From 596cbd0a56d0839607a1726834a80f5a36dd162d Mon Sep 17 00:00:00 2001 From: frankkulak Date: Sat, 17 Feb 2024 09:49:31 -0500 Subject: [PATCH] Deploy. --- build/bundle.css | 2 +- build/bundle.js | 2 +- build/bundle.js.map | 2 +- build/tailwind.css | 4 ---- 4 files changed, 3 insertions(+), 7 deletions(-) diff --git a/build/bundle.css b/build/bundle.css index 56487d6..29bcb0c 100644 --- a/build/bundle.css +++ b/build/bundle.css @@ -1 +1 @@ -nav.svelte-1vd52s4{overflow:visible !important}.centered-in-relative.svelte-1a3x1h9{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.up-on-hover.svelte-1a3x1h9{transition:top ease 200ms}.up-on-hover.svelte-1a3x1h9:hover{top:-4px}.download-button.svelte-1raocbi:hover img.svelte-1raocbi{filter:var(--filter-svg-invert)}button.svelte-1dbjub8.svelte-1dbjub8{background:none;color:var(--color-text);border-radius:4px}button.border.svelte-1dbjub8.svelte-1dbjub8{border:1px solid var(--color-text)}button.use-bg.svelte-1dbjub8.svelte-1dbjub8{background-color:var(--color-bg)}button.svelte-1dbjub8.svelte-1dbjub8:not(.border){border:none}button.svelte-1dbjub8 img.svelte-1dbjub8{height:18px;width:auto;margin-right:10px}button.large.svelte-1dbjub8.svelte-1dbjub8{font-size:1.2em}button.large.svelte-1dbjub8 img.svelte-1dbjub8{height:32px}button.active.svelte-1dbjub8.svelte-1dbjub8:hover,button.active.svelte-1dbjub8.svelte-1dbjub8:focus{cursor:pointer;background-color:var(--color-accent-secondary);border-color:var(--color-accent-secondary);color:var(--color-bg)}button.active:hover.danger.svelte-1dbjub8.svelte-1dbjub8,button.active:focus.danger.svelte-1dbjub8.svelte-1dbjub8{background-color:var(--color-error);border-color:var(--color-error);color:var(--color-light)}button.active:hover.danger.svelte-1dbjub8 img.svg.svelte-1dbjub8,button.active:focus.danger.svelte-1dbjub8 img.svg.svelte-1dbjub8{filter:var(--filter-light)}button.active.svelte-1dbjub8:hover:not(.danger) img.svg.svelte-1dbjub8,button.active.svelte-1dbjub8:focus:not(.danger) img.svg.svelte-1dbjub8{filter:var(--filter-svg-invert)}button.svelte-1dbjub8.svelte-1dbjub8:not(.active){border-color:var(--color-text-subtle);color:var(--color-text-subtle);cursor:not-allowed}button.svelte-1dbjub8.svelte-1dbjub8:not(.active):hover{cursor:not-allowed}button.svelte-1dbjub8:not(.active) img.svelte-1dbjub8{opacity:0.65}hr.svelte-1hlby7e{height:2px;border-radius:2px;width:85%}.loading-indicator.svelte-9y60i5.svelte-9y60i5{display:inline-block;position:relative;width:80px;height:13px}.loading-indicator.svelte-9y60i5 div.svelte-9y60i5{position:absolute;top:0px;width:13px;height:13px;border-radius:50%;background:var(--color-text);animation-timing-function:cubic-bezier(0, 1, 1, 0)}.loading-indicator.svelte-9y60i5 div.svelte-9y60i5:nth-child(1){left:8px;animation:svelte-9y60i5-loading-indicator1 0.6s infinite}.loading-indicator.svelte-9y60i5 div.svelte-9y60i5:nth-child(2){left:8px;animation:svelte-9y60i5-loading-indicator2 0.6s infinite}.loading-indicator.svelte-9y60i5 div.svelte-9y60i5:nth-child(3){left:32px;animation:svelte-9y60i5-loading-indicator2 0.6s infinite}.loading-indicator.svelte-9y60i5 div.svelte-9y60i5:nth-child(4){left:56px;animation:svelte-9y60i5-loading-indicator3 0.6s infinite}@keyframes svelte-9y60i5-loading-indicator1{0%{transform:scale(0)}100%{transform:scale(1)}}@keyframes svelte-9y60i5-loading-indicator2{0%{transform:translate(0, 0)}100%{transform:translate(24px, 0)}}@keyframes svelte-9y60i5-loading-indicator3{0%{transform:scale(1)}100%{transform:scale(0)}}.split-view.is-resizing.svelte-1j0yqlr{cursor:row-resize;user-select:none !important}.split-view-resizer.svelte-1j0yqlr:hover,.split-view-resizer.is-resizing.svelte-1j0yqlr{cursor:row-resize;background-color:var(--color-accent) !important;transition:background-color 200ms ease-in}button.active.svelte-1oz4oo2{border-bottom-color:var(--color-text) !important}p.active.svelte-1oz4oo2{color:var(--color-text) !important}.active-left-border.svelte-26t14g{border-left-color:var(--color-accent-secondary)}.stick-to-top.svelte-26t14g{position:sticky;top:0;z-index:10}.split-view.is-resizing.svelte-1jq8vs3{cursor:col-resize;user-select:none !important}.split-view-resizer.svelte-1jq8vs3:hover,.split-view-resizer.is-resizing.svelte-1jq8vs3{cursor:col-resize;background-color:var(--color-accent) !important;transition:background-color 200ms ease-in}.switch.svelte-107vzwt.svelte-107vzwt.svelte-107vzwt{width:30px;height:16px}.switch.svelte-107vzwt input.svelte-107vzwt:checked+.slider.svelte-107vzwt{background-color:var(--color-accent-secondary)}.switch.svelte-107vzwt input.svelte-107vzwt:focus+.slider.svelte-107vzwt::before{box-shadow:0 0 4px black}.switch.svelte-107vzwt input.svelte-107vzwt:checked+.slider.svelte-107vzwt::before{-webkit-transform:translateX(14px);-ms-transform:translateX(14px);transform:translateX(14px)}.switch.svelte-107vzwt .slider.svelte-107vzwt.svelte-107vzwt{background-color:var(--color-text-subtle);-webkit-transition:250ms;transition:250ms;border-radius:16px}.switch.svelte-107vzwt .slider.svelte-107vzwt.svelte-107vzwt::before{position:absolute;content:"";height:14px;width:14px;left:1px;bottom:1px;background-color:var(--color-bg);-webkit-transition:250ms;transition:250ms;border-radius:50%}mark.key.svelte-uav024{color:var(--color-text);border:1px solid var(--color-text);background-color:transparent;border-radius:2px;text-transform:uppercase;font-family:var(--font-mono), monospace;font-size:0.8em;padding-left:0.35em;padding-right:0.35em}.primary-entry.svelte-1ytoyos{border-radius:4px}.primary-entry.has-simdata.svelte-1ytoyos{border-radius:4px 4px 0 4px}.linked-entry.svelte-1ytoyos{border-radius:0;border-top:1px solid var(--color-bg);padding:0.5em;margin-left:2em}.linked-entry.svelte-1ytoyos:last-child{border-radius:0 0 4px 4px}button.svelte-1ehlu20.svelte-1ehlu20{background:none;border:1px solid var(--color-divider);padding:0.5em;border-radius:4px}button.round.svelte-1ehlu20.svelte-1ehlu20{border-radius:50%}button.use-bg.svelte-1ehlu20.svelte-1ehlu20{background-color:var(--color-bg)}button.no-border.svelte-1ehlu20.svelte-1ehlu20{border:none !important}button.small.svelte-1ehlu20.svelte-1ehlu20{padding-left:0.65em;padding-right:0.65em}button.svelte-1ehlu20 img.svelte-1ehlu20{height:18px;width:auto}button.svelte-1ehlu20 img.small.svelte-1ehlu20{height:14px}button.active.svelte-1ehlu20.svelte-1ehlu20:hover,button.active.svelte-1ehlu20.svelte-1ehlu20:focus{cursor:pointer;background-color:var(--color-accent-secondary);border-color:var(--color-accent-secondary)}button.active:hover.danger-bg.svelte-1ehlu20.svelte-1ehlu20,button.active:focus.danger-bg.svelte-1ehlu20.svelte-1ehlu20{background-color:var(--color-danger);border-color:var(--color-danger)}button.active.svelte-1ehlu20:hover img.svelte-1ehlu20,button.active.svelte-1ehlu20:focus img.svelte-1ehlu20{filter:var(--filter-svg-invert)}button.svelte-1ehlu20.svelte-1ehlu20:not(.active){opacity:0.65}button.svelte-1ehlu20.svelte-1ehlu20:not(.active):hover{cursor:not-allowed}.active-left-border.svelte-1tsgmii{border-left-color:var(--color-accent-secondary)}input[type=file].svelte-10do9z8::file-selector-button{display:none}textarea.svelte-1sw55l8{resize:none;border-radius:8px;padding:8px;width:100%;height:350px;overflow-y:auto;overflow-x:auto;white-space:pre}input.invalid.svelte-1fm0ybo{border-color:var(--color-danger)}button.svelte-1xpaq9i:disabled{pointer-events:none;opacity:0.65}.checkbox.svelte-6qqi0r.svelte-6qqi0r{white-space:nowrap}.checkbox.svelte-6qqi0r input.svelte-6qqi0r:hover:not(:disabled),.checkbox.svelte-6qqi0r label.svelte-6qqi0r:hover:not(:disabled){cursor:pointer}.checkbox.svelte-6qqi0r input.svelte-6qqi0r:disabled,.checkbox.svelte-6qqi0r label.svelte-6qqi0r:disabled{opacity:0.65;pointer-events:none}.overlay.svelte-1piiy29.svelte-1piiy29{z-index:4096;position:fixed;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.overlay.svelte-1piiy29 .popup.svelte-1piiy29{max-width:768px;padding:1em}.overlay.svelte-1piiy29 .popup.large.svelte-1piiy29{max-width:1280px}.overlay.svelte-1piiy29 .popup.fill.svelte-1piiy29{width:100%}img.svelte-4un9ln{display:inline;height:0.8em;margin-left:0.2em;margin-right:0.2em}.select-with-label.svelte-17jj2pq select.small.svelte-17jj2pq{font-size:0.8em;padding-left:0.2rem;padding-right:0.2rem;padding-top:0.15rem;padding-bottom:0.15rem}.select-with-label.svelte-17jj2pq select option.svelte-17jj2pq{background-color:var(--color-bg)}.select-with-label.svelte-17jj2pq select.svelte-17jj2pq:disabled{opacity:0.65}.select-with-label.svelte-17jj2pq label.svelte-17jj2pq,.select-with-label.svelte-17jj2pq select.svelte-17jj2pq{display:block}.select-with-label.svelte-17jj2pq label.small.svelte-17jj2pq{font-size:0.6em}.active-border.svelte-1kz9fsp{border-color:var(--color-accent-secondary) !important}button.svelte-1on8w4u.svelte-1on8w4u{position:fixed;z-index:4096;top:25px;right:25px;width:40px;height:40px}button.svelte-1on8w4u img.svelte-1on8w4u{width:100%;height:100%}button.svelte-1on8w4u img.svelte-1on8w4u:hover{cursor:pointer;opacity:0.65} \ No newline at end of file +nav.svelte-1vd52s4{overflow:visible !important}.centered-in-relative.svelte-1a3x1h9{position:absolute;top:50%;left:50%;transform:translate(-50%, -50%)}.up-on-hover.svelte-1a3x1h9{transition:top ease 200ms}.up-on-hover.svelte-1a3x1h9:hover{top:-4px}.download-button.svelte-1raocbi:hover img.svelte-1raocbi{filter:var(--filter-svg-invert)}button.svelte-1dbjub8.svelte-1dbjub8{background:none;color:var(--color-text);border-radius:4px}button.border.svelte-1dbjub8.svelte-1dbjub8{border:1px solid var(--color-text)}button.use-bg.svelte-1dbjub8.svelte-1dbjub8{background-color:var(--color-bg)}button.svelte-1dbjub8.svelte-1dbjub8:not(.border){border:none}button.svelte-1dbjub8 img.svelte-1dbjub8{height:18px;width:auto;margin-right:10px}button.large.svelte-1dbjub8.svelte-1dbjub8{font-size:1.2em}button.large.svelte-1dbjub8 img.svelte-1dbjub8{height:32px}button.active.svelte-1dbjub8.svelte-1dbjub8:hover,button.active.svelte-1dbjub8.svelte-1dbjub8:focus{cursor:pointer;background-color:var(--color-accent-secondary);border-color:var(--color-accent-secondary);color:var(--color-bg)}button.active:hover.danger.svelte-1dbjub8.svelte-1dbjub8,button.active:focus.danger.svelte-1dbjub8.svelte-1dbjub8{background-color:var(--color-error);border-color:var(--color-error);color:var(--color-light)}button.active:hover.danger.svelte-1dbjub8 img.svg.svelte-1dbjub8,button.active:focus.danger.svelte-1dbjub8 img.svg.svelte-1dbjub8{filter:var(--filter-light)}button.active.svelte-1dbjub8:hover:not(.danger) img.svg.svelte-1dbjub8,button.active.svelte-1dbjub8:focus:not(.danger) img.svg.svelte-1dbjub8{filter:var(--filter-svg-invert)}button.svelte-1dbjub8.svelte-1dbjub8:not(.active){border-color:var(--color-text-subtle);color:var(--color-text-subtle);cursor:not-allowed}button.svelte-1dbjub8.svelte-1dbjub8:not(.active):hover{cursor:not-allowed}button.svelte-1dbjub8:not(.active) img.svelte-1dbjub8{opacity:0.65}hr.svelte-1hlby7e{height:2px;border-radius:2px;width:85%}.loading-indicator.svelte-9y60i5.svelte-9y60i5{display:inline-block;position:relative;width:80px;height:13px}.loading-indicator.svelte-9y60i5 div.svelte-9y60i5{position:absolute;top:0px;width:13px;height:13px;border-radius:50%;background:var(--color-text);animation-timing-function:cubic-bezier(0, 1, 1, 0)}.loading-indicator.svelte-9y60i5 div.svelte-9y60i5:nth-child(1){left:8px;animation:svelte-9y60i5-loading-indicator1 0.6s infinite}.loading-indicator.svelte-9y60i5 div.svelte-9y60i5:nth-child(2){left:8px;animation:svelte-9y60i5-loading-indicator2 0.6s infinite}.loading-indicator.svelte-9y60i5 div.svelte-9y60i5:nth-child(3){left:32px;animation:svelte-9y60i5-loading-indicator2 0.6s infinite}.loading-indicator.svelte-9y60i5 div.svelte-9y60i5:nth-child(4){left:56px;animation:svelte-9y60i5-loading-indicator3 0.6s infinite}@keyframes svelte-9y60i5-loading-indicator1{0%{transform:scale(0)}100%{transform:scale(1)}}@keyframes svelte-9y60i5-loading-indicator2{0%{transform:translate(0, 0)}100%{transform:translate(24px, 0)}}@keyframes svelte-9y60i5-loading-indicator3{0%{transform:scale(1)}100%{transform:scale(0)}}.split-view.is-resizing.svelte-1j0yqlr{cursor:row-resize;user-select:none !important}.split-view-resizer.svelte-1j0yqlr:hover,.split-view-resizer.is-resizing.svelte-1j0yqlr{cursor:row-resize;background-color:var(--color-accent) !important;transition:background-color 200ms ease-in}button.active.svelte-1oz4oo2{border-bottom-color:var(--color-text) !important}p.active.svelte-1oz4oo2{color:var(--color-text) !important}.active-left-border.svelte-26t14g{border-left-color:var(--color-accent-secondary)}.stick-to-top.svelte-26t14g{position:sticky;top:0;z-index:10}.split-view.is-resizing.svelte-1jq8vs3{cursor:col-resize;user-select:none !important}.split-view-resizer.svelte-1jq8vs3:hover,.split-view-resizer.is-resizing.svelte-1jq8vs3{cursor:col-resize;background-color:var(--color-accent) !important;transition:background-color 200ms ease-in}.switch.svelte-107vzwt.svelte-107vzwt.svelte-107vzwt{width:30px;height:16px}.switch.svelte-107vzwt input.svelte-107vzwt:checked+.slider.svelte-107vzwt{background-color:var(--color-accent-secondary)}.switch.svelte-107vzwt input.svelte-107vzwt:focus+.slider.svelte-107vzwt::before{box-shadow:0 0 4px black}.switch.svelte-107vzwt input.svelte-107vzwt:checked+.slider.svelte-107vzwt::before{-webkit-transform:translateX(14px);-ms-transform:translateX(14px);transform:translateX(14px)}.switch.svelte-107vzwt .slider.svelte-107vzwt.svelte-107vzwt{background-color:var(--color-text-subtle);-webkit-transition:250ms;transition:250ms;border-radius:16px}.switch.svelte-107vzwt .slider.svelte-107vzwt.svelte-107vzwt::before{position:absolute;content:"";height:14px;width:14px;left:1px;bottom:1px;background-color:var(--color-bg);-webkit-transition:250ms;transition:250ms;border-radius:50%}.primary-entry.svelte-1ytoyos{border-radius:4px}.primary-entry.has-simdata.svelte-1ytoyos{border-radius:4px 4px 0 4px}.linked-entry.svelte-1ytoyos{border-radius:0;border-top:1px solid var(--color-bg);padding:0.5em;margin-left:2em}.linked-entry.svelte-1ytoyos:last-child{border-radius:0 0 4px 4px}mark.key.svelte-uav024{color:var(--color-text);border:1px solid var(--color-text);background-color:transparent;border-radius:2px;text-transform:uppercase;font-family:var(--font-mono), monospace;font-size:0.8em;padding-left:0.35em;padding-right:0.35em}button.svelte-1ehlu20.svelte-1ehlu20{background:none;border:1px solid var(--color-divider);padding:0.5em;border-radius:4px}button.round.svelte-1ehlu20.svelte-1ehlu20{border-radius:50%}button.use-bg.svelte-1ehlu20.svelte-1ehlu20{background-color:var(--color-bg)}button.no-border.svelte-1ehlu20.svelte-1ehlu20{border:none !important}button.small.svelte-1ehlu20.svelte-1ehlu20{padding-left:0.65em;padding-right:0.65em}button.svelte-1ehlu20 img.svelte-1ehlu20{height:18px;width:auto}button.svelte-1ehlu20 img.small.svelte-1ehlu20{height:14px}button.active.svelte-1ehlu20.svelte-1ehlu20:hover,button.active.svelte-1ehlu20.svelte-1ehlu20:focus{cursor:pointer;background-color:var(--color-accent-secondary);border-color:var(--color-accent-secondary)}button.active:hover.danger-bg.svelte-1ehlu20.svelte-1ehlu20,button.active:focus.danger-bg.svelte-1ehlu20.svelte-1ehlu20{background-color:var(--color-danger);border-color:var(--color-danger)}button.active.svelte-1ehlu20:hover img.svelte-1ehlu20,button.active.svelte-1ehlu20:focus img.svelte-1ehlu20{filter:var(--filter-svg-invert)}button.svelte-1ehlu20.svelte-1ehlu20:not(.active){opacity:0.65}button.svelte-1ehlu20.svelte-1ehlu20:not(.active):hover{cursor:not-allowed}.active-left-border.svelte-1tsgmii{border-left-color:var(--color-accent-secondary)}input[type=file].svelte-10do9z8::file-selector-button{display:none}textarea.svelte-1sw55l8{resize:none;border-radius:8px;padding:8px;width:100%;height:350px;overflow-y:auto;overflow-x:auto;white-space:pre}input.invalid.svelte-1fm0ybo{border-color:var(--color-danger)}button.svelte-1xpaq9i:disabled{pointer-events:none;opacity:0.65}.checkbox.svelte-6qqi0r.svelte-6qqi0r{white-space:nowrap}.checkbox.svelte-6qqi0r input.svelte-6qqi0r:hover:not(:disabled),.checkbox.svelte-6qqi0r label.svelte-6qqi0r:hover:not(:disabled){cursor:pointer}.checkbox.svelte-6qqi0r input.svelte-6qqi0r:disabled,.checkbox.svelte-6qqi0r label.svelte-6qqi0r:disabled{opacity:0.65;pointer-events:none}.select-with-label.svelte-17jj2pq select.small.svelte-17jj2pq{font-size:0.8em;padding-left:0.2rem;padding-right:0.2rem;padding-top:0.15rem;padding-bottom:0.15rem}.select-with-label.svelte-17jj2pq select option.svelte-17jj2pq{background-color:var(--color-bg)}.select-with-label.svelte-17jj2pq select.svelte-17jj2pq:disabled{opacity:0.65}.select-with-label.svelte-17jj2pq label.svelte-17jj2pq,.select-with-label.svelte-17jj2pq select.svelte-17jj2pq{display:block}.select-with-label.svelte-17jj2pq label.small.svelte-17jj2pq{font-size:0.6em}.overlay.svelte-1piiy29.svelte-1piiy29{z-index:4096;position:fixed;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.overlay.svelte-1piiy29 .popup.svelte-1piiy29{max-width:768px;padding:1em}.overlay.svelte-1piiy29 .popup.large.svelte-1piiy29{max-width:1280px}.overlay.svelte-1piiy29 .popup.fill.svelte-1piiy29{width:100%}img.svelte-4un9ln{display:inline;height:0.8em;margin-left:0.2em;margin-right:0.2em}.active-border.svelte-1kz9fsp{border-color:var(--color-accent-secondary) !important}button.svelte-1on8w4u.svelte-1on8w4u{position:fixed;z-index:4096;top:25px;right:25px;width:40px;height:40px}button.svelte-1on8w4u img.svelte-1on8w4u{width:100%;height:100%}button.svelte-1on8w4u img.svelte-1on8w4u:hover{cursor:pointer;opacity:0.65} \ No newline at end of file diff --git a/build/bundle.js b/build/bundle.js index fce867a..27457e6 100644 --- a/build/bundle.js +++ b/build/bundle.js @@ -9,5 +9,5 @@ var app=function(){"use strict";function e(){}const t=e=>e;function n(e,t){for(c JSZip uses the library pako released under the MIT license : https://github.com/nodeca/pako/blob/main/LICENSE - */var it=tt((function(e,t){e.exports=function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){if(!a&&nt)return nt(o);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,(function(e){return r(t[o][1][e]||e)}),c,c.exports,e,t,n,i)}return n[o].exports}for(var s=nt,o=0;o>2,a=(3&t)<<4|n>>4,l=1>6:64,c=2>4,n=(15&o)<<4|(a=s.indexOf(e.charAt(c++)))>>2,i=(3&a)<<6|(l=s.indexOf(e.charAt(c++))),d[h++]=t,64!==a&&(d[h++]=n),64!==l&&(d[h++]=i);return d}},{"./support":30,"./utils":32}],2:[function(e,t,n){var i=e("./external"),r=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function a(e,t,n,i,r){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=i,this.compressedContent=r}a.prototype={getContentWorker:function(){var e=new r(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new r(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,n){return e.pipe(new s).pipe(new o("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){var i=e("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},n.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,n){var i=e("./utils"),r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==i.getTypeOf(e)?function(e,t,n,i){var s=r,o=i+n;e^=-1;for(var a=i;a>>8^s[255&(e^t[a])];return-1^e}(0|t,e,e.length,0):function(e,t,n,i){var s=r,o=i+n;e^=-1;for(var a=i;a>>8^s[255&(e^t.charCodeAt(a))];return-1^e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,n){n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t,n){var i=null;i="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:i}},{lie:37}],7:[function(e,t,n){var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,r=e("pako"),s=e("./utils"),o=e("./stream/GenericWorker"),a=i?"uint8array":"array";function l(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}n.magic="\b\0",s.inherits(l,o),l.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(a,e.data),!1)},l.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new r[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},n.compressWorker=function(e){return new l("Deflate",e)},n.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,n){function i(e,t){var n,i="";for(n=0;n>>=8;return i}function r(e,t,n,r,o,h){var u,d,f=e.file,O=e.compression,p=h!==a.utf8encode,m=s.transformTo("string",h(f.name)),g=s.transformTo("string",a.utf8encode(f.name)),b=f.comment,w=s.transformTo("string",h(b)),x=s.transformTo("string",a.utf8encode(b)),v=g.length!==f.name.length,y=x.length!==b.length,S="",$="",Q="",k=f.dir,P=f.date,T={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(T.crc32=e.crc32,T.compressedSize=e.compressedSize,T.uncompressedSize=e.uncompressedSize);var _=0;t&&(_|=8),p||!v&&!y||(_|=2048);var Z=0,C=0;k&&(Z|=16),"UNIX"===o?(C=798,Z|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(f.unixPermissions,k)):(C=20,Z|=function(e){return 63&(e||0)}(f.dosPermissions)),u=P.getUTCHours(),u<<=6,u|=P.getUTCMinutes(),u<<=5,u|=P.getUTCSeconds()/2,d=P.getUTCFullYear()-1980,d<<=4,d|=P.getUTCMonth()+1,d<<=5,d|=P.getUTCDate(),v&&($=i(1,1)+i(l(m),4)+g,S+="up"+i($.length,2)+$),y&&(Q=i(1,1)+i(l(w),4)+x,S+="uc"+i(Q.length,2)+Q);var X="";return X+="\n\0",X+=i(_,2),X+=O.magic,X+=i(u,2),X+=i(d,2),X+=i(T.crc32,4),X+=i(T.compressedSize,4),X+=i(T.uncompressedSize,4),X+=i(m.length,2),X+=i(S.length,2),{fileRecord:c.LOCAL_FILE_HEADER+X+m+S,dirRecord:c.CENTRAL_FILE_HEADER+i(C,2)+X+i(w.length,2)+"\0\0\0\0"+i(Z,4)+i(r,4)+m+S+w}}var s=e("../utils"),o=e("../stream/GenericWorker"),a=e("../utf8"),l=e("../crc32"),c=e("../signature");function h(e,t,n,i){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=i,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(h,o),h.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,i=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-i-1))/n:100}}))},h.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=r(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=r(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return c.DATA_DESCRIPTOR+i(e.crc32,4)+i(e.compressedSize,4)+i(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return i.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=r},{"../utils":32}],19:[function(e,t,n){var i=e("./Uint8ArrayReader");function r(e){i.call(this,e)}e("../utils").inherits(r,i),r.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){var i=e("./DataReader");function r(e){i.call(this,e)}e("../utils").inherits(r,i),r.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},r.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},r.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},r.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){var i=e("./ArrayReader");function r(e){i.call(this,e)}e("../utils").inherits(r,i),r.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){var i=e("../utils"),r=e("../support"),s=e("./ArrayReader"),o=e("./StringReader"),a=e("./NodeBufferReader"),l=e("./Uint8ArrayReader");t.exports=function(e){var t=i.getTypeOf(e);return i.checkSupport(t),"string"!==t||r.uint8array?"nodebuffer"===t?new a(e):r.uint8array?new l(i.transformTo("uint8array",e)):new s(i.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,n){var i=e("./GenericWorker"),r=e("../utils");function s(e){i.call(this,"ConvertWorker to "+e),this.destType=e}r.inherits(s,i),s.prototype.processChunk=function(e){this.push({data:r.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){var i=e("./GenericWorker"),r=e("../crc32");function s(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(s,i),s.prototype.processChunk=function(e){this.streamInfo.crc32=r(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){var i=e("../utils"),r=e("./GenericWorker");function s(e){r.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}i.inherits(s,r),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}r.prototype.processChunk.call(this,e)},t.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){var i=e("../utils"),r=e("./GenericWorker");function s(e){r.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=i.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}i.inherits(s,r),s.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){function i(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n "+e:e}},t.exports=i},{}],29:[function(e,t,n){var i=e("../utils"),r=e("./ConvertWorker"),s=e("./GenericWorker"),o=e("../base64"),a=e("../support"),l=e("../external"),c=null;if(a.nodestream)try{c=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function h(e,t){return new l.Promise((function(n,r){var s=[],a=e._internalType,l=e._outputType,c=e._mimeType;e.on("data",(function(e,n){s.push(e),t&&t(n)})).on("error",(function(e){s=[],r(e)})).on("end",(function(){try{var e=function(e,t,n){switch(e){case"blob":return i.newBlob(i.transformTo("arraybuffer",t),n);case"base64":return o.encode(t);default:return i.transformTo(e,t)}}(l,function(e,t){var n,i=0,r=null,s=0;for(n=0;n>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t}(e)},n.utf8decode=function(e){return r.nodebuffer?i.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,n,r,s,o=e.length,l=new Array(2*o);for(t=n=0;t>10&1023,l[n++]=56320|1023&r)}return l.length!==n&&(l.subarray?l=l.subarray(0,n):l.length=n),i.applyFromCharCode(l)}(e=i.transformTo(r.uint8array?"uint8array":"array",e))},i.inherits(c,o),c.prototype.processChunk=function(e){var t=i.transformTo(r.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(r.uint8array){var s=t;(t=new Uint8Array(s.length+this.leftOver.length)).set(this.leftOver,0),t.set(s,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+a[e[n]]>t?n:t}(t),l=t;o!==t.length&&(r.uint8array?(l=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(l=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:n.utf8decode(l),meta:e.meta})},c.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=c,i.inherits(h,o),h.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){var i=e("./support"),r=e("./base64"),s=e("./nodejsUtils"),o=e("./external");function a(e){return e}function l(e,t){for(var n=0;n>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=i(this.extraFields[1].value);this.uncompressedSize===r.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,i,r=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t},n.buf2binstring=function(e){return l(e,e.length)},n.binstring2buf=function(e){for(var t=new i.Buf8(e.length),n=0,r=t.length;n>10&1023,c[i++]=56320|1023&r)}return l(c,i)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+o[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){t.exports=function(e,t,n,i){for(var r=65535&e|0,s=e>>>16&65535|0,o=0;0!==n;){for(n-=o=2e3>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,r){var s=i,o=r+n;e^=-1;for(var a=r;a>>8^s[255&(e^t[a])];return-1^e}},{}],46:[function(e,t,n){var i,r=e("../utils/common"),s=e("./trees"),o=e("./adler32"),a=e("./crc32"),l=e("./messages"),c=0,h=4,u=0,d=-2,f=-1,O=4,p=2,m=8,g=9,b=286,w=30,x=19,v=2*b+1,y=15,S=3,$=258,Q=$+S+1,k=42,P=113,T=1,_=2,Z=3,C=4;function X(e,t){return e.msg=l[t],t}function Y(e){return(e<<1)-(4e.avail_out&&(n=e.avail_out),0!==n&&(r.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function A(e,t){s._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,q(e.strm)}function W(e,t){e.pending_buf[e.pending++]=t}function E(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function j(e,t){var n,i,r=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-Q?e.strstart-(e.w_size-Q):0,c=e.window,h=e.w_mask,u=e.prev,d=e.strstart+$,f=c[s+o-1],O=c[s+o];e.prev_length>=e.good_match&&(r>>=2),a>e.lookahead&&(a=e.lookahead);do{if(c[(n=t)+o]===O&&c[n+o-1]===f&&c[n]===c[s]&&c[++n]===c[s+1]){s+=2,n++;do{}while(c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&sl&&0!=--r);return o<=e.lookahead?o:e.lookahead}function z(e){var t,n,i,s,l,c,h,u,d,f,O=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=O+(O-Q)){for(r.arraySet(e.window,e.window,O,O,0),e.match_start-=O,e.strstart-=O,e.block_start-=O,t=n=e.hash_size;i=e.head[--t],e.head[t]=O<=i?i-O:0,--n;);for(t=n=O;i=e.prev[--t],e.prev[t]=O<=i?i-O:0,--n;);s+=O}if(0===e.strm.avail_in)break;if(c=e.strm,h=e.window,u=e.strstart+e.lookahead,f=void 0,(d=s)<(f=c.avail_in)&&(f=d),n=0===f?0:(c.avail_in-=f,r.arraySet(h,c.input,c.next_in,f,u),1===c.state.wrap?c.adler=o(c.adler,h,f,u):2===c.state.wrap&&(c.adler=a(c.adler,h,f,u)),c.next_in+=f,c.total_in+=f,f),e.lookahead+=n,e.lookahead+e.insert>=S)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<=S&&(e.ins_h=(e.ins_h<=S)if(i=s._tr_tally(e,e.strstart-e.match_start,e.match_length-S),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=S){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=S&&(e.ins_h=(e.ins_h<=S&&e.match_length<=e.prev_length){for(r=e.strstart+e.lookahead-S,i=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-S),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=r&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(z(e),0===e.lookahead&&t===c)return T;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+n;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,A(e,!1),0===e.strm.avail_out))return T;if(e.strstart-e.block_start>=e.w_size-Q&&(A(e,!1),0===e.strm.avail_out))return T}return e.insert=0,t===h?(A(e,!0),0===e.strm.avail_out?Z:C):(e.strstart>e.block_start&&(A(e,!1),e.strm.avail_out),T)})),new V(4,4,8,4,D),new V(4,5,16,8,D),new V(4,6,32,32,D),new V(4,4,16,16,U),new V(8,16,32,32,U),new V(8,16,128,128,U),new V(8,32,128,256,U),new V(32,128,258,1024,U),new V(32,258,258,4096,U)],n.deflateInit=function(e,t){return B(e,t,m,15,8,0)},n.deflateInit2=B,n.deflateReset=G,n.deflateResetKeep=M,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?d:(e.state.gzhead=t,u):d},n.deflate=function(e,t){var n,r,o,l;if(!e||!e.state||5>8&255),W(r,r.gzhead.time>>16&255),W(r,r.gzhead.time>>24&255),W(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),W(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(W(r,255&r.gzhead.extra.length),W(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=a(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(W(r,0),W(r,0),W(r,0),W(r,0),W(r,0),W(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),W(r,3),r.status=P);else{var f=m+(r.w_bits-8<<4)<<8;f|=(2<=r.strategy||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(f|=32),f+=31-f%31,r.status=P,E(r,f),0!==r.strstart&&(E(r,e.adler>>>16),E(r,65535&e.adler)),e.adler=1}if(69===r.status)if(r.gzhead.extra){for(o=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),q(e),o=r.pending,r.pending!==r.pending_buf_size));)W(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){o=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),q(e),o=r.pending,r.pending===r.pending_buf_size)){l=1;break}l=r.gzindexo&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),0===l&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){o=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),q(e),o=r.pending,r.pending===r.pending_buf_size)){l=1;break}l=r.gzindexo&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),0===l&&(r.status=103)}else r.status=103;if(103===r.status&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&q(e),r.pending+2<=r.pending_buf_size&&(W(r,255&e.adler),W(r,e.adler>>8&255),e.adler=0,r.status=P)):r.status=P),0!==r.pending){if(q(e),0===e.avail_out)return r.last_flush=-1,u}else if(0===e.avail_in&&Y(t)<=Y(n)&&t!==h)return X(e,-5);if(666===r.status&&0!==e.avail_in)return X(e,-5);if(0!==e.avail_in||0!==r.lookahead||t!==c&&666!==r.status){var O=2===r.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(z(e),0===e.lookahead)){if(t===c)return T;break}if(e.match_length=0,n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(A(e,!1),0===e.strm.avail_out))return T}return e.insert=0,t===h?(A(e,!0),0===e.strm.avail_out?Z:C):e.last_lit&&(A(e,!1),0===e.strm.avail_out)?T:_}(r,t):3===r.strategy?function(e,t){for(var n,i,r,o,a=e.window;;){if(e.lookahead<=$){if(z(e),e.lookahead<=$&&t===c)return T;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=S&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=S?(n=s._tr_tally(e,1,e.match_length-S),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(A(e,!1),0===e.strm.avail_out))return T}return e.insert=0,t===h?(A(e,!0),0===e.strm.avail_out?Z:C):e.last_lit&&(A(e,!1),0===e.strm.avail_out)?T:_}(r,t):i[r.level].func(r,t);if(O!==Z&&O!==C||(r.status=666),O===T||O===Z)return 0===e.avail_out&&(r.last_flush=-1),u;if(O===_&&(1===t?s._tr_align(r):5!==t&&(s._tr_stored_block(r,0,0,!1),3===t&&(R(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),q(e),0===e.avail_out))return r.last_flush=-1,u}return t!==h?u:r.wrap<=0?1:(2===r.wrap?(W(r,255&e.adler),W(r,e.adler>>8&255),W(r,e.adler>>16&255),W(r,e.adler>>24&255),W(r,255&e.total_in),W(r,e.total_in>>8&255),W(r,e.total_in>>16&255),W(r,e.total_in>>24&255)):(E(r,e.adler>>>16),E(r,65535&e.adler)),q(e),0=n.w_size&&(0===a&&(R(n.head),n.strstart=0,n.block_start=0,n.insert=0),f=new r.Buf8(n.w_size),r.arraySet(f,t,O-n.w_size,n.w_size,0),t=f,O=n.w_size),l=e.avail_in,c=e.next_in,h=e.input,e.avail_in=O,e.next_in=0,e.input=t,z(n);n.lookahead>=S;){for(i=n.strstart,s=n.lookahead-(S-1);n.ins_h=(n.ins_h<>>=x=w>>>24,O-=x,0==(x=w>>>16&255))k[s++]=65535&w;else{if(!(16&x)){if(0==(64&x)){w=p[(65535&w)+(f&(1<>>=x,O-=x),O<15&&(f+=Q[i++]<>>=x=w>>>24,O-=x,!(16&(x=w>>>16&255))){if(0==(64&x)){w=m[(65535&w)+(f&(1<>>=x,O-=x,(x=s-o)>3,f&=(1<<(O-=v<<3))-1,e.next_in=i,e.next_out=s,e.avail_in=i>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function m(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function g(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=d,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new i.Buf32(f),t.distcode=t.distdyn=new i.Buf32(O),t.sane=1,t.back=-1,h):u}function b(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,g(e)):u}function w(e,t){var n,i;return e&&e.state?(i=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=o.wsize?(i.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(r<(s=o.wsize-o.wnext)&&(s=r),i.arraySet(o.window,t,n-r,s,o.wnext),(r-=s)?(i.arraySet(o.window,t,n-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=s(n.check,z,2,0),v=x=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&x)<<8)+(x>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&x)){e.msg="unknown compression method",n.mode=30;break}if(v-=4,q=8+(15&(x>>>=4)),0===n.wbits)n.wbits=q;else if(q>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(z[0]=255&x,z[1]=x>>>8&255,n.check=s(n.check,z,2,0)),v=x=0,n.mode=3;case 3:for(;v<32;){if(0===b)break e;b--,x+=f[m++]<>>8&255,z[2]=x>>>16&255,z[3]=x>>>24&255,n.check=s(n.check,z,4,0)),v=x=0,n.mode=4;case 4:for(;v<16;){if(0===b)break e;b--,x+=f[m++]<>8),512&n.flags&&(z[0]=255&x,z[1]=x>>>8&255,n.check=s(n.check,z,2,0)),v=x=0,n.mode=5;case 5:if(1024&n.flags){for(;v<16;){if(0===b)break e;b--,x+=f[m++]<>>8&255,n.check=s(n.check,z,2,0)),v=x=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(b<(k=n.length)&&(k=b),k&&(n.head&&(q=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),i.arraySet(n.head.extra,f,m,k,q)),512&n.flags&&(n.check=s(n.check,f,k,m)),b-=k,m+=k,n.length-=k),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===b)break e;for(k=0;q=f[m+k++],n.head&&q&&n.length<65536&&(n.head.name+=String.fromCharCode(q)),q&&k>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;v<32;){if(0===b)break e;b--,x+=f[m++]<>>=7&v,v-=7&v,n.mode=27;break}for(;v<3;){if(0===b)break e;b--,x+=f[m++]<>>=1)){case 0:n.mode=14;break;case 1:if($(n),n.mode=20,6!==t)break;x>>>=2,v-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}x>>>=2,v-=2;break;case 14:for(x>>>=7&v,v-=7&v;v<32;){if(0===b)break e;b--,x+=f[m++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&x,v=x=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(k=n.length){if(b>>=5,v-=5,n.ndist=1+(31&x),x>>>=5,v-=5,n.ncode=4+(15&x),x>>>=4,v-=4,286>>=3,v-=3}for(;n.have<19;)n.lens[D[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,W={bits:n.lenbits},A=a(0,n.lens,0,19,n.lencode,0,n.work,W),n.lenbits=W.bits,A){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,C=65535&j,!((_=j>>>24)<=v);){if(0===b)break e;b--,x+=f[m++]<>>=_,v-=_,n.lens[n.have++]=C;else{if(16===C){for(E=_+2;v>>=_,v-=_,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}q=n.lens[n.have-1],k=3+(3&x),x>>>=2,v-=2}else if(17===C){for(E=_+3;v>>=_)),x>>>=3,v-=3}else{for(E=_+7;v>>=_)),x>>>=7,v-=7}if(n.have+k>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;k--;)n.lens[n.have++]=q}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,W={bits:n.lenbits},A=a(l,n.lens,0,n.nlen,n.lencode,0,n.work,W),n.lenbits=W.bits,A){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,W={bits:n.distbits},A=a(c,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,W),n.distbits=W.bits,A){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(6<=b&&258<=w){e.next_out=g,e.avail_out=w,e.next_in=m,e.avail_in=b,n.hold=x,n.bits=v,o(e,S),g=e.next_out,O=e.output,w=e.avail_out,m=e.next_in,f=e.input,b=e.avail_in,x=n.hold,v=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;Z=(j=n.lencode[x&(1<>>16&255,C=65535&j,!((_=j>>>24)<=v);){if(0===b)break e;b--,x+=f[m++]<>X)])>>>16&255,C=65535&j,!(X+(_=j>>>24)<=v);){if(0===b)break e;b--,x+=f[m++]<>>=X,v-=X,n.back+=X}if(x>>>=_,v-=_,n.back+=_,n.length=C,0===Z){n.mode=26;break}if(32&Z){n.back=-1,n.mode=12;break}if(64&Z){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&Z,n.mode=22;case 22:if(n.extra){for(E=n.extra;v>>=n.extra,v-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;Z=(j=n.distcode[x&(1<>>16&255,C=65535&j,!((_=j>>>24)<=v);){if(0===b)break e;b--,x+=f[m++]<>X)])>>>16&255,C=65535&j,!(X+(_=j>>>24)<=v);){if(0===b)break e;b--,x+=f[m++]<>>=X,v-=X,n.back+=X}if(x>>>=_,v-=_,n.back+=_,64&Z){e.msg="invalid distance code",n.mode=30;break}n.offset=C,n.extra=15&Z,n.mode=24;case 24:if(n.extra){for(E=n.extra;v>>=n.extra,v-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===w)break e;if(k=S-w,n.offset>k){if((k=n.offset-k)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}P=k>n.wnext?(k-=n.wnext,n.wsize-k):n.wnext-k,k>n.length&&(k=n.length),T=n.window}else T=O,P=g-n.offset,k=n.length;for(wb?(x=W[E+u[$]],Y[R+u[$]]):(x=96,0),f=1<>_)+(O-=f)]=w<<24|x<<16|v|0,0!==O;);for(f=1<>=1;if(0!==f?(X&=f-1,X+=f):X=0,$++,0==--q[S]){if(S===k)break;S=t[n+u[$]]}if(P>>7)]}function W(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function E(e,t,n){e.bi_valid>p-n?(e.bi_buf|=t<>p-e.bi_valid,e.bi_valid+=n-p):(e.bi_buf|=t<>>=1,n<<=1,0<--t;);return n>>>1}function D(e,t,n){var i,r,s=new Array(O+1),o=0;for(i=1;i<=O;i++)s[i]=o=o+n[i-1]<<1;for(r=0;r<=t;r++){var a=e[2*r+1];0!==a&&(e[2*r]=z(s[a]++,a))}}function U(e){var t;for(t=0;t>1;1<=n;n--)M(e,s,n);for(r=l;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],M(e,s,1),i=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=i,s[2*r]=s[2*n]+s[2*i],e.depth[r]=(e.depth[n]>=e.depth[i]?e.depth[n]:e.depth[i])+1,s[2*n+1]=s[2*i+1]=r,e.heap[1]=r++,M(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,i,r,s,o,a,l=t.dyn_tree,c=t.max_code,h=t.stat_desc.static_tree,u=t.stat_desc.has_stree,d=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,m=t.stat_desc.max_length,g=0;for(s=0;s<=O;s++)e.bl_count[s]=0;for(l[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n>=7;i>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return r;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return s;for(t=32;t>>3,(a=e.static_len+3+7>>>3)<=o&&(o=a)):o=a=n+5,n+4<=o&&-1!==t?H(e,t,n,i):4===e.strategy||a===o?(E(e,2+(i?1:0),3),G(e,Q,k)):(E(e,4+(i?1:0),3),function(e,t,n,i){var r;for(E(e,t-257,5),E(e,n-1,5),E(e,i-4,4),r=0;r>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(T[n]+c+1)]++,e.dyn_dtree[2*A(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){E(e,2,3),j(e,g,Q),function(e){16===e.bi_valid?(W(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,n){(function(e){!function(e,t){if(!e.setImmediate){var n,i,r,s,o=1,a={},l=!1,c=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,n="[object process]"==={}.toString.call(e.process)?function(e){process.nextTick((function(){d(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?(s="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",f,!1):e.attachEvent("onmessage",f),function(t){e.postMessage(s+t,"*")}):e.MessageChannel?((r=new MessageChannel).port1.onmessage=function(e){d(e.data)},function(e){r.port2.postMessage(e)}):c&&"onreadystatechange"in c.createElement("script")?(i=c.documentElement,function(e){var t=c.createElement("script");t.onreadystatechange=function(){d(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):function(e){setTimeout(d,0,e)},h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),i=0;i=t.status}function r(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var s="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof et&&et.global===et?et:void 0,o=s.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),a=s.saveAs||("object"!=typeof window||window!==s?function(){}:"download"in HTMLAnchorElement.prototype&&!o?function(e,t,o){var a=s.URL||s.webkitURL,l=document.createElement("a");t=t||e.name||"download",l.download=t,l.rel="noopener","string"==typeof e?(l.href=e,l.origin===location.origin?r(l):i(l.href)?n(e,t,o):r(l,l.target="_blank")):(l.href=a.createObjectURL(e),setTimeout((function(){a.revokeObjectURL(l.href)}),4e4),setTimeout((function(){r(l)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,s,o){if(s=s||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(t(e,o),s);else if(i(e))n(e,s,o);else{var a=document.createElement("a");a.href=e,a.target="_blank",setTimeout((function(){r(a)}))}}:function(e,t,i,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof e)return n(e,t,i);var a="application/octet-stream"===e.type,l=/constructor/i.test(s.HTMLElement)||s.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||a&&l||o)&&"undefined"!=typeof FileReader){var h=new FileReader;h.onloadend=function(){var e=h.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=e:location=e,r=null},h.readAsDataURL(e)}else{var u=s.URL||s.webkitURL,d=u.createObjectURL(e);r?r.location=d:location.href=d,r=null,setTimeout((function(){u.revokeObjectURL(d)}),4e4)}});s.saveAs=a.saveAs=a,e.exports=a}()}));class st{constructor(){this._nextId=0,this._subscribers=new Map}subscribe(e){const t=this._nextId++;return this._subscribers.set(t,e),()=>this._subscribers.delete(t)}notify(e){this._subscribers.forEach((t=>t(e)))}}const ot={onExplorerSectionsChange:new st,onViewedFileChange:new st,onSearchTermChange:new st,onUserClickedFile:new st,onPackageNameChange:new st,onPackageUnloaded:new st};var at,lt;!function(e){e[e.Unknown=0]="Unknown",e[e.Corrupt=1]="Corrupt",e[e.StringTable=2]="StringTable",e[e.Image=3]="Image",e[e.Deleted=4]="Deleted",e[e.PlainText=5]="PlainText"}(at||(at={})),function(e){e.toggleLightTheme=function(e,t){t&&(document.documentElement.classList.add("theme-transition"),window.setTimeout((()=>{document.documentElement.classList.remove("theme-transition")}),500)),e?document.documentElement.classList.remove("dark"):document.documentElement.classList.add("dark")},e.toggleBooleanAttribute=function(e,t){document.documentElement.setAttribute(e,t?"true":"false")}}(lt||(lt={}));var ct=lt;class ht{constructor(e,t,n=[]){this.name=e,this.defaultValue=t,this._onChangeCallbacks=n}get(e){if(void 0===this._cachedValue){const t=localStorage.getItem("s:"+e);this._cachedValue=t?this._parseValue(t):this.defaultValue}return this._cachedValue}set(e,t){this._cachedValue=t,localStorage.setItem("s:"+e,this._stringifyValue(t)),this._onChange(t)}addCallback(e){this._onChangeCallbacks.push(e)}_onChange(e){this._onChangeCallbacks.forEach((t=>t(e)))}}class ut extends ht{constructor(e,t=!1,n){super(e,t,n)}_parseValue(e){return"true"===e}_stringifyValue(e){return e?"true":"false"}}class dt extends ht{constructor(e,t,n){super(e,t??new Set,n)}_parseValue(e){return new Set(JSON.parse(e))}_stringifyValue(e){return JSON.stringify(Array.from(e))}}const ft=function(e){const t={};for(const n in e){const i=e[n];t[n]=new i.cls(n,i.defaultValue,i.callbacks)}return new Proxy(t,{get:(e,t)=>e[t].get(t),set:(e,t,n)=>(e[t].set(t,n),Ot.notifySubscribers(t,n),!0)})}({isLightTheme:{cls:ut,callbacks:[e=>ct.toggleLightTheme(e,!0)],defaultValue:!1},suppressedDiagnosticLevels:{cls:dt,defaultValue:new Set},suppressedDiagnosticCodes:{cls:dt,defaultValue:new Set},showDiagnosticCodesOnUi:{cls:ut,defaultValue:!1},expandFoldersByDefault:{cls:ut,defaultValue:!1},formatXmlSpaces:{cls:class extends ht{constructor(e,t=0,n){super(e,t,n)}_parseValue(e){const t=parseInt(e);return Number.isNaN(t)?this.defaultValue:t}_stringifyValue(e){return e.toString()}},defaultValue:2}});const Ot=new class{constructor(){this._nextId=0,this._subscriptions=new Map}subscribe(e,t){const n=this._nextId++;return this._subscriptions.set(n,{setting:e,fn:t}),()=>this._subscriptions.delete(n)}notifySubscribers(e,t){this._subscriptions.forEach((n=>{n.setting===e&&n.fn(t)}))}};var pt;!function(e){e.countExact=function(e,t){return t.filter((t=>t.level===e)).length},e.countAtLeast=function(e,t){return t.filter((t=>t.level>=e)).length},e.passesSettings=function(e){return!ft.suppressedDiagnosticLevels.has(e.level)&&!ft.suppressedDiagnosticCodes.has(e.code)},e.sorter=function(e,t){const n=t.level-e.level;return 0!==n?n:e.code>t.code?1:e.codet[e]n[e]?1:0}function vt(...e){const t=[];return e.forEach((e=>t.push(...e))),t}!function(e){e[e.Unspecified=0]="Unspecified",e[e.Tuning=1]="Tuning",e[e.StringTable=2]="StringTable"}(mt||(mt={})),function(e){e.isActive=function(e,t){return e.containedIds.has(t)},e.passesSearch=function(e,t){return t=t?.trim(),!t||e.filterName.toLowerCase().includes(t.toLowerCase())},e.allDiagnostics=function(e){let t;switch(e.displayType){case mt.StringTable:t=[],e.localeChoices.forEach((e=>{t.push(...e.diagnostics)}));break;case mt.Tuning:t=[...e.tuningInfo.diagnostics,...e.simDataInfo?.diagnostics??[]];break;case mt.Unspecified:t=e.info.diagnostics}return t.filter((e=>bt.passesSettings(e))).sort(bt.sorter)}}(gt||(gt={}));const{models:yt,enums:St,formatting:$t}=window.S4TK,{DiagnosticLevel:Qt,ValidationSchema:kt}=window.S4TK.validation;async function Pt(e,t,n){const i=new Map;for(let n=0;n{const r=e.map((e=>function(e,t){let n=t.get(e.id);if(e.isDeleted)return{displayType:mt.Unspecified,filterName:n.displayName,containedIds:new Set([n.id]),defaultId:n.id,info:n};switch(e.schema){case kt.Tuning:{const i=t.get(e.pairedSimDataId),r=new Set([n.id]);return i&&r.add(i.id),{displayType:mt.Tuning,filterName:n.displayName,defaultId:n.id,containedIds:r,tuningInfo:n,simDataInfo:i}}case kt.StringTable:return{displayType:mt.StringTable,filterName:"String Table",defaultId:n.id,containedIds:new Set([n.id,...e.otherLocaleIds]),sharedResourceKey:Xt(e,!0),localeChoices:[n.id,...e.otherLocaleIds].map((e=>t.get(e))),chosenLocaleIndex:0}}return{displayType:mt.Unspecified,filterName:n.displayName,containedIds:new Set([n.id]),defaultId:n.id,info:n}}(e,t))).sort(xt("filterName"));n.push({title:i,cells:r,collapsed:a})})),n.sort(xt("title"))}async function Tt(e){try{if(e.isDeleted)return{renderType:at.Deleted,id:e.id,displayName:"Deleted Record",resourceKey:Xt(e),diagnostics:Ct(e),extension:"binary",downloadData:e.resource.getBuffer()};switch(e.schema){case kt.Tuning:return _t("Tuning",e)??function(e){const t=e.resource;return{renderType:at.PlainText,id:e.id,displayName:e.domValid?t.root.name??"Unnamed Tuning":"Invalid Tuning",resourceKey:Xt(e),diagnostics:Ct(e),language:"xml",textContent:t.content,extension:"xml",downloadData:e.resource.getBuffer(),tdescMetadata:e.domValid?{class:t.root.attributes.c,type:t.root.attributes.i,module:t.root.attributes.m}:void 0}}(e);case kt.SimData:return _t("SimData",e)??function(e){const t=e.resource,n=t.toXmlDocument().toXml();return{renderType:at.PlainText,id:e.id,displayName:t.instance.name??"Unnamed SimData",resourceKey:Xt(e),diagnostics:Ct(e),language:"xml",textContent:n,extension:"SimData.xml",downloadData:window.NodeJS.Buffer.from(n)}}(e);case kt.StringTable:return _t("String Table",e)??function(e){const t=e.resource,n=St.StringTableLocale[e.locale]??"Unknown";return{renderType:at.StringTable,id:e.id,displayName:`${n}`,resourceKey:Xt(e),diagnostics:Ct(e),locale:e.locale,entries:t.entries,extension:"stbl",downloadData:e.resource.getBuffer()}}(e);default:return await async function(e){switch(e.key.type){case St.BinaryResourceType.DdsImage:case St.BinaryResourceType.DstImage:return await async function(e){const t=e.key.type===St.BinaryResourceType.DdsImage?"DDS Image":"DST Image";try{const n=yt.DdsImageResource.from(e.resource.getBuffer()).image.toJimp(),i="data:image/png;base64,"+(await n.getBufferAsync("image/png")).toString("base64");return{renderType:at.Image,id:e.id,displayName:t,resourceKey:Xt(e),diagnostics:Ct(e),pngBase64:i,width:n.getWidth(),height:n.getHeight(),extension:"dds",downloadData:e.resource.getBuffer()}}catch(n){return console.error(`Failed to parse DDS image [${n}]`),{renderType:at.Corrupt,id:e.id,displayName:`${t} (Unparsable)`,resourceKey:Xt(e),diagnostics:Ct(e),extension:"dds",downloadData:e.resource.getBuffer()}}}(e);case St.BinaryResourceType.ObjectDefinition:return function(e){try{const t=yt.ObjectDefinitionResource.from(e.resource.getBuffer());return{renderType:at.PlainText,id:e.id,displayName:t.properties.name??"Unnamed Object Definition",resourceKey:Xt(e),diagnostics:Ct(e),language:"json",textContent:JSON.stringify(t.properties,((e,t)=>"bigint"==typeof t||"number"==typeof t?t.toString():t),2),extension:"binary",downloadData:e.resource.getBuffer()}}catch(t){return console.error(`Failed to parse object definition [${t}]`),{renderType:at.Corrupt,id:e.id,displayName:"Object Definition (Unparsable)",resourceKey:Xt(e),diagnostics:Ct(e),extension:"binary",downloadData:e.resource.getBuffer()}}}(e);case St.BinaryResourceType.PngImage:return await async function(e){try{const t="data:image/png;base64,"+e.resource.getBuffer().toString("base64");return{renderType:at.Image,id:e.id,displayName:"PNG Image",resourceKey:Xt(e),diagnostics:Ct(e),pngBase64:t,extension:"png",downloadData:e.resource.getBuffer()}}catch(t){return console.error(`Failed to parse PNG image [${t}]`),{renderType:at.Corrupt,id:e.id,displayName:"PNG Image (Unparsable)",resourceKey:Xt(e),diagnostics:Ct(e),extension:"png",downloadData:e.resource.getBuffer()}}}(e)}if(e.modelLoaded){if(e.resource instanceof yt.XmlResource)return{renderType:at.PlainText,id:e.id,displayName:"Tuning (Suspected)",resourceKey:Xt(e),diagnostics:Ct(e),language:"xml",textContent:e.resource.content,extension:"xml",downloadData:e.resource.getBuffer()};if(e.resource instanceof yt.SimDataResource){const t=e.resource.toXmlDocument().toXml();return{renderType:at.PlainText,id:e.id,displayName:"SimData (Suspected)",resourceKey:Xt(e),diagnostics:Ct(e),language:"xml",textContent:t,extension:"SimData.xml",downloadData:window.NodeJS.Buffer.from(t)}}if(e.resource instanceof yt.StringTableResource)return{renderType:at.StringTable,id:e.id,displayName:"String Table (Suspected)",resourceKey:Xt(e,!0),diagnostics:Ct(e),locale:St.StringTableLocale.getLocale(e.key.instance),entries:e.resource.entries.map((({key:e,value:t})=>({key:e,value:t}))),extension:"stbl",downloadData:e.resource.getBuffer()}}return{renderType:at.Unknown,id:e.id,displayName:e.key.type in St.BinaryResourceType?wt(St.BinaryResourceType[e.key.type]):"Unknown",resourceKey:Xt(e),diagnostics:Ct(e),extension:"binary",downloadData:e.resource.getBuffer()}}(e)}}catch(t){return e.diagnostics.push({ownerId:e.id,code:"Unknown",level:Qt.Warning,message:"Something unexpected went wrong while loading this resource. It is possible that the issue is with the website, not the package. Please report this."}),{renderType:at.Corrupt,id:e.id,displayName:"Unexpected Error",resourceKey:Xt(e),diagnostics:Ct(e),extension:"binary",downloadData:e.resource.getBuffer()}}}function _t(e,t){if(!t.modelLoaded)return{renderType:at.Corrupt,id:t.id,displayName:`Corrupt ${e}`,resourceKey:Xt(t),diagnostics:Ct(t),extension:"binary",downloadData:t.resource.getBuffer()}}function Zt(e){switch(e.schema){case kt.SimData:if(void 0!==e.pairedTuningId)return;return`${wt(St.SimDataGroup[e.key.group]??"Unknown")} SimData`;case kt.StringTable:return e.primary?"String Table":void 0;case kt.Tuning:if(e.key.type===St.TuningResourceType.Tuning)return"Module Tuning";return`${wt(St.TuningResourceType[e.key.type]??"Unknown")} Tuning`}if(!(e.key.type in St.BinaryResourceType))return"Unknown";switch(e.key.type){case St.BinaryResourceType.DdsImage:case St.BinaryResourceType.DstImage:case St.BinaryResourceType.ObjectDefinition:case St.BinaryResourceType.PngImage:return wt(St.BinaryResourceType[e.key.type]);default:return"Unsupported"}}function Ct(e){return e.diagnostics.sort(bt.sorter)}function Xt(e,t=!1){if(t){const t=St.StringTableLocale.getInstanceBase(e.key.instance);return`${$t.formatResourceType(e.key.type)}-${$t.formatResourceGroup(e.key.group)}-XX${$t.formatAsHexString(t,14,!1)}`}return $t.formatResourceKey(e.key,"-")}const{validatePackageBuffer:Yt}=window.S4TK.validation;const Rt=new class{constructor(){this._fileInfoMap=new Map,this._viewedFileId=0}get _viewedFile(){return this._fileInfoMap.get(this._viewedFileId)}async loadPackage(e,t){this.unloadPackage();try{const n=Yt(e);return!(n.length<1)&&(await Pt(n,this._fileInfoMap,this._explorerSections),this._cachedPackageName=t,this._cachedPackageBuffer=e,this._viewedFileId=this._explorerSections[0]?.cells[0]?.defaultId??0,!0)}catch(e){return console.error(e),!1}finally{this.requestRefresh()}}unloadPackage(e){this._cachedPackageName=null,this._cachedPackageBuffer=null,this._viewedFileId=0,this._fileInfoMap.clear(),this._explorerSections=[],this._searchTerm="",e?.requestRefresh&&(this.requestRefresh(),ot.onPackageUnloaded.notify())}getFile(e){return this._fileInfoMap.get(e)}downloadFile(e){const t=this.getFile(e),n=t.resourceKey.replace(/-/g,"_"),i=t.displayName.replace(/[^a-z0-9_-]/gi,"_");t&&rt.saveAs(new Blob([t.downloadData]),`${n}.${i}.${t.extension}`)}downloadCurrentFile(){this.downloadFile(this._viewedFileId)}async downloadAllFiles(){const e=new it;this._fileInfoMap.forEach((t=>{const n=`${t.resourceKey.replace(/-/g,"_")}.${t.displayName.replace(/[^a-z0-9_-]/gi,"_")}.${t.extension}`;e.file(n,t.downloadData)}));const t=await e.generateAsync({type:"blob"});rt.saveAs(t,this._cachedPackageName.replace(".package",".zip"))}downloadCurrentPackage(){this._cachedPackageBuffer&&rt.saveAs(new Blob([this._cachedPackageBuffer]),this._cachedPackageName??"Download.package")}requestFile(e,t){this._fileInfoMap.has(e)?(this._viewedFileId=e,ot.onViewedFileChange.notify(this._viewedFile),t&&ot.onUserClickedFile.notify()):console.error(`Cannot switch to entry ${e} because it does not exist.`)}requestRefresh(){ot.onExplorerSectionsChange.notify(this._explorerSections),ot.onViewedFileChange.notify(this._viewedFile),ot.onSearchTermChange.notify(this._searchTerm),ot.onPackageNameChange.notify(this._cachedPackageName)}requestSearch(e){this._searchTerm=e??"",ot.onSearchTermChange.notify(e)}};function qt(t){let n,i,r,s,o;return{c(){n=P("div"),i=P("h3"),r=T(t[0]),s=_(),o=P("hr"),X(i,"class","mt-0 mb-2 font-bold text-xl"),X(o,"class","bg-accent-primary-light dark:bg-accent-primary-dark m-0 border-none svelte-1hlby7e"),X(n,"class","text-left inline-block")},m(e,t){$(e,n,t),v(n,i),v(i,r),v(n,s),v(n,o)},p(e,[t]){1&t&&R(r,e[0])},i:e,o:e,d(e){e&&Q(n)}}}function At(e,t,n){let{title:i}=t;return e.$$set=e=>{"title"in e&&n(0,i=e.title)},[i]}class Wt extends Ye{constructor(e){super(),Xe(this,e,At,qt,a,{title:0})}}function Et(t){let n,i,r,s,o,a,l,c,h,u;return{c(){n=P("div"),i=P("p"),r=T(t[1]),s=_(),o=P("label"),a=P("input"),l=_(),c=P("span"),X(i,"class","text-sm mr-4"),X(a,"type","checkbox"),X(a,"class","opacity-0 w-0 h-0 svelte-107vzwt"),X(c,"class","slider absolute top-0 right-0 bottom-0 left-0 cursor-pointer svelte-107vzwt"),X(o,"class","switch relative inline-block svelte-107vzwt"),X(n,"class","w-full flex items-center justify-between")},m(e,d){$(e,n,d),v(n,i),v(i,r),v(n,s),v(n,o),v(o,a),a.checked=t[0],v(o,l),v(o,c),h||(u=C(a,"change",t[2]),h=!0)},p(e,[t]){2&t&&R(r,e[1]),1&t&&(a.checked=e[0])},i:e,o:e,d(e){e&&Q(n),h=!1,u()}}}function jt(e,t,n){let{label:i}=t,{checked:r}=t;return e.$$set=e=>{"label"in e&&n(1,i=e.label),"checked"in e&&n(0,r=e.checked)},[r,i,function(){r=this.checked,n(0,r)}]}class zt extends Ye{constructor(e){super(),Xe(this,e,jt,Et,a,{label:1,checked:0})}}function Dt(e,t,n){const i=e.slice();return i[5]=t[n],i}function Ut(t){let n,i,r,s,o,a,l,c,h,u=t[5]+"",d=t[1].getBrief(t[5])+"";return{c(){n=P("li"),i=P("input"),r=_(),s=P("label"),o=P("span"),a=T(u),l=T(": "),c=T(d),h=_(),X(i,"id","setting-code-"+t[5]),X(i,"name",t[5]),X(i,"type","checkbox"),i.checked=t[3](t[5]),X(o,"class","monospace text-subtle"),X(s,"for","setting-code-"+t[5]),X(s,"class","text-sm")},m(e,t){$(e,n,t),v(n,i),v(n,r),v(n,s),v(s,o),v(o,a),v(s,l),v(s,c),v(n,h)},p:e,d(e){e&&Q(n)}}}function Vt(t){let n,i,r,s,o,a=t[2],l=[];for(let e=0;e{"title"in e&&n(0,r=e.title),"codePrefix"in e&&n(4,s=e.codePrefix)},[r,i,o,function(e){return!ft.suppressedDiagnosticCodes.has(e)},s]}class Mt extends Ye{constructor(e){super(),Xe(this,e,It,Vt,a,{title:0,codePrefix:4})}}function Gt(t){let n,i;return{c(){n=P("img"),c(n.src,i="./assets/diagnostics/"+t[2]+".svg")||X(n,"src",i),X(n,"alt",t[1]),X(n,"class","h-4 w-4"),E(n,"inline",t[0])},m(e,t){$(e,n,t)},p(e,[t]){4&t&&!c(n.src,i="./assets/diagnostics/"+e[2]+".svg")&&X(n,"src",i),2&t&&X(n,"alt",e[1]),1&t&&E(n,"inline",e[0])},i:e,o:e,d(e){e&&Q(n)}}}function Bt(e,t,n){let i,r;const{DiagnosticLevel:s}=window.S4TK.validation;let{level:o}=t,{inline:a=!1}=t,l=ft.isLightTheme?"light":"dark";const c=[Ot.subscribe("isLightTheme",(e=>{n(4,l=e?"light":"dark")}))];return L((()=>{c.forEach((e=>e()))})),e.$$set=e=>{"level"in e&&n(3,o=e.level),"inline"in e&&n(0,a=e.inline)},e.$$.update=()=>{8&e.$$.dirty&&n(1,i=s[o].toLowerCase()),26&e.$$.dirty&&n(2,r=o===s.Warning?`warning-${l}`:i)},[a,i,r,o,l]}class Nt extends Ye{constructor(e){super(),Xe(this,e,Bt,Gt,a,{level:3,inline:0})}}function Lt(e){let t,n,i,r,s,o,a,l,c,h,u,d;return s=new Nt({props:{level:e[0],inline:!0}}),{c(){t=P("div"),n=P("input"),i=_(),r=P("label"),_e(s.$$.fragment),o=_(),a=P("p"),l=T(e[2]),X(n,"id",e[4]),X(n,"name",e[2]),X(n,"type","checkbox"),X(a,"class",c="monospace text-sm diagnostics-text inline "+e[1]),X(r,"for",e[4]),X(r,"class","whitespace-nowrap select-none"),X(t,"class","whitespace-nowrap")},m(c,f){$(c,t,f),v(t,n),n.checked=e[3],v(t,i),v(t,r),Ze(s,r,null),v(r,o),v(r,a),v(a,l),h=!0,u||(d=C(n,"change",e[5]),u=!0)},p(e,[t]){(!h||16&t)&&X(n,"id",e[4]),(!h||4&t)&&X(n,"name",e[2]),8&t&&(n.checked=e[3]);const i={};1&t&&(i.level=e[0]),s.$set(i),(!h||4&t)&&R(l,e[2]),(!h||2&t&&c!==(c="monospace text-sm diagnostics-text inline "+e[1]))&&X(a,"class",c),(!h||16&t)&&X(r,"for",e[4])},i(e){h||(be(s.$$.fragment,e),h=!0)},o(e){we(s.$$.fragment,e),h=!1},d(e){e&&Q(t),Ce(s),u=!1,d()}}}function Ft(e,t,n){let i,r,s;const{DiagnosticLevel:o}=window.S4TK.validation;let{level:a}=t,l=!ft.suppressedDiagnosticLevels.has(a);return e.$$set=e=>{"level"in e&&n(0,a=e.level)},e.$$.update=()=>{1&e.$$.dirty&&n(2,i=o[a]),4&e.$$.dirty&&n(1,r=i.toLowerCase()),2&e.$$.dirty&&n(4,s=`setting-level-${r}`)},[a,r,i,l,s,function(){l=this.checked,n(3,l)}]}class Ht extends Ye{constructor(e){super(),Xe(this,e,Ft,Lt,a,{level:0})}}function Kt(e){let t,n,i,r,s,o,a,l,c,h,u,d,f,O,p,m,g,b,w,x,y,S,k,T,Z,R,A,W,E,j,z,D,U,V,I,M,G;function B(t){e[5](t)}let N={label:"Show diagnostic codes in bottom panel"};function L(t){e[6](t)}void 0!==e[1]&&(N.checked=e[1]),i=new zt({props:N}),K.push((()=>Te(i,"checked",B)));let F={label:"Expand file explorer folders by default"};return void 0!==e[2]&&(F.checked=e[2]),o=new zt({props:F}),K.push((()=>Te(o,"checked",L))),b=new Ht({props:{level:e[3].Error}}),x=new Ht({props:{level:e[3].Warning}}),S=new Ht({props:{level:e[3].Info}}),W=new Mt({props:{title:"General",codePrefix:"GEN"}}),j=new Mt({props:{title:"Tuning",codePrefix:"TUN"}}),D=new Mt({props:{title:"SimData",codePrefix:"DAT"}}),V=new Mt({props:{title:"String Table",codePrefix:"STB"}}),{c(){t=P("div"),n=P("div"),_e(i.$$.fragment),s=_(),_e(o.$$.fragment),l=_(),c=P("div"),h=P("label"),h.textContent="Spaces in formatted XML",u=_(),d=P("input"),f=_(),O=P("div"),p=P("h2"),p.textContent="Enabled Diagnostic Levels",m=_(),g=P("div"),_e(b.$$.fragment),w=_(),_e(x.$$.fragment),y=_(),_e(S.$$.fragment),k=_(),T=P("div"),Z=P("h2"),Z.textContent="Enabled Diagnostics",R=_(),A=P("div"),_e(W.$$.fragment),E=_(),_e(j.$$.fragment),z=_(),_e(D.$$.fragment),U=_(),_e(V.$$.fragment),X(h,"class","text-sm"),X(h,"for","setting-xml-spaces"),X(d,"id","setting-xml-spaces"),X(d,"class","px-2 w-16 bg-transparent rounded border border-solid border-gray-600 dark:border-white"),X(d,"type","number"),X(d,"min","1"),X(d,"max","8"),X(c,"class","w-full flex justify-between"),X(n,"class","w-full flex flex-col gap-2"),X(p,"class","mb-2 font-bold"),X(g,"class","flex flex-wrap gap-4"),X(O,"class","text-left w-full"),X(Z,"class","mb-2 font-bold"),X(A,"class","w-full flex flex-col gap-4 bg-gray-50 dark:bg-gray-900 p-2 rounded"),X(T,"class","text-left w-full"),X(t,"class","w-full h-full overflow-y-auto flex flex-col gap-6")},m(r,a){$(r,t,a),v(t,n),Ze(i,n,null),v(n,s),Ze(o,n,null),v(n,l),v(n,c),v(c,h),v(c,u),v(c,d),q(d,e[0]),v(t,f),v(t,O),v(O,p),v(O,m),v(O,g),Ze(b,g,null),v(g,w),Ze(x,g,null),v(g,y),Ze(S,g,null),v(t,k),v(t,T),v(T,Z),v(T,R),v(T,A),Ze(W,A,null),v(A,E),Ze(j,A,null),v(A,z),Ze(D,A,null),v(A,U),Ze(V,A,null),I=!0,M||(G=C(d,"input",e[7]),M=!0)},p(e,[t]){const n={};!r&&2&t&&(r=!0,n.checked=e[1],oe((()=>r=!1))),i.$set(n);const s={};!a&&4&t&&(a=!0,s.checked=e[2],oe((()=>a=!1))),o.$set(s),1&t&&Y(d.value)!==e[0]&&q(d,e[0])},i(e){I||(be(i.$$.fragment,e),be(o.$$.fragment,e),be(b.$$.fragment,e),be(x.$$.fragment,e),be(S.$$.fragment,e),be(W.$$.fragment,e),be(j.$$.fragment,e),be(D.$$.fragment,e),be(V.$$.fragment,e),I=!0)},o(e){we(i.$$.fragment,e),we(o.$$.fragment,e),we(b.$$.fragment,e),we(x.$$.fragment,e),we(S.$$.fragment,e),we(W.$$.fragment,e),we(j.$$.fragment,e),we(D.$$.fragment,e),we(V.$$.fragment,e),I=!1},d(e){e&&Q(t),Ce(i),Ce(o),Ce(b),Ce(x),Ce(S),Ce(W),Ce(j),Ce(D),Ce(V),M=!1,G()}}}function Jt(e,t,n){const{DiagnosticCode:i,DiagnosticLevel:r}=window.S4TK.validation;let s=ft.formatXmlSpaces,o=ft.showDiagnosticCodesOnUi,a=ft.expandFoldersByDefault;return[s,o,a,r,()=>{ft.formatXmlSpaces=Math.min(8,Math.max(1,s)),ft.showDiagnosticCodesOnUi=o,ft.expandFoldersByDefault=a,function(){try{const e=new Set;["Error","Warning","Info"].forEach((t=>{document.getElementsByName(t)[0].checked||e.add(r[t])})),ft.suppressedDiagnosticLevels=e}catch(e){console.error(e)}}(),function(){try{const e=new Set;i.getAll().forEach((t=>{const n=document.getElementsByName(t);if(!n?.length)return;n[0].checked||e.add(t)})),ft.suppressedDiagnosticCodes=e}catch(e){console.error(e)}}()},function(e){o=e,n(1,o)},function(e){a=e,n(2,a)},function(){s=Y(this.value),n(0,s)}]}class en extends Ye{constructor(e){super(),Xe(this,e,Jt,Kt,a,{save:4})}get save(){return this.$$.ctx[4]}}function tn(t){let n,i,r,s,o,a,l,h,u,d,f=t[0]?"Light":"Dark";return{c(){n=P("button"),i=P("img"),o=_(),a=P("p"),l=T(f),h=T(" Mode"),c(i.src,r="./assets/icons/"+(t[0]?"sunny":"moon")+"-outline.svg")||X(i,"src",r),X(i,"alt",s=t[0]?"sun":"moon"),X(i,"class","svg h-4 w-4 inline"),X(a,"class","ml-2 text-sm inline"),X(n,"title","Toggle Theme"),X(n,"class","tint-on-hover")},m(e,r){$(e,n,r),v(n,i),v(n,o),v(n,a),v(a,l),v(a,h),u||(d=C(n,"click",t[1]),u=!0)},p(e,[t]){1&t&&!c(i.src,r="./assets/icons/"+(e[0]?"sunny":"moon")+"-outline.svg")&&X(i,"src",r),1&t&&s!==(s=e[0]?"sun":"moon")&&X(i,"alt",s),1&t&&f!==(f=e[0]?"Light":"Dark")&&R(l,f)},i:e,o:e,d(e){e&&Q(n),u=!1,d()}}}function nn(e,t,n){let i=ft.isLightTheme;return[i,function(){ft.isLightTheme=!ft.isLightTheme,n(0,i=ft.isLightTheme)}]}class rn extends Ye{constructor(e){super(),Xe(this,e,nn,tn,a,{})}}function sn(e){let t,n,i,r,a,l,c,h,u,d,f,O,p,m,g,b,w;function x(t){e[3](t)}i=new Wt({props:{title:"Settings"}});let y={};return void 0!==e[1]&&(y.save=e[1]),a=new en({props:y}),K.push((()=>Te(a,"save",x))),d=new rn({}),{c(){t=P("div"),n=P("div"),_e(i.$$.fragment),r=_(),_e(a.$$.fragment),c=_(),h=P("div"),u=P("div"),_e(d.$$.fragment),f=_(),O=P("button"),O.textContent="Cancel",p=_(),m=P("button"),m.textContent="Save",X(u,"class","mr-auto my-auto"),X(O,"class","px-3 py-1 rounded border border-solid border-gray-800 text-gray-800 hover:bg-gray-800 hover:text-white dark:border-white dark:text-white dark:hover:bg-white dark:hover:text-black"),X(m,"class","px-3 py-1 rounded bg-green-600 text-gray-100 hover:bg-green-700 dark:bg-green-400 dark:text-gray-800 hover:dark:bg-green-300"),X(h,"class","w-full flex justify-end gap-4"),X(t,"class","w-full max-w-lg h-2/3 mx-2 my-8 p-4 overflow-hidden bg-gray-100 dark:bg-gray-800 rounded-xl drop-shadow-md flex flex-col gap-4")},m(s,l){$(s,t,l),v(t,n),Ze(i,n,null),v(t,r),Ze(a,t,null),v(t,c),v(t,h),v(h,u),Ze(d,u,null),v(h,f),v(h,O),v(h,p),v(h,m),g=!0,b||(w=[C(O,"click",(function(){o(e[0])&&e[0].apply(this,arguments)})),C(m,"click",e[2])],b=!0)},p(t,[n]){e=t;const i={};!l&&2&n&&(l=!0,i.save=e[1],oe((()=>l=!1))),a.$set(i)},i(e){g||(be(i.$$.fragment,e),be(a.$$.fragment,e),be(d.$$.fragment,e),g=!0)},o(e){we(i.$$.fragment,e),we(a.$$.fragment,e),we(d.$$.fragment,e),g=!1},d(e){e&&Q(t),Ce(i),Ce(a),Ce(d),b=!1,s(w)}}}function on(e,t,n){let i,{onClose:r}=t;return e.$$set=e=>{"onClose"in e&&n(0,r=e.onClose)},[r,i,function(){i(),Rt.requestRefresh(),r()},function(e){i=e,n(1,i)}]}class an extends Ye{constructor(e){super(),Xe(this,e,on,sn,a,{onClose:0})}}function ln(e){let t,n;return t=new Je({props:{$$slots:{default:[cn]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};65&n&&(i.$$scope={dirty:n,ctx:e}),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function cn(e){let t,n;return t=new an({props:{onClose:e[4]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.onClose=e[4]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function hn(t){let n,i,r,a,l,h,u,d,f,O,p,m,g,b,w,x,y=t[0]&&ln(t);return{c(){n=P("nav"),i=P("a"),r=P("img"),l=_(),h=P("h2"),u=T("S4TK Package "),d=T(t[1]),f=_(),O=P("div"),p=P("button"),p.innerHTML='settings',m=_(),y&&y.c(),g=Z(),c(r.src,a="./assets/s4tk-transparent.png")||X(r,"src","./assets/s4tk-transparent.png"),X(r,"alt","S4TK"),X(r,"class","h-5"),X(h,"class","font-bold"),X(i,"class","flex gap-2 items-center no-underline tint-on-hover whitespace-nowrap"),X(i,"href","/"),X(p,"title","Settings"),X(O,"class","flex gap-3 items-center"),X(n,"class","fixed top-0 left-0 right-0 h-10 z-10 px-4 flex justify-between gap-4 bg-gray-200 dark:bg-gray-950 bottom-shadow svelte-1vd52s4")},m(s,a){var c;$(s,n,a),v(n,i),v(i,r),v(i,l),v(i,h),v(h,u),v(h,d),v(n,f),v(n,O),v(O,p),$(s,m,a),y&&y.m(s,a),$(s,g,a),b=!0,w||(x=[(c=Me.call(null,i),c&&o(c.destroy)?c.destroy:e),C(p,"click",t[3])],w=!0)},p(e,[t]){(!b||2&t)&&R(d,e[1]),e[0]?y?(y.p(e,t),1&t&&be(y,1)):(y=ln(e),y.c(),be(y,1),y.m(g.parentNode,g)):y&&(me(),we(y,1,1,(()=>{y=null})),ge())},i(e){b||(be(y),b=!0)},o(e){we(y),b=!1},d(e){e&&Q(n),e&&Q(m),y&&y.d(e),e&&Q(g),w=!1,s(x)}}}function un(e,t,n){let i,r,s=!1;const o=[Ve.subscribe((e=>{n(2,r=e)}))];L((()=>{o.forEach((e=>e()))}));return e.$$.update=()=>{4&e.$$.dirty&&n(1,i="/generate"===r?"Generator":"/view"===r?"Viewer":"Tools")},[s,i,r,()=>n(0,s=!0),()=>n(0,s=!1)]}class dn extends Ye{constructor(e){super(),Xe(this,e,un,hn,a,{})}}function fn(t){let n;return{c(){n=P("footer"),n.innerHTML='

Created with by Frankk using Sims\n 4 Toolkit

\n

Frankk's Mods\n |\n Sims 4 Toolkit\n |\n Twitter\n |\n Patreon\n |\n Ko-fi\n |\n Discord

\n

The Sims™ and its plumbob icon are registered trademarks of Electronic\n Arts, Inc. (EA). Sims 4 Toolkit is not affiliated with or endorsed by\n EA.

\n

All icons on this website are supplied by\n Ionicons\n and\n GitHub Octicons.

\n

2023 © Frankk

',X(n,"class","relative w-full py-12 px-4 flex justify-center bg-gray-200 dark:bg-gray-900")},m(e,t){$(e,n,t)},p:e,i:e,o:e,d(e){e&&Q(n)}}}class On extends Ye{constructor(e){super(),Xe(this,e,null,fn,a,{})}}function pn(t){let n,i,r,s,o,a,l,h,u,d,f;return{c(){n=P("a"),i=P("div"),r=P("img"),o=_(),a=P("div"),l=P("h2"),h=T(t[0]),u=_(),d=P("p"),f=T(t[1]),c(r.src,s="./assets/screenshots/"+t[3])||X(r,"src",s),X(r,"alt","Package Viewer"),X(r,"class","w-full h-full rounded-lg shadow-lg"),X(l,"class","text-white font-bold text-2xl whitespace-nowrap"),X(d,"class","text-white whitespace-nowrap mt-2"),X(a,"class","centered-in-relative svelte-1a3x1h9"),X(i,"class","up-on-hover relative top-0 text-white text-center w-full sm:w-80 svelte-1a3x1h9"),X(n,"href",t[2]),X(n,"class","max-w-fit")},m(e,t){$(e,n,t),v(n,i),v(i,r),v(i,o),v(i,a),v(a,l),v(l,h),v(a,u),v(a,d),v(d,f)},p(e,[t]){8&t&&!c(r.src,s="./assets/screenshots/"+e[3])&&X(r,"src",s),1&t&&R(h,e[0]),2&t&&R(f,e[1]),4&t&&X(n,"href",e[2])},i:e,o:e,d(e){e&&Q(n)}}}function mn(e,t,n){let{title:i}=t,{subtitle:r}=t,{href:s}=t,{image:o}=t;return e.$$set=e=>{"title"in e&&n(0,i=e.title),"subtitle"in e&&n(1,r=e.subtitle),"href"in e&&n(2,s=e.href),"image"in e&&n(3,o=e.image)},[i,r,s,o]}class gn extends Ye{constructor(e){super(),Xe(this,e,mn,pn,a,{title:0,subtitle:1,href:2,image:3})}}function bn(t){let n,i,r,s,o,a,l,c,h,u,d,f,O;return o=new Wt({props:{title:"Available Tools"}}),c=new gn({props:{title:"Package Viewer",subtitle:"Version 2.0",href:"#/view",image:"viewer.png"}}),u=new gn({props:{title:"Tuning Generator",subtitle:"Legacy Tool",href:"#/generate",image:"generator.png"}}),f=new On({}),{c(){n=_(),i=P("section"),r=P("div"),s=P("div"),_e(o.$$.fragment),a=_(),l=P("div"),_e(c.$$.fragment),h=_(),_e(u.$$.fragment),d=_(),_e(f.$$.fragment),document.title="S4TK Package Tools",X(l,"class","flex flex-col md:flex-row gap-8 items-center"),X(r,"class","py-10 w-full xl:max-w-screen-xl px-4 flex flex-col justify-center gap-8"),X(i,"class","pt-10 flex-1 w-full flex justify-center")},m(e,t){$(e,n,t),$(e,i,t),v(i,r),v(r,s),Ze(o,s,null),v(r,a),v(r,l),Ze(c,l,null),v(l,h),Ze(u,l,null),$(e,d,t),Ze(f,e,t),O=!0},p:e,i(e){O||(be(o.$$.fragment,e),be(c.$$.fragment,e),be(u.$$.fragment,e),be(f.$$.fragment,e),O=!0)},o(e){we(o.$$.fragment,e),we(c.$$.fragment,e),we(u.$$.fragment,e),we(f.$$.fragment,e),O=!1},d(e){e&&Q(n),e&&Q(i),Ce(o),Ce(c),Ce(u),e&&Q(d),Ce(f,e)}}}class wn extends Ye{constructor(e){super(),Xe(this,e,null,bn,a,{})}}function xn(t){let n,i,r,s,o,a,l,c,h,u,d,f;return o=new Wt({props:{title:"Unlock this page for $4.04"}}),d=new On({}),{c(){n=_(),i=P("section"),r=P("div"),s=P("div"),_e(o.$$.fragment),a=_(),l=P("p"),l.innerHTML='Just kidding. This page doesn't exist. Please go home.',c=_(),h=P("p"),h.textContent="Error 404",u=_(),_e(d.$$.fragment),document.title="Page Not Found",X(s,"class","mb-4"),X(l,"class","mb-8"),X(h,"class","text-subtle text-xs"),X(r,"class","w-full xl:max-w-screen-xl px-4 flex flex-col justify-center"),X(i,"class","pt-10 flex-1 w-full flex justify-center")},m(e,t){$(e,n,t),$(e,i,t),v(i,r),v(r,s),Ze(o,s,null),v(r,a),v(r,l),v(r,c),v(r,h),$(e,u,t),Ze(d,e,t),f=!0},p:e,i(e){f||(be(o.$$.fragment,e),be(d.$$.fragment,e),f=!0)},o(e){we(o.$$.fragment,e),we(d.$$.fragment,e),f=!1},d(e){e&&Q(n),e&&Q(i),Ce(o),e&&Q(u),Ce(d,e)}}}class vn extends Ye{constructor(e){super(),Xe(this,e,null,xn,a,{})}}function yn(t){let n;return{c(){n=P("div"),n.innerHTML='
\n
\n
\n
',X(n,"class","loading-indicator svelte-9y60i5")},m(e,t){$(e,n,t)},p:e,i:e,o:e,d(e){e&&Q(n)}}}class Sn extends Ye{constructor(e){super(),Xe(this,e,null,yn,a,{})}}const $n=e=>({}),Qn=e=>({}),kn=e=>({}),Pn=e=>({});function Tn(e){let t,n,i,r,s,o,a,l,u,p,m,g,b,w,x,y,S;const k=e[5].primary,Z=h(k,e,e[4],Pn),Y=e[5].secondary,q=h(Y,e,e[4],Qn);return{c(){t=P("div"),n=P("button"),i=P("p"),r=T(e[3]),s=_(),o=T(e[0]),a=_(),l=P("img"),p=_(),m=P("div"),Z&&Z.c(),g=_(),b=P("div"),q&&q.c(),X(i,"class","text-sm uppercase font-bold text-subtle"),c(l.src,u="./assets/icons/"+e[2]+".svg")||X(l,"src",u),X(l,"alt",e[2]),X(l,"class","svg h-4 w-4 absolute right-3 top-3"),X(n,"class","absolute h-10 top-0 right-0 left-0 w-full bg-gray-100 dark:bg-gray-900 border-b border-solid border-b-gray-300 dark:border-b-gray-700"),X(m,"class","absolute top-10 bottom-0 right-0 left-0"),X(b,"class","absolute top-10 bottom-0 right-0 left-0"),b.hidden=w=!e[1],X(t,"class","w-full h-full relative")},m(c,h){$(c,t,h),v(t,n),v(n,i),v(i,r),v(i,s),v(i,o),v(n,a),v(n,l),v(t,p),v(t,m),Z&&Z.m(m,null),v(t,g),v(t,b),q&&q.m(b,null),x=!0,y||(S=C(n,"click",e[6]),y=!0)},p(e,[t]){(!x||8&t)&&R(r,e[3]),(!x||1&t)&&R(o,e[0]),(!x||4&t&&!c(l.src,u="./assets/icons/"+e[2]+".svg"))&&X(l,"src",u),(!x||4&t)&&X(l,"alt",e[2]),Z&&Z.p&&(!x||16&t)&&f(Z,k,e,e[4],x?d(k,e[4],t,kn):O(e[4]),Pn),q&&q.p&&(!x||16&t)&&f(q,Y,e,e[4],x?d(Y,e[4],t,$n):O(e[4]),Qn),(!x||2&t&&w!==(w=!e[1]))&&(b.hidden=w)},i(e){x||(be(Z,e),be(q,e),x=!0)},o(e){we(Z,e),we(q,e),x=!1},d(e){e&&Q(t),Z&&Z.d(e),q&&q.d(e),y=!1,S()}}}function _n(e,t,n){let i,r,{$$slots:s={},$$scope:o}=t,{compactTitle:a}=t,l=!1;const c=[ot.onUserClickedFile.subscribe((()=>{n(1,l=!1)}))];L((()=>{c.forEach((e=>e()))}));return e.$$set=e=>{"compactTitle"in e&&n(0,a=e.compactTitle),"$$scope"in e&&n(4,o=e.$$scope)},e.$$.update=()=>{2&e.$$.dirty&&n(3,i=l?"close":"open"),2&e.$$.dirty&&n(2,r=l?"x":"list")},[a,l,r,i,o,s,()=>n(1,l=!l)]}class Zn extends Ye{constructor(e){super(),Xe(this,e,_n,Tn,a,{compactTitle:0})}}const Cn=e=>({}),Xn=e=>({}),Yn=e=>({}),Rn=e=>({});function qn(e){let t,n,i,r,o,a,l,c,u;const p=e[8].left,m=h(p,e,e[7],Rn),g=e[8].right,b=h(g,e,e[7],Xn);return{c(){t=P("div"),n=P("div"),m&&m.c(),i=_(),r=P("div"),o=_(),a=P("div"),b&&b.c(),X(n,"class","absolute top-0 bottom-0"),A(n,"width","384px"),X(r,"class","absolute top-0 bottom-0 w-1 split-view-resizer bg-gray-100 dark:bg-gray-900 svelte-1jq8vs3"),A(r,"left","384px"),E(r,"is-resizing",e[3]),X(a,"class","absolute top-0 bottom-0 right-0 overflow-hidden"),A(a,"left","388px"),X(t,"class","w-full h-full relative split-view svelte-1jq8vs3"),E(t,"is-resizing",e[3])},m(s,h){$(s,t,h),v(t,n),m&&m.m(n,null),e[9](n),v(t,i),v(t,r),e[10](r),v(t,o),v(t,a),b&&b.m(a,null),e[11](a),l=!0,c||(u=[C(r,"mousedown",e[4]),C(t,"mousemove",e[5]),C(t,"mouseup",e[6])],c=!0)},p(e,[n]){m&&m.p&&(!l||128&n)&&f(m,p,e,e[7],l?d(p,e[7],n,Yn):O(e[7]),Rn),(!l||8&n)&&E(r,"is-resizing",e[3]),b&&b.p&&(!l||128&n)&&f(b,g,e,e[7],l?d(g,e[7],n,Cn):O(e[7]),Xn),(!l||8&n)&&E(t,"is-resizing",e[3])},i(e){l||(be(m,e),be(b,e),l=!0)},o(e){we(m,e),we(b,e),l=!1},d(n){n&&Q(t),m&&m.d(n),e[9](null),e[10](null),b&&b.d(n),e[11](null),c=!1,s(u)}}}function An(e,t,n){let i,r,s,{$$slots:o={},$$scope:a}=t,l=!1;function c(e){const t=.8*window.innerWidth;e=Math.max(196,Math.min(t,e)),n(0,i.style.width=`${e}px`,i),n(2,s.style.left=`${e}px`,s),n(1,r.style.left=`${e+4}px`,r)}function h(){c(i.offsetWidth)}return N((()=>{c(i.offsetWidth),window.addEventListener("resize",h)})),L((()=>{window.removeEventListener("resize",h)})),e.$$set=e=>{"$$scope"in e&&n(7,a=e.$$scope)},[i,r,s,l,function(e){n(3,l=!0)},function(e){l&&c(e.clientX)},function(e){n(3,l=!1)},a,o,function(e){K[e?"unshift":"push"]((()=>{i=e,n(0,i)}))},function(e){K[e?"unshift":"push"]((()=>{s=e,n(2,s)}))},function(e){K[e?"unshift":"push"]((()=>{r=e,n(1,r)}))}]}class Wn extends Ye{constructor(e){super(),Xe(this,e,An,qn,a,{})}}const En=e=>({}),jn=e=>({slot:"left"}),zn=e=>({}),Dn=e=>({slot:"right"}),Un=e=>({}),Vn=e=>({slot:"secondary"}),In=e=>({}),Mn=e=>({slot:"primary"});function Gn(e){let t,n;return t=new Wn({props:{$$slots:{right:[Ln],left:[Nn]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};32&n&&(i.$$scope={dirty:n,ctx:e}),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function Bn(e){let t,n;return t=new Zn({props:{compactTitle:e[1],$$slots:{primary:[Hn],secondary:[Fn]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};2&n&&(i.compactTitle=e[1]),32&n&&(i.$$scope={dirty:n,ctx:e}),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function Nn(e){let t;const n=e[4].secondary,i=h(n,e,e[5],jn);return{c(){i&&i.c()},m(e,n){i&&i.m(e,n),t=!0},p(e,r){i&&i.p&&(!t||32&r)&&f(i,n,e,e[5],t?d(n,e[5],r,En):O(e[5]),jn)},i(e){t||(be(i,e),t=!0)},o(e){we(i,e),t=!1},d(e){i&&i.d(e)}}}function Ln(e){let t;const n=e[4].primary,i=h(n,e,e[5],Dn);return{c(){i&&i.c()},m(e,n){i&&i.m(e,n),t=!0},p(e,r){i&&i.p&&(!t||32&r)&&f(i,n,e,e[5],t?d(n,e[5],r,zn):O(e[5]),Dn)},i(e){t||(be(i,e),t=!0)},o(e){we(i,e),t=!1},d(e){i&&i.d(e)}}}function Fn(e){let t;const n=e[4].secondary,i=h(n,e,e[5],Vn);return{c(){i&&i.c()},m(e,n){i&&i.m(e,n),t=!0},p(e,r){i&&i.p&&(!t||32&r)&&f(i,n,e,e[5],t?d(n,e[5],r,Un):O(e[5]),Vn)},i(e){t||(be(i,e),t=!0)},o(e){we(i,e),t=!1},d(e){i&&i.d(e)}}}function Hn(e){let t;const n=e[4].primary,i=h(n,e,e[5],Mn);return{c(){i&&i.c()},m(e,n){i&&i.m(e,n),t=!0},p(e,r){i&&i.p&&(!t||32&r)&&f(i,n,e,e[5],t?d(n,e[5],r,In):O(e[5]),Mn)},i(e){t||(be(i,e),t=!0)},o(e){we(i,e),t=!1},d(e){i&&i.d(e)}}}function Kn(e){let t,n,i;return n=new Sn({}),{c(){t=P("div"),_e(n.$$.fragment),X(t,"class","absolute top-0 bottom-0 left-0 right-0 flex items-center justify-center")},m(e,r){$(e,t,r),Ze(n,t,null),i=!0},i(e){i||(be(n.$$.fragment,e),i=!0)},o(e){we(n.$$.fragment,e),i=!1},d(e){e&&Q(t),Ce(n)}}}function Jn(e){let t,n,i,r,s,o;const a=[Bn,Gn],l=[];function c(e,t){return e[2]?0:1}i=c(e),r=l[i]=a[i](e);let h=e[0]&&Kn();return{c(){t=P("div"),n=P("div"),r.c(),s=_(),h&&h.c(),X(n,"class","absolute top-0 bottom-0 left-0 right-0"),n.hidden=e[0],X(t,"class","w-full h-full relative")},m(e,r){$(e,t,r),v(t,n),l[i].m(n,null),v(t,s),h&&h.m(t,null),o=!0},p(e,[s]){let u=i;i=c(e),i===u?l[i].p(e,s):(me(),we(l[u],1,1,(()=>{l[u]=null})),ge(),r=l[i],r?r.p(e,s):(r=l[i]=a[i](e),r.c()),be(r,1),r.m(n,null)),(!o||1&s)&&(n.hidden=e[0]),e[0]?h?1&s&&be(h,1):(h=Kn(),h.c(),be(h,1),h.m(t,null)):h&&(me(),we(h,1,1,(()=>{h=null})),ge())},i(e){o||(be(r),be(h),o=!0)},o(e){we(r),we(h),o=!1},d(e){e&&Q(t),l[i].d(),h&&h.d()}}}function ei(e,t,n){let{$$slots:i={},$$scope:r}=t,{compactTitle:s}=t,{onCompactChange:o=null}=t,{isSwitchingCompact:a=!1}=t,l=!1,c=!1;function h(){const e=window.innerWidth<=640;c&&l!==e&&o&&(n(0,a=!0),setTimeout((()=>{o(),n(0,a=!1)}),250)),n(2,l=e),c=!0}return N((()=>{h(),window.addEventListener("resize",h)})),L((()=>{window.removeEventListener("resize",h)})),e.$$set=e=>{"compactTitle"in e&&n(1,s=e.compactTitle),"onCompactChange"in e&&n(3,o=e.onCompactChange),"isSwitchingCompact"in e&&n(0,a=e.isSwitchingCompact),"$$scope"in e&&n(5,r=e.$$scope)},[a,s,l,o,i,r]}class ti extends Ye{constructor(e){super(),Xe(this,e,ei,Jn,a,{compactTitle:1,onCompactChange:3,isSwitchingCompact:0})}}const ni=e=>({}),ii=e=>({}),ri=e=>({}),si=e=>({});function oi(e){let t,n,i,r,o,a,l,c,u;const p=e[9].top,m=h(p,e,e[8],si),g=e[9].bottom,b=h(g,e,e[8],ii);return{c(){t=P("div"),n=P("div"),m&&m.c(),i=_(),r=P("div"),o=_(),a=P("div"),b&&b.c(),X(n,"class","absolute top-0 left-0 right-0"),A(n,"bottom","196px"),X(r,"class","absolute left-0 right-0 h-1 split-view-resizer border-b border-solid border-b-gray-300 dark:border-b-gray-700 svelte-1j0yqlr"),A(r,"bottom","192px"),E(r,"is-resizing",e[3]),X(a,"class","absolute left-0 bottom-0 right-0 overflow-hidden"),A(a,"height","192px"),X(t,"class","w-full h-full relative split-view svelte-1j0yqlr"),E(t,"is-resizing",e[3])},m(s,h){$(s,t,h),v(t,n),m&&m.m(n,null),e[10](n),v(t,i),v(t,r),e[11](r),v(t,o),v(t,a),b&&b.m(a,null),e[12](a),l=!0,c||(u=[C(r,"mousedown",e[4]),C(t,"mousemove",e[5]),C(t,"mouseup",e[6])],c=!0)},p(e,[n]){m&&m.p&&(!l||256&n)&&f(m,p,e,e[8],l?d(p,e[8],n,ri):O(e[8]),si),(!l||8&n)&&E(r,"is-resizing",e[3]),b&&b.p&&(!l||256&n)&&f(b,g,e,e[8],l?d(g,e[8],n,ni):O(e[8]),ii),(!l||8&n)&&E(t,"is-resizing",e[3])},i(e){l||(be(m,e),be(b,e),l=!0)},o(e){we(m,e),we(b,e),l=!1},d(n){n&&Q(t),m&&m.d(n),e[10](null),e[11](null),b&&b.d(n),e[12](null),c=!1,s(u)}}}function ai(e,t,n){let i,r,s,{$$slots:o={},$$scope:a}=t,{bottomIsCollapsed:l=null}=t,c=!1,h=!1;function u(e){const t=.6*(window.innerHeight-40);e=Math.max(40,Math.min(t,e)),n(0,i.style.height=`${e}px`,i),n(2,s.style.bottom=`${e}px`,s),n(1,r.style.bottom=`${e+4}px`,r)}function d(){u(i.offsetHeight)}return N((()=>{u(i.offsetHeight),window.addEventListener("resize",d),h=!0})),L((()=>{window.removeEventListener("resize",d)})),e.$$set=e=>{"bottomIsCollapsed"in e&&n(7,l=e.bottomIsCollapsed),"$$scope"in e&&n(8,a=e.$$scope)},e.$$.update=()=>{128&e.$$.dirty&&h&&null!=l&&u(l?40:192)},[i,r,s,c,function(e){n(3,c=!0)},function(e){c&&u(window.innerHeight-e.clientY)},function(e){n(3,c=!1)},l,a,o,function(e){K[e?"unshift":"push"]((()=>{r=e,n(1,r)}))},function(e){K[e?"unshift":"push"]((()=>{s=e,n(2,s)}))},function(e){K[e?"unshift":"push"]((()=>{i=e,n(0,i)}))}]}class li extends Ye{constructor(e){super(),Xe(this,e,ai,oi,a,{bottomIsCollapsed:7})}}function ci(e){let t,n,i,r,a,l,c,h,u,d,f,O,p,m,g,b;return i=new Wt({props:{title:e[0]}}),{c(){t=P("div"),n=P("div"),_e(i.$$.fragment),r=_(),a=P("p"),l=T(e[1]),c=_(),h=P("div"),u=P("button"),d=T(e[2]),f=_(),O=P("button"),p=T(e[3]),X(u,"class","px-3 py-1 rounded border border-solid border-gray-800 text-gray-800 hover:bg-gray-800 hover:text-white dark:border-white dark:text-white dark:hover:bg-white dark:hover:text-black"),X(O,"class","px-3 py-1 rounded border border-solid border-gray-800 hover:border-red-600 dark:hover:border-red-400 text-gray-800 hover:bg-red-600 hover:text-white dark:border-white dark:text-white dark:hover:bg-red-400 dark:hover:text-gray-800"),X(h,"class","flex justify-end gap-4"),X(t,"class","w-full max-w-lg mx-2 my-8 p-4 overflow-hidden bg-gray-100 dark:bg-gray-800 rounded-xl drop-shadow-md flex flex-col gap-4")},m(s,w){$(s,t,w),v(t,n),Ze(i,n,null),v(t,r),v(t,a),v(a,l),v(t,c),v(t,h),v(h,u),v(u,d),v(h,f),v(h,O),v(O,p),m=!0,g||(b=[C(u,"click",(function(){o(e[4])&&e[4].apply(this,arguments)})),C(O,"click",(function(){o(e[5])&&e[5].apply(this,arguments)}))],g=!0)},p(t,n){e=t;const r={};1&n&&(r.title=e[0]),i.$set(r),(!m||2&n)&&R(l,e[1]),(!m||4&n)&&R(d,e[2]),(!m||8&n)&&R(p,e[3])},i(e){m||(be(i.$$.fragment,e),m=!0)},o(e){we(i.$$.fragment,e),m=!1},d(e){e&&Q(t),Ce(i),g=!1,s(b)}}}function hi(e){let t,n;return t=new Je({props:{$$slots:{default:[ci]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,[n]){const i={};127&n&&(i.$$scope={dirty:n,ctx:e}),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function ui(e,t,n){let{title:i}=t,{description:r}=t,{confirmText:s="Confirm"}=t,{cancelText:o="Cancel"}=t,{onConfirm:a}=t,{onCancel:l}=t;return e.$$set=e=>{"title"in e&&n(0,i=e.title),"description"in e&&n(1,r=e.description),"confirmText"in e&&n(2,s=e.confirmText),"cancelText"in e&&n(3,o=e.cancelText),"onConfirm"in e&&n(4,a=e.onConfirm),"onCancel"in e&&n(5,l=e.onCancel)},[i,r,s,o,a,l]}class di extends Ye{constructor(e){super(),Xe(this,e,ui,hi,a,{title:0,description:1,confirmText:2,cancelText:3,onConfirm:4,onCancel:5})}}function fi(t){let n,i,r;return{c(){n=P("button"),n.innerHTML='clear',X(n,"title","Clear")},m(e,s){$(e,n,s),i||(r=C(n,"click",t[5]),i=!0)},p:e,d(e){e&&Q(n),i=!1,r()}}}function Oi(e){let t,n;return t=new di({props:{title:"Refresh Viewer",description:"Are you sure you want to refresh the viewer? You will be able to upload another package.",confirmText:"Reload Viewer",cancelText:"Cancel",onConfirm:e[6],onCancel:e[11]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};2&n&&(i.onCancel=e[11]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function pi(e){let t,n,i,r,o,a,l,h,u,d,f,O,p,m,g,b,w,x,y,S,k,T=Boolean(e[0]),Y=T&&fi(e),R=e[1]&&Oi(e);return{c(){t=P("div"),n=P("div"),i=P("button"),r=P("img"),a=_(),l=P("button"),h=P("img"),d=_(),f=P("div"),O=P("img"),m=_(),g=P("input"),b=_(),Y&&Y.c(),w=_(),R&&R.c(),x=Z(),c(r.src,o="./assets/icons/refresh.svg")||X(r,"src","./assets/icons/refresh.svg"),X(r,"alt",e[2]),X(r,"class","svg h-4 w-4 tint-on-hover"),X(i,"class","flex-shrink-0"),X(i,"title","Reset Viewer"),c(h.src,u="./assets/icons/chevron-"+e[2]+"-outline.svg")||X(h,"src",u),X(h,"alt",e[2]),X(h,"class","svg h-5 w-5 tint-on-hover"),X(l,"class","flex-shrink-0"),X(l,"title",e[3]),X(n,"class","flex-shrink-0 flex items-center gap-2"),c(O.src,p="./assets/icons/search.svg")||X(O,"src","./assets/icons/search.svg"),X(O,"alt","search"),X(O,"class","svg h-4 w-4"),X(g,"type","text"),X(g,"class","flex-1 rounded bg-transparent min-w-0 w-0 text-sm placeholder-gray-500"),X(g,"placeholder","Search"),X(f,"class","basis-full p-1 flex gap-1 items-center rounded bg-gray-300 dark:bg-gray-800"),A(f,"max-width","196px"),X(t,"class","h-full w-full flex items-center justify-between gap-4 px-2")},m(s,o){$(s,t,o),v(t,n),v(n,i),v(i,r),v(n,a),v(n,l),v(l,h),v(t,d),v(t,f),v(f,O),v(f,m),v(f,g),q(g,e[0]),v(f,b),Y&&Y.m(f,null),$(s,w,o),R&&R.m(s,o),$(s,x,o),y=!0,S||(k=[C(i,"click",e[9]),C(l,"click",e[4]),C(g,"input",e[10])],S=!0)},p(e,[t]){(!y||4&t)&&X(r,"alt",e[2]),(!y||4&t&&!c(h.src,u="./assets/icons/chevron-"+e[2]+"-outline.svg"))&&X(h,"src",u),(!y||4&t)&&X(h,"alt",e[2]),(!y||8&t)&&X(l,"title",e[3]),1&t&&g.value!==e[0]&&q(g,e[0]),1&t&&(T=Boolean(e[0])),T?Y?Y.p(e,t):(Y=fi(e),Y.c(),Y.m(f,null)):Y&&(Y.d(1),Y=null),e[1]?R?(R.p(e,t),2&t&&be(R,1)):(R=Oi(e),R.c(),be(R,1),R.m(x.parentNode,x)):R&&(me(),we(R,1,1,(()=>{R=null})),ge())},i(e){y||(be(R),y=!0)},o(e){we(R),y=!1},d(e){e&&Q(t),Y&&Y.d(),e&&Q(w),R&&R.d(e),e&&Q(x),S=!1,s(k)}}}function mi(e,t,n){let i,r,s,{sections:o}=t,a="",l=!1;return e.$$set=e=>{"sections"in e&&n(7,o=e.sections)},e.$$.update=()=>{1&e.$$.dirty&&Rt.requestSearch(a),128&e.$$.dirty&&n(8,i=o?.every((e=>e.collapsed))),256&e.$$.dirty&&n(3,r=i?"Expand All":"Collapse All"),256&e.$$.dirty&&n(2,s=i?"expand":"collapse")},[a,l,s,r,function(){const e=!i;o.forEach((t=>t.collapsed=e)),n(7,o)},function(){n(0,a="")},function(){n(1,l=!1),Rt.unloadPackage({requestRefresh:!0}),async function(e){if(!e||e.length<1||"/"!=e.charAt(0)&&0!==e.indexOf("#/"))throw Error("Invalid parameter location");await re();const t=("#"==e.charAt(0)?"":"#")+e;try{const e={...history.state};delete e.__svelte_spa_router_scrollX,delete e.__svelte_spa_router_scrollY,window.history.replaceState(e,void 0,t)}catch(e){console.warn("Caught exception while replacing the current page. If you're running this in the Svelte REPL, please note that the `replace` method might not work in this environment.")}window.dispatchEvent(new Event("hashchange"))}("#/view")},o,i,()=>n(1,l=!0),function(){a=this.value,n(0,a)},()=>n(1,l=!1)]}class gi extends Ye{constructor(e){super(),Xe(this,e,mi,pi,a,{sections:7})}}function bi(e){let t,n,i,r,s,o,a;return n=new Nt({props:{level:e[0]}}),{c(){t=P("div"),_e(n.$$.fragment),i=_(),r=P("p"),s=T(e[1]),X(r,"class",o="monospace text-xs diagnostics-text "+e[3]),X(t,"title",e[2]),X(t,"class","flex-shrink-0 flex items-center gap-1 flex-nowrap whitespace-nowrap")},m(e,o){$(e,t,o),Ze(n,t,null),v(t,i),v(t,r),v(r,s),a=!0},p(e,[i]){const l={};1&i&&(l.level=e[0]),n.$set(l),(!a||2&i)&&R(s,e[1]),(!a||8&i&&o!==(o="monospace text-xs diagnostics-text "+e[3]))&&X(r,"class",o),(!a||4&i)&&X(t,"title",e[2])},i(e){a||(be(n.$$.fragment,e),a=!0)},o(e){we(n.$$.fragment,e),a=!1},d(e){e&&Q(t),Ce(n)}}}function wi(e,t,n){let i,r;const{DiagnosticLevel:s}=window.S4TK.validation;let{level:o}=t,{count:a}=t;return e.$$set=e=>{"level"in e&&n(0,o=e.level),"count"in e&&n(1,a=e.count)},e.$$.update=()=>{1&e.$$.dirty&&n(2,i=s[o]),4&e.$$.dirty&&n(3,r=i.toLowerCase())},[o,a,i,r]}class xi extends Ye{constructor(e){super(),Xe(this,e,wi,bi,a,{level:0,count:1})}}function vi(e){let t,n;return t=new xi({props:{level:e[3].Error,count:e[2]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};4&n&&(i.count=e[2]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function yi(e){let t,n;return t=new xi({props:{level:e[3].Warning,count:e[1]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};2&n&&(i.count=e[1]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function Si(e){let t,n;return t=new xi({props:{level:e[3].Info,count:e[0]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.count=e[0]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function $i(e){let t,n,i,r,s=Boolean(e[2]),o=Boolean(e[1]),a=Boolean(e[0]),l=s&&vi(e),c=o&&yi(e),h=a&&Si(e);return{c(){t=P("div"),l&&l.c(),n=_(),c&&c.c(),i=_(),h&&h.c(),X(t,"class","flex-shrink-0 flex items-center gap-2 flex-nowrap whitespace-nowrap")},m(e,s){$(e,t,s),l&&l.m(t,null),v(t,n),c&&c.m(t,null),v(t,i),h&&h.m(t,null),r=!0},p(e,[r]){4&r&&(s=Boolean(e[2])),s?l?(l.p(e,r),4&r&&be(l,1)):(l=vi(e),l.c(),be(l,1),l.m(t,n)):l&&(me(),we(l,1,1,(()=>{l=null})),ge()),2&r&&(o=Boolean(e[1])),o?c?(c.p(e,r),2&r&&be(c,1)):(c=yi(e),c.c(),be(c,1),c.m(t,i)):c&&(me(),we(c,1,1,(()=>{c=null})),ge()),1&r&&(a=Boolean(e[0])),a?h?(h.p(e,r),1&r&&be(h,1)):(h=Si(e),h.c(),be(h,1),h.m(t,null)):h&&(me(),we(h,1,1,(()=>{h=null})),ge())},i(e){r||(be(l),be(c),be(h),r=!0)},o(e){we(l),we(c),we(h),r=!1},d(e){e&&Q(t),l&&l.d(),c&&c.d(),h&&h.d()}}}function Qi(e,t,n){let i,r,s,o;const{DiagnosticLevel:a}=window.S4TK.validation;let{diagnostics:l}=t;return e.$$set=e=>{"diagnostics"in e&&n(4,l=e.diagnostics)},e.$$.update=()=>{16&e.$$.dirty&&n(5,i=l.filter((e=>bt.passesSettings(e)))),32&e.$$.dirty&&n(2,r=bt.countExact(a.Error,i)),32&e.$$.dirty&&n(1,s=bt.countExact(a.Warning,i)),32&e.$$.dirty&&n(0,o=bt.countExact(a.Info,i))},[o,s,r,a,l,i]}class ki extends Ye{constructor(e){super(),Xe(this,e,Qi,$i,a,{diagnostics:4})}}function Pi(t){let n,i,r=t[0].tuningInfo.displayName+"";return{c(){n=P("p"),i=T(r),X(n,"class","mb-1 text-sm ellipsis-overflow")},m(e,t){$(e,n,t),v(n,i)},p(e,t){1&t&&r!==(r=e[0].tuningInfo.displayName+"")&&R(i,r)},i:e,o:e,d(e){e&&Q(n)}}}function Ti(e){let t,n,i,r,s,o,a=e[0].tuningInfo.displayName+"";return s=new ki({props:{diagnostics:e[0].tuningInfo.diagnostics}}),{c(){t=P("div"),n=P("p"),i=T(a),r=_(),_e(s.$$.fragment),X(n,"class","text-sm ellipsis-overflow"),X(t,"class","mb-1 w-full flex items-center justify-between")},m(e,a){$(e,t,a),v(t,n),v(n,i),v(t,r),Ze(s,t,null),o=!0},p(e,t){(!o||1&t)&&a!==(a=e[0].tuningInfo.displayName+"")&&R(i,a);const n={};1&t&&(n.diagnostics=e[0].tuningInfo.diagnostics),s.$set(n)},i(e){o||(be(s.$$.fragment,e),o=!0)},o(e){we(s.$$.fragment,e),o=!1},d(e){e&&Q(t),Ce(s)}}}function _i(e){let t,n,i,r,s,o,a,l,h,u,d,f,O,p,m,g=e[2]&&Zi(e);return{c(){t=P("div"),n=P("button"),i=P("div"),r=P("img"),o=_(),a=P("p"),l=T("SimData ("),h=P("span"),u=T(e[1]),d=T(")"),f=_(),g&&g.c(),c(r.src,s="./assets/icons/link-outline.svg")||X(r,"src","./assets/icons/link-outline.svg"),X(r,"alt","Link"),X(r,"class","h-4 w-4 svg"),X(h,"class","monospace"),X(a,"class","text-sm ellipsis-overflow"),X(i,"class","min-w-0 flex items-center gap-2"),X(n,"class","w-full flex gap-2 items-center justify-between bg-gray-300 dark:bg-gray-800 px-2 py-1 rounded border border-solid border-gray-200 dark:border-gray-900 h-10 sm:h-8 svelte-1kz9fsp"),E(n,"active-border",e[5]),X(t,"class","px-2 pb-2")},m(s,c){$(s,t,c),v(t,n),v(n,i),v(i,r),v(i,o),v(i,a),v(a,l),v(a,h),v(h,u),v(a,d),v(n,f),g&&g.m(n,null),O=!0,p||(m=C(n,"click",e[7]),p=!0)},p(e,t){(!O||2&t)&&R(u,e[1]),e[2]?g?(g.p(e,t),4&t&&be(g,1)):(g=Zi(e),g.c(),be(g,1),g.m(n,null)):g&&(me(),we(g,1,1,(()=>{g=null})),ge()),(!O||32&t)&&E(n,"active-border",e[5])},i(e){O||(be(g),O=!0)},o(e){we(g),O=!1},d(e){e&&Q(t),g&&g.d(),p=!1,m()}}}function Zi(e){let t,n;return t=new ki({props:{diagnostics:e[0].simDataInfo.diagnostics}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.diagnostics=e[0].simDataInfo.diagnostics),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function Ci(e){let t,n,i,r,s,o,a,l,c,h,u,d=e[0].tuningInfo.resourceKey+"";const f=[Ti,Pi],O=[];function p(e,t){return e[3]?0:1}n=p(e),i=O[n]=f[n](e);let m=e[4]&&_i(e);return{c(){t=P("button"),i.c(),r=_(),s=P("p"),o=T(d),a=_(),m&&m.c(),l=Z(),X(s,"class","text-xs text-subtle monospace ellipsis-overflow"),X(t,"class","px-2 py-2 text-left w-full")},m(i,d){$(i,t,d),O[n].m(t,null),v(t,r),v(t,s),v(s,o),$(i,a,d),m&&m.m(i,d),$(i,l,d),c=!0,h||(u=C(t,"click",e[6]),h=!0)},p(e,[s]){let a=n;n=p(e),n===a?O[n].p(e,s):(me(),we(O[a],1,1,(()=>{O[a]=null})),ge(),i=O[n],i?i.p(e,s):(i=O[n]=f[n](e),i.c()),be(i,1),i.m(t,r)),(!c||1&s)&&d!==(d=e[0].tuningInfo.resourceKey+"")&&R(o,d),e[4]?m?(m.p(e,s),16&s&&be(m,1)):(m=_i(e),m.c(),be(m,1),m.m(l.parentNode,l)):m&&(me(),we(m,1,1,(()=>{m=null})),ge())},i(e){c||(be(i),be(m),c=!0)},o(e){we(i),we(m),c=!1},d(e){e&&Q(t),O[n].d(),e&&Q(a),m&&m.d(e),e&&Q(l),h=!1,u()}}}function Xi(e,t,n){let i,r,s,o,a,{cell:l}=t,{activeId:c}=t;return e.$$set=e=>{"cell"in e&&n(0,l=e.cell),"activeId"in e&&n(8,c=e.activeId)},e.$$.update=()=>{257&e.$$.dirty&&n(5,i=l.simDataInfo?.id===c),1&e.$$.dirty&&n(4,r=Boolean(l.simDataInfo)),1&e.$$.dirty&&n(3,s=Boolean(l.tuningInfo.diagnostics.length)),1&e.$$.dirty&&n(2,o=Boolean(l.simDataInfo?.diagnostics.length)),1&e.$$.dirty&&n(1,a=l.simDataInfo?.resourceKey.split("-")[1]??"Unknown")},[l,a,o,s,r,i,function(){Rt.requestFile(l.tuningInfo.id,!0)},function(){Rt.requestFile(l.simDataInfo.id,!0)},c]}class Yi extends Ye{constructor(e){super(),Xe(this,e,Xi,Ci,a,{cell:0,activeId:8})}}function Ri(e,t,n){const i=e.slice();return i[9]=t[n],i[11]=n,i}function qi(t){let n,i,r=t[0].filterName+"";return{c(){n=P("p"),i=T(r),X(n,"class","mb-1 text-sm ellipsis-overflow")},m(e,t){$(e,n,t),v(n,i)},p(e,t){1&t&&r!==(r=e[0].filterName+"")&&R(i,r)},i:e,o:e,d(e){e&&Q(n)}}}function Ai(e){let t,n,i,r,s,o,a=e[0].filterName+"";return s=new ki({props:{diagnostics:e[1]}}),{c(){t=P("div"),n=P("p"),i=T(a),r=_(),_e(s.$$.fragment),X(n,"class","text-sm ellipsis-overflow"),X(t,"class","mb-1 w-full flex items-center justify-between")},m(e,a){$(e,t,a),v(t,n),v(n,i),v(t,r),Ze(s,t,null),o=!0},p(e,t){(!o||1&t)&&a!==(a=e[0].filterName+"")&&R(i,a);const n={};2&t&&(n.diagnostics=e[1]),s.$set(n)},i(e){o||(be(s.$$.fragment,e),o=!0)},o(e){we(s.$$.fragment,e),o=!1},d(e){e&&Q(t),Ce(s)}}}function Wi(e){let t,n,i,r=e[9].displayName+"",s=e[6](e[9])+"";return{c(){t=P("option"),n=T(r),i=T(s),t.__value=e[11],t.value=t.__value},m(e,r){$(e,t,r),v(t,n),v(t,i)},p(e,t){1&t&&r!==(r=e[9].displayName+"")&&R(n,r),1&t&&s!==(s=e[6](e[9])+"")&&R(i,s)},d(e){e&&Q(t)}}}function Ei(e){let t,n,i,r,o,a,l,c,h,u,d,f,O=e[0].sharedResourceKey+"";const p=[Ai,qi],m=[];function g(e,t){return e[3]?0:1}n=g(e),i=m[n]=p[n](e);let b=e[0].localeChoices,w=[];for(let t=0;t{m[o]=null})),ge(),i=m[n],i?i.p(e,s):(i=m[n]=p[n](e),i.c()),be(i,1),i.m(t,r)),(!u||1&s)&&O!==(O=e[0].sharedResourceKey+"")&&R(a,O),65&s){let t;for(b=e[0].localeChoices,t=0;t{"cell"in e&&n(0,a=e.cell)},e.$$.update=()=>{1&e.$$.dirty&&(i=a.localeChoices[a.chosenLocaleIndex]),1&e.$$.dirty&&n(1,r=gt.allDiagnostics(a)),2&e.$$.dirty&&n(3,s=Boolean(r.length))},[a,r,o,s,function(){Rt.requestFile(i.id,!0)},function(){n(0,a.chosenLocaleIndex=parseInt(o.value),a);const e=a.localeChoices[a.chosenLocaleIndex];Rt.requestFile(e.id,!0)},function(e){const t=e.diagnostics.filter((e=>bt.passesSettings(e))).length;return 0===t?"":1===t?" (1 issue)":` (${t} issues)`},function(e){K[e?"unshift":"push"]((()=>{o=e,n(2,o)}))}]}class zi extends Ye{constructor(e){super(),Xe(this,e,ji,Ei,a,{cell:0})}}function Di(t){let n,i,r=t[0].info.displayName+"";return{c(){n=P("p"),i=T(r),X(n,"class","mb-1 text-sm ellipsis-overflow")},m(e,t){$(e,n,t),v(n,i)},p(e,t){1&t&&r!==(r=e[0].info.displayName+"")&&R(i,r)},i:e,o:e,d(e){e&&Q(n)}}}function Ui(e){let t,n,i,r,s,o,a=e[0].info.displayName+"";return s=new ki({props:{diagnostics:e[0].info.diagnostics}}),{c(){t=P("div"),n=P("p"),i=T(a),r=_(),_e(s.$$.fragment),X(n,"class","text-sm ellipsis-overflow"),X(t,"class","mb-1 w-full flex items-center justify-between")},m(e,a){$(e,t,a),v(t,n),v(n,i),v(t,r),Ze(s,t,null),o=!0},p(e,t){(!o||1&t)&&a!==(a=e[0].info.displayName+"")&&R(i,a);const n={};1&t&&(n.diagnostics=e[0].info.diagnostics),s.$set(n)},i(e){o||(be(s.$$.fragment,e),o=!0)},o(e){we(s.$$.fragment,e),o=!1},d(e){e&&Q(t),Ce(s)}}}function Vi(e){let t,n,i,r,s,o,a,l,c,h=e[0].info.resourceKey+"";const u=[Ui,Di],d=[];function f(e,t){return e[1]?0:1}return n=f(e),i=d[n]=u[n](e),{c(){t=P("button"),i.c(),r=_(),s=P("p"),o=T(h),X(s,"class","text-xs text-subtle monospace ellipsis-overflow"),X(t,"class","px-2 py-2 text-left w-full")},m(i,h){$(i,t,h),d[n].m(t,null),v(t,r),v(t,s),v(s,o),a=!0,l||(c=C(t,"click",e[2]),l=!0)},p(e,[s]){let l=n;n=f(e),n===l?d[n].p(e,s):(me(),we(d[l],1,1,(()=>{d[l]=null})),ge(),i=d[n],i?i.p(e,s):(i=d[n]=u[n](e),i.c()),be(i,1),i.m(t,r)),(!a||1&s)&&h!==(h=e[0].info.resourceKey+"")&&R(o,h)},i(e){a||(be(i),a=!0)},o(e){we(i),a=!1},d(e){e&&Q(t),d[n].d(),l=!1,c()}}}function Ii(e,t,n){let i,{cell:r}=t;return e.$$set=e=>{"cell"in e&&n(0,r=e.cell)},e.$$.update=()=>{1&e.$$.dirty&&n(1,i=Boolean(r.info.diagnostics.length))},[r,i,function(){Rt.requestFile(r.info.id,!0)}]}class Mi extends Ye{constructor(e){super(),Xe(this,e,Ii,Vi,a,{cell:0})}}function Gi(e){let t,n;return t=new Mi({props:{cell:e[0]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.cell=e[0]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function Bi(e){let t,n;return t=new zi({props:{cell:e[0]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.cell=e[0]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function Ni(e){let t,n;return t=new Yi({props:{cell:e[0],activeId:e[1]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.cell=e[0]),2&n&&(i.activeId=e[1]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function Li(e){let t,n,i,r;const s=[Ni,Bi,Gi],o=[];function a(e,t){return e[0].displayType===mt.Tuning?0:e[0].displayType===mt.StringTable?1:2}return n=a(e),i=o[n]=s[n](e),{c(){t=P("div"),i.c(),X(t,"class","border-l-4 border-b border-solid border-l-transparent border-b-gray-300 dark:border-b-gray-700 explorer-cell hover:bg-gray-200 dark:hover:bg-gray-800 svelte-1tsgmii"),E(t,"active-left-border",e[2])},m(e,i){$(e,t,i),o[n].m(t,null),r=!0},p(e,[l]){let c=n;n=a(e),n===c?o[n].p(e,l):(me(),we(o[c],1,1,(()=>{o[c]=null})),ge(),i=o[n],i?i.p(e,l):(i=o[n]=s[n](e),i.c()),be(i,1),i.m(t,null)),(!r||4&l)&&E(t,"active-left-border",e[2])},i(e){r||(be(i),r=!0)},o(e){we(i),r=!1},d(e){e&&Q(t),o[n].d()}}}function Fi(e,t,n){let i,{cell:r}=t,{activeId:s}=t;return e.$$set=e=>{"cell"in e&&n(0,r=e.cell),"activeId"in e&&n(1,s=e.activeId)},e.$$.update=()=>{3&e.$$.dirty&&n(2,i=gt.isActive(r,s))},[r,s,i]}class Hi extends Ye{constructor(e){super(),Xe(this,e,Fi,Li,a,{cell:0,activeId:1})}}function Ki(e,t,n){const i=e.slice();return i[11]=t[n],i}function Ji(t){let n,i;return{c(){n=P("img"),c(n.src,i="./assets/icons/"+t[6]+".svg")||X(n,"src",i),X(n,"alt",t[6]),X(n,"class","svg h-3 w-3 ml-3")},m(e,t){$(e,n,t)},p(e,t){64&t&&!c(n.src,i="./assets/icons/"+e[6]+".svg")&&X(n,"src",i),64&t&&X(n,"alt",e[6])},i:e,o:e,d(e){e&&Q(n)}}}function er(e){let t,n,i,r,s,o;return n=new ki({props:{diagnostics:e[5]}}),{c(){t=P("div"),_e(n.$$.fragment),i=_(),r=P("img"),c(r.src,s="./assets/icons/"+e[6]+".svg")||X(r,"src",s),X(r,"alt",e[6]),X(r,"class","svg h-3 w-3"),X(t,"class","flex-shrink-0 ml-3 flex items-center gap-2")},m(e,s){$(e,t,s),Ze(n,t,null),v(t,i),v(t,r),o=!0},p(e,t){const i={};32&t&&(i.diagnostics=e[5]),n.$set(i),(!o||64&t&&!c(r.src,s="./assets/icons/"+e[6]+".svg"))&&X(r,"src",s),(!o||64&t)&&X(r,"alt",e[6])},i(e){o||(be(n.$$.fragment,e),o=!0)},o(e){we(n.$$.fragment,e),o=!1},d(e){e&&Q(t),Ce(n)}}}function tr(e){let t,n,i=e[2],r=[];for(let t=0;twe(r[e],1,1,(()=>{r[e]=null}));return{c(){for(let e=0;e{w[s]=null})),ge(),h=w[c],h?h.p(e,i):(h=w[c]=b[c](e),h.c()),be(h,1),h.m(n,null)),(!O||17&i)&&E(n,"active-left-border",e[0].collapsed&&e[4]),(!O||4&i)&&E(n,"opacity-20",!e[2]?.length),(!O||1&i)&&E(n,"stick-to-top",!e[0].collapsed),e[0].collapsed?y&&(me(),we(y,1,1,(()=>{y=null})),ge()):y?(y.p(e,i),1&i&&be(y,1)):(y=tr(e),y.c(),be(y,1),y.m(t,null))},i(e){O||(be(h),be(y),O=!0)},o(e){we(h),we(y),O=!1},d(e){e&&Q(t),w[c].d(),y&&y.d(),p=!1,m()}}}function rr(e,t,n){let i,r,s,o,a;const{passesSearch:l,allDiagnostics:c}=gt;let{searchTerm:h}=t,{section:u}=t,{activeId:d}=t;return e.$$set=e=>{"searchTerm"in e&&n(8,h=e.searchTerm),"section"in e&&n(0,u=e.section),"activeId"in e&&n(1,d=e.activeId)},e.$$.update=()=>{1&e.$$.dirty&&n(6,i=u.collapsed?"chevron-right":"chevron-down"),257&e.$$.dirty&&n(2,r=u.cells.filter((e=>l(e,h)))),4&e.$$.dirty&&n(5,s=vt(...r.map(c))),3&e.$$.dirty&&n(4,o=u.cells.some((e=>e.containedIds.has(d)))),5&e.$$.dirty&&n(3,a=r.length"opacity: "+e*s}}function lr(e,{delay:t=0,duration:n=400,easing:i=or,x:r=0,y:s=0,opacity:o=0}={}){const a=getComputedStyle(e),l=+a.opacity,c="none"===a.transform?"":a.transform,h=l*(1-o);return{delay:t,duration:n,easing:i,css:(e,t)=>`\n\t\t\ttransform: ${c} translate(${(1-e)*r}px, ${(1-e)*s}px);\n\t\t\topacity: ${l-h*t}`}}function cr(e){let t,n,i,r,s;return{c(){t=P("div"),n=P("p"),i=T(e[0]),X(n,"class","text-white"),X(t,"class","fixed z-50 bottom-4 right-4 bg-gray-900 px-4 py-2 rounded")},m(e,r){$(e,t,r),v(t,n),v(n,i),s=!0},p(e,[t]){(!s||1&t)&&R(i,e[0])},i(e){s||(se((()=>{r||(r=ve(t,lr,{y:20},!0)),r.run(1)})),s=!0)},o(e){r||(r=ve(t,lr,{y:20},!1)),r.run(0),s=!1},d(e){e&&Q(t),e&&r&&r.end()}}}function hr(e,t,n){let{text:i}=t,{visible:r}=t;return N((()=>{setTimeout((()=>{n(1,r=!1)}),2e3)})),e.$$set=e=>{"text"in e&&n(0,i=e.text),"visible"in e&&n(1,r=e.visible)},[i,r]}class ur extends Ye{constructor(e){super(),Xe(this,e,hr,cr,a,{text:0,visible:1})}}function dr(e){let t,n,i;function r(t){e[4](t)}let s={text:"Downloading "+e[0]+"..."};return void 0!==e[1]&&(s.visible=e[1]),t=new ur({props:s}),K.push((()=>Te(t,"visible",r))),{c(){_e(t.$$.fragment)},m(e,n){Ze(t,e,n),i=!0},p(e,i){const r={};1&i&&(r.text="Downloading "+e[0]+"..."),!n&&2&i&&(n=!0,r.visible=e[1],oe((()=>n=!1))),t.$set(r)},i(e){i||(be(t.$$.fragment,e),i=!0)},o(e){we(t.$$.fragment,e),i=!1},d(e){Ce(t,e)}}}function fr(e){let t,n,i,r,s,o,a,l,c=e[1]&&dr(e);return{c(){t=P("button"),n=T(e[0]),r=_(),c&&c.c(),s=Z(),X(t,"class","download-button flex-1 text-xs px-2 py-1 rounded border border-solid border-gray-800 text-gray-800 hover:bg-gray-800 hover:text-white dark:border-white dark:text-white dark:hover:bg-white dark:hover:text-black whitespace-nowrap text-ellipsis overflow-hidden"),X(t,"title",i="Download "+e[0])},m(i,h){$(i,t,h),v(t,n),$(i,r,h),c&&c.m(i,h),$(i,s,h),o=!0,a||(l=C(t,"click",e[2]),a=!0)},p(e,[r]){(!o||1&r)&&R(n,e[0]),(!o||1&r&&i!==(i="Download "+e[0]))&&X(t,"title",i),e[1]?c?(c.p(e,r),2&r&&be(c,1)):(c=dr(e),c.c(),be(c,1),c.m(s.parentNode,s)):c&&(me(),we(c,1,1,(()=>{c=null})),ge())},i(e){o||(be(c),o=!0)},o(e){we(c),o=!1},d(e){e&&Q(t),e&&Q(r),c&&c.d(e),e&&Q(s),a=!1,l()}}}function Or(e,t,n){let{text:i}=t,{onClick:r}=t,s=!1;return e.$$set=e=>{"text"in e&&n(0,i=e.text),"onClick"in e&&n(3,r=e.onClick)},[i,s,function(){r(),s||n(1,s=!0)},r,function(e){s=e,n(1,s)}]}class pr extends Ye{constructor(e){super(),Xe(this,e,Or,fr,a,{text:0,onClick:3})}}const{Boolean:mr}=ye;function gr(e,t,n){const i=e.slice();return i[9]=t[n],i}function br(t){let n;return{c(){n=P("div"),n.innerHTML='

No files loaded

',X(n,"class","h-full flex items-center justify-center")},m(e,t){$(e,n,t)},p:e,i:e,o:e,d(e){e&&Q(n)}}}function wr(e){let t,n,i,r,s,o,a,l,h,u,d,f,O,p,m,g,b;function w(t){e[7](t)}let x={};void 0!==e[0]&&(x.sections=e[0]),i=new gi({props:x}),K.push((()=>Te(i,"sections",w)));let y=e[0],S=[];for(let t=0;twe(S[e],1,1,(()=>{S[e]=null}));return f=new pr({props:{text:"ZIP",onClick:e[4]}}),p=new pr({props:{text:"Package",onClick:e[6]}}),g=new pr({props:{text:"File",onClick:e[5]}}),{c(){t=P("div"),n=P("div"),_e(i.$$.fragment),s=_(),o=P("div");for(let e=0;er=!1))),i.$set(n),7&t){let n;for(y=e[0],n=0;n{o[l]=null})),ge(),i=o[n],i?i.p(e,r):(i=o[n]=s[n](e),i.c()),be(i,1),i.m(t,null))},i(e){r||(be(i),r=!0)},o(e){we(i),r=!1},d(e){e&&Q(t),o[n].d()}}}function yr(e,t,n){let i,r,s="",o=-1;const a=[ot.onExplorerSectionsChange.subscribe((e=>{n(0,r=e)})),ot.onViewedFileChange.subscribe((e=>{n(2,o=e?.id??-1)})),ot.onSearchTermChange.subscribe((e=>{n(1,s=e)}))];L((()=>{a.forEach((e=>e()))}));return e.$$.update=()=>{1&e.$$.dirty&&n(3,i=Boolean(r?.length))},[r,s,o,i,()=>Rt.downloadAllFiles(),()=>Rt.downloadCurrentFile(),()=>Rt.downloadCurrentPackage(),function(e){r=e,n(0,r)}]}class Sr extends Ye{constructor(e){super(),Xe(this,e,yr,vr,a,{})}}function $r(t){let n,i,r,s,o=t[3]&&Qr(t);return{c(){n=P("div"),i=P("label"),r=T(t[1]),s=_(),o&&o.c(),X(i,"for","file-upload"),X(i,"class","uppercase text-xs font-bold text-subtle"),X(n,"class","flex items-center mb-2")},m(e,t){$(e,n,t),v(n,i),v(i,r),v(n,s),o&&o.m(n,null)},p(e,t){2&t&&R(r,e[1]),e[3]?o?(o.p(e,t),8&t&&be(o,1)):(o=Qr(e),o.c(),be(o,1),o.m(n,null)):o&&(o.d(1),o=null)},i(e){be(o)},o:e,d(e){e&&Q(n),o&&o.d()}}}function Qr(n){let i,r,s,a;return{c(){i=P("p"),r=T(" • "),s=T(n[4]),X(i,"class","text-xs text-red-600 dark:text-red-400")},m(e,t){$(e,i,t),v(i,r),v(i,s)},p(e,t){16&t&&R(s,e[4])},i(n){a||se((()=>{a=function(n,i,r){let s,a,l=i(n,r),c=!1,h=0;function u(){s&&M(n,s)}function d(){const{delay:i=0,duration:r=300,easing:o=t,tick:d=e,css:f}=l||xe;f&&(s=I(n,0,1,r,i,o,f,h++)),d(0,1);const O=m()+i,p=O+r;a&&a.abort(),c=!0,se((()=>fe(n,!0,"start"))),a=x((e=>{if(c){if(e>=p)return d(1,0),fe(n,!0,"end"),u(),c=!1;if(e>=O){const t=o((e-O)/r);d(t,1-t)}}return c}))}let f=!1;return{start(){f||(f=!0,M(n),o(l)?(l=l(),de().then(d)):d())},invalidate(){f=!1},end(){c&&(u(),c=!1)}}}(i,ar,{}),a.start()}))},o:e,d(e){e&&Q(i)}}}function kr(t){let n,i,r,s,o,a=Boolean(t[1]),l=a&&$r(t);return{c(){n=P("div"),l&&l.c(),i=_(),r=P("input"),X(r,"name","file-upload"),X(r,"type","file"),X(r,"class","w-full min-w-0 hover:cursor-pointer border border-solid border-gray-600 dark:border-gray-300 p-2 rounded svelte-10do9z8"),X(r,"accept",t[0]),r.multiple=t[2],E(r,"border-red-500",t[3]),X(n,"class","w-full")},m(e,a){$(e,n,a),l&&l.m(n,null),v(n,i),v(n,r),s||(o=C(r,"change",t[7]),s=!0)},p(e,[t]){2&t&&(a=Boolean(e[1])),a?l?(l.p(e,t),2&t&&be(l,1)):(l=$r(e),l.c(),be(l,1),l.m(n,i)):l&&(l.d(1),l=null),1&t&&X(r,"accept",e[0]),4&t&&(r.multiple=e[2]),8&t&&E(r,"border-red-500",e[3])},i(e){be(l)},o:e,d(e){e&&Q(n),l&&l.d(),s=!1,o()}}}function Pr(e,t,n){let i,{accept:r}=t,{label:s=""}=t,{multiple:o=!1}=t,{filesInvalid:a=!1}=t,{errorMessage:l=""}=t,{onFilesChanged:c}=t;return e.$$set=e=>{"accept"in e&&n(0,r=e.accept),"label"in e&&n(1,s=e.label),"multiple"in e&&n(2,o=e.multiple),"filesInvalid"in e&&n(3,a=e.filesInvalid),"errorMessage"in e&&n(4,l=e.errorMessage),"onFilesChanged"in e&&n(6,c=e.onFilesChanged)},e.$$.update=()=>{96&e.$$.dirty&&void 0!==i&&c?.(i)},[r,s,o,a,l,i,c,function(){i=this.files,n(5,i)}]}class Tr extends Ye{constructor(e){super(),Xe(this,e,Pr,kr,a,{accept:0,label:1,multiple:2,filesInvalid:3,errorMessage:4,onFilesChanged:6})}}function _r(t){let n,i,r,s,o,a;return o=new Sn({}),{c(){n=P("div"),i=P("div"),i.innerHTML='

Scanning Package

\n

This may take a bit. Don't close this tab.

',r=_(),s=P("div"),_e(o.$$.fragment),X(i,"class","text-center"),X(s,"class","h-6"),X(n,"class","bg-gray-100 dark:bg-gray-800 rounded-xl drop-shadow-md p-8 flex flex-col items-center gap-8")},m(e,t){$(e,n,t),v(n,i),v(n,r),v(n,s),Ze(o,s,null),a=!0},p:e,i(e){a||(be(o.$$.fragment,e),a=!0)},o(e){we(o.$$.fragment,e),a=!1},d(e){e&&Q(n),Ce(o)}}}class Zr extends Ye{constructor(e){super(),Xe(this,e,null,_r,a,{})}}function Cr(e){let t,n;return t=new Je({props:{$$slots:{default:[Xr]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function Xr(e){let t,n;return t=new Zr({}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function Yr(e){let t,n,i,r,s,o,a,l,c,h;i=new Wt({props:{title:"Scan package for issues"}}),a=new Tr({props:{label:"Upload a package",errorMessage:"Not a valid package",onFilesChanged:e[2],accept:".package",filesInvalid:e[1],multiple:!1}});let u=e[0]&&Cr(e);return{c(){t=P("div"),n=P("div"),_e(i.$$.fragment),r=_(),s=P("div"),s.innerHTML='

Select a TS4 package file, and its contents will be shown. If any issues\n with meta data are found, they will be displayed. Note that TDESC\n validation is not yet available.

\n

A lack of warnings does not guarantee that everything is working; the\n scanner cannot check logic.

',o=_(),_e(a.$$.fragment),l=_(),u&&u.c(),c=Z(),X(s,"class","my-8"),X(n,"class","max-w-2xl"),X(t,"class","flex justify-center items-center h-full w-full px-4")},m(e,d){$(e,t,d),v(t,n),Ze(i,n,null),v(n,r),v(n,s),v(n,o),Ze(a,n,null),$(e,l,d),u&&u.m(e,d),$(e,c,d),h=!0},p(e,[t]){const n={};2&t&&(n.filesInvalid=e[1]),a.$set(n),e[0]?u?1&t&&be(u,1):(u=Cr(e),u.c(),be(u,1),u.m(c.parentNode,c)):u&&(me(),we(u,1,1,(()=>{u=null})),ge())},i(e){h||(be(i.$$.fragment,e),be(a.$$.fragment,e),be(u),h=!0)},o(e){we(i.$$.fragment,e),we(a.$$.fragment,e),we(u),h=!1},d(e){e&&Q(t),Ce(i),Ce(a),e&&Q(l),u&&u.d(e),e&&Q(c)}}}function Rr(e,t,n){const{Buffer:i}=window.NodeJS;let r=!1,s=!1;return[r,s,async function(e){if(e.length<1)return;n(0,r=!0),n(1,s=!1);const t=i.from(await e[0].arrayBuffer()),o=e[0].name;n(1,s=!await Rt.loadPackage(t,o)),n(0,r=!1)}]}class qr extends Ye{constructor(e){super(),Xe(this,e,Rr,Yr,a,{})}}function Ar(e){let t,n,i,r,s=e[0].width+"",o=e[0].height+"";return{c(){t=P("p"),n=T(s),i=T(" x "),r=T(o),X(t,"class","mt-2 text-subtle text-center text-sm")},m(e,s){$(e,t,s),v(t,n),v(t,i),v(t,r)},p(e,t){1&t&&s!==(s=e[0].width+"")&&R(n,s),1&t&&o!==(o=e[0].height+"")&&R(r,o)},d(e){e&&Q(t)}}}function Wr(t){let n,i,r,s,o,a=t[0].width&&t[0].height&&Ar(t);return{c(){n=P("div"),i=P("div"),r=P("img"),o=_(),a&&a.c(),c(r.src,s=t[0].pngBase64)||X(r,"src",s),X(r,"alt","Preview"),X(r,"class","max-w-full max-h-full border border-solid border-black dark:border-white"),X(i,"class","text-center"),X(n,"class","w-full h-full overflow-auto flex items-center justify-center")},m(e,t){$(e,n,t),v(n,i),v(i,r),v(i,o),a&&a.m(i,null)},p(e,[t]){1&t&&!c(r.src,s=e[0].pngBase64)&&X(r,"src",s),e[0].width&&e[0].height?a?a.p(e,t):(a=Ar(e),a.c(),a.m(i,null)):a&&(a.d(1),a=null)},i:e,o:e,d(e){e&&Q(n),a&&a.d()}}}function Er(e,t,n){let{info:i}=t;return e.$$set=e=>{"info"in e&&n(0,i=e.info)},[i]}class jr extends Ye{constructor(e){super(),Xe(this,e,Er,Wr,a,{info:0})}}function zr(e,t,n){const i=e.slice();return i[6]=t[n],i}function Dr(e){let t,n,i,r,s,o,a,l=e[2](e[6].key)+"",c=e[6].value+"";return{c(){t=P("li"),n=P("p"),i=T(l),r=_(),s=P("p"),o=T(c),a=_(),X(n,"class","inline monospace text-subtle text-sm"),X(s,"class","inline text-sm"),X(t,"class","mb-3")},m(e,l){$(e,t,l),v(t,n),v(n,i),v(t,r),v(t,s),v(s,o),v(t,a)},p(e,t){1&t&&l!==(l=e[2](e[6].key)+"")&&R(i,l),1&t&&c!==(c=e[6].value+"")&&R(o,c)},d(e){e&&Q(t)}}}function Ur(t){let n,i,r,s,o,a,l=t[0].entries,c=[];for(let e=0;e{"info"in e&&n(0,l=e.info)},e.$$.update=()=>{1&e.$$.dirty&&n(4,i=o[l.locale]??"Unknown"),1&e.$$.dirty&&n(3,r=1===l.entries.length?"1 entry":`${l.entries.length} entries`),24&e.$$.dirty&&n(1,s=`${i} String Table (${r})`)},[l,s,a,r,i]}class Ir extends Ye{constructor(e){super(),Xe(this,e,Vr,Ur,a,{info:0})}}function Mr(t){let n,i,r,s,o,a,l,c,h,u,d,f,O,p,m=t[0].resourceKey+"",g=t[0].displayName+"";return{c(){n=P("div"),i=P("p"),r=T("["),s=T(m),o=T("] "),a=T(g),l=_(),c=P("div"),h=P("div"),u=P("h2"),d=T(t[1]),f=_(),O=P("p"),p=T(t[2]),X(i,"class","text-xs text-subtle whitespace-nowrap text-ellipsis overflow-hidden"),X(n,"class","absolute top-0 left-0 right-0 h-8 flex items-center pl-2"),X(u,"class","mb-4 text-2xl font-bold text-subtle"),X(O,"class","text-subtle"),X(h,"class","text-center"),X(c,"class","absolute top-8 bottom-0 left-0 right-0 p-2 flex items-center justify-center")},m(e,t){$(e,n,t),v(n,i),v(i,r),v(i,s),v(i,o),v(i,a),$(e,l,t),$(e,c,t),v(c,h),v(h,u),v(u,d),v(h,f),v(h,O),v(O,p)},p(e,[t]){1&t&&m!==(m=e[0].resourceKey+"")&&R(s,m),1&t&&g!==(g=e[0].displayName+"")&&R(a,g),2&t&&R(d,e[1]),4&t&&R(p,e[2])},i:e,o:e,d(e){e&&Q(n),e&&Q(l),e&&Q(c)}}}function Gr(e,t,n){let{info:i}=t,{title:r}=t,{description:s}=t;return e.$$set=e=>{"info"in e&&n(0,i=e.info),"title"in e&&n(1,r=e.title),"description"in e&&n(2,s=e.description)},[i,r,s]}class Br extends Ye{constructor(e){super(),Xe(this,e,Gr,Mr,a,{info:0,title:1,description:2})}}class Nr{constructor(){}lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(t,this.length,i,1),Fr.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let n=[];return this.decompose(e,t,n,0),Fr.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),i=new Jr(this),r=new Jr(e);for(let e=t,s=t;;){if(i.next(e),r.next(e),e=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(s+=i.value.length,i.done||s>=n)return!0}}iter(e=1){return new Jr(this,e)}iterRange(e,t=this.length){return new es(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ts(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}static of(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new Lr(e):Fr.from(Lr.split(e,[])):Nr.empty}}class Lr extends Nr{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let r=0;;r++){let s=this.text[r],o=i+s.length;if((t?n:o)>=e)return new ns(i,o,n,s);i=o+1,n++}}decompose(e,t,n,i){let r=e<=0&&t>=this.length?this:new Lr(Kr(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&i){let e=n.pop(),t=Hr(r.text,e.text.slice(),0,r.length);if(t.length<=32)n.push(new Lr(t,e.length+r.length));else{let e=t.length>>1;n.push(new Lr(t.slice(0,e)),new Lr(t.slice(e)))}}else n.push(r)}replace(e,t,n){if(!(n instanceof Lr))return super.replace(e,t,n);let i=Hr(this.text,Hr(n.text,Kr(this.text,0,e)),t),r=this.length+n.length-(t-e);return i.length<=32?new Lr(i,r):Fr.from(Lr.split(i,[]),r)}sliceString(e,t=this.length,n="\n"){let i="";for(let r=0,s=0;r<=t&&se&&s&&(i+=n),er&&(i+=o.slice(Math.max(0,e-r),t-r)),r=a+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let r of e)n.push(r),i+=r.length+1,32==n.length&&(t.push(new Lr(n,i)),n=[],i=-1);return i>-1&&t.push(new Lr(n,i)),t}}class Fr extends Nr{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,i){for(let r=0;;r++){let s=this.children[r],o=i+s.length,a=n+s.lines-1;if((t?a:o)>=e)return s.lineInner(e,t,n,i);i=o+1,n=a+1}}decompose(e,t,n,i){for(let r=0,s=0;s<=t&&r=s){let r=i&((s<=e?1:0)|(a>=t?2:0));s>=e&&a<=t&&!r?n.push(o):o.decompose(e-s,t-s,n,r)}s=a+1}}replace(e,t,n){if(n.lines=r&&t<=o){let a=s.replace(e-r,t-r,n),l=this.lines-s.lines+a.lines;if(a.lines>4&&a.lines>l>>6){let r=this.children.slice();return r[i]=a,new Fr(r,this.length-(t-e)+n.length)}return super.replace(r,o,a)}r=o+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){let i="";for(let r=0,s=0;re&&r&&(i+=n),es&&(i+=o.sliceString(e-s,t-s,n)),s=a+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Fr))return 0;let n=0,[i,r,s,o]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,r+=t){if(i==s||r==o)return n;let a=this.children[i],l=e.children[r];if(a!=l)return n+a.scanIdentical(l,t);n+=a.length+1}}static from(e,t=e.reduce(((e,t)=>e+t.length+1),-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let n=[];for(let t of e)t.flatten(n);return new Lr(n,t)}let i=Math.max(32,n>>5),r=i<<1,s=i>>1,o=[],a=0,l=-1,c=[];function h(e){let t;if(e.lines>r&&e instanceof Fr)for(let t of e.children)h(t);else e.lines>s&&(a>s||!a)?(u(),o.push(e)):e instanceof Lr&&a&&(t=c[c.length-1])instanceof Lr&&e.lines+t.lines<=32?(a+=e.lines,l+=e.length+1,c[c.length-1]=new Lr(t.text.concat(e.text),t.length+1+e.length)):(a+e.lines>i&&u(),a+=e.lines,l+=e.length+1,c.push(e))}function u(){0!=a&&(o.push(1==c.length?c[0]:Fr.from(c,l)),l=-1,a=c.length=0)}for(let t of e)h(t);return u(),1==o.length?o[0]:new Fr(o,t)}}function Hr(e,t,n=0,i=1e9){for(let r=0,s=0,o=!0;s=n&&(l>i&&(a=a.slice(0,i-r)),r0?1:(e instanceof Lr?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],s=r>>1,o=i instanceof Lr?i.text.length:i.children.length;if(s==(t>0?o:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(i instanceof Lr){let r=i.text[s+(t<0?-1:0)];if(this.offsets[n]+=t,r.length>Math.max(0,e))return this.value=0==e?r:t>0?r.slice(e):r.slice(0,r.length-e),this;e-=r.length}else{let r=i.children[s+(t<0?-1:0)];e>r.length?(e-=r.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(r),this.offsets.push(t>0?1:(r instanceof Lr?r.text.length:r.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class es{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Jr(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class ts{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);return t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(Nr.prototype[Symbol.iterator]=function(){return this.iter()},Jr.prototype[Symbol.iterator]=es.prototype[Symbol.iterator]=ts.prototype[Symbol.iterator]=function(){return this});class ns{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}let is="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((e=>e?parseInt(e,36):1));for(let e=1;ee)return is[t-1]<=e;return!1}function ss(e){return e>=127462&&e<=127487}function os(e,t,n=!0,i=!0){return(n?as:ls)(e,t,i)}function as(e,t,n){if(t==e.length)return t;t&&cs(e.charCodeAt(t))&&hs(e.charCodeAt(t-1))&&t--;let i=us(e,t);for(t+=fs(i);t=0&&ss(us(e,i));)n++,i-=2;if(n%2==0)break;t+=2}}}return t}function ls(e,t,n){for(;t>0;){let i=as(e,t-2,n);if(i=56320&&e<57344}function hs(e){return e>=55296&&e<56320}function us(e,t){let n=e.charCodeAt(t);if(!hs(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);return cs(i)?i-56320+(n-55296<<10)+65536:n}function ds(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function fs(e){return e<65536?1:2}const Os=/\r\n?|\n/;var ps=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(ps||(ps={}));class ms{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-i);r+=o}else{if(n!=ps.Simple&&l>=e&&(n==ps.TrackDel&&ie||n==ps.TrackBefore&&ie))return null;if(l>e||l==e&&t<0&&!o)return e==i||t<0?r:r+a;r+=a}i=l}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return r}touchesRange(e,t=e){for(let n=0,i=0;n=0&&i<=t&&r>=e)return!(it)||"cover";i=r}return!1}toString(){let e="";for(let t=0;t=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some((e=>"number"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ms(e)}static create(e){return new ms(e)}}class gs extends ms{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return xs(this,((t,n,i,r,s)=>e=e.replace(i,i+(n-t),s)),!1),e}mapDesc(e,t=!1){return vs(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,r=0;i=0){t[i]=o,t[i+1]=s;let a=i>>1;for(;n.length0&&ws(n,t,r.text),r.forward(e),o+=e}let l=e[s++];for(;o>1].toJSON()))}return e}static of(e,t,n){let i=[],r=[],s=0,o=null;function a(e=!1){if(!e&&!i.length)return;so||e<0||o>t)throw new RangeError(`Invalid change range ${e} to ${o} (in doc of length ${t})`);let h=c?"string"==typeof c?Nr.of(c.split(n||Os)):c:Nr.empty,u=h.length;if(e==o&&0==u)return;es&&bs(i,e-s,-1),bs(i,o-e,u),ws(r,i,h),s=o}}(e),a(!o),o}static empty(e){return new gs(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;it&&"string"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==r.length)t.push(r[0],0);else{for(;n.length=0&&n<=0&&n==e[r+1]?e[r]+=t:0==t&&0==e[r]?e[r+1]+=n:i?(e[r]+=t,e[r+1]+=n):e.push(t,n)}function ws(e,t,n){if(0==n.length)return;let i=t.length-2>>1;if(i>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)a=e.sections[o++],l=e.sections[o++];t(r,c,s,h,u),r=c,s=h}}}function vs(e,t,n,i=!1){let r=[],s=i?[]:null,o=new Ss(e),a=new Ss(t);for(let e=-1;;)if(-1==o.ins&&-1==a.ins){let e=Math.min(o.len,a.len);bs(r,e,-1),o.forward(e),a.forward(e)}else if(a.ins>=0&&(o.ins<0||e==o.i||0==o.off&&(a.len=0&&e=0)){if(o.done&&a.done)return s?gs.createSet(r,s):ms.create(r);throw new Error("Mismatched change set lengths")}{let t=0,n=o.len;for(;n;)if(-1==a.ins){let e=Math.min(n,a.len);t+=e,n-=e,a.forward(e)}else{if(!(0==a.ins&&a.lent||o.ins>=0&&o.len>t)&&(e||i.length>n),s.forward2(t),o.forward(t)}}else bs(i,0,o.ins,e),r&&ws(r,i,o.text),o.next()}}class Ss{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?Nr.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Nr.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class $s{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return 16&this.flags?this.to:this.from}get head(){return 16&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 4&this.flags?-1:8&this.flags?1:0}get bidiLevel(){let e=3&this.flags;return 3==e?null:e}get goalColumn(){let e=this.flags>>5;return 33554431==e?void 0:e}map(e,t=-1){let n,i;return this.empty?n=i=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new $s(n,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return Qs.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Qs.range(this.anchor,n)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return Qs.range(e.anchor,e.head)}static create(e,t,n){return new $s(e,t,n)}}class Qs{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:Qs.create(this.ranges.map((n=>n.map(e,t))),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let t=0;te.toJSON())),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Qs(e.ranges.map((e=>$s.fromJSON(e))),e.main)}static single(e,t=e){return new Qs([Qs.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw new RangeError("A selection needs at least one range");for(let n=0,i=0;ie?4:0))}static normalized(e,t=0){let n=e[t];e.sort(((e,t)=>e.from-t.from)),t=e.indexOf(n);for(let n=1;ni.head?Qs.range(o,s):Qs.range(s,o))}}return new Qs(e,t)}}function ks(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let Ps=0;class Ts{constructor(e,t,n,i,r){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=Ps++,this.default=e([]),this.extensions="function"==typeof r?r(this):r}static define(e={}){return new Ts(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:_s),!!e.static,e.enables)}of(e){return new Zs([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Zs(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Zs(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],(n=>t(n.field(e))))}}function _s(e,t){return e==t||e.length==t.length&&e.every(((e,n)=>e===t[n]))}class Zs{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=Ps++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,r=this.id,s=e[r]>>1,o=2==this.type,a=!1,l=!1,c=[];for(let n of this.dependencies)"doc"==n?a=!0:"selection"==n?l=!0:0==(1&(null!==(t=e[n.id])&&void 0!==t?t:1))&&c.push(e[n.id]);return{create:e=>(e.values[s]=n(e),1),update(e,t){if(a&&t.docChanged||l&&(t.docChanged||t.selection)||Xs(e,c)){let t=n(e);if(o?!Cs(t,e.values[s],i):!i(t,e.values[s]))return e.values[s]=t,1}return 0},reconfigure:(e,t)=>{let a,l=t.config.address[r];if(null!=l){let r=Bs(t,l);if(this.dependencies.every((n=>n instanceof Ts?t.facet(n)===e.facet(n):!(n instanceof qs)||t.field(n,!1)==e.field(n,!1)))||(o?Cs(a=n(e),r,i):i(a=n(e),r)))return e.values[s]=r,0}else a=n(e);return e.values[s]=a,1}}}}function Cs(e,t,n){if(e.length!=t.length)return!1;for(let i=0;ie[t.id])),r=n.map((e=>e.type)),s=i.filter((e=>!(1&e))),o=e[t.id]>>1;function a(e){let n=[];for(let t=0;te===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Rs).find((e=>e.field==this));return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let i=e.values[t],r=this.updateF(i,n);return this.compareF(i,r)?0:(e.values[t]=r,1)},reconfigure:(e,n)=>null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}init(e){return[this,Rs.of({field:this,create:e})]}get extension(){return this}}const As=4,Ws=3,Es=2,js=1;function zs(e){return t=>new Us(t,e)}const Ds={highest:zs(0),high:zs(js),default:zs(Es),low:zs(Ws),lowest:zs(As)};class Us{constructor(e,t){this.inner=e,this.prec=t}}class Vs{of(e){return new Is(this,e)}reconfigure(e){return Vs.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Is{constructor(e,t){this.compartment=e,this.inner=t}}class Ms{constructor(e,t,n,i,r,s){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=r,this.facets=s,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,n){let i=[],r=Object.create(null),s=new Map;for(let n of function(e,t,n){let i=[[],[],[],[],[]],r=new Map;function s(e,o){let a=r.get(e);if(null!=a){if(a<=o)return;let t=i[a].indexOf(e);t>-1&&i[a].splice(t,1),e instanceof Is&&n.delete(e.compartment)}if(r.set(e,o),Array.isArray(e))for(let t of e)s(t,o);else if(e instanceof Is){if(n.has(e.compartment))throw new RangeError("Duplicate use of compartment in extensions");let i=t.get(e.compartment)||e.inner;n.set(e.compartment,i),s(i,o)}else if(e instanceof Us)s(e.inner,e.prec);else if(e instanceof qs)i[o].push(e),e.provides&&s(e.provides,o);else if(e instanceof Zs)i[o].push(e),e.facet.extensions&&s(e.facet.extensions,Es);else{let t=e.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(t,o)}}return s(e,Es),i.reduce(((e,t)=>e.concat(t)))}(e,t,s))n instanceof qs?i.push(n):(r[n.facet.id]||(r[n.facet.id]=[])).push(n);let o=Object.create(null),a=[],l=[];for(let e of i)o[e.id]=l.length<<1,l.push((t=>e.slot(t)));let c=null==n?void 0:n.config.facets;for(let e in r){let t=r[e],i=t[0].facet,s=c&&c[e]||[];if(t.every((e=>0==e.type)))if(o[i.id]=a.length<<1|1,_s(s,t))a.push(n.facet(i));else{let e=i.combine(t.map((e=>e.value)));a.push(n&&i.compare(e,n.facet(i))?n.facet(i):e)}else{for(let e of t)0==e.type?(o[e.id]=a.length<<1|1,a.push(e.value)):(o[e.id]=l.length<<1,l.push((t=>e.dynamicSlot(t))));o[i.id]=l.length<<1,l.push((e=>Ys(e,i,t)))}}let h=l.map((e=>e(o)));return new Ms(e,s,h,o,a,r)}}function Gs(e,t){if(1&t)return 2;let n=t>>1,i=e.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;e.status[n]=4;let r=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|r}function Bs(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const Ns=Ts.define(),Ls=Ts.define({combine:e=>e.some((e=>e)),static:!0}),Fs=Ts.define({combine:e=>e.length?e[0]:void 0,static:!0}),Hs=Ts.define(),Ks=Ts.define(),Js=Ts.define(),eo=Ts.define({combine:e=>!!e.length&&e[0]});class to{constructor(e,t){this.type=e,this.value=t}static define(){return new no}}class no{of(e){return new to(this,e)}}class io{constructor(e){this.map=e}of(e){return new ro(this,e)}}class ro{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new ro(this.type,t)}is(e){return this.type==e}static define(e={}){return new io(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let e=i.map(t);e&&n.push(e)}return n}}ro.reconfigure=ro.define(),ro.appendConfig=ro.define();class so{constructor(e,t,n,i,r,s){this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=r,this.scrollIntoView=s,this._doc=null,this._state=null,n&&ks(n,t.newLength),r.some((e=>e.type==so.time))||(this.annotations=r.concat(so.time.of(Date.now())))}static create(e,t,n,i,r,s){return new so(e,t,n,i,r,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(so.userEvent);return!(!t||!(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function oo(e,t){let n=[];for(let i=0,r=0;;){let s,o;if(i=e[i]))s=e[i++],o=e[i++];else{if(!(r=0;r--){let s=n[r](e);s&&Object.keys(s).length&&(i=ao(i,lo(t,s,e.changes.newLength),!0))}return i==e?e:so.create(t,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(e){let t=e.startState,n=!0;for(let i of t.facet(Hs)){let t=i(e);if(!1===t){n=!1;break}Array.isArray(t)&&(n=!0===n?t:oo(n,t))}if(!0!==n){let i,r;if(!1===n)r=e.changes.invertedDesc,i=gs.empty(t.doc.length);else{let t=e.changes.filter(n);i=t.changes,r=t.filtered.mapDesc(t.changes).invertedDesc}e=so.create(t,i,e.selection&&e.selection.map(r),ro.mapEffects(e.effects,r),e.annotations,e.scrollIntoView)}let i=t.facet(Ks);for(let n=i.length-1;n>=0;n--){let r=i[n](e);e=r instanceof so?r:Array.isArray(r)&&1==r.length&&r[0]instanceof so?r[0]:co(t,uo(r),!1)}return e}(r):r)}so.time=to.define(),so.userEvent=to.define(),so.addToHistory=to.define(),so.remote=to.define();const ho=[];function uo(e){return null==e?ho:Array.isArray(e)?e:[e]}var fo=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(fo||(fo={}));const Oo=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let po;try{po=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}function mo(e){return t=>{if(!/\S/.test(t))return fo.Space;if(function(e){if(po)return po.test(e);for(let t=0;t"€"&&(n.toUpperCase()!=n.toLowerCase()||Oo.test(n)))return!0}return!1}(t))return fo.Word;for(let n=0;n-1)return fo.Word;return fo.Other}}class go{constructor(e,t,n,i,r,s){this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=r,s&&(s._state=this);for(let e=0;er.set(t,e))),n=null),r.set(t.value.compartment,t.value.extension)):t.is(ro.reconfigure)?(n=null,i=t.value):t.is(ro.appendConfig)&&(n=null,i=uo(i).concat(t.value));if(n)t=e.startState.values.slice();else{n=Ms.resolve(i,r,this),t=new go(n,this.doc,this.selection,n.dynamicSlots.map((()=>null)),((e,t)=>t.reconfigure(e,this)),null).values}new go(n,e.newDoc,e.newSelection,t,((t,n)=>n.update(t,e)),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange((t=>({changes:{from:t.from,to:t.to,insert:e},range:Qs.cursor(t.from+e.length)})))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),r=[n.range],s=uo(n.effects);for(let n=1;nr.spec.fromJSON(s,e))))}return go.create({doc:e.doc,selection:Qs.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=Ms.resolve(e.extensions||[],new Map),n=e.doc instanceof Nr?e.doc:Nr.of((e.doc||"").split(t.staticFacet(go.lineSeparator)||Os)),i=e.selection?e.selection instanceof Qs?e.selection:Qs.single(e.selection.anchor,e.selection.head):Qs.single(0);return ks(i,n.length),t.staticFacet(Ls)||(i=i.asSingle()),new go(t,n,i,t.dynamicSlots.map((()=>null)),((e,t)=>t.create(e)),null)}get tabSize(){return this.facet(go.tabSize)}get lineBreak(){return this.facet(go.lineSeparator)||"\n"}get readOnly(){return this.facet(eo)}phrase(e,...t){for(let t of this.facet(go.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,((e,n)=>{if("$"==n)return"$";let i=+(n||1);return!i||i>t.length?e:t[i-1]}))),e}languageDataAt(e,t,n=-1){let i=[];for(let r of this.facet(Ns))for(let s of r(this,t,n))Object.prototype.hasOwnProperty.call(s,e)&&i.push(s[e]);return i}charCategorizer(e){return mo(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),r=this.charCategorizer(e),s=e-n,o=e-n;for(;s>0;){let e=os(t,s,!1);if(r(t.slice(e,s))!=fo.Word)break;s=e}for(;oe.length?e[0]:4}),go.lineSeparator=Fs,go.readOnly=eo,go.phrases=Ts.define({compare(e,t){let n=Object.keys(e),i=Object.keys(t);return n.length==i.length&&n.every((n=>e[n]==t[n]))}}),go.languageData=Ns,go.changeFilter=Hs,go.transactionFilter=Ks,go.transactionExtender=Js,Vs.reconfigure=ro.define();class wo{eq(e){return this==e}range(e,t=e){return xo.create(e,t,this)}}wo.prototype.startSide=wo.prototype.endSide=0,wo.prototype.point=!1,wo.prototype.mapMode=ps.TrackDel;class xo{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new xo(e,t,n)}}function vo(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class yo{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,i=0){let r=n?this.to:this.from;for(let s=i,o=r.length;;){if(s==o)return s;let i=s+o>>1,a=r[i]-e||(n?this.value[i].endSide:this.value[i].startSide)-t;if(i==s)return a>=0?s:o;a>=0?o=i:s=i+1}}between(e,t,n,i){for(let r=this.findIndex(t,-1e9,!0),s=this.findIndex(n,1e9,!1,r);rc||l==c&&h.startSide>0&&h.endSide<=0)continue;(c-l||h.endSide-h.startSide)<0||(s<0&&(s=l),h.point&&(o=Math.max(o,c-l)),n.push(h),i.push(l-s),r.push(c-s))}return{mapped:n.length?new yo(i,r,n,o):null,pos:s}}}class So{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new So(e,t,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:i=0,filterTo:r=this.length}=e,s=e.filter;if(0==t.length&&!s)return this;if(n&&(t=t.slice().sort(vo)),this.isEmpty)return t.length?So.of(t):this;let o=new ko(this,null,-1).goto(0),a=0,l=[],c=new $o;for(;o.value||a=0){let e=t[a++];c.addInner(e.from,e.to,e.value)||l.push(e)}else 1==o.rangeIndex&&o.chunkIndexthis.chunkEnd(o.chunkIndex)||ro.to||r=r&&e<=r+s.length&&!1===s.between(r,e-r,t-r,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return Po.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Po.from(e).goto(t)}static compare(e,t,n,i,r=-1){let s=e.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=r)),o=t.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=r)),a=Qo(s,o,n),l=new _o(s,a,r),c=new _o(o,a,r);n.iterGaps(((e,t,n)=>Zo(l,e,c,t,n,i))),n.empty&&0==n.length&&Zo(l,0,c,0,0,i)}static eq(e,t,n=0,i){null==i&&(i=999999999);let r=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0)),s=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0));if(r.length!=s.length)return!1;if(!r.length)return!0;let o=Qo(r,s),a=new _o(r,o,0).goto(n),l=new _o(s,o,0).goto(n);for(;;){if(a.to!=l.to||!Co(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>i)return!0;a.next(),l.next()}}static spans(e,t,n,i,r=-1){let s=new _o(e,null,r).goto(t),o=t,a=s.openStart;for(;;){let e=Math.min(s.to,n);if(s.point){let n=s.activeForPoint(s.to),r=s.pointFromo&&(i.span(o,e,s.active,a),a=s.openEnd(e));if(s.to>n)return a+(s.point&&s.to>n?1:0);o=s.to,s.next()}}static of(e,t=!1){let n=new $o;for(let i of e instanceof xo?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n0)return e.slice().sort(vo);t=i}return e}(e):e)n.add(i.from,i.to,i.value);return n.finish()}}So.empty=new So([],[],null,-1),So.empty.nextLayer=So.empty;class $o{constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}finishChunk(e){this.chunks.push(new yo(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new $o)).add(e,t,n)}addInner(e,t,n){let i=e-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(So.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=So.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Qo(e,t,n){let i=new Map;for(let t of e)for(let e=0;e=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=n&&i.push(new ko(s,t,n,r));return 1==i.length?i[0]:new Po(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)To(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)To(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),To(this.heap,0)}}}function To(e,t){for(let n=e[t];;){let i=1+(t<<1);if(i>=e.length)break;let r=e[i];if(i+1=0&&(r=e[i+1],i++),n.compare(r)<0)break;e[i]=n,e[t]=r,t=i}}class _o{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Po.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Xo(this.active,e),Xo(this.activeTo,e),Xo(this.activeRank,e),this.minActive=Ro(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:r}=this.cursor;for(;t-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&Xo(n,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from=0&&n[t]=0&&!(this.activeRank[n]e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function Zo(e,t,n,i,r,s){e.goto(t),n.goto(i);let o=i+r,a=i,l=i-t;for(;;){let t=e.to+l-n.to||e.endSide-n.endSide,i=t<0?e.to+l:n.to,r=Math.min(i,o);if(e.point||n.point?e.point&&n.point&&(e.point==n.point||e.point.eq(n.point))&&Co(e.activeForPoint(e.to+l),n.activeForPoint(n.to))||s.comparePoint(a,r,e.point,n.point):r>a&&!Co(e.active,n.active)&&s.compareRange(a,r,e.active,n.active),i>o)break;a=i,t<=0&&e.next(),t>=0&&n.next()}}function Co(e,t){if(e.length!=t.length)return!1;for(let n=0;n=t;n--)e[n+1]=e[n];e[t]=n}function Ro(e,t){let n=-1,i=1e9;for(let r=0;r=t)return i;if(i==e.length)break;r+=9==e.charCodeAt(i)?n-r%n:1,i=os(e,i)}return!0===i?-1:e.length}const Wo="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),Eo="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),jo="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class zo{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function r(e,t,s,o){let a=[],l=/^@(\w+)\b/.exec(e[0]),c=l&&"keyframes"==l[1];if(l&&null==t)return s.push(e[0]+";");for(let n in t){let o=t[n];if(/&/.test(n))r(n.split(/,\s*/).map((t=>e.map((e=>t.replace(/&/,e))))).reduce(((e,t)=>e.concat(t))),o,s);else if(o&&"object"==typeof o){if(!l)throw new RangeError("The value of a property ("+n+") should be a primitive value.");r(i(n),o,a,c)}else null!=o&&a.push(n.replace(/_.*/,"").replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))+": "+o+";")}(a.length||c)&&s.push((!n||l||o?e:e.map(n)).join(", ")+" {"+a.join(" ")+"}")}for(let t in e)r(i(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=jo[Wo]||1;return jo[Wo]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let i=e[Eo],r=n&&n.nonce;i?r&&i.setNonce(r):i=new Uo(e,r),i.mount(Array.isArray(t)?t:[t])}}let Do=new Map;class Uo{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let t=Do.get(n);if(t)return e.adoptedStyleSheets=[t.sheet,...e.adoptedStyleSheets],e[Eo]=t;this.sheet=new i.CSSStyleSheet,e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets],Do.set(n,this)}else{this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);let i=e.head||e;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],e[Eo]=this}mount(e){let t=this.sheet,n=0,i=0;for(let r=0;r-1&&(this.modules.splice(o,1),i--,o=-1),-1==o){if(this.modules.splice(i++,0,s),t)for(let e=0;e",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Mo="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent);"undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent);for(var Go="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Bo="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),No=Go||Mo&&+Mo[1]<57,Lo=0;Lo<10;Lo++)Vo[48+Lo]=Vo[96+Lo]=String(Lo);for(Lo=1;Lo<=24;Lo++)Vo[Lo+111]="F"+Lo;for(Lo=65;Lo<=90;Lo++)Vo[Lo]=String.fromCharCode(Lo+32),Io[Lo]=String.fromCharCode(Lo);for(var Fo in Vo)Io.hasOwnProperty(Fo)||(Io[Fo]=Vo[Fo]);function Ho(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function Ko(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function Jo(e,t){if(!t.anchorNode)return!1;try{return Ko(e,t.anchorNode)}catch(e){return!1}}function ea(e){return 3==e.nodeType?ua(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function ta(e,t,n,i){return!!n&&(ia(e,t,n,i,-1)||ia(e,t,n,i,1))}function na(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function ia(e,t,n,i,r){for(;;){if(e==n&&t==i)return!0;if(t==(r<0?0:ra(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=na(e)+(r<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(r<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=r<0?ra(e):0}}}function ra(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function sa(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function oa(e){return{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}class aa{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?ra(t):0),n,Math.min(e.focusOffset,n?ra(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}let la,ca=null;function ha(e){if(e.setActive)return e.setActive();if(ca)return e.focus(ca);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==ca?{get preventScroll(){return ca={preventScroll:!0},!0}}:void 0),!ca){ca=!1;for(let e=0;eMath.max(1,e.scrollHeight-e.clientHeight-4)}class pa{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new pa(e.parentNode,na(e),t)}static after(e,t){return new pa(e.parentNode,na(e)+1,t)}}const ma=[];class ga{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let n of this.children){if(n==e)return t;t+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(2&this.flags){let n,i=this.dom,r=null;for(let s of this.children){if(7&s.flags){if(!s.dom&&(n=r?r.nextSibling:i.firstChild)){let e=ga.get(n);(!e||!e.parent&&e.canReuseDOM(s))&&s.reuseDOM(n)}s.sync(e,t),s.flags&=-8}if(n=r?r.nextSibling:i.firstChild,t&&!t.written&&t.node==i&&n!=s.dom&&(t.written=!0),s.dom.parentNode==i)for(;n&&n!=s.dom;)n=ba(n);else i.insertBefore(s.dom,n);r=s.dom}for(n=r?r.nextSibling:i.firstChild,n&&t&&t.node==i&&(t.written=!0);n;)n=ba(n)}else if(1&this.flags)for(let n of this.children)7&n.flags&&(n.sync(e,t),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let n;if(e==this.dom)n=this.dom.childNodes[t];else{let i=0==ra(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==this.dom)break;0==i&&t.firstChild!=t.lastChild&&(i=e==t.firstChild?-1:1),e=t}n=i<0?e:e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!ga.get(n);)n=n.nextSibling;if(!n)return this.length;for(let e=0,t=0;;e++){let i=this.children[e];if(i.dom==n)return t;t+=i.length+i.breakAfter}}domBoundsAround(e,t,n=0){let i=-1,r=-1,s=-1,o=-1;for(let a=0,l=n,c=n;at)return n.domBoundsAround(e,t,l);if(h>=e&&-1==i&&(i=a,r=l),l>t&&n.dom.parentNode==this.dom){s=a,o=c;break}c=h,l=h+n.breakAfter}return{from:r,to:o<0?n+this.length:o,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:s=0?this.children[s].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),1&t.flags)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,7&this.flags&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,n=ma){this.markDirty();for(let n=e;nthis.pos||e==this.pos&&(t>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function xa(e,t,n,i,r,s,o,a,l){let{children:c}=e,h=c.length?c[t]:null,u=s.length?s[s.length-1]:null,d=u?u.breakAfter:o;if(!(t==i&&h&&!o&&!d&&s.length<2&&h.merge(n,r,s.length?u:null,0==n,a,l))){if(i0&&(!o&&s.length&&h.merge(n,h.length,s[0],!1,a,0)?h.breakAfter=s.shift().breakAfter:(n2);var Ya={mac:Xa||/Mac/.test(ya.platform),windows:/Win/.test(ya.platform),linux:/Linux|X11/.test(ya.platform),ie:Pa,ie_version:Qa?Sa.documentMode||6:ka?+ka[1]:$a?+$a[1]:0,gecko:Ta,gecko_version:Ta?+(/Firefox\/(\d+)/.exec(ya.userAgent)||[0,0])[1]:0,chrome:!!_a,chrome_version:_a?+_a[1]:0,ios:Xa,android:/Android\b/.test(ya.userAgent),webkit:Za,safari:Ca,webkit_version:Za?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Sa.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class Ra extends ga{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){3==e.nodeType&&this.createDOM(e)}merge(e,t,n){return!(8&this.flags||n&&(!(n instanceof Ra)||this.length-(t-e)+n.length>256||8&n.flags))&&(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new Ra(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=8&this.flags,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new pa(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return function(e,t,n){let i=e.nodeValue.length;t>i&&(t=i);let r=t,s=t,o=0;0==t&&n<0||t==i&&n>=0?Ya.chrome||Ya.gecko||(t?(r--,o=1):s=0)?0:a.length-1];Ya.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(e=>e.width))||l);return o?sa(l,o<0):l||null}(this.dom,e,t)}}class qa extends ga{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let e of t)e.setParent(this)}setAttrs(e){if(fa(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!(8&(this.flags|e.flags))}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,n,i,r,s){return(!n||!(!(n instanceof qa&&n.mark.eq(this.mark))||e&&r<=0||te&&t.push(n=e&&(i=r),n=o,r++}let s=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new qa(this.mark,t,s)}domAtPos(e){return Ea(this,e)}coordsAt(e,t){return za(this,e,t)}}class Aa extends ga{static create(e,t,n){return new Aa(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=Aa.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){this.dom&&this.widget.updateDOM(this.dom,e)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.dom.contentEditable="false")}getSide(){return this.side}merge(e,t,n,i,r,s){return!(n&&(!(n instanceof Aa&&this.widget.compare(n.widget))||e>0&&r<=0||t0)?pa.before(this.dom):pa.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let i=this.dom.getClientRects(),r=null;if(!i.length)return null;let s=this.side?this.side<0:e>0;for(let t=s?i.length-1:0;r=i[t],!(e>0?0==t:t==i.length-1||r.top0?pa.before(this.dom):pa.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Nr.empty}get isHidden(){return!0}}function Ea(e,t){let n=e.dom,{children:i}=e,r=0;for(let e=0;re&&t0;e--){let t=i[e-1];if(t.dom.parentNode==n)return t.domAtPos(t.length)}for(let e=r;e0&&t instanceof qa&&r.length&&(i=r[r.length-1])instanceof qa&&i.mark.eq(t.mark)?ja(i,t.children[0],n-1):(r.push(t),t.setParent(e)),e.length+=t.length}function za(e,t,n){let i=null,r=-1,s=null,o=-1;!function e(t,a){for(let l=0,c=0;l=a&&(h.children.length?e(h,a-c):(!s||s.isHidden&&n>0)&&(u>a||c==u&&h.getSide()>0)?(s=h,o=a-c):(c-1?1:0)!=r.length-(n&&r.indexOf(n)>-1?1:0))return!1;for(let s of i)if(s!=n&&(-1==r.indexOf(s)||e[s]!==t[s]))return!1;return!0}function Ia(e,t,n){let i=!1;if(t)for(let r in t)n&&r in n||(i=!0,"style"==r?e.style.cssText="":e.removeAttribute(r));if(n)for(let r in n)t&&t[r]==n[r]||(i=!0,"style"==r?e.style.cssText=n[r]:e.setAttribute(r,n[r]));return i}function Ma(e){let t=Object.create(null);for(let n=0;n0&&0==this.children[n-1].length;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Va(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){ja(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=Da(t,this.attrs||{})),n&&(this.attrs=Da({class:n},this.attrs||{}))}domAtPos(e){return Ea(this,e)}reuseDOM(e){"DIV"==e.nodeName&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?4&this.flags&&(fa(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(Ia(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let i=this.dom.lastChild;for(;i&&ga.get(i)instanceof qa;)i=i.lastChild;if(!(i&&this.length&&("BR"==i.nodeName||0!=(null===(n=ga.get(i))||void 0===n?void 0:n.isEditable)||Ya.ios&&this.children.some((e=>e instanceof Ra))))){let e=document.createElement("BR");e.cmIgnore=!0,this.dom.appendChild(e)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let e,t=0;for(let n of this.children){if(!(n instanceof Ra)||/[^ -~]/.test(n.text))return null;let i=ea(n.dom);if(1!=i.length)return null;t+=i[0].width,e=i[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(e,t){let n=za(this,e,t);if(!this.children.length&&n&&this.parent){let{heightOracle:e}=this.parent.view.viewState,t=n.bottom-n.top;if(Math.abs(t-e.lineHeight)<2&&e.textHeight=t){if(r instanceof Ga)return r;if(s>t)break}i=s+r.breakAfter}return null}}class Ba extends ga{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,i,r,s){return!(n&&(!(n instanceof Ba&&this.widget.compare(n.widget))||e>0&&r<=0||t0)}}class Na{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}destroy(e){}}var La=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(La||(La={}));class Fa extends wo{constructor(e,t,n,i){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(e){return new Ha(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Ja(e,t,t,n,e.widget||null,!1)}static replace(e){let t,n,i=!!e.block;if(e.isBlockGap)t=-5e8,n=4e8;else{let{start:r,end:s}=el(e,i);t=(r?i?-3e8:-1:5e8)-1,n=1+(s?i?2e8:1:-6e8)}return new Ja(e,t,n,i,e.widget||null,!0)}static line(e){return new Ka(e)}static set(e,t=!1){return So.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}Fa.none=So.empty;class Ha extends Fa{constructor(e){let{start:t,end:n}=el(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,n;return this==e||e instanceof Ha&&this.tagName==e.tagName&&(this.class||(null===(t=this.attrs)||void 0===t?void 0:t.class))==(e.class||(null===(n=e.attrs)||void 0===n?void 0:n.class))&&Va(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Ha.prototype.point=!1;class Ka extends Fa{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Ka&&this.spec.class==e.spec.class&&Va(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Ka.prototype.mapMode=ps.TrackBefore,Ka.prototype.point=!0;class Ja extends Fa{constructor(e,t,n,i,r,s){super(t,n,r,e),this.block=i,this.isReplace=s,this.mapMode=i?t<=0?ps.TrackBefore:ps.TrackAfter:ps.TrackDel}get type(){return this.startSide!=this.endSide?La.WidgetRange:this.startSide<=0?La.WidgetBefore:La.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Ja&&(t=this.widget,n=e.widget,t==n||!!(t&&n&&t.compare(n)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide;var t,n}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function el(e,t=!1){let{inclusiveStart:n,inclusiveEnd:i}=e;return null==n&&(n=e.inclusive),null==i&&(i=e.inclusive),{start:null!=n?n:t,end:null!=i?i:t}}function tl(e,t,n,i=0){let r=n.length-1;r>=0&&n[r]+i>=e?n[r]=Math.max(n[r],t):n.push(e,t)}Ja.prototype.point=!0;class nl{constructor(e,t,n,i){this.doc=e,this.pos=t,this.end=n,this.disallowBlockEffectsFor=i,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof Ba&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Ga),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(il(new Wa(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||e&&this.content.length&&this.content[this.content.length-1]instanceof Ba||this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:i}=this.cursor.next(this.skip);if(this.skip=0,i)throw new Error("Ran out of text content when drawing inline views");if(n){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}this.text=t,this.textOff=0}let i=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(il(new Ra(this.text.slice(this.textOff,this.textOff+i)),t),n),this.atCursorPos=!0,this.textOff+=i,e-=i,n=0}}span(e,t,n,i){this.buildText(t-e,n,i),this.pos=t,this.openStart<0&&(this.openStart=i)}point(e,t,n,i,r,s){if(this.disallowBlockEffectsFor[s]&&n instanceof Ja){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=t-e;if(n instanceof Ja)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Ba(n.widget||new rl("div"),o,n));else{let s=Aa.create(n.widget||new rl("span"),o,o?0:n.startSide),a=this.atCursorPos&&!s.isEditable&&r<=i.length&&(e0),l=!s.isEditable&&(ei.length||n.startSide<=0),c=this.getLine();2!=this.pendingBuffer||a||s.isEditable||(this.pendingBuffer=0),this.flushBuffer(i),a&&(c.append(il(new Wa(1),i),r),r=i.length+Math.max(0,r-i.length)),c.append(il(s,i),r),this.atCursorPos=l,this.pendingBuffer=l?ei.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);o&&(this.textOff+o<=this.text.length?this.textOff+=o:(this.skip+=o-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=r)}static build(e,t,n,i,r){let s=new nl(e,t,n,r);return s.openEnd=So.spans(i,t,n,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function il(e,t){for(let n of t)e=new qa(n,[e],e.length);return e}class rl extends Na{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}const sl=Ts.define(),ol=Ts.define(),al=Ts.define(),ll=Ts.define(),cl=Ts.define(),hl=Ts.define(),ul=Ts.define(),dl=Ts.define({combine:e=>e.some((e=>e))}),fl=Ts.define({combine:e=>e.some((e=>e))});class Ol{constructor(e,t="nearest",n="nearest",i=5,r=5){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=r}map(e){return e.empty?this:new Ol(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin)}}const pl=ro.define({map:(e,t)=>e.map(t)});function ml(e,t,n){let i=e.facet(ll);i.length?i[0](t):window.onerror?window.onerror(String(t),n,void 0,void 0,t):n?console.error(n+":",t):console.error(t)}const gl=Ts.define({combine:e=>!e.length||e[0]});let bl=0;const wl=Ts.define();class xl{constructor(e,t,n,i,r){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=i,this.extension=r(this)}static define(e,t){const{eventHandlers:n,eventObservers:i,provide:r,decorations:s}=t||{};return new xl(bl++,e,n,i,(e=>{let t=[wl.of(e)];return s&&t.push($l.of((t=>{let n=t.plugin(e);return n?s(n):Fa.none}))),r&&t.push(r(e)),t}))}static fromClass(e,t){return xl.define((t=>new e(t)),t)}}class vl{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(ml(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){ml(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){ml(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const yl=Ts.define(),Sl=Ts.define(),$l=Ts.define(),Ql=Ts.define(),kl=Ts.define();function Pl(e,t,n){let i=e.state.facet(kl);if(!i.length)return i;let r=i.map((t=>t instanceof Function?t(e):t)),s=[];return So.spans(r,t,n,{point(){},span(e,t,n,i){let r=s;for(let s=n.length-1;s>=0;s--,i--){let o,a=n[s].spec.bidiIsolate;if(null!=a)if(i>0&&r.length&&(o=r[r.length-1]).to==e&&o.direction==a)o.to=t,r=o.inner;else{let n={from:e,to:t,direction:a,inner:[]};r.push(n),r=n.inner}}}}),s}const Tl=Ts.define();function _l(e){let t=0,n=0,i=0,r=0;for(let s of e.state.facet(Tl)){let o=s(e);o&&(null!=o.left&&(t=Math.max(t,o.left)),null!=o.right&&(n=Math.max(n,o.right)),null!=o.top&&(i=Math.max(i,o.top)),null!=o.bottom&&(r=Math.max(r,o.bottom)))}return{left:t,right:n,top:i,bottom:r}}const Zl=Ts.define();class Cl{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new Cl(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>n.toA)){if(i.toAc)break;r+=2}if(!a)return n;new Cl(a.fromA,a.toA,a.fromB,a.toB).addToSet(n),s=a.toA,o=a.toB}}}class Xl{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=gs.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let i=[];this.changes.iterChangedRanges(((e,t,n,r)=>i.push(new Cl(e,t,n,r)))),this.changedRanges=i}static create(e,t,n){return new Xl(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(10&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some((e=>e.selection))}get empty(){return 0==this.flags&&0==this.transactions.length}}var Yl=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(Yl||(Yl={}));const Rl=Yl.LTR,ql=Yl.RTL;function Al(e){let t=[];for(let n=0;n=t){if(o.level==n)return s;(r<0||(0!=i?i<0?o.fromt:e[r].level>o.level))&&(r=s)}}if(r<0)throw new RangeError("Index out of range");return r}}function Vl(e,t){if(e.length!=t.length)return!1;for(let n=0;nl&&o.push(new Ul(l,O.from,d)),Gl(e,O.direction==Rl!=!(d%2)?i+1:i,r,O.inner,O.from,O.to,o),l=O.to}f=O.to}else{if(f==n||(t?Il[f]!=a:Il[f]==a))break;f++}u?Ml(e,l,f,i+1,r,u,o):lt;){let n=!0,h=!1;if(!c||l>s[c-1].to){let e=Il[l-1];e!=a&&(n=!1,h=16==e)}let u=n||1!=a?null:[],d=n?i:i+1,f=l;e:for(;;)if(c&&f==s[c-1].to){if(h)break e;let O=s[--c];if(!n)for(let e=O.from,n=c;;){if(e==t)break e;if(!n||s[n-1].to!=e){if(Il[e-1]==a)break e;break}e=s[--n].from}if(u)u.push(O);else{O.to=0;e-=3)if(zl[e+1]==-n){let t=zl[e+2],n=2&t?r:4&t?1&t?s:r:0;n&&(Il[o]=Il[zl[e]]=n),a=e;break}}else{if(189==zl.length)break;zl[a++]=o,zl[a++]=t,zl[a++]=l}else if(2==(i=Il[o])||1==i){let e=i==r;l=e?0:1;for(let t=a-3;t>=0;t-=3){let n=zl[t+2];if(2&n)break;if(e)zl[t+2]|=2;else{if(4&n)break;zl[t+2]|=4}}}}}(e,r,s,i,a),function(e,t,n,i){for(let r=0,s=i;r<=n.length;r++){let o=r?n[r-1].to:e,a=rl;)t==s&&(t=n[--i].from,s=i?n[i-1].to:e),Il[--t]=h;l=o}else s=o,l++}}}(r,s,i,a),Ml(e,r,s,t,n,i,o)}function Bl(e){return[new Ul(0,e,0)]}let Nl="";function Ll(e,t,n,i,r){var s;let o=i.head-e.from,a=-1;if(0==o){if(!r||!e.length)return null;t[0].level!=n&&(o=t[0].side(!1,n),a=0)}else if(o==e.length){if(r)return null;let e=t[t.length-1];e.level!=n&&(o=e.side(!0,n),a=t.length-1)}a<0&&(a=Ul.find(t,o,null!==(s=i.bidiLevel)&&void 0!==s?s:-1,i.assoc));let l=t[a];o==l.side(r,n)&&(l=t[a+=r?1:-1],o=l.side(!r,n));let c=r==(l.dir==n),h=os(e.text,o,c);if(Nl=e.text.slice(Math.min(o,h),Math.max(o,h)),h!=l.side(r,n))return Qs.cursor(h+e.from,c?-1:1,l.level);let u=a==(r?t.length-1:0)?null:t[a+(r?1:-1)];return u||l.level==n?u&&u.level0&&n.length&&(n.every((({fromA:e,toA:t})=>tthis.minWidthTo))?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let i=-1;this.view.inputState.composing>=0&&((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?i=this.domChanged.newSel.head:function(e,t){let n=!1;t&&e.iterChangedRanges(((e,i)=>{et.from&&(n=!0)}));return n}(e.changes,this.hasComposition)||e.selectionSet||(i=e.state.selection.main.head));let r=i>-1?function(e,t,n){let i=Kl(e,n);if(!i)return null;let{node:r,from:s,to:o}=i,a=r.nodeValue;if(/[\n\r]/.test(a))return null;if(e.state.doc.sliceString(i.from,i.to)!=a)return null;let l=t.invertedDesc,c=new Cl(l.mapPos(s),l.mapPos(o),s,o),h=[];for(let t=r.parentNode;;t=t.parentNode){let n=ga.get(t);if(n instanceof qa)h.push({node:t,deco:n.mark});else{if(n instanceof Ga||"DIV"==t.nodeName&&t.parentNode==e.contentDOM)return{range:c,text:r,marks:h,line:t};if(t==e.contentDOM)return null;h.push({node:t,deco:new Ha({inclusive:!0,attributes:Ma(t),tagName:t.tagName.toLowerCase()})})}}}(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:t,to:i}=this.hasComposition;n=new Cl(t,i,e.changes.mapPos(t,-1),e.changes.mapPos(i,1)).addToSet(n.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Ya.ie||Ya.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let s=function(e,t,n){let i=new class{constructor(){this.changes=[]}compareRange(e,t){tl(e,t,this.changes)}comparePoint(e,t){tl(e,t,this.changes)}};return So.compare(e,t,n,i),i.changes}(this.decorations,this.updateDeco(),e.changes);return n=Cl.extendWithRanges(n,s),!!(7&this.flags||0!=n.length)&&(this.updateInner(n,e.startState.doc.length,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);let{observer:i}=this.view;i.ignore((()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let e=Ya.chrome||Ya.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,e),this.flags&=-8,e&&(e.written||i.selectionRange.focusNode!=e.node)&&(this.forceSelection=!0),this.dom.style.height=""})),this.markedForComposition.forEach((e=>e.flags&=-9));let r=[];if(this.view.viewport.from||this.view.viewport.to=0?i[e]:null;if(!t)break;let s,o,a,l,{fromA:c,toA:h,fromB:u,toB:d}=t;if(n&&n.range.fromBu){let e=nl.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),t=nl.build(this.view.state.doc,n.range.toB,d,this.decorations,this.dynamicDecorationMap);o=e.breakAtStart,a=e.openStart,l=t.openEnd;let i=this.compositionView(n);t.breakAtStart?i.breakAfter=1:t.content.length&&i.merge(i.length,i.length,t.content[0],!1,t.openStart,0)&&(i.breakAfter=t.content[0].breakAfter,t.content.shift()),e.content.length&&i.merge(0,0,e.content[e.content.length-1],!0,0,e.openEnd)&&e.content.pop(),s=e.content.concat(i).concat(t.content)}else({content:s,breakAtStart:o,openStart:a,openEnd:l}=nl.build(this.view.state.doc,u,d,this.decorations,this.dynamicDecorationMap));let{i:f,off:O}=r.findPos(h,1),{i:p,off:m}=r.findPos(c,-1);xa(this,p,m,f,O,s,o,a,l)}n&&this.fixCompositionDOM(n)}compositionView(e){let t=new Ra(e.text.nodeValue);t.flags|=8;for(let{deco:n}of e.marks)t=new qa(n,[t],t.length);let n=new Ga;return n.append(t,0),n}fixCompositionDOM(e){let t=(e,t)=>{t.flags|=8|(t.children.some((e=>7&e.flags))?1:0),this.markedForComposition.add(t);let n=ga.get(e);n&&n!=t&&(n.dom=null),t.setDOM(e)},n=this.childPos(e.range.fromB,1),i=this.children[n.i];t(e.line,i);for(let r=e.marks.length-1;r>=-1;r--)n=i.childPos(n.off,1),i=i.children[n.i],t(r>=0?e.marks[r].node:e.text,i)}updateSelection(e=!1,t=!1){!e&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let n=this.view.root.activeElement,i=n==this.dom,r=!i&&Jo(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(i||t||r))return;let s=this.forceSelection;this.forceSelection=!1;let o=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(o.anchor)),l=o.empty?a:this.moveToLine(this.domAtPos(o.head));if(Ya.gecko&&o.empty&&!this.hasComposition&&(1==(c=a).node.nodeType&&c.node.firstChild&&(0==c.offset||"false"==c.node.childNodes[c.offset-1].contentEditable)&&(c.offset==c.node.childNodes.length||"false"==c.node.childNodes[c.offset].contentEditable))){let e=document.createTextNode("");this.view.observer.ignore((()=>a.node.insertBefore(e,a.node.childNodes[a.offset]||null))),a=l=new pa(e,0),s=!0}var c;let h=this.view.observer.selectionRange;!s&&h.focusNode&&ta(a.node,a.offset,h.anchorNode,h.anchorOffset)&&ta(l.node,l.offset,h.focusNode,h.focusOffset)||(this.view.observer.ignore((()=>{Ya.android&&Ya.chrome&&this.dom.contains(h.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let e=Ho(this.view.root);if(e)if(o.empty){if(Ya.gecko){let e=(t=a.node,i=a.offset,1!=t.nodeType?0:(i&&"false"==t.childNodes[i-1].contentEditable?1:0)|(io.head&&([a,l]=[l,a]),t.setEnd(l.node,l.offset),t.setStart(a.node,a.offset),e.removeAllRanges(),e.addRange(t)}else;var t,i;r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new pa(h.anchorNode,h.anchorOffset),this.impreciseHead=l.precise?null:new pa(h.focusNode,h.focusOffset)}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=Ho(e.root),{anchorNode:i,anchorOffset:r}=e.observer.selectionRange;if(!(n&&t.empty&&t.assoc&&n.modify))return;let s=Ga.find(this,t.head);if(!s)return;let o=s.posAtStart;if(t.head==o||t.head==o+s.length)return;let a=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(!a||!l||a.bottom>l.top)return;let c=this.domAtPos(t.head+t.assoc);n.collapse(c.node,c.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&n.collapse(i,r)}moveToLine(e){let t,n=this.dom;if(e.node!=n)return e;for(let i=e.offset;!t&&i=0;i--){let e=ga.get(n.childNodes[i]);e instanceof Ga&&(t=e.domAtPos(e.length))}return t?new pa(t.node,t.offset,!0):e}nearest(e){for(let t=e;t;){let e=ga.get(t);if(e&&e.rootView==this)return e;t=t.parentNode}return null}posFromDOM(e,t){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t=0;s--){let o=this.children[s],a=r-o.breakAfter,l=a-o.length;if(ae||o.covers(1))&&(!n||o instanceof Ga&&!(n instanceof Ga&&t>=0))&&(n=o,i=l),r=l}return n?n.coordsAt(e-i,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),i=this.children[t];if(!(i instanceof Ga))return null;for(;i.children.length;){let{i:e,off:t}=i.childPos(n,1);for(;;e++){if(e==i.children.length)return null;if((i=i.children[e]).length)break}n=t}if(!(i instanceof Ra))return null;let r=os(i.text,n);if(r==n)return null;let s=ua(i.dom,n,r).getClientRects();for(let e=0;eMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,a=this.view.textDirection==Yl.LTR;for(let e=0,l=0;li)break;if(e>=n){let n=c.dom.getBoundingClientRect();if(t.push(n.height),s){let t=c.dom.lastChild,i=t?ea(t):[];if(i.length){let t=i[i.length-1],s=a?t.right-n.left:n.right-t.left;s>o&&(o=s,this.minWidth=r,this.minWidthFrom=e,this.minWidthTo=h)}}}e=h+c.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return"rtl"==getComputedStyle(this.children[t].dom).direction?Yl.RTL:Yl.LTR}measureTextSize(){for(let e of this.children)if(e instanceof Ga){let t=e.measureTextSize();if(t)return t}let e,t,n,i=document.createElement("div");return i.className="cm-line",i.style.width="99999px",i.style.position="absolute",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(i);let r=ea(i.firstChild)[0];e=i.getBoundingClientRect().height,t=r?r.width/27:7,n=r?r.height:e,i.remove()})),{lineHeight:e,charWidth:t,textHeight:n}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new wa(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,i=0;;i++){let r=i==t.viewports.length?null:t.viewports[i],s=r?r.from-1:this.length;if(s>n){let i=(t.lineBlockAt(s).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(Fa.replace({widget:new Hl(i),block:!0,inclusive:!0,isBlockGap:!0}).range(n,s))}if(!r)break;n=r.to+1}return Fa.set(e)}updateDeco(){let e=this.view.state.facet($l).map(((e,t)=>(this.dynamicDecorationMap[t]="function"==typeof e)?e(this.view):e));for(let t=e.length;tn.anchor?-1:1);if(!i)return;!n.empty&&(t=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,t.left),top:Math.min(i.top,t.top),right:Math.max(i.right,t.right),bottom:Math.max(i.bottom,t.bottom)});let r=_l(this.view),s={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom};!function(e,t,n,i,r,s,o,a){let l=e.ownerDocument,c=l.defaultView||window;for(let h=e,u=!1;h&&!u;)if(1==h.nodeType){let e,d=h==l.body,f=1,O=1;if(d)e=oa(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let t=h.getBoundingClientRect();f=t.width/h.offsetWidth,O=t.height/h.offsetHeight,e={left:t.left,right:t.left+h.clientWidth*f,top:t.top,bottom:t.top+h.clientHeight*O}}let p=0,m=0;if("nearest"==r)t.top0&&t.bottom>e.bottom+m&&(m=t.bottom-e.bottom+m+o)):t.bottom>e.bottom&&(m=t.bottom-e.bottom+o,n<0&&t.top-m0&&t.right>e.right+p&&(p=t.right-e.right+p+s)):t.right>e.right&&(p=t.right-e.right+s,n<0&&t.left0))break;n=n.childNodes[i-1],i=ra(n)}if(n>=0)for(let i=e,r=t;;){if(3==i.nodeType)return{node:i,offset:r};if(!(1==i.nodeType&&r=0))break;i=i.childNodes[r],r=0}return null}function ec(e,t){return t.left>e?t.left-e:Math.max(0,e-t.right)}function tc(e,t){return t.top>e?t.top-e:Math.max(0,e-t.bottom)}function nc(e,t){return e.topt.top+1}function ic(e,t){return te.bottom?{top:e.top,left:e.left,right:e.right,bottom:t}:e}function sc(e,t,n){let i,r,s,o,a,l,c,h,u=!1;for(let d=e.firstChild;d;d=d.nextSibling){let e=ea(d);for(let f=0;fm||o==m&&s>p){i=d,r=O,s=p,o=m;let a=m?n0?f0)}0==p?n>O.bottom&&(!c||c.bottomO.top)&&(l=d,h=O):c&&nc(c,O)?c=rc(c,O.bottom):h&&nc(h,O)&&(h=ic(h,O.top))}}if(c&&c.bottom>=n?(i=a,r=c):h&&h.top<=n&&(i=l,r=h),!i)return{node:e,offset:0};let d=Math.max(r.left,Math.min(r.right,t));return 3==i.nodeType?oc(i,d,n):u&&"false"!=i.contentEditable?sc(i,d,n):{node:e,offset:Array.prototype.indexOf.call(e.childNodes,i)+(t>=(r.left+r.right)/2?1:0)}}function oc(e,t,n){let i=e.nodeValue.length,r=-1,s=1e9,o=0;for(let a=0;an?c.top-n:n-c.bottom)-1;if(c.left-1<=t&&c.right+1>=t&&h=(c.left+c.right)/2,i=n;if(Ya.chrome||Ya.gecko){ua(e,a).getBoundingClientRect().left==c.right&&(i=!n)}if(h<=0)return{node:e,offset:a+(i?1:0)};r=a+(i?1:0),s=h}}}return{node:e,offset:r>-1?r:o>0?e.nodeValue.length:0}}function ac(e,t,n,i=-1){var r,s;let o,a=e.contentDOM.getBoundingClientRect(),l=a.top+e.viewState.paddingTop,{docHeight:c}=e.viewState,{x:h,y:u}=t,d=u-l;if(d<0)return 0;if(d>c)return e.state.doc.length;for(let t=e.viewState.heightOracle.textHeight/2,r=!1;o=e.elementAtHeight(d),o.type!=La.Text;)for(;d=i>0?o.bottom+t:o.top-t,!(d>=0&&d<=c);){if(r)return n?null:0;r=!0,i=-i}u=l+d;let f=o.from;if(fe.viewport.to)return e.viewport.to==e.state.doc.length?e.state.doc.length:n?null:lc(e,a,o,h,u);let O=e.dom.ownerDocument,p=e.root.elementFromPoint?e.root:O,m=p.elementFromPoint(h,u);m&&!e.contentDOM.contains(m)&&(m=null),m||(h=Math.max(a.left+1,Math.min(a.right-1,h)),m=p.elementFromPoint(h,u),m&&!e.contentDOM.contains(m)&&(m=null));let g,b=-1;if(m&&0!=(null===(r=e.docView.nearest(m))||void 0===r?void 0:r.isEditable))if(O.caretPositionFromPoint){let e=O.caretPositionFromPoint(h,u);e&&({offsetNode:g,offset:b}=e)}else if(O.caretRangeFromPoint){let t=O.caretRangeFromPoint(h,u);t&&(({startContainer:g,startOffset:b}=t),(!e.contentDOM.contains(g)||Ya.safari&&function(e,t,n){let i;if(3!=e.nodeType||t!=(i=e.nodeValue.length))return!1;for(let t=e.nextSibling;t;t=t.nextSibling)if(1!=t.nodeType||"BR"!=t.nodeName)return!1;return ua(e,i-1,i).getBoundingClientRect().left>n}(g,b,h)||Ya.chrome&&function(e,t,n){if(0!=t)return!1;for(let t=e;;){let e=t.parentNode;if(!e||1!=e.nodeType||e.firstChild!=t)return!1;if(e.classList.contains("cm-line"))break;t=e}let i=1==e.nodeType?e.getBoundingClientRect():ua(e,0,Math.max(e.nodeValue.length,1)).getBoundingClientRect();return n-i.left>5}(g,b,h))&&(g=void 0))}if(!g||!e.docView.dom.contains(g)){let t=Ga.find(e.docView,f);if(!t)return d>o.top+o.height/2?o.to:o.from;({node:g,offset:b}=sc(t.dom,h,u))}let w=e.docView.nearest(g);if(!w)return null;if(w.isWidget&&1==(null===(s=w.dom)||void 0===s?void 0:s.nodeType)){let e=w.dom.getBoundingClientRect();return t.y1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;s+=Math.floor((r-n.top-.5*(e.defaultLineHeight-t))/t)*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+Ao(o,s,e.state.tabSize)}function cc(e,t){let n=e.lineBlockAt(t);if(Array.isArray(n.type))for(let e of n.type)if(e.to>t||e.to==t&&(e.to==n.to||e.type==La.Text))return e;return n}function hc(e,t,n,i){let r=e.state.doc.lineAt(t.head),s=e.bidiSpans(r),o=e.textDirectionAt(r.from);for(let a=t,l=null;;){let t=Ll(r,s,o,a,n),c=Nl;if(!t){if(r.number==(n?e.state.doc.lines:1))return a;c="\n",r=e.state.doc.line(r.number+(n?1:-1)),s=e.bidiSpans(r),t=Qs.cursor(n?r.from:r.to)}if(l){if(!l(c))return a}else{if(!i)return t;l=i(c)}a=t}}function uc(e,t,n){for(;;){let i=0;for(let r of e)r.between(t-1,t+1,((e,r,s)=>{if(t>e&&tt(e))),n.from,t.head>n.from?-1:1);return i==n.from?n:Qs.cursor(i,inull)),Ya.gecko&&function(e){zc.has(e)||(zc.add(e),e.addEventListener("copy",(()=>{})),e.addEventListener("cut",(()=>{})))}(e.contentDOM.ownerDocument)}handleEvent(e){(function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n,i=t.target;i!=e.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(n=ga.get(i))&&n.ignoreEvent(t))return!1;return!0})(this.view,e)&&!this.ignoreDuringComposition(e)&&("keydown"==e.type&&this.keydown(e)||this.runHandlers(e.type,e))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=pc(e),n=this.handlers,i=this.view.contentDOM;for(let e in t)if("scroll"!=e){let r=!t[e].handlers.length,s=n[e];s&&r!=!s.handlers.length&&(i.removeEventListener(e,this.handleEvent),s=null),s||i.addEventListener(e,this.handleEvent,{passive:r})}for(let e in n)"scroll"==e||t[e]||i.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&Date.now()t.keyCode==e.keyCode)))&&!e.ctrlKey||gc.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(229!=e.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=t||e,setTimeout((()=>this.flushIOSKey()),250),!0)}flushIOSKey(){let e=this.pendingIOSKey;return!!e&&(this.pendingIOSKey=void 0,da(this.view.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(e){return!!/^key/.test(e.type)&&(this.composing>0||!!(Ya.safari&&!Ya.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.mouseSelection&&this.mouseSelection.update(e),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Oc(e,t){return(n,i)=>{try{return t.call(e,i,n)}catch(e){ml(n.state,e)}}}function pc(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec;if(e&&e.domEventHandlers)for(let i in e.domEventHandlers){let r=e.domEventHandlers[i];r&&n(i).handlers.push(Oc(t.value,r))}if(e&&e.domEventObservers)for(let i in e.domEventObservers){let r=e.domEventObservers[i];r&&n(i).observers.push(Oc(t.value,r))}}for(let e in vc)n(e).handlers.push(vc[e]);for(let e in yc)n(e).observers.push(yc[e]);return t}const mc=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],gc="dthko",bc=[16,17,18,20,91,92,224,225];function wc(e){return.7*Math.max(0,e)+8}class xc{constructor(e,t,n,i){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParent=function(e){let t=e.ownerDocument;for(let n=e.parentNode;n&&n!=t.body;)if(1==n.nodeType){if(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.assignedSlot||n.parentNode}else{if(11!=n.nodeType)break;n=n.host}return null}(e.contentDOM),this.atoms=e.state.facet(Ql).map((t=>t(e)));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(go.allowMultipleSelections)&&function(e,t){let n=e.state.facet(sl);return n.length?n[0](t):Ya.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!(!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let i=Ho(e.root);if(!i||0==i.rangeCount)return!0;let r=i.getRangeAt(0).getClientRects();for(let e=0;e=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)||1!=Rc(t))&&null}start(e){!1===this.dragging&&this.select(e)}move(e){var t,n,i;if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(n=this.startEvent,i=e,Math.max(Math.abs(n.clientX-i.clientX),Math.abs(n.clientY-i.clientY))<10))return;this.select(this.lastEvent=e);let r=0,s=0,o=(null===(t=this.scrollParent)||void 0===t?void 0:t.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},a=_l(this.view);e.clientX-a.left<=o.left+6?r=-wc(o.left-e.clientX):e.clientX+a.right>=o.right-6&&(r=wc(e.clientX-o.right)),e.clientY-a.top<=o.top+6?s=-wc(o.top-e.clientY):e.clientY+a.bottom>=o.bottom-6&&(s=wc(e.clientY-o.bottom)),this.setScrollSpeed(r,s)}up(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval((()=>this.scroll()),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),!1===this.dragging&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let n=0;nthis.select(this.lastEvent)),20)}}const vc=Object.create(null),yc=Object.create(null),Sc=Ya.ie&&Ya.ie_version<15||Ya.ios&&Ya.webkit_version<604;function $c(e,t){let n,{state:i}=e,r=1,s=i.toText(t),o=s.lines==i.selection.ranges.length;if(null!=Ac&&i.selection.ranges.every((e=>e.empty))&&Ac==s.toString()){let e=-1;n=i.changeByRange((n=>{let a=i.doc.lineAt(n.from);if(a.from==e)return{range:n};e=a.from;let l=i.toText((o?s.line(r++).text:t)+i.lineBreak);return{changes:{from:a.from,insert:l},range:Qs.cursor(n.from+l.length)}}))}else n=o?i.changeByRange((e=>{let t=s.line(r++);return{changes:{from:e.from,to:e.to,insert:t.text},range:Qs.cursor(e.from+t.length)}})):i.replaceSelection(s);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function Qc(e,t,n,i){if(1==i)return Qs.cursor(t,n);if(2==i)return function(e,t,n=1){let i=e.charCategorizer(t),r=e.doc.lineAt(t),s=t-r.from;if(0==r.length)return Qs.cursor(t);0==s?n=1:s==r.length&&(n=-1);let o=s,a=s;n<0?o=os(r.text,s,!1):a=os(r.text,s);let l=i(r.text.slice(o,a));for(;o>0;){let e=os(r.text,o,!1);if(i(r.text.slice(e,o))!=l)break;o=e}for(;a{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},vc.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&(e.inputState.lastEscPress=Date.now()),!1),yc.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},yc.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},vc.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of e.state.facet(al))if(n=i(e,t),n)break;if(n||0!=t.button||(n=function(e,t){let n=_c(e,t),i=Rc(t),r=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),r=r.map(e.changes))},get(t,s,o){let a,l=_c(e,t),c=Qc(e,l.pos,l.bias,i);if(n.pos!=l.pos&&!s){let t=Qc(e,n.pos,n.bias,i),r=Math.min(t.from,c.from),s=Math.max(t.to,c.to);c=r1&&(a=function(e,t){for(let n=0;n=t)return Qs.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}(r,l.pos))?a:o?r.addRange(c):Qs.create([c])}}}(e,t)),n){let i=!e.hasFocus;e.inputState.startMouseSelection(new xc(e,t,n,i)),i&&e.observer.ignore((()=>ha(e.contentDOM)));let r=e.inputState.mouseSelection;if(r)return r.start(t),!1===r.dragging}return!1};let kc=(e,t)=>e>=t.top&&e<=t.bottom,Pc=(e,t,n)=>kc(t,n)&&e>=n.left&&e<=n.right;function Tc(e,t,n,i){let r=Ga.find(e.docView,t);if(!r)return 1;let s=t-r.posAtStart;if(0==s)return 1;if(s==r.length)return-1;let o=r.coordsAt(s,-1);if(o&&Pc(n,i,o))return-1;let a=r.coordsAt(s,1);return a&&Pc(n,i,a)?1:o&&kc(i,o)?-1:1}function _c(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:n,bias:Tc(e,n,t.clientX,t.clientY)}}const Zc=Ya.ie&&Ya.ie_version<=11;let Cc=null,Xc=0,Yc=0;function Rc(e){if(!Zc)return e.detail;let t=Cc,n=Yc;return Cc=e,Yc=Date.now(),Xc=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(Xc+1)%3:1}function qc(e,t,n,i){if(!n)return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{mouseSelection:s}=e.inputState,o=i&&s&&s.dragging&&function(e,t){let n=e.state.facet(ol);return n.length?n[0](t):Ya.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:s.dragging.from,to:s.dragging.to}:null,a={from:r,insert:n},l=e.state.changes(o?[o,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"})}vc.dragstart=(e,t)=>{let{selection:{main:n}}=e.state,{mouseSelection:i}=e.inputState;return i&&(i.dragging=n),t.dataTransfer&&(t.dataTransfer.setData("Text",e.state.sliceDoc(n.from,n.to)),t.dataTransfer.effectAllowed="copyMove"),!1},vc.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let i=Array(n.length),r=0,s=()=>{++r==n.length&&qc(e,t,i.filter((e=>null!=e)).join(e.state.lineBreak),!1)};for(let e=0;e{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(i[e]=t.result),s()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return qc(e,t,n,!0),!0}return!1},vc.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=Sc?null:t.clipboardData;return n?($c(e,n.getData("text/plain")||n.getData("text/uri-text")),!0):(function(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout((()=>{e.focus(),n.remove(),$c(e,n.value)}),50)}(e),!1)};let Ac=null;vc.copy=vc.cut=(e,t)=>{let{text:n,ranges:i,linewise:r}=function(e){let t=[],n=[],i=!1;for(let i of e.selection.ranges)i.empty||(t.push(e.sliceDoc(i.from,i.to)),n.push(i));if(!t.length){let r=-1;for(let{from:i}of e.selection.ranges){let s=e.doc.lineAt(i);s.number>r&&(t.push(s.text),n.push({from:s.from,to:Math.min(e.doc.length,s.to+1)})),r=s.number}i=!0}return{text:t.join(e.lineBreak),ranges:n,linewise:i}}(e.state);if(!n&&!r)return!1;Ac=r?n:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=Sc?null:t.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(function(e,t){let n=e.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout((()=>{i.remove(),e.focus()}),50)}(e,n),!1)};const Wc=to.define();function Ec(e,t){let n=[];for(let i of e.facet(ul)){let r=i(e,t);r&&n.push(r)}return n?e.update({effects:n,annotations:Wc.of(!0)}):null}function jc(e){setTimeout((()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Ec(e.state,t);n?e.dispatch(n):e.update([])}}),10)}yc.focus=e=>{e.inputState.lastFocusTime=Date.now(),e.scrollDOM.scrollTop||!e.inputState.lastScrollTop&&!e.inputState.lastScrollLeft||(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),jc(e)},yc.blur=e=>{e.observer.clearSelectionRange(),jc(e)},yc.compositionstart=yc.compositionupdate=e=>{null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0)},yc.compositionend=e=>{e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,Ya.chrome&&Ya.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then((()=>e.observer.flush())):setTimeout((()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])}),50)},yc.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},vc.beforeinput=(e,t)=>{var n;let i;if(Ya.chrome&&Ya.android&&(i=mc.find((e=>e.inputType==t.inputType)))&&(e.observer.delayAndroidKey(i.key,i.keyCode),"Backspace"==i.key||"Delete"==i.key)){let t=(null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0;setTimeout((()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())}),100)}return!1};const zc=new Set;const Dc=["pre-wrap","normal","pre-line","break-spaces"];class Uc{constructor(e){this.lineWrapping=e,this.doc=Nr.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Dc.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=n,this.textHeight=i,this.lineLength=r,a){this.heightSamples={};for(let e=0;e0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e,t){this.height!=t&&(Math.abs(this.height-t)>Gc&&(e.heightChanged=!0),this.height=t)}replace(e,t,n){return Bc.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,i){let r=this,s=n.doc;for(let o=i.length-1;o>=0;o--){let{fromA:a,toA:l,fromB:c,toB:h}=i[o],u=r.lineAt(a,Mc.ByPosNoHeight,n.setDoc(t),0,0),d=u.to>=l?u:r.lineAt(l,Mc.ByPosNoHeight,n,0,0);for(h+=d.to-l,l=d.to;o>0&&u.from<=i[o-1].toA;)a=i[o-1].fromA,c=i[o-1].fromB,o--,a2*r){let r=e[t-1];r.break?e.splice(--t,1,r.left,null,r.right):e.splice(--t,1,r.left,r.right),n+=1+r.break,i-=r.size}else{if(!(r>2*i))break;{let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,r-=t.size}}else if(i=r&&s(this.blockAt(0,n,i,r))}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more&&this.setHeight(e,i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Lc extends Nc{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,i){return new Ic(i,this.length,n,this.height,this.breaks)}replace(e,t,n){let i=n[0];return 1==n.length&&(i instanceof Lc||i instanceof Fc&&4&i.flags)&&Math.abs(this.length-i.length)<10?(i instanceof Fc?i=new Lc(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):Bc.of(n)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more?this.setHeight(e,i.heights[i.index++]):(n||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Fc extends Bc{constructor(e){super(e,0)}heightMetrics(e,t){let n,i=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,s=r-i+1,o=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*s);n=t/s,this.length>s+1&&(o=(this.height-t)/(this.length-s-1))}else n=this.height/s;return{firstLine:i,lastLine:r,perLine:n,perChar:o}}blockAt(e,t,n,i){let{firstLine:r,lastLine:s,perLine:o,perChar:a}=this.heightMetrics(t,i);if(t.lineWrapping){let r=i+Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length),s=t.doc.lineAt(r),l=o+s.length*a,c=Math.max(n,e-l/2);return new Ic(s.from,s.length,c,l,0)}{let i=Math.max(0,Math.min(s-r,Math.floor((e-n)/o))),{from:a,length:l}=t.doc.line(r+i);return new Ic(a,l,n+o*i,o,0)}}lineAt(e,t,n,i,r){if(t==Mc.ByHeight)return this.blockAt(e,n,i,r);if(t==Mc.ByPosNoHeight){let{from:t,to:i}=n.doc.lineAt(e);return new Ic(t,i-t,0,0,0)}let{firstLine:s,perLine:o,perChar:a}=this.heightMetrics(n,r),l=n.doc.lineAt(e),c=o+l.length*a,h=l.number-s,u=i+o*h+a*(l.from-r-h);return new Ic(l.from,l.length,Math.max(i,Math.min(u,i+this.height-c)),c,0)}forEachLine(e,t,n,i,r,s){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(n,r);for(let c=e,h=i;c<=t;){let t=n.doc.lineAt(c);if(c==e){let n=t.number-o;h+=a*n+l*(e-r-n)}let i=a+l*t.length;s(new Ic(t.from,t.length,h,i,0)),h+=i,c=t.to+1}}replace(e,t,n){let i=this.length-t;if(i>0){let e=n[n.length-1];e instanceof Fc?n[n.length-1]=new Fc(e.length+i):n.push(null,new Fc(i-1))}if(e>0){let t=n[0];t instanceof Fc?n[0]=new Fc(e+t.length):n.unshift(new Fc(e-1),null)}return Bc.of(n)}decomposeLeft(e,t){t.push(new Fc(e-1),null)}decomposeRight(e,t){t.push(null,new Fc(this.length-e-1))}updateHeight(e,t=0,n=!1,i){let r=t+this.length;if(i&&i.from<=t+this.length&&i.more){let n=[],s=Math.max(t,i.from),o=-1;for(i.from>t&&n.push(new Fc(i.from-t-1).updateHeight(e,t));s<=r&&i.more;){let t=e.doc.lineAt(s).length;n.length&&n.push(null);let r=i.heights[i.index++];-1==o?o=r:Math.abs(r-o)>=Gc&&(o=-2);let a=new Lc(t,r);a.outdated=!1,n.push(a),s+=t+1}s<=r&&n.push(null,new Fc(r-s).updateHeight(e,s));let a=Bc.of(n);return(o<0||Math.abs(a.height-this.height)>=Gc||Math.abs(o-this.heightMetrics(e,t).perLine)>=Gc)&&(e.heightChanged=!0),a}return(n||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Hc extends Bc{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return 1&this.flags}blockAt(e,t,n,i){let r=n+this.left.height;return eo))return l;let c=t==Mc.ByPosNoHeight?Mc.ByPosNoHeight:Mc.ByPos;return a?l.join(this.right.lineAt(o,c,n,s,o)):this.left.lineAt(o,c,n,i,r).join(l)}forEachLine(e,t,n,i,r,s){let o=i+this.left.height,a=r+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,n,o,a,s);else{let l=this.lineAt(a,Mc.ByPos,n,i,r);e=e&&l.from<=t&&s(l),t>l.to&&this.right.forEachLine(l.to+1,t,n,o,a,s)}}replace(e,t,n){let i=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,n));let r=[];e>0&&this.decomposeLeft(e,r);let s=r.length;for(let e of n)r.push(e);if(e>0&&Kc(r,s-1),t=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e2*t.size||t.size>2*e.size?Bc.of(this.break?[e,null,t]:[e,t]):(this.left=e,this.right=t,this.height=e.height+t.height,this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,i){let{left:r,right:s}=this,o=t+r.length+this.break,a=null;return i&&i.from<=t+r.length&&i.more?a=r=r.updateHeight(e,t,n,i):r.updateHeight(e,t,n),i&&i.from<=o+s.length&&i.more?a=s=s.updateHeight(e,o,n,i):s.updateHeight(e,o,n),a?this.balanced(r,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Kc(e,t){let n,i;null==e[t]&&(n=e[t-1])instanceof Fc&&(i=e[t+1])instanceof Fc&&e.splice(t-1,3,new Fc(n.length+1+i.length))}class Jc{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Lc?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new Lc(e-this.pos,-1)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e=5)&&this.addLineDeco(i,r,s)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new Lc(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new Fc(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Lc)return e;let t=new Lc(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof Lc||this.isCovered?(this.writtenTon.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=i.overflow){let i=n.getBoundingClientRect();s=Math.max(s,i.left),o=Math.min(o,i.right),a=Math.max(a,i.top),l=t==e.parentNode?i.bottom:Math.min(l,i.bottom)}t="absolute"==i.position||"fixed"==i.position?n.offsetParent:n.parentNode}else{if(11!=t.nodeType)break;t=t.host}return{left:s-n.left,right:Math.max(s,o)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}}function nh(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class ih{constructor(e,t,n){this.from=e,this.to=t,this.size=n}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n"function"!=typeof e&&"cm-lineWrapping"==e.class));this.heightOracle=new Uc(t),this.stateDeco=e.facet($l).filter((e=>"function"!=typeof e)),this.heightMap=Bc.empty().applyChanges(this.stateDeco,Nr.empty,this.heightOracle.setDoc(e.doc),[new Cl(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Fa.set(this.lineGaps.map((e=>e.draw(this,!1)))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let i=n?t.head:t.anchor;if(!e.some((({from:e,to:t})=>i>=e&&i<=t))){let{from:t,to:n}=this.lineBlockAt(i);e.push(new oh(t,n))}}this.viewports=e.sort(((e,t)=>e.from-t.from)),this.scaler=this.heightMap.height<=7e6?hh:new uh(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(e=>{this.viewportLines.push(1==this.scaler.scale?e:dh(e,this.scaler))}))}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet($l).filter((e=>"function"!=typeof e));let i=e.changedRanges,r=Cl.extendWithRanges(i,function(e,t,n){let i=new eh;return So.compare(e,t,n,i,0),i.changes}(n,this.stateDeco,e?e.changes:gs.empty(this.state.doc.length))),s=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=s&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let l=!e.changes.empty||2&e.flags||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,this.updateForViewport(),l&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(fl)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),i=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Yl.RTL:Yl.LTR;let s=this.heightOracle.mustRefreshForWrapping(r),o=t.getBoundingClientRect(),a=s||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let l=0,c=0;if(o.width&&o.height){let e=o.width/t.offsetWidth,n=o.height/t.offsetHeight;(e>.995&&e<1.005||!isFinite(e)||Math.abs(o.width-t.offsetWidth)<1)&&(e=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(o.height-t.offsetHeight)<1)&&(n=1),this.scaleX==e&&this.scaleY==n||(this.scaleX=e,this.scaleY=n,l|=8,s=a=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,u=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==h&&this.paddingBottom==u||(this.paddingTop=h,this.paddingBottom=u,l|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,l|=8);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Oa(e.scrollDOM);let f=(this.printing?nh:th)(t,this.paddingTop),O=f.top-this.pixelViewport.top,p=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let m=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(m!=this.inView&&(this.inView=m,m&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let g=o.width;if(this.contentDOMWidth==g&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,l|=8),a){let t=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(t)&&(s=!0),s||i.lineWrapping&&Math.abs(g-this.contentDOMWidth)>i.charWidth){let{lineHeight:n,charWidth:o,textHeight:a}=e.docView.measureTextSize();s=n>0&&i.refresh(r,n,o,a,g/o,t),s&&(e.docView.minWidth=0,l|=8)}O>0&&p>0?c=Math.max(O,p):O<0&&p<0&&(c=Math.min(O,p)),i.heightChanged=!1;for(let n of this.viewports){let r=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(s?Bc.empty().applyChanges(this.stateDeco,Nr.empty,this.heightOracle,[new Cl(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,s,new Vc(n.from,r))}i.heightChanged&&(l|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&l||b)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,e)),l|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),l}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,r=this.heightOracle,{visibleTop:s,visibleBottom:o}=this,a=new oh(i.lineAt(s-1e3*n,Mc.ByHeight,r,0,0).from,i.lineAt(o+1e3*(1-n),Mc.ByHeight,r,0,0).to);if(t){let{head:e}=t.range;if(ea.to){let n,s=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=i.lineAt(e,Mc.ByPos,r,0,0);n="center"==t.y?(o.top+o.bottom)/2-s/2:"start"==t.y||"nearest"==t.y&&e=o+Math.max(10,Math.min(n,250)))&&i>s-2e3&&r>1,s=i<<1;if(this.defaultTextDirection!=Yl.LTR&&!n)return[];let o=[],a=(i,s,l,c)=>{if(s-ii&&ee.from>=l.from&&e.to<=l.to&&Math.abs(e.from-i)e.fromt))));if(!d){if(se.from<=s&&e.to>=s))){let e=t.moveToLineBoundary(Qs.cursor(s),!1,!0).head;e>i&&(s=e)}d=new ih(i,s,this.gapSize(l,i,s,c))}o.push(d)};for(let e of this.viewportLines){if(e.lengthe.from&&a(e.from,r,e,t),oe.draw(this,this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];So.spans(e,this.viewport.from,this.viewport.to,{span(e,n){t.push({from:e,to:n})},point(){}},20);let n=t.length!=this.visibleRanges.length||this.visibleRanges.some(((e,n)=>e.from!=t[n].from||e.to!=t[n].to));return this.visibleRanges=t,n?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find((t=>t.from<=e&&t.to>=e))||dh(this.heightMap.lineAt(e,Mc.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return dh(this.heightMap.lineAt(this.scaler.fromDOM(e),Mc.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return dh(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class oh{constructor(e,t){this.from=e,this.to=t}}function ah(e,t,n){let i=[],r=e,s=0;return So.spans(n,e,t,{span(){},point(e,t){e>r&&(i.push({from:r,to:e}),s+=e-r),r=t}},20),r=1)return t[t.length-1].to;let i=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:r}=t[e],s=r-n;if(i<=s)return n+i;i-=s}}function ch(e,t){let n=0;for(let{from:i,to:r}of e.ranges){if(t<=r){n+=t-i;break}n+=r-i}return n/e.total}const hh={toDOM:e=>e,fromDOM:e=>e,scale:1};class uh{constructor(e,t,n){let i=0,r=0,s=0;this.viewports=n.map((({from:n,to:r})=>{let s=t.lineAt(n,Mc.ByPos,e,0,0).top,o=t.lineAt(r,Mc.ByPos,e,0,0).bottom;return i+=o-s,{from:n,to:r,top:s,bottom:o,domTop:0,domBottom:0}})),this.scale=(7e6-i)/(t.height-i);for(let e of this.viewports)e.domTop=s+(e.top-r)*this.scale,s=e.domBottom=e.domTop+(e.bottom-e.top),r=e.bottom}toDOM(e){for(let t=0,n=0,i=0;;t++){let r=tdh(e,t))):e._content)}const fh=Ts.define({combine:e=>e.join(" ")}),Oh=Ts.define({combine:e=>e.indexOf(!0)>-1}),ph=zo.newName(),mh=zo.newName(),gh=zo.newName(),bh={"&light":"."+mh,"&dark":"."+gh};function wh(e,t,n){return new zo(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,(t=>{if("&"==t)return e;if(!n||!n[t])throw new RangeError(`Unsupported selector: ${t}`);return n[t]})):e+" "+t})}const xh=wh("."+ph,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},bh),vh="￿";class yh{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(go.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=vh}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let i=e;;){this.findPointBefore(n,i);let e=this.text.length;this.readNode(i);let r=i.nextSibling;if(r==t)break;let s=ga.get(i),o=ga.get(r);(s&&o?s.breakAfter:(s?s.breakAfter:$h(i))||$h(r)&&("BR"!=i.nodeName||i.cmIgnore)&&this.text.length>e)&&this.lineBreak(),i=r}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let r,s=-1,o=1;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(r=i.exec(t))&&(s=r.index,o=r[0].length),this.append(t.slice(n,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=o-1);n=s+o}}readNode(e){if(e.cmIgnore)return;let t=ga.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(3==e.nodeType?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Sh(e,n.node,n.offset)?t:0))}}function Sh(e,t,n){for(;;){if(!t||n-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let t=r||s?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}=e.observer.selectionRange;n&&(t.push(new Qh(n,i)),r==n&&s==i||t.push(new Qh(r,s)));return t}(e),n=new yh(t,e.state);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(e,t){if(0==e.length)return null;let n=e[0].pos,i=2==e.length?e[1].pos:n;return n>-1&&i>-1?Qs.single(n+t,i+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=r&&r.node==t.focusNode&&r.offset==t.focusOffset||!Ko(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),i=s&&s.node==t.anchorNode&&s.offset==t.anchorOffset||!Ko(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset);this.newSel=Qs.single(i,n)}}}function Ph(e,t){let n,{newSel:i}=t,r=e.state.selection.main,s=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:i,to:o}=t.bounds,a=r.from,l=null;(8===s||Ya.android&&t.text.length0&&a>0&&e.charCodeAt(o-1)==t.charCodeAt(a-1);)o--,a--;if("end"==i){n-=o+Math.max(0,s-Math.min(o,a))-s}if(o=o?s-n:0,a=s+(a-o),o=s}else if(a=a?s-n:0,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}(e.state.doc.sliceString(i,o,vh),t.text,a-i,l);c&&(Ya.chrome&&13==s&&c.toB==c.from+2&&"￿￿"==t.text.slice(c.from,c.toB)&&c.toB--,n={from:i+c.from,to:i+c.toA,insert:Nr.of(t.text.slice(c.from,c.toB).split(vh))})}else i&&(!e.hasFocus&&e.state.facet(gl)||i.main.eq(r))&&(i=null);if(!n&&!i)return!1;if(!n&&t.typeOver&&!r.empty&&i&&i.main.empty?n={from:r.from,to:r.to,insert:e.state.doc.slice(r.from,r.to)}:n&&n.from>=r.from&&n.to<=r.to&&(n.from!=r.from||n.to!=r.to)&&r.to-r.from-(n.to-n.from)<=4?n={from:r.from,to:r.to,insert:e.state.doc.slice(r.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,r.to))}:(Ya.mac||Ya.android)&&n&&n.from==n.to&&n.from==r.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(i&&2==n.insert.length&&(i=Qs.single(i.main.anchor-1,i.main.head-1)),n={from:r.from,to:r.to,insert:Nr.of([" "])}):Ya.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(i&&(i=Qs.single(i.main.anchor-1,i.main.head-1)),n={from:r.from,to:r.to,insert:Nr.of([" "])}),n){if(Ya.ios&&e.inputState.flushIOSKey())return!0;if(Ya.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&da(e.contentDOM,"Enter",13)||(n.from==r.from-1&&n.to==r.to&&0==n.insert.length||8==s&&n.insert.lengthr.head)&&da(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&da(e.contentDOM,"Delete",46)))return!0;let t,o=n.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a=()=>t||(t=function(e,t,n){let i,r=e.state,s=r.selection.main;if(t.from>=s.from&&t.to<=s.to&&t.to-t.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=s.fromt.to?r.sliceDoc(t.to,s.to):"";i=r.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=r.changes(t),a=n&&n.main.to<=o.newLength?n.main:void 0;if(r.selection.ranges.length>1&&e.inputState.composing>=0&&t.to<=s.to&&t.to>=s.to-10){let l,c=e.state.sliceDoc(t.from,t.to),h=n&&Kl(e,n.main.head);if(h){let e=t.insert.length-(t.to-t.from);l={from:h.from,to:h.to-e}}else l=e.state.doc.lineAt(s.head);let u=s.to-t.to,d=s.to-s.from;i=r.changeByRange((n=>{if(n.from==s.from&&n.to==s.to)return{changes:o,range:a||n.map(o)};let i=n.to-u,h=i-c.length;if(n.to-n.from!=d||e.state.sliceDoc(h,i)!=c||n.to>=l.from&&n.from<=l.to)return{range:n};let f=r.changes({from:h,to:i,insert:t.insert}),O=n.to-s.to;return{changes:f,range:a?Qs.range(Math.max(0,a.anchor+O),Math.max(0,a.head+O)):n.map(f)}}))}else i={changes:o,selection:a&&r.selection.replaceRange(a)}}let o="input.type";(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,o+=".compose",e.inputState.compositionFirstChange&&(o+=".start",e.inputState.compositionFirstChange=!1));return r.update(i,{userEvent:o,scrollIntoView:!0})}(e,n,i));return e.state.facet(hl).some((t=>t(e,n.from,n.to,o,a)))||e.dispatch(a()),!0}if(i&&!i.main.eq(r)){let t=!1,n="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),n=e.inputState.lastSelectionOrigin),e.dispatch({selection:i,scrollIntoView:t,userEvent:n}),!0}return!1}const Th={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},_h=Ya.ie&&Ya.ie_version<=11;class Zh{constructor(e){this.view=e,this.active=!1,this.selectionRange=new aa,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.resizeContent=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver((t=>{for(let e of t)this.queue.push(e);(Ya.ie&&Ya.ie_version<=11||Ya.ios&&e.composing)&&t.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),_h&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((()=>{var e;(null===(e=this.view.docView)||void 0===e?void 0:e.lastUpdate)this.view.requestMeasure())),this.resizeContent.observe(e.contentDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver((e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))}),{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((()=>{this.resizeTimeout=-1,this.view.requestMeasure()}),50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout((()=>{this.view.viewState.printing=!1,this.view.requestMeasure()}),500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some(((t,n)=>t!=e[n])))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet(gl)?n.root.activeElement!=this.dom:!Jo(n.dom,i))return;let r=i.anchorNode&&n.docView.nearest(i.anchorNode);r&&r.ignoreEvent(e)?t||(this.selectionChanged=!1):(Ya.ie&&Ya.ie_version<=11||Ya.android&&Ya.chrome)&&!n.state.selection.main.empty&&i.focusNode&&ta(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Ya.safari&&11==e.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e){let t=null;function n(e){e.preventDefault(),e.stopImmediatePropagation(),t=e.getTargetRanges()[0]}if(e.contentDOM.addEventListener("beforeinput",n,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",n,!0),!t)return null;let i=t.startContainer,r=t.startOffset,s=t.endContainer,o=t.endOffset,a=e.docView.domAtPos(e.state.selection.main.anchor);ta(a.node,a.offset,s,o)&&([i,r,s,o]=[s,o,i,r]);return{anchorNode:i,anchorOffset:r,focusNode:s,focusOffset:o}}(this.view)||Ho(e.root);if(!t||this.selectionRange.eq(t))return!1;let n=Jo(this.dom,t);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let e=this.delayedAndroidKey;if(e){this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&da(this.dom,e.key,e.keyCode)}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()})))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,i=!1;for(let r of e){let e=this.readMutation(r);e&&(e.typeOver&&(i=!0),-1==t?({from:t,to:n}=e):(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:i}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),i=this.selectionChanged&&Jo(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new kh(this.view,e,t,n);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,i=Ph(this.view,t);return this.view.state==n&&this.view.update([]),i}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty("attributes"==e.type),"attributes"==e.type&&(t.flags|=4),"childList"==e.type){let n=Ch(t,e.previousSibling||e.target.previousSibling,-1),i=Ch(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var e,t,n,i;this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect(),null===(i=this.resizeContent)||void 0===i||i.disconnect();for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function Ch(e,t,n){for(;t;){let i=ga.get(t);if(i&&i.parent==e)return i;let r=t.parentNode;t=r!=e.dom?r:n>0?t.nextSibling:t.previousSibling}return null}class Xh{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(e=>e.forEach((e=>t(e,this))))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new sh(e.state||go.create(e)),this.plugins=this.state.facet(wl).map((e=>new vl(e)));for(let e of this.plugins)e.update(this);this.observer=new Zh(this),this.inputState=new fc(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Fl(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),e.parent&&e.parent.appendChild(this.dom)}dispatch(...e){let t=1==e.length&&e[0]instanceof so?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t,n=!1,i=!1,r=this.state;for(let t of e){if(t.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=t.state}if(this.destroyed)return void(this.viewState.state=r);let s=this.hasFocus,o=0,a=null;e.some((e=>e.annotation(Wc)))?(this.inputState.notifiedFocused=s,o=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,a=Ec(r,s),a||(o=1));let l=this.observer.delayedAndroidKey,c=null;if(l?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(go.phrases)!=this.state.facet(go.phrases))return this.setState(r);t=Xl.create(this,r,e),t.flags|=o;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(h&&(h=h.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;h=new Ol(e.empty?e:Qs.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(pl)&&(h=e.value)}this.viewState.update(t,h),this.bidiCache=qh.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),n=this.docView.update(t),this.state.facet(Zl)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some((e=>e.isUserEvent("select.pointer"))))}finally{this.updateState=0}if(t.startState.facet(fh)!=t.state.facet(fh)&&(this.viewState.mustMeasureContent=!0),(n||i||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!t.empty)for(let e of this.state.facet(cl))e(t);(a||c)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!Ph(this,c)&&l.force&&da(this.contentDOM,l.key,l.keyCode)}))}setState(e){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=e);this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new sh(e),this.plugins=e.facet(wl).map((e=>new vl(e))),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView=new Fl(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(wl),n=e.state.facet(wl);if(t!=n){let i=[];for(let r of n){let n=t.indexOf(r);if(n<0)i.push(new vl(r));else{let t=this.plugins[n];t.mustUpdate=e,i.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,i=n.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:s}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(s<0)if(Oa(n))r=-1,s=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(i);r=e.from,s=e.top}this.updateState=1;let o=this.viewState.measure(this);if(!o&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let a=[];4&o||([this.measureRequests,a]=[a,this.measureRequests]);let l=a.map((e=>{try{return e.read(this)}catch(e){return ml(this.state,e),Rh}})),c=Xl.create(this,this.state,[]),h=!1;c.flags|=o,t?t.flags|=o:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),h=this.docView.update(c));for(let e=0;e1||e<-1){i+=e,n.scrollTop=i/this.scaleY,s=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(cl))e(t)}get themeClasses(){return ph+" "+(this.state.facet(Oh)?gh:mh)+" "+this.state.facet(fh)}updateAttrs(){let e=Ah(this,yl,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(gl)?"true":"false",class:"cm-content",style:`${Ya.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Ah(this,Sl,t);let n=this.observer.ignore((()=>{let n=Ia(this.contentDOM,this.contentAttrs,t),i=Ia(this.dom,this.editorAttrs,e);return n||i}));return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let e of n.effects)if(e.is(Xh.announce)){t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value}}mountStyles(){this.styleModules=this.state.facet(Zl);let e=this.state.facet(Xh.cspNonce);zo.mount(this.root,this.styleModules.concat(xh).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((()=>this.measure()))),e){if(this.measureRequests.indexOf(e)>-1)return;if(null!=e.key)for(let t=0;tt.spec==e))||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return dc(this,e,hc(this,e,t,n))}moveByGroup(e,t){return dc(this,e,hc(this,e,t,(t=>function(e,t,n){let i=e.state.charCategorizer(t),r=i(n);return e=>{let t=i(e);return r==fo.Space&&(r=t),r==t}}(this,e.head,t))))}moveToLineBoundary(e,t,n=!0){return function(e,t,n,i){let r=cc(e,t.head),s=i&&r.type==La.Text&&(e.lineWrapping||r.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head):null;if(s){let t=e.dom.getBoundingClientRect(),i=e.textDirectionAt(r.from),o=e.posAtCoords({x:n==(i==Yl.LTR)?t.right-1:t.left+1,y:(s.top+s.bottom)/2});if(null!=o)return Qs.cursor(o,n?-1:1)}return Qs.cursor(n?r.to:r.from,n?-1:1)}(this,e,t,n)}moveVertically(e,t,n){return dc(this,e,function(e,t,n,i){let r=t.head,s=n?1:-1;if(r==(n?e.state.doc.length:0))return Qs.cursor(r,t.assoc);let o,a=t.goalColumn,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(r,t.assoc||-1),h=e.documentTop;if(c)null==a&&(a=c.left-l.left),o=s<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(r);null==a&&(a=Math.min(l.right-l.left,e.defaultCharacterWidth*(r-t.from))),o=(s<0?t.top:t.bottom)+h}let u=l.left+a,d=null!=i?i:e.viewState.heightOracle.textHeight>>1;for(let t=0;;t+=10){let n=o+(d+t)*s,i=ac(e,{x:u,y:n},!1,s);if(nl.bottom||(s<0?ir)){let t=e.docView.coordsForChar(i),r=!t||n0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(dl)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Yh)return Bl(e.length);let t,n=this.textDirectionAt(e.from);for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||Vl(i.isolates,t=Pl(this,e.from,e.to))))return i.order;t||(t=Pl(this,e.from,e.to));let i=function(e,t,n){if(!e)return[new Ul(0,0,t==ql?1:0)];if(t==Rl&&!n.length&&!Dl.test(e))return Bl(e.length);if(n.length)for(;e.length>Il.length;)Il[Il.length]=256;let i=[],r=t==Rl?0:1;return Gl(e,r,r,n,0,e.length,i),i}(e.text,n,t);return this.bidiCache.push(new qh(e.from,e.to,n,t,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Ya.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ha(this.contentDOM),this.docView.updateSelection()}))}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return pl.of(new Ol("number"==typeof e?Qs.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}static domEventHandlers(e){return xl.define((()=>({})),{eventHandlers:e})}static domEventObservers(e){return xl.define((()=>({})),{eventObservers:e})}static theme(e,t){let n=zo.newName(),i=[fh.of(n),Zl.of(wh(`.${n}`,e))];return t&&t.dark&&i.push(Oh.of(!0)),i}static baseTheme(e){return Ds.lowest(Zl.of(wh("."+ph,e,bh)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&ga.get(n)||ga.get(e);return(null===(t=null==i?void 0:i.rootView)||void 0===t?void 0:t.view)||null}}Xh.styleModule=Zl,Xh.inputHandler=hl,Xh.focusChangeEffect=ul,Xh.perLineTextDirection=dl,Xh.exceptionSink=ll,Xh.updateListener=cl,Xh.editable=gl,Xh.mouseSelectionStyle=al,Xh.dragMovesSelection=ol,Xh.clickAddsSelectionRange=sl,Xh.decorations=$l,Xh.atomicRanges=Ql,Xh.bidiIsolatedRanges=kl,Xh.scrollMargins=Tl,Xh.darkTheme=Oh,Xh.cspNonce=Ts.define({combine:e=>e.length?e[0]:""}),Xh.contentAttributes=Sl,Xh.editorAttributes=yl,Xh.lineWrapping=Xh.contentAttributes.of({class:"cm-lineWrapping"}),Xh.announce=ro.define();const Yh=4096,Rh={};class qh{constructor(e,t,n,i,r,s){this.from=e,this.to=t,this.dir=n,this.isolates=i,this.fresh=r,this.order=s}static update(e,t){if(t.empty&&!e.some((e=>e.fresh)))return e;let n=[],i=e.length?e[e.length-1].dir:Yl.LTR;for(let r=Math.max(0,e.length-10);r=0;r--){let t=i[r],s="function"==typeof t?t(e):t;s&&Da(s,n)}return n}const Wh=Ya.mac?"mac":Ya.windows?"win":Ya.linux?"linux":"key";function Eh(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}const jh=Ds.default(Xh.domEventHandlers({keydown:(e,t)=>Ih(Uh(t.state),e,t,"editor")})),zh=Ts.define({enables:jh}),Dh=new WeakMap;function Uh(e){let t=e.facet(zh),n=Dh.get(t);return n||Dh.set(t,n=function(e,t=Wh){let n=Object.create(null),i=Object.create(null),r=(e,t)=>{let n=i[e];if(null==n)i[e]=t;else if(n!=t)throw new Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},s=(e,i,s,o,a)=>{var l,c;let h=n[e]||(n[e]=Object.create(null)),u=i.split(/ (?!$)/).map((e=>function(e,t){const n=e.split(/-(?!$)/);let i,r,s,o,a=n[n.length-1];"Space"==a&&(a=" ");for(let e=0;e{let i=Vh={view:t,prefix:n,scope:e};return setTimeout((()=>{Vh==i&&(Vh=null)}),4e3),!0}]})}let d=u.join(" ");r(d,!1);let f=h[d]||(h[d]={preventDefault:!1,stopPropagation:!1,run:(null===(c=null===(l=h._any)||void 0===l?void 0:l.run)||void 0===c?void 0:c.slice())||[]});s&&f.run.push(s),o&&(f.preventDefault=!0),a&&(f.stopPropagation=!0)};for(let i of e){let e=i.scope?i.scope.split(" "):["editor"];if(i.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let t in e)e[t].run.push(i.any)}let r=i[t]||i.key;if(r)for(let t of e)s(t,r,i.run,i.preventDefault,i.stopPropagation),i.shift&&s(t,"Shift-"+r,i.shift,i.preventDefault,i.stopPropagation)}return n}(t.reduce(((e,t)=>e.concat(t)),[]))),n}let Vh=null;function Ih(e,t,n,i){let r=function(e){var t=!(No&&(e.ctrlKey||e.altKey||e.metaKey)||Bo&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?Io:Vo)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(t),s=fs(us(r,0))==r.length&&" "!=r,o="",a=!1,l=!1,c=!1;Vh&&Vh.view==n&&Vh.scope==i&&(o=Vh.prefix+" ",bc.indexOf(t.keyCode)<0&&(l=!0,Vh=null));let h,u,d=new Set,f=e=>{if(e){for(let i of e.run)if(!d.has(i)&&(d.add(i),i(n,t)))return e.stopPropagation&&(c=!0),!0;e.preventDefault&&(e.stopPropagation&&(c=!0),l=!0)}return!1},O=e[i];return O&&(f(O[o+Eh(r,t,!s)])?a=!0:s&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Ya.windows&&t.ctrlKey&&t.altKey)&&(h=Vo[t.keyCode])&&h!=r?(f(O[o+Eh(h,t,!0)])||t.shiftKey&&(u=Io[t.keyCode])!=r&&u!=h&&f(O[o+Eh(u,t,!1)]))&&(a=!0):s&&t.shiftKey&&f(O[o+Eh(r,t,!0)])&&(a=!0),!a&&f(O._any)&&(a=!0)),l&&(a=!0),a&&c&&t.stopPropagation(),a}class Mh{constructor(e,t,n,i,r){this.className=e,this.left=t,this.top=n,this.width=i,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",null!=this.width&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(n.empty){let i=e.coordsAtPos(n.head,n.assoc||1);if(!i)return[];let r=Gh(e);return[new Mh(t,i.left-r.left,i.top-r.top,null,i.bottom-i.top)]}return function(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let i=Math.max(n.from,e.viewport.from),r=Math.min(n.to,e.viewport.to),s=e.textDirection==Yl.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),l=Gh(e),c=o.querySelector(".cm-line"),h=c&&window.getComputedStyle(c),u=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),d=a.right-(h?parseInt(h.paddingRight):0),f=cc(e,i),O=cc(e,r),p=f.type==La.Text?f:null,m=O.type==La.Text?O:null;p&&(e.lineWrapping||f.widgetLineBreaks)&&(p=Bh(e,i,p));m&&(e.lineWrapping||O.widgetLineBreaks)&&(m=Bh(e,r,m));if(p&&m&&p.from==m.from)return b(w(n.from,n.to,p));{let t=p?w(n.from,null,p):x(f,!1),i=m?w(null,n.to,m):x(O,!0),r=[];return(p||f).to<(m||O).from-(p&&m?1:0)||f.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2c&&i.from=s)break;a>r&&l(Math.max(e,r),null==t&&e<=c,Math.min(a,s),null==n&&a>=h,o.dir)}if(r=i.to+1,r>=s)break}return 0==a.length&&l(c,null==t,h,null==n,e.textDirection),{top:r,bottom:o,horizontal:a}}function x(e,t){let n=a.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}(e,t,n)}}function Gh(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Yl.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function Bh(e,t,n){let i=Qs.cursor(t);return{from:Math.max(n.from,e.moveToLineBoundary(i,!1,!0).from),to:Math.min(n.to,e.moveToLineBoundary(i,!0,!0).from),type:La.Text}}class Nh{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Lh)!=e.state.facet(Lh)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}setOrder(e){let t=0,n=e.facet(Lh);for(;t{return n=e,i=this.drawn[t],!(n.constructor==i.constructor&&n.eq(i));var n,i}))){let t=this.dom.firstChild,n=0;for(let i of e)i.update&&t&&i.constructor&&this.drawn[n].constructor&&i.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(i.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Lh=Ts.define();function Fh(e){return[xl.define((t=>new Nh(t,e))),Lh.of(e)]}const Hh=!Ya.ios,Kh=Ts.define({combine:e=>bo(e,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})});function Jh(e={}){return[Kh.of(e),tu,iu,su,fl.of(!0)]}function eu(e){return e.startState.facet(Kh)!=e.state.facet(Kh)}const tu=Fh({above:!0,markers(e){let{state:t}=e,n=t.facet(Kh),i=[];for(let r of t.selection.ranges){let s=r==t.selection.main;if(r.empty?!s||Hh:n.drawRangeCursor){let t=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",n=r.empty?r:Qs.cursor(r.head,r.head>r.anchor?-1:1);for(let r of Mh.forRange(e,t,n))i.push(r)}}return i},update(e,t){e.transactions.some((e=>e.selection))&&(t.style.animationName="cm-blink"==t.style.animationName?"cm-blink2":"cm-blink");let n=eu(e);return n&&nu(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){nu(t.state,e)},class:"cm-cursorLayer"});function nu(e,t){t.style.animationDuration=e.facet(Kh).cursorBlinkRate+"ms"}const iu=Fh({above:!1,markers:e=>e.state.selection.ranges.map((t=>t.empty?[]:Mh.forRange(e,"cm-selectionBackground",t))).reduce(((e,t)=>e.concat(t))),update:(e,t)=>e.docChanged||e.selectionSet||e.viewportChanged||eu(e),class:"cm-selectionLayer"}),ru={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};Hh&&(ru[".cm-line"].caretColor="transparent !important");const su=Ds.highest(Xh.theme(ru)),ou=ro.define({map:(e,t)=>null==e?null:t.mapPos(e)}),au=qs.define({create:()=>null,update:(e,t)=>(null!=e&&(e=t.changes.mapPos(e)),t.effects.reduce(((e,t)=>t.is(ou)?t.value:e),e))}),lu=xl.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(au);null==n?null!=this.cursor&&(null===(t=this.cursor)||void 0===t||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(au)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(au),n=null!=t&&e.coordsAtPos(t);if(!n)return null;let i=e.scrollDOM.getBoundingClientRect();return{left:n.left-i.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-i.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(au)!=e&&this.view.dispatch({effects:ou.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){e.target!=this.view.contentDOM&&this.view.contentDOM.contains(e.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function cu(e,t,n,i,r){t.lastIndex=0;for(let s,o=e.iterRange(n,i),a=n;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;s=t.exec(o.value);)r(a+s.index,s)}class hu{constructor(e){const{regexp:t,decoration:n,decorate:i,boundary:r,maxLength:s=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,i)this.addMatch=(e,t,n,r)=>i(r,n,n+e[0].length,e,t);else if("function"==typeof n)this.addMatch=(e,t,i,r)=>{let s=n(e,t,i);s&&r(i,i+e[0].length,s)};else{if(!n)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(e,t,i,r)=>r(i,i+e[0].length,n)}this.boundary=r,this.maxLength=s}createDeco(e){let t=new $o,n=t.add.bind(t);for(let{from:t,to:i}of function(e,t){let n=e.visibleRanges;if(1==n.length&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let i=[];for(let{from:r,to:s}of n)r=Math.max(e.state.doc.lineAt(r).from,r-t),s=Math.min(e.state.doc.lineAt(s).to,s+t),i.length&&i[i.length-1].to>=r?i[i.length-1].to=s:i.push({from:r,to:s});return i}(e,this.maxLength))cu(e.state.doc,this.regexp,t,i,((t,i)=>this.addMatch(i,e,t,n)));return t.finish()}updateDeco(e,t){let n=1e9,i=-1;return e.docChanged&&e.changes.iterChanges(((t,r,s,o)=>{o>e.view.viewport.from&&s1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,t.map(e.changes),n,i):t}updateRange(e,t,n,i){for(let r of e.visibleRanges){let s=Math.max(r.from,n),o=Math.min(r.to,i);if(o>s){let n=e.state.doc.lineAt(s),i=n.ton.from;s--)if(this.boundary.test(n.text[s-1-n.from])){a=s;break}for(;oh.push(n.range(e,t));if(n==i)for(this.regexp.lastIndex=a-n.from;(c=this.regexp.exec(n.text))&&c.indexthis.addMatch(n,e,t,u)));t=t.update({filterFrom:a,filterTo:l,filter:(e,t)=>el,add:h})}}return t}}const uu=null!=/x/.unicode?"gu":"g",du=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",uu),fu={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Ou=null;const pu=Ts.define({combine(e){let t=bo(e,{render:null,specialChars:du,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==Ou&&"undefined"!=typeof document&&document.body){let t=document.body.style;Ou=null!=(null!==(e=t.tabSize)&&void 0!==e?e:t.MozTabSize)}return Ou||!1}())&&(t.specialChars=new RegExp("\t|"+t.specialChars.source,uu)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,uu)),t}});function mu(e={}){return[pu.of(e),gu||(gu=xl.fromClass(class{constructor(e){this.view=e,this.decorations=Fa.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(pu)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new hu({regexp:e.specialChars,decoration:(t,n,i)=>{let{doc:r}=n.state,s=us(t[0],0);if(9==s){let e=r.lineAt(i),t=n.state.tabSize,s=qo(e.text,t,i-e.from);return Fa.replace({widget:new wu((t-s%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Fa.replace({widget:new bu(e,s)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(pu);e.startState.facet(pu)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))]}let gu=null;class bu extends Na{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=function(e){return e>=32?"•":10==e?"␤":String.fromCharCode(9216+e)}(this.code),n=e.state.phrase("Control character")+" "+(fu[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,n,t);if(i)return i;let r=document.createElement("span");return r.textContent=t,r.title=n,r.setAttribute("aria-label",n),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class wu extends Na{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="\t",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}const xu=Fa.line({class:"cm-activeLine"}),vu=xl.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let i of e.state.selection.ranges){let r=e.lineBlockAt(i.head);r.from>t&&(n.push(xu.range(r.from)),t=r.from)}return Fa.set(n)}},{decorations:e=>e.decorations}),yu=2e3;function Su(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),i=e.state.doc.lineAt(n),r=n-i.from,s=r>yu?-1:r==i.length?function(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}(e,t.clientX):qo(i.text,e.state.tabSize,n-i.from);return{line:i.number,col:s,off:r}}function $u(e,t){let n=Su(e,t),i=e.state.selection;return n?{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(n.line).from),r=e.state.doc.lineAt(t);n={line:r.number,col:n.col,off:Math.min(n.off,r.length)},i=i.map(e.changes)}},get(t,r,s){let o=Su(e,t);if(!o)return i;let a=function(e,t,n){let i=Math.min(t.line,n.line),r=Math.max(t.line,n.line),s=[];if(t.off>yu||n.off>yu||t.col<0||n.col<0){let o=Math.min(t.off,n.off),a=Math.max(t.off,n.off);for(let t=i;t<=r;t++){let n=e.doc.line(t);n.length<=a&&s.push(Qs.range(n.from+o,n.to+a))}}else{let o=Math.min(t.col,n.col),a=Math.max(t.col,n.col);for(let t=i;t<=r;t++){let n=e.doc.line(t),i=Ao(n.text,o,e.tabSize,!0);if(i<0)s.push(Qs.cursor(n.to));else{let t=Ao(n.text,a,e.tabSize);s.push(Qs.range(n.from+i,n.from+t))}}}return s}(e.state,n,o);return a.length?s?Qs.create(a.concat(i.ranges)):Qs.create(a):i}}:null}function Qu(e){let t=(null==e?void 0:e.eventFilter)||(e=>e.altKey&&0==e.button);return Xh.mouseSelectionStyle.of(((e,n)=>t(n)?$u(e,n):null))}const ku={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},Pu={style:"cursor: crosshair"};function Tu(e={}){let[t,n]=ku[e.key||"Alt"],i=xl.fromClass(class{constructor(e){this.view=e,this.isDown=!1}set(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}},{eventObservers:{keydown(e){this.set(e.keyCode==t||n(e))},keyup(e){e.keyCode!=t&&n(e)||this.set(!1)},mousemove(e){this.set(n(e))}}});return[i,Xh.contentAttributes.of((e=>{var t;return(null===(t=e.plugin(i))||void 0===t?void 0:t.isDown)?Pu:null}))]}const _u="-10000px";class Zu{constructor(e,t,n){this.facet=t,this.createTooltipView=n,this.input=e.state.facet(t),this.tooltips=this.input.filter((e=>e)),this.tooltipViews=this.tooltips.map(n)}update(e,t){var n;let i=e.state.facet(this.facet),r=i.filter((e=>e));if(i===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let s=[],o=t?[]:null;for(let n=0;nt[n]=e)),t.length=o.length),this.input=i,this.tooltips=r,this.tooltipViews=s,!0}}function Cu(e){let{win:t}=e;return{top:0,left:0,bottom:t.innerHeight,right:t.innerWidth}}const Xu=Ts.define({combine:e=>{var t,n,i;return{position:Ya.ios?"absolute":(null===(t=e.find((e=>e.position)))||void 0===t?void 0:t.position)||"fixed",parent:(null===(n=e.find((e=>e.parent)))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(i=e.find((e=>e.tooltipSpace)))||void 0===i?void 0:i.tooltipSpace)||Cu}}}),Yu=new WeakMap,Ru=xl.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(Xu);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new Zu(e,Wu,(e=>this.createTooltip(e))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,i=e.state.facet(Xu);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e){let t=e.create(this.view);if(t.dom.classList.add("cm-tooltip"),e.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",t.dom.appendChild(e)}return t.dom.style.position=this.position,t.dom.style.top=_u,this.container.appendChild(t.dom),t.mount&&t.mount(this.view),t}destroy(){var e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.intersectionObserver)||void 0===t||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=this.view.dom.getBoundingClientRect(),t=1,n=1,i=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{offsetParent:e}=this.manager.tooltipViews[0].dom;i=!(!e||e==this.container.ownerDocument.body)}if(i||"absolute"==this.position)if(this.parent){let e=this.parent.getBoundingClientRect();e.width&&e.height&&(t=e.width/this.parent.offsetWidth,n=e.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:n}=this.view.viewState);return{editor:e,parent:this.parent?this.container.getBoundingClientRect():e,pos:this.manager.tooltips.map(((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)})),size:this.manager.tooltipViews.map((({dom:e})=>e.getBoundingClientRect())),space:this.view.state.facet(Xu).tooltipSpace(this.view),scaleX:t,scaleY:n,makeAbsolute:i}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let e of this.manager.tooltipViews)e.dom.style.position="absolute"}let{editor:n,space:i,scaleX:r,scaleY:s}=e,o=[];for(let a=0;a=Math.min(n.bottom,i.bottom)||u.rightMath.min(n.right,i.right)+.1){h.style.top=_u;continue}let f=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,O=f?7:0,p=d.right-d.left,m=null!==(t=Yu.get(c))&&void 0!==t?t:d.bottom-d.top,g=c.offset||Au,b=this.view.textDirection==Yl.LTR,w=d.width>i.right-i.left?b?i.left:i.right-d.width:b?Math.min(u.left-(f?14:0)+g.x,i.right-p):Math.max(i.left,u.left-p+(f?14:0)-g.x),x=this.above[a];!l.strictSide&&(x?u.top-(d.bottom-d.top)-g.yi.bottom)&&x==i.bottom-u.bottom>u.top-i.top&&(x=this.above[a]=!x);let v=(x?u.top-i.top:i.bottom-u.bottom)-O;if(vw&&e.topy&&(y=x?e.top-m-2-O:e.bottom+O+2);if("absolute"==this.position?(h.style.top=(y-e.parent.top)/s+"px",h.style.left=(w-e.parent.left)/r+"px"):(h.style.top=y/s+"px",h.style.left=w/r+"px"),f){let e=u.left+(b?g.x:-g.x)-(w+14-7);f.style.left=e/r+"px"}!0!==c.overlap&&o.push({left:w,top:y,right:S,bottom:y+m}),h.classList.toggle("cm-tooltip-above",x),h.classList.toggle("cm-tooltip-below",!x),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=_u}},{eventObservers:{scroll(){this.maybeMeasure()}}}),qu=Xh.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Au={x:0,y:0},Wu=Ts.define({enables:[Ru,qu]}),Eu=Ts.define();class ju{static create(e){return new ju(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Zu(e,Eu,(e=>this.createHostedView(e)))}createHostedView(e){let t=e.create(this.view);return t.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(t.dom),this.mounted&&t.mount&&t.mount(this.view),t}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null===(e=t.destroy)||void 0===e||e.call(t)}}const zu=Wu.compute([Eu],(e=>{let t=e.facet(Eu).filter((e=>e));return 0===t.length?null:{pos:Math.min(...t.map((e=>e.pos))),end:Math.max(...t.filter((e=>null!=e.end)).map((e=>e.end))),create:ju.create,above:t[0].above,arrow:t.some((e=>e.arrow))}}));class Du{constructor(e,t,n,i,r){this.view=e,this.source=t,this.field=n,this.setHover=i,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout((()=>this.startHover()),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active)return;let e=Date.now()-this.lastMove.time;en.bottom||t.xn.right+e.defaultCharacterWidth)return;let s=e.bidiSpans(e.state.doc.lineAt(i)).find((e=>e.from<=i&&e.to>=i)),o=s&&s.dir==Yl.RTL?-1:1;r=t.x{this.pending==t&&(this.pending=null,n&&e.dispatch({effects:this.setHover.of(n)}))}),(t=>ml(e.state,t,"hover tooltip")))}else s&&e.dispatch({effects:this.setHover.of(s)})}mousemove(e){var t;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let n=this.active;if(n&&!Uu(this.lastMove.target)||this.pending){let{pos:i}=n||this.pending,r=null!==(t=null==n?void 0:n.end)&&void 0!==t?t:i;(i==r?this.view.posAtCoords(this.lastMove)==i:function(e,t,n,i,r,s){let o=e.scrollDOM.getBoundingClientRect(),a=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>i||o.rightr||Math.min(o.bottom,a)=t&&l<=n}(this.view,i,r,e.clientX,e.clientY))||(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!Uu(e.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function Uu(e){for(let t=e;t;t=t.parentNode)if(1==t.nodeType&&t.classList.contains("cm-tooltip"))return!0;return!1}function Vu(e,t={}){let n=ro.define(),i=qs.define({create:()=>null,update(e,i){if(e&&(t.hideOnChange&&(i.docChanged||i.selection)||t.hideOn&&t.hideOn(i,e)))return null;if(e&&i.docChanged){let t=i.changes.mapPos(e.pos,-1,ps.TrackDel);if(null==t)return null;let n=Object.assign(Object.create(null),e);n.pos=t,null!=e.end&&(n.end=i.changes.mapPos(e.end)),e=n}for(let t of i.effects)t.is(n)&&(e=t.value),t.is(Iu)&&(e=null);return e},provide:e=>Eu.from(e)});return[i,xl.define((r=>new Du(r,e,i,n,t.hoverTime||300))),zu]}const Iu=ro.define(),Mu=Ts.define({combine(e){let t,n;for(let i of e)t=t||i.topContainer,n=n||i.bottomContainer;return{topContainer:t,bottomContainer:n}}});function Gu(e,t){let n=e.plugin(Bu),i=n?n.specs.indexOf(t):-1;return i>-1?n.panels[i]:null}const Bu=xl.fromClass(class{constructor(e){this.input=e.state.facet(Fu),this.specs=this.input.filter((e=>e)),this.panels=this.specs.map((t=>t(e)));let t=e.state.facet(Mu);this.top=new Nu(e,!0,t.topContainer),this.bottom=new Nu(e,!1,t.bottomContainer),this.top.sync(this.panels.filter((e=>e.top))),this.bottom.sync(this.panels.filter((e=>!e.top)));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(e){let t=e.state.facet(Mu);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Nu(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Nu(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Fu);if(n!=this.input){let t=n.filter((e=>e)),i=[],r=[],s=[],o=[];for(let n of t){let t,a=this.specs.indexOf(n);a<0?(t=n(e.view),o.push(t)):(t=this.panels[a],t.update&&t.update(e)),i.push(t),(t.top?r:s).push(t)}this.specs=t,this.panels=i,this.top.sync(r),this.bottom.sync(s);for(let e of o)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>Xh.scrollMargins.of((t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}}))});class Nu{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Lu(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Lu(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Lu(e){let t=e.nextSibling;return e.remove(),t}const Fu=Ts.define({enables:Bu});class Hu extends wo{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Hu.prototype.elementClass="",Hu.prototype.toDOM=void 0,Hu.prototype.mapMode=ps.TrackBefore,Hu.prototype.startSide=Hu.prototype.endSide=-1,Hu.prototype.point=!0;const Ku=Ts.define(),Ju={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>So.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},ed=Ts.define();function td(e){return[id(),ed.of(Object.assign(Object.assign({},Ju),e))]}const nd=Ts.define({combine:e=>e.some((e=>e))});function id(e){let t=[rd];return e&&!1===e.fixed&&t.push(nd.of(!0)),t}const rd=xl.fromClass(class{constructor(e){this.view=e,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(ed).map((t=>new ld(e,t)));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!e.state.facet(nd),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,i=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(i<.8*(n.to-n.from))}e.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(nd)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&this.dom.remove();let n=So.iter(this.view.state.facet(Ku),this.view.viewport.from),i=[],r=this.gutters.map((e=>new ad(e,this.view.viewport,-this.view.documentPadding.top)));for(let e of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(e.type)){let t=!0;for(let s of e.type)if(s.type==La.Text&&t){od(n,i,s.from);for(let e of r)e.line(this.view,s,i);t=!1}else if(s.widget)for(let e of r)e.widget(this.view,s)}else if(e.type==La.Text){od(n,i,e.from);for(let t of r)t.line(this.view,e,i)}else if(e.widget)for(let t of r)t.widget(this.view,e);for(let e of r)e.finish();e&&this.view.scrollDOM.insertBefore(this.dom,t)}updateGutters(e){let t=e.startState.facet(ed),n=e.state.facet(ed),i=e.docChanged||e.heightChanged||e.viewportChanged||!So.eq(e.startState.facet(Ku),e.state.facet(Ku),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(i=!0);else{i=!0;let r=[];for(let i of n){let n=t.indexOf(i);n<0?r.push(new ld(this.view,i)):(this.gutters[n].update(e),r.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),r.indexOf(e)<0&&e.destroy();for(let e of r)this.dom.appendChild(e.dom);this.gutters=r}return i}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove()}},{provide:e=>Xh.scrollMargins.of((t=>{let n=t.plugin(e);return n&&0!=n.gutters.length&&n.fixed?t.textDirection==Yl.LTR?{left:n.dom.offsetWidth*t.scaleX}:{right:n.dom.offsetWidth*t.scaleX}:null}))});function sd(e){return Array.isArray(e)?e:[e]}function od(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class ad{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=So.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:i}=this,r=(t.top-this.height)/e.scaleY,s=t.height/e.scaleY;if(this.i==i.elements.length){let t=new cd(e,s,r,n);i.elements.push(t),i.dom.appendChild(t.dom)}else i.elements[this.i].update(e,s,r,n);this.height=t.bottom,this.i++}line(e,t,n){let i=[];od(this.cursor,i,t.from),n.length&&(i=i.concat(n));let r=this.gutter.config.lineMarker(e,t,i);r&&i.unshift(r);let s=this.gutter;(0!=i.length||s.config.renderEmptyElements)&&this.addElement(e,t,i)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t);n&&this.addElement(e,t,[n])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class ld{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,(i=>{let r,s=i.target;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let e=s.getBoundingClientRect();r=(e.top+e.bottom)/2}else r=i.clientY;let o=e.lineBlockAtHeight(r-e.documentTop);t.domEventHandlers[n](e,o,i)&&i.preventDefault()}));this.markers=sd(t.markers(e)),t.initialSpacer&&(this.spacer=new cd(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=sd(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!So.eq(this.markers,t,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class cd{constructor(e,t,n,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,i)}update(e,t,n,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(e,t){if(e.length!=t.length)return!1;for(let n=0;nbo(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let i=n[e],r=t[e];n[e]=i?(e,t,n)=>i(e,t,n)||r(e,t,n):r}return n}})});class dd extends Hu{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function fd(e,t){return e.state.facet(ud).formatNumber(t,e.state)}const Od=ed.compute([ud],(e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet(hd),lineMarker:(e,t,n)=>n.some((e=>e.toDOM))?null:new dd(fd(e,e.state.doc.lineAt(t.from).number)),widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(ud)!=e.state.facet(ud),initialSpacer:e=>new dd(fd(e,md(e.state.doc.lines))),updateSpacer(e,t){let n=fd(t.view,md(t.view.state.doc.lines));return n==e.number?e:new dd(n)},domEventHandlers:e.facet(ud).domEventHandlers})));function pd(e={}){return[ud.of(e),id(),Od]}function md(e){let t=9;for(;t{let t=[],n=-1;for(let i of e.selection.ranges){let r=e.doc.lineAt(i.head).from;r>n&&(n=r,t.push(gd.range(r)))}return So.of(t)}));const wd=1024;let xd=0;class vd{constructor(e,t){this.from=e,this.to=t}}class yd{constructor(e={}){this.id=xd++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=Qd.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}yd.closedBy=new yd({deserialize:e=>e.split(" ")}),yd.openedBy=new yd({deserialize:e=>e.split(" ")}),yd.group=new yd({deserialize:e=>e.split(" ")}),yd.contextHash=new yd({perNode:!0}),yd.lookAhead=new yd({perNode:!0}),yd.mounted=new yd({perNode:!0});class Sd{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[yd.mounted.id]}}const $d=Object.create(null);class Qd{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):$d,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),i=new Qd(e.name||"",t,e.id,n);if(e.props)for(let n of e.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}return i}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(yd.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return e=>{for(let n=e.prop(yd.group),i=-1;i<(n?n.length:0);i++){let r=t[i<0?e.name:n[i]];if(r)return r}}}}Qd.none=new Qd("",Object.create(null),0,8);class kd{constructor(e){this.types=e;for(let t=0;t=t){let o=new Ad(s.tree,s.overlay[0].from+e.from,0,null);(r||(r=[i])).push(Rd(o,t,n,!1))}}return r?Dd(r):i}(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:r=this.length}=e,s=e.mode||0,o=(s&_d.IncludeAnonymous)>0;for(let e=this.cursor(s|_d.IncludeAnonymous);;){let s=!1;if(e.from<=r&&e.to>=i&&(!o&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;s=!0}for(;s&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;s=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Bd(Qd.none,this.children,this.positions,0,this.children.length,0,this.length,((e,t,n)=>new Zd(this.type,e,t,n,this.propValues)),e.makeTree||((e,t,n)=>new Zd(Qd.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:i,maxBufferLength:r=wd,reused:s=[],minRepeatType:o=i.types.length}=e,a=Array.isArray(n)?new Cd(n,n.length):n,l=i.types,c=0,h=0;function u(e,t,n,g,b){let{id:w,start:x,end:v,size:y}=a,S=h;for(;y<0;){if(a.next(),-1==y){let t=s[w];return n.push(t),void g.push(x-e)}if(-3==y)return void(c=w);if(-4==y)return void(h=w);throw new RangeError(`Unrecognized record size: ${y}`)}let $,Q,k=l[w],P=x-e;if(v-x<=r&&(Q=p(a.pos-t,b))){let t=new Uint16Array(Q.size-Q.skip),n=a.pos-Q.size,r=t.length;for(;a.pos>n;)r=m(Q.start,t,r);$=new Xd(t,v-Q.start,i),P=Q.start-e}else{let e=a.pos-y;a.next();let t=[],n=[],i=w>=o?w:-1,s=0,l=v;for(;a.pos>e;)i>=0&&a.id==i&&a.size>=0?(a.end<=l-r&&(f(t,n,x,s,a.end,l,i,S),s=t.length,l=a.end),a.next()):u(x,e,t,n,i);if(i>=0&&s>0&&s-1&&s>0){let e=d(k);$=Bd(k,t,n,0,t.length,0,v-x,e,e)}else $=O(k,t,n,v-x,S-v)}n.push($),g.push(P)}function d(e){return(t,n,i)=>{let r,s,o=0,a=t.length-1;if(a>=0&&(r=t[a])instanceof Zd){if(!a&&r.type==e&&r.length==i)return r;(s=r.prop(yd.lookAhead))&&(o=n[a]+r.length+s)}return O(e,t,n,i,o)}}function f(e,t,n,r,s,o,a,l){let c=[],h=[];for(;e.length>r;)c.push(e.pop()),h.push(t.pop()+n-s);e.push(O(i.types[a],c,h,o-s,l-o)),t.push(s-n)}function O(e,t,n,i,r=0,s){if(c){let e=[yd.contextHash,c];s=s?[e].concat(s):[e]}if(r>25){let e=[yd.lookAhead,r];s=s?[e].concat(s):[e]}return new Zd(e,t,n,i,s)}function p(e,t){let n=a.fork(),i=0,s=0,l=0,c=n.end-r,h={size:0,start:0,skip:0};e:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){h.size=i,h.start=s,h.skip=l,l+=4,i+=4,n.next();continue}let a=n.pos-e;if(e<0||a=o?4:0,d=n.start;for(n.next();n.pos>a;){if(n.size<0){if(-3!=n.size)break e;u+=4}else n.id>=o&&(u+=4);n.next()}s=d,i+=e,l+=u}return(t<0||i==e)&&(h.size=i,h.start=s,h.skip=l),h.size>4?h:void 0}function m(e,t,n){let{id:i,start:r,end:s,size:l}=a;if(a.next(),l>=0&&i4){let i=a.pos-(l-4);for(;a.pos>i;)n=m(e,t,n)}t[--n]=o,t[--n]=s-e,t[--n]=r-e,t[--n]=i}else-3==l?c=i:-4==l&&(h=i);return n}let g=[],b=[];for(;a.pos>0;)u(e.start||0,e.bufferStart||0,g,b,-1);let w=null!==(t=e.length)&&void 0!==t?t:g.length?b[0]+g[0].length:0;return new Zd(l[e.topID],g.reverse(),b.reverse(),w)}(e)}}Zd.empty=new Zd(Qd.none,[],[],0);class Cd{constructor(e,t){this.buffer=e,this.index=t}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]}get pos(){return this.index}next(){this.index-=4}fork(){return new Cd(this.buffer,this.index)}}class Xd{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Qd.none}toString(){let e=[];for(let t=0;t0));a=s[a+3]);return o}slice(e,t,n){let i=this.buffer,r=new Uint16Array(t-e),s=0;for(let o=e,a=0;o=t&&nt;case 1:return n<=t&&i>t;case 2:return i>t;case 4:return!0}}function Rd(e,t,n,i){for(var r;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to0?o.length:-1;e!=l;e+=t){let l=o[e],c=a[e]+s.from;if(Yd(i,n,c,c+l.length))if(l instanceof Xd){if(r&_d.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,t,n-c,i);if(o>-1)return new zd(new jd(s,l,e,c),null,o)}else if(r&_d.IncludeAnonymous||!l.type.isAnonymous||Id(l)){let o;if(!(r&_d.IgnoreMounts)&&(o=Sd.get(l))&&!o.overlay)return new Ad(o.tree,c,e,s);let a=new Ad(l,c,e,s);return r&_d.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(t<0?l.children.length-1:0,t,n,i)}}if(r&_d.IncludeAnonymous||!s.type.isAnonymous)return null;if(e=s.index>=0?s.index+t:t<0?-1:s._parent._tree.children.length,s=s._parent,!s)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,n=0){let i;if(!(n&_d.IgnoreOverlays)&&(i=Sd.get(this._tree))&&i.overlay){let n=e-this.from;for(let{from:e,to:r}of i.overlay)if((t>0?e<=n:e=n:r>n))return new Ad(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Wd(e,t,n,i){let r=e.cursor(),s=[];if(!r.firstChild())return s;if(null!=n)for(;!r.type.is(n);)if(!r.nextSibling())return s;for(;;){if(null!=i&&r.type.is(i))return s;if(r.type.is(t)&&s.push(r.node),!r.nextSibling())return null==i?s:[]}}function Ed(e,t,n=t.length-1){for(let i=e.parent;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[n]&&t[n]!=i.name)return!1;n--}}return!0}class jd{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class zd extends qd{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return r<0?null:new zd(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,n=0){if(n&_d.ExcludeBuffers)return null;let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new zd(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new zd(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new zd(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,r=n.buffer[this.index+3];if(r>i){let s=n.buffer[this.index+1];e.push(n.slice(i,r,s)),t.push(0)}return new Zd(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Dd(e){if(!e.length)return null;if(1==e.length)return e[0];let t=0,n=e[0];for(let i=1;in.from||r.to0){if(this.index-1)for(let i=t+e,r=e<0?-1:n._tree.children.length;i!=r;i+=e){let e=n._tree.children[i];if(this.mode&_d.IncludeAnonymous||e instanceof Xd||!e.type.isAnonymous||Id(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let s=e;s;s=s._parent)if(s.index==i){if(i==this.index)return s;t=s,n=r+1;break e}i=this.stack[--r]}for(let e=n;e=0;r--){if(r<0)return Ed(this.node,e,i);let s=n[t.buffer[this.stack[r]]];if(!s.isAnonymous){if(e[i]&&e[i]!=s.name)return!1;i--}}return!0}}function Id(e){return e.children.some((e=>e instanceof Xd||!e.type.isAnonymous||Id(e)))}const Md=new WeakMap;function Gd(e,t){if(!e.isAnonymous||t instanceof Xd||t.type!=e)return 1;let n=Md.get(t);if(null==n){n=1;for(let i of t.children){if(i.type!=e||!(i instanceof Zd)){n=1;break}n+=Gd(e,i)}Md.set(t,n)}return n}function Bd(e,t,n,i,r,s,o,a,l){let c=0;for(let n=i;n=h)break;O+=t}if(c==r+1){if(O>h){let e=n[r];t(e.children,e.positions,0,e.children.length,i[r]+a);continue}u.push(n[r])}else{let t=i[c-1]+n[c-1].length-f;u.push(Bd(e,n,i,r,c,f,t,null,l))}d.push(f+a-s)}}(t,n,i,r,0),(a||l)(u,d,o)}class Nd{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof zd?this.setBuffer(e.context.buffer,e.index,t):e instanceof Ad&&this.map.set(e.tree,t)}get(e){return e instanceof zd?this.getBuffer(e.context.buffer,e.index):e instanceof Ad?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Ld{constructor(e,t,n,i,r=!1,s=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,this.open=(r?1:0)|(s?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let i=[new Ld(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&i.push(n);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],r=1,s=e.length?e[0]:null;for(let o=0,a=0,l=0;;o++){let c=o=n)for(;s&&s.from=t.from||h<=t.to||l){let e=Math.max(t.from,a)-l,n=Math.min(t.to,h)-l;t=e>=n?null:new Ld(e,n,t.tree,t.offset+l,o>0,!!c)}if(t&&i.push(t),s.to>h)break;s=rnew vd(e.from,e.to))):[new vd(0,0)]:[new vd(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let e=i.advance();if(e)return e}}}class Hd{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new yd({perNode:!0});let Kd=0;class Jd{constructor(e,t,n){this.set=e,this.base=t,this.modified=n,this.id=Kd++}static define(e){if(null==e?void 0:e.base)throw new Error("Can not derive from a modified tag");let t=new Jd([],null,[]);if(t.set.push(t),e)for(let n of e.set)t.set.push(n);return t}static defineModifier(){let e=new tf;return t=>t.modified.indexOf(e)>-1?t:tf.get(t.base||t,t.modified.concat(e).sort(((e,t)=>e.id-t.id)))}}let ef=0;class tf{constructor(){this.instances=[],this.id=ef++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find((n=>{return n.base==e&&(i=t,r=n.modified,i.length==r.length&&i.every(((e,t)=>e==r[t])));var i,r}));if(n)return n;let i=[],r=new Jd(i,e,t);for(let e of t)e.instances.push(r);let s=function(e){let t=[[]];for(let n=0;nt.length-e.length))}(t);for(let t of e.set)if(!t.modified.length)for(let e of s)i.push(tf.get(t,e));return r}}function nf(e){let t=Object.create(null);for(let n in e){let i=e[n];Array.isArray(i)||(i=[i]);for(let e of n.split(" "))if(e){let n=[],r=2,s=e;for(let t=0;;){if("..."==s&&t>0&&t+3==e.length){r=1;break}let i=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!i)throw new RangeError("Invalid path: "+e);if(n.push("*"==i[0]?"":'"'==i[0][0]?JSON.parse(i[0]):i[0]),t+=i[0].length,t==e.length)break;let o=e[t++];if(t==e.length&&"!"==o){r=0;break}if("/"!=o)throw new RangeError("Invalid path: "+e);s=e.slice(t)}let o=n.length-1,a=n[o];if(!a)throw new RangeError("Invalid path: "+e);let l=new sf(i,r,o>0?n.slice(0,o):null);t[a]=l.sort(t[a])}}return rf.add(t)}const rf=new yd;class sf{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,this.next=i}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth{let t=r;for(let i of e)for(let e of i.set){let i=n[e.id];if(i){t=t?t+" "+i:i;break}}return t},scope:i}}function af(e,t,n,i=0,r=e.length){let s=new lf(i,Array.isArray(t)?t:[t],n);s.highlightRange(e.cursor(),i,r,"",s.highlighters),s.flush(r)}sf.empty=new sf([],2,null);class lf{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,i,r){let{type:s,from:o,to:a}=e;if(o>=n||a<=t)return;s.isTop&&(r=this.highlighters.filter((e=>!e.scope||e.scope(s))));let l=i,c=function(e){let t=e.type.prop(rf);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||sf.empty,h=function(e,t){let n=null;for(let i of e){let e=i.style(t);e&&(n=n?n+" "+e:e)}return n}(r,c.tags);if(h&&(l&&(l+=" "),l+=h,1==c.mode&&(i+=(i?" ":"")+h)),this.startSpan(e.from,l),c.opaque)return;let u=e.tree&&e.tree.prop(yd.mounted);if(u&&u.overlay){let s=e.node.enter(u.overlay[0].from+o,1),c=this.highlighters.filter((e=>!e.scope||e.scope(u.tree.type))),h=e.firstChild();for(let d=0,f=o;;d++){let O=d=p)&&e.nextSibling()););if(!O||p>n)break;f=O.to+o,f>t&&(this.highlightRange(s.cursor(),Math.max(t,O.from+o),Math.min(n,f),i,c),this.startSpan(f,l))}h&&e.parent()}else if(e.firstChild()){do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,i,r),this.startSpan(Math.min(n,e.to),l)}}while(e.nextSibling());e.parent()}}}const cf=Jd.define,hf=cf(),uf=cf(),df=cf(uf),ff=cf(uf),Of=cf(),pf=cf(Of),mf=cf(Of),gf=cf(),bf=cf(gf),wf=cf(),xf=cf(),vf=cf(),yf=cf(vf),Sf=cf(),$f={comment:hf,lineComment:cf(hf),blockComment:cf(hf),docComment:cf(hf),name:uf,variableName:cf(uf),typeName:df,tagName:cf(df),propertyName:ff,attributeName:cf(ff),className:cf(uf),labelName:cf(uf),namespace:cf(uf),macroName:cf(uf),literal:Of,string:pf,docString:cf(pf),character:cf(pf),attributeValue:cf(pf),number:mf,integer:cf(mf),float:cf(mf),bool:cf(Of),regexp:cf(Of),escape:cf(Of),color:cf(Of),url:cf(Of),keyword:wf,self:cf(wf),null:cf(wf),atom:cf(wf),unit:cf(wf),modifier:cf(wf),operatorKeyword:cf(wf),controlKeyword:cf(wf),definitionKeyword:cf(wf),moduleKeyword:cf(wf),operator:xf,derefOperator:cf(xf),arithmeticOperator:cf(xf),logicOperator:cf(xf),bitwiseOperator:cf(xf),compareOperator:cf(xf),updateOperator:cf(xf),definitionOperator:cf(xf),typeOperator:cf(xf),controlOperator:cf(xf),punctuation:vf,separator:cf(vf),bracket:yf,angleBracket:cf(yf),squareBracket:cf(yf),paren:cf(yf),brace:cf(yf),content:gf,heading:bf,heading1:cf(bf),heading2:cf(bf),heading3:cf(bf),heading4:cf(bf),heading5:cf(bf),heading6:cf(bf),contentSeparator:cf(gf),list:cf(gf),quote:cf(gf),emphasis:cf(gf),strong:cf(gf),link:cf(gf),monospace:cf(gf),strikethrough:cf(gf),inserted:cf(),deleted:cf(),changed:cf(),invalid:cf(),meta:Sf,documentMeta:cf(Sf),annotation:cf(Sf),processingInstruction:cf(Sf),definition:Jd.defineModifier(),constant:Jd.defineModifier(),function:Jd.defineModifier(),standard:Jd.defineModifier(),local:Jd.defineModifier(),special:Jd.defineModifier()};var Qf;of([{tag:$f.link,class:"tok-link"},{tag:$f.heading,class:"tok-heading"},{tag:$f.emphasis,class:"tok-emphasis"},{tag:$f.strong,class:"tok-strong"},{tag:$f.keyword,class:"tok-keyword"},{tag:$f.atom,class:"tok-atom"},{tag:$f.bool,class:"tok-bool"},{tag:$f.url,class:"tok-url"},{tag:$f.labelName,class:"tok-labelName"},{tag:$f.inserted,class:"tok-inserted"},{tag:$f.deleted,class:"tok-deleted"},{tag:$f.literal,class:"tok-literal"},{tag:$f.string,class:"tok-string"},{tag:$f.number,class:"tok-number"},{tag:[$f.regexp,$f.escape,$f.special($f.string)],class:"tok-string2"},{tag:$f.variableName,class:"tok-variableName"},{tag:$f.local($f.variableName),class:"tok-variableName tok-local"},{tag:$f.definition($f.variableName),class:"tok-variableName tok-definition"},{tag:$f.special($f.variableName),class:"tok-variableName2"},{tag:$f.definition($f.propertyName),class:"tok-propertyName tok-definition"},{tag:$f.typeName,class:"tok-typeName"},{tag:$f.namespace,class:"tok-namespace"},{tag:$f.className,class:"tok-className"},{tag:$f.macroName,class:"tok-macroName"},{tag:$f.propertyName,class:"tok-propertyName"},{tag:$f.operator,class:"tok-operator"},{tag:$f.comment,class:"tok-comment"},{tag:$f.meta,class:"tok-meta"},{tag:$f.invalid,class:"tok-invalid"},{tag:$f.punctuation,class:"tok-punctuation"}]);const kf=new yd;function Pf(e){return Ts.define({combine:e?t=>t.concat(e):void 0})}const Tf=new yd;class _f{constructor(e,t,n=[],i=""){this.data=e,this.name=i,go.prototype.hasOwnProperty("tree")||Object.defineProperty(go.prototype,"tree",{get(){return Xf(this)}}),this.parser=t,this.extension=[Df.of(this),go.languageData.of(((e,t,n)=>{let i=Zf(e,t,n),r=i.type.prop(kf);if(!r)return[];let s=e.facet(r),o=i.type.prop(Tf);if(o){let r=i.resolve(t-i.from,n);for(let t of o)if(t.test(r,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(s)}}return s}))].concat(n)}isActiveAt(e,t,n=-1){return Zf(e,t,n).type.prop(kf)==this.data}findRegions(e){let t=e.facet(Df);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],i=(e,t)=>{if(e.prop(kf)==this.data)return void n.push({from:t,to:t+e.length});let r=e.prop(yd.mounted);if(r){if(r.tree.prop(kf)==this.data){if(r.overlay)for(let e of r.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(r.overlay){let e=n.length;if(i(r.tree,r.overlay[0].from+t),n.length>e)return}}for(let n=0;ne.isTop?t:void 0))]}),e.name)}configure(e,t){return new Cf(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xf(e){let t=e.field(_f.state,!1);return t?t.tree:Zd.empty}class Yf{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let Rf=null;class qf{constructor(e,t,n=[],i,r,s,o,a){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=r,this.viewport=s,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new qf(e,t,[],Zd.empty,0,n,[],null)}startParse(){return this.parser.startParse(new Yf(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=Zd.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext((()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext((()=>{for(;!(t=this.parse.advance()););})),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Ld.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Rf;Rf=this;try{return e()}finally{Rf=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Af(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:r,viewport:s,skipped:o}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges(((e,n,i,r)=>t.push({fromA:e,toA:n,fromB:i,toB:r}))),n=Ld.applyChanges(n,t),i=Zd.empty,r=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){o=[];for(let t of this.skipped){let n=e.mapPos(t.from,1),i=e.mapPos(t.to,-1);ne.from&&(this.fragments=Af(this.fragments,n,i),this.skipped.splice(t--,1))}return!(this.skipped.length>=t)&&(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Fd{createParse(t,n,i){let r=i[0].from,s=i[i.length-1].to;return{parsedPos:r,advance(){let t=Rf;if(t){for(let e of i)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=s,new Zd(Qd.none,[],[],s-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return Rf}}function Af(e,t,n){return Ld.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class Wf{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new Wf(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=qf.create(e.facet(Df).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new Wf(n)}}_f.state=qs.define({create:Wf.init,update(e,t){for(let e of t.effects)if(e.is(_f.setState))return e.value;return t.startState.facet(Df)!=t.state.facet(Df)?Wf.init(t.state):e.apply(t)}});let Ef=e=>{let t=setTimeout((()=>e()),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(Ef=e=>{let t=-1,n=setTimeout((()=>{t=requestIdleCallback(e,{timeout:400})}),100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const jf="undefined"!=typeof navigator&&(null===(Qf=navigator.scheduling)||void 0===Qf?void 0:Qf.isInputPending)?()=>navigator.scheduling.isInputPending():null,zf=xl.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(_f.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(_f.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=Ef(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndi+1e3,a=r.context.work((()=>jf&&jf()||Date.now()>s),i+(o?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:_f.setState.of(new Wf(r.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then((()=>this.scheduleWork())).catch((e=>ml(this.view.state,e))).then((()=>this.workScheduled--)),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Df=Ts.define({combine:e=>e.length?e[0]:null,enables:e=>[_f.state,zf,Xh.contentAttributes.compute([e],(t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}}))]});class Uf{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const Vf=Ts.define(),If=Ts.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some((e=>e!=t[0])))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function Mf(e){let t=e.facet(If);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function Gf(e,t){let n="",i=e.tabSize,r=e.facet(If)[0];if("\t"==r){for(;t>=i;)n+="\t",t-=i;r=" "}for(let e=0;e=t?function(e,t,n){let i=t.resolveStack(n),r=i.node.enterUnfinishedNodesBefore(n);if(r!=i.node){let e=[];for(let t=r;t!=i.node;t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)i={node:e[t],next:i}}return Ff(i,e,n)}(e,n,t):null}class Nf{constructor(e,t={}){this.state=e,this.options=t,this.unit=Mf(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:r}=this.options;return null!=i&&i>=n.from&&i<=n.to?r&&i==e?{text:"",from:e}:(t<0?i-1&&(r+=s-this.countColumn(n,n.search(/\S|$/))),r}countColumn(e,t=e.length){return qo(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let e=r(i);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Lf=new yd;function Ff(e,t,n){for(let i=e;i;i=i.next){let e=Hf(i.node);if(e)return e(Jf.create(t,n,i))}return 0}function Hf(e){let t=e.type.prop(Lf);if(t)return t;let n,i=e.firstChild;if(i&&(n=i.type.prop(yd.closedBy))){let t=e.lastChild,i=t&&n.indexOf(t.name)>-1;return e=>nO(e,!0,1,void 0,i&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?Kf:null}function Kf(){return 0}class Jf extends Nf{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new Jf(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(eO(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return Ff(this.context.next,this.base,this.pos)}}function eO(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function tO({closing:e,align:t=!0,units:n=1}){return i=>nO(i,t,n,e)}function nO(e,t,n,i,r){let s=e.textAfter,o=s.match(/^\s*/)[0].length,a=i&&s.slice(o,o+i.length)==i||r==e.pos+o,l=t?function(e){let t=e.node,n=t.childAfter(t.from),i=t.lastChild;if(!n)return null;let r=e.options.simulateBreak,s=e.state.doc.lineAt(n.from),o=null==r||r<=s.from?s.to:Math.min(s.to,r);for(let e=n.to;;){let r=t.childAfter(e);if(!r||r==i)return null;if(!r.type.isSkipped)return r.from{let i=e&&e.test(n.textAfter);return n.baseIndent+(i?0:t*n.unit)}}const rO=Ts.define(),sO=new yd;function oO(e){let t=e.firstChild,n=e.lastChild;return t&&t.ton)continue;if(r&&o.from=t&&i.to>n&&(r=i)}}return r}(e,t,n)}function cO(e,t){let n=t.mapPos(e.from,1),i=t.mapPos(e.to,-1);return n>=i?void 0:{from:n,to:i}}const hO=ro.define({map:cO}),uO=ro.define({map:cO});function dO(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some((e=>e.from<=n&&e.to>=n))||t.push(e.lineBlockAt(n));return t}const fO=qs.define({create:()=>Fa.none,update(e,t){e=e.map(t.changes);for(let n of t.effects)if(n.is(hO)&&!pO(e,n.value.from,n.value.to)){let{preparePlaceholder:i}=t.state.facet(xO),r=i?Fa.replace({widget:new $O(i(t.state,n.value))}):SO;e=e.update({add:[r.range(n.value.from,n.value.to)]})}else n.is(uO)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));if(t.selection){let n=!1,{head:i}=t.selection.main;e.between(i,i,((e,t)=>{ei&&(n=!0)})),n&&(e=e.update({filterFrom:i,filterTo:i,filter:(e,t)=>t<=i||e>=i}))}return e},provide:e=>Xh.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,((e,t)=>{n.push(e,t)})),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n{(!r||r.from>e)&&(r={from:e,to:t})})),r}function pO(e,t,n){let i=!1;return e.between(t,t,((e,r)=>{e==t&&r==n&&(i=!0)})),i}function mO(e,t){return e.field(fO,!1)?t:t.concat(ro.appendConfig.of(vO()))}function gO(e,t,n=!0){let i=e.state.doc.lineAt(t.from).number,r=e.state.doc.lineAt(t.to).number;return Xh.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${i} ${e.state.phrase("to")} ${r}.`)}const bO=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of dO(e)){let n=lO(e.state,t.from,t.to);if(n)return e.dispatch({effects:mO(e.state,[hO.of(n),gO(e,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field(fO,!1))return!1;let t=[];for(let n of dO(e)){let i=OO(e.state,n.from,n.to);i&&t.push(uO.of(i),gO(e,i,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,n=[];for(let i=0;i{let t=e.state.field(fO,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,((e,t)=>{n.push(uO.of({from:e,to:t}))})),e.dispatch({effects:n}),!0}}],wO={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},xO=Ts.define({combine:e=>bo(e,wO)});function vO(e){let t=[fO,TO];return e&&t.push(xO.of(e)),t}function yO(e,t){let{state:n}=e,i=n.facet(xO),r=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),i=OO(e.state,n.from,n.to);i&&e.dispatch({effects:uO.of(i)}),t.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(e,r,t);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=r,s}const SO=Fa.replace({widget:new class extends Na{toDOM(e){return yO(e,null)}}});class $O extends Na{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return yO(e,this.value)}}const QO={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class kO extends Hu{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function PO(e={}){let t=Object.assign(Object.assign({},QO),e),n=new kO(t,!0),i=new kO(t,!1),r=xl.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(Df)!=e.state.facet(Df)||e.startState.field(fO,!1)!=e.state.field(fO,!1)||Xf(e.startState)!=Xf(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new $o;for(let r of e.viewportLineBlocks){let s=OO(e.state,r.from,r.to)?i:lO(e.state,r.from,r.to)?n:null;s&&t.add(r.from,r.from,s)}return t.finish()}}),{domEventHandlers:s}=t;return[r,td({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(r))||void 0===t?void 0:t.markers)||So.empty},initialSpacer:()=>new kO(t,!1),domEventHandlers:Object.assign(Object.assign({},s),{click:(e,t,n)=>{if(s.click&&s.click(e,t,n))return!0;let i=OO(e.state,t.from,t.to);if(i)return e.dispatch({effects:uO.of(i)}),!0;let r=lO(e.state,t.from,t.to);return!!r&&(e.dispatch({effects:hO.of(r)}),!0)}})}),vO()]}const TO=Xh.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class _O{constructor(e,t){let n;function i(e){let t=zo.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const r="string"==typeof t.all?t.all:t.all?i(t.all):void 0,s=t.scope;this.scope=s instanceof _f?e=>e.prop(kf)==s.data:s?e=>e==s:void 0,this.style=of(e.map((e=>({tag:e.tag,class:e.class||i(Object.assign({},e,{tag:null}))}))),{all:r}).style,this.module=n?new zo(n):null,this.themeType=t.themeType}static define(e,t){return new _O(e,t||{})}}const ZO=Ts.define(),CO=Ts.define({combine:e=>e.length?[e[0]]:null});function XO(e){let t=e.facet(ZO);return t.length?t:e.facet(CO)}function YO(e,t){let n,i=[qO];return e instanceof _O&&(e.module&&i.push(Xh.styleModule.of(e.module)),n=e.themeType),(null==t?void 0:t.fallback)?i.push(CO.of(e)):n?i.push(ZO.computeN([Xh.darkTheme],(t=>t.facet(Xh.darkTheme)==("dark"==n)?[e]:[]))):i.push(ZO.of(e)),i}class RO{constructor(e){this.markCache=Object.create(null),this.tree=Xf(e.state),this.decorations=this.buildDeco(e,XO(e.state))}update(e){let t=Xf(e.state),n=XO(e.state),i=n!=XO(e.startState);t.length{n.add(e,t,this.markCache[i]||(this.markCache[i]=Fa.mark({class:i})))}),i,r);return n.finish()}}const qO=Ds.high(xl.fromClass(RO,{decorations:e=>e.decorations})),AO=_O.define([{tag:$f.meta,color:"#404740"},{tag:$f.link,textDecoration:"underline"},{tag:$f.heading,textDecoration:"underline",fontWeight:"bold"},{tag:$f.emphasis,fontStyle:"italic"},{tag:$f.strong,fontWeight:"bold"},{tag:$f.strikethrough,textDecoration:"line-through"},{tag:$f.keyword,color:"#708"},{tag:[$f.atom,$f.bool,$f.url,$f.contentSeparator,$f.labelName],color:"#219"},{tag:[$f.literal,$f.inserted],color:"#164"},{tag:[$f.string,$f.deleted],color:"#a11"},{tag:[$f.regexp,$f.escape,$f.special($f.string)],color:"#e40"},{tag:$f.definition($f.variableName),color:"#00f"},{tag:$f.local($f.variableName),color:"#30a"},{tag:[$f.typeName,$f.namespace],color:"#085"},{tag:$f.className,color:"#167"},{tag:[$f.special($f.variableName),$f.macroName],color:"#256"},{tag:$f.definition($f.propertyName),color:"#00c"},{tag:$f.comment,color:"#940"},{tag:$f.invalid,color:"#f00"}]),WO=Xh.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),EO="()[]{}",jO=Ts.define({combine:e=>bo(e,{afterCursor:!0,brackets:EO,maxScanDistance:1e4,renderMatch:UO})}),zO=Fa.mark({class:"cm-matchingBracket"}),DO=Fa.mark({class:"cm-nonmatchingBracket"});function UO(e){let t=[],n=e.matched?zO:DO;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}const VO=qs.define({create:()=>Fa.none,update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],i=t.state.facet(jO);for(let e of t.state.selection.ranges){if(!e.empty)continue;let r=LO(t.state,e.head,-1,i)||e.head>0&&LO(t.state,e.head-1,1,i)||i.afterCursor&&(LO(t.state,e.head,1,i)||e.headXh.decorations.from(e)}),IO=[VO,WO];function MO(e={}){return[jO.of(e),IO]}const GO=new yd;function BO(e,t,n){let i=e.prop(t<0?yd.openedBy:yd.closedBy);if(i)return i;if(1==e.name.length){let i=n.indexOf(e.name);if(i>-1&&i%2==(t<0?1:0))return[n[i+t]]}return null}function NO(e){let t=e.type.prop(GO);return t?t(e.node):e}function LO(e,t,n,i={}){let r=i.maxScanDistance||1e4,s=i.brackets||EO,o=Xf(e),a=o.resolveInner(t,n);for(let i=a;i;i=i.parent){let r=BO(i.type,n,s);if(r&&i.from0?t>=o.from&&to.from&&t<=o.to))return FO(e,t,n,i,o,r,s)}}return function(e,t,n,i,r,s,o){let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=o.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},h=e.doc.iterRange(t,n>0?e.doc.length:0),u=0;for(let e=0;!h.next().done&&e<=s;){let s=h.value;n<0&&(e+=s.length);let a=t+e*n;for(let e=n>0?0:s.length-1,t=n>0?s.length:-1;e!=t;e+=n){let t=o.indexOf(s[e]);if(!(t<0||i.resolveInner(a+e,1).type!=r))if(t%2==0==n>0)u++;else{if(1==u)return{start:c,end:{from:a+e,to:a+e+1},matched:t>>1==l>>1};u--}}n>0&&(e+=s.length)}return h.done?{start:c,matched:!1}:null}(e,t,n,o,a.type,r,s)}function FO(e,t,n,i,r,s,o){let a=i.parent,l={from:r.from,to:r.to},c=0,h=null==a?void 0:a.cursor();if(h&&(n<0?h.childBefore(i.from):h.childAfter(i.to)))do{if(n<0?h.to<=i.from:h.from>=i.to){if(0==c&&s.indexOf(h.type.name)>-1&&h.from-1||(JO.push(e),console.warn(t))}function np(e,t){let n=null;for(let i of t.split(".")){let t=e[i]||$f[i];t?"function"==typeof t?n?n=t(n):tp(i,`Modifier ${i} used at start of tag`):n?tp(i,`Tag ${i} used as modifier`):n=t:tp(i,`Unknown highlighting tag ${i}`)}if(!n)return 0;let i=t.replace(/ /g,"_"),r=Qd.define({id:KO.length,name:i,props:[nf({[i]:n})]});return KO.push(r),r.id}function ip(e,t){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let r=e(t,n);return!!r&&(i(n.update(r)),!0)}}const rp=ip(cp,0),sp=ip(lp,0),op=ip(((e,t)=>lp(e,t,function(e){let t=[];for(let n of e.selection.ranges){let i=e.doc.lineAt(n.from),r=n.to<=i.to?i:e.doc.lineAt(n.to),s=t.length-1;s>=0&&t[s].to>i.from?t[s].to=r.to:t.push({from:i.from,to:r.to})}return t}(t))),0);function ap(e,t=e.selection.main.head){let n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}function lp(e,t,n=t.selection.ranges){let i=n.map((e=>ap(t,e.from).block));if(!i.every((e=>e)))return null;let r=n.map(((e,n)=>function(e,{open:t,close:n},i,r){let s,o,a=e.sliceDoc(i-50,i),l=e.sliceDoc(r,r+50),c=/\s*$/.exec(a)[0].length,h=/^\s*/.exec(l)[0].length,u=a.length-c;if(a.slice(u-t.length,u)==t&&l.slice(h,h+n.length)==n)return{open:{pos:i-c,margin:c&&1},close:{pos:r+h,margin:h&&1}};r-i<=100?s=o=e.sliceDoc(i,r):(s=e.sliceDoc(i,i+50),o=e.sliceDoc(r-50,r));let d=/^\s*/.exec(s)[0].length,f=/\s*$/.exec(o)[0].length,O=o.length-f-n.length;return s.slice(d,d+t.length)==t&&o.slice(O,O+n.length)==n?{open:{pos:i+d+t.length,margin:/\s/.test(s.charAt(d+t.length))?1:0},close:{pos:r-f-n.length,margin:/\s/.test(o.charAt(O-1))?1:0}}:null}(t,i[n],e.from,e.to)));if(2!=e&&!r.every((e=>e)))return{changes:t.changes(n.map(((e,t)=>r[t]?[]:[{from:e.from,insert:i[t].open+" "},{from:e.to,insert:" "+i[t].close}])))};if(1!=e&&r.some((e=>e))){let e=[];for(let t,n=0;nr&&(e==s||s>a.from)){r=a.from;let e=ap(t,n).line;if(!e)continue;let s=/^\s*/.exec(a.text)[0].length,l=s==a.length,c=a.text.slice(s,s+e.length)==e?s:-1;se.comment<0&&(!e.empty||e.single)))){let e=[];for(let{line:t,token:n,indent:r,empty:s,single:o}of i)!o&&s||e.push({from:t.from+r,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&i.some((e=>e.comment>=0))){let e=[];for(let{line:t,comment:n,token:r}of i)if(n>=0){let i=t.from+n,s=i+r.length;" "==t.text[s-t.from]&&s++,e.push({from:i,to:s})}return{changes:e}}return null}const hp=to.define(),up=to.define(),dp=Ts.define(),fp=Ts.define({combine:e=>bo(e,{minDepth:100,newGroupDelay:500},{minDepth:Math.max,newGroupDelay:Math.min})});const Op=qs.define({create:()=>Zp.empty,update(e,t){let n=t.state.facet(fp),i=t.annotation(hp);if(i){let r=t.docChanged?Qs.single(function(e){let t=0;return e.iterChangedRanges(((e,n)=>t=n)),t}(t.changes)):void 0,s=vp.fromTransaction(t,r),o=i.side,a=0==o?e.undone:e.done;return a=s?yp(a,a.length,n.minDepth,s):Qp(a,t.startState.selection),new Zp(0==o?i.rest:a,0==o?a:i.rest)}let r=t.annotation(up);if("full"!=r&&"before"!=r||(e=e.isolate()),!1===t.annotation(so.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let s=vp.fromTransaction(t),o=t.annotation(so.time),a=t.annotation(so.userEvent);return s?e=e.addChanges(s,o,a,n.newGroupDelay,n.minDepth):t.selection&&(e=e.addSelection(t.startState.selection,o,a,n.newGroupDelay)),"full"!=r&&"after"!=r||(e=e.isolate()),e},toJSON:e=>({done:e.done.map((e=>e.toJSON())),undone:e.undone.map((e=>e.toJSON()))}),fromJSON:e=>new Zp(e.done.map(vp.fromJSON),e.undone.map(vp.fromJSON))});function pp(e={}){return[Op,fp.of(e),Xh.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?gp:"historyRedo"==e.inputType?bp:null;return!!n&&(e.preventDefault(),n(t))}})]}function mp(e,t){return function({state:n,dispatch:i}){if(!t&&n.readOnly)return!1;let r=n.field(Op,!1);if(!r)return!1;let s=r.pop(e,n,t);return!!s&&(i(s),!0)}}const gp=mp(0,!1),bp=mp(1,!1),wp=mp(0,!0),xp=mp(1,!0);class vp{constructor(e,t,n,i,r){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=i,this.selectionsAfter=r}setSelAfter(e){return new vp(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((e=>e.toJSON()))}}static fromJSON(e){return new vp(e.changes&&gs.fromJSON(e.changes),[],e.mapped&&ms.fromJSON(e.mapped),e.startSelection&&Qs.fromJSON(e.startSelection),e.selectionsAfter.map(Qs.fromJSON))}static fromTransaction(e,t){let n=$p;for(let t of e.startState.facet(dp)){let i=t(e);i.length&&(n=n.concat(i))}return!n.length&&e.changes.empty?null:new vp(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,$p)}static selection(e){return new vp(void 0,$p,void 0,void 0,e)}}function yp(e,t,n,i){let r=t+1>n+20?t-n-1:0,s=e.slice(r,t);return s.push(i),s}function Sp(e,t){return e.length?t.length?e.concat(t):e:t}const $p=[];function Qp(e,t){if(e.length){let n=e[e.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return i.length&&i[i.length-1].eq(t)?e:(i.push(t),yp(e,e.length-1,1e9,n.setSelAfter(i)))}return[vp.selection([t])]}function kp(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Pp(e,t){if(!e.length)return e;let n=e.length,i=$p;for(;n;){let r=Tp(e[n-1],t,i);if(r.changes&&!r.changes.empty||r.effects.length){let t=e.slice(0,n);return t[n-1]=r,t}t=r.mapped,n--,i=r.selectionsAfter}return i.length?[vp.selection(i)]:$p}function Tp(e,t,n){let i=Sp(e.selectionsAfter.length?e.selectionsAfter.map((e=>e.map(t))):$p,n);if(!e.changes)return vp.selection(i);let r=e.changes.map(t),s=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(s):s;return new vp(r,ro.mapEffects(e.effects,t),o,e.startSelection.map(s),i)}const _p=/^(input\.type|delete)($|\.)/;class Zp{constructor(e,t,n=0,i){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new Zp(this.done,this.undone):this}addChanges(e,t,n,i,r){let s=this.done,o=s[s.length-1];return s=o&&o.changes&&!o.changes.empty&&e.changes&&(!n||_p.test(n))&&(!o.selectionsAfter.length&&t-this.prevTimen.push(e,t))),t.iterChangedRanges(((e,t,r,s)=>{for(let e=0;e=t&&r<=o&&(i=!0)}})),i}(o.changes,e.changes)||"input.type.compose"==n)?yp(s,s.length-1,r,new vp(e.changes.compose(o.changes),Sp(e.effects,o.effects),o.mapped,o.startSelection,$p)):yp(s,s.length,r,e),new Zp(s,$p,t,n)}addSelection(e,t,n,i){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:$p;return r.length>0&&t-this.prevTimee.empty!=o.ranges[t].empty)).length)?this:new Zp(Qp(this.done,e),this.undone,t,n);var s,o}addMapping(e){return new Zp(Pp(this.done,e),Pp(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let i=0==e?this.done:this.undone;if(0==i.length)return null;let r=i[i.length-1];if(n&&r.selectionsAfter.length)return t.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:hp.of({side:e,rest:kp(i)}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let n=1==i.length?$p:i.slice(0,i.length-1);return r.mapped&&(n=Pp(n,r.mapped)),t.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:hp.of({side:e,rest:n}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}Zp.empty=new Zp($p,$p);const Cp=[{key:"Mod-z",run:gp,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:bp,preventDefault:!0},{linux:"Ctrl-Shift-z",run:bp,preventDefault:!0},{key:"Mod-u",run:wp,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:xp,preventDefault:!0}];function Xp(e,t){return Qs.create(e.ranges.map(t),e.mainIndex)}function Yp(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Rp({state:e,dispatch:t},n){let i=Xp(e.selection,n);return!i.eq(e.selection)&&(t(Yp(e,i)),!0)}function qp(e,t){return Qs.cursor(t?e.to:e.from)}function Ap(e,t){return Rp(e,(n=>n.empty?e.moveByChar(n,t):qp(n,t)))}function Wp(e){return e.textDirectionAt(e.state.selection.main.head)==Yl.LTR}const Ep=e=>Ap(e,!Wp(e)),jp=e=>Ap(e,Wp(e));function zp(e,t){return Rp(e,(n=>n.empty?e.moveByGroup(n,t):qp(n,t)))}function Dp(e,t,n){if(t.type.prop(n))return!0;let i=t.to-t.from;return i&&(i>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Up(e,t,n){let i,r,s=Xf(e).resolveInner(t.head),o=n?yd.closedBy:yd.openedBy;for(let i=t.head;;){let t=n?s.childAfter(i):s.childBefore(i);if(!t)break;Dp(e,t,o)?s=t:i=n?t.to:t.from}return r=s.type.prop(o)&&(i=n?LO(e,s.from,1):LO(e,s.to,-1))&&i.matched?n?i.end.to:i.end.from:n?s.to:s.from,Qs.cursor(r,n?-1:1)}function Vp(e,t){return Rp(e,(n=>{if(!n.empty)return qp(n,t);let i=e.moveVertically(n,t);return i.head!=n.head?i:e.moveToLineBoundary(n,t)}))}const Ip=e=>Vp(e,!1),Mp=e=>Vp(e,!0);function Gp(e){return Math.max(e.defaultLineHeight,Math.min(e.dom.clientHeight,innerHeight)-5)}function Bp(e,t){let{state:n}=e,i=Xp(n.selection,(n=>n.empty?e.moveVertically(n,t,Gp(e)):qp(n,t)));if(i.eq(n.selection))return!1;let r,s=e.coordsAtPos(n.selection.main.head),o=e.scrollDOM.getBoundingClientRect();return s&&s.top>o.top&&s.bottomBp(e,!1),Lp=e=>Bp(e,!0);function Fp(e,t,n){let i=e.lineBlockAt(t.head),r=e.moveToLineBoundary(t,n);if(r.head==t.head&&r.head!=(n?i.to:i.from)&&(r=e.moveToLineBoundary(t,n,!1)),!n&&r.head==i.from&&i.length){let n=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;n&&t.head!=i.from+n&&(r=Qs.cursor(i.from+n))}return r}function Hp(e,t){let n=Xp(e.state.selection,(e=>{let n=t(e);return Qs.range(e.anchor,n.head,n.goalColumn)}));return!n.eq(e.state.selection)&&(e.dispatch(Yp(e.state,n)),!0)}function Kp(e,t){return Hp(e,(n=>e.moveByChar(n,t)))}const Jp=e=>Kp(e,!Wp(e)),em=e=>Kp(e,Wp(e));function tm(e,t){return Hp(e,(n=>e.moveByGroup(n,t)))}function nm(e,t){return Hp(e,(n=>e.moveVertically(n,t)))}const im=e=>nm(e,!1),rm=e=>nm(e,!0);function sm(e,t){return Hp(e,(n=>e.moveVertically(n,t,Gp(e))))}const om=e=>sm(e,!1),am=e=>sm(e,!0),lm=({state:e,dispatch:t})=>(t(Yp(e,{anchor:0})),!0),cm=({state:e,dispatch:t})=>(t(Yp(e,{anchor:e.doc.length})),!0),hm=({state:e,dispatch:t})=>(t(Yp(e,{anchor:e.selection.main.anchor,head:0})),!0),um=({state:e,dispatch:t})=>(t(Yp(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function dm(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,r=i.changeByRange((i=>{let{from:r,to:s}=i;if(r==s){let i=t(r);ir&&(n="delete.forward",i=fm(e,i,!0)),r=Math.min(r,i),s=Math.max(s,i)}else r=fm(e,r,!1),s=fm(e,s,!0);return r==s?{range:i}:{changes:{from:r,to:s},range:Qs.cursor(r)}}));return!r.changes.empty&&(e.dispatch(i.update(r,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?Xh.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function fm(e,t,n){if(e instanceof Xh)for(let i of e.state.facet(Xh.atomicRanges).map((t=>t(e))))i.between(t,t,((e,i)=>{et&&(t=n?i:e)}));return t}const Om=(e,t)=>dm(e,(n=>{let i,r,{state:s}=e,o=s.doc.lineAt(n);if(!t&&n>o.from&&nOm(e,!1),mm=e=>Om(e,!0),gm=(e,t)=>dm(e,(n=>{let i=n,{state:r}=e,s=r.doc.lineAt(i),o=r.charCategorizer(i);for(let e=null;;){if(i==(t?s.to:s.from)){i==n&&s.number!=(t?r.doc.lines:1)&&(i+=t?1:-1);break}let a=os(s.text,i-s.from,t)+s.from,l=s.text.slice(Math.min(i,a)-s.from,Math.max(i,a)-s.from),c=o(l);if(null!=e&&c!=e)break;" "==l&&i==n||(e=c),i=a}return i})),bm=e=>gm(e,!1),wm=e=>dm(e,(t=>{let n=e.lineBlockAt(t).to;return t=r.number){let e=t[t.length-1];e.to=s.to,e.ranges.push(i)}else t.push({from:r.from,to:s.to,ranges:[i]});n=s.number+1}return t}function vm(e,t,n){if(e.readOnly)return!1;let i=[],r=[];for(let t of xm(e)){if(n?t.to==e.doc.length:0==t.from)continue;let s=e.doc.lineAt(n?t.to+1:t.from-1),o=s.length+1;if(n){i.push({from:t.to,to:s.to},{from:t.from,insert:s.text+e.lineBreak});for(let n of t.ranges)r.push(Qs.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{i.push({from:s.from,to:t.from},{from:t.to,insert:e.lineBreak+s.text});for(let e of t.ranges)r.push(Qs.range(e.anchor-o,e.head-o))}}return!!i.length&&(t(e.update({changes:i,scrollIntoView:!0,selection:Qs.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0)}function ym(e,t,n){if(e.readOnly)return!1;let i=[];for(let t of xm(e))n?i.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):i.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});return t(e.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Sm=Qm(!1),$m=Qm(!0);function Qm(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=t.changeByRange((n=>{let{from:i,to:r}=n,s=t.doc.lineAt(i),o=!e&&i==r&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,i=Xf(e).resolveInner(t),r=i.childBefore(t),s=i.childAfter(t);return r&&s&&r.to<=t&&s.from>=t&&(n=r.type.prop(yd.closedBy))&&n.indexOf(s.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(s.from).from?{from:r.to,to:s.from}:null}(t,i);e&&(i=r=(r<=s.to?s:t.doc.lineAt(r)).to);let a=new Nf(t,{simulateBreak:i,simulateDoubleBreak:!!o}),l=Bf(a,i);for(null==l&&(l=/^\s*/.exec(t.doc.lineAt(i).text)[0].length);rs.from&&i{let r=[];for(let s=i.from;s<=i.to;){let o=e.doc.lineAt(s);o.number>n&&(i.empty||i.to>o.from)&&(t(o,r,i),n=o.number),s=o.to+1}let s=e.changes(r);return{changes:r,range:Qs.range(s.mapPos(i.anchor,1),s.mapPos(i.head,1))}}))}const Pm=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(km(e,((t,n)=>{n.push({from:t.from,insert:e.facet(If)})})),{userEvent:"input.indent"})),!0),Tm=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(km(e,((t,n)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let r=qo(i,e.tabSize),s=0,o=Gf(e,Math.max(0,r-Mf(e)));for(;sRp(e,(t=>Qs.cursor(e.lineBlockAt(t.head).from,1))),shift:e=>Hp(e,(t=>Qs.cursor(e.lineBlockAt(t.head).from)))},{key:"Ctrl-e",run:e=>Rp(e,(t=>Qs.cursor(e.lineBlockAt(t.head).to,-1))),shift:e=>Hp(e,(t=>Qs.cursor(e.lineBlockAt(t.head).to)))},{key:"Ctrl-d",run:mm},{key:"Ctrl-h",run:pm},{key:"Ctrl-k",run:wm},{key:"Ctrl-Alt-h",run:bm},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:Nr.of(["",""])},range:Qs.cursor(e.from)})));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,i=e.doc.lineAt(n),r=n==i.from?n-1:os(i.text,n-i.from,!1)+i.from,s=n==i.to?n+1:os(i.text,n-i.from,!0)+i.from;return{changes:{from:r,to:s,insert:e.doc.slice(n,s).append(e.doc.slice(r,n))},range:Qs.cursor(s)}}));return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:Lp}],Zm=[{key:"ArrowLeft",run:Ep,shift:Jp,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>zp(e,!Wp(e)),shift:e=>tm(e,!Wp(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>Rp(e,(t=>Fp(e,t,!Wp(e)))),shift:e=>Hp(e,(t=>Fp(e,t,!Wp(e)))),preventDefault:!0},{key:"ArrowRight",run:jp,shift:em,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>zp(e,Wp(e)),shift:e=>tm(e,Wp(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>Rp(e,(t=>Fp(e,t,Wp(e)))),shift:e=>Hp(e,(t=>Fp(e,t,Wp(e)))),preventDefault:!0},{key:"ArrowUp",run:Ip,shift:im,preventDefault:!0},{mac:"Cmd-ArrowUp",run:lm,shift:hm},{mac:"Ctrl-ArrowUp",run:Np,shift:om},{key:"ArrowDown",run:Mp,shift:rm,preventDefault:!0},{mac:"Cmd-ArrowDown",run:cm,shift:um},{mac:"Ctrl-ArrowDown",run:Lp,shift:am},{key:"PageUp",run:Np,shift:om},{key:"PageDown",run:Lp,shift:am},{key:"Home",run:e=>Rp(e,(t=>Fp(e,t,!1))),shift:e=>Hp(e,(t=>Fp(e,t,!1))),preventDefault:!0},{key:"Mod-Home",run:lm,shift:hm},{key:"End",run:e=>Rp(e,(t=>Fp(e,t,!0))),shift:e=>Hp(e,(t=>Fp(e,t,!0))),preventDefault:!0},{key:"Mod-End",run:cm,shift:um},{key:"Enter",run:Sm},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:pm,shift:pm},{key:"Delete",run:mm},{key:"Mod-Backspace",mac:"Alt-Backspace",run:bm},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>gm(e,!0)},{mac:"Mod-Backspace",run:e=>dm(e,(t=>{let n=e.lineBlockAt(t).from;return t>n?n:Math.max(0,t-1)}))},{mac:"Mod-Delete",run:wm}].concat(_m.map((e=>({mac:e.key,run:e.run,shift:e.shift})))),Cm=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>Rp(e,(t=>Up(e.state,t,!Wp(e)))),shift:e=>Hp(e,(t=>Up(e.state,t,!Wp(e))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>Rp(e,(t=>Up(e.state,t,Wp(e)))),shift:e=>Hp(e,(t=>Up(e.state,t,Wp(e))))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>vm(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>ym(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>vm(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>ym(e,t,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,i=null;return n.ranges.length>1?i=Qs.create([n.main]):n.main.empty||(i=Qs.create([Qs.cursor(n.main.head)])),!!i&&(t(Yp(e,i)),!0)}},{key:"Mod-Enter",run:$m},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=xm(e).map((({from:t,to:n})=>Qs.range(t,Math.min(n+1,e.doc.length))));return t(e.update({selection:Qs.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=Xp(e.selection,(t=>{var n;let i=Xf(e).resolveInner(t.head,1);for(;!(i.from=t.to||i.to>t.to&&i.from<=t.from)&&(null===(n=i.parent)||void 0===n?void 0:n.parent);)i=i.parent;return Qs.range(i.to,i.from)}));return t(Yp(e,n)),!0},preventDefault:!0},{key:"Mod-[",run:Tm},{key:"Mod-]",run:Pm},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),i=new Nf(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),r=km(e,((t,r,s)=>{let o=Bf(i,t.from);if(null==o)return;/\S/.test(t.text)||(o=0);let a=/^\s*/.exec(t.text)[0],l=Gf(e,o);(a!=l||s.from{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(xm(t).map((({from:e,to:n})=>(e>0?e--:ne.moveVertically(t,!0))).map(n);return e.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t,n){let i=!1,r=Xp(e.selection,(t=>{let r=LO(e,t.head,-1)||LO(e,t.head,1)||t.head>0&&LO(e,t.head-1,1)||t.head{let t=ap(e.state);return t.line?rp(e):!!t.block&&op(e)}},{key:"Alt-A",run:sp}].concat(Zm),Xm={key:"Tab",run:Pm,shift:Tm};function Ym(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var r=n[i];"string"==typeof r?e.setAttribute(i,r):null!=r&&(e[i]=r)}t++}for(;te.normalize("NFKD"):e=>e;class Am{constructor(e,t,n=0,i=e.length,r,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,i),this.bufferStart=n,this.normalize=r?e=>r(qm(e)):qm,this.query=this.normalize(t)}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 us(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 t=ds(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=fs(e);let i=this.normalize(t);for(let e=0,r=n;;e++){let s=i.charCodeAt(e),o=this.match(s,r);if(o)return this.value=o,this;if(e==i.length-1)break;r==n&&ethis.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 t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,i=n+t[0].length;if(this.matchPos=Vm(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,i,t)))return this.value={from:n,to:i,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length=n||i.to<=t){let i=new Dm(t,e.sliceString(t,n));return zm.set(e,i),i}if(i.from==t&&i.to==n)return i;let{text:r,from:s}=i;return s>t&&(r=e.sliceString(t,s)+r,s=t),i.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=Vm(this.text,n+(e==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Dm.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function Vm(e,t){if(t>=e.length)return t;let n,i=e.lineAt(t);for(;t=56320&&n<57344;)t++;return t}function Im(e){let t=Ym("input",{class:"cm-textfield",name:"line"});function n(){let n=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!n)return;let{state:i}=e,r=i.doc.lineAt(i.selection.main.head),[,s,o,a,l]=n,c=a?+a.slice(1):0,h=o?+o:r.number;if(o&&l){let e=h/100;s&&(e=e*("-"==s?-1:1)+r.number/i.doc.lines),h=Math.round(i.doc.lines*e)}else o&&s&&(h=h*("-"==s?-1:1)+r.number);let u=i.doc.line(Math.max(1,Math.min(i.doc.lines,h)));e.dispatch({effects:Mm.of(!1),selection:Qs.cursor(u.from+Math.max(0,Math.min(c,u.length))),scrollIntoView:!0}),e.focus()}return{dom:Ym("form",{class:"cm-gotoLine",onkeydown:t=>{27==t.keyCode?(t.preventDefault(),e.dispatch({effects:Mm.of(!1)}),e.focus()):13==t.keyCode&&(t.preventDefault(),n())},onsubmit:e=>{e.preventDefault(),n()}},Ym("label",e.state.phrase("Go to line"),": ",t)," ",Ym("button",{class:"cm-button",type:"submit"},e.state.phrase("go")))}}"undefined"!=typeof Symbol&&(jm.prototype[Symbol.iterator]=Um.prototype[Symbol.iterator]=function(){return this});const Mm=ro.define(),Gm=qs.define({create:()=>!0,update(e,t){for(let n of t.effects)n.is(Mm)&&(e=n.value);return e},provide:e=>Fu.from(e,(e=>e?Im:null))}),Bm=Xh.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Nm={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Lm=Ts.define({combine:e=>bo(e,Nm,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})});function Fm(e){let t=[tg,eg];return e&&t.push(Lm.of(e)),t}const Hm=Fa.mark({class:"cm-selectionMatch"}),Km=Fa.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Jm(e,t,n,i){return!(0!=n&&e(t.sliceDoc(n-1,n))==fo.Word||i!=t.doc.length&&e(t.sliceDoc(i,i+1))==fo.Word)}const eg=xl.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Lm),{state:n}=e,i=n.selection;if(i.ranges.length>1)return Fa.none;let r,s=i.main,o=null;if(s.empty){if(!t.highlightWordAroundCursor)return Fa.none;let e=n.wordAt(s.head);if(!e)return Fa.none;o=n.charCategorizer(s.head),r=n.sliceDoc(e.from,e.to)}else{let e=s.to-s.from;if(e200)return Fa.none;if(t.wholeWords){if(r=n.sliceDoc(s.from,s.to),o=n.charCategorizer(s.head),!Jm(o,n,s.from,s.to)||!function(e,t,n,i){return e(t.sliceDoc(n,n+1))==fo.Word&&e(t.sliceDoc(i-1,i))==fo.Word}(o,n,s.from,s.to))return Fa.none}else if(r=n.sliceDoc(s.from,s.to).trim(),!r)return Fa.none}let a=[];for(let i of e.visibleRanges){let e=new Am(n.doc,r,i.from,i.to);for(;!e.next().done;){let{from:i,to:r}=e.value;if((!o||Jm(o,n,i,r))&&(s.empty&&i<=s.from&&r>=s.to?a.push(Km.range(i,r)):(i>=s.to||r<=s.from)&&a.push(Hm.range(i,r)),a.length>t.maxMatches))return Fa.none}}return Fa.set(a)}},{decorations:e=>e.decorations}),tg=Xh.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const ng=Ts.define({combine:e=>bo(e,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:e=>new _g(e)})});class ig{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||function(e){try{return new RegExp(e,Em),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,((e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\"))}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new hg(this):new og(this)}getCursor(e,t=0,n){let i=e.doc?e:go.create({doc:e});return null==n&&(n=i.doc.length),this.regexp?ag(this,i,t,n):sg(this,i,t,n)}}class rg{constructor(e){this.spec=e}}function sg(e,t,n,i){return new Am(t.doc,e.unquoted,n,i,e.caseSensitive?void 0:e=>e.toLowerCase(),e.wholeWord?function(e,t){return(n,i,r,s)=>((s>n||s+r.length=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let r=sg(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)i(r.value.from,r.value.to)}}function ag(e,t,n,i){return new jm(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?(r=t.charCategorizer(t.selection.main.head),(e,t,n)=>!n[0].length||(r(lg(n.input,n.index))!=fo.Word||r(cg(n.input,n.index))!=fo.Word)&&(r(cg(n.input,n.index+n[0].length))!=fo.Word||r(lg(n.input,n.index+n[0].length))!=fo.Word)):void 0},n,i);var r}function lg(e,t){return e.slice(os(e,t,!1),t)}function cg(e,t){return e.slice(t,os(e,t))}class hg extends rg{nextMatch(e,t,n){let i=ag(this.spec,e,n,e.doc.length).next();return i.done&&(i=ag(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,n){for(let i=1;;i++){let r=Math.max(t,n-1e4*i),s=ag(this.spec,e,r,n),o=null;for(;!s.next().done;)o=s.value;if(o&&(r==t||o.from>r+10))return o;if(r==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,((t,n)=>"$"==n?"$":"&"==n?e.match[0]:"0"!=n&&+n=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let r=ag(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!r.next().done;)i(r.value.from,r.value.to)}}const ug=ro.define(),dg=ro.define(),fg=qs.define({create:e=>new Og(Qg(e).create(),null),update(e,t){for(let n of t.effects)n.is(ug)?e=new Og(n.value.create(),e.panel):n.is(dg)&&(e=new Og(e.query,n.value?$g:null));return e},provide:e=>Fu.from(e,(e=>e.panel))});class Og{constructor(e,t){this.query=e,this.panel=t}}const pg=Fa.mark({class:"cm-searchMatch"}),mg=Fa.mark({class:"cm-searchMatch cm-searchMatch-selected"}),gg=xl.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(fg))}update(e){let t=e.state.field(fg);(t!=e.startState.field(fg)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return Fa.none;let{view:n}=this,i=new $o;for(let t=0,r=n.visibleRanges,s=r.length;tr[t+1].from-500;)a=r[++t].to;e.highlight(n.state,o,a,((e,t)=>{let r=n.state.selection.ranges.some((n=>n.from==e&&n.to==t));i.add(e,t,r?mg:pg)}))}return i.finish()}},{decorations:e=>e.decorations});function bg(e){return t=>{let n=t.state.field(fg,!1);return n&&n.query.spec.valid?e(t,n):kg(t)}}const wg=bg(((e,{query:t})=>{let{to:n}=e.state.selection.main,i=t.nextMatch(e.state,n,n);return!!i&&(e.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:Xg(e,i),userEvent:"select.search"}),!0)})),xg=bg(((e,{query:t})=>{let{state:n}=e,{from:i}=n.selection.main,r=t.prevMatch(n,i,i);return!!r&&(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Xg(e,r),userEvent:"select.search"}),!0)})),vg=bg(((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!(!n||!n.length)&&(e.dispatch({selection:Qs.create(n.map((e=>Qs.range(e.from,e.to)))),userEvent:"select.search.matches"}),!0)})),yg=bg(((e,{query:t})=>{let{state:n}=e,{from:i,to:r}=n.selection.main;if(n.readOnly)return!1;let s=t.nextMatch(n,i,i);if(!s)return!1;let o,a,l=[],c=[];if(s.from==i&&s.to==r&&(a=n.toText(t.getReplacement(s)),l.push({from:s.from,to:s.to,insert:a}),s=t.nextMatch(n,s.from,s.to),c.push(Xh.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(i).number)+"."))),s){let t=0==l.length||l[0].from>=s.to?0:s.to-s.from-a.length;o={anchor:s.from-t,head:s.to-t},c.push(Xg(e,s))}return e.dispatch({changes:l,selection:o,scrollIntoView:!!o,effects:c,userEvent:"input.replace"}),!0})),Sg=bg(((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map((e=>{let{from:n,to:i}=e;return{from:n,to:i,insert:t.getReplacement(e)}}));if(!n.length)return!1;let i=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:Xh.announce.of(i),userEvent:"input.replace.all"}),!0}));function $g(e){return e.state.facet(ng).createPanel(e)}function Qg(e,t){var n,i,r,s;let o=e.selection.main,a=o.empty||o.to>o.from+100?"":e.sliceDoc(o.from,o.to);if(t&&!a)return t;let l=e.facet(ng);return new ig({search:(null!==(n=null==t?void 0:t.literal)&&void 0!==n?n:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(i=null==t?void 0:t.caseSensitive)&&void 0!==i?i:l.caseSensitive,literal:null!==(r=null==t?void 0:t.literal)&&void 0!==r?r:l.literal,wholeWord:null!==(s=null==t?void 0:t.wholeWord)&&void 0!==s?s:l.wholeWord})}const kg=e=>{let t=e.state.field(fg,!1);if(t&&t.panel){let n=Gu(e,$g);if(!n)return!1;let i=n.dom.querySelector("[main-field]");if(i&&i!=e.root.activeElement){let n=Qg(e.state,t.query.spec);n.valid&&e.dispatch({effects:ug.of(n)}),i.focus(),i.select()}}else e.dispatch({effects:[dg.of(!0),t?ug.of(Qg(e.state,t.query.spec)):ro.appendConfig.of(Rg)]});return!0},Pg=e=>{let t=e.state.field(fg,!1);if(!t||!t.panel)return!1;let n=Gu(e,$g);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:dg.of(!1)}),!0},Tg=[{key:"Mod-f",run:kg,scope:"editor search-panel"},{key:"F3",run:wg,shift:xg,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:wg,shift:xg,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Pg,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:i,to:r}=n.main,s=[],o=0;for(let t=new Am(e.doc,e.sliceDoc(i,r));!t.next().done;){if(s.length>1e3)return!1;t.value.from==i&&(o=s.length),s.push(Qs.range(t.value.from,t.value.to))}return t(e.update({selection:Qs.create(s,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:e=>{let t=Gu(e,Im);if(!t){let n=[Mm.of(!0)];null==e.state.field(Gm,!1)&&n.push(ro.appendConfig.of([Gm,Bm])),e.dispatch({effects:n}),t=Gu(e,Im)}return t&&t.dom.querySelector("input").focus(),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some((e=>e.from===e.to)))return(({state:e,dispatch:t})=>{let{selection:n}=e,i=Qs.create(n.ranges.map((t=>e.wordAt(t.head)||Qs.cursor(t.head))),n.mainIndex);return!i.eq(n)&&(t(e.update({selection:i})),!0)})({state:e,dispatch:t});let i=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some((t=>e.sliceDoc(t.from,t.to)!=i)))return!1;let r=function(e,t){let{main:n,ranges:i}=e.selection,r=e.wordAt(n.head),s=r&&r.from==n.from&&r.to==n.to;for(let n=!1,r=new Am(e.doc,t,i[i.length-1].to);;){if(r.next(),!r.done){if(n&&i.some((e=>e.from==r.value.from)))continue;if(s){let t=e.wordAt(r.value.from);if(!t||t.from!=r.value.from||t.to!=r.value.to)continue}return r.value}if(n)return null;r=new Am(e.doc,t,0,Math.max(0,i[i.length-1].from-1)),n=!0}}(e,i);return!!r&&(t(e.update({selection:e.selection.addRange(Qs.range(r.from,r.to),!1),effects:Xh.scrollIntoView(r.to)})),!0)},preventDefault:!0}];class _g{constructor(e){this.view=e;let t=this.query=e.state.field(fg).query.spec;function n(e,t,n){return Ym("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=Ym("input",{value:t.search,placeholder:Zg(e,"Find"),"aria-label":Zg(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ym("input",{value:t.replace,placeholder:Zg(e,"Replace"),"aria-label":Zg(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ym("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Ym("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Ym("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=Ym("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",(()=>wg(e)),[Zg(e,"next")]),n("prev",(()=>xg(e)),[Zg(e,"previous")]),n("select",(()=>vg(e)),[Zg(e,"all")]),Ym("label",null,[this.caseField,Zg(e,"match case")]),Ym("label",null,[this.reField,Zg(e,"regexp")]),Ym("label",null,[this.wordField,Zg(e,"by word")]),...e.state.readOnly?[]:[Ym("br"),this.replaceField,n("replace",(()=>yg(e)),[Zg(e,"replace")]),n("replaceAll",(()=>Sg(e)),[Zg(e,"replace all")])],Ym("button",{name:"close",onclick:()=>Pg(e),"aria-label":Zg(e,"close"),type:"button"},["×"])])}commit(){let e=new ig({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:ug.of(e)}))}keydown(e){var t,n,i;t=this.view,n=e,i="search-panel",Ih(Uh(t.state),n,t,i)?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?xg:wg)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),yg(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(ug)&&!e.value.eq(this.query)&&this.setQuery(e.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(ng).top}}function Zg(e,t){return e.state.phrase(t)}const Cg=/[\s\.,:;?!]/;function Xg(e,{from:t,to:n}){let i=e.state.doc.lineAt(t),r=e.state.doc.lineAt(n).to,s=Math.max(i.from,t-30),o=Math.min(r,n+30),a=e.state.sliceDoc(s,o);if(s!=i.from)for(let e=0;e<30;e++)if(!Cg.test(a[e+1])&&Cg.test(a[e])){a=a.slice(e);break}if(o!=r)for(let e=a.length-1;e>a.length-30;e--)if(!Cg.test(a[e-1])&&Cg.test(a[e])){a=a.slice(0,e);break}return Xh.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${i.number}.`)}const Yg=Xh.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"}}),Rg=[fg,Ds.lowest(gg),Yg];class qg{constructor(e,t,n){this.state=e,this.pos=t,this.explicit=n,this.abortListeners=[]}tokenBefore(e){let t=Xf(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),r=i.search(Dg(e,!1));return r<0?null:{from:n+r,to:this.pos,text:i.slice(r)}}get aborted(){return null==this.abortListeners}addEventListener(e,t){"abort"==e&&this.abortListeners&&this.abortListeners.push(t)}}function Ag(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function Wg(e){let t=e.map((e=>"string"==typeof e?{label:e}:e)),[n,i]=t.every((e=>/^\w+$/.test(e.label)))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let e=1;e{let r=e.matchBefore(i);return r||e.explicit?{from:r?r.from:e.pos,options:t,validFor:n}:null}}function Eg(e,t){return n=>{for(let t=Xf(n.state).resolveInner(n.pos,-1);t;t=t.parent)if(e.indexOf(t.name)>-1)return null;return t(n)}}class jg{constructor(e,t,n){this.completion=e,this.source=t,this.match=n}}function zg(e){return e.selection.main.head}function Dg(e,t){var n;let{source:i}=e,r=t&&"^"!=i[0],s="$"!=i[i.length-1];return r||s?new RegExp(`${r?"^":""}(?:${i})${s?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}const Ug=to.define();function Vg(e,t){const n=t.completion.apply||t.completion.label;let i=t.source;"string"==typeof n?e.dispatch(Object.assign(Object.assign({},function(e,t,n,i){return Object.assign(Object.assign({},e.changeByRange((r=>{if(r==e.selection.main)return{changes:{from:n,to:i,insert:t},range:Qs.cursor(n+t.length)};let s=i-n;return!r.empty||s&&e.sliceDoc(r.from-s,r.from)!=e.sliceDoc(n,i)?{range:r}:{changes:{from:r.from-s,to:r.from,insert:t},range:Qs.cursor(r.from-s+t.length)}}))),{userEvent:"input.complete"})}(e.state,n,i.from,i.to)),{annotations:Ug.of(t.completion)})):n(e,t.completion,i.from,i.to)}const Ig=new WeakMap;function Mg(e){if(!Array.isArray(e))return e;let t=Ig.get(e);return t||Ig.set(e,t=Wg(e)),t}class Gg{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let t=0;t=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(b=ds(l))!=b.toLowerCase()?1:b!=b.toUpperCase()?2:0;(!i||1==w&&p||0==g&&0!=w)&&(t[h]==l||n[h]==l&&(u=!0)?s[h++]=i:s.length&&(m=!1)),g=w,i+=fs(l)}return h==a&&0==s[0]&&m?this.result((u?-200:0)-100,s,e):d==a&&0==f?[-200-e.length,0,O]:o>-1?[-700-e.length,o,o+this.pattern.length]:d==a?[-900-e.length,f,O]:h==a?this.result((u?-200:0)-100-700+(m?0:-1100),s,e):2==t.length?null:this.result((i[0]?-700:0)-200-1100,i,e)}result(e,t,n){let i=[e-n.length],r=1;for(let e of t){let t=e+(this.astral?fs(us(n,e)):1);r>1&&i[r-1]==e?i[r-1]=t:(i[r++]=e,i[r++]=t)}return i}}const Bg=Ts.define({combine:e=>bo(e,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,optionClass:(e,t)=>n=>function(e,t){return e?t?e+" "+t:e:t}(e(n),t(n)),addToOptions:(e,t)=>e.concat(t)})});function Ng(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let i=Math.floor((e-t)/n);return{from:e-(i+1)*n,to:e-i*n}}class Lg{constructor(e,t){this.view=e,this.stateField=t,this.info=null,this.placeInfo={read:()=>this.measureInfo(),write:e=>this.positionInfo(e),key:this},this.space=null;let n=e.state.field(t),{options:i,selected:r}=n.open,s=e.state.facet(Bg);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map((e=>"cm-completionIcon-"+e))),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,n){let i=document.createElement("span");i.className="cm-completionLabel";let{label:r}=e,s=0;for(let e=1;es&&i.appendChild(document.createTextNode(r.slice(s,t)));let a=i.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(r.slice(t,o))),a.className="cm-completionMatchedText",s=o}return se.position-t.position)).map((e=>e.render))}(s),this.optionClass=s.optionClass,this.range=Ng(i.length,r,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.dom.addEventListener("mousedown",(t=>{for(let n,r=t.target;r&&r!=this.dom;r=r.parentNode)if("LI"==r.nodeName&&(n=/-(\d+)$/.exec(r.id))&&+n[1]{this.info&&this.view.requestMeasure(this.placeInfo)}))}mount(){this.updateSel()}update(e){var t,n,i;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);r!=s&&(this.updateSel(),(null===(t=r.open)||void 0===t?void 0:t.disabled)!=(null===(n=s.open)||void 0===n?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(i=r.open)||void 0===i?void 0:i.disabled)))}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfo)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected=this.range.to)&&(this.range=Ng(t.options.length,t.selected,this.view.state.facet(Bg).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t.options,e.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfo)}))),this.updateSelectedOption(t.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:n}=t.options[t.selected],{info:i}=n;if(!i)return;let r="string"==typeof i?document.createTextNode(i):i(n);if(!r)return;"then"in r?r.then((t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t)})).catch((e=>ml(this.view.state,e,"completion info"))):this.addInfoPane(r)}}addInfoPane(e){let t=this.info=document.createElement("div");t.className="cm-tooltip cm-completionInfo",t.appendChild(e),this.dom.appendChild(t),this.view.requestMeasure(this.placeInfo)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected");return t&&function(e,t){let n=e.getBoundingClientRect(),i=t.getBoundingClientRect();i.topn.bottom&&(e.scrollTop+=i.bottom-n.bottom)}(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),r=this.space;if(!r){let e=this.dom.ownerDocument.defaultView||window;r={left:0,top:0,right:e.innerWidth,bottom:e.innerHeight}}if(i.top>Math.min(r.bottom,t.bottom)-10||i.bottom=n.height||e>t.top?c=i.bottom-t.top+"px":h=t.bottom-i.top+"px"}return{top:c,bottom:h,maxWidth:s,class:l?o?"left-narrow":"right-narrow":a?"left":"right"}}positionInfo(e){this.info&&(e?(this.info.style.top=e.top,this.info.style.bottom=e.bottom,this.info.style.maxWidth=e.maxWidth,this.info.className="cm-tooltip cm-completionInfo cm-completionInfo-"+e.class):this.info.style.top="-1e6px")}createListBox(e,t,n){const i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions"));for(let r=n.from;r=this.options.length?this:new Hg(this.options,eb(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,r){let s=function(e,t){let n=[],i=0;for(let r of e)if(r.hasResult())if(!1===r.result.filter){let e=r.result.getMatch;for(let t of r.result.options){let s=[1e9-i++];if(e)for(let n of e(t))s.push(n);n.push(new jg(t,r,s))}}else{let e,i=new Gg(t.sliceDoc(r.from,r.to));for(let t of r.result.options)(e=i.match(t.label))&&(null!=t.boost&&(e[0]+=t.boost),n.push(new jg(t,r,e)))}let r=[],s=null,o=t.facet(Bg).compareCompletions;for(let e of n.sort(((e,t)=>t.match[0]-e.match[0]||o(e.completion,t.completion))))!s||s.label!=e.completion.label||s.detail!=e.completion.detail||null!=s.type&&null!=e.completion.type&&s.type!=e.completion.type||s.apply!=e.completion.apply?r.push(e):Fg(e.completion)>Fg(s)&&(r[r.length-1]=e),s=e.completion;return r}(e,t);if(!s.length)return i&&e.some((e=>1==e.state))?new Hg(i.options,i.attrs,i.tooltip,i.timestamp,i.selected,!0):null;let o=t.facet(Bg).selectOnOpen?0:-1;if(i&&i.selected!=o&&-1!=i.selected){let e=i.options[i.selected].completion;for(let t=0;tt.hasResult()?Math.min(e,t.from):e),1e8),create:(a=cb,e=>new Lg(e,a)),above:r.aboveCursor},i?i.timestamp:Date.now(),o,!1);var a}map(e){return new Hg(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class Kg{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new Kg(tb,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(Bg),i=(n.override||t.languageDataAt("autocomplete",zg(t)).map(Mg)).map((t=>(this.active.find((e=>e.source==t))||new ib(t,this.active.some((e=>0!=e.state))?1:0)).update(e,n)));i.length==this.active.length&&i.every(((e,t)=>e==this.active[t]))&&(i=this.active);let r=this.open;e.selection||i.some((t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to)))||!function(e,t){if(e==t)return!0;for(let n=0,i=0;;){for(;n1==e.state))?r=null:r&&e.docChanged&&(r=r.map(e.changes)),!r&&i.every((e=>1!=e.state))&&i.some((e=>e.hasResult()))&&(i=i.map((e=>e.hasResult()?new ib(e.source,0):e)));for(let t of e.effects)t.is(lb)&&(r=r&&r.setSelected(t.value,this.id));return i==this.active&&r==this.open?this:new Kg(i,this.id,r)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:Jg}}const Jg={"aria-autocomplete":"list"};function eb(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const tb=[];function nb(e){return e.isUserEvent("input.type")?"input":e.isUserEvent("delete.backward")?"delete":null}class ib{constructor(e,t,n=-1){this.source=e,this.state=t,this.explicitPos=n}hasResult(){return!1}update(e,t){let n=nb(e),i=this;n?i=i.handleUserEvent(e,n,t):e.docChanged?i=i.handleChange(e):e.selection&&0!=i.state&&(i=new ib(i.source,0));for(let t of e.effects)if(t.is(sb))i=new ib(i.source,1,t.value?zg(e.state):-1);else if(t.is(ob))i=new ib(i.source,0);else if(t.is(ab))for(let e of t.value)e.source==i.source&&(i=e);return i}handleUserEvent(e,t,n){return"delete"!=t&&n.activateOnTyping?new ib(this.source,1):this.map(e.changes)}handleChange(e){return e.changes.touchesRange(zg(e.startState))?new ib(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new ib(this.source,this.state,e.mapPos(this.explicitPos))}}class rb extends ib{constructor(e,t,n,i,r){super(e,2,t),this.result=n,this.from=i,this.to=r}hasResult(){return!0}handleUserEvent(e,t,n){var i;let r=e.changes.mapPos(this.from),s=e.changes.mapPos(this.to,1),o=zg(e.state);if((this.explicitPos<0?o<=r:os||"delete"==t&&zg(e.startState)==this.from)return new ib(this.source,"input"==t&&n.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);return function(e,t,n,i){if(!e)return!1;let r=t.sliceDoc(n,i);return"function"==typeof e?e(r,n,i,t):Dg(e,!0).test(r)}(this.result.validFor,e.state,r,s)?new rb(this.source,l,this.result,r,s):this.result.update&&(a=this.result.update(this.result,r,s,new qg(e.state,o,l>=0)))?new rb(this.source,l,a,a.from,null!==(i=a.to)&&void 0!==i?i:zg(e.state)):new ib(this.source,1,l)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new ib(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new rb(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}const sb=ro.define(),ob=ro.define(),ab=ro.define({map:(e,t)=>e.map((e=>e.map(t)))}),lb=ro.define(),cb=qs.define({create:()=>Kg.start(),update:(e,t)=>e.update(t),provide:e=>[Wu.from(e,(e=>e.tooltip)),Xh.contentAttributes.from(e,(e=>e.attrs))]});function hb(e,t="option"){return n=>{let i=n.state.field(cb,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+s*(e?1:-1):e?0:o-1;return a<0?a="page"==t?0:o-1:a>=o&&(a="page"==t?o-1:0),n.dispatch({effects:lb.of(a)}),!0}}class ub{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const db=xl.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let t of e.state.field(cb).active)1==t.state&&this.startQuery(t)}update(e){let t=e.state.field(cb);if(!e.selectionSet&&!e.docChanged&&e.startState.field(cb)==t)return;let n=e.transactions.some((e=>(e.selection||e.docChanged)&&!nb(e)));for(let t=0;t50&&Date.now()-i.time>1e3){for(let e of i.context.abortListeners)try{e()}catch(e){ml(this.view.state,e)}i.context.abortListeners=null,this.running.splice(t--,1)}else i.updates.push(...e.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=t.active.some((e=>1==e.state&&!this.running.some((t=>t.active.source==e.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let t of e.transactions)"input"==nb(t)?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:e}=this.view,t=e.field(cb);for(let e of t.active)1!=e.state||this.running.some((t=>t.active.source==e.source))||this.startQuery(e)}startQuery(e){let{state:t}=this.view,n=zg(t),i=new qg(t,n,e.explicitPos==n),r=new ub(e,i);this.running.push(r),Promise.resolve(e.source(i)).then((e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())}),(e=>{this.view.dispatch({effects:ob.of(null)}),ml(this.view.state,e)}))}scheduleAccept(){this.running.every((e=>void 0!==e.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Bg);for(let i=0;ie.source==r.active.source));if(s&&1==s.state)if(null==r.done){let e=new ib(r.active.source,0);for(let t of r.updates)e=e.update(t,n);1!=e.state&&t.push(e)}else this.startQuery(s)}t.length&&this.view.dispatch({effects:ab.of(t)})}},{eventHandlers:{blur(){let e=this.view.state.field(cb,!1);e&&e.tooltip&&this.view.state.facet(Bg).closeOnBlur&&this.view.dispatch({effects:ob.of(null)})},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:sb.of(!1)})),20),this.composing=0}}}),fb=Xh.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":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer",padding:"1px 3px",lineHeight:1.2}}},"&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:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".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:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Ob{constructor(e,t,n,i){this.field=e,this.line=t,this.from=n,this.to=i}}class pb{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,ps.TrackDel),n=e.mapPos(this.to,1,ps.TrackDel);return null==t||null==n?null:new pb(this.field,t,n)}}class mb{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],i=[t],r=e.doc.lineAt(t),s=/^\s*/.exec(r.text)[0];for(let r of this.lines){if(n.length){let n=s,o=/^\t*/.exec(r)[0].length;for(let t=0;tnew pb(e.field,i[e.line]+e.from,i[e.line]+e.to)));return{text:n,ranges:o}}static parse(e){let t,n=[],i=[],r=[];for(let s of e.split(/\r\n?|\n/)){for(;t=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(s);){let e=t[1]?+t[1]:null,o=t[2]||t[3]||"",a=-1;for(let t=0;t=a&&e.field++}r.push(new Ob(a,i.length,t.index,t.index+o.length)),s=s.slice(0,t.index)+o+s.slice(t.index+t[0].length)}for(let e;e=/\\([{}])/.exec(s);){s=s.slice(0,e.index)+e[1]+s.slice(e.index+e[0].length);for(let t of r)t.line==i.length&&t.from>e.index&&(t.from--,t.to--)}i.push(s)}return new mb(i,r)}}let gb=Fa.widget({widget:new class extends Na{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),bb=Fa.mark({class:"cm-snippetField"});class wb{constructor(e,t){this.ranges=e,this.active=t,this.deco=Fa.set(e.map((e=>(e.from==e.to?gb:bb).range(e.from,e.to))))}map(e){let t=[];for(let n of this.ranges){let i=n.map(e);if(!i)return null;t.push(i)}return new wb(t,this.active)}selectionInsideField(e){return e.ranges.every((e=>this.ranges.some((t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))))}}const xb=ro.define({map:(e,t)=>e&&e.map(t)}),vb=ro.define(),yb=qs.define({create:()=>null,update(e,t){for(let n of t.effects){if(n.is(xb))return n.value;if(n.is(vb)&&e)return new wb(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>Xh.decorations.from(e,(e=>e?e.deco:Fa.none))});function Sb(e,t){return Qs.create(e.filter((e=>e.field==t)).map((e=>Qs.range(e.from,e.to))))}function $b(e){let t=mb.parse(e);return(e,n,i,r)=>{let{text:s,ranges:o}=t.instantiate(e.state,i),a={changes:{from:i,to:r,insert:Nr.of(s)},scrollIntoView:!0};if(o.length&&(a.selection=Sb(o,0)),o.length>1){let t=new wb(o,0),n=a.effects=[xb.of(t)];void 0===e.state.field(yb,!1)&&n.push(ro.appendConfig.of([yb,Tb,Zb,fb]))}e.dispatch(e.state.update(a))}}function Qb(e){return({state:t,dispatch:n})=>{let i=t.field(yb,!1);if(!i||e<0&&0==i.active)return!1;let r=i.active+e,s=e>0&&!i.ranges.some((t=>t.field==r+e));return n(t.update({selection:Sb(i.ranges,r),effects:xb.of(s?null:new wb(i.ranges,r))})),!0}}const kb=[{key:"Tab",run:Qb(1),shift:Qb(-1)},{key:"Escape",run:({state:e,dispatch:t})=>!!e.field(yb,!1)&&(t(e.update({effects:xb.of(null)})),!0)}],Pb=Ts.define({combine:e=>e.length?e[0]:kb}),Tb=Ds.highest(zh.compute([Pb],(e=>e.facet(Pb))));function _b(e,t){return Object.assign(Object.assign({},t),{apply:$b(e)})}const Zb=Xh.domEventHandlers({mousedown(e,t){let n,i=t.state.field(yb,!1);if(!i||null==(n=t.posAtCoords({x:e.clientX,y:e.clientY})))return!1;let r=i.ranges.find((e=>e.from<=n&&e.to>=n));return!(!r||r.field==i.active)&&(t.dispatch({selection:Sb(i.ranges,r.field),effects:xb.of(i.ranges.some((e=>e.field>r.field))?new wb(i.ranges,r.field):null)}),!0)}}),Cb={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Xb=ro.define({map(e,t){let n=t.mapPos(e,-1,ps.TrackAfter);return null==n?void 0:n}}),Yb=ro.define({map:(e,t)=>t.mapPos(e)}),Rb=new class extends wo{};Rb.startSide=1,Rb.endSide=-1;const qb=qs.define({create:()=>So.empty,update(e,t){if(t.selection){let n=t.state.doc.lineAt(t.selection.main.head).from,i=t.startState.doc.lineAt(t.startState.selection.main.head).from;n!=t.changes.mapPos(i,-1)&&(e=So.empty)}e=e.map(t.changes);for(let n of t.effects)n.is(Xb)?e=e.update({add:[Rb.range(n.value,n.value+1)]}):n.is(Yb)&&(e=e.update({filter:e=>e!=n.value}));return e}});const Ab="()[]{}<>";function Wb(e){for(let t=0;t{if((jb?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let r=e.state.selection.main;if(i.length>2||2==i.length&&1==fs(us(i,0))||t!=r.from||n!=r.to)return!1;let s=function(e,t){let n=Eb(e,e.selection.main.head),i=n.brackets||Cb.brackets;for(let r of i){let s=Wb(us(r,0));if(t==r)return s==r?Gb(e,r,i.indexOf(r+r+r)>-1,n):Ib(e,r,s,n.before||Cb.before);if(t==s&&Ub(e,e.selection.main.from))return Mb(e,r,s)}return null}(e.state,i);return!!s&&(e.dispatch(s),!0)})),Db=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Eb(e,e.selection.main.head).brackets||Cb.brackets,i=null,r=e.changeByRange((t=>{if(t.empty){let i=function(e,t){let n=e.sliceString(t-2,t);return fs(us(n,0))==n.length?n:n.slice(1)}(e.doc,t.head);for(let r of n)if(r==i&&Vb(e.doc,t.head)==Wb(us(r,0)))return{changes:{from:t.head-r.length,to:t.head+r.length},range:Qs.cursor(t.head-r.length)}}return{range:i=t}}));return i||t(e.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!i}}];function Ub(e,t){let n=!1;return e.field(qb).between(0,e.doc.length,(e=>{e==t&&(n=!0)})),n}function Vb(e,t){let n=e.sliceString(t,t+2);return n.slice(0,fs(us(n,0)))}function Ib(e,t,n,i){let r=null,s=e.changeByRange((s=>{if(!s.empty)return{changes:[{insert:t,from:s.from},{insert:n,from:s.to}],effects:Xb.of(s.to+t.length),range:Qs.range(s.anchor+t.length,s.head+t.length)};let o=Vb(e.doc,s.head);return!o||/\s/.test(o)||i.indexOf(o)>-1?{changes:{insert:t+n,from:s.head},effects:Xb.of(s.head+t.length),range:Qs.cursor(s.head+t.length)}:{range:r=s}}));return r?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Mb(e,t,n){let i=null,r=e.selection.ranges.map((t=>t.empty&&Vb(e.doc,t.head)==n?Qs.cursor(t.head+n.length):i=t));return i?null:e.update({selection:Qs.create(r,e.selection.mainIndex),scrollIntoView:!0,effects:e.selection.ranges.map((({from:e})=>Yb.of(e)))})}function Gb(e,t,n,i){let r=i.stringPrefixes||Cb.stringPrefixes,s=null,o=e.changeByRange((i=>{if(!i.empty)return{changes:[{insert:t,from:i.from},{insert:t,from:i.to}],effects:Xb.of(i.to+t.length),range:Qs.range(i.anchor+t.length,i.head+t.length)};let o,a=i.head,l=Vb(e.doc,a);if(l==t){if(Bb(e,a))return{changes:{insert:t+t,from:a},effects:Xb.of(a+t.length),range:Qs.cursor(a+t.length)};if(Ub(e,a)){let i=n&&e.sliceDoc(a,a+3*t.length)==t+t+t;return{range:Qs.cursor(a+t.length*(i?3:1)),effects:Yb.of(a)}}}else{if(n&&e.sliceDoc(a-2*t.length,a)==t+t&&(o=Nb(e,a-2*t.length,r))>-1&&Bb(e,o))return{changes:{insert:t+t+t+t,from:a},effects:Xb.of(a+t.length),range:Qs.cursor(a+t.length)};if(e.charCategorizer(a)(l)!=fo.Word&&Nb(e,a,r)>-1&&!function(e,t,n,i){let r=Xf(e).resolveInner(t,-1),s=i.reduce(((e,t)=>Math.max(e,t.length)),0);for(let o=0;o<5;o++){let o=e.sliceDoc(r.from,Math.min(r.to,r.from+n.length+s)),a=o.indexOf(n);if(!a||a>-1&&i.indexOf(o.slice(0,a))>-1){let t=r.firstChild;for(;t&&t.from==r.from&&t.to-t.from>n.length+a;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let l=r.to==t&&r.parent;if(!l)break;r=l}return!1}(e,a,t,r))return{changes:{insert:t+t,from:a},effects:Xb.of(a+t.length),range:Qs.cursor(a+t.length)}}return{range:s=i}}));return s?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Bb(e,t){let n=Xf(e).resolveInner(t+1);return n.parent&&n.from==t}function Nb(e,t,n){let i=e.charCategorizer(t);if(i(e.sliceDoc(t-1,t))!=fo.Word)return t;for(let r of n){let n=t-r.length;if(e.sliceDoc(n,t)==r&&i(e.sliceDoc(n-1,n))!=fo.Word)return n}return-1}function Lb(e={}){return[cb,Bg.of(e),db,Hb,fb]}const Fb=[{key:"Ctrl-Space",run:e=>!!e.state.field(cb,!1)&&(e.dispatch({effects:sb.of(!0)}),!0)},{key:"Escape",run:e=>{let t=e.state.field(cb,!1);return!(!t||!t.active.some((e=>0!=e.state)))&&(e.dispatch({effects:ob.of(null)}),!0)}},{key:"ArrowDown",run:hb(!0)},{key:"ArrowUp",run:hb(!1)},{key:"PageDown",run:hb(!0,"page")},{key:"PageUp",run:hb(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(cb,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||Date.now()-t.open.timestampe.facet(Bg).defaultKeymap?[Fb]:[])));class Kb{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class Jb{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let i=e,r=n.facet(fw).markerFilter;r&&(i=r(i));let s=Fa.set(i.map((e=>e.from==e.to||e.from==e.to-1&&n.doc.lineAt(e.from).to==e.from?Fa.widget({widget:new mw(e),diagnostic:e}).range(e.from):Fa.mark({attributes:{class:"cm-lintRange cm-lintRange-"+e.severity},diagnostic:e}).range(e.from,e.to))),!0);return new Jb(s,t,ew(s))}}function ew(e,t=null,n=0){let i=null;return e.between(n,1e9,((e,n,{spec:r})=>{if(!t||r.diagnostic==t)return i=new Kb(e,n,r.diagnostic),!1})),i}function tw(e,t){return!(!e.effects.some((e=>e.is(iw)))&&!e.changes.touchesRange(t.pos))}function nw(e,t){return e.field(ow,!1)?t:t.concat(ro.appendConfig.of([ow,Xh.decorations.compute([ow],(e=>{let{selected:t,panel:n}=e.field(ow);return t&&n&&t.from!=t.to?Fa.set([aw.range(t.from,t.to)]):Fa.none})),Vu(lw,{hideOn:tw}),xw]))}const iw=ro.define(),rw=ro.define(),sw=ro.define(),ow=qs.define({create:()=>new Jb(Fa.none,null,null),update(e,t){if(t.docChanged){let n=e.diagnostics.map(t.changes),i=null;if(e.selected){let r=t.changes.mapPos(e.selected.from,1);i=ew(n,e.selected.diagnostic,r)||ew(n,null,r)}e=new Jb(n,e.panel,i)}for(let n of t.effects)n.is(iw)?e=Jb.init(n.value,e.panel,t.state):n.is(rw)?e=new Jb(e.diagnostics,n.value?bw.open:null,e.selected):n.is(sw)&&(e=new Jb(e.diagnostics,e.panel,n.value));return e},provide:e=>[Fu.from(e,(e=>e.panel)),Xh.decorations.from(e,(e=>e.diagnostics))]}),aw=Fa.mark({class:"cm-lintRange cm-lintRange-active"});function lw(e,t,n){let{diagnostics:i}=e.state.field(ow),r=[],s=2e8,o=0;i.between(t-(n<0?1:0),t+(n>0?1:0),((e,i,{spec:a})=>{t>=e&&t<=i&&(e==i||(t>e||n>0)&&(t({dom:cw(e,r)})}:null}function cw(e,t){return Ym("ul",{class:"cm-tooltip-lint"},t.map((t=>pw(e,t,!1))))}const hw=e=>{let t=e.state.field(ow,!1);return!(!t||!t.panel)&&(e.dispatch({effects:rw.of(!1)}),!0)},uw=[{key:"Mod-Shift-m",run:e=>{let t=e.state.field(ow,!1);t&&t.panel||e.dispatch({effects:nw(e.state,[rw.of(!0)])});let n=Gu(e,bw.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(ow,!1);if(!t)return!1;let n=e.state.selection.main,i=t.diagnostics.iter(n.to+1);return!(!i.value&&(i=t.diagnostics.iter(0),!i.value||i.from==n.from&&i.to==n.to))&&(e.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)}}],dw=xl.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet(fw);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){let e=Date.now();if(ePromise.resolve(e(this.view))))).then((t=>{let n=t.reduce(((e,t)=>e.concat(t)));this.view.state.doc==e.doc&&this.view.dispatch(function(e,t){return{effects:nw(e,[iw.of(t)])}}(this.view.state,n))}),(e=>{ml(this.view.state,e)}))}}update(e){let t=e.state.facet(fw);(e.docChanged||t!=e.startState.facet(fw))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),fw=Ts.define({combine:e=>Object.assign({sources:e.map((e=>e.source))},bo(e.map((e=>e.config)),{delay:750,markerFilter:null,tooltipFilter:null})),enables:dw});function Ow(e){let t=[];if(e)e:for(let{name:n}of e){for(let e=0;ee.toLowerCase()==i.toLowerCase()))){t.push(i);continue e}}t.push("")}return t}function pw(e,t,n){var i;let r=n?Ow(t.actions):[];return Ym("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},Ym("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage():t.message),null===(i=t.actions)||void 0===i?void 0:i.map(((n,i)=>{let s=i=>{i.preventDefault();let r=ew(e.state.field(ow).diagnostics,t);r&&n.apply(e,r.from,r.to)},{name:o}=n,a=r[i]?o.indexOf(r[i]):-1,l=a<0?o:[o.slice(0,a),Ym("u",o.slice(a,a+1)),o.slice(a+1)];return Ym("button",{type:"button",class:"cm-diagnosticAction",onclick:s,onmousedown:s,"aria-label":` Action: ${o}${a<0?"":` (access key "${r[i]})"`}.`},l)})),t.source&&Ym("div",{class:"cm-diagnosticSource"},t.source))}class mw extends Na{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return Ym("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class gw{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=pw(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class bw{constructor(e){this.view=e,this.items=[];this.list=Ym("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(27==t.keyCode)hw(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:n}=this.items[this.selectedIndex],i=Ow(n.actions);for(let r=0;r{for(let t=0;thw(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(ow).selected;if(!e)return-1;for(let t=0;t{let a,l=-1;for(let e=n;en&&(this.items.splice(n,l-n),i=!0)),t&&a.diagnostic==t.diagnostic?a.dom.hasAttribute("aria-selected")||(a.dom.setAttribute("aria-selected","true"),r=a):a.dom.hasAttribute("aria-selected")&&a.dom.removeAttribute("aria-selected"),n++}));n({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{e.topt.bottom&&(this.list.scrollTop+=e.bottom-t.bottom)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=ew(this.view.state.field(ow).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:sw.of(t)})}static open(e){return new bw(e)}}function ww(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(e)}')`}(``,'width="6" height="3"')}const xw=Xh.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:ww("#d11")},".cm-lintRange-warning":{backgroundImage:ww("orange")},".cm-lintRange-info":{backgroundImage:ww("#999")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}}),vw=(()=>[pd(),bd,mu(),pp(),PO(),Jh(),[au,lu],go.allowMultipleSelections.of(!0),go.transactionFilter.of((e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:i}=e.newSelection.main,r=n.lineAt(i);if(i>r.from+200)return e;let s=n.sliceString(r.from,i);if(!t.some((e=>e.test(s))))return e;let{state:o}=e,a=-1,l=[];for(let{head:e}of o.selection.ranges){let t=o.doc.lineAt(e);if(t.from==a)continue;a=t.from;let n=Bf(o,t.from);if(null==n)continue;let i=/^\s*/.exec(t.text)[0],r=Gf(o,n);i!=r&&l.push({from:t.from,to:t.from+i.length,insert:r})}return l.length?[e,{changes:l,sequential:!0}]:e})),YO(AO,{fallback:!0}),MO(),[zb,qb],Lb(),Qu(),Tu(),vu,Fm(),zh.of([...Db,...Cm,...Tg,...Cp,...bO,...Fb,...uw])])();class yw{constructor(e,t,n,i,r,s,o,a,l,c=0,h){this.p=e,this.stack=t,this.state=n,this.reducePos=i,this.pos=r,this.score=s,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=c,this.parent=h}toString(){return`[${this.stack.filter(((e,t)=>t%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let i=e.parser.context;return new yw(e,[],t,n,n,0,[],0,i?new Sw(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,i=65535&e,{parser:r}=this.p,s=r.dynamicPrecedence(i);if(s&&(this.score+=s),0==n)return this.pushState(r.getGoto(this.state,i,!0),this.reducePos),i=2e3&&!(null===(t=this.p.parser.nodeSet.types[i])||void 0===t?void 0:t.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(i,a)}storeNode(e,t,n,i=4,r=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==e.buffer[i-4]&&e.buffer[i-1]>-1){if(t==n)return;if(e.buffer[i-2]>=t)return void(e.buffer[i-2]=n)}}if(r&&this.pos!=n){let r=this.buffer.length;if(r>0&&0!=this.buffer[r-4])for(;r>0&&this.buffer[r-2]>n;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4);this.buffer[r]=e,this.buffer[r+1]=t,this.buffer[r+2]=n,this.buffer[r+3]=i}else this.buffer.push(e,t,n,i)}shift(e,t,n,i){if(131072&e)this.pushState(65535&e,this.pos);else if(0==(262144&e)){let r=e,{parser:s}=this.p;(i>this.pos||t<=s.maxNode)&&(this.pos=i,s.stateFlag(r,1)||(this.reducePos=i)),this.pushState(r,n),this.shiftContext(t,n),t<=s.maxNode&&this.buffer.push(t,n,i,4)}else this.pos=i,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,i,4)}apply(e,t,n,i){65536&e?this.reduce(e):this.shift(e,t,n,i)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(t,i),this.buffer.push(n,i,this.reducePos,-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,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new yw(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new $w(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==n)return!1;if(0==(65536&n))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let i,r=0;r1&t&&e==i))||n.push(t[e],i)}t=n}let n=[];for(let e=0;e>19,i=65535&t,r=this.stack.length-3*n;if(r<0||e.getGoto(this.stack[r],i,!1)<0){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(i,r)=>{if(!t.includes(i))return t.push(i),e.allActions(i,(t=>{if(393216&t);else if(65536&t){let n=(t>>19)-r;if(n>1){let i=65535&t,r=this.stack.length-3*n;if(r>=0&&e.getGoto(this.stack[r],i,!1)>=0)return n<<19|65536|i}}else{let e=n(t,r+1);if(null!=e)return e}}))};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(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!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 t=0;tthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Sw{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class $w{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=65535&e,n=e>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);let i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}}class Qw{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Qw(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(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,0==this.index&&this.maybeNext()}fork(){return new Qw(this.stack,this.pos,this.index)}}function kw(e,t=Uint16Array){if("string"!=typeof e)return e;let n=null;for(let i=0,r=0;i=92&&t--,t>=34&&t--;let r=t-32;if(r>=46&&(r-=46,n=!0),s+=r,n)break;s*=46}n?n[r++]=s:n=new t(s)}return n}class Pw{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Tw=new Pw;class _w{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Tw,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,i=this.rangeIndex,r=this.pos+e;for(;rn.to:r>=n.to;){if(i==this.ranges.length-1)return null;let e=this.ranges[++i];r+=e.from-n.to,n=e}return r}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t,n,i=this.chunkOff+e;if(i>=0&&i=this.chunk2Pos&&ti.to&&(this.chunk2=this.chunk2.slice(0,i.to-t)),n=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),n}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(null==n||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,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Tw,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&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return n}}class Zw{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Yw(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}Zw.prototype.contextual=Zw.prototype.fallback=Zw.prototype.extend=!1;class Cw{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data="string"==typeof e?kw(e):e}token(e,t){let n=e.pos,i=0;for(;;){let n=e.next<0,r=e.resolveOffset(1,1);if(Yw(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(null==this.elseToken)return;if(n||i++,null==r)break;e.reset(r,e.token)}i&&(e.reset(n,e.token),e.acceptToken(this.elseToken,i))}}Cw.prototype.contextual=Zw.prototype.fallback=Zw.prototype.extend=!1;class Xw{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Yw(e,t,n,i,r,s){let o=0,a=1<0){let n=e[i];if(l.allows(n)&&(-1==t.token.value||t.token.value==n||qw(n,t.token.value,r,s))){t.acceptToken(n);break}}let i=t.next,c=0,h=e[o+2];if(!(t.next<0&&h>c&&65535==e[n+3*h-3]&&65535==e[n+3*h-3])){for(;c>1,s=n+r+(r<<1),a=e[s],l=e[s+1]||65536;if(i=l)){o=e[s+2],t.advance();continue e}c=r+1}}break}o=e[n+3*h-1]}}function Rw(e,t,n){for(let i,r=t;65535!=(i=e[r]);r++)if(i==n)return r-t;return-1}function qw(e,t,n,i){let r=Rw(n,i,t);return r<0||Rw(n,i,e)t)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,t-25)):Math.min(e.length,Math.max(i.from+1,t+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:e.length}}class jw{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Ew(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Ew(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=s,null;if(r instanceof Zd){if(s==e){if(s=Math.max(this.safeFrom,e)&&(this.trees.push(r),this.start.push(s),this.index.push(0))}else this.index[t]++,this.nextStart=s+r.length}}}class zw{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map((e=>new Pw))}getActions(e){let t=0,n=null,{parser:i}=e.p,{tokenizers:r}=i,s=i.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,a=0;for(let i=0;ic.end+25&&(a=Math.max(c.lookAhead,a)),0!=c.value)){let i=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!l.extend&&(n=c,t>i))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),n||e.pos!=this.stream.end||(n=new Pw,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Pw,{pos:n,p:i}=e;return t.start=n,t.end=Math.min(n+1,i.stream.end),t.value=n==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,n){let i=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(i,e),n),e.value>-1){let{parser:t}=n.p;for(let i=0;i=0&&n.p.parser.dialect.allows(r>>1)){0==(1&r)?e.value=r>>1:e.extended=r>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,n,i){for(let t=0;t4*e.bufferLength?new jw(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,n=this.stacks,i=this.minStackPos,r=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[e]=n;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;si)r.push(o);else{if(this.advanceStack(o,r,n))continue;{e||(e=[],t=[]),e.push(o);let n=this.tokens.getMainToken(o);t.push(n.value,n.end)}}break}}if(!r.length){let t=e&&function(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=e&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.scorethis.stoppedAt?e[0]:this.runRecovery(e,t,r);if(n)return Aw&&console.log("Force-finish "+this.stackID(n)),this.stackToTree(n.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(r.length>e)for(r.sort(((e,t)=>t.score-e.score));r.length>e;)r.pop();r.some((e=>e.reducePos>i))&&this.recovering--}else if(r.length>1){e:for(let e=0;e500&&i.buffer.length>500){if(!((t.score-i.score||t.buffer.length-i.buffer.length)>0)){r.splice(e--,1);continue e}r.splice(n--,1)}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let e=1;e ":"";if(null!=this.stoppedAt&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let o=this.fragments.nodeAt(i);o;){let i=this.parser.nodeSet.types[o.type.id]==o.type?r.getGoto(e.state,o.type.id):-1;if(i>-1&&o.length&&(!t||(o.prop(yd.contextHash)||0)==n))return e.useNode(o,i),Aw&&console.log(s+this.stackID(e)+` (via reuse of ${r.getName(o.type.id)})`),!0;if(!(o instanceof Zd)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof Zd&&0==o.positions[0]))break;o=a}}let o=r.stateSlot(e.state,4);if(o>0)return e.reduce(o),Aw&&console.log(s+this.stackID(e)+` (via always-reduce ${r.getName(65535&o)})`),!0;if(e.stack.length>=9e3)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let o=0;oi?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Uw(e,t),!0}}runRecovery(e,t,n){let i=null,r=!1;for(let s=0;s ":"";if(o.deadEnd){if(r)continue;if(r=!0,o.restart(),Aw&&console.log(c+this.stackID(o)+" (restarted)"),this.advanceFully(o,n))continue}let h=o.split(),u=c;for(let e=0;h.forceReduce()&&e<10;e++){if(Aw&&console.log(u+this.stackID(h)+" (via force-reduce)"),this.advanceFully(h,n))break;Aw&&(u=this.stackID(h)+" -> ")}for(let e of o.recoverByInsert(a))Aw&&console.log(c+this.stackID(e)+" (via recover-insert)"),this.advanceFully(e,n);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),Aw&&console.log(c+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Uw(o,n)):(!i||i.scoree;class Mw{constructor(e){this.start=e.start,this.shift=e.shift||Iw,this.reduce=e.reduce||Iw,this.reuse=e.reuse||Iw,this.hash=e.hash||(()=>0),this.strict=!1!==e.strict}}class Gw extends Fd{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let n=0;ne.topRules[t][1])),i=[];for(let e=0;e=0)r(i,e,t[n++]);else{let s=t[n+-i];for(let o=-i;o>0;o--)r(t[n++],e,s);n++}}}this.nodeSet=new kd(t.map(((t,r)=>Qd.define({name:r>=this.minRepeatTerm?void 0:t,id:r,props:i[r],top:n.indexOf(r)>-1,error:0==r,skipped:e.skippedNodes&&e.skippedNodes.indexOf(r)>-1})))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=wd;let s=kw(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e"number"==typeof e?new Zw(s,e):e)),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,t,n){let i=new Dw(this,e,t,n);for(let r of this.wrappers)i=r(i,e,t,n);return i}getGoto(e,t,n=!1){let i=this.goto;if(t>=i[0])return-1;for(let r=i[t+1];;){let t=i[r++],s=1&t,o=i[r++];if(s&&n)return o;for(let n=r+(t>>1);r0}validAction(e,t){return!!this.allActions(e,(e=>e==t||null))}allActions(e,t){let n=this.stateSlot(e,4),i=n?t(n):void 0;for(let n=this.stateSlot(e,1);null==i;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=Bw(this.data,n+2)}i=t(Bw(this.data,n+1))}return i}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=Bw(this.data,n+2)}if(0==(1&this.data[n+2])){let e=this.data[n+1];t.some(((t,n)=>1&n&&t==e))||t.push(this.data[n],e)}}return t}configure(e){let t=Object.assign(Object.create(Gw.prototype),this);if(e.props&&(t.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}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map((t=>{let n=e.tokenizers.find((e=>e.from==t));return n?n.to:t}))),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map(((n,i)=>{let r=e.specializers.find((e=>e.from==n.external));if(!r)return n;let s=Object.assign(Object.assign({},n),{external:r.to});return t.specializers[i]=Nw(s),s}))),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}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 t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map((()=>!1));if(e)for(let i of e.split(" ")){let e=t.indexOf(i);e>=0&&(n[e]=!0)}let i=null;for(let e=0;ee.external(n,i)<<1|t}return e.get}function Lw(e){return 45==e||46==e||58==e||e>=65&&e<=90||95==e||e>=97&&e<=122||e>=161}let Fw=null,Hw=null,Kw=0;function Jw(e,t){let n=e.pos+t;if(Hw==e&&Kw==n)return Fw;for(;9==(i=e.peek(t))||10==i||13==i||32==i;)t++;var i;let r="";for(;;){let n=e.peek(t);if(!Lw(n))break;r+=String.fromCharCode(n),t++}return Hw=e,Kw=n,Fw=r||null}function ex(e,t){this.name=e,this.parent=t,this.hash=t?t.hash:0;for(let t=0;t1==t?new ex(Jw(i,1)||"",e):e,reduce:(e,t)=>11==t&&e?e.parent:e,reuse(e,t,n,i){let r=t.type.id;return 1==r||13==r?new ex(Jw(i,1)||"",e):e},hash:e=>e?e.hash:0,strict:!1}),nx=new Xw(((e,t)=>{if(60==e.next)if(e.advance(),47==e.next){e.advance();let n=Jw(e,0);if(!n)return e.acceptToken(5);if(t.context&&n==t.context.name)return e.acceptToken(2);for(let i=t.context;i;i=i.parent)if(i.name==n)return e.acceptToken(3,-2);e.acceptToken(4)}else if(33!=e.next&&63!=e.next)return e.acceptToken(1)}),{contextual:!0});function ix(e,t){return new Xw((n=>{for(let i=0,r=0;;r++){if(n.next<0){r&&n.acceptToken(e);break}if(n.next==t.charCodeAt(i)){if(i++,i==t.length){r>=t.length&&n.acceptToken(e,1-t.length);break}}else i=n.next==t.charCodeAt(0)?1:0;n.advance()}}))}const rx=ix(35,"--\x3e"),sx=ix(36,"?>"),ox=ix(37,"]]>"),ax=nf({Text:$f.content,"StartTag StartCloseTag EndTag SelfCloseEndTag":$f.angleBracket,TagName:$f.tagName,"MismatchedCloseTag/Tagname":[$f.tagName,$f.invalid],AttributeName:$f.attributeName,AttributeValue:$f.attributeValue,Is:$f.definitionOperator,"EntityReference CharacterReference":$f.character,Comment:$f.blockComment,ProcessingInst:$f.processingInstruction,DoctypeDecl:$f.documentMeta,Cdata:$f.special($f.string)}),lx=Gw.deserialize({version:14,states:",SOQOaOOOrOxO'#CfOzOpO'#CiO!tOaO'#CgOOOP'#Cg'#CgO!{OrO'#CrO#TOtO'#CsO#]OpO'#CtOOOP'#DS'#DSOOOP'#Cv'#CvQQOaOOOOOW'#Cw'#CwO#eOxO,59QOOOP,59Q,59QOOOO'#Cx'#CxO#mOpO,59TO#uO!bO,59TOOOP'#C{'#C{O$TOaO,59RO$[OpO'#CoOOOP,59R,59ROOOQ'#C|'#C|O$dOrO,59^OOOP,59^,59^OOOS'#C}'#C}O$lOtO,59_OOOP,59_,59_O$tOpO,59`O$|OpO,59`OOOP-E6t-E6tOOOW-E6u-E6uOOOP1G.l1G.lOOOO-E6v-E6vO%UO!bO1G.oO%UO!bO1G.oO%dOpO'#CkO%lO!bO'#CyO%zO!bO1G.oOOOP1G.o1G.oOOOP1G.w1G.wOOOP-E6y-E6yOOOP1G.m1G.mO&VOpO,59ZO&_OpO,59ZOOOQ-E6z-E6zOOOP1G.x1G.xOOOS-E6{-E6{OOOP1G.y1G.yO&gOpO1G.zO&gOpO1G.zOOOP1G.z1G.zO&oO!bO7+$ZO&}O!bO7+$ZOOOP7+$Z7+$ZOOOP7+$c7+$cO'YOpO,59VO'bOpO,59VO'jO!bO,59eOOOO-E6w-E6wO'xOpO1G.uO'xOpO1G.uOOOP1G.u1G.uO(QOpO7+$fOOOP7+$f7+$fO(YO!bO<`#X;'S%y;'S;=`&_<%lO%yX>eV{WOr%ysv%yw#T%y#T#U>z#U;'S%y;'S;=`&_<%lO%yX?PV{WOr%ysv%yw#h%y#h#i?f#i;'S%y;'S;=`&_<%lO%yX?kV{WOr%ysv%yw#T%y#T#U",boost:2}),this.closeNameCompletion=Object.assign(Object.assign({},this.completion),{label:this.name+">"}),this.text=e.textContent?e.textContent.map((e=>({label:e,type:"text"}))):[]}}const fx=/^[:\-\.\w\u00b7-\uffff]*$/;function Ox(e){return Object.assign(Object.assign({type:"property"},e.completion||{}),{label:e.name})}function px(e){return"string"==typeof e?{label:`"${e}"`,type:"constant"}:/^"/.test(e.label)?e:Object.assign(Object.assign({},e),{label:`"${e.label}"`})}function mx(e,t){let n=[],i=[],r=Object.create(null);for(let e of t){let t=Ox(e);n.push(t),e.global&&i.push(t),e.values&&(r[e.name]=e.values.map(px))}let s=[],o=[],a=Object.create(null);for(let t of e){let e=i,l=r;t.attributes&&(e=e.concat(t.attributes.map((e=>"string"==typeof e?n.find((t=>t.label==e))||{label:e,type:"property"}:(e.values&&(l==r&&(l=Object.create(l)),l[e.name]=e.values.map(px)),Ox(e))))));let c=new dx(t,e,l);a[c.name]=c,s.push(c),t.top&&o.push(c)}o.length||(o=s);for(let t=0;t{var t;let{doc:n}=e.state,l=function(e,t){var n;let i=Xf(e).resolveInner(t,-1),r=null;for(let e=i;!r&&e.parent;e=e.parent)"OpenTag"!=e.name&&"CloseTag"!=e.name&&"SelfClosingTag"!=e.name&&"MismatchedCloseTag"!=e.name||(r=e);if(r&&(r.to>t||r.lastChild.type.isError)){let e=r.parent;if("TagName"==i.name)return"CloseTag"==r.name||"MismatchedCloseTag"==r.name?{type:"closeTag",from:i.from,context:e}:{type:"openTag",from:i.from,context:ux(e)};if("AttributeName"==i.name)return{type:"attrName",from:i.from,context:r};if("AttributeValue"==i.name)return{type:"attrValue",from:i.from,context:r};let n=i==r||"Attribute"==i.name?i.childBefore(t):i;return"StartTag"==(null==n?void 0:n.name)?{type:"openTag",from:t,context:ux(e)}:"StartCloseTag"==(null==n?void 0:n.name)&&n.to<=t?{type:"closeTag",from:t,context:e}:"Is"==(null==n?void 0:n.name)?{type:"attrValue",from:t,context:r}:n?{type:"attrName",from:t,context:r}:null}if("StartCloseTag"==i.name)return{type:"closeTag",from:t,context:i.parent};for(;i.parent&&i.to==t&&!(null===(n=i.lastChild)||void 0===n?void 0:n.type.isError);)i=i.parent;return"Element"==i.name||"Text"==i.name||"Document"==i.name?{type:"tag",from:t,context:"Element"==i.name?i:ux(i)}:null}(e.state,e.pos);if(!l||"tag"==l.type&&!e.explicit)return null;let{type:c,from:h,context:u}=l;if("openTag"==c){let e=o,t=hx(n,u);if(t){let n=a[t];e=(null==n?void 0:n.children)||s}return{from:h,options:e.map((e=>e.completion)),validFor:fx}}if("closeTag"==c){let i=hx(n,u);return i?{from:h,to:e.pos+(">"==n.sliceString(e.pos,e.pos+1)?1:0),options:[(null===(t=a[i])||void 0===t?void 0:t.closeNameCompletion)||{label:i+">",type:"type"}],validFor:fx}:null}if("attrName"==c){let e=a[cx(n,u)];return{from:h,options:(null==e?void 0:e.attrs)||i,validFor:fx}}if("attrValue"==c){let t=function(e,t,n){let i=t&&t.getChildren("Attribute").find((e=>e.from<=n&&e.to>=n)),r=i&&i.getChild("AttributeName");return r?e.sliceString(r.from,r.to):""}(n,u,h);if(!t)return null;let i=a[cx(n,u)],s=((null==i?void 0:i.attrValues)||r)[t];return s&&s.length?{from:h,to:e.pos+('"'==n.sliceString(e.pos,e.pos+1)?1:0),options:s,validFor:/^"[^"]*"?$/}:null}if("tag"==c){let t=hx(n,u),i=a[t],r=[],l=u&&u.lastChild;!t||l&&"CloseTag"==l.name&&cx(n,l)==t||r.push(i?i.closeCompletion:{label:"",type:"type",boost:2});let c=r.concat(((null==i?void 0:i.children)||(u?s:o)).map((e=>e.openCompletion)));if(u&&(null==i?void 0:i.text.length)){let t=u.firstChild;t.to>e.pos-20&&!/\S/.test(e.state.sliceDoc(t.to,e.pos))&&(c=c.concat(i.text))}return{from:h,options:c,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}return null}}const gx=Cf.define({name:"xml",parser:lx.configure({props:[Lf.add({Element(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"OpenTag CloseTag SelfClosingTag":e=>e.column(e.node.from)+e.unit}),sO.add({Element(e){let t=e.firstChild,n=e.lastChild;return t&&"OpenTag"==t.name?{from:t.to,to:"CloseTag"==n.name?n.from:e.to}:null}}),GO.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/$/}});const bx=nf({String:$f.string,Number:$f.number,"True False":$f.bool,PropertyName:$f.propertyName,Null:$f.null,",":$f.separator,"[ ]":$f.squareBracket,"{ }":$f.brace}),wx=Gw.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[bx],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),xx=Cf.define({name:"json",parser:wx.configure({props:[Lf.add({Object:iO({except:/^\s*\}/}),Array:iO({except:/^\s*\]/})}),sO.add({"Object Array":oO})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});const vx=new Set([27,51,52,270,67,133,58,59,251,64,65,74,62,63,154,155,158,115]);function yx(e){return 10==e||13==e}const Sx=new Xw(((e,t)=>{let n;if(e.next<0)e.acceptToken(206);else if(t.context.depth<0)yx(e.next)&&e.acceptToken(205,1);else if(((n=e.peek(-1))<0||yx(n))&&t.canShift(204)){let t=0;for(;32==e.next||9==e.next;)e.advance(),t++;10!=e.next&&13!=e.next&&35!=e.next||e.acceptToken(204,-t)}else yx(e.next)&&e.acceptToken(203,1)}),{contextual:!0}),$x=new Xw(((e,t)=>{let n=t.context.depth;if(n<0)return;let i=e.peek(-1);if(10==i||13==i){let t=0,i=0;for(;;){if(32==e.next)t++;else{if(9!=e.next)break;t+=8-t%8}e.advance(),i++}t!=n&&10!=e.next&&13!=e.next&&35!=e.next&&(te.depth<0&&vx.has(t)?e.parent:e,shift:(e,t,n,i)=>201==t?new Qx(e,function(e){let t=0;for(let n=0;ne.hash}),Px=new Xw((e=>{for(let t=0;t<5;t++){if(e.next!="print".charCodeAt(t))return;e.advance()}if(!/\w/.test(String.fromCharCode(e.next)))for(let t=0;;t++){let n=e.peek(t);if(32!=n&&9!=n)return void(40!=n&&46!=n&&10!=n&&13!=n&&35!=n&&e.acceptToken(1))}}));function Tx(e,t,n,i,r){return new Xw((s=>{let o=s.pos;for(;!(s.next<0);)if(123==s.next){if(123!=s.peek(1)){if(s.pos==o)return void s.acceptToken(i,1);break}s.advance(2)}else if(92==s.next)s.advance(),s.next>=0&&s.advance();else{if(s.next==e&&(1==t||s.peek(1)==e&&s.peek(2)==e)){if(s.pos==o)return void s.acceptToken(r,t);break}s.advance()}s.pos>o&&s.acceptToken(n)}))}const _x=Tx(39,1,207,2,208),Zx=Tx(34,1,209,3,210),Cx=Tx(39,3,211,4,212),Xx=Tx(34,3,213,5,214),Yx=nf({'async "*" "**" FormatConversion FormatSpec':$f.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":$f.controlKeyword,"in not and or is del":$f.operatorKeyword,"from def class global nonlocal lambda":$f.definitionKeyword,import:$f.moduleKeyword,"with as print":$f.keyword,Boolean:$f.bool,None:$f.null,VariableName:$f.variableName,"CallExpression/VariableName":$f.function($f.variableName),"FunctionDefinition/VariableName":$f.function($f.definition($f.variableName)),"ClassDefinition/VariableName":$f.definition($f.className),PropertyName:$f.propertyName,"CallExpression/MemberExpression/PropertyName":$f.function($f.propertyName),Comment:$f.lineComment,Number:$f.number,String:$f.string,FormatString:$f.special($f.string),UpdateOp:$f.updateOperator,"ArithOp!":$f.arithmeticOperator,BitOp:$f.bitwiseOperator,CompareOp:$f.compareOperator,AssignOp:$f.definitionOperator,Ellipsis:$f.punctuation,At:$f.meta,"( )":$f.paren,"[ ]":$f.squareBracket,"{ }":$f.brace,".":$f.derefOperator,", ;":$f.separator}),Rx={__proto__:null,await:48,or:58,and:60,in:64,not:66,is:68,if:74,else:76,lambda:80,yield:98,from:100,async:106,for:108,None:168,True:170,False:170,del:184,pass:188,break:192,continue:196,return:200,raise:208,import:212,as:214,global:218,nonlocal:220,assert:224,type:229,elif:242,while:246,try:252,except:254,finally:256,with:260,def:264,class:274,match:285,case:291},qx=Gw.deserialize({version:14,states:"#&jO`Q#yOOP$bOSOOO%kQ&nO'#HcOOQS'#Cq'#CqOOQS'#Cr'#CrO'ZQ#xO'#CpO(|Q&nO'#HbOOQS'#Hc'#HcOOQS'#DW'#DWOOQS'#Hb'#HbO)jQ#xO'#DaO)}Q#xO'#DhO*_Q#xO'#DlOOQS'#Dw'#DwO*rO,UO'#DwO*zO7[O'#DwO+SOWO'#DxO+_O`O'#DxO+jOpO'#DxO+uO!bO'#DxO-wQ&nO'#HSOOQS'#HS'#HSO'ZQ#xO'#HRO/ZQ&nO'#HROOQS'#Ee'#EeO/rQ#xO'#EfOOQS'#HQ'#HQO/|Q#xO'#HPOOQV'#HP'#HPO0XQ#xO'#F]OOQS'#Ge'#GeO0^Q#xO'#F[OOQV'#IY'#IYOOQV'#HO'#HOOOQV'#Ft'#FtQ`Q#yOOO'ZQ#xO'#CsO0lQ#xO'#DPO0sQ#xO'#DTO1RQ#xO'#HgO1cQ&nO'#EYO'ZQ#xO'#EZOOQS'#E]'#E]OOQS'#E_'#E_OOQS'#Ea'#EaO1wQ#xO'#EcO2_Q#xO'#EgO0XQ#xO'#EiO2rQ&nO'#EiO0XQ#xO'#ElO/rQ#xO'#EoO0XQ#xO'#EqO/rQ#xO'#EwO/rQ#xO'#EzO2}Q#xO'#E|O3UQ#xO'#FRO3aQ#xO'#E}O/rQ#xO'#FRO0XQ#xO'#FTO0XQ#xO'#FYO3fQ#xO'#F_P3mO#xO'#G}POOO)CBq)CBqOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS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$q$}%S%T%U%V%W%X%r%w%}&O&t'a'x)W)c)|+R+[,[-Z0Y1OR%b!pQ&W#cQ&Z#gQ&]#jQ&_#mR-`+lQ(}&WQ)P&ZQ)R&]Q)T&_Q+p)OQ+q)QQ+r)SQ+s)UQ.^-`R/V._Q$m!SQ&{$aQ*R'bR,`*SQ#zmQ$f!PQ$i!QR'T$hQ)h'SR+|)kQ)h'SQ+{)jR+|)kR$k!RR)u'YXqOs*W,dQ$s!WR'c$tQ$z!ZR'd$uR*k'pQ*i'pV-|,s-}.lQ.{.RQ/i.uR/j.vU.t.R.u.vQ/n.xQ/y/^Q0O/dU0Q/f0R0bQ0V/kQ0e0WQ0g0]U0i0^0k0sQ0t0mQ0x0rR0y0uR/m.wR/{/^",nodeNames:"⚠ print { { { { Comment Script AssignStatement * BinaryExpression BitOp BitOp BitOp BitOp ArithOp ArithOp @ ArithOp ** UnaryExpression ArithOp BitOp AwaitExpression await ) ( ParenthesizedExpression BinaryExpression or and CompareOp in not is UnaryExpression ConditionalExpression if else LambdaExpression lambda ParamList VariableName AssignOp , : NamedExpression AssignOp YieldExpression yield from TupleExpression ComprehensionExpression async for LambdaExpression ] [ ArrayExpression ArrayComprehensionExpression } { DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression CallExpression ArgList AssignOp MemberExpression . PropertyName Number String FormatString FormatReplacement FormatConversion FormatSpec FormatReplacement FormatReplacement FormatReplacement FormatReplacement ContinuedString Ellipsis None Boolean TypeDef AssignOp UpdateStatement UpdateOp ExpressionStatement DeleteStatement del PassStatement pass BreakStatement break ContinueStatement continue ReturnStatement return YieldStatement PrintStatement RaiseStatement raise ImportStatement import as ScopeStatement global nonlocal AssertStatement assert TypeDefinition type TypeParamList TypeParam StatementGroup ; IfStatement Body elif WhileStatement while ForStatement TryStatement try except finally WithStatement with FunctionDefinition def ParamList AssignOp TypeDef ClassDefinition class DecoratedStatement Decorator At MatchStatement match MatchBody MatchClause case CapturePattern LiteralPattern ArithOp ArithOp AsPattern OrPattern LogicOp AttributePattern SequencePattern MappingPattern StarPattern ClassPattern PatternArgList KeywordPattern KeywordPattern Guard",maxTerm:283,context:kx,nodeProps:[["group",-15,8,88,90,91,93,95,97,99,101,102,103,105,108,111,113,"Statement Statement",-22,10,20,23,27,42,51,52,58,59,62,63,64,65,66,69,72,73,74,82,83,84,85,"Expression",-10,117,119,122,124,125,129,131,136,138,141,"Statement",-9,146,147,150,151,153,154,155,156,157,"Pattern"],["openedBy",25,"(",56,"[",60,"{"],["closedBy",26,")",57,"]",61,"}"]],propSources:[Yx],skippedNodes:[0,6],repeatNodeCount:38,tokenData:"%-W#sR!`OX%TXY=|Y[%T[]=|]p%Tpq=|qr@_rsDOst!+|tu%Tuv!Nnvw#!|wx#$Wxy#:Uyz#;Yz{#<^{|#>x|}#@S}!O#AW!O!P#Ci!P!Q#N_!Q!R$!y!R![$&w![!]$1e!]!^$3s!^!_$4w!_!`$7c!`!a$8m!a!b%T!b!c$;U!c!d$W!e!h$W#V#Y$Q<%lO$Xc&r!b&jS&mW%p!TOX%TXY=|Y[%T[]=|]p%Tpq=|qr%Trs&Vsw%Twx/Xx#O%T#O#P?d#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#s?i[&r!bOY%TYZ=|Z]%T]^=|^#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=P;=`<%l8^<%lO%T!q@hd&r!b&jS&mWOr%Trs&Vsw%Twx/Xx!_%T!_!`Av!`#O%T#O#P7o#P#T%T#T#UBz#U#f%T#f#gBz#g#hBz#h#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T!qBR]oR&r!b&jS&mWOr%Trs&Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T!qCV]!nR&r!b&jS&mWOr%Trs&Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S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=`<%l!Ag<%lO4`!]!E`P;=`<%l!Ag#o!EhW&mWOr4`rs4zs#O4`#O#P5y#P;'S4`;'S;=`6t;=`<%l!=U<%lO4`#o!FTP;=`<%l!=U#s!F_[U!T&r!bOY!+|YZ%TZ]!+|]^%T^#o!+|#o#p!GT#p#q!+|#q#r!GT#r;'S!+|;'S;=`!Mq;=`<%l8^<%lO!+|!a!G^]U!T&jS&mWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!H^]U!T&jSOY!GTYZ8^Z]!GT]^8^^r!GTrs!IVsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!I^]U!T&jSOY!GTYZ8^Z]!GT]^8^^r!GTrs!5wsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!J^]U!T&mWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!KVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!K^]U!T&mWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!Agx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!L[WU!TOY!GTYZ8^Z]!GT]^8^^;'S!GT;'S;=`!Lt;=`<%l8^<%lO!GT!a!L{Y&jS&mWOr8^rs9Qsw8^wx:dx#O8^#O#P;v#P;'S8^;'S;=`Q<%lO$TP;=`<%l$ei&r!b&jS&mW&g`&SsOr%Trs$@Ssw%Twx$C`x!Q%T!Q![$Q<%lO$Q<%lO$Q<%lO$Q<%lO$Q<%lO$Rx[e]||-1}],tokenPrec:7372}),Ax=new Nd,Wx=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function Ex(e){return(t,n,i)=>{if(i)return!1;let r=t.node.getChild("VariableName");return r&&n(r,e),!0}}const jx={FunctionDefinition:Ex("function"),ClassDefinition:Ex("class"),ForStatement(e,t,n){if(n)for(let n=e.node.firstChild;n;n=n.nextSibling)if("VariableName"==n.name)t(n,"variable");else if("in"==n.name)break},ImportStatement(e,t){var n,i;let{node:r}=e,s="from"==(null===(n=r.firstChild)||void 0===n?void 0:n.name);for(let e=r.getChild("import");e;e=e.nextSibling)"VariableName"==e.name&&"as"!=(null===(i=e.nextSibling)||void 0===i?void 0:i.name)&&t(e,s?"variable":"namespace")},AssignStatement(e,t){for(let n=e.node.firstChild;n;n=n.nextSibling)if("VariableName"==n.name)t(n,"variable");else if(":"==n.name||"AssignOp"==n.name)break},ParamList(e,t){for(let n=null,i=e.node.firstChild;i;i=i.nextSibling)"VariableName"!=i.name||n&&/\*|AssignOp/.test(n.name)||t(i,"variable"),n=i},CapturePattern:Ex("variable"),AsPattern:Ex("variable"),__proto__:null};function zx(e,t){let n=Ax.get(t);if(n)return n;let i=[],r=!0;function s(t,n){let r=e.sliceString(t.from,t.to);i.push({label:r,type:n})}return t.cursor(_d.IncludeAnonymous).iterate((t=>{if(t.name){let e=jx[t.name];if(e&&e(t,s,r)||!r&&Wx.has(t.name))return!1;r=!1}else if(t.to-t.from>8192){for(let n of zx(e,t.node))i.push(n);return!1}})),Ax.set(t,i),i}const Dx=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,Ux=["String","FormatString","Comment","PropertyName"];function Vx(e){let t=Xf(e.state).resolveInner(e.pos,-1);if(Ux.indexOf(t.name)>-1)return null;let n="VariableName"==t.name||t.to-t.from<20&&Dx.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let i=[];for(let n=t;n;n=n.parent)Wx.has(n.name)&&(i=i.concat(zx(e.state.doc,n)));return{options:i,from:n?t.from:e.pos,validFor:Dx}}const Ix=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map((e=>({label:e,type:"constant"}))).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map((e=>({label:e,type:"type"})))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map((e=>({label:e,type:"class"})))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map((e=>({label:e,type:"function"})))),Mx=[_b("def ${name}(${params}):\n\t${}",{label:"def",detail:"function",type:"keyword"}),_b("for ${name} in ${collection}:\n\t${}",{label:"for",detail:"loop",type:"keyword"}),_b("while ${}:\n\t${}",{label:"while",detail:"loop",type:"keyword"}),_b("try:\n\t${}\nexcept ${error}:\n\t${}",{label:"try",detail:"/ except block",type:"keyword"}),_b("if ${}:\n\t\n",{label:"if",detail:"block",type:"keyword"}),_b("if ${}:\n\t${}\nelse:\n\t${}",{label:"if",detail:"/ else block",type:"keyword"}),_b("class ${name}:\n\tdef __init__(self, ${params}):\n\t\t\t${}",{label:"class",detail:"definition",type:"keyword"}),_b("import ${module}",{label:"import",detail:"statement",type:"keyword"}),_b("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],Gx=Eg(Ux,Wg(Ix.concat(Mx)));function Bx(e,t){let n=e.baseIndentFor(t),i=e.lineAt(e.pos,-1),r=i.from+i.text.length;return/^\s*($|#)/.test(i.text)&&e.node.ton?null:n+e.unit}const Nx=Cf.define({name:"python",parser:qx.configure({props:[Lf.add({Body:e=>{var t;return null!==(t=Bx(e,e.node))&&void 0!==t?t:e.continue()},IfStatement:e=>/^\s*(else:|elif )/.test(e.textAfter)?e.baseIndent:e.continue(),TryStatement:e=>/^\s*(except |finally:|else:)/.test(e.textAfter)?e.baseIndent:e.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":tO({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":tO({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":tO({closing:"]"}),"String FormatString":()=>null,Script:e=>{if(e.pos+/\s*/.exec(e.textAfter)[0].length>=e.node.to){let t=null;for(let n=e.node,i=n.to;n=n.lastChild,n&&n.to==i;)"Body"==n.type.name&&(t=n);if(t){let n=Bx(e,t);if(null!=n)return n}}return e.continue()}}),sO.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":oO,Body:(e,t)=>({from:e.from+1,to:e.to-(e.to==t.doc.length?0:1)})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:)$/}});const Lx=[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],Fx=new Mw({start:!1,shift:(e,t)=>3==t||4==t||307==t?e:308==t,strict:!1}),Hx=new Xw(((e,t)=>{let{next:n}=e;(125==n||-1==n||t.context)&&e.acceptToken(305)}),{contextual:!0,fallback:!0}),Kx=new Xw(((e,t)=>{let n,{next:i}=e;Lx.indexOf(i)>-1||(47!=i||47!=(n=e.peek(1))&&42!=n)&&(125==i||59==i||-1==i||t.context||e.acceptToken(304))}),{contextual:!0}),Jx=new Xw(((e,t)=>{let{next:n}=e;if((43==n||45==n)&&(e.advance(),n==e.next)){e.advance();let n=!t.context&&t.canShift(1);e.acceptToken(n?1:2)}}),{contextual:!0}),ev=nf({"get set async static":$f.modifier,"for while do if else switch try catch finally return throw break continue default case":$f.controlKeyword,"in of await yield void typeof delete instanceof":$f.operatorKeyword,"let var const using function class extends":$f.definitionKeyword,"import export from":$f.moduleKeyword,"with debugger as 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),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":$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)}),tv={__proto__:null,export:16,as:21,from:29,default:32,async:37,function:38,extends:48,this:52,true:60,false:60,null:72,void:76,typeof:80,super:98,new:132,delete:148,yield:157,await:161,class:166,public:223,private:223,protected:223,readonly:225,instanceof:244,satisfies:247,in:248,const:250,import:282,keyof:337,unique:341,infer:347,is:383,abstract:403,implements:405,type:407,let:410,var:412,using:415,interface:421,enum:425,namespace:431,module:433,declare:437,global:441,for:460,of:469,while:472,with:476,do:480,if:484,else:486,switch:490,case:496,try:502,catch:506,finally:510,return:514,throw:518,break:522,continue:526,debugger:530},nv={__proto__:null,async:119,get:121,set:123,declare:183,public:185,private:185,protected:185,static:187,abstract:189,override:191,readonly:197,accessor:199,new:387},iv={__proto__:null,"<":139},rv=Gw.deserialize({version:14,states:"$6zO%TQUOOO%[QUOOO'_QWOOP(lOSOOO*zQ(CjO'#CgO+ROpO'#ChO+aO!bO'#ChO+oO07`O'#D[O.QQUO'#DbO.bQUO'#DmO%[QUO'#DwO0fQUO'#EPOOQ(CY'#EX'#EXO1PQSO'#EUOOQO'#Ej'#EjOOQO'#Id'#IdO1XQSO'#GlO1dQSO'#EiO1iQSO'#EiO3kQ(CjO'#JeO6[Q(CjO'#JfO6xQSO'#FXO6}Q#tO'#FpOOQ(CY'#Fa'#FaO7YO&jO'#FaO7hQ,UO'#FwO9OQSO'#FvOOQ(CY'#Jf'#JfOOQ(CW'#Je'#JeO9TQSO'#GpOOQQ'#K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Comment Script Hashbang ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList 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 : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate 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 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:367,context:Fx,nodeProps:[["group",-26,7,15,17,63,200,204,208,209,211,214,217,227,229,235,237,239,241,244,250,256,258,260,262,264,266,267,"Statement",-32,11,12,26,29,30,36,46,49,50,52,57,65,73,77,79,81,82,104,105,114,115,132,135,137,138,139,140,142,143,163,164,166,"Expression",-23,25,27,31,35,37,39,167,169,171,172,174,175,176,178,179,180,182,183,184,194,196,198,199,"Type",-3,85,97,103,"ClassItem"],["openedBy",32,"InterpolationStart",51,"[",55,"{",70,"(",144,"JSXStartTag",156,"JSXStartTag JSXStartCloseTag"],["closedBy",34,"InterpolationEnd",45,"]",56,"}",71,")",145,"JSXSelfCloseEndTag JSXEndTag",161,"JSXEndTag"]],propSources:[ev],skippedNodes:[0,3,4,270],repeatNodeCount:33,tokenData:"$Fl(CSR!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#8g!R![#:v![!]#Gv!]!^#IS!^!_#J^!_!`#Nu!`!a$#a!a!b$(n!b!c$,m!c!}Er!}#O$-w#O#P$/R#P#Q$4j#Q#R$5t#R#SEr#S#T$7R#T#o$8]#o#p$s#r#s$@P#s$f%Z$f$g+g$g#BYEr#BY#BZ$AZ#BZ$ISEr$IS$I_$AZ$I_$I|Er$I|$I}$Df$I}$JO$Df$JO$JTEr$JT$JU$AZ$JU$KVEr$KV$KW$AZ$KW&FUEr&FU&FV$AZ&FV;'SEr;'S;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%Z!Q!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#b%Z#b#c#tv[e]||-1},{term:330,get:e=>nv[e]||-1},{term:68,get:e=>iv[e]||-1}],tokenPrec:12827}),sv=[_b("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),_b("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),_b("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),_b("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),_b("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),_b("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),_b("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),_b("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),_b("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),_b('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),_b('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],ov=sv.concat([_b("interface ${name} {\n\t${}\n}",{label:"interface",detail:"definition",type:"keyword"}),_b("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),_b("enum ${name} {\n\t${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),av=new Nd,lv=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function cv(e){return(t,n)=>{let i=t.node.getChild("VariableDefinition");return i&&n(i,e),!0}}const hv=["FunctionDeclaration"],uv={FunctionDeclaration:cv("function"),ClassDeclaration:cv("class"),ClassExpression:()=>!0,EnumDeclaration:cv("constant"),TypeAliasDeclaration:cv("type"),NamespaceDeclaration:cv("namespace"),VariableDefinition(e,t){e.matchContext(hv)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function dv(e,t){let n=av.get(t);if(n)return n;let i=[],r=!0;function s(t,n){let r=e.sliceString(t.from,t.to);i.push({label:r,type:n})}return t.cursor(_d.IncludeAnonymous).iterate((t=>{if(r)r=!1;else if(t.name){let e=uv[t.name];if(e&&e(t,s)||lv.has(t.name))return!1}else if(t.to-t.from>8192){for(let n of dv(e,t.node))i.push(n);return!1}})),av.set(t,i),i}const fv=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Ov=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function pv(e){let t=Xf(e.state).resolveInner(e.pos,-1);if(Ov.indexOf(t.name)>-1)return null;let n="VariableName"==t.name||t.to-t.from<20&&fv.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let i=[];for(let n=t;n;n=n.parent)lv.has(n.name)&&(i=i.concat(dv(e.state.doc,n)));return{options:i,from:n?t.from:e.pos,validFor:fv}}const mv=Cf.define({name:"javascript",parser:rv.configure({props:[Lf.add({IfStatement:iO({except:/^\s*({|else\b)/}),TryStatement:iO({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:e=>e.baseIndent,SwitchBody:e=>{let t=e.textAfter,n=/^\s*\}/.test(t),i=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:i?1:2)*e.unit},Block:tO({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":iO({except:/^{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag":e=>e.column(e.node.from)+e.unit}),sO.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":oO,BlockComment:e=>({from:e.from+2,to:e.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),gv={test:e=>/^JSX/.test(e.name),facet:Pf({commentTokens:{block:{open:"{/*",close:"*/}"}}})},bv=mv.configure({dialect:"ts"},"typescript"),wv=mv.configure({dialect:"jsx",props:[Tf.add((e=>e.isTop?[gv]:void 0))]}),xv=mv.configure({dialect:"jsx ts",props:[Tf.add((e=>e.isTop?[gv]:void 0))]},"typescript");let vv=e=>({label:e,type:"keyword"});const yv="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(vv),Sv=yv.concat(["declare","implements","private","protected","public"].map(vv));function $v(e,t,n=e.length){for(let i=null==t?void 0:t.firstChild;i;i=i.nextSibling)if("JSXIdentifier"==i.name||"JSXBuiltin"==i.name||"JSXNamespacedName"==i.name||"JSXMemberExpression"==i.name)return e.sliceString(i.from,Math.min(i.to,n));return""}const Qv="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),kv=Xh.inputHandler.of(((e,t,n,i,r)=>{if((Qv?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||">"!=i&&"/"!=i||!mv.isActiveAt(e.state,t,-1))return!1;let s=r(),{state:o}=s,a=o.changeByRange((e=>{var t;let n,{head:r}=e,s=Xf(o).resolveInner(r-1,-1);if("JSXStartTag"==s.name&&(s=s.parent),o.doc.sliceString(r-1,r)!=i||"JSXAttributeValue"==s.name&&s.to>r);else{if(">"==i&&"JSXFragmentTag"==s.name)return{range:e,changes:{from:r,insert:""}};if("/"==i&&"JSXStartCloseTag"==s.name){let e=s.parent,i=e.parent;if(i&&e.from==r-2&&((n=$v(o.doc,i.firstChild,r))||"JSXFragmentTag"==(null===(t=i.firstChild)||void 0===t?void 0:t.name))){let e=`${n}>`;return{range:Qs.cursor(r+e.length,-1),changes:{from:r,insert:e}}}}else if(">"==i){let t=function(e){for(;;){if("JSXOpenTag"==e.name||"JSXSelfClosingTag"==e.name||"JSXFragmentTag"==e.name)return e;if("JSXEscape"==e.name||!e.parent)return null;e=e.parent}}(s);if(t&&!/^\/?>|^<\//.test(o.doc.sliceString(r,r+2))&&(n=$v(o.doc,t,r)))return{range:e,changes:{from:r,insert:``}}}}return{range:e}}));return!a.changes.empty&&(e.dispatch([s,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)})),Pv="#56b6c2",Tv="#d3d8e0",_v="#7d8799",Zv="#d19a66",Cv="#2c313a",Xv="#353a42",Yv="#528bff",Rv=[Xh.theme({"&":{color:Tv},".cm-content":{caretColor:Yv},".cm-cursor, .cm-dropCursor":{borderLeftColor:Yv},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"#3E4451"},".cm-panels":{backgroundColor:"#21252b",color:Tv},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847",outline:"1px solid #515a6b"},".cm-gutters":{backgroundColor:"#282c34",color:_v,border:"none"},".cm-activeLineGutter":{backgroundColor:Cv},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Xv},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Xv,borderBottomColor:Xv},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Cv,color:Tv}}},{dark:!0}),YO(_O.define([{tag:[$f.tagName],color:"#e06c75"},{tag:[$f.propertyName],color:Zv},{tag:[$f.separator,$f.character,$f.name,$f.operator,$f.operatorKeyword],color:Tv},{tag:[$f.url,$f.link],color:Pv},{tag:[$f.meta,$f.comment,$f.processingInstruction],color:_v},{tag:[$f.string],color:"#98c379"},{tag:$f.invalid,color:"#ffffff"},{tag:$f.keyword,color:"#c678dd"},{tag:[$f.url,$f.escape,$f.regexp,$f.link,$f.special($f.string)],color:Pv},{tag:[$f.function($f.variableName),$f.labelName],color:"#61afef"},{tag:[$f.color,$f.constant($f.name),$f.standard($f.name)],color:Zv},{tag:[$f.typeName,$f.className,$f.number,$f.changed,$f.annotation,$f.modifier,$f.self,$f.namespace],color:"#e5c07b"},{tag:[$f.atom,$f.bool,$f.special($f.variableName)],color:Zv}]))],qv="#abb2bf",Av="#778191",Wv="#323232",Ev="#a807ed",jv="#006eff",zv="#e63c5b",Dv="#ebebeb",Uv="#528bff",Vv="#e87307",Iv=[Xh.theme({"&":{color:Wv},".cm-content":{caretColor:Uv},".cm-cursor, .cm-dropCursor":{borderLeftColor:Uv},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"#c7dded"},".cm-panels":{color:Wv},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847",outline:"1px solid #515a6b"},".cm-gutters":{backgroundColor:"#fff",color:Av,border:"none"},".cm-activeLineGutter":{backgroundColor:Dv},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:qv},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:qv,borderBottomColor:qv},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Dv,color:qv}}},{dark:!1}),YO(_O.define([{tag:[$f.tagName],color:zv},{tag:[$f.propertyName],color:Vv},{tag:[$f.separator,$f.character,$f.name],color:Wv},{tag:[$f.url,$f.link],color:Ev},{tag:[$f.meta,$f.comment,$f.processingInstruction],color:Av},{tag:[$f.string],color:"#34a312"},{tag:$f.invalid,color:"#0000000"},{tag:$f.keyword,color:Ev},{tag:[$f.operator,$f.operatorKeyword,$f.url,$f.escape,$f.regexp,$f.link,$f.special($f.string)],color:"#226b53"},{tag:[$f.function($f.variableName),$f.labelName],color:jv},{tag:[$f.color,$f.constant($f.name),$f.standard($f.name)],color:jv},{tag:[$f.typeName,$f.className,$f.number,$f.changed,$f.annotation,$f.modifier,$f.self,$f.namespace],color:zv},{tag:[$f.atom,$f.bool,$f.special($f.variableName)],color:Vv}]))];var Mv;!function(e){const t=new Vs,n=new Vs;function i(e){switch(e){case"xml":return function(e={}){return new Uf(gx,gx.data.of({autocomplete:mx(e.elements||[],e.attributes||[])}))}();case"json":return new Uf(xx);case"js":return function(e={}){let t=e.jsx?e.typescript?xv:wv:e.typescript?bv:mv,n=e.typescript?ov.concat(Sv):sv.concat(yv);return new Uf(t,[mv.data.of({autocomplete:Eg(Ov,Wg(n))}),mv.data.of({autocomplete:pv}),e.jsx?kv:[]])}();case"py":return new Uf(Nx,[Nx.data.of({autocomplete:Vx}),Nx.data.of({autocomplete:Gx})])}}e.create=function(e,r,s){return new Xh({parent:e,state:go.create({extensions:[vw,zh.of([Xm]),n.of(i(s)),t.of(r?Rv:Iv),go.readOnly.of(!0)]})})},e.updateContent=function(e,t,r,s=!1){const o=[n.reconfigure(i(r))];s&&o.push(Xh.scrollIntoView(0)),e.update([e.state.update({changes:{from:0,to:e.state.doc.length,insert:t},effects:o})])},e.updateTheme=function(e,n){const i=n?Rv:Iv;e.dispatch({effects:t.reconfigure(i)})}}(Mv||(Mv={}));var Gv=Mv;function Bv(e){let t,n,i,r,s;return{c(){t=P("button"),n=P("img"),c(n.src,i="./assets/icons/code-slash-outline.svg")||X(n,"src","./assets/icons/code-slash-outline.svg"),X(n,"alt","code"),X(n,"class","svg h-5 w-5"),X(t,"title","Format XML"),X(t,"class","tint-on-hover"),t.disabled=e[2]},m(i,o){$(i,t,o),v(t,n),r||(s=C(t,"click",e[6]),r=!0)},p(e,n){4&n&&(t.disabled=e[2])},d(e){e&&Q(t),r=!1,s()}}}function Nv(e){let t,n,i;function r(t){e[10](t)}let s={text:"File content formatted!"};return void 0!==e[3]&&(s.visible=e[3]),t=new ur({props:s}),K.push((()=>Te(t,"visible",r))),{c(){_e(t.$$.fragment)},m(e,n){Ze(t,e,n),i=!0},p(e,i){const r={};!n&&8&i&&(n=!0,r.visible=e[3],oe((()=>n=!1))),t.$set(r)},i(e){i||(be(t.$$.fragment,e),i=!0)},o(e){we(t.$$.fragment,e),i=!1},d(e){Ce(t,e)}}}function Lv(e){let t,n,i;function r(t){e[11](t)}let s={text:"File content copied!"};return void 0!==e[4]&&(s.visible=e[4]),t=new ur({props:s}),K.push((()=>Te(t,"visible",r))),{c(){_e(t.$$.fragment)},m(e,n){Ze(t,e,n),i=!0},p(e,i){const r={};!n&&16&i&&(n=!0,r.visible=e[4],oe((()=>n=!1))),t.$set(r)},i(e){i||(be(t.$$.fragment,e),i=!0)},o(e){we(t.$$.fragment,e),i=!1},d(e){Ce(t,e)}}}function Fv(e){let t,n,i,r,s,o,a,l,c,h,u,d,f,O,p,m=e[0].displayName+"",g=e[5]&&Bv(e),b=e[3]&&Nv(e),w=e[4]&&Lv(e);return{c(){t=P("div"),n=P("p"),i=T(m),r=_(),s=P("div"),g&&g.c(),o=_(),a=P("button"),a.innerHTML='code',l=_(),c=P("div"),h=_(),b&&b.c(),u=_(),w&&w.c(),d=Z(),X(n,"class","text-xs text-subtle whitespace-nowrap text-ellipsis overflow-hidden"),X(a,"title","Copy to Clipboard"),X(a,"class","tint-on-hover"),X(s,"class","flex items-center gap-4"),X(t,"class","absolute top-0 left-0 right-0 h-8 flex items-center justify-between px-2"),X(c,"class","absolute top-8 bottom-0 left-0 right-0 overflow-auto")},m(m,x){$(m,t,x),v(t,n),v(n,i),v(t,r),v(t,s),g&&g.m(s,null),v(s,o),v(s,a),$(m,l,x),$(m,c,x),e[9](c),$(m,h,x),b&&b.m(m,x),$(m,u,x),w&&w.m(m,x),$(m,d,x),f=!0,O||(p=C(a,"click",e[7]),O=!0)},p(e,[t]){(!f||1&t)&&m!==(m=e[0].displayName+"")&&R(i,m),e[5]?g?g.p(e,t):(g=Bv(e),g.c(),g.m(s,o)):g&&(g.d(1),g=null),e[3]?b?(b.p(e,t),8&t&&be(b,1)):(b=Nv(e),b.c(),be(b,1),b.m(u.parentNode,u)):b&&(me(),we(b,1,1,(()=>{b=null})),ge()),e[4]?w?(w.p(e,t),16&t&&be(w,1)):(w=Lv(e),w.c(),be(w,1),w.m(d.parentNode,d)):w&&(me(),we(w,1,1,(()=>{w=null})),ge())},i(e){f||(be(b),be(w),f=!0)},o(e){we(b),we(w),f=!1},d(n){n&&Q(t),g&&g.d(),n&&Q(l),n&&Q(c),e[9](null),n&&Q(h),b&&b.d(n),n&&Q(u),w&&w.d(n),n&&Q(d),O=!1,p()}}}function Hv(e,t,n){let i;const{XmlDocumentNode:r}=window.S4TK.xml;let s,o,{info:a}=t,l=!1,c=!1,h=!1,u=!1;const d=[Ot.subscribe("isLightTheme",(e=>{s&&Gv.updateTheme(s,!e)}))];return N((()=>{n(8,s=Gv.create(o,!ft.isLightTheme,a.language))})),L((()=>{d.forEach((e=>e()))})),e.$$set=e=>{"info"in e&&n(0,a=e.info)},e.$$.update=()=>{1&e.$$.dirty&&n(5,i="xml"===a.language),257&e.$$.dirty&&s&&a&&(Gv.updateContent(s,a.textContent,a.language,!c),n(2,l=!1),c=!0)},[a,o,l,h,u,i,function(){try{if(l)return;const e=r.from(a.textContent).toXml({spacesPerIndent:ft.formatXmlSpaces});Gv.updateContent(s,e,a.language),n(2,l=!0),h||n(3,h=!0)}catch(e){console.error(e)}},function(){try{const e=s.state.doc.toString();navigator.clipboard.writeText(e),u||n(4,u=!0)}catch(e){console.error(e)}},s,function(e){K[e?"unshift":"push"]((()=>{o=e,n(1,o)}))},function(e){h=e,n(3,h)},function(e){u=e,n(4,u)}]}class Kv extends Ye{constructor(e){super(),Xe(this,e,Hv,Fv,a,{info:0})}}function Jv(t){let n,i;return n=new qr({}),{c(){_e(n.$$.fragment)},m(e,t){Ze(n,e,t),i=!0},p:e,i(e){i||(be(n.$$.fragment,e),i=!0)},o(e){we(n.$$.fragment,e),i=!1},d(e){Ce(n,e)}}}function ey(e){let t,n,i,r;const s=[oy,sy,ry,iy,ny,ty],o=[];function a(e,t){return e[0].renderType===at.PlainText?0:e[0].renderType===at.StringTable?1:e[0].renderType===at.Image?2:e[0].renderType===at.Corrupt?3:e[0].renderType===at.Deleted?4:5}return t=a(e),n=o[t]=s[t](e),{c(){n.c(),i=Z()},m(e,n){o[t].m(e,n),$(e,i,n),r=!0},p(e,r){let l=t;t=a(e),t===l?o[t].p(e,r):(me(),we(o[l],1,1,(()=>{o[l]=null})),ge(),n=o[t],n?n.p(e,r):(n=o[t]=s[t](e),n.c()),be(n,1),n.m(i.parentNode,i))},i(e){r||(be(n),r=!0)},o(e){we(n),r=!1},d(e){o[t].d(e),e&&Q(i)}}}function ty(e){let t,n;return t=new Br({props:{info:e[0],title:"Unsupported",description:"This file type is not supported by S4TK."}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.info=e[0]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function ny(e){let t,n;return t=new Br({props:{info:e[0],title:"Deleted Record",description:"Deleted records have no content."}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.info=e[0]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function iy(e){let t,n;return t=new Br({props:{info:e[0],title:"Corrupt",description:"This file appears to be corrupt."}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.info=e[0]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function ry(e){let t,n;return t=new jr({props:{info:e[0]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.info=e[0]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function sy(e){let t,n;return t=new Ir({props:{info:e[0]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.info=e[0]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function oy(e){let t,n;return t=new Kv({props:{info:e[0]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.info=e[0]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function ay(e){let t,n,i,r,s;const o=[ey,Jv],a=[];function l(e,n){return 1&n&&(t=null),null==t&&(t=!!Boolean(e[0])),t?0:1}return n=l(e,-1),i=a[n]=o[n](e),{c(){i.c(),r=Z()},m(e,t){a[n].m(e,t),$(e,r,t),s=!0},p(e,[t]){let s=n;n=l(e,t),n===s?a[n].p(e,t):(me(),we(a[s],1,1,(()=>{a[s]=null})),ge(),i=a[n],i?i.p(e,t):(i=a[n]=o[n](e),i.c()),be(i,1),i.m(r.parentNode,r))},i(e){s||(be(i),s=!0)},o(e){we(i),s=!1},d(e){a[n].d(e),e&&Q(r)}}}function ly(e,t,n){let i;const r=[ot.onViewedFileChange.subscribe((e=>{n(0,i=e)}))];return N((()=>{Rt.requestRefresh()})),L((()=>{r.forEach((e=>e()))})),[i]}class cy extends Ye{constructor(e){super(),Xe(this,e,ly,ay,a,{})}}function hy(t){let n,i,r,s,o;return{c(){n=P("button"),i=P("img"),c(i.src,r="./assets/icons/chevron-"+t[0]+".svg")||X(i,"src",r),X(i,"alt","clear"),X(i,"class","svg h-4 w-4"),X(n,"title",t[1])},m(e,r){$(e,n,r),v(n,i),s||(o=C(n,"click",t[2]),s=!0)},p(e,[t]){1&t&&!c(i.src,r="./assets/icons/chevron-"+e[0]+".svg")&&X(i,"src",r),2&t&&X(n,"title",e[1])},i:e,o:e,d(e){e&&Q(n),s=!1,o()}}}function uy(e,t,n){let i,r,{isCollapsed:s}=t;return e.$$set=e=>{"isCollapsed"in e&&n(3,s=e.isCollapsed)},e.$$.update=()=>{8&e.$$.dirty&&n(1,i=s?"Expand":"Collapse"),8&e.$$.dirty&&n(0,r=s?"up":"down")},[r,i,function(){n(3,s=!s)},s]}class dy extends Ye{constructor(e){super(),Xe(this,e,uy,hy,a,{isCollapsed:3})}}function fy(t){let n,i,r,s,a,l,c,h,u;return{c(){n=P("button"),i=P("p"),r=P("span"),s=T(t[0]),a=T("\n ("),l=T(t[1]),c=T(")"),X(r,"class","uppercase text-inherit"),X(i,"class","text-xs text-gray-400 dark:text-gray-400 svelte-1oz4oo2"),E(i,"active",t[2]),X(n,"class","px-1 pb-1 border-b border-solid border-b-transparent svelte-1oz4oo2"),E(n,"active",t[2])},m(e,d){$(e,n,d),v(n,i),v(i,r),v(r,s),v(i,a),v(i,l),v(i,c),h||(u=C(n,"click",(function(){o(t[3])&&t[3].apply(this,arguments)})),h=!0)},p(e,[r]){t=e,1&r&&R(s,t[0]),2&r&&R(l,t[1]),4&r&&E(i,"active",t[2]),4&r&&E(n,"active",t[2])},i:e,o:e,d(e){e&&Q(n),h=!1,u()}}}function Oy(e,t,n){let{title:i}=t,{countText:r}=t,{active:s}=t,{onClick:o}=t;return e.$$set=e=>{"title"in e&&n(0,i=e.title),"countText"in e&&n(1,r=e.countText),"active"in e&&n(2,s=e.active),"onClick"in e&&n(3,o=e.onClick)},[i,r,s,o]}class py extends Ye{constructor(e){super(),Xe(this,e,Oy,fy,a,{title:0,countText:1,active:2,onClick:3})}}function my(e){let t,n,i,r,s=e[0].code+"";return{c(){t=P("span"),n=T("["),i=T(s),r=T("]"),X(t,"class","text-subtle monospace")},m(e,s){$(e,t,s),v(t,n),v(t,i),v(t,r)},p(e,t){1&t&&s!==(s=e[0].code+"")&&R(i,s)},d(e){e&&Q(t)}}}function gy(e){let t,n,i,r,s,o,a,l,c,h,u,d,f,O,p=e[0].message+"";n=new Nt({props:{level:e[0].level,inline:!0}});let m=e[1]&&my(e);return{c(){t=P("button"),_e(n.$$.fragment),i=_(),r=P("p"),s=T(e[2]),a=_(),l=P("p"),m&&m.c(),c=_(),h=T(p),X(r,"class",o="mr-1 text-xs uppercase font-bold inline diagnostics-text "+e[3]),X(l,"class","text-sm inline"),X(t,"class",u="w-full px-2 pb-1 diagnostics-bg "+e[3]+" text-left"),X(t,"title",e[4])},m(o,u){$(o,t,u),Ze(n,t,null),v(t,i),v(t,r),v(r,s),v(t,a),v(t,l),m&&m.m(l,null),v(l,c),v(l,h),d=!0,f||(O=C(t,"click",e[5]),f=!0)},p(e,[i]){const a={};1&i&&(a.level=e[0].level),n.$set(a),(!d||4&i)&&R(s,e[2]),(!d||8&i&&o!==(o="mr-1 text-xs uppercase font-bold inline diagnostics-text "+e[3]))&&X(r,"class",o),e[1]?m?m.p(e,i):(m=my(e),m.c(),m.m(l,c)):m&&(m.d(1),m=null),(!d||1&i)&&p!==(p=e[0].message+"")&&R(h,p),(!d||8&i&&u!==(u="w-full px-2 pb-1 diagnostics-bg "+e[3]+" text-left"))&&X(t,"class",u),(!d||16&i)&&X(t,"title",e[4])},i(e){d||(be(n.$$.fragment,e),d=!0)},o(e){we(n.$$.fragment,e),d=!1},d(e){e&&Q(t),Ce(n),m&&m.d(),f=!1,O()}}}function by(e,t,n){let i,r,s,o,a;const{DiagnosticLevel:l}=window.S4TK.validation;let{info:c}=t,{showDiagnosticCode:h}=t;return e.$$set=e=>{"info"in e&&n(0,c=e.info),"showDiagnosticCode"in e&&n(1,h=e.showDiagnosticCode)},e.$$.update=()=>{1&e.$$.dirty&&n(7,i=Rt.getFile(c.ownerId)),128&e.$$.dirty&&n(6,r=i?`${i.resourceKey} = ${i.displayName}`:"Unknown File"),65&e.$$.dirty&&n(4,s=`[${c.code}] ${r}`),1&e.$$.dirty&&n(2,o=l[c.level]),4&e.$$.dirty&&n(3,a=o.toLowerCase())},[c,h,o,a,s,function(){Rt.requestFile(c.ownerId,!0)},r,i]}class wy extends Ye{constructor(e){super(),Xe(this,e,by,gy,a,{info:0,showDiagnosticCode:1})}}const{Boolean:xy}=ye;function vy(e,t,n){const i=e.slice();return i[17]=t[n],i}function yy(t){let n;return{c(){n=P("div"),n.innerHTML='

No issues found

',X(n,"class","px-2 overflow-auto")},m(e,t){$(e,n,t)},p:e,i:e,o:e,d(e){e&&Q(n)}}}function Sy(e){let t,n,i=e[2],r=[];for(let t=0;twe(r[e],1,1,(()=>{r[e]=null}));return{c(){t=P("div");for(let e=0;eTe(d,"isCollapsed",b)));const x=[Sy,yy],y=[];function S(e,t){return e[6]?0:1}return p=S(e),m=y[p]=x[p](e),{c(){t=P("div"),n=P("div"),i=P("div"),_e(r.$$.fragment),s=_(),_e(o.$$.fragment),a=_(),l=P("div"),_e(c.$$.fragment),h=_(),u=P("div"),_e(d.$$.fragment),O=_(),m.c(),X(i,"class","flex gap-2 sm:gap-4"),X(u,"class","block sm:hidden"),X(l,"class","flex gap-2 sm:gap-4"),X(n,"class","p-2 w-full flex gap-2 items-center justify-between flex-wrap"),X(t,"class","w-full h-full flex flex-col bg-gray-50 dark:bg-gray-800")},m(e,f){$(e,t,f),v(t,n),v(n,i),Ze(r,i,null),v(i,s),Ze(o,i,null),v(n,a),v(n,l),Ze(c,l,null),v(l,h),v(l,u),Ze(d,u,null),v(t,O),y[p].m(t,null),g=!0},p(e,[n]){const i={};16&n&&(i.countText=e[4]),2&n&&(i.active=!e[1]),2&n&&(i.onClick=e[10]),r.$set(i);const s={};32&n&&(s.countText=e[5]),2&n&&(s.active=e[1]),2&n&&(s.onClick=e[11]),o.$set(s);const a={};4&n&&(a.diagnostics=e[2]),c.$set(a);const l={};!f&&1&n&&(f=!0,l.isCollapsed=e[0],oe((()=>f=!1))),d.$set(l);let h=p;p=S(e),p===h?y[p].p(e,n):(me(),we(y[h],1,1,(()=>{y[h]=null})),ge(),m=y[p],m?m.p(e,n):(m=y[p]=x[p](e),m.c()),be(m,1),m.m(t,null))},i(e){g||(be(r.$$.fragment,e),be(o.$$.fragment,e),be(c.$$.fragment,e),be(d.$$.fragment,e),be(m),g=!0)},o(e){we(r.$$.fragment,e),we(o.$$.fragment,e),we(c.$$.fragment,e),we(d.$$.fragment,e),we(m),g=!1},d(e){e&&Q(t),Ce(r),Ce(o),Ce(c),Ce(d),y[p].d()}}}function ky(e,t,n){let i,r,s,o,{bottomIsCollapsed:a}=t,l=0,c=[],h="",u=!1,d=[],f=[],O=ft.showDiagnosticCodesOnUi;const p=[ot.onExplorerSectionsChange.subscribe((e=>{c=e,n(7,l=c?.length?vt(...vt(...c.map((e=>e.cells))).map((e=>gt.allDiagnostics(e)))).length:0),m()})),ot.onViewedFileChange.subscribe((e=>{n(8,d=e?.diagnostics.filter((e=>bt.passesSettings(e)))??[])})),ot.onUserClickedFile.subscribe((()=>{n(1,u=!0)})),ot.onSearchTermChange.subscribe((e=>{h=e,m()})),ot.onPackageUnloaded.subscribe((()=>{n(9,f=[])})),Ot.subscribe("showDiagnosticCodesOnUi",(e=>{n(3,O=e)}))];function m(){c?.length?n(9,f=vt(...vt(...c.map((e=>e.cells))).filter((e=>gt.passesSearch(e,h))).map((e=>gt.allDiagnostics(e)))).sort(bt.sorter)):n(8,d=[])}L((()=>{p.forEach((e=>e()))}));return e.$$set=e=>{"bottomIsCollapsed"in e&&n(0,a=e.bottomIsCollapsed)},e.$$.update=()=>{770&e.$$.dirty&&n(2,i=u?d:f),4&e.$$.dirty&&n(6,r=Boolean(i?.length)),256&e.$$.dirty&&n(5,s=(d?.length??0).toString()),640&e.$$.dirty&&n(4,o=f.lengthn(1,u=!1),()=>n(1,u=!0),function(e){a=e,n(0,a)}]}class Py extends Ye{constructor(e){super(),Xe(this,e,ky,Qy,a,{bottomIsCollapsed:0})}}function Ty(t){let n,i;return n=new Sr({props:{slot:"secondary"}}),{c(){_e(n.$$.fragment)},m(e,t){Ze(n,e,t),i=!0},p:e,i(e){i||(be(n.$$.fragment,e),i=!0)},o(e){we(n.$$.fragment,e),i=!1},d(e){Ce(n,e)}}}function _y(t){let n,i;return n=new cy({props:{slot:"top"}}),{c(){_e(n.$$.fragment)},m(e,t){Ze(n,e,t),i=!0},p:e,i(e){i||(be(n.$$.fragment,e),i=!0)},o(e){we(n.$$.fragment,e),i=!1},d(e){Ce(n,e)}}}function Zy(e){let t,n,i;function r(t){e[4](t)}let s={slot:"bottom"};return void 0!==e[0]&&(s.bottomIsCollapsed=e[0]),t=new Py({props:s}),K.push((()=>Te(t,"bottomIsCollapsed",r))),{c(){_e(t.$$.fragment)},m(e,n){Ze(t,e,n),i=!0},p(e,i){const r={};!n&&1&i&&(n=!0,r.bottomIsCollapsed=e[0],oe((()=>n=!1))),t.$set(r)},i(e){i||(be(t.$$.fragment,e),i=!0)},o(e){we(t.$$.fragment,e),i=!1},d(e){Ce(t,e)}}}function Cy(e){let t,n,i;function r(t){e[5](t)}let s={slot:"primary",$$slots:{bottom:[Zy],top:[_y]},$$scope:{ctx:e}};return void 0!==e[0]&&(s.bottomIsCollapsed=e[0]),t=new li({props:s}),K.push((()=>Te(t,"bottomIsCollapsed",r))),{c(){_e(t.$$.fragment)},m(e,n){Ze(t,e,n),i=!0},p(e,i){const r={};129&i&&(r.$$scope={dirty:i,ctx:e}),!n&&1&i&&(n=!0,r.bottomIsCollapsed=e[0],oe((()=>n=!1))),t.$set(r)},i(e){i||(be(t.$$.fragment,e),i=!0)},o(e){we(t.$$.fragment,e),i=!1},d(e){Ce(t,e)}}}function Xy(e){let t,n,i,r,s;return document.title=t=e[1],r=new ti({props:{compactTitle:"File Explorer",onCompactChange:e[2],$$slots:{primary:[Cy],secondary:[Ty]},$$scope:{ctx:e}}}),{c(){n=_(),i=P("section"),_e(r.$$.fragment),X(i,"class","pt-10 h-screen w-screen")},m(e,t){$(e,n,t),$(e,i,t),Ze(r,i,null),s=!0},p(e,[n]){(!s||2&n)&&t!==(t=e[1])&&(document.title=t);const i={};129&n&&(i.$$scope={dirty:n,ctx:e}),r.$set(i)},i(e){s||(be(r.$$.fragment,e),s=!0)},o(e){we(r.$$.fragment,e),s=!1},d(e){e&&Q(n),e&&Q(i),Ce(r)}}}function Yy(e,t,n){let i,r,s=!1;const o=[ot.onPackageNameChange.subscribe((e=>{n(3,r=e)}))];return L((()=>{o.forEach((e=>e()))})),e.$$.update=()=>{8&e.$$.dirty&&n(1,i=r||"S4TK Package Viewer")},[s,i,function(){Rt.requestRefresh()},r,function(e){s=e,n(0,s)},function(e){s=e,n(0,s)}]}class Ry extends Ye{constructor(e){super(),Xe(this,e,Yy,Xy,a,{})}}let qy=0;const Ay=new Map;function Wy(e,t,n){const i=qy++;return Ay.set(i,(i=>{(!n?.ctrlOrMeta||i.ctrlKey||i.metaKey)&&(n?.shift&&!i.shiftKey||i.key===e&&(n?.preventDefault&&i.preventDefault(),t(i)))})),()=>Ay.delete(i)}document.addEventListener("keydown",(function(e){Ay.forEach((t=>{t(e)}))}));const Ey={onPreviewingPackageChange:new st,onPackagePreviewReadyChange:new st,onFileDataChange:new st,onGlobalSettingsChange:new st};function jy(t){let n,i,r,s,o,a;return{c(){n=P("button"),i=P("img"),X(i,"class","svg svelte-1ehlu20"),c(i.src,r="./assets/icons/"+t[0]+".svg")||X(i,"src",r),X(i,"alt",t[0]),E(i,"small",t[3]),X(n,"class","flex items-center svelte-1ehlu20"),X(n,"title",t[2]),X(n,"tabindex",s=t[1]?0:-1),E(n,"active",t[1]),E(n,"small",t[3]),E(n,"no-border",t[4]),E(n,"use-bg",t[5]),E(n,"danger-bg",t[6]),E(n,"round",t[7])},m(e,r){$(e,n,r),v(n,i),t[11](n),o||(a=C(n,"click",t[9]),o=!0)},p(e,[t]){1&t&&!c(i.src,r="./assets/icons/"+e[0]+".svg")&&X(i,"src",r),1&t&&X(i,"alt",e[0]),8&t&&E(i,"small",e[3]),4&t&&X(n,"title",e[2]),2&t&&s!==(s=e[1]?0:-1)&&X(n,"tabindex",s),2&t&&E(n,"active",e[1]),8&t&&E(n,"small",e[3]),16&t&&E(n,"no-border",e[4]),32&t&&E(n,"use-bg",e[5]),64&t&&E(n,"danger-bg",e[6]),128&t&&E(n,"round",e[7])},i:e,o:e,d(e){e&&Q(n),t[11](null),o=!1,a()}}}function zy(e,t,n){let i,{icon:r}=t,{onClick:s}=t,{active:o=!0}=t,{title:a}=t,{small:l=!1}=t,{noBorder:c=l}=t,{useBg:h=!1}=t,{danger:u=!1}=t,{round:d=!0}=t;return e.$$set=e=>{"icon"in e&&n(0,r=e.icon),"onClick"in e&&n(10,s=e.onClick),"active"in e&&n(1,o=e.active),"title"in e&&n(2,a=e.title),"small"in e&&n(3,l=e.small),"noBorder"in e&&n(4,c=e.noBorder),"useBg"in e&&n(5,h=e.useBg),"danger"in e&&n(6,u=e.danger),"round"in e&&n(7,d=e.round)},[r,o,a,l,c,h,u,d,i,function(){o&&(s(),setTimeout((()=>{i.blur()}),100))},s,function(e){K[e?"unshift":"push"]((()=>{i=e,n(8,i)}))}]}class Dy extends Ye{constructor(e){super(),Xe(this,e,zy,jy,a,{icon:0,onClick:10,active:1,title:2,small:3,noBorder:4,useBg:5,danger:6,round:7})}}function Uy(e){let t,n,i;return{c(){t=P("input"),X(t,"type","checkbox"),t.disabled=e[3],X(t,"class","svelte-6qqi0r")},m(r,s){$(r,t,s),t.checked=e[0],n||(i=C(t,"change",e[5]),n=!0)},p(e,n){8&n&&(t.disabled=e[3]),1&n&&(t.checked=e[0])},d(e){e&&Q(t),n=!1,i()}}}function Vy(e){let t,n,i;return{c(){t=P("input"),X(t,"type","checkbox"),t.disabled=e[3],X(t,"class","svelte-6qqi0r")},m(r,s){$(r,t,s),t.checked=e[1].checked,n||(i=C(t,"change",e[4]),n=!0)},p(e,n){8&n&&(t.disabled=e[3]),2&n&&(t.checked=e[1].checked)},d(e){e&&Q(t),n=!1,i()}}}function Iy(t){let n,i,r,s;function o(e,t){return e[1]?Vy:Uy}let a=o(t),l=a(t);return{c(){n=P("div"),i=P("label"),l.c(),r=_(),s=T(t[2]),X(i,"disabled",t[3]),X(i,"class","svelte-6qqi0r"),X(n,"class","checkbox svelte-6qqi0r")},m(e,t){$(e,n,t),v(n,i),l.m(i,null),v(i,r),v(i,s)},p(e,[t]){a===(a=o(e))&&l?l.p(e,t):(l.d(1),l=a(e),l&&(l.c(),l.m(i,r))),4&t&&R(s,e[2]),8&t&&X(i,"disabled",e[3])},i:e,o:e,d(e){e&&Q(n),l.d()}}}function My(e,t,n){let{label:i}=t,{disabled:r=!1}=t,{checked:s}=t,{checkable:o}=t;return e.$$set=e=>{"label"in e&&n(2,i=e.label),"disabled"in e&&n(3,r=e.disabled),"checked"in e&&n(0,s=e.checked),"checkable"in e&&n(1,o=e.checkable)},[s,o,i,r,function(){o.checked=this.checked,n(1,o)},function(){s=this.checked,n(0,s)}]}class Gy extends Ye{constructor(e){super(),Xe(this,e,My,Iy,a,{label:2,disabled:3,checked:0,checkable:1})}}function By(e,t,n){const i=e.slice();return i[8]=t[n],i[10]=n,i}function Ny(e){let t,n;return{c(){t=P("label"),n=T(e[1]),X(t,"class","text-subtle uppercase font-bold text-sm mb-2 svelte-17jj2pq"),X(t,"for",e[2]),E(t,"small",e[4])},m(e,i){$(e,t,i),v(t,n)},p(e,i){2&i&&R(n,e[1]),4&i&&X(t,"for",e[2]),16&i&&E(t,"small",e[4])},d(e){e&&Q(t)}}}function Ly(e,t){let n,i,r,s,o=t[8].text+"";return{key:e,first:null,c(){n=P("option"),i=T(o),r=_(),n.__value=s=t[8].value,n.value=n.__value,X(n,"class","svelte-17jj2pq"),this.first=n},m(e,t){$(e,n,t),v(n,i),v(n,r)},p(e,r){t=e,64&r&&o!==(o=t[8].text+"")&&R(i,o),64&r&&s!==(s=t[8].value)&&(n.__value=s,n.value=n.__value)},d(e){e&&Q(n)}}}function Fy(t){let n,i,r,s,o,a=Boolean(t[1]),l=[],c=new Map,h=a&&Ny(t),u=t[6];const d=e=>e[10];for(let e=0;et[7].call(r))),E(r,"w-full",t[3]),E(r,"small",t[4]),X(n,"class","select-with-label svelte-17jj2pq"),E(n,"w-full",t[3])},m(e,a){$(e,n,a),h&&h.m(n,null),v(n,i),v(n,r);for(let e=0;e{"label"in e&&n(1,i=e.label),"name"in e&&n(2,r=e.name),"selected"in e&&n(0,s=e.selected),"fillWidth"in e&&n(3,o=e.fillWidth),"small"in e&&n(4,a=e.small),"disabled"in e&&n(5,l=e.disabled),"options"in e&&n(6,c=e.options)},[s,i,r,o,a,l,c,function(){s=function(e){const t=e.querySelector(":checked")||e.options[0];return t&&t.__value}(this),n(0,s),n(6,c)}]}class Ky extends Ye{constructor(e){super(),Xe(this,e,Hy,Fy,a,{label:1,name:2,selected:0,fillWidth:3,small:4,disabled:5,options:6})}}function Jy(e){let t,n,i;return{c(){t=P("div"),n=P("label"),i=T(e[1]),X(n,"class","text-subtle uppercase font-bold text-sm mb-2 block"),X(n,"for",e[2]),X(t,"class","flex items-center")},m(e,r){$(e,t,r),v(t,n),v(n,i)},p(e,t){2&t&&R(i,e[1]),4&t&&X(n,"for",e[2])},d(e){e&&Q(t)}}}function eS(t){let n,i,r,s,o,a=Boolean(t[1]),l=a&&Jy(t);return{c(){n=P("div"),l&&l.c(),i=_(),r=P("input"),X(r,"id",t[2]),X(r,"name",t[2]),X(r,"type","text"),X(r,"class","h-8 px-2 block bg-gray-100 dark:bg-gray-800 rounded border border-solid border-gray-600 dark:border-gray-400 placeholder:text-gray-400 dark:placeholder:text-gray-500 svelte-1fm0ybo"),X(r,"placeholder",t[3]),X(r,"autocomplete","off"),E(r,"monospace",t[4]),E(r,"w-full",t[5]),E(r,"invalid",!t[6]),E(n,"flex-grow",t[5])},m(e,a){$(e,n,a),l&&l.m(n,null),v(n,i),v(n,r),t[9](r),q(r,t[0]),s||(o=C(r,"input",t[10]),s=!0)},p(e,[t]){2&t&&(a=Boolean(e[1])),a?l?l.p(e,t):(l=Jy(e),l.c(),l.m(n,i)):l&&(l.d(1),l=null),4&t&&X(r,"id",e[2]),4&t&&X(r,"name",e[2]),8&t&&X(r,"placeholder",e[3]),1&t&&r.value!==e[0]&&q(r,e[0]),16&t&&E(r,"monospace",e[4]),32&t&&E(r,"w-full",e[5]),64&t&&E(r,"invalid",!e[6]),32&t&&E(n,"flex-grow",e[5])},i:e,o:e,d(e){e&&Q(n),l&&l.d(),t[9](null),s=!1,o()}}}function tS(e,t,n){let i,{label:r}=t,{name:s}=t,{placeholder:o}=t,{monospace:a=!1}=t,{value:l=""}=t,{fillWidth:c=!1}=t,{focusOnMount:h=!1}=t,{isValid:u=!0}=t;return N((()=>{h&&i.focus()})),e.$$set=e=>{"label"in e&&n(1,r=e.label),"name"in e&&n(2,s=e.name),"placeholder"in e&&n(3,o=e.placeholder),"monospace"in e&&n(4,a=e.monospace),"value"in e&&n(0,l=e.value),"fillWidth"in e&&n(5,c=e.fillWidth),"focusOnMount"in e&&n(8,h=e.focusOnMount),"isValid"in e&&n(6,u=e.isValid)},[l,r,s,o,a,c,u,i,h,function(e){K[e?"unshift":"push"]((()=>{i=e,n(7,i)}))},function(){l=this.value,n(0,l)}]}class nS extends Ye{constructor(e){super(),Xe(this,e,tS,eS,a,{label:1,name:2,placeholder:3,monospace:4,value:0,fillWidth:5,focusOnMount:8,isValid:6})}}function iS(e){let t;return{c(){t=P("span"),t.textContent="• Key is invalid",X(t,"class","text-red-600 dark:text-red-400")},m(e,n){$(e,t,n)},d(e){e&&Q(t)}}}function rS(e){let t,n,i,r,s,o,a,l,c,h,u,d,f,O,p,m,g,b=!e[7]&&iS();function w(t){e[8](t)}function x(t){e[9](t)}let y={name:"manual-type-input-"+e[0].id,placeholder:"Type",monospace:!0};function S(t){e[10](t)}function k(t){e[11](t)}void 0!==e[1]&&(y.value=e[1]),void 0!==e[6]&&(y.isValid=e[6]),o=new nS({props:y}),K.push((()=>Te(o,"value",w))),K.push((()=>Te(o,"isValid",x)));let Z={name:"manual-group-input-"+e[0].id,placeholder:"Group",monospace:!0};function C(t){e[12](t)}function Y(t){e[13](t)}void 0!==e[2]&&(Z.value=e[2]),void 0!==e[5]&&(Z.isValid=e[5]),h=new nS({props:Z}),K.push((()=>Te(h,"value",S))),K.push((()=>Te(h,"isValid",k)));let R={name:"manual-inst-input-"+e[0].id,placeholder:"Instance",monospace:!0};return void 0!==e[3]&&(R.value=e[3]),void 0!==e[4]&&(R.isValid=e[4]),O=new nS({props:R}),K.push((()=>Te(O,"value",C))),K.push((()=>Te(O,"isValid",Y))),{c(){t=P("div"),n=P("p"),i=T("+ Manual Key\n "),b&&b.c(),r=_(),s=P("div"),_e(o.$$.fragment),c=_(),_e(h.$$.fragment),f=_(),_e(O.$$.fragment),X(n,"class","whitespace-nowrap text-sm font-bold text-subtle uppercase"),X(s,"class","flex flex-wrap justify-center items-end gap-4"),X(t,"class","flex justify-between items-center")},m(e,a){$(e,t,a),v(t,n),v(n,i),b&&b.m(n,null),v(t,r),v(t,s),Ze(o,s,null),v(s,c),Ze(h,s,null),v(s,f),Ze(O,s,null),g=!0},p(e,[t]){e[7]?b&&(b.d(1),b=null):b||(b=iS(),b.c(),b.m(n,null));const i={};1&t&&(i.name="manual-type-input-"+e[0].id),!a&&2&t&&(a=!0,i.value=e[1],oe((()=>a=!1))),!l&&64&t&&(l=!0,i.isValid=e[6],oe((()=>l=!1))),o.$set(i);const r={};1&t&&(r.name="manual-group-input-"+e[0].id),!u&&4&t&&(u=!0,r.value=e[2],oe((()=>u=!1))),!d&&32&t&&(d=!0,r.isValid=e[5],oe((()=>d=!1))),h.$set(r);const s={};1&t&&(s.name="manual-inst-input-"+e[0].id),!p&&8&t&&(p=!0,s.value=e[3],oe((()=>p=!1))),!m&&16&t&&(m=!0,s.isValid=e[4],oe((()=>m=!1))),O.$set(s)},i(e){g||(be(o.$$.fragment,e),be(h.$$.fragment,e),be(O.$$.fragment,e),g=!0)},o(e){we(o.$$.fragment,e),we(h.$$.fragment,e),we(O.$$.fragment,e),g=!1},d(e){e&&Q(t),b&&b.d(),Ce(o),Ce(h),Ce(O)}}}function sS(e,t){return new RegExp(`^[0-9A-Fa-f]{${t}}$`).test(e)}function oS(e,t,n){let i,r,s,o;const{formatAsHexString:a}=window.S4TK.formatting;let{entry:l}=t,c=a(l.manualKey.type,8,!1),h=a(l.manualKey.group,8,!1),u=a(l.manualKey.instance,16,!1);return e.$$set=e=>{"entry"in e&&n(0,l=e.entry)},e.$$.update=()=>{2&e.$$.dirty&&n(6,i=sS(c,8)),4&e.$$.dirty&&n(5,r=sS(h,8)),8&e.$$.dirty&&n(4,s=sS(u,16)),112&e.$$.dirty&&n(7,o=i&&r&&s)},[l,c,h,u,s,r,i,o,function(e){c=e,n(1,c)},function(e){i=e,n(6,i),n(1,c)},function(e){h=e,n(2,h)},function(e){r=e,n(5,r),n(2,h)},function(e){u=e,n(3,u)},function(e){s=e,n(4,s),n(3,u)}]}class aS extends Ye{constructor(e){super(),Xe(this,e,oS,rS,a,{entry:0})}}function lS(e){let t,n,i,r,s,o,a;return{c(){t=P("p"),n=T("+ "),i=T(e[2]),r=T(" SimData ("),s=P("span"),o=T(e[1]),a=T(")"),X(s,"class","monospace"),X(t,"class","text-subtle uppercase font-bold text-sm")},m(e,l){$(e,t,l),v(t,n),v(t,i),v(t,r),v(t,s),v(s,o),v(t,a)},p(e,t){4&t&&R(i,e[2]),2&t&&R(o,e[1])},d(e){e&&Q(t)}}}function cS(e){let t,n,i,r;return{c(){t=P("p"),n=T('Tuning type "'),i=T(e[2]),r=T('" does not have simdata'),X(t,"class","text-red-600 dark:text-red-400 text-subtle uppercase font-bold text-sm")},m(e,s){$(e,t,s),v(t,n),v(t,i),v(t,r)},p(e,t){4&t&&R(i,e[2])},d(e){e&&Q(t)}}}function hS(t){let n;function i(e,t){return e[0]?cS:lS}let r=i(t),s=r(t);return{c(){n=P("div"),s.c(),X(n,"class","flex items-center justify-between")},m(e,t){$(e,n,t),s.m(n,null)},p(e,[t]){r===(r=i(e))&&s?s.p(e,t):(s.d(1),s=r(e),s&&(s.c(),s.m(n,null)))},i:e,o:e,d(e){e&&Q(n),s.d()}}}function uS(e,t,n){let i,r,s;const{TuningResourceType:o,SimDataGroup:a}=window.S4TK.enums,{formatAsHexString:l}=window.S4TK.formatting;let{entry:c}=t;return e.$$set=e=>{"entry"in e&&n(3,c=e.entry)},e.$$.update=()=>{8&e.$$.dirty&&n(2,i=o[c.type]),8&e.$$.dirty&&n(1,r=l(a.getForTuning(c.type)??0,8,!1)),8&e.$$.dirty&&n(0,s=null==a.getForTuning(c.type))},[s,r,i,c]}class dS extends Ye{constructor(e){super(),Xe(this,e,uS,hS,a,{entry:3})}}function fS(e){let t,n,i,r,s,o;function a(t){e[3](t)}let l={options:e[1],small:!0,name:"custom-template-select-"+e[0].id};return void 0!==e[0].templateId&&(l.selected=e[0].templateId),r=new Ky({props:l}),K.push((()=>Te(r,"selected",a))),{c(){t=P("div"),n=P("p"),n.textContent="+ Custom Template",i=_(),_e(r.$$.fragment),X(n,"class","text-sm uppercase font-bold text-subtle whitespace-nowrap"),X(t,"class","flex items-center justify-between")},m(e,s){$(e,t,s),v(t,n),v(t,i),Ze(r,t,null),o=!0},p(e,[t]){const n={};2&t&&(n.options=e[1]),1&t&&(n.name="custom-template-select-"+e[0].id),!s&&1&t&&(s=!0,n.selected=e[0].templateId,oe((()=>s=!1))),r.$set(n)},i(e){o||(be(r.$$.fragment,e),o=!0)},o(e){we(r.$$.fragment,e),o=!1},d(e){e&&Q(t),Ce(r)}}}function OS(e,t,n){let i,{globalSettings:r}=t,{entry:s}=t;return e.$$set=e=>{"globalSettings"in e&&n(2,r=e.globalSettings),"entry"in e&&n(0,s=e.entry)},e.$$.update=()=>{4&e.$$.dirty&&n(1,i=r.templateData.templates.map((e=>({value:e.id,text:e.name}))))},[s,i,r,function(t){e.$$.not_equal(s.templateId,t)&&(s.templateId=t,n(0,s))}]}class pS extends Ye{constructor(e){super(),Xe(this,e,OS,fS,a,{globalSettings:2,entry:0})}}function mS(e){let t,n,i,r;function s(t){e[15](t)}let o={};return void 0!==e[1]&&(o.entry=e[1]),n=new aS({props:o}),K.push((()=>Te(n,"entry",s))),{c(){t=P("div"),_e(n.$$.fragment),X(t,"class","linked-entry bg-gray-200 dark:bg-gray-900 svelte-1ytoyos")},m(e,i){$(e,t,i),Ze(n,t,null),r=!0},p(e,t){const r={};!i&&2&t&&(i=!0,r.entry=e[1],oe((()=>i=!1))),n.$set(r)},i(e){r||(be(n.$$.fragment,e),r=!0)},o(e){we(n.$$.fragment,e),r=!1},d(e){e&&Q(t),Ce(n)}}}function gS(e){let t,n,i,r,s;function o(t){e[16](t)}function a(t){e[17](t)}let l={};return void 0!==e[0]&&(l.globalSettings=e[0]),void 0!==e[1]&&(l.entry=e[1]),n=new pS({props:l}),K.push((()=>Te(n,"globalSettings",o))),K.push((()=>Te(n,"entry",a))),{c(){t=P("div"),_e(n.$$.fragment),X(t,"class","linked-entry bg-gray-200 dark:bg-gray-900 svelte-1ytoyos")},m(e,i){$(e,t,i),Ze(n,t,null),s=!0},p(e,t){const s={};!i&&1&t&&(i=!0,s.globalSettings=e[0],oe((()=>i=!1))),!r&&2&t&&(r=!0,s.entry=e[1],oe((()=>r=!1))),n.$set(s)},i(e){s||(be(n.$$.fragment,e),s=!0)},o(e){we(n.$$.fragment,e),s=!1},d(e){e&&Q(t),Ce(n)}}}function bS(e){let t,n,i,r;function s(t){e[18](t)}let o={};return void 0!==e[1]&&(o.entry=e[1]),n=new dS({props:o}),K.push((()=>Te(n,"entry",s))),{c(){t=P("div"),_e(n.$$.fragment),X(t,"class","linked-entry bg-gray-200 dark:bg-gray-900 svelte-1ytoyos")},m(e,i){$(e,t,i),Ze(n,t,null),r=!0},p(e,t){const r={};!i&&2&t&&(i=!0,r.entry=e[1],oe((()=>i=!1))),n.$set(r)},i(e){r||(be(n.$$.fragment,e),r=!0)},o(e){we(n.$$.fragment,e),r=!1},d(e){e&&Q(t),Ce(n)}}}function wS(e){let t,n,i,r,s,o,a,l,c,h,u,d,f,O,p,m,g,b,w,x,y,S,k,T,Z,C,Y,R,q,A,W,j,z,D;function U(t){e[8](t)}let V={name:`gen-file-name-${e[1].id}`,placeholder:"File name (excluding prefix)",focusOnMount:!0,fillWidth:!0};function I(t){e[9](t)}void 0!==e[1].filename&&(V.value=e[1].filename),i=new nS({props:V}),K.push((()=>Te(i,"value",U)));let M={name:`gen-file-type-${e[1].id}`,options:e[4],disabled:e[2]};function G(t){e[10](t)}void 0!==e[1].type&&(M.selected=e[1].type),o=new Ky({props:M}),K.push((()=>Te(o,"selected",I)));let B={label:"32-bit",disabled:e[2]};function N(t){e[11](t)}void 0!==e[1].use32bit&&(B.checked=e[1].use32bit),h=new Gy({props:B}),K.push((()=>Te(h,"checked",G)));let L={label:"High bit",disabled:e[2]};function F(t){e[12](t)}void 0!==e[1].useHighBit&&(L.checked=e[1].useHighBit),f=new Gy({props:L}),K.push((()=>Te(f,"checked",N)));let H={label:"Manual key"};function J(t){e[13](t)}void 0!==e[2]&&(H.checked=e[2]),g=new Gy({props:H}),K.push((()=>Te(g,"checked",F)));let ee={label:"SimData"};function te(t){e[14](t)}void 0!==e[1].hasSimData&&(ee.checked=e[1].hasSimData),x=new Gy({props:ee}),K.push((()=>Te(x,"checked",J)));let ne={label:"Template"};void 0!==e[3]&&(ne.checked=e[3]),T=new Gy({props:ne}),K.push((()=>Te(T,"checked",te))),R=new Dy({props:{title:"Duplicate",icon:"duplicate",noBorder:!0,onClick:e[6],round:!1}}),A=new Dy({props:{title:"Delete",icon:"trash",noBorder:!0,onClick:e[5],danger:!0,round:!1}});let ie=e[1].manualKey&&mS(e),re=e[3]&&gS(e),se=e[1].hasSimData&&bS(e);return{c(){t=P("div"),n=P("div"),_e(i.$$.fragment),s=_(),_e(o.$$.fragment),l=_(),c=P("div"),_e(h.$$.fragment),d=_(),_e(f.$$.fragment),p=_(),m=P("div"),_e(g.$$.fragment),w=_(),_e(x.$$.fragment),S=_(),k=P("div"),_e(T.$$.fragment),C=_(),Y=P("div"),_e(R.$$.fragment),q=_(),_e(A.$$.fragment),W=_(),ie&&ie.c(),j=_(),re&&re.c(),z=_(),se&&se.c(),X(c,"class","flex flex-col gap-1"),X(m,"class","flex flex-col gap-1"),X(k,"class","flex flex-col gap-1"),X(Y,"class","flex gap-1"),X(n,"class","primary-entry bg-gray-200 dark:bg-gray-900 p-2 flex gap-4 items-center flex-wrap w-full svelte-1ytoyos"),E(n,"has-simdata",e[1].hasSimData),X(t,"class","w-full")},m(e,r){$(e,t,r),v(t,n),Ze(i,n,null),v(n,s),Ze(o,n,null),v(n,l),v(n,c),Ze(h,c,null),v(c,d),Ze(f,c,null),v(n,p),v(n,m),Ze(g,m,null),v(m,w),Ze(x,m,null),v(n,S),v(n,k),Ze(T,k,null),v(n,C),v(n,Y),Ze(R,Y,null),v(Y,q),Ze(A,Y,null),v(t,W),ie&&ie.m(t,null),v(t,j),re&&re.m(t,null),v(t,z),se&&se.m(t,null),D=!0},p(e,[s]){const l={};2&s&&(l.name=`gen-file-name-${e[1].id}`),!r&&2&s&&(r=!0,l.value=e[1].filename,oe((()=>r=!1))),i.$set(l);const c={};2&s&&(c.name=`gen-file-type-${e[1].id}`),4&s&&(c.disabled=e[2]),!a&&2&s&&(a=!0,c.selected=e[1].type,oe((()=>a=!1))),o.$set(c);const d={};4&s&&(d.disabled=e[2]),!u&&2&s&&(u=!0,d.checked=e[1].use32bit,oe((()=>u=!1))),h.$set(d);const p={};4&s&&(p.disabled=e[2]),!O&&2&s&&(O=!0,p.checked=e[1].useHighBit,oe((()=>O=!1))),f.$set(p);const m={};!b&&4&s&&(b=!0,m.checked=e[2],oe((()=>b=!1))),g.$set(m);const w={};!y&&2&s&&(y=!0,w.checked=e[1].hasSimData,oe((()=>y=!1))),x.$set(w);const v={};!Z&&8&s&&(Z=!0,v.checked=e[3],oe((()=>Z=!1))),T.$set(v),(!D||2&s)&&E(n,"has-simdata",e[1].hasSimData),e[1].manualKey?ie?(ie.p(e,s),2&s&&be(ie,1)):(ie=mS(e),ie.c(),be(ie,1),ie.m(t,j)):ie&&(me(),we(ie,1,1,(()=>{ie=null})),ge()),e[3]?re?(re.p(e,s),8&s&&be(re,1)):(re=gS(e),re.c(),be(re,1),re.m(t,z)):re&&(me(),we(re,1,1,(()=>{re=null})),ge()),e[1].hasSimData?se?(se.p(e,s),2&s&&be(se,1)):(se=bS(e),se.c(),be(se,1),se.m(t,null)):se&&(me(),we(se,1,1,(()=>{se=null})),ge())},i(e){D||(be(i.$$.fragment,e),be(o.$$.fragment,e),be(h.$$.fragment,e),be(f.$$.fragment,e),be(g.$$.fragment,e),be(x.$$.fragment,e),be(T.$$.fragment,e),be(R.$$.fragment,e),be(A.$$.fragment,e),be(ie),be(re),be(se),D=!0)},o(e){we(i.$$.fragment,e),we(o.$$.fragment,e),we(h.$$.fragment,e),we(f.$$.fragment,e),we(g.$$.fragment,e),we(x.$$.fragment,e),we(T.$$.fragment,e),we(R.$$.fragment,e),we(A.$$.fragment,e),we(ie),we(re),we(se),D=!1},d(e){e&&Q(t),Ce(i),Ce(o),Ce(h),Ce(f),Ce(g),Ce(x),Ce(T),Ce(R),Ce(A),ie&&ie.d(),re&&re.d(),se&&se.d()}}}function xS(e,t,n){const{fnv32:i,fnv64:r}=window.S4TK.hashing,{TuningResourceType:s}=window.S4TK.enums;let{globalSettings:o}=t,{fileData:a}=t,{entry:l}=t,c=null!=l.manualKey,h=0!==l.templateId;const u=[...s.all().map((e=>({value:e,text:s[e]})))];return e.$$set=e=>{"globalSettings"in e&&n(0,o=e.globalSettings),"fileData"in e&&n(7,a=e.fileData),"entry"in e&&n(1,l=e.entry)},e.$$.update=()=>{7&e.$$.dirty&&(c?n(1,l.manualKey={type:l.type,group:0,instance:BigInt((l.use32bit?i:r)(o.filenamePrefix+l.filename,l.useHighBit))},l):delete l.manualKey),8&e.$$.dirty&&(h||n(1,l.templateId=0,l))},[o,l,c,h,u,function(){const e=a.entries.findIndex((e=>e===l));e>=0&&(a.entries.splice(e,1),n(7,a))},function(){const e={};for(const t in l)e[t]=l[t];e.id=n(7,a.nextId++,a),e.filename="",delete e.manualKey,a.entries.push(e),n(7,a)},a,function(t){e.$$.not_equal(l.filename,t)&&(l.filename=t,n(1,l),n(2,c),n(0,o),n(3,h))},function(t){e.$$.not_equal(l.type,t)&&(l.type=t,n(1,l),n(2,c),n(0,o),n(3,h))},function(t){e.$$.not_equal(l.use32bit,t)&&(l.use32bit=t,n(1,l),n(2,c),n(0,o),n(3,h))},function(t){e.$$.not_equal(l.useHighBit,t)&&(l.useHighBit=t,n(1,l),n(2,c),n(0,o),n(3,h))},function(e){c=e,n(2,c)},function(t){e.$$.not_equal(l.hasSimData,t)&&(l.hasSimData=t,n(1,l),n(2,c),n(0,o),n(3,h))},function(e){h=e,n(3,h)},function(e){l=e,n(1,l),n(2,c),n(0,o),n(3,h)},function(e){o=e,n(0,o)},function(e){l=e,n(1,l),n(2,c),n(0,o),n(3,h)},function(e){l=e,n(1,l),n(2,c),n(0,o),n(3,h)}]}class vS extends Ye{constructor(e){super(),Xe(this,e,xS,wS,a,{globalSettings:0,fileData:7,entry:1})}}function yS(t){let n,i,r,s,a=(t[4]?t[1]:t[0])+"";return{c(){n=P("button"),i=T(a),X(n,"class","px-2 py-1 rounded flex items-center text-black dark:text-white hover:text-white dark:hover:text-black bg-gray-200 dark:bg-gray-800 hover:bg-accent-secondary-light dark:hover:bg-accent-secondary-dark border border-solid border-gray-600 dark:border-gray-400 svelte-1xpaq9i"),n.disabled=t[4],E(n,"w-full",t[3])},m(e,a){$(e,n,a),v(n,i),r||(s=C(n,"click",(function(){o(t[2])&&t[2].apply(this,arguments)})),r=!0)},p(e,[r]){t=e,19&r&&a!==(a=(t[4]?t[1]:t[0])+"")&&R(i,a),16&r&&(n.disabled=t[4]),8&r&&E(n,"w-full",t[3])},i:e,o:e,d(e){e&&Q(n),r=!1,s()}}}function SS(e,t,n){let{text:i}=t,{disabledText:r=i}=t,{onClick:s}=t,{fillWidth:o=!1}=t,{disabled:a=!1}=t;return e.$$set=e=>{"text"in e&&n(0,i=e.text),"disabledText"in e&&n(1,r=e.disabledText),"onClick"in e&&n(2,s=e.onClick),"fillWidth"in e&&n(3,o=e.fillWidth),"disabled"in e&&n(4,a=e.disabled)},[i,r,s,o,a]}class $S extends Ye{constructor(e){super(),Xe(this,e,SS,yS,a,{text:0,disabledText:1,onClick:2,fillWidth:3,disabled:4})}}function QS(e){let t,n,i,r,s;return{c(){t=P("button"),t.innerHTML='X',X(t,"class","svelte-1on8w4u")},m(n,a){$(n,t,a),i=!0,r||(s=C(t,"click",(function(){o(e[0])&&e[0].apply(this,arguments)})),r=!0)},p(t,[n]){e=t},i(e){i||(se((()=>{n||(n=ve(t,ar,{},!0)),n.run(1)})),i=!0)},o(e){n||(n=ve(t,ar,{},!1)),n.run(0),i=!1},d(e){e&&Q(t),e&&n&&n.end(),r=!1,s()}}}function kS(e,t,n){let{onClick:i}=t;return e.$$set=e=>{"onClick"in e&&n(0,i=e.onClick)},[i]}class PS extends Ye{constructor(e){super(),Xe(this,e,kS,QS,a,{onClick:0})}}function TS(e){let t,n;return t=new PS({props:{onClick:e[2]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};4&n&&(i.onClick=e[2]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function _S(e){let t,n,i,r,s,o;const a=e[5].default,l=h(a,e,e[4],null);let c=null!=e[2]&&TS(e);return{c(){t=P("div"),n=P("div"),i=P("div"),l&&l.c(),r=_(),c&&c.c(),X(n,"class","popup svelte-1piiy29"),E(n,"large",e[0]),E(n,"fill",e[1]),X(t,"class","overlay blurred-bg svelte-1piiy29")},m(s,a){$(s,t,a),v(t,n),v(n,i),l&&l.m(i,null),v(t,r),c&&c.m(t,null),e[6](t),o=!0},p(e,[i]){l&&l.p&&(!o||16&i)&&f(l,a,e,e[4],o?d(a,e[4],i,null):O(e[4]),null),(!o||1&i)&&E(n,"large",e[0]),(!o||2&i)&&E(n,"fill",e[1]),null!=e[2]?c?(c.p(e,i),4&i&&be(c,1)):(c=TS(e),c.c(),be(c,1),c.m(t,null)):c&&(me(),we(c,1,1,(()=>{c=null})),ge())},i(e){o||(be(l,e),be(c),se((()=>{s||(s=ve(t,ar,{},!0)),s.run(1)})),o=!0)},o(e){we(l,e),we(c),s||(s=ve(t,ar,{},!1)),s.run(0),o=!1},d(n){n&&Q(t),l&&l.d(n),c&&c.d(),e[6](null),n&&s&&s.end()}}}const ZS="overlay-active";function CS(e,t,n){let i,r,s,{$$slots:o={},$$scope:a}=t,{large:l=!1}=t,{fill:c=!0}=t,{onClose:h=(()=>{})}=t;const u=[Wy("Escape",h)];function d(){const e=i.querySelectorAll("a, button, input, textarea, select");r=e[0],s=e[e.length-1]}function f(){document.contains(r)||d(),r?.focus()}function O(e){i.contains(e.relatedTarget)||(s===e.target?f():r===e.target&&(document.contains(s)||d(),s?.focus()))}function p(e){i.contains(e.target)||f()}return N((()=>{document.body.classList.add(ZS),d(),window.addEventListener("focusin",p),window.addEventListener("focusout",O)})),L((()=>{document.body.classList.remove(ZS),window.removeEventListener("focusin",p),window.removeEventListener("focusout",O),u.forEach((e=>e()))})),e.$$set=e=>{"large"in e&&n(0,l=e.large),"fill"in e&&n(1,c=e.fill),"onClose"in e&&n(2,h=e.onClose),"$$scope"in e&&n(4,a=e.$$scope)},[l,c,h,i,a,o,function(e){K[e?"unshift":"push"]((()=>{i=e,n(3,i)}))}]}class XS extends Ye{constructor(e){super(),Xe(this,e,CS,_S,a,{large:0,fill:1,onClose:2})}}function YS(e){let t,n,i,r,o,a,l,c,h,u,d,f,O,p,m,g,b,w,x,y,S,k,T,Z;function Y(t){e[11](t)}let R={label:"template",name:"template-name-select",options:e[4]};function A(t){e[12](t)}void 0!==e[0]&&(R.selected=e[0]),r=new Ky({props:R}),K.push((()=>Te(r,"selected",Y)));let W={label:"content",name:"template-content-select",options:e[5]};function E(e,t){return e[2].locked?qS:RS}void 0!==e[1]&&(W.selected=e[1]),l=new Ky({props:W}),K.push((()=>Te(l,"selected",A))),d=new Dy({props:{icon:"trash",active:!e[2].locked,onClick:e[7],title:"Delete Template",danger:!0}}),O=new Dy({props:{icon:"pencil",active:!e[2].locked,onClick:e[8],title:"Edit Name"}}),m=new Dy({props:{icon:"plus",onClick:e[9],title:"New Template"}});let j=E(e),z=j(e);return{c(){t=P("div"),n=P("div"),i=P("div"),_e(r.$$.fragment),a=_(),_e(l.$$.fragment),h=_(),u=P("div"),_e(d.$$.fragment),f=_(),_e(O.$$.fragment),p=_(),_e(m.$$.fragment),g=_(),b=P("textarea"),y=_(),S=P("p"),z.c(),X(i,"class","flex gap-2"),X(u,"class","flex gap-2"),X(n,"class","flex justify-between items-center"),X(b,"class","monospace shadow-md bg-white dark:bg-gray-900 placeholder:text-gray-400 dark:placeholder:text-gray-500 svelte-1sw55l8"),b.disabled=w=e[2].locked,X(b,"placeholder",x=0===e[1]?"Enter tuning XML":"Enter SimData XML"),X(S,"class","text-subtle text-sm"),X(t,"class","flex flex-col gap-2")},m(s,o){$(s,t,o),v(t,n),v(n,i),Ze(r,i,null),v(i,a),Ze(l,i,null),v(n,h),v(n,u),Ze(d,u,null),v(u,f),Ze(O,u,null),v(u,p),Ze(m,u,null),v(t,g),v(t,b),q(b,e[3]),v(t,y),v(t,S),z.m(S,null),k=!0,T||(Z=[C(b,"input",e[13]),C(b,"blur",e[6])],T=!0)},p(e,t){const n={};16&t&&(n.options=e[4]),!o&&1&t&&(o=!0,n.selected=e[0],oe((()=>o=!1))),r.$set(n);const i={};!c&&2&t&&(c=!0,i.selected=e[1],oe((()=>c=!1))),l.$set(i);const s={};4&t&&(s.active=!e[2].locked),d.$set(s);const a={};4&t&&(a.active=!e[2].locked),O.$set(a),(!k||4&t&&w!==(w=e[2].locked))&&(b.disabled=w),(!k||2&t&&x!==(x=0===e[1]?"Enter tuning XML":"Enter SimData XML"))&&X(b,"placeholder",x),8&t&&q(b,e[3]),j===(j=E(e))&&z?z.p(e,t):(z.d(1),z=j(e),z&&(z.c(),z.m(S,null)))},i(e){k||(be(r.$$.fragment,e),be(l.$$.fragment,e),be(d.$$.fragment,e),be(O.$$.fragment,e),be(m.$$.fragment,e),k=!0)},o(e){we(r.$$.fragment,e),we(l.$$.fragment,e),we(d.$$.fragment,e),we(O.$$.fragment,e),we(m.$$.fragment,e),k=!1},d(e){e&&Q(t),Ce(r),Ce(l),Ce(d),Ce(O),Ce(m),z.d(),T=!1,s(Z)}}}function RS(e){let t,n;function i(e,t){return 0===e[1]?WS:AS}let r=i(e),s=r(e);return{c(){t=T("Paste in the XML content to use.\n "),s.c(),n=Z()},m(e,i){$(e,t,i),s.m(e,i),$(e,n,i)},p(e,t){r!==(r=i(e))&&(s.d(1),s=r(e),s&&(s.c(),s.m(n.parentNode,n)))},d(e){e&&Q(t),s.d(e),e&&Q(n)}}}function qS(t){let n;return{c(){n=T("This template is not editable.")},m(e,t){$(e,n,t)},p:e,d(e){e&&Q(n)}}}function AS(e){let t;return{c(){t=T("SimData structure must be valid, or the site might go boom boom.")},m(e,n){$(e,t,n)},d(e){e&&Q(t)}}}function WS(e){let t;return{c(){t=T("Tuning must have a root node, or the site might go boom boom.")},m(e,n){$(e,t,n)},d(e){e&&Q(t)}}}function ES(e){let t,n,i=null!=e[2]&&YS(e);return{c(){i&&i.c(),t=Z()},m(e,r){i&&i.m(e,r),$(e,t,r),n=!0},p(e,[n]){null!=e[2]?i?(i.p(e,n),4&n&&be(i,1)):(i=YS(e),i.c(),be(i,1),i.m(t.parentNode,t)):i&&(me(),we(i,1,1,(()=>{i=null})),ge())},i(e){n||(be(i),n=!0)},o(e){we(i),n=!1},d(e){i&&i.d(e),e&&Q(t)}}}function jS(e,t){try{return e()}catch(e){return t}}function zS(e,t,n){let i,r;const{XmlDocumentNode:s}=window.S4TK.xml;let{globalSettings:o}=t,a="",l=0,c=0;function h(e){return null!=e&&(e?o.templateData.templates.some((t=>t.name===e))?(alert(`Name "${e}" is already in use.`),!1):!(e.length>50)||(alert(`Name "${e}" is too long (must be <= 50 characters).`),!1):(alert("Name cannot be empty."),!1))}return e.$$set=e=>{"globalSettings"in e&&n(10,o=e.globalSettings)},e.$$.update=()=>{1024&e.$$.dirty&&n(4,i=o.templateData.templates.map((e=>({value:e.id,text:e.name})))),1025&e.$$.dirty&&n(2,r=o.templateData.templates.find((e=>e.id===l))),6&e.$$.dirty&&r&&function(){const e=0===c?r.tuning:r.simdata,t=jS((()=>s.from(e,{recycleNodes:!0}).toXml({writeXmlDeclaration:!1})),e);n(3,a=t)}()},[l,c,r,a,i,[{value:0,text:"Tuning"},{value:1,text:"SimData"}],function(){const e=jS((()=>s.from(a,{recycleNodes:!0}).toXml({minify:!0,writeXmlDeclaration:!1})),a);n(2,0===c?r.tuning=e:r.simdata=e,r)},function(){if(confirm(`Do you really want to delete the template "${r.name}"? This cannot be undone.`)){const e=o.templateData.templates.findIndex((e=>e.id===l));o.templateData.templates.splice(e,1),n(0,l=0),n(10,o)}},function(){const e=prompt(`Enter a new name for the "${r.name}" template. Names must be unique.`)?.trim();h(e)&&n(2,r.name=e,r),n(10,o)},function(){const e=prompt("Enter a name for your new template. Names must be unique.")?.trim();if(h(e)){const t=n(10,o.templateData.nextId++,o);o.templateData.templates.push({id:t,name:e,tuning:"",simdata:"",locked:!1}),n(10,o),n(0,l=t)}},o,function(e){l=e,n(0,l)},function(e){c=e,n(1,c)},function(){a=this.value,n(3,a)}]}class DS extends Ye{constructor(e){super(),Xe(this,e,zS,ES,a,{globalSettings:10})}}function US(e){let t,n;return t=new XS({props:{onClose:e[7],$$slots:{default:[VS]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};2&n&&(i.onClose=e[7]),257&n&&(i.$$scope={dirty:n,ctx:e}),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function VS(e){let t,n,i;function r(t){e[6](t)}let s={};return void 0!==e[0]&&(s.globalSettings=e[0]),t=new DS({props:s}),K.push((()=>Te(t,"globalSettings",r))),{c(){_e(t.$$.fragment)},m(e,n){Ze(t,e,n),i=!0},p(e,i){const r={};!n&&1&i&&(n=!0,r.globalSettings=e[0],oe((()=>n=!1))),t.$set(r)},i(e){i||(be(t.$$.fragment,e),i=!0)},o(e){we(t.$$.fragment,e),i=!1},d(e){Ce(t,e)}}}function IS(e){let t,n,i,r,s,o,a,l,c,h,u,d,f,O,p,m,g,b,w,x,y,S,k,T;function C(t){e[2](t)}r=new Wt({props:{title:"Legacy Tuning Generator"}});let Y={name:"filename-prefix-input",placeholder:"Prefix file names with...",fillWidth:!0};function R(t){e[3](t)}void 0!==e[0].filenamePrefix&&(Y.value=e[0].filenamePrefix),d=new nS({props:Y}),K.push((()=>Te(d,"value",C)));let q={label:"32-bit by default"};function A(t){e[4](t)}void 0!==e[0].all32bit&&(q.checked=e[0].all32bit),p=new Gy({props:q}),K.push((()=>Te(p,"checked",R)));let W={label:"High bit by default"};void 0!==e[0].allHighBit&&(W.checked=e[0].allHighBit),b=new Gy({props:W}),K.push((()=>Te(b,"checked",A))),y=new $S({props:{text:"Edit Templates",onClick:e[5]}});let E=e[1]&&US(e);return{c(){t=P("div"),n=P("div"),i=P("div"),_e(r.$$.fragment),s=_(),o=P("p"),o.innerHTML='This tool is for generating tuning/SimData files. It has now reached end of support, meaning I no longer maintain or\n provide support for it.\n This is an incomplete tool, and a more fleshed-out alternative should be available\n in the\n S4TK VS Code extension eventually.',a=_(),l=P("div"),c=P("p"),c.textContent="Global settings",h=_(),u=P("div"),_e(d.$$.fragment),O=_(),_e(p.$$.fragment),g=_(),_e(b.$$.fragment),x=_(),_e(y.$$.fragment),S=_(),E&&E.c(),k=Z(),X(c,"class","text-sm text-subtle uppercase font-bold mb-1"),X(u,"class","flex items-center gap-4 flex-wrap"),X(n,"class","w-full xl:max-w-screen-xl px-4 flex flex-col justify-center gap-4"),X(t,"class","bg-gray-100 dark:bg-gray-900 py-10 w-full flex justify-center")},m(e,f){$(e,t,f),v(t,n),v(n,i),Ze(r,i,null),v(n,s),v(n,o),v(n,a),v(n,l),v(l,c),v(l,h),v(l,u),Ze(d,u,null),v(u,O),Ze(p,u,null),v(u,g),Ze(b,u,null),v(u,x),Ze(y,u,null),$(e,S,f),E&&E.m(e,f),$(e,k,f),T=!0},p(e,[t]){const n={};!f&&1&t&&(f=!0,n.value=e[0].filenamePrefix,oe((()=>f=!1))),d.$set(n);const i={};!m&&1&t&&(m=!0,i.checked=e[0].all32bit,oe((()=>m=!1))),p.$set(i);const r={};!w&&1&t&&(w=!0,r.checked=e[0].allHighBit,oe((()=>w=!1))),b.$set(r);const s={};2&t&&(s.onClick=e[5]),y.$set(s),e[1]?E?(E.p(e,t),2&t&&be(E,1)):(E=US(e),E.c(),be(E,1),E.m(k.parentNode,k)):E&&(me(),we(E,1,1,(()=>{E=null})),ge())},i(e){T||(be(r.$$.fragment,e),be(d.$$.fragment,e),be(p.$$.fragment,e),be(b.$$.fragment,e),be(y.$$.fragment,e),be(E),T=!0)},o(e){we(r.$$.fragment,e),we(d.$$.fragment,e),we(p.$$.fragment,e),we(b.$$.fragment,e),we(y.$$.fragment,e),we(E),T=!1},d(e){e&&Q(t),Ce(r),Ce(d),Ce(p),Ce(b),Ce(y),e&&Q(S),E&&E.d(e),e&&Q(k)}}}function MS(e,t,n){let{globalSettings:i}=t,r=!1;return e.$$set=e=>{"globalSettings"in e&&n(0,i=e.globalSettings)},[i,r,function(t){e.$$.not_equal(i.filenamePrefix,t)&&(i.filenamePrefix=t,n(0,i))},function(t){e.$$.not_equal(i.all32bit,t)&&(i.all32bit=t,n(0,i))},function(t){e.$$.not_equal(i.allHighBit,t)&&(i.allHighBit=t,n(0,i))},()=>n(1,r=!0),function(e){i=e,n(0,i)},()=>n(1,r=!1)]}class GS extends Ye{constructor(e){super(),Xe(this,e,MS,IS,a,{globalSettings:0})}}function BS(t){let n,i;return{c(){n=P("img"),c(n.src,i="./assets/icons/"+t[0]+".svg")||X(n,"src",i),X(n,"alt",t[1]),X(n,"class","svg svelte-4un9ln")},m(e,t){$(e,n,t)},p(e,[t]){1&t&&!c(n.src,i="./assets/icons/"+e[0]+".svg")&&X(n,"src",i),2&t&&X(n,"alt",e[1])},i:e,o:e,d(e){e&&Q(n)}}}function NS(e,t,n){let{src:i}=t,{alt:r=i}=t;return e.$$set=e=>{"src"in e&&n(0,i=e.src),"alt"in e&&n(1,r=e.alt)},[i,r]}class LS extends Ye{constructor(e){super(),Xe(this,e,NS,BS,a,{src:0,alt:1})}}function FS(t){let n,i,r,s,o,a,l,c,h,u,d,f,O,p,m,g,b,w,x,y,S,k,Z,C,Y,R,q,A,W,E,j,z;return a=new LS({props:{src:"plus"}}),m=new LS({props:{src:"duplicate"}}),Y=new LS({props:{src:"hammer"}}),{c(){n=P("div"),i=P("h2"),i.textContent="This package is empty",r=_(),s=P("p"),o=T("Add an entry with the "),_e(a.$$.fragment),l=T(" button or\n "),c=P("mark"),c.textContent="ctrl/cmd",h=T("\n +\n "),u=P("mark"),u.textContent="n",d=T("."),f=_(),O=P("p"),p=T("Clone the last entry with the "),_e(m.$$.fragment),g=T(" button or\n "),b=P("mark"),b.textContent="ctrl/cmd",w=T("\n +\n "),x=P("mark"),x.textContent="m",y=T("."),S=_(),k=P("p"),Z=T("Build the package with the "),C=P("span"),_e(Y.$$.fragment),R=T("Build"),q=T("\n button or "),A=P("mark"),A.textContent="ctrl/cmd",W=T("\n +\n "),E=P("mark"),E.textContent="b",j=T("."),X(i,"class","text-center text-lg font-bold"),X(c,"class","key svelte-uav024"),X(u,"class","key svelte-uav024"),X(s,"class","text-subtle text-center"),X(b,"class","key svelte-uav024"),X(x,"class","key svelte-uav024"),X(O,"class","text-subtle text-center"),X(C,"class","monospace text-sm"),X(A,"class","key svelte-uav024"),X(E,"class","key svelte-uav024"),X(k,"class","text-subtle text-center"),X(n,"class","flex flex-col items-center gap-4")},m(e,t){$(e,n,t),v(n,i),v(n,r),v(n,s),v(s,o),Ze(a,s,null),v(s,l),v(s,c),v(s,h),v(s,u),v(s,d),v(n,f),v(n,O),v(O,p),Ze(m,O,null),v(O,g),v(O,b),v(O,w),v(O,x),v(O,y),v(n,S),v(n,k),v(k,Z),v(k,C),Ze(Y,C,null),v(C,R),v(k,q),v(k,A),v(k,W),v(k,E),v(k,j),z=!0},p:e,i(e){z||(be(a.$$.fragment,e),be(m.$$.fragment,e),be(Y.$$.fragment,e),z=!0)},o(e){we(a.$$.fragment,e),we(m.$$.fragment,e),we(Y.$$.fragment,e),z=!1},d(e){e&&Q(n),Ce(a),Ce(m),Ce(Y)}}}class HS extends Ye{constructor(e){super(),Xe(this,e,null,FS,a,{})}}function KS(e,t,n){const i=e.slice();return i[12]=t[n],i[13]=t,i[14]=n,i}function JS(t){let n,i;return n=new HS({}),{c(){_e(n.$$.fragment)},m(e,t){Ze(n,e,t),i=!0},p:e,i(e){i||(be(n.$$.fragment,e),i=!0)},o(e){we(n.$$.fragment,e),i=!1},d(e){Ce(n,e)}}}function e$(e){let t,n,i=[],r=new Map,s=e[1].entries;const o=e=>e[12].id;for(let t=0;tTe(i,"fileData",l))),K.push((()=>Te(i,"globalSettings",c))),K.push((()=>Te(i,"entry",h))),{key:e,first:null,c(){n=Z(),_e(i.$$.fragment),this.first=n},m(e,t){$(e,n,t),Ze(i,e,t),a=!0},p(e,n){t=e;const a={};!r&&2&n&&(r=!0,a.fileData=t[1],oe((()=>r=!1))),!s&&1&n&&(s=!0,a.globalSettings=t[0],oe((()=>s=!1))),!o&&2&n&&(o=!0,a.entry=t[12],oe((()=>o=!1))),i.$set(a)},i(e){a||(be(i.$$.fragment,e),a=!0)},o(e){we(i.$$.fragment,e),a=!1},d(e){e&&Q(n),Ce(i,e)}}}function n$(e){let t,n,i,r,s,o,a,l,c,h,u,d,f,O,p;function m(t){e[5](t)}let g={};void 0!==e[0]&&(g.globalSettings=e[0]),n=new GS({props:g}),K.push((()=>Te(n,"globalSettings",m)));const b=[e$,JS],w=[];function x(e,t){return e[1]?.entries.length>0?0:1}return o=x(e),a=w[o]=b[o](e),h=new Dy({props:{icon:"trash",title:"Delete All",onClick:e[4],danger:!0,useBg:!0,active:e[1].entries.length>0}}),d=new Dy({props:{icon:"duplicate",title:"Duplicate Last",onClick:e[3],useBg:!0,active:e[1].entries.length>0}}),O=new Dy({props:{icon:"plus",title:"New Resource",onClick:e[2],useBg:!0}}),{c(){t=P("div"),_e(n.$$.fragment),r=_(),s=P("div"),a.c(),l=_(),c=P("div"),_e(h.$$.fragment),u=_(),_e(d.$$.fragment),f=_(),_e(O.$$.fragment),X(s,"class","py-10 w-full xl:max-w-screen-xl px-4 flex flex-col justify-center gap-8"),X(t,"class","flex flex-col w-full items-center"),X(c,"class","fixed bottom-4 right-4 flex gap-2")},m(e,i){$(e,t,i),Ze(n,t,null),v(t,r),v(t,s),w[o].m(s,null),$(e,l,i),$(e,c,i),Ze(h,c,null),v(c,u),Ze(d,c,null),v(c,f),Ze(O,c,null),p=!0},p(e,[t]){const r={};!i&&1&t&&(i=!0,r.globalSettings=e[0],oe((()=>i=!1))),n.$set(r);let l=o;o=x(e),o===l?w[o].p(e,t):(me(),we(w[l],1,1,(()=>{w[l]=null})),ge(),a=w[o],a?a.p(e,t):(a=w[o]=b[o](e),a.c()),be(a,1),a.m(s,null));const c={};2&t&&(c.active=e[1].entries.length>0),h.$set(c);const u={};2&t&&(u.active=e[1].entries.length>0),d.$set(u)},i(e){p||(be(n.$$.fragment,e),be(a),be(h.$$.fragment,e),be(d.$$.fragment,e),be(O.$$.fragment,e),p=!0)},o(e){we(n.$$.fragment,e),we(a),we(h.$$.fragment,e),we(d.$$.fragment,e),we(O.$$.fragment,e),p=!1},d(e){e&&Q(t),Ce(n),w[o].d(),e&&Q(l),e&&Q(c),Ce(h),Ce(d),Ce(O)}}}function i$(e,t,n){const{enums:i}=window.S4TK;let{globalSettings:r}=t,{fileData:s}=t;const o=i.TuningResourceType.all()[0],a=[Wy("n",l,{ctrlOrMeta:!0,preventDefault:!0}),Wy("m",c,{ctrlOrMeta:!0,preventDefault:!0})];function l(){s.entries.push({id:n(1,s.nextId++,s),filename:"",hasSimData:!1,type:o,use32bit:r.all32bit,useHighBit:r.allHighBit,templateId:0}),n(1,s)}function c(){if(0===s.entries.length)return;const e={},t=s.entries[s.entries.length-1];for(const n in t)e[n]=t[n];e.id=n(1,s.nextId++,s),e.filename="",delete e.manualKey,s.entries.push(e),n(1,s)}return L((()=>{a.forEach((e=>e()))})),e.$$set=e=>{"globalSettings"in e&&n(0,r=e.globalSettings),"fileData"in e&&n(1,s=e.fileData)},[r,s,l,c,function(){confirm("This will delete all of the entries you've made for this package. This cannot be undone. Are you sure you want to continue?")&&(s.entries.splice(0,s.entries.length),n(1,s))},function(e){r=e,n(0,r)},function(e){s=e,n(1,s)},function(e){r=e,n(0,r)},function(e,t,i,r){i[r]=e,n(1,s)}]}class r$ extends Ye{constructor(e){super(),Xe(this,e,i$,n$,a,{globalSettings:0,fileData:1})}}var s$,o$={nextId:1,templates:[{id:0,name:"Default",tuning:'placeholder_value',simdata:'placeholder_value',locked:!0}]};!function(e){let t;async function n(){return new Promise(((e,n)=>{const i=indexedDB.open("PackageGeneratorDB",1);i.onerror=()=>{alert("Your browser does not support indexed databases, which means your work in the package generator will not be saved. Make sure you do not navigate away from this page, or you will lose your progress.")};const r=async e=>{t=e.target.result,t.onerror=e=>{console.error(`Database error: ${e.target.errorCode}`)}};i.onsuccess=t=>{r(t).then((()=>{e()}))},i.onupgradeneeded=e=>{r(e).then((()=>{t.createObjectStore("data",{autoIncrement:!0})}))}}))}e.fetchData=async function(){return new Promise((async(e,i)=>{t||await n();const r=t.transaction("data","readonly").objectStore("data").get(0);r.onerror=()=>{i("Could not fetch data.")},r.onsuccess=()=>{e(r.result)}}))},e.saveData=async function(e){t||await n(),t.transaction("data","readwrite").objectStore("data").put(e,0)}}(s$||(s$={}));var a$=s$;const{models:l$,hashing:c$,enums:h$}=window.S4TK;const u$=new class{constructor(){this._initialized=!1,this._isPreviewingPackage=!1,this._isPackagePreviewReady=!1}async initializeFromStorage(){try{if(this._initialized)return;const e=await a$.fetchData();e?(this._fileData=e.fileData,this._globalSettings=e.globalSettings):this._createDefaultData(),this._initialized=!0}catch(e){console.error(e),this._createDefaultData()}finally{Ey.onFileDataChange.notify(this._fileData),Ey.onGlobalSettingsChange.notify(this._globalSettings)}}async saveToStorage(){try{await a$.saveData({fileData:this._fileData,globalSettings:this._globalSettings})}catch(e){console.error(e)}}async requestPreviewer(){if(this._fileData&&this._globalSettings)try{this._isPreviewingPackage=!0,Ey.onPreviewingPackageChange.notify(!0),this._isPackagePreviewReady=!1,Ey.onPackagePreviewReadyChange.notify(!1);const e=this._buildPackage();if(!e)return alert("Could not build package. There is most likely a syntax error in one of your templates. Check the console for the full call stack."),void(this._isPreviewingPackage=!1);Rt.loadPackage(e.getBuffer(),"Generated.package")&&(this._isPackagePreviewReady=!0)}catch(e){this._isPreviewingPackage=!1}finally{Ey.onPreviewingPackageChange.notify(this._isPreviewingPackage),Ey.onPackagePreviewReadyChange.notify(this._isPackagePreviewReady)}}async requestBuilder(){this._fileData&&this._globalSettings&&(this._isPreviewingPackage=!1,this._isPackagePreviewReady=!1,Ey.onPreviewingPackageChange.notify(!1),Ey.onPackagePreviewReadyChange.notify(!1))}_buildPackage(){try{const e=new l$.Package;return this._fileData.entries.forEach((t=>{const n=this._globalSettings.templateData.templates.find((e=>e.id===t.templateId)),i=this._globalSettings.filenamePrefix+t.filename,r=this._getKey(t,"tuning"),s=new l$.XmlResource(n.tuning);if(s.updateRoot((e=>{e.name=i,e.id=r.instance.toString()})),e.add(r,s),t.hasSimData){const r=l$.SimDataResource.fromXml(n.simdata);r.instance.name=i,e.add(this._getKey(t,"simdata"),r)}})),e}catch(e){console.error("Could not generate package:",e)}}_getKey(e,t){const n=e.manualKey?.type??e.type,i=e.manualKey?.instance??BigInt((e.use32bit?c$.fnv32:c$.fnv64)(this._globalSettings.filenamePrefix+e.filename,e.useHighBit));return"tuning"===t?e.manualKey??{type:n,group:0,instance:i}:{type:h$.BinaryResourceType.SimData,group:h$.SimDataGroup.getForTuning(n),instance:i}}_createDefaultData(){this._fileData={nextId:0,entries:[]},this._globalSettings={filenamePrefix:"",all32bit:!1,allHighBit:!1,templateData:o$}}};function d$(t){let n,i,r,s,o;return s=new Sn({}),{c(){n=P("div"),i=P("p"),i.textContent="Loading saved data...",r=_(),_e(s.$$.fragment),X(n,"class","my-auto flex flex-col items-center gap-8")},m(e,t){$(e,n,t),v(n,i),v(n,r),Ze(s,n,null),o=!0},p:e,i(e){o||(be(s.$$.fragment,e),o=!0)},o(e){we(s.$$.fragment,e),o=!1},d(e){e&&Q(n),Ce(s)}}}function f$(e){let t,n,i,r;function s(t){e[3](t)}function o(t){e[4](t)}let a={};return void 0!==e[0]&&(a.fileData=e[0]),void 0!==e[1]&&(a.globalSettings=e[1]),t=new r$({props:a}),K.push((()=>Te(t,"fileData",s))),K.push((()=>Te(t,"globalSettings",o))),{c(){_e(t.$$.fragment)},m(e,n){Ze(t,e,n),r=!0},p(e,r){const s={};!n&&1&r&&(n=!0,s.fileData=e[0],oe((()=>n=!1))),!i&&2&r&&(i=!0,s.globalSettings=e[1],oe((()=>i=!1))),t.$set(s)},i(e){r||(be(t.$$.fragment,e),r=!0)},o(e){we(t.$$.fragment,e),r=!1},d(e){Ce(t,e)}}}function O$(e){let t,n,i,r;const s=[f$,d$],o=[];function a(e,t){return e[2]?0:1}return n=a(e),i=o[n]=s[n](e),{c(){t=P("section"),i.c(),X(t,"class","pt-10 h-screen w-full flex justify-center")},m(e,i){$(e,t,i),o[n].m(t,null),r=!0},p(e,[r]){let l=n;n=a(e),n===l?o[n].p(e,r):(me(),we(o[l],1,1,(()=>{o[l]=null})),ge(),i=o[n],i?i.p(e,r):(i=o[n]=s[n](e),i.c()),be(i,1),i.m(t,null))},i(e){r||(be(i),r=!0)},o(e){we(i),r=!1},d(e){e&&Q(t),o[n].d()}}}function p$(e,t,n){let i,r,s;const o=[Ey.onFileDataChange.subscribe((e=>{n(0,r=e)})),Ey.onGlobalSettingsChange.subscribe((e=>{n(1,s=e)}))];return N((()=>{u$.initializeFromStorage()})),L((()=>{o.forEach((e=>e()))})),e.$$.update=()=>{3&e.$$.dirty&&n(2,i=r&&s),3&e.$$.dirty&&r&&s&&u$.saveToStorage()},[r,s,i,function(e){r=e,n(0,r)},function(e){s=e,n(1,s)}]}class m$ extends Ye{constructor(e){super(),Xe(this,e,p$,O$,a,{})}}function g$(t){let n,i,r,s,o,a,l,h=(t[2]?t[1]:t[5])+"";return{c(){n=P("button"),i=P("img"),s=_(),o=T(h),X(i,"class","svg svelte-1dbjub8"),c(i.src,r="./assets/icons/"+t[0]+".svg")||X(i,"src",r),X(i,"alt",t[0]),X(n,"class","flex items-center py-1 px-2 svelte-1dbjub8"),E(n,"active",t[2]),E(n,"border",t[6]),E(n,"large",t[3]),E(n,"danger",t[4]),E(n,"use-bg",t[7])},m(e,r){$(e,n,r),v(n,i),v(n,s),v(n,o),t[12](n),a||(l=C(n,"click",t[9]),a=!0)},p(e,[t]){1&t&&!c(i.src,r="./assets/icons/"+e[0]+".svg")&&X(i,"src",r),1&t&&X(i,"alt",e[0]),38&t&&h!==(h=(e[2]?e[1]:e[5])+"")&&R(o,h),4&t&&E(n,"active",e[2]),64&t&&E(n,"border",e[6]),8&t&&E(n,"large",e[3]),16&t&&E(n,"danger",e[4]),128&t&&E(n,"use-bg",e[7])},i:e,o:e,d(e){e&&Q(n),t[12](null),a=!1,l()}}}function b$(e,t,n){let i,{icon:r}=t,{text:s}=t,{onClick:o}=t,{active:a=!0}=t,{large:l=!1}=t,{danger:c=!1}=t,{fixedWidth:h=""}=t,{disabledText:u=""}=t,{border:d=!0}=t,{useBg:f=!1}=t;return N((()=>{h&&n(8,i.style.width=h+"px",i)})),e.$$set=e=>{"icon"in e&&n(0,r=e.icon),"text"in e&&n(1,s=e.text),"onClick"in e&&n(10,o=e.onClick),"active"in e&&n(2,a=e.active),"large"in e&&n(3,l=e.large),"danger"in e&&n(4,c=e.danger),"fixedWidth"in e&&n(11,h=e.fixedWidth),"disabledText"in e&&n(5,u=e.disabledText),"border"in e&&n(6,d=e.border),"useBg"in e&&n(7,f=e.useBg)},[r,s,a,l,c,u,d,f,i,function(){a&&(o(),setTimeout((()=>{i.blur()}),100))},o,h,function(e){K[e?"unshift":"push"]((()=>{i=e,n(8,i)}))}]}class w$ extends Ye{constructor(e){super(),Xe(this,e,b$,g$,a,{icon:0,text:1,onClick:10,active:2,large:3,danger:4,fixedWidth:11,disabledText:5,border:6,useBg:7})}}function x$(t){let n,i;return n=new m$({}),{c(){_e(n.$$.fragment)},m(e,t){Ze(n,e,t),i=!0},p:e,i(e){i||(be(n.$$.fragment,e),i=!0)},o(e){we(n.$$.fragment,e),i=!1},d(e){Ce(n,e)}}}function v$(e){let t,n,i,r;const s=[S$,y$],o=[];function a(e,t){return e[1]?0:1}return t=a(e),n=o[t]=s[t](e),{c(){n.c(),i=Z()},m(e,n){o[t].m(e,n),$(e,i,n),r=!0},p(e,r){let l=t;t=a(e),t!==l&&(me(),we(o[l],1,1,(()=>{o[l]=null})),ge(),n=o[t],n||(n=o[t]=s[t](e),n.c()),be(n,1),n.m(i.parentNode,i))},i(e){r||(be(n),r=!0)},o(e){we(n),r=!1},d(e){o[t].d(e),e&&Q(i)}}}function y$(e){let t,n,i,r,s,o;return s=new Sn({}),{c(){t=P("section"),n=P("div"),i=P("p"),i.textContent="Building package...",r=_(),_e(s.$$.fragment),X(n,"class","flex flex-col items-center gap-8"),X(t,"class","pt-10 h-screen w-screen flex items-center justify-center")},m(e,a){$(e,t,a),v(t,n),v(n,i),v(n,r),Ze(s,n,null),o=!0},i(e){o||(be(s.$$.fragment,e),o=!0)},o(e){we(s.$$.fragment,e),o=!1},d(e){e&&Q(t),Ce(s)}}}function S$(e){let t,n;return t=new Ry({}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function $$(e){let t,n,i,r,s,o,a,l;i=new w$({props:{icon:e[0]?"pencil":"hammer",text:e[0]?"Edit":"Build",onClick:e[2],useBg:!0}});const c=[v$,x$],h=[];function u(e,t){return e[0]?0:1}return s=u(e),o=h[s]=c[s](e),{c(){t=_(),n=P("div"),_e(i.$$.fragment),r=_(),o.c(),a=Z(),document.title="S4TK Package Generator",X(n,"class","fixed z-30 top-14 right-4 hover:opacity-100"),E(n,"opacity-50",e[0])},m(e,o){$(e,t,o),$(e,n,o),Ze(i,n,null),$(e,r,o),h[s].m(e,o),$(e,a,o),l=!0},p(e,[t]){const r={};1&t&&(r.icon=e[0]?"pencil":"hammer"),1&t&&(r.text=e[0]?"Edit":"Build"),i.$set(r),(!l||1&t)&&E(n,"opacity-50",e[0]);let d=s;s=u(e),s===d?h[s].p(e,t):(me(),we(h[d],1,1,(()=>{h[d]=null})),ge(),o=h[s],o?o.p(e,t):(o=h[s]=c[s](e),o.c()),be(o,1),o.m(a.parentNode,a))},i(e){l||(be(i.$$.fragment,e),be(o),l=!0)},o(e){we(i.$$.fragment,e),we(o),l=!1},d(e){e&&Q(t),e&&Q(n),Ce(i),e&&Q(r),h[s].d(e),e&&Q(a)}}}function Q$(e,t,n){let i=!1,r=!1;const s=[Ey.onPreviewingPackageChange.subscribe((e=>{n(0,i=e)})),Ey.onPackagePreviewReadyChange.subscribe((e=>{n(1,r=e)})),Wy("b",o,{ctrlOrMeta:!0,preventDefault:!0})];function o(){i?u$.requestBuilder():u$.requestPreviewer()}return L((()=>{s.forEach((e=>e()))})),[i,r,o]}class k$ extends Ye{constructor(e){super(),Xe(this,e,Q$,$$,a,{})}}var P$="https://api.sims4toolkit.com";function T$(t){let n,i,r;return{c(){n=P("button"),n.innerHTML='code\n Format',X(n,"class","download-button text-xs px-2 py-1 rounded border border-solid border-gray-800 text-gray-800 hover:bg-gray-800 hover:text-white dark:border-white dark:text-white dark:hover:bg-white dark:hover:text-black svelte-1raocbi")},m(e,s){$(e,n,s),i||(r=C(n,"click",t[5]),i=!0)},p:e,d(e){e&&Q(n),i=!1,r()}}}function _$(t){let n,i,r,s,o,a,l,c,h,u,d,f,O;document.title=n=t[0];let p=t[2]&&T$(t);return{c(){i=_(),r=P("section"),s=P("div"),o=_(),a=P("div"),l=P("div"),c=P("button"),c.innerHTML='download\n Download',h=_(),p&&p.c(),u=_(),d=P("p"),d.textContent=`${t[3]()}`,X(s,"class","absolute top-10 bottom-10 left-0 right-0 overflow-auto"),X(c,"class","download-button text-xs px-2 py-1 rounded border border-solid border-gray-800 text-gray-800 hover:bg-gray-800 hover:text-white dark:border-white dark:text-white dark:hover:bg-white dark:hover:text-black svelte-1raocbi"),X(l,"class","flex gap-2"),X(d,"class","text-subtle text-xs uppercase"),X(a,"class","absolute bottom-0 left-0 right-0 h-10 px-2 bg-gray-200 dark:bg-gray-900 flex items-center justify-between border-t border-solid border-t-gray-300 dark:border-t-gray-700"),X(r,"class","pt-10 h-screen w-screen")},m(e,n){$(e,i,n),$(e,r,n),v(r,s),t[9](s),v(r,o),v(r,a),v(a,l),v(l,c),v(l,h),p&&p.m(l,null),v(a,u),v(a,d),f||(O=C(c,"click",t[4]),f=!0)},p(e,[t]){1&t&&n!==(n=e[0])&&(document.title=n),e[2]?p?p.p(e,t):(p=T$(e),p.c(),p.m(l,null)):p&&(p.d(1),p=null)},i:e,o:e,d(e){e&&Q(i),e&&Q(r),t[9](null),p&&p.d(),f=!1,O()}}}function Z$(e,t,n){let i;const{XmlDocumentNode:r}=window.S4TK.xml;let s,o,{filename:a}=t,{content:l}=t,{extension:c}=t,h=!1;const u=[Ot.subscribe("isLightTheme",(e=>{s&&Gv.updateTheme(s,!e)}))];function d(){switch(c){case"xml":case"json":case"py":return c;case"js":case"cjs":case"ts":return"js";default:return"py"}}return N((()=>{s=Gv.create(o,!ft.isLightTheme,d()),Gv.updateContent(s,l,d(),!0)})),L((()=>{u.forEach((e=>e()))})),e.$$set=e=>{"filename"in e&&n(0,a=e.filename),"content"in e&&n(6,l=e.content),"extension"in e&&n(7,c=e.extension)},e.$$.update=()=>{384&e.$$.dirty&&n(2,i=!h&&"xml"===c)},[a,o,i,function(){switch(c){case"py":return"python";case"js":case"cjs":return"javascript";case"ts":return"typescript";default:return c}},function(){rt.saveAs(new Blob([l]),a)},function(){try{const e=r.from(l).toXml({spacesPerIndent:ft.formatXmlSpaces});Gv.updateContent(s,e,"xml"),n(8,h=!0)}catch(e){console.error(e)}},l,c,h,function(e){K[e?"unshift":"push"]((()=>{o=e,n(1,o)}))}]}class C$ extends Ye{constructor(e){super(),Xe(this,e,Z$,_$,a,{filename:0,content:6,extension:7})}}function X$(t){let n,i;return n=new Sn({}),{c(){_e(n.$$.fragment)},m(e,t){Ze(n,e,t),i=!0},p:e,i(e){i||(be(n.$$.fragment,e),i=!0)},o(e){we(n.$$.fragment,e),i=!1},d(e){Ce(n,e)}}}function Y$(e){let t,n,i,r,o,a,l,c,h,u,d,f,O,p,m,g,b;return i=new Wt({props:{title:"Do you trust this page?"}}),{c(){t=P("div"),n=P("div"),_e(i.$$.fragment),r=_(),o=P("p"),o.textContent="The HTML page you're about to preview contains an unrecognized script.\n Running scripts from people you do not know can be risky; review it\n below before proceeding. Loading without the script make cause the\n page to behave incorrectly.",a=_(),l=P("div"),c=P("button"),c.textContent="Load Content Only",h=_(),u=P("button"),u.textContent="Load with Script",d=_(),f=P("div"),O=P("pre"),p=T(e[0]),X(o,"class","mt-4 mb-8"),X(c,"class","px-3 py-2 rounded border border-solid border-gray-800 text-gray-800 hover:bg-gray-800 hover:text-white dark:border-white dark:text-white dark:hover:bg-white dark:hover:text-black"),X(u,"class","px-3 py-2 rounded border border-solid border-gray-800 text-gray-800 hover:bg-gray-800 hover:text-white dark:border-white dark:text-white dark:hover:bg-white dark:hover:text-black"),X(l,"class","flex gap-4"),X(n,"class","max-w-full"),X(O,"class","w-full p-2 whitespace-pre-wrap break-all"),X(f,"class","max-w-full mt-8 w-full max-h-52 overflow-auto bg-gray-200 dark:bg-gray-900 rounded-lg"),X(t,"class","max-w-screen-md")},m(s,w){$(s,t,w),v(t,n),Ze(i,n,null),v(n,r),v(n,o),v(n,a),v(n,l),v(l,c),v(l,h),v(l,u),v(t,d),v(t,f),v(f,O),v(O,p),m=!0,g||(b=[C(c,"click",e[2]),C(u,"click",e[1])],g=!0)},p(e,t){(!m||1&t)&&R(p,e[0])},i(e){m||(be(i.$$.fragment,e),m=!0)},o(e){we(i.$$.fragment,e),m=!1},d(e){e&&Q(t),Ce(i),g=!1,s(b)}}}function R$(e){let t,n,i,r;const s=[Y$,X$],o=[];function a(e,t){return e[0]?0:1}return n=a(e),i=o[n]=s[n](e),{c(){t=P("section"),i.c(),X(t,"class","pt-10 px-4 h-screen w-screen flex items-center justify-center")},m(e,i){$(e,t,i),o[n].m(t,null),r=!0},p(e,[r]){let l=n;n=a(e),n===l?o[n].p(e,r):(me(),we(o[l],1,1,(()=>{o[l]=null})),ge(),i=o[n],i?i.p(e,r):(i=o[n]=s[n](e),i.c()),be(i,1),i.m(t,null))},i(e){r||(be(i),r=!0)},o(e){we(i),r=!1},d(e){e&&Q(t),o[n].d()}}}function q$(e){document.open(),document.write(e),document.close()}function A$(e,t,n){const{fnv64:i}=window.S4TK.hashing;let r,s,o,{content:a}=t;return N((()=>{if(r=document.createElement("html"),r.innerHTML=a,s=r.getElementsByTagName("script"),s.length){const t=[];for(let e=0;e{"content"in e&&n(3,a=e.content)},[o,function(){q$(a)},function(){for(let e=0;e{a[s]=null})),ge(),r=a[i],r?r.p(e,n):(r=a[i]=o[i](e),r.c()),be(r,1),r.m(t,null))},i(e){s||(be(r),s=!0)},o(e){we(r),s=!1},d(e){e&&Q(t),a[i].d()}}}function j$(e){let t,n,i,r;const s=[I$,V$,U$],o=[];function a(e,t){return e[4]?0:e[5]?1:2}return t=a(e),n=o[t]=s[t](e),{c(){n.c(),i=Z()},m(e,n){o[t].m(e,n),$(e,i,n),r=!0},p(e,r){let l=t;t=a(e),t===l?o[t].p(e,r):(me(),we(o[l],1,1,(()=>{o[l]=null})),ge(),n=o[t],n?n.p(e,r):(n=o[t]=s[t](e),n.c()),be(n,1),n.m(i.parentNode,i))},i(e){r||(be(n),r=!0)},o(e){we(n),r=!1},d(e){o[t].d(e),e&&Q(i)}}}function z$(e){let t,n,i,r,s,o,a,l,c,h,u=e[4]?"package":"file";return c=new Sn({}),{c(){t=P("div"),n=P("h2"),n.textContent="Hang Tight",i=_(),r=P("p"),s=T("Fetching "),o=T(u),a=T(" from Discord"),l=_(),_e(c.$$.fragment),X(n,"class","mb-4 text-2xl font-bold"),X(r,"class","mb-4"),X(t,"class","text-center")},m(e,u){$(e,t,u),v(t,n),v(t,i),v(t,r),v(r,s),v(r,o),v(r,a),v(t,l),Ze(c,t,null),h=!0},p(e,t){(!h||16&t)&&u!==(u=e[4]?"package":"file")&&R(o,u)},i(e){h||(be(c.$$.fragment,e),h=!0)},o(e){we(c.$$.fragment,e),h=!1},d(e){e&&Q(t),Ce(c)}}}function D$(t){let n,i,r,s,o,a,l;return{c(){n=P("div"),i=P("h2"),i.textContent="Error",r=_(),s=P("p"),o=T(t[2]),a=_(),l=P("p"),l.innerHTML='Try refreshing the page. If it still isn't working, let me know.',X(i,"class","mb-4 text-2xl font-bold"),X(s,"class","mb-8"),X(l,"class","text-sm text-subtle"),X(n,"class","text-center")},m(e,t){$(e,n,t),v(n,i),v(n,r),v(n,s),v(s,o),v(n,a),v(n,l)},p(e,t){4&t&&R(o,e[2])},i:e,o:e,d(e){e&&Q(n)}}}function U$(e){let t,n;return t=new C$({props:{filename:e[0].filename,content:e[3],extension:e[6]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.filename=e[0].filename),8&n&&(i.content=e[3]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function V$(e){let t,n;return t=new W$({props:{content:e[3]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};8&n&&(i.content=e[3]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function I$(t){let n,i;return n=new Ry({}),{c(){_e(n.$$.fragment)},m(e,t){Ze(n,e,t),i=!0},p:e,i(e){i||(be(n.$$.fragment,e),i=!0)},o(e){we(n.$$.fragment,e),i=!1},d(e){Ce(n,e)}}}function M$(e){let t,n,i,r;const s=[j$,E$],o=[];function a(e,t){return e[1]?0:1}return t=a(e),n=o[t]=s[t](e),{c(){n.c(),i=Z()},m(e,n){o[t].m(e,n),$(e,i,n),r=!0},p(e,[r]){let l=t;t=a(e),t===l?o[t].p(e,r):(me(),we(o[l],1,1,(()=>{o[l]=null})),ge(),n=o[t],n?n.p(e,r):(n=o[t]=s[t](e),n.c()),be(n,1),n.m(i.parentNode,i))},i(e){r||(be(n),r=!0)},o(e){we(n),r=!1},d(e){o[t].d(e),e&&Q(i)}}}function G$(e,t,n){let i,r,{params:s}=t;const o=(a=s.filename?.split("."),a[a.length-1]);var a;let l,c,h=!1;return N((()=>{const e=window.location.hash?.replace("#/","");i?async function(e){try{const t=await fetch(`${P$}/${e}`);if(t.ok){const e=await t.arrayBuffer(),i=window.NodeJS.Buffer.from(e);await Rt.loadPackage(i,s.filename)?n(1,h=!0):(n(2,l="Package is invalid or empty."),console.error(l))}else console.error(t),n(2,l=`[${t.status}] ${t.statusText}`)}catch(e){console.error(e),n(2,l=e instanceof Error?e.message:e)}}(e):async function(e){try{const t=await fetch(`${P$}/${e}`);t.ok?(n(3,c=await t.text()),n(1,h=!0)):(console.error(t),n(2,l=`[${t.status}] ${t.statusText}`))}catch(e){console.error(e),n(2,l=e instanceof Error?e.message:e)}}(e)})),e.$$set=e=>{"params"in e&&n(0,s=e.params)},n(4,i="package"===o),n(5,r="html"===o),[s,h,l,c,i,r,o]}class B$ extends Ye{constructor(e){super(),Xe(this,e,G$,M$,a,{params:0})}}function N$(t){let n,i,r,s,o;return n=new dn({}),s=new Le({props:{routes:t[0],restoreScrollState:!0}}),{c(){_e(n.$$.fragment),i=_(),r=P("main"),_e(s.$$.fragment),X(r,"class","min-h-screen flex flex-col")},m(e,t){Ze(n,e,t),$(e,i,t),$(e,r,t),Ze(s,r,null),o=!0},p:e,i(e){o||(be(n.$$.fragment,e),be(s.$$.fragment,e),o=!0)},o(e){we(n.$$.fragment,e),we(s.$$.fragment,e),o=!1},d(e){Ce(n,e),e&&Q(i),e&&Q(r),Ce(s)}}}function L$(e){return[{"/":wn,"/view":Ry,"/generate":k$,"/discord/:server/:message/:filename":B$,"*":vn}]}const F$=new class extends Ye{constructor(e){super(),Xe(this,e,L$,N$,a,{})}}({target:document.body});return window.addEventListener("load",(()=>{ct.toggleLightTheme(ft.isLightTheme,!1)})),F$}(); + */var it=tt((function(e,t){e.exports=function e(t,n,i){function r(o,a){if(!n[o]){if(!t[o]){if(!a&&nt)return nt(o);if(s)return s(o,!0);var l=new Error("Cannot find module '"+o+"'");throw l.code="MODULE_NOT_FOUND",l}var c=n[o]={exports:{}};t[o][0].call(c.exports,(function(e){return r(t[o][1][e]||e)}),c,c.exports,e,t,n,i)}return n[o].exports}for(var s=nt,o=0;o>2,a=(3&t)<<4|n>>4,l=1>6:64,c=2>4,n=(15&o)<<4|(a=s.indexOf(e.charAt(c++)))>>2,i=(3&a)<<6|(l=s.indexOf(e.charAt(c++))),d[h++]=t,64!==a&&(d[h++]=n),64!==l&&(d[h++]=i);return d}},{"./support":30,"./utils":32}],2:[function(e,t,n){var i=e("./external"),r=e("./stream/DataWorker"),s=e("./stream/Crc32Probe"),o=e("./stream/DataLengthProbe");function a(e,t,n,i,r){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=i,this.compressedContent=r}a.prototype={getContentWorker:function(){var e=new r(i.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o("data_length")),t=this;return e.on("end",(function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")})),e},getCompressedWorker:function(){return new r(i.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},a.createWorkerFrom=function(e,t,n){return e.pipe(new s).pipe(new o("uncompressedSize")).pipe(t.compressWorker(n)).pipe(new o("compressedSize")).withStreamInfo("compression",t)},t.exports=a},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){var i=e("./stream/GenericWorker");n.STORE={magic:"\0\0",compressWorker:function(){return new i("STORE compression")},uncompressWorker:function(){return new i("STORE decompression")}},n.DEFLATE=e("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,n){var i=e("./utils"),r=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return void 0!==e&&e.length?"string"!==i.getTypeOf(e)?function(e,t,n,i){var s=r,o=i+n;e^=-1;for(var a=i;a>>8^s[255&(e^t[a])];return-1^e}(0|t,e,e.length,0):function(e,t,n,i){var s=r,o=i+n;e^=-1;for(var a=i;a>>8^s[255&(e^t.charCodeAt(a))];return-1^e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,n){n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t,n){var i=null;i="undefined"!=typeof Promise?Promise:e("lie"),t.exports={Promise:i}},{lie:37}],7:[function(e,t,n){var i="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array,r=e("pako"),s=e("./utils"),o=e("./stream/GenericWorker"),a=i?"uint8array":"array";function l(e,t){o.call(this,"FlateWorker/"+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}n.magic="\b\0",s.inherits(l,o),l.prototype.processChunk=function(e){this.meta=e.meta,null===this._pako&&this._createPako(),this._pako.push(s.transformTo(a,e.data),!1)},l.prototype.flush=function(){o.prototype.flush.call(this),null===this._pako&&this._createPako(),this._pako.push([],!0)},l.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},l.prototype._createPako=function(){this._pako=new r[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},n.compressWorker=function(e){return new l("Deflate",e)},n.uncompressWorker=function(){return new l("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,n){function i(e,t){var n,i="";for(n=0;n>>=8;return i}function r(e,t,n,r,o,h){var u,d,f=e.file,O=e.compression,p=h!==a.utf8encode,m=s.transformTo("string",h(f.name)),g=s.transformTo("string",a.utf8encode(f.name)),b=f.comment,w=s.transformTo("string",h(b)),x=s.transformTo("string",a.utf8encode(b)),v=g.length!==f.name.length,y=x.length!==b.length,S="",$="",Q="",k=f.dir,P=f.date,T={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(T.crc32=e.crc32,T.compressedSize=e.compressedSize,T.uncompressedSize=e.uncompressedSize);var _=0;t&&(_|=8),p||!v&&!y||(_|=2048);var Z=0,C=0;k&&(Z|=16),"UNIX"===o?(C=798,Z|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(f.unixPermissions,k)):(C=20,Z|=function(e){return 63&(e||0)}(f.dosPermissions)),u=P.getUTCHours(),u<<=6,u|=P.getUTCMinutes(),u<<=5,u|=P.getUTCSeconds()/2,d=P.getUTCFullYear()-1980,d<<=4,d|=P.getUTCMonth()+1,d<<=5,d|=P.getUTCDate(),v&&($=i(1,1)+i(l(m),4)+g,S+="up"+i($.length,2)+$),y&&(Q=i(1,1)+i(l(w),4)+x,S+="uc"+i(Q.length,2)+Q);var X="";return X+="\n\0",X+=i(_,2),X+=O.magic,X+=i(u,2),X+=i(d,2),X+=i(T.crc32,4),X+=i(T.compressedSize,4),X+=i(T.uncompressedSize,4),X+=i(m.length,2),X+=i(S.length,2),{fileRecord:c.LOCAL_FILE_HEADER+X+m+S,dirRecord:c.CENTRAL_FILE_HEADER+i(C,2)+X+i(w.length,2)+"\0\0\0\0"+i(Z,4)+i(r,4)+m+S+w}}var s=e("../utils"),o=e("../stream/GenericWorker"),a=e("../utf8"),l=e("../crc32"),c=e("../signature");function h(e,t,n,i){o.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=i,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}s.inherits(h,o),h.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,i=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-i-1))/n:100}}))},h.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=r(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},h.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=r(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return c.DATA_DESCRIPTOR+i(e.crc32,4)+i(e.compressedSize,4)+i(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},h.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return i.transformTo("string",this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=r},{"../utils":32}],19:[function(e,t,n){var i=e("./Uint8ArrayReader");function r(e){i.call(this,e)}e("../utils").inherits(r,i),r.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){var i=e("./DataReader");function r(e){i.call(this,e)}e("../utils").inherits(r,i),r.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},r.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},r.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},r.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){var i=e("./ArrayReader");function r(e){i.call(this,e)}e("../utils").inherits(r,i),r.prototype.readData=function(e){if(this.checkOffset(e),0===e)return new Uint8Array(0);var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=r},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){var i=e("../utils"),r=e("../support"),s=e("./ArrayReader"),o=e("./StringReader"),a=e("./NodeBufferReader"),l=e("./Uint8ArrayReader");t.exports=function(e){var t=i.getTypeOf(e);return i.checkSupport(t),"string"!==t||r.uint8array?"nodebuffer"===t?new a(e):r.uint8array?new l(i.transformTo("uint8array",e)):new s(i.transformTo("array",e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){n.LOCAL_FILE_HEADER="PK",n.CENTRAL_FILE_HEADER="PK",n.CENTRAL_DIRECTORY_END="PK",n.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK",n.ZIP64_CENTRAL_DIRECTORY_END="PK",n.DATA_DESCRIPTOR="PK\b"},{}],24:[function(e,t,n){var i=e("./GenericWorker"),r=e("../utils");function s(e){i.call(this,"ConvertWorker to "+e),this.destType=e}r.inherits(s,i),s.prototype.processChunk=function(e){this.push({data:r.transformTo(this.destType,e.data),meta:e.meta})},t.exports=s},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){var i=e("./GenericWorker"),r=e("../crc32");function s(){i.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}e("../utils").inherits(s,i),s.prototype.processChunk=function(e){this.streamInfo.crc32=r(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=s},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){var i=e("../utils"),r=e("./GenericWorker");function s(e){r.call(this,"DataLengthProbe for "+e),this.propName=e,this.withStreamInfo(e,0)}i.inherits(s,r),s.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}r.prototype.processChunk.call(this,e)},t.exports=s},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){var i=e("../utils"),r=e("./GenericWorker");function s(e){r.call(this,"DataWorker");var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,e.then((function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=i.getTypeOf(e),t.isPaused||t._tickAndRepeat()}),(function(e){t.error(e)}))}i.inherits(s,r),s.prototype.cleanUp=function(){r.prototype.cleanUp.call(this),this.data=null},s.prototype.resume=function(){return!!r.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,i.delay(this._tickAndRepeat,[],this)),!0)},s.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(i.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},s.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":e=this.data.substring(this.index,t);break;case"uint8array":e=this.data.subarray(this.index,t);break;case"array":case"nodebuffer":e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=s},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){function i(e){this.name=e||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}i.prototype={push:function(e){this.emit("data",e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(e){this.emit("error",e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit("error",e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n "+e:e}},t.exports=i},{}],29:[function(e,t,n){var i=e("../utils"),r=e("./ConvertWorker"),s=e("./GenericWorker"),o=e("../base64"),a=e("../support"),l=e("../external"),c=null;if(a.nodestream)try{c=e("../nodejs/NodejsStreamOutputAdapter")}catch(e){}function h(e,t){return new l.Promise((function(n,r){var s=[],a=e._internalType,l=e._outputType,c=e._mimeType;e.on("data",(function(e,n){s.push(e),t&&t(n)})).on("error",(function(e){s=[],r(e)})).on("end",(function(){try{var e=function(e,t,n){switch(e){case"blob":return i.newBlob(i.transformTo("arraybuffer",t),n);case"base64":return o.encode(t);default:return i.transformTo(e,t)}}(l,function(e,t){var n,i=0,r=null,s=0;for(n=0;n>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t}(e)},n.utf8decode=function(e){return r.nodebuffer?i.transformTo("nodebuffer",e).toString("utf-8"):function(e){var t,n,r,s,o=e.length,l=new Array(2*o);for(t=n=0;t>10&1023,l[n++]=56320|1023&r)}return l.length!==n&&(l.subarray?l=l.subarray(0,n):l.length=n),i.applyFromCharCode(l)}(e=i.transformTo(r.uint8array?"uint8array":"array",e))},i.inherits(c,o),c.prototype.processChunk=function(e){var t=i.transformTo(r.uint8array?"uint8array":"array",e.data);if(this.leftOver&&this.leftOver.length){if(r.uint8array){var s=t;(t=new Uint8Array(s.length+this.leftOver.length)).set(this.leftOver,0),t.set(s,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+a[e[n]]>t?n:t}(t),l=t;o!==t.length&&(r.uint8array?(l=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(l=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:n.utf8decode(l),meta:e.meta})},c.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=c,i.inherits(h,o),h.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=h},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){var i=e("./support"),r=e("./base64"),s=e("./nodejsUtils"),o=e("./external");function a(e){return e}function l(e,t){for(var n=0;n>8;this.dir=!!(16&this.externalFileAttributes),0==e&&(this.dosPermissions=63&this.externalFileAttributes),3==e&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||"/"!==this.fileNameStr.slice(-1)||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=i(this.extraFields[1].value);this.uncompressedSize===r.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===r.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===r.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===r.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,i,r=e.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});e.index+4>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t},n.buf2binstring=function(e){return l(e,e.length)},n.binstring2buf=function(e){for(var t=new i.Buf8(e.length),n=0,r=t.length;n>10&1023,c[i++]=56320|1023&r)}return l(c,i)},n.utf8border=function(e,t){var n;for((t=t||e.length)>e.length&&(t=e.length),n=t-1;0<=n&&128==(192&e[n]);)n--;return n<0||0===n?t:n+o[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){t.exports=function(e,t,n,i){for(var r=65535&e|0,s=e>>>16&65535|0,o=0;0!==n;){for(n-=o=2e3>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,r){var s=i,o=r+n;e^=-1;for(var a=r;a>>8^s[255&(e^t[a])];return-1^e}},{}],46:[function(e,t,n){var i,r=e("../utils/common"),s=e("./trees"),o=e("./adler32"),a=e("./crc32"),l=e("./messages"),c=0,h=4,u=0,d=-2,f=-1,O=4,p=2,m=8,g=9,b=286,w=30,x=19,v=2*b+1,y=15,S=3,$=258,Q=$+S+1,k=42,P=113,T=1,_=2,Z=3,C=4;function X(e,t){return e.msg=l[t],t}function Y(e){return(e<<1)-(4e.avail_out&&(n=e.avail_out),0!==n&&(r.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))}function A(e,t){s._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,q(e.strm)}function W(e,t){e.pending_buf[e.pending++]=t}function E(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function j(e,t){var n,i,r=e.max_chain_length,s=e.strstart,o=e.prev_length,a=e.nice_match,l=e.strstart>e.w_size-Q?e.strstart-(e.w_size-Q):0,c=e.window,h=e.w_mask,u=e.prev,d=e.strstart+$,f=c[s+o-1],O=c[s+o];e.prev_length>=e.good_match&&(r>>=2),a>e.lookahead&&(a=e.lookahead);do{if(c[(n=t)+o]===O&&c[n+o-1]===f&&c[n]===c[s]&&c[++n]===c[s+1]){s+=2,n++;do{}while(c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&c[++s]===c[++n]&&sl&&0!=--r);return o<=e.lookahead?o:e.lookahead}function z(e){var t,n,i,s,l,c,h,u,d,f,O=e.w_size;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=O+(O-Q)){for(r.arraySet(e.window,e.window,O,O,0),e.match_start-=O,e.strstart-=O,e.block_start-=O,t=n=e.hash_size;i=e.head[--t],e.head[t]=O<=i?i-O:0,--n;);for(t=n=O;i=e.prev[--t],e.prev[t]=O<=i?i-O:0,--n;);s+=O}if(0===e.strm.avail_in)break;if(c=e.strm,h=e.window,u=e.strstart+e.lookahead,f=void 0,(d=s)<(f=c.avail_in)&&(f=d),n=0===f?0:(c.avail_in-=f,r.arraySet(h,c.input,c.next_in,f,u),1===c.state.wrap?c.adler=o(c.adler,h,f,u):2===c.state.wrap&&(c.adler=a(c.adler,h,f,u)),c.next_in+=f,c.total_in+=f,f),e.lookahead+=n,e.lookahead+e.insert>=S)for(l=e.strstart-e.insert,e.ins_h=e.window[l],e.ins_h=(e.ins_h<=S&&(e.ins_h=(e.ins_h<=S)if(i=s._tr_tally(e,e.strstart-e.match_start,e.match_length-S),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=S){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=S&&(e.ins_h=(e.ins_h<=S&&e.match_length<=e.prev_length){for(r=e.strstart+e.lookahead-S,i=s._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-S),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=r&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(z(e),0===e.lookahead&&t===c)return T;if(0===e.lookahead)break}e.strstart+=e.lookahead,e.lookahead=0;var i=e.block_start+n;if((0===e.strstart||e.strstart>=i)&&(e.lookahead=e.strstart-i,e.strstart=i,A(e,!1),0===e.strm.avail_out))return T;if(e.strstart-e.block_start>=e.w_size-Q&&(A(e,!1),0===e.strm.avail_out))return T}return e.insert=0,t===h?(A(e,!0),0===e.strm.avail_out?Z:C):(e.strstart>e.block_start&&(A(e,!1),e.strm.avail_out),T)})),new V(4,4,8,4,D),new V(4,5,16,8,D),new V(4,6,32,32,D),new V(4,4,16,16,U),new V(8,16,32,32,U),new V(8,16,128,128,U),new V(8,32,128,256,U),new V(32,128,258,1024,U),new V(32,258,258,4096,U)],n.deflateInit=function(e,t){return B(e,t,m,15,8,0)},n.deflateInit2=B,n.deflateReset=G,n.deflateResetKeep=M,n.deflateSetHeader=function(e,t){return e&&e.state?2!==e.state.wrap?d:(e.state.gzhead=t,u):d},n.deflate=function(e,t){var n,r,o,l;if(!e||!e.state||5>8&255),W(r,r.gzhead.time>>16&255),W(r,r.gzhead.time>>24&255),W(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),W(r,255&r.gzhead.os),r.gzhead.extra&&r.gzhead.extra.length&&(W(r,255&r.gzhead.extra.length),W(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(e.adler=a(e.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=69):(W(r,0),W(r,0),W(r,0),W(r,0),W(r,0),W(r,9===r.level?2:2<=r.strategy||r.level<2?4:0),W(r,3),r.status=P);else{var f=m+(r.w_bits-8<<4)<<8;f|=(2<=r.strategy||r.level<2?0:r.level<6?1:6===r.level?2:3)<<6,0!==r.strstart&&(f|=32),f+=31-f%31,r.status=P,E(r,f),0!==r.strstart&&(E(r,e.adler>>>16),E(r,65535&e.adler)),e.adler=1}if(69===r.status)if(r.gzhead.extra){for(o=r.pending;r.gzindex<(65535&r.gzhead.extra.length)&&(r.pending!==r.pending_buf_size||(r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),q(e),o=r.pending,r.pending!==r.pending_buf_size));)W(r,255&r.gzhead.extra[r.gzindex]),r.gzindex++;r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),r.gzindex===r.gzhead.extra.length&&(r.gzindex=0,r.status=73)}else r.status=73;if(73===r.status)if(r.gzhead.name){o=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),q(e),o=r.pending,r.pending===r.pending_buf_size)){l=1;break}l=r.gzindexo&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),0===l&&(r.gzindex=0,r.status=91)}else r.status=91;if(91===r.status)if(r.gzhead.comment){o=r.pending;do{if(r.pending===r.pending_buf_size&&(r.gzhead.hcrc&&r.pending>o&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),q(e),o=r.pending,r.pending===r.pending_buf_size)){l=1;break}l=r.gzindexo&&(e.adler=a(e.adler,r.pending_buf,r.pending-o,o)),0===l&&(r.status=103)}else r.status=103;if(103===r.status&&(r.gzhead.hcrc?(r.pending+2>r.pending_buf_size&&q(e),r.pending+2<=r.pending_buf_size&&(W(r,255&e.adler),W(r,e.adler>>8&255),e.adler=0,r.status=P)):r.status=P),0!==r.pending){if(q(e),0===e.avail_out)return r.last_flush=-1,u}else if(0===e.avail_in&&Y(t)<=Y(n)&&t!==h)return X(e,-5);if(666===r.status&&0!==e.avail_in)return X(e,-5);if(0!==e.avail_in||0!==r.lookahead||t!==c&&666!==r.status){var O=2===r.strategy?function(e,t){for(var n;;){if(0===e.lookahead&&(z(e),0===e.lookahead)){if(t===c)return T;break}if(e.match_length=0,n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(A(e,!1),0===e.strm.avail_out))return T}return e.insert=0,t===h?(A(e,!0),0===e.strm.avail_out?Z:C):e.last_lit&&(A(e,!1),0===e.strm.avail_out)?T:_}(r,t):3===r.strategy?function(e,t){for(var n,i,r,o,a=e.window;;){if(e.lookahead<=$){if(z(e),e.lookahead<=$&&t===c)return T;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=S&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=S?(n=s._tr_tally(e,1,e.match_length-S),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=s._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(A(e,!1),0===e.strm.avail_out))return T}return e.insert=0,t===h?(A(e,!0),0===e.strm.avail_out?Z:C):e.last_lit&&(A(e,!1),0===e.strm.avail_out)?T:_}(r,t):i[r.level].func(r,t);if(O!==Z&&O!==C||(r.status=666),O===T||O===Z)return 0===e.avail_out&&(r.last_flush=-1),u;if(O===_&&(1===t?s._tr_align(r):5!==t&&(s._tr_stored_block(r,0,0,!1),3===t&&(R(r.head),0===r.lookahead&&(r.strstart=0,r.block_start=0,r.insert=0))),q(e),0===e.avail_out))return r.last_flush=-1,u}return t!==h?u:r.wrap<=0?1:(2===r.wrap?(W(r,255&e.adler),W(r,e.adler>>8&255),W(r,e.adler>>16&255),W(r,e.adler>>24&255),W(r,255&e.total_in),W(r,e.total_in>>8&255),W(r,e.total_in>>16&255),W(r,e.total_in>>24&255)):(E(r,e.adler>>>16),E(r,65535&e.adler)),q(e),0=n.w_size&&(0===a&&(R(n.head),n.strstart=0,n.block_start=0,n.insert=0),f=new r.Buf8(n.w_size),r.arraySet(f,t,O-n.w_size,n.w_size,0),t=f,O=n.w_size),l=e.avail_in,c=e.next_in,h=e.input,e.avail_in=O,e.next_in=0,e.input=t,z(n);n.lookahead>=S;){for(i=n.strstart,s=n.lookahead-(S-1);n.ins_h=(n.ins_h<>>=x=w>>>24,O-=x,0==(x=w>>>16&255))k[s++]=65535&w;else{if(!(16&x)){if(0==(64&x)){w=p[(65535&w)+(f&(1<>>=x,O-=x),O<15&&(f+=Q[i++]<>>=x=w>>>24,O-=x,!(16&(x=w>>>16&255))){if(0==(64&x)){w=m[(65535&w)+(f&(1<>>=x,O-=x,(x=s-o)>3,f&=(1<<(O-=v<<3))-1,e.next_in=i,e.next_out=s,e.avail_in=i>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function m(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new i.Buf16(320),this.work=new i.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function g(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=d,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new i.Buf32(f),t.distcode=t.distdyn=new i.Buf32(O),t.sane=1,t.back=-1,h):u}function b(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,g(e)):u}function w(e,t){var n,i;return e&&e.state?(i=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=o.wsize?(i.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(r<(s=o.wsize-o.wnext)&&(s=r),i.arraySet(o.window,t,n-r,s,o.wnext),(r-=s)?(i.arraySet(o.window,t,n-r,r,0),o.wnext=r,o.whave=o.wsize):(o.wnext+=s,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=s(n.check,z,2,0),v=x=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&x)<<8)+(x>>8))%31){e.msg="incorrect header check",n.mode=30;break}if(8!=(15&x)){e.msg="unknown compression method",n.mode=30;break}if(v-=4,q=8+(15&(x>>>=4)),0===n.wbits)n.wbits=q;else if(q>n.wbits){e.msg="invalid window size",n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(z[0]=255&x,z[1]=x>>>8&255,n.check=s(n.check,z,2,0)),v=x=0,n.mode=3;case 3:for(;v<32;){if(0===b)break e;b--,x+=f[m++]<>>8&255,z[2]=x>>>16&255,z[3]=x>>>24&255,n.check=s(n.check,z,4,0)),v=x=0,n.mode=4;case 4:for(;v<16;){if(0===b)break e;b--,x+=f[m++]<>8),512&n.flags&&(z[0]=255&x,z[1]=x>>>8&255,n.check=s(n.check,z,2,0)),v=x=0,n.mode=5;case 5:if(1024&n.flags){for(;v<16;){if(0===b)break e;b--,x+=f[m++]<>>8&255,n.check=s(n.check,z,2,0)),v=x=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(b<(k=n.length)&&(k=b),k&&(n.head&&(q=n.head.extra_len-n.length,n.head.extra||(n.head.extra=new Array(n.head.extra_len)),i.arraySet(n.head.extra,f,m,k,q)),512&n.flags&&(n.check=s(n.check,f,k,m)),b-=k,m+=k,n.length-=k),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(0===b)break e;for(k=0;q=f[m+k++],n.head&&q&&n.length<65536&&(n.head.name+=String.fromCharCode(q)),q&&k>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;v<32;){if(0===b)break e;b--,x+=f[m++]<>>=7&v,v-=7&v,n.mode=27;break}for(;v<3;){if(0===b)break e;b--,x+=f[m++]<>>=1)){case 0:n.mode=14;break;case 1:if($(n),n.mode=20,6!==t)break;x>>>=2,v-=2;break e;case 2:n.mode=17;break;case 3:e.msg="invalid block type",n.mode=30}x>>>=2,v-=2;break;case 14:for(x>>>=7&v,v-=7&v;v<32;){if(0===b)break e;b--,x+=f[m++]<>>16^65535)){e.msg="invalid stored block lengths",n.mode=30;break}if(n.length=65535&x,v=x=0,n.mode=15,6===t)break e;case 15:n.mode=16;case 16:if(k=n.length){if(b>>=5,v-=5,n.ndist=1+(31&x),x>>>=5,v-=5,n.ncode=4+(15&x),x>>>=4,v-=4,286>>=3,v-=3}for(;n.have<19;)n.lens[D[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,W={bits:n.lenbits},A=a(0,n.lens,0,19,n.lencode,0,n.work,W),n.lenbits=W.bits,A){e.msg="invalid code lengths set",n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,C=65535&j,!((_=j>>>24)<=v);){if(0===b)break e;b--,x+=f[m++]<>>=_,v-=_,n.lens[n.have++]=C;else{if(16===C){for(E=_+2;v>>=_,v-=_,0===n.have){e.msg="invalid bit length repeat",n.mode=30;break}q=n.lens[n.have-1],k=3+(3&x),x>>>=2,v-=2}else if(17===C){for(E=_+3;v>>=_)),x>>>=3,v-=3}else{for(E=_+7;v>>=_)),x>>>=7,v-=7}if(n.have+k>n.nlen+n.ndist){e.msg="invalid bit length repeat",n.mode=30;break}for(;k--;)n.lens[n.have++]=q}}if(30===n.mode)break;if(0===n.lens[256]){e.msg="invalid code -- missing end-of-block",n.mode=30;break}if(n.lenbits=9,W={bits:n.lenbits},A=a(l,n.lens,0,n.nlen,n.lencode,0,n.work,W),n.lenbits=W.bits,A){e.msg="invalid literal/lengths set",n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,W={bits:n.distbits},A=a(c,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,W),n.distbits=W.bits,A){e.msg="invalid distances set",n.mode=30;break}if(n.mode=20,6===t)break e;case 20:n.mode=21;case 21:if(6<=b&&258<=w){e.next_out=g,e.avail_out=w,e.next_in=m,e.avail_in=b,n.hold=x,n.bits=v,o(e,S),g=e.next_out,O=e.output,w=e.avail_out,m=e.next_in,f=e.input,b=e.avail_in,x=n.hold,v=n.bits,12===n.mode&&(n.back=-1);break}for(n.back=0;Z=(j=n.lencode[x&(1<>>16&255,C=65535&j,!((_=j>>>24)<=v);){if(0===b)break e;b--,x+=f[m++]<>X)])>>>16&255,C=65535&j,!(X+(_=j>>>24)<=v);){if(0===b)break e;b--,x+=f[m++]<>>=X,v-=X,n.back+=X}if(x>>>=_,v-=_,n.back+=_,n.length=C,0===Z){n.mode=26;break}if(32&Z){n.back=-1,n.mode=12;break}if(64&Z){e.msg="invalid literal/length code",n.mode=30;break}n.extra=15&Z,n.mode=22;case 22:if(n.extra){for(E=n.extra;v>>=n.extra,v-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;Z=(j=n.distcode[x&(1<>>16&255,C=65535&j,!((_=j>>>24)<=v);){if(0===b)break e;b--,x+=f[m++]<>X)])>>>16&255,C=65535&j,!(X+(_=j>>>24)<=v);){if(0===b)break e;b--,x+=f[m++]<>>=X,v-=X,n.back+=X}if(x>>>=_,v-=_,n.back+=_,64&Z){e.msg="invalid distance code",n.mode=30;break}n.offset=C,n.extra=15&Z,n.mode=24;case 24:if(n.extra){for(E=n.extra;v>>=n.extra,v-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg="invalid distance too far back",n.mode=30;break}n.mode=25;case 25:if(0===w)break e;if(k=S-w,n.offset>k){if((k=n.offset-k)>n.whave&&n.sane){e.msg="invalid distance too far back",n.mode=30;break}P=k>n.wnext?(k-=n.wnext,n.wsize-k):n.wnext-k,k>n.length&&(k=n.length),T=n.window}else T=O,P=g-n.offset,k=n.length;for(wb?(x=W[E+u[$]],Y[R+u[$]]):(x=96,0),f=1<>_)+(O-=f)]=w<<24|x<<16|v|0,0!==O;);for(f=1<>=1;if(0!==f?(X&=f-1,X+=f):X=0,$++,0==--q[S]){if(S===k)break;S=t[n+u[$]]}if(P>>7)]}function W(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function E(e,t,n){e.bi_valid>p-n?(e.bi_buf|=t<>p-e.bi_valid,e.bi_valid+=n-p):(e.bi_buf|=t<>>=1,n<<=1,0<--t;);return n>>>1}function D(e,t,n){var i,r,s=new Array(O+1),o=0;for(i=1;i<=O;i++)s[i]=o=o+n[i-1]<<1;for(r=0;r<=t;r++){var a=e[2*r+1];0!==a&&(e[2*r]=z(s[a]++,a))}}function U(e){var t;for(t=0;t>1;1<=n;n--)M(e,s,n);for(r=l;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],M(e,s,1),i=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=i,s[2*r]=s[2*n]+s[2*i],e.depth[r]=(e.depth[n]>=e.depth[i]?e.depth[n]:e.depth[i])+1,s[2*n+1]=s[2*i+1]=r,e.heap[1]=r++,M(e,s,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,i,r,s,o,a,l=t.dyn_tree,c=t.max_code,h=t.stat_desc.static_tree,u=t.stat_desc.has_stree,d=t.stat_desc.extra_bits,p=t.stat_desc.extra_base,m=t.stat_desc.max_length,g=0;for(s=0;s<=O;s++)e.bl_count[s]=0;for(l[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n>=7;i>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return r;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return s;for(t=32;t>>3,(a=e.static_len+3+7>>>3)<=o&&(o=a)):o=a=n+5,n+4<=o&&-1!==t?H(e,t,n,i):4===e.strategy||a===o?(E(e,2+(i?1:0),3),G(e,Q,k)):(E(e,4+(i?1:0),3),function(e,t,n,i){var r;for(E(e,t-257,5),E(e,n-1,5),E(e,i-4,4),r=0;r>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(T[n]+c+1)]++,e.dyn_dtree[2*A(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){E(e,2,3),j(e,g,Q),function(e){16===e.bi_valid?(W(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,n){(function(e){!function(e,t){if(!e.setImmediate){var n,i,r,s,o=1,a={},l=!1,c=e.document,h=Object.getPrototypeOf&&Object.getPrototypeOf(e);h=h&&h.setTimeout?h:e,n="[object process]"==={}.toString.call(e.process)?function(e){process.nextTick((function(){d(e)}))}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage("","*"),e.onmessage=n,t}}()?(s="setImmediate$"+Math.random()+"$",e.addEventListener?e.addEventListener("message",f,!1):e.attachEvent("onmessage",f),function(t){e.postMessage(s+t,"*")}):e.MessageChannel?((r=new MessageChannel).port1.onmessage=function(e){d(e.data)},function(e){r.port2.postMessage(e)}):c&&"onreadystatechange"in c.createElement("script")?(i=c.documentElement,function(e){var t=c.createElement("script");t.onreadystatechange=function(){d(e),t.onreadystatechange=null,i.removeChild(t),t=null},i.appendChild(t)}):function(e){setTimeout(d,0,e)},h.setImmediate=function(e){"function"!=typeof e&&(e=new Function(""+e));for(var t=new Array(arguments.length-1),i=0;i=t.status}function r(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(n){var t=document.createEvent("MouseEvents");t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var s="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof et&&et.global===et?et:void 0,o=s.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),a=s.saveAs||("object"!=typeof window||window!==s?function(){}:"download"in HTMLAnchorElement.prototype&&!o?function(e,t,o){var a=s.URL||s.webkitURL,l=document.createElement("a");t=t||e.name||"download",l.download=t,l.rel="noopener","string"==typeof e?(l.href=e,l.origin===location.origin?r(l):i(l.href)?n(e,t,o):r(l,l.target="_blank")):(l.href=a.createObjectURL(e),setTimeout((function(){a.revokeObjectURL(l.href)}),4e4),setTimeout((function(){r(l)}),0))}:"msSaveOrOpenBlob"in navigator?function(e,s,o){if(s=s||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(t(e,o),s);else if(i(e))n(e,s,o);else{var a=document.createElement("a");a.href=e,a.target="_blank",setTimeout((function(){r(a)}))}}:function(e,t,i,r){if((r=r||open("","_blank"))&&(r.document.title=r.document.body.innerText="downloading..."),"string"==typeof e)return n(e,t,i);var a="application/octet-stream"===e.type,l=/constructor/i.test(s.HTMLElement)||s.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||a&&l||o)&&"undefined"!=typeof FileReader){var h=new FileReader;h.onloadend=function(){var e=h.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),r?r.location.href=e:location=e,r=null},h.readAsDataURL(e)}else{var u=s.URL||s.webkitURL,d=u.createObjectURL(e);r?r.location=d:location.href=d,r=null,setTimeout((function(){u.revokeObjectURL(d)}),4e4)}});s.saveAs=a.saveAs=a,e.exports=a}()}));class st{constructor(){this._nextId=0,this._subscribers=new Map}subscribe(e){const t=this._nextId++;return this._subscribers.set(t,e),()=>this._subscribers.delete(t)}notify(e){this._subscribers.forEach((t=>t(e)))}}const ot={onExplorerSectionsChange:new st,onViewedFileChange:new st,onSearchTermChange:new st,onUserClickedFile:new st,onPackageNameChange:new st,onPackageUnloaded:new st};var at,lt;!function(e){e[e.Unknown=0]="Unknown",e[e.Corrupt=1]="Corrupt",e[e.StringTable=2]="StringTable",e[e.Image=3]="Image",e[e.Deleted=4]="Deleted",e[e.PlainText=5]="PlainText"}(at||(at={})),function(e){e.toggleLightTheme=function(e,t){t&&(document.documentElement.classList.add("theme-transition"),window.setTimeout((()=>{document.documentElement.classList.remove("theme-transition")}),500)),e?document.documentElement.classList.remove("dark"):document.documentElement.classList.add("dark")},e.toggleBooleanAttribute=function(e,t){document.documentElement.setAttribute(e,t?"true":"false")}}(lt||(lt={}));var ct=lt;class ht{constructor(e,t,n=[]){this.name=e,this.defaultValue=t,this._onChangeCallbacks=n}get(e){if(void 0===this._cachedValue){const t=localStorage.getItem("s:"+e);this._cachedValue=t?this._parseValue(t):this.defaultValue}return this._cachedValue}set(e,t){this._cachedValue=t,localStorage.setItem("s:"+e,this._stringifyValue(t)),this._onChange(t)}addCallback(e){this._onChangeCallbacks.push(e)}_onChange(e){this._onChangeCallbacks.forEach((t=>t(e)))}}class ut extends ht{constructor(e,t=!1,n){super(e,t,n)}_parseValue(e){return"true"===e}_stringifyValue(e){return e?"true":"false"}}class dt extends ht{constructor(e,t,n){super(e,t??new Set,n)}_parseValue(e){return new Set(JSON.parse(e))}_stringifyValue(e){return JSON.stringify(Array.from(e))}}const ft=function(e){const t={};for(const n in e){const i=e[n];t[n]=new i.cls(n,i.defaultValue,i.callbacks)}return new Proxy(t,{get:(e,t)=>e[t].get(t),set:(e,t,n)=>(e[t].set(t,n),Ot.notifySubscribers(t,n),!0)})}({isLightTheme:{cls:ut,callbacks:[e=>ct.toggleLightTheme(e,!0)],defaultValue:!1},suppressedDiagnosticLevels:{cls:dt,defaultValue:new Set},suppressedDiagnosticCodes:{cls:dt,defaultValue:new Set},showDiagnosticCodesOnUi:{cls:ut,defaultValue:!1},expandFoldersByDefault:{cls:ut,defaultValue:!1},formatXmlSpaces:{cls:class extends ht{constructor(e,t=0,n){super(e,t,n)}_parseValue(e){const t=parseInt(e);return Number.isNaN(t)?this.defaultValue:t}_stringifyValue(e){return e.toString()}},defaultValue:2}});const Ot=new class{constructor(){this._nextId=0,this._subscriptions=new Map}subscribe(e,t){const n=this._nextId++;return this._subscriptions.set(n,{setting:e,fn:t}),()=>this._subscriptions.delete(n)}notifySubscribers(e,t){this._subscriptions.forEach((n=>{n.setting===e&&n.fn(t)}))}};var pt;!function(e){e.countExact=function(e,t){return t.filter((t=>t.level===e)).length},e.countAtLeast=function(e,t){return t.filter((t=>t.level>=e)).length},e.passesSettings=function(e){return!ft.suppressedDiagnosticLevels.has(e.level)&&!ft.suppressedDiagnosticCodes.has(e.code)},e.sorter=function(e,t){const n=t.level-e.level;return 0!==n?n:e.code>t.code?1:e.codet[e]n[e]?1:0}function vt(...e){const t=[];return e.forEach((e=>t.push(...e))),t}!function(e){e[e.Unspecified=0]="Unspecified",e[e.Tuning=1]="Tuning",e[e.StringTable=2]="StringTable"}(mt||(mt={})),function(e){e.isActive=function(e,t){return e.containedIds.has(t)},e.passesSearch=function(e,t){return t=t?.trim(),!t||e.filterName.toLowerCase().includes(t.toLowerCase())},e.allDiagnostics=function(e){let t;switch(e.displayType){case mt.StringTable:t=[],e.localeChoices.forEach((e=>{t.push(...e.diagnostics)}));break;case mt.Tuning:t=[...e.tuningInfo.diagnostics,...e.simDataInfo?.diagnostics??[]];break;case mt.Unspecified:t=e.info.diagnostics}return t.filter((e=>bt.passesSettings(e))).sort(bt.sorter)}}(gt||(gt={}));const{models:yt,enums:St,formatting:$t}=window.S4TK,{DiagnosticLevel:Qt,ValidationSchema:kt}=window.S4TK.validation;async function Pt(e,t,n){const i=new Map;for(let n=0;n{const r=e.map((e=>function(e,t){let n=t.get(e.id);if(e.isDeleted)return{displayType:mt.Unspecified,filterName:n.displayName,containedIds:new Set([n.id]),defaultId:n.id,info:n};switch(e.schema){case kt.Tuning:{const i=t.get(e.pairedSimDataId),r=new Set([n.id]);return i&&r.add(i.id),{displayType:mt.Tuning,filterName:n.displayName,defaultId:n.id,containedIds:r,tuningInfo:n,simDataInfo:i}}case kt.StringTable:return{displayType:mt.StringTable,filterName:"String Table",defaultId:n.id,containedIds:new Set([n.id,...e.otherLocaleIds]),sharedResourceKey:Xt(e,!0),localeChoices:[n.id,...e.otherLocaleIds].map((e=>t.get(e))),chosenLocaleIndex:0}}return{displayType:mt.Unspecified,filterName:n.displayName,containedIds:new Set([n.id]),defaultId:n.id,info:n}}(e,t))).sort(xt("filterName"));n.push({title:i,cells:r,collapsed:a})})),n.sort(xt("title"))}async function Tt(e){try{if(e.isDeleted)return{renderType:at.Deleted,id:e.id,displayName:"Deleted Record",resourceKey:Xt(e),diagnostics:Ct(e),extension:"binary",downloadData:e.resource.getBuffer()};switch(e.schema){case kt.Tuning:return _t("Tuning",e)??function(e){const t=e.resource;return{renderType:at.PlainText,id:e.id,displayName:e.domValid?t.root.name??"Unnamed Tuning":"Invalid Tuning",resourceKey:Xt(e),diagnostics:Ct(e),language:"xml",textContent:t.content,extension:"xml",downloadData:e.resource.getBuffer(),tdescMetadata:e.domValid?{class:t.root.attributes.c,type:t.root.attributes.i,module:t.root.attributes.m}:void 0}}(e);case kt.SimData:return _t("SimData",e)??function(e){const t=e.resource,n=t.toXmlDocument().toXml();return{renderType:at.PlainText,id:e.id,displayName:t.instance.name??"Unnamed SimData",resourceKey:Xt(e),diagnostics:Ct(e),language:"xml",textContent:n,extension:"SimData.xml",downloadData:window.NodeJS.Buffer.from(n)}}(e);case kt.StringTable:return _t("String Table",e)??function(e){const t=e.resource,n=St.StringTableLocale[e.locale]??"Unknown";return{renderType:at.StringTable,id:e.id,displayName:`${n}`,resourceKey:Xt(e),diagnostics:Ct(e),locale:e.locale,entries:t.entries,extension:"stbl",downloadData:e.resource.getBuffer()}}(e);default:return await async function(e){switch(e.key.type){case St.BinaryResourceType.DdsImage:case St.BinaryResourceType.DstImage:return await async function(e){const t=e.key.type===St.BinaryResourceType.DdsImage?"DDS Image":"DST Image";try{const n=yt.DdsImageResource.from(e.resource.getBuffer()).image.toJimp(),i="data:image/png;base64,"+(await n.getBufferAsync("image/png")).toString("base64");return{renderType:at.Image,id:e.id,displayName:t,resourceKey:Xt(e),diagnostics:Ct(e),pngBase64:i,width:n.getWidth(),height:n.getHeight(),extension:"dds",downloadData:e.resource.getBuffer()}}catch(n){return console.error(`Failed to parse DDS image [${n}]`),{renderType:at.Corrupt,id:e.id,displayName:`${t} (Unparsable)`,resourceKey:Xt(e),diagnostics:Ct(e),extension:"dds",downloadData:e.resource.getBuffer()}}}(e);case St.BinaryResourceType.ObjectDefinition:return function(e){try{const t=yt.ObjectDefinitionResource.from(e.resource.getBuffer());return{renderType:at.PlainText,id:e.id,displayName:t.properties.name??"Unnamed Object Definition",resourceKey:Xt(e),diagnostics:Ct(e),language:"json",textContent:JSON.stringify(t.properties,((e,t)=>"bigint"==typeof t||"number"==typeof t?t.toString():t),2),extension:"binary",downloadData:e.resource.getBuffer()}}catch(t){return console.error(`Failed to parse object definition [${t}]`),{renderType:at.Corrupt,id:e.id,displayName:"Object Definition (Unparsable)",resourceKey:Xt(e),diagnostics:Ct(e),extension:"binary",downloadData:e.resource.getBuffer()}}}(e);case St.BinaryResourceType.PngImage:return await async function(e){try{const t="data:image/png;base64,"+e.resource.getBuffer().toString("base64");return{renderType:at.Image,id:e.id,displayName:"PNG Image",resourceKey:Xt(e),diagnostics:Ct(e),pngBase64:t,extension:"png",downloadData:e.resource.getBuffer()}}catch(t){return console.error(`Failed to parse PNG image [${t}]`),{renderType:at.Corrupt,id:e.id,displayName:"PNG Image (Unparsable)",resourceKey:Xt(e),diagnostics:Ct(e),extension:"png",downloadData:e.resource.getBuffer()}}}(e)}if(e.modelLoaded){if(e.resource instanceof yt.XmlResource)return{renderType:at.PlainText,id:e.id,displayName:"Tuning (Suspected)",resourceKey:Xt(e),diagnostics:Ct(e),language:"xml",textContent:e.resource.content,extension:"xml",downloadData:e.resource.getBuffer()};if(e.resource instanceof yt.SimDataResource){const t=e.resource.toXmlDocument().toXml();return{renderType:at.PlainText,id:e.id,displayName:"SimData (Suspected)",resourceKey:Xt(e),diagnostics:Ct(e),language:"xml",textContent:t,extension:"SimData.xml",downloadData:window.NodeJS.Buffer.from(t)}}if(e.resource instanceof yt.StringTableResource)return{renderType:at.StringTable,id:e.id,displayName:"String Table (Suspected)",resourceKey:Xt(e,!0),diagnostics:Ct(e),locale:St.StringTableLocale.getLocale(e.key.instance),entries:e.resource.entries.map((({key:e,value:t})=>({key:e,value:t}))),extension:"stbl",downloadData:e.resource.getBuffer()}}return{renderType:at.Unknown,id:e.id,displayName:e.key.type in St.BinaryResourceType?wt(St.BinaryResourceType[e.key.type]):"Unknown",resourceKey:Xt(e),diagnostics:Ct(e),extension:"binary",downloadData:e.resource.getBuffer()}}(e)}}catch(t){return e.diagnostics.push({ownerId:e.id,code:"Unknown",level:Qt.Warning,message:"Something unexpected went wrong while loading this resource. It is possible that the issue is with the website, not the package. Please report this."}),{renderType:at.Corrupt,id:e.id,displayName:"Unexpected Error",resourceKey:Xt(e),diagnostics:Ct(e),extension:"binary",downloadData:e.resource.getBuffer()}}}function _t(e,t){if(!t.modelLoaded)return{renderType:at.Corrupt,id:t.id,displayName:`Corrupt ${e}`,resourceKey:Xt(t),diagnostics:Ct(t),extension:"binary",downloadData:t.resource.getBuffer()}}function Zt(e){switch(e.schema){case kt.SimData:if(void 0!==e.pairedTuningId)return;return`${wt(St.SimDataGroup[e.key.group]??"Unknown")} SimData`;case kt.StringTable:return e.primary?"String Table":void 0;case kt.Tuning:if(e.key.type===St.TuningResourceType.Tuning)return"Module Tuning";return`${wt(St.TuningResourceType[e.key.type]??"Unknown")} Tuning`}if(!(e.key.type in St.BinaryResourceType))return"Unknown";switch(e.key.type){case St.BinaryResourceType.DdsImage:case St.BinaryResourceType.DstImage:case St.BinaryResourceType.ObjectDefinition:case St.BinaryResourceType.PngImage:return wt(St.BinaryResourceType[e.key.type]);default:return"Unsupported"}}function Ct(e){return e.diagnostics.sort(bt.sorter)}function Xt(e,t=!1){if(t){const t=St.StringTableLocale.getInstanceBase(e.key.instance);return`${$t.formatResourceType(e.key.type)}-${$t.formatResourceGroup(e.key.group)}-XX${$t.formatAsHexString(t,14,!1)}`}return $t.formatResourceKey(e.key,"-")}const{validatePackageBuffer:Yt}=window.S4TK.validation;const Rt=new class{constructor(){this._fileInfoMap=new Map,this._viewedFileId=0}get _viewedFile(){return this._fileInfoMap.get(this._viewedFileId)}async loadPackage(e,t){this.unloadPackage();try{const n=Yt(e);return!(n.length<1)&&(await Pt(n,this._fileInfoMap,this._explorerSections),this._cachedPackageName=t,this._cachedPackageBuffer=e,this._viewedFileId=this._explorerSections[0]?.cells[0]?.defaultId??0,!0)}catch(e){return console.error(e),!1}finally{this.requestRefresh()}}unloadPackage(e){this._cachedPackageName=null,this._cachedPackageBuffer=null,this._viewedFileId=0,this._fileInfoMap.clear(),this._explorerSections=[],this._searchTerm="",e?.requestRefresh&&(this.requestRefresh(),ot.onPackageUnloaded.notify())}getFile(e){return this._fileInfoMap.get(e)}downloadFile(e){const t=this.getFile(e),n=t.resourceKey.replace(/-/g,"_"),i=t.displayName.replace(/[^a-z0-9_-]/gi,"_");t&&rt.saveAs(new Blob([t.downloadData]),`${n}.${i}.${t.extension}`)}downloadCurrentFile(){this.downloadFile(this._viewedFileId)}async downloadAllFiles(){const e=new it;this._fileInfoMap.forEach((t=>{const n=`${t.resourceKey.replace(/-/g,"_")}.${t.displayName.replace(/[^a-z0-9_-]/gi,"_")}.${t.extension}`;e.file(n,t.downloadData)}));const t=await e.generateAsync({type:"blob"});rt.saveAs(t,this._cachedPackageName.replace(".package",".zip"))}downloadCurrentPackage(){this._cachedPackageBuffer&&rt.saveAs(new Blob([this._cachedPackageBuffer]),this._cachedPackageName??"Download.package")}requestFile(e,t){this._fileInfoMap.has(e)?(this._viewedFileId=e,ot.onViewedFileChange.notify(this._viewedFile),t&&ot.onUserClickedFile.notify()):console.error(`Cannot switch to entry ${e} because it does not exist.`)}requestRefresh(){ot.onExplorerSectionsChange.notify(this._explorerSections),ot.onViewedFileChange.notify(this._viewedFile),ot.onSearchTermChange.notify(this._searchTerm),ot.onPackageNameChange.notify(this._cachedPackageName)}requestSearch(e){this._searchTerm=e??"",ot.onSearchTermChange.notify(e)}};function qt(t){let n,i,r,s,o;return{c(){n=P("div"),i=P("h3"),r=T(t[0]),s=_(),o=P("hr"),X(i,"class","mt-0 mb-2 font-bold text-xl"),X(o,"class","bg-accent-primary-light dark:bg-accent-primary-dark m-0 border-none svelte-1hlby7e"),X(n,"class","text-left inline-block")},m(e,t){$(e,n,t),v(n,i),v(i,r),v(n,s),v(n,o)},p(e,[t]){1&t&&R(r,e[0])},i:e,o:e,d(e){e&&Q(n)}}}function At(e,t,n){let{title:i}=t;return e.$$set=e=>{"title"in e&&n(0,i=e.title)},[i]}class Wt extends Ye{constructor(e){super(),Xe(this,e,At,qt,a,{title:0})}}function Et(t){let n,i,r,s,o,a,l,c,h,u;return{c(){n=P("div"),i=P("p"),r=T(t[1]),s=_(),o=P("label"),a=P("input"),l=_(),c=P("span"),X(i,"class","text-sm mr-4"),X(a,"type","checkbox"),X(a,"class","opacity-0 w-0 h-0 svelte-107vzwt"),X(c,"class","slider absolute top-0 right-0 bottom-0 left-0 cursor-pointer svelte-107vzwt"),X(o,"class","switch relative inline-block svelte-107vzwt"),X(n,"class","w-full flex items-center justify-between")},m(e,d){$(e,n,d),v(n,i),v(i,r),v(n,s),v(n,o),v(o,a),a.checked=t[0],v(o,l),v(o,c),h||(u=C(a,"change",t[2]),h=!0)},p(e,[t]){2&t&&R(r,e[1]),1&t&&(a.checked=e[0])},i:e,o:e,d(e){e&&Q(n),h=!1,u()}}}function jt(e,t,n){let{label:i}=t,{checked:r}=t;return e.$$set=e=>{"label"in e&&n(1,i=e.label),"checked"in e&&n(0,r=e.checked)},[r,i,function(){r=this.checked,n(0,r)}]}class zt extends Ye{constructor(e){super(),Xe(this,e,jt,Et,a,{label:1,checked:0})}}function Dt(e,t,n){const i=e.slice();return i[5]=t[n],i}function Ut(t){let n,i,r,s,o,a,l,c,h,u=t[5]+"",d=t[1].getBrief(t[5])+"";return{c(){n=P("li"),i=P("input"),r=_(),s=P("label"),o=P("span"),a=T(u),l=T(": "),c=T(d),h=_(),X(i,"id","setting-code-"+t[5]),X(i,"name",t[5]),X(i,"type","checkbox"),i.checked=t[3](t[5]),X(o,"class","monospace text-subtle"),X(s,"for","setting-code-"+t[5]),X(s,"class","text-sm")},m(e,t){$(e,n,t),v(n,i),v(n,r),v(n,s),v(s,o),v(o,a),v(s,l),v(s,c),v(n,h)},p:e,d(e){e&&Q(n)}}}function Vt(t){let n,i,r,s,o,a=t[2],l=[];for(let e=0;e{"title"in e&&n(0,r=e.title),"codePrefix"in e&&n(4,s=e.codePrefix)},[r,i,o,function(e){return!ft.suppressedDiagnosticCodes.has(e)},s]}class Mt extends Ye{constructor(e){super(),Xe(this,e,It,Vt,a,{title:0,codePrefix:4})}}function Gt(t){let n,i;return{c(){n=P("img"),c(n.src,i="./assets/diagnostics/"+t[2]+".svg")||X(n,"src",i),X(n,"alt",t[1]),X(n,"class","h-4 w-4"),E(n,"inline",t[0])},m(e,t){$(e,n,t)},p(e,[t]){4&t&&!c(n.src,i="./assets/diagnostics/"+e[2]+".svg")&&X(n,"src",i),2&t&&X(n,"alt",e[1]),1&t&&E(n,"inline",e[0])},i:e,o:e,d(e){e&&Q(n)}}}function Bt(e,t,n){let i,r;const{DiagnosticLevel:s}=window.S4TK.validation;let{level:o}=t,{inline:a=!1}=t,l=ft.isLightTheme?"light":"dark";const c=[Ot.subscribe("isLightTheme",(e=>{n(4,l=e?"light":"dark")}))];return L((()=>{c.forEach((e=>e()))})),e.$$set=e=>{"level"in e&&n(3,o=e.level),"inline"in e&&n(0,a=e.inline)},e.$$.update=()=>{8&e.$$.dirty&&n(1,i=s[o].toLowerCase()),26&e.$$.dirty&&n(2,r=o===s.Warning?`warning-${l}`:i)},[a,i,r,o,l]}class Nt extends Ye{constructor(e){super(),Xe(this,e,Bt,Gt,a,{level:3,inline:0})}}function Lt(e){let t,n,i,r,s,o,a,l,c,h,u,d;return s=new Nt({props:{level:e[0],inline:!0}}),{c(){t=P("div"),n=P("input"),i=_(),r=P("label"),_e(s.$$.fragment),o=_(),a=P("p"),l=T(e[2]),X(n,"id",e[4]),X(n,"name",e[2]),X(n,"type","checkbox"),X(a,"class",c="monospace text-sm diagnostics-text inline "+e[1]),X(r,"for",e[4]),X(r,"class","whitespace-nowrap select-none"),X(t,"class","whitespace-nowrap")},m(c,f){$(c,t,f),v(t,n),n.checked=e[3],v(t,i),v(t,r),Ze(s,r,null),v(r,o),v(r,a),v(a,l),h=!0,u||(d=C(n,"change",e[5]),u=!0)},p(e,[t]){(!h||16&t)&&X(n,"id",e[4]),(!h||4&t)&&X(n,"name",e[2]),8&t&&(n.checked=e[3]);const i={};1&t&&(i.level=e[0]),s.$set(i),(!h||4&t)&&R(l,e[2]),(!h||2&t&&c!==(c="monospace text-sm diagnostics-text inline "+e[1]))&&X(a,"class",c),(!h||16&t)&&X(r,"for",e[4])},i(e){h||(be(s.$$.fragment,e),h=!0)},o(e){we(s.$$.fragment,e),h=!1},d(e){e&&Q(t),Ce(s),u=!1,d()}}}function Ft(e,t,n){let i,r,s;const{DiagnosticLevel:o}=window.S4TK.validation;let{level:a}=t,l=!ft.suppressedDiagnosticLevels.has(a);return e.$$set=e=>{"level"in e&&n(0,a=e.level)},e.$$.update=()=>{1&e.$$.dirty&&n(2,i=o[a]),4&e.$$.dirty&&n(1,r=i.toLowerCase()),2&e.$$.dirty&&n(4,s=`setting-level-${r}`)},[a,r,i,l,s,function(){l=this.checked,n(3,l)}]}class Ht extends Ye{constructor(e){super(),Xe(this,e,Ft,Lt,a,{level:0})}}function Kt(e){let t,n,i,r,s,o,a,l,c,h,u,d,f,O,p,m,g,b,w,x,y,S,k,T,Z,R,A,W,E,j,z,D,U,V,I,M,G;function B(t){e[5](t)}let N={label:"Show diagnostic codes in bottom panel"};function L(t){e[6](t)}void 0!==e[1]&&(N.checked=e[1]),i=new zt({props:N}),K.push((()=>Te(i,"checked",B)));let F={label:"Expand file explorer folders by default"};return void 0!==e[2]&&(F.checked=e[2]),o=new zt({props:F}),K.push((()=>Te(o,"checked",L))),b=new Ht({props:{level:e[3].Error}}),x=new Ht({props:{level:e[3].Warning}}),S=new Ht({props:{level:e[3].Info}}),W=new Mt({props:{title:"General",codePrefix:"GEN"}}),j=new Mt({props:{title:"Tuning",codePrefix:"TUN"}}),D=new Mt({props:{title:"SimData",codePrefix:"DAT"}}),V=new Mt({props:{title:"String Table",codePrefix:"STB"}}),{c(){t=P("div"),n=P("div"),_e(i.$$.fragment),s=_(),_e(o.$$.fragment),l=_(),c=P("div"),h=P("label"),h.textContent="Spaces in formatted XML",u=_(),d=P("input"),f=_(),O=P("div"),p=P("h2"),p.textContent="Enabled Diagnostic Levels",m=_(),g=P("div"),_e(b.$$.fragment),w=_(),_e(x.$$.fragment),y=_(),_e(S.$$.fragment),k=_(),T=P("div"),Z=P("h2"),Z.textContent="Enabled Diagnostics",R=_(),A=P("div"),_e(W.$$.fragment),E=_(),_e(j.$$.fragment),z=_(),_e(D.$$.fragment),U=_(),_e(V.$$.fragment),X(h,"class","text-sm"),X(h,"for","setting-xml-spaces"),X(d,"id","setting-xml-spaces"),X(d,"class","px-2 w-16 bg-transparent rounded border border-solid border-gray-600 dark:border-white"),X(d,"type","number"),X(d,"min","1"),X(d,"max","8"),X(c,"class","w-full flex justify-between"),X(n,"class","w-full flex flex-col gap-2"),X(p,"class","mb-2 font-bold"),X(g,"class","flex flex-wrap gap-4"),X(O,"class","text-left w-full"),X(Z,"class","mb-2 font-bold"),X(A,"class","w-full flex flex-col gap-4 bg-gray-50 dark:bg-gray-900 p-2 rounded"),X(T,"class","text-left w-full"),X(t,"class","w-full h-full overflow-y-auto flex flex-col gap-6")},m(r,a){$(r,t,a),v(t,n),Ze(i,n,null),v(n,s),Ze(o,n,null),v(n,l),v(n,c),v(c,h),v(c,u),v(c,d),q(d,e[0]),v(t,f),v(t,O),v(O,p),v(O,m),v(O,g),Ze(b,g,null),v(g,w),Ze(x,g,null),v(g,y),Ze(S,g,null),v(t,k),v(t,T),v(T,Z),v(T,R),v(T,A),Ze(W,A,null),v(A,E),Ze(j,A,null),v(A,z),Ze(D,A,null),v(A,U),Ze(V,A,null),I=!0,M||(G=C(d,"input",e[7]),M=!0)},p(e,[t]){const n={};!r&&2&t&&(r=!0,n.checked=e[1],oe((()=>r=!1))),i.$set(n);const s={};!a&&4&t&&(a=!0,s.checked=e[2],oe((()=>a=!1))),o.$set(s),1&t&&Y(d.value)!==e[0]&&q(d,e[0])},i(e){I||(be(i.$$.fragment,e),be(o.$$.fragment,e),be(b.$$.fragment,e),be(x.$$.fragment,e),be(S.$$.fragment,e),be(W.$$.fragment,e),be(j.$$.fragment,e),be(D.$$.fragment,e),be(V.$$.fragment,e),I=!0)},o(e){we(i.$$.fragment,e),we(o.$$.fragment,e),we(b.$$.fragment,e),we(x.$$.fragment,e),we(S.$$.fragment,e),we(W.$$.fragment,e),we(j.$$.fragment,e),we(D.$$.fragment,e),we(V.$$.fragment,e),I=!1},d(e){e&&Q(t),Ce(i),Ce(o),Ce(b),Ce(x),Ce(S),Ce(W),Ce(j),Ce(D),Ce(V),M=!1,G()}}}function Jt(e,t,n){const{DiagnosticCode:i,DiagnosticLevel:r}=window.S4TK.validation;let s=ft.formatXmlSpaces,o=ft.showDiagnosticCodesOnUi,a=ft.expandFoldersByDefault;return[s,o,a,r,()=>{ft.formatXmlSpaces=Math.min(8,Math.max(1,s)),ft.showDiagnosticCodesOnUi=o,ft.expandFoldersByDefault=a,function(){try{const e=new Set;["Error","Warning","Info"].forEach((t=>{document.getElementsByName(t)[0].checked||e.add(r[t])})),ft.suppressedDiagnosticLevels=e}catch(e){console.error(e)}}(),function(){try{const e=new Set;i.getAll().forEach((t=>{const n=document.getElementsByName(t);if(!n?.length)return;n[0].checked||e.add(t)})),ft.suppressedDiagnosticCodes=e}catch(e){console.error(e)}}()},function(e){o=e,n(1,o)},function(e){a=e,n(2,a)},function(){s=Y(this.value),n(0,s)}]}class en extends Ye{constructor(e){super(),Xe(this,e,Jt,Kt,a,{save:4})}get save(){return this.$$.ctx[4]}}function tn(t){let n,i,r,s,o,a,l,h,u,d,f=t[0]?"Light":"Dark";return{c(){n=P("button"),i=P("img"),o=_(),a=P("p"),l=T(f),h=T(" Mode"),c(i.src,r="./assets/icons/"+(t[0]?"sunny":"moon")+"-outline.svg")||X(i,"src",r),X(i,"alt",s=t[0]?"sun":"moon"),X(i,"class","svg h-4 w-4 inline"),X(a,"class","ml-2 text-sm inline"),X(n,"title","Toggle Theme"),X(n,"class","tint-on-hover")},m(e,r){$(e,n,r),v(n,i),v(n,o),v(n,a),v(a,l),v(a,h),u||(d=C(n,"click",t[1]),u=!0)},p(e,[t]){1&t&&!c(i.src,r="./assets/icons/"+(e[0]?"sunny":"moon")+"-outline.svg")&&X(i,"src",r),1&t&&s!==(s=e[0]?"sun":"moon")&&X(i,"alt",s),1&t&&f!==(f=e[0]?"Light":"Dark")&&R(l,f)},i:e,o:e,d(e){e&&Q(n),u=!1,d()}}}function nn(e,t,n){let i=ft.isLightTheme;return[i,function(){ft.isLightTheme=!ft.isLightTheme,n(0,i=ft.isLightTheme)}]}class rn extends Ye{constructor(e){super(),Xe(this,e,nn,tn,a,{})}}function sn(e){let t,n,i,r,a,l,c,h,u,d,f,O,p,m,g,b,w;function x(t){e[3](t)}i=new Wt({props:{title:"Settings"}});let y={};return void 0!==e[1]&&(y.save=e[1]),a=new en({props:y}),K.push((()=>Te(a,"save",x))),d=new rn({}),{c(){t=P("div"),n=P("div"),_e(i.$$.fragment),r=_(),_e(a.$$.fragment),c=_(),h=P("div"),u=P("div"),_e(d.$$.fragment),f=_(),O=P("button"),O.textContent="Cancel",p=_(),m=P("button"),m.textContent="Save",X(u,"class","mr-auto my-auto"),X(O,"class","px-3 py-1 rounded border border-solid border-gray-800 text-gray-800 hover:bg-gray-800 hover:text-white dark:border-white dark:text-white dark:hover:bg-white dark:hover:text-black"),X(m,"class","px-3 py-1 rounded bg-green-600 text-gray-100 hover:bg-green-700 dark:bg-green-400 dark:text-gray-800 hover:dark:bg-green-300"),X(h,"class","w-full flex justify-end gap-4"),X(t,"class","w-full max-w-lg h-2/3 mx-2 my-8 p-4 overflow-hidden bg-gray-100 dark:bg-gray-800 rounded-xl drop-shadow-md flex flex-col gap-4")},m(s,l){$(s,t,l),v(t,n),Ze(i,n,null),v(t,r),Ze(a,t,null),v(t,c),v(t,h),v(h,u),Ze(d,u,null),v(h,f),v(h,O),v(h,p),v(h,m),g=!0,b||(w=[C(O,"click",(function(){o(e[0])&&e[0].apply(this,arguments)})),C(m,"click",e[2])],b=!0)},p(t,[n]){e=t;const i={};!l&&2&n&&(l=!0,i.save=e[1],oe((()=>l=!1))),a.$set(i)},i(e){g||(be(i.$$.fragment,e),be(a.$$.fragment,e),be(d.$$.fragment,e),g=!0)},o(e){we(i.$$.fragment,e),we(a.$$.fragment,e),we(d.$$.fragment,e),g=!1},d(e){e&&Q(t),Ce(i),Ce(a),Ce(d),b=!1,s(w)}}}function on(e,t,n){let i,{onClose:r}=t;return e.$$set=e=>{"onClose"in e&&n(0,r=e.onClose)},[r,i,function(){i(),Rt.requestRefresh(),r()},function(e){i=e,n(1,i)}]}class an extends Ye{constructor(e){super(),Xe(this,e,on,sn,a,{onClose:0})}}function ln(e){let t,n;return t=new Je({props:{$$slots:{default:[cn]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};65&n&&(i.$$scope={dirty:n,ctx:e}),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function cn(e){let t,n;return t=new an({props:{onClose:e[4]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.onClose=e[4]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function hn(t){let n,i,r,a,l,h,u,d,f,O,p,m,g,b,w,x,y=t[0]&&ln(t);return{c(){n=P("nav"),i=P("a"),r=P("img"),l=_(),h=P("h2"),u=T("S4TK Package "),d=T(t[1]),f=_(),O=P("div"),p=P("button"),p.innerHTML='settings',m=_(),y&&y.c(),g=Z(),c(r.src,a="./assets/s4tk-transparent.png")||X(r,"src","./assets/s4tk-transparent.png"),X(r,"alt","S4TK"),X(r,"class","h-5"),X(h,"class","font-bold"),X(i,"class","flex gap-2 items-center no-underline tint-on-hover whitespace-nowrap"),X(i,"href","/"),X(p,"title","Settings"),X(O,"class","flex gap-3 items-center"),X(n,"class","fixed top-0 left-0 right-0 h-10 z-10 px-4 flex justify-between gap-4 bg-gray-200 dark:bg-gray-950 bottom-shadow svelte-1vd52s4")},m(s,a){var c;$(s,n,a),v(n,i),v(i,r),v(i,l),v(i,h),v(h,u),v(h,d),v(n,f),v(n,O),v(O,p),$(s,m,a),y&&y.m(s,a),$(s,g,a),b=!0,w||(x=[(c=Me.call(null,i),c&&o(c.destroy)?c.destroy:e),C(p,"click",t[3])],w=!0)},p(e,[t]){(!b||2&t)&&R(d,e[1]),e[0]?y?(y.p(e,t),1&t&&be(y,1)):(y=ln(e),y.c(),be(y,1),y.m(g.parentNode,g)):y&&(me(),we(y,1,1,(()=>{y=null})),ge())},i(e){b||(be(y),b=!0)},o(e){we(y),b=!1},d(e){e&&Q(n),e&&Q(m),y&&y.d(e),e&&Q(g),w=!1,s(x)}}}function un(e,t,n){let i,r,s=!1;const o=[Ve.subscribe((e=>{n(2,r=e)}))];L((()=>{o.forEach((e=>e()))}));return e.$$.update=()=>{4&e.$$.dirty&&n(1,i="/generate"===r?"Generator":"/view"===r?"Viewer":"Tools")},[s,i,r,()=>n(0,s=!0),()=>n(0,s=!1)]}class dn extends Ye{constructor(e){super(),Xe(this,e,un,hn,a,{})}}function fn(t){let n;return{c(){n=P("footer"),n.innerHTML='

Created with by Frankk using Sims\n 4 Toolkit

\n

Frankk's Mods\n |\n Sims 4 Toolkit\n |\n Twitter\n |\n Patreon\n |\n Ko-fi\n |\n Discord

\n

The Sims™ and its plumbob icon are registered trademarks of Electronic\n Arts, Inc. (EA). Sims 4 Toolkit is not affiliated with or endorsed by\n EA.

\n

All icons on this website are supplied by\n Ionicons\n and\n GitHub Octicons.

\n

2023 © Frankk

',X(n,"class","relative w-full py-12 px-4 flex justify-center bg-gray-200 dark:bg-gray-900")},m(e,t){$(e,n,t)},p:e,i:e,o:e,d(e){e&&Q(n)}}}class On extends Ye{constructor(e){super(),Xe(this,e,null,fn,a,{})}}function pn(t){let n,i,r,s,o,a,l,h,u,d,f;return{c(){n=P("a"),i=P("div"),r=P("img"),o=_(),a=P("div"),l=P("h2"),h=T(t[0]),u=_(),d=P("p"),f=T(t[1]),c(r.src,s="./assets/screenshots/"+t[3])||X(r,"src",s),X(r,"alt","Package Viewer"),X(r,"class","w-full h-full rounded-lg shadow-lg"),X(l,"class","text-white font-bold text-2xl whitespace-nowrap"),X(d,"class","text-white whitespace-nowrap mt-2"),X(a,"class","centered-in-relative svelte-1a3x1h9"),X(i,"class","up-on-hover relative top-0 text-white text-center w-full sm:w-80 svelte-1a3x1h9"),X(n,"href",t[2]),X(n,"class","max-w-fit")},m(e,t){$(e,n,t),v(n,i),v(i,r),v(i,o),v(i,a),v(a,l),v(l,h),v(a,u),v(a,d),v(d,f)},p(e,[t]){8&t&&!c(r.src,s="./assets/screenshots/"+e[3])&&X(r,"src",s),1&t&&R(h,e[0]),2&t&&R(f,e[1]),4&t&&X(n,"href",e[2])},i:e,o:e,d(e){e&&Q(n)}}}function mn(e,t,n){let{title:i}=t,{subtitle:r}=t,{href:s}=t,{image:o}=t;return e.$$set=e=>{"title"in e&&n(0,i=e.title),"subtitle"in e&&n(1,r=e.subtitle),"href"in e&&n(2,s=e.href),"image"in e&&n(3,o=e.image)},[i,r,s,o]}class gn extends Ye{constructor(e){super(),Xe(this,e,mn,pn,a,{title:0,subtitle:1,href:2,image:3})}}function bn(t){let n,i,r,s,o,a,l,c,h,u,d,f,O;return o=new Wt({props:{title:"Available Tools"}}),c=new gn({props:{title:"Package Viewer",subtitle:"Version 2.0",href:"#/view",image:"viewer.png"}}),u=new gn({props:{title:"Tuning Generator",subtitle:"Legacy Tool",href:"#/generate",image:"generator.png"}}),f=new On({}),{c(){n=_(),i=P("section"),r=P("div"),s=P("div"),_e(o.$$.fragment),a=_(),l=P("div"),_e(c.$$.fragment),h=_(),_e(u.$$.fragment),d=_(),_e(f.$$.fragment),document.title="S4TK Package Tools",X(l,"class","flex flex-col md:flex-row gap-8 items-center"),X(r,"class","py-10 w-full xl:max-w-screen-xl px-4 flex flex-col justify-center gap-8"),X(i,"class","pt-10 flex-1 w-full flex justify-center")},m(e,t){$(e,n,t),$(e,i,t),v(i,r),v(r,s),Ze(o,s,null),v(r,a),v(r,l),Ze(c,l,null),v(l,h),Ze(u,l,null),$(e,d,t),Ze(f,e,t),O=!0},p:e,i(e){O||(be(o.$$.fragment,e),be(c.$$.fragment,e),be(u.$$.fragment,e),be(f.$$.fragment,e),O=!0)},o(e){we(o.$$.fragment,e),we(c.$$.fragment,e),we(u.$$.fragment,e),we(f.$$.fragment,e),O=!1},d(e){e&&Q(n),e&&Q(i),Ce(o),Ce(c),Ce(u),e&&Q(d),Ce(f,e)}}}class wn extends Ye{constructor(e){super(),Xe(this,e,null,bn,a,{})}}function xn(t){let n,i,r,s,o,a,l,c,h,u,d,f;return o=new Wt({props:{title:"Unlock this page for $4.04"}}),d=new On({}),{c(){n=_(),i=P("section"),r=P("div"),s=P("div"),_e(o.$$.fragment),a=_(),l=P("p"),l.innerHTML='Just kidding. This page doesn't exist. Please go home.',c=_(),h=P("p"),h.textContent="Error 404",u=_(),_e(d.$$.fragment),document.title="Page Not Found",X(s,"class","mb-4"),X(l,"class","mb-8"),X(h,"class","text-subtle text-xs"),X(r,"class","w-full xl:max-w-screen-xl px-4 flex flex-col justify-center"),X(i,"class","pt-10 flex-1 w-full flex justify-center")},m(e,t){$(e,n,t),$(e,i,t),v(i,r),v(r,s),Ze(o,s,null),v(r,a),v(r,l),v(r,c),v(r,h),$(e,u,t),Ze(d,e,t),f=!0},p:e,i(e){f||(be(o.$$.fragment,e),be(d.$$.fragment,e),f=!0)},o(e){we(o.$$.fragment,e),we(d.$$.fragment,e),f=!1},d(e){e&&Q(n),e&&Q(i),Ce(o),e&&Q(u),Ce(d,e)}}}class vn extends Ye{constructor(e){super(),Xe(this,e,null,xn,a,{})}}function yn(t){let n;return{c(){n=P("div"),n.innerHTML='
\n
\n
\n
',X(n,"class","loading-indicator svelte-9y60i5")},m(e,t){$(e,n,t)},p:e,i:e,o:e,d(e){e&&Q(n)}}}class Sn extends Ye{constructor(e){super(),Xe(this,e,null,yn,a,{})}}const $n=e=>({}),Qn=e=>({}),kn=e=>({}),Pn=e=>({});function Tn(e){let t,n,i,r,s,o,a,l,u,p,m,g,b,w,x,y,S;const k=e[5].primary,Z=h(k,e,e[4],Pn),Y=e[5].secondary,q=h(Y,e,e[4],Qn);return{c(){t=P("div"),n=P("button"),i=P("p"),r=T(e[3]),s=_(),o=T(e[0]),a=_(),l=P("img"),p=_(),m=P("div"),Z&&Z.c(),g=_(),b=P("div"),q&&q.c(),X(i,"class","text-sm uppercase font-bold text-subtle"),c(l.src,u="./assets/icons/"+e[2]+".svg")||X(l,"src",u),X(l,"alt",e[2]),X(l,"class","svg h-4 w-4 absolute right-3 top-3"),X(n,"class","absolute h-10 top-0 right-0 left-0 w-full bg-gray-100 dark:bg-gray-900 border-b border-solid border-b-gray-300 dark:border-b-gray-700"),X(m,"class","absolute top-10 bottom-0 right-0 left-0"),X(b,"class","absolute top-10 bottom-0 right-0 left-0"),b.hidden=w=!e[1],X(t,"class","w-full h-full relative")},m(c,h){$(c,t,h),v(t,n),v(n,i),v(i,r),v(i,s),v(i,o),v(n,a),v(n,l),v(t,p),v(t,m),Z&&Z.m(m,null),v(t,g),v(t,b),q&&q.m(b,null),x=!0,y||(S=C(n,"click",e[6]),y=!0)},p(e,[t]){(!x||8&t)&&R(r,e[3]),(!x||1&t)&&R(o,e[0]),(!x||4&t&&!c(l.src,u="./assets/icons/"+e[2]+".svg"))&&X(l,"src",u),(!x||4&t)&&X(l,"alt",e[2]),Z&&Z.p&&(!x||16&t)&&f(Z,k,e,e[4],x?d(k,e[4],t,kn):O(e[4]),Pn),q&&q.p&&(!x||16&t)&&f(q,Y,e,e[4],x?d(Y,e[4],t,$n):O(e[4]),Qn),(!x||2&t&&w!==(w=!e[1]))&&(b.hidden=w)},i(e){x||(be(Z,e),be(q,e),x=!0)},o(e){we(Z,e),we(q,e),x=!1},d(e){e&&Q(t),Z&&Z.d(e),q&&q.d(e),y=!1,S()}}}function _n(e,t,n){let i,r,{$$slots:s={},$$scope:o}=t,{compactTitle:a}=t,l=!1;const c=[ot.onUserClickedFile.subscribe((()=>{n(1,l=!1)}))];L((()=>{c.forEach((e=>e()))}));return e.$$set=e=>{"compactTitle"in e&&n(0,a=e.compactTitle),"$$scope"in e&&n(4,o=e.$$scope)},e.$$.update=()=>{2&e.$$.dirty&&n(3,i=l?"close":"open"),2&e.$$.dirty&&n(2,r=l?"x":"list")},[a,l,r,i,o,s,()=>n(1,l=!l)]}class Zn extends Ye{constructor(e){super(),Xe(this,e,_n,Tn,a,{compactTitle:0})}}const Cn=e=>({}),Xn=e=>({}),Yn=e=>({}),Rn=e=>({});function qn(e){let t,n,i,r,o,a,l,c,u;const p=e[8].left,m=h(p,e,e[7],Rn),g=e[8].right,b=h(g,e,e[7],Xn);return{c(){t=P("div"),n=P("div"),m&&m.c(),i=_(),r=P("div"),o=_(),a=P("div"),b&&b.c(),X(n,"class","absolute top-0 bottom-0"),A(n,"width","384px"),X(r,"class","absolute top-0 bottom-0 w-1 split-view-resizer bg-gray-100 dark:bg-gray-900 svelte-1jq8vs3"),A(r,"left","384px"),E(r,"is-resizing",e[3]),X(a,"class","absolute top-0 bottom-0 right-0 overflow-hidden"),A(a,"left","388px"),X(t,"class","w-full h-full relative split-view svelte-1jq8vs3"),E(t,"is-resizing",e[3])},m(s,h){$(s,t,h),v(t,n),m&&m.m(n,null),e[9](n),v(t,i),v(t,r),e[10](r),v(t,o),v(t,a),b&&b.m(a,null),e[11](a),l=!0,c||(u=[C(r,"mousedown",e[4]),C(t,"mousemove",e[5]),C(t,"mouseup",e[6])],c=!0)},p(e,[n]){m&&m.p&&(!l||128&n)&&f(m,p,e,e[7],l?d(p,e[7],n,Yn):O(e[7]),Rn),(!l||8&n)&&E(r,"is-resizing",e[3]),b&&b.p&&(!l||128&n)&&f(b,g,e,e[7],l?d(g,e[7],n,Cn):O(e[7]),Xn),(!l||8&n)&&E(t,"is-resizing",e[3])},i(e){l||(be(m,e),be(b,e),l=!0)},o(e){we(m,e),we(b,e),l=!1},d(n){n&&Q(t),m&&m.d(n),e[9](null),e[10](null),b&&b.d(n),e[11](null),c=!1,s(u)}}}function An(e,t,n){let i,r,s,{$$slots:o={},$$scope:a}=t,l=!1;function c(e){const t=.8*window.innerWidth;e=Math.max(196,Math.min(t,e)),n(0,i.style.width=`${e}px`,i),n(2,s.style.left=`${e}px`,s),n(1,r.style.left=`${e+4}px`,r)}function h(){c(i.offsetWidth)}return N((()=>{c(i.offsetWidth),window.addEventListener("resize",h)})),L((()=>{window.removeEventListener("resize",h)})),e.$$set=e=>{"$$scope"in e&&n(7,a=e.$$scope)},[i,r,s,l,function(e){n(3,l=!0)},function(e){l&&c(e.clientX)},function(e){n(3,l=!1)},a,o,function(e){K[e?"unshift":"push"]((()=>{i=e,n(0,i)}))},function(e){K[e?"unshift":"push"]((()=>{s=e,n(2,s)}))},function(e){K[e?"unshift":"push"]((()=>{r=e,n(1,r)}))}]}class Wn extends Ye{constructor(e){super(),Xe(this,e,An,qn,a,{})}}const En=e=>({}),jn=e=>({slot:"left"}),zn=e=>({}),Dn=e=>({slot:"right"}),Un=e=>({}),Vn=e=>({slot:"secondary"}),In=e=>({}),Mn=e=>({slot:"primary"});function Gn(e){let t,n;return t=new Wn({props:{$$slots:{right:[Ln],left:[Nn]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};32&n&&(i.$$scope={dirty:n,ctx:e}),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function Bn(e){let t,n;return t=new Zn({props:{compactTitle:e[1],$$slots:{primary:[Hn],secondary:[Fn]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};2&n&&(i.compactTitle=e[1]),32&n&&(i.$$scope={dirty:n,ctx:e}),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function Nn(e){let t;const n=e[4].secondary,i=h(n,e,e[5],jn);return{c(){i&&i.c()},m(e,n){i&&i.m(e,n),t=!0},p(e,r){i&&i.p&&(!t||32&r)&&f(i,n,e,e[5],t?d(n,e[5],r,En):O(e[5]),jn)},i(e){t||(be(i,e),t=!0)},o(e){we(i,e),t=!1},d(e){i&&i.d(e)}}}function Ln(e){let t;const n=e[4].primary,i=h(n,e,e[5],Dn);return{c(){i&&i.c()},m(e,n){i&&i.m(e,n),t=!0},p(e,r){i&&i.p&&(!t||32&r)&&f(i,n,e,e[5],t?d(n,e[5],r,zn):O(e[5]),Dn)},i(e){t||(be(i,e),t=!0)},o(e){we(i,e),t=!1},d(e){i&&i.d(e)}}}function Fn(e){let t;const n=e[4].secondary,i=h(n,e,e[5],Vn);return{c(){i&&i.c()},m(e,n){i&&i.m(e,n),t=!0},p(e,r){i&&i.p&&(!t||32&r)&&f(i,n,e,e[5],t?d(n,e[5],r,Un):O(e[5]),Vn)},i(e){t||(be(i,e),t=!0)},o(e){we(i,e),t=!1},d(e){i&&i.d(e)}}}function Hn(e){let t;const n=e[4].primary,i=h(n,e,e[5],Mn);return{c(){i&&i.c()},m(e,n){i&&i.m(e,n),t=!0},p(e,r){i&&i.p&&(!t||32&r)&&f(i,n,e,e[5],t?d(n,e[5],r,In):O(e[5]),Mn)},i(e){t||(be(i,e),t=!0)},o(e){we(i,e),t=!1},d(e){i&&i.d(e)}}}function Kn(e){let t,n,i;return n=new Sn({}),{c(){t=P("div"),_e(n.$$.fragment),X(t,"class","absolute top-0 bottom-0 left-0 right-0 flex items-center justify-center")},m(e,r){$(e,t,r),Ze(n,t,null),i=!0},i(e){i||(be(n.$$.fragment,e),i=!0)},o(e){we(n.$$.fragment,e),i=!1},d(e){e&&Q(t),Ce(n)}}}function Jn(e){let t,n,i,r,s,o;const a=[Bn,Gn],l=[];function c(e,t){return e[2]?0:1}i=c(e),r=l[i]=a[i](e);let h=e[0]&&Kn();return{c(){t=P("div"),n=P("div"),r.c(),s=_(),h&&h.c(),X(n,"class","absolute top-0 bottom-0 left-0 right-0"),n.hidden=e[0],X(t,"class","w-full h-full relative")},m(e,r){$(e,t,r),v(t,n),l[i].m(n,null),v(t,s),h&&h.m(t,null),o=!0},p(e,[s]){let u=i;i=c(e),i===u?l[i].p(e,s):(me(),we(l[u],1,1,(()=>{l[u]=null})),ge(),r=l[i],r?r.p(e,s):(r=l[i]=a[i](e),r.c()),be(r,1),r.m(n,null)),(!o||1&s)&&(n.hidden=e[0]),e[0]?h?1&s&&be(h,1):(h=Kn(),h.c(),be(h,1),h.m(t,null)):h&&(me(),we(h,1,1,(()=>{h=null})),ge())},i(e){o||(be(r),be(h),o=!0)},o(e){we(r),we(h),o=!1},d(e){e&&Q(t),l[i].d(),h&&h.d()}}}function ei(e,t,n){let{$$slots:i={},$$scope:r}=t,{compactTitle:s}=t,{onCompactChange:o=null}=t,{isSwitchingCompact:a=!1}=t,l=!1,c=!1;function h(){const e=window.innerWidth<=640;c&&l!==e&&o&&(n(0,a=!0),setTimeout((()=>{o(),n(0,a=!1)}),250)),n(2,l=e),c=!0}return N((()=>{h(),window.addEventListener("resize",h)})),L((()=>{window.removeEventListener("resize",h)})),e.$$set=e=>{"compactTitle"in e&&n(1,s=e.compactTitle),"onCompactChange"in e&&n(3,o=e.onCompactChange),"isSwitchingCompact"in e&&n(0,a=e.isSwitchingCompact),"$$scope"in e&&n(5,r=e.$$scope)},[a,s,l,o,i,r]}class ti extends Ye{constructor(e){super(),Xe(this,e,ei,Jn,a,{compactTitle:1,onCompactChange:3,isSwitchingCompact:0})}}const ni=e=>({}),ii=e=>({}),ri=e=>({}),si=e=>({});function oi(e){let t,n,i,r,o,a,l,c,u;const p=e[9].top,m=h(p,e,e[8],si),g=e[9].bottom,b=h(g,e,e[8],ii);return{c(){t=P("div"),n=P("div"),m&&m.c(),i=_(),r=P("div"),o=_(),a=P("div"),b&&b.c(),X(n,"class","absolute top-0 left-0 right-0"),A(n,"bottom","196px"),X(r,"class","absolute left-0 right-0 h-1 split-view-resizer border-b border-solid border-b-gray-300 dark:border-b-gray-700 svelte-1j0yqlr"),A(r,"bottom","192px"),E(r,"is-resizing",e[3]),X(a,"class","absolute left-0 bottom-0 right-0 overflow-hidden"),A(a,"height","192px"),X(t,"class","w-full h-full relative split-view svelte-1j0yqlr"),E(t,"is-resizing",e[3])},m(s,h){$(s,t,h),v(t,n),m&&m.m(n,null),e[10](n),v(t,i),v(t,r),e[11](r),v(t,o),v(t,a),b&&b.m(a,null),e[12](a),l=!0,c||(u=[C(r,"mousedown",e[4]),C(t,"mousemove",e[5]),C(t,"mouseup",e[6])],c=!0)},p(e,[n]){m&&m.p&&(!l||256&n)&&f(m,p,e,e[8],l?d(p,e[8],n,ri):O(e[8]),si),(!l||8&n)&&E(r,"is-resizing",e[3]),b&&b.p&&(!l||256&n)&&f(b,g,e,e[8],l?d(g,e[8],n,ni):O(e[8]),ii),(!l||8&n)&&E(t,"is-resizing",e[3])},i(e){l||(be(m,e),be(b,e),l=!0)},o(e){we(m,e),we(b,e),l=!1},d(n){n&&Q(t),m&&m.d(n),e[10](null),e[11](null),b&&b.d(n),e[12](null),c=!1,s(u)}}}function ai(e,t,n){let i,r,s,{$$slots:o={},$$scope:a}=t,{bottomIsCollapsed:l=null}=t,c=!1,h=!1;function u(e){const t=.6*(window.innerHeight-40);e=Math.max(40,Math.min(t,e)),n(0,i.style.height=`${e}px`,i),n(2,s.style.bottom=`${e}px`,s),n(1,r.style.bottom=`${e+4}px`,r),!l&&e<48?n(7,l=!0):l&&e>192&&n(7,l=!1)}function d(){u(i.offsetHeight)}return N((()=>{u(i.offsetHeight),window.addEventListener("resize",d),h=!0})),L((()=>{window.removeEventListener("resize",d)})),e.$$set=e=>{"bottomIsCollapsed"in e&&n(7,l=e.bottomIsCollapsed),"$$scope"in e&&n(8,a=e.$$scope)},e.$$.update=()=>{128&e.$$.dirty&&h&&null!=l&&u(l?40:192)},[i,r,s,c,function(e){n(3,c=!0)},function(e){c&&u(window.innerHeight-e.clientY)},function(e){n(3,c=!1)},l,a,o,function(e){K[e?"unshift":"push"]((()=>{r=e,n(1,r)}))},function(e){K[e?"unshift":"push"]((()=>{s=e,n(2,s)}))},function(e){K[e?"unshift":"push"]((()=>{i=e,n(0,i)}))}]}class li extends Ye{constructor(e){super(),Xe(this,e,ai,oi,a,{bottomIsCollapsed:7})}}function ci(e){let t,n,i,r,a,l,c,h,u,d,f,O,p,m,g,b;return i=new Wt({props:{title:e[0]}}),{c(){t=P("div"),n=P("div"),_e(i.$$.fragment),r=_(),a=P("p"),l=T(e[1]),c=_(),h=P("div"),u=P("button"),d=T(e[2]),f=_(),O=P("button"),p=T(e[3]),X(u,"class","px-3 py-1 rounded border border-solid border-gray-800 text-gray-800 hover:bg-gray-800 hover:text-white dark:border-white dark:text-white dark:hover:bg-white dark:hover:text-black"),X(O,"class","px-3 py-1 rounded border border-solid border-gray-800 hover:border-red-600 dark:hover:border-red-400 text-gray-800 hover:bg-red-600 hover:text-white dark:border-white dark:text-white dark:hover:bg-red-400 dark:hover:text-gray-800"),X(h,"class","flex justify-end gap-4"),X(t,"class","w-full max-w-lg mx-2 my-8 p-4 overflow-hidden bg-gray-100 dark:bg-gray-800 rounded-xl drop-shadow-md flex flex-col gap-4")},m(s,w){$(s,t,w),v(t,n),Ze(i,n,null),v(t,r),v(t,a),v(a,l),v(t,c),v(t,h),v(h,u),v(u,d),v(h,f),v(h,O),v(O,p),m=!0,g||(b=[C(u,"click",(function(){o(e[4])&&e[4].apply(this,arguments)})),C(O,"click",(function(){o(e[5])&&e[5].apply(this,arguments)}))],g=!0)},p(t,n){e=t;const r={};1&n&&(r.title=e[0]),i.$set(r),(!m||2&n)&&R(l,e[1]),(!m||4&n)&&R(d,e[2]),(!m||8&n)&&R(p,e[3])},i(e){m||(be(i.$$.fragment,e),m=!0)},o(e){we(i.$$.fragment,e),m=!1},d(e){e&&Q(t),Ce(i),g=!1,s(b)}}}function hi(e){let t,n;return t=new Je({props:{$$slots:{default:[ci]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,[n]){const i={};127&n&&(i.$$scope={dirty:n,ctx:e}),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function ui(e,t,n){let{title:i}=t,{description:r}=t,{confirmText:s="Confirm"}=t,{cancelText:o="Cancel"}=t,{onConfirm:a}=t,{onCancel:l}=t;return e.$$set=e=>{"title"in e&&n(0,i=e.title),"description"in e&&n(1,r=e.description),"confirmText"in e&&n(2,s=e.confirmText),"cancelText"in e&&n(3,o=e.cancelText),"onConfirm"in e&&n(4,a=e.onConfirm),"onCancel"in e&&n(5,l=e.onCancel)},[i,r,s,o,a,l]}class di extends Ye{constructor(e){super(),Xe(this,e,ui,hi,a,{title:0,description:1,confirmText:2,cancelText:3,onConfirm:4,onCancel:5})}}function fi(t){let n,i,r;return{c(){n=P("button"),n.innerHTML='clear',X(n,"title","Clear")},m(e,s){$(e,n,s),i||(r=C(n,"click",t[5]),i=!0)},p:e,d(e){e&&Q(n),i=!1,r()}}}function Oi(e){let t,n;return t=new di({props:{title:"Refresh Viewer",description:"Are you sure you want to refresh the viewer? You will be able to upload another package.",confirmText:"Reload Viewer",cancelText:"Cancel",onConfirm:e[6],onCancel:e[11]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};2&n&&(i.onCancel=e[11]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function pi(e){let t,n,i,r,o,a,l,h,u,d,f,O,p,m,g,b,w,x,y,S,k,T=Boolean(e[0]),Y=T&&fi(e),R=e[1]&&Oi(e);return{c(){t=P("div"),n=P("div"),i=P("button"),r=P("img"),a=_(),l=P("button"),h=P("img"),d=_(),f=P("div"),O=P("img"),m=_(),g=P("input"),b=_(),Y&&Y.c(),w=_(),R&&R.c(),x=Z(),c(r.src,o="./assets/icons/refresh.svg")||X(r,"src","./assets/icons/refresh.svg"),X(r,"alt",e[2]),X(r,"class","svg h-4 w-4 tint-on-hover"),X(i,"class","flex-shrink-0"),X(i,"title","Reset Viewer"),c(h.src,u="./assets/icons/chevron-"+e[2]+"-outline.svg")||X(h,"src",u),X(h,"alt",e[2]),X(h,"class","svg h-5 w-5 tint-on-hover"),X(l,"class","flex-shrink-0"),X(l,"title",e[3]),X(n,"class","flex-shrink-0 flex items-center gap-2"),c(O.src,p="./assets/icons/search.svg")||X(O,"src","./assets/icons/search.svg"),X(O,"alt","search"),X(O,"class","svg h-4 w-4"),X(g,"type","text"),X(g,"class","flex-1 rounded bg-transparent min-w-0 w-0 text-sm placeholder-gray-500"),X(g,"placeholder","Search"),X(f,"class","basis-full p-1 flex gap-1 items-center rounded bg-gray-300 dark:bg-gray-800"),A(f,"max-width","196px"),X(t,"class","h-full w-full flex items-center justify-between gap-4 px-2")},m(s,o){$(s,t,o),v(t,n),v(n,i),v(i,r),v(n,a),v(n,l),v(l,h),v(t,d),v(t,f),v(f,O),v(f,m),v(f,g),q(g,e[0]),v(f,b),Y&&Y.m(f,null),$(s,w,o),R&&R.m(s,o),$(s,x,o),y=!0,S||(k=[C(i,"click",e[9]),C(l,"click",e[4]),C(g,"input",e[10])],S=!0)},p(e,[t]){(!y||4&t)&&X(r,"alt",e[2]),(!y||4&t&&!c(h.src,u="./assets/icons/chevron-"+e[2]+"-outline.svg"))&&X(h,"src",u),(!y||4&t)&&X(h,"alt",e[2]),(!y||8&t)&&X(l,"title",e[3]),1&t&&g.value!==e[0]&&q(g,e[0]),1&t&&(T=Boolean(e[0])),T?Y?Y.p(e,t):(Y=fi(e),Y.c(),Y.m(f,null)):Y&&(Y.d(1),Y=null),e[1]?R?(R.p(e,t),2&t&&be(R,1)):(R=Oi(e),R.c(),be(R,1),R.m(x.parentNode,x)):R&&(me(),we(R,1,1,(()=>{R=null})),ge())},i(e){y||(be(R),y=!0)},o(e){we(R),y=!1},d(e){e&&Q(t),Y&&Y.d(),e&&Q(w),R&&R.d(e),e&&Q(x),S=!1,s(k)}}}function mi(e,t,n){let i,r,s,{sections:o}=t,a="",l=!1;return e.$$set=e=>{"sections"in e&&n(7,o=e.sections)},e.$$.update=()=>{1&e.$$.dirty&&Rt.requestSearch(a),128&e.$$.dirty&&n(8,i=o?.every((e=>e.collapsed))),256&e.$$.dirty&&n(3,r=i?"Expand All":"Collapse All"),256&e.$$.dirty&&n(2,s=i?"expand":"collapse")},[a,l,s,r,function(){const e=!i;o.forEach((t=>t.collapsed=e)),n(7,o)},function(){n(0,a="")},function(){n(1,l=!1),Rt.unloadPackage({requestRefresh:!0}),async function(e){if(!e||e.length<1||"/"!=e.charAt(0)&&0!==e.indexOf("#/"))throw Error("Invalid parameter location");await re();const t=("#"==e.charAt(0)?"":"#")+e;try{const e={...history.state};delete e.__svelte_spa_router_scrollX,delete e.__svelte_spa_router_scrollY,window.history.replaceState(e,void 0,t)}catch(e){console.warn("Caught exception while replacing the current page. If you're running this in the Svelte REPL, please note that the `replace` method might not work in this environment.")}window.dispatchEvent(new Event("hashchange"))}("#/view")},o,i,()=>n(1,l=!0),function(){a=this.value,n(0,a)},()=>n(1,l=!1)]}class gi extends Ye{constructor(e){super(),Xe(this,e,mi,pi,a,{sections:7})}}function bi(e){let t,n,i,r,s,o,a;return n=new Nt({props:{level:e[0]}}),{c(){t=P("div"),_e(n.$$.fragment),i=_(),r=P("p"),s=T(e[1]),X(r,"class",o="monospace text-xs diagnostics-text "+e[3]),X(t,"title",e[2]),X(t,"class","flex-shrink-0 flex items-center gap-1 flex-nowrap whitespace-nowrap")},m(e,o){$(e,t,o),Ze(n,t,null),v(t,i),v(t,r),v(r,s),a=!0},p(e,[i]){const l={};1&i&&(l.level=e[0]),n.$set(l),(!a||2&i)&&R(s,e[1]),(!a||8&i&&o!==(o="monospace text-xs diagnostics-text "+e[3]))&&X(r,"class",o),(!a||4&i)&&X(t,"title",e[2])},i(e){a||(be(n.$$.fragment,e),a=!0)},o(e){we(n.$$.fragment,e),a=!1},d(e){e&&Q(t),Ce(n)}}}function wi(e,t,n){let i,r;const{DiagnosticLevel:s}=window.S4TK.validation;let{level:o}=t,{count:a}=t;return e.$$set=e=>{"level"in e&&n(0,o=e.level),"count"in e&&n(1,a=e.count)},e.$$.update=()=>{1&e.$$.dirty&&n(2,i=s[o]),4&e.$$.dirty&&n(3,r=i.toLowerCase())},[o,a,i,r]}class xi extends Ye{constructor(e){super(),Xe(this,e,wi,bi,a,{level:0,count:1})}}function vi(e){let t,n;return t=new xi({props:{level:e[3].Error,count:e[2]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};4&n&&(i.count=e[2]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function yi(e){let t,n;return t=new xi({props:{level:e[3].Warning,count:e[1]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};2&n&&(i.count=e[1]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function Si(e){let t,n;return t=new xi({props:{level:e[3].Info,count:e[0]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.count=e[0]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function $i(e){let t,n,i,r,s=Boolean(e[2]),o=Boolean(e[1]),a=Boolean(e[0]),l=s&&vi(e),c=o&&yi(e),h=a&&Si(e);return{c(){t=P("div"),l&&l.c(),n=_(),c&&c.c(),i=_(),h&&h.c(),X(t,"class","flex-shrink-0 flex items-center gap-2 flex-nowrap whitespace-nowrap")},m(e,s){$(e,t,s),l&&l.m(t,null),v(t,n),c&&c.m(t,null),v(t,i),h&&h.m(t,null),r=!0},p(e,[r]){4&r&&(s=Boolean(e[2])),s?l?(l.p(e,r),4&r&&be(l,1)):(l=vi(e),l.c(),be(l,1),l.m(t,n)):l&&(me(),we(l,1,1,(()=>{l=null})),ge()),2&r&&(o=Boolean(e[1])),o?c?(c.p(e,r),2&r&&be(c,1)):(c=yi(e),c.c(),be(c,1),c.m(t,i)):c&&(me(),we(c,1,1,(()=>{c=null})),ge()),1&r&&(a=Boolean(e[0])),a?h?(h.p(e,r),1&r&&be(h,1)):(h=Si(e),h.c(),be(h,1),h.m(t,null)):h&&(me(),we(h,1,1,(()=>{h=null})),ge())},i(e){r||(be(l),be(c),be(h),r=!0)},o(e){we(l),we(c),we(h),r=!1},d(e){e&&Q(t),l&&l.d(),c&&c.d(),h&&h.d()}}}function Qi(e,t,n){let i,r,s,o;const{DiagnosticLevel:a}=window.S4TK.validation;let{diagnostics:l}=t;return e.$$set=e=>{"diagnostics"in e&&n(4,l=e.diagnostics)},e.$$.update=()=>{16&e.$$.dirty&&n(5,i=l.filter((e=>bt.passesSettings(e)))),32&e.$$.dirty&&n(2,r=bt.countExact(a.Error,i)),32&e.$$.dirty&&n(1,s=bt.countExact(a.Warning,i)),32&e.$$.dirty&&n(0,o=bt.countExact(a.Info,i))},[o,s,r,a,l,i]}class ki extends Ye{constructor(e){super(),Xe(this,e,Qi,$i,a,{diagnostics:4})}}function Pi(t){let n,i,r=t[0].tuningInfo.displayName+"";return{c(){n=P("p"),i=T(r),X(n,"class","mb-1 text-sm ellipsis-overflow")},m(e,t){$(e,n,t),v(n,i)},p(e,t){1&t&&r!==(r=e[0].tuningInfo.displayName+"")&&R(i,r)},i:e,o:e,d(e){e&&Q(n)}}}function Ti(e){let t,n,i,r,s,o,a=e[0].tuningInfo.displayName+"";return s=new ki({props:{diagnostics:e[0].tuningInfo.diagnostics}}),{c(){t=P("div"),n=P("p"),i=T(a),r=_(),_e(s.$$.fragment),X(n,"class","text-sm ellipsis-overflow"),X(t,"class","mb-1 w-full flex items-center justify-between")},m(e,a){$(e,t,a),v(t,n),v(n,i),v(t,r),Ze(s,t,null),o=!0},p(e,t){(!o||1&t)&&a!==(a=e[0].tuningInfo.displayName+"")&&R(i,a);const n={};1&t&&(n.diagnostics=e[0].tuningInfo.diagnostics),s.$set(n)},i(e){o||(be(s.$$.fragment,e),o=!0)},o(e){we(s.$$.fragment,e),o=!1},d(e){e&&Q(t),Ce(s)}}}function _i(e){let t,n,i,r,s,o,a,l,h,u,d,f,O,p,m,g=e[2]&&Zi(e);return{c(){t=P("div"),n=P("button"),i=P("div"),r=P("img"),o=_(),a=P("p"),l=T("SimData ("),h=P("span"),u=T(e[1]),d=T(")"),f=_(),g&&g.c(),c(r.src,s="./assets/icons/link-outline.svg")||X(r,"src","./assets/icons/link-outline.svg"),X(r,"alt","Link"),X(r,"class","h-4 w-4 svg"),X(h,"class","monospace"),X(a,"class","text-sm ellipsis-overflow"),X(i,"class","min-w-0 flex items-center gap-2"),X(n,"class","w-full flex gap-2 items-center justify-between bg-gray-300 dark:bg-gray-800 px-2 py-1 rounded border border-solid border-gray-200 dark:border-gray-900 h-10 sm:h-8 svelte-1kz9fsp"),E(n,"active-border",e[5]),X(t,"class","px-2 pb-2")},m(s,c){$(s,t,c),v(t,n),v(n,i),v(i,r),v(i,o),v(i,a),v(a,l),v(a,h),v(h,u),v(a,d),v(n,f),g&&g.m(n,null),O=!0,p||(m=C(n,"click",e[7]),p=!0)},p(e,t){(!O||2&t)&&R(u,e[1]),e[2]?g?(g.p(e,t),4&t&&be(g,1)):(g=Zi(e),g.c(),be(g,1),g.m(n,null)):g&&(me(),we(g,1,1,(()=>{g=null})),ge()),(!O||32&t)&&E(n,"active-border",e[5])},i(e){O||(be(g),O=!0)},o(e){we(g),O=!1},d(e){e&&Q(t),g&&g.d(),p=!1,m()}}}function Zi(e){let t,n;return t=new ki({props:{diagnostics:e[0].simDataInfo.diagnostics}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.diagnostics=e[0].simDataInfo.diagnostics),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function Ci(e){let t,n,i,r,s,o,a,l,c,h,u,d=e[0].tuningInfo.resourceKey+"";const f=[Ti,Pi],O=[];function p(e,t){return e[3]?0:1}n=p(e),i=O[n]=f[n](e);let m=e[4]&&_i(e);return{c(){t=P("button"),i.c(),r=_(),s=P("p"),o=T(d),a=_(),m&&m.c(),l=Z(),X(s,"class","text-xs text-subtle monospace ellipsis-overflow"),X(t,"class","px-2 py-2 text-left w-full")},m(i,d){$(i,t,d),O[n].m(t,null),v(t,r),v(t,s),v(s,o),$(i,a,d),m&&m.m(i,d),$(i,l,d),c=!0,h||(u=C(t,"click",e[6]),h=!0)},p(e,[s]){let a=n;n=p(e),n===a?O[n].p(e,s):(me(),we(O[a],1,1,(()=>{O[a]=null})),ge(),i=O[n],i?i.p(e,s):(i=O[n]=f[n](e),i.c()),be(i,1),i.m(t,r)),(!c||1&s)&&d!==(d=e[0].tuningInfo.resourceKey+"")&&R(o,d),e[4]?m?(m.p(e,s),16&s&&be(m,1)):(m=_i(e),m.c(),be(m,1),m.m(l.parentNode,l)):m&&(me(),we(m,1,1,(()=>{m=null})),ge())},i(e){c||(be(i),be(m),c=!0)},o(e){we(i),we(m),c=!1},d(e){e&&Q(t),O[n].d(),e&&Q(a),m&&m.d(e),e&&Q(l),h=!1,u()}}}function Xi(e,t,n){let i,r,s,o,a,{cell:l}=t,{activeId:c}=t;return e.$$set=e=>{"cell"in e&&n(0,l=e.cell),"activeId"in e&&n(8,c=e.activeId)},e.$$.update=()=>{257&e.$$.dirty&&n(5,i=l.simDataInfo?.id===c),1&e.$$.dirty&&n(4,r=Boolean(l.simDataInfo)),1&e.$$.dirty&&n(3,s=Boolean(l.tuningInfo.diagnostics.length)),1&e.$$.dirty&&n(2,o=Boolean(l.simDataInfo?.diagnostics.length)),1&e.$$.dirty&&n(1,a=l.simDataInfo?.resourceKey.split("-")[1]??"Unknown")},[l,a,o,s,r,i,function(){Rt.requestFile(l.tuningInfo.id,!0)},function(){Rt.requestFile(l.simDataInfo.id,!0)},c]}class Yi extends Ye{constructor(e){super(),Xe(this,e,Xi,Ci,a,{cell:0,activeId:8})}}function Ri(e,t,n){const i=e.slice();return i[9]=t[n],i[11]=n,i}function qi(t){let n,i,r=t[0].filterName+"";return{c(){n=P("p"),i=T(r),X(n,"class","mb-1 text-sm ellipsis-overflow")},m(e,t){$(e,n,t),v(n,i)},p(e,t){1&t&&r!==(r=e[0].filterName+"")&&R(i,r)},i:e,o:e,d(e){e&&Q(n)}}}function Ai(e){let t,n,i,r,s,o,a=e[0].filterName+"";return s=new ki({props:{diagnostics:e[1]}}),{c(){t=P("div"),n=P("p"),i=T(a),r=_(),_e(s.$$.fragment),X(n,"class","text-sm ellipsis-overflow"),X(t,"class","mb-1 w-full flex items-center justify-between")},m(e,a){$(e,t,a),v(t,n),v(n,i),v(t,r),Ze(s,t,null),o=!0},p(e,t){(!o||1&t)&&a!==(a=e[0].filterName+"")&&R(i,a);const n={};2&t&&(n.diagnostics=e[1]),s.$set(n)},i(e){o||(be(s.$$.fragment,e),o=!0)},o(e){we(s.$$.fragment,e),o=!1},d(e){e&&Q(t),Ce(s)}}}function Wi(e){let t,n,i,r=e[9].displayName+"",s=e[6](e[9])+"";return{c(){t=P("option"),n=T(r),i=T(s),t.__value=e[11],t.value=t.__value},m(e,r){$(e,t,r),v(t,n),v(t,i)},p(e,t){1&t&&r!==(r=e[9].displayName+"")&&R(n,r),1&t&&s!==(s=e[6](e[9])+"")&&R(i,s)},d(e){e&&Q(t)}}}function Ei(e){let t,n,i,r,o,a,l,c,h,u,d,f,O=e[0].sharedResourceKey+"";const p=[Ai,qi],m=[];function g(e,t){return e[3]?0:1}n=g(e),i=m[n]=p[n](e);let b=e[0].localeChoices,w=[];for(let t=0;t{m[o]=null})),ge(),i=m[n],i?i.p(e,s):(i=m[n]=p[n](e),i.c()),be(i,1),i.m(t,r)),(!u||1&s)&&O!==(O=e[0].sharedResourceKey+"")&&R(a,O),65&s){let t;for(b=e[0].localeChoices,t=0;t{"cell"in e&&n(0,a=e.cell)},e.$$.update=()=>{1&e.$$.dirty&&(i=a.localeChoices[a.chosenLocaleIndex]),1&e.$$.dirty&&n(1,r=gt.allDiagnostics(a)),2&e.$$.dirty&&n(3,s=Boolean(r.length))},[a,r,o,s,function(){Rt.requestFile(i.id,!0)},function(){n(0,a.chosenLocaleIndex=parseInt(o.value),a);const e=a.localeChoices[a.chosenLocaleIndex];Rt.requestFile(e.id,!0)},function(e){const t=e.diagnostics.filter((e=>bt.passesSettings(e))).length;return 0===t?"":1===t?" (1 issue)":` (${t} issues)`},function(e){K[e?"unshift":"push"]((()=>{o=e,n(2,o)}))}]}class zi extends Ye{constructor(e){super(),Xe(this,e,ji,Ei,a,{cell:0})}}function Di(t){let n,i,r=t[0].info.displayName+"";return{c(){n=P("p"),i=T(r),X(n,"class","mb-1 text-sm ellipsis-overflow")},m(e,t){$(e,n,t),v(n,i)},p(e,t){1&t&&r!==(r=e[0].info.displayName+"")&&R(i,r)},i:e,o:e,d(e){e&&Q(n)}}}function Ui(e){let t,n,i,r,s,o,a=e[0].info.displayName+"";return s=new ki({props:{diagnostics:e[0].info.diagnostics}}),{c(){t=P("div"),n=P("p"),i=T(a),r=_(),_e(s.$$.fragment),X(n,"class","text-sm ellipsis-overflow"),X(t,"class","mb-1 w-full flex items-center justify-between")},m(e,a){$(e,t,a),v(t,n),v(n,i),v(t,r),Ze(s,t,null),o=!0},p(e,t){(!o||1&t)&&a!==(a=e[0].info.displayName+"")&&R(i,a);const n={};1&t&&(n.diagnostics=e[0].info.diagnostics),s.$set(n)},i(e){o||(be(s.$$.fragment,e),o=!0)},o(e){we(s.$$.fragment,e),o=!1},d(e){e&&Q(t),Ce(s)}}}function Vi(e){let t,n,i,r,s,o,a,l,c,h=e[0].info.resourceKey+"";const u=[Ui,Di],d=[];function f(e,t){return e[1]?0:1}return n=f(e),i=d[n]=u[n](e),{c(){t=P("button"),i.c(),r=_(),s=P("p"),o=T(h),X(s,"class","text-xs text-subtle monospace ellipsis-overflow"),X(t,"class","px-2 py-2 text-left w-full")},m(i,h){$(i,t,h),d[n].m(t,null),v(t,r),v(t,s),v(s,o),a=!0,l||(c=C(t,"click",e[2]),l=!0)},p(e,[s]){let l=n;n=f(e),n===l?d[n].p(e,s):(me(),we(d[l],1,1,(()=>{d[l]=null})),ge(),i=d[n],i?i.p(e,s):(i=d[n]=u[n](e),i.c()),be(i,1),i.m(t,r)),(!a||1&s)&&h!==(h=e[0].info.resourceKey+"")&&R(o,h)},i(e){a||(be(i),a=!0)},o(e){we(i),a=!1},d(e){e&&Q(t),d[n].d(),l=!1,c()}}}function Ii(e,t,n){let i,{cell:r}=t;return e.$$set=e=>{"cell"in e&&n(0,r=e.cell)},e.$$.update=()=>{1&e.$$.dirty&&n(1,i=Boolean(r.info.diagnostics.length))},[r,i,function(){Rt.requestFile(r.info.id,!0)}]}class Mi extends Ye{constructor(e){super(),Xe(this,e,Ii,Vi,a,{cell:0})}}function Gi(e){let t,n;return t=new Mi({props:{cell:e[0]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.cell=e[0]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function Bi(e){let t,n;return t=new zi({props:{cell:e[0]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.cell=e[0]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function Ni(e){let t,n;return t=new Yi({props:{cell:e[0],activeId:e[1]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.cell=e[0]),2&n&&(i.activeId=e[1]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function Li(e){let t,n,i,r;const s=[Ni,Bi,Gi],o=[];function a(e,t){return e[0].displayType===mt.Tuning?0:e[0].displayType===mt.StringTable?1:2}return n=a(e),i=o[n]=s[n](e),{c(){t=P("div"),i.c(),X(t,"class","border-l-4 border-b border-solid border-l-transparent border-b-gray-300 dark:border-b-gray-700 explorer-cell hover:bg-gray-200 dark:hover:bg-gray-800 svelte-1tsgmii"),E(t,"active-left-border",e[2])},m(e,i){$(e,t,i),o[n].m(t,null),r=!0},p(e,[l]){let c=n;n=a(e),n===c?o[n].p(e,l):(me(),we(o[c],1,1,(()=>{o[c]=null})),ge(),i=o[n],i?i.p(e,l):(i=o[n]=s[n](e),i.c()),be(i,1),i.m(t,null)),(!r||4&l)&&E(t,"active-left-border",e[2])},i(e){r||(be(i),r=!0)},o(e){we(i),r=!1},d(e){e&&Q(t),o[n].d()}}}function Fi(e,t,n){let i,{cell:r}=t,{activeId:s}=t;return e.$$set=e=>{"cell"in e&&n(0,r=e.cell),"activeId"in e&&n(1,s=e.activeId)},e.$$.update=()=>{3&e.$$.dirty&&n(2,i=gt.isActive(r,s))},[r,s,i]}class Hi extends Ye{constructor(e){super(),Xe(this,e,Fi,Li,a,{cell:0,activeId:1})}}function Ki(e,t,n){const i=e.slice();return i[11]=t[n],i}function Ji(t){let n,i;return{c(){n=P("img"),c(n.src,i="./assets/icons/"+t[6]+".svg")||X(n,"src",i),X(n,"alt",t[6]),X(n,"class","svg h-3 w-3 ml-3")},m(e,t){$(e,n,t)},p(e,t){64&t&&!c(n.src,i="./assets/icons/"+e[6]+".svg")&&X(n,"src",i),64&t&&X(n,"alt",e[6])},i:e,o:e,d(e){e&&Q(n)}}}function er(e){let t,n,i,r,s,o;return n=new ki({props:{diagnostics:e[5]}}),{c(){t=P("div"),_e(n.$$.fragment),i=_(),r=P("img"),c(r.src,s="./assets/icons/"+e[6]+".svg")||X(r,"src",s),X(r,"alt",e[6]),X(r,"class","svg h-3 w-3"),X(t,"class","flex-shrink-0 ml-3 flex items-center gap-2")},m(e,s){$(e,t,s),Ze(n,t,null),v(t,i),v(t,r),o=!0},p(e,t){const i={};32&t&&(i.diagnostics=e[5]),n.$set(i),(!o||64&t&&!c(r.src,s="./assets/icons/"+e[6]+".svg"))&&X(r,"src",s),(!o||64&t)&&X(r,"alt",e[6])},i(e){o||(be(n.$$.fragment,e),o=!0)},o(e){we(n.$$.fragment,e),o=!1},d(e){e&&Q(t),Ce(n)}}}function tr(e){let t,n,i=e[2],r=[];for(let t=0;twe(r[e],1,1,(()=>{r[e]=null}));return{c(){for(let e=0;e{w[s]=null})),ge(),h=w[c],h?h.p(e,i):(h=w[c]=b[c](e),h.c()),be(h,1),h.m(n,null)),(!O||17&i)&&E(n,"active-left-border",e[0].collapsed&&e[4]),(!O||4&i)&&E(n,"opacity-20",!e[2]?.length),(!O||1&i)&&E(n,"stick-to-top",!e[0].collapsed),e[0].collapsed?y&&(me(),we(y,1,1,(()=>{y=null})),ge()):y?(y.p(e,i),1&i&&be(y,1)):(y=tr(e),y.c(),be(y,1),y.m(t,null))},i(e){O||(be(h),be(y),O=!0)},o(e){we(h),we(y),O=!1},d(e){e&&Q(t),w[c].d(),y&&y.d(),p=!1,m()}}}function rr(e,t,n){let i,r,s,o,a;const{passesSearch:l,allDiagnostics:c}=gt;let{searchTerm:h}=t,{section:u}=t,{activeId:d}=t;return e.$$set=e=>{"searchTerm"in e&&n(8,h=e.searchTerm),"section"in e&&n(0,u=e.section),"activeId"in e&&n(1,d=e.activeId)},e.$$.update=()=>{1&e.$$.dirty&&n(6,i=u.collapsed?"chevron-right":"chevron-down"),257&e.$$.dirty&&n(2,r=u.cells.filter((e=>l(e,h)))),4&e.$$.dirty&&n(5,s=vt(...r.map(c))),3&e.$$.dirty&&n(4,o=u.cells.some((e=>e.containedIds.has(d)))),5&e.$$.dirty&&n(3,a=r.length"opacity: "+e*s}}function lr(e,{delay:t=0,duration:n=400,easing:i=or,x:r=0,y:s=0,opacity:o=0}={}){const a=getComputedStyle(e),l=+a.opacity,c="none"===a.transform?"":a.transform,h=l*(1-o);return{delay:t,duration:n,easing:i,css:(e,t)=>`\n\t\t\ttransform: ${c} translate(${(1-e)*r}px, ${(1-e)*s}px);\n\t\t\topacity: ${l-h*t}`}}function cr(e){let t,n,i,r,s;return{c(){t=P("div"),n=P("p"),i=T(e[0]),X(n,"class","text-white"),X(t,"class","fixed z-50 bottom-4 right-4 bg-gray-900 px-4 py-2 rounded")},m(e,r){$(e,t,r),v(t,n),v(n,i),s=!0},p(e,[t]){(!s||1&t)&&R(i,e[0])},i(e){s||(se((()=>{r||(r=ve(t,lr,{y:20},!0)),r.run(1)})),s=!0)},o(e){r||(r=ve(t,lr,{y:20},!1)),r.run(0),s=!1},d(e){e&&Q(t),e&&r&&r.end()}}}function hr(e,t,n){let{text:i}=t,{visible:r}=t;return N((()=>{setTimeout((()=>{n(1,r=!1)}),2e3)})),e.$$set=e=>{"text"in e&&n(0,i=e.text),"visible"in e&&n(1,r=e.visible)},[i,r]}class ur extends Ye{constructor(e){super(),Xe(this,e,hr,cr,a,{text:0,visible:1})}}function dr(e){let t,n,i;function r(t){e[4](t)}let s={text:"Downloading "+e[0]+"..."};return void 0!==e[1]&&(s.visible=e[1]),t=new ur({props:s}),K.push((()=>Te(t,"visible",r))),{c(){_e(t.$$.fragment)},m(e,n){Ze(t,e,n),i=!0},p(e,i){const r={};1&i&&(r.text="Downloading "+e[0]+"..."),!n&&2&i&&(n=!0,r.visible=e[1],oe((()=>n=!1))),t.$set(r)},i(e){i||(be(t.$$.fragment,e),i=!0)},o(e){we(t.$$.fragment,e),i=!1},d(e){Ce(t,e)}}}function fr(e){let t,n,i,r,s,o,a,l,c=e[1]&&dr(e);return{c(){t=P("button"),n=T(e[0]),r=_(),c&&c.c(),s=Z(),X(t,"class","download-button flex-1 text-xs px-2 py-1 rounded border border-solid border-gray-800 text-gray-800 hover:bg-gray-800 hover:text-white dark:border-white dark:text-white dark:hover:bg-white dark:hover:text-black whitespace-nowrap text-ellipsis overflow-hidden"),X(t,"title",i="Download "+e[0])},m(i,h){$(i,t,h),v(t,n),$(i,r,h),c&&c.m(i,h),$(i,s,h),o=!0,a||(l=C(t,"click",e[2]),a=!0)},p(e,[r]){(!o||1&r)&&R(n,e[0]),(!o||1&r&&i!==(i="Download "+e[0]))&&X(t,"title",i),e[1]?c?(c.p(e,r),2&r&&be(c,1)):(c=dr(e),c.c(),be(c,1),c.m(s.parentNode,s)):c&&(me(),we(c,1,1,(()=>{c=null})),ge())},i(e){o||(be(c),o=!0)},o(e){we(c),o=!1},d(e){e&&Q(t),e&&Q(r),c&&c.d(e),e&&Q(s),a=!1,l()}}}function Or(e,t,n){let{text:i}=t,{onClick:r}=t,s=!1;return e.$$set=e=>{"text"in e&&n(0,i=e.text),"onClick"in e&&n(3,r=e.onClick)},[i,s,function(){r(),s||n(1,s=!0)},r,function(e){s=e,n(1,s)}]}class pr extends Ye{constructor(e){super(),Xe(this,e,Or,fr,a,{text:0,onClick:3})}}const{Boolean:mr}=ye;function gr(e,t,n){const i=e.slice();return i[9]=t[n],i}function br(t){let n;return{c(){n=P("div"),n.innerHTML='

No files loaded

',X(n,"class","h-full flex items-center justify-center")},m(e,t){$(e,n,t)},p:e,i:e,o:e,d(e){e&&Q(n)}}}function wr(e){let t,n,i,r,s,o,a,l,h,u,d,f,O,p,m,g,b;function w(t){e[7](t)}let x={};void 0!==e[0]&&(x.sections=e[0]),i=new gi({props:x}),K.push((()=>Te(i,"sections",w)));let y=e[0],S=[];for(let t=0;twe(S[e],1,1,(()=>{S[e]=null}));return f=new pr({props:{text:"ZIP",onClick:e[4]}}),p=new pr({props:{text:"Package",onClick:e[6]}}),g=new pr({props:{text:"File",onClick:e[5]}}),{c(){t=P("div"),n=P("div"),_e(i.$$.fragment),s=_(),o=P("div");for(let e=0;er=!1))),i.$set(n),7&t){let n;for(y=e[0],n=0;n{o[l]=null})),ge(),i=o[n],i?i.p(e,r):(i=o[n]=s[n](e),i.c()),be(i,1),i.m(t,null))},i(e){r||(be(i),r=!0)},o(e){we(i),r=!1},d(e){e&&Q(t),o[n].d()}}}function yr(e,t,n){let i,r,s="",o=-1;const a=[ot.onExplorerSectionsChange.subscribe((e=>{n(0,r=e)})),ot.onViewedFileChange.subscribe((e=>{n(2,o=e?.id??-1)})),ot.onSearchTermChange.subscribe((e=>{n(1,s=e)}))];L((()=>{a.forEach((e=>e()))}));return e.$$.update=()=>{1&e.$$.dirty&&n(3,i=Boolean(r?.length))},[r,s,o,i,()=>Rt.downloadAllFiles(),()=>Rt.downloadCurrentFile(),()=>Rt.downloadCurrentPackage(),function(e){r=e,n(0,r)}]}class Sr extends Ye{constructor(e){super(),Xe(this,e,yr,vr,a,{})}}function $r(t){let n,i,r,s,o=t[3]&&Qr(t);return{c(){n=P("div"),i=P("label"),r=T(t[1]),s=_(),o&&o.c(),X(i,"for","file-upload"),X(i,"class","uppercase text-xs font-bold text-subtle"),X(n,"class","flex items-center mb-2")},m(e,t){$(e,n,t),v(n,i),v(i,r),v(n,s),o&&o.m(n,null)},p(e,t){2&t&&R(r,e[1]),e[3]?o?(o.p(e,t),8&t&&be(o,1)):(o=Qr(e),o.c(),be(o,1),o.m(n,null)):o&&(o.d(1),o=null)},i(e){be(o)},o:e,d(e){e&&Q(n),o&&o.d()}}}function Qr(n){let i,r,s,a;return{c(){i=P("p"),r=T(" • "),s=T(n[4]),X(i,"class","text-xs text-red-600 dark:text-red-400")},m(e,t){$(e,i,t),v(i,r),v(i,s)},p(e,t){16&t&&R(s,e[4])},i(n){a||se((()=>{a=function(n,i,r){let s,a,l=i(n,r),c=!1,h=0;function u(){s&&M(n,s)}function d(){const{delay:i=0,duration:r=300,easing:o=t,tick:d=e,css:f}=l||xe;f&&(s=I(n,0,1,r,i,o,f,h++)),d(0,1);const O=m()+i,p=O+r;a&&a.abort(),c=!0,se((()=>fe(n,!0,"start"))),a=x((e=>{if(c){if(e>=p)return d(1,0),fe(n,!0,"end"),u(),c=!1;if(e>=O){const t=o((e-O)/r);d(t,1-t)}}return c}))}let f=!1;return{start(){f||(f=!0,M(n),o(l)?(l=l(),de().then(d)):d())},invalidate(){f=!1},end(){c&&(u(),c=!1)}}}(i,ar,{}),a.start()}))},o:e,d(e){e&&Q(i)}}}function kr(t){let n,i,r,s,o,a=Boolean(t[1]),l=a&&$r(t);return{c(){n=P("div"),l&&l.c(),i=_(),r=P("input"),X(r,"name","file-upload"),X(r,"type","file"),X(r,"class","w-full min-w-0 hover:cursor-pointer border border-solid border-gray-600 dark:border-gray-300 p-2 rounded svelte-10do9z8"),X(r,"accept",t[0]),r.multiple=t[2],E(r,"border-red-500",t[3]),X(n,"class","w-full")},m(e,a){$(e,n,a),l&&l.m(n,null),v(n,i),v(n,r),s||(o=C(r,"change",t[7]),s=!0)},p(e,[t]){2&t&&(a=Boolean(e[1])),a?l?(l.p(e,t),2&t&&be(l,1)):(l=$r(e),l.c(),be(l,1),l.m(n,i)):l&&(l.d(1),l=null),1&t&&X(r,"accept",e[0]),4&t&&(r.multiple=e[2]),8&t&&E(r,"border-red-500",e[3])},i(e){be(l)},o:e,d(e){e&&Q(n),l&&l.d(),s=!1,o()}}}function Pr(e,t,n){let i,{accept:r}=t,{label:s=""}=t,{multiple:o=!1}=t,{filesInvalid:a=!1}=t,{errorMessage:l=""}=t,{onFilesChanged:c}=t;return e.$$set=e=>{"accept"in e&&n(0,r=e.accept),"label"in e&&n(1,s=e.label),"multiple"in e&&n(2,o=e.multiple),"filesInvalid"in e&&n(3,a=e.filesInvalid),"errorMessage"in e&&n(4,l=e.errorMessage),"onFilesChanged"in e&&n(6,c=e.onFilesChanged)},e.$$.update=()=>{96&e.$$.dirty&&void 0!==i&&c?.(i)},[r,s,o,a,l,i,c,function(){i=this.files,n(5,i)}]}class Tr extends Ye{constructor(e){super(),Xe(this,e,Pr,kr,a,{accept:0,label:1,multiple:2,filesInvalid:3,errorMessage:4,onFilesChanged:6})}}function _r(t){let n,i,r,s,o,a;return o=new Sn({}),{c(){n=P("div"),i=P("div"),i.innerHTML='

Scanning Package

\n

This may take a bit. Don't close this tab.

',r=_(),s=P("div"),_e(o.$$.fragment),X(i,"class","text-center"),X(s,"class","h-6"),X(n,"class","bg-gray-100 dark:bg-gray-800 rounded-xl drop-shadow-md p-8 flex flex-col items-center gap-8")},m(e,t){$(e,n,t),v(n,i),v(n,r),v(n,s),Ze(o,s,null),a=!0},p:e,i(e){a||(be(o.$$.fragment,e),a=!0)},o(e){we(o.$$.fragment,e),a=!1},d(e){e&&Q(n),Ce(o)}}}class Zr extends Ye{constructor(e){super(),Xe(this,e,null,_r,a,{})}}function Cr(e){let t,n;return t=new Je({props:{$$slots:{default:[Xr]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function Xr(e){let t,n;return t=new Zr({}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function Yr(e){let t,n,i,r,s,o,a,l,c,h;i=new Wt({props:{title:"Scan package for issues"}}),a=new Tr({props:{label:"Upload a package",errorMessage:"Not a valid package",onFilesChanged:e[2],accept:".package",filesInvalid:e[1],multiple:!1}});let u=e[0]&&Cr(e);return{c(){t=P("div"),n=P("div"),_e(i.$$.fragment),r=_(),s=P("div"),s.innerHTML='

Select a TS4 package file, and its contents will be shown. If any issues\n with meta data are found, they will be displayed. Note that TDESC\n validation is not yet available.

\n

A lack of warnings does not guarantee that everything is working; the\n scanner cannot check logic.

',o=_(),_e(a.$$.fragment),l=_(),u&&u.c(),c=Z(),X(s,"class","my-8"),X(n,"class","max-w-2xl"),X(t,"class","flex justify-center items-center h-full w-full px-4")},m(e,d){$(e,t,d),v(t,n),Ze(i,n,null),v(n,r),v(n,s),v(n,o),Ze(a,n,null),$(e,l,d),u&&u.m(e,d),$(e,c,d),h=!0},p(e,[t]){const n={};2&t&&(n.filesInvalid=e[1]),a.$set(n),e[0]?u?1&t&&be(u,1):(u=Cr(e),u.c(),be(u,1),u.m(c.parentNode,c)):u&&(me(),we(u,1,1,(()=>{u=null})),ge())},i(e){h||(be(i.$$.fragment,e),be(a.$$.fragment,e),be(u),h=!0)},o(e){we(i.$$.fragment,e),we(a.$$.fragment,e),we(u),h=!1},d(e){e&&Q(t),Ce(i),Ce(a),e&&Q(l),u&&u.d(e),e&&Q(c)}}}function Rr(e,t,n){const{Buffer:i}=window.NodeJS;let r=!1,s=!1;return[r,s,async function(e){if(e.length<1)return;n(0,r=!0),n(1,s=!1);const t=i.from(await e[0].arrayBuffer()),o=e[0].name;n(1,s=!await Rt.loadPackage(t,o)),n(0,r=!1)}]}class qr extends Ye{constructor(e){super(),Xe(this,e,Rr,Yr,a,{})}}function Ar(e){let t,n,i,r,s=e[0].width+"",o=e[0].height+"";return{c(){t=P("p"),n=T(s),i=T(" x "),r=T(o),X(t,"class","mt-2 text-subtle text-center text-sm")},m(e,s){$(e,t,s),v(t,n),v(t,i),v(t,r)},p(e,t){1&t&&s!==(s=e[0].width+"")&&R(n,s),1&t&&o!==(o=e[0].height+"")&&R(r,o)},d(e){e&&Q(t)}}}function Wr(t){let n,i,r,s,o,a=t[0].width&&t[0].height&&Ar(t);return{c(){n=P("div"),i=P("div"),r=P("img"),o=_(),a&&a.c(),c(r.src,s=t[0].pngBase64)||X(r,"src",s),X(r,"alt","Preview"),X(r,"class","max-w-full max-h-full border border-solid border-black dark:border-white"),X(i,"class","text-center"),X(n,"class","w-full h-full overflow-auto flex items-center justify-center")},m(e,t){$(e,n,t),v(n,i),v(i,r),v(i,o),a&&a.m(i,null)},p(e,[t]){1&t&&!c(r.src,s=e[0].pngBase64)&&X(r,"src",s),e[0].width&&e[0].height?a?a.p(e,t):(a=Ar(e),a.c(),a.m(i,null)):a&&(a.d(1),a=null)},i:e,o:e,d(e){e&&Q(n),a&&a.d()}}}function Er(e,t,n){let{info:i}=t;return e.$$set=e=>{"info"in e&&n(0,i=e.info)},[i]}class jr extends Ye{constructor(e){super(),Xe(this,e,Er,Wr,a,{info:0})}}function zr(e,t,n){const i=e.slice();return i[6]=t[n],i}function Dr(e){let t,n,i,r,s,o,a,l=e[2](e[6].key)+"",c=e[6].value+"";return{c(){t=P("li"),n=P("p"),i=T(l),r=_(),s=P("p"),o=T(c),a=_(),X(n,"class","inline monospace text-subtle text-sm"),X(s,"class","inline text-sm"),X(t,"class","mb-3")},m(e,l){$(e,t,l),v(t,n),v(n,i),v(t,r),v(t,s),v(s,o),v(t,a)},p(e,t){1&t&&l!==(l=e[2](e[6].key)+"")&&R(i,l),1&t&&c!==(c=e[6].value+"")&&R(o,c)},d(e){e&&Q(t)}}}function Ur(t){let n,i,r,s,o,a,l=t[0].entries,c=[];for(let e=0;e{"info"in e&&n(0,l=e.info)},e.$$.update=()=>{1&e.$$.dirty&&n(4,i=o[l.locale]??"Unknown"),1&e.$$.dirty&&n(3,r=1===l.entries.length?"1 entry":`${l.entries.length} entries`),24&e.$$.dirty&&n(1,s=`${i} String Table (${r})`)},[l,s,a,r,i]}class Ir extends Ye{constructor(e){super(),Xe(this,e,Vr,Ur,a,{info:0})}}function Mr(t){let n,i,r,s,o,a,l,c,h,u,d,f,O,p,m=t[0].resourceKey+"",g=t[0].displayName+"";return{c(){n=P("div"),i=P("p"),r=T("["),s=T(m),o=T("] "),a=T(g),l=_(),c=P("div"),h=P("div"),u=P("h2"),d=T(t[1]),f=_(),O=P("p"),p=T(t[2]),X(i,"class","text-xs text-subtle whitespace-nowrap text-ellipsis overflow-hidden"),X(n,"class","absolute top-0 left-0 right-0 h-8 flex items-center pl-2"),X(u,"class","mb-4 text-2xl font-bold text-subtle"),X(O,"class","text-subtle"),X(h,"class","text-center"),X(c,"class","absolute top-8 bottom-0 left-0 right-0 p-2 flex items-center justify-center")},m(e,t){$(e,n,t),v(n,i),v(i,r),v(i,s),v(i,o),v(i,a),$(e,l,t),$(e,c,t),v(c,h),v(h,u),v(u,d),v(h,f),v(h,O),v(O,p)},p(e,[t]){1&t&&m!==(m=e[0].resourceKey+"")&&R(s,m),1&t&&g!==(g=e[0].displayName+"")&&R(a,g),2&t&&R(d,e[1]),4&t&&R(p,e[2])},i:e,o:e,d(e){e&&Q(n),e&&Q(l),e&&Q(c)}}}function Gr(e,t,n){let{info:i}=t,{title:r}=t,{description:s}=t;return e.$$set=e=>{"info"in e&&n(0,i=e.info),"title"in e&&n(1,r=e.title),"description"in e&&n(2,s=e.description)},[i,r,s]}class Br extends Ye{constructor(e){super(),Xe(this,e,Gr,Mr,a,{info:0,title:1,description:2})}}class Nr{constructor(){}lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){let i=[];return this.decompose(0,e,i,2),n.length&&n.decompose(0,n.length,i,3),this.decompose(t,this.length,i,1),Fr.from(i,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){let n=[];return this.decompose(e,t,n,0),Fr.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),i=new Jr(this),r=new Jr(e);for(let e=t,s=t;;){if(i.next(e),r.next(e),e=0,i.lineBreak!=r.lineBreak||i.done!=r.done||i.value!=r.value)return!1;if(s+=i.value.length,i.done||s>=n)return!0}}iter(e=1){return new Jr(this,e)}iterRange(e,t=this.length){return new es(this,e,t)}iterLines(e,t){let n;if(null==e)n=this.iter();else{null==t&&(t=this.lines+1);let i=this.line(e).from;n=this.iterRange(i,Math.max(i,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ts(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}static of(e){if(0==e.length)throw new RangeError("A document must have at least one line");return 1!=e.length||e[0]?e.length<=32?new Lr(e):Fr.from(Lr.split(e,[])):Nr.empty}}class Lr extends Nr{constructor(e,t=function(e){let t=-1;for(let n of e)t+=n.length+1;return t}(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,i){for(let r=0;;r++){let s=this.text[r],o=i+s.length;if((t?n:o)>=e)return new ns(i,o,n,s);i=o+1,n++}}decompose(e,t,n,i){let r=e<=0&&t>=this.length?this:new Lr(Kr(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(1&i){let e=n.pop(),t=Hr(r.text,e.text.slice(),0,r.length);if(t.length<=32)n.push(new Lr(t,e.length+r.length));else{let e=t.length>>1;n.push(new Lr(t.slice(0,e)),new Lr(t.slice(e)))}}else n.push(r)}replace(e,t,n){if(!(n instanceof Lr))return super.replace(e,t,n);let i=Hr(this.text,Hr(n.text,Kr(this.text,0,e)),t),r=this.length+n.length-(t-e);return i.length<=32?new Lr(i,r):Fr.from(Lr.split(i,[]),r)}sliceString(e,t=this.length,n="\n"){let i="";for(let r=0,s=0;r<=t&&se&&s&&(i+=n),er&&(i+=o.slice(Math.max(0,e-r),t-r)),r=a+1}return i}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let n=[],i=-1;for(let r of e)n.push(r),i+=r.length+1,32==n.length&&(t.push(new Lr(n,i)),n=[],i=-1);return i>-1&&t.push(new Lr(n,i)),t}}class Fr extends Nr{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,i){for(let r=0;;r++){let s=this.children[r],o=i+s.length,a=n+s.lines-1;if((t?a:o)>=e)return s.lineInner(e,t,n,i);i=o+1,n=a+1}}decompose(e,t,n,i){for(let r=0,s=0;s<=t&&r=s){let r=i&((s<=e?1:0)|(a>=t?2:0));s>=e&&a<=t&&!r?n.push(o):o.decompose(e-s,t-s,n,r)}s=a+1}}replace(e,t,n){if(n.lines=r&&t<=o){let a=s.replace(e-r,t-r,n),l=this.lines-s.lines+a.lines;if(a.lines>4&&a.lines>l>>6){let r=this.children.slice();return r[i]=a,new Fr(r,this.length-(t-e)+n.length)}return super.replace(r,o,a)}r=o+1}return super.replace(e,t,n)}sliceString(e,t=this.length,n="\n"){let i="";for(let r=0,s=0;re&&r&&(i+=n),es&&(i+=o.sliceString(e-s,t-s,n)),s=a+1}return i}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Fr))return 0;let n=0,[i,r,s,o]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;i+=t,r+=t){if(i==s||r==o)return n;let a=this.children[i],l=e.children[r];if(a!=l)return n+a.scanIdentical(l,t);n+=a.length+1}}static from(e,t=e.reduce(((e,t)=>e+t.length+1),-1)){let n=0;for(let t of e)n+=t.lines;if(n<32){let n=[];for(let t of e)t.flatten(n);return new Lr(n,t)}let i=Math.max(32,n>>5),r=i<<1,s=i>>1,o=[],a=0,l=-1,c=[];function h(e){let t;if(e.lines>r&&e instanceof Fr)for(let t of e.children)h(t);else e.lines>s&&(a>s||!a)?(u(),o.push(e)):e instanceof Lr&&a&&(t=c[c.length-1])instanceof Lr&&e.lines+t.lines<=32?(a+=e.lines,l+=e.length+1,c[c.length-1]=new Lr(t.text.concat(e.text),t.length+1+e.length)):(a+e.lines>i&&u(),a+=e.lines,l+=e.length+1,c.push(e))}function u(){0!=a&&(o.push(1==c.length?c[0]:Fr.from(c,l)),l=-1,a=c.length=0)}for(let t of e)h(t);return u(),1==o.length?o[0]:new Fr(o,t)}}function Hr(e,t,n=0,i=1e9){for(let r=0,s=0,o=!0;s=n&&(l>i&&(a=a.slice(0,i-r)),r0?1:(e instanceof Lr?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,i=this.nodes[n],r=this.offsets[n],s=r>>1,o=i instanceof Lr?i.text.length:i.children.length;if(s==(t>0?o:0)){if(0==n)return this.done=!0,this.value="",this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((1&r)==(t>0?0:1)){if(this.offsets[n]+=t,0==e)return this.lineBreak=!0,this.value="\n",this;e--}else if(i instanceof Lr){let r=i.text[s+(t<0?-1:0)];if(this.offsets[n]+=t,r.length>Math.max(0,e))return this.value=0==e?r:t>0?r.slice(e):r.slice(0,r.length-e),this;e-=r.length}else{let r=i.children[s+(t<0?-1:0)];e>r.length?(e-=r.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(r),this.offsets.push(t>0?1:(r instanceof Lr?r.text.length:r.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class es{constructor(e,t,n){this.value="",this.done=!1,this.cursor=new Jr(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:i}=this.cursor.next(e);return this.pos+=(i.length+e)*t,this.value=i.length<=n?i:t<0?i.slice(i.length-n):i.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&""!=this.value}}class ts{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:n,value:i}=this.inner.next(e);return t?(this.done=!0,this.value=""):n?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=i,this.afterBreak=!1),this}get lineBreak(){return!1}}"undefined"!=typeof Symbol&&(Nr.prototype[Symbol.iterator]=function(){return this.iter()},Jr.prototype[Symbol.iterator]=es.prototype[Symbol.iterator]=ts.prototype[Symbol.iterator]=function(){return this});class ns{constructor(e,t,n,i){this.from=e,this.to=t,this.number=n,this.text=i}get length(){return this.to-this.from}}let is="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map((e=>e?parseInt(e,36):1));for(let e=1;ee)return is[t-1]<=e;return!1}function ss(e){return e>=127462&&e<=127487}function os(e,t,n=!0,i=!0){return(n?as:ls)(e,t,i)}function as(e,t,n){if(t==e.length)return t;t&&cs(e.charCodeAt(t))&&hs(e.charCodeAt(t-1))&&t--;let i=us(e,t);for(t+=fs(i);t=0&&ss(us(e,i));)n++,i-=2;if(n%2==0)break;t+=2}}}return t}function ls(e,t,n){for(;t>0;){let i=as(e,t-2,n);if(i=56320&&e<57344}function hs(e){return e>=55296&&e<56320}function us(e,t){let n=e.charCodeAt(t);if(!hs(n)||t+1==e.length)return n;let i=e.charCodeAt(t+1);return cs(i)?i-56320+(n-55296<<10)+65536:n}function ds(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10),56320+(1023&e)))}function fs(e){return e<65536?1:2}const Os=/\r\n?|\n/;var ps=function(e){return e[e.Simple=0]="Simple",e[e.TrackDel=1]="TrackDel",e[e.TrackBefore=2]="TrackBefore",e[e.TrackAfter=3]="TrackAfter",e}(ps||(ps={}));class ms{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return r+(e-i);r+=o}else{if(n!=ps.Simple&&l>=e&&(n==ps.TrackDel&&ie||n==ps.TrackBefore&&ie))return null;if(l>e||l==e&&t<0&&!o)return e==i||t<0?r:r+a;r+=a}i=l}if(e>i)throw new RangeError(`Position ${e} is out of range for changeset of length ${i}`);return r}touchesRange(e,t=e){for(let n=0,i=0;n=0&&i<=t&&r>=e)return!(it)||"cover";i=r}return!1}toString(){let e="";for(let t=0;t=0?":"+i:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some((e=>"number"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeDesc");return new ms(e)}static create(e){return new ms(e)}}class gs extends ms{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return xs(this,((t,n,i,r,s)=>e=e.replace(i,i+(n-t),s)),!1),e}mapDesc(e,t=!1){return vs(this,e,t,!0)}invert(e){let t=this.sections.slice(),n=[];for(let i=0,r=0;i=0){t[i]=o,t[i+1]=s;let a=i>>1;for(;n.length0&&ws(n,t,r.text),r.forward(e),o+=e}let l=e[s++];for(;o>1].toJSON()))}return e}static of(e,t,n){let i=[],r=[],s=0,o=null;function a(e=!1){if(!e&&!i.length)return;so||e<0||o>t)throw new RangeError(`Invalid change range ${e} to ${o} (in doc of length ${t})`);let h=c?"string"==typeof c?Nr.of(c.split(n||Os)):c:Nr.empty,u=h.length;if(e==o&&0==u)return;es&&bs(i,e-s,-1),bs(i,o-e,u),ws(r,i,h),s=o}}(e),a(!o),o}static empty(e){return new gs(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],n=[];for(let i=0;it&&"string"!=typeof e)))throw new RangeError("Invalid JSON representation of ChangeSet");if(1==r.length)t.push(r[0],0);else{for(;n.length=0&&n<=0&&n==e[r+1]?e[r]+=t:0==t&&0==e[r]?e[r+1]+=n:i?(e[r]+=t,e[r+1]+=n):e.push(t,n)}function ws(e,t,n){if(0==n.length)return;let i=t.length-2>>1;if(i>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)a=e.sections[o++],l=e.sections[o++];t(r,c,s,h,u),r=c,s=h}}}function vs(e,t,n,i=!1){let r=[],s=i?[]:null,o=new Ss(e),a=new Ss(t);for(let e=-1;;)if(-1==o.ins&&-1==a.ins){let e=Math.min(o.len,a.len);bs(r,e,-1),o.forward(e),a.forward(e)}else if(a.ins>=0&&(o.ins<0||e==o.i||0==o.off&&(a.len=0&&e=0)){if(o.done&&a.done)return s?gs.createSet(r,s):ms.create(r);throw new Error("Mismatched change set lengths")}{let t=0,n=o.len;for(;n;)if(-1==a.ins){let e=Math.min(n,a.len);t+=e,n-=e,a.forward(e)}else{if(!(0==a.ins&&a.lent||o.ins>=0&&o.len>t)&&(e||i.length>n),s.forward2(t),o.forward(t)}}else bs(i,0,o.ins,e),r&&ws(r,i,o.text),o.next()}}class Ss{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?Nr.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Nr.empty:t[n].slice(this.off,null==e?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){-1==this.ins?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class $s{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return 16&this.flags?this.to:this.from}get head(){return 16&this.flags?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return 4&this.flags?-1:8&this.flags?1:0}get bidiLevel(){let e=3&this.flags;return 3==e?null:e}get goalColumn(){let e=this.flags>>5;return 33554431==e?void 0:e}map(e,t=-1){let n,i;return this.empty?n=i=e.mapPos(this.from,t):(n=e.mapPos(this.from,1),i=e.mapPos(this.to,-1)),n==this.from&&i==this.to?this:new $s(n,i,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return Qs.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return Qs.range(this.anchor,n)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||"number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid JSON representation for SelectionRange");return Qs.range(e.anchor,e.head)}static create(e,t,n){return new $s(e,t,n)}}class Qs{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:Qs.create(this.ranges.map((n=>n.map(e,t))),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let t=0;te.toJSON())),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||"number"!=typeof e.main||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new Qs(e.ranges.map((e=>$s.fromJSON(e))),e.main)}static single(e,t=e){return new Qs([Qs.range(e,t)],0)}static create(e,t=0){if(0==e.length)throw new RangeError("A selection needs at least one range");for(let n=0,i=0;ie?4:0))}static normalized(e,t=0){let n=e[t];e.sort(((e,t)=>e.from-t.from)),t=e.indexOf(n);for(let n=1;ni.head?Qs.range(o,s):Qs.range(s,o))}}return new Qs(e,t)}}function ks(e,t){for(let n of e.ranges)if(n.to>t)throw new RangeError("Selection points outside of document")}let Ps=0;class Ts{constructor(e,t,n,i,r){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=i,this.id=Ps++,this.default=e([]),this.extensions="function"==typeof r?r(this):r}static define(e={}){return new Ts(e.combine||(e=>e),e.compareInput||((e,t)=>e===t),e.compare||(e.combine?(e,t)=>e===t:_s),!!e.static,e.enables)}of(e){return new Zs([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Zs(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Zs(e,this,2,t)}from(e,t){return t||(t=e=>e),this.compute([e],(n=>t(n.field(e))))}}function _s(e,t){return e==t||e.length==t.length&&e.every(((e,n)=>e===t[n]))}class Zs{constructor(e,t,n,i){this.dependencies=e,this.facet=t,this.type=n,this.value=i,this.id=Ps++}dynamicSlot(e){var t;let n=this.value,i=this.facet.compareInput,r=this.id,s=e[r]>>1,o=2==this.type,a=!1,l=!1,c=[];for(let n of this.dependencies)"doc"==n?a=!0:"selection"==n?l=!0:0==(1&(null!==(t=e[n.id])&&void 0!==t?t:1))&&c.push(e[n.id]);return{create:e=>(e.values[s]=n(e),1),update(e,t){if(a&&t.docChanged||l&&(t.docChanged||t.selection)||Xs(e,c)){let t=n(e);if(o?!Cs(t,e.values[s],i):!i(t,e.values[s]))return e.values[s]=t,1}return 0},reconfigure:(e,t)=>{let a,l=t.config.address[r];if(null!=l){let r=Bs(t,l);if(this.dependencies.every((n=>n instanceof Ts?t.facet(n)===e.facet(n):!(n instanceof qs)||t.field(n,!1)==e.field(n,!1)))||(o?Cs(a=n(e),r,i):i(a=n(e),r)))return e.values[s]=r,0}else a=n(e);return e.values[s]=a,1}}}}function Cs(e,t,n){if(e.length!=t.length)return!1;for(let i=0;ie[t.id])),r=n.map((e=>e.type)),s=i.filter((e=>!(1&e))),o=e[t.id]>>1;function a(e){let n=[];for(let t=0;te===t),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(Rs).find((e=>e.field==this));return((null==t?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let i=e.values[t],r=this.updateF(i,n);return this.compareF(i,r)?0:(e.values[t]=r,1)},reconfigure:(e,n)=>null!=n.config.address[this.id]?(e.values[t]=n.field(this),0):(e.values[t]=this.create(e),1)}}init(e){return[this,Rs.of({field:this,create:e})]}get extension(){return this}}const As=4,Ws=3,Es=2,js=1;function zs(e){return t=>new Us(t,e)}const Ds={highest:zs(0),high:zs(js),default:zs(Es),low:zs(Ws),lowest:zs(As)};class Us{constructor(e,t){this.inner=e,this.prec=t}}class Vs{of(e){return new Is(this,e)}reconfigure(e){return Vs.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Is{constructor(e,t){this.compartment=e,this.inner=t}}class Ms{constructor(e,t,n,i,r,s){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=i,this.staticValues=r,this.facets=s,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,n){let i=[],r=Object.create(null),s=new Map;for(let n of function(e,t,n){let i=[[],[],[],[],[]],r=new Map;function s(e,o){let a=r.get(e);if(null!=a){if(a<=o)return;let t=i[a].indexOf(e);t>-1&&i[a].splice(t,1),e instanceof Is&&n.delete(e.compartment)}if(r.set(e,o),Array.isArray(e))for(let t of e)s(t,o);else if(e instanceof Is){if(n.has(e.compartment))throw new RangeError("Duplicate use of compartment in extensions");let i=t.get(e.compartment)||e.inner;n.set(e.compartment,i),s(i,o)}else if(e instanceof Us)s(e.inner,e.prec);else if(e instanceof qs)i[o].push(e),e.provides&&s(e.provides,o);else if(e instanceof Zs)i[o].push(e),e.facet.extensions&&s(e.facet.extensions,Es);else{let t=e.extension;if(!t)throw new Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(t,o)}}return s(e,Es),i.reduce(((e,t)=>e.concat(t)))}(e,t,s))n instanceof qs?i.push(n):(r[n.facet.id]||(r[n.facet.id]=[])).push(n);let o=Object.create(null),a=[],l=[];for(let e of i)o[e.id]=l.length<<1,l.push((t=>e.slot(t)));let c=null==n?void 0:n.config.facets;for(let e in r){let t=r[e],i=t[0].facet,s=c&&c[e]||[];if(t.every((e=>0==e.type)))if(o[i.id]=a.length<<1|1,_s(s,t))a.push(n.facet(i));else{let e=i.combine(t.map((e=>e.value)));a.push(n&&i.compare(e,n.facet(i))?n.facet(i):e)}else{for(let e of t)0==e.type?(o[e.id]=a.length<<1|1,a.push(e.value)):(o[e.id]=l.length<<1,l.push((t=>e.dynamicSlot(t))));o[i.id]=l.length<<1,l.push((e=>Ys(e,i,t)))}}let h=l.map((e=>e(o)));return new Ms(e,s,h,o,a,r)}}function Gs(e,t){if(1&t)return 2;let n=t>>1,i=e.status[n];if(4==i)throw new Error("Cyclic dependency between fields and/or facets");if(2&i)return i;e.status[n]=4;let r=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|r}function Bs(e,t){return 1&t?e.config.staticValues[t>>1]:e.values[t>>1]}const Ns=Ts.define(),Ls=Ts.define({combine:e=>e.some((e=>e)),static:!0}),Fs=Ts.define({combine:e=>e.length?e[0]:void 0,static:!0}),Hs=Ts.define(),Ks=Ts.define(),Js=Ts.define(),eo=Ts.define({combine:e=>!!e.length&&e[0]});class to{constructor(e,t){this.type=e,this.value=t}static define(){return new no}}class no{of(e){return new to(this,e)}}class io{constructor(e){this.map=e}of(e){return new ro(this,e)}}class ro{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return void 0===t?void 0:t==this.value?this:new ro(this.type,t)}is(e){return this.type==e}static define(e={}){return new io(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let i of e){let e=i.map(t);e&&n.push(e)}return n}}ro.reconfigure=ro.define(),ro.appendConfig=ro.define();class so{constructor(e,t,n,i,r,s){this.startState=e,this.changes=t,this.selection=n,this.effects=i,this.annotations=r,this.scrollIntoView=s,this._doc=null,this._state=null,n&&ks(n,t.newLength),r.some((e=>e.type==so.time))||(this.annotations=r.concat(so.time.of(Date.now())))}static create(e,t,n,i,r,s){return new so(e,t,n,i,r,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(so.userEvent);return!(!t||!(t==e||t.length>e.length&&t.slice(0,e.length)==e&&"."==t[e.length]))}}function oo(e,t){let n=[];for(let i=0,r=0;;){let s,o;if(i=e[i]))s=e[i++],o=e[i++];else{if(!(r=0;r--){let s=n[r](e);s&&Object.keys(s).length&&(i=ao(i,lo(t,s,e.changes.newLength),!0))}return i==e?e:so.create(t,e.changes,e.selection,i.effects,i.annotations,i.scrollIntoView)}(n?function(e){let t=e.startState,n=!0;for(let i of t.facet(Hs)){let t=i(e);if(!1===t){n=!1;break}Array.isArray(t)&&(n=!0===n?t:oo(n,t))}if(!0!==n){let i,r;if(!1===n)r=e.changes.invertedDesc,i=gs.empty(t.doc.length);else{let t=e.changes.filter(n);i=t.changes,r=t.filtered.mapDesc(t.changes).invertedDesc}e=so.create(t,i,e.selection&&e.selection.map(r),ro.mapEffects(e.effects,r),e.annotations,e.scrollIntoView)}let i=t.facet(Ks);for(let n=i.length-1;n>=0;n--){let r=i[n](e);e=r instanceof so?r:Array.isArray(r)&&1==r.length&&r[0]instanceof so?r[0]:co(t,uo(r),!1)}return e}(r):r)}so.time=to.define(),so.userEvent=to.define(),so.addToHistory=to.define(),so.remote=to.define();const ho=[];function uo(e){return null==e?ho:Array.isArray(e)?e:[e]}var fo=function(e){return e[e.Word=0]="Word",e[e.Space=1]="Space",e[e.Other=2]="Other",e}(fo||(fo={}));const Oo=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let po;try{po=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch(e){}function mo(e){return t=>{if(!/\S/.test(t))return fo.Space;if(function(e){if(po)return po.test(e);for(let t=0;t"€"&&(n.toUpperCase()!=n.toLowerCase()||Oo.test(n)))return!0}return!1}(t))return fo.Word;for(let n=0;n-1)return fo.Word;return fo.Other}}class go{constructor(e,t,n,i,r,s){this.config=e,this.doc=t,this.selection=n,this.values=i,this.status=e.statusTemplate.slice(),this.computeSlot=r,s&&(s._state=this);for(let e=0;er.set(t,e))),n=null),r.set(t.value.compartment,t.value.extension)):t.is(ro.reconfigure)?(n=null,i=t.value):t.is(ro.appendConfig)&&(n=null,i=uo(i).concat(t.value));if(n)t=e.startState.values.slice();else{n=Ms.resolve(i,r,this),t=new go(n,this.doc,this.selection,n.dynamicSlots.map((()=>null)),((e,t)=>t.reconfigure(e,this)),null).values}new go(n,e.newDoc,e.newSelection,t,((t,n)=>n.update(t,e)),e)}replaceSelection(e){return"string"==typeof e&&(e=this.toText(e)),this.changeByRange((t=>({changes:{from:t.from,to:t.to,insert:e},range:Qs.cursor(t.from+e.length)})))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),i=this.changes(n.changes),r=[n.range],s=uo(n.effects);for(let n=1;nr.spec.fromJSON(s,e))))}return go.create({doc:e.doc,selection:Qs.fromJSON(e.selection),extensions:t.extensions?i.concat([t.extensions]):i})}static create(e={}){let t=Ms.resolve(e.extensions||[],new Map),n=e.doc instanceof Nr?e.doc:Nr.of((e.doc||"").split(t.staticFacet(go.lineSeparator)||Os)),i=e.selection?e.selection instanceof Qs?e.selection:Qs.single(e.selection.anchor,e.selection.head):Qs.single(0);return ks(i,n.length),t.staticFacet(Ls)||(i=i.asSingle()),new go(t,n,i,t.dynamicSlots.map((()=>null)),((e,t)=>t.create(e)),null)}get tabSize(){return this.facet(go.tabSize)}get lineBreak(){return this.facet(go.lineSeparator)||"\n"}get readOnly(){return this.facet(eo)}phrase(e,...t){for(let t of this.facet(go.phrases))if(Object.prototype.hasOwnProperty.call(t,e)){e=t[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,((e,n)=>{if("$"==n)return"$";let i=+(n||1);return!i||i>t.length?e:t[i-1]}))),e}languageDataAt(e,t,n=-1){let i=[];for(let r of this.facet(Ns))for(let s of r(this,t,n))Object.prototype.hasOwnProperty.call(s,e)&&i.push(s[e]);return i}charCategorizer(e){return mo(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:t,from:n,length:i}=this.doc.lineAt(e),r=this.charCategorizer(e),s=e-n,o=e-n;for(;s>0;){let e=os(t,s,!1);if(r(t.slice(e,s))!=fo.Word)break;s=e}for(;oe.length?e[0]:4}),go.lineSeparator=Fs,go.readOnly=eo,go.phrases=Ts.define({compare(e,t){let n=Object.keys(e),i=Object.keys(t);return n.length==i.length&&n.every((n=>e[n]==t[n]))}}),go.languageData=Ns,go.changeFilter=Hs,go.transactionFilter=Ks,go.transactionExtender=Js,Vs.reconfigure=ro.define();class wo{eq(e){return this==e}range(e,t=e){return xo.create(e,t,this)}}wo.prototype.startSide=wo.prototype.endSide=0,wo.prototype.point=!1,wo.prototype.mapMode=ps.TrackDel;class xo{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(e,t,n){return new xo(e,t,n)}}function vo(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}class yo{constructor(e,t,n,i){this.from=e,this.to=t,this.value=n,this.maxPoint=i}get length(){return this.to[this.to.length-1]}findIndex(e,t,n,i=0){let r=n?this.to:this.from;for(let s=i,o=r.length;;){if(s==o)return s;let i=s+o>>1,a=r[i]-e||(n?this.value[i].endSide:this.value[i].startSide)-t;if(i==s)return a>=0?s:o;a>=0?o=i:s=i+1}}between(e,t,n,i){for(let r=this.findIndex(t,-1e9,!0),s=this.findIndex(n,1e9,!1,r);rc||l==c&&h.startSide>0&&h.endSide<=0)continue;(c-l||h.endSide-h.startSide)<0||(s<0&&(s=l),h.point&&(o=Math.max(o,c-l)),n.push(h),i.push(l-s),r.push(c-s))}return{mapped:n.length?new yo(i,r,n,o):null,pos:s}}}class So{constructor(e,t,n,i){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=i}static create(e,t,n,i){return new So(e,t,n,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:n=!1,filterFrom:i=0,filterTo:r=this.length}=e,s=e.filter;if(0==t.length&&!s)return this;if(n&&(t=t.slice().sort(vo)),this.isEmpty)return t.length?So.of(t):this;let o=new ko(this,null,-1).goto(0),a=0,l=[],c=new $o;for(;o.value||a=0){let e=t[a++];c.addInner(e.from,e.to,e.value)||l.push(e)}else 1==o.rangeIndex&&o.chunkIndexthis.chunkEnd(o.chunkIndex)||ro.to||r=r&&e<=r+s.length&&!1===s.between(r,e-r,t-r,n))return}this.nextLayer.between(e,t,n)}}iter(e=0){return Po.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Po.from(e).goto(t)}static compare(e,t,n,i,r=-1){let s=e.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=r)),o=t.filter((e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=r)),a=Qo(s,o,n),l=new _o(s,a,r),c=new _o(o,a,r);n.iterGaps(((e,t,n)=>Zo(l,e,c,t,n,i))),n.empty&&0==n.length&&Zo(l,0,c,0,0,i)}static eq(e,t,n=0,i){null==i&&(i=999999999);let r=e.filter((e=>!e.isEmpty&&t.indexOf(e)<0)),s=t.filter((t=>!t.isEmpty&&e.indexOf(t)<0));if(r.length!=s.length)return!1;if(!r.length)return!0;let o=Qo(r,s),a=new _o(r,o,0).goto(n),l=new _o(s,o,0).goto(n);for(;;){if(a.to!=l.to||!Co(a.active,l.active)||a.point&&(!l.point||!a.point.eq(l.point)))return!1;if(a.to>i)return!0;a.next(),l.next()}}static spans(e,t,n,i,r=-1){let s=new _o(e,null,r).goto(t),o=t,a=s.openStart;for(;;){let e=Math.min(s.to,n);if(s.point){let n=s.activeForPoint(s.to),r=s.pointFromo&&(i.span(o,e,s.active,a),a=s.openEnd(e));if(s.to>n)return a+(s.point&&s.to>n?1:0);o=s.to,s.next()}}static of(e,t=!1){let n=new $o;for(let i of e instanceof xo?[e]:t?function(e){if(e.length>1)for(let t=e[0],n=1;n0)return e.slice().sort(vo);t=i}return e}(e):e)n.add(i.from,i.to,i.value);return n.finish()}}So.empty=new So([],[],null,-1),So.empty.nextLayer=So.empty;class $o{constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}finishChunk(e){this.chunks.push(new yo(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}add(e,t,n){this.addInner(e,t,n)||(this.nextLayer||(this.nextLayer=new $o)).add(e,t,n)}addInner(e,t,n){let i=e-this.lastTo||n.startSide-this.last.endSide;if(i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return!(i<0)&&(250==this.from.length&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(So.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),0==this.chunks.length)return e;let t=So.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Qo(e,t,n){let i=new Map;for(let t of e)for(let e=0;e=this.minPoint)break}}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=n&&i.push(new ko(s,t,n,r));return 1==i.length?i[0]:new Po(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)To(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)To(this.heap,e);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(0==this.heap.length)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),To(this.heap,0)}}}function To(e,t){for(let n=e[t];;){let i=1+(t<<1);if(i>=e.length)break;let r=e[i];if(i+1=0&&(r=e[i+1],i++),n.compare(r)<0)break;e[i]=n,e[t]=r,t=i}}class _o{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Po.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){Xo(this.active,e),Xo(this.activeTo,e),Xo(this.activeRank,e),this.minActive=Ro(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:i,rank:r}=this.cursor;for(;t-1&&(this.activeTo[i]-this.cursor.from||this.active[i].endSide-this.cursor.startSide)<0){if(this.activeTo[i]>e){this.to=this.activeTo[i],this.endSide=this.active[i].endSide;break}this.removeActive(i),n&&Xo(n,i)}else{if(!this.cursor.value){this.to=this.endSide=1e9;break}if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}{let e=this.cursor.value;if(e.point){if(!(t&&this.cursor.to==this.to&&this.cursor.from=0&&n[t]=0&&!(this.activeRank[n]e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}}function Zo(e,t,n,i,r,s){e.goto(t),n.goto(i);let o=i+r,a=i,l=i-t;for(;;){let t=e.to+l-n.to||e.endSide-n.endSide,i=t<0?e.to+l:n.to,r=Math.min(i,o);if(e.point||n.point?e.point&&n.point&&(e.point==n.point||e.point.eq(n.point))&&Co(e.activeForPoint(e.to+l),n.activeForPoint(n.to))||s.comparePoint(a,r,e.point,n.point):r>a&&!Co(e.active,n.active)&&s.compareRange(a,r,e.active,n.active),i>o)break;a=i,t<=0&&e.next(),t>=0&&n.next()}}function Co(e,t){if(e.length!=t.length)return!1;for(let n=0;n=t;n--)e[n+1]=e[n];e[t]=n}function Ro(e,t){let n=-1,i=1e9;for(let r=0;r=t)return i;if(i==e.length)break;r+=9==e.charCodeAt(i)?n-r%n:1,i=os(e,i)}return!0===i?-1:e.length}const Wo="undefined"==typeof Symbol?"__ͼ":Symbol.for("ͼ"),Eo="undefined"==typeof Symbol?"__styleSet"+Math.floor(1e8*Math.random()):Symbol("styleSet"),jo="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:{};class zo{constructor(e,t){this.rules=[];let{finish:n}=t||{};function i(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function r(e,t,s,o){let a=[],l=/^@(\w+)\b/.exec(e[0]),c=l&&"keyframes"==l[1];if(l&&null==t)return s.push(e[0]+";");for(let n in t){let o=t[n];if(/&/.test(n))r(n.split(/,\s*/).map((t=>e.map((e=>t.replace(/&/,e))))).reduce(((e,t)=>e.concat(t))),o,s);else if(o&&"object"==typeof o){if(!l)throw new RangeError("The value of a property ("+n+") should be a primitive value.");r(i(n),o,a,c)}else null!=o&&a.push(n.replace(/_.*/,"").replace(/[A-Z]/g,(e=>"-"+e.toLowerCase()))+": "+o+";")}(a.length||c)&&s.push((!n||l||o?e:e.map(n)).join(", ")+" {"+a.join(" ")+"}")}for(let t in e)r(i(t),e[t],this.rules)}getRules(){return this.rules.join("\n")}static newName(){let e=jo[Wo]||1;return jo[Wo]=e+1,"ͼ"+e.toString(36)}static mount(e,t,n){let i=e[Eo],r=n&&n.nonce;i?r&&i.setNonce(r):i=new Uo(e,r),i.mount(Array.isArray(t)?t:[t])}}let Do=new Map;class Uo{constructor(e,t){let n=e.ownerDocument||e,i=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&i.CSSStyleSheet){let t=Do.get(n);if(t)return e.adoptedStyleSheets=[t.sheet,...e.adoptedStyleSheets],e[Eo]=t;this.sheet=new i.CSSStyleSheet,e.adoptedStyleSheets=[this.sheet,...e.adoptedStyleSheets],Do.set(n,this)}else{this.styleTag=n.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);let i=e.head||e;i.insertBefore(this.styleTag,i.firstChild)}this.modules=[],e[Eo]=this}mount(e){let t=this.sheet,n=0,i=0;for(let r=0;r-1&&(this.modules.splice(o,1),i--,o=-1),-1==o){if(this.modules.splice(i++,0,s),t)for(let e=0;e",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Mo="undefined"!=typeof navigator&&/Chrome\/(\d+)/.exec(navigator.userAgent);"undefined"!=typeof navigator&&/Gecko\/\d+/.test(navigator.userAgent);for(var Go="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Bo="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),No=Go||Mo&&+Mo[1]<57,Lo=0;Lo<10;Lo++)Vo[48+Lo]=Vo[96+Lo]=String(Lo);for(Lo=1;Lo<=24;Lo++)Vo[Lo+111]="F"+Lo;for(Lo=65;Lo<=90;Lo++)Vo[Lo]=String.fromCharCode(Lo+32),Io[Lo]=String.fromCharCode(Lo);for(var Fo in Vo)Io.hasOwnProperty(Fo)||(Io[Fo]=Vo[Fo]);function Ho(e){let t;return t=11==e.nodeType?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function Ko(e,t){return!!t&&(e==t||e.contains(1!=t.nodeType?t.parentNode:t))}function Jo(e,t){if(!t.anchorNode)return!1;try{return Ko(e,t.anchorNode)}catch(e){return!1}}function ea(e){return 3==e.nodeType?ua(e,0,e.nodeValue.length).getClientRects():1==e.nodeType?e.getClientRects():[]}function ta(e,t,n,i){return!!n&&(ia(e,t,n,i,-1)||ia(e,t,n,i,1))}function na(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t}function ia(e,t,n,i,r){for(;;){if(e==n&&t==i)return!0;if(t==(r<0?0:ra(e))){if("DIV"==e.nodeName)return!1;let n=e.parentNode;if(!n||1!=n.nodeType)return!1;t=na(e)+(r<0?0:1),e=n}else{if(1!=e.nodeType)return!1;if(1==(e=e.childNodes[t+(r<0?-1:0)]).nodeType&&"false"==e.contentEditable)return!1;t=r<0?ra(e):0}}}function ra(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function sa(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function oa(e){return{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}class aa{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?ra(t):0),n,Math.min(e.focusOffset,n?ra(n):0))}set(e,t,n,i){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=i}}let la,ca=null;function ha(e){if(e.setActive)return e.setActive();if(ca)return e.focus(ca);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(null==ca?{get preventScroll(){return ca={preventScroll:!0},!0}}:void 0),!ca){ca=!1;for(let e=0;eMath.max(1,e.scrollHeight-e.clientHeight-4)}class pa{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(e,t){return new pa(e.parentNode,na(e),t)}static after(e,t){return new pa(e.parentNode,na(e)+1,t)}}const ma=[];class ga{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let t=this.posAtStart;for(let n of this.children){if(n==e)return t;t+=n.length+n.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,t){if(2&this.flags){let n,i=this.dom,r=null;for(let s of this.children){if(7&s.flags){if(!s.dom&&(n=r?r.nextSibling:i.firstChild)){let e=ga.get(n);(!e||!e.parent&&e.canReuseDOM(s))&&s.reuseDOM(n)}s.sync(e,t),s.flags&=-8}if(n=r?r.nextSibling:i.firstChild,t&&!t.written&&t.node==i&&n!=s.dom&&(t.written=!0),s.dom.parentNode==i)for(;n&&n!=s.dom;)n=ba(n);else i.insertBefore(s.dom,n);r=s.dom}for(n=r?r.nextSibling:i.firstChild,n&&t&&t.node==i&&(t.written=!0);n;)n=ba(n)}else if(1&this.flags)for(let n of this.children)7&n.flags&&(n.sync(e,t),n.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,t){let n;if(e==this.dom)n=this.dom.childNodes[t];else{let i=0==ra(e)?0:0==t?-1:1;for(;;){let t=e.parentNode;if(t==this.dom)break;0==i&&t.firstChild!=t.lastChild&&(i=e==t.firstChild?-1:1),e=t}n=i<0?e:e.nextSibling}if(n==this.dom.firstChild)return 0;for(;n&&!ga.get(n);)n=n.nextSibling;if(!n)return this.length;for(let e=0,t=0;;e++){let i=this.children[e];if(i.dom==n)return t;t+=i.length+i.breakAfter}}domBoundsAround(e,t,n=0){let i=-1,r=-1,s=-1,o=-1;for(let a=0,l=n,c=n;at)return n.domBoundsAround(e,t,l);if(h>=e&&-1==i&&(i=a,r=l),l>t&&n.dom.parentNode==this.dom){s=a,o=c;break}c=h,l=h+n.breakAfter}return{from:r,to:o<0?n+this.length:o,startDOM:(i?this.children[i-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:s=0?this.children[s].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),1&t.flags)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,7&this.flags&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,n=ma){this.markDirty();for(let n=e;nthis.pos||e==this.pos&&(t>0||0==this.i||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}}function xa(e,t,n,i,r,s,o,a,l){let{children:c}=e,h=c.length?c[t]:null,u=s.length?s[s.length-1]:null,d=u?u.breakAfter:o;if(!(t==i&&h&&!o&&!d&&s.length<2&&h.merge(n,r,s.length?u:null,0==n,a,l))){if(i0&&(!o&&s.length&&h.merge(n,h.length,s[0],!1,a,0)?h.breakAfter=s.shift().breakAfter:(n2);var Ya={mac:Xa||/Mac/.test(ya.platform),windows:/Win/.test(ya.platform),linux:/Linux|X11/.test(ya.platform),ie:Pa,ie_version:Qa?Sa.documentMode||6:ka?+ka[1]:$a?+$a[1]:0,gecko:Ta,gecko_version:Ta?+(/Firefox\/(\d+)/.exec(ya.userAgent)||[0,0])[1]:0,chrome:!!_a,chrome_version:_a?+_a[1]:0,ios:Xa,android:/Android\b/.test(ya.userAgent),webkit:Za,safari:Ca,webkit_version:Za?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:null!=Sa.documentElement.style.tabSize?"tab-size":"-moz-tab-size"};class Ra extends ga{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,t){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(t&&t.node==this.dom&&(t.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){3==e.nodeType&&this.createDOM(e)}merge(e,t,n){return!(8&this.flags||n&&(!(n instanceof Ra)||this.length-(t-e)+n.length>256||8&n.flags))&&(this.text=this.text.slice(0,e)+(n?n.text:"")+this.text.slice(t),this.markDirty(),!0)}split(e){let t=new Ra(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),t.flags|=8&this.flags,t}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new pa(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return function(e,t,n){let i=e.nodeValue.length;t>i&&(t=i);let r=t,s=t,o=0;0==t&&n<0||t==i&&n>=0?Ya.chrome||Ya.gecko||(t?(r--,o=1):s=0)?0:a.length-1];Ya.safari&&!o&&0==l.width&&(l=Array.prototype.find.call(a,(e=>e.width))||l);return o?sa(l,o<0):l||null}(this.dom,e,t)}}class qa extends ga{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let e of t)e.setParent(this)}setAttrs(e){if(fa(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!(8&(this.flags|e.flags))}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?4&this.flags&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(e,t,n,i,r,s){return(!n||!(!(n instanceof qa&&n.mark.eq(this.mark))||e&&r<=0||te&&t.push(n=e&&(i=r),n=o,r++}let s=this.length-e;return this.length=e,i>-1&&(this.children.length=i,this.markDirty()),new qa(this.mark,t,s)}domAtPos(e){return Ea(this,e)}coordsAt(e,t){return za(this,e,t)}}class Aa extends ga{static create(e,t,n){return new Aa(e,t,n)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(e){let t=Aa.create(this.widget,this.length-e,this.side);return this.length-=e,t}sync(e){this.dom&&this.widget.updateDOM(this.dom,e)||(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.dom.contentEditable="false")}getSide(){return this.side}merge(e,t,n,i,r,s){return!(n&&(!(n instanceof Aa&&this.widget.compare(n.widget))||e>0&&r<=0||t0)?pa.before(this.dom):pa.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let i=this.dom.getClientRects(),r=null;if(!i.length)return null;let s=this.side?this.side<0:e>0;for(let t=s?i.length-1:0;r=i[t],!(e>0?0==t:t==i.length-1||r.top0?pa.before(this.dom):pa.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Nr.empty}get isHidden(){return!0}}function Ea(e,t){let n=e.dom,{children:i}=e,r=0;for(let e=0;re&&t0;e--){let t=i[e-1];if(t.dom.parentNode==n)return t.domAtPos(t.length)}for(let e=r;e0&&t instanceof qa&&r.length&&(i=r[r.length-1])instanceof qa&&i.mark.eq(t.mark)?ja(i,t.children[0],n-1):(r.push(t),t.setParent(e)),e.length+=t.length}function za(e,t,n){let i=null,r=-1,s=null,o=-1;!function e(t,a){for(let l=0,c=0;l=a&&(h.children.length?e(h,a-c):(!s||s.isHidden&&n>0)&&(u>a||c==u&&h.getSide()>0)?(s=h,o=a-c):(c-1?1:0)!=r.length-(n&&r.indexOf(n)>-1?1:0))return!1;for(let s of i)if(s!=n&&(-1==r.indexOf(s)||e[s]!==t[s]))return!1;return!0}function Ia(e,t,n){let i=!1;if(t)for(let r in t)n&&r in n||(i=!0,"style"==r?e.style.cssText="":e.removeAttribute(r));if(n)for(let r in n)t&&t[r]==n[r]||(i=!0,"style"==r?e.style.cssText=n[r]:e.setAttribute(r,n[r]));return i}function Ma(e){let t=Object.create(null);for(let n=0;n0&&0==this.children[n-1].length;)this.children[--n].destroy();return this.children.length=n,this.markDirty(),this.length=e,t}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=void 0===this.prevAttrs?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){Va(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){ja(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=Da(t,this.attrs||{})),n&&(this.attrs=Da({class:n},this.attrs||{}))}domAtPos(e){return Ea(this,e)}reuseDOM(e){"DIV"==e.nodeName&&(this.setDOM(e),this.flags|=6)}sync(e,t){var n;this.dom?4&this.flags&&(fa(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),void 0!==this.prevAttrs&&(Ia(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,t);let i=this.dom.lastChild;for(;i&&ga.get(i)instanceof qa;)i=i.lastChild;if(!(i&&this.length&&("BR"==i.nodeName||0!=(null===(n=ga.get(i))||void 0===n?void 0:n.isEditable)||Ya.ios&&this.children.some((e=>e instanceof Ra))))){let e=document.createElement("BR");e.cmIgnore=!0,this.dom.appendChild(e)}}measureTextSize(){if(0==this.children.length||this.length>20)return null;let e,t=0;for(let n of this.children){if(!(n instanceof Ra)||/[^ -~]/.test(n.text))return null;let i=ea(n.dom);if(1!=i.length)return null;t+=i[0].width,e=i[0].height}return t?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:t/this.length,textHeight:e}:null}coordsAt(e,t){let n=za(this,e,t);if(!this.children.length&&n&&this.parent){let{heightOracle:e}=this.parent.view.viewState,t=n.bottom-n.top;if(Math.abs(t-e.lineHeight)<2&&e.textHeight=t){if(r instanceof Ga)return r;if(s>t)break}i=s+r.breakAfter}return null}}class Ba extends ga{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(e,t,n,i,r,s){return!(n&&(!(n instanceof Ba&&this.widget.compare(n.widget))||e>0&&r<=0||t0)}}class Na{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}destroy(e){}}var La=function(e){return e[e.Text=0]="Text",e[e.WidgetBefore=1]="WidgetBefore",e[e.WidgetAfter=2]="WidgetAfter",e[e.WidgetRange=3]="WidgetRange",e}(La||(La={}));class Fa extends wo{constructor(e,t,n,i){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=i}get heightRelevant(){return!1}static mark(e){return new Ha(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Ja(e,t,t,n,e.widget||null,!1)}static replace(e){let t,n,i=!!e.block;if(e.isBlockGap)t=-5e8,n=4e8;else{let{start:r,end:s}=el(e,i);t=(r?i?-3e8:-1:5e8)-1,n=1+(s?i?2e8:1:-6e8)}return new Ja(e,t,n,i,e.widget||null,!0)}static line(e){return new Ka(e)}static set(e,t=!1){return So.of(e,t)}hasHeight(){return!!this.widget&&this.widget.estimatedHeight>-1}}Fa.none=So.empty;class Ha extends Fa{constructor(e){let{start:t,end:n}=el(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var t,n;return this==e||e instanceof Ha&&this.tagName==e.tagName&&(this.class||(null===(t=this.attrs)||void 0===t?void 0:t.class))==(e.class||(null===(n=e.attrs)||void 0===n?void 0:n.class))&&Va(this.attrs,e.attrs,"class")}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Ha.prototype.point=!1;class Ka extends Fa{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Ka&&this.spec.class==e.spec.class&&Va(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}Ka.prototype.mapMode=ps.TrackBefore,Ka.prototype.point=!0;class Ja extends Fa{constructor(e,t,n,i,r,s){super(t,n,r,e),this.block=i,this.isReplace=s,this.mapMode=i?t<=0?ps.TrackBefore:ps.TrackAfter:ps.TrackDel}get type(){return this.startSide!=this.endSide?La.WidgetRange:this.startSide<=0?La.WidgetBefore:La.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Ja&&(t=this.widget,n=e.widget,t==n||!!(t&&n&&t.compare(n)))&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide;var t,n}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}function el(e,t=!1){let{inclusiveStart:n,inclusiveEnd:i}=e;return null==n&&(n=e.inclusive),null==i&&(i=e.inclusive),{start:null!=n?n:t,end:null!=i?i:t}}function tl(e,t,n,i=0){let r=n.length-1;r>=0&&n[r]+i>=e?n[r]=Math.max(n[r],t):n.push(e,t)}Ja.prototype.point=!0;class nl{constructor(e,t,n,i){this.doc=e,this.pos=t,this.end=n,this.disallowBlockEffectsFor=i,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(0==this.content.length)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof Ba&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new Ga),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(il(new Wa(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||e&&this.content.length&&this.content[this.content.length-1]instanceof Ba||this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:i}=this.cursor.next(this.skip);if(this.skip=0,i)throw new Error("Ran out of text content when drawing inline views");if(n){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}this.text=t,this.textOff=0}let i=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(il(new Ra(this.text.slice(this.textOff,this.textOff+i)),t),n),this.atCursorPos=!0,this.textOff+=i,e-=i,n=0}}span(e,t,n,i){this.buildText(t-e,n,i),this.pos=t,this.openStart<0&&(this.openStart=i)}point(e,t,n,i,r,s){if(this.disallowBlockEffectsFor[s]&&n instanceof Ja){if(n.block)throw new RangeError("Block decorations may not be specified via plugins");if(t>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let o=t-e;if(n instanceof Ja)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new Ba(n.widget||new rl("div"),o,n));else{let s=Aa.create(n.widget||new rl("span"),o,o?0:n.startSide),a=this.atCursorPos&&!s.isEditable&&r<=i.length&&(e0),l=!s.isEditable&&(ei.length||n.startSide<=0),c=this.getLine();2!=this.pendingBuffer||a||s.isEditable||(this.pendingBuffer=0),this.flushBuffer(i),a&&(c.append(il(new Wa(1),i),r),r=i.length+Math.max(0,r-i.length)),c.append(il(s,i),r),this.atCursorPos=l,this.pendingBuffer=l?ei.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=i.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);o&&(this.textOff+o<=this.text.length?this.textOff+=o:(this.skip+=o-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=r)}static build(e,t,n,i,r){let s=new nl(e,t,n,r);return s.openEnd=So.spans(i,t,n,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}}function il(e,t){for(let n of t)e=new qa(n,[e],e.length);return e}class rl extends Na{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}const sl=Ts.define(),ol=Ts.define(),al=Ts.define(),ll=Ts.define(),cl=Ts.define(),hl=Ts.define(),ul=Ts.define(),dl=Ts.define({combine:e=>e.some((e=>e))}),fl=Ts.define({combine:e=>e.some((e=>e))});class Ol{constructor(e,t="nearest",n="nearest",i=5,r=5){this.range=e,this.y=t,this.x=n,this.yMargin=i,this.xMargin=r}map(e){return e.empty?this:new Ol(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin)}}const pl=ro.define({map:(e,t)=>e.map(t)});function ml(e,t,n){let i=e.facet(ll);i.length?i[0](t):window.onerror?window.onerror(String(t),n,void 0,void 0,t):n?console.error(n+":",t):console.error(t)}const gl=Ts.define({combine:e=>!e.length||e[0]});let bl=0;const wl=Ts.define();class xl{constructor(e,t,n,i,r){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=i,this.extension=r(this)}static define(e,t){const{eventHandlers:n,eventObservers:i,provide:r,decorations:s}=t||{};return new xl(bl++,e,n,i,(e=>{let t=[wl.of(e)];return s&&t.push($l.of((t=>{let n=t.plugin(e);return n?s(n):Fa.none}))),r&&t.push(r(e)),t}))}static fromClass(e,t){return xl.define((t=>new e(t)),t)}}class vl{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(ml(e.state,t,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch(e){}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(t){ml(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(null===(t=this.value)||void 0===t?void 0:t.destroy)try{this.value.destroy()}catch(t){ml(e.state,t,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const yl=Ts.define(),Sl=Ts.define(),$l=Ts.define(),Ql=Ts.define(),kl=Ts.define();function Pl(e,t,n){let i=e.state.facet(kl);if(!i.length)return i;let r=i.map((t=>t instanceof Function?t(e):t)),s=[];return So.spans(r,t,n,{point(){},span(e,t,n,i){let r=s;for(let s=n.length-1;s>=0;s--,i--){let o,a=n[s].spec.bidiIsolate;if(null!=a)if(i>0&&r.length&&(o=r[r.length-1]).to==e&&o.direction==a)o.to=t,r=o.inner;else{let n={from:e,to:t,direction:a,inner:[]};r.push(n),r=n.inner}}}}),s}const Tl=Ts.define();function _l(e){let t=0,n=0,i=0,r=0;for(let s of e.state.facet(Tl)){let o=s(e);o&&(null!=o.left&&(t=Math.max(t,o.left)),null!=o.right&&(n=Math.max(n,o.right)),null!=o.top&&(i=Math.max(i,o.top)),null!=o.bottom&&(r=Math.max(r,o.bottom)))}return{left:t,right:n,top:i,bottom:r}}const Zl=Ts.define();class Cl{constructor(e,t,n,i){this.fromA=e,this.toA=t,this.fromB=n,this.toB=i}join(e){return new Cl(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let i=e[t-1];if(!(i.fromA>n.toA)){if(i.toAc)break;r+=2}if(!a)return n;new Cl(a.fromA,a.toA,a.fromB,a.toB).addToSet(n),s=a.toA,o=a.toB}}}class Xl{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=gs.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let i=[];this.changes.iterChangedRanges(((e,t,n,r)=>i.push(new Cl(e,t,n,r)))),this.changedRanges=i}static create(e,t,n){return new Xl(e,t,n)}get viewportChanged(){return(4&this.flags)>0}get heightChanged(){return(2&this.flags)>0}get geometryChanged(){return this.docChanged||(10&this.flags)>0}get focusChanged(){return(1&this.flags)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some((e=>e.selection))}get empty(){return 0==this.flags&&0==this.transactions.length}}var Yl=function(e){return e[e.LTR=0]="LTR",e[e.RTL=1]="RTL",e}(Yl||(Yl={}));const Rl=Yl.LTR,ql=Yl.RTL;function Al(e){let t=[];for(let n=0;n=t){if(o.level==n)return s;(r<0||(0!=i?i<0?o.fromt:e[r].level>o.level))&&(r=s)}}if(r<0)throw new RangeError("Index out of range");return r}}function Vl(e,t){if(e.length!=t.length)return!1;for(let n=0;nl&&o.push(new Ul(l,O.from,d)),Gl(e,O.direction==Rl!=!(d%2)?i+1:i,r,O.inner,O.from,O.to,o),l=O.to}f=O.to}else{if(f==n||(t?Il[f]!=a:Il[f]==a))break;f++}u?Ml(e,l,f,i+1,r,u,o):lt;){let n=!0,h=!1;if(!c||l>s[c-1].to){let e=Il[l-1];e!=a&&(n=!1,h=16==e)}let u=n||1!=a?null:[],d=n?i:i+1,f=l;e:for(;;)if(c&&f==s[c-1].to){if(h)break e;let O=s[--c];if(!n)for(let e=O.from,n=c;;){if(e==t)break e;if(!n||s[n-1].to!=e){if(Il[e-1]==a)break e;break}e=s[--n].from}if(u)u.push(O);else{O.to=0;e-=3)if(zl[e+1]==-n){let t=zl[e+2],n=2&t?r:4&t?1&t?s:r:0;n&&(Il[o]=Il[zl[e]]=n),a=e;break}}else{if(189==zl.length)break;zl[a++]=o,zl[a++]=t,zl[a++]=l}else if(2==(i=Il[o])||1==i){let e=i==r;l=e?0:1;for(let t=a-3;t>=0;t-=3){let n=zl[t+2];if(2&n)break;if(e)zl[t+2]|=2;else{if(4&n)break;zl[t+2]|=4}}}}}(e,r,s,i,a),function(e,t,n,i){for(let r=0,s=i;r<=n.length;r++){let o=r?n[r-1].to:e,a=rl;)t==s&&(t=n[--i].from,s=i?n[i-1].to:e),Il[--t]=h;l=o}else s=o,l++}}}(r,s,i,a),Ml(e,r,s,t,n,i,o)}function Bl(e){return[new Ul(0,e,0)]}let Nl="";function Ll(e,t,n,i,r){var s;let o=i.head-e.from,a=-1;if(0==o){if(!r||!e.length)return null;t[0].level!=n&&(o=t[0].side(!1,n),a=0)}else if(o==e.length){if(r)return null;let e=t[t.length-1];e.level!=n&&(o=e.side(!0,n),a=t.length-1)}a<0&&(a=Ul.find(t,o,null!==(s=i.bidiLevel)&&void 0!==s?s:-1,i.assoc));let l=t[a];o==l.side(r,n)&&(l=t[a+=r?1:-1],o=l.side(!r,n));let c=r==(l.dir==n),h=os(e.text,o,c);if(Nl=e.text.slice(Math.min(o,h),Math.max(o,h)),h!=l.side(r,n))return Qs.cursor(h+e.from,c?-1:1,l.level);let u=a==(r?t.length-1:0)?null:t[a+(r?1:-1)];return u||l.level==n?u&&u.level0&&n.length&&(n.every((({fromA:e,toA:t})=>tthis.minWidthTo))?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let i=-1;this.view.inputState.composing>=0&&((null===(t=this.domChanged)||void 0===t?void 0:t.newSel)?i=this.domChanged.newSel.head:function(e,t){let n=!1;t&&e.iterChangedRanges(((e,i)=>{et.from&&(n=!0)}));return n}(e.changes,this.hasComposition)||e.selectionSet||(i=e.state.selection.main.head));let r=i>-1?function(e,t,n){let i=Kl(e,n);if(!i)return null;let{node:r,from:s,to:o}=i,a=r.nodeValue;if(/[\n\r]/.test(a))return null;if(e.state.doc.sliceString(i.from,i.to)!=a)return null;let l=t.invertedDesc,c=new Cl(l.mapPos(s),l.mapPos(o),s,o),h=[];for(let t=r.parentNode;;t=t.parentNode){let n=ga.get(t);if(n instanceof qa)h.push({node:t,deco:n.mark});else{if(n instanceof Ga||"DIV"==t.nodeName&&t.parentNode==e.contentDOM)return{range:c,text:r,marks:h,line:t};if(t==e.contentDOM)return null;h.push({node:t,deco:new Ha({inclusive:!0,attributes:Ma(t),tagName:t.tagName.toLowerCase()})})}}}(this.view,e.changes,i):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:t,to:i}=this.hasComposition;n=new Cl(t,i,e.changes.mapPos(t,-1),e.changes.mapPos(i,1)).addToSet(n.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Ya.ie||Ya.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let s=function(e,t,n){let i=new class{constructor(){this.changes=[]}compareRange(e,t){tl(e,t,this.changes)}comparePoint(e,t){tl(e,t,this.changes)}};return So.compare(e,t,n,i),i.changes}(this.decorations,this.updateDeco(),e.changes);return n=Cl.extendWithRanges(n,s),!!(7&this.flags||0!=n.length)&&(this.updateInner(n,e.startState.doc.length,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);let{observer:i}=this.view;i.ignore((()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let e=Ya.chrome||Ya.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,e),this.flags&=-8,e&&(e.written||i.selectionRange.focusNode!=e.node)&&(this.forceSelection=!0),this.dom.style.height=""})),this.markedForComposition.forEach((e=>e.flags&=-9));let r=[];if(this.view.viewport.from||this.view.viewport.to=0?i[e]:null;if(!t)break;let s,o,a,l,{fromA:c,toA:h,fromB:u,toB:d}=t;if(n&&n.range.fromBu){let e=nl.build(this.view.state.doc,u,n.range.fromB,this.decorations,this.dynamicDecorationMap),t=nl.build(this.view.state.doc,n.range.toB,d,this.decorations,this.dynamicDecorationMap);o=e.breakAtStart,a=e.openStart,l=t.openEnd;let i=this.compositionView(n);t.breakAtStart?i.breakAfter=1:t.content.length&&i.merge(i.length,i.length,t.content[0],!1,t.openStart,0)&&(i.breakAfter=t.content[0].breakAfter,t.content.shift()),e.content.length&&i.merge(0,0,e.content[e.content.length-1],!0,0,e.openEnd)&&e.content.pop(),s=e.content.concat(i).concat(t.content)}else({content:s,breakAtStart:o,openStart:a,openEnd:l}=nl.build(this.view.state.doc,u,d,this.decorations,this.dynamicDecorationMap));let{i:f,off:O}=r.findPos(h,1),{i:p,off:m}=r.findPos(c,-1);xa(this,p,m,f,O,s,o,a,l)}n&&this.fixCompositionDOM(n)}compositionView(e){let t=new Ra(e.text.nodeValue);t.flags|=8;for(let{deco:n}of e.marks)t=new qa(n,[t],t.length);let n=new Ga;return n.append(t,0),n}fixCompositionDOM(e){let t=(e,t)=>{t.flags|=8|(t.children.some((e=>7&e.flags))?1:0),this.markedForComposition.add(t);let n=ga.get(e);n&&n!=t&&(n.dom=null),t.setDOM(e)},n=this.childPos(e.range.fromB,1),i=this.children[n.i];t(e.line,i);for(let r=e.marks.length-1;r>=-1;r--)n=i.childPos(n.off,1),i=i.children[n.i],t(r>=0?e.marks[r].node:e.text,i)}updateSelection(e=!1,t=!1){!e&&this.view.observer.selectionRange.focusNode||this.view.observer.readSelectionRange();let n=this.view.root.activeElement,i=n==this.dom,r=!i&&Jo(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(i||t||r))return;let s=this.forceSelection;this.forceSelection=!1;let o=this.view.state.selection.main,a=this.moveToLine(this.domAtPos(o.anchor)),l=o.empty?a:this.moveToLine(this.domAtPos(o.head));if(Ya.gecko&&o.empty&&!this.hasComposition&&(1==(c=a).node.nodeType&&c.node.firstChild&&(0==c.offset||"false"==c.node.childNodes[c.offset-1].contentEditable)&&(c.offset==c.node.childNodes.length||"false"==c.node.childNodes[c.offset].contentEditable))){let e=document.createTextNode("");this.view.observer.ignore((()=>a.node.insertBefore(e,a.node.childNodes[a.offset]||null))),a=l=new pa(e,0),s=!0}var c;let h=this.view.observer.selectionRange;!s&&h.focusNode&&ta(a.node,a.offset,h.anchorNode,h.anchorOffset)&&ta(l.node,l.offset,h.focusNode,h.focusOffset)||(this.view.observer.ignore((()=>{Ya.android&&Ya.chrome&&this.dom.contains(h.focusNode)&&function(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(1==n.nodeType&&"false"==n.contentEditable)return!0;return!1}(h.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let e=Ho(this.view.root);if(e)if(o.empty){if(Ya.gecko){let e=(t=a.node,i=a.offset,1!=t.nodeType?0:(i&&"false"==t.childNodes[i-1].contentEditable?1:0)|(io.head&&([a,l]=[l,a]),t.setEnd(l.node,l.offset),t.setStart(a.node,a.offset),e.removeAllRanges(),e.addRange(t)}else;var t,i;r&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())})),this.view.observer.setSelectionRange(a,l)),this.impreciseAnchor=a.precise?null:new pa(h.anchorNode,h.anchorOffset),this.impreciseHead=l.precise?null:new pa(h.focusNode,h.focusOffset)}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,n=Ho(e.root),{anchorNode:i,anchorOffset:r}=e.observer.selectionRange;if(!(n&&t.empty&&t.assoc&&n.modify))return;let s=Ga.find(this,t.head);if(!s)return;let o=s.posAtStart;if(t.head==o||t.head==o+s.length)return;let a=this.coordsAt(t.head,-1),l=this.coordsAt(t.head,1);if(!a||!l||a.bottom>l.top)return;let c=this.domAtPos(t.head+t.assoc);n.collapse(c.node,c.offset),n.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let h=e.observer.selectionRange;e.docView.posFromDOM(h.anchorNode,h.anchorOffset)!=t.from&&n.collapse(i,r)}moveToLine(e){let t,n=this.dom;if(e.node!=n)return e;for(let i=e.offset;!t&&i=0;i--){let e=ga.get(n.childNodes[i]);e instanceof Ga&&(t=e.domAtPos(e.length))}return t?new pa(t.node,t.offset,!0):e}nearest(e){for(let t=e;t;){let e=ga.get(t);if(e&&e.rootView==this)return e;t=t.parentNode}return null}posFromDOM(e,t){let n=this.nearest(e);if(!n)throw new RangeError("Trying to find position for a DOM position outside of the document");return n.localPosFromDOM(e,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t=0;s--){let o=this.children[s],a=r-o.breakAfter,l=a-o.length;if(ae||o.covers(1))&&(!n||o instanceof Ga&&!(n instanceof Ga&&t>=0))&&(n=o,i=l),r=l}return n?n.coordsAt(e-i,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),i=this.children[t];if(!(i instanceof Ga))return null;for(;i.children.length;){let{i:e,off:t}=i.childPos(n,1);for(;;e++){if(e==i.children.length)return null;if((i=i.children[e]).length)break}n=t}if(!(i instanceof Ra))return null;let r=os(i.text,n);if(r==n)return null;let s=ua(i.dom,n,r).getClientRects();for(let e=0;eMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,a=this.view.textDirection==Yl.LTR;for(let e=0,l=0;li)break;if(e>=n){let n=c.dom.getBoundingClientRect();if(t.push(n.height),s){let t=c.dom.lastChild,i=t?ea(t):[];if(i.length){let t=i[i.length-1],s=a?t.right-n.left:n.right-t.left;s>o&&(o=s,this.minWidth=r,this.minWidthFrom=e,this.minWidthTo=h)}}}e=h+c.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return"rtl"==getComputedStyle(this.children[t].dom).direction?Yl.RTL:Yl.LTR}measureTextSize(){for(let e of this.children)if(e instanceof Ga){let t=e.measureTextSize();if(t)return t}let e,t,n,i=document.createElement("div");return i.className="cm-line",i.style.width="99999px",i.style.position="absolute",i.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore((()=>{this.dom.appendChild(i);let r=ea(i.firstChild)[0];e=i.getBoundingClientRect().height,t=r?r.width/27:7,n=r?r.height:e,i.remove()})),{lineHeight:e,charWidth:t,textHeight:n}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new wa(this.children,e,t)}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,i=0;;i++){let r=i==t.viewports.length?null:t.viewports[i],s=r?r.from-1:this.length;if(s>n){let i=(t.lineBlockAt(s).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(Fa.replace({widget:new Hl(i),block:!0,inclusive:!0,isBlockGap:!0}).range(n,s))}if(!r)break;n=r.to+1}return Fa.set(e)}updateDeco(){let e=this.view.state.facet($l).map(((e,t)=>(this.dynamicDecorationMap[t]="function"==typeof e)?e(this.view):e));for(let t=e.length;tn.anchor?-1:1);if(!i)return;!n.empty&&(t=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(i={left:Math.min(i.left,t.left),top:Math.min(i.top,t.top),right:Math.max(i.right,t.right),bottom:Math.max(i.bottom,t.bottom)});let r=_l(this.view),s={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom};!function(e,t,n,i,r,s,o,a){let l=e.ownerDocument,c=l.defaultView||window;for(let h=e,u=!1;h&&!u;)if(1==h.nodeType){let e,d=h==l.body,f=1,O=1;if(d)e=oa(c);else{if(/^(fixed|sticky)$/.test(getComputedStyle(h).position)&&(u=!0),h.scrollHeight<=h.clientHeight&&h.scrollWidth<=h.clientWidth){h=h.assignedSlot||h.parentNode;continue}let t=h.getBoundingClientRect();f=t.width/h.offsetWidth,O=t.height/h.offsetHeight,e={left:t.left,right:t.left+h.clientWidth*f,top:t.top,bottom:t.top+h.clientHeight*O}}let p=0,m=0;if("nearest"==r)t.top0&&t.bottom>e.bottom+m&&(m=t.bottom-e.bottom+m+o)):t.bottom>e.bottom&&(m=t.bottom-e.bottom+o,n<0&&t.top-m0&&t.right>e.right+p&&(p=t.right-e.right+p+s)):t.right>e.right&&(p=t.right-e.right+s,n<0&&t.left0))break;n=n.childNodes[i-1],i=ra(n)}if(n>=0)for(let i=e,r=t;;){if(3==i.nodeType)return{node:i,offset:r};if(!(1==i.nodeType&&r=0))break;i=i.childNodes[r],r=0}return null}function ec(e,t){return t.left>e?t.left-e:Math.max(0,e-t.right)}function tc(e,t){return t.top>e?t.top-e:Math.max(0,e-t.bottom)}function nc(e,t){return e.topt.top+1}function ic(e,t){return te.bottom?{top:e.top,left:e.left,right:e.right,bottom:t}:e}function sc(e,t,n){let i,r,s,o,a,l,c,h,u=!1;for(let d=e.firstChild;d;d=d.nextSibling){let e=ea(d);for(let f=0;fm||o==m&&s>p){i=d,r=O,s=p,o=m;let a=m?n0?f0)}0==p?n>O.bottom&&(!c||c.bottomO.top)&&(l=d,h=O):c&&nc(c,O)?c=rc(c,O.bottom):h&&nc(h,O)&&(h=ic(h,O.top))}}if(c&&c.bottom>=n?(i=a,r=c):h&&h.top<=n&&(i=l,r=h),!i)return{node:e,offset:0};let d=Math.max(r.left,Math.min(r.right,t));return 3==i.nodeType?oc(i,d,n):u&&"false"!=i.contentEditable?sc(i,d,n):{node:e,offset:Array.prototype.indexOf.call(e.childNodes,i)+(t>=(r.left+r.right)/2?1:0)}}function oc(e,t,n){let i=e.nodeValue.length,r=-1,s=1e9,o=0;for(let a=0;an?c.top-n:n-c.bottom)-1;if(c.left-1<=t&&c.right+1>=t&&h=(c.left+c.right)/2,i=n;if(Ya.chrome||Ya.gecko){ua(e,a).getBoundingClientRect().left==c.right&&(i=!n)}if(h<=0)return{node:e,offset:a+(i?1:0)};r=a+(i?1:0),s=h}}}return{node:e,offset:r>-1?r:o>0?e.nodeValue.length:0}}function ac(e,t,n,i=-1){var r,s;let o,a=e.contentDOM.getBoundingClientRect(),l=a.top+e.viewState.paddingTop,{docHeight:c}=e.viewState,{x:h,y:u}=t,d=u-l;if(d<0)return 0;if(d>c)return e.state.doc.length;for(let t=e.viewState.heightOracle.textHeight/2,r=!1;o=e.elementAtHeight(d),o.type!=La.Text;)for(;d=i>0?o.bottom+t:o.top-t,!(d>=0&&d<=c);){if(r)return n?null:0;r=!0,i=-i}u=l+d;let f=o.from;if(fe.viewport.to)return e.viewport.to==e.state.doc.length?e.state.doc.length:n?null:lc(e,a,o,h,u);let O=e.dom.ownerDocument,p=e.root.elementFromPoint?e.root:O,m=p.elementFromPoint(h,u);m&&!e.contentDOM.contains(m)&&(m=null),m||(h=Math.max(a.left+1,Math.min(a.right-1,h)),m=p.elementFromPoint(h,u),m&&!e.contentDOM.contains(m)&&(m=null));let g,b=-1;if(m&&0!=(null===(r=e.docView.nearest(m))||void 0===r?void 0:r.isEditable))if(O.caretPositionFromPoint){let e=O.caretPositionFromPoint(h,u);e&&({offsetNode:g,offset:b}=e)}else if(O.caretRangeFromPoint){let t=O.caretRangeFromPoint(h,u);t&&(({startContainer:g,startOffset:b}=t),(!e.contentDOM.contains(g)||Ya.safari&&function(e,t,n){let i;if(3!=e.nodeType||t!=(i=e.nodeValue.length))return!1;for(let t=e.nextSibling;t;t=t.nextSibling)if(1!=t.nodeType||"BR"!=t.nodeName)return!1;return ua(e,i-1,i).getBoundingClientRect().left>n}(g,b,h)||Ya.chrome&&function(e,t,n){if(0!=t)return!1;for(let t=e;;){let e=t.parentNode;if(!e||1!=e.nodeType||e.firstChild!=t)return!1;if(e.classList.contains("cm-line"))break;t=e}let i=1==e.nodeType?e.getBoundingClientRect():ua(e,0,Math.max(e.nodeValue.length,1)).getBoundingClientRect();return n-i.left>5}(g,b,h))&&(g=void 0))}if(!g||!e.docView.dom.contains(g)){let t=Ga.find(e.docView,f);if(!t)return d>o.top+o.height/2?o.to:o.from;({node:g,offset:b}=sc(t.dom,h,u))}let w=e.docView.nearest(g);if(!w)return null;if(w.isWidget&&1==(null===(s=w.dom)||void 0===s?void 0:s.nodeType)){let e=w.dom.getBoundingClientRect();return t.y1.5*e.defaultLineHeight){let t=e.viewState.heightOracle.textHeight;s+=Math.floor((r-n.top-.5*(e.defaultLineHeight-t))/t)*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+Ao(o,s,e.state.tabSize)}function cc(e,t){let n=e.lineBlockAt(t);if(Array.isArray(n.type))for(let e of n.type)if(e.to>t||e.to==t&&(e.to==n.to||e.type==La.Text))return e;return n}function hc(e,t,n,i){let r=e.state.doc.lineAt(t.head),s=e.bidiSpans(r),o=e.textDirectionAt(r.from);for(let a=t,l=null;;){let t=Ll(r,s,o,a,n),c=Nl;if(!t){if(r.number==(n?e.state.doc.lines:1))return a;c="\n",r=e.state.doc.line(r.number+(n?1:-1)),s=e.bidiSpans(r),t=Qs.cursor(n?r.from:r.to)}if(l){if(!l(c))return a}else{if(!i)return t;l=i(c)}a=t}}function uc(e,t,n){for(;;){let i=0;for(let r of e)r.between(t-1,t+1,((e,r,s)=>{if(t>e&&tt(e))),n.from,t.head>n.from?-1:1);return i==n.from?n:Qs.cursor(i,inull)),Ya.gecko&&function(e){zc.has(e)||(zc.add(e),e.addEventListener("copy",(()=>{})),e.addEventListener("cut",(()=>{})))}(e.contentDOM.ownerDocument)}handleEvent(e){(function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n,i=t.target;i!=e.contentDOM;i=i.parentNode)if(!i||11==i.nodeType||(n=ga.get(i))&&n.ignoreEvent(t))return!1;return!0})(this.view,e)&&!this.ignoreDuringComposition(e)&&("keydown"==e.type&&this.keydown(e)||this.runHandlers(e.type,e))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=pc(e),n=this.handlers,i=this.view.contentDOM;for(let e in t)if("scroll"!=e){let r=!t[e].handlers.length,s=n[e];s&&r!=!s.handlers.length&&(i.removeEventListener(e,this.handleEvent),s=null),s||i.addEventListener(e,this.handleEvent,{passive:r})}for(let e in n)"scroll"==e||t[e]||i.removeEventListener(e,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),9==e.keyCode&&Date.now()t.keyCode==e.keyCode)))&&!e.ctrlKey||gc.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(229!=e.keyCode&&this.view.observer.forceFlush(),!1):(this.pendingIOSKey=t||e,setTimeout((()=>this.flushIOSKey()),250),!0)}flushIOSKey(){let e=this.pendingIOSKey;return!!e&&(this.pendingIOSKey=void 0,da(this.view.contentDOM,e.key,e.keyCode))}ignoreDuringComposition(e){return!!/^key/.test(e.type)&&(this.composing>0||!!(Ya.safari&&!Ya.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100)&&(this.compositionPendingKey=!1,!0))}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.mouseSelection&&this.mouseSelection.update(e),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Oc(e,t){return(n,i)=>{try{return t.call(e,i,n)}catch(e){ml(n.state,e)}}}function pc(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec;if(e&&e.domEventHandlers)for(let i in e.domEventHandlers){let r=e.domEventHandlers[i];r&&n(i).handlers.push(Oc(t.value,r))}if(e&&e.domEventObservers)for(let i in e.domEventObservers){let r=e.domEventObservers[i];r&&n(i).observers.push(Oc(t.value,r))}}for(let e in vc)n(e).handlers.push(vc[e]);for(let e in yc)n(e).observers.push(yc[e]);return t}const mc=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],gc="dthko",bc=[16,17,18,20,91,92,224,225];function wc(e){return.7*Math.max(0,e)+8}class xc{constructor(e,t,n,i){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=i,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParent=function(e){let t=e.ownerDocument;for(let n=e.parentNode;n&&n!=t.body;)if(1==n.nodeType){if(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.assignedSlot||n.parentNode}else{if(11!=n.nodeType)break;n=n.host}return null}(e.contentDOM),this.atoms=e.state.facet(Ql).map((t=>t(e)));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(go.allowMultipleSelections)&&function(e,t){let n=e.state.facet(sl);return n.length?n[0](t):Ya.mac?t.metaKey:t.ctrlKey}(e,t),this.dragging=!(!function(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let i=Ho(e.root);if(!i||0==i.rangeCount)return!0;let r=i.getRangeAt(0).getClientRects();for(let e=0;e=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}(e,t)||1!=Rc(t))&&null}start(e){!1===this.dragging&&this.select(e)}move(e){var t,n,i;if(0==e.buttons)return this.destroy();if(this.dragging||null==this.dragging&&(n=this.startEvent,i=e,Math.max(Math.abs(n.clientX-i.clientX),Math.abs(n.clientY-i.clientY))<10))return;this.select(this.lastEvent=e);let r=0,s=0,o=(null===(t=this.scrollParent)||void 0===t?void 0:t.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},a=_l(this.view);e.clientX-a.left<=o.left+6?r=-wc(o.left-e.clientX):e.clientX+a.right>=o.right-6&&(r=wc(e.clientX-o.right)),e.clientY-a.top<=o.top+6?s=-wc(o.top-e.clientY):e.clientY+a.bottom>=o.bottom-6&&(s=wc(e.clientY-o.bottom)),this.setScrollSpeed(r,s)}up(e){null==this.dragging&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval((()=>this.scroll()),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),!1===this.dragging&&this.select(this.lastEvent)}skipAtoms(e){let t=null;for(let n=0;nthis.select(this.lastEvent)),20)}}const vc=Object.create(null),yc=Object.create(null),Sc=Ya.ie&&Ya.ie_version<15||Ya.ios&&Ya.webkit_version<604;function $c(e,t){let n,{state:i}=e,r=1,s=i.toText(t),o=s.lines==i.selection.ranges.length;if(null!=Ac&&i.selection.ranges.every((e=>e.empty))&&Ac==s.toString()){let e=-1;n=i.changeByRange((n=>{let a=i.doc.lineAt(n.from);if(a.from==e)return{range:n};e=a.from;let l=i.toText((o?s.line(r++).text:t)+i.lineBreak);return{changes:{from:a.from,insert:l},range:Qs.cursor(n.from+l.length)}}))}else n=o?i.changeByRange((e=>{let t=s.line(r++);return{changes:{from:e.from,to:e.to,insert:t.text},range:Qs.cursor(e.from+t.length)}})):i.replaceSelection(s);e.dispatch(n,{userEvent:"input.paste",scrollIntoView:!0})}function Qc(e,t,n,i){if(1==i)return Qs.cursor(t,n);if(2==i)return function(e,t,n=1){let i=e.charCategorizer(t),r=e.doc.lineAt(t),s=t-r.from;if(0==r.length)return Qs.cursor(t);0==s?n=1:s==r.length&&(n=-1);let o=s,a=s;n<0?o=os(r.text,s,!1):a=os(r.text,s);let l=i(r.text.slice(o,a));for(;o>0;){let e=os(r.text,o,!1);if(i(r.text.slice(e,o))!=l)break;o=e}for(;a{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},vc.keydown=(e,t)=>(e.inputState.setSelectionOrigin("select"),27==t.keyCode&&(e.inputState.lastEscPress=Date.now()),!1),yc.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin("select.pointer")},yc.touchmove=e=>{e.inputState.setSelectionOrigin("select.pointer")},vc.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let i of e.state.facet(al))if(n=i(e,t),n)break;if(n||0!=t.button||(n=function(e,t){let n=_c(e,t),i=Rc(t),r=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),r=r.map(e.changes))},get(t,s,o){let a,l=_c(e,t),c=Qc(e,l.pos,l.bias,i);if(n.pos!=l.pos&&!s){let t=Qc(e,n.pos,n.bias,i),r=Math.min(t.from,c.from),s=Math.max(t.to,c.to);c=r1&&(a=function(e,t){for(let n=0;n=t)return Qs.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}(r,l.pos))?a:o?r.addRange(c):Qs.create([c])}}}(e,t)),n){let i=!e.hasFocus;e.inputState.startMouseSelection(new xc(e,t,n,i)),i&&e.observer.ignore((()=>ha(e.contentDOM)));let r=e.inputState.mouseSelection;if(r)return r.start(t),!1===r.dragging}return!1};let kc=(e,t)=>e>=t.top&&e<=t.bottom,Pc=(e,t,n)=>kc(t,n)&&e>=n.left&&e<=n.right;function Tc(e,t,n,i){let r=Ga.find(e.docView,t);if(!r)return 1;let s=t-r.posAtStart;if(0==s)return 1;if(s==r.length)return-1;let o=r.coordsAt(s,-1);if(o&&Pc(n,i,o))return-1;let a=r.coordsAt(s,1);return a&&Pc(n,i,a)?1:o&&kc(i,o)?-1:1}function _c(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:n,bias:Tc(e,n,t.clientX,t.clientY)}}const Zc=Ya.ie&&Ya.ie_version<=11;let Cc=null,Xc=0,Yc=0;function Rc(e){if(!Zc)return e.detail;let t=Cc,n=Yc;return Cc=e,Yc=Date.now(),Xc=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(Xc+1)%3:1}function qc(e,t,n,i){if(!n)return;let r=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{mouseSelection:s}=e.inputState,o=i&&s&&s.dragging&&function(e,t){let n=e.state.facet(ol);return n.length?n[0](t):Ya.mac?!t.altKey:!t.ctrlKey}(e,t)?{from:s.dragging.from,to:s.dragging.to}:null,a={from:r,insert:n},l=e.state.changes(o?[o,a]:a);e.focus(),e.dispatch({changes:l,selection:{anchor:l.mapPos(r,-1),head:l.mapPos(r,1)},userEvent:o?"move.drop":"input.drop"})}vc.dragstart=(e,t)=>{let{selection:{main:n}}=e.state,{mouseSelection:i}=e.inputState;return i&&(i.dragging=n),t.dataTransfer&&(t.dataTransfer.setData("Text",e.state.sliceDoc(n.from,n.to)),t.dataTransfer.effectAllowed="copyMove"),!1},vc.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let i=Array(n.length),r=0,s=()=>{++r==n.length&&qc(e,t,i.filter((e=>null!=e)).join(e.state.lineBreak),!1)};for(let e=0;e{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(i[e]=t.result),s()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData("Text");if(n)return qc(e,t,n,!0),!0}return!1},vc.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=Sc?null:t.clipboardData;return n?($c(e,n.getData("text/plain")||n.getData("text/uri-text")),!0):(function(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout((()=>{e.focus(),n.remove(),$c(e,n.value)}),50)}(e),!1)};let Ac=null;vc.copy=vc.cut=(e,t)=>{let{text:n,ranges:i,linewise:r}=function(e){let t=[],n=[],i=!1;for(let i of e.selection.ranges)i.empty||(t.push(e.sliceDoc(i.from,i.to)),n.push(i));if(!t.length){let r=-1;for(let{from:i}of e.selection.ranges){let s=e.doc.lineAt(i);s.number>r&&(t.push(s.text),n.push({from:s.from,to:Math.min(e.doc.length,s.to+1)})),r=s.number}i=!0}return{text:t.join(e.lineBreak),ranges:n,linewise:i}}(e.state);if(!n&&!r)return!1;Ac=r?n:null,"cut"!=t.type||e.state.readOnly||e.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let s=Sc?null:t.clipboardData;return s?(s.clearData(),s.setData("text/plain",n),!0):(function(e,t){let n=e.dom.parentNode;if(!n)return;let i=n.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=t,i.focus(),i.selectionEnd=t.length,i.selectionStart=0,setTimeout((()=>{i.remove(),e.focus()}),50)}(e,n),!1)};const Wc=to.define();function Ec(e,t){let n=[];for(let i of e.facet(ul)){let r=i(e,t);r&&n.push(r)}return n?e.update({effects:n,annotations:Wc.of(!0)}):null}function jc(e){setTimeout((()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Ec(e.state,t);n?e.dispatch(n):e.update([])}}),10)}yc.focus=e=>{e.inputState.lastFocusTime=Date.now(),e.scrollDOM.scrollTop||!e.inputState.lastScrollTop&&!e.inputState.lastScrollLeft||(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),jc(e)},yc.blur=e=>{e.observer.clearSelectionRange(),jc(e)},yc.compositionstart=yc.compositionupdate=e=>{null==e.inputState.compositionFirstChange&&(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0)},yc.compositionend=e=>{e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,Ya.chrome&&Ya.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then((()=>e.observer.flush())):setTimeout((()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])}),50)},yc.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},vc.beforeinput=(e,t)=>{var n;let i;if(Ya.chrome&&Ya.android&&(i=mc.find((e=>e.inputType==t.inputType)))&&(e.observer.delayAndroidKey(i.key,i.keyCode),"Backspace"==i.key||"Delete"==i.key)){let t=(null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0;setTimeout((()=>{var n;((null===(n=window.visualViewport)||void 0===n?void 0:n.height)||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())}),100)}return!1};const zc=new Set;const Dc=["pre-wrap","normal","pre-line","break-spaces"];class Uc{constructor(e){this.lineWrapping=e,this.doc=Nr.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){if(!this.lineWrapping)return this.lineHeight;return(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return Dc.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n-1,a=Math.round(t)!=Math.round(this.lineHeight)||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=n,this.textHeight=i,this.lineLength=r,a){this.heightSamples={};for(let e=0;e0}set outdated(e){this.flags=(e?2:0)|-3&this.flags}setHeight(e,t){this.height!=t&&(Math.abs(this.height-t)>Gc&&(e.heightChanged=!0),this.height=t)}replace(e,t,n){return Bc.of(n)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,i){let r=this,s=n.doc;for(let o=i.length-1;o>=0;o--){let{fromA:a,toA:l,fromB:c,toB:h}=i[o],u=r.lineAt(a,Mc.ByPosNoHeight,n.setDoc(t),0,0),d=u.to>=l?u:r.lineAt(l,Mc.ByPosNoHeight,n,0,0);for(h+=d.to-l,l=d.to;o>0&&u.from<=i[o-1].toA;)a=i[o-1].fromA,c=i[o-1].fromB,o--,a2*r){let r=e[t-1];r.break?e.splice(--t,1,r.left,null,r.right):e.splice(--t,1,r.left,r.right),n+=1+r.break,i-=r.size}else{if(!(r>2*i))break;{let t=e[n];t.break?e.splice(n,1,t.left,null,t.right):e.splice(n,1,t.left,t.right),n+=2+t.break,r-=t.size}}else if(i=r&&s(this.blockAt(0,n,i,r))}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more&&this.setHeight(e,i.heights[i.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Lc extends Nc{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,i){return new Ic(i,this.length,n,this.height,this.breaks)}replace(e,t,n){let i=n[0];return 1==n.length&&(i instanceof Lc||i instanceof Fc&&4&i.flags)&&Math.abs(this.length-i.length)<10?(i instanceof Fc?i=new Lc(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):Bc.of(n)}updateHeight(e,t=0,n=!1,i){return i&&i.from<=t&&i.more?this.setHeight(e,i.heights[i.index++]):(n||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class Fc extends Bc{constructor(e){super(e,0)}heightMetrics(e,t){let n,i=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,s=r-i+1,o=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*s);n=t/s,this.length>s+1&&(o=(this.height-t)/(this.length-s-1))}else n=this.height/s;return{firstLine:i,lastLine:r,perLine:n,perChar:o}}blockAt(e,t,n,i){let{firstLine:r,lastLine:s,perLine:o,perChar:a}=this.heightMetrics(t,i);if(t.lineWrapping){let r=i+Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length),s=t.doc.lineAt(r),l=o+s.length*a,c=Math.max(n,e-l/2);return new Ic(s.from,s.length,c,l,0)}{let i=Math.max(0,Math.min(s-r,Math.floor((e-n)/o))),{from:a,length:l}=t.doc.line(r+i);return new Ic(a,l,n+o*i,o,0)}}lineAt(e,t,n,i,r){if(t==Mc.ByHeight)return this.blockAt(e,n,i,r);if(t==Mc.ByPosNoHeight){let{from:t,to:i}=n.doc.lineAt(e);return new Ic(t,i-t,0,0,0)}let{firstLine:s,perLine:o,perChar:a}=this.heightMetrics(n,r),l=n.doc.lineAt(e),c=o+l.length*a,h=l.number-s,u=i+o*h+a*(l.from-r-h);return new Ic(l.from,l.length,Math.max(i,Math.min(u,i+this.height-c)),c,0)}forEachLine(e,t,n,i,r,s){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:o,perLine:a,perChar:l}=this.heightMetrics(n,r);for(let c=e,h=i;c<=t;){let t=n.doc.lineAt(c);if(c==e){let n=t.number-o;h+=a*n+l*(e-r-n)}let i=a+l*t.length;s(new Ic(t.from,t.length,h,i,0)),h+=i,c=t.to+1}}replace(e,t,n){let i=this.length-t;if(i>0){let e=n[n.length-1];e instanceof Fc?n[n.length-1]=new Fc(e.length+i):n.push(null,new Fc(i-1))}if(e>0){let t=n[0];t instanceof Fc?n[0]=new Fc(e+t.length):n.unshift(new Fc(e-1),null)}return Bc.of(n)}decomposeLeft(e,t){t.push(new Fc(e-1),null)}decomposeRight(e,t){t.push(null,new Fc(this.length-e-1))}updateHeight(e,t=0,n=!1,i){let r=t+this.length;if(i&&i.from<=t+this.length&&i.more){let n=[],s=Math.max(t,i.from),o=-1;for(i.from>t&&n.push(new Fc(i.from-t-1).updateHeight(e,t));s<=r&&i.more;){let t=e.doc.lineAt(s).length;n.length&&n.push(null);let r=i.heights[i.index++];-1==o?o=r:Math.abs(r-o)>=Gc&&(o=-2);let a=new Lc(t,r);a.outdated=!1,n.push(a),s+=t+1}s<=r&&n.push(null,new Fc(r-s).updateHeight(e,s));let a=Bc.of(n);return(o<0||Math.abs(a.height-this.height)>=Gc||Math.abs(o-this.heightMetrics(e,t).perLine)>=Gc)&&(e.heightChanged=!0),a}return(n||this.outdated)&&(this.setHeight(e,e.heightForGap(t,t+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}}class Hc extends Bc{constructor(e,t,n){super(e.length+t+n.length,e.height+n.height,t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return 1&this.flags}blockAt(e,t,n,i){let r=n+this.left.height;return eo))return l;let c=t==Mc.ByPosNoHeight?Mc.ByPosNoHeight:Mc.ByPos;return a?l.join(this.right.lineAt(o,c,n,s,o)):this.left.lineAt(o,c,n,i,r).join(l)}forEachLine(e,t,n,i,r,s){let o=i+this.left.height,a=r+this.left.length+this.break;if(this.break)e=a&&this.right.forEachLine(e,t,n,o,a,s);else{let l=this.lineAt(a,Mc.ByPos,n,i,r);e=e&&l.from<=t&&s(l),t>l.to&&this.right.forEachLine(l.to+1,t,n,o,a,s)}}replace(e,t,n){let i=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-i,t-i,n));let r=[];e>0&&this.decomposeLeft(e,r);let s=r.length;for(let e of n)r.push(e);if(e>0&&Kc(r,s-1),t=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,i=n+this.break;if(e>=i)return this.right.decomposeRight(e-i,t);e2*t.size||t.size>2*e.size?Bc.of(this.break?[e,null,t]:[e,t]):(this.left=e,this.right=t,this.height=e.height+t.height,this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,n=!1,i){let{left:r,right:s}=this,o=t+r.length+this.break,a=null;return i&&i.from<=t+r.length&&i.more?a=r=r.updateHeight(e,t,n,i):r.updateHeight(e,t,n),i&&i.from<=o+s.length&&i.more?a=s=s.updateHeight(e,o,n,i):s.updateHeight(e,o,n),a?this.balanced(r,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function Kc(e,t){let n,i;null==e[t]&&(n=e[t-1])instanceof Fc&&(i=e[t+1])instanceof Fc&&e.splice(t-1,3,new Fc(n.length+1+i.length))}class Jc{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof Lc?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new Lc(e-this.pos,-1)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e=5)&&this.addLineDeco(i,r,s)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new Lc(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new Fc(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Lc)return e;let t=new Lc(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let i=this.ensureLine();i.length+=n,i.collapsed+=n,i.widgetHeight=Math.max(i.widgetHeight,e),i.breaks+=t,this.writtenTo=this.pos=this.pos+n}finish(e){let t=0==this.nodes.length?null:this.nodes[this.nodes.length-1];!(this.lineStart>-1)||t instanceof Lc||this.isCovered?(this.writtenTon.clientHeight||n.scrollWidth>n.clientWidth)&&"visible"!=i.overflow){let i=n.getBoundingClientRect();s=Math.max(s,i.left),o=Math.min(o,i.right),a=Math.max(a,i.top),l=t==e.parentNode?i.bottom:Math.min(l,i.bottom)}t="absolute"==i.position||"fixed"==i.position?n.offsetParent:n.parentNode}else{if(11!=t.nodeType)break;t=t.host}return{left:s-n.left,right:Math.max(s,o)-n.left,top:a-(n.top+t),bottom:Math.max(a,l)-(n.top+t)}}function nh(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}class ih{constructor(e,t,n){this.from=e,this.to=t,this.size=n}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n"function"!=typeof e&&"cm-lineWrapping"==e.class));this.heightOracle=new Uc(t),this.stateDeco=e.facet($l).filter((e=>"function"!=typeof e)),this.heightMap=Bc.empty().applyChanges(this.stateDeco,Nr.empty,this.heightOracle.setDoc(e.doc),[new Cl(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Fa.set(this.lineGaps.map((e=>e.draw(this,!1)))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let i=n?t.head:t.anchor;if(!e.some((({from:e,to:t})=>i>=e&&i<=t))){let{from:t,to:n}=this.lineBlockAt(i);e.push(new oh(t,n))}}this.viewports=e.sort(((e,t)=>e.from-t.from)),this.scaler=this.heightMap.height<=7e6?hh:new uh(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,(e=>{this.viewportLines.push(1==this.scaler.scale?e:dh(e,this.scaler))}))}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet($l).filter((e=>"function"!=typeof e));let i=e.changedRanges,r=Cl.extendWithRanges(i,function(e,t,n){let i=new eh;return So.compare(e,t,n,i,0),i.changes}(n,this.stateDeco,e?e.changes:gs.empty(this.state.doc.length))),s=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),this.heightMap.height!=s&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.heada.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let l=!e.changes.empty||2&e.flags||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,this.updateForViewport(),l&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(fl)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),i=this.heightOracle,r=n.whiteSpace;this.defaultTextDirection="rtl"==n.direction?Yl.RTL:Yl.LTR;let s=this.heightOracle.mustRefreshForWrapping(r),o=t.getBoundingClientRect(),a=s||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let l=0,c=0;if(o.width&&o.height){let e=o.width/t.offsetWidth,n=o.height/t.offsetHeight;(e>.995&&e<1.005||!isFinite(e)||Math.abs(o.width-t.offsetWidth)<1)&&(e=1),(n>.995&&n<1.005||!isFinite(n)||Math.abs(o.height-t.offsetHeight)<1)&&(n=1),this.scaleX==e&&this.scaleY==n||(this.scaleX=e,this.scaleY=n,l|=8,s=a=!0)}let h=(parseInt(n.paddingTop)||0)*this.scaleY,u=(parseInt(n.paddingBottom)||0)*this.scaleY;this.paddingTop==h&&this.paddingBottom==u||(this.paddingTop=h,this.paddingBottom=u,l|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(i.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,l|=8);let d=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=d&&(this.scrollAnchorHeight=-1,this.scrollTop=d),this.scrolledToBottom=Oa(e.scrollDOM);let f=(this.printing?nh:th)(t,this.paddingTop),O=f.top-this.pixelViewport.top,p=f.bottom-this.pixelViewport.bottom;this.pixelViewport=f;let m=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(m!=this.inView&&(this.inView=m,m&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let g=o.width;if(this.contentDOMWidth==g&&this.editorHeight==e.scrollDOM.clientHeight||(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,l|=8),a){let t=e.docView.measureVisibleLineHeights(this.viewport);if(i.mustRefreshForHeights(t)&&(s=!0),s||i.lineWrapping&&Math.abs(g-this.contentDOMWidth)>i.charWidth){let{lineHeight:n,charWidth:o,textHeight:a}=e.docView.measureTextSize();s=n>0&&i.refresh(r,n,o,a,g/o,t),s&&(e.docView.minWidth=0,l|=8)}O>0&&p>0?c=Math.max(O,p):O<0&&p<0&&(c=Math.min(O,p)),i.heightChanged=!1;for(let n of this.viewports){let r=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(s?Bc.empty().applyChanges(this.stateDeco,Nr.empty,this.heightOracle,[new Cl(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(i,0,s,new Vc(n.from,r))}i.heightChanged&&(l|=2)}let b=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return b&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(2&l||b)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,e)),l|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),l}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),i=this.heightMap,r=this.heightOracle,{visibleTop:s,visibleBottom:o}=this,a=new oh(i.lineAt(s-1e3*n,Mc.ByHeight,r,0,0).from,i.lineAt(o+1e3*(1-n),Mc.ByHeight,r,0,0).to);if(t){let{head:e}=t.range;if(ea.to){let n,s=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),o=i.lineAt(e,Mc.ByPos,r,0,0);n="center"==t.y?(o.top+o.bottom)/2-s/2:"start"==t.y||"nearest"==t.y&&e=o+Math.max(10,Math.min(n,250)))&&i>s-2e3&&r>1,s=i<<1;if(this.defaultTextDirection!=Yl.LTR&&!n)return[];let o=[],a=(i,s,l,c)=>{if(s-ii&&ee.from>=l.from&&e.to<=l.to&&Math.abs(e.from-i)e.fromt))));if(!d){if(se.from<=s&&e.to>=s))){let e=t.moveToLineBoundary(Qs.cursor(s),!1,!0).head;e>i&&(s=e)}d=new ih(i,s,this.gapSize(l,i,s,c))}o.push(d)};for(let e of this.viewportLines){if(e.lengthe.from&&a(e.from,r,e,t),oe.draw(this,this.heightOracle.lineWrapping)))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let t=[];So.spans(e,this.viewport.from,this.viewport.to,{span(e,n){t.push({from:e,to:n})},point(){}},20);let n=t.length!=this.visibleRanges.length||this.visibleRanges.some(((e,n)=>e.from!=t[n].from||e.to!=t[n].to));return this.visibleRanges=t,n?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find((t=>t.from<=e&&t.to>=e))||dh(this.heightMap.lineAt(e,Mc.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return dh(this.heightMap.lineAt(this.scaler.fromDOM(e),Mc.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return dh(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class oh{constructor(e,t){this.from=e,this.to=t}}function ah(e,t,n){let i=[],r=e,s=0;return So.spans(n,e,t,{span(){},point(e,t){e>r&&(i.push({from:r,to:e}),s+=e-r),r=t}},20),r=1)return t[t.length-1].to;let i=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:r}=t[e],s=r-n;if(i<=s)return n+i;i-=s}}function ch(e,t){let n=0;for(let{from:i,to:r}of e.ranges){if(t<=r){n+=t-i;break}n+=r-i}return n/e.total}const hh={toDOM:e=>e,fromDOM:e=>e,scale:1};class uh{constructor(e,t,n){let i=0,r=0,s=0;this.viewports=n.map((({from:n,to:r})=>{let s=t.lineAt(n,Mc.ByPos,e,0,0).top,o=t.lineAt(r,Mc.ByPos,e,0,0).bottom;return i+=o-s,{from:n,to:r,top:s,bottom:o,domTop:0,domBottom:0}})),this.scale=(7e6-i)/(t.height-i);for(let e of this.viewports)e.domTop=s+(e.top-r)*this.scale,s=e.domBottom=e.domTop+(e.bottom-e.top),r=e.bottom}toDOM(e){for(let t=0,n=0,i=0;;t++){let r=tdh(e,t))):e._content)}const fh=Ts.define({combine:e=>e.join(" ")}),Oh=Ts.define({combine:e=>e.indexOf(!0)>-1}),ph=zo.newName(),mh=zo.newName(),gh=zo.newName(),bh={"&light":"."+mh,"&dark":"."+gh};function wh(e,t,n){return new zo(t,{finish:t=>/&/.test(t)?t.replace(/&\w*/,(t=>{if("&"==t)return e;if(!n||!n[t])throw new RangeError(`Unsupported selector: ${t}`);return n[t]})):e+" "+t})}const xh=wh("."+ph,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:'url(\'data:image/svg+xml,\')',backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},bh),vh="￿";class yh{constructor(e,t){this.points=e,this.text="",this.lineSeparator=t.facet(go.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=vh}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let i=e;;){this.findPointBefore(n,i);let e=this.text.length;this.readNode(i);let r=i.nextSibling;if(r==t)break;let s=ga.get(i),o=ga.get(r);(s&&o?s.breakAfter:(s?s.breakAfter:$h(i))||$h(r)&&("BR"!=i.nodeName||i.cmIgnore)&&this.text.length>e)&&this.lineBreak(),i=r}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,i=this.lineSeparator?null:/\r\n?|\n/g;;){let r,s=-1,o=1;if(this.lineSeparator?(s=t.indexOf(this.lineSeparator,n),o=this.lineSeparator.length):(r=i.exec(t))&&(s=r.index,o=r[0].length),this.append(t.slice(n,s<0?t.length:s)),s<0)break;if(this.lineBreak(),o>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=o-1);n=s+o}}readNode(e){if(e.cmIgnore)return;let t=ga.get(e),n=t&&t.overrideDOMText;if(null!=n){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else 3==e.nodeType?this.readTextNode(e):"BR"==e.nodeName?e.nextSibling&&this.lineBreak():1==e.nodeType&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(3==e.nodeType?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(Sh(e,n.node,n.offset)?t:0))}}function Sh(e,t,n){for(;;){if(!t||n-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let t=r||s?[]:function(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:i,focusNode:r,focusOffset:s}=e.observer.selectionRange;n&&(t.push(new Qh(n,i)),r==n&&s==i||t.push(new Qh(r,s)));return t}(e),n=new yh(t,e.state);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=function(e,t){if(0==e.length)return null;let n=e[0].pos,i=2==e.length?e[1].pos:n;return n>-1&&i>-1?Qs.single(n+t,i+t):null}(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=r&&r.node==t.focusNode&&r.offset==t.focusOffset||!Ko(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),i=s&&s.node==t.anchorNode&&s.offset==t.anchorOffset||!Ko(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset);this.newSel=Qs.single(i,n)}}}function Ph(e,t){let n,{newSel:i}=t,r=e.state.selection.main,s=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:i,to:o}=t.bounds,a=r.from,l=null;(8===s||Ya.android&&t.text.length0&&a>0&&e.charCodeAt(o-1)==t.charCodeAt(a-1);)o--,a--;if("end"==i){n-=o+Math.max(0,s-Math.min(o,a))-s}if(o=o?s-n:0,a=s+(a-o),o=s}else if(a=a?s-n:0,o=s+(o-a),a=s}return{from:s,toA:o,toB:a}}(e.state.doc.sliceString(i,o,vh),t.text,a-i,l);c&&(Ya.chrome&&13==s&&c.toB==c.from+2&&"￿￿"==t.text.slice(c.from,c.toB)&&c.toB--,n={from:i+c.from,to:i+c.toA,insert:Nr.of(t.text.slice(c.from,c.toB).split(vh))})}else i&&(!e.hasFocus&&e.state.facet(gl)||i.main.eq(r))&&(i=null);if(!n&&!i)return!1;if(!n&&t.typeOver&&!r.empty&&i&&i.main.empty?n={from:r.from,to:r.to,insert:e.state.doc.slice(r.from,r.to)}:n&&n.from>=r.from&&n.to<=r.to&&(n.from!=r.from||n.to!=r.to)&&r.to-r.from-(n.to-n.from)<=4?n={from:r.from,to:r.to,insert:e.state.doc.slice(r.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,r.to))}:(Ya.mac||Ya.android)&&n&&n.from==n.to&&n.from==r.head-1&&/^\. ?$/.test(n.insert.toString())&&"off"==e.contentDOM.getAttribute("autocorrect")?(i&&2==n.insert.length&&(i=Qs.single(i.main.anchor-1,i.main.head-1)),n={from:r.from,to:r.to,insert:Nr.of([" "])}):Ya.chrome&&n&&n.from==n.to&&n.from==r.head&&"\n "==n.insert.toString()&&e.lineWrapping&&(i&&(i=Qs.single(i.main.anchor-1,i.main.head-1)),n={from:r.from,to:r.to,insert:Nr.of([" "])}),n){if(Ya.ios&&e.inputState.flushIOSKey())return!0;if(Ya.android&&(n.from==r.from&&n.to==r.to&&1==n.insert.length&&2==n.insert.lines&&da(e.contentDOM,"Enter",13)||(n.from==r.from-1&&n.to==r.to&&0==n.insert.length||8==s&&n.insert.lengthr.head)&&da(e.contentDOM,"Backspace",8)||n.from==r.from&&n.to==r.to+1&&0==n.insert.length&&da(e.contentDOM,"Delete",46)))return!0;let t,o=n.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let a=()=>t||(t=function(e,t,n){let i,r=e.state,s=r.selection.main;if(t.from>=s.from&&t.to<=s.to&&t.to-t.from>=(s.to-s.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=s.fromt.to?r.sliceDoc(t.to,s.to):"";i=r.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=r.changes(t),a=n&&n.main.to<=o.newLength?n.main:void 0;if(r.selection.ranges.length>1&&e.inputState.composing>=0&&t.to<=s.to&&t.to>=s.to-10){let l,c=e.state.sliceDoc(t.from,t.to),h=n&&Kl(e,n.main.head);if(h){let e=t.insert.length-(t.to-t.from);l={from:h.from,to:h.to-e}}else l=e.state.doc.lineAt(s.head);let u=s.to-t.to,d=s.to-s.from;i=r.changeByRange((n=>{if(n.from==s.from&&n.to==s.to)return{changes:o,range:a||n.map(o)};let i=n.to-u,h=i-c.length;if(n.to-n.from!=d||e.state.sliceDoc(h,i)!=c||n.to>=l.from&&n.from<=l.to)return{range:n};let f=r.changes({from:h,to:i,insert:t.insert}),O=n.to-s.to;return{changes:f,range:a?Qs.range(Math.max(0,a.anchor+O),Math.max(0,a.head+O)):n.map(f)}}))}else i={changes:o,selection:a&&r.selection.replaceRange(a)}}let o="input.type";(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,o+=".compose",e.inputState.compositionFirstChange&&(o+=".start",e.inputState.compositionFirstChange=!1));return r.update(i,{userEvent:o,scrollIntoView:!0})}(e,n,i));return e.state.facet(hl).some((t=>t(e,n.from,n.to,o,a)))||e.dispatch(a()),!0}if(i&&!i.main.eq(r)){let t=!1,n="select";return e.inputState.lastSelectionTime>Date.now()-50&&("select"==e.inputState.lastSelectionOrigin&&(t=!0),n=e.inputState.lastSelectionOrigin),e.dispatch({selection:i,scrollIntoView:t,userEvent:n}),!0}return!1}const Th={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},_h=Ya.ie&&Ya.ie_version<=11;class Zh{constructor(e){this.view=e,this.active=!1,this.selectionRange=new aa,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.resizeContent=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver((t=>{for(let e of t)this.queue.push(e);(Ya.ie&&Ya.ie_version<=11||Ya.ios&&e.composing)&&t.some((e=>"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length))?this.flushSoon():this.flush()})),_h&&(this.onCharData=e=>{this.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),"function"==typeof ResizeObserver&&(this.resizeScroll=new ResizeObserver((()=>{var e;(null===(e=this.view.docView)||void 0===e?void 0:e.lastUpdate)this.view.requestMeasure())),this.resizeContent.observe(e.contentDOM)),this.addWindowListeners(this.win=e.win),this.start(),"function"==typeof IntersectionObserver&&(this.intersection=new IntersectionObserver((e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))}),{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver((e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))}),{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout((()=>{this.resizeTimeout=-1,this.view.requestMeasure()}),50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout((()=>{this.view.viewState.printing=!1,this.view.requestMeasure()}),500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some(((t,n)=>t!=e[n])))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,i=this.selectionRange;if(n.state.facet(gl)?n.root.activeElement!=this.dom:!Jo(n.dom,i))return;let r=i.anchorNode&&n.docView.nearest(i.anchorNode);r&&r.ignoreEvent(e)?t||(this.selectionChanged=!1):(Ya.ie&&Ya.ie_version<=11||Ya.android&&Ya.chrome)&&!n.state.selection.main.empty&&i.focusNode&&ta(i.focusNode,i.focusOffset,i.anchorNode,i.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Ya.safari&&11==e.root.nodeType&&function(e){let t=e.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e){let t=null;function n(e){e.preventDefault(),e.stopImmediatePropagation(),t=e.getTargetRanges()[0]}if(e.contentDOM.addEventListener("beforeinput",n,!0),e.dom.ownerDocument.execCommand("indent"),e.contentDOM.removeEventListener("beforeinput",n,!0),!t)return null;let i=t.startContainer,r=t.startOffset,s=t.endContainer,o=t.endOffset,a=e.docView.domAtPos(e.state.selection.main.anchor);ta(a.node,a.offset,s,o)&&([i,r,s,o]=[s,o,i,r]);return{anchorNode:i,anchorOffset:r,focusNode:s,focusOffset:o}}(this.view)||Ho(e.root);if(!t||this.selectionRange.eq(t))return!1;let n=Jo(this.dom,t);return n&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let e=this.delayedAndroidKey;if(e){this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&da(this.dom,e.key,e.keyCode)}};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&"Enter"!=e||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()})))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,i=!1;for(let r of e){let e=this.readMutation(r);e&&(e.typeOver&&(i=!0),-1==t?({from:t,to:n}=e):(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:i}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),i=this.selectionChanged&&Jo(this.dom,this.selectionRange);if(e<0&&!i)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new kh(this.view,e,t,n);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,i=Ph(this.view,t);return this.view.state==n&&this.view.update([]),i}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty("attributes"==e.type),"attributes"==e.type&&(t.flags|=4),"childList"==e.type){let n=Ch(t,e.previousSibling||e.target.previousSibling,-1),i=Ch(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:i?t.posBefore(i):t.posAtEnd,typeOver:!1}}return"characterData"==e.type?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var e,t,n,i;this.stop(),null===(e=this.intersection)||void 0===e||e.disconnect(),null===(t=this.gapIntersection)||void 0===t||t.disconnect(),null===(n=this.resizeScroll)||void 0===n||n.disconnect(),null===(i=this.resizeContent)||void 0===i||i.disconnect();for(let e of this.scrollTargets)e.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}}function Ch(e,t,n){for(;t;){let i=ga.get(t);if(i&&i.parent==e)return i;let r=t.parentNode;t=r!=e.dom?r:n>0?t.nextSibling:t.previousSibling}return null}class Xh{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM);let{dispatch:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(e=>e.forEach((e=>t(e,this))))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||function(e){for(;e;){if(e&&(9==e.nodeType||11==e.nodeType&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}(e.parent)||document,this.viewState=new sh(e.state||go.create(e)),this.plugins=this.state.facet(wl).map((e=>new vl(e)));for(let e of this.plugins)e.update(this);this.observer=new Zh(this),this.inputState=new fc(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Fl(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),e.parent&&e.parent.appendChild(this.dom)}dispatch(...e){let t=1==e.length&&e[0]instanceof so?e:1==e.length&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(0!=this.updateState)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t,n=!1,i=!1,r=this.state;for(let t of e){if(t.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=t.state}if(this.destroyed)return void(this.viewState.state=r);let s=this.hasFocus,o=0,a=null;e.some((e=>e.annotation(Wc)))?(this.inputState.notifiedFocused=s,o=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,a=Ec(r,s),a||(o=1));let l=this.observer.delayedAndroidKey,c=null;if(l?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(go.phrases)!=this.state.facet(go.phrases))return this.setState(r);t=Xl.create(this,r,e),t.flags|=o;let h=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(h&&(h=h.map(t.changes)),t.scrollIntoView){let{main:e}=t.state.selection;h=new Ol(e.empty?e:Qs.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(pl)&&(h=e.value)}this.viewState.update(t,h),this.bidiCache=qh.update(this.bidiCache,t.changes),t.empty||(this.updatePlugins(t),this.inputState.update(t)),n=this.docView.update(t),this.state.facet(Zl)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some((e=>e.isUserEvent("select.pointer"))))}finally{this.updateState=0}if(t.startState.facet(fh)!=t.state.facet(fh)&&(this.viewState.mustMeasureContent=!0),(n||i||h||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!t.empty)for(let e of this.state.facet(cl))e(t);(a||c)&&Promise.resolve().then((()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!Ph(this,c)&&l.force&&da(this.contentDOM,l.key,l.keyCode)}))}setState(e){if(0!=this.updateState)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed)return void(this.viewState.state=e);this.updateState=2;let t=this.hasFocus;try{for(let e of this.plugins)e.destroy(this);this.viewState=new sh(e),this.plugins=e.facet(wl).map((e=>new vl(e))),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView=new Fl(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(wl),n=e.state.facet(wl);if(t!=n){let i=[];for(let r of n){let n=t.indexOf(r);if(n<0)i.push(new vl(r));else{let t=this.plugins[n];t.mustUpdate=e,i.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=i,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey)return this.measureScheduled=-1,void this.requestMeasure();this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,n=this.scrollDOM,i=n.scrollTop*this.scaleY,{scrollAnchorPos:r,scrollAnchorHeight:s}=this.viewState;Math.abs(i-this.viewState.scrollTop)>1&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(s<0)if(Oa(n))r=-1,s=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(i);r=e.from,s=e.top}this.updateState=1;let o=this.viewState.measure(this);if(!o&&!this.measureRequests.length&&null==this.viewState.scrollTarget)break;if(e>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let a=[];4&o||([this.measureRequests,a]=[a,this.measureRequests]);let l=a.map((e=>{try{return e.read(this)}catch(e){return ml(this.state,e),Rh}})),c=Xl.create(this,this.state,[]),h=!1;c.flags|=o,t?t.flags|=o:t=c,this.updateState=2,c.empty||(this.updatePlugins(c),this.inputState.update(c),this.updateAttrs(),h=this.docView.update(c));for(let e=0;e1||e<-1){i+=e,n.scrollTop=i/this.scaleY,s=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(cl))e(t)}get themeClasses(){return ph+" "+(this.state.facet(Oh)?gh:mh)+" "+this.state.facet(fh)}updateAttrs(){let e=Ah(this,yl,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(gl)?"true":"false",class:"cm-content",style:`${Ya.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),Ah(this,Sl,t);let n=this.observer.ignore((()=>{let n=Ia(this.contentDOM,this.contentAttrs,t),i=Ia(this.dom,this.editorAttrs,e);return n||i}));return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(e){let t=!0;for(let n of e)for(let e of n.effects)if(e.is(Xh.announce)){t&&(this.announceDOM.textContent=""),t=!1,this.announceDOM.appendChild(document.createElement("div")).textContent=e.value}}mountStyles(){this.styleModules=this.state.facet(Zl);let e=this.state.facet(Xh.cspNonce);zo.mount(this.root,this.styleModules.concat(xh).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(2==this.updateState)throw new Error("Reading the editor layout isn't allowed during an update");0==this.updateState&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame((()=>this.measure()))),e){if(this.measureRequests.indexOf(e)>-1)return;if(null!=e.key)for(let t=0;tt.spec==e))||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,n){return dc(this,e,hc(this,e,t,n))}moveByGroup(e,t){return dc(this,e,hc(this,e,t,(t=>function(e,t,n){let i=e.state.charCategorizer(t),r=i(n);return e=>{let t=i(e);return r==fo.Space&&(r=t),r==t}}(this,e.head,t))))}moveToLineBoundary(e,t,n=!0){return function(e,t,n,i){let r=cc(e,t.head),s=i&&r.type==La.Text&&(e.lineWrapping||r.widgetLineBreaks)?e.coordsAtPos(t.assoc<0&&t.head>r.from?t.head-1:t.head):null;if(s){let t=e.dom.getBoundingClientRect(),i=e.textDirectionAt(r.from),o=e.posAtCoords({x:n==(i==Yl.LTR)?t.right-1:t.left+1,y:(s.top+s.bottom)/2});if(null!=o)return Qs.cursor(o,n?-1:1)}return Qs.cursor(n?r.to:r.from,n?-1:1)}(this,e,t,n)}moveVertically(e,t,n){return dc(this,e,function(e,t,n,i){let r=t.head,s=n?1:-1;if(r==(n?e.state.doc.length:0))return Qs.cursor(r,t.assoc);let o,a=t.goalColumn,l=e.contentDOM.getBoundingClientRect(),c=e.coordsAtPos(r,t.assoc||-1),h=e.documentTop;if(c)null==a&&(a=c.left-l.left),o=s<0?c.top:c.bottom;else{let t=e.viewState.lineBlockAt(r);null==a&&(a=Math.min(l.right-l.left,e.defaultCharacterWidth*(r-t.from))),o=(s<0?t.top:t.bottom)+h}let u=l.left+a,d=null!=i?i:e.viewState.heightOracle.textHeight>>1;for(let t=0;;t+=10){let n=o+(d+t)*s,i=ac(e,{x:u,y:n},!1,s);if(nl.bottom||(s<0?ir)){let t=e.docView.coordsForChar(i),r=!t||n0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(dl)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Yh)return Bl(e.length);let t,n=this.textDirectionAt(e.from);for(let i of this.bidiCache)if(i.from==e.from&&i.dir==n&&(i.fresh||Vl(i.isolates,t=Pl(this,e.from,e.to))))return i.order;t||(t=Pl(this,e.from,e.to));let i=function(e,t,n){if(!e)return[new Ul(0,0,t==ql?1:0)];if(t==Rl&&!n.length&&!Dl.test(e))return Bl(e.length);if(n.length)for(;e.length>Il.length;)Il[Il.length]=256;let i=[],r=t==Rl?0:1;return Gl(e,r,r,n,0,e.length,i),i}(e.text,n,t);return this.bidiCache.push(new qh(e.from,e.to,n,t,!0,i)),i}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Ya.safari&&(null===(e=this.inputState)||void 0===e?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore((()=>{ha(this.contentDOM),this.docView.updateSelection()}))}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((9==e.nodeType?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return pl.of(new Ol("number"==typeof e?Qs.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}static domEventHandlers(e){return xl.define((()=>({})),{eventHandlers:e})}static domEventObservers(e){return xl.define((()=>({})),{eventObservers:e})}static theme(e,t){let n=zo.newName(),i=[fh.of(n),Zl.of(wh(`.${n}`,e))];return t&&t.dark&&i.push(Oh.of(!0)),i}static baseTheme(e){return Ds.lowest(Zl.of(wh("."+ph,e,bh)))}static findFromDOM(e){var t;let n=e.querySelector(".cm-content"),i=n&&ga.get(n)||ga.get(e);return(null===(t=null==i?void 0:i.rootView)||void 0===t?void 0:t.view)||null}}Xh.styleModule=Zl,Xh.inputHandler=hl,Xh.focusChangeEffect=ul,Xh.perLineTextDirection=dl,Xh.exceptionSink=ll,Xh.updateListener=cl,Xh.editable=gl,Xh.mouseSelectionStyle=al,Xh.dragMovesSelection=ol,Xh.clickAddsSelectionRange=sl,Xh.decorations=$l,Xh.atomicRanges=Ql,Xh.bidiIsolatedRanges=kl,Xh.scrollMargins=Tl,Xh.darkTheme=Oh,Xh.cspNonce=Ts.define({combine:e=>e.length?e[0]:""}),Xh.contentAttributes=Sl,Xh.editorAttributes=yl,Xh.lineWrapping=Xh.contentAttributes.of({class:"cm-lineWrapping"}),Xh.announce=ro.define();const Yh=4096,Rh={};class qh{constructor(e,t,n,i,r,s){this.from=e,this.to=t,this.dir=n,this.isolates=i,this.fresh=r,this.order=s}static update(e,t){if(t.empty&&!e.some((e=>e.fresh)))return e;let n=[],i=e.length?e[e.length-1].dir:Yl.LTR;for(let r=Math.max(0,e.length-10);r=0;r--){let t=i[r],s="function"==typeof t?t(e):t;s&&Da(s,n)}return n}const Wh=Ya.mac?"mac":Ya.windows?"win":Ya.linux?"linux":"key";function Eh(e,t,n){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),!1!==n&&t.shiftKey&&(e="Shift-"+e),e}const jh=Ds.default(Xh.domEventHandlers({keydown:(e,t)=>Ih(Uh(t.state),e,t,"editor")})),zh=Ts.define({enables:jh}),Dh=new WeakMap;function Uh(e){let t=e.facet(zh),n=Dh.get(t);return n||Dh.set(t,n=function(e,t=Wh){let n=Object.create(null),i=Object.create(null),r=(e,t)=>{let n=i[e];if(null==n)i[e]=t;else if(n!=t)throw new Error("Key binding "+e+" is used both as a regular binding and as a multi-stroke prefix")},s=(e,i,s,o,a)=>{var l,c;let h=n[e]||(n[e]=Object.create(null)),u=i.split(/ (?!$)/).map((e=>function(e,t){const n=e.split(/-(?!$)/);let i,r,s,o,a=n[n.length-1];"Space"==a&&(a=" ");for(let e=0;e{let i=Vh={view:t,prefix:n,scope:e};return setTimeout((()=>{Vh==i&&(Vh=null)}),4e3),!0}]})}let d=u.join(" ");r(d,!1);let f=h[d]||(h[d]={preventDefault:!1,stopPropagation:!1,run:(null===(c=null===(l=h._any)||void 0===l?void 0:l.run)||void 0===c?void 0:c.slice())||[]});s&&f.run.push(s),o&&(f.preventDefault=!0),a&&(f.stopPropagation=!0)};for(let i of e){let e=i.scope?i.scope.split(" "):["editor"];if(i.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||(e._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let t in e)e[t].run.push(i.any)}let r=i[t]||i.key;if(r)for(let t of e)s(t,r,i.run,i.preventDefault,i.stopPropagation),i.shift&&s(t,"Shift-"+r,i.shift,i.preventDefault,i.stopPropagation)}return n}(t.reduce(((e,t)=>e.concat(t)),[]))),n}let Vh=null;function Ih(e,t,n,i){let r=function(e){var t=!(No&&(e.ctrlKey||e.altKey||e.metaKey)||Bo&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?Io:Vo)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(t),s=fs(us(r,0))==r.length&&" "!=r,o="",a=!1,l=!1,c=!1;Vh&&Vh.view==n&&Vh.scope==i&&(o=Vh.prefix+" ",bc.indexOf(t.keyCode)<0&&(l=!0,Vh=null));let h,u,d=new Set,f=e=>{if(e){for(let i of e.run)if(!d.has(i)&&(d.add(i),i(n,t)))return e.stopPropagation&&(c=!0),!0;e.preventDefault&&(e.stopPropagation&&(c=!0),l=!0)}return!1},O=e[i];return O&&(f(O[o+Eh(r,t,!s)])?a=!0:s&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Ya.windows&&t.ctrlKey&&t.altKey)&&(h=Vo[t.keyCode])&&h!=r?(f(O[o+Eh(h,t,!0)])||t.shiftKey&&(u=Io[t.keyCode])!=r&&u!=h&&f(O[o+Eh(u,t,!1)]))&&(a=!0):s&&t.shiftKey&&f(O[o+Eh(r,t,!0)])&&(a=!0),!a&&f(O._any)&&(a=!0)),l&&(a=!0),a&&c&&t.stopPropagation(),a}class Mh{constructor(e,t,n,i,r){this.className=e,this.left=t,this.top=n,this.width=i,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",null!=this.width&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,n){if(n.empty){let i=e.coordsAtPos(n.head,n.assoc||1);if(!i)return[];let r=Gh(e);return[new Mh(t,i.left-r.left,i.top-r.top,null,i.bottom-i.top)]}return function(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let i=Math.max(n.from,e.viewport.from),r=Math.min(n.to,e.viewport.to),s=e.textDirection==Yl.LTR,o=e.contentDOM,a=o.getBoundingClientRect(),l=Gh(e),c=o.querySelector(".cm-line"),h=c&&window.getComputedStyle(c),u=a.left+(h?parseInt(h.paddingLeft)+Math.min(0,parseInt(h.textIndent)):0),d=a.right-(h?parseInt(h.paddingRight):0),f=cc(e,i),O=cc(e,r),p=f.type==La.Text?f:null,m=O.type==La.Text?O:null;p&&(e.lineWrapping||f.widgetLineBreaks)&&(p=Bh(e,i,p));m&&(e.lineWrapping||O.widgetLineBreaks)&&(m=Bh(e,r,m));if(p&&m&&p.from==m.from)return b(w(n.from,n.to,p));{let t=p?w(n.from,null,p):x(f,!1),i=m?w(null,n.to,m):x(O,!0),r=[];return(p||f).to<(m||O).from-(p&&m?1:0)||f.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2c&&i.from=s)break;a>r&&l(Math.max(e,r),null==t&&e<=c,Math.min(a,s),null==n&&a>=h,o.dir)}if(r=i.to+1,r>=s)break}return 0==a.length&&l(c,null==t,h,null==n,e.textDirection),{top:r,bottom:o,horizontal:a}}function x(e,t){let n=a.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}(e,t,n)}}function Gh(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Yl.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function Bh(e,t,n){let i=Qs.cursor(t);return{from:Math.max(n.from,e.moveToLineBoundary(i,!1,!0).from),to:Math.min(n.to,e.moveToLineBoundary(i,!0,!0).from),type:La.Text}}class Nh{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(Lh)!=e.state.facet(Lh)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}setOrder(e){let t=0,n=e.facet(Lh);for(;t{return n=e,i=this.drawn[t],!(n.constructor==i.constructor&&n.eq(i));var n,i}))){let t=this.dom.firstChild,n=0;for(let i of e)i.update&&t&&i.constructor&&this.drawn[n].constructor&&i.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(i.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const Lh=Ts.define();function Fh(e){return[xl.define((t=>new Nh(t,e))),Lh.of(e)]}const Hh=!Ya.ios,Kh=Ts.define({combine:e=>bo(e,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})});function Jh(e={}){return[Kh.of(e),tu,iu,su,fl.of(!0)]}function eu(e){return e.startState.facet(Kh)!=e.state.facet(Kh)}const tu=Fh({above:!0,markers(e){let{state:t}=e,n=t.facet(Kh),i=[];for(let r of t.selection.ranges){let s=r==t.selection.main;if(r.empty?!s||Hh:n.drawRangeCursor){let t=s?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",n=r.empty?r:Qs.cursor(r.head,r.head>r.anchor?-1:1);for(let r of Mh.forRange(e,t,n))i.push(r)}}return i},update(e,t){e.transactions.some((e=>e.selection))&&(t.style.animationName="cm-blink"==t.style.animationName?"cm-blink2":"cm-blink");let n=eu(e);return n&&nu(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){nu(t.state,e)},class:"cm-cursorLayer"});function nu(e,t){t.style.animationDuration=e.facet(Kh).cursorBlinkRate+"ms"}const iu=Fh({above:!1,markers:e=>e.state.selection.ranges.map((t=>t.empty?[]:Mh.forRange(e,"cm-selectionBackground",t))).reduce(((e,t)=>e.concat(t))),update:(e,t)=>e.docChanged||e.selectionSet||e.viewportChanged||eu(e),class:"cm-selectionLayer"}),ru={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};Hh&&(ru[".cm-line"].caretColor="transparent !important");const su=Ds.highest(Xh.theme(ru)),ou=ro.define({map:(e,t)=>null==e?null:t.mapPos(e)}),au=qs.define({create:()=>null,update:(e,t)=>(null!=e&&(e=t.changes.mapPos(e)),t.effects.reduce(((e,t)=>t.is(ou)?t.value:e),e))}),lu=xl.fromClass(class{constructor(e){this.view=e,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(e){var t;let n=e.state.field(au);null==n?null!=this.cursor&&(null===(t=this.cursor)||void 0===t||t.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(e.startState.field(au)!=n||e.docChanged||e.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:e}=this,t=e.state.field(au),n=null!=t&&e.coordsAtPos(t);if(!n)return null;let i=e.scrollDOM.getBoundingClientRect();return{left:n.left-i.left+e.scrollDOM.scrollLeft*e.scaleX,top:n.top-i.top+e.scrollDOM.scrollTop*e.scaleY,height:n.bottom-n.top}}drawCursor(e){if(this.cursor){let{scaleX:t,scaleY:n}=this.view;e?(this.cursor.style.left=e.left/t+"px",this.cursor.style.top=e.top/n+"px",this.cursor.style.height=e.height/n+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(e){this.view.state.field(au)!=e&&this.view.dispatch({effects:ou.of(e)})}},{eventObservers:{dragover(e){this.setDropPos(this.view.posAtCoords({x:e.clientX,y:e.clientY}))},dragleave(e){e.target!=this.view.contentDOM&&this.view.contentDOM.contains(e.relatedTarget)||this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function cu(e,t,n,i,r){t.lastIndex=0;for(let s,o=e.iterRange(n,i),a=n;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;s=t.exec(o.value);)r(a+s.index,s)}class hu{constructor(e){const{regexp:t,decoration:n,decorate:i,boundary:r,maxLength:s=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,i)this.addMatch=(e,t,n,r)=>i(r,n,n+e[0].length,e,t);else if("function"==typeof n)this.addMatch=(e,t,i,r)=>{let s=n(e,t,i);s&&r(i,i+e[0].length,s)};else{if(!n)throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.addMatch=(e,t,i,r)=>r(i,i+e[0].length,n)}this.boundary=r,this.maxLength=s}createDeco(e){let t=new $o,n=t.add.bind(t);for(let{from:t,to:i}of function(e,t){let n=e.visibleRanges;if(1==n.length&&n[0].from==e.viewport.from&&n[0].to==e.viewport.to)return n;let i=[];for(let{from:r,to:s}of n)r=Math.max(e.state.doc.lineAt(r).from,r-t),s=Math.min(e.state.doc.lineAt(s).to,s+t),i.length&&i[i.length-1].to>=r?i[i.length-1].to=s:i.push({from:r,to:s});return i}(e,this.maxLength))cu(e.state.doc,this.regexp,t,i,((t,i)=>this.addMatch(i,e,t,n)));return t.finish()}updateDeco(e,t){let n=1e9,i=-1;return e.docChanged&&e.changes.iterChanges(((t,r,s,o)=>{o>e.view.viewport.from&&s1e3?this.createDeco(e.view):i>-1?this.updateRange(e.view,t.map(e.changes),n,i):t}updateRange(e,t,n,i){for(let r of e.visibleRanges){let s=Math.max(r.from,n),o=Math.min(r.to,i);if(o>s){let n=e.state.doc.lineAt(s),i=n.ton.from;s--)if(this.boundary.test(n.text[s-1-n.from])){a=s;break}for(;oh.push(n.range(e,t));if(n==i)for(this.regexp.lastIndex=a-n.from;(c=this.regexp.exec(n.text))&&c.indexthis.addMatch(n,e,t,u)));t=t.update({filterFrom:a,filterTo:l,filter:(e,t)=>el,add:h})}}return t}}const uu=null!=/x/.unicode?"gu":"g",du=new RegExp("[\0-\b\n--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\ufeff-]",uu),fu={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let Ou=null;const pu=Ts.define({combine(e){let t=bo(e,{render:null,specialChars:du,addSpecialChars:null});return(t.replaceTabs=!function(){var e;if(null==Ou&&"undefined"!=typeof document&&document.body){let t=document.body.style;Ou=null!=(null!==(e=t.tabSize)&&void 0!==e?e:t.MozTabSize)}return Ou||!1}())&&(t.specialChars=new RegExp("\t|"+t.specialChars.source,uu)),t.addSpecialChars&&(t.specialChars=new RegExp(t.specialChars.source+"|"+t.addSpecialChars.source,uu)),t}});function mu(e={}){return[pu.of(e),gu||(gu=xl.fromClass(class{constructor(e){this.view=e,this.decorations=Fa.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(e.state.facet(pu)),this.decorations=this.decorator.createDeco(e)}makeDecorator(e){return new hu({regexp:e.specialChars,decoration:(t,n,i)=>{let{doc:r}=n.state,s=us(t[0],0);if(9==s){let e=r.lineAt(i),t=n.state.tabSize,s=qo(e.text,t,i-e.from);return Fa.replace({widget:new wu((t-s%t)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[s]||(this.decorationCache[s]=Fa.replace({widget:new bu(e,s)}))},boundary:e.replaceTabs?void 0:/[^]/})}update(e){let t=e.state.facet(pu);e.startState.facet(pu)!=t?(this.decorator=this.makeDecorator(t),this.decorations=this.decorator.createDeco(e.view)):this.decorations=this.decorator.updateDeco(e,this.decorations)}},{decorations:e=>e.decorations}))]}let gu=null;class bu extends Na{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=function(e){return e>=32?"•":10==e?"␤":String.fromCharCode(9216+e)}(this.code),n=e.state.phrase("Control character")+" "+(fu[this.code]||"0x"+this.code.toString(16)),i=this.options.render&&this.options.render(this.code,n,t);if(i)return i;let r=document.createElement("span");return r.textContent=t,r.title=n,r.setAttribute("aria-label",n),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class wu extends Na{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent="\t",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}const xu=Fa.line({class:"cm-activeLine"}),vu=xl.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.docChanged||e.selectionSet)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=-1,n=[];for(let i of e.state.selection.ranges){let r=e.lineBlockAt(i.head);r.from>t&&(n.push(xu.range(r.from)),t=r.from)}return Fa.set(n)}},{decorations:e=>e.decorations}),yu=2e3;function Su(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1),i=e.state.doc.lineAt(n),r=n-i.from,s=r>yu?-1:r==i.length?function(e,t){let n=e.coordsAtPos(e.viewport.from);return n?Math.round(Math.abs((n.left-t)/e.defaultCharacterWidth)):-1}(e,t.clientX):qo(i.text,e.state.tabSize,n-i.from);return{line:i.number,col:s,off:r}}function $u(e,t){let n=Su(e,t),i=e.state.selection;return n?{update(e){if(e.docChanged){let t=e.changes.mapPos(e.startState.doc.line(n.line).from),r=e.state.doc.lineAt(t);n={line:r.number,col:n.col,off:Math.min(n.off,r.length)},i=i.map(e.changes)}},get(t,r,s){let o=Su(e,t);if(!o)return i;let a=function(e,t,n){let i=Math.min(t.line,n.line),r=Math.max(t.line,n.line),s=[];if(t.off>yu||n.off>yu||t.col<0||n.col<0){let o=Math.min(t.off,n.off),a=Math.max(t.off,n.off);for(let t=i;t<=r;t++){let n=e.doc.line(t);n.length<=a&&s.push(Qs.range(n.from+o,n.to+a))}}else{let o=Math.min(t.col,n.col),a=Math.max(t.col,n.col);for(let t=i;t<=r;t++){let n=e.doc.line(t),i=Ao(n.text,o,e.tabSize,!0);if(i<0)s.push(Qs.cursor(n.to));else{let t=Ao(n.text,a,e.tabSize);s.push(Qs.range(n.from+i,n.from+t))}}}return s}(e.state,n,o);return a.length?s?Qs.create(a.concat(i.ranges)):Qs.create(a):i}}:null}function Qu(e){let t=(null==e?void 0:e.eventFilter)||(e=>e.altKey&&0==e.button);return Xh.mouseSelectionStyle.of(((e,n)=>t(n)?$u(e,n):null))}const ku={Alt:[18,e=>!!e.altKey],Control:[17,e=>!!e.ctrlKey],Shift:[16,e=>!!e.shiftKey],Meta:[91,e=>!!e.metaKey]},Pu={style:"cursor: crosshair"};function Tu(e={}){let[t,n]=ku[e.key||"Alt"],i=xl.fromClass(class{constructor(e){this.view=e,this.isDown=!1}set(e){this.isDown!=e&&(this.isDown=e,this.view.update([]))}},{eventObservers:{keydown(e){this.set(e.keyCode==t||n(e))},keyup(e){e.keyCode!=t&&n(e)||this.set(!1)},mousemove(e){this.set(n(e))}}});return[i,Xh.contentAttributes.of((e=>{var t;return(null===(t=e.plugin(i))||void 0===t?void 0:t.isDown)?Pu:null}))]}const _u="-10000px";class Zu{constructor(e,t,n){this.facet=t,this.createTooltipView=n,this.input=e.state.facet(t),this.tooltips=this.input.filter((e=>e)),this.tooltipViews=this.tooltips.map(n)}update(e,t){var n;let i=e.state.facet(this.facet),r=i.filter((e=>e));if(i===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let s=[],o=t?[]:null;for(let n=0;nt[n]=e)),t.length=o.length),this.input=i,this.tooltips=r,this.tooltipViews=s,!0}}function Cu(e){let{win:t}=e;return{top:0,left:0,bottom:t.innerHeight,right:t.innerWidth}}const Xu=Ts.define({combine:e=>{var t,n,i;return{position:Ya.ios?"absolute":(null===(t=e.find((e=>e.position)))||void 0===t?void 0:t.position)||"fixed",parent:(null===(n=e.find((e=>e.parent)))||void 0===n?void 0:n.parent)||null,tooltipSpace:(null===(i=e.find((e=>e.tooltipSpace)))||void 0===i?void 0:i.tooltipSpace)||Cu}}}),Yu=new WeakMap,Ru=xl.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(Xu);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.manager=new Zu(e,Wu,(e=>this.createTooltip(e))),this.intersectionObserver="function"==typeof IntersectionObserver?new IntersectionObserver((e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()}),{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout((()=>{this.measureTimeout=-1,this.maybeMeasure()}),50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,i=e.state.facet(Xu);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e){let t=e.create(this.view);if(t.dom.classList.add("cm-tooltip"),e.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let e=document.createElement("div");e.className="cm-tooltip-arrow",t.dom.appendChild(e)}return t.dom.style.position=this.position,t.dom.style.top=_u,this.container.appendChild(t.dom),t.mount&&t.mount(this.view),t}destroy(){var e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),null===(e=t.destroy)||void 0===e||e.call(t);this.parent&&this.container.remove(),null===(t=this.intersectionObserver)||void 0===t||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=this.view.dom.getBoundingClientRect(),t=1,n=1,i=!1;if("fixed"==this.position&&this.manager.tooltipViews.length){let{offsetParent:e}=this.manager.tooltipViews[0].dom;i=!(!e||e==this.container.ownerDocument.body)}if(i||"absolute"==this.position)if(this.parent){let e=this.parent.getBoundingClientRect();e.width&&e.height&&(t=e.width/this.parent.offsetWidth,n=e.height/this.parent.offsetHeight)}else({scaleX:t,scaleY:n}=this.view.viewState);return{editor:e,parent:this.parent?this.container.getBoundingClientRect():e,pos:this.manager.tooltips.map(((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)})),size:this.manager.tooltipViews.map((({dom:e})=>e.getBoundingClientRect())),space:this.view.state.facet(Xu).tooltipSpace(this.view),scaleX:t,scaleY:n,makeAbsolute:i}}writeMeasure(e){var t;if(e.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let e of this.manager.tooltipViews)e.dom.style.position="absolute"}let{editor:n,space:i,scaleX:r,scaleY:s}=e,o=[];for(let a=0;a=Math.min(n.bottom,i.bottom)||u.rightMath.min(n.right,i.right)+.1){h.style.top=_u;continue}let f=l.arrow?c.dom.querySelector(".cm-tooltip-arrow"):null,O=f?7:0,p=d.right-d.left,m=null!==(t=Yu.get(c))&&void 0!==t?t:d.bottom-d.top,g=c.offset||Au,b=this.view.textDirection==Yl.LTR,w=d.width>i.right-i.left?b?i.left:i.right-d.width:b?Math.min(u.left-(f?14:0)+g.x,i.right-p):Math.max(i.left,u.left-p+(f?14:0)-g.x),x=this.above[a];!l.strictSide&&(x?u.top-(d.bottom-d.top)-g.yi.bottom)&&x==i.bottom-u.bottom>u.top-i.top&&(x=this.above[a]=!x);let v=(x?u.top-i.top:i.bottom-u.bottom)-O;if(vw&&e.topy&&(y=x?e.top-m-2-O:e.bottom+O+2);if("absolute"==this.position?(h.style.top=(y-e.parent.top)/s+"px",h.style.left=(w-e.parent.left)/r+"px"):(h.style.top=y/s+"px",h.style.left=w/r+"px"),f){let e=u.left+(b?g.x:-g.x)-(w+14-7);f.style.left=e/r+"px"}!0!==c.overlap&&o.push({left:w,top:y,right:S,bottom:y+m}),h.classList.toggle("cm-tooltip-above",x),h.classList.toggle("cm-tooltip-below",!x),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=_u}},{eventObservers:{scroll(){this.maybeMeasure()}}}),qu=Xh.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),Au={x:0,y:0},Wu=Ts.define({enables:[Ru,qu]}),Eu=Ts.define();class ju{static create(e){return new ju(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new Zu(e,Eu,(e=>this.createHostedView(e)))}createHostedView(e){let t=e.create(this.view);return t.dom.classList.add("cm-tooltip-section"),this.dom.appendChild(t.dom),this.mounted&&t.mount&&t.mount(this.view),t}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)null===(e=t.destroy)||void 0===e||e.call(t)}}const zu=Wu.compute([Eu],(e=>{let t=e.facet(Eu).filter((e=>e));return 0===t.length?null:{pos:Math.min(...t.map((e=>e.pos))),end:Math.max(...t.filter((e=>null!=e.end)).map((e=>e.end))),create:ju.create,above:t[0].above,arrow:t.some((e=>e.arrow))}}));class Du{constructor(e,t,n,i,r){this.view=e,this.source=t,this.field=n,this.setHover=i,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout((()=>this.startHover()),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active)return;let e=Date.now()-this.lastMove.time;en.bottom||t.xn.right+e.defaultCharacterWidth)return;let s=e.bidiSpans(e.state.doc.lineAt(i)).find((e=>e.from<=i&&e.to>=i)),o=s&&s.dir==Yl.RTL?-1:1;r=t.x{this.pending==t&&(this.pending=null,n&&e.dispatch({effects:this.setHover.of(n)}))}),(t=>ml(e.state,t,"hover tooltip")))}else s&&e.dispatch({effects:this.setHover.of(s)})}mousemove(e){var t;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let n=this.active;if(n&&!Uu(this.lastMove.target)||this.pending){let{pos:i}=n||this.pending,r=null!==(t=null==n?void 0:n.end)&&void 0!==t?t:i;(i==r?this.view.posAtCoords(this.lastMove)==i:function(e,t,n,i,r,s){let o=e.scrollDOM.getBoundingClientRect(),a=e.documentTop+e.documentPadding.top+e.contentHeight;if(o.left>i||o.rightr||Math.min(o.bottom,a)=t&&l<=n}(this.view,i,r,e.clientX,e.clientY))||(this.view.dispatch({effects:this.setHover.of(null)}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1,this.active&&!Uu(e.relatedTarget)&&this.view.dispatch({effects:this.setHover.of(null)})}destroy(){clearTimeout(this.hoverTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}function Uu(e){for(let t=e;t;t=t.parentNode)if(1==t.nodeType&&t.classList.contains("cm-tooltip"))return!0;return!1}function Vu(e,t={}){let n=ro.define(),i=qs.define({create:()=>null,update(e,i){if(e&&(t.hideOnChange&&(i.docChanged||i.selection)||t.hideOn&&t.hideOn(i,e)))return null;if(e&&i.docChanged){let t=i.changes.mapPos(e.pos,-1,ps.TrackDel);if(null==t)return null;let n=Object.assign(Object.create(null),e);n.pos=t,null!=e.end&&(n.end=i.changes.mapPos(e.end)),e=n}for(let t of i.effects)t.is(n)&&(e=t.value),t.is(Iu)&&(e=null);return e},provide:e=>Eu.from(e)});return[i,xl.define((r=>new Du(r,e,i,n,t.hoverTime||300))),zu]}const Iu=ro.define(),Mu=Ts.define({combine(e){let t,n;for(let i of e)t=t||i.topContainer,n=n||i.bottomContainer;return{topContainer:t,bottomContainer:n}}});function Gu(e,t){let n=e.plugin(Bu),i=n?n.specs.indexOf(t):-1;return i>-1?n.panels[i]:null}const Bu=xl.fromClass(class{constructor(e){this.input=e.state.facet(Fu),this.specs=this.input.filter((e=>e)),this.panels=this.specs.map((t=>t(e)));let t=e.state.facet(Mu);this.top=new Nu(e,!0,t.topContainer),this.bottom=new Nu(e,!1,t.bottomContainer),this.top.sync(this.panels.filter((e=>e.top))),this.bottom.sync(this.panels.filter((e=>!e.top)));for(let e of this.panels)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}update(e){let t=e.state.facet(Mu);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new Nu(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new Nu(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(Fu);if(n!=this.input){let t=n.filter((e=>e)),i=[],r=[],s=[],o=[];for(let n of t){let t,a=this.specs.indexOf(n);a<0?(t=n(e.view),o.push(t)):(t=this.panels[a],t.update&&t.update(e)),i.push(t),(t.top?r:s).push(t)}this.specs=t,this.panels=i,this.top.sync(r),this.bottom.sync(s);for(let e of o)e.dom.classList.add("cm-panel"),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>Xh.scrollMargins.of((t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}}))});class Nu{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(0==this.panels.length)return void(this.dom&&(this.dom.remove(),this.dom=void 0));if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=Lu(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=Lu(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(this.container&&this.classes!=this.view.themeClasses){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function Lu(e){let t=e.nextSibling;return e.remove(),t}const Fu=Ts.define({enables:Bu});class Hu extends wo{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}Hu.prototype.elementClass="",Hu.prototype.toDOM=void 0,Hu.prototype.mapMode=ps.TrackBefore,Hu.prototype.startSide=Hu.prototype.endSide=-1,Hu.prototype.point=!0;const Ku=Ts.define(),Ju={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>So.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{}},ed=Ts.define();function td(e){return[id(),ed.of(Object.assign(Object.assign({},Ju),e))]}const nd=Ts.define({combine:e=>e.some((e=>e))});function id(e){let t=[rd];return e&&!1===e.fixed&&t.push(nd.of(!0)),t}const rd=xl.fromClass(class{constructor(e){this.view=e,this.prevViewport=e.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=e.state.facet(ed).map((t=>new ld(e,t)));for(let e of this.gutters)this.dom.appendChild(e.dom);this.fixed=!e.state.facet(nd),this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),e.scrollDOM.insertBefore(this.dom,e.contentDOM)}update(e){if(this.updateGutters(e)){let t=this.prevViewport,n=e.view.viewport,i=Math.min(t.to,n.to)-Math.max(t.from,n.from);this.syncGutters(i<.8*(n.to-n.from))}e.geometryChanged&&(this.dom.style.minHeight=this.view.contentHeight+"px"),this.view.state.facet(nd)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":""),this.prevViewport=e.view.viewport}syncGutters(e){let t=this.dom.nextSibling;e&&this.dom.remove();let n=So.iter(this.view.state.facet(Ku),this.view.viewport.from),i=[],r=this.gutters.map((e=>new ad(e,this.view.viewport,-this.view.documentPadding.top)));for(let e of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(e.type)){let t=!0;for(let s of e.type)if(s.type==La.Text&&t){od(n,i,s.from);for(let e of r)e.line(this.view,s,i);t=!1}else if(s.widget)for(let e of r)e.widget(this.view,s)}else if(e.type==La.Text){od(n,i,e.from);for(let t of r)t.line(this.view,e,i)}else if(e.widget)for(let t of r)t.widget(this.view,e);for(let e of r)e.finish();e&&this.view.scrollDOM.insertBefore(this.dom,t)}updateGutters(e){let t=e.startState.facet(ed),n=e.state.facet(ed),i=e.docChanged||e.heightChanged||e.viewportChanged||!So.eq(e.startState.facet(Ku),e.state.facet(Ku),e.view.viewport.from,e.view.viewport.to);if(t==n)for(let t of this.gutters)t.update(e)&&(i=!0);else{i=!0;let r=[];for(let i of n){let n=t.indexOf(i);n<0?r.push(new ld(this.view,i)):(this.gutters[n].update(e),r.push(this.gutters[n]))}for(let e of this.gutters)e.dom.remove(),r.indexOf(e)<0&&e.destroy();for(let e of r)this.dom.appendChild(e.dom);this.gutters=r}return i}destroy(){for(let e of this.gutters)e.destroy();this.dom.remove()}},{provide:e=>Xh.scrollMargins.of((t=>{let n=t.plugin(e);return n&&0!=n.gutters.length&&n.fixed?t.textDirection==Yl.LTR?{left:n.dom.offsetWidth*t.scaleX}:{right:n.dom.offsetWidth*t.scaleX}:null}))});function sd(e){return Array.isArray(e)?e:[e]}function od(e,t,n){for(;e.value&&e.from<=n;)e.from==n&&t.push(e.value),e.next()}class ad{constructor(e,t,n){this.gutter=e,this.height=n,this.i=0,this.cursor=So.iter(e.markers,t.from)}addElement(e,t,n){let{gutter:i}=this,r=(t.top-this.height)/e.scaleY,s=t.height/e.scaleY;if(this.i==i.elements.length){let t=new cd(e,s,r,n);i.elements.push(t),i.dom.appendChild(t.dom)}else i.elements[this.i].update(e,s,r,n);this.height=t.bottom,this.i++}line(e,t,n){let i=[];od(this.cursor,i,t.from),n.length&&(i=i.concat(n));let r=this.gutter.config.lineMarker(e,t,i);r&&i.unshift(r);let s=this.gutter;(0!=i.length||s.config.renderEmptyElements)&&this.addElement(e,t,i)}widget(e,t){let n=this.gutter.config.widgetMarker(e,t.widget,t);n&&this.addElement(e,t,[n])}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class ld{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let n in t.domEventHandlers)this.dom.addEventListener(n,(i=>{let r,s=i.target;if(s!=this.dom&&this.dom.contains(s)){for(;s.parentNode!=this.dom;)s=s.parentNode;let e=s.getBoundingClientRect();r=(e.top+e.bottom)/2}else r=i.clientY;let o=e.lineBlockAtHeight(r-e.documentTop);t.domEventHandlers[n](e,o,i)&&i.preventDefault()}));this.markers=sd(t.markers(e)),t.initialSpacer&&(this.spacer=new cd(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=sd(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let t=this.config.updateSpacer(this.spacer.markers[0],e);t!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[t])}let n=e.view.viewport;return!So.eq(this.markers,t,n.from,n.to)||!!this.config.lineMarkerChange&&this.config.lineMarkerChange(e)}destroy(){for(let e of this.elements)e.destroy()}}class cd{constructor(e,t,n,i){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,n,i)}update(e,t,n,i){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=n&&(this.dom.style.marginTop=(this.above=n)?n+"px":""),function(e,t){if(e.length!=t.length)return!1;for(let n=0;nbo(e,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let n=Object.assign({},e);for(let e in t){let i=n[e],r=t[e];n[e]=i?(e,t,n)=>i(e,t,n)||r(e,t,n):r}return n}})});class dd extends Hu{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function fd(e,t){return e.state.facet(ud).formatNumber(t,e.state)}const Od=ed.compute([ud],(e=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers:e=>e.state.facet(hd),lineMarker:(e,t,n)=>n.some((e=>e.toDOM))?null:new dd(fd(e,e.state.doc.lineAt(t.from).number)),widgetMarker:()=>null,lineMarkerChange:e=>e.startState.facet(ud)!=e.state.facet(ud),initialSpacer:e=>new dd(fd(e,md(e.state.doc.lines))),updateSpacer(e,t){let n=fd(t.view,md(t.view.state.doc.lines));return n==e.number?e:new dd(n)},domEventHandlers:e.facet(ud).domEventHandlers})));function pd(e={}){return[ud.of(e),id(),Od]}function md(e){let t=9;for(;t{let t=[],n=-1;for(let i of e.selection.ranges){let r=e.doc.lineAt(i.head).from;r>n&&(n=r,t.push(gd.range(r)))}return So.of(t)}));const wd=1024;let xd=0;class vd{constructor(e,t){this.from=e,this.to=t}}class yd{constructor(e={}){this.id=xd++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return"function"!=typeof e&&(e=Qd.match(e)),t=>{let n=e(t);return void 0===n?null:[this,n]}}}yd.closedBy=new yd({deserialize:e=>e.split(" ")}),yd.openedBy=new yd({deserialize:e=>e.split(" ")}),yd.group=new yd({deserialize:e=>e.split(" ")}),yd.contextHash=new yd({perNode:!0}),yd.lookAhead=new yd({perNode:!0}),yd.mounted=new yd({perNode:!0});class Sd{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[yd.mounted.id]}}const $d=Object.create(null);class Qd{constructor(e,t,n,i=0){this.name=e,this.props=t,this.id=n,this.flags=i}static define(e){let t=e.props&&e.props.length?Object.create(null):$d,n=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(null==e.name?8:0),i=new Qd(e.name||"",t,e.id,n);if(e.props)for(let n of e.props)if(Array.isArray(n)||(n=n(i)),n){if(n[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[n[0].id]=n[1]}return i}prop(e){return this.props[e.id]}get isTop(){return(1&this.flags)>0}get isSkipped(){return(2&this.flags)>0}get isError(){return(4&this.flags)>0}get isAnonymous(){return(8&this.flags)>0}is(e){if("string"==typeof e){if(this.name==e)return!0;let t=this.prop(yd.group);return!!t&&t.indexOf(e)>-1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let i of n.split(" "))t[i]=e[n];return e=>{for(let n=e.prop(yd.group),i=-1;i<(n?n.length:0);i++){let r=t[i<0?e.name:n[i]];if(r)return r}}}}Qd.none=new Qd("",Object.create(null),0,8);class kd{constructor(e){this.types=e;for(let t=0;t=t){let o=new Ad(s.tree,s.overlay[0].from+e.from,0,null);(r||(r=[i])).push(Rd(o,t,n,!1))}}return r?Dd(r):i}(this,e,t)}iterate(e){let{enter:t,leave:n,from:i=0,to:r=this.length}=e,s=e.mode||0,o=(s&_d.IncludeAnonymous)>0;for(let e=this.cursor(s|_d.IncludeAnonymous);;){let s=!1;if(e.from<=r&&e.to>=i&&(!o&&e.type.isAnonymous||!1!==t(e))){if(e.firstChild())continue;s=!0}for(;s&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;s=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:Bd(Qd.none,this.children,this.positions,0,this.children.length,0,this.length,((e,t,n)=>new Zd(this.type,e,t,n,this.propValues)),e.makeTree||((e,t,n)=>new Zd(Qd.none,e,t,n)))}static build(e){return function(e){var t;let{buffer:n,nodeSet:i,maxBufferLength:r=wd,reused:s=[],minRepeatType:o=i.types.length}=e,a=Array.isArray(n)?new Cd(n,n.length):n,l=i.types,c=0,h=0;function u(e,t,n,g,b){let{id:w,start:x,end:v,size:y}=a,S=h;for(;y<0;){if(a.next(),-1==y){let t=s[w];return n.push(t),void g.push(x-e)}if(-3==y)return void(c=w);if(-4==y)return void(h=w);throw new RangeError(`Unrecognized record size: ${y}`)}let $,Q,k=l[w],P=x-e;if(v-x<=r&&(Q=p(a.pos-t,b))){let t=new Uint16Array(Q.size-Q.skip),n=a.pos-Q.size,r=t.length;for(;a.pos>n;)r=m(Q.start,t,r);$=new Xd(t,v-Q.start,i),P=Q.start-e}else{let e=a.pos-y;a.next();let t=[],n=[],i=w>=o?w:-1,s=0,l=v;for(;a.pos>e;)i>=0&&a.id==i&&a.size>=0?(a.end<=l-r&&(f(t,n,x,s,a.end,l,i,S),s=t.length,l=a.end),a.next()):u(x,e,t,n,i);if(i>=0&&s>0&&s-1&&s>0){let e=d(k);$=Bd(k,t,n,0,t.length,0,v-x,e,e)}else $=O(k,t,n,v-x,S-v)}n.push($),g.push(P)}function d(e){return(t,n,i)=>{let r,s,o=0,a=t.length-1;if(a>=0&&(r=t[a])instanceof Zd){if(!a&&r.type==e&&r.length==i)return r;(s=r.prop(yd.lookAhead))&&(o=n[a]+r.length+s)}return O(e,t,n,i,o)}}function f(e,t,n,r,s,o,a,l){let c=[],h=[];for(;e.length>r;)c.push(e.pop()),h.push(t.pop()+n-s);e.push(O(i.types[a],c,h,o-s,l-o)),t.push(s-n)}function O(e,t,n,i,r=0,s){if(c){let e=[yd.contextHash,c];s=s?[e].concat(s):[e]}if(r>25){let e=[yd.lookAhead,r];s=s?[e].concat(s):[e]}return new Zd(e,t,n,i,s)}function p(e,t){let n=a.fork(),i=0,s=0,l=0,c=n.end-r,h={size:0,start:0,skip:0};e:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){h.size=i,h.start=s,h.skip=l,l+=4,i+=4,n.next();continue}let a=n.pos-e;if(e<0||a=o?4:0,d=n.start;for(n.next();n.pos>a;){if(n.size<0){if(-3!=n.size)break e;u+=4}else n.id>=o&&(u+=4);n.next()}s=d,i+=e,l+=u}return(t<0||i==e)&&(h.size=i,h.start=s,h.skip=l),h.size>4?h:void 0}function m(e,t,n){let{id:i,start:r,end:s,size:l}=a;if(a.next(),l>=0&&i4){let i=a.pos-(l-4);for(;a.pos>i;)n=m(e,t,n)}t[--n]=o,t[--n]=s-e,t[--n]=r-e,t[--n]=i}else-3==l?c=i:-4==l&&(h=i);return n}let g=[],b=[];for(;a.pos>0;)u(e.start||0,e.bufferStart||0,g,b,-1);let w=null!==(t=e.length)&&void 0!==t?t:g.length?b[0]+g[0].length:0;return new Zd(l[e.topID],g.reverse(),b.reverse(),w)}(e)}}Zd.empty=new Zd(Qd.none,[],[],0);class Cd{constructor(e,t){this.buffer=e,this.index=t}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]}get pos(){return this.index}next(){this.index-=4}fork(){return new Cd(this.buffer,this.index)}}class Xd{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Qd.none}toString(){let e=[];for(let t=0;t0));a=s[a+3]);return o}slice(e,t,n){let i=this.buffer,r=new Uint16Array(t-e),s=0;for(let o=e,a=0;o=t&&nt;case 1:return n<=t&&i>t;case 2:return i>t;case 4:return!0}}function Rd(e,t,n,i){for(var r;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to0?o.length:-1;e!=l;e+=t){let l=o[e],c=a[e]+s.from;if(Yd(i,n,c,c+l.length))if(l instanceof Xd){if(r&_d.ExcludeBuffers)continue;let o=l.findChild(0,l.buffer.length,t,n-c,i);if(o>-1)return new zd(new jd(s,l,e,c),null,o)}else if(r&_d.IncludeAnonymous||!l.type.isAnonymous||Id(l)){let o;if(!(r&_d.IgnoreMounts)&&(o=Sd.get(l))&&!o.overlay)return new Ad(o.tree,c,e,s);let a=new Ad(l,c,e,s);return r&_d.IncludeAnonymous||!a.type.isAnonymous?a:a.nextChild(t<0?l.children.length-1:0,t,n,i)}}if(r&_d.IncludeAnonymous||!s.type.isAnonymous)return null;if(e=s.index>=0?s.index+t:t<0?-1:s._parent._tree.children.length,s=s._parent,!s)return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,t,n=0){let i;if(!(n&_d.IgnoreOverlays)&&(i=Sd.get(this._tree))&&i.overlay){let n=e-this.from;for(let{from:e,to:r}of i.overlay)if((t>0?e<=n:e=n:r>n))return new Ad(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,n)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Wd(e,t,n,i){let r=e.cursor(),s=[];if(!r.firstChild())return s;if(null!=n)for(;!r.type.is(n);)if(!r.nextSibling())return s;for(;;){if(null!=i&&r.type.is(i))return s;if(r.type.is(t)&&s.push(r.node),!r.nextSibling())return null==i?s:[]}}function Ed(e,t,n=t.length-1){for(let i=e.parent;n>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(t[n]&&t[n]!=i.name)return!1;n--}}return!0}class jd{constructor(e,t,n,i){this.parent=e,this.buffer=t,this.index=n,this.start=i}}class zd extends qd{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(e,t,n){let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],e,t-this.context.start,n);return r<0?null:new zd(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,t,n=0){if(n&_d.ExcludeBuffers)return null;let{buffer:i}=this.context,r=i.findChild(this.index+4,i.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new zd(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new zd(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new zd(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,i=this.index+4,r=n.buffer[this.index+3];if(r>i){let s=n.buffer[this.index+1];e.push(n.slice(i,r,s)),t.push(0)}return new Zd(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Dd(e){if(!e.length)return null;if(1==e.length)return e[0];let t=0,n=e[0];for(let i=1;in.from||r.to0){if(this.index-1)for(let i=t+e,r=e<0?-1:n._tree.children.length;i!=r;i+=e){let e=n._tree.children[i];if(this.mode&_d.IncludeAnonymous||e instanceof Xd||!e.type.isAnonymous||Id(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let s=e;s;s=s._parent)if(s.index==i){if(i==this.index)return s;t=s,n=r+1;break e}i=this.stack[--r]}for(let e=n;e=0;r--){if(r<0)return Ed(this.node,e,i);let s=n[t.buffer[this.stack[r]]];if(!s.isAnonymous){if(e[i]&&e[i]!=s.name)return!1;i--}}return!0}}function Id(e){return e.children.some((e=>e instanceof Xd||!e.type.isAnonymous||Id(e)))}const Md=new WeakMap;function Gd(e,t){if(!e.isAnonymous||t instanceof Xd||t.type!=e)return 1;let n=Md.get(t);if(null==n){n=1;for(let i of t.children){if(i.type!=e||!(i instanceof Zd)){n=1;break}n+=Gd(e,i)}Md.set(t,n)}return n}function Bd(e,t,n,i,r,s,o,a,l){let c=0;for(let n=i;n=h)break;O+=t}if(c==r+1){if(O>h){let e=n[r];t(e.children,e.positions,0,e.children.length,i[r]+a);continue}u.push(n[r])}else{let t=i[c-1]+n[c-1].length-f;u.push(Bd(e,n,i,r,c,f,t,null,l))}d.push(f+a-s)}}(t,n,i,r,0),(a||l)(u,d,o)}class Nd{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let i=this.map.get(e);i||this.map.set(e,i=new Map),i.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof zd?this.setBuffer(e.context.buffer,e.index,t):e instanceof Ad&&this.map.set(e.tree,t)}get(e){return e instanceof zd?this.getBuffer(e.context.buffer,e.index):e instanceof Ad?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}}class Ld{constructor(e,t,n,i,r=!1,s=!1){this.from=e,this.to=t,this.tree=n,this.offset=i,this.open=(r?1:0)|(s?2:0)}get openStart(){return(1&this.open)>0}get openEnd(){return(2&this.open)>0}static addTree(e,t=[],n=!1){let i=[new Ld(0,e.length,e,0,!1,n)];for(let n of t)n.to>e.length&&i.push(n);return i}static applyChanges(e,t,n=128){if(!t.length)return e;let i=[],r=1,s=e.length?e[0]:null;for(let o=0,a=0,l=0;;o++){let c=o=n)for(;s&&s.from=t.from||h<=t.to||l){let e=Math.max(t.from,a)-l,n=Math.min(t.to,h)-l;t=e>=n?null:new Ld(e,n,t.tree,t.offset+l,o>0,!!c)}if(t&&i.push(t),s.to>h)break;s=rnew vd(e.from,e.to))):[new vd(0,0)]:[new vd(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let i=this.startParse(e,t,n);for(;;){let e=i.advance();if(e)return e}}}class Hd{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new yd({perNode:!0});let Kd=0;class Jd{constructor(e,t,n){this.set=e,this.base=t,this.modified=n,this.id=Kd++}static define(e){if(null==e?void 0:e.base)throw new Error("Can not derive from a modified tag");let t=new Jd([],null,[]);if(t.set.push(t),e)for(let n of e.set)t.set.push(n);return t}static defineModifier(){let e=new tf;return t=>t.modified.indexOf(e)>-1?t:tf.get(t.base||t,t.modified.concat(e).sort(((e,t)=>e.id-t.id)))}}let ef=0;class tf{constructor(){this.instances=[],this.id=ef++}static get(e,t){if(!t.length)return e;let n=t[0].instances.find((n=>{return n.base==e&&(i=t,r=n.modified,i.length==r.length&&i.every(((e,t)=>e==r[t])));var i,r}));if(n)return n;let i=[],r=new Jd(i,e,t);for(let e of t)e.instances.push(r);let s=function(e){let t=[[]];for(let n=0;nt.length-e.length))}(t);for(let t of e.set)if(!t.modified.length)for(let e of s)i.push(tf.get(t,e));return r}}function nf(e){let t=Object.create(null);for(let n in e){let i=e[n];Array.isArray(i)||(i=[i]);for(let e of n.split(" "))if(e){let n=[],r=2,s=e;for(let t=0;;){if("..."==s&&t>0&&t+3==e.length){r=1;break}let i=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(s);if(!i)throw new RangeError("Invalid path: "+e);if(n.push("*"==i[0]?"":'"'==i[0][0]?JSON.parse(i[0]):i[0]),t+=i[0].length,t==e.length)break;let o=e[t++];if(t==e.length&&"!"==o){r=0;break}if("/"!=o)throw new RangeError("Invalid path: "+e);s=e.slice(t)}let o=n.length-1,a=n[o];if(!a)throw new RangeError("Invalid path: "+e);let l=new sf(i,r,o>0?n.slice(0,o):null);t[a]=l.sort(t[a])}}return rf.add(t)}const rf=new yd;class sf{constructor(e,t,n,i){this.tags=e,this.mode=t,this.context=n,this.next=i}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(e){return!e||e.depth{let t=r;for(let i of e)for(let e of i.set){let i=n[e.id];if(i){t=t?t+" "+i:i;break}}return t},scope:i}}function af(e,t,n,i=0,r=e.length){let s=new lf(i,Array.isArray(t)?t:[t],n);s.highlightRange(e.cursor(),i,r,"",s.highlighters),s.flush(r)}sf.empty=new sf([],2,null);class lf{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,i,r){let{type:s,from:o,to:a}=e;if(o>=n||a<=t)return;s.isTop&&(r=this.highlighters.filter((e=>!e.scope||e.scope(s))));let l=i,c=function(e){let t=e.type.prop(rf);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}(e)||sf.empty,h=function(e,t){let n=null;for(let i of e){let e=i.style(t);e&&(n=n?n+" "+e:e)}return n}(r,c.tags);if(h&&(l&&(l+=" "),l+=h,1==c.mode&&(i+=(i?" ":"")+h)),this.startSpan(e.from,l),c.opaque)return;let u=e.tree&&e.tree.prop(yd.mounted);if(u&&u.overlay){let s=e.node.enter(u.overlay[0].from+o,1),c=this.highlighters.filter((e=>!e.scope||e.scope(u.tree.type))),h=e.firstChild();for(let d=0,f=o;;d++){let O=d=p)&&e.nextSibling()););if(!O||p>n)break;f=O.to+o,f>t&&(this.highlightRange(s.cursor(),Math.max(t,O.from+o),Math.min(n,f),i,c),this.startSpan(f,l))}h&&e.parent()}else if(e.firstChild()){do{if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,i,r),this.startSpan(Math.min(n,e.to),l)}}while(e.nextSibling());e.parent()}}}const cf=Jd.define,hf=cf(),uf=cf(),df=cf(uf),ff=cf(uf),Of=cf(),pf=cf(Of),mf=cf(Of),gf=cf(),bf=cf(gf),wf=cf(),xf=cf(),vf=cf(),yf=cf(vf),Sf=cf(),$f={comment:hf,lineComment:cf(hf),blockComment:cf(hf),docComment:cf(hf),name:uf,variableName:cf(uf),typeName:df,tagName:cf(df),propertyName:ff,attributeName:cf(ff),className:cf(uf),labelName:cf(uf),namespace:cf(uf),macroName:cf(uf),literal:Of,string:pf,docString:cf(pf),character:cf(pf),attributeValue:cf(pf),number:mf,integer:cf(mf),float:cf(mf),bool:cf(Of),regexp:cf(Of),escape:cf(Of),color:cf(Of),url:cf(Of),keyword:wf,self:cf(wf),null:cf(wf),atom:cf(wf),unit:cf(wf),modifier:cf(wf),operatorKeyword:cf(wf),controlKeyword:cf(wf),definitionKeyword:cf(wf),moduleKeyword:cf(wf),operator:xf,derefOperator:cf(xf),arithmeticOperator:cf(xf),logicOperator:cf(xf),bitwiseOperator:cf(xf),compareOperator:cf(xf),updateOperator:cf(xf),definitionOperator:cf(xf),typeOperator:cf(xf),controlOperator:cf(xf),punctuation:vf,separator:cf(vf),bracket:yf,angleBracket:cf(yf),squareBracket:cf(yf),paren:cf(yf),brace:cf(yf),content:gf,heading:bf,heading1:cf(bf),heading2:cf(bf),heading3:cf(bf),heading4:cf(bf),heading5:cf(bf),heading6:cf(bf),contentSeparator:cf(gf),list:cf(gf),quote:cf(gf),emphasis:cf(gf),strong:cf(gf),link:cf(gf),monospace:cf(gf),strikethrough:cf(gf),inserted:cf(),deleted:cf(),changed:cf(),invalid:cf(),meta:Sf,documentMeta:cf(Sf),annotation:cf(Sf),processingInstruction:cf(Sf),definition:Jd.defineModifier(),constant:Jd.defineModifier(),function:Jd.defineModifier(),standard:Jd.defineModifier(),local:Jd.defineModifier(),special:Jd.defineModifier()};var Qf;of([{tag:$f.link,class:"tok-link"},{tag:$f.heading,class:"tok-heading"},{tag:$f.emphasis,class:"tok-emphasis"},{tag:$f.strong,class:"tok-strong"},{tag:$f.keyword,class:"tok-keyword"},{tag:$f.atom,class:"tok-atom"},{tag:$f.bool,class:"tok-bool"},{tag:$f.url,class:"tok-url"},{tag:$f.labelName,class:"tok-labelName"},{tag:$f.inserted,class:"tok-inserted"},{tag:$f.deleted,class:"tok-deleted"},{tag:$f.literal,class:"tok-literal"},{tag:$f.string,class:"tok-string"},{tag:$f.number,class:"tok-number"},{tag:[$f.regexp,$f.escape,$f.special($f.string)],class:"tok-string2"},{tag:$f.variableName,class:"tok-variableName"},{tag:$f.local($f.variableName),class:"tok-variableName tok-local"},{tag:$f.definition($f.variableName),class:"tok-variableName tok-definition"},{tag:$f.special($f.variableName),class:"tok-variableName2"},{tag:$f.definition($f.propertyName),class:"tok-propertyName tok-definition"},{tag:$f.typeName,class:"tok-typeName"},{tag:$f.namespace,class:"tok-namespace"},{tag:$f.className,class:"tok-className"},{tag:$f.macroName,class:"tok-macroName"},{tag:$f.propertyName,class:"tok-propertyName"},{tag:$f.operator,class:"tok-operator"},{tag:$f.comment,class:"tok-comment"},{tag:$f.meta,class:"tok-meta"},{tag:$f.invalid,class:"tok-invalid"},{tag:$f.punctuation,class:"tok-punctuation"}]);const kf=new yd;function Pf(e){return Ts.define({combine:e?t=>t.concat(e):void 0})}const Tf=new yd;class _f{constructor(e,t,n=[],i=""){this.data=e,this.name=i,go.prototype.hasOwnProperty("tree")||Object.defineProperty(go.prototype,"tree",{get(){return Xf(this)}}),this.parser=t,this.extension=[Df.of(this),go.languageData.of(((e,t,n)=>{let i=Zf(e,t,n),r=i.type.prop(kf);if(!r)return[];let s=e.facet(r),o=i.type.prop(Tf);if(o){let r=i.resolve(t-i.from,n);for(let t of o)if(t.test(r,e)){let n=e.facet(t.facet);return"replace"==t.type?n:n.concat(s)}}return s}))].concat(n)}isActiveAt(e,t,n=-1){return Zf(e,t,n).type.prop(kf)==this.data}findRegions(e){let t=e.facet(Df);if((null==t?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],i=(e,t)=>{if(e.prop(kf)==this.data)return void n.push({from:t,to:t+e.length});let r=e.prop(yd.mounted);if(r){if(r.tree.prop(kf)==this.data){if(r.overlay)for(let e of r.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(r.overlay){let e=n.length;if(i(r.tree,r.overlay[0].from+t),n.length>e)return}}for(let n=0;ne.isTop?t:void 0))]}),e.name)}configure(e,t){return new Cf(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Xf(e){let t=e.field(_f.state,!1);return t?t.tree:Zd.empty}class Yf{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}}let Rf=null;class qf{constructor(e,t,n=[],i,r,s,o,a){this.parser=e,this.state=t,this.fragments=n,this.tree=i,this.treeLen=r,this.viewport=s,this.skipped=o,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,n){return new qf(e,t,[],Zd.empty,0,n,[],null)}startParse(){return this.parser.startParse(new Yf(this.state.doc),this.fragments)}work(e,t){return null!=t&&t>=this.state.doc.length&&(t=void 0),this.tree!=Zd.empty&&this.isDone(null!=t?t:this.state.doc.length)?(this.takeTree(),!0):this.withContext((()=>{var n;if("number"==typeof e){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||(this.parse=this.startParse()),null!=t&&(null==this.parse.stoppedAt||this.parse.stoppedAt>t)&&t=this.treeLen&&((null==this.parse.stoppedAt||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext((()=>{for(;!(t=this.parse.advance()););})),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Ld.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Rf;Rf=this;try{return e()}finally{Rf=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Af(e,t.from,t.to);return e}changes(e,t){let{fragments:n,tree:i,treeLen:r,viewport:s,skipped:o}=this;if(this.takeTree(),!e.empty){let t=[];if(e.iterChangedRanges(((e,n,i,r)=>t.push({fromA:e,toA:n,fromB:i,toB:r}))),n=Ld.applyChanges(n,t),i=Zd.empty,r=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){o=[];for(let t of this.skipped){let n=e.mapPos(t.from,1),i=e.mapPos(t.to,-1);ne.from&&(this.fragments=Af(this.fragments,n,i),this.skipped.splice(t--,1))}return!(this.skipped.length>=t)&&(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends Fd{createParse(t,n,i){let r=i[0].from,s=i[i.length-1].to;return{parsedPos:r,advance(){let t=Rf;if(t){for(let e of i)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=s,new Zd(Qd.none,[],[],s-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&0==t[0].from&&t[0].to>=e}static get(){return Rf}}function Af(e,t,n){return Ld.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}class Wf{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),n=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,n)||t.takeTree(),new Wf(t)}static init(e){let t=Math.min(3e3,e.doc.length),n=qf.create(e.facet(Df).parser,e,{from:0,to:t});return n.work(20,t)||n.takeTree(),new Wf(n)}}_f.state=qs.define({create:Wf.init,update(e,t){for(let e of t.effects)if(e.is(_f.setState))return e.value;return t.startState.facet(Df)!=t.state.facet(Df)?Wf.init(t.state):e.apply(t)}});let Ef=e=>{let t=setTimeout((()=>e()),500);return()=>clearTimeout(t)};"undefined"!=typeof requestIdleCallback&&(Ef=e=>{let t=-1,n=setTimeout((()=>{t=requestIdleCallback(e,{timeout:400})}),100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});const jf="undefined"!=typeof navigator&&(null===(Qf=navigator.scheduling)||void 0===Qf?void 0:Qf.isInputPending)?()=>navigator.scheduling.isInputPending():null,zf=xl.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(_f.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(_f.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=Ef(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndi+1e3,a=r.context.work((()=>jf&&jf()||Date.now()>s),i+(o?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:_f.setState.of(new Wf(r.context))})),this.chunkBudget>0&&(!a||o)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then((()=>this.scheduleWork())).catch((e=>ml(this.view.state,e))).then((()=>this.workScheduled--)),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Df=Ts.define({combine:e=>e.length?e[0]:null,enables:e=>[_f.state,zf,Xh.contentAttributes.compute([e],(t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}}))]});class Uf{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const Vf=Ts.define(),If=Ts.define({combine:e=>{if(!e.length)return" ";let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some((e=>e!=t[0])))throw new Error("Invalid indent unit: "+JSON.stringify(e[0]));return t}});function Mf(e){let t=e.facet(If);return 9==t.charCodeAt(0)?e.tabSize*t.length:t.length}function Gf(e,t){let n="",i=e.tabSize,r=e.facet(If)[0];if("\t"==r){for(;t>=i;)n+="\t",t-=i;r=" "}for(let e=0;e=t?function(e,t,n){let i=t.resolveStack(n),r=i.node.enterUnfinishedNodesBefore(n);if(r!=i.node){let e=[];for(let t=r;t!=i.node;t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)i={node:e[t],next:i}}return Ff(i,e,n)}(e,n,t):null}class Nf{constructor(e,t={}){this.state=e,this.options=t,this.unit=Mf(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:i,simulateDoubleBreak:r}=this.options;return null!=i&&i>=n.from&&i<=n.to?r&&i==e?{text:"",from:e}:(t<0?i-1&&(r+=s-this.countColumn(n,n.search(/\S|$/))),r}countColumn(e,t=e.length){return qo(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:i}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let e=r(i);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const Lf=new yd;function Ff(e,t,n){for(let i=e;i;i=i.next){let e=Hf(i.node);if(e)return e(Jf.create(t,n,i))}return 0}function Hf(e){let t=e.type.prop(Lf);if(t)return t;let n,i=e.firstChild;if(i&&(n=i.type.prop(yd.closedBy))){let t=e.lastChild,i=t&&n.indexOf(t.name)>-1;return e=>nO(e,!0,1,void 0,i&&!function(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}(e)?t.from:void 0)}return null==e.parent?Kf:null}function Kf(){return 0}class Jf extends Nf{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(e,t,n){return new Jf(e,t,n)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(eO(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return Ff(this.context.next,this.base,this.pos)}}function eO(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function tO({closing:e,align:t=!0,units:n=1}){return i=>nO(i,t,n,e)}function nO(e,t,n,i,r){let s=e.textAfter,o=s.match(/^\s*/)[0].length,a=i&&s.slice(o,o+i.length)==i||r==e.pos+o,l=t?function(e){let t=e.node,n=t.childAfter(t.from),i=t.lastChild;if(!n)return null;let r=e.options.simulateBreak,s=e.state.doc.lineAt(n.from),o=null==r||r<=s.from?s.to:Math.min(s.to,r);for(let e=n.to;;){let r=t.childAfter(e);if(!r||r==i)return null;if(!r.type.isSkipped)return r.from{let i=e&&e.test(n.textAfter);return n.baseIndent+(i?0:t*n.unit)}}const rO=Ts.define(),sO=new yd;function oO(e){let t=e.firstChild,n=e.lastChild;return t&&t.ton)continue;if(r&&o.from=t&&i.to>n&&(r=i)}}return r}(e,t,n)}function cO(e,t){let n=t.mapPos(e.from,1),i=t.mapPos(e.to,-1);return n>=i?void 0:{from:n,to:i}}const hO=ro.define({map:cO}),uO=ro.define({map:cO});function dO(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some((e=>e.from<=n&&e.to>=n))||t.push(e.lineBlockAt(n));return t}const fO=qs.define({create:()=>Fa.none,update(e,t){e=e.map(t.changes);for(let n of t.effects)if(n.is(hO)&&!pO(e,n.value.from,n.value.to)){let{preparePlaceholder:i}=t.state.facet(xO),r=i?Fa.replace({widget:new $O(i(t.state,n.value))}):SO;e=e.update({add:[r.range(n.value.from,n.value.to)]})}else n.is(uO)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));if(t.selection){let n=!1,{head:i}=t.selection.main;e.between(i,i,((e,t)=>{ei&&(n=!0)})),n&&(e=e.update({filterFrom:i,filterTo:i,filter:(e,t)=>t<=i||e>=i}))}return e},provide:e=>Xh.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,((e,t)=>{n.push(e,t)})),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw new RangeError("Invalid JSON for fold state");let t=[];for(let n=0;n{(!r||r.from>e)&&(r={from:e,to:t})})),r}function pO(e,t,n){let i=!1;return e.between(t,t,((e,r)=>{e==t&&r==n&&(i=!0)})),i}function mO(e,t){return e.field(fO,!1)?t:t.concat(ro.appendConfig.of(vO()))}function gO(e,t,n=!0){let i=e.state.doc.lineAt(t.from).number,r=e.state.doc.lineAt(t.to).number;return Xh.announce.of(`${e.state.phrase(n?"Folded lines":"Unfolded lines")} ${i} ${e.state.phrase("to")} ${r}.`)}const bO=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:e=>{for(let t of dO(e)){let n=lO(e.state,t.from,t.to);if(n)return e.dispatch({effects:mO(e.state,[hO.of(n),gO(e,n)])}),!0}return!1}},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:e=>{if(!e.state.field(fO,!1))return!1;let t=[];for(let n of dO(e)){let i=OO(e.state,n.from,n.to);i&&t.push(uO.of(i),gO(e,i,!1))}return t.length&&e.dispatch({effects:t}),t.length>0}},{key:"Ctrl-Alt-[",run:e=>{let{state:t}=e,n=[];for(let i=0;i{let t=e.state.field(fO,!1);if(!t||!t.size)return!1;let n=[];return t.between(0,e.state.doc.length,((e,t)=>{n.push(uO.of({from:e,to:t}))})),e.dispatch({effects:n}),!0}}],wO={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},xO=Ts.define({combine:e=>bo(e,wO)});function vO(e){let t=[fO,TO];return e&&t.push(xO.of(e)),t}function yO(e,t){let{state:n}=e,i=n.facet(xO),r=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),i=OO(e.state,n.from,n.to);i&&e.dispatch({effects:uO.of(i)}),t.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(e,r,t);let s=document.createElement("span");return s.textContent=i.placeholderText,s.setAttribute("aria-label",n.phrase("folded code")),s.title=n.phrase("unfold"),s.className="cm-foldPlaceholder",s.onclick=r,s}const SO=Fa.replace({widget:new class extends Na{toDOM(e){return yO(e,null)}}});class $O extends Na{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return yO(e,this.value)}}const QO={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class kO extends Hu{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function PO(e={}){let t=Object.assign(Object.assign({},QO),e),n=new kO(t,!0),i=new kO(t,!1),r=xl.fromClass(class{constructor(e){this.from=e.viewport.from,this.markers=this.buildMarkers(e)}update(e){(e.docChanged||e.viewportChanged||e.startState.facet(Df)!=e.state.facet(Df)||e.startState.field(fO,!1)!=e.state.field(fO,!1)||Xf(e.startState)!=Xf(e.state)||t.foldingChanged(e))&&(this.markers=this.buildMarkers(e.view))}buildMarkers(e){let t=new $o;for(let r of e.viewportLineBlocks){let s=OO(e.state,r.from,r.to)?i:lO(e.state,r.from,r.to)?n:null;s&&t.add(r.from,r.from,s)}return t.finish()}}),{domEventHandlers:s}=t;return[r,td({class:"cm-foldGutter",markers(e){var t;return(null===(t=e.plugin(r))||void 0===t?void 0:t.markers)||So.empty},initialSpacer:()=>new kO(t,!1),domEventHandlers:Object.assign(Object.assign({},s),{click:(e,t,n)=>{if(s.click&&s.click(e,t,n))return!0;let i=OO(e.state,t.from,t.to);if(i)return e.dispatch({effects:uO.of(i)}),!0;let r=lO(e.state,t.from,t.to);return!!r&&(e.dispatch({effects:hO.of(r)}),!0)}})}),vO()]}const TO=Xh.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class _O{constructor(e,t){let n;function i(e){let t=zo.newName();return(n||(n=Object.create(null)))["."+t]=e,t}this.specs=e;const r="string"==typeof t.all?t.all:t.all?i(t.all):void 0,s=t.scope;this.scope=s instanceof _f?e=>e.prop(kf)==s.data:s?e=>e==s:void 0,this.style=of(e.map((e=>({tag:e.tag,class:e.class||i(Object.assign({},e,{tag:null}))}))),{all:r}).style,this.module=n?new zo(n):null,this.themeType=t.themeType}static define(e,t){return new _O(e,t||{})}}const ZO=Ts.define(),CO=Ts.define({combine:e=>e.length?[e[0]]:null});function XO(e){let t=e.facet(ZO);return t.length?t:e.facet(CO)}function YO(e,t){let n,i=[qO];return e instanceof _O&&(e.module&&i.push(Xh.styleModule.of(e.module)),n=e.themeType),(null==t?void 0:t.fallback)?i.push(CO.of(e)):n?i.push(ZO.computeN([Xh.darkTheme],(t=>t.facet(Xh.darkTheme)==("dark"==n)?[e]:[]))):i.push(ZO.of(e)),i}class RO{constructor(e){this.markCache=Object.create(null),this.tree=Xf(e.state),this.decorations=this.buildDeco(e,XO(e.state))}update(e){let t=Xf(e.state),n=XO(e.state),i=n!=XO(e.startState);t.length{n.add(e,t,this.markCache[i]||(this.markCache[i]=Fa.mark({class:i})))}),i,r);return n.finish()}}const qO=Ds.high(xl.fromClass(RO,{decorations:e=>e.decorations})),AO=_O.define([{tag:$f.meta,color:"#404740"},{tag:$f.link,textDecoration:"underline"},{tag:$f.heading,textDecoration:"underline",fontWeight:"bold"},{tag:$f.emphasis,fontStyle:"italic"},{tag:$f.strong,fontWeight:"bold"},{tag:$f.strikethrough,textDecoration:"line-through"},{tag:$f.keyword,color:"#708"},{tag:[$f.atom,$f.bool,$f.url,$f.contentSeparator,$f.labelName],color:"#219"},{tag:[$f.literal,$f.inserted],color:"#164"},{tag:[$f.string,$f.deleted],color:"#a11"},{tag:[$f.regexp,$f.escape,$f.special($f.string)],color:"#e40"},{tag:$f.definition($f.variableName),color:"#00f"},{tag:$f.local($f.variableName),color:"#30a"},{tag:[$f.typeName,$f.namespace],color:"#085"},{tag:$f.className,color:"#167"},{tag:[$f.special($f.variableName),$f.macroName],color:"#256"},{tag:$f.definition($f.propertyName),color:"#00c"},{tag:$f.comment,color:"#940"},{tag:$f.invalid,color:"#f00"}]),WO=Xh.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),EO="()[]{}",jO=Ts.define({combine:e=>bo(e,{afterCursor:!0,brackets:EO,maxScanDistance:1e4,renderMatch:UO})}),zO=Fa.mark({class:"cm-matchingBracket"}),DO=Fa.mark({class:"cm-nonmatchingBracket"});function UO(e){let t=[],n=e.matched?zO:DO;return t.push(n.range(e.start.from,e.start.to)),e.end&&t.push(n.range(e.end.from,e.end.to)),t}const VO=qs.define({create:()=>Fa.none,update(e,t){if(!t.docChanged&&!t.selection)return e;let n=[],i=t.state.facet(jO);for(let e of t.state.selection.ranges){if(!e.empty)continue;let r=LO(t.state,e.head,-1,i)||e.head>0&&LO(t.state,e.head-1,1,i)||i.afterCursor&&(LO(t.state,e.head,1,i)||e.headXh.decorations.from(e)}),IO=[VO,WO];function MO(e={}){return[jO.of(e),IO]}const GO=new yd;function BO(e,t,n){let i=e.prop(t<0?yd.openedBy:yd.closedBy);if(i)return i;if(1==e.name.length){let i=n.indexOf(e.name);if(i>-1&&i%2==(t<0?1:0))return[n[i+t]]}return null}function NO(e){let t=e.type.prop(GO);return t?t(e.node):e}function LO(e,t,n,i={}){let r=i.maxScanDistance||1e4,s=i.brackets||EO,o=Xf(e),a=o.resolveInner(t,n);for(let i=a;i;i=i.parent){let r=BO(i.type,n,s);if(r&&i.from0?t>=o.from&&to.from&&t<=o.to))return FO(e,t,n,i,o,r,s)}}return function(e,t,n,i,r,s,o){let a=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),l=o.indexOf(a);if(l<0||l%2==0!=n>0)return null;let c={from:n<0?t-1:t,to:n>0?t+1:t},h=e.doc.iterRange(t,n>0?e.doc.length:0),u=0;for(let e=0;!h.next().done&&e<=s;){let s=h.value;n<0&&(e+=s.length);let a=t+e*n;for(let e=n>0?0:s.length-1,t=n>0?s.length:-1;e!=t;e+=n){let t=o.indexOf(s[e]);if(!(t<0||i.resolveInner(a+e,1).type!=r))if(t%2==0==n>0)u++;else{if(1==u)return{start:c,end:{from:a+e,to:a+e+1},matched:t>>1==l>>1};u--}}n>0&&(e+=s.length)}return h.done?{start:c,matched:!1}:null}(e,t,n,o,a.type,r,s)}function FO(e,t,n,i,r,s,o){let a=i.parent,l={from:r.from,to:r.to},c=0,h=null==a?void 0:a.cursor();if(h&&(n<0?h.childBefore(i.from):h.childAfter(i.to)))do{if(n<0?h.to<=i.from:h.from>=i.to){if(0==c&&s.indexOf(h.type.name)>-1&&h.from-1||(JO.push(e),console.warn(t))}function np(e,t){let n=null;for(let i of t.split(".")){let t=e[i]||$f[i];t?"function"==typeof t?n?n=t(n):tp(i,`Modifier ${i} used at start of tag`):n?tp(i,`Tag ${i} used as modifier`):n=t:tp(i,`Unknown highlighting tag ${i}`)}if(!n)return 0;let i=t.replace(/ /g,"_"),r=Qd.define({id:KO.length,name:i,props:[nf({[i]:n})]});return KO.push(r),r.id}function ip(e,t){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let r=e(t,n);return!!r&&(i(n.update(r)),!0)}}const rp=ip(cp,0),sp=ip(lp,0),op=ip(((e,t)=>lp(e,t,function(e){let t=[];for(let n of e.selection.ranges){let i=e.doc.lineAt(n.from),r=n.to<=i.to?i:e.doc.lineAt(n.to),s=t.length-1;s>=0&&t[s].to>i.from?t[s].to=r.to:t.push({from:i.from,to:r.to})}return t}(t))),0);function ap(e,t=e.selection.main.head){let n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}function lp(e,t,n=t.selection.ranges){let i=n.map((e=>ap(t,e.from).block));if(!i.every((e=>e)))return null;let r=n.map(((e,n)=>function(e,{open:t,close:n},i,r){let s,o,a=e.sliceDoc(i-50,i),l=e.sliceDoc(r,r+50),c=/\s*$/.exec(a)[0].length,h=/^\s*/.exec(l)[0].length,u=a.length-c;if(a.slice(u-t.length,u)==t&&l.slice(h,h+n.length)==n)return{open:{pos:i-c,margin:c&&1},close:{pos:r+h,margin:h&&1}};r-i<=100?s=o=e.sliceDoc(i,r):(s=e.sliceDoc(i,i+50),o=e.sliceDoc(r-50,r));let d=/^\s*/.exec(s)[0].length,f=/\s*$/.exec(o)[0].length,O=o.length-f-n.length;return s.slice(d,d+t.length)==t&&o.slice(O,O+n.length)==n?{open:{pos:i+d+t.length,margin:/\s/.test(s.charAt(d+t.length))?1:0},close:{pos:r-f-n.length,margin:/\s/.test(o.charAt(O-1))?1:0}}:null}(t,i[n],e.from,e.to)));if(2!=e&&!r.every((e=>e)))return{changes:t.changes(n.map(((e,t)=>r[t]?[]:[{from:e.from,insert:i[t].open+" "},{from:e.to,insert:" "+i[t].close}])))};if(1!=e&&r.some((e=>e))){let e=[];for(let t,n=0;nr&&(e==s||s>a.from)){r=a.from;let e=ap(t,n).line;if(!e)continue;let s=/^\s*/.exec(a.text)[0].length,l=s==a.length,c=a.text.slice(s,s+e.length)==e?s:-1;se.comment<0&&(!e.empty||e.single)))){let e=[];for(let{line:t,token:n,indent:r,empty:s,single:o}of i)!o&&s||e.push({from:t.from+r,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(1!=e&&i.some((e=>e.comment>=0))){let e=[];for(let{line:t,comment:n,token:r}of i)if(n>=0){let i=t.from+n,s=i+r.length;" "==t.text[s-t.from]&&s++,e.push({from:i,to:s})}return{changes:e}}return null}const hp=to.define(),up=to.define(),dp=Ts.define(),fp=Ts.define({combine:e=>bo(e,{minDepth:100,newGroupDelay:500},{minDepth:Math.max,newGroupDelay:Math.min})});const Op=qs.define({create:()=>Zp.empty,update(e,t){let n=t.state.facet(fp),i=t.annotation(hp);if(i){let r=t.docChanged?Qs.single(function(e){let t=0;return e.iterChangedRanges(((e,n)=>t=n)),t}(t.changes)):void 0,s=vp.fromTransaction(t,r),o=i.side,a=0==o?e.undone:e.done;return a=s?yp(a,a.length,n.minDepth,s):Qp(a,t.startState.selection),new Zp(0==o?i.rest:a,0==o?a:i.rest)}let r=t.annotation(up);if("full"!=r&&"before"!=r||(e=e.isolate()),!1===t.annotation(so.addToHistory))return t.changes.empty?e:e.addMapping(t.changes.desc);let s=vp.fromTransaction(t),o=t.annotation(so.time),a=t.annotation(so.userEvent);return s?e=e.addChanges(s,o,a,n.newGroupDelay,n.minDepth):t.selection&&(e=e.addSelection(t.startState.selection,o,a,n.newGroupDelay)),"full"!=r&&"after"!=r||(e=e.isolate()),e},toJSON:e=>({done:e.done.map((e=>e.toJSON())),undone:e.undone.map((e=>e.toJSON()))}),fromJSON:e=>new Zp(e.done.map(vp.fromJSON),e.undone.map(vp.fromJSON))});function pp(e={}){return[Op,fp.of(e),Xh.domEventHandlers({beforeinput(e,t){let n="historyUndo"==e.inputType?gp:"historyRedo"==e.inputType?bp:null;return!!n&&(e.preventDefault(),n(t))}})]}function mp(e,t){return function({state:n,dispatch:i}){if(!t&&n.readOnly)return!1;let r=n.field(Op,!1);if(!r)return!1;let s=r.pop(e,n,t);return!!s&&(i(s),!0)}}const gp=mp(0,!1),bp=mp(1,!1),wp=mp(0,!0),xp=mp(1,!0);class vp{constructor(e,t,n,i,r){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=i,this.selectionsAfter=r}setSelAfter(e){return new vp(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:null===(e=this.changes)||void 0===e?void 0:e.toJSON(),mapped:null===(t=this.mapped)||void 0===t?void 0:t.toJSON(),startSelection:null===(n=this.startSelection)||void 0===n?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((e=>e.toJSON()))}}static fromJSON(e){return new vp(e.changes&&gs.fromJSON(e.changes),[],e.mapped&&ms.fromJSON(e.mapped),e.startSelection&&Qs.fromJSON(e.startSelection),e.selectionsAfter.map(Qs.fromJSON))}static fromTransaction(e,t){let n=$p;for(let t of e.startState.facet(dp)){let i=t(e);i.length&&(n=n.concat(i))}return!n.length&&e.changes.empty?null:new vp(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,$p)}static selection(e){return new vp(void 0,$p,void 0,void 0,e)}}function yp(e,t,n,i){let r=t+1>n+20?t-n-1:0,s=e.slice(r,t);return s.push(i),s}function Sp(e,t){return e.length?t.length?e.concat(t):e:t}const $p=[];function Qp(e,t){if(e.length){let n=e[e.length-1],i=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-200));return i.length&&i[i.length-1].eq(t)?e:(i.push(t),yp(e,e.length-1,1e9,n.setSelAfter(i)))}return[vp.selection([t])]}function kp(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function Pp(e,t){if(!e.length)return e;let n=e.length,i=$p;for(;n;){let r=Tp(e[n-1],t,i);if(r.changes&&!r.changes.empty||r.effects.length){let t=e.slice(0,n);return t[n-1]=r,t}t=r.mapped,n--,i=r.selectionsAfter}return i.length?[vp.selection(i)]:$p}function Tp(e,t,n){let i=Sp(e.selectionsAfter.length?e.selectionsAfter.map((e=>e.map(t))):$p,n);if(!e.changes)return vp.selection(i);let r=e.changes.map(t),s=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(s):s;return new vp(r,ro.mapEffects(e.effects,t),o,e.startSelection.map(s),i)}const _p=/^(input\.type|delete)($|\.)/;class Zp{constructor(e,t,n=0,i){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=i}isolate(){return this.prevTime?new Zp(this.done,this.undone):this}addChanges(e,t,n,i,r){let s=this.done,o=s[s.length-1];return s=o&&o.changes&&!o.changes.empty&&e.changes&&(!n||_p.test(n))&&(!o.selectionsAfter.length&&t-this.prevTimen.push(e,t))),t.iterChangedRanges(((e,t,r,s)=>{for(let e=0;e=t&&r<=o&&(i=!0)}})),i}(o.changes,e.changes)||"input.type.compose"==n)?yp(s,s.length-1,r,new vp(e.changes.compose(o.changes),Sp(e.effects,o.effects),o.mapped,o.startSelection,$p)):yp(s,s.length,r,e),new Zp(s,$p,t,n)}addSelection(e,t,n,i){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:$p;return r.length>0&&t-this.prevTimee.empty!=o.ranges[t].empty)).length)?this:new Zp(Qp(this.done,e),this.undone,t,n);var s,o}addMapping(e){return new Zp(Pp(this.done,e),Pp(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let i=0==e?this.done:this.undone;if(0==i.length)return null;let r=i[i.length-1];if(n&&r.selectionsAfter.length)return t.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:hp.of({side:e,rest:kp(i)}),userEvent:0==e?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let n=1==i.length?$p:i.slice(0,i.length-1);return r.mapped&&(n=Pp(n,r.mapped)),t.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:hp.of({side:e,rest:n}),filter:!1,userEvent:0==e?"undo":"redo",scrollIntoView:!0})}return null}}Zp.empty=new Zp($p,$p);const Cp=[{key:"Mod-z",run:gp,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:bp,preventDefault:!0},{linux:"Ctrl-Shift-z",run:bp,preventDefault:!0},{key:"Mod-u",run:wp,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:xp,preventDefault:!0}];function Xp(e,t){return Qs.create(e.ranges.map(t),e.mainIndex)}function Yp(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:"select"})}function Rp({state:e,dispatch:t},n){let i=Xp(e.selection,n);return!i.eq(e.selection)&&(t(Yp(e,i)),!0)}function qp(e,t){return Qs.cursor(t?e.to:e.from)}function Ap(e,t){return Rp(e,(n=>n.empty?e.moveByChar(n,t):qp(n,t)))}function Wp(e){return e.textDirectionAt(e.state.selection.main.head)==Yl.LTR}const Ep=e=>Ap(e,!Wp(e)),jp=e=>Ap(e,Wp(e));function zp(e,t){return Rp(e,(n=>n.empty?e.moveByGroup(n,t):qp(n,t)))}function Dp(e,t,n){if(t.type.prop(n))return!0;let i=t.to-t.from;return i&&(i>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function Up(e,t,n){let i,r,s=Xf(e).resolveInner(t.head),o=n?yd.closedBy:yd.openedBy;for(let i=t.head;;){let t=n?s.childAfter(i):s.childBefore(i);if(!t)break;Dp(e,t,o)?s=t:i=n?t.to:t.from}return r=s.type.prop(o)&&(i=n?LO(e,s.from,1):LO(e,s.to,-1))&&i.matched?n?i.end.to:i.end.from:n?s.to:s.from,Qs.cursor(r,n?-1:1)}function Vp(e,t){return Rp(e,(n=>{if(!n.empty)return qp(n,t);let i=e.moveVertically(n,t);return i.head!=n.head?i:e.moveToLineBoundary(n,t)}))}const Ip=e=>Vp(e,!1),Mp=e=>Vp(e,!0);function Gp(e){return Math.max(e.defaultLineHeight,Math.min(e.dom.clientHeight,innerHeight)-5)}function Bp(e,t){let{state:n}=e,i=Xp(n.selection,(n=>n.empty?e.moveVertically(n,t,Gp(e)):qp(n,t)));if(i.eq(n.selection))return!1;let r,s=e.coordsAtPos(n.selection.main.head),o=e.scrollDOM.getBoundingClientRect();return s&&s.top>o.top&&s.bottomBp(e,!1),Lp=e=>Bp(e,!0);function Fp(e,t,n){let i=e.lineBlockAt(t.head),r=e.moveToLineBoundary(t,n);if(r.head==t.head&&r.head!=(n?i.to:i.from)&&(r=e.moveToLineBoundary(t,n,!1)),!n&&r.head==i.from&&i.length){let n=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;n&&t.head!=i.from+n&&(r=Qs.cursor(i.from+n))}return r}function Hp(e,t){let n=Xp(e.state.selection,(e=>{let n=t(e);return Qs.range(e.anchor,n.head,n.goalColumn)}));return!n.eq(e.state.selection)&&(e.dispatch(Yp(e.state,n)),!0)}function Kp(e,t){return Hp(e,(n=>e.moveByChar(n,t)))}const Jp=e=>Kp(e,!Wp(e)),em=e=>Kp(e,Wp(e));function tm(e,t){return Hp(e,(n=>e.moveByGroup(n,t)))}function nm(e,t){return Hp(e,(n=>e.moveVertically(n,t)))}const im=e=>nm(e,!1),rm=e=>nm(e,!0);function sm(e,t){return Hp(e,(n=>e.moveVertically(n,t,Gp(e))))}const om=e=>sm(e,!1),am=e=>sm(e,!0),lm=({state:e,dispatch:t})=>(t(Yp(e,{anchor:0})),!0),cm=({state:e,dispatch:t})=>(t(Yp(e,{anchor:e.doc.length})),!0),hm=({state:e,dispatch:t})=>(t(Yp(e,{anchor:e.selection.main.anchor,head:0})),!0),um=({state:e,dispatch:t})=>(t(Yp(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0);function dm(e,t){if(e.state.readOnly)return!1;let n="delete.selection",{state:i}=e,r=i.changeByRange((i=>{let{from:r,to:s}=i;if(r==s){let i=t(r);ir&&(n="delete.forward",i=fm(e,i,!0)),r=Math.min(r,i),s=Math.max(s,i)}else r=fm(e,r,!1),s=fm(e,s,!0);return r==s?{range:i}:{changes:{from:r,to:s},range:Qs.cursor(r)}}));return!r.changes.empty&&(e.dispatch(i.update(r,{scrollIntoView:!0,userEvent:n,effects:"delete.selection"==n?Xh.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function fm(e,t,n){if(e instanceof Xh)for(let i of e.state.facet(Xh.atomicRanges).map((t=>t(e))))i.between(t,t,((e,i)=>{et&&(t=n?i:e)}));return t}const Om=(e,t)=>dm(e,(n=>{let i,r,{state:s}=e,o=s.doc.lineAt(n);if(!t&&n>o.from&&nOm(e,!1),mm=e=>Om(e,!0),gm=(e,t)=>dm(e,(n=>{let i=n,{state:r}=e,s=r.doc.lineAt(i),o=r.charCategorizer(i);for(let e=null;;){if(i==(t?s.to:s.from)){i==n&&s.number!=(t?r.doc.lines:1)&&(i+=t?1:-1);break}let a=os(s.text,i-s.from,t)+s.from,l=s.text.slice(Math.min(i,a)-s.from,Math.max(i,a)-s.from),c=o(l);if(null!=e&&c!=e)break;" "==l&&i==n||(e=c),i=a}return i})),bm=e=>gm(e,!1),wm=e=>dm(e,(t=>{let n=e.lineBlockAt(t).to;return t=r.number){let e=t[t.length-1];e.to=s.to,e.ranges.push(i)}else t.push({from:r.from,to:s.to,ranges:[i]});n=s.number+1}return t}function vm(e,t,n){if(e.readOnly)return!1;let i=[],r=[];for(let t of xm(e)){if(n?t.to==e.doc.length:0==t.from)continue;let s=e.doc.lineAt(n?t.to+1:t.from-1),o=s.length+1;if(n){i.push({from:t.to,to:s.to},{from:t.from,insert:s.text+e.lineBreak});for(let n of t.ranges)r.push(Qs.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{i.push({from:s.from,to:t.from},{from:t.to,insert:e.lineBreak+s.text});for(let e of t.ranges)r.push(Qs.range(e.anchor-o,e.head-o))}}return!!i.length&&(t(e.update({changes:i,scrollIntoView:!0,selection:Qs.create(r,e.selection.mainIndex),userEvent:"move.line"})),!0)}function ym(e,t,n){if(e.readOnly)return!1;let i=[];for(let t of xm(e))n?i.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):i.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});return t(e.update({changes:i,scrollIntoView:!0,userEvent:"input.copyline"})),!0}const Sm=Qm(!1),$m=Qm(!0);function Qm(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let i=t.changeByRange((n=>{let{from:i,to:r}=n,s=t.doc.lineAt(i),o=!e&&i==r&&function(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n,i=Xf(e).resolveInner(t),r=i.childBefore(t),s=i.childAfter(t);return r&&s&&r.to<=t&&s.from>=t&&(n=r.type.prop(yd.closedBy))&&n.indexOf(s.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(s.from).from?{from:r.to,to:s.from}:null}(t,i);e&&(i=r=(r<=s.to?s:t.doc.lineAt(r)).to);let a=new Nf(t,{simulateBreak:i,simulateDoubleBreak:!!o}),l=Bf(a,i);for(null==l&&(l=/^\s*/.exec(t.doc.lineAt(i).text)[0].length);rs.from&&i{let r=[];for(let s=i.from;s<=i.to;){let o=e.doc.lineAt(s);o.number>n&&(i.empty||i.to>o.from)&&(t(o,r,i),n=o.number),s=o.to+1}let s=e.changes(r);return{changes:r,range:Qs.range(s.mapPos(i.anchor,1),s.mapPos(i.head,1))}}))}const Pm=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(km(e,((t,n)=>{n.push({from:t.from,insert:e.facet(If)})})),{userEvent:"input.indent"})),!0),Tm=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(km(e,((t,n)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let r=qo(i,e.tabSize),s=0,o=Gf(e,Math.max(0,r-Mf(e)));for(;sRp(e,(t=>Qs.cursor(e.lineBlockAt(t.head).from,1))),shift:e=>Hp(e,(t=>Qs.cursor(e.lineBlockAt(t.head).from)))},{key:"Ctrl-e",run:e=>Rp(e,(t=>Qs.cursor(e.lineBlockAt(t.head).to,-1))),shift:e=>Hp(e,(t=>Qs.cursor(e.lineBlockAt(t.head).to)))},{key:"Ctrl-d",run:mm},{key:"Ctrl-h",run:pm},{key:"Ctrl-k",run:wm},{key:"Ctrl-Alt-h",run:bm},{key:"Ctrl-o",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:Nr.of(["",""])},range:Qs.cursor(e.from)})));return t(e.update(n,{scrollIntoView:!0,userEvent:"input"})),!0}},{key:"Ctrl-t",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange((t=>{if(!t.empty||0==t.from||t.from==e.doc.length)return{range:t};let n=t.from,i=e.doc.lineAt(n),r=n==i.from?n-1:os(i.text,n-i.from,!1)+i.from,s=n==i.to?n+1:os(i.text,n-i.from,!0)+i.from;return{changes:{from:r,to:s,insert:e.doc.slice(n,s).append(e.doc.slice(r,n))},range:Qs.cursor(s)}}));return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)}},{key:"Ctrl-v",run:Lp}],Zm=[{key:"ArrowLeft",run:Ep,shift:Jp,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e=>zp(e,!Wp(e)),shift:e=>tm(e,!Wp(e)),preventDefault:!0},{mac:"Cmd-ArrowLeft",run:e=>Rp(e,(t=>Fp(e,t,!Wp(e)))),shift:e=>Hp(e,(t=>Fp(e,t,!Wp(e)))),preventDefault:!0},{key:"ArrowRight",run:jp,shift:em,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:e=>zp(e,Wp(e)),shift:e=>tm(e,Wp(e)),preventDefault:!0},{mac:"Cmd-ArrowRight",run:e=>Rp(e,(t=>Fp(e,t,Wp(e)))),shift:e=>Hp(e,(t=>Fp(e,t,Wp(e)))),preventDefault:!0},{key:"ArrowUp",run:Ip,shift:im,preventDefault:!0},{mac:"Cmd-ArrowUp",run:lm,shift:hm},{mac:"Ctrl-ArrowUp",run:Np,shift:om},{key:"ArrowDown",run:Mp,shift:rm,preventDefault:!0},{mac:"Cmd-ArrowDown",run:cm,shift:um},{mac:"Ctrl-ArrowDown",run:Lp,shift:am},{key:"PageUp",run:Np,shift:om},{key:"PageDown",run:Lp,shift:am},{key:"Home",run:e=>Rp(e,(t=>Fp(e,t,!1))),shift:e=>Hp(e,(t=>Fp(e,t,!1))),preventDefault:!0},{key:"Mod-Home",run:lm,shift:hm},{key:"End",run:e=>Rp(e,(t=>Fp(e,t,!0))),shift:e=>Hp(e,(t=>Fp(e,t,!0))),preventDefault:!0},{key:"Mod-End",run:cm,shift:um},{key:"Enter",run:Sm},{key:"Mod-a",run:({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"})),!0)},{key:"Backspace",run:pm,shift:pm},{key:"Delete",run:mm},{key:"Mod-Backspace",mac:"Alt-Backspace",run:bm},{key:"Mod-Delete",mac:"Alt-Delete",run:e=>gm(e,!0)},{mac:"Mod-Backspace",run:e=>dm(e,(t=>{let n=e.lineBlockAt(t).from;return t>n?n:Math.max(0,t-1)}))},{mac:"Mod-Delete",run:wm}].concat(_m.map((e=>({mac:e.key,run:e.run,shift:e.shift})))),Cm=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:e=>Rp(e,(t=>Up(e.state,t,!Wp(e)))),shift:e=>Hp(e,(t=>Up(e.state,t,!Wp(e))))},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:e=>Rp(e,(t=>Up(e.state,t,Wp(e)))),shift:e=>Hp(e,(t=>Up(e.state,t,Wp(e))))},{key:"Alt-ArrowUp",run:({state:e,dispatch:t})=>vm(e,t,!1)},{key:"Shift-Alt-ArrowUp",run:({state:e,dispatch:t})=>ym(e,t,!1)},{key:"Alt-ArrowDown",run:({state:e,dispatch:t})=>vm(e,t,!0)},{key:"Shift-Alt-ArrowDown",run:({state:e,dispatch:t})=>ym(e,t,!0)},{key:"Escape",run:({state:e,dispatch:t})=>{let n=e.selection,i=null;return n.ranges.length>1?i=Qs.create([n.main]):n.main.empty||(i=Qs.create([Qs.cursor(n.main.head)])),!!i&&(t(Yp(e,i)),!0)}},{key:"Mod-Enter",run:$m},{key:"Alt-l",mac:"Ctrl-l",run:({state:e,dispatch:t})=>{let n=xm(e).map((({from:t,to:n})=>Qs.range(t,Math.min(n+1,e.doc.length))));return t(e.update({selection:Qs.create(n),userEvent:"select"})),!0}},{key:"Mod-i",run:({state:e,dispatch:t})=>{let n=Xp(e.selection,(t=>{var n;let i=Xf(e).resolveInner(t.head,1);for(;!(i.from=t.to||i.to>t.to&&i.from<=t.from)&&(null===(n=i.parent)||void 0===n?void 0:n.parent);)i=i.parent;return Qs.range(i.to,i.from)}));return t(Yp(e,n)),!0},preventDefault:!0},{key:"Mod-[",run:Tm},{key:"Mod-]",run:Pm},{key:"Mod-Alt-\\",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),i=new Nf(e,{overrideIndentation:e=>{let t=n[e];return null==t?-1:t}}),r=km(e,((t,r,s)=>{let o=Bf(i,t.from);if(null==o)return;/\S/.test(t.text)||(o=0);let a=/^\s*/.exec(t.text)[0],l=Gf(e,o);(a!=l||s.from{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(xm(t).map((({from:e,to:n})=>(e>0?e--:ne.moveVertically(t,!0))).map(n);return e.dispatch({changes:n,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0}},{key:"Shift-Mod-\\",run:({state:e,dispatch:t})=>function(e,t,n){let i=!1,r=Xp(e.selection,(t=>{let r=LO(e,t.head,-1)||LO(e,t.head,1)||t.head>0&&LO(e,t.head-1,1)||t.head{let t=ap(e.state);return t.line?rp(e):!!t.block&&op(e)}},{key:"Alt-A",run:sp}].concat(Zm),Xm={key:"Tab",run:Pm,shift:Tm};function Ym(){var e=arguments[0];"string"==typeof e&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&"object"==typeof n&&null==n.nodeType&&!Array.isArray(n)){for(var i in n)if(Object.prototype.hasOwnProperty.call(n,i)){var r=n[i];"string"==typeof r?e.setAttribute(i,r):null!=r&&(e[i]=r)}t++}for(;te.normalize("NFKD"):e=>e;class Am{constructor(e,t,n=0,i=e.length,r,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(n,i),this.bufferStart=n,this.normalize=r?e=>r(qm(e)):qm,this.query=this.normalize(t)}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 us(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 t=ds(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=fs(e);let i=this.normalize(t);for(let e=0,r=n;;e++){let s=i.charCodeAt(e),o=this.match(s,r);if(o)return this.value=o,this;if(e==i.length-1)break;r==n&&ethis.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 t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,i=n+t[0].length;if(this.matchPos=Vm(this.text,i+(n==i?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,i,t)))return this.value={from:n,to:i,match:t},this;e=this.matchPos-this.curLineStart}else{if(!(this.curLineStart+this.curLine.length=n||i.to<=t){let i=new Dm(t,e.sliceString(t,n));return zm.set(e,i),i}if(i.from==t&&i.to==n)return i;let{text:r,from:s}=i;return s>t&&(r=e.sliceString(t,s)+r,s=t),i.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=Vm(this.text,n+(e==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Dm.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+2*this.flat.text.length))}}}function Vm(e,t){if(t>=e.length)return t;let n,i=e.lineAt(t);for(;t=56320&&n<57344;)t++;return t}function Im(e){let t=Ym("input",{class:"cm-textfield",name:"line"});function n(){let n=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(t.value);if(!n)return;let{state:i}=e,r=i.doc.lineAt(i.selection.main.head),[,s,o,a,l]=n,c=a?+a.slice(1):0,h=o?+o:r.number;if(o&&l){let e=h/100;s&&(e=e*("-"==s?-1:1)+r.number/i.doc.lines),h=Math.round(i.doc.lines*e)}else o&&s&&(h=h*("-"==s?-1:1)+r.number);let u=i.doc.line(Math.max(1,Math.min(i.doc.lines,h)));e.dispatch({effects:Mm.of(!1),selection:Qs.cursor(u.from+Math.max(0,Math.min(c,u.length))),scrollIntoView:!0}),e.focus()}return{dom:Ym("form",{class:"cm-gotoLine",onkeydown:t=>{27==t.keyCode?(t.preventDefault(),e.dispatch({effects:Mm.of(!1)}),e.focus()):13==t.keyCode&&(t.preventDefault(),n())},onsubmit:e=>{e.preventDefault(),n()}},Ym("label",e.state.phrase("Go to line"),": ",t)," ",Ym("button",{class:"cm-button",type:"submit"},e.state.phrase("go")))}}"undefined"!=typeof Symbol&&(jm.prototype[Symbol.iterator]=Um.prototype[Symbol.iterator]=function(){return this});const Mm=ro.define(),Gm=qs.define({create:()=>!0,update(e,t){for(let n of t.effects)n.is(Mm)&&(e=n.value);return e},provide:e=>Fu.from(e,(e=>e?Im:null))}),Bm=Xh.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px","& label":{fontSize:"80%"}}}),Nm={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Lm=Ts.define({combine:e=>bo(e,Nm,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})});function Fm(e){let t=[tg,eg];return e&&t.push(Lm.of(e)),t}const Hm=Fa.mark({class:"cm-selectionMatch"}),Km=Fa.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Jm(e,t,n,i){return!(0!=n&&e(t.sliceDoc(n-1,n))==fo.Word||i!=t.doc.length&&e(t.sliceDoc(i,i+1))==fo.Word)}const eg=xl.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Lm),{state:n}=e,i=n.selection;if(i.ranges.length>1)return Fa.none;let r,s=i.main,o=null;if(s.empty){if(!t.highlightWordAroundCursor)return Fa.none;let e=n.wordAt(s.head);if(!e)return Fa.none;o=n.charCategorizer(s.head),r=n.sliceDoc(e.from,e.to)}else{let e=s.to-s.from;if(e200)return Fa.none;if(t.wholeWords){if(r=n.sliceDoc(s.from,s.to),o=n.charCategorizer(s.head),!Jm(o,n,s.from,s.to)||!function(e,t,n,i){return e(t.sliceDoc(n,n+1))==fo.Word&&e(t.sliceDoc(i-1,i))==fo.Word}(o,n,s.from,s.to))return Fa.none}else if(r=n.sliceDoc(s.from,s.to).trim(),!r)return Fa.none}let a=[];for(let i of e.visibleRanges){let e=new Am(n.doc,r,i.from,i.to);for(;!e.next().done;){let{from:i,to:r}=e.value;if((!o||Jm(o,n,i,r))&&(s.empty&&i<=s.from&&r>=s.to?a.push(Km.range(i,r)):(i>=s.to||r<=s.from)&&a.push(Hm.range(i,r)),a.length>t.maxMatches))return Fa.none}}return Fa.set(a)}},{decorations:e=>e.decorations}),tg=Xh.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}});const ng=Ts.define({combine:e=>bo(e,{top:!1,caseSensitive:!1,literal:!1,wholeWord:!1,createPanel:e=>new _g(e)})});class ig{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||function(e){try{return new RegExp(e,Em),!0}catch(e){return!1}}(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,((e,t)=>"n"==t?"\n":"r"==t?"\r":"t"==t?"\t":"\\"))}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new hg(this):new og(this)}getCursor(e,t=0,n){let i=e.doc?e:go.create({doc:e});return null==n&&(n=i.doc.length),this.regexp?ag(this,i,t,n):sg(this,i,t,n)}}class rg{constructor(e){this.spec=e}}function sg(e,t,n,i){return new Am(t.doc,e.unquoted,n,i,e.caseSensitive?void 0:e=>e.toLowerCase(),e.wholeWord?function(e,t){return(n,i,r,s)=>((s>n||s+r.length=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let r=sg(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)i(r.value.from,r.value.to)}}function ag(e,t,n,i){return new jm(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?(r=t.charCategorizer(t.selection.main.head),(e,t,n)=>!n[0].length||(r(lg(n.input,n.index))!=fo.Word||r(cg(n.input,n.index))!=fo.Word)&&(r(cg(n.input,n.index+n[0].length))!=fo.Word||r(lg(n.input,n.index+n[0].length))!=fo.Word)):void 0},n,i);var r}function lg(e,t){return e.slice(os(e,t,!1),t)}function cg(e,t){return e.slice(t,os(e,t))}class hg extends rg{nextMatch(e,t,n){let i=ag(this.spec,e,n,e.doc.length).next();return i.done&&(i=ag(this.spec,e,0,t).next()),i.done?null:i.value}prevMatchInRange(e,t,n){for(let i=1;;i++){let r=Math.max(t,n-1e4*i),s=ag(this.spec,e,r,n),o=null;for(;!s.next().done;)o=s.value;if(o&&(r==t||o.from>r+10))return o;if(r==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace.replace(/\$([$&\d+])/g,((t,n)=>"$"==n?"$":"&"==n?e.match[0]:"0"!=n&&+n=t)return null;i.push(n.value)}return i}highlight(e,t,n,i){let r=ag(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!r.next().done;)i(r.value.from,r.value.to)}}const ug=ro.define(),dg=ro.define(),fg=qs.define({create:e=>new Og(Qg(e).create(),null),update(e,t){for(let n of t.effects)n.is(ug)?e=new Og(n.value.create(),e.panel):n.is(dg)&&(e=new Og(e.query,n.value?$g:null));return e},provide:e=>Fu.from(e,(e=>e.panel))});class Og{constructor(e,t){this.query=e,this.panel=t}}const pg=Fa.mark({class:"cm-searchMatch"}),mg=Fa.mark({class:"cm-searchMatch cm-searchMatch-selected"}),gg=xl.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(fg))}update(e){let t=e.state.field(fg);(t!=e.startState.field(fg)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return Fa.none;let{view:n}=this,i=new $o;for(let t=0,r=n.visibleRanges,s=r.length;tr[t+1].from-500;)a=r[++t].to;e.highlight(n.state,o,a,((e,t)=>{let r=n.state.selection.ranges.some((n=>n.from==e&&n.to==t));i.add(e,t,r?mg:pg)}))}return i.finish()}},{decorations:e=>e.decorations});function bg(e){return t=>{let n=t.state.field(fg,!1);return n&&n.query.spec.valid?e(t,n):kg(t)}}const wg=bg(((e,{query:t})=>{let{to:n}=e.state.selection.main,i=t.nextMatch(e.state,n,n);return!!i&&(e.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:Xg(e,i),userEvent:"select.search"}),!0)})),xg=bg(((e,{query:t})=>{let{state:n}=e,{from:i}=n.selection.main,r=t.prevMatch(n,i,i);return!!r&&(e.dispatch({selection:{anchor:r.from,head:r.to},scrollIntoView:!0,effects:Xg(e,r),userEvent:"select.search"}),!0)})),vg=bg(((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!(!n||!n.length)&&(e.dispatch({selection:Qs.create(n.map((e=>Qs.range(e.from,e.to)))),userEvent:"select.search.matches"}),!0)})),yg=bg(((e,{query:t})=>{let{state:n}=e,{from:i,to:r}=n.selection.main;if(n.readOnly)return!1;let s=t.nextMatch(n,i,i);if(!s)return!1;let o,a,l=[],c=[];if(s.from==i&&s.to==r&&(a=n.toText(t.getReplacement(s)),l.push({from:s.from,to:s.to,insert:a}),s=t.nextMatch(n,s.from,s.to),c.push(Xh.announce.of(n.phrase("replaced match on line $",n.doc.lineAt(i).number)+"."))),s){let t=0==l.length||l[0].from>=s.to?0:s.to-s.from-a.length;o={anchor:s.from-t,head:s.to-t},c.push(Xg(e,s))}return e.dispatch({changes:l,selection:o,scrollIntoView:!!o,effects:c,userEvent:"input.replace"}),!0})),Sg=bg(((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map((e=>{let{from:n,to:i}=e;return{from:n,to:i,insert:t.getReplacement(e)}}));if(!n.length)return!1;let i=e.state.phrase("replaced $ matches",n.length)+".";return e.dispatch({changes:n,effects:Xh.announce.of(i),userEvent:"input.replace.all"}),!0}));function $g(e){return e.state.facet(ng).createPanel(e)}function Qg(e,t){var n,i,r,s;let o=e.selection.main,a=o.empty||o.to>o.from+100?"":e.sliceDoc(o.from,o.to);if(t&&!a)return t;let l=e.facet(ng);return new ig({search:(null!==(n=null==t?void 0:t.literal)&&void 0!==n?n:l.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:null!==(i=null==t?void 0:t.caseSensitive)&&void 0!==i?i:l.caseSensitive,literal:null!==(r=null==t?void 0:t.literal)&&void 0!==r?r:l.literal,wholeWord:null!==(s=null==t?void 0:t.wholeWord)&&void 0!==s?s:l.wholeWord})}const kg=e=>{let t=e.state.field(fg,!1);if(t&&t.panel){let n=Gu(e,$g);if(!n)return!1;let i=n.dom.querySelector("[main-field]");if(i&&i!=e.root.activeElement){let n=Qg(e.state,t.query.spec);n.valid&&e.dispatch({effects:ug.of(n)}),i.focus(),i.select()}}else e.dispatch({effects:[dg.of(!0),t?ug.of(Qg(e.state,t.query.spec)):ro.appendConfig.of(Rg)]});return!0},Pg=e=>{let t=e.state.field(fg,!1);if(!t||!t.panel)return!1;let n=Gu(e,$g);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:dg.of(!1)}),!0},Tg=[{key:"Mod-f",run:kg,scope:"editor search-panel"},{key:"F3",run:wg,shift:xg,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:wg,shift:xg,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Pg,scope:"editor search-panel"},{key:"Mod-Shift-l",run:({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:i,to:r}=n.main,s=[],o=0;for(let t=new Am(e.doc,e.sliceDoc(i,r));!t.next().done;){if(s.length>1e3)return!1;t.value.from==i&&(o=s.length),s.push(Qs.range(t.value.from,t.value.to))}return t(e.update({selection:Qs.create(s,o),userEvent:"select.search.matches"})),!0}},{key:"Alt-g",run:e=>{let t=Gu(e,Im);if(!t){let n=[Mm.of(!0)];null==e.state.field(Gm,!1)&&n.push(ro.appendConfig.of([Gm,Bm])),e.dispatch({effects:n}),t=Gu(e,Im)}return t&&t.dom.querySelector("input").focus(),!0}},{key:"Mod-d",run:({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some((e=>e.from===e.to)))return(({state:e,dispatch:t})=>{let{selection:n}=e,i=Qs.create(n.ranges.map((t=>e.wordAt(t.head)||Qs.cursor(t.head))),n.mainIndex);return!i.eq(n)&&(t(e.update({selection:i})),!0)})({state:e,dispatch:t});let i=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some((t=>e.sliceDoc(t.from,t.to)!=i)))return!1;let r=function(e,t){let{main:n,ranges:i}=e.selection,r=e.wordAt(n.head),s=r&&r.from==n.from&&r.to==n.to;for(let n=!1,r=new Am(e.doc,t,i[i.length-1].to);;){if(r.next(),!r.done){if(n&&i.some((e=>e.from==r.value.from)))continue;if(s){let t=e.wordAt(r.value.from);if(!t||t.from!=r.value.from||t.to!=r.value.to)continue}return r.value}if(n)return null;r=new Am(e.doc,t,0,Math.max(0,i[i.length-1].from-1)),n=!0}}(e,i);return!!r&&(t(e.update({selection:e.selection.addRange(Qs.range(r.from,r.to),!1),effects:Xh.scrollIntoView(r.to)})),!0)},preventDefault:!0}];class _g{constructor(e){this.view=e;let t=this.query=e.state.field(fg).query.spec;function n(e,t,n){return Ym("button",{class:"cm-button",name:e,onclick:t,type:"button"},n)}this.commit=this.commit.bind(this),this.searchField=Ym("input",{value:t.search,placeholder:Zg(e,"Find"),"aria-label":Zg(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ym("input",{value:t.replace,placeholder:Zg(e,"Replace"),"aria-label":Zg(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Ym("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Ym("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Ym("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit}),this.dom=Ym("div",{onkeydown:e=>this.keydown(e),class:"cm-search"},[this.searchField,n("next",(()=>wg(e)),[Zg(e,"next")]),n("prev",(()=>xg(e)),[Zg(e,"previous")]),n("select",(()=>vg(e)),[Zg(e,"all")]),Ym("label",null,[this.caseField,Zg(e,"match case")]),Ym("label",null,[this.reField,Zg(e,"regexp")]),Ym("label",null,[this.wordField,Zg(e,"by word")]),...e.state.readOnly?[]:[Ym("br"),this.replaceField,n("replace",(()=>yg(e)),[Zg(e,"replace")]),n("replaceAll",(()=>Sg(e)),[Zg(e,"replace all")])],Ym("button",{name:"close",onclick:()=>Pg(e),"aria-label":Zg(e,"close"),type:"button"},["×"])])}commit(){let e=new ig({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:ug.of(e)}))}keydown(e){var t,n,i;t=this.view,n=e,i="search-panel",Ih(Uh(t.state),n,t,i)?e.preventDefault():13==e.keyCode&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?xg:wg)(this.view)):13==e.keyCode&&e.target==this.replaceField&&(e.preventDefault(),yg(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(ug)&&!e.value.eq(this.query)&&this.setQuery(e.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(ng).top}}function Zg(e,t){return e.state.phrase(t)}const Cg=/[\s\.,:;?!]/;function Xg(e,{from:t,to:n}){let i=e.state.doc.lineAt(t),r=e.state.doc.lineAt(n).to,s=Math.max(i.from,t-30),o=Math.min(r,n+30),a=e.state.sliceDoc(s,o);if(s!=i.from)for(let e=0;e<30;e++)if(!Cg.test(a[e+1])&&Cg.test(a[e])){a=a.slice(e);break}if(o!=r)for(let e=a.length-1;e>a.length-30;e--)if(!Cg.test(a[e-1])&&Cg.test(a[e])){a=a.slice(0,e);break}return Xh.announce.of(`${e.state.phrase("current match")}. ${a} ${e.state.phrase("on line")} ${i.number}.`)}const Yg=Xh.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"}}),Rg=[fg,Ds.lowest(gg),Yg];class qg{constructor(e,t,n){this.state=e,this.pos=t,this.explicit=n,this.abortListeners=[]}tokenBefore(e){let t=Xf(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),i=t.text.slice(n-t.from,this.pos-t.from),r=i.search(Dg(e,!1));return r<0?null:{from:n+r,to:this.pos,text:i.slice(r)}}get aborted(){return null==this.abortListeners}addEventListener(e,t){"abort"==e&&this.abortListeners&&this.abortListeners.push(t)}}function Ag(e){let t=Object.keys(e).join(""),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,"")),`[${n?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function Wg(e){let t=e.map((e=>"string"==typeof e?{label:e}:e)),[n,i]=t.every((e=>/^\w+$/.test(e.label)))?[/\w*$/,/\w+$/]:function(e){let t=Object.create(null),n=Object.create(null);for(let{label:i}of e){t[i[0]]=!0;for(let e=1;e{let r=e.matchBefore(i);return r||e.explicit?{from:r?r.from:e.pos,options:t,validFor:n}:null}}function Eg(e,t){return n=>{for(let t=Xf(n.state).resolveInner(n.pos,-1);t;t=t.parent)if(e.indexOf(t.name)>-1)return null;return t(n)}}class jg{constructor(e,t,n){this.completion=e,this.source=t,this.match=n}}function zg(e){return e.selection.main.head}function Dg(e,t){var n;let{source:i}=e,r=t&&"^"!=i[0],s="$"!=i[i.length-1];return r||s?new RegExp(`${r?"^":""}(?:${i})${s?"$":""}`,null!==(n=e.flags)&&void 0!==n?n:e.ignoreCase?"i":""):e}const Ug=to.define();function Vg(e,t){const n=t.completion.apply||t.completion.label;let i=t.source;"string"==typeof n?e.dispatch(Object.assign(Object.assign({},function(e,t,n,i){return Object.assign(Object.assign({},e.changeByRange((r=>{if(r==e.selection.main)return{changes:{from:n,to:i,insert:t},range:Qs.cursor(n+t.length)};let s=i-n;return!r.empty||s&&e.sliceDoc(r.from-s,r.from)!=e.sliceDoc(n,i)?{range:r}:{changes:{from:r.from-s,to:r.from,insert:t},range:Qs.cursor(r.from-s+t.length)}}))),{userEvent:"input.complete"})}(e.state,n,i.from,i.to)),{annotations:Ug.of(t.completion)})):n(e,t.completion,i.from,i.to)}const Ig=new WeakMap;function Mg(e){if(!Array.isArray(e))return e;let t=Ig.get(e);return t||Ig.set(e,t=Wg(e)),t}class Gg{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[];for(let t=0;t=48&&l<=57||l>=97&&l<=122?2:l>=65&&l<=90?1:0:(b=ds(l))!=b.toLowerCase()?1:b!=b.toUpperCase()?2:0;(!i||1==w&&p||0==g&&0!=w)&&(t[h]==l||n[h]==l&&(u=!0)?s[h++]=i:s.length&&(m=!1)),g=w,i+=fs(l)}return h==a&&0==s[0]&&m?this.result((u?-200:0)-100,s,e):d==a&&0==f?[-200-e.length,0,O]:o>-1?[-700-e.length,o,o+this.pattern.length]:d==a?[-900-e.length,f,O]:h==a?this.result((u?-200:0)-100-700+(m?0:-1100),s,e):2==t.length?null:this.result((i[0]?-700:0)-200-1100,i,e)}result(e,t,n){let i=[e-n.length],r=1;for(let e of t){let t=e+(this.astral?fs(us(n,e)):1);r>1&&i[r-1]==e?i[r-1]=t:(i[r++]=e,i[r++]=t)}return i}}const Bg=Ts.define({combine:e=>bo(e,{activateOnTyping:!0,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,optionClass:(e,t)=>n=>function(e,t){return e?t?e+" "+t:e:t}(e(n),t(n)),addToOptions:(e,t)=>e.concat(t)})});function Ng(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let i=Math.floor((e-t)/n);return{from:e-(i+1)*n,to:e-i*n}}class Lg{constructor(e,t){this.view=e,this.stateField=t,this.info=null,this.placeInfo={read:()=>this.measureInfo(),write:e=>this.positionInfo(e),key:this},this.space=null;let n=e.state.field(t),{options:i,selected:r}=n.open,s=e.state.facet(Bg);this.optionContent=function(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement("div");return t.classList.add("cm-completionIcon"),e.type&&t.classList.add(...e.type.split(/\s+/g).map((e=>"cm-completionIcon-"+e))),t.setAttribute("aria-hidden","true"),t},position:20}),t.push({render(e,t,n){let i=document.createElement("span");i.className="cm-completionLabel";let{label:r}=e,s=0;for(let e=1;es&&i.appendChild(document.createTextNode(r.slice(s,t)));let a=i.appendChild(document.createElement("span"));a.appendChild(document.createTextNode(r.slice(t,o))),a.className="cm-completionMatchedText",s=o}return se.position-t.position)).map((e=>e.render))}(s),this.optionClass=s.optionClass,this.range=Ng(i.length,r,s.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.dom.addEventListener("mousedown",(t=>{for(let n,r=t.target;r&&r!=this.dom;r=r.parentNode)if("LI"==r.nodeName&&(n=/-(\d+)$/.exec(r.id))&&+n[1]{this.info&&this.view.requestMeasure(this.placeInfo)}))}mount(){this.updateSel()}update(e){var t,n,i;let r=e.state.field(this.stateField),s=e.startState.field(this.stateField);r!=s&&(this.updateSel(),(null===(t=r.open)||void 0===t?void 0:t.disabled)!=(null===(n=s.open)||void 0===n?void 0:n.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!(null===(i=r.open)||void 0===i?void 0:i.disabled)))}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfo)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if((t.selected>-1&&t.selected=this.range.to)&&(this.range=Ng(t.options.length,t.selected,this.view.state.facet(Bg).maxRenderedOptions),this.list.remove(),this.list=this.dom.appendChild(this.createListBox(t.options,e.id,this.range)),this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfo)}))),this.updateSelectedOption(t.selected)){this.info&&(this.info.remove(),this.info=null);let{completion:n}=t.options[t.selected],{info:i}=n;if(!i)return;let r="string"==typeof i?document.createTextNode(i):i(n);if(!r)return;"then"in r?r.then((t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t)})).catch((e=>ml(this.view.state,e,"completion info"))):this.addInfoPane(r)}}addInfoPane(e){let t=this.info=document.createElement("div");t.className="cm-tooltip cm-completionInfo",t.appendChild(e),this.dom.appendChild(t),this.view.requestMeasure(this.placeInfo)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,i=this.range.from;n;n=n.nextSibling,i++)i==e?n.hasAttribute("aria-selected")||(n.setAttribute("aria-selected","true"),t=n):n.hasAttribute("aria-selected")&&n.removeAttribute("aria-selected");return t&&function(e,t){let n=e.getBoundingClientRect(),i=t.getBoundingClientRect();i.topn.bottom&&(e.scrollTop+=i.bottom-n.bottom)}(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),i=e.getBoundingClientRect(),r=this.space;if(!r){let e=this.dom.ownerDocument.defaultView||window;r={left:0,top:0,right:e.innerWidth,bottom:e.innerHeight}}if(i.top>Math.min(r.bottom,t.bottom)-10||i.bottom=n.height||e>t.top?c=i.bottom-t.top+"px":h=t.bottom-i.top+"px"}return{top:c,bottom:h,maxWidth:s,class:l?o?"left-narrow":"right-narrow":a?"left":"right"}}positionInfo(e){this.info&&(e?(this.info.style.top=e.top,this.info.style.bottom=e.bottom,this.info.style.maxWidth=e.maxWidth,this.info.className="cm-tooltip cm-completionInfo cm-completionInfo-"+e.class):this.info.style.top="-1e6px")}createListBox(e,t,n){const i=document.createElement("ul");i.id=t,i.setAttribute("role","listbox"),i.setAttribute("aria-expanded","true"),i.setAttribute("aria-label",this.view.state.phrase("Completions"));for(let r=n.from;r=this.options.length?this:new Hg(this.options,eb(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,n,i,r){let s=function(e,t){let n=[],i=0;for(let r of e)if(r.hasResult())if(!1===r.result.filter){let e=r.result.getMatch;for(let t of r.result.options){let s=[1e9-i++];if(e)for(let n of e(t))s.push(n);n.push(new jg(t,r,s))}}else{let e,i=new Gg(t.sliceDoc(r.from,r.to));for(let t of r.result.options)(e=i.match(t.label))&&(null!=t.boost&&(e[0]+=t.boost),n.push(new jg(t,r,e)))}let r=[],s=null,o=t.facet(Bg).compareCompletions;for(let e of n.sort(((e,t)=>t.match[0]-e.match[0]||o(e.completion,t.completion))))!s||s.label!=e.completion.label||s.detail!=e.completion.detail||null!=s.type&&null!=e.completion.type&&s.type!=e.completion.type||s.apply!=e.completion.apply?r.push(e):Fg(e.completion)>Fg(s)&&(r[r.length-1]=e),s=e.completion;return r}(e,t);if(!s.length)return i&&e.some((e=>1==e.state))?new Hg(i.options,i.attrs,i.tooltip,i.timestamp,i.selected,!0):null;let o=t.facet(Bg).selectOnOpen?0:-1;if(i&&i.selected!=o&&-1!=i.selected){let e=i.options[i.selected].completion;for(let t=0;tt.hasResult()?Math.min(e,t.from):e),1e8),create:(a=cb,e=>new Lg(e,a)),above:r.aboveCursor},i?i.timestamp:Date.now(),o,!1);var a}map(e){return new Hg(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class Kg{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new Kg(tb,"cm-ac-"+Math.floor(2e6*Math.random()).toString(36),null)}update(e){let{state:t}=e,n=t.facet(Bg),i=(n.override||t.languageDataAt("autocomplete",zg(t)).map(Mg)).map((t=>(this.active.find((e=>e.source==t))||new ib(t,this.active.some((e=>0!=e.state))?1:0)).update(e,n)));i.length==this.active.length&&i.every(((e,t)=>e==this.active[t]))&&(i=this.active);let r=this.open;e.selection||i.some((t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to)))||!function(e,t){if(e==t)return!0;for(let n=0,i=0;;){for(;n1==e.state))?r=null:r&&e.docChanged&&(r=r.map(e.changes)),!r&&i.every((e=>1!=e.state))&&i.some((e=>e.hasResult()))&&(i=i.map((e=>e.hasResult()?new ib(e.source,0):e)));for(let t of e.effects)t.is(lb)&&(r=r&&r.setSelected(t.value,this.id));return i==this.active&&r==this.open?this:new Kg(i,this.id,r)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:Jg}}const Jg={"aria-autocomplete":"list"};function eb(e,t){let n={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};return t>-1&&(n["aria-activedescendant"]=e+"-"+t),n}const tb=[];function nb(e){return e.isUserEvent("input.type")?"input":e.isUserEvent("delete.backward")?"delete":null}class ib{constructor(e,t,n=-1){this.source=e,this.state=t,this.explicitPos=n}hasResult(){return!1}update(e,t){let n=nb(e),i=this;n?i=i.handleUserEvent(e,n,t):e.docChanged?i=i.handleChange(e):e.selection&&0!=i.state&&(i=new ib(i.source,0));for(let t of e.effects)if(t.is(sb))i=new ib(i.source,1,t.value?zg(e.state):-1);else if(t.is(ob))i=new ib(i.source,0);else if(t.is(ab))for(let e of t.value)e.source==i.source&&(i=e);return i}handleUserEvent(e,t,n){return"delete"!=t&&n.activateOnTyping?new ib(this.source,1):this.map(e.changes)}handleChange(e){return e.changes.touchesRange(zg(e.startState))?new ib(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new ib(this.source,this.state,e.mapPos(this.explicitPos))}}class rb extends ib{constructor(e,t,n,i,r){super(e,2,t),this.result=n,this.from=i,this.to=r}hasResult(){return!0}handleUserEvent(e,t,n){var i;let r=e.changes.mapPos(this.from),s=e.changes.mapPos(this.to,1),o=zg(e.state);if((this.explicitPos<0?o<=r:os||"delete"==t&&zg(e.startState)==this.from)return new ib(this.source,"input"==t&&n.activateOnTyping?1:0);let a,l=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);return function(e,t,n,i){if(!e)return!1;let r=t.sliceDoc(n,i);return"function"==typeof e?e(r,n,i,t):Dg(e,!0).test(r)}(this.result.validFor,e.state,r,s)?new rb(this.source,l,this.result,r,s):this.result.update&&(a=this.result.update(this.result,r,s,new qg(e.state,o,l>=0)))?new rb(this.source,l,a,a.from,null!==(i=a.to)&&void 0!==i?i:zg(e.state)):new ib(this.source,1,l)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new ib(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new rb(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}const sb=ro.define(),ob=ro.define(),ab=ro.define({map:(e,t)=>e.map((e=>e.map(t)))}),lb=ro.define(),cb=qs.define({create:()=>Kg.start(),update:(e,t)=>e.update(t),provide:e=>[Wu.from(e,(e=>e.tooltip)),Xh.contentAttributes.from(e,(e=>e.attrs))]});function hb(e,t="option"){return n=>{let i=n.state.field(cb,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+s*(e?1:-1):e?0:o-1;return a<0?a="page"==t?0:o-1:a>=o&&(a="page"==t?o-1:0),n.dispatch({effects:lb.of(a)}),!0}}class ub{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const db=xl.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.composing=0;for(let t of e.state.field(cb).active)1==t.state&&this.startQuery(t)}update(e){let t=e.state.field(cb);if(!e.selectionSet&&!e.docChanged&&e.startState.field(cb)==t)return;let n=e.transactions.some((e=>(e.selection||e.docChanged)&&!nb(e)));for(let t=0;t50&&Date.now()-i.time>1e3){for(let e of i.context.abortListeners)try{e()}catch(e){ml(this.view.state,e)}i.context.abortListeners=null,this.running.splice(t--,1)}else i.updates.push(...e.transactions)}if(this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),this.debounceUpdate=t.active.some((e=>1==e.state&&!this.running.some((t=>t.active.source==e.source))))?setTimeout((()=>this.startUpdate()),50):-1,0!=this.composing)for(let t of e.transactions)"input"==nb(t)?this.composing=2:2==this.composing&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;let{state:e}=this.view,t=e.field(cb);for(let e of t.active)1!=e.state||this.running.some((t=>t.active.source==e.source))||this.startQuery(e)}startQuery(e){let{state:t}=this.view,n=zg(t),i=new qg(t,n,e.explicitPos==n),r=new ub(e,i);this.running.push(r),Promise.resolve(e.source(i)).then((e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())}),(e=>{this.view.dispatch({effects:ob.of(null)}),ml(this.view.state,e)}))}scheduleAccept(){this.running.every((e=>void 0!==e.done))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),50))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let t=[],n=this.view.state.facet(Bg);for(let i=0;ie.source==r.active.source));if(s&&1==s.state)if(null==r.done){let e=new ib(r.active.source,0);for(let t of r.updates)e=e.update(t,n);1!=e.state&&t.push(e)}else this.startQuery(s)}t.length&&this.view.dispatch({effects:ab.of(t)})}},{eventHandlers:{blur(){let e=this.view.state.field(cb,!1);e&&e.tooltip&&this.view.state.facet(Bg).closeOnBlur&&this.view.dispatch({effects:ob.of(null)})},compositionstart(){this.composing=1},compositionend(){3==this.composing&&setTimeout((()=>this.view.dispatch({effects:sb.of(!1)})),20),this.composing=0}}}),fb=Xh.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":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer",padding:"1px 3px",lineHeight:1.2}}},"&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:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".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:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class Ob{constructor(e,t,n,i){this.field=e,this.line=t,this.from=n,this.to=i}}class pb{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(e){let t=e.mapPos(this.from,-1,ps.TrackDel),n=e.mapPos(this.to,1,ps.TrackDel);return null==t||null==n?null:new pb(this.field,t,n)}}class mb{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],i=[t],r=e.doc.lineAt(t),s=/^\s*/.exec(r.text)[0];for(let r of this.lines){if(n.length){let n=s,o=/^\t*/.exec(r)[0].length;for(let t=0;tnew pb(e.field,i[e.line]+e.from,i[e.line]+e.to)));return{text:n,ranges:o}}static parse(e){let t,n=[],i=[],r=[];for(let s of e.split(/\r\n?|\n/)){for(;t=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(s);){let e=t[1]?+t[1]:null,o=t[2]||t[3]||"",a=-1;for(let t=0;t=a&&e.field++}r.push(new Ob(a,i.length,t.index,t.index+o.length)),s=s.slice(0,t.index)+o+s.slice(t.index+t[0].length)}for(let e;e=/\\([{}])/.exec(s);){s=s.slice(0,e.index)+e[1]+s.slice(e.index+e[0].length);for(let t of r)t.line==i.length&&t.from>e.index&&(t.from--,t.to--)}i.push(s)}return new mb(i,r)}}let gb=Fa.widget({widget:new class extends Na{toDOM(){let e=document.createElement("span");return e.className="cm-snippetFieldPosition",e}ignoreEvent(){return!1}}}),bb=Fa.mark({class:"cm-snippetField"});class wb{constructor(e,t){this.ranges=e,this.active=t,this.deco=Fa.set(e.map((e=>(e.from==e.to?gb:bb).range(e.from,e.to))))}map(e){let t=[];for(let n of this.ranges){let i=n.map(e);if(!i)return null;t.push(i)}return new wb(t,this.active)}selectionInsideField(e){return e.ranges.every((e=>this.ranges.some((t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))))}}const xb=ro.define({map:(e,t)=>e&&e.map(t)}),vb=ro.define(),yb=qs.define({create:()=>null,update(e,t){for(let n of t.effects){if(n.is(xb))return n.value;if(n.is(vb)&&e)return new wb(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>Xh.decorations.from(e,(e=>e?e.deco:Fa.none))});function Sb(e,t){return Qs.create(e.filter((e=>e.field==t)).map((e=>Qs.range(e.from,e.to))))}function $b(e){let t=mb.parse(e);return(e,n,i,r)=>{let{text:s,ranges:o}=t.instantiate(e.state,i),a={changes:{from:i,to:r,insert:Nr.of(s)},scrollIntoView:!0};if(o.length&&(a.selection=Sb(o,0)),o.length>1){let t=new wb(o,0),n=a.effects=[xb.of(t)];void 0===e.state.field(yb,!1)&&n.push(ro.appendConfig.of([yb,Tb,Zb,fb]))}e.dispatch(e.state.update(a))}}function Qb(e){return({state:t,dispatch:n})=>{let i=t.field(yb,!1);if(!i||e<0&&0==i.active)return!1;let r=i.active+e,s=e>0&&!i.ranges.some((t=>t.field==r+e));return n(t.update({selection:Sb(i.ranges,r),effects:xb.of(s?null:new wb(i.ranges,r))})),!0}}const kb=[{key:"Tab",run:Qb(1),shift:Qb(-1)},{key:"Escape",run:({state:e,dispatch:t})=>!!e.field(yb,!1)&&(t(e.update({effects:xb.of(null)})),!0)}],Pb=Ts.define({combine:e=>e.length?e[0]:kb}),Tb=Ds.highest(zh.compute([Pb],(e=>e.facet(Pb))));function _b(e,t){return Object.assign(Object.assign({},t),{apply:$b(e)})}const Zb=Xh.domEventHandlers({mousedown(e,t){let n,i=t.state.field(yb,!1);if(!i||null==(n=t.posAtCoords({x:e.clientX,y:e.clientY})))return!1;let r=i.ranges.find((e=>e.from<=n&&e.to>=n));return!(!r||r.field==i.active)&&(t.dispatch({selection:Sb(i.ranges,r.field),effects:xb.of(i.ranges.some((e=>e.field>r.field))?new wb(i.ranges,r.field):null)}),!0)}}),Cb={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Xb=ro.define({map(e,t){let n=t.mapPos(e,-1,ps.TrackAfter);return null==n?void 0:n}}),Yb=ro.define({map:(e,t)=>t.mapPos(e)}),Rb=new class extends wo{};Rb.startSide=1,Rb.endSide=-1;const qb=qs.define({create:()=>So.empty,update(e,t){if(t.selection){let n=t.state.doc.lineAt(t.selection.main.head).from,i=t.startState.doc.lineAt(t.startState.selection.main.head).from;n!=t.changes.mapPos(i,-1)&&(e=So.empty)}e=e.map(t.changes);for(let n of t.effects)n.is(Xb)?e=e.update({add:[Rb.range(n.value,n.value+1)]}):n.is(Yb)&&(e=e.update({filter:e=>e!=n.value}));return e}});const Ab="()[]{}<>";function Wb(e){for(let t=0;t{if((jb?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let r=e.state.selection.main;if(i.length>2||2==i.length&&1==fs(us(i,0))||t!=r.from||n!=r.to)return!1;let s=function(e,t){let n=Eb(e,e.selection.main.head),i=n.brackets||Cb.brackets;for(let r of i){let s=Wb(us(r,0));if(t==r)return s==r?Gb(e,r,i.indexOf(r+r+r)>-1,n):Ib(e,r,s,n.before||Cb.before);if(t==s&&Ub(e,e.selection.main.from))return Mb(e,r,s)}return null}(e.state,i);return!!s&&(e.dispatch(s),!0)})),Db=[{key:"Backspace",run:({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Eb(e,e.selection.main.head).brackets||Cb.brackets,i=null,r=e.changeByRange((t=>{if(t.empty){let i=function(e,t){let n=e.sliceString(t-2,t);return fs(us(n,0))==n.length?n:n.slice(1)}(e.doc,t.head);for(let r of n)if(r==i&&Vb(e.doc,t.head)==Wb(us(r,0)))return{changes:{from:t.head-r.length,to:t.head+r.length},range:Qs.cursor(t.head-r.length)}}return{range:i=t}}));return i||t(e.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!i}}];function Ub(e,t){let n=!1;return e.field(qb).between(0,e.doc.length,(e=>{e==t&&(n=!0)})),n}function Vb(e,t){let n=e.sliceString(t,t+2);return n.slice(0,fs(us(n,0)))}function Ib(e,t,n,i){let r=null,s=e.changeByRange((s=>{if(!s.empty)return{changes:[{insert:t,from:s.from},{insert:n,from:s.to}],effects:Xb.of(s.to+t.length),range:Qs.range(s.anchor+t.length,s.head+t.length)};let o=Vb(e.doc,s.head);return!o||/\s/.test(o)||i.indexOf(o)>-1?{changes:{insert:t+n,from:s.head},effects:Xb.of(s.head+t.length),range:Qs.cursor(s.head+t.length)}:{range:r=s}}));return r?null:e.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function Mb(e,t,n){let i=null,r=e.selection.ranges.map((t=>t.empty&&Vb(e.doc,t.head)==n?Qs.cursor(t.head+n.length):i=t));return i?null:e.update({selection:Qs.create(r,e.selection.mainIndex),scrollIntoView:!0,effects:e.selection.ranges.map((({from:e})=>Yb.of(e)))})}function Gb(e,t,n,i){let r=i.stringPrefixes||Cb.stringPrefixes,s=null,o=e.changeByRange((i=>{if(!i.empty)return{changes:[{insert:t,from:i.from},{insert:t,from:i.to}],effects:Xb.of(i.to+t.length),range:Qs.range(i.anchor+t.length,i.head+t.length)};let o,a=i.head,l=Vb(e.doc,a);if(l==t){if(Bb(e,a))return{changes:{insert:t+t,from:a},effects:Xb.of(a+t.length),range:Qs.cursor(a+t.length)};if(Ub(e,a)){let i=n&&e.sliceDoc(a,a+3*t.length)==t+t+t;return{range:Qs.cursor(a+t.length*(i?3:1)),effects:Yb.of(a)}}}else{if(n&&e.sliceDoc(a-2*t.length,a)==t+t&&(o=Nb(e,a-2*t.length,r))>-1&&Bb(e,o))return{changes:{insert:t+t+t+t,from:a},effects:Xb.of(a+t.length),range:Qs.cursor(a+t.length)};if(e.charCategorizer(a)(l)!=fo.Word&&Nb(e,a,r)>-1&&!function(e,t,n,i){let r=Xf(e).resolveInner(t,-1),s=i.reduce(((e,t)=>Math.max(e,t.length)),0);for(let o=0;o<5;o++){let o=e.sliceDoc(r.from,Math.min(r.to,r.from+n.length+s)),a=o.indexOf(n);if(!a||a>-1&&i.indexOf(o.slice(0,a))>-1){let t=r.firstChild;for(;t&&t.from==r.from&&t.to-t.from>n.length+a;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let l=r.to==t&&r.parent;if(!l)break;r=l}return!1}(e,a,t,r))return{changes:{insert:t+t,from:a},effects:Xb.of(a+t.length),range:Qs.cursor(a+t.length)}}return{range:s=i}}));return s?null:e.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Bb(e,t){let n=Xf(e).resolveInner(t+1);return n.parent&&n.from==t}function Nb(e,t,n){let i=e.charCategorizer(t);if(i(e.sliceDoc(t-1,t))!=fo.Word)return t;for(let r of n){let n=t-r.length;if(e.sliceDoc(n,t)==r&&i(e.sliceDoc(n-1,n))!=fo.Word)return n}return-1}function Lb(e={}){return[cb,Bg.of(e),db,Hb,fb]}const Fb=[{key:"Ctrl-Space",run:e=>!!e.state.field(cb,!1)&&(e.dispatch({effects:sb.of(!0)}),!0)},{key:"Escape",run:e=>{let t=e.state.field(cb,!1);return!(!t||!t.active.some((e=>0!=e.state)))&&(e.dispatch({effects:ob.of(null)}),!0)}},{key:"ArrowDown",run:hb(!0)},{key:"ArrowUp",run:hb(!1)},{key:"PageDown",run:hb(!0,"page")},{key:"PageUp",run:hb(!1,"page")},{key:"Enter",run:e=>{let t=e.state.field(cb,!1);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||Date.now()-t.open.timestampe.facet(Bg).defaultKeymap?[Fb]:[])));class Kb{constructor(e,t,n){this.from=e,this.to=t,this.diagnostic=n}}class Jb{constructor(e,t,n){this.diagnostics=e,this.panel=t,this.selected=n}static init(e,t,n){let i=e,r=n.facet(fw).markerFilter;r&&(i=r(i));let s=Fa.set(i.map((e=>e.from==e.to||e.from==e.to-1&&n.doc.lineAt(e.from).to==e.from?Fa.widget({widget:new mw(e),diagnostic:e}).range(e.from):Fa.mark({attributes:{class:"cm-lintRange cm-lintRange-"+e.severity},diagnostic:e}).range(e.from,e.to))),!0);return new Jb(s,t,ew(s))}}function ew(e,t=null,n=0){let i=null;return e.between(n,1e9,((e,n,{spec:r})=>{if(!t||r.diagnostic==t)return i=new Kb(e,n,r.diagnostic),!1})),i}function tw(e,t){return!(!e.effects.some((e=>e.is(iw)))&&!e.changes.touchesRange(t.pos))}function nw(e,t){return e.field(ow,!1)?t:t.concat(ro.appendConfig.of([ow,Xh.decorations.compute([ow],(e=>{let{selected:t,panel:n}=e.field(ow);return t&&n&&t.from!=t.to?Fa.set([aw.range(t.from,t.to)]):Fa.none})),Vu(lw,{hideOn:tw}),xw]))}const iw=ro.define(),rw=ro.define(),sw=ro.define(),ow=qs.define({create:()=>new Jb(Fa.none,null,null),update(e,t){if(t.docChanged){let n=e.diagnostics.map(t.changes),i=null;if(e.selected){let r=t.changes.mapPos(e.selected.from,1);i=ew(n,e.selected.diagnostic,r)||ew(n,null,r)}e=new Jb(n,e.panel,i)}for(let n of t.effects)n.is(iw)?e=Jb.init(n.value,e.panel,t.state):n.is(rw)?e=new Jb(e.diagnostics,n.value?bw.open:null,e.selected):n.is(sw)&&(e=new Jb(e.diagnostics,e.panel,n.value));return e},provide:e=>[Fu.from(e,(e=>e.panel)),Xh.decorations.from(e,(e=>e.diagnostics))]}),aw=Fa.mark({class:"cm-lintRange cm-lintRange-active"});function lw(e,t,n){let{diagnostics:i}=e.state.field(ow),r=[],s=2e8,o=0;i.between(t-(n<0?1:0),t+(n>0?1:0),((e,i,{spec:a})=>{t>=e&&t<=i&&(e==i||(t>e||n>0)&&(t({dom:cw(e,r)})}:null}function cw(e,t){return Ym("ul",{class:"cm-tooltip-lint"},t.map((t=>pw(e,t,!1))))}const hw=e=>{let t=e.state.field(ow,!1);return!(!t||!t.panel)&&(e.dispatch({effects:rw.of(!1)}),!0)},uw=[{key:"Mod-Shift-m",run:e=>{let t=e.state.field(ow,!1);t&&t.panel||e.dispatch({effects:nw(e.state,[rw.of(!0)])});let n=Gu(e,bw.open);return n&&n.dom.querySelector(".cm-panel-lint ul").focus(),!0},preventDefault:!0},{key:"F8",run:e=>{let t=e.state.field(ow,!1);if(!t)return!1;let n=e.state.selection.main,i=t.diagnostics.iter(n.to+1);return!(!i.value&&(i=t.diagnostics.iter(0),!i.value||i.from==n.from&&i.to==n.to))&&(e.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)}}],dw=xl.fromClass(class{constructor(e){this.view=e,this.timeout=-1,this.set=!0;let{delay:t}=e.state.facet(fw);this.lintTime=Date.now()+t,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,t)}run(){let e=Date.now();if(ePromise.resolve(e(this.view))))).then((t=>{let n=t.reduce(((e,t)=>e.concat(t)));this.view.state.doc==e.doc&&this.view.dispatch(function(e,t){return{effects:nw(e,[iw.of(t)])}}(this.view.state,n))}),(e=>{ml(this.view.state,e)}))}}update(e){let t=e.state.facet(fw);(e.docChanged||t!=e.startState.facet(fw))&&(this.lintTime=Date.now()+t.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,t.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}}),fw=Ts.define({combine:e=>Object.assign({sources:e.map((e=>e.source))},bo(e.map((e=>e.config)),{delay:750,markerFilter:null,tooltipFilter:null})),enables:dw});function Ow(e){let t=[];if(e)e:for(let{name:n}of e){for(let e=0;ee.toLowerCase()==i.toLowerCase()))){t.push(i);continue e}}t.push("")}return t}function pw(e,t,n){var i;let r=n?Ow(t.actions):[];return Ym("li",{class:"cm-diagnostic cm-diagnostic-"+t.severity},Ym("span",{class:"cm-diagnosticText"},t.renderMessage?t.renderMessage():t.message),null===(i=t.actions)||void 0===i?void 0:i.map(((n,i)=>{let s=i=>{i.preventDefault();let r=ew(e.state.field(ow).diagnostics,t);r&&n.apply(e,r.from,r.to)},{name:o}=n,a=r[i]?o.indexOf(r[i]):-1,l=a<0?o:[o.slice(0,a),Ym("u",o.slice(a,a+1)),o.slice(a+1)];return Ym("button",{type:"button",class:"cm-diagnosticAction",onclick:s,onmousedown:s,"aria-label":` Action: ${o}${a<0?"":` (access key "${r[i]})"`}.`},l)})),t.source&&Ym("div",{class:"cm-diagnosticSource"},t.source))}class mw extends Na{constructor(e){super(),this.diagnostic=e}eq(e){return e.diagnostic==this.diagnostic}toDOM(){return Ym("span",{class:"cm-lintPoint cm-lintPoint-"+this.diagnostic.severity})}}class gw{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(4294967295*Math.random()).toString(16),this.dom=pw(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class bw{constructor(e){this.view=e,this.items=[];this.list=Ym("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t=>{if(27==t.keyCode)hw(this.view),this.view.focus();else if(38==t.keyCode||33==t.keyCode)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(40==t.keyCode||34==t.keyCode)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(36==t.keyCode)this.moveSelection(0);else if(35==t.keyCode)this.moveSelection(this.items.length-1);else if(13==t.keyCode)this.view.focus();else{if(!(t.keyCode>=65&&t.keyCode<=90&&this.selectedIndex>=0))return;{let{diagnostic:n}=this.items[this.selectedIndex],i=Ow(n.actions);for(let r=0;r{for(let t=0;thw(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(ow).selected;if(!e)return-1;for(let t=0;t{let a,l=-1;for(let e=n;en&&(this.items.splice(n,l-n),i=!0)),t&&a.diagnostic==t.diagnostic?a.dom.hasAttribute("aria-selected")||(a.dom.setAttribute("aria-selected","true"),r=a):a.dom.hasAttribute("aria-selected")&&a.dom.removeAttribute("aria-selected"),n++}));n({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:e,panel:t})=>{e.topt.bottom&&(this.list.scrollTop+=e.bottom-t.bottom)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),i&&this.sync()}sync(){let e=this.list.firstChild;function t(){let t=e;e=t.nextSibling,t.remove()}for(let n of this.items)if(n.dom.parentNode==this.list){for(;e!=n.dom;)t();e=n.dom.nextSibling}else this.list.insertBefore(n.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=ew(this.view.state.field(ow).diagnostics,this.items[e].diagnostic);t&&this.view.dispatch({selection:{anchor:t.from,head:t.to},scrollIntoView:!0,effects:sw.of(t)})}static open(e){return new bw(e)}}function ww(e){return function(e,t='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(e)}')`}(``,'width="6" height="3"')}const xw=Xh.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:ww("#d11")},".cm-lintRange-warning":{backgroundImage:ww("orange")},".cm-lintRange-info":{backgroundImage:ww("#999")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}}}),vw=(()=>[pd(),bd,mu(),pp(),PO(),Jh(),[au,lu],go.allowMultipleSelections.of(!0),go.transactionFilter.of((e=>{if(!e.docChanged||!e.isUserEvent("input.type")&&!e.isUserEvent("input.complete"))return e;let t=e.startState.languageDataAt("indentOnInput",e.startState.selection.main.head);if(!t.length)return e;let n=e.newDoc,{head:i}=e.newSelection.main,r=n.lineAt(i);if(i>r.from+200)return e;let s=n.sliceString(r.from,i);if(!t.some((e=>e.test(s))))return e;let{state:o}=e,a=-1,l=[];for(let{head:e}of o.selection.ranges){let t=o.doc.lineAt(e);if(t.from==a)continue;a=t.from;let n=Bf(o,t.from);if(null==n)continue;let i=/^\s*/.exec(t.text)[0],r=Gf(o,n);i!=r&&l.push({from:t.from,to:t.from+i.length,insert:r})}return l.length?[e,{changes:l,sequential:!0}]:e})),YO(AO,{fallback:!0}),MO(),[zb,qb],Lb(),Qu(),Tu(),vu,Fm(),zh.of([...Db,...Cm,...Tg,...Cp,...bO,...Fb,...uw])])();class yw{constructor(e,t,n,i,r,s,o,a,l,c=0,h){this.p=e,this.stack=t,this.state=n,this.reducePos=i,this.pos=r,this.score=s,this.buffer=o,this.bufferBase=a,this.curContext=l,this.lookAhead=c,this.parent=h}toString(){return`[${this.stack.filter(((e,t)=>t%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,n=0){let i=e.parser.context;return new yw(e,[],t,n,n,0,[],0,i?new Sw(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let n=e>>19,i=65535&e,{parser:r}=this.p,s=r.dynamicPrecedence(i);if(s&&(this.score+=s),0==n)return this.pushState(r.getGoto(this.state,i,!0),this.reducePos),i=2e3&&!(null===(t=this.p.parser.nodeSet.types[i])||void 0===t?void 0:t.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=l):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(i,a)}storeNode(e,t,n,i=4,r=!1){if(0==e&&(!this.stack.length||this.stack[this.stack.length-1]0&&0==e.buffer[i-4]&&e.buffer[i-1]>-1){if(t==n)return;if(e.buffer[i-2]>=t)return void(e.buffer[i-2]=n)}}if(r&&this.pos!=n){let r=this.buffer.length;if(r>0&&0!=this.buffer[r-4])for(;r>0&&this.buffer[r-2]>n;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,i>4&&(i-=4);this.buffer[r]=e,this.buffer[r+1]=t,this.buffer[r+2]=n,this.buffer[r+3]=i}else this.buffer.push(e,t,n,i)}shift(e,t,n,i){if(131072&e)this.pushState(65535&e,this.pos);else if(0==(262144&e)){let r=e,{parser:s}=this.p;(i>this.pos||t<=s.maxNode)&&(this.pos=i,s.stateFlag(r,1)||(this.reducePos=i)),this.pushState(r,n),this.shiftContext(t,n),t<=s.maxNode&&this.buffer.push(t,n,i,4)}else this.pos=i,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,i,4)}apply(e,t,n,i){65536&e?this.reduce(e):this.shift(e,t,n,i)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let i=this.pos;this.reducePos=this.pos=i+e.length,this.pushState(t,i),this.buffer.push(n,i,this.reducePos,-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,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let n=e.buffer.slice(t),i=e.bufferBase+t;for(;e&&i==e.bufferBase;)e=e.parent;return new yw(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,n,i,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new $w(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(0==n)return!1;if(0==(65536&n))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let i,r=0;r1&t&&e==i))||n.push(t[e],i)}t=n}let n=[];for(let e=0;e>19,i=65535&t,r=this.stack.length-3*n;if(r<0||e.getGoto(this.stack[r],i,!1)<0){let e=this.findForcedReduction();if(null==e)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(i,r)=>{if(!t.includes(i))return t.push(i),e.allActions(i,(t=>{if(393216&t);else if(65536&t){let n=(t>>19)-r;if(n>1){let i=65535&t,r=this.stack.length-3*n;if(r>=0&&e.getGoto(this.stack[r],i,!1)>=0)return n<<19|65536|i}}else{let e=n(t,r+1);if(null!=e)return e}}))};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(3!=this.stack.length)return!1;let{parser:e}=this.p;return 65535==e.data[e.stateSlot(this.state,1)]&&!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 t=0;tthis.lookAhead&&(this.emitLookAhead(),this.lookAhead=e)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Sw{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class $w{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=65535&e,n=e>>19;0==n?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=3*(n-1);let i=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=i}}class Qw{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,0==this.index&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Qw(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;null!=e&&(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,0==this.index&&this.maybeNext()}fork(){return new Qw(this.stack,this.pos,this.index)}}function kw(e,t=Uint16Array){if("string"!=typeof e)return e;let n=null;for(let i=0,r=0;i=92&&t--,t>=34&&t--;let r=t-32;if(r>=46&&(r-=46,n=!0),s+=r,n)break;s*=46}n?n[r++]=s:n=new t(s)}return n}class Pw{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const Tw=new Pw;class _w{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=Tw,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,i=this.rangeIndex,r=this.pos+e;for(;rn.to:r>=n.to;){if(i==this.ranges.length-1)return null;let e=this.ranges[++i];r+=e.from-n.to,n=e}return r}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t,n,i=this.chunkOff+e;if(i>=0&&i=this.chunk2Pos&&ti.to&&(this.chunk2=this.chunk2.slice(0,i.to-t)),n=this.chunk2.charCodeAt(0)}}return t>=this.token.lookAhead&&(this.token.lookAhead=t+1),n}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(null==n||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,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=Tw,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&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n="";for(let i of this.ranges){if(i.from>=t)break;i.to>e&&(n+=this.input.read(Math.max(i.from,e),Math.min(i.to,t)))}return n}}class Zw{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Yw(this.data,e,t,this.id,n.data,n.tokenPrecTable)}}Zw.prototype.contextual=Zw.prototype.fallback=Zw.prototype.extend=!1;class Cw{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data="string"==typeof e?kw(e):e}token(e,t){let n=e.pos,i=0;for(;;){let n=e.next<0,r=e.resolveOffset(1,1);if(Yw(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(null==this.elseToken)return;if(n||i++,null==r)break;e.reset(r,e.token)}i&&(e.reset(n,e.token),e.acceptToken(this.elseToken,i))}}Cw.prototype.contextual=Zw.prototype.fallback=Zw.prototype.extend=!1;class Xw{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function Yw(e,t,n,i,r,s){let o=0,a=1<0){let n=e[i];if(l.allows(n)&&(-1==t.token.value||t.token.value==n||qw(n,t.token.value,r,s))){t.acceptToken(n);break}}let i=t.next,c=0,h=e[o+2];if(!(t.next<0&&h>c&&65535==e[n+3*h-3]&&65535==e[n+3*h-3])){for(;c>1,s=n+r+(r<<1),a=e[s],l=e[s+1]||65536;if(i=l)){o=e[s+2],t.advance();continue e}c=r+1}}break}o=e[n+3*h-1]}}function Rw(e,t,n){for(let i,r=t;65535!=(i=e[r]);r++)if(i==n)return r-t;return-1}function qw(e,t,n,i){let r=Rw(n,i,t);return r<0||Rw(n,i,e)t)&&!i.type.isError)return n<0?Math.max(0,Math.min(i.to-1,t-25)):Math.min(e.length,Math.max(i.from+1,t+25));if(n<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return n<0?0:e.length}}class jw{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Ew(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Ew(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=s,null;if(r instanceof Zd){if(s==e){if(s=Math.max(this.safeFrom,e)&&(this.trees.push(r),this.start.push(s),this.index.push(0))}else this.index[t]++,this.nextStart=s+r.length}}}class zw{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map((e=>new Pw))}getActions(e){let t=0,n=null,{parser:i}=e.p,{tokenizers:r}=i,s=i.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,a=0;for(let i=0;ic.end+25&&(a=Math.max(c.lookAhead,a)),0!=c.value)){let i=t;if(c.extended>-1&&(t=this.addActions(e,c.extended,c.end,t)),t=this.addActions(e,c.value,c.end,t),!l.extend&&(n=c,t>i))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),n||e.pos!=this.stream.end||(n=new Pw,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new Pw,{pos:n,p:i}=e;return t.start=n,t.end=Math.min(n+1,i.stream.end),t.value=n==i.stream.end?i.parser.eofTerm:0,t}updateCachedToken(e,t,n){let i=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(i,e),n),e.value>-1){let{parser:t}=n.p;for(let i=0;i=0&&n.p.parser.dialect.allows(r>>1)){0==(1&r)?e.value=r>>1:e.extended=r>>1;break}}}else e.value=0,e.end=this.stream.clipPos(i+1)}putAction(e,t,n,i){for(let t=0;t4*e.bufferLength?new jw(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e,t,n=this.stacks,i=this.minStackPos,r=this.stacks=[];if(this.bigReductionCount>300&&1==n.length){let[e]=n;for(;e.forceReduce()&&e.stack.length&&e.stack[e.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let s=0;si)r.push(o);else{if(this.advanceStack(o,r,n))continue;{e||(e=[],t=[]),e.push(o);let n=this.tokens.getMainToken(o);t.push(n.value,n.end)}}break}}if(!r.length){let t=e&&function(e){let t=null;for(let n of e){let e=n.p.stoppedAt;(n.pos==n.p.stream.end||null!=e&&n.pos>e)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.scorethis.stoppedAt?e[0]:this.runRecovery(e,t,r);if(n)return Aw&&console.log("Force-finish "+this.stackID(n)),this.stackToTree(n.forceAll())}if(this.recovering){let e=1==this.recovering?1:3*this.recovering;if(r.length>e)for(r.sort(((e,t)=>t.score-e.score));r.length>e;)r.pop();r.some((e=>e.reducePos>i))&&this.recovering--}else if(r.length>1){e:for(let e=0;e500&&i.buffer.length>500){if(!((t.score-i.score||t.buffer.length-i.buffer.length)>0)){r.splice(e--,1);continue e}r.splice(n--,1)}}}r.length>12&&r.splice(12,r.length-12)}this.minStackPos=r[0].pos;for(let e=1;e ":"";if(null!=this.stoppedAt&&i>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let o=this.fragments.nodeAt(i);o;){let i=this.parser.nodeSet.types[o.type.id]==o.type?r.getGoto(e.state,o.type.id):-1;if(i>-1&&o.length&&(!t||(o.prop(yd.contextHash)||0)==n))return e.useNode(o,i),Aw&&console.log(s+this.stackID(e)+` (via reuse of ${r.getName(o.type.id)})`),!0;if(!(o instanceof Zd)||0==o.children.length||o.positions[0]>0)break;let a=o.children[0];if(!(a instanceof Zd&&0==o.positions[0]))break;o=a}}let o=r.stateSlot(e.state,4);if(o>0)return e.reduce(o),Aw&&console.log(s+this.stackID(e)+` (via always-reduce ${r.getName(65535&o)})`),!0;if(e.stack.length>=9e3)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let o=0;oi?t.push(d):n.push(d)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Uw(e,t),!0}}runRecovery(e,t,n){let i=null,r=!1;for(let s=0;s ":"";if(o.deadEnd){if(r)continue;if(r=!0,o.restart(),Aw&&console.log(c+this.stackID(o)+" (restarted)"),this.advanceFully(o,n))continue}let h=o.split(),u=c;for(let e=0;h.forceReduce()&&e<10;e++){if(Aw&&console.log(u+this.stackID(h)+" (via force-reduce)"),this.advanceFully(h,n))break;Aw&&(u=this.stackID(h)+" -> ")}for(let e of o.recoverByInsert(a))Aw&&console.log(c+this.stackID(e)+" (via recover-insert)"),this.advanceFully(e,n);this.stream.end>o.pos?(l==o.pos&&(l++,a=0),o.recoverByDelete(a,l),Aw&&console.log(c+this.stackID(o)+` (via recover-delete ${this.parser.getName(a)})`),Uw(o,n)):(!i||i.scoree;class Mw{constructor(e){this.start=e.start,this.shift=e.shift||Iw,this.reduce=e.reduce||Iw,this.reuse=e.reuse||Iw,this.hash=e.hash||(()=>0),this.strict=!1!==e.strict}}class Gw extends Fd{constructor(e){if(super(),this.wrappers=[],14!=e.version)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let n=0;ne.topRules[t][1])),i=[];for(let e=0;e=0)r(i,e,t[n++]);else{let s=t[n+-i];for(let o=-i;o>0;o--)r(t[n++],e,s);n++}}}this.nodeSet=new kd(t.map(((t,r)=>Qd.define({name:r>=this.minRepeatTerm?void 0:t,id:r,props:i[r],top:n.indexOf(r)>-1,error:0==r,skipped:e.skippedNodes&&e.skippedNodes.indexOf(r)>-1})))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=wd;let s=kw(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;e"number"==typeof e?new Zw(s,e):e)),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,t,n){let i=new Dw(this,e,t,n);for(let r of this.wrappers)i=r(i,e,t,n);return i}getGoto(e,t,n=!1){let i=this.goto;if(t>=i[0])return-1;for(let r=i[t+1];;){let t=i[r++],s=1&t,o=i[r++];if(s&&n)return o;for(let n=r+(t>>1);r0}validAction(e,t){return!!this.allActions(e,(e=>e==t||null))}allActions(e,t){let n=this.stateSlot(e,4),i=n?t(n):void 0;for(let n=this.stateSlot(e,1);null==i;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=Bw(this.data,n+2)}i=t(Bw(this.data,n+1))}return i}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(65535==this.data[n]){if(1!=this.data[n+1])break;n=Bw(this.data,n+2)}if(0==(1&this.data[n+2])){let e=this.data[n+1];t.some(((t,n)=>1&n&&t==e))||t.push(this.data[n],e)}}return t}configure(e){let t=Object.assign(Object.create(Gw.prototype),this);if(e.props&&(t.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}`);t.top=n}return e.tokenizers&&(t.tokenizers=this.tokenizers.map((t=>{let n=e.tokenizers.find((e=>e.from==t));return n?n.to:t}))),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map(((n,i)=>{let r=e.specializers.find((e=>e.from==n.external));if(!r)return n;let s=Object.assign(Object.assign({},n),{external:r.to});return t.specializers[i]=Nw(s),s}))),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),null!=e.strict&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),null!=e.bufferLength&&(t.bufferLength=e.bufferLength),t}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 t=this.dynamicPrecedences;return null==t?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map((()=>!1));if(e)for(let i of e.split(" ")){let e=t.indexOf(i);e>=0&&(n[e]=!0)}let i=null;for(let e=0;ee.external(n,i)<<1|t}return e.get}function Lw(e){return 45==e||46==e||58==e||e>=65&&e<=90||95==e||e>=97&&e<=122||e>=161}let Fw=null,Hw=null,Kw=0;function Jw(e,t){let n=e.pos+t;if(Hw==e&&Kw==n)return Fw;for(;9==(i=e.peek(t))||10==i||13==i||32==i;)t++;var i;let r="";for(;;){let n=e.peek(t);if(!Lw(n))break;r+=String.fromCharCode(n),t++}return Hw=e,Kw=n,Fw=r||null}function ex(e,t){this.name=e,this.parent=t,this.hash=t?t.hash:0;for(let t=0;t1==t?new ex(Jw(i,1)||"",e):e,reduce:(e,t)=>11==t&&e?e.parent:e,reuse(e,t,n,i){let r=t.type.id;return 1==r||13==r?new ex(Jw(i,1)||"",e):e},hash:e=>e?e.hash:0,strict:!1}),nx=new Xw(((e,t)=>{if(60==e.next)if(e.advance(),47==e.next){e.advance();let n=Jw(e,0);if(!n)return e.acceptToken(5);if(t.context&&n==t.context.name)return e.acceptToken(2);for(let i=t.context;i;i=i.parent)if(i.name==n)return e.acceptToken(3,-2);e.acceptToken(4)}else if(33!=e.next&&63!=e.next)return e.acceptToken(1)}),{contextual:!0});function ix(e,t){return new Xw((n=>{for(let i=0,r=0;;r++){if(n.next<0){r&&n.acceptToken(e);break}if(n.next==t.charCodeAt(i)){if(i++,i==t.length){r>=t.length&&n.acceptToken(e,1-t.length);break}}else i=n.next==t.charCodeAt(0)?1:0;n.advance()}}))}const rx=ix(35,"--\x3e"),sx=ix(36,"?>"),ox=ix(37,"]]>"),ax=nf({Text:$f.content,"StartTag StartCloseTag EndTag SelfCloseEndTag":$f.angleBracket,TagName:$f.tagName,"MismatchedCloseTag/Tagname":[$f.tagName,$f.invalid],AttributeName:$f.attributeName,AttributeValue:$f.attributeValue,Is:$f.definitionOperator,"EntityReference CharacterReference":$f.character,Comment:$f.blockComment,ProcessingInst:$f.processingInstruction,DoctypeDecl:$f.documentMeta,Cdata:$f.special($f.string)}),lx=Gw.deserialize({version:14,states:",SOQOaOOOrOxO'#CfOzOpO'#CiO!tOaO'#CgOOOP'#Cg'#CgO!{OrO'#CrO#TOtO'#CsO#]OpO'#CtOOOP'#DS'#DSOOOP'#Cv'#CvQQOaOOOOOW'#Cw'#CwO#eOxO,59QOOOP,59Q,59QOOOO'#Cx'#CxO#mOpO,59TO#uO!bO,59TOOOP'#C{'#C{O$TOaO,59RO$[OpO'#CoOOOP,59R,59ROOOQ'#C|'#C|O$dOrO,59^OOOP,59^,59^OOOS'#C}'#C}O$lOtO,59_OOOP,59_,59_O$tOpO,59`O$|OpO,59`OOOP-E6t-E6tOOOW-E6u-E6uOOOP1G.l1G.lOOOO-E6v-E6vO%UO!bO1G.oO%UO!bO1G.oO%dOpO'#CkO%lO!bO'#CyO%zO!bO1G.oOOOP1G.o1G.oOOOP1G.w1G.wOOOP-E6y-E6yOOOP1G.m1G.mO&VOpO,59ZO&_OpO,59ZOOOQ-E6z-E6zOOOP1G.x1G.xOOOS-E6{-E6{OOOP1G.y1G.yO&gOpO1G.zO&gOpO1G.zOOOP1G.z1G.zO&oO!bO7+$ZO&}O!bO7+$ZOOOP7+$Z7+$ZOOOP7+$c7+$cO'YOpO,59VO'bOpO,59VO'jO!bO,59eOOOO-E6w-E6wO'xOpO1G.uO'xOpO1G.uOOOP1G.u1G.uO(QOpO7+$fOOOP7+$f7+$fO(YO!bO<`#X;'S%y;'S;=`&_<%lO%yX>eV{WOr%ysv%yw#T%y#T#U>z#U;'S%y;'S;=`&_<%lO%yX?PV{WOr%ysv%yw#h%y#h#i?f#i;'S%y;'S;=`&_<%lO%yX?kV{WOr%ysv%yw#T%y#T#U",boost:2}),this.closeNameCompletion=Object.assign(Object.assign({},this.completion),{label:this.name+">"}),this.text=e.textContent?e.textContent.map((e=>({label:e,type:"text"}))):[]}}const fx=/^[:\-\.\w\u00b7-\uffff]*$/;function Ox(e){return Object.assign(Object.assign({type:"property"},e.completion||{}),{label:e.name})}function px(e){return"string"==typeof e?{label:`"${e}"`,type:"constant"}:/^"/.test(e.label)?e:Object.assign(Object.assign({},e),{label:`"${e.label}"`})}function mx(e,t){let n=[],i=[],r=Object.create(null);for(let e of t){let t=Ox(e);n.push(t),e.global&&i.push(t),e.values&&(r[e.name]=e.values.map(px))}let s=[],o=[],a=Object.create(null);for(let t of e){let e=i,l=r;t.attributes&&(e=e.concat(t.attributes.map((e=>"string"==typeof e?n.find((t=>t.label==e))||{label:e,type:"property"}:(e.values&&(l==r&&(l=Object.create(l)),l[e.name]=e.values.map(px)),Ox(e))))));let c=new dx(t,e,l);a[c.name]=c,s.push(c),t.top&&o.push(c)}o.length||(o=s);for(let t=0;t{var t;let{doc:n}=e.state,l=function(e,t){var n;let i=Xf(e).resolveInner(t,-1),r=null;for(let e=i;!r&&e.parent;e=e.parent)"OpenTag"!=e.name&&"CloseTag"!=e.name&&"SelfClosingTag"!=e.name&&"MismatchedCloseTag"!=e.name||(r=e);if(r&&(r.to>t||r.lastChild.type.isError)){let e=r.parent;if("TagName"==i.name)return"CloseTag"==r.name||"MismatchedCloseTag"==r.name?{type:"closeTag",from:i.from,context:e}:{type:"openTag",from:i.from,context:ux(e)};if("AttributeName"==i.name)return{type:"attrName",from:i.from,context:r};if("AttributeValue"==i.name)return{type:"attrValue",from:i.from,context:r};let n=i==r||"Attribute"==i.name?i.childBefore(t):i;return"StartTag"==(null==n?void 0:n.name)?{type:"openTag",from:t,context:ux(e)}:"StartCloseTag"==(null==n?void 0:n.name)&&n.to<=t?{type:"closeTag",from:t,context:e}:"Is"==(null==n?void 0:n.name)?{type:"attrValue",from:t,context:r}:n?{type:"attrName",from:t,context:r}:null}if("StartCloseTag"==i.name)return{type:"closeTag",from:t,context:i.parent};for(;i.parent&&i.to==t&&!(null===(n=i.lastChild)||void 0===n?void 0:n.type.isError);)i=i.parent;return"Element"==i.name||"Text"==i.name||"Document"==i.name?{type:"tag",from:t,context:"Element"==i.name?i:ux(i)}:null}(e.state,e.pos);if(!l||"tag"==l.type&&!e.explicit)return null;let{type:c,from:h,context:u}=l;if("openTag"==c){let e=o,t=hx(n,u);if(t){let n=a[t];e=(null==n?void 0:n.children)||s}return{from:h,options:e.map((e=>e.completion)),validFor:fx}}if("closeTag"==c){let i=hx(n,u);return i?{from:h,to:e.pos+(">"==n.sliceString(e.pos,e.pos+1)?1:0),options:[(null===(t=a[i])||void 0===t?void 0:t.closeNameCompletion)||{label:i+">",type:"type"}],validFor:fx}:null}if("attrName"==c){let e=a[cx(n,u)];return{from:h,options:(null==e?void 0:e.attrs)||i,validFor:fx}}if("attrValue"==c){let t=function(e,t,n){let i=t&&t.getChildren("Attribute").find((e=>e.from<=n&&e.to>=n)),r=i&&i.getChild("AttributeName");return r?e.sliceString(r.from,r.to):""}(n,u,h);if(!t)return null;let i=a[cx(n,u)],s=((null==i?void 0:i.attrValues)||r)[t];return s&&s.length?{from:h,to:e.pos+('"'==n.sliceString(e.pos,e.pos+1)?1:0),options:s,validFor:/^"[^"]*"?$/}:null}if("tag"==c){let t=hx(n,u),i=a[t],r=[],l=u&&u.lastChild;!t||l&&"CloseTag"==l.name&&cx(n,l)==t||r.push(i?i.closeCompletion:{label:"",type:"type",boost:2});let c=r.concat(((null==i?void 0:i.children)||(u?s:o)).map((e=>e.openCompletion)));if(u&&(null==i?void 0:i.text.length)){let t=u.firstChild;t.to>e.pos-20&&!/\S/.test(e.state.sliceDoc(t.to,e.pos))&&(c=c.concat(i.text))}return{from:h,options:c,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}return null}}const gx=Cf.define({name:"xml",parser:lx.configure({props:[Lf.add({Element(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"OpenTag CloseTag SelfClosingTag":e=>e.column(e.node.from)+e.unit}),sO.add({Element(e){let t=e.firstChild,n=e.lastChild;return t&&"OpenTag"==t.name?{from:t.to,to:"CloseTag"==n.name?n.from:e.to}:null}}),GO.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/$/}});const bx=nf({String:$f.string,Number:$f.number,"True False":$f.bool,PropertyName:$f.propertyName,Null:$f.null,",":$f.separator,"[ ]":$f.squareBracket,"{ }":$f.brace}),wx=Gw.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#CjOOQO'#Cp'#CpQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CrOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59U,59UO!iQPO,59UOVQPO,59QOqQPO'#CkO!nQPO,59^OOQO1G.k1G.kOVQPO'#ClO!vQPO,59aOOQO1G.p1G.pOOQO1G.l1G.lOOQO,59V,59VOOQO-E6i-E6iOOQO,59W,59WOOQO-E6j-E6j",stateData:"#O~OcOS~OQSORSOSSOTSOWQO]ROePO~OVXOeUO~O[[O~PVOg^O~Oh_OVfX~OVaO~OhbO[iX~O[dO~Oh_OVfa~OhbO[ia~O",goto:"!kjPPPPPPkPPkqwPPk{!RPPP!XP!ePP!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName ] [ Array",maxTerm:25,nodeProps:[["openedBy",7,"{",12,"["],["closedBy",8,"}",13,"]"]],propSources:[bx],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oc~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Oe~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zOh~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yOg~~'OO]~~'TO[~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),xx=Cf.define({name:"json",parser:wx.configure({props:[Lf.add({Object:iO({except:/^\s*\}/}),Array:iO({except:/^\s*\]/})}),sO.add({"Object Array":oO})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});const vx=new Set([27,51,52,270,67,133,58,59,251,64,65,74,62,63,154,155,158,115]);function yx(e){return 10==e||13==e}const Sx=new Xw(((e,t)=>{let n;if(e.next<0)e.acceptToken(206);else if(t.context.depth<0)yx(e.next)&&e.acceptToken(205,1);else if(((n=e.peek(-1))<0||yx(n))&&t.canShift(204)){let t=0;for(;32==e.next||9==e.next;)e.advance(),t++;10!=e.next&&13!=e.next&&35!=e.next||e.acceptToken(204,-t)}else yx(e.next)&&e.acceptToken(203,1)}),{contextual:!0}),$x=new Xw(((e,t)=>{let n=t.context.depth;if(n<0)return;let i=e.peek(-1);if(10==i||13==i){let t=0,i=0;for(;;){if(32==e.next)t++;else{if(9!=e.next)break;t+=8-t%8}e.advance(),i++}t!=n&&10!=e.next&&13!=e.next&&35!=e.next&&(te.depth<0&&vx.has(t)?e.parent:e,shift:(e,t,n,i)=>201==t?new Qx(e,function(e){let t=0;for(let n=0;ne.hash}),Px=new Xw((e=>{for(let t=0;t<5;t++){if(e.next!="print".charCodeAt(t))return;e.advance()}if(!/\w/.test(String.fromCharCode(e.next)))for(let t=0;;t++){let n=e.peek(t);if(32!=n&&9!=n)return void(40!=n&&46!=n&&10!=n&&13!=n&&35!=n&&e.acceptToken(1))}}));function Tx(e,t,n,i,r){return new Xw((s=>{let o=s.pos;for(;!(s.next<0);)if(123==s.next){if(123!=s.peek(1)){if(s.pos==o)return void s.acceptToken(i,1);break}s.advance(2)}else if(92==s.next)s.advance(),s.next>=0&&s.advance();else{if(s.next==e&&(1==t||s.peek(1)==e&&s.peek(2)==e)){if(s.pos==o)return void s.acceptToken(r,t);break}s.advance()}s.pos>o&&s.acceptToken(n)}))}const _x=Tx(39,1,207,2,208),Zx=Tx(34,1,209,3,210),Cx=Tx(39,3,211,4,212),Xx=Tx(34,3,213,5,214),Yx=nf({'async "*" "**" FormatConversion FormatSpec':$f.modifier,"for while if elif else try except finally return raise break continue with pass assert await yield match case":$f.controlKeyword,"in not and or is del":$f.operatorKeyword,"from def class global nonlocal lambda":$f.definitionKeyword,import:$f.moduleKeyword,"with as print":$f.keyword,Boolean:$f.bool,None:$f.null,VariableName:$f.variableName,"CallExpression/VariableName":$f.function($f.variableName),"FunctionDefinition/VariableName":$f.function($f.definition($f.variableName)),"ClassDefinition/VariableName":$f.definition($f.className),PropertyName:$f.propertyName,"CallExpression/MemberExpression/PropertyName":$f.function($f.propertyName),Comment:$f.lineComment,Number:$f.number,String:$f.string,FormatString:$f.special($f.string),UpdateOp:$f.updateOperator,"ArithOp!":$f.arithmeticOperator,BitOp:$f.bitwiseOperator,CompareOp:$f.compareOperator,AssignOp:$f.definitionOperator,Ellipsis:$f.punctuation,At:$f.meta,"( )":$f.paren,"[ ]":$f.squareBracket,"{ }":$f.brace,".":$f.derefOperator,", ;":$f.separator}),Rx={__proto__:null,await:48,or:58,and:60,in:64,not:66,is:68,if:74,else:76,lambda:80,yield:98,from:100,async:106,for:108,None:168,True:170,False:170,del:184,pass:188,break:192,continue:196,return:200,raise:208,import:212,as:214,global:218,nonlocal:220,assert:224,type:229,elif:242,while:246,try:252,except:254,finally:256,with:260,def:264,class:274,match:285,case:291},qx=Gw.deserialize({version:14,states:"#&jO`Q#yOOP$bOSOOO%kQ&nO'#HcOOQS'#Cq'#CqOOQS'#Cr'#CrO'ZQ#xO'#CpO(|Q&nO'#HbOOQS'#Hc'#HcOOQS'#DW'#DWOOQS'#Hb'#HbO)jQ#xO'#DaO)}Q#xO'#DhO*_Q#xO'#DlOOQS'#Dw'#DwO*rO,UO'#DwO*zO7[O'#DwO+SOWO'#DxO+_O`O'#DxO+jOpO'#DxO+uO!bO'#DxO-wQ&nO'#HSOOQS'#HS'#HSO'ZQ#xO'#HRO/ZQ&nO'#HROOQS'#Ee'#EeO/rQ#xO'#EfOOQS'#HQ'#HQO/|Q#xO'#HPOOQV'#HP'#HPO0XQ#xO'#F]OOQS'#Ge'#GeO0^Q#xO'#F[OOQV'#IY'#IYOOQV'#HO'#HOOOQV'#Ft'#FtQ`Q#yOOO'ZQ#xO'#CsO0lQ#xO'#DPO0sQ#xO'#DTO1RQ#xO'#HgO1cQ&nO'#EYO'ZQ#xO'#EZOOQS'#E]'#E]OOQS'#E_'#E_OOQS'#Ea'#EaO1wQ#xO'#EcO2_Q#xO'#EgO0XQ#xO'#EiO2rQ&nO'#EiO0XQ#xO'#ElO/rQ#xO'#EoO0XQ#xO'#EqO/rQ#xO'#EwO/rQ#xO'#EzO2}Q#xO'#E|O3UQ#xO'#FRO3aQ#xO'#E}O/rQ#xO'#FRO0XQ#xO'#FTO0XQ#xO'#FYO3fQ#xO'#F_P3mO#xO'#G}POOO)CBq)CBqOOQS'#Cg'#CgOOQS'#Ch'#ChOOQS'#Ci'#CiOOQS'#Cj'#CjOOQS'#Ck'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%T%U%V%W%X%r%w%}&O&t'a'x)W)c)|+R+[,[-Z0Y1OR%b!pQ&W#cQ&Z#gQ&]#jQ&_#mR-`+lQ(}&WQ)P&ZQ)R&]Q)T&_Q+p)OQ+q)QQ+r)SQ+s)UQ.^-`R/V._Q$m!SQ&{$aQ*R'bR,`*SQ#zmQ$f!PQ$i!QR'T$hQ)h'SR+|)kQ)h'SQ+{)jR+|)kR$k!RR)u'YXqOs*W,dQ$s!WR'c$tQ$z!ZR'd$uR*k'pQ*i'pV-|,s-}.lQ.{.RQ/i.uR/j.vU.t.R.u.vQ/n.xQ/y/^Q0O/dU0Q/f0R0bQ0V/kQ0e0WQ0g0]U0i0^0k0sQ0t0mQ0x0rR0y0uR/m.wR/{/^",nodeNames:"⚠ print { { { { Comment Script AssignStatement * BinaryExpression BitOp BitOp BitOp BitOp ArithOp ArithOp @ ArithOp ** UnaryExpression ArithOp BitOp AwaitExpression await ) ( ParenthesizedExpression BinaryExpression or and CompareOp in not is UnaryExpression ConditionalExpression if else LambdaExpression lambda ParamList VariableName AssignOp , : NamedExpression AssignOp YieldExpression yield from TupleExpression ComprehensionExpression async for LambdaExpression ] [ ArrayExpression ArrayComprehensionExpression } { DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression CallExpression ArgList AssignOp MemberExpression . PropertyName Number String FormatString FormatReplacement FormatConversion FormatSpec FormatReplacement FormatReplacement FormatReplacement FormatReplacement ContinuedString Ellipsis None Boolean TypeDef AssignOp UpdateStatement UpdateOp ExpressionStatement DeleteStatement del PassStatement pass BreakStatement break ContinueStatement continue ReturnStatement return YieldStatement PrintStatement RaiseStatement raise ImportStatement import as ScopeStatement global nonlocal AssertStatement assert TypeDefinition type TypeParamList TypeParam StatementGroup ; IfStatement Body elif WhileStatement while ForStatement TryStatement try except finally WithStatement with FunctionDefinition def ParamList AssignOp TypeDef ClassDefinition class DecoratedStatement Decorator At MatchStatement match MatchBody MatchClause case CapturePattern LiteralPattern ArithOp ArithOp AsPattern OrPattern LogicOp AttributePattern SequencePattern MappingPattern StarPattern ClassPattern PatternArgList KeywordPattern KeywordPattern Guard",maxTerm:283,context:kx,nodeProps:[["group",-15,8,88,90,91,93,95,97,99,101,102,103,105,108,111,113,"Statement Statement",-22,10,20,23,27,42,51,52,58,59,62,63,64,65,66,69,72,73,74,82,83,84,85,"Expression",-10,117,119,122,124,125,129,131,136,138,141,"Statement",-9,146,147,150,151,153,154,155,156,157,"Pattern"],["openedBy",25,"(",56,"[",60,"{"],["closedBy",26,")",57,"]",61,"}"]],propSources:[Yx],skippedNodes:[0,6],repeatNodeCount:38,tokenData:"%-W#sR!`OX%TXY=|Y[%T[]=|]p%Tpq=|qr@_rsDOst!+|tu%Tuv!Nnvw#!|wx#$Wxy#:Uyz#;Yz{#<^{|#>x|}#@S}!O#AW!O!P#Ci!P!Q#N_!Q!R$!y!R![$&w![!]$1e!]!^$3s!^!_$4w!_!`$7c!`!a$8m!a!b%T!b!c$;U!c!d$W!e!h$W#V#Y$Q<%lO$Xc&r!b&jS&mW%p!TOX%TXY=|Y[%T[]=|]p%Tpq=|qr%Trs&Vsw%Twx/Xx#O%T#O#P?d#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T#s?i[&r!bOY%TYZ=|Z]%T]^=|^#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=P;=`<%l8^<%lO%T!q@hd&r!b&jS&mWOr%Trs&Vsw%Twx/Xx!_%T!_!`Av!`#O%T#O#P7o#P#T%T#T#UBz#U#f%T#f#gBz#g#hBz#h#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T!qBR]oR&r!b&jS&mWOr%Trs&Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<%lO%T!qCV]!nR&r!b&jS&mWOr%Trs&Vsw%Twx/Xx#O%T#O#P7o#P#o%T#o#p8^#p#q%T#q#r8^#r;'S%T;'S;=`=v<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Ag<%lO4`!]!E`P;=`<%l!Ag#o!EhW&mWOr4`rs4zs#O4`#O#P5y#P;'S4`;'S;=`6t;=`<%l!=U<%lO4`#o!FTP;=`<%l!=U#s!F_[U!T&r!bOY!+|YZ%TZ]!+|]^%T^#o!+|#o#p!GT#p#q!+|#q#r!GT#r;'S!+|;'S;=`!Mq;=`<%l8^<%lO!+|!a!G^]U!T&jS&mWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!H^]U!T&jSOY!GTYZ8^Z]!GT]^8^^r!GTrs!IVsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!I^]U!T&jSOY!GTYZ8^Z]!GT]^8^^r!GTrs!5wsw!GTwx!JVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!J^]U!T&mWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!KVx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!K^]U!T&mWOY!GTYZ8^Z]!GT]^8^^r!GTrs!HVsw!GTwx!Agx#O!GT#O#P!LV#P;'S!GT;'S;=`!Mk<%lO!GT!a!L[WU!TOY!GTYZ8^Z]!GT]^8^^;'S!GT;'S;=`!Lt;=`<%l8^<%lO!GT!a!L{Y&jS&mWOr8^rs9Qsw8^wx:dx#O8^#O#P;v#P;'S8^;'S;=`Q<%lO$TP;=`<%l$ei&r!b&jS&mW&g`&SsOr%Trs$@Ssw%Twx$C`x!Q%T!Q![$Q<%lO$Q<%lO$Q<%lO$Q<%lO$Q<%lO$Rx[e]||-1}],tokenPrec:7372}),Ax=new Nd,Wx=new Set(["Script","Body","FunctionDefinition","ClassDefinition","LambdaExpression","ForStatement","MatchClause"]);function Ex(e){return(t,n,i)=>{if(i)return!1;let r=t.node.getChild("VariableName");return r&&n(r,e),!0}}const jx={FunctionDefinition:Ex("function"),ClassDefinition:Ex("class"),ForStatement(e,t,n){if(n)for(let n=e.node.firstChild;n;n=n.nextSibling)if("VariableName"==n.name)t(n,"variable");else if("in"==n.name)break},ImportStatement(e,t){var n,i;let{node:r}=e,s="from"==(null===(n=r.firstChild)||void 0===n?void 0:n.name);for(let e=r.getChild("import");e;e=e.nextSibling)"VariableName"==e.name&&"as"!=(null===(i=e.nextSibling)||void 0===i?void 0:i.name)&&t(e,s?"variable":"namespace")},AssignStatement(e,t){for(let n=e.node.firstChild;n;n=n.nextSibling)if("VariableName"==n.name)t(n,"variable");else if(":"==n.name||"AssignOp"==n.name)break},ParamList(e,t){for(let n=null,i=e.node.firstChild;i;i=i.nextSibling)"VariableName"!=i.name||n&&/\*|AssignOp/.test(n.name)||t(i,"variable"),n=i},CapturePattern:Ex("variable"),AsPattern:Ex("variable"),__proto__:null};function zx(e,t){let n=Ax.get(t);if(n)return n;let i=[],r=!0;function s(t,n){let r=e.sliceString(t.from,t.to);i.push({label:r,type:n})}return t.cursor(_d.IncludeAnonymous).iterate((t=>{if(t.name){let e=jx[t.name];if(e&&e(t,s,r)||!r&&Wx.has(t.name))return!1;r=!1}else if(t.to-t.from>8192){for(let n of zx(e,t.node))i.push(n);return!1}})),Ax.set(t,i),i}const Dx=/^[\w\xa1-\uffff][\w\d\xa1-\uffff]*$/,Ux=["String","FormatString","Comment","PropertyName"];function Vx(e){let t=Xf(e.state).resolveInner(e.pos,-1);if(Ux.indexOf(t.name)>-1)return null;let n="VariableName"==t.name||t.to-t.from<20&&Dx.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let i=[];for(let n=t;n;n=n.parent)Wx.has(n.name)&&(i=i.concat(zx(e.state.doc,n)));return{options:i,from:n?t.from:e.pos,validFor:Dx}}const Ix=["__annotations__","__builtins__","__debug__","__doc__","__import__","__name__","__loader__","__package__","__spec__","False","None","True"].map((e=>({label:e,type:"constant"}))).concat(["ArithmeticError","AssertionError","AttributeError","BaseException","BlockingIOError","BrokenPipeError","BufferError","BytesWarning","ChildProcessError","ConnectionAbortedError","ConnectionError","ConnectionRefusedError","ConnectionResetError","DeprecationWarning","EOFError","Ellipsis","EncodingWarning","EnvironmentError","Exception","FileExistsError","FileNotFoundError","FloatingPointError","FutureWarning","GeneratorExit","IOError","ImportError","ImportWarning","IndentationError","IndexError","InterruptedError","IsADirectoryError","KeyError","KeyboardInterrupt","LookupError","MemoryError","ModuleNotFoundError","NameError","NotADirectoryError","NotImplemented","NotImplementedError","OSError","OverflowError","PendingDeprecationWarning","PermissionError","ProcessLookupError","RecursionError","ReferenceError","ResourceWarning","RuntimeError","RuntimeWarning","StopAsyncIteration","StopIteration","SyntaxError","SyntaxWarning","SystemError","SystemExit","TabError","TimeoutError","TypeError","UnboundLocalError","UnicodeDecodeError","UnicodeEncodeError","UnicodeError","UnicodeTranslateError","UnicodeWarning","UserWarning","ValueError","Warning","ZeroDivisionError"].map((e=>({label:e,type:"type"})))).concat(["bool","bytearray","bytes","classmethod","complex","float","frozenset","int","list","map","memoryview","object","range","set","staticmethod","str","super","tuple","type"].map((e=>({label:e,type:"class"})))).concat(["abs","aiter","all","anext","any","ascii","bin","breakpoint","callable","chr","compile","delattr","dict","dir","divmod","enumerate","eval","exec","exit","filter","format","getattr","globals","hasattr","hash","help","hex","id","input","isinstance","issubclass","iter","len","license","locals","max","min","next","oct","open","ord","pow","print","property","quit","repr","reversed","round","setattr","slice","sorted","sum","vars","zip"].map((e=>({label:e,type:"function"})))),Mx=[_b("def ${name}(${params}):\n\t${}",{label:"def",detail:"function",type:"keyword"}),_b("for ${name} in ${collection}:\n\t${}",{label:"for",detail:"loop",type:"keyword"}),_b("while ${}:\n\t${}",{label:"while",detail:"loop",type:"keyword"}),_b("try:\n\t${}\nexcept ${error}:\n\t${}",{label:"try",detail:"/ except block",type:"keyword"}),_b("if ${}:\n\t\n",{label:"if",detail:"block",type:"keyword"}),_b("if ${}:\n\t${}\nelse:\n\t${}",{label:"if",detail:"/ else block",type:"keyword"}),_b("class ${name}:\n\tdef __init__(self, ${params}):\n\t\t\t${}",{label:"class",detail:"definition",type:"keyword"}),_b("import ${module}",{label:"import",detail:"statement",type:"keyword"}),_b("from ${module} import ${names}",{label:"from",detail:"import",type:"keyword"})],Gx=Eg(Ux,Wg(Ix.concat(Mx)));function Bx(e,t){let n=e.baseIndentFor(t),i=e.lineAt(e.pos,-1),r=i.from+i.text.length;return/^\s*($|#)/.test(i.text)&&e.node.ton?null:n+e.unit}const Nx=Cf.define({name:"python",parser:qx.configure({props:[Lf.add({Body:e=>{var t;return null!==(t=Bx(e,e.node))&&void 0!==t?t:e.continue()},IfStatement:e=>/^\s*(else:|elif )/.test(e.textAfter)?e.baseIndent:e.continue(),TryStatement:e=>/^\s*(except |finally:|else:)/.test(e.textAfter)?e.baseIndent:e.continue(),"TupleExpression ComprehensionExpression ParamList ArgList ParenthesizedExpression":tO({closing:")"}),"DictionaryExpression DictionaryComprehensionExpression SetExpression SetComprehensionExpression":tO({closing:"}"}),"ArrayExpression ArrayComprehensionExpression":tO({closing:"]"}),"String FormatString":()=>null,Script:e=>{if(e.pos+/\s*/.exec(e.textAfter)[0].length>=e.node.to){let t=null;for(let n=e.node,i=n.to;n=n.lastChild,n&&n.to==i;)"Body"==n.type.name&&(t=n);if(t){let n=Bx(e,t);if(null!=n)return n}}return e.continue()}}),sO.add({"ArrayExpression DictionaryExpression SetExpression TupleExpression":oO,Body:(e,t)=>({from:e.from+1,to:e.to-(e.to==t.doc.length?0:1)})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"'''",'"""'],stringPrefixes:["f","fr","rf","r","u","b","br","rb","F","FR","RF","R","U","B","BR","RB"]},commentTokens:{line:"#"},indentOnInput:/^\s*([\}\]\)]|else:|elif |except |finally:)$/}});const Lx=[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],Fx=new Mw({start:!1,shift:(e,t)=>3==t||4==t||307==t?e:308==t,strict:!1}),Hx=new Xw(((e,t)=>{let{next:n}=e;(125==n||-1==n||t.context)&&e.acceptToken(305)}),{contextual:!0,fallback:!0}),Kx=new Xw(((e,t)=>{let n,{next:i}=e;Lx.indexOf(i)>-1||(47!=i||47!=(n=e.peek(1))&&42!=n)&&(125==i||59==i||-1==i||t.context||e.acceptToken(304))}),{contextual:!0}),Jx=new Xw(((e,t)=>{let{next:n}=e;if((43==n||45==n)&&(e.advance(),n==e.next)){e.advance();let n=!t.context&&t.canShift(1);e.acceptToken(n?1:2)}}),{contextual:!0}),ev=nf({"get set async static":$f.modifier,"for while do if else switch try catch finally return throw break continue default case":$f.controlKeyword,"in of await yield void typeof delete instanceof":$f.operatorKeyword,"let var const using function class extends":$f.definitionKeyword,"import export from":$f.moduleKeyword,"with debugger as 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),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":$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)}),tv={__proto__:null,export:16,as:21,from:29,default:32,async:37,function:38,extends:48,this:52,true:60,false:60,null:72,void:76,typeof:80,super:98,new:132,delete:148,yield:157,await:161,class:166,public:223,private:223,protected:223,readonly:225,instanceof:244,satisfies:247,in:248,const:250,import:282,keyof:337,unique:341,infer:347,is:383,abstract:403,implements:405,type:407,let:410,var:412,using:415,interface:421,enum:425,namespace:431,module:433,declare:437,global:441,for:460,of:469,while:472,with:476,do:480,if:484,else:486,switch:490,case:496,try:502,catch:506,finally:510,return:514,throw:518,break:522,continue:526,debugger:530},nv={__proto__:null,async:119,get:121,set:123,declare:183,public:185,private:185,protected:185,static:187,abstract:189,override:191,readonly:197,accessor:199,new:387},iv={__proto__:null,"<":139},rv=Gw.deserialize({version:14,states:"$6zO%TQUOOO%[QUOOO'_QWOOP(lOSOOO*zQ(CjO'#CgO+ROpO'#ChO+aO!bO'#ChO+oO07`O'#D[O.QQUO'#DbO.bQUO'#DmO%[QUO'#DwO0fQUO'#EPOOQ(CY'#EX'#EXO1PQSO'#EUOOQO'#Ej'#EjOOQO'#Id'#IdO1XQSO'#GlO1dQSO'#EiO1iQSO'#EiO3kQ(CjO'#JeO6[Q(CjO'#JfO6xQSO'#FXO6}Q#tO'#FpOOQ(CY'#Fa'#FaO7YO&jO'#FaO7hQ,UO'#FwO9OQSO'#FvOOQ(CY'#Jf'#JfOOQ(CW'#Je'#JeO9TQSO'#GpOOQQ'#KQ'#KQ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ashbang ExportDeclaration export Star as VariableName String Escape from ; default FunctionDeclaration async function VariableDefinition > TypeParamList 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 : NewExpression new TypeArgList CompareOp < ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies in const CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXStartTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast ArrowFunction TypeParamList SequenceExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate 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 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:367,context:Fx,nodeProps:[["group",-26,7,15,17,63,200,204,208,209,211,214,217,227,229,235,237,239,241,244,250,256,258,260,262,264,266,267,"Statement",-32,11,12,26,29,30,36,46,49,50,52,57,65,73,77,79,81,82,104,105,114,115,132,135,137,138,139,140,142,143,163,164,166,"Expression",-23,25,27,31,35,37,39,167,169,171,172,174,175,176,178,179,180,182,183,184,194,196,198,199,"Type",-3,85,97,103,"ClassItem"],["openedBy",32,"InterpolationStart",51,"[",55,"{",70,"(",144,"JSXStartTag",156,"JSXStartTag JSXStartCloseTag"],["closedBy",34,"InterpolationEnd",45,"]",56,"}",71,")",145,"JSXSelfCloseEndTag JSXEndTag",161,"JSXEndTag"]],propSources:[ev],skippedNodes:[0,3,4,270],repeatNodeCount:33,tokenData:"$Fl(CSR!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#8g!R![#:v![!]#Gv!]!^#IS!^!_#J^!_!`#Nu!`!a$#a!a!b$(n!b!c$,m!c!}Er!}#O$-w#O#P$/R#P#Q$4j#Q#R$5t#R#SEr#S#T$7R#T#o$8]#o#p$s#r#s$@P#s$f%Z$f$g+g$g#BYEr#BY#BZ$AZ#BZ$ISEr$IS$I_$AZ$I_$I|Er$I|$I}$Df$I}$JO$Df$JO$JTEr$JT$JU$AZ$JU$KVEr$KV$KW$AZ$KW&FUEr&FU&FV$AZ&FV;'SEr;'S;=`I|<%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!R#?i!R!S#?i!S!^%Z!^!_*g!_#O%Z#O#P&c#P#R%Z#R#S#?i#S#b%Z#b#c#tv[e]||-1},{term:330,get:e=>nv[e]||-1},{term:68,get:e=>iv[e]||-1}],tokenPrec:12827}),sv=[_b("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),_b("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),_b("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),_b("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),_b("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),_b("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),_b("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),_b("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),_b("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),_b('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),_b('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})],ov=sv.concat([_b("interface ${name} {\n\t${}\n}",{label:"interface",detail:"definition",type:"keyword"}),_b("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),_b("enum ${name} {\n\t${}\n}",{label:"enum",detail:"definition",type:"keyword"})]),av=new Nd,lv=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function cv(e){return(t,n)=>{let i=t.node.getChild("VariableDefinition");return i&&n(i,e),!0}}const hv=["FunctionDeclaration"],uv={FunctionDeclaration:cv("function"),ClassDeclaration:cv("class"),ClassExpression:()=>!0,EnumDeclaration:cv("constant"),TypeAliasDeclaration:cv("type"),NamespaceDeclaration:cv("namespace"),VariableDefinition(e,t){e.matchContext(hv)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function dv(e,t){let n=av.get(t);if(n)return n;let i=[],r=!0;function s(t,n){let r=e.sliceString(t.from,t.to);i.push({label:r,type:n})}return t.cursor(_d.IncludeAnonymous).iterate((t=>{if(r)r=!1;else if(t.name){let e=uv[t.name];if(e&&e(t,s)||lv.has(t.name))return!1}else if(t.to-t.from>8192){for(let n of dv(e,t.node))i.push(n);return!1}})),av.set(t,i),i}const fv=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,Ov=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function pv(e){let t=Xf(e.state).resolveInner(e.pos,-1);if(Ov.indexOf(t.name)>-1)return null;let n="VariableName"==t.name||t.to-t.from<20&&fv.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let i=[];for(let n=t;n;n=n.parent)lv.has(n.name)&&(i=i.concat(dv(e.state.doc,n)));return{options:i,from:n?t.from:e.pos,validFor:fv}}const mv=Cf.define({name:"javascript",parser:rv.configure({props:[Lf.add({IfStatement:iO({except:/^\s*({|else\b)/}),TryStatement:iO({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:e=>e.baseIndent,SwitchBody:e=>{let t=e.textAfter,n=/^\s*\}/.test(t),i=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:i?1:2)*e.unit},Block:tO({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":iO({except:/^{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag":e=>e.column(e.node.from)+e.unit}),sO.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":oO,BlockComment:e=>({from:e.from+2,to:e.to-2})})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}}),gv={test:e=>/^JSX/.test(e.name),facet:Pf({commentTokens:{block:{open:"{/*",close:"*/}"}}})},bv=mv.configure({dialect:"ts"},"typescript"),wv=mv.configure({dialect:"jsx",props:[Tf.add((e=>e.isTop?[gv]:void 0))]}),xv=mv.configure({dialect:"jsx ts",props:[Tf.add((e=>e.isTop?[gv]:void 0))]},"typescript");let vv=e=>({label:e,type:"keyword"});const yv="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(vv),Sv=yv.concat(["declare","implements","private","protected","public"].map(vv));function $v(e,t,n=e.length){for(let i=null==t?void 0:t.firstChild;i;i=i.nextSibling)if("JSXIdentifier"==i.name||"JSXBuiltin"==i.name||"JSXNamespacedName"==i.name||"JSXMemberExpression"==i.name)return e.sliceString(i.from,Math.min(i.to,n));return""}const Qv="object"==typeof navigator&&/Android\b/.test(navigator.userAgent),kv=Xh.inputHandler.of(((e,t,n,i,r)=>{if((Qv?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||">"!=i&&"/"!=i||!mv.isActiveAt(e.state,t,-1))return!1;let s=r(),{state:o}=s,a=o.changeByRange((e=>{var t;let n,{head:r}=e,s=Xf(o).resolveInner(r-1,-1);if("JSXStartTag"==s.name&&(s=s.parent),o.doc.sliceString(r-1,r)!=i||"JSXAttributeValue"==s.name&&s.to>r);else{if(">"==i&&"JSXFragmentTag"==s.name)return{range:e,changes:{from:r,insert:""}};if("/"==i&&"JSXStartCloseTag"==s.name){let e=s.parent,i=e.parent;if(i&&e.from==r-2&&((n=$v(o.doc,i.firstChild,r))||"JSXFragmentTag"==(null===(t=i.firstChild)||void 0===t?void 0:t.name))){let e=`${n}>`;return{range:Qs.cursor(r+e.length,-1),changes:{from:r,insert:e}}}}else if(">"==i){let t=function(e){for(;;){if("JSXOpenTag"==e.name||"JSXSelfClosingTag"==e.name||"JSXFragmentTag"==e.name)return e;if("JSXEscape"==e.name||!e.parent)return null;e=e.parent}}(s);if(t&&!/^\/?>|^<\//.test(o.doc.sliceString(r,r+2))&&(n=$v(o.doc,t,r)))return{range:e,changes:{from:r,insert:``}}}}return{range:e}}));return!a.changes.empty&&(e.dispatch([s,o.update(a,{userEvent:"input.complete",scrollIntoView:!0})]),!0)})),Pv="#56b6c2",Tv="#d3d8e0",_v="#7d8799",Zv="#d19a66",Cv="#2c313a",Xv="#353a42",Yv="#528bff",Rv=[Xh.theme({"&":{color:Tv},".cm-content":{caretColor:Yv},".cm-cursor, .cm-dropCursor":{borderLeftColor:Yv},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"#3E4451"},".cm-panels":{backgroundColor:"#21252b",color:Tv},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847",outline:"1px solid #515a6b"},".cm-gutters":{backgroundColor:"#282c34",color:_v,border:"none"},".cm-activeLineGutter":{backgroundColor:Cv},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:Xv},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Xv,borderBottomColor:Xv},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Cv,color:Tv}}},{dark:!0}),YO(_O.define([{tag:[$f.tagName],color:"#e06c75"},{tag:[$f.propertyName],color:Zv},{tag:[$f.separator,$f.character,$f.name,$f.operator,$f.operatorKeyword],color:Tv},{tag:[$f.url,$f.link],color:Pv},{tag:[$f.meta,$f.comment,$f.processingInstruction],color:_v},{tag:[$f.string],color:"#98c379"},{tag:$f.invalid,color:"#ffffff"},{tag:$f.keyword,color:"#c678dd"},{tag:[$f.url,$f.escape,$f.regexp,$f.link,$f.special($f.string)],color:Pv},{tag:[$f.function($f.variableName),$f.labelName],color:"#61afef"},{tag:[$f.color,$f.constant($f.name),$f.standard($f.name)],color:Zv},{tag:[$f.typeName,$f.className,$f.number,$f.changed,$f.annotation,$f.modifier,$f.self,$f.namespace],color:"#e5c07b"},{tag:[$f.atom,$f.bool,$f.special($f.variableName)],color:Zv}]))],qv="#abb2bf",Av="#778191",Wv="#323232",Ev="#a807ed",jv="#006eff",zv="#e63c5b",Dv="#ebebeb",Uv="#528bff",Vv="#e87307",Iv=[Xh.theme({"&":{color:Wv},".cm-content":{caretColor:Uv},".cm-cursor, .cm-dropCursor":{borderLeftColor:Uv},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"#c7dded"},".cm-panels":{color:Wv},".cm-panels.cm-panels-top":{borderBottom:"2px solid black"},".cm-panels.cm-panels-bottom":{borderTop:"2px solid black"},".cm-searchMatch":{backgroundColor:"#72a1ff59",outline:"1px solid #457dff"},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#6199ff2f"},".cm-activeLine":{backgroundColor:"#6699ff0b"},".cm-selectionMatch":{backgroundColor:"#aafe661a"},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bad0f847",outline:"1px solid #515a6b"},".cm-gutters":{backgroundColor:"#fff",color:Av,border:"none"},".cm-activeLineGutter":{backgroundColor:Dv},".cm-foldPlaceholder":{backgroundColor:"transparent",border:"none",color:"#ddd"},".cm-tooltip":{border:"none",backgroundColor:qv},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:qv,borderBottomColor:qv},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:Dv,color:qv}}},{dark:!1}),YO(_O.define([{tag:[$f.tagName],color:zv},{tag:[$f.propertyName],color:Vv},{tag:[$f.separator,$f.character,$f.name],color:Wv},{tag:[$f.url,$f.link],color:Ev},{tag:[$f.meta,$f.comment,$f.processingInstruction],color:Av},{tag:[$f.string],color:"#34a312"},{tag:$f.invalid,color:"#0000000"},{tag:$f.keyword,color:Ev},{tag:[$f.operator,$f.operatorKeyword,$f.url,$f.escape,$f.regexp,$f.link,$f.special($f.string)],color:"#226b53"},{tag:[$f.function($f.variableName),$f.labelName],color:jv},{tag:[$f.color,$f.constant($f.name),$f.standard($f.name)],color:jv},{tag:[$f.typeName,$f.className,$f.number,$f.changed,$f.annotation,$f.modifier,$f.self,$f.namespace],color:zv},{tag:[$f.atom,$f.bool,$f.special($f.variableName)],color:Vv}]))];var Mv;!function(e){const t=new Vs,n=new Vs;function i(e){switch(e){case"xml":return function(e={}){return new Uf(gx,gx.data.of({autocomplete:mx(e.elements||[],e.attributes||[])}))}();case"json":return new Uf(xx);case"js":return function(e={}){let t=e.jsx?e.typescript?xv:wv:e.typescript?bv:mv,n=e.typescript?ov.concat(Sv):sv.concat(yv);return new Uf(t,[mv.data.of({autocomplete:Eg(Ov,Wg(n))}),mv.data.of({autocomplete:pv}),e.jsx?kv:[]])}();case"py":return new Uf(Nx,[Nx.data.of({autocomplete:Vx}),Nx.data.of({autocomplete:Gx})])}}e.create=function(e,r,s){return new Xh({parent:e,state:go.create({extensions:[vw,zh.of([Xm]),n.of(i(s)),t.of(r?Rv:Iv),go.readOnly.of(!0)]})})},e.updateContent=function(e,t,r,s=!1){const o=[n.reconfigure(i(r))];s&&o.push(Xh.scrollIntoView(0)),e.update([e.state.update({changes:{from:0,to:e.state.doc.length,insert:t},effects:o})])},e.updateTheme=function(e,n){const i=n?Rv:Iv;e.dispatch({effects:t.reconfigure(i)})}}(Mv||(Mv={}));var Gv=Mv;function Bv(e){let t,n,i,r,s;return{c(){t=P("button"),n=P("img"),c(n.src,i="./assets/icons/code-slash-outline.svg")||X(n,"src","./assets/icons/code-slash-outline.svg"),X(n,"alt","code"),X(n,"class","svg h-5 w-5"),X(t,"title","Format XML"),X(t,"class","tint-on-hover"),t.disabled=e[2]},m(i,o){$(i,t,o),v(t,n),r||(s=C(t,"click",e[6]),r=!0)},p(e,n){4&n&&(t.disabled=e[2])},d(e){e&&Q(t),r=!1,s()}}}function Nv(e){let t,n,i;function r(t){e[10](t)}let s={text:"File content formatted!"};return void 0!==e[3]&&(s.visible=e[3]),t=new ur({props:s}),K.push((()=>Te(t,"visible",r))),{c(){_e(t.$$.fragment)},m(e,n){Ze(t,e,n),i=!0},p(e,i){const r={};!n&&8&i&&(n=!0,r.visible=e[3],oe((()=>n=!1))),t.$set(r)},i(e){i||(be(t.$$.fragment,e),i=!0)},o(e){we(t.$$.fragment,e),i=!1},d(e){Ce(t,e)}}}function Lv(e){let t,n,i;function r(t){e[11](t)}let s={text:"File content copied!"};return void 0!==e[4]&&(s.visible=e[4]),t=new ur({props:s}),K.push((()=>Te(t,"visible",r))),{c(){_e(t.$$.fragment)},m(e,n){Ze(t,e,n),i=!0},p(e,i){const r={};!n&&16&i&&(n=!0,r.visible=e[4],oe((()=>n=!1))),t.$set(r)},i(e){i||(be(t.$$.fragment,e),i=!0)},o(e){we(t.$$.fragment,e),i=!1},d(e){Ce(t,e)}}}function Fv(e){let t,n,i,r,s,o,a,l,c,h,u,d,f,O,p,m=e[0].displayName+"",g=e[5]&&Bv(e),b=e[3]&&Nv(e),w=e[4]&&Lv(e);return{c(){t=P("div"),n=P("p"),i=T(m),r=_(),s=P("div"),g&&g.c(),o=_(),a=P("button"),a.innerHTML='code',l=_(),c=P("div"),h=_(),b&&b.c(),u=_(),w&&w.c(),d=Z(),X(n,"class","text-xs text-subtle whitespace-nowrap text-ellipsis overflow-hidden"),X(a,"title","Copy to Clipboard"),X(a,"class","tint-on-hover"),X(s,"class","flex items-center gap-4"),X(t,"class","absolute top-0 left-0 right-0 h-8 flex items-center justify-between px-2"),X(c,"class","absolute top-8 bottom-0 left-0 right-0 overflow-auto")},m(m,x){$(m,t,x),v(t,n),v(n,i),v(t,r),v(t,s),g&&g.m(s,null),v(s,o),v(s,a),$(m,l,x),$(m,c,x),e[9](c),$(m,h,x),b&&b.m(m,x),$(m,u,x),w&&w.m(m,x),$(m,d,x),f=!0,O||(p=C(a,"click",e[7]),O=!0)},p(e,[t]){(!f||1&t)&&m!==(m=e[0].displayName+"")&&R(i,m),e[5]?g?g.p(e,t):(g=Bv(e),g.c(),g.m(s,o)):g&&(g.d(1),g=null),e[3]?b?(b.p(e,t),8&t&&be(b,1)):(b=Nv(e),b.c(),be(b,1),b.m(u.parentNode,u)):b&&(me(),we(b,1,1,(()=>{b=null})),ge()),e[4]?w?(w.p(e,t),16&t&&be(w,1)):(w=Lv(e),w.c(),be(w,1),w.m(d.parentNode,d)):w&&(me(),we(w,1,1,(()=>{w=null})),ge())},i(e){f||(be(b),be(w),f=!0)},o(e){we(b),we(w),f=!1},d(n){n&&Q(t),g&&g.d(),n&&Q(l),n&&Q(c),e[9](null),n&&Q(h),b&&b.d(n),n&&Q(u),w&&w.d(n),n&&Q(d),O=!1,p()}}}function Hv(e,t,n){let i;const{XmlDocumentNode:r}=window.S4TK.xml;let s,o,{info:a}=t,l=!1,c=!1,h=!1,u=!1;const d=[Ot.subscribe("isLightTheme",(e=>{s&&Gv.updateTheme(s,!e)}))];return N((()=>{n(8,s=Gv.create(o,!ft.isLightTheme,a.language))})),L((()=>{d.forEach((e=>e()))})),e.$$set=e=>{"info"in e&&n(0,a=e.info)},e.$$.update=()=>{1&e.$$.dirty&&n(5,i="xml"===a.language),257&e.$$.dirty&&s&&a&&(Gv.updateContent(s,a.textContent,a.language,!c),n(2,l=!1),c=!0)},[a,o,l,h,u,i,function(){try{if(l)return;const e=r.from(a.textContent).toXml({spacesPerIndent:ft.formatXmlSpaces});Gv.updateContent(s,e,a.language),n(2,l=!0),h||n(3,h=!0)}catch(e){console.error(e)}},function(){try{const e=s.state.doc.toString();navigator.clipboard.writeText(e),u||n(4,u=!0)}catch(e){console.error(e)}},s,function(e){K[e?"unshift":"push"]((()=>{o=e,n(1,o)}))},function(e){h=e,n(3,h)},function(e){u=e,n(4,u)}]}class Kv extends Ye{constructor(e){super(),Xe(this,e,Hv,Fv,a,{info:0})}}function Jv(t){let n,i;return n=new qr({}),{c(){_e(n.$$.fragment)},m(e,t){Ze(n,e,t),i=!0},p:e,i(e){i||(be(n.$$.fragment,e),i=!0)},o(e){we(n.$$.fragment,e),i=!1},d(e){Ce(n,e)}}}function ey(e){let t,n,i,r;const s=[oy,sy,ry,iy,ny,ty],o=[];function a(e,t){return e[0].renderType===at.PlainText?0:e[0].renderType===at.StringTable?1:e[0].renderType===at.Image?2:e[0].renderType===at.Corrupt?3:e[0].renderType===at.Deleted?4:5}return t=a(e),n=o[t]=s[t](e),{c(){n.c(),i=Z()},m(e,n){o[t].m(e,n),$(e,i,n),r=!0},p(e,r){let l=t;t=a(e),t===l?o[t].p(e,r):(me(),we(o[l],1,1,(()=>{o[l]=null})),ge(),n=o[t],n?n.p(e,r):(n=o[t]=s[t](e),n.c()),be(n,1),n.m(i.parentNode,i))},i(e){r||(be(n),r=!0)},o(e){we(n),r=!1},d(e){o[t].d(e),e&&Q(i)}}}function ty(e){let t,n;return t=new Br({props:{info:e[0],title:"Unsupported",description:"This file type is not supported by S4TK."}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.info=e[0]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function ny(e){let t,n;return t=new Br({props:{info:e[0],title:"Deleted Record",description:"Deleted records have no content."}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.info=e[0]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function iy(e){let t,n;return t=new Br({props:{info:e[0],title:"Corrupt",description:"This file appears to be corrupt."}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.info=e[0]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function ry(e){let t,n;return t=new jr({props:{info:e[0]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.info=e[0]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function sy(e){let t,n;return t=new Ir({props:{info:e[0]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.info=e[0]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function oy(e){let t,n;return t=new Kv({props:{info:e[0]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.info=e[0]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function ay(e){let t,n,i,r,s;const o=[ey,Jv],a=[];function l(e,n){return 1&n&&(t=null),null==t&&(t=!!Boolean(e[0])),t?0:1}return n=l(e,-1),i=a[n]=o[n](e),{c(){i.c(),r=Z()},m(e,t){a[n].m(e,t),$(e,r,t),s=!0},p(e,[t]){let s=n;n=l(e,t),n===s?a[n].p(e,t):(me(),we(a[s],1,1,(()=>{a[s]=null})),ge(),i=a[n],i?i.p(e,t):(i=a[n]=o[n](e),i.c()),be(i,1),i.m(r.parentNode,r))},i(e){s||(be(i),s=!0)},o(e){we(i),s=!1},d(e){a[n].d(e),e&&Q(r)}}}function ly(e,t,n){let i;const r=[ot.onViewedFileChange.subscribe((e=>{n(0,i=e)}))];return N((()=>{Rt.requestRefresh()})),L((()=>{r.forEach((e=>e()))})),[i]}class cy extends Ye{constructor(e){super(),Xe(this,e,ly,ay,a,{})}}function hy(t){let n,i,r,s,o;return{c(){n=P("button"),i=P("img"),c(i.src,r="./assets/icons/chevron-"+t[0]+".svg")||X(i,"src",r),X(i,"alt","clear"),X(i,"class","svg h-4 w-4"),X(n,"title",t[1])},m(e,r){$(e,n,r),v(n,i),s||(o=C(n,"click",t[2]),s=!0)},p(e,[t]){1&t&&!c(i.src,r="./assets/icons/chevron-"+e[0]+".svg")&&X(i,"src",r),2&t&&X(n,"title",e[1])},i:e,o:e,d(e){e&&Q(n),s=!1,o()}}}function uy(e,t,n){let i,r,{isCollapsed:s}=t;return e.$$set=e=>{"isCollapsed"in e&&n(3,s=e.isCollapsed)},e.$$.update=()=>{8&e.$$.dirty&&n(1,i=s?"Expand":"Collapse"),8&e.$$.dirty&&n(0,r=s?"up":"down")},[r,i,function(){n(3,s=!s)},s]}class dy extends Ye{constructor(e){super(),Xe(this,e,uy,hy,a,{isCollapsed:3})}}function fy(t){let n,i,r,s,a,l,c,h,u;return{c(){n=P("button"),i=P("p"),r=P("span"),s=T(t[0]),a=T("\n ("),l=T(t[1]),c=T(")"),X(r,"class","uppercase text-inherit"),X(i,"class","text-xs text-gray-400 dark:text-gray-400 svelte-1oz4oo2"),E(i,"active",t[2]),X(n,"class","px-1 pb-1 border-b border-solid border-b-transparent svelte-1oz4oo2"),E(n,"active",t[2])},m(e,d){$(e,n,d),v(n,i),v(i,r),v(r,s),v(i,a),v(i,l),v(i,c),h||(u=C(n,"click",(function(){o(t[3])&&t[3].apply(this,arguments)})),h=!0)},p(e,[r]){t=e,1&r&&R(s,t[0]),2&r&&R(l,t[1]),4&r&&E(i,"active",t[2]),4&r&&E(n,"active",t[2])},i:e,o:e,d(e){e&&Q(n),h=!1,u()}}}function Oy(e,t,n){let{title:i}=t,{countText:r}=t,{active:s}=t,{onClick:o}=t;return e.$$set=e=>{"title"in e&&n(0,i=e.title),"countText"in e&&n(1,r=e.countText),"active"in e&&n(2,s=e.active),"onClick"in e&&n(3,o=e.onClick)},[i,r,s,o]}class py extends Ye{constructor(e){super(),Xe(this,e,Oy,fy,a,{title:0,countText:1,active:2,onClick:3})}}function my(e){let t,n,i,r,s=e[0].code+"";return{c(){t=P("span"),n=T("["),i=T(s),r=T("]"),X(t,"class","text-subtle monospace")},m(e,s){$(e,t,s),v(t,n),v(t,i),v(t,r)},p(e,t){1&t&&s!==(s=e[0].code+"")&&R(i,s)},d(e){e&&Q(t)}}}function gy(e){let t,n,i,r,s,o,a,l,c,h,u,d,f,O,p=e[0].message+"";n=new Nt({props:{level:e[0].level,inline:!0}});let m=e[1]&&my(e);return{c(){t=P("button"),_e(n.$$.fragment),i=_(),r=P("p"),s=T(e[2]),a=_(),l=P("p"),m&&m.c(),c=_(),h=T(p),X(r,"class",o="mr-1 text-xs uppercase font-bold inline diagnostics-text "+e[3]),X(l,"class","text-sm inline"),X(t,"class",u="w-full px-2 pb-1 diagnostics-bg "+e[3]+" text-left"),X(t,"title",e[4])},m(o,u){$(o,t,u),Ze(n,t,null),v(t,i),v(t,r),v(r,s),v(t,a),v(t,l),m&&m.m(l,null),v(l,c),v(l,h),d=!0,f||(O=C(t,"click",e[5]),f=!0)},p(e,[i]){const a={};1&i&&(a.level=e[0].level),n.$set(a),(!d||4&i)&&R(s,e[2]),(!d||8&i&&o!==(o="mr-1 text-xs uppercase font-bold inline diagnostics-text "+e[3]))&&X(r,"class",o),e[1]?m?m.p(e,i):(m=my(e),m.c(),m.m(l,c)):m&&(m.d(1),m=null),(!d||1&i)&&p!==(p=e[0].message+"")&&R(h,p),(!d||8&i&&u!==(u="w-full px-2 pb-1 diagnostics-bg "+e[3]+" text-left"))&&X(t,"class",u),(!d||16&i)&&X(t,"title",e[4])},i(e){d||(be(n.$$.fragment,e),d=!0)},o(e){we(n.$$.fragment,e),d=!1},d(e){e&&Q(t),Ce(n),m&&m.d(),f=!1,O()}}}function by(e,t,n){let i,r,s,o,a;const{DiagnosticLevel:l}=window.S4TK.validation;let{info:c}=t,{showDiagnosticCode:h}=t;return e.$$set=e=>{"info"in e&&n(0,c=e.info),"showDiagnosticCode"in e&&n(1,h=e.showDiagnosticCode)},e.$$.update=()=>{1&e.$$.dirty&&n(7,i=Rt.getFile(c.ownerId)),128&e.$$.dirty&&n(6,r=i?`${i.resourceKey} = ${i.displayName}`:"Unknown File"),65&e.$$.dirty&&n(4,s=`[${c.code}] ${r}`),1&e.$$.dirty&&n(2,o=l[c.level]),4&e.$$.dirty&&n(3,a=o.toLowerCase())},[c,h,o,a,s,function(){Rt.requestFile(c.ownerId,!0)},r,i]}class wy extends Ye{constructor(e){super(),Xe(this,e,by,gy,a,{info:0,showDiagnosticCode:1})}}const{Boolean:xy}=ye;function vy(e,t,n){const i=e.slice();return i[17]=t[n],i}function yy(t){let n;return{c(){n=P("div"),n.innerHTML='

No issues found

',X(n,"class","px-2 overflow-auto")},m(e,t){$(e,n,t)},p:e,i:e,o:e,d(e){e&&Q(n)}}}function Sy(e){let t,n,i=e[2],r=[];for(let t=0;twe(r[e],1,1,(()=>{r[e]=null}));return{c(){t=P("div");for(let e=0;eTe(u,"isCollapsed",g)));const w=[Sy,yy],x=[];function y(e,t){return e[6]?0:1}return O=y(e),p=x[O]=w[O](e),{c(){t=P("div"),n=P("div"),i=P("div"),_e(r.$$.fragment),s=_(),_e(o.$$.fragment),a=_(),l=P("div"),_e(c.$$.fragment),h=_(),_e(u.$$.fragment),f=_(),p.c(),X(i,"class","flex gap-2 sm:gap-4"),X(l,"class","flex gap-2 sm:gap-4"),X(n,"class","p-2 w-full flex gap-2 items-center justify-between flex-wrap"),X(t,"class","w-full h-full flex flex-col bg-gray-50 dark:bg-gray-800")},m(e,d){$(e,t,d),v(t,n),v(n,i),Ze(r,i,null),v(i,s),Ze(o,i,null),v(n,a),v(n,l),Ze(c,l,null),v(l,h),Ze(u,l,null),v(t,f),x[O].m(t,null),m=!0},p(e,[n]){const i={};16&n&&(i.countText=e[4]),2&n&&(i.active=!e[1]),2&n&&(i.onClick=e[10]),r.$set(i);const s={};32&n&&(s.countText=e[5]),2&n&&(s.active=e[1]),2&n&&(s.onClick=e[11]),o.$set(s);const a={};4&n&&(a.diagnostics=e[2]),c.$set(a);const l={};!d&&1&n&&(d=!0,l.isCollapsed=e[0],oe((()=>d=!1))),u.$set(l);let h=O;O=y(e),O===h?x[O].p(e,n):(me(),we(x[h],1,1,(()=>{x[h]=null})),ge(),p=x[O],p?p.p(e,n):(p=x[O]=w[O](e),p.c()),be(p,1),p.m(t,null))},i(e){m||(be(r.$$.fragment,e),be(o.$$.fragment,e),be(c.$$.fragment,e),be(u.$$.fragment,e),be(p),m=!0)},o(e){we(r.$$.fragment,e),we(o.$$.fragment,e),we(c.$$.fragment,e),we(u.$$.fragment,e),we(p),m=!1},d(e){e&&Q(t),Ce(r),Ce(o),Ce(c),Ce(u),x[O].d()}}}function ky(e,t,n){let i,r,s,o,{bottomIsCollapsed:a}=t,l=0,c=[],h="",u=!1,d=[],f=[],O=ft.showDiagnosticCodesOnUi;const p=[ot.onExplorerSectionsChange.subscribe((e=>{c=e,n(7,l=c?.length?vt(...vt(...c.map((e=>e.cells))).map((e=>gt.allDiagnostics(e)))).length:0),m()})),ot.onViewedFileChange.subscribe((e=>{n(8,d=e?.diagnostics.filter((e=>bt.passesSettings(e)))??[])})),ot.onUserClickedFile.subscribe((()=>{n(1,u=!0)})),ot.onSearchTermChange.subscribe((e=>{h=e,m()})),ot.onPackageUnloaded.subscribe((()=>{n(9,f=[])})),Ot.subscribe("showDiagnosticCodesOnUi",(e=>{n(3,O=e)}))];function m(){c?.length?n(9,f=vt(...vt(...c.map((e=>e.cells))).filter((e=>gt.passesSearch(e,h))).map((e=>gt.allDiagnostics(e)))).sort(bt.sorter)):n(8,d=[])}L((()=>{p.forEach((e=>e()))}));return e.$$set=e=>{"bottomIsCollapsed"in e&&n(0,a=e.bottomIsCollapsed)},e.$$.update=()=>{770&e.$$.dirty&&n(2,i=u?d:f),4&e.$$.dirty&&n(6,r=Boolean(i?.length)),256&e.$$.dirty&&n(5,s=(d?.length??0).toString()),640&e.$$.dirty&&n(4,o=f.lengthn(1,u=!1),()=>n(1,u=!0),function(e){a=e,n(0,a)}]}class Py extends Ye{constructor(e){super(),Xe(this,e,ky,Qy,a,{bottomIsCollapsed:0})}}function Ty(t){let n,i;return n=new Sr({props:{slot:"secondary"}}),{c(){_e(n.$$.fragment)},m(e,t){Ze(n,e,t),i=!0},p:e,i(e){i||(be(n.$$.fragment,e),i=!0)},o(e){we(n.$$.fragment,e),i=!1},d(e){Ce(n,e)}}}function _y(t){let n,i;return n=new cy({props:{slot:"top"}}),{c(){_e(n.$$.fragment)},m(e,t){Ze(n,e,t),i=!0},p:e,i(e){i||(be(n.$$.fragment,e),i=!0)},o(e){we(n.$$.fragment,e),i=!1},d(e){Ce(n,e)}}}function Zy(e){let t,n,i;function r(t){e[4](t)}let s={slot:"bottom"};return void 0!==e[0]&&(s.bottomIsCollapsed=e[0]),t=new Py({props:s}),K.push((()=>Te(t,"bottomIsCollapsed",r))),{c(){_e(t.$$.fragment)},m(e,n){Ze(t,e,n),i=!0},p(e,i){const r={};!n&&1&i&&(n=!0,r.bottomIsCollapsed=e[0],oe((()=>n=!1))),t.$set(r)},i(e){i||(be(t.$$.fragment,e),i=!0)},o(e){we(t.$$.fragment,e),i=!1},d(e){Ce(t,e)}}}function Cy(e){let t,n,i;function r(t){e[5](t)}let s={slot:"primary",$$slots:{bottom:[Zy],top:[_y]},$$scope:{ctx:e}};return void 0!==e[0]&&(s.bottomIsCollapsed=e[0]),t=new li({props:s}),K.push((()=>Te(t,"bottomIsCollapsed",r))),{c(){_e(t.$$.fragment)},m(e,n){Ze(t,e,n),i=!0},p(e,i){const r={};129&i&&(r.$$scope={dirty:i,ctx:e}),!n&&1&i&&(n=!0,r.bottomIsCollapsed=e[0],oe((()=>n=!1))),t.$set(r)},i(e){i||(be(t.$$.fragment,e),i=!0)},o(e){we(t.$$.fragment,e),i=!1},d(e){Ce(t,e)}}}function Xy(e){let t,n,i,r,s;return document.title=t=e[1],r=new ti({props:{compactTitle:"File Explorer",onCompactChange:e[2],$$slots:{primary:[Cy],secondary:[Ty]},$$scope:{ctx:e}}}),{c(){n=_(),i=P("section"),_e(r.$$.fragment),X(i,"class","pt-10 h-screen w-screen")},m(e,t){$(e,n,t),$(e,i,t),Ze(r,i,null),s=!0},p(e,[n]){(!s||2&n)&&t!==(t=e[1])&&(document.title=t);const i={};129&n&&(i.$$scope={dirty:n,ctx:e}),r.$set(i)},i(e){s||(be(r.$$.fragment,e),s=!0)},o(e){we(r.$$.fragment,e),s=!1},d(e){e&&Q(n),e&&Q(i),Ce(r)}}}function Yy(e,t,n){let i,r,s=!1;const o=[ot.onPackageNameChange.subscribe((e=>{n(3,r=e)}))];return L((()=>{o.forEach((e=>e()))})),e.$$.update=()=>{8&e.$$.dirty&&n(1,i=r||"S4TK Package Viewer")},[s,i,function(){Rt.requestRefresh()},r,function(e){s=e,n(0,s)},function(e){s=e,n(0,s)}]}class Ry extends Ye{constructor(e){super(),Xe(this,e,Yy,Xy,a,{})}}let qy=0;const Ay=new Map;function Wy(e,t,n){const i=qy++;return Ay.set(i,(i=>{(!n?.ctrlOrMeta||i.ctrlKey||i.metaKey)&&(n?.shift&&!i.shiftKey||i.key===e&&(n?.preventDefault&&i.preventDefault(),t(i)))})),()=>Ay.delete(i)}document.addEventListener("keydown",(function(e){Ay.forEach((t=>{t(e)}))}));const Ey={onPreviewingPackageChange:new st,onPackagePreviewReadyChange:new st,onFileDataChange:new st,onGlobalSettingsChange:new st};function jy(t){let n,i,r,s,o,a;return{c(){n=P("button"),i=P("img"),X(i,"class","svg svelte-1ehlu20"),c(i.src,r="./assets/icons/"+t[0]+".svg")||X(i,"src",r),X(i,"alt",t[0]),E(i,"small",t[3]),X(n,"class","flex items-center svelte-1ehlu20"),X(n,"title",t[2]),X(n,"tabindex",s=t[1]?0:-1),E(n,"active",t[1]),E(n,"small",t[3]),E(n,"no-border",t[4]),E(n,"use-bg",t[5]),E(n,"danger-bg",t[6]),E(n,"round",t[7])},m(e,r){$(e,n,r),v(n,i),t[11](n),o||(a=C(n,"click",t[9]),o=!0)},p(e,[t]){1&t&&!c(i.src,r="./assets/icons/"+e[0]+".svg")&&X(i,"src",r),1&t&&X(i,"alt",e[0]),8&t&&E(i,"small",e[3]),4&t&&X(n,"title",e[2]),2&t&&s!==(s=e[1]?0:-1)&&X(n,"tabindex",s),2&t&&E(n,"active",e[1]),8&t&&E(n,"small",e[3]),16&t&&E(n,"no-border",e[4]),32&t&&E(n,"use-bg",e[5]),64&t&&E(n,"danger-bg",e[6]),128&t&&E(n,"round",e[7])},i:e,o:e,d(e){e&&Q(n),t[11](null),o=!1,a()}}}function zy(e,t,n){let i,{icon:r}=t,{onClick:s}=t,{active:o=!0}=t,{title:a}=t,{small:l=!1}=t,{noBorder:c=l}=t,{useBg:h=!1}=t,{danger:u=!1}=t,{round:d=!0}=t;return e.$$set=e=>{"icon"in e&&n(0,r=e.icon),"onClick"in e&&n(10,s=e.onClick),"active"in e&&n(1,o=e.active),"title"in e&&n(2,a=e.title),"small"in e&&n(3,l=e.small),"noBorder"in e&&n(4,c=e.noBorder),"useBg"in e&&n(5,h=e.useBg),"danger"in e&&n(6,u=e.danger),"round"in e&&n(7,d=e.round)},[r,o,a,l,c,h,u,d,i,function(){o&&(s(),setTimeout((()=>{i.blur()}),100))},s,function(e){K[e?"unshift":"push"]((()=>{i=e,n(8,i)}))}]}class Dy extends Ye{constructor(e){super(),Xe(this,e,zy,jy,a,{icon:0,onClick:10,active:1,title:2,small:3,noBorder:4,useBg:5,danger:6,round:7})}}function Uy(e){let t,n,i;return{c(){t=P("input"),X(t,"type","checkbox"),t.disabled=e[3],X(t,"class","svelte-6qqi0r")},m(r,s){$(r,t,s),t.checked=e[0],n||(i=C(t,"change",e[5]),n=!0)},p(e,n){8&n&&(t.disabled=e[3]),1&n&&(t.checked=e[0])},d(e){e&&Q(t),n=!1,i()}}}function Vy(e){let t,n,i;return{c(){t=P("input"),X(t,"type","checkbox"),t.disabled=e[3],X(t,"class","svelte-6qqi0r")},m(r,s){$(r,t,s),t.checked=e[1].checked,n||(i=C(t,"change",e[4]),n=!0)},p(e,n){8&n&&(t.disabled=e[3]),2&n&&(t.checked=e[1].checked)},d(e){e&&Q(t),n=!1,i()}}}function Iy(t){let n,i,r,s;function o(e,t){return e[1]?Vy:Uy}let a=o(t),l=a(t);return{c(){n=P("div"),i=P("label"),l.c(),r=_(),s=T(t[2]),X(i,"disabled",t[3]),X(i,"class","svelte-6qqi0r"),X(n,"class","checkbox svelte-6qqi0r")},m(e,t){$(e,n,t),v(n,i),l.m(i,null),v(i,r),v(i,s)},p(e,[t]){a===(a=o(e))&&l?l.p(e,t):(l.d(1),l=a(e),l&&(l.c(),l.m(i,r))),4&t&&R(s,e[2]),8&t&&X(i,"disabled",e[3])},i:e,o:e,d(e){e&&Q(n),l.d()}}}function My(e,t,n){let{label:i}=t,{disabled:r=!1}=t,{checked:s}=t,{checkable:o}=t;return e.$$set=e=>{"label"in e&&n(2,i=e.label),"disabled"in e&&n(3,r=e.disabled),"checked"in e&&n(0,s=e.checked),"checkable"in e&&n(1,o=e.checkable)},[s,o,i,r,function(){o.checked=this.checked,n(1,o)},function(){s=this.checked,n(0,s)}]}class Gy extends Ye{constructor(e){super(),Xe(this,e,My,Iy,a,{label:2,disabled:3,checked:0,checkable:1})}}function By(e,t,n){const i=e.slice();return i[8]=t[n],i[10]=n,i}function Ny(e){let t,n;return{c(){t=P("label"),n=T(e[1]),X(t,"class","text-subtle uppercase font-bold text-sm mb-2 svelte-17jj2pq"),X(t,"for",e[2]),E(t,"small",e[4])},m(e,i){$(e,t,i),v(t,n)},p(e,i){2&i&&R(n,e[1]),4&i&&X(t,"for",e[2]),16&i&&E(t,"small",e[4])},d(e){e&&Q(t)}}}function Ly(e,t){let n,i,r,s,o=t[8].text+"";return{key:e,first:null,c(){n=P("option"),i=T(o),r=_(),n.__value=s=t[8].value,n.value=n.__value,X(n,"class","svelte-17jj2pq"),this.first=n},m(e,t){$(e,n,t),v(n,i),v(n,r)},p(e,r){t=e,64&r&&o!==(o=t[8].text+"")&&R(i,o),64&r&&s!==(s=t[8].value)&&(n.__value=s,n.value=n.__value)},d(e){e&&Q(n)}}}function Fy(t){let n,i,r,s,o,a=Boolean(t[1]),l=[],c=new Map,h=a&&Ny(t),u=t[6];const d=e=>e[10];for(let e=0;et[7].call(r))),E(r,"w-full",t[3]),E(r,"small",t[4]),X(n,"class","select-with-label svelte-17jj2pq"),E(n,"w-full",t[3])},m(e,a){$(e,n,a),h&&h.m(n,null),v(n,i),v(n,r);for(let e=0;e{"label"in e&&n(1,i=e.label),"name"in e&&n(2,r=e.name),"selected"in e&&n(0,s=e.selected),"fillWidth"in e&&n(3,o=e.fillWidth),"small"in e&&n(4,a=e.small),"disabled"in e&&n(5,l=e.disabled),"options"in e&&n(6,c=e.options)},[s,i,r,o,a,l,c,function(){s=function(e){const t=e.querySelector(":checked")||e.options[0];return t&&t.__value}(this),n(0,s),n(6,c)}]}class Ky extends Ye{constructor(e){super(),Xe(this,e,Hy,Fy,a,{label:1,name:2,selected:0,fillWidth:3,small:4,disabled:5,options:6})}}function Jy(e){let t,n,i;return{c(){t=P("div"),n=P("label"),i=T(e[1]),X(n,"class","text-subtle uppercase font-bold text-sm mb-2 block"),X(n,"for",e[2]),X(t,"class","flex items-center")},m(e,r){$(e,t,r),v(t,n),v(n,i)},p(e,t){2&t&&R(i,e[1]),4&t&&X(n,"for",e[2])},d(e){e&&Q(t)}}}function eS(t){let n,i,r,s,o,a=Boolean(t[1]),l=a&&Jy(t);return{c(){n=P("div"),l&&l.c(),i=_(),r=P("input"),X(r,"id",t[2]),X(r,"name",t[2]),X(r,"type","text"),X(r,"class","h-8 px-2 block bg-gray-100 dark:bg-gray-800 rounded border border-solid border-gray-600 dark:border-gray-400 placeholder:text-gray-400 dark:placeholder:text-gray-500 svelte-1fm0ybo"),X(r,"placeholder",t[3]),X(r,"autocomplete","off"),E(r,"monospace",t[4]),E(r,"w-full",t[5]),E(r,"invalid",!t[6]),E(n,"flex-grow",t[5])},m(e,a){$(e,n,a),l&&l.m(n,null),v(n,i),v(n,r),t[9](r),q(r,t[0]),s||(o=C(r,"input",t[10]),s=!0)},p(e,[t]){2&t&&(a=Boolean(e[1])),a?l?l.p(e,t):(l=Jy(e),l.c(),l.m(n,i)):l&&(l.d(1),l=null),4&t&&X(r,"id",e[2]),4&t&&X(r,"name",e[2]),8&t&&X(r,"placeholder",e[3]),1&t&&r.value!==e[0]&&q(r,e[0]),16&t&&E(r,"monospace",e[4]),32&t&&E(r,"w-full",e[5]),64&t&&E(r,"invalid",!e[6]),32&t&&E(n,"flex-grow",e[5])},i:e,o:e,d(e){e&&Q(n),l&&l.d(),t[9](null),s=!1,o()}}}function tS(e,t,n){let i,{label:r}=t,{name:s}=t,{placeholder:o}=t,{monospace:a=!1}=t,{value:l=""}=t,{fillWidth:c=!1}=t,{focusOnMount:h=!1}=t,{isValid:u=!0}=t;return N((()=>{h&&i.focus()})),e.$$set=e=>{"label"in e&&n(1,r=e.label),"name"in e&&n(2,s=e.name),"placeholder"in e&&n(3,o=e.placeholder),"monospace"in e&&n(4,a=e.monospace),"value"in e&&n(0,l=e.value),"fillWidth"in e&&n(5,c=e.fillWidth),"focusOnMount"in e&&n(8,h=e.focusOnMount),"isValid"in e&&n(6,u=e.isValid)},[l,r,s,o,a,c,u,i,h,function(e){K[e?"unshift":"push"]((()=>{i=e,n(7,i)}))},function(){l=this.value,n(0,l)}]}class nS extends Ye{constructor(e){super(),Xe(this,e,tS,eS,a,{label:1,name:2,placeholder:3,monospace:4,value:0,fillWidth:5,focusOnMount:8,isValid:6})}}function iS(e){let t;return{c(){t=P("span"),t.textContent="• Key is invalid",X(t,"class","text-red-600 dark:text-red-400")},m(e,n){$(e,t,n)},d(e){e&&Q(t)}}}function rS(e){let t,n,i,r,s,o,a,l,c,h,u,d,f,O,p,m,g,b=!e[7]&&iS();function w(t){e[8](t)}function x(t){e[9](t)}let y={name:"manual-type-input-"+e[0].id,placeholder:"Type",monospace:!0};function S(t){e[10](t)}function k(t){e[11](t)}void 0!==e[1]&&(y.value=e[1]),void 0!==e[6]&&(y.isValid=e[6]),o=new nS({props:y}),K.push((()=>Te(o,"value",w))),K.push((()=>Te(o,"isValid",x)));let Z={name:"manual-group-input-"+e[0].id,placeholder:"Group",monospace:!0};function C(t){e[12](t)}function Y(t){e[13](t)}void 0!==e[2]&&(Z.value=e[2]),void 0!==e[5]&&(Z.isValid=e[5]),h=new nS({props:Z}),K.push((()=>Te(h,"value",S))),K.push((()=>Te(h,"isValid",k)));let R={name:"manual-inst-input-"+e[0].id,placeholder:"Instance",monospace:!0};return void 0!==e[3]&&(R.value=e[3]),void 0!==e[4]&&(R.isValid=e[4]),O=new nS({props:R}),K.push((()=>Te(O,"value",C))),K.push((()=>Te(O,"isValid",Y))),{c(){t=P("div"),n=P("p"),i=T("+ Manual Key\n "),b&&b.c(),r=_(),s=P("div"),_e(o.$$.fragment),c=_(),_e(h.$$.fragment),f=_(),_e(O.$$.fragment),X(n,"class","whitespace-nowrap text-sm font-bold text-subtle uppercase"),X(s,"class","flex flex-wrap justify-center items-end gap-4"),X(t,"class","flex justify-between items-center")},m(e,a){$(e,t,a),v(t,n),v(n,i),b&&b.m(n,null),v(t,r),v(t,s),Ze(o,s,null),v(s,c),Ze(h,s,null),v(s,f),Ze(O,s,null),g=!0},p(e,[t]){e[7]?b&&(b.d(1),b=null):b||(b=iS(),b.c(),b.m(n,null));const i={};1&t&&(i.name="manual-type-input-"+e[0].id),!a&&2&t&&(a=!0,i.value=e[1],oe((()=>a=!1))),!l&&64&t&&(l=!0,i.isValid=e[6],oe((()=>l=!1))),o.$set(i);const r={};1&t&&(r.name="manual-group-input-"+e[0].id),!u&&4&t&&(u=!0,r.value=e[2],oe((()=>u=!1))),!d&&32&t&&(d=!0,r.isValid=e[5],oe((()=>d=!1))),h.$set(r);const s={};1&t&&(s.name="manual-inst-input-"+e[0].id),!p&&8&t&&(p=!0,s.value=e[3],oe((()=>p=!1))),!m&&16&t&&(m=!0,s.isValid=e[4],oe((()=>m=!1))),O.$set(s)},i(e){g||(be(o.$$.fragment,e),be(h.$$.fragment,e),be(O.$$.fragment,e),g=!0)},o(e){we(o.$$.fragment,e),we(h.$$.fragment,e),we(O.$$.fragment,e),g=!1},d(e){e&&Q(t),b&&b.d(),Ce(o),Ce(h),Ce(O)}}}function sS(e,t){return new RegExp(`^[0-9A-Fa-f]{${t}}$`).test(e)}function oS(e,t,n){let i,r,s,o;const{formatAsHexString:a}=window.S4TK.formatting;let{entry:l}=t,c=a(l.manualKey.type,8,!1),h=a(l.manualKey.group,8,!1),u=a(l.manualKey.instance,16,!1);return e.$$set=e=>{"entry"in e&&n(0,l=e.entry)},e.$$.update=()=>{2&e.$$.dirty&&n(6,i=sS(c,8)),4&e.$$.dirty&&n(5,r=sS(h,8)),8&e.$$.dirty&&n(4,s=sS(u,16)),112&e.$$.dirty&&n(7,o=i&&r&&s)},[l,c,h,u,s,r,i,o,function(e){c=e,n(1,c)},function(e){i=e,n(6,i),n(1,c)},function(e){h=e,n(2,h)},function(e){r=e,n(5,r),n(2,h)},function(e){u=e,n(3,u)},function(e){s=e,n(4,s),n(3,u)}]}class aS extends Ye{constructor(e){super(),Xe(this,e,oS,rS,a,{entry:0})}}function lS(e){let t,n,i,r,s,o,a;return{c(){t=P("p"),n=T("+ "),i=T(e[2]),r=T(" SimData ("),s=P("span"),o=T(e[1]),a=T(")"),X(s,"class","monospace"),X(t,"class","text-subtle uppercase font-bold text-sm")},m(e,l){$(e,t,l),v(t,n),v(t,i),v(t,r),v(t,s),v(s,o),v(t,a)},p(e,t){4&t&&R(i,e[2]),2&t&&R(o,e[1])},d(e){e&&Q(t)}}}function cS(e){let t,n,i,r;return{c(){t=P("p"),n=T('Tuning type "'),i=T(e[2]),r=T('" does not have simdata'),X(t,"class","text-red-600 dark:text-red-400 text-subtle uppercase font-bold text-sm")},m(e,s){$(e,t,s),v(t,n),v(t,i),v(t,r)},p(e,t){4&t&&R(i,e[2])},d(e){e&&Q(t)}}}function hS(t){let n;function i(e,t){return e[0]?cS:lS}let r=i(t),s=r(t);return{c(){n=P("div"),s.c(),X(n,"class","flex items-center justify-between")},m(e,t){$(e,n,t),s.m(n,null)},p(e,[t]){r===(r=i(e))&&s?s.p(e,t):(s.d(1),s=r(e),s&&(s.c(),s.m(n,null)))},i:e,o:e,d(e){e&&Q(n),s.d()}}}function uS(e,t,n){let i,r,s;const{TuningResourceType:o,SimDataGroup:a}=window.S4TK.enums,{formatAsHexString:l}=window.S4TK.formatting;let{entry:c}=t;return e.$$set=e=>{"entry"in e&&n(3,c=e.entry)},e.$$.update=()=>{8&e.$$.dirty&&n(2,i=o[c.type]),8&e.$$.dirty&&n(1,r=l(a.getForTuning(c.type)??0,8,!1)),8&e.$$.dirty&&n(0,s=null==a.getForTuning(c.type))},[s,r,i,c]}class dS extends Ye{constructor(e){super(),Xe(this,e,uS,hS,a,{entry:3})}}function fS(e){let t,n,i,r,s,o;function a(t){e[3](t)}let l={options:e[1],small:!0,name:"custom-template-select-"+e[0].id};return void 0!==e[0].templateId&&(l.selected=e[0].templateId),r=new Ky({props:l}),K.push((()=>Te(r,"selected",a))),{c(){t=P("div"),n=P("p"),n.textContent="+ Custom Template",i=_(),_e(r.$$.fragment),X(n,"class","text-sm uppercase font-bold text-subtle whitespace-nowrap"),X(t,"class","flex items-center justify-between")},m(e,s){$(e,t,s),v(t,n),v(t,i),Ze(r,t,null),o=!0},p(e,[t]){const n={};2&t&&(n.options=e[1]),1&t&&(n.name="custom-template-select-"+e[0].id),!s&&1&t&&(s=!0,n.selected=e[0].templateId,oe((()=>s=!1))),r.$set(n)},i(e){o||(be(r.$$.fragment,e),o=!0)},o(e){we(r.$$.fragment,e),o=!1},d(e){e&&Q(t),Ce(r)}}}function OS(e,t,n){let i,{globalSettings:r}=t,{entry:s}=t;return e.$$set=e=>{"globalSettings"in e&&n(2,r=e.globalSettings),"entry"in e&&n(0,s=e.entry)},e.$$.update=()=>{4&e.$$.dirty&&n(1,i=r.templateData.templates.map((e=>({value:e.id,text:e.name}))))},[s,i,r,function(t){e.$$.not_equal(s.templateId,t)&&(s.templateId=t,n(0,s))}]}class pS extends Ye{constructor(e){super(),Xe(this,e,OS,fS,a,{globalSettings:2,entry:0})}}function mS(e){let t,n,i,r;function s(t){e[15](t)}let o={};return void 0!==e[1]&&(o.entry=e[1]),n=new aS({props:o}),K.push((()=>Te(n,"entry",s))),{c(){t=P("div"),_e(n.$$.fragment),X(t,"class","linked-entry bg-gray-200 dark:bg-gray-900 svelte-1ytoyos")},m(e,i){$(e,t,i),Ze(n,t,null),r=!0},p(e,t){const r={};!i&&2&t&&(i=!0,r.entry=e[1],oe((()=>i=!1))),n.$set(r)},i(e){r||(be(n.$$.fragment,e),r=!0)},o(e){we(n.$$.fragment,e),r=!1},d(e){e&&Q(t),Ce(n)}}}function gS(e){let t,n,i,r,s;function o(t){e[16](t)}function a(t){e[17](t)}let l={};return void 0!==e[0]&&(l.globalSettings=e[0]),void 0!==e[1]&&(l.entry=e[1]),n=new pS({props:l}),K.push((()=>Te(n,"globalSettings",o))),K.push((()=>Te(n,"entry",a))),{c(){t=P("div"),_e(n.$$.fragment),X(t,"class","linked-entry bg-gray-200 dark:bg-gray-900 svelte-1ytoyos")},m(e,i){$(e,t,i),Ze(n,t,null),s=!0},p(e,t){const s={};!i&&1&t&&(i=!0,s.globalSettings=e[0],oe((()=>i=!1))),!r&&2&t&&(r=!0,s.entry=e[1],oe((()=>r=!1))),n.$set(s)},i(e){s||(be(n.$$.fragment,e),s=!0)},o(e){we(n.$$.fragment,e),s=!1},d(e){e&&Q(t),Ce(n)}}}function bS(e){let t,n,i,r;function s(t){e[18](t)}let o={};return void 0!==e[1]&&(o.entry=e[1]),n=new dS({props:o}),K.push((()=>Te(n,"entry",s))),{c(){t=P("div"),_e(n.$$.fragment),X(t,"class","linked-entry bg-gray-200 dark:bg-gray-900 svelte-1ytoyos")},m(e,i){$(e,t,i),Ze(n,t,null),r=!0},p(e,t){const r={};!i&&2&t&&(i=!0,r.entry=e[1],oe((()=>i=!1))),n.$set(r)},i(e){r||(be(n.$$.fragment,e),r=!0)},o(e){we(n.$$.fragment,e),r=!1},d(e){e&&Q(t),Ce(n)}}}function wS(e){let t,n,i,r,s,o,a,l,c,h,u,d,f,O,p,m,g,b,w,x,y,S,k,T,Z,C,Y,R,q,A,W,j,z,D;function U(t){e[8](t)}let V={name:`gen-file-name-${e[1].id}`,placeholder:"File name (excluding prefix)",focusOnMount:!0,fillWidth:!0};function I(t){e[9](t)}void 0!==e[1].filename&&(V.value=e[1].filename),i=new nS({props:V}),K.push((()=>Te(i,"value",U)));let M={name:`gen-file-type-${e[1].id}`,options:e[4],disabled:e[2]};function G(t){e[10](t)}void 0!==e[1].type&&(M.selected=e[1].type),o=new Ky({props:M}),K.push((()=>Te(o,"selected",I)));let B={label:"32-bit",disabled:e[2]};function N(t){e[11](t)}void 0!==e[1].use32bit&&(B.checked=e[1].use32bit),h=new Gy({props:B}),K.push((()=>Te(h,"checked",G)));let L={label:"High bit",disabled:e[2]};function F(t){e[12](t)}void 0!==e[1].useHighBit&&(L.checked=e[1].useHighBit),f=new Gy({props:L}),K.push((()=>Te(f,"checked",N)));let H={label:"Manual key"};function J(t){e[13](t)}void 0!==e[2]&&(H.checked=e[2]),g=new Gy({props:H}),K.push((()=>Te(g,"checked",F)));let ee={label:"SimData"};function te(t){e[14](t)}void 0!==e[1].hasSimData&&(ee.checked=e[1].hasSimData),x=new Gy({props:ee}),K.push((()=>Te(x,"checked",J)));let ne={label:"Template"};void 0!==e[3]&&(ne.checked=e[3]),T=new Gy({props:ne}),K.push((()=>Te(T,"checked",te))),R=new Dy({props:{title:"Duplicate",icon:"duplicate",noBorder:!0,onClick:e[6],round:!1}}),A=new Dy({props:{title:"Delete",icon:"trash",noBorder:!0,onClick:e[5],danger:!0,round:!1}});let ie=e[1].manualKey&&mS(e),re=e[3]&&gS(e),se=e[1].hasSimData&&bS(e);return{c(){t=P("div"),n=P("div"),_e(i.$$.fragment),s=_(),_e(o.$$.fragment),l=_(),c=P("div"),_e(h.$$.fragment),d=_(),_e(f.$$.fragment),p=_(),m=P("div"),_e(g.$$.fragment),w=_(),_e(x.$$.fragment),S=_(),k=P("div"),_e(T.$$.fragment),C=_(),Y=P("div"),_e(R.$$.fragment),q=_(),_e(A.$$.fragment),W=_(),ie&&ie.c(),j=_(),re&&re.c(),z=_(),se&&se.c(),X(c,"class","flex flex-col gap-1"),X(m,"class","flex flex-col gap-1"),X(k,"class","flex flex-col gap-1"),X(Y,"class","flex gap-1"),X(n,"class","primary-entry bg-gray-200 dark:bg-gray-900 p-2 flex gap-4 items-center flex-wrap w-full svelte-1ytoyos"),E(n,"has-simdata",e[1].hasSimData),X(t,"class","w-full")},m(e,r){$(e,t,r),v(t,n),Ze(i,n,null),v(n,s),Ze(o,n,null),v(n,l),v(n,c),Ze(h,c,null),v(c,d),Ze(f,c,null),v(n,p),v(n,m),Ze(g,m,null),v(m,w),Ze(x,m,null),v(n,S),v(n,k),Ze(T,k,null),v(n,C),v(n,Y),Ze(R,Y,null),v(Y,q),Ze(A,Y,null),v(t,W),ie&&ie.m(t,null),v(t,j),re&&re.m(t,null),v(t,z),se&&se.m(t,null),D=!0},p(e,[s]){const l={};2&s&&(l.name=`gen-file-name-${e[1].id}`),!r&&2&s&&(r=!0,l.value=e[1].filename,oe((()=>r=!1))),i.$set(l);const c={};2&s&&(c.name=`gen-file-type-${e[1].id}`),4&s&&(c.disabled=e[2]),!a&&2&s&&(a=!0,c.selected=e[1].type,oe((()=>a=!1))),o.$set(c);const d={};4&s&&(d.disabled=e[2]),!u&&2&s&&(u=!0,d.checked=e[1].use32bit,oe((()=>u=!1))),h.$set(d);const p={};4&s&&(p.disabled=e[2]),!O&&2&s&&(O=!0,p.checked=e[1].useHighBit,oe((()=>O=!1))),f.$set(p);const m={};!b&&4&s&&(b=!0,m.checked=e[2],oe((()=>b=!1))),g.$set(m);const w={};!y&&2&s&&(y=!0,w.checked=e[1].hasSimData,oe((()=>y=!1))),x.$set(w);const v={};!Z&&8&s&&(Z=!0,v.checked=e[3],oe((()=>Z=!1))),T.$set(v),(!D||2&s)&&E(n,"has-simdata",e[1].hasSimData),e[1].manualKey?ie?(ie.p(e,s),2&s&&be(ie,1)):(ie=mS(e),ie.c(),be(ie,1),ie.m(t,j)):ie&&(me(),we(ie,1,1,(()=>{ie=null})),ge()),e[3]?re?(re.p(e,s),8&s&&be(re,1)):(re=gS(e),re.c(),be(re,1),re.m(t,z)):re&&(me(),we(re,1,1,(()=>{re=null})),ge()),e[1].hasSimData?se?(se.p(e,s),2&s&&be(se,1)):(se=bS(e),se.c(),be(se,1),se.m(t,null)):se&&(me(),we(se,1,1,(()=>{se=null})),ge())},i(e){D||(be(i.$$.fragment,e),be(o.$$.fragment,e),be(h.$$.fragment,e),be(f.$$.fragment,e),be(g.$$.fragment,e),be(x.$$.fragment,e),be(T.$$.fragment,e),be(R.$$.fragment,e),be(A.$$.fragment,e),be(ie),be(re),be(se),D=!0)},o(e){we(i.$$.fragment,e),we(o.$$.fragment,e),we(h.$$.fragment,e),we(f.$$.fragment,e),we(g.$$.fragment,e),we(x.$$.fragment,e),we(T.$$.fragment,e),we(R.$$.fragment,e),we(A.$$.fragment,e),we(ie),we(re),we(se),D=!1},d(e){e&&Q(t),Ce(i),Ce(o),Ce(h),Ce(f),Ce(g),Ce(x),Ce(T),Ce(R),Ce(A),ie&&ie.d(),re&&re.d(),se&&se.d()}}}function xS(e,t,n){const{fnv32:i,fnv64:r}=window.S4TK.hashing,{TuningResourceType:s}=window.S4TK.enums;let{globalSettings:o}=t,{fileData:a}=t,{entry:l}=t,c=null!=l.manualKey,h=0!==l.templateId;const u=[...s.all().map((e=>({value:e,text:s[e]})))];return e.$$set=e=>{"globalSettings"in e&&n(0,o=e.globalSettings),"fileData"in e&&n(7,a=e.fileData),"entry"in e&&n(1,l=e.entry)},e.$$.update=()=>{7&e.$$.dirty&&(c?n(1,l.manualKey={type:l.type,group:0,instance:BigInt((l.use32bit?i:r)(o.filenamePrefix+l.filename,l.useHighBit))},l):delete l.manualKey),8&e.$$.dirty&&(h||n(1,l.templateId=0,l))},[o,l,c,h,u,function(){const e=a.entries.findIndex((e=>e===l));e>=0&&(a.entries.splice(e,1),n(7,a))},function(){const e={};for(const t in l)e[t]=l[t];e.id=n(7,a.nextId++,a),e.filename="",delete e.manualKey,a.entries.push(e),n(7,a)},a,function(t){e.$$.not_equal(l.filename,t)&&(l.filename=t,n(1,l),n(2,c),n(0,o),n(3,h))},function(t){e.$$.not_equal(l.type,t)&&(l.type=t,n(1,l),n(2,c),n(0,o),n(3,h))},function(t){e.$$.not_equal(l.use32bit,t)&&(l.use32bit=t,n(1,l),n(2,c),n(0,o),n(3,h))},function(t){e.$$.not_equal(l.useHighBit,t)&&(l.useHighBit=t,n(1,l),n(2,c),n(0,o),n(3,h))},function(e){c=e,n(2,c)},function(t){e.$$.not_equal(l.hasSimData,t)&&(l.hasSimData=t,n(1,l),n(2,c),n(0,o),n(3,h))},function(e){h=e,n(3,h)},function(e){l=e,n(1,l),n(2,c),n(0,o),n(3,h)},function(e){o=e,n(0,o)},function(e){l=e,n(1,l),n(2,c),n(0,o),n(3,h)},function(e){l=e,n(1,l),n(2,c),n(0,o),n(3,h)}]}class vS extends Ye{constructor(e){super(),Xe(this,e,xS,wS,a,{globalSettings:0,fileData:7,entry:1})}}function yS(t){let n,i,r,s,a=(t[4]?t[1]:t[0])+"";return{c(){n=P("button"),i=T(a),X(n,"class","px-2 py-1 rounded flex items-center text-black dark:text-white hover:text-white dark:hover:text-black bg-gray-200 dark:bg-gray-800 hover:bg-accent-secondary-light dark:hover:bg-accent-secondary-dark border border-solid border-gray-600 dark:border-gray-400 svelte-1xpaq9i"),n.disabled=t[4],E(n,"w-full",t[3])},m(e,a){$(e,n,a),v(n,i),r||(s=C(n,"click",(function(){o(t[2])&&t[2].apply(this,arguments)})),r=!0)},p(e,[r]){t=e,19&r&&a!==(a=(t[4]?t[1]:t[0])+"")&&R(i,a),16&r&&(n.disabled=t[4]),8&r&&E(n,"w-full",t[3])},i:e,o:e,d(e){e&&Q(n),r=!1,s()}}}function SS(e,t,n){let{text:i}=t,{disabledText:r=i}=t,{onClick:s}=t,{fillWidth:o=!1}=t,{disabled:a=!1}=t;return e.$$set=e=>{"text"in e&&n(0,i=e.text),"disabledText"in e&&n(1,r=e.disabledText),"onClick"in e&&n(2,s=e.onClick),"fillWidth"in e&&n(3,o=e.fillWidth),"disabled"in e&&n(4,a=e.disabled)},[i,r,s,o,a]}class $S extends Ye{constructor(e){super(),Xe(this,e,SS,yS,a,{text:0,disabledText:1,onClick:2,fillWidth:3,disabled:4})}}function QS(e){let t,n,i,r,s;return{c(){t=P("button"),t.innerHTML='X',X(t,"class","svelte-1on8w4u")},m(n,a){$(n,t,a),i=!0,r||(s=C(t,"click",(function(){o(e[0])&&e[0].apply(this,arguments)})),r=!0)},p(t,[n]){e=t},i(e){i||(se((()=>{n||(n=ve(t,ar,{},!0)),n.run(1)})),i=!0)},o(e){n||(n=ve(t,ar,{},!1)),n.run(0),i=!1},d(e){e&&Q(t),e&&n&&n.end(),r=!1,s()}}}function kS(e,t,n){let{onClick:i}=t;return e.$$set=e=>{"onClick"in e&&n(0,i=e.onClick)},[i]}class PS extends Ye{constructor(e){super(),Xe(this,e,kS,QS,a,{onClick:0})}}function TS(e){let t,n;return t=new PS({props:{onClick:e[2]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};4&n&&(i.onClick=e[2]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function _S(e){let t,n,i,r,s,o;const a=e[5].default,l=h(a,e,e[4],null);let c=null!=e[2]&&TS(e);return{c(){t=P("div"),n=P("div"),i=P("div"),l&&l.c(),r=_(),c&&c.c(),X(n,"class","popup svelte-1piiy29"),E(n,"large",e[0]),E(n,"fill",e[1]),X(t,"class","overlay blurred-bg svelte-1piiy29")},m(s,a){$(s,t,a),v(t,n),v(n,i),l&&l.m(i,null),v(t,r),c&&c.m(t,null),e[6](t),o=!0},p(e,[i]){l&&l.p&&(!o||16&i)&&f(l,a,e,e[4],o?d(a,e[4],i,null):O(e[4]),null),(!o||1&i)&&E(n,"large",e[0]),(!o||2&i)&&E(n,"fill",e[1]),null!=e[2]?c?(c.p(e,i),4&i&&be(c,1)):(c=TS(e),c.c(),be(c,1),c.m(t,null)):c&&(me(),we(c,1,1,(()=>{c=null})),ge())},i(e){o||(be(l,e),be(c),se((()=>{s||(s=ve(t,ar,{},!0)),s.run(1)})),o=!0)},o(e){we(l,e),we(c),s||(s=ve(t,ar,{},!1)),s.run(0),o=!1},d(n){n&&Q(t),l&&l.d(n),c&&c.d(),e[6](null),n&&s&&s.end()}}}const ZS="overlay-active";function CS(e,t,n){let i,r,s,{$$slots:o={},$$scope:a}=t,{large:l=!1}=t,{fill:c=!0}=t,{onClose:h=(()=>{})}=t;const u=[Wy("Escape",h)];function d(){const e=i.querySelectorAll("a, button, input, textarea, select");r=e[0],s=e[e.length-1]}function f(){document.contains(r)||d(),r?.focus()}function O(e){i.contains(e.relatedTarget)||(s===e.target?f():r===e.target&&(document.contains(s)||d(),s?.focus()))}function p(e){i.contains(e.target)||f()}return N((()=>{document.body.classList.add(ZS),d(),window.addEventListener("focusin",p),window.addEventListener("focusout",O)})),L((()=>{document.body.classList.remove(ZS),window.removeEventListener("focusin",p),window.removeEventListener("focusout",O),u.forEach((e=>e()))})),e.$$set=e=>{"large"in e&&n(0,l=e.large),"fill"in e&&n(1,c=e.fill),"onClose"in e&&n(2,h=e.onClose),"$$scope"in e&&n(4,a=e.$$scope)},[l,c,h,i,a,o,function(e){K[e?"unshift":"push"]((()=>{i=e,n(3,i)}))}]}class XS extends Ye{constructor(e){super(),Xe(this,e,CS,_S,a,{large:0,fill:1,onClose:2})}}function YS(e){let t,n,i,r,o,a,l,c,h,u,d,f,O,p,m,g,b,w,x,y,S,k,T,Z;function Y(t){e[11](t)}let R={label:"template",name:"template-name-select",options:e[4]};function A(t){e[12](t)}void 0!==e[0]&&(R.selected=e[0]),r=new Ky({props:R}),K.push((()=>Te(r,"selected",Y)));let W={label:"content",name:"template-content-select",options:e[5]};function E(e,t){return e[2].locked?qS:RS}void 0!==e[1]&&(W.selected=e[1]),l=new Ky({props:W}),K.push((()=>Te(l,"selected",A))),d=new Dy({props:{icon:"trash",active:!e[2].locked,onClick:e[7],title:"Delete Template",danger:!0}}),O=new Dy({props:{icon:"pencil",active:!e[2].locked,onClick:e[8],title:"Edit Name"}}),m=new Dy({props:{icon:"plus",onClick:e[9],title:"New Template"}});let j=E(e),z=j(e);return{c(){t=P("div"),n=P("div"),i=P("div"),_e(r.$$.fragment),a=_(),_e(l.$$.fragment),h=_(),u=P("div"),_e(d.$$.fragment),f=_(),_e(O.$$.fragment),p=_(),_e(m.$$.fragment),g=_(),b=P("textarea"),y=_(),S=P("p"),z.c(),X(i,"class","flex gap-2"),X(u,"class","flex gap-2"),X(n,"class","flex justify-between items-center"),X(b,"class","monospace shadow-md bg-white dark:bg-gray-900 placeholder:text-gray-400 dark:placeholder:text-gray-500 svelte-1sw55l8"),b.disabled=w=e[2].locked,X(b,"placeholder",x=0===e[1]?"Enter tuning XML":"Enter SimData XML"),X(S,"class","text-subtle text-sm"),X(t,"class","flex flex-col gap-2")},m(s,o){$(s,t,o),v(t,n),v(n,i),Ze(r,i,null),v(i,a),Ze(l,i,null),v(n,h),v(n,u),Ze(d,u,null),v(u,f),Ze(O,u,null),v(u,p),Ze(m,u,null),v(t,g),v(t,b),q(b,e[3]),v(t,y),v(t,S),z.m(S,null),k=!0,T||(Z=[C(b,"input",e[13]),C(b,"blur",e[6])],T=!0)},p(e,t){const n={};16&t&&(n.options=e[4]),!o&&1&t&&(o=!0,n.selected=e[0],oe((()=>o=!1))),r.$set(n);const i={};!c&&2&t&&(c=!0,i.selected=e[1],oe((()=>c=!1))),l.$set(i);const s={};4&t&&(s.active=!e[2].locked),d.$set(s);const a={};4&t&&(a.active=!e[2].locked),O.$set(a),(!k||4&t&&w!==(w=e[2].locked))&&(b.disabled=w),(!k||2&t&&x!==(x=0===e[1]?"Enter tuning XML":"Enter SimData XML"))&&X(b,"placeholder",x),8&t&&q(b,e[3]),j===(j=E(e))&&z?z.p(e,t):(z.d(1),z=j(e),z&&(z.c(),z.m(S,null)))},i(e){k||(be(r.$$.fragment,e),be(l.$$.fragment,e),be(d.$$.fragment,e),be(O.$$.fragment,e),be(m.$$.fragment,e),k=!0)},o(e){we(r.$$.fragment,e),we(l.$$.fragment,e),we(d.$$.fragment,e),we(O.$$.fragment,e),we(m.$$.fragment,e),k=!1},d(e){e&&Q(t),Ce(r),Ce(l),Ce(d),Ce(O),Ce(m),z.d(),T=!1,s(Z)}}}function RS(e){let t,n;function i(e,t){return 0===e[1]?WS:AS}let r=i(e),s=r(e);return{c(){t=T("Paste in the XML content to use.\n "),s.c(),n=Z()},m(e,i){$(e,t,i),s.m(e,i),$(e,n,i)},p(e,t){r!==(r=i(e))&&(s.d(1),s=r(e),s&&(s.c(),s.m(n.parentNode,n)))},d(e){e&&Q(t),s.d(e),e&&Q(n)}}}function qS(t){let n;return{c(){n=T("This template is not editable.")},m(e,t){$(e,n,t)},p:e,d(e){e&&Q(n)}}}function AS(e){let t;return{c(){t=T("SimData structure must be valid, or the site might go boom boom.")},m(e,n){$(e,t,n)},d(e){e&&Q(t)}}}function WS(e){let t;return{c(){t=T("Tuning must have a root node, or the site might go boom boom.")},m(e,n){$(e,t,n)},d(e){e&&Q(t)}}}function ES(e){let t,n,i=null!=e[2]&&YS(e);return{c(){i&&i.c(),t=Z()},m(e,r){i&&i.m(e,r),$(e,t,r),n=!0},p(e,[n]){null!=e[2]?i?(i.p(e,n),4&n&&be(i,1)):(i=YS(e),i.c(),be(i,1),i.m(t.parentNode,t)):i&&(me(),we(i,1,1,(()=>{i=null})),ge())},i(e){n||(be(i),n=!0)},o(e){we(i),n=!1},d(e){i&&i.d(e),e&&Q(t)}}}function jS(e,t){try{return e()}catch(e){return t}}function zS(e,t,n){let i,r;const{XmlDocumentNode:s}=window.S4TK.xml;let{globalSettings:o}=t,a="",l=0,c=0;function h(e){return null!=e&&(e?o.templateData.templates.some((t=>t.name===e))?(alert(`Name "${e}" is already in use.`),!1):!(e.length>50)||(alert(`Name "${e}" is too long (must be <= 50 characters).`),!1):(alert("Name cannot be empty."),!1))}return e.$$set=e=>{"globalSettings"in e&&n(10,o=e.globalSettings)},e.$$.update=()=>{1024&e.$$.dirty&&n(4,i=o.templateData.templates.map((e=>({value:e.id,text:e.name})))),1025&e.$$.dirty&&n(2,r=o.templateData.templates.find((e=>e.id===l))),6&e.$$.dirty&&r&&function(){const e=0===c?r.tuning:r.simdata,t=jS((()=>s.from(e,{recycleNodes:!0}).toXml({writeXmlDeclaration:!1})),e);n(3,a=t)}()},[l,c,r,a,i,[{value:0,text:"Tuning"},{value:1,text:"SimData"}],function(){const e=jS((()=>s.from(a,{recycleNodes:!0}).toXml({minify:!0,writeXmlDeclaration:!1})),a);n(2,0===c?r.tuning=e:r.simdata=e,r)},function(){if(confirm(`Do you really want to delete the template "${r.name}"? This cannot be undone.`)){const e=o.templateData.templates.findIndex((e=>e.id===l));o.templateData.templates.splice(e,1),n(0,l=0),n(10,o)}},function(){const e=prompt(`Enter a new name for the "${r.name}" template. Names must be unique.`)?.trim();h(e)&&n(2,r.name=e,r),n(10,o)},function(){const e=prompt("Enter a name for your new template. Names must be unique.")?.trim();if(h(e)){const t=n(10,o.templateData.nextId++,o);o.templateData.templates.push({id:t,name:e,tuning:"",simdata:"",locked:!1}),n(10,o),n(0,l=t)}},o,function(e){l=e,n(0,l)},function(e){c=e,n(1,c)},function(){a=this.value,n(3,a)}]}class DS extends Ye{constructor(e){super(),Xe(this,e,zS,ES,a,{globalSettings:10})}}function US(e){let t,n;return t=new XS({props:{onClose:e[7],$$slots:{default:[VS]},$$scope:{ctx:e}}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};2&n&&(i.onClose=e[7]),257&n&&(i.$$scope={dirty:n,ctx:e}),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function VS(e){let t,n,i;function r(t){e[6](t)}let s={};return void 0!==e[0]&&(s.globalSettings=e[0]),t=new DS({props:s}),K.push((()=>Te(t,"globalSettings",r))),{c(){_e(t.$$.fragment)},m(e,n){Ze(t,e,n),i=!0},p(e,i){const r={};!n&&1&i&&(n=!0,r.globalSettings=e[0],oe((()=>n=!1))),t.$set(r)},i(e){i||(be(t.$$.fragment,e),i=!0)},o(e){we(t.$$.fragment,e),i=!1},d(e){Ce(t,e)}}}function IS(e){let t,n,i,r,s,o,a,l,c,h,u,d,f,O,p,m,g,b,w,x,y,S,k,T;function C(t){e[2](t)}r=new Wt({props:{title:"Legacy Tuning Generator"}});let Y={name:"filename-prefix-input",placeholder:"Prefix file names with...",fillWidth:!0};function R(t){e[3](t)}void 0!==e[0].filenamePrefix&&(Y.value=e[0].filenamePrefix),d=new nS({props:Y}),K.push((()=>Te(d,"value",C)));let q={label:"32-bit by default"};function A(t){e[4](t)}void 0!==e[0].all32bit&&(q.checked=e[0].all32bit),p=new Gy({props:q}),K.push((()=>Te(p,"checked",R)));let W={label:"High bit by default"};void 0!==e[0].allHighBit&&(W.checked=e[0].allHighBit),b=new Gy({props:W}),K.push((()=>Te(b,"checked",A))),y=new $S({props:{text:"Edit Templates",onClick:e[5]}});let E=e[1]&&US(e);return{c(){t=P("div"),n=P("div"),i=P("div"),_e(r.$$.fragment),s=_(),o=P("p"),o.innerHTML='This tool is for generating tuning/SimData files. It has now reached end of support, meaning I no longer maintain or\n provide support for it.\n This is an incomplete tool, and a more fleshed-out alternative should be available\n in the\n S4TK VS Code extension eventually.',a=_(),l=P("div"),c=P("p"),c.textContent="Global settings",h=_(),u=P("div"),_e(d.$$.fragment),O=_(),_e(p.$$.fragment),g=_(),_e(b.$$.fragment),x=_(),_e(y.$$.fragment),S=_(),E&&E.c(),k=Z(),X(c,"class","text-sm text-subtle uppercase font-bold mb-1"),X(u,"class","flex items-center gap-4 flex-wrap"),X(n,"class","w-full xl:max-w-screen-xl px-4 flex flex-col justify-center gap-4"),X(t,"class","bg-gray-100 dark:bg-gray-900 py-10 w-full flex justify-center")},m(e,f){$(e,t,f),v(t,n),v(n,i),Ze(r,i,null),v(n,s),v(n,o),v(n,a),v(n,l),v(l,c),v(l,h),v(l,u),Ze(d,u,null),v(u,O),Ze(p,u,null),v(u,g),Ze(b,u,null),v(u,x),Ze(y,u,null),$(e,S,f),E&&E.m(e,f),$(e,k,f),T=!0},p(e,[t]){const n={};!f&&1&t&&(f=!0,n.value=e[0].filenamePrefix,oe((()=>f=!1))),d.$set(n);const i={};!m&&1&t&&(m=!0,i.checked=e[0].all32bit,oe((()=>m=!1))),p.$set(i);const r={};!w&&1&t&&(w=!0,r.checked=e[0].allHighBit,oe((()=>w=!1))),b.$set(r);const s={};2&t&&(s.onClick=e[5]),y.$set(s),e[1]?E?(E.p(e,t),2&t&&be(E,1)):(E=US(e),E.c(),be(E,1),E.m(k.parentNode,k)):E&&(me(),we(E,1,1,(()=>{E=null})),ge())},i(e){T||(be(r.$$.fragment,e),be(d.$$.fragment,e),be(p.$$.fragment,e),be(b.$$.fragment,e),be(y.$$.fragment,e),be(E),T=!0)},o(e){we(r.$$.fragment,e),we(d.$$.fragment,e),we(p.$$.fragment,e),we(b.$$.fragment,e),we(y.$$.fragment,e),we(E),T=!1},d(e){e&&Q(t),Ce(r),Ce(d),Ce(p),Ce(b),Ce(y),e&&Q(S),E&&E.d(e),e&&Q(k)}}}function MS(e,t,n){let{globalSettings:i}=t,r=!1;return e.$$set=e=>{"globalSettings"in e&&n(0,i=e.globalSettings)},[i,r,function(t){e.$$.not_equal(i.filenamePrefix,t)&&(i.filenamePrefix=t,n(0,i))},function(t){e.$$.not_equal(i.all32bit,t)&&(i.all32bit=t,n(0,i))},function(t){e.$$.not_equal(i.allHighBit,t)&&(i.allHighBit=t,n(0,i))},()=>n(1,r=!0),function(e){i=e,n(0,i)},()=>n(1,r=!1)]}class GS extends Ye{constructor(e){super(),Xe(this,e,MS,IS,a,{globalSettings:0})}}function BS(t){let n,i;return{c(){n=P("img"),c(n.src,i="./assets/icons/"+t[0]+".svg")||X(n,"src",i),X(n,"alt",t[1]),X(n,"class","svg svelte-4un9ln")},m(e,t){$(e,n,t)},p(e,[t]){1&t&&!c(n.src,i="./assets/icons/"+e[0]+".svg")&&X(n,"src",i),2&t&&X(n,"alt",e[1])},i:e,o:e,d(e){e&&Q(n)}}}function NS(e,t,n){let{src:i}=t,{alt:r=i}=t;return e.$$set=e=>{"src"in e&&n(0,i=e.src),"alt"in e&&n(1,r=e.alt)},[i,r]}class LS extends Ye{constructor(e){super(),Xe(this,e,NS,BS,a,{src:0,alt:1})}}function FS(t){let n,i,r,s,o,a,l,c,h,u,d,f,O,p,m,g,b,w,x,y,S,k,Z,C,Y,R,q,A,W,E,j,z;return a=new LS({props:{src:"plus"}}),m=new LS({props:{src:"duplicate"}}),Y=new LS({props:{src:"hammer"}}),{c(){n=P("div"),i=P("h2"),i.textContent="This package is empty",r=_(),s=P("p"),o=T("Add an entry with the "),_e(a.$$.fragment),l=T(" button or\n "),c=P("mark"),c.textContent="ctrl/cmd",h=T("\n +\n "),u=P("mark"),u.textContent="n",d=T("."),f=_(),O=P("p"),p=T("Clone the last entry with the "),_e(m.$$.fragment),g=T(" button or\n "),b=P("mark"),b.textContent="ctrl/cmd",w=T("\n +\n "),x=P("mark"),x.textContent="m",y=T("."),S=_(),k=P("p"),Z=T("Build the package with the "),C=P("span"),_e(Y.$$.fragment),R=T("Build"),q=T("\n button or "),A=P("mark"),A.textContent="ctrl/cmd",W=T("\n +\n "),E=P("mark"),E.textContent="b",j=T("."),X(i,"class","text-center text-lg font-bold"),X(c,"class","key svelte-uav024"),X(u,"class","key svelte-uav024"),X(s,"class","text-subtle text-center"),X(b,"class","key svelte-uav024"),X(x,"class","key svelte-uav024"),X(O,"class","text-subtle text-center"),X(C,"class","monospace text-sm"),X(A,"class","key svelte-uav024"),X(E,"class","key svelte-uav024"),X(k,"class","text-subtle text-center"),X(n,"class","flex flex-col items-center gap-4")},m(e,t){$(e,n,t),v(n,i),v(n,r),v(n,s),v(s,o),Ze(a,s,null),v(s,l),v(s,c),v(s,h),v(s,u),v(s,d),v(n,f),v(n,O),v(O,p),Ze(m,O,null),v(O,g),v(O,b),v(O,w),v(O,x),v(O,y),v(n,S),v(n,k),v(k,Z),v(k,C),Ze(Y,C,null),v(C,R),v(k,q),v(k,A),v(k,W),v(k,E),v(k,j),z=!0},p:e,i(e){z||(be(a.$$.fragment,e),be(m.$$.fragment,e),be(Y.$$.fragment,e),z=!0)},o(e){we(a.$$.fragment,e),we(m.$$.fragment,e),we(Y.$$.fragment,e),z=!1},d(e){e&&Q(n),Ce(a),Ce(m),Ce(Y)}}}class HS extends Ye{constructor(e){super(),Xe(this,e,null,FS,a,{})}}function KS(e,t,n){const i=e.slice();return i[12]=t[n],i[13]=t,i[14]=n,i}function JS(t){let n,i;return n=new HS({}),{c(){_e(n.$$.fragment)},m(e,t){Ze(n,e,t),i=!0},p:e,i(e){i||(be(n.$$.fragment,e),i=!0)},o(e){we(n.$$.fragment,e),i=!1},d(e){Ce(n,e)}}}function e$(e){let t,n,i=[],r=new Map,s=e[1].entries;const o=e=>e[12].id;for(let t=0;tTe(i,"fileData",l))),K.push((()=>Te(i,"globalSettings",c))),K.push((()=>Te(i,"entry",h))),{key:e,first:null,c(){n=Z(),_e(i.$$.fragment),this.first=n},m(e,t){$(e,n,t),Ze(i,e,t),a=!0},p(e,n){t=e;const a={};!r&&2&n&&(r=!0,a.fileData=t[1],oe((()=>r=!1))),!s&&1&n&&(s=!0,a.globalSettings=t[0],oe((()=>s=!1))),!o&&2&n&&(o=!0,a.entry=t[12],oe((()=>o=!1))),i.$set(a)},i(e){a||(be(i.$$.fragment,e),a=!0)},o(e){we(i.$$.fragment,e),a=!1},d(e){e&&Q(n),Ce(i,e)}}}function n$(e){let t,n,i,r,s,o,a,l,c,h,u,d,f,O,p;function m(t){e[5](t)}let g={};void 0!==e[0]&&(g.globalSettings=e[0]),n=new GS({props:g}),K.push((()=>Te(n,"globalSettings",m)));const b=[e$,JS],w=[];function x(e,t){return e[1]?.entries.length>0?0:1}return o=x(e),a=w[o]=b[o](e),h=new Dy({props:{icon:"trash",title:"Delete All",onClick:e[4],danger:!0,useBg:!0,active:e[1].entries.length>0}}),d=new Dy({props:{icon:"duplicate",title:"Duplicate Last",onClick:e[3],useBg:!0,active:e[1].entries.length>0}}),O=new Dy({props:{icon:"plus",title:"New Resource",onClick:e[2],useBg:!0}}),{c(){t=P("div"),_e(n.$$.fragment),r=_(),s=P("div"),a.c(),l=_(),c=P("div"),_e(h.$$.fragment),u=_(),_e(d.$$.fragment),f=_(),_e(O.$$.fragment),X(s,"class","py-10 w-full xl:max-w-screen-xl px-4 flex flex-col justify-center gap-8"),X(t,"class","flex flex-col w-full items-center"),X(c,"class","fixed bottom-4 right-4 flex gap-2")},m(e,i){$(e,t,i),Ze(n,t,null),v(t,r),v(t,s),w[o].m(s,null),$(e,l,i),$(e,c,i),Ze(h,c,null),v(c,u),Ze(d,c,null),v(c,f),Ze(O,c,null),p=!0},p(e,[t]){const r={};!i&&1&t&&(i=!0,r.globalSettings=e[0],oe((()=>i=!1))),n.$set(r);let l=o;o=x(e),o===l?w[o].p(e,t):(me(),we(w[l],1,1,(()=>{w[l]=null})),ge(),a=w[o],a?a.p(e,t):(a=w[o]=b[o](e),a.c()),be(a,1),a.m(s,null));const c={};2&t&&(c.active=e[1].entries.length>0),h.$set(c);const u={};2&t&&(u.active=e[1].entries.length>0),d.$set(u)},i(e){p||(be(n.$$.fragment,e),be(a),be(h.$$.fragment,e),be(d.$$.fragment,e),be(O.$$.fragment,e),p=!0)},o(e){we(n.$$.fragment,e),we(a),we(h.$$.fragment,e),we(d.$$.fragment,e),we(O.$$.fragment,e),p=!1},d(e){e&&Q(t),Ce(n),w[o].d(),e&&Q(l),e&&Q(c),Ce(h),Ce(d),Ce(O)}}}function i$(e,t,n){const{enums:i}=window.S4TK;let{globalSettings:r}=t,{fileData:s}=t;const o=i.TuningResourceType.all()[0],a=[Wy("n",l,{ctrlOrMeta:!0,preventDefault:!0}),Wy("m",c,{ctrlOrMeta:!0,preventDefault:!0})];function l(){s.entries.push({id:n(1,s.nextId++,s),filename:"",hasSimData:!1,type:o,use32bit:r.all32bit,useHighBit:r.allHighBit,templateId:0}),n(1,s)}function c(){if(0===s.entries.length)return;const e={},t=s.entries[s.entries.length-1];for(const n in t)e[n]=t[n];e.id=n(1,s.nextId++,s),e.filename="",delete e.manualKey,s.entries.push(e),n(1,s)}return L((()=>{a.forEach((e=>e()))})),e.$$set=e=>{"globalSettings"in e&&n(0,r=e.globalSettings),"fileData"in e&&n(1,s=e.fileData)},[r,s,l,c,function(){confirm("This will delete all of the entries you've made for this package. This cannot be undone. Are you sure you want to continue?")&&(s.entries.splice(0,s.entries.length),n(1,s))},function(e){r=e,n(0,r)},function(e){s=e,n(1,s)},function(e){r=e,n(0,r)},function(e,t,i,r){i[r]=e,n(1,s)}]}class r$ extends Ye{constructor(e){super(),Xe(this,e,i$,n$,a,{globalSettings:0,fileData:1})}}var s$,o$={nextId:1,templates:[{id:0,name:"Default",tuning:'placeholder_value',simdata:'placeholder_value',locked:!0}]};!function(e){let t;async function n(){return new Promise(((e,n)=>{const i=indexedDB.open("PackageGeneratorDB",1);i.onerror=()=>{alert("Your browser does not support indexed databases, which means your work in the package generator will not be saved. Make sure you do not navigate away from this page, or you will lose your progress.")};const r=async e=>{t=e.target.result,t.onerror=e=>{console.error(`Database error: ${e.target.errorCode}`)}};i.onsuccess=t=>{r(t).then((()=>{e()}))},i.onupgradeneeded=e=>{r(e).then((()=>{t.createObjectStore("data",{autoIncrement:!0})}))}}))}e.fetchData=async function(){return new Promise((async(e,i)=>{t||await n();const r=t.transaction("data","readonly").objectStore("data").get(0);r.onerror=()=>{i("Could not fetch data.")},r.onsuccess=()=>{e(r.result)}}))},e.saveData=async function(e){t||await n(),t.transaction("data","readwrite").objectStore("data").put(e,0)}}(s$||(s$={}));var a$=s$;const{models:l$,hashing:c$,enums:h$}=window.S4TK;const u$=new class{constructor(){this._initialized=!1,this._isPreviewingPackage=!1,this._isPackagePreviewReady=!1}async initializeFromStorage(){try{if(this._initialized)return;const e=await a$.fetchData();e?(this._fileData=e.fileData,this._globalSettings=e.globalSettings):this._createDefaultData(),this._initialized=!0}catch(e){console.error(e),this._createDefaultData()}finally{Ey.onFileDataChange.notify(this._fileData),Ey.onGlobalSettingsChange.notify(this._globalSettings)}}async saveToStorage(){try{await a$.saveData({fileData:this._fileData,globalSettings:this._globalSettings})}catch(e){console.error(e)}}async requestPreviewer(){if(this._fileData&&this._globalSettings)try{this._isPreviewingPackage=!0,Ey.onPreviewingPackageChange.notify(!0),this._isPackagePreviewReady=!1,Ey.onPackagePreviewReadyChange.notify(!1);const e=this._buildPackage();if(!e)return alert("Could not build package. There is most likely a syntax error in one of your templates. Check the console for the full call stack."),void(this._isPreviewingPackage=!1);Rt.loadPackage(e.getBuffer(),"Generated.package")&&(this._isPackagePreviewReady=!0)}catch(e){this._isPreviewingPackage=!1}finally{Ey.onPreviewingPackageChange.notify(this._isPreviewingPackage),Ey.onPackagePreviewReadyChange.notify(this._isPackagePreviewReady)}}async requestBuilder(){this._fileData&&this._globalSettings&&(this._isPreviewingPackage=!1,this._isPackagePreviewReady=!1,Ey.onPreviewingPackageChange.notify(!1),Ey.onPackagePreviewReadyChange.notify(!1))}_buildPackage(){try{const e=new l$.Package;return this._fileData.entries.forEach((t=>{const n=this._globalSettings.templateData.templates.find((e=>e.id===t.templateId)),i=this._globalSettings.filenamePrefix+t.filename,r=this._getKey(t,"tuning"),s=new l$.XmlResource(n.tuning);if(s.updateRoot((e=>{e.name=i,e.id=r.instance.toString()})),e.add(r,s),t.hasSimData){const r=l$.SimDataResource.fromXml(n.simdata);r.instance.name=i,e.add(this._getKey(t,"simdata"),r)}})),e}catch(e){console.error("Could not generate package:",e)}}_getKey(e,t){const n=e.manualKey?.type??e.type,i=e.manualKey?.instance??BigInt((e.use32bit?c$.fnv32:c$.fnv64)(this._globalSettings.filenamePrefix+e.filename,e.useHighBit));return"tuning"===t?e.manualKey??{type:n,group:0,instance:i}:{type:h$.BinaryResourceType.SimData,group:h$.SimDataGroup.getForTuning(n),instance:i}}_createDefaultData(){this._fileData={nextId:0,entries:[]},this._globalSettings={filenamePrefix:"",all32bit:!1,allHighBit:!1,templateData:o$}}};function d$(t){let n,i,r,s,o;return s=new Sn({}),{c(){n=P("div"),i=P("p"),i.textContent="Loading saved data...",r=_(),_e(s.$$.fragment),X(n,"class","my-auto flex flex-col items-center gap-8")},m(e,t){$(e,n,t),v(n,i),v(n,r),Ze(s,n,null),o=!0},p:e,i(e){o||(be(s.$$.fragment,e),o=!0)},o(e){we(s.$$.fragment,e),o=!1},d(e){e&&Q(n),Ce(s)}}}function f$(e){let t,n,i,r;function s(t){e[3](t)}function o(t){e[4](t)}let a={};return void 0!==e[0]&&(a.fileData=e[0]),void 0!==e[1]&&(a.globalSettings=e[1]),t=new r$({props:a}),K.push((()=>Te(t,"fileData",s))),K.push((()=>Te(t,"globalSettings",o))),{c(){_e(t.$$.fragment)},m(e,n){Ze(t,e,n),r=!0},p(e,r){const s={};!n&&1&r&&(n=!0,s.fileData=e[0],oe((()=>n=!1))),!i&&2&r&&(i=!0,s.globalSettings=e[1],oe((()=>i=!1))),t.$set(s)},i(e){r||(be(t.$$.fragment,e),r=!0)},o(e){we(t.$$.fragment,e),r=!1},d(e){Ce(t,e)}}}function O$(e){let t,n,i,r;const s=[f$,d$],o=[];function a(e,t){return e[2]?0:1}return n=a(e),i=o[n]=s[n](e),{c(){t=P("section"),i.c(),X(t,"class","pt-10 h-screen w-full flex justify-center")},m(e,i){$(e,t,i),o[n].m(t,null),r=!0},p(e,[r]){let l=n;n=a(e),n===l?o[n].p(e,r):(me(),we(o[l],1,1,(()=>{o[l]=null})),ge(),i=o[n],i?i.p(e,r):(i=o[n]=s[n](e),i.c()),be(i,1),i.m(t,null))},i(e){r||(be(i),r=!0)},o(e){we(i),r=!1},d(e){e&&Q(t),o[n].d()}}}function p$(e,t,n){let i,r,s;const o=[Ey.onFileDataChange.subscribe((e=>{n(0,r=e)})),Ey.onGlobalSettingsChange.subscribe((e=>{n(1,s=e)}))];return N((()=>{u$.initializeFromStorage()})),L((()=>{o.forEach((e=>e()))})),e.$$.update=()=>{3&e.$$.dirty&&n(2,i=r&&s),3&e.$$.dirty&&r&&s&&u$.saveToStorage()},[r,s,i,function(e){r=e,n(0,r)},function(e){s=e,n(1,s)}]}class m$ extends Ye{constructor(e){super(),Xe(this,e,p$,O$,a,{})}}function g$(t){let n,i,r,s,o,a,l,h=(t[2]?t[1]:t[5])+"";return{c(){n=P("button"),i=P("img"),s=_(),o=T(h),X(i,"class","svg svelte-1dbjub8"),c(i.src,r="./assets/icons/"+t[0]+".svg")||X(i,"src",r),X(i,"alt",t[0]),X(n,"class","flex items-center py-1 px-2 svelte-1dbjub8"),E(n,"active",t[2]),E(n,"border",t[6]),E(n,"large",t[3]),E(n,"danger",t[4]),E(n,"use-bg",t[7])},m(e,r){$(e,n,r),v(n,i),v(n,s),v(n,o),t[12](n),a||(l=C(n,"click",t[9]),a=!0)},p(e,[t]){1&t&&!c(i.src,r="./assets/icons/"+e[0]+".svg")&&X(i,"src",r),1&t&&X(i,"alt",e[0]),38&t&&h!==(h=(e[2]?e[1]:e[5])+"")&&R(o,h),4&t&&E(n,"active",e[2]),64&t&&E(n,"border",e[6]),8&t&&E(n,"large",e[3]),16&t&&E(n,"danger",e[4]),128&t&&E(n,"use-bg",e[7])},i:e,o:e,d(e){e&&Q(n),t[12](null),a=!1,l()}}}function b$(e,t,n){let i,{icon:r}=t,{text:s}=t,{onClick:o}=t,{active:a=!0}=t,{large:l=!1}=t,{danger:c=!1}=t,{fixedWidth:h=""}=t,{disabledText:u=""}=t,{border:d=!0}=t,{useBg:f=!1}=t;return N((()=>{h&&n(8,i.style.width=h+"px",i)})),e.$$set=e=>{"icon"in e&&n(0,r=e.icon),"text"in e&&n(1,s=e.text),"onClick"in e&&n(10,o=e.onClick),"active"in e&&n(2,a=e.active),"large"in e&&n(3,l=e.large),"danger"in e&&n(4,c=e.danger),"fixedWidth"in e&&n(11,h=e.fixedWidth),"disabledText"in e&&n(5,u=e.disabledText),"border"in e&&n(6,d=e.border),"useBg"in e&&n(7,f=e.useBg)},[r,s,a,l,c,u,d,f,i,function(){a&&(o(),setTimeout((()=>{i.blur()}),100))},o,h,function(e){K[e?"unshift":"push"]((()=>{i=e,n(8,i)}))}]}class w$ extends Ye{constructor(e){super(),Xe(this,e,b$,g$,a,{icon:0,text:1,onClick:10,active:2,large:3,danger:4,fixedWidth:11,disabledText:5,border:6,useBg:7})}}function x$(t){let n,i;return n=new m$({}),{c(){_e(n.$$.fragment)},m(e,t){Ze(n,e,t),i=!0},p:e,i(e){i||(be(n.$$.fragment,e),i=!0)},o(e){we(n.$$.fragment,e),i=!1},d(e){Ce(n,e)}}}function v$(e){let t,n,i,r;const s=[S$,y$],o=[];function a(e,t){return e[1]?0:1}return t=a(e),n=o[t]=s[t](e),{c(){n.c(),i=Z()},m(e,n){o[t].m(e,n),$(e,i,n),r=!0},p(e,r){let l=t;t=a(e),t!==l&&(me(),we(o[l],1,1,(()=>{o[l]=null})),ge(),n=o[t],n||(n=o[t]=s[t](e),n.c()),be(n,1),n.m(i.parentNode,i))},i(e){r||(be(n),r=!0)},o(e){we(n),r=!1},d(e){o[t].d(e),e&&Q(i)}}}function y$(e){let t,n,i,r,s,o;return s=new Sn({}),{c(){t=P("section"),n=P("div"),i=P("p"),i.textContent="Building package...",r=_(),_e(s.$$.fragment),X(n,"class","flex flex-col items-center gap-8"),X(t,"class","pt-10 h-screen w-screen flex items-center justify-center")},m(e,a){$(e,t,a),v(t,n),v(n,i),v(n,r),Ze(s,n,null),o=!0},i(e){o||(be(s.$$.fragment,e),o=!0)},o(e){we(s.$$.fragment,e),o=!1},d(e){e&&Q(t),Ce(s)}}}function S$(e){let t,n;return t=new Ry({}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function $$(e){let t,n,i,r,s,o,a,l;i=new w$({props:{icon:e[0]?"pencil":"hammer",text:e[0]?"Edit":"Build",onClick:e[2],useBg:!0}});const c=[v$,x$],h=[];function u(e,t){return e[0]?0:1}return s=u(e),o=h[s]=c[s](e),{c(){t=_(),n=P("div"),_e(i.$$.fragment),r=_(),o.c(),a=Z(),document.title="S4TK Package Generator",X(n,"class","fixed z-30 top-14 right-4 hover:opacity-100"),E(n,"opacity-50",e[0])},m(e,o){$(e,t,o),$(e,n,o),Ze(i,n,null),$(e,r,o),h[s].m(e,o),$(e,a,o),l=!0},p(e,[t]){const r={};1&t&&(r.icon=e[0]?"pencil":"hammer"),1&t&&(r.text=e[0]?"Edit":"Build"),i.$set(r),(!l||1&t)&&E(n,"opacity-50",e[0]);let d=s;s=u(e),s===d?h[s].p(e,t):(me(),we(h[d],1,1,(()=>{h[d]=null})),ge(),o=h[s],o?o.p(e,t):(o=h[s]=c[s](e),o.c()),be(o,1),o.m(a.parentNode,a))},i(e){l||(be(i.$$.fragment,e),be(o),l=!0)},o(e){we(i.$$.fragment,e),we(o),l=!1},d(e){e&&Q(t),e&&Q(n),Ce(i),e&&Q(r),h[s].d(e),e&&Q(a)}}}function Q$(e,t,n){let i=!1,r=!1;const s=[Ey.onPreviewingPackageChange.subscribe((e=>{n(0,i=e)})),Ey.onPackagePreviewReadyChange.subscribe((e=>{n(1,r=e)})),Wy("b",o,{ctrlOrMeta:!0,preventDefault:!0})];function o(){i?u$.requestBuilder():u$.requestPreviewer()}return L((()=>{s.forEach((e=>e()))})),[i,r,o]}class k$ extends Ye{constructor(e){super(),Xe(this,e,Q$,$$,a,{})}}var P$="https://api.sims4toolkit.com";function T$(t){let n,i,r;return{c(){n=P("button"),n.innerHTML='code\n Format',X(n,"class","download-button text-xs px-2 py-1 rounded border border-solid border-gray-800 text-gray-800 hover:bg-gray-800 hover:text-white dark:border-white dark:text-white dark:hover:bg-white dark:hover:text-black svelte-1raocbi")},m(e,s){$(e,n,s),i||(r=C(n,"click",t[5]),i=!0)},p:e,d(e){e&&Q(n),i=!1,r()}}}function _$(t){let n,i,r,s,o,a,l,c,h,u,d,f,O;document.title=n=t[0];let p=t[2]&&T$(t);return{c(){i=_(),r=P("section"),s=P("div"),o=_(),a=P("div"),l=P("div"),c=P("button"),c.innerHTML='download\n Download',h=_(),p&&p.c(),u=_(),d=P("p"),d.textContent=`${t[3]()}`,X(s,"class","absolute top-10 bottom-10 left-0 right-0 overflow-auto"),X(c,"class","download-button text-xs px-2 py-1 rounded border border-solid border-gray-800 text-gray-800 hover:bg-gray-800 hover:text-white dark:border-white dark:text-white dark:hover:bg-white dark:hover:text-black svelte-1raocbi"),X(l,"class","flex gap-2"),X(d,"class","text-subtle text-xs uppercase"),X(a,"class","absolute bottom-0 left-0 right-0 h-10 px-2 bg-gray-200 dark:bg-gray-900 flex items-center justify-between border-t border-solid border-t-gray-300 dark:border-t-gray-700"),X(r,"class","pt-10 h-screen w-screen")},m(e,n){$(e,i,n),$(e,r,n),v(r,s),t[9](s),v(r,o),v(r,a),v(a,l),v(l,c),v(l,h),p&&p.m(l,null),v(a,u),v(a,d),f||(O=C(c,"click",t[4]),f=!0)},p(e,[t]){1&t&&n!==(n=e[0])&&(document.title=n),e[2]?p?p.p(e,t):(p=T$(e),p.c(),p.m(l,null)):p&&(p.d(1),p=null)},i:e,o:e,d(e){e&&Q(i),e&&Q(r),t[9](null),p&&p.d(),f=!1,O()}}}function Z$(e,t,n){let i;const{XmlDocumentNode:r}=window.S4TK.xml;let s,o,{filename:a}=t,{content:l}=t,{extension:c}=t,h=!1;const u=[Ot.subscribe("isLightTheme",(e=>{s&&Gv.updateTheme(s,!e)}))];function d(){switch(c){case"xml":case"json":case"py":return c;case"js":case"cjs":case"ts":return"js";default:return"py"}}return N((()=>{s=Gv.create(o,!ft.isLightTheme,d()),Gv.updateContent(s,l,d(),!0)})),L((()=>{u.forEach((e=>e()))})),e.$$set=e=>{"filename"in e&&n(0,a=e.filename),"content"in e&&n(6,l=e.content),"extension"in e&&n(7,c=e.extension)},e.$$.update=()=>{384&e.$$.dirty&&n(2,i=!h&&"xml"===c)},[a,o,i,function(){switch(c){case"py":return"python";case"js":case"cjs":return"javascript";case"ts":return"typescript";default:return c}},function(){rt.saveAs(new Blob([l]),a)},function(){try{const e=r.from(l).toXml({spacesPerIndent:ft.formatXmlSpaces});Gv.updateContent(s,e,"xml"),n(8,h=!0)}catch(e){console.error(e)}},l,c,h,function(e){K[e?"unshift":"push"]((()=>{o=e,n(1,o)}))}]}class C$ extends Ye{constructor(e){super(),Xe(this,e,Z$,_$,a,{filename:0,content:6,extension:7})}}function X$(t){let n,i;return n=new Sn({}),{c(){_e(n.$$.fragment)},m(e,t){Ze(n,e,t),i=!0},p:e,i(e){i||(be(n.$$.fragment,e),i=!0)},o(e){we(n.$$.fragment,e),i=!1},d(e){Ce(n,e)}}}function Y$(e){let t,n,i,r,o,a,l,c,h,u,d,f,O,p,m,g,b;return i=new Wt({props:{title:"Do you trust this page?"}}),{c(){t=P("div"),n=P("div"),_e(i.$$.fragment),r=_(),o=P("p"),o.textContent="The HTML page you're about to preview contains an unrecognized script.\n Running scripts from people you do not know can be risky; review it\n below before proceeding. Loading without the script make cause the\n page to behave incorrectly.",a=_(),l=P("div"),c=P("button"),c.textContent="Load Content Only",h=_(),u=P("button"),u.textContent="Load with Script",d=_(),f=P("div"),O=P("pre"),p=T(e[0]),X(o,"class","mt-4 mb-8"),X(c,"class","px-3 py-2 rounded border border-solid border-gray-800 text-gray-800 hover:bg-gray-800 hover:text-white dark:border-white dark:text-white dark:hover:bg-white dark:hover:text-black"),X(u,"class","px-3 py-2 rounded border border-solid border-gray-800 text-gray-800 hover:bg-gray-800 hover:text-white dark:border-white dark:text-white dark:hover:bg-white dark:hover:text-black"),X(l,"class","flex gap-4"),X(n,"class","max-w-full"),X(O,"class","w-full p-2 whitespace-pre-wrap break-all"),X(f,"class","max-w-full mt-8 w-full max-h-52 overflow-auto bg-gray-200 dark:bg-gray-900 rounded-lg"),X(t,"class","max-w-screen-md")},m(s,w){$(s,t,w),v(t,n),Ze(i,n,null),v(n,r),v(n,o),v(n,a),v(n,l),v(l,c),v(l,h),v(l,u),v(t,d),v(t,f),v(f,O),v(O,p),m=!0,g||(b=[C(c,"click",e[2]),C(u,"click",e[1])],g=!0)},p(e,t){(!m||1&t)&&R(p,e[0])},i(e){m||(be(i.$$.fragment,e),m=!0)},o(e){we(i.$$.fragment,e),m=!1},d(e){e&&Q(t),Ce(i),g=!1,s(b)}}}function R$(e){let t,n,i,r;const s=[Y$,X$],o=[];function a(e,t){return e[0]?0:1}return n=a(e),i=o[n]=s[n](e),{c(){t=P("section"),i.c(),X(t,"class","pt-10 px-4 h-screen w-screen flex items-center justify-center")},m(e,i){$(e,t,i),o[n].m(t,null),r=!0},p(e,[r]){let l=n;n=a(e),n===l?o[n].p(e,r):(me(),we(o[l],1,1,(()=>{o[l]=null})),ge(),i=o[n],i?i.p(e,r):(i=o[n]=s[n](e),i.c()),be(i,1),i.m(t,null))},i(e){r||(be(i),r=!0)},o(e){we(i),r=!1},d(e){e&&Q(t),o[n].d()}}}function q$(e){document.open(),document.write(e),document.close()}function A$(e,t,n){const{fnv64:i}=window.S4TK.hashing;let r,s,o,{content:a}=t;return N((()=>{if(r=document.createElement("html"),r.innerHTML=a,s=r.getElementsByTagName("script"),s.length){const t=[];for(let e=0;e{"content"in e&&n(3,a=e.content)},[o,function(){q$(a)},function(){for(let e=0;e{a[s]=null})),ge(),r=a[i],r?r.p(e,n):(r=a[i]=o[i](e),r.c()),be(r,1),r.m(t,null))},i(e){s||(be(r),s=!0)},o(e){we(r),s=!1},d(e){e&&Q(t),a[i].d()}}}function j$(e){let t,n,i,r;const s=[I$,V$,U$],o=[];function a(e,t){return e[4]?0:e[5]?1:2}return t=a(e),n=o[t]=s[t](e),{c(){n.c(),i=Z()},m(e,n){o[t].m(e,n),$(e,i,n),r=!0},p(e,r){let l=t;t=a(e),t===l?o[t].p(e,r):(me(),we(o[l],1,1,(()=>{o[l]=null})),ge(),n=o[t],n?n.p(e,r):(n=o[t]=s[t](e),n.c()),be(n,1),n.m(i.parentNode,i))},i(e){r||(be(n),r=!0)},o(e){we(n),r=!1},d(e){o[t].d(e),e&&Q(i)}}}function z$(e){let t,n,i,r,s,o,a,l,c,h,u=e[4]?"package":"file";return c=new Sn({}),{c(){t=P("div"),n=P("h2"),n.textContent="Hang Tight",i=_(),r=P("p"),s=T("Fetching "),o=T(u),a=T(" from Discord"),l=_(),_e(c.$$.fragment),X(n,"class","mb-4 text-2xl font-bold"),X(r,"class","mb-4"),X(t,"class","text-center")},m(e,u){$(e,t,u),v(t,n),v(t,i),v(t,r),v(r,s),v(r,o),v(r,a),v(t,l),Ze(c,t,null),h=!0},p(e,t){(!h||16&t)&&u!==(u=e[4]?"package":"file")&&R(o,u)},i(e){h||(be(c.$$.fragment,e),h=!0)},o(e){we(c.$$.fragment,e),h=!1},d(e){e&&Q(t),Ce(c)}}}function D$(t){let n,i,r,s,o,a,l;return{c(){n=P("div"),i=P("h2"),i.textContent="Error",r=_(),s=P("p"),o=T(t[2]),a=_(),l=P("p"),l.innerHTML='Try refreshing the page. If it still isn't working, let me know.',X(i,"class","mb-4 text-2xl font-bold"),X(s,"class","mb-8"),X(l,"class","text-sm text-subtle"),X(n,"class","text-center")},m(e,t){$(e,n,t),v(n,i),v(n,r),v(n,s),v(s,o),v(n,a),v(n,l)},p(e,t){4&t&&R(o,e[2])},i:e,o:e,d(e){e&&Q(n)}}}function U$(e){let t,n;return t=new C$({props:{filename:e[0].filename,content:e[3],extension:e[6]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};1&n&&(i.filename=e[0].filename),8&n&&(i.content=e[3]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function V$(e){let t,n;return t=new W$({props:{content:e[3]}}),{c(){_e(t.$$.fragment)},m(e,i){Ze(t,e,i),n=!0},p(e,n){const i={};8&n&&(i.content=e[3]),t.$set(i)},i(e){n||(be(t.$$.fragment,e),n=!0)},o(e){we(t.$$.fragment,e),n=!1},d(e){Ce(t,e)}}}function I$(t){let n,i;return n=new Ry({}),{c(){_e(n.$$.fragment)},m(e,t){Ze(n,e,t),i=!0},p:e,i(e){i||(be(n.$$.fragment,e),i=!0)},o(e){we(n.$$.fragment,e),i=!1},d(e){Ce(n,e)}}}function M$(e){let t,n,i,r;const s=[j$,E$],o=[];function a(e,t){return e[1]?0:1}return t=a(e),n=o[t]=s[t](e),{c(){n.c(),i=Z()},m(e,n){o[t].m(e,n),$(e,i,n),r=!0},p(e,[r]){let l=t;t=a(e),t===l?o[t].p(e,r):(me(),we(o[l],1,1,(()=>{o[l]=null})),ge(),n=o[t],n?n.p(e,r):(n=o[t]=s[t](e),n.c()),be(n,1),n.m(i.parentNode,i))},i(e){r||(be(n),r=!0)},o(e){we(n),r=!1},d(e){o[t].d(e),e&&Q(i)}}}function G$(e,t,n){let i,r,{params:s}=t;const o=(a=s.filename?.split("."),a[a.length-1]);var a;let l,c,h=!1;return N((()=>{const e=window.location.hash?.replace("#/","");i?async function(e){try{const t=await fetch(`${P$}/${e}`);if(t.ok){const e=await t.arrayBuffer(),i=window.NodeJS.Buffer.from(e);await Rt.loadPackage(i,s.filename)?n(1,h=!0):(n(2,l="Package is invalid or empty."),console.error(l))}else console.error(t),n(2,l=`[${t.status}] ${t.statusText}`)}catch(e){console.error(e),n(2,l=e instanceof Error?e.message:e)}}(e):async function(e){try{const t=await fetch(`${P$}/${e}`);t.ok?(n(3,c=await t.text()),n(1,h=!0)):(console.error(t),n(2,l=`[${t.status}] ${t.statusText}`))}catch(e){console.error(e),n(2,l=e instanceof Error?e.message:e)}}(e)})),e.$$set=e=>{"params"in e&&n(0,s=e.params)},n(4,i="package"===o),n(5,r="html"===o),[s,h,l,c,i,r,o]}class B$ extends Ye{constructor(e){super(),Xe(this,e,G$,M$,a,{params:0})}}function N$(t){let n,i,r,s,o;return n=new dn({}),s=new Le({props:{routes:t[0],restoreScrollState:!0}}),{c(){_e(n.$$.fragment),i=_(),r=P("main"),_e(s.$$.fragment),X(r,"class","min-h-screen flex flex-col")},m(e,t){Ze(n,e,t),$(e,i,t),$(e,r,t),Ze(s,r,null),o=!0},p:e,i(e){o||(be(n.$$.fragment,e),be(s.$$.fragment,e),o=!0)},o(e){we(n.$$.fragment,e),we(s.$$.fragment,e),o=!1},d(e){Ce(n,e),e&&Q(i),e&&Q(r),Ce(s)}}}function L$(e){return[{"/":wn,"/view":Ry,"/generate":k$,"/discord/:server/:message/:filename":B$,"*":vn}]}const F$=new class extends Ye{constructor(e){super(),Xe(this,e,L$,N$,a,{})}}({target:document.body});return window.addEventListener("load",(()=>{ct.toggleLightTheme(ft.isLightTheme,!1)})),F$}(); //# sourceMappingURL=bundle.js.map diff --git a/build/bundle.js.map b/build/bundle.js.map index 2c765f7..952a191 100644 --- a/build/bundle.js.map +++ b/build/bundle.js.map @@ -1 +1 @@ -{"version":3,"file":"bundle.js","sources":["../../node_modules/svelte/internal/index.mjs","../../node_modules/svelte/store/index.mjs","../../node_modules/svelte-spa-router/Router.svelte","../../node_modules/regexparam/dist/index.mjs","../../src/components/layout/Modal.svelte","../../node_modules/jszip/dist/jszip.min.js","../../node_modules/file-saver/dist/FileSaver.min.js","../../src/lib/utils/event-notifier.ts","../../src/lib/viewer/viewer-events.ts","../../src/lib/viewer/viewable-file-info.ts","../../src/lib/utils/document-utils.ts","../../src/lib/utils/settings.ts","../../src/lib/viewer/diagnostics.ts","../../src/lib/viewer/explorer-data.ts","../../src/lib/utils/helpers.ts","../../src/lib/viewer/resource-loader.ts","../../src/lib/viewer/viewer-state.ts","../../src/components/elements/SectionHeader.svelte","../../src/components/elements/Switch.svelte","../../src/components/settings/DiagnosticCodeChecklist.svelte","../../src/components/elements/DiagnosticsIcon.svelte","../../src/components/settings/DiagnosticLevelCheckbox.svelte","../../src/components/settings/SettingsMenuContent.svelte","../../src/components/settings/ThemeToggle.svelte","../../src/components/settings/SettingsMenu.svelte","../../src/components/Navbar.svelte","../../src/components/Footer.svelte","../../src/pages/home/ToolCardLink.svelte","../../src/pages/home/HomePage.svelte","../../src/pages/NotFoundPage.svelte","../../src/components/elements/LoadingIndicator.svelte","../../src/components/layout/CompactSplitView.svelte","../../src/components/layout/LeftRightSplitView.svelte","../../src/components/layout/SplitView.svelte","../../src/components/layout/TopBottomSplitView.svelte","../../src/components/elements/ConfirmDialogue.svelte","../../src/pages/viewer/explorer/FileExplorerToolbar.svelte","../../src/pages/viewer/diagnostics/DiagnosticsBubbleItem.svelte","../../src/pages/viewer/diagnostics/DiagnosticsBubble.svelte","../../src/pages/viewer/explorer/cells/TuningCellContent.svelte","../../src/pages/viewer/explorer/cells/StringTableCellContent.svelte","../../src/pages/viewer/explorer/cells/DefaultCellContent.svelte","../../src/pages/viewer/explorer/cells/FileExplorerCell.svelte","../../src/pages/viewer/explorer/FileExplorerSection.svelte","../../node_modules/svelte/easing/index.mjs","../../node_modules/svelte/transition/index.mjs","../../src/components/elements/CornerAlert.svelte","../../src/pages/viewer/explorer/DownloadButton.svelte","../../src/pages/viewer/explorer/FileExplorerPanel.svelte","../../src/components/elements/FileInput.svelte","../../src/pages/viewer/editor/ScanningPackageProgress.svelte","../../src/pages/viewer/editor/UploadPackagePanel.svelte","../../src/pages/viewer/editor/renderers/ImageFileRenderer.svelte","../../src/pages/viewer/editor/renderers/StringTableFileRenderer.svelte","../../src/pages/viewer/editor/renderers/UnrenderableRenderer.svelte","../../node_modules/@codemirror/state/dist/index.js","../../node_modules/style-mod/src/style-mod.js","../../node_modules/w3c-keyname/index.es.js","../../node_modules/@codemirror/view/dist/index.js","../../node_modules/@lezer/common/dist/index.js","../../node_modules/@lezer/highlight/dist/index.js","../../node_modules/@codemirror/language/dist/index.js","../../node_modules/@codemirror/commands/dist/index.js","../../node_modules/crelt/index.es.js","../../node_modules/@codemirror/search/dist/index.js","../../node_modules/@codemirror/autocomplete/dist/index.js","../../node_modules/@codemirror/lint/dist/index.js","../../node_modules/codemirror/dist/index.js","../../node_modules/@lezer/lr/dist/index.js","../../node_modules/@lezer/xml/dist/index.js","../../node_modules/@codemirror/lang-xml/dist/index.js","../../node_modules/@lezer/json/dist/index.js","../../node_modules/@codemirror/lang-json/dist/index.js","../../node_modules/@lezer/python/dist/index.js","../../node_modules/@codemirror/lang-python/dist/index.js","../../node_modules/@lezer/javascript/dist/index.js","../../node_modules/@codemirror/lang-javascript/dist/index.js","../../src/lib/editor/editor-theme-dark.ts","../../src/lib/editor/editor-theme-light.ts","../../src/lib/editor/editor.ts","../../src/pages/viewer/editor/renderers/PlainTextRenderer.svelte","../../src/pages/viewer/editor/EditorPanelDelegate.svelte","../../src/components/elements/ChevronToggle.svelte","../../src/pages/viewer/diagnostics/DiagnosticsSectionButton.svelte","../../src/pages/viewer/diagnostics/DiagnosticsSwimlane.svelte","../../src/pages/viewer/diagnostics/DiagnosticsPanel.svelte","../../src/pages/viewer/PackageViewerPage.svelte","../../src/lib/utils/keybindings.ts","../../src/lib/generator/generator-events.ts","../../src/pages/generator/legacy/elements/IconButton.svelte","../../src/pages/generator/legacy/elements/Checkbox.svelte","../../src/pages/generator/legacy/elements/Select.svelte","../../src/pages/generator/legacy/elements/TextInput.svelte","../../src/pages/generator/legacy/AddOnManualKey.svelte","../../src/pages/generator/legacy/AddOnSimData.svelte","../../src/pages/generator/legacy/AddOnTemplateId.svelte","../../src/pages/generator/legacy/GeneratedFileEntry.svelte","../../src/pages/generator/legacy/elements/Button.svelte","../../src/pages/generator/legacy/elements/StickyCloseButton.svelte","../../src/pages/generator/legacy/elements/BlurOverlay.svelte","../../src/pages/generator/legacy/TemplatesEditor.svelte","../../src/pages/generator/legacy/BuilderHeader.svelte","../../src/pages/generator/legacy/elements/InlineImage.svelte","../../src/pages/generator/legacy/EmptyBuilderContent.svelte","../../src/pages/generator/legacy/PkgBuilderView.svelte","../../src/lib/generator/generator-db.ts","../../src/lib/generator/generator-state.ts","../../src/pages/generator/legacy/PkgGeneratorPage.svelte","../../src/pages/generator/legacy/elements/IconTextButton.svelte","../../src/pages/generator/PackageGeneratorDelegate.svelte","../../src/config.ts","../../src/pages/viewer/discord/PlainTextViewer.svelte","../../src/pages/viewer/discord/HtmlViewer.svelte","../../src/pages/viewer/discord/DiscordViewerDelegate.svelte","../../src/App.svelte","../../src/main.ts"],"sourcesContent":["function noop() { }\nconst identity = x => x;\nfunction assign(tar, src) {\n // @ts-ignore\n for (const k in src)\n tar[k] = src[k];\n return tar;\n}\nfunction is_promise(value) {\n return value && typeof value === 'object' && typeof value.then === 'function';\n}\nfunction add_location(element, file, line, column, char) {\n element.__svelte_meta = {\n loc: { file, line, column, char }\n };\n}\nfunction run(fn) {\n return fn();\n}\nfunction blank_object() {\n return Object.create(null);\n}\nfunction run_all(fns) {\n fns.forEach(run);\n}\nfunction is_function(thing) {\n return typeof thing === 'function';\n}\nfunction safe_not_equal(a, b) {\n return a != a ? b == b : a !== b || ((a && typeof a === 'object') || typeof a === 'function');\n}\nlet src_url_equal_anchor;\nfunction src_url_equal(element_src, url) {\n if (!src_url_equal_anchor) {\n src_url_equal_anchor = document.createElement('a');\n }\n src_url_equal_anchor.href = url;\n return element_src === src_url_equal_anchor.href;\n}\nfunction not_equal(a, b) {\n return a != a ? b == b : a !== b;\n}\nfunction is_empty(obj) {\n return Object.keys(obj).length === 0;\n}\nfunction validate_store(store, name) {\n if (store != null && typeof store.subscribe !== 'function') {\n throw new Error(`'${name}' is not a store with a 'subscribe' method`);\n }\n}\nfunction subscribe(store, ...callbacks) {\n if (store == null) {\n return noop;\n }\n const unsub = store.subscribe(...callbacks);\n return unsub.unsubscribe ? () => unsub.unsubscribe() : unsub;\n}\nfunction get_store_value(store) {\n let value;\n subscribe(store, _ => value = _)();\n return value;\n}\nfunction component_subscribe(component, store, callback) {\n component.$$.on_destroy.push(subscribe(store, callback));\n}\nfunction create_slot(definition, ctx, $$scope, fn) {\n if (definition) {\n const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);\n return definition[0](slot_ctx);\n }\n}\nfunction get_slot_context(definition, ctx, $$scope, fn) {\n return definition[1] && fn\n ? assign($$scope.ctx.slice(), definition[1](fn(ctx)))\n : $$scope.ctx;\n}\nfunction get_slot_changes(definition, $$scope, dirty, fn) {\n if (definition[2] && fn) {\n const lets = definition[2](fn(dirty));\n if ($$scope.dirty === undefined) {\n return lets;\n }\n if (typeof lets === 'object') {\n const merged = [];\n const len = Math.max($$scope.dirty.length, lets.length);\n for (let i = 0; i < len; i += 1) {\n merged[i] = $$scope.dirty[i] | lets[i];\n }\n return merged;\n }\n return $$scope.dirty | lets;\n }\n return $$scope.dirty;\n}\nfunction update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn) {\n if (slot_changes) {\n const slot_context = get_slot_context(slot_definition, ctx, $$scope, get_slot_context_fn);\n slot.p(slot_context, slot_changes);\n }\n}\nfunction update_slot(slot, slot_definition, ctx, $$scope, dirty, get_slot_changes_fn, get_slot_context_fn) {\n const slot_changes = get_slot_changes(slot_definition, $$scope, dirty, get_slot_changes_fn);\n update_slot_base(slot, slot_definition, ctx, $$scope, slot_changes, get_slot_context_fn);\n}\nfunction get_all_dirty_from_scope($$scope) {\n if ($$scope.ctx.length > 32) {\n const dirty = [];\n const length = $$scope.ctx.length / 32;\n for (let i = 0; i < length; i++) {\n dirty[i] = -1;\n }\n return dirty;\n }\n return -1;\n}\nfunction exclude_internal_props(props) {\n const result = {};\n for (const k in props)\n if (k[0] !== '$')\n result[k] = props[k];\n return result;\n}\nfunction compute_rest_props(props, keys) {\n const rest = {};\n keys = new Set(keys);\n for (const k in props)\n if (!keys.has(k) && k[0] !== '$')\n rest[k] = props[k];\n return rest;\n}\nfunction compute_slots(slots) {\n const result = {};\n for (const key in slots) {\n result[key] = true;\n }\n return result;\n}\nfunction once(fn) {\n let ran = false;\n return function (...args) {\n if (ran)\n return;\n ran = true;\n fn.call(this, ...args);\n };\n}\nfunction null_to_empty(value) {\n return value == null ? '' : value;\n}\nfunction set_store_value(store, ret, value) {\n store.set(value);\n return ret;\n}\nconst has_prop = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop);\nfunction action_destroyer(action_result) {\n return action_result && is_function(action_result.destroy) ? action_result.destroy : noop;\n}\n\nconst is_client = typeof window !== 'undefined';\nlet now = is_client\n ? () => window.performance.now()\n : () => Date.now();\nlet raf = is_client ? cb => requestAnimationFrame(cb) : noop;\n// used internally for testing\nfunction set_now(fn) {\n now = fn;\n}\nfunction set_raf(fn) {\n raf = fn;\n}\n\nconst tasks = new Set();\nfunction run_tasks(now) {\n tasks.forEach(task => {\n if (!task.c(now)) {\n tasks.delete(task);\n task.f();\n }\n });\n if (tasks.size !== 0)\n raf(run_tasks);\n}\n/**\n * For testing purposes only!\n */\nfunction clear_loops() {\n tasks.clear();\n}\n/**\n * Creates a new task that runs on each raf frame\n * until it returns a falsy value or is aborted\n */\nfunction loop(callback) {\n let task;\n if (tasks.size === 0)\n raf(run_tasks);\n return {\n promise: new Promise(fulfill => {\n tasks.add(task = { c: callback, f: fulfill });\n }),\n abort() {\n tasks.delete(task);\n }\n };\n}\n\n// Track which nodes are claimed during hydration. Unclaimed nodes can then be removed from the DOM\n// at the end of hydration without touching the remaining nodes.\nlet is_hydrating = false;\nfunction start_hydrating() {\n is_hydrating = true;\n}\nfunction end_hydrating() {\n is_hydrating = false;\n}\nfunction upper_bound(low, high, key, value) {\n // Return first index of value larger than input value in the range [low, high)\n while (low < high) {\n const mid = low + ((high - low) >> 1);\n if (key(mid) <= value) {\n low = mid + 1;\n }\n else {\n high = mid;\n }\n }\n return low;\n}\nfunction init_hydrate(target) {\n if (target.hydrate_init)\n return;\n target.hydrate_init = true;\n // We know that all children have claim_order values since the unclaimed have been detached if target is not \n let children = target.childNodes;\n // If target is , there may be children without claim_order\n if (target.nodeName === 'HEAD') {\n const myChildren = [];\n for (let i = 0; i < children.length; i++) {\n const node = children[i];\n if (node.claim_order !== undefined) {\n myChildren.push(node);\n }\n }\n children = myChildren;\n }\n /*\n * Reorder claimed children optimally.\n * We can reorder claimed children optimally by finding the longest subsequence of\n * nodes that are already claimed in order and only moving the rest. The longest\n * subsequence of nodes that are claimed in order can be found by\n * computing the longest increasing subsequence of .claim_order values.\n *\n * This algorithm is optimal in generating the least amount of reorder operations\n * possible.\n *\n * Proof:\n * We know that, given a set of reordering operations, the nodes that do not move\n * always form an increasing subsequence, since they do not move among each other\n * meaning that they must be already ordered among each other. Thus, the maximal\n * set of nodes that do not move form a longest increasing subsequence.\n */\n // Compute longest increasing subsequence\n // m: subsequence length j => index k of smallest value that ends an increasing subsequence of length j\n const m = new Int32Array(children.length + 1);\n // Predecessor indices + 1\n const p = new Int32Array(children.length);\n m[0] = -1;\n let longest = 0;\n for (let i = 0; i < children.length; i++) {\n const current = children[i].claim_order;\n // Find the largest subsequence length such that it ends in a value less than our current value\n // upper_bound returns first greater value, so we subtract one\n // with fast path for when we are on the current longest subsequence\n const seqLen = ((longest > 0 && children[m[longest]].claim_order <= current) ? longest + 1 : upper_bound(1, longest, idx => children[m[idx]].claim_order, current)) - 1;\n p[i] = m[seqLen] + 1;\n const newLen = seqLen + 1;\n // We can guarantee that current is the smallest value. Otherwise, we would have generated a longer sequence.\n m[newLen] = i;\n longest = Math.max(newLen, longest);\n }\n // The longest increasing subsequence of nodes (initially reversed)\n const lis = [];\n // The rest of the nodes, nodes that will be moved\n const toMove = [];\n let last = children.length - 1;\n for (let cur = m[longest] + 1; cur != 0; cur = p[cur - 1]) {\n lis.push(children[cur - 1]);\n for (; last >= cur; last--) {\n toMove.push(children[last]);\n }\n last--;\n }\n for (; last >= 0; last--) {\n toMove.push(children[last]);\n }\n lis.reverse();\n // We sort the nodes being moved to guarantee that their insertion order matches the claim order\n toMove.sort((a, b) => a.claim_order - b.claim_order);\n // Finally, we move the nodes\n for (let i = 0, j = 0; i < toMove.length; i++) {\n while (j < lis.length && toMove[i].claim_order >= lis[j].claim_order) {\n j++;\n }\n const anchor = j < lis.length ? lis[j] : null;\n target.insertBefore(toMove[i], anchor);\n }\n}\nfunction append(target, node) {\n target.appendChild(node);\n}\nfunction append_styles(target, style_sheet_id, styles) {\n const append_styles_to = get_root_for_style(target);\n if (!append_styles_to.getElementById(style_sheet_id)) {\n const style = element('style');\n style.id = style_sheet_id;\n style.textContent = styles;\n append_stylesheet(append_styles_to, style);\n }\n}\nfunction get_root_for_style(node) {\n if (!node)\n return document;\n const root = node.getRootNode ? node.getRootNode() : node.ownerDocument;\n if (root && root.host) {\n return root;\n }\n return node.ownerDocument;\n}\nfunction append_empty_stylesheet(node) {\n const style_element = element('style');\n append_stylesheet(get_root_for_style(node), style_element);\n return style_element.sheet;\n}\nfunction append_stylesheet(node, style) {\n append(node.head || node, style);\n return style.sheet;\n}\nfunction append_hydration(target, node) {\n if (is_hydrating) {\n init_hydrate(target);\n if ((target.actual_end_child === undefined) || ((target.actual_end_child !== null) && (target.actual_end_child.parentNode !== target))) {\n target.actual_end_child = target.firstChild;\n }\n // Skip nodes of undefined ordering\n while ((target.actual_end_child !== null) && (target.actual_end_child.claim_order === undefined)) {\n target.actual_end_child = target.actual_end_child.nextSibling;\n }\n if (node !== target.actual_end_child) {\n // We only insert if the ordering of this node should be modified or the parent node is not target\n if (node.claim_order !== undefined || node.parentNode !== target) {\n target.insertBefore(node, target.actual_end_child);\n }\n }\n else {\n target.actual_end_child = node.nextSibling;\n }\n }\n else if (node.parentNode !== target || node.nextSibling !== null) {\n target.appendChild(node);\n }\n}\nfunction insert(target, node, anchor) {\n target.insertBefore(node, anchor || null);\n}\nfunction insert_hydration(target, node, anchor) {\n if (is_hydrating && !anchor) {\n append_hydration(target, node);\n }\n else if (node.parentNode !== target || node.nextSibling != anchor) {\n target.insertBefore(node, anchor || null);\n }\n}\nfunction detach(node) {\n if (node.parentNode) {\n node.parentNode.removeChild(node);\n }\n}\nfunction destroy_each(iterations, detaching) {\n for (let i = 0; i < iterations.length; i += 1) {\n if (iterations[i])\n iterations[i].d(detaching);\n }\n}\nfunction element(name) {\n return document.createElement(name);\n}\nfunction element_is(name, is) {\n return document.createElement(name, { is });\n}\nfunction object_without_properties(obj, exclude) {\n const target = {};\n for (const k in obj) {\n if (has_prop(obj, k)\n // @ts-ignore\n && exclude.indexOf(k) === -1) {\n // @ts-ignore\n target[k] = obj[k];\n }\n }\n return target;\n}\nfunction svg_element(name) {\n return document.createElementNS('http://www.w3.org/2000/svg', name);\n}\nfunction text(data) {\n return document.createTextNode(data);\n}\nfunction space() {\n return text(' ');\n}\nfunction empty() {\n return text('');\n}\nfunction listen(node, event, handler, options) {\n node.addEventListener(event, handler, options);\n return () => node.removeEventListener(event, handler, options);\n}\nfunction prevent_default(fn) {\n return function (event) {\n event.preventDefault();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction stop_propagation(fn) {\n return function (event) {\n event.stopPropagation();\n // @ts-ignore\n return fn.call(this, event);\n };\n}\nfunction self(fn) {\n return function (event) {\n // @ts-ignore\n if (event.target === this)\n fn.call(this, event);\n };\n}\nfunction trusted(fn) {\n return function (event) {\n // @ts-ignore\n if (event.isTrusted)\n fn.call(this, event);\n };\n}\nfunction attr(node, attribute, value) {\n if (value == null)\n node.removeAttribute(attribute);\n else if (node.getAttribute(attribute) !== value)\n node.setAttribute(attribute, value);\n}\nfunction set_attributes(node, attributes) {\n // @ts-ignore\n const descriptors = Object.getOwnPropertyDescriptors(node.__proto__);\n for (const key in attributes) {\n if (attributes[key] == null) {\n node.removeAttribute(key);\n }\n else if (key === 'style') {\n node.style.cssText = attributes[key];\n }\n else if (key === '__value') {\n node.value = node[key] = attributes[key];\n }\n else if (descriptors[key] && descriptors[key].set) {\n node[key] = attributes[key];\n }\n else {\n attr(node, key, attributes[key]);\n }\n }\n}\nfunction set_svg_attributes(node, attributes) {\n for (const key in attributes) {\n attr(node, key, attributes[key]);\n }\n}\nfunction set_custom_element_data_map(node, data_map) {\n Object.keys(data_map).forEach((key) => {\n set_custom_element_data(node, key, data_map[key]);\n });\n}\nfunction set_custom_element_data(node, prop, value) {\n if (prop in node) {\n node[prop] = typeof node[prop] === 'boolean' && value === '' ? true : value;\n }\n else {\n attr(node, prop, value);\n }\n}\nfunction xlink_attr(node, attribute, value) {\n node.setAttributeNS('http://www.w3.org/1999/xlink', attribute, value);\n}\nfunction get_binding_group_value(group, __value, checked) {\n const value = new Set();\n for (let i = 0; i < group.length; i += 1) {\n if (group[i].checked)\n value.add(group[i].__value);\n }\n if (!checked) {\n value.delete(__value);\n }\n return Array.from(value);\n}\nfunction to_number(value) {\n return value === '' ? null : +value;\n}\nfunction time_ranges_to_array(ranges) {\n const array = [];\n for (let i = 0; i < ranges.length; i += 1) {\n array.push({ start: ranges.start(i), end: ranges.end(i) });\n }\n return array;\n}\nfunction children(element) {\n return Array.from(element.childNodes);\n}\nfunction init_claim_info(nodes) {\n if (nodes.claim_info === undefined) {\n nodes.claim_info = { last_index: 0, total_claimed: 0 };\n }\n}\nfunction claim_node(nodes, predicate, processNode, createNode, dontUpdateLastIndex = false) {\n // Try to find nodes in an order such that we lengthen the longest increasing subsequence\n init_claim_info(nodes);\n const resultNode = (() => {\n // We first try to find an element after the previous one\n for (let i = nodes.claim_info.last_index; i < nodes.length; i++) {\n const node = nodes[i];\n if (predicate(node)) {\n const replacement = processNode(node);\n if (replacement === undefined) {\n nodes.splice(i, 1);\n }\n else {\n nodes[i] = replacement;\n }\n if (!dontUpdateLastIndex) {\n nodes.claim_info.last_index = i;\n }\n return node;\n }\n }\n // Otherwise, we try to find one before\n // We iterate in reverse so that we don't go too far back\n for (let i = nodes.claim_info.last_index - 1; i >= 0; i--) {\n const node = nodes[i];\n if (predicate(node)) {\n const replacement = processNode(node);\n if (replacement === undefined) {\n nodes.splice(i, 1);\n }\n else {\n nodes[i] = replacement;\n }\n if (!dontUpdateLastIndex) {\n nodes.claim_info.last_index = i;\n }\n else if (replacement === undefined) {\n // Since we spliced before the last_index, we decrease it\n nodes.claim_info.last_index--;\n }\n return node;\n }\n }\n // If we can't find any matching node, we create a new one\n return createNode();\n })();\n resultNode.claim_order = nodes.claim_info.total_claimed;\n nodes.claim_info.total_claimed += 1;\n return resultNode;\n}\nfunction claim_element_base(nodes, name, attributes, create_element) {\n return claim_node(nodes, (node) => node.nodeName === name, (node) => {\n const remove = [];\n for (let j = 0; j < node.attributes.length; j++) {\n const attribute = node.attributes[j];\n if (!attributes[attribute.name]) {\n remove.push(attribute.name);\n }\n }\n remove.forEach(v => node.removeAttribute(v));\n return undefined;\n }, () => create_element(name));\n}\nfunction claim_element(nodes, name, attributes) {\n return claim_element_base(nodes, name, attributes, element);\n}\nfunction claim_svg_element(nodes, name, attributes) {\n return claim_element_base(nodes, name, attributes, svg_element);\n}\nfunction claim_text(nodes, data) {\n return claim_node(nodes, (node) => node.nodeType === 3, (node) => {\n const dataStr = '' + data;\n if (node.data.startsWith(dataStr)) {\n if (node.data.length !== dataStr.length) {\n return node.splitText(dataStr.length);\n }\n }\n else {\n node.data = dataStr;\n }\n }, () => text(data), true // Text nodes should not update last index since it is likely not worth it to eliminate an increasing subsequence of actual elements\n );\n}\nfunction claim_space(nodes) {\n return claim_text(nodes, ' ');\n}\nfunction find_comment(nodes, text, start) {\n for (let i = start; i < nodes.length; i += 1) {\n const node = nodes[i];\n if (node.nodeType === 8 /* comment node */ && node.textContent.trim() === text) {\n return i;\n }\n }\n return nodes.length;\n}\nfunction claim_html_tag(nodes, is_svg) {\n // find html opening tag\n const start_index = find_comment(nodes, 'HTML_TAG_START', 0);\n const end_index = find_comment(nodes, 'HTML_TAG_END', start_index);\n if (start_index === end_index) {\n return new HtmlTagHydration(undefined, is_svg);\n }\n init_claim_info(nodes);\n const html_tag_nodes = nodes.splice(start_index, end_index - start_index + 1);\n detach(html_tag_nodes[0]);\n detach(html_tag_nodes[html_tag_nodes.length - 1]);\n const claimed_nodes = html_tag_nodes.slice(1, html_tag_nodes.length - 1);\n for (const n of claimed_nodes) {\n n.claim_order = nodes.claim_info.total_claimed;\n nodes.claim_info.total_claimed += 1;\n }\n return new HtmlTagHydration(claimed_nodes, is_svg);\n}\nfunction set_data(text, data) {\n data = '' + data;\n if (text.wholeText !== data)\n text.data = data;\n}\nfunction set_input_value(input, value) {\n input.value = value == null ? '' : value;\n}\nfunction set_input_type(input, type) {\n try {\n input.type = type;\n }\n catch (e) {\n // do nothing\n }\n}\nfunction set_style(node, key, value, important) {\n if (value === null) {\n node.style.removeProperty(key);\n }\n else {\n node.style.setProperty(key, value, important ? 'important' : '');\n }\n}\nfunction select_option(select, value) {\n for (let i = 0; i < select.options.length; i += 1) {\n const option = select.options[i];\n if (option.__value === value) {\n option.selected = true;\n return;\n }\n }\n select.selectedIndex = -1; // no option should be selected\n}\nfunction select_options(select, value) {\n for (let i = 0; i < select.options.length; i += 1) {\n const option = select.options[i];\n option.selected = ~value.indexOf(option.__value);\n }\n}\nfunction select_value(select) {\n const selected_option = select.querySelector(':checked') || select.options[0];\n return selected_option && selected_option.__value;\n}\nfunction select_multiple_value(select) {\n return [].map.call(select.querySelectorAll(':checked'), option => option.__value);\n}\n// unfortunately this can't be a constant as that wouldn't be tree-shakeable\n// so we cache the result instead\nlet crossorigin;\nfunction is_crossorigin() {\n if (crossorigin === undefined) {\n crossorigin = false;\n try {\n if (typeof window !== 'undefined' && window.parent) {\n void window.parent.document;\n }\n }\n catch (error) {\n crossorigin = true;\n }\n }\n return crossorigin;\n}\nfunction add_resize_listener(node, fn) {\n const computed_style = getComputedStyle(node);\n if (computed_style.position === 'static') {\n node.style.position = 'relative';\n }\n const iframe = element('iframe');\n iframe.setAttribute('style', 'display: block; position: absolute; top: 0; left: 0; width: 100%; height: 100%; ' +\n 'overflow: hidden; border: 0; opacity: 0; pointer-events: none; z-index: -1;');\n iframe.setAttribute('aria-hidden', 'true');\n iframe.tabIndex = -1;\n const crossorigin = is_crossorigin();\n let unsubscribe;\n if (crossorigin) {\n iframe.src = \"data:text/html,\";\n unsubscribe = listen(window, 'message', (event) => {\n if (event.source === iframe.contentWindow)\n fn();\n });\n }\n else {\n iframe.src = 'about:blank';\n iframe.onload = () => {\n unsubscribe = listen(iframe.contentWindow, 'resize', fn);\n };\n }\n append(node, iframe);\n return () => {\n if (crossorigin) {\n unsubscribe();\n }\n else if (unsubscribe && iframe.contentWindow) {\n unsubscribe();\n }\n detach(iframe);\n };\n}\nfunction toggle_class(element, name, toggle) {\n element.classList[toggle ? 'add' : 'remove'](name);\n}\nfunction custom_event(type, detail, { bubbles = false, cancelable = false } = {}) {\n const e = document.createEvent('CustomEvent');\n e.initCustomEvent(type, bubbles, cancelable, detail);\n return e;\n}\nfunction query_selector_all(selector, parent = document.body) {\n return Array.from(parent.querySelectorAll(selector));\n}\nfunction head_selector(nodeId, head) {\n const result = [];\n let started = 0;\n for (const node of head.childNodes) {\n if (node.nodeType === 8 /* comment node */) {\n const comment = node.textContent.trim();\n if (comment === `HEAD_${nodeId}_END`) {\n started -= 1;\n result.push(node);\n }\n else if (comment === `HEAD_${nodeId}_START`) {\n started += 1;\n result.push(node);\n }\n }\n else if (started > 0) {\n result.push(node);\n }\n }\n return result;\n}\nclass HtmlTag {\n constructor(is_svg = false) {\n this.is_svg = false;\n this.is_svg = is_svg;\n this.e = this.n = null;\n }\n c(html) {\n this.h(html);\n }\n m(html, target, anchor = null) {\n if (!this.e) {\n if (this.is_svg)\n this.e = svg_element(target.nodeName);\n else\n this.e = element(target.nodeName);\n this.t = target;\n this.c(html);\n }\n this.i(anchor);\n }\n h(html) {\n this.e.innerHTML = html;\n this.n = Array.from(this.e.childNodes);\n }\n i(anchor) {\n for (let i = 0; i < this.n.length; i += 1) {\n insert(this.t, this.n[i], anchor);\n }\n }\n p(html) {\n this.d();\n this.h(html);\n this.i(this.a);\n }\n d() {\n this.n.forEach(detach);\n }\n}\nclass HtmlTagHydration extends HtmlTag {\n constructor(claimed_nodes, is_svg = false) {\n super(is_svg);\n this.e = this.n = null;\n this.l = claimed_nodes;\n }\n c(html) {\n if (this.l) {\n this.n = this.l;\n }\n else {\n super.c(html);\n }\n }\n i(anchor) {\n for (let i = 0; i < this.n.length; i += 1) {\n insert_hydration(this.t, this.n[i], anchor);\n }\n }\n}\nfunction attribute_to_object(attributes) {\n const result = {};\n for (const attribute of attributes) {\n result[attribute.name] = attribute.value;\n }\n return result;\n}\nfunction get_custom_elements_slots(element) {\n const result = {};\n element.childNodes.forEach((node) => {\n result[node.slot || 'default'] = true;\n });\n return result;\n}\nfunction construct_svelte_component(component, props) {\n return new component(props);\n}\n\n// we need to store the information for multiple documents because a Svelte application could also contain iframes\n// https://github.com/sveltejs/svelte/issues/3624\nconst managed_styles = new Map();\nlet active = 0;\n// https://github.com/darkskyapp/string-hash/blob/master/index.js\nfunction hash(str) {\n let hash = 5381;\n let i = str.length;\n while (i--)\n hash = ((hash << 5) - hash) ^ str.charCodeAt(i);\n return hash >>> 0;\n}\nfunction create_style_information(doc, node) {\n const info = { stylesheet: append_empty_stylesheet(node), rules: {} };\n managed_styles.set(doc, info);\n return info;\n}\nfunction create_rule(node, a, b, duration, delay, ease, fn, uid = 0) {\n const step = 16.666 / duration;\n let keyframes = '{\\n';\n for (let p = 0; p <= 1; p += step) {\n const t = a + (b - a) * ease(p);\n keyframes += p * 100 + `%{${fn(t, 1 - t)}}\\n`;\n }\n const rule = keyframes + `100% {${fn(b, 1 - b)}}\\n}`;\n const name = `__svelte_${hash(rule)}_${uid}`;\n const doc = get_root_for_style(node);\n const { stylesheet, rules } = managed_styles.get(doc) || create_style_information(doc, node);\n if (!rules[name]) {\n rules[name] = true;\n stylesheet.insertRule(`@keyframes ${name} ${rule}`, stylesheet.cssRules.length);\n }\n const animation = node.style.animation || '';\n node.style.animation = `${animation ? `${animation}, ` : ''}${name} ${duration}ms linear ${delay}ms 1 both`;\n active += 1;\n return name;\n}\nfunction delete_rule(node, name) {\n const previous = (node.style.animation || '').split(', ');\n const next = previous.filter(name\n ? anim => anim.indexOf(name) < 0 // remove specific animation\n : anim => anim.indexOf('__svelte') === -1 // remove all Svelte animations\n );\n const deleted = previous.length - next.length;\n if (deleted) {\n node.style.animation = next.join(', ');\n active -= deleted;\n if (!active)\n clear_rules();\n }\n}\nfunction clear_rules() {\n raf(() => {\n if (active)\n return;\n managed_styles.forEach(info => {\n const { ownerNode } = info.stylesheet;\n // there is no ownerNode if it runs on jsdom.\n if (ownerNode)\n detach(ownerNode);\n });\n managed_styles.clear();\n });\n}\n\nfunction create_animation(node, from, fn, params) {\n if (!from)\n return noop;\n const to = node.getBoundingClientRect();\n if (from.left === to.left && from.right === to.right && from.top === to.top && from.bottom === to.bottom)\n return noop;\n const { delay = 0, duration = 300, easing = identity, \n // @ts-ignore todo: should this be separated from destructuring? Or start/end added to public api and documentation?\n start: start_time = now() + delay, \n // @ts-ignore todo:\n end = start_time + duration, tick = noop, css } = fn(node, { from, to }, params);\n let running = true;\n let started = false;\n let name;\n function start() {\n if (css) {\n name = create_rule(node, 0, 1, duration, delay, easing, css);\n }\n if (!delay) {\n started = true;\n }\n }\n function stop() {\n if (css)\n delete_rule(node, name);\n running = false;\n }\n loop(now => {\n if (!started && now >= start_time) {\n started = true;\n }\n if (started && now >= end) {\n tick(1, 0);\n stop();\n }\n if (!running) {\n return false;\n }\n if (started) {\n const p = now - start_time;\n const t = 0 + 1 * easing(p / duration);\n tick(t, 1 - t);\n }\n return true;\n });\n start();\n tick(0, 1);\n return stop;\n}\nfunction fix_position(node) {\n const style = getComputedStyle(node);\n if (style.position !== 'absolute' && style.position !== 'fixed') {\n const { width, height } = style;\n const a = node.getBoundingClientRect();\n node.style.position = 'absolute';\n node.style.width = width;\n node.style.height = height;\n add_transform(node, a);\n }\n}\nfunction add_transform(node, a) {\n const b = node.getBoundingClientRect();\n if (a.left !== b.left || a.top !== b.top) {\n const style = getComputedStyle(node);\n const transform = style.transform === 'none' ? '' : style.transform;\n node.style.transform = `${transform} translate(${a.left - b.left}px, ${a.top - b.top}px)`;\n }\n}\n\nlet current_component;\nfunction set_current_component(component) {\n current_component = component;\n}\nfunction get_current_component() {\n if (!current_component)\n throw new Error('Function called outside component initialization');\n return current_component;\n}\n/**\n * Schedules a callback to run immediately before the component is updated after any state change.\n *\n * The first time the callback runs will be before the initial `onMount`\n *\n * https://svelte.dev/docs#run-time-svelte-beforeupdate\n */\nfunction beforeUpdate(fn) {\n get_current_component().$$.before_update.push(fn);\n}\n/**\n * The `onMount` function schedules a callback to run as soon as the component has been mounted to the DOM.\n * It must be called during the component's initialisation (but doesn't need to live *inside* the component;\n * it can be called from an external module).\n *\n * `onMount` does not run inside a [server-side component](/docs#run-time-server-side-component-api).\n *\n * https://svelte.dev/docs#run-time-svelte-onmount\n */\nfunction onMount(fn) {\n get_current_component().$$.on_mount.push(fn);\n}\n/**\n * Schedules a callback to run immediately after the component has been updated.\n *\n * The first time the callback runs will be after the initial `onMount`\n */\nfunction afterUpdate(fn) {\n get_current_component().$$.after_update.push(fn);\n}\n/**\n * Schedules a callback to run immediately before the component is unmounted.\n *\n * Out of `onMount`, `beforeUpdate`, `afterUpdate` and `onDestroy`, this is the\n * only one that runs inside a server-side component.\n *\n * https://svelte.dev/docs#run-time-svelte-ondestroy\n */\nfunction onDestroy(fn) {\n get_current_component().$$.on_destroy.push(fn);\n}\n/**\n * Creates an event dispatcher that can be used to dispatch [component events](/docs#template-syntax-component-directives-on-eventname).\n * Event dispatchers are functions that can take two arguments: `name` and `detail`.\n *\n * Component events created with `createEventDispatcher` create a\n * [CustomEvent](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent).\n * These events do not [bubble](https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Building_blocks/Events#Event_bubbling_and_capture).\n * The `detail` argument corresponds to the [CustomEvent.detail](https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/detail)\n * property and can contain any type of data.\n *\n * https://svelte.dev/docs#run-time-svelte-createeventdispatcher\n */\nfunction createEventDispatcher() {\n const component = get_current_component();\n return (type, detail, { cancelable = false } = {}) => {\n const callbacks = component.$$.callbacks[type];\n if (callbacks) {\n // TODO are there situations where events could be dispatched\n // in a server (non-DOM) environment?\n const event = custom_event(type, detail, { cancelable });\n callbacks.slice().forEach(fn => {\n fn.call(component, event);\n });\n return !event.defaultPrevented;\n }\n return true;\n };\n}\n/**\n * Associates an arbitrary `context` object with the current component and the specified `key`\n * and returns that object. The context is then available to children of the component\n * (including slotted content) with `getContext`.\n *\n * Like lifecycle functions, this must be called during component initialisation.\n *\n * https://svelte.dev/docs#run-time-svelte-setcontext\n */\nfunction setContext(key, context) {\n get_current_component().$$.context.set(key, context);\n return context;\n}\n/**\n * Retrieves the context that belongs to the closest parent component with the specified `key`.\n * Must be called during component initialisation.\n *\n * https://svelte.dev/docs#run-time-svelte-getcontext\n */\nfunction getContext(key) {\n return get_current_component().$$.context.get(key);\n}\n/**\n * Retrieves the whole context map that belongs to the closest parent component.\n * Must be called during component initialisation. Useful, for example, if you\n * programmatically create a component and want to pass the existing context to it.\n *\n * https://svelte.dev/docs#run-time-svelte-getallcontexts\n */\nfunction getAllContexts() {\n return get_current_component().$$.context;\n}\n/**\n * Checks whether a given `key` has been set in the context of a parent component.\n * Must be called during component initialisation.\n *\n * https://svelte.dev/docs#run-time-svelte-hascontext\n */\nfunction hasContext(key) {\n return get_current_component().$$.context.has(key);\n}\n// TODO figure out if we still want to support\n// shorthand events, or if we want to implement\n// a real bubbling mechanism\nfunction bubble(component, event) {\n const callbacks = component.$$.callbacks[event.type];\n if (callbacks) {\n // @ts-ignore\n callbacks.slice().forEach(fn => fn.call(this, event));\n }\n}\n\nconst dirty_components = [];\nconst intros = { enabled: false };\nconst binding_callbacks = [];\nconst render_callbacks = [];\nconst flush_callbacks = [];\nconst resolved_promise = Promise.resolve();\nlet update_scheduled = false;\nfunction schedule_update() {\n if (!update_scheduled) {\n update_scheduled = true;\n resolved_promise.then(flush);\n }\n}\nfunction tick() {\n schedule_update();\n return resolved_promise;\n}\nfunction add_render_callback(fn) {\n render_callbacks.push(fn);\n}\nfunction add_flush_callback(fn) {\n flush_callbacks.push(fn);\n}\n// flush() calls callbacks in this order:\n// 1. All beforeUpdate callbacks, in order: parents before children\n// 2. All bind:this callbacks, in reverse order: children before parents.\n// 3. All afterUpdate callbacks, in order: parents before children. EXCEPT\n// for afterUpdates called during the initial onMount, which are called in\n// reverse order: children before parents.\n// Since callbacks might update component values, which could trigger another\n// call to flush(), the following steps guard against this:\n// 1. During beforeUpdate, any updated components will be added to the\n// dirty_components array and will cause a reentrant call to flush(). Because\n// the flush index is kept outside the function, the reentrant call will pick\n// up where the earlier call left off and go through all dirty components. The\n// current_component value is saved and restored so that the reentrant call will\n// not interfere with the \"parent\" flush() call.\n// 2. bind:this callbacks cannot trigger new flush() calls.\n// 3. During afterUpdate, any updated components will NOT have their afterUpdate\n// callback called a second time; the seen_callbacks set, outside the flush()\n// function, guarantees this behavior.\nconst seen_callbacks = new Set();\nlet flushidx = 0; // Do *not* move this inside the flush() function\nfunction flush() {\n const saved_component = current_component;\n do {\n // first, call beforeUpdate functions\n // and update components\n while (flushidx < dirty_components.length) {\n const component = dirty_components[flushidx];\n flushidx++;\n set_current_component(component);\n update(component.$$);\n }\n set_current_component(null);\n dirty_components.length = 0;\n flushidx = 0;\n while (binding_callbacks.length)\n binding_callbacks.pop()();\n // then, once components are updated, call\n // afterUpdate functions. This may cause\n // subsequent updates...\n for (let i = 0; i < render_callbacks.length; i += 1) {\n const callback = render_callbacks[i];\n if (!seen_callbacks.has(callback)) {\n // ...so guard against infinite loops\n seen_callbacks.add(callback);\n callback();\n }\n }\n render_callbacks.length = 0;\n } while (dirty_components.length);\n while (flush_callbacks.length) {\n flush_callbacks.pop()();\n }\n update_scheduled = false;\n seen_callbacks.clear();\n set_current_component(saved_component);\n}\nfunction update($$) {\n if ($$.fragment !== null) {\n $$.update();\n run_all($$.before_update);\n const dirty = $$.dirty;\n $$.dirty = [-1];\n $$.fragment && $$.fragment.p($$.ctx, dirty);\n $$.after_update.forEach(add_render_callback);\n }\n}\n\nlet promise;\nfunction wait() {\n if (!promise) {\n promise = Promise.resolve();\n promise.then(() => {\n promise = null;\n });\n }\n return promise;\n}\nfunction dispatch(node, direction, kind) {\n node.dispatchEvent(custom_event(`${direction ? 'intro' : 'outro'}${kind}`));\n}\nconst outroing = new Set();\nlet outros;\nfunction group_outros() {\n outros = {\n r: 0,\n c: [],\n p: outros // parent group\n };\n}\nfunction check_outros() {\n if (!outros.r) {\n run_all(outros.c);\n }\n outros = outros.p;\n}\nfunction transition_in(block, local) {\n if (block && block.i) {\n outroing.delete(block);\n block.i(local);\n }\n}\nfunction transition_out(block, local, detach, callback) {\n if (block && block.o) {\n if (outroing.has(block))\n return;\n outroing.add(block);\n outros.c.push(() => {\n outroing.delete(block);\n if (callback) {\n if (detach)\n block.d(1);\n callback();\n }\n });\n block.o(local);\n }\n else if (callback) {\n callback();\n }\n}\nconst null_transition = { duration: 0 };\nfunction create_in_transition(node, fn, params) {\n let config = fn(node, params);\n let running = false;\n let animation_name;\n let task;\n let uid = 0;\n function cleanup() {\n if (animation_name)\n delete_rule(node, animation_name);\n }\n function go() {\n const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition;\n if (css)\n animation_name = create_rule(node, 0, 1, duration, delay, easing, css, uid++);\n tick(0, 1);\n const start_time = now() + delay;\n const end_time = start_time + duration;\n if (task)\n task.abort();\n running = true;\n add_render_callback(() => dispatch(node, true, 'start'));\n task = loop(now => {\n if (running) {\n if (now >= end_time) {\n tick(1, 0);\n dispatch(node, true, 'end');\n cleanup();\n return running = false;\n }\n if (now >= start_time) {\n const t = easing((now - start_time) / duration);\n tick(t, 1 - t);\n }\n }\n return running;\n });\n }\n let started = false;\n return {\n start() {\n if (started)\n return;\n started = true;\n delete_rule(node);\n if (is_function(config)) {\n config = config();\n wait().then(go);\n }\n else {\n go();\n }\n },\n invalidate() {\n started = false;\n },\n end() {\n if (running) {\n cleanup();\n running = false;\n }\n }\n };\n}\nfunction create_out_transition(node, fn, params) {\n let config = fn(node, params);\n let running = true;\n let animation_name;\n const group = outros;\n group.r += 1;\n function go() {\n const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition;\n if (css)\n animation_name = create_rule(node, 1, 0, duration, delay, easing, css);\n const start_time = now() + delay;\n const end_time = start_time + duration;\n add_render_callback(() => dispatch(node, false, 'start'));\n loop(now => {\n if (running) {\n if (now >= end_time) {\n tick(0, 1);\n dispatch(node, false, 'end');\n if (!--group.r) {\n // this will result in `end()` being called,\n // so we don't need to clean up here\n run_all(group.c);\n }\n return false;\n }\n if (now >= start_time) {\n const t = easing((now - start_time) / duration);\n tick(1 - t, t);\n }\n }\n return running;\n });\n }\n if (is_function(config)) {\n wait().then(() => {\n // @ts-ignore\n config = config();\n go();\n });\n }\n else {\n go();\n }\n return {\n end(reset) {\n if (reset && config.tick) {\n config.tick(1, 0);\n }\n if (running) {\n if (animation_name)\n delete_rule(node, animation_name);\n running = false;\n }\n }\n };\n}\nfunction create_bidirectional_transition(node, fn, params, intro) {\n let config = fn(node, params);\n let t = intro ? 0 : 1;\n let running_program = null;\n let pending_program = null;\n let animation_name = null;\n function clear_animation() {\n if (animation_name)\n delete_rule(node, animation_name);\n }\n function init(program, duration) {\n const d = (program.b - t);\n duration *= Math.abs(d);\n return {\n a: t,\n b: program.b,\n d,\n duration,\n start: program.start,\n end: program.start + duration,\n group: program.group\n };\n }\n function go(b) {\n const { delay = 0, duration = 300, easing = identity, tick = noop, css } = config || null_transition;\n const program = {\n start: now() + delay,\n b\n };\n if (!b) {\n // @ts-ignore todo: improve typings\n program.group = outros;\n outros.r += 1;\n }\n if (running_program || pending_program) {\n pending_program = program;\n }\n else {\n // if this is an intro, and there's a delay, we need to do\n // an initial tick and/or apply CSS animation immediately\n if (css) {\n clear_animation();\n animation_name = create_rule(node, t, b, duration, delay, easing, css);\n }\n if (b)\n tick(0, 1);\n running_program = init(program, duration);\n add_render_callback(() => dispatch(node, b, 'start'));\n loop(now => {\n if (pending_program && now > pending_program.start) {\n running_program = init(pending_program, duration);\n pending_program = null;\n dispatch(node, running_program.b, 'start');\n if (css) {\n clear_animation();\n animation_name = create_rule(node, t, running_program.b, running_program.duration, 0, easing, config.css);\n }\n }\n if (running_program) {\n if (now >= running_program.end) {\n tick(t = running_program.b, 1 - t);\n dispatch(node, running_program.b, 'end');\n if (!pending_program) {\n // we're done\n if (running_program.b) {\n // intro — we can tidy up immediately\n clear_animation();\n }\n else {\n // outro — needs to be coordinated\n if (!--running_program.group.r)\n run_all(running_program.group.c);\n }\n }\n running_program = null;\n }\n else if (now >= running_program.start) {\n const p = now - running_program.start;\n t = running_program.a + running_program.d * easing(p / running_program.duration);\n tick(t, 1 - t);\n }\n }\n return !!(running_program || pending_program);\n });\n }\n }\n return {\n run(b) {\n if (is_function(config)) {\n wait().then(() => {\n // @ts-ignore\n config = config();\n go(b);\n });\n }\n else {\n go(b);\n }\n },\n end() {\n clear_animation();\n running_program = pending_program = null;\n }\n };\n}\n\nfunction handle_promise(promise, info) {\n const token = info.token = {};\n function update(type, index, key, value) {\n if (info.token !== token)\n return;\n info.resolved = value;\n let child_ctx = info.ctx;\n if (key !== undefined) {\n child_ctx = child_ctx.slice();\n child_ctx[key] = value;\n }\n const block = type && (info.current = type)(child_ctx);\n let needs_flush = false;\n if (info.block) {\n if (info.blocks) {\n info.blocks.forEach((block, i) => {\n if (i !== index && block) {\n group_outros();\n transition_out(block, 1, 1, () => {\n if (info.blocks[i] === block) {\n info.blocks[i] = null;\n }\n });\n check_outros();\n }\n });\n }\n else {\n info.block.d(1);\n }\n block.c();\n transition_in(block, 1);\n block.m(info.mount(), info.anchor);\n needs_flush = true;\n }\n info.block = block;\n if (info.blocks)\n info.blocks[index] = block;\n if (needs_flush) {\n flush();\n }\n }\n if (is_promise(promise)) {\n const current_component = get_current_component();\n promise.then(value => {\n set_current_component(current_component);\n update(info.then, 1, info.value, value);\n set_current_component(null);\n }, error => {\n set_current_component(current_component);\n update(info.catch, 2, info.error, error);\n set_current_component(null);\n if (!info.hasCatch) {\n throw error;\n }\n });\n // if we previously had a then/catch block, destroy it\n if (info.current !== info.pending) {\n update(info.pending, 0);\n return true;\n }\n }\n else {\n if (info.current !== info.then) {\n update(info.then, 1, info.value, promise);\n return true;\n }\n info.resolved = promise;\n }\n}\nfunction update_await_block_branch(info, ctx, dirty) {\n const child_ctx = ctx.slice();\n const { resolved } = info;\n if (info.current === info.then) {\n child_ctx[info.value] = resolved;\n }\n if (info.current === info.catch) {\n child_ctx[info.error] = resolved;\n }\n info.block.p(child_ctx, dirty);\n}\n\nconst globals = (typeof window !== 'undefined'\n ? window\n : typeof globalThis !== 'undefined'\n ? globalThis\n : global);\n\nfunction destroy_block(block, lookup) {\n block.d(1);\n lookup.delete(block.key);\n}\nfunction outro_and_destroy_block(block, lookup) {\n transition_out(block, 1, 1, () => {\n lookup.delete(block.key);\n });\n}\nfunction fix_and_destroy_block(block, lookup) {\n block.f();\n destroy_block(block, lookup);\n}\nfunction fix_and_outro_and_destroy_block(block, lookup) {\n block.f();\n outro_and_destroy_block(block, lookup);\n}\nfunction update_keyed_each(old_blocks, dirty, get_key, dynamic, ctx, list, lookup, node, destroy, create_each_block, next, get_context) {\n let o = old_blocks.length;\n let n = list.length;\n let i = o;\n const old_indexes = {};\n while (i--)\n old_indexes[old_blocks[i].key] = i;\n const new_blocks = [];\n const new_lookup = new Map();\n const deltas = new Map();\n i = n;\n while (i--) {\n const child_ctx = get_context(ctx, list, i);\n const key = get_key(child_ctx);\n let block = lookup.get(key);\n if (!block) {\n block = create_each_block(key, child_ctx);\n block.c();\n }\n else if (dynamic) {\n block.p(child_ctx, dirty);\n }\n new_lookup.set(key, new_blocks[i] = block);\n if (key in old_indexes)\n deltas.set(key, Math.abs(i - old_indexes[key]));\n }\n const will_move = new Set();\n const did_move = new Set();\n function insert(block) {\n transition_in(block, 1);\n block.m(node, next);\n lookup.set(block.key, block);\n next = block.first;\n n--;\n }\n while (o && n) {\n const new_block = new_blocks[n - 1];\n const old_block = old_blocks[o - 1];\n const new_key = new_block.key;\n const old_key = old_block.key;\n if (new_block === old_block) {\n // do nothing\n next = new_block.first;\n o--;\n n--;\n }\n else if (!new_lookup.has(old_key)) {\n // remove old block\n destroy(old_block, lookup);\n o--;\n }\n else if (!lookup.has(new_key) || will_move.has(new_key)) {\n insert(new_block);\n }\n else if (did_move.has(old_key)) {\n o--;\n }\n else if (deltas.get(new_key) > deltas.get(old_key)) {\n did_move.add(new_key);\n insert(new_block);\n }\n else {\n will_move.add(old_key);\n o--;\n }\n }\n while (o--) {\n const old_block = old_blocks[o];\n if (!new_lookup.has(old_block.key))\n destroy(old_block, lookup);\n }\n while (n)\n insert(new_blocks[n - 1]);\n return new_blocks;\n}\nfunction validate_each_keys(ctx, list, get_context, get_key) {\n const keys = new Set();\n for (let i = 0; i < list.length; i++) {\n const key = get_key(get_context(ctx, list, i));\n if (keys.has(key)) {\n throw new Error('Cannot have duplicate keys in a keyed each');\n }\n keys.add(key);\n }\n}\n\nfunction get_spread_update(levels, updates) {\n const update = {};\n const to_null_out = {};\n const accounted_for = { $$scope: 1 };\n let i = levels.length;\n while (i--) {\n const o = levels[i];\n const n = updates[i];\n if (n) {\n for (const key in o) {\n if (!(key in n))\n to_null_out[key] = 1;\n }\n for (const key in n) {\n if (!accounted_for[key]) {\n update[key] = n[key];\n accounted_for[key] = 1;\n }\n }\n levels[i] = n;\n }\n else {\n for (const key in o) {\n accounted_for[key] = 1;\n }\n }\n }\n for (const key in to_null_out) {\n if (!(key in update))\n update[key] = undefined;\n }\n return update;\n}\nfunction get_spread_object(spread_props) {\n return typeof spread_props === 'object' && spread_props !== null ? spread_props : {};\n}\n\n// source: https://html.spec.whatwg.org/multipage/indices.html\nconst boolean_attributes = new Set([\n 'allowfullscreen',\n 'allowpaymentrequest',\n 'async',\n 'autofocus',\n 'autoplay',\n 'checked',\n 'controls',\n 'default',\n 'defer',\n 'disabled',\n 'formnovalidate',\n 'hidden',\n 'inert',\n 'ismap',\n 'itemscope',\n 'loop',\n 'multiple',\n 'muted',\n 'nomodule',\n 'novalidate',\n 'open',\n 'playsinline',\n 'readonly',\n 'required',\n 'reversed',\n 'selected'\n]);\n\n/** regex of all html void element names */\nconst void_element_names = /^(?:area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/;\nfunction is_void(name) {\n return void_element_names.test(name) || name.toLowerCase() === '!doctype';\n}\n\nconst invalid_attribute_name_character = /[\\s'\">/=\\u{FDD0}-\\u{FDEF}\\u{FFFE}\\u{FFFF}\\u{1FFFE}\\u{1FFFF}\\u{2FFFE}\\u{2FFFF}\\u{3FFFE}\\u{3FFFF}\\u{4FFFE}\\u{4FFFF}\\u{5FFFE}\\u{5FFFF}\\u{6FFFE}\\u{6FFFF}\\u{7FFFE}\\u{7FFFF}\\u{8FFFE}\\u{8FFFF}\\u{9FFFE}\\u{9FFFF}\\u{AFFFE}\\u{AFFFF}\\u{BFFFE}\\u{BFFFF}\\u{CFFFE}\\u{CFFFF}\\u{DFFFE}\\u{DFFFF}\\u{EFFFE}\\u{EFFFF}\\u{FFFFE}\\u{FFFFF}\\u{10FFFE}\\u{10FFFF}]/u;\n// https://html.spec.whatwg.org/multipage/syntax.html#attributes-2\n// https://infra.spec.whatwg.org/#noncharacter\nfunction spread(args, attrs_to_add) {\n const attributes = Object.assign({}, ...args);\n if (attrs_to_add) {\n const classes_to_add = attrs_to_add.classes;\n const styles_to_add = attrs_to_add.styles;\n if (classes_to_add) {\n if (attributes.class == null) {\n attributes.class = classes_to_add;\n }\n else {\n attributes.class += ' ' + classes_to_add;\n }\n }\n if (styles_to_add) {\n if (attributes.style == null) {\n attributes.style = style_object_to_string(styles_to_add);\n }\n else {\n attributes.style = style_object_to_string(merge_ssr_styles(attributes.style, styles_to_add));\n }\n }\n }\n let str = '';\n Object.keys(attributes).forEach(name => {\n if (invalid_attribute_name_character.test(name))\n return;\n const value = attributes[name];\n if (value === true)\n str += ' ' + name;\n else if (boolean_attributes.has(name.toLowerCase())) {\n if (value)\n str += ' ' + name;\n }\n else if (value != null) {\n str += ` ${name}=\"${value}\"`;\n }\n });\n return str;\n}\nfunction merge_ssr_styles(style_attribute, style_directive) {\n const style_object = {};\n for (const individual_style of style_attribute.split(';')) {\n const colon_index = individual_style.indexOf(':');\n const name = individual_style.slice(0, colon_index).trim();\n const value = individual_style.slice(colon_index + 1).trim();\n if (!name)\n continue;\n style_object[name] = value;\n }\n for (const name in style_directive) {\n const value = style_directive[name];\n if (value) {\n style_object[name] = value;\n }\n else {\n delete style_object[name];\n }\n }\n return style_object;\n}\nconst ATTR_REGEX = /[&\"]/g;\nconst CONTENT_REGEX = /[&<]/g;\n/**\n * Note: this method is performance sensitive and has been optimized\n * https://github.com/sveltejs/svelte/pull/5701\n */\nfunction escape(value, is_attr = false) {\n const str = String(value);\n const pattern = is_attr ? ATTR_REGEX : CONTENT_REGEX;\n pattern.lastIndex = 0;\n let escaped = '';\n let last = 0;\n while (pattern.test(str)) {\n const i = pattern.lastIndex - 1;\n const ch = str[i];\n escaped += str.substring(last, i) + (ch === '&' ? '&' : (ch === '\"' ? '"' : '<'));\n last = i + 1;\n }\n return escaped + str.substring(last);\n}\nfunction escape_attribute_value(value) {\n // keep booleans, null, and undefined for the sake of `spread`\n const should_escape = typeof value === 'string' || (value && typeof value === 'object');\n return should_escape ? escape(value, true) : value;\n}\nfunction escape_object(obj) {\n const result = {};\n for (const key in obj) {\n result[key] = escape_attribute_value(obj[key]);\n }\n return result;\n}\nfunction each(items, fn) {\n let str = '';\n for (let i = 0; i < items.length; i += 1) {\n str += fn(items[i], i);\n }\n return str;\n}\nconst missing_component = {\n $$render: () => ''\n};\nfunction validate_component(component, name) {\n if (!component || !component.$$render) {\n if (name === 'svelte:component')\n name += ' this={...}';\n throw new Error(`<${name}> is not a valid SSR component. You may need to review your build config to ensure that dependencies are compiled, rather than imported as pre-compiled modules. Otherwise you may need to fix a <${name}>.`);\n }\n return component;\n}\nfunction debug(file, line, column, values) {\n console.log(`{@debug} ${file ? file + ' ' : ''}(${line}:${column})`); // eslint-disable-line no-console\n console.log(values); // eslint-disable-line no-console\n return '';\n}\nlet on_destroy;\nfunction create_ssr_component(fn) {\n function $$render(result, props, bindings, slots, context) {\n const parent_component = current_component;\n const $$ = {\n on_destroy,\n context: new Map(context || (parent_component ? parent_component.$$.context : [])),\n // these will be immediately discarded\n on_mount: [],\n before_update: [],\n after_update: [],\n callbacks: blank_object()\n };\n set_current_component({ $$ });\n const html = fn(result, props, bindings, slots);\n set_current_component(parent_component);\n return html;\n }\n return {\n render: (props = {}, { $$slots = {}, context = new Map() } = {}) => {\n on_destroy = [];\n const result = { title: '', head: '', css: new Set() };\n const html = $$render(result, props, {}, $$slots, context);\n run_all(on_destroy);\n return {\n html,\n css: {\n code: Array.from(result.css).map(css => css.code).join('\\n'),\n map: null // TODO\n },\n head: result.title + result.head\n };\n },\n $$render\n };\n}\nfunction add_attribute(name, value, boolean) {\n if (value == null || (boolean && !value))\n return '';\n const assignment = (boolean && value === true) ? '' : `=\"${escape(value, true)}\"`;\n return ` ${name}${assignment}`;\n}\nfunction add_classes(classes) {\n return classes ? ` class=\"${classes}\"` : '';\n}\nfunction style_object_to_string(style_object) {\n return Object.keys(style_object)\n .filter(key => style_object[key])\n .map(key => `${key}: ${style_object[key]};`)\n .join(' ');\n}\nfunction add_styles(style_object) {\n const styles = style_object_to_string(style_object);\n return styles ? ` style=\"${styles}\"` : '';\n}\n\nfunction bind(component, name, callback) {\n const index = component.$$.props[name];\n if (index !== undefined) {\n component.$$.bound[index] = callback;\n callback(component.$$.ctx[index]);\n }\n}\nfunction create_component(block) {\n block && block.c();\n}\nfunction claim_component(block, parent_nodes) {\n block && block.l(parent_nodes);\n}\nfunction mount_component(component, target, anchor, customElement) {\n const { fragment, after_update } = component.$$;\n fragment && fragment.m(target, anchor);\n if (!customElement) {\n // onMount happens before the initial afterUpdate\n add_render_callback(() => {\n const new_on_destroy = component.$$.on_mount.map(run).filter(is_function);\n // if the component was destroyed immediately\n // it will update the `$$.on_destroy` reference to `null`.\n // the destructured on_destroy may still reference to the old array\n if (component.$$.on_destroy) {\n component.$$.on_destroy.push(...new_on_destroy);\n }\n else {\n // Edge case - component was destroyed immediately,\n // most likely as a result of a binding initialising\n run_all(new_on_destroy);\n }\n component.$$.on_mount = [];\n });\n }\n after_update.forEach(add_render_callback);\n}\nfunction destroy_component(component, detaching) {\n const $$ = component.$$;\n if ($$.fragment !== null) {\n run_all($$.on_destroy);\n $$.fragment && $$.fragment.d(detaching);\n // TODO null out other refs, including component.$$ (but need to\n // preserve final state?)\n $$.on_destroy = $$.fragment = null;\n $$.ctx = [];\n }\n}\nfunction make_dirty(component, i) {\n if (component.$$.dirty[0] === -1) {\n dirty_components.push(component);\n schedule_update();\n component.$$.dirty.fill(0);\n }\n component.$$.dirty[(i / 31) | 0] |= (1 << (i % 31));\n}\nfunction init(component, options, instance, create_fragment, not_equal, props, append_styles, dirty = [-1]) {\n const parent_component = current_component;\n set_current_component(component);\n const $$ = component.$$ = {\n fragment: null,\n ctx: [],\n // state\n props,\n update: noop,\n not_equal,\n bound: blank_object(),\n // lifecycle\n on_mount: [],\n on_destroy: [],\n on_disconnect: [],\n before_update: [],\n after_update: [],\n context: new Map(options.context || (parent_component ? parent_component.$$.context : [])),\n // everything else\n callbacks: blank_object(),\n dirty,\n skip_bound: false,\n root: options.target || parent_component.$$.root\n };\n append_styles && append_styles($$.root);\n let ready = false;\n $$.ctx = instance\n ? instance(component, options.props || {}, (i, ret, ...rest) => {\n const value = rest.length ? rest[0] : ret;\n if ($$.ctx && not_equal($$.ctx[i], $$.ctx[i] = value)) {\n if (!$$.skip_bound && $$.bound[i])\n $$.bound[i](value);\n if (ready)\n make_dirty(component, i);\n }\n return ret;\n })\n : [];\n $$.update();\n ready = true;\n run_all($$.before_update);\n // `false` as a special case of no DOM component\n $$.fragment = create_fragment ? create_fragment($$.ctx) : false;\n if (options.target) {\n if (options.hydrate) {\n start_hydrating();\n const nodes = children(options.target);\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n $$.fragment && $$.fragment.l(nodes);\n nodes.forEach(detach);\n }\n else {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n $$.fragment && $$.fragment.c();\n }\n if (options.intro)\n transition_in(component.$$.fragment);\n mount_component(component, options.target, options.anchor, options.customElement);\n end_hydrating();\n flush();\n }\n set_current_component(parent_component);\n}\nlet SvelteElement;\nif (typeof HTMLElement === 'function') {\n SvelteElement = class extends HTMLElement {\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n }\n connectedCallback() {\n const { on_mount } = this.$$;\n this.$$.on_disconnect = on_mount.map(run).filter(is_function);\n // @ts-ignore todo: improve typings\n for (const key in this.$$.slotted) {\n // @ts-ignore todo: improve typings\n this.appendChild(this.$$.slotted[key]);\n }\n }\n attributeChangedCallback(attr, _oldValue, newValue) {\n this[attr] = newValue;\n }\n disconnectedCallback() {\n run_all(this.$$.on_disconnect);\n }\n $destroy() {\n destroy_component(this, 1);\n this.$destroy = noop;\n }\n $on(type, callback) {\n // TODO should this delegate to addEventListener?\n if (!is_function(callback)) {\n return noop;\n }\n const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));\n callbacks.push(callback);\n return () => {\n const index = callbacks.indexOf(callback);\n if (index !== -1)\n callbacks.splice(index, 1);\n };\n }\n $set($$props) {\n if (this.$$set && !is_empty($$props)) {\n this.$$.skip_bound = true;\n this.$$set($$props);\n this.$$.skip_bound = false;\n }\n }\n };\n}\n/**\n * Base class for Svelte components. Used when dev=false.\n */\nclass SvelteComponent {\n $destroy() {\n destroy_component(this, 1);\n this.$destroy = noop;\n }\n $on(type, callback) {\n if (!is_function(callback)) {\n return noop;\n }\n const callbacks = (this.$$.callbacks[type] || (this.$$.callbacks[type] = []));\n callbacks.push(callback);\n return () => {\n const index = callbacks.indexOf(callback);\n if (index !== -1)\n callbacks.splice(index, 1);\n };\n }\n $set($$props) {\n if (this.$$set && !is_empty($$props)) {\n this.$$.skip_bound = true;\n this.$$set($$props);\n this.$$.skip_bound = false;\n }\n }\n}\n\nfunction dispatch_dev(type, detail) {\n document.dispatchEvent(custom_event(type, Object.assign({ version: '3.53.1' }, detail), { bubbles: true }));\n}\nfunction append_dev(target, node) {\n dispatch_dev('SvelteDOMInsert', { target, node });\n append(target, node);\n}\nfunction append_hydration_dev(target, node) {\n dispatch_dev('SvelteDOMInsert', { target, node });\n append_hydration(target, node);\n}\nfunction insert_dev(target, node, anchor) {\n dispatch_dev('SvelteDOMInsert', { target, node, anchor });\n insert(target, node, anchor);\n}\nfunction insert_hydration_dev(target, node, anchor) {\n dispatch_dev('SvelteDOMInsert', { target, node, anchor });\n insert_hydration(target, node, anchor);\n}\nfunction detach_dev(node) {\n dispatch_dev('SvelteDOMRemove', { node });\n detach(node);\n}\nfunction detach_between_dev(before, after) {\n while (before.nextSibling && before.nextSibling !== after) {\n detach_dev(before.nextSibling);\n }\n}\nfunction detach_before_dev(after) {\n while (after.previousSibling) {\n detach_dev(after.previousSibling);\n }\n}\nfunction detach_after_dev(before) {\n while (before.nextSibling) {\n detach_dev(before.nextSibling);\n }\n}\nfunction listen_dev(node, event, handler, options, has_prevent_default, has_stop_propagation) {\n const modifiers = options === true ? ['capture'] : options ? Array.from(Object.keys(options)) : [];\n if (has_prevent_default)\n modifiers.push('preventDefault');\n if (has_stop_propagation)\n modifiers.push('stopPropagation');\n dispatch_dev('SvelteDOMAddEventListener', { node, event, handler, modifiers });\n const dispose = listen(node, event, handler, options);\n return () => {\n dispatch_dev('SvelteDOMRemoveEventListener', { node, event, handler, modifiers });\n dispose();\n };\n}\nfunction attr_dev(node, attribute, value) {\n attr(node, attribute, value);\n if (value == null)\n dispatch_dev('SvelteDOMRemoveAttribute', { node, attribute });\n else\n dispatch_dev('SvelteDOMSetAttribute', { node, attribute, value });\n}\nfunction prop_dev(node, property, value) {\n node[property] = value;\n dispatch_dev('SvelteDOMSetProperty', { node, property, value });\n}\nfunction dataset_dev(node, property, value) {\n node.dataset[property] = value;\n dispatch_dev('SvelteDOMSetDataset', { node, property, value });\n}\nfunction set_data_dev(text, data) {\n data = '' + data;\n if (text.wholeText === data)\n return;\n dispatch_dev('SvelteDOMSetData', { node: text, data });\n text.data = data;\n}\nfunction validate_each_argument(arg) {\n if (typeof arg !== 'string' && !(arg && typeof arg === 'object' && 'length' in arg)) {\n let msg = '{#each} only iterates over array-like objects.';\n if (typeof Symbol === 'function' && arg && Symbol.iterator in arg) {\n msg += ' You can use a spread to convert this iterable into an array.';\n }\n throw new Error(msg);\n }\n}\nfunction validate_slots(name, slot, keys) {\n for (const slot_key of Object.keys(slot)) {\n if (!~keys.indexOf(slot_key)) {\n console.warn(`<${name}> received an unexpected slot \"${slot_key}\".`);\n }\n }\n}\nfunction validate_dynamic_element(tag) {\n const is_string = typeof tag === 'string';\n if (tag && !is_string) {\n throw new Error(' expects \"this\" attribute to be a string.');\n }\n}\nfunction validate_void_dynamic_element(tag) {\n if (tag && is_void(tag)) {\n console.warn(` is self-closing and cannot have content.`);\n }\n}\nfunction construct_svelte_component_dev(component, props) {\n const error_message = 'this={...} of should specify a Svelte component.';\n try {\n const instance = new component(props);\n if (!instance.$$ || !instance.$set || !instance.$on || !instance.$destroy) {\n throw new Error(error_message);\n }\n return instance;\n }\n catch (err) {\n const { message } = err;\n if (typeof message === 'string' && message.indexOf('is not a constructor') !== -1) {\n throw new Error(error_message);\n }\n else {\n throw err;\n }\n }\n}\n/**\n * Base class for Svelte components with some minor dev-enhancements. Used when dev=true.\n */\nclass SvelteComponentDev extends SvelteComponent {\n constructor(options) {\n if (!options || (!options.target && !options.$$inline)) {\n throw new Error(\"'target' is a required option\");\n }\n super();\n }\n $destroy() {\n super.$destroy();\n this.$destroy = () => {\n console.warn('Component was already destroyed'); // eslint-disable-line no-console\n };\n }\n $capture_state() { }\n $inject_state() { }\n}\n/**\n * Base class to create strongly typed Svelte components.\n * This only exists for typing purposes and should be used in `.d.ts` files.\n *\n * ### Example:\n *\n * You have component library on npm called `component-library`, from which\n * you export a component called `MyComponent`. For Svelte+TypeScript users,\n * you want to provide typings. Therefore you create a `index.d.ts`:\n * ```ts\n * import { SvelteComponentTyped } from \"svelte\";\n * export class MyComponent extends SvelteComponentTyped<{foo: string}> {}\n * ```\n * Typing this makes it possible for IDEs like VS Code with the Svelte extension\n * to provide intellisense and to use the component like this in a Svelte file\n * with TypeScript:\n * ```svelte\n * \n * \n * ```\n *\n * #### Why not make this part of `SvelteComponent(Dev)`?\n * Because\n * ```ts\n * class ASubclassOfSvelteComponent extends SvelteComponent<{foo: string}> {}\n * const component: typeof SvelteComponent = ASubclassOfSvelteComponent;\n * ```\n * will throw a type error, so we need to separate the more strictly typed class.\n */\nclass SvelteComponentTyped extends SvelteComponentDev {\n constructor(options) {\n super(options);\n }\n}\nfunction loop_guard(timeout) {\n const start = Date.now();\n return () => {\n if (Date.now() - start > timeout) {\n throw new Error('Infinite loop detected');\n }\n };\n}\n\nexport { HtmlTag, HtmlTagHydration, SvelteComponent, SvelteComponentDev, SvelteComponentTyped, SvelteElement, action_destroyer, add_attribute, add_classes, add_flush_callback, add_location, add_render_callback, add_resize_listener, add_styles, add_transform, afterUpdate, append, append_dev, append_empty_stylesheet, append_hydration, append_hydration_dev, append_styles, assign, attr, attr_dev, attribute_to_object, beforeUpdate, bind, binding_callbacks, blank_object, bubble, check_outros, children, claim_component, claim_element, claim_html_tag, claim_space, claim_svg_element, claim_text, clear_loops, component_subscribe, compute_rest_props, compute_slots, construct_svelte_component, construct_svelte_component_dev, createEventDispatcher, create_animation, create_bidirectional_transition, create_component, create_in_transition, create_out_transition, create_slot, create_ssr_component, current_component, custom_event, dataset_dev, debug, destroy_block, destroy_component, destroy_each, detach, detach_after_dev, detach_before_dev, detach_between_dev, detach_dev, dirty_components, dispatch_dev, each, element, element_is, empty, end_hydrating, escape, escape_attribute_value, escape_object, exclude_internal_props, fix_and_destroy_block, fix_and_outro_and_destroy_block, fix_position, flush, getAllContexts, getContext, get_all_dirty_from_scope, get_binding_group_value, get_current_component, get_custom_elements_slots, get_root_for_style, get_slot_changes, get_spread_object, get_spread_update, get_store_value, globals, group_outros, handle_promise, hasContext, has_prop, head_selector, identity, init, insert, insert_dev, insert_hydration, insert_hydration_dev, intros, invalid_attribute_name_character, is_client, is_crossorigin, is_empty, is_function, is_promise, is_void, listen, listen_dev, loop, loop_guard, merge_ssr_styles, missing_component, mount_component, noop, not_equal, now, null_to_empty, object_without_properties, onDestroy, onMount, once, outro_and_destroy_block, prevent_default, prop_dev, query_selector_all, raf, run, run_all, safe_not_equal, schedule_update, select_multiple_value, select_option, select_options, select_value, self, setContext, set_attributes, set_current_component, set_custom_element_data, set_custom_element_data_map, set_data, set_data_dev, set_input_type, set_input_value, set_now, set_raf, set_store_value, set_style, set_svg_attributes, space, spread, src_url_equal, start_hydrating, stop_propagation, subscribe, svg_element, text, tick, time_ranges_to_array, to_number, toggle_class, transition_in, transition_out, trusted, update_await_block_branch, update_keyed_each, update_slot, update_slot_base, validate_component, validate_dynamic_element, validate_each_argument, validate_each_keys, validate_slots, validate_store, validate_void_dynamic_element, xlink_attr };\n","import { noop, safe_not_equal, subscribe, run_all, is_function } from '../internal/index.mjs';\nexport { get_store_value as get } from '../internal/index.mjs';\n\nconst subscriber_queue = [];\n/**\n * Creates a `Readable` store that allows reading by subscription.\n * @param value initial value\n * @param {StartStopNotifier}start start and stop notifications for subscriptions\n */\nfunction readable(value, start) {\n return {\n subscribe: writable(value, start).subscribe\n };\n}\n/**\n * Create a `Writable` store that allows both updating and reading by subscription.\n * @param {*=}value initial value\n * @param {StartStopNotifier=}start start and stop notifications for subscriptions\n */\nfunction writable(value, start = noop) {\n let stop;\n const subscribers = new Set();\n function set(new_value) {\n if (safe_not_equal(value, new_value)) {\n value = new_value;\n if (stop) { // store is ready\n const run_queue = !subscriber_queue.length;\n for (const subscriber of subscribers) {\n subscriber[1]();\n subscriber_queue.push(subscriber, value);\n }\n if (run_queue) {\n for (let i = 0; i < subscriber_queue.length; i += 2) {\n subscriber_queue[i][0](subscriber_queue[i + 1]);\n }\n subscriber_queue.length = 0;\n }\n }\n }\n }\n function update(fn) {\n set(fn(value));\n }\n function subscribe(run, invalidate = noop) {\n const subscriber = [run, invalidate];\n subscribers.add(subscriber);\n if (subscribers.size === 1) {\n stop = start(set) || noop;\n }\n run(value);\n return () => {\n subscribers.delete(subscriber);\n if (subscribers.size === 0) {\n stop();\n stop = null;\n }\n };\n }\n return { set, update, subscribe };\n}\nfunction derived(stores, fn, initial_value) {\n const single = !Array.isArray(stores);\n const stores_array = single\n ? [stores]\n : stores;\n const auto = fn.length < 2;\n return readable(initial_value, (set) => {\n let inited = false;\n const values = [];\n let pending = 0;\n let cleanup = noop;\n const sync = () => {\n if (pending) {\n return;\n }\n cleanup();\n const result = fn(single ? values[0] : values, set);\n if (auto) {\n set(result);\n }\n else {\n cleanup = is_function(result) ? result : noop;\n }\n };\n const unsubscribers = stores_array.map((store, i) => subscribe(store, (value) => {\n values[i] = value;\n pending &= ~(1 << i);\n if (inited) {\n sync();\n }\n }, () => {\n pending |= (1 << i);\n }));\n inited = true;\n sync();\n return function stop() {\n run_all(unsubscribers);\n cleanup();\n };\n });\n}\n\nexport { derived, readable, writable };\n","\n\n{#if componentParams}\n \n{:else}\n \n{/if}\n\n\n","export function parse(str, loose) {\n\tif (str instanceof RegExp) return { keys:false, pattern:str };\n\tvar c, o, tmp, ext, keys=[], pattern='', arr = str.split('/');\n\tarr[0] || arr.shift();\n\n\twhile (tmp = arr.shift()) {\n\t\tc = tmp[0];\n\t\tif (c === '*') {\n\t\t\tkeys.push('wild');\n\t\t\tpattern += '/(.*)';\n\t\t} else if (c === ':') {\n\t\t\to = tmp.indexOf('?', 1);\n\t\t\text = tmp.indexOf('.', 1);\n\t\t\tkeys.push( tmp.substring(1, !!~o ? o : !!~ext ? ext : tmp.length) );\n\t\t\tpattern += !!~o && !~ext ? '(?:/([^/]+?))?' : '/([^/]+?)';\n\t\t\tif (!!~ext) pattern += (!!~o ? '?' : '') + '\\\\' + tmp.substring(ext);\n\t\t} else {\n\t\t\tpattern += '/' + tmp;\n\t\t}\n\t}\n\n\treturn {\n\t\tkeys: keys,\n\t\tpattern: new RegExp('^' + pattern + (loose ? '(?=$|\\/)' : '\\/?$'), 'i')\n\t};\n}\n\nvar RGX = /*#__PURE__*/ /(\\/|^)([:*][^/]*?)(\\?)?(?=[/.]|$)/g;\n\n// error if key missing?\nexport function inject(route, values) {\n\treturn route.replace(RGX, (x, lead, key, optional) => {\n\t\tx = values[key=='*' ? 'wild' : key.substring(1)];\n\t\treturn x ? '/'+x : (optional || key=='*') ? '' : '/' + key;\n\t});\n}\n","\n\n\n {#if Boolean(onClose)}\n \n","\n\n\n
\n \n
\n \n
\n
\n Cancel\n Save\n
\n\n","\n\n\n \n \"S4TK\"\n

S4TK Package {titleSuffix}

\n \n
\n \n
\n\n\n{#if settingsOpen}\n \n (settingsOpen = false)} />\n \n{/if}\n\n\n","\n
\n
\n

\n Created with by Frankk using Sims\n 4 Toolkit\n

\n

\n Frankk's Mods\n |\n Sims 4 Toolkit\n |\n Twitter\n |\n Patreon\n |\n Ko-fi\n |\n Discord\n

\n
\n
\n

\n The Sims™ and its plumbob icon are registered trademarks of Electronic\n Arts, Inc. (EA). Sims 4 Toolkit is not affiliated with or endorsed by\n EA.\n

\n

\n All icons on this website are supplied by\n Ionicons\n and\n GitHub Octicons.\n

\n

2023 © Frankk

\n
\n
\n\n","\n\n\n
\n \n
\n

\n {title}\n

\n

{subtitle}

\n
\n
\n
\n\n\n","\n\n\n S4TK Package Tools\n\n\n
\n \n
\n \n
\n
\n \n \n
\n \n
\n