From 971610357a18e5a468f0d7f894715d1f7c736bbb Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 9 Nov 2026 08:28:40 +0000 Subject: [PATCH 1/7] Dates, agenda and reminders; password-protected notes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Editor page (rebuilt from ivynote): task date chips, the date picker and "@明天 9点" completion; password protection through @ivynote/editor/protection — lock panel, sealing every edit, the set / change / remove / lock dialogs. The app only ever sees sealed bodies; the page reports {protected, locked} for the note menu. - Note menu: 日期与提醒, 设置密码 / 更改密码 / 移除密码 / 立即锁定; a date button in the format bar; protected notes show a lock and cannot be shared. - Agenda sheet (library menu → 日程): open dated to-dos across the library, check off in place, open a note at its task. - Reminders: the next reminders of a library become AlarmManager alarms a moment after any change (exact when allowed), are restored after a reboot or update, and open their note when tapped. Android 13+ asks for notification permission the first time there is something to remind of. - core: Tasks (parse, reminders, agenda, toggle as the editor does) and NoteLock.isEncrypted, with tests; search matches protected notes by title. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01NZ7eDpLFZCVDPw4eURZJLR --- README.md | 13 ++ app/src/main/AndroidManifest.xml | 14 ++ app/src/main/assets/editor/editor.css | 2 +- app/src/main/assets/editor/main.js | 153 +++++++++-------- .../app/ivynote/android/LibrarySession.kt | 12 ++ .../app/ivynote/android/MainActivity.kt | 59 +++++++ .../app/ivynote/android/editor/EditorHost.kt | 15 ++ .../ivynote/android/reminders/Reminders.kt | 158 ++++++++++++++++++ .../app/ivynote/android/ui/AgendaSheet.kt | 112 +++++++++++++ .../app/ivynote/android/ui/LibraryScreen.kt | 27 +++ .../app/ivynote/android/ui/NoteScreen.kt | 35 +++- .../app/ivynote/android/ui/ShelfPane.kt | 3 + .../main/kotlin/app/ivynote/core/Search.kt | 6 +- .../main/kotlin/app/ivynote/core/Strings.kt | 66 ++++++++ .../src/main/kotlin/app/ivynote/core/Tasks.kt | 153 +++++++++++++++++ .../test/kotlin/app/ivynote/core/TasksTest.kt | 72 ++++++++ editor-web/build.sh | 5 +- editor-web/main.ts | 95 ++++++++--- 18 files changed, 904 insertions(+), 96 deletions(-) create mode 100644 app/src/main/kotlin/app/ivynote/android/reminders/Reminders.kt create mode 100644 app/src/main/kotlin/app/ivynote/android/ui/AgendaSheet.kt create mode 100644 core/src/main/kotlin/app/ivynote/core/Tasks.kt create mode 100644 core/src/test/kotlin/app/ivynote/core/TasksTest.kt diff --git a/README.md b/README.md index e08a178..3fc269c 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,19 @@ repository does not keep a copy. push. A refused file (too large) is reported and does not hold back sync. A local library keeps its files on the device (de-duplicated by SHA-256) and uploads them when it turns on sync. +- **Dates and reminders** (guide 9.4, 11.8): `@明天 9点` completion, date chips + and the picker come with the editor page; the format bar has a date button. + The agenda (library menu → 日程) lists open dated to-dos across the + library, checks them off and opens a note at its task. Reminders are + system alarms (`reminders/Reminders.kt`, `Tasks` in core): set again a + moment after any change, restored after a reboot or update, exact when the + system allows it. Android 13+ asks for notification permission the first + time there is something to remind of; a tapped reminder opens its note. +- **Password-protected notes** (guide 8.4): the editor page shows the lock + panel, asks for the password and seals every edit; the app only ever stores + and syncs the sealed body. Note menu: 设置密码 / 更改密码 / 移除密码 / + 立即锁定. Protected notes are found by title only, cannot be shared, and + take no part in the agenda or reminders. - **Media library**: filters (all, images, video, audio, files, unreferenced, trash), file name search, a thumbnail grid, and details: preview, the notes that reference the file, rename, public link (make, copy, revoke), diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 4661295..0967359 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -6,6 +6,10 @@ + + + + + + + + + + + + :first-child{margin-top:0}.prose-ivy h1,.prose-ivy h2,.prose-ivy h3{font-family:var(--font-serif);font-weight:600}.prose-ivy h1{margin-bottom:.75rem;margin-top:2.5rem;font-size:1.6em;line-height:1.375}.prose-ivy h2{margin-bottom:.5rem;margin-top:2.25rem;font-size:1.3em;line-height:1.375}.prose-ivy h3{margin-bottom:.5rem;margin-top:1.75rem;font-size:1.1em}.prose-ivy h4,.prose-ivy h5,.prose-ivy h6{margin-bottom:.375rem;margin-top:1.5rem;font-weight:600}.prose-ivy ol,.prose-ivy p,.prose-ivy ul{margin-top:1rem;margin-bottom:1rem}.prose-ivy ol,.prose-ivy ul{padding-left:1.5rem}.prose-ivy ul{list-style:disc}.prose-ivy ol{list-style:decimal}.prose-ivy li{margin-top:.375rem;margin-bottom:.375rem}.prose-ivy li::marker{color:rgb(var(--faint))}.prose-ivy li.task{list-style:none;margin-left:-1.5rem;display:flex;gap:.6rem;align-items:flex-start}.prose-ivy li.task input{margin-top:.5em;accent-color:rgb(var(--ivy));width:1rem;height:1rem;flex:none}.prose-ivy li.task.done>span{color:rgb(var(--muted));text-decoration:line-through}.prose-ivy a{color:rgb(var(--ivy));text-decoration:underline;text-decoration-color:rgb(var(--ivy)/.3);text-decoration-thickness:1px;text-underline-offset:3px;transition:text-decoration-color .18s ease}.prose-ivy a:hover{text-decoration-color:rgb(var(--ivy))}.prose-ivy a.wikilink{text-decoration-style:solid}.prose-ivy a.wikilink.missing{color:rgb(var(--muted));text-decoration-style:dashed}.prose-ivy code{border-radius:.375rem;padding:.125rem .375rem;font-size:.85em}.prose-ivy code,.prose-ivy pre{font-family:SF Mono,JetBrains Mono,ui-monospace,SFMono-Regular,Menlo,Consolas,PingFang SC,monospace;background:rgb(var(--code-bg))}.prose-ivy pre{margin-top:1.25rem;margin-bottom:1.25rem;overflow-x:auto;border-radius:1rem;padding:1rem 1.25rem;font-size:13px;line-height:1.7}.prose-ivy pre code{background-color:transparent;padding:0;font-size:13px}.prose-ivy blockquote{margin-top:1.25rem;margin-bottom:1.25rem;padding-left:1.25rem;font-family:Iowan Old Style,Charter,"Source Serif 4",Songti SC,"Noto Serif SC","Source Han Serif SC",STSong,Georgia,serif;--tw-text-opacity:1;color:rgb(var(--ink-2)/var(--tw-text-opacity,1));box-shadow:inset 2px 0 0 rgb(var(--ivy)/.35)}.prose-ivy hr{margin-top:2.5rem;margin-bottom:2.5rem;border-width:0;text-align:center}.prose-ivy hr:after{content:"· · ·";color:rgb(var(--faint));letter-spacing:.4em}.prose-ivy img,.prose-ivy video{margin-top:1.25rem;margin-bottom:1.25rem;max-height:70vh;border-radius:1rem;max-width:100%}.prose-ivy table{margin-top:1.25rem;margin-bottom:1.25rem;display:block;width:100%;border-collapse:collapse;overflow-x:auto;font-size:14px}.prose-ivy td,.prose-ivy th{padding:.5rem .75rem;text-align:left;box-shadow:inset 0 -1px 0 rgb(var(--line))}.prose-ivy th{font-weight:500;--tw-text-opacity:1;color:rgb(var(--muted)/var(--tw-text-opacity,1))}.prose-ivy td[align=center],.prose-ivy th[align=center]{text-align:center}.prose-ivy td[align=right],.prose-ivy th[align=right]{text-align:right}.prose-ivy mark{background:rgb(var(--warn)/.22);color:inherit;border-radius:3px;padding:0 2px}.prose-ivy .file-card{margin-top:.5rem;margin-bottom:.5rem;display:inline-flex;align-items:center;gap:.5rem;border-radius:.75rem;padding:.5rem .875rem;font-size:13px;background:rgb(var(--code-bg));color:rgb(var(--ink))}.prose-ivy .file-card,.prose-ivy sup.cite a{text-decoration-line:none}.prose-ivy sup.cite a{margin-left:.125rem;border-radius:.375rem;padding:1px .375rem;font-size:11px;background:rgb(var(--ivy-soft));color:rgb(var(--ivy-ink))}.prose-sm{font-size:15px;line-height:1.8}.prose-sm p{margin-top:.625rem;margin-bottom:.625rem}.prose-ivy .mermaid-diagram{display:flex;justify-content:center;margin:1.2em 0;padding:16px;border-radius:16px;background:rgb(var(--code-bg)/.5);overflow-x:auto}.prose-ivy .mermaid-diagram svg{max-width:100%;height:auto}.prose-ivy .mermaid-diagram.mermaid-error{justify-content:flex-start;font-family:var(--font-mono);font-size:.8em;color:rgb(var(--danger))}.drag-ghost{position:fixed;top:-200px;left:0;padding:6px 14px;border-radius:999px;background:rgb(var(--ivy));color:rgb(var(--on-ivy));font-size:13px;font-weight:500;white-space:nowrap}.split-preview{font-size:var(--preview-size)}@media (max-width:767px){.split-preview{font-size:var(--editor-size);line-height:1.9}.split-preview h1{font-size:1.4em}.split-preview h2{font-size:1.2em}.split-preview pre{padding:10px 12px}.split-preview td,.split-preview th{white-space:nowrap}.split-preview ol,.split-preview ul{padding-left:1.1em}}.ivy-editor.mode-source .cm-scroller{font-family:var(--font-mono);line-height:1.9}.ivy-editor .cm-h{font-family:var(--font-serif);font-weight:600;line-height:1.4}.ivy-editor .cm-h1{font-size:1.6em;padding-top:.7em!important;padding-bottom:.15em!important}.ivy-editor .cm-h2{font-size:1.3em;padding-top:.7em!important;padding-bottom:.1em!important}.ivy-editor .cm-h3{font-size:1.1em;padding-top:.5em!important}.ivy-editor .cm-h4,.ivy-editor .cm-h5,.ivy-editor .cm-h6{font-size:1em;padding-top:.3em!important}.ivy-editor .cm-src-h,.ivy-editor .cm-strong{font-weight:600}.ivy-editor .cm-em{font-style:italic}.ivy-editor .cm-strike,.ivy-editor .cm-task-done{text-decoration:line-through;color:rgb(var(--muted))}.ivy-editor .cm-inline-code{font-family:var(--font-mono);font-size:.85em;background:rgb(var(--code-bg));border-radius:6px;padding:2px 6px}.ivy-editor .cm-link{color:rgb(var(--ivy));text-decoration:underline;text-decoration-color:rgb(var(--ivy)/.3);text-decoration-thickness:1px;text-underline-offset:3px}.ivy-editor .cm-wikilink{color:rgb(var(--ivy));cursor:pointer}.ivy-editor .cm-wikilink-rendered{text-decoration:underline;text-decoration-color:rgb(var(--ivy)/.3);text-decoration-thickness:1px;text-underline-offset:3px}.ivy-editor .cm-wikilink-missing{color:rgb(var(--muted));-webkit-text-decoration:underline dashed;text-decoration:underline dashed;text-underline-offset:3px}.ivy-editor .cm-quote{box-shadow:inset 2px 0 0 rgb(var(--ivy)/.35);padding-left:18px!important;font-family:var(--font-serif);color:rgb(var(--ink-2))}.ivy-editor .cm-list-mark{color:rgb(var(--faint))}.ivy-editor .cm-codeblock{font-family:var(--font-mono);font-size:.82em;background:rgb(var(--code-bg));padding:0 20px!important}.ivy-editor .cm-codeblock-src{padding:0!important;font-size:1em;background:rgb(var(--code-bg)/.6)}.ivy-editor .cm-codeblock-first{border-radius:16px 16px 0 0;padding-top:12px!important;color:rgb(var(--faint))}.ivy-editor .cm-codeblock-last{border-radius:0 0 16px 16px;padding-bottom:12px!important;color:rgb(var(--faint))}.ivy-editor .cm-media{display:inline-block;max-width:100%;vertical-align:top;margin:10px 0}.ivy-editor .cm-media img,.ivy-editor .cm-media video{display:block;max-width:100%;max-height:60vh;border-radius:16px}.ivy-editor .cm-media audio{display:block;width:min(100%,420px)}.ivy-editor .cm-media-broken{width:180px;height:120px;border-radius:16px;background:rgb(var(--sunken))}.ivy-editor .cm-media-broken img{display:none}.ivy-editor .cm-file-card{display:inline-flex;align-items:center;gap:6px;background:rgb(var(--code-bg));border-radius:12px;padding:7px 14px;font-size:13px;color:rgb(var(--ink));text-decoration:none}.ivy-editor .cm-task{width:1.05em;height:1.05em;margin:0 .3em 0 0;vertical-align:-.15em;accent-color:rgb(var(--ivy));cursor:pointer}.ivy-editor .cm-bullet{display:inline-block;width:.7em;color:rgb(var(--faint));font-weight:700}.ivy-editor .cm-table{white-space:normal;overflow-x:auto;margin:4px 0;border-radius:12px;cursor:text;transition:background-color .2s}.ivy-editor .cm-table:hover{background:rgb(var(--code-bg)/.5)}.ivy-editor .cm-table table{margin:0;font-size:.92em;line-height:1.6}.ivy-editor .cm-table td:empty,.ivy-editor .cm-table th:empty{min-width:2em}.ivy-editor .cm-mermaid{display:flex;justify-content:center;min-height:48px;margin:6px 0;padding:16px;border-radius:16px;background:rgb(var(--code-bg)/.5);cursor:pointer;overflow-x:auto;transition:background-color .2s}.ivy-editor .cm-mermaid:hover{background:rgb(var(--code-bg))}.ivy-editor .cm-mermaid svg{max-width:100%;height:auto}.ivy-editor .cm-mermaid-loading{min-height:120px}.ivy-editor .cm-mermaid.mermaid-error{justify-content:flex-start;font-family:var(--font-mono);font-size:.8em;color:rgb(var(--danger))}.ivy-editor .cm-hr-widget{display:inline-block;width:100%;height:1px;vertical-align:middle;background:rgb(var(--line))}:root{--editor-size:16px;--gutter:20px}body,html{margin:0;background:rgb(var(--surface));-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent;font-family:system-ui,Roboto,Noto Sans CJK SC,Noto Sans SC,sans-serif}body{min-height:100vh;padding-bottom:40vh;box-sizing:border-box}#editor{padding:4px var(--gutter) 0}.ivy-editor .cm-editor{font-size:var(--editor-size)}.ivy-editor .cm-scroller{overflow:visible!important}@media (min-width:700px){:root{--gutter:44px}#editor{max-width:760px;margin:0 auto}}.ivy-editor .cm-table td,.ivy-editor .cm-table th{min-width:5em} \ No newline at end of file +*,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:-apple-system,BlinkMacSystemFont,SF Pro Text,Inter,Segoe UI,PingFang SC,Hiragino Sans GB,Noto Sans SC,Microsoft YaHei,sans-serif;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:SF Mono,JetBrains Mono,ui-monospace,SFMono-Regular,Menlo,Consolas,PingFang SC,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.btn{display:inline-flex;height:2.25rem;align-items:center;justify-content:center;gap:.375rem;white-space:nowrap;border-radius:9999px;padding-left:1rem;padding-right:1rem;font-size:13px;font-weight:500}.btn:disabled{pointer-events:none;opacity:.4}.btn{transition:background-color .18s ease,color .18s ease,transform .3s var(--spring)}.btn:active{transform:scale(.97)}.input{height:2.5rem;width:100%;border-radius:.75rem;--tw-bg-opacity:1;background-color:rgb(var(--sunken)/var(--tw-bg-opacity,1));padding-left:.875rem;padding-right:.875rem;font-size:14px;--tw-text-opacity:1;color:rgb(var(--ink)/var(--tw-text-opacity,1));outline:2px solid transparent;outline-offset:2px}.input::-moz-placeholder{--tw-text-opacity:1;color:rgb(var(--faint)/var(--tw-text-opacity,1))}.input::placeholder{--tw-text-opacity:1;color:rgb(var(--faint)/var(--tw-text-opacity,1))}.input{box-shadow:inset 0 0 0 1px transparent;transition:background-color .2s ease,box-shadow .2s ease}.input:focus{--tw-bg-opacity:1;background-color:rgb(var(--surface)/var(--tw-bg-opacity,1));box-shadow:inset 0 0 0 1px rgb(var(--ivy)/.4),0 0 0 4px rgb(var(--ivy)/.08)}select.input{-webkit-appearance:none;-moz-appearance:none;appearance:none;padding-right:2.25rem;background-image:var(--select-chevron);background-position:right .75rem center;background-repeat:no-repeat;background-size:16px}.label{margin-bottom:.375rem;display:block;color:rgb(var(--muted)/var(--tw-text-opacity,1))}.chip,.label{font-size:13px;--tw-text-opacity:1}.chip{display:inline-flex;height:2rem;flex-shrink:0;align-items:center;gap:.375rem;border-radius:9999px;padding-left:.75rem;padding-right:.75rem;color:rgb(var(--ink-2)/var(--tw-text-opacity,1))}.chip:hover{--tw-bg-opacity:1;background-color:rgb(var(--sunken)/var(--tw-bg-opacity,1))}.chip{transition:background-color .18s ease,color .18s ease}.row{display:flex;align-items:center;gap:.625rem;border-radius:.75rem;padding-left:.75rem;padding-right:.75rem;font-size:14px;--tw-text-opacity:1;color:rgb(var(--ink-2)/var(--tw-text-opacity,1))}.row:hover{--tw-text-opacity:1;color:rgb(var(--ink)/var(--tw-text-opacity,1))}.row{transition:color .16s ease}.row[data-active]{font-weight:500;--tw-text-opacity:1;color:rgb(var(--ink)/var(--tw-text-opacity,1))}.visible{visibility:visible}.block{display:block}.inline{display:inline}.\!table{display:table!important}.table{display:table}.hidden{display:none}.border{border-width:1px}.italic{font-style:italic}.line-through{text-decoration-line:line-through}.outline{outline-style:solid}.blur{--tw-blur:blur(8px)}.blur,.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}:root{--font-mono:"SF Mono","JetBrains Mono",ui-monospace,SFMono-Regular,Menlo,Consolas,"PingFang SC",monospace;--font-serif:"Iowan Old Style",Charter,"Source Serif 4","Songti SC","Noto Serif SC","Source Han Serif SC",STSong,Georgia,serif;--shelf-w:296px;--spring:cubic-bezier(0.22,1,0.36,1)}@supports (transition-timing-function:linear(0,1)){:root{--spring:linear(0,0.009,0.035 2.1%,0.141 4.4%,0.723 12.9%,0.938 16.7%,1.017 18.9%,1.077 21.2%,1.121 24%,1.149 27.3%,1.159 31.4%,1.14 36.4%,1.052 49.3%,1.019 55.5%,1.003 61.8%,0.995 70.1%,1)}}:root,:root[data-theme=light]{color-scheme:light;--canvas:247 248 249;--surface:255 255 255;--sunken:241 243 245;--ink:28 31 34;--ink-2:70 75 80;--muted:112 118 124;--faint:160 166 172;--line:230 233 236;--hover:234 237 240;--ivy:40 122 82;--ivy-hover:31 104 69;--ivy-soft:229 243 235;--on-ivy:255 255 255;--ivy-ink:27 92 60;--warn:190 134 48;--warn-ink:110 78 26;--warn-soft:252 244 228;--danger:176 62 54;--danger-soft:252 235 233;--ok:74 142 104;--code-bg:244 246 248;--shadow-paper:0 0 0 0.5px rgba(16,24,32,.05),0 1px 2px rgba(16,24,32,.03),0 12px 32px -12px rgba(16,24,32,.08);--shadow-float:0 0 0 0.5px rgba(16,24,32,.06),0 2px 6px rgba(16,24,32,.05),0 12px 28px -10px rgba(16,24,32,.14);--shadow-lift:0 0 0 0.5px rgba(16,24,32,.07),0 8px 16px -6px rgba(16,24,32,.08),0 32px 64px -16px rgba(16,24,32,.22);--tag-green-fg:#3f7a5b;--tag-blue-fg:#4f6a9a;--tag-amber-fg:#a0702c;--tag-pink-fg:#a65a7c;--tag-gray-fg:#6f767d;--tag-purple-fg:#7a62a8;--select-chevron:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%2370767c' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")}:root[data-theme=dark]{color-scheme:dark;--canvas:16 18 20;--surface:25 27 30;--sunken:34 37 41;--ink:232 235 238;--ink-2:190 195 200;--muted:138 144 150;--faint:96 101 107;--line:44 48 52;--hover:38 41 45;--ivy:86 180 130;--ivy-hover:110 196 150;--ivy-soft:28 50 39;--on-ivy:10 28 18;--ivy-ink:150 224 182;--warn:214 170 98;--warn-ink:232 205 158;--warn-soft:48 40 26;--danger:226 128 116;--danger-soft:58 33 31;--ok:124 190 150;--code-bg:31 34 38;--shadow-paper:0 0 0 0.5px hsla(0,0%,100%,.05),0 12px 32px -12px rgba(0,0,0,.5);--shadow-float:0 0 0 0.5px hsla(0,0%,100%,.07),0 12px 28px -10px rgba(0,0,0,.6);--shadow-lift:0 0 0 0.5px hsla(0,0%,100%,.08),0 32px 64px -16px rgba(0,0,0,.7);--tag-green-fg:#92c4a6;--tag-blue-fg:#9db2dc;--tag-amber-fg:#d9b77e;--tag-pink-fg:#dba6bf;--tag-gray-fg:#a3a9af;--tag-purple-fg:#bcaae0;--select-chevron:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' stroke='%238a9096' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.75' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")}body,html{height:100%;background:rgb(var(--canvas));color:rgb(var(--ink));-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility}body{font-family:-apple-system,BlinkMacSystemFont,SF Pro Text,Inter,Segoe UI,PingFang SC,Hiragino Sans GB,Noto Sans SC,Microsoft YaHei,sans-serif;font-size:14px;line-height:1.5;overscroll-behavior:none}::-moz-selection{background:rgb(var(--ivy)/.18)}::selection{background:rgb(var(--ivy)/.18)}:focus{outline:none}:focus-visible{outline:2px solid rgb(var(--ivy)/.45);outline-offset:2px}button{-webkit-user-select:none;-moz-user-select:none;user-select:none}.glide{position:relative;isolation:isolate}.glide-pill{position:absolute;left:0;top:0;z-index:-1;width:var(--gw,0);height:var(--gh,0);transform:translate3d(var(--gx,0),var(--gy,0),0);opacity:var(--go,0);border-radius:12px;background:rgb(var(--ink)/.055);pointer-events:none}:root[data-theme=dark] .glide-pill{background:rgb(var(--ink)/.08)}.glide[data-glide-ready] .glide-pill{transition:transform .46s var(--spring),width .46s var(--spring),height .3s var(--soft,ease),opacity .2s ease}.veil:before{content:"";position:sticky;top:0;z-index:5;display:block;height:20px;margin-bottom:-20px;pointer-events:none;background:linear-gradient(to bottom,rgb(var(--veil,var(--surface))),rgb(var(--veil,var(--surface))/0))}.safe-top{padding-top:env(safe-area-inset-top)}.safe-bottom{padding-bottom:env(safe-area-inset-bottom)}@view-transition{navigation:none}::view-transition-group(root){animation-duration:.42s;animation-timing-function:cubic-bezier(.22,1,.36,1)}::view-transition-new(root),::view-transition-old(root){animation-duration:.26s;animation-timing-function:ease}::view-transition-old(dock){display:none}::view-transition-new(dock){animation:none}:root[data-nav=push]::view-transition-old(root){animation:vt-recede .42s cubic-bezier(.22,1,.36,1) both}:root[data-nav=push]::view-transition-new(root){animation:vt-enter .42s cubic-bezier(.22,1,.36,1) both;box-shadow:var(--shadow-lift)}:root[data-nav=pop]::view-transition-old(root){z-index:2;animation:vt-leave .34s cubic-bezier(.22,1,.36,1) both;box-shadow:var(--shadow-lift)}:root[data-nav=pop]::view-transition-new(root){animation:vt-return .34s cubic-bezier(.22,1,.36,1) both}@keyframes vt-enter{0%{transform:translateX(100%)}}@keyframes vt-recede{to{transform:translateX(-22%);filter:brightness(.94)}}@keyframes vt-leave{to{transform:translateX(100%)}}@keyframes vt-return{0%{transform:translateX(-22%);filter:brightness(.94)}}@media (prefers-reduced-motion:reduce){*,::view-transition-group(*),::view-transition-new(*),::view-transition-old(*),:after,:before{animation-duration:1ms!important;animation-delay:0ms!important;transition-duration:1ms!important}}.prose-ivy{font-size:16px;line-height:1.85;--tw-text-opacity:1;color:rgb(var(--ink)/var(--tw-text-opacity,1));overflow-wrap:anywhere}.prose-ivy>:first-child{margin-top:0}.prose-ivy h1,.prose-ivy h2,.prose-ivy h3{font-family:var(--font-serif);font-weight:600}.prose-ivy h1{margin-bottom:.75rem;margin-top:2.5rem;font-size:1.6em;line-height:1.375}.prose-ivy h2{margin-bottom:.5rem;margin-top:2.25rem;font-size:1.3em;line-height:1.375}.prose-ivy h3{margin-bottom:.5rem;margin-top:1.75rem;font-size:1.1em}.prose-ivy h4,.prose-ivy h5,.prose-ivy h6{margin-bottom:.375rem;margin-top:1.5rem;font-weight:600}.prose-ivy ol,.prose-ivy p,.prose-ivy ul{margin-top:1rem;margin-bottom:1rem}.prose-ivy ol,.prose-ivy ul{padding-left:1.5rem}.prose-ivy ul{list-style:disc}.prose-ivy ol{list-style:decimal}.prose-ivy li{margin-top:.375rem;margin-bottom:.375rem}.prose-ivy li::marker{color:rgb(var(--faint))}.prose-ivy li.task{list-style:none;margin-left:-1.5rem;display:flex;gap:.6rem;align-items:flex-start}.prose-ivy li.task input{margin-top:.5em;accent-color:rgb(var(--ivy));width:1rem;height:1rem;flex:none}.prose-ivy li.task.done>span{color:rgb(var(--muted));text-decoration:line-through}.prose-ivy a{color:rgb(var(--ivy));text-decoration:underline;text-decoration-color:rgb(var(--ivy)/.3);text-decoration-thickness:1px;text-underline-offset:3px;transition:text-decoration-color .18s ease}.prose-ivy a:hover{text-decoration-color:rgb(var(--ivy))}.prose-ivy a.wikilink{text-decoration-style:solid}.prose-ivy a.wikilink.missing{color:rgb(var(--muted));text-decoration-style:dashed}.prose-ivy code{border-radius:.375rem;padding:.125rem .375rem;font-size:.85em}.prose-ivy code,.prose-ivy pre{font-family:SF Mono,JetBrains Mono,ui-monospace,SFMono-Regular,Menlo,Consolas,PingFang SC,monospace;background:rgb(var(--code-bg))}.prose-ivy pre{margin-top:1.25rem;margin-bottom:1.25rem;overflow-x:auto;border-radius:1rem;padding:1rem 1.25rem;font-size:13px;line-height:1.7}.prose-ivy pre code{background-color:transparent;padding:0;font-size:13px}.prose-ivy blockquote{margin-top:1.25rem;margin-bottom:1.25rem;padding-left:1.25rem;font-family:Iowan Old Style,Charter,"Source Serif 4",Songti SC,"Noto Serif SC","Source Han Serif SC",STSong,Georgia,serif;--tw-text-opacity:1;color:rgb(var(--ink-2)/var(--tw-text-opacity,1));box-shadow:inset 2px 0 0 rgb(var(--ivy)/.35)}.prose-ivy hr{margin-top:2.5rem;margin-bottom:2.5rem;border-width:0;text-align:center}.prose-ivy hr:after{content:"· · ·";color:rgb(var(--faint));letter-spacing:.4em}.prose-ivy img,.prose-ivy video{margin-top:1.25rem;margin-bottom:1.25rem;max-height:70vh;border-radius:1rem;max-width:100%}.prose-ivy table{margin-top:1.25rem;margin-bottom:1.25rem;display:block;width:100%;border-collapse:collapse;overflow-x:auto;font-size:14px}.prose-ivy td,.prose-ivy th{padding:.5rem .75rem;text-align:left;box-shadow:inset 0 -1px 0 rgb(var(--line))}.prose-ivy th{font-weight:500;--tw-text-opacity:1;color:rgb(var(--muted)/var(--tw-text-opacity,1))}.prose-ivy td[align=center],.prose-ivy th[align=center]{text-align:center}.prose-ivy td[align=right],.prose-ivy th[align=right]{text-align:right}.prose-ivy mark{background:rgb(var(--warn)/.22);color:inherit;border-radius:3px;padding:0 2px}.prose-ivy .file-card{margin-top:.5rem;margin-bottom:.5rem;display:inline-flex;align-items:center;gap:.5rem;border-radius:.75rem;padding:.5rem .875rem;font-size:13px;background:rgb(var(--code-bg));color:rgb(var(--ink))}.prose-ivy .file-card,.prose-ivy sup.cite a{text-decoration-line:none}.prose-ivy sup.cite a{margin-left:.125rem;border-radius:.375rem;padding:1px .375rem;font-size:11px;background:rgb(var(--ivy-soft));color:rgb(var(--ivy-ink))}.prose-sm{font-size:15px;line-height:1.8}.prose-sm p{margin-top:.625rem;margin-bottom:.625rem}.prose-ivy .mermaid-diagram{display:flex;justify-content:center;margin:1.2em 0;padding:16px;border-radius:16px;background:rgb(var(--code-bg)/.5);overflow-x:auto}.prose-ivy .mermaid-diagram svg{max-width:100%;height:auto}.prose-ivy .mermaid-diagram.mermaid-error{justify-content:flex-start;font-family:var(--font-mono);font-size:.8em;color:rgb(var(--danger))}.drag-ghost{position:fixed;top:-200px;left:0;padding:6px 14px;border-radius:999px;background:rgb(var(--ivy));color:rgb(var(--on-ivy));font-size:13px;font-weight:500;white-space:nowrap}.split-preview{font-size:var(--preview-size)}@media (max-width:767px){.split-preview{font-size:var(--editor-size);line-height:1.9}.split-preview h1{font-size:1.4em}.split-preview h2{font-size:1.2em}.split-preview pre{padding:10px 12px}.split-preview td,.split-preview th{white-space:nowrap}.split-preview ol,.split-preview ul{padding-left:1.1em}}.ivy-editor.mode-source .cm-scroller{font-family:var(--font-mono);line-height:1.9}.ivy-editor .cm-h{font-family:var(--font-serif);font-weight:600;line-height:1.4}.ivy-editor .cm-h1{font-size:1.6em;padding-top:.7em!important;padding-bottom:.15em!important}.ivy-editor .cm-h2{font-size:1.3em;padding-top:.7em!important;padding-bottom:.1em!important}.ivy-editor .cm-h3{font-size:1.1em;padding-top:.5em!important}.ivy-editor .cm-h4,.ivy-editor .cm-h5,.ivy-editor .cm-h6{font-size:1em;padding-top:.3em!important}.ivy-editor .cm-src-h,.ivy-editor .cm-strong{font-weight:600}.ivy-editor .cm-em{font-style:italic}.ivy-editor .cm-strike,.ivy-editor .cm-task-done{text-decoration:line-through;color:rgb(var(--muted))}.ivy-editor .cm-inline-code{font-family:var(--font-mono);font-size:.85em;background:rgb(var(--code-bg));border-radius:6px;padding:2px 6px}.ivy-editor .cm-link{color:rgb(var(--ivy));text-decoration:underline;text-decoration-color:rgb(var(--ivy)/.3);text-decoration-thickness:1px;text-underline-offset:3px}.ivy-editor .cm-wikilink{color:rgb(var(--ivy));cursor:pointer}.ivy-editor .cm-wikilink-rendered{text-decoration:underline;text-decoration-color:rgb(var(--ivy)/.3);text-decoration-thickness:1px;text-underline-offset:3px}.ivy-editor .cm-wikilink-missing{color:rgb(var(--muted));-webkit-text-decoration:underline dashed;text-decoration:underline dashed;text-underline-offset:3px}.ivy-editor .cm-quote{box-shadow:inset 2px 0 0 rgb(var(--ivy)/.35);padding-left:18px!important;font-family:var(--font-serif);color:rgb(var(--ink-2))}.ivy-editor .cm-list-mark{color:rgb(var(--faint))}.ivy-editor .cm-codeblock{font-family:var(--font-mono);font-size:.82em;background:rgb(var(--code-bg));padding:0 20px!important}.ivy-editor .cm-codeblock-src{padding:0!important;font-size:1em;background:rgb(var(--code-bg)/.6)}.ivy-editor .cm-codeblock-first{border-radius:16px 16px 0 0;padding-top:12px!important;color:rgb(var(--faint))}.ivy-editor .cm-codeblock-last{border-radius:0 0 16px 16px;padding-bottom:12px!important;color:rgb(var(--faint))}.ivy-editor .cm-media{display:inline-block;max-width:100%;vertical-align:top;margin:10px 0}.ivy-editor .cm-media img,.ivy-editor .cm-media video{display:block;max-width:100%;max-height:60vh;border-radius:16px}.ivy-editor .cm-media audio{display:block;width:min(100%,420px)}.ivy-editor .cm-media-broken{width:180px;height:120px;border-radius:16px;background:rgb(var(--sunken))}.ivy-editor .cm-media-broken img{display:none}.ivy-editor .cm-file-card{display:inline-flex;align-items:center;gap:6px;background:rgb(var(--code-bg));border-radius:12px;padding:7px 14px;font-size:13px;color:rgb(var(--ink));text-decoration:none}.ivy-editor .cm-task{width:1.05em;height:1.05em;margin:0 .3em 0 0;vertical-align:-.15em;accent-color:rgb(var(--ivy));cursor:pointer}.ivy-editor .cm-bullet{display:inline-block;width:.7em;color:rgb(var(--faint));font-weight:700}.ivy-editor .cm-table{white-space:normal;overflow-x:auto;margin:4px 0;border-radius:12px;cursor:text;transition:background-color .2s}.ivy-editor .cm-table:hover{background:rgb(var(--code-bg)/.5)}.ivy-editor .cm-table table{margin:0;font-size:.92em;line-height:1.6}.ivy-editor .cm-table td:empty,.ivy-editor .cm-table th:empty{min-width:2em}.ivy-editor .cm-mermaid{display:flex;justify-content:center;min-height:48px;margin:6px 0;padding:16px;border-radius:16px;background:rgb(var(--code-bg)/.5);cursor:pointer;overflow-x:auto;transition:background-color .2s}.ivy-editor .cm-mermaid:hover{background:rgb(var(--code-bg))}.ivy-editor .cm-mermaid svg{max-width:100%;height:auto}.ivy-editor .cm-mermaid-loading{min-height:120px}.ivy-editor .cm-mermaid.mermaid-error{justify-content:flex-start;font-family:var(--font-mono);font-size:.8em;color:rgb(var(--danger))}.ivy-editor .cm-hr-widget{display:inline-block;width:100%;height:1px;vertical-align:middle;background:rgb(var(--line))}.ivy-editor .cm-due{display:inline-flex;align-items:center;gap:2px;margin:0 0 0 6px;padding:0 8px;border-radius:999px;font-size:.78em;line-height:1.7;vertical-align:.08em;white-space:nowrap;color:rgb(var(--ink-2));background:rgb(var(--sunken));cursor:pointer;transition:background-color .15s}.ivy-editor .cm-due:hover{background:rgb(var(--hover))}.ivy-editor .cm-due-today{color:rgb(var(--ivy-ink));background:rgb(var(--ivy-soft))}.ivy-editor .cm-due-over{color:rgb(var(--danger));background:rgb(var(--danger-soft))}.ivy-editor .cm-due-repeat{color:rgb(var(--muted))}.ivy-editor .cm-due-done{color:rgb(var(--faint));background:transparent;cursor:default;text-decoration:none}.ivy-editor .cm-due-src{color:rgb(var(--ivy))}.ivy-due-picker{position:fixed;z-index:80;width:288px;max-width:calc(100vw - 16px);padding:12px;border-radius:18px;background:rgb(var(--surface));color:rgb(var(--ink));box-shadow:var(--shadow-lift);font-size:14px;animation:ivy-pop .16s ease-out}.ivy-due-quick{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}.ivy-due-chip{height:30px;padding:0 11px;border-radius:999px;background:rgb(var(--sunken));color:rgb(var(--ink-2));font-size:13px}.ivy-due-chip:focus-visible,.ivy-due-chip:hover{background:rgb(var(--ivy-soft));color:rgb(var(--ivy-ink));outline:none}.ivy-due-row{display:flex;align-items:center;gap:10px;margin-top:6px}.ivy-due-row>span{width:2.6em;flex-shrink:0;color:rgb(var(--muted));font-size:13px}.ivy-due-input{flex:1;min-width:0;height:36px;padding:0 10px;border-radius:10px;border:1px solid rgb(var(--line));background:rgb(var(--canvas));color:rgb(var(--ink));font:inherit;font-size:14px}.ivy-due-note{margin-top:8px;color:rgb(var(--faint));font-size:12px;line-height:1.5}.ivy-due-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}.ivy-due-btn{height:34px;padding:0 14px;border-radius:999px;color:rgb(var(--ink-2));font-size:13.5px}.ivy-due-btn:hover{background:rgb(var(--sunken))}.ivy-due-ok{background:rgb(var(--ivy));color:rgb(var(--on-ivy))}.ivy-due-ok:hover{background:rgb(var(--ivy-hover))}.ivy-editor .cm-query .cm-table-total td,.ivy-editor .cm-table-total td{font-weight:600;font-variant-numeric:tabular-nums;border-top:1.5px solid rgb(var(--line))}.ivy-editor .cm-table-total-label{color:rgb(var(--muted))}.ivy-editor .cm-table-sort{margin-left:4px;padding:0 4px;border-radius:6px;color:rgb(var(--faint));font-size:.85em;opacity:0;transition:opacity .15s}.ivy-editor .cm-table-sort.on,.ivy-editor .cm-table-sort:focus-visible,.ivy-editor .cm-table:hover .cm-table-sort{opacity:1}.ivy-editor .cm-table-sort:hover{background:rgb(var(--sunken));color:rgb(var(--ink))}@media (pointer:coarse){.ivy-editor .cm-table-sort{opacity:.6}}.ivy-editor .cm-frontmatter{font-family:var(--font-mono);font-size:.85em;color:rgb(var(--muted))}.ivy-editor .cm-props{display:grid;gap:4px;margin:2px 0 10px;padding:10px 14px;border-radius:14px;background:rgb(var(--code-bg)/.55);font-size:.86em;cursor:text}.ivy-editor .cm-props-empty{color:rgb(var(--faint))}.ivy-editor .cm-prop{display:flex;gap:12px;align-items:baseline;line-height:1.7}.ivy-editor .cm-prop-key{flex:0 0 auto;min-width:5em;max-width:40%;color:rgb(var(--muted));overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ivy-editor .cm-prop-val{display:flex;flex-wrap:wrap;gap:4px;min-width:0;overflow-wrap:anywhere}.ivy-editor .cm-prop-chip{padding:0 8px;border-radius:999px;background:rgb(var(--sunken))}.ivy-editor .cm-query{white-space:normal;margin:6px 0;padding:10px 12px 6px;border-radius:16px;background:rgb(var(--code-bg)/.45);cursor:text}.ivy-editor .cm-query-head{margin-bottom:4px;color:rgb(var(--faint));font-size:12px;letter-spacing:.02em}.ivy-editor .cm-query-scroll{overflow-x:auto}.ivy-editor .cm-query table{margin:0;font-size:.9em;line-height:1.6}.ivy-editor .cm-query a.wikilink{color:rgb(var(--ivy));cursor:pointer}.ivy-editor .cm-query-empty,.ivy-editor .cm-query-note{padding:4px 0 6px;color:rgb(var(--muted));font-size:.9em}.ivy-editor .cm-query-error{padding:4px 0 6px;color:rgb(var(--danger));font-family:var(--font-mono);font-size:.8em}.ivy-editor .ivy-lock{display:flex;flex-direction:column;align-items:center;gap:8px;max-width:360px;margin:4vh auto 8vh;padding:28px 24px 22px;border-radius:24px;background:rgb(var(--sunken)/.6);text-align:center}.ivy-editor .ivy-lock-icon{display:flex;width:56px;height:56px;align-items:center;justify-content:center;border-radius:999px;background:rgb(var(--ivy-soft));color:rgb(var(--ivy-ink))}.ivy-editor .ivy-lock-title{margin-top:4px;font-family:var(--font-serif);font-size:17px;font-weight:600}.ivy-editor .ivy-lock-hint,.ivy-editor .ivy-lock-sub{color:rgb(var(--muted));font-size:13px;line-height:1.6}.ivy-editor .ivy-lock-hint{color:rgb(var(--ink-2))}.ivy-editor .ivy-lock-form{display:flex;width:100%;gap:8px;margin-top:8px}.ivy-dlg-input,.ivy-editor .ivy-lock-input{flex:1 1 auto;min-width:0;height:42px;padding:0 14px;border-radius:12px;border:1px solid rgb(var(--line));background:rgb(var(--surface));color:rgb(var(--ink));font:inherit;font-size:15px;outline:none}.ivy-dlg-input:focus,.ivy-editor .ivy-lock-input:focus{border-color:rgb(var(--ivy));box-shadow:0 0 0 3px rgb(var(--ivy)/.15)}.ivy-dlg-primary,.ivy-editor .ivy-lock-btn{height:42px;padding:0 18px;border-radius:12px;background:rgb(var(--ivy));color:rgb(var(--on-ivy));font-size:14.5px;font-weight:500;white-space:nowrap}.ivy-editor .ivy-lock-btn:disabled{opacity:.7}.ivy-dlg-error,.ivy-editor .ivy-lock-error{min-height:1.4em;color:rgb(var(--danger));font-size:13px}.ivy-shake{animation:ivy-shake .36s}@keyframes ivy-shake{20%,60%{transform:translateX(-6px)}40%,80%{transform:translateX(6px)}}@keyframes ivy-pop{0%{opacity:0;transform:translateY(-4px) scale(.98)}}.ivy-dlg-back{position:fixed;inset:0;z-index:90;display:flex;align-items:center;justify-content:center;padding:16px;background:rgba(10,14,18,.36);animation:ivy-fade .16s ease-out}.ivy-dlg-out{opacity:0;transition:opacity .15s}@keyframes ivy-fade{0%{opacity:0}}.ivy-dlg{width:100%;max-width:420px;max-height:calc(100vh - 32px);overflow-y:auto;padding:22px 22px 18px;border-radius:22px;background:rgb(var(--surface));color:rgb(var(--ink));box-shadow:var(--shadow-lift);animation:ivy-pop .18s ease-out}.ivy-dlg-form{display:flex;flex-direction:column;gap:10px}.ivy-dlg-title{font-family:var(--font-serif);font-size:18px;font-weight:600}.ivy-dlg-notes,.ivy-dlg-text{color:rgb(var(--ink-2));font-size:13.5px;line-height:1.65}.ivy-dlg-notes{padding-left:1.1em;list-style:disc}.ivy-dlg-field{display:flex;flex-direction:column;gap:4px}.ivy-dlg-field .ivy-dlg-input{flex:none;width:100%}.ivy-dlg-label{color:rgb(var(--muted));font-size:12.5px}.ivy-dlg-ack{display:flex;gap:8px;align-items:flex-start;padding:10px 12px;border-radius:12px;background:rgb(var(--warn-soft));color:rgb(var(--warn-ink));font-size:13px;line-height:1.55}.ivy-dlg-ack input{margin-top:3px;accent-color:rgb(var(--ivy))}.ivy-dlg-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:4px}.ivy-dlg-btn{height:40px;padding:0 16px;border-radius:12px;color:rgb(var(--ink-2));font-size:14px}.ivy-dlg-btn:hover{background:rgb(var(--sunken))}.ivy-dlg-btn.ivy-dlg-primary{background:rgb(var(--ivy));color:rgb(var(--on-ivy))}.ivy-dlg-btn.ivy-dlg-primary:hover{background:rgb(var(--ivy-hover))}.ivy-dlg-btn.ivy-dlg-danger{background:rgb(var(--danger));color:#fff}:root{--editor-size:16px;--gutter:20px}body,html{margin:0;background:rgb(var(--surface));-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:transparent;font-family:system-ui,Roboto,Noto Sans CJK SC,Noto Sans SC,sans-serif}body{min-height:100vh;padding-bottom:40vh;box-sizing:border-box}#editor{padding:4px var(--gutter) 0}.ivy-editor .cm-editor{font-size:var(--editor-size)}.ivy-editor .cm-scroller{overflow:visible!important}@media (min-width:700px){:root{--gutter:44px}#editor{max-width:760px;margin:0 auto}}.ivy-editor .cm-table td,.ivy-editor .cm-table th{min-width:5em} \ No newline at end of file diff --git a/app/src/main/assets/editor/main.js b/app/src/main/assets/editor/main.js index dd5c1e1..33b1170 100644 --- a/app/src/main/assets/editor/main.js +++ b/app/src/main/assets/editor/main.js @@ -1,98 +1,115 @@ -import{$ as R,A as ve,B as X,C as Te,D as Ji,E as Yr,F as es,G as zr,H as qr,I as ts,Ia as ds,J as rs,K as ns,L as K,M as Re,N as pt,O as le,P as M,Q as Wt,R as Mt,S as Ut,T as is,U as Oe,V as f,W as ss,X as Vt,Y as Ar,Z as as,_ as Ne,a as Ii,aa as os,b as _r,ba as ce,c as W,ca as Lr,d as ht,da as Gt,e as J,ea as $e,f as Lt,fa as ls,g as Z,ga as Os,h as De,ha as Fe,i as ie,ia as cs,j as ge,ja as he,k as Cr,ka as It,l as Di,la as hs,m as q,ma as us,n as Bi,na as ps,o as A,p as Qe,q as ut,r as Ni,s as Fi,t as Hi,tc as ms,u as Be,uc as gs,v as I,w as ee,x as v,y as Ki,ya as fs,z as Et}from"./chunks/chunk-GJGDCSZU.js";import{a as Dt}from"./chunks/chunk-TO3N6BD7.js";import"./chunks/chunk-Y6SLVHK3.js";var He=class{constructor(e,r,n,i){this.state=e,this.pos=r,this.explicit=n,this.view=i,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let r=R(this.state).resolveInner(this.pos,-1);for(;r&&e.indexOf(r.name)<0;)r=r.parent;return r?{from:r.from,to:this.pos,text:this.state.sliceDoc(r.from,this.pos),type:r.type}:null}matchBefore(e){let r=this.state.doc.lineAt(this.pos),n=Math.max(r.from,this.pos-250),i=r.text.slice(n-r.from,this.pos-r.from),s=i.search(Zs(e,!1));return s<0?null:{from:n+s,to:this.pos,text:i.slice(s)}}get aborted(){return this.abortListeners==null}addEventListener(e,r,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(r),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function Qs(t){let e=Object.keys(t).join(""),r=/\w/.test(e);return r&&(e=e.replace(/\w/g,"")),`[${r?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Gl(t){let e=Object.create(null),r=Object.create(null);for(let{label:i}of t){e[i[0]]=!0;for(let s=1;stypeof i=="string"?{label:i}:i),[r,n]=e.every(i=>/^\w+$/.test(i.label))?[/\w*$/,/\w+$/]:Gl(e);return i=>{let s=i.matchBefore(n);return s||i.explicit?{from:s?s.from:i.pos,options:e,validFor:r}:null}}function ys(t,e){return r=>{for(let n=R(r.state).resolveInner(r.pos,-1);n;n=n.parent){if(t.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(r)}}var Nt=class{constructor(e,r,n,i){this.completion=e,this.source=r,this.match=n,this.score=i}};function _e(t){return t.selection.main.from}function Zs(t,e){var r;let{source:n}=t,i=e&&n[0]!="^",s=n[n.length-1]!="$";return!i&&!s?t:new RegExp(`${i?"^":""}(?:${n})${s?"$":""}`,(r=t.flags)!==null&&r!==void 0?r:t.ignoreCase?"i":"")}var Jr=Di.define();function Il(t,e,r,n){let{main:i}=t.selection,s=r-i.from,a=n-i.from;return{...t.changeByRange(o=>{if(o!=i&&r!=n&&t.sliceDoc(o.from+s,o.from+a)!=t.sliceDoc(r,n))return{range:o};let l=t.toText(e);return{changes:{from:o.from+s,to:n==i.from?o.to:o.from+a,insert:l},range:Z.cursor(o.from+s+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}var $s=new WeakMap;function Dl(t){if(!Array.isArray(t))return t;let e=$s.get(t);return e||$s.set(t,e=Kr(t)),e}var Ft=q.define(),ft=q.define(),Ur=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let r=0;r=48&&w<=57||w>=97&&w<=122?2:w>=65&&w<=90?1:0:(_=ht(w))!=_.toLowerCase()?1:_!=_.toUpperCase()?2:0;(!Q||G==1&&g||y==0&&G!=0)&&(r[h]==w||n[h]==w&&(p=!0)?a[h++]=Q:a.length&&(b=!1)),y=G,Q+=J(w)}return h==l&&a[0]==0&&b?this.result(-100+(p?-200:0),a,e):u==l&&d==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):u==l?this.ret(-900-e.length,[d,m]):h==l?this.result(-100+(p?-200:0)+-700+(b?0:-1100),a,e):r.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,r,n){let i=[],s=0;for(let a of r){let o=a+(this.astral?J(W(n,a)):1);s&&i[s-1]==a?i[s-1]=o:(i[s++]=a,i[s++]=o)}return this.ret(e-n.length,i)}},Vr=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Bl,filterStrict:!1,compareCompletions:(e,r)=>(e.sortText||e.label).localeCompare(r.sortText||r.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,r)=>e&&r,closeOnBlur:(e,r)=>e&&r,icons:(e,r)=>e&&r,tooltipClass:(e,r)=>n=>bs(e(n),r(n)),optionClass:(e,r)=>n=>bs(e(n),r(n)),addToOptions:(e,r)=>e.concat(r),filterStrict:(e,r)=>e||r})}});function bs(t,e){return t?e?t+" "+e:t:e}function Bl(t,e,r,n,i,s){let a=t.textDirection==Ki.RTL,o=a,l=!1,O="top",c,h,p=e.left-i.left,u=i.right-e.right,d=n.right-n.left,m=n.bottom-n.top;if(o&&p=m||Q>e.top?c=r.bottom-e.top:(O="bottom",c=e.bottom-r.top)}let g=(e.bottom-e.top)/s.offsetHeight,b=(e.right-e.left)/s.offsetWidth;return{style:`${O}: ${c/g}px; max-width: ${h/b}px`,class:"cm-completionInfo-"+(l?a?"left-narrow":"right-narrow":o?"left":"right")}}var en=q.define();function Nl(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(r){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),r.type&&n.classList.add(...r.type.split(/\s+/g).map(i=>"cm-completionIcon-"+i)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(r,n,i,s){let a=document.createElement("span");a.className="cm-completionLabel";let o=r.displayLabel||r.label,l=0;for(let O=0;Ol&&a.appendChild(document.createTextNode(o.slice(l,c)));let p=a.appendChild(document.createElement("span"));p.appendChild(document.createTextNode(o.slice(c,h))),p.className="cm-completionMatchedText",l=h}return lr.position-n.position).map(r=>r.render)}function Er(t,e,r){if(t<=r)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let i=Math.floor(e/r);return{from:i*r,to:(i+1)*r}}let n=Math.ceil((t-e)/r);return{from:t-n*r,to:t-(n-1)*r}}var Gr=class{constructor(e,r,n){this.view=e,this.stateField=r,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let i=e.state.field(r),{options:s,selected:a}=i.open,o=e.state.facet(Y);this.optionContent=Nl(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=Er(s.length,a,o.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:O}=e.state.field(r).open;for(let c=l.target,h;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(h=/-(\d+)$/.exec(c.id))&&+h[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;c!=null&&(e.dispatch({effects:en.of(c)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let O=e.state.field(this.stateField,!1);O&&O.tooltip&&e.state.facet(Y).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:ft.of(null)})}),this.showOptions(s,i.id)}mount(){this.updateSel()}showOptions(e,r){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,r,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var r;let n=e.state.field(this.stateField),i=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=i){let{options:s,selected:a,disabled:o}=n.open;(!i.open||i.open.options!=s)&&(this.range=Er(s.length,a,e.state.facet(Y).maxRenderedOptions),this.showOptions(s,n.id)),this.updateSel(),o!=((r=i.open)===null||r===void 0?void 0:r.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!o)}}updateTooltipClass(e){let r=this.tooltipClass(e);if(r!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of r.split(" "))n&&this.dom.classList.add(n);this.currentClass=r}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),r=e.open;(r.selected>-1&&r.selected=this.range.to)&&(this.range=Er(r.options.length,r.selected,this.view.state.facet(Y).maxRenderedOptions),this.showOptions(r.options,e.id));let n=this.updateSelectedOption(r.selected);if(n){this.destroyInfo();let{completion:i}=r.options[r.selected],{info:s}=i;if(!s)return;let a=typeof s=="string"?document.createTextNode(s):s(i);if(!a)return;"then"in a?a.then(o=>{o&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(o,i)}).catch(o=>Et(this.view.state,o,"completion info")):(this.addInfoPane(a,i),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,r){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:i,destroy:s}=e;n.appendChild(i),this.infoDestroy=s||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let r=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)n.nodeName!="LI"||!n.id?i--:i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),r=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby"));return r&&Hl(this.list,r),r}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let r=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),s=this.space;if(!s){let a=this.dom.ownerDocument.documentElement;s={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return i.top>Math.min(s.bottom,r.bottom)-10||i.bottom{a.target==i&&a.preventDefault()});let s=null;for(let a=n.from;an.from||n.from==0))if(s=p,typeof O!="string"&&O.header)i.appendChild(O.header(O));else{let u=i.appendChild(document.createElement("completion-section"));u.textContent=p}}let c=i.appendChild(document.createElement("li"));c.id=r+"-"+a,c.setAttribute("role","option");let h=this.optionClass(o);h&&(c.className=h);for(let p of this.optionContent){let u=p(o,this.view.state,this.view,l);u&&c.appendChild(u)}}return n.from&&i.classList.add("cm-completionListIncompleteTop"),n.tonew Gr(r,t,e)}function Hl(t,e){let r=t.getBoundingClientRect(),n=e.getBoundingClientRect(),i=r.height/t.offsetHeight;n.topr.bottom&&(t.scrollTop+=(n.bottom-r.bottom)/i)}function Ss(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function Kl(t,e){let r=[],n=null,i=null,s=c=>{r.push(c);let{section:h}=c.completion;if(h){n||(n=[]);let p=typeof h=="string"?h:h.name;n.some(u=>u.name==p)||n.push(typeof h=="string"?{name:p}:h)}},a=e.facet(Y);for(let c of t)if(c.hasResult()){let h=c.result.getMatch;if(c.result.filter===!1)for(let p of c.result.options)s(new Nt(p,c.source,h?h(p):[],1e9-r.length));else{let p=e.sliceDoc(c.from,c.to),u,d=a.filterStrict?new Vr(p):new Ur(p);for(let m of c.result.options)if(u=d.match(m.label)){let g=m.displayLabel?h?h(m,u.matched):[]:u.matched,b=u.score+(m.boost||0);if(s(new Nt(m,c.source,g,b)),typeof m.section=="object"&&m.section.rank==="dynamic"){let{name:Q}=m.section;i||(i=Object.create(null)),i[Q]=Math.max(b,i[Q]||-1e9)}}}}if(n){let c=Object.create(null),h=0,p=(u,d)=>(u.rank==="dynamic"&&d.rank==="dynamic"?i[d.name]-i[u.name]:0)||(typeof u.rank=="number"?u.rank:1e9)-(typeof d.rank=="number"?d.rank:1e9)||(u.namep.score-h.score||O(h.completion,p.completion))){let h=c.completion;!l||l.label!=h.label||l.detail!=h.detail||l.type!=null&&h.type!=null&&l.type!=h.type||l.apply!=h.apply||l.boost!=h.boost?o.push(c):Ss(c.completion)>Ss(l)&&(o[o.length-1]=c),l=c.completion}return o}var Ir=class t{constructor(e,r,n,i,s,a){this.options=e,this.attrs=r,this.tooltip=n,this.timestamp=i,this.selected=s,this.disabled=a}setSelected(e,r){return e==this.selected||e>=this.options.length?this:new t(this.options,ks(r,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,r,n,i,s,a){if(i&&!a&&e.some(O=>O.isPending))return i.setDisabled();let o=Kl(e,r);if(!o.length)return i&&e.some(O=>O.isPending)?i.setDisabled():null;let l=r.facet(Y).selectOnOpen?0:-1;if(i&&i.selected!=l&&i.selected!=-1){let O=i.options[i.selected].completion;for(let c=0;cc.hasResult()?Math.min(O,c.from):O,1e8),create:iO,above:s.aboveCursor},i?i.timestamp:Date.now(),l,!1)}map(e){return new t(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new t(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},Dr=class t{constructor(e,r,n){this.active=e,this.id=r,this.open=n}static start(){return new t(rO,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:r}=e,n=r.facet(Y),s=(n.override||r.languageDataAt("autocomplete",_e(r)).map(Dl)).map(l=>(this.active.find(c=>c.source==l)||new ue(l,this.active.some(c=>c.state!=0)?1:0)).update(e,n));s.length==this.active.length&&s.every((l,O)=>l==this.active[O])&&(s=this.active);let a=this.open,o=e.effects.some(l=>l.is(tn));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||s.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!Jl(s,this.active)||o?a=Ir.build(s,r,this.id,a,n,o):a&&a.disabled&&!s.some(l=>l.isPending)&&(a=null),!a&&s.every(l=>!l.isPending)&&s.some(l=>l.hasResult())&&(s=s.map(l=>l.hasResult()?new ue(l.source,0):l));for(let l of e.effects)l.is(en)&&(a=a&&a.setSelected(l.value,this.id));return s==this.active&&a==this.open?this:new t(s,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?eO:tO}};function Jl(t,e){if(t==e)return!0;for(let r=0,n=0;;){for(;r-1&&(r["aria-activedescendant"]=t+"-"+e),r}var rO=[];function Xs(t,e){if(t.isUserEvent("input.complete")){let n=t.annotation(Jr);if(n&&e.activateOnCompletion(n))return 12}let r=t.isUserEvent("input.type");return r&&e.activateOnTyping?5:r?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}var ue=class t{constructor(e,r,n=!1){this.source=e,this.state=r,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,r){let n=Xs(e,r),i=this;(n&8||n&16&&this.touches(e))&&(i=new t(i.source,0)),n&4&&i.state==0&&(i=new t(this.source,1)),i=i.updateFor(e,n);for(let s of e.effects)if(s.is(Ft))i=new t(i.source,1,s.value);else if(s.is(ft))i=new t(i.source,0);else if(s.is(tn))for(let a of s.value)a.source==i.source&&(i=a);return i}updateFor(e,r){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(_e(e.state))}},Ht=class t extends ue{constructor(e,r,n,i,s,a){super(e,3,r),this.limit=n,this.result=i,this.from=s,this.to=a}hasResult(){return!0}updateFor(e,r){var n;if(!(r&3))return this.map(e.changes);let i=this.result;i.map&&!e.changes.empty&&(i=i.map(i,e.changes));let s=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),o=_e(e.state);if(o>a||!i||r&2&&(_e(e.startState)==this.from||or.map(e))}}),U=ie.define({create(){return Dr.start()},update(t,e){return t.update(e)},provide:t=>[es.from(t,e=>e.tooltip),X.contentAttributes.from(t,e=>e.attrs)]});function rn(t,e){let r=e.completion.apply||e.completion.label,n=t.state.field(U).active.find(i=>i.source==e.source);return n instanceof Ht?(typeof r=="string"?t.dispatch({...Il(t.state,r,n.from,n.to),annotations:Jr.of(e.completion)}):r(t,e.completion,n.from,n.to),!0):!1}var iO=Fl(U,rn);function Bt(t,e="option"){return r=>{let n=r.state.field(U,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+i*(t?1:-1):t?0:a-1;return o<0?o=e=="page"?0:a-1:o>=a&&(o=e=="page"?a-1:0),r.dispatch({effects:en.of(o)}),!0}}var sO=t=>{let e=t.state.field(U,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(U,!1)?(t.dispatch({effects:Ft.of(!0)}),!0):!1,aO=t=>{let e=t.state.field(U,!1);return!e||!e.active.some(r=>r.state!=0)?!1:(t.dispatch({effects:ft.of(null)}),!0)},Br=class{constructor(e,r){this.active=e,this.context=r,this.time=Date.now(),this.updates=[],this.done=void 0}},oO=50,lO=1e3,OO=ve.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(U).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(U),r=t.state.facet(Y);if(!t.selectionSet&&!t.docChanged&&t.startState.field(U)==e)return;let n=t.transactions.some(s=>{let a=Xs(s,r);return a&8||(s.selection||s.docChanged)&&!(a&3)});for(let s=0;soO&&Date.now()-a.time>lO){for(let o of a.context.abortListeners)try{o()}catch(l){Et(this.view.state,l)}a.context.abortListeners=null,this.running.splice(s--,1)}else a.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(s=>s.effects.some(a=>a.is(Ft)))&&(this.pendingStart=!0);let i=this.pendingStart?50:r.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(s=>s.isPending&&!this.running.some(a=>a.active.source==s.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let s of t.transactions)s.isUserEvent("input.type")?this.composing=2:this.composing==2&&s.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(U);for(let r of e.active)r.isPending&&!this.running.some(n=>n.active.source==r.source)&&this.startQuery(r);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Y).updateSyncTime))}startQuery(t){let{state:e}=this.view,r=_e(e),n=new He(e,r,t.explicit,this.view),i=new Br(t,n);this.running.push(i),Promise.resolve(t.source(n)).then(s=>{i.context.aborted||(i.done=s||null,this.scheduleAccept())},s=>{this.view.dispatch({effects:ft.of(null)}),Et(this.view.state,s)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Y).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],r=this.view.state.facet(Y),n=this.view.state.field(U);for(let i=0;io.source==s.active.source);if(a&&a.isPending)if(s.done==null){let o=new ue(s.active.source,0);for(let l of s.updates)o=o.update(l,r);o.isPending||e.push(o)}else this.startQuery(a)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:tn.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(U,!1);if(e&&e.tooltip&&this.view.state.facet(Y).closeOnBlur){let r=e.open&&zr(this.view,e.open.tooltip);(!r||!r.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:ft.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Ft.of(!1)}),20),this.composing=0}}}),cO=typeof navigator=="object"&&/Win/.test(navigator.platform),hO=ge.highest(X.domEventHandlers({keydown(t,e){let r=e.state.field(U,!1);if(!r||!r.open||r.open.disabled||r.open.selected<0||!t.key||t.key.length>1||t.ctrlKey&&!(cO&&t.altKey)||t.metaKey)return!1;let n=r.open.options[r.open.selected],i=r.active.find(a=>a.source==n.source),s=n.completion.commitCharacters||i.result.commitCharacters;return s&&s.indexOf(t.key)>-1&&rn(e,n),!1}})),vs=X.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Nr=class{constructor(e,r,n,i){this.field=e,this.line=r,this.from=n,this.to=i}},Fr=class t{constructor(e,r,n){this.field=e,this.from=r,this.to=n}map(e){let r=e.mapPos(this.from,-1,Lt.TrackDel),n=e.mapPos(this.to,1,Lt.TrackDel);return r==null||n==null?null:new t(this.field,r,n)}},Hr=class t{constructor(e,r){this.lines=e,this.fieldPositions=r}instantiate(e,r){let n=[],i=[r],s=e.doc.lineAt(r),a=/^\s*/.exec(s.text)[0];for(let l of this.lines){if(n.length){let O=a,c=/^\t*/.exec(l)[0].length;for(let h=0;hnew Fr(l.field,i[l.line]+l.from,i[l.line]+l.to));return{text:n,ranges:o}}static parse(e){let r=[],n=[],i=[],s;for(let a of e.split(/\r\n?|\n/)){for(;s=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(a);){let o=s[1]?+s[1]:null,l=s[2]||s[3]||"",O=-1;o===0&&(o=1e9);let c=l.replace(/\\[{}]/g,h=>h[1]);for(let h=0;h=O&&p.field++}for(let h of i)if(h.line==n.length&&h.from>s.index){let p=s[2]?3+(s[1]||"").length:2;h.from-=p,h.to-=p}i.push(new Nr(O,n.length,s.index,s.index+c.length)),a=a.slice(0,s.index)+l+a.slice(s.index+s[0].length)}a=a.replace(/\\([{}])/g,(o,l,O)=>{for(let c of i)c.line==n.length&&c.from>O&&(c.from--,c.to--);return l}),n.push(a)}return new t(n,i)}},uO=v.widget({widget:new class extends ee{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),pO=v.mark({class:"cm-snippetField"}),Ke=class t{constructor(e,r){this.ranges=e,this.active=r,this.deco=v.set(e.map(n=>(n.from==n.to?uO:pO).range(n.from,n.to)),!0)}map(e){let r=[];for(let n of this.ranges){let i=n.map(e);if(!i)return null;r.push(i)}return new t(r,this.active)}selectionInsideField(e){return e.ranges.every(r=>this.ranges.some(n=>n.field==this.active&&n.from<=r.from&&n.to>=r.to))}},gt=q.define({map(t,e){return t&&t.map(e)}}),fO=q.define(),dt=ie.define({create(){return null},update(t,e){for(let r of e.effects){if(r.is(gt))return r.value;if(r.is(fO)&&t)return new Ke(t.ranges,r.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>X.decorations.from(t,e=>e?e.deco:v.none)});function nn(t,e){return Z.create(t.filter(r=>r.field==e).map(r=>Z.range(r.from,r.to)))}function dO(t){let e=Hr.parse(t);return(r,n,i,s)=>{let{text:a,ranges:o}=e.instantiate(r.state,i),{main:l}=r.state.selection,O={changes:{from:i,to:s==l.from?l.to:s,insert:Ii.of(a)},scrollIntoView:!0,annotations:n?[Jr.of(n),Bi.userEvent.of("input.complete")]:void 0};if(o.length&&(O.selection=nn(o,0)),o.some(c=>c.field>0)){let c=new Ke(o,0),h=O.effects=[gt.of(c)];r.state.field(dt,!1)===void 0&&h.push(q.appendConfig.of([dt,bO,SO,vs]))}r.dispatch(r.state.update(O))}}function Ts(t){return({state:e,dispatch:r})=>{let n=e.field(dt,!1);if(!n||t<0&&n.active==0)return!1;let i=n.active+t,s=t>0&&!n.ranges.some(a=>a.field==i+t);return r(e.update({selection:nn(n.ranges,i),effects:gt.of(s?null:new Ke(n.ranges,i)),scrollIntoView:!0})),!0}}var mO=({state:t,dispatch:e})=>t.field(dt,!1)?(e(t.update({effects:gt.of(null)})),!0):!1,gO=Ts(1),QO=Ts(-1);var $O=[{key:"Tab",run:gO,shift:QO},{key:"Escape",run:mO}],Ps=De.define({combine(t){return t.length?t[0]:$O}}),bO=ge.highest(Te.compute([Ps],t=>t.facet(Ps)));function L(t,e){return{...e,apply:dO(t)}}var SO=X.domEventHandlers({mousedown(t,e){let r=e.state.field(dt,!1),n;if(!r||(n=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let i=r.ranges.find(s=>s.from<=n&&s.to>=n);return!i||i.field==r.active?!1:(e.dispatch({selection:nn(r.ranges,i.field),effects:gt.of(r.ranges.some(s=>s.field>i.field)?new Ke(r.ranges,i.field):null),scrollIntoView:!0}),!0)}});var mt={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},je=q.define({map(t,e){let r=e.mapPos(t,-1,Lt.TrackAfter);return r??void 0}}),sn=new class extends Ni{};sn.startSide=1;sn.endSide=-1;var Rs=ie.define({create(){return Fi.empty},update(t,e){if(t=t.map(e.changes),e.selection){let r=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:n=>n>=r.from&&n<=r.to})}for(let r of e.effects)r.is(je)&&(t=t.update({add:[sn.range(r.value,r.value+1)]}));return t}});function js(){return[PO,Rs]}var Mr="()[]{}<>\xAB\xBB\xBB\xAB\uFF3B\uFF3D\uFF5B\uFF5D";function _s(t){for(let e=0;e{if((kO?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let i=t.state.selection.main;if(n.length>2||n.length==2&&J(W(n,0))==1||e!=i.from||r!=i.to)return!1;let s=wO(t.state,n);return s?(t.dispatch(s),!0):!1}),xO=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Cs(t,t.selection.main.head).brackets||mt.brackets,i=null,s=t.changeByRange(a=>{if(a.empty){let o=yO(t.doc,a.head);for(let l of n)if(l==o&&Kt(t.doc,a.head)==_s(W(l,0)))return{changes:{from:a.head-l.length,to:a.head+l.length},range:Z.cursor(a.head-l.length)}}return{range:i=a}});return i||e(t.update(s,{scrollIntoView:!0,userEvent:"delete.backward"})),!i},Ys=[{key:"Backspace",run:xO}];function wO(t,e){let r=Cs(t,t.selection.main.head),n=r.brackets||mt.brackets;for(let i of n){let s=_s(W(i,0));if(e==i)return s==i?vO(t,i,n.indexOf(i+i+i)>-1,r):ZO(t,i,s,r.before||mt.before);if(e==s&&zs(t,t.selection.main.from))return XO(t,i,s)}return null}function zs(t,e){let r=!1;return t.field(Rs).between(0,t.doc.length,n=>{n==e&&(r=!0)}),r}function Kt(t,e){let r=t.sliceString(e,e+2);return r.slice(0,J(W(r,0)))}function yO(t,e){let r=t.sliceString(e-2,e);return J(W(r,0))==r.length?r:r.slice(1)}function ZO(t,e,r,n){let i=null,s=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:r,from:a.to}],effects:je.of(a.to+e.length),range:Z.range(a.anchor+e.length,a.head+e.length)};let o=Kt(t.doc,a.head);return!o||/\s/.test(o)||n.indexOf(o)>-1?{changes:{insert:e+r,from:a.head},effects:je.of(a.head+e.length),range:Z.cursor(a.head+e.length)}:{range:i=a}});return i?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function XO(t,e,r){let n=null,i=t.changeByRange(s=>s.empty&&Kt(t.doc,s.head)==r?{changes:{from:s.head,to:s.head+r.length,insert:r},range:Z.cursor(s.head+r.length)}:n={range:s});return n?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function vO(t,e,r,n){let i=n.stringPrefixes||mt.stringPrefixes,s=null,a=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:e,from:o.to}],effects:je.of(o.to+e.length),range:Z.range(o.anchor+e.length,o.head+e.length)};let l=o.head,O=Kt(t.doc,l),c;if(O==e){if(xs(t,l))return{changes:{insert:e+e,from:l},effects:je.of(l+e.length),range:Z.cursor(l+e.length)};if(zs(t,l)){let p=r&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+p.length,insert:p},range:Z.cursor(l+p.length)}}}else{if(r&&t.sliceDoc(l-2*e.length,l)==e+e&&(c=ws(t,l-2*e.length,i))>-1&&xs(t,c))return{changes:{insert:e+e+e+e,from:l},effects:je.of(l+e.length),range:Z.cursor(l+e.length)};if(t.charCategorizer(l)(O)!=A.Word&&ws(t,l,i)>-1&&!TO(t,l,e,i))return{changes:{insert:e+e,from:l},effects:je.of(l+e.length),range:Z.cursor(l+e.length)}}return{range:s=o}});return s?null:t.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function xs(t,e){let r=R(t).resolveInner(e+1);return r.parent&&r.from==e}function TO(t,e,r,n){let i=R(t).resolveInner(e,-1),s=n.reduce((a,o)=>Math.max(a,o.length),0);for(let a=0;a<5;a++){let o=t.sliceDoc(i.from,Math.min(i.to,i.from+r.length+s)),l=o.indexOf(r);if(!l||l>-1&&n.indexOf(o.slice(0,l))>-1){let c=i.firstChild;for(;c&&c.from==i.from&&c.to-c.from>r.length+l;){if(t.sliceDoc(c.to-r.length,c.to)==r)return!1;c=c.firstChild}return!0}let O=i.to==e&&i.parent;if(!O)break;i=O}return!1}function ws(t,e,r){let n=t.charCategorizer(e);if(n(t.sliceDoc(e-1,e))!=A.Word)return e;for(let i of r){let s=e-i.length;if(t.sliceDoc(s,e)==i&&n(t.sliceDoc(s-1,s))!=A.Word)return s}return-1}function qs(t={}){return[hO,U,Y.of(t),OO,RO,vs]}var an=[{key:"Ctrl-Space",run:Wr},{mac:"Alt-`",run:Wr},{mac:"Alt-i",run:Wr},{key:"Escape",run:aO},{key:"ArrowDown",run:Bt(!0)},{key:"ArrowUp",run:Bt(!1)},{key:"PageDown",run:Bt(!0,"page")},{key:"PageUp",run:Bt(!1,"page")},{key:"Enter",run:sO}],RO=ge.highest(Te.computeN([Y],t=>t.facet(Y).defaultKeymap?[an]:[]));var tr=class t{static create(e,r,n,i,s){let a=i+(i<<8)+e+(r<<4)|0;return new t(e,r,n,a,s,[],[])}constructor(e,r,n,i,s,a,o){this.type=e,this.value=r,this.from=n,this.hash=i,this.end=s,this.children=a,this.positions=o,this.blankFirstLine=!1,this.hashProp=[[K.contextHash,i]]}addChild(e,r){e.prop(K.contextHash)!=this.hash&&(e=new M(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(r)}toTree(e,r=this.end){let n=this.children.length-1;return n>=0&&(r=Math.max(r,this.positions[n]+this.children[n].length+this.from)),new M(e.types[this.type],this.children,this.positions,r-this.from).balance({makeTree:(i,s,a)=>new M(Re.none,i,s,a,this.hashProp)})}},$;(function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.Autolink=33]="Autolink",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel",t[t.URL=44]="URL"})($||($={}));var On=class{constructor(e,r){this.start=e,this.content=r,this.marks=[],this.parsers=[]}},cn=class{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return $t(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,r=0,n=0){for(let i=r;i=e.stack[r.depth+1].value+r.baseIndent)return!0;if(r.indent>=r.baseIndent+4)return!1;let n=(t.type==$.OrderedList?kn:Sn)(r,e,!1);return n>0&&(t.type!=$.BulletList||bn(r,e,!1)<0)&&r.text.charCodeAt(r.pos+n-1)==t.value}var Ns={[$.Blockquote](t,e,r){return r.next!=62?!1:(r.markers.push(T($.QuoteMark,e.lineStart+r.pos,e.lineStart+r.pos+1)),r.moveBase(r.pos+(D(r.text.charCodeAt(r.pos+1))?2:1)),t.end=e.lineStart+r.text.length,!0)},[$.ListItem](t,e,r){return(r.next<0?t.blankFirstLine&&t.children.length==1:r.indentr&&D(t.charCodeAt(e-1));)e--;return e}function Fs(t){if(t.next!=96&&t.next!=126)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(ia.SetextHeading)>-1||n<3?-1:1}function Ks(t,e){for(let r=t.stack.length-1;r>=0;r--)if(t.stack[r].type==e)return!0;return!1}function Sn(t,e,r){return(t.next==45||t.next==43||t.next==42)&&(t.pos==t.text.length-1||D(t.text.charCodeAt(t.pos+1)))&&(!r||Ks(e,$.BulletList)||t.skipSpace(t.pos+2)=48&&i<=57;){n++;if(n==t.text.length)return-1;i=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||i!=46&&i!=41||nt.pos+1||t.next!=49)?-1:n+1-t.pos}function Js(t){if(t.next!=35)return-1;let e=t.pos+1;for(;e6?-1:r}function ea(t){if(t.next!=45&&t.next!=61||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,ra=/\?>/,un=[[/^<(?:script|pre|style|textarea)(?:\s|>|$)/i,/<\/(?:script|pre|style|textarea)>/i],[/^\s*)/.exec(n);if(s)return t.append(T($.Comment,r,r+1+s[0].length));let a=/^\?[^]*?\?>/.exec(n);if(a)return t.append(T($.ProcessingInstruction,r,r+1+a[0].length));let o=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/[a-zA-Z][\w-]*\s*>|[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*\/?>)/.exec(n);return o?t.append(T($.HTMLTag,r,r+1+o[0].length)):-1},Emphasis(t,e,r){if(e!=95&&e!=42)return-1;let n=r+1;for(;t.char(n)==e;)n++;let i=t.slice(r-1,r),s=t.slice(n,n+1),a=kt.test(i),o=kt.test(s),l=/\s|^$/.test(i),O=/\s|^$/.test(s),c=!O&&(!o||l||a),h=!l&&(!a||O||o),p=c&&(e==42||!h||a),u=h&&(e==42||!c||o);return t.append(new E(e==95?Pn:xn,r,n,(p?1:0)|(u?2:0)))},HardBreak(t,e,r){if(e==92&&t.char(r+1)==10)return t.append(T($.HardBreak,r,r+2));if(e==32){let n=r+1;for(;t.char(n)==32;)n++;if(t.char(n)==10&&n>=r+2)return t.append(T($.HardBreak,r,n+1))}return-1},Link(t,e,r){return e==91?t.append(new E(Ce,r,r+1,1)):-1},Image(t,e,r){return e==33&&t.char(r+1)==91?t.append(new E(ir,r,r+2,1)):-1},LinkEnd(t,e,r){if(e!=93)return-1;for(let n=t.parts.length-1;n>=0;n--){let i=t.parts[n];if(i instanceof E&&(i.type==Ce||i.type==ir)){if(!i.side||t.skipSpace(i.to)==r&&!/[(\[]/.test(t.slice(r+1,r+2)))return t.parts[n]=null,-1;let s=t.takeContent(n),a=t.parts[n]=CO(t,s,i.type==Ce?$.Link:$.Image,i.from,r+1);if(i.type==Ce)for(let o=0;oe?T($.URL,e+r,s+r):s==t.length?null:!1}}function la(t,e,r){let n=t.charCodeAt(e);if(n!=39&&n!=34&&n!=40)return!1;let i=n==40?41:n;for(let s=e+1,a=!1;s=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,r){return this.text.slice(e-this.offset,r-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,r,n,i,s){return this.append(new E(e,r,n,(i?1:0)|(s?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let r=this.parts[e];if(r instanceof E&&(r.type==Ce||r.type==ir))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let n=e;n=e;l--){let m=this.parts[l];if(m instanceof E&&m.side&1&&m.type==i.type&&!(s&&(i.side&1||m.side&2)&&(m.size+i.size)%3==0&&(m.size%3||i.size%3))){o=m;break}}if(!o)continue;let O=i.type.resolve,c=[],h=o.from,p=i.to;if(s){let m=Math.min(2,o.to-o.from,a);h=o.to-m,p=i.from+m,O=m==1?"Emphasis":"StrongEmphasis"}o.type.mark&&c.push(this.elt(o.type.mark,h,o.to));for(let m=l+1;m=0;r--){let n=this.parts[r];if(n instanceof E&&n.type==e&&n.side&1)return r}return null}takeContent(e){let r=this.resolveMarkers(e);return this.parts.length=e,r}getDelimiterAt(e){let r=this.parts[e];return r instanceof E?r:null}skipSpace(e){return $t(this.text,e-this.offset)+this.offset}elt(e,r,n,i){return typeof e=="string"?T(this.parser.getNodeType(e),r,n,i):new nr(e,r)}};ze.linkStart=Ce;ze.imageStart=ir;ze.emphasisAsterisk=xn;ze.emphasisUnderscore=Pn;function gn(t,e){if(!e.length)return t;if(!t.length)return e;let r=t.slice(),n=0;for(let i of e){for(;n(e?e-1:0))return!1;if(this.fragmentEnd<0){let s=this.fragment.to;for(;s>0&&this.input.read(s-1,s)!=` -`;)s--;this.fragmentEnd=s?s-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(le.IncludeAnonymous|le.IgnoreMounts),n.firstChild());let i=e+this.fragment.offset;for(;n.to<=i;)if(!n.parent())return!1;for(;;){if(n.from>=i)return this.fragment.from<=r;if(!n.childAfter(i))return!1}}matches(e){let r=this.cursor.tree;for(;r&&r.type.isAnonymous&&r.children[0]instanceof M;)r=r.children[0];return r&&r.prop(K.contextHash)==e}takeNodes(e){let r=this.cursor,n=this.fragment.offset,i=this.fragmentEnd-(this.fragment.openEnd?1:0),s=e.absoluteLineStart,a=s,o=e.block.children.length,l=e.lineStart-e.block.from>>2,O=a,c=o;e:for(;;){if(r.to-n>Math.min(i,e.to)||r.type.isAnonymous&&r.tree&&(r.to-r.from>l||!YO(r.tree))){if(r.type.isAnonymous&&r.firstChild())continue;break}let h=ha(r.from-n,e.ranges);if(r.to-n<=e.ranges[e.rangeI].to)e.addNode(r.tree,h);else{let p=new M(e.parser.nodeSet.types[$.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(p,r.tree),e.addNode(p,h)}for((r.type.isAnonymous||r.type.is("Block"))&&(r.type.isAnonymous||ca.indexOf(r.type.id)<0?(a=r.to-n,o=e.block.children.length):(a=O,o=c),O=r.to-n,c=e.block.children.length);;){if(r.nextSibling())continue e;if(!r.parent()||!r.type.isAnonymous)break e}}for(;e.block.children.length>o;)e.block.children.pop(),e.block.positions.pop();return a-s}};function YO(t){for(;t.type.isAnonymous;){let e=t.children[t.children.length-1];if(e instanceof M)t=e;else return!1}return t.type.is("Block")&&ca.indexOf(t.type.id)<0}function ha(t,e){let r=t;for(let n=1;nJt[t]),Object.keys(Jt).map(t=>ia[t]),Object.keys(Jt),jO,Ns,Object.keys(ln).map(t=>ln[t]),Object.keys(ln),[]);function qO(t,e,r){let n=[];for(let i=t.firstChild,s=e;;i=i.nextSibling){let a=i?i.from:r;if(a>s&&n.push({from:s,to:a}),!i)break;s=i.to}return n}function pa(t){let{codeParser:e,htmlParser:r}=t;return{wrap:Ut((i,s)=>{let a=i.type.id;if(e&&(a==$.CodeBlock||a==$.FencedCode)){let o="";if(a==$.FencedCode){let O=i.node.getChild($.CodeInfo);O&&(o=s.read(O.from,O.to))}let l=e(o);if(l)return{parser:l,overlay:O=>O.type.id==$.CodeText,bracketed:a==$.FencedCode}}else if(r&&(a==$.HTMLBlock||a==$.HTMLTag||a==$.CommentBlock))return{parser:r,overlay:qO(i.node,i.from,i.to)};return null})}}var AO={resolve:"Strikethrough",mark:"StrikethroughMark"},LO={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":f.strikethrough}},{name:"StrikethroughMark",style:f.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,r){if(e!=126||t.char(r+1)!=126||t.char(r+2)==126)return-1;let n=t.slice(r-1,r),i=t.slice(r+2,r+3),s=/\s|^$/.test(n),a=/\s|^$/.test(i),o=kt.test(n),l=kt.test(i);return t.addDelimiter(AO,r,r+2,!a&&(!l||s||o),!s&&(!o||a||l))},after:"Emphasis"}]};function bt(t,e,r=0,n,i=0){let s=0,a=!0,o=-1,l=-1,O=!1,c=()=>{n.push(t.elt("TableCell",i+o,i+l,t.parser.parseInline(e.slice(o,l),i+o)))};for(let h=r;h-1)&&s++,a=!1,n&&(o>-1&&c(),n.push(t.elt("TableDelimiter",h+i,h+i+1))),o=l=-1):(O||p!=32&&p!=9)&&(o<0&&(o=h),l=h+1),O=!O&&p==92}return o>-1&&(s++,n&&c()),s}function Ms(t,e){for(let r=e;r\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,sr=class{constructor(){this.rows=null}nextLine(e,r,n){if(this.rows==null){this.rows=!1;let i;if((r.next==45||r.next==58||r.next==124)&&fa.test(i=r.text.slice(r.pos))){let s=[];bt(e,n.content,0,s,n.start)==bt(e,i,0)&&(this.rows=[e.elt("TableHeader",n.start,n.start+n.content.length,s),e.elt("TableDelimiter",e.lineStart+r.pos,e.lineStart+r.text.length)])}}else if(this.rows){let i=[];bt(e,r.text,r.pos,i,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+r.pos,e.lineStart+r.text.length,i))}return!1}finish(e,r){return this.rows?(e.addLeafElement(r,e.elt("Table",r.start,r.start+r.content.length,this.rows)),!0):!1}},EO={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":f.heading}},"TableRow",{name:"TableCell",style:f.content},{name:"TableDelimiter",style:f.processingInstruction}],parseBlock:[{name:"Table",leaf(t,e){return Ms(e.content,0)?new sr:null},endLeaf(t,e,r){if(r.parsers.some(i=>i instanceof sr)||!Ms(e.text,e.basePos))return!1;let n=t.peekLine();return fa.test(n)&&bt(t,e.text,e.basePos)==bt(t,n,e.basePos)},before:"SetextHeading"}]},$n=class{nextLine(){return!1}finish(e,r){return e.addLeafElement(r,e.elt("Task",r.start,r.start+r.content.length,[e.elt("TaskMarker",r.start,r.start+3),...e.parser.parseInline(r.content.slice(3),r.start+3)])),!0}},WO={defineNodes:[{name:"Task",block:!0,style:f.list},{name:"TaskMarker",style:f.atom}],parseBlock:[{name:"TaskList",leaf(t,e){return/^\[[ xX]\][ \t]/.test(e.content)&&t.parentType().name=="ListItem"?new $n:null},after:"SetextHeading"}]},Us=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,Vs=/[\w-]+(\.[\w-]+)+(:\d+)?(\/[^\s<]*)?/gy,MO=/[\w-]+\.[\w-]+($|[/:])/,Gs=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,Is=/\/[a-zA-Z\d@.]+/gy;function Ds(t,e,r,n){let i=0;for(let s=e;s-1)return-1;let n=e+r[0].length;for(;;){let i=t[n-1],s;if(/[?!.,:*_~]/.test(i)||i==")"&&Ds(t,e,n,")")>Ds(t,e,n,"("))n--;else if(i==";"&&(s=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(t.slice(e,n))))n=e+s.index;else break}return n}function Bs(t,e){Gs.lastIndex=e;let r=Gs.exec(t);if(!r)return-1;let n=r[0][r[0].length-1];return n=="_"||n=="-"?-1:e+r[0].length-(n=="."?1:0)}var VO={parseInline:[{name:"Autolink",parse(t,e,r){let n=r-t.offset;if(n&&/\w/.test(t.text[n-1]))return-1;Us.lastIndex=n;let i=Us.exec(t.text),s=-1;if(!i)return-1;if(i[1]||i[2]){if(s=UO(t.text,n+i[0].length),s>-1&&t.hasOpenLink){let a=/([^\[\]]|\[[^\]]*\])*/.exec(t.text.slice(n,s));s=n+a[0].length}}else i[3]?s=Bs(t.text,n):(s=Bs(t.text,n+i[0].length),s>-1&&i[0]=="xmpp:"&&(Is.lastIndex=s,i=Is.exec(t.text),i&&(s=i.index+i[0].length)));return s<0?-1:(t.addElement(t.elt("URL",r,s+t.offset)),s+t.offset)}}]},da=[EO,WO,LO,VO];function ma(t,e,r){return(n,i,s)=>{if(i!=t||n.char(s+1)==t)return-1;let a=[n.elt(r,s,s+1)];for(let o=s+1;or%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,r,n=0){let i=e.parser.context;return new t(e,[],r,n,n,0,[],0,i?new ar(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,r){this.stack.push(this.state,r,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var r;let n=e>>19,i=e&65535,{parser:s}=this.p,a=this.reducePos=2e3&&!(!((r=this.p.parser.nodeSet.types[i])===null||r===void 0)&&r.isAnonymous)&&(O==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizel;)this.stack.pop();this.reduceContext(i,O)}storeNode(e,r,n,i=4,s=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[a-4]==0&&this.buffer[a-1]>-1){if(r==n)return;if(this.buffer[a-2]>=r){this.buffer[a-2]=n;return}}}if(!s||this.pos==n)this.buffer.push(e,r,n,i);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let o=!1;for(let l=a;l>0&&this.buffer[l-2]>n;l-=4)if(this.buffer[l-1]>=0){o=!0;break}if(o)for(;a>0&&this.buffer[a-2]>n;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,i>4&&(i-=4)}this.buffer[a]=e,this.buffer[a+1]=r,this.buffer[a+2]=n,this.buffer[a+3]=i}}shift(e,r,n,i){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let s=e,{parser:a}=this.p;this.pos=i;let o=a.stateFlag(s,1);!o&&(i>n||r<=a.maxNode)&&(this.reducePos=i),this.pushState(s,o?n:Math.min(n,this.reducePos)),this.shiftContext(r,n),r<=a.maxNode&&this.buffer.push(r,n,i,4)}else this.pos=i,this.shiftContext(r,n),r<=this.p.parser.maxNode&&this.buffer.push(r,n,i,4)}apply(e,r,n,i){e&65536?this.reduce(e):this.shift(e,r,n,i)}useNode(e,r,n){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let s=this.reducePos=this.pos=n+e.length;this.pushState(r,n),this.buffer.push(i,n,s,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,r=e.buffer.length;for(r&&e.buffer[r-4]==0&&(r-=4);r>0&&e.buffer[r-2]>e.reducePos;)r-=4;let n=e.buffer.slice(r),i=e.bufferBase+r;for(;e&&i==e.bufferBase;)e=e.parent;return new t(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,r){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,r,4),this.storeNode(0,this.pos,r,n?8:4),this.pos=this.reducePos=r,this.score-=190}canShift(e){for(let r=new Xn(this);;){let n=this.p.parser.stateSlot(r.state,4)||this.p.parser.hasAction(r.state,e);if(n==0)return!1;if((n&65536)==0)return!0;r.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let r=this.p.parser.nextStates(this.state);if(r.length>8||this.stack.length>=120){let i=[];for(let s=0,a;sl&1&&o==a)||i.push(r[s],a)}r=i}let n=[];for(let i=0;i>19,i=r&65535,s=this.stack.length-n*3;if(s<0||e.getGoto(this.stack[s],i,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;r=a}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(r),!0}findForcedReduction(){let{parser:e}=this.p,r=[],n=(i,s)=>{if(!r.includes(i))return r.push(i),e.allActions(i,a=>{if(!(a&393216))if(a&65536){let o=(a>>19)-s;if(o>1){let l=a&65535,O=this.stack.length-o*3;if(O>=0&&e.getGoto(this.stack[O],l,!1)>=0)return o<<19|65536|l}}else{let o=n(a,s+1);if(o!=null)return o}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let r=0;r0&&this.emitLookAhead()}},ar=class{constructor(e,r){this.tracker=e,this.context=r,this.hash=e.strict?e.hash(r):0}},Xn=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let r=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let i=this.start.p.parser.getGoto(this.stack[this.base-3],r,!0);this.state=i}},vn=class t{constructor(e,r,n){this.stack=e,this.pos=r,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,r=e.bufferBase+e.buffer.length){return new t(e,r,r-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new t(this.stack,this.pos,this.index)}};function Pt(t,e=Uint16Array){if(typeof t!="string")return t;let r=null;for(let n=0,i=0;n=92&&a--,a>=34&&a--;let l=a-32;if(l>=46&&(l-=46,o=!0),s+=l,o)break;s*=46}r?r[i++]=s:r=new e(s)}return r}var et=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},ba=new et,Tn=class{constructor(e,r){this.input=e,this.ranges=r,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=ba,this.rangeIndex=0,this.pos=this.chunkPos=r[0].from,this.range=r[0],this.end=r[r.length-1].to,this.readNext()}resolveOffset(e,r){let n=this.range,i=this.rangeIndex,s=this.pos+e;for(;sn.to:s>=n.to;){if(i==this.ranges.length-1)return null;let a=this.ranges[++i];s+=a.from-n.to,n=a}return s}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,r.from);return this.end}peek(e){let r=this.chunkOff+e,n,i;if(r>=0&&r=this.chunk2Pos&&no.to&&(this.chunk2=this.chunk2.slice(0,o.to-n)),i=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),i}acceptToken(e,r=0){let n=r?this.resolveOffset(r,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,r){if(r?(this.token=r,r.start=e,r.lookAhead=e+1,r.value=r.extended=-1):this.token=ba,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&r<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,r-this.chunkPos);if(e>=this.chunk2Pos&&r<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,r-this.chunk2Pos);if(e>=this.range.from&&r<=this.range.to)return this.input.read(e,r);let n="";for(let i of this.ranges){if(i.from>=r)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,r)))}return n}},Se=class{constructor(e,r){this.data=e,this.id=r}token(e,r){let{parser:n}=r.p;wa(this.data,e,r,this.id,n.data,n.tokenPrecTable)}};Se.prototype.contextual=Se.prototype.fallback=Se.prototype.extend=!1;var ke=class{constructor(e,r,n){this.precTable=r,this.elseToken=n,this.data=typeof e=="string"?Pt(e):e}token(e,r){let n=e.pos,i=0;for(;;){let s=e.next<0,a=e.resolveOffset(1,1);if(wa(this.data,e,r,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(s||i++,a==null)break;e.reset(a,e.token)}i&&(e.reset(n,e.token),e.acceptToken(this.elseToken,i))}};ke.prototype.contextual=Se.prototype.fallback=Se.prototype.extend=!1;var z=class{constructor(e,r={}){this.token=e,this.contextual=!!r.contextual,this.fallback=!!r.fallback,this.extend=!!r.extend}};function wa(t,e,r,n,i,s){let a=0,o=1<0){let d=t[u];if(l.allows(d)&&(e.token.value==-1||e.token.value==d||IO(d,e.token.value,i,s))){e.acceptToken(d);break}}let c=e.next,h=0,p=t[a+2];if(e.next<0&&p>h&&t[O+p*3-3]==65535){a=t[O+p*3-1];continue e}for(;h>1,d=O+u+(u<<1),m=t[d],g=t[d+1]||65536;if(c=g)h=u+1;else{a=t[d+2],e.advance();continue e}}break}}function Sa(t,e,r){for(let n=e,i;(i=t[n])!=65535;n++)if(i==r)return n-e;return-1}function IO(t,e,r,n){let i=Sa(r,n,e);return i<0||Sa(r,n,t)e)&&!n.type.isError)return r<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(r<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return r<0?0:t.length}}var Rn=class{constructor(e,r){this.fragments=e,this.minRepeat=r,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?ka(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?ka(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(s instanceof M){let o=a>this.lastRepeatPos&&s.type.id>=this.minRepeat;if(a==e||o){let l=a+s.length,O;if(a>=this.safeFrom&&l<=this.safeTo&&(!(O=s.prop(K.lookAhead))||l+O=Math.max(this.safeFrom,e)&&(this.trees.push(s),this.start.push(a),this.index.push(0))}else this.index[r]++,this.nextStart=a+s.length}}},jn=class{constructor(e,r){this.stream=r,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new et)}getActions(e){let r=0,n=null,{parser:i}=e.p,{tokenizers:s}=i,a=i.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,l=0;for(let O=0;Oh.end+25&&(l=Math.max(h.lookAhead,l)),h.value!=0)){let p=r;if(h.extended>-1&&(r=this.addActions(e,h.extended,h.end,r)),r=this.addActions(e,h.value,h.end,r),!c.extend&&(n=h,r>p))break}}for(;this.actions.length>r;)this.actions.pop();return l&&e.setLookAhead(l),!n&&e.pos==this.stream.end&&(n=new et,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,r=this.addActions(e,n.value,n.end,r)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let r=new et,{pos:n,p:i}=e;return r.start=n,r.end=Math.min(n+1,i.stream.end),r.value=n==i.stream.end?i.parser.eofTerm:0,r}updateCachedToken(e,r,n){let i=this.stream.clipPos(n.pos);if(r.token(this.stream.reset(i,e),n),e.value>-1){let{parser:s}=n.p;for(let a=0;a=0&&n.p.parser.dialect.allows(o>>1)){(o&1)==0?e.value=o>>1:e.extended=o>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,r,n,i){for(let s=0;se.bufferLength*4?new Rn(n,e.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,r=this.minStackPos,n=this.stacks=[],i,s;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;ar)n.push(o);else{if(this.advanceStack(o,n,e))continue;{i||(i=[],s=[]),i.push(o);let l=this.tokens.getMainToken(o);s.push(l.value,l.end)}}break}}if(!n.length){let a=i&&DO(i);if(a)return B&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw B&&i&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+r);this.recovering||(this.recovering=5)}if(this.recovering&&i){let a=this.stoppedAt!=null&&i[0].pos>this.stoppedAt?i[0]:this.runRecovery(i,s,n);if(a)return B&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(n.length>a)for(n.sort((o,l)=>l.score-o.score);n.length>a;)n.pop();n.some(o=>o.reducePos>r)&&this.recovering--}else if(n.length>1){e:for(let a=0;a500&&O.buffer.length>500)if((o.score-O.score||o.buffer.length-O.buffer.length)>0)n.splice(l--,1);else{n.splice(a--,1);continue e}}}n.length>12&&(n.sort((a,o)=>o.score-a.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let a=1;a-1&&n.length&&(!s||(n.prop(K.contextHash)||0)==a))return e.useNode(n,o,r),n;if(n.children.length==0||n.positions[0]>0)break;let l=n.children[0];if(l instanceof M&&(!i||l.type.id>=this.parser.minRepeatTerm))n=l;else break}return null}advanceStack(e,r,n){let i=e.pos,{parser:s}=this,a=B?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let O=e.reducePos0)return e.reduce(o),B&&console.log(a+this.stackID(e)+` (via always-reduce ${s.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let O=0;Oi?r.push(d):n.push(d)}return!1}advanceFully(e,r){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Pa(e,r),!0}}runRecovery(e,r,n){let i=null,s=!1;for(let a=0;a ":"";if(o.deadEnd&&(s||(s=!0,o.restart(),B&&console.log(c+this.stackID(o)+" (restarted)"),this.advanceFully(o,n))))continue;let h=o.split(),p=c;for(let u=0;u<10&&h.forceReduce()&&(B&&console.log(p+this.stackID(h)+" (via force-reduce)"),!this.advanceFully(h,n));u++)B&&(p=this.stackID(h)+" -> ");for(let u of o.recoverByInsert(l))B&&console.log(c+this.stackID(u)+" (via recover-insert)"),this.advanceFully(u,n);this.stream.end>o.pos?(O==o.pos&&(O++,l=0),o.recoverByDelete(l,O),B&&console.log(c+this.stackID(o)+` (via recover-delete ${this.parser.getName(l)})`),Pa(o,n)):(!i||i.scoret,tt=class{constructor(e){this.start=e.start,this.shift=e.shift||yn,this.reduce=e.reduce||yn,this.reuse=e.reuse||yn,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},Pe=class t extends Mt{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let r=e.nodeNames.split(" ");this.minRepeatTerm=r.length;for(let o=0;oe.topRules[o][1]),i=[];for(let o=0;o=0)s(c,l,o[O++]);else{let h=o[O+-c];for(let p=-c;p>0;p--)s(o[O++],l,h);O++}}}this.nodeSet=new pt(r.map((o,l)=>Re.define({name:l>=this.minRepeatTerm?void 0:o,id:l,props:i[l],top:n.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let a=Pt(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let o=0;otypeof o=="number"?new Se(a,o):o),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,r,n){let i=new _n(this,e,r,n);for(let s of this.wrappers)i=s(i,e,r,n);return i}getGoto(e,r,n=!1){let i=this.goto;if(r>=i[0])return-1;for(let s=i[r+1];;){let a=i[s++],o=a&1,l=i[s++];if(o&&n)return l;for(let O=s+(a>>1);s0}validAction(e,r){return!!this.allActions(e,n=>n==r?!0:null)}allActions(e,r){let n=this.stateSlot(e,4),i=n?r(n):void 0;for(let s=this.stateSlot(e,1);i==null;s+=3){if(this.data[s]==65535)if(this.data[s+1]==1)s=pe(this.data,s+2);else break;i=r(pe(this.data,s+1))}return i}nextStates(e){let r=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=pe(this.data,n+2);else break;if((this.data[n+2]&1)==0){let i=this.data[n+1];r.some((s,a)=>a&1&&s==i)||r.push(this.data[n],i)}}return r}configure(e){let r=Object.assign(Object.create(t.prototype),this);if(e.props&&(r.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);r.top=n}return e.tokenizers&&(r.tokenizers=this.tokenizers.map(n=>{let i=e.tokenizers.find(s=>s.from==n);return i?i.to:n})),e.specializers&&(r.specializers=this.specializers.slice(),r.specializerSpecs=this.specializerSpecs.map((n,i)=>{let s=e.specializers.find(o=>o.from==n.external);if(!s)return n;let a=Object.assign(Object.assign({},n),{external:s.to});return r.specializers[i]=xa(a),a})),e.contextTracker&&(r.context=e.contextTracker),e.dialect&&(r.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(r.strict=e.strict),e.wrap&&(r.wrappers=r.wrappers.concat(e.wrap)),e.bufferLength!=null&&(r.bufferLength=e.bufferLength),r}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let r=this.dynamicPrecedences;return r==null?0:r[e]||0}parseDialect(e){let r=Object.keys(this.dialects),n=r.map(()=>!1);if(e)for(let s of e.split(" ")){let a=r.indexOf(s);a>=0&&(n[a]=!0)}let i=null;for(let s=0;sn)&&r.p.parser.stateFlag(r.state,2)&&(!e||e.scoret.external(r,n)<<1|e}return t.get}var BO=55,NO=1,FO=56,HO=2,KO=57,JO=3,ya=4,ec=5,Ln=6,Ca=7,Ya=8,za=9,qa=10,tc=11,rc=12,nc=13,Yn=58,ic=14,sc=15,Za=59,Aa=21,ac=23,La=24,oc=25,qn=27,Ea=28,lc=29,Oc=32,cc=35,hc=37,uc=38,pc=0,fc=1,dc={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},mc={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},Xa={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function gc(t){return t==45||t==46||t==58||t>=65&&t<=90||t==95||t>=97&&t<=122||t>=161}var va=null,Ta=null,Ra=0;function An(t,e){let r=t.pos+e;if(Ra==r&&Ta==t)return va;let n=t.peek(e),i="";for(;gc(n);)i+=String.fromCharCode(n),n=t.peek(++e);return Ta=t,Ra=r,va=i?i.toLowerCase():n==Qc||n==$c?void 0:null}var Wa=60,or=62,En=47,Qc=63,$c=33,bc=45;function ja(t,e){this.name=t,this.parent=e}var Sc=[Ln,qa,Ca,Ya,za],kc=new tt({start:null,shift(t,e,r,n){return Sc.indexOf(e)>-1?new ja(An(n,1)||"",t):t},reduce(t,e){return e==Aa&&t?t.parent:t},reuse(t,e,r,n){let i=e.type.id;return i==Ln||i==hc?new ja(An(n,1)||"",t):t},strict:!1}),Pc=new z((t,e)=>{if(t.next!=Wa){t.next<0&&e.context&&t.acceptToken(Yn);return}t.advance();let r=t.next==En;r&&t.advance();let n=An(t,0);if(n===void 0)return;if(!n)return t.acceptToken(r?sc:ic);let i=e.context?e.context.name:null;if(r){if(n==i)return t.acceptToken(tc);if(i&&mc[i])return t.acceptToken(Yn,-2);if(e.dialectEnabled(pc))return t.acceptToken(rc);for(let s=e.context;s;s=s.parent)if(s.name==n)return;t.acceptToken(nc)}else{if(n=="script")return t.acceptToken(Ca);if(n=="style")return t.acceptToken(Ya);if(n=="textarea")return t.acceptToken(za);if(dc.hasOwnProperty(n))return t.acceptToken(qa);i&&Xa[i]&&Xa[i][n]?t.acceptToken(Yn,-1):t.acceptToken(Ln)}},{contextual:!0}),xc=new z(t=>{for(let e=0,r=0;;r++){if(t.next<0){r&&t.acceptToken(Za);break}if(t.next==bc)e++;else if(t.next==or&&e>=2){r>=3&&t.acceptToken(Za,-2);break}else e=0;t.advance()}});function wc(t){for(;t;t=t.parent)if(t.name=="svg"||t.name=="math")return!0;return!1}var yc=new z((t,e)=>{if(t.next==En&&t.peek(1)==or){let r=e.dialectEnabled(fc)||wc(e.context);t.acceptToken(r?ec:ya,2)}else t.next==or&&t.acceptToken(ya,1)});function Wn(t,e,r){let n=2+t.length;return new z(i=>{for(let s=0,a=0,o=0;;o++){if(i.next<0){o&&i.acceptToken(e);break}if(s==0&&i.next==Wa||s==1&&i.next==En||s>=2&&sa?i.acceptToken(e,-a):i.acceptToken(r,-(a-2));break}else if((i.next==10||i.next==13)&&o){i.acceptToken(e,1);break}else s=a=0;i.advance()}})}var Zc=Wn("script",BO,NO),Xc=Wn("style",FO,HO),vc=Wn("textarea",KO,JO),Tc=Oe({"Text RawText IncompleteTag IncompleteCloseTag":f.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":f.angleBracket,TagName:f.tagName,"MismatchedCloseTag/TagName":[f.tagName,f.invalid],AttributeName:f.attributeName,"AttributeValue UnquotedAttributeValue":f.attributeValue,Is:f.definitionOperator,"EntityReference CharacterReference":f.character,Comment:f.blockComment,ProcessingInst:f.processingInstruction,DoctypeDecl:f.documentMeta}),Ma=Pe.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOOO`'#DZ'#DZQVO!rOOO%UQ&rO,59^O%aQ&rO,59gO%lQ&rO,59jO%wQ&rO,59mO&SQ&rO,59oOOOa'#D_'#D_O&_OaO'#CyO&jOaO,59]OOOb'#D`'#D`O&rObO'#C|O&}ObO,59]OOOd'#Da'#DaO'VOdO'#DPO'bOdO,59]OOO`'#Db'#DbO'jO!rO,59]O'qQ#tO'#DSOOO`,59],59]OOOp'#Dc'#DcO'vO$fO,59pOOO`,59p,59pO(OQ#|O,59rO(TQ#|O,59sOOO`-E7X-E7XO(YQ&rO'#CtOOQW'#D['#D[O(hQ&rO1G.xOOOa1G.x1G.xOOO`1G/Z1G/ZO(sQ&rO1G/ROOOb1G/R1G/RO)OQ&rO1G/UOOOd1G/U1G/UO)ZQ&rO1G/XOOO`1G/X1G/XO)fQ&rO1G/ZOOOa-E7]-E7]O)qQ#tO'#CzOOO`1G.w1G.wOOOb-E7^-E7^O)vQ#tO'#C}OOOd-E7_-E7_O){Q#tO'#DQOOO`-E7`-E7`O*QQ#|O,59nOOOp-E7a-E7aOOO`1G/[1G/[OOO`1G/^1G/^O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PP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:"\u26A0 StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:kc,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent Entity"],["isolate",-11,22,30,31,33,34,36,37,38,39,42,43,"ltr",-3,27,28,40,""]],propSources:[Tc],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYl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<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!{let O=o.type.id;if(O==lc)return zn(o,l,r);if(O==Oc)return zn(o,l,n);if(O==cc)return zn(o,l,i);if(O==Aa&&s.length){let c=o.node,h=c.firstChild,p=h&&_a(h,l),u;if(p){for(let d of s)if(d.tag==p&&(!d.attrs||d.attrs(u||(u=Ua(h,l))))){let m=c.lastChild,g=m.type.id==uc?m.from:c.to;if(g>h.to)return{parser:d.parser,overlay:[{from:h.to,to:g}]}}}}if(a&&O==La){let c=o.node,h;if(h=c.firstChild){let p=a[l.read(h.from,h.to)];if(p)for(let u of p){if(u.tagName&&u.tagName!=_a(c.parent,l))continue;let d=c.lastChild;if(d.type.id==qn){let m=d.from+1,g=d.lastChild,b=d.to-(g&&g.isError?0:1);if(b>m)return{parser:u.parser,overlay:[{from:m,to:b}],bracketed:!0}}else if(d.type.id==Ea)return{parser:u.parser,overlay:[{from:d.from,to:d.to}]}}}}return null})}var Rc=148,Va=1,jc=149,_c=150,Da=2,Cc=151,Yc=3,zc=4,qc=152,Ba=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],Ac=58,Lc=40,Na=95,Ec=91,lr=45,Wc=46,Mc=35,Uc=37,Vc=38,Gc=92,Ic=10,Dc=42;function xt(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}function Un(t){return t>=48&&t<=57}function Ga(t){return Un(t)||t>=97&&t<=102||t>=65&&t<=70}var Fa=(t,e,r)=>(n,i)=>{for(let s=!1,a=0,o=0;;o++){let{next:l}=n;if(xt(l)||l==lr||l==Na||s&&Un(l))!s&&(l!=lr||o>0)&&(s=!0),a===o&&l==lr&&a++,n.advance();else if(l==Gc&&n.peek(1)!=Ic){if(n.advance(),Ga(n.next)){do n.advance();while(Ga(n.next));n.next==32&&n.advance()}else n.next>-1&&n.advance();s=!0}else{s&&n.acceptToken(a>=2&&i.canShift(Da)?e:l==Lc?r:t);break}}},Bc=new z(Fa(jc,Da,_c),{contextual:!0}),Nc=new z(Fa(Cc,Yc,zc),{contextual:!0}),Fc=new z(t=>{if(Ba.includes(t.peek(-1))){let{next:e}=t;(xt(e)||e==Na||e==Mc||e==Wc||e==Dc||e==Ec||e==Ac&&xt(t.peek(1))||e==lr||e==Vc)&&t.acceptToken(Rc)}}),Hc=new z(t=>{if(!Ba.includes(t.peek(-1))){let{next:e}=t;if(e==Uc&&(t.advance(),t.acceptToken(Va)),xt(e)){do t.advance();while(xt(t.next)||Un(t.next));t.acceptToken(Va)}}});function Ia(t){let e=t.length;return(e==4||e==5||e==7||e==9)&&/^#[a-f\d]+$/i.test(t)?qc:-1}var Kc=Oe({"AtKeyword import charset namespace keyframes media supports font-feature-values":f.definitionKeyword,"from to selector scope MatchFlag":f.keyword,NamespaceName:f.namespace,KeyframeName:f.labelName,KeyframeRangeName:f.operatorKeyword,TagName:f.tagName,ClassName:f.className,PseudoClassName:f.constant(f.className),IdName:f.labelName,"FeatureName PropertyName":f.propertyName,AttributeName:f.attributeName,NumberLiteral:f.number,KeywordQuery:f.keyword,UnaryQueryOp:f.operatorKeyword,"CallTag ValueName FontName":f.atom,VariableName:f.variableName,Callee:f.operatorKeyword,Unit:f.unit,"UniversalSelector NestingSelector":f.definitionOperator,"MatchOp CompareOp":f.compareOperator,"ChildOp SiblingOp, LogicOp":f.logicOperator,BinOp:f.arithmeticOperator,Important:f.modifier,Comment:f.blockComment,ColorLiteral:f.color,"ParenthesizedContent StringLiteral":f.string,":":f.punctuation,PseudoOp:f.derefOperator,"; , |":f.separator,"( )":f.paren,"[ ]":f.squareBracket,"{ }":f.brace}),Jc={__proto__:null,lang:44,"nth-child":44,"nth-last-child":44,"nth-of-type":44,"nth-last-of-type":44,dir:44,"host-context":44,if:88,url:158,"url-prefix":158,domain:158,regexp:158},eh={__proto__:null,or:102,and:102,not:112,only:112,layer:212},th={__proto__:null,selector:118,style:124,layer:208},rh={__proto__:null,"@import":204,"@media":216,"@charset":220,"@namespace":224,"@keyframes":230,"@supports":242,"@scope":246,"@font-feature-values":252},nh={__proto__:null,to:249},Ha=Pe.deserialize({version:14,states:"MrQYQdOOO$TQdOOP$[O`OOO%XQaO'#CfOOQP'#Ce'#CeO%`QdO'#CgO%eQ`O'#CgO%jQaO'#FrO&eQdO'#CkO'XQaO'#CcO'cQdO'#CnOOQP'#ES'#ESOOQP'#ER'#ERO'nQdO'#ETO'yQdO'#E[O'yQdO'#E_OOQP'#Fr'#FrO)`QhO'#FQOOQS'#Fq'#FqOOQS'#FT'#FTQYQdOOO)gQdO'#EeO*vQhO'#EkO)gQdO'#EmO*}QdO'#EoO+YQdO'#ErO*[QhO'#ExO+bQdO'#EzO+mQdO'#E}O+rQaO'#CfO+yQ`O'#EbO,OQ`O'#GPO,ZQdO'#GPQOQ`OOP,eO&jO'#CaPOOO)CAa)CAaOOQP'#Ci'#CiOOQP,59R,59RO%`QdO,59ROOQP'#Cm'#CmOOQP,59V,59VO&eQdO,59VO,pQdO,59YOOQP,5:m,5:mO'nQdO,5:oO'yQdO,5:vO'yQdO,5:xO'yQdO,5:yO'yQdO'#F[O,{Q`O,58}O-TQdO'#EaOOQS,58},58}OOQP'#Cq'#CqOOQO'#EP'#EPOOQP,59Y,59YO-[Q`O,59YO-aQ`O,59YO-fQpO'#EUO-qQdO'#EVO-vQ`O'#EVO-{QpO,5:oO.iQaO,5:vO/PQaO,5:yOOQW'#D]'#D]O0OQhO'#DgO0cQhO,5;lO*[QhO'#DeO0pQ`O'#DnO0uQhO'#D{OO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%j;'S;=`%{<%lO%jj@v[lY!r`Oy%jz}%j}!O@o!O!Q%j!Q![@o![!c%j!c!}@o!}#T%j#T#o@o#o;'S%j;'S;=`%{<%lO%jhAqS!}WOy%jz;'S%j;'S;=`%{<%lO%jjBSSoYOy%jz;'S%j;'S;=`%{<%lO%jnBeSn^Oy%jz;'S%j;'S;=`%{<%lO%jjBvU!}WOy%jz#a%j#a#bCY#b;'S%j;'S;=`%{<%lO%jbC_U!r`Oy%jz#d%j#d#eCq#e;'S%j;'S;=`%{<%lO%jbCvU!r`Oy%jz#c%j#c#dDY#d;'S%j;'S;=`%{<%lO%jbD_U!r`Oy%jz#f%j#f#gDq#g;'S%j;'S;=`%{<%lO%jbDvU!r`Oy%jz#h%j#h#iEY#i;'S%j;'S;=`%{<%lO%jbE_U!r`Oy%jz#T%j#T#UEq#U;'S%j;'S;=`%{<%lO%jbEvU!r`Oy%jz#b%j#b#cFY#c;'S%j;'S;=`%{<%lO%jbF_U!r`Oy%jz#h%j#h#iFq#i;'S%j;'S;=`%{<%lO%jbFxS$tQ!r`Oy%jz;'S%j;'S;=`%{<%lO%jjGZSrYOy%jz;'S%j;'S;=`%{<%lO%jfGlU$gUOy%jz!_%j!_!`0^!`;'S%j;'S;=`%{<%lO%jjHTSqYOy%jz;'S%j;'S;=`%{<%lO%jfHfU#SQOy%jz!_%j!_!`0^!`;'S%j;'S;=`%{<%lO%j`H{P;=`<%l%Z",tokenizers:[Fc,Hc,Bc,Nc,1,2,3,4,new ke("m~RRYZ[z{a~~g~aO$c~~dP!P!Qg~lO$d~~",28,156)],topRules:{StyleSheet:[0,6],Styles:[1,129]},dynamicPrecedences:{97:1},specialized:[{term:172,get:(t,e)=>Ia(t)<<1,external:Ia},{term:150,get:t=>Jc[t]||-1},{term:151,get:t=>eh[t]||-1},{term:4,get:t=>th[t]||-1},{term:28,get:t=>rh[t]||-1},{term:149,get:t=>nh[t]||-1}],tokenPrec:2433});var Vn=null;function Gn(){if(!Vn&&typeof document=="object"&&document.body){let{style:t}=document.body,e=[],r=new Set;for(let n in t)n!="cssText"&&n!="cssFloat"&&typeof t[n]=="string"&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,i=>"-"+i.toLowerCase())),r.has(n)||(e.push(n),r.add(n)));Vn=e.sort().map(n=>({type:"property",label:n,apply:n+": "}))}return Vn||[]}var Ka=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(t=>({type:"class",label:t})),Ja=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(t=>({type:"keyword",label:t})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(t=>({type:"constant",label:t}))),ih=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(t=>({type:"type",label:t})),sh=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(t=>({type:"keyword",label:t})),fe=/^(\w[\w-]*|-\w[\w-]*|)$/,ah=/^-(-[\w-]*)?$/;function oh(t,e){var r;if((t.name=="("||t.type.isError)&&(t=t.parent||t),t.name!="ArgList")return!1;let n=(r=t.parent)===null||r===void 0?void 0:r.firstChild;return n?.name!="Callee"?!1:e.sliceString(n.from,n.to)=="var"}var eo=new Wt,lh=["Declaration"];function Oh(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function to(t,e,r){if(e.to-e.from>4096){let n=eo.get(e);if(n)return n;let i=[],s=new Set,a=e.cursor(le.IncludeAnonymous);if(a.firstChild())do for(let o of to(t,a.node,r))s.has(o.label)||(s.add(o.label),i.push(o));while(a.nextSibling());return eo.set(e,i),i}else{let n=[],i=new Set;return e.cursor().iterate(s=>{var a;if(r(s)&&s.matchContext(lh)&&((a=s.node.nextSibling)===null||a===void 0?void 0:a.name)==":"){let o=t.sliceString(s.from,s.to);i.has(o)||(i.add(o),n.push({label:o,type:"variable"}))}}),n}}var ch=t=>e=>{let{state:r,pos:n}=e,i=R(r).resolveInner(n,-1),s=i.type.isError&&i.from==i.to-1&&r.doc.sliceString(i.from,i.to)=="-";if(i.name=="PropertyName"||(s||i.name=="TagName")&&/^(Block|Styles)$/.test(i.resolve(i.to).name))return{from:i.from,options:Gn(),validFor:fe};if(i.name=="ValueName")return{from:i.from,options:Ja,validFor:fe};if(i.name=="PseudoClassName")return{from:i.from,options:Ka,validFor:fe};if(t(i)||(e.explicit||s)&&oh(i,r.doc))return{from:t(i)||s?i.from:n,options:to(r.doc,Oh(i),t),validFor:ah};if(i.name=="TagName"){for(let{parent:l}=i;l;l=l.parent)if(l.name=="Block")return{from:i.from,options:Gn(),validFor:fe};return{from:i.from,options:ih,validFor:fe}}if(i.name=="AtKeyword")return{from:i.from,options:sh,validFor:fe};if(!e.explicit)return null;let a=i.resolve(n),o=a.childBefore(n);return o&&o.name==":"&&a.name=="PseudoClassSelector"?{from:n,options:Ka,validFor:fe}:o&&o.name==":"&&a.name=="Declaration"||a.name=="ArgList"?{from:n,options:Ja,validFor:fe}:a.name=="Block"||a.name=="Styles"?{from:n,options:Gn(),validFor:fe}:null},hh=ch(t=>t.name=="VariableName"),wt=Ne.define({name:"css",parser:Ha.configure({props:[$e.add({Declaration:Fe()}),he.add({"Block KeyframeList":It})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function ro(){return new ce(wt,wt.data.of({autocomplete:hh}))}var uh=317,ph=318,no=1,fh=2,dh=3,mh=4,gh=319,Qh=321,$h=322,bh=5,Sh=6,kh=0,Dn=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],io=125,Ph=59,Bn=47,xh=42,wh=43,yh=45,Zh=60,Xh=44,vh=63,Th=46,Rh=91,jh=new tt({start:!1,shift(t,e){return e==bh||e==Sh||e==Qh?t:e==$h},strict:!1}),_h=new z((t,e)=>{let{next:r}=t;(r==io||r==-1||e.context)&&t.acceptToken(gh)},{contextual:!0,fallback:!0}),Ch=new z((t,e)=>{let{next:r}=t,n;Dn.indexOf(r)>-1||r==Bn&&((n=t.peek(1))==Bn||n==xh)||r!=io&&r!=Ph&&r!=-1&&!e.context&&t.acceptToken(uh)},{contextual:!0}),Yh=new z((t,e)=>{t.next==Rh&&!e.context&&t.acceptToken(ph)},{contextual:!0}),zh=new z((t,e)=>{let{next:r}=t;if(r==wh||r==yh){if(t.advance(),r==t.next){t.advance();let n=!e.context&&e.canShift(no);t.acceptToken(n?no:fh)}}else r==vh&&t.peek(1)==Th&&(t.advance(),t.advance(),(t.next<48||t.next>57)&&t.acceptToken(dh))},{contextual:!0});function In(t,e){return t>=65&&t<=90||t>=97&&t<=122||t==95||t>=192||!e&&t>=48&&t<=57}var qh=new z((t,e)=>{if(t.next!=Zh||!e.dialectEnabled(kh)||(t.advance(),t.next==Bn))return;let r=0;for(;Dn.indexOf(t.next)>-1;)t.advance(),r++;if(In(t.next,!0)){for(t.advance(),r++;In(t.next,!1);)t.advance(),r++;for(;Dn.indexOf(t.next)>-1;)t.advance(),r++;if(t.next==Xh)return;for(let n=0;;n++){if(n==7){if(!In(t.next,!0))return;break}if(t.next!="extends".charCodeAt(n))break;t.advance(),r++}}t.acceptToken(mh,-r)}),Ah=Oe({"get set async static":f.modifier,"for while do if else switch try catch finally return throw break continue default case defer":f.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":f.operatorKeyword,"let var const using function class extends":f.definitionKeyword,"import export from":f.moduleKeyword,"with debugger new":f.keyword,TemplateString:f.special(f.string),super:f.atom,BooleanLiteral:f.bool,this:f.self,null:f.null,Star:f.modifier,VariableName:f.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":f.function(f.variableName),VariableDefinition:f.definition(f.variableName),Label:f.labelName,PropertyName:f.propertyName,PrivatePropertyName:f.special(f.propertyName),"CallExpression/MemberExpression/PropertyName":f.function(f.propertyName),"FunctionDeclaration/VariableDefinition":f.function(f.definition(f.variableName)),"ClassDeclaration/VariableDefinition":f.definition(f.className),"NewExpression/VariableName":f.className,PropertyDefinition:f.definition(f.propertyName),PrivatePropertyDefinition:f.definition(f.special(f.propertyName)),UpdateOp:f.updateOperator,"LineComment Hashbang":f.lineComment,BlockComment:f.blockComment,Number:f.number,String:f.string,Escape:f.escape,ArithOp:f.arithmeticOperator,LogicOp:f.logicOperator,BitOp:f.bitwiseOperator,CompareOp:f.compareOperator,RegExp:f.regexp,Equals:f.definitionOperator,Arrow:f.function(f.punctuation),": Spread":f.punctuation,"( )":f.paren,"[ ]":f.squareBracket,"{ }":f.brace,"InterpolationStart InterpolationEnd":f.special(f.brace),".":f.derefOperator,", ;":f.separator,"@":f.meta,TypeName:f.typeName,TypeDefinition:f.definition(f.typeName),"type enum interface implements namespace module declare":f.definitionKeyword,"abstract global Privacy readonly override":f.modifier,"is keyof unique infer asserts":f.operatorKeyword,JSXAttributeValue:f.attributeValue,JSXText:f.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":f.angleBracket,"JSXIdentifier JSXNameSpacedName":f.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":f.attributeName,"JSXBuiltin/JSXIdentifier":f.standard(f.tagName)}),Lh={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:237,private:237,protected:237,readonly:239,instanceof:258,satisfies:261,import:294,keyof:351,unique:355,infer:361,asserts:397,is:399,abstract:419,implements:421,type:423,let:426,var:428,using:431,interface:437,enum:441,namespace:447,module:449,declare:453,global:457,defer:473,for:478,of:487,while:490,with:494,do:498,if:502,else:504,switch:508,case:514,try:520,catch:524,finally:528,return:532,throw:536,break:540,continue:544,debugger:548},Eh={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:403},Wh={__proto__:null,"<":193},so=Pe.deserialize({version:14,states:"$GSQ%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0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#xQ!fQT-f'a-g]!qQ!r'a-g1q5}Q#p]R'j < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty VariableDefinition Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:381,context:jh,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,208,212,216,217,219,222,225,235,238,244,246,248,250,253,259,265,267,269,271,273,275,276,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,121,122,137,140,142,143,144,145,146,148,149,168,170,172,"Expression",-23,31,33,37,41,43,45,174,176,178,179,181,182,183,185,186,187,189,190,191,202,204,206,207,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",161,"JSXStartCloseTag"],["closedBy",-2,24,169,">",40,"InterpolationEnd",50,"]",61,"}",74,")",166,"JSXEndTag"]],propSources:[Ah],skippedNodes:[0,5,6,279],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;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ZXz{^~^O(R~~aP!P!Qd~iO(S~~",25,324)],topRules:{Script:[0,7],SingleExpression:[1,277],SingleClassItem:[2,278]},dialects:{jsx:0,ts:15179},dynamicPrecedences:{80:1,82:1,94:1,170:1,200:1},specialized:[{term:328,get:t=>Lh[t]||-1},{term:344,get:t=>Eh[t]||-1},{term:95,get:t=>Wh[t]||-1}],tokenPrec:15205});var Oo=[L("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),L("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),L("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),L("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),L("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),L(`try { +import{$ as U,A as Me,B as _,C as pt,D as la,E as ms,F as ca,G as gs,H as bs,I as Oa,Ia as ya,J as ua,K as ha,L as Te,M as mt,N as hr,O as Ue,P as me,Q as Jr,R as en,S as tn,T as fa,U as We,V as m,W as da,X as rn,Y as Qs,Z as pa,_ as qt,a as ra,aa as ma,b as ds,ba as Ve,c as pe,ca as xs,d as cr,da as nn,e as je,ea as rt,f as Hr,fa as ga,g as z,ga as ba,h as Lt,ha as zt,i as Xe,ia as Qa,j as et,ja as Ie,k as ps,ka as sn,l as na,la as xa,m as re,ma as $a,n as Or,na as ka,o as le,p as tt,q as ur,r as sa,s as ia,t as oa,tc as Pa,u as Yt,uc as wa,v as $e,w as Oe,x as j,y as aa,ya as Sa,z as Kr}from"./chunks/chunk-GJGDCSZU.js";import{a as on}from"./chunks/chunk-TO3N6BD7.js";import"./chunks/chunk-Y6SLVHK3.js";var Mt=class{constructor(e,r,n,s){this.state=e,this.pos=r,this.explicit=n,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let r=U(this.state).resolveInner(this.pos,-1);for(;r&&e.indexOf(r.name)<0;)r=r.parent;return r?{from:r.from,to:this.pos,text:this.state.sliceDoc(r.from,this.pos),type:r.type}:null}matchBefore(e){let r=this.state.doc.lineAt(this.pos),n=Math.max(r.from,this.pos-250),s=r.text.slice(n-r.from,this.pos-r.from),i=s.search(Aa(e,!1));return i<0?null:{from:n+i,to:this.pos,text:s.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,r,n){e=="abort"&&this.abortListeners&&(this.abortListeners.push(r),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function va(t){let e=Object.keys(t).join(""),r=/\w/.test(e);return r&&(e=e.replace(/\w/g,"")),`[${r?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function ih(t){let e=Object.create(null),r=Object.create(null);for(let{label:s}of t){e[s[0]]=!0;for(let i=1;itypeof s=="string"?{label:s}:s),[r,n]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:ih(e);return s=>{let i=s.matchBefore(n);return i||s.explicit?{from:i?i.from:s.pos,options:e,validFor:r}:null}}function Ca(t,e){return r=>{for(let n=U(r.state).resolveInner(r.pos,-1);n;n=n.parent){if(t.indexOf(n.name)>-1)return null;if(n.type.isTop)break}return e(r)}}var ln=class{constructor(e,r,n,s){this.completion=e,this.source=r,this.match=n,this.score=s}};function bt(t){return t.selection.main.from}function Aa(t,e){var r;let{source:n}=t,s=e&&n[0]!="^",i=n[n.length-1]!="$";return!s&&!i?t:new RegExp(`${s?"^":""}(?:${n})${i?"$":""}`,(r=t.flags)!==null&&r!==void 0?r:t.ignoreCase?"i":"")}var _s=na.define();function oh(t,e,r,n){let{main:s}=t.selection,i=r-s.from,o=n-s.from;return{...t.changeByRange(a=>{if(a!=s&&r!=n&&t.sliceDoc(a.from+i,a.from+o)!=t.sliceDoc(r,n))return{range:a};let l=t.toText(e);return{changes:{from:a.from+i,to:n==s.from?a.to:a.from+o,insert:l},range:z.cursor(a.from+i+l.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}var Za=new WeakMap;function ah(t){if(!Array.isArray(t))return t;let e=Za.get(t);return e||Za.set(t,e=Es(t)),e}var cn=re.define(),fr=re.define(),ys=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let r=0;r=48&&w<=57||w>=97&&w<=122?2:w>=65&&w<=90?1:0:(y=cr(w))!=y.toLowerCase()?1:y!=y.toUpperCase()?2:0;(!b||T==1&&g||k==0&&T!=0)&&(r[u]==w||n[u]==w&&(h=!0)?o[u++]=b:o.length&&(Q=!1)),k=T,b+=je(w)}return u==l&&o[0]==0&&Q?this.result(-100+(h?-200:0),o,e):f==l&&p==0?this.ret(-200-e.length+(d==e.length?0:-100),[0,d]):a>-1?this.ret(-700-e.length,[a,a+this.pattern.length]):f==l?this.ret(-900-e.length,[p,d]):u==l?this.result(-100+(h?-200:0)+-700+(Q?0:-1100),o,e):r.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,r,n){let s=[],i=0;for(let o of r){let a=o+(this.astral?je(pe(n,o)):1);i&&s[i-1]==o?s[i-1]=a:(s[i++]=o,s[i++]=a)}return this.ret(e-n.length,s)}},Ps=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:lh,filterStrict:!1,compareCompletions:(e,r)=>(e.sortText||e.label).localeCompare(r.sortText||r.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,r)=>e&&r,closeOnBlur:(e,r)=>e&&r,icons:(e,r)=>e&&r,tooltipClass:(e,r)=>n=>Xa(e(n),r(n)),optionClass:(e,r)=>n=>Xa(e(n),r(n)),addToOptions:(e,r)=>e.concat(r),filterStrict:(e,r)=>e||r})}});function Xa(t,e){return t?e?t+" "+e:t:e}function lh(t,e,r,n,s,i){let o=t.textDirection==aa.RTL,a=o,l=!1,c="top",O,u,h=e.left-s.left,f=s.right-e.right,p=n.right-n.left,d=n.bottom-n.top;if(a&&h=d||b>e.top?O=r.bottom-e.top:(c="bottom",O=e.bottom-r.top)}let g=(e.bottom-e.top)/i.offsetHeight,Q=(e.right-e.left)/i.offsetWidth;return{style:`${c}: ${O/g}px; max-width: ${u/Q}px`,class:"cm-completionInfo-"+(l?o?"left-narrow":"right-narrow":a?"left":"right")}}var Cs=re.define();function ch(t){let e=t.addToOptions.slice();return t.icons&&e.push({render(r){let n=document.createElement("div");return n.classList.add("cm-completionIcon"),r.type&&n.classList.add(...r.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),n.setAttribute("aria-hidden","true"),n},position:20}),e.push({render(r,n,s,i){let o=document.createElement("span");o.className="cm-completionLabel";let a=r.displayLabel||r.label,l=0;for(let c=0;cl&&o.appendChild(document.createTextNode(a.slice(l,O)));let h=o.appendChild(document.createElement("span"));h.appendChild(document.createTextNode(a.slice(O,u))),h.className="cm-completionMatchedText",l=u}return lr.position-n.position).map(r=>r.render)}function $s(t,e,r){if(t<=r)return{from:0,to:t};if(e<0&&(e=0),e<=t>>1){let s=Math.floor(e/r);return{from:s*r,to:(s+1)*r}}let n=Math.ceil((t-e)/r);return{from:t-n*r,to:t-(n-1)*r}}var ws=class{constructor(e,r,n){this.view=e,this.stateField=r,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:l=>this.placeInfo(l),key:this},this.space=null,this.currentClass="";let s=e.state.field(r),{options:i,selected:o}=s.open,a=e.state.facet(se);this.optionContent=ch(a),this.optionClass=a.optionClass,this.tooltipClass=a.tooltipClass,this.range=$s(i.length,o,a.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",l=>{let{options:c}=e.state.field(r).open;for(let O=l.target,u;O&&O!=this.dom;O=O.parentNode)if(O.nodeName=="LI"&&(u=/-(\d+)$/.exec(O.id))&&+u[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;O!=null&&(e.dispatch({effects:Cs.of(O)}),l.preventDefault())}}),this.dom.addEventListener("focusout",l=>{let c=e.state.field(this.stateField,!1);c&&c.tooltip&&e.state.facet(se).closeOnBlur&&l.relatedTarget!=e.contentDOM&&e.dispatch({effects:fr.of(null)})}),this.showOptions(i,s.id)}mount(){this.updateSel()}showOptions(e,r){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,r,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var r;let n=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),n!=s){let{options:i,selected:o,disabled:a}=n.open;(!s.open||s.open.options!=i)&&(this.range=$s(i.length,o,e.state.facet(se).maxRenderedOptions),this.showOptions(i,n.id)),this.updateSel(),a!=((r=s.open)===null||r===void 0?void 0:r.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!a)}}updateTooltipClass(e){let r=this.tooltipClass(e);if(r!=this.currentClass){for(let n of this.currentClass.split(" "))n&&this.dom.classList.remove(n);for(let n of r.split(" "))n&&this.dom.classList.add(n);this.currentClass=r}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),r=e.open;(r.selected>-1&&r.selected=this.range.to)&&(this.range=$s(r.options.length,r.selected,this.view.state.facet(se).maxRenderedOptions),this.showOptions(r.options,e.id));let n=this.updateSelectedOption(r.selected);if(n){this.destroyInfo();let{completion:s}=r.options[r.selected],{info:i}=s;if(!i)return;let o=typeof i=="string"?document.createTextNode(i):i(s);if(!o)return;"then"in o?o.then(a=>{a&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(a,s)}).catch(a=>Kr(this.view.state,a,"completion info")):(this.addInfoPane(o,s),n.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,r){this.destroyInfo();let n=this.info=document.createElement("div");if(n.className="cm-tooltip cm-completionInfo",n.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:i}=e;n.appendChild(s),this.infoDestroy=i||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let r=null;for(let n=this.list.firstChild,s=this.range.from;n;n=n.nextSibling,s++)n.nodeName!="LI"||!n.id?s--:s==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),r=n):n.hasAttribute("aria-selected")&&(n.removeAttribute("aria-selected"),n.removeAttribute("aria-describedby"));return r&&uh(this.list,r),r}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let r=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),i=this.space;if(!i){let o=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(i.bottom,r.bottom)-10||s.bottom{o.target==s&&o.preventDefault()});let i=null;for(let o=n.from;on.from||n.from==0))if(i=h,typeof c!="string"&&c.header)s.appendChild(c.header(c));else{let f=s.appendChild(document.createElement("completion-section"));f.textContent=h}}let O=s.appendChild(document.createElement("li"));O.id=r+"-"+o,O.setAttribute("role","option");let u=this.optionClass(a);u&&(O.className=u);for(let h of this.optionContent){let f=h(a,this.view.state,this.view,l);f&&O.appendChild(f)}}return n.from&&s.classList.add("cm-completionListIncompleteTop"),n.tonew ws(r,t,e)}function uh(t,e){let r=t.getBoundingClientRect(),n=e.getBoundingClientRect(),s=r.height/t.offsetHeight;n.topr.bottom&&(t.scrollTop+=(n.bottom-r.bottom)/s)}function Ta(t){return(t.boost||0)*100+(t.apply?10:0)+(t.info?5:0)+(t.type?1:0)}function hh(t,e){let r=[],n=null,s=null,i=O=>{r.push(O);let{section:u}=O.completion;if(u){n||(n=[]);let h=typeof u=="string"?u:u.name;n.some(f=>f.name==h)||n.push(typeof u=="string"?{name:h}:u)}},o=e.facet(se);for(let O of t)if(O.hasResult()){let u=O.result.getMatch;if(O.result.filter===!1)for(let h of O.result.options)i(new ln(h,O.source,u?u(h):[],1e9-r.length));else{let h=e.sliceDoc(O.from,O.to),f,p=o.filterStrict?new Ps(h):new ys(h);for(let d of O.result.options)if(f=p.match(d.label)){let g=d.displayLabel?u?u(d,f.matched):[]:f.matched,Q=f.score+(d.boost||0);if(i(new ln(d,O.source,g,Q)),typeof d.section=="object"&&d.section.rank==="dynamic"){let{name:b}=d.section;s||(s=Object.create(null)),s[b]=Math.max(Q,s[b]||-1e9)}}}}if(n){let O=Object.create(null),u=0,h=(f,p)=>(f.rank==="dynamic"&&p.rank==="dynamic"?s[p.name]-s[f.name]:0)||(typeof f.rank=="number"?f.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(f.nameh.score-u.score||c(u.completion,h.completion))){let u=O.completion;!l||l.label!=u.label||l.detail!=u.detail||l.type!=null&&u.type!=null&&l.type!=u.type||l.apply!=u.apply||l.boost!=u.boost?a.push(O):Ta(O.completion)>Ta(l)&&(a[a.length-1]=O),l=O.completion}return a}var vs=class t{constructor(e,r,n,s,i,o){this.options=e,this.attrs=r,this.tooltip=n,this.timestamp=s,this.selected=i,this.disabled=o}setSelected(e,r){return e==this.selected||e>=this.options.length?this:new t(this.options,Ra(r,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,r,n,s,i,o){if(s&&!o&&e.some(c=>c.isPending))return s.setDisabled();let a=hh(e,r);if(!a.length)return s&&e.some(c=>c.isPending)?s.setDisabled():null;let l=r.facet(se).selectOnOpen?0:-1;if(s&&s.selected!=l&&s.selected!=-1){let c=s.options[s.selected].completion;for(let O=0;OO.hasResult()?Math.min(c,O.from):c,1e8),create:bh,above:i.aboveCursor},s?s.timestamp:Date.now(),l,!1)}map(e){return new t(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new t(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},Zs=class t{constructor(e,r,n){this.active=e,this.id=r,this.open=n}static start(){return new t(mh,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:r}=e,n=r.facet(se),i=(n.override||r.languageDataAt("autocomplete",bt(r)).map(ah)).map(l=>(this.active.find(O=>O.source==l)||new De(l,this.active.some(O=>O.state!=0)?1:0)).update(e,n));i.length==this.active.length&&i.every((l,c)=>l==this.active[c])&&(i=this.active);let o=this.open,a=e.effects.some(l=>l.is(As));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||i.some(l=>l.hasResult()&&e.changes.touchesRange(l.from,l.to))||!fh(i,this.active)||a?o=vs.build(i,r,this.id,o,n,a):o&&o.disabled&&!i.some(l=>l.isPending)&&(o=null),!o&&i.every(l=>!l.isPending)&&i.some(l=>l.hasResult())&&(i=i.map(l=>l.hasResult()?new De(l.source,0):l));for(let l of e.effects)l.is(Cs)&&(o=o&&o.setSelected(l.value,this.id));return i==this.active&&o==this.open?this:new t(i,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?dh:ph}};function fh(t,e){if(t==e)return!0;for(let r=0,n=0;;){for(;r-1&&(r["aria-activedescendant"]=t+"-"+e),r}var mh=[];function La(t,e){if(t.isUserEvent("input.complete")){let n=t.annotation(_s);if(n&&e.activateOnCompletion(n))return 12}let r=t.isUserEvent("input.type");return r&&e.activateOnTyping?5:r?1:t.isUserEvent("delete.backward")?2:t.selection?8:t.docChanged?16:0}var De=class t{constructor(e,r,n=!1){this.source=e,this.state=r,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(e,r){let n=La(e,r),s=this;(n&8||n&16&&this.touches(e))&&(s=new t(s.source,0)),n&4&&s.state==0&&(s=new t(this.source,1)),s=s.updateFor(e,n);for(let i of e.effects)if(i.is(cn))s=new t(s.source,1,i.value);else if(i.is(fr))s=new t(s.source,0);else if(i.is(As))for(let o of i.value)o.source==s.source&&(s=o);return s}updateFor(e,r){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(bt(e.state))}},On=class t extends De{constructor(e,r,n,s,i,o){super(e,3,r),this.limit=n,this.result=s,this.from=i,this.to=o}hasResult(){return!0}updateFor(e,r){var n;if(!(r&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let i=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),a=bt(e.state);if(a>o||!s||r&2&&(bt(e.startState)==this.from||ar.map(e))}}),ge=Xe.define({create(){return Zs.start()},update(t,e){return t.update(e)},provide:t=>[ca.from(t,e=>e.tooltip),_.contentAttributes.from(t,e=>e.attrs)]});function Ls(t,e){let r=e.completion.apply||e.completion.label,n=t.state.field(ge).active.find(s=>s.source==e.source);return n instanceof On?(typeof r=="string"?t.dispatch({...oh(t.state,r,n.from,n.to),annotations:_s.of(e.completion)}):r(t,e.completion,n.from,n.to),!0):!1}var bh=Oh(ge,Ls);function an(t,e="option"){return r=>{let n=r.state.field(ge,!1);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp-1?n.open.selected+s*(t?1:-1):t?0:o-1;return a<0?a=e=="page"?0:o-1:a>=o&&(a=e=="page"?o-1:0),r.dispatch({effects:Cs.of(a)}),!0}}var Qh=t=>{let e=t.state.field(ge,!1);return t.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampt.state.field(ge,!1)?(t.dispatch({effects:cn.of(!0)}),!0):!1,xh=t=>{let e=t.state.field(ge,!1);return!e||!e.active.some(r=>r.state!=0)?!1:(t.dispatch({effects:fr.of(null)}),!0)},Xs=class{constructor(e,r){this.active=e,this.context=r,this.time=Date.now(),this.updates=[],this.done=void 0}},$h=50,kh=1e3,Sh=Me.fromClass(class{constructor(t){this.view=t,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of t.state.field(ge).active)e.isPending&&this.startQuery(e)}update(t){let e=t.state.field(ge),r=t.state.facet(se);if(!t.selectionSet&&!t.docChanged&&t.startState.field(ge)==e)return;let n=t.transactions.some(i=>{let o=La(i,r);return o&8||(i.selection||i.docChanged)&&!(o&3)});for(let i=0;i$h&&Date.now()-o.time>kh){for(let a of o.context.abortListeners)try{a()}catch(l){Kr(this.view.state,l)}o.context.abortListeners=null,this.running.splice(i--,1)}else o.updates.push(...t.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),t.transactions.some(i=>i.effects.some(o=>o.is(cn)))&&(this.pendingStart=!0);let s=this.pendingStart?50:r.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(i=>i.isPending&&!this.running.some(o=>o.active.source==i.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let i of t.transactions)i.isUserEvent("input.type")?this.composing=2:this.composing==2&&i.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:t}=this.view,e=t.field(ge);for(let r of e.active)r.isPending&&!this.running.some(n=>n.active.source==r.source)&&this.startQuery(r);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(se).updateSyncTime))}startQuery(t){let{state:e}=this.view,r=bt(e),n=new Mt(e,r,t.explicit,this.view),s=new Xs(t,n);this.running.push(s),Promise.resolve(t.source(n)).then(i=>{s.context.aborted||(s.done=i||null,this.scheduleAccept())},i=>{this.view.dispatch({effects:fr.of(null)}),Kr(this.view.state,i)})}scheduleAccept(){this.running.every(t=>t.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(se).updateSyncTime))}accept(){var t;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],r=this.view.state.facet(se),n=this.view.state.field(ge);for(let s=0;sa.source==i.active.source);if(o&&o.isPending)if(i.done==null){let a=new De(i.active.source,0);for(let l of i.updates)a=a.update(l,r);a.isPending||e.push(a)}else this.startQuery(o)}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:As.of(e)})}},{eventHandlers:{blur(t){let e=this.view.state.field(ge,!1);if(e&&e.tooltip&&this.view.state.facet(se).closeOnBlur){let r=e.open&&gs(this.view,e.open.tooltip);(!r||!r.dom.contains(t.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:fr.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:cn.of(!1)}),20),this.composing=0}}}),yh=typeof navigator=="object"&&/Win/.test(navigator.platform),Ph=et.highest(_.domEventHandlers({keydown(t,e){let r=e.state.field(ge,!1);if(!r||!r.open||r.open.disabled||r.open.selected<0||!t.key||t.key.length>1||t.ctrlKey&&!(yh&&t.altKey)||t.metaKey)return!1;let n=r.open.options[r.open.selected],s=r.active.find(o=>o.source==n.source),i=n.completion.commitCharacters||s.result.commitCharacters;return i&&i.indexOf(t.key)>-1&&Ls(e,n),!1}})),Ya=_.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"\xB7\xB7\xB7"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'\u0192'"}},".cm-completionIcon-class":{"&:after":{content:"'\u25CB'"}},".cm-completionIcon-interface":{"&:after":{content:"'\u25CC'"}},".cm-completionIcon-variable":{"&:after":{content:"'\u{1D465}'"}},".cm-completionIcon-constant":{"&:after":{content:"'\u{1D436}'"}},".cm-completionIcon-type":{"&:after":{content:"'\u{1D461}'"}},".cm-completionIcon-enum":{"&:after":{content:"'\u222A'"}},".cm-completionIcon-property":{"&:after":{content:"'\u25A1'"}},".cm-completionIcon-keyword":{"&:after":{content:"'\u{1F511}\uFE0E'"}},".cm-completionIcon-namespace":{"&:after":{content:"'\u25A2'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),Ts=class{constructor(e,r,n,s){this.field=e,this.line=r,this.from=n,this.to=s}},Rs=class t{constructor(e,r,n){this.field=e,this.from=r,this.to=n}map(e){let r=e.mapPos(this.from,-1,Hr.TrackDel),n=e.mapPos(this.to,1,Hr.TrackDel);return r==null||n==null?null:new t(this.field,r,n)}},js=class t{constructor(e,r){this.lines=e,this.fieldPositions=r}instantiate(e,r){let n=[],s=[r],i=e.doc.lineAt(r),o=/^\s*/.exec(i.text)[0];for(let l of this.lines){if(n.length){let c=o,O=/^\t*/.exec(l)[0].length;for(let u=0;unew Rs(l.field,s[l.line]+l.from,s[l.line]+l.to));return{text:n,ranges:a}}static parse(e){let r=[],n=[],s=[],i;for(let o of e.split(/\r\n?|\n/)){for(;i=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(o);){let a=i[1]?+i[1]:null,l=i[2]||i[3]||"",c=-1;a===0&&(a=1e9);let O=l.replace(/\\[{}]/g,u=>u[1]);for(let u=0;u=c&&h.field++}for(let u of s)if(u.line==n.length&&u.from>i.index){let h=i[2]?3+(i[1]||"").length:2;u.from-=h,u.to-=h}s.push(new Ts(c,n.length,i.index,i.index+O.length)),o=o.slice(0,i.index)+l+o.slice(i.index+i[0].length)}o=o.replace(/\\([{}])/g,(a,l,c)=>{for(let O of s)O.line==n.length&&O.from>c&&(O.from--,O.to--);return l}),n.push(o)}return new t(n,s)}},wh=j.widget({widget:new class extends Oe{toDOM(){let t=document.createElement("span");return t.className="cm-snippetFieldPosition",t}ignoreEvent(){return!1}}}),vh=j.mark({class:"cm-snippetField"}),Ut=class t{constructor(e,r){this.ranges=e,this.active=r,this.deco=j.set(e.map(n=>(n.from==n.to?wh:vh).range(n.from,n.to)),!0)}map(e){let r=[];for(let n of this.ranges){let s=n.map(e);if(!s)return null;r.push(s)}return new t(r,this.active)}selectionInsideField(e){return e.ranges.every(r=>this.ranges.some(n=>n.field==this.active&&n.from<=r.from&&n.to>=r.to))}},mr=re.define({map(t,e){return t&&t.map(e)}}),Zh=re.define(),dr=Xe.define({create(){return null},update(t,e){for(let r of e.effects){if(r.is(mr))return r.value;if(r.is(Zh)&&t)return new Ut(t.ranges,r.value)}return t&&e.docChanged&&(t=t.map(e.changes)),t&&e.selection&&!t.selectionInsideField(e.selection)&&(t=null),t},provide:t=>_.decorations.from(t,e=>e?e.deco:j.none)});function Ys(t,e){return z.create(t.filter(r=>r.field==e).map(r=>z.range(r.from,r.to)))}function Xh(t){let e=js.parse(t);return(r,n,s,i)=>{let{text:o,ranges:a}=e.instantiate(r.state,s),{main:l}=r.state.selection,c={changes:{from:s,to:i==l.from?l.to:i,insert:ra.of(o)},scrollIntoView:!0,annotations:n?[_s.of(n),Or.userEvent.of("input.complete")]:void 0};if(a.length&&(c.selection=Ys(a,0)),a.some(O=>O.field>0)){let O=new Ut(a,0),u=c.effects=[mr.of(O)];r.state.field(dr,!1)===void 0&&u.push(re.appendConfig.of([dr,_h,Ch,Ya]))}r.dispatch(r.state.update(c))}}function qa(t){return({state:e,dispatch:r})=>{let n=e.field(dr,!1);if(!n||t<0&&n.active==0)return!1;let s=n.active+t,i=t>0&&!n.ranges.some(o=>o.field==s+t);return r(e.update({selection:Ys(n.ranges,s),effects:mr.of(i?null:new Ut(n.ranges,s)),scrollIntoView:!0})),!0}}var Th=({state:t,dispatch:e})=>t.field(dr,!1)?(e(t.update({effects:mr.of(null)})),!0):!1,Rh=qa(1),jh=qa(-1);var Eh=[{key:"Tab",run:Rh,shift:jh},{key:"Escape",run:Th}],ja=Lt.define({combine(t){return t.length?t[0]:Eh}}),_h=et.highest(pt.compute([ja],t=>t.facet(ja)));function fe(t,e){return{...e,apply:Xh(t)}}var Ch=_.domEventHandlers({mousedown(t,e){let r=e.state.field(dr,!1),n;if(!r||(n=e.posAtCoords({x:t.clientX,y:t.clientY}))==null)return!1;let s=r.ranges.find(i=>i.from<=n&&i.to>=n);return!s||s.field==r.active?!1:(e.dispatch({selection:Ys(r.ranges,s.field),effects:mr.of(r.ranges.some(i=>i.field>s.field)?new Ut(r.ranges,s.field):null),scrollIntoView:!0}),!0)}});var pr={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},gt=re.define({map(t,e){let r=e.mapPos(t,-1,Hr.TrackAfter);return r??void 0}}),qs=new class extends sa{};qs.startSide=1;qs.endSide=-1;var za=Xe.define({create(){return ia.empty},update(t,e){if(t=t.map(e.changes),e.selection){let r=e.state.doc.lineAt(e.selection.main.head);t=t.update({filter:n=>n>=r.from&&n<=r.to})}for(let r of e.effects)r.is(gt)&&(t=t.update({add:[qs.range(r.value,r.value+1)]}));return t}});function Ma(){return[Lh,za]}var Ss="()[]{}<>\xAB\xBB\xBB\xAB\uFF3B\uFF3D\uFF5B\uFF5D";function Ua(t){for(let e=0;e{if((Ah?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let s=t.state.selection.main;if(n.length>2||n.length==2&&je(pe(n,0))==1||e!=s.from||r!=s.to)return!1;let i=qh(t.state,n);return i?(t.dispatch(i),!0):!1}),Yh=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Wa(t,t.selection.main.head).brackets||pr.brackets,s=null,i=t.changeByRange(o=>{if(o.empty){let a=zh(t.doc,o.head);for(let l of n)if(l==a&&un(t.doc,o.head)==Ua(pe(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:z.cursor(o.head-l.length)}}return{range:s=o}});return s||e(t.update(i,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},Va=[{key:"Backspace",run:Yh}];function qh(t,e){let r=Wa(t,t.selection.main.head),n=r.brackets||pr.brackets;for(let s of n){let i=Ua(pe(s,0));if(e==s)return i==s?Wh(t,s,n.indexOf(s+s+s)>-1,r):Mh(t,s,i,r.before||pr.before);if(e==i&&Ia(t,t.selection.main.from))return Uh(t,s,i)}return null}function Ia(t,e){let r=!1;return t.field(za).between(0,t.doc.length,n=>{n==e&&(r=!0)}),r}function un(t,e){let r=t.sliceString(e,e+2);return r.slice(0,je(pe(r,0)))}function zh(t,e){let r=t.sliceString(e-2,e);return je(pe(r,0))==r.length?r:r.slice(1)}function Mh(t,e,r,n){let s=null,i=t.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:r,from:o.to}],effects:gt.of(o.to+e.length),range:z.range(o.anchor+e.length,o.head+e.length)};let a=un(t.doc,o.head);return!a||/\s/.test(a)||n.indexOf(a)>-1?{changes:{insert:e+r,from:o.head},effects:gt.of(o.head+e.length),range:z.cursor(o.head+e.length)}:{range:s=o}});return s?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function Uh(t,e,r){let n=null,s=t.changeByRange(i=>i.empty&&un(t.doc,i.head)==r?{changes:{from:i.head,to:i.head+r.length,insert:r},range:z.cursor(i.head+r.length)}:n={range:i});return n?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Wh(t,e,r,n){let s=n.stringPrefixes||pr.stringPrefixes,i=null,o=t.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:e,from:a.to}],effects:gt.of(a.to+e.length),range:z.range(a.anchor+e.length,a.head+e.length)};let l=a.head,c=un(t.doc,l),O;if(c==e){if(Ea(t,l))return{changes:{insert:e+e,from:l},effects:gt.of(l+e.length),range:z.cursor(l+e.length)};if(Ia(t,l)){let h=r&&t.sliceDoc(l,l+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:l,to:l+h.length,insert:h},range:z.cursor(l+h.length)}}}else{if(r&&t.sliceDoc(l-2*e.length,l)==e+e&&(O=_a(t,l-2*e.length,s))>-1&&Ea(t,O))return{changes:{insert:e+e+e+e,from:l},effects:gt.of(l+e.length),range:z.cursor(l+e.length)};if(t.charCategorizer(l)(c)!=le.Word&&_a(t,l,s)>-1&&!Vh(t,l,e,s))return{changes:{insert:e+e,from:l},effects:gt.of(l+e.length),range:z.cursor(l+e.length)}}return{range:i=a}});return i?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Ea(t,e){let r=U(t).resolveInner(e+1);return r.parent&&r.from==e}function Vh(t,e,r,n){let s=U(t).resolveInner(e,-1),i=n.reduce((o,a)=>Math.max(o,a.length),0);for(let o=0;o<5;o++){let a=t.sliceDoc(s.from,Math.min(s.to,s.from+r.length+i)),l=a.indexOf(r);if(!l||l>-1&&n.indexOf(a.slice(0,l))>-1){let O=s.firstChild;for(;O&&O.from==s.from&&O.to-O.from>r.length+l;){if(t.sliceDoc(O.to-r.length,O.to)==r)return!1;O=O.firstChild}return!0}let c=s.to==e&&s.parent;if(!c)break;s=c}return!1}function _a(t,e,r){let n=t.charCategorizer(e);if(n(t.sliceDoc(e-1,e))!=le.Word)return e;for(let s of r){let i=e-s.length;if(t.sliceDoc(i,e)==s&&n(t.sliceDoc(i-1,i))!=le.Word)return i}return-1}function Da(t={}){return[Ph,ge,se.of(t),Sh,Ih,Ya]}var zs=[{key:"Ctrl-Space",run:ks},{mac:"Alt-`",run:ks},{mac:"Alt-i",run:ks},{key:"Escape",run:xh},{key:"ArrowDown",run:an(!0)},{key:"ArrowUp",run:an(!1)},{key:"PageDown",run:an(!0,"page")},{key:"PageUp",run:an(!1,"page")},{key:"Enter",run:Qh}],Ih=et.highest(pt.computeN([se],t=>t.facet(se).defaultKeymap?[zs]:[]));var dn=class t{static create(e,r,n,s,i){let o=s+(s<<8)+e+(r<<4)|0;return new t(e,r,n,o,i,[],[])}constructor(e,r,n,s,i,o,a){this.type=e,this.value=r,this.from=n,this.hash=s,this.end=i,this.children=o,this.positions=a,this.blankFirstLine=!1,this.hashProp=[[Te.contextHash,s]]}addChild(e,r){e.prop(Te.contextHash)!=this.hash&&(e=new me(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(r)}toTree(e,r=this.end){let n=this.children.length-1;return n>=0&&(r=Math.max(r,this.positions[n]+this.children[n].length+this.from)),new me(e.types[this.type],this.children,this.positions,r-this.from).balance({makeTree:(s,i,o)=>new me(mt.none,s,i,o,this.hashProp)})}},$;(function(t){t[t.Document=1]="Document",t[t.CodeBlock=2]="CodeBlock",t[t.FencedCode=3]="FencedCode",t[t.Blockquote=4]="Blockquote",t[t.HorizontalRule=5]="HorizontalRule",t[t.BulletList=6]="BulletList",t[t.OrderedList=7]="OrderedList",t[t.ListItem=8]="ListItem",t[t.ATXHeading1=9]="ATXHeading1",t[t.ATXHeading2=10]="ATXHeading2",t[t.ATXHeading3=11]="ATXHeading3",t[t.ATXHeading4=12]="ATXHeading4",t[t.ATXHeading5=13]="ATXHeading5",t[t.ATXHeading6=14]="ATXHeading6",t[t.SetextHeading1=15]="SetextHeading1",t[t.SetextHeading2=16]="SetextHeading2",t[t.HTMLBlock=17]="HTMLBlock",t[t.LinkReference=18]="LinkReference",t[t.Paragraph=19]="Paragraph",t[t.CommentBlock=20]="CommentBlock",t[t.ProcessingInstructionBlock=21]="ProcessingInstructionBlock",t[t.Escape=22]="Escape",t[t.Entity=23]="Entity",t[t.HardBreak=24]="HardBreak",t[t.Emphasis=25]="Emphasis",t[t.StrongEmphasis=26]="StrongEmphasis",t[t.Link=27]="Link",t[t.Image=28]="Image",t[t.InlineCode=29]="InlineCode",t[t.HTMLTag=30]="HTMLTag",t[t.Comment=31]="Comment",t[t.ProcessingInstruction=32]="ProcessingInstruction",t[t.Autolink=33]="Autolink",t[t.HeaderMark=34]="HeaderMark",t[t.QuoteMark=35]="QuoteMark",t[t.ListMark=36]="ListMark",t[t.LinkMark=37]="LinkMark",t[t.EmphasisMark=38]="EmphasisMark",t[t.CodeMark=39]="CodeMark",t[t.CodeText=40]="CodeText",t[t.CodeInfo=41]="CodeInfo",t[t.LinkTitle=42]="LinkTitle",t[t.LinkLabel=43]="LinkLabel",t[t.URL=44]="URL"})($||($={}));var Ws=class{constructor(e,r){this.start=e,this.content=r,this.marks=[],this.parsers=[]}},Vs=class{constructor(){this.text="",this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return br(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,r=0,n=0){for(let s=r;s=e.stack[r.depth+1].value+r.baseIndent)return!0;if(r.indent>=r.baseIndent+4)return!1;let n=(t.type==$.OrderedList?ri:ti)(r,e,!1);return n>0&&(t.type!=$.BulletList||ei(r,e,!1)<0)&&r.text.charCodeAt(r.pos+n-1)==t.value}var sl={[$.Blockquote](t,e,r){return r.next!=62?!1:(r.markers.push(W($.QuoteMark,e.lineStart+r.pos,e.lineStart+r.pos+1)),r.moveBase(r.pos+(ke(r.text.charCodeAt(r.pos+1))?2:1)),t.end=e.lineStart+r.text.length,!0)},[$.ListItem](t,e,r){return(r.next<0?t.blankFirstLine&&t.children.length==1:r.indentr&&ke(t.charCodeAt(e-1));)e--;return e}function il(t){if(t.next!=96&&t.next!=126)return-1;let e=t.pos+1;for(;e-1&&t.depth==e.stack.length&&e.parser.leafBlockParsers.indexOf(fl.SetextHeading)>-1||n<3?-1:1}function al(t,e){for(let r=t.stack.length-1;r>=0;r--)if(t.stack[r].type==e)return!0;return!1}function ti(t,e,r){return(t.next==45||t.next==43||t.next==42)&&(t.pos==t.text.length-1||ke(t.text.charCodeAt(t.pos+1)))&&(!r||al(e,$.BulletList)||t.skipSpace(t.pos+2)=48&&s<=57;){n++;if(n==t.text.length)return-1;s=t.text.charCodeAt(n)}return n==t.pos||n>t.pos+9||s!=46&&s!=41||nt.pos+1||t.next!=49)?-1:n+1-t.pos}function ll(t){if(t.next!=35)return-1;let e=t.pos+1;for(;e6?-1:r}function cl(t){if(t.next!=45&&t.next!=61||t.indent>=t.baseIndent+4)return-1;let e=t.pos+1;for(;e/,ul=/\?>/,Ds=[[/^<(?:script|pre|style|textarea)(?:\s|>|$)/i,/<\/(?:script|pre|style|textarea)>/i],[/^\s*)/.exec(n);if(i)return t.append(W($.Comment,r,r+1+i[0].length));let o=/^\?[^]*?\?>/.exec(n);if(o)return t.append(W($.ProcessingInstruction,r,r+1+o[0].length));let a=/^(?:![A-Z][^]*?>|!\[CDATA\[[^]*?\]\]>|\/[a-zA-Z][\w-]*\s*>|[a-zA-Z][\w-]*(\s+[a-zA-Z:_][\w-.:]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*\/?>)/.exec(n);return a?t.append(W($.HTMLTag,r,r+1+a[0].length)):-1},Emphasis(t,e,r){if(e!=95&&e!=42)return-1;let n=r+1;for(;t.char(n)==e;)n++;let s=t.slice(r-1,r),i=t.slice(n,n+1),o=$r.test(s),a=$r.test(i),l=/\s|^$/.test(s),c=/\s|^$/.test(i),O=!c&&(!a||l||o),u=!l&&(!o||c||a),h=O&&(e==42||!u||o),f=u&&(e==42||!O||a);return t.append(new de(e==95?ni:si,r,n,(h?1:0)|(f?2:0)))},HardBreak(t,e,r){if(e==92&&t.char(r+1)==10)return t.append(W($.HardBreak,r,r+2));if(e==32){let n=r+1;for(;t.char(n)==32;)n++;if(t.char(n)==10&&n>=r+2)return t.append(W($.HardBreak,r,n+1))}return-1},Link(t,e,r){return e==91?t.append(new de(Qt,r,r+1,1)):-1},Image(t,e,r){return e==33&&t.char(r+1)==91?t.append(new de(gn,r,r+2,1)):-1},LinkEnd(t,e,r){if(e!=93)return-1;for(let n=t.parts.length-1;n>=0;n--){let s=t.parts[n];if(s instanceof de&&(s.type==Qt||s.type==gn)){if(!s.side||t.skipSpace(s.to)==r&&!/[(\[]/.test(t.slice(r+1,r+2)))return t.parts[n]=null,-1;let i=t.takeContent(n),o=t.parts[n]=Nh(t,i,s.type==Qt?$.Link:$.Image,s.from,r+1);if(s.type==Qt)for(let a=0;ae?W($.URL,e+r,i+r):i==t.length?null:!1}}function gl(t,e,r){let n=t.charCodeAt(e);if(n!=39&&n!=34&&n!=40)return!1;let s=n==40?41:n;for(let i=e+1,o=!1;i=this.end?-1:this.text.charCodeAt(e-this.offset)}get end(){return this.offset+this.text.length}slice(e,r){return this.text.slice(e-this.offset,r-this.offset)}append(e){return this.parts.push(e),e.to}addDelimiter(e,r,n,s,i){return this.append(new de(e,r,n,(s?1:0)|(i?2:0)))}get hasOpenLink(){for(let e=this.parts.length-1;e>=0;e--){let r=this.parts[e];if(r instanceof de&&(r.type==Qt||r.type==gn))return!0}return!1}addElement(e){return this.append(e)}resolveMarkers(e){for(let n=e;n=e;l--){let d=this.parts[l];if(d instanceof de&&d.side&1&&d.type==s.type&&!(i&&(s.side&1||d.side&2)&&(d.size+s.size)%3==0&&(d.size%3||s.size%3))){a=d;break}}if(!a)continue;let c=s.type.resolve,O=[],u=a.from,h=s.to;if(i){let d=Math.min(2,a.to-a.from,o);u=a.to-d,h=s.from+d,c=d==1?"Emphasis":"StrongEmphasis"}a.type.mark&&O.push(this.elt(a.type.mark,u,a.to));for(let d=l+1;d=0;r--){let n=this.parts[r];if(n instanceof de&&n.type==e&&n.side&1)return r}return null}takeContent(e){let r=this.resolveMarkers(e);return this.parts.length=e,r}getDelimiterAt(e){let r=this.parts[e];return r instanceof de?r:null}skipSpace(e){return br(this.text,e-this.offset)+this.offset}elt(e,r,n,s){return typeof e=="string"?W(this.parser.getNodeType(e),r,n,s):new mn(e,r)}};$t.linkStart=Qt;$t.imageStart=gn;$t.emphasisAsterisk=si;$t.emphasisUnderscore=ni;function Hs(t,e){if(!e.length)return t;if(!t.length)return e;let r=t.slice(),n=0;for(let s of e){for(;n(e?e-1:0))return!1;if(this.fragmentEnd<0){let i=this.fragment.to;for(;i>0&&this.input.read(i-1,i)!=` +`;)i--;this.fragmentEnd=i?i-1:0}let n=this.cursor;n||(n=this.cursor=this.fragment.tree.cursor(Ue.IncludeAnonymous|Ue.IgnoreMounts),n.firstChild());let s=e+this.fragment.offset;for(;n.to<=s;)if(!n.parent())return!1;for(;;){if(n.from>=s)return this.fragment.from<=r;if(!n.childAfter(s))return!1}}matches(e){let r=this.cursor.tree;for(;r&&r.type.isAnonymous&&r.children[0]instanceof me;)r=r.children[0];return r&&r.prop(Te.contextHash)==e}takeNodes(e){let r=this.cursor,n=this.fragment.offset,s=this.fragmentEnd-(this.fragment.openEnd?1:0),i=e.absoluteLineStart,o=i,a=e.block.children.length,l=e.lineStart-e.block.from>>2,c=o,O=a;e:for(;;){if(r.to-n>Math.min(s,e.to)||r.type.isAnonymous&&r.tree&&(r.to-r.from>l||!Bh(r.tree))){if(r.type.isAnonymous&&r.firstChild())continue;break}let u=xl(r.from-n,e.ranges);if(r.to-n<=e.ranges[e.rangeI].to)e.addNode(r.tree,u);else{let h=new me(e.parser.nodeSet.types[$.Paragraph],[],[],0,e.block.hashProp);e.reusePlaceholders.set(h,r.tree),e.addNode(h,u)}for((r.type.isAnonymous||r.type.is("Block"))&&(r.type.isAnonymous||Ql.indexOf(r.type.id)<0?(o=r.to-n,a=e.block.children.length):(o=c,a=O),c=r.to-n,O=e.block.children.length);;){if(r.nextSibling())continue e;if(!r.parent()||!r.type.isAnonymous)break e}}for(;e.block.children.length>a;)e.block.children.pop(),e.block.positions.pop();return o-i}};function Bh(t){for(;t.type.isAnonymous;){let e=t.children[t.children.length-1];if(e instanceof me)t=e;else return!1}return t.type.is("Block")&&Ql.indexOf(t.type.id)<0}function xl(t,e){let r=t;for(let n=1;nhn[t]),Object.keys(hn).map(t=>fl[t]),Object.keys(hn),Dh,sl,Object.keys(Us).map(t=>Us[t]),Object.keys(Us),[]);function Hh(t,e,r){let n=[];for(let s=t.firstChild,i=e;;s=s.nextSibling){let o=s?s.from:r;if(o>i&&n.push({from:i,to:o}),!s)break;i=s.to}return n}function kl(t){let{codeParser:e,htmlParser:r}=t;return{wrap:tn((s,i)=>{let o=s.type.id;if(e&&(o==$.CodeBlock||o==$.FencedCode)){let a="";if(o==$.FencedCode){let c=s.node.getChild($.CodeInfo);c&&(a=i.read(c.from,c.to))}let l=e(a);if(l)return{parser:l,overlay:c=>c.type.id==$.CodeText,bracketed:o==$.FencedCode}}else if(r&&(o==$.HTMLBlock||o==$.HTMLTag||o==$.CommentBlock))return{parser:r,overlay:Hh(s.node,s.from,s.to)};return null})}}var Kh={resolve:"Strikethrough",mark:"StrikethroughMark"},Jh={defineNodes:[{name:"Strikethrough",style:{"Strikethrough/...":m.strikethrough}},{name:"StrikethroughMark",style:m.processingInstruction}],parseInline:[{name:"Strikethrough",parse(t,e,r){if(e!=126||t.char(r+1)!=126||t.char(r+2)==126)return-1;let n=t.slice(r-1,r),s=t.slice(r+2,r+3),i=/\s|^$/.test(n),o=/\s|^$/.test(s),a=$r.test(n),l=$r.test(s);return t.addDelimiter(Kh,r,r+2,!o&&(!l||i||a),!i&&(!a||o||l))},after:"Emphasis"}]};function Qr(t,e,r=0,n,s=0){let i=0,o=!0,a=-1,l=-1,c=!1,O=()=>{n.push(t.elt("TableCell",s+a,s+l,t.parser.parseInline(e.slice(a,l),s+a)))};for(let u=r;u-1)&&i++,o=!1,n&&(a>-1&&O(),n.push(t.elt("TableDelimiter",u+s,u+s+1))),a=l=-1):(c||h!=32&&h!=9)&&(a<0&&(a=u),l=u+1),c=!c&&h==92}return a>-1&&(i++,n&&O()),i}function Ha(t,e){for(let r=e;r\s]*\|?(\s*:?-+:?\s*\|)+(\s*:?-+:?\s*)?$/,bn=class{constructor(){this.rows=null}nextLine(e,r,n){if(this.rows==null){this.rows=!1;let s;if((r.next==45||r.next==58||r.next==124)&&Sl.test(s=r.text.slice(r.pos))){let i=[];Qr(e,n.content,0,i,n.start)==Qr(e,s,0)&&(this.rows=[e.elt("TableHeader",n.start,n.start+n.content.length,i),e.elt("TableDelimiter",e.lineStart+r.pos,e.lineStart+r.text.length)])}}else if(this.rows){let s=[];Qr(e,r.text,r.pos,s,e.lineStart),this.rows.push(e.elt("TableRow",e.lineStart+r.pos,e.lineStart+r.text.length,s))}return!1}finish(e,r){return this.rows?(e.addLeafElement(r,e.elt("Table",r.start,r.start+r.content.length,this.rows)),!0):!1}},ef={defineNodes:[{name:"Table",block:!0},{name:"TableHeader",style:{"TableHeader/...":m.heading}},"TableRow",{name:"TableCell",style:m.content},{name:"TableDelimiter",style:m.processingInstruction}],parseBlock:[{name:"Table",leaf(t,e){return Ha(e.content,0)?new bn:null},endLeaf(t,e,r){if(r.parsers.some(s=>s instanceof bn)||!Ha(e.text,e.basePos))return!1;let n=t.peekLine();return Sl.test(n)&&Qr(t,e.text,e.basePos)==Qr(t,n,e.basePos)},before:"SetextHeading"}]},Js=class{nextLine(){return!1}finish(e,r){return e.addLeafElement(r,e.elt("Task",r.start,r.start+r.content.length,[e.elt("TaskMarker",r.start,r.start+3),...e.parser.parseInline(r.content.slice(3),r.start+3)])),!0}},tf={defineNodes:[{name:"Task",block:!0,style:m.list},{name:"TaskMarker",style:m.atom}],parseBlock:[{name:"TaskList",leaf(t,e){return/^\[[ xX]\][ \t]/.test(e.content)&&t.parentType().name=="ListItem"?new Js:null},after:"SetextHeading"}]},Ka=/(www\.)|(https?:\/\/)|([\w.+-]{1,100}@)|(mailto:|xmpp:)/gy,Ja=/[\w-]+(\.[\w-]+)+(:\d+)?(\/[^\s<]*)?/gy,rf=/[\w-]+\.[\w-]+($|[/:])/,el=/[\w.+-]+@[\w-]+(\.[\w.-]+)+/gy,tl=/\/[a-zA-Z\d@.]+/gy;function rl(t,e,r,n){let s=0;for(let i=e;i-1)return-1;let n=e+r[0].length;for(;;){let s=t[n-1],i;if(/[?!.,:*_~]/.test(s)||s==")"&&rl(t,e,n,")")>rl(t,e,n,"("))n--;else if(s==";"&&(i=/&(?:#\d+|#x[a-f\d]+|\w+);$/.exec(t.slice(e,n))))n=e+i.index;else break}return n}function nl(t,e){el.lastIndex=e;let r=el.exec(t);if(!r)return-1;let n=r[0][r[0].length-1];return n=="_"||n=="-"?-1:e+r[0].length-(n=="."?1:0)}var sf={parseInline:[{name:"Autolink",parse(t,e,r){let n=r-t.offset;if(n&&/\w/.test(t.text[n-1]))return-1;Ka.lastIndex=n;let s=Ka.exec(t.text),i=-1;if(!s)return-1;if(s[1]||s[2]){if(i=nf(t.text,n+s[0].length),i>-1&&t.hasOpenLink){let o=/([^\[\]]|\[[^\]]*\])*/.exec(t.text.slice(n,i));i=n+o[0].length}}else s[3]?i=nl(t.text,n):(i=nl(t.text,n+s[0].length),i>-1&&s[0]=="xmpp:"&&(tl.lastIndex=i,s=tl.exec(t.text),s&&(i=s.index+s[0].length)));return i<0?-1:(t.addElement(t.elt("URL",r,i+t.offset)),i+t.offset)}}]},yl=[ef,tf,Jh,sf];function Pl(t,e,r){return(n,s,i)=>{if(s!=t||n.char(i+1)==t)return-1;let o=[n.elt(r,i,i+1)];for(let a=i+1;ar%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,r,n=0){let s=e.parser.context;return new t(e,[],r,n,n,0,[],0,s?new Qn(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,r){this.stack.push(this.state,r,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var r;let n=e>>19,s=e&65535,{parser:i}=this.p,o=this.reducePos=2e3&&!(!((r=this.p.parser.nodeSet.types[s])===null||r===void 0)&&r.isAnonymous)&&(c==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=O):this.p.lastBigReductionSizel;)this.stack.pop();this.reduceContext(s,c)}storeNode(e,r,n,s=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[o-4]==0&&this.buffer[o-1]>-1){if(r==n)return;if(this.buffer[o-2]>=r){this.buffer[o-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,r,n,s);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let a=!1;for(let l=o;l>0&&this.buffer[l-2]>n;l-=4)if(this.buffer[l-1]>=0){a=!0;break}if(a)for(;o>0&&this.buffer[o-2]>n;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4)}this.buffer[o]=e,this.buffer[o+1]=r,this.buffer[o+2]=n,this.buffer[o+3]=s}}shift(e,r,n,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let i=e,{parser:o}=this.p;this.pos=s;let a=o.stateFlag(i,1);!a&&(s>n||r<=o.maxNode)&&(this.reducePos=s),this.pushState(i,a?n:Math.min(n,this.reducePos)),this.shiftContext(r,n),r<=o.maxNode&&this.buffer.push(r,n,s,4)}else this.pos=s,this.shiftContext(r,n),r<=this.p.parser.maxNode&&this.buffer.push(r,n,s,4)}apply(e,r,n,s){e&65536?this.reduce(e):this.shift(e,r,n,s)}useNode(e,r,n){let s=this.p.reused.length-1;(s<0||this.p.reused[s]!=e)&&(this.p.reused.push(e),s++);let i=this.reducePos=this.pos=n+e.length;this.pushState(r,n),this.buffer.push(s,n,i,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,r=e.buffer.length;for(r&&e.buffer[r-4]==0&&(r-=4);r>0&&e.buffer[r-2]>e.reducePos;)r-=4;let n=e.buffer.slice(r),s=e.bufferBase+r;for(;e&&s==e.bufferBase;)e=e.parent;return new t(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,r){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,r,4),this.storeNode(0,this.pos,r,n?8:4),this.pos=this.reducePos=r,this.score-=190}canShift(e){for(let r=new li(this);;){let n=this.p.parser.stateSlot(r.state,4)||this.p.parser.hasAction(r.state,e);if(n==0)return!1;if((n&65536)==0)return!0;r.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let r=this.p.parser.nextStates(this.state);if(r.length>8||this.stack.length>=120){let s=[];for(let i=0,o;il&1&&a==o)||s.push(r[i],o)}r=s}let n=[];for(let s=0;s>19,s=r&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;r=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(r),!0}findForcedReduction(){let{parser:e}=this.p,r=[],n=(s,i)=>{if(!r.includes(s))return r.push(s),e.allActions(s,o=>{if(!(o&393216))if(o&65536){let a=(o>>19)-i;if(a>1){let l=o&65535,c=this.stack.length-a*3;if(c>=0&&e.getGoto(this.stack[c],l,!1)>=0)return a<<19|65536|l}}else{let a=n(o,i+1);if(a!=null)return a}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let r=0;r0&&this.emitLookAhead()}},Qn=class{constructor(e,r){this.tracker=e,this.context=r,this.hash=e.strict?e.hash(r):0}},li=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let r=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],r,!0);this.state=s}},ci=class t{constructor(e,r,n){this.stack=e,this.pos=r,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,r=e.bufferBase+e.buffer.length){return new t(e,r,r-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new t(this.stack,this.pos,this.index)}};function kr(t,e=Uint16Array){if(typeof t!="string")return t;let r=null;for(let n=0,s=0;n=92&&o--,o>=34&&o--;let l=o-32;if(l>=46&&(l-=46,a=!0),i+=l,a)break;i*=46}r?r[s++]=i:r=new e(i)}return r}var Vt=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},Xl=new Vt,Oi=class{constructor(e,r){this.input=e,this.ranges=r,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Xl,this.rangeIndex=0,this.pos=this.chunkPos=r[0].from,this.range=r[0],this.end=r[r.length-1].to,this.readNext()}resolveOffset(e,r){let n=this.range,s=this.rangeIndex,i=this.pos+e;for(;in.to:i>=n.to;){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];i+=o.from-n.to,n=o}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,r.from);return this.end}peek(e){let r=this.chunkOff+e,n,s;if(r>=0&&r=this.chunk2Pos&&na.to&&(this.chunk2=this.chunk2.slice(0,a.to-n)),s=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),s}acceptToken(e,r=0){let n=r?this.resolveOffset(r,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,r){if(r?(this.token=r,r.start=e,r.lookAhead=e+1,r.value=r.extended=-1):this.token=Xl,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&r<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,r-this.chunkPos);if(e>=this.chunk2Pos&&r<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,r-this.chunk2Pos);if(e>=this.range.from&&r<=this.range.to)return this.input.read(e,r);let n="";for(let s of this.ranges){if(s.from>=r)break;s.to>e&&(n+=this.input.read(Math.max(s.from,e),Math.min(s.to,r)))}return n}},st=class{constructor(e,r){this.data=e,this.id=r}token(e,r){let{parser:n}=r.p;_l(this.data,e,r,this.id,n.data,n.tokenPrecTable)}};st.prototype.contextual=st.prototype.fallback=st.prototype.extend=!1;var it=class{constructor(e,r,n){this.precTable=r,this.elseToken=n,this.data=typeof e=="string"?kr(e):e}token(e,r){let n=e.pos,s=0;for(;;){let i=e.next<0,o=e.resolveOffset(1,1);if(_l(this.data,e,r,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(i||s++,o==null)break;e.reset(o,e.token)}s&&(e.reset(n,e.token),e.acceptToken(this.elseToken,s))}};it.prototype.contextual=st.prototype.fallback=st.prototype.extend=!1;var ie=class{constructor(e,r={}){this.token=e,this.contextual=!!r.contextual,this.fallback=!!r.fallback,this.extend=!!r.extend}};function _l(t,e,r,n,s,i){let o=0,a=1<0){let p=t[f];if(l.allows(p)&&(e.token.value==-1||e.token.value==p||af(p,e.token.value,s,i))){e.acceptToken(p);break}}let O=e.next,u=0,h=t[o+2];if(e.next<0&&h>u&&t[c+h*3-3]==65535){o=t[c+h*3-1];continue e}for(;u>1,p=c+f+(f<<1),d=t[p],g=t[p+1]||65536;if(O=g)u=f+1;else{o=t[p+2],e.advance();continue e}}break}}function Tl(t,e,r){for(let n=e,s;(s=t[n])!=65535;n++)if(s==r)return n-e;return-1}function af(t,e,r,n){let s=Tl(r,n,e);return s<0||Tl(r,n,t)e)&&!n.type.isError)return r<0?Math.max(0,Math.min(n.to-1,e-25)):Math.min(t.length,Math.max(n.from+1,e+25));if(r<0?n.prevSibling():n.nextSibling())break;if(!n.parent())return r<0?0:t.length}}var ui=class{constructor(e,r){this.fragments=e,this.minRepeat=r,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Rl(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Rl(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=o,null;if(i instanceof me){let a=o>this.lastRepeatPos&&i.type.id>=this.minRepeat;if(o==e||a){let l=o+i.length,c;if(o>=this.safeFrom&&l<=this.safeTo&&(!(c=i.prop(Te.lookAhead))||l+c=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(o),this.index.push(0))}else this.index[r]++,this.nextStart=o+i.length}}},hi=class{constructor(e,r){this.stream=r,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(n=>new Vt)}getActions(e){let r=0,n=null,{parser:s}=e.p,{tokenizers:i}=s,o=s.stateSlot(e.state,3),a=e.curContext?e.curContext.hash:0,l=0;for(let c=0;cu.end+25&&(l=Math.max(u.lookAhead,l)),u.value!=0)){let h=r;if(u.extended>-1&&(r=this.addActions(e,u.extended,u.end,r)),r=this.addActions(e,u.value,u.end,r),!O.extend&&(n=u,r>h))break}}for(;this.actions.length>r;)this.actions.pop();return l&&e.setLookAhead(l),!n&&e.pos==this.stream.end&&(n=new Vt,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,r=this.addActions(e,n.value,n.end,r)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let r=new Vt,{pos:n,p:s}=e;return r.start=n,r.end=Math.min(n+1,s.stream.end),r.value=n==s.stream.end?s.parser.eofTerm:0,r}updateCachedToken(e,r,n){let s=this.stream.clipPos(n.pos);if(r.token(this.stream.reset(s,e),n),e.value>-1){let{parser:i}=n.p;for(let o=0;o=0&&n.p.parser.dialect.allows(a>>1)){(a&1)==0?e.value=a>>1:e.extended=a>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,r,n,s){for(let i=0;ie.bufferLength*4?new ui(n,e.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,r=this.minStackPos,n=this.stacks=[],s,i;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;or)n.push(a);else{if(this.advanceStack(a,n,e))continue;{s||(s=[],i=[]),s.push(a);let l=this.tokens.getMainToken(a);i.push(l.value,l.end)}}break}}if(!n.length){let o=s&&lf(s);if(o)return Se&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Se&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+r);this.recovering||(this.recovering=5)}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,i,n);if(o)return Se&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(n.length>o)for(n.sort((a,l)=>l.score-a.score);n.length>o;)n.pop();n.some(a=>a.reducePos>r)&&this.recovering--}else if(n.length>1){e:for(let o=0;o500&&c.buffer.length>500)if((a.score-c.score||a.buffer.length-c.buffer.length)>0)n.splice(l--,1);else{n.splice(o--,1);continue e}}}n.length>12&&(n.sort((o,a)=>a.score-o.score),n.splice(12,n.length-12))}this.minStackPos=n[0].pos;for(let o=1;o-1&&n.length&&(!i||(n.prop(Te.contextHash)||0)==o))return e.useNode(n,a,r),n;if(n.children.length==0||n.positions[0]>0)break;let l=n.children[0];if(l instanceof me&&(!s||l.type.id>=this.parser.minRepeatTerm))n=l;else break}return null}advanceStack(e,r,n){let s=e.pos,{parser:i}=this,o=Se?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let c=e.reducePos0)return e.reduce(a),Se&&console.log(o+this.stackID(e)+` (via always-reduce ${i.getName(a&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let l=this.tokens.getActions(e);for(let c=0;cs?r.push(p):n.push(p)}return!1}advanceFully(e,r){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return jl(e,r),!0}}runRecovery(e,r,n){let s=null,i=!1;for(let o=0;o ":"";if(a.deadEnd&&(i||(i=!0,a.restart(),Se&&console.log(O+this.stackID(a)+" (restarted)"),this.advanceFully(a,n))))continue;let u=a.split(),h=O;for(let f=0;f<10&&u.forceReduce()&&(Se&&console.log(h+this.stackID(u)+" (via force-reduce)"),!this.advanceFully(u,n));f++)Se&&(h=this.stackID(u)+" -> ");for(let f of a.recoverByInsert(l))Se&&console.log(O+this.stackID(f)+" (via recover-insert)"),this.advanceFully(f,n);this.stream.end>a.pos?(c==a.pos&&(c++,l=0),a.recoverByDelete(l,c),Se&&console.log(O+this.stackID(a)+` (via recover-delete ${this.parser.getName(l)})`),jl(a,n)):(!s||s.scoret,It=class{constructor(e){this.start=e.start,this.shift=e.shift||oi,this.reduce=e.reduce||oi,this.reuse=e.reuse||oi,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},ot=class t extends en{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let r=e.nodeNames.split(" ");this.minRepeatTerm=r.length;for(let a=0;ae.topRules[a][1]),s=[];for(let a=0;a=0)i(O,l,a[c++]);else{let u=a[c+-O];for(let h=-O;h>0;h--)i(a[c++],l,u);c++}}}this.nodeSet=new hr(r.map((a,l)=>mt.define({name:l>=this.minRepeatTerm?void 0:a,id:l,props:s[l],top:n.indexOf(l)>-1,error:l==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(l)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=1024;let o=kr(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let a=0;atypeof a=="number"?new st(o,a):a),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,r,n){let s=new fi(this,e,r,n);for(let i of this.wrappers)s=i(s,e,r,n);return s}getGoto(e,r,n=!1){let s=this.goto;if(r>=s[0])return-1;for(let i=s[r+1];;){let o=s[i++],a=o&1,l=s[i++];if(a&&n)return l;for(let c=i+(o>>1);i0}validAction(e,r){return!!this.allActions(e,n=>n==r?!0:null)}allActions(e,r){let n=this.stateSlot(e,4),s=n?r(n):void 0;for(let i=this.stateSlot(e,1);s==null;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=Ge(this.data,i+2);else break;s=r(Ge(this.data,i+1))}return s}nextStates(e){let r=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Ge(this.data,n+2);else break;if((this.data[n+2]&1)==0){let s=this.data[n+1];r.some((i,o)=>o&1&&i==s)||r.push(this.data[n],s)}}return r}configure(e){let r=Object.assign(Object.create(t.prototype),this);if(e.props&&(r.nodeSet=this.nodeSet.extend(...e.props)),e.top){let n=this.topRules[e.top];if(!n)throw new RangeError(`Invalid top rule name ${e.top}`);r.top=n}return e.tokenizers&&(r.tokenizers=this.tokenizers.map(n=>{let s=e.tokenizers.find(i=>i.from==n);return s?s.to:n})),e.specializers&&(r.specializers=this.specializers.slice(),r.specializerSpecs=this.specializerSpecs.map((n,s)=>{let i=e.specializers.find(a=>a.from==n.external);if(!i)return n;let o=Object.assign(Object.assign({},n),{external:i.to});return r.specializers[s]=El(o),o})),e.contextTracker&&(r.context=e.contextTracker),e.dialect&&(r.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(r.strict=e.strict),e.wrap&&(r.wrappers=r.wrappers.concat(e.wrap)),e.bufferLength!=null&&(r.bufferLength=e.bufferLength),r}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let r=this.dynamicPrecedences;return r==null?0:r[e]||0}parseDialect(e){let r=Object.keys(this.dialects),n=r.map(()=>!1);if(e)for(let i of e.split(" ")){let o=r.indexOf(i);o>=0&&(n[o]=!0)}let s=null;for(let i=0;in)&&r.p.parser.stateFlag(r.state,2)&&(!e||e.scoret.external(r,n)<<1|e}return t.get}var cf=55,Of=1,uf=56,hf=2,ff=57,df=3,Cl=4,pf=5,Qi=6,Wl=7,Vl=8,Il=9,Dl=10,mf=11,gf=12,bf=13,pi=58,Qf=14,xf=15,Al=59,Gl=21,$f=23,Nl=24,kf=25,gi=27,Bl=28,Sf=29,yf=32,Pf=35,wf=37,vf=38,Zf=0,Xf=1,Tf={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},Rf={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},Ll={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function jf(t){return t==45||t==46||t==58||t>=65&&t<=90||t==95||t>=97&&t<=122||t>=161}var Yl=null,ql=null,zl=0;function bi(t,e){let r=t.pos+e;if(zl==r&&ql==t)return Yl;let n=t.peek(e),s="";for(;jf(n);)s+=String.fromCharCode(n),n=t.peek(++e);return ql=t,zl=r,Yl=s?s.toLowerCase():n==Ef||n==_f?void 0:null}var Fl=60,xn=62,xi=47,Ef=63,_f=33,Cf=45;function Ml(t,e){this.name=t,this.parent=e}var Af=[Qi,Dl,Wl,Vl,Il],Lf=new It({start:null,shift(t,e,r,n){return Af.indexOf(e)>-1?new Ml(bi(n,1)||"",t):t},reduce(t,e){return e==Gl&&t?t.parent:t},reuse(t,e,r,n){let s=e.type.id;return s==Qi||s==wf?new Ml(bi(n,1)||"",t):t},strict:!1}),Yf=new ie((t,e)=>{if(t.next!=Fl){t.next<0&&e.context&&t.acceptToken(pi);return}t.advance();let r=t.next==xi;r&&t.advance();let n=bi(t,0);if(n===void 0)return;if(!n)return t.acceptToken(r?xf:Qf);let s=e.context?e.context.name:null;if(r){if(n==s)return t.acceptToken(mf);if(s&&Rf[s])return t.acceptToken(pi,-2);if(e.dialectEnabled(Zf))return t.acceptToken(gf);for(let i=e.context;i;i=i.parent)if(i.name==n)return;t.acceptToken(bf)}else{if(n=="script")return t.acceptToken(Wl);if(n=="style")return t.acceptToken(Vl);if(n=="textarea")return t.acceptToken(Il);if(Tf.hasOwnProperty(n))return t.acceptToken(Dl);s&&Ll[s]&&Ll[s][n]?t.acceptToken(pi,-1):t.acceptToken(Qi)}},{contextual:!0}),qf=new ie(t=>{for(let e=0,r=0;;r++){if(t.next<0){r&&t.acceptToken(Al);break}if(t.next==Cf)e++;else if(t.next==xn&&e>=2){r>=3&&t.acceptToken(Al,-2);break}else e=0;t.advance()}});function zf(t){for(;t;t=t.parent)if(t.name=="svg"||t.name=="math")return!0;return!1}var Mf=new ie((t,e)=>{if(t.next==xi&&t.peek(1)==xn){let r=e.dialectEnabled(Xf)||zf(e.context);t.acceptToken(r?pf:Cl,2)}else t.next==xn&&t.acceptToken(Cl,1)});function $i(t,e,r){let n=2+t.length;return new ie(s=>{for(let i=0,o=0,a=0;;a++){if(s.next<0){a&&s.acceptToken(e);break}if(i==0&&s.next==Fl||i==1&&s.next==xi||i>=2&&io?s.acceptToken(e,-o):s.acceptToken(r,-(o-2));break}else if((s.next==10||s.next==13)&&a){s.acceptToken(e,1);break}else i=o=0;s.advance()}})}var Uf=$i("script",cf,Of),Wf=$i("style",uf,hf),Vf=$i("textarea",ff,df),If=We({"Text RawText IncompleteTag IncompleteCloseTag":m.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":m.angleBracket,TagName:m.tagName,"MismatchedCloseTag/TagName":[m.tagName,m.invalid],AttributeName:m.attributeName,"AttributeValue UnquotedAttributeValue":m.attributeValue,Is:m.definitionOperator,"EntityReference CharacterReference":m.character,Comment:m.blockComment,ProcessingInst:m.processing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StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl",maxTerm:68,context:Lf,nodeProps:[["closedBy",-10,1,2,3,7,8,9,10,11,12,13,"EndTag",6,"EndTag SelfClosingEndTag",-4,22,31,34,37,"CloseTag"],["openedBy",4,"StartTag StartCloseTag",5,"StartTag",-4,30,33,36,38,"OpenTag"],["group",-10,14,15,18,19,20,21,40,41,42,43,"Entity",17,"Entity TextContent",-3,29,32,35,"TextContent Entity"],["isolate",-11,22,30,31,33,34,36,37,38,39,42,43,"ltr",-3,27,28,40,""]],propSources:[If],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z5zblWOX5uXZ7SZ[5u[^7S^p5uqr5urs7Sst+Ptw5uwx7Sx!]5u!]!^7w!^!a7S!a#S5u#S#T7S#T;'S5u;'S;=`8n<%lO5u!R7VVOp7Sqs7St!]7S!]!^7l!^;'S7S;'S;=`7q<%lO7S!R7qOb!R!R7tP;=`<%l7S!Z8OYlWb!ROX+PZ[+P^p+Pqr+Psw+Px!^+P!a#S+P#T;'S+P;'S;=`+t<%lO+P!Z8qP;=`<%l5u!_8{iiSlWOX5uXZ7SZ[5u[^7S^p5uqr8trs7Sst/^tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^:j!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!_:sbiSlWb!ROX+PZ[+P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%lO*V!R!;uP;=`<%l!4t!V!{let c=a.type.id;if(c==Sf)return mi(a,l,r);if(c==yf)return mi(a,l,n);if(c==Pf)return mi(a,l,s);if(c==Gl&&i.length){let O=a.node,u=O.firstChild,h=u&&Ul(u,l),f;if(h){for(let p of i)if(p.tag==h&&(!p.attrs||p.attrs(f||(f=Kl(u,l))))){let d=O.lastChild,g=d.type.id==vf?d.from:O.to;if(g>u.to)return{parser:p.parser,overlay:[{from:u.to,to:g}]}}}}if(o&&c==Nl){let O=a.node,u;if(u=O.firstChild){let h=o[l.read(u.from,u.to)];if(h)for(let f of h){if(f.tagName&&f.tagName!=Ul(O.parent,l))continue;let p=O.lastChild;if(p.type.id==gi){let d=p.from+1,g=p.lastChild,Q=p.to-(g&&g.isError?0:1);if(Q>d)return{parser:f.parser,overlay:[{from:d,to:Q}],bracketed:!0}}else if(p.type.id==Bl)return{parser:f.parser,overlay:[{from:p.from,to:p.to}]}}}}return null})}var Df=148,Jl=1,Gf=149,Nf=150,rc=2,Bf=151,Ff=3,Hf=4,Kf=152,nc=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],Jf=58,ed=40,sc=95,td=91,$n=45,rd=46,nd=35,sd=37,id=38,od=92,ad=10,ld=42;function Sr(t){return t>=65&&t<=90||t>=97&&t<=122||t>=161}function Si(t){return t>=48&&t<=57}function ec(t){return Si(t)||t>=97&&t<=102||t>=65&&t<=70}var ic=(t,e,r)=>(n,s)=>{for(let i=!1,o=0,a=0;;a++){let{next:l}=n;if(Sr(l)||l==$n||l==sc||i&&Si(l))!i&&(l!=$n||a>0)&&(i=!0),o===a&&l==$n&&o++,n.advance();else if(l==od&&n.peek(1)!=ad){if(n.advance(),ec(n.next)){do n.advance();while(ec(n.next));n.next==32&&n.advance()}else n.next>-1&&n.advance();i=!0}else{i&&n.acceptToken(o>=2&&s.canShift(rc)?e:l==ed?r:t);break}}},cd=new ie(ic(Gf,rc,Nf),{contextual:!0}),Od=new ie(ic(Bf,Ff,Hf),{contextual:!0}),ud=new ie(t=>{if(nc.includes(t.peek(-1))){let{next:e}=t;(Sr(e)||e==sc||e==nd||e==rd||e==ld||e==td||e==Jf&&Sr(t.peek(1))||e==$n||e==id)&&t.acceptToken(Df)}}),hd=new ie(t=>{if(!nc.includes(t.peek(-1))){let{next:e}=t;if(e==sd&&(t.advance(),t.acceptToken(Jl)),Sr(e)){do t.advance();while(Sr(t.next)||Si(t.next));t.acceptToken(Jl)}}});function tc(t){let e=t.length;return(e==4||e==5||e==7||e==9)&&/^#[a-f\d]+$/i.test(t)?Kf:-1}var fd=We({"AtKeyword import charset namespace keyframes media supports font-feature-values":m.definitionKeyword,"from to selector scope MatchFlag":m.keyword,NamespaceName:m.namespace,KeyframeName:m.labelName,KeyframeRangeName:m.operatorKeyword,TagName:m.tagName,ClassName:m.className,PseudoClassName:m.constant(m.className),IdName:m.labelName,"FeatureName PropertyName":m.propertyName,AttributeName:m.attributeName,NumberLiteral:m.number,KeywordQuery:m.keyword,UnaryQueryOp:m.operatorKeyword,"CallTag ValueName FontName":m.atom,VariableName:m.variableName,Callee:m.operatorKeyword,Unit:m.unit,"UniversalSelector NestingSelector":m.definitionOperator,"MatchOp CompareOp":m.compareOperator,"ChildOp SiblingOp, LogicOp":m.logicOperator,BinOp:m.arithmeticOperator,Important:m.modifier,Comment:m.blockComment,ColorLiteral:m.color,"ParenthesizedContent StringLiteral":m.string,":":m.punctuation,PseudoOp:m.derefOperator,"; , |":m.separator,"( )":m.paren,"[ ]":m.squareBracket,"{ }":m.brace}),dd={__proto__:null,lang:44,"nth-child":44,"nth-last-child":44,"nth-of-type":44,"nth-last-of-type":44,dir:44,"host-context":44,if:88,url:158,"url-prefix":158,domain:158,regexp:158},pd={__proto__:null,or:102,and:102,not:112,only:112,layer:212},md={__proto__:null,selector:118,style:124,layer:208},gd={__proto__:null,"@import":204,"@media":216,"@charset":220,"@namespace":224,"@keyframes":230,"@supports":242,"@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S;=`%{<%lO%jbCvU!r`Oy%jz#c%j#c#dDY#d;'S%j;'S;=`%{<%lO%jbD_U!r`Oy%jz#f%j#f#gDq#g;'S%j;'S;=`%{<%lO%jbDvU!r`Oy%jz#h%j#h#iEY#i;'S%j;'S;=`%{<%lO%jbE_U!r`Oy%jz#T%j#T#UEq#U;'S%j;'S;=`%{<%lO%jbEvU!r`Oy%jz#b%j#b#cFY#c;'S%j;'S;=`%{<%lO%jbF_U!r`Oy%jz#h%j#h#iFq#i;'S%j;'S;=`%{<%lO%jbFxS$tQ!r`Oy%jz;'S%j;'S;=`%{<%lO%jjGZSrYOy%jz;'S%j;'S;=`%{<%lO%jfGlU$gUOy%jz!_%j!_!`0^!`;'S%j;'S;=`%{<%lO%jjHTSqYOy%jz;'S%j;'S;=`%{<%lO%jfHfU#SQOy%jz!_%j!_!`0^!`;'S%j;'S;=`%{<%lO%j`H{P;=`<%l%Z",tokenizers:[ud,hd,cd,Od,1,2,3,4,new it("m~RRYZ[z{a~~g~aO$c~~dP!P!Qg~lO$d~~",28,156)],topRules:{StyleSheet:[0,6],Styles:[1,129]},dynamicPrecedences:{97:1},specialized:[{term:172,get:(t,e)=>tc(t)<<1,external:tc},{term:150,get:t=>dd[t]||-1},{term:151,get:t=>pd[t]||-1},{term:4,get:t=>md[t]||-1},{term:28,get:t=>gd[t]||-1},{term:149,get:t=>bd[t]||-1}],tokenPrec:2433});var yi=null;function Pi(){if(!yi&&typeof document=="object"&&document.body){let{style:t}=document.body,e=[],r=new Set;for(let n in t)n!="cssText"&&n!="cssFloat"&&typeof t[n]=="string"&&(/[A-Z]/.test(n)&&(n=n.replace(/[A-Z]/g,s=>"-"+s.toLowerCase())),r.has(n)||(e.push(n),r.add(n)));yi=e.sort().map(n=>({type:"property",label:n,apply:n+": "}))}return yi||[]}var ac=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map(t=>({type:"class",label:t})),lc=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map(t=>({type:"keyword",label:t})).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map(t=>({type:"constant",label:t}))),Qd=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map(t=>({type:"type",label:t})),xd=["@charset","@color-profile","@container","@counter-style","@font-face","@font-feature-values","@font-palette-values","@import","@keyframes","@layer","@media","@namespace","@page","@position-try","@property","@scope","@starting-style","@supports","@view-transition"].map(t=>({type:"keyword",label:t})),Ne=/^(\w[\w-]*|-\w[\w-]*|)$/,$d=/^-(-[\w-]*)?$/;function kd(t,e){var r;if((t.name=="("||t.type.isError)&&(t=t.parent||t),t.name!="ArgList")return!1;let n=(r=t.parent)===null||r===void 0?void 0:r.firstChild;return n?.name!="Callee"?!1:e.sliceString(n.from,n.to)=="var"}var cc=new Jr,Sd=["Declaration"];function yd(t){for(let e=t;;){if(e.type.isTop)return e;if(!(e=e.parent))return t}}function Oc(t,e,r){if(e.to-e.from>4096){let n=cc.get(e);if(n)return n;let s=[],i=new Set,o=e.cursor(Ue.IncludeAnonymous);if(o.firstChild())do for(let a of Oc(t,o.node,r))i.has(a.label)||(i.add(a.label),s.push(a));while(o.nextSibling());return cc.set(e,s),s}else{let n=[],s=new Set;return e.cursor().iterate(i=>{var o;if(r(i)&&i.matchContext(Sd)&&((o=i.node.nextSibling)===null||o===void 0?void 0:o.name)==":"){let a=t.sliceString(i.from,i.to);s.has(a)||(s.add(a),n.push({label:a,type:"variable"}))}}),n}}var Pd=t=>e=>{let{state:r,pos:n}=e,s=U(r).resolveInner(n,-1),i=s.type.isError&&s.from==s.to-1&&r.doc.sliceString(s.from,s.to)=="-";if(s.name=="PropertyName"||(i||s.name=="TagName")&&/^(Block|Styles)$/.test(s.resolve(s.to).name))return{from:s.from,options:Pi(),validFor:Ne};if(s.name=="ValueName")return{from:s.from,options:lc,validFor:Ne};if(s.name=="PseudoClassName")return{from:s.from,options:ac,validFor:Ne};if(t(s)||(e.explicit||i)&&kd(s,r.doc))return{from:t(s)||i?s.from:n,options:Oc(r.doc,yd(s),t),validFor:$d};if(s.name=="TagName"){for(let{parent:l}=s;l;l=l.parent)if(l.name=="Block")return{from:s.from,options:Pi(),validFor:Ne};return{from:s.from,options:Qd,validFor:Ne}}if(s.name=="AtKeyword")return{from:s.from,options:xd,validFor:Ne};if(!e.explicit)return null;let o=s.resolve(n),a=o.childBefore(n);return a&&a.name==":"&&o.name=="PseudoClassSelector"?{from:n,options:ac,validFor:Ne}:a&&a.name==":"&&o.name=="Declaration"||o.name=="ArgList"?{from:n,options:lc,validFor:Ne}:o.name=="Block"||o.name=="Styles"?{from:n,options:Pi(),validFor:Ne}:null},wd=Pd(t=>t.name=="VariableName"),yr=qt.define({name:"css",parser:oc.configure({props:[rt.add({Declaration:zt()}),Ie.add({"Block KeyframeList":sn})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function uc(){return new Ve(yr,yr.data.of({autocomplete:wd}))}var vd=317,Zd=318,hc=1,Xd=2,Td=3,Rd=4,jd=319,Ed=321,_d=322,Cd=5,Ad=6,Ld=0,vi=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],fc=125,Yd=59,Zi=47,qd=42,zd=43,Md=45,Ud=60,Wd=44,Vd=63,Id=46,Dd=91,Gd=new It({start:!1,shift(t,e){return e==Cd||e==Ad||e==Ed?t:e==_d},strict:!1}),Nd=new ie((t,e)=>{let{next:r}=t;(r==fc||r==-1||e.context)&&t.acceptToken(jd)},{contextual:!0,fallback:!0}),Bd=new ie((t,e)=>{let{next:r}=t,n;vi.indexOf(r)>-1||r==Zi&&((n=t.peek(1))==Zi||n==qd)||r!=fc&&r!=Yd&&r!=-1&&!e.context&&t.acceptToken(vd)},{contextual:!0}),Fd=new ie((t,e)=>{t.next==Dd&&!e.context&&t.acceptToken(Zd)},{contextual:!0}),Hd=new ie((t,e)=>{let{next:r}=t;if(r==zd||r==Md){if(t.advance(),r==t.next){t.advance();let n=!e.context&&e.canShift(hc);t.acceptToken(n?hc:Xd)}}else r==Vd&&t.peek(1)==Id&&(t.advance(),t.advance(),(t.next<48||t.next>57)&&t.acceptToken(Td))},{contextual:!0});function wi(t,e){return t>=65&&t<=90||t>=97&&t<=122||t==95||t>=192||!e&&t>=48&&t<=57}var Kd=new ie((t,e)=>{if(t.next!=Ud||!e.dialectEnabled(Ld)||(t.advance(),t.next==Zi))return;let r=0;for(;vi.indexOf(t.next)>-1;)t.advance(),r++;if(wi(t.next,!0)){for(t.advance(),r++;wi(t.next,!1);)t.advance(),r++;for(;vi.indexOf(t.next)>-1;)t.advance(),r++;if(t.next==Wd)return;for(let n=0;;n++){if(n==7){if(!wi(t.next,!0))return;break}if(t.next!="extends".charCodeAt(n))break;t.advance(),r++}}t.acceptToken(Rd,-r)}),Jd=We({"get set async static":m.modifier,"for while do if else switch try catch finally return throw break continue default case defer":m.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":m.operatorKeyword,"let var const using function class extends":m.definitionKeyword,"import export from":m.moduleKeyword,"with debugger new":m.keyword,TemplateString:m.special(m.string),super:m.atom,BooleanLiteral:m.bool,this:m.self,null:m.null,Star:m.modifier,VariableName:m.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":m.function(m.variableName),VariableDefinition:m.definition(m.variableName),Label:m.labelName,PropertyName:m.propertyName,PrivatePropertyName:m.special(m.propertyName),"CallExpression/MemberExpression/PropertyName":m.function(m.propertyName),"FunctionDeclaration/VariableDefinition":m.function(m.definition(m.variableName)),"ClassDeclaration/VariableDefinition":m.definition(m.className),"NewExpression/VariableName":m.className,PropertyDefinition:m.definition(m.propertyName),PrivatePropertyDefinition:m.definition(m.special(m.propertyName)),UpdateOp:m.updateOperator,"LineComment Hashbang":m.lineComment,BlockComment:m.blockComment,Number:m.number,String:m.string,Escape:m.escape,ArithOp:m.arithmeticOperator,LogicOp:m.logicOperator,BitOp:m.bitwiseOperator,CompareOp:m.compareOperator,RegExp:m.regexp,Equals:m.definitionOperator,Arrow:m.function(m.punctuation),": Spread":m.punctuation,"( )":m.paren,"[ ]":m.squareBracket,"{ }":m.brace,"InterpolationStart InterpolationEnd":m.special(m.brace),".":m.derefOperator,", ;":m.separator,"@":m.meta,TypeName:m.typeName,TypeDefinition:m.definition(m.typeName),"type enum interface implements namespace module declare":m.definitionKeyword,"abstract global Privacy readonly override":m.modifier,"is keyof unique infer asserts":m.operatorKeyword,JSXAttributeValue:m.attributeValue,JSXText:m.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":m.angleBracket,"JSXIdentifier JSXNameSpacedName":m.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":m.attributeName,"JSXBuiltin/JSXIdentifier":m.standard(m.tagName)}),ep={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:237,private:237,protected:237,readonly:239,instanceof:258,satisfies:261,import:294,keyof:351,unique:355,infer:361,asserts:397,is:399,abstract:419,implements:421,type:423,let:426,var:428,using:431,interface:437,enum:441,namespace:447,module:449,declare:453,global:457,defer:473,for:478,of:487,while:490,with:494,do:498,if:502,else:504,switch:508,case:514,try:520,catch:524,finally:528,return:532,throw:536,break:540,continue:544,debugger:548},tp={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:403},rp={__proto__:null,"<":193},dc=ot.deserialize({version:14,states:"$GSQ%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Im'#ImO1XQ`O'#GtO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JsO6[Q!0MxO'#JtO6uQ`O'#F^O6zQ,UO'#FuOOQ!0Lf'#Fg'#FgO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8|R8|6aQ1W+tW5j1W5l8c:XQ5l1ZQ8c5kR:X8dQ+y&QR1^+yQ2a,zR6o2aYrOXst#dQ&v!ZQ+c%mQ,t&rQ,v&tQ,w&uQ,y&wQ2[,uS2_,z2aR6n2^Q%opQ&z!_Q&}!aQ'P!bQ'R!cQ'r!uQ+b%lQ+n%zQ,S&XQ,j&mQ-R&|W-r'l't'u'xQ-y'pQ0Z*oQ1R+oQ1e,RS2Q,k,nQ2i-QQ2j-TQ2k-UQ3P-qW3R-t-u-x-zQ5c1SQ5o1aQ5s1gQ6X1wQ6c2SQ6m2]U6|3Q3T3WQ7P3UQ8_5dQ8g5qQ8i5tQ8n5|Q8w6YQ8}6bS9^6}7RQ9`7QQ:Y8eQ:d8xQ:i9OQ:p9_Q;W:ZQ;_:eQ;c:qQ;n;XR;q;`Q%zyQ'e!iQ'p!uU+o%{%|%}Q-X'VU-m'f'g'hS-q'l'vQ0S*kS1S+p+qQ2p-ZS2}-n-oQ3U-vS4r0T0WQ5d1TQ6x2wQ6{3OQ7Q3VU7}4t4u4xQ9|8PR;Q9}S$wi>QR*|%VU%Ui%V>QR0h*zQ$viS(v#v+kS)d$b$cQ)f$dQ*]$xS*f${*ZQ*u%OQ*v%QQ+R%^Q+S%_Q+W%cQ.nQQ>O>YQ>P>ZQ>[>^R>]>_Q+P%]Q.pTR#[WR'Z!el!tQ!r!v!y!z'a'm'n'o-g-w1q5}6PS'V!e-^U*k$|*[*pS-Z'W'`S0W*l*rQ0`*sQ2w-eQ4x0^R4}0aR(|#xQ!fQT-f'a-g]!qQ!r'a-g1q5}Q#p]R'j < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty VariableDefinition Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem",maxTerm:381,context:Gd,nodeProps:[["isolate",-8,5,6,14,37,39,51,53,55,""],["group",-26,9,17,19,68,208,212,216,217,219,222,225,235,238,244,246,248,250,253,259,265,267,269,271,273,275,276,"Statement",-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,121,122,137,140,142,143,144,145,146,148,149,168,170,172,"Expression",-23,31,33,37,41,43,45,174,176,178,179,181,182,183,185,186,187,189,190,191,202,204,206,207,"Type",-3,88,103,109,"ClassItem"],["openedBy",23,"<",38,"InterpolationStart",56,"[",60,"{",73,"(",161,"JSXStartCloseTag"],["closedBy",-2,24,169,">",40,"InterpolationEnd",50,"]",61,"}",74,")",166,"JSXEndTag"]],propSources:[Jd],skippedNodes:[0,5,6,279],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-yZ[+g[]%Z]^.c^p%Zpq+gqr/mrs3cst:_tuEruvJSvwLkwx! Yxy!'iyz!(sz{!)}{|!,q|}!.O}!O!,q!O!P!/Y!P!Q!9j!Q!R#:O!R![#<_![!]#I_!]!^#Jk!^!_#Ku!_!`$![!`!a$$v!a!b$*T!b!c$,r!c!}Er!}#O$-|#O#P$/W#P#Q$4o#Q#R$5y#R#SEr#S#T$7W#T#o$8b#o#p$x#r#s$@U#s$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$I|Er$I|$I}$Dk$I}$JO$Dk$JO$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr(n%d_$j&j(Xp([!bOY%ZYZ&cZr%Zrs&}sw%Zwx(rx!^%Z!^!_*g!_#O%Z#O#P&c#P#o%Z#o#p*g#p;'S%Z;'S;=`+a<%lO%Z&j&hT$j&jO!^&c!_#o&c#p;'S&c;'S;=`&w<%lO&c&j&zP;=`<%l&c'|'U]$j&j([!bOY&}YZ&cZw&}wx&cx!^&}!^!_'}!_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+g[p%Zpq+gqr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$f%Z$f$g+g$g#BYEr#BY#BZ$A`#BZ$ISEr$IS$I_$A`$I_$JTEr$JT$JU$A`$JU$KVEr$KV$KW$A`$KW&FUEr&FU&FV$A`&FV;'SEr;'S;=`I|<%l?HTEr?HT?HU$A`?HUOEr07[$D|k$j&j(Xp([!b(O0/l$^#t(U,2j(f$I[OY%ZYZ&cZr%Zrs&}st%ZtuEruw%Zwx(rx}%Z}!OGv!O!Q%Z!Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[Bd,Fd,Hd,Kd,2,3,4,5,6,7,8,9,10,11,12,13,14,Nd,new it("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(d~~",141,341),new it("j~RQYZXz{^~^O(R~~aP!P!Qd~iO(S~~",25,324)],topRules:{Script:[0,7],SingleExpression:[1,277],SingleClassItem:[2,278]},dialects:{jsx:0,ts:15179},dynamicPrecedences:{80:1,82:1,94:1,170:1,200:1},specialized:[{term:328,get:t=>ep[t]||-1},{term:344,get:t=>tp[t]||-1},{term:95,get:t=>rp[t]||-1}],tokenPrec:15205});var bc=[fe("function ${name}(${params}) {\n ${}\n}",{label:"function",detail:"definition",type:"keyword"}),fe("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:"for",detail:"loop",type:"keyword"}),fe("for (let ${name} of ${collection}) {\n ${}\n}",{label:"for",detail:"of loop",type:"keyword"}),fe("do {\n ${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),fe("while (${}) {\n ${}\n}",{label:"while",detail:"loop",type:"keyword"}),fe(`try { \${} } catch (\${error}) { \${} -}`,{label:"try",detail:"/ catch block",type:"keyword"}),L("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),L(`if (\${}) { +}`,{label:"try",detail:"/ catch block",type:"keyword"}),fe("if (${}) {\n ${}\n}",{label:"if",detail:"block",type:"keyword"}),fe(`if (\${}) { \${} } else { \${} -}`,{label:"if",detail:"/ else block",type:"keyword"}),L(`class \${name} { +}`,{label:"if",detail:"/ else block",type:"keyword"}),fe(`class \${name} { constructor(\${params}) { \${} } -}`,{label:"class",detail:"definition",type:"keyword"}),L('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),L('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],Mh=Oo.concat([L("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),L("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),L("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),ao=new Wt,co=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function yt(t){return(e,r)=>{let n=e.node.getChild("VariableDefinition");return n&&r(n,t),!0}}var Uh=["FunctionDeclaration"],Vh={FunctionDeclaration:yt("function"),ClassDeclaration:yt("class"),ClassExpression:()=>!0,EnumDeclaration:yt("constant"),TypeAliasDeclaration:yt("type"),NamespaceDeclaration:yt("namespace"),VariableDefinition(t,e){t.matchContext(Uh)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function ho(t,e){let r=ao.get(e);if(r)return r;let n=[],i=!0;function s(a,o){let l=t.sliceString(a.from,a.to);n.push({label:l,type:o})}return e.cursor(le.IncludeAnonymous).iterate(a=>{if(i)i=!1;else if(a.name){let o=Vh[a.name];if(o&&o(a,s)||co.has(a.name))return!1}else if(a.to-a.from>8192){for(let o of ho(t,a.node))n.push(o);return!1}}),ao.set(e,n),n}var oo=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,uo=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function Gh(t){let e=R(t.state).resolveInner(t.pos,-1);if(uo.indexOf(e.name)>-1)return null;let r=e.name=="VariableName"||e.to-e.from<20&&oo.test(t.state.sliceDoc(e.from,e.to));if(!r&&!t.explicit)return null;let n=[];for(let i=e;i;i=i.parent)co.has(i.name)&&(n=n.concat(ho(t.state.doc,i)));return{options:n,from:r?e.from:t.pos,validFor:oo}}var te=Ne.define({name:"javascript",parser:so.configure({props:[$e.add({IfStatement:Fe({except:/^\s*({|else\b)/}),TryStatement:Fe({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Os,SwitchBody:t=>{let e=t.textAfter,r=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(r?0:n?1:2)*t.unit},Block:ls({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":Fe({except:/^\s*{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),he.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":It,BlockComment(t){return{from:t.from+2,to:t.to-2}},JSXElement(t){let e=t.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let r=t.lastChild;return{from:e.to,to:r.type.isError?t.to:r.from}},"JSXSelfClosingTag JSXOpenTag"(t){var e;let r=(e=t.firstChild)===null||e===void 0?void 0:e.nextSibling,n=t.lastChild;return!r||r.type.isError?null:{from:r.to,to:n.type.isError?t.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),po={test:t=>/^JSX/.test(t.name),facet:Vt({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Nn=te.configure({dialect:"ts"},"typescript"),Fn=te.configure({dialect:"jsx",props:[Ar.add(t=>t.isTop?[po]:void 0)]}),Hn=te.configure({dialect:"jsx ts",props:[Ar.add(t=>t.isTop?[po]:void 0)]},"typescript"),fo=t=>({label:t,type:"keyword"}),mo="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(fo),Ih=mo.concat(["declare","implements","private","protected","public"].map(fo));function go(t={}){let e=t.jsx?t.typescript?Hn:Fn:t.typescript?Nn:te,r=t.typescript?Mh.concat(Ih):Oo.concat(mo);return new ce(e,[te.data.of({autocomplete:ys(uo,Kr(r))}),te.data.of({autocomplete:Gh}),t.jsx?Nh:[]])}function Dh(t){for(;;){if(t.name=="JSXOpenTag"||t.name=="JSXSelfClosingTag"||t.name=="JSXFragmentTag")return t;if(t.name=="JSXEscape"||!t.parent)return null;t=t.parent}}function lo(t,e,r=t.length){for(let n=e?.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return t.sliceString(n.from,Math.min(n.to,r));return""}var Bh=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Nh=X.inputHandler.of((t,e,r,n,i)=>{if((Bh?t.composing:t.compositionStarted)||t.state.readOnly||e!=r||n!=">"&&n!="/"||!te.isActiveAt(t.state,e,-1))return!1;let s=i(),{state:a}=s,o=a.changeByRange(l=>{var O;let{head:c}=l,h=R(a).resolveInner(c-1,-1),p;if(h.name=="JSXStartTag"&&(h=h.parent),!(a.doc.sliceString(c-1,c)!=n||h.name=="JSXAttributeValue"&&h.to>c)){if(n==">"&&h.name=="JSXFragmentTag")return{range:l,changes:{from:c,insert:""}};if(n=="/"&&h.name=="JSXStartCloseTag"){let u=h.parent,d=u.parent;if(d&&u.from==c-2&&((p=lo(a.doc,d.firstChild,c))||((O=d.firstChild)===null||O===void 0?void 0:O.name)=="JSXFragmentTag")){let m=`${p}>`;return{range:Z.cursor(c+m.length,-1),changes:{from:c,insert:m}}}}else if(n==">"){let u=Dh(h);if(u&&u.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(a.doc.sliceString(c,c+2))&&(p=lo(a.doc,u,c)))return{range:l,changes:{from:c,insert:``}}}}return{range:l}});return o.changes.empty?!1:(t.dispatch([s,a.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var Zt=["_blank","_self","_top","_parent"],Kn=["ascii","utf-8","utf-16","latin1","latin1"],Jn=["get","post","put","delete"],ei=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],N=["true","false"],S={},Fh={a:{attrs:{href:null,ping:null,type:null,media:null,target:Zt,hreflang:null}},abbr:S,address:S,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:S,aside:S,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:S,base:{attrs:{href:null,target:Zt}},bdi:S,bdo:S,blockquote:{attrs:{cite:null}},body:S,br:S,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:ei,formmethod:Jn,formnovalidate:["novalidate"],formtarget:Zt,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:S,center:S,cite:S,code:S,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:S,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:S,div:S,dl:S,dt:S,em:S,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:S,figure:S,footer:S,form:{attrs:{action:null,name:null,"accept-charset":Kn,autocomplete:["on","off"],enctype:ei,method:Jn,novalidate:["novalidate"],target:Zt}},h1:S,h2:S,h3:S,h4:S,h5:S,h6:S,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:S,hgroup:S,hr:S,html:{attrs:{manifest:null}},i:S,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:ei,formmethod:Jn,formnovalidate:["novalidate"],formtarget:Zt,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:S,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:S,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:S,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:Kn,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:S,noscript:S,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:S,param:{attrs:{name:null,value:null}},pre:S,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:S,rt:S,ruby:S,samp:S,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:Kn}},section:S,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:S,source:{attrs:{src:null,type:null,media:null}},span:S,strong:S,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:S,summary:S,sup:S,table:S,tbody:S,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:S,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:S,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:S,time:{attrs:{datetime:null}},title:S,tr:S,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:S,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:S},So={accesskey:null,class:null,contenteditable:N,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:N,autocorrect:N,autocapitalize:N,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":N,"aria-autocomplete":["inline","list","both","none"],"aria-busy":N,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":N,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":N,"aria-hidden":N,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":N,"aria-multiselectable":N,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":N,"aria-relevant":null,"aria-required":N,"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},ko="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(t=>"on"+t);for(let t of ko)So[t]=null;var qe=class{constructor(e,r){this.tags={...Fh,...e},this.globalAttrs={...So,...r},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};qe.default=new qe;function Ae(t,e,r=t.length){if(!e)return"";let n=e.firstChild,i=n&&n.getChild("TagName");return i?t.sliceString(i.from,Math.min(i.to,r)):""}function rt(t,e=!1){for(;t;t=t.parent)if(t.name=="Element")if(e)e=!1;else return t;return null}function Po(t,e,r){let n=r.tags[Ae(t,rt(e))];return n?.children||r.allTags}function ti(t,e){let r=[];for(let n=rt(e);n&&!n.type.isTop;n=rt(n.parent)){let i=Ae(t,n);if(i&&n.lastChild.name=="CloseTag")break;i&&r.indexOf(i)<0&&(e.name=="EndTag"||e.from>=n.firstChild.to)&&r.push(i)}return r}var xo=/^[:\-\.\w\u00b7-\uffff]*$/;function Qo(t,e,r,n,i){let s=/\s*>/.test(t.sliceDoc(i,i+5))?"":">",a=rt(r,r.name=="StartTag"||r.name=="TagName");return{from:n,to:i,options:Po(t.doc,a,e).map(o=>({label:o,type:"type"})).concat(ti(t.doc,r).map((o,l)=>({label:"/"+o,apply:"/"+o+s,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function $o(t,e,r,n){let i=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:r,to:n,options:ti(t.doc,e).map((s,a)=>({label:s,apply:s+i,type:"type",boost:99-a})),validFor:xo}}function Hh(t,e,r,n){let i=[],s=0;for(let a of Po(t.doc,r,e))i.push({label:"<"+a,type:"type"});for(let a of ti(t.doc,r))i.push({label:"",type:"type",boost:99-s++});return{from:n,to:n,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Kh(t,e,r,n,i){let s=rt(r),a=s?e.tags[Ae(t.doc,s)]:null,o=a&&a.attrs?Object.keys(a.attrs):[],l=a&&a.globalAttrs===!1?o:o.length?o.concat(e.globalAttrNames):e.globalAttrNames;return{from:n,to:i,options:l.map(O=>({label:O,type:"property"})),validFor:xo}}function Jh(t,e,r,n,i){var s;let a=(s=r.parent)===null||s===void 0?void 0:s.getChild("AttributeName"),o=[],l;if(a){let O=t.sliceDoc(a.from,a.to),c=e.globalAttrs[O];if(!c){let h=rt(r),p=h?e.tags[Ae(t.doc,h)]:null;c=p?.attrs&&p.attrs[O]}if(c){let h=t.sliceDoc(n,i).toLowerCase(),p='"',u='"';/^['"]/.test(h)?(l=h[0]=='"'?/^[^"]*$/:/^[^']*$/,p="",u=t.sliceDoc(i,i+1)==h[0]?"":h[0],h=h.slice(1),n++):l=/^[^\s<>='"]*$/;for(let d of c)o.push({label:d,apply:p+d+u,type:"constant"})}}return{from:n,to:i,options:o,validFor:l}}function wo(t,e){let{state:r,pos:n}=e,i=R(r).resolveInner(n,-1),s=i.resolve(n);for(let a=n,o;s==i&&(o=i.childBefore(a));){let l=o.lastChild;if(!l||!l.type.isError||l.fromwo(n,i)}var tu=te.parser.configure({top:"SingleExpression"}),Zo=[{tag:"script",attrs:t=>t.type=="text/typescript"||t.lang=="ts",parser:Nn.parser},{tag:"script",attrs:t=>t.type=="text/babel"||t.type=="text/jsx",parser:Fn.parser},{tag:"script",attrs:t=>t.type=="text/typescript-jsx",parser:Hn.parser},{tag:"script",attrs(t){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(t.type)},parser:tu},{tag:"script",attrs(t){return!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type)},parser:te.parser},{tag:"style",attrs(t){return(!t.lang||t.lang=="css")&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type))},parser:wt.parser}],Xo=[{name:"style",parser:wt.parser.configure({top:"Styles"})}].concat(ko.map(t=>({name:t,parser:te.parser}))),vo=Ne.define({name:"html",parser:Ma.configure({props:[$e.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag"(t){return t.column(t.node.from)+t.unit},Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),Or=vo.configure({wrap:Mn(Zo,Xo)});function To(t={}){let e="",r;t.matchClosingTags===!1&&(e="noMatch"),t.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(r=Mn((t.nestedLanguages||[]).concat(Zo),(t.nestedAttributes||[]).concat(Xo)));let n=r?vo.configure({wrap:r,dialect:e}):e?Or.configure({dialect:e}):Or;return new ce(n,[Or.data.of({autocomplete:eu(t)}),t.autoCloseTags!==!1?nu:[],go().support,ro().support])}var bo=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" "));function ru(t,e,r){for(var n;;){if(((n=e.lastChild)===null||n===void 0?void 0:n.name)!="CloseTag")return!1;let i=e.parent;if(!i||Ae(t,i)!=r)return!0;e=i}}var nu=X.inputHandler.of((t,e,r,n,i)=>{if(t.composing||t.state.readOnly||e!=r||n!=">"&&n!="/"||!Or.isActiveAt(t.state,e,-1))return!1;let s=i(),{state:a}=s,o=a.changeByRange(l=>{var O;let c=a.doc.sliceString(l.from-1,l.to)==n,{head:h}=l,p=R(a).resolveInner(h,-1),u;if(c&&n==">"&&p.name=="EndTag"){let d=p.parent;if((u=Ae(a.doc,d.parent,h))&&!bo.has(u)&&!ru(a.doc,d.parent,u)){let m=h+(a.doc.sliceString(h,h+1)===">"?1:0),g=``;return{range:l,changes:{from:h,to:m,insert:g}}}}else if(c&&n=="/"&&p.name=="IncompleteCloseTag"){let d=p.parent;if(p.from==h-2&&((O=d.lastChild)===null||O===void 0?void 0:O.name)!="CloseTag"&&(u=Ae(a.doc,d,h))&&!bo.has(u)){let m=h+(a.doc.sliceString(h,h+1)===">"?1:0),g=`${u}>`;return{range:Z.cursor(h+g.length,-1),changes:{from:h,to:m,insert:g}}}}return{range:l}});return o.changes.empty?!1:(t.dispatch([s,a.update(o,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var _o=Vt({commentTokens:{block:{open:""}}}),Co=new K,Yo=ua.configure({props:[he.add(t=>!t.is("Block")||t.is("Document")||ii(t)!=null||iu(t)?void 0:(e,r)=>({from:r.doc.lineAt(e.from).to,to:e.to})),Co.add(ii),$e.add({Document:()=>null}),ss.add({Document:_o})]});function ii(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function iu(t){return t.name=="OrderedList"||t.name=="BulletList"}function su(t,e){let r=t;for(;;){let n=r.nextSibling,i;if(!n||(i=ii(n.type))!=null&&i<=e)break;r=n}return r.to}var au=cs.of((t,e,r)=>{for(let n=R(t).resolveInner(r,-1);n&&!(n.fromr)return{from:r,to:s}}return null});function si(t){return new as(_o,t,[],"markdown")}var ou=si(Yo),lu=Yo.configure([da,Qa,ga,$a,{props:[he.add({Table:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}]),nt=si(lu);function Ou(t,e){return r=>{if(r&&t){let n=null;if(r=/\S*/.exec(r)[0],typeof t=="function"?n=t(r):n=Lr.matchLanguageName(t,r,!0),n instanceof Lr)return n.support?n.support.language.parser:os.getSkippingParser(n.load());if(n)return n.parser}return e?e.parser:null}}var Xt=class{constructor(e,r,n,i,s,a,o){this.node=e,this.from=r,this.to=n,this.spaceBefore=i,this.spaceAfter=s,this.type=a,this.item=o}blank(e,r=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;n.length0;i--)n+=" ";return n+(r?this.spaceAfter:"")}}marker(e,r){let n=this.node.name=="OrderedList"?String(+qo(this.item,e)[2]+r):"";return this.spaceBefore+n+this.type+this.spaceAfter}};function zo(t,e){let r=[],n=[];for(let i=t;i;i=i.parent){if(i.name=="FencedCode")return n;(i.name=="ListItem"||i.name=="Blockquote")&&r.push(i)}for(let i=r.length-1;i>=0;i--){let s=r[i],a,o=e.lineAt(s.from),l=s.from-o.from;if(s.name=="Blockquote"&&(a=/^ *>( ?)/.exec(o.text.slice(l))))n.push(new Xt(s,l,l+a[0].length,"",a[1],">",null));else if(s.name=="ListItem"&&s.parent.name=="OrderedList"&&(a=/^( *)\d+([.)])( *)/.exec(o.text.slice(l)))){let O=a[3],c=a[0].length;O.length>=4&&(O=O.slice(0,O.length-4),c-=4),n.push(new Xt(s.parent,l,l+c,a[1],O,a[2],s))}else if(s.name=="ListItem"&&s.parent.name=="BulletList"&&(a=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(o.text.slice(l)))){let O=a[4],c=a[0].length;O.length>4&&(O=O.slice(0,O.length-4),c-=4);let h=a[2];a[3]&&(h+=a[3].replace(/[xX]/," ")),n.push(new Xt(s.parent,l,l+c,a[1],O,h,s))}}return n}function qo(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function ri(t,e,r,n=0){for(let i=-1,s=t;;){if(s.name=="ListItem"){let o=qo(s,e),l=+o[2];if(i>=0){if(l!=i+1)return;r.push({from:s.from+o[1].length,to:s.from+o[0].length,insert:String(i+2+n)})}i=l}let a=s.nextSibling;if(!a)break;s=a}}function ai(t,e){let r=/^[ \t]*/.exec(t)[0].length;if(!r||e.facet(Gt)!=" ")return t;let n=Be(t,4,r),i="";for(let s=n;s>0;)s>=4?(i+=" ",s-=4):(i+=" ",s--);return i+t.slice(r)}var cu=(t={})=>({state:e,dispatch:r})=>{let n=R(e),{doc:i}=e,s=null,a=e.changeByRange(o=>{if(!o.empty||!nt.isActiveAt(e,o.from,-1)&&!nt.isActiveAt(e,o.from,1))return s={range:o};let l=o.from,O=i.lineAt(l),c=zo(n.resolveInner(l,-1),i);for(;c.length&&c[c.length-1].from>l-O.from;)c.pop();if(!c.length)return s={range:o};let h=c[c.length-1];if(h.to-h.spaceAfter.length>l-O.from)return s={range:o};let p=l>=h.to-h.spaceAfter.length&&!/\S/.test(O.text.slice(h.to));if(h.item&&p){if(h.item.from]*$/.test(O.text.slice(0,h.to)))return s={range:o};let b=h.node.firstChild,Q=h.node.getChild("ListItem","ListItem");if(b.to>=l||Q&&Q.to0&&!/[^\s>]/.test(i.lineAt(O.from-1).text)||t.nonTightLists===!1){let k=c.length>1?c[c.length-2]:null,y,w="";k&&k.item?(y=O.from+k.from,w=k.marker(i,1)):y=O.from+(k?k.to:0);let _=[{from:y,to:l,insert:w}];return h.node.name=="OrderedList"&&ri(h.item,i,_,-2),k&&k.node.name=="OrderedList"&&ri(k.item,i,_),{range:Z.cursor(y+w.length),changes:_}}else{let k=jo(c,e,O);return{range:Z.cursor(l+k.length+1),changes:{from:O.from,insert:k+e.lineBreak}}}}if(h.node.name=="Blockquote"&&p&&O.from){let b=i.lineAt(O.from-1),Q=/>\s*$/.exec(b.text);if(Q&&Q.index==h.from){let k=e.changes([{from:b.from+Q.index,to:b.to},{from:O.from+h.from,to:O.to}]);return{range:o.map(k),changes:k}}}let u=[];h.node.name=="OrderedList"&&ri(h.item,i,u);let d=h.item&&h.item.from]*/.exec(O.text)[0].length>=h.to)for(let b=0,Q=c.length-1;b<=Q;b++)m+=b==Q&&!d?c[b].marker(i,1):c[b].blank(bO.from&&/\s/.test(O.text.charAt(g-O.from-1));)g--;return m=ai(m,e),uu(h.node,e.doc)&&(m=jo(c,e,O)+e.lineBreak+m),u.push({from:g,to:l,insert:e.lineBreak+m}),{range:Z.cursor(g+m.length+1),changes:u}});return s?!1:(r(e.update(a,{scrollIntoView:!0,userEvent:"input"})),!0)},hu=cu();function Ro(t){return t.name=="QuoteMark"||t.name=="ListMark"}function uu(t,e){if(t.name!="OrderedList"&&t.name!="BulletList")return!1;let r=t.firstChild,n=t.getChild("ListItem","ListItem");if(!n)return!1;let i=e.lineAt(r.to),s=e.lineAt(n.from),a=/^[\s>]*$/.test(i.text);return i.number+(a?0:1){let r=R(t),n=null,i=t.changeByRange(s=>{let a=s.from,{doc:o}=t;if(s.empty&&nt.isActiveAt(t,s.from)){let l=o.lineAt(a),O=zo(pu(r,a),o);if(O.length){let c=O[O.length-1],h=c.to-c.spaceAfter.length+(c.spaceAfter?1:0);if(a-l.from>h&&!/\S/.test(l.text.slice(h,a-l.from)))return{range:Z.cursor(l.from+h),changes:{from:l.from+h,to:a}};if(a-l.from==h&&(c.item&&l.from<=c.item.from||/^[\s>]*$/.test(l.text.slice(0,c.to)))){let p=l.from+c.from;if(c.item&&c.node.from{var r;let{main:n}=e.state.selection;if(n.empty)return!1;let i=(r=t.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!i||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(i)||(/^www\./.test(i)&&(i="https://"+i),!nt.isActiveAt(e.state,n.from,1)))return!1;let s=R(e.state),a=!1;return s.iterate({from:n.from,to:n.to,enter:o=>{(o.from>n.from||Qu.test(o.name))&&(a=!0)},leave:o=>{o.tot.normalize("NFKD"):t=>t,we=class{constructor(e,r,n=0,i=e.length,s,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,i),this.bufferStart=n,this.normalize=s?o=>s(Eo(o)):Eo,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return W(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let r=ht(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=J(e);let i=this.normalize(r);if(i.length)for(let s=0,a=n,o=!0;;s++){let l=i.charCodeAt(s),O=this.match(l,a,o,this.bufferPos+this.bufferStart,s==i.length-1);if(O)return this.value=O,this;if(s==i.length-1)break;o&&sthis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,i=n+r[0].length;if(this.matchPos=dr(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,i,r)))return this.value={from:n,to:i,precise:!0,match:r},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=n||i.to<=r){let o=new t(r,e.sliceString(r,n));return oi.set(e,o),o}if(i.from==r&&i.to==n)return i;let{text:s,from:a}=i;return a>r&&(s=e.sliceString(r,a)+s,a=r),i.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==e&&(this.re.lastIndex=e+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,i=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,i,r)))return this.value={from:n,to:i,precise:!0,match:r},this.matchPos=dr(this.text,i+(n==i?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=pr.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<"u"&&(ur.prototype[Symbol.iterator]=fr.prototype[Symbol.iterator]=function(){return this});function bu(t){try{return new RegExp(t,pi),!0}catch{return!1}}function dr(t,e){if(e>=t.length)return e;let r=t.lineAt(e),n;for(;e=56320&&n<57344;)e++;return e}var Su=t=>{let e=ns(t,"cm-goto-line");if(e){let a=e.dom.querySelector("input[type=text]");return a&&a.select(),!0}let{state:r}=t,n=String(r.doc.lineAt(t.state.selection.main.head).number),{close:i,result:s}=rs(t,{class:"cm-goto-line",label:r.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:r.phrase("go")});return s.then(a=>{let o=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!o){t.dispatch({effects:i});return}let l=r.doc.lineAt(r.selection.main.head),[,O,c,h,p]=o,u=h?+h.slice(1):0,d=c?+c:l.number;if(c&&p){let b=d/100;O&&(b=b*(O=="-"?-1:1)+l.number/r.doc.lines),d=Math.round(r.doc.lines*b)}else c&&O&&(d=d*(O=="-"?-1:1)+l.number);let m=r.doc.line(Math.max(1,Math.min(r.doc.lines,d))),g=Z.cursor(m.from+Math.max(0,Math.min(u,m.length)));t.dispatch({effects:[i,X.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},ku={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Vo=De.define({combine(t){return ut(t,ku,{highlightWordAroundCursor:(e,r)=>e||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function Go(t){let e=[Zu,yu];return t&&e.push(Vo.of(t)),e}var Pu=v.mark({class:"cm-selectionMatch"}),xu=v.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Wo(t,e,r,n){return(r==0||t(e.sliceDoc(r-1,r))!=A.Word)&&(n==e.doc.length||t(e.sliceDoc(n,n+1))!=A.Word)}function wu(t,e,r,n){return t(e.sliceDoc(r,r+1))==A.Word&&t(e.sliceDoc(n-1,n))==A.Word}var yu=ve.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Vo),{state:r}=t,n=r.selection;if(n.ranges.length>1)return v.none;let i=n.main,s,a=null;if(i.empty){if(!e.highlightWordAroundCursor)return v.none;let l=r.wordAt(i.head);if(!l)return v.none;a=r.charCategorizer(i.head),s=r.sliceDoc(l.from,l.to)}else{let l=i.to-i.from;if(l200)return v.none;if(e.wholeWords){if(s=r.sliceDoc(i.from,i.to),a=r.charCategorizer(i.head),!(Wo(a,r,i.from,i.to)&&wu(a,r,i.from,i.to)))return v.none}else if(s=r.sliceDoc(i.from,i.to),!s)return v.none}let o=[];for(let l of t.visibleRanges){let O=new we(r.doc,s,l.from,l.to);for(;!O.next().done;){let{from:c,to:h}=O.value;if((!a||Wo(a,r,c,h))&&(i.empty&&c<=i.from&&h>=i.to?o.push(xu.range(c,h)):(c>=i.to||h<=i.from)&&o.push(Pu.range(c,h)),o.length>e.maxMatches))return v.none}}return v.set(o)}},{decorations:t=>t.decorations}),Zu=X.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Xu=({state:t,dispatch:e})=>{let{selection:r}=t,n=Z.create(r.ranges.map(i=>t.wordAt(i.head)||Z.cursor(i.head)),r.mainIndex);return n.eq(r)?!1:(e(t.update({selection:n})),!0)};function vu(t,e){let{main:r,ranges:n}=t.selection,i=t.wordAt(r.head),s=i&&i.from==r.from&&i.to==r.to;for(let a=!1,o=new we(t.doc,e,n[n.length-1].to);;)if(o.next(),o.done){if(a)return null;o=new we(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),a=!0}else{if(a&&n.some(l=>l.from==o.value.from))continue;if(s){let l=t.wordAt(o.value.from);if(!l||l.from!=o.value.from||l.to!=o.value.to)continue}return o.value}}var Tu=({state:t,dispatch:e})=>{let{ranges:r}=t.selection;if(r.some(s=>s.from===s.to))return Xu({state:t,dispatch:e});let n=t.sliceDoc(r[0].from,r[0].to);if(t.selection.ranges.some(s=>t.sliceDoc(s.from,s.to)!=n))return!1;let i=vu(t,n);return i?(e(t.update({selection:t.selection.addRange(Z.range(i.from,i.to),!1),effects:X.scrollIntoView(i.to)})),!0):!1},Le=De.define({combine(t){return ut(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new hi(e),scrollToMatch:e=>X.scrollIntoView(e)})}});function Io(t){return t?[Le.of(t),ui]:ui}var mr=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||bu(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?` -`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Oi(this):new li(this)}getCursor(e,r=0,n){let i=e.doc?e:Qe.create({doc:e});return n==null&&(n=i.doc.length),this.regexp?st(this,i,r,n):it(this,i,r,n)}},gr=class{constructor(e){this.spec=e}};function Ru(t,e,r){return(n,i,s,a)=>{if(r&&!r(n,i,s,a))return!1;let o=n>=a&&i<=a+s.length?s.slice(n-a,i-a):e.doc.sliceString(n,i);return t(o,e,n,i)}}function it(t,e,r,n){let i;return t.wholeWord&&(i=ju(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(i=Ru(t.test,e,i)),new we(e.doc,t.unquoted,r,n,t.caseSensitive?void 0:s=>s.toLowerCase(),i)}function ju(t,e){return(r,n,i,s)=>((s>r||s+i.length=r)return null;i.push(n.value)}return i}highlight(e,r,n,i){let s=it(this.spec,e,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}};function _u(t,e,r){return(n,i,s)=>(!r||r(n,i,s))&&t(s[0],e,n,i)}function st(t,e,r,n){let i;return t.wholeWord&&(i=Cu(e.charCategorizer(e.selection.main.head))),t.test&&(i=_u(t.test,e,i)),new ur(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:i},r,n)}function Qr(t,e){return t.slice(_r(t,e,!1),e)}function $r(t,e){return t.slice(e,_r(t,e))}function Cu(t){return(e,r,n)=>!n[0].length||(t(Qr(n.input,n.index))!=A.Word||t($r(n.input,n.index))!=A.Word)&&(t($r(n.input,n.index+n[0].length))!=A.Word||t(Qr(n.input,n.index+n[0].length))!=A.Word)}var Oi=class extends gr{nextMatch(e,r,n){let i=st(this.spec,e,n,e.doc.length).next();return i.done&&(i=st(this.spec,e,0,r).next()),i.done?null:i.value}prevMatchInRange(e,r,n){for(let i=1;;i++){let s=Math.max(r,n-i*1e4),a=st(this.spec,e,s,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(s==r||o.from>s+10))return o;if(s==r)return null}}prevMatch(e,r,n){return this.prevMatchInRange(e,0,r)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let i=n.length;i>0;i--){let s=+n.slice(0,i);if(s>0&&s=r)return null;i.push(n.value)}return i}highlight(e,r,n,i){let s=st(this.spec,e,Math.max(0,r-250),Math.min(n+250,e.doc.length));for(;!s.next().done;)i(s.value.from,s.value.to)}},Tt=q.define(),fi=q.define(),xe=ie.define({create(t){return new vt(ci(t).create(),null)},update(t,e){for(let r of e.effects)r.is(Tt)?t=new vt(r.value.create(),t.panel):r.is(fi)&&(t=new vt(t.query,r.value?di:null));return t},provide:t=>ts.from(t,e=>e.panel)});var vt=class{constructor(e,r){this.query=e,this.panel=r}},Yu=v.mark({class:"cm-searchMatch"}),zu=v.mark({class:"cm-searchMatch cm-searchMatch-selected"}),qu=ve.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(xe))}update(t){let e=t.state.field(xe);(e!=t.startState.field(xe)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return v.none;let{view:r}=this,n=new Hi;for(let i=0,s=r.visibleRanges,a=s.length;is[i+1].from-500;)l=s[++i].to;t.highlight(r.state,o,l,(O,c)=>{let h=r.state.selection.ranges.some(p=>p.from==O&&p.to==c);n.add(O,c,h?zu:Yu)})}return n.finish()}},{decorations:t=>t.decorations});function Rt(t){return e=>{let r=e.state.field(xe,!1);return r&&r.query.spec.valid?t(e,r):No(e)}}var br=Rt((t,{query:e})=>{let{to:r}=t.state.selection.main,n=e.nextMatch(t.state,r,r);if(!n)return!1;let i=Z.single(n.from,n.to),s=t.state.facet(Le);return t.dispatch({selection:i,effects:[mi(t,n),s.scrollToMatch(i.main,t)],userEvent:"select.search"}),Bo(t),!0}),Sr=Rt((t,{query:e})=>{let{state:r}=t,{from:n}=r.selection.main,i=e.prevMatch(r,n,n);if(!i)return!1;let s=Z.single(i.from,i.to),a=t.state.facet(Le);return t.dispatch({selection:s,effects:[mi(t,i),a.scrollToMatch(s.main,t)],userEvent:"select.search"}),Bo(t),!0}),Au=Rt((t,{query:e})=>{let r=e.matchAll(t.state,1e3);return!r||!r.length?!1:(t.dispatch({selection:Z.create(r.map(n=>Z.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),Lu=({state:t,dispatch:e})=>{let r=t.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:i}=r.main,s=[],a=0;for(let o=new we(t.doc,t.sliceDoc(n,i));!o.next().done;){if(s.length>1e3)return!1;o.value.from==n&&(a=s.length),s.push(Z.range(o.value.from,o.value.to))}return e(t.update({selection:Z.create(s,a),userEvent:"select.search.matches"})),!0},Mo=Rt((t,{query:e})=>{let{state:r}=t,{from:n,to:i}=r.selection.main;if(r.readOnly)return!1;let s=e.nextMatch(r,n,n);if(!s)return!1;let a=s,o=[],l,O,c=[];a.precise?a.from==n&&a.to==i&&(O=r.toText(e.getReplacement(a)),o.push({from:a.from,to:a.to,insert:O}),a=e.nextMatch(r,a.from,a.to),c.push(X.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+"."))):a=e.nextMatch(r,a.from,a.to);let h=t.state.changes(o);return a&&(l=Z.single(a.from,a.to).map(h),c.push(mi(t,a)),c.push(r.facet(Le).scrollToMatch(l.main,t))),t.dispatch({changes:h,selection:l,effects:c,userEvent:"input.replace"}),!0}),Eu=Rt((t,{query:e})=>{if(t.state.readOnly)return!1;let r=[];for(let i of e.matchAll(t.state,1e9)){let{from:s,to:a,precise:o}=i;o&&r.push({from:s,to:a,insert:e.getReplacement(i)})}if(!r.length)return!1;let n=t.state.phrase("replaced $ matches",r.length)+".";return t.dispatch({changes:r,effects:X.announce.of(n),userEvent:"input.replace.all"}),!0});function di(t){return t.state.facet(Le).createPanel(t)}function ci(t,e){var r,n,i,s,a;let o=t.selection.main,l=o.empty||o.to>o.from+100?"":t.sliceDoc(o.from,o.to);if(e&&!l)return e;let O=t.facet(Le);return new mr({search:((r=e?.literal)!==null&&r!==void 0?r:O.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:O.caseSensitive,literal:(i=e?.literal)!==null&&i!==void 0?i:O.literal,regexp:(s=e?.regexp)!==null&&s!==void 0?s:O.regexp,wholeWord:(a=e?.wholeWord)!==null&&a!==void 0?a:O.wholeWord})}function Do(t){let e=qr(t,di);return e&&e.dom.querySelector("[main-field]")}function Bo(t){let e=Do(t);e&&e==t.root.activeElement&&e.select()}var No=t=>{let e=t.state.field(xe,!1);if(e&&e.panel){let r=Do(t);if(r&&r!=t.root.activeElement){let n=ci(t.state,e.query.spec);n.valid&&t.dispatch({effects:Tt.of(n)}),r.focus(),r.select()}}else t.dispatch({effects:[fi.of(!0),e?Tt.of(ci(t.state,e.query.spec)):q.appendConfig.of(ui)]});return!0},Fo=t=>{let e=t.state.field(xe,!1);if(!e||!e.panel)return!1;let r=qr(t,di);return r&&r.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:fi.of(!1)}),!0},Ho=[{key:"Mod-f",run:No,scope:"editor search-panel"},{key:"F3",run:br,shift:Sr,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:br,shift:Sr,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Fo,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Lu},{key:"Mod-Alt-g",run:Su},{key:"Mod-d",run:Tu,preventDefault:!0}],hi=class{constructor(e){this.view=e;let r=this.query=e.state.field(xe).query.spec;this.commit=this.commit.bind(this),this.searchField=I("input",{value:r.search,placeholder:F(e,"Find"),"aria-label":F(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=I("input",{value:r.replace,placeholder:F(e,"Replace"),"aria-label":F(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=I("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=I("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=I("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(i,s,a){return I("button",{class:"cm-button",name:i,onclick:s,type:"button"},a)}this.dom=I("div",{onkeydown:i=>this.keydown(i),class:"cm-search"},[this.searchField,n("next",()=>br(e),[F(e,"next")]),n("prev",()=>Sr(e),[F(e,"previous")]),n("select",()=>Au(e),[F(e,"all")]),I("label",null,[this.caseField,F(e,"match case")]),I("label",null,[this.reField,F(e,"regexp")]),I("label",null,[this.wordField,F(e,"by word")]),...e.state.readOnly?[]:[I("br"),this.replaceField,n("replace",()=>Mo(e),[F(e,"replace")]),n("replaceAll",()=>Eu(e),[F(e,"replace all")])],I("button",{name:"close",onclick:()=>Fo(e),"aria-label":F(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new mr({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Tt.of(e)}))}keydown(e){Ji(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Sr:br)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Mo(this.view))}update(e){for(let r of e.transactions)for(let n of r.effects)n.is(Tt)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Le).top}};function F(t,e){return t.state.phrase(e)}var cr=30,hr=/[\s\.,:;?!]/;function mi(t,{from:e,to:r}){let n=t.state.doc.lineAt(e),i=t.state.doc.lineAt(r).to,s=Math.max(n.from,e-cr),a=Math.min(i,r+cr),o=t.state.sliceDoc(s,a);if(s!=n.from){for(let l=0;lo.length-cr;l--)if(!hr.test(o[l-1])&&hr.test(o[l])){o=o.slice(0,l);break}}return X.announce.of(`${t.state.phrase("current match")}. ${o} ${t.state.phrase("on line")} ${n.number}.`)}var Wu=X.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),ui=[xe,ge.low(qu),Wu];function Ee(t,e){return typeof document<"u"&&document.documentElement.lang.toLowerCase().startsWith("zh")?t:e}function de(t,e,r=""){let n=t.state.changeByRange(i=>{let{from:s,to:a}=i,o=t.state.sliceDoc(s-e.length,s),l=t.state.sliceDoc(a,a+e.length);if(o===e&&l===e)return{changes:[{from:s-e.length,to:s,insert:""},{from:a,to:a+e.length,insert:""}],range:Z.range(s-e.length,a-e.length)};let O=t.state.sliceDoc(s,a)||r;return{changes:{from:s,to:a,insert:e+O+e},range:Z.range(s+e.length,s+e.length+O.length)}});return t.dispatch(n,{scrollIntoView:!0,userEvent:"input"}),t.focus(),!0}function V(t,e){let{state:r}=t,n=[],i=new Set;for(let a of r.selection.ranges)for(let o=r.doc.lineAt(a.from).number;o<=r.doc.lineAt(a.to).number;o++)i.add(o);let s=/^(\s*)(#{1,6}\s+|>\s?|[-*+]\s+\[[ xX]\]\s+|[-*+]\s+|\d+[.)]\s+)?/;for(let a of i){let o=r.doc.line(a),l=s.exec(o.text),O=l[1],c=l[2]??"",h=o.from+O.length,p=h+c.length;n.push({from:h,to:p,insert:c===e?"":e})}return t.dispatch({changes:n,scrollIntoView:!0,userEvent:"input"}),t.focus(),!0}function gi(t,e,r=!1){let{state:n}=t,i=n.selection.main,s=e;if(r){let a=n.doc.lineAt(i.from);i.from===a.from||(s=` -`+s);let l=n.doc.lineAt(i.to);(i.to!==l.to||l.number===n.doc.lines)&&(s+=` -`)}t.dispatch({changes:{from:i.from,to:i.to,insert:s},selection:{anchor:i.from+s.length},scrollIntoView:!0,userEvent:"input"}),t.focus()}function Qi(t){let e=t.state.selection.main,r=t.state.sliceDoc(e.from,e.to)||Ee("\u94FE\u63A5","link"),n=`[${r}](https://)`;return t.dispatch({changes:{from:e.from,to:e.to,insert:n},selection:Z.range(e.from+r.length+3,e.from+n.length-1),userEvent:"input"}),t.focus(),!0}function $i(t){let e=t.state.selection.main,r=t.state.sliceDoc(e.from,e.to);return t.dispatch({changes:{from:e.from,to:e.to,insert:`[[${r}]]`},selection:{anchor:e.from+2+r.length},userEvent:"input"}),t.focus(),!0}var Ko=null,Jo="",Mu=0,at=new Map;function Si(){return typeof document<"u"&&document.documentElement.dataset.theme==="dark"?"dark":"neutral"}async function Uu(){Ko??=import("./chunks/mermaid.core-3W6VKKIW.js").then(r=>r.default);let t=await Ko,e=Si();return Jo!==e&&(t.initialize({startOnLoad:!1,securityLevel:"strict",theme:e,fontFamily:"inherit"}),Jo=e),t}async function Vu(t){let e=Si()+` -`+t,r=at.get(e);if(r)return r;let n=await Uu(),i=`ivy-mermaid-${++Mu}`;try{let{svg:s}=await n.render(i,t);return at.size>64&&at.delete(at.keys().next().value),at.set(e,s),s}finally{document.getElementById("d"+i)?.remove(),document.getElementById(i)?.remove()}}function Gu(t,e){return t.classList.add("mermaid-diagram"),t.setAttribute("role","img"),t.setAttribute("aria-label","Mermaid"),Vu(e).then(n=>{t.innerHTML=n,t.classList.remove("mermaid-error")},n=>{t.classList.add("mermaid-error"),t.textContent="Mermaid: "+String(n?.message??n).split(` -`)[0]})}var bi=class extends ee{constructor(r){super();this.code=r}eq(r){return r.code===this.code}toDOM(){let r=document.createElement("div");r.className="cm-mermaid";let n=Si()+` -`+this.code,i=at.get(n);return i?(r.classList.add("mermaid-diagram"),r.innerHTML=i):(r.classList.add("cm-mermaid-loading"),Gu(r,this.code).finally(()=>r.classList.remove("cm-mermaid-loading"))),r}get estimatedHeight(){return 200}ignoreEvent(){return!1}};function Iu(t){let e=[];return R(t).iterate({enter(r){if(r.name!=="FencedCode")return;let n=r.node.getChild("CodeInfo");if(!n||t.sliceDoc(n.from,n.to).trim().toLowerCase()!=="mermaid")return!1;let i=r.node.getChild("CodeText");return e.push({from:r.from,to:r.to,code:i?t.sliceDoc(i.from,i.to):""}),!1}}),e}function ki(t,e,r){return t.selection.ranges.some(n=>n.from<=r&&n.to>=e)}var el=q.define();function tl(t,e){let r=[];for(let n of Iu(t)){if(e&&ki(t,n.from,n.to)||!n.code.trim())continue;let i=t.doc.lineAt(n.from).from,s=t.doc.lineAt(n.to).to;r.push(v.replace({widget:new bi(n.code),block:!0}).range(i,s))}return v.set(r,!0)}function rl(){return[ie.define({create:e=>({focused:!1,deco:tl(e,!1)}),update(e,r){let n=e.focused;for(let i of r.effects)i.is(el)&&(n=i.value);return n!==e.focused||r.docChanged||r.selection||R(r.startState)!==R(r.state)?{focused:n,deco:tl(r.state,n)}:e},provide:e=>X.decorations.from(e,r=>r.deco)}),X.focusChangeEffect.of((e,r)=>el.of(r)),X.domEventHandlers({mousedown(e,r){let n=e.target.closest(".cm-mermaid");if(!n)return!1;let i=r.posAtDOM(n),s=r.state.doc.lineAt(i);e.preventDefault();let a=s.number"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function nl(t){let e=t.trim();return e.startsWith("|")&&(e=e.slice(1)),e.endsWith("|")&&!e.endsWith("\\|")&&(e=e.slice(0,-1)),e.split(/(?r.trim().replace(/\\\|/g,"|"))}function Bu(t){let e=t.split(` -`).filter(i=>i.trim());if(e.length<2)return"";let r=nl(e[1]).map(i=>/^:-+:$/.test(i)?"center":/^-+:$/.test(i)?"right":""),n=(i,s)=>""+nl(i).map((a,o)=>`<${s}${r[o]?` style="text-align:${r[o]}"`:""}>${Du(a)}`).join("")+"";return`${n(e[0],"th")}${e.slice(2).map(i=>n(i,"td")).join("")}
`}var Pi=class extends ee{constructor(r,n){super();this.src=r;this.render=n}eq(r){return r.src===this.src}toDOM(){let r=document.createElement("div");return r.className="cm-table prose-ivy",r.innerHTML=this.render(this.src),r}ignoreEvent(){return!1}};function Nu(t){let e=[];return R(t).iterate({enter(r){if(r.name==="Table")return e.push({from:r.from,to:r.to}),!1;if(r.name==="FencedCode"||r.name==="CodeBlock")return!1}}),e}var il=q.define();function al(t,e,r){return t.selection.ranges.some(n=>n.from<=r&&n.to>=e)}function sl(t,e,r){let n=[];for(let i of Nu(t)){if(e&&al(t,i.from,i.to))continue;let s=t.doc.lineAt(i.from).from,a=t.doc.lineAt(i.to).to;n.push(v.replace({widget:new Pi(t.sliceDoc(s,a),r),block:!0}).range(s,a))}return v.set(n,!0)}function ol(t,e,r,n){return!(n&&al(t,e,r))}function ll(t){let e=n=>t.renderBlock?.(n)||Bu(n);return[ie.define({create:n=>({focused:!1,deco:sl(n,!1,e)}),update(n,i){let s=n.focused;for(let a of i.effects)a.is(il)&&(s=a.value);return s!==n.focused||i.docChanged||i.selection||R(i.startState)!==R(i.state)?{focused:s,deco:sl(i.state,s,e)}:n},provide:n=>X.decorations.from(n,i=>i.deco)}),X.focusChangeEffect.of((n,i)=>il.of(i)),X.domEventHandlers({mousedown(n,i){let s=n.target.closest(".cm-table");if(!s)return!1;let a=n.target.closest("a");if(n.preventDefault(),a?.dataset.note||a?.classList.contains("missing"))return t.openNote(a.dataset.note??"",a.dataset.title??a.textContent??"",n.button===1||n.shiftKey),!0;if(a?.href&&/^https?:/i.test(a.href))return window.open(a.href,"_blank","noopener"),!0;let o=i.posAtDOM(s),l=i.state.doc.lineAt(o),O=n.target.closest("tr"),c=[...s.querySelectorAll("tr")],h=O?c.indexOf(O):0;h>0&&h++;let p=i.state.doc.line(Math.min(l.number+Math.max(0,h),i.state.doc.lines));return i.dispatch({selection:{anchor:p.from+Math.min(2,p.length)}}),i.focus(),!0}})]}var Fu=/^ivy:\/\/res\/([A-Za-z0-9_-]{8,64})/,wi=class extends ee{constructor(r,n,i){super();this.src=r;this.alt=n;this.kind=i}eq(r){return r.src===this.src&&r.alt===this.alt&&r.kind===this.kind}toDOM(){let r=document.createElement("span");if(r.className="cm-media",this.kind==="video"||this.kind==="audio"){let n=document.createElement(this.kind);n.src=this.src,n.controls=!0,n.preload="metadata",r.appendChild(n)}else if(this.kind==="file"){let n=document.createElement("a");n.className="cm-file-card",n.href=this.src,n.target="_blank",n.rel="noopener",n.textContent="\u{1F4CE} "+(this.alt||"file"),r.appendChild(n)}else{let n=document.createElement("img");n.src=this.src,n.alt=this.alt,n.loading="lazy",n.onerror=()=>r.classList.add("cm-media-broken"),r.appendChild(n)}return r}ignoreEvent(){return!1}},yi=class extends ee{constructor(r,n){super();this.checked=r;this.pos=n}eq(r){return r.checked===this.checked&&r.pos===this.pos}toDOM(r){let n=document.createElement("input");return n.type="checkbox",n.className="cm-task",n.checked=this.checked,n.setAttribute("aria-label",this.checked?Ee("\u5DF2\u5B8C\u6210","Done"):Ee("\u5F85\u529E","To-do")),n.addEventListener("mousedown",i=>{i.preventDefault();let a=r.state.sliceDoc(this.pos,this.pos+3)==="[ ]"?"[x]":"[ ]";r.dispatch({changes:{from:this.pos,to:this.pos+3,insert:a}})}),n}ignoreEvent(){return!0}},Zi=class extends ee{toDOM(){let e=document.createElement("span");return e.className="cm-hr-widget",e}eq(){return!0}},Xi=class extends ee{toDOM(){let e=document.createElement("span");return e.className="cm-bullet",e.textContent="\u2022",e}eq(){return!0}},se=v.replace({}),xi=t=>v.line({class:t}),jt=t=>v.mark({class:t});function Hu(t){let e=new Set;for(let r of t.selection.ranges){let n=t.doc.lineAt(r.from).number,i=t.doc.lineAt(r.to).number;for(let s=n;s<=i;s++)e.add(s)}return e}function Ku(t,e,r){return t.selection.ranges.some(n=>n.from<=r&&n.to>=e)}var Ju=/\[\[([^[\]\n]+?)\]\]/g;function Ol(t,e,r){let{state:n}=t,i=[],s=r?Hu(n):new Set,a=c=>s.has(n.doc.lineAt(c).number),o=(c,h)=>r&&Ku(n,c,h),l=[];for(let{from:c,to:h}of t.visibleRanges){R(n).iterate({from:c,to:h,enter(u){let d=u.name,m=/^ATXHeading(\d)$/.exec(d);if(m){let g=n.doc.lineAt(u.from);if(i.push(xi(`cm-h cm-h${m[1]}`).range(g.from)),!a(u.from)){let b=u.node.getChild("HeaderMark");b&&i.push(se.range(b.from,Math.min(b.to+1,g.to)))}return}switch(d){case"Table":return ol(n,u.from,u.to,r)?!1:void 0;case"FencedCode":case"CodeBlock":{l.push([u.from,u.to]);let g=u.node.getChild("CodeInfo"),b=u.node.getChild("CodeText");if(g&&b&&n.sliceDoc(g.from,g.to).trim().toLowerCase()==="mermaid"&&n.sliceDoc(b.from,b.to).trim()&&!(r&&ki(n,u.from,u.to)))return!1;let Q=n.doc.lineAt(u.from).number,k=n.doc.lineAt(u.to).number;if(d==="FencedCode"&&!o(u.from,u.to)){let y=n.doc.line(Q),w=n.doc.line(k);y.to>y.from&&i.push(se.range(y.from,y.to)),k!==Q&&w.to>w.from&&/^\s*(```|~~~)/.test(w.text)&&i.push(se.range(w.from,w.to))}for(let y=Q;y<=k;y++){let w=n.doc.line(y),_="cm-codeblock";y===Q&&(_+=" cm-codeblock-first"),y===k&&(_+=" cm-codeblock-last"),i.push(xi(_).range(w.from))}return!1}case"StrongEmphasis":case"Emphasis":case"Strikethrough":case"InlineCode":{let g=d==="StrongEmphasis"?"cm-strong":d==="Emphasis"?"cm-em":d==="Strikethrough"?"cm-strike":"cm-inline-code";if(i.push(jt(g).range(u.from,u.to)),!o(u.from,u.to)){let b=d==="InlineCode"?"CodeMark":d==="Strikethrough"?"StrikethroughMark":"EmphasisMark",Q=u.node.firstChild;for(;Q;)Q.name===b&&i.push(se.range(Q.from,Q.to)),Q=Q.nextSibling}return d!=="InlineCode"}case"Link":{if(o(u.from,u.to))return;let g=u.node.getChildren("LinkMark"),b=u.node.getChild("URL");return g.length>=2&&(i.push(se.range(g[0].from,g[0].to)),i.push(jt("cm-link").range(g[0].to,g[1].from)),i.push(se.range(g[1].from,u.to))),!1}case"Image":{let g=u.node.getChild("URL");if(!g)return!1;let b=n.sliceDoc(g.from,g.to),Q=Fu.exec(b),k=Q?e.resolveResource(Q[1]):b,y=Q?e.resourceKind(Q[1]):void 0,w=u.node.getChildren("LinkMark"),_=w.length>=2?n.sliceDoc(w[0].to,w[1].from):"";if(!k||/^javascript:/i.test(k))return!1;let G=new wi(k,_,y);return a(u.from)?i.push(v.widget({widget:G,side:1}).range(u.to)):i.push(v.replace({widget:G}).range(u.from,u.to)),!1}case"Blockquote":{let g=n.doc.lineAt(u.from).number,b=n.doc.lineAt(u.to).number;for(let Q=g;Q<=b;Q++)i.push(xi("cm-quote").range(n.doc.line(Q).from));return}case"QuoteMark":{if(!a(u.from)){let g=n.sliceDoc(u.to,u.to+1)===" "?u.to+1:u.to;i.push(se.range(u.from,g))}return}case"HorizontalRule":{a(u.from)||i.push(v.replace({widget:new Zi}).range(u.from,u.to));return}case"ListMark":{let g=n.sliceDoc(u.from,u.to),b=g==="-"||g==="*"||g==="+",Q=n.sliceDoc(u.to,u.to+4),k=/^ \[[ xX]\]/.test(Q);b&&!a(u.from)?k?i.push(se.range(u.from,u.to+1)):i.push(v.replace({widget:new Xi}).range(u.from,u.to)):i.push(jt("cm-list-mark").range(u.from,u.to));return}case"TaskMarker":{let g=/x/i.test(n.sliceDoc(u.from,u.to));if(!o(u.from,u.to)&&(i.push(v.replace({widget:new yi(g,u.from)}).range(u.from,u.to)),g)){let b=n.doc.lineAt(u.from);u.to+1d>=w&&m<=_))continue;let g=u[1],b=g.indexOf("|"),Q=(b>=0?g.slice(0,b):g).split("#")[0].trim(),k=!!e.resolveTitle(Q),y={"data-wiki":Q};if(o(d,m)){i.push(v.mark({class:"cm-wikilink cm-wikilink-src"+(k?"":" cm-wikilink-missing"),attributes:y}).range(d,m));continue}i.push(se.range(d,d+2+(b>=0?b+1:0))),i.push(v.mark({class:"cm-wikilink cm-wikilink-rendered"+(k?"":" cm-wikilink-missing"),attributes:y}).range(d+2+(b>=0?b+1:0),m-2)),i.push(se.range(m-2,m))}}let O=i.filter(c=>c.value.point===!0);return{all:v.set(i,!0),atomic:v.set(O,!0)}}function cl(t){let e=ve.fromClass(class{decorations;atomic;constructor(r){let n=Ol(r,t,r.hasFocus);this.decorations=n.all,this.atomic=n.atomic}update(r){if(r.docChanged||r.viewportChanged||r.selectionSet||r.focusChanged||R(r.startState)!==R(r.state)){let n=Ol(r.view,t,r.view.hasFocus);this.decorations=n.all,this.atomic=n.atomic}}},{decorations:r=>r.decorations,eventHandlers:{mousedown(r,n){let i=r.target.closest(".cm-wikilink");if(!i)return!1;let s=i.classList.contains("cm-wikilink-rendered"),a=r.button===1||r.shiftKey;if(r.button>1||!s&&!(r.metaKey||r.ctrlKey||r.button===1))return!1;let o=i.dataset.wiki??"";return r.preventDefault(),t.openNote(t.resolveTitle(o),o,a),!0},click(r){let n=r.target.closest(".cm-link, .cm-file-card");return n&&(r.metaKey||r.ctrlKey)&&n instanceof HTMLAnchorElement?(window.open(n.href,"_blank","noopener"),!0):!1}}});return[e,rl(),ll(t),X.atomicRanges.of(r=>r.plugin(e)?.atomic??v.none)]}var hl=X.theme({"&":{color:"rgb(var(--ink))",backgroundColor:"transparent",height:"100%"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"inherit",lineHeight:"1.85",overflow:"visible"},".cm-content":{padding:"0 0 40vh",caretColor:"rgb(var(--ivy))"},".cm-line":{padding:"0"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"rgb(var(--ivy))",borderLeftWidth:"2px"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:"rgb(var(--ivy) / 0.2) !important"},".cm-placeholder":{color:"rgb(var(--faint))"},".cm-tooltip":{border:"none",backgroundColor:"rgb(var(--surface))",borderRadius:"14px",boxShadow:"var(--shadow-lift)",overflow:"hidden"},".cm-tooltip-autocomplete > ul":{fontFamily:"inherit",maxHeight:"260px",padding:"4px"},".cm-tooltip-autocomplete > ul > li":{padding:"7px 10px",borderRadius:"10px",lineHeight:"1.4"},".cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:"rgb(var(--sunken))",color:"rgb(var(--ink))"},".cm-completionDetail":{marginLeft:"8px",color:"rgb(var(--muted))",fontStyle:"normal",fontSize:"12px"},".cm-completionIcon":{display:"none"},".cm-panels":{backgroundColor:"rgb(var(--surface))",color:"rgb(var(--ink))",border:"none"},".cm-searchMatch":{backgroundColor:"rgb(var(--warn) / 0.3)"},".cm-searchMatch-selected":{backgroundColor:"rgb(var(--warn) / 0.55)"}}),ul=us(hs.define([{tag:f.heading,fontWeight:"600"},{tag:f.strong,fontWeight:"600"},{tag:f.emphasis,fontStyle:"italic"},{tag:f.strikethrough,textDecoration:"line-through"},{tag:f.link,color:"rgb(var(--ivy))"},{tag:f.url,color:"rgb(var(--ivy))"},{tag:f.monospace,fontFamily:"var(--font-mono)",color:"rgb(var(--warn-ink))"},{tag:f.quote,color:"rgb(var(--ink-2))"},{tag:[f.processingInstruction,f.contentSeparator,f.meta],color:"rgb(var(--faint))"},{tag:f.labelName,color:"rgb(var(--muted))"}]));function pl(t){return e=>{let r=e.matchBefore(/\[\[[^\]\n|#]*$/);if(!r)return null;let n=r.text.slice(2).toLowerCase(),i=e.state.sliceDoc(e.pos,e.pos+2),s=[],a=new Set;for(let o of t())if(!(!o.title||a.has(o.title))&&(a.add(o.title),!(n&&!o.title.toLowerCase().includes(n))&&(s.push({label:o.title,detail:o.detail,type:"text",boost:o.title.toLowerCase().startsWith(n)?1:0,apply:(l,O,c,h)=>{let p=i==="]]"?"":"]]";l.dispatch({changes:{from:c,to:h,insert:O.label+p},selection:{anchor:c+O.label.length+2}})}}),s.length>=50)))break;if(n&&!a.has(r.text.slice(2))){let o=r.text.slice(2);s.push({label:o,detail:Ee("\u65B0\u5EFA\u94FE\u63A5","New link"),type:"keyword",boost:-1,apply:(l,O,c,h)=>l.dispatch({changes:{from:c,to:h,insert:o+(i==="]]"?"":"]]")},selection:{anchor:c+o.length+2}})})}return{from:r.from+2,options:s,validFor:/^[^\]\n|#]*$/}}}function kr(t){return t.trim().replace(/\s+/g," ").toLowerCase()}function fl(t){let e=t,r,n,i=e.indexOf("|");i>=0&&(r=e.slice(i+1).trim(),e=e.slice(0,i));let s=e.indexOf("#");return s>=0&&(n=e.slice(s+1).trim(),e=e.slice(0,s)),{target:e.trim(),alias:r,heading:n}}function ji(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Ve=ji();function wl(t){Ve=t}var Me={exec:()=>null};function We(t){let e=[];return r=>{let n=Math.max(0,Math.min(3,r-1)),i=e[n];return i||(i=t(n),e[n]=i),i}}function x(t,e=""){let r=typeof t=="string"?t:t.source,n={replace:(i,s)=>{let a=typeof s=="string"?s:s.source;return a=a.replace(C.caret,"$1"),r=r.replace(i,a),n},getRegex:()=>new RegExp(r,e)};return n}var yl=((t="")=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+)[ \t]*)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\][ \t]+\S/,listReplaceTask:/^\[[ xX]\][ \t]+/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:We(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:We(t=>new RegExp(`^ {0,${t}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:We(t=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:We(t=>new RegExp(`^ {0,${t}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:We(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:We(t=>new RegExp(`^ {0,${t}}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|new RegExp(`^ {0,${t}}>`))},ep=/^(?:[ \t]*(?:\n|$))+/,tp=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,rp=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\n|$)|$)/,Yt=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,np=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_i=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Zl=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/,Xl=x(Zl).replace(/bull/g,_i).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),ip=x(Zl).replace(/bull/g,_i).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Ci=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,sp=/^[^\n]+/,Yi=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/,ap=x(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Yi).replace("title",/(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex(),op=x(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,_i).getRegex(),zt="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",zi=/|$))/,lp=x("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|[^\\n]*\\n*|$)|[^\\n]*\\n*|$)||$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",zi).replace("tag",zt).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),vl=t=>x(Ci).replace("hr",Yt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",t).replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?| ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace("paragraph",cp).getRegex(),qi={blockquote:hp,code:tp,def:ap,fences:rp,heading:np,hr:Yt,html:lp,lheading:Xl,list:op,newline:ep,paragraph:Op,table:Me,text:sp},dl=x("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Yt).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|(?: *\\n{2,}|\\s*$)|\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace("comment",zi).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Me,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:x(Ci).replace("hr",Yt).replace("heading",` *#{1,6} *[^ -]`).replace("lheading",Xl).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},fp=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,dp=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Tl=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,mp=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",yl?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),jl=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,kp=x(jl,"u").replace(/punct/g,ae).getRegex(),Pp=x(jl,"u").replace(/punct/g,Rl).getRegex(),xp=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,wp=x(xp,"u").replace(/openQuote/g,Qp).replace(/punct/g,ae).getRegex(),_l="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",yp=x(_l,"gu").replace(/notPunctSpace/g,qt).replace(/punctSpace/g,Ot).replace(/punct/g,ae).getRegex(),Zp=x(_l,"gu").replace(/notPunctSpace/g,bp).replace(/punctSpace/g,$p).replace(/punct/g,Rl).getRegex(),Xp="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",vp=x(Xp,"gu").replace(/notPunctSpace/g,qt).replace(/punctSpace/g,Ot).replace(/punct/g,ae).getRegex(),Tp=x("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,qt).replace(/punctSpace/g,Ot).replace(/punct/g,ae).getRegex(),Rp="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",jp=x(Rp,"gu").replace(/notPunctSpace/g,qt).replace(/punctSpace/g,Ot).replace(/punct/g,ae).getRegex(),_p=x(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ae).getRegex(),Cp="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Yp=x(Cp,"gu").replace(/notPunctSpace/g,qt).replace(/punctSpace/g,Ot).replace(/punct/g,ae).getRegex(),zp=x(/\\(punct)/,"gu").replace(/punct/g,ae).getRegex(),qp=x(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,ae).getRegex(),Ap=x(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Lp=x(zi).replace("(?:-->|$)","-->").getRegex(),Ep=x("^comment|^|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",Lp).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Cl=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,wr=x(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",Cl).getRegex(),Wp=x(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",wr).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex(),Mp=x(/^!?\[(label)\]\[(ref)\]/).replace("label",wr).replace("ref",Yi).getRegex(),Up=x(/^!?\[(ref)\](?:\[\])?/).replace("ref",Yi).getRegex(),ml=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Vp=x(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",Cl).getRegex(),Gp=x("reflink|nolink(?!\\()","g").replace("reflink",x(/^!?\[(label)\]\[(ref)\]/).replace("label",Vp).replace("ref",ml).getRegex()).replace("nolink",x(/^!?\[(ref)\](?:\[\])?/).replace("ref",ml).getRegex()).getRegex(),gl=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ip=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,Dp=x(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,Ip).getRegex(),Ai={_backpedal:Me,anyPunctuation:zp,anyPunctuationOutsideCode:qp,autolink:Ap,blockSkip:Sp,br:Tl,code:dp,del:Me,delLDelim:Me,delRDelim:Me,emStrongLDelim:kp,emStrongRDelimAst:yp,emStrongRDelimUnd:Tp,escape:fp,link:Wp,nolink:Up,punctuation:gp,reflink:Mp,reflinkSearch:Gp,tag:Ep,text:mp,url:Me},Bp={...Ai,emStrongLDelim:wp,emStrongRDelimAst:vp,emStrongRDelimUnd:jp,link:x(/^!?\[(label)\]\((.*?)\)/).replace("label",wr).getRegex(),reflink:x(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",wr).getRegex()},vi={...Ai,emStrongRDelimAst:Zp,emStrongLDelim:Pp,delLDelim:_p,delRDelim:Yp,url:x(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",Dp).replace("protocol",gl).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:x(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},Ql=t=>Fp[t];function H(t,e){if(e){if(C.escapeTest.test(t))return t.replace(C.escapeReplace,Ql)}else if(C.escapeTestNoEncode.test(t))return t.replace(C.escapeReplaceNoEncode,Ql);return t}function Hp(t){return C.numericCharacterReference.test(t)?t.replace(C.numericCharacterReferenceOrAmpersand,(e,r,n)=>{if(r===void 0&&n===void 0)return"&";let i=r===void 0?Number.parseInt(n,16):Number.parseInt(r,10);return i===0||i>1114111||i>=55296&&i<=57343?"\uFFFD":i===38?"&":String.fromCodePoint(i)}):t}function $l(t){try{t=encodeURI(t).replace(C.percentDecode,"%")}catch{return null}return t}function bl(t,e){let r=t.replace(C.findPipe,(s,a,o)=>{let l=!1,O=a;for(;--O>=0&&o[O]==="\\";)l=!l;return l?"|":" |"}),n=r.split(C.splitPipe),i=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length=0&&C.blankLine.test(e[r]);)r--;return e.length-r<=2?t:e.slice(0,r+1).join(` -`)}function yr(t){return t.trim().replace(C.multipleSpaceGlobal," ").toLowerCase().toUpperCase().toLowerCase()}function kl(t,e){if(t.indexOf(e[0])===-1&&t.indexOf(e[1])===-1)return-1;let r=0;for(let n=0;n0?-2:-1}var lt=new WeakMap;function Li(t){let e={"*":-1,_:-1},r=-1,n=t.length;for(let i=0;i{let a=s.match(r.other.beginningSpace);if(a===null)return s;let[o]=a;return s.slice(Math.min(o.length,i.length))}).join(` -`)}function xl(t,e,r,n){if(!e.includes("<"))return!1;for(let i=0;ie.length-i)return!0;i+=a[0].length-1}}return!1}var ot=class{options;rules;lexer;constructor(t){this.options=t||Ve}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let r=this.options.pedantic?e[0]:Sl(e[0]),n=r.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:r,codeBlockStyle:"indented",text:n}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let r=e[0],n=rf(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){let n=me(r,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceTabChar.test(n))&&(r=n.trim())}return{type:"heading",raw:me(e[0],` -`),depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:me(e[0],` -`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let r=me(e[0],` +}`,{label:"class",detail:"definition",type:"keyword"}),fe('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),fe('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],np=bc.concat([fe("interface ${name} {\n ${}\n}",{label:"interface",detail:"definition",type:"keyword"}),fe("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),fe("enum ${name} {\n ${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),pc=new Jr,Qc=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function Pr(t){return(e,r)=>{let n=e.node.getChild("VariableDefinition");return n&&r(n,t),!0}}var sp=["FunctionDeclaration"],ip={FunctionDeclaration:Pr("function"),ClassDeclaration:Pr("class"),ClassExpression:()=>!0,EnumDeclaration:Pr("constant"),TypeAliasDeclaration:Pr("type"),NamespaceDeclaration:Pr("namespace"),VariableDefinition(t,e){t.matchContext(sp)||e(t,"variable")},TypeDefinition(t,e){e(t,"type")},__proto__:null};function xc(t,e){let r=pc.get(e);if(r)return r;let n=[],s=!0;function i(o,a){let l=t.sliceString(o.from,o.to);n.push({label:l,type:a})}return e.cursor(Ue.IncludeAnonymous).iterate(o=>{if(s)s=!1;else if(o.name){let a=ip[o.name];if(a&&a(o,i)||Qc.has(o.name))return!1}else if(o.to-o.from>8192){for(let a of xc(t,o.node))n.push(a);return!1}}),pc.set(e,n),n}var mc=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,$c=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName","JSXText","JSXAttributeValue","JSXOpenTag","JSXCloseTag","JSXSelfClosingTag",".","?."];function op(t){let e=U(t.state).resolveInner(t.pos,-1);if($c.indexOf(e.name)>-1)return null;let r=e.name=="VariableName"||e.to-e.from<20&&mc.test(t.state.sliceDoc(e.from,e.to));if(!r&&!t.explicit)return null;let n=[];for(let s=e;s;s=s.parent)Qc.has(s.name)&&(n=n.concat(xc(t.state.doc,s)));return{options:n,from:r?e.from:t.pos,validFor:mc}}var Ee=qt.define({name:"javascript",parser:dc.configure({props:[rt.add({IfStatement:zt({except:/^\s*({|else\b)/}),TryStatement:zt({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:ba,SwitchBody:t=>{let e=t.textAfter,r=/^\s*\}/.test(e),n=/^\s*(case|default)\b/.test(e);return t.baseIndent+(r?0:n?1:2)*t.unit},Block:ga({closing:"}"}),ArrowFunction:t=>t.baseIndent+t.unit,"TemplateString BlockComment":()=>null,"Statement Property":zt({except:/^\s*{/}),JSXElement(t){let e=/^\s*<\//.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},JSXEscape(t){let e=/\s*\}/.test(t.textAfter);return t.lineIndent(t.node.from)+(e?0:t.unit)},"JSXOpenTag JSXSelfClosingTag"(t){return t.column(t.node.from)+t.unit}}),Ie.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":sn,BlockComment(t){return{from:t.from+2,to:t.to-2}},JSXElement(t){let e=t.firstChild;if(!e||e.name=="JSXSelfClosingTag")return null;let r=t.lastChild;return{from:e.to,to:r.type.isError?t.to:r.from}},"JSXSelfClosingTag JSXOpenTag"(t){var e;let r=(e=t.firstChild)===null||e===void 0?void 0:e.nextSibling,n=t.lastChild;return!r||r.type.isError?null:{from:r.to,to:n.type.isError?t.to:n.from}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),kc={test:t=>/^JSX/.test(t.name),facet:rn({commentTokens:{block:{open:"{/*",close:"*/}"}}})},Xi=Ee.configure({dialect:"ts"},"typescript"),Ti=Ee.configure({dialect:"jsx",props:[Qs.add(t=>t.isTop?[kc]:void 0)]}),Ri=Ee.configure({dialect:"jsx ts",props:[Qs.add(t=>t.isTop?[kc]:void 0)]},"typescript"),Sc=t=>({label:t,type:"keyword"}),yc="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(Sc),ap=yc.concat(["declare","implements","private","protected","public"].map(Sc));function Pc(t={}){let e=t.jsx?t.typescript?Ri:Ti:t.typescript?Xi:Ee,r=t.typescript?np.concat(ap):bc.concat(yc);return new Ve(e,[Ee.data.of({autocomplete:Ca($c,Es(r))}),Ee.data.of({autocomplete:op}),t.jsx?Op:[]])}function lp(t){for(;;){if(t.name=="JSXOpenTag"||t.name=="JSXSelfClosingTag"||t.name=="JSXFragmentTag")return t;if(t.name=="JSXEscape"||!t.parent)return null;t=t.parent}}function gc(t,e,r=t.length){for(let n=e?.firstChild;n;n=n.nextSibling)if(n.name=="JSXIdentifier"||n.name=="JSXBuiltin"||n.name=="JSXNamespacedName"||n.name=="JSXMemberExpression")return t.sliceString(n.from,Math.min(n.to,r));return""}var cp=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),Op=_.inputHandler.of((t,e,r,n,s)=>{if((cp?t.composing:t.compositionStarted)||t.state.readOnly||e!=r||n!=">"&&n!="/"||!Ee.isActiveAt(t.state,e,-1))return!1;let i=s(),{state:o}=i,a=o.changeByRange(l=>{var c;let{head:O}=l,u=U(o).resolveInner(O-1,-1),h;if(u.name=="JSXStartTag"&&(u=u.parent),!(o.doc.sliceString(O-1,O)!=n||u.name=="JSXAttributeValue"&&u.to>O)){if(n==">"&&u.name=="JSXFragmentTag")return{range:l,changes:{from:O,insert:""}};if(n=="/"&&u.name=="JSXStartCloseTag"){let f=u.parent,p=f.parent;if(p&&f.from==O-2&&((h=gc(o.doc,p.firstChild,O))||((c=p.firstChild)===null||c===void 0?void 0:c.name)=="JSXFragmentTag")){let d=`${h}>`;return{range:z.cursor(O+d.length,-1),changes:{from:O,insert:d}}}}else if(n==">"){let f=lp(u);if(f&&f.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(o.doc.sliceString(O,O+2))&&(h=gc(o.doc,f,O)))return{range:l,changes:{from:O,insert:``}}}}return{range:l}});return a.changes.empty?!1:(t.dispatch([i,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var wr=["_blank","_self","_top","_parent"],ji=["ascii","utf-8","utf-16","latin1","latin1"],Ei=["get","post","put","delete"],_i=["application/x-www-form-urlencoded","multipart/form-data","text/plain"],ye=["true","false"],Z={},up={a:{attrs:{href:null,ping:null,type:null,media:null,target:wr,hreflang:null}},abbr:Z,address:Z,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:Z,aside:Z,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:Z,base:{attrs:{href:null,target:wr}},bdi:Z,bdo:Z,blockquote:{attrs:{cite:null}},body:Z,br:Z,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:_i,formmethod:Ei,formnovalidate:["novalidate"],formtarget:wr,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:Z,center:Z,cite:Z,code:Z,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:Z,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:Z,div:Z,dl:Z,dt:Z,em:Z,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:Z,figure:Z,footer:Z,form:{attrs:{action:null,name:null,"accept-charset":ji,autocomplete:["on","off"],enctype:_i,method:Ei,novalidate:["novalidate"],target:wr}},h1:Z,h2:Z,h3:Z,h4:Z,h5:Z,h6:Z,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:Z,hgroup:Z,hr:Z,html:{attrs:{manifest:null}},i:Z,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:_i,formmethod:Ei,formnovalidate:["novalidate"],formtarget:wr,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:Z,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:Z,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:Z,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:ji,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:Z,noscript:Z,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:Z,param:{attrs:{name:null,value:null}},pre:Z,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:Z,rt:Z,ruby:Z,samp:Z,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:ji}},section:Z,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:Z,source:{attrs:{src:null,type:null,media:null}},span:Z,strong:Z,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:Z,summary:Z,sup:Z,table:Z,tbody:Z,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:Z,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:Z,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:Z,time:{attrs:{datetime:null}},title:Z,tr:Z,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:Z,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:Z},Xc={accesskey:null,class:null,contenteditable:ye,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:ye,autocorrect:ye,autocapitalize:ye,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":ye,"aria-autocomplete":["inline","list","both","none"],"aria-busy":ye,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":ye,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":ye,"aria-hidden":ye,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":ye,"aria-multiselectable":ye,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":ye,"aria-relevant":null,"aria-required":ye,"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},Tc="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(t=>"on"+t);for(let t of Tc)Xc[t]=null;var kt=class{constructor(e,r){this.tags={...up,...e},this.globalAttrs={...Xc,...r},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};kt.default=new kt;function St(t,e,r=t.length){if(!e)return"";let n=e.firstChild,s=n&&n.getChild("TagName");return s?t.sliceString(s.from,Math.min(s.to,r)):""}function Dt(t,e=!1){for(;t;t=t.parent)if(t.name=="Element")if(e)e=!1;else return t;return null}function Rc(t,e,r){let n=r.tags[St(t,Dt(e))];return n?.children||r.allTags}function Ci(t,e){let r=[];for(let n=Dt(e);n&&!n.type.isTop;n=Dt(n.parent)){let s=St(t,n);if(s&&n.lastChild.name=="CloseTag")break;s&&r.indexOf(s)<0&&(e.name=="EndTag"||e.from>=n.firstChild.to)&&r.push(s)}return r}var jc=/^[:\-\.\w\u00b7-\uffff]*$/;function wc(t,e,r,n,s){let i=/\s*>/.test(t.sliceDoc(s,s+5))?"":">",o=Dt(r,r.name=="StartTag"||r.name=="TagName");return{from:n,to:s,options:Rc(t.doc,o,e).map(a=>({label:a,type:"type"})).concat(Ci(t.doc,r).map((a,l)=>({label:"/"+a,apply:"/"+a+i,type:"type",boost:99-l}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function vc(t,e,r,n){let s=/\s*>/.test(t.sliceDoc(n,n+5))?"":">";return{from:r,to:n,options:Ci(t.doc,e).map((i,o)=>({label:i,apply:i+s,type:"type",boost:99-o})),validFor:jc}}function hp(t,e,r,n){let s=[],i=0;for(let o of Rc(t.doc,r,e))s.push({label:"<"+o,type:"type"});for(let o of Ci(t.doc,r))s.push({label:"",type:"type",boost:99-i++});return{from:n,to:n,options:s,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function fp(t,e,r,n,s){let i=Dt(r),o=i?e.tags[St(t.doc,i)]:null,a=o&&o.attrs?Object.keys(o.attrs):[],l=o&&o.globalAttrs===!1?a:a.length?a.concat(e.globalAttrNames):e.globalAttrNames;return{from:n,to:s,options:l.map(c=>({label:c,type:"property"})),validFor:jc}}function dp(t,e,r,n,s){var i;let o=(i=r.parent)===null||i===void 0?void 0:i.getChild("AttributeName"),a=[],l;if(o){let c=t.sliceDoc(o.from,o.to),O=e.globalAttrs[c];if(!O){let u=Dt(r),h=u?e.tags[St(t.doc,u)]:null;O=h?.attrs&&h.attrs[c]}if(O){let u=t.sliceDoc(n,s).toLowerCase(),h='"',f='"';/^['"]/.test(u)?(l=u[0]=='"'?/^[^"]*$/:/^[^']*$/,h="",f=t.sliceDoc(s,s+1)==u[0]?"":u[0],u=u.slice(1),n++):l=/^[^\s<>='"]*$/;for(let p of O)a.push({label:p,apply:h+p+f,type:"constant"})}}return{from:n,to:s,options:a,validFor:l}}function Ec(t,e){let{state:r,pos:n}=e,s=U(r).resolveInner(n,-1),i=s.resolve(n);for(let o=n,a;i==s&&(a=s.childBefore(o));){let l=a.lastChild;if(!l||!l.type.isError||l.fromEc(n,s)}var mp=Ee.parser.configure({top:"SingleExpression"}),Cc=[{tag:"script",attrs:t=>t.type=="text/typescript"||t.lang=="ts",parser:Xi.parser},{tag:"script",attrs:t=>t.type=="text/babel"||t.type=="text/jsx",parser:Ti.parser},{tag:"script",attrs:t=>t.type=="text/typescript-jsx",parser:Ri.parser},{tag:"script",attrs(t){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(t.type)},parser:mp},{tag:"script",attrs(t){return!t.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(t.type)},parser:Ee.parser},{tag:"style",attrs(t){return(!t.lang||t.lang=="css")&&(!t.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(t.type))},parser:yr.parser}],Ac=[{name:"style",parser:yr.parser.configure({top:"Styles"})}].concat(Tc.map(t=>({name:t,parser:Ee.parser}))),Lc=qt.define({name:"html",parser:Hl.configure({props:[rt.add({Element(t){let e=/^(\s*)(<\/)?/.exec(t.textAfter);return t.node.to<=t.pos+e[0].length?t.continue():t.lineIndent(t.node.from)+(e[2]?0:t.unit)},"OpenTag CloseTag SelfClosingTag"(t){return t.column(t.node.from)+t.unit},Document(t){if(t.pos+/\s*/.exec(t.textAfter)[0].lengtht.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:""}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-_"}}),kn=Lc.configure({wrap:ki(Cc,Ac)});function Yc(t={}){let e="",r;t.matchClosingTags===!1&&(e="noMatch"),t.selfClosingTags===!0&&(e=(e?e+" ":"")+"selfClosing"),(t.nestedLanguages&&t.nestedLanguages.length||t.nestedAttributes&&t.nestedAttributes.length)&&(r=ki((t.nestedLanguages||[]).concat(Cc),(t.nestedAttributes||[]).concat(Ac)));let n=r?Lc.configure({wrap:r,dialect:e}):e?kn.configure({dialect:e}):kn;return new Ve(n,[kn.data.of({autocomplete:pp(t)}),t.autoCloseTags!==!1?bp:[],Pc().support,uc().support])}var Zc=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" "));function gp(t,e,r){for(var n;;){if(((n=e.lastChild)===null||n===void 0?void 0:n.name)!="CloseTag")return!1;let s=e.parent;if(!s||St(t,s)!=r)return!0;e=s}}var bp=_.inputHandler.of((t,e,r,n,s)=>{if(t.composing||t.state.readOnly||e!=r||n!=">"&&n!="/"||!kn.isActiveAt(t.state,e,-1))return!1;let i=s(),{state:o}=i,a=o.changeByRange(l=>{var c;let O=o.doc.sliceString(l.from-1,l.to)==n,{head:u}=l,h=U(o).resolveInner(u,-1),f;if(O&&n==">"&&h.name=="EndTag"){let p=h.parent;if((f=St(o.doc,p.parent,u))&&!Zc.has(f)&&!gp(o.doc,p.parent,f)){let d=u+(o.doc.sliceString(u,u+1)===">"?1:0),g=``;return{range:l,changes:{from:u,to:d,insert:g}}}}else if(O&&n=="/"&&h.name=="IncompleteCloseTag"){let p=h.parent;if(h.from==u-2&&((c=p.lastChild)===null||c===void 0?void 0:c.name)!="CloseTag"&&(f=St(o.doc,p,u))&&!Zc.has(f)){let d=u+(o.doc.sliceString(u,u+1)===">"?1:0),g=`${f}>`;return{range:z.cursor(u+g.length,-1),changes:{from:u,to:d,insert:g}}}}return{range:l}});return a.changes.empty?!1:(t.dispatch([i,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)});var Mc=rn({commentTokens:{block:{open:""}}}),Uc=new Te,Wc=$l.configure({props:[Ie.add(t=>!t.is("Block")||t.is("Document")||Yi(t)!=null||Qp(t)?void 0:(e,r)=>({from:r.doc.lineAt(e.from).to,to:e.to})),Uc.add(Yi),rt.add({Document:()=>null}),da.add({Document:Mc})]});function Yi(t){let e=/^(?:ATX|Setext)Heading(\d)$/.exec(t.name);return e?+e[1]:void 0}function Qp(t){return t.name=="OrderedList"||t.name=="BulletList"}function xp(t,e){let r=t;for(;;){let n=r.nextSibling,s;if(!n||(s=Yi(n.type))!=null&&s<=e)break;r=n}return r.to}var $p=Qa.of((t,e,r)=>{for(let n=U(t).resolveInner(r,-1);n&&!(n.fromr)return{from:r,to:i}}return null});function qi(t){return new pa(Mc,t,[],"markdown")}var kp=qi(Wc),Sp=Wc.configure([yl,vl,wl,Zl,{props:[Ie.add({Table:(t,e)=>({from:e.doc.lineAt(t.from).to,to:t.to})})]}]),Gt=qi(Sp);function yp(t,e){return r=>{if(r&&t){let n=null;if(r=/\S*/.exec(r)[0],typeof t=="function"?n=t(r):n=xs.matchLanguageName(t,r,!0),n instanceof xs)return n.support?n.support.language.parser:ma.getSkippingParser(n.load());if(n)return n.parser}return e?e.parser:null}}var vr=class{constructor(e,r,n,s,i,o,a){this.node=e,this.from=r,this.to=n,this.spaceBefore=s,this.spaceAfter=i,this.type=o,this.item=a}blank(e,r=!0){let n=this.spaceBefore+(this.node.name=="Blockquote"?">":"");if(e!=null){for(;n.length0;s--)n+=" ";return n+(r?this.spaceAfter:"")}}marker(e,r){let n=this.node.name=="OrderedList"?String(+Ic(this.item,e)[2]+r):"";return this.spaceBefore+n+this.type+this.spaceAfter}};function Vc(t,e){let r=[],n=[];for(let s=t;s;s=s.parent){if(s.name=="FencedCode")return n;(s.name=="ListItem"||s.name=="Blockquote")&&r.push(s)}for(let s=r.length-1;s>=0;s--){let i=r[s],o,a=e.lineAt(i.from),l=i.from-a.from;if(i.name=="Blockquote"&&(o=/^ *>( ?)/.exec(a.text.slice(l))))n.push(new vr(i,l,l+o[0].length,"",o[1],">",null));else if(i.name=="ListItem"&&i.parent.name=="OrderedList"&&(o=/^( *)\d+([.)])( *)/.exec(a.text.slice(l)))){let c=o[3],O=o[0].length;c.length>=4&&(c=c.slice(0,c.length-4),O-=4),n.push(new vr(i.parent,l,l+O,o[1],c,o[2],i))}else if(i.name=="ListItem"&&i.parent.name=="BulletList"&&(o=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(a.text.slice(l)))){let c=o[4],O=o[0].length;c.length>4&&(c=c.slice(0,c.length-4),O-=4);let u=o[2];o[3]&&(u+=o[3].replace(/[xX]/," ")),n.push(new vr(i.parent,l,l+O,o[1],c,u,i))}}return n}function Ic(t,e){return/^(\s*)(\d+)(?=[.)])/.exec(e.sliceString(t.from,t.from+10))}function Ai(t,e,r,n=0){for(let s=-1,i=t;;){if(i.name=="ListItem"){let a=Ic(i,e),l=+a[2];if(s>=0){if(l!=s+1)return;r.push({from:i.from+a[1].length,to:i.from+a[0].length,insert:String(s+2+n)})}s=l}let o=i.nextSibling;if(!o)break;i=o}}function zi(t,e){let r=/^[ \t]*/.exec(t)[0].length;if(!r||e.facet(nn)!=" ")return t;let n=Yt(t,4,r),s="";for(let i=n;i>0;)i>=4?(s+=" ",i-=4):(s+=" ",i--);return s+t.slice(r)}var Pp=(t={})=>({state:e,dispatch:r})=>{let n=U(e),{doc:s}=e,i=null,o=e.changeByRange(a=>{if(!a.empty||!Gt.isActiveAt(e,a.from,-1)&&!Gt.isActiveAt(e,a.from,1))return i={range:a};let l=a.from,c=s.lineAt(l),O=Vc(n.resolveInner(l,-1),s);for(;O.length&&O[O.length-1].from>l-c.from;)O.pop();if(!O.length)return i={range:a};let u=O[O.length-1];if(u.to-u.spaceAfter.length>l-c.from)return i={range:a};let h=l>=u.to-u.spaceAfter.length&&!/\S/.test(c.text.slice(u.to));if(u.item&&h){if(u.item.from]*$/.test(c.text.slice(0,u.to)))return i={range:a};let Q=u.node.firstChild,b=u.node.getChild("ListItem","ListItem");if(Q.to>=l||b&&b.to0&&!/[^\s>]/.test(s.lineAt(c.from-1).text)||t.nonTightLists===!1){let x=O.length>1?O[O.length-2]:null,k,w="";x&&x.item?(k=c.from+x.from,w=x.marker(s,1)):k=c.from+(x?x.to:0);let y=[{from:k,to:l,insert:w}];return u.node.name=="OrderedList"&&Ai(u.item,s,y,-2),x&&x.node.name=="OrderedList"&&Ai(x.item,s,y),{range:z.cursor(k+w.length),changes:y}}else{let x=zc(O,e,c);return{range:z.cursor(l+x.length+1),changes:{from:c.from,insert:x+e.lineBreak}}}}if(u.node.name=="Blockquote"&&h&&c.from){let Q=s.lineAt(c.from-1),b=/>\s*$/.exec(Q.text);if(b&&b.index==u.from){let x=e.changes([{from:Q.from+b.index,to:Q.to},{from:c.from+u.from,to:c.to}]);return{range:a.map(x),changes:x}}}let f=[];u.node.name=="OrderedList"&&Ai(u.item,s,f);let p=u.item&&u.item.from]*/.exec(c.text)[0].length>=u.to)for(let Q=0,b=O.length-1;Q<=b;Q++)d+=Q==b&&!p?O[Q].marker(s,1):O[Q].blank(Qc.from&&/\s/.test(c.text.charAt(g-c.from-1));)g--;return d=zi(d,e),vp(u.node,e.doc)&&(d=zc(O,e,c)+e.lineBreak+d),f.push({from:g,to:l,insert:e.lineBreak+d}),{range:z.cursor(g+d.length+1),changes:f}});return i?!1:(r(e.update(o,{scrollIntoView:!0,userEvent:"input"})),!0)},wp=Pp();function qc(t){return t.name=="QuoteMark"||t.name=="ListMark"}function vp(t,e){if(t.name!="OrderedList"&&t.name!="BulletList")return!1;let r=t.firstChild,n=t.getChild("ListItem","ListItem");if(!n)return!1;let s=e.lineAt(r.to),i=e.lineAt(n.from),o=/^[\s>]*$/.test(s.text);return s.number+(o?0:1){let r=U(t),n=null,s=t.changeByRange(i=>{let o=i.from,{doc:a}=t;if(i.empty&&Gt.isActiveAt(t,i.from)){let l=a.lineAt(o),c=Vc(Zp(r,o),a);if(c.length){let O=c[c.length-1],u=O.to-O.spaceAfter.length+(O.spaceAfter?1:0);if(o-l.from>u&&!/\S/.test(l.text.slice(u,o-l.from)))return{range:z.cursor(l.from+u),changes:{from:l.from+u,to:o}};if(o-l.from==u&&(O.item&&l.from<=O.item.from||/^[\s>]*$/.test(l.text.slice(0,O.to)))){let h=l.from+O.from;if(O.item&&O.node.from{var r;let{main:n}=e.state.selection;if(n.empty)return!1;let s=(r=t.clipboardData)===null||r===void 0?void 0:r.getData("text/plain");if(!s||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(s)||(/^www\./.test(s)&&(s="https://"+s),!Gt.isActiveAt(e.state,n.from,1)))return!1;let i=U(e.state),o=!1;return i.iterate({from:n.from,to:n.to,enter:a=>{(a.from>n.from||Ep.test(a.name))&&(o=!0)},leave:a=>{a.tot.normalize("NFKD"):t=>t,lt=class{constructor(e,r,n=0,s=e.length,i,o){this.test=o,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,s),this.bufferStart=n,this.normalize=i?a=>i(Nc(a)):Nc,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return pe(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let r=cr(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=je(e);let s=this.normalize(r);if(s.length)for(let i=0,o=n,a=!0;;i++){let l=s.charCodeAt(i),c=this.match(l,o,a,this.bufferPos+this.bufferStart,i==s.length-1);if(c)return this.value=c,this;if(i==s.length-1)break;a&&ithis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,s=n+r[0].length;if(this.matchPos=Zn(this.text,s+(n==s?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,precise:!0,match:r},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=n||s.to<=r){let a=new t(r,e.sliceString(r,n));return Mi.set(e,a),a}if(s.from==r&&s.to==n)return s;let{text:i,from:o}=s;return o>r&&(i=e.sliceString(r,o)+i,o=r),s.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==e&&(this.re.lastIndex=e+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,s=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,s,r)))return this.value={from:n,to:s,precise:!0,match:r},this.matchPos=Zn(this.text,s+(n==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=wn.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<"u"&&(Pn.prototype[Symbol.iterator]=vn.prototype[Symbol.iterator]=function(){return this});function Cp(t){try{return new RegExp(t,Gi),!0}catch{return!1}}function Zn(t,e){if(e>=t.length)return e;let r=t.lineAt(e),n;for(;e=56320&&n<57344;)e++;return e}var Ap=t=>{let e=ha(t,"cm-goto-line");if(e){let o=e.dom.querySelector("input[type=text]");return o&&o.select(),!0}let{state:r}=t,n=String(r.doc.lineAt(t.state.selection.main.head).number),{close:s,result:i}=ua(t,{class:"cm-goto-line",label:r.phrase("Go to line"),input:{type:"text",name:"line",value:n},focus:!0,submitLabel:r.phrase("go")});return i.then(o=>{let a=o&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(o.elements.line.value);if(!a){t.dispatch({effects:s});return}let l=r.doc.lineAt(r.selection.main.head),[,c,O,u,h]=a,f=u?+u.slice(1):0,p=O?+O:l.number;if(O&&h){let Q=p/100;c&&(Q=Q*(c=="-"?-1:1)+l.number/r.doc.lines),p=Math.round(r.doc.lines*Q)}else O&&c&&(p=p*(c=="-"?-1:1)+l.number);let d=r.doc.line(Math.max(1,Math.min(r.doc.lines,p))),g=z.cursor(d.from+Math.max(0,Math.min(f,d.length)));t.dispatch({effects:[s,_.scrollIntoView(g.from,{y:"center"})],selection:g})}),!0},Lp={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Kc=Lt.define({combine(t){return ur(t,Lp,{highlightWordAroundCursor:(e,r)=>e||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function Jc(t){let e=[Up,Mp];return t&&e.push(Kc.of(t)),e}var Yp=j.mark({class:"cm-selectionMatch"}),qp=j.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Bc(t,e,r,n){return(r==0||t(e.sliceDoc(r-1,r))!=le.Word)&&(n==e.doc.length||t(e.sliceDoc(n,n+1))!=le.Word)}function zp(t,e,r,n){return t(e.sliceDoc(r,r+1))==le.Word&&t(e.sliceDoc(n-1,n))==le.Word}var Mp=Me.fromClass(class{constructor(t){this.decorations=this.getDeco(t)}update(t){(t.selectionSet||t.docChanged||t.viewportChanged)&&(this.decorations=this.getDeco(t.view))}getDeco(t){let e=t.state.facet(Kc),{state:r}=t,n=r.selection;if(n.ranges.length>1)return j.none;let s=n.main,i,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return j.none;let l=r.wordAt(s.head);if(!l)return j.none;o=r.charCategorizer(s.head),i=r.sliceDoc(l.from,l.to)}else{let l=s.to-s.from;if(l200)return j.none;if(e.wholeWords){if(i=r.sliceDoc(s.from,s.to),o=r.charCategorizer(s.head),!(Bc(o,r,s.from,s.to)&&zp(o,r,s.from,s.to)))return j.none}else if(i=r.sliceDoc(s.from,s.to),!i)return j.none}let a=[];for(let l of t.visibleRanges){let c=new lt(r.doc,i,l.from,l.to);for(;!c.next().done;){let{from:O,to:u}=c.value;if((!o||Bc(o,r,O,u))&&(s.empty&&O<=s.from&&u>=s.to?a.push(qp.range(O,u)):(O>=s.to||u<=s.from)&&a.push(Yp.range(O,u)),a.length>e.maxMatches))return j.none}}return j.set(a)}},{decorations:t=>t.decorations}),Up=_.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),Wp=({state:t,dispatch:e})=>{let{selection:r}=t,n=z.create(r.ranges.map(s=>t.wordAt(s.head)||z.cursor(s.head)),r.mainIndex);return n.eq(r)?!1:(e(t.update({selection:n})),!0)};function Vp(t,e){let{main:r,ranges:n}=t.selection,s=t.wordAt(r.head),i=s&&s.from==r.from&&s.to==r.to;for(let o=!1,a=new lt(t.doc,e,n[n.length-1].to);;)if(a.next(),a.done){if(o)return null;a=new lt(t.doc,e,0,Math.max(0,n[n.length-1].from-1)),o=!0}else{if(o&&n.some(l=>l.from==a.value.from))continue;if(i){let l=t.wordAt(a.value.from);if(!l||l.from!=a.value.from||l.to!=a.value.to)continue}return a.value}}var Ip=({state:t,dispatch:e})=>{let{ranges:r}=t.selection;if(r.some(i=>i.from===i.to))return Wp({state:t,dispatch:e});let n=t.sliceDoc(r[0].from,r[0].to);if(t.selection.ranges.some(i=>t.sliceDoc(i.from,i.to)!=n))return!1;let s=Vp(t,n);return s?(e(t.update({selection:t.selection.addRange(z.range(s.from,s.to),!1),effects:_.scrollIntoView(s.to)})),!0):!1},yt=Lt.define({combine(t){return ur(t,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ii(e),scrollToMatch:e=>_.scrollIntoView(e)})}});function eO(t){return t?[yt.of(t),Di]:Di}var Xn=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||Cp(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?` +`:n=="r"?"\r":n=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new Wi(this):new Ui(this)}getCursor(e,r=0,n){let s=e.doc?e:tt.create({doc:e});return n==null&&(n=s.doc.length),this.regexp?Bt(this,s,r,n):Nt(this,s,r,n)}},Tn=class{constructor(e){this.spec=e}};function Dp(t,e,r){return(n,s,i,o)=>{if(r&&!r(n,s,i,o))return!1;let a=n>=o&&s<=o+i.length?i.slice(n-o,s-o):e.doc.sliceString(n,s);return t(a,e,n,s)}}function Nt(t,e,r,n){let s;return t.wholeWord&&(s=Gp(e.doc,e.charCategorizer(e.selection.main.head))),t.test&&(s=Dp(t.test,e,s)),new lt(e.doc,t.unquoted,r,n,t.caseSensitive?void 0:i=>i.toLowerCase(),s)}function Gp(t,e){return(r,n,s,i)=>((i>r||i+s.length=r)return null;s.push(n.value)}return s}highlight(e,r,n,s){let i=Nt(this.spec,e,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}};function Np(t,e,r){return(n,s,i)=>(!r||r(n,s,i))&&t(i[0],e,n,s)}function Bt(t,e,r,n){let s;return t.wholeWord&&(s=Bp(e.charCategorizer(e.selection.main.head))),t.test&&(s=Np(t.test,e,s)),new Pn(e.doc,t.search,{ignoreCase:!t.caseSensitive,test:s},r,n)}function Rn(t,e){return t.slice(ds(t,e,!1),e)}function jn(t,e){return t.slice(e,ds(t,e))}function Bp(t){return(e,r,n)=>!n[0].length||(t(Rn(n.input,n.index))!=le.Word||t(jn(n.input,n.index))!=le.Word)&&(t(jn(n.input,n.index+n[0].length))!=le.Word||t(Rn(n.input,n.index+n[0].length))!=le.Word)}var Wi=class extends Tn{nextMatch(e,r,n){let s=Bt(this.spec,e,n,e.doc.length).next();return s.done&&(s=Bt(this.spec,e,0,r).next()),s.done?null:s.value}prevMatchInRange(e,r,n){for(let s=1;;s++){let i=Math.max(r,n-s*1e4),o=Bt(this.spec,e,i,n),a=null;for(;!o.next().done;)a=o.value;if(a&&(i==r||a.from>i+10))return a;if(i==r)return null}}prevMatch(e,r,n){return this.prevMatchInRange(e,0,r)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,n)=>{if(n=="&")return e.match[0];if(n=="$")return"$";for(let s=n.length;s>0;s--){let i=+n.slice(0,s);if(i>0&&i=r)return null;s.push(n.value)}return s}highlight(e,r,n,s){let i=Bt(this.spec,e,Math.max(0,r-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)s(i.value.from,i.value.to)}},Xr=re.define(),Ni=re.define(),at=Xe.define({create(t){return new Zr(Vi(t).create(),null)},update(t,e){for(let r of e.effects)r.is(Xr)?t=new Zr(r.value.create(),t.panel):r.is(Ni)&&(t=new Zr(t.query,r.value?Bi:null));return t},provide:t=>Oa.from(t,e=>e.panel)});var Zr=class{constructor(e,r){this.query=e,this.panel=r}},Fp=j.mark({class:"cm-searchMatch"}),Hp=j.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Kp=Me.fromClass(class{constructor(t){this.view=t,this.decorations=this.highlight(t.state.field(at))}update(t){let e=t.state.field(at);(e!=t.startState.field(at)||t.docChanged||t.selectionSet||t.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:t,panel:e}){if(!e||!t.spec.valid)return j.none;let{view:r}=this,n=new oa;for(let s=0,i=r.visibleRanges,o=i.length;si[s+1].from-500;)l=i[++s].to;t.highlight(r.state,a,l,(c,O)=>{let u=r.state.selection.ranges.some(h=>h.from==c&&h.to==O);n.add(c,O,u?Hp:Fp)})}return n.finish()}},{decorations:t=>t.decorations});function Tr(t){return e=>{let r=e.state.field(at,!1);return r&&r.query.spec.valid?t(e,r):nO(e)}}var En=Tr((t,{query:e})=>{let{to:r}=t.state.selection.main,n=e.nextMatch(t.state,r,r);if(!n)return!1;let s=z.single(n.from,n.to),i=t.state.facet(yt);return t.dispatch({selection:s,effects:[Fi(t,n),i.scrollToMatch(s.main,t)],userEvent:"select.search"}),rO(t),!0}),_n=Tr((t,{query:e})=>{let{state:r}=t,{from:n}=r.selection.main,s=e.prevMatch(r,n,n);if(!s)return!1;let i=z.single(s.from,s.to),o=t.state.facet(yt);return t.dispatch({selection:i,effects:[Fi(t,s),o.scrollToMatch(i.main,t)],userEvent:"select.search"}),rO(t),!0}),Jp=Tr((t,{query:e})=>{let r=e.matchAll(t.state,1e3);return!r||!r.length?!1:(t.dispatch({selection:z.create(r.map(n=>z.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),em=({state:t,dispatch:e})=>{let r=t.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:s}=r.main,i=[],o=0;for(let a=new lt(t.doc,t.sliceDoc(n,s));!a.next().done;){if(i.length>1e3)return!1;a.value.from==n&&(o=i.length),i.push(z.range(a.value.from,a.value.to))}return e(t.update({selection:z.create(i,o),userEvent:"select.search.matches"})),!0},Fc=Tr((t,{query:e})=>{let{state:r}=t,{from:n,to:s}=r.selection.main;if(r.readOnly)return!1;let i=e.nextMatch(r,n,n);if(!i)return!1;let o=i,a=[],l,c,O=[];o.precise?o.from==n&&o.to==s&&(c=r.toText(e.getReplacement(o)),a.push({from:o.from,to:o.to,insert:c}),o=e.nextMatch(r,o.from,o.to),O.push(_.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+"."))):o=e.nextMatch(r,o.from,o.to);let u=t.state.changes(a);return o&&(l=z.single(o.from,o.to).map(u),O.push(Fi(t,o)),O.push(r.facet(yt).scrollToMatch(l.main,t))),t.dispatch({changes:u,selection:l,effects:O,userEvent:"input.replace"}),!0}),tm=Tr((t,{query:e})=>{if(t.state.readOnly)return!1;let r=[];for(let s of e.matchAll(t.state,1e9)){let{from:i,to:o,precise:a}=s;a&&r.push({from:i,to:o,insert:e.getReplacement(s)})}if(!r.length)return!1;let n=t.state.phrase("replaced $ matches",r.length)+".";return t.dispatch({changes:r,effects:_.announce.of(n),userEvent:"input.replace.all"}),!0});function Bi(t){return t.state.facet(yt).createPanel(t)}function Vi(t,e){var r,n,s,i,o;let a=t.selection.main,l=a.empty||a.to>a.from+100?"":t.sliceDoc(a.from,a.to);if(e&&!l)return e;let c=t.facet(yt);return new Xn({search:((r=e?.literal)!==null&&r!==void 0?r:c.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=e?.caseSensitive)!==null&&n!==void 0?n:c.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:c.literal,regexp:(i=e?.regexp)!==null&&i!==void 0?i:c.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:c.wholeWord})}function tO(t){let e=bs(t,Bi);return e&&e.dom.querySelector("[main-field]")}function rO(t){let e=tO(t);e&&e==t.root.activeElement&&e.select()}var nO=t=>{let e=t.state.field(at,!1);if(e&&e.panel){let r=tO(t);if(r&&r!=t.root.activeElement){let n=Vi(t.state,e.query.spec);n.valid&&t.dispatch({effects:Xr.of(n)}),r.focus(),r.select()}}else t.dispatch({effects:[Ni.of(!0),e?Xr.of(Vi(t.state,e.query.spec)):re.appendConfig.of(Di)]});return!0},sO=t=>{let e=t.state.field(at,!1);if(!e||!e.panel)return!1;let r=bs(t,Bi);return r&&r.dom.contains(t.root.activeElement)&&t.focus(),t.dispatch({effects:Ni.of(!1)}),!0},iO=[{key:"Mod-f",run:nO,scope:"editor search-panel"},{key:"F3",run:En,shift:_n,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:En,shift:_n,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:sO,scope:"editor search-panel"},{key:"Mod-Shift-l",run:em},{key:"Mod-Alt-g",run:Ap},{key:"Mod-d",run:Ip,preventDefault:!0}],Ii=class{constructor(e){this.view=e;let r=this.query=e.state.field(at).query.spec;this.commit=this.commit.bind(this),this.searchField=$e("input",{value:r.search,placeholder:Pe(e,"Find"),"aria-label":Pe(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=$e("input",{value:r.replace,placeholder:Pe(e,"Replace"),"aria-label":Pe(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=$e("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=$e("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=$e("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(s,i,o){return $e("button",{class:"cm-button",name:s,onclick:i,type:"button"},o)}this.dom=$e("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,n("next",()=>En(e),[Pe(e,"next")]),n("prev",()=>_n(e),[Pe(e,"previous")]),n("select",()=>Jp(e),[Pe(e,"all")]),$e("label",null,[this.caseField,Pe(e,"match case")]),$e("label",null,[this.reField,Pe(e,"regexp")]),$e("label",null,[this.wordField,Pe(e,"by word")]),...e.state.readOnly?[]:[$e("br"),this.replaceField,n("replace",()=>Fc(e),[Pe(e,"replace")]),n("replaceAll",()=>tm(e),[Pe(e,"replace all")])],$e("button",{name:"close",onclick:()=>sO(e),"aria-label":Pe(e,"close"),type:"button"},["\xD7"])])}commit(){let e=new Xn({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:Xr.of(e)}))}keydown(e){la(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?_n:En)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Fc(this.view))}update(e){for(let r of e.transactions)for(let n of r.effects)n.is(Xr)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(yt).top}};function Pe(t,e){return t.state.phrase(e)}var Sn=30,yn=/[\s\.,:;?!]/;function Fi(t,{from:e,to:r}){let n=t.state.doc.lineAt(e),s=t.state.doc.lineAt(r).to,i=Math.max(n.from,e-Sn),o=Math.min(s,r+Sn),a=t.state.sliceDoc(i,o);if(i!=n.from){for(let l=0;la.length-Sn;l--)if(!yn.test(a[l-1])&&yn.test(a[l])){a=a.slice(0,l);break}}return _.announce.of(`${t.state.phrase("current match")}. ${a} ${t.state.phrase("on line")} ${n.number}.`)}var rm=_.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Di=[at,et.low(Kp),rm];function S(t,e){return typeof document<"u"&&document.documentElement.lang.toLowerCase().startsWith("zh")?t:e}function Be(t,e,r=""){let n=t.state.changeByRange(s=>{let{from:i,to:o}=s,a=t.state.sliceDoc(i-e.length,i),l=t.state.sliceDoc(o,o+e.length);if(a===e&&l===e)return{changes:[{from:i-e.length,to:i,insert:""},{from:o,to:o+e.length,insert:""}],range:z.range(i-e.length,o-e.length)};let c=t.state.sliceDoc(i,o)||r;return{changes:{from:i,to:o,insert:e+c+e},range:z.range(i+e.length,i+e.length+c.length)}});return t.dispatch(n,{scrollIntoView:!0,userEvent:"input"}),t.focus(),!0}function be(t,e){let{state:r}=t,n=[],s=new Set;for(let o of r.selection.ranges)for(let a=r.doc.lineAt(o.from).number;a<=r.doc.lineAt(o.to).number;a++)s.add(a);let i=/^(\s*)(#{1,6}\s+|>\s?|[-*+]\s+\[[ xX]\]\s+|[-*+]\s+|\d+[.)]\s+)?/;for(let o of s){let a=r.doc.line(o),l=i.exec(a.text),c=l[1],O=l[2]??"",u=a.from+c.length,h=u+O.length;n.push({from:u,to:h,insert:O===e?"":e})}return t.dispatch({changes:n,scrollIntoView:!0,userEvent:"input"}),t.focus(),!0}function Hi(t,e,r=!1){let{state:n}=t,s=n.selection.main,i=e;if(r){let o=n.doc.lineAt(s.from);s.from===o.from||(i=` +`+i);let l=n.doc.lineAt(s.to);(s.to!==l.to||l.number===n.doc.lines)&&(i+=` +`)}t.dispatch({changes:{from:s.from,to:s.to,insert:i},selection:{anchor:s.from+i.length},scrollIntoView:!0,userEvent:"input"}),t.focus()}function Ki(t){let e=t.state.selection.main,r=t.state.sliceDoc(e.from,e.to)||S("\u94FE\u63A5","link"),n=`[${r}](https://)`;return t.dispatch({changes:{from:e.from,to:e.to,insert:n},selection:z.range(e.from+r.length+3,e.from+n.length-1),userEvent:"input"}),t.focus(),!0}function Ji(t){let e=t.state.selection.main,r=t.state.sliceDoc(e.from,e.to);return t.dispatch({changes:{from:e.from,to:e.to,insert:`[[${r}]]`},selection:{anchor:e.from+2+r.length},userEvent:"input"}),t.focus(),!0}function eo(t){let e=t.trim();return e.startsWith('"')&&e.endsWith('"')&&e.length>=2||e.startsWith("'")&&e.endsWith("'")&&e.length>=2?e.slice(1,-1):e==="true"||e==="false"?e==="true":/^[-+]?\d+(\.\d+)?$/.test(e)&&e.length<16?Number(e):(e=e.replace(/\s+#.*$/,""),e)}function nm(t){return t.slice(1,-1).split(",").map(e=>String(eo(e))).filter(Boolean)}function Rr(t){if(!/^---[ \t]*\r?\n/.test(t))return null;let e=t.split(` +`),r=-1;for(let a=1;ai.value),n=r.reduce((i,o)=>i+o,0),s=i=>e.every(o=>o[i]===e[0][i])?e[0][i]:"";return{count:e.length,sum:n,avg:n/e.length,min:Math.min(...r),max:Math.max(...r),prefix:s("prefix"),suffix:s("suffix"),decimals:Math.min(4,Math.max(...e.map(i=>i.decimals)))}}function ue(t,e,r=0){let n=Math.min(4,e.decimals+r),s=Math.abs(t).toLocaleString("en-US",{minimumFractionDigits:e.decimals,maximumFractionDigits:n});return(t<0?"-":"")+e.prefix+s+e.suffix}function aO(t,e){let r=to(t),n=to(e);return r&&n?r.value-n.value:!t.trim()&&e.trim()?1:t.trim()&&!e.trim()?-1:t.localeCompare(e,"zh-Hans-CN",{numeric:!0})}var im=re.define(),lO=re.define();function ro(t,e,r){return t.selection.ranges.some(n=>n.from<=r&&n.to>=e)}function io(t){let e=t.sliceDoc(0,Math.min(t.doc.length,2e4)),r=Rr(e);return r?{from:0,to:t.doc.line(r.endLine+1).to}:null}var no=class extends Oe{constructor(r){super();this.src=r}eq(r){return r.src===this.src}toDOM(){let r=document.createElement("div");r.className="cm-props";let n=Rr(this.src+` +`);if(!n||!n.keys.length)return r.classList.add("cm-props-empty"),r.textContent=S("\u5C5E\u6027","Properties"),r;for(let s of n.keys){let i=document.createElement("div");i.className="cm-prop";let o=document.createElement("span");o.className="cm-prop-key",o.textContent=s;let a=document.createElement("span");a.className="cm-prop-val";let l=n.props[s];if(Array.isArray(l))for(let c of l){let O=document.createElement("span");O.className="cm-prop-chip",O.textContent=c,a.append(O)}else typeof l=="boolean"?a.textContent=l?"\u2713":"\u2717":a.textContent=Cn(l)||"\u2014";i.append(o,a),r.append(i)}return r}ignoreEvent(){return!1}},so=class extends Oe{constructor(r,n,s){super();this.src=r;this.stamp=n;this.opts=s}eq(r){return r.src===this.src&&r.stamp===this.stamp}get estimatedHeight(){return 160}toDOM(){let r=document.createElement("div");if(r.className="cm-query prose-ivy",!this.opts.query)return r.classList.add("cm-query-note"),r.textContent=S("\u7B14\u8BB0\u67E5\u8BE2\uFF1A\u5728\u7F51\u9875\u7248\u6216\u684C\u9762\u7248\u4E2D\u663E\u793A\u7ED3\u679C\u3002","Note query: its results show in the web and desktop apps."),r;let n;try{n=this.opts.query(this.src)}catch(c){return r.classList.add("cm-query-error"),r.textContent=S("\u67E5\u8BE2\u65E0\u6CD5\u7406\u89E3\u8FD9\u4E00\u884C\uFF1A","The query does not understand: ")+String(c.message??c),r}let s=document.createElement("div");if(s.className="cm-query-head",s.textContent=S(`\u67E5\u8BE2 \xB7 ${n.total} \u7BC7\u7B14\u8BB0`,`Query \xB7 ${n.total} ${n.total===1?"note":"notes"}`)+(n.total>n.rows.length?S(`\uFF08\u663E\u793A\u524D ${n.rows.length} \u7BC7\uFF09`,` (first ${n.rows.length})`):""),r.append(s),!n.rows.length){let c=document.createElement("div");return c.className="cm-query-empty",c.textContent=S("\u6CA1\u6709\u7B26\u5408\u6761\u4EF6\u7684\u7B14\u8BB0\u3002","No notes match."),r.append(c),r}let i=document.createElement("div");i.className="cm-query-scroll";let o=document.createElement("table"),a=o.createTHead().insertRow();for(let c of[S("\u6807\u9898","Title"),...n.columns]){let O=document.createElement("th");O.textContent=c,a.append(O)}let l=o.createTBody();for(let c of n.rows){let O=l.insertRow(),u=O.insertCell(),h=document.createElement("a");h.className="wikilink",h.dataset.note=c.id,h.dataset.title=c.title,h.textContent=c.title||S("\u65E0\u6807\u9898","Untitled"),u.append(h);for(let f of c.cells)O.insertCell().textContent=f}if(n.stats.some(Boolean)&&n.rows.length>=2){let c=o.createTFoot().insertRow();c.className="cm-table-total";let O=c.insertCell();O.className="cm-table-total-label",O.textContent=S("\u5408\u8BA1","Total"),n.stats.forEach(u=>{let h=c.insertCell();u&&(h.textContent=ue(u.sum,u),h.title=S(`\u5E73\u5747 ${ue(u.avg,u,2)}`,`Average ${ue(u.avg,u,2)}`))})}return i.append(o),r.append(i),r}ignoreEvent(){return!1}};function om(t){let e=[];return U(t).iterate({enter(r){if(r.name!=="FencedCode")return;let n=r.node.getChild("CodeInfo");if(!n||t.sliceDoc(n.from,n.to).trim().toLowerCase()!=="ivy-query")return!1;let s=r.node.getChild("CodeText");return e.push({from:r.from,to:r.to,src:s?t.sliceDoc(s.from,s.to):""}),!1}}),e}function cO(t,e,r,n){let s=[],i=io(t);i&&!(e&&ro(t,i.from,i.to))&&s.push(j.replace({widget:new no(t.sliceDoc(i.from,i.to)),block:!0}).range(i.from,i.to));for(let o of om(t)){if(e&&ro(t,o.from,o.to))continue;let a=t.doc.lineAt(o.from).from,l=t.doc.lineAt(o.to).to;s.push(j.replace({widget:new so(o.src,r,n),block:!0}).range(a,l))}return j.set(s,!0)}function OO(t,e,r,n){return!(n&&ro(t,e,r))}function uO(t){let e=0;return[Xe.define({create:n=>({focused:!1,deco:cO(n,!1,e,t)}),update(n,s){let i=n.focused,o=!1;for(let a of s.effects)a.is(lO)&&(i=a.value),a.is(im)&&(o=!0);return o&&e++,o||i!==n.focused||s.docChanged||s.selection||U(s.startState)!==U(s.state)?{focused:i,deco:cO(s.state,i,e,t)}:n},provide:n=>_.decorations.from(n,s=>s.deco)}),_.focusChangeEffect.of((n,s)=>lO.of(s)),_.domEventHandlers({mousedown(n,s){let i=n.target,o=i.closest(".cm-query a[data-note]");if(o)return n.preventDefault(),t.openNote(o.dataset.note??"",o.dataset.title??"",n.button===1||n.shiftKey),!0;let a=i.closest(".cm-props, .cm-query");if(!a)return!1;if(i.closest(".cm-query-scroll")&&!(n.metaKey||n.ctrlKey))return!0;n.preventDefault();let l=s.posAtDOM(a),c=s.state.doc.lineAt(l),O=c.number23||Number(e[2])>59?"":`${ae(Number(e[1]))}:${e[2]}`}function ao(t){let e=t.trim().toLowerCase();if(e==="every weekday")return{every:1,unit:"weekday",text:t.trim()};let r=/^every\s+(?:(\d{1,3})\s+)?(day|week|month|year)s?$/.exec(e);if(!r)return null;let n=r[1]?Number(r[1]):1;return n<1?null:{every:n,unit:r[2],text:t.trim()}}function Yn(t){let e=fO.exec(t);if(!e)return null;let r=e[4],n=jr.exec(r),s=n&&Fe(n[1])?n[1]:"",i=An.exec(r),o=oo.exec(r),a=r.replace(jr,"").replace(An,"").replace(oo,"").replace(/\s+/g," ").trim();return{done:e[2]!==" ",text:a,due:s?{date:s,time:n?.[2]?am(n[2]):""}:null,repeat:o?ao(o[1]):null,doneDate:i?.[1]??"",raw:t}}function Ln(t){return`\u{1F4C5} ${t.date}${t.time?" "+t.time:""}`}function lo(t,e,r){if(e&&r===void 0&&jr.test(t))return t.replace(jr,Ln(e));let n=t.replace(new RegExp("\\s*"+jr.source,"u"),"");r!==void 0&&(n=n.replace(new RegExp("\\s*"+oo.source,"u"),o=>o.endsWith(" ")?" ":"")),n=n.replace(/\s+$/,"");let s=[];if(e&&s.push(Ln(e)),r&&s.push(`\u{1F501} ${r}`),!s.length)return n;let i=n.search(/\s*✅/u);return i>=0?n.slice(0,i)+" "+s.join(" ")+n.slice(i):n+" "+s.join(" ")}function hO(t,e){let r=t.getDate(),n=new Date(t.getFullYear(),t.getMonth()+e,1),s=new Date(n.getFullYear(),n.getMonth()+1,0).getDate();return n.setDate(Math.min(r,s)),n}function lm(t,e){let r=Fe(t);if(!r)return t;switch(e.unit){case"day":return r.setDate(r.getDate()+e.every),oe(r);case"week":return r.setDate(r.getDate()+7*e.every),oe(r);case"month":return oe(hO(r,e.every));case"year":return oe(hO(r,12*e.every));case"weekday":{do r.setDate(r.getDate()+1);while(r.getDay()===0||r.getDay()===6);return oe(r)}}}function pO(t,e,r){let n=t.split(` +`),s=n[e],i=s===void 0?null:fO.exec(s);if(!i)return t;if(i[2]!==" ")return n[e]=(i[1]+" "+i[3]+i[4].replace(new RegExp("\\s*"+An.source,"u"),"")).replace(/\s+$/,""),n.join(` +`);let a=Yn(s);if(!a.due&&!a.repeat)return n[e]=`${i[1]}x${i[3]}${i[4]}`,n.join(` +`);let l=i[4].replace(new RegExp("\\s*"+An.source,"u"),"").replace(/\s+$/,"");if(n[e]=`${i[1]}x${i[3]}${l} \u2705 ${r}`,a.repeat&&a.due){let c=lo(i[1]+" "+i[3]+l,{date:lm(a.due.date,a.repeat),time:a.due.time});n.splice(e,0,c)}return n.join(` +`)}var Er={\u96F6:0,"\u3007":0,\u4E00:1,\u4E8C:2,\u4E24:2,\u4E09:3,\u56DB:4,\u4E94:5,\u516D:6,\u4E03:7,\u516B:8,\u4E5D:9,\u5341:10},cm={\u65E5:0,\u5929:0,\u4E00:1,\u4E8C:2,\u4E09:3,\u56DB:4,\u4E94:5,\u516D:6},Om={sun:0,mon:1,tue:2,wed:3,thu:4,fri:5,sat:6};function Ft(t){return/^\d+$/.test(t)?Number(t):t==="\u5341"?10:t.startsWith("\u5341")?10+(Er[t[1]]??0):t.endsWith("\u5341")?(Er[t[0]]??0)*10:t.length===3&&t[1]==="\u5341"?(Er[t[0]]??0)*10+(Er[t[2]]??0):Er[t]??NaN}var Ht="(\\d{1,4}|[\u96F6\u3007\u4E00\u4E8C\u4E24\u4E09\u56DB\u4E94\u516D\u4E03\u516B\u4E5D\u5341]{1,3})";function Qe(t,e){let r=new Date(t.getFullYear(),t.getMonth(),t.getDate());return r.setDate(r.getDate()+e),r}function Pt(t,e,r){if(r){let s=(t.getDay()+6)%7,i=Qe(t,7-s);return Qe(i,(e+6)%7)}let n=(e-t.getDay()+7)%7;return n===0&&(n=7),Qe(t,n)}function um(t){let e=t,r="",n="",s=/(凌晨|早上|早晨|上午|中午|下午|傍晚|晚上|今晚|明晚|夜里)/.exec(e);s&&(n=s[1],n==="\u4ECA\u665A"?e=e.replace("\u4ECA\u665A","\u4ECA\u5929"):n==="\u660E\u665A"?e=e.replace("\u660E\u665A","\u660E\u5929"):e=e.replace(n," "));let i=/\b(\d{1,2})(?::(\d{2}))?\s*(am|pm)\b/i.exec(e),o=/(\d{1,2})[::](\d{2})/.exec(e),a=new RegExp(Ht+"\\s*[\u70B9\u9EDE\u65F6](\u534A|\u4E00\u523B|\u4E09\u523B|"+Ht+"\u5206?)?").exec(e),l=-1,c=0;if(i)l=Number(i[1])%12+(i[3].toLowerCase()==="pm"?12:0),c=i[2]?Number(i[2]):0,e=e.replace(i[0]," ");else if(o)l=Number(o[1]),c=Number(o[2]),e=e.replace(o[0]," ");else if(a){l=Ft(a[1]);let O=a[2];c=O?O==="\u534A"?30:O==="\u4E00\u523B"?15:O==="\u4E09\u523B"?45:Ft(a[3]??"0"):0,e=e.replace(a[0]," ")}else n&&(l={\u51CC\u6668:6,\u65E9\u4E0A:8,\u65E9\u6668:8,\u4E0A\u5348:9,\u4E2D\u5348:12,\u4E0B\u5348:15,\u508D\u665A:18,\u665A\u4E0A:20,\u4ECA\u665A:20,\u660E\u665A:20,\u591C\u91CC:22}[n]);return l>=0&&l<12&&/下午|傍晚|晚上|今晚|明晚|夜里/.test(n)&&(l+=12),l===12&&n==="\u51CC\u6668"&&(l=0),l>=0&&l<=23&&c>=0&&c<=59&&!Number.isNaN(l)&&!Number.isNaN(c)&&(r=`${ae(l)}:${ae(c)}`),{time:r,rest:e}}function hm(t,e){let r=t.trim().toLowerCase(),n,s=[[/大后天/,3],[/后天|day after tomorrow/,2],[/明天|明日|tomorrow|tmr/,1],[/今天|今日|today|tonight/,0],[/昨天|yesterday/,-1]];for(let[i,o]of s)if(i.test(r))return{date:Qe(e,o),rest:r.replace(i," ")};if(n=/(\d{4})[-/.年](\d{1,2})[-/.月](\d{1,2})[日号]?/.exec(r))return{date:Fe(`${n[1]}-${ae(Number(n[2]))}-${ae(Number(n[3]))}`),rest:r.replace(n[0]," ")};if((n=new RegExp("(?:^|[^\\d])(\\d{1,2})[-/.\u6708](\\d{1,2})[\u65E5\u53F7]?").exec(r))||(n=new RegExp(Ht+"\u6708"+Ht+"[\u65E5\u53F7]?").exec(r))){let i=Ft(n[1]),o=Ft(n[2]),a=Fe(`${e.getFullYear()}-${ae(i)}-${ae(o)}`);return a&&adO(e)?a:oe(Qe(e,1)),time:n}}function co(t=new Date){let e=Pt(t,6,!1),r=Pt(t,1,!0),n=t.getHours()<20?[{label:["\u4ECA\u665A 20:00","Tonight 20:00"],due:{date:oe(t),time:"20:00"}}]:[];return[{label:["\u4ECA\u5929","Today"],due:{date:oe(t),time:""}},...n,{label:["\u660E\u5929 09:00","Tomorrow 09:00"],due:{date:oe(Qe(t,1)),time:"09:00"}},{label:["\u660E\u5929","Tomorrow"],due:{date:oe(Qe(t,1)),time:""}},{label:["\u5468\u672B","This weekend"],due:{date:oe(e),time:""}},{label:["\u4E0B\u5468\u4E00","Next Monday"],due:{date:oe(r),time:""}}]}var fm=["\u5468\u65E5","\u5468\u4E00","\u5468\u4E8C","\u5468\u4E09","\u5468\u56DB","\u5468\u4E94","\u5468\u516D"],dm=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],mO=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function _r(t,e=new Date,r=!0){let n=Fe(t.date);if(!n)return t.date;let s=new Date(e.getFullYear(),e.getMonth(),e.getDate()),i=Math.round((n.getTime()-s.getTime())/864e5),o;return i===0?o=r?"\u4ECA\u5929":"Today":i===1?o=r?"\u660E\u5929":"Tomorrow":i===2&&r?o="\u540E\u5929":i===-1?o=r?"\u6628\u5929":"Yesterday":i>1&&i<7?o=r?fm[n.getDay()]:dm[n.getDay()]:n.getFullYear()===e.getFullYear()?o=r?`${n.getMonth()+1}\u6708${n.getDate()}\u65E5`:`${mO[n.getMonth()]} ${n.getDate()}`:o=r?`${n.getFullYear()}\u5E74${n.getMonth()+1}\u6708${n.getDate()}\u65E5`:`${mO[n.getMonth()]} ${n.getDate()}, ${n.getFullYear()}`,t.time?`${o} ${t.time}`:o}function Oo(t,e=!0){let r={day:"\u5929",week:"\u5468",month:"\u4E2A\u6708",year:"\u5E74"};return t.unit==="weekday"?e?"\u6BCF\u4E2A\u5DE5\u4F5C\u65E5":"Every weekday":e?t.every===1?{day:"\u6BCF\u5929",week:"\u6BCF\u5468",month:"\u6BCF\u6708",year:"\u6BCF\u5E74"}[t.unit]??t.text:`\u6BCF ${t.every} ${r[t.unit]??t.unit}`:t.text.replace(/^every/i,"Every")}var uo=[["","\u4E0D\u91CD\u590D","Never"],["every day","\u6BCF\u5929","Every day"],["every weekday","\u6BCF\u4E2A\u5DE5\u4F5C\u65E5","Every weekday"],["every week","\u6BCF\u5468","Every week"],["every 2 weeks","\u6BCF 2 \u5468","Every 2 weeks"],["every month","\u6BCF\u6708","Every month"],["every year","\u6BCF\u5E74","Every year"]];var He=()=>S("zh","en")==="zh",ho=/^\s*(?:[-*+]|\d+[.)])\s+\[[ xX]\]/,bO=/(📅️?\s*\d{4}-\d{2}-\d{2}(?:[ T]\d{1,2}:\d{2})?)|(🔁️?\s*every(?:\s+\d{1,3})?\s+(?:day|week|month|year|weekday)s?)|(✅️?\s*\d{4}-\d{2}-\d{2})/giu;function pm(t,e){if(e)return"cm-due cm-due-done";let r=oe(new Date);return t.date{if(s.preventDefault(),s.stopPropagation(),r.state.readOnly)return;let i=Number(n.dataset.dueLine);i>=1&&i<=r.state.doc.lines&&zn(r,r.state.doc.line(i).from,n)})),n}ignoreEvent(){return!0}};function QO(t,e){let{state:r}=t,n=[],s=new Set;if(e)for(let o of r.selection.ranges)for(let a=r.doc.lineAt(o.from).number;a<=r.doc.lineAt(o.to).number;a++)s.add(a);let i=new Date;for(let{from:o,to:a}of t.visibleRanges){let l=o;for(;l<=a;){let c=r.doc.lineAt(l);if(l=c.to+1,!ho.test(c.text)||!/[📅🔁✅]/u.test(c.text))continue;let O=Yn(c.text);if(O){if(s.has(c.number)){for(let u of c.text.matchAll(bO))n.push(j.mark({class:"cm-due-src"}).range(c.from+u.index,c.from+u.index+u[0].length));continue}for(let u of c.text.matchAll(bO)){let h=c.from+u.index,f=h+u[0].length,p;if(u[1]){if(!O.due)continue;p=new Cr("\u{1F4C5} "+_r(O.due,i,He()),pm(O.due,O.done),c.number,"due")}else if(u[2]){let g=ao(u[2].replace(/^🔁️?\s*/u,""));if(!g)continue;p=new Cr("\u{1F501} "+Oo(g,He()),"cm-due cm-due-repeat",c.number,"repeat")}else p=new Cr("\u2705 "+_r({date:u[3].replace(/^✅️?\s*/u,""),time:""},i,He()),"cm-due cm-due-done",c.number,"done");let d=h>c.from&&r.sliceDoc(h-1,h)===" "?1:0;n.push(j.replace({widget:p}).range(h-d,f))}}}}return j.set(n,!0)}function xO(){return Me.fromClass(class{decorations;constructor(t){this.decorations=QO(t,t.hasFocus)}update(t){(t.docChanged||t.viewportChanged||t.selectionSet||t.focusChanged)&&(this.decorations=QO(t.view,t.view.hasFocus))}},{decorations:t=>t.decorations,provide:t=>_.atomicRanges.of(e=>e.plugin(t)?.decorations??j.none)})}function $O(t,e){let r=t.state.doc.lineAt(e),n=r.text,s=pO(n,0,oe(new Date));s!==n&&t.dispatch({changes:{from:r.from,to:r.to,insert:s},userEvent:"input"})}var qn=null;function mm(t){if(ho.test(t))return t;let e=/^(\s*)(?:[-*+]\s+|\d+[.)]\s+)?(.*)$/.exec(t);return`${e[1]}- [ ] ${e[2]}`}function zn(t,e,r){qn?.();let n=e??t.state.selection.main.head,s=t.state.doc.lineAt(n).from,i=Yn(t.state.doc.lineAt(n).text),o=new Date,a=document.createElement("div");a.className="ivy-due-picker",a.setAttribute("role","dialog"),a.setAttribute("aria-label",S("\u8BBE\u7F6E\u65E5\u671F\u548C\u63D0\u9192","Date and reminder"));let l=document.createElement("div");l.className="ivy-due-quick";let c=document.createElement("input");c.type="date",c.className="ivy-due-input",c.setAttribute("aria-label",S("\u65E5\u671F","Date")),c.value=i?.due?.date??"";let O=document.createElement("input");O.type="time",O.className="ivy-due-input",O.setAttribute("aria-label",S("\u63D0\u9192\u65F6\u95F4","Reminder time")),O.value=i?.due?.time??"";let u=document.createElement("select");u.className="ivy-due-input",u.setAttribute("aria-label",S("\u91CD\u590D","Repeat"));let h=i?.repeat?.text??"";for(let[P,R,L]of uo){let q=document.createElement("option");q.value=P,q.textContent=He()?R:L,u.append(q)}if(h&&!uo.some(([P])=>P===h)){let P=document.createElement("option");P.value=h,P.textContent=Oo(i.repeat,He()),u.append(P)}u.value=h;for(let P of co(o)){let R=document.createElement("button");R.type="button",R.className="ivy-due-chip",R.textContent=He()?P.label[0]:P.label[1],R.addEventListener("click",()=>{c.value=P.due.date,O.value=P.due.time,x()}),l.append(R)}let f=(P,R)=>{let L=document.createElement("label");L.className="ivy-due-row";let q=document.createElement("span");return q.textContent=P,L.append(q,R),L},p=document.createElement("div");p.className="ivy-due-note",p.textContent=S("\u4E0D\u586B\u65F6\u95F4\uFF1A\u5F53\u5929\u6309\u8BBE\u7F6E\u4E2D\u7684\u65F6\u95F4\u63D0\u9192\u3002","No time: reminds on the day at the time set in Settings.");let d=document.createElement("div");d.className="ivy-due-actions";let g=document.createElement("button");g.type="button",g.className="ivy-due-btn",g.textContent=S("\u79FB\u9664\u65E5\u671F","Remove date"),g.hidden=!i?.due;let Q=document.createElement("button");Q.type="button",Q.className="ivy-due-btn ivy-due-ok",Q.textContent=S("\u786E\u5B9A","Done"),d.append(g,Q),a.append(l,f(S("\u65E5\u671F","Date"),c),f(S("\u65F6\u95F4","Time"),O),f(S("\u91CD\u590D","Repeat"),u),p,d);function b(P,R){let L=t.state.doc.lineAt(Math.min(s,t.state.doc.length)),q=mm(L.text),M=lo(q,P,P&&R||null);P||(M=M.replace(/\s+$/,"")),t.dispatch({changes:{from:L.from,to:L.to,insert:M},selection:{anchor:L.from+M.length},userEvent:"input"})}function x(){if(!c.value){E();return}b({date:c.value,time:O.value},u.value),E(),t.focus()}Q.addEventListener("click",x),g.addEventListener("click",()=>{b(null,null),E(),t.focus()}),a.addEventListener("keydown",P=>{P.key==="Escape"?(P.preventDefault(),E(),t.focus()):P.key==="Enter"&&P.target.tagName!=="BUTTON"&&(P.preventDefault(),x())}),document.body.append(a);let k=r?.getBoundingClientRect()??t.coordsAtPos(n)??{left:40,bottom:80,top:60},w=a.offsetWidth,y=a.offsetHeight,T=Math.min(Math.max(8,k.left),window.innerWidth-w-8),A=k.bottom+6;A+y>window.innerHeight-8&&(A=Math.max(8,k.top-y-6)),window.innerWidth<480&&(T=Math.max(8,(window.innerWidth-w)/2)),a.style.left=`${T}px`,a.style.top=`${A}px`;let C=P=>{a.contains(P.target)||E()};setTimeout(()=>document.addEventListener("mousedown",C,!0),0),setTimeout(()=>document.addEventListener("touchstart",C,!0),0);function E(){a.remove(),document.removeEventListener("mousedown",C,!0),document.removeEventListener("touchstart",C,!0),qn===E&&(qn=null)}qn=E,setTimeout(()=>(c.value?Q:l.querySelector("button"))?.focus({preventScroll:!0}),20)}function kO(t){let e=t.state.doc.lineAt(t.pos);if(!ho.test(e.text))return null;let r=e.text.slice(0,t.pos-e.from),n=/(^|\s)@([^@\n]{0,24})$/.exec(r);if(!n)return null;let s=n[2],i=t.pos-s.length-1,o=new Date,a=[],l=(c,O)=>{let u=Ln(c);a.some(h=>h.apply===u)||a.push({label:"@"+s,displayLabel:O,detail:c.time?`${c.date} ${c.time}`:c.date,apply:u,type:"text",boost:99-a.length})};if(s.trim()){let c=gO(s,o);if(!c)return null;l(c,"\u{1F4C5} "+_r(c,o,He())),c.time||l({...c,time:"09:00"},"\u{1F4C5} "+_r({...c,time:"09:00"},o,He()))}else for(let c of co(o))l(c.due,"\u{1F4C5} "+(He()?c.label[0]:c.label[1]));return{from:i,options:a,filter:!1}}var SO=null,yO="",gm=0,Kt=new Map;function po(){return typeof document<"u"&&document.documentElement.dataset.theme==="dark"?"dark":"neutral"}async function bm(){SO??=import("./chunks/mermaid.core-3W6VKKIW.js").then(r=>r.default);let t=await SO,e=po();return yO!==e&&(t.initialize({startOnLoad:!1,securityLevel:"strict",theme:e,fontFamily:"inherit"}),yO=e),t}async function Qm(t){let e=po()+` +`+t,r=Kt.get(e);if(r)return r;let n=await bm(),s=`ivy-mermaid-${++gm}`;try{let{svg:i}=await n.render(s,t);return Kt.size>64&&Kt.delete(Kt.keys().next().value),Kt.set(e,i),i}finally{document.getElementById("d"+s)?.remove(),document.getElementById(s)?.remove()}}function xm(t,e){return t.classList.add("mermaid-diagram"),t.setAttribute("role","img"),t.setAttribute("aria-label","Mermaid"),Qm(e).then(n=>{t.innerHTML=n,t.classList.remove("mermaid-error")},n=>{t.classList.add("mermaid-error"),t.textContent="Mermaid: "+String(n?.message??n).split(` +`)[0]})}var fo=class extends Oe{constructor(r){super();this.code=r}eq(r){return r.code===this.code}toDOM(){let r=document.createElement("div");r.className="cm-mermaid";let n=po()+` +`+this.code,s=Kt.get(n);return s?(r.classList.add("mermaid-diagram"),r.innerHTML=s):(r.classList.add("cm-mermaid-loading"),xm(r,this.code).finally(()=>r.classList.remove("cm-mermaid-loading"))),r}get estimatedHeight(){return 200}ignoreEvent(){return!1}};function $m(t){let e=[];return U(t).iterate({enter(r){if(r.name!=="FencedCode")return;let n=r.node.getChild("CodeInfo");if(!n||t.sliceDoc(n.from,n.to).trim().toLowerCase()!=="mermaid")return!1;let s=r.node.getChild("CodeText");return e.push({from:r.from,to:r.to,code:s?t.sliceDoc(s.from,s.to):""}),!1}}),e}function Mn(t,e,r){return t.selection.ranges.some(n=>n.from<=r&&n.to>=e)}var PO=re.define();function wO(t,e){let r=[];for(let n of $m(t)){if(e&&Mn(t,n.from,n.to)||!n.code.trim())continue;let s=t.doc.lineAt(n.from).from,i=t.doc.lineAt(n.to).to;r.push(j.replace({widget:new fo(n.code),block:!0}).range(s,i))}return j.set(r,!0)}function vO(){return[Xe.define({create:e=>({focused:!1,deco:wO(e,!1)}),update(e,r){let n=e.focused;for(let s of r.effects)s.is(PO)&&(n=s.value);return n!==e.focused||r.docChanged||r.selection||U(r.startState)!==U(r.state)?{focused:n,deco:wO(r.state,n)}:e},provide:e=>_.decorations.from(e,r=>r.deco)}),_.focusChangeEffect.of((e,r)=>PO.of(r)),_.domEventHandlers({mousedown(e,r){let n=e.target.closest(".cm-mermaid");if(!n)return!1;let s=r.posAtDOM(n),i=r.state.doc.lineAt(s);e.preventDefault();let o=i.number"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function Un(t){let e=t.trim();return e.startsWith("|")&&(e=e.slice(1)),e.endsWith("|")&&!e.endsWith("\\|")&&(e=e.slice(0,-1)),e.split(/(?r.trim().replace(/\\\|/g,"|"))}function Sm(t){let e=t.split(` +`).filter(s=>s.trim());if(e.length<2)return"";let r=Un(e[1]).map(s=>/^:-+:$/.test(s)?"center":/^-+:$/.test(s)?"right":""),n=(s,i)=>""+Un(s).map((o,a)=>`<${i}${r[a]?` style="text-align:${r[a]}"`:""}>${km(o)}`).join("")+"";return`${n(e[0],"th")}${e.slice(2).map(s=>n(s,"td")).join("")}
`}var mo=class extends Oe{constructor(r,n){super();this.src=r;this.render=n}eq(r){return r.src===this.src}toDOM(){let r=document.createElement("div");return r.className="cm-table prose-ivy",r.innerHTML=this.render(this.src),ym(r,this.src),r}ignoreEvent(){return!1}};function ym(t,e){let r=t.querySelector("table"),n=r?.querySelector("tbody");if(!r||!n)return;let s=e.split(` +`).filter(u=>u.trim()),i=s.slice(2).map(Un),o=Un(s[0]??"").length,a=Array.from({length:o},(u,h)=>oO(i.map(f=>f[h]??"")));if(a.some(Boolean)&&i.length>=2){let u=document.createElement("tfoot"),h=document.createElement("tr");h.className="cm-table-total";for(let f=0;f{let f=document.createElement("button");f.type="button",f.className="cm-table-sort",f.setAttribute("aria-label",S("\u6309\u6B64\u5217\u6392\u5E8F","Sort by this column")),f.textContent="\u2195",f.addEventListener("mousedown",p=>{p.preventDefault(),p.stopPropagation()}),f.addEventListener("click",p=>{p.preventDefault(),p.stopPropagation(),c!==h?(c=h,O=!1):O?c=-1:O=!0,r.querySelectorAll(".cm-table-sort").forEach(g=>{g.textContent="\u2195",g.classList.remove("on")});let d=l;if(c>=0){let g=Q=>Q.children[c]?.textContent??"";d=[...l].sort((Q,b)=>(O?-1:1)*aO(g(Q),g(b))),f.textContent=O?"\u2193":"\u2191",f.classList.add("on")}n.append(...d)}),u.append(f)})}function Pm(t){let e=[];return U(t).iterate({enter(r){if(r.name==="Table")return e.push({from:r.from,to:r.to}),!1;if(r.name==="FencedCode"||r.name==="CodeBlock")return!1}}),e}var ZO=re.define();function TO(t,e,r){return t.selection.ranges.some(n=>n.from<=r&&n.to>=e)}function XO(t,e,r){let n=[];for(let s of Pm(t)){if(e&&TO(t,s.from,s.to))continue;let i=t.doc.lineAt(s.from).from,o=t.doc.lineAt(s.to).to;n.push(j.replace({widget:new mo(t.sliceDoc(i,o),r),block:!0}).range(i,o))}return j.set(n,!0)}function RO(t,e,r,n){return!(n&&TO(t,e,r))}function jO(t){let e=n=>t.renderBlock?.(n)||Sm(n);return[Xe.define({create:n=>({focused:!1,deco:XO(n,!1,e)}),update(n,s){let i=n.focused;for(let o of s.effects)o.is(ZO)&&(i=o.value);return i!==n.focused||s.docChanged||s.selection||U(s.startState)!==U(s.state)?{focused:i,deco:XO(s.state,i,e)}:n},provide:n=>_.decorations.from(n,s=>s.deco)}),_.focusChangeEffect.of((n,s)=>ZO.of(s)),_.domEventHandlers({mousedown(n,s){let i=n.target.closest(".cm-table");if(!i)return!1;if(n.target.closest(".cm-table-sort"))return!0;let o=n.target.closest("a");if(n.preventDefault(),o?.dataset.note||o?.classList.contains("missing"))return t.openNote(o.dataset.note??"",o.dataset.title??o.textContent??"",n.button===1||n.shiftKey),!0;if(o?.href&&/^https?:/i.test(o.href))return window.open(o.href,"_blank","noopener"),!0;let a=s.posAtDOM(i),l=s.state.doc.lineAt(a),c=n.target.closest("tr"),O=[...i.querySelectorAll("tr")],u=c?O.indexOf(c):0;u>0&&u++;let h=s.state.doc.line(Math.min(l.number+Math.max(0,u),s.state.doc.lines));return s.dispatch({selection:{anchor:h.from+Math.min(2,h.length)}}),s.focus(),!0}})]}var wm=/^ivy:\/\/res\/([A-Za-z0-9_-]{8,64})/,go=class extends Oe{constructor(r,n,s){super();this.src=r;this.alt=n;this.kind=s}eq(r){return r.src===this.src&&r.alt===this.alt&&r.kind===this.kind}toDOM(){let r=document.createElement("span");if(r.className="cm-media",this.kind==="video"||this.kind==="audio"){let n=document.createElement(this.kind);n.src=this.src,n.controls=!0,n.preload="metadata",r.appendChild(n)}else if(this.kind==="file"){let n=document.createElement("a");n.className="cm-file-card",n.href=this.src,n.target="_blank",n.rel="noopener",n.textContent="\u{1F4CE} "+(this.alt||"file"),r.appendChild(n)}else{let n=document.createElement("img");n.src=this.src,n.alt=this.alt,n.loading="lazy",n.onerror=()=>r.classList.add("cm-media-broken"),r.appendChild(n)}return r}ignoreEvent(){return!1}},bo=class extends Oe{constructor(r,n){super();this.checked=r;this.pos=n}eq(r){return r.checked===this.checked&&r.pos===this.pos}toDOM(r){let n=document.createElement("input");return n.type="checkbox",n.className="cm-task",n.checked=this.checked,n.setAttribute("aria-label",this.checked?S("\u5DF2\u5B8C\u6210","Done"):S("\u5F85\u529E","To-do")),n.addEventListener("mousedown",s=>{s.preventDefault(),$O(r,this.pos)}),n}ignoreEvent(){return!0}},Qo=class extends Oe{toDOM(){let e=document.createElement("span");return e.className="cm-hr-widget",e}eq(){return!0}},xo=class extends Oe{toDOM(){let e=document.createElement("span");return e.className="cm-bullet",e.textContent="\u2022",e}eq(){return!0}},Le=j.replace({}),Wn=t=>j.line({class:t}),Ar=t=>j.mark({class:t});function vm(t){let e=new Set;for(let r of t.selection.ranges){let n=t.doc.lineAt(r.from).number,s=t.doc.lineAt(r.to).number;for(let i=n;i<=s;i++)e.add(i)}return e}function Zm(t,e,r){return t.selection.ranges.some(n=>n.from<=r&&n.to>=e)}var Xm=/\[\[([^[\]\n]+?)\]\]/g;function EO(t,e,r){let{state:n}=t,s=[],i=r?vm(n):new Set,o=h=>i.has(n.doc.lineAt(h).number),a=(h,f)=>r&&Zm(n,h,f),l=[],c=io(n),O=c&&!OO(n,c.from,c.to,r);if(c&&O)for(let h=1;h<=n.doc.lineAt(c.to).number;h++)s.push(Wn("cm-frontmatter").range(n.doc.line(h).from));for(let{from:h,to:f}of t.visibleRanges){U(n).iterate({from:h,to:f,enter(d){let g=d.name;if(c&&g!=="Document"&&d.to<=c.to)return!1;let Q=/^ATXHeading(\d)$/.exec(g);if(Q){let b=n.doc.lineAt(d.from);if(s.push(Wn(`cm-h cm-h${Q[1]}`).range(b.from)),!o(d.from)){let x=d.node.getChild("HeaderMark");x&&s.push(Le.range(x.from,Math.min(x.to+1,b.to)))}return}switch(g){case"Table":return RO(n,d.from,d.to,r)?!1:void 0;case"FencedCode":case"CodeBlock":{l.push([d.from,d.to]);let b=d.node.getChild("CodeInfo"),x=d.node.getChild("CodeText");if(b&&x&&n.sliceDoc(b.from,b.to).trim().toLowerCase()==="mermaid"&&n.sliceDoc(x.from,x.to).trim()&&!(r&&Mn(n,d.from,d.to))||b&&n.sliceDoc(b.from,b.to).trim().toLowerCase()==="ivy-query"&&!(r&&Mn(n,d.from,d.to)))return!1;let k=n.doc.lineAt(d.from).number,w=n.doc.lineAt(d.to).number;if(g==="FencedCode"&&!a(d.from,d.to)){let y=n.doc.line(k),T=n.doc.line(w);y.to>y.from&&s.push(Le.range(y.from,y.to)),w!==k&&T.to>T.from&&/^\s*(```|~~~)/.test(T.text)&&s.push(Le.range(T.from,T.to))}for(let y=k;y<=w;y++){let T=n.doc.line(y),A="cm-codeblock";y===k&&(A+=" cm-codeblock-first"),y===w&&(A+=" cm-codeblock-last"),s.push(Wn(A).range(T.from))}return!1}case"StrongEmphasis":case"Emphasis":case"Strikethrough":case"InlineCode":{let b=g==="StrongEmphasis"?"cm-strong":g==="Emphasis"?"cm-em":g==="Strikethrough"?"cm-strike":"cm-inline-code";if(s.push(Ar(b).range(d.from,d.to)),!a(d.from,d.to)){let x=g==="InlineCode"?"CodeMark":g==="Strikethrough"?"StrikethroughMark":"EmphasisMark",k=d.node.firstChild;for(;k;)k.name===x&&s.push(Le.range(k.from,k.to)),k=k.nextSibling}return g!=="InlineCode"}case"Link":{if(a(d.from,d.to))return;let b=d.node.getChildren("LinkMark"),x=d.node.getChild("URL");return b.length>=2&&(s.push(Le.range(b[0].from,b[0].to)),s.push(Ar("cm-link").range(b[0].to,b[1].from)),s.push(Le.range(b[1].from,d.to))),!1}case"Image":{let b=d.node.getChild("URL");if(!b)return!1;let x=n.sliceDoc(b.from,b.to),k=wm.exec(x),w=k?e.resolveResource(k[1]):x,y=k?e.resourceKind(k[1]):void 0,T=d.node.getChildren("LinkMark"),A=T.length>=2?n.sliceDoc(T[0].to,T[1].from):"";if(!w||/^javascript:/i.test(w))return!1;let C=new go(w,A,y);return o(d.from)?s.push(j.widget({widget:C,side:1}).range(d.to)):s.push(j.replace({widget:C}).range(d.from,d.to)),!1}case"Blockquote":{let b=n.doc.lineAt(d.from).number,x=n.doc.lineAt(d.to).number;for(let k=b;k<=x;k++)s.push(Wn("cm-quote").range(n.doc.line(k).from));return}case"QuoteMark":{if(!o(d.from)){let b=n.sliceDoc(d.to,d.to+1)===" "?d.to+1:d.to;s.push(Le.range(d.from,b))}return}case"HorizontalRule":{o(d.from)||s.push(j.replace({widget:new Qo}).range(d.from,d.to));return}case"ListMark":{let b=n.sliceDoc(d.from,d.to),x=b==="-"||b==="*"||b==="+",k=n.sliceDoc(d.to,d.to+4),w=/^ \[[ xX]\]/.test(k);x&&!o(d.from)?w?s.push(Le.range(d.from,d.to+1)):s.push(j.replace({widget:new xo}).range(d.from,d.to)):s.push(Ar("cm-list-mark").range(d.from,d.to));return}case"TaskMarker":{let b=/x/i.test(n.sliceDoc(d.from,d.to));if(!a(d.from,d.to)&&(s.push(j.replace({widget:new bo(b,d.from)}).range(d.from,d.to)),b)){let x=n.doc.lineAt(d.from);d.to+1g>=T&&Q<=A))continue;let b=d[1],x=b.indexOf("|"),k=(x>=0?b.slice(0,x):b).split("#")[0].trim(),w=!!e.resolveTitle(k),y={"data-wiki":k};if(a(g,Q)){s.push(j.mark({class:"cm-wikilink cm-wikilink-src"+(w?"":" cm-wikilink-missing"),attributes:y}).range(g,Q));continue}s.push(Le.range(g,g+2+(x>=0?x+1:0))),s.push(j.mark({class:"cm-wikilink cm-wikilink-rendered"+(w?"":" cm-wikilink-missing"),attributes:y}).range(g+2+(x>=0?x+1:0),Q-2)),s.push(Le.range(Q-2,Q))}}let u=s.filter(h=>h.value.point===!0);return{all:j.set(s,!0),atomic:j.set(u,!0)}}function _O(t){let e=Me.fromClass(class{decorations;atomic;constructor(r){let n=EO(r,t,r.hasFocus);this.decorations=n.all,this.atomic=n.atomic}update(r){if(r.docChanged||r.viewportChanged||r.selectionSet||r.focusChanged||U(r.startState)!==U(r.state)){let n=EO(r.view,t,r.view.hasFocus);this.decorations=n.all,this.atomic=n.atomic}}},{decorations:r=>r.decorations,eventHandlers:{mousedown(r,n){let s=r.target.closest(".cm-wikilink");if(!s)return!1;let i=s.classList.contains("cm-wikilink-rendered"),o=r.button===1||r.shiftKey;if(r.button>1||!i&&!(r.metaKey||r.ctrlKey||r.button===1))return!1;let a=s.dataset.wiki??"";return r.preventDefault(),t.openNote(t.resolveTitle(a),a,o),!0},click(r){let n=r.target.closest(".cm-link, .cm-file-card");return n&&(r.metaKey||r.ctrlKey)&&n instanceof HTMLAnchorElement?(window.open(n.href,"_blank","noopener"),!0):!1}}});return[e,vO(),jO(t),uO(t),xO(),_.atomicRanges.of(r=>r.plugin(e)?.atomic??j.none)]}var CO=_.theme({"&":{color:"rgb(var(--ink))",backgroundColor:"transparent",height:"100%"},"&.cm-focused":{outline:"none"},".cm-scroller":{fontFamily:"inherit",lineHeight:"1.85",overflow:"visible"},".cm-content":{padding:"0 0 40vh",caretColor:"rgb(var(--ivy))"},".cm-line":{padding:"0"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"rgb(var(--ivy))",borderLeftWidth:"2px"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, ::selection":{backgroundColor:"rgb(var(--ivy) / 0.2) !important"},".cm-placeholder":{color:"rgb(var(--faint))"},".cm-tooltip":{border:"none",backgroundColor:"rgb(var(--surface))",borderRadius:"14px",boxShadow:"var(--shadow-lift)",overflow:"hidden"},".cm-tooltip-autocomplete > ul":{fontFamily:"inherit",maxHeight:"260px",padding:"4px"},".cm-tooltip-autocomplete > ul > li":{padding:"7px 10px",borderRadius:"10px",lineHeight:"1.4"},".cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:"rgb(var(--sunken))",color:"rgb(var(--ink))"},".cm-completionDetail":{marginLeft:"8px",color:"rgb(var(--muted))",fontStyle:"normal",fontSize:"12px"},".cm-completionIcon":{display:"none"},".cm-panels":{backgroundColor:"rgb(var(--surface))",color:"rgb(var(--ink))",border:"none"},".cm-searchMatch":{backgroundColor:"rgb(var(--warn) / 0.3)"},".cm-searchMatch-selected":{backgroundColor:"rgb(var(--warn) / 0.55)"}}),AO=$a(xa.define([{tag:m.heading,fontWeight:"600"},{tag:m.strong,fontWeight:"600"},{tag:m.emphasis,fontStyle:"italic"},{tag:m.strikethrough,textDecoration:"line-through"},{tag:m.link,color:"rgb(var(--ivy))"},{tag:m.url,color:"rgb(var(--ivy))"},{tag:m.monospace,fontFamily:"var(--font-mono)",color:"rgb(var(--warn-ink))"},{tag:m.quote,color:"rgb(var(--ink-2))"},{tag:[m.processingInstruction,m.contentSeparator,m.meta],color:"rgb(var(--faint))"},{tag:m.labelName,color:"rgb(var(--muted))"}]));function LO(t){return e=>{let r=e.matchBefore(/\[\[[^\]\n|#]*$/);if(!r)return null;let n=r.text.slice(2).toLowerCase(),s=e.state.sliceDoc(e.pos,e.pos+2),i=[],o=new Set;for(let a of t())if(!(!a.title||o.has(a.title))&&(o.add(a.title),!(n&&!a.title.toLowerCase().includes(n))&&(i.push({label:a.title,detail:a.detail,type:"text",boost:a.title.toLowerCase().startsWith(n)?1:0,apply:(l,c,O,u)=>{let h=s==="]]"?"":"]]";l.dispatch({changes:{from:O,to:u,insert:c.label+h},selection:{anchor:O+c.label.length+2}})}}),i.length>=50)))break;if(n&&!o.has(r.text.slice(2))){let a=r.text.slice(2);i.push({label:a,detail:S("\u65B0\u5EFA\u94FE\u63A5","New link"),type:"keyword",boost:-1,apply:(l,c,O,u)=>l.dispatch({changes:{from:O,to:u,insert:a+(s==="]]"?"":"]]")},selection:{anchor:O+a.length+2}})})}return{from:r.from+2,options:i,validFor:/^[^\]\n|#]*$/}}}function $o(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}var Vn=t=>t?`"${t}" `:"";function In(t,e=""){if(typeof t!="boolean")throw new TypeError(Vn(e)+"expected boolean, got type="+typeof t);return t}function ct(t,e=""){if(typeof t!="number")throw new TypeError(Vn(e)+"expected number, got "+typeof t);if(!Number.isSafeInteger(t)||t<0)throw new RangeError(Vn(e)+"expected integer >= 0, got "+t);return t}function te(t,e,r=""){if($o(t)&&(e===void 0||t.length===e))return t;e!==void 0&&ct(e,"length");let n=$o(t),s=e!==void 0?` of length ${e}`:"",i=n?`length=${t.length}`:`type=${typeof t}`,o=Vn(r)+"expected Uint8Array"+s+", got "+i;throw n?new RangeError(o):new TypeError(o)}var YO=(t,e)=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError(e==="object"?"expected valid options object":`"${e}" expected object, got type=${typeof t}`)};function ko(t,e=!0){if(t.destroyed)throw new Error("hash was destroyed");if(e&&t.finished)throw new Error("digest() was already called")}function qO(t,e){te(t,void 0,"output");let r=e.outputLen;if(!(t.length>=r))throw new RangeError('"output" expected length >= '+r)}function Ye(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function we(...t){for(let e=0;e>>8&65280|t>>>24&255}function jm(t){for(let e=0;et:jm;function Em(t,e){return!t.byteLength||!e.byteLength?!1:t.buffer===e.buffer&&t.byteOffset[]),i=(a,l)=>n(l,...s(a)).update(a).digest(),o=n(new Uint8Array(t),...s(new Uint8Array(0)));return i.outputLen=o.outputLen,i.blockLen=o.blockLen,i.create=(a,...l)=>n(a,...l),i}var VO=(t,e)=>{function r(n,...s){if(te(n,void 0,"key"),t.nonceLength!==void 0){let u=s[0];te(u,t.varSizeNonce?void 0:t.nonceLength,"nonce")}let i=t.tagLength,o=t.nonceLength!==void 0?1:0;if(!t.withAAD){for(let u=o;u{if(h!==void 0){if(u!==2)throw new Error("cipher output not supported");te(h,void 0,"output")}},c=!1;return{encrypt(u,h){if(c)throw new Error("cannot encrypt() twice with same key + nonce");return c=!0,te(u,void 0,"data"),l(a.encrypt.length,h),a.encrypt(u,h)},decrypt(u,h){if(te(u,void 0,"data"),i&&u.length= tagLength='+i);return l(a.decrypt.length,h),a.decrypt(u,h)}}}return Object.assign(r,t),r};function Lr(t,e,r=!0){if(e===void 0)return new Uint8Array(t);if(te(e,t,"output"),r&&!Yr(e))throw new Error("invalid output, must be aligned");return e}function IO(t,e,r){ct(t),ct(e),In(r);let n=new Uint8Array(16),s=Tm(n);return s.setBigUint64(0,BigInt(e),r),s.setBigUint64(8,BigInt(t),r),n}function Yr(t){return t.byteOffset%4===0}function Jt(t){return Uint8Array.from(te(t))}function Dn(t=32){ct(t,"bytesLength");let e=typeof globalThis=="object"?globalThis.crypto:null;if(typeof e?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(t>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${t}`);return e.getRandomValues(new Uint8Array(t))}var GO=t=>Uint8Array.from(t.split(""),e=>e.charCodeAt(0)),_m=ve(Ye(GO("expand 16-byte k"))),Cm=ve(Ye(GO("expand 32-byte k")));function V(t,e){return t<>>32-e}var qr=64,Am=16,So=2**32-1,DO=Uint32Array.of();function Lm(t,e,r,n,s,i,o,a){let l=s.length,c=new Uint8Array(qr),O=Ye(c),u=Re&&Yr(s)&&Yr(i),h=u?Ye(s):DO,f=u?Ye(i):DO;if(!Re){for(let p=0;p=So)throw new Error("arx: counter overflow");let d=Math.min(qr,l-p);for(let g=0,Q;g=So)throw new Error("arx: counter overflow");let d=Math.min(qr,l-p);if(u&&d===qr){let g=p/4;if(p%4!==0)throw new Error("arx: invalid block position");for(let Q=0,b;Q{te(a,void 0,"key"),te(l,void 0,"nonce"),te(c,void 0,"data");let h=c.length,f=O!==void 0;if(O=Lr(h,O,!1),f&&zO(c,O),ct(u),u<0||u>=So)throw new Error("arx: counter overflow");let p=[],d=a.length,g,Q;if(d===32)p.push(g=Jt(a)),Q=Cm;else if(d===16&&r)g=new Uint8Array(32),g.set(a),g.set(a,16),Q=_m,p.push(g);else throw te(a,32,"arx key"),new Error("invalid key size");(!Re||!Yr(l))&&p.push(l=Jt(l));let b=Ye(g);if(n){if(l.length!==24)throw new Error("arx: extended nonce must be 24 bytes");let w=l.subarray(0,16);if(Re)n(Q,b,Ye(w),b);else{let y=ve(Uint32Array.from(Q));n(y,b,Ye(w),b),we(y),ve(b)}l=l.subarray(16)}else Re||ve(b);let x=16-s;if(x!==l.length)throw new Error(`arx: nonce must be ${x} or 16 bytes`);if(x!==12){let w=new Uint8Array(12);w.set(l,i?0:12-l.length),l=w,p.push(l)}let k=ve(Ye(l));try{return Lm(t,Q,b,k,c,O,u,o),O}finally{we(...p)}}}function ce(t,e){return t[e++]&255|(t[e++]&255)<<8}var yo=class{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=!1;destroyed=!1;constructor(e){e=Jt(te(e,32,"key"));let r=ce(e,0),n=ce(e,2),s=ce(e,4),i=ce(e,6),o=ce(e,8),a=ce(e,10),l=ce(e,12),c=ce(e,14);this.r[0]=r&8191,this.r[1]=(r>>>13|n<<3)&8191,this.r[2]=(n>>>10|s<<6)&7939,this.r[3]=(s>>>7|i<<9)&8191,this.r[4]=(i>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|a<<2)&8191,this.r[7]=(a>>>11|l<<5)&8065,this.r[8]=(l>>>8|c<<8)&8191,this.r[9]=c>>>5&127;for(let O=0;O<8;O++)this.pad[O]=ce(e,16+2*O)}process(e,r,n=!1){let s=n?0:2048,{h:i,r:o}=this,a=o[0],l=o[1],c=o[2],O=o[3],u=o[4],h=o[5],f=o[6],p=o[7],d=o[8],g=o[9],Q=ce(e,r+0),b=ce(e,r+2),x=ce(e,r+4),k=ce(e,r+6),w=ce(e,r+8),y=ce(e,r+10),T=ce(e,r+12),A=ce(e,r+14),C=i[0]+(Q&8191),E=i[1]+((Q>>>13|b<<3)&8191),P=i[2]+((b>>>10|x<<6)&8191),R=i[3]+((x>>>7|k<<9)&8191),L=i[4]+((k>>>4|w<<12)&8191),q=i[5]+(w>>>1&8191),M=i[6]+((w>>>14|y<<2)&8191),D=i[7]+((y>>>11|T<<5)&8191),G=i[8]+((T>>>8|A<<8)&8191),N=i[9]+(A>>>5|s),v=0,B=v+C*a+E*(5*g)+P*(5*d)+R*(5*p)+L*(5*f);v=B>>>13,B&=8191,B+=q*(5*h)+M*(5*u)+D*(5*O)+G*(5*c)+N*(5*l),v+=B>>>13,B&=8191;let F=v+C*l+E*a+P*(5*g)+R*(5*d)+L*(5*p);v=F>>>13,F&=8191,F+=q*(5*f)+M*(5*h)+D*(5*u)+G*(5*O)+N*(5*c),v+=F>>>13,F&=8191;let J=v+C*c+E*l+P*a+R*(5*g)+L*(5*d);v=J>>>13,J&=8191,J+=q*(5*p)+M*(5*f)+D*(5*h)+G*(5*u)+N*(5*O),v+=J>>>13,J&=8191;let ze=v+C*O+E*c+P*l+R*a+L*(5*g);v=ze>>>13,ze&=8191,ze+=q*(5*d)+M*(5*p)+D*(5*f)+G*(5*h)+N*(5*u),v+=ze>>>13,ze&=8191;let Rt=v+C*u+E*O+P*c+R*l+L*a;v=Rt>>>13,Rt&=8191,Rt+=q*(5*g)+M*(5*d)+D*(5*p)+G*(5*f)+N*(5*h),v+=Rt>>>13,Rt&=8191;let jt=v+C*h+E*u+P*O+R*c+L*l;v=jt>>>13,jt&=8191,jt+=q*a+M*(5*g)+D*(5*d)+G*(5*p)+N*(5*f),v+=jt>>>13,jt&=8191;let Et=v+C*f+E*h+P*u+R*O+L*c;v=Et>>>13,Et&=8191,Et+=q*l+M*a+D*(5*g)+G*(5*d)+N*(5*p),v+=Et>>>13,Et&=8191;let _t=v+C*p+E*f+P*h+R*u+L*O;v=_t>>>13,_t&=8191,_t+=q*c+M*l+D*a+G*(5*g)+N*(5*d),v+=_t>>>13,_t&=8191;let Ct=v+C*d+E*p+P*f+R*h+L*u;v=Ct>>>13,Ct&=8191,Ct+=q*O+M*c+D*l+G*a+N*(5*g),v+=Ct>>>13,Ct&=8191;let At=v+C*g+E*d+P*p+R*f+L*h;v=At>>>13,At&=8191,At+=q*u+M*O+D*c+G*l+N*a,v+=At>>>13,At&=8191,v=(v<<2)+v|0,v=v+B|0,B=v&8191,v=v>>>13,F+=v,i[0]=B,i[1]=F,i[2]=J,i[3]=ze,i[4]=Rt,i[5]=jt,i[6]=Et,i[7]=_t,i[8]=Ct,i[9]=At}finalize(){let{h:e,pad:r}=this,n=new Uint16Array(10),s=e[1]>>>13;e[1]&=8191;for(let a=2;a<10;a++)e[a]+=s,s=e[a]>>>13,e[a]&=8191;e[0]+=s*5,s=e[0]>>>13,e[0]&=8191,e[1]+=s,s=e[1]>>>13,e[1]&=8191,e[2]+=s,n[0]=e[0]+5,s=n[0]>>>13,n[0]&=8191;for(let a=1;a<10;a++)n[a]=e[a]+s,s=n[a]>>>13,n[a]&=8191;n[9]-=8192;let i=(s^1)-1;for(let a=0;a<10;a++)n[a]&=i;i=~i;for(let a=0;a<10;a++)e[a]=e[a]&i|n[a];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let o=e[0]+r[0];e[0]=o&65535;for(let a=1;a<8;a++)o=(e[a]+r[a]|0)+(o>>>16)|0,e[a]=o&65535;we(n)}update(e){ko(this),te(e),e=Jt(e);let{buffer:r,blockLen:n}=this,s=e.length;for(let i=0;i>>0,e[i++]=n[o]>>>8}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}},BO=WO(32,t=>new yo(t));function KO(t,e,r,n,s,i=20){let o=t[0],a=t[1],l=t[2],c=t[3],O=e[0],u=e[1],h=e[2],f=e[3],p=e[4],d=e[5],g=e[6],Q=e[7],b=s,x=r[0],k=r[1],w=r[2],y=o,T=a,A=l,C=c,E=O,P=u,R=h,L=f,q=p,M=d,D=g,G=Q,N=b,v=x,B=k,F=w;for(let ze=0;ze{t.update(e);let r=e.length%16;r&&t.update(zm.subarray(r))},Mm=new Uint8Array(32);function HO(t,e,r,n,s){s!==void 0&&te(s,void 0,"AAD");let i=t(e,r,Mm),o=IO(n.length,s?s.length:0,!0),a=BO.create(i);s&&FO(a,s),FO(a,n),a.update(o);let l=a.digest();return we(i,o),l}var Um=t=>(e,r,n)=>({encrypt(i,o){let a=i.length;o=Lr(a+16,o,!1),o.set(i);let l=o.subarray(0,-16);t(e,r,l,l,1);let c=HO(t,e,r,l,n);return o.set(c,a),we(c),o},decrypt(i,o){o=Lr(i.length-16,o,!1);let a=i.subarray(0,-16),l=i.subarray(-16),c=HO(t,e,r,a,n);if(!UO(l,c))throw we(c),new Error("invalid tag");return o.set(i.subarray(0,-16)),t(e,r,o,o,1),we(c),o}});var Po=VO({blockSize:64,nonceLength:24,tagLength:16,withAAD:!0},Um(qm));function JO(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}var wo=t=>t?`"${t}" `:"";function he(t,e=""){if(typeof t!="number")throw new TypeError(wo(e)+"expected number, got "+typeof t);if(!Number.isSafeInteger(t)||t<0)throw new RangeError(wo(e)+"expected integer >= 0, got "+t);return t}function er(t,e,r=""){if(JO(t)&&(e===void 0||t.length===e))return t;e!==void 0&&he(e,"length");let n=JO(t),s=e!==void 0?` of length ${e}`:"",i=n?`length=${t.length}`:`type=${typeof t}`,o=wo(r)+"expected Uint8Array"+s+", got "+i;throw n?new RangeError(o):new TypeError(o)}function Gn(t){if(typeof t!="function"||typeof t.create!="function")throw new TypeError("expected hash wrapped by utils.createHasher");if(he(t.outputLen),he(t.blockLen),t.outputLen<1||t.blockLen<1)throw new Error("hash blockLen / outputLen must be >= 1")}var Wm=(t,e)=>{if(t===null||typeof t!="object"||Array.isArray(t))throw new TypeError((e==="object"?"":`"${e}" `)+"expected object, got type="+typeof t)},eu=(t,e)=>{Wm(t,e);let r=Object.getPrototypeOf(t);if(r!==Object.prototype&&r!==null)throw new TypeError(`"${e}" expected plain object`);if(Object.hasOwn(t,"__proto__"))throw new TypeError(`"${e}.__proto__" is not allowed`)};function tr(t,e=!0){if(t.destroyed)throw new Error("hash was destroyed");if(e&&t.finished)throw new Error("digest() was already called")}function Nn(t,e){er(t,void 0,"output");let r=e.outputLen;if(!(t.length>=r))throw new RangeError('"output" expected length >= '+r)}function Bn(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function xe(...t){for(let e=0;e>>e}function I(t,e){return t<>>32-e>>>0}var Vm=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Im(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function Dm(t){for(let e=0;et:Dm;function Gm(t){let e=globalThis;if(typeof e.scheduler?.yield=="function"){let r=e.scheduler.yield();return t&&r.catch(t),r}return new Promise(r=>e.setTimeout(r,0))}async function Fn(t,e,r,n){if(he(t,"iters"),he(e,"tick"),typeof r!="function")throw new TypeError("callback must be a function");let s=Date.now();for(let i=0;i=0&&o= 1');if(o<1)throw new Error('"dkLen" must be >= 1');if(o>(2**32-1)*t.outputLen)throw new Error("derived key too long");let l=Zo(e,"password");try{let c=Zo(r,"salt");try{let O=new Uint8Array(o),{iHash:u,oHash:h,outputLen:f}=nu.create(t,l),p=new Uint8Array(f),d=Fm(u,h,c,p);return{c:i,dkLen:o,asyncTick:a,DK:O,outputLen:f,eng:d}}finally{typeof r=="string"&&xe(c)}}finally{typeof e=="string"&&xe(l)}}function Fm(t,e,r,n){let s=new Uint8Array(4),i=rr(s),o=t._cloneInto().update(r),a=e._cloneInto(),l=t._cloneInto,c=e._cloneInto;return{u1:(O,u)=>{i.setInt32(0,O,!1),o._cloneInto(a).update(s).digestInto(n),e._cloneInto(a).update(n).digestInto(n),u.set(n.subarray(0,u.length))},rounds:(O,u)=>{for(let h=1;h(t.destroy(),e.destroy(),o.destroy(),a.destroy(),xe(n),O)}}function Xo(t,e,r,n){let{c:s,dkLen:i,DK:o,outputLen:a,eng:l}=Bm(t,e,r,n);for(let c=1,O=0;Ot/2**32|0,Km=t=>t>>>0;function su(t,e,r,n){let s=Hm(r),i=Km(r);t.setUint32(e,n?i:s,n),t.setUint32(e+4,n?s:i,n)}function iu(t,e,r){return t&e^~t&r}function ou(t,e,r){return t&e^t&r^e&r}var Kn=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,r,n,s){this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=s,this.buffer=new Uint8Array(e),this.view=rr(this.buffer)}update(e){tr(this),er(e);let{view:r,buffer:n,blockLen:s}=this,i=e.length,o=!1;for(let a=0;as-o&&(this.process(n,0),r.fill(0)),su(n,s-8,this.length*8,i),this.process(n,0),this.roundClean();let a=e===r?n:rr(e),l=this.outputLen,c=l/4,O=this.get();if(l%4||c>O.length)throw new Error("invalid outputLen");for(let u=0;u>>3,d=_e(f,17)^_e(f,19)^f>>>10;Ot[u]=d+Ot[u-7]+p+Ot[u-16]|0}let{A:n,B:s,C:i,D:o,E:a,F:l,G:c,H:O}=this;for(let u=0;u<64;u++){let h=_e(a,6)^_e(a,11)^_e(a,25),f=O+h+iu(a,l,c)+Jm[u]+Ot[u]|0,d=(_e(n,2)^_e(n,13)^_e(n,22))+ou(n,s,i)|0;O=c,c=l,l=a,a=o+f|0,o=i,i=s,s=n,n=f+d|0}n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,c=c+this.G|0,O=O+this.H|0,this.set(n,s,i,o,a,l,c,O)}roundClean(){xe(Ot)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),xe(this.buffer)}},Ro=class extends To{constructor(){super(32,au)}};var jo=tu(()=>new Ro,ru(1));function lu(t,e,r,n,s,i){let o=t[e++]^r[n++],a=t[e++]^r[n++],l=t[e++]^r[n++],c=t[e++]^r[n++],O=t[e++]^r[n++],u=t[e++]^r[n++],h=t[e++]^r[n++],f=t[e++]^r[n++],p=t[e++]^r[n++],d=t[e++]^r[n++],g=t[e++]^r[n++],Q=t[e++]^r[n++],b=t[e++]^r[n++],x=t[e++]^r[n++],k=t[e++]^r[n++],w=t[e++]^r[n++],y=o,T=a,A=l,C=c,E=O,P=u,R=h,L=f,q=p,M=d,D=g,G=Q,N=b,v=x,B=k,F=w;for(let J=0;J<8;J+=2)E^=I(y+N|0,7),q^=I(E+y|0,9),N^=I(q+E|0,13),y^=I(N+q|0,18),M^=I(P+T|0,7),v^=I(M+P|0,9),T^=I(v+M|0,13),P^=I(T+v|0,18),B^=I(D+R|0,7),A^=I(B+D|0,9),R^=I(A+B|0,13),D^=I(R+A|0,18),C^=I(F+G|0,7),L^=I(C+F|0,9),G^=I(L+C|0,13),F^=I(G+L|0,18),T^=I(y+C|0,7),A^=I(T+y|0,9),C^=I(A+T|0,13),y^=I(C+A|0,18),R^=I(P+E|0,7),L^=I(R+P|0,9),E^=I(L+R|0,13),P^=I(E+L|0,18),G^=I(D+M|0,7),q^=I(G+D|0,9),M^=I(q+G|0,13),D^=I(M+q|0,18),N^=I(F+B|0,7),v^=I(N+F|0,9),B^=I(v+N|0,13),F^=I(B+v|0,18);s[i++]=o+y|0,s[i++]=a+T|0,s[i++]=l+A|0,s[i++]=c+C|0,s[i++]=O+E|0,s[i++]=u+P|0,s[i++]=h+R|0,s[i++]=f+L|0,s[i++]=p+q|0,s[i++]=d+M|0,s[i++]=g+D|0,s[i++]=Q+G|0,s[i++]=b+N|0,s[i++]=x+v|0,s[i++]=k+B|0,s[i++]=w+F|0}function Eo(t,e,r,n,s){let i=n+0,o=n+16*s;for(let a=0;a<16;a++)r[o+a]=t[e+(2*s-1)*16+a];for(let a=0;a0&&(o+=16),lu(r,i,t,e+=16,r,o)}var eg=1024*(2**20+1+1);function tg(t,e,r){let n=zr({dkLen:32,asyncTick:10,maxmem:eg},r),{N:s,r:i,p:o,dkLen:a,asyncTick:l,maxmem:c,onProgress:O}=n;if(he(s,"N"),he(i,"r"),he(o,"p"),he(a,"dkLen"),he(l,"asyncTick"),he(c,"maxmem"),O!==void 0&&typeof O!="function")throw new Error('"onProgress" must be a function');if(i<1)throw new Error('"r" expected integer >= 1');let u=128*i,h=u/4,f=Math.pow(2,32);if(s<=1||(s&s-1)!==0||s>f)throw new Error('"N" expected a power of 2, and 2^1 <= N <= 2^32');if(o<1||o>(f-1)*32/u)throw new Error('"p" expected integer 1..((2^32 - 1) * 32) / (128 * r)');if(a<1||a>(f-1)*32)throw new Error('"dkLen" expected integer 1..(2^32 - 1) * 32');let p=u*(s+o+1);if(p>c)throw new Error('"maxmem" limit was hit: memUsed(128*r*(N+p+1))='+p+", maxmem="+c);let d=Xo(jo,t,e,{c:1,dkLen:u*o}),g=Bn(d),Q=Bn(new Uint8Array(u*s)),b=Bn(new Uint8Array(u)),x=()=>{};if(O){let k=2*s*o,w=Math.max(Math.floor(k/1e4),1),y=0;x=()=>{if(y++,O&&(!(y%w)||y===k))try{O(y/k)}catch(T){throw xe(d,Q,b),T}}}return{N:s,r:i,p:o,dkLen:a,blockSize32:h,V:Q,B32:g,B:d,tmp:b,blockMixCb:x,asyncTick:l}}function rg(t,e,r,n,s){let i=Xo(jo,t,r,{c:1,dkLen:e});return xe(r,n,s),i}async function cu(t,e,r){let{N:n,r:s,p:i,dkLen:o,blockSize32:a,V:l,B32:c,B:O,tmp:u,blockMixCb:h,asyncTick:f}=tg(t,e,r),p=()=>xe(O,l,u);vo(c);for(let d=0;d{Eo(l,Q,l,Q+=a,s),h()},p),Eo(l,(n-1)*a,c,g,s),h(),await Fn(n,f,()=>{let b=(c[g+a-16]&n-1)>>>0;for(let x=0;x=0&&(r=e.slice(s+1).trim(),e=e.slice(0,s));let i=e.indexOf("#");return i>=0&&(n=e.slice(i+1).trim(),e=e.slice(0,i)),{target:e.trim(),alias:r,heading:n}}function uu(t){return[...new Set([...t.matchAll(ng)].map(e=>e[1]))]}var hu="ivy-encrypted",sg="This note is encrypted. Open it in ivyNote and enter its password.",_o="```",fu=/^\s*```ivy-encrypted[ \t]*\n([\s\S]*?)\n```[ \t]*\s*$/,du={N:32768,r:8,p:1},ig=du;var wt=4,og=10*6e4,ut=class extends Error{constructor(){super("wrong password"),this.name="WrongPasswordError"}},Mr=class extends Error{constructor(e){super("broken encrypted note: "+e),this.name="BrokenEnvelopeError"}};function Ur(t){return t?t.trimStart().startsWith(_o+hu)&&fu.test(t):!1}function es(t){let e="";for(let r=0;r/^[A-Za-z0-9_-]{8,64}$/.test(o)),data:r.data}}function mu(t){return Wr(t)?.hint??""}function ag(t,e,r,n){let s=[sg,"v: 1",`kdf: scrypt N=${t.N} r=${t.r} p=${t.p}`,`salt: ${e}`];return r&&s.push(`hint: ${es(ns.encode(r))}`),n.length&&s.push(`refs: ${n.join(" ")}`),s}function gu(t,e,r,n){return ns.encode(["ivy:note:v1",`scrypt N=${t.N} r=${t.r} p=${t.p}`,e,r,n.join(" ")].join("|"))}function lg(t){return Number.isInteger(t.N)&&t.N>=1024&&t.N<=1<<20&&(t.N&t.N-1)===0&&t.r>=1&&t.r<=16&&t.p>=1&&t.p<=4&&t.N*t.r*128<=256*1024*1024}async function bu(t,e,r=du,n=""){if(!lg(r))throw new Mr("kdf");return{bytes:await cu(ns.encode(t.normalize("NFC")),ts(e),{...r,dkLen:32,maxmem:300*1024*1024}),salt:e,kdf:r,hint:n}}async function Co(t,e=""){if(t.lengthDate.now();function is(t){nr.set(t.salt,{key:t,used:rs()})}function cg(t){let e=Wr(t);if(!e)return null;let r=nr.get(e.salt);return r?rs()-r.used>og?(nr.delete(e.salt),null):xu(e,r.key)?(r.used=rs(),r.key):null:null}function ku(t){let e=nr.get(t.salt);e&&(e.used=rs())}function Ao(t){let e=cg(t);if(!e)return null;try{return{plain:ss(t,e),key:e}}catch{return null}}function Vr(t){t===void 0?nr.clear():nr.delete(typeof t=="string"?Wr(t)?.salt??t:t.salt)}var Og='';function H(t,e="",r=""){let n=document.createElement(t);return e&&(n.className=e),r&&(n.textContent=r),n}function Su(t,e,r,n={}){let s=H("div","ivy-lock");s.setAttribute("role","group"),s.setAttribute("aria-label",S("\u5DF2\u52A0\u5BC6\u7684\u7B14\u8BB0","Protected note"));let i=H("div","ivy-lock-icon");i.innerHTML=Og;let o=H("div","ivy-lock-title",S("\u8FD9\u7BC7\u7B14\u8BB0\u5DF2\u7528\u5BC6\u7801\u4FDD\u62A4","This note is password protected")),a=H("div","ivy-lock-sub",S("\u8F93\u5165\u5BC6\u7801\u67E5\u770B\u548C\u7F16\u8F91\u3002\u5BC6\u7801\u53EA\u5728\u672C\u673A\u4F7F\u7528\uFF0C\u4E0D\u4F1A\u4E0A\u4F20\u3002","Enter its password to read and edit it. The password never leaves this device.")),l=mu(e()),c=H("div","ivy-lock-hint",l?S("\u5BC6\u7801\u63D0\u793A\uFF1A","Hint: ")+l:"");l||(c.hidden=!0);let O=H("form","ivy-lock-form"),u=H("input","ivy-lock-input");u.type="password",u.autocomplete="current-password",u.placeholder=S("\u5BC6\u7801","Password"),u.setAttribute("aria-label",S("\u5BC6\u7801","Password"));let h=H("button","ivy-lock-btn",S("\u89E3\u9501","Unlock"));h.type="submit";let f=H("div","ivy-lock-error");f.setAttribute("role","alert"),O.append(u,h),s.append(i,o,a,c,O,f),t.append(s);let p=!1;return O.addEventListener("submit",async d=>{if(d.preventDefault(),p)return;let g=u.value;if(!g){u.focus();return}p=!0,h.disabled=!0,h.textContent=S("\u6B63\u5728\u89E3\u9501\u2026","Unlocking\u2026"),f.textContent="";try{let{plain:Q,key:b}=await $u(e(),g);u.value="",r(Q,b)}catch(Q){f.textContent=Q instanceof ut?S("\u5BC6\u7801\u4E0D\u6B63\u786E\uFF0C\u8BF7\u518D\u8BD5\u4E00\u6B21\u3002","Wrong password. Try again."):S("\u65E0\u6CD5\u6253\u5F00\u8FD9\u7BC7\u7B14\u8BB0\uFF1A\u5185\u5BB9\u5DF2\u635F\u574F\u3002","This note cannot be opened: its content is damaged."),u.select(),s.classList.remove("ivy-shake"),s.offsetWidth,s.classList.add("ivy-shake")}finally{p=!1,h.disabled=!1,h.textContent=S("\u89E3\u9501","Unlock")}}),n.autofocus!==!1&&setTimeout(()=>u.focus({preventScroll:!0}),30),()=>s.remove()}function Lo(t,e,r,n=""){let s=H("label","ivy-dlg-field"),i=H("span","ivy-dlg-label",t),o=H("input","ivy-dlg-input");return o.type=e,o.autocomplete=r,n&&(o.placeholder=n),s.append(i,o),{input:o,row:s}}function yu(t){return new Promise(e=>{let r=H("div","ivy-dlg-back"),n=H("div","ivy-dlg");n.setAttribute("role","dialog"),n.setAttribute("aria-modal","true"),r.append(n);let s=document.activeElement,i=!1,o=c=>{i||(i=!0,r.classList.add("ivy-dlg-out"),document.removeEventListener("keydown",a,!0),setTimeout(()=>r.remove(),160),s?.focus?.({preventScroll:!0}),e(c))},a=c=>{c.key==="Escape"&&(c.stopPropagation(),o(null))};r.addEventListener("mousedown",c=>{c.target===r&&o(null)}),document.addEventListener("keydown",a,!0);let l=t(n,o);document.body.append(r),setTimeout(()=>l?.focus({preventScroll:!0}),30)})}function Pu(t,e,r=!1){let n=H("div","ivy-dlg-actions"),s=H("button","ivy-dlg-btn",S("\u53D6\u6D88","Cancel"));s.type="button",s.addEventListener("click",t);let i=H("button","ivy-dlg-btn ivy-dlg-primary"+(r?" ivy-dlg-danger":""),e);return i.type="submit",n.append(s,i),{row:n,ok:i}}function Yo(t=!1){return yu((e,r)=>{let n=H("form","ivy-dlg-form"),s=H("h2","ivy-dlg-title",t?S("\u66F4\u6539\u5BC6\u7801","Change password"):S("\u4E3A\u7B14\u8BB0\u8BBE\u7F6E\u5BC6\u7801","Protect this note with a password")),i=H("ul","ivy-dlg-notes"),o=t?[S("\u65B0\u5BC6\u7801\u7ACB\u5373\u751F\u6548\uFF0C\u5176\u4ED6\u8BBE\u5907\u9700\u8981\u8F93\u5165\u65B0\u5BC6\u7801\u3002","The new password takes effect at once; other devices will ask for it.")]:[S("\u6B63\u6587\u5728\u672C\u673A\u52A0\u5BC6\u540E\u624D\u540C\u6B65\uFF0C\u670D\u52A1\u5668\u3001\u641C\u7D22\u3001\u5386\u53F2\u7248\u672C\u548C AI \u90FD\u770B\u4E0D\u5230\u5185\u5BB9\u3002","The text is encrypted on this device before it syncs: the server, search, history and AI cannot read it."),S("\u6807\u9898\u4E0D\u52A0\u5BC6\uFF0C\u4FBF\u4E8E\u5728\u5217\u8868\u4E2D\u627E\u5230\uFF1B\u9644\u4EF6\u4E0D\u968F\u6B63\u6587\u52A0\u5BC6\u3002","The title stays readable so you can find the note; attachments are not encrypted."),S("\u52A0\u5BC6\u524D\u7684\u5386\u53F2\u7248\u672C\u4F1A\u88AB\u5220\u9664\uFF0C\u516C\u5F00\u5206\u4EAB\u4F1A\u5173\u95ED\u3002","Earlier versions are deleted and public sharing is turned off.")];for(let d of o)i.append(H("li","",d));let a=Lo(S("\u5BC6\u7801","Password"),"password","new-password",S(`\u81F3\u5C11 ${wt} \u4F4D`,`At least ${wt} characters`)),l=Lo(S("\u518D\u8F93\u5165\u4E00\u6B21","Repeat password"),"password","new-password"),c=Lo(S("\u5BC6\u7801\u63D0\u793A\uFF08\u53EF\u9009\uFF0C\u4ED6\u4EBA\u4E5F\u80FD\u770B\u5230\uFF09","Hint (optional, visible to anyone)"),"text","off");c.input.maxLength=100;let O=H("label","ivy-dlg-ack"),u=H("input");u.type="checkbox",O.append(u,H("span","",S("\u6211\u660E\u767D\uFF1A\u5FD8\u8BB0\u5BC6\u7801\u540E\uFF0C\u4EFB\u4F55\u4EBA\uFF08\u5305\u62EC\u670D\u52A1\u5668\u7BA1\u7406\u5458\uFF09\u90FD\u65E0\u6CD5\u6062\u590D\u8FD9\u7BC7\u7B14\u8BB0\u3002","I understand: if I forget the password, nobody \u2014 not even the server admin \u2014 can recover this note.")));let h=H("div","ivy-dlg-error");h.setAttribute("role","alert");let{row:f,ok:p}=Pu(()=>r(null),t?S("\u66F4\u6539\u5BC6\u7801","Change password"):S("\u52A0\u5BC6","Protect"));return n.append(s,i,a.row,l.row,c.row,O,h,f),n.addEventListener("submit",d=>{d.preventDefault(),h.textContent="",a.input.value.length{let r=H("form","ivy-dlg-form");r.append(H("h2","ivy-dlg-title",S("\u79FB\u9664\u5BC6\u7801\uFF1F","Remove the password?")),H("p","ivy-dlg-text",S("\u8FD9\u7BC7\u7B14\u8BB0\u5C06\u4EE5\u660E\u6587\u4FDD\u5B58\u548C\u540C\u6B65\uFF0C\u53EF\u4EE5\u88AB\u641C\u7D22\u3001\u51FA\u73B0\u5728\u65E5\u7A0B\u4E2D\uFF0C\u4E5F\u53EF\u4EE5\u5206\u4EAB\u3002","The note will be stored and synced readable again: searchable, on the agenda, and shareable.")));let{row:n,ok:s}=Pu(()=>e(null),S("\u79FB\u9664\u5BC6\u7801","Remove password"),!0);return r.append(n),r.addEventListener("submit",i=>{i.preventDefault(),e(!0)}),t.append(r),s}).then(t=>t===!0)}var os=class{constructor(e){this.host=e}key=null;locked=!1;body="";unmount=null;get isProtected(){return!!this.key||this.locked}get isLocked(){return this.locked}report(){this.host.state({protected:this.isProtected,locked:this.locked})}showLock(){this.host.hide(),this.key=null,this.locked=!0,this.unmount?.(),this.unmount=Su(this.host.lockHost,()=>this.body,(e,r)=>{this.unmount?.(),this.unmount=null,this.locked=!1,this.key=r,this.host.show(e),this.report()},{autofocus:!1}),this.report()}clearLock(){this.unmount?.(),this.unmount=null,this.locked=!1}load(e){if(this.body=e,this.clearLock(),this.key=null,Ur(e)){let r=Ao(e);if(!r){this.showLock();return}this.key=r.key,this.host.show(r.plain)}else this.host.show(e);this.report()}edited(e){return this.key?(ku(this.key),this.body=Qu(e,this.key),this.body):(this.body=e,e)}external(e){if(e===this.body)return!1;if(this.body=e,Ur(e)){if(!this.key){let n=Ao(e);return n?(this.key=n.key,this.locked?(this.clearLock(),this.host.show(n.plain)):this.host.replace(n.plain),this.report(),!0):(this.locked||this.showLock(),!0)}try{this.host.replace(ss(e,this.key))}catch(n){n instanceof ut&&Vr(this.key),this.showLock()}return!0}let r=this.isProtected;return this.locked?(this.clearLock(),this.key=null,this.host.show(e)):(this.key=null,this.host.replace(e)),r&&this.report(),!0}plain(){return this.key?this.host.text():null}async protect(){let e=this.host.text();if(e===null||this.isProtected||this.host.readonly())return!1;let r=await Yo(!1);return r?(this.key=await Co(r.password,r.hint),is(this.key),this.host.emit(this.edited(this.host.text()??e)),this.report(),!0):!1}async changePassword(){if(!this.key||this.host.readonly())return!1;let e=await Yo(!0);if(!e||!this.key)return!1;let r=this.key;return this.key=await Co(e.password,e.hint),Vr(r),is(this.key),this.host.emit(this.edited(this.host.text()??"")),!0}async unprotect(){return!this.key||this.host.readonly()||!await wu()||!this.key?!1:(Vr(this.key),this.key=null,this.host.emit(this.edited(this.host.text()??"")),this.report(),!0)}lock(){this.key&&(Vr(this.key),this.showLock())}};function Uo(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Tt=Uo();function Lu(t){Tt=t}var Zt={exec:()=>null};function vt(t){let e=[];return r=>{let n=Math.max(0,Math.min(3,r-1)),s=e[n];return s||(s=t(n),e[n]=s),s}}function Y(t,e=""){let r=typeof t=="string"?t:t.source,n={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(ne.caret,"$1"),r=r.replace(s,o),n},getRegex:()=>new RegExp(r,e)};return n}var Yu=((t="")=>{try{return!!new RegExp("(?<=1)(?/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+)[ \t]*)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\][ \t]+\S/,listReplaceTask:/^\[[ xX]\][ \t]+/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^
/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:vt(t=>new RegExp(`^ {0,${t}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:vt(t=>new RegExp(`^ {0,${t}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:vt(t=>new RegExp(`^ {0,${t}}(?:\`\`\`|~~~)`)),headingBeginRegex:vt(t=>new RegExp(`^ {0,${t}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:vt(t=>new RegExp(`^ {0,${t}}#`)),htmlBeginRegex:vt(t=>new RegExp(`^ {0,${t}}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|new RegExp(`^ {0,${t}}>`))},ug=/^(?:[ \t]*(?:\n|$))+/,hg=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,fg=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\n|$)|$)/,Gr=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,dg=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Wo=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,qu=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/,zu=Y(qu).replace(/bull/g,Wo).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),pg=Y(qu).replace(/bull/g,Wo).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Vo=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,mg=/^[^\n]+/,Io=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/,gg=Y(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Io).replace("title",/(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex(),bg=Y(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,Wo).getRegex(),Nr="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Do=/|$))/,Qg=Y("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|[^\\n]*\\n*|$)|[^\\n]*\\n*|$)||$)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Do).replace("tag",Nr).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Mu=t=>Y(Vo).replace("hr",Gr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list",t).replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?| ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace("paragraph",$g).getRegex(),Go={blockquote:kg,code:hg,def:gg,fences:fg,heading:dg,hr:Gr,html:Qg,lheading:zu,list:bg,newline:ug,paragraph:xg,table:Zt,text:mg},vu=Y("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Gr).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]").replace("html"," {0,3}(?:)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|(?: *\\n{2,}|\\s*$)|\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace("comment",Do).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Zt,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Y(Vo).replace("hr",Gr).replace("heading",` *#{1,6} *[^ +]`).replace("lheading",zu).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Pg=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,wg=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Uu=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,vg=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\`+)[^`]+\k(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",Yu?"(?`+)[^`]+\k(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),Vu=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Eg=Y(Vu,"u").replace(/punct/g,qe).getRegex(),_g=Y(Vu,"u").replace(/punct/g,Wu).getRegex(),Cg=/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,Ag=Y(Cg,"u").replace(/openQuote/g,Xg).replace(/punct/g,qe).getRegex(),Iu="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Lg=Y(Iu,"gu").replace(/notPunctSpace/g,Br).replace(/punctSpace/g,or).replace(/punct/g,qe).getRegex(),Yg=Y(Iu,"gu").replace(/notPunctSpace/g,Rg).replace(/punctSpace/g,Tg).replace(/punct/g,Wu).getRegex(),qg="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)",zg=Y(qg,"gu").replace(/notPunctSpace/g,Br).replace(/punctSpace/g,or).replace(/punct/g,qe).getRegex(),Mg=Y("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Br).replace(/punctSpace/g,or).replace(/punct/g,qe).getRegex(),Ug="^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)",Wg=Y(Ug,"gu").replace(/notPunctSpace/g,Br).replace(/punctSpace/g,or).replace(/punct/g,qe).getRegex(),Vg=Y(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,qe).getRegex(),Ig="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Dg=Y(Ig,"gu").replace(/notPunctSpace/g,Br).replace(/punctSpace/g,or).replace(/punct/g,qe).getRegex(),Gg=Y(/\\(punct)/,"gu").replace(/punct/g,qe).getRegex(),Ng=Y(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,"gu").replace(/punct/g,qe).getRegex(),Bg=Y(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Fg=Y(Do).replace("(?:-->|$)","-->").getRegex(),Hg=Y("^comment|^|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",Fg).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Du=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,cs=Y(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace("brackets",Du).getRegex(),Kg=Y(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace("label",cs).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace("title",/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex(),Jg=Y(/^!?\[(label)\]\[(ref)\]/).replace("label",cs).replace("ref",Io).getRegex(),e0=Y(/^!?\[(ref)\](?:\[\])?/).replace("ref",Io).getRegex(),Zu=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,t0=Y(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace("brackets",Du).getRegex(),r0=Y("reflink|nolink(?!\\()","g").replace("reflink",Y(/^!?\[(label)\]\[(ref)\]/).replace("label",t0).replace("ref",Zu).getRegex()).replace("nolink",Y(/^!?\[(ref)\](?:\[\])?/).replace("ref",Zu).getRegex()).getRegex(),Xu=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,n0=/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/,s0=Y(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,n0).getRegex(),No={_backpedal:Zt,anyPunctuation:Gg,anyPunctuationOutsideCode:Ng,autolink:Bg,blockSkip:jg,br:Uu,code:wg,del:Zt,delLDelim:Zt,delRDelim:Zt,emStrongLDelim:Eg,emStrongRDelimAst:Lg,emStrongRDelimUnd:Mg,escape:Pg,link:Kg,nolink:e0,punctuation:Zg,reflink:Jg,reflinkSearch:r0,tag:Hg,text:vg,url:Zt},i0={...No,emStrongLDelim:Ag,emStrongRDelimAst:zg,emStrongRDelimUnd:Wg,link:Y(/^!?\[(label)\]\((.*?)\)/).replace("label",cs).getRegex(),reflink:Y(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",cs).getRegex()},qo={...No,emStrongRDelimAst:Yg,emStrongLDelim:_g,delLDelim:Vg,delRDelim:Dg,url:Y(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("emailProtocol",s0).replace("protocol",Xu).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Y(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},Tu=t=>a0[t];function Ze(t,e){if(e){if(ne.escapeTest.test(t))return t.replace(ne.escapeReplace,Tu)}else if(ne.escapeTestNoEncode.test(t))return t.replace(ne.escapeReplaceNoEncode,Tu);return t}function l0(t){return ne.numericCharacterReference.test(t)?t.replace(ne.numericCharacterReferenceOrAmpersand,(e,r,n)=>{if(r===void 0&&n===void 0)return"&";let s=r===void 0?Number.parseInt(n,16):Number.parseInt(r,10);return s===0||s>1114111||s>=55296&&s<=57343?"\uFFFD":s===38?"&":String.fromCodePoint(s)}):t}function Ru(t){try{t=encodeURI(t).replace(ne.percentDecode,"%")}catch{return null}return t}function ju(t,e){let r=t.replace(ne.findPipe,(i,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),n=r.split(ne.splitPipe),s=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),e)if(n.length>e)n.splice(e);else for(;n.length=0&&ne.blankLine.test(e[r]);)r--;return e.length-r<=2?t:e.slice(0,r+1).join(` +`)}function Os(t){return t.trim().replace(ne.multipleSpaceGlobal," ").toLowerCase().toUpperCase().toLowerCase()}function _u(t,e){if(t.indexOf(e[0])===-1&&t.indexOf(e[1])===-1)return-1;let r=0;for(let n=0;n0?-2:-1}var ir=new WeakMap;function Bo(t){let e={"*":-1,_:-1},r=-1,n=t.length;for(let s=0;s{let o=i.match(r.other.beginningSpace);if(o===null)return i;let[a]=o;return i.slice(Math.min(a.length,s.length))}).join(` +`)}function Au(t,e,r,n){if(!e.includes("<"))return!1;for(let s=0;se.length-s)return!0;s+=o[0].length-1}}return!1}var sr=class{options;rules;lexer;constructor(t){this.options=t||Tt}space(t){let e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){let e=this.rules.block.code.exec(t);if(e){let r=this.options.pedantic?e[0]:Eu(e[0]),n=r.replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:r,codeBlockStyle:"indented",text:n}}}fences(t){let e=this.rules.block.fences.exec(t);if(e){let r=e[0],n=f0(r,e[3]||"",this.rules);return{type:"code",raw:r,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:n}}}heading(t){let e=this.rules.block.heading.exec(t);if(e){let r=e[2].trim();if(this.rules.other.endingHash.test(r)){let n=Ke(r,"#");(this.options.pedantic||!n||this.rules.other.endingSpaceTabChar.test(n))&&(r=n.trim())}return{type:"heading",raw:Ke(e[0],` +`),depth:e[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(t){let e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:Ke(e[0],` +`)}}blockquote(t){let e=this.rules.block.blockquote.exec(t);if(e){let r=Ke(e[0],` `).split(` -`),n="",i="",s=[];for(;r.length>0;){let a=!1,o=[],l;for(l=0;ld+xr(m,d.length)).replace(this.rules.other.blockquoteSetextReplace,` +`),n="",s="",i=[];for(;r.length>0;){let o=!1,a=[],l;for(l=0;lp+ls(d,p.length)).replace(this.rules.other.blockquoteSetextReplace,` $1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n} -${O}`:O,i=i?`${i} -${c}`:c;let h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,s,!0),this.lexer.state.top=h,r.length===0)break;let p=s.at(-1);if(p?.type==="code"||p?.type==="heading"||p?.type==="hr"||p?.type==="html"||p?.type==="table")break;if(p?.type==="blockquote"){let u=p,d=r.join(` -`),m=u.raw+` -`+d.replace(this.rules.other.blockquoteSetextReplace2,""),g=this.blockquote(m);s[s.length-1]=g;let b=m.substring(g.raw.length).replace(/^\n/,""),Q=b?b.split(` -`).length:0,k=Q?r.slice(0,-Q):r;if(k.length>0&&(n=`${n} -${k.join(` -`)}`),i=i.substring(0,i.length-u.text.length)+g.text,r=r.slice(k.length),r.length>0&&this.rules.other.blockquoteStart.test(r[0]))continue;break}else if(p?.type==="list"){let u=p,d=u.raw+` +${c}`:c,s=s?`${s} +${O}`:O;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(O,i,!0),this.lexer.state.top=u,r.length===0)break;let h=i.at(-1);if(h?.type==="code"||h?.type==="heading"||h?.type==="hr"||h?.type==="html"||h?.type==="table")break;if(h?.type==="blockquote"){let f=h,p=r.join(` +`),d=f.raw+` +`+p.replace(this.rules.other.blockquoteSetextReplace2,""),g=this.blockquote(d);i[i.length-1]=g;let Q=d.substring(g.raw.length).replace(/^\n/,""),b=Q?Q.split(` +`).length:0,x=b?r.slice(0,-b):r;if(x.length>0&&(n=`${n} +${x.join(` +`)}`),s=s.substring(0,s.length-f.text.length)+g.text,r=r.slice(x.length),r.length>0&&this.rules.other.blockquoteStart.test(r[0]))continue;break}else if(h?.type==="list"){let f=h,p=f.raw+` `+r.join(` -`),m=this.list(d);s[s.length-1]=m;let g=m.raw.length>u.raw.length?d.slice(u.raw.length+1,m.raw.length).split(` -`).length:0;if(g>0){let b=r.slice(0,g).join(` +`),d=this.list(p);i[i.length-1]=d;let g=d.raw.length>f.raw.length?p.slice(f.raw.length+1,d.raw.length).split(` +`).length:0;if(g>0){let Q=r.slice(0,g).join(` `);n=`${n} -${b}`,i=`${i} -${b}`}r=r.slice(g);continue}}return{type:"blockquote",raw:n,tokens:s,text:i}}}list(t){let e=this.rules.block.list.exec(t);if(e){let r=t,n=()=>r.length-t.length,i=e[1].trim(),s=i.length>1,a={type:"list",raw:"",ordered:s,start:s?+i.slice(0,-1):"",loose:!1,items:[]};i=s?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=s?i:"[*+-]");let o=this.rules.other.listItemRegex(i),l=!1;for(;t;){let c=!1,h="";if(!(e=o.exec(t))||this.rules.block.hr.test(t))break;let p=n();t=t.substring(e[0].length);let u=e[2].split(` -`,1)[0],d=e[1].length,m=this.options.pedantic?xr(u,d):u.replace(this.rules.other.leadingSpaceTab,y=>xr(y,d)),g=t.split(` -`,1)[0],b=!m.trim(),Q=0;if(this.options.pedantic?(Q=2,h=m.trimStart()):b?Q=d+1:(Q=m.search(this.rules.other.nonSpaceChar),Q=Q>4?1:Q,h=m.slice(Q),Q+=d),b&&this.rules.other.blankLine.test(g)&&(t=t.substring(g.length+1),c=!0),!c){let y=this.rules.other.nextBulletRegex(Q),w=this.rules.other.hrRegex(Q),_=this.rules.other.fencesBeginRegex(Q),G=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(Q):this.rules.other.headingBeginRegex(Q),Xe=this.rules.other.htmlBeginRegex(Q),At=this.rules.other.blockquoteBeginRegex(Q);for(;t;){let ct=t.split(` -`,1)[0],Ie;if(g=ct,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),Ie=g):Ie=g.replace(this.rules.other.leadingSpaceTab,jr=>xr(jr)),_.test(g)||G.test(g)||Xe.test(g)||At.test(g)||y.test(g)||w.test(g))break;if(Ie.search(this.rules.other.nonSpaceChar)>=Q||!g.trim())h+=` -`+Ie.slice(Q);else{if(b||m.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(m)||G.test(m)||Xe.test(m)||w.test(m))break;let jr=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(g)&&this.rules.block.lheading.test(`${m} -${g}`)?` ${Ie.replace(/^ {0,3}/,"")}`:g;h+=` -`+jr}b=!g.trim(),t=t.substring(ct.length+1),m=Ie.slice(Q)}}let k=r.slice(p,n());a.loose||(l?a.loose=!0:this.rules.other.doubleBlankLine.test(k)&&(l=!0)),a.items.push({type:"list_item",raw:k,task:!!this.options.gfm&&this.rules.other.listIsTask.test(h),loose:!1,text:h,tokens:[]})}let O=a.items.at(-1);if(O)O.raw=O.raw.trimEnd(),O.text=O.text.trimEnd();else return;a.raw=r.slice(0,n()).trimEnd();for(let c of a.items)if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),!a.loose){let h=c.tokens.filter(u=>u.type==="space"),p=h.length>0&&h.some(u=>this.rules.other.anyLine.test(u.raw));a.loose=p}for(let c of a.items){let h=c.tokens[0];if(c.task&&(h?.type==="text"||h?.type==="paragraph")){c.text=c.text.replace(this.rules.other.listReplaceTask,""),h.raw=h.raw.replace(this.rules.other.listReplaceTask,""),h.text=h.text.replace(this.rules.other.listReplaceTask,"");for(let u=this.lexer.inlineQueue.length-1;u>=0;u--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[u].src)){this.lexer.inlineQueue[u].src=this.lexer.inlineQueue[u].src.replace(this.rules.other.listReplaceTask,"");break}let p=this.rules.other.listTaskCheckbox.exec(c.raw);if(p){let u={type:"checkbox",raw:p[0]+" ",checked:p[0]!=="[ ]"};c.checked=u.checked,a.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=u.raw+c.tokens[0].raw,c.tokens[0].text=u.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(u)):c.tokens.unshift({type:"paragraph",raw:u.raw,text:u.raw,tokens:[u]}):c.tokens.unshift(u)}}else c.task&&(c.task=!1)}if(a.loose)for(let c of a.items){c.loose=!0;for(let h of c.tokens)h.type==="text"&&(h.type="paragraph")}return a}}html(t){let e=this.rules.block.html.exec(t);if(e){let r=Sl(e[0]);return{type:"html",block:!0,raw:r,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:r}}}def(t){let e=this.rules.block.def.exec(t);if(e){if(!this.rules.other.startAngleBracket.test(e[2])&&kl(e[2],"()")!==-1)return;let r=yr(e[1]),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:me(e[0],` -`),href:n,title:i}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let r=bl(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(` -`):[],s={type:"table",raw:me(e[0],` -`),header:[],align:[],rows:[]};if(r.length===n.length){for(let a of n)this.rules.other.tableAlignRight.test(a)?s.align.push("right"):this.rules.other.tableAlignCenter.test(a)?s.align.push("center"):this.rules.other.tableAlignLeft.test(a)?s.align.push("left"):s.align.push(null);for(let a=0;a({text:o,tokens:this.lexer.inline(o),header:!1,align:s.align[l]})));return s}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let r=e[1].trim();return{type:"heading",raw:me(e[0],` +${Q}`,s=`${s} +${Q}`}r=r.slice(g);continue}}return{type:"blockquote",raw:n,tokens:i,text:s}}}list(t){let e=this.rules.block.list.exec(t);if(e){let r=t,n=()=>r.length-t.length,s=e[1].trim(),i=s.length>1,o={type:"list",raw:"",ordered:i,start:i?+s.slice(0,-1):"",loose:!1,items:[]};s=i?`\\d{1,9}\\${s.slice(-1)}`:`\\${s}`,this.options.pedantic&&(s=i?s:"[*+-]");let a=this.rules.other.listItemRegex(s),l=!1;for(;t;){let O=!1,u="";if(!(e=a.exec(t))||this.rules.block.hr.test(t))break;let h=n();t=t.substring(e[0].length);let f=e[2].split(` +`,1)[0],p=e[1].length,d=this.options.pedantic?ls(f,p):f.replace(this.rules.other.leadingSpaceTab,k=>ls(k,p)),g=t.split(` +`,1)[0],Q=!d.trim(),b=0;if(this.options.pedantic?(b=2,u=d.trimStart()):Q?b=p+1:(b=d.search(this.rules.other.nonSpaceChar),b=b>4?1:b,u=d.slice(b),b+=p),Q&&this.rules.other.blankLine.test(g)&&(t=t.substring(g.length+1),O=!0),!O){let k=this.rules.other.nextBulletRegex(b),w=this.rules.other.hrRegex(b),y=this.rules.other.fencesBeginRegex(b),T=this.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(b):this.rules.other.headingBeginRegex(b),A=this.rules.other.htmlBeginRegex(b),C=this.rules.other.blockquoteBeginRegex(b);for(;t;){let E=t.split(` +`,1)[0],P;if(g=E,this.options.pedantic?(g=g.replace(this.rules.other.listReplaceNesting," "),P=g):P=g.replace(this.rules.other.leadingSpaceTab,R=>ls(R)),y.test(g)||T.test(g)||A.test(g)||C.test(g)||k.test(g)||w.test(g))break;if(P.search(this.rules.other.nonSpaceChar)>=b||!g.trim())u+=` +`+P.slice(b);else{if(Q||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||y.test(d)||T.test(d)||A.test(d)||w.test(d))break;let R=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(g)&&this.rules.block.lheading.test(`${d} +${g}`)?` ${P.replace(/^ {0,3}/,"")}`:g;u+=` +`+R}Q=!g.trim(),t=t.substring(E.length+1),d=P.slice(b)}}let x=r.slice(h,n());o.loose||(l?o.loose=!0:this.rules.other.doubleBlankLine.test(x)&&(l=!0)),o.items.push({type:"list_item",raw:x,task:!!this.options.gfm&&this.rules.other.listIsTask.test(u),loose:!1,text:u,tokens:[]})}let c=o.items.at(-1);if(c)c.raw=c.raw.trimEnd(),c.text=c.text.trimEnd();else return;o.raw=r.slice(0,n()).trimEnd();for(let O of o.items)if(this.lexer.state.top=!1,O.tokens=this.lexer.blockTokens(O.text,[]),!o.loose){let u=O.tokens.filter(f=>f.type==="space"),h=u.length>0&&u.some(f=>this.rules.other.anyLine.test(f.raw));o.loose=h}for(let O of o.items){let u=O.tokens[0];if(O.task&&(u?.type==="text"||u?.type==="paragraph")){O.text=O.text.replace(this.rules.other.listReplaceTask,""),u.raw=u.raw.replace(this.rules.other.listReplaceTask,""),u.text=u.text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}let h=this.rules.other.listTaskCheckbox.exec(O.raw);if(h){let f={type:"checkbox",raw:h[0]+" ",checked:h[0]!=="[ ]"};O.checked=f.checked,o.loose?O.tokens[0]&&["paragraph","text"].includes(O.tokens[0].type)&&"tokens"in O.tokens[0]&&O.tokens[0].tokens?(O.tokens[0].raw=f.raw+O.tokens[0].raw,O.tokens[0].text=f.raw+O.tokens[0].text,O.tokens[0].tokens.unshift(f)):O.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):O.tokens.unshift(f)}}else O.task&&(O.task=!1)}if(o.loose)for(let O of o.items){O.loose=!0;for(let u of O.tokens)u.type==="text"&&(u.type="paragraph")}return o}}html(t){let e=this.rules.block.html.exec(t);if(e){let r=Eu(e[0]);return{type:"html",block:!0,raw:r,pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:r}}}def(t){let e=this.rules.block.def.exec(t);if(e){if(!this.rules.other.startAngleBracket.test(e[2])&&_u(e[2],"()")!==-1)return;let r=Os(e[1]),n=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:r,raw:Ke(e[0],` +`),href:n,title:s}}}table(t){let e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;let r=ju(e[1]),n=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=e[3]?.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(` +`):[],i={type:"table",raw:Ke(e[0],` +`),header:[],align:[],rows:[]};if(r.length===n.length){for(let o of n)this.rules.other.tableAlignRight.test(o)?i.align.push("right"):this.rules.other.tableAlignCenter.test(o)?i.align.push("center"):this.rules.other.tableAlignLeft.test(o)?i.align.push("left"):i.align.push(null);for(let o=0;o({text:a,tokens:this.lexer.inline(a),header:!1,align:i.align[l]})));return i}}lheading(t){let e=this.rules.block.lheading.exec(t);if(e){let r=e[1].trim();return{type:"heading",raw:Ke(e[0],` `),depth:e[2].charAt(0)==="="?1:2,text:r,tokens:this.lexer.inline(r)}}}paragraph(t){let e=this.rules.block.paragraph.exec(t);if(e){let r=e[1].charAt(e[1].length-1)===` -`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){if(this.lexer.state.linkParenPossible===!1)return;let e=this.rules.inline.link.exec(t);if(e){let r=e[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&xl(t,e[1],r,this.rules))return;let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let o=me(n.slice(0,-1),"\\");if((n.length-o.length)%2===0)return}else{let o=kl(e[2],"()");if(o===-2)return;if(o>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+o;e[2]=e[2].substring(0,o),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let i=me(e[0].slice(0,-1),"\\");if((e[0].length-i.length)%2===0)return;let s=e[2],a="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(s);o&&(s=o[1],a=o[3])}else a=e[3]?e[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?s=s.slice(1):s=s.slice(1,-1)),Pl(e,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:a&&a.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){let n=r[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&xl(t,r[1],n,this.rules))return;let i=e[yr(r[2]||r[1])];if(!i){let s=r[0].charAt(0);return{type:"text",raw:s,text:s}}return Pl(r,i,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!n||!n[1]&&!n[2]&&!n[3]&&!n[4])return;let i=n[0][0],s=r===i,a=e.length-t.length,o=a;for(;!this.options.pedantic&&o>0&&e[o-1]===i;)o--;let l=[...e.slice(Math.max(0,o-2),o)].at(-1)??"",O=l==="*"||l==="_"||!!this.rules.inline.punctuation.exec(l);o_);){if(u=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!u)continue;if(d=[...u].length,n[3]||n[4]){m+=d;continue}else if(n[5]||n[6]||Q){if(s&&(n[5]||n[6]))break;if(b%3&&!((b+d)%3)){g+=d;continue}}if(m-=d,m>0)continue;d=Math.min(d,d+m+g);let G=[...n[0]][0].length,Xe=t.slice(0,p+n.index+G+d);if(Math.min(p,d)%2){let ct=Xe.slice(1,-1);return{type:"em",raw:Xe,text:ct,tokens:this.lexer.inlineTokens(ct)}}let At=Xe.slice(2,-2);return{type:"strong",raw:Xe,text:At,tokens:this.lexer.inlineTokens(At)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(r),i=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return n&&i&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,r=""){let n=this.rules.inline.delLDelim.exec(t);if(n&&(!n[1]||!r||this.rules.inline.punctuation.exec(r))){let i=[...n[0]].length-1,s,a,o=i,l=this.rules.inline.delRDelim,O=tf(this,e),c=e.length-t.length+i;if(Oh);){if(s=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!s||(a=[...s].length,a!==i))continue;if(n[3]||n[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let p=[...n[0]][0].length,u=t.slice(0,i+n.index+p+a),d=u.slice(i,-i);return{type:"del",raw:u,text:d,tokens:this.lexer.inlineTokens(d)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let r,n;return e[2]==="@"?(r=e[1],n="mailto:"+r):(r=e[1],n=r),{type:"link",raw:e[0],text:r,href:n,autolink:!0,tokens:[{type:"text",raw:r,text:r}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let r,n;if(e[2]==="@")r=e[0],n="mailto:"+r;else{let i;do i=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(i!==e[0]);r=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:r,href:n,autolink:!0,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:r?e[0]:Hp(e[0]),escaped:r}}}},re=class Ti{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Ve,this.options.tokenizer=this.options.tokenizer||new ot,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let r={other:C,block:Pr.normal,inline:_t.normal};this.options.pedantic?(r.block=Pr.pedantic,r.inline=_t.pedantic):this.options.gfm&&(r.block=Pr.gfm,this.options.breaks?r.inline=_t.breaks:r.inline=_t.gfm),this.tokenizer.rules=r}static get rules(){return{block:Pr,inline:_t}}static lex(e,r){return new Ti(r).lex(e)}static lexInline(e,r){return new Ti(r).inlineTokens(e)}lex(e){e=e.replace(C.carriageReturn,` -`),this.blockTokens(e,this.tokens);for(let r=0;r(s=o.call({lexer:this},e,r))?(e=e.substring(s.raw.length),r.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);let o=r.at(-1);s.raw.length===1&&o!==void 0?o.raw+=` -`:r.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);let o=r.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(` +`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:r,tokens:this.lexer.inline(r)}}}text(t){let e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){let e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){let e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){if(this.lexer.state.linkParenPossible===!1)return;let e=this.rules.inline.link.exec(t);if(e){let r=e[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Au(t,e[1],r,this.rules))return;let n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;let a=Ke(n.slice(0,-1),"\\");if((n.length-a.length)%2===0)return}else{let a=_u(e[2],"()");if(a===-2)return;if(a>-1){let l=(e[0].indexOf("!")===0?5:4)+e[1].length+a;e[2]=e[2].substring(0,a),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let s=Ke(e[0].slice(0,-1),"\\");if((e[0].length-s.length)%2===0)return;let i=e[2],o="";if(this.options.pedantic){let a=this.rules.other.pedanticHrefTitle.exec(i);a&&(i=a[1],o=a[3])}else o=e[3]?e[3].slice(1,-1):"";return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?i=i.slice(1):i=i.slice(1,-1)),Cu(e,{href:i&&i.replace(this.rules.inline.anyPunctuation,"$1"),title:o&&o.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let r;if((r=this.rules.inline.reflink.exec(t))||(r=this.rules.inline.nolink.exec(t))){let n=r[0].charAt(0)==="!"?2:1;if(!this.options.pedantic&&Au(t,r[1],n,this.rules))return;let s=e[Os(r[2]||r[1])];if(!s){let i=r[0].charAt(0);return{type:"text",raw:i,text:i}}return Cu(r,s,r[0],this.lexer,this.rules)}}emStrong(t,e,r=""){let n=this.rules.inline.emStrongLDelim.exec(t);if(!n||!n[1]&&!n[2]&&!n[3]&&!n[4])return;let s=n[0][0],i=r===s,o=e.length-t.length,a=o;for(;!this.options.pedantic&&a>0&&e[a-1]===s;)a--;let l=[...e.slice(Math.max(0,a-2),a)].at(-1)??"",c=l==="*"||l==="_"||!!this.rules.inline.punctuation.exec(l);ay);){if(f=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!f)continue;if(p=[...f].length,n[3]||n[4]){d+=p;continue}else if(n[5]||n[6]||b){if(i&&(n[5]||n[6]))break;if(Q%3&&!((Q+p)%3)){g+=p;continue}}if(d-=p,d>0)continue;p=Math.min(p,p+d+g);let T=[...n[0]][0].length,A=t.slice(0,h+n.index+T+p);if(Math.min(h,p)%2){let E=A.slice(1,-1);return{type:"em",raw:A,text:E,tokens:this.lexer.inlineTokens(E)}}let C=A.slice(2,-2);return{type:"strong",raw:A,text:C,tokens:this.lexer.inlineTokens(C)}}}}codespan(t){let e=this.rules.inline.code.exec(t);if(e){let r=e[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(r),s=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return n&&s&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:e[0],text:r}}}br(t){let e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t,e,r=""){let n=this.rules.inline.delLDelim.exec(t);if(n&&(!n[1]||!r||this.rules.inline.punctuation.exec(r))){let s=[...n[0]].length-1,i,o,a=s,l=this.rules.inline.delRDelim,c=h0(this,e),O=e.length-t.length+s;if(cu);){if(i=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!i||(o=[...i].length,o!==s))continue;if(n[3]||n[4]){a+=o;continue}if(a-=o,a>0)continue;o=Math.min(o,o+a);let h=[...n[0]][0].length,f=t.slice(0,s+n.index+h+o),p=f.slice(s,-s);return{type:"del",raw:f,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(t){let e=this.rules.inline.autolink.exec(t);if(e){let r,n;return e[2]==="@"?(r=e[1],n="mailto:"+r):(r=e[1],n=r),{type:"link",raw:e[0],text:r,href:n,autolink:!0,tokens:[{type:"text",raw:r,text:r}]}}}url(t){let e;if(e=this.rules.inline.url.exec(t)){let r,n;if(e[2]==="@")r=e[0],n="mailto:"+r;else{let s;do s=e[0],e[0]=this.rules.inline._backpedal.exec(e[0])?.[0]??"";while(s!==e[0]);r=e[0],e[1]==="www."?n="http://"+e[0]:n=e[0]}return{type:"link",raw:e[0],text:r,href:n,autolink:!0,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){let e=this.rules.inline.text.exec(t);if(e){let r=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:r?e[0]:l0(e[0]),escaped:r}}}},Ce=class zo{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Tt,this.options.tokenizer=this.options.tokenizer||new sr,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let r={other:ne,block:as.normal,inline:Ir.normal};this.options.pedantic?(r.block=as.pedantic,r.inline=Ir.pedantic):this.options.gfm&&(r.block=as.gfm,this.options.breaks?r.inline=Ir.breaks:r.inline=Ir.gfm),this.tokenizer.rules=r}static get rules(){return{block:as,inline:Ir}}static lex(e,r){return new zo(r).lex(e)}static lexInline(e,r){return new zo(r).inlineTokens(e)}lex(e){e=e.replace(ne.carriageReturn,` +`),this.blockTokens(e,this.tokens);for(let r=0;r(i=a.call({lexer:this},e,r))?(e=e.substring(i.raw.length),r.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let a=r.at(-1);i.raw.length===1&&a!==void 0?a.raw+=` +`:r.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let a=r.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(` `)?"":` -`)+s.raw,o.text+=` -`+s.text,this.inlineQueue.at(-1).src=o.text):r.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);let o=r.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=(o.raw.endsWith(` +`)+i.raw,a.text+=` +`+i.text,this.inlineQueue.at(-1).src=a.text):r.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let a=r.at(-1);a?.type==="paragraph"||a?.type==="text"?(a.raw+=(a.raw.endsWith(` `)?"":` -`)+s.raw,o.text+=` -`+s.raw,this.inlineQueue.at(-1).src=o.text):(this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title}),r.push(s));continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),r.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),r.push(s);continue}let a=e;if(this.options.extensions?.startBlock){let o=1/0,l=e.slice(1),O;this.options.extensions.startBlock.forEach(c=>{O=c.call({lexer:this},l),typeof O=="number"&&O>=0&&(o=Math.min(o,O))}),o<1/0&&o>=0&&(a=e.substring(0,o+1))}if(this.state.top&&(s=this.tokenizer.paragraph(a))){let o=r.at(-1);n&&o?.type==="paragraph"?(o.raw+=(o.raw.endsWith(` +`)+i.raw,a.text+=` +`+i.raw,this.inlineQueue.at(-1).src=a.text):(this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title}),r.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),r.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),r.push(i);continue}let o=e;if(this.options.extensions?.startBlock){let a=1/0,l=e.slice(1),c;this.options.extensions.startBlock.forEach(O=>{c=O.call({lexer:this},l),typeof c=="number"&&c>=0&&(a=Math.min(a,c))}),a<1/0&&a>=0&&(o=e.substring(0,a+1))}if(this.state.top&&(i=this.tokenizer.paragraph(o))){let a=r.at(-1);n&&a?.type==="paragraph"?(a.raw+=(a.raw.endsWith(` `)?"":` -`)+s.raw,o.text+=` -`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):r.push(s),n=a.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);let o=r.at(-1);o?.type==="text"?(o.raw+=(o.raw.endsWith(` +`)+i.raw,a.text+=` +`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):r.push(i),n=o.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let a=r.at(-1);a?.type==="text"?(a.raw+=(a.raw.endsWith(` `)?"":` -`)+s.raw,o.text+=` -`+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):r.push(s);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}linkInText(e){if(!e.includes("["))return!1;let r=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(r.test(n[0])&&e.charAt(n.index-1)!=="!")return!0;for(let n of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let i=n[0],s=i.lastIndexOf("[");if(!(i.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,yr(i.slice(s+1,-1))))&&!(s>1&&this.linkInText(i.slice(1,s-1))))return!0}return!1}inlineTokens(e,r=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(")");try{return this.#e(e,r)}finally{this.state.linkParenPossible=n}}#e(e,r){let n=e.includes("*")||e.includes("_")||e.includes("~")||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==ot.prototype.emStrong||this.tokenizer.del!==ot.prototype.del?this.#r(e):e;Kp(this.tokenizer,n);try{return this.#t(e,n,r)}finally{Jp(this.tokenizer)}}#t(e,r,n){let i=!1,s="",a=1/0;for(;e;){if(e.length(o=O.call({lexer:this},e,n))?(e=e.substring(o.raw.length),n.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let O=n.at(-1);o.type==="text"&&O?.type==="text"?(O.raw+=o.raw,O.text+=o.text):n.push(o);continue}if(o=this.tokenizer.emStrong(e,r,s)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.del(e,r,s)){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),n.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),n.push(o);continue}let l=e;if(this.options.extensions?.startInline){let O=1/0,c=e.slice(1),h;this.options.extensions.startInline.forEach(p=>{h=p.call({lexer:this},c),typeof h=="number"&&h>=0&&(O=Math.min(O,h))}),O<1/0&&O>=0&&(l=e.substring(0,O+1))}if(o=this.tokenizer.inlineText(l)){e=e.substring(o.raw.length),o.raw.slice(-1)!=="_"&&(s=o.raw.slice(-1)),i=!0;let O=n.at(-1);O?.type==="text"?(O.raw+=o.raw,O.text+=o.text):n.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return n}#r(e){let r=e;if(this.tokens.links&&e.includes("[")){let n=this.tokenizer.rules.inline.reflinkSearch,i=s=>{let a=s.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,yr(s.slice(a+1,-1))))return s;if(a>1&&s.charAt(0)!=="!"){let o=s.slice(1,a-1);if(this.linkInText(o))return"["+o.replace(n,i)+"]["+"a".repeat(s.length-a-2)+"]"}return"["+"a".repeat(s.length-2)+"]"};r=r.replace(n,i)}return r=r.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(n,i,s)=>s?"+".repeat(n.length):i?i+n.slice(i.length,-i.length).replace(/`/g,"+")+i:n),r=r.replace(this.tokenizer.rules.inline.blockSkip,(n,i,s)=>{let a=s?s.length:0;return n.slice(0,a)+"["+"a".repeat(n.length-a-2)+"]"}),r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r,r}infiniteLoopError(e){let r="Infinite loop on byte: "+e;if(this.options.silent)console.error(r);else throw new Error(r)}},Zr=class{options;parser;constructor(t){this.options=t||Ve}space(t){return""}code({text:t,lang:e,escaped:r}){let n=(e||"").match(C.notSpaceStart)?.[0],i=t?t.replace(C.endingNewline,"")+` -`:"";return n?'
'+(r?i:H(i,!0))+`
-`:"
"+(r?i:H(i,!0))+`
+`)+i.raw,a.text+=` +`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=a.text):r.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,r}inline(e,r=[]){return this.inlineQueue.push({src:e,tokens:r}),r}linkInText(e){if(!e.includes("["))return!1;let r=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(r.test(n[0])&&e.charAt(n.index-1)!=="!")return!0;for(let n of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let s=n[0],i=s.lastIndexOf("[");if(!(s.charAt(0)==="!"||!Object.hasOwn(this.tokens.links,Os(s.slice(i+1,-1))))&&!(i>1&&this.linkInText(s.slice(1,i-1))))return!0}return!1}inlineTokens(e,r=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(")");try{return this.#e(e,r)}finally{this.state.linkParenPossible=n}}#e(e,r){let n=e.includes("*")||e.includes("_")||e.includes("~")||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==sr.prototype.emStrong||this.tokenizer.del!==sr.prototype.del?this.#r(e):e;c0(this.tokenizer,n);try{return this.#t(e,n,r)}finally{O0(this.tokenizer)}}#t(e,r,n){let s=!1,i="",o=1/0;for(;e;){if(e.length(a=c.call({lexer:this},e,n))?(e=e.substring(a.raw.length),n.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let c=n.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):n.push(a);continue}if(a=this.tokenizer.emStrong(e,r,i)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.del(e,r,i)){e=e.substring(a.raw.length),n.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),n.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),n.push(a);continue}let l=e;if(this.options.extensions?.startInline){let c=1/0,O=e.slice(1),u;this.options.extensions.startInline.forEach(h=>{u=h.call({lexer:this},O),typeof u=="number"&&u>=0&&(c=Math.min(c,u))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(i=a.raw.slice(-1)),s=!0;let c=n.at(-1);c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):n.push(a);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return n}#r(e){let r=e;if(this.tokens.links&&e.includes("[")){let n=this.tokenizer.rules.inline.reflinkSearch,s=i=>{let o=i.lastIndexOf("[");if(!Object.hasOwn(this.tokens.links,Os(i.slice(o+1,-1))))return i;if(o>1&&i.charAt(0)!=="!"){let a=i.slice(1,o-1);if(this.linkInText(a))return"["+a.replace(n,s)+"]["+"a".repeat(i.length-o-2)+"]"}return"["+"a".repeat(i.length-2)+"]"};r=r.replace(n,s)}return r=r.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(n,s,i)=>i?"+".repeat(n.length):s?s+n.slice(s.length,-s.length).replace(/`/g,"+")+s:n),r=r.replace(this.tokenizer.rules.inline.blockSkip,(n,s,i)=>{let o=i?i.length:0;return n.slice(0,o)+"["+"a".repeat(n.length-o-2)+"]"}),r=this.options.hooks?.emStrongMask?.call({lexer:this},r)??r,r}infiniteLoopError(e){let r="Infinite loop on byte: "+e;if(this.options.silent)console.error(r);else throw new Error(r)}},us=class{options;parser;constructor(t){this.options=t||Tt}space(t){return""}code({text:t,lang:e,escaped:r}){let n=(e||"").match(ne.notSpaceStart)?.[0],s=t?t.replace(ne.endingNewline,"")+` +`:"";return n?'
'+(r?s:Ze(s,!0))+`
+`:"
"+(r?s:Ze(s,!0))+`
`}blockquote({tokens:t}){return`
${this.parser.parse(t)}
`}html({text:t}){return t}def(t){return""}heading({tokens:t,depth:e}){return`${this.parser.parseInline(t)} `}hr(t){return`
-`}list(t){let e=t.ordered,r=t.start,n="";for(let a=0;a -`+n+" +`}list(t){let e=t.ordered,r=t.start,n="";for(let o=0;o +`+n+" `}listitem(t){return`
  • ${this.parser.parse(t.tokens)}
  • `}checkbox({checked:t}){return" '}paragraph({tokens:t}){return`

    ${this.parser.parseInline(t)}

    -`}table(t){let e="",r="";for(let i=0;i${n}`),` +`}table(t){let e="",r="";for(let s=0;s${n}`),`
    `+e+` `+n+`
    `}tablerow({text:t}){return` ${t} `}tablecell(t){let e=this.parser.parseInline(t.tokens),r=t.header?"th":"td";return(t.align?`<${r} align="${t.align}">`:`<${r}>`)+e+` -`}strong({tokens:t}){return`${this.parser.parseInline(t)}`}em({tokens:t}){return`${this.parser.parseInline(t)}`}codespan({text:t}){return`${H(t,!0)}`}br(t){return"
    "}del({tokens:t}){return`${this.parser.parseInline(t)}`}link({href:t,title:e,text:r,tokens:n,autolink:i}){let s=i?H(r,!0):this.parser.parseInline(n),a=$l(t);if(a===null)return s;t=H(a,i);let o='
    ",o}image({href:t,title:e,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));let i=$l(t);if(i===null)return H(r);t=i;let s=`${H(r)}{let a=i[s].flat(1/0);ye(r,this.walkTokens(a,e))}):i.tokens&&ye(r,this.walkTokens(i.tokens,e))}}return r}use(...t){let e=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};return t.forEach(r=>{let n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let s=e.renderers[i.name];s?e.renderers[i.name]=function(...a){let o=i.renderer.apply(this,a);return o===!1&&(o=s.apply(this,a)),o}:e.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let s=e[i.level];s?s.unshift(i.tokenizer):e[i.level]=[i.tokenizer],i.start&&(i.level==="block"?e.startBlock?e.startBlock.push(i.start):e.startBlock=[i.start]:i.level==="inline"&&(e.startInline?e.startInline.push(i.start):e.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(e.childTokens[i.name]=i.childTokens)}),n.extensions=e),r.renderer){let i=this.defaults.renderer||new Zr(this.defaults);for(let s in r.renderer){if(!(s in i))throw new Error(`renderer '${s}' does not exist`);if(["options","parser"].includes(s))continue;let a=s,o=r.renderer[a],l=i[a];i[a]=(...O)=>{let c=o.apply(i,O);return c===!1&&(c=l.apply(i,O)),c===!1?"":c??""}}n.renderer=i}if(r.tokenizer){let i=this.defaults.tokenizer||new ot(this.defaults);for(let s in r.tokenizer){if(!(s in i))throw new Error(`tokenizer '${s}' does not exist`);if(["options","rules","lexer"].includes(s))continue;let a=s,o=r.tokenizer[a],l=i[a];i[a]=(...O)=>{let c=o.apply(i,O);return c===!1&&(c=l.apply(i,O)),c}}n.tokenizer=i}if(r.hooks){let i=this.defaults.hooks||new Ct;for(let s in r.hooks){if(!(s in i))throw new Error(`hook '${s}' does not exist`);if(["options","block"].includes(s))continue;let a=s,o=r.hooks[a],l=i[a];Ct.passThroughHooks.has(s)?i[a]=O=>{if(i.options.async&&Ct.passThroughHooksRespectAsync.has(s))return(async()=>{let h=await o.call(i,O);return l.call(i,h)})();let c=o.call(i,O);return l.call(i,c)}:i[a]=(...O)=>{if(i.options.async)return(async()=>{let h=await o.apply(i,O);return h===!1&&(h=await l.apply(i,O)),h})();let c=o.apply(i,O);return c===!1&&(c=l.apply(i,O)),c}}n.hooks=i}if(r.walkTokens){let i=this.defaults.walkTokens,s=r.walkTokens;n.walkTokens=function(a){let o=[];return ye(o,s.call(this,a)),i&&ye(o,i.call(this,a)),o}}this.defaults={...this.defaults,...n}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return re.lex(t,e??this.defaults)}parser(t,e){return ne.parse(t,e??this.defaults)}parseMarkdown(t){return(e,r)=>{let n={...r},i={...this.defaults,...n},s=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&n.async===!1)return s(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return s(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return s(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=t),i.async)return(async()=>{let a=i.hooks?await i.hooks.preprocess(e):e,o=await(i.hooks?await i.hooks.provideLexer(t):t?re.lex:re.lexInline)(a,i),l=i.hooks?await i.hooks.processAllTokens(o):o;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let O=await(i.hooks?await i.hooks.provideParser(t):t?ne.parse:ne.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(O):O})().catch(s);try{i.hooks&&(e=i.hooks.preprocess(e));let a=(i.hooks?i.hooks.provideLexer(t):t?re.lex:re.lexInline)(e,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let o=(i.hooks?i.hooks.provideParser(t):t?ne.parse:ne.parseInline)(a,i);return i.hooks&&(o=i.hooks.postprocess(o)),o}catch(a){return s(a)}}}onError(t,e){return r=>{if(r.message+=` -Please report this to https://github.com/markedjs/marked.`,t){let n="

    An error occurred:

    "+H(r.message+"",!0)+"
    ";return e?Promise.resolve(n):n}if(e)return Promise.reject(r);throw r}}},Ue=new Wi;function j(t,e){return Ue.parse(t,e)}j.options=j.setOptions=function(t){return Ue.setOptions(t),j.defaults=Ue.defaults,wl(j.defaults),j};j.getDefaults=ji;j.defaults=Ve;function nf(...t){return Ue.use(...t),j.defaults=Ue.defaults,wl(j.defaults),j}j.use=nf;j.walkTokens=function(t,e){return Ue.walkTokens(t,e)};j.parseInline=Ue.parseInline;j.Parser=ne;j.parser=ne.parse;j.Renderer=Zr;j.TextRenderer=Ei;j.Lexer=re;j.lexer=re.lex;j.Tokenizer=ot;j.Hooks=Ct;j.parse=j;var zd=j.options,qd=j.setOptions,Ad=j.walkTokens,Ld=j.parseInline;var Ed=ne.parse,Wd=re.lex;var Mi=/^ivy:\/\/res\/([A-Za-z0-9_-]{8,64})/,Yl=/^ivy:\/\/note\/([A-Za-z0-9_-]{8,64})/;function oe(t){return t.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function zl(t){return t.toLowerCase().trim().replace(/<[^>]+>/g,"").replace(/[^\p{L}\p{N}\s-]/gu,"").replace(/\s+/g,"-")}function sf(t){let e=new Wi({gfm:!0,breaks:!1}),r=i=>{let s=Mi.exec(i);if(s)return t.resolveResource?.(s[1])||i;let a=Yl.exec(i);return a?t.noteHref?.(a[1])??"#":i},n=0;return e.use({extensions:[{name:"wikilink",level:"inline",start:i=>i.indexOf("[["),tokenizer(i){let s=/^\[\[([^[\]\n]+?)\]\]/.exec(i);if(s)return{type:"wikilink",raw:s[0],inner:s[1]}},renderer(i){let s=fl(i.inner),a=oe(s.alias||s.target),o=t.resolveTitle?.(s.target)??"";if(!o)return`
    ${a}`;let l=(t.noteHref?.(o)??"#")+(s.heading?"#"+zl(s.heading):"");return`${a}`}},{name:"highlight",level:"inline",start:i=>i.indexOf("=="),tokenizer(i){let s=/^==([^=\n]+)==/.exec(i);if(s)return{type:"highlight",raw:s[0],text:s[1]}},renderer(i){return`${oe(i.text)}`}}],renderer:{heading({tokens:i,depth:s}){let a=this.parser.parseInline(i);return`${a} -`},image({href:i,title:s,text:a}){let o=Mi.exec(i),l=o?t.resourceKind?.(o[1]):void 0,O=oe(r(i)),c=s?` title="${oe(s)}"`:"";return l==="video"?``:l==="audio"?``:l==="file"?`\u{1F4CE} ${oe(a||"file")}`:`${oe(a)}`},link({href:i,title:s,tokens:a}){let o=this.parser.parseInline(a),l=Mi.exec(i),O=Yl.exec(i),c=oe(r(i)),h=s?` title="${oe(s)}"`:"";if(O)return`${o}`;if(l)return`\u{1F4CE} ${o}`;let p=/^https?:\/\//i.test(i);return`${o}`},listitem(i){let s=this.parser.parse(i.tokens);if(i.task){let a=n++;s=s.replace(/^]*>\s*/,"");let o=t.interactiveTasks?"":" disabled";return`
  • ${s}
  • -`}return`
  • ${s}
  • -`}}}),{marked:e,resetTasks:()=>n=0}}var ql=!1;function Al(t,e={}){let{marked:r,resetTasks:n}=sf(e);n();let i=r.parse(t,{async:!1});return e.citations&&(i=i.replace(/\[(\d{1,2})\](?![^<]*<\/a>)/g,'$1')),!ql&&typeof Dt.addHook=="function"&&(Dt.addHook("afterSanitizeAttributes",s=>{s.tagName==="A"&&s.getAttribute("target")==="_blank"&&s.setAttribute("rel","noopener noreferrer")}),ql=!0),Dt.sanitize(i,{ADD_TAGS:["video","audio"],ADD_ATTR:["target","controls","preload","data-note","data-title","data-task","data-cite","loading"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|tel|blob):|\/|#|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i})}function Ge(t){window.IvyAndroid?.postMessage(JSON.stringify(t))}var Tr="",El=[],Xr=new Map,Rr={},vr="",P=null,Wl=new Cr,Ml=new Cr,af={zh:{placeholder:"\u5F00\u59CB\u5199\u4F5C\u2026",bold:"\u52A0\u7C97",italic:"\u659C\u4F53",strike:"\u5220\u9664\u7EBF"},en:{placeholder:"Start writing\u2026",bold:"bold",italic:"italic",strike:"strikethrough"}},Ui="zh",Ze=()=>af[Ui];function Ll(t,e){return`/res/${encodeURIComponent(t)}${e?"?thumb=1":""}`}var Ul={resolveResource:Ll,resourceKind:t=>Rr[t]??"image",resolveTitle:t=>Xr.get(kr(t.split("#")[0].split("|")[0]))??"",openNote:(t,e)=>Ge({type:"open",id:t,title:e}),renderBlock:t=>Al(t,{resolveResource:Ll,resourceKind:e=>Rr[e],resolveTitle:e=>Ul.resolveTitle(e),noteHref:()=>"#"})};function of(){return El.filter(t=>t.id!==Tr&&t.title).map(t=>({title:t.title,detail:t.folder}))}function lf(t){return[fs(),js(),Io({top:!0}),Go(),Lo({base:nt,addKeymap:!0}),ul,hl,X.lineWrapping,Ml.of(Yr(Ze().placeholder)),qs({override:[pl(of)],icons:!1,activateOnTyping:!0}),Te.of([{key:"Mod-b",run:e=>de(e,"**",Ze().bold)},{key:"Mod-i",run:e=>de(e,"*",Ze().italic)},{key:"Mod-e",run:e=>de(e,"`","code")},{key:"Mod-Shift-x",run:e=>de(e,"~~",Ze().strike)},{key:"Mod-k",run:Qi},{key:"Mod-Shift-k",run:$i},{key:"Mod-Alt-1",run:e=>V(e,"# ")},{key:"Mod-Alt-2",run:e=>V(e,"## ")},{key:"Mod-Alt-3",run:e=>V(e,"### ")},{key:"Mod-Shift-7",run:e=>V(e,"1. ")},{key:"Mod-Shift-8",run:e=>V(e,"- ")},{key:"Mod-Shift-9",run:e=>V(e,"- [ ] ")},...Ys,...an,...Ho,...ds,gs,...ms]),cl(Ul),X.contentAttributes.of({class:"cm-live"}),Wl.of(Qe.readOnly.of(t)),X.updateListener.of(e=>{if(e.focusChanged&&Ge({type:"focus",focused:e.view.hasFocus}),!e.docChanged)return;let r=e.state.doc.toString();vr=r,Ge({type:"change",id:Tr,body:r})})]}var Of=document.getElementById("editor"),Vi=-1,Gi=!1;function Vl(){if(Gi=!1,!P)return;let t=P.lineBlockAtHeight(48-P.documentTop),e=P.state.doc.lineAt(Math.min(t.from,P.state.doc.length)).number-1;e!==Vi&&(Vi=e,Ge({type:"scroll",line:e}))}window.addEventListener("scroll",()=>{Gi||(Gi=!0,requestAnimationFrame(Vl))},{passive:!0});window.ivy={load(t){Tr=t.id,vr=t.body,t.fontSize&&document.documentElement.style.setProperty("--editor-size",`${t.fontSize}px`);let e=Qe.create({doc:t.body,extensions:lf(!!t.readonly)});P?P.setState(e):P=new X({state:e,parent:Of}),P.scrollDOM.scrollTop=0,document.scrollingElement?.scrollTo(0,0),Vi=-1,Vl(),t.focus&&window.ivy.focus(!0)},setBody(t,e){if(!P||t!==Tr||e===vr)return;let r=P.state.doc.toString();if(vr=e,e===r)return;let n=0;for(;nn&&s>n&&r[i-1]===e[s-1];)i--,s--;P.dispatch({changes:{from:n,to:i,insert:e.slice(n,s)}})},setTitles(t){El=t,Xr=new Map;for(let e of t){let r=kr(e.title);r&&!Xr.has(r)&&Xr.set(r,e.id)}P?.dispatch({})},setKinds(t){let e=JSON.stringify(t)!==JSON.stringify(Rr);Rr=t,e&&P?.dispatch({})},insert(t,e=!0){!P||P.state.readOnly||gi(P,t,e)},setLanguage(t){Ui=t==="en"?"en":"zh",document.documentElement.lang=Ui==="zh"?"zh-CN":"en",P?.dispatch({effects:Ml.reconfigure(Yr(Ze().placeholder))})},setTheme(t){document.documentElement.dataset.theme=t?"dark":"light"},setReadonly(t){P?.dispatch({effects:Wl.reconfigure(Qe.readOnly.of(t))})},focus(t=!1){P&&(P.focus(),t&&P.dispatch({selection:{anchor:P.state.doc.length},scrollIntoView:!0}))},scrollToLine(t,e=!1){if(!P)return;let r=P.state.doc.line(Math.min(Math.max(1,t+1),P.state.doc.lines));P.dispatch({selection:{anchor:r.from},effects:X.scrollIntoView(r.from,{y:"start",yMargin:24})}),e&&P.focus()},command(t){if(P){switch(t){case"bold":de(P,"**",Ze().bold);break;case"italic":de(P,"*",Ze().italic);break;case"strike":de(P,"~~",Ze().strike);break;case"code":de(P,"`","code");break;case"h1":V(P,"# ");break;case"h2":V(P,"## ");break;case"h3":V(P,"### ");break;case"list":V(P,"- ");break;case"ordered":V(P,"1. ");break;case"task":V(P,"- [ ] ");break;case"quote":V(P,"> ");break;case"link":Qi(P);break;case"wiki":$i(P);break;case"rule":gi(P,"---",!0);break;case"undo":import("./chunks/dist-6TNHQW23.js").then(e=>P&&e.undo(P));return;case"redo":import("./chunks/dist-6TNHQW23.js").then(e=>P&&e.redo(P));return;case"blur":P.contentDOM.blur();return}P.focus()}}};window.addEventListener("error",t=>Ge({type:"error",message:String(t.message)}));document.addEventListener("error",t=>{let e=t.target;e&&"src"in e&&e!==window&&Ge({type:"log",message:`failed to load ${e.src}`})},!0);Ge({type:"ready"}); +`}strong({tokens:t}){return`${this.parser.parseInline(t)}`}em({tokens:t}){return`${this.parser.parseInline(t)}`}codespan({text:t}){return`${Ze(t,!0)}`}br(t){return"
    "}del({tokens:t}){return`${this.parser.parseInline(t)}`}link({href:t,title:e,text:r,tokens:n,autolink:s}){let i=s?Ze(r,!0):this.parser.parseInline(n),o=Ru(t);if(o===null)return i;t=Ze(o,s);let a='",a}image({href:t,title:e,text:r,tokens:n}){n&&(r=this.parser.parseInline(n,this.parser.textRenderer));let s=Ru(t);if(s===null)return Ze(r);t=s;let i=`${Ze(r)}{let o=s[i].flat(1/0);ht(r,this.walkTokens(o,e))}):s.tokens&&ht(r,this.walkTokens(s.tokens,e))}}return r}use(...t){let e=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};return t.forEach(r=>{let n={...r};if(n.async=this.defaults.async||n.async||!1,r.extensions&&(r.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let i=e.renderers[s.name];i?e.renderers[s.name]=function(...o){let a=s.renderer.apply(this,o);return a===!1&&(a=i.apply(this,o)),a}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let i=e[s.level];i?i.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),n.extensions=e),r.renderer){let s=this.defaults.renderer||new us(this.defaults);for(let i in r.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;let o=i,a=r.renderer[o],l=s[o];s[o]=(...c)=>{let O=a.apply(s,c);return O===!1&&(O=l.apply(s,c)),O===!1?"":O??""}}n.renderer=s}if(r.tokenizer){let s=this.defaults.tokenizer||new sr(this.defaults);for(let i in r.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;let o=i,a=r.tokenizer[o],l=s[o];s[o]=(...c)=>{let O=a.apply(s,c);return O===!1&&(O=l.apply(s,c)),O}}n.tokenizer=s}if(r.hooks){let s=this.defaults.hooks||new Dr;for(let i in r.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;let o=i,a=r.hooks[o],l=s[o];Dr.passThroughHooks.has(i)?s[o]=c=>{if(s.options.async&&Dr.passThroughHooksRespectAsync.has(i))return(async()=>{let u=await a.call(s,c);return l.call(s,u)})();let O=a.call(s,c);return l.call(s,O)}:s[o]=(...c)=>{if(s.options.async)return(async()=>{let u=await a.apply(s,c);return u===!1&&(u=await l.apply(s,c)),u})();let O=a.apply(s,c);return O===!1&&(O=l.apply(s,c)),O}}n.hooks=s}if(r.walkTokens){let s=this.defaults.walkTokens,i=r.walkTokens;n.walkTokens=function(o){let a=[];return ht(a,i.call(this,o)),s&&ht(a,s.call(this,o)),a}}this.defaults={...this.defaults,...n}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return Ce.lex(t,e??this.defaults)}parser(t,e){return Ae.parse(t,e??this.defaults)}parseMarkdown(t){return(e,r)=>{let n={...r},s={...this.defaults,...n},i=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&n.async===!1)return i(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof e>"u"||e===null)return i(new Error("marked(): input parameter is undefined or null"));if(typeof e!="string")return i(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(e)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=t),s.async)return(async()=>{let o=s.hooks?await s.hooks.preprocess(e):e,a=await(s.hooks?await s.hooks.provideLexer(t):t?Ce.lex:Ce.lexInline)(o,s),l=s.hooks?await s.hooks.processAllTokens(a):a;s.walkTokens&&await Promise.all(this.walkTokens(l,s.walkTokens));let c=await(s.hooks?await s.hooks.provideParser(t):t?Ae.parse:Ae.parseInline)(l,s);return s.hooks?await s.hooks.postprocess(c):c})().catch(i);try{s.hooks&&(e=s.hooks.preprocess(e));let o=(s.hooks?s.hooks.provideLexer(t):t?Ce.lex:Ce.lexInline)(e,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let a=(s.hooks?s.hooks.provideParser(t):t?Ae.parse:Ae.parseInline)(o,s);return s.hooks&&(a=s.hooks.postprocess(a)),a}catch(o){return i(o)}}}onError(t,e){return r=>{if(r.message+=` +Please report this to https://github.com/markedjs/marked.`,t){let n="

    An error occurred:

    "+Ze(r.message+"",!0)+"
    ";return e?Promise.resolve(n):n}if(e)return Promise.reject(r);throw r}}},Xt=new Ho;function K(t,e){return Xt.parse(t,e)}K.options=K.setOptions=function(t){return Xt.setOptions(t),K.defaults=Xt.defaults,Lu(K.defaults),K};K.getDefaults=Uo;K.defaults=Tt;function d0(...t){return Xt.use(...t),K.defaults=Xt.defaults,Lu(K.defaults),K}K.use=d0;K.walkTokens=function(t,e){return Xt.walkTokens(t,e)};K.parseInline=Xt.parseInline;K.Parser=Ae;K.parser=Ae.parse;K.Renderer=us;K.TextRenderer=Fo;K.Lexer=Ce;K.lexer=Ce.lex;K.Tokenizer=sr;K.Hooks=Dr;K.parse=K;var nx=K.options,sx=K.setOptions,ix=K.walkTokens,ox=K.parseInline;var ax=Ae.parse,lx=Ce.lex;var Ko=/^ivy:\/\/res\/([A-Za-z0-9_-]{8,64})/,Gu=/^ivy:\/\/note\/([A-Za-z0-9_-]{8,64})/;function ee(t){return t.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e])}function Nu(t){return t.toLowerCase().trim().replace(/<[^>]+>/g,"").replace(/[^\p{L}\p{N}\s-]/gu,"").replace(/\s+/g,"-")}function p0(t){let e=new Ho({gfm:!0,breaks:!1}),r=s=>{let i=Ko.exec(s);if(i)return t.resolveResource?.(i[1])||s;let o=Gu.exec(s);return o?t.noteHref?.(o[1])??"#":s},n=0;return e.use({extensions:[{name:"wikilink",level:"inline",start:s=>s.indexOf("[["),tokenizer(s){let i=/^\[\[([^[\]\n]+?)\]\]/.exec(s);if(i)return{type:"wikilink",raw:i[0],inner:i[1]}},renderer(s){let i=Ou(s.inner),o=ee(i.alias||i.target),a=t.resolveTitle?.(i.target)??"";if(!a)return`
    ${o}`;let l=(t.noteHref?.(a)??"#")+(i.heading?"#"+Nu(i.heading):"");return`${o}`}},{name:"highlight",level:"inline",start:s=>s.indexOf("=="),tokenizer(s){let i=/^==([^=\n]+)==/.exec(s);if(i)return{type:"highlight",raw:i[0],text:i[1]}},renderer(s){return`${ee(s.text)}`}}],renderer:{code({text:s,lang:i}){if((i??"").trim().toLowerCase()!=="ivy-query")return!1;if(!t.query)return`

    ${ee(ar("\u7B14\u8BB0\u67E5\u8BE2\uFF1A\u5728\u5E38\u9752\u7B14\u8BB0\u4E2D\u67E5\u770B\u7ED3\u679C\u3002","Note query: open it in ivyNote to see its results."))}

    +`;try{return m0(t.query(s),t)}catch(o){return`

    ${ee(String(o.message??o))}

    +`}},heading({tokens:s,depth:i}){let o=this.parser.parseInline(s);return`${o} +`},image({href:s,title:i,text:o}){let a=Ko.exec(s),l=a?t.resourceKind?.(a[1]):void 0,c=ee(r(s)),O=i?` title="${ee(i)}"`:"";return l==="video"?``:l==="audio"?``:l==="file"?`\u{1F4CE} ${ee(o||"file")}`:`${ee(o)}`},link({href:s,title:i,tokens:o}){let a=this.parser.parseInline(o),l=Ko.exec(s),c=Gu.exec(s),O=ee(r(s)),u=i?` title="${ee(i)}"`:"";if(c)return`${a}`;if(l)return`\u{1F4CE} ${a}`;let h=/^https?:\/\//i.test(s);return`${a}`},listitem(s){let i=this.parser.parse(s.tokens);if(s.task){let o=n++;i=i.replace(/^]*>\s*/,"");let a=t.interactiveTasks?"":" disabled";return`
  • ${i}
  • +`}return`
  • ${i}
  • +`}}}),{marked:e,resetTasks:()=>n=0}}var Bu=!1;function ar(t,e){return typeof document>"u"||document.documentElement.lang.toLowerCase().startsWith("zh")?t:e}function m0(t,e={}){if(!t.rows.length)return`

    ${ee(ar("\u6CA1\u6709\u7B26\u5408\u6761\u4EF6\u7684\u7B14\u8BB0\u3002","No notes match."))}

    +`;let r=[ar("\u6807\u9898","Title"),...t.columns].map(i=>`${ee(i)}`).join(""),n=t.rows.map(i=>{let o=ee(e.noteHref?.(i.id)??"#"),a=ee(i.title||ar("\u65E0\u6807\u9898","Untitled"));return`${a}${i.cells.map(l=>`${ee(l)}`).join("")}`}).join(""),s=t.stats.some(Boolean)&&t.rows.length>=2?`${ee(ar("\u5408\u8BA1","Total"))}${t.stats.map(i=>`${i?ee(ue(i.sum,i)):""}`).join("")}`:"";return`${r}${n}${s}
    +`}function g0(t){let e=Rr(t);if(!e)return{html:"",rest:t};let r=t.slice(e.to);return e.keys.length?{html:`
    ${e.keys.map(s=>`
    ${ee(s)}
    ${ee(Cn(e.props[s]))}
    `).join("")}
    +`,rest:r}:{html:"",rest:r}}function Fu(t,e={}){if(Ur(t))return`

    \u{1F512} ${ee(ar("\u8FD9\u7BC7\u7B14\u8BB0\u5DF2\u7528\u5BC6\u7801\u4FDD\u62A4\u3002","This note is password protected."))}

    `;let{marked:r,resetTasks:n}=p0(e);n();let s=g0(t),i=(e.properties===!1?"":s.html)+r.parse(s.rest,{async:!1});return e.citations&&(i=i.replace(/\[(\d{1,2})\](?![^<]*<\/a>)/g,'$1')),!Bu&&typeof on.addHook=="function"&&(on.addHook("afterSanitizeAttributes",o=>{o.tagName==="A"&&o.getAttribute("target")==="_blank"&&o.setAttribute("rel","noopener noreferrer")}),Bu=!0),on.sanitize(i,{ADD_TAGS:["video","audio"],ADD_ATTR:["target","controls","preload","data-note","data-title","data-task","data-cite","loading"],ALLOWED_URI_REGEXP:/^(?:(?:https?|mailto|tel|blob):|\/|#|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i})}function Je(t){window.IvyAndroid?.postMessage(JSON.stringify(t))}var lr="",Ju=[],hs=new Map,fs={},Fr="",X=null,eh=new ps,th=new ps,b0={zh:{placeholder:"\u5F00\u59CB\u5199\u4F5C\u2026",bold:"\u52A0\u7C97",italic:"\u659C\u4F53",strike:"\u5220\u9664\u7EBF"},en:{placeholder:"Start writing\u2026",bold:"bold",italic:"italic",strike:"strikethrough"}},Jo="zh",dt=()=>b0[Jo];function Hu(t,e){return`/res/${encodeURIComponent(t)}${e?"?thumb=1":""}`}var rh={resolveResource:Hu,resourceKind:t=>fs[t]??"image",resolveTitle:t=>hs.get(Jn(t.split("#")[0].split("|")[0]))??"",openNote:(t,e)=>Je({type:"open",id:t,title:e}),renderBlock:t=>Fu(t,{resolveResource:Hu,resourceKind:e=>fs[e],resolveTitle:e=>rh.resolveTitle(e),noteHref:()=>"#"})};function Q0(){return Ju.filter(t=>t.id!==lr&&t.title).map(t=>({title:t.title,detail:t.folder}))}function x0(t){return[Sa(),Ma(),eO({top:!0}),Jc(),Gc({base:Gt,addKeymap:!0}),AO,CO,_.lineWrapping,th.of(ms(dt().placeholder)),Da({override:[kO,LO(Q0)],icons:!1,activateOnTyping:!0}),pt.of([{key:"Mod-b",run:e=>Be(e,"**",dt().bold)},{key:"Mod-i",run:e=>Be(e,"*",dt().italic)},{key:"Mod-e",run:e=>Be(e,"`","code")},{key:"Mod-Shift-x",run:e=>Be(e,"~~",dt().strike)},{key:"Mod-k",run:Ki},{key:"Mod-Shift-k",run:Ji},{key:"Mod-Alt-1",run:e=>be(e,"# ")},{key:"Mod-Alt-2",run:e=>be(e,"## ")},{key:"Mod-Alt-3",run:e=>be(e,"### ")},{key:"Mod-Shift-7",run:e=>be(e,"1. ")},{key:"Mod-Shift-8",run:e=>be(e,"- ")},{key:"Mod-Shift-9",run:e=>be(e,"- [ ] ")},{key:"Mod-Shift-d",run:e=>(zn(e),!0)},...Va,...zs,...iO,...ya,wa,...Pa]),_O(rh),_.contentAttributes.of({class:"cm-live"}),eh.of(tt.readOnly.of(t)),_.updateListener.of(e=>{if(e.focusChanged&&Je({type:"focus",focused:e.view.hasFocus}),!e.docChanged||e.transactions.every(n=>n.annotation(Or.remote)))return;let r=ft.edited(e.state.doc.toString());Fr=r,Je({type:"change",id:lr,body:r})})]}var Ku=document.getElementById("editor"),nh=!1;function $0(t){if(!X)return;let e=X.state.doc.toString();if(t===e)return;let r=0;for(;rr&&s>r&&e[n-1]===t[s-1];)n--,s--;X.dispatch({changes:{from:r,to:n,insert:t.slice(r,s)},annotations:Or.remote.of(!0)})}var ft=new os({lockHost:Ku,show(t){let e=tt.create({doc:t,extensions:x0(nh)});X?X.setState(e):X=new _({state:e,parent:Ku}),X.scrollDOM.scrollTop=0},hide(){X?.destroy(),X=null},replace:$0,text:()=>X?.state.doc.toString()??null,emit(t){Fr=t,Je({type:"change",id:lr,body:t})},state:t=>Je({type:"protection",id:lr,...t}),readonly:()=>!X||X.state.readOnly}),ea=-1,ta=!1;function sh(){if(ta=!1,!X)return;let t=X.lineBlockAtHeight(48-X.documentTop),e=X.state.doc.lineAt(Math.min(t.from,X.state.doc.length)).number-1;e!==ea&&(ea=e,Je({type:"scroll",line:e}))}window.addEventListener("scroll",()=>{ta||(ta=!0,requestAnimationFrame(sh))},{passive:!0});window.ivy={load(t){lr=t.id,Fr=t.body,nh=!!t.readonly,t.fontSize&&document.documentElement.style.setProperty("--editor-size",`${t.fontSize}px`),ft.load(t.body),document.scrollingElement?.scrollTo(0,0),ea=-1,sh(),t.focus&&!ft.isLocked&&window.ivy.focus(!0)},setBody(t,e){t!==lr||e===Fr||(Fr=e,ft.external(e))},setTitles(t){Ju=t,hs=new Map;for(let e of t){let r=Jn(e.title);r&&!hs.has(r)&&hs.set(r,e.id)}X?.dispatch({})},setKinds(t){let e=JSON.stringify(t)!==JSON.stringify(fs);fs=t,e&&X?.dispatch({})},insert(t,e=!0){!X||X.state.readOnly||Hi(X,t,e)},setLanguage(t){Jo=t==="en"?"en":"zh",document.documentElement.lang=Jo==="zh"?"zh-CN":"en",X?.dispatch({effects:th.reconfigure(ms(dt().placeholder))})},setTheme(t){document.documentElement.dataset.theme=t?"dark":"light"},setReadonly(t){X?.dispatch({effects:eh.reconfigure(tt.readOnly.of(t))})},focus(t=!1){X&&(X.focus(),t&&X.dispatch({selection:{anchor:X.state.doc.length},scrollIntoView:!0}))},scrollToLine(t,e=!1){if(!X)return;let r=X.state.doc.line(Math.min(Math.max(1,t+1),X.state.doc.lines));X.dispatch({selection:{anchor:r.from},effects:_.scrollIntoView(r.from,{y:"start",yMargin:24})}),e&&X.focus()},command(t){switch(t){case"protect":ft.protect();return;case"unprotect":ft.unprotect();return;case"changePassword":ft.changePassword();return;case"lock":ft.lock();return}if(X){switch(t){case"due":zn(X);return;case"bold":Be(X,"**",dt().bold);break;case"italic":Be(X,"*",dt().italic);break;case"strike":Be(X,"~~",dt().strike);break;case"code":Be(X,"`","code");break;case"h1":be(X,"# ");break;case"h2":be(X,"## ");break;case"h3":be(X,"### ");break;case"list":be(X,"- ");break;case"ordered":be(X,"1. ");break;case"task":be(X,"- [ ] ");break;case"quote":be(X,"> ");break;case"link":Ki(X);break;case"wiki":Ji(X);break;case"rule":Hi(X,"---",!0);break;case"undo":import("./chunks/dist-6TNHQW23.js").then(e=>X&&e.undo(X));return;case"redo":import("./chunks/dist-6TNHQW23.js").then(e=>X&&e.redo(X));return;case"blur":X.contentDOM.blur();return}X.focus()}}};window.addEventListener("error",t=>Je({type:"error",message:String(t.message)}));document.addEventListener("error",t=>{let e=t.target;e&&"src"in e&&e!==window&&Je({type:"log",message:`failed to load ${e.src}`})},!0);Je({type:"ready"}); diff --git a/app/src/main/kotlin/app/ivynote/android/LibrarySession.kt b/app/src/main/kotlin/app/ivynote/android/LibrarySession.kt index 54dc332..981b7cf 100644 --- a/app/src/main/kotlin/app/ivynote/android/LibrarySession.kt +++ b/app/src/main/kotlin/app/ivynote/android/LibrarySession.kt @@ -9,6 +9,7 @@ import app.ivynote.android.editor.AttachmentLoader import app.ivynote.android.editor.EditorHost import app.ivynote.android.platform.SqliteDocumentStore import app.ivynote.android.platform.networkAvailable +import app.ivynote.android.reminders.Reminders import app.ivynote.core.L10n import app.ivynote.core.AddedFile import app.ivynote.core.ApiClient @@ -30,6 +31,7 @@ import kotlinx.coroutines.delay import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.collectLatest import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch import kotlinx.coroutines.withContext @@ -68,6 +70,15 @@ class LibrarySession private constructor( engine.onUploaded = { att, file -> runCatching { AttachmentLoader.store(cache, att.id, file, att.mime) } } + // Reminders follow the notes: the system's alarms are set again a + // moment after any change (guide 11.8). + scope.launch { + engine.revision.collectLatest { + delay(1_500) + val notes = engine.notes.values.toList() + withContext(Dispatchers.Default) { runCatching { Reminders.schedule(context, ref.id, notes) } } + } + } } /** @@ -180,6 +191,7 @@ class LibrarySession private constructor( fun destroy() { if (closed) return closed = true + Reminders.clear(context, ref.id) deactivate() engine.stop() editorHost?.destroy() diff --git a/app/src/main/kotlin/app/ivynote/android/MainActivity.kt b/app/src/main/kotlin/app/ivynote/android/MainActivity.kt index db2d75c..5825974 100644 --- a/app/src/main/kotlin/app/ivynote/android/MainActivity.kt +++ b/app/src/main/kotlin/app/ivynote/android/MainActivity.kt @@ -1,19 +1,78 @@ package app.ivynote.android +import android.Manifest +import android.content.Intent +import android.os.Build import android.os.Bundle import androidx.activity.ComponentActivity import androidx.activity.compose.setContent import androidx.activity.enableEdgeToEdge +import androidx.activity.result.contract.ActivityResultContracts +import app.ivynote.android.reminders.Reminders import app.ivynote.android.ui.IvyTheme import app.ivynote.android.ui.ProvideStrings import app.ivynote.android.ui.RootScreen +import kotlinx.coroutines.flow.MutableStateFlow class MainActivity : ComponentActivity() { + private val askNotifications = registerForActivityResult(ActivityResultContracts.RequestPermission()) { } + override fun onCreate(savedInstanceState: Bundle?) { enableEdgeToEdge() super.onCreate(savedInstanceState) + Reminders.ensureChannel(this) + Reminders.onScheduled = { runOnUiThread { askForNotificationsOnce() } } + handle(intent) setContent { ProvideStrings { IvyTheme { RootScreen() } } } } + + override fun onDestroy() { + Reminders.onScheduled = null + super.onDestroy() + } + + override fun onNewIntent(intent: Intent) { + super.onNewIntent(intent) + handle(intent) + } + + override fun onResume() { + super.onResume() + askForNotificationsOnce() + } + + /** A tapped reminder opens its note (LibraryScreen picks the request up). */ + private fun handle(intent: Intent?) { + val note = intent?.getStringExtra(EXTRA_NOTE) ?: return + val library = intent.getStringExtra(EXTRA_LIBRARY) ?: return + openRequest.value = OpenRequest(library, note) + intent.removeExtra(EXTRA_NOTE) + } + + /** + * Android 13+ asks before an app may notify. The question comes once, the + * first time a library has a reminder to come, not at the first start. + */ + private fun askForNotificationsOnce() { + if (Build.VERSION.SDK_INT < 33 || Reminders.mayNotify(this)) return + val prefs = getSharedPreferences("ivy.app", MODE_PRIVATE) + if (prefs.getBoolean(ASKED, false)) return + val any = getSharedPreferences("ivy.reminders", MODE_PRIVATE).all.values.any { ((it as? String)?.length ?: 0) > 2 } + if (!any) return + prefs.edit().putBoolean(ASKED, true).apply() + askNotifications.launch(Manifest.permission.POST_NOTIFICATIONS) + } + + data class OpenRequest(val library: String, val note: String) + + companion object { + const val EXTRA_LIBRARY = "app.ivynote.library" + const val EXTRA_NOTE = "app.ivynote.note" + private const val ASKED = "notificationsAsked" + + /** A note to open, from a tapped reminder. */ + val openRequest = MutableStateFlow(null) + } } diff --git a/app/src/main/kotlin/app/ivynote/android/editor/EditorHost.kt b/app/src/main/kotlin/app/ivynote/android/editor/EditorHost.kt index 4b50fbc..9e83655 100644 --- a/app/src/main/kotlin/app/ivynote/android/editor/EditorHost.kt +++ b/app/src/main/kotlin/app/ivynote/android/editor/EditorHost.kt @@ -32,6 +32,7 @@ import app.ivynote.core.Language import app.ivynote.core.Attachment import app.ivynote.core.IvyJson import app.ivynote.core.Note +import app.ivynote.core.NoteLock import app.ivynote.core.SyncEngine import kotlinx.coroutines.flow.MutableStateFlow import kotlinx.coroutines.flow.StateFlow @@ -90,6 +91,12 @@ class EditorHost(appContext: Context, private val session: LibrarySession) { private val _topLine = MutableStateFlow(0) val topLine: StateFlow = _topLine.asStateFlow() + /** Whether the open note has a password (guide 8.4), and is locked now. */ + data class Protection(val protected: Boolean = false, val locked: Boolean = false) + + private val _protection = MutableStateFlow(Protection()) + val protection: StateFlow = _protection.asStateFlow() + /** A followed `[[wiki link]]`: id ("" when no such note) and title. */ var onOpenNote: ((String, String) -> Unit)? = null @@ -119,6 +126,8 @@ class EditorHost(appContext: Context, private val session: LibrarySession) { fun open(note: Note, focus: Boolean) { noteId = note.id pageBody = note.body + val sealed = NoteLock.isEncrypted(note.body) + _protection.value = Protection(protected = sealed, locked = sealed) _topLine.value = 0 sendTitles() refreshKinds() @@ -243,6 +252,12 @@ class EditorHost(appContext: Context, private val session: LibrarySession) { } "open" -> onOpenNote?.invoke(m.str("id").orEmpty(), m.str("title").orEmpty()) "focus" -> _focused.value = (m["focused"] as? JsonPrimitive)?.booleanOrNull ?: false + "protection" -> if (m.str("id") == noteId) { + _protection.value = Protection( + protected = (m["protected"] as? JsonPrimitive)?.booleanOrNull ?: false, + locked = (m["locked"] as? JsonPrimitive)?.booleanOrNull ?: false, + ) + } "scroll" -> _topLine.value = (m["line"] as? JsonPrimitive)?.intOrNull ?: 0 "error", "log" -> if (BuildConfig.DEBUG) Log.d("ivy", "page ${m.str("type")}: ${m.str("message")}") } diff --git a/app/src/main/kotlin/app/ivynote/android/reminders/Reminders.kt b/app/src/main/kotlin/app/ivynote/android/reminders/Reminders.kt new file mode 100644 index 0000000..c334d39 --- /dev/null +++ b/app/src/main/kotlin/app/ivynote/android/reminders/Reminders.kt @@ -0,0 +1,158 @@ +package app.ivynote.android.reminders + +import android.Manifest +import android.app.AlarmManager +import android.app.NotificationChannel +import android.app.NotificationManager +import android.app.PendingIntent +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import android.content.pm.PackageManager +import android.os.Build +import androidx.core.app.NotificationCompat +import androidx.core.app.NotificationManagerCompat +import androidx.core.content.ContextCompat +import app.ivynote.android.MainActivity +import app.ivynote.android.R +import app.ivynote.core.IvyJson +import app.ivynote.core.L10n +import app.ivynote.core.Note +import app.ivynote.core.Tasks +import app.ivynote.core.nowMillis +import kotlinx.serialization.Serializable +import kotlinx.serialization.builtins.ListSerializer +import java.time.LocalTime + +/** + * Reminders for tasks with a 📅 date (guide 9.4, 11.8). Whenever a library's + * notes change, the next reminders of that library are handed to the + * system's AlarmManager, so they fire while the app is closed. They are also + * kept in preferences, to be set again after a reboot or an app update. + * Protected notes take no part: their tasks are encrypted. + */ +object Reminders { + const val CHANNEL = "reminders" + private const val PREFS = "ivy.reminders" + private const val ACTION = "app.ivynote.REMINDER" + /** How far ahead alarms are set; changes reschedule anyway. */ + private const val HORIZON_MS = 8L * 24 * 3600 * 1000 + private const val MAX = 48 + /** A date without a time reminds at this hour (as the web's default). */ + val ALL_DAY: LocalTime = LocalTime.of(9, 0) + + @Serializable + data class Pending(val key: String, val library: String, val noteId: String, val title: String, val text: String, val at: Long) + + /** Called after alarms were set for at least one reminder (any thread). */ + @Volatile var onScheduled: (() -> Unit)? = null + + private fun prefs(context: Context) = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE) + + private fun load(context: Context, library: String): List = + prefs(context).getString(library, null)?.let { runCatching { IvyJson.decodeFromString(ListSerializer(Pending.serializer()), it) }.getOrNull() } ?: emptyList() + + private fun save(context: Context, library: String, list: List) { + prefs(context).edit().putString(library, IvyJson.encodeToString(ListSerializer(Pending.serializer()), list)).apply() + } + + fun ensureChannel(context: Context) { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return + val nm = context.getSystemService(NotificationManager::class.java) ?: return + val ch = NotificationChannel(CHANNEL, L10n.s.reminderChannel, NotificationManager.IMPORTANCE_HIGH) + ch.description = L10n.s.reminderChannelHint + nm.createNotificationChannel(ch) + } + + private fun intent(context: Context, p: Pending): PendingIntent { + val i = Intent(context, ReminderReceiver::class.java).setAction(ACTION) + .putExtra("key", p.key).putExtra("library", p.library).putExtra("note", p.noteId) + .putExtra("title", p.title).putExtra("text", p.text) + return PendingIntent.getBroadcast(context, p.key.hashCode(), i, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE) + } + + private fun set(context: Context, p: Pending) { + val am = context.getSystemService(AlarmManager::class.java) ?: return + val pi = intent(context, p) + // Exact when the system allows it; otherwise within a few minutes. + val exact = Build.VERSION.SDK_INT < Build.VERSION_CODES.S || am.canScheduleExactAlarms() + runCatching { + if (exact) am.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, p.at, pi) + else am.setAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, p.at, pi) + } + } + + private fun cancel(context: Context, p: Pending) { + val am = context.getSystemService(AlarmManager::class.java) ?: return + am.cancel(intent(context, p)) + } + + /** Sets the alarms of a library's next reminders, replacing the earlier ones. */ + fun schedule(context: Context, library: String, notes: Collection) { + val now = nowMillis() + val next = Tasks.reminders(notes, now, now + HORIZON_MS, ALL_DAY).take(MAX).map { + Pending(it.key, library, it.noteId, it.noteTitle, it.text, it.at) + } + val old = load(context, library) + val keep = next.map { it.key }.toSet() + for (p in old) if (p.key !in keep) cancel(context, p) + for (p in next) set(context, p) + save(context, library, next) + if (next.isNotEmpty()) onScheduled?.invoke() + } + + /** Sets every saved alarm again (after a reboot or an update). */ + fun restore(context: Context) { + val now = nowMillis() + for (library in prefs(context).all.keys) { + val list = load(context, library).filter { it.at > now - 60_000 } + list.forEach { set(context, it) } + save(context, library, list) + } + } + + /** Stops the reminders of a library (signed out, removed). */ + fun clear(context: Context, library: String) { + load(context, library).forEach { cancel(context, it) } + prefs(context).edit().remove(library).apply() + } + + fun mayNotify(context: Context): Boolean = + Build.VERSION.SDK_INT < 33 || ContextCompat.checkSelfPermission(context, Manifest.permission.POST_NOTIFICATIONS) == PackageManager.PERMISSION_GRANTED + + /** Whether the library has reminders to come (to ask for permission). */ + fun hasPending(context: Context, library: String): Boolean = load(context, library).isNotEmpty() + + internal fun show(context: Context, i: Intent) { + if (!mayNotify(context)) return + ensureChannel(context) + val title = i.getStringExtra("text").orEmpty().ifEmpty { i.getStringExtra("title").orEmpty() } + val noteTitle = i.getStringExtra("title").orEmpty() + val open = Intent(context, MainActivity::class.java) + .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_SINGLE_TOP) + .putExtra(MainActivity.EXTRA_LIBRARY, i.getStringExtra("library")) + .putExtra(MainActivity.EXTRA_NOTE, i.getStringExtra("note")) + val key = i.getStringExtra("key").orEmpty() + val tap = PendingIntent.getActivity(context, key.hashCode(), open, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE) + val n = NotificationCompat.Builder(context, CHANNEL) + .setSmallIcon(R.drawable.ivy_leaf) + .setContentTitle(title) + .setContentText(if (noteTitle.isNotEmpty()) L10n.s.reminderFrom(noteTitle) else null) + .setCategory(NotificationCompat.CATEGORY_REMINDER) + .setPriority(NotificationCompat.PRIORITY_HIGH) + .setAutoCancel(true) + .setContentIntent(tap) + .build() + runCatching { NotificationManagerCompat.from(context).notify(key.hashCode(), n) } + } +} + +/** Fires a reminder; after a reboot or an update, sets the alarms again. */ +class ReminderReceiver : BroadcastReceiver() { + override fun onReceive(context: Context, intent: Intent) { + when (intent.action) { + Intent.ACTION_BOOT_COMPLETED, Intent.ACTION_MY_PACKAGE_REPLACED -> Reminders.restore(context) + else -> Reminders.show(context, intent) + } + } +} diff --git a/app/src/main/kotlin/app/ivynote/android/ui/AgendaSheet.kt b/app/src/main/kotlin/app/ivynote/android/ui/AgendaSheet.kt new file mode 100644 index 0000000..37473bc --- /dev/null +++ b/app/src/main/kotlin/app/ivynote/android/ui/AgendaSheet.kt @@ -0,0 +1,112 @@ +package app.ivynote.android.ui + +import androidx.compose.foundation.clickable +import androidx.compose.foundation.layout.Arrangement +import androidx.compose.foundation.layout.Column +import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.Spacer +import androidx.compose.foundation.layout.fillMaxWidth +import androidx.compose.foundation.layout.navigationBarsPadding +import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.width +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.shape.RoundedCornerShape +import androidx.compose.foundation.verticalScroll +import androidx.compose.material3.Checkbox +import androidx.compose.material3.CheckboxDefaults +import androidx.compose.material3.ExperimentalMaterial3Api +import androidx.compose.material3.ModalBottomSheet +import androidx.compose.material3.Text +import androidx.compose.material3.rememberModalBottomSheetState +import androidx.compose.runtime.Composable +import androidx.compose.runtime.collectAsState +import androidx.compose.runtime.getValue +import androidx.compose.runtime.remember +import androidx.compose.ui.Alignment +import androidx.compose.ui.Modifier +import androidx.compose.ui.draw.clip +import androidx.compose.ui.text.style.TextOverflow +import androidx.compose.ui.unit.dp +import androidx.compose.ui.unit.sp +import app.ivynote.android.LibrarySession +import app.ivynote.core.NoteLock +import app.ivynote.core.SyncEngine +import app.ivynote.core.Tasks +import java.time.LocalDate +import java.time.format.DateTimeFormatter +import java.time.format.FormatStyle + +/** + * The agenda (guide 11.8): open to-dos with a 📅 date across the library, + * overdue first. Checking one off writes the note, as the editor would; a + * tap opens the note at the task. + */ +@OptIn(ExperimentalMaterial3Api::class) +@Composable +fun AgendaSheet(lib: LibrarySession, onOpen: (noteId: String, line: Int) -> Unit, onDismiss: () -> Unit) { + val c = Ivy.colors + val s = LocalStrings.current + val engine = lib.engine + val revision by engine.revision.collectAsState() + val today = LocalDate.now() + val items = remember(revision, today) { Tasks.agenda(engine.notes.values, today) } + val anyProtected = remember(revision) { engine.notes.values.any { !it.deleted && !it.isTrashed && NoteLock.isEncrypted(it.body) } } + val dateFormat = remember(s) { DateTimeFormatter.ofLocalizedDate(FormatStyle.MEDIUM).withLocale(s.locale) } + + ModalBottomSheet(onDismissRequest = onDismiss, sheetState = rememberModalBottomSheetState(skipPartiallyExpanded = true), containerColor = c.canvas) { + Column( + Modifier.verticalScroll(rememberScrollState()).padding(horizontal = 16.dp).navigationBarsPadding().padding(bottom = 24.dp), + verticalArrangement = Arrangement.spacedBy(2.dp), + ) { + Text(s.agenda, style = SerifTitle, fontSize = 20.sp, color = c.ink, modifier = Modifier.padding(horizontal = 4.dp, vertical = 6.dp)) + if (items.isEmpty()) { + Text(s.agendaEmpty, color = c.ink, fontSize = 15.sp, modifier = Modifier.padding(horizontal = 4.dp, vertical = 8.dp)) + Text(s.agendaEmptyHint, color = c.muted, fontSize = 13.sp, modifier = Modifier.padding(horizontal = 4.dp)) + } + var lastGroup = "" + for (item in items) { + val group = when { + item.days < 0 -> s.agendaOverdue + item.days == 0L -> s.agendaToday + else -> s.agendaLater + } + if (group != lastGroup) { + lastGroup = group + Caption(group, Modifier.padding(start = 4.dp, top = 12.dp, bottom = 2.dp)) + } + val due = item.task.due!! + val color = when { + item.days < 0 -> c.danger + item.days == 0L -> c.ivy + else -> c.muted + } + Row( + Modifier.fillMaxWidth().clip(RoundedCornerShape(12.dp)).clickable { onOpen(item.noteId, item.task.line) }.padding(end = 8.dp, top = 2.dp, bottom = 2.dp), + verticalAlignment = Alignment.CenterVertically, + ) { + Checkbox( + checked = false, + onCheckedChange = { _ -> + val note = engine.notes[item.noteId] ?: return@Checkbox + // Only if the line is still the task shown. + if (note.body.split('\n').getOrNull(item.task.line) != item.task.raw) return@Checkbox + engine.updateNote(note.id, SyncEngine.NotePatch(body = Tasks.toggle(note.body, item.task.line, today))) + }, + colors = CheckboxDefaults.colors(checkedColor = c.ivy, uncheckedColor = c.faint), + ) + Column(Modifier.weight(1f)) { + Text(item.task.text.ifEmpty { s.untitled }, color = c.ink, fontSize = 15.sp, maxLines = 2, overflow = TextOverflow.Ellipsis) + val time = due.time?.let { t -> " %02d:%02d".format(t.hour, t.minute) } ?: "" + val title = item.noteTitle.ifEmpty { s.untitled } + Text("${due.date.format(dateFormat)}$time · $title", color = c.muted, fontSize = 12.sp, maxLines = 1, overflow = TextOverflow.Ellipsis) + } + Spacer(Modifier.width(8.dp)) + Text(s.daysLeft(item.days), color = color, fontSize = 12.sp) + } + } + if (anyProtected) { + Text(s.agendaProtectedHint, color = c.faint, fontSize = 12.sp, modifier = Modifier.padding(horizontal = 4.dp, vertical = 12.dp)) + } + } + } +} diff --git a/app/src/main/kotlin/app/ivynote/android/ui/LibraryScreen.kt b/app/src/main/kotlin/app/ivynote/android/ui/LibraryScreen.kt index a81047c..7d4b793 100644 --- a/app/src/main/kotlin/app/ivynote/android/ui/LibraryScreen.kt +++ b/app/src/main/kotlin/app/ivynote/android/ui/LibraryScreen.kt @@ -38,6 +38,7 @@ import androidx.compose.ui.draw.clip import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import app.ivynote.android.IvyApp +import app.ivynote.android.MainActivity import app.ivynote.android.LibrarySession import app.ivynote.core.L10n import app.ivynote.core.SessionStore @@ -51,6 +52,9 @@ class LibraryUiState(val lib: LibrarySession) { var expanded by mutableStateOf(IvyApp.instance.catalog.expanded(lib.ref.id)) var showAccount by mutableStateOf(false) var showMedia by mutableStateOf(false) + var showAgenda by mutableStateOf(false) + /** A line to show once the note opens (a task picked on the agenda). */ + var pendingLine by mutableStateOf?>(null) val selectedNote: String? get() = selection?.let(Shelf::noteId) @@ -153,6 +157,29 @@ fun LibraryScreen(lib: LibrarySession, session: SessionStore?) { } } + if (ui.showAgenda) { + AgendaSheet(lib, onOpen = { id, line -> + ui.showAgenda = false + ui.pendingLine = id to line + ui.reveal(id) + }, onDismiss = { ui.showAgenda = false }) + } + + // A tapped reminder: its note, in its library. + val request by MainActivity.openRequest.collectAsState() + LaunchedEffect(request) { + val r = request ?: return@LaunchedEffect + val catalog = IvyApp.instance.catalog + when { + r.library == lib.ref.id -> { + MainActivity.openRequest.value = null + if (engine.notes[r.note] != null) ui.reveal(r.note) + } + catalog.library(r.library) != null -> catalog.open(r.library) + else -> MainActivity.openRequest.value = null + } + } + if (ui.showMedia) { MediaScreen(lib, onOpenNote = { id -> ui.showMedia = false; ui.reveal(id) }, onDismiss = { ui.showMedia = false }) } diff --git a/app/src/main/kotlin/app/ivynote/android/ui/NoteScreen.kt b/app/src/main/kotlin/app/ivynote/android/ui/NoteScreen.kt index 4243004..7eecc5f 100644 --- a/app/src/main/kotlin/app/ivynote/android/ui/NoteScreen.kt +++ b/app/src/main/kotlin/app/ivynote/android/ui/NoteScreen.kt @@ -30,7 +30,11 @@ import androidx.compose.material.icons.automirrored.filled.FormatListBulleted import androidx.compose.material.icons.automirrored.filled.Undo import androidx.compose.material.icons.outlined.AddLink import androidx.compose.material.icons.outlined.AttachFile +import androidx.compose.material.icons.outlined.Event import androidx.compose.material.icons.outlined.History +import androidx.compose.material.icons.outlined.Lock +import androidx.compose.material.icons.outlined.LockOpen +import androidx.compose.material.icons.outlined.VpnKey import androidx.compose.material.icons.outlined.Image import androidx.compose.material.icons.outlined.IosShare import androidx.compose.material.icons.outlined.PhotoCamera @@ -108,6 +112,7 @@ fun NoteScreen(ui: LibraryUiState, noteId: String, wide: Boolean, onBack: () -> var history by remember { mutableStateOf(false) } var sharing by remember { mutableStateOf(false) } val adding by lib.adding.collectAsState() + val protection by host.protection.collectAsState() val linkCount = remember(revision, noteId) { Links.backlinks(noteId, engine.notes.values).size } // Picked files land in the note they were picked for, even if another is open by the time they are ready. @@ -123,6 +128,11 @@ fun NoteScreen(ui: LibraryUiState, noteId: String, wide: Boolean, onBack: () -> host.setTheme(dark) val n = engine.notes[noteId] ?: return@LaunchedEffect host.open(n, focus = n.body.isEmpty() && n.title.isEmpty() && !n.isTrashed) + // Opened from the agenda: show the task. + ui.pendingLine?.takeIf { it.first == noteId }?.let { (_, line) -> + ui.pendingLine = null + host.scrollToLine(line) + } } LaunchedEffect(dark) { host.setTheme(dark) } LaunchedEffect(s) { host.setLanguage(L10n.language) } @@ -163,7 +173,11 @@ fun NoteScreen(ui: LibraryUiState, noteId: String, wide: Boolean, onBack: () -> if (focused && !wide) { TextButton(onClick = { host.hideKeyboard() }) { Text(s.done, color = c.ivy, fontWeight = FontWeight.SemiBold) } } - if (!note.isTrashed) { + if (protection.protected) { + Icon(Icons.Outlined.Lock, contentDescription = s.protectedNote, tint = c.faint, modifier = Modifier.padding(horizontal = 6.dp).size(18.dp)) + } + // A protected note is never shared: the server cannot read it. + if (!note.isTrashed && !protection.protected) { IconButton(onClick = { sharing = true }) { Icon(Icons.Outlined.IosShare, contentDescription = s.share, tint = c.ink2) } } IconButton(onClick = { outline = true }) { Icon(Icons.Outlined.Toc, contentDescription = s.outline, tint = c.ink2) } @@ -180,6 +194,24 @@ fun NoteScreen(ui: LibraryUiState, noteId: String, wide: Boolean, onBack: () -> DropdownMenuItem(text = { Text(s.history) }, leadingIcon = { Icon(Icons.Outlined.History, null) }, onClick = { menu = false; history = true }) } + if (!note.isTrashed && !protection.locked) { + DropdownMenuItem(text = { Text(s.dateAndReminder) }, leadingIcon = { Icon(Icons.Outlined.Event, null) }, + onClick = { menu = false; host.command("due") }) + } + if (!note.isTrashed && !protection.locked) { + HorizontalDivider() + if (protection.protected) { + DropdownMenuItem(text = { Text(s.lockNoteNow) }, leadingIcon = { Icon(Icons.Outlined.Lock, null) }, + onClick = { menu = false; host.command("lock") }) + DropdownMenuItem(text = { Text(s.changeNotePassword) }, leadingIcon = { Icon(Icons.Outlined.VpnKey, null) }, + onClick = { menu = false; host.command("changePassword") }) + DropdownMenuItem(text = { Text(s.removeNotePassword) }, leadingIcon = { Icon(Icons.Outlined.LockOpen, null) }, + onClick = { menu = false; host.command("unprotect") }) + } else { + DropdownMenuItem(text = { Text(s.protectNote) }, leadingIcon = { Icon(Icons.Outlined.Lock, null) }, + onClick = { menu = false; host.command("protect") }) + } + } HorizontalDivider() NoteMenuItems(note, ui, engine, ShelfActions( newNote = ui::newNote, newFolder = {}, renameFolder = {}, deleteFolder = {}, @@ -308,6 +340,7 @@ private fun FormatBar(host: app.ivynote.android.editor.EditorHost, modifier: Mod Triple("bold", Icons.Outlined.FormatBold, s.formatBold), Triple("italic", Icons.Outlined.FormatItalic, s.formatItalic), Triple("task", Icons.Outlined.CheckBox, s.formatTask), + Triple("due", Icons.Outlined.Event, s.formatDue), Triple("list", Icons.AutoMirrored.Filled.FormatListBulleted, s.formatList), Triple("ordered", Icons.Outlined.FormatListNumbered, s.formatOrdered), Triple("quote", Icons.Outlined.FormatQuote, s.formatQuote), diff --git a/app/src/main/kotlin/app/ivynote/android/ui/ShelfPane.kt b/app/src/main/kotlin/app/ivynote/android/ui/ShelfPane.kt index 3fe6e48..a84bccb 100644 --- a/app/src/main/kotlin/app/ivynote/android/ui/ShelfPane.kt +++ b/app/src/main/kotlin/app/ivynote/android/ui/ShelfPane.kt @@ -45,6 +45,7 @@ import androidx.compose.material.icons.outlined.FolderOpen import androidx.compose.material.icons.outlined.Language import androidx.compose.material.icons.outlined.ManageAccounts import androidx.compose.material.icons.outlined.MoreHoriz +import androidx.compose.material.icons.outlined.Event import androidx.compose.material.icons.outlined.PhotoLibrary import androidx.compose.material.icons.outlined.PushPin import androidx.compose.material.icons.outlined.Restore @@ -275,6 +276,8 @@ private fun LibraryHeader(ui: LibraryUiState, session: SessionStore?, state: app DropdownMenuItem(text = { Text(s.turnOnSyncEllipsis) }, leadingIcon = { Icon(Icons.Outlined.CloudUpload, null) }, onClick = { open = false; catalog.turnOnSync(ref.id) }) } + DropdownMenuItem(text = { Text(s.agenda) }, leadingIcon = { Icon(Icons.Outlined.Event, null) }, + onClick = { open = false; ui.showAgenda = true }) DropdownMenuItem(text = { Text(s.mediaLibrary) }, leadingIcon = { Icon(Icons.Outlined.PhotoLibrary, null) }, onClick = { open = false; ui.showMedia = true }) DropdownMenuItem(text = { Text(s.language) }, leadingIcon = { Icon(Icons.Outlined.Language, null) }, diff --git a/core/src/main/kotlin/app/ivynote/core/Search.kt b/core/src/main/kotlin/app/ivynote/core/Search.kt index b895e80..9cb5e94 100644 --- a/core/src/main/kotlin/app/ivynote/core/Search.kt +++ b/core/src/main/kotlin/app/ivynote/core/Search.kt @@ -19,7 +19,9 @@ object Search { for (n in notes) { if (n.isTrashed || n.deleted) continue val title = n.title.lowercase() - val body = n.body.lowercase() + // A protected note is found by its title only (guide 8.4). + val locked = NoteLock.isEncrypted(n.body) + val body = if (locked) "" else n.body.lowercase() var score = 0.0 var all = true for (t in terms) { @@ -35,7 +37,7 @@ object Search { } if (!all) continue score += maxOf(0.0, 1 - (now - n.updatedAt).toDouble() / YEAR_MS) - val (snippet, ranges) = snippet(n.body, terms) + val (snippet, ranges) = snippet(if (locked) "" else n.body, terms) hits += Hit(n, score, snippet, ranges) } return hits.sortedWith(compareByDescending { it.score }.thenByDescending { it.note.updatedAt }).take(limit) diff --git a/core/src/main/kotlin/app/ivynote/core/Strings.kt b/core/src/main/kotlin/app/ivynote/core/Strings.kt index b8d232d..95c6ce2 100644 --- a/core/src/main/kotlin/app/ivynote/core/Strings.kt +++ b/core/src/main/kotlin/app/ivynote/core/Strings.kt @@ -395,6 +395,26 @@ interface Strings { val serverInvalid: String fun unsupportedScheme(scheme: String): String fun insecureRemote(host: String): String + + // Dates, reminders and protected notes (guide 8.4, 9.4, 11.8) + val agenda: String + val agendaEmpty: String + val agendaEmptyHint: String + val agendaProtectedHint: String + val agendaOverdue: String + val agendaToday: String + val agendaLater: String + val dateAndReminder: String + val formatDue: String + val protectNote: String + val changeNotePassword: String + val removeNotePassword: String + val lockNoteNow: String + val protectedNote: String + val reminderChannel: String + val reminderChannelHint: String + fun reminderFrom(title: String): String + fun daysLeft(days: Long): String } object ZhStrings : Strings { @@ -776,6 +796,29 @@ object ZhStrings : Strings { override val serverInvalid = "服务器地址无效" override fun unsupportedScheme(scheme: String) = "不支持的协议:$scheme" override fun insecureRemote(host: String) = "$host 不是局域网地址,必须使用 https://" + + override val agenda = "日程" + override val agendaEmpty = "还没有带日期的待办" + override val agendaEmptyHint = "在待办后输入 @明天 9点、@周五,或点格式栏的日期按钮。选好日期就会出现在这里,到点提醒。" + override val agendaProtectedHint = "加密笔记中的待办不会出现在日程里。" + override val agendaOverdue = "已逾期" + override val agendaToday = "今天" + override val agendaLater = "接下来" + override val dateAndReminder = "日期与提醒" + override val formatDue = "日期与提醒" + override val protectNote = "设置密码…" + override val changeNotePassword = "更改密码…" + override val removeNotePassword = "移除密码" + override val lockNoteNow = "立即锁定" + override val protectedNote = "已加密" + override val reminderChannel = "待办提醒" + override val reminderChannelHint = "带日期的待办到点提醒" + override fun reminderFrom(title: String) = "来自《$title》" + override fun daysLeft(days: Long) = when { + days == 0L -> "今天" + days > 0 -> "$days 天后" + else -> "逾期 ${-days} 天" + } } object EnStrings : Strings { @@ -1161,4 +1204,27 @@ object EnStrings : Strings { override val serverInvalid = "The server address is not valid" override fun unsupportedScheme(scheme: String) = "Unsupported protocol: $scheme" override fun insecureRemote(host: String) = "$host is not on the local network; use https://" + + override val agenda = "Agenda" + override val agendaEmpty = "No dated to-dos yet" + override val agendaEmptyHint = "Type @tomorrow 9am or @fri after a to-do, or tap the date button in the format bar. Dated to-dos appear here and remind you when they are due." + override val agendaProtectedHint = "To-dos in password-protected notes are not shown here." + override val agendaOverdue = "Overdue" + override val agendaToday = "Today" + override val agendaLater = "Coming up" + override val dateAndReminder = "Date & reminder" + override val formatDue = "Date & reminder" + override val protectNote = "Protect with password…" + override val changeNotePassword = "Change password…" + override val removeNotePassword = "Remove password" + override val lockNoteNow = "Lock now" + override val protectedNote = "Protected" + override val reminderChannel = "To-do reminders" + override val reminderChannelHint = "Dated to-dos when they are due" + override fun reminderFrom(title: String) = "From “$title”" + override fun daysLeft(days: Long) = when { + days == 0L -> "today" + days > 0 -> if (days == 1L) "in 1 day" else "in $days days" + else -> if (days == -1L) "1 day overdue" else "${-days} days overdue" + } } diff --git a/core/src/main/kotlin/app/ivynote/core/Tasks.kt b/core/src/main/kotlin/app/ivynote/core/Tasks.kt new file mode 100644 index 0000000..89ce03b --- /dev/null +++ b/core/src/main/kotlin/app/ivynote/core/Tasks.kt @@ -0,0 +1,153 @@ +package app.ivynote.core + +import java.time.LocalDate +import java.time.LocalDateTime +import java.time.LocalTime +import java.time.ZoneId +import java.time.format.DateTimeParseException +import java.time.temporal.ChronoUnit + +/** + * Password-protected notes (guide 8.4): the body is one ```ivy-encrypted + * fence sealed by the editor page. The app never decrypts it; it only keeps + * it out of search, excerpts, the agenda and reminders. + */ +object NoteLock { + private val ENVELOPE = Regex("^\\s*```ivy-encrypted[ \\t]*\\n[\\s\\S]*?\\n```[ \\t]*\\s*$") + + fun isEncrypted(body: String): Boolean = + body.trimStart().startsWith("```ivy-encrypted") && ENVELOPE.matches(body) +} + +/** + * Tasks with dates (guide 9.4), as the web client's `markdown/tasks.ts` and + * `agenda.ts`: `- [ ] 交房租 📅 2026-11-15 09:00 🔁 every month`. Dates are + * local to the device. + */ +object Tasks { + data class Due(val date: LocalDate, val time: LocalTime?) + data class Repeat(val every: Int, val unit: String, val text: String) + data class Task(val line: Int, val text: String, val done: Boolean, val due: Due?, val repeat: Repeat?, val raw: String) + + private val TASK = Regex("^(\\s*(?:[-*+]|\\d+[.)])\\s+\\[)([ xX])(\\]\\s?)(.*)$") + private val DUE = Regex("📅\\uFE0F?\\s*(\\d{4}-\\d{2}-\\d{2})(?:[ T](\\d{1,2}:\\d{2}))?") + private val DONE = Regex("✅\\uFE0F?\\s*(\\d{4}-\\d{2}-\\d{2})") + private val REPEAT = Regex("🔁\\uFE0F?\\s*([^📅✅⏳🛫➕⏫🔼🔽🔺⏬\\n]*)") + private val RULE = Regex("^every\\s+(?:(\\d{1,3})\\s+)?(day|week|month|year)s?$") + private val FENCE = Regex("^\\s*(```|~~~)") + + private fun date(s: String): LocalDate? = try { LocalDate.parse(s) } catch (_: DateTimeParseException) { null } + + private fun time(s: String?): LocalTime? { + val m = Regex("^(\\d{1,2}):(\\d{2})$").find(s ?: return null) ?: return null + val h = m.groupValues[1].toInt() + val mi = m.groupValues[2].toInt() + return if (h in 0..23 && mi in 0..59) LocalTime.of(h, mi) else null + } + + fun parseRepeat(text: String): Repeat? { + val t = text.trim().lowercase() + if (t == "every weekday") return Repeat(1, "weekday", text.trim()) + val m = RULE.find(t) ?: return null + val n = m.groupValues[1].ifEmpty { "1" }.toInt() + return if (n >= 1) Repeat(n, m.groupValues[2], text.trim()) else null + } + + /** The task lines of a body, skipping code. */ + fun parse(body: String): List { + val out = ArrayList() + var inFence = false + body.split('\n').forEachIndexed { i, line -> + if (FENCE.containsMatchIn(line)) inFence = !inFence + if (inFence) return@forEachIndexed + val m = TASK.find(line) ?: return@forEachIndexed + val rest = m.groupValues[4] + val d = DUE.find(rest) + val due = d?.let { date(it.groupValues[1])?.let { day -> Due(day, time(it.groupValues[2].ifEmpty { null })) } } + val rep = REPEAT.find(rest)?.let { parseRepeat(it.groupValues[1]) } + val text = rest.replace(DUE, "").replace(DONE, "").replace(REPEAT, "").replace(Regex("\\s+"), " ").trim() + out += Task(i, text, m.groupValues[2] != " ", due, rep, line) + } + return out + } + + private fun live(n: Note) = !n.deleted && !n.isTrashed && n.body.contains("📅") && !NoteLock.isEncrypted(n.body) + + data class Reminder(val key: String, val noteId: String, val noteTitle: String, val text: String, val line: Int, val at: Millis) + + /** + * Reminders that fire in [from, to). [allDayTime] is when a task with a + * date but no time reminds; null: such tasks do not remind. + */ + fun reminders(notes: Collection, from: Millis, to: Millis, allDayTime: LocalTime?, zone: ZoneId = ZoneId.systemDefault()): List { + val out = ArrayList() + for (n in notes) { + if (!live(n)) continue + for (t in parse(n.body)) { + val due = t.due ?: continue + if (t.done) continue + val at = LocalDateTime.of(due.date, due.time ?: allDayTime ?: continue).atZone(zone).toInstant().toEpochMilli() + if (at < from || at >= to) continue + out += Reminder("${n.id}:${t.text.hashCode().toUInt().toString(36)}:${due.date}${due.time ?: ""}", n.id, n.title, t.text, t.line, at) + } + } + return out.sortedBy { it.at } + } + + data class AgendaItem(val noteId: String, val noteTitle: String, val task: Task, val days: Long) + + /** Open dated tasks across notes, soonest first (overdue at the top). */ + fun agenda(notes: Collection, today: LocalDate = LocalDate.now()): List { + val out = ArrayList() + for (n in notes) { + if (!live(n)) continue + for (t in parse(n.body)) { + val due = t.due ?: continue + if (t.done) continue + out += AgendaItem(n.id, n.title, t, ChronoUnit.DAYS.between(today, due.date)) + } + } + return out.sortedWith(compareBy { it.task.due!!.date }.thenBy { it.task.due!!.time ?: LocalTime.MAX }.thenBy { it.noteTitle }.thenBy { it.task.line }) + } + + fun nextDate(date: LocalDate, rule: Repeat): LocalDate = when (rule.unit) { + "day" -> date.plusDays(rule.every.toLong()) + "week" -> date.plusWeeks(rule.every.toLong()) + "month" -> date.plusMonths(rule.every.toLong()) + "year" -> date.plusYears(rule.every.toLong()) + else -> { + var d = date.plusDays(1) + while (d.dayOfWeek.value >= 6) d = d.plusDays(1) + d + } + } + + /** + * Checks or unchecks the task on a 0-based line, as the editor does: + * a dated task gets ✅ and the day, and a repeating one its next + * occurrence on the line above. + */ + fun toggle(body: String, lineNo: Int, today: LocalDate = LocalDate.now()): String { + val lines = body.split('\n').toMutableList() + val line = lines.getOrNull(lineNo) ?: return body + val m = TASK.find(line) ?: return body + val (open, mark, close, rest) = m.destructured + if (mark != " ") { + lines[lineNo] = "$open $close${rest.replace(Regex("\\s*" + DONE.pattern), "")}".trimEnd() + return lines.joinToString("\n") + } + val t = parse(line).firstOrNull() ?: return body + if (t.due == null && t.repeat == null) { + lines[lineNo] = "${open}x$close$rest" + return lines.joinToString("\n") + } + val clean = rest.replace(Regex("\\s*" + DONE.pattern), "").trimEnd() + lines[lineNo] = "${open}x$close$clean ✅ $today" + if (t.repeat != null && t.due != null) { + val next = nextDate(t.due.date, t.repeat) + val marker = "📅 $next" + (t.due.time?.let { " %02d:%02d".format(it.hour, it.minute) } ?: "") + lines.add(lineNo, "$open $close" + clean.replace(DUE, marker)) + } + return lines.joinToString("\n") + } +} diff --git a/core/src/test/kotlin/app/ivynote/core/TasksTest.kt b/core/src/test/kotlin/app/ivynote/core/TasksTest.kt new file mode 100644 index 0000000..4df4f5c --- /dev/null +++ b/core/src/test/kotlin/app/ivynote/core/TasksTest.kt @@ -0,0 +1,72 @@ +package app.ivynote.core + +import java.time.LocalDate +import java.time.LocalDateTime +import java.time.LocalTime +import java.time.ZoneId +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFalse +import kotlin.test.assertNull +import kotlin.test.assertTrue + +class TasksTest { + private val sealed = "```ivy-encrypted\nThis note is encrypted.\nv: 1\nkdf: scrypt N=32768 r=8 p=1\nsalt: AA==\nnonce: AA==\ndata: AA==\n```\n" + + @Test fun detectsProtectedNotes() { + assertTrue(NoteLock.isEncrypted(sealed)) + assertFalse(NoteLock.isEncrypted("x\n$sealed")) + assertFalse(NoteLock.isEncrypted("plain")) + } + + @Test fun parsesTasks() { + val ts = Tasks.parse("- [ ] 交房租 📅 2026-11-15 09:00 🔁 every month\n```\n- [ ] code 📅 2026-11-01\n```\n* [x] done ✅ 2026-11-01 📅 2026-10-31\n- [ ] bad 📅 2026-02-30\n- [ ] plain") + assertEquals(4, ts.size) + assertEquals("交房租", ts[0].text) + assertEquals(LocalDate.of(2026, 11, 15), ts[0].due!!.date) + assertEquals(LocalTime.of(9, 0), ts[0].due!!.time) + assertEquals(Tasks.Repeat(1, "month", "every month"), ts[0].repeat) + assertTrue(ts[1].done) + assertEquals(4, ts[1].line) + assertNull(ts[2].due) + assertNull(ts[3].due) + assertEquals(Tasks.Repeat(2, "week", "every 2 weeks"), Tasks.parseRepeat("every 2 weeks")) + assertNull(Tasks.parseRepeat("sometimes")) + } + + @Test fun listsRemindersAndAgenda() { + val zone = ZoneId.of("Asia/Shanghai") + val notes = listOf( + Note("a", title = "生活", body = "- [ ] 早 📅 2026-11-09 08:00\n- [ ] 全天 📅 2026-11-09\n- [ ] 过期 📅 2026-11-01\n- [x] 完成 📅 2026-11-09 ✅ 2026-11-09"), + Note("b", title = "回收", body = "- [ ] x 📅 2026-11-09 08:00", trashedAt = 5), + Note("c", title = "秘密", body = sealed), + ) + val from = LocalDateTime.of(2026, 11, 9, 0, 0).atZone(zone).toInstant().toEpochMilli() + val to = LocalDateTime.of(2026, 11, 10, 0, 0).atZone(zone).toInstant().toEpochMilli() + assertEquals(listOf("早"), Tasks.reminders(notes, from, to, null, zone).map { it.text }) + val all = Tasks.reminders(notes, from, to, LocalTime.of(9, 0), zone) + assertEquals(listOf("早", "全天"), all.map { it.text }) + assertEquals(all, Tasks.reminders(notes, from, to, LocalTime.of(9, 0), zone)) + val agenda = Tasks.agenda(notes, LocalDate.of(2026, 11, 9)) + assertEquals(listOf("过期" to -8L, "早" to 0L, "全天" to 0L), agenda.map { it.task.text to it.days }) + } + + @Test fun togglesLikeTheEditor() { + val today = LocalDate.of(2026, 11, 15) + assertEquals( + "- [ ] 交房租 📅 2026-12-15 09:00 🔁 every month\n- [x] 交房租 📅 2026-11-15 09:00 🔁 every month ✅ 2026-11-15", + Tasks.toggle("- [ ] 交房租 📅 2026-11-15 09:00 🔁 every month", 0, today) + ) + assertEquals("- [ ] a 📅 2026-11-15", Tasks.toggle("- [x] a 📅 2026-11-15 ✅ 2026-11-15", 0, today)) + assertEquals("- [x] plain", Tasks.toggle("- [ ] plain", 0, today)) + assertEquals("text", Tasks.toggle("text", 0, today)) + assertEquals(LocalDate.of(2026, 2, 28), Tasks.nextDate(LocalDate.of(2026, 1, 31), Tasks.Repeat(1, "month", ""))) + assertEquals(LocalDate.of(2026, 11, 16), Tasks.nextDate(LocalDate.of(2026, 11, 13), Tasks.Repeat(1, "weekday", ""))) + } + + @Test fun searchSkipsProtectedBodies() { + val notes = listOf(Note("s", title = "Secret", body = sealed)) + assertTrue(Search.run(notes, "AA==").isEmpty()) + assertEquals("", Search.run(notes, "secret").single().snippet) + } +} diff --git a/editor-web/build.sh b/editor-web/build.sh index 92353e5..47c76e0 100755 --- a/editor-web/build.sh +++ b/editor-web/build.sh @@ -33,9 +33,10 @@ NODE_PATH="$ivy/node_modules" "$bin/esbuild" "$here/main.ts" \ --outdir="$out" # Styles: the web's design tokens and prose styles, the editor's own styles -# lifted from Editor.svelte (":global(x)" -> "x"), and the native page frame. +# lifted from Editor.svelte (":global(x)" -> "x", "@keyframes -global-x" -> +# "@keyframes x"), and the native page frame. sed -n '/