diff --git a/src/profiles/web/dist/assets/index-BPqTLQSc.css b/src/profiles/web/dist/assets/index-BPqTLQSc.css deleted file mode 100644 index 59e07f2..0000000 --- a/src/profiles/web/dist/assets/index-BPqTLQSc.css +++ /dev/null @@ -1 +0,0 @@ -/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-800:oklch(43.2% .095 166.913);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-900:oklch(20.8% .042 265.755);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-xs:4px;--blur-sm:8px;--blur-md:12px;--blur-xl:24px;--aspect-video:16 / 9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components{.glass-panel{background:var(--app-glass-panel);-webkit-backdrop-filter:blur(24px)saturate(160%);backdrop-filter:blur(24px)saturate(160%);box-shadow:var(--app-panel-shadow),inset 0 1px 0 var(--app-glass-highlight)}.glass-panel-strong{background:var(--app-glass-panel-strong);-webkit-backdrop-filter:blur(28px)saturate(180%);backdrop-filter:blur(28px)saturate(180%);box-shadow:var(--app-panel-shadow),inset 0 1px 0 var(--app-glass-highlight)}.btn{justify-content:center;align-items:center;gap:calc(var(--spacing) * 1.5);border-radius:var(--radius-md);border-style:var(--tw-border-style);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));border-width:1px;display:inline-flex}.btn:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-ring-color:#625fffb3}@supports (color:color-mix(in lab,red,red)){.btn:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 70%, transparent)}}.btn:focus-visible{--tw-outline-style:none;outline-style:none}.btn:disabled{cursor:not-allowed;opacity:.4}.btn-primary{background-color:var(--color-indigo-600);color:var(--color-white);border-color:#0000}@media(hover:hover){.btn-primary:hover{background-color:var(--color-indigo-500)}}.btn-secondary{border-color:var(--app-border);background-color:var(--app-elevated);color:var(--app-text-secondary)}@media(hover:hover){.btn-secondary:hover{border-color:var(--color-indigo-500);color:var(--app-text-primary)}.btn-chip:hover{--tw-brightness:brightness(95%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.btn-chip:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-ring-color:#625fffb3}@supports (color:color-mix(in lab,red,red)){.btn-chip:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 70%, transparent)}}.btn-chip:focus-visible{--tw-outline-style:none;outline-style:none}.btn-chip:disabled{cursor:not-allowed;opacity:.4}.focus-ring:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-ring-color:#625fffb3}@supports (color:color-mix(in lab,red,red)){.focus-ring:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 70%, transparent)}}.focus-ring:focus-visible{--tw-outline-style:none;outline-style:none}}@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{inset-block:0}.-top-1{top:calc(var(--spacing) * -1)}.top-0{top:0}.top-1\/2{top:50%}.top-2{top:calc(var(--spacing) * 2)}.top-full{top:100%}.-right-0\.5{right:calc(var(--spacing) * -.5)}.-right-1{right:calc(var(--spacing) * -1)}.right-0{right:0}.right-2{right:calc(var(--spacing) * 2)}.-bottom-0\.5{bottom:calc(var(--spacing) * -.5)}.-bottom-1{bottom:calc(var(--spacing) * -1)}.bottom-0{bottom:0}.bottom-2{bottom:calc(var(--spacing) * 2)}.-left-1{left:calc(var(--spacing) * -1)}.left-0{left:0}.left-1\/2{left:50%}.left-2\.5{left:calc(var(--spacing) * 2.5)}.left-3{left:calc(var(--spacing) * 3)}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-\[calc\(var\(--z-context-menu\)-1\)\]{z-index:calc(var(--z-context-menu) - 1)}.z-\[var\(--z-combobox-list\)\]{z-index:var(--z-combobox-list)}.z-\[var\(--z-context-menu\)\]{z-index:var(--z-context-menu)}.z-\[var\(--z-drop-overlay\)\]{z-index:var(--z-drop-overlay)}.z-\[var\(--z-modal\)\]{z-index:var(--z-modal)}.z-\[var\(--z-syntax-helper\)\]{z-index:var(--z-syntax-helper)}.z-\[var\(--z-toast\)\]{z-index:var(--z-toast)}.z-\[var\(--z-tooltip\)\]{z-index:var(--z-tooltip)}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.container\!{width:100%!important}@media(min-width:40rem){.container\!{max-width:40rem!important}}@media(min-width:48rem){.container\!{max-width:48rem!important}}@media(min-width:64rem){.container\!{max-width:64rem!important}}@media(min-width:80rem){.container\!{max-width:80rem!important}}@media(min-width:96rem){.container\!{max-width:96rem!important}}.mx-1{margin-inline:var(--spacing)}.mx-auto{margin-inline:auto}.my-1{margin-block:var(--spacing)}.my-1\.5{margin-block:calc(var(--spacing) * 1.5)}.my-2{margin-block:calc(var(--spacing) * 2)}.my-3{margin-block:calc(var(--spacing) * 3)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mr-1\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-auto{margin-right:auto}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:var(--spacing)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.list-item{display:list-item}.table{display:table}.aspect-video{aspect-ratio:var(--aspect-video)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-12{height:calc(var(--spacing) * 12)}.h-48{height:calc(var(--spacing) * 48)}.h-\[80vh\]{height:80vh}.h-\[90vh\]{height:90vh}.h-\[min\(84dvh\,760px\)\]{height:min(84dvh,760px)}.h-dvh{height:100dvh}.h-full{height:100%}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-60{max-height:calc(var(--spacing) * 60)}.max-h-\[60vh\]{max-height:60vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(100dvh-1\.5rem\)\]{max-height:calc(100dvh - 1.5rem)}.max-h-\[calc\(100dvh-2rem\)\]{max-height:calc(100dvh - 2rem)}.max-h-\[calc\(100dvh-16px\)\]{max-height:calc(100dvh - 16px)}.min-h-0{min-height:0}.min-h-9{min-height:calc(var(--spacing) * 9)}.min-h-10{min-height:calc(var(--spacing) * 10)}.min-h-16{min-height:calc(var(--spacing) * 16)}.min-h-24{min-height:calc(var(--spacing) * 24)}.min-h-36{min-height:calc(var(--spacing) * 36)}.min-h-\[24px\]{min-height:24px}.min-h-\[44px\]{min-height:44px}.min-h-screen{min-height:100vh}.w-1\/3{width:33.3333%}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-12{width:calc(var(--spacing) * 12)}.w-44{width:calc(var(--spacing) * 44)}.w-48{width:calc(var(--spacing) * 48)}.w-56{width:calc(var(--spacing) * 56)}.w-72{width:calc(var(--spacing) * 72)}.w-96{width:calc(var(--spacing) * 96)}.w-\[52px\]{width:52px}.w-\[138px\]{width:138px}.w-\[150px\]{width:150px}.w-\[280px\]{width:280px}.w-\[400px\]{width:400px}.w-\[420px\]{width:420px}.w-\[450px\]{width:450px}.w-\[clamp\(560px\,85vw\,1500px\)\]{width:clamp(560px,85vw,1500px)}.w-\[min\(94vw\,560px\)\]{width:min(94vw,560px)}.w-\[min\(94vw\,960px\)\]{width:min(94vw,960px)}.w-full{width:100%}.w-max{width:max-content}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-\[220px\]{max-width:220px}.max-w-\[calc\(100vw-16px\)\]{max-width:calc(100vw - 16px)}.max-w-\[min\(70vw\,560px\)\]{max-width:min(70vw,560px)}.max-w-\[min\(80vw\,640px\)\]{max-width:min(80vw,640px)}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:0}.min-w-48{min-width:calc(var(--spacing) * 48)}.min-w-\[100px\]{min-width:100px}.min-w-\[220px\]{min-width:220px}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.basis-64{flex-basis:calc(var(--spacing) * 64)}.basis-full{flex-basis:100%}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-45{rotate:45deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize{resize:both}.resize\!{resize:both!important}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-3\.5{gap:calc(var(--spacing) * 3.5)}.gap-4{gap:calc(var(--spacing) * 4)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overscroll-contain{overscroll-behavior:contain}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-l-md{border-top-left-radius:var(--radius-md);border-bottom-left-radius:var(--radius-md)}.rounded-r-md{border-top-right-radius:var(--radius-md);border-bottom-right-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-r-2{border-right-style:var(--tw-border-style);border-right-width:2px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-0{border-left-style:var(--tw-border-style);border-left-width:0}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-\[var\(--app-editor-border\)\]{border-color:var(--app-editor-border)}.border-chip-amber-border{border-color:var(--chip-amber-border)}.border-chip-fuchsia-border{border-color:var(--chip-fuchsia-border)}.border-chip-indigo-border,.border-chip-indigo-border\/50{border-color:var(--chip-indigo-border)}@supports (color:color-mix(in lab,red,red)){.border-chip-indigo-border\/50{border-color:color-mix(in oklab,var(--chip-indigo-border) 50%,transparent)}}.border-chip-purple-border,.border-chip-purple-border\/50{border-color:var(--chip-purple-border)}@supports (color:color-mix(in lab,red,red)){.border-chip-purple-border\/50{border-color:color-mix(in oklab,var(--chip-purple-border) 50%,transparent)}}.border-chip-sky-border{border-color:var(--chip-sky-border)}.border-emerald-300\/50{border-color:#5ee9b580}@supports (color:color-mix(in lab,red,red)){.border-emerald-300\/50{border-color:color-mix(in oklab,var(--color-emerald-300) 50%,transparent)}}.border-emerald-500\/30{border-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/30{border-color:color-mix(in oklab,var(--color-emerald-500) 30%,transparent)}}.border-frame-line{border-color:var(--app-frame-border)}.border-indigo-400{border-color:var(--color-indigo-400)}.border-indigo-400\/80{border-color:#7d87ffcc}@supports (color:color-mix(in lab,red,red)){.border-indigo-400\/80{border-color:color-mix(in oklab,var(--color-indigo-400) 80%,transparent)}}.border-indigo-600{border-color:var(--color-indigo-600)}.border-line,.border-line\/40{border-color:var(--app-border)}@supports (color:color-mix(in lab,red,red)){.border-line\/40{border-color:color-mix(in oklab,var(--app-border) 40%,transparent)}}.border-line\/60{border-color:var(--app-border)}@supports (color:color-mix(in lab,red,red)){.border-line\/60{border-color:color-mix(in oklab,var(--app-border) 60%,transparent)}}.border-slate-500\/30{border-color:#62748e4d}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/30{border-color:color-mix(in oklab,var(--color-slate-500) 30%,transparent)}}.border-status-danger-border{border-color:var(--status-danger-border)}.border-status-success-border{border-color:var(--status-success-border)}.border-status-warning-border{border-color:var(--status-warning-border)}.border-transparent{border-color:#0000}.border-t-transparent{border-top-color:#0000}.border-l-transparent{border-left-color:#0000}.bg-\[var\(--app-editor-bg\)\]{background-color:var(--app-editor-bg)}.bg-app,.bg-app\/90{background-color:var(--app-bg)}@supports (color:color-mix(in lab,red,red)){.bg-app\/90{background-color:color-mix(in oklab,var(--app-bg) 90%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.bg-black\/20{background-color:color-mix(in oklab,var(--color-black) 20%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.bg-black\/65{background-color:#000000a6}@supports (color:color-mix(in lab,red,red)){.bg-black\/65{background-color:color-mix(in oklab,var(--color-black) 65%,transparent)}}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black) 70%,transparent)}}.bg-chip-amber-bg{background-color:var(--chip-amber-bg)}.bg-chip-fuchsia-bg{background-color:var(--chip-fuchsia-bg)}.bg-chip-indigo-bg,.bg-chip-indigo-bg\/20{background-color:var(--chip-indigo-bg)}@supports (color:color-mix(in lab,red,red)){.bg-chip-indigo-bg\/20{background-color:color-mix(in oklab,var(--chip-indigo-bg) 20%,transparent)}}.bg-chip-purple-bg{background-color:var(--chip-purple-bg)}.bg-chip-sky-bg{background-color:var(--chip-sky-bg)}.bg-elevated,.bg-elevated\/30{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.bg-elevated\/30{background-color:color-mix(in oklab,var(--app-elevated) 30%,transparent)}}.bg-elevated\/50{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.bg-elevated\/50{background-color:color-mix(in oklab,var(--app-elevated) 50%,transparent)}}.bg-elevated\/60{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.bg-elevated\/60{background-color:color-mix(in oklab,var(--app-elevated) 60%,transparent)}}.bg-emerald-400{background-color:var(--color-emerald-400)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-600{background-color:var(--color-emerald-600)}.bg-emerald-800\/60{background-color:#005f4699}@supports (color:color-mix(in lab,red,red)){.bg-emerald-800\/60{background-color:color-mix(in oklab,var(--color-emerald-800) 60%,transparent)}}.bg-indigo-500\/5{background-color:#625fff0d}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/5{background-color:color-mix(in oklab,var(--color-indigo-500) 5%,transparent)}}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-ink-faint{background-color:var(--app-text-faint)}.bg-slate-600\/20{background-color:#45556c33}@supports (color:color-mix(in lab,red,red)){.bg-slate-600\/20{background-color:color-mix(in oklab,var(--color-slate-600) 20%,transparent)}}.bg-status-danger-bg,.bg-status-danger-bg\/30{background-color:var(--status-danger-bg)}@supports (color:color-mix(in lab,red,red)){.bg-status-danger-bg\/30{background-color:color-mix(in oklab,var(--status-danger-bg) 30%,transparent)}}.bg-status-danger-bg\/40{background-color:var(--status-danger-bg)}@supports (color:color-mix(in lab,red,red)){.bg-status-danger-bg\/40{background-color:color-mix(in oklab,var(--status-danger-bg) 40%,transparent)}}.bg-status-success-bg{background-color:var(--status-success-bg)}.bg-status-warning-bg{background-color:var(--status-warning-bg)}.bg-surface{background-color:var(--app-surface)}.bg-surface-glass{background-color:var(--app-glass)}.bg-surface-strong,.bg-surface-strong\/20{background-color:var(--app-glass-strong)}@supports (color:color-mix(in lab,red,red)){.bg-surface-strong\/20{background-color:color-mix(in oklab,var(--app-glass-strong) 20%,transparent)}}.bg-surface-strong\/30{background-color:var(--app-glass-strong)}@supports (color:color-mix(in lab,red,red)){.bg-surface-strong\/30{background-color:color-mix(in oklab,var(--app-glass-strong) 30%,transparent)}}.bg-surface\/50{background-color:var(--app-surface)}@supports (color:color-mix(in lab,red,red)){.bg-surface\/50{background-color:color-mix(in oklab,var(--app-surface) 50%,transparent)}}.bg-surface\/60{background-color:var(--app-surface)}@supports (color:color-mix(in lab,red,red)){.bg-surface\/60{background-color:color-mix(in oklab,var(--app-surface) 60%,transparent)}}.bg-white{background-color:var(--color-white)}.bg-white\/90{background-color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.bg-white\/90{background-color:color-mix(in oklab,var(--color-white) 90%,transparent)}}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-chip-indigo-bg{--tw-gradient-from:var(--chip-indigo-bg);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-400\/90{--tw-gradient-from:#00d294e6}@supports (color:color-mix(in lab,red,red)){.from-emerald-400\/90{--tw-gradient-from:color-mix(in oklab, var(--color-emerald-400) 90%, transparent)}}.from-emerald-400\/90{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-chip-purple-bg{--tw-gradient-to:var(--chip-purple-bg);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-600\/90{--tw-gradient-to:#009767e6}@supports (color:color-mix(in lab,red,red)){.to-emerald-600\/90{--tw-gradient-to:color-mix(in oklab, var(--color-emerald-600) 90%, transparent)}}.to-emerald-600\/90{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.fill-current{fill:currentColor}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-3\.5{padding-block:calc(var(--spacing) * 3.5)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-px{padding-block:1px}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pr-1{padding-right:var(--spacing)}.pr-2\.5{padding-right:calc(var(--spacing) * 2.5)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-5{padding-left:calc(var(--spacing) * 5)}.pl-8{padding-left:calc(var(--spacing) * 8)}.pl-9{padding-left:calc(var(--spacing) * 9)}.text-center{text-align:center}.text-left{text-align:left}.align-\[1px\]{vertical-align:1px}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-chip-amber-text{color:var(--chip-amber-text)}.text-chip-fuchsia-text{color:var(--chip-fuchsia-text)}.text-chip-indigo-text{color:var(--chip-indigo-text)}.text-chip-purple-text{color:var(--chip-purple-text)}.text-chip-sky-text{color:var(--chip-sky-text)}.text-emerald-200{color:var(--color-emerald-200)}.text-ink{color:var(--app-text-primary)}.text-ink-faint{color:var(--app-text-faint)}.text-ink-muted,.text-ink-muted\/50{color:var(--app-text-muted)}@supports (color:color-mix(in lab,red,red)){.text-ink-muted\/50{color:color-mix(in oklab,var(--app-text-muted) 50%,transparent)}}.text-ink-secondary{color:var(--app-text-secondary)}.text-ink\/70{color:var(--app-text-primary)}@supports (color:color-mix(in lab,red,red)){.text-ink\/70{color:color-mix(in oklab,var(--app-text-primary) 70%,transparent)}}.text-slate-300{color:var(--color-slate-300)}.text-slate-400{color:var(--color-slate-400)}.text-slate-900{color:var(--color-slate-900)}.text-status-danger-text,.text-status-danger-text\/60{color:var(--status-danger-text)}@supports (color:color-mix(in lab,red,red)){.text-status-danger-text\/60{color:color-mix(in oklab,var(--status-danger-text) 60%,transparent)}}.text-status-danger-text\/70{color:var(--status-danger-text)}@supports (color:color-mix(in lab,red,red)){.text-status-danger-text\/70{color:color-mix(in oklab,var(--status-danger-text) 70%,transparent)}}.text-status-danger-text\/80{color:var(--status-danger-text)}@supports (color:color-mix(in lab,red,red)){.text-status-danger-text\/80{color:color-mix(in oklab,var(--status-danger-text) 80%,transparent)}}.text-status-danger-text\/90{color:var(--status-danger-text)}@supports (color:color-mix(in lab,red,red)){.text-status-danger-text\/90{color:color-mix(in oklab,var(--status-danger-text) 90%,transparent)}}.text-status-success-text{color:var(--status-success-text)}.text-status-warning-text{color:var(--status-warning-text)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.placeholder-ink-faint::placeholder{color:var(--app-text-faint)}.opacity-0{opacity:0}.opacity-40{opacity:.4}.opacity-90{opacity:.9}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_0_9999px_rgba\(0\,0\,0\,0\.45\)\]{--tw-shadow:0 0 0 9999px var(--tw-shadow-color,#00000073);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_2px_6px_rgb\(0_0_0\/0\.35\)\]{--tw-shadow:0 2px 6px var(--tw-shadow-color,#00000059);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[inset_0_1px_0_rgb\(255_255_255\/0\.12\)\]{--tw-shadow:inset 0 1px 0 var(--tw-shadow-color,#ffffff1f);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[inset_0_1px_0_rgb\(255_255_255\/0\.35\)\,0_8px_24px_-6px_rgb\(16_185_129\/0\.55\)\]{--tw-shadow:inset 0 1px 0 var(--tw-shadow-color,#ffffff59), 0 8px 24px -6px var(--tw-shadow-color,#10b9818c);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-app{--tw-ring-color:var(--app-bg)}.ring-chip-indigo-border\/40{--tw-ring-color:var(--chip-indigo-border)}@supports (color:color-mix(in lab,red,red)){.ring-chip-indigo-border\/40{--tw-ring-color:color-mix(in oklab, var(--chip-indigo-border) 40%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter\!{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)!important}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-xs{--tw-backdrop-blur:blur(var(--blur-xs));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[filter\,box-shadow\,transform\]{transition-property:filter,box-shadow,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}@media(hover:hover){.group-hover\:text-white:is(:where(.group):hover *){color:var(--color-white)}.group-hover\:opacity-40:is(:where(.group):hover *){opacity:.4}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.selection\:bg-indigo-500 ::selection{background-color:var(--color-indigo-500)}.selection\:bg-indigo-500::selection{background-color:var(--color-indigo-500)}.selection\:text-white ::selection{color:var(--color-white)}.selection\:text-white::selection{color:var(--color-white)}.placeholder\:text-ink-faint::placeholder{color:var(--app-text-faint)}.first\:mt-0:first-child{margin-top:0}.last\:mb-0:last-child{margin-bottom:0}@media(hover:hover){.hover\:-translate-y-px:hover{--tw-translate-y:-1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\:border-chip-indigo-border:hover{border-color:var(--chip-indigo-border)}.hover\:border-indigo-400:hover{border-color:var(--color-indigo-400)}.hover\:border-indigo-500:hover{border-color:var(--color-indigo-500)}.hover\:border-status-warning-border:hover{border-color:var(--status-warning-border)}.hover\:bg-chip-indigo-bg\/40:hover{background-color:var(--chip-indigo-bg)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-chip-indigo-bg\/40:hover{background-color:color-mix(in oklab,var(--chip-indigo-bg) 40%,transparent)}}.hover\:bg-elevated:hover,.hover\:bg-elevated\/50:hover{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-elevated\/50:hover{background-color:color-mix(in oklab,var(--app-elevated) 50%,transparent)}}.hover\:bg-elevated\/60:hover{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-elevated\/60:hover{background-color:color-mix(in oklab,var(--app-elevated) 60%,transparent)}}.hover\:bg-elevated\/70:hover{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-elevated\/70:hover{background-color:color-mix(in oklab,var(--app-elevated) 70%,transparent)}}.hover\:bg-elevated\/80:hover{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-elevated\/80:hover{background-color:color-mix(in oklab,var(--app-elevated) 80%,transparent)}}.hover\:bg-emerald-500:hover{background-color:var(--color-emerald-500)}.hover\:bg-hover-surface:hover{background-color:var(--app-hover)}.hover\:bg-indigo-500:hover{background-color:var(--color-indigo-500)}.hover\:bg-indigo-600:hover{background-color:var(--color-indigo-600)}.hover\:bg-status-danger-bg:hover,.hover\:bg-status-danger-bg\/60:hover{background-color:var(--status-danger-bg)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-status-danger-bg\/60:hover{background-color:color-mix(in oklab,var(--status-danger-bg) 60%,transparent)}}.hover\:bg-status-warning-bg:hover,.hover\:bg-status-warning-bg\/40:hover{background-color:var(--status-warning-bg)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-status-warning-bg\/40:hover{background-color:color-mix(in oklab,var(--status-warning-bg) 40%,transparent)}}.hover\:bg-surface:hover{background-color:var(--app-surface)}.hover\:bg-surface-strong:hover{background-color:var(--app-glass-strong)}.hover\:bg-white:hover{background-color:var(--color-white)}.hover\:text-chip-indigo-text:hover{color:var(--chip-indigo-text)}.hover\:text-ink:hover{color:var(--app-text-primary)}.hover\:text-status-danger-text:hover{color:var(--status-danger-text)}.hover\:text-status-warning-text:hover{color:var(--status-warning-text)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-40:hover{opacity:.4}.hover\:shadow-\[inset_0_1px_0_rgb\(255_255_255\/0\.35\)\,0_12px_30px_-6px_rgb\(16_185_129\/0\.7\)\]:hover{--tw-shadow:inset 0 1px 0 var(--tw-shadow-color,#ffffff59), 0 12px 30px -6px var(--tw-shadow-color,#10b981b3);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:brightness-95:hover{--tw-brightness:brightness(95%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.hover\:brightness-110:hover{--tw-brightness:brightness(110%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.focus\:border-indigo-500:focus{border-color:var(--color-indigo-500)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-indigo-500:focus{--tw-ring-color:var(--color-indigo-500)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:z-10:focus-visible{z-index:10}.focus-visible\:border-indigo-400:focus-visible{border-color:var(--color-indigo-400)}.focus-visible\:border-indigo-500:focus-visible{border-color:var(--color-indigo-500)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-emerald-400:focus-visible{--tw-ring-color:var(--color-emerald-400)}.focus-visible\:ring-indigo-400:focus-visible{--tw-ring-color:var(--color-indigo-400)}.focus-visible\:ring-indigo-500:focus-visible{--tw-ring-color:var(--color-indigo-500)}.focus-visible\:ring-indigo-500\/30:focus-visible{--tw-ring-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-indigo-500\/30:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 30%, transparent)}}.focus-visible\:ring-status-danger-border:focus-visible{--tw-ring-color:var(--status-danger-border)}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:ring-offset-app:focus-visible{--tw-ring-offset-color:var(--app-bg)}.focus-visible\:outline:focus-visible{outline-style:var(--tw-outline-style);outline-width:1px}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-\[-2px\]:focus-visible{outline-offset:-2px}.focus-visible\:outline-indigo-500:focus-visible{outline-color:var(--color-indigo-500)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-inset:focus-visible{--tw-ring-inset:inset}.active\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media(hover:hover){.disabled\:hover\:translate-y-0:disabled:hover{--tw-translate-y:0px;translate:var(--tw-translate-x) var(--tw-translate-y)}.disabled\:hover\:text-ink-muted:disabled:hover{color:var(--app-text-muted)}.disabled\:hover\:shadow-\[inset_0_1px_0_rgb\(255_255_255\/0\.35\)\,0_8px_24px_-6px_rgb\(16_185_129\/0\.55\)\]:disabled:hover{--tw-shadow:inset 0 1px 0 var(--tw-shadow-color,#ffffff59), 0 8px 24px -6px var(--tw-shadow-color,#10b9818c);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.disabled\:hover\:brightness-100:disabled:hover{--tw-brightness:brightness(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}@media(prefers-reduced-motion:reduce){.motion-reduce\:animate-none{animation:none}}@media(min-width:40rem){.sm\:inline{display:inline}.sm\:basis-auto{flex-basis:auto}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}.sm\:rounded-2xl{border-radius:var(--radius-2xl)}.sm\:rounded-xl{border-radius:var(--radius-xl)}.sm\:p-1\.5{padding:calc(var(--spacing) * 1.5)}.sm\:p-4{padding:calc(var(--spacing) * 4)}.sm\:p-6{padding:calc(var(--spacing) * 6)}.sm\:px-3{padding-inline:calc(var(--spacing) * 3)}.sm\:px-5{padding-inline:calc(var(--spacing) * 5)}.sm\:px-6{padding-inline:calc(var(--spacing) * 6)}.sm\:py-3{padding-block:calc(var(--spacing) * 3)}}@media(min-width:64rem){.lg\:flex{display:flex}}.\[\&_code\]\:bg-transparent code{background-color:#0000}.\[\&_code\]\:px-0 code{padding-inline:0}.\[\&_code\]\:py-0 code{padding-block:0}.\[\&_code\]\:text-inherit code{color:inherit}.animate-modal-in{animation:.15s cubic-bezier(.2,.8,.2,1) modal-in}.animate-overlay-in{animation:.15s ease-out overlay-in}.animate-toast-in{animation:.12s ease-out toast-in}}:where(button,[role=button],input,select,textarea,a,summary,video[tabindex],[tabindex]):focus-visible{outline:2px solid var(--color-indigo-500,#6366f1);outline-offset:2px}:root{color-scheme:light dark;--z-combobox-list:60;--z-syntax-helper:65;--z-context-menu:70;--z-modal:80;--z-drop-overlay:85;--z-toast:90;--z-tooltip:100}:root,[data-theme=dark]{--app-bg:#020617;--app-surface:#0f172a;--app-elevated:#1e293b;--app-hover:#334155;--app-border:#334155;--app-frame-border:#94a3b84d;--app-text-primary:#f8fafc;--app-text-secondary:#cbd5e1;--app-text-muted:#94a3b8;--app-text-faint:#94a3b8;--app-glass:#0f172a99;--app-glass-strong:#020617e6;--app-glass-panel:#0f172ac7;--app-glass-panel-strong:#020617e0;--app-glass-highlight:#ffffff17;--app-panel-shadow:0 24px 60px -12px #0206178c;--app-editor-bg:#1e1e1e;--app-editor-gutter-bg:#181818;--app-editor-active-line:#282828;--app-editor-selection:#6366f14d;--app-editor-border:#34343e;--app-editor-syntax-comment:#6a9955;--app-editor-syntax-key:#9cdcfe;--app-editor-syntax-string:#ce9178;--app-editor-syntax-keyword:#569cd6;--app-editor-syntax-label:#4ec9b0;color-scheme:dark;--chip-indigo-bg:#6366f140;--chip-indigo-border:#818cf880;--chip-indigo-text:#c7d2fe;--chip-purple-bg:#a855f740;--chip-purple-border:#c084fc80;--chip-purple-text:#f3e8ff;--chip-fuchsia-bg:#c026d340;--chip-fuchsia-border:#e879f980;--chip-fuchsia-text:#f5d0fe;--chip-sky-bg:#0ea5e940;--chip-sky-border:#38bdf880;--chip-sky-text:#bae6fd;--chip-amber-bg:#f59e0b40;--chip-amber-border:#fbbf2480;--chip-amber-text:#fde68a;--status-success-bg:#10b98140;--status-success-border:#34d39980;--status-success-text:#a7f3d0;--status-warning-bg:#f59e0b40;--status-warning-border:#fbbf2480;--status-warning-text:#fde68a;--status-danger-bg:#f43f5e40;--status-danger-border:#fb718580;--status-danger-text:#fecdd3}[data-theme=light]{--chip-indigo-bg:#e0e7ff;--chip-indigo-border:#a5b4fc;--chip-indigo-text:#3730a3;--chip-purple-bg:#f3e8ff;--chip-purple-border:#d8b4fe;--chip-purple-text:#6b21a8;--chip-fuchsia-bg:#fae8ff;--chip-fuchsia-border:#f0abfc;--chip-fuchsia-text:#86198f;--chip-sky-bg:#e0f2fe;--chip-sky-border:#7dd3fc;--chip-sky-text:#0369a1;--chip-amber-bg:#fef3c7;--chip-amber-border:#fcd34d;--chip-amber-text:#92400e;--status-success-bg:#d1fae5;--status-success-border:#6ee7b7;--status-success-text:#065f46;--status-warning-bg:#fef3c7;--status-warning-border:#fcd34d;--status-warning-text:#92400e;--status-danger-bg:#ffe4e6;--status-danger-border:#fda4af;--status-danger-text:#9f1239;--app-bg:#f8fafc;--app-surface:#fff;--app-elevated:#f1f5f9;--app-hover:#e2e8f0;--app-border:#cbd5e1;--app-frame-border:#0f172a29;--app-text-primary:#0f172a;--app-text-secondary:#334155;--app-text-muted:#475569;--app-text-faint:#475569;--app-glass:#ffffffb3;--app-glass-strong:#f8fafcf2;--app-glass-panel:#fffc;--app-glass-panel-strong:#f8fafceb;--app-glass-highlight:#ffffffe6;--app-panel-shadow:0 24px 60px -18px #0f172a47;--app-editor-bg:#fff;--app-editor-gutter-bg:#f8fafc;--app-editor-active-line:#f1f5f9;--app-editor-selection:#6366f129;--app-editor-border:#e2e8f0;--app-editor-syntax-comment:green;--app-editor-syntax-key:#0451a5;--app-editor-syntax-string:#a31515;--app-editor-syntax-keyword:#00f;--app-editor-syntax-label:#267f99;color-scheme:light}body{background-color:var(--app-bg);min-height:100vh;color:var(--app-text-primary);margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;transition:background-color .2s,color .2s}@media(prefers-reduced-motion:reduce){*,:before,:after{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@keyframes modal-in{0%{opacity:0;transform:translateY(4px)scale(.995)}to{opacity:1;transform:none}}@keyframes overlay-in{0%{opacity:0}to{opacity:1}}@keyframes toast-in{0%{opacity:0;translate:-50% calc(6px - 50%)}to{opacity:1;translate:-50% -50%}}*{scrollbar-color:var(--app-border) transparent;scrollbar-width:thin}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background-color:var(--app-border);background-clip:content-box;border:2px solid #0000;border-radius:9999px}::-webkit-scrollbar-thumb:hover{background-color:var(--app-text-faint)}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}} diff --git a/src/profiles/web/dist/assets/index-C1MMTlfW.css b/src/profiles/web/dist/assets/index-C1MMTlfW.css new file mode 100644 index 0000000..d416297 --- /dev/null +++ b/src/profiles/web/dist/assets/index-C1MMTlfW.css @@ -0,0 +1 @@ +/*! tailwindcss v4.3.3 | MIT License | https://tailwindcss.com */@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1}}}@layer theme{:root,:host{--font-sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--font-mono:ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-emerald-200:oklch(90.5% .093 164.15);--color-emerald-300:oklch(84.5% .143 164.978);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-emerald-600:oklch(59.6% .145 163.225);--color-emerald-800:oklch(43.2% .095 166.913);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-600:oklch(51.1% .262 276.966);--color-slate-300:oklch(86.9% .022 252.894);--color-slate-400:oklch(70.4% .04 256.788);--color-slate-500:oklch(55.4% .046 257.417);--color-slate-600:oklch(44.6% .043 257.281);--color-slate-900:oklch(20.8% .042 265.755);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--tracking-tight:-.025em;--tracking-wide:.025em;--tracking-wider:.05em;--leading-relaxed:1.625;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-xs:4px;--blur-sm:8px;--blur-md:12px;--blur-xl:24px;--aspect-video:16 / 9;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;-moz-tab-size:4;tab-size:4;line-height:1.5;font-family:var(--default-font-family,-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring:where(:not(iframe)){outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){-webkit-appearance:button;-moz-appearance:button;appearance:button}::file-selector-button{-webkit-appearance:button;-moz-appearance:button;appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components{.glass-panel{background:var(--app-glass-panel);-webkit-backdrop-filter:blur(24px)saturate(160%);backdrop-filter:blur(24px)saturate(160%);box-shadow:var(--app-panel-shadow),inset 0 1px 0 var(--app-glass-highlight)}.glass-panel-strong{background:var(--app-glass-panel-strong);-webkit-backdrop-filter:blur(28px)saturate(180%);backdrop-filter:blur(28px)saturate(180%);box-shadow:var(--app-panel-shadow),inset 0 1px 0 var(--app-glass-highlight)}.btn{justify-content:center;align-items:center;gap:calc(var(--spacing) * 1.5);border-radius:var(--radius-md);border-style:var(--tw-border-style);font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height));--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium);transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration));border-width:1px;display:inline-flex}.btn:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-ring-color:#625fffb3}@supports (color:color-mix(in lab,red,red)){.btn:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 70%, transparent)}}.btn:focus-visible{--tw-outline-style:none;outline-style:none}.btn:disabled{cursor:not-allowed;opacity:.4}.btn-primary{background-color:var(--color-indigo-600);color:var(--color-white);border-color:#0000}@media(hover:hover){.btn-primary:hover{background-color:var(--color-indigo-500)}}.btn-secondary{border-color:var(--app-border);background-color:var(--app-elevated);color:var(--app-text-secondary)}@media(hover:hover){.btn-secondary:hover{border-color:var(--color-indigo-500);color:var(--app-text-primary)}.btn-chip:hover{--tw-brightness:brightness(95%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.btn-chip:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-ring-color:#625fffb3}@supports (color:color-mix(in lab,red,red)){.btn-chip:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 70%, transparent)}}.btn-chip:focus-visible{--tw-outline-style:none;outline-style:none}.btn-chip:disabled{cursor:not-allowed;opacity:.4}.focus-ring:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow);--tw-ring-color:#625fffb3}@supports (color:color-mix(in lab,red,red)){.focus-ring:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 70%, transparent)}}.focus-ring:focus-visible{--tw-outline-style:none;outline-style:none}}@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.invisible{visibility:hidden}.visible{visibility:visible}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.static{position:static}.sticky{position:sticky}.inset-0{top:0;right:0;bottom:0;left:0}.inset-y-0{inset-block:0}.-top-1{top:calc(var(--spacing) * -1)}.top-0{top:0}.top-1\/2{top:50%}.top-2{top:calc(var(--spacing) * 2)}.top-full{top:100%}.-right-0\.5{right:calc(var(--spacing) * -.5)}.-right-1{right:calc(var(--spacing) * -1)}.right-0{right:0}.right-2{right:calc(var(--spacing) * 2)}.-bottom-0\.5{bottom:calc(var(--spacing) * -.5)}.-bottom-1{bottom:calc(var(--spacing) * -1)}.bottom-0{bottom:0}.bottom-2{bottom:calc(var(--spacing) * 2)}.-left-1{left:calc(var(--spacing) * -1)}.left-0{left:0}.left-1\/2{left:50%}.left-2\.5{left:calc(var(--spacing) * 2.5)}.left-3{left:calc(var(--spacing) * 3)}.isolate{isolation:isolate}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-\[calc\(var\(--z-context-menu\)-1\)\]{z-index:calc(var(--z-context-menu) - 1)}.z-\[var\(--z-combobox-list\)\]{z-index:var(--z-combobox-list)}.z-\[var\(--z-context-menu\)\]{z-index:var(--z-context-menu)}.z-\[var\(--z-drop-overlay\)\]{z-index:var(--z-drop-overlay)}.z-\[var\(--z-modal\)\]{z-index:var(--z-modal)}.z-\[var\(--z-syntax-helper\)\]{z-index:var(--z-syntax-helper)}.z-\[var\(--z-toast\)\]{z-index:var(--z-toast)}.z-\[var\(--z-tooltip\)\]{z-index:var(--z-tooltip)}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.container\!{width:100%!important}@media(min-width:40rem){.container\!{max-width:40rem!important}}@media(min-width:48rem){.container\!{max-width:48rem!important}}@media(min-width:64rem){.container\!{max-width:64rem!important}}@media(min-width:80rem){.container\!{max-width:80rem!important}}@media(min-width:96rem){.container\!{max-width:96rem!important}}.mx-1{margin-inline:var(--spacing)}.mx-auto{margin-inline:auto}.my-1{margin-block:var(--spacing)}.my-1\.5{margin-block:calc(var(--spacing) * 1.5)}.my-2{margin-block:calc(var(--spacing) * 2)}.my-3{margin-block:calc(var(--spacing) * 3)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:var(--spacing)}.mt-1\.5{margin-top:calc(var(--spacing) * 1.5)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.mt-4{margin-top:calc(var(--spacing) * 4)}.mt-5{margin-top:calc(var(--spacing) * 5)}.mt-6{margin-top:calc(var(--spacing) * 6)}.mr-1\.5{margin-right:calc(var(--spacing) * 1.5)}.mr-auto{margin-right:auto}.mb-0\.5{margin-bottom:calc(var(--spacing) * .5)}.mb-1{margin-bottom:var(--spacing)}.mb-1\.5{margin-bottom:calc(var(--spacing) * 1.5)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-5{margin-bottom:calc(var(--spacing) * 5)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-auto{margin-left:auto}.block{display:block}.contents{display:contents}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.list-item{display:list-item}.table{display:table}.aspect-video{aspect-ratio:var(--aspect-video)}.h-2{height:calc(var(--spacing) * 2)}.h-2\.5{height:calc(var(--spacing) * 2.5)}.h-3{height:calc(var(--spacing) * 3)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-4{height:calc(var(--spacing) * 4)}.h-5{height:calc(var(--spacing) * 5)}.h-6{height:calc(var(--spacing) * 6)}.h-7{height:calc(var(--spacing) * 7)}.h-8{height:calc(var(--spacing) * 8)}.h-9{height:calc(var(--spacing) * 9)}.h-10{height:calc(var(--spacing) * 10)}.h-12{height:calc(var(--spacing) * 12)}.h-48{height:calc(var(--spacing) * 48)}.h-\[80vh\]{height:80vh}.h-\[90vh\]{height:90vh}.h-\[min\(84dvh\,760px\)\]{height:min(84dvh,760px)}.h-dvh{height:100dvh}.h-full{height:100%}.max-h-40{max-height:calc(var(--spacing) * 40)}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-60{max-height:calc(var(--spacing) * 60)}.max-h-\[60vh\]{max-height:60vh}.max-h-\[90vh\]{max-height:90vh}.max-h-\[calc\(100dvh-1\.5rem\)\]{max-height:calc(100dvh - 1.5rem)}.max-h-\[calc\(100dvh-2rem\)\]{max-height:calc(100dvh - 2rem)}.max-h-\[calc\(100dvh-16px\)\]{max-height:calc(100dvh - 16px)}.min-h-0{min-height:0}.min-h-9{min-height:calc(var(--spacing) * 9)}.min-h-10{min-height:calc(var(--spacing) * 10)}.min-h-16{min-height:calc(var(--spacing) * 16)}.min-h-24{min-height:calc(var(--spacing) * 24)}.min-h-36{min-height:calc(var(--spacing) * 36)}.min-h-\[24px\]{min-height:24px}.min-h-\[44px\]{min-height:44px}.min-h-screen{min-height:100vh}.w-1\/3{width:33.3333%}.w-2{width:calc(var(--spacing) * 2)}.w-2\.5{width:calc(var(--spacing) * 2.5)}.w-3{width:calc(var(--spacing) * 3)}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-5{width:calc(var(--spacing) * 5)}.w-6{width:calc(var(--spacing) * 6)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-9{width:calc(var(--spacing) * 9)}.w-10{width:calc(var(--spacing) * 10)}.w-12{width:calc(var(--spacing) * 12)}.w-44{width:calc(var(--spacing) * 44)}.w-48{width:calc(var(--spacing) * 48)}.w-56{width:calc(var(--spacing) * 56)}.w-72{width:calc(var(--spacing) * 72)}.w-96{width:calc(var(--spacing) * 96)}.w-\[52px\]{width:52px}.w-\[138px\]{width:138px}.w-\[150px\]{width:150px}.w-\[280px\]{width:280px}.w-\[400px\]{width:400px}.w-\[420px\]{width:420px}.w-\[440px\]{width:440px}.w-\[450px\]{width:450px}.w-\[clamp\(560px\,85vw\,1500px\)\]{width:clamp(560px,85vw,1500px)}.w-\[min\(94vw\,560px\)\]{width:min(94vw,560px)}.w-\[min\(94vw\,960px\)\]{width:min(94vw,960px)}.w-full{width:100%}.w-max{width:max-content}.max-w-4xl{max-width:var(--container-4xl)}.max-w-5xl{max-width:var(--container-5xl)}.max-w-6xl{max-width:var(--container-6xl)}.max-w-\[220px\]{max-width:220px}.max-w-\[calc\(100vw-16px\)\]{max-width:calc(100vw - 16px)}.max-w-\[min\(70vw\,560px\)\]{max-width:min(70vw,560px)}.max-w-\[min\(80vw\,640px\)\]{max-width:min(80vw,640px)}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:0}.min-w-48{min-width:calc(var(--spacing) * 48)}.min-w-\[100px\]{min-width:100px}.min-w-\[220px\]{min-width:220px}.flex-1{flex:1}.flex-shrink-0,.shrink-0{flex-shrink:0}.flex-grow,.grow{flex-grow:1}.basis-64{flex-basis:calc(var(--spacing) * 64)}.basis-full{flex-basis:100%}.border-collapse{border-collapse:collapse}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.rotate-45{rotate:45deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse{animation:var(--animate-pulse)}.animate-spin{animation:var(--animate-spin)}.cursor-col-resize{cursor:col-resize}.cursor-not-allowed{cursor:not-allowed}.cursor-pointer{cursor:pointer}.touch-none{touch-action:none}.resize{resize:both}.resize\!{resize:both!important}.list-decimal{list-style-type:decimal}.list-disc{list-style-type:disc}.grid-cols-1{grid-template-columns:repeat(1,minmax(0,1fr))}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.place-items-center{place-items:center}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-1{gap:var(--spacing)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-2\.5{gap:calc(var(--spacing) * 2.5)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-3\.5{gap:calc(var(--spacing) * 3.5)}.gap-4{gap:calc(var(--spacing) * 4)}:where(.space-y-0\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * .5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * .5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(var(--spacing) * var(--tw-space-y-reverse));margin-block-end:calc(var(--spacing) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-1\.5>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 1.5) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 1.5) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-2>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 2) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 2) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-3>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 3) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 3) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-4>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 4) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 4) * calc(1 - var(--tw-space-y-reverse)))}:where(.space-y-6>:not(:last-child)){--tw-space-y-reverse:0;margin-block-start:calc(calc(var(--spacing) * 6) * var(--tw-space-y-reverse));margin-block-end:calc(calc(var(--spacing) * 6) * calc(1 - var(--tw-space-y-reverse)))}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-y-1\.5{row-gap:calc(var(--spacing) * 1.5)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-auto{overflow:auto}.overflow-hidden{overflow:hidden}.overflow-x-auto{overflow-x:auto}.overflow-y-auto{overflow-y:auto}.overscroll-contain{overscroll-behavior:contain}.rounded{border-radius:.25rem}.rounded-2xl{border-radius:var(--radius-2xl)}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-l-md{border-top-left-radius:var(--radius-md);border-bottom-left-radius:var(--radius-md)}.rounded-r-md{border-top-right-radius:var(--radius-md);border-bottom-right-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-t-2{border-top-style:var(--tw-border-style);border-top-width:2px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-r-2{border-right-style:var(--tw-border-style);border-right-width:2px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-l{border-left-style:var(--tw-border-style);border-left-width:1px}.border-l-0{border-left-style:var(--tw-border-style);border-left-width:0}.border-l-2{border-left-style:var(--tw-border-style);border-left-width:2px}.border-l-4{border-left-style:var(--tw-border-style);border-left-width:4px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-\[var\(--app-editor-border\)\]{border-color:var(--app-editor-border)}.border-chip-amber-border{border-color:var(--chip-amber-border)}.border-chip-fuchsia-border{border-color:var(--chip-fuchsia-border)}.border-chip-indigo-border,.border-chip-indigo-border\/50{border-color:var(--chip-indigo-border)}@supports (color:color-mix(in lab,red,red)){.border-chip-indigo-border\/50{border-color:color-mix(in oklab,var(--chip-indigo-border) 50%,transparent)}}.border-chip-purple-border,.border-chip-purple-border\/50{border-color:var(--chip-purple-border)}@supports (color:color-mix(in lab,red,red)){.border-chip-purple-border\/50{border-color:color-mix(in oklab,var(--chip-purple-border) 50%,transparent)}}.border-chip-sky-border{border-color:var(--chip-sky-border)}.border-emerald-300\/50{border-color:#5ee9b580}@supports (color:color-mix(in lab,red,red)){.border-emerald-300\/50{border-color:color-mix(in oklab,var(--color-emerald-300) 50%,transparent)}}.border-emerald-500\/30{border-color:#00bb7f4d}@supports (color:color-mix(in lab,red,red)){.border-emerald-500\/30{border-color:color-mix(in oklab,var(--color-emerald-500) 30%,transparent)}}.border-frame-line{border-color:var(--app-frame-border)}.border-indigo-400{border-color:var(--color-indigo-400)}.border-indigo-400\/80{border-color:#7d87ffcc}@supports (color:color-mix(in lab,red,red)){.border-indigo-400\/80{border-color:color-mix(in oklab,var(--color-indigo-400) 80%,transparent)}}.border-indigo-600{border-color:var(--color-indigo-600)}.border-line,.border-line\/40{border-color:var(--app-border)}@supports (color:color-mix(in lab,red,red)){.border-line\/40{border-color:color-mix(in oklab,var(--app-border) 40%,transparent)}}.border-line\/60{border-color:var(--app-border)}@supports (color:color-mix(in lab,red,red)){.border-line\/60{border-color:color-mix(in oklab,var(--app-border) 60%,transparent)}}.border-slate-500\/30{border-color:#62748e4d}@supports (color:color-mix(in lab,red,red)){.border-slate-500\/30{border-color:color-mix(in oklab,var(--color-slate-500) 30%,transparent)}}.border-status-danger-border{border-color:var(--status-danger-border)}.border-status-success-border{border-color:var(--status-success-border)}.border-status-warning-border{border-color:var(--status-warning-border)}.border-transparent{border-color:#0000}.border-t-transparent{border-top-color:#0000}.border-l-transparent{border-left-color:#0000}.bg-\[var\(--app-editor-bg\)\]{background-color:var(--app-editor-bg)}.bg-app,.bg-app\/90{background-color:var(--app-bg)}@supports (color:color-mix(in lab,red,red)){.bg-app\/90{background-color:color-mix(in oklab,var(--app-bg) 90%,transparent)}}.bg-black{background-color:var(--color-black)}.bg-black\/20{background-color:#0003}@supports (color:color-mix(in lab,red,red)){.bg-black\/20{background-color:color-mix(in oklab,var(--color-black) 20%,transparent)}}.bg-black\/60{background-color:#0009}@supports (color:color-mix(in lab,red,red)){.bg-black\/60{background-color:color-mix(in oklab,var(--color-black) 60%,transparent)}}.bg-black\/65{background-color:#000000a6}@supports (color:color-mix(in lab,red,red)){.bg-black\/65{background-color:color-mix(in oklab,var(--color-black) 65%,transparent)}}.bg-black\/70{background-color:#000000b3}@supports (color:color-mix(in lab,red,red)){.bg-black\/70{background-color:color-mix(in oklab,var(--color-black) 70%,transparent)}}.bg-chip-amber-bg{background-color:var(--chip-amber-bg)}.bg-chip-fuchsia-bg{background-color:var(--chip-fuchsia-bg)}.bg-chip-indigo-bg,.bg-chip-indigo-bg\/20{background-color:var(--chip-indigo-bg)}@supports (color:color-mix(in lab,red,red)){.bg-chip-indigo-bg\/20{background-color:color-mix(in oklab,var(--chip-indigo-bg) 20%,transparent)}}.bg-chip-purple-bg{background-color:var(--chip-purple-bg)}.bg-chip-sky-bg{background-color:var(--chip-sky-bg)}.bg-elevated,.bg-elevated\/30{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.bg-elevated\/30{background-color:color-mix(in oklab,var(--app-elevated) 30%,transparent)}}.bg-elevated\/50{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.bg-elevated\/50{background-color:color-mix(in oklab,var(--app-elevated) 50%,transparent)}}.bg-elevated\/60{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.bg-elevated\/60{background-color:color-mix(in oklab,var(--app-elevated) 60%,transparent)}}.bg-emerald-400{background-color:var(--color-emerald-400)}.bg-emerald-500{background-color:var(--color-emerald-500)}.bg-emerald-600{background-color:var(--color-emerald-600)}.bg-emerald-800\/60{background-color:#005f4699}@supports (color:color-mix(in lab,red,red)){.bg-emerald-800\/60{background-color:color-mix(in oklab,var(--color-emerald-800) 60%,transparent)}}.bg-indigo-500\/5{background-color:#625fff0d}@supports (color:color-mix(in lab,red,red)){.bg-indigo-500\/5{background-color:color-mix(in oklab,var(--color-indigo-500) 5%,transparent)}}.bg-indigo-600{background-color:var(--color-indigo-600)}.bg-ink-faint{background-color:var(--app-text-faint)}.bg-slate-600\/20{background-color:#45556c33}@supports (color:color-mix(in lab,red,red)){.bg-slate-600\/20{background-color:color-mix(in oklab,var(--color-slate-600) 20%,transparent)}}.bg-status-danger-bg,.bg-status-danger-bg\/30{background-color:var(--status-danger-bg)}@supports (color:color-mix(in lab,red,red)){.bg-status-danger-bg\/30{background-color:color-mix(in oklab,var(--status-danger-bg) 30%,transparent)}}.bg-status-danger-bg\/40{background-color:var(--status-danger-bg)}@supports (color:color-mix(in lab,red,red)){.bg-status-danger-bg\/40{background-color:color-mix(in oklab,var(--status-danger-bg) 40%,transparent)}}.bg-status-success-bg{background-color:var(--status-success-bg)}.bg-status-warning-bg{background-color:var(--status-warning-bg)}.bg-surface{background-color:var(--app-surface)}.bg-surface-glass{background-color:var(--app-glass)}.bg-surface-strong,.bg-surface-strong\/20{background-color:var(--app-glass-strong)}@supports (color:color-mix(in lab,red,red)){.bg-surface-strong\/20{background-color:color-mix(in oklab,var(--app-glass-strong) 20%,transparent)}}.bg-surface-strong\/30{background-color:var(--app-glass-strong)}@supports (color:color-mix(in lab,red,red)){.bg-surface-strong\/30{background-color:color-mix(in oklab,var(--app-glass-strong) 30%,transparent)}}.bg-surface\/50{background-color:var(--app-surface)}@supports (color:color-mix(in lab,red,red)){.bg-surface\/50{background-color:color-mix(in oklab,var(--app-surface) 50%,transparent)}}.bg-surface\/60{background-color:var(--app-surface)}@supports (color:color-mix(in lab,red,red)){.bg-surface\/60{background-color:color-mix(in oklab,var(--app-surface) 60%,transparent)}}.bg-white{background-color:var(--color-white)}.bg-white\/90{background-color:#ffffffe6}@supports (color:color-mix(in lab,red,red)){.bg-white\/90{background-color:color-mix(in oklab,var(--color-white) 90%,transparent)}}.bg-gradient-to-b{--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.bg-gradient-to-br{--tw-gradient-position:to bottom right in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-chip-indigo-bg{--tw-gradient-from:var(--chip-indigo-bg);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-emerald-400\/90{--tw-gradient-from:#00d294e6}@supports (color:color-mix(in lab,red,red)){.from-emerald-400\/90{--tw-gradient-from:color-mix(in oklab, var(--color-emerald-400) 90%, transparent)}}.from-emerald-400\/90{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-chip-purple-bg{--tw-gradient-to:var(--chip-purple-bg);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-emerald-600\/90{--tw-gradient-to:#009767e6}@supports (color:color-mix(in lab,red,red)){.to-emerald-600\/90{--tw-gradient-to:color-mix(in oklab, var(--color-emerald-600) 90%, transparent)}}.to-emerald-600\/90{--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.fill-current{fill:currentColor}.object-contain{object-fit:contain}.object-cover{object-fit:cover}.p-0\.5{padding:calc(var(--spacing) * .5)}.p-1{padding:var(--spacing)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-2{padding:calc(var(--spacing) * 2)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-5{padding:calc(var(--spacing) * 5)}.p-6{padding:calc(var(--spacing) * 6)}.p-8{padding:calc(var(--spacing) * 8)}.px-1{padding-inline:var(--spacing)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-3\.5{padding-inline:calc(var(--spacing) * 3.5)}.px-4{padding-inline:calc(var(--spacing) * 4)}.px-5{padding-inline:calc(var(--spacing) * 5)}.px-6{padding-inline:calc(var(--spacing) * 6)}.px-8{padding-inline:calc(var(--spacing) * 8)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:var(--spacing)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-3\.5{padding-block:calc(var(--spacing) * 3.5)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-6{padding-block:calc(var(--spacing) * 6)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-px{padding-block:1px}.pt-2{padding-top:calc(var(--spacing) * 2)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-4{padding-top:calc(var(--spacing) * 4)}.pr-1{padding-right:var(--spacing)}.pr-2\.5{padding-right:calc(var(--spacing) * 2.5)}.pr-3{padding-right:calc(var(--spacing) * 3)}.pr-8{padding-right:calc(var(--spacing) * 8)}.pr-10{padding-right:calc(var(--spacing) * 10)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-4{padding-bottom:calc(var(--spacing) * 4)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-5{padding-left:calc(var(--spacing) * 5)}.pl-8{padding-left:calc(var(--spacing) * 8)}.pl-9{padding-left:calc(var(--spacing) * 9)}.text-center{text-align:center}.text-left{text-align:left}.align-\[1px\]{vertical-align:1px}.align-top{vertical-align:top}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.text-\[11px\]{font-size:11px}.leading-5{--tw-leading:calc(var(--spacing) * 5);line-height:calc(var(--spacing) * 5)}.leading-none{--tw-leading:1;line-height:1}.leading-relaxed{--tw-leading:var(--leading-relaxed);line-height:var(--leading-relaxed)}.font-bold{--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-tight{--tw-tracking:var(--tracking-tight);letter-spacing:var(--tracking-tight)}.tracking-wide{--tw-tracking:var(--tracking-wide);letter-spacing:var(--tracking-wide)}.tracking-wider{--tw-tracking:var(--tracking-wider);letter-spacing:var(--tracking-wider)}.break-words{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-line{white-space:pre-line}.whitespace-pre-wrap{white-space:pre-wrap}.text-chip-amber-text{color:var(--chip-amber-text)}.text-chip-fuchsia-text{color:var(--chip-fuchsia-text)}.text-chip-indigo-text{color:var(--chip-indigo-text)}.text-chip-purple-text{color:var(--chip-purple-text)}.text-chip-sky-text{color:var(--chip-sky-text)}.text-emerald-200{color:var(--color-emerald-200)}.text-ink{color:var(--app-text-primary)}.text-ink-faint{color:var(--app-text-faint)}.text-ink-muted,.text-ink-muted\/50{color:var(--app-text-muted)}@supports (color:color-mix(in lab,red,red)){.text-ink-muted\/50{color:color-mix(in oklab,var(--app-text-muted) 50%,transparent)}}.text-ink-secondary{color:var(--app-text-secondary)}.text-ink\/70{color:var(--app-text-primary)}@supports (color:color-mix(in lab,red,red)){.text-ink\/70{color:color-mix(in oklab,var(--app-text-primary) 70%,transparent)}}.text-slate-300{color:var(--color-slate-300)}.text-slate-400{color:var(--color-slate-400)}.text-slate-900{color:var(--color-slate-900)}.text-status-danger-text,.text-status-danger-text\/60{color:var(--status-danger-text)}@supports (color:color-mix(in lab,red,red)){.text-status-danger-text\/60{color:color-mix(in oklab,var(--status-danger-text) 60%,transparent)}}.text-status-danger-text\/70{color:var(--status-danger-text)}@supports (color:color-mix(in lab,red,red)){.text-status-danger-text\/70{color:color-mix(in oklab,var(--status-danger-text) 70%,transparent)}}.text-status-danger-text\/80{color:var(--status-danger-text)}@supports (color:color-mix(in lab,red,red)){.text-status-danger-text\/80{color:color-mix(in oklab,var(--status-danger-text) 80%,transparent)}}.text-status-danger-text\/90{color:var(--status-danger-text)}@supports (color:color-mix(in lab,red,red)){.text-status-danger-text\/90{color:color-mix(in oklab,var(--status-danger-text) 90%,transparent)}}.text-status-success-text{color:var(--status-success-text)}.text-status-warning-text{color:var(--status-warning-text)}.text-white{color:var(--color-white)}.lowercase{text-transform:lowercase}.uppercase{text-transform:uppercase}.italic{font-style:italic}.not-italic{font-style:normal}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.underline-offset-2{text-underline-offset:2px}.antialiased{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.placeholder-ink-faint::placeholder{color:var(--app-text-faint)}.opacity-0{opacity:0}.opacity-40{opacity:.4}.opacity-90{opacity:.9}.opacity-100{opacity:1}.shadow{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-2xl{--tw-shadow:0 25px 50px -12px var(--tw-shadow-color,#00000040);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_0_0_9999px_rgba\(0\,0\,0\,0\.45\)\]{--tw-shadow:0 0 0 9999px var(--tw-shadow-color,#00000073);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[0_2px_6px_rgb\(0_0_0\/0\.35\)\]{--tw-shadow:0 2px 6px var(--tw-shadow-color,#00000059);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[inset_0_1px_0_rgb\(255_255_255\/0\.12\)\]{--tw-shadow:inset 0 1px 0 var(--tw-shadow-color,#ffffff1f);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-\[inset_0_1px_0_rgb\(255_255_255\/0\.35\)\,0_8px_24px_-6px_rgb\(16_185_129\/0\.55\)\]{--tw-shadow:inset 0 1px 0 var(--tw-shadow-color,#ffffff59), 0 8px 24px -6px var(--tw-shadow-color,#10b9818c);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-lg{--tw-shadow:0 10px 15px -3px var(--tw-shadow-color,#0000001a), 0 4px 6px -4px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-sm{--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xl{--tw-shadow:0 20px 25px -5px var(--tw-shadow-color,#0000001a), 0 8px 10px -6px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-1{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-2{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.ring-app{--tw-ring-color:var(--app-bg)}.ring-chip-indigo-border\/40{--tw-ring-color:var(--chip-indigo-border)}@supports (color:color-mix(in lab,red,red)){.ring-chip-indigo-border\/40{--tw-ring-color:color-mix(in oklab, var(--chip-indigo-border) 40%, transparent)}}.outline{outline-style:var(--tw-outline-style);outline-width:1px}.blur{--tw-blur:blur(8px);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.filter\!{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)!important}.backdrop-blur-md{--tw-backdrop-blur:blur(var(--blur-md));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-sm{--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-xl{--tw-backdrop-blur:blur(var(--blur-xl));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.backdrop-blur-xs{--tw-backdrop-blur:blur(var(--blur-xs));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-\[filter\,box-shadow\,transform\]{transition-property:filter,box-shadow,transform;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200{--tw-duration:.2s;transition-duration:.2s}.outline-none{--tw-outline-style:none;outline-style:none}.select-none{-webkit-user-select:none;user-select:none}@media(hover:hover){.group-hover\:text-white:is(:where(.group):hover *){color:var(--color-white)}.group-hover\:opacity-40:is(:where(.group):hover *){opacity:.4}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}}.selection\:bg-indigo-500 ::selection{background-color:var(--color-indigo-500)}.selection\:bg-indigo-500::selection{background-color:var(--color-indigo-500)}.selection\:text-white ::selection{color:var(--color-white)}.selection\:text-white::selection{color:var(--color-white)}.placeholder\:text-ink-faint::placeholder{color:var(--app-text-faint)}.first\:mt-0:first-child{margin-top:0}.last\:mb-0:last-child{margin-bottom:0}@media(hover:hover){.hover\:-translate-y-px:hover{--tw-translate-y:-1px;translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\:border-chip-indigo-border:hover{border-color:var(--chip-indigo-border)}.hover\:border-indigo-400:hover{border-color:var(--color-indigo-400)}.hover\:border-indigo-500:hover{border-color:var(--color-indigo-500)}.hover\:border-status-warning-border:hover{border-color:var(--status-warning-border)}.hover\:bg-chip-indigo-bg\/40:hover{background-color:var(--chip-indigo-bg)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-chip-indigo-bg\/40:hover{background-color:color-mix(in oklab,var(--chip-indigo-bg) 40%,transparent)}}.hover\:bg-elevated:hover,.hover\:bg-elevated\/50:hover{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-elevated\/50:hover{background-color:color-mix(in oklab,var(--app-elevated) 50%,transparent)}}.hover\:bg-elevated\/60:hover{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-elevated\/60:hover{background-color:color-mix(in oklab,var(--app-elevated) 60%,transparent)}}.hover\:bg-elevated\/70:hover{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-elevated\/70:hover{background-color:color-mix(in oklab,var(--app-elevated) 70%,transparent)}}.hover\:bg-elevated\/80:hover{background-color:var(--app-elevated)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-elevated\/80:hover{background-color:color-mix(in oklab,var(--app-elevated) 80%,transparent)}}.hover\:bg-emerald-500:hover{background-color:var(--color-emerald-500)}.hover\:bg-hover-surface:hover{background-color:var(--app-hover)}.hover\:bg-indigo-500:hover{background-color:var(--color-indigo-500)}.hover\:bg-indigo-600:hover{background-color:var(--color-indigo-600)}.hover\:bg-status-danger-bg:hover,.hover\:bg-status-danger-bg\/60:hover{background-color:var(--status-danger-bg)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-status-danger-bg\/60:hover{background-color:color-mix(in oklab,var(--status-danger-bg) 60%,transparent)}}.hover\:bg-status-warning-bg:hover,.hover\:bg-status-warning-bg\/40:hover{background-color:var(--status-warning-bg)}@supports (color:color-mix(in lab,red,red)){.hover\:bg-status-warning-bg\/40:hover{background-color:color-mix(in oklab,var(--status-warning-bg) 40%,transparent)}}.hover\:bg-surface:hover{background-color:var(--app-surface)}.hover\:bg-surface-strong:hover{background-color:var(--app-glass-strong)}.hover\:bg-white:hover{background-color:var(--color-white)}.hover\:text-chip-indigo-text:hover{color:var(--chip-indigo-text)}.hover\:text-ink:hover{color:var(--app-text-primary)}.hover\:text-status-danger-text:hover{color:var(--status-danger-text)}.hover\:text-status-warning-text:hover{color:var(--status-warning-text)}.hover\:text-white:hover{color:var(--color-white)}.hover\:underline:hover{text-decoration-line:underline}.hover\:opacity-40:hover{opacity:.4}.hover\:shadow-\[inset_0_1px_0_rgb\(255_255_255\/0\.35\)\,0_12px_30px_-6px_rgb\(16_185_129\/0\.7\)\]:hover{--tw-shadow:inset 0 1px 0 var(--tw-shadow-color,#ffffff59), 0 12px 30px -6px var(--tw-shadow-color,#10b981b3);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.hover\:brightness-95:hover{--tw-brightness:brightness(95%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.hover\:brightness-110:hover{--tw-brightness:brightness(110%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}.focus\:border-indigo-500:focus{border-color:var(--color-indigo-500)}.focus\:ring-2:focus{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus\:ring-indigo-500:focus{--tw-ring-color:var(--color-indigo-500)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.focus-visible\:z-10:focus-visible{z-index:10}.focus-visible\:border-indigo-400:focus-visible{border-color:var(--color-indigo-400)}.focus-visible\:border-indigo-500:focus-visible{border-color:var(--color-indigo-500)}.focus-visible\:ring-2:focus-visible{--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.focus-visible\:ring-emerald-400:focus-visible{--tw-ring-color:var(--color-emerald-400)}.focus-visible\:ring-indigo-400:focus-visible{--tw-ring-color:var(--color-indigo-400)}.focus-visible\:ring-indigo-500:focus-visible{--tw-ring-color:var(--color-indigo-500)}.focus-visible\:ring-indigo-500\/30:focus-visible{--tw-ring-color:#625fff4d}@supports (color:color-mix(in lab,red,red)){.focus-visible\:ring-indigo-500\/30:focus-visible{--tw-ring-color:color-mix(in oklab, var(--color-indigo-500) 30%, transparent)}}.focus-visible\:ring-status-danger-border:focus-visible{--tw-ring-color:var(--status-danger-border)}.focus-visible\:ring-offset-1:focus-visible{--tw-ring-offset-width:1px;--tw-ring-offset-shadow:var(--tw-ring-inset,) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color)}.focus-visible\:ring-offset-app:focus-visible{--tw-ring-offset-color:var(--app-bg)}.focus-visible\:outline:focus-visible{outline-style:var(--tw-outline-style);outline-width:1px}.focus-visible\:outline-2:focus-visible{outline-style:var(--tw-outline-style);outline-width:2px}.focus-visible\:outline-offset-\[-2px\]:focus-visible{outline-offset:-2px}.focus-visible\:outline-indigo-500:focus-visible{outline-color:var(--color-indigo-500)}.focus-visible\:outline-none:focus-visible{--tw-outline-style:none;outline-style:none}.focus-visible\:ring-inset:focus-visible{--tw-ring-inset:inset}.active\:scale-95:active{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.disabled\:cursor-not-allowed:disabled{cursor:not-allowed}.disabled\:opacity-40:disabled{opacity:.4}.disabled\:opacity-50:disabled{opacity:.5}@media(hover:hover){.disabled\:hover\:translate-y-0:disabled:hover{--tw-translate-y:0px;translate:var(--tw-translate-x) var(--tw-translate-y)}.disabled\:hover\:text-ink-muted:disabled:hover{color:var(--app-text-muted)}.disabled\:hover\:shadow-\[inset_0_1px_0_rgb\(255_255_255\/0\.35\)\,0_8px_24px_-6px_rgb\(16_185_129\/0\.55\)\]:disabled:hover{--tw-shadow:inset 0 1px 0 var(--tw-shadow-color,#ffffff59), 0 8px 24px -6px var(--tw-shadow-color,#10b9818c);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.disabled\:hover\:brightness-100:disabled:hover{--tw-brightness:brightness(100%);filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}}@media(prefers-reduced-motion:reduce){.motion-reduce\:animate-none{animation:none}}@media(min-width:40rem){.sm\:inline{display:inline}.sm\:basis-auto{flex-basis:auto}.sm\:grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:justify-between{justify-content:space-between}.sm\:rounded-2xl{border-radius:var(--radius-2xl)}.sm\:rounded-xl{border-radius:var(--radius-xl)}.sm\:p-1\.5{padding:calc(var(--spacing) * 1.5)}.sm\:p-4{padding:calc(var(--spacing) * 4)}.sm\:p-6{padding:calc(var(--spacing) * 6)}.sm\:px-3{padding-inline:calc(var(--spacing) * 3)}.sm\:px-5{padding-inline:calc(var(--spacing) * 5)}.sm\:px-6{padding-inline:calc(var(--spacing) * 6)}.sm\:py-3{padding-block:calc(var(--spacing) * 3)}}@media(min-width:64rem){.lg\:flex{display:flex}}.\[\&_code\]\:bg-transparent code{background-color:#0000}.\[\&_code\]\:px-0 code{padding-inline:0}.\[\&_code\]\:py-0 code{padding-block:0}.\[\&_code\]\:text-inherit code{color:inherit}.animate-modal-in{animation:.15s cubic-bezier(.2,.8,.2,1) modal-in}.animate-overlay-in{animation:.15s ease-out overlay-in}.animate-toast-in{animation:.12s ease-out toast-in}}:where(button,[role=button],input,select,textarea,a,summary,video[tabindex],[tabindex]):focus-visible{outline:2px solid var(--color-indigo-500,#6366f1);outline-offset:2px}:root{color-scheme:light dark;--z-combobox-list:60;--z-syntax-helper:65;--z-context-menu:70;--z-modal:80;--z-drop-overlay:85;--z-toast:90;--z-tooltip:100}:root,[data-theme=dark]{--app-bg:#020617;--app-surface:#0f172a;--app-elevated:#1e293b;--app-hover:#334155;--app-border:#334155;--app-frame-border:#94a3b84d;--app-text-primary:#f8fafc;--app-text-secondary:#cbd5e1;--app-text-muted:#94a3b8;--app-text-faint:#94a3b8;--app-glass:#0f172a99;--app-glass-strong:#020617e6;--app-glass-panel:#0f172ac7;--app-glass-panel-strong:#020617e0;--app-glass-highlight:#ffffff17;--app-panel-shadow:0 24px 60px -12px #0206178c;--app-editor-bg:#1e1e1e;--app-editor-gutter-bg:#181818;--app-editor-active-line:#282828;--app-editor-selection:#6366f14d;--app-editor-border:#34343e;--app-editor-syntax-comment:#6a9955;--app-editor-syntax-key:#9cdcfe;--app-editor-syntax-string:#ce9178;--app-editor-syntax-keyword:#569cd6;--app-editor-syntax-label:#4ec9b0;color-scheme:dark;--chip-indigo-bg:#6366f140;--chip-indigo-border:#818cf880;--chip-indigo-text:#c7d2fe;--chip-purple-bg:#a855f740;--chip-purple-border:#c084fc80;--chip-purple-text:#f3e8ff;--chip-fuchsia-bg:#c026d340;--chip-fuchsia-border:#e879f980;--chip-fuchsia-text:#f5d0fe;--chip-sky-bg:#0ea5e940;--chip-sky-border:#38bdf880;--chip-sky-text:#bae6fd;--chip-amber-bg:#f59e0b40;--chip-amber-border:#fbbf2480;--chip-amber-text:#fde68a;--status-success-bg:#10b98140;--status-success-border:#34d39980;--status-success-text:#a7f3d0;--status-warning-bg:#f59e0b40;--status-warning-border:#fbbf2480;--status-warning-text:#fde68a;--status-danger-bg:#f43f5e40;--status-danger-border:#fb718580;--status-danger-text:#fecdd3}[data-theme=light]{--chip-indigo-bg:#e0e7ff;--chip-indigo-border:#a5b4fc;--chip-indigo-text:#3730a3;--chip-purple-bg:#f3e8ff;--chip-purple-border:#d8b4fe;--chip-purple-text:#6b21a8;--chip-fuchsia-bg:#fae8ff;--chip-fuchsia-border:#f0abfc;--chip-fuchsia-text:#86198f;--chip-sky-bg:#e0f2fe;--chip-sky-border:#7dd3fc;--chip-sky-text:#0369a1;--chip-amber-bg:#fef3c7;--chip-amber-border:#fcd34d;--chip-amber-text:#92400e;--status-success-bg:#d1fae5;--status-success-border:#6ee7b7;--status-success-text:#065f46;--status-warning-bg:#fef3c7;--status-warning-border:#fcd34d;--status-warning-text:#92400e;--status-danger-bg:#ffe4e6;--status-danger-border:#fda4af;--status-danger-text:#9f1239;--app-bg:#f8fafc;--app-surface:#fff;--app-elevated:#f1f5f9;--app-hover:#e2e8f0;--app-border:#cbd5e1;--app-frame-border:#0f172a29;--app-text-primary:#0f172a;--app-text-secondary:#334155;--app-text-muted:#475569;--app-text-faint:#475569;--app-glass:#ffffffb3;--app-glass-strong:#f8fafcf2;--app-glass-panel:#fffc;--app-glass-panel-strong:#f8fafceb;--app-glass-highlight:#ffffffe6;--app-panel-shadow:0 24px 60px -18px #0f172a47;--app-editor-bg:#fff;--app-editor-gutter-bg:#f8fafc;--app-editor-active-line:#f1f5f9;--app-editor-selection:#6366f129;--app-editor-border:#e2e8f0;--app-editor-syntax-comment:green;--app-editor-syntax-key:#0451a5;--app-editor-syntax-string:#a31515;--app-editor-syntax-keyword:#00f;--app-editor-syntax-label:#267f99;color-scheme:light}body{background-color:var(--app-bg);min-height:100vh;color:var(--app-text-primary);margin:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;transition:background-color .2s,color .2s}@media(prefers-reduced-motion:reduce){*,:before,:after{scroll-behavior:auto!important;transition-duration:.01ms!important;animation-duration:.01ms!important;animation-iteration-count:1!important}}@keyframes modal-in{0%{opacity:0;transform:translateY(4px)scale(.995)}to{opacity:1;transform:none}}@keyframes overlay-in{0%{opacity:0}to{opacity:1}}@keyframes toast-in{0%{opacity:0;translate:-50% calc(6px - 50%)}to{opacity:1;translate:-50% -50%}}*{scrollbar-color:var(--app-border) transparent;scrollbar-width:thin}::-webkit-scrollbar{width:10px;height:10px}::-webkit-scrollbar-track{background:0 0}::-webkit-scrollbar-thumb{background-color:var(--app-border);background-clip:content-box;border:2px solid #0000;border-radius:9999px}::-webkit-scrollbar-thumb:hover{background-color:var(--app-text-faint)}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-space-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@keyframes spin{to{transform:rotate(360deg)}}@keyframes pulse{50%{opacity:.5}} diff --git a/src/profiles/web/dist/assets/index-CY2LGDSY.js b/src/profiles/web/dist/assets/index-CY2LGDSY.js deleted file mode 100644 index e6f84b9..0000000 --- a/src/profiles/web/dist/assets/index-CY2LGDSY.js +++ /dev/null @@ -1,448 +0,0 @@ -var sM=Object.defineProperty;var oM=(n,e,t)=>e in n?sM(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var dh=(n,e,t)=>oM(n,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function t(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(l){if(l.ep)return;l.ep=!0;const o=t(l);fetch(l.href,o)}})();function my(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Vg={exports:{}},_c={};/** - * @license React - * react-jsx-runtime.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Ok;function aM(){if(Ok)return _c;Ok=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(i,l,o){var a=null;if(o!==void 0&&(a=""+o),l.key!==void 0&&(a=""+l.key),"key"in l){o={};for(var u in l)u!=="key"&&(o[u]=l[u])}else o=l;return l=o.ref,{$$typeof:n,type:i,key:a,ref:l!==void 0?l:null,props:o}}return _c.Fragment=e,_c.jsx=t,_c.jsxs=t,_c}var Nk;function cM(){return Nk||(Nk=1,Vg.exports=aM()),Vg.exports}var y=cM(),Qg={exports:{}},qe={};/** - * @license React - * react.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Tk;function uM(){if(Tk)return qe;Tk=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.for("react.view_transition"),v=Symbol.iterator;function w(R){return R===null||typeof R!="object"?null:(R=v&&R[v]||R["@@iterator"],typeof R=="function"?R:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,N={};function j(R,$,ue){this.props=R,this.context=$,this.refs=N,this.updater=ue||S}j.prototype.isReactComponent={},j.prototype.setState=function(R,$){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,$,"setState")},j.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function D(){}D.prototype=j.prototype;function I(R,$,ue){this.props=R,this.context=$,this.refs=N,this.updater=ue||S}var U=I.prototype=new D;U.constructor=I,C(U,j.prototype),U.isPureReactComponent=!0;var E=Array.isArray;function T(){}var z={H:null,A:null,T:null,S:null},te=Object.prototype.hasOwnProperty;function q(R,$,ue){var ge=ue.ref;return{$$typeof:n,type:R,key:$,ref:ge!==void 0?ge:null,props:ue}}function G(R,$){return q(R.type,$,R.props)}function F(R){return typeof R=="object"&&R!==null&&R.$$typeof===n}function se(R){var $={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(ue){return $[ue]})}var me=/\/+/g;function ne(R,$){return typeof R=="object"&&R!==null&&R.key!=null?se(""+R.key):$.toString(36)}function _(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(T,T):(R.status="pending",R.then(function($){R.status==="pending"&&(R.status="fulfilled",R.value=$)},function($){R.status==="pending"&&(R.status="rejected",R.reason=$)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function Z(R,$,ue,ge,je){var Ne=typeof R;(Ne==="undefined"||Ne==="boolean")&&(R=null);var Pe=!1;if(R===null)Pe=!0;else switch(Ne){case"bigint":case"string":case"number":Pe=!0;break;case"object":switch(R.$$typeof){case n:case e:Pe=!0;break;case m:return Pe=R._init,Z(Pe(R._payload),$,ue,ge,je)}}if(Pe)return je=je(R),Pe=ge===""?"."+ne(R,0):ge,E(je)?(ue="",Pe!=null&&(ue=Pe.replace(me,"$&/")+"/"),Z(je,$,ue,"",function(Pt){return Pt})):je!=null&&(F(je)&&(je=G(je,ue+(je.key==null||R&&R.key===je.key?"":(""+je.key).replace(me,"$&/")+"/")+Pe)),$.push(je)),1;Pe=0;var be=ge===""?".":ge+":";if(E(R))for(var _e=0;_e>>1,A=_[re];if(0>>1;rel(B,ie))Rl($,B)?(_[re]=$,_[R]=ie,re=R):(_[re]=B,_[ze]=ie,re=ze);else if(Rl($,ie))_[re]=$,_[R]=ie,re=R;else break e}}return Z}function l(_,Z){var ie=_.sortIndex-Z.sortIndex;return ie!==0?ie:_.id-Z.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;n.unstable_now=function(){return o.now()}}else{var a=Date,u=a.now();n.unstable_now=function(){return a.now()-u}}var f=[],d=[],m=1,g=null,b=3,v=!1,w=!1,S=!1,C=!1,N=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function I(_){for(var Z=t(d);Z!==null;){if(Z.callback===null)i(d);else if(Z.startTime<=_)i(d),Z.sortIndex=Z.expirationTime,e(f,Z);else break;Z=t(d)}}function U(_){if(S=!1,I(_),!w)if(t(f)!==null)w=!0,E||(E=!0,F());else{var Z=t(d);Z!==null&&ne(U,Z.startTime-_)}}var E=!1,T=-1,z=5,te=-1;function q(){return C?!0:!(n.unstable_now()-te_&&q());){var re=g.callback;if(typeof re=="function"){g.callback=null,b=g.priorityLevel;var A=re(g.expirationTime<=_);if(_=n.unstable_now(),typeof A=="function"){g.callback=A,I(_),Z=!0;break t}g===t(f)&&i(f),I(_)}else i(f);g=t(f)}if(g!==null)Z=!0;else{var Be=t(d);Be!==null&&ne(U,Be.startTime-_),Z=!1}}break e}finally{g=null,b=ie,v=!1}Z=void 0}}finally{Z?F():E=!1}}}var F;if(typeof D=="function")F=function(){D(G)};else if(typeof MessageChannel<"u"){var se=new MessageChannel,me=se.port2;se.port1.onmessage=G,F=function(){me.postMessage(null)}}else F=function(){N(G,0)};function ne(_,Z){T=N(function(){_(n.unstable_now())},Z)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(_){_.callback=null},n.unstable_forceFrameRate=function(_){0>_||125<_?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):z=0<_?Math.floor(1e3/_):5},n.unstable_getCurrentPriorityLevel=function(){return b},n.unstable_next=function(_){switch(b){case 1:case 2:case 3:var Z=3;break;default:Z=b}var ie=b;b=Z;try{return _()}finally{b=ie}},n.unstable_requestPaint=function(){C=!0},n.unstable_runWithPriority=function(_,Z){switch(_){case 1:case 2:case 3:case 4:case 5:break;default:_=3}var ie=b;b=_;try{return Z()}finally{b=ie}},n.unstable_scheduleCallback=function(_,Z,ie){var re=n.unstable_now();switch(typeof ie=="object"&&ie!==null?(ie=ie.delay,ie=typeof ie=="number"&&0re?(_.sortIndex=ie,e(d,_),t(f)===null&&_===t(d)&&(S?(j(T),T=-1):S=!0,ne(U,ie-re))):(_.sortIndex=A,e(f,_),w||v||(w=!0,E||(E=!0,F()))),_},n.unstable_shouldYield=q,n.unstable_wrapCallback=function(_){var Z=b;return function(){var ie=b;b=Z;try{return _.apply(this,arguments)}finally{b=ie}}}})(Yg)),Yg}var Mk;function dM(){return Mk||(Mk=1,$g.exports=hM()),$g.exports}var Gg={exports:{}},Rn={};/** - * @license React - * react-dom.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var Dk;function mM(){if(Dk)return Rn;Dk=1;var n=py();function e(m){var g="https://react.dev/errors/"+m;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Gg.exports=mM(),Gg.exports}/** - * @license React - * react-dom-client.production.js - * - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */var jk;function pM(){if(jk)return Lc;jk=1;var n=dM(),e=py(),t=YC();function i(r){var s="https://react.dev/errors/"+r;if(1gn||(r.current=tn[gn],tn[gn]=null,gn--)}function ot(r,s){gn++,tn[gn]=r.current,r.current=s}var nn=zt(null),Pn=zt(null),Ht=zt(null),rn=zt(null);function Se(r,s){switch(ot(Ht,s),ot(Pn,r),ot(nn,null),s.nodeType){case 9:case 11:r=(r=s.documentElement)&&(r=r.namespaceURI)?_w(r):0;break;default:if(r=s.tagName,s=s.namespaceURI)s=_w(s),r=Lw(s,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}Ct(nn),ot(nn,r)}function Ve(){Ct(nn),Ct(Pn),Ct(Ht)}function We(r){var s=r.memoizedState;s!==null&&(Zo._currentValue=s.memoizedState,ot(rn,r)),s=nn.current;var c=Lw(s,r.type);s!==c&&(ot(Pn,r),ot(nn,c))}function ft(r){Pn.current===r&&(Ct(nn),Ct(Pn)),rn.current===r&&(Ct(rn),Zo._currentValue=Pt)}var ee,fe;function Te(r){if(ee===void 0)try{throw Error()}catch(c){var s=c.stack.trim().match(/\n( *(at )?)/);ee=s&&s[1]||"",fe=-1)":-1p||L[h]!==Y[p]){var J=` -`+L[h].replace(" at new "," at ");return r.displayName&&J.includes("")&&(J=J.replace("",r.displayName)),J}while(1<=h&&0<=p);break}}}finally{He=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?Te(c):""}function pe(r,s){switch(r.tag){case 26:case 27:case 5:return Te(r.type);case 16:return Te("Lazy");case 13:return r.child!==s&&s!==null?Te("Suspense Fallback"):Te("Suspense");case 19:return Te("SuspenseList");case 0:case 15:return de(r.type,!1);case 11:return de(r.type.render,!1);case 1:return de(r.type,!0);case 31:return Te("Activity");case 30:return Te("ViewTransition");default:return""}}function Ee(r){try{var s="",c=null;do s+=pe(r,c),c=r,r=r.return;while(r);return s}catch(h){return` -Error generating stack: `+h.message+` -`+h.stack}}var nt=Object.prototype.hasOwnProperty,at=n.unstable_scheduleCallback,hn=n.unstable_cancelCallback,Kt=n.unstable_shouldYield,bi=n.unstable_requestPaint,Vt=n.unstable_now,xn=n.unstable_getCurrentPriorityLevel,ti=n.unstable_ImmediatePriority,yn=n.unstable_UserBlockingPriority,dl=n.unstable_NormalPriority,ps=n.unstable_LowPriority,zu=n.unstable_IdlePriority,uo=n.log,gs=n.unstable_setDisableYieldValue,ye=null,Qn=null;function cr(r){if(typeof uo=="function"&&gs(r),Qn&&typeof Qn.setStrictMode=="function")try{Qn.setStrictMode(ye,r)}catch{}}var Bt=Math.clz32?Math.clz32:ii,Qt=Math.log,ni=Math.LN2;function ii(r){return r>>>=0,r===0?32:31-(Qt(r)/ni|0)|0}var At=256,fo=262144,xs=4194304;function bn(r){var s=r&42;if(s!==0)return s;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&-r;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function ho(r,s,c){var h=r.pendingLanes;if(h===0)return 0;var p=0,x=r.suspendedLanes,k=r.pingedLanes;r=r.warmLanes;var O=h&134217727;return O!==0?(h=O&~x,h!==0?p=bn(h):(k&=O,k!==0?p=bn(k):c||(c=O&~r,c!==0&&(p=bn(c))))):(O=h&~x,O!==0?p=bn(O):k!==0?p=bn(k):c||(c=h&~r,c!==0&&(p=bn(c)))),p===0?0:s!==0&&s!==p&&(s&x)===0&&(x=p&-p,c=s&-s,x>=c||x===32&&(c&4194048)!==0)?s:p}function ml(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function ys(r,s){(s&8)!==0&&(s|=s&32);var c=r.entangledLanes;if(c!==0)for(r=r.entanglements,c&=s;0c;c++)s.push(r);return s}function ur(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function Pa(r,s,c,h,p,x){var k=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var O=r.entanglements,L=r.expirationTimes,Y=r.hiddenUpdates;for(c=k&~c;0"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Tm=!1;if(qr)try{var $a={};Object.defineProperty($a,"passive",{get:function(){Tm=!0}}),window.addEventListener("test",$a,$a),window.removeEventListener("test",$a,$a)}catch{Tm=!1}var vl=null,Am=null,Gu=null;function Mb(){if(Gu)return Gu;var r,s=Am,c=s.length,h,p="value"in vl?vl.value:vl.textContent,x=p.length;for(r=0;r=Ka),zb=" ",Bb=!1;function Pb(r,s){switch(r){case"keyup":return i5.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Hb(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var vo=!1;function l5(r,s){switch(r){case"compositionend":return Hb(s);case"keypress":return s.which!==32?null:(Bb=!0,zb);case"textInput":return r=s.data,r===zb&&Bb?null:r;default:return null}}function s5(r,s){if(vo)return r==="compositionend"||!jm&&Pb(r,s)?(r=Mb(),Gu=Am=vl=null,vo=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function $b(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Yb(r,s){var c=$b(r);r=0;for(var h;c;){if(c.nodeType===3){if(h=r+c.textContent.length,r<=s&&h>=s)return{node:c,offset:s-r};r=h}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=$b(c)}}function Gb(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?Gb(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function Kb(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=zm(r.document);s instanceof r.HTMLIFrameElement;){try{var c=typeof s.contentWindow.location.href=="string"}catch{c=!1}if(c)r=s.contentWindow;else break;s=zm(r.document)}return s}function Bm(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}var m5=qr&&"documentMode"in document&&11>=document.documentMode,wo=null,Pm=null,ec=null,Hm=!1;function Wb(r,s,c){var h=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Hm||wo==null||wo!==zm(h)||(h=wo,"selectionStart"in h&&Bm(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),ec&&Ja(ec,h)||(ec=h,h=th(Pm,"onSelect"),0>=k,p-=k,dr=1<<32-Bt(s)+p|c<Ue?(cn=Le,Le=null):cn=Le.sibling;var dt=Q(X,Le,K[Ue],ae);if(dt===null){Le===null&&(Le=cn);break}r&&Le&&dt.alternate===null&&s(X,Le),V=x(dt,V,Ue),ut===null?Ae=dt:ut.sibling=dt,ut=dt,Le=cn}if(Ue===K.length)return c(X,Le),Ze&&$r(X,Ue),Ae;if(Le===null){for(;UeUe?(cn=Le,Le=null):cn=Le.sibling;var Ql=Q(X,Le,dt.value,ae);if(Ql===null){Le===null&&(Le=cn);break}r&&Le&&Ql.alternate===null&&s(X,Le),V=x(Ql,V,Ue),ut===null?Ae=Ql:ut.sibling=Ql,ut=Ql,Le=cn}if(dt.done)return c(X,Le),Ze&&$r(X,Ue),Ae;if(Le===null){for(;!dt.done;Ue++,dt=K.next())dt=ce(X,dt.value,ae),dt!==null&&(V=x(dt,V,Ue),ut===null?Ae=dt:ut.sibling=dt,ut=dt);return Ze&&$r(X,Ue),Ae}for(Le=h(Le);!dt.done;Ue++,dt=K.next())dt=W(Le,X,Ue,dt.value,ae),dt!==null&&(r&&(cn=dt.alternate,cn!==null&&Le.delete(cn.key===null?Ue:cn.key)),V=x(dt,V,Ue),ut===null?Ae=dt:ut.sibling=dt,ut=dt);return r&&Le.forEach(function(lM){return s(X,lM)}),Ze&&$r(X,Ue),Ae}function Ge(X,V,K,ae){if(typeof K=="object"&&K!==null&&K.type===G&&K.key===null&&K.props.ref===void 0&&(K=K.props.children),typeof K=="object"&&K!==null){switch(K.$$typeof){case te:e:{for(var Ae=K.key;V!==null;){if(V.key===Ae){if(Ae=K.type,Ae===G){if(V.tag===7){c(X,V.sibling),ae=p(V,K.props.children),Nl(ae,K),ae.return=X,X=ae;break e}}else if(V.elementType===Ae||typeof Ae=="object"&&Ae!==null&&Ae.$$typeof===A&&Rs(Ae)===V.type){c(X,V.sibling),ae=p(V,K.props),Nl(ae,K),ae.return=X,X=ae;break e}c(X,V);break}else s(X,V);V=V.sibling}K.type===G?(ae=Os(K.props.children,X.mode,ae,K.key),Nl(ae,K),ae.return=X,X=ae):(ae=sf(K.type,K.key,K.props,null,X.mode,ae),Nl(ae,K),ae.return=X,X=ae)}return k(X);case q:e:{for(Ae=K.key;V!==null;){if(V.key===Ae)if(V.tag===4&&V.stateNode.containerInfo===K.containerInfo&&V.stateNode.implementation===K.implementation){c(X,V.sibling),ae=p(V,K.children||[]),ae.return=X,X=ae;break e}else{c(X,V);break}else s(X,V);V=V.sibling}ae=Xm(K,X.mode,ae),ae.return=X,X=ae}return k(X);case A:return K=Rs(K),Ge(X,V,K,ae)}if(Pe(K))return ve(X,V,K,ae);if(ge(K)){if(Ae=ge(K),typeof Ae!="function")throw Error(i(150));return K=Ae.call(K),Me(X,V,K,ae)}if(typeof K.then=="function")return Ge(X,V,gf(K),ae);if(K.$$typeof===ne)return Ge(X,V,hf(X,K),ae);xf(X,K)}return typeof K=="string"&&K!==""||typeof K=="number"||typeof K=="bigint"?(K=""+K,V!==null&&V.tag===6?(c(X,V.sibling),ae=p(V,K),ae.return=X,X=ae):(c(X,V),ae=Qm(K,X.mode,ae),ae.return=X,X=ae),k(X)):c(X,V)}return function(X,V,K,ae){try{sc=0;var Ae=Ge(X,V,K,ae);return Mo=null,Ae}catch(Le){if(Le===Eo||Le===mf)throw Le;var ut=li(29,Le,null,X.mode);return ut.lanes=ae,ut.return=X,ut}finally{}}}var _s=w1(!0),k1=w1(!1),Tl=!1;function np(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function ip(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function Al(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function El(r,s,c){var h=r.updateQueue;if(h===null)return null;if(h=h.shared,(yt&2)!==0){var p=h.pending;return p===null?s.next=s:(s.next=p.next,p.next=s),h.pending=s,s=lf(r),l1(r,null,c),s}return rf(r,h,s,c),lf(r)}function oc(r,s,c){if(s=s.updateQueue,s!==null&&(s=s.shared,(c&4194048)!==0)){var h=s.lanes;h&=r.pendingLanes,c|=h,s.lanes=c,mo(r,c)}}function rp(r,s){var c=r.updateQueue,h=r.alternate;if(h!==null&&(h=h.updateQueue,c===h)){var p=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var k={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?p=x=k:x=x.next=k,c=c.next}while(c!==null);x===null?p=x=s:x=x.next=s}else p=x=s;c={baseState:h.baseState,firstBaseUpdate:p,lastBaseUpdate:x,shared:h.shared,callbacks:h.callbacks},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=s:r.next=s,c.lastBaseUpdate=s}var lp=!1;function ac(){if(lp){var r=Ao;if(r!==null)throw r}}function cc(r,s,c,h){lp=!1;var p=r.updateQueue;Tl=!1;var x=p.firstBaseUpdate,k=p.lastBaseUpdate,O=p.shared.pending;if(O!==null){p.shared.pending=null;var L=O,Y=L.next;L.next=null,k===null?x=Y:k.next=Y,k=L;var J=r.alternate;J!==null&&(J=J.updateQueue,O=J.lastBaseUpdate,O!==k&&(O===null?J.firstBaseUpdate=Y:O.next=Y,J.lastBaseUpdate=L))}if(x!==null){var ce=p.baseState;k=0,J=Y=L=null,O=x;do{var Q=O.lane&-536870913,W=Q!==O.lane;if(W?(ct&Q)===Q:(h&Q)===Q){Q!==0&&Q===Ms&&(lp=!0),J!==null&&(J=J.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var ve=r,Me=O;Q=s;var Ge=c;switch(Me.tag){case 1:if(ve=Me.payload,typeof ve=="function"){ce=ve.call(Ge,ce,Q);break e}ce=ve;break e;case 3:ve.flags=ve.flags&-65537|128;case 0:if(ve=Me.payload,Q=typeof ve=="function"?ve.call(Ge,ce,Q):ve,Q==null)break e;ce=T({},ce,Q);break e;case 2:Tl=!0}}Q=O.callback,Q!==null&&(r.flags|=64,W&&(r.flags|=8192),W=p.callbacks,W===null?p.callbacks=[Q]:W.push(Q))}else W={lane:Q,tag:O.tag,payload:O.payload,callback:O.callback,next:null},J===null?(Y=J=W,L=ce):J=J.next=W,k|=Q;if(O=O.next,O===null){if(O=p.shared.pending,O===null)break;W=O,O=W.next,W.next=null,p.lastBaseUpdate=W,p.shared.pending=null}}while(!0);J===null&&(L=ce),p.baseState=L,p.firstBaseUpdate=Y,p.lastBaseUpdate=J,x===null&&(p.shared.lanes=0),zl|=k,r.lanes=k,r.memoizedState=ce}}function S1(r,s){if(typeof r!="function")throw Error(i(191,r));r.call(s)}function C1(r,s){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;rx?x:8;var k=be.T,O={};O.types=k!==null?k.types:null,be.T=O,Op(r,!1,s,c);try{var L=p(),Y=be.S;if(Y!==null&&Y(O,L),L!==null&&typeof L=="object"&&typeof L.then=="function"){var J=O5(L,h);dc(r,s,J,Oi(r))}else dc(r,s,h,Oi(r))}catch(ce){dc(r,s,{then:function(){},status:"rejected",reason:ce},Oi())}finally{_e.p=x,k!==null&&O.types!==null&&(k.types=O.types),be.T=k}}function D5(){}function Sp(r,s,c,h){if(r.tag!==5)throw Error(i(476));var p=nv(r).queue;tv(r,p,s,Pt,c===null?D5:function(){return iv(r),c(h)})}function nv(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:Pt,baseState:Pt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wr,lastRenderedState:Pt},next:null};var c={};return s.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Wr,lastRenderedState:c},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function iv(r){var s=nv(r);s.next===null&&(s=r.alternate.memoizedState),dc(r,s.next.queue,{},Oi())}function Cp(){return Tn(Zo)}function rv(){return Zt().memoizedState}function lv(){return Zt().memoizedState}function R5(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var c=Oi();r=Al(c);var h=El(s,r,c);h!==null&&(ci(h,s,c),oc(h,s,c)),s={cache:Zm()},r.payload=s;return}s=s.return}}function j5(r,s,c){var h=Oi();c={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Tf(r)?ov(s,c):(c=qm(r,s,c,h),c!==null&&(ci(c,r,h),av(c,s,h)))}function sv(r,s,c){var h=Oi();dc(r,s,c,h)}function dc(r,s,c,h){var p={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Tf(r))ov(s,p);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=s.lastRenderedReducer,x!==null))try{var k=s.lastRenderedState,O=x(k,c);if(p.hasEagerState=!0,p.eagerState=O,vi(O,k))return rf(r,s,p,0),Et===null&&nf(),!1}catch{}finally{}if(c=qm(r,s,p,h),c!==null)return ci(c,r,h),av(c,s,h),!0}return!1}function Op(r,s,c,h){if(h={lane:2,revertLane:pg(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Tf(r)){if(s)throw Error(i(479))}else s=qm(r,c,h,2),s!==null&&ci(s,r,2)}function Tf(r){var s=r.alternate;return r===Ye||s!==null&&s===Ye}function ov(r,s){Do=vf=!0;var c=r.pending;c===null?s.next=s:(s.next=c.next,c.next=s),r.pending=s}function av(r,s,c){if((c&4194048)!==0){var h=s.lanes;h&=r.pendingLanes,c|=h,s.lanes=c,mo(r,c)}}var Af={readContext:Tn,use:Sf,useCallback:Xt,useContext:Xt,useEffect:Xt,useImperativeHandle:Xt,useLayoutEffect:Xt,useInsertionEffect:Xt,useMemo:Xt,useReducer:Xt,useRef:Xt,useState:Xt,useDebugValue:Xt,useDeferredValue:Xt,useTransition:Xt,useSyncExternalStore:Xt,useId:Xt,useHostTransitionStatus:Xt,useFormState:Xt,useActionState:Xt,useOptimistic:Xt,useMemoCache:Xt,useCacheRefresh:Xt,useEffectEvent:Xt},cv={readContext:Tn,use:Sf,useCallback:function(r,s){return Yn().memoizedState=[r,s===void 0?null:s],r},useContext:Tn,useEffect:X1,useImperativeHandle:function(r,s,c){c=c!=null?c.concat([r]):null,Of(4194308,4,K1.bind(null,s,r),c)},useLayoutEffect:function(r,s){return Of(4194308,4,r,s)},useInsertionEffect:function(r,s){Of(4,2,r,s)},useMemo:function(r,s){var c=Yn();s=s===void 0?null:s;var h=r();if(Ls){cr(!0);try{r()}finally{cr(!1)}}return c.memoizedState=[h,s],h},useReducer:function(r,s,c){var h=Yn();if(c!==void 0){var p=c(s);if(Ls){cr(!0);try{c(s)}finally{cr(!1)}}}else p=s;return h.memoizedState=h.baseState=p,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:p},h.queue=r,r=r.dispatch=j5.bind(null,Ye,r),[h.memoizedState,r]},useRef:function(r){var s=Yn();return r={current:r},s.memoizedState=r},useState:function(r){r=yp(r);var s=r.queue,c=sv.bind(null,Ye,s);return s.dispatch=c,[r.memoizedState,c]},useDebugValue:wp,useDeferredValue:function(r,s){var c=Yn();return kp(c,r,s)},useTransition:function(){var r=yp(!1);return r=tv.bind(null,Ye,r.queue,!0,!1),Yn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,c){var h=Ye,p=Yn();if(Ze){if(c===void 0)throw Error(i(407));c=c()}else{if(c=s(),Et===null)throw Error(i(349));(ct&127)!==0||M1(h,s,c)}p.memoizedState=c;var x={value:c,getSnapshot:s};return p.queue=x,X1(R1.bind(null,h,x,r),[r]),h.flags|=2048,jo(9,{destroy:void 0},D1.bind(null,h,x,c,s),null),c},useId:function(){var r=Yn(),s=Et.identifierPrefix;if(Ze){var c=mr,h=dr;c=(h&~(1<<32-Bt(h)-1)).toString(32)+c,s="_"+s+"R_"+c,c=wf++,0<\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof h.is=="string"?k.createElement("select",{is:h.is}):k.createElement("select"),h.multiple?x.multiple=!0:h.size&&(x.size=h.size);break;default:x=typeof h.is=="string"?k.createElement(p,{is:h.is}):k.createElement(p)}}x[It]=s,x[Wt]=h;e:for(k=s.child;k!==null;){if(k.tag===5||k.tag===6)x.appendChild(k.stateNode);else if(k.tag!==4&&k.tag!==27&&k.child!==null){k.child.return=k,k=k.child;continue}if(k===s)break e;for(;k.sibling===null;){if(k.return===null||k.return===s)break e;k=k.return}k.sibling.return=k.return,k=k.sibling}s.stateNode=x;e:switch(Dn(x,p,h),p){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&Jr(s)}}return _t(s),s.subtreeFlags&=-33554433,Pp(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,c),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==h&&Jr(s);else{if(typeof h!="string"&&s.stateNode===null)throw Error(i(166));if(r=Ht.current,To(s)){if(r=s.stateNode,c=s.memoizedProps,h=null,p=wn,p!==null)switch(p.tag){case 27:case 5:h=p.memoizedProps}r[It]=s,r=!!(r.nodeValue===c||h!==null&&h.suppressHydrationWarning===!0||Rw(r.nodeValue,c)),r||Cl(s,!0)}else r=Nc(r).createTextNode(h),r[It]=s,s.stateNode=r}return _t(s),null;case 31:if(c=s.memoizedState,r===null||r.memoizedState!==null){if(h=To(s),c!==null){if(r===null){if(!h)throw Error(i(318));if(r=s.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));r[It]=s}else Ns(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;_t(s),r=!1}else c=Gm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return s.flags&256?(wi(s),s):(wi(s),null);if((s.flags&128)!==0)throw Error(i(558))}return _t(s),null;case 13:if(h=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(p=To(s),h!==null&&h.dehydrated!==null){if(r===null){if(!p)throw Error(i(318));if(p=s.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(i(317));p[It]=s}else Ns(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;_t(s),p=!1}else p=Gm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=p),p=!0;if(!p)return s.flags&256?(wi(s),s):(wi(s),null)}return wi(s),(s.flags&128)!==0?(s.lanes=c,s):(c=h!==null,r=r!==null&&r.memoizedState!==null,c&&(h=s.child,p=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(p=h.alternate.memoizedState.cachePool.pool),x=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(x=h.memoizedState.cachePool.pool),x!==p&&(h.flags|=2048)),c!==r&&c&&(s.child.flags|=8192),_f(s,s.updateQueue),_t(s),null);case 4:return Ve(),r===null&&bg(s.stateNode.containerInfo),s.flags|=67108864,_t(s),null;case 10:return Gr(s.type),_t(s),null;case 19:if(cp(s),h=s.memoizedState,h===null)return _t(s),null;if(p=(s.flags&128)!==0,x=h.rendering,x===null)if(p)pc(h,!1);else{if($t!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(x=bf(r),x!==null){for(s.flags|=128,pc(h,!1),r=x.updateQueue,s.updateQueue=r,_f(s,r),s.subtreeFlags=0,r=c,c=s.child;c!==null;)s1(c,r),c=c.sibling;return uc(s,En.current&1|2),Ze&&$r(s,h.treeForkCount),s.child}r=r.sibling}h.tail!==null&&Vt()>Xf&&(s.flags|=128,p=!0,pc(h,!1),s.lanes=4194304)}else{if(!p)if(r=bf(x),r!==null){if(s.flags|=128,p=!0,r=r.updateQueue,s.updateQueue=r,_f(s,r),pc(h,!0),h.tail===null&&h.tailMode!=="collapsed"&&h.tailMode!=="visible"&&!x.alternate&&!Ze)return _t(s),null}else 2*Vt()-h.renderingStartTime>Xf&&c!==536870912&&(s.flags|=128,p=!0,pc(h,!1),s.lanes=4194304);h.isBackwards?(x.sibling=s.child,s.child=x):(r=h.last,r!==null?r.sibling=x:s.child=x,h.last=x)}if(h.tail!==null){r=h.tail;e:{for(c=r;c!==null;){if(c.alternate!==null){c=!1;break e}c=c.sibling}c=!0}return h.rendering=r,h.tail=r.sibling,h.renderingStartTime=Vt(),r.sibling=null,x=En.current,x=p?x&1|2:x&1,h.tailMode==="visible"||h.tailMode==="collapsed"||!c||Ze?uc(s,x):(c=x,ot(An,s),ot(En,c),Hn===null&&(Hn=s)),Ze&&$r(s,h.treeForkCount),r}return _t(s),null;case 22:case 23:return wi(s),op(),h=s.memoizedState!==null,r!==null?r.memoizedState!==null!==h&&(s.flags|=8192):h&&(s.flags|=8192),h?(c&536870912)!==0&&(s.flags&128)===0&&(_t(s),s.subtreeFlags&6&&(s.flags|=8192)):_t(s),c=s.updateQueue,c!==null&&_f(s,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),h=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(h=s.memoizedState.cachePool.pool),h!==c&&(s.flags|=2048),r!==null&&Ct(Ds),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),Gr(sn),_t(s),null;case 25:return null;case 30:return s.flags|=33554432,_t(s),null}throw Error(i(156,s.tag))}function I5(r,s){switch($m(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return Gr(sn),Ve(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return ft(s),null;case 31:if(s.memoizedState!==null){if(wi(s),s.alternate===null)throw Error(i(340));Ns()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 13:if(wi(s),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(i(340));Ns()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return cp(s),r=s.flags,r&65536?(s.flags=r&-65537|128,r=s.memoizedState,r!==null&&(r.rendering=null,r.tail=null),s.flags|=4,s):null;case 4:return Ve(),null;case 10:return Gr(s.type),null;case 22:case 23:return wi(s),op(),r!==null&&Ct(Ds),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return Gr(sn),null;case 25:return null;default:return null}}function _v(r,s){switch($m(s),s.tag){case 3:Gr(sn),Ve();break;case 26:case 27:case 5:ft(s);break;case 4:Ve();break;case 31:s.memoizedState!==null&&wi(s);break;case 13:wi(s);break;case 19:cp(s);break;case 10:Gr(s.type);break;case 22:case 23:wi(s),op(),r!==null&&Ct(Ds);break;case 24:Gr(sn)}}function gc(r,s){try{var c=s.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var p=h.next;c=p;do{if((c.tag&r)===r){h=void 0;var x=c.create,k=c.inst;h=x(),k.destroy=h}c=c.next}while(c!==p)}}catch(O){kt(s,s.return,O)}}function jl(r,s,c){try{var h=s.updateQueue,p=h!==null?h.lastEffect:null;if(p!==null){var x=p.next;h=x;do{if((h.tag&r)===r){var k=h.inst,O=k.destroy;if(O!==void 0){k.destroy=void 0,p=s;var L=c,Y=O;try{Y()}catch(J){kt(p,L,J)}}}h=h.next}while(h!==x)}}catch(J){kt(s,s.return,J)}}function Lv(r){var s=r.updateQueue;if(s!==null){var c=r.stateNode;try{C1(s,c)}catch(h){kt(r,r.return,h)}}}function zv(r,s,c){c.props=zs(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(h){kt(r,s,h)}}function pr(r,s){try{var c=r.ref;if(c!==null){switch(r.tag){case 26:case 27:case 5:var h=r.stateNode;break;case 30:var p=r.stateNode,x=Vr(r.memoizedProps,p);(p.ref===null||p.ref.name!==x)&&(p.ref=qw(x)),h=p.ref;break;case 7:if(r.stateNode===null){var k=new Ni(r);g(r.child,!1,M3,k,void 0,void 0),r.stateNode=k}h=r.stateNode;break;default:h=r.stateNode}typeof c=="function"?r.refCleanup=c(h):c.current=h}}catch(O){kt(r,s,O)}}function Mn(r,s){var c=r.ref,h=r.refCleanup;if(c!==null)if(typeof h=="function")try{h()}catch(p){kt(r,s,p)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(p){kt(r,s,p)}else c.current=null}function Lf(r,s){if((r.tag===5||r.tag===27||r.tag===6)&&r.alternate===null&&s!==null)for(var c=0;c title"))),Dn(h,s,c),h[It]=r,ln(h),s=h;break e;case"link":if(x=sk("link","href",p).get(s+(c.href||""))){for(k=0;kGe&&(k=Ge,Ge=Me,Me=k);var X=Yb(O,Me),V=Yb(O,Ge);if(X&&V&&(W.rangeCount!==1||W.anchorNode!==X.node||W.anchorOffset!==X.offset||W.focusNode!==V.node||W.focusOffset!==V.offset)){var K=ce.createRange();K.setStart(X.node,X.offset),W.removeAllRanges(),Me>Ge?(W.addRange(K),W.extend(V.node,V.offset)):(K.setEnd(V.node,V.offset),W.addRange(K))}}}}for(ce=[],W=O;W=W.parentNode;)W.nodeType===1&&ce.push({element:W,left:W.scrollLeft,top:W.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;Oc?32:c,be.T=null,c=lg,lg=null;var x=Zi,k=wr;if(qt=0,Is=Zi=null,wr=0,(yt&6)!==0)throw Error(i(331));var O=yt;if(yt|=4,lw(x.current),nw(x,x.current,k,c),yt=O,Sc(0,!1),Qn&&typeof Qn.onPostCommitFiberRoot=="function")try{Qn.onPostCommitFiberRoot(ye,x)}catch{}return!0}finally{_e.p=p,be.T=h,vw(r,s)}}function ww(r,s,c){s=_i(c,s),s=Ap(r.stateNode,s,2),r=El(r,s,2),r!==null&&(ur(r,2),kr(r))}function kt(r,s,c){if(r.tag===3)ww(r,r,c);else for(;s!==null;){if(s.tag===3){ww(s,r,c);break}else if(s.tag===1){var h=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Bl===null||!Bl.has(h))){r=_i(c,r),c=xv(2),h=El(s,c,2),h!==null&&(yv(c,h,s,r),ur(h,2),kr(h));break}}s=s.return}}function hg(r,s,c){var h=r.pingCache;if(h===null){h=r.pingCache=new V5;var p=new Set;h.set(s,p)}else p=h.get(s),p===void 0&&(p=new Set,h.set(s,p));p.has(c)||(ng=!0,p.add(c),r=Z5.bind(null,r,s,c),s.then(r,r))}function Z5(r,s,c){var h=r.pingCache;h!==null&&h.delete(s),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,Et===r&&(ct&c)===c&&(($t===4||$t===3&&(ct&62914560)===ct&&300>Vt()-Qf)&&(yt&2)===0?Vo(r,0):Vf|=c,Ho===ct&&(Ho=0)),kr(r)}function kw(r,s){s===0&&(s=Bu()),r=Cs(r,s),r!==null&&(ur(r,s),kr(r))}function J5(r){var s=r.memoizedState,c=0;s!==null&&(c=s.retryLane),kw(r,c)}function e3(r,s){var c=0;switch(r.tag){case 31:case 13:var h=r.stateNode,p=r.memoizedState;p!==null&&(c=p.retryLane);break;case 19:h=r.stateNode;break;case 22:h=r.stateNode._retryCache;break;default:throw Error(i(314))}h!==null&&h.delete(s),kw(r,c)}function t3(r,s){return at(r,s)}var Xo=null,$o=null,dg=!1,Jf=!1,mg=!1,Hl=0;function kr(r){r!==$o&&r.next===null&&($o===null?Xo=$o=r:$o=$o.next=r),Jf=!0,dg||(dg=!0,i3())}function Sc(r,s){if(!mg&&Jf){mg=!0;do for(var c=!1,h=Xo;h!==null;){if(r!==0){var p=h.pendingLanes;if(p===0)var x=0;else{var k=h.suspendedLanes,O=h.pingedLanes;x=(1<<31-Bt(42|r)+1)-1,x&=p&~(k&~O),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,Nw(h,x))}else x=ct,x=ho(h,h===Et?x:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(x&3)===0||ml(h,x)||(c=!0,Nw(h,x));h=h.next}while(c);mg=!1}}function n3(){Sw()}function Sw(){Jf=dg=!1;var r=0;Hl!==0&&m3()&&(r=Hl);for(var s=Vt(),c=null,h=Xo;h!==null;){var p=h.next,x=Cw(h,s);x===0?(h.next=null,c===null?Xo=p:c.next=p,p===null&&($o=c)):(c=h,(r!==0||(x&3)!==0)&&(Jf=!0)),h=p}qt!==0&&qt!==5||Sc(r),Hl!==0&&(Hl=0)}function Cw(r,s){for(var c=r.suspendedLanes,h=r.pingedLanes,p=r.expirationTimes,x=r.pendingLanes&-62914561;0O)break;var J=L.transferSize,ce=L.initiatorType;J&&jw(ce)&&(L=L.responseEnd,k+=J*(Lrh){Me.length=ve;break}K=new Promise(v3.bind(K)),Me.push(K)}}}if(0"u"?null:document;function nk(r,s,c){var h=Go;if(h&&typeof s=="string"&&s){var p=H(s);p='link[rel="'+r+'"][href="'+p+'"]',typeof c=="string"&&(p+='[crossorigin="'+c+'"]'),tk.has(p)||(tk.add(p),r={rel:r,crossOrigin:c,href:s},h.querySelector(p)===null&&(s=h.createElement("link"),Dn(s,"link",r),ln(s),h.head.appendChild(s)))}}function H3(r){tl.D(r),nk("dns-prefetch",r,null)}function I3(r,s){tl.C(r,s),nk("preconnect",r,s)}function U3(r,s,c){tl.L(r,s,c);var h=Go;if(h&&r&&s){var p='link[rel="preload"][as="'+H(s)+'"]';s==="image"&&c&&c.imageSrcSet?(p+='[imagesrcset="'+H(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(p+='[imagesizes="'+H(c.imageSizes)+'"]')):p+='[href="'+H(r)+'"]';var x=p;switch(s){case"style":x=Ko(r);break;case"script":x=Wo(r)}if(!(Ii.has(x)||(r=T({rel:"preload",href:s==="image"&&c&&c.imageSrcSet?void 0:r,as:s},c),Ii.set(x,r),h.querySelector(p)!==null||s==="style"&&h.querySelector(Ac(x))||s==="script"&&h.querySelector(Ec(x))))){var k=h.createElement("link");Dn(k,"link",r),s==="style"&&(k[po]=!0,k.onload=k.onerror=function(){Uu(k)}),ln(k),h.head.appendChild(k)}}}function F3(r,s){tl.m(r,s);var c=Go;if(c&&r){var h=s&&typeof s.as=="string"?s.as:"script",p='link[rel="modulepreload"][as="'+H(h)+'"][href="'+H(r)+'"]',x=p;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=Wo(r)}if(!Ii.has(x)&&(r=T({rel:"modulepreload",href:r},s),Ii.set(x,r),c.querySelector(p)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Ec(x)))return}h=c.createElement("link"),Dn(h,"link",r),ln(h),c.head.appendChild(h)}}}function q3(r,s,c){tl.S(r,s,c);var h=Go;if(h&&r){var p=yl(h).hoistableStyles,x=Ko(r);s=s||"default";var k=p.get(x);if(!k){var O={loading:0,preload:null};if(k=h.querySelector(Ac(x)))O.loading=5;else{r=T({rel:"stylesheet",href:r,"data-precedence":s},c),(c=Ii.get(x))&&Lg(r,c);var L=k=h.createElement("link");ln(L),Dn(L,"link",r),L._p=new Promise(function(Y,J){L.onload=Y,L.onerror=J}),L.addEventListener("load",function(){O.loading|=1}),L.addEventListener("error",function(){O.loading|=2}),O.loading|=4,nh(k,s,h)}k={type:"stylesheet",instance:k,count:1,state:O},p.set(x,k)}}}function V3(r,s){tl.X(r,s);var c=Go;if(c&&r){var h=yl(c).hoistableScripts,p=Wo(r),x=h.get(p);x||(x=c.querySelector(Ec(p)),x||(r=T({src:r,async:!0},s),(s=Ii.get(p))&&zg(r,s),x=c.createElement("script"),ln(x),Dn(x,"link",r),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},h.set(p,x))}}function Q3(r,s){tl.M(r,s);var c=Go;if(c&&r){var h=yl(c).hoistableScripts,p=Wo(r),x=h.get(p);x||(x=c.querySelector(Ec(p)),x||(r=T({src:r,async:!0,type:"module"},s),(s=Ii.get(p))&&zg(r,s),x=c.createElement("script"),ln(x),Dn(x,"link",r),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},h.set(p,x))}}function ik(r,s,c,h){var p=(p=Ht.current)?Tc(p):null;if(!p)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(c=Ko(c.href),s=yl(p).hoistableStyles,h=s.get(c),h||(h={type:"style",instance:null,count:0,state:null},s.set(c,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){r=Ko(c.href);var x=yl(p).hoistableStyles,k=x.get(r);if(k||(p=p.ownerDocument||p,k={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(r,k),(x=p.querySelector(Ac(r)))?x._p||(k.instance=x,k.state.loading=5):(x=Ii.get(r),x||(x={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Ii.set(r,x)),X3(p,r,x,k.state))),s&&h===null)throw Error(i(528,""));return k}if(s&&h!==null)throw Error(i(529,""));return null;case"script":return s=c.async,c=c.src,typeof c=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(c=Wo(c),s=yl(p).hoistableScripts,h=s.get(c),h||(h={type:"script",instance:null,count:0,state:null},s.set(c,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function Ko(r){return'href="'+H(r)+'"'}function Ac(r){return'link[rel="stylesheet"]['+r+"]"}function rk(r){return T({},r,{"data-precedence":r.precedence,precedence:null})}function X3(r,s,c,h){if(s=r.querySelector('link[rel="preload"][as="style"]['+s+"]")){if(s[po]!==!0){h.loading=1;return}}else s=r.createElement("link"),s[po]=!0,s.onload=s.onerror=Uu.bind(null,s),Dn(s,"link",c),ln(s),r.head.appendChild(s);h.preload=s,s.addEventListener("load",function(){return h.loading|=1}),s.addEventListener("error",function(){return h.loading|=2})}function Wo(r){return'[src="'+H(r)+'"]'}function Ec(r){return"script[async]"+r}function lk(r,s,c){if(s.count++,s.instance===null)switch(s.type){case"style":var h=r.querySelector('style[data-href~="'+H(c.href)+'"]');if(h)return s.instance=h,ln(h),h;var p=T({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return h=(r.ownerDocument||r).createElement("style"),ln(h),Dn(h,"style",p),nh(h,c.precedence,r),s.instance=h;case"stylesheet":p=Ko(c.href);var x=r.querySelector(Ac(p));if(x)return s.state.loading|=4,s.instance=x,ln(x),x;h=rk(c),(p=Ii.get(p))&&Lg(h,p),x=(r.ownerDocument||r).createElement("link"),ln(x);var k=x;return k._p=new Promise(function(O,L){k.onload=O,k.onerror=L}),Dn(x,"link",h),s.state.loading|=4,nh(x,c.precedence,r),s.instance=x;case"script":return x=Wo(c.src),(p=r.querySelector(Ec(x)))?(s.instance=p,ln(p),p):(h=c,(p=Ii.get(x))&&(h=T({},c),zg(h,p)),r=r.ownerDocument||r,p=r.createElement("script"),ln(p),Dn(p,"link",h),r.head.appendChild(p),s.instance=p);case"void":return null;default:throw Error(i(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(h=s.instance,s.state.loading|=4,nh(h,c.precedence,r));return s.instance}function nh(r,s,c){for(var h=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=h.length?h[h.length-1]:null,x=p,k=0;k title"):null)}function $3(r,s,c){if(c===1||s.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return r=s.disabled,typeof s.precedence=="string"&&r==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function ok(r,s){return r==="img"&&s.src!=null&&s.src!==""&&s.onLoad==null&&s.loading!=="lazy"}function ak(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function ck(r){return(r.width||100)*(r.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function uk(r,s){typeof s.decode=="function"&&(r.imgCount++,s.complete||(r.imgBytes+=ck(s),r.suspenseyImages.push(s)),r=K3.bind(r),s.decode().then(r,r))}function Y3(r,s,c,h){if(c.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var p=Ko(h.href),x=s.querySelector(Ac(p));if(x){s=x._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=Mc.bind(r),s.then(r,r)),c.state.loading|=4,c.instance=x,ln(x);return}x=s.ownerDocument||s,h=rk(h),(p=Ii.get(p))&&Lg(h,p),x=x.createElement("link"),ln(x);var k=x;k._p=new Promise(function(O,L){k.onload=O,k.onerror=L}),Dn(x,"link",h),c.instance=x}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(c,s),(s=c.state.preload)&&(c.state.loading&3)===0&&(r.count++,c=Mc.bind(r),s.addEventListener("load",c),s.addEventListener("error",c))}}var rh=0;function G3(r,s){return r.stylesheets&&r.count===0&&sh(r,r.stylesheets),0rh?50:800)+s);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(h),clearTimeout(p)}}:null}function fk(r){if(r.count===0&&(r.imgCount===0||!r.waitingForImages)){if(r.stylesheets)sh(r,r.stylesheets);else if(r.unsuspend){var s=r.unsuspend;r.unsuspend=null,s()}}}function Mc(){this.count--,fk(this)}function K3(){this.imgCount--,fk(this)}var lh=null;function sh(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,lh=new Map,s.forEach(W3,r),lh=null,Mc.call(r))}function W3(r,s){if(!(s.state.loading&4)){var c=lh.get(r);if(c)var h=c.get(null);else{c=new Map,lh.set(r,c);for(var p=r.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Xg.exports=pM(),Xg.exports}var xM=gM();const yM=my(xM);class gy extends Error{constructor(t,i,l){super(t);dh(this,"status");dh(this,"detail");this.name="ApiError",this.status=i,this.detail=l}}async function fs(n,e){let t=e,i;try{const l=await n.json();typeof(l==null?void 0:l.detail)=="string"&&l.detail?(t=l.detail,i=l.detail):Array.isArray(l==null?void 0:l.detail)&&(i=l.detail)}catch{}return new gy(t,n.status,i)}async function bM(n){const e=await fetch(`/api/notifications?after=${n}`);if(!e.ok)throw new Error("Failed to fetch notifications");return e.json()}async function vM(){const n=await fetch("/api/actions/open-log",{method:"POST"});if(!n.ok)throw new Error("Failed to open log file");return n.json()}async function wM(n){const e=new URLSearchParams;e.set("limit",String(n.limit)),n!=null&&n.level&&e.set("level",n.level),n!=null&&n.search&&e.set("search",n.search);const t=await fetch(`/api/logs?${e.toString()}`);if(!t.ok)throw new Error("Failed to fetch log entries");return t.json()}async function Gh(){const n=await fetch("/api/system");if(!n.ok)throw new Error("Failed to fetch system info");return n.json()}async function kM(n){const e=await fetch("/api/system/bind",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:n})});if(!e.ok){let t="Failed to update LAN binding";try{const i=await e.json();i!=null&&i.detail&&(t=i.detail)}catch{}throw new Error(t)}return e.json()}async function SM(n,e=1e4){const t=Date.now()+e;let i=null;for(;Date.now()setTimeout(l,500))}return i}async function Lk(){const n=await fetch("/api/config");if(!n.ok)throw new Error("Failed to fetch app configuration");return n.json()}async function zk(n){const e=await fetch("/api/config/select-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({directory:n})});if(!e.ok)throw new Error("Failed to select directory");return e.json()}async function CM(n){const e=await fetch("/api/config/load",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config_path:n})});if(!e.ok)throw new Error("Failed to load config file");return e.json()}async function GC(n,e){const t=await fetch("/api/config/load-content",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:n,content:e})});if(!t.ok){let i=`Failed to apply dropped config (${n})`;try{const l=await t.json();l!=null&&l.detail&&(i=l.detail)}catch{}throw new Error(i)}return t.json()}async function OM(){const n=await fetch("/api/config/reload",{method:"POST"});if(!n.ok){let e="Failed to reload configuration";try{const t=await n.json();t!=null&&t.detail&&(e=t.detail)}catch{}throw new Error(e)}return n.json()}async function NM(n){const e=await fetch("/api/config/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({directory:n})});if(!e.ok)throw new Error("Failed to create config file");return e.json()}async function Bk(){const n=await fetch("/api/config/content");if(!n.ok)throw await fs(n,"Failed to fetch config content");return n.json()}async function Pk(n,e){const t=await fetch("/api/config/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:n,content:e})});if(!t.ok)throw await fs(t,"Failed to validate config content");return t.json()}async function TM(){const n=await fetch("/api/config/template",{method:"POST"});if(!n.ok)throw await fs(n,"Failed to fetch config template");return n.json()}async function Hk(n,e,t={}){const i=await fetch("/api/config/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n,force:e,baseline_hash:t.baselineHash??null,overwrite_changes:t.overwriteChanges??!1})});if(!i.ok)throw await fs(i,"Failed to save configuration");const l=await i.json();return{config:l.config,contentHash:l.content_hash??null}}async function AM(n){const e=await fetch("/api/config/save-as",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok)throw await fs(e,"Failed to save configuration as");const t=await e.json();return{config:t.config,contentHash:t.content_hash??null}}async function EM(n){const e=`/api/fs/browse?path=${encodeURIComponent(n)}&include_hidden=true`,t=await fetch(e);if(!t.ok)throw new Error("Failed to browse config files");return t.json()}async function KC(n){const e=`/api/fs/browse?path=${encodeURIComponent(n)}`,t=await fetch(e);if(!t.ok)throw new Error("Failed to browse directory");return t.json()}async function Ik(n,e){const t=await fetch("/api/scan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:e});if(!t.ok)throw new Error("Failed to execute scan");return t.json()}async function Kg(n){const e=new URLSearchParams;(n==null?void 0:n.offset)!=null&&e.set("offset",String(n.offset)),(n==null?void 0:n.limit)!=null&&e.set("limit",String(n.limit)),n!=null&&n.sort_by&&e.set("sort_by",n.sort_by),n!=null&&n.sort_dir&&e.set("sort_dir",n.sort_dir);const t=e.toString(),i=`/api/scan/results${t?`?${t}`:""}`,l=await fetch(i,{signal:n==null?void 0:n.signal});if(!l.ok)throw new Error("Failed to fetch scan results");return l.json()}async function MM(n){const e=await fetch("/api/actions/launch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok)throw new Error("Failed to launch file");return e.json()}async function WC(n){const e=await fetch("/api/actions/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n})});if(!e.ok)throw new Error("Failed to reveal file");return e.json()}async function Y0(n){const e=await fetch("/api/actions/open-folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n})});if(!e.ok)throw new Error("Failed to open folder");return e.json()}async function Uk(n){const e=await fetch("/api/actions/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n})});if(!e.ok)throw new Error("Failed to open terminal");return e.json()}async function Fk(n,e){const t=await fetch("/api/actions/hash",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n,algorithm:e})});if(!t.ok)throw new Error("Failed to compute hash");return t.json()}async function DM(){const n=await fetch("/api/actions/open-config",{method:"POST"});if(!n.ok)throw new Error("Failed to open config file");return n.json()}async function qk(n){const e={file_path:n.file_path||n.filePath,content:n.content},t=await fetch("/api/actions/barcode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error("Failed to generate barcode");return t.json()}async function RM(n){const e=await fetch("/api/actions/barcode/decode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image_base64:n.imageBase64,formats:n.formats})});if(!e.ok)throw e.status===503?new Error("Server-side barcode decoding is unavailable"):new Error(`Failed to decode frame (HTTP ${e.status})`);return e.json()}async function jM(n,e){const t=await fetch("/api/actions/metadata",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n}),signal:e});if(!t.ok)throw new Error("Failed to fetch metadata");return t.json()}async function _M(n,e){const t=await fetch("/api/actions/export-csv",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n,filename:e})});if(!t.ok)throw new Error("Failed to export CSV");return t.json()}async function LM(n,e){const t=await fetch("/api/actions/save-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image_base64:n,filename:e})});if(!t.ok)throw new Error("Failed to save image");return t.json()}async function zM(n){const e=await fetch("/api/workflow/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok)throw await fs(e,"Failed to start workflow session");return e.json()}async function BM(n,e){const t=await fetch(`/api/workflow/${n}/respond`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e})});if(!t.ok)throw await fs(t,"Failed to respond to workflow prompt");return t.json()}async function PM(n){const e=await fetch(`/api/workflow/${n}/abort`,{method:"POST"});if(!e.ok)throw await fs(e,"Failed to abort workflow session");return e.json()}const HM=[".profiles",".profiles.yaml",".profiles.yml",".yaml",".yml"];function IM(n){const e=n.toLowerCase();return HM.some(t=>e.endsWith(t))}function UM(n){for(const e of n)if(IM(e.name))return e;return null}function Kh(){return{depth:0,overlayVisible:!1}}function Vk(n,e,t){switch(e){case"enter":return t?{depth:n.depth+1,overlayVisible:!0}:n;case"leave":{const i=Math.max(0,n.depth-1);return{depth:i,overlayVisible:n.depth>0&&i>0}}case"drop":return Kh()}}function Qk(n){return n==="light"?"light":"dark"}/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const FM=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),ZC=(...n)=>n.filter((e,t,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===t).join(" ").trim();/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */var qM={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const VM=M.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:i,className:l="",children:o,iconNode:a,...u},f)=>M.createElement("svg",{ref:f,...qM,width:e,height:e,stroke:n,strokeWidth:i?Number(t)*24/Number(e):t,className:ZC("lucide",l),...u},[...a.map(([d,m])=>M.createElement(d,m)),...Array.isArray(o)?o:[o]]));/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const De=(n,e)=>{const t=M.forwardRef(({className:i,...l},o)=>M.createElement(VM,{ref:o,iconNode:e,className:ZC(`lucide-${FM(n)}`,i),...l}));return t.displayName=`${n}`,t};/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const QM=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],XM=De("Activity",QM);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $M=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],JC=De("ArrowDown",$M);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const YM=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],GM=De("ArrowLeftRight",YM);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const KM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],WM=De("ArrowRight",KM);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const ZM=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],Xk=De("ArrowUpDown",ZM);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const JM=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],e4=De("ArrowUp",JM);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const t4=[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]],n4=De("Bug",t4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const i4=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],r4=De("Calendar",i4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const l4=[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],eO=De("Camera",l4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const s4=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Lr=De("Check",s4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const o4=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],a4=De("ChevronDown",o4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const c4=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Xd=De("ChevronRight",c4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const u4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Gc=De("CircleAlert",u4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const f4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],$k=De("CircleCheck",f4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const h4=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],d4=De("CircleDashed",h4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const m4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],p4=De("CircleDot",m4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const g4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]],x4=De("CirclePause",g4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const y4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]],b4=De("CirclePlay",y4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const v4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],ou=De("CircleX",v4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const w4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],k4=De("Clock",w4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const S4=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],fi=De("Copy",S4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const C4=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]],tO=De("Download",C4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const O4=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],nO=De("ExternalLink",O4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const N4=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],T4=De("EyeOff",N4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const A4=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],G0=De("Eye",A4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const E4=[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]],M4=De("FastForward",E4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const D4=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]],R4=De("FileCode2",D4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const j4=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]],K0=De("FileCode",j4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const _4=[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m3.2 12.9-.9-.4",key:"1i3dj5"}],["path",{d:"m3.2 15.1-.9.4",key:"1fvgj0"}],["path",{d:"M4.677 21.5a2 2 0 0 0 1.313.5H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2.5",key:"1yo3oz"}],["path",{d:"m4.9 11.2-.4-.9",key:"otmhb9"}],["path",{d:"m4.9 16.8-.4.9",key:"1b8z07"}],["path",{d:"m7.5 10.3-.4.9",key:"11k65u"}],["path",{d:"m7.5 17.7-.4-.9",key:"431x55"}],["path",{d:"m9.7 12.5-.9.4",key:"87sjan"}],["path",{d:"m9.7 15.5-.9-.4",key:"khqm91"}],["circle",{cx:"6",cy:"14",r:"3",key:"a1xfv6"}]],oa=De("FileCog",_4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const L4=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]],z4=De("FilePlus2",L4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const B4=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],ka=De("FileText",B4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const P4=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],Wg=De("File",P4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const H4=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],I4=De("FlaskConical",H4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const U4=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],es=De("FolderOpen",U4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const F4=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Ou=De("Folder",F4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const q4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],V4=De("Globe",q4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Q4=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],aa=De("Hash",Q4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const X4=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],$d=De("House",X4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const $4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],xy=De("Info",$4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Y4=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],iO=De("Keyboard",Y4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const G4=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],K4=De("Link2",G4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const W4=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],sl=De("LoaderCircle",W4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const Z4=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],J4=De("Lock",Z4);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const eD=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],tD=De("Moon",eD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const nD=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],iD=De("Network",nD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const rD=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],ns=De("Play",rD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const lD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],sD=De("Plus",lD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const oD=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],yy=De("QrCode",oD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const aD=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Yd=De("RefreshCw",aD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const cD=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],uD=De("Rocket",cD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const fD=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],hD=De("RotateCcw",fD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const dD=[["path",{d:"M10 2v3a1 1 0 0 0 1 1h5",key:"1xspal"}],["path",{d:"M18 18v-6a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6",key:"1ra60u"}],["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"M8 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9.172a2 2 0 0 1 1.414.586l2.828 2.828A2 2 0 0 1 22 6.828V16a2 2 0 0 1-2.01 2z",key:"1yve0x"}]],mD=De("SaveAll",dD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const pD=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],rO=De("Save",pD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const gD=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],lO=De("Search",gD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const xD=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],yD=De("Settings",xD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const bD=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],vD=De("Sun",bD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const wD=[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]],W0=De("Terminal",wD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const kD=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],sO=De("Timer",kD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const SD=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],oO=De("Trash2",SD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const CD=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],by=De("TriangleAlert",CD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const OD=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],ND=De("User",OD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const TD=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],aO=De("Webhook",TD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const AD=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],ED=De("Workflow",AD);/** - * @license lucide-react v0.477.0 - ISC - * - * This source code is licensed under the ISC license. - * See the LICENSE file in the root directory of this source tree. - */const MD=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Ri=De("X",MD);function DD(n){if(n<60)return`${n}s`;const e=Math.floor(n/60),t=n%60;return`${e}m${t.toString().padStart(2,"0")}s`}function RD(n){if(!n)return{label:"",cut:!1};const e=n.replace(/\\/g,"/").split("/").filter(Boolean);return e.length===0?{label:n,cut:!1}:{label:e[e.length-1],cut:e.length>1}}function jD({directory:n}){const[e,t]=M.useState(0);M.useEffect(()=>{t(0);const o=window.setInterval(()=>{t(a=>a+1)},1e3);return()=>window.clearInterval(o)},[]);const{label:i,cut:l}=RD(n);return y.jsxs("div",{"data-testid":"scan-status-strip",className:"flex min-w-0 items-center gap-1.5 text-[11px] text-ink-muted",children:[y.jsx(sl,{className:"h-3 w-3 shrink-0 animate-spin text-chip-indigo-text motion-reduce:animate-none","aria-hidden":"true"}),y.jsxs("span",{className:"min-w-0 truncate",children:["Scanning",n&&y.jsxs(y.Fragment,{children:[" ",y.jsxs("span",{className:"font-mono text-ink-secondary",title:n,children:[l?"…/":"",i]})]})," — ",y.jsx("span",{className:"font-mono tabular-nums text-ink-secondary",children:DD(e)})]})]})}function _D({onExecute:n,scanning:e,hasSelection:t,fileCount:i,totalCount:l,scanningDirectory:o="",toastMessage:a,onToastDismiss:u}){const f=(a==null?void 0:a.kind)==="error";return y.jsxs("div",{className:"relative flex items-center justify-between border-t border-line bg-surface-glass px-4 py-2.5 text-xs transition-colors duration-200",children:[a&&y.jsx("div",{role:"status","aria-live":f?"assertive":"polite","aria-atomic":"true",className:`animate-toast-in absolute left-1/2 top-1/2 z-[var(--z-toast)] max-w-[min(80vw,640px)] -translate-x-1/2 -translate-y-1/2 rounded-xl border px-4 py-2 text-xs font-medium glass-panel-strong ${f?"pointer-events-auto flex max-w-[min(70vw,560px)] items-center gap-2.5 border-status-danger-border text-left text-ink":"pointer-events-none max-w-[min(70vw,560px)] text-center text-ink"}`,children:f?y.jsxs(y.Fragment,{children:[y.jsx(ou,{className:"h-3.5 w-3.5 shrink-0 text-status-danger-text/80","aria-hidden":"true"}),y.jsx("span",{className:"min-w-0 flex-1",children:a.message}),u&&y.jsx("button",{type:"button",onClick:u,"aria-label":"Dismiss error",className:"shrink-0 rounded-md p-0.5 text-status-danger-text/60 hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-status-danger-border transition-colors",children:y.jsx(Ri,{className:"h-3.5 w-3.5"})})]}):a.message}),y.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e&&y.jsx(jD,{directory:o}),l!==void 0&&l!==i&&y.jsxs("span",{"data-testid":"action-bar-count",className:"text-ink-muted",children:["Showing ",i," of ",l]})]}),y.jsxs("button",{onClick:n,disabled:!t||e,className:"flex shrink-0 items-center gap-2 rounded-xl border border-emerald-300/50 bg-gradient-to-b from-emerald-400/90 to-emerald-600/90 px-5 py-2 font-semibold text-white shadow-[inset_0_1px_0_rgb(255_255_255/0.35),0_8px_24px_-6px_rgb(16_185_129/0.55)] transition-[filter,box-shadow,transform] hover:-translate-y-px hover:brightness-110 hover:shadow-[inset_0_1px_0_rgb(255_255_255/0.35),0_12px_30px_-6px_rgb(16_185_129/0.7)] disabled:opacity-40 disabled:hover:translate-y-0 disabled:hover:brightness-100 disabled:hover:shadow-[inset_0_1px_0_rgb(255_255_255/0.35),0_8px_24px_-6px_rgb(16_185_129/0.55)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-400",children:[y.jsx(ns,{className:"h-3.5 w-3.5 fill-current"}),y.jsx("span",{children:"Execute"}),y.jsx("kbd",{className:"rounded bg-emerald-800/60 px-1.5 py-0.5 text-[10px] text-emerald-200 shadow-[inset_0_1px_0_rgb(255_255_255/0.12)]",children:"↵"})]})]})}let Z0=[],cO=[];(()=>{let n="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,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(n=cO[i])e=i+1;else return!0;if(e==t)return!1}}function Yk(n){return n>=127462&&n<=127487}const Gk=8205;function zD(n,e,t=!0,i=!0){return(t?uO:BD)(n,e,i)}function uO(n,e,t){if(e==n.length)return e;e&&fO(n.charCodeAt(e))&&hO(n.charCodeAt(e-1))&&e--;let i=Zg(n,e);for(e+=Kk(i);e=0&&Yk(Zg(n,a));)o++,a-=2;if(o%2==0)break;e+=2}else break}return e}function BD(n,e,t){for(;e>1;){let i=uO(n,e-2,t);if(i=56320&&n<57344}function hO(n){return n>=55296&&n<56320}function Kk(n){return n<65536?1:2}class mt{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=Sa(this,e,t);let l=[];return this.decompose(0,e,l,2),i.length&&i.decompose(0,i.length,l,3),this.decompose(t,this.length,l,1),Er.from(l,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Sa(this,e,t);let i=[];return this.decompose(e,t,i,0),Er.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),l=new Kc(this),o=new Kc(e);for(let a=t,u=t;;){if(l.next(a),o.next(a),a=0,l.lineBreak!=o.lineBreak||l.done!=o.done||l.value!=o.value)return!1;if(u+=l.value.length,l.done||u>=i)return!0}}iter(e=1){return new Kc(this,e)}iterRange(e,t=this.length){return new dO(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let l=this.line(e).from;i=this.iterRange(l,Math.max(l,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new mO(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?mt.empty:e.length<=32?new Jt(e):Er.from(Jt.split(e,[]))}}class Jt extends mt{constructor(e,t=PD(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,l){for(let o=0;;o++){let a=this.text[o],u=l+a.length;if((t?i:u)>=e)return new HD(l,u,i,a);l=u+1,i++}}decompose(e,t,i,l){let o=e<=0&&t>=this.length?this:new Jt(Wk(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(l&1){let a=i.pop(),u=Wh(o.text,a.text.slice(),0,o.length);if(u.length<=32)i.push(new Jt(u,a.length+o.length));else{let f=u.length>>1;i.push(new Jt(u.slice(0,f)),new Jt(u.slice(f)))}}else i.push(o)}replace(e,t,i){if(!(i instanceof Jt))return super.replace(e,t,i);[e,t]=Sa(this,e,t);let l=Wh(this.text,Wh(i.text,Wk(this.text,0,e)),t),o=this.length+i.length-(t-e);return l.length<=32?new Jt(l,o):Er.from(Jt.split(l,[]),o)}sliceString(e,t=this.length,i=` -`){[e,t]=Sa(this,e,t);let l="";for(let o=0,a=0;o<=t&&ae&&a&&(l+=i),eo&&(l+=u.slice(Math.max(0,e-o),t-o)),o=f+1}return l}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],l=-1;for(let o of e)i.push(o),l+=o.length+1,i.length==32&&(t.push(new Jt(i,l)),i=[],l=-1);return l>-1&&t.push(new Jt(i,l)),t}}class Er extends mt{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,l){for(let o=0;;o++){let a=this.children[o],u=l+a.length,f=i+a.lines-1;if((t?f:u)>=e)return a.lineInner(e,t,i,l);l=u+1,i=f+1}}decompose(e,t,i,l){for(let o=0,a=0;a<=t&&o=a){let d=l&((a<=e?1:0)|(f>=t?2:0));a>=e&&f<=t&&!d?i.push(u):u.decompose(e-a,t-a,i,d)}a=f+1}}replace(e,t,i){if([e,t]=Sa(this,e,t),i.lines=o&&t<=u){let f=a.replace(e-o,t-o,i),d=this.lines-a.lines+f.lines;if(f.lines>4&&f.lines>d>>6){let m=this.children.slice();return m[l]=f,new Er(m,this.length-(t-e)+i.length)}return super.replace(o,u,f)}o=u+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` -`){[e,t]=Sa(this,e,t);let l="";for(let o=0,a=0;oe&&o&&(l+=i),ea&&(l+=u.sliceString(e-a,t-a,i)),a=f+1}return l}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Er))return 0;let i=0,[l,o,a,u]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;l+=t,o+=t){if(l==a||o==u)return i;let f=this.children[l],d=e.children[o];if(f!=d)return i+f.scanIdentical(d,t);i+=f.length+1}}static from(e,t=e.reduce((i,l)=>i+l.length+1,-1)){let i=0;for(let v of e)i+=v.lines;if(i<32){let v=[];for(let w of e)w.flatten(v);return new Jt(v,t)}let l=Math.max(32,i>>5),o=l<<1,a=l>>1,u=[],f=0,d=-1,m=[];function g(v){let w;if(v.lines>o&&v instanceof Er)for(let S of v.children)g(S);else v.lines>a&&(f>a||!f)?(b(),u.push(v)):v instanceof Jt&&f&&(w=m[m.length-1])instanceof Jt&&v.lines+w.lines<=32?(f+=v.lines,d+=v.length+1,m[m.length-1]=new Jt(w.text.concat(v.text),w.length+1+v.length)):(f+v.lines>l&&b(),f+=v.lines,d+=v.length+1,m.push(v))}function b(){f!=0&&(u.push(m.length==1?m[0]:Er.from(m,d)),d=-1,f=m.length=0)}for(let v of e)g(v);return b(),u.length==1?u[0]:new Er(u,t)}}mt.empty=new Jt([""],0);function PD(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Wh(n,e,t=0,i=1e9){for(let l=0,o=0,a=!0;o=t&&(f>i&&(u=u.slice(0,i-l)),l0?1:(e instanceof Jt?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,l=this.nodes[i],o=this.offsets[i],a=o>>1,u=l instanceof Jt?l.text.length:l.children.length;if(a==(t>0?u:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` -`,this;e--}else if(l instanceof Jt){let f=l.text[a+(t<0?-1:0)];if(this.offsets[i]+=t,f.length>Math.max(0,e))return this.value=e==0?f:t>0?f.slice(e):f.slice(0,f.length-e),this;e-=f.length}else{let f=l.children[a+(t<0?-1:0)];e>f.length?(e-=f.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(f),this.offsets.push(t>0?1:(f instanceof Jt?f.text.length:f.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class dO{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Kc(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*t,this.value=l.length<=i?l:t<0?l.slice(l.length-i):l.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class mO{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:l}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=l,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(mt.prototype[Symbol.iterator]=function(){return this.iter()},Kc.prototype[Symbol.iterator]=dO.prototype[Symbol.iterator]=mO.prototype[Symbol.iterator]=function(){return this});class HD{constructor(e,t,i,l){this.from=e,this.to=t,this.number=i,this.text=l}get length(){return this.to-this.from}}function Sa(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function On(n,e,t=!0,i=!0){return zD(n,e,t,i)}function ID(n){return n>=56320&&n<57344}function UD(n){return n>=55296&&n<56320}function hi(n,e){let t=n.charCodeAt(e);if(!UD(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return ID(i)?(t-55296<<10)+(i-56320)+65536:t}function vy(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Mr(n){return n<65536?1:2}const J0=/\r\n?|\n/;var Zn=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(Zn||(Zn={}));class zr{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return o+(e-l);o+=u}else{if(i!=Zn.Simple&&d>=e&&(i==Zn.TrackDel&&le||i==Zn.TrackBefore&&le))return null;if(d>e||d==e&&t<0&&!u)return e==l||t<0?o:o+f;o+=f}l=d}if(e>l)throw new RangeError(`Position ${e} is out of range for changeset of length ${l}`);return o}touchesRange(e,t=e){for(let i=0,l=0;i=0&&l<=t&&u>=e)return lt?"cover":!0;l=u}return!1}toString(){let e="";for(let t=0;t=0?":"+l:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new zr(e)}static create(e){return new zr(e)}}class mn extends zr{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 ex(this,(t,i,l,o,a)=>e=e.replace(l,l+(i-t),a),!1),e}mapDesc(e,t=!1){return tx(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let l=0,o=0;l=0){t[l]=u,t[l+1]=a;let f=l>>1;for(;i.length0&&Wl(i,t,o.text),o.forward(m),u+=m}let d=e[a++];for(;u>1].toJSON()))}return e}static of(e,t,i){let l=[],o=[],a=0,u=null;function f(m=!1){if(!m&&!l.length)return;ab||g<0||b>t)throw new RangeError(`Invalid change range ${g} to ${b} (in doc of length ${t})`);let w=v?typeof v=="string"?mt.of(v.split(i||J0)):v:mt.empty,S=w.length;if(g==b&&S==0)return;ga&&In(l,g-a,-1),In(l,b-g,S),Wl(o,l,w),a=b}}return d(e),f(!u),u}static empty(e){return new mn(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let l=0;lu&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)t.push(o[0],0);else{for(;i.length=0&&t<=0&&t==n[l+1]?n[l]+=e:l>=0&&e==0&&n[l]==0?n[l+1]+=t:i?(n[l]+=e,n[l+1]+=t):n.push(e,t)}function Wl(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||a==n.sections.length||n.sections[a+1]<0);)u=n.sections[a++],f=n.sections[a++];e(l,d,o,m,g),l=d,o=m}}}function tx(n,e,t,i=!1){let l=[],o=i?[]:null,a=new au(n),u=new au(e);for(let f=-1;;){if(a.done&&u.len||u.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&u.ins==-1){let d=Math.min(a.len,u.len);In(l,d,-1),a.forward(d),u.forward(d)}else if(u.ins>=0&&(a.ins<0||f==a.i||a.off==0&&(u.len=0&&f=0){let d=0,m=a.len;for(;m;)if(u.ins==-1){let g=Math.min(m,u.len);d+=g,m-=g,u.forward(g)}else if(u.ins==0&&u.lenf||a.ins>=0&&a.len>f)&&(u||i.length>d),o.forward2(f),a.forward(f)}}}}class au{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?mt.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?mt.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Gl{constructor(e,t,i,l){this.from=e,this.to=t,this.flags=i,this.goalColumn=l}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let i,l;return this.empty?i=l=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),l=e.mapPos(this.to,-1)),i==this.from&&l==this.to?this:new Gl(i,l,this.flags,this.goalColumn)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return oe.range(e,t,void 0,void 0,i);let l=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return oe.range(this.anchor,l,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return oe.range(e.anchor,e.head)}static create(e,t,i,l){return new Gl(e,t,i,l)}}class oe{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:oe.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new oe(e.ranges.map(t=>Gl.fromJSON(t)),e.main)}static single(e,t=e){return new oe([oe.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,l=0;ll.from-o.from),t=e.indexOf(i);for(let l=1;lo.head?oe.range(f,u):oe.range(u,f))}}return new oe(e,t)}}function gO(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let wy=0;class Ce{constructor(e,t,i,l,o){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=l,this.id=wy++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new Ce(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:ky),!!e.static,e.enables)}of(e){return new Zh([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Zh(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new Zh(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function ky(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class Zh{constructor(e,t,i,l){this.dependencies=e,this.facet=t,this.type=i,this.value=l,this.id=wy++}dynamicSlot(e){var t;let i=this.value,l=this.facet.compareInput,o=this.id,a=e[o]>>1,u=this.type==2,f=!1,d=!1,m=[];for(let g of this.dependencies)g=="doc"?f=!0:g=="selection"?d=!0:(((t=e[g.id])!==null&&t!==void 0?t:1)&1)==0&&m.push(e[g.id]);return{create(g){return g.values[a]=i(g),1},update(g,b){if(f&&b.docChanged||d&&(b.docChanged||b.selection)||nx(g,m)){let v=i(g);if(u?!Zk(v,g.values[a],l):!l(v,g.values[a]))return g.values[a]=v,1}return 0},reconfigure:(g,b)=>{let v,w=b.config.address[o];if(w!=null){let S=fd(b,w);if(this.dependencies.every(C=>C instanceof Ce?b.facet(C)===g.facet(C):C instanceof Fn?b.field(C,!1)==g.field(C,!1):!0)||(u?Zk(v=i(g),S,l):l(v=i(g),S)))return g.values[a]=S,0}else v=i(g);return g.values[a]=v,1}}}get extension(){return this}}function Zk(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[f.id]),l=t.map(f=>f.type),o=i.filter(f=>!(f&1)),a=n[e.id]>>1;function u(f){let d=[];for(let m=0;mi===l),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(mh).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,l)=>{let o=i.values[t],a=this.updateF(o,l);return this.compareF(o,a)?0:(i.values[t]=a,1)},reconfigure:(i,l)=>{let o=i.facet(mh),a=l.facet(mh),u;return(u=o.find(f=>f.field==this))&&u!=a.find(f=>f.field==this)?(i.values[t]=u.create(i),1):l.config.address[this.id]!=null?(i.values[t]=l.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,mh.of({field:this,create:e})]}get extension(){return this}}const $s={lowest:4,low:3,default:2,high:1,highest:0};function zc(n){return e=>new xO(e,n)}const ao={highest:zc($s.highest),high:zc($s.high),default:zc($s.default),low:zc($s.low),lowest:zc($s.lowest)};class xO{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class Gd{of(e){return new ix(this,e)}reconfigure(e){return Gd.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class ix{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class ud{constructor(e,t,i,l,o,a){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=l,this.staticValues=o,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let l=[],o=Object.create(null),a=new Map;for(let b of qD(e,t,a))b instanceof Fn?l.push(b):(o[b.facet.id]||(o[b.facet.id]=[])).push(b);let u=Object.create(null),f=[],d=[];for(let b of l)u[b.id]=d.length<<1,d.push(v=>b.slot(v));let m=i==null?void 0:i.config.facets;for(let b in o){let v=o[b],w=v[0].facet,S=m&&m[b]||[];if(v.every(C=>C.type==0))if(u[w.id]=f.length<<1|1,ky(S,v))f.push(i.facet(w));else{let C=w.combine(v.map(N=>N.value));f.push(i&&w.compare(C,i.facet(w))?i.facet(w):C)}else{for(let C of v)C.type==0?(u[C.id]=f.length<<1|1,f.push(C.value)):(u[C.id]=d.length<<1,d.push(N=>C.dynamicSlot(N)));u[w.id]=d.length<<1,d.push(C=>FD(C,w,v))}}let g=d.map(b=>b(u));return new ud(e,a,g,u,f,o)}}function qD(n,e,t){let i=[[],[],[],[],[]],l=new Map;function o(a,u){let f=l.get(a);if(f!=null){if(f<=u)return;let d=i[f].indexOf(a);d>-1&&i[f].splice(d,1),a instanceof ix&&t.delete(a.compartment)}if(l.set(a,u),Array.isArray(a))for(let d of a)o(d,u);else if(a instanceof ix){if(t.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(a.compartment)||a.inner;t.set(a.compartment,d),o(d,u)}else if(a instanceof xO)o(a.inner,a.prec);else if(a instanceof Fn)i[u].push(a),a.provides&&o(a.provides,u);else if(a instanceof Zh)i[u].push(a),a.facet.extensions&&o(a.facet.extensions,$s.default);else{let d=a.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${a}).`);if(d==a)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(d,u)}}return o(n,$s.default),i.reduce((a,u)=>a.concat(u))}function Wc(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let l=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|l}function fd(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const yO=Ce.define(),rx=Ce.define({combine:n=>n.some(e=>e),static:!0}),bO=Ce.define({combine:n=>n.length?n[0]:void 0,static:!0}),vO=Ce.define(),wO=Ce.define(),kO=Ce.define(),SO=Ce.define({combine:n=>n.length?n[0]:!1});class ul{constructor(e,t){this.type=e,this.value=t}static define(){return new VD}}class VD{of(e){return new ul(this,e)}}class QD{constructor(e){this.map=e}of(e){return new Ke(this,e)}}class Ke{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new Ke(this.type,t)}is(e){return this.type==e}static define(e={}){return new QD(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let l of e){let o=l.map(t);o&&i.push(o)}return i}}Ke.reconfigure=Ke.define();Ke.appendConfig=Ke.define();class pn{constructor(e,t,i,l,o,a){this.startState=e,this.changes=t,this.selection=i,this.effects=l,this.annotations=o,this.scrollIntoView=a,this._doc=null,this._state=null,i&&gO(i,t.newLength),o.some(u=>u.type==pn.time)||(this.annotations=o.concat(pn.time.of(Date.now())))}static create(e,t,i,l,o,a){return new pn(e,t,i,l,o,a)}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(pn.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}pn.time=ul.define();pn.userEvent=ul.define();pn.addToHistory=ul.define();pn.remote=ul.define();function XD(n,e){let t=[];for(let i=0,l=0;;){let o,a;if(i=n[i]))o=n[i++],a=n[i++];else if(l=0;l--){let o=i[l](n);o instanceof pn?n=o:Array.isArray(o)&&o.length==1&&o[0]instanceof pn?n=o[0]:n=OO(e,ma(o),!1)}return n}function YD(n){let e=n.startState,t=e.facet(kO),i=n;for(let l=t.length-1;l>=0;l--){let o=t[l](n);o&&Object.keys(o).length&&(i=CO(i,lx(e,o,n.changes.newLength),!0))}return i==n?n:pn.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const GD=[];function ma(n){return n==null?GD:Array.isArray(n)?n:[n]}var Ft=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(Ft||(Ft={}));const KD=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let sx;try{sx=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function WD(n){if(sx)return sx.test(n);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||KD.test(t)))return!0}return!1}function ZD(n){return e=>{if(!/\S/.test(e))return Ft.Space;if(WD(e))return Ft.Word;for(let t=0;t-1)return Ft.Word;return Ft.Other}}class gt{constructor(e,t,i,l,o,a){this.config=e,this.doc=t,this.selection=i,this.values=l,this.status=e.statusTemplate.slice(),this.computeSlot=o,a&&(a._state=this);for(let u=0;ul.set(d,f)),t=null),l.set(u.value.compartment,u.value.extension)):u.is(Ke.reconfigure)?(t=null,i=u.value):u.is(Ke.appendConfig)&&(t=null,i=ma(i).concat(u.value));let o;t?o=e.startState.values.slice():(t=ud.resolve(i,l,this),o=new gt(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(f,d)=>d.reconfigure(f,this),null).values);let a=e.startState.facet(rx)?e.newSelection:e.newSelection.asSingle();new gt(t,e.newDoc,a,o,(u,f)=>f.update(u,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:oe.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),l=this.changes(i.changes),o=[i.range],a=ma(i.effects);for(let u=1;ua.spec.fromJSON(u,f)))}}return gt.create({doc:e.doc,selection:oe.fromJSON(e.selection),extensions:t.extensions?l.concat([t.extensions]):l})}static create(e={}){let t=ud.resolve(e.extensions||[],new Map),i=e.doc instanceof mt?e.doc:mt.of((e.doc||"").split(t.staticFacet(gt.lineSeparator)||J0)),l=e.selection?e.selection instanceof oe?e.selection:oe.single(e.selection.anchor,e.selection.head):oe.single(0);return gO(l,i.length),t.staticFacet(rx)||(l=l.asSingle()),new gt(t,i,l,t.dynamicSlots.map(()=>null),(o,a)=>a.create(o),null)}get tabSize(){return this.facet(gt.tabSize)}get lineBreak(){return this.facet(gt.lineSeparator)||` -`}get readOnly(){return this.facet(SO)}phrase(e,...t){for(let i of this.facet(gt.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,l)=>{if(l=="$")return"$";let o=+(l||1);return!o||o>t.length?i:t[o-1]})),e}languageDataAt(e,t,i=-1){let l=[];for(let o of this.facet(yO))for(let a of o(this,t,i))Object.prototype.hasOwnProperty.call(a,e)&&l.push(a[e]);return l}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return ZD(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:l}=this.doc.lineAt(e),o=this.charCategorizer(e),a=e-i,u=e-i;for(;a>0;){let f=On(t,a,!1);if(o(t.slice(f,a))!=Ft.Word)break;a=f}for(;un.length?n[0]:4});gt.lineSeparator=bO;gt.readOnly=SO;gt.phrases=Ce.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(l=>n[l]==e[l])}});gt.languageData=yO;gt.changeFilter=vO;gt.transactionFilter=wO;gt.transactionExtender=kO;Gd.reconfigure=Ke.define();function Pr(n,e,t={}){let i={};for(let l of n)for(let o of Object.keys(l)){let a=l[o],u=i[o];if(u===void 0)i[o]=a;else if(!(u===a||a===void 0))if(Object.hasOwnProperty.call(t,o))i[o]=t[o](u,a);else throw new Error("Config merge conflict for field "+o)}for(let l in e)i[l]===void 0&&(i[l]=e[l]);return i}class is{eq(e){return this==e}range(e,t=e){return ox.create(e,t,this)}}is.prototype.startSide=is.prototype.endSide=0;is.prototype.point=!1;is.prototype.mapMode=Zn.TrackDel;function Sy(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}let ox=class NO{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new NO(e,t,i)}};function ax(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class Cy{constructor(e,t,i,l){this.from=e,this.to=t,this.value=i,this.maxPoint=l}get length(){return ta(this.to)}findIndex(e,t,i,l=0){let o=i?this.to:this.from;for(let a=l,u=o.length;;){if(a==u)return a;let f=a+u>>1,d=o[f]-e||(i?this.value[f].endSide:this.value[f].startSide)-t;if(f==a)return d>=0?a:u;d>=0?u=f:a=f+1}}between(e,t,i,l){for(let o=this.findIndex(t,-1e9,!0),a=this.findIndex(i,1e9,!1,o);oC||S==C&&b.startSide>0&&b.endSide<=0)continue;if(!((C-S||b.endSide-b.startSide)<0))if(d<0&&(d=S),b.point&&(m=Math.max(m,C-S)),(S-i||b.startSide-l)>=0)a.push(b),u.push(S-d),f.push(C-d),i=C,l=b.endSide;else{if(S==C)for(let N=a.length;N>0;N--){if((S-(f[N-1]+d)||b.startSide-a[N-1].endSide)>=0){a.splice(N,0,b),u.splice(N,0,S-d),f.splice(N,0,C-d);continue e}if((S-(u[N-1]+d)||b.endSide-a[N-1].startSide)>0)break}o(S,C,b)}}return{mapped:a.length?new Cy(u,f,a,m):null,pos:d}}}class st{constructor(e,t,i,l){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=l}static create(e,t,i,l){return new st(e,t,i,l)}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:i=!1,filterFrom:l=0,filterTo:o=this.length}=e,a=e.filter;if(t.length==0&&!a)return this;if(i&&(t=t.slice().sort(ax)),this.isEmpty)return t.length?st.of(t):this;let u=new TO(this,null,-1).goto(0),f=0,d=[],m=new Br;for(;u.value||f=0){let g=t[f++];m.addInner(g.from,g.to,g.value,!1)||d.push(g)}else u.rangeIndex==1&&u.chunkIndexthis.chunkEnd(u.chunkIndex)||ou.to||o{o||(o=new Br),o.addRange(f,d,m,!1)};for(let f=0;f=o&&e<=o+a.length&&a.between(o,e-o,t-o,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return cu.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return cu.from(e).goto(t)}static compare(e,t,i,l,o=-1){let a=e.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=o),u=t.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=o),f=Jk(a,u,i),d=new Bc(a,f,o),m=new Bc(u,f,o);i.iterGaps((g,b,v)=>eS(d,g,m,b,v,l)),i.empty&&i.length==0&&eS(d,0,m,0,0,l)}static eq(e,t,i=0,l){l==null&&(l=999999999);let o=e.filter(m=>!m.isEmpty&&t.indexOf(m)<0),a=t.filter(m=>!m.isEmpty&&e.indexOf(m)<0);if(o.length!=a.length)return!1;if(!o.length)return!0;let u=Jk(o,a),f=new Bc(o,u,0).goto(i),d=new Bc(a,u,0).goto(i);for(;;){if(f.to!=d.to||!cx(f.active,d.active)||f.point&&(!d.point||!Sy(f.point,d.point)))return!1;if(f.to>l)return!0;f.next(),d.next()}}static spans(e,t,i,l,o=-1){let a=new Bc(e,null,o).goto(t),u=t,f=a.openStart;for(;;){let d=Math.min(a.to,i);if(a.point){let m=a.activeForPoint(a.to),g=a.pointFromu&&(l.span(u,d,a.active,f),f=a.openEnd(d));if(a.to>i)return f+(a.point&&a.to>i?1:0);u=a.to,a.next()}}static of(e,t=!1){let i=new Br;for(let l of e instanceof ox?[e]:t?JD(e):e)i.add(l.from,l.to,l.value);return i.finish()}static join(e){if(!e.length)return st.empty;let t=ta(e);for(let i=e.length-2;i>=0;i--)for(let l=e[i];l!=st.empty;l=l.nextLayer)t=new st(l.chunkPos,l.chunk,t,Math.max(l.maxPoint,t.maxPoint));return t}}st.empty=new st([],[],null,-1);function ta(n){return n[n.length-1]}function JD(n){if(n.length>1)for(let e=n[0],t=1;t0)return n.slice().sort(ax);e=i}return n}st.empty.nextLayer=st.empty;class Br{finishChunk(e){this.chunks.push(new Cy(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=[])}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}add(e,t,i){this.addRange(e,t,i,!0)}addRange(e,t,i,l){this.addInner(e,t,i,l)||(this.nextLayer||(this.nextLayer=new Br)).addRange(e,t,i,l)}addInner(e,t,i,l){let o=e-this.lastTo||i.startSide-this.last.endSide;if(l&&o<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return o<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.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 i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(st.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=st.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Jk(n,e,t){let i=new Map;for(let o of n)for(let a=0;a=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&l.push(new TO(a,t,i,o));return l.length==1?l[0]:new cu(l)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Jg(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Jg(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)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(),Jg(this.heap,0)}}}function Jg(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let l=n[i];if(i+1=0&&(l=n[i+1],i++),t.compare(l)<0)break;n[i]=t,n[e]=l,e=i}}class Bc{constructor(e,t,i){this.minPoint=i,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=cu.from(e,t,i)}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){ph(this.active,e),ph(this.activeTo,e),ph(this.activeRank,e),this.minActive=tS(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:l,rank:o}=this.cursor;for(;t0;)t++;gh(this.active,t,i),gh(this.activeTo,t,l),gh(this.activeRank,t,o),e&&gh(e,t,this.cursor.from),this.minActive=tS(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let l=this.minActive;if(l>-1&&(this.activeTo[l]-this.cursor.from||this.active[l].endSide-this.cursor.startSide)<0){if(this.activeTo[l]>e){this.to=this.activeTo[l],this.endSide=this.active[l].endSide;break}this.removeActive(l),i&&ph(i,l)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let o=this.cursor.value;if(!o.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&i[l]=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function eS(n,e,t,i,l,o){n.goto(e),t.goto(i);let a=i+l,u=i,f=i-e,d=!!o.boundChange;for(let m=!1;;){let g=n.to+f-t.to,b=g||n.endSide-t.endSide,v=b<0?n.to+f:t.to,w=Math.min(v,a);if(n.point||t.point?(n.point&&t.point&&Sy(n.point,t.point)&&cx(n.activeForPoint(n.to),t.activeForPoint(t.to))||o.comparePoint(u,w,n.point,t.point),m=!1):(m&&(o.boundChange(u),m=!1),w>u&&!cx(n.active,t.active)&&o.compareRange(u,w,n.active,t.active),d&&wa)break;u=v,b<=0&&n.next(),b>=0&&t.next()}}function cx(n,e){if(n.length!=e.length)return!1;for(let t=0;t=e;i--)n[i+1]=n[i];n[e]=t}function tS(n,e){let t=-1,i=1e9;for(let l=0;l=e)return l;if(l==n.length)break;o+=n.charCodeAt(l)==9?t-o%t:1,l=On(n,l)}return i===!0?-1:n.length}const fx="ͼ",nS=typeof Symbol>"u"?"__"+fx:Symbol.for(fx),hx=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),iS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class rs{constructor(e,t){this.rules=[];let{finish:i}=t||{};function l(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function o(a,u,f,d){let m=[],g=/^@(\w+)\b/.exec(a[0]),b=g&&g[1]=="keyframes";if(g&&u==null)return f.push(a[0]+";");for(let v in u){let w=u[v];if(/&/.test(v))o(v.split(/,\s*/).map(S=>a.map(C=>S.replace(/&/,C))).reduce((S,C)=>S.concat(C)),w,f);else if(w&&typeof w=="object"){if(!g)throw new RangeError("The value of a property ("+v+") should be a primitive value.");o(l(v),w,m,b)}else w!=null&&m.push(v.replace(/_.*/,"").replace(/[A-Z]/g,S=>"-"+S.toLowerCase())+": "+w+";")}(m.length||b)&&f.push((i&&!g&&!d?a.map(i):a).join(", ")+" {"+m.join(" ")+"}")}for(let a in e)o(l(a),e[a],this.rules)}getRules(){return this.rules.join(` -`)}static newName(){let e=iS[nS]||1;return iS[nS]=e+1,fx+e.toString(36)}static mount(e,t,i){let l=e[hx],o=i&&i.nonce;l?o&&l.setNonce(o):l=new eR(e,o),l.mount(Array.isArray(t)?t:[t],e)}}let rS=new Map;class eR{constructor(e,t){let i=e.ownerDocument||e,l=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&l.CSSStyleSheet){let o=rS.get(i);if(o)return e[hx]=o;this.sheet=new l.CSSStyleSheet,rS.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[hx]=this}mount(e,t){let i=this.sheet,l=0,o=0,a=!1;for(let u=0;u-1&&(this.modules.splice(d,1),a=!0,o--,d=-1),d==-1){if(this.modules.splice(o++,0,f),a=!0,i)for(let m=0;m",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},tR=typeof navigator<"u"&&/Mac/.test(navigator.platform),nR=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var _n=0;_n<10;_n++)ls[48+_n]=ls[96+_n]=String(_n);for(var _n=1;_n<=24;_n++)ls[_n+111]="F"+_n;for(var _n=65;_n<=90;_n++)ls[_n]=String.fromCharCode(_n+32),uu[_n]=String.fromCharCode(_n);for(var e0 in ls)uu.hasOwnProperty(e0)||(uu[e0]=ls[e0]);function iR(n){var e=tR&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||nR&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?uu:ls)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function Nt(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var l=t[i];typeof l=="string"?n.setAttribute(i,l):l!=null&&(n[i]=l)}e++}for(;e2);var ke={mac:oS||/Mac/.test(Wn.platform),windows:/Win/.test(Wn.platform),linux:/Linux|X11/.test(Wn.platform),ie:Kd,ie_version:EO?dx.documentMode||6:px?+px[1]:mx?+mx[1]:0,gecko:lS,gecko_version:lS?+(/Firefox\/(\d+)/.exec(Wn.userAgent)||[0,0])[1]:0,chrome:!!t0,chrome_version:t0?+t0[1]:0,ios:oS,android:/Android\b/.test(Wn.userAgent),webkit:sS,webkit_version:sS?+(/\bAppleWebKit\/(\d+)/.exec(Wn.userAgent)||[0,0])[1]:0,safari:gx,safari_version:gx?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Wn.userAgent)||[0,0])[1]:0,tabSize:dx.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Oy(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const hd=Object.create(null);function Ny(n,e,t){if(n==e)return!0;n||(n=hd),e||(e=hd);let i=Object.keys(n),l=Object.keys(e);if(i.length-0!=l.length-0)return!1;for(let o of i)if(o!=t&&(l.indexOf(o)==-1||n[o]!==e[o]))return!1;return!0}function rR(n,e){for(let t=n.attributes.length-1;t>=0;t--){let i=n.attributes[t].name;e[i]==null&&n.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?n.style.cssText=i:n.getAttribute(t)!=i&&n.setAttribute(t,i)}}function aS(n,e,t){let i=!1;if(e)for(let l in e)t&&l in t||(i=!0,l=="style"?n.style.cssText="":n.removeAttribute(l));if(t)for(let l in t)e&&e[l]==t[l]||(i=!0,l=="style"?n.style.cssText=t[l]:n.setAttribute(l,t[l]));return i}function lR(n){let e=Object.create(null);for(let t=0;t0?3e8:-4e8:t>0?1e8:-1e8,new ro(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,l;if(e.isBlockGap)i=-5e8,l=4e8;else{let{start:o,end:a}=MO(e,t);i=(o?t?-3e8:-1:5e8)-1,l=(a?t?2e8:1:-6e8)+1}return new ro(e,i,l,t,e.widget||null,!0)}static line(e){return new Tu(e)}static set(e,t=!1){return st.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Fe.none=st.empty;class Nu extends Fe{constructor(e){let{start:t,end:i}=MO(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Oy(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||hd}eq(e){return this==e||e instanceof Nu&&this.tagName==e.tagName&&Ny(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Nu.prototype.point=!1;class Tu extends Fe{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Tu&&this.spec.class==e.spec.class&&Ny(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)}}Tu.prototype.mapMode=Zn.TrackBefore;Tu.prototype.point=!0;class ro extends Fe{constructor(e,t,i,l,o,a){super(t,i,o,e),this.block=l,this.isReplace=a,this.mapMode=l?t<=0?Zn.TrackBefore:Zn.TrackAfter:Zn.TrackDel}get type(){return this.startSide!=this.endSide?Bn.WidgetRange:this.startSide<=0?Bn.WidgetBefore:Bn.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof ro&&sR(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}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)}}ro.prototype.point=!0;function MO(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t??e,end:i??e}}function sR(n,e){return n==e||!!(n&&e&&n.compare(e))}function pa(n,e,t,i=0){let l=t.length-1;l>=0&&t[l]+i>=n?t[l]=Math.max(t[l],e):t.push(n,e)}class fu extends is{constructor(e,t,i){super(),this.tagName=e,this.attributes=t,this.rank=i}eq(e){return e==this||e instanceof fu&&this.tagName==e.tagName&&Ny(this.attributes,e.attributes)}static create(e){return new fu(e.tagName,e.attributes||hd,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return st.of(e,t)}}fu.prototype.startSide=fu.prototype.endSide=-1;const Nn=n=>n.nodeType==1,Ca=n=>n.nodeType==3;function hu(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function xx(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function Zc(n,e){if(!e.anchorNode)return!1;try{return xx(n,e.anchorNode)}catch{return!1}}function Jh(n){return Ca(n)?du(n,0,n.nodeValue.length).getClientRects():Nn(n)?n.getClientRects():[]}function Jc(n,e,t,i){return t?cS(n,e,t,i,-1)||cS(n,e,t,i,1):!1}function ss(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function dd(n){return Nn(n)&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function cS(n,e,t,i,l){for(;;){if(n==t&&e==i)return!0;if(e==(l<0?0:ol(n))){if(n.nodeName=="DIV")return!1;let o=n.parentNode;if(!o||!Nn(o))return!1;e=ss(n)+(l<0?0:1),n=o}else if(Nn(n)){if(n=n.childNodes[e+(l<0?-1:0)],Nn(n)&&(n.nodeName=="IMG"||n.nodeName=="BR"||n.contentEditable=="false"))return!1;e=l<0?ol(n):0}else return!1}}function ol(n){return Ca(n)?n.nodeValue.length:n.childNodes.length}function md(n,e){let{left:t,right:i}=n;if(t==i)return n;let l=e?t:i;return{left:l,right:l,top:n.top,bottom:n.bottom}}function oR(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function DO(n,e){let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function aR(n,e,t,i,l,o,a,u){let f=n.ownerDocument,d=f.defaultView||window;for(let m=n,g=!1;m&&!g;)if(Nn(m)){let b,v=m==f.body,w=1,S=1,C=!0,N=!0;if(v)b=oR(d);else{let I=getComputedStyle(m);if(/^(fixed|sticky)$/.test(I.position)&&(g=!0),(m.scrollHeight<=m.clientHeight||!/auto|scroll/.test(I.overflowY))&&(N=!1),(m.scrollWidth<=m.clientWidth||!/auto|scroll/.test(I.overflowX))&&(C=!1),!C&&!N){m=m.assignedSlot||m.parentNode;continue}let U=m.getBoundingClientRect();({scaleX:w,scaleY:S}=DO(m,U)),b={left:U.left,right:U.left+m.clientWidth*w,top:U.top,bottom:U.top+m.clientHeight*S}}let j=0,D=0;if(N)if(l=="nearest")e.top0&&e.bottom>b.bottom+D&&(D=e.bottom-b.bottom+a)):e.bottom>b.bottom-a&&(D=e.bottom-b.bottom+a,t<0&&e.top-D0&&e.right>b.right+j&&(j=e.right-b.right+o)):e.right>b.right-o&&(j=e.right-b.right+o,t<0&&e.leftb.bottom||e.leftb.right)&&(e={left:Math.max(e.left,b.left),right:Math.min(e.right,b.right),top:Math.max(e.top,b.top),bottom:Math.min(e.bottom,b.bottom)}),m=m.assignedSlot||m.parentNode}else if(m.nodeType==11)m=m.host;else break}function RO(n,e=!0){let t=n.ownerDocument,i=null,l=null;for(let o=n.parentNode;o&&!(o==t.body||(!e||i)&&l);)if(Nn(o))!l&&o.scrollHeight>o.clientHeight&&/scroll|auto/.test(getComputedStyle(o).overflowY)&&(l=o),e&&!i&&o.scrollWidth>o.clientWidth&&/scroll|auto/.test(getComputedStyle(o).overflowX)&&(i=o),o=o.assignedSlot||o.parentNode;else if(o.nodeType==11)o=o.host;else break;return{x:i,y:l}}class cR{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:i}=e;this.set(t,Math.min(e.anchorOffset,t?ol(t):0),i,Math.min(e.focusOffset,i?ol(i):0))}set(e,t,i,l){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=l}}function jO(n){let e=[];for(let t=n;t;t=t.nodeType==11?t.host:t.parentNode)Nn(t)&&e.push({node:t,left:t.scrollLeft,top:t.scrollTop});return e}function _O(n,e=!0){for(let{node:t,left:i,top:l}of n)e&&t.scrollTop!=l&&(t.scrollTop=l),t.scrollLeft!=i&&(t.scrollLeft=i)}let Qs=null;ke.safari&&ke.safari_version>=26&&(Qs=!1);function LO(n){if(n.setActive)return n.setActive();if(Qs)return n.focus(Qs);let e=jO(n);n.focus(Qs==null?{get preventScroll(){return Qs={preventScroll:!0},!0}}:void 0),Qs||(Qs=!1,_O(e))}let uS;function du(n,e,t=e){let i=uS||(uS=document.createRange());return i.setEnd(n,t),i.setStart(n,e),i}function ga(n,e,t,i){let l={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:l.altKey,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,metaKey:l.metaKey}=i);let o=new KeyboardEvent("keydown",l);o.synthetic=!0,n.dispatchEvent(o);let a=new KeyboardEvent("keyup",l);return a.synthetic=!0,n.dispatchEvent(a),o.defaultPrevented||a.defaultPrevented}function uR(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function fR(n,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,ol(t));;)if(i){if(!Nn(t))return!1;let l=t.childNodes[i-1];l.contentEditable=="false"?i--:(t=l,i=ol(t))}else{if(t==n)return!0;i=ss(t),t=t.parentNode}}function zO(n){return n instanceof Window?n.pageYOffset>Math.max(0,n.document.documentElement.scrollHeight-n.innerHeight-4):n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function BO(n,e){for(let t=n,i=e;;){if(Ca(t)&&i>0)return{node:t,offset:i};if(Nn(t)&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=ol(t)}else if(t.parentNode&&!dd(t))i=ss(t),t=t.parentNode;else return null}}function PO(n,e){for(let t=n,i=e;;){if(Ca(t)&&i=t){if(u.level==i)return a;(o<0||(l!=0?l<0?u.fromt:e[o].level>u.level))&&(o=a)}}if(o<0)throw new RangeError("Index out of range");return o}}function UO(n,e){if(n.length!=e.length)return!1;for(let t=0;t=0;S-=3)if(Sr[S+1]==-v){let C=Sr[S+2],N=C&2?l:C&4?C&1?o:l:0;N&&(Dt[g]=Dt[Sr[S]]=N),u=S;break}}else{if(Sr.length==189)break;Sr[u++]=g,Sr[u++]=b,Sr[u++]=f}else if((w=Dt[g])==2||w==1){let S=w==l;f=S?0:1;for(let C=u-3;C>=0;C-=3){let N=Sr[C+2];if(N&2)break;if(S)Sr[C+2]|=2;else{if(N&4)break;Sr[C+2]|=4}}}}}function xR(n,e,t,i){for(let l=0,o=i;l<=t.length;l++){let a=l?t[l-1].to:n,u=lf;)w==C&&(w=t[--S].from,C=S?t[S-1].to:n),Dt[--w]=v;f=m}else o=d,f++}}}function bx(n,e,t,i,l,o,a){let u=i%2?2:1;if(i%2==l%2)for(let f=e,d=0;ff&&a.push(new Rr(f,S.from,v));let C=S.direction==Oa!=!(v%2);vx(n,C?i+1:i,l,S.inner,S.from,S.to,a),f=S.to}w=S.to}else{if(w==t||(m?Dt[w]!=u:Dt[w]==u))break;w++}b?bx(n,f,w,i+1,l,b,a):fe;){let m=!0,g=!1;if(!d||f>o[d-1].to){let S=Dt[f-1];S!=u&&(m=!1,g=S==16)}let b=!m&&u==1?[]:null,v=m?i:i+1,w=f;e:for(;;)if(d&&w==o[d-1].to){if(g)break e;let S=o[--d];if(!m)for(let C=S.from,N=d;;){if(C==e)break e;if(N&&o[N-1].to==C)C=o[--N].from;else{if(Dt[C-1]==u)break e;break}}if(b)b.push(S);else{S.toDt.length;)Dt[Dt.length]=256;let i=[],l=e==Oa?0:1;return vx(n,l,l,t,0,n.length,i),i}function FO(n){return[new Rr(0,n,0)]}let qO="";function bR(n,e,t,i,l){var o;if(!n.length)return null;let a=i.head-n.from,u;if(i.head==n.from&&i.assoc<0){if(!l)return null;a=e[u=0].side(!1,t)}else if(i.head==n.to&&i.assoc>0){if(l)return null;a=e[u=e.length-1].side(!0,t)}else u=Rr.find(e,a,(o=i.bidiLevel)!==null&&o!==void 0?o:-1,i.assoc);let f=e[u],d=f.side(l,t);if(a==d){let b=u+=l?1:-1;if(b<0||b>=e.length)return null;f=e[u=b],a=f.side(!l,t),d=f.side(l,t)}let m=On(n.text,a,f.forward(l,t));(mf.to)&&(m=d),qO=n.text.slice(Math.min(a,m),Math.max(a,m));let g=u==(l?e.length-1:0)?null:e[u+(l?1:-1)];if(m==d){if(!g)return l?oe.cursor(n.to,1):oe.cursor(n.from,-1);if(g.level+(l?0:1)n.some(e=>e)}),WO=Ce.define({combine:n=>n.some(e=>e)}),ZO=Ce.define();class xa{constructor(e,t,i,l,o,a=!1){this.range=e,this.y=t,this.x=i,this.yMargin=l,this.xMargin=o,this.isSnapshot=a}map(e){return e.empty?this:new xa(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new xa(oe.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const xh=Ke.define({map:(n,e)=>n.map(e)}),JO=Ke.define();function pi(n,e,t){let i=n.facet($O);i.length?i[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const rl=Ce.define({combine:n=>n.length?n[0]:!0});let wR=0;const ca=Ce.define({combine(n){return n.filter((e,t)=>{for(let i=0;i{let f=[];return a&&f.push(Wd.of(d=>{let m=d.plugin(u);return m?a(m):Fe.none})),o&&f.push(o(u)),f})}static fromClass(e,t){return en.define((i,l)=>new e(i,l),t)}}class n0{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(pi(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){pi(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){pi(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const eN=Ce.define(),My=Ce.define(),Wd=Ce.define(),tN=Ce.define(),Dy=Ce.define(),Au=Ce.define(),nN=Ce.define();function fS(n,e){let t=n.state.facet(nN);if(!t.length)return t;let i=t.map(o=>o instanceof Function?o(n):o),l=[];return st.spans(i,e.from,e.to,{point(){},span(o,a,u,f){let d=o-e.from,m=a-e.from,g=l;for(let b=u.length-1;b>=0;b--,f--){let v=u[b].spec.bidiIsolate,w;if(f>0&&g.length&&(w=g[g.length-1]).to==d&&w.direction==v)w.to=m,g=w.inner;else{let S={from:d,to:m,direction:v,inner:[]};g.push(S),g=S.inner}}}}),iN(e.text,l)}function iN(n,e){for(let t of e){if(t.direction==null){for(let i=t.from,l=0;i0;t--){let l=e[t-1];if(!(l.fromA>i.toA)){if(l.toAl.push(new Fi(o,a,u,f))),this.changedRanges=l}static create(e,t,i){return new pd(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const kR=[];class Gt{constructor(e,t,i=0){this.dom=e,this.length=t,this.flags=i,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return kR}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&rR(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let i=t;for(let l of this.children){if(l==e)return i;i+=l.length+l.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,i){return null}domPosFor(e,t){let i=ss(this.dom),l=this.length?e>0:t>0;return new nr(this.parent.dom,i+(l?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof Jd)return e;return null}static get(e){return e.cmTile}}class Zd extends Gt{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,i=null,l,o=(e==null?void 0:e.node)==t?e:null,a=0;for(let u of this.children){if(u.sync(e),a+=u.length+u.breakAfter,l=i?i.nextSibling:t.firstChild,o&&l!=u.dom&&(o.written=!0),u.dom.parentNode==t)for(;l&&l!=u.dom;)l=hS(l);else t.insertBefore(u.dom,l);i=u.dom}for(l=i?i.nextSibling:t.firstChild,o&&l&&(o.written=!0);l;)l=hS(l);this.length=a}}function hS(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class Jd extends Zd{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=Gt.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],i=this,l=0,o=0;;)if(l==i.children.length){if(!t.length)return;i=i.parent,i.breakAfter&&o++,l=t.pop()}else{let a=i.children[l++];if(a instanceof ll)t.push(l),i=a,l=0;else{let u=o+a.length,f=e(a,o);if(f!==void 0)return f;o=u+a.breakAfter}}}resolveBlock(e,t){let i,l=-1,o,a=-1;if(this.blockTiles((u,f)=>{let d=f+u.length;if(e>=f&&e<=d){if(u.isWidget()&&t>=-1&&t<=1){if(u.flags&32)return!0;u.flags&16&&(i=void 0)}(fe||e==f&&(t>1?u.length:u.covers(-1)))&&(!o||!u.isWidget()&&o.isWidget())&&(o=u,a=e-f)}}),!i&&!o)throw new Error("No tile at position "+e);return i&&t<0||!o?{tile:i,offset:l}:{tile:o,offset:a}}}class ll extends Zd{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let i=new ll(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}}class Na extends Zd{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,i){let l=new Na(t||document.createElement("div"),e);return(!t||!i)&&(l.flags|=4),l}get domAttrs(){return this.attrs}resolveInline(e,t,i=!1){let l=null,o=-1,a=null,u=-1;function f(m,g){for(let b=0,v=0;b=g&&(w.isComposite()?f(w,g-v):(!a||i&&a.isHidden&&(t>0&&!(a.flags&32)||i&&CR(a,w)))&&(S>g||w.flags&32&&t<=1)?(a=w,u=g-v):(v=-1)&&(l=w,o=g-v)),v=S}}f(this,e);let d=(t<0?l:a)||l||a;return d?{tile:d,offset:d==l?o:u}:null}coordsIn(e,t,i){let l=this.resolveInline(e,t,!0);return l?l.tile.coordsIn(Math.max(0,l.offset),t,i):SR(this)}domIn(e,t){let i=this.resolveInline(e,t);if(i){let{tile:l,offset:o}=i;if(this.dom.contains(l.dom))return l.isText()?new nr(l.dom,Math.min(l.dom.nodeValue.length,o)):l.domPosFor(o,l.flags&16?1:l.flags&32?-1:t);let a=i.tile.parent,u=!1;for(let f of a.children){if(u)return new nr(f.dom,0);f==i.tile&&(u=!0)}}return new nr(this.dom,0)}}function SR(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=Jh(e);return t[t.length-1]||null}function CR(n,e){let t=n.coordsIn(0,1),i=e.coordsIn(0,1);return t&&i&&i.topl&&(e=l);let o=e,a=e,u=0;e==0&&t<0||e==l&&t>=0?ke.chrome||ke.gecko||(e?(o--,u=1):a=0)?0:f.length-1];return ke.safari&&!u&&d.width==0&&(d=Array.prototype.find.call(f,m=>m.width)||d),i==null?d:md(d,(u?u>0:t<0)==i)}static of(e,t){let i=new Ks(t||document.createTextNode(e),e);return t||(i.flags|=2),i}}class lo extends Gt{constructor(e,t,i,l){super(e,t,l),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,i){let l=this.widget.coordsAt(this.dom,e,t);if(l)return l;if(i)return md(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let o=this.dom.getClientRects(),a=null;if(!o.length)return null;let u=this.flags&16?!0:this.flags&32?!1:e>0;for(let f=u?o.length-1:0;a=o[f],!(e>0?f==0:f==o.length-1||a.top0==i)}}class OR{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,i){let{tile:l,index:o,beforeBreak:a,parents:u}=this;for(;e||t>0;)if(l.isComposite())if(a){if(!e)break;i&&i.break(),e--,a=!1}else if(o==l.children.length){if(!e&&!u.length)break;i&&i.leave(l),a=!!l.breakAfter,{tile:l,index:o}=u.pop(),o++}else{let f=l.children[o],d=f.breakAfter;(t>0?f.length<=e:f.length=0;u--){let f=t.marks[u],d=l.lastChild;if(d instanceof mi&&d.mark.eq(f.mark))d.dom!=f.dom&&d.setDOM(i0(f.dom)),l=d;else{let{dom:m}=f;this.cache.reused.get(f)&&Gt.get(f.dom)&&(m=i0(f.dom));let g=mi.of(f.mark,m);l.append(g),l=g}this.cache.reused.set(f,2)}let o=Gt.get(e.text);o&&this.cache.reused.set(o,2);let a=new Ks(e.text,e.text.nodeValue);a.flags|=8,this.pos=e.range.toB,l.append(a)}addInlineWidget(e,t,i){let l=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);l||this.flushBuffer();let o=this.ensureMarks(t,i);!l&&!(e.flags&16)&&o.append(this.getBuffer(1)),o.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,i){this.flushBuffer(),this.ensureMarks(t,i).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var i;e||(e=lN);let l=Na.start(e,t||((i=this.cache.find(Na))===null||i===void 0?void 0:i.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=l)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var i;let l=this.curLine;for(let o=e.length-1;o>=0;o--){let a=e[o],u;if(t>0&&(u=l.lastChild)&&u instanceof mi&&u.mark.eq(a))l=u,t--;else{let f=mi.of(a,(i=this.cache.find(mi,d=>d.mark.eq(a)))===null||i===void 0?void 0:i.dom);l.append(f),l=f,t=0}}return l}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!dS(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(ke.ios&&dS(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(r0,0,32)||new lo(r0.toDOM(),0,r0,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to=this.pos){let t=e.rank*102+e.value.rank,i=new NR(e.from,e.to,e.value,t),l=this.wrappers.length;for(;l>0&&(this.wrappers[l-1].rank-i.rank||this.wrappers[l-1].to-i.to)<0;)l--;this.wrappers.splice(l,0,i)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let i of this.wrappers){let l=t.lastChild;if(i.froma.wrapper.eq(i.wrapper)))===null||e===void 0?void 0:e.dom);t.append(o),t=o}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),i=this.cache.find(gd,void 0,1);return i&&(i.flags=t),i||new gd(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class AR{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:l,lineBreak:o,done:a}=this.cursor.next(this.skipCount);if(this.skipCount=0,a)throw new Error("Ran out of text content when drawing inline views");this.text=l;let u=this.textOff=Math.min(e,l.length);return o?null:l.slice(0,u)}let t=Math.min(this.text.length,this.textOff+e),i=this.text.slice(this.textOff,t);return this.textOff=t,i}}const xd=[lo,Na,Ks,mi,gd,ll,Jd];for(let n=0;n[]),this.index=xd.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,i=this.buckets[t];i.length<6?i.push(e):i[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,i=2){let l=e.bucket,o=this.buckets[l],a=this.index[l];for(let u=0;u{if(this.cache.add(a),a.isComposite())return!1},enter:a=>this.cache.add(a),leave:()=>{},break:()=>{}}}run(e,t){let i=t&&this.getCompositionContext(t.text);for(let l=0,o=0,a=0;;){let u=al){let d=f-l;this.preserve(d,!a,!u),l=f,o+=d}if(!u)break;t&&u.fromA<=t.range.fromA&&u.toA>=t.range.toA?(this.forward(u.fromA,t.range.fromA,t.range.fromA{if(a.isWidget())if(this.openWidget)this.builder.continueWidget(f-u);else{let d=f>0||u{a.isLine()?this.builder.addLineStart(a.attrs,this.cache.maybeReuse(a)):(this.cache.add(a),a instanceof mi&&l.unshift(a.mark)),this.openWidget=!1},leave:a=>{a.isLine()?l.length&&(l.length=o=0):a instanceof mi&&(l.shift(),o=Math.min(o,l.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let i=null,l=this.builder,o=-1,a=st.spans(this.decorations,e,t,{point:(u,f,d,m,g,b)=>{if(d instanceof ro){if(this.disallowBlockEffectsFor[b]){if(d.block)throw new RangeError("Block decorations may not be specified via plugins");if(f>this.view.state.doc.lineAt(u).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(o=m.length,g>m.length)l.continueWidget(f-u);else{let v=d.widget||(d.block?Ta.block:Ta.inline),w=DR(d),S=this.cache.findWidget(v,f-u,w)||lo.of(v,this.view,f-u,w);d.block?(d.startSide>0&&l.addLineStartIfNotCovered(i),l.addBlockWidget(S)):(l.ensureLine(i),l.addInlineWidget(S,m,g))}i=null}else i=RR(i,d);f>u&&this.text.skip(f-u)},span:(u,f,d,m)=>{for(let g=u;g-1&&(this.openWidget=a>o),this.openWidget||l.addLineStartIfNotCovered(i),this.openMarks=a}forward(e,t,i=1){t-e<=10?this.old.advance(t-e,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(e){let t=[],i=null;for(let l=e.parentNode;;l=l.parentNode){let o=Gt.get(l);if(l==this.view.contentDOM)break;o instanceof mi?t.push(o):o!=null&&o.isLine()?i=o:o instanceof ll||(l.nodeName=="DIV"&&!i?i=new Na(l,lN):i||t.push(mi.of(new Nu({tagName:l.nodeName.toLowerCase(),attributes:lR(l)}),l)))}return i?{line:i,marks:t}:null}}function dS(n,e){let t=i=>{for(let l of i.children)if((e?l.isText():l.length)||t(l))return!0;return!1};return t(n)}function DR(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}const lN={class:"cm-line"};function RR(n,e){let t=e.spec.attributes,i=e.spec.class;return!t&&!i||(n||(n={class:"cm-line"}),t&&Oy(t,n),i&&(n.class+=" "+i)),n}function jR(n){let e=[];for(let t=n.parents.length;t>1;t--){let i=t==n.parents.length?n.tile:n.parents[t].tile;i instanceof mi&&e.push(i.mark)}return e}function i0(n){let e=Gt.get(n);return e&&e.setDOM(n.cloneNode()),n}class Ta extends fl{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}}Ta.inline=new Ta("span");Ta.block=new Ta("div");const r0=new class extends fl{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class mS{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Fe.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new Jd(e,e.contentDOM),this.updateInner([new Fi(0,0,0,e.state.doc.length)],null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:m,toA:g})=>gthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let l=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?l=this.domChanged.newSel.head:!FR(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let o=l>-1?LR(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){let{from:m,to:g}=this.hasComposition;i=new Fi(m,g,e.changes.mapPos(m,-1),e.changes.mapPos(g,1)).addToSet(i.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(ke.ie||ke.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,u=this.blockWrappers;this.updateDeco();let f=PR(a,this.decorations,e.changes);f.length&&(i=Fi.extendWithRanges(i,f));let d=IR(u,this.blockWrappers,e.changes);return d.length&&(i=Fi.extendWithRanges(i,d)),o&&!i.some(m=>m.fromA<=o.range.fromA&&m.toA>=o.range.toA)&&(i=o.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(t||e.length){let a=this.tile,u=new MR(this.view,a,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&Gt.get(t.text)&&u.cache.reused.set(Gt.get(t.text),2),this.tile=u.run(e,t),kx(a,u.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=ke.chrome||ke.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(o),o&&(o.written||i.selectionRange.focusNode!=o.node||!this.tile.dom.contains(o.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let l=[];if(this.view.viewport.from||this.view.viewport.to-1)&&Zc(i,this.view.observer.selectionRange)&&!(l&&i.contains(l));if(!(o||t||a))return;let u=this.forceSelection;this.forceSelection=!1;let f=this.view.state.selection.main,d,m;if(f.empty?m=d=this.inlineDOMNearPos(f.anchor,f.assoc||1):(m=this.inlineDOMNearPos(f.head,f.head==f.from?1:-1),d=this.inlineDOMNearPos(f.anchor,f.anchor==f.from?1:-1)),ke.gecko&&f.empty&&!this.hasComposition&&_R(d)){let b=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(b,d.node.childNodes[d.offset]||null)),d=m=new nr(b,0),u=!0}let g=this.view.observer.selectionRange;(u||!g.focusNode||(!Jc(d.node,d.offset,g.anchorNode,g.anchorOffset)||!Jc(m.node,m.offset,g.focusNode,g.focusOffset))&&!this.suppressWidgetCursorChange(g,f))&&(this.view.observer.ignore(()=>{ke.android&&ke.chrome&&i.contains(g.focusNode)&&UR(g.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let b=hu(this.view.root);if(b)if(f.empty){if(ke.gecko){let v=zR(d.node,d.offset);if(v&&v!=3){let w=(v==1?BO:PO)(d.node,d.offset);w&&(d=new nr(w.node,w.offset))}}b.collapse(d.node,d.offset),f.bidiLevel!=null&&b.caretBidiLevel!==void 0&&(b.caretBidiLevel=f.bidiLevel)}else if(b.extend){b.collapse(d.node,d.offset);try{b.extend(m.node,m.offset)}catch{}}else{let v=document.createRange();f.anchor>f.head&&([d,m]=[m,d]),v.setEnd(m.node,m.offset),v.setStart(d.node,d.offset),b.removeAllRanges(),b.addRange(v)}a&&this.view.root.activeElement==i&&(i.blur(),l&&l.focus())}),this.view.observer.setSelectionRange(d,m)),this.impreciseAnchor=d.precise?null:new nr(g.anchorNode,g.anchorOffset),this.impreciseHead=m.precise?null:new nr(g.focusNode,g.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Jc(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=hu(e.root),{anchorNode:l,anchorOffset:o}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let a=this.lineAt(t.head,t.assoc);if(!a)return;let u=a.posAtStart;if(t.head==u||t.head==u+a.length)return;let f=this.coordsAt(t.head,-1),d=this.coordsAt(t.head,1);if(!f||!d||f.bottom>d.top)return;let m=this.domAtPos(t.head+t.assoc,t.assoc);i.collapse(m.node,m.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let g=e.observer.selectionRange;e.docView.posFromDOM(g.anchorNode,g.anchorOffset)!=t.from&&i.collapse(l,o)}posFromDOM(e,t){let i=this.tile.nearest(e);if(!i)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let l=i.posAtStart;if(i.isComposite()){let o;if(e==i.dom)o=i.dom.childNodes[t];else{let a=ol(e)==0?0:t==0?-1:1;for(;;){let u=e.parentNode;if(u==i.dom)break;a==0&&u.firstChild!=u.lastChild&&(e==u.firstChild?a=-1:a=1),e=u}a<0?o=e:o=e.nextSibling}if(o==i.dom.firstChild)return l;for(;o&&!Gt.get(o);)o=o.nextSibling;if(!o)return l+i.length;for(let a=0,u=l;;a++){let f=i.children[a];if(f.dom==o)return u;u+=f.length+f.breakAfter}}else return i.isText()?e==i.dom?l+t:l+(t?i.length:0):l}domAtPos(e,t){let{tile:i,offset:l}=this.tile.resolveBlock(e,t);return i.isWidget()?i.domPosFor(l,t):i.domIn(l,t)}inlineDOMNearPos(e,t){let i,l=-1,o=!1,a,u=-1,f=!1;return this.tile.blockTiles((d,m)=>{if(d.isWidget()){if(d.flags&32&&m>=e)return!0;d.flags&16&&(o=!0)}else{let g=m+d.length;if(m<=e&&(i=d,l=e-m,o=g=e&&!a&&(a=d,u=e-m,f=m>e),m>e&&a)return!0}}),!i&&!a?this.domAtPos(e,t):(o&&a?i=null:f&&i&&(a=null),i&&t<0||!a?i.domIn(l,t):a.domIn(u,t))}coordsAt(e,t,i){let{tile:l,offset:o}=this.tile.resolveBlock(e,t);return l.isWidget()?l.widget instanceof l0?null:l.coordsInWidget(o,t,!0):l.coordsIn(o,t,i)}lineAt(e,t){let{tile:i}=this.tile.resolveBlock(e,t);return i.isLine()?i:null}coordsForChar(e){let{tile:t,offset:i}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function l(o,a){if(o.isComposite())for(let u of o.children){if(u.length>=a){let f=l(u,a);if(f)return f}if(a-=u.length,a<0)break}else if(o.isText()&&aMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,u=-1,f=this.view.textDirection==Tt.LTR,d=0,m=(g,b,v)=>{for(let w=0;wl);w++){let S=g.children[w],C=b+S.length,N=S.dom.getBoundingClientRect(),{height:j}=N;if(v&&!w&&(d+=N.top-v.top),S instanceof ll)C>i&&m(S,b,N);else if(b>=i&&(d>0&&t.push(-d),t.push(j+d),d=0,a)){let D=S.dom.lastChild,I=D?Jh(D):[];if(I.length){let U=I[I.length-1],E=f?U.right-N.left:N.right-U.left;E>u&&(u=E,this.minWidth=o,this.minWidthFrom=b,this.minWidthTo=C)}}v&&w==g.children.length-1&&(d+=v.bottom-N.bottom),b=C+S.breakAfter}};return m(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?Tt.RTL:Tt.LTR}measureTextSize(){let e=this.tile.blockTiles(a=>{if(a.isLine()&&a.children.length&&a.length<=20){let u=0,f;for(let d of a.children){if(!d.isText()||/[^ -~]/.test(d.text))return;let m=Jh(d.dom);if(m.length!=1)return;u+=m[0].width,f=m[0].height}if(u)return{lineHeight:a.dom.getBoundingClientRect().height,charWidth:u/a.length,textHeight:f}}});if(e)return e;let t=document.createElement("div"),i,l,o;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let a=Jh(t.firstChild)[0];i=t.getBoundingClientRect().height,l=a&&a.width?a.width/27:7,o=a&&a.height?a.height:i,t.remove()}),{lineHeight:i,charWidth:l,textHeight:o}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,l=0;;l++){let o=l==t.viewports.length?null:t.viewports[l],a=o?o.from-1:this.view.state.doc.length;if(a>i){let u=(t.lineBlockAt(a).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(Fe.replace({widget:new l0(u),block:!0,inclusive:!0,isBlockGap:!0}).range(i,a))}if(!o)break;i=o.to+1}return Fe.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Wd).map(o=>(this.dynamicDecorationMap[e++]=typeof o=="function")?o(this.view):o),i=!1,l=this.view.state.facet(Dy).map((o,a)=>{let u=typeof o=="function";return u&&(i=!0),u?o(this.view):o});for(l.length&&(this.dynamicDecorationMap[e++]=i,t.push(st.join(l))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];etypeof o=="function"?o(this.view):o)}scrollIntoView(e){if(e.isSnapshot){let d=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=d.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let d of this.view.state.facet(ZO))try{if(d(this.view,e.range,e))return!0}catch(m){pi(this.view.state,m,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),l;if(!i)return;!t.empty&&(l=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,l.left),top:Math.min(i.top,l.top),right:Math.max(i.right,l.right),bottom:Math.max(i.bottom,l.bottom)});let o=Ry(this.view),a={left:i.left-o.left,top:i.top-o.top,right:i.right+o.right,bottom:i.bottom+o.bottom},{offsetWidth:u,offsetHeight:f}=this.view.scrollDOM;if(aR(this.view.scrollDOM,a,t.head1&&(i.top>window.visualViewport.offsetTop+window.visualViewport.height||i.bottomi.isWidget()||i.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){kx(this.tile)}}function kx(n,e){let t=e==null?void 0:e.get(n);if(t!=1){t==null&&n.destroy();for(let i of n.children)kx(i,e)}}function _R(n){return Nn(n.node)&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function sN(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let i=BO(t.focusNode,t.focusOffset),l=PO(t.focusNode,t.focusOffset),o=i||l;if(l&&i&&l.node!=i.node){let u=Gt.get(l.node);if(!u||u.isText()&&u.text!=l.node.nodeValue)o=l;else if(n.docView.lastCompositionAfterCursor){let f=Gt.get(i.node);!f||f.isText()&&f.text!=i.node.nodeValue||(o=l)}}if(n.docView.lastCompositionAfterCursor=o!=i,!o)return null;let a=e-o.offset;return{from:a,to:a+o.node.nodeValue.length,node:o.node}}function LR(n,e,t){let i=sN(n,t);if(!i)return null;let{node:l,from:o,to:a}=i,u=l.nodeValue;if(/[\n\r]/.test(u)||n.state.doc.sliceString(i.from,i.to)!=u)return null;let f=e.invertedDesc;return{range:new Fi(f.mapPos(o),f.mapPos(a),o,a),text:l}}function zR(n,e){return Nn(n)?(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e{ie.from&&(t=!0)}),t}class l0 extends fl{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function qR(n,e,t=1){let i=n.charCategorizer(e),l=n.doc.lineAt(e),o=e-l.from;if(l.length==0)return oe.cursor(e);o==0?t=1:o==l.length&&(t=-1);let a=o,u=o;t<0?a=On(l.text,o,!1):u=On(l.text,o);let f=i(l.text.slice(a,u));for(;a>0;){let d=On(l.text,a,!1);if(i(l.text.slice(d,a))!=f)break;a=d}for(;un.defaultLineHeight*1.5){let u=n.viewState.heightOracle.textHeight,f=Math.floor((l-t.top-(n.defaultLineHeight-u)*.5)/u);o+=f*n.viewState.heightOracle.lineLength}let a=n.state.sliceDoc(t.from,t.to);return t.from+ux(a,o,n.state.tabSize)}function Sx(n,e,t){let i=n.lineBlockAt(e);if(Array.isArray(i.type)){let l;for(let o of i.type){if(o.from>e)break;if(!(o.toe)return o;(!l||o.type==Bn.Text&&(l.type!=o.type||(t<0?o.frome)))&&(l=o)}}return l||i}return i}function QR(n,e,t,i){let l=Sx(n,e.head,e.assoc||-1),o=!i||l.type!=Bn.Text||!(n.lineWrapping||l.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>l.from?e.head-1:e.head);if(o){let a=n.dom.getBoundingClientRect(),u=n.textDirectionAt(l.from),f=n.posAndSideAtCoords({x:t==(u==Tt.LTR)?a.right-1:a.left+1,y:(o.top+o.bottom)/2});if(f)return oe.cursor(f.pos,f.assoc)}return oe.cursor(t?l.to:l.from,t?1:-1)}function pS(n,e,t,i){let l=n.state.doc.lineAt(e.head),o=n.bidiSpans(l),a=n.textDirectionAt(l.from);for(let u=e,f=null;;){let d=bR(l,o,a,u,t),m=qO;if(!d){if(l.number==(t?n.state.doc.lines:1))return u;m=` -`,l=n.state.doc.line(l.number+(t?1:-1)),o=n.bidiSpans(l),d=t?oe.cursor(l.from,-1):oe.cursor(l.to,1)}if(f){if(!f(m))return u}else{if(!i)return d;f=i(m)}u=d}}function XR(n,e,t){let i=n.state.charCategorizer(e),l=i(t);return o=>{let a=i(o);return l==Ft.Space&&(l=a),l==a}}function $R(n,e,t,i){let l=e.head,o=t?1:-1;if(l==(t?n.state.doc.length:0))return oe.cursor(l,e.assoc);let a=e.goalColumn,u,f=n.contentDOM.getBoundingClientRect(),d=n.coordsAtPos(l,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),m=n.documentTop;if(d)a==null&&(a=d.left-f.left),u=o<0?d.top:d.bottom;else{let w=n.viewState.lineBlockAt(l);a==null&&(a=Math.min(f.right-f.left,n.defaultCharacterWidth*(l-w.from))),u=(o<0?w.top:w.bottom)+m}let g=f.left+a,b=n.viewState.heightOracle.textHeight>>1,v=i??b;for(let w=0;;w+=b){let S=u+(v+w)*o,C=Cx(n,{x:g,y:S},!1,o);if(t?S>f.bottom:Su:j{if(e>o&&el(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:oe.cursor(i,in.viewState.docHeight)return new Dr(n.state.doc.length,-1);if(d=n.elementAtHeight(f),i==null)break;if(d.type==Bn.Text){if(i<0?d.ton.viewport.to)break;let b=n.docView.coordsAt(i<0?d.from:d.to,i>0?-1:1);if(b&&(i<0?b.top<=f+o:b.bottom>=f+o))break}let g=n.viewState.heightOracle.textHeight/2;f=i>0?d.bottom+g:d.top-g}if(n.viewport.from>=d.to||n.viewport.to<=d.from){if(t)return null;if(d.type==Bn.Text){let g=VR(n,l,d,a,u);return new Dr(g,g==d.from?1:-1)}}if(d.type!=Bn.Text)return f<(d.top+d.bottom)/2?new Dr(d.from,1):new Dr(d.to,-1);let m=n.docView.lineAt(d.from,2);return(!m||m.length!=d.length)&&(m=n.docView.lineAt(d.from,-2)),new YR(n,a,u,n.textDirectionAt(d.from)).scanTile(m,d.from)}class YR{constructor(e,t,i,l){this.view=e,this.x=t,this.y=i,this.baseDir=l,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to1||i.length&&(i[0].level!=this.baseDir||i[0].to+l.from>1;t:if(a.has(S)){for(let j=1;j=o&&(D-=w),!a.has(D)){S=D;break t}}break e}a.add(S);let C=t(S),N=0;if(C)for(let j=0;j1))if(D.bottomthis.y)(!d||d.top>D.top)&&(d=D),N=-1;else{let I=D.left>this.x?this.x-D.left:D.right(w+w+S)/3)return this.y=f.bottom-1,this.scan(e,t,!0);if(d&&d.top<(w+S+S)/3)return this.y=d.top+1,this.scan(e,t,!0)}let v=(u?this.dirAt(e[m],1):this.baseDir)==Tt.LTR;return{i:m,after:this.x>(b.left+b.right)/2==v}}scanText(e,t){let i=[];for(let o=0;o{let a=i[o]-t,u=i[o+1]-t;return du(e.dom,a,u).getClientRects()});return l.after?new Dr(i[l.i+1],-1):new Dr(i[l.i],1)}scanTile(e,t){if(!e.length)return new Dr(t,1);if(e.children.length==1){let u=e.children[0];if(u.isText())return this.scanText(u,t);if(u.isComposite())return this.scanTile(u,t)}let i=[t];for(let u=0,f=t;u{let f=e.children[u];return f.flags&48?null:(Nn(f.dom)?f.dom:du(f.dom,0,f.length)).getClientRects()}),o=e.children[l.i],a=i[l.i];return o.isText()?this.scanText(o,a):o.isComposite()?this.scanTile(o,a):l.after?new Dr(i[l.i+1],-1):new Dr(a,1)}}const na="￿";class GR{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(gt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=na}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let l=e;;){this.findPointBefore(i,l);let o=this.text.length;this.readNode(l);let a=Gt.get(l),u=l.nextSibling;if(u==t){a!=null&&a.breakAfter&&!u&&i!=this.view.contentDOM&&this.lineBreak();break}let f=Gt.get(u);(a&&f?a.breakAfter:(a?a.breakAfter:dd(l))||dd(u)&&(l.nodeName!="BR"||a!=null&&a.isWidget())&&this.text.length>o)&&!WR(u,t)&&this.lineBreak(),l=u}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,l=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,a=1,u;if(this.lineSeparator?(o=t.indexOf(this.lineSeparator,i),a=this.lineSeparator.length):(u=l.exec(t))&&(o=u.index,a=u[0].length),this.append(t.slice(i,o<0?t.length:o)),o<0)break;if(this.lineBreak(),a>1)for(let f of this.points)f.node==e&&f.pos>this.text.length&&(f.pos-=a-1);i=o+a}}readNode(e){let t=Gt.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let l=i.iter();!l.next().done;)l.lineBreak?this.lineBreak():this.append(l.value)}else Ca(e)?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():Nn(e)&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(Ca(e)?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(KR(e,i.node,i.offset)?t:0))}}function KR(n,e,t){for(;;){if(!e||t-1;let{impreciseHead:o,impreciseAnchor:a}=e.docView,u=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=aN(e.docView.tile,t,i,0))){let f=o||a?[]:ej(e),d=new GR(f,e);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=tj(f,this.bounds.from)}else{let f=e.observer.selectionRange,d=o&&o.node==f.focusNode&&o.offset==f.focusOffset||!xx(e.contentDOM,f.focusNode)?u.main.head:e.docView.posFromDOM(f.focusNode,f.focusOffset),m=a&&a.node==f.anchorNode&&a.offset==f.anchorOffset||!xx(e.contentDOM,f.anchorNode)?u.main.anchor:e.docView.posFromDOM(f.anchorNode,f.anchorOffset),g=e.viewport;if((ke.ios||ke.chrome)&&d!=m&&Math.min(d,m)<=u.main.from&&Math.max(d,m)>=u.main.to&&(g.from>0||g.to-1&&u.ranges.length>1)this.newSel=u.replaceRange(oe.range(m,d));else if(e.lineWrapping&&m==d&&!(u.main.empty&&u.main.head==d)&&e.inputState.lastTouchTime>Date.now()-100){let b=e.coordsAtPos(d,-1),v=0;b&&(v=e.inputState.lastTouchY<=b.bottom?-1:1),this.newSel=oe.create([oe.cursor(d,v)])}else this.newSel=oe.single(m,d)}}}function aN(n,e,t,i){if(n.isComposite()){let l=-1,o=-1,a=-1,u=-1;for(let f=0,d=i,m=i;ft)return aN(g,e,t,d);if(b>=e&&l==-1&&(l=f,o=d),d>t&&g.dom.parentNode==n.dom){a=f,u=m;break}m=b,d=b+g.breakAfter}return{from:o,to:u<0?i+n.length:u,startDOM:(l?n.children[l-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:a=0?n.children[a].dom:null}}else return n.isText()?{from:i,to:i+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function cN(n,e){let t,{newSel:i}=e,{state:l}=n,o=l.selection.main,a=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:u,to:f}=e.bounds,d=o.from,m=null;(a===8||ke.android&&e.text.length=u&&o.to<=f&&(e.typeOver||g!=e.text)&&g.slice(0,o.from-u)==e.text.slice(0,o.from-u)&&g.slice(o.to-u)==e.text.slice(b=e.text.length-(g.length-(o.to-u)))?t={from:o.from,to:o.to,insert:mt.of(e.text.slice(o.from-u,b).split(na))}:(v=uN(g,e.text,d-u,m))&&(ke.chrome&&a==13&&v.toB==v.from+2&&e.text.slice(v.from,v.toB)==na+na&&v.toB--,t={from:u+v.from,to:u+v.toA,insert:mt.of(e.text.slice(v.from,v.toB).split(na))})}else i&&(!n.hasFocus&&l.facet(rl)||Ox(i,o))&&(i=null);if(!t&&!i)return!1;if((ke.mac||ke.android)&&t&&t.from==t.to&&t.from==o.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=oe.single(i.main.anchor-1,i.main.head-1)),t={from:t.from,to:t.to,insert:mt.of([t.insert.toString().replace("."," ")])}):l.doc.lineAt(o.from).toDate.now()-50?t={from:o.from,to:o.to,insert:l.toText(n.inputState.insertingText)}:ke.chrome&&t&&t.from==t.to&&t.from==o.head&&t.insert.toString()==` - `&&n.lineWrapping&&(i&&(i=oe.single(i.main.anchor-1,i.main.head-1)),t={from:o.from,to:o.to,insert:mt.of([" "])}),t)return jy(n,t,i,a);if(i&&!Ox(i,o)){let u=!1,f="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(u=!0),f=n.inputState.lastSelectionOrigin,f=="select.pointer"&&(i=oN(l.facet(Au).map(d=>d(n)),i))),n.dispatch({selection:i,scrollIntoView:u,userEvent:f}),!0}else return!1}function jy(n,e,t,i=-1){if(ke.ios&&n.inputState.flushIOSKey(e))return!0;let l=n.state.selection.main;if(ke.android&&(e.to==l.to&&(e.from==l.from||e.from==l.from-1&&n.state.sliceDoc(e.from,l.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&ga(n.contentDOM,"Enter",13)||(e.from==l.from-1&&e.to==l.to&&e.insert.length==0||i==8&&e.insert.lengthl.head)&&ga(n.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&ga(n.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let a,u=()=>a||(a=JR(n,e,t));return n.state.facet(YO).some(f=>f(n,e.from,e.to,o,u))||n.dispatch(u()),!0}function JR(n,e,t){let i,l=n.state,o=l.selection.main,a=-1;if(e.from==e.to&&e.fromo.to){let f=e.fromg(n)),d,f);e.from==m&&(a=m)}if(a>-1)i={changes:e,selection:oe.cursor(e.from+e.insert.length,-1)};else if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let f=o.frome.to?l.sliceDoc(e.to,o.to):"";i=l.replaceSelection(n.state.toText(f+e.insert.sliceString(0,void 0,n.state.lineBreak)+d))}else{let f=l.changes(e),d=t&&t.main.to<=f.newLength?t.main:void 0;if(l.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=o.to+10&&e.to>=o.to-10){let m=n.state.sliceDoc(e.from,e.to),g,b=t&&sN(n,t.main.head);if(b){let w=e.insert.length-(e.to-e.from);g={from:b.from,to:b.to-w}}else g=n.state.doc.lineAt(o.head);let v=o.to-e.to;i=l.changeByRange(w=>{if(w.from==o.from&&w.to==o.to)return{changes:f,range:d||w.map(f)};let S=w.to-v,C=S-m.length;if(n.state.sliceDoc(C,S)!=m||S>=g.from&&C<=g.to)return{range:w};let N=l.changes({from:C,to:S,insert:e.insert}),j=w.to-o.to;return{changes:N,range:d?oe.range(Math.max(0,d.anchor+j),Math.max(0,d.head+j)):w.map(N)}})}else i={changes:f,selection:d&&l.selection.replaceRange(d)}}let u="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,u+=".compose",n.inputState.compositionFirstChange&&(u+=".start",n.inputState.compositionFirstChange=!1)),l.update(i,{userEvent:u,scrollIntoView:!0})}function uN(n,e,t,i){let l=Math.min(n.length,e.length),o=0;for(;o0&&u>0&&n.charCodeAt(a-1)==e.charCodeAt(u-1);)a--,u--;if(i=="end"){let f=Math.max(0,o-Math.min(a,u));t-=a+f-o}if(a=a?o-t:0;o-=f,u=o+(u-a),a=o}else if(u=u?o-t:0;o-=f,a=o+(a-u),u=o}return{from:o,toA:a,toB:u}}function ej(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:o}=n.observer.selectionRange;return t&&(e.push(new gS(t,i)),(l!=t||o!=i)&&e.push(new gS(l,o))),e}function tj(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t<0||i<0?null:t==i?oe.create([oe.cursor(i+e,-1)]):oe.single(t+e,i+e)}function Ox(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}class nj{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,ke.safari&&e.contentDOM.addEventListener("input",()=>null),ke.gecko&&yj(e.contentDOM.ownerDocument)}handleEvent(e){!fj(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let l of i.observers)l(this.view,t);for(let l of i.handlers){if(t.defaultPrevented)break;if(l(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=rj(e),i=this.handlers,l=this.view.contentDOM;for(let o in t)if(o!="scroll"){let a=!t[o].handlers.length,u=i[o];u&&a!=!u.handlers.length&&(l.removeEventListener(o,this.handleEvent),u=null),u||l.addEventListener(o,this.handleEvent,{passive:a})}for(let o in i)o!="scroll"&&!t[o]&&l.removeEventListener(o,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&hN.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),ke.android&&ke.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(ke.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(fN.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||lj.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};t.shiftKey&&ke.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&ij(this.view.win)&&(t.shiftKey=!1);let i=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{this.pendingIOSKey==i&&this.flushIOSKey()},50),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||this.view.observer.pendingRecords().length||t.key=="Enter"&&e&&e.from0?!0:ke.safari&&!ke.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function ij(n){return n.visualViewport?n.visualViewport.height*n.visualViewport.scale/n.document.documentElement.clientHeight<.85:!1}function xS(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(l){pi(t.state,l)}}}function rj(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let l=i.spec,o=l&&l.plugin.domEventHandlers,a=l&&l.plugin.domEventObservers;if(o)for(let u in o){let f=o[u];f&&t(u).handlers.push(xS(i.value,f))}if(a)for(let u in a){let f=a[u];f&&t(u).observers.push(xS(i.value,f))}}for(let i in sr)t(i).handlers.push(sr[i]);for(let i in ei)t(i).observers.push(ei[i]);return e}const fN=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],lj="dthko",hN=[16,17,18,20,91,92,224,225],yh=6;function bh(n){return Math.max(0,n)*.7+8}function sj(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class oj{constructor(e,t,i,l){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=l,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=RO(e.contentDOM),this.atoms=e.state.facet(Au).map(a=>a(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(gt.allowMultipleSelections)&&aj(e,t),this.dragging=uj(e,t)&&pN(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&sj(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,l=0,o=0,a=this.view.win.innerWidth,u=this.view.win.innerHeight;this.scrollParents.x&&({left:l,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:u}=this.scrollParents.y.getBoundingClientRect());let f=Ry(this.view);e.clientX-f.left<=l+yh?t=-bh(l-e.clientX):e.clientX+f.right>=a-yh&&(t=bh(e.clientX-a)),e.clientY-f.top<=o+yh?i=-bh(o-e.clientY):e.clientY+f.bottom>=u-yh&&(i=bh(e.clientY-u)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&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=this.view.inputState.draggedContent=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(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=oN(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function aj(n,e){let t=n.state.facet(VO);return t.length?t[0](e):ke.mac?e.metaKey:e.ctrlKey}function cj(n,e){let t=n.state.facet(QO);return t.length?t[0](e):ke.mac?!e.altKey:!e.ctrlKey}function uj(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=hu(n.root);if(!i||i.rangeCount==0)return!0;let l=i.getRangeAt(0).getClientRects();for(let o=0;o=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function fj(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=Gt.get(t))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0}const sr=Object.create(null),ei=Object.create(null),dN=ke.ie&&ke.ie_version<15||ke.ios&&ke.webkit_version<604;function hj(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),mN(n,t.value)},50)}function em(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function mN(n,e){e=em(n.state,Ay,e);let{state:t}=n,i,l=1,o=t.toText(e),a=o.lines==t.selection.ranges.length;if(Nx!=null&&t.selection.ranges.every(f=>f.empty)&&Nx==o.toString()){let f=-1;i=t.changeByRange(d=>{let m=t.doc.lineAt(d.from);if(m.from==f)return{range:d};f=m.from;let g=t.toText((a?o.line(l++).text:e)+t.lineBreak);return{changes:{from:m.from,insert:g},range:oe.cursor(d.from+g.length,-1)}})}else a?i=t.changeByRange(f=>{let d=o.line(l++);return{changes:{from:f.from,to:f.to,insert:d.text},range:oe.cursor(f.from+d.length,-1)}}):i=t.replaceSelection(o);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}ei.scroll=n=>{let e=n.inputState;e.lastScrollTop=n.scrollDOM.scrollTop,e.lastScrollLeft=n.scrollDOM.scrollLeft,ke.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};ei.wheel=ei.mousewheel=n=>{n.inputState.lastWheelEvent=Date.now()};sr.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);ei.touchstart=(n,e)=>{let t=n.inputState,i=e.targetTouches[0];t.touchActive=!0,t.lastTouchTime=Date.now(),i&&(t.lastTouchX=i.clientX,t.lastTouchY=i.clientY),t.setSelectionOrigin("select.pointer")};ei.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};ei.touchend=(n,e)=>{n.inputState.touchActive=!1};sr.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(XO))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=mj(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new oj(n,e,t,i)),i&&n.observer.ignore(()=>{LO(n.contentDOM);let o=n.root.activeElement;o&&!o.contains(n.contentDOM)&&o.blur()});let l=n.inputState.mouseSelection;if(l)return l.start(e),l.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function yS(n,e,t,i){if(i==1)return oe.cursor(e,t);if(i==2)return qR(n.state,e,t);{let l=n.docView.lineAt(e,t),o=n.state.doc.lineAt(l?l.posAtEnd:e),a=l?l.posAtStart:o.from,u=l?l.posAtEnd:o.to;return uDate.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(vS+1)%3:1}function mj(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),i=pN(e),l=n.state.selection;return{update(o){o.docChanged&&(t.pos=o.changes.mapPos(t.pos),l=l.map(o.changes))},get(o,a,u){let f=n.posAndSideAtCoords({x:o.clientX,y:o.clientY},!1),d,m=yS(n,f.pos,f.assoc,i);if(t.pos!=f.pos&&!a){let g=yS(n,t.pos,t.assoc,i),b=Math.min(g.from,m.from),v=Math.max(g.to,m.to);m=b1&&(d=pj(l,f.pos))?d:u?l.addRange(m):oe.create([m])}}}function pj(n,e){for(let t=0;t=e)return oe.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}sr.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let l=n.docView.tile.nearest(e.target);if(l&&l.isWidget()){let o=l.posAtStart,a=o+l.length;(o>=t.to||a<=t.from)&&(t=oe.undirectionalRange(o,a))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",em(n.state,Ey,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};sr.dragend=n=>(n.inputState.draggedContent=null,!1);function kS(n,e,t,i){if(t=em(n.state,Ay,t),!t)return;let l=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=n.inputState,a=i&&o&&cj(n,e)?{from:o.from,to:o.to}:null,u={from:l,insert:t},f=n.state.changes(a?[a,u]:u);n.focus(),n.dispatch({changes:f,selection:{anchor:f.mapPos(l,-1),head:f.mapPos(l,1)},userEvent:a?"move.drop":"input.drop"}),n.inputState.draggedContent=null}sr.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),l=0,o=()=>{++l==t.length&&kS(n,e,i.filter(a=>a!=null).join(n.state.lineBreak),!1)};for(let a=0;a{/[\x00-\x08\x0e-\x1f]{2}/.test(u.result)||(i[a]=u.result),o()},u.readAsText(t[a])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return kS(n,e,i,!0),!0}return!1};sr.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=dN?null:e.clipboardData;return t?(mN(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(hj(n),!1)};function gj(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function xj(n){let e=[],t=[],i=!1;for(let l of n.selection.ranges)l.empty||(e.push(n.sliceDoc(l.from,l.to)),t.push(l));if(!e.length){let l=-1;for(let{from:o}of n.selection.ranges){let a=n.doc.lineAt(o);a.number>l&&(e.push(a.text),t.push({from:a.from,to:Math.min(n.doc.length,a.to+1)})),l=a.number}i=!0}return{text:em(n,Ey,e.join(n.lineBreak)),ranges:t,linewise:i}}let Nx=null;sr.copy=sr.cut=(n,e)=>{if(!Zc(n.contentDOM,n.observer.selectionRange))return!1;let{text:t,ranges:i,linewise:l}=xj(n.state);if(!t&&!l)return!1;Nx=l?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let o=dN?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",t),!0):(gj(n,t),!1)};const gN=ul.define();function xN(n,e){let t=[];for(let i of n.facet(GO)){let l=i(n,e);l&&t.push(l)}return t.length?n.update({effects:t,annotations:gN.of(!0)}):null}function yN(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=xN(n.state,e);t?n.dispatch(t):n.update([])}},10)}ei.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),yN(n)};ei.blur=n=>{n.observer.clearSelectionRange(),yN(n)};ei.compositionstart=ei.compositionupdate=(n,e)=>{if(!n.observer.editContext&&(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0)){let{main:t}=n.state.selection;!t.empty&&n.lineBlockAt(t.from).from!=n.lineBlockAt(t.to).from&&!n.state.readOnly&&n.dispatch({changes:n.state.selection.ranges.filter(i=>!i.empty).map(i=>({from:i.from,to:i.to})),userEvent:"input"}),n.inputState.composing=0}};ei.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,ke.chrome&&ke.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};ei.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};sr.beforeinput=(n,e)=>{var t,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let o=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),a=e.getTargetRanges();if(o&&a.length){let u=a[0],f=n.posAtDOM(u.startContainer,u.startOffset),d=n.posAtDOM(u.endContainer,u.endOffset);return jy(n,{from:f,to:d,insert:n.state.toText(o)},null),!0}}let l;if(ke.chrome&&ke.android&&(l=fN.find(o=>o.inputType==e.inputType))&&(n.observer.delayAndroidKey(l.key,l.keyCode),l.key=="Backspace"||l.key=="Delete")){let o=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>o+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return ke.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),ke.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>ei.compositionend(n,e),20),!1};const SS=new Set;function yj(n){SS.has(n)||(SS.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const CS=["pre-wrap","normal","pre-line","break-spaces"];let Aa=!1;function OS(){Aa=!1}class bj{constructor(e){this.lineWrapping=e,this.doc=mt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return CS.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,f=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=u;if(this.lineWrapping=u,this.lineHeight=t,this.charWidth=i,this.textHeight=l,this.lineLength=o,f){this.heightSamples={};for(let d=0;d0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>ed&&(Aa=!0),this.height=e)}replace(e,t,i){return Jn.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,l){let o=this,a=i.doc;for(let u=l.length-1;u>=0;u--){let{fromA:f,toA:d,fromB:m,toB:g}=l[u],b=o.lineAt(f,Lt.ByPosNoHeight,i.setDoc(t),0,0),v=b.to>=d?b:o.lineAt(d,Lt.ByPosNoHeight,i,0,0);for(g+=v.to-d,d=v.to;u>0&&b.from<=l[u-1].toA;)f=l[u-1].fromA,m=l[u-1].fromB,u--,fo*2){let u=e[t-1];u.break?e.splice(--t,1,u.left,null,u.right):e.splice(--t,1,u.left,u.right),i+=1+u.break,l-=u.size}else if(o>l*2){let u=e[i];u.break?e.splice(i,1,u.left,null,u.right):e.splice(i,1,u.left,u.right),i+=2+u.break,o-=u.size}else break;else if(l=o&&a(this.lineAt(0,Lt.ByPos,i,l,o))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more&&this.setMeasuredHeight(l),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Mi extends bN{constructor(e,t,i){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(e,t){return new tr(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,i){let l=i[0];return i.length==1&&(l instanceof Mi||l instanceof jn&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof jn?l=new Mi(l.length,this.height,this.spaceAbove):l.height=this.height,this.outdated||(l.outdated=!1),l):Jn.of(i)}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more?this.setMeasuredHeight(l):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(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 jn extends Jn{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,l=e.doc.lineAt(t+this.length).number,o=l-i+1,a,u=0;if(e.lineWrapping){let f=Math.min(this.height,e.lineHeight*o);a=f/o,this.length>o+1&&(u=(this.height-f)/(this.length-o-1))}else a=this.height/o;return{firstLine:i,lastLine:l,perLine:a,perChar:u}}blockAt(e,t,i,l){let{firstLine:o,lastLine:a,perLine:u,perChar:f}=this.heightMetrics(t,l);if(t.lineWrapping){let d=l+(e0){let o=i[i.length-1];o instanceof jn?i[i.length-1]=new jn(o.length+l):i.push(null,new jn(l-1))}if(e>0){let o=i[0];o instanceof jn?i[0]=new jn(e+o.length):i.unshift(new jn(e-1),null)}return Jn.of(i)}decomposeLeft(e,t){t.push(new jn(e-1),null)}decomposeRight(e,t){t.push(null,new jn(this.length-e-1))}updateHeight(e,t=0,i=!1,l){let o=t+this.length;if(l&&l.from<=t+this.length&&l.more){let a=[],u=Math.max(t,l.from),f=-1;for(l.from>t&&a.push(new jn(l.from-t-1).updateHeight(e,t));u<=o&&l.more;){let m=e.doc.lineAt(u).length;a.length&&a.push(null);let g=l.heights[l.index++],b=0;g<0&&(b=-g,g=l.heights[l.index++]),f==-1?f=g:Math.abs(g-f)>=ed&&(f=-2);let v=new Mi(m,g,b);v.outdated=!1,a.push(v),u+=m+1}u<=o&&a.push(null,new jn(o-u).updateHeight(e,u));let d=Jn.of(a);return(f<0||Math.abs(d.height-this.height)>=ed||Math.abs(f-this.heightMetrics(e,t).perLine)>=ed)&&(Aa=!0),yd(this,d)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class kj extends Jn{constructor(e,t,i){super(e.length+(t?1:0)+i.length,e.height+i.height,(t?1:0)|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,l){let o=i+this.left.height;return eu))return d;let m=t==Lt.ByPosNoHeight?Lt.ByPosNoHeight:Lt.ByPos;return f?d.join(this.right.lineAt(u,m,i,a,u)):this.left.lineAt(u,m,i,l,o).join(d)}forEachLine(e,t,i,l,o,a){let u=l+this.left.height,f=o+this.left.length+this.break;if(this.break)e=f&&this.right.forEachLine(e,t,i,u,f,a);else{let d=this.lineAt(f,Lt.ByPos,i,l,o);e=e&&d.from<=t&&a(d),t>d.to&&this.right.forEachLine(Math.max(e,d.to+1),t,i,u,f,a)}}replace(e,t,i){let l=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-l,t-l,i));let o=[];e>0&&this.decomposeLeft(e,o);let a=o.length;for(let u of i)o.push(u);if(e>0&&NS(o,a-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,l=i+this.break;if(e>=l)return this.right.decomposeRight(e-l,t);e2*t.size||t.size>2*e.size?Jn.of(this.break?[e,null,t]:[e,t]):(this.left=yd(this.left,e),this.right=yd(this.right,t),this.setHeight(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,i=!1,l){let{left:o,right:a}=this,u=t+o.length+this.break,f=null;return l&&l.from<=t+o.length&&l.more?f=o=o.updateHeight(e,t,i,l):o.updateHeight(e,t,i),l&&l.from<=u+a.length&&l.more?f=a=a.updateHeight(e,u,i,l):a.updateHeight(e,u,i),f?this.balanced(o,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function NS(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof jn&&(i=n[e+1])instanceof jn&&n.splice(e-1,3,new jn(t.length+1+i.length))}const Sj=5;class _y{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 i=Math.min(t,this.lineEnd),l=this.nodes[this.nodes.length-1];l instanceof Mi?l.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Mi(i-this.pos,-1,0)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=Sj)&&this.addLineDeco(l,o,a)}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 Mi(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let i=new jn(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Mi)return e;let t=new Mi(0,-1,0);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,i){let l=this.ensureLine();l.length+=i,l.collapsed+=i,l.widgetHeight=Math.max(l.widgetHeight,e),l.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Mi)&&!this.isCovered?this.nodes.push(new Mi(0,-1,0)):(this.writtenTod.clientHeight||d.scrollWidth>d.clientWidth)&&m.overflow!="visible"){let g=d.getBoundingClientRect();o=Math.max(o,g.left),a=Math.min(a,g.right),u=Math.max(u,g.top),f=Math.min(d==n.parentNode?l.innerHeight:f,g.bottom)}d=m.position=="absolute"||m.position=="fixed"?d.offsetParent:d.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:o-t.left,right:Math.max(o,a)-t.left,top:u-(t.top+e),bottom:Math.max(u,f)-(t.top+e)}}function Tj(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left0&&e.top0}function Aj(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class o0{constructor(e,t,i,l){this.from=e,this.to=t,this.size=i,this.displaySize=l}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof l!="function"&&l.class=="cm-lineWrapping");this.heightOracle=new bj(i),this.stateDeco=AS(t),this.heightMap=Jn.empty().applyChanges(this.stateDeco,mt.empty,this.heightOracle.setDoc(t.doc),[new Fi(0,0,0,t.doc.length)]);for(let l=0;l<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());l++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Fe.set(this.lineGaps.map(l=>l.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let l=i?t.head:t.anchor;if(!e.some(({from:o,to:a})=>l>=o&&l<=a)){let{from:o,to:a}=this.lineBlockAt(l);e.push(new vh(o,a))}}return this.viewports=e.sort((i,l)=>i.from-l.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Tx:bd.get(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push($c(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=AS(this.state);let l=e.changedRanges,o=Fi.extendWithRanges(l,Cj(i,this.stateDeco,e?e.changes:mn.empty(this.state.doc.length))),a=this.heightMap.height,u=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);OS(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=a||Aa)&&(e.flags|=2),u?(this.scrollAnchorPos=e.changes.mapPos(u.from,-1),this.scrollAnchorHeight=u.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let f=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.headf.to)||!this.viewportIsAppropriate(f))&&(f=this.getViewport(0,t));let d=f.from!=this.viewport.from||f.to!=this.viewport.to;this.viewport=f,e.flags|=this.updateForViewport(),(d||!e.changes.empty||e.flags&2)&&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(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(WO)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,i=window.getComputedStyle(t),l=this.heightOracle,o=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?Tt.RTL:Tt.LTR;let a=this.heightOracle.mustRefreshForWrapping(o)||this.mustMeasureContent==="refresh",u=t.getBoundingClientRect(),f=a||this.mustMeasureContent||this.contentDOMHeight!=u.height;this.contentDOMHeight=u.height,this.mustMeasureContent=!1;let d=0,m=0;if(u.width&&u.height){let{scaleX:U,scaleY:E}=DO(t,u);(U>.005&&Math.abs(this.scaleX-U)>.005||E>.005&&Math.abs(this.scaleY-E)>.005)&&(this.scaleX=U,this.scaleY=E,d|=16,a=f=!0)}let g=(parseInt(i.paddingTop)||0)*this.scaleY,b=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=g||this.paddingBottom!=b)&&(this.paddingTop=g,this.paddingBottom=b,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(l.lineWrapping&&(f=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let v=RO(this.view.contentDOM,!1).y;v!=this.scrollParent&&(this.scrollParent=v,this.scrollAnchorHeight=-1,this.scrollOffset=0);let w=this.getScrollOffset();this.scrollOffset!=w&&(this.scrollAnchorHeight=-1,this.scrollOffset=w),this.scrolledToBottom=zO(this.scrollParent||e.win);let S=(this.printing?Aj:Nj)(t,this.paddingTop),C=S.top-this.pixelViewport.top,N=S.bottom-this.pixelViewport.bottom;this.pixelViewport=S;let j=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(j!=this.inView&&(this.inView=j,j&&(f=!0)),!this.inView&&!this.scrollTarget&&!Tj(e.dom))return 0;let D=u.width;if((this.contentDOMWidth!=D||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=u.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),f){let U=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(U)&&(a=!0),a||l.lineWrapping&&Math.abs(D-this.contentDOMWidth)>l.charWidth){let{lineHeight:E,charWidth:T,textHeight:z}=e.docView.measureTextSize();a=E>0&&l.refresh(o,E,T,z,Math.max(5,D/T),U),a&&(e.docView.minWidth=0,d|=16)}C>0&&N>0?m=Math.max(C,N):C<0&&N<0&&(m=Math.min(C,N)),OS();for(let E of this.viewports){let T=E.from==this.viewport.from?U:e.docView.measureVisibleLineHeights(E);this.heightMap=(a?Jn.empty().applyChanges(this.stateDeco,mt.empty,this.heightOracle,[new Fi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,a,new vj(E.from,T))}Aa&&(d|=2)}let I=!this.viewportIsAppropriate(this.viewport,m)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return I&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(m,this.scrollTarget),d|=this.updateForViewport()),(d&2||I)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),l=this.heightMap,o=this.heightOracle,{visibleTop:a,visibleBottom:u}=this,f=new vh(l.lineAt(a-i*1e3,Lt.ByHeight,o,0,0).from,l.lineAt(u+(1-i)*1e3,Lt.ByHeight,o,0,0).to);if(t){let{head:d}=t.range;if(df.to){let m=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),g=l.lineAt(d,Lt.ByPos,o,0,0),b;t.y=="center"?b=(g.top+g.bottom)/2-m/2:t.y=="start"||t.y=="nearest"&&d=u+Math.max(10,Math.min(i,250)))&&l>a-2*1e3&&o>1,a=l<<1;if(this.defaultTextDirection!=Tt.LTR&&!i)return[];let u=[],f=(m,g,b,v)=>{if(g-mm&&NN.from>=b.from&&N.to<=b.to&&Math.abs(N.from-m)N.fromj));if(!C){if(gD.from<=g&&D.to>=g)){let D=t.moveToLineBoundary(oe.cursor(g),!1,!0).head;D>m&&(g=D)}let N=this.gapSize(b,m,g,v),j=i||N<2e6?N:2e6;C=new o0(m,g,N,j)}u.push(C)},d=m=>{if(m.length2e6)for(let E of e)E.from>=m.from&&E.fromm.from&&f(m.from,v,m,g),wt.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];st.spans(t,this.viewport.from,this.viewport.to,{span(o,a){i.push({from:o,to:a})},point(){}},20);let l=0;if(i.length!=this.visibleRanges.length)l=12;else for(let o=0;o=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||$c(this.heightMap.lineAt(e,Lt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||$c(this.heightMap.lineAt(this.scaler.fromDOM(e),Lt.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop*this.scaleY:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+12-this.paddingTop);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return $c(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 vh{constructor(e,t){this.from=e,this.to=t}}function Mj(n,e,t){let i=[],l=n,o=0;return st.spans(t,n,e,{span(){},point(a,u){a>l&&(i.push({from:l,to:a}),o+=a-l),l=u}},20),l=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let l=0;;l++){let{from:o,to:a}=e[l],u=a-o;if(i<=u)return o+i;i-=u}}function kh(n,e){let t=0;for(let{from:i,to:l}of n.ranges){if(e<=l){t+=e-i;break}t+=l-i}return t/n.total}function Dj(n,e){for(let t of n)if(e(t))return t}const Tx={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function AS(n){let e=n.facet(Wd).filter(i=>typeof i!="function"),t=n.facet(Dy).filter(i=>typeof i!="function");return t.length&&e.push(st.join(t)),e}class bd{constructor(e,t){this.scale=e,this.viewports=t}static get(e,t,i){let l=0,o=0,a=0,u=i.map(({from:d,to:m})=>{let g=t.lineAt(d,Lt.ByPos,e,0,0).top,b=t.lineAt(m,Lt.ByPos,e,0,0).bottom;return l+=b-g,{from:d,to:m,top:g,bottom:b,domTop:0,domBottom:0}});if(t.height-l<10)return Tx;let f=(7e6-l)/(t.height-l);for(let d of u)d.domTop=a+(d.top-o)*f,a=d.domBottom=d.domTop+(d.bottom-d.top),o=d.bottom;return new bd(f,u)}toDOM(e){for(let t=0,i=0,l=0;;t++){let o=tt.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function $c(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new tr(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(l=>$c(l,e)):n._content)}const Sh=Ce.define({combine:n=>n.join(" ")}),Ax=Ce.define({combine:n=>n.indexOf(!0)>-1}),Ex=rs.newName(),vN=rs.newName(),wN=rs.newName(),kN={"&light":"."+vN,"&dark":"."+wN};function Mx(n,e,t){return new rs(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,l=>{if(l=="&")return n;if(!t||!t[l])throw new RangeError(`Unsupported selector: ${l}`);return t[l]}):n+" "+i}})}const Rj=Mx("."+Ex,{"&":{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,overflowAnchor:"none"},".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":{userSelect:"none",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:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&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",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&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,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"baseline",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{background:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat",backgroundSize:".4em",backgroundPosition:"calc(min(50%, 0px)) center"},".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"}},kN),jj={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},a0=ke.ie&&ke.ie_version<=11;class _j{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new cR,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.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(ke.ie&&ke.ie_version<=11||ke.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&ke.android&&e.constructor.EDIT_CONTEXT!==!1&&!(ke.chrome&&ke.chrome_version<126)&&(this.editContext=new zj(e),e.state.facet(rl)&&(e.contentDOM.editContext=this.editContext.editContext)),a0&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.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),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.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(t=>{t.length>0&&t[t.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(this.pendingRecords().length>0),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(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,i)=>t!=e[i]))){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:i}=this,l=this.selectionRange;if(i.state.facet(rl)?i.root.activeElement!=this.dom:!Zc(this.dom,l))return;let o=l.anchorNode&&i.docView.tile.nearest(l.anchorNode);if(o&&o.isWidget()&&o.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(ke.ie&&ke.ie_version<=11||ke.android&&ke.chrome)&&!i.state.selection.main.empty&&l.focusNode&&Jc(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=hu(e.root);if(!t)return!1;let i=ke.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Lj(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let l=Zc(this.dom,i);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&ga(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(l)}(!this.delayedAndroidKey||e=="Enter")&&(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,i=-1,l=!1;for(let o of e){let a=this.readMutation(o);a&&(a.typeOver&&(l=!0),t==-1?{from:t,to:i}=a:(t=Math.min(a.from,t),i=Math.max(a.to,i)))}return{from:t,to:i,typeOver:l}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),l=this.selectionChanged&&Zc(this.dom,this.selectionRange);if(e<0&&!l)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new ZR(this.view,e,t,i);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.selectionChanged,i=this.readChange();if(!i)return this.view.requestMeasure(),!1;let l=this.view.state,o=cN(this.view,i);return this.view.state==l&&(i.domChanged||t)&&this.view.update([]),o}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let i=ES(t,e.previousSibling||e.target.previousSibling,-1),l=ES(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:l?t.posBefore(l):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{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),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):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),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(rl)!=e.state.facet(rl)&&(e.view.contentDOM.editContext=e.state.facet(rl)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let l of this.scrollTargets)l.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function ES(n,e,t){for(;e;){let i=Gt.get(e);if(i&&i.parent==n)return i;let l=e.parentNode;e=l!=n.dom?l:t>0?e.nextSibling:e.previousSibling}return null}function MS(n,e){let t=e.startContainer,i=e.startOffset,l=e.endContainer,o=e.endOffset,a=n.docView.domAtPos(n.state.selection.main.anchor,1);return Jc(a.node,a.offset,l,o)&&([t,i,l,o]=[l,o,t,i]),{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:o}}function Lj(n,e){if(e.getComposedRanges){let l=e.getComposedRanges(n.root)[0];if(l)return MS(n,l)}let t=null;function i(l){l.preventDefault(),l.stopImmediatePropagation(),t=l.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?MS(n,t):null}class zj{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let l=e.state.selection.main,{anchor:o,head:a}=l,u=this.toEditorPos(i.updateRangeStart),f=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:u,drifted:!1});let d=f-u>i.text.length;u==this.from&&othis.to&&(f=o);let m=uN(e.state.sliceDoc(u,f),i.text,(d?l.from:l.to)-u,d?"end":null);if(!m){let b=oe.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));Ox(b,l)||e.dispatch({selection:b,userEvent:"select"});return}let g={from:m.from+u,to:m.toA+u,insert:mt.of(i.text.slice(m.from,m.toB).split(` -`))};if((ke.mac||ke.android)&&g.from==a-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(g={from:u,to:f,insert:mt.of([i.text.replace("."," ")])}),this.pendingContextChange=g,!e.state.readOnly){let b=this.to-this.from+(g.to-g.from+g.insert.length);jy(e,g,oe.single(this.toEditorPos(i.selectionStart,b),this.toEditorPos(i.selectionEnd,b)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),g.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let l=[],o=null;for(let a=this.toEditorPos(i.rangeStart),u=this.toEditorPos(i.rangeEnd);a{let l=[];for(let o of i.getTextFormats()){let a=o.underlineStyle,u=o.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(u)){let f=this.toEditorPos(o.rangeStart),d=this.toEditorPos(o.rangeEnd);if(f{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{let l=hu(i.root);l&&l.rangeCount&&this.editContext.updateSelectionBounds(l.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,l=this.pendingContextChange;return e.changes.iterChanges((o,a,u,f,d)=>{if(i)return;let m=d.length-(a-o);if(l&&a>=l.to)if(l.from==o&&l.to==a&&l.insert.eq(d)){l=this.pendingContextChange=null,t+=m,this.to+=m;return}else l=null,this.revertPending(e.state);if(o+=t,a+=t,a<=this.from)this.from+=m,this.to+=m;else if(othis.to||this.to-this.from+d.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(o),this.toContextPos(a),d.toString()),this.to+=m}t+=m}),l&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(l=>!l.isUserEvent("input.type")&&l.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),l=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=l)&&this.editContext.updateSelection(i,l)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Oe{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&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.clearAnnouncement=-1,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.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(l=>l.forEach(o=>i(o,this)))||(l=>this.update(l)),this.dispatch=this.dispatch.bind(this),this._root=e.root||uR(e.parent)||document,this.viewState=new TS(this,e.state||gt.create(e)),e.scrollTo&&e.scrollTo.is(xh)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(ca).map(l=>new n0(l));for(let l of this.plugins)l.update(this);this.observer=new _j(this),this.inputState=new nj(this),this.inputState.ensureHandlers(this.plugins),this.docView=new mS(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof pn?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,l,o=this.state;for(let b of e){if(b.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=b.state}if(this.destroyed){this.viewState.state=o;return}let a=this.hasFocus,u=0,f=null;e.some(b=>b.annotation(gN))?(this.inputState.notifiedFocused=a,u=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,f=xN(o,a),f||(u=1));let d=this.observer.delayedAndroidKey,m=null;if(d?(this.observer.clearDelayedAndroidKey(),m=this.observer.readChange(),(m&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(m=null)):this.observer.clear(),o.facet(gt.phrases)!=this.state.facet(gt.phrases))return this.setState(o);l=pd.create(this,o,e),l.flags|=u;let g=this.viewState.scrollTarget;try{this.updateState=2;for(let b of e){if(g&&(g=g.map(b.changes)),b.scrollIntoView){let{main:v}=b.state.selection,{x:w,y:S}=this.state.facet(Oe.cursorScrollMargin);g=new xa(v.empty?v:oe.cursor(v.head,v.head>v.anchor?-1:1),"nearest","nearest",S,w)}for(let v of b.effects)v.is(xh)&&(g=v.value.clip(this.state))}this.viewState.update(l,g),this.bidiCache=vd.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),t=this.docView.update(l),this.state.facet(Xc)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(b=>b.isUserEvent("select.pointer")))}finally{this.updateState=0}if(l.startState.facet(Sh)!=l.state.facet(Sh)&&(this.viewState.mustMeasureContent=!0),(t||i||g||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!l.empty)for(let b of this.state.facet(wx))try{b(l)}catch(v){pi(this.state,v,"update listener")}(f||m)&&Promise.resolve().then(()=>{f&&this.state==f.startState&&this.dispatch(f),m&&!cN(this,m)&&d.force&&ga(this.contentDOM,d.key,d.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new TS(this,e),this.plugins=e.facet(ca).map(i=>new n0(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new mS(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(ca),i=e.state.facet(ca);if(t!=i){let l=[];for(let o of i){let a=t.indexOf(o);if(a<0)l.push(new n0(o));else{let u=this.plugins[a];u.mustUpdate=e,l.push(u)}}for(let o of this.plugins)o.mustUpdate!=e&&o.destroy(this);this.plugins=l,this.pluginMap.clear()}else for(let l of this.plugins)l.mustUpdate=e;for(let l=0;l-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.viewState.scrollParent,l=this.viewState.getScrollOffset(),{scrollAnchorPos:o,scrollAnchorHeight:a,scaleY:u}=this.viewState;Math.abs(l-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let f=0;;f++){if(a<0){if(zO(i||this.win))o=-1,a=this.viewState.heightMap.height/this.viewState.scaleY;else{let w=this.viewState.scrollAnchorAt(l);o=w.from,a=w.top}u=this.viewState.scaleY}this.updateState=1;let d=this.viewState.measure();if(!d&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(f>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let m=[];d&4||([this.measureRequests,m]=[m,this.measureRequests]);let g=m.map(w=>{try{return w.read(this)}catch(S){return pi(this.state,S),DS}}),b=pd.create(this,this.state,[]),v=!1;b.flags|=d,t?t.flags|=d:t=b,this.updateState=2,b.empty||(this.updatePlugins(b),this.inputState.update(b),this.updateAttrs(),v=this.docView.update(b),v&&this.docViewUpdate());for(let w=0;w1||S<-1)&&!(ke.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){l=l+S,i?o<0?i.scrollTop=i.scrollHeight:i.scrollTop+=S:this.win.scrollBy(0,S),a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let f of this.state.facet(wx))f(t)}get themeClasses(){return Ex+" "+(this.state.facet(Ax)?wN:vN)+" "+this.state.facet(Sh)}updateAttrs(){let e=RS(this,eN,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(rl)?"true":"false",class:"cm-content",style:`${ke.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),RS(this,My,t);let i=this.observer.ignore(()=>{let l=aS(this.contentDOM,this.contentAttrs,t),o=aS(this.dom,this.editorAttrs,e);return l||o});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let l of i.effects)if(l.is(Oe.announce)){t&&(this.announceDOM.textContent="",this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=" "},200),t=!1);let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=l.value}}mountStyles(){this.styleModules=this.state.facet(Xc);let e=this.state.facet(Oe.cspNonce);rs.mount(this.root,this.styleModules.concat(Rj).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&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(e.key!=null){for(let t=0;ti.plugin==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,i){return s0(this,e,pS(this,e,t,i))}moveByGroup(e,t){return s0(this,e,pS(this,e,t,i=>XR(this,e.head,i)))}visualLineSide(e,t){return t?oe.cursor(e.to,1):oe.cursor(e.from,-1)}moveToLineBoundary(e,t,i=!0){return QR(this,e,t,i)}moveVertically(e,t,i){return s0(this,e,$R(this,e,t,i))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let i=Cx(this,e,t);return i&&i.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Cx(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.state.doc.lineAt(e),l=this.bidiSpans(i),o=l[Rr.find(l,e-i.from,-1,t)];return i.length&&(e==i.from&&t<0||e==i.to&&t>0)&&o.dir!=this.textDirectionAt(i.from)&&(e==i.to?(e=i.from+o.from,t=1):(e=i.from+o.to,t=-1)),this.docView.coordsAt(e,t,o.dir==Tt.RTL)}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(KO)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Bj)return FO(e.length);let t=this.textDirectionAt(e.from),i;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==t&&(o.fresh||UO(o.isolates,i=fS(this,e))))return o.order;i||(i=fS(this,e));let l=yR(e.text,t,i);return this.bidiCache.push(new vd(e.from,e.to,t,i,!0,l)),l}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||ke.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{LO(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.win.clearTimeout(this.clearAnnouncement),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){var i,l,o,a;return xh.of(new xa(typeof e=="number"?oe.cursor(e):e,(i=t.y)!==null&&i!==void 0?i:"nearest",(l=t.x)!==null&&l!==void 0?l:"nearest",(o=t.yMargin)!==null&&o!==void 0?o:5,(a=t.xMargin)!==null&&a!==void 0?a:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return xh.of(new xa(oe.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return en.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return en.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=rs.newName(),l=[Sh.of(i),Xc.of(Mx(`.${i}`,e))];return t&&t.dark&&l.push(Ax.of(!0)),l}static baseTheme(e){return ao.lowest(Xc.of(Mx("."+Ex,e,kN)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),l=i&&Gt.get(i)||Gt.get(e);return((t=l==null?void 0:l.root)===null||t===void 0?void 0:t.view)||null}}Oe.styleModule=Xc;Oe.inputHandler=YO;Oe.clipboardInputFilter=Ay;Oe.clipboardOutputFilter=Ey;Oe.scrollHandler=ZO;Oe.focusChangeEffect=GO;Oe.perLineTextDirection=KO;Oe.exceptionSink=$O;Oe.updateListener=wx;Oe.editable=rl;Oe.mouseSelectionStyle=XO;Oe.dragMovesSelection=QO;Oe.clickAddsSelectionRange=VO;Oe.decorations=Wd;Oe.blockWrappers=tN;Oe.outerDecorations=Dy;Oe.atomicRanges=Au;Oe.bidiIsolatedRanges=nN;Oe.cursorScrollMargin=Ce.define({combine:n=>{let e=5,t=5;for(let i of n)typeof i=="number"?e=t=i:{x:e,y:t}=i;return{x:e,y:t}}});Oe.scrollMargins=rN;Oe.darkTheme=Ax;Oe.cspNonce=Ce.define({combine:n=>n.length?n[0]:""});Oe.contentAttributes=My;Oe.editorAttributes=eN;Oe.lineWrapping=Oe.contentAttributes.of({class:"cm-lineWrapping"});Oe.announce=Ke.define();const Bj=4096,DS={};class vd{constructor(e,t,i,l,o,a){this.from=e,this.to=t,this.dir=i,this.isolates=l,this.fresh=o,this.order=a}static update(e,t){if(t.empty&&!e.some(o=>o.fresh))return e;let i=[],l=e.length?e[e.length-1].dir:Tt.LTR;for(let o=Math.max(0,e.length-10);o=0;l--){let o=i[l],a=typeof o=="function"?o(n):o;a&&Oy(a,t)}return t}const Pj=ke.mac?"mac":ke.windows?"win":ke.linux?"linux":"key";function Hj(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let l,o,a,u;for(let f=0;fi.concat(l),[]))),t}function Uj(n,e,t){return CN(SN(n.state),e,n,t)}let Kl=null;const Fj=4e3;function qj(n,e=Pj){let t=Object.create(null),i=Object.create(null),l=(a,u)=>{let f=i[a];if(f==null)i[a]=u;else if(f!=u)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},o=(a,u,f,d,m)=>{var g,b;let v=t[a]||(t[a]=Object.create(null)),w=u.split(/ (?!$)/).map(N=>Hj(N,e));for(let N=1;N{let I=Kl={view:D,prefix:j,scope:a};return setTimeout(()=>{Kl==I&&(Kl=null)},Fj),!0}]})}let S=w.join(" ");l(S,!1);let C=v[S]||(v[S]={preventDefault:!1,stopPropagation:!1,run:((b=(g=v._any)===null||g===void 0?void 0:g.run)===null||b===void 0?void 0:b.slice())||[]});f&&C.run.push(f),d&&(C.preventDefault=!0),m&&(C.stopPropagation=!0)};for(let a of n){let u=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let d of u){let m=t[d]||(t[d]=Object.create(null));m._any||(m._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:g}=a;for(let b in m)m[b].run.push(v=>g(v,Dx))}let f=a[e]||a.key;if(f)for(let d of u)o(d,f,a.run,a.preventDefault,a.stopPropagation),a.shift&&o(d,"Shift-"+f,a.shift,a.preventDefault,a.stopPropagation)}return t}let Dx=null;function CN(n,e,t,i){Dx=e;let l=iR(e),o=hi(l,0),a=Mr(o)==l.length&&l!=" ",u="",f=!1,d=!1,m=!1;Kl&&Kl.view==t&&Kl.scope==i&&(u=Kl.prefix+" ",hN.indexOf(e.keyCode)<0&&(d=!0,Kl=null));let g=new Set,b=C=>{if(C){for(let N of C.run)if(!g.has(N)&&(g.add(N),N(t)))return C.stopPropagation&&(m=!0),!0;C.preventDefault&&(C.stopPropagation&&(m=!0),d=!0)}return!1},v=n[i],w,S;return v&&(b(v[u+Ch(l,e,!a)])?f=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(ke.windows&&e.ctrlKey&&e.altKey)&&!(ke.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(w=ls[e.keyCode])&&w!=l?(b(v[u+Ch(w,e,!0)])||e.shiftKey&&(S=uu[e.keyCode])!=l&&S!=w&&b(v[u+Ch(S,e,!1)]))&&(f=!0):a&&e.shiftKey&&b(v[u+Ch(l,e,!0)])&&(f=!0),!f&&b(v._any)&&(f=!0)),d&&(f=!0),f&&m&&e.stopPropagation(),Dx=null,f}class eo{constructor(e,t,i,l,o){this.className=e,this.left=t,this.top=i,this.width=l,this.height=o}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(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,i){if(i.empty){let l=e.coordsAtPos(i.head,i.assoc||1);if(!l)return[];let o=ON(e);return[new eo(t,l.left-o.left,l.top-o.top,null,l.bottom-l.top)]}else return Vj(e,t,i)}}function ON(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==Tt.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function _S(n,e,t,i){let l=n.coordsAtPos(e,t*2);if(!l)return i;let o=n.dom.getBoundingClientRect(),a=(l.top+l.bottom)/2,u=n.posAtCoords({x:o.left+1,y:a}),f=n.posAtCoords({x:o.right-1,y:a});return u==null||f==null?i:{from:Math.max(i.from,Math.min(u,f)),to:Math.min(i.to,Math.max(u,f))}}function Vj(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let i=Math.max(t.from,n.viewport.from),l=Math.min(t.to,n.viewport.to),o=n.textDirection==Tt.LTR,a=n.contentDOM,u=a.getBoundingClientRect(),f=ON(n),d=a.querySelector(".cm-line"),m=d&&window.getComputedStyle(d),g=u.left+(m?parseInt(m.paddingLeft)+Math.min(0,parseInt(m.textIndent)):0),b=u.right-(m?parseInt(m.paddingRight):0),v=Sx(n,i,1),w=Sx(n,l,-1),S=v.type==Bn.Text?v:null,C=w.type==Bn.Text?w:null;if(S&&(n.lineWrapping||v.widgetLineBreaks)&&(S=_S(n,i,1,S)),C&&(n.lineWrapping||w.widgetLineBreaks)&&(C=_S(n,l,-1,C)),S&&C&&S.from==C.from&&S.to==C.to)return j(D(t.from,t.to,S));{let U=S?D(t.from,null,S):I(v,!1),E=C?D(null,t.to,C):I(w,!0),T=[];return(S||v).to<(C||w).from-(S&&C?1:0)||v.widgetLineBreaks>1&&U.bottom+n.defaultLineHeight/2F&&me.from=_)break;A>ne&&G(Math.max(re,ne),U==null&&re<=F,Math.min(A,_),E==null&&A>=se,ie.dir)}if(ne=Z.to+1,ne>=_)break}return q.length==0&&G(F,U==null,se,E==null,n.textDirection),{top:z,bottom:te,horizontal:q}}function I(U,E){let T=u.top+(E?U.top:U.bottom);return{top:T,bottom:T,horizontal:[]}}}function Qj(n,e){return n.constructor==e.constructor&&n.eq(e)}class Xj{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(td)!=e.state.facet(td)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,i=e.facet(td);for(;t!Qj(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let l of e)l.update&&t&&l.constructor&&this.drawn[i].constructor&&l.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(l.draw(),t);for(;t;){let l=t.nextSibling;t.remove(),t=l}this.drawn=e,ke.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const td=Ce.define();function NN(n){return[en.define(e=>new Xj(e,n)),td.of(n)]}const Rx=!ke.ios,Ea=Ce.define({combine(n){return Pr(n,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function $j(n={}){return[Ea.of(n),Yj,Gj,Wj,WO.of(!0)]}function TN(n){return n.startState.facet(Ea)!=n.state.facet(Ea)}const Yj=NN({above:!0,markers(n){let{state:e}=n,t=e.facet(Ea),i=[];for(let l of e.selection.ranges){let o=l==e.selection.main;if(l.empty||t.drawRangeCursor&&!(o&&ke.ios&&t.iosSelectionHandles)){let a=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",u=l.empty?l:oe.cursor(l.head,l.assoc);for(let f of eo.forRange(n,a,u))i.push(f)}}return i},update(n,e){n.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=TN(n);return t&&LS(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){LS(e.state,n)},class:"cm-cursorLayer"});function LS(n,e){e.style.animationDuration=n.facet(Ea).cursorBlinkRate+"ms"}const Gj=NN({above:!1,markers(n){let e=[],{main:t,ranges:i}=n.state.selection;for(let l of i)if(!l.empty&&(Rx||l!=t))for(let o of eo.forRange(n,"cm-selectionBackground",l))e.push(o);if(ke.ios&&!t.empty&&n.state.facet(Ea).iosSelectionHandles){for(let l of eo.forRange(n,"cm-selectionHandle cm-selectionHandle-start",oe.cursor(t.from,1)))e.push(l);for(let l of eo.forRange(n,"cm-selectionHandle cm-selectionHandle-end",oe.cursor(t.to,1)))e.push(l)}return e},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||TN(n)},class:"cm-selectionLayer"}),Kj=ke.gecko&&ke.gecko_version==153?"#ffffff01":"transparent",Wj=ao.highest(Oe.theme({".cm-line":{...Rx?{"& ::selection, &::selection":{backgroundColor:`${Kj} !important`}}:{},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important",...Rx?{"&::selection, & ::selection":{backgroundColor:"Highlight !important"}}:{}}}})),AN=Ke.define({map(n,e){return n==null?null:e.mapPos(n)}}),Yc=Fn.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(AN)?i.value:t,n)}}),Zj=en.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(Yc);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(Yc)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(Yc),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let i=n.scrollDOM.getBoundingClientRect();return{left:t.left-i.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-i.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(Yc)!=n&&this.view.dispatch({effects:AN.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Jj(){return[Yc,Zj]}function zS(n,e,t,i,l){e.lastIndex=0;for(let o=n.iterRange(t,i),a=t,u;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;u=e.exec(o.value);)l(a+u.index,u)}function e_(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:l,to:o}of t)l=Math.max(n.state.doc.lineAt(l).from,l-e),o=Math.min(n.state.doc.lineAt(o).to,o+e),i.length&&i[i.length-1].to>=l?i[i.length-1].to=o:i.push({from:l,to:o});return i}class t_{constructor(e){const{regexp:t,decoration:i,decorate:l,boundary:o,maxLength:a=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,l)this.addMatch=(u,f,d,m)=>l(m,d,d+u[0].length,u,f);else if(typeof i=="function")this.addMatch=(u,f,d,m)=>{let g=i(u,f,d);g&&m(d,d+u[0].length,g)};else if(i)this.addMatch=(u,f,d,m)=>m(d,d+u[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=o,this.maxLength=a}createDeco(e){let t=new Br,i=t.add.bind(t);for(let{from:l,to:o}of e_(e,this.maxLength))zS(e.state.doc,this.regexp,l,o,(a,u)=>this.addMatch(u,e,a,i));return t.finish()}updateDeco(e,t){let i=1e9,l=-1;return e.docChanged&&e.changes.iterChanges((o,a,u,f)=>{f>=e.view.viewport.from&&u<=e.view.viewport.to&&(i=Math.min(u,i),l=Math.max(f,l))}),e.viewportMoved||l-i>1e3?this.createDeco(e.view):l>-1?this.updateRange(e.view,t.map(e.changes),i,l):t}updateRange(e,t,i,l){for(let o of e.visibleRanges){let a=Math.max(o.from,i),u=Math.min(o.to,l);if(u>=a){let f=e.state.doc.lineAt(a),d=f.tof.from;a--)if(this.boundary.test(f.text[a-1-f.from])){m=a;break}for(;ub.push(N.range(S,C));if(f==d)for(this.regexp.lastIndex=m-f.from;(v=this.regexp.exec(f.text))&&v.indexthis.addMatch(C,e,S,w));t=t.update({filterFrom:m,filterTo:g,filter:(S,C)=>Sg,add:b})}}return t}}const jx=/x/.unicode!=null?"gu":"g",n_=new RegExp(`[\0-\b ---Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,jx),i_={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 c0=null;function r_(){var n;if(c0==null&&typeof document<"u"&&document.body){let e=document.body.style;c0=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return c0||!1}const nd=Ce.define({combine(n){let e=Pr(n,{render:null,specialChars:n_,addSpecialChars:null});return(e.replaceTabs=!r_())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,jx)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,jx)),e}});function l_(n={}){return[nd.of(n),s_()]}let BS=null;function s_(){return BS||(BS=en.fromClass(class{constructor(n){this.view=n,this.decorations=Fe.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(nd)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new t_({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:l}=t.state,o=hi(e[0],0);if(o==9){let a=l.lineAt(i),u=t.state.tabSize,f=ja(a.text,u,i-a.from);return Fe.replace({widget:new u_((u-f%u)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=Fe.replace({widget:new c_(n,o)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(nd);n.startState.facet(nd)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const o_="•";function a_(n){return n>=32?o_:n==10?"␤":String.fromCharCode(9216+n)}class c_ extends fl{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=a_(this.code),i=e.state.phrase("Control character")+" "+(i_[this.code]||"0x"+this.code.toString(16)),l=this.options.render&&this.options.render(this.code,i,t);if(l)return l;let o=document.createElement("span");return o.textContent=t,o.title=i,o.setAttribute("aria-label",i),o.className="cm-specialChar",o}ignoreEvent(){return!1}}class u_ extends fl{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function f_(){return d_}const h_=Fe.line({class:"cm-activeLine"}),d_=en.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let l=n.lineBlockAt(i.head);l.from>e&&(t.push(h_.range(l.from)),e=l.from)}return Fe.set(t)}},{decorations:n=>n.decorations}),_x=2e3;function m_(n,e,t){let i=Math.min(e.line,t.line),l=Math.max(e.line,t.line),o=[];if(e.off>_x||t.off>_x||e.col<0||t.col<0){let a=Math.min(e.off,t.off),u=Math.max(e.off,t.off);for(let f=i;f<=l;f++){let d=n.doc.line(f);d.length<=u&&o.push(oe.range(d.from+a,d.to+u))}}else{let a=Math.min(e.col,t.col),u=Math.max(e.col,t.col);for(let f=i;f<=l;f++){let d=n.doc.line(f),m=ux(d.text,a,n.tabSize,!0);if(m<0)o.push(oe.cursor(d.to));else{let g=ux(d.text,u,n.tabSize);o.push(oe.range(d.from+m,d.from+g))}}}return o}function p_(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function PS(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),l=t-i.from,o=l>_x?-1:l==i.length?p_(n,e.clientX):ja(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:o,off:l}}function g_(n,e){let t=PS(n,e),i=n.state.selection;return t?{update(l){if(l.docChanged){let o=l.changes.mapPos(l.startState.doc.line(t.line).from),a=l.state.doc.lineAt(o);t={line:a.number,col:t.col,off:Math.min(t.off,a.length)},i=i.map(l.changes)}},get(l,o,a){let u=PS(n,l);if(!u)return i;let f=m_(n.state,t,u);return f.length?a?oe.create(f.concat(i.ranges)):oe.create(f):i}}:null}function x_(n){let e=(t=>t.altKey&&t.button==0);return Oe.mouseSelectionStyle.of((t,i)=>e(i)?g_(t,i):null)}const y_={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},b_={style:"cursor: crosshair"};function v_(n={}){let[e,t]=y_[n.key||"Alt"],i=en.fromClass(class{constructor(l){this.view=l,this.isDown=!1}set(l){this.isDown!=l&&(this.isDown=l,this.view.update([]))}},{eventObservers:{keydown(l){this.set(l.keyCode==e||t(l))},keyup(l){(l.keyCode==e||!t(l))&&this.set(!1)},mousemove(l){this.set(t(l))}}});return[i,Oe.contentAttributes.of(l=>{var o;return!((o=l.plugin(i))===null||o===void 0)&&o.isDown?b_:null})]}const Oh="-10000px";class EN{constructor(e,t,i,l){this.facet=t,this.createTooltipView=i,this.removeTooltipView=l,this.input=e.state.facet(t),this.tooltips=this.input.filter(a=>a);let o=null;this.tooltipViews=this.tooltips.map(a=>o=i(a,o))}update(e,t){var i;let l=e.state.facet(this.facet),o=l.filter(f=>f);if(l===this.input){for(let f of this.tooltipViews)f.update&&f.update(e);return!1}let a=[],u=t?[]:null;for(let f=0;ft[d]=f),t.length=u.length),this.input=l,this.tooltips=o,this.tooltipViews=a,!0}}function MN(n){let e=n.dom.ownerDocument.documentElement,t=e.clientWidth,i=getComputedStyle(e);if(!/stable/.test(i.scrollbarGutter||""))return{left:0,right:t};let l=e.getBoundingClientRect(),o=n.win.scrollX;return{left:Math.max(0,l.left+o-parseFloat(i.marginLeft)),right:Math.min(t,l.right+o+parseFloat(i.marginRight))}}function w_(n){let{left:e,right:t}=MN(n);return{top:0,left:e,right:t,bottom:n.dom.ownerDocument.documentElement.clientHeight}}const u0=Ce.define({combine:n=>{var e,t,i;return{position:ke.ios?"absolute":((e=n.find(l=>l.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(l=>l.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(l=>l.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||w_}}}),HS=new WeakMap,zy=en.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(u0);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new EN(n,By,(t,i)=>this.createTooltip(t,i),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.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 n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(u0);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let l of this.manager.tooltipViews)l.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let l of this.manager.tooltipViews)this.container.appendChild(l.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),i=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let l=document.createElement("div");l.className="cm-tooltip-arrow",t.dom.appendChild(l)}return t.dom.style.position=this.position,t.dom.style.top=Oh,t.dom.style.left="0px",this.container.insertBefore(t.dom,i),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(n=i.destroy)===null||n===void 0||n.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1,i=0;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:a}=this.manager.tooltipViews[0];if(ke.safari){let u=a.getBoundingClientRect();t=Math.abs(u.top+1e4)>1||Math.abs(u.left)>1}else t=!!a.offsetParent&&a.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let a=this.parent.getBoundingClientRect();a.width&&a.height&&(n=a.width/this.parent.offsetWidth,e=a.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);else i=MN(this.view).left;let l=this.view.scrollDOM.getBoundingClientRect(),o=Ry(this.view);return{visible:{left:l.left+o.left,top:l.top+o.top,right:l.right-o.right,bottom:l.bottom-o.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((a,u)=>{let f=this.manager.tooltipViews[u];return f.getCoords?f.getCoords(a.pos):this.view.coordsAtPos(a.pos)}),size:this.manager.tooltipViews.map(({dom:a})=>a.getBoundingClientRect()),space:this.view.state.facet(u0).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t,fixedLeft:i}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let u of this.manager.tooltipViews)u.dom.style.position="absolute"}let{visible:t,space:i,scaleX:l,scaleY:o}=n,a=[];for(let u=0;u=Math.min(t.bottom,i.bottom)||g.rightMath.min(t.right,i.right)+.1)){m.style.top=Oh;continue}let v=f.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,w=v?7:0,S=b.right-b.left,C=(e=HS.get(d))!==null&&e!==void 0?e:b.bottom-b.top,N=d.offset||S_,j=this.view.textDirection==Tt.LTR,D=b.width>i.right-i.left?j?i.left:i.right-b.width:j?Math.max(i.left,Math.min(g.left-(v?14:0)+N.x,i.right-S)):Math.min(Math.max(i.left,g.left-S+(v?14:0)-N.x),i.right-S),I=this.above[u];!f.strictSide&&(I?g.top-C-w-N.yi.bottom)&&I==i.bottom-g.bottom>g.top-i.top&&(I=this.above[u]=!I);let U=(I?g.top-i.top:i.bottom-g.bottom)-w;if(UD&&z.topE&&(E=I?z.top-C-2-w:z.bottom+w+2);if(this.position=="absolute"?(m.style.top=(E-n.parent.top)/o+"px",IS(m,(D-n.parent.left)/l)):(m.style.top=E/o+"px",IS(m,(D-n.fixedLeft)/l)),v){let z=g.left+(j?N.x:-N.x)-(D+14-7);v.style.left=z/l+"px"}d.overlap!==!0&&a.push({left:D,top:E,right:T,bottom:E+C}),m.classList.toggle("cm-tooltip-above",I),m.classList.toggle("cm-tooltip-below",!I),d.positioned&&d.positioned(n.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 n of this.manager.tooltipViews)n.dom.style.top=Oh}},{eventObservers:{scroll(){this.maybeMeasure()}}});function IS(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const k_=Oe.baseTheme({".cm-tooltip":{zIndex:500,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"}}}),S_={x:0,y:0},By=Ce.define({enables:[zy,k_]}),wd=Ce.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class tm{static create(e){return new tm(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new EN(e,wd,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}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)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let l=i[e];if(l!==void 0){if(t===void 0)t=l;else if(t!==l)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const C_=By.compute([wd],n=>{let e=n.facet(wd);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:tm.create,above:e[0].above,arrow:e.some(t=>t.arrow)}}),DN=Ce.define();class O_{constructor(e,t,i,l,o,a){this.view=e,this.source=t,this.field=i,this.locked=l,this.setHover=o,this.hoverTime=a,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(e){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.length)return;let e=Date.now()-this.lastMove.time;ea.bottom||t.xa.right+e.defaultCharacterWidth)return;let u=e.bidiSpans(e.state.doc.lineAt(l)).find(d=>d.from<=l&&d.to>=l),f=u&&u.dir==Tt.RTL?-1:1;o=t.x{if(u&&!(Array.isArray(u)&&!u.length)){let f=Array.isArray(u)?u:[u];l&&this.locked.set(f,l),e.dispatch({effects:this.setHover.of(f)})}};if(o&&"then"in o){let u=this.pending={pos:t};o.then(f=>{this.pending==u&&(this.pending=null,a(f))},f=>pi(e.state,f,"hover tooltip"))}else a(o)}get tooltip(){let e=this.view.plugin(zy),t=e?e.manager.tooltips.findIndex(i=>i.create==tm.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;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{active:l,tooltip:o}=this;if(l.length&&!this.locked.has(l)&&o&&!N_(o.dom,e)||this.pending){let{pos:a}=l[0]||this.pending,u=(i=(t=l[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:a;(a==u?this.view.posAtCoords(this.lastMove)!=a:!T_(this.view,a,u,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t);let{active:l}=this;l.length&&!this.locked.has(l)&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Nh=4;function N_(n,e){let{left:t,right:i,top:l,bottom:o}=n.getBoundingClientRect(),a;if(a=n.querySelector(".cm-tooltip-arrow")){let u=a.getBoundingClientRect();l=Math.min(u.top,l),o=Math.max(u.bottom,o)}return e.clientX>=t-Nh&&e.clientX<=i+Nh&&e.clientY>=l-Nh&&e.clientY<=o+Nh}function T_(n,e,t,i,l,o){let a=n.scrollDOM.getBoundingClientRect(),u=n.documentTop+n.documentPadding.top+n.contentHeight;if(a.left>i||a.rightl||Math.min(a.bottom,u)=e&&f<=t}function A_(n,e={}){let t=Ke.define(),i=new WeakMap,l=Fn.define({create(){return[]},update(a,u){let f=i.get(a);if(a.length&&(e.hideOnChange&&(u.docChanged||u.selection)?a=[]:f&&f(u)?a=[]:e.hideOn&&(a=a.filter(d=>!e.hideOn(u,d)))),u.docChanged&&a.length){let d=[];for(let m of a){let g=u.changes.mapPos(m.pos,-1,Zn.TrackDel);if(g!=null){let b=Object.assign(Object.create(null),m);b.pos=g,b.end!=null&&(b.end=u.changes.mapPos(b.end)),d.push(b)}}a=d}for(let d of u.effects)d.is(t)&&(a=d.value,f=void 0),(d.is(M_)&&!d.value||d.value==l)&&(a=[]);return a.length&&f&&i.set(a,f),a},provide:a=>wd.from(a)});const o=en.define(a=>new O_(a,n,l,i,t,e.hoverTime||300));return{active:l,extension:[l,o,DN.of(o),C_]}}function E_(n,e,t,i={}){var l;let o=n.state.facet(DN).map(a=>n.plugin(a)).filter(a=>!!a);if(i.tooltip&&i.tooltip.active){let a=o.find(u=>u.field==i.tooltip.active);a&&(o=[a])}for(let a of o)a.activateHover(n,e,t,(l=i.until)!==null&&l!==void 0?l:(()=>!1))}function RN(n,e){let t=n.plugin(zy);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const M_=Ke.define(),US=Ce.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function nm(n,e){let t=n.plugin(jN),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const jN=en.fromClass(class{constructor(n){this.input=n.state.facet(mu),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(US);this.top=new Th(n,!0,e.topContainer),this.bottom=new Th(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(US);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Th(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Th(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(mu);if(t!=this.input){let i=t.filter(f=>f),l=[],o=[],a=[],u=[];for(let f of i){let d=this.specs.indexOf(f),m;d<0?(m=f(n.view),u.push(m)):(m=this.panels[d],m.update&&m.update(n)),l.push(m),(m.top?o:a).push(m)}this.specs=i,this.panels=l,this.top.sync(o),this.bottom.sync(a);for(let f of u)f.dom.classList.add("cm-panel"),f.mount&&f.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>Oe.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Th{constructor(e,t,i){this.view=e,this.top=t,this.container=i,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(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=FS(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=FS(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 FS(n){let e=n.nextSibling;return n.remove(),e}const mu=Ce.define({enables:jN});function D_(n,e){let t,i=new Promise(a=>t=a),l=a=>j_(a,e,t);n.state.field(id,!1)?n.dispatch({effects:_N.of(l)}):n.dispatch({effects:Ke.appendConfig.of(id.init(()=>[l]))});let o=LN.of(l);return{close:o,result:i.then(a=>((n.win.queueMicrotask||(f=>n.win.setTimeout(f,10)))(()=>{n.state.field(id).indexOf(l)>-1&&n.dispatch({effects:o})}),a))}}function R_(n,e){let t=n.state.field(id,!1)||[];for(let i of t){let l=nm(n,i);if(l&&l.dom.classList.contains(e))return l}return null}const id=Fn.define({create(){return[]},update(n,e){for(let t of e.effects)t.is(_N)?n=[t.value].concat(n):t.is(LN)&&(n=n.filter(i=>i!=t.value));return n},provide:n=>mu.computeN([n],e=>e.field(n))}),_N=Ke.define(),LN=Ke.define();function j_(n,e,t){let i=e.content?e.content(n,()=>u(null)):null;if(!i){if(i=Nt("form"),e.input){let f=Nt("input",e.input);/^(text|password|number|email|tel|url)$/.test(f.type)&&f.classList.add("cm-textfield"),f.name||(f.name="input"),i.appendChild(Nt("label",(e.label||"")+": ",f))}else i.appendChild(document.createTextNode(e.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild(Nt("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let l=i.nodeName=="FORM"?[i]:i.querySelectorAll("form");for(let f=0;f{m.keyCode==27?(m.preventDefault(),u(null)):m.keyCode==13&&(m.preventDefault(),u(d))}),d.addEventListener("submit",m=>{m.preventDefault(),u(d)})}let o=Nt("div",i,Nt("button",{onclick:()=>u(null),"aria-label":n.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(o.className=e.class),o.classList.add("cm-dialog");let a=typeof e.focus=="string"?i.querySelector(e.focus):e.focus?i.querySelector("input")||i.querySelector("button"):null;function u(f){o.contains(o.ownerDocument.activeElement)&&n.focus(),t(f)}return{dom:o,top:e.top,mount:()=>{a&&("select"in a?a.select():"focus"in a&&a.focus())},destroy:()=>t(null)}}class al extends is{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}al.prototype.elementClass="";al.prototype.toDOM=void 0;al.prototype.mapMode=Zn.TrackBefore;al.prototype.startSide=al.prototype.endSide=-1;al.prototype.point=!0;const rd=Ce.define(),__=Ce.define(),L_={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>st.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},tu=Ce.define();function z_(n){return[zN(),tu.of({...L_,...n})]}const qS=Ce.define({combine:n=>n.some(e=>e)});function zN(n){return[B_]}const B_=en.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(tu).map(e=>new QS(n,e)),this.fixed=!n.state.facet(qS);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}if(n.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(qS)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=st.iter(this.view.state.facet(rd),this.view.viewport.from),i=[],l=this.gutters.map(o=>new P_(o,this.view.viewport,-this.view.documentPadding.top));for(let o of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(o.type)){let a=!0;for(let u of o.type)if(u.type==Bn.Text&&a){Lx(t,i,u.from);for(let f of l)f.line(this.view,u,i);a=!1}else if(u.widget)for(let f of l)f.widget(this.view,u)}else if(o.type==Bn.Text){Lx(t,i,o.from);for(let a of l)a.line(this.view,o,i)}else if(o.widget)for(let a of l)a.widget(this.view,o);for(let o of l)o.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(tu),t=n.state.facet(tu),i=n.docChanged||n.heightChanged||n.viewportChanged||!st.eq(n.startState.facet(rd),n.state.facet(rd),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let l of this.gutters)l.update(n)&&(i=!0);else{i=!0;let l=[];for(let o of t){let a=e.indexOf(o);a<0?l.push(new QS(this.view,o)):(this.gutters[a].update(n),l.push(this.gutters[a]))}for(let o of this.gutters)o.dom.remove(),l.indexOf(o)<0&&o.destroy();for(let o of l)o.config.side=="after"?this.getDOMAfter().appendChild(o.dom):this.dom.appendChild(o.dom);this.gutters=l}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>Oe.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let i=t.dom.offsetWidth*e.scaleX,l=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==Tt.LTR?{left:i,right:l}:{right:i,left:l}})});function VS(n){return Array.isArray(n)?n:[n]}function Lx(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class P_{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=st.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:l}=this,o=(t.top-this.height)/e.scaleY,a=t.height/e.scaleY;if(this.i==l.elements.length){let u=new BN(e,a,o,i);l.elements.push(u),l.dom.appendChild(u.dom)}else l.elements[this.i].update(e,a,o,i);this.height=t.bottom,this.i++}line(e,t,i){let l=[];Lx(this.cursor,l,t.from),i.length&&(l=l.concat(i));let o=this.gutter.config.lineMarker(e,t,l);o&&l.unshift(o);let a=this.gutter;l.length==0&&!a.config.renderEmptyElements||this.addElement(e,t,l)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),l=i?[i]:null;for(let o of e.state.facet(__)){let a=o(e,t.widget,t);a&&(l||(l=[])).push(a)}l&&this.addElement(e,t,l)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class QS{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 i in t.domEventHandlers)this.dom.addEventListener(i,l=>{let o=l.target,a;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let f=o.getBoundingClientRect();a=(f.top+f.bottom)/2}else a=l.clientY;let u=e.lineBlockAtHeight(a-e.documentTop);t.domEventHandlers[i](e,u,l)&&l.preventDefault()});this.markers=VS(t.markers(e)),t.initialSpacer&&(this.spacer=new BN(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=VS(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let l=this.config.updateSpacer(this.spacer.markers[0],e);l!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[l])}let i=e.view.viewport;return!st.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class BN{constructor(e,t,i,l){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,l)}update(e,t,i,l){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),H_(this.markers,l)||this.setMarkers(e,l)}setMarkers(e,t){let i="cm-gutterElement",l=this.dom.firstChild;for(let o=0,a=0;;){let u=a,f=oo(u,f,d)||a(u,f,d):a}return i}})}});class f0 extends al{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function h0(n,e){return n.state.facet(ua).formatNumber(e,n.state)}const F_=tu.compute([ua],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(I_)},lineMarker(e,t,i){return i.some(l=>l.toDOM)?null:new f0(h0(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let l of e.state.facet(U_)){let o=l(e,t,i);if(o)return o}return null},lineMarkerChange:e=>e.startState.facet(ua)!=e.state.facet(ua),initialSpacer(e){return new f0(h0(e,XS(e.state.doc.lines)))},updateSpacer(e,t){let i=h0(t.view,XS(t.view.state.doc.lines));return i==e.number?e:new f0(i)},domEventHandlers:n.facet(ua).domEventHandlers,side:"before"}));function q_(n={}){return[ua.of(n),zN(),F_]}function XS(n){let e=9;for(;e{let e=[],t=-1;for(let i of n.selection.ranges){let l=n.doc.lineAt(i.head).from;l>t&&(t=l,e.push(V_.range(l)))}return st.of(e)});function X_(){return Q_}const PN=1024;let $_=0;class d0{constructor(e,t){this.from=e,this.to=t}}class tt{constructor(e={}){this.id=$_++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=xi.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}tt.closedBy=new tt({deserialize:n=>n.split(" ")});tt.openedBy=new tt({deserialize:n=>n.split(" ")});tt.group=new tt({deserialize:n=>n.split(" ")});tt.isolate=new tt({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});tt.contextHash=new tt({perNode:!0});tt.lookAhead=new tt({perNode:!0});tt.mounted=new tt({perNode:!0});class nu{constructor(e,t,i,l=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=l}static get(e){return e&&e.props&&e.props[tt.mounted.id]}}const Y_=Object.create(null);class xi{constructor(e,t,i,l=0){this.name=e,this.props=t,this.id=i,this.flags=l}static define(e){let t=e.props&&e.props.length?Object.create(null):Y_,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new xi(e.name||"",t,e.id,i);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(l)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[o[0].id]=o[1]}}return l}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(tt.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let l of i.split(" "))t[l]=e[i];return i=>{for(let l=i.prop(tt.group),o=-1;o<(l?l.length:0);o++){let a=t[o<0?i.name:l[o]];if(a)return a}}}}xi.none=new xi("",Object.create(null),0,8);class Py{constructor(e){this.types=e;for(let t=0;t0;for(let f=this.cursor(a|Yt.IncludeAnonymous);;){let d=!1;if(f.from<=o&&f.to>=l&&(!u&&f.type.isAnonymous||t(f)!==!1)){if(f.firstChild())continue;d=!0}for(;d&&i&&(u||!f.type.isAnonymous)&&i(f),!f.nextSibling();){if(!f.parent())return;d=!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:Uy(xi.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,l)=>new fn(this.type,t,i,l,this.propValues),e.makeTree||((t,i,l)=>new fn(xi.none,t,i,l)))}static build(e){return Z_(e)}}fn.empty=new fn(xi.none,[],[],0);class Hy{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 Hy(this.buffer,this.index)}}class os{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return xi.none}toString(){let e=[];for(let t=0;t0));f=a[f+3]);return u}slice(e,t,i){let l=this.buffer,o=new Uint16Array(t-e),a=0;for(let u=e,f=0;u=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function pu(n,e,t,i){for(var l;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?u.length:-1;e!=d;e+=t){let m=u[e],g=f[e]+a.from,b;if(!(!(o&Yt.EnterBracketed&&m instanceof fn&&(b=nu.get(m))&&!b.overlay&&b.bracketed&&i>=g&&i<=g+m.length)&&!HN(l,i,g,g+m.length))){if(m instanceof os){if(o&Yt.ExcludeBuffers)continue;let v=m.findChild(0,m.buffer.length,t,i-g,l);if(v>-1)return new Zl(new G_(a,m,e,g),null,v)}else if(o&Yt.IncludeAnonymous||!m.type.isAnonymous||Iy(m)){let v;if(!(o&Yt.IgnoreMounts)&&(v=nu.get(m))&&!v.overlay)return new Qi(v.tree,g,e,a);let w=new Qi(m,g,e,a);return o&Yt.IncludeAnonymous||!w.type.isAnonymous?w:w.nextChild(t<0?m.children.length-1:0,t,i,l,o)}}}if(o&Yt.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+t:e=t<0?-1:a._parent._tree.children.length,a=a._parent,!a))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)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let l;if(!(i&Yt.IgnoreOverlays)&&(l=nu.get(this._tree))&&l.overlay){let o=e-this.from,a=i&Yt.EnterBracketed&&l.bracketed;for(let{from:u,to:f}of l.overlay)if((t>0||a?u<=o:u=o:f>o))return new Qi(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}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 YS(n,e,t,i){let l=n.cursor(),o=[];if(!l.firstChild())return o;if(t!=null){for(let a=!1;!a;)if(a=l.type.is(t),!l.nextSibling())return o}for(;;){if(i!=null&&l.type.is(i))return o;if(l.type.is(e)&&o.push(l.node),!l.nextSibling())return i==null?o:[]}}function zx(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class G_{constructor(e,t,i,l){this.parent=e,this.buffer=t,this.index=i,this.start=l}}class Zl extends IN{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,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.context.start,i);return o<0?null:new Zl(this.context,this,o)}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)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&Yt.ExcludeBuffers)return null;let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return o<0?null:new Zl(this.context,this,o)}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 Zl(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 Zl(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,l=this.index+4,o=i.buffer[this.index+3];if(o>l){let a=i.buffer[this.index+1];e.push(i.slice(l,o,a)),t.push(0)}return new fn(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function UN(n){if(!n.length)return null;let e=0,t=n[0];for(let o=1;ot.from||a.to=e){let u=new Qi(a.tree,a.overlay[0].from+o.from,-1,o);(l||(l=[i])).push(pu(u,e,t,!1))}}return l?UN(l):i}class Bx{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~Yt.EnterBracketed,e instanceof Qi)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:l}=this.buffer;return this.type=t||l.set.types[l.buffer[e]],this.from=i+l.buffer[e+1],this.to=i+l.buffer[e+2],!0}yield(e){return e?e instanceof Qi?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:l}=this.buffer,o=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.buffer.start,i);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&Yt.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Yt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Yt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let l=i<0?0:this.stack[i]+4;if(this.index!=l)return this.yieldBuf(t.findChild(l,this.index,-1,0,4))}else{let l=t.buffer[this.index+3];if(l<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(l)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:l}=this;if(l){if(e>0){if(this.index-1)for(let o=t+e,a=e<0?-1:i._tree.children.length;o!=a;o+=e){let u=i._tree.children[o];if(this.mode&Yt.IncludeAnonymous||u instanceof os||!u.type.isAnonymous||Iy(u))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 a=e;a;a=a._parent)if(a.index==l){if(l==this.index)return a;t=a,i=o+1;break e}l=this.stack[--o]}for(let l=i;l=0;o--){if(o<0)return zx(this._tree,e,l);let a=i[t.buffer[this.stack[o]]];if(!a.isAnonymous){if(e[l]&&e[l]!=a.name)return!1;l--}}return!0}}function Iy(n){return n.children.some(e=>e instanceof os||!e.type.isAnonymous||Iy(e))}function Z_(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:l=PN,reused:o=[],minRepeatType:a=i.types.length}=n,u=Array.isArray(t)?new Hy(t,t.length):t,f=i.types,d=0,m=0;function g(U,E,T,z,te,q){let{id:G,start:F,end:se,size:me}=u,ne=m,_=d;if(me<0)if(u.next(),me==-1){let Be=o[G];T.push(Be),z.push(F-U);return}else if(me==-3){d=G;return}else if(me==-4){m=G;return}else throw new RangeError(`Unrecognized record size: ${me}`);let Z=f[G],ie,re,A=F-U;if(se-F<=l&&(re=C(u.pos-E,te))){let Be=new Uint16Array(re.size-re.skip),ze=u.pos-re.size,B=Be.length;for(;u.pos>ze;)B=N(re.start,Be,B);ie=new os(Be,se-re.start,i),A=re.start-U}else{let Be=u.pos-me;u.next();let ze=[],B=[],R=G>=a?G:-1,$=0,ue=se,ge=ne;for(;u.pos>Be;)R>=0&&u.id==R&&u.size>=0?(u.end<=ue-l&&(w(ze,B,F,$,u.end,ue,R,ge,_),$=ze.length,ue=u.end,ge=m),u.next()):q>2500?b(F,Be,ze,B):(R>=0&&u.size==-1&&o[u.id].type==i.types[R]&&($=0&&$>0&&$-1&&$>0){let je=v(Z,_);ie=Uy(Z,ze,B,0,ze.length,0,se-F,je,je)}else ie=S(Z,ze,B,se-F,ne-se,_)}T.push(ie),z.push(A)}function b(U,E,T,z){let te=[],q=0,G=-1;for(;u.pos>E;){let{id:F,start:se,end:me,size:ne}=u;if(ne>4)u.next();else{if(G>-1&&se=0;me-=3)F[ne++]=te[me],F[ne++]=te[me+1]-se,F[ne++]=te[me+2]-se,F[ne++]=ne;T.push(new os(F,te[2]-se,i)),z.push(se-U)}}function v(U,E){return(T,z,te)=>{let q=0,G=T.length-1,F,se;if(G>=0&&(F=T[G])instanceof fn){if(!G&&F.type==U&&F.length==te)return F;(se=F.prop(tt.lookAhead))&&(q=z[G]+F.length+se-te)}return S(U,T,z,te,q,E)}}function w(U,E,T,z,te,q,G,F,se){let me=[],ne=[];for(;U.length>z;)me.push(U.pop()),ne.push(E.pop()+T-te);U.push(S(i.types[G],me,ne,q-te,F-q,se)),E.push(te-T)}function S(U,E,T,z,te,q,G){if(q){let F=[tt.contextHash,q];G=G?[F].concat(G):[F]}if(te>25){let F=[tt.lookAhead,te];G=G?[F].concat(G):[F]}return new fn(U,E,T,z,G)}function C(U,E){let T=u.fork(),z=0,te=0,q=0,G=T.end-l,F={size:0,start:0,skip:0};e:for(let se=T.pos-U;T.pos>se;){let me=T.size;if(T.id==E&&me>=0){F.size=z,F.start=te,F.skip=q,q+=4,z+=4,T.next();continue}let ne=T.pos-me;if(me<0||ne=a?4:0,Z=T.start;for(T.next();T.pos>ne;){if(T.size<0)if(T.size==-3||T.size==-4)_+=4;else break e;else T.id>=a&&(_+=4);T.next()}te=Z,z+=me,q+=_}return(E<0||z==U)&&(F.size=z,F.start=te,F.skip=q),F.size>4?F:void 0}function N(U,E,T){let{id:z,start:te,end:q,size:G}=u;if(u.next(),G>=0&&z4){let se=u.pos-(G-4);for(;u.pos>se;)T=N(U,E,T)}E[--T]=F,E[--T]=q-U,E[--T]=te-U,E[--T]=z}else G==-3?d=z:G==-4&&(m=z);return T}let j=[],D=[];for(;u.pos>0;)g(n.start||0,n.bufferStart||0,j,D,-1,0);let I=(e=n.length)!==null&&e!==void 0?e:j.length?D[0]+j[0].length:0;return new fn(f[n.topID],j.reverse(),D.reverse(),I)}const GS=new WeakMap;function ld(n,e){if(!n.isAnonymous||e instanceof os||e.type!=n)return 1;let t=GS.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof fn)){t=1;break}t+=ld(n,i)}GS.set(e,t)}return t}function Uy(n,e,t,i,l,o,a,u,f){let d=0;for(let w=i;w=m)break;E+=T}if(D==I+1){if(E>m){let T=w[I];v(T.children,T.positions,0,T.children.length,S[I]+j);continue}g.push(w[I])}else{let T=S[D-1]+w[D-1].length-U;g.push(Uy(n,w,S,I,D,U,T,null,f))}b.push(U+j-o)}}return v(e,t,i,l,0),(u||f)(g,b,a)}class to{constructor(e,t,i,l,o=!1,a=!1){this.from=e,this.to=t,this.tree=i,this.offset=l,this.open=(o?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let l=[new to(0,e.length,e,0,!1,i)];for(let o of t)o.to>e.length&&l.push(o);return l}static applyChanges(e,t,i=128){if(!t.length)return e;let l=[],o=1,a=e.length?e[0]:null;for(let u=0,f=0,d=0;;u++){let m=u=i)for(;a&&a.from=b.from||g<=b.to||d){let v=Math.max(b.from,f)-d,w=Math.min(b.to,g)-d;b=v>=w?null:new to(v,w,b.tree,b.offset+d,u>0,!!m)}if(b&&l.push(b),a.to>g)break;a=onew d0(l.from,l.to)):[new d0(0,0)]:[new d0(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let l=this.startParse(e,t,i);for(;;){let o=l.advance();if(o)return o}}}class J_{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 tt({perNode:!0});let eL=0,nl=class Px{constructor(e,t,i,l){this.name=e,this.set=t,this.base=i,this.modified=l,this.id=eL++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof Px&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let l=new Px(i,[],null,[]);if(l.set.push(l),t)for(let o of t.set)l.set.push(o);return l}static defineModifier(e){let t=new kd(e);return i=>i.modified.indexOf(t)>-1?i:kd.get(i.base||i,i.modified.concat(t).sort((l,o)=>l.id-o.id))}},tL=0;class kd{constructor(e){this.name=e,this.instances=[],this.id=tL++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(u=>u.base==e&&nL(t,u.modified));if(i)return i;let l=[],o=new nl(e.name,l,e,t);for(let u of t)u.instances.push(o);let a=iL(t);for(let u of e.set)if(!u.modified.length)for(let f of a)l.push(kd.get(u,f));return o}}function nL(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function iL(n){let e=[[]];for(let t=0;ti.length-t.length)}function qN(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let l of t.split(" "))if(l){let o=[],a=2,u=l;for(let g=0;;){if(u=="..."&&g>0&&g+3==l.length){a=1;break}let b=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(u);if(!b)throw new RangeError("Invalid path: "+l);if(o.push(b[0]=="*"?"":b[0][0]=='"'?JSON.parse(b[0]):b[0]),g+=b[0].length,g==l.length)break;let v=l[g++];if(g==l.length&&v=="!"){a=0;break}if(v!="/")throw new RangeError("Invalid path: "+l);u=l.slice(g)}let f=o.length-1,d=o[f];if(!d)throw new RangeError("Invalid path: "+l);let m=new gu(i,a,f>0?o.slice(0,f):null);e[d]=m.sort(e[d])}}return VN.add(e)}const VN=new tt({combine(n,e){let t,i,l;for(;n||e;){if(!n||e&&n.depth<=e.depth?(l=e,e=e.next):(l=n,n=n.next),t&&t.mode==l.mode&&!l.context&&!t.context)continue;let o=new gu(l.tags,l.mode,l.context);t?t.next=o:i=o,t=o}return i}});class gu{constructor(e,t,i,l){this.tags=e,this.mode=t,this.context=i,this.next=l}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let a=l;for(let u of o)for(let f of u.set){let d=t[f.id];if(d){a=a?a+" "+d:d;break}}return a},scope:i}}function rL(n,e){let t=null;for(let i of n){let l=i.style(e);l&&(t=t?t+" "+l:l)}return t}function lL(n,e,t,i=0,l=n.length){let o=new sL(i,Array.isArray(e)?e:[e],t);o.highlightRange(n.cursor(),i,l,"",o.highlighters),o.flush(l)}class sL{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,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,i,l,o){let{type:a,from:u,to:f}=e;if(u>=i||f<=t)return;a.isTop&&(o=this.highlighters.filter(v=>!v.scope||v.scope(a)));let d=l,m=oL(e)||gu.empty,g=rL(o,m.tags);if(g&&(d&&(d+=" "),d+=g,m.mode==1&&(l+=(l?" ":"")+g)),this.startSpan(Math.max(t,u),d),m.opaque)return;let b=e.tree&&e.tree.prop(tt.mounted);if(b&&b.overlay){let v=e.node.enter(b.overlay[0].from+u,1),w=this.highlighters.filter(C=>!C.scope||C.scope(b.tree.type)),S=e.firstChild();for(let C=0,N=u;;C++){let j=C=D||!e.nextSibling())););if(!j||D>i)break;N=j.to+u,N>t&&(this.highlightRange(v.cursor(),Math.max(t,j.from+u),Math.min(i,N),"",w),this.startSpan(Math.min(i,N),d))}S&&e.parent()}else if(e.firstChild()){b&&(l="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,l,o),this.startSpan(Math.min(i,e.to),d)}while(e.nextSibling());e.parent()}}}function oL(n){let e=n.type.prop(VN);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const we=nl.define,Eh=we(),$l=we(),KS=we($l),WS=we($l),Yl=we(),Mh=we(Yl),m0=we(Yl),Nr=we(),Fs=we(Nr),Cr=we(),Or=we(),Hx=we(),Pc=we(Hx),Dh=we(),he={comment:Eh,lineComment:we(Eh),blockComment:we(Eh),docComment:we(Eh),name:$l,variableName:we($l),typeName:KS,tagName:we(KS),propertyName:WS,attributeName:we(WS),className:we($l),labelName:we($l),namespace:we($l),macroName:we($l),literal:Yl,string:Mh,docString:we(Mh),character:we(Mh),attributeValue:we(Mh),number:m0,integer:we(m0),float:we(m0),bool:we(Yl),regexp:we(Yl),escape:we(Yl),color:we(Yl),url:we(Yl),keyword:Cr,self:we(Cr),null:we(Cr),atom:we(Cr),unit:we(Cr),modifier:we(Cr),operatorKeyword:we(Cr),controlKeyword:we(Cr),definitionKeyword:we(Cr),moduleKeyword:we(Cr),operator:Or,derefOperator:we(Or),arithmeticOperator:we(Or),logicOperator:we(Or),bitwiseOperator:we(Or),compareOperator:we(Or),updateOperator:we(Or),definitionOperator:we(Or),typeOperator:we(Or),controlOperator:we(Or),punctuation:Hx,separator:we(Hx),bracket:Pc,angleBracket:we(Pc),squareBracket:we(Pc),paren:we(Pc),brace:we(Pc),content:Nr,heading:Fs,heading1:we(Fs),heading2:we(Fs),heading3:we(Fs),heading4:we(Fs),heading5:we(Fs),heading6:we(Fs),contentSeparator:we(Nr),list:we(Nr),quote:we(Nr),emphasis:we(Nr),strong:we(Nr),link:we(Nr),monospace:we(Nr),strikethrough:we(Nr),inserted:we(),deleted:we(),changed:we(),invalid:we(),meta:Dh,documentMeta:we(Dh),annotation:we(Dh),processingInstruction:we(Dh),definition:nl.defineModifier("definition"),constant:nl.defineModifier("constant"),function:nl.defineModifier("function"),standard:nl.defineModifier("standard"),local:nl.defineModifier("local"),special:nl.defineModifier("special")};for(let n in he){let e=he[n];e instanceof nl&&(e.name=n)}QN([{tag:he.link,class:"tok-link"},{tag:he.heading,class:"tok-heading"},{tag:he.emphasis,class:"tok-emphasis"},{tag:he.strong,class:"tok-strong"},{tag:he.keyword,class:"tok-keyword"},{tag:he.atom,class:"tok-atom"},{tag:he.bool,class:"tok-bool"},{tag:he.url,class:"tok-url"},{tag:he.labelName,class:"tok-labelName"},{tag:he.inserted,class:"tok-inserted"},{tag:he.deleted,class:"tok-deleted"},{tag:he.literal,class:"tok-literal"},{tag:he.string,class:"tok-string"},{tag:he.number,class:"tok-number"},{tag:[he.regexp,he.escape,he.special(he.string)],class:"tok-string2"},{tag:he.variableName,class:"tok-variableName"},{tag:he.local(he.variableName),class:"tok-variableName tok-local"},{tag:he.definition(he.variableName),class:"tok-variableName tok-definition"},{tag:he.special(he.variableName),class:"tok-variableName2"},{tag:he.definition(he.propertyName),class:"tok-propertyName tok-definition"},{tag:he.typeName,class:"tok-typeName"},{tag:he.namespace,class:"tok-namespace"},{tag:he.className,class:"tok-className"},{tag:he.macroName,class:"tok-macroName"},{tag:he.propertyName,class:"tok-propertyName"},{tag:he.operator,class:"tok-operator"},{tag:he.comment,class:"tok-comment"},{tag:he.meta,class:"tok-meta"},{tag:he.invalid,class:"tok-invalid"},{tag:he.punctuation,class:"tok-punctuation"}]);var p0;const fa=new tt;function aL(n){return Ce.define({combine:n?e=>e.concat(n):void 0})}const cL=new tt;class ir{constructor(e,t,i=[],l=""){this.data=e,this.name=l,gt.prototype.hasOwnProperty("tree")||Object.defineProperty(gt.prototype,"tree",{get(){return Un(this)}}),this.parser=t,this.extension=[as.of(this),gt.languageData.of((o,a,u)=>{let f=ZS(o,a,u),d=f.type.prop(fa);if(!d)return[];let m=o.facet(d),g=f.type.prop(cL);if(g){let b=f.resolve(a-f.from,u);for(let v of g)if(v.test(b,o)){let w=o.facet(v.facet);return v.type=="replace"?w:w.concat(m)}}return m})].concat(i)}isActiveAt(e,t,i=-1){return ZS(e,t,i).type.prop(fa)==this.data}findRegions(e){let t=e.facet(as);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],l=(o,a)=>{if(o.prop(fa)==this.data){i.push({from:a,to:a+o.length});return}let u=o.prop(tt.mounted);if(u){if(u.tree.prop(fa)==this.data){if(u.overlay)for(let f of u.overlay)i.push({from:f.from+a,to:f.to+a});else i.push({from:a,to:a+o.length});return}else if(u.overlay){let f=i.length;if(l(u.tree,u.overlay[0].from+a),i.length>f)return}}for(let f=0;fi.isTop?t:void 0)]}),e.name)}configure(e,t){return new Sd(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Un(n){let e=n.field(ir.state,!1);return e?e.tree:fn.empty}class uL{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 i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let Hc=null;class Cd{constructor(e,t,i=[],l,o,a,u,f){this.parser=e,this.state=t,this.fragments=i,this.tree=l,this.treeLen=o,this.viewport=a,this.skipped=u,this.scheduleOn=f,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Cd(e,t,[],fn.empty,0,i,[],null)}startParse(){return this.parser.startParse(new uL(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=fn.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let l=Date.now()+e;e=()=>Date.now()>l}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||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(to.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Hc;Hc=this;try{return e()}finally{Hc=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=JS(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:l,treeLen:o,viewport:a,skipped:u}=this;if(this.takeTree(),!e.empty){let f=[];if(e.iterChangedRanges((d,m,g,b)=>f.push({fromA:d,toA:m,fromB:g,toB:b})),i=to.applyChanges(i,f),l=fn.empty,o=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){u=[];for(let d of this.skipped){let m=e.mapPos(d.from,1),g=e.mapPos(d.to,-1);me.from&&(this.fragments=JS(this.fragments,l,o),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(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 FN{createParse(t,i,l){let o=l[0].from,a=l[l.length-1].to;return{parsedPos:o,advance(){let f=Hc;if(f){for(let d of l)f.tempSkipped.push(d);e&&(f.scheduleOn=f.scheduleOn?Promise.all([f.scheduleOn,e]):e)}return this.parsedPos=a,new fn(xi.none,[],[],a-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Hc}}function JS(n,e,t){return to.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class Ma{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),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new Ma(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Cd.create(e.facet(as).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Ma(i)}}ir.state=Fn.define({create:Ma.init,update(n,e){for(let t of e.effects)if(t.is(ir.setState))return t.value;return e.startState.facet(as)!=e.state.facet(as)?Ma.init(e.state):n.apply(e)}});let XN=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(XN=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const g0=typeof navigator<"u"&&(!((p0=navigator.scheduling)===null||p0===void 0)&&p0.isInputPending)?()=>navigator.scheduling.isInputPending():null,fL=en.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(ir.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(ir.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=XN(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndl+1e3,f=o.context.work(()=>g0&&g0()||Date.now()>a,l+(u?0:1e5));this.chunkBudget-=Date.now()-t,(f||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:ir.setState.of(new Ma(o.context))})),this.chunkBudget>0&&!(f&&!u)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>pi(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),as=Ce.define({combine(n){return n.length?n[0]:null},enables:n=>[ir.state,fL,Oe.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class hL{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const dL=Ce.define(),Fy=Ce.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Od(n){let e=n.facet(Fy);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function xu(n,e){let t="",i=n.tabSize,l=n.facet(Fy)[0];if(l==" "){for(;e>=i;)t+=" ",e-=i;l=" "}for(let o=0;o=e?mL(n,t,e):null}class im{constructor(e,t={}){this.state=e,this.options=t,this.unit=Od(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:l,simulateDoubleBreak:o}=this.options;return l!=null&&l>=i.from&&l<=i.to?o&&l==e?{text:"",from:e}:(t<0?l-1&&(o+=a-this.countColumn(i,i.search(/\S|$/))),o}countColumn(e,t=e.length){return ja(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:l}=this.lineAt(e,t),o=this.options.overrideIndentation;if(o){let a=o(l);if(a>-1)return a}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const $N=new tt;function mL(n,e,t){let i=e.resolveStack(t),l=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(l!=i.node){let o=[];for(let a=l;a&&!(a.fromi.node.to||a.from==i.node.from&&a.type==i.node.type);a=a.parent)o.push(a);for(let a=o.length-1;a>=0;a--)i={node:o[a],next:i}}return YN(i,n,t)}function YN(n,e,t){for(let i=n;i;i=i.next){let l=gL(i.node);if(l)return l(Vy.create(e,t,i))}return 0}function pL(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function gL(n){let e=n.type.prop($N);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(tt.closedBy))){let l=n.lastChild,o=l&&i.indexOf(l.name)>-1;return a=>GN(a,!0,1,void 0,o&&!pL(a)?l.from:void 0)}return n.parent==null?xL:null}function xL(){return 0}class Vy extends im{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new Vy(e,t,i)}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 i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(yL(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return YN(this.context.next,this.base,this.pos)}}function yL(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function bL(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let l=n.options.simulateBreak,o=n.state.doc.lineAt(t.from),a=l==null||l<=o.from?o.to:Math.min(o.to,l);for(let u=t.to;;){let f=e.childAfter(u);if(!f||f==i)return null;if(!f.type.isSkipped){if(f.from>=a)return null;let d=/^ */.exec(o.text.slice(t.to-o.from))[0].length;return{from:t.from,to:t.to+d}}u=f.to}}function e2({closing:n,align:e=!0,units:t=1}){return i=>GN(i,e,t,n)}function GN(n,e,t,i,l){let o=n.textAfter,a=o.match(/^\s*/)[0].length,u=i&&o.slice(a,a+i.length)==i||l==n.pos+a,f=e?bL(n):null;return f?u?n.column(f.from):n.column(f.to):n.baseIndent+(u?0:n.unit*t)}const vL=200;function wL(){return gt.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,l=t.lineAt(i);if(i>l.from+vL)return n;let o=t.sliceString(l.from,i);if(!e.some(d=>d.test(o)))return n;let{state:a}=n,u=-1,f=[];for(let{head:d}of a.selection.ranges){let m=a.doc.lineAt(d);if(m.from==u)continue;u=m.from;let g=qy(a,m.from);if(g==null)continue;let b=/^\s*/.exec(m.text)[0],v=xu(a,g);b!=v&&f.push({from:m.from,to:m.from+b.length,insert:v})}return f.length?[n,{changes:f,sequential:!0}]:n})}const kL=Ce.define(),KN=new tt;function SL(n){let e=n.firstChild,t=n.lastChild;return e&&e.tot)continue;if(o&&u.from=e&&d.to>t&&(o=d)}}return o}function OL(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function Nd(n,e,t){for(let i of n.facet(kL)){let l=i(n,e,t);if(l)return l}return CL(n,e,t)}function WN(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const rm=Ke.define({map:WN}),Eu=Ke.define({map:WN});function ZN(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(i=>i.from<=t&&i.to>=t)||e.push(n.lineBlockAt(t));return e}const so=Fn.define({create(){return Fe.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((i,l)=>n=t2(n,i,l)),n=n.map(e.changes);let t=[];for(let i of e.effects)i.is(rm)&&!NL(n,i.value.from,i.value.to)?t.push(i.value):i.is(Eu)&&(n=n.update({filter:(l,o)=>i.value.from!=l||i.value.to!=o,filterFrom:i.value.from,filterTo:i.value.to}));if(t.length){let{preparePlaceholder:i}=e.state.facet(tT),l=t.map(o=>(i?Fe.replace({widget:new jL(i(e.state,o))}):n2).range(o.from,o.to));n=n.update({add:l})}return e.selection&&(n=t2(n,e.selection.main.head)),n},provide:n=>Oe.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(i,l)=>{t.push(i,l)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{le&&(i=!0)}),i?n.update({filterFrom:e,filterTo:t,filter:(l,o)=>l>=t||o<=e}):n}function Td(n,e,t){var i;let l=null;return(i=n.field(so,!1))===null||i===void 0||i.between(e,t,(o,a)=>{(!l||l.from>o)&&(l={from:o,to:a})}),l}function NL(n,e,t){let i=!1;return n.between(e,e,(l,o)=>{l==e&&o==t&&(i=!0)}),i}function JN(n,e){return n.field(so,!1)?e:e.concat(Ke.appendConfig.of(nT()))}const TL=n=>{for(let e of ZN(n)){let t=Nd(n.state,e.from,e.to);if(t)return n.dispatch({effects:JN(n.state,[rm.of(t),eT(n,t)])}),!0}return!1},AL=n=>{if(!n.state.field(so,!1))return!1;let e=[];for(let t of ZN(n)){let i=Td(n.state,t.from,t.to);i&&e.push(Eu.of(i),eT(n,i,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function eT(n,e,t=!0){let i=n.state.doc.lineAt(e.from).number,l=n.state.doc.lineAt(e.to).number;return Oe.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${l}.`)}const EL=n=>{let{state:e}=n,t=[];for(let i=0;i{let e=n.state.field(so,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(i,l)=>{t.push(Eu.of({from:i,to:l}))}),n.dispatch({effects:t}),!0},DL=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:TL},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:AL},{key:"Ctrl-Alt-[",run:EL},{key:"Ctrl-Alt-]",run:ML}],RL={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},tT=Ce.define({combine(n){return Pr(n,RL)}});function nT(n){return[so,zL]}function iT(n,e){let{state:t}=n,i=t.facet(tT),l=a=>{let u=n.lineBlockAt(n.posAtDOM(a.target)),f=Td(n.state,u.from,u.to);f&&n.dispatch({effects:Eu.of(f)}),a.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(n,l,e);let o=document.createElement("span");return o.textContent=i.placeholderText,o.setAttribute("aria-label",t.phrase("folded code")),o.title=t.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=l,o}const n2=Fe.replace({widget:new class extends fl{toDOM(n){return iT(n,null)}}});class jL extends fl{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return iT(e,this.value)}}const _L={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class x0 extends al{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 LL(n={}){let e={..._L,...n},t=new x0(e,!0),i=new x0(e,!1),l=en.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(as)!=a.state.facet(as)||a.startState.field(so,!1)!=a.state.field(so,!1)||Un(a.startState)!=Un(a.state)||e.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let u=new Br;for(let f of a.viewportLineBlocks){let d=Td(a.state,f.from,f.to)?i:Nd(a.state,f.from,f.to)?t:null;d&&u.add(f.from,f.from,d)}return u.finish()}}),{domEventHandlers:o}=e;return[l,z_({class:"cm-foldGutter",markers(a){var u;return((u=a.plugin(l))===null||u===void 0?void 0:u.markers)||st.empty},initialSpacer(){return new x0(e,!1)},domEventHandlers:{...o,click:(a,u,f)=>{if(o.click&&o.click(a,u,f))return!0;let d=Td(a.state,u.from,u.to);if(d)return a.dispatch({effects:Eu.of(d)}),!0;let m=Nd(a.state,u.from,u.to);return m?(a.dispatch({effects:rm.of(m)}),!0):!1}}}),nT()]}const zL=Oe.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 Mu{constructor(e,t){this.specs=e;let i;function l(u){let f=rs.newName();return(i||(i=Object.create(null)))["."+f]=u,f}const o=typeof t.all=="string"?t.all:t.all?l(t.all):void 0,a=t.scope;this.scope=a instanceof ir?u=>u.prop(fa)==a.data:a?u=>u==a:void 0,this.style=QN(e.map(u=>({tag:u.tag,class:u.class||l(Object.assign({},u,{tag:null}))})),{all:o}).style,this.module=i?new rs(i):null,this.themeType=t.themeType}static define(e,t){return new Mu(e,t||{})}}const Ix=Ce.define(),rT=Ce.define({combine(n){return n.length?[n[0]]:null}});function y0(n){let e=n.facet(Ix);return e.length?e:n.facet(rT)}function lT(n,e){let t=[PL],i;return n instanceof Mu&&(n.module&&t.push(Oe.styleModule.of(n.module)),i=n.themeType),e!=null&&e.fallback?t.push(rT.of(n)):i?t.push(Ix.computeN([Oe.darkTheme],l=>l.facet(Oe.darkTheme)==(i=="dark")?[n]:[])):t.push(Ix.of(n)),t}class BL{constructor(e){this.markCache=Object.create(null),this.tree=Un(e.state),this.decorations=this.buildDeco(e,y0(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Un(e.state),i=y0(e.state),l=i!=y0(e.startState),{viewport:o}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length=o.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||l)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=o.to)}buildDeco(e,t){if(!t||!this.tree.length)return Fe.none;let i=new Br;for(let{from:l,to:o}of e.visibleRanges)lL(this.tree,t,(a,u,f)=>{i.add(a,u,this.markCache[f]||(this.markCache[f]=Fe.mark({class:f})))},l,o);return i.finish()}}const PL=ao.high(en.fromClass(BL,{decorations:n=>n.decorations})),HL=Mu.define([{tag:he.meta,color:"#404740"},{tag:he.link,textDecoration:"underline"},{tag:he.heading,textDecoration:"underline",fontWeight:"bold"},{tag:he.emphasis,fontStyle:"italic"},{tag:he.strong,fontWeight:"bold"},{tag:he.strikethrough,textDecoration:"line-through"},{tag:he.keyword,color:"#708"},{tag:[he.atom,he.bool,he.url,he.contentSeparator,he.labelName],color:"#219"},{tag:[he.literal,he.inserted],color:"#164"},{tag:[he.string,he.deleted],color:"#a11"},{tag:[he.regexp,he.escape,he.special(he.string)],color:"#e40"},{tag:he.definition(he.variableName),color:"#00f"},{tag:he.local(he.variableName),color:"#30a"},{tag:[he.typeName,he.namespace],color:"#085"},{tag:he.className,color:"#167"},{tag:[he.special(he.variableName),he.macroName],color:"#256"},{tag:he.definition(he.propertyName),color:"#00c"},{tag:he.comment,color:"#940"},{tag:he.invalid,color:"#f00"}]),IL=Oe.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),sT=1e4,oT="()[]{}",aT=Ce.define({combine(n){return Pr(n,{afterCursor:!0,brackets:oT,maxScanDistance:sT,renderMatch:qL})}}),UL=Fe.mark({class:"cm-matchingBracket"}),FL=Fe.mark({class:"cm-nonmatchingBracket"});function qL(n){let e=[],t=n.matched?UL:FL;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function i2(n){let e=[],t=n.facet(aT);for(let i of n.selection.ranges){if(!i.empty)continue;let l=jr(n,i.head,-1,t)||i.head>0&&jr(n,i.head-1,1,t)||t.afterCursor&&(jr(n,i.head,1,t)||i.headn.decorations}),QL=[VL,IL];function XL(n={}){return[aT.of(n),QL]}const $L=new tt;function Ux(n,e,t){let i=n.prop(e<0?tt.openedBy:tt.closedBy);if(i)return i;if(n.name.length==1){let l=t.indexOf(n.name);if(l>-1&&l%2==(e<0?1:0))return[t[l+e]]}return null}function Fx(n){let e=n.type.prop($L);return e?e(n.node):n}function jr(n,e,t,i={}){let l=i.maxScanDistance||sT,o=i.brackets||oT,a=Un(n),u=a.resolveInner(e,t);for(let f=u;f;f=f.parent){let d=Ux(f.type,t,o);if(d&&f.from0?e>=m.from&&em.from&&e<=m.to))return YL(n,e,t,f,m,d,o)}}return GL(n,e,t,a,u.type,l,o)}function YL(n,e,t,i,l,o,a){let u=i.parent,f={from:l.from,to:l.to},d=0,m=u==null?void 0:u.cursor();if(m&&(t<0?m.childBefore(i.from):m.childAfter(i.to)))do if(t<0?m.to<=i.from:m.from>=i.to){if(d==0&&o.indexOf(m.type.name)>-1&&m.from0)return null;let d={from:t<0?e-1:e,to:t>0?e+1:e},m=n.doc.iterRange(e,t>0?n.doc.length:0),g=0;for(let b=0;!m.next().done&&b<=o;){let v=m.value;t<0&&(b+=v.length);let w=e+b*t;for(let S=t>0?0:v.length-1,C=t>0?v.length:-1;S!=C;S+=t){let N=a.indexOf(v[S]);if(!(N<0||i.resolveInner(w+S,1).type!=l))if(N%2==0==t>0)g++;else{if(g==1)return{start:d,end:{from:w+S,to:w+S+1},matched:N>>1==f>>1};g--}}t>0&&(b+=v.length)}return m.done?{start:d,matched:!1}:null}const KL=Object.create(null),r2=[xi.none],l2=[],s2=Object.create(null),WL=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])WL[n]=ZL(KL,e);function b0(n,e){l2.indexOf(n)>-1||(l2.push(n),console.warn(e))}function ZL(n,e){let t=[];for(let u of e.split(" ")){let f=[];for(let d of u.split(".")){let m=n[d]||he[d];m?typeof m=="function"?f.length?f=f.map(m):b0(d,`Modifier ${d} used at start of tag`):f.length?b0(d,`Tag ${d} used as modifier`):f=Array.isArray(m)?m:[m]:b0(d,`Unknown highlighting tag ${d}`)}for(let d of f)t.push(d)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),l=i+" "+t.map(u=>u.id),o=s2[l];if(o)return o.id;let a=s2[l]=xi.define({id:r2.length,name:i,props:[qN({[i]:t})]});return r2.push(a),a.id}Tt.RTL,Tt.LTR;const JL=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=Xy(n.state,t.from);return i.line?ez(n):i.block?nz(n):!1};function Qy(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let l=n(e,t);return l?(i(t.update(l)),!0):!1}}const ez=Qy(lz,0),tz=Qy(cT,0),nz=Qy((n,e)=>cT(n,e,rz(e)),0);function Xy(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const Ic=50;function iz(n,{open:e,close:t},i,l){let o=n.sliceDoc(i-Ic,i),a=n.sliceDoc(l,l+Ic),u=/\s*$/.exec(o)[0].length,f=/^\s*/.exec(a)[0].length,d=o.length-u;if(o.slice(d-e.length,d)==e&&a.slice(f,f+t.length)==t)return{open:{pos:i-u,margin:u&&1},close:{pos:l+f,margin:f&&1}};let m,g;l-i<=2*Ic?m=g=n.sliceDoc(i,l):(m=n.sliceDoc(i,i+Ic),g=n.sliceDoc(l-Ic,l));let b=/^\s*/.exec(m)[0].length,v=/\s*$/.exec(g)[0].length,w=g.length-v-t.length;return m.slice(b,b+e.length)==e&&g.slice(w,w+t.length)==t?{open:{pos:i+b+e.length,margin:/\s/.test(m.charAt(b+e.length))?1:0},close:{pos:l-v-t.length,margin:/\s/.test(g.charAt(w-1))?1:0}}:null}function rz(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),l=t.to<=i.to?i:n.doc.lineAt(t.to);l.from>i.from&&l.from==t.to&&(l=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let o=e.length-1;o>=0&&e[o].to>i.from?e[o].to=l.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:l.to})}return e}function cT(n,e,t=e.selection.ranges){let i=t.map(o=>Xy(e,o.from).block);if(!i.every(o=>o))return null;let l=t.map((o,a)=>iz(e,i[a],o.from,o.to));if(n!=2&&!l.every(o=>o))return{changes:e.changes(t.map((o,a)=>l[a]?[]:[{from:o.from,insert:i[a].open+" "},{from:o.to,insert:" "+i[a].close}]))};if(n!=1&&l.some(o=>o)){let o=[];for(let a=0,u;al&&(o==a||a>g.from)){l=g.from;let b=/^\s*/.exec(g.text)[0].length,v=b==g.length,w=g.text.slice(b,b+d.length)==d?b:-1;bo.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:u,token:f,indent:d,empty:m,single:g}of i)(g||!m)&&o.push({from:u.from+d,insert:f+" "});let a=e.changes(o);return{changes:a,selection:e.selection.map(a,1)}}else if(n!=1&&i.some(o=>o.comment>=0)){let o=[];for(let{line:a,comment:u,token:f}of i)if(u>=0){let d=a.from+u,m=d+f.length;a.text[m-a.from]==" "&&m++,o.push({from:d,to:m})}return{changes:o}}return null}const qx=ul.define(),sz=ul.define(),oz=Ce.define(),uT=Ce.define({combine(n){return Pr(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,l)=>e(i,l)||t(i,l)})}}),fT=Fn.define({create(){return _r.empty},update(n,e){let t=e.state.facet(uT),i=e.annotation(qx);if(i){let f=gi.fromTransaction(e,i.selection),d=i.side,m=d==0?n.undone:n.done;return f?m=Ad(m,m.length,t.minDepth,f):m=mT(m,e.startState.selection),new _r(d==0?i.rest:m,d==0?m:i.rest)}let l=e.annotation(sz);if((l=="full"||l=="before")&&(n=n.isolate()),e.annotation(pn.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let o=gi.fromTransaction(e),a=e.annotation(pn.time),u=e.annotation(pn.userEvent);return o?n=n.addChanges(o,a,u,t,e):e.selection&&(n=n.addSelection(e.startState.selection,a,u,t.newGroupDelay)),(l=="full"||l=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new _r(n.done.map(gi.fromJSON),n.undone.map(gi.fromJSON))}});function az(n={}){return[fT,uT.of(n),Oe.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?hT:e.inputType=="historyRedo"?Vx:null;return i?(e.preventDefault(),i(t)):!1}})]}function lm(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let l=t.field(fT,!1);if(!l)return!1;let o=l.pop(n,t,e);return o?(i(o),!0):!1}}const hT=lm(0,!1),Vx=lm(1,!1),cz=lm(0,!0),uz=lm(1,!0);class gi{constructor(e,t,i,l,o){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=l,this.selectionsAfter=o}setSelAfter(e){return new gi(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(l=>l.toJSON())}}static fromJSON(e){return new gi(e.changes&&mn.fromJSON(e.changes),[],e.mapped&&zr.fromJSON(e.mapped),e.startSelection&&oe.fromJSON(e.startSelection),e.selectionsAfter.map(oe.fromJSON))}static fromTransaction(e,t){let i=qi;for(let l of e.startState.facet(oz)){let o=l(e);o.length&&(i=i.concat(o))}return!i.length&&e.changes.empty?null:new gi(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,qi)}static selection(e){return new gi(void 0,qi,void 0,void 0,e)}}function Ad(n,e,t,i){let l=e+1>t+20?e-t-1:0,o=n.slice(l,e);return o.push(i),o}function fz(n,e){let t=[],i=!1;return n.iterChangedRanges((l,o)=>t.push(l,o)),e.iterChangedRanges((l,o,a,u)=>{for(let f=0;f=d&&a<=m&&(i=!0)}}),i}function hz(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function dT(n,e){return n.length?e.length?n.concat(e):n:e}const qi=[],dz=200;function mT(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-dz));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),Ad(n,n.length-1,1e9,t.setSelAfter(i)))}else return[gi.selection([e])]}function mz(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function v0(n,e){if(!n.length)return n;let t=n.length,i=qi;for(;t;){let l=pz(n[t-1],e,i);if(l.changes&&!l.changes.empty||l.effects.length){let o=n.slice(0,t);return o[t-1]=l,o}else e=l.mapped,t--,i=l.selectionsAfter}return i.length?[gi.selection(i)]:qi}function pz(n,e,t){let i=dT(n.selectionsAfter.length?n.selectionsAfter.map(u=>u.map(e)):qi,t);if(!n.changes)return gi.selection(i);let l=n.changes.map(e),o=e.mapDesc(n.changes,!0),a=n.mapped?n.mapped.composeDesc(o):o;return new gi(l,Ke.mapEffects(n.effects,e),a,n.startSelection.map(o),i)}const gz=/^(input\.type|delete)($|\.)/;class _r{constructor(e,t,i=0,l=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=l}isolate(){return this.prevTime?new _r(this.done,this.undone):this}addChanges(e,t,i,l,o){let a=this.done,u=a[a.length-1];return u&&u.changes&&!u.changes.empty&&e.changes&&(!i||gz.test(i))&&(!u.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):sm(t,e))}function qn(n){return n.textDirectionAt(n.state.selection.main.head)==Tt.LTR}const gT=n=>pT(n,!qn(n)),xT=n=>pT(n,qn(n));function yT(n,e){return ar(n,t=>t.empty?n.moveByGroup(t,e):sm(t,e))}const yz=n=>yT(n,!qn(n)),bz=n=>yT(n,qn(n));function vz(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function om(n,e,t){let i=Un(n).resolveInner(e.head),l=t?tt.closedBy:tt.openedBy;for(let f=e.head;;){let d=t?i.childAfter(f):i.childBefore(f);if(!d)break;vz(n,d,l)?i=d:f=t?d.to:d.from}let o=i.type.prop(l),a,u;return o&&(a=t?jr(n,i.from,1):jr(n,i.to,-1))&&a.matched?u=t?a.end.to:a.end.from:u=t?i.to:i.from,oe.cursor(u,t?-1:1)}const wz=n=>ar(n,e=>om(n.state,e,!qn(n))),kz=n=>ar(n,e=>om(n.state,e,qn(n)));function bT(n,e){return ar(n,t=>{if(!t.empty)return sm(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const vT=n=>bT(n,!1),wT=n=>bT(n,!0);function kT(n){let e=n.scrollDOM.clientHeighta.empty?n.moveVertically(a,e,t.height):sm(a,e));if(l.eq(i.selection))return!1;let o;if(t.selfScroll){let a=n.coordsAtPos(i.selection.main.head),u=n.scrollDOM.getBoundingClientRect(),f=u.top+t.marginTop,d=u.bottom-t.marginBottom;a&&a.top>f&&a.bottomST(n,!1),Qx=n=>ST(n,!0);function hs(n,e,t){let i=n.lineBlockAt(e.head),l=n.moveToLineBoundary(e,t);if(l.head==e.head&&l.head!=(t?i.to:i.from)&&(l=n.moveToLineBoundary(e,t,!1)),!t&&l.head==i.from&&i.length){let o=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;o&&e.head!=i.from+o&&(l=oe.cursor(i.from+o))}return l}const Sz=n=>ar(n,e=>hs(n,e,!0)),Cz=n=>ar(n,e=>hs(n,e,!1)),Oz=n=>ar(n,e=>hs(n,e,!qn(n))),Nz=n=>ar(n,e=>hs(n,e,qn(n))),Tz=n=>ar(n,e=>n.moveToLineBoundary(e,!1,!1)),Az=n=>ar(n,e=>n.moveToLineBoundary(e,!0,!1));function Ez(n,e,t){let i=!1,l=_a(n.selection,o=>{let a=jr(n,o.head,-1)||jr(n,o.head,1)||o.head>0&&jr(n,o.head-1,1)||o.headEz(n,e);function Xi(n,e,t){let i=_a(n.state.selection,l=>{l.undirectional&&l.head>=l.anchor!=e&&(l=oe.range(l.head,l.anchor));let o=t(l);return oe.range(l.anchor,o.head,o.goalColumn,o.bidiLevel||void 0,o.assoc)});return i.eq(n.state.selection)?!1:(n.dispatch(or(n.state,i)),!0)}function CT(n,e){return Xi(n,e,t=>n.moveByChar(t,e))}const OT=n=>CT(n,!qn(n)),NT=n=>CT(n,qn(n));function TT(n,e){return Xi(n,e,t=>n.moveByGroup(t,e))}const Dz=n=>TT(n,!qn(n)),Rz=n=>TT(n,qn(n)),jz=n=>{let e=!qn(n);return Xi(n,e,t=>om(n.state,t,e))},_z=n=>{let e=qn(n);return Xi(n,e,t=>om(n.state,t,e))};function AT(n,e){return Xi(n,e,t=>n.moveVertically(t,e))}const ET=n=>AT(n,!1),MT=n=>AT(n,!0);function DT(n,e){return Xi(n,e,t=>n.moveVertically(t,e,kT(n).height))}const a2=n=>DT(n,!1),c2=n=>DT(n,!0),Lz=n=>Xi(n,!0,e=>hs(n,e,!0)),zz=n=>Xi(n,!1,e=>hs(n,e,!1)),Bz=n=>{let e=!qn(n);return Xi(n,e,t=>hs(n,t,e))},Pz=n=>{let e=qn(n);return Xi(n,e,t=>hs(n,t,e))},Hz=n=>Xi(n,!1,e=>oe.cursor(n.lineBlockAt(e.head).from)),Iz=n=>Xi(n,!0,e=>oe.cursor(n.lineBlockAt(e.head).to)),u2=({state:n,dispatch:e})=>(e(or(n,{anchor:0})),!0),f2=({state:n,dispatch:e})=>(e(or(n,{anchor:n.doc.length})),!0),h2=({state:n,dispatch:e})=>(e(or(n,{anchor:n.selection.main.anchor,head:0})),!0),d2=({state:n,dispatch:e})=>(e(or(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),Uz=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),Fz=({state:n,dispatch:e})=>{let t=am(n).map(({from:i,to:l})=>oe.undirectionalRange(i,Math.min(l+1,n.doc.length)));return e(n.update({selection:oe.create(t),userEvent:"select"})),!0},qz=({state:n,dispatch:e})=>{let t=_a(n.selection,i=>{let l=Un(n),o=l.resolveStack(i.from,1);if(i.empty){let a=l.resolveStack(i.from,-1);a.node.from>=o.node.from&&a.node.to<=o.node.to&&(o=a)}for(let a=o;a;a=a.next){let{node:u}=a;if((u.from=i.to||u.to>i.to&&u.from<=i.from)&&a.next)return oe.undirectionalRange(u.from,u.to)}return i});return t.eq(n.selection)?!1:(e(or(n,t)),!0)};function RT(n,e){let{state:t}=n,i=t.selection,l=t.selection.ranges.slice();for(let o of t.selection.ranges){let a=t.doc.lineAt(o.head);if(e?a.to0)for(let u=o;;){let f=n.moveVertically(u,e);if(f.heada.to){l.some(d=>d.head==f.head)||l.push(f);break}else{if(f.head==u.head)break;u=f}}}return l.length==i.ranges.length?!1:(n.dispatch(or(t,oe.create(l,l.length-1))),!0)}const Vz=n=>RT(n,!1),Qz=n=>RT(n,!0),Xz=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=oe.create([t.main]):t.main.empty||(i=oe.create([oe.cursor(t.main.head)])),i?(e(or(n,i)),!0):!1};function Du(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,l=i.changeByRange(o=>{let{from:a,to:u}=o;if(a==u){let f=e(o);fa&&(t="delete.forward",f=Rh(n,f,!0)),a=Math.min(a,f),u=Math.max(u,f)}else a=Rh(n,a,!1),u=Rh(n,u,!0);return a==u?{range:o}:{changes:{from:a,to:u},range:oe.cursor(a,al(n)))i.between(e,e,(l,o)=>{le&&(e=t?o:l)});return e}const jT=(n,e,t)=>Du(n,i=>{let l=i.from,{state:o}=n,a=o.doc.lineAt(l),u,f;if(t&&!e&&l>a.from&&ljT(n,!1,!0),_T=n=>jT(n,!0,!1),LT=(n,e)=>Du(n,t=>{let i=t.head,{state:l}=n,o=l.doc.lineAt(i),a=l.charCategorizer(i);for(let u=null;;){if(i==(e?o.to:o.from)){i==t.head&&o.number!=(e?l.doc.lines:1)&&(i+=e?1:-1);break}let f=On(o.text,i-o.from,e)+o.from,d=o.text.slice(Math.min(i,f)-o.from,Math.max(i,f)-o.from),m=a(d);if(u!=null&&m!=u)break;(d!=" "||i!=t.head)&&(u=m),i=f}return i}),zT=n=>LT(n,!1),$z=n=>LT(n,!0),Yz=n=>Du(n,e=>{let t=n.lineBlockAt(e.head).to;return e.headDu(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),Kz=n=>Du(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:mt.of(["",""])},range:oe.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},Zz=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let l=i.from,o=n.doc.lineAt(l),a=l==o.from?l-1:On(o.text,l-o.from,!1)+o.from,u=l==o.to?l+1:On(o.text,l-o.from,!0)+o.from;return{changes:{from:a,to:u,insert:n.doc.slice(l,u).append(n.doc.slice(a,l))},range:oe.cursor(u)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function am(n){let e=[],t=-1;for(let i of n.selection.ranges){let l=n.doc.lineAt(i.from),o=n.doc.lineAt(i.to);if(!i.empty&&i.to==o.from&&(o=n.doc.lineAt(i.to-1)),t>=l.number){let a=e[e.length-1];a.to=o.to,a.ranges.push(i)}else e.push({from:l.from,to:o.to,ranges:[i]});t=o.number+1}return e}function BT(n,e,t){if(n.readOnly)return!1;let i=[],l=[];for(let o of am(n)){if(t?o.to==n.doc.length:o.from==0)continue;let a=n.doc.lineAt(t?o.to+1:o.from-1),u=a.length+1;if(t){i.push({from:o.to,to:a.to},{from:o.from,insert:a.text+n.lineBreak});for(let f of o.ranges)l.push(oe.range(Math.min(n.doc.length,f.anchor+u),Math.min(n.doc.length,f.head+u)))}else{i.push({from:a.from,to:o.from},{from:o.to,insert:n.lineBreak+a.text});for(let f of o.ranges)l.push(oe.range(f.anchor-u,f.head-u))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:oe.create(l,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Jz=({state:n,dispatch:e})=>BT(n,e,!1),e6=({state:n,dispatch:e})=>BT(n,e,!0);function PT(n,e,t){if(n.readOnly)return!1;let i=[];for(let o of am(n))t?i.push({from:o.from,insert:n.doc.slice(o.from,o.to)+n.lineBreak}):i.push({from:o.to,insert:n.lineBreak+n.doc.slice(o.from,o.to)});let l=n.changes(i);return e(n.update({changes:l,selection:n.selection.map(l,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const t6=({state:n,dispatch:e})=>PT(n,e,!1),n6=({state:n,dispatch:e})=>PT(n,e,!0),i6=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(am(e).map(({from:l,to:o})=>(l>0?l--:o{let o;if(n.lineWrapping){let a=n.lineBlockAt(l.head),u=n.coordsAtPos(l.head,l.assoc||1);u&&(o=a.bottom+n.documentTop-u.bottom+n.defaultLineHeight/2)}return n.moveVertically(l,!0,o)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function r6(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Un(n).resolveInner(e),i=t.childBefore(e),l=t.childAfter(e),o;return i&&l&&i.to<=e&&l.from>=e&&(o=i.type.prop(tt.closedBy))&&o.indexOf(l.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(l.from).from&&!/\S/.test(n.sliceDoc(i.to,l.from))?{from:i.to,to:l.from}:null}const m2=HT(!1),l6=HT(!0);function HT(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(l=>{let{from:o,to:a}=l,u=e.doc.lineAt(o),f=!n&&o==a&&r6(e,o);n&&(o=a=(a<=u.to?u:e.doc.lineAt(a)).to);let d=new im(e,{simulateBreak:o,simulateDoubleBreak:!!f}),m=qy(d,o);for(m==null&&(m=ja(/^\s*/.exec(e.doc.lineAt(o).text)[0],e.tabSize));au.from&&o{let l=[];for(let a=i.from;a<=i.to;){let u=n.doc.lineAt(a);u.number>t&&(i.empty||i.to>u.from)&&(e(u,l,i),t=u.number),a=u.to+1}let o=n.changes(l);return{changes:l,range:oe.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}})}const s6=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new im(n,{overrideIndentation:o=>{let a=t[o];return a??-1}}),l=$y(n,(o,a,u)=>{let f=qy(i,o.from);if(f==null)return;/\S/.test(o.text)||(f=0);let d=/^\s*/.exec(o.text)[0],m=xu(n,f);(d!=m||u.fromn.readOnly?!1:(e(n.update($y(n,(t,i)=>{i.push({from:t.from,insert:n.facet(Fy)})}),{userEvent:"input.indent"})),!0),a6=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update($y(n,(t,i)=>{let l=/^\s*/.exec(t.text)[0];if(!l)return;let o=ja(l,n.tabSize),a=0,u=xu(n,Math.max(0,o-Od(n)));for(;a(n.setTabFocusMode(),!0),u6=[{key:"Ctrl-b",run:gT,shift:OT,preventDefault:!0},{key:"Ctrl-f",run:xT,shift:NT},{key:"Ctrl-p",run:vT,shift:ET},{key:"Ctrl-n",run:wT,shift:MT},{key:"Ctrl-a",run:Tz,shift:Hz},{key:"Ctrl-e",run:Az,shift:Iz},{key:"Ctrl-d",run:_T},{key:"Ctrl-h",run:Xx},{key:"Ctrl-k",run:Yz},{key:"Ctrl-Alt-h",run:zT},{key:"Ctrl-o",run:Wz},{key:"Ctrl-t",run:Zz},{key:"Ctrl-v",run:Qx}],f6=[{key:"ArrowLeft",run:gT,shift:OT,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:yz,shift:Dz,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Oz,shift:Bz,preventDefault:!0},{key:"ArrowRight",run:xT,shift:NT,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:bz,shift:Rz,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Nz,shift:Pz,preventDefault:!0},{key:"ArrowUp",run:vT,shift:ET,preventDefault:!0},{mac:"Cmd-ArrowUp",run:u2,shift:h2},{mac:"Ctrl-ArrowUp",run:o2,shift:a2},{key:"ArrowDown",run:wT,shift:MT,preventDefault:!0},{mac:"Cmd-ArrowDown",run:f2,shift:d2},{mac:"Ctrl-ArrowDown",run:Qx,shift:c2},{key:"PageUp",run:o2,shift:a2},{key:"PageDown",run:Qx,shift:c2},{key:"Home",run:Cz,shift:zz,preventDefault:!0},{key:"Mod-Home",run:u2,shift:h2},{key:"End",run:Sz,shift:Lz,preventDefault:!0},{key:"Mod-End",run:f2,shift:d2},{key:"Enter",run:m2,shift:m2},{key:"Mod-a",run:Uz},{key:"Backspace",run:Xx,shift:Xx,preventDefault:!0},{key:"Delete",run:_T,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:zT,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:$z,preventDefault:!0},{mac:"Mod-Backspace",run:Gz,preventDefault:!0},{mac:"Mod-Delete",run:Kz,preventDefault:!0}].concat(u6.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),h6=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:wz,shift:jz},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:kz,shift:_z},{key:"Alt-ArrowUp",run:Jz},{key:"Shift-Alt-ArrowUp",run:t6},{key:"Alt-ArrowDown",run:e6},{key:"Shift-Alt-ArrowDown",run:n6},{key:"Mod-Alt-ArrowUp",run:Vz},{key:"Mod-Alt-ArrowDown",run:Qz},{key:"Escape",run:Xz},{key:"Mod-Enter",run:l6},{key:"Alt-l",mac:"Ctrl-l",run:Fz},{key:"Mod-i",run:qz,preventDefault:!0},{key:"Mod-[",run:a6},{key:"Mod-]",run:o6},{key:"Mod-Alt-\\",run:s6},{key:"Shift-Mod-k",run:i6},{key:"Shift-Mod-\\",run:Mz},{key:"Mod-/",run:JL},{key:"Alt-A",mac:"Ctrl-A",run:tz},{key:"Ctrl-m",mac:"Shift-Alt-m",run:c6}].concat(f6),p2=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class Da{constructor(e,t,i=0,l=e.length,o,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,l),this.bufferStart=i,this.normalize=o?u=>o(p2(u)):p2,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 hi(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=vy(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=Mr(e);let l=this.normalize(t);if(l.length)for(let o=0,a=i,u=!0;;o++){let f=l.charCodeAt(o),d=this.match(f,a,u,this.bufferPos+this.bufferStart,o==l.length-1);if(d)return this.value=d,this;if(o==l.length-1)break;u&&othis.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 i=this.curLineStart+t.index,l=i+t[0].length;if(this.matchPos=Ed(this.text,l+(i==l?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,l,t)))return this.value={from:i,to:l,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||l.to<=t){let u=new ya(t,e.sliceString(t,i));return w0.set(e,u),u}if(l.from==t&&l.to==i)return l;let{text:o,from:a}=l;return a>t&&(o=e.sliceString(t,a)+o,a=t),l.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 i=this.flat.from+t.index,l=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,l,t)))return this.value={from:i,to:l,precise:!0,match:t},this.matchPos=Ed(this.text,l+(i==l?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=ya.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(UT.prototype[Symbol.iterator]=FT.prototype[Symbol.iterator]=function(){return this});function d6(n){try{return new RegExp(n,Yy),!0}catch{return!1}}function Ed(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}const m6=n=>{let e=R_(n,"cm-goto-line");if(e){let a=e.dom.querySelector("input[type=text]");return a&&a.select(),!0}let{state:t}=n,i=String(t.doc.lineAt(n.state.selection.main.head).number),{close:l,result:o}=D_(n,{class:"cm-goto-line",label:t.phrase("Go to line"),input:{type:"text",name:"line",value:i},focus:!0,submitLabel:t.phrase("go")});return o.then(a=>{let u=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!u){n.dispatch({effects:l});return}let f=t.doc.lineAt(t.selection.main.head),[,d,m,g,b]=u,v=g?+g.slice(1):0,w=m?+m:f.number;if(m&&b){let N=w/100;d&&(N=N*(d=="-"?-1:1)+f.number/t.doc.lines),w=Math.round(t.doc.lines*N)}else m&&d&&(w=w*(d=="-"?-1:1)+f.number);let S=t.doc.line(Math.max(1,Math.min(t.doc.lines,w))),C=oe.cursor(S.from+Math.max(0,Math.min(v,S.length)));n.dispatch({effects:[l,Oe.scrollIntoView(C.from,{y:"center"})],selection:C})}),!0},p6={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},g6=Ce.define({combine(n){return Pr(n,p6,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function x6(n){return[k6,w6]}const y6=Fe.mark({class:"cm-selectionMatch"}),b6=Fe.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function g2(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=Ft.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=Ft.Word)}function v6(n,e,t,i){return n(e.sliceDoc(t,t+1))==Ft.Word&&n(e.sliceDoc(i-1,i))==Ft.Word}const w6=en.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(g6),{state:t}=n,i=t.selection;if(i.ranges.length>1)return Fe.none;let l=i.main,o,a=null;if(l.empty){if(!e.highlightWordAroundCursor)return Fe.none;let f=t.wordAt(l.head);if(!f)return Fe.none;a=t.charCategorizer(l.head),o=t.sliceDoc(f.from,f.to)}else{let f=l.to-l.from;if(f200)return Fe.none;if(e.wholeWords){if(o=t.sliceDoc(l.from,l.to),a=t.charCategorizer(l.head),!(g2(a,t,l.from,l.to)&&v6(a,t,l.from,l.to)))return Fe.none}else if(o=t.sliceDoc(l.from,l.to),!o)return Fe.none}let u=[];for(let f of n.visibleRanges){let d=new Da(t.doc,o,f.from,f.to);for(;!d.next().done;){let{from:m,to:g}=d.value;if((!a||g2(a,t,m,g))&&(l.empty&&m<=l.from&&g>=l.to?u.push(b6.range(m,g)):(m>=l.to||g<=l.from)&&u.push(y6.range(m,g)),u.length>e.maxMatches))return Fe.none}}return Fe.set(u)}},{decorations:n=>n.decorations}),k6=Oe.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),S6=({state:n,dispatch:e})=>{let{selection:t}=n,i=oe.create(t.ranges.map(l=>n.wordAt(l.head)||oe.cursor(l.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function C6(n,e){let{main:t,ranges:i}=n.selection,l=n.wordAt(t.head),o=l&&l.from==t.from&&l.to==t.to;for(let a=!1,u=new Da(n.doc,e,i[i.length-1].to);;)if(u.next(),u.done){if(a)return null;u=new Da(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),a=!0}else{if(a&&i.some(f=>f.from==u.value.from))continue;if(o){let f=n.wordAt(u.value.from);if(!f||f.from!=u.value.from||f.to!=u.value.to)continue}return u.value}}const O6=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(o=>o.from===o.to))return S6({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(o=>n.sliceDoc(o.from,o.to)!=i))return!1;let l=C6(n,i);return l?(e(n.update({selection:n.selection.addRange(oe.range(l.from,l.to),!1),effects:Oe.scrollIntoView(l.to)})),!0):!1},La=Ce.define({combine(n){return Pr(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new H6(e),scrollToMatch:e=>Oe.scrollIntoView(e)})}});class qT{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||d6(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?` -`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new D6(this):new A6(this)}getCursor(e,t=0,i){let l=e.doc?e:gt.create({doc:e});return i==null&&(i=l.doc.length),this.regexp?ra(this,l,t,i):ia(this,l,t,i)}}class VT{constructor(e){this.spec=e}}function N6(n,e,t){return(i,l,o,a)=>{if(t&&!t(i,l,o,a))return!1;let u=i>=a&&l<=a+o.length?o.slice(i-a,l-a):e.doc.sliceString(i,l);return n(u,e,i,l)}}function ia(n,e,t,i){let l;return n.wholeWord&&(l=T6(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(l=N6(n.test,e,l)),new Da(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:o=>o.toLowerCase(),l)}function T6(n,e){return(t,i,l,o)=>((o>t||o+l.length=t)return null;l.push(i.value)}return l}highlight(e,t,i,l){let o=ia(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!o.next().done;)l(o.value.from,o.value.to)}}function E6(n,e,t){return(i,l,o)=>(!t||t(i,l,o))&&n(o[0],e,i,l)}function ra(n,e,t,i){let l;return n.wholeWord&&(l=M6(e.charCategorizer(e.selection.main.head))),n.test&&(l=E6(n.test,e,l)),new UT(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:l},t,i)}function Md(n,e){return n.slice(On(n,e,!1),e)}function Dd(n,e){return n.slice(e,On(n,e))}function M6(n){return(e,t,i)=>!i[0].length||(n(Md(i.input,i.index))!=Ft.Word||n(Dd(i.input,i.index))!=Ft.Word)&&(n(Dd(i.input,i.index+i[0].length))!=Ft.Word||n(Md(i.input,i.index+i[0].length))!=Ft.Word)}class D6 extends VT{nextMatch(e,t,i){let l=ra(this.spec,e,i,e.doc.length).next();return l.done&&(l=ra(this.spec,e,0,t).next()),l.done?null:l.value}prevMatchInRange(e,t,i){for(let l=1;;l++){let o=Math.max(t,i-l*1e4),a=ra(this.spec,e,o,i),u=null;for(;!a.next().done;)u=a.value;if(u&&(o==t||u.from>o+10))return u;if(o==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let l=i.length;l>0;l--){let o=+i.slice(0,l);if(o>0&&o=t)return null;l.push(i.value)}return l}highlight(e,t,i,l){let o=ra(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!o.next().done;)l(o.value.from,o.value.to)}}const yu=Ke.define(),Gy=Ke.define(),ts=Fn.define({create(n){return new k0($x(n).create(),null)},update(n,e){for(let t of e.effects)t.is(yu)?n=new k0(t.value.create(),n.panel):t.is(Gy)&&(n=new k0(n.query,t.value?Ky:null));return n},provide:n=>mu.from(n,e=>e.panel)});class k0{constructor(e,t){this.query=e,this.panel=t}}const R6=Fe.mark({class:"cm-searchMatch"}),j6=Fe.mark({class:"cm-searchMatch cm-searchMatch-selected"}),_6=en.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(ts))}update(n){let e=n.state.field(ts);(e!=n.startState.field(ts)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return Fe.none;let{view:t}=this,i=new Br;for(let l=0,o=t.visibleRanges,a=o.length;lo[l+1].from-500;)f=o[++l].to;n.highlight(t.state,u,f,(d,m)=>{let g=t.state.selection.ranges.some(b=>b.from==d&&b.to==m);i.add(d,m,g?j6:R6)})}return i.finish()}},{decorations:n=>n.decorations});function Ru(n){return e=>{let t=e.state.field(ts,!1);return t&&t.query.spec.valid?n(e,t):$T(e)}}const Rd=Ru((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let l=oe.single(i.from,i.to),o=n.state.facet(La);return n.dispatch({selection:l,effects:[Wy(n,i),o.scrollToMatch(l.main,n)],userEvent:"select.search"}),XT(n),!0}),jd=Ru((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,l=e.prevMatch(t,i,i);if(!l)return!1;let o=oe.single(l.from,l.to),a=n.state.facet(La);return n.dispatch({selection:o,effects:[Wy(n,l),a.scrollToMatch(o.main,n)],userEvent:"select.search"}),XT(n),!0}),L6=Ru((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:oe.create(t.map(i=>oe.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),z6=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:l}=t.main,o=[],a=0;for(let u=new Da(n.doc,n.sliceDoc(i,l));!u.next().done;){if(o.length>1e3)return!1;u.value.from==i&&(a=o.length),o.push(oe.range(u.value.from,u.value.to))}return e(n.update({selection:oe.create(o,a),userEvent:"select.search.matches"})),!0},x2=Ru((n,{query:e})=>{let{state:t}=n,{from:i,to:l}=t.selection.main;if(t.readOnly)return!1;let o=e.nextMatch(t,i,i);if(!o)return!1;let a=o,u=[],f,d,m=[];a.precise?a.from==i&&a.to==l&&(d=t.toText(e.getReplacement(a)),u.push({from:a.from,to:a.to,insert:d}),a=e.nextMatch(t,a.from,a.to),m.push(Oe.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))):a=e.nextMatch(t,a.from,a.to);let g=n.state.changes(u);return a&&(f=oe.single(a.from,a.to).map(g),m.push(Wy(n,a)),m.push(t.facet(La).scrollToMatch(f.main,n))),n.dispatch({changes:g,selection:f,effects:m,userEvent:"input.replace"}),!0}),B6=Ru((n,{query:e})=>{if(n.state.readOnly)return!1;let t=[];for(let l of e.matchAll(n.state,1e9)){let{from:o,to:a,precise:u}=l;u&&t.push({from:o,to:a,insert:e.getReplacement(l)})}if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:Oe.announce.of(i),userEvent:"input.replace.all"}),!0});function Ky(n){return n.state.facet(La).createPanel(n)}function $x(n,e){var t,i,l,o,a;let u=n.selection.main,f=u.empty||u.to>u.from+100?"":n.sliceDoc(u.from,u.to);if(e&&!f)return e;let d=n.facet(La);return new qT({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:d.literal)?f:f.replace(/\n/g,"\\n"),caseSensitive:(i=e==null?void 0:e.caseSensitive)!==null&&i!==void 0?i:d.caseSensitive,literal:(l=e==null?void 0:e.literal)!==null&&l!==void 0?l:d.literal,regexp:(o=e==null?void 0:e.regexp)!==null&&o!==void 0?o:d.regexp,wholeWord:(a=e==null?void 0:e.wholeWord)!==null&&a!==void 0?a:d.wholeWord})}function QT(n){let e=nm(n,Ky);return e&&e.dom.querySelector("[main-field]")}function XT(n){let e=QT(n);e&&e==n.root.activeElement&&e.select()}const $T=n=>{let e=n.state.field(ts,!1);if(e&&e.panel){let t=QT(n);if(t&&t!=n.root.activeElement){let i=$x(n.state,e.query.spec);i.valid&&n.dispatch({effects:yu.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[Gy.of(!0),e?yu.of($x(n.state,e.query.spec)):Ke.appendConfig.of(U6)]});return!0},YT=n=>{let e=n.state.field(ts,!1);if(!e||!e.panel)return!1;let t=nm(n,Ky);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:Gy.of(!1)}),!0},P6=[{key:"Mod-f",run:$T,scope:"editor search-panel"},{key:"F3",run:Rd,shift:jd,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Rd,shift:jd,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:YT,scope:"editor search-panel"},{key:"Mod-Shift-l",run:z6},{key:"Mod-Alt-g",run:m6},{key:"Mod-d",run:O6,preventDefault:!0}];class H6{constructor(e){this.view=e;let t=this.query=e.state.field(ts).query.spec;this.commit=this.commit.bind(this),this.searchField=Nt("input",{value:t.search,placeholder:Ti(e,"Find"),"aria-label":Ti(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Nt("input",{value:t.replace,placeholder:Ti(e,"Replace"),"aria-label":Ti(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Nt("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Nt("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Nt("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(l,o,a){return Nt("button",{class:"cm-button",name:l,onclick:o,type:"button"},a)}this.dom=Nt("div",{onkeydown:l=>this.keydown(l),class:"cm-search"},[this.searchField,i("next",()=>Rd(e),[Ti(e,"next")]),i("prev",()=>jd(e),[Ti(e,"previous")]),i("select",()=>L6(e),[Ti(e,"all")]),Nt("label",null,[this.caseField,Ti(e,"match case")]),Nt("label",null,[this.reField,Ti(e,"regexp")]),Nt("label",null,[this.wordField,Ti(e,"by word")]),...e.state.readOnly?[]:[Nt("br"),this.replaceField,i("replace",()=>x2(e),[Ti(e,"replace")]),i("replaceAll",()=>B6(e),[Ti(e,"replace all")])],Nt("button",{name:"close",onclick:()=>YT(e),"aria-label":Ti(e,"close"),type:"button"},["×"])])}commit(){let e=new qT({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:yu.of(e)}))}keydown(e){Uj(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?jd:Rd)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),x2(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(yu)&&!i.value.eq(this.query)&&this.setQuery(i.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(La).top}}function Ti(n,e){return n.state.phrase(e)}const jh=30,_h=/[\s\.,:;?!]/;function Wy(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),l=n.state.doc.lineAt(t).to,o=Math.max(i.from,e-jh),a=Math.min(l,t+jh),u=n.state.sliceDoc(o,a);if(o!=i.from){for(let f=0;fu.length-jh;f--)if(!_h.test(u[f-1])&&_h.test(u[f])){u=u.slice(0,f);break}}return Oe.announce.of(`${n.state.phrase("current match")}. ${u} ${n.state.phrase("on line")} ${i.number}.`)}const I6=Oe.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"}}),U6=[ts,ao.low(_6),I6];class GT{constructor(e,t,i,l){this.state=e,this.pos=t,this.explicit=i,this.view=l,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Un(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),i=Math.max(t.from,this.pos-250),l=t.text.slice(i-t.from,this.pos-t.from),o=l.search(KT(e,!1));return o<0?null:{from:i+o,to:this.pos,text:l.slice(o)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function y2(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function F6(n){let e=Object.create(null),t=Object.create(null);for(let{label:l}of n){e[l[0]]=!0;for(let o=1;otypeof l=="string"?{label:l}:l),[t,i]=e.every(l=>/^\w+$/.test(l.label))?[/\w*$/,/\w+$/]:F6(e);return l=>{let o=l.matchBefore(i);return o||l.explicit?{from:o?o.from:l.pos,options:e,validFor:t}:null}}class b2{constructor(e,t,i,l){this.completion=e,this.source=t,this.match=i,this.score=l}}function no(n){return n.selection.main.from}function KT(n,e){var t;let{source:i}=n,l=e&&i[0]!="^",o=i[i.length-1]!="$";return!l&&!o?n:new RegExp(`${l?"^":""}(?:${i})${o?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const WT=ul.define();function V6(n,e,t,i){let{main:l}=n.selection,o=t-l.from,a=i-l.from;return{...n.changeByRange(u=>{if(u!=l&&t!=i&&n.sliceDoc(u.from+o,u.from+a)!=n.sliceDoc(t,i))return{range:u};let f=n.toText(e);return{changes:{from:u.from+o,to:i==l.from?u.to:u.from+a,insert:f},range:oe.cursor(u.from+o+f.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const v2=new WeakMap;function Q6(n){if(!Array.isArray(n))return n;let e=v2.get(n);return e||v2.set(n,e=q6(n)),e}const _d=Ke.define(),bu=Ke.define();class X6{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&U<=57||U>=97&&U<=122?2:U>=65&&U<=90?1:0:(E=vy(U))!=E.toLowerCase()?1:E!=E.toUpperCase()?2:0;(!j||T==1&&C||I==0&&T!=0)&&(t[g]==U||i[g]==U&&(b=!0)?a[g++]=j:a.length&&(N=!1)),I=T,j+=Mr(U)}return g==f&&a[0]==0&&N?this.result(-100+(b?-200:0),a,e):v==f&&w==0?this.ret(-200-e.length+(S==e.length?0:-100),[0,S]):u>-1?this.ret(-700-e.length,[u,u+this.pattern.length]):v==f?this.ret(-900-e.length,[w,S]):g==f?this.result(-100+(b?-200:0)+-700+(N?0:-1100),a,e):t.length==2?null:this.result((l[0]?-700:0)+-200+-1100,l,e)}result(e,t,i){let l=[],o=0;for(let a of t){let u=a+(this.astral?Mr(hi(i,a)):1);o&&l[o-1]==a?l[o-1]=u:(l[o++]=a,l[o++]=u)}return this.ret(e-i.length,l)}}class $6{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Y6,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>w2(e(i),t(i)),optionClass:(e,t)=>i=>w2(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function w2(n,e){return n?e?n+" "+e:n:e}function Y6(n,e,t,i,l,o){let a=n.textDirection==Tt.RTL,u=a,f=!1,d="top",m,g,b=e.left-l.left,v=l.right-e.right,w=i.right-i.left,S=i.bottom-i.top;if(u&&b=S||j>e.top?m=t.bottom-e.top:(d="bottom",m=e.bottom-t.top)}let C=(e.bottom-e.top)/o.offsetHeight,N=(e.right-e.left)/o.offsetWidth;return{style:`${d}: ${m/C}px; max-width: ${g/N}px`,class:"cm-completionInfo-"+(f?a?"left-narrow":"right-narrow":u?"left":"right")}}const Zy=Ke.define();function G6(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(l=>"cm-completionIcon-"+l)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,l,o){let a=document.createElement("span");a.className="cm-completionLabel";let u=t.displayLabel||t.label,f=0;for(let d=0;df&&a.appendChild(document.createTextNode(u.slice(f,m)));let b=a.appendChild(document.createElement("span"));b.appendChild(document.createTextNode(u.slice(m,g))),b.className="cm-completionMatchedText",f=g}return ft.position-i.position).map(t=>t.render)}function S0(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let l=Math.floor(e/t);return{from:l*t,to:(l+1)*t}}let i=Math.ceil((n-e)/t);return{from:n-i*t,to:n-(i-1)*t}}class K6{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:f=>this.placeInfo(f),key:this},this.space=null,this.currentClass="";let l=e.state.field(t),{options:o,selected:a}=l.open,u=e.state.facet(Cn);this.optionContent=G6(u),this.optionClass=u.optionClass,this.tooltipClass=u.tooltipClass,this.range=S0(o.length,a,u.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",f=>{let{options:d}=e.state.field(t).open;for(let m=f.target,g;m&&m!=this.dom;m=m.parentNode)if(m.nodeName=="LI"&&(g=/-(\d+)$/.exec(m.id))&&+g[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;m!=null&&(e.dispatch({effects:Zy.of(m)}),f.preventDefault())}}),this.dom.addEventListener("focusout",f=>{let d=e.state.field(this.stateField,!1);d&&d.tooltip&&e.state.facet(Cn).closeOnBlur&&f.relatedTarget!=e.contentDOM&&e.dispatch({effects:bu.of(null)})}),this.showOptions(o,l.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField),l=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=l){let{options:o,selected:a,disabled:u}=i.open;(!l.open||l.open.options!=o)&&(this.range=S0(o.length,a,e.state.facet(Cn).maxRenderedOptions),this.showOptions(o,i.id)),this.updateSel(),u!=((t=l.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!u)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected=this.range.to)&&(this.range=S0(t.options.length,t.selected,this.view.state.facet(Cn).maxRenderedOptions),this.showOptions(t.options,e.id));let i=this.updateSelectedOption(t.selected);if(i){this.destroyInfo();let{completion:l}=t.options[t.selected],{info:o}=l;if(!o)return;let a=typeof o=="string"?document.createTextNode(o):o(l);if(!a)return;"then"in a?a.then(u=>{u&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(u,l)}).catch(u=>pi(this.view.state,u,"completion info")):(this.addInfoPane(a,l),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:l,destroy:o}=e;i.appendChild(l),this.infoDestroy=o||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,l=this.range.from;i;i=i.nextSibling,l++)i.nodeName!="LI"||!i.id?l--:l==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return t&&Z6(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),l=e.getBoundingClientRect(),o=this.space;if(!o){let a=this.dom.ownerDocument.documentElement;o={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return l.top>Math.min(o.bottom,t.bottom)-10||l.bottom{a.target==l&&a.preventDefault()});let o=null;for(let a=i.from;ai.from||i.from==0))if(o=b,typeof d!="string"&&d.header)l.appendChild(d.header(d));else{let v=l.appendChild(document.createElement("completion-section"));v.textContent=b}}const m=l.appendChild(document.createElement("li"));m.id=t+"-"+a,m.setAttribute("role","option");let g=this.optionClass(u);g&&(m.className=g);for(let b of this.optionContent){let v=b(u,this.view.state,this.view,f);v&&m.appendChild(v)}}return i.from&&l.classList.add("cm-completionListIncompleteTop"),i.tonew K6(t,n,e)}function Z6(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),l=t.height/n.offsetHeight;i.topt.bottom&&(n.scrollTop+=(i.bottom-t.bottom)/l)}function k2(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function J6(n,e){let t=[],i=null,l=null,o=m=>{t.push(m);let{section:g}=m.completion;if(g){i||(i=[]);let b=typeof g=="string"?g:g.name;i.some(v=>v.name==b)||i.push(typeof g=="string"?{name:b}:g)}},a=e.facet(Cn);for(let m of n)if(m.hasResult()){let g=m.result.getMatch;if(m.result.filter===!1)for(let b of m.result.options)o(new b2(b,m.source,g?g(b):[],1e9-t.length));else{let b=e.sliceDoc(m.from,m.to),v,w=a.filterStrict?new $6(b):new X6(b);for(let S of m.result.options)if(v=w.match(S.label)){let C=S.displayLabel?g?g(S,v.matched):[]:v.matched,N=v.score+(S.boost||0);if(o(new b2(S,m.source,C,N)),typeof S.section=="object"&&S.section.rank==="dynamic"){let{name:j}=S.section;l||(l=Object.create(null)),l[j]=Math.max(N,l[j]||-1e9)}}}}if(i){let m=Object.create(null),g=0,b=(v,w)=>(v.rank==="dynamic"&&w.rank==="dynamic"?l[w.name]-l[v.name]:0)||(typeof v.rank=="number"?v.rank:1e9)-(typeof w.rank=="number"?w.rank:1e9)||(v.nameb.score-g.score||d(g.completion,b.completion))){let g=m.completion;!f||f.label!=g.label||f.detail!=g.detail||f.type!=null&&g.type!=null&&f.type!=g.type||f.apply!=g.apply||f.boost!=g.boost?u.push(m):k2(m.completion)>k2(f)&&(u[u.length-1]=m),f=m.completion}return u}class ha{constructor(e,t,i,l,o,a){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=l,this.selected=o,this.disabled=a}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new ha(this.options,S2(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,l,o,a){if(l&&!a&&e.some(d=>d.isPending))return l.setDisabled();let u=J6(e,t);if(!u.length)return l&&e.some(d=>d.isPending)?l.setDisabled():null;let f=t.facet(Cn).selectOnOpen?0:-1;if(l&&l.selected!=f&&l.selected!=-1){let d=l.options[l.selected].completion;for(let m=0;mm.hasResult()?Math.min(d,m.from):d,1e8),create:lB,above:o.aboveCursor},l?l.timestamp:Date.now(),f,!1)}map(e){return new ha(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new ha(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Ld{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new Ld(iB,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(Cn),o=(i.override||t.languageDataAt("autocomplete",no(t)).map(Q6)).map(f=>(this.active.find(m=>m.source==f)||new Vi(f,this.active.some(m=>m.state!=0)?1:0)).update(e,i));o.length==this.active.length&&o.every((f,d)=>f==this.active[d])&&(o=this.active);let a=this.open,u=e.effects.some(f=>f.is(Jy));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||o.some(f=>f.hasResult()&&e.changes.touchesRange(f.from,f.to))||!eB(o,this.active)||u?a=ha.build(o,t,this.id,a,i,u):a&&a.disabled&&!o.some(f=>f.isPending)&&(a=null),!a&&o.every(f=>!f.isPending)&&o.some(f=>f.hasResult())&&(o=o.map(f=>f.hasResult()?new Vi(f.source,0):f));for(let f of e.effects)f.is(Zy)&&(a=a&&a.setSelected(f.value,this.id));return o==this.active&&a==this.open?this:new Ld(o,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?tB:nB}}function eB(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}const iB=[];function ZT(n,e){if(n.isUserEvent("input.complete")){let i=n.annotation(WT);if(i&&e.activateOnCompletion(i))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class Vi{constructor(e,t,i=!1){this.source=e,this.state=t,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let i=ZT(e,t),l=this;(i&8||i&16&&this.touches(e))&&(l=new Vi(l.source,0)),i&4&&l.state==0&&(l=new Vi(this.source,1)),l=l.updateFor(e,i);for(let o of e.effects)if(o.is(_d))l=new Vi(l.source,1,o.value);else if(o.is(bu))l=new Vi(l.source,0);else if(o.is(Jy))for(let a of o.value)a.source==l.source&&(l=a);return l}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(no(e.state))}}class ba extends Vi{constructor(e,t,i,l,o,a){super(e,3,t),this.limit=i,this.result=l,this.from=o,this.to=a}hasResult(){return!0}updateFor(e,t){var i;if(!(t&3))return this.map(e.changes);let l=this.result;l.map&&!e.changes.empty&&(l=l.map(l,e.changes));let o=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),u=no(e.state);if(u>a||!l||t&2&&(no(e.startState)==this.from||ut.map(e))}}),di=Fn.define({create(){return Ld.start()},update(n,e){return n.update(e)},provide:n=>[By.from(n,e=>e.tooltip),Oe.contentAttributes.from(n,e=>e.attrs)]});function eb(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(di).active.find(l=>l.source==e.source);return i instanceof ba?(typeof t=="string"?n.dispatch({...V6(n.state,t,i.from,i.to),annotations:WT.of(e.completion)}):t(n,e.completion,i.from,i.to),!0):!1}const lB=W6(di,eb);function Lh(n,e="option"){return t=>{let i=t.state.field(di,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+l*(n?1:-1):n?0:a-1;return u<0?u=e=="page"?0:a-1:u>=a&&(u=e=="page"?a-1:0),t.dispatch({effects:Zy.of(u)}),!0}}const sB=n=>{let e=n.state.field(di,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampn.state.field(di,!1)?(n.dispatch({effects:_d.of(!0)}),!0):!1,oB=n=>{let e=n.state.field(di,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:bu.of(null)}),!0)};class aB{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const cB=50,uB=1e3,fB=en.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(di).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(di),t=n.state.facet(Cn);if(!n.selectionSet&&!n.docChanged&&n.startState.field(di)==e)return;let i=n.transactions.some(o=>{let a=ZT(o,t);return a&8||(o.selection||o.docChanged)&&!(a&3)});for(let o=0;ocB&&Date.now()-a.time>uB){for(let u of a.context.abortListeners)try{u()}catch(f){pi(this.view.state,f)}a.context.abortListeners=null,this.running.splice(o--,1)}else a.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(o=>o.effects.some(a=>a.is(_d)))&&(this.pendingStart=!0);let l=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(o=>o.isPending&&!this.running.some(a=>a.active.source==o.source))?setTimeout(()=>this.startUpdate(),l):-1,this.composing!=0)for(let o of n.transactions)o.isUserEvent("input.type")?this.composing=2:this.composing==2&&o.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(di);for(let t of e.active)t.isPending&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Cn).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=no(e),i=new GT(e,t,n.explicit,this.view),l=new aB(n,i);this.running.push(l),Promise.resolve(n.source(i)).then(o=>{l.context.aborted||(l.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:bu.of(null)}),pi(this.view.state,o)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(Cn).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(Cn),i=this.view.state.field(di);for(let l=0;lu.source==o.active.source);if(a&&a.isPending)if(o.done==null){let u=new Vi(o.active.source,0);for(let f of o.updates)u=u.update(f,t);u.isPending||e.push(u)}else this.startQuery(a)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:Jy.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(di,!1);if(e&&e.tooltip&&this.view.state.facet(Cn).closeOnBlur){let t=e.open&&RN(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:bu.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:_d.of(!1)}),20),this.composing=0}}}),hB=typeof navigator=="object"&&/Win/.test(navigator.platform),dB=ao.highest(Oe.domEventHandlers({keydown(n,e){let t=e.state.field(di,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||!n.key||n.key.length>1||n.ctrlKey&&!(hB&&n.altKey)||n.metaKey)return!1;let i=t.open.options[t.open.selected],l=t.active.find(a=>a.source==i.source),o=i.completion.commitCharacters||l.result.commitCharacters;return o&&o.indexOf(n.key)>-1&&eb(e,i),!1}})),mB=Oe.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".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"}}}),vu={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Ws=Ke.define({map(n,e){let t=e.mapPos(n,-1,Zn.TrackAfter);return t??void 0}}),tb=new class extends is{};tb.startSide=1;tb.endSide=-1;const JT=Fn.define({create(){return st.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(Ws)&&(n=n.update({add:[tb.range(t.value,t.value+1)]}));return n}});function pB(){return[xB,JT]}const O0="()[]{}<>«»»«[]{}";function eA(n){for(let e=0;e{if((gB?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let l=n.state.selection.main;if(i.length>2||i.length==2&&Mr(hi(i,0))==1||e!=l.from||t!=l.to)return!1;let o=vB(n.state,i);return o?(n.dispatch(o),!0):!1}),yB=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=tA(n,n.selection.main.head).brackets||vu.brackets,l=null,o=n.changeByRange(a=>{if(a.empty){let u=wB(n.doc,a.head);for(let f of i)if(f==u&&cm(n.doc,a.head)==eA(hi(f,0)))return{changes:{from:a.head-f.length,to:a.head+f.length},range:oe.cursor(a.head-f.length)}}return{range:l=a}});return l||e(n.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!l},bB=[{key:"Backspace",run:yB}];function vB(n,e){let t=tA(n,n.selection.main.head),i=t.brackets||vu.brackets;for(let l of i){let o=eA(hi(l,0));if(e==l)return o==l?CB(n,l,i.indexOf(l+l+l)>-1,t):kB(n,l,o,t.before||vu.before);if(e==o&&nA(n,n.selection.main.from))return SB(n,l,o)}return null}function nA(n,e){let t=!1;return n.field(JT).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function cm(n,e){let t=n.sliceString(e,e+2);return t.slice(0,Mr(hi(t,0)))}function wB(n,e){let t=n.sliceString(e-2,e);return Mr(hi(t,0))==t.length?t:t.slice(1)}function kB(n,e,t,i){let l=null,o=n.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:t,from:a.to}],effects:Ws.of(a.to+e.length),range:oe.range(a.anchor+e.length,a.head+e.length)};let u=cm(n.doc,a.head);return!u||/\s/.test(u)||i.indexOf(u)>-1?{changes:{insert:e+t,from:a.head},effects:Ws.of(a.head+e.length),range:oe.cursor(a.head+e.length)}:{range:l=a}});return l?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function SB(n,e,t){let i=null,l=n.changeByRange(o=>o.empty&&cm(n.doc,o.head)==t?{changes:{from:o.head,to:o.head+t.length,insert:t},range:oe.cursor(o.head+t.length)}:i={range:o});return i?null:n.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function CB(n,e,t,i){let l=i.stringPrefixes||vu.stringPrefixes,o=null,a=n.changeByRange(u=>{if(!u.empty)return{changes:[{insert:e,from:u.from},{insert:e,from:u.to}],effects:Ws.of(u.to+e.length),range:oe.range(u.anchor+e.length,u.head+e.length)};let f=u.head,d=cm(n.doc,f),m;if(d==e){if(C2(n,f))return{changes:{insert:e+e,from:f},effects:Ws.of(f+e.length),range:oe.cursor(f+e.length)};if(nA(n,f)){let b=t&&n.sliceDoc(f,f+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:f,to:f+b.length,insert:b},range:oe.cursor(f+b.length)}}}else{if(t&&n.sliceDoc(f-2*e.length,f)==e+e&&(m=O2(n,f-2*e.length,l))>-1&&C2(n,m))return{changes:{insert:e+e+e+e,from:f},effects:Ws.of(f+e.length),range:oe.cursor(f+e.length)};if(n.charCategorizer(f)(d)!=Ft.Word&&O2(n,f,l)>-1&&!OB(n,f,e,l))return{changes:{insert:e+e,from:f},effects:Ws.of(f+e.length),range:oe.cursor(f+e.length)}}return{range:o=u}});return o?null:n.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function C2(n,e){let t=Un(n).resolveInner(e+1);return t.parent&&t.from==e}function OB(n,e,t,i){let l=Un(n).resolveInner(e,-1),o=i.reduce((a,u)=>Math.max(a,u.length),0);for(let a=0;a<5;a++){let u=n.sliceDoc(l.from,Math.min(l.to,l.from+t.length+o)),f=u.indexOf(t);if(!f||f>-1&&i.indexOf(u.slice(0,f))>-1){let m=l.firstChild;for(;m&&m.from==l.from&&m.to-m.from>t.length+f;){if(n.sliceDoc(m.to-t.length,m.to)==t)return!1;m=m.firstChild}return!0}let d=l.to==e&&l.parent;if(!d)break;l=d}return!1}function O2(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=Ft.Word)return e;for(let l of t){let o=e-l.length;if(n.sliceDoc(o,e)==l&&i(n.sliceDoc(o-1,o))!=Ft.Word)return o}return-1}function NB(n={}){return[dB,di,Cn.of(n),fB,TB,mB]}const iA=[{key:"Ctrl-Space",run:C0},{mac:"Alt-`",run:C0},{mac:"Alt-i",run:C0},{key:"Escape",run:oB},{key:"ArrowDown",run:Lh(!0)},{key:"ArrowUp",run:Lh(!1)},{key:"PageDown",run:Lh(!0,"page")},{key:"PageUp",run:Lh(!1,"page")},{key:"Enter",run:sB}],TB=ao.highest(Ly.computeN([Cn],n=>n.facet(Cn).defaultKeymap?[iA]:[]));class N2{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class Ys{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let l=i.facet(wu).markerFilter;l&&(e=l(e,i));let o=e.slice().sort((v,w)=>v.from-w.from||v.to-w.to),a=new Br,u=[],f=0,d=i.doc.iter(),m=0,g=i.doc.length;for(let v=0;;){let w=v==o.length?null:o[v];if(!w&&!u.length)break;let S,C;if(u.length)S=f,C=u.reduce((D,I)=>Math.min(D,I.to),w&&w.from>S?w.from:1e8);else{if(S=w.from,S>g)break;C=w.to,u.push(w),v++}for(;vD.from||D.to==S))u.push(D),v++,C=Math.min(D.to,C);else{C=Math.min(D.from,C);break}}C=Math.min(C,g);let N=!1;if(u.some(D=>D.from==S&&(D.to==C||C==g))&&(N=S==C,!N&&C-S<10)){let D=S-(m+d.value.length);D>0&&(d.next(D),m=S);for(let I=S;;){if(I>=C){N=!0;break}if(!d.lineBreak&&m+d.value.length>I)break;I=m+d.value.length,m+=d.value.length,d.next()}}let j=IB(u);if(N)a.add(S,S,Fe.widget({widget:new zB(j),diagnostics:u.slice()}));else{let D=u.reduce((I,U)=>U.markClass?I+" "+U.markClass:I,"");a.add(S,C,Fe.mark({class:"cm-lintRange cm-lintRange-"+j+D,diagnostics:u.slice(),inclusiveEnd:u.some(I=>I.to>C)}))}if(f=C,f==g)break;for(let D=0;D{if(!(e&&a.diagnostics.indexOf(e)<0))if(!i)i=new N2(l,o,e||a.diagnostics[0]);else{if(a.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new N2(i.from,o,i.diagnostic)}}),i}function AB(n,e){let t=e.pos,i=e.end||t,l=n.state.facet(wu).hideOn(n,t,i);if(l!=null)return l;let o=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(a=>a.is(rA))||n.changes.touchesRange(o.from,Math.max(o.to,i)))}function EB(n,e){return n.field(Di,!1)?e:e.concat(Ke.appendConfig.of(UB))}const rA=Ke.define(),nb=Ke.define(),lA=Ke.define(),Di=Fn.define({create(){return new Ys(Fe.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,l=n.panel;if(n.selected){let o=e.changes.mapPos(n.selected.from,1);i=cs(t,n.selected.diagnostic,o)||cs(t,null,o)}!t.size&&l&&e.state.facet(wu).autoPanel&&(l=null),n=new Ys(t,l,i)}for(let t of e.effects)if(t.is(rA)){let i=e.state.facet(wu).autoPanel?t.value.length?ku.open:null:n.panel;n=Ys.init(t.value,i,e.state)}else t.is(nb)?n=new Ys(n.diagnostics,t.value?ku.open:null,n.selected):t.is(lA)&&(n=new Ys(n.diagnostics,n.panel,t.value));return n},provide:n=>[mu.from(n,e=>e.panel),Oe.decorations.from(n,e=>e.diagnostics)]}),MB=Fe.mark({class:"cm-lintRange cm-lintRange-active"});function DB(n,e,t){let{diagnostics:i}=n.state.field(Di),l,o=-1,a=-1;i.between(e-(t<0?1:0),e+(t>0?1:0),(f,d,{spec:m})=>{if(e>=f&&e<=d&&(f==d||(e>f||t>0)&&(eoA(n,t,!1)))}const jB=n=>{let e=n.state.field(Di,!1);(!e||!e.panel)&&n.dispatch({effects:EB(n.state,[nb.of(!0)])});let t=nm(n,ku.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},T2=n=>{let e=n.state.field(Di,!1);return!e||!e.panel?!1:(n.dispatch({effects:nb.of(!1)}),!0)},_B=n=>{let e=n.state.field(Di,!1);if(!e)return!1;let t=n.state.selection.main,i=cs(e.diagnostics,null,t.to+1);return!i&&(i=cs(e.diagnostics,null,0),!i||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),E_(n,i.from,1,{tooltip:aA,until:l=>l.docChanged||l.newSelection.main.headi.to}),!0)},LB=[{key:"Mod-Shift-m",run:jB,preventDefault:!0},{key:"F8",run:_B}],wu=Ce.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...Pr(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:A2,tooltipFilter:A2,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,l,o)=>e(i,l,o)||t(i,l,o):e:t,autoPanel:(e,t)=>e||t})}}});function A2(n,e){return n?e?(t,i)=>e(n(t,i),i):n:e}function sA(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;io.toLowerCase()==l.toLowerCase())){e.push(l);continue e}}e.push("")}return e}function oA(n,e,t){var i;let l=t?sA(e.actions):[];return Nt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Nt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((o,a)=>{let u=!1,f=v=>{if(v.preventDefault(),u)return;u=!0;let w=cs(n.state.field(Di).diagnostics,e);w&&o.apply(n,w.from,w.to)},{name:d}=o,m=l[a]?d.indexOf(l[a]):-1,g=m<0?d:[d.slice(0,m),Nt("u",d.slice(m,m+1)),d.slice(m+1)],b=o.markClass?" "+o.markClass:"";return Nt("button",{type:"button",class:"cm-diagnosticAction"+b,onclick:f,onmousedown:f,"aria-label":` Action: ${d}${m<0?"":` (access key "${l[a]})"`}.`},g)}),e.source&&Nt("div",{class:"cm-diagnosticSource"},e.source))}class zB extends fl{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Nt("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class E2{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=oA(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class ku{constructor(e){this.view=e,this.items=[];let t=l=>{if(!(l.ctrlKey||l.altKey||l.metaKey)){if(l.keyCode==27)T2(this.view),this.view.focus();else if(l.keyCode==38||l.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(l.keyCode==40||l.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(l.keyCode==36)this.moveSelection(0);else if(l.keyCode==35)this.moveSelection(this.items.length-1);else if(l.keyCode==13)this.view.focus();else if(l.keyCode>=65&&l.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:o}=this.items[this.selectedIndex],a=sA(o.actions);for(let u=0;u{for(let o=0;oT2(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Di).selected;if(!e)return-1;for(let t=0;t{for(let m of d.diagnostics){if(a.has(m))continue;a.add(m);let g=-1,b;for(let v=i;vi&&(this.items.splice(i,g-i),l=!0)),t&&b.diagnostic==t.diagnostic?b.dom.hasAttribute("aria-selected")||(b.dom.setAttribute("aria-selected","true"),o=b):b.dom.hasAttribute("aria-selected")&&b.dom.removeAttribute("aria-selected"),i++}});i({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:u,panel:f})=>{let d=f.height/this.list.offsetHeight;u.topf.bottom&&(this.list.scrollTop+=(u.bottom-f.bottom)/d)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),l&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Di),i=cs(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:lA.of(i)})}static open(e){return new ku(e)}}function BB(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(n)}')`}function zh(n){return BB(``,'width="6" height="3"')}const PB=Oe.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-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:zh("#f11")},".cm-lintRange-warning":{backgroundImage:zh("orange")},".cm-lintRange-info":{backgroundImage:zh("#999")},".cm-lintRange-hint":{backgroundImage:zh("#66d")},".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-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".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}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function HB(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function IB(n){let e="hint",t=1;for(let i of n){let l=HB(i.severity);l>t&&(t=l,e=i.severity)}return e}const aA=A_(DB,{hideOn:AB}),UB=[Di,Oe.decorations.compute([Di],n=>{let{selected:e,panel:t}=n.field(Di);return!e||!t||e.from==e.to?Fe.none:Fe.set([MB.range(e.from,e.to)])}),aA,PB],FB=[q_(),X_(),l_(),az(),LL(),$j(),Jj(),gt.allowMultipleSelections.of(!0),wL(),lT(HL,{fallback:!0}),XL(),pB(),NB(),x_(),v_(),f_(),x6(),Ly.of([...bB,...h6,...P6,...xz,...DL,...iA,...LB])];var M2={};class zd{constructor(e,t,i,l,o,a,u,f,d,m=0,g){this.p=e,this.stack=t,this.state=i,this.reducePos=l,this.pos=o,this.score=a,this.buffer=u,this.bufferBase=f,this.curContext=d,this.lookAhead=m,this.parent=g}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let l=e.parser.context;return new zd(e,[],t,i,i,0,[],0,l?new D2(l,l.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 i=e>>19,l=e&65535,{parser:o}=this.p,a=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[l])===null||t===void 0)&&t.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=m):this.p.lastBigReductionSizef;)this.stack.pop();this.reduceContext(l,d)}storeNode(e,t,i,l=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[a-4]==0&&this.buffer[a-1]>-1){if(t==i)return;if(this.buffer[a-2]>=t){this.buffer[a-2]=i;return}}}if(!o||this.pos==i)this.buffer.push(e,t,i,l);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let u=!1;for(let f=a;f>0&&this.buffer[f-2]>i;f-=4)if(this.buffer[f-1]>=0){u=!0;break}if(u)for(;a>0&&this.buffer[a-2]>i;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,l>4&&(l-=4)}this.buffer[a]=e,this.buffer[a+1]=t,this.buffer[a+2]=i,this.buffer[a+3]=l}}shift(e,t,i,l){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let o=e,{parser:a}=this.p;this.pos=l;let u=a.stateFlag(o,1);!u&&(l>i||t<=a.maxNode)&&(this.reducePos=l),this.pushState(o,u?i:Math.min(i,this.reducePos)),this.shiftContext(t,i),t<=a.maxNode&&this.buffer.push(t,i,l,4)}else this.pos=l,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,l,4)}apply(e,t,i,l){e&65536?this.reduce(e):this.shift(e,t,i,l)}useNode(e,t,i){let l=this.p.reused.length-1;(l<0||this.p.reused[l]!=e)&&(this.p.reused.push(e),l++);let o=this.reducePos=this.pos=i+e.length;this.pushState(t,i),this.buffer.push(l,i,o,-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&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),l=e.bufferBase+t;for(;e&&l==e.bufferBase;)e=e.parent;return new zd(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,l,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new qB(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if((i&65536)==0)return!0;t.reduce(i)}}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 l=[];for(let o=0,a;of&1&&u==a)||l.push(t[o],a)}t=l}let i=[];for(let l=0;l>19,l=t&65535,o=this.stack.length-i*3;if(o<0||e.getGoto(this.stack[o],l,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;t=a}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=[],i=(l,o)=>{if(!t.includes(l))return t.push(l),e.allActions(l,a=>{if(!(a&393216))if(a&65536){let u=(a>>19)-o;if(u>1){let f=a&65535,d=this.stack.length-u*3;if(d>=0&&e.getGoto(this.stack[d],f,!1)>=0)return u<<19|65536|f}}else{let u=i(a,o+1);if(u!=null)return u}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}}class D2{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class qB{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let l=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=l}}class Bd{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Bd(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Bd(this.stack,this.pos,this.index)}}function Bh(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let i=0,l=0;i=92&&a--,a>=34&&a--;let f=a-32;if(f>=46&&(f-=46,u=!0),o+=f,u)break;o*=46}t?t[l++]=o:t=new e(o)}return t}class sd{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const R2=new sd;class VB{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=R2,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 i=this.range,l=this.rangeIndex,o=this.pos+e;for(;oi.to:o>=i.to;){if(l==this.ranges.length-1)return null;let a=this.ranges[++l];o+=a.from-i.to,i=a}return o}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,l;if(t>=0&&t=this.chunk2Pos&&iu.to&&(this.chunk2=this.chunk2.slice(0,u.to-i)),l=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),l}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i=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=R2,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 i="";for(let l of this.ranges){if(l.from>=t)break;l.to>e&&(i+=this.input.read(Math.max(l.from,e),Math.min(l.to,t)))}return i}}class va{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;QB(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}va.prototype.contextual=va.prototype.fallback=va.prototype.extend=!1;va.prototype.fallback=va.prototype.extend=!1;class um{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function QB(n,e,t,i,l,o){let a=0,u=1<0){let w=n[v];if(f.allows(w)&&(e.token.value==-1||e.token.value==w||XB(w,e.token.value,l,o))){e.acceptToken(w);break}}let m=e.next,g=0,b=n[a+2];if(e.next<0&&b>g&&n[d+b*3-3]==65535){a=n[d+b*3-1];continue e}for(;g>1,w=d+v+(v<<1),S=n[w],C=n[w+1]||65536;if(m=C)g=v+1;else{a=n[w+2],e.advance();continue e}}break}}function j2(n,e,t){for(let i=e,l;(l=n[i])!=65535;i++)if(l==t)return i-e;return-1}function XB(n,e,t,i){let l=j2(t,i,e);return l<0||j2(t,i,n)e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(n.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:n.length}}class $B{constructor(e,t){this.fragments=e,this.minRepeat=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?_2(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?_2(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(o instanceof fn){let u=a>this.lastRepeatPos&&o.type.id>=this.minRepeat;if(a==e||u){let f=a+o.length,d;if(a>=this.safeFrom&&f<=this.safeTo&&(!(d=o.prop(tt.lookAhead))||f+d=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+o.length}}}class YB{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new sd)}getActions(e){let t=0,i=null,{parser:l}=e.p,{tokenizers:o}=l,a=l.stateSlot(e.state,3),u=e.curContext?e.curContext.hash:0,f=0;for(let d=0;dg.end+25&&(f=Math.max(g.lookAhead,f)),g.value!=0)){let b=t;if(g.extended>-1&&(t=this.addActions(e,g.extended,g.end,t)),t=this.addActions(e,g.value,g.end,t),!m.extend&&(i=g,t>b))break}}for(;this.actions.length>t;)this.actions.pop();return f&&e.setLookAhead(f),!i&&e.pos==this.stream.end&&(i=new sd,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new sd,{pos:i,p:l}=e;return t.start=i,t.end=Math.min(i+1,l.stream.end),t.value=i==l.stream.end?l.parser.eofTerm:0,t}updateCachedToken(e,t,i){let l=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(l,e),i),e.value>-1){let{parser:o}=i.p;for(let a=0;a=0&&i.p.parser.dialect.allows(u>>1)){(u&1)==0?e.value=u>>1:e.extended=u>>1;break}}}else e.value=0,e.end=this.stream.clipPos(l+1)}putAction(e,t,i,l){for(let o=0;oe.bufferLength*4?new $B(i,e.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],l,o;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;at)i.push(u);else{if(this.advanceStack(u,i,e))continue;{l||(l=[],o=[]),l.push(u);let f=this.tokens.getMainToken(u);o.push(f.value,f.end)}}break}}if(!i.length){let a=l&&ZB(l);if(a)return Ai&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw Ai&&l&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&l){let a=this.stoppedAt!=null&&l[0].pos>this.stoppedAt?l[0]:this.runRecovery(l,o,i);if(a)return Ai&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(i.length>a)for(i.sort((u,f)=>f.score-u.score);i.length>a;)i.pop();i.some(u=>u.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let a=0;a500&&d.buffer.length>500)if((u.score-d.score||u.buffer.length-d.buffer.length)>0)i.splice(f--,1);else{i.splice(a--,1);continue e}}}i.length>12&&(i.sort((a,u)=>u.score-a.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let a=1;a-1&&i.length&&(!o||(i.prop(tt.contextHash)||0)==a))return e.useNode(i,u,t),i;if(i.children.length==0||i.positions[0]>0)break;let f=i.children[0];if(f instanceof fn&&(!l||f.type.id>=this.parser.minRepeatTerm))i=f;else break}return null}advanceStack(e,t,i){let l=e.pos,{parser:o}=this,a=Ai?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&l>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.reducePos0)return e.reduce(u),Ai&&console.log(a+this.stackID(e)+` (via always-reduce ${o.getName(u&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let f=this.tokens.getActions(e);for(let d=0;dl?t.push(w):i.push(w)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return L2(e,t),!0}}runRecovery(e,t,i){let l=null,o=!1;for(let a=0;a ":"";if(u.deadEnd&&(o||(o=!0,u.restart(),Ai&&console.log(m+this.stackID(u)+" (restarted)"),this.advanceFully(u,i))))continue;let g=u.split(),b=m;for(let v=0;v<10&&g.forceReduce()&&(Ai&&console.log(b+this.stackID(g)+" (via force-reduce)"),!this.advanceFully(g,i));v++)Ai&&(b=this.stackID(g)+" -> ");for(let v of u.recoverByInsert(f))Ai&&console.log(m+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,i);this.stream.end>u.pos?(d==u.pos&&(d++,f=0),u.recoverByDelete(f,d),Ai&&console.log(m+this.stackID(u)+` (via recover-delete ${this.parser.getName(f)})`),L2(u,i)):(!l||l.scoren;class WB{constructor(e){this.start=e.start,this.shift=e.shift||T0,this.reduce=e.reduce||T0,this.reuse=e.reuse||T0,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Pd extends FN{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let u=0;ue.topRules[u][1]),l=[];for(let u=0;u=0)o(m,f,u[d++]);else{let g=u[d+-m];for(let b=-m;b>0;b--)o(u[d++],f,g);d++}}}this.nodeSet=new Py(t.map((u,f)=>xi.define({name:f>=this.minRepeatTerm?void 0:u,id:f,props:l[f],top:i.indexOf(f)>-1,error:f==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(f)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=PN;let a=Bh(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let u=0;utypeof u=="number"?new va(a,u):u),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,i){let l=new GB(this,e,t,i);for(let o of this.wrappers)l=o(l,e,t,i);return l}getGoto(e,t,i=!1){let l=this.goto;if(t>=l[0])return-1;for(let o=l[t+1];;){let a=l[o++],u=a&1,f=l[o++];if(u&&i)return f;for(let d=o+(a>>1);o0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),l=i?t(i):void 0;for(let o=this.stateSlot(e,1);l==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=il(this.data,o+2);else break;l=t(il(this.data,o+1))}return l}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=il(this.data,i+2);else break;if((this.data[i+2]&1)==0){let l=this.data[i+1];t.some((o,a)=>a&1&&o==l)||t.push(this.data[i],l)}}return t}configure(e){let t=Object.assign(Object.create(Pd.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let l=e.tokenizers.find(o=>o.from==i);return l?l.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,l)=>{let o=e.specializers.find(u=>u.from==i.external);if(!o)return i;let a=Object.assign(Object.assign({},i),{external:o.to});return t.specializers[l]=z2(a),a})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(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 t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let o of e.split(" ")){let a=t.indexOf(o);a>=0&&(i[a]=!0)}let l=null;for(let o=0;oi)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scoren.external(t,i)<<1|e}return n.get}const la=63,B2=64,JB=1,e9=2,cA=3,t9=4,uA=5,n9=6,i9=7,fA=65,r9=66,l9=8,s9=9,o9=10,a9=11,c9=12,hA=13,u9=19,f9=20,h9=29,d9=33,m9=34,p9=47,g9=0,ib=1,Yx=2,Su=3,Gx=4;class Gs{constructor(e,t,i){this.parent=e,this.depth=t,this.type=i,this.hash=(e?e.hash+e.hash<<8:0)+t+(t<<4)+i}}Gs.top=new Gs(null,-1,g9);function iu(n,e){for(let t=0,i=e-n.pos-1;;i--,t++){let l=n.peek(i);if(cl(l)||l==-1)return t}}function Kx(n){return n==32||n==9}function cl(n){return n==10||n==13}function dA(n){return Kx(n)||cl(n)}function Zs(n){return n<0||dA(n)}const x9=new WB({start:Gs.top,reduce(n,e){return n.type==Su&&(e==f9||e==m9)?n.parent:n},shift(n,e,t,i){if(e==cA)return new Gs(n,iu(i,i.pos),ib);if(e==fA||e==uA)return new Gs(n,iu(i,i.pos),Yx);if(e==la)return n.parent;if(e==u9||e==d9)return new Gs(n,0,Su);if(e==hA&&n.type==Gx)return n.parent;if(e==p9){let l=/[1-9]/.exec(i.read(i.pos,t.pos));if(l)return new Gs(n,n.depth+ +l[0],Gx)}return n},hash(n){return n.hash}});function Ra(n,e,t=0){return n.peek(t)==e&&n.peek(t+1)==e&&n.peek(t+2)==e&&Zs(n.peek(t+3))}const y9=new um((n,e)=>{if(n.next==-1&&e.canShift(B2))return n.acceptToken(B2);let t=n.peek(-1);if((cl(t)||t<0)&&e.context.type!=Su){if(Ra(n,45))if(e.canShift(la))n.acceptToken(la);else return n.acceptToken(JB,3);if(Ra(n,46))if(e.canShift(la))n.acceptToken(la);else return n.acceptToken(e9,3);let i=0;for(;n.next==32;)i++,n.advance();(i{if(e.context.type==Su){n.next==63&&(n.advance(),Zs(n.next)&&n.acceptToken(i9));return}if(n.next==45)n.advance(),Zs(n.next)&&n.acceptToken(e.context.type==ib&&e.context.depth==iu(n,n.pos-1)?t9:cA);else if(n.next==63)n.advance(),Zs(n.next)&&n.acceptToken(e.context.type==Yx&&e.context.depth==iu(n,n.pos-1)?n9:uA);else{let t=n.pos;for(;;)if(Kx(n.next)){if(n.pos==t)return;n.advance()}else if(n.next==33)mA(n);else if(n.next==38)Wx(n);else if(n.next==42){Wx(n);break}else if(n.next==39||n.next==34){if(rb(n,!0))break;return}else if(n.next==91||n.next==123){if(!w9(n))return;break}else{pA(n,!0,!1,0);break}for(;Kx(n.next);)n.advance();if(n.next==58){if(n.pos==t&&e.canShift(h9))return;let i=n.peek(1);Zs(i)&&n.acceptTokenTo(e.context.type==Yx&&e.context.depth==iu(n,t)?r9:fA,t)}}},{contextual:!0});function v9(n){return n>32&&n<127&&n!=34&&n!=37&&n!=44&&n!=60&&n!=62&&n!=92&&n!=94&&n!=96&&n!=123&&n!=124&&n!=125}function P2(n){return n>=48&&n<=57||n>=97&&n<=102||n>=65&&n<=70}function H2(n,e){return n.next==37?(n.advance(),P2(n.next)&&n.advance(),P2(n.next)&&n.advance(),!0):v9(n.next)||e&&n.next==44?(n.advance(),!0):!1}function mA(n){if(n.advance(),n.next==60){for(n.advance();;)if(!H2(n,!0)){n.next==62&&n.advance();break}}else for(;H2(n,!1););}function Wx(n){for(n.advance();!Zs(n.next)&&Hd(n.next)!="f";)n.advance()}function rb(n,e){let t=n.next,i=!1,l=n.pos;for(n.advance();;){let o=n.next;if(o<0)break;if(n.advance(),o==t)if(o==39)if(n.next==39)n.advance();else break;else break;else if(o==92&&t==34)n.next>=0&&n.advance();else if(cl(o)){if(e)return!1;i=!0}else if(e&&n.pos>=l+1024)return!1}return!i}function w9(n){for(let e=[],t=n.pos+1024;;)if(n.next==91||n.next==123)e.push(n.next),n.advance();else if(n.next==39||n.next==34){if(!rb(n,!0))return!1}else if(n.next==93||n.next==125){if(e[e.length-1]!=n.next-2)return!1;if(e.pop(),n.advance(),!e.length)return!0}else{if(n.next<0||n.pos>t||cl(n.next))return!1;n.advance()}}const k9="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function Hd(n){return n<33?"u":n>125?"s":k9[n-33]}function A0(n,e){let t=Hd(n);return t!="u"&&!(e&&t=="f")}function pA(n,e,t,i){if(Hd(n.next)=="s"||(n.next==63||n.next==58||n.next==45)&&A0(n.peek(1),t))n.advance();else return!1;let l=n.pos;for(;;){let o=n.next,a=0,u=i+1;for(;dA(o);){if(cl(o)){if(e)return!1;u=0}else u++;o=n.peek(++a)}if(!(o>=0&&(o==58?A0(n.peek(a+1),t):o==35?n.peek(a-1)!=32:A0(o,t)))||!t&&u<=i||u==0&&!t&&(Ra(n,45,a)||Ra(n,46,a)))break;if(e&&Hd(o)=="f")return!1;for(let d=a;d>=0;d--)n.advance();if(e&&n.pos>l+1024)return!1}return!0}const S9=new um((n,e)=>{if(n.next==33)mA(n),n.acceptToken(c9);else if(n.next==38||n.next==42){let t=n.next==38?o9:a9;Wx(n),n.acceptToken(t)}else n.next==39||n.next==34?(rb(n,!1),n.acceptToken(s9)):pA(n,!1,e.context.type==Su,e.context.depth)&&n.acceptToken(l9)}),C9=new um((n,e)=>{let t=e.context.type==Gx?e.context.depth:-1,i=n.pos;e:for(;;){let l=0,o=n.next;for(;o==32;)o=n.peek(++l);if(!l&&(Ra(n,45,l)||Ra(n,46,l))||!cl(o)&&(t<0&&(t=Math.max(e.context.depth+1,l)),lYAN>Y",stateData:";S~O!fOS!gOS^OS~OP_OQbORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!V[O!cTO~O`cO~P]OVkOWROXROYeOZfO[dOcPOmhOqQO~OboO~P!bOVtOWROXROYeOZfO[dOcPOmrOqQO~OpwO~P#WORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!cTO~OSvP!avP!bvP~P#|OWROXROYeOZfO[dOcPOqQO~OmzO~P%OOm!OOUzP!azP!bzP!dzP~P#|O^!SO!b!QO!f!TO!g!RO~ORSOTUOWROXROcPOqQO!PVO!cTO~OY!UOP!QXQ!QX!V!QX!`!QXS!QX!a!QX!b!QXU!QXm!QX!d!QX~P&aO[!WOP!SXQ!SX!V!SX!`!SXS!SX!a!SX!b!SXU!SXm!SX!d!SX~P&aO^!ZO!W![O!b!YO!f!]O!g!YO~OP!_O!V[OQaX!`aX~OPaXQaX!VaX!`aX~P#|OP!bOQ!cO!V[O~OP_O!V[O~P#|OWROXROY!fOcPOqQObfXmfXofXpfX~OWROXRO[!hOcPOqQObhXmhXohXphX~ObeXmlXoeX~ObkXokX~P%OOm!kO~Om!lObnPonP~P%OOb!pOo!oO~Ob!pO~P!bOm!sOosXpsX~OosXpsX~P%OOm!uOotPptP~P%OOo!xOp!yO~Op!yO~P#WOS!|O!a#OO!b#OO~OUyX!ayX!byX!dyX~P#|Om#QO~OU#SO!a#UO!b#UO!d#RO~Om#WOUzX!azX!bzX!dzX~O]#XO~O!b#XO!g#YO~O^#ZO!b#XO!g#YO~OP!RXQ!RX!V!RX!`!RXS!RX!a!RX!b!RXU!RXm!RX!d!RX~P&aOP!TXQ!TX!V!TX!`!TXS!TX!a!TX!b!TXU!TXm!TX!d!TX~P&aO!b#^O!g#^O~O^#_O!b#^O!f#`O!g#^O~O^#_O!W#aO!b#^O!g#^O~OPaaQaa!Vaa!`aa~P#|OP#cO!V[OQ!XX!`!XX~OP!XXQ!XX!V!XX!`!XX~P#|OP_O!V[OQ!_X!`!_X~P#|OWROXROcPOqQObgXmgXogXpgX~OWROXROcPOqQObiXmiXoiXpiX~Obkaoka~P%OObnXonX~P%OOm#kO~Ob#lOo!oO~Oosapsa~P%OOotXptX~P%OOm#pO~Oo!xOp#qO~OSwP!awP!bwP~P#|OS!|O!a#vO!b#vO~OUya!aya!bya!dya~P#|Om#xO~P%OOm#{OU}P!a}P!b}P!d}P~P#|OU#SO!a$OO!b$OO!d#RO~O]$QO~O!b$QO!g$RO~O!b$SO!g$SO~O^$TO!b$SO!g$SO~O^$TO!b$SO!f$UO!g$SO~OP!XaQ!Xa!V!Xa!`!Xa~P#|Obnaona~P%OOotapta~P%OOo!xO~OU|X!a|X!b|X!d|X~P#|Om$ZO~Om$]OU}X!a}X!b}X!d}X~O]$^O~O!b$_O!g$_O~O^$`O!b$_O!g$_O~OU|a!a|a!b|a!d|a~P#|O!b$cO!g$cO~O",goto:",]!mPPPPPPPPPPPPPPPPP!nPP!v#v#|$`#|$c$f$j$nP%VPPP!v%Y%^%a%{&O%a&R&U&X&_&b%aP&e&{&e'O'RPP']'a'g'm's'y(XPPPPPPPP(_)e*X+c,VUaObcR#e!c!{ROPQSTUXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:"⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document",maxTerm:74,context:x9,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[O9],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[y9,b9,S9,C9,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),T9=Sd.define({name:"yaml",parser:N9.configure({props:[$N.add({Stream:n=>{for(let e=n.node.resolve(n.pos,-1);e&&e.to>=n.pos;e=e.parent){if(e.name=="BlockLiteralContent"&&e.fromn.pos)return null}}return null},FlowMapping:e2({closing:"}"}),FlowSequence:e2({closing:"]"})}),KN.add({"FlowMapping FlowSequence":SL,"Item Pair BlockLiteral":(n,e)=>({from:e.doc.lineAt(n.from).to,to:n.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});function A9(){return new hL(T9)}const I2='button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], video[tabindex], [tabindex]:not([tabindex="-1"])';function ds({isOpen:n,onClose:e,dialogRef:t,initialFocusRef:i}){return M.useEffect(()=>{if(!n)return;const l=document.activeElement instanceof HTMLElement?document.activeElement:null,o=requestAnimationFrame(()=>{var f;const u=(i==null?void 0:i.current)??((f=t.current)==null?void 0:f.querySelector(I2))??t.current;u==null||u.focus()}),a=u=>{if(u.key!=="Tab")return;const f=t.current;if(!f)return;const d=Array.from(f.querySelectorAll(I2));if(!d.length)return;const m=d[0],g=d[d.length-1],b=document.activeElement;if(!(b instanceof Node&&f.contains(b))){u.preventDefault(),(u.shiftKey?g:m).focus();return}u.shiftKey&&(b===m||b===f)?(u.preventDefault(),g.focus()):!u.shiftKey&&(b===g||b===f)&&(u.preventDefault(),m.focus())};return window.addEventListener("keydown",a,!0),()=>{cancelAnimationFrame(o),l==null||l.focus(),window.removeEventListener("keydown",a,!0)}},[n]),l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),e())}}function Js({isOpen:n,title:e,message:t,confirmLabel:i="Confirm",cancelLabel:l="Cancel",danger:o=!1,onConfirm:a,onCancel:u}){const f=M.useRef(null),d=M.useRef(null),m=ds({isOpen:n,onClose:u,dialogRef:f,initialFocusRef:d});return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",onClick:u,children:y.jsxs("div",{ref:f,role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",onKeyDown:m,onClick:g=>g.stopPropagation(),className:"animate-modal-in w-[400px] max-w-full rounded-2xl border border-frame-line glass-panel p-5",children:[y.jsxs("div",{className:"mb-3 flex items-center gap-2.5",children:[y.jsx("span",{className:`grid h-9 w-9 shrink-0 place-items-center rounded-lg ${o?"bg-status-danger-bg text-status-danger-text":"bg-chip-indigo-bg text-chip-indigo-text"}`,children:y.jsx(by,{className:"h-5 w-5"})}),y.jsx("h2",{id:"confirm-dialog-title",className:"text-sm font-semibold text-ink",children:e})]}),y.jsx("div",{className:"mb-5 whitespace-pre-line text-xs text-ink-secondary",children:t}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx("button",{ref:d,type:"button",onClick:u,className:"min-h-9 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:l}),y.jsx("button",{type:"button",onClick:a,className:`min-h-9 rounded-lg border px-4 text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400 ${o?"border-status-danger-border bg-status-danger-bg/30 text-status-danger-text hover:bg-status-danger-bg/60":"btn-primary border-transparent bg-indigo-600 text-white hover:bg-indigo-500"}`,children:i})]})]})}):null}var E9=YC();const Ar=8,Jl=8,M9=400,U2={top:"bottom",bottom:"top",left:"right",right:"left"},D9={top:"-bottom-1 left-1/2 -translate-x-1/2",bottom:"-top-1 left-1/2 -translate-x-1/2",left:"-right-1 top-1/2 -translate-y-1/2",right:"-left-1 top-1/2 -translate-y-1/2"},R9={top:"border-b border-r",bottom:"border-t border-l",left:"border-t border-r",right:"border-b border-l"},F2=(n,e,t)=>{switch(n){case"top":return e.top-Jl-t.h>=Ar;case"bottom":return e.bottom+Jl+t.h<=window.innerHeight-Ar;case"left":return e.left-Jl-t.w>=Ar;default:return e.right+Jl+t.w<=window.innerWidth-Ar}},j9=(n,e,t)=>{if(n==="top"||n==="bottom"){const a=e.left+e.width/2-t.w/2,u=window.innerWidth-t.w-Ar;return{x:Math.min(Math.max(a,Ar),Math.max(Ar,u))-a,y:0}}const i=e.top+e.height/2-t.h/2,l=window.innerHeight-t.h-Ar;return{x:0,y:Math.min(Math.max(i,Ar),Math.max(Ar,l))-i}},$e=({text:n,children:e,block:t=!0,placement:i="top",suppress:l=!1})=>{const o=M.useRef(null),a=M.useRef(null),u=M.useId(),f=M.useRef(null),[d,m]=M.useState(!1),[g,b]=M.useState(i),[v,w]=M.useState({x:0,y:0}),[S,C]=M.useState({left:-9999,top:-9999}),N=()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null)};M.useEffect(()=>{l&&(N(),m(!1))},[l]),M.useEffect(()=>()=>N(),[]);const j=M.useCallback(()=>{const E=o.current,T=a.current;if(!E||!T)return;const z=E.getBoundingClientRect(),te={w:T.offsetWidth,h:T.offsetHeight},q=F2(i,z,te)?i:F2(U2[i],z,te)?U2[i]:i,G=j9(q,z,te);b(q),w(G);const F=z.left+z.width/2,se=z.top+z.height/2;C(q==="top"?{left:F,top:z.top-Jl-te.h}:q==="bottom"?{left:F,top:z.bottom+Jl}:q==="left"?{left:z.left-Jl-te.w,top:se}:{left:z.right+Jl,top:se})},[i]);M.useEffect(()=>{if(!d)return;const E=()=>m(!1);return window.addEventListener("resize",E),window.addEventListener("scroll",E,!0),()=>{window.removeEventListener("resize",E),window.removeEventListener("scroll",E,!0)}},[d]);const D=E=>{if(l)return;N();const T=()=>{j(),m(!0)};E?T():f.current=window.setTimeout(T,M9)},I=()=>{N(),m(!1)};M.useEffect(()=>{if(!d)return;const E=T=>{T.key==="Escape"&&m(!1)};return document.addEventListener("keydown",E,!0),()=>document.removeEventListener("keydown",E,!0)},[d]),M.useEffect(()=>{if(!d)return;const E=()=>!!document.querySelector('[role="dialog"][aria-modal="true"], dialog[open]');if(E()){m(!1);return}const T=new MutationObserver(()=>{E()&&m(!1)});return T.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["role","aria-modal","open","class"]}),()=>T.disconnect()},[d]);const U={onMouseEnter:()=>D(!1),onMouseLeave:I,onFocus:()=>D(!0),onBlur:I,"aria-describedby":u};return y.jsxs("div",{ref:o,className:`group relative ${t?"flex min-w-0 flex-1 items-center":"inline-flex shrink-0 items-center"}`,onMouseEnter:()=>D(!1),onMouseLeave:I,onFocus:()=>D(!0),onBlur:I,children:[M.cloneElement(e,U),E9.createPortal(y.jsxs("span",{ref:a,id:u,role:"tooltip",className:`pointer-events-none invisible fixed z-[var(--z-tooltip)] w-max max-w-[calc(100vw-16px)] rounded-md border border-line bg-elevated px-2 py-1 text-left text-[11px] leading-relaxed text-ink shadow-lg ${d?"visible opacity-100":"opacity-0"}`,style:{left:S.left,top:S.top,transform:g==="top"||g==="bottom"?`translateX(calc(-50% + ${v.x}px))`:`translateY(calc(-50% + ${v.y}px))`},children:[n,y.jsx("span",{className:`absolute h-2 w-2 rotate-45 border-line bg-elevated ${D9[g]} ${R9[g]}`,style:g==="top"||g==="bottom"?{left:`calc(50% - ${v.x}px)`}:void 0})]}),document.body)]})},_9=[".profiles",".profiles.yaml"];function L9(n){const e=n.trim();if(!e)return null;const t=e.toLowerCase(),i=_9.find(l=>t.endsWith(l));if(i!==void 0){const l=e.slice(0,e.length-i.length);return!l.trim()||l!==l.trimEnd()?null:e}return t.includes(".")?null:`${e}.profiles`}function z9({open:n,onCancel:e,onConfirm:t}){const[i,l]=M.useState(null),[o,a]=M.useState(""),[u,f]=M.useState(""),[d,m]=M.useState(null),[g,b]=M.useState(!1),[v,w]=M.useState(null),[S,C]=M.useState(null),N=M.useRef(null),j=M.useRef(null),D=M.useRef(null),I=M.useCallback(async z=>{b(!0),w(null);try{const te=await KC(z);l(te),a(te.current_path)}catch(te){w(te instanceof Error?te.message:String(te))}finally{b(!1)}},[]);M.useEffect(()=>{if(!n)return;f(""),m(null),C(null),I(o);const z=requestAnimationFrame(()=>{var te;return(te=j.current)==null?void 0:te.focus()});return()=>cancelAnimationFrame(z)},[n]);const U=ds({isOpen:n,onClose:e,dialogRef:N,initialFocusRef:j});function E(){if(!i)return;const z=L9(u);if(z===null){m("Not a ProFiles configuration file. Allowed extensions: .profiles, .profiles.yaml");return}m(null);const te=o.trim()||i.current_path;if(o.trim()===i.current_path&&i.items.some(F=>!F.is_dir&&F.name===z)){C({filename:z,directory:te});return}t({filename:z,directory:te,overwrite:!1})}if(!n)return null;const T=(i==null?void 0:i.items.filter(z=>z.is_dir))??[];return y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-4 backdrop-blur-sm",onClick:e,children:y.jsxs("div",{ref:N,role:"dialog","aria-modal":"true","aria-labelledby":"save-as-dialog-title",onKeyDown:U,onClick:z=>z.stopPropagation(),className:"animate-modal-in flex max-h-[calc(100dvh-2rem)] w-[min(94vw,560px)] flex-col overflow-hidden rounded-xl border border-frame-line glass-panel sm:rounded-2xl",children:[y.jsx("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-line px-5 py-3",children:y.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx("span",{className:"grid h-8 w-8 shrink-0 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(rO,{className:"h-4 w-4 text-chip-indigo-text"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"save-as-dialog-title",className:"text-sm font-semibold text-ink",children:"Save configuration as"}),y.jsx("p",{className:"truncate font-mono text-xs text-ink-muted",children:(i==null?void 0:i.current_path)||"…"})]})]})}),y.jsxs("div",{className:"border-b border-line px-5 py-3",children:[y.jsx("label",{htmlFor:"save-as-path",className:"mb-1.5 block text-xs font-medium text-ink-secondary",children:"Location"}),y.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[y.jsx("input",{ref:D,id:"save-as-path",type:"text",value:o,onChange:z=>a(z.target.value),onKeyDown:z=>{z.key==="Enter"&&I(o.trim())},placeholder:"/path/to/directory",className:"h-9 min-w-0 flex-1 rounded-lg border border-line bg-elevated px-2.5 font-mono text-sm text-ink outline-none placeholder:text-ink-faint transition-colors hover:bg-surface-strong focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-indigo-500/30"}),y.jsx("button",{type:"button",onClick:()=>void I(o.trim()),className:"inline-flex h-9 shrink-0 items-center rounded-lg border border-line bg-elevated px-3 text-sm font-medium text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Go"}),y.jsx($e,{text:"Home directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>void I(""),"aria-label":"Home directory",className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx($d,{className:"h-4 w-4"})})}),(i==null?void 0:i.parent_path)&&y.jsx($e,{text:"Parent directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>void I(i.parent_path),"aria-label":"Parent directory",className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Xd,{className:"h-4 w-4 rotate-180"})})})]})]}),y.jsx("div",{className:"min-h-24 flex-1 overflow-y-auto px-2 py-2 sm:px-3","aria-busy":g,children:g?y.jsxs("div",{className:"flex h-full items-center justify-center gap-2.5 text-sm text-ink-muted",children:[y.jsx(sl,{className:"h-5 w-5 animate-spin text-chip-indigo-text"}),y.jsx("span",{role:"status",children:"Loading directories…"})]}):v?y.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-2.5 text-center",children:[y.jsx("p",{className:"text-sm text-status-danger-text",children:v}),y.jsx("button",{type:"button",onClick:()=>void I(o||(i==null?void 0:i.current_path)||""),className:"min-h-9 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Retry"})]}):y.jsxs("ul",{className:"space-y-0.5",children:[T.map(z=>y.jsx("li",{children:y.jsxs("button",{type:"button",onClick:()=>void I(z.path),className:"flex min-h-9 w-full items-center gap-2.5 rounded-lg px-3 py-1.5 text-left text-sm text-ink-secondary transition-colors hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-400",children:[y.jsx(Ou,{className:"h-4 w-4 shrink-0 text-chip-indigo-text"}),y.jsx("span",{className:"truncate",children:z.name})]})},z.path)),T.length===0&&y.jsxs("li",{className:"flex min-h-16 flex-col items-center justify-center gap-2 text-center text-sm text-ink-muted",children:[y.jsx(es,{className:"h-6 w-6 text-ink-faint"}),"No subdirectories found"]})]})}),y.jsxs("div",{className:"shrink-0 border-t border-line px-5 py-3",children:[y.jsx("label",{htmlFor:"save-as-filename",className:"mb-1.5 block text-xs font-medium text-ink-secondary",children:"File name"}),y.jsx("input",{ref:j,id:"save-as-filename",type:"text",value:u,onChange:z=>{f(z.target.value),m(null)},onKeyDown:z=>{z.key==="Enter"&&u.trim()&&E()},placeholder:"machine.profiles",className:"h-9 w-full rounded-lg border border-line bg-elevated px-2.5 font-mono text-sm text-ink outline-none placeholder:text-ink-faint transition-colors hover:bg-surface-strong focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-indigo-500/30"}),d&&y.jsx("p",{role:"alert","data-testid":"save-as-error",className:"mt-1.5 text-xs text-status-danger-text",children:d}),y.jsxs("div",{className:"mt-3 flex justify-end gap-1.5",children:[y.jsx("button",{type:"button",onClick:e,className:"min-h-9 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Cancel"}),y.jsxs("button",{type:"button",onClick:E,disabled:!u.trim()||!i||g,title:"Save the configuration to the selected folder",className:"btn btn-primary min-h-9 rounded-lg px-4 text-sm font-semibold",children:[y.jsx(Lr,{className:"h-4 w-4"}),"Save"]})]})]})]})}),y.jsx(Js,{isOpen:S!==null,title:"Replace configuration?",message:`A configuration named "${S==null?void 0:S.filename}" already exists in this folder. -Saving will replace it.`,confirmLabel:"Replace",cancelLabel:"Keep existing",danger:!0,onConfirm:()=>{const z=S;C(null),z&&t({...z,overwrite:!0})},onCancel:()=>C(null)})]})}const B9=800,P9=Oe.theme({"&":{height:"100%",fontSize:"12.5px",color:"var(--app-text-primary)",backgroundColor:"var(--app-editor-bg)"},".cm-scroller":{fontFamily:"'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",lineHeight:"1.6"},".cm-content":{caretColor:"var(--color-indigo-500, #6366f1)"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--color-indigo-500, #6366f1)"},"&.cm-focused":{outline:"none"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground":{backgroundColor:"var(--app-editor-selection)"},".cm-activeLine":{backgroundColor:"var(--app-editor-active-line)"},".cm-matchingBracket":{color:"inherit",backgroundColor:"var(--app-editor-selection)",outline:"1px solid var(--app-editor-border)"},".cm-nonmatchingBracket":{color:"inherit",outline:"1px solid var(--status-danger-border, #fb7185)"},".cm-gutters":{backgroundColor:"var(--app-editor-gutter-bg)",color:"var(--app-text-faint)",border:"none",borderRight:"1px solid var(--app-editor-border)"},".cm-activeLineGutter":{backgroundColor:"var(--app-editor-active-line)",color:"var(--app-text-secondary)"},".cm-panels":{backgroundColor:"var(--app-editor-bg)",color:"var(--app-text-primary)"},".cm-tooltip":{border:"1px solid var(--app-border)",backgroundColor:"var(--app-glass-panel-strong)",color:"var(--app-text-primary)"}}),H9=Mu.define([{tag:he.lineComment,color:"var(--app-editor-syntax-comment)"},{tag:[he.propertyName,he.definition(he.propertyName)],color:"var(--app-editor-syntax-key)"},{tag:[he.string,he.special(he.string)],color:"var(--app-editor-syntax-string)"},{tag:he.content,color:"var(--app-editor-syntax-string)"},{tag:[he.keyword,he.typeName],color:"var(--app-editor-syntax-keyword)"},{tag:he.labelName,color:"var(--app-editor-syntax-label)"}]);function E0(n){return n.replace(/\r\n?/g,` -`)}function Ph(n,e){return n!==null&&n.state.doc.toString()!==e}function I9(n){return n instanceof gy&&Array.isArray(n.detail)?{text:n.message,issues:n.detail}:{text:n instanceof Error?n.message:String(n),issues:[]}}function U9({open:n,onClose:e,onApplied:t,onLoadConfig:i,reloadKey:l=0}){const[o,a]=M.useState({status:"loading"}),[u,f]=M.useState(!1),[d,m]=M.useState(!1),[g,b]=M.useState(null),[v,w]=M.useState([]),[S,C]=M.useState({kind:"unknown"}),[N,j]=M.useState(!1),[D,I]=M.useState({line:1,col:1}),[U,E]=M.useState(null),[T,z]=M.useState(null),[te,q]=M.useState(null),[G,F]=M.useState(null),se=M.useRef(null),me=M.useRef(null),ne=M.useRef(null),_=M.useRef(""),Z=M.useRef(null),ie=M.useRef(0),re=M.useRef(new Map),A=M.useRef(null),Be=M.useRef(null),ze=M.useRef(!1),B=M.useRef(()=>{}),R=M.useRef(()=>{});ze.current=T!==null||te!==null||G!==null;const $=ds({isOpen:n,onClose:je,dialogRef:se});M.useEffect(()=>{if(!n){_.current="",Z.current=null,ne.current=null,a({status:"loading"}),f(!1),m(!1),b(null),w([]),C({kind:"unknown"}),j(!1),I({line:1,col:1}),E(null),z(null),q(null),F(null),A.current!==null&&(clearTimeout(A.current),A.current=null),Be.current=null,ie.current+=1,re.current.clear();return}let de=!1;return Bk().then(pe=>{if(de)return;const Ee=E0(pe.content);_.current=Ee,Z.current=pe.content_hash??null,Be.current=Ee,a({status:"ready",data:{...pe,content:Ee}})}).catch(pe=>{de||(_.current="",a({status:"error",message:pe instanceof Error?pe.message:String(pe)}))}),()=>{de=!0}},[n,l]);const ue=M.useCallback(()=>{A.current!==null&&(clearTimeout(A.current),A.current=null)},[]),ge=M.useCallback(de=>{ze.current||de!==Be.current&&(ue(),A.current=window.setTimeout(()=>{if(A.current=null,re.current.has("test")){R.current(de);return}B.current()},B9))},[ue]);M.useEffect(()=>{if(!n||o.status!=="ready")return;const de=me.current;if(!de)return;const pe=new Oe({doc:o.data.content,extensions:[FB,A9(),lT(H9),P9,Oe.updateListener.of(Ee=>{if(Ee.selectionSet||Ee.docChanged){const nt=Ee.state.selection.main.head,at=Ee.state.doc.lineAt(nt);I({line:at.number,col:nt-at.from+1})}Ee.docChanged&&(f(Ph(Ee.view,_.current)),b(null),w([]),C({kind:"unknown"}),j(!1),ge(Ee.state.doc.toString()))})],parent:de});return ne.current=pe,()=>{pe.destroy(),ne.current=null,ue()}},[n,o]);function je(){if(Ph(ne.current,_.current)){m(!0);return}e()}const Ne=M.useCallback(()=>{DM().catch(de=>{console.error("Failed to open config file in OS editor:",de)})},[]);function Pe(){var de;return((de=ne.current)==null?void 0:de.state.doc.toString())??_.current}const be=M.useCallback(async(de,pe)=>{if(re.current.has(de))return;const Ee=++ie.current;re.current.set(de,Ee);try{await pe(Ee)}finally{re.current.get(de)===Ee&&re.current.delete(de)}},[]),_e=M.useCallback(()=>be("new",async de=>{b(null),w([]);try{const pe=await TM();if(de!==ie.current)return;const Ee=E0(pe.content);_.current=Ee,Z.current=null,f(!1),a(nt=>nt.status==="ready"?{status:"ready",data:{...nt.data,filename:pe.filename,content:Ee,config_path:null}}:nt),b({kind:"ok",text:"New configuration template loaded."})}catch(pe){if(de!==ie.current)return;b({kind:"error",text:pe instanceof Error?pe.message:String(pe)})}}),[be]),Pt=M.useCallback(()=>be("revert",async de=>{b(null),w([]);try{const pe=await Bk();if(de!==ie.current)return;const Ee=E0(pe.content);_.current=Ee,Z.current=pe.content_hash??null,f(!1),a({status:"ready",data:{...pe,content:Ee}}),b({kind:"ok",text:"Configuration reloaded from disk."})}catch(pe){if(de!==ie.current)return;b({kind:"error",text:pe instanceof Error?pe.message:String(pe)})}}),[be]);function tn(){if(Ph(ne.current,_.current)){E("new");return}_e()}function gn(){if(Ph(ne.current,_.current)){E("revert");return}Pt()}const zt=M.useCallback(()=>be("test",async de=>{if(o.status!=="ready")return;ue();const pe=Pe();Be.current=pe,C({kind:"validating"});try{const Ee=await Pk(o.data.filename,pe);if(de!==ie.current)return;w(Ee.issues),Ee.valid?(C({kind:"valid"}),b({kind:"ok",text:"Configuration is valid."})):(C({kind:"invalid",count:Ee.issues.length}),j(!0),b({kind:"error",text:`Validation failed with ${Ee.issues.length} issue${Ee.issues.length===1?"":"s"}.`}))}catch(Ee){if(de!==ie.current)return;w([]),C({kind:"unknown"}),b({kind:"error",text:Ee instanceof Error?Ee.message:String(Ee)})}}),[o,be]);B.current=()=>void zt(),R.current=ge;const Ct=M.useCallback(()=>be("apply",async de=>{if(o.status==="ready")try{const pe=await GC(o.data.filename,Pe());if(de!==ie.current)return;b({kind:"ok",text:"Configuration applied (session trial)."}),t==null||t(pe)}catch(pe){if(de!==ie.current)return;b({kind:"error",text:pe instanceof Error?pe.message:String(pe)})}}),[o,t,be]),ot=M.useCallback(de=>new Promise(pe=>{z({issues:de,resolve:Ee=>{z(null),pe(Ee)}})}),[]),nn=M.useCallback(()=>new Promise(de=>{q({resolve:pe=>{q(null),de(pe)}})}),[]),Pn=M.useCallback(()=>new Promise(de=>{F({resolve:pe=>{F(null),de(pe)}})}),[]),Ht=M.useCallback((de,pe,Ee)=>{if(_.current=pe,Z.current=Ee,f(!1),w([]),C({kind:"unknown"}),z(null),q(null),de.config_path){const nt=de.config_path.split(/[\\/]/).pop()||de.title||"configuration";a(at=>at.status!=="ready"||!(at.data.filename!==nt||at.data.config_path!==de.config_path||at.data.session_trial)?at:{status:"ready",data:{...at.data,filename:nt,config_path:de.config_path,session_trial:!1,content:pe}})}t==null||t(de)},[t]),rn=M.useCallback(de=>{const pe=I9(de);z(null),q(null),w(pe.issues),pe.issues.length>0?(C({kind:"invalid",count:pe.issues.length}),j(!0)):C({kind:"unknown"}),b({kind:"error",text:pe.text})},[]),Se=M.useCallback((de,pe)=>be(de,async Ee=>{if(o.status!=="ready")return;const nt=Pe();b(null),w([]),C({kind:"validating"});try{const at=await Pk(pe,nt);if(Ee!==ie.current)return;let hn=!1;if(at.valid)C({kind:"valid"});else{if(C({kind:"invalid",count:at.issues.length}),w(at.issues),j(!0),hn=await ot(at.issues),Ee!==ie.current)return;if(!hn){b({kind:"error",text:"Save cancelled — fix the listed issues, or force-save anyway."});return}}if(de==="save-as"){const Kt=await nn();if(Ee!==ie.current||Kt===null)return;const bi=await AM({content:nt,filename:Kt.filename,directory:Kt.directory,force:hn,overwrite:Kt.overwrite});if(Ee!==ie.current)return;Ht(bi.config,nt,bi.contentHash),b({kind:"ok",text:`Configuration saved as ${Kt.filename}.`})}else{let Kt;try{Kt=await Hk(nt,hn,{baselineHash:Z.current})}catch(bi){if(!(bi instanceof gy)||bi.status!==409)throw bi;const Vt=await Pn();if(Ee!==ie.current)return;if(!Vt){Pt();return}Kt=await Hk(nt,hn,{baselineHash:Z.current,overwriteChanges:!0})}if(Ee!==ie.current)return;Ht(Kt.config,nt,Kt.contentHash),b({kind:"ok",text:`Configuration saved to ${pe}.`})}}catch(at){if(Ee!==ie.current)return;rn(at)}}),[ot,nn,Pn,o,Ht,rn,Pt,be]),Ve=M.useCallback(()=>Se("save",o.status==="ready"?o.data.filename:""),[o,Se]),We=M.useCallback(()=>Se("save-as",o.status==="ready"?o.data.filename:""),[o,Se]),ft=M.useRef(()=>{});if(ft.current=()=>{o.status==="ready"&&(T!==null||te!==null||G!==null||d||U!==null||(o.data.config_path!==null?Ve():Ct()))},M.useEffect(()=>{if(!n)return;const de=pe=>{(pe.metaKey||pe.ctrlKey)&&!pe.altKey&&!pe.shiftKey&&pe.key.toLowerCase()==="s"&&(pe.preventDefault(),pe.stopPropagation(),ft.current())};return window.addEventListener("keydown",de,!0),()=>window.removeEventListener("keydown",de,!0)},[n]),!n)return null;const ee=o.status==="ready"?o.data.filename:"",fe=o.status==="ready"?o.data.session_trial:!1,Te=o.status!=="ready",He=o.status==="ready"&&o.data.config_path!==null;return y.jsxs(y.Fragment,{children:[y.jsx("div",{ref:se,role:"dialog","aria-modal":"true","aria-labelledby":"config-editor-title",onKeyDown:$,onClick:je,className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-3 backdrop-blur-sm sm:p-6",children:y.jsxs("div",{className:"animate-modal-in flex h-[90vh] w-full max-w-6xl flex-col overflow-hidden rounded-xl border border-frame-line glass-panel",onClick:de=>de.stopPropagation(),children:[y.jsxs("div",{"data-testid":"editor-header",className:"flex shrink-0 items-center justify-between gap-3 border-b border-line px-5 py-3",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-chip-indigo-bg text-chip-indigo-text",children:y.jsx(R4,{className:"h-4 w-4"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"config-editor-title",className:"text-sm font-semibold text-ink",children:"Configuration Editor"}),y.jsxs("p",{className:"truncate text-xs text-ink-muted",children:[ee||"…",fe?" • session trial (not anchored to disk)":""]})]})]}),y.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[y.jsxs("button",{type:"button",onClick:tn,disabled:Te,title:"Load the starter configuration template",className:"btn btn-secondary px-2.5 py-1.5",children:[y.jsx(z4,{className:"h-3.5 w-3.5"}),"New"]}),y.jsxs("button",{type:"button",onClick:()=>void zt(),disabled:Te,title:"Validate the editor content in memory",className:"btn btn-secondary px-2.5 py-1.5",children:[y.jsx(I4,{className:"h-3.5 w-3.5"}),"Test"]}),y.jsxs("button",{type:"button",onClick:gn,disabled:Te,title:"Discard edits and reload the file from disk",className:"btn btn-secondary px-2.5 py-1.5",children:[y.jsx(hD,{className:"h-3.5 w-3.5"}),"Revert"]}),He&&y.jsxs("button",{type:"button",onClick:()=>void Ve(),disabled:Te,title:"Save to the configuration file on disk (Ctrl/Cmd+S)",className:"btn btn-secondary px-2.5 py-1.5",children:[y.jsx(rO,{className:"h-3.5 w-3.5"}),"Save"]}),y.jsxs("button",{type:"button",onClick:()=>void We(),disabled:Te,title:"Save the configuration to a new file — also anchors a session trial onto disk",className:"btn btn-secondary px-2.5 py-1.5",children:[y.jsx(mD,{className:"h-3.5 w-3.5"}),"Save As"]}),y.jsxs("button",{type:"button",onClick:()=>void Ct(),disabled:Te,title:"Trial the editor content as the session configuration",className:"btn btn-primary px-2.5 py-1.5 font-semibold",children:[y.jsx(ns,{className:"h-3.5 w-3.5"}),"Apply"]}),i&&y.jsxs("button",{type:"button",onClick:i,title:"Load a different .profiles file",className:"btn btn-secondary px-2.5 py-1.5",children:[y.jsx(oa,{className:"h-3.5 w-3.5"}),"Load config file…"]}),He&&y.jsxs("button",{type:"button",onClick:Ne,title:"Open the configuration file with the OS default editor",className:"btn inline-flex items-center gap-1.5 rounded-md border border-line bg-surface px-2.5 py-1.5 text-xs font-medium text-ink-secondary hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:[y.jsx(nO,{className:"h-3.5 w-3.5"}),"Open in OS"]}),y.jsx("button",{type:"button",onClick:je,"aria-label":"Close editor",className:"rounded-md p-1.5 text-ink-muted hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:y.jsx(Ri,{className:"h-4 w-4"})})]})]}),y.jsxs("div",{className:"flex min-h-0 flex-1 gap-2 p-3 sm:p-4",children:[y.jsx("div",{"data-testid":"editor-card",className:"min-w-0 flex-1 overflow-hidden rounded-lg border border-[var(--app-editor-border)] bg-[var(--app-editor-bg)]",children:o.status==="loading"?y.jsx("div",{className:"flex h-full items-center justify-center",children:y.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent"})}):o.status==="error"?y.jsx("div",{className:"flex h-full items-center justify-center p-6",children:y.jsx("div",{className:"max-w-md rounded-md border border-status-danger-border bg-status-danger-bg p-4 text-center text-xs text-status-danger-text",children:o.message})}):y.jsx("div",{ref:me,className:"h-full"})}),o.status==="ready"&&N&&y.jsxs("aside",{"data-testid":"problems-panel","aria-live":"polite",className:"flex w-[280px] shrink-0 flex-col overflow-hidden rounded-lg border border-line bg-surface",children:[y.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-line px-3 py-1.5",children:[y.jsx("span",{className:"text-xs font-semibold text-ink-secondary",children:"Problems"}),y.jsx("button",{type:"button",onClick:()=>j(!1),"aria-label":"Close problems",className:"rounded-md p-1 text-ink-muted hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:y.jsx(Ri,{className:"h-3.5 w-3.5"})})]}),y.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-2",children:v.length===0?y.jsx("p",{className:"px-2 py-1 text-xs text-ink-faint",children:"No problems detected."}):y.jsx("ul",{"data-testid":"editor-issues",className:"space-y-1",children:v.map((de,pe)=>y.jsxs("li",{tabIndex:0,className:`flex items-start gap-2 rounded-md border px-2.5 py-1.5 text-xs ${de.severity==="error"?"border-status-danger-border bg-status-danger-bg text-status-danger-text":de.severity==="warning"?"border-chip-amber-border bg-chip-amber-bg text-chip-amber-text":"border-line bg-surface text-ink-secondary"}`,children:[de.severity==="error"?y.jsx(ou,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}):de.severity==="warning"?y.jsx(by,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}):y.jsx(xy,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),y.jsx("span",{className:"min-w-0",children:de.message})]},`${de.severity}-${pe}`))})})]})]}),o.status==="ready"&&y.jsxs("footer",{"data-testid":"editor-footer",className:"flex shrink-0 items-center justify-between gap-3 border-t border-line px-5 py-1.5 text-xs",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[y.jsxs("button",{type:"button","data-testid":"validity-chip",onClick:()=>j(de=>!de),title:"Toggle the problems panel","aria-pressed":N,className:`inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 ${S.kind==="valid"?"border-status-success-border bg-status-success-bg text-status-success-text":S.kind==="invalid"?"border-status-danger-border bg-status-danger-bg text-status-danger-text":"border-line bg-surface text-ink-muted"}`,children:[S.kind==="valid"?y.jsx(Lr,{className:"h-3 w-3"}):S.kind==="invalid"?y.jsx(ou,{className:"h-3 w-3"}):S.kind==="validating"?y.jsx(sl,{className:"h-3 w-3 animate-spin"}):y.jsx(d4,{className:"h-3 w-3"}),S.kind==="valid"?"Valid":S.kind==="invalid"?`${S.count} issue${S.count===1?"":"s"}`:S.kind==="validating"?"Validating…":"Not validated"]}),u&&y.jsxs("span",{role:"status",className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-chip-amber-border bg-chip-amber-bg px-2 py-0.5 text-[10px] font-bold text-chip-amber-text",children:[y.jsx(p4,{className:"h-3 w-3"}),"Unsaved changes"]}),g!==null&&y.jsx("div",{"data-testid":"editor-status","aria-live":"polite",className:`min-w-0 truncate rounded-md border px-2 py-0.5 font-medium ${g.kind==="ok"?"border-status-success-border bg-status-success-bg text-status-success-text":"border-status-danger-border bg-status-danger-bg text-status-danger-text"}`,children:g.text})]}),y.jsxs("div",{className:"flex shrink-0 items-center gap-3 text-ink-muted",children:[y.jsxs("span",{className:"font-mono",children:["Ln ",D.line,", Col ",D.col]}),y.jsx("span",{className:"text-ink-faint",children:"YAML"}),y.jsx("span",{className:"max-w-[220px] truncate font-mono",children:ee})]})]})]})}),y.jsx(Js,{isOpen:d,title:"Discard changes?",message:`The editor contains unsaved changes. -Closing now will discard them.`,confirmLabel:"Discard",cancelLabel:"Keep editing",danger:!0,onConfirm:()=>{m(!1),e()},onCancel:()=>m(!1)}),y.jsx(Js,{isOpen:U!==null,title:"Replace current edits?",message:U==="revert"?`The editor contains unsaved changes. -Reverting will discard them and reload the file from disk.`:`The editor contains unsaved changes. -Loading the starter template will discard them.`,confirmLabel:"Replace",cancelLabel:"Keep editing",danger:!0,onConfirm:()=>{const de=U;E(null),de==="new"?_e():de==="revert"&&Pt()},onCancel:()=>E(null)}),y.jsx(Js,{isOpen:T!==null,title:"Save with validation issues?",danger:!0,message:y.jsxs(y.Fragment,{children:[y.jsx("p",{children:"Saving will write these issues to disk; the file may fail to load until they are fixed."}),y.jsx("ul",{className:"mt-2 space-y-1",children:T==null?void 0:T.issues.map((de,pe)=>y.jsx("li",{className:`rounded-md border px-3 py-1.5 text-xs ${de.severity==="error"?"border-status-danger-border bg-status-danger-bg text-status-danger-text":"border-chip-amber-border bg-chip-amber-bg text-chip-amber-text"}`,children:de.message},`${de.severity}-${pe}`))})]}),confirmLabel:"Force save anyway",cancelLabel:"Go back and fix",onConfirm:()=>T==null?void 0:T.resolve(!0),onCancel:()=>T==null?void 0:T.resolve(!1)}),y.jsx(Js,{isOpen:G!==null,title:"File changed on disk",danger:!0,message:`The configuration file was modified outside this editor since it was loaded. - -Reload disk version: discard your edits and load the file as it is on disk. -Overwrite anyway: save your edits and replace the file's current content.`,confirmLabel:"Overwrite anyway",cancelLabel:"Reload disk version",onConfirm:()=>G==null?void 0:G.resolve(!0),onCancel:()=>G==null?void 0:G.resolve(!1)}),y.jsx(z9,{open:te!==null,onCancel:()=>te==null?void 0:te.resolve(null),onConfirm:de=>te==null?void 0:te.resolve(de)})]})}function F9({position:n,onClose:e,onLaunch:t,onLaunchWithArgs:i,onReveal:l,onOpenFolder:o,onOpenTerminal:a,onScanDirectory:u,onFilterFolder:f,onFilterExtension:d,onCopyPath:m,onCopyFilename:g,onCopyUri:b,onComputeHash:v,onVerifyHash:w,onProperties:S,onClearFile:C,onGenerateBarcode:N,showToast:j}){const[D,I]=M.useState(!1),[U,E]=M.useState(""),T=M.useRef(null),z=M.useRef(null),te=M.useRef(null),[q,G]=M.useState(null);if(M.useEffect(()=>{var re;D&&((re=z.current)==null||re.showModal())},[D]),M.useLayoutEffect(()=>{if(!n){G(null);return}const re=()=>{const A=T.current;if(!A)return;const Be=A.getBoundingClientRect(),ze=8;G({left:Math.max(ze,Math.min(n.x,window.innerWidth-Be.width-ze)),top:Math.max(ze,Math.min(n.y,window.innerHeight-Be.height-ze))})};return re(),window.addEventListener("resize",re),()=>window.removeEventListener("resize",re)},[n]),M.useEffect(()=>{if(!n)return;te.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const re=window.requestAnimationFrame(()=>{var A,Be;(Be=(A=T.current)==null?void 0:A.querySelector("[role='menuitem']"))==null||Be.focus()});return()=>{var A;window.cancelAnimationFrame(re),(A=te.current)==null||A.focus()}},[n]),!n)return null;const{file:F,x:se,y:me}=n,ne=()=>{i(F,U),I(!1),e()},_=re=>{const A=re.lastIndexOf(".");return A!==-1?re.slice(A):""},Z=re=>{const A=Math.max(re.lastIndexOf("/"),re.lastIndexOf("\\"));return A!==-1?re.slice(0,A):re},ie=re=>{const A=Math.max(re.lastIndexOf("/"),re.lastIndexOf("\\"));return A!==-1?re.slice(0,A):""};return y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"fixed inset-0 z-[calc(var(--z-context-menu)-1)]",onClick:e,onContextMenu:re=>{re.preventDefault(),e()},"aria-hidden":"true"}),y.jsxs("div",{ref:T,role:"menu","aria-label":`Actions for ${F.filename}`,tabIndex:0,onKeyDown:re=>{var ze,B,R,$;["Escape","ArrowDown","ArrowUp","Home","End"].includes(re.key)&&re.stopPropagation();const A=Array.from(((ze=T.current)==null?void 0:ze.querySelectorAll("[role='menuitem']"))??[]),Be=A.indexOf(document.activeElement);if(re.key==="Escape")re.preventDefault(),e();else if(re.key==="ArrowDown"||re.key==="ArrowUp"){re.preventDefault();const ue=re.key==="ArrowDown"?1:-1;(B=A[(Be+ue+A.length)%A.length])==null||B.focus()}else re.key==="Home"?(re.preventDefault(),(R=A[0])==null||R.focus()):re.key==="End"&&(re.preventDefault(),($=A.at(-1))==null||$.focus())},className:"animate-modal-in fixed z-[var(--z-context-menu)] max-h-[calc(100dvh-16px)] w-56 max-w-[calc(100vw-16px)] overflow-y-auto rounded-lg border border-line bg-surface-glass py-1 text-xs text-ink shadow-2xl backdrop-blur-md",style:q??{left:se,top:me,visibility:"hidden"},children:[y.jsx("div",{className:"border-b border-line px-3 py-2 font-medium text-ink-muted truncate",children:F.filename}),y.jsxs("button",{role:"menuitem",onClick:()=>{t(F),e()},className:"flex w-full items-center gap-2 px-3 py-3 min-h-[44px] hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Launch ${F.filename}`,children:[y.jsx(ns,{className:"h-3.5 w-3.5 fill-current text-status-success-text group-hover:text-white"}),y.jsx("span",{children:"Launch"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{I(!0)},className:"flex w-full items-center gap-2 px-3 py-3 min-h-[44px] hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Launch ${F.filename} with arguments`,children:[y.jsx(ns,{className:"h-3.5 w-3.5 text-chip-indigo-text group-hover:text-white"}),y.jsx("span",{children:"Launch with arguments..."})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{l(F),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Reveal ${F.filename} in file manager`,children:[y.jsx(G0,{className:"h-3.5 w-3.5 text-chip-sky-text group-hover:text-white"}),y.jsx("span",{children:"Reveal in File Manager"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{o(F),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Open folder containing ${F.filename}`,children:[y.jsx(es,{className:"h-3.5 w-3.5 text-chip-amber-text group-hover:text-white"}),y.jsx("span",{children:"Open Folder"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{a(F),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Open terminal in directory containing ${F.filename}`,children:[y.jsx(W0,{className:"h-3.5 w-3.5 text-status-success-text group-hover:text-white"}),y.jsx("span",{children:"Open Terminal in Directory"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{N(F),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":"Generate QR Code",children:[y.jsx(yy,{className:"h-3.5 w-3.5 text-chip-fuchsia-text group-hover:text-white"}),y.jsx("span",{children:"Generate QR Code"})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{const re=Z(F.path);u(re),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":"Scan to Directory",children:[y.jsx(es,{className:"h-3.5 w-3.5 text-chip-indigo-text group-hover:text-white"}),y.jsx("span",{children:"Scan to Directory"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{const re=ie(F.rel_path);re&&f(re),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Filter view to folder ${F.filename} is in`,children:[y.jsx(K0,{className:"h-3.5 w-3.5 text-chip-indigo-text group-hover:text-white"}),y.jsx("span",{children:"Filter to Folder"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{const re=_(F.filename);re&&d(re),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Filter view by extension ${_(F.filename)}`,children:[y.jsx(K0,{className:"h-3.5 w-3.5 text-chip-indigo-text group-hover:text-white"}),y.jsx("span",{children:"Filter by Extension"})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{m(F,!1),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy full path of ${F.filename}`,children:[y.jsx(fi,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Full Path"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{m(F,!0),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy path of ${F.filename} with forward slashes`,children:[y.jsx(fi,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Path (Forward Slashes)"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{g(F,!1),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy filename of ${F.filename}`,children:[y.jsx(fi,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Filename"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{g(F,!0),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy filename of ${F.filename} without extension`,children:[y.jsx(fi,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Filename (no ext)"})]}),y.jsxs("button",{role:"menuitem",onClick:async()=>{const re=Z(F.path);e();try{await navigator.clipboard.writeText(re),j==null||j(`Copied: ${re}`)}catch(A){j==null||j(`Copy failed: ${(A==null?void 0:A.message)??A}`,"error")}},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":"Copy Directory",children:[y.jsx(fi,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Directory"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{b(F),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy URI of ${F.filename}`,children:[y.jsx(fi,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy URI"})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{v(F,"md5"),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Compute MD5 hash of ${F.filename}`,children:[y.jsx(aa,{className:"h-3.5 w-3.5 text-chip-purple-text group-hover:text-white"}),y.jsx("span",{children:"Compute MD5 Hash"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{v(F,"sha256"),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Compute SHA256 hash of ${F.filename}`,children:[y.jsx(aa,{className:"h-3.5 w-3.5 text-chip-purple-text group-hover:text-white"}),y.jsx("span",{children:"Compute SHA256 Hash"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{w(F,"md5"),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Verify MD5 hash of ${F.filename}`,children:[y.jsx(aa,{className:"h-3.5 w-3.5 text-chip-purple-text group-hover:text-white"}),y.jsx("span",{children:"Verify MD5 Hash"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{w(F,"sha256"),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Verify SHA256 hash of ${F.filename}`,children:[y.jsx(aa,{className:"h-3.5 w-3.5 text-chip-purple-text group-hover:text-white"}),y.jsx("span",{children:"Verify SHA256 Hash"})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{S(F),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`View properties of ${F.filename}`,children:[y.jsx(G0,{className:"h-3.5 w-3.5 text-chip-sky-text group-hover:text-white"}),y.jsx("span",{children:"Properties"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{C(F),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Remove ${F.filename} from list`,children:[y.jsx(oO,{className:"h-3.5 w-3.5 text-status-danger-text group-hover:text-white"}),y.jsx("span",{children:"Delete"})]})]}),D&&y.jsx("dialog",{ref:z,className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 rounded-xl","aria-labelledby":"args-modal-title",onClick:re=>{re.target===z.current&&I(!1)},onCancel:re=>{re.preventDefault(),I(!1)},children:y.jsxs("div",{className:"animate-modal-in w-96 rounded-xl border border-frame-line glass-panel p-4",children:[y.jsx("h3",{id:"args-modal-title",className:"mb-2 text-sm font-semibold text-ink",children:"Launch with Arguments"}),y.jsx("p",{className:"mb-3 text-xs text-ink-muted truncate",children:F.filename}),y.jsx("input",{type:"text",autoFocus:!0,placeholder:"Arguments (e.g. --verbose --port 80)",value:U,onChange:re=>E(re.target.value),onKeyDown:re=>{re.key==="Enter"&&ne(),re.key==="Escape"&&I(!1)},className:"mb-4 w-full rounded-md border border-line bg-elevated px-3 py-2 text-xs text-ink outline-none focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500","aria-label":"Command line arguments"}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx("button",{onClick:()=>I(!1),className:"rounded-md px-3 py-1.5 text-xs text-ink-muted hover:bg-elevated hover:text-ink focus:outline-none focus:ring-2 focus:ring-indigo-500","aria-label":"Cancel launch",children:"Cancel"}),y.jsx("button",{onClick:ne,className:"btn btn-primary px-3 py-1.5","aria-label":`Launch ${F.filename} with arguments`,children:"Launch"})]})]})})]})}function q9({isOpen:n,initialPath:e,onClose:t,onSelect:i}){const[l,o]=M.useState(null),[a,u]=M.useState(null),[f,d]=M.useState(""),[m,g]=M.useState(!1),[b,v]=M.useState(null),w=M.useRef(null),S=M.useRef(null),C=M.useRef(null);M.useEffect(()=>{var U;if(!n){(U=C.current)==null||U.focus();return}C.current=document.activeElement instanceof HTMLElement?document.activeElement:null,v(null),N(e||"");const I=requestAnimationFrame(()=>{var E;return(E=S.current)==null?void 0:E.focus()});return()=>{var E;cancelAnimationFrame(I),(E=C.current)==null||E.focus()}},[n]);const N=async I=>{g(!0),v(null);try{const U=await fetch(`/api/fs/browse?path=${encodeURIComponent(I)}`);if(!U.ok)throw new Error("Failed to browse directory");const E=await U.json();o(E),u(E.current_path),d(E.current_path)}catch(U){v(U.message||"Navigation failed")}finally{g(!1)}},j=()=>{const I=f.trim()||a;I&&(i(I),t())},D=I=>{var z;if(I.key==="Escape"){I.preventDefault(),t();return}if(I.key!=="Tab")return;const U=(z=w.current)==null?void 0:z.querySelectorAll('button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(!(U!=null&&U.length))return;const E=U[0],T=U[U.length-1];I.shiftKey&&document.activeElement===E?(I.preventDefault(),T.focus()):!I.shiftKey&&document.activeElement===T&&(I.preventDefault(),E.focus())};return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-3 backdrop-blur-sm sm:p-6",onClick:t,children:y.jsxs("div",{ref:w,role:"dialog","aria-modal":"true","aria-labelledby":"directory-picker-title",onKeyDown:D,className:"animate-modal-in flex h-[min(84dvh,760px)] max-h-[calc(100dvh-1.5rem)] w-[min(94vw,960px)] min-h-0 flex-col overflow-hidden rounded-xl border border-frame-line glass-panel sm:rounded-2xl",onClick:I=>I.stopPropagation(),children:[y.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-line px-4 py-3 sm:px-5",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx("span",{className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(es,{className:"h-5 w-5 text-chip-indigo-text"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"directory-picker-title",className:"text-sm font-semibold text-ink",children:"Select a directory"}),y.jsx("p",{className:"truncate font-mono text-xs text-ink-muted",children:(l==null?void 0:l.current_path)||""})]})]}),y.jsx($e,{text:"Close",block:!1,children:y.jsx("button",{type:"button",onClick:t,"aria-label":"Close directory picker",className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg text-ink-muted transition-colors hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Ri,{className:"h-4 w-4"})})})]}),y.jsxs("div",{className:"border-b border-line px-4 py-3 sm:px-5",children:[y.jsx("label",{htmlFor:"directory-picker-path",className:"mb-1.5 block text-xs font-medium text-ink-secondary",children:"Location"}),y.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[y.jsx("input",{ref:S,id:"directory-picker-path",type:"text",value:f,onChange:I=>d(I.target.value),onKeyDown:I=>{I.key==="Enter"&&N(f.trim())},placeholder:"/path/to/directory",className:"h-10 min-w-0 flex-1 rounded-lg border border-line bg-elevated px-2.5 font-mono text-sm text-ink outline-none placeholder:text-ink-faint transition-colors hover:bg-surface-strong focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-indigo-500/30"}),y.jsx("button",{type:"button",onClick:()=>N(f.trim()),className:"inline-flex h-10 shrink-0 items-center gap-1.5 rounded-lg border border-line bg-elevated px-3.5 text-sm font-medium text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Go"}),y.jsx($e,{text:"Home directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>N(""),"aria-label":"Home directory",className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx($d,{className:"h-4 w-4"})})}),(l==null?void 0:l.parent_path)&&y.jsx($e,{text:"Parent directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>N(l.parent_path),"aria-label":"Parent directory",className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Xd,{className:"h-4 w-4 rotate-180"})})})]})]}),y.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2 sm:px-3 sm:py-3","aria-busy":m,children:m?y.jsxs("div",{className:"flex h-full items-center justify-center gap-2.5 text-sm text-ink-muted",children:[y.jsx(sl,{className:"h-5 w-5 animate-spin text-chip-indigo-text"}),y.jsx("span",{role:"status",children:"Loading directories…"})]}):b?y.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-2.5 text-center",children:[y.jsx("p",{className:"text-sm text-status-danger-text",children:b}),y.jsx("button",{type:"button",onClick:()=>N(f||(l==null?void 0:l.current_path)||""),className:"min-h-10 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Retry"})]}):y.jsxs("ul",{className:"space-y-0.5",children:[l==null?void 0:l.items.filter(I=>I.is_dir).map(I=>y.jsx("li",{children:y.jsxs("button",{type:"button",onClick:()=>N(I.path),onDoubleClick:()=>{d(I.path),i(I.path),t()},className:`flex min-h-10 w-full items-center justify-between rounded-lg px-3 py-1.5 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-400 ${a===I.path?"bg-chip-indigo-bg text-chip-indigo-text":"text-ink-secondary hover:bg-elevated hover:text-ink"}`,children:[y.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx(Ou,{className:"h-5 w-5 shrink-0 text-chip-indigo-text"}),y.jsx("span",{className:"truncate",children:I.name})]}),a===I.path&&y.jsx(Lr,{className:"h-4 w-4 shrink-0 text-chip-indigo-text"})]})},I.path)),(l==null?void 0:l.items.filter(I=>I.is_dir).length)===0&&y.jsxs("li",{className:"flex h-full min-h-36 flex-col items-center justify-center gap-2.5 text-center text-sm text-ink-muted",children:[y.jsx(es,{className:"h-7 w-7 text-ink-faint"}),"No subdirectories found"]})]})}),y.jsxs("div",{className:"flex flex-col gap-2 border-t border-line px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:px-5",children:[y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("p",{className:"mb-0.5 text-xs font-medium text-ink-muted",children:"Selected folder"}),y.jsx("p",{className:"truncate font-mono text-sm text-ink",title:a||f,children:a||f||"—"})]}),y.jsxs("div",{className:"flex shrink-0 justify-end gap-1.5",children:[y.jsx("button",{type:"button",onClick:t,className:"min-h-10 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Cancel"}),y.jsxs("button",{type:"button",onClick:j,disabled:!f.trim(),className:"btn btn-primary min-h-10 rounded-lg px-4 text-sm font-semibold",children:[y.jsx(es,{className:"h-4 w-4"}),"Select folder"]})]})]})]})}):null}function V9({visible:n,onFileSelected:e}){const t=M.useRef(null);return n?y.jsxs("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-drop-overlay)] flex items-center justify-center bg-black/65 backdrop-blur-sm",onClick:()=>{var i;return(i=t.current)==null?void 0:i.click()},"data-testid":"drop-config-overlay",children:[y.jsx("input",{ref:t,type:"file",accept:".profiles,.profiles.yaml,.profiles.yml,.yaml,.yml",className:"hidden",onChange:i=>{var o;const l=(o=i.target.files)==null?void 0:o[0];l&&e(l),i.target.value=""}}),y.jsxs("div",{className:"rounded-xl border-2 border-dashed border-chip-indigo-border bg-surface px-8 py-6 text-center shadow-2xl",children:[y.jsx("span",{className:"mx-auto mb-3 grid h-9 w-9 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(oa,{className:"h-5 w-5 text-chip-indigo-text"})}),y.jsx("p",{className:"text-sm font-semibold text-ink",children:"Drop configuration file"}),y.jsx("p",{className:"mt-1 text-xs text-ink-muted",children:".profiles, .profiles.yaml, .yml, .yaml — session-only preview"})]})]}):null}function Q9({items:n,columnTemplate:e,resizePointerRef:t,resizeMovedRef:i}){return y.jsx("div",{className:"grid select-none items-center border-b border-l-2 border-l-transparent border-line/40 bg-surface/60 font-medium text-ink-muted shadow-sm backdrop-blur-md",role:"row","aria-rowindex":1,"data-file-list-header":!0,style:{gridTemplateColumns:e},children:n.map((l,o)=>{const a=!!(l.onSort&&l.sortKey),u=l.active?l.direction==="asc"?"ascending":"descending":"none";return y.jsxs("div",{role:"columnheader","data-column-key":l.sortKey,className:`group relative flex items-center gap-1.5 truncate px-3 py-2 ${a?"cursor-pointer hover:text-ink transition-colors":""} ${l.active?"text-ink":""}`,...a?{"aria-sort":u,tabIndex:0,onClick:l.onSort,onKeyDown:f=>{var d;(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),(d=l.onSort)==null||d.call(l))}}:{},children:[l.icon,y.jsx("span",{className:"truncate",children:l.label}),a?l.active?l.direction==="asc"?y.jsx(e4,{className:"ml-auto h-3 w-3 shrink-0 text-chip-indigo-text"}):y.jsx(JC,{className:"ml-auto h-3 w-3 shrink-0 text-chip-indigo-text"}):y.jsx(Xk,{className:"ml-auto h-3 w-3 shrink-0 opacity-0 transition-opacity group-hover:opacity-40 hover:opacity-40"}):o>0&&y.jsx(Xk,{className:"ml-auto h-3 w-3 shrink-0 opacity-40"}),l.canResize&&l.onResizeBy&&y.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":`Resize ${l.label} column`,"aria-valuemin":da,"aria-valuemax":Id,"aria-valuenow":l.width??l.defaultWidth??od,"aria-valuetext":`${l.width??l.defaultWidth??od} pixels wide`,title:"Drag to resize; use arrow keys or click either side to adjust",tabIndex:0,onClick:f=>{var g;f.preventDefault(),f.stopPropagation();const d=i.current;if(i.current=!1,d)return;const m=f.currentTarget.getBoundingClientRect();(g=l.onResizeBy)==null||g.call(l,f.clientX{f.preventDefault(),f.stopPropagation();const d=f.currentTarget.parentElement;i.current=!1,t.current={pointerId:f.pointerId,startX:f.clientX,startWidth:l.width??(d==null?void 0:d.getBoundingClientRect().width)??l.defaultWidth??od,resizeTo:l.onResizeTo},f.currentTarget.setPointerCapture(f.pointerId)},onPointerMove:f=>{const d=t.current;if(!d||d.pointerId!==f.pointerId)return;const m=f.clientX-d.startX;Math.abs(m)>2&&(i.current=!0),d.resizeTo(d.startWidth+m)},onPointerUp:f=>{var d;((d=t.current)==null?void 0:d.pointerId)===f.pointerId&&(f.currentTarget.releasePointerCapture(f.pointerId),t.current=null,window.setTimeout(()=>{i.current=!1},0))},onPointerCancel:()=>{t.current=null,i.current=!1},onKeyDown:f=>{var d,m;f.stopPropagation(),f.key==="ArrowLeft"||f.key==="ArrowRight"?(f.preventDefault(),(d=l.onResizeBy)==null||d.call(l,f.key==="ArrowLeft"?-Ih:Ih)):(f.key==="Home"||f.key==="End")&&(f.preventDefault(),(m=l.onResizeTo)==null||m.call(l,f.key==="Home"?da:Id))},className:"absolute inset-y-0 right-0 z-10 w-3 cursor-col-resize touch-none border-r border-transparent transition-colors hover:border-indigo-400 focus-visible:border-indigo-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500"})]},o)})})}const er=28,Hh=12,M0=500,da=80,Id=960,od=160,Ih=24,q2=44,Uh={File:2,Path:3,FileName:1,Type:1,Version:1};function X9({files:n,totalCount:e,rawLoadedCount:t,onLoadMore:i,loadingMore:l=!1,scanning:o=!1,hasScanned:a=!1,activeDirectory:u="",recursive:f=!1,onDisableRecursive:d,onOpenDirectory:m,onLoadConfig:g,filterText:b,onClearFilter:v,prefilterNote:w,columnHeaders:S,columnNames:C,selectedIndex:N,onSelectIndex:j,onLaunch:D,onContextMenu:I,rowColors:U,sort:E,onSortChange:T}){const z=["File"],te=C.length>0?C:z,q=S.length>0?S:te,G=Array.from({length:Math.max(te.length,q.length)},(Se,Ve)=>({key:te[Ve]??z[0],header:q[Ve]??te[Ve]??z[0]})),F=M.useRef(null),[se,me]=M.useState(0),[ne,_]=M.useState(600),[Z,ie]=M.useState(0),[re,A]=M.useState({}),Be=M.useRef(null),ze=M.useRef(!1),B=te.reduce((Se,Ve)=>Se+(Uh[Ve]??1),1),R=(Se,Ve)=>{const We=Math.min(Id,Math.max(da,Math.round(Ve)));A(ft=>({...ft,[Se]:We}))},$=(Se,Ve)=>{var ee;const We=Array.from(((ee=F.current)==null?void 0:ee.querySelectorAll("[data-column-key]"))??[]).find(fe=>fe.dataset.columnKey===Se),ft=re[Se]??(We==null?void 0:We.getBoundingClientRect().width)??od;R(Se,ft+Ve)},ue=[`${q2}px`,...te.map(Se=>re[Se]?`${re[Se]}px`:`minmax(${da}px, ${Uh[Se]??1}fr)`)].join(" "),ge=M.useRef(!1),je=M.useRef(null),Ne=n.length,Pe=t??Ne,be=e??Pe,_e=Pe{const Se=F.current;if(!Se)return;const Ve=new ResizeObserver(We=>{for(const ft of We)_(ft.contentRect.height),ie(ft.contentRect.width)});return Ve.observe(Se),_(Se.clientHeight||600),ie(Se.clientWidth||0),()=>Ve.disconnect()},[]),M.useEffect(()=>{var fe;const Se=F.current;if(!Se||N<0||N>=Ne)return;const Ve=((fe=Se.querySelector("[data-file-list-header]"))==null?void 0:fe.offsetHeight)??0,We=Ve+N*er,ft=We+er;let ee=Se.scrollTop;WeSe.scrollTop+Se.clientHeight&&(ee=ft-Se.clientHeight),ee!==Se.scrollTop&&(Se.scrollTop=ee,me(ee))},[N,Ne]),M.useEffect(()=>{const Se=F.current;if(!Se)return;const Ve=()=>{if(ge.current||!tn||!i)return;const We=Se.scrollTop+Se.clientHeight,ft=Ne*er;ft-WeWe&&(ge.current=!0,window.setTimeout(()=>{ge.current=!1},200),i())};return Se.addEventListener("scroll",Ve,{passive:!0}),window.addEventListener("scroll",Ve,{passive:!0}),()=>{Se.removeEventListener("scroll",Ve),window.removeEventListener("scroll",Ve)}},[n,tn,i,Ne]),M.useEffect(()=>{if(ge.current||!tn||!i)return;const Se=Ne*er,Ve=se+ne;if(!(Se-VeVe))return;const ft=`${Ne}:${Pe}:${be}`;je.current=ft,i()});const gn=M.useCallback(Se=>{me(Se.currentTarget.scrollTop)},[]),zt=Math.max(0,Math.floor(se/er)-Hh),Ct=Math.ceil(ne/er)+Hh*2,ot=Math.min(Ne,zt+Ct),nn=zt*er,Pn=(Se,Ve)=>{if(Ve)return{className:"bg-chip-indigo-bg border-l-4 border-chip-indigo-border text-ink",style:{}};for(const[We,ft]of U)if(Se.toLowerCase().includes(We.toLowerCase()))return{className:"hover:bg-elevated border-l-4 text-ink",style:{borderLeftColor:ft,borderLeftWidth:"4px"}};return{className:"border-l-4 border-transparent text-ink-secondary hover:bg-elevated/60",style:{borderLeftColor:"transparent",borderLeftWidth:"4px"}}},Ht=(tn?Ne+Ct:Ne)*er,rn="btn btn-secondary px-3 py-1.5";return y.jsxs("div",{ref:F,onScroll:gn,className:"flex-1 overflow-auto bg-app text-xs transition-colors duration-200 focus-visible:outline focus-visible:outline-2 focus-visible:outline-indigo-500 focus-visible:outline-offset-[-2px]","data-testid":"file-list","data-loaded-count":Pe,"aria-busy":o,role:"grid","aria-label":"Discovered files","aria-rowcount":Math.max(be,Ne===0?1:0)+1,"aria-colcount":te.length+1,"aria-activedescendant":Ne>0?`file-row-${N}`:void 0,tabIndex:0,children:[y.jsx("div",{className:"sticky top-0 z-10",role:"presentation",children:y.jsx(Q9,{columnTemplate:ue,resizePointerRef:Be,resizeMovedRef:ze,items:[{label:"#",icon:y.jsx(K0,{className:"h-3.5 w-3.5"})},...G.map(({key:Se,header:Ve})=>({label:Ve,weight:Uh[Se]??1,width:re[Se],defaultWidth:Math.min(Id,Math.max(da,Math.round((Z-q2)*(Uh[Se]??1)/B))),canResize:!0,onResizeBy:We=>$(Se,We),onResizeTo:We=>R(Se,We),sortKey:Se,active:(E==null?void 0:E.column)===Se,direction:E==null?void 0:E.direction,onSort:()=>{(E==null?void 0:E.column)!==Se?T({column:Se,direction:"asc"}):E.direction==="asc"?T({column:Se,direction:"desc"}):T(null)}}))]})}),w&&Ne>0&&y.jsxs("div",{role:"note","data-testid":"prefilter-note",className:"flex items-center gap-1.5 border-b border-line/40 bg-surface px-3 py-1 text-[11px] text-ink-faint",children:[y.jsx(xy,{className:"h-3 w-3 shrink-0 text-ink-faint","aria-hidden":"true"}),y.jsx("span",{className:"min-w-0 truncate",children:w})]}),Ne===0?y.jsx("div",{role:"row","aria-rowindex":2,"data-testid":"file-list-empty",children:y.jsx("div",{role:"gridcell","aria-colspan":te.length+1,className:"p-8 text-center text-ink-faint",children:o?y.jsxs("div",{className:"flex flex-col items-center gap-2",children:[y.jsx(sl,{className:"h-5 w-5 animate-spin text-chip-indigo-text motion-reduce:animate-none"}),y.jsx("span",{children:"Scanning files..."})]}):!u.trim()&&g?y.jsxs("div",{className:"flex flex-col items-center gap-3",children:[y.jsx("span",{children:"Select a directory first."}),y.jsx("button",{type:"button",onClick:g,className:rn,children:"Choose configuration"})]}):a?b.trim()?y.jsxs("div",{className:"flex flex-col items-center gap-3",children:[y.jsxs("span",{children:["No files match “",b,"”."]}),y.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[y.jsx("button",{type:"button",onClick:v,className:rn,children:"Clear filter"}),f&&d&&y.jsx("button",{type:"button",onClick:d,className:rn,children:"Turn off recursive"}),m&&y.jsx("button",{type:"button",onClick:m,className:rn,children:"Open directory"})]})]}):y.jsxs("div",{className:"flex flex-col items-center gap-3",children:[y.jsx("span",{children:"No files found for the current directory and extension."}),y.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[f&&d&&y.jsx("button",{type:"button",onClick:d,className:rn,children:"Turn off recursive"}),m&&y.jsx("button",{type:"button",onClick:m,className:rn,children:"Open directory"})]})]}):y.jsx("span",{children:"Select a directory and scan to find files."})})}):y.jsxs("div",{className:"relative",style:{height:Ht},role:"rowgroup",children:[l&&y.jsx("div",{className:"pointer-events-none absolute left-1/2 top-2 z-20 -translate-x-1/2","aria-hidden":"true",children:y.jsx(sl,{className:"h-4 w-4 animate-spin text-chip-indigo-text"})}),y.jsx("div",{style:{transform:`translateY(${nn}px)`},"data-testid":"file-list-window",role:"presentation",children:n.slice(zt,ot).map((Se,Ve)=>{const We=zt+Ve,ft=We===N,ee=Pn(Se.filename,ft);return y.jsxs("div",{id:`file-row-${We}`,"data-row-index":We,role:"row","aria-rowindex":We+2,"aria-selected":ft,onClick:()=>{var fe;j(We),(fe=F.current)==null||fe.focus()},onDoubleClick:()=>D(Se),onContextMenu:fe=>I(fe,Se,We),className:`grid cursor-pointer items-center transition-colors ${ee.className}`,style:{...ee.style,height:er,gridTemplateColumns:ue},children:[y.jsxs("div",{className:"flex items-center justify-end gap-1 px-3 font-mono text-ink-faint",children:[Se.has_hook&&y.jsx("span",{title:Se.hook_pattern?`Launch workflow: ${Se.hook_pattern}`:"Launch workflow configured","aria-label":"Workflow hook attached",className:"inline-flex items-center text-status-warning-text hover:brightness-95",children:y.jsx(aO,{className:"h-3 w-3 shrink-0"})}),y.jsx("span",{className:"hidden sm:inline",children:We+1})]}),te.map((fe,Te)=>{const He=Se.column_values[fe]||(fe==="File"?Se.filename:"-");return y.jsx("div",{role:"gridcell","data-column-key":fe,className:"truncate px-3 font-mono",style:{minWidth:da},title:fe==="Path"?Se.path:He,children:He},Te)})]},Se.path||We)})}),_e&&y.jsxs("div",{className:"pointer-events-none absolute bottom-2 left-1/2 -translate-x-1/2 rounded-full border border-line bg-surface-strong px-3 py-1 text-[11px] text-ink-muted shadow","data-testid":"file-list-paging",children:[l?y.jsx(GM,{className:"mr-1.5 h-4 w-4 animate-spin motion-reduce:animate-none text-ink-muted"}):null,"(",Pe," of ",be," loaded)"]})]})]})}function Zx({id:n,ariaLabel:e,value:t,options:i,onChange:l,placeholder:o,className:a="",inputClassName:u="",optionLabel:f=m=>m,onOpenChange:d}){const m=M.useId(),g=M.useRef(null),[b,v]=M.useState(!1),[w,S]=M.useState(""),[C,N]=M.useState(-1),j=i.filter(T=>f(T).toLocaleLowerCase().includes(w.toLocaleLowerCase())),D=C>=0&&j[C]?`${m}-option-${C}`:void 0;M.useEffect(()=>{const T=z=>{var te;(te=g.current)!=null&&te.contains(z.target)||v(!1)};return document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[]),M.useEffect(()=>{d==null||d(b)},[b,d]),M.useEffect(()=>{var T;C<0||(T=document.getElementById(`${m}-option-${C}`))==null||T.scrollIntoView({block:"nearest"})},[C,m]);const I=()=>{S(""),N(-1),v(!0)},U=T=>{l(T),S(""),N(-1),v(!1)},E=T=>{if(T.key==="ArrowDown"){if(T.preventDefault(),!b){I(),N(0);return}N(z=>Math.min(z+1,j.length-1))}else if(T.key==="ArrowUp"){if(T.preventDefault(),!b){I(),N(j.length-1);return}N(z=>z<=0?j.length-1:z-1)}else T.key==="Enter"&&b&&j[C]!==void 0?(T.preventDefault(),U(j[C])):T.key==="Escape"&&v(!1)};return y.jsxs("div",{ref:g,onBlur:T=>{var z;(z=g.current)!=null&&z.contains(T.relatedTarget)||v(!1)},className:`relative flex min-w-0 ${a}`,children:[y.jsx("input",{id:n,type:"text",role:"combobox","aria-label":e,"aria-autocomplete":"list","aria-expanded":b,"aria-controls":m,"aria-activedescendant":D,value:t,placeholder:o,onChange:T=>{l(T.target.value),S(T.target.value),N(-1),v(!0)},onKeyDown:E,className:`min-w-0 flex-1 rounded-l-md border border-line bg-elevated px-3 py-1.5 text-ink outline-none transition-colors hover:bg-surface-strong focus:border-indigo-500 ${u}`}),y.jsx("button",{type:"button","aria-label":`Show ${e.toLowerCase()} options`,"aria-expanded":b,title:`Show ${e.toLowerCase()} options`,onMouseDown:T=>T.preventDefault(),onClick:()=>b?v(!1):I(),className:"shrink-0 rounded-r-md border border-l-0 border-line bg-elevated px-2 text-ink-muted hover:bg-surface-strong hover:text-ink focus-visible:z-10 focus-visible:outline focus-visible:outline-2 focus-visible:outline-indigo-500 transition-colors",children:y.jsx(a4,{className:`h-3.5 w-3.5 transition-transform ${b?"rotate-180":""}`})}),b&&y.jsx("ul",{id:m,role:"listbox","aria-label":`${e} options`,className:"absolute left-0 top-full z-[var(--z-combobox-list)] mt-1 max-h-60 w-full min-w-48 overflow-y-auto rounded-md border border-line bg-surface py-1 text-ink shadow-xl",children:j.length>0?j.map((T,z)=>{const te=f(T),q=z===C,G=T===t;return y.jsx("li",{id:`${m}-option-${z}`,role:"option","aria-selected":G,title:te||void 0,onMouseEnter:()=>N(z),onMouseDown:F=>F.preventDefault(),onClick:()=>U(T),className:`cursor-pointer truncate px-3 py-1.5 ${q?"bg-elevated text-ink":"text-ink-secondary"} ${G?"font-semibold":""}`,children:te||"(No filter)"},`${T}-${z}`)}):y.jsx("li",{className:"px-3 py-1.5 text-ink-muted",children:"No matching presets"})})]})}function $9({title:n,release:e,directories:t,activeDirectory:i,onDirectoryChange:l,onBrowseDirectory:o,onGoToParentDirectory:a,onGoToHomeDirectory:u,onOpenActiveDirectory:f,onOpenTerminal:d}){const[m,g]=M.useState(!1);return y.jsxs("header",{className:"relative z-30 flex flex-wrap items-center gap-3 border-b border-line bg-app/90 px-5 py-2 text-xs backdrop-blur-xl shadow-xs transition-all duration-200",children:[y.jsx("div",{className:"flex shrink-0 items-center gap-3",children:y.jsxs("div",{className:"flex items-center gap-3.5",children:[y.jsxs("div",{className:"relative flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-chip-indigo-bg to-chip-purple-bg text-chip-indigo-text border border-chip-indigo-border shadow-xs",children:[y.jsx(W0,{className:"h-4 w-4"}),y.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 flex h-2.5 w-2.5 items-center justify-center rounded-full bg-emerald-500 ring-2 ring-app"})]}),y.jsxs("div",{children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("h1",{className:"text-sm font-bold tracking-tight text-ink font-heading",children:"ProFiles"}),n&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-ink-faint",children:"/"}),y.jsx("span",{className:"text-xs font-medium text-chip-indigo-text bg-chip-indigo-bg px-2 py-0.5 rounded-md border border-chip-indigo-border/50",children:n})]})]}),y.jsxs("p",{className:"text-[11px] font-medium text-ink-muted tracking-wide mt-0.5",children:["Crafted by ",y.jsx("span",{className:"text-ink font-semibold",children:"Florent ALBANY"})," • ",y.jsxs("span",{className:"font-mono text-chip-indigo-text",children:["v",e||"0.11.0-rc.2"]})]})]})]})}),y.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[y.jsxs("label",{className:"flex shrink-0 items-center gap-1.5 font-medium text-ink-secondary text-xs",children:[y.jsx(Ou,{className:"h-3.5 w-3.5 text-chip-indigo-text"}),y.jsx("span",{children:"Directory:"})]}),y.jsx($e,{text:"Select or type a directory path to scan files from.",suppress:m,children:y.jsx(Zx,{id:"directory-combobox",ariaLabel:"Directory",value:i,options:t,onChange:l,onOpenChange:g,placeholder:"/path/to/directory",className:"w-full",inputClassName:"font-mono"})}),f&&y.jsx($e,{text:"Open the active directory in the OS file manager",block:!1,children:y.jsx("button",{type:"button",onClick:f,"aria-label":"Open active directory",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(WM,{className:"h-3.5 w-3.5"})})}),a&&y.jsx($e,{text:"Go to parent directory",block:!1,children:y.jsx("button",{type:"button",onClick:a,"aria-label":"Go to parent directory",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(Xd,{className:"h-3.5 w-3.5 rotate-180"})})}),o&&y.jsx($e,{text:"Browse for a folder on this system",block:!1,children:y.jsx("button",{type:"button",onClick:o,"aria-label":"Browse directory",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(es,{className:"h-3.5 w-3.5"})})}),d&&y.jsx($e,{text:"Open the active directory in a terminal",block:!1,children:y.jsx("button",{type:"button",onClick:()=>d(i),"aria-label":"Open directory in terminal",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(W0,{className:"h-3.5 w-3.5"})})}),u&&y.jsx($e,{text:"Set directory to your home folder",block:!1,children:y.jsx("button",{type:"button",onClick:u,"aria-label":"Go to home directory",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx($d,{className:"h-3.5 w-3.5"})})})]})]})}function Y9({message:n,onRetry:e,retrying:t=!1}){return y.jsx("div",{className:"flex flex-1 items-center justify-center p-8",role:"alert","data-testid":"init-error-panel",children:y.jsxs("div",{className:"w-full max-w-sm rounded-xl border border-line bg-surface p-6 text-center shadow-xl",children:[y.jsx("div",{className:"mx-auto mb-3 flex h-10 w-10 items-center justify-center rounded-full border border-status-danger-border bg-status-danger-bg",children:y.jsx(Gc,{className:"h-5 w-5 text-status-danger-text/80"})}),y.jsx("h3",{className:"text-sm font-semibold text-ink",children:"Couldn't load the app"}),y.jsx("p",{className:"mt-1 break-words text-xs text-ink-secondary",children:n}),y.jsxs("button",{type:"button",onClick:e,disabled:t,className:"btn btn-primary mx-auto mt-4 px-3.5 py-1.5 font-semibold shadow-sm",children:[y.jsx(Yd,{className:`h-3.5 w-3.5 ${t?"animate-spin motion-reduce:animate-none":""}`}),y.jsx("span",{children:t?"Retrying...":"Retry"})]})]})})}const V2=/"([^"]*)"|(\S+)/g,Q2=/"([^"]*)"/g,G9="Unmatched quote";function K9(n){const e=[];let t;for(V2.lastIndex=0;(t=V2.exec(n))!==null;){const a=t[1]!==void 0?t[1]:t[2];a&&a.trim()&&e.push(a)}let i="",l=0;Q2.lastIndex=0;let o;for(;(o=Q2.exec(n))!==null;)i+=n.slice(l,o.index),l=o.index+o[0].length;return i+=n.slice(l),{terms:e,error:i.includes('"')?G9:null}}function gA(n){const e=n.trim();if(!e)return{error:null,groups:[]};const{terms:t,error:i}=K9(e);if(t.length===0)return{error:i,groups:[]};const l=[];let o={includes:[],excludes:[]};for(const a of t){if(a.toUpperCase()==="OR"){l.push(o),o={includes:[],excludes:[]};continue}a==="-"||a==="+"||(a.startsWith("-")&&a.length>1?o.excludes.push(a.slice(1)):a.startsWith("+")&&a.length>1?o.includes.push(a.slice(1)):o.includes.push(a))}return l.push(o),{error:i,groups:l}}const W9=256,qs=new Map;function X2(n){return n.toLowerCase()}function Z9(n){const e=qs.get(n);if(e)return qs.delete(n),qs.set(n,e),e;const{groups:t}=gA(n),i={groups:t.map(l=>({includes:l.includes.map(X2),excludes:l.excludes.map(X2)}))};if(qs.size>=W9){const l=qs.keys().next().value;l!==void 0&&qs.delete(l)}return qs.set(n,i),i}function J9(n,e){return e.includes.every(t=>n.includes(t))&&!e.excludes.some(t=>n.includes(t))}function e8(n,e){const{groups:t}=Z9(e);if(t.length===0)return!0;const i=n.toLowerCase();return t.some(l=>J9(i,l))}function t8({query:n,visible:e}){if(!e)return null;const t=gA(n);return t.error?y.jsx("div",{"data-testid":"filter-syntax-helper",className:"pointer-events-none absolute left-0 right-0 top-full z-[var(--z-syntax-helper)] mt-1 rounded-md border border-status-danger-border bg-surface-strong px-3 py-2 text-[11px] leading-5 text-status-danger-text/90 shadow-xl",children:t.error}):t.groups.length===0?null:y.jsxs("div",{"data-testid":"filter-syntax-helper",className:"pointer-events-none absolute left-0 right-0 top-full z-[var(--z-syntax-helper)] mt-1 rounded-md border border-line bg-surface-strong px-3 py-2 text-[11px] leading-5 text-ink-secondary shadow-xl",children:[y.jsx("span",{className:"mr-1.5 align-[1px] text-[10px] uppercase tracking-wide text-ink-muted",children:"reads as"}),t.groups.map((i,l)=>y.jsxs("span",{"data-testid":"filter-syntax-group",children:[l>0&&y.jsx("span",{className:"mx-1 font-mono text-chip-indigo-text",children:"OR"}),i.includes.map((o,a)=>y.jsxs("span",{children:[a>0&&y.jsx("span",{className:"text-ink-muted",children:" · "}),y.jsx("span",{className:"font-mono text-chip-indigo-text",children:o})]},`i-${a}`)),i.includes.length>0&&i.excludes.length>0&&y.jsx("span",{className:"text-ink-muted",children:" · "}),i.excludes.map((o,a)=>y.jsxs("span",{children:[a>0&&y.jsx("span",{className:"text-ink-muted",children:" · "}),y.jsx("span",{className:"text-ink-muted",children:"✕ "}),y.jsx("span",{className:"font-mono text-status-danger-text/70 line-through",children:o})]},`x-${a}`))]},l))]})}const $2=y.jsxs("span",{className:"flex flex-col gap-1 whitespace-nowrap text-left",children:[y.jsx("span",{className:"font-semibold",children:"Supported operators"}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:"a b"})," — AND (both terms)"]}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:"a OR b"})," — either term"]}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:"-a"})," — NOT (exclude)"]}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:"+a"})," — force include"]}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:'"a b"'})," — exact phrase"]})]});function n8({extensions:n,activeExtension:e,onExtensionChange:t,filterOptions:i,filterText:l,onFilterTextChange:o,recursive:a,onRecursiveChange:u,onScan:f,scanning:d,barcodeMode:m,onBarcodeToggle:g,onCameraBarcodeClick:b,autoRescanActive:v,onTimerClick:w}){const[S,C]=M.useState(!1),[N,j]=M.useState(!1),[D,I]=M.useState(!1);return y.jsxs("div",{className:"flex w-full flex-wrap items-center gap-3 border-b border-line bg-surface-glass p-3 text-xs",children:[y.jsx($e,{text:$2,suppress:N,children:y.jsxs("div",{className:"relative min-w-0 flex-1 basis-64",onFocusCapture:U=>{U.target.tagName==="INPUT"&&C(!0)},onBlurCapture:U=>{U.target.tagName==="INPUT"&&C(!1)},children:[y.jsx(lO,{className:"pointer-events-none absolute left-3 top-1/2 z-10 h-4 w-4 -translate-y-1/2 text-ink-secondary"}),y.jsx(Zx,{id:"filter-combobox",ariaLabel:"File filter",value:l,options:i||[],onChange:o,onOpenChange:j,placeholder:"Filter files: keyword, a OR b, -tag, exact phrase...",className:"w-full",inputClassName:"pl-9 pr-3",optionLabel:U=>U||"(No filter)"}),y.jsx(t8,{query:l,visible:S&&!N&&l.trim().length>0})]})}),y.jsx($e,{text:$2,block:!1,suppress:D,children:y.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[y.jsx("span",{className:"text-ink-muted",children:"Ext:"}),y.jsx(Zx,{id:"extension-combobox",ariaLabel:"Extension filter",value:e,options:n,onChange:t,onOpenChange:I,placeholder:".py OR .toml",className:"w-44",inputClassName:"font-mono px-2.5"})]})}),y.jsx($e,{text:"Include subdirectories when scanning",block:!1,children:y.jsxs("label",{className:"flex shrink-0 cursor-pointer select-none items-center gap-1.5 text-ink-secondary",children:[y.jsx("input",{type:"checkbox",checked:a,onChange:U=>u(U.target.checked),className:"rounded border-line text-chip-indigo-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-1 focus-visible:ring-offset-app"}),y.jsx("span",{children:"Recursive"})]})}),y.jsx($e,{text:"Run the scan with the current criteria (Enter)",block:!1,children:y.jsxs("button",{onClick:f,disabled:d,className:"btn btn-primary shrink-0 px-3.5 py-1.5 font-semibold shadow-sm",children:[d?y.jsx(Yd,{className:"h-3.5 w-3.5 animate-spin motion-reduce:animate-none"}):y.jsx(ns,{className:"h-3.5 w-3.5 fill-current"}),y.jsx("span",{children:d?"Scanning...":"Scan"})]})}),y.jsx($e,{text:v?"Auto-rescan is active. Click to configure.":"Configure periodic auto-rescan (hot-folder mode)",block:!1,children:y.jsx("button",{type:"button",onClick:w,"aria-label":"Configure timer / auto-rescan",className:`flex shrink-0 items-center justify-center rounded-md border p-1.5 text-ink-secondary hover:border-indigo-500 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 transition-colors ${v?"border-chip-indigo-border bg-chip-indigo-bg text-chip-indigo-text":"border-line bg-elevated"}`,children:y.jsx(sO,{className:`h-3.5 w-3.5 ${v?"animate-pulse":""}`})})}),y.jsx($e,{text:"Toggle barcode scanner mode (USB HID). When active, scan a barcode to auto-fill controls and trigger a scan.",block:!1,children:y.jsx("button",{type:"button",onClick:g,"aria-label":m?"Disable barcode mode":"Enable barcode mode",className:`flex shrink-0 items-center justify-center rounded-md border p-1.5 text-ink-secondary hover:border-indigo-500 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 transition-colors ${m?"border-chip-indigo-border bg-chip-indigo-bg text-chip-indigo-text":"border-line bg-elevated"}`,children:y.jsx(yy,{className:`h-3.5 w-3.5 ${m?"animate-pulse":""}`})})}),b&&y.jsx($e,{text:"Scan barcode or QR code using webcam / camera (Ctrl + Shift + B)",block:!1,children:y.jsx("button",{type:"button",onClick:b,"aria-label":"Scan barcode with camera",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(eO,{className:"h-3.5 w-3.5"})})})]})}const i8=2e3,r8=500,l8=[{value:null,label:"ALL"},{value:"DEBUG",label:"DEBUG"},{value:"INFO",label:"INFO"},{value:"WARNING",label:"WARNING"},{value:"ERROR",label:"ERROR"},{value:"CRITICAL",label:"CRITICAL"}],Y2={DEBUG:{icon:n4,className:"text-chip-sky-text"},INFO:{icon:xy,className:"text-status-success-text"},WARNING:{icon:by,className:"text-status-warning-text"},ERROR:{icon:ou,className:"text-status-danger-text"},CRITICAL:{icon:ou,className:"text-status-danger-text"},UNKNOWN:{icon:ka,className:"text-ink-faint"}};function s8({isOpen:n,onClose:e,onOpenExternally:t}){const[i,l]=M.useState([]),[o,a]=M.useState("profiles.log"),[u,f]=M.useState(0),[d,m]=M.useState(null),[g,b]=M.useState(""),[v,w]=M.useState(!1),[S,C]=M.useState(!0),[N,j]=M.useState(null),[D,I]=M.useState(!0),U=M.useRef(null),E=M.useRef(null),T=M.useRef(null),z=M.useRef(null),te=M.useRef(S),q=M.useRef({level:d,search:g});te.current=S,q.current={level:d,search:g};const G=M.useCallback(async()=>{const{level:_,search:Z}=q.current;w(!0);try{const ie=await wM({limit:r8,level:_,search:Z});l(ie.entries),a(ie.path),f(ie.size_bytes),j(null)}catch(ie){j((ie==null?void 0:ie.message)||"Failed to read the log file")}finally{w(!1)}},[]);M.useEffect(()=>{n&&G()},[n,G]),M.useEffect(()=>{if(!n||!S)return;const _=window.setInterval(()=>{G()},i8);return()=>window.clearInterval(_)},[n,S,G]),M.useEffect(()=>{if(!n)return;const _=window.setTimeout(()=>void G(),250);return()=>window.clearTimeout(_)},[n,d,g,G]),M.useEffect(()=>{if(!D)return;const _=T.current;_&&(_.scrollTop=_.scrollHeight)},[i,D]),M.useEffect(()=>{if(!n)return;const _=document.activeElement instanceof HTMLElement?document.activeElement:null,Z=requestAnimationFrame(()=>{var ie;return(ie=E.current)==null?void 0:ie.focus()});return()=>{cancelAnimationFrame(Z),_==null||_.focus()}},[n]);const F=_=>{var A;if(_.key==="Escape"){_.preventDefault(),e();return}if(_.key!=="Tab")return;const Z=(A=U.current)==null?void 0:A.querySelectorAll('button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(!(Z!=null&&Z.length))return;const ie=Z[0],re=Z[Z.length-1];_.shiftKey&&document.activeElement===ie?(_.preventDefault(),re.focus()):!_.shiftKey&&document.activeElement===re&&(_.preventDefault(),ie.focus())},se=()=>{const _=T.current;if(!_)return;const Z=_.scrollHeight-_.scrollTop-_.clientHeight<24;I(Z)},me=async()=>{try{await navigator.clipboard.writeText(i.map(_=>_.raw).join(` -`))}catch{}},ne=M.useMemo(()=>{const _=new Map;for(const Z of i)_.set(Z.level,(_.get(Z.level)??0)+1);return _},[i]);return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-3 backdrop-blur-sm sm:p-6",onClick:e,children:y.jsxs("div",{ref:U,role:"dialog","aria-modal":"true","aria-labelledby":"log-viewer-title",onKeyDown:F,className:"animate-modal-in flex h-[min(84dvh,760px)] w-[clamp(560px,85vw,1500px)] min-h-0 flex-col overflow-hidden rounded-xl border border-frame-line glass-panel sm:rounded-2xl",onClick:_=>_.stopPropagation(),children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-line px-5 py-4 sm:px-6",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[y.jsx("span",{className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(ka,{className:"h-5 w-5 text-chip-indigo-text","aria-hidden":"true"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"log-viewer-title",className:"text-base font-semibold text-ink",children:"Application logs"}),y.jsxs("p",{className:"truncate font-mono text-xs text-ink-muted",children:[o,y.jsxs("span",{className:"text-ink-faint",children:[" · ",G2(u)]})]})]})]}),y.jsxs("div",{className:"relative min-w-[220px] flex-1",children:[y.jsx(lO,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-ink-faint","aria-hidden":"true"}),y.jsx("input",{ref:z,type:"search",value:g,onChange:_=>b(_.target.value),placeholder:"Filter log lines…","aria-label":"Filter log lines",className:"w-full rounded-lg border border-line bg-elevated py-1.5 pl-8 pr-2.5 font-mono text-xs text-ink placeholder:text-ink-faint focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400"})]}),y.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[y.jsx($e,{text:S?"Pause live tail":"Resume live tail",block:!1,children:y.jsxs("button",{type:"button",onClick:()=>C(_=>!_),"aria-pressed":S,className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400 ${S?"border-status-success-border bg-status-success-bg text-status-success-text":"border-line bg-elevated text-ink-muted hover:text-ink"}`,children:[y.jsx("span",{className:`h-2 w-2 rounded-full ${S?"bg-emerald-400":"bg-ink-faint"}`,"aria-hidden":"true"}),S?"Live":"Paused"]})}),y.jsx($e,{text:"Refresh now",block:!1,children:y.jsx("button",{type:"button",onClick:()=>void G(),disabled:v,className:"rounded-lg border border-line bg-elevated p-2 text-ink-muted hover:text-ink disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Yd,{className:`h-4 w-4 ${v?"animate-spin":""}`,"aria-hidden":"true"})})}),y.jsx($e,{text:"Copy visible lines",block:!1,children:y.jsx("button",{type:"button",onClick:()=>void me(),disabled:i.length===0,className:"rounded-lg border border-line bg-elevated p-2 text-ink-muted hover:text-ink disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(fi,{className:"h-4 w-4","aria-hidden":"true"})})}),y.jsx($e,{text:"Open log file in the default application",block:!1,children:y.jsx("button",{type:"button",onClick:()=>{t==null||t(),e()},className:"rounded-lg border border-line bg-elevated p-2 text-ink-muted hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(nO,{className:"h-4 w-4","aria-hidden":"true"})})}),y.jsx($e,{text:"Close",block:!1,children:y.jsx("button",{ref:E,type:"button",onClick:e,className:"rounded-lg p-2 text-ink-muted hover:bg-hover-surface hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Ri,{className:"h-4 w-4","aria-hidden":"true"})})})]})]}),y.jsxs("div",{ref:T,onScroll:se,className:"min-h-0 flex-1 overflow-y-auto overscroll-contain bg-app px-2 py-2 font-mono text-xs leading-relaxed sm:px-3",children:[y.jsxs("div",{className:"sticky top-0 z-10 mb-1 flex items-center gap-2 rounded-md border border-line/40 bg-surface/60 px-2 py-1 text-[10px] font-bold uppercase tracking-wider text-ink-muted shadow-sm backdrop-blur-md",role:"row",children:[y.jsx("span",{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),y.jsx("span",{className:"w-[138px] shrink-0 text-ink/70",children:"Time"}),y.jsx("span",{className:"w-[52px] shrink-0 text-ink/70",children:"Level"}),y.jsx("span",{className:"w-[150px] shrink-0 text-ink/70",children:"Source"}),y.jsx("span",{className:"min-w-0 flex-1 text-ink/70",children:"Message"})]}),N&&y.jsx("p",{role:"alert",className:"px-3 py-6 text-center text-xs text-status-danger-text",children:N}),!N&&i.length===0&&!v&&y.jsx("p",{className:"px-3 py-6 text-center text-xs text-ink-faint",children:"No log entries match the current filters."}),y.jsx("ul",{className:"space-y-0.5",children:i.map((_,Z)=>{const ie=Y2[_.level]??Y2.UNKNOWN,re=ie.icon,A=_.level==="ERROR"||_.level==="CRITICAL";return y.jsxs("li",{className:`group flex items-start gap-2 rounded px-2 py-1 ${A?"bg-status-danger-bg/40":"hover:bg-elevated/50"}`,children:[y.jsx("span",{className:ie.className,children:y.jsx(re,{className:"mt-0.5 h-3.5 w-3.5","aria-hidden":"true"})}),y.jsx("span",{className:"w-[138px] shrink-0 text-ink-faint",children:_.timestamp}),y.jsx("span",{className:`w-[52px] shrink-0 text-[10px] font-semibold ${ie.className}`,children:_.level}),y.jsx("span",{className:"w-[150px] shrink-0 truncate text-ink-faint",title:_.source,children:_.source}),y.jsx("span",{className:"min-w-0 flex-1 break-words text-ink-secondary",children:_.message})]},`${Z}-${_.raw}`)})})]}),y.jsx("div",{className:"border-t border-line/60 bg-elevated/50 px-5 py-2.5 text-[11px] text-ink-faint shadow-sm backdrop-blur-md sm:px-6",children:y.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[y.jsx("span",{className:"mr-auto min-w-0 max-w-full basis-full truncate sm:basis-auto",role:"status","aria-atomic":"true",children:v&&i.length===0?"Loading log entries…":`${i.length} of ${G2(u)} shown`}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("div",{className:"flex overflow-hidden rounded-lg border border-line/60 text-[11px] backdrop-blur-sm",role:"group","aria-label":"Filter by log level",children:l8.map(_=>{const Z=d===_.value,ie=_.value?ne.get(_.value)??0:i.length;return y.jsxs("button",{type:"button",onClick:()=>m(_.value),"aria-pressed":Z,title:_.value?`Show ${_.value} and above`:"Show all levels",className:`flex items-center gap-1 px-2.5 py-1 font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-400 ${Z?"bg-indigo-600 text-white":"text-ink-muted hover:bg-elevated hover:text-ink"}`,children:[_.label,y.jsx("span",{className:Z?"text-chip-indigo-text":"text-ink-faint",children:ie})]},_.label)})}),y.jsx($e,{text:"Scroll to the newest entry",block:!1,children:y.jsxs("button",{type:"button",onClick:()=>I(!0),"aria-pressed":D,className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400 ${D?"border-chip-indigo-border bg-chip-indigo-bg text-chip-indigo-text":"border-line bg-elevated text-ink-muted hover:text-ink"}`,children:[y.jsx(JC,{className:"h-3.5 w-3.5","aria-hidden":"true"}),y.jsx("span",{className:"hidden sm:inline",children:"Follow tail"})]})})]}),y.jsxs("span",{className:"hidden items-center gap-1.5 lg:flex",children:[y.jsx("span",{className:"hidden sm:inline",children:"Ctrl + Shift + L"}),y.jsx("span",{children:"opens externally"})]})]})})]})}):null}function G2(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}function o8({isOpen:n,onClose:e}){const t=M.useRef(null),i=ds({isOpen:n,onClose:e,dialogRef:t});if(!n)return null;const l=[{key:"F5",desc:"Refresh / re-scan file list"},{key:"Ctrl + R",desc:"Reload configuration & scan"},{key:"Enter",desc:"Execute / launch selected file"},{key:"P",desc:"Open properties for selected file"},{key:"↑ / ↓",desc:"Navigate file list"},{key:"Home / End",desc:"Jump to first / last file"},{key:"PageUp / PageDown",desc:"Page through the file list"},{key:"Ctrl + D",desc:"Focus Directory field"},{key:"Ctrl + E",desc:"Focus Extension field"},{key:"Ctrl + F",desc:"Focus Filter / Search field"},{key:"Ctrl + L",desc:"Focus File List"},{key:"Ctrl + Shift + L",desc:"Open the log viewer"},{key:"Ctrl + ,",desc:"Open the config editor"},{key:"Ctrl + Shift + T",desc:"Toggle theme (Dark / Light)"},{key:"Ctrl + B",desc:"Toggle barcode scanner mode"},{key:"Ctrl + Shift + B",desc:"Open webcam / camera barcode scanner"},{key:"Ctrl + T",desc:"Open auto-rescan timer modal"},{key:"Ctrl + H",desc:"Set directory to home folder"},{key:"? or Ctrl + /",desc:"Show keyboard shortcuts"},{key:"Y / S / N",desc:"Answer workflow guard: Yes / Skip / No (prompt open)"},{key:"Enter",desc:"Confirm active workflow prompt (prompt open)"},{key:"Escape",desc:"Close dialogs / context menu"}];return y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",children:y.jsxs("div",{ref:t,role:"dialog","aria-modal":"true","aria-label":"Keyboard Shortcuts",onKeyDown:i,className:"animate-modal-in w-[450px] max-w-full rounded-2xl border border-frame-line glass-panel p-5",children:[y.jsxs("div",{className:"mb-4 flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2 font-semibold text-ink",children:[y.jsx(iO,{className:"h-5 w-5 text-chip-indigo-text"}),y.jsx("span",{children:"Keyboard Shortcuts"})]}),y.jsx("button",{onClick:e,className:"focus-ring rounded-lg p-1 text-ink-muted hover:bg-elevated hover:text-ink",children:y.jsx(Ri,{className:"h-4 w-4"})})]}),y.jsx("div",{className:"max-h-[60vh] space-y-2 overflow-y-auto pr-1 text-xs",children:l.map(({key:o,desc:a})=>y.jsxs("div",{className:"flex items-center justify-between rounded-lg bg-elevated/50 px-3 py-2",children:[y.jsx("span",{className:"text-ink-secondary",children:a}),y.jsx("kbd",{className:"rounded bg-app px-2 py-0.5 font-mono text-[11px] font-semibold text-chip-indigo-text border border-line",children:o})]},o))}),y.jsx("div",{className:"mt-5 flex justify-end",children:y.jsx("button",{onClick:e,className:"btn btn-primary rounded-lg px-4 py-2 font-semibold",children:"Close"})})]})})}function a8({isOpen:n,activeConfigPath:e,configExists:t=!0,onClose:i,onLoaded:l}){const[o,a]=M.useState(null),[u,f]=M.useState(""),[d,m]=M.useState(null),[g,b]=M.useState(!1),[v,w]=M.useState(null),S=M.useRef(null),C=M.useRef(null),N=M.useRef(null),j=t===!1;M.useEffect(()=>{var G;if(!n){(G=N.current)==null||G.focus();return}N.current=document.activeElement instanceof HTMLElement?document.activeElement:null,w(null);const T=e??"",z=Math.max(T.lastIndexOf("/"),T.lastIndexOf("\\")),te=z>0?T.slice(0,z):"";D(te);const q=requestAnimationFrame(()=>{var F;return(F=C.current)==null?void 0:F.focus()});return()=>{var F;cancelAnimationFrame(q),(F=N.current)==null||F.focus()}},[n,e]);const D=async T=>{b(!0),w(null);try{const z=await EM(T);a(z),f(z.current_path),e&&z.items.some(te=>te.path===e)?m(e):m(null)}catch(z){w(z.message||"Navigation failed")}finally{b(!1)}},I=T=>{var G;if(T.key==="Escape"){T.preventDefault(),i();return}if(T.key!=="Tab")return;const z=(G=S.current)==null?void 0:G.querySelectorAll('button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(!(z!=null&&z.length))return;const te=z[0],q=z[z.length-1];T.shiftKey&&document.activeElement===te?(T.preventDefault(),q.focus()):!T.shiftKey&&document.activeElement===q&&(T.preventDefault(),te.focus())},U=async()=>{var z;const T=d||(((z=o==null?void 0:o.items.find(te=>te.is_config))==null?void 0:z.path)??null);if(!T){w("Select a configuration file to load.");return}try{b(!0);const te=await CM(T);l(te),i()}catch(te){w(te.message||"Unable to load configuration")}finally{b(!1)}},E=async()=>{const T=(u||(o==null?void 0:o.current_path)||"").trim();if(!T){w("Choose a directory before creating a configuration.");return}try{b(!0);const z=await NM(T);l(z),i()}catch(z){w(z.message||"Unable to create configuration")}finally{b(!1)}};return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-3 backdrop-blur-sm sm:p-6",onClick:i,children:y.jsxs("div",{ref:S,role:"dialog","aria-modal":"true","aria-labelledby":"load-config-title",onKeyDown:I,className:"animate-modal-in flex h-[min(84dvh,760px)] max-h-[calc(100dvh-1.5rem)] w-[min(94vw,960px)] min-h-0 flex-col overflow-hidden rounded-xl border border-frame-line glass-panel sm:rounded-2xl",onClick:T=>T.stopPropagation(),children:[y.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-line px-4 py-3 sm:px-5",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx("span",{className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(oa,{className:"h-5 w-5 text-chip-indigo-text"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"load-config-title",className:"text-sm font-semibold text-ink",children:j?"Create configuration":"Load configuration"}),y.jsx("p",{className:"truncate font-mono text-xs text-ink-muted",children:(o==null?void 0:o.current_path)||""})]})]}),y.jsx($e,{text:"Close",block:!1,children:y.jsx("button",{type:"button",onClick:i,"aria-label":"Close configuration modal",className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg text-ink-muted transition-colors hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Ri,{className:"h-4 w-4"})})})]}),j&&y.jsx("div",{className:"border-b border-line bg-chip-indigo-bg/20 px-4 py-3 text-xs text-ink-secondary",children:"No configuration file was found. Create one here?"}),y.jsxs("div",{className:"border-b border-line px-4 py-3 sm:px-5",children:[y.jsx("label",{htmlFor:"config-path-input",className:"mb-1.5 block text-xs font-medium text-ink-secondary",children:"Configuration directory"}),y.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[y.jsx("input",{ref:C,id:"config-path-input",type:"text",value:u,onChange:T=>f(T.target.value),onKeyDown:T=>{T.key==="Enter"&&D(u.trim())},placeholder:"/path/to/directory",className:"h-10 min-w-0 flex-1 rounded-lg border border-line bg-elevated px-2.5 font-mono text-sm text-ink outline-none placeholder:text-ink-faint transition-colors hover:bg-surface-strong focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-indigo-500/30"}),y.jsx("button",{type:"button",onClick:()=>D(u.trim()),className:"inline-flex h-10 shrink-0 items-center gap-1.5 rounded-lg border border-line bg-elevated px-3.5 text-sm font-medium text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Go"}),y.jsx($e,{text:"Home directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>D(""),"aria-label":"Home directory",className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx($d,{className:"h-4 w-4"})})}),(o==null?void 0:o.parent_path)&&y.jsx($e,{text:"Parent directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>D(o.parent_path),"aria-label":"Parent directory",className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Xd,{className:"h-4 w-4 rotate-180"})})})]})]}),y.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2 sm:px-3 sm:py-3","aria-busy":g,children:g?y.jsxs("div",{className:"flex h-full items-center justify-center gap-2.5 text-sm text-ink-muted",children:[y.jsx(sl,{className:"h-5 w-5 animate-spin text-chip-indigo-text"}),y.jsx("span",{role:"status",children:"Loading configuration files…"})]}):v?y.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-2.5 text-center",children:[y.jsx("p",{className:"text-sm text-status-danger-text",children:v}),y.jsx("button",{type:"button",onClick:()=>D(u||(o==null?void 0:o.current_path)||""),className:"min-h-10 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Retry"})]}):y.jsxs("ul",{className:"space-y-1",children:[o==null?void 0:o.items.map(T=>{if(T.is_dir)return y.jsx("li",{children:y.jsx("button",{onClick:()=>D(T.path),onDoubleClick:()=>D(T.path),className:"flex w-full items-center justify-between rounded-md px-3 py-1.5 text-left text-xs text-ink-secondary hover:bg-elevated",children:y.jsxs("span",{className:"flex items-center gap-2",children:[y.jsx(Ou,{className:"h-3.5 w-3.5 text-chip-indigo-text"}),T.name]})})},T.path);const z=d===T.path;return y.jsx("li",{children:y.jsxs("button",{type:"button",onClick:()=>m(T.path),"aria-pressed":z,className:`flex w-full items-center justify-between rounded-lg px-3 py-1.5 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-400 ${z?"bg-chip-indigo-bg text-chip-indigo-text":"text-ink-secondary hover:bg-elevated hover:text-ink"}`,children:[y.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx(ka,{className:"h-5 w-5 shrink-0 text-chip-amber-text"}),y.jsx("span",{className:"truncate",children:T.name})]}),T.is_config&&y.jsx(oa,{className:"h-4 w-4 shrink-0 text-chip-indigo-text"}),z&&y.jsx(Lr,{className:"h-4 w-4 shrink-0 text-chip-indigo-text"})]})},T.path)}),(o==null?void 0:o.items.filter(T=>T.is_config).length)===0&&y.jsxs("li",{className:"flex h-full min-h-36 flex-col items-center justify-center gap-2.5 text-center text-sm text-ink-muted",children:[y.jsx(ka,{className:"h-7 w-7 text-ink-faint"}),"No configuration files found"]})]})}),y.jsxs("div",{className:"flex flex-col gap-2 border-t border-line px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:px-5",children:[y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("p",{className:"mb-0.5 text-xs font-medium text-ink-muted",children:"Selected file"}),y.jsx("p",{className:"truncate font-mono text-sm text-ink",title:d||u,children:d||u||"—"})]}),y.jsxs("div",{className:"flex shrink-0 justify-end gap-1.5",children:[y.jsx("button",{type:"button",onClick:i,className:"min-h-10 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Cancel"}),j?y.jsxs("button",{type:"button",onClick:E,disabled:!u.trim(),className:"btn btn-primary min-h-10 rounded-lg px-4 text-sm font-semibold",children:[y.jsx(oa,{className:"h-4 w-4"}),"Create configuration"]}):y.jsxs("button",{type:"button",onClick:U,disabled:!d,className:"btn btn-primary min-h-10 rounded-lg px-4 text-sm font-semibold",children:[y.jsx(oa,{className:"h-4 w-4"}),"Load configuration"]})]})]})]})}):null}function xA({isOpen:n,onClose:e,initialFilePath:t,md5:i}){const[l,o]=M.useState(null),[a,u]=M.useState(""),[f,d]=M.useState([]),[m,g]=M.useState(!1),[b,v]=M.useState(null),[w,S]=M.useState(!1),[C,N]=M.useState(!1),[j,D]=M.useState(null),I=M.useRef(null),U=ds({isOpen:n,onClose:e,dialogRef:I});M.useEffect(()=>{if(!n)return;async function ne(){if(t){g(!0);try{const _=await qk({filePath:t});o(_.image),u(_.content),E(_.content)}catch(_){v(_.message)}finally{g(!1)}}}ne()},[n,t]);const E=ne=>{const _=ne.split(";").map(Z=>{const ie=Z.split("=");return{key:ie[0]||"",value:ie[1]||""}}).filter(Z=>Z.key||Z.value);d(_)},T=async ne=>{const _=ne.filter(Z=>Z.key.trim()).map(Z=>`${Z.key.trim()}=${Z.value.trim()}`).join(";");if(u(_),!_){o(null);return}try{const Z=await qk({content:_});o(Z.image)}catch(Z){console.error("Failed to re-generate barcode:",Z)}},z=(ne,_,Z)=>{const ie=[...f];ie[ne][_]=Z,d(ie),T(ie)},te=()=>{const ne=[...f,{key:"",value:""}];d(ne)},q=ne=>{const _=f.filter((Z,ie)=>ie!==ne);d(_),T(_)},G=()=>{if(!i||f.some(_=>_.key.toLowerCase()==="md5"))return;const ne=[...f,{key:"md5",value:i}];d(ne),T(ne)},F=async()=>{if(l){D("Saving…");try{const ne=await LM(l,`profiles-qr-${Date.now()}.png`);D(ne.path||ne.message)}catch(ne){D(`Save failed: ${(ne==null?void 0:ne.message)??ne}`)}finally{setTimeout(()=>D(null),6e3)}}},se=async()=>{try{await navigator.clipboard.writeText(a),S(!0),setTimeout(()=>S(!1),2e3)}catch(ne){console.error("Copy failed",ne)}},me=async()=>{if(l)try{const _=await(await fetch(l)).blob();await navigator.clipboard.write([new ClipboardItem({[_.type]:_})]),N(!0),setTimeout(()=>N(!1),2e3)}catch(ne){console.error("Image copy failed",ne)}};return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4",onClick:e,children:y.jsxs("div",{ref:I,role:"dialog","aria-modal":"true","aria-label":"QR Code Settings",onKeyDown:U,className:"animate-modal-in w-full max-w-md rounded-xl border border-frame-line glass-panel p-6",onClick:ne=>ne.stopPropagation(),children:[y.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[y.jsx("h3",{className:"text-sm font-semibold text-ink",children:"QR Code Settings"}),y.jsx("button",{onClick:e,className:"focus-ring rounded-md p-1 text-ink-muted hover:bg-elevated hover:text-ink",children:y.jsx(Ri,{className:"h-4 w-4"})})]}),m?y.jsx("div",{className:"flex h-48 items-center justify-center",children:y.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent"})}):b?y.jsx("div",{className:"rounded-md border border-status-danger-border bg-status-danger-bg p-4 text-center text-xs text-status-danger-text",children:b}):y.jsxs("div",{className:"space-y-6",children:[y.jsxs("div",{className:"flex flex-col items-center gap-4",children:[y.jsxs("div",{className:"relative group",children:[y.jsx("div",{className:"h-48 w-48 overflow-hidden rounded-lg border border-line bg-white p-2",children:l?y.jsx("img",{src:l,alt:"QR Code",className:"h-full w-full object-contain"}):y.jsx("div",{className:"flex h-full items-center justify-center text-xs text-slate-400",children:"No content"})}),l&&y.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity bg-black/20 rounded-lg",children:y.jsxs("button",{onClick:me,className:"focus-ring flex items-center gap-2 rounded-md bg-white/90 p-2 text-xs font-medium text-slate-900 shadow-sm hover:bg-white",children:[C?y.jsx(Lr,{className:"h-3.5 w-3.5"}):y.jsx(fi,{className:"h-3.5 w-3.5"}),C?"Copied":"Copy Image"]})})]}),y.jsxs("div",{className:"flex w-full gap-2",children:[y.jsxs("button",{onClick:se,className:"btn btn-secondary flex-1 px-3 py-1.5",children:[w?y.jsx(Lr,{className:"h-3.5 w-3.5 text-status-success-text"}):y.jsx(fi,{className:"h-3.5 w-3.5"}),"Copy Content"]}),y.jsxs("button",{onClick:F,disabled:!l,className:"btn btn-primary flex-1 px-3 py-1.5",children:[y.jsx(tO,{className:"h-3.5 w-3.5"}),"Save Image"]})]}),j&&y.jsx("p",{className:"break-all text-center text-[11px] text-ink-muted",role:"status",children:j})]}),y.jsxs("div",{className:"space-y-3",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("label",{className:"text-xs font-medium text-ink-muted uppercase tracking-wider",children:"Payload Fields"}),y.jsxs("div",{className:"flex gap-2",children:[i&&!f.some(ne=>ne.key==="md5")&&y.jsxs("button",{onClick:G,className:"btn-chip flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-bold text-chip-purple-text border border-chip-purple-border",children:[y.jsx(aa,{className:"h-3 w-3"})," Inc. MD5"]}),y.jsxs("button",{onClick:te,className:"btn-chip flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-bold text-chip-indigo-text border border-chip-indigo-border",children:[y.jsx(sD,{className:"h-3 w-3"})," Add Field"]})]})]}),y.jsxs("div",{className:"max-h-48 space-y-2 overflow-y-auto pr-1 custom-scrollbar",children:[f.map((ne,_)=>y.jsxs("div",{className:"flex gap-2 items-center slide-in",children:[y.jsx("input",{type:"text",placeholder:"key",value:ne.key,onChange:Z=>z(_,"key",Z.target.value),className:"w-1/3 rounded border border-line bg-elevated px-2 py-1 text-xs text-ink focus:border-indigo-500 focus:outline-none"}),y.jsx("input",{type:"text",placeholder:"value",value:ne.value,onChange:Z=>z(_,"value",Z.target.value),className:"flex-1 rounded border border-line bg-elevated px-2 py-1 text-xs text-ink focus:border-indigo-500 focus:outline-none"}),y.jsx("button",{onClick:()=>q(_),className:"p-1 text-ink-muted hover:text-status-danger-text transition-colors","aria-label":"Remove field",children:y.jsx(oO,{className:"h-3.5 w-3.5"})})]},_)),f.length===0&&y.jsx("p",{className:"text-center py-4 text-xs text-ink-muted italic",children:"No fields defined"})]})]}),y.jsxs("div",{className:"pt-2 border-t border-line",children:[y.jsx("label",{className:"text-[10px] font-medium text-ink-muted uppercase tracking-wider block mb-1.5",children:"Raw Preview"}),y.jsx("div",{className:"rounded bg-elevated p-2 font-mono text-[10px] text-ink-secondary break-all border border-line",children:a||y.jsx("span",{className:"italic text-ink-muted/50",children:"empty"})})]})]})]})}):null}const K2=["Bytes","KB","MB","GB","TB"];function yA(n){if(n===0)return"0 Bytes";const e=1024,t=Math.max(0,Math.min(K2.length-1,Math.floor(Math.log(n)/Math.log(e))));return parseFloat((n/Math.pow(e,t)).toFixed(2))+" "+K2[t]}function c8(n){const e=Math.max(n.lastIndexOf("\\"),n.lastIndexOf("/"));return e===-1?"":n.slice(0,e)}function u8(n){const e=[`File Properties: ${n.name}`,`Path: ${n.path}`,`Type: ${n.type}`,`Size: ${yA(n.size_bytes)}`,`Created: ${n.created}`,`Modified: ${n.modified}`];return n.md5&&e.push(`MD5: ${n.md5}`),n.sha256&&e.push(`SHA256: ${n.sha256}`),e.join(` -`)}function D0(n,e,t){return n.length<=e+t+1?n:`${n.slice(0,e)}…${n.slice(-t)}`}function f8(n){const e=n.includes("\\")?"\\":"/",t=n.split(/[\\/]/);return t.length<=5?n:[t[0],t[1],"…",t[t.length-2],t[t.length-1]].join(e)}const h8=[{ms:1e3*60,unit:"minute"},{ms:1e3*60*60,unit:"hour"},{ms:1e3*60*60*24,unit:"day"},{ms:1e3*60*60*24*30,unit:"month"},{ms:1e3*60*60*24*365,unit:"year"}];function W2(n,e=new Date){const t=new Date(n.replace(" ","T"));if(Number.isNaN(t.getTime()))return"just now";const i=e.getTime()-t.getTime();if(i<6e4)return"just now";let l="just now";for(const{ms:o,unit:a}of h8){if(i{var F;n||((F=D.current)==null||F.focus(),v(!1))},[n]),M.useEffect(()=>{if(!n||!e)return;const F=new AbortController;return I.current=F,o(null),N(null),u(!0),d(null),(async()=>{try{const se=await jM(e.path,F.signal);if(I.current!==F)return;o(se)}catch(se){if(I.current!==F||se instanceof DOMException&&se.name==="AbortError")return;d(se instanceof Error?se.message:"Failed to load properties")}finally{I.current===F&&u(!1)}})(),()=>{I.current=null,F.abort()}},[n,e]),M.useEffect(()=>{if(!n)return;const F=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=F}},[n]),M.useEffect(()=>{if(!n)return;const F=se=>{if(se.key==="Escape"){if(b)return;t();return}if(se.key!=="Tab")return;const me=j.current;if(!me)return;const ne=Array.from(me.querySelectorAll('button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(re=>re.offsetParent!==null);if(ne.length===0)return;const _=ne[0],Z=ne[ne.length-1],ie=document.activeElement instanceof HTMLElement?document.activeElement:null;se.shiftKey?(ie===_||!me.contains(ie))&&(se.preventDefault(),Z.focus()):ie===Z&&(se.preventDefault(),_.focus())};return window.addEventListener("keydown",F),()=>window.removeEventListener("keydown",F)},[n,b,t]),M.useEffect(()=>{if(!n)return;const F=document.activeElement instanceof HTMLElement?document.activeElement:null;D.current=F;const se=requestAnimationFrame(()=>{var me,ne;(ne=(me=j.current)==null?void 0:me.querySelector("button"))==null||ne.focus()});return()=>cancelAnimationFrame(se)},[n]);const U=async(F,se)=>{try{await navigator.clipboard.writeText(F),g(se),setTimeout(()=>g(null),2e3)}catch(me){console.error("Failed to copy:",me)}},E=async(F,se,me)=>{S(F),N(null);try{await me(),N(se)}catch{N("Action failed")}finally{S(null)}},T=F=>`btn btn-chip rounded-md border px-3 py-2 text-xs ${{reveal:"bg-chip-sky-bg text-chip-sky-text border-chip-sky-border",launch:"border-emerald-500/30 bg-emerald-600 font-semibold text-white hover:bg-emerald-500",folder:"bg-chip-amber-bg text-chip-amber-text border-chip-amber-border"}[F]??"bg-chip-indigo-bg text-chip-indigo-text border-chip-indigo-border"}`,z=(F,se,me,ne=!1,_)=>y.jsxs("div",{className:"flex items-start gap-2 py-1.5 group",children:[y.jsxs("span",{className:"text-ink-muted min-w-[100px] text-xs",children:[F,":"]}),y.jsx("div",{className:"flex-1 min-w-0",children:y.jsx("span",{className:`text-ink text-xs break-all ${ne?"font-mono":""}`,children:_??se})}),y.jsx($e,{text:"Copy to clipboard",block:!1,children:y.jsx("button",{onClick:()=>U(se,me),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-elevated","aria-label":`Copy ${F}`,children:m===me?y.jsx(Lr,{className:"h-3.5 w-3.5 text-status-success-text"}):y.jsx(fi,{className:"h-3.5 w-3.5 text-ink-muted"})})})]}),te=(F,se,me)=>y.jsxs("div",{className:"rounded-lg border border-line bg-elevated p-4",children:[y.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[se,y.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-ink-muted",children:F})]}),me]}),q=()=>y.jsx($e,{text:"Click to copy full path",children:y.jsxs("button",{onClick:()=>void U(l.path,"path"),className:"group mb-3 flex w-full items-center gap-2 rounded-lg border border-line bg-elevated px-3 py-2 text-left hover:bg-surface",children:[y.jsx(Ou,{className:"text-chip-amber-text h-4 w-4 flex-shrink-0"}),y.jsx("span",{className:"text-ink min-w-0 flex-1 truncate font-mono text-xs",children:f8(l.path)}),m==="path"?y.jsx(Lr,{className:"text-status-success-text h-3.5 w-3.5"}):y.jsx(fi,{className:"text-ink-muted h-3.5 w-3.5"})]})});if(!n||!e)return null;const G=e;return y.jsxs("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 backdrop-blur-md p-4",role:"dialog","aria-modal":"true","aria-labelledby":"properties-modal-title",children:[y.jsx("div",{className:"absolute inset-0",onClick:t,onContextMenu:F=>{F.preventDefault(),t()}}),y.jsxs("div",{ref:j,className:"animate-modal-in relative w-full max-w-4xl max-h-[90vh] overflow-hidden rounded-xl border border-frame-line glass-panel flex flex-col",children:[y.jsx("div",{className:"flex-shrink-0 border-b border-line px-6 py-4",children:y.jsxs("div",{className:"flex items-start justify-between gap-4",children:[y.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[y.jsx("div",{className:"rounded-lg bg-indigo-600 p-2 flex-shrink-0",children:y.jsx(Wg,{className:"h-5 w-5 text-white"})}),y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("h3",{id:"properties-modal-title",className:"text-base font-semibold text-ink truncate",children:"File Properties"}),y.jsx("p",{className:"text-xs text-ink-muted truncate",children:e.filename})]}),y.jsx($e,{text:"Copy all properties to clipboard",block:!1,children:y.jsx("button",{onClick:()=>{l&&U(u8(l),"all")},disabled:!l||a||f!==null,className:"btn-chip ml-2 flex items-center gap-1 rounded-md border border-chip-indigo-border bg-chip-indigo-bg p-1.5 text-chip-indigo-text","aria-label":"Copy all properties",children:m==="all"?y.jsx(Lr,{className:"h-4 w-4 text-status-success-text"}):y.jsx(fi,{className:"h-4 w-4"})})}),y.jsx($e,{text:"Generate Barcode/QR Code",block:!1,children:y.jsx("button",{onClick:()=>v(!0),className:"btn-chip rounded-md border border-chip-indigo-border bg-chip-indigo-bg p-1.5 text-chip-indigo-text",children:y.jsx(yy,{className:"h-4 w-4"})})})]}),y.jsx("button",{onClick:t,className:"focus-ring rounded-md p-1 text-ink-muted hover:bg-elevated hover:text-ink flex-shrink-0","aria-label":"Close",children:y.jsx(Ri,{className:"h-4 w-4"})})]})}),y.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:[a&&y.jsx("div",{className:"flex items-center justify-center py-8",children:y.jsxs("div",{className:"flex flex-col items-center gap-2",children:[y.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent"}),y.jsx("p",{className:"text-xs text-ink-muted",children:"Loading properties..."})]})}),f&&y.jsx("div",{className:"rounded-lg border border-status-danger-border bg-status-danger-bg p-4 text-center",children:y.jsx("p",{className:"text-xs text-status-danger-text",children:f})}),l&&!a&&!f&&y.jsxs("div",{children:[y.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-x-4 gap-y-1.5 rounded-lg border border-line bg-elevated px-4 py-2.5",children:[y.jsx("span",{className:"inline-flex items-center gap-1 rounded-md border border-chip-indigo-border bg-chip-indigo-bg px-2 py-0.5 text-xs font-semibold text-chip-indigo-text",children:l.type}),l.attributes.extension&&y.jsx("span",{className:"inline-flex items-center rounded-md border border-line bg-surface px-2 py-0.5 text-xs font-medium text-ink-muted",children:l.attributes.extension}),y.jsxs("span",{className:"text-xs text-ink-muted",title:`${l.size_bytes} bytes`,children:["Size ",y.jsx("strong",{className:"text-ink font-medium",children:yA(l.size_bytes)})]}),y.jsxs("span",{className:"text-xs text-ink-muted",title:l.created,children:["Created ",y.jsx("strong",{className:"text-ink font-medium",children:W2(l.created)})]}),y.jsxs("span",{className:"text-xs text-ink-muted",title:l.modified,children:["Modified ",y.jsx("strong",{className:"text-ink font-medium",children:W2(l.modified)})]}),l.md5&&y.jsx("span",{className:"inline-flex items-center rounded-md border border-chip-purple-border bg-chip-purple-bg px-2 py-0.5 font-mono text-xs font-medium text-chip-purple-text",title:`MD5 ${l.md5}`,children:D0(l.md5,4,4)}),l.attributes.is_symlink&&y.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-chip-fuchsia-border bg-chip-fuchsia-bg px-2 py-0.5 text-xs font-medium text-chip-fuchsia-text",children:[y.jsx(K4,{className:"h-3 w-3"})," Symlink"]})]}),q(),y.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[te("Hashes",y.jsx(aa,{className:"text-chip-purple-text h-3.5 w-3.5"}),y.jsxs("div",{className:"space-y-0.5",children:[z("MD5",l.md5,"md5",!0,D0(l.md5,10,6)),z("SHA256",l.sha256,"sha256",!0,D0(l.sha256,10,6))]})),te("Timestamps",y.jsx(r4,{className:"text-chip-sky-text h-3.5 w-3.5"}),y.jsxs("div",{className:"space-y-0.5",children:[z("Created",l.created,"created",!0),z("Modified",l.modified,"modified",!0)]})),te("Identity",y.jsx(Wg,{className:"text-chip-indigo-text h-3.5 w-3.5"}),y.jsxs("div",{className:"space-y-0.5",children:[z("Type",l.type,"type"),l.attributes.stem&&z("Stem",l.attributes.stem,"attrStem"),z("Extension",l.name.includes(".")?l.name.slice(l.name.lastIndexOf(".")):"None","extension"),z("Directory",c8(l.path)||"None","directory",!0)]})),te("System",y.jsx(Wg,{className:"text-status-success-text h-3.5 w-3.5"}),y.jsxs("div",{children:[y.jsxs("div",{className:"mb-1 flex min-h-[24px] flex-wrap items-center gap-1.5",children:[l.attributes.is_readonly&&y.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-status-danger-border bg-status-danger-bg px-2 py-0.5 text-xs text-status-danger-text",children:[y.jsx(J4,{className:"h-3 w-3"})," Read-only"]}),l.attributes.is_hidden&&y.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-slate-500/30 bg-slate-600/20 px-2 py-0.5 text-xs text-slate-300",children:[y.jsx(T4,{className:"h-3 w-3"})," Hidden"]}),!l.attributes.is_readonly&&!l.attributes.is_hidden&&!l.attributes.is_symlink&&y.jsx("span",{className:"text-xs text-ink-muted",children:"No special flags"})]}),y.jsxs("div",{className:"space-y-0.5",children:[z("File Type",l.attributes.is_file?"Regular File":l.attributes.is_dir?"Directory":"Other","fileType"),l.attributes.permissions&&z("Permissions",l.attributes.permissions,"permissions",!0),l.attributes.owner_uid!==void 0&&z("Owner UID",String(l.attributes.owner_uid),"ownerUid"),l.attributes.group_gid!==void 0&&z("Group GID",String(l.attributes.group_gid),"groupGid")]})]}))]})]})]}),y.jsx("div",{className:"flex-shrink-0 border-t border-line px-6 py-3",children:y.jsxs("div",{className:"flex justify-between items-center gap-2",children:[y.jsx("p",{className:"min-w-0 text-xs text-ink-muted truncate",children:C??"Click the copy icon next to any field to copy its value"}),y.jsxs("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[y.jsx($e,{text:"Show file in Explorer",block:!1,children:y.jsxs("button",{onClick:()=>void E("reveal","Revealed in Explorer",()=>WC(G.path)),disabled:w!==null,className:T("reveal"),children:[y.jsx(G0,{className:"h-3.5 w-3.5"})," Reveal"]})}),y.jsx($e,{text:"Launch file with default association",block:!1,children:y.jsxs("button",{onClick:()=>{i&&(S("launch"),Promise.resolve(i(G)).finally(()=>S(null)))},disabled:w!==null||!i,className:T("launch"),children:[y.jsx(ns,{className:"h-3.5 w-3.5"})," Launch"]})}),y.jsx($e,{text:"Open containing folder",block:!1,children:y.jsxs("button",{onClick:()=>void E("folder","Opened folder",()=>Y0(G.path)),disabled:w!==null,className:T("folder"),children:[y.jsx(es,{className:"h-3.5 w-3.5"})," Open Folder"]})}),y.jsx("button",{onClick:t,className:"btn btn-primary px-4 py-2",children:"Close"})]})]})})]}),y.jsx(xA,{isOpen:b,onClose:()=>v(!1),initialFilePath:e.path,md5:l==null?void 0:l.md5})]})}const m8=["qr_code","code_128","code_39","ean_13","ean_8","upc_a","upc_e","data_matrix"],p8=250,g8=400,x8=.7;function y8(n,e=g8,t=x8){const i=n.videoWidth,l=n.videoHeight;if(!i||!l)return null;const o=Math.min(i,l),a=document.createElement("canvas");a.width=Math.min(e,o),a.height=a.width;const u=a.getContext("2d");if(!u)return null;u.drawImage(n,(i-o)/2,(l-o)/2,o,o,0,0,a.width,a.height);const f=a.toDataURL("image/jpeg",t);return f.slice(f.indexOf(",")+1)}function b8(n,e){const t=n.intervalMs??p8;let i=!1,l=!1;const o=()=>{i=!0,clearInterval(a)},a=setInterval(()=>{if(i||l)return;const u=n.capture();u&&(l=!0,n.decode(u).then(f=>{i||f.decoded&&(o(),e.onDetected(f.decoded))}).catch(f=>{i||(o(),e.onError(f instanceof Error?f.message:"Frame decoding failed"))}).finally(()=>{l=!1}))},t);return o}const v8=8e3;function w8({isOpen:n,onClose:e,onDetected:t}){const i=M.useRef(null),l=M.useRef(null),o=ds({isOpen:n,onClose:e,dialogRef:l}),a=M.useRef(null),u=M.useRef(null),f=M.useRef(null),[d,m]=M.useState(null),[g,b]=M.useState(!1),v=()=>{f.current&&(f.current(),f.current=null),u.current&&(cancelAnimationFrame(u.current),u.current=null),a.current&&(a.current.getTracks().forEach(C=>C.stop()),a.current=null),i.current&&(i.current.srcObject=null)};M.useEffect(()=>{if(!n){v(),m(null);return}let C=!0;async function N(){var D,I,U,E,T;if(m(null),b(!1),typeof window<"u"&&!window.isSecureContext&&window.location.hostname!=="localhost"&&window.location.hostname!=="127.0.0.1"){m("Camera access requires HTTPS or localhost. If connecting across a local network IP (e.g. 192.168.x.x), modern browsers disable camera access for insecure HTTP.");return}const j=((I=(D=navigator.mediaDevices)==null?void 0:D.getUserMedia)==null?void 0:I.bind(navigator.mediaDevices))||((U=navigator.getUserMedia)==null?void 0:U.bind(navigator))||((E=navigator.webkitGetUserMedia)==null?void 0:E.bind(navigator))||((T=navigator.mozGetUserMedia)==null?void 0:T.bind(navigator));if(!j){m(window.isSecureContext?"Camera access is not supported by your browser or environment.":"Camera access is blocked because the page is not served over a secure origin (HTTPS or localhost/127.0.0.1).");return}try{let z;const te=await Promise.race([j({video:{facingMode:"environment",width:{ideal:1280},height:{ideal:720}}}),new Promise((q,G)=>{z=window.setTimeout(()=>G(new DOMException("Camera did not start in time","TimeoutError")),v8)})]).finally(()=>{z!==void 0&&window.clearTimeout(z)});if(!C){te.getTracks().forEach(q=>q.stop());return}a.current=te,i.current&&(i.current.srcObject=te,await i.current.play()),"BarcodeDetector"in window?S():w()}catch(z){if(!C)return;console.error("Camera access error:",z),m(z.name==="NotAllowedError"||z.name==="PermissionDeniedError"?"Camera permission denied. Please allow camera access in your browser settings.":z.name==="TimeoutError"?"The camera did not start in time. On macOS, camera capture needs the packaged desktop app — a bare Python process cannot access the camera. Alternatively, open ProFiles in Chrome, Edge or Safari.":`Could not access camera: ${z.message||"Unknown error"}`)}}return N(),()=>{C=!1,v()}},[n]);const w=()=>{b(!0),f.current=b8({capture:()=>i.current?y8(i.current):null,decode:C=>RM({imageBase64:C,formats:[...m8]})},{onDetected:C=>{v(),t(C)},onError:C=>{v(),m(C)}})},S=()=>{const C=["qr_code","code_128","code_39","ean_13","ean_8","upc_a","upc_e","data_matrix"];let N;try{N=new window.BarcodeDetector({formats:C})}catch(D){console.warn("BarcodeDetector formats unsupported:",D),N=new window.BarcodeDetector}const j=async()=>{if(!i.current||i.current.readyState<2){u.current=requestAnimationFrame(j);return}try{const D=await N.detect(i.current);if(D&&D.length>0){const I=D[0].rawValue;if(I){v(),t(I);return}}}catch(D){console.debug("Frame detection error:",D)}u.current=requestAnimationFrame(j)};u.current=requestAnimationFrame(j)};return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",onClick:e,children:y.jsxs("div",{ref:l,role:"dialog","aria-modal":"true","aria-label":"Camera barcode scanner",onKeyDown:o,className:"relative w-full max-w-lg rounded-2xl border border-frame-line glass-panel p-6 flex flex-col",onClick:C=>C.stopPropagation(),children:[y.jsxs("div",{className:"mb-4 flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2 font-semibold text-ink",children:[y.jsx(eO,{className:"h-5 w-5 text-chip-indigo-text"}),y.jsx("span",{children:"Scan with Camera"})]}),y.jsx("button",{onClick:e,className:"focus-ring rounded-lg p-1 text-ink-muted hover:bg-elevated hover:text-ink transition-colors","aria-label":"Close",children:y.jsx(Ri,{className:"h-4 w-4"})})]}),d?y.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[y.jsx("div",{className:"rounded-full bg-status-danger-bg p-3 text-status-danger-text mb-3",children:y.jsx(Gc,{className:"h-6 w-6"})}),y.jsx("p",{className:"text-xs text-status-danger-text max-w-xs",children:d}),y.jsx("button",{onClick:e,className:"btn btn-secondary mt-6 px-4 py-2",children:"Close"})]}):y.jsxs("div",{className:"flex flex-col items-center",children:[y.jsxs("div",{className:"relative aspect-video w-full overflow-hidden rounded-xl bg-black border border-line flex items-center justify-center",children:[y.jsx("video",{ref:i,playsInline:!0,muted:!0,className:"h-full w-full object-cover"}),y.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:y.jsxs("div",{className:"relative h-48 w-48 rounded-lg border-2 border-dashed border-indigo-400/80 bg-indigo-500/5 shadow-[0_0_0_9999px_rgba(0,0,0,0.45)]",children:[y.jsx("div",{className:"absolute top-0 left-0 h-4 w-4 border-t-2 border-l-2 border-indigo-400"}),y.jsx("div",{className:"absolute top-0 right-0 h-4 w-4 border-t-2 border-r-2 border-indigo-400"}),y.jsx("div",{className:"absolute bottom-0 left-0 h-4 w-4 border-b-2 border-l-2 border-indigo-400"}),y.jsx("div",{className:"absolute bottom-0 right-0 h-4 w-4 border-b-2 border-r-2 border-indigo-400"})]})})]}),y.jsx("p",{className:"mt-4 text-center text-xs text-ink-muted",children:g?"Hold a QR code or barcode steady in front of your camera — frames are decoded by the local ProFiles server (no native Barcode Detector in this browser).":"Hold a QR code or barcode steady in front of your camera to auto-scan."})]})]})}):null}function k8({isOpen:n,file:e,onConfirm:t,onDismiss:i}){const l=M.useRef(null);return M.useEffect(()=>{var o;if(n){const a=u=>{u.key==="Enter"?(u.preventDefault(),t()):u.key==="Escape"&&(u.preventDefault(),i())};return window.addEventListener("keydown",a),(o=l.current)==null||o.focus(),()=>window.removeEventListener("keydown",a)}},[n,t,i]),!n||!e?null:y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",onClick:i,children:y.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":`1 file matched: ${e.filename}`,className:"animate-modal-in w-full max-w-sm rounded-xl border border-frame-line glass-panel p-5 flex flex-col gap-4",onClick:o=>o.stopPropagation(),children:[y.jsxs("div",{className:"flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2 font-semibold text-ink text-sm",children:[e.has_hook?y.jsx(ED,{className:"h-4 w-4 text-chip-purple-text"}):y.jsx(ns,{className:"h-4 w-4 text-status-success-text"}),y.jsx("span",{children:"1 File Matched"})]}),y.jsx("button",{onClick:i,className:"focus-ring rounded p-1 text-ink-muted hover:bg-elevated hover:text-ink","aria-label":"Dismiss",children:y.jsx(Ri,{className:"h-4 w-4"})})]}),y.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-line bg-elevated/50 p-3",children:[y.jsx(ka,{className:"h-5 w-5 text-chip-indigo-text shrink-0 mt-0.5"}),y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("h4",{className:"text-xs font-semibold text-ink truncate",children:e.filename}),y.jsx("p",{className:"text-[11px] text-ink-muted truncate mt-0.5",children:e.rel_path||e.path}),e.has_hook&&y.jsx("span",{className:"inline-block mt-1 text-[10px] text-chip-purple-text bg-chip-purple-bg px-1.5 py-0.5 rounded border border-chip-purple-border/50 font-medium",children:"Workflow Hook Configured"})]})]}),y.jsx("p",{className:"text-xs text-ink-muted text-center",children:"Launch this file now?"}),y.jsxs("div",{className:"flex gap-2",children:[y.jsx("button",{type:"button",onClick:i,className:"btn btn-secondary flex-1 px-3 py-1.5",children:"Dismiss (Esc)"}),y.jsxs("button",{ref:l,type:"button",onClick:t,className:"btn btn-primary flex-1 px-3 py-1.5 shadow-md",children:[y.jsx(ns,{className:"h-3 w-3 fill-current"}),"Launch (Enter)"]})]})]})})}function S8({systemInfo:n,fileCount:e,theme:t,onToggleTheme:i,onOpenLog:l,onOpenConfig:o,onShowShortcuts:a,onReloadConfig:u,onExport:f,exportDisabled:d=!1,language:m="en",onLanguageChange:g,lanEnabled:b,onToggleLan:v}){return y.jsxs("footer",{className:"flex items-center justify-between border-t border-line bg-app px-4 py-2 text-[11px] text-ink-muted transition-colors duration-200",children:[y.jsx("div",{className:"flex items-center gap-4",children:n&&y.jsxs("div",{className:"flex items-center gap-1.5 rounded-full border border-line bg-surface px-2.5 py-0.5 text-ink-secondary",children:[y.jsx(XM,{className:"h-3 w-3 text-status-success-text"}),y.jsx("a",{href:`http://${n.hostname}:${window.location.port}`,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ProFiles on ${n.hostname}`,className:"font-mono hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 rounded px-1 py-0.5",children:n.hostname}),y.jsx("span",{className:"text-ink-faint",children:"|"}),y.jsx("a",{href:`http://${n.ip}:${window.location.port}`,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ProFiles on ${n.ip}`,className:"font-mono hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 rounded px-1 py-0.5",children:n.ip}),y.jsx("span",{className:"text-ink-faint",children:"|"}),y.jsxs("span",{className:"flex items-center gap-1",title:"Session user",children:[y.jsx(ND,{className:"h-3 w-3 text-ink-faint"}),y.jsx("span",{children:n.username||"operator"})]}),v!==void 0&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-ink-faint",children:"|"}),y.jsx($e,{text:"LAN access",block:!1,children:y.jsxs("button",{onClick:()=>v(b!==!0),disabled:b===null,"aria-pressed":b===!0,className:`focus-ring flex items-center gap-1 rounded px-1 py-0.5 text-[10px] ${b===null?"text-ink-faint cursor-not-allowed":b===!0?"text-status-success-text":"text-ink-muted hover:text-ink"}`,children:[y.jsx(iD,{className:"h-3 w-3"}),y.jsx("span",{children:"LAN"})]})})]})]})}),y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsxs("span",{children:[y.jsx("strong",{className:"text-ink",children:e})," files found"]}),y.jsx("span",{className:"text-ink-faint",children:"|"}),y.jsx($e,{text:"Keyboard shortcuts (?)",block:!1,children:y.jsxs("button",{onClick:a,className:"focus-ring flex items-center gap-1 text-ink-muted hover:text-ink",children:[y.jsx(iO,{className:"h-3 w-3"}),y.jsx("span",{children:"Shortcuts"})]})}),y.jsx($e,{text:"Open the application log viewer",block:!1,children:y.jsxs("button",{onClick:l,className:"focus-ring flex items-center gap-1 text-ink-muted hover:text-ink",children:[y.jsx(ka,{className:"h-3 w-3"}),y.jsx("span",{children:"Logs"})]})}),y.jsx("span",{className:"text-ink-faint",children:"|"}),u&&y.jsx($e,{text:"Reload configuration from disk",block:!1,children:y.jsxs("button",{onClick:u,className:"focus-ring flex items-center gap-1 text-ink-muted hover:text-ink",children:[y.jsx(Yd,{className:"h-3 w-3"}),y.jsx("span",{children:"Reload"})]})}),f&&y.jsx($e,{text:"Export the current results as CSV",block:!1,children:y.jsxs("button",{onClick:f,disabled:d,className:"focus-ring flex items-center gap-1 rounded text-ink-muted hover:text-ink disabled:opacity-40 disabled:hover:text-ink-muted",children:[y.jsx(tO,{className:"h-3 w-3"}),y.jsx("span",{children:"Export CSV"})]})}),g&&y.jsxs("div",{className:"flex items-center overflow-hidden rounded border border-line text-[10px]",children:[y.jsx($e,{text:"English",block:!1,children:y.jsxs("button",{onClick:()=>g("en"),className:`flex items-center gap-1 px-1.5 py-0.5 transition-colors ${m==="en"?"bg-indigo-600 text-white focus-ring":"text-ink-muted hover:text-ink focus-ring"}`,children:[y.jsx(V4,{className:"h-3 w-3"}),y.jsx("span",{children:"EN"})]})}),y.jsx($e,{text:"Français",block:!1,children:y.jsx("button",{onClick:()=>g("fr"),className:`flex items-center gap-1 px-1.5 py-0.5 transition-colors ${m==="fr"?"bg-indigo-600 text-white focus-ring":"text-ink-muted hover:text-ink focus-ring"}`,children:y.jsx("span",{children:"FR"})})})]}),y.jsx($e,{text:"Open the configuration editor",block:!1,children:y.jsxs("button",{onClick:o,className:"focus-ring flex items-center gap-1 text-ink-muted hover:text-ink",children:[y.jsx(yD,{className:"h-3 w-3"}),y.jsx("span",{children:"Config"})]})}),y.jsx($e,{text:`Switch to ${t==="dark"?"light":"dark"} mode`,block:!1,children:y.jsxs("button",{onClick:i,className:"focus-ring flex items-center gap-1 rounded px-1.5 py-0.5 text-ink-muted hover:bg-elevated hover:text-status-warning-text",children:[t==="dark"?y.jsx(vD,{className:"h-3 w-3 text-status-warning-text"}):y.jsx(tD,{className:"h-3 w-3 text-chip-indigo-text"}),y.jsx("span",{children:t==="dark"?"Light":"Dark"})]})})]})]})}const C8=[{label:"5 seconds",seconds:5},{label:"10 seconds",seconds:10},{label:"30 seconds",seconds:30},{label:"1 minute",seconds:60},{label:"5 minutes",seconds:300}];function O8({isOpen:n,currentInterval:e,onClose:t,onSetInterval:i}){const l=M.useRef(null),o=ds({isOpen:n,onClose:t,dialogRef:l});if(!n)return null;const a=e>0,u=m=>{i(m)},f=m=>{m.preventDefault();const b=m.currentTarget.elements.namedItem("custom-interval"),v=parseInt(b.value,10);!isNaN(v)&&v>0&&i(v)},d=()=>{i(0)};return y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",children:y.jsxs("div",{ref:l,role:"dialog","aria-modal":"true","aria-label":"Auto-Rescan Timer",onKeyDown:o,className:"animate-modal-in w-[420px] max-w-full rounded-2xl border border-frame-line glass-panel p-5",children:[y.jsxs("div",{className:"mb-4 flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2 font-semibold text-ink",children:[y.jsx(sO,{className:"h-5 w-5 text-chip-indigo-text"}),y.jsx("span",{children:"Auto-Rescan Timer"})]}),y.jsx("button",{onClick:t,className:"focus-ring rounded-lg p-1 text-ink-muted hover:bg-elevated hover:text-ink",children:y.jsx(Ri,{className:"h-4 w-4"})})]}),y.jsx("div",{className:"mb-4 rounded-lg bg-elevated/50 px-3 py-2 text-xs",children:a?y.jsxs("div",{className:"flex items-center gap-2 text-status-success-text",children:[y.jsx(b4,{className:"h-4 w-4 animate-pulse"}),y.jsxs("span",{children:["Auto-rescan every ",e,"s"]})]}):y.jsxs("div",{className:"flex items-center gap-2 text-ink-secondary",children:[y.jsx(x4,{className:"h-4 w-4"}),y.jsx("span",{children:"Auto-rescan is disabled"})]})}),y.jsxs("div",{className:"mb-4 space-y-1 text-xs",children:[y.jsx("p",{className:"text-ink-muted",children:"Presets:"}),y.jsx("div",{className:"grid grid-cols-2 gap-2",children:C8.map(m=>y.jsx("button",{onClick:()=>u(m.seconds),className:"rounded-lg border border-line bg-elevated/50 px-3 py-1.5 text-left font-medium text-ink-secondary hover:border-chip-indigo-border hover:bg-chip-indigo-bg/40 hover:text-chip-indigo-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:m.label},m.seconds))})]}),y.jsxs("form",{onSubmit:f,className:"mb-4",children:[y.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-ink-secondary",children:[y.jsx(k4,{className:"h-3.5 w-3.5"}),y.jsx("span",{children:"Custom interval (seconds):"})]}),y.jsxs("div",{className:"mt-1 flex gap-2",children:[y.jsx("input",{type:"number",name:"custom-interval",min:"1",placeholder:"e.g. 45",className:"flex-1 rounded-lg border border-line bg-app px-2 py-1 text-xs text-ink placeholder-ink-faint focus:border-indigo-500 focus:outline-none"}),y.jsx("button",{type:"submit",className:"btn btn-primary rounded-lg px-3 py-1 font-semibold",children:"Set"})]})]}),a&&y.jsx("button",{onClick:d,className:"btn w-full rounded-lg border-line bg-elevated/50 px-3 py-2 text-status-warning-text hover:border-status-warning-border hover:bg-status-warning-bg/40",children:"Stop Auto-Rescan"}),y.jsx("div",{className:"flex justify-end gap-2 border-t border-line pt-3",children:y.jsx("button",{onClick:t,className:"rounded-lg border border-line bg-elevated px-4 py-2 text-xs font-semibold text-ink-secondary hover:bg-elevated/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:"Close"})})]})})}function N8(n,e){const t={};return(n[n.length-1]===""?[...n,""]:n).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}const T8=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,A8=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,E8={};function Z2(n,e){return(E8.jsx?A8:T8).test(n)}const M8=/[ \t\n\f\r]/g;function D8(n){return typeof n=="object"?n.type==="text"?J2(n.value):!1:J2(n)}function J2(n){return n.replace(M8,"")===""}class ju{constructor(e,t,i){this.normal=t,this.property=e,i&&(this.space=i)}}ju.prototype.normal={};ju.prototype.property={};ju.prototype.space=void 0;function bA(n,e){const t={},i={};for(const l of n)Object.assign(t,l.property),Object.assign(i,l.normal);return new ju(t,i,e)}function Jx(n){return n.toLowerCase()}class yi{constructor(e,t){this.attribute=t,this.property=e}}yi.prototype.attribute="";yi.prototype.booleanish=!1;yi.prototype.boolean=!1;yi.prototype.commaOrSpaceSeparated=!1;yi.prototype.commaSeparated=!1;yi.prototype.defined=!1;yi.prototype.mustUseProperty=!1;yi.prototype.number=!1;yi.prototype.overloadedBoolean=!1;yi.prototype.property="";yi.prototype.spaceSeparated=!1;yi.prototype.space=void 0;let R8=0;const Qe=co(),un=co(),ey=co(),xe=co(),Mt=co(),io=co(),Ei=co();function co(){return 2**++R8}const ty=Object.freeze(Object.defineProperty({__proto__:null,boolean:Qe,booleanish:un,commaOrSpaceSeparated:Ei,commaSeparated:io,number:xe,overloadedBoolean:ey,spaceSeparated:Mt},Symbol.toStringTag,{value:"Module"})),R0=Object.keys(ty);class lb extends yi{constructor(e,t,i,l){let o=-1;if(super(e,t),eC(this,"space",l),typeof i=="number")for(;++o4&&t.slice(0,4)==="data"&&B8.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(tC,I8);i="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!tC.test(o)){let a=o.replace(z8,H8);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}l=lb}return new l(i,e)}function H8(n){return"-"+n.toLowerCase()}function I8(n){return n.charAt(1).toUpperCase()}const U8=bA([vA,j8,SA,CA,OA],"html"),sb=bA([vA,_8,SA,CA,OA],"svg");function F8(n){return n.join(" ").trim()}var nC=/\/\*(?:[^*]|\*(?!\/))*\*\//g,q8=/\n/g,V8=/^\s*/,Q8=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,X8=/^:\s*/,$8=/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/,Y8=/^[;\s]*/,G8=` -`,iC="/",rC="*",Uc="",K8="comment",W8="declaration";function Z8(n,e){if(typeof n!="string")throw new TypeError("First argument must be a string");if(!n)return[];e=e||{};var t=1,i=1;function l(w){var S=w.match(q8);S&&(t+=S.length);var C=w.lastIndexOf(G8);i=~C?w.length-C:i+w.length}function o(){var w={line:t,column:i};return function(S){return S.position=new a(w),d(),S}}function a(w){this.start=w,this.end={line:t,column:i},this.source=e.source}a.prototype.content=n;function u(w){var S=new Error(e.source+":"+t+":"+i+": "+w);if(S.reason=w,S.filename=e.source,S.line=t,S.column=i,S.source=n,!e.silent)throw S}function f(w){var S=w.exec(n);if(S){var C=S[0];return l(C),n=n.slice(C.length),S}}function d(){f(V8)}function m(w){for(var S;S=g();)w.push(S);return w}function g(){var w=o();if(!(iC!=n.charAt(0)||rC!=n.charAt(1))){for(var S=2;Uc!=n.charAt(S)&&(rC!=n.charAt(S)||iC!=n.charAt(S+1));)++S;if(S+=2,Uc===n.charAt(S-1))return u("End of comment missing");var C=n.slice(2,S-2);return i+=2,l(C),n=n.slice(S),i+=2,w({type:K8,comment:C})}}function b(){var w=o(),S=f(Q8);if(S){if(g(),!f(X8))return u("property missing ':'");var C=f($8),N=w({type:W8,property:S[0].replace(nC,Uc).trim(),value:C?C[0].replace(nC,Uc).trim():Uc});return f(Y8),N}}function v(){var w=[];m(w);for(var S;S=b();)w.push(S),m(w);return w}return d(),v()}function J8(n,e){let t=null;if(!n||typeof n!="string")return t;const i=Z8(n),l=typeof e=="function";return i.forEach(o=>{if(o.type!=="declaration")return;const{property:a,value:u}=o;l?e(a,u,o):u&&(t=t??{},t[a]=u)}),t}const NA=TA("end"),ob=TA("start");function TA(n){return e;function e(t){const i=t&&t.position&&t.position[n]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function eP(n){const e=ob(n),t=NA(n);if(e&&t)return{start:e,end:t}}function ru(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?lC(n.position):"start"in n||"end"in n?lC(n):"line"in n||"column"in n?ny(n):""}function ny(n){return sC(n&&n.line)+":"+sC(n&&n.column)}function lC(n){return ny(n&&n.start)+"-"+ny(n&&n.end)}function sC(n){return n&&typeof n=="number"?n:1}class Vn extends Error{constructor(e,t,i){super(),typeof t=="string"&&(i=t,t=void 0);let l="",o={},a=!1;if(t&&("line"in t&&"column"in t?o={place:t}:"start"in t&&"end"in t?o={place:t}:"type"in t?o={ancestors:[t],place:t.position}:o={...t}),typeof e=="string"?l=e:!o.cause&&e&&(a=!0,l=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof i=="string"){const f=i.indexOf(":");f===-1?o.ruleId=i:(o.source=i.slice(0,f),o.ruleId=i.slice(f+1))}if(!o.place&&o.ancestors&&o.ancestors){const f=o.ancestors[o.ancestors.length-1];f&&(o.place=f.position)}const u=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=u?u.line:void 0,this.name=ru(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Vn.prototype.file="";Vn.prototype.name="";Vn.prototype.reason="";Vn.prototype.message="";Vn.prototype.stack="";Vn.prototype.column=void 0;Vn.prototype.line=void 0;Vn.prototype.ancestors=void 0;Vn.prototype.cause=void 0;Vn.prototype.fatal=void 0;Vn.prototype.place=void 0;Vn.prototype.ruleId=void 0;Vn.prototype.source=void 0;const ab={}.hasOwnProperty,tP=new Map,nP=/[A-Z]/g,iP=/-([a-z])/g,rP=new Set(["table","tbody","thead","tfoot","tr"]),lP=new Set(["td","th"]),AA="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function sP(n,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const t=e.filePath||void 0;let i;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=mP(t,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=dP(t,e.jsx,e.jsxs)}const l={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:i,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:t,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?sb:U8,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},o=EA(l,n,void 0);return o&&typeof o!="string"?o:l.create(n,l.Fragment,{children:o||void 0},void 0)}function EA(n,e,t){if(e.type==="element")return oP(n,e,t);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return aP(n,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return uP(n,e,t);if(e.type==="mdxjsEsm")return cP(n,e);if(e.type==="root")return fP(n,e,t);if(e.type==="text")return hP(n,e)}function oP(n,e,t){const i=n.schema;let l=i;e.tagName.toLowerCase()==="svg"&&i.space==="html"&&(l=sb,n.schema=l),n.ancestors.push(e);const o=DA(n,e.tagName,!1),a=pP(n,e);let u=ub(n,e);return rP.has(e.tagName)&&(u=u.filter(function(f){return typeof f=="string"?!D8(f):!0})),MA(n,a,o,e),cb(a,u),n.ancestors.pop(),n.schema=i,n.create(e,o,a,t)}function aP(n,e){if(e.data&&e.data.estree&&n.evaluater){const i=e.data.estree.body[0];return i.type,n.evaluater.evaluateExpression(i.expression)}Cu(n,e.position)}function cP(n,e){if(e.data&&e.data.estree&&n.evaluater)return n.evaluater.evaluateProgram(e.data.estree);Cu(n,e.position)}function uP(n,e,t){const i=n.schema;let l=i;e.name==="svg"&&i.space==="html"&&(l=sb,n.schema=l),n.ancestors.push(e);const o=e.name===null?n.Fragment:DA(n,e.name,!0),a=gP(n,e),u=ub(n,e);return MA(n,a,o,e),cb(a,u),n.ancestors.pop(),n.schema=i,n.create(e,o,a,t)}function fP(n,e,t){const i={};return cb(i,ub(n,e)),n.create(e,n.Fragment,i,t)}function hP(n,e){return e.value}function MA(n,e,t,i){typeof t!="string"&&t!==n.Fragment&&n.passNode&&(e.node=i)}function cb(n,e){if(e.length>0){const t=e.length>1?e:e[0];t&&(n.children=t)}}function dP(n,e,t){return i;function i(l,o,a,u){const d=Array.isArray(a.children)?t:e;return u?d(o,a,u):d(o,a)}}function mP(n,e){return t;function t(i,l,o,a){const u=Array.isArray(o.children),f=ob(i);return e(l,o,a,u,{columnNumber:f?f.column-1:void 0,fileName:n,lineNumber:f?f.line:void 0},void 0)}}function pP(n,e){const t={};let i,l;for(l in e.properties)if(l!=="children"&&ab.call(e.properties,l)){const o=xP(n,l,e.properties[l]);if(o){const[a,u]=o;n.tableCellAlignToStyle&&a==="align"&&typeof u=="string"&&lP.has(e.tagName)?i=u:t[a]=u}}if(i){const o=t.style||(t.style={});o[n.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return t}function gP(n,e){const t={};for(const i of e.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&n.evaluater){const o=i.data.estree.body[0];o.type;const a=o.expression;a.type;const u=a.properties[0];u.type,Object.assign(t,n.evaluater.evaluateExpression(u.argument))}else Cu(n,e.position);else{const{name:l}=i;let o;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&n.evaluater){const u=i.value.data.estree.body[0];u.type,o=n.evaluater.evaluateExpression(u.expression)}else Cu(n,e.position);else o=i.value===null?!0:i.value;t[l]=o}return t}function ub(n,e){const t=[];let i=-1;const l=n.passKeys?new Map:tP;for(;++il?0:l+e:e=e>l?l:e,t=t>0?t:0,i.length<1e4)a=Array.from(i),a.unshift(e,t),n.splice(...a);else for(t&&n.splice(e,t);o0?(rr(n,n.length,0,e),n):e}const cC={}.hasOwnProperty;function jA(n){const e={};let t=-1;for(;++t13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function lr(n){return n.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const Ln=ms(/[A-Za-z]/),zn=ms(/[\dA-Za-z]/),TP=ms(/[#-'*+\--9=?A-Z^-~]/);function Ud(n){return n!==null&&(n<32||n===127)}const iy=ms(/\d/),AP=ms(/[\dA-Fa-f]/),LA=ms(/[!-/:-@[-`{-~]/);function Ie(n){return n!==null&&n<-2}function Rt(n){return n!==null&&(n<0||n===32)}function Je(n){return n===-2||n===-1||n===32}const fm=ms(new RegExp("\\p{P}|\\p{S}","u")),oo=ms(/\s/);function ms(n){return e;function e(t){return t!==null&&t>-1&&n.test(String.fromCharCode(t))}}function Ba(n){const e=[];let t=-1,i=0,l=0;for(;++t55295&&o<57344){const u=n.charCodeAt(t+1);o<56320&&u>56319&&u<57344?(a=String.fromCharCode(o,u),l=1):a="�"}else a=String.fromCharCode(o);a&&(e.push(n.slice(i,t),encodeURIComponent(a)),i=t+l+1,a=""),l&&(t+=l,l=0)}return e.join("")+n.slice(i)}function xt(n,e,t,i){const l=i?i-1:1/0;let o=0;return a;function a(f){return Je(f)?(n.enter(t),u(f)):e(f)}function u(f){return Je(f)&&o++=l?e(m):t(m)}}const EP={tokenize:MP};function MP(n){const e=n.attempt(this.parser.constructs.contentInitial,i,l);let t;return e;function i(u){if(u===null){n.consume(u);return}return n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),xt(n,e,"linePrefix")}function l(u){return n.enter("paragraph"),o(u)}function o(u){const f=n.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=f),t=f,a(u)}function a(u){if(u===null){n.exit("chunkText"),n.exit("paragraph"),n.consume(u);return}return Ie(u)?(n.consume(u),n.exit("chunkText"),o):(n.consume(u),a)}}let Fd=class{constructor(){this.index=new Map,this.map=[]}add(e,t,i){uC(this,e,t,i,!1)}addBefore(e,t,i){uC(this,e,t,i,!0)}consume(e){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let t=this.map.length;const i=[];for(;t>0;)t-=1,i.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];i.push(e.slice()),e.length=0;let l=i.pop();for(;l;){for(const o of l)e.push(o);l=i.pop()}this.map.length=0,this.index.clear()}};function uC(n,e,t,i,l){if(t===0&&i.length===0)return;const o=n.index.get(e);if(o){o[1]+=t,l?(i.push(...o[2]),o[2]=i):o[2].push(...i);return}const a=[e,t,i];n.map.push(a),n.index.set(e,a)}const DP={tokenize:RP},fC={tokenize:jP};function RP(n){const e=this,t=[];let i=0,l,o,a;return u;function u(D){if(ia))return;const T=e.events.length;let z=T,te,q;for(;z--;)if(e.events[z][0]==="exit"&&e.events[z][1].type==="chunkFlow"){if(te){q=e.events[z][1].end;break}te=!0}for(N(i),E=T;ED;){const U=t[I];e.containerState=U[1],U[0].exit.call(e,n)}t.length=D}function j(){l.write([null]),o=void 0,l=void 0,e.containerState._closeFlow=void 0}}function jP(n,e,t){return xt(n,n.attempt(this.parser.constructs.document,e,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function us(n){if(n===null||Rt(n)||oo(n))return 1;if(fm(n))return 2}function hm(n,e,t){const i=[];let l=-1;for(;++l1&&n[t][1].end.offset-n[t][1].start.offset>1?2:1,a={...n[l][1].end},u={...n[t][1].start};hC(a,-o),hC(u,o);const f={type:o>1?"strongSequence":"emphasisSequence",start:a,end:{...n[l][1].end}},d={type:o>1?"strongSequence":"emphasisSequence",start:{...n[t][1].start},end:u},m={type:o>1?"strongText":"emphasisText",start:{...n[l][1].end},end:{...n[t][1].start}},g={type:o>1?"strong":"emphasis",start:{...f.start},end:{...d.end}};n[l][1].end={...f.start},n[t][1].start={...d.end},i=[],n[l][1].end.offset-n[l][1].start.offset&&(i=Ui(i,[["enter",n[l][1],e],["exit",n[l][1],e]])),i=Ui(i,[["enter",g,e],["enter",f,e],["exit",f,e],["enter",m,e]]),i=Ui(i,hm(e.parser.constructs.insideSpan.null,n.slice(l+1,t),e)),i=Ui(i,[["exit",m,e],["enter",d,e],["exit",d,e],["exit",g,e]]);let b=0;n[t][1].end.offset-n[t][1].start.offset&&(b=2,i=Ui(i,[["enter",n[t][1],e],["exit",n[t][1],e]])),rr(n,l-1,t-l+3,i),t=l+i.length-b-2;break}}for(t=-1;++t0&&Je(E)?xt(n,j,"linePrefix",o+1)(E):j(E)}function j(E){return E===null||Ie(E)?n.check(ly,S,I)(E):(n.enter("codeFlowValue"),D(E))}function D(E){return E===null||Ie(E)?(n.exit("codeFlowValue"),j(E)):(n.consume(E),D)}function I(E){return n.exit("codeFenced"),e(E)}function U(E,T,z){let te=0;return q;function q(ne){return E.enter("lineEnding"),E.consume(ne),E.exit("lineEnding"),G}function G(ne){return E.enter("codeFencedFence"),Je(ne)?xt(E,F,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ne):F(ne)}function F(ne){return ne===u?(E.enter("codeFencedFenceSequence"),se(ne)):z(ne)}function se(ne){return ne===u?(te++,E.consume(ne),se):te>=a?(E.exit("codeFencedFenceSequence"),Je(ne)?xt(E,me,"whitespace")(ne):me(ne)):z(ne)}function me(ne){return ne===null||Ie(ne)?(E.exit("codeFencedFence"),T(ne)):z(ne)}}}const _0={name:"codeIndented",tokenize:$P},XP={partial:!0,tokenize:YP};function $P(n,e,t){return i;function i(u){return n.enter("codeIndented"),zA(n,l,t,"linePrefix",4,4)(u)}function l(u){return u===null?a(u):Ie(u)?n.attempt(XP,l,a)(u):(n.enter("codeFlowValue"),o(u))}function o(u){return u===null||Ie(u)?(n.exit("codeFlowValue"),l(u)):(n.consume(u),o)}function a(u){return n.exit("codeIndented"),e(u)}}function YP(n,e,t){const i=this;return l;function l(a){return i.parser.lazy[i.now().line]?t(a):Ie(a)?(n.enter("lineEnding"),n.consume(a),n.exit("lineEnding"),l):zA(n,e,o,"linePrefix",4,4)(a)}function o(a){return Ie(a)?l(a):t(a)}}const GP={name:"codeText",previous:WP,resolve:KP,tokenize:ZP};function KP(n){let e=n.length-4,t=3,i,l;if((n[t][1].type==="lineEnding"||n[t][1].type==="space")&&(n[e][1].type==="lineEnding"||n[e][1].type==="space")){for(i=t;++i=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(e,t,i){const l=t||0;this.setCursor(Math.trunc(e));const o=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return i&&Fc(this.left,i),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Fc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Fc(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(a):n.interrupt(i.parser.constructs.flow,t,e)(a)}}function UA(n,e,t,i,l,o,a,u,f){const d=f||Number.POSITIVE_INFINITY;let m=0;return g;function g(N){return N===60?(n.enter(i),n.enter(l),n.enter(o),n.consume(N),n.exit(o),b):N===null||N===32||N===41||Ud(N)?t(N):(n.enter(i),n.enter(a),n.enter(u),n.enter("chunkString",{contentType:"string"}),S(N))}function b(N){return N===62?(n.enter(o),n.consume(N),n.exit(o),n.exit(l),n.exit(i),e):(n.enter(u),n.enter("chunkString",{contentType:"string"}),v(N))}function v(N){return N===62?(n.exit("chunkString"),n.exit(u),b(N)):N===null||N===60||Ie(N)?t(N):(n.consume(N),N===92?w:v)}function w(N){return N===60||N===62||N===92?(n.consume(N),v):v(N)}function S(N){return!m&&(N===null||N===41||Rt(N))?(n.exit("chunkString"),n.exit(u),n.exit(a),n.exit(i),e(N)):m999||v===null||v===91||v===93&&!f||v===94&&!u&&"_hiddenFootnoteSupport"in a.parser.constructs?t(v):v===93?(n.exit(o),n.enter(l),n.consume(v),n.exit(l),n.exit(i),e):Ie(v)?(n.enter("lineEnding"),n.consume(v),n.exit("lineEnding"),m):(n.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===null||v===91||v===93||Ie(v)||u++>999?(n.exit("chunkString"),m(v)):(n.consume(v),f||(f=!Je(v)),v===92?b:g)}function b(v){return v===91||v===92||v===93?(n.consume(v),u++,g):g(v)}}function qA(n,e,t,i,l,o){let a;return u;function u(b){return b===34||b===39||b===40?(n.enter(i),n.enter(l),n.consume(b),n.exit(l),a=b===40?41:b,f):t(b)}function f(b){return b===a?(n.enter(l),n.consume(b),n.exit(l),n.exit(i),e):(n.enter(o),d(b))}function d(b){return b===a?(n.exit(o),f(a)):b===null?t(b):Ie(b)?(n.enter("lineEnding"),n.consume(b),n.exit("lineEnding"),xt(n,d,"linePrefix")):(n.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===a||b===null||Ie(b)?(n.exit("chunkString"),d(b)):(n.consume(b),b===92?g:m)}function g(b){return b===a||b===92?(n.consume(b),m):m(b)}}function lu(n,e){let t;return i;function i(l){return Ie(l)?(n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),t=!0,i):Je(l)?xt(n,i,t?"linePrefix":"lineSuffix")(l):e(l)}}const sH={name:"definition",tokenize:aH},oH={partial:!0,tokenize:cH};function aH(n,e,t){const i=this;let l;return o;function o(v){return n.enter("definition"),a(v)}function a(v){return FA.call(i,n,u,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function u(v){return l=lr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),v===58?(n.enter("definitionMarker"),n.consume(v),n.exit("definitionMarker"),f):t(v)}function f(v){return Rt(v)?lu(n,d)(v):d(v)}function d(v){return UA(n,m,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function m(v){return n.attempt(oH,g,g)(v)}function g(v){return Je(v)?xt(n,b,"whitespace")(v):b(v)}function b(v){return v===null||Ie(v)?(n.exit("definition"),i.parser.defined.push(l),e(v)):t(v)}}function cH(n,e,t){return i;function i(u){return Rt(u)?lu(n,l)(u):t(u)}function l(u){return qA(n,o,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function o(u){return Je(u)?xt(n,a,"whitespace")(u):a(u)}function a(u){return u===null||Ie(u)?e(u):t(u)}}const uH={name:"hardBreakEscape",tokenize:fH};function fH(n,e,t){return i;function i(o){return n.enter("hardBreakEscape"),n.consume(o),l}function l(o){return Ie(o)?(n.exit("hardBreakEscape"),e(o)):t(o)}}const hH={name:"headingAtx",resolve:dH,tokenize:mH};function dH(n,e){let t=n.length-2,i=3;if(n[i][1].type==="whitespace"&&(i+=2),t-2>i&&n[t][1].type==="whitespace"&&(t-=2),n[t][1].type==="atxHeadingSequence"&&(i===t-1||t-4>i&&n[t-2][1].type==="whitespace")&&(t-=i+1===t?2:4),t>i){const l={type:"atxHeadingText",start:n[i][1].start,end:n[t][1].end},o={type:"chunkText",start:n[i][1].start,end:n[t][1].end,contentType:"text"};rr(n,i,t-i+1,[["enter",l,e],["enter",o,e],["exit",o,e],["exit",l,e]])}return n}function mH(n,e,t){let i=0;return l;function l(m){return n.enter("atxHeading"),o(m)}function o(m){return n.enter("atxHeadingSequence"),a(m)}function a(m){return m===35&&i++<6?(n.consume(m),a):m===null||Rt(m)?(n.exit("atxHeadingSequence"),u(m)):t(m)}function u(m){return m===35?(n.enter("atxHeadingSequence"),f(m)):m===null||Ie(m)?(n.exit("atxHeading"),e(m)):Je(m)?xt(n,u,"whitespace")(m):(n.enter("atxHeadingText"),d(m))}function f(m){return m===35?(n.consume(m),f):(n.exit("atxHeadingSequence"),u(m))}function d(m){return m===null||m===35||Rt(m)?(n.exit("atxHeadingText"),u(m)):(n.consume(m),d)}}const VA=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],sy=["pre","script","style","textarea"],pH={concrete:!0,name:"htmlFlow",resolveTo:xH,tokenize:yH},gH={partial:!0,tokenize:bH};function xH(n){let e=n.length;for(;e--&&!(n[e][0]==="enter"&&n[e][1].type==="htmlFlow"););return e>1&&n[e-2][1].type==="linePrefix"&&(n[e][1].start=n[e-2][1].start,n[e+1][1].start=n[e-2][1].start,n.splice(e-2,2)),n}function yH(n,e,t){const i=this;let l,o,a,u,f;return d;function d(B){return m(B)}function m(B){return n.enter("htmlFlow"),n.enter("htmlFlowData"),n.consume(B),g}function g(B){return B===33?(n.consume(B),b):B===47?(n.consume(B),o=!0,S):B===63?(n.consume(B),l=3,i.interrupt?e:A):Ln(B)?(n.consume(B),a=String.fromCharCode(B),C):t(B)}function b(B){return B===45?(n.consume(B),l=2,v):B===91?(n.consume(B),l=5,u=0,w):Ln(B)?(n.consume(B),l=4,i.interrupt?e:A):t(B)}function v(B){return B===45?(n.consume(B),i.interrupt?e:A):t(B)}function w(B){const R="CDATA[";return B===R.charCodeAt(u++)?(n.consume(B),u===R.length?i.interrupt?e:F:w):t(B)}function S(B){return Ln(B)?(n.consume(B),a=String.fromCharCode(B),C):t(B)}function C(B){if(B===null||B===47||B===62||Rt(B)){const R=B===47,$=a.toLowerCase();return!R&&!o&&sy.includes($)?(l=1,i.interrupt?e(B):F(B)):VA.includes(a.toLowerCase())?(l=6,R?(n.consume(B),N):i.interrupt?e(B):F(B)):(l=7,i.interrupt&&!i.parser.lazy[i.now().line]?t(B):o?j(B):D(B))}return B===45||zn(B)?(n.consume(B),a+=String.fromCharCode(B),C):t(B)}function N(B){return B===62?(n.consume(B),i.interrupt?e:F):t(B)}function j(B){return Je(B)?(n.consume(B),j):q(B)}function D(B){return B===47?(n.consume(B),q):B===58||B===95||Ln(B)?(n.consume(B),I):Je(B)?(n.consume(B),D):q(B)}function I(B){return B===45||B===46||B===58||B===95||zn(B)?(n.consume(B),I):U(B)}function U(B){return B===61?(n.consume(B),E):Je(B)?(n.consume(B),U):D(B)}function E(B){return B===null||B===60||B===61||B===62||B===96?t(B):B===34||B===39?(n.consume(B),f=B,T):Je(B)?(n.consume(B),E):z(B)}function T(B){return B===f?(n.consume(B),f=null,te):B===null||Ie(B)?t(B):(n.consume(B),T)}function z(B){return B===null||B===34||B===39||B===47||B===60||B===61||B===62||B===96||Rt(B)?U(B):(n.consume(B),z)}function te(B){return B===47||B===62||Je(B)?D(B):t(B)}function q(B){return B===62?(n.consume(B),G):t(B)}function G(B){return B===null||Ie(B)?F(B):Je(B)?(n.consume(B),G):t(B)}function F(B){return B===45&&l===2?(n.consume(B),_):B===60&&l===1?(n.consume(B),Z):B===62&&l===4?(n.consume(B),Be):B===63&&l===3?(n.consume(B),A):B===93&&l===5?(n.consume(B),re):Ie(B)&&(l===6||l===7)?(n.exit("htmlFlowData"),n.check(gH,ze,se)(B)):B===null||Ie(B)?(n.exit("htmlFlowData"),se(B)):(n.consume(B),F)}function se(B){return n.check(ly,me,ze)(B)}function me(B){return n.enter("lineEnding"),n.consume(B),n.exit("lineEnding"),ne}function ne(B){return B===null||Ie(B)?se(B):(n.enter("htmlFlowData"),F(B))}function _(B){return B===45?(n.consume(B),A):F(B)}function Z(B){return B===47?(n.consume(B),a="",ie):F(B)}function ie(B){if(B===62){const R=a.toLowerCase();return sy.includes(R)?(n.consume(B),Be):F(B)}return Ln(B)&&a.length<8?(n.consume(B),a+=String.fromCharCode(B),ie):F(B)}function re(B){return B===93?(n.consume(B),A):F(B)}function A(B){return B===62?(n.consume(B),Be):B===45&&l===2?(n.consume(B),A):F(B)}function Be(B){return B===null||Ie(B)?(n.exit("htmlFlowData"),ze(B)):(n.consume(B),Be)}function ze(B){return n.exit("htmlFlow"),e(B)}}function bH(n,e,t){return i;function i(l){return n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),n.attempt(_u,e,t)}}const vH={name:"htmlText",tokenize:wH};function wH(n,e,t){const i=this;let l,o,a;return u;function u(A){return n.enter("htmlText"),n.enter("htmlTextData"),n.consume(A),f}function f(A){return A===33?(n.consume(A),d):A===47?(n.consume(A),U):A===63?(n.consume(A),D):Ln(A)?(n.consume(A),z):t(A)}function d(A){return A===45?(n.consume(A),m):A===91?(n.consume(A),o=0,w):Ln(A)?(n.consume(A),j):t(A)}function m(A){return A===45?(n.consume(A),v):t(A)}function g(A){return A===null?t(A):A===45?(n.consume(A),b):Ie(A)?(a=g,Z(A)):(n.consume(A),g)}function b(A){return A===45?(n.consume(A),v):g(A)}function v(A){return A===62?_(A):A===45?b(A):g(A)}function w(A){const Be="CDATA[";return A===Be.charCodeAt(o++)?(n.consume(A),o===Be.length?S:w):t(A)}function S(A){return A===null?t(A):A===93?(n.consume(A),C):Ie(A)?(a=S,Z(A)):(n.consume(A),S)}function C(A){return A===93?(n.consume(A),N):S(A)}function N(A){return A===62?_(A):A===93?(n.consume(A),N):S(A)}function j(A){return A===null||A===62?_(A):Ie(A)?(a=j,Z(A)):(n.consume(A),j)}function D(A){return A===null?t(A):A===63?(n.consume(A),I):Ie(A)?(a=D,Z(A)):(n.consume(A),D)}function I(A){return A===62?_(A):D(A)}function U(A){return Ln(A)?(n.consume(A),E):t(A)}function E(A){return A===45||zn(A)?(n.consume(A),E):T(A)}function T(A){return Ie(A)?(a=T,Z(A)):Je(A)?(n.consume(A),T):_(A)}function z(A){return A===45||zn(A)?(n.consume(A),z):A===47||A===62||Rt(A)?te(A):t(A)}function te(A){return A===47?(n.consume(A),_):A===58||A===95||Ln(A)?(n.consume(A),q):Ie(A)?(a=te,Z(A)):Je(A)?(n.consume(A),te):_(A)}function q(A){return A===45||A===46||A===58||A===95||zn(A)?(n.consume(A),q):G(A)}function G(A){return A===61?(n.consume(A),F):Ie(A)?(a=G,Z(A)):Je(A)?(n.consume(A),G):te(A)}function F(A){return A===null||A===60||A===61||A===62||A===96?t(A):A===34||A===39?(n.consume(A),l=A,se):Ie(A)?(a=F,Z(A)):Je(A)?(n.consume(A),F):(n.consume(A),me)}function se(A){return A===l?(n.consume(A),l=void 0,ne):A===null?t(A):Ie(A)?(a=se,Z(A)):(n.consume(A),se)}function me(A){return A===null||A===34||A===39||A===60||A===61||A===96?t(A):A===47||A===62||Rt(A)?te(A):(n.consume(A),me)}function ne(A){return A===47||A===62||Rt(A)?te(A):t(A)}function _(A){return A===62?(n.consume(A),n.exit("htmlTextData"),n.exit("htmlText"),e):t(A)}function Z(A){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(A),n.exit("lineEnding"),ie}function ie(A){return Je(A)?xt(n,re,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):re(A)}function re(A){return n.enter("htmlTextData"),a(A)}}const db={name:"labelEnd",resolveAll:OH,resolveTo:NH,tokenize:TH},kH={tokenize:AH},SH={tokenize:EH},CH={tokenize:MH};function OH(n){let e=-1;const t=[];for(;++e0&&l[l.length-1]._balanced;)l.pop();o=l[l.length-1]}return u;function u(b){return o?o._inactive?g(b):(a=i.parser.defined.includes(lr(i.sliceSerialize({start:o.end,end:i.now()}))),n.enter("labelEnd"),n.enter("labelMarker"),n.consume(b),n.exit("labelMarker"),n.exit("labelEnd"),f):t(b)}function f(b){return b===40?n.attempt(kH,m,a?m:g)(b):b===91?n.attempt(SH,m,a?d:g)(b):a?m(b):g(b)}function d(b){return n.attempt(CH,m,g)(b)}function m(b){return l.pop(),e(b)}function g(b){return o._balanced=!0,t(b)}}function AH(n,e,t){return i;function i(g){return n.enter("resource"),n.enter("resourceMarker"),n.consume(g),n.exit("resourceMarker"),l}function l(g){return Rt(g)?lu(n,o)(g):o(g)}function o(g){return g===41?m(g):UA(n,a,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function a(g){return Rt(g)?lu(n,f)(g):m(g)}function u(g){return t(g)}function f(g){return g===34||g===39||g===40?qA(n,d,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):m(g)}function d(g){return Rt(g)?lu(n,m)(g):m(g)}function m(g){return g===41?(n.enter("resourceMarker"),n.consume(g),n.exit("resourceMarker"),n.exit("resource"),e):t(g)}}function EH(n,e,t){const i=this;return l;function l(u){return FA.call(i,n,o,a,"reference","referenceMarker","referenceString")(u)}function o(u){return i.parser.defined.includes(lr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?e(u):t(u)}function a(u){return t(u)}}function MH(n,e,t){return i;function i(o){return n.enter("reference"),n.enter("referenceMarker"),n.consume(o),n.exit("referenceMarker"),l}function l(o){return o===93?(n.enter("referenceMarker"),n.consume(o),n.exit("referenceMarker"),n.exit("reference"),e):t(o)}}const DH={name:"labelStartImage",resolveAll:db.resolveAll,tokenize:RH};function RH(n,e,t){const i=this;let l;return o;function o(f){return n.enter("labelImage"),n.enter("labelImageMarker"),n.consume(f),n.exit("labelImageMarker"),a}function a(f){return f===91?(n.enter("labelMarker"),n.consume(f),n.exit("labelMarker"),l=n.exit("labelImage"),u):t(f)}function u(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?t(f):(i._labelStarts=i._labelStarts||[],i._labelStarts.push(l),e(f))}}const jH={name:"labelStartLink",resolveAll:db.resolveAll,tokenize:_H};function _H(n,e,t){const i=this;let l;return o;function o(u){return n.enter("labelLink"),n.enter("labelMarker"),n.consume(u),n.exit("labelMarker"),l=n.exit("labelLink"),a}function a(u){return u===94&&"_hiddenFootnoteSupport"in i.parser.constructs?t(u):(i._labelStarts=i._labelStarts||[],i._labelStarts.push(l),e(u))}}const L0={name:"lineEnding",tokenize:LH};function LH(n,e){return t;function t(i){return n.enter("lineEnding"),n.consume(i),n.exit("lineEnding"),xt(n,e,"linePrefix")}}const ad={name:"thematicBreak",tokenize:zH};function zH(n,e,t){let i=0,l;return o;function o(d){return n.enter("thematicBreak"),a(d)}function a(d){return l=d,u(d)}function u(d){return d===l?(n.enter("thematicBreakSequence"),f(d)):i>=3&&(d===null||Ie(d))?(n.exit("thematicBreak"),e(d)):t(d)}function f(d){return d===l?(n.consume(d),i++,f):(n.exit("thematicBreakSequence"),Je(d)?xt(n,u,"whitespace")(d):u(d))}}const ui={continuation:{tokenize:IH},exit:FH,name:"list",tokenize:HH},BH={partial:!0,tokenize:qH},PH={partial:!0,tokenize:UH};function HH(n,e,t){const i=this,l=i.events[i.events.length-1];let o=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,a=0;return u;function u(v){const w=i.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!i.containerState.marker||v===i.containerState.marker:iy(v)){if(i.containerState.type||(i.containerState.type=w,n.enter(w,{_container:!0})),w==="listUnordered")return n.enter("listItemPrefix"),v===42||v===45?n.check(ad,t,d)(v):d(v);if(!i.interrupt||v===49)return n.enter("listItemPrefix"),n.enter("listItemValue"),f(v)}return t(v)}function f(v){return iy(v)&&++a<10?(n.consume(v),f):(!i.interrupt||a<2)&&(i.containerState.marker?v===i.containerState.marker:v===41||v===46)?(n.exit("listItemValue"),d(v)):t(v)}function d(v){return n.enter("listItemMarker"),n.consume(v),n.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||v,n.check(_u,i.interrupt?t:m,n.attempt(BH,b,g))}function m(v){return i.containerState.initialBlankLine=!0,o++,b(v)}function g(v){return Je(v)?(n.enter("listItemPrefixWhitespace"),n.consume(v),n.exit("listItemPrefixWhitespace"),b):t(v)}function b(v){return i.containerState.size=o+i.sliceSerialize(n.exit("listItemPrefix"),!0).length,e(v)}}function IH(n,e,t){const i=this;return i.containerState._closeFlow=void 0,n.check(_u,l,o);function l(u){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,xt(n,e,"listItemIndent",i.containerState.size+1)(u)}function o(u){return i.containerState.furtherBlankLines||!Je(u)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,a(u)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,n.attempt(PH,e,a)(u))}function a(u){return i.containerState._closeFlow=!0,i.interrupt=void 0,xt(n,n.attempt(ui,e,t),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function UH(n,e,t){const i=this;return xt(n,l,"listItemIndent",i.containerState.size+1);function l(o){const a=i.events[i.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===i.containerState.size?e(o):t(o)}}function FH(n){n.exit(this.containerState.type)}function qH(n,e,t){const i=this;return xt(n,l,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(o){const a=i.events[i.events.length-1];return!Je(o)&&a&&a[1].type==="listItemPrefixWhitespace"?e(o):t(o)}}const mC={name:"setextUnderline",resolveTo:VH,tokenize:QH};function VH(n,e){const t=new Fd;let i=n.length,l,o,a;for(;i--;)if(n[i][0]==="enter"){if(n[i][1].type==="content"){l=i;break}n[i][1].type==="paragraph"&&(o=i)}else n[i][1].type==="content"&&t.add(i,1,[]),!a&&n[i][1].type==="definition"&&(a=i);const u={type:"setextHeading",start:{...n[l][1].start},end:{...n[n.length-1][1].end}};return n[o][1].type="setextHeadingText",a?(t.add(o,0,[["enter",u,e]]),t.add(a+1,0,[["exit",n[l][1],e]]),n[l][1].end={...n[a][1].end}):n[l][1]=u,t.add(n.length,0,[["exit",u,e]]),t.consume(n),n}function QH(n,e,t){const i=this;let l;return o;function o(d){let m=i.events.length,g;for(;m--;)if(i.events[m][1].type!=="lineEnding"&&i.events[m][1].type!=="linePrefix"&&i.events[m][1].type!=="content"){g=i.events[m][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||g)?(n.enter("setextHeadingLine"),l=d,a(d)):t(d)}function a(d){return n.enter("setextHeadingLineSequence"),u(d)}function u(d){return d===l?(n.consume(d),u):(n.exit("setextHeadingLineSequence"),Je(d)?xt(n,f,"lineSuffix")(d):f(d))}function f(d){return d===null||Ie(d)?(n.exit("setextHeadingLine"),e(d)):t(d)}}const XH={tokenize:$H};function $H(n){const e=this,t=n.attempt(_u,i,n.attempt(this.parser.constructs.flowInitial,l,xt(n,n.attempt(this.parser.constructs.flow,l,n.attempt(tH,l)),"linePrefix")));return t;function i(o){if(o===null){n.consume(o);return}return n.enter("lineEndingBlank"),n.consume(o),n.exit("lineEndingBlank"),e.currentConstruct=void 0,t}function l(o){if(o===null){n.consume(o);return}return n.enter("lineEnding"),n.consume(o),n.exit("lineEnding"),e.currentConstruct=void 0,t}}const YH={resolveAll:XA()},GH=QA("string"),KH=QA("text");function QA(n){return{resolveAll:XA(n==="text"?WH:void 0),tokenize:e};function e(t){const i=this,l=this.parser.constructs[n],o=t.attempt(l,a,u);return a;function a(m){return d(m)?o(m):u(m)}function u(m){if(m===null){t.consume(m);return}return t.enter("data"),t.consume(m),f}function f(m){return d(m)?(t.exit("data"),o(m)):(t.consume(m),f)}function d(m){if(m===null)return!0;const g=l[m];let b=-1;if(g)for(;++b-1){const u=a[0];typeof u=="string"?a[0]=u.slice(i):a.shift()}o>0&&a.push(n[l].slice(0,o))}return a}function u7(n,e){let t=-1;const i=[];let l;for(;++t0&&l(e.beforeEnter,{...Te,sliceSerialize:ee[pe][2].sliceSerialize},ee[pe][1]),$A.call(Ee,ee[pe][1].type)&&Ee[ee[pe][1].type].call({...Te,sliceSerialize:ee[pe][2].sliceSerialize},ee[pe][1]),ee[pe][0]==="exit"&&e.afterExit.length>0&&l(e.afterExit,{...Te,sliceSerialize:ee[pe][2].sliceSerialize},ee[pe][1])}if(Te.tokenStack.length>0){const Ee=Te.tokenStack[Te.tokenStack.length-1];(Ee[1]||gC).call(Te,void 0,Ee[0])}for(fe.position={start:Xl(ee.length>0?ee[0][1].start:{line:1,column:1,offset:0}),end:Xl(ee.length>0?ee[ee.length-2][1].end:{line:1,column:1,offset:0})},pe=-1;++pe0&&(i.className=["language-"+l[0]]);let o={type:"element",tagName:"code",properties:i,children:[{type:"text",value:t}]};return e.meta&&(o.data={meta:e.meta}),n.patch(e,o),o=n.applyData(e,o),o={type:"element",tagName:"pre",properties:{},children:[o]},n.patch(e,o),o}function C7(n,e){const t={type:"element",tagName:"del",properties:{},children:n.all(e)};return n.patch(e,t),n.applyData(e,t)}function O7(n,e){const t={type:"element",tagName:"em",properties:{},children:n.all(e)};return n.patch(e,t),n.applyData(e,t)}function N7(n,e){const t=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",i=String(e.identifier).toUpperCase(),l=Ba(i.toLowerCase()),o=n.footnoteOrder.indexOf(i);let a,u=n.footnoteCounts.get(i);u===void 0?(u=0,n.footnoteOrder.push(i),a=n.footnoteOrder.length):a=o+1,u+=1,n.footnoteCounts.set(i,u);const f={type:"element",tagName:"a",properties:{href:"#"+t+"fn-"+l,id:t+"fnref-"+l+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};n.patch(e,f);const d={type:"element",tagName:"sup",properties:{},children:[f]};return n.patch(e,d),n.applyData(e,d)}function T7(n,e){const t={type:"element",tagName:"h"+e.depth,properties:{},children:n.all(e)};return n.patch(e,t),n.applyData(e,t)}function A7(n,e){if(n.options.allowDangerousHtml){const t={type:"raw",value:e.value};return n.patch(e,t),n.applyData(e,t)}}function GA(n,e){const t=e.referenceType;let i="]";if(t==="collapsed"?i+="[]":t==="full"&&(i+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+i}];const l=n.all(e),o=l[0];o&&o.type==="text"?o.value="["+o.value:l.unshift({type:"text",value:"["});const a=l[l.length-1];return a&&a.type==="text"?a.value+=i:l.push({type:"text",value:i}),l}function E7(n,e){const t=String(e.identifier).toUpperCase(),i=n.definitionById.get(t);if(!i)return GA(n,e);const l={src:Ba(i.url||""),alt:e.alt};i.title!==null&&i.title!==void 0&&(l.title=i.title);const o={type:"element",tagName:"img",properties:l,children:[]};return n.patch(e,o),n.applyData(e,o)}function M7(n,e){const t={src:Ba(e.url)};e.alt!==null&&e.alt!==void 0&&(t.alt=e.alt),e.title!==null&&e.title!==void 0&&(t.title=e.title);const i={type:"element",tagName:"img",properties:t,children:[]};return n.patch(e,i),n.applyData(e,i)}function D7(n,e){const t={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};n.patch(e,t);const i={type:"element",tagName:"code",properties:{},children:[t]};return n.patch(e,i),n.applyData(e,i)}function R7(n,e){const t=String(e.identifier).toUpperCase(),i=n.definitionById.get(t);if(!i)return GA(n,e);const l={href:Ba(i.url||"")};i.title!==null&&i.title!==void 0&&(l.title=i.title);const o={type:"element",tagName:"a",properties:l,children:n.all(e)};return n.patch(e,o),n.applyData(e,o)}function j7(n,e){const t={href:Ba(e.url)};e.title!==null&&e.title!==void 0&&(t.title=e.title);const i={type:"element",tagName:"a",properties:t,children:n.all(e)};return n.patch(e,i),n.applyData(e,i)}function _7(n,e,t){const i=n.all(e),l=t?L7(t):KA(e),o={},a=[];if(typeof e.checked=="boolean"){const m=i[0];let g;m&&m.type==="element"&&m.tagName==="p"?g=m:(g={type:"element",tagName:"p",properties:{},children:[]},i.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let u=-1;for(;++u1}function z7(n,e){const t={},i=n.all(e);let l=-1;for(typeof e.start=="number"&&e.start!==1&&(t.start=e.start);++l0){const a={type:"element",tagName:"tbody",properties:{},children:n.wrap(t,!0)},u=ob(e.children[1]),f=NA(e.children[e.children.length-1]);u&&f&&(a.position={start:u,end:f}),l.push(a)}const o={type:"element",tagName:"table",properties:{},children:n.wrap(l,!0)};return n.patch(e,o),n.applyData(e,o)}function U7(n,e,t){const i=t?t.children:void 0,o=(i?i.indexOf(e):1)===0?"th":"td",a=t&&t.type==="table"?t.align:void 0,u=a?a.length:e.children.length;let f=-1;const d=[];for(;++f0,!0),i[0]),l=i.index+i[0].length,i=t.exec(e);return o.push(bC(e.slice(l),l>0,!1)),o.join("")}function bC(n,e,t){let i=0,l=n.length;if(e){let o=n.codePointAt(i);for(;o===xC||o===yC;)i++,o=n.codePointAt(i)}if(t){let o=n.codePointAt(l-1);for(;o===xC||o===yC;)l--,o=n.codePointAt(l-1)}return l>i?n.slice(i,l):""}function V7(n,e){const t={type:"text",value:q7(String(e.value))};return n.patch(e,t),n.applyData(e,t)}function Q7(n,e){const t={type:"element",tagName:"hr",properties:{},children:[]};return n.patch(e,t),n.applyData(e,t)}const X7={blockquote:w7,break:k7,code:S7,delete:C7,emphasis:O7,footnoteReference:N7,heading:T7,html:A7,imageReference:E7,image:M7,inlineCode:D7,linkReference:R7,link:j7,listItem:_7,list:z7,paragraph:B7,root:P7,strong:H7,table:I7,tableCell:F7,tableRow:U7,text:V7,thematicBreak:Q7,toml:Fh,yaml:Fh,definition:Fh,footnoteDefinition:Fh};function Fh(){}const WA=-1,dm=0,su=1,qd=2,mb=3,pb=4,gb=5,xb=6,ZA=7,JA=8,{defineProperty:$7}=Object,eE=typeof self=="object"?self:globalThis,vC=(n,e)=>{switch(n){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+n)}return new eE[n](e)},Y7=(n,e)=>{const t=(l,o)=>(n.set(o,l),l),i=l=>{if(n.has(l))return n.get(l);const[o,a]=e[l];switch(o){case dm:case WA:return t(a,l);case su:{const u=t([],l);for(const f of a)u.push(i(f));return u}case qd:{const u=t({},l);for(const[f,d]of a){const m=i(f),g=i(d);m==="__proto__"?$7(u,m,{value:g,configurable:!0,enumerable:!0,writable:!0}):u[m]=g}return u}case mb:return t(new Date(a),l);case pb:{const{source:u,flags:f}=a;return t(new RegExp(u,f),l)}case gb:{const u=t(new Map,l);for(const[f,d]of a)u.set(i(f),i(d));return u}case xb:{const u=t(new Set,l);for(const f of a)u.add(i(f));return u}case ZA:{const{name:u,message:f}=a;return t(typeof eE[u]=="function"?vC(u,f):new Error(f),l)}case JA:return t(BigInt(a),l);case"BigInt":return t(Object(BigInt(a)),l);case"ArrayBuffer":return t(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:u}=new Uint8Array(a);return t(new DataView(u),a)}case"-0":return-0}return t(vC(o,a),l)};return i},wC=n=>Y7(new Map,n)(0),Xs="",{toString:G7}={},{keys:K7,is:W7}=Object,qc=n=>{const e=typeof n;if(e!=="object"||!n)return[dm,e];const t=G7.call(n).slice(8,-1);switch(t){case"Array":return[su,Xs];case"Object":return[qd,Xs];case"Date":return[mb,Xs];case"RegExp":return[pb,Xs];case"Map":return[gb,Xs];case"Set":return[xb,Xs];case"DataView":return[su,t]}return t.includes("Array")?[su,t]:n instanceof Error?[ZA,n.name||"Error"]:[qd,t]},qh=([n,e])=>n===dm&&(e==="function"||e==="symbol"),Z7=(n,e,t,i)=>{const l=(a,u)=>{const f=i.push(a)-1;return t.set(u,f),f},o=a=>{if(t.has(a))return t.get(a);let[u,f]=qc(a);switch(u){case dm:{let m=a;switch(f){case"bigint":u=JA,m=a.toString();break;case"number":if(!a&&W7(a,-0))return i.push(["-0"])-1;break;case"function":case"symbol":if(n)throw new TypeError("unable to serialize "+f);m=null;break;case"undefined":return l([WA],a)}return l([u,m],a)}case su:{if(f){let b=a;return f==="DataView"?b=new Uint8Array(a.buffer):f==="ArrayBuffer"&&(b=new Uint8Array(a)),l([f,[...b]],a)}const m=[],g=l([u,m],a);for(const b of a)m.push(o(b));return g}case qd:{if(f)switch(f){case"BigInt":return l([f,a.toString()],a);case"Boolean":case"Number":case"String":return l([f,a.valueOf()],a)}if(e&&"toJSON"in a)return o(a.toJSON());const m=[],g=l([u,m],a);for(const b of K7(a))(n||!qh(qc(a[b])))&&m.push([o(b),o(a[b])]);return g}case mb:return l([u,isNaN(a.getTime())?Xs:a.toISOString()],a);case pb:{const{source:m,flags:g}=a;return l([u,{source:m,flags:g}],a)}case gb:{const m=[],g=l([u,m],a);for(const[b,v]of a)(n||!(qh(qc(b))||qh(qc(v))))&&m.push([o(b),o(v)]);return g}case xb:{const m=[],g=l([u,m],a);for(const b of a)(n||!qh(qc(b)))&&m.push(o(b));return g}}const{message:d}=a;return l([u,{name:f,message:d}],a)};return o},kC=(n,{json:e,lossy:t}={})=>{const i=[];return Z7(!(e||t),!!e,new Map,i)(n),i},Vd=typeof structuredClone=="function"?(n,e)=>e&&("json"in e||"lossy"in e)?wC(kC(n,e)):structuredClone(n):(n,e)=>wC(kC(n,e));function J7(n,e){const t=[{type:"text",value:"↩"}];return e>1&&t.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),t}function eI(n,e){return"Back to reference "+(n+1)+(e>1?"-"+e:"")}function tI(n){const e=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",t=n.options.footnoteBackContent||J7,i=n.options.footnoteBackLabel||eI,l=n.options.footnoteLabel||"Footnotes",o=n.options.footnoteLabelTagName||"h2",a=n.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let f=-1;for(;++f0&&w.push({type:"text",value:" "});let j=typeof t=="string"?t:t(f,v);typeof j=="string"&&(j={type:"text",value:j}),w.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+b+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(f,v),className:["data-footnote-backref"]},children:Array.isArray(j)?j:[j]})}const C=m[m.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const j=C.children[C.children.length-1];j&&j.type==="text"?j.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...w)}else m.push(...w);const N={type:"element",tagName:"li",properties:{id:e+"fn-"+b},children:n.wrap(m,!0)};n.patch(d,N),u.push(N)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Vd(a),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:` -`},{type:"element",tagName:"ol",properties:{},children:n.wrap(u,!0)},{type:"text",value:` -`}]}}const mm=(function(n){if(n==null)return lI;if(typeof n=="function")return pm(n);if(typeof n=="object")return Array.isArray(n)?nI(n):iI(n);if(typeof n=="string")return rI(n);throw new Error("Expected function, string, or object as test")});function nI(n){const e=[];let t=-1;for(;++t":""))+")"})}return C;function C(){const N=!o||d(b,v,w[w.length-1]||void 0);let j=tE;if(u&&N&&(j=SC(u(b,w,v)),j[0]===cd))return j;if("children"in b&&b.children){const D=b;if(D.children&&j[0]!==oy){let I=(l?-1:D.children.length)+m;const U=[...w,D];for(;I>-1&&I0&&t.push({type:"text",value:` -`}),t}function CC(n){let e=0,t=n.charCodeAt(e);for(;t===9||t===32;)e++,t=n.charCodeAt(e);return n.slice(e)}function OC(n,e){const t=uI(n,e),i=t.one(n,void 0),l=tI(t),o=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return l&&o.children.push({type:"text",value:` -`},l),o}function pI(n,e){return n&&"run"in n?async function(t,i){const l=OC(t,{file:i,...e});await n.run(l,i)}:function(t,i){return OC(t,{file:i,...n||e})}}function NC(n){if(n)throw n}var z0,TC;function gI(){if(TC)return z0;TC=1;var n=Object.prototype.hasOwnProperty,e=Object.prototype.toString,t=Object.defineProperty,i=Object.getOwnPropertyDescriptor,l=function(d){return typeof Array.isArray=="function"?Array.isArray(d):e.call(d)==="[object Array]"},o=function(d){if(!d||e.call(d)!=="[object Object]")return!1;var m=n.call(d,"constructor"),g=d.constructor&&d.constructor.prototype&&n.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!m&&!g)return!1;var b;for(b in d);return typeof b>"u"||n.call(d,b)},a=function(d,m){t&&m.name==="__proto__"?t(d,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):d[m.name]=m.newValue},u=function(d,m){if(m==="__proto__")if(n.call(d,m)){if(i)return i(d,m).value}else return;return d[m]};return z0=function f(){var d,m,g,b,v,w,S=arguments[0],C=1,N=arguments.length,j=!1;for(typeof S=="boolean"&&(j=S,S=arguments[1]||{},C=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});Ca.length;let f;u&&a.push(l);try{f=n.apply(this,a)}catch(d){const m=d;if(u&&t)throw m;return l(m)}u||(f&&f.then&&typeof f.then=="function"?f.then(o,l):f instanceof Error?l(f):o(f))}function l(a,...u){t||(t=!0,e(a,...u))}function o(a){l(null,a)}}const Tr={basename:vI,dirname:wI,extname:kI,join:SI,sep:"/"};function vI(n,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Lu(n);let t=0,i=-1,l=n.length,o;if(e===void 0||e.length===0||e.length>n.length){for(;l--;)if(n.codePointAt(l)===47){if(o){t=l+1;break}}else i<0&&(o=!0,i=l+1);return i<0?"":n.slice(t,i)}if(e===n)return"";let a=-1,u=e.length-1;for(;l--;)if(n.codePointAt(l)===47){if(o){t=l+1;break}}else a<0&&(o=!0,a=l+1),u>-1&&(n.codePointAt(l)===e.codePointAt(u--)?u<0&&(i=l):(u=-1,i=a));return t===i?i=a:i<0&&(i=n.length),n.slice(t,i)}function wI(n){if(Lu(n),n.length===0)return".";let e=-1,t=n.length,i;for(;--t;)if(n.codePointAt(t)===47){if(i){e=t;break}}else i||(i=!0);return e<0?n.codePointAt(0)===47?"/":".":e===1&&n.codePointAt(0)===47?"//":n.slice(0,e)}function kI(n){Lu(n);let e=n.length,t=-1,i=0,l=-1,o=0,a;for(;e--;){const u=n.codePointAt(e);if(u===47){if(a){i=e+1;break}continue}t<0&&(a=!0,t=e+1),u===46?l<0?l=e:o!==1&&(o=1):l>-1&&(o=-1)}return l<0||t<0||o===0||o===1&&l===t-1&&l===i+1?"":n.slice(l,t)}function SI(...n){let e=-1,t;for(;++e0&&n.codePointAt(n.length-1)===47&&(t+="/"),e?"/"+t:t}function OI(n,e){let t="",i=0,l=-1,o=0,a=-1,u,f;for(;++a<=n.length;){if(a2){if(f=t.lastIndexOf("/"),f!==t.length-1){f<0?(t="",i=0):(t=t.slice(0,f),i=t.length-1-t.lastIndexOf("/")),l=a,o=0;continue}}else if(t.length>0){t="",i=0,l=a,o=0;continue}}e&&(t=t.length>0?t+"/..":"..",i=2)}else t.length>0?t+="/"+n.slice(l+1,a):t=n.slice(l+1,a),i=a-l-1;l=a,o=0}else u===46&&o>-1?o++:o=-1}return t}function Lu(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const NI={cwd:TI};function TI(){return"/"}function hy(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function AI(n){if(typeof n=="string")n=new URL(n);else if(!hy(n)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(n.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return EI(n)}function EI(n){if(n.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const e=n.pathname;let t=-1;for(;++t0){let[v,...w]=m;const S=i[b][1];fy(S)&&fy(v)&&(v=B0(!0,S,v)),i[b]=[d,v,...w]}}}}const jI=new bb().freeze();function U0(n,e){if(typeof e!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function F0(n,e){if(typeof e!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function q0(n,e){if(e)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function EC(n){if(!fy(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function MC(n,e,t){if(!t)throw new Error("`"+n+"` finished async. Use `"+e+"` instead")}function Vh(n){return _I(n)?n:new nE(n)}function _I(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function LI(n){return typeof n=="string"||zI(n)}function zI(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const BI="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",DC=[],RC={allowDangerousHtml:!0},PI=/^(https?|ircs?|mailto|xmpp)$/i,HI=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function II(n){const e=UI(n),t=FI(n);return qI(e.runSync(e.parse(t),t),n)}function UI(n){const e=n.rehypePlugins||DC,t=n.remarkPlugins||DC,i=n.remarkRehypeOptions?{...n.remarkRehypeOptions,...RC}:RC;return jI().use(v7).use(t).use(pI,i).use(e)}function FI(n){const e=n.children||"",t=new nE;return typeof e=="string"&&(t.value=e),t}function qI(n,e){const t=e.allowedElements,i=e.allowElement,l=e.components,o=e.disallowedElements,a=e.skipHtml,u=e.unwrapDisallowed,f=e.urlTransform||VI;for(const m of HI)Object.hasOwn(e,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+BI+m.id,void 0);return yb(n,d),sP(n,{Fragment:y.Fragment,components:l,ignoreInvalidStyle:!0,jsx:y.jsx,jsxs:y.jsxs,passKeys:!0,passNode:!0});function d(m,g,b){if(m.type==="raw"&&b&&typeof g=="number")return a?b.children.splice(g,1):b.children[g]={type:"text",value:m.value},g;if(m.type==="element"){let v;for(v in j0)if(Object.hasOwn(j0,v)&&Object.hasOwn(m.properties,v)){const w=m.properties[v],S=j0[v];(S===null||S.includes(m.tagName))&&(m.properties[v]=f(String(w||""),v,m))}}if(m.type==="element"){let v=t?!t.includes(m.tagName):o?o.includes(m.tagName):!1;if(!v&&i&&typeof g=="number"&&(v=!i(m,g,b)),v&&b&&typeof g=="number")return u&&m.children?b.children.splice(g,1,...m.children):b.children.splice(g,1),g}}}function VI(n){const e=n.indexOf(":"),t=n.indexOf("?"),i=n.indexOf("#"),l=n.indexOf("/");return e===-1||l!==-1&&e>l||t!==-1&&e>t||i!==-1&&e>i||PI.test(n.slice(0,e))?n:""}function QI(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function iE(n,e,t){const l=mm((t||{}).ignore||[]),o=XI(e);let a=-1;for(;++a0?{type:"text",value:E}:void 0),E===!1)v.lastIndex=I+1;else{if(S!==I&&D({type:"text",value:d.value.slice(S,I)}),Array.isArray(E))for(const T of E)D(T);else E&&D(E);S=I+j[0].length,C=!0}if(!v.global)break;j=v.exec(d.value)}return C?(S?\]}]+$/.exec(n);if(!e)return[n,void 0];n=n.slice(0,e.index);let t=e[0],i=t.indexOf(")");const l=jC(n,"(");let o=jC(n,")");for(;i!==-1&&l>o;)n+=t.slice(0,i+1),t=t.slice(i+1),i=t.indexOf(")"),o++;return[n,t]}function rE(n,e){const t=n.input.charCodeAt(n.index-1);return(n.index===0||oo(t)||fm(t))&&(!e||t!==47)}lE.peek=yU;function uU(){this.buffer()}function fU(n){this.enter({type:"footnoteReference",identifier:"",label:""},n)}function hU(){this.buffer()}function dU(n){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},n)}function mU(n){const e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.identifier=lr(this.sliceSerialize(n)).toLowerCase(),t.label=e}function pU(n){this.exit(n)}function gU(n){const e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.identifier=lr(this.sliceSerialize(n)).toLowerCase(),t.label=e}function xU(n){this.exit(n)}function yU(){return"["}function lE(n,e,t,i){const l=t.createTracker(i);let o=l.move("[^");const a=t.enter("footnoteReference"),u=t.enter("reference");return o+=l.move(t.safe(t.associationId(n),{after:"]",before:o})),u(),a(),o+=l.move("]"),o}function bU(){return{enter:{gfmFootnoteCallString:uU,gfmFootnoteCall:fU,gfmFootnoteDefinitionLabelString:hU,gfmFootnoteDefinition:dU},exit:{gfmFootnoteCallString:mU,gfmFootnoteCall:pU,gfmFootnoteDefinitionLabelString:gU,gfmFootnoteDefinition:xU}}}function vU(n){let e=!1;return n&&n.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:t,footnoteReference:lE},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function t(i,l,o,a){const u=o.createTracker(a);let f=u.move("[^");const d=o.enter("footnoteDefinition"),m=o.enter("label");return f+=u.move(o.safe(o.associationId(i),{before:f,after:"]"})),m(),f+=u.move("]:"),i.children&&i.children.length>0&&(u.shift(4),f+=u.move((e?` -`:" ")+o.indentLines(o.containerFlow(i,u.current()),e?sE:wU))),d(),f}}function wU(n,e,t){return e===0?n:sE(n,e,t)}function sE(n,e,t){return(t?"":" ")+n}const kU=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];vb.attention=TU;vb.peek=AU;function SU(){return{canContainEols:["delete"],enter:{strikethrough:OU},exit:{strikethrough:NU}}}function CU(){return{handlers:{delete:vb},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:kU}]}}function OU(n){this.enter({type:"delete",children:[],position:void 0},n)}function NU(n){this.exit(n)}function vb(n,e,t,i){const l=t.createTracker(i),o=t.stack.includes("strikethrough")?"~":"~~",a=t.enter("strikethrough");let u=l.move(o);return u+=t.containerPhrasing(n,{...l.current(),before:u,after:"~"}),u+=l.move(o),a(),u}function TU(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function AU(){return"~"}function EU(n){return n.length}function MU(n,e){const t=e||{},i=(t.align||[]).concat(),l=t.stringLength||EU,o=[],a=[],u=[],f=[];let d=0,m=-1;for(;++md&&(d=n[m].length);++Nf[N])&&(f[N]=D)}S.push(j)}a[m]=S,u[m]=C}let g=-1;if(typeof i=="object"&&"length"in i)for(;++gf[g]&&(f[g]=j),v[g]=j),b[g]=D}a.splice(1,0,b),u.splice(1,0,v),m=-1;const w=[];for(;++m "),o.shift(2);const a=t.indentLines(t.containerFlow(n,o.current()),_U);return l(),a}function _U(n,e,t){return">"+(t?"":" ")+n}function LU(n,e){return LC(n,e.inConstruct,!0)&&!LC(n,e.notInConstruct,!1)}function LC(n,e,t){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return t;let i=-1;for(;++ia&&(a=o):o=1,l=i+e.length,i=t.indexOf(e,l);return a}function BU(n,e){return!!(e.options.fences===!1&&n.value&&!n.lang&&/[^\n\r ]/.test(n.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(n.value))}function PU(n){const e=n.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function HU(n,e,t,i){const l=PU(t),o=n.value||"";if(BU(n,t)){const g=t.enter("codeIndented"),b=t.indentLines(o,IU);return g(),b}const a=t.createTracker(i),u=l.repeat(Math.max(zU(o,l)+1,3)),f=t.enter("codeFenced"),d=l==="`"?"GraveAccent":"Tilde";let m=a.move(u);if(n.lang){const g=t.enter(`codeFencedLang${d}`);m+=a.move(t.safe(n.lang,{before:m,after:" ",encode:["`"],...a.current()})),g()}if(n.lang&&n.meta){const g=t.enter(`codeFencedMeta${d}`);m+=a.move(" "),m+=a.move(t.safe(n.meta,{before:m,after:` -`,encode:["`"],...a.current()})),g()}return m+=a.move(` -`),o&&(m+=a.move(o+` -`)),m+=a.move(u),f(),m}function IU(n,e,t){return(t?"":" ")+n}function wb(n){const e=n.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function UU(n,e,t,i){const l=wb(t),o=l==='"'?"Quote":"Apostrophe",a=t.enter("definition");let u=t.enter("label");const f=t.createTracker(i);let d=f.move("[");return d+=f.move(t.safe(t.associationId(n),{before:d,after:"]",...f.current()})),d+=f.move("]: "),u(),!n.url||/[\0- \u007F]/.test(n.url)?(u=t.enter("destinationLiteral"),d+=f.move("<"),d+=f.move(t.safe(n.url,{before:d,after:">",...f.current()})),d+=f.move(">")):(u=t.enter("destinationRaw"),d+=f.move(t.safe(n.url,{before:d,after:n.title?" ":` -`,...f.current()}))),u(),n.title&&(u=t.enter(`title${o}`),d+=f.move(" "+l),d+=f.move(t.safe(n.title,{before:d,after:l,...f.current()})),d+=f.move(l),u()),a(),d}function FU(n){const e=n.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function Qd(n){const e=n.codePointAt(0);return e===void 0?"":String.fromCodePoint(e)}function wa(n){const e=n.codePointAt(n.length-2);return e!==void 0&&e>65535?n.slice(-2):n.slice(-1)}function oE(n){return"&#x"+n.toString(16).toUpperCase()+";"}function BC(n,e,t){const i=us(n),l=us(e);return i===void 0?l===void 0?t==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function qU(n){if(n.charCodeAt(0)!==60)return;const e=n.charCodeAt(1);if(e===33){const u=n.charCodeAt(2);return u===45?2:u===91?5:Ln(u)?4:void 0}if(e===63)return 3;const t=e===47,i=t?2:1;let l=i,o=n.charCodeAt(l);if(!Ln(o))return;for(;o===45||zn(o);)o=n.charCodeAt(++l);const a=n.slice(i,l).toLowerCase();return!t&&o!==47&&sy.includes(a)?1:VA.includes(a)?6:7}const VU=new Map([["*",!1],["_",!0]]);function QU(n,e,t){const i=new Set;for(const o of n){const a=t.get(o);if(a&&o.attention&&e.some(u=>u.attention===o.attention))for(const u of a.tokens)i.add(u.attention)}const l=[];for(const o of n)o.attention&&i.delete(o.attention)&&l.push(o.attention);return l.reverse(),l}function aE(n,e,t){const i=[],l=new Map,o=new Map;let a=0;for(;at.index)return{chosen:f,mistake:m,tokens:d}}}}function $U(n,e){const t=new Map;for(const i of n){const l=i.tokens[0].value.charAt(0);let o=t.get(l);o||(o=[],t.set(l,o));let a=i.close?o.length:0;for(;a--&&i.start1&&d>1?2:1:d,g=u.markers.slice(u.end-m,u.end),b=i.markers.slice(i.start,i.start+m),v=g[0],w=b[0];if(v===g[m-1]&&v.value.length===m&&w===b[m-1]&&w.value.length===m&&v.attention===w.attention)e.delete(v),e.delete(w);else{const S=[...new Set([...g,...b])];for(const C of S){const N=e.get(C);N&&N.push(...S)}}u.end-=m,i.start+=m,u.start===u.end&&o.splice(a,1),a=o.length}i.open&&i.start0?w[0].value:"",C=BC(b.charCodeAt(b.length-1),S.charCodeAt(0),m);C.inside&&Qh(w,!0);const N=w.length>0?wa(w[w.length-1].value):"",j=BC(v.charCodeAt(0),N.charCodeAt(N.length-1),m);j.inside&&Qh(w,!1),C.outside&&b!==` -`&&b!=="\r"&&Qh(l,!1),j.outside&&(o=v),l.push({value:d,attention:f},...w,{value:d,attention:f}),a=d.charAt(d.length-1)}return l}function gm(n,e,t){let i=new Map;const l=Sb(n,i,e,t);let o=l,a=aE(o,e,t);for(;a;){const f=XU(n,i,a,e,t);if(!f){o=l;break}i=f.chosen,o=f.tokens,a=f.mistake}let u="";for(const f of o)u+=f.value;return u}Cb.attention=cE;Cb.peek=KU;function Cb(n,e,t,i){const l=t.enter("phrasing"),o=kb(n,cE,t,t.createTracker(i)),a=gm([o],i.before,i.after);return l(),a}function cE(n,e){return{construct:"emphasis",markers:FU(e)==="*"?["*","_"]:["_","*"],sizes:[1]}}function KU(n,e,t){return t.options.emphasis||"*"}function WU(n,e){let t=!1;return yb(n,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return t=!0,cd}),!!((!n.depth||n.depth<3)&&fb(n)&&(e.options.setext||t))}function ZU(n,e,t,i){const l=Math.max(Math.min(6,n.depth||1),1),o=t.createTracker(i);if(WU(n,t)){const g=t.enter("headingSetext"),b=t.enter("phrasing"),v=t.containerPhrasing(n,{...o.current(),before:` -`,after:` -`});return b(),g(),v+` -`+(l===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(` -`))+1))}const a="#".repeat(l),u=t.enter("headingAtx"),f=t.enter("phrasing");o.move(a+" ");let d=t.containerPhrasing(n,{before:"# ",after:` -`,...o.current()});const m=d.charCodeAt(0);return(m===9||m===32)&&(d=oE(m)+d.slice(1)),d=d?a+" "+d:a,t.options.closeAtx&&(d+=" "+a),f(),u(),d}uE.peek=JU;function uE(n){return n.value||""}function JU(){return"<"}fE.peek=eF;function fE(n,e,t,i){const l=wb(t),o=l==='"'?"Quote":"Apostrophe",a=t.enter("image");let u=t.enter("label");const f=t.createTracker(i);let d=f.move("![");return d+=f.move(t.safe(n.alt,{before:d,after:"]",...f.current()})),d+=f.move("]("),u(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(u=t.enter("destinationLiteral"),d+=f.move("<"),d+=f.move(t.safe(n.url,{before:d,after:">",...f.current()})),d+=f.move(">")):(u=t.enter("destinationRaw"),d+=f.move(t.safe(n.url,{before:d,after:n.title?" ":")",...f.current()}))),u(),n.title&&(u=t.enter(`title${o}`),d+=f.move(" "+l),d+=f.move(t.safe(n.title,{before:d,after:l,...f.current()})),d+=f.move(l),u()),d+=f.move(")"),a(),d}function eF(){return"!"}hE.peek=tF;function hE(n,e,t,i){const l=n.referenceType,o=t.enter("imageReference");let a=t.enter("label");const u=t.createTracker(i);let f=u.move("![");const d=t.safe(n.alt,{before:f,after:"]",...u.current()});f+=u.move(d+"]["),a();const m=t.stack;t.stack=m.filter(function(b){return b!=="phrasing"}),a=t.enter("reference");const g=t.safe(t.associationId(n),{before:f,after:"]",...u.current()});return a(),t.stack=m,o(),l==="full"||!d||d!==g?f+=u.move(g+"]"):l==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function tF(){return"!"}dE.peek=nF;function dE(n,e,t){let i=n.value||"",l="`",o=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(i);)l+="`";for(/[^\n\r ]/.test(i)&&(/^[\n\r ]/.test(i)&&/[\n\r ]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++o\u007F]/.test(n.url))}pE.peek=iF;function pE(n,e,t,i){const l=wb(t),o=l==='"'?"Quote":"Apostrophe",a=t.createTracker(i);if(mE(n,t)){const w=t.stack;t.stack=w.filter(function(N){return N!=="phrasing"});const S=t.enter("autolink");let C=a.move("<");return C+=a.move(t.containerPhrasing(n,{before:C,after:">",...a.current()})),C+=a.move(">"),S(),t.stack=w,C}const u=t.enter("link");let f=t.enter("label"),d=a.move("[");const m=t.containerPhrasing(n,{before:d,after:"](",...a.current()});d+=a.move(m),f(),d+=a.move("](");const g=/[\0- \u007F]/.test(n.url),b=i.before.charAt(i.before.length-1);let v=n.title||void 0;if(!v&&!g&&(b===` -`||b==="\r")){let w=0;for(;w",...a.current()})),d+=a.move(">")):(f=t.enter("destinationRaw"),d+=a.move(t.safe(n.url,{before:d,after:typeof v=="string"?" ":")",...a.current()}))),f(),typeof v=="string"&&(f=t.enter(`title${o}`),d+=a.move(" "+l),d+=a.move(t.safe(v,{before:d,after:l,...a.current()})),d+=a.move(l),f()),d+=a.move(")"),u(),d}function iF(n,e,t){return mE(n,t)?"<":"["}gE.peek=rF;function gE(n,e,t,i){const l=n.referenceType,o=t.enter("linkReference");let a=t.enter("label");const u=t.createTracker(i);let f=u.move("[");const d=t.containerPhrasing(n,{before:f,after:"]",...u.current()});f+=u.move(d+"]["),a();const m=t.stack;t.stack=m.filter(function(b){return b!=="phrasing"}),a=t.enter("reference");const g=t.safe(t.associationId(n),{before:f,after:"]",...u.current()});return a(),t.stack=m,o(),l==="full"||!d||d!==g?f+=u.move(g+"]"):l==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function rF(){return"["}function Ob(n){const e=n.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function lF(n){const e=Ob(n),t=n.options.bulletOther;if(!t)return e==="*"?"-":"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(t===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+t+"`) to be different");return t}function sF(n){const e=n.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function xE(n){const e=n.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function oF(n,e,t,i){const l=t.enter("list"),o=t.bulletCurrent;let a=n.ordered?sF(t):Ob(t);const u=n.ordered?a==="."?")":".":lF(t);let f=e&&t.bulletLastUsed?a===t.bulletLastUsed:!1;if(!n.ordered){const m=n.children?n.children[0]:void 0;if((a==="*"||a==="-")&&m&&(!m.children||!m.children[0])&&t.stack[t.stack.length-1]==="list"&&t.stack[t.stack.length-2]==="listItem"&&t.stack[t.stack.length-3]==="list"&&t.stack[t.stack.length-4]==="listItem"&&t.indexStack[t.indexStack.length-1]===0&&t.indexStack[t.indexStack.length-2]===0&&t.indexStack[t.indexStack.length-3]===0&&(f=!0),xE(t)===a&&m){let g=-1;for(;++g-1?e.start:1)+(t.options.incrementListMarker===!1?0:e.children.indexOf(n))+o);let a=o.length+1;(l==="tab"||l==="mixed"&&(e&&e.type==="list"&&e.spread||n.spread))&&(a=Math.ceil(a/4)*4);const u=t.createTracker(i);u.move(o+" ".repeat(a-o.length)),u.shift(a);const f=t.enter("listItem"),d=t.indentLines(t.containerFlow(n,u.current()),m);return f(),d;function m(g,b,v){return b?(v?"":" ".repeat(a))+g:(v?o:o+" ".repeat(a-o.length))+g}}function uF(n,e,t,i){const l=t.enter("paragraph"),o=t.enter("phrasing"),a=t.containerPhrasing(n,i);return o(),l(),a}function fF(n,e,t,i){if(!n.children.some(function(u){return RU(u)}))return t.containerFlow(n,i);const o=t.enter("phrasing"),a=t.containerPhrasing(n,i);return o(),a}function hF(n){const e=n.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}Nb.attention=yE;Nb.peek=dF;function Nb(n,e,t,i){const l=t.enter("phrasing"),o=kb(n,yE,t,t.createTracker(i)),a=gm([o],i.before,i.after);return l(),a}function yE(n,e){return{construct:"strong",markers:hF(e)==="*"?["*","_"]:["_","*"],sizes:[2]}}function dF(n,e,t){return t.options.strong||"*"}function mF(n,e,t,i){const l=e?e.children:[],o=t.indexStack[t.indexStack.length-1];return t.safe(n.value,{...i,afterNode:l[o+1],beforeNode:l[o-1]})}function pF(n){const e=n.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function gF(n,e,t){const i=(xE(t)+(t.options.ruleSpaces?" ":"")).repeat(pF(t));return t.options.ruleSpaces?i.slice(0,-1):i}const bE={blockquote:jU,break:zC,code:HU,definition:UU,emphasis:Cb,hardBreak:zC,heading:ZU,html:uE,image:fE,imageReference:hE,inlineCode:dE,link:pE,linkReference:gE,list:oF,listItem:cF,paragraph:uF,root:fF,strong:Nb,text:mF,thematicBreak:gF};function xF(){return{enter:{table:yF,tableData:PC,tableHeader:PC,tableRow:vF},exit:{codeText:wF,table:bF,tableData:$0,tableHeader:$0,tableRow:$0}}}function yF(n){const e=n._align;this.enter({type:"table",align:e.map(function(t){return t==="none"?null:t}),children:[]},n),this.data.inTable=!0}function bF(n){this.exit(n),this.data.inTable=void 0}function vF(n){this.enter({type:"tableRow",children:[]},n)}function $0(n){this.exit(n)}function PC(n){this.enter({type:"tableCell",children:[]},n)}function wF(n){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,kF));const t=this.stack[this.stack.length-1];t.type,t.value=e,this.exit(n)}function kF(n,e){return e==="|"?e:n}function SF(n){const e=n||{},t=e.tableCellPadding,i=e.tablePipeAlign,l=e.stringLength,o=t?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` -`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:a,tableCell:f,tableRow:u}};function a(v,w,S,C){return d(m(v,S,C),v.align)}function u(v,w,S,C){const N=g(v,S,C),j=d([N]);return j.slice(0,j.indexOf(` -`))}function f(v,w,S,C){const N=S.enter("tableCell"),j=S.enter("phrasing"),D=S.containerPhrasing(v,{...C,before:o,after:o});return j(),N(),D}function d(v,w){return MU(v,{align:w,alignDelimiters:i,padding:t,stringLength:l})}function m(v,w,S){const C=v.children;let N=-1;const j=[],D=w.enter("table");for(;++N0&&!t&&(n[n.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),t}const UF={tokenize:GF,partial:!0};function FF(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:XF,continuation:{tokenize:$F},exit:YF}},text:{91:{name:"gfmFootnoteCall",tokenize:QF},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:qF,resolveTo:VF}}}}function qF(n,e,t){const i=this;let l=i.events.length;const o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let a;for(;l--;){const f=i.events[l][1];if(f.type==="labelImage"){a=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return u;function u(f){if(!a||!a._balanced)return t(f);const d=lr(i.sliceSerialize({start:a.end,end:i.now()}));return d.codePointAt(0)!==94||!o.includes(d.slice(1))?t(f):(n.enter("gfmFootnoteCallLabelMarker"),n.consume(f),n.exit("gfmFootnoteCallLabelMarker"),e(f))}}function VF(n,e){let t=n.length;for(;t--;)if(n[t][1].type==="labelImage"&&n[t][0]==="enter"){n[t][1];break}n[t+1][1].type="data",n[t+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},n[t+3][1].start),end:Object.assign({},n[n.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},n[t+3][1].end),end:Object.assign({},n[t+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},n[n.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},u=[n[t+1],n[t+2],["enter",i,e],n[t+3],n[t+4],["enter",l,e],["exit",l,e],["enter",o,e],["enter",a,e],["exit",a,e],["exit",o,e],n[n.length-2],n[n.length-1],["exit",i,e]];return n.splice(t,n.length-t+1,...u),n}function QF(n,e,t){const i=this,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o=0,a;return u;function u(g){return n.enter("gfmFootnoteCall"),n.enter("gfmFootnoteCallLabelMarker"),n.consume(g),n.exit("gfmFootnoteCallLabelMarker"),f}function f(g){return g!==94?t(g):(n.enter("gfmFootnoteCallMarker"),n.consume(g),n.exit("gfmFootnoteCallMarker"),n.enter("gfmFootnoteCallString"),n.enter("chunkString").contentType="string",d)}function d(g){if(o>999||g===93&&!a||g===null||g===91||Rt(g))return t(g);if(g===93){n.exit("chunkString");const b=n.exit("gfmFootnoteCallString");return l.includes(lr(i.sliceSerialize(b)))?(n.enter("gfmFootnoteCallLabelMarker"),n.consume(g),n.exit("gfmFootnoteCallLabelMarker"),n.exit("gfmFootnoteCall"),e):t(g)}return Rt(g)||(a=!0),o++,n.consume(g),g===92?m:d}function m(g){return g===91||g===92||g===93?(n.consume(g),o++,d):d(g)}}function XF(n,e,t){const i=this,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o,a=0,u;return f;function f(w){return n.enter("gfmFootnoteDefinition")._container=!0,n.enter("gfmFootnoteDefinitionLabel"),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(w),n.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(w){return w===94?(n.enter("gfmFootnoteDefinitionMarker"),n.consume(w),n.exit("gfmFootnoteDefinitionMarker"),n.enter("gfmFootnoteDefinitionLabelString"),n.enter("chunkString").contentType="string",m):t(w)}function m(w){if(a>999||w===93&&!u||w===null||w===91||Rt(w))return t(w);if(w===93){n.exit("chunkString");const S=n.exit("gfmFootnoteDefinitionLabelString");return o=lr(i.sliceSerialize(S)),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(w),n.exit("gfmFootnoteDefinitionLabelMarker"),n.exit("gfmFootnoteDefinitionLabel"),b}return Rt(w)||(u=!0),a++,n.consume(w),w===92?g:m}function g(w){return w===91||w===92||w===93?(n.consume(w),a++,m):m(w)}function b(w){return w===58?(n.enter("definitionMarker"),n.consume(w),n.exit("definitionMarker"),l.includes(o)||l.push(o),xt(n,v,"gfmFootnoteDefinitionWhitespace")):t(w)}function v(w){return e(w)}}function $F(n,e,t){return n.check(_u,e,n.attempt(UF,e,t))}function YF(n){n.exit("gfmFootnoteDefinition")}function GF(n,e,t){const i=this;return xt(n,l,"gfmFootnoteDefinitionIndent",5);function l(o){const a=i.events[i.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(o):t(o)}}function KF(n){let t=(n||{}).singleTilde;const i={name:"strikethrough",tokenize:o,resolveAll:l};return t==null&&(t=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function l(a,u){let f=-1;for(;++f1?f(w):(a.consume(w),g++,v);if(g<2&&!t)return f(w);const C=a.exit("strikethroughSequenceTemporary"),N=us(w);return C._open=!N||N===2&&!!S,C._close=!S||S===2&&!!N,u(w)}}}class WF{constructor(){this.map=[],this.index=new Map}add(e,t,i){ZF(this,e,t,i)}consume(e){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let t=this.map.length;const i=[];for(;t>0;)t-=1,i.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];i.push(e.slice()),e.length=0;let l=i.pop();for(;l;){for(const o of l)e.push(o);l=i.pop()}this.map.length=0,this.index.clear()}}function ZF(n,e,t,i){if(t===0&&i.length===0)return;const l=n.index.get(e);if(l){l[1]+=t,l[2].push(...i);return}const o=[e,t,i];n.map.push(o),n.index.set(e,o)}function JF(n,e){let t=!1;const i=[];for(;e-1;){const{type:me}=i.events[G][1];if(me==="lineEnding"||me==="linePrefix")G--;else break}const F=G>-1?i.events[G][1].type:null,se=F==="tableHead"||F==="tableRow"?E:f;return se===E&&i.parser.lazy[i.now().line]?t(q):se(q)}function f(q){return n.enter("tableHead"),n.enter("tableRow"),d(q)}function d(q){return q===124||(a=!0,o+=1),m(q)}function m(q){return q===null?t(q):Ie(q)?o>1?(o=0,i.interrupt=!0,n.exit("tableRow"),n.enter("lineEnding"),n.consume(q),n.exit("lineEnding"),v):t(q):Je(q)?xt(n,m,"whitespace")(q):(o+=1,a&&(a=!1,l+=1),q===124?(n.enter("tableCellDivider"),n.consume(q),n.exit("tableCellDivider"),a=!0,m):(n.enter("data"),g(q)))}function g(q){return q===null||q===124||Rt(q)?(n.exit("data"),m(q)):(n.consume(q),q===92?b:g)}function b(q){return q===92||q===124?(n.consume(q),g):g(q)}function v(q){return i.interrupt=!1,i.parser.lazy[i.now().line]?t(q):(n.enter("tableDelimiterRow"),a=!1,Je(q)?xt(n,w,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(q):w(q))}function w(q){return q===45||q===58?C(q):q===124?(a=!0,n.enter("tableCellDivider"),n.consume(q),n.exit("tableCellDivider"),S):U(q)}function S(q){return Je(q)?xt(n,C,"whitespace")(q):C(q)}function C(q){return q===58?(o+=1,a=!0,n.enter("tableDelimiterMarker"),n.consume(q),n.exit("tableDelimiterMarker"),N):q===45?(o+=1,N(q)):q===null||Ie(q)?I(q):U(q)}function N(q){return q===45?(n.enter("tableDelimiterFiller"),j(q)):U(q)}function j(q){return q===45?(n.consume(q),j):q===58?(a=!0,n.exit("tableDelimiterFiller"),n.enter("tableDelimiterMarker"),n.consume(q),n.exit("tableDelimiterMarker"),D):(n.exit("tableDelimiterFiller"),D(q))}function D(q){return Je(q)?xt(n,I,"whitespace")(q):I(q)}function I(q){return q===124?w(q):q===null||Ie(q)?!a||l!==o?U(q):(n.exit("tableDelimiterRow"),n.exit("tableHead"),e(q)):U(q)}function U(q){return t(q)}function E(q){return n.enter("tableRow"),T(q)}function T(q){return q===124?(n.enter("tableCellDivider"),n.consume(q),n.exit("tableCellDivider"),T):q===null||Ie(q)?(n.exit("tableRow"),e(q)):Je(q)?xt(n,T,"whitespace")(q):(n.enter("data"),z(q))}function z(q){return q===null||q===124||Rt(q)?(n.exit("data"),T(q)):(n.consume(q),q===92?te:z)}function te(q){return q===92||q===124?(n.consume(q),z):z(q)}}function nq(n,e){let t=-1,i=!0,l=0,o=[0,0,0,0],a=[0,0,0,0],u=!1,f=0,d,m,g;const b=new WF;for(;++tt[2]+1){const w=t[2]+1,S=t[3]-t[2]-1;n.add(w,S,[])}}n.add(t[3]+1,0,[["exit",g,e]])}return l!==void 0&&(o.end=Object.assign({},sa(e.events,l)),n.add(l,0,[["exit",o,e]]),o=void 0),o}function IC(n,e,t,i,l){const o=[],a=sa(e.events,t);l&&(l.end=Object.assign({},a),o.push(["exit",l,e])),i.end=Object.assign({},a),o.push(["exit",i,e]),n.add(t+1,0,o)}function sa(n,e){const t=n[e],i=t[0]==="enter"?"start":"end";return t[1][i]}const iq={name:"tasklistCheck",tokenize:lq};function rq(){return{text:{91:iq}}}function lq(n,e,t){const i=this;return l;function l(f){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?t(f):(n.enter("taskListCheck"),n.enter("taskListCheckMarker"),n.consume(f),n.exit("taskListCheckMarker"),o)}function o(f){return Rt(f)?(n.enter("taskListCheckValueUnchecked"),n.consume(f),n.exit("taskListCheckValueUnchecked"),a):f===88||f===120?(n.enter("taskListCheckValueChecked"),n.consume(f),n.exit("taskListCheckValueChecked"),a):t(f)}function a(f){return f===93?(n.enter("taskListCheckMarker"),n.consume(f),n.exit("taskListCheckMarker"),n.exit("taskListCheck"),u):t(f)}function u(f){return Ie(f)?e(f):Je(f)?n.check({tokenize:sq},e,t)(f):t(f)}}function sq(n,e,t){return xt(n,i,"whitespace");function i(l){return l===null?t(l):e(l)}}function oq(n){return jA([RF(),FF(),KF(n),eq(),rq()])}const aq={};function cq(n){const e=this,t=n||aq,i=e.data(),l=i.micromarkExtensions||(i.micromarkExtensions=[]),o=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),a=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);l.push(oq(t)),o.push(AF()),a.push(EF(t))}function uq(n){return n.replace(/\\n/g,` -`).replace(/\\t/g," ").replace(/\\"/g,'"').replace(/\\'/g,"'").replace(/\\\\/g,"\\")}const fq={h1:({children:n})=>y.jsx("h3",{className:"mt-3 mb-1.5 text-base font-bold text-ink first:mt-0",children:n}),h2:({children:n})=>y.jsx("h4",{className:"mt-3 mb-1 text-sm font-semibold text-ink first:mt-0",children:n}),h3:({children:n})=>y.jsx("h5",{className:"mt-2 mb-1 text-xs font-semibold text-ink first:mt-0",children:n}),p:({children:n})=>y.jsx("p",{className:"my-1.5 leading-relaxed first:mt-0 last:mb-0",children:n}),strong:({children:n})=>y.jsx("strong",{className:"font-semibold text-ink",children:n}),em:({children:n})=>y.jsx("em",{className:"italic text-ink-secondary",children:n}),del:({children:n})=>y.jsx("del",{className:"text-ink-muted line-through",children:n}),a:({children:n,href:e})=>y.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-chip-indigo-text underline underline-offset-2 hover:text-ink",children:n}),code:({children:n,className:e})=>y.jsx("code",{className:`break-words rounded bg-elevated px-1 py-0.5 font-mono text-chip-indigo-text whitespace-pre-wrap ${e??""}`,children:n}),pre:({children:n})=>y.jsx("pre",{className:"my-2 overflow-x-auto rounded-lg border border-line bg-elevated p-3 font-mono text-xs text-ink [&_code]:bg-transparent [&_code]:px-0 [&_code]:py-0 [&_code]:text-inherit",children:n}),ul:({children:n})=>y.jsx("ul",{className:"my-1.5 list-disc space-y-0.5 pl-5",children:n}),ol:({children:n})=>y.jsx("ol",{className:"my-1.5 list-decimal space-y-0.5 pl-5",children:n}),li:({children:n})=>y.jsx("li",{className:"leading-relaxed",children:n}),blockquote:({children:n})=>y.jsx("blockquote",{className:"my-2 border-l-2 border-line-strong pl-3 text-ink-secondary italic",children:n}),table:({children:n})=>y.jsx("div",{className:"my-2 overflow-x-auto",children:y.jsx("table",{className:"w-full border-collapse text-xs",children:n})}),th:({children:n})=>y.jsx("th",{className:"border border-line bg-elevated px-2 py-1 text-left font-semibold",children:n}),td:({children:n})=>y.jsx("td",{className:"border border-line px-2 py-1 align-top",children:n}),hr:()=>y.jsx("hr",{className:"my-3 border-line"}),img:({alt:n,src:e,title:t})=>y.jsx("img",{src:e,alt:n,title:t,loading:"lazy",referrerPolicy:"no-referrer",className:"my-2 max-w-full rounded-lg border border-line"})};function $h({text:n}){return n?y.jsx(II,{remarkPlugins:[cq,WI],components:fq,children:uq(n)}):null}function AE(n){return n==="completed"||n==="aborted"||n==="failed"}function Vc({label:n}){return y.jsx("kbd",{"aria-hidden":"true",className:"ml-1.5 inline-block rounded border border-line/60 bg-elevated/60 px-1 py-px font-mono text-[10px] font-normal leading-none opacity-90",children:n})}function UC(n){!n||AE(n.status)||PM(n.session_id).catch(()=>{})}const hq={running:"running",completed:"done",skipped:"skipped",failed:"failed",pending:"pending"};function Yh({text:n}){const[e,t]=M.useState(!1),i=M.useRef(void 0);M.useEffect(()=>()=>window.clearTimeout(i.current),[]);const l=async()=>{try{await navigator.clipboard.writeText(n),t(!0),window.clearTimeout(i.current),i.current=window.setTimeout(()=>t(!1),1500)}catch{}};return y.jsx("button",{type:"button",onClick:l,"aria-label":e?"Copied":"Copy content",title:e?"Copied!":"Copy content",className:"absolute right-2 top-2 rounded-md p-1.5 text-ink-muted hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:e?y.jsx(Lr,{className:"h-3.5 w-3.5"}):y.jsx(fi,{className:"h-3.5 w-3.5"})})}function dq({isOpen:n,onClose:e,directory:t,filename:i,release:l,args:o,onFinished:a}){var ze,B;const[u,f]=M.useState(null),[d,m]=M.useState(!1),[g,b]=M.useState(null),[v,w]=M.useState(null),[S,C]=M.useState(!1),[N,j]=M.useState(0),D=M.useRef(null),I=M.useRef(!1),U=M.useRef(null),E=M.useRef(!1);M.useEffect(()=>{if(!n||!t||!i){f(null),b(null),C(!1),w(null),E.current=!1;return}let R=!0;return m(!0),b(null),C(!1),w(null),zM({directory:t,filename:i,release:l,args:o}).then($=>{R&&(f($),m(!1),($.status==="completed"||$.status==="aborted"||$.status==="failed")&&(a==null||a($.status,$.final_message||"")))}).catch($=>{R&&(($==null?void 0:$.status)===404&&C(!0),b($.message||"Failed to start workflow"),m(!1))}),()=>{R=!1}},[n,t,i,l,o,N]);const T=async R=>{if(!(!u||I.current)){I.current=!0,m(!0);try{const $=await BM(u.session_id,R);f($),($.status==="completed"||$.status==="aborted"||$.status==="failed")&&(a==null||a($.status,$.final_message||""))}catch($){($==null?void 0:$.status)===404?(C(!0),b($.message||"Workflow session on the server has expired.")):b($.message||"Failed to process workflow response")}finally{I.current=!1,m(!1)}}},z=M.useRef(u);z.current=u;const te=M.useRef(T);te.current=T;const q=M.useRef(v);q.current=v;const G=M.useRef([]),F=(R,$)=>{var je,Ne;if(R.key!=="ArrowDown"&&R.key!=="ArrowUp"&&R.key!=="Home"&&R.key!=="End")return;R.preventDefault();const ue=((je=z.current)==null?void 0:je.steps.length)??0;if(ue===0)return;const ge=R.key==="ArrowDown"?($+1)%ue:R.key==="ArrowUp"?($-1+ue)%ue:R.key==="Home"?0:ue-1;w(ge),(Ne=G.current[ge])==null||Ne.focus()};M.useEffect(()=>()=>UC(z.current),[]);const se=()=>{E.current||(E.current=!0,UC(z.current),e())},me=()=>{f(null),b(null),C(!1),w(null),E.current=!1,j(R=>R+1)},ne=ds({isOpen:n,onClose:se,dialogRef:D,initialFocusRef:U});if(M.useEffect(()=>{if(!n)return;const R=$=>{var _e,Pt,tn;if($.key==="Escape"){$.preventDefault(),se();return}const ue=z.current;if(!ue)return;if(AE(ue.status)){$.key==="Enter"&&!$.repeat&&!$.ctrlKey&&!$.metaKey&&!$.altKey&&!I.current&&((_e=$.target)==null?void 0:_e.tagName)!=="BUTTON"&&((Pt=document.activeElement)==null?void 0:Pt.tagName)!=="BUTTON"&&($.preventDefault(),se());return}if(I.current||$.repeat||$.ctrlKey||$.metaKey||$.altKey)return;const ge=$.target;if((ge==null?void 0:ge.tagName)==="INPUT"||(ge==null?void 0:ge.tagName)==="TEXTAREA"||ge!=null&&ge.isContentEditable)return;const je=q.current,Ne=je===null||je===ue.current_index,Pe=ue.status==="waiting_ask"?"yes":ue.status==="waiting_notify"||ue.status==="waiting_notice"?"ack":null;if(!Ne||Pe===null)return;if($.key==="Enter"){const gn=$.target;if((gn==null?void 0:gn.tagName)==="BUTTON"||((tn=document.activeElement)==null?void 0:tn.tagName)==="BUTTON")return;$.preventDefault(),te.current(Pe);return}if(ue.status!=="waiting_ask")return;const be=$.key.toLowerCase();be==="y"?($.preventDefault(),te.current("yes")):be==="s"?($.preventDefault(),te.current("skip")):be==="n"&&($.preventDefault(),te.current("no"))};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[n,e]),M.useEffect(()=>{if(!n||!u)return;const R=requestAnimationFrame(()=>{var $;return($=U.current)==null?void 0:$.focus()});return()=>cancelAnimationFrame(R)},[n,u==null?void 0:u.status]),!n)return null;const _=v!==null?u==null?void 0:u.steps[v]:u==null?void 0:u.steps[u.current_index],Z=(u==null?void 0:u.status)==="completed"||(u==null?void 0:u.status)==="aborted"||(u==null?void 0:u.status)==="failed",ie=!!u&&!Z&&!S&&(((ze=u.status)==null?void 0:ze.startsWith("waiting"))??!1),re=(((B=u==null?void 0:u.steps[(u==null?void 0:u.current_index)??-1])==null?void 0:B.phase)??"pre")==="post",Be=!S&&(v===null||v===(u==null?void 0:u.current_index))&&(_!=null&&_.command)&&((u==null?void 0:u.status)==="waiting_notify"||(u==null?void 0:u.status)==="waiting_notice"||(u==null?void 0:u.status)==="waiting_ask")?y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Command:"}),y.jsxs("div",{className:"relative rounded-lg border border-line bg-surface-strong p-4 pr-10 font-mono text-xs text-ink leading-relaxed",children:[y.jsx(Yh,{text:_.command}),_.command]})]}):null;return y.jsx("div",{ref:D,role:"dialog","aria-modal":"true","aria-labelledby":"workflow-runner-title",onKeyDown:ne,className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-xs",children:y.jsxs("div",{className:"animate-modal-in flex h-[80vh] w-full max-w-5xl flex-col rounded-xl border border-frame-line glass-panel overflow-hidden",children:[y.jsxs("div",{className:"flex items-center justify-between border-b border-line px-5 py-3.5 bg-surface-strong/30 shrink-0",children:[y.jsxs("div",{className:"flex items-center gap-2.5",children:[y.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-chip-indigo-bg text-chip-indigo-text",children:y.jsx(aO,{className:"h-4 w-4"})}),y.jsxs("div",{children:[y.jsx("h2",{id:"workflow-runner-title",className:"text-sm font-semibold text-ink",children:"Launch Workflow Engine"}),y.jsxs("p",{className:"text-xs text-ink-muted",children:[i," ",u!=null&&u.pattern?`• Pattern: ${u.pattern}`:""]})]})]}),y.jsxs("div",{className:"flex items-center gap-1.5",children:[u&&!Z&&!S&&y.jsxs("button",{type:"button",disabled:!ie||d,onClick:()=>T("bypass"),title:re?"Skip the remaining post-launch steps":"Skip the remaining steps and launch with the OS default app",className:"btn inline-flex items-center gap-1.5 rounded-md border border-line bg-surface px-3 py-1.5 text-xs font-medium text-status-warning-text hover:bg-status-warning-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 disabled:cursor-not-allowed disabled:opacity-40",children:[y.jsx(uD,{className:"h-3.5 w-3.5"}),re?"Skip rest":"Launch now"]}),y.jsx("button",{type:"button",onClick:se,className:"rounded-md p-1.5 text-ink-muted hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:y.jsx(Ri,{className:"h-4 w-4"})})]})]}),y.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[y.jsxs("div",{className:"w-72 border-r border-line bg-surface-strong/20 p-4 overflow-y-auto flex flex-col gap-2 shrink-0",children:[y.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-ink-muted px-1 mb-1",children:"Workflow Steps (Click to inspect)"}),u&&u.steps.length>0?y.jsx("ul",{role:"list",className:"flex flex-col gap-2",children:u.steps.map((R,$)=>{const ue=u.current_index===$&&!Z,ge=v===$||v===null&&ue,je=hq[R.status];return y.jsx("li",{children:y.jsxs("button",{ref:Ne=>{G.current[$]=Ne},type:"button",tabIndex:ge?0:-1,"aria-current":ge?"step":void 0,onKeyDown:Ne=>F(Ne,$),onClick:()=>w($),className:`flex items-start text-left gap-2.5 rounded-lg border px-3 py-2.5 transition-colors cursor-pointer w-full ${ge?"border-chip-indigo-border bg-chip-indigo-bg shadow-xs ring-1 ring-chip-indigo-border/40":"border-line/60 bg-surface/60 hover:bg-elevated/80"}`,children:[y.jsxs("div",{className:"mt-0.5 shrink-0",children:[R.status==="running"&&y.jsx(sl,{className:"h-4 w-4 animate-spin text-chip-indigo-text"}),R.status==="completed"&&y.jsx($k,{className:"h-4 w-4 text-status-success-text"}),R.status==="skipped"&&y.jsx(M4,{className:"h-4 w-4 text-status-warning-text"}),R.status==="failed"&&y.jsx(Gc,{className:"h-4 w-4 text-status-danger-text"}),R.status==="pending"&&y.jsx("div",{className:"h-4 w-4 rounded-full border border-line-strong flex items-center justify-center text-[10px] text-ink-faint font-mono",children:R.index})]}),y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("span",{className:"font-mono text-[11px] font-bold uppercase text-chip-indigo-text",children:R.action}),y.jsxs("span",{className:"text-[10px] font-mono text-ink-faint",children:["#",R.index," · ",je]})]}),y.jsx("p",{className:"truncate font-mono text-[11px] text-ink-secondary mt-0.5",title:R.command,children:R.message?R.message.split(` -`)[0]:R.command}),R.note&&y.jsx("p",{className:"mt-1 text-[10px] text-ink-faint italic",children:R.note})]})]})},R.index)})}):y.jsx("div",{className:"p-4 text-center text-xs text-ink-faint",children:g||S?"Session unavailable — see the error panel.":"Loading steps..."})]}),y.jsxs("div",{className:"flex-1 flex flex-col bg-app",children:[y.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-6",children:y.jsx("div",{className:"space-y-6",children:y.jsxs("div",{className:"rounded-xl border border-line bg-surface p-5 shadow-xs space-y-4",children:[y.jsxs("div",{className:"flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"rounded bg-chip-indigo-bg px-2 py-0.5 font-mono text-xs font-semibold uppercase text-chip-indigo-text",children:(_==null?void 0:_.action)||(u==null?void 0:u.status)}),y.jsx("span",{className:"text-xs text-ink-muted",children:_?`Step ${_.index} of ${u==null?void 0:u.steps.length}`:"Status"}),v!==null&&v!==(u==null?void 0:u.current_index)&&y.jsx("button",{type:"button",onClick:()=>w(null),className:"text-[11px] text-chip-indigo-text hover:underline ml-2",children:"(Return to active step)"})]}),d&&y.jsx(sl,{className:"h-4 w-4 animate-spin text-chip-indigo-text"})]}),y.jsxs("div",{className:"space-y-3 text-xs text-ink font-sans leading-relaxed",children:[(v===null||v===(u==null?void 0:u.current_index))&&(u==null?void 0:u.status)==="waiting_notify"&&u.notify_message&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Notification Message:"}),y.jsx("div",{className:"rounded-lg border border-line bg-surface-strong p-4 text-ink",children:y.jsx($h,{text:u.notify_message})}),Be]}),(v===null||v===(u==null?void 0:u.current_index))&&(u==null?void 0:u.status)==="waiting_notice"&&u.notice_message&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Notice:"}),y.jsx("div",{className:"rounded-lg border border-line bg-surface-strong p-4 text-ink",children:y.jsx($h,{text:u.notice_message})}),Be,y.jsx("p",{className:"text-[11px] text-ink-faint",children:"The command will run when you continue."})]}),(v===null||v===(u==null?void 0:u.current_index))&&(u==null?void 0:u.status)==="waiting_ask"&&u.ask_prompt&&y.jsxs("div",{className:"space-y-2",children:[u.ask_message&&y.jsx("div",{className:"rounded-lg border border-line bg-surface-strong p-4 text-ink",children:y.jsx($h,{text:u.ask_message})}),y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-status-warning-text",children:"Confirmation Prompt:"}),y.jsx("div",{className:"rounded-lg border border-status-warning-border bg-status-warning-bg p-4 text-sm font-medium text-ink",children:u.ask_prompt}),Be]}),Z&&v===null&&y.jsxs("div",{className:`rounded-xl border p-8 text-center space-y-4 ${(u==null?void 0:u.status)==="completed"?"border-status-success-border bg-status-success-bg text-status-success-text":"border-status-danger-border bg-status-danger-bg text-status-danger-text"}`,children:[y.jsx("div",{className:"inline-flex h-12 w-12 items-center justify-center rounded-full bg-surface/50 mx-auto",children:(u==null?void 0:u.status)==="completed"?y.jsx($k,{className:"h-6 w-6 text-status-success-text"}):y.jsx(Gc,{className:"h-6 w-6 text-status-danger-text"})}),y.jsxs("div",{className:"space-y-1",children:[y.jsx("h3",{className:"text-base font-bold",children:(u==null?void 0:u.status)==="completed"?"Workflow Finished":"Workflow Terminated"}),y.jsx("p",{className:"text-xs text-ink-secondary max-w-md mx-auto",children:(u==null?void 0:u.final_message)||"The launch sequence has ended."})]}),y.jsx("div",{className:"pt-2",children:y.jsx("button",{type:"button",onClick:e,className:"btn btn-primary px-8 py-2.5 font-bold shadow-lg",children:"Close Engine Runner"})})]}),Z&&v===null&&(u==null?void 0:u.last_output)&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Command Output:"}),y.jsxs("div",{className:"relative",children:[y.jsx(Yh,{text:u.last_output}),y.jsx("pre",{className:"max-h-48 overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-line bg-surface-strong p-4 font-mono text-xs text-ink",children:u.last_output})]})]}),!S&&!(Z&&v===null)&&!((v===null||v===(u==null?void 0:u.current_index))&&((u==null?void 0:u.status)==="waiting_notify"||(u==null?void 0:u.status)==="waiting_ask"||(u==null?void 0:u.status)==="waiting_notice"))&&y.jsxs("div",{className:"space-y-4",children:[(_==null?void 0:_.message)&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Message:"}),y.jsx("div",{className:"rounded-lg border border-line bg-surface-strong p-4 text-xs text-ink",children:y.jsx($h,{text:_.message})})]}),y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Command:"}),y.jsx("div",{className:"relative rounded-lg border border-line bg-surface-strong p-4 font-mono text-xs text-ink leading-relaxed",children:_!=null&&_.command?y.jsxs(y.Fragment,{children:[y.jsx(Yh,{text:_.command}),y.jsx("span",{className:"block pr-8",children:_.command})]}):"Waiting..."})]}),(_==null?void 0:_.output)&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Output:"}),y.jsxs("div",{className:"relative",children:[y.jsx(Yh,{text:_.output}),y.jsx("pre",{className:"max-h-48 overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-line bg-surface-strong p-4 font-mono text-xs text-ink",children:_.output})]})]}),(_==null?void 0:_.ask)&&y.jsxs("div",{className:"rounded-lg border border-status-warning-border bg-status-warning-bg p-3 text-xs text-status-warning-text",children:[y.jsx("span",{className:"font-semibold",children:"Workflow Guard:"})," ",_.ask]}),(_==null?void 0:_.note)&&y.jsxs("div",{className:"rounded-lg border border-line bg-surface-strong p-3 text-xs text-ink-muted italic",children:[y.jsx("span",{className:"font-semibold text-ink-secondary not-italic uppercase text-[10px]",children:"Log:"})," ",_.note]})]})]})]})})}),(g||S)&&y.jsx("div",{className:"shrink-0 px-6 pt-3",children:y.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-status-danger-border bg-status-danger-bg p-3 text-xs text-status-danger-text",children:[y.jsx(Gc,{className:"mt-0.5 h-4 w-4 shrink-0"}),y.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[y.jsx("p",{children:S?"Workflow session on the server has expired or ended.":g}),S?y.jsxs("div",{className:"space-y-2",children:[g&&y.jsxs("details",{className:"text-ink-muted",children:[y.jsx("summary",{className:"cursor-pointer select-none text-[11px] underline",children:"Raw error (for bug reports)"}),y.jsx("pre",{className:"mt-1 overflow-x-auto whitespace-pre-wrap break-words font-mono text-[11px]",children:g})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("button",{type:"button",onClick:me,className:"btn btn-primary px-4 py-1.5 text-xs font-semibold",children:"Restart workflow"}),y.jsx("button",{type:"button",onClick:se,className:"btn rounded-md border-line bg-surface px-4 py-1.5 text-xs",children:"Close"})]})]}):null]})]})}),y.jsxs("div",{className:"shrink-0 px-6 pt-4 pb-4 border-t border-line flex items-center justify-between bg-app",children:[y.jsx("div",{className:"text-xs text-ink-muted","aria-live":"polite",children:S?"Session unavailable — restart or close above.":(u==null?void 0:u.status)==="waiting_ask"&&(v===null||v===u.current_index)?"Action required to proceed:":(u==null?void 0:u.status)==="waiting_notify"&&(v===null||v===u.current_index)?"Acknowledge message to proceed:":(u==null?void 0:u.status)==="waiting_notice"&&(v===null||v===u.current_index)?"Continue to run the command:":Z?"Session terminated.":"Step in progress..."}),y.jsxs("div",{className:"flex items-center gap-2",children:[!S&&(u==null?void 0:u.status)==="waiting_notice"&&(v===null||v===u.current_index)&&y.jsxs("button",{type:"button",ref:U,disabled:d,onClick:()=>T("ack"),className:"btn btn-primary px-5 py-2 font-semibold shadow-sm",children:["Run Command",y.jsx(Vc,{label:"↵"})]}),!S&&(u==null?void 0:u.status)==="waiting_notify"&&(v===null||v===u.current_index)&&y.jsxs("button",{type:"button",ref:U,disabled:d,onClick:()=>T("ack"),className:"btn btn-primary px-5 py-2 font-semibold shadow-sm",children:["Continue Workflow",y.jsx(Vc,{label:"↵"})]}),!S&&(u==null?void 0:u.status)==="waiting_ask"&&(v===null||v===u.current_index)&&y.jsxs(y.Fragment,{children:[y.jsxs("button",{type:"button",disabled:d,onClick:()=>T("no"),className:"btn rounded-md border-line bg-surface px-4 py-2 text-status-danger-text hover:bg-status-danger-bg",children:["Abort Launch",y.jsx(Vc,{label:"N"})]}),y.jsxs("button",{type:"button",disabled:d,onClick:()=>T("skip"),className:"btn rounded-md border-line bg-surface px-4 py-2 text-status-warning-text hover:bg-status-warning-bg",children:["Skip Step",y.jsx(Vc,{label:"S"})]}),y.jsxs("button",{type:"button",ref:U,disabled:d,onClick:()=>T("yes"),className:"btn btn-primary px-5 py-2 font-semibold shadow-sm",children:["Execute Step",y.jsx(Vc,{label:"Y"})]})]}),Z&&y.jsx("button",{type:"button",ref:U,onClick:e,className:"btn btn-primary px-5 py-2 font-semibold shadow-sm",children:"Close Runner"})]})]})]})]})]})})}function FC({url:n,label:e,className:t="",onCopied:i,onCopyError:l}){const o=async()=>{try{await navigator.clipboard.writeText(n),i==null||i(n)}catch{l==null||l(n)}};return y.jsxs("span",{className:`flex items-center justify-between gap-2 ${t}`.trim(),children:[y.jsx("code",{className:"truncate font-mono text-[11px] text-ink",children:n}),y.jsx("button",{type:"button",onClick:o,"aria-label":e??`Copy ${n}`,title:e??"Copy",className:"focus-ring shrink-0 rounded p-1 text-ink-faint transition-colors hover:bg-elevated hover:text-ink",children:y.jsx(fi,{className:"h-3.5 w-3.5"})})]})}const mq=";",qC="=";function pq(n){const e=n.trim().toLowerCase();return e==="extension"||e==="file_ext"||e==="filetype"?"ext":e==="directory"||e==="path"||e==="folder"?"dir":e==="recurse"||e==="recursive_search"?"recursive":e==="filter_text"||e==="query"||e==="search"?"filter":e}function VC(n){const e=n.trim();if(!e.includes(qC))return{values:{filter:e},isPlainFilter:!0};const t={};for(const i of e.split(mq)){const l=i.trim();if(!l)continue;const o=l.indexOf(qC);if(o===-1)continue;const a=pq(l.slice(0,o)),u=l.slice(o+1).trim();switch(a){case"filter":t.filter=u;break;case"ext":t.ext=u;break;case"recursive":t.recursive=QC(u,!0);break;case"dir":t.dir=u;break;case"scan":t.scan=QC(u,!1);break}}return{values:t,isPlainFilter:!1}}function QC(n,e){const t=n.toLowerCase();return["0","false","no","off"].includes(t)?!1:["1","true","yes","on"].includes(t)?!0:e}function Qc(n){return/[",\n\r]/.test(n)?`"${n.replace(/"/g,'""')}"`:n}function gq(n,e,t,i){var f,d;const l=[],a=[["Exported",new Date().toISOString()],["App Version",(t==null?void 0:t.release)??"unknown"],["Config File",(t==null?void 0:t.config_path)??"none"],["Config Exists",String((t==null?void 0:t.config_exists)??!1)],["Directory",(t==null?void 0:t.active_directory)??""],["Extensions",((f=t==null?void 0:t.extensions)==null?void 0:f.join(" | "))??""],["Filter Text",i??((d=t==null?void 0:t.filters)==null?void 0:d[0])??""],["Recursive",String((t==null?void 0:t.recursive_search)??!0)],["Title",(t==null?void 0:t.title)??""],["Release",(t==null?void 0:t.release)??""]];for(const[m,g]of a)l.push(`${Qc(m)},${Qc(g)}`);l.push("");const u=e.length>0?e:["filename","path","rel_path"];l.push(u.map(Qc).join(","));for(const m of n){const g=u.map(b=>b in m?Qc(String(m[b]??"")):Qc(m.column_values[b]??""));l.push(g.join(","))}return l.join(`\r -`)}const xq=120,XC=800,yq=4e3,$C=20;function bq(){const[n,e]=M.useState("dark"),[t,i]=M.useState(null),[l,o]=M.useState(null),[a,u]=M.useState(""),[f,d]=M.useState(""),[m,g]=M.useState(""),[b,v]=M.useState(!0),[w,S]=M.useState([]),[C,N]=M.useState(0),[j,D]=M.useState(!1),[I,U]=M.useState(!1),[E,T]=M.useState(null),[z,te]=M.useState(!1),[q,G]=M.useState(null),[F,se]=M.useState(0),[me,ne]=M.useState(!1),_=M.useRef(0),Z=M.useRef(null),ie=M.useRef(null),[re,A]=M.useState(""),[Be,ze]=M.useState(null),[B,R]=M.useState(!1),[$,ue]=M.useState(null),[ge,je]=M.useState(!1),[Ne,Pe]=M.useState("en"),[be,_e]=M.useState(!1),[Pt,tn]=M.useState(!1),[gn,zt]=M.useState(!1),[Ct,ot]=M.useState(0),[nn,Pn]=M.useState(!1),[Ht,rn]=M.useState(null),[Se,Ve]=M.useState(null),[We,ft]=M.useState(!1),[ee,fe]=M.useState(!1),[Te,He]=M.useState(null),[de,pe]=M.useState(null),[Ee,nt]=M.useState(!1),at=M.useRef(""),[hn,Kt]=M.useState(!1),[bi,Vt]=M.useState(void 0),[xn,ti]=M.useState(!1),[yn,dl]=M.useState(null),[ps,zu]=M.useState(0),uo=M.useRef(null),gs=M.useRef(null),ye=(H,P="info")=>{H&&(ue({message:H,kind:P}),gs.current&&clearTimeout(gs.current),gs.current=setTimeout(()=>ue(null),P==="error"?1e4:3500))},Qn=()=>{gs.current&&clearTimeout(gs.current),ue(null)},cr=H=>{He(H)},Bt=()=>{var P;ie.current&&(clearTimeout(ie.current),ie.current=null),(P=Z.current)==null||P.abort(),Z.current=new AbortController;const H=++_.current;return ne(!0),U(!1),H},Qt=H=>H===_.current,ni=H=>{Qt(H)&&ne(!1)},ii=M.useRef(null);M.useEffect(()=>{if(!m.trim()){A("");return}const H=window.setTimeout(()=>A(m),xq);return()=>window.clearTimeout(H)},[m]);const At=M.useMemo(()=>re.trim()===""?w:w.filter(H=>e8(H.rel_path,re)),[w,re]),fo=m.trim()&&w.length{const H=ii.current,P=H?At.findIndex(le=>le.path===H):-1;if(P>=0){se(le=>P!==le?P:le);return}se(le=>Math.min(le,Math.max(0,At.length-1)))},[At]);const xs=async(H,P=q)=>{var Re;const le=await Kg({offset:0,limit:M0,sort_by:P==null?void 0:P.column,sort_dir:P==null?void 0:P.direction,signal:(Re=Z.current)==null?void 0:Re.signal});return Qt(H)?(S(le.items),N(le.count),D(!0),!0):!1},bn=async(H,P)=>{var le;return!Qt(H)||(await Ik(P,(le=Z.current)==null?void 0:le.signal),!Qt(H)||!await xs(H))?!1:(ii.current=null,se(0),!0)},ho=async()=>{if(I||w.length>=C)return;const H=_.current;U(!0);try{const P=await Kg({offset:w.length,limit:M0,sort_by:q==null?void 0:q.column,sort_dir:q==null?void 0:q.direction});if(!Qt(H))return;const le=new Set(w.map(Re=>Re.path||Re.filename));S(Re=>[...Re,...P.items.filter(et=>!le.has(et.path||et.filename))]),N(P.count)}catch{ye("Couldn't load more results — scroll to try again.","error")}finally{Qt(H)&&U(!1)}},ml=async()=>{if(ge)return;je(!0),ye("Reloading configuration...");const H=Bt();try{const P=await Gh();i(P);const le=await OM();o(le),e(Qk(le.theme));const Re=le.active_directory||a,et=le.extensions[0]??"",it=le.filters[0]??"";Re&&u(Re),d(et),g(it),v(le.recursive_search),le.reloaded===!1?ye(`Config file not found: ${le.config_path||"(unknown path)"} — kept current configuration.`,"error"):ye("Configuration reloaded."),Re&&await bn(H,{directory:Re,extension:et,filter_text:it,recursive:le.recursive_search})}catch(P){ye(`Failed to reload configuration: ${P.message}`,"error")}finally{je(!1),ni(H)}},ys=async H=>{const P=Bt();o(H),e(Qk(H.theme));const le=H.active_directory||a||(H.directories[0]??""),Re=H.extensions[0]??"",et=H.filters[0]??"";if(le&&u(le),d(Re),g(et),v(H.recursive_search),H.session_trial||ye(H.config_exists?`Loaded config: ${H.config_path}`:"Starter configuration created."),le)try{await bn(P,{directory:le,extension:Re,filter_text:et,recursive:H.recursive_search})}catch(it){ye(`Scan failed after config load: ${it.message}`,"error")}finally{ni(P)}else ni(P)},[xm,Bu]=M.useState(!1),bs=M.useRef(Kh()),ur=H=>{bs.current=H,Bu(H.overlayVisible)},Pa=M.useRef(()=>{}),Pu=async H=>{try{const P=await H.text(),le=await GC(H.name,P);await ys(le),ye(`Session config applied: ${H.name}`)}catch(P){ye(P.message||"Failed to apply dropped configuration","error")}};Pa.current=H=>{Pu(H)};const mo=M.useRef(0),Ha=M.useRef(async()=>{});M.useEffect(()=>{Ha.current=async()=>{const H=await Lk();await ys(H)}}),M.useEffect(()=>{const H=async()=>{let le=[];try{le=(await bM(mo.current)).events}catch{return}for(const Re of le){if(mo.current=Math.max(mo.current,Re.id),Re.config_applied)try{await Ha.current()}catch{}ye(Re.message)}},P=setInterval(()=>void H(),yq);return()=>clearInterval(P)},[]),M.useEffect(()=>{const H=it=>{var vn;return Array.from(((vn=it.dataTransfer)==null?void 0:vn.types)??[]).includes("Files")},P=it=>{ur(Vk(bs.current,"enter",H(it)))},le=it=>{H(it)&&it.preventDefault()},Re=it=>{ur(Vk(bs.current,"leave",H(it)))},et=it=>{var pt;it.preventDefault(),ur(Kh());const vn=Array.from(((pt=it.dataTransfer)==null?void 0:pt.files)??[]),Xe=UM(vn);if(!Xe){vn.length>0&&ye("Not a ProFiles configuration file.","error");return}Pa.current(Xe)};return window.addEventListener("dragenter",P),window.addEventListener("dragover",le),window.addEventListener("dragleave",Re),window.addEventListener("drop",et),()=>{window.removeEventListener("dragenter",P),window.removeEventListener("dragover",le),window.removeEventListener("dragleave",Re),window.removeEventListener("drop",et)}},[]);const Ia=()=>{_e(!0)},Ua=async H=>{const P=Bt();_e(!1),u(H),ye(`Directory selected: ${H}`);let le;try{le=await zk(H),o(le)}catch(it){console.error("select-directory failed:",it)}if(!Qt(P))return;const Re=le!=null&&le.extensions.includes(f)?f:(le==null?void 0:le.extensions[0])??f,et=le!=null&&le.filters.includes(m)?m:(le==null?void 0:le.filters[0])??m;d(Re),g(et);try{await bn(P,{directory:H,extension:Re,filter_text:et,recursive:b})}catch(it){Qt(P)&&ye(`Scan failed: ${it.message}`,"error")}finally{ni(P)}},Hu=async(H,P)=>{if(!Qt(P))return;const le=H.theme==="auto"?"dark":H.theme==="light"?"light":"dark";e(le);try{localStorage.setItem("profiles-theme",le)}catch{}o(H);const Re=H.active_directory||(H.directories.length>0?H.directories[0]:""),et=H.extensions.length>0?H.extensions[0]:"",it=H.filters.length>0?H.filters[0]:"";if(Re&&u(Re),et&&d(et),H.recursive_search!==void 0&&v(H.recursive_search),it&&g(it),H.config_exists||tn(!0),Re)try{await bn(P,{directory:Re,extension:et,filter_text:it,recursive:H.recursive_search})}catch(vn){Qt(P)&&ye(`Initial scan failed: ${vn.message}`,"error")}},Fa=async()=>{var P;(P=Z.current)==null||P.abort(),Z.current=new AbortController;const H=++_.current;T(null),te(!0);try{const le=await Gh();i(le);const Re=await Lk();await Hu(Re,H)}catch(le){T((le==null?void 0:le.message)||"Couldn't fetch system info or configuration.")}finally{te(!1)}};M.useEffect(()=>{Fa()},[]),M.useEffect(()=>()=>{var H;ie.current&&(clearTimeout(ie.current),ie.current=null),(H=Z.current)==null||H.abort()},[]);const ri=async H=>{const P=Bt();u(H);try{const le=await zk(H);if(!Qt(P))return;o(le);const Re=le.extensions.includes(f)?f:le.extensions[0]??"",et=le.filters.includes(m)?m:le.filters[0]??"";d(Re),g(et),await bn(P,{directory:H,extension:Re,filter_text:et,recursive:b})}catch(le){Qt(P)&&ye(`Directory change failed: ${le.message}`,"error")}finally{ni(P)}},It=async()=>{if(!a)return;const H=Bt();try{await bn(H,{directory:a,extension:f,filter_text:m,recursive:b})}catch(P){Qt(H)&&ye(`Scan failed: ${(P==null?void 0:P.message)??P}`,"error")}finally{ni(H)}},Wt=M.useRef(It);M.useEffect(()=>{Wt.current=It});const pl=H=>{g(H),ie.current&&clearTimeout(ie.current),ie.current=setTimeout(()=>{ie.current=null,Wt.current()},XC)},Iu=H=>{v(H),ie.current&&clearTimeout(ie.current),ie.current=setTimeout(()=>{ie.current=null,Wt.current()},XC)},ym=async()=>{if(g(""),!a)return;const H=Bt();try{await bn(H,{directory:a,extension:f,filter_text:"",recursive:b})}catch(P){Qt(H)&&ye(`Scan failed: ${(P==null?void 0:P.message)??P}`,"error")}finally{ni(H)}},bm=async()=>{if(v(!1),!a)return;const H=Bt();try{await bn(H,{directory:a,extension:f,filter_text:m,recursive:!1})}catch(P){Qt(H)&&ye(`Scan failed: ${P.message}`,"error")}finally{ni(H)}},Ir=async(H,P)=>{if(H.has_hook){pe({file:H,args:P});return}try{await MM({directory:a,filename:H.rel_path,release:l==null?void 0:l.release,args:P}),ye(`Launched ${H.filename}`)}catch(le){ye(`Launch error: ${le.message}`,"error")}},gl=()=>{At.length>0&&At[F]&&Ir(At[F])},po=H=>{var P;ii.current=((P=At[H])==null?void 0:P.path)??null,se(H)},go=async(H,P)=>{Ir(H,P)},Ur=async H=>{try{await WC(H.path),ye("Revealed in file manager.")}catch(P){ye(`Error: ${P.message}`,"error")}},xl=async H=>{try{await Y0(H.path),ye("Folder opened in file manager.")}catch(P){ye(`Error: ${P.message}`,"error")}},vs=async H=>{try{const P=await Uk(H.path);ye(P.message||"Terminal opened.")}catch(P){ye(`Error: ${P.message}`,"error")}},yl=async H=>{try{await ri(H),ye(`Scanned directory: ${H}`)}catch(P){ye(`Error: ${P.message}`,"error")}},ln=H=>{g(H);const P=Bt();bn(P,{directory:a,extension:f,filter_text:H,recursive:b}).catch(le=>{Qt(P)&&ye(`Scan failed: ${(le==null?void 0:le.message)??le}`,"error")}).finally(()=>ni(P))},Uu=H=>{d(H);const P=Bt();bn(P,{directory:a,extension:H,filter_text:m,recursive:b}).catch(le=>{Qt(P)&&ye(`Scan failed: ${(le==null?void 0:le.message)??le}`,"error")}).finally(()=>ni(P))},Fu=async(H,P)=>{const le=P?H.path.replace(/\\/g,"/"):H.path;try{await navigator.clipboard.writeText(le),ye("Path copied to clipboard.")}catch(Re){ye(`Copy failed: ${(Re==null?void 0:Re.message)??Re}`,"error")}},qu=async(H,P)=>{let le=H.filename;if(P){const Re=le.lastIndexOf(".");Re!==-1&&(le=le.slice(0,Re))}try{await navigator.clipboard.writeText(le),ye("Filename copied to clipboard.")}catch(Re){ye(`Copy failed: ${(Re==null?void 0:Re.message)??Re}`,"error")}},Fr=async(H,P)=>{try{ye(`Computing ${P.toUpperCase()}...`);const le=await Fk(H.path,P);await navigator.clipboard.writeText(le.hash),ye(`${P.toUpperCase()} hash copied: ${le.hash.slice(0,12)}...`)}catch(le){ye(`Hash computation failed: ${le.message}`,"error")}},bl=async H=>{try{const P=new URL("file:///").href+H.path.replace(/\\/g,"/");await navigator.clipboard.writeText(P),ye("File URI copied to clipboard.")}catch(P){ye(`URI copy failed: ${P.message}`,"error")}},vm=async(H,P)=>{try{const le=await navigator.clipboard.readText();if(!le.trim()){ye("Clipboard is empty — copy a hash first, then try again.");return}ye(`Computing ${P.toUpperCase()}...`);const et=(await Fk(H.path,P)).hash.toLowerCase()===le.trim().toLowerCase();ye(et?`✅ ${P.toUpperCase()} matches!`:`❌ ${P.toUpperCase()} mismatch`)}catch(le){ye(`Verification failed: ${le.message}`,"error")}},qa=H=>{Ve(H),Pn(!0)},Vu=H=>{rn(H)},wm=async()=>{const H=Ht;if(rn(null),!!H)try{if(ye("Deleting file..."),!(await fetch("/api/actions/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:H.path})})).ok)throw new Error("Failed to delete file");ye("File deleted successfully."),It()}catch(P){ye(`Delete failed: ${P.message}`,"error")}},ht=H=>{Vt(H.path),Kt(!0)},Va=async()=>{if(a)try{await Y0(a),ye("Directory opened in file manager.")}catch(H){ye(`Error: ${H.message}`,"error")}},xo=async H=>{if(H)try{await Uk(H),ye("Terminal opened in directory.")}catch(P){ye(`Error: ${P.message}`,"error")}},ws=async()=>{try{await ri("~"),ye("Directory set to home folder.")}catch(H){ye(`Error: ${H.message}`,"error")}},$i=async()=>{if(a)try{const H=await KC(a);H.parent_path?(await ri(H.parent_path),ye("Moved to parent directory.")):ye("Already at root directory.")}catch(H){ye(`Error: ${H.message}`,"error")}},Xn=async()=>{if(w.length===0){ye("No files to export.");return}try{const H=gq(w,(l==null?void 0:l.column_names)||[],l??void 0,m),P=`profiles-export-${new Date().toISOString().slice(0,19).replace(/[:.]/g,"-")}.csv`,le=await _M(H,P);ye(`Exported ${w.length} loaded row${w.length===1?"":"s"}${m?` matching "${m}"`:""} — ${le.message}`)}catch(H){ye(`Export failed: ${H.message}`,"error")}},Qu=async H=>{var Xe,pt;ti(!1),ye("Barcode detected!");const le=VC(H).values,Re=le.dir!==void 0?le.dir:a,et=le.ext!==void 0?le.ext:f,it=le.filter!==void 0?le.filter:m,vn=le.recursive!==void 0?le.recursive:b;if(le.dir!==void 0&&u(le.dir),le.ext!==void 0&&d(le.ext),le.filter!==void 0&&g(le.filter),le.recursive!==void 0&&v(le.recursive),Re){const vt=Bt();try{await Ik({directory:Re,extension:et,filter_text:it,recursive:vn},(Xe=Z.current)==null?void 0:Xe.signal);const fr=await Kg({offset:0,limit:M0,sort_by:q==null?void 0:q.column,sort_dir:q==null?void 0:q.direction,signal:(pt=Z.current)==null?void 0:pt.signal});if(!Qt(vt))return;S(fr.items),N(fr.count),D(!0),ii.current=null,se(0),fr.count===1&&fr.items.length===1&&dl(fr.items[0])}catch(fr){Qt(vt)&&ye(`Scan error: ${fr.message}`,"error")}finally{ni(vt)}}},km=()=>{nt(H=>{const P=!H;return P?(at.current="",ye("Barcode mode ON — scan a barcode now.")):(at.current="",ye("Barcode mode OFF.")),P})},Qa=H=>{H.filter!==void 0&&g(H.filter),H.ext!==void 0&&d(H.ext),H.recursive!==void 0&&v(H.recursive),H.dir!==void 0&&u(H.dir),(H.scan===!0||H.filter!==void 0||H.ext!==void 0||H.recursive!==void 0||H.dir!==void 0)&&(nt(!1),at.current="",setTimeout(()=>{Wt.current()},50))};M.useEffect(()=>{if(!Ee)return;const H=P=>{const le=P.target;if(!(le instanceof HTMLElement&&(le.isContentEditable||le instanceof HTMLInputElement||le instanceof HTMLTextAreaElement||le instanceof HTMLSelectElement)))if(P.key==="Enter"){const et=at.current;if(!et){at.current="";return}P.preventDefault(),at.current="";const it=VC(et);if(it.isPlainFilter)ye(`Barcode filter: ${it.values.filter}`),g(it.values.filter||""),nt(!1),setTimeout(()=>void Wt.current(),50);else{const vn=it.values,Xe=Object.entries(vn).map(([pt,vt])=>`${pt}=${vt}`).join(", ");ye(`Barcode applied: ${Xe}`),Qa(vn)}}else P.key==="Escape"?(nt(!1),at.current="",ye("Barcode mode cancelled.")):P.key.length===1&&!P.ctrlKey&&!P.metaKey&&!P.altKey&&(at.current+=P.key)};return document.addEventListener("keydown",H,!0),()=>document.removeEventListener("keydown",H,!0)},[Ee]),M.useEffect(()=>(ps>0&&(uo.current=setInterval(()=>{Wt.current()},ps*1e3)),()=>{uo.current&&(clearInterval(uo.current),uo.current=null)}),[ps]);const Xu=H=>{zu(H),H>0?ye(`Auto-rescan every ${H}s.`):ye("Auto-rescan disabled.")},$u=!!(Be||B||be||Pt||nn||We||ee||hn||xn||yn||de||Ht);return M.useEffect(()=>{const H=P=>{var Re,et,it,vn;if(P.key==="Escape"){ze(null),R(!1),ft(!1),fe(!1),ur(Kh());return}if($u)return;if(P.ctrlKey&&!P.shiftKey&&P.key.toLowerCase()==="l"){P.preventDefault(),(Re=document.querySelector("[data-testid='file-list']"))==null||Re.focus();return}const le=P.target;if(!(le instanceof HTMLElement&&le.closest("button, a, [role='menuitem'], [role='option'], [role='columnheader'], [role='separator']"))){if(le instanceof HTMLInputElement||le instanceof HTMLSelectElement){P.key==="Enter"&&It();return}if(P.key==="ContextMenu"||P.shiftKey&&P.key==="F10"){const Xe=At[F];if(!Xe)return;P.preventDefault();const pt=document.querySelector(`[data-row-index="${F}"]`),vt=pt==null?void 0:pt.getBoundingClientRect();ze({x:vt?vt.left+24:24,y:vt?vt.top+vt.height/2:24,file:Xe});return}if(P.key==="F5"){P.preventDefault(),It();return}if(P.ctrlKey&&P.key.toLowerCase()==="r"){P.preventDefault(),ml();return}if(P.ctrlKey&&P.key.toLowerCase()==="d"){P.preventDefault(),(et=document.querySelector("#directory-combobox"))==null||et.focus();return}if(P.ctrlKey&&P.key.toLowerCase()==="e"){P.preventDefault(),(it=document.querySelector("#extension-combobox"))==null||it.focus();return}if(P.ctrlKey&&P.key.toLowerCase()==="f"){P.preventDefault(),(vn=document.querySelector("#filter-combobox"))==null||vn.focus();return}if(P.ctrlKey&&P.shiftKey&&P.key.toLowerCase()==="l"){P.preventDefault(),ft(Xe=>!Xe);return}if(P.ctrlKey&&P.key===","){P.preventDefault(),zt(!0);return}if(P.ctrlKey&&P.shiftKey&&P.key.toLowerCase()==="t"){P.preventDefault(),e(Xe=>Xe==="dark"?"light":"dark");return}if(P.ctrlKey&&!P.shiftKey&&P.key.toLowerCase()==="b"){P.preventDefault(),nt(Xe=>!Xe);return}if(P.ctrlKey&&P.shiftKey&&P.key.toLowerCase()==="b"){P.preventDefault(),ti(Xe=>!Xe);return}if(P.ctrlKey&&!P.shiftKey&&P.key.toLowerCase()==="t"){P.preventDefault(),fe(!0);return}if(P.ctrlKey&&!P.shiftKey&&P.key.toLowerCase()==="h"){P.preventDefault(),ws();return}if(P.key==="?"||P.ctrlKey&&P.key==="/"){P.preventDefault(),R(Xe=>!Xe);return}if(P.key.toLowerCase()==="p"&&!P.ctrlKey&&!P.shiftKey&&!P.altKey){const Xe=At[F];Xe&&(P.preventDefault(),qa(Xe));return}P.key==="ArrowDown"?(P.preventDefault(),se(Xe=>{var vt;const pt=Math.min(Xe+1,Math.max(0,At.length-1));return ii.current=((vt=At[pt])==null?void 0:vt.path)??null,pt})):P.key==="ArrowUp"?(P.preventDefault(),se(Xe=>{var vt;const pt=Math.max(Xe-1,0);return ii.current=((vt=At[pt])==null?void 0:vt.path)??null,pt})):P.key==="Home"?(P.preventDefault(),se(Xe=>{var pt;return ii.current=((pt=At[0])==null?void 0:pt.path)??null,Xe===0?Xe:0})):P.key==="End"?(P.preventDefault(),se(Xe=>{var vt;const pt=Math.max(0,At.length-1);return ii.current=((vt=At[pt])==null?void 0:vt.path)??null,Xe===pt?Xe:pt})):P.key==="PageUp"?(P.preventDefault(),se(Xe=>{var vt;const pt=Math.max(Xe-$C,0);return ii.current=((vt=At[pt])==null?void 0:vt.path)??null,pt})):P.key==="PageDown"?(P.preventDefault(),se(Xe=>{var vt;const pt=Math.min(Xe+$C,Math.max(0,At.length-1));return ii.current=((vt=At[pt])==null?void 0:vt.path)??null,pt})):P.key==="Enter"&&(P.preventDefault(),gl())}};return window.addEventListener("keydown",H),()=>window.removeEventListener("keydown",H)},[$u,At,F,a,f,m,b,Ee]),M.useEffect(()=>{document.documentElement.setAttribute("data-theme",n);try{localStorage.setItem("profiles-theme",n)}catch{}},[n]),y.jsxs("div",{className:"flex h-dvh flex-col bg-elevated/30 p-1 font-sans text-ink transition-colors duration-200 sm:p-1.5",children:[y.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-frame-line bg-app shadow-[0_2px_6px_rgb(0_0_0/0.35)] transition-colors duration-200 sm:rounded-xl",children:[y.jsx($9,{title:(l==null?void 0:l.title)||"",release:(l==null?void 0:l.release)||"",directories:(l==null?void 0:l.directories)||[],activeDirectory:a,onDirectoryChange:ri,onBrowseDirectory:Ia,onGoToParentDirectory:$i,onGoToHomeDirectory:ws,onOpenActiveDirectory:Va,onOpenTerminal:xo}),y.jsx(n8,{extensions:(l==null?void 0:l.extensions)||[],activeExtension:f,onExtensionChange:d,filterOptions:(l==null?void 0:l.filters)||[],filterText:m,onFilterTextChange:pl,recursive:b,onRecursiveChange:Iu,onScan:It,scanning:me,barcodeMode:Ee,onBarcodeToggle:km,onCameraBarcodeClick:()=>ti(!0),autoRescanActive:ps>0,onTimerClick:()=>fe(!0)}),E?y.jsx(Y9,{message:E,onRetry:()=>void Fa(),retrying:z}):y.jsx(X9,{files:At,totalCount:C,rawLoadedCount:w.length,onLoadMore:ho,loadingMore:I,scanning:me,hasScanned:j,activeDirectory:a,recursive:b,onDisableRecursive:bm,onOpenDirectory:Va,onLoadConfig:()=>tn(!0),filterText:m,onClearFilter:ym,columnHeaders:(l==null?void 0:l.column_headers)||[],columnNames:(l==null?void 0:l.column_names)||[],selectedIndex:F,onSelectIndex:po,prefilterNote:fo,onLaunch:Ir,onContextMenu:(H,P,le)=>{H.preventDefault(),ii.current=P.path,se(le),ze({x:H.clientX,y:H.clientY,file:P})},rowColors:(l==null?void 0:l.row_colors)||[],sort:q,onSortChange:H=>{G(H),ii.current=null,se(0);const P=Bt();xs(P,H).catch(le=>{Qt(P)&&ye(`Sort failed: ${le.message}`,"error")}).finally(()=>ni(P))}}),y.jsx(_D,{onExecute:gl,scanning:me,scanningDirectory:a,hasSelection:At.length>0,fileCount:At.length,totalCount:C,toastMessage:$,onToastDismiss:Qn}),y.jsx(S8,{systemInfo:t,fileCount:C,theme:n,onToggleTheme:()=>e(H=>H==="dark"?"light":"dark"),onOpenLog:()=>ft(!0),onOpenConfig:()=>zt(!0),onShowShortcuts:()=>R(!0),onReloadConfig:ml,onExport:Xn,exportDisabled:w.length===0||me,language:Ne,onLanguageChange:Pe,lanEnabled:(t==null?void 0:t.lan_enabled)??null,onToggleLan:cr})]}),y.jsx(U9,{open:gn,onClose:()=>zt(!1),onApplied:ys,onLoadConfig:()=>tn(!0),reloadKey:Ct}),y.jsx(a8,{isOpen:Pt,activeConfigPath:l==null?void 0:l.config_path,configExists:l==null?void 0:l.config_exists,onClose:()=>tn(!1),onLoaded:H=>{ys(H),ot(P=>P+1)}}),y.jsx(V9,{visible:xm,onFileSelected:H=>Pa.current(H)}),y.jsx(q9,{isOpen:be,initialPath:a,onClose:()=>_e(!1),onSelect:Ua}),y.jsx(F9,{position:Be,onClose:()=>ze(null),onLaunch:Ir,onLaunchWithArgs:go,onReveal:Ur,onOpenFolder:xl,onOpenTerminal:vs,onScanDirectory:yl,onFilterFolder:ln,onFilterExtension:Uu,onCopyPath:Fu,onCopyFilename:qu,onCopyUri:bl,onComputeHash:Fr,onVerifyHash:vm,onProperties:qa,onClearFile:Vu,onGenerateBarcode:ht,showToast:ye}),y.jsx(o8,{isOpen:B,onClose:()=>R(!1)}),y.jsx(d8,{isOpen:nn,file:Se,onLaunch:Ir,onClose:()=>{Pn(!1),Ve(null)}}),y.jsx(O8,{isOpen:ee,currentInterval:ps,onClose:()=>fe(!1),onSetInterval:Xu}),y.jsx(s8,{isOpen:We,onClose:()=>ft(!1),onOpenExternally:()=>{vM().then(H=>ye(H.message))}}),y.jsx(dq,{isOpen:!!de,onClose:()=>pe(null),directory:a,filename:(de==null?void 0:de.file.rel_path)||"",release:l==null?void 0:l.release,args:de==null?void 0:de.args,onFinished:(H,P)=>{H==="completed"?ye(P||"Workflow launched successfully."):(H==="aborted"||H==="failed")&&ye(`Workflow stopped: ${P}`,"error")}}),y.jsx(xA,{isOpen:hn,onClose:()=>{Kt(!1),Vt(void 0)},initialFilePath:bi}),y.jsx(w8,{isOpen:xn,onClose:()=>ti(!1),onDetected:Qu}),y.jsx(Js,{isOpen:!!Ht,title:"Delete file",message:`Delete this file? - -${(Ht==null?void 0:Ht.path)??""} - -This action cannot be undone.`,confirmLabel:"Delete",danger:!0,onConfirm:wm,onCancel:()=>rn(null)}),y.jsx(Js,{isOpen:Te!==null,title:Te?"Enable LAN access?":"Restrict to this machine?",message:Te?y.jsxs("span",{className:"block",children:["ProFiles will be reachable by anyone on this network:",y.jsx(FC,{url:`http://${t==null?void 0:t.hostname}:${window.location.port}`,label:"Copy hostname URL",className:"mt-1.5",onCopied:()=>ye("URL copied to clipboard."),onCopyError:()=>ye("Failed to copy URL.","error")}),y.jsx(FC,{url:`http://${t==null?void 0:t.ip}:${window.location.port}`,label:"Copy IP URL",className:"mt-1.5",onCopied:()=>ye("URL copied to clipboard."),onCopyError:()=>ye("Failed to copy URL.","error")})]}):"ProFiles will be reachable only on this machine.",confirmLabel:Te?"Enable LAN":"Restrict",onConfirm:async()=>{const H=Te;He(null);try{await kM(H),ye(H?"Updating LAN binding…":"Restricting ProFiles to this machine…","info");const P=await SM(H);P&&i(P),(P==null?void 0:P.lan_enabled)===H?ye(H?"ProFiles is now reachable on the local network.":"ProFiles is restricted to this machine.","info"):ye("Failed to update LAN binding — the previous address is still active.","error")}catch(P){const le=P instanceof Error?P.message:"Failed to update LAN binding";ye(`Failed to update LAN binding: ${le}`,"error");const Re=await Gh();i(Re)}},onCancel:()=>He(null)}),y.jsx(k8,{isOpen:!!yn,file:yn,onConfirm:()=>{if(yn){const H=yn;dl(null),Ir(H)}},onDismiss:()=>dl(null)})]})}class vq extends M.Component{constructor(){super(...arguments);dh(this,"state",{error:null})}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,i){console.error("Application render error:",t,i.componentStack)}render(){return this.state.error?y.jsx("main",{className:"flex min-h-screen items-center justify-center bg-app p-6 text-ink",children:y.jsxs("section",{className:"w-full max-w-lg rounded-lg border border-line bg-surface p-6",children:[y.jsx("h1",{className:"text-base font-semibold",children:"ProFiles encountered an error"}),y.jsx("p",{className:"mt-2 text-sm text-ink-secondary",children:"The interface could not continue. Reload the application to try again."}),y.jsxs("details",{className:"mt-4 text-xs text-ink-muted",children:[y.jsx("summary",{className:"cursor-pointer",children:"Error details"}),y.jsx("pre",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap",children:this.state.error.message})]}),y.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"btn btn-primary mt-5 px-4 py-2 text-sm font-semibold",children:"Reload application"})]})}):this.props.children}}yM.createRoot(document.getElementById("root")).render(y.jsx(fM.StrictMode,{children:y.jsx(vq,{children:y.jsx(bq,{})})})); diff --git a/src/profiles/web/dist/assets/index-SVUzfHxO.js b/src/profiles/web/dist/assets/index-SVUzfHxO.js new file mode 100644 index 0000000..cb4e337 --- /dev/null +++ b/src/profiles/web/dist/assets/index-SVUzfHxO.js @@ -0,0 +1,448 @@ +var sM=Object.defineProperty;var oM=(n,e,t)=>e in n?sM(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var ph=(n,e,t)=>oM(n,typeof e!="symbol"?e+"":e,t);(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const l of document.querySelectorAll('link[rel="modulepreload"]'))i(l);new MutationObserver(l=>{for(const o of l)if(o.type==="childList")for(const a of o.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&i(a)}).observe(document,{childList:!0,subtree:!0});function t(l){const o={};return l.integrity&&(o.integrity=l.integrity),l.referrerPolicy&&(o.referrerPolicy=l.referrerPolicy),l.crossOrigin==="use-credentials"?o.credentials="include":l.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function i(l){if(l.ep)return;l.ep=!0;const o=t(l);fetch(l.href,o)}})();function gy(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Xg={exports:{}},Bc={};/** + * @license React + * react-jsx-runtime.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Tk;function aM(){if(Tk)return Bc;Tk=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function t(i,l,o){var a=null;if(o!==void 0&&(a=""+o),l.key!==void 0&&(a=""+l.key),"key"in l){o={};for(var u in l)u!=="key"&&(o[u]=l[u])}else o=l;return l=o.ref,{$$typeof:n,type:i,key:a,ref:l!==void 0?l:null,props:o}}return Bc.Fragment=e,Bc.jsx=t,Bc.jsxs=t,Bc}var Ak;function cM(){return Ak||(Ak=1,Xg.exports=aM()),Xg.exports}var y=cM(),$g={exports:{}},Ve={};/** + * @license React + * react.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Ek;function uM(){if(Ek)return Ve;Ek=1;var n=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),t=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),l=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),a=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),f=Symbol.for("react.suspense"),d=Symbol.for("react.memo"),m=Symbol.for("react.lazy"),g=Symbol.for("react.activity"),b=Symbol.for("react.view_transition"),v=Symbol.iterator;function w(R){return R===null||typeof R!="object"?null:(R=v&&R[v]||R["@@iterator"],typeof R=="function"?R:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,N={};function j(R,Q,he){this.props=R,this.context=Q,this.refs=N,this.updater=he||S}j.prototype.isReactComponent={},j.prototype.setState=function(R,Q){if(typeof R!="object"&&typeof R!="function"&&R!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,R,Q,"setState")},j.prototype.forceUpdate=function(R){this.updater.enqueueForceUpdate(this,R,"forceUpdate")};function D(){}D.prototype=j.prototype;function U(R,Q,he){this.props=R,this.context=Q,this.refs=N,this.updater=he||S}var H=U.prototype=new D;H.constructor=U,C(H,j.prototype),H.isPureReactComponent=!0;var M=Array.isArray;function A(){}var L={H:null,A:null,T:null,S:null},ne=Object.prototype.hasOwnProperty;function F(R,Q,he){var ge=he.ref;return{$$typeof:n,type:R,key:Q,ref:ge!==void 0?ge:null,props:he}}function W(R,Q){return F(R.type,Q,R.props)}function I(R){return typeof R=="object"&&R!==null&&R.$$typeof===n}function re(R){var Q={"=":"=0",":":"=2"};return"$"+R.replace(/[=:]/g,function(he){return Q[he]})}var pe=/\/+/g;function ce(R,Q){return typeof R=="object"&&R!==null&&R.key!=null?re(""+R.key):Q.toString(36)}function Z(R){switch(R.status){case"fulfilled":return R.value;case"rejected":throw R.reason;default:switch(typeof R.status=="string"?R.then(A,A):(R.status="pending",R.then(function(Q){R.status==="pending"&&(R.status="fulfilled",R.value=Q)},function(Q){R.status==="pending"&&(R.status="rejected",R.reason=Q)})),R.status){case"fulfilled":return R.value;case"rejected":throw R.reason}}throw R}function oe(R,Q,he,ge,ze){var Te=typeof R;(Te==="undefined"||Te==="boolean")&&(R=null);var He=!1;if(R===null)He=!0;else switch(Te){case"bigint":case"string":case"number":He=!0;break;case"object":switch(R.$$typeof){case n:case e:He=!0;break;case m:return He=R._init,oe(He(R._payload),Q,he,ge,ze)}}if(He)return ze=ze(R),He=ge===""?"."+ce(R,0):ge,M(ze)?(he="",He!=null&&(he=He.replace(pe,"$&/")+"/"),oe(ze,Q,he,"",function(Qt){return Qt})):ze!=null&&(I(ze)&&(ze=W(ze,he+(ze.key==null||R&&R.key===ze.key?"":(""+ze.key).replace(pe,"$&/")+"/")+He)),Q.push(ze)),1;He=0;var ke=ge===""?".":ge+":";if(M(R))for(var Ae=0;Ae>>1,T=Z[G];if(0>>1;Gl(z,K))Rl(Q,z)?(Z[G]=Q,Z[R]=K,G=R):(Z[G]=z,Z[be]=K,G=be);else if(Rl(Q,K))Z[G]=Q,Z[R]=K,G=R;else break e}}return oe}function l(Z,oe){var K=Z.sortIndex-oe.sortIndex;return K!==0?K:Z.id-oe.id}if(n.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;n.unstable_now=function(){return o.now()}}else{var a=Date,u=a.now();n.unstable_now=function(){return a.now()-u}}var f=[],d=[],m=1,g=null,b=3,v=!1,w=!1,S=!1,C=!1,N=typeof setTimeout=="function"?setTimeout:null,j=typeof clearTimeout=="function"?clearTimeout:null,D=typeof setImmediate<"u"?setImmediate:null;function U(Z){for(var oe=t(d);oe!==null;){if(oe.callback===null)i(d);else if(oe.startTime<=Z)i(d),oe.sortIndex=oe.expirationTime,e(f,oe);else break;oe=t(d)}}function H(Z){if(S=!1,U(Z),!w)if(t(f)!==null)w=!0,M||(M=!0,I());else{var oe=t(d);oe!==null&&ce(H,oe.startTime-Z)}}var M=!1,A=-1,L=5,ne=-1;function F(){return C?!0:!(n.unstable_now()-neZ&&F());){var G=g.callback;if(typeof G=="function"){g.callback=null,b=g.priorityLevel;var T=G(g.expirationTime<=Z);if(Z=n.unstable_now(),typeof T=="function"){g.callback=T,U(Z),oe=!0;break t}g===t(f)&&i(f),U(Z)}else i(f);g=t(f)}if(g!==null)oe=!0;else{var de=t(d);de!==null&&ce(H,de.startTime-Z),oe=!1}}break e}finally{g=null,b=K,v=!1}oe=void 0}}finally{oe?I():M=!1}}}var I;if(typeof D=="function")I=function(){D(W)};else if(typeof MessageChannel<"u"){var re=new MessageChannel,pe=re.port2;re.port1.onmessage=W,I=function(){pe.postMessage(null)}}else I=function(){N(W,0)};function ce(Z,oe){A=N(function(){Z(n.unstable_now())},oe)}n.unstable_IdlePriority=5,n.unstable_ImmediatePriority=1,n.unstable_LowPriority=4,n.unstable_NormalPriority=3,n.unstable_Profiling=null,n.unstable_UserBlockingPriority=2,n.unstable_cancelCallback=function(Z){Z.callback=null},n.unstable_forceFrameRate=function(Z){0>Z||125G?(Z.sortIndex=K,e(d,Z),t(f)===null&&Z===t(d)&&(S?(j(A),A=-1):S=!0,ce(H,K-G))):(Z.sortIndex=T,e(f,Z),w||v||(w=!0,M||(M=!0,I()))),Z},n.unstable_shouldYield=F,n.unstable_wrapCallback=function(Z){var oe=b;return function(){var K=b;b=oe;try{return Z.apply(this,arguments)}finally{b=K}}}})(Kg)),Kg}var Rk;function dM(){return Rk||(Rk=1,Gg.exports=hM()),Gg.exports}var Wg={exports:{}},jn={};/** + * @license React + * react-dom.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var jk;function mM(){if(jk)return jn;jk=1;var n=xy();function e(m){var g="https://react.dev/errors/"+m;if(1"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Wg.exports=mM(),Wg.exports}/** + * @license React + * react-dom-client.production.js + * + * Copyright (c) Meta Platforms, Inc. and affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + */var Lk;function pM(){if(Lk)return Pc;Lk=1;var n=dM(),e=xy(),t=KC();function i(r){var s="https://react.dev/errors/"+r;if(1xn||(r.current=Ft[xn],Ft[xn]=null,xn--)}function lt(r,s){xn++,Ft[xn]=r.current,r.current=s}var tn=Ht(null),Hn=Ht(null),qt=Ht(null),Kt=Ht(null);function Oe(r,s){switch(lt(qt,s),lt(Hn,r),lt(tn,null),s.nodeType){case 9:case 11:r=(r=s.documentElement)&&(r=r.namespaceURI)?zw(r):0;break;default:if(r=s.tagName,s=s.namespaceURI)s=zw(s),r=Bw(s,r);else switch(r){case"svg":r=1;break;case"math":r=2;break;default:r=0}}Ot(tn),lt(tn,r)}function qe(){Ot(tn),Ot(Hn),Ot(qt)}function $e(r){var s=r.memoizedState;s!==null&&(na._currentValue=s.memoizedState,lt(Kt,r)),s=tn.current;var c=Bw(s,r.type);s!==c&&(lt(Hn,r),lt(tn,c))}function ht(r){Hn.current===r&&(Ot(tn),Ot(Hn)),Kt.current===r&&(Ot(Kt),na._currentValue=Qt)}var te,fe;function _e(r){if(te===void 0)try{throw Error()}catch(c){var s=c.stack.trim().match(/\n( *(at )?)/);te=s&&s[1]||"",fe=-1)":-1p||_[h]!==$[p]){var ee=` +`+_[h].replace(" at new "," at ");return r.displayName&&ee.includes("")&&(ee=ee.replace("",r.displayName)),ee}while(1<=h&&0<=p);break}}}finally{Be=!1,Error.prepareStackTrace=c}return(c=r?r.displayName||r.name:"")?_e(c):""}function ue(r,s){switch(r.tag){case 26:case 27:case 5:return _e(r.type);case 16:return _e("Lazy");case 13:return r.child!==s&&s!==null?_e("Suspense Fallback"):_e("Suspense");case 19:return _e("SuspenseList");case 0:case 15:return bt(r.type,!1);case 11:return bt(r.type.render,!1);case 1:return bt(r.type,!0);case 31:return _e("Activity");case 30:return _e("ViewTransition");default:return""}}function ye(r){try{var s="",c=null;do s+=ue(r,c),c=r,r=r.return;while(r);return s}catch(h){return` +Error generating stack: `+h.message+` +`+h.stack}}var De=Object.prototype.hasOwnProperty,at=n.unstable_scheduleCallback,vt=n.unstable_cancelCallback,On=n.unstable_shouldYield,Nn=n.unstable_requestPaint,Et=n.unstable_now,Wt=n.unstable_getCurrentPriorityLevel,Gn=n.unstable_ImmediatePriority,In=n.unstable_UserBlockingPriority,gs=n.unstable_NormalPriority,Hu=n.unstable_LowPriority,xs=n.unstable_IdlePriority,ys=n.log,Fa=n.unstable_setDisableYieldValue,Wi=null,Kn=null;function ki(r){if(typeof ys=="function"&&Fa(r),Kn&&typeof Kn.setStrictMode=="function")try{Kn.setStrictMode(Wi,r)}catch{}}var fn=Math.clz32?Math.clz32:vm,ve=Math.log,bm=Math.LN2;function vm(r){return r>>>=0,r===0?32:31-(ve(r)/bm|0)|0}var Un=256,Pt=262144,Tn=4194304;function nn(r){var s=r&42;if(s!==0)return s;switch(r&-r){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return r&-r;case 262144:case 524288:case 1048576:case 2097152:return r&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return r&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return r}}function Mt(r,s,c){var h=r.pendingLanes;if(h===0)return 0;var p=0,x=r.suspendedLanes,k=r.pingedLanes;r=r.warmLanes;var O=h&134217727;return O!==0?(h=O&~x,h!==0?p=nn(h):(k&=O,k!==0?p=nn(k):c||(c=O&~r,c!==0&&(p=nn(c))))):(O=h&~x,O!==0?p=nn(O):k!==0?p=nn(k):c||(c=h&~r,c!==0&&(p=nn(c)))),p===0?0:s!==0&&s!==p&&(s&x)===0&&(x=p&-p,c=s&-s,x>=c||x===32&&(c&4194048)!==0)?s:p}function bs(r,s){return(r.pendingLanes&~(r.suspendedLanes&~r.pingedLanes)&s)===0}function qa(r,s){(s&8)!==0&&(s|=s&32);var c=r.entangledLanes;if(c!==0)for(r=r.entanglements,c&=s;0c;c++)s.push(r);return s}function pr(r,s){r.pendingLanes|=s,s!==268435456&&(r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0)}function wm(r,s,c,h,p,x){var k=r.pendingLanes;r.pendingLanes=c,r.suspendedLanes=0,r.pingedLanes=0,r.warmLanes=0,r.expiredLanes&=c,r.entangledLanes&=c,r.errorRecoveryDisabledLanes&=c,r.shellSuspendCounter=0;var O=r.entanglements,_=r.expirationTimes,$=r.hiddenUpdates;for(c=k&~c;0"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),Em=!1;if($r)try{var Ka={};Object.defineProperty(Ka,"passive",{get:function(){Em=!0}}),window.addEventListener("test",Ka,Ka),window.removeEventListener("test",Ka,Ka)}catch{Em=!1}var wl=null,Mm=null,Wu=null;function Rb(){if(Wu)return Wu;var r,s=Mm,c=s.length,h,p="value"in wl?wl.value:wl.textContent,x=p.length;for(r=0;r=Ja),Pb=" ",Hb=!1;function Ib(r,s){switch(r){case"keyup":return i5.indexOf(s.keyCode)!==-1;case"keydown":return s.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ub(r){return r=r.detail,typeof r=="object"&&"data"in r?r.data:null}var Co=!1;function l5(r,s){switch(r){case"compositionend":return Ub(s);case"keypress":return s.which!==32?null:(Hb=!0,Pb);case"textInput":return r=s.data,r===Pb&&Hb?null:r;default:return null}}function s5(r,s){if(Co)return r==="compositionend"||!Lm&&Ib(r,s)?(r=Rb(),Wu=Mm=wl=null,Co=!1,r):null;switch(r){case"paste":return null;case"keypress":if(!(s.ctrlKey||s.altKey||s.metaKey)||s.ctrlKey&&s.altKey){if(s.char&&1"u")return null;try{return r.activeElement||r.body}catch{return r.body}}function Gb(r){for(;r&&r.firstChild;)r=r.firstChild;return r}function Kb(r,s){var c=Gb(r);r=0;for(var h;c;){if(c.nodeType===3){if(h=r+c.textContent.length,r<=s&&h>=s)return{node:c,offset:s-r};r=h}e:{for(;c;){if(c.nextSibling){c=c.nextSibling;break e}c=c.parentNode}c=void 0}c=Gb(c)}}function Wb(r,s){return r&&s?r===s?!0:r&&r.nodeType===3?!1:s&&s.nodeType===3?Wb(r,s.parentNode):"contains"in r?r.contains(s):r.compareDocumentPosition?!!(r.compareDocumentPosition(s)&16):!1:!1}function Zb(r){r=r!=null&&r.ownerDocument!=null&&r.ownerDocument.defaultView!=null?r.ownerDocument.defaultView:window;for(var s=Pm(r.document);s instanceof r.HTMLIFrameElement;){try{var c=typeof s.contentWindow.location.href=="string"}catch{c=!1}if(c)r=s.contentWindow;else break;s=Pm(r.document)}return s}function Hm(r){var s=r&&r.nodeName&&r.nodeName.toLowerCase();return s&&(s==="input"&&(r.type==="text"||r.type==="search"||r.type==="tel"||r.type==="url"||r.type==="password")||s==="textarea"||r.contentEditable==="true")}var m5=$r&&"documentMode"in document&&11>=document.documentMode,Oo=null,Im=null,ic=null,Um=!1;function Jb(r,s,c){var h=c.window===c?c.document:c.nodeType===9?c:c.ownerDocument;Um||Oo==null||Oo!==Pm(h)||(h=Oo,"selectionStart"in h&&Hm(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),ic&&nc(ic,h)||(ic=h,h=ih(Im,"onSelect"),0>=k,p-=k,gr=1<<32-fn(s)+p|c<Ue?(an=Pe,Pe=null):an=Pe.sibling;var ft=V(X,Pe,Y[Ue],se);if(ft===null){Pe===null&&(Pe=an);break}r&&Pe&&ft.alternate===null&&s(X,Pe),q=x(ft,q,Ue),ot===null?Me=ft:ot.sibling=ft,ot=ft,Pe=an}if(Ue===Y.length)return c(X,Pe),Ze&&Wr(X,Ue),Me;if(Pe===null){for(;UeUe?(an=Pe,Pe=null):an=Pe.sibling;var Xl=V(X,Pe,ft.value,se);if(Xl===null){Pe===null&&(Pe=an);break}r&&Pe&&Xl.alternate===null&&s(X,Pe),q=x(Xl,q,Ue),ot===null?Me=Xl:ot.sibling=Xl,ot=Xl,Pe=an}if(ft.done)return c(X,Pe),Ze&&Wr(X,Ue),Me;if(Pe===null){for(;!ft.done;Ue++,ft=Y.next())ft=ae(X,ft.value,se),ft!==null&&(q=x(ft,q,Ue),ot===null?Me=ft:ot.sibling=ft,ot=ft);return Ze&&Wr(X,Ue),Me}for(Pe=h(Pe);!ft.done;Ue++,ft=Y.next())ft=J(Pe,X,Ue,ft.value,se),ft!==null&&(r&&(an=ft.alternate,an!==null&&Pe.delete(an.key===null?Ue:an.key)),q=x(ft,q,Ue),ot===null?Me=ft:ot.sibling=ft,ot=ft);return r&&Pe.forEach(function(lM){return s(X,lM)}),Ze&&Wr(X,Ue),Me}function Ge(X,q,Y,se){if(typeof Y=="object"&&Y!==null&&Y.type===W&&Y.key===null&&Y.props.ref===void 0&&(Y=Y.props.children),typeof Y=="object"&&Y!==null){switch(Y.$$typeof){case ne:e:{for(var Me=Y.key;q!==null;){if(q.key===Me){if(Me=Y.type,Me===W){if(q.tag===7){c(X,q.sibling),se=p(q,Y.props.children),Tl(se,Y),se.return=X,X=se;break e}}else if(q.elementType===Me||typeof Me=="object"&&Me!==null&&Me.$$typeof===T&&zs(Me)===q.type){c(X,q.sibling),se=p(q,Y.props),Tl(se,Y),se.return=X,X=se;break e}c(X,q);break}else s(X,q);q=q.sibling}Y.type===W?(se=Es(Y.props.children,X.mode,se,Y.key),Tl(se,Y),se.return=X,X=se):(se=af(Y.type,Y.key,Y.props,null,X.mode,se),Tl(se,Y),se.return=X,X=se)}return k(X);case F:e:{for(Me=Y.key;q!==null;){if(q.key===Me)if(q.tag===4&&q.stateNode.containerInfo===Y.containerInfo&&q.stateNode.implementation===Y.implementation){c(X,q.sibling),se=p(q,Y.children||[]),se.return=X,X=se;break e}else{c(X,q);break}else s(X,q);q=q.sibling}se=Ym(Y,X.mode,se),se.return=X,X=se}return k(X);case T:return Y=zs(Y),Ge(X,q,Y,se)}if(He(Y))return we(X,q,Y,se);if(ge(Y)){if(Me=ge(Y),typeof Me!="function")throw Error(i(150));return Y=Me.call(Y),Re(X,q,Y,se)}if(typeof Y.then=="function")return Ge(X,q,yf(Y),se);if(Y.$$typeof===ce)return Ge(X,q,mf(X,Y),se);bf(X,Y)}return typeof Y=="string"&&Y!==""||typeof Y=="number"||typeof Y=="bigint"?(Y=""+Y,q!==null&&q.tag===6?(c(X,q.sibling),se=p(q,Y),se.return=X,X=se):(c(X,q),se=$m(Y,X.mode,se),se.return=X,X=se),k(X)):c(X,q)}return function(X,q,Y,se){try{cc=0;var Me=Ge(X,q,Y,se);return _o=null,Me}catch(Pe){if(Pe===jo||Pe===gf)throw Pe;var ot=ai(29,Pe,null,X.mode);return ot.lanes=se,ot.return=X,ot}finally{}}}var Ps=S1(!0),C1=S1(!1),Al=!1;function rp(r){r.updateQueue={baseState:r.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function lp(r,s){r=r.updateQueue,s.updateQueue===r&&(s.updateQueue={baseState:r.baseState,firstBaseUpdate:r.firstBaseUpdate,lastBaseUpdate:r.lastBaseUpdate,shared:r.shared,callbacks:null})}function El(r){return{lane:r,tag:0,payload:null,callback:null,next:null}}function Ml(r,s,c){var h=r.updateQueue;if(h===null)return null;if(h=h.shared,(yt&2)!==0){var p=h.pending;return p===null?s.next=s:(s.next=p.next,p.next=s),h.pending=s,s=of(r),o1(r,null,c),s}return sf(r,h,s,c),of(r)}function uc(r,s,c){if(s=s.updateQueue,s!==null&&(s=s.shared,(c&4194048)!==0)){var h=s.lanes;h&=r.pendingLanes,c|=h,s.lanes=c,go(r,c)}}function sp(r,s){var c=r.updateQueue,h=r.alternate;if(h!==null&&(h=h.updateQueue,c===h)){var p=null,x=null;if(c=c.firstBaseUpdate,c!==null){do{var k={lane:c.lane,tag:c.tag,payload:c.payload,callback:null,next:null};x===null?p=x=k:x=x.next=k,c=c.next}while(c!==null);x===null?p=x=s:x=x.next=s}else p=x=s;c={baseState:h.baseState,firstBaseUpdate:p,lastBaseUpdate:x,shared:h.shared,callbacks:h.callbacks},r.updateQueue=c;return}r=c.lastBaseUpdate,r===null?c.firstBaseUpdate=s:r.next=s,c.lastBaseUpdate=s}var op=!1;function fc(){if(op){var r=Ro;if(r!==null)throw r}}function hc(r,s,c,h){op=!1;var p=r.updateQueue;Al=!1;var x=p.firstBaseUpdate,k=p.lastBaseUpdate,O=p.shared.pending;if(O!==null){p.shared.pending=null;var _=O,$=_.next;_.next=null,k===null?x=$:k.next=$,k=_;var ee=r.alternate;ee!==null&&(ee=ee.updateQueue,O=ee.lastBaseUpdate,O!==k&&(O===null?ee.firstBaseUpdate=$:O.next=$,ee.lastBaseUpdate=_))}if(x!==null){var ae=p.baseState;k=0,ee=$=_=null,O=x;do{var V=O.lane&-536870913,J=V!==O.lane;if(J?(st&V)===V:(h&V)===V){V!==0&&V===_s&&(op=!0),ee!==null&&(ee=ee.next={lane:0,tag:O.tag,payload:O.payload,callback:null,next:null});e:{var we=r,Re=O;V=s;var Ge=c;switch(Re.tag){case 1:if(we=Re.payload,typeof we=="function"){ae=we.call(Ge,ae,V);break e}ae=we;break e;case 3:we.flags=we.flags&-65537|128;case 0:if(we=Re.payload,V=typeof we=="function"?we.call(Ge,ae,V):we,V==null)break e;ae=A({},ae,V);break e;case 2:Al=!0}}V=O.callback,V!==null&&(r.flags|=64,J&&(r.flags|=8192),J=p.callbacks,J===null?p.callbacks=[V]:J.push(V))}else J={lane:V,tag:O.tag,payload:O.payload,callback:O.callback,next:null},ee===null?($=ee=J,_=ae):ee=ee.next=J,k|=V;if(O=O.next,O===null){if(O=p.shared.pending,O===null)break;J=O,O=J.next,J.next=null,p.lastBaseUpdate=J,p.shared.pending=null}}while(!0);ee===null&&(_=ae),p.baseState=_,p.firstBaseUpdate=$,p.lastBaseUpdate=ee,x===null&&(p.shared.lanes=0),Bl|=k,r.lanes=k,r.memoizedState=ae}}function O1(r,s){if(typeof r!="function")throw Error(i(191,r));r.call(s)}function N1(r,s){var c=r.callbacks;if(c!==null)for(r.callbacks=null,r=0;rx?x:8;var k=ke.T,O={};O.types=k!==null?k.types:null,ke.T=O,Tp(r,!1,s,c);try{var _=p(),$=ke.S;if($!==null&&$(O,_),_!==null&&typeof _=="object"&&typeof _.then=="function"){var ee=O5(_,h);gc(r,s,ee,Ai(r))}else gc(r,s,h,Ai(r))}catch(ae){gc(r,s,{then:function(){},status:"rejected",reason:ae},Ai())}finally{Ae.p=x,k!==null&&O.types!==null&&(k.types=O.types),ke.T=k}}function D5(){}function Op(r,s,c,h){if(r.tag!==5)throw Error(i(476));var p=rv(r).queue;iv(r,p,s,Qt,c===null?D5:function(){return lv(r),c(h)})}function rv(r){var s=r.memoizedState;if(s!==null)return s;s={memoizedState:Qt,baseState:Qt,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tl,lastRenderedState:Qt},next:null};var c={};return s.next={memoizedState:c,baseState:c,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:tl,lastRenderedState:c},next:null},r.memoizedState=s,r=r.alternate,r!==null&&(r.memoizedState=s),s}function lv(r){var s=rv(r);s.next===null&&(s=r.alternate.memoizedState),gc(r,s.next.queue,{},Ai())}function Np(){return An(na)}function sv(){return Zt().memoizedState}function ov(){return Zt().memoizedState}function R5(r){for(var s=r.return;s!==null;){switch(s.tag){case 24:case 3:var c=Ai();r=El(c);var h=Ml(s,r,c);h!==null&&(hi(h,s,c),uc(h,s,c)),s={cache:ep()},r.payload=s;return}s=s.return}}function j5(r,s,c){var h=Ai();c={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null},Ef(r)?cv(s,c):(c=Qm(r,s,c,h),c!==null&&(hi(c,r,h),uv(c,s,h)))}function av(r,s,c){var h=Ai();gc(r,s,c,h)}function gc(r,s,c,h){var p={lane:h,revertLane:0,gesture:null,action:c,hasEagerState:!1,eagerState:null,next:null};if(Ef(r))cv(s,p);else{var x=r.alternate;if(r.lanes===0&&(x===null||x.lanes===0)&&(x=s.lastRenderedReducer,x!==null))try{var k=s.lastRenderedState,O=x(k,c);if(p.hasEagerState=!0,p.eagerState=O,Si(O,k))return sf(r,s,p,0),Dt===null&&lf(),!1}catch{}finally{}if(c=Qm(r,s,p,h),c!==null)return hi(c,r,h),uv(c,s,h),!0}return!1}function Tp(r,s,c,h){if(h={lane:2,revertLane:xg(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},Ef(r)){if(s)throw Error(i(479))}else s=Qm(r,c,h,2),s!==null&&hi(s,r,2)}function Ef(r){var s=r.alternate;return r===Ye||s!==null&&s===Ye}function cv(r,s){Lo=kf=!0;var c=r.pending;c===null?s.next=s:(s.next=c.next,c.next=s),r.pending=s}function uv(r,s,c){if((c&4194048)!==0){var h=s.lanes;h&=r.pendingLanes,c|=h,s.lanes=c,go(r,c)}}var Mf={readContext:An,use:Of,useCallback:Xt,useContext:Xt,useEffect:Xt,useImperativeHandle:Xt,useLayoutEffect:Xt,useInsertionEffect:Xt,useMemo:Xt,useReducer:Xt,useRef:Xt,useState:Xt,useDebugValue:Xt,useDeferredValue:Xt,useTransition:Xt,useSyncExternalStore:Xt,useId:Xt,useHostTransitionStatus:Xt,useFormState:Xt,useActionState:Xt,useOptimistic:Xt,useMemoCache:Xt,useCacheRefresh:Xt,useEffectEvent:Xt},fv={readContext:An,use:Of,useCallback:function(r,s){return Jn().memoizedState=[r,s===void 0?null:s],r},useContext:An,useEffect:Y1,useImperativeHandle:function(r,s,c){c=c!=null?c.concat([r]):null,Tf(4194308,4,Z1.bind(null,s,r),c)},useLayoutEffect:function(r,s){return Tf(4194308,4,r,s)},useInsertionEffect:function(r,s){Tf(4,2,r,s)},useMemo:function(r,s){var c=Jn();s=s===void 0?null:s;var h=r();if(Hs){ki(!0);try{r()}finally{ki(!1)}}return c.memoizedState=[h,s],h},useReducer:function(r,s,c){var h=Jn();if(c!==void 0){var p=c(s);if(Hs){ki(!0);try{c(s)}finally{ki(!1)}}}else p=s;return h.memoizedState=h.baseState=p,r={pending:null,lanes:0,dispatch:null,lastRenderedReducer:r,lastRenderedState:p},h.queue=r,r=r.dispatch=j5.bind(null,Ye,r),[h.memoizedState,r]},useRef:function(r){var s=Jn();return r={current:r},s.memoizedState=r},useState:function(r){r=vp(r);var s=r.queue,c=av.bind(null,Ye,s);return s.dispatch=c,[r.memoizedState,c]},useDebugValue:Sp,useDeferredValue:function(r,s){var c=Jn();return Cp(c,r,s)},useTransition:function(){var r=vp(!1);return r=iv.bind(null,Ye,r.queue,!0,!1),Jn().memoizedState=r,[!1,r]},useSyncExternalStore:function(r,s,c){var h=Ye,p=Jn();if(Ze){if(c===void 0)throw Error(i(407));c=c()}else{if(c=s(),Dt===null)throw Error(i(349));(st&127)!==0||R1(h,s,c)}p.memoizedState=c;var x={value:c,getSnapshot:s};return p.queue=x,Y1(_1.bind(null,h,x,r),[r]),h.flags|=2048,Bo(9,{destroy:void 0},j1.bind(null,h,x,c,s),null),c},useId:function(){var r=Jn(),s=Dt.identifierPrefix;if(Ze){var c=xr,h=gr;c=(h&~(1<<32-fn(h)-1)).toString(32)+c,s="_"+s+"R_"+c,c=Sf++,0<\/script>",x=x.removeChild(x.firstChild);break;case"select":x=typeof h.is=="string"?k.createElement("select",{is:h.is}):k.createElement("select"),h.multiple?x.multiple=!0:h.size&&(x.size=h.size);break;default:x=typeof h.is=="string"?k.createElement(p,{is:h.is}):k.createElement(p)}}x[hn]=s,x[Fn]=h;e:for(k=s.child;k!==null;){if(k.tag===5||k.tag===6)x.appendChild(k.stateNode);else if(k.tag!==4&&k.tag!==27&&k.child!==null){k.child.return=k,k=k.child;continue}if(k===s)break e;for(;k.sibling===null;){if(k.return===null||k.return===s)break e;k=k.return}k.sibling.return=k.return,k=k.sibling}s.stateNode=x;e:switch(Rn(x,p,h),p){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&il(s)}}return zt(s),s.subtreeFlags&=-33554433,Ip(s,s.type,r===null?null:r.memoizedProps,s.pendingProps,c),null;case 6:if(r&&s.stateNode!=null)r.memoizedProps!==h&&il(s);else{if(typeof h!="string"&&s.stateNode===null)throw Error(i(166));if(r=qt.current,Do(s)){if(r=s.stateNode,c=s.memoizedProps,h=null,p=bn,p!==null)switch(p.tag){case 27:case 5:h=p.memoizedProps}r[hn]=s,r=!!(r.nodeValue===c||h!==null&&h.suppressHydrationWarning===!0||_w(r.nodeValue,c)),r||Ol(s,!0)}else r=Ec(r).createTextNode(h),r[hn]=s,s.stateNode=r}return zt(s),null;case 31:if(c=s.memoizedState,r===null||r.memoizedState!==null){if(h=Do(s),c!==null){if(r===null){if(!h)throw Error(i(318));if(r=s.memoizedState,r=r!==null?r.dehydrated:null,!r)throw Error(i(557));r[hn]=s}else Ms(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;zt(s),r=!1}else c=Wm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=c),r=!0;if(!r)return s.flags&256?(Ci(s),s):(Ci(s),null);if((s.flags&128)!==0)throw Error(i(558))}return zt(s),null;case 13:if(h=s.memoizedState,r===null||r.memoizedState!==null&&r.memoizedState.dehydrated!==null){if(p=Do(s),h!==null&&h.dehydrated!==null){if(r===null){if(!p)throw Error(i(318));if(p=s.memoizedState,p=p!==null?p.dehydrated:null,!p)throw Error(i(317));p[hn]=s}else Ms(),(s.flags&128)===0&&(s.memoizedState=null),s.flags|=4;zt(s),p=!1}else p=Wm(),r!==null&&r.memoizedState!==null&&(r.memoizedState.hydrationErrors=p),p=!0;if(!p)return s.flags&256?(Ci(s),s):(Ci(s),null)}return Ci(s),(s.flags&128)!==0?(s.lanes=c,s):(c=h!==null,r=r!==null&&r.memoizedState!==null,c&&(h=s.child,p=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(p=h.alternate.memoizedState.cachePool.pool),x=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(x=h.memoizedState.cachePool.pool),x!==p&&(h.flags|=2048)),c!==r&&c&&(s.child.flags|=8192),zf(s,s.updateQueue),zt(s),null);case 4:return qe(),r===null&&wg(s.stateNode.containerInfo),s.flags|=67108864,zt(s),null;case 10:return Jr(s.type),zt(s),null;case 19:if(fp(s),h=s.memoizedState,h===null)return zt(s),null;if(p=(s.flags&128)!==0,x=h.rendering,x===null)if(p)yc(h,!1);else{if($t!==0||r!==null&&(r.flags&128)!==0)for(r=s.child;r!==null;){if(x=wf(r),x!==null){for(s.flags|=128,yc(h,!1),r=x.updateQueue,s.updateQueue=r,zf(s,r),s.subtreeFlags=0,r=c,c=s.child;c!==null;)a1(c,r),c=c.sibling;return dc(s,Mn.current&1|2),Ze&&Wr(s,h.treeForkCount),s.child}r=r.sibling}h.tail!==null&&Et()>Yf&&(s.flags|=128,p=!0,yc(h,!1),s.lanes=4194304)}else{if(!p)if(r=wf(x),r!==null){if(s.flags|=128,p=!0,r=r.updateQueue,s.updateQueue=r,zf(s,r),yc(h,!0),h.tail===null&&h.tailMode!=="collapsed"&&h.tailMode!=="visible"&&!x.alternate&&!Ze)return zt(s),null}else 2*Et()-h.renderingStartTime>Yf&&c!==536870912&&(s.flags|=128,p=!0,yc(h,!1),s.lanes=4194304);h.isBackwards?(x.sibling=s.child,s.child=x):(r=h.last,r!==null?r.sibling=x:s.child=x,h.last=x)}if(h.tail!==null){r=h.tail;e:{for(c=r;c!==null;){if(c.alternate!==null){c=!1;break e}c=c.sibling}c=!0}return h.rendering=r,h.tail=r.sibling,h.renderingStartTime=Et(),r.sibling=null,x=Mn.current,x=p?x&1|2:x&1,h.tailMode==="visible"||h.tailMode==="collapsed"||!c||Ze?dc(s,x):(c=x,lt(En,s),lt(Mn,c),qn===null&&(qn=s)),Ze&&Wr(s,h.treeForkCount),r}return zt(s),null;case 22:case 23:return Ci(s),cp(),h=s.memoizedState!==null,r!==null?r.memoizedState!==null!==h&&(s.flags|=8192):h&&(s.flags|=8192),h?(c&536870912)!==0&&(s.flags&128)===0&&(zt(s),s.subtreeFlags&6&&(s.flags|=8192)):zt(s),c=s.updateQueue,c!==null&&zf(s,c.retryQueue),c=null,r!==null&&r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(c=r.memoizedState.cachePool.pool),h=null,s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(h=s.memoizedState.cachePool.pool),h!==c&&(s.flags|=2048),r!==null&&Ot(Ls),null;case 24:return c=null,r!==null&&(c=r.memoizedState.cache),s.memoizedState.cache!==c&&(s.flags|=2048),Jr(ln),zt(s),null;case 25:return null;case 30:return s.flags|=33554432,zt(s),null}throw Error(i(156,s.tag))}function I5(r,s){switch(Gm(s),s.tag){case 1:return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 3:return Jr(ln),qe(),r=s.flags,(r&65536)!==0&&(r&128)===0?(s.flags=r&-65537|128,s):null;case 26:case 27:case 5:return ht(s),null;case 31:if(s.memoizedState!==null){if(Ci(s),s.alternate===null)throw Error(i(340));Ms()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 13:if(Ci(s),r=s.memoizedState,r!==null&&r.dehydrated!==null){if(s.alternate===null)throw Error(i(340));Ms()}return r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 19:return fp(s),r=s.flags,r&65536?(s.flags=r&-65537|128,r=s.memoizedState,r!==null&&(r.rendering=null,r.tail=null),s.flags|=4,s):null;case 4:return qe(),null;case 10:return Jr(s.type),null;case 22:case 23:return Ci(s),cp(),r!==null&&Ot(Ls),r=s.flags,r&65536?(s.flags=r&-65537|128,s):null;case 24:return Jr(ln),null;case 25:return null;default:return null}}function zv(r,s){switch(Gm(s),s.tag){case 3:Jr(ln),qe();break;case 26:case 27:case 5:ht(s);break;case 4:qe();break;case 31:s.memoizedState!==null&&Ci(s);break;case 13:Ci(s);break;case 19:fp(s);break;case 10:Jr(s.type);break;case 22:case 23:Ci(s),cp(),r!==null&&Ot(Ls);break;case 24:Jr(ln)}}function bc(r,s){try{var c=s.updateQueue,h=c!==null?c.lastEffect:null;if(h!==null){var p=h.next;c=p;do{if((c.tag&r)===r){h=void 0;var x=c.create,k=c.inst;h=x(),k.destroy=h}c=c.next}while(c!==p)}}catch(O){St(s,s.return,O)}}function _l(r,s,c){try{var h=s.updateQueue,p=h!==null?h.lastEffect:null;if(p!==null){var x=p.next;h=x;do{if((h.tag&r)===r){var k=h.inst,O=k.destroy;if(O!==void 0){k.destroy=void 0,p=s;var _=c,$=O;try{$()}catch(ee){St(p,_,ee)}}}h=h.next}while(h!==x)}}catch(ee){St(s,s.return,ee)}}function Bv(r){var s=r.updateQueue;if(s!==null){var c=r.stateNode;try{N1(s,c)}catch(h){St(r,r.return,h)}}}function Pv(r,s,c){c.props=Is(r.type,r.memoizedProps),c.state=r.memoizedState;try{c.componentWillUnmount()}catch(h){St(r,s,h)}}function yr(r,s){try{var c=r.ref;if(c!==null){switch(r.tag){case 26:case 27:case 5:var h=r.stateNode;break;case 30:var p=r.stateNode,x=Yr(r.memoizedProps,p);(p.ref===null||p.ref.name!==x)&&(p.ref=Qw(x)),h=p.ref;break;case 7:if(r.stateNode===null){var k=new Ei(r);g(r.child,!1,M3,k,void 0,void 0),r.stateNode=k}h=r.stateNode;break;default:h=r.stateNode}typeof c=="function"?r.refCleanup=c(h):c.current=h}}catch(O){St(r,s,O)}}function Dn(r,s){var c=r.ref,h=r.refCleanup;if(c!==null)if(typeof h=="function")try{h()}catch(p){St(r,s,p)}finally{r.refCleanup=null,r=r.alternate,r!=null&&(r.refCleanup=null)}else if(typeof c=="function")try{c(null)}catch(p){St(r,s,p)}else c.current=null}function Bf(r,s){if((r.tag===5||r.tag===27||r.tag===6)&&r.alternate===null&&s!==null)for(var c=0;c title"))),Rn(h,s,c),h[hn]=r,rn(h),s=h;break e;case"link":if(x=ak("link","href",p).get(s+(c.href||""))){for(k=0;kGe&&(k=Ge,Ge=Re,Re=k);var X=Kb(O,Re),q=Kb(O,Ge);if(X&&q&&(J.rangeCount!==1||J.anchorNode!==X.node||J.anchorOffset!==X.offset||J.focusNode!==q.node||J.focusOffset!==q.offset)){var Y=ae.createRange();Y.setStart(X.node,X.offset),J.removeAllRanges(),Re>Ge?(J.addRange(Y),J.extend(q.node,q.offset)):(Y.setEnd(q.node,q.offset),J.addRange(Y))}}}}for(ae=[],J=O;J=J.parentNode;)J.nodeType===1&&ae.push({element:J,left:J.scrollLeft,top:J.scrollTop});for(typeof O.focus=="function"&&O.focus(),O=0;Oc?32:c,ke.T=null,c=og,og=null;var x=rr,k=Cr;if(Vt=0,Vs=rr=null,Cr=0,(yt&6)!==0)throw Error(i(331));var O=yt;if(yt|=4,ow(x.current),rw(x,x.current,k,c),yt=O,Nc(0,!1),Kn&&typeof Kn.onPostCommitFiberRoot=="function")try{Kn.onPostCommitFiberRoot(Wi,x)}catch{}return!0}finally{Ae.p=p,ke.T=h,kw(r,s)}}function Sw(r,s,c){s=Pi(c,s),s=Mp(r.stateNode,s,2),r=Ml(r,s,2),r!==null&&(pr(r,2),Or(r))}function St(r,s,c){if(r.tag===3)Sw(r,r,c);else for(;s!==null;){if(s.tag===3){Sw(s,r,c);break}else if(s.tag===1){var h=s.stateNode;if(typeof s.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Pl===null||!Pl.has(h))){r=Pi(c,r),c=bv(2),h=Ml(s,c,2),h!==null&&(vv(c,h,s,r),pr(h,2),Or(h));break}}s=s.return}}function mg(r,s,c){var h=r.pingCache;if(h===null){h=r.pingCache=new V5;var p=new Set;h.set(s,p)}else p=h.get(s),p===void 0&&(p=new Set,h.set(s,p));p.has(c)||(rg=!0,p.add(c),r=Z5.bind(null,r,s,c),s.then(r,r))}function Z5(r,s,c){var h=r.pingCache;h!==null&&h.delete(s),r.pingedLanes|=r.suspendedLanes&c,r.warmLanes&=~c,Dt===r&&(st&c)===c&&(($t===4||$t===3&&(st&62914560)===st&&300>Et()-$f)&&(yt&2)===0?Yo(r,0):Xf|=c,qo===st&&(qo=0)),Or(r)}function Cw(r,s){s===0&&(s=Iu()),r=As(r,s),r!==null&&(pr(r,s),Or(r))}function J5(r){var s=r.memoizedState,c=0;s!==null&&(c=s.retryLane),Cw(r,c)}function e3(r,s){var c=0;switch(r.tag){case 31:case 13:var h=r.stateNode,p=r.memoizedState;p!==null&&(c=p.retryLane);break;case 19:h=r.stateNode;break;case 22:h=r.stateNode._retryCache;break;default:throw Error(i(314))}h!==null&&h.delete(s),Cw(r,c)}function t3(r,s){return at(r,s)}var Ko=null,Wo=null,pg=!1,th=!1,gg=!1,Il=0;function Or(r){r!==Wo&&r.next===null&&(Wo===null?Ko=Wo=r:Wo=Wo.next=r),th=!0,pg||(pg=!0,i3())}function Nc(r,s){if(!gg&&th){gg=!0;do for(var c=!1,h=Ko;h!==null;){if(r!==0){var p=h.pendingLanes;if(p===0)var x=0;else{var k=h.suspendedLanes,O=h.pingedLanes;x=(1<<31-fn(42|r)+1)-1,x&=p&~(k&~O),x=x&201326741?x&201326741|1:x?x|2:0}x!==0&&(c=!0,Aw(h,x))}else x=st,x=Mt(h,h===Dt?x:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(x&3)===0||bs(h,x)||(c=!0,Aw(h,x));h=h.next}while(c);gg=!1}}function n3(){Ow()}function Ow(){th=pg=!1;var r=0;Il!==0&&m3()&&(r=Il);for(var s=Et(),c=null,h=Ko;h!==null;){var p=h.next,x=Nw(h,s);x===0?(h.next=null,c===null?Ko=p:c.next=p,p===null&&(Wo=c)):(c=h,(r!==0||(x&3)!==0)&&(th=!0)),h=p}Vt!==0&&Vt!==5||Nc(r),Il!==0&&(Il=0)}function Nw(r,s){for(var c=r.suspendedLanes,h=r.pingedLanes,p=r.expirationTimes,x=r.pendingLanes&-62914561;0O)break;var ee=_.transferSize,ae=_.initiatorType;ee&&Lw(ae)&&(_=_.responseEnd,k+=ee*(_sh){Re.length=we;break}Y=new Promise(v3.bind(Y)),Re.push(Y)}}}if(0"u"?null:document;function rk(r,s,c){var h=Jo;if(h&&typeof s=="string"&&s){var p=oi(s);p='link[rel="'+r+'"][href="'+p+'"]',typeof c=="string"&&(p+='[crossorigin="'+c+'"]'),ik.has(p)||(ik.add(p),r={rel:r,crossOrigin:c,href:s},h.querySelector(p)===null&&(s=h.createElement("link"),Rn(s,"link",r),rn(s),h.head.appendChild(s)))}}function H3(r){ll.D(r),rk("dns-prefetch",r,null)}function I3(r,s){ll.C(r,s),rk("preconnect",r,s)}function U3(r,s,c){ll.L(r,s,c);var h=Jo;if(h&&r&&s){var p='link[rel="preload"][as="'+oi(s)+'"]';s==="image"&&c&&c.imageSrcSet?(p+='[imagesrcset="'+oi(c.imageSrcSet)+'"]',typeof c.imageSizes=="string"&&(p+='[imagesizes="'+oi(c.imageSizes)+'"]')):p+='[href="'+oi(r)+'"]';var x=p;switch(s){case"style":x=ea(r);break;case"script":x=ta(r)}if(!(Vi.has(x)||(r=A({rel:"preload",href:s==="image"&&c&&c.imageSrcSet?void 0:r,as:s},c),Vi.set(x,r),h.querySelector(p)!==null||s==="style"&&h.querySelector(Dc(x))||s==="script"&&h.querySelector(Rc(x))))){var k=h.createElement("link");Rn(k,"link",r),s==="style"&&(k[yo]=!0,k.onload=k.onerror=function(){qu(k)}),rn(k),h.head.appendChild(k)}}}function F3(r,s){ll.m(r,s);var c=Jo;if(c&&r){var h=s&&typeof s.as=="string"?s.as:"script",p='link[rel="modulepreload"][as="'+oi(h)+'"][href="'+oi(r)+'"]',x=p;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":x=ta(r)}if(!Vi.has(x)&&(r=A({rel:"modulepreload",href:r},s),Vi.set(x,r),c.querySelector(p)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(c.querySelector(Rc(x)))return}h=c.createElement("link"),Rn(h,"link",r),rn(h),c.head.appendChild(h)}}}function q3(r,s,c){ll.S(r,s,c);var h=Jo;if(h&&r){var p=bl(h).hoistableStyles,x=ea(r);s=s||"default";var k=p.get(x);if(!k){var O={loading:0,preload:null};if(k=h.querySelector(Dc(x)))O.loading=5;else{r=A({rel:"stylesheet",href:r,"data-precedence":s},c),(c=Vi.get(x))&&Bg(r,c);var _=k=h.createElement("link");rn(_),Rn(_,"link",r),_._p=new Promise(function($,ee){_.onload=$,_.onerror=ee}),_.addEventListener("load",function(){O.loading|=1}),_.addEventListener("error",function(){O.loading|=2}),O.loading|=4,rh(k,s,h)}k={type:"stylesheet",instance:k,count:1,state:O},p.set(x,k)}}}function V3(r,s){ll.X(r,s);var c=Jo;if(c&&r){var h=bl(c).hoistableScripts,p=ta(r),x=h.get(p);x||(x=c.querySelector(Rc(p)),x||(r=A({src:r,async:!0},s),(s=Vi.get(p))&&Pg(r,s),x=c.createElement("script"),rn(x),Rn(x,"link",r),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},h.set(p,x))}}function Q3(r,s){ll.M(r,s);var c=Jo;if(c&&r){var h=bl(c).hoistableScripts,p=ta(r),x=h.get(p);x||(x=c.querySelector(Rc(p)),x||(r=A({src:r,async:!0,type:"module"},s),(s=Vi.get(p))&&Pg(r,s),x=c.createElement("script"),rn(x),Rn(x,"link",r),c.head.appendChild(x)),x={type:"script",instance:x,count:1,state:null},h.set(p,x))}}function lk(r,s,c,h){var p=(p=qt.current)?Mc(p):null;if(!p)throw Error(i(446));switch(r){case"meta":case"title":return null;case"style":return typeof c.precedence=="string"&&typeof c.href=="string"?(c=ea(c.href),s=bl(p).hoistableStyles,h=s.get(c),h||(h={type:"style",instance:null,count:0,state:null},s.set(c,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(c.rel==="stylesheet"&&typeof c.href=="string"&&typeof c.precedence=="string"){r=ea(c.href);var x=bl(p).hoistableStyles,k=x.get(r);if(k||(p=p.ownerDocument||p,k={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},x.set(r,k),(x=p.querySelector(Dc(r)))?x._p||(k.instance=x,k.state.loading=5):(x=Vi.get(r),x||(x={rel:"preload",as:"style",href:c.href,crossOrigin:c.crossOrigin,integrity:c.integrity,media:c.media,hrefLang:c.hrefLang,referrerPolicy:c.referrerPolicy},Vi.set(r,x)),X3(p,r,x,k.state))),s&&h===null)throw Error(i(528,""));return k}if(s&&h!==null)throw Error(i(529,""));return null;case"script":return s=c.async,c=c.src,typeof c=="string"&&s&&typeof s!="function"&&typeof s!="symbol"?(c=ta(c),s=bl(p).hoistableScripts,h=s.get(c),h||(h={type:"script",instance:null,count:0,state:null},s.set(c,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,r))}}function ea(r){return'href="'+oi(r)+'"'}function Dc(r){return'link[rel="stylesheet"]['+r+"]"}function sk(r){return A({},r,{"data-precedence":r.precedence,precedence:null})}function X3(r,s,c,h){if(s=r.querySelector('link[rel="preload"][as="style"]['+s+"]")){if(s[yo]!==!0){h.loading=1;return}}else s=r.createElement("link"),s[yo]=!0,s.onload=s.onerror=qu.bind(null,s),Rn(s,"link",c),rn(s),r.head.appendChild(s);h.preload=s,s.addEventListener("load",function(){return h.loading|=1}),s.addEventListener("error",function(){return h.loading|=2})}function ta(r){return'[src="'+oi(r)+'"]'}function Rc(r){return"script[async]"+r}function ok(r,s,c){if(s.count++,s.instance===null)switch(s.type){case"style":var h=r.querySelector('style[data-href~="'+oi(c.href)+'"]');if(h)return s.instance=h,rn(h),h;var p=A({},c,{"data-href":c.href,"data-precedence":c.precedence,href:null,precedence:null});return h=(r.ownerDocument||r).createElement("style"),rn(h),Rn(h,"style",p),rh(h,c.precedence,r),s.instance=h;case"stylesheet":p=ea(c.href);var x=r.querySelector(Dc(p));if(x)return s.state.loading|=4,s.instance=x,rn(x),x;h=sk(c),(p=Vi.get(p))&&Bg(h,p),x=(r.ownerDocument||r).createElement("link"),rn(x);var k=x;return k._p=new Promise(function(O,_){k.onload=O,k.onerror=_}),Rn(x,"link",h),s.state.loading|=4,rh(x,c.precedence,r),s.instance=x;case"script":return x=ta(c.src),(p=r.querySelector(Rc(x)))?(s.instance=p,rn(p),p):(h=c,(p=Vi.get(x))&&(h=A({},c),Pg(h,p)),r=r.ownerDocument||r,p=r.createElement("script"),rn(p),Rn(p,"link",h),r.head.appendChild(p),s.instance=p);case"void":return null;default:throw Error(i(443,s.type))}else s.type==="stylesheet"&&(s.state.loading&4)===0&&(h=s.instance,s.state.loading|=4,rh(h,c.precedence,r));return s.instance}function rh(r,s,c){for(var h=c.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),p=h.length?h[h.length-1]:null,x=p,k=0;k title"):null)}function $3(r,s,c){if(c===1||s.itemProp!=null)return!1;switch(r){case"meta":case"title":return!0;case"style":if(typeof s.precedence!="string"||typeof s.href!="string"||s.href==="")break;return!0;case"link":if(typeof s.rel!="string"||typeof s.href!="string"||s.href===""||s.onLoad||s.onError)break;switch(s.rel){case"stylesheet":return r=s.disabled,typeof s.precedence=="string"&&r==null;default:return!0}case"script":if(s.async&&typeof s.async!="function"&&typeof s.async!="symbol"&&!s.onLoad&&!s.onError&&s.src&&typeof s.src=="string")return!0}return!1}function ck(r,s){return r==="img"&&s.src!=null&&s.src!==""&&s.onLoad==null&&s.loading!=="lazy"}function uk(r){return!(r.type==="stylesheet"&&(r.state.loading&3)===0)}function fk(r){return(r.width||100)*(r.height||100)*(typeof devicePixelRatio=="number"?devicePixelRatio:1)*.25}function hk(r,s){typeof s.decode=="function"&&(r.imgCount++,s.complete||(r.imgBytes+=fk(s),r.suspenseyImages.push(s)),r=K3.bind(r),s.decode().then(r,r))}function Y3(r,s,c,h){if(c.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(c.state.loading&4)===0){if(c.instance===null){var p=ea(h.href),x=s.querySelector(Dc(p));if(x){s=x._p,s!==null&&typeof s=="object"&&typeof s.then=="function"&&(r.count++,r=jc.bind(r),s.then(r,r)),c.state.loading|=4,c.instance=x,rn(x);return}x=s.ownerDocument||s,h=sk(h),(p=Vi.get(p))&&Bg(h,p),x=x.createElement("link"),rn(x);var k=x;k._p=new Promise(function(O,_){k.onload=O,k.onerror=_}),Rn(x,"link",h),c.instance=x}r.stylesheets===null&&(r.stylesheets=new Map),r.stylesheets.set(c,s),(s=c.state.preload)&&(c.state.loading&3)===0&&(r.count++,c=jc.bind(r),s.addEventListener("load",c),s.addEventListener("error",c))}}var sh=0;function G3(r,s){return r.stylesheets&&r.count===0&&ah(r,r.stylesheets),0sh?50:800)+s);return r.unsuspend=c,function(){r.unsuspend=null,clearTimeout(h),clearTimeout(p)}}:null}function dk(r){if(r.count===0&&(r.imgCount===0||!r.waitingForImages)){if(r.stylesheets)ah(r,r.stylesheets);else if(r.unsuspend){var s=r.unsuspend;r.unsuspend=null,s()}}}function jc(){this.count--,dk(this)}function K3(){this.imgCount--,dk(this)}var oh=null;function ah(r,s){r.stylesheets=null,r.unsuspend!==null&&(r.count++,oh=new Map,s.forEach(W3,r),oh=null,jc.call(r))}function W3(r,s){if(!(s.state.loading&4)){var c=oh.get(r);if(c)var h=c.get(null);else{c=new Map,oh.set(r,c);for(var p=r.querySelectorAll("link[data-precedence],style[data-precedence]"),x=0;x"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(n)}catch(e){console.error(e)}}return n(),Yg.exports=pM(),Yg.exports}var xM=gM();const yM=gy(xM);class yy extends Error{constructor(t,i,l){super(t);ph(this,"status");ph(this,"detail");this.name="ApiError",this.status=i,this.detail=l}}async function hs(n,e){let t=e,i;try{const l=await n.json();typeof(l==null?void 0:l.detail)=="string"&&l.detail?(t=l.detail,i=l.detail):Array.isArray(l==null?void 0:l.detail)&&(i=l.detail)}catch{}return new yy(t,n.status,i)}async function bM(n){const e=await fetch(`/api/notifications?after=${n}`);if(!e.ok)throw new Error("Failed to fetch notifications");return e.json()}async function vM(){const n=await fetch("/api/actions/open-log",{method:"POST"});if(!n.ok)throw new Error("Failed to open log file");return n.json()}async function wM(n){const e=new URLSearchParams;e.set("limit",String(n.limit)),n!=null&&n.level&&e.set("level",n.level),n!=null&&n.search&&e.set("search",n.search);const t=await fetch(`/api/logs?${e.toString()}`);if(!t.ok)throw new Error("Failed to fetch log entries");return t.json()}async function Wh(){const n=await fetch("/api/system");if(!n.ok)throw new Error("Failed to fetch system info");return n.json()}async function kM(n){const e=await fetch("/api/system/bind",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({lan:n})});if(!e.ok){let t="Failed to update LAN binding";try{const i=await e.json();i!=null&&i.detail&&(t=i.detail)}catch{}throw new Error(t)}return e.json()}async function SM(n,e=1e4){const t=Date.now()+e;let i=null;for(;Date.now()setTimeout(l,500))}return i}async function Bk(){const n=await fetch("/api/config");if(!n.ok)throw new Error("Failed to fetch app configuration");return n.json()}async function Pk(n){const e=await fetch("/api/config/select-directory",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({directory:n})});if(!e.ok)throw new Error("Failed to select directory");return e.json()}async function CM(n){const e=await fetch("/api/config/load",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({config_path:n})});if(!e.ok)throw new Error("Failed to load config file");return e.json()}async function WC(n,e){const t=await fetch("/api/config/load-content",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:n,content:e})});if(!t.ok){let i=`Failed to apply dropped config (${n})`;try{const l=await t.json();l!=null&&l.detail&&(i=l.detail)}catch{}throw new Error(i)}return t.json()}async function OM(){const n=await fetch("/api/config/reload",{method:"POST"});if(!n.ok){let e="Failed to reload configuration";try{const t=await n.json();t!=null&&t.detail&&(e=t.detail)}catch{}throw new Error(e)}return n.json()}async function NM(n){const e=await fetch("/api/config/create",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({directory:n})});if(!e.ok)throw new Error("Failed to create config file");return e.json()}async function Hk(){const n=await fetch("/api/config/content");if(!n.ok)throw await hs(n,"Failed to fetch config content");return n.json()}async function Ik(n,e){const t=await fetch("/api/config/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:n,content:e})});if(!t.ok)throw await hs(t,"Failed to validate config content");return t.json()}async function TM(){const n=await fetch("/api/config/template",{method:"POST"});if(!n.ok)throw await hs(n,"Failed to fetch config template");return n.json()}async function Uk(n,e,t={}){const i=await fetch("/api/config/save",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n,force:e,baseline_hash:t.baselineHash??null,overwrite_changes:t.overwriteChanges??!1})});if(!i.ok)throw await hs(i,"Failed to save configuration");const l=await i.json();return{config:l.config,contentHash:l.content_hash??null}}async function AM(n){const e=await fetch("/api/config/save-as",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok)throw await hs(e,"Failed to save configuration as");const t=await e.json();return{config:t.config,contentHash:t.content_hash??null}}async function EM(n){const e=`/api/fs/browse?path=${encodeURIComponent(n)}&include_hidden=true`,t=await fetch(e);if(!t.ok)throw new Error("Failed to browse config files");return t.json()}async function ZC(n){const e=`/api/fs/browse?path=${encodeURIComponent(n)}`,t=await fetch(e);if(!t.ok)throw new Error("Failed to browse directory");return t.json()}async function Fk(n,e){const t=await fetch("/api/scan",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n),signal:e});if(!t.ok)throw new Error("Failed to execute scan");return t.json()}async function Zg(n){const e=new URLSearchParams;(n==null?void 0:n.offset)!=null&&e.set("offset",String(n.offset)),(n==null?void 0:n.limit)!=null&&e.set("limit",String(n.limit)),n!=null&&n.sort_by&&e.set("sort_by",n.sort_by),n!=null&&n.sort_dir&&e.set("sort_dir",n.sort_dir);const t=e.toString(),i=`/api/scan/results${t?`?${t}`:""}`,l=await fetch(i,{signal:n==null?void 0:n.signal});if(!l.ok)throw new Error("Failed to fetch scan results");return l.json()}async function MM(n){const e=await fetch("/api/actions/launch",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok)throw new Error("Failed to launch file");return e.json()}async function JC(n){const e=await fetch("/api/actions/reveal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n})});if(!e.ok)throw new Error("Failed to reveal file");return e.json()}async function K0(n){const e=await fetch("/api/actions/open-folder",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n})});if(!e.ok)throw new Error("Failed to open folder");return e.json()}async function qk(n){const e=await fetch("/api/actions/open-terminal",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n})});if(!e.ok)throw new Error("Failed to open terminal");return e.json()}async function Vk(n,e){const t=await fetch("/api/actions/hash",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n,algorithm:e})});if(!t.ok)throw new Error("Failed to compute hash");return t.json()}async function DM(){const n=await fetch("/api/actions/open-config",{method:"POST"});if(!n.ok)throw new Error("Failed to open config file");return n.json()}async function Qk(n){const e={file_path:n.file_path||n.filePath,content:n.content},t=await fetch("/api/actions/barcode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok)throw new Error("Failed to generate barcode");return t.json()}async function RM(n){const e=await fetch("/api/actions/barcode/decode",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image_base64:n.imageBase64,formats:n.formats})});if(!e.ok)throw e.status===503?new Error("Server-side barcode decoding is unavailable"):new Error(`Failed to decode frame (HTTP ${e.status})`);return e.json()}async function jM(n,e){const t=await fetch("/api/actions/metadata",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:n}),signal:e});if(!t.ok)throw new Error("Failed to fetch metadata");return t.json()}async function _M(n,e){const t=await fetch("/api/actions/export-csv",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:n,filename:e})});if(!t.ok)throw new Error("Failed to export CSV");return t.json()}async function LM(n,e){const t=await fetch("/api/actions/save-image",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({image_base64:n,filename:e})});if(!t.ok)throw new Error("Failed to save image");return t.json()}async function zM(n){const e=await fetch("/api/workflow/start",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(n)});if(!e.ok)throw await hs(e,"Failed to start workflow session");return e.json()}async function BM(n,e){const t=await fetch(`/api/workflow/${n}/respond`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:e})});if(!t.ok)throw await hs(t,"Failed to respond to workflow prompt");return t.json()}async function PM(n){const e=await fetch(`/api/workflow/${n}/abort`,{method:"POST"});if(!e.ok)throw await hs(e,"Failed to abort workflow session");return e.json()}const HM=[".profiles",".profiles.yaml",".profiles.yml",".yaml",".yml"];function IM(n){const e=n.toLowerCase();return HM.some(t=>e.endsWith(t))}function UM(n){for(const e of n)if(IM(e.name))return e;return null}function Zh(){return{depth:0,overlayVisible:!1}}function Xk(n,e,t){switch(e){case"enter":return t?{depth:n.depth+1,overlayVisible:!0}:n;case"leave":{const i=Math.max(0,n.depth-1);return{depth:i,overlayVisible:n.depth>0&&i>0}}case"drop":return Zh()}}function $k(n){return n==="light"?"light":"dark"}/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const FM=n=>n.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),eO=(...n)=>n.filter((e,t,i)=>!!e&&e.trim()!==""&&i.indexOf(e)===t).join(" ").trim();/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */var qM={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const VM=E.forwardRef(({color:n="currentColor",size:e=24,strokeWidth:t=2,absoluteStrokeWidth:i,className:l="",children:o,iconNode:a,...u},f)=>E.createElement("svg",{ref:f,...qM,width:e,height:e,stroke:n,strokeWidth:i?Number(t)*24/Number(e):t,className:eO("lucide",l),...u},[...a.map(([d,m])=>E.createElement(d,m)),...Array.isArray(o)?o:[o]]));/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const je=(n,e)=>{const t=E.forwardRef(({className:i,...l},o)=>E.createElement(VM,{ref:o,iconNode:e,className:eO(`lucide-${FM(n)}`,i),...l}));return t.displayName=`${n}`,t};/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const QM=[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]],XM=je("Activity",QM);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $M=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],tO=je("ArrowDown",$M);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const YM=[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]],GM=je("ArrowLeftRight",YM);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const KM=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]],WM=je("ArrowRight",KM);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const ZM=[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]],Yk=je("ArrowUpDown",ZM);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const JM=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],e4=je("ArrowUp",JM);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const t4=[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]],n4=je("Bug",t4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const i4=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],r4=je("Calendar",i4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const l4=[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]],nO=je("Camera",l4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const s4=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],Pr=je("Check",s4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const o4=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],a4=je("ChevronDown",o4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const c4=[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]],Yd=je("ChevronRight",c4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const u4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],Zc=je("CircleAlert",u4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const f4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]],Gk=je("CircleCheck",f4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const h4=[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]],d4=je("CircleDashed",h4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const m4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]],p4=je("CircleDot",m4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const g4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]],x4=je("CirclePause",g4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const y4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]],b4=je("CirclePlay",y4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const v4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]],uu=je("CircleX",v4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const w4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]],k4=je("Clock",w4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const S4=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]],mi=je("Copy",S4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const C4=[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]],iO=je("Download",C4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const O4=[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]],rO=je("ExternalLink",O4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const N4=[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]],T4=je("EyeOff",N4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const A4=[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],W0=je("Eye",A4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const E4=[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]],M4=je("FastForward",E4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const D4=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]],R4=je("FileCode2",D4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const j4=[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]],Z0=je("FileCode",j4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const _4=[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m3.2 12.9-.9-.4",key:"1i3dj5"}],["path",{d:"m3.2 15.1-.9.4",key:"1fvgj0"}],["path",{d:"M4.677 21.5a2 2 0 0 0 1.313.5H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2.5",key:"1yo3oz"}],["path",{d:"m4.9 11.2-.4-.9",key:"otmhb9"}],["path",{d:"m4.9 16.8-.4.9",key:"1b8z07"}],["path",{d:"m7.5 10.3-.4.9",key:"11k65u"}],["path",{d:"m7.5 17.7-.4-.9",key:"431x55"}],["path",{d:"m9.7 12.5-.9.4",key:"87sjan"}],["path",{d:"m9.7 15.5-.9-.4",key:"khqm91"}],["circle",{cx:"6",cy:"14",r:"3",key:"a1xfv6"}]],fa=je("FileCog",_4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const L4=[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]],z4=je("FilePlus2",L4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const B4=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]],Na=je("FileText",B4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const P4=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],Jg=je("File",P4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const H4=[["path",{d:"M14 2v6a2 2 0 0 0 .245.96l5.51 10.08A2 2 0 0 1 18 22H6a2 2 0 0 1-1.755-2.96l5.51-10.08A2 2 0 0 0 10 8V2",key:"18mbvz"}],["path",{d:"M6.453 15h11.094",key:"3shlmq"}],["path",{d:"M8.5 2h7",key:"csnxdl"}]],I4=je("FlaskConical",H4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const U4=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],ts=je("FolderOpen",U4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const F4=[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]],Au=je("Folder",F4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const q4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]],V4=je("Globe",q4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Q4=[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]],ha=je("Hash",Q4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const X4=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]],Gd=je("House",X4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const $4=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]],by=je("Info",$4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Y4=[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]],lO=je("Keyboard",Y4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const G4=[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]],K4=je("Link2",G4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const W4=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],ul=je("LoaderCircle",W4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const Z4=[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]],J4=je("Lock",Z4);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const eD=[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]],tD=je("Moon",eD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const nD=[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]],iD=je("Network",nD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const rD=[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]],is=je("Play",rD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const lD=[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]],sD=je("Plus",lD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const oD=[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]],vy=je("QrCode",oD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const aD=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],Kd=je("RefreshCw",aD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const cD=[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]],uD=je("Rocket",cD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const fD=[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]],hD=je("RotateCcw",fD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const dD=[["path",{d:"M10 2v3a1 1 0 0 0 1 1h5",key:"1xspal"}],["path",{d:"M18 18v-6a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6",key:"1ra60u"}],["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"M8 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9.172a2 2 0 0 1 1.414.586l2.828 2.828A2 2 0 0 1 22 6.828V16a2 2 0 0 1-2.01 2z",key:"1yve0x"}]],mD=je("SaveAll",dD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const pD=[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]],sO=je("Save",pD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const gD=[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]],oO=je("Search",gD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const xD=[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]],yD=je("Settings",xD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const bD=[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]],vD=je("Sun",bD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const wD=[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]],J0=je("Terminal",wD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const kD=[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]],aO=je("Timer",kD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const SD=[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]],cO=je("Trash2",SD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const CD=[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]],wy=je("TriangleAlert",CD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const OD=[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]],ND=je("User",OD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const TD=[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]],uO=je("Webhook",TD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const AD=[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]],ED=je("Workflow",AD);/** + * @license lucide-react v0.477.0 - ISC + * + * This source code is licensed under the ISC license. + * See the LICENSE file in the root directory of this source tree. + */const MD=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Li=je("X",MD);function DD(n){if(n<60)return`${n}s`;const e=Math.floor(n/60),t=n%60;return`${e}m${t.toString().padStart(2,"0")}s`}function RD(n){if(!n)return{label:"",cut:!1};const e=n.replace(/\\/g,"/").split("/").filter(Boolean);return e.length===0?{label:n,cut:!1}:{label:e[e.length-1],cut:e.length>1}}function jD({directory:n}){const[e,t]=E.useState(0);E.useEffect(()=>{t(0);const o=window.setInterval(()=>{t(a=>a+1)},1e3);return()=>window.clearInterval(o)},[]);const{label:i,cut:l}=RD(n);return y.jsxs("div",{"data-testid":"scan-status-strip",className:"flex min-w-0 items-center gap-1.5 text-[11px] text-ink-muted",children:[y.jsx(ul,{className:"h-3 w-3 shrink-0 animate-spin text-chip-indigo-text motion-reduce:animate-none","aria-hidden":"true"}),y.jsxs("span",{className:"min-w-0 truncate",children:["Scanning",n&&y.jsxs(y.Fragment,{children:[" ",y.jsxs("span",{className:"font-mono text-ink-secondary",title:n,children:[l?"…/":"",i]})]})," — ",y.jsx("span",{className:"font-mono tabular-nums text-ink-secondary",children:DD(e)})]})]})}function _D({onExecute:n,scanning:e,hasSelection:t,fileCount:i,totalCount:l,scanningDirectory:o="",toastMessage:a,onToastDismiss:u}){const f=(a==null?void 0:a.kind)==="error";return y.jsxs("div",{className:"relative flex items-center justify-between border-t border-line bg-surface-glass px-4 py-2.5 text-xs transition-colors duration-200",children:[a&&y.jsx("div",{role:"status","aria-live":f?"assertive":"polite","aria-atomic":"true",className:`animate-toast-in absolute left-1/2 top-1/2 z-[var(--z-toast)] max-w-[min(80vw,640px)] -translate-x-1/2 -translate-y-1/2 rounded-xl border px-4 py-2 text-xs font-medium glass-panel-strong ${f?"pointer-events-auto flex max-w-[min(70vw,560px)] items-center gap-2.5 border-status-danger-border text-left text-ink":"pointer-events-none max-w-[min(70vw,560px)] text-center text-ink"}`,children:f?y.jsxs(y.Fragment,{children:[y.jsx(uu,{className:"h-3.5 w-3.5 shrink-0 text-status-danger-text/80","aria-hidden":"true"}),y.jsx("span",{className:"min-w-0 flex-1",children:a.message}),u&&y.jsx("button",{type:"button",onClick:u,"aria-label":"Dismiss error",className:"shrink-0 rounded-md p-0.5 text-status-danger-text/60 hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-status-danger-border transition-colors",children:y.jsx(Li,{className:"h-3.5 w-3.5"})})]}):a.message}),y.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[e&&y.jsx(jD,{directory:o}),l!==void 0&&l!==i&&y.jsxs("span",{"data-testid":"action-bar-count",className:"text-ink-muted",children:["Showing ",i," of ",l]})]}),y.jsxs("button",{onClick:n,disabled:!t||e,className:"flex shrink-0 items-center gap-2 rounded-xl border border-emerald-300/50 bg-gradient-to-b from-emerald-400/90 to-emerald-600/90 px-5 py-2 font-semibold text-white shadow-[inset_0_1px_0_rgb(255_255_255/0.35),0_8px_24px_-6px_rgb(16_185_129/0.55)] transition-[filter,box-shadow,transform] hover:-translate-y-px hover:brightness-110 hover:shadow-[inset_0_1px_0_rgb(255_255_255/0.35),0_12px_30px_-6px_rgb(16_185_129/0.7)] disabled:opacity-40 disabled:hover:translate-y-0 disabled:hover:brightness-100 disabled:hover:shadow-[inset_0_1px_0_rgb(255_255_255/0.35),0_8px_24px_-6px_rgb(16_185_129/0.55)] focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-emerald-400",children:[y.jsx(is,{className:"h-3.5 w-3.5 fill-current"}),y.jsx("span",{children:"Execute"}),y.jsx("kbd",{className:"rounded bg-emerald-800/60 px-1.5 py-0.5 text-[10px] text-emerald-200 shadow-[inset_0_1px_0_rgb(255_255_255/0.12)]",children:"↵"})]})]})}let ex=[],fO=[];(()=>{let n="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,1n,9,16,o,,x,1i,3,,i,,7,a,2,t,3,1k,,,7,2,2,2,3,9,,a,2,q,,2,3,1k,,,5,4,2,2,3,3,,u,2,3,,b,3,1k,,,8,,3,,3,k,2,m,6,,3,1k,,,7,2,2,2,3,7,3,a,2,u,,1n,5,3,3,,4,9,,14,5,1j,,,7,,3,,4,7,2,b,2,t,3,1k,,,7,,3,,4,7,2,b,2,f,,c,4,1j,2,,7,,3,,4,9,,a,2,t,3,1y,,4,6,,,,8,i,2,1p,,,8,c,8,2q,,,a,b,7,21,2,r,,,,,,4,2,1d,k,,2,5,b,,10,9,,2u,b,,6,n,4,4,3,g,4,d,,,3,6,,f,,jj,3,qa,4,s,3,t,2,u,2,1s,w,9,,19,3,,,39,2,y,,3a,c,4,c,63,5,1l,a,,,,,2,o,2,,1c,1a,2,c,k,5,1b,h,12,9,c,3,u,d,1k,e,1c,k,48,3,,l,4,,6,,2,3,5i,1s,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,n,5,4,,2b,2,1e,i,q,i,d,,12,8,p,d,18,4,1b,e,10,,1v,e,c,,8,2,1a,,1f,,,3,2,2,5,2,,,15,5,5,2,6k,8,,2,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,1t,5,8t,2,25,6,1y,b,1d,4,3e,3,1h,f,15,,2,2,a,4,19,b,7,,1p,3,10,e,g,2,18,,c,3,1c,e,8,4,,2,2k,c,6,,2,,4d,c,l,4,1j,2,,7,2,2,2,3,9,,a,2,2,7,3,5,1v,9,,,2,,,4,,5,,,e,2,2a,i,n,,29,k,6j,7,2,9,r,2,2a,h,2y,d,2t,3,2,a,74,f,6t,6,,2,2,4,,,,2,3x,7,2,7,3,,s,a,14,7,,4,8,,9,b,1a,g,5i,8,5j,8,,8,2a,m,,e,3e,6,3,,,2,,7,,,1u,5,,2,,5,9n,4,9,2,,,1c,7,3,5,n,,44l,,6,f,8ug,i,1xc,5,1n,7,t4,,,1j,7,4,29,,b,2,f57,2,3mp,1a,2,n,f2,5,3,6,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,2s,,4g,7,af,,1p,4,e4,4,72,2,6r,,2,,7,2,5,,d6,7,31,7,240,5".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e>1;if(n=fO[i])e=i+1;else return!0;if(e==t)return!1}}function Kk(n){return n>=127462&&n<=127487}const Wk=8205;function zD(n,e,t=!0,i=!0){return(t?hO:BD)(n,e,i)}function hO(n,e,t){if(e==n.length)return e;e&&dO(n.charCodeAt(e))&&mO(n.charCodeAt(e-1))&&e--;let i=e0(n,e);for(e+=Zk(i);e=0&&Kk(e0(n,a));)o++,a-=2;if(o%2==0)break;e+=2}else break}return e}function BD(n,e,t){for(;e>1;){let i=hO(n,e-2,t);if(i=56320&&n<57344}function mO(n){return n>=55296&&n<56320}function Zk(n){return n<65536?1:2}class dt{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=Ta(this,e,t);let l=[];return this.decompose(0,e,l,2),i.length&&i.decompose(0,i.length,l,3),this.decompose(t,this.length,l,1),Rr.from(l,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Ta(this,e,t);let i=[];return this.decompose(e,t,i,0),Rr.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),l=new Jc(this),o=new Jc(e);for(let a=t,u=t;;){if(l.next(a),o.next(a),a=0,l.lineBreak!=o.lineBreak||l.done!=o.done||l.value!=o.value)return!1;if(u+=l.value.length,l.done||u>=i)return!0}}iter(e=1){return new Jc(this,e)}iterRange(e,t=this.length){return new pO(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let l=this.line(e).from;i=this.iterRange(l,Math.max(l,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new gO(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?dt.empty:e.length<=32?new Jt(e):Rr.from(Jt.split(e,[]))}}class Jt extends dt{constructor(e,t=PD(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,l){for(let o=0;;o++){let a=this.text[o],u=l+a.length;if((t?i:u)>=e)return new HD(l,u,i,a);l=u+1,i++}}decompose(e,t,i,l){let o=e<=0&&t>=this.length?this:new Jt(Jk(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(l&1){let a=i.pop(),u=Jh(o.text,a.text.slice(),0,o.length);if(u.length<=32)i.push(new Jt(u,a.length+o.length));else{let f=u.length>>1;i.push(new Jt(u.slice(0,f)),new Jt(u.slice(f)))}}else i.push(o)}replace(e,t,i){if(!(i instanceof Jt))return super.replace(e,t,i);[e,t]=Ta(this,e,t);let l=Jh(this.text,Jh(i.text,Jk(this.text,0,e)),t),o=this.length+i.length-(t-e);return l.length<=32?new Jt(l,o):Rr.from(Jt.split(l,[]),o)}sliceString(e,t=this.length,i=` +`){[e,t]=Ta(this,e,t);let l="";for(let o=0,a=0;o<=t&&ae&&a&&(l+=i),eo&&(l+=u.slice(Math.max(0,e-o),t-o)),o=f+1}return l}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],l=-1;for(let o of e)i.push(o),l+=o.length+1,i.length==32&&(t.push(new Jt(i,l)),i=[],l=-1);return l>-1&&t.push(new Jt(i,l)),t}}class Rr extends dt{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,l){for(let o=0;;o++){let a=this.children[o],u=l+a.length,f=i+a.lines-1;if((t?f:u)>=e)return a.lineInner(e,t,i,l);l=u+1,i=f+1}}decompose(e,t,i,l){for(let o=0,a=0;a<=t&&o=a){let d=l&((a<=e?1:0)|(f>=t?2:0));a>=e&&f<=t&&!d?i.push(u):u.decompose(e-a,t-a,i,d)}a=f+1}}replace(e,t,i){if([e,t]=Ta(this,e,t),i.lines=o&&t<=u){let f=a.replace(e-o,t-o,i),d=this.lines-a.lines+f.lines;if(f.lines>4&&f.lines>d>>6){let m=this.children.slice();return m[l]=f,new Rr(m,this.length-(t-e)+i.length)}return super.replace(o,u,f)}o=u+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` +`){[e,t]=Ta(this,e,t);let l="";for(let o=0,a=0;oe&&o&&(l+=i),ea&&(l+=u.sliceString(e-a,t-a,i)),a=f+1}return l}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof Rr))return 0;let i=0,[l,o,a,u]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;l+=t,o+=t){if(l==a||o==u)return i;let f=this.children[l],d=e.children[o];if(f!=d)return i+f.scanIdentical(d,t);i+=f.length+1}}static from(e,t=e.reduce((i,l)=>i+l.length+1,-1)){let i=0;for(let v of e)i+=v.lines;if(i<32){let v=[];for(let w of e)w.flatten(v);return new Jt(v,t)}let l=Math.max(32,i>>5),o=l<<1,a=l>>1,u=[],f=0,d=-1,m=[];function g(v){let w;if(v.lines>o&&v instanceof Rr)for(let S of v.children)g(S);else v.lines>a&&(f>a||!f)?(b(),u.push(v)):v instanceof Jt&&f&&(w=m[m.length-1])instanceof Jt&&v.lines+w.lines<=32?(f+=v.lines,d+=v.length+1,m[m.length-1]=new Jt(w.text.concat(v.text),w.length+1+v.length)):(f+v.lines>l&&b(),f+=v.lines,d+=v.length+1,m.push(v))}function b(){f!=0&&(u.push(m.length==1?m[0]:Rr.from(m,d)),d=-1,f=m.length=0)}for(let v of e)g(v);return b(),u.length==1?u[0]:new Rr(u,t)}}dt.empty=new Jt([""],0);function PD(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Jh(n,e,t=0,i=1e9){for(let l=0,o=0,a=!0;o=t&&(f>i&&(u=u.slice(0,i-l)),l0?1:(e instanceof Jt?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,l=this.nodes[i],o=this.offsets[i],a=o>>1,u=l instanceof Jt?l.text.length:l.children.length;if(a==(t>0?u:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((o&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` +`,this;e--}else if(l instanceof Jt){let f=l.text[a+(t<0?-1:0)];if(this.offsets[i]+=t,f.length>Math.max(0,e))return this.value=e==0?f:t>0?f.slice(e):f.slice(0,f.length-e),this;e-=f.length}else{let f=l.children[a+(t<0?-1:0)];e>f.length?(e-=f.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(f),this.offsets.push(t>0?1:(f instanceof Jt?f.text.length:f.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class pO{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new Jc(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:l}=this.cursor.next(e);return this.pos+=(l.length+e)*t,this.value=l.length<=i?l:t<0?l.slice(l.length-i):l.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class gO{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:l}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=l,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(dt.prototype[Symbol.iterator]=function(){return this.iter()},Jc.prototype[Symbol.iterator]=pO.prototype[Symbol.iterator]=gO.prototype[Symbol.iterator]=function(){return this});class HD{constructor(e,t,i,l){this.from=e,this.to=t,this.number=i,this.text=l}get length(){return this.to-this.from}}function Ta(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function Sn(n,e,t=!0,i=!0){return zD(n,e,t,i)}function ID(n){return n>=56320&&n<57344}function UD(n){return n>=55296&&n<56320}function pi(n,e){let t=n.charCodeAt(e);if(!UD(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return ID(i)?(t-55296<<10)+(i-56320)+65536:t}function ky(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function jr(n){return n<65536?1:2}const tx=/\r\n?|\n/;var ii=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(ii||(ii={}));class Hr{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return o+(e-l);o+=u}else{if(i!=ii.Simple&&d>=e&&(i==ii.TrackDel&&le||i==ii.TrackBefore&&le))return null;if(d>e||d==e&&t<0&&!u)return e==l||t<0?o:o+f;o+=f}l=d}if(e>l)throw new RangeError(`Position ${e} is out of range for changeset of length ${l}`);return o}touchesRange(e,t=e){for(let i=0,l=0;i=0&&l<=t&&u>=e)return lt?"cover":!0;l=u}return!1}toString(){let e="";for(let t=0;t=0?":"+l:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new Hr(e)}static create(e){return new Hr(e)}}class pn extends Hr{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 nx(this,(t,i,l,o,a)=>e=e.replace(l,l+(i-t),a),!1),e}mapDesc(e,t=!1){return ix(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let l=0,o=0;l=0){t[l]=u,t[l+1]=a;let f=l>>1;for(;i.length0&&Zl(i,t,o.text),o.forward(m),u+=m}let d=e[a++];for(;u>1].toJSON()))}return e}static of(e,t,i){let l=[],o=[],a=0,u=null;function f(m=!1){if(!m&&!l.length)return;ab||g<0||b>t)throw new RangeError(`Invalid change range ${g} to ${b} (in doc of length ${t})`);let w=v?typeof v=="string"?dt.of(v.split(i||tx)):v:dt.empty,S=w.length;if(g==b&&S==0)return;ga&&Vn(l,g-a,-1),Vn(l,b-g,S),Zl(o,l,w),a=b}}return d(e),f(!u),u}static empty(e){return new pn(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let l=0;lu&&typeof a!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(o.length==1)t.push(o[0],0);else{for(;i.length=0&&t<=0&&t==n[l+1]?n[l]+=e:l>=0&&e==0&&n[l]==0?n[l+1]+=t:i?(n[l]+=e,n[l+1]+=t):n.push(e,t)}function Zl(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i>1])),!(t||a==n.sections.length||n.sections[a+1]<0);)u=n.sections[a++],f=n.sections[a++];e(l,d,o,m,g),l=d,o=m}}}function ix(n,e,t,i=!1){let l=[],o=i?[]:null,a=new fu(n),u=new fu(e);for(let f=-1;;){if(a.done&&u.len||u.done&&a.len)throw new Error("Mismatched change set lengths");if(a.ins==-1&&u.ins==-1){let d=Math.min(a.len,u.len);Vn(l,d,-1),a.forward(d),u.forward(d)}else if(u.ins>=0&&(a.ins<0||f==a.i||a.off==0&&(u.len=0&&f=0){let d=0,m=a.len;for(;m;)if(u.ins==-1){let g=Math.min(m,u.len);d+=g,m-=g,u.forward(g)}else if(u.ins==0&&u.lenf||a.ins>=0&&a.len>f)&&(u||i.length>d),o.forward2(f),a.forward(f)}}}}class fu{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?dt.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?dt.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Kl{constructor(e,t,i,l){this.from=e,this.to=t,this.flags=i,this.goalColumn=l}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(e,t=-1){let i,l;return this.empty?i=l=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),l=e.mapPos(this.to,-1)),i==this.from&&l==this.to?this:new Kl(i,l,this.flags,this.goalColumn)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return le.range(e,t,void 0,void 0,i);let l=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return le.range(this.anchor,l,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return le.range(e.anchor,e.head)}static create(e,t,i,l){return new Kl(e,t,i,l)}}class le{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:le.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;ie.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new le(e.ranges.map(t=>Kl.fromJSON(t)),e.main)}static single(e,t=e){return new le([le.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,l=0;ll.from-o.from),t=e.indexOf(i);for(let l=1;lo.head?le.range(f,u):le.range(u,f))}}return new le(e,t)}}function yO(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Sy=0;class Ne{constructor(e,t,i,l,o){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=l,this.id=Sy++,this.default=e([]),this.extensions=typeof o=="function"?o(this):o}get reader(){return this}static define(e={}){return new Ne(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Cy),!!e.static,e.enables)}of(e){return new ed([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ed(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new ed(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Cy(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class ed{constructor(e,t,i,l){this.dependencies=e,this.facet=t,this.type=i,this.value=l,this.id=Sy++}dynamicSlot(e){var t;let i=this.value,l=this.facet.compareInput,o=this.id,a=e[o]>>1,u=this.type==2,f=!1,d=!1,m=[];for(let g of this.dependencies)g=="doc"?f=!0:g=="selection"?d=!0:(((t=e[g.id])!==null&&t!==void 0?t:1)&1)==0&&m.push(e[g.id]);return{create(g){return g.values[a]=i(g),1},update(g,b){if(f&&b.docChanged||d&&(b.docChanged||b.selection)||rx(g,m)){let v=i(g);if(u?!eS(v,g.values[a],l):!l(v,g.values[a]))return g.values[a]=v,1}return 0},reconfigure:(g,b)=>{let v,w=b.config.address[o];if(w!=null){let S=dd(b,w);if(this.dependencies.every(C=>C instanceof Ne?b.facet(C)===g.facet(C):C instanceof Xn?b.field(C,!1)==g.field(C,!1):!0)||(u?eS(v=i(g),S,l):l(v=i(g),S)))return g.values[a]=S,0}else v=i(g);return g.values[a]=v,1}}}get extension(){return this}}function eS(n,e,t){if(n.length!=e.length)return!1;for(let i=0;in[f.id]),l=t.map(f=>f.type),o=i.filter(f=>!(f&1)),a=n[e.id]>>1;function u(f){let d=[];for(let m=0;mi===l),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(gh).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,l)=>{let o=i.values[t],a=this.updateF(o,l);return this.compareF(o,a)?0:(i.values[t]=a,1)},reconfigure:(i,l)=>{let o=i.facet(gh),a=l.facet(gh),u;return(u=o.find(f=>f.field==this))&&u!=a.find(f=>f.field==this)?(i.values[t]=u.create(i),1):l.config.address[this.id]!=null?(i.values[t]=l.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,gh.of({field:this,create:e})]}get extension(){return this}}const Ws={lowest:4,low:3,default:2,high:1,highest:0};function Hc(n){return e=>new bO(e,n)}const ho={highest:Hc(Ws.highest),high:Hc(Ws.high),default:Hc(Ws.default),low:Hc(Ws.low),lowest:Hc(Ws.lowest)};class bO{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}}class Wd{of(e){return new lx(this,e)}reconfigure(e){return Wd.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class lx{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}}class hd{constructor(e,t,i,l,o,a){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=l,this.staticValues=o,this.facets=a,this.statusTemplate=[];this.statusTemplate.length>1]}static resolve(e,t,i){let l=[],o=Object.create(null),a=new Map;for(let b of qD(e,t,a))b instanceof Xn?l.push(b):(o[b.facet.id]||(o[b.facet.id]=[])).push(b);let u=Object.create(null),f=[],d=[];for(let b of l)u[b.id]=d.length<<1,d.push(v=>b.slot(v));let m=i==null?void 0:i.config.facets;for(let b in o){let v=o[b],w=v[0].facet,S=m&&m[b]||[];if(v.every(C=>C.type==0))if(u[w.id]=f.length<<1|1,Cy(S,v))f.push(i.facet(w));else{let C=w.combine(v.map(N=>N.value));f.push(i&&w.compare(C,i.facet(w))?i.facet(w):C)}else{for(let C of v)C.type==0?(u[C.id]=f.length<<1|1,f.push(C.value)):(u[C.id]=d.length<<1,d.push(N=>C.dynamicSlot(N)));u[w.id]=d.length<<1,d.push(C=>FD(C,w,v))}}let g=d.map(b=>b(u));return new hd(e,a,g,u,f,o)}}function qD(n,e,t){let i=[[],[],[],[],[]],l=new Map;function o(a,u){let f=l.get(a);if(f!=null){if(f<=u)return;let d=i[f].indexOf(a);d>-1&&i[f].splice(d,1),a instanceof lx&&t.delete(a.compartment)}if(l.set(a,u),Array.isArray(a))for(let d of a)o(d,u);else if(a instanceof lx){if(t.has(a.compartment))throw new RangeError("Duplicate use of compartment in extensions");let d=e.get(a.compartment)||a.inner;t.set(a.compartment,d),o(d,u)}else if(a instanceof bO)o(a.inner,a.prec);else if(a instanceof Xn)i[u].push(a),a.provides&&o(a.provides,u);else if(a instanceof ed)i[u].push(a),a.facet.extensions&&o(a.facet.extensions,Ws.default);else{let d=a.extension;if(!d)throw new Error(`Unrecognized extension value in extension set (${a}).`);if(d==a)throw new Error(`Unrecognized extension value in extension set (${a}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);o(d,u)}}return o(n,Ws.default),i.reduce((a,u)=>a.concat(u))}function eu(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let l=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|l}function dd(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const vO=Ne.define(),sx=Ne.define({combine:n=>n.some(e=>e),static:!0}),wO=Ne.define({combine:n=>n.length?n[0]:void 0,static:!0}),kO=Ne.define(),SO=Ne.define(),CO=Ne.define(),OO=Ne.define({combine:n=>n.length?n[0]:!1});class ml{constructor(e,t){this.type=e,this.value=t}static define(){return new VD}}class VD{of(e){return new ml(this,e)}}class QD{constructor(e){this.map=e}of(e){return new Ke(this,e)}}class Ke{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new Ke(this.type,t)}is(e){return this.type==e}static define(e={}){return new QD(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let l of e){let o=l.map(t);o&&i.push(o)}return i}}Ke.reconfigure=Ke.define();Ke.appendConfig=Ke.define();class gn{constructor(e,t,i,l,o,a){this.startState=e,this.changes=t,this.selection=i,this.effects=l,this.annotations=o,this.scrollIntoView=a,this._doc=null,this._state=null,i&&yO(i,t.newLength),o.some(u=>u.type==gn.time)||(this.annotations=o.concat(gn.time.of(Date.now())))}static create(e,t,i,l,o,a){return new gn(e,t,i,l,o,a)}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(gn.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}gn.time=ml.define();gn.userEvent=ml.define();gn.addToHistory=ml.define();gn.remote=ml.define();function XD(n,e){let t=[];for(let i=0,l=0;;){let o,a;if(i=n[i]))o=n[i++],a=n[i++];else if(l=0;l--){let o=i[l](n);o instanceof gn?n=o:Array.isArray(o)&&o.length==1&&o[0]instanceof gn?n=o[0]:n=TO(e,ya(o),!1)}return n}function YD(n){let e=n.startState,t=e.facet(CO),i=n;for(let l=t.length-1;l>=0;l--){let o=t[l](n);o&&Object.keys(o).length&&(i=NO(i,ox(e,o,n.changes.newLength),!0))}return i==n?n:gn.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const GD=[];function ya(n){return n==null?GD:Array.isArray(n)?n:[n]}var Ut=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(Ut||(Ut={}));const KD=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let ax;try{ax=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function WD(n){if(ax)return ax.test(n);for(let e=0;e"€"&&(t.toUpperCase()!=t.toLowerCase()||KD.test(t)))return!0}return!1}function ZD(n){return e=>{if(!/\S/.test(e))return Ut.Space;if(WD(e))return Ut.Word;for(let t=0;t-1)return Ut.Word;return Ut.Other}}class pt{constructor(e,t,i,l,o,a){this.config=e,this.doc=t,this.selection=i,this.values=l,this.status=e.statusTemplate.slice(),this.computeSlot=o,a&&(a._state=this);for(let u=0;ul.set(d,f)),t=null),l.set(u.value.compartment,u.value.extension)):u.is(Ke.reconfigure)?(t=null,i=u.value):u.is(Ke.appendConfig)&&(t=null,i=ya(i).concat(u.value));let o;t?o=e.startState.values.slice():(t=hd.resolve(i,l,this),o=new pt(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(f,d)=>d.reconfigure(f,this),null).values);let a=e.startState.facet(sx)?e.newSelection:e.newSelection.asSingle();new pt(t,e.newDoc,a,o,(u,f)=>f.update(u,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:le.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),l=this.changes(i.changes),o=[i.range],a=ya(i.effects);for(let u=1;ua.spec.fromJSON(u,f)))}}return pt.create({doc:e.doc,selection:le.fromJSON(e.selection),extensions:t.extensions?l.concat([t.extensions]):l})}static create(e={}){let t=hd.resolve(e.extensions||[],new Map),i=e.doc instanceof dt?e.doc:dt.of((e.doc||"").split(t.staticFacet(pt.lineSeparator)||tx)),l=e.selection?e.selection instanceof le?e.selection:le.single(e.selection.anchor,e.selection.head):le.single(0);return yO(l,i.length),t.staticFacet(sx)||(l=l.asSingle()),new pt(t,i,l,t.dynamicSlots.map(()=>null),(o,a)=>a.create(o),null)}get tabSize(){return this.facet(pt.tabSize)}get lineBreak(){return this.facet(pt.lineSeparator)||` +`}get readOnly(){return this.facet(OO)}phrase(e,...t){for(let i of this.facet(pt.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,l)=>{if(l=="$")return"$";let o=+(l||1);return!o||o>t.length?i:t[o-1]})),e}languageDataAt(e,t,i=-1){let l=[];for(let o of this.facet(vO))for(let a of o(this,t,i))Object.prototype.hasOwnProperty.call(a,e)&&l.push(a[e]);return l}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return ZD(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:l}=this.doc.lineAt(e),o=this.charCategorizer(e),a=e-i,u=e-i;for(;a>0;){let f=Sn(t,a,!1);if(o(t.slice(f,a))!=Ut.Word)break;a=f}for(;un.length?n[0]:4});pt.lineSeparator=wO;pt.readOnly=OO;pt.phrases=Ne.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(l=>n[l]==e[l])}});pt.languageData=vO;pt.changeFilter=kO;pt.transactionFilter=SO;pt.transactionExtender=CO;Wd.reconfigure=Ke.define();function Ur(n,e,t={}){let i={};for(let l of n)for(let o of Object.keys(l)){let a=l[o],u=i[o];if(u===void 0)i[o]=a;else if(!(u===a||a===void 0))if(Object.hasOwnProperty.call(t,o))i[o]=t[o](u,a);else throw new Error("Config merge conflict for field "+o)}for(let l in e)i[l]===void 0&&(i[l]=e[l]);return i}class rs{eq(e){return this==e}range(e,t=e){return cx.create(e,t,this)}}rs.prototype.startSide=rs.prototype.endSide=0;rs.prototype.point=!1;rs.prototype.mapMode=ii.TrackDel;function Oy(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}let cx=class AO{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new AO(e,t,i)}};function ux(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class Ny{constructor(e,t,i,l){this.from=e,this.to=t,this.value=i,this.maxPoint=l}get length(){return la(this.to)}findIndex(e,t,i,l=0){let o=i?this.to:this.from;for(let a=l,u=o.length;;){if(a==u)return a;let f=a+u>>1,d=o[f]-e||(i?this.value[f].endSide:this.value[f].startSide)-t;if(f==a)return d>=0?a:u;d>=0?u=f:a=f+1}}between(e,t,i,l){for(let o=this.findIndex(t,-1e9,!0),a=this.findIndex(i,1e9,!1,o);oC||S==C&&b.startSide>0&&b.endSide<=0)continue;if(!((C-S||b.endSide-b.startSide)<0))if(d<0&&(d=S),b.point&&(m=Math.max(m,C-S)),(S-i||b.startSide-l)>=0)a.push(b),u.push(S-d),f.push(C-d),i=C,l=b.endSide;else{if(S==C)for(let N=a.length;N>0;N--){if((S-(f[N-1]+d)||b.startSide-a[N-1].endSide)>=0){a.splice(N,0,b),u.splice(N,0,S-d),f.splice(N,0,C-d);continue e}if((S-(u[N-1]+d)||b.endSide-a[N-1].startSide)>0)break}o(S,C,b)}}return{mapped:a.length?new Ny(u,f,a,m):null,pos:d}}}class rt{constructor(e,t,i,l){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=l}static create(e,t,i,l){return new rt(e,t,i,l)}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:i=!1,filterFrom:l=0,filterTo:o=this.length}=e,a=e.filter;if(t.length==0&&!a)return this;if(i&&(t=t.slice().sort(ux)),this.isEmpty)return t.length?rt.of(t):this;let u=new EO(this,null,-1).goto(0),f=0,d=[],m=new Ir;for(;u.value||f=0){let g=t[f++];m.addInner(g.from,g.to,g.value,!1)||d.push(g)}else u.rangeIndex==1&&u.chunkIndexthis.chunkEnd(u.chunkIndex)||ou.to||o{o||(o=new Ir),o.addRange(f,d,m,!1)};for(let f=0;f=o&&e<=o+a.length&&a.between(o,e-o,t-o,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return hu.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return hu.from(e).goto(t)}static compare(e,t,i,l,o=-1){let a=e.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=o),u=t.filter(g=>g.maxPoint>0||!g.isEmpty&&g.maxPoint>=o),f=tS(a,u,i),d=new Ic(a,f,o),m=new Ic(u,f,o);i.iterGaps((g,b,v)=>nS(d,g,m,b,v,l)),i.empty&&i.length==0&&nS(d,0,m,0,0,l)}static eq(e,t,i=0,l){l==null&&(l=999999999);let o=e.filter(m=>!m.isEmpty&&t.indexOf(m)<0),a=t.filter(m=>!m.isEmpty&&e.indexOf(m)<0);if(o.length!=a.length)return!1;if(!o.length)return!0;let u=tS(o,a),f=new Ic(o,u,0).goto(i),d=new Ic(a,u,0).goto(i);for(;;){if(f.to!=d.to||!fx(f.active,d.active)||f.point&&(!d.point||!Oy(f.point,d.point)))return!1;if(f.to>l)return!0;f.next(),d.next()}}static spans(e,t,i,l,o=-1){let a=new Ic(e,null,o).goto(t),u=t,f=a.openStart;for(;;){let d=Math.min(a.to,i);if(a.point){let m=a.activeForPoint(a.to),g=a.pointFromu&&(l.span(u,d,a.active,f),f=a.openEnd(d));if(a.to>i)return f+(a.point&&a.to>i?1:0);u=a.to,a.next()}}static of(e,t=!1){let i=new Ir;for(let l of e instanceof cx?[e]:t?JD(e):e)i.add(l.from,l.to,l.value);return i.finish()}static join(e){if(!e.length)return rt.empty;let t=la(e);for(let i=e.length-2;i>=0;i--)for(let l=e[i];l!=rt.empty;l=l.nextLayer)t=new rt(l.chunkPos,l.chunk,t,Math.max(l.maxPoint,t.maxPoint));return t}}rt.empty=new rt([],[],null,-1);function la(n){return n[n.length-1]}function JD(n){if(n.length>1)for(let e=n[0],t=1;t0)return n.slice().sort(ux);e=i}return n}rt.empty.nextLayer=rt.empty;class Ir{finishChunk(e){this.chunks.push(new Ny(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=[])}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}add(e,t,i){this.addRange(e,t,i,!0)}addRange(e,t,i,l){this.addInner(e,t,i,l)||(this.nextLayer||(this.nextLayer=new Ir)).addRange(e,t,i,l)}addInner(e,t,i,l){let o=e-this.lastTo||i.startSide-this.last.endSide;if(l&&o<=0&&(e-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return o<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.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 i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(rt.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=rt.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function tS(n,e,t){let i=new Map;for(let o of n)for(let a=0;a=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=i&&l.push(new EO(a,t,i,o));return l.length==1?l[0]:new hu(l)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)t0(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)t0(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)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(),t0(this.heap,0)}}}function t0(n,e){for(let t=n[e];;){let i=(e<<1)+1;if(i>=n.length)break;let l=n[i];if(i+1=0&&(l=n[i+1],i++),t.compare(l)<0)break;n[i]=t,n[e]=l,e=i}}class Ic{constructor(e,t,i){this.minPoint=i,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=hu.from(e,t,i)}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){xh(this.active,e),xh(this.activeTo,e),xh(this.activeRank,e),this.minActive=iS(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:l,rank:o}=this.cursor;for(;t0;)t++;yh(this.active,t,i),yh(this.activeTo,t,l),yh(this.activeRank,t,o),e&&yh(e,t,this.cursor.from),this.minActive=iS(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let l=this.minActive;if(l>-1&&(this.activeTo[l]-this.cursor.from||this.active[l].endSide-this.cursor.startSide)<0){if(this.activeTo[l]>e){this.to=this.activeTo[l],this.endSide=this.active[l].endSide;break}this.removeActive(l),i&&xh(i,l)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let o=this.cursor.value;if(!o.point)this.addActive(i),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from=0&&i[l]=0&&!(this.activeRank[i]e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function nS(n,e,t,i,l,o){n.goto(e),t.goto(i);let a=i+l,u=i,f=i-e,d=!!o.boundChange;for(let m=!1;;){let g=n.to+f-t.to,b=g||n.endSide-t.endSide,v=b<0?n.to+f:t.to,w=Math.min(v,a);if(n.point||t.point?(n.point&&t.point&&Oy(n.point,t.point)&&fx(n.activeForPoint(n.to),t.activeForPoint(t.to))||o.comparePoint(u,w,n.point,t.point),m=!1):(m&&(o.boundChange(u),m=!1),w>u&&!fx(n.active,t.active)&&o.compareRange(u,w,n.active,t.active),d&&wa)break;u=v,b<=0&&n.next(),b>=0&&t.next()}}function fx(n,e){if(n.length!=e.length)return!1;for(let t=0;t=e;i--)n[i+1]=n[i];n[e]=t}function iS(n,e){let t=-1,i=1e9;for(let l=0;l=e)return l;if(l==n.length)break;o+=n.charCodeAt(l)==9?t-o%t:1,l=Sn(n,l)}return i===!0?-1:n.length}const dx="ͼ",rS=typeof Symbol>"u"?"__"+dx:Symbol.for(dx),mx=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),lS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class ls{constructor(e,t){this.rules=[];let{finish:i}=t||{};function l(a){return/^@/.test(a)?[a]:a.split(/,\s*/)}function o(a,u,f,d){let m=[],g=/^@(\w+)\b/.exec(a[0]),b=g&&g[1]=="keyframes";if(g&&u==null)return f.push(a[0]+";");for(let v in u){let w=u[v];if(/&/.test(v))o(v.split(/,\s*/).map(S=>a.map(C=>S.replace(/&/,C))).reduce((S,C)=>S.concat(C)),w,f);else if(w&&typeof w=="object"){if(!g)throw new RangeError("The value of a property ("+v+") should be a primitive value.");o(l(v),w,m,b)}else w!=null&&m.push(v.replace(/_.*/,"").replace(/[A-Z]/g,S=>"-"+S.toLowerCase())+": "+w+";")}(m.length||b)&&f.push((i&&!g&&!d?a.map(i):a).join(", ")+" {"+m.join(" ")+"}")}for(let a in e)o(l(a),e[a],this.rules)}getRules(){return this.rules.join(` +`)}static newName(){let e=lS[rS]||1;return lS[rS]=e+1,dx+e.toString(36)}static mount(e,t,i){let l=e[mx],o=i&&i.nonce;l?o&&l.setNonce(o):l=new eR(e,o),l.mount(Array.isArray(t)?t:[t],e)}}let sS=new Map;class eR{constructor(e,t){let i=e.ownerDocument||e,l=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&l.CSSStyleSheet){let o=sS.get(i);if(o)return e[mx]=o;this.sheet=new l.CSSStyleSheet,sS.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[mx]=this}mount(e,t){let i=this.sheet,l=0,o=0,a=!1;for(let u=0;u-1&&(this.modules.splice(d,1),a=!0,o--,d=-1),d==-1){if(this.modules.splice(o++,0,f),a=!0,i)for(let m=0;m",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},tR=typeof navigator<"u"&&/Mac/.test(navigator.platform),nR=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Ln=0;Ln<10;Ln++)ss[48+Ln]=ss[96+Ln]=String(Ln);for(var Ln=1;Ln<=24;Ln++)ss[Ln+111]="F"+Ln;for(var Ln=65;Ln<=90;Ln++)ss[Ln]=String.fromCharCode(Ln+32),du[Ln]=String.fromCharCode(Ln);for(var n0 in ss)du.hasOwnProperty(n0)||(du[n0]=ss[n0]);function iR(n){var e=tR&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||nR&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?du:ss)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function Tt(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var l=t[i];typeof l=="string"?n.setAttribute(i,l):l!=null&&(n[i]=l)}e++}for(;e2);var Ce={mac:cS||/Mac/.test(ni.platform),windows:/Win/.test(ni.platform),linux:/Linux|X11/.test(ni.platform),ie:Zd,ie_version:DO?px.documentMode||6:xx?+xx[1]:gx?+gx[1]:0,gecko:oS,gecko_version:oS?+(/Firefox\/(\d+)/.exec(ni.userAgent)||[0,0])[1]:0,chrome:!!i0,chrome_version:i0?+i0[1]:0,ios:cS,android:/Android\b/.test(ni.userAgent),webkit:aS,webkit_version:aS?+(/\bAppleWebKit\/(\d+)/.exec(ni.userAgent)||[0,0])[1]:0,safari:yx,safari_version:yx?+(/\bVersion\/(\d+(\.\d+)?)/.exec(ni.userAgent)||[0,0])[1]:0,tabSize:px.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function Ty(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const md=Object.create(null);function Ay(n,e,t){if(n==e)return!0;n||(n=md),e||(e=md);let i=Object.keys(n),l=Object.keys(e);if(i.length-0!=l.length-0)return!1;for(let o of i)if(o!=t&&(l.indexOf(o)==-1||n[o]!==e[o]))return!1;return!0}function rR(n,e){for(let t=n.attributes.length-1;t>=0;t--){let i=n.attributes[t].name;e[i]==null&&n.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?n.style.cssText=i:n.getAttribute(t)!=i&&n.setAttribute(t,i)}}function uS(n,e,t){let i=!1;if(e)for(let l in e)t&&l in t||(i=!0,l=="style"?n.style.cssText="":n.removeAttribute(l));if(t)for(let l in t)e&&e[l]==t[l]||(i=!0,l=="style"?n.style.cssText=t[l]:n.setAttribute(l,t[l]));return i}function lR(n){let e=Object.create(null);for(let t=0;t0?3e8:-4e8:t>0?1e8:-1e8,new ao(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,l;if(e.isBlockGap)i=-5e8,l=4e8;else{let{start:o,end:a}=RO(e,t);i=(o?t?-3e8:-1:5e8)-1,l=(a?t?2e8:1:-6e8)+1}return new ao(e,i,l,t,e.widget||null,!0)}static line(e){return new Mu(e)}static set(e,t=!1){return rt.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}Fe.none=rt.empty;class Eu extends Fe{constructor(e){let{start:t,end:i}=RO(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?Ty(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||md}eq(e){return this==e||e instanceof Eu&&this.tagName==e.tagName&&Ay(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}Eu.prototype.point=!1;class Mu extends Fe{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof Mu&&this.spec.class==e.spec.class&&Ay(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)}}Mu.prototype.mapMode=ii.TrackBefore;Mu.prototype.point=!0;class ao extends Fe{constructor(e,t,i,l,o,a){super(t,i,o,e),this.block=l,this.isReplace=a,this.mapMode=l?t<=0?ii.TrackBefore:ii.TrackAfter:ii.TrackDel}get type(){return this.startSide!=this.endSide?Pn.WidgetRange:this.startSide<=0?Pn.WidgetBefore:Pn.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof ao&&sR(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}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)}}ao.prototype.point=!0;function RO(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t??e,end:i??e}}function sR(n,e){return n==e||!!(n&&e&&n.compare(e))}function ba(n,e,t,i=0){let l=t.length-1;l>=0&&t[l]+i>=n?t[l]=Math.max(t[l],e):t.push(n,e)}class mu extends rs{constructor(e,t,i){super(),this.tagName=e,this.attributes=t,this.rank=i}eq(e){return e==this||e instanceof mu&&this.tagName==e.tagName&&Ay(this.attributes,e.attributes)}static create(e){return new mu(e.tagName,e.attributes||md,e.rank==null?50:Math.max(0,Math.min(e.rank,100)))}static set(e,t=!1){return rt.of(e,t)}}mu.prototype.startSide=mu.prototype.endSide=-1;const Cn=n=>n.nodeType==1,Aa=n=>n.nodeType==3;function pu(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function bx(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function tu(n,e){if(!e.anchorNode)return!1;try{return bx(n,e.anchorNode)}catch{return!1}}function td(n){return Aa(n)?gu(n,0,n.nodeValue.length).getClientRects():Cn(n)?n.getClientRects():[]}function nu(n,e,t,i){return t?fS(n,e,t,i,-1)||fS(n,e,t,i,1):!1}function os(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function pd(n){return Cn(n)&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function fS(n,e,t,i,l){for(;;){if(n==t&&e==i)return!0;if(e==(l<0?0:fl(n))){if(n.nodeName=="DIV")return!1;let o=n.parentNode;if(!o||!Cn(o))return!1;e=os(n)+(l<0?0:1),n=o}else if(Cn(n)){if(n=n.childNodes[e+(l<0?-1:0)],Cn(n)&&(n.nodeName=="IMG"||n.nodeName=="BR"||n.contentEditable=="false"))return!1;e=l<0?fl(n):0}else return!1}}function fl(n){return Aa(n)?n.nodeValue.length:n.childNodes.length}function gd(n,e){let{left:t,right:i}=n;if(t==i)return n;let l=e?t:i;return{left:l,right:l,top:n.top,bottom:n.bottom}}function oR(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function jO(n,e){let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function aR(n,e,t,i,l,o,a,u){let f=n.ownerDocument,d=f.defaultView||window;for(let m=n,g=!1;m&&!g;)if(Cn(m)){let b,v=m==f.body,w=1,S=1,C=!0,N=!0;if(v)b=oR(d);else{let U=getComputedStyle(m);if(/^(fixed|sticky)$/.test(U.position)&&(g=!0),(m.scrollHeight<=m.clientHeight||!/auto|scroll/.test(U.overflowY))&&(N=!1),(m.scrollWidth<=m.clientWidth||!/auto|scroll/.test(U.overflowX))&&(C=!1),!C&&!N){m=m.assignedSlot||m.parentNode;continue}let H=m.getBoundingClientRect();({scaleX:w,scaleY:S}=jO(m,H)),b={left:H.left,right:H.left+m.clientWidth*w,top:H.top,bottom:H.top+m.clientHeight*S}}let j=0,D=0;if(N)if(l=="nearest")e.top0&&e.bottom>b.bottom+D&&(D=e.bottom-b.bottom+a)):e.bottom>b.bottom-a&&(D=e.bottom-b.bottom+a,t<0&&e.top-D0&&e.right>b.right+j&&(j=e.right-b.right+o)):e.right>b.right-o&&(j=e.right-b.right+o,t<0&&e.leftb.bottom||e.leftb.right)&&(e={left:Math.max(e.left,b.left),right:Math.min(e.right,b.right),top:Math.max(e.top,b.top),bottom:Math.min(e.bottom,b.bottom)}),m=m.assignedSlot||m.parentNode}else if(m.nodeType==11)m=m.host;else break}function _O(n,e=!0){let t=n.ownerDocument,i=null,l=null;for(let o=n.parentNode;o&&!(o==t.body||(!e||i)&&l);)if(Cn(o))!l&&o.scrollHeight>o.clientHeight&&/scroll|auto/.test(getComputedStyle(o).overflowY)&&(l=o),e&&!i&&o.scrollWidth>o.clientWidth&&/scroll|auto/.test(getComputedStyle(o).overflowX)&&(i=o),o=o.assignedSlot||o.parentNode;else if(o.nodeType==11)o=o.host;else break;return{x:i,y:l}}class cR{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:i}=e;this.set(t,Math.min(e.anchorOffset,t?fl(t):0),i,Math.min(e.focusOffset,i?fl(i):0))}set(e,t,i,l){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=l}}function LO(n){let e=[];for(let t=n;t;t=t.nodeType==11?t.host:t.parentNode)Cn(t)&&e.push({node:t,left:t.scrollLeft,top:t.scrollTop});return e}function zO(n,e=!0){for(let{node:t,left:i,top:l}of n)e&&t.scrollTop!=l&&(t.scrollTop=l),t.scrollLeft!=i&&(t.scrollLeft=i)}let Gs=null;Ce.safari&&Ce.safari_version>=26&&(Gs=!1);function BO(n){if(n.setActive)return n.setActive();if(Gs)return n.focus(Gs);let e=LO(n);n.focus(Gs==null?{get preventScroll(){return Gs={preventScroll:!0},!0}}:void 0),Gs||(Gs=!1,zO(e))}let hS;function gu(n,e,t=e){let i=hS||(hS=document.createRange());return i.setEnd(n,t),i.setStart(n,e),i}function va(n,e,t,i){let l={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:l.altKey,ctrlKey:l.ctrlKey,shiftKey:l.shiftKey,metaKey:l.metaKey}=i);let o=new KeyboardEvent("keydown",l);o.synthetic=!0,n.dispatchEvent(o);let a=new KeyboardEvent("keyup",l);return a.synthetic=!0,n.dispatchEvent(a),o.defaultPrevented||a.defaultPrevented}function uR(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function fR(n,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,fl(t));;)if(i){if(!Cn(t))return!1;let l=t.childNodes[i-1];l.contentEditable=="false"?i--:(t=l,i=fl(t))}else{if(t==n)return!0;i=os(t),t=t.parentNode}}function PO(n){return n instanceof Window?n.pageYOffset>Math.max(0,n.document.documentElement.scrollHeight-n.innerHeight-4):n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function HO(n,e){for(let t=n,i=e;;){if(Aa(t)&&i>0)return{node:t,offset:i};if(Cn(t)&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=fl(t)}else if(t.parentNode&&!pd(t))i=os(t),t=t.parentNode;else return null}}function IO(n,e){for(let t=n,i=e;;){if(Aa(t)&&i=t){if(u.level==i)return a;(o<0||(l!=0?l<0?u.fromt:e[o].level>u.level))&&(o=a)}}if(o<0)throw new RangeError("Index out of range");return o}}function qO(n,e){if(n.length!=e.length)return!1;for(let t=0;t=0;S-=3)if(Nr[S+1]==-v){let C=Nr[S+2],N=C&2?l:C&4?C&1?o:l:0;N&&(jt[g]=jt[Nr[S]]=N),u=S;break}}else{if(Nr.length==189)break;Nr[u++]=g,Nr[u++]=b,Nr[u++]=f}else if((w=jt[g])==2||w==1){let S=w==l;f=S?0:1;for(let C=u-3;C>=0;C-=3){let N=Nr[C+2];if(N&2)break;if(S)Nr[C+2]|=2;else{if(N&4)break;Nr[C+2]|=4}}}}}function xR(n,e,t,i){for(let l=0,o=i;l<=t.length;l++){let a=l?t[l-1].to:n,u=lf;)w==C&&(w=t[--S].from,C=S?t[S-1].to:n),jt[--w]=v;f=m}else o=d,f++}}}function wx(n,e,t,i,l,o,a){let u=i%2?2:1;if(i%2==l%2)for(let f=e,d=0;ff&&a.push(new Lr(f,S.from,v));let C=S.direction==Ea!=!(v%2);kx(n,C?i+1:i,l,S.inner,S.from,S.to,a),f=S.to}w=S.to}else{if(w==t||(m?jt[w]!=u:jt[w]==u))break;w++}b?wx(n,f,w,i+1,l,b,a):fe;){let m=!0,g=!1;if(!d||f>o[d-1].to){let S=jt[f-1];S!=u&&(m=!1,g=S==16)}let b=!m&&u==1?[]:null,v=m?i:i+1,w=f;e:for(;;)if(d&&w==o[d-1].to){if(g)break e;let S=o[--d];if(!m)for(let C=S.from,N=d;;){if(C==e)break e;if(N&&o[N-1].to==C)C=o[--N].from;else{if(jt[C-1]==u)break e;break}}if(b)b.push(S);else{S.tojt.length;)jt[jt.length]=256;let i=[],l=e==Ea?0:1;return kx(n,l,l,t,0,n.length,i),i}function VO(n){return[new Lr(0,n,0)]}let QO="";function bR(n,e,t,i,l){var o;if(!n.length)return null;let a=i.head-n.from,u;if(i.head==n.from&&i.assoc<0){if(!l)return null;a=e[u=0].side(!1,t)}else if(i.head==n.to&&i.assoc>0){if(l)return null;a=e[u=e.length-1].side(!0,t)}else u=Lr.find(e,a,(o=i.bidiLevel)!==null&&o!==void 0?o:-1,i.assoc);let f=e[u],d=f.side(l,t);if(a==d){let b=u+=l?1:-1;if(b<0||b>=e.length)return null;f=e[u=b],a=f.side(!l,t),d=f.side(l,t)}let m=Sn(n.text,a,f.forward(l,t));(mf.to)&&(m=d),QO=n.text.slice(Math.min(a,m),Math.max(a,m));let g=u==(l?e.length-1:0)?null:e[u+(l?1:-1)];if(m==d){if(!g)return l?le.cursor(n.to,1):le.cursor(n.from,-1);if(g.level+(l?0:1)n.some(e=>e)}),JO=Ne.define({combine:n=>n.some(e=>e)}),eN=Ne.define();class wa{constructor(e,t,i,l,o,a=!1){this.range=e,this.y=t,this.x=i,this.yMargin=l,this.xMargin=o,this.isSnapshot=a}map(e){return e.empty?this:new wa(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new wa(le.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const bh=Ke.define({map:(n,e)=>n.map(e)}),tN=Ke.define();function yi(n,e,t){let i=n.facet(GO);i.length?i[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const al=Ne.define({combine:n=>n.length?n[0]:!0});let wR=0;const da=Ne.define({combine(n){return n.filter((e,t)=>{for(let i=0;i{let f=[];return a&&f.push(Jd.of(d=>{let m=d.plugin(u);return m?a(m):Fe.none})),o&&f.push(o(u)),f})}static fromClass(e,t){return en.define((i,l)=>new e(i,l),t)}}class r0{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(yi(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){yi(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){yi(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const nN=Ne.define(),Ry=Ne.define(),Jd=Ne.define(),iN=Ne.define(),jy=Ne.define(),Du=Ne.define(),rN=Ne.define();function dS(n,e){let t=n.state.facet(rN);if(!t.length)return t;let i=t.map(o=>o instanceof Function?o(n):o),l=[];return rt.spans(i,e.from,e.to,{point(){},span(o,a,u,f){let d=o-e.from,m=a-e.from,g=l;for(let b=u.length-1;b>=0;b--,f--){let v=u[b].spec.bidiIsolate,w;if(f>0&&g.length&&(w=g[g.length-1]).to==d&&w.direction==v)w.to=m,g=w.inner;else{let S={from:d,to:m,direction:v,inner:[]};g.push(S),g=S.inner}}}}),lN(e.text,l)}function lN(n,e){for(let t of e){if(t.direction==null){for(let i=t.from,l=0;i0;t--){let l=e[t-1];if(!(l.fromA>i.toA)){if(l.toAl.push(new Xi(o,a,u,f))),this.changedRanges=l}static create(e,t,i){return new xd(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const kR=[];class Gt{constructor(e,t,i=0){this.dom=e,this.length=t,this.flags=i,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return kR}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&rR(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let i=t;for(let l of this.children){if(l==e)return i;i+=l.length+l.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,i){return null}domPosFor(e,t){let i=os(this.dom),l=this.length?e>0:t>0;return new ar(this.parent.dom,i+(l?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof tm)return e;return null}static get(e){return e.cmTile}}class em extends Gt{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,i=null,l,o=(e==null?void 0:e.node)==t?e:null,a=0;for(let u of this.children){if(u.sync(e),a+=u.length+u.breakAfter,l=i?i.nextSibling:t.firstChild,o&&l!=u.dom&&(o.written=!0),u.dom.parentNode==t)for(;l&&l!=u.dom;)l=mS(l);else t.insertBefore(u.dom,l);i=u.dom}for(l=i?i.nextSibling:t.firstChild,o&&l&&(o.written=!0);l;)l=mS(l);this.length=a}}function mS(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class tm extends em{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=Gt.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],i=this,l=0,o=0;;)if(l==i.children.length){if(!t.length)return;i=i.parent,i.breakAfter&&o++,l=t.pop()}else{let a=i.children[l++];if(a instanceof cl)t.push(l),i=a,l=0;else{let u=o+a.length,f=e(a,o);if(f!==void 0)return f;o=u+a.breakAfter}}}resolveBlock(e,t){let i,l=-1,o,a=-1;if(this.blockTiles((u,f)=>{let d=f+u.length;if(e>=f&&e<=d){if(u.isWidget()&&t>=-1&&t<=1){if(u.flags&32)return!0;u.flags&16&&(i=void 0)}(fe||e==f&&(t>1?u.length:u.covers(-1)))&&(!o||!u.isWidget()&&o.isWidget())&&(o=u,a=e-f)}}),!i&&!o)throw new Error("No tile at position "+e);return i&&t<0||!o?{tile:i,offset:l}:{tile:o,offset:a}}}class cl extends em{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let i=new cl(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}}class Ma extends em{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,i){let l=new Ma(t||document.createElement("div"),e);return(!t||!i)&&(l.flags|=4),l}get domAttrs(){return this.attrs}resolveInline(e,t,i=!1){let l=null,o=-1,a=null,u=-1;function f(m,g){for(let b=0,v=0;b=g&&(w.isComposite()?f(w,g-v):(!a||i&&a.isHidden&&(t>0&&!(a.flags&32)||i&&CR(a,w)))&&(S>g||w.flags&32&&t<=1)?(a=w,u=g-v):(v=-1)&&(l=w,o=g-v)),v=S}}f(this,e);let d=(t<0?l:a)||l||a;return d?{tile:d,offset:d==l?o:u}:null}coordsIn(e,t,i){let l=this.resolveInline(e,t,!0);return l?l.tile.coordsIn(Math.max(0,l.offset),t,i):SR(this)}domIn(e,t){let i=this.resolveInline(e,t);if(i){let{tile:l,offset:o}=i;if(this.dom.contains(l.dom))return l.isText()?new ar(l.dom,Math.min(l.dom.nodeValue.length,o)):l.domPosFor(o,l.flags&16?1:l.flags&32?-1:t);let a=i.tile.parent,u=!1;for(let f of a.children){if(u)return new ar(f.dom,0);f==i.tile&&(u=!0)}}return new ar(this.dom,0)}}function SR(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=td(e);return t[t.length-1]||null}function CR(n,e){let t=n.coordsIn(0,1),i=e.coordsIn(0,1);return t&&i&&i.topl&&(e=l);let o=e,a=e,u=0;e==0&&t<0||e==l&&t>=0?Ce.chrome||Ce.gecko||(e?(o--,u=1):a=0)?0:f.length-1];return Ce.safari&&!u&&d.width==0&&(d=Array.prototype.find.call(f,m=>m.width)||d),i==null?d:gd(d,(u?u>0:t<0)==i)}static of(e,t){let i=new eo(t||document.createTextNode(e),e);return t||(i.flags|=2),i}}class co extends Gt{constructor(e,t,i,l){super(e,t,l),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,i){let l=this.widget.coordsAt(this.dom,e,t);if(l)return l;if(i)return gd(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let o=this.dom.getClientRects(),a=null;if(!o.length)return null;let u=this.flags&16?!0:this.flags&32?!1:e>0;for(let f=u?o.length-1:0;a=o[f],!(e>0?f==0:f==o.length-1||a.top0==i)}}class OR{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,i){let{tile:l,index:o,beforeBreak:a,parents:u}=this;for(;e||t>0;)if(l.isComposite())if(a){if(!e)break;i&&i.break(),e--,a=!1}else if(o==l.children.length){if(!e&&!u.length)break;i&&i.leave(l),a=!!l.breakAfter,{tile:l,index:o}=u.pop(),o++}else{let f=l.children[o],d=f.breakAfter;(t>0?f.length<=e:f.length=0;u--){let f=t.marks[u],d=l.lastChild;if(d instanceof xi&&d.mark.eq(f.mark))d.dom!=f.dom&&d.setDOM(l0(f.dom)),l=d;else{let{dom:m}=f;this.cache.reused.get(f)&&Gt.get(f.dom)&&(m=l0(f.dom));let g=xi.of(f.mark,m);l.append(g),l=g}this.cache.reused.set(f,2)}let o=Gt.get(e.text);o&&this.cache.reused.set(o,2);let a=new eo(e.text,e.text.nodeValue);a.flags|=8,this.pos=e.range.toB,l.append(a)}addInlineWidget(e,t,i){let l=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);l||this.flushBuffer();let o=this.ensureMarks(t,i);!l&&!(e.flags&16)&&o.append(this.getBuffer(1)),o.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,i){this.flushBuffer(),this.ensureMarks(t,i).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var i;e||(e=oN);let l=Ma.start(e,t||((i=this.cache.find(Ma))===null||i===void 0?void 0:i.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=l)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var i;let l=this.curLine;for(let o=e.length-1;o>=0;o--){let a=e[o],u;if(t>0&&(u=l.lastChild)&&u instanceof xi&&u.mark.eq(a))l=u,t--;else{let f=xi.of(a,(i=this.cache.find(xi,d=>d.mark.eq(a)))===null||i===void 0?void 0:i.dom);l.append(f),l=f,t=0}}return l}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!pS(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(Ce.ios&&pS(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(s0,0,32)||new co(s0.toDOM(),0,s0,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to=this.pos){let t=e.rank*102+e.value.rank,i=new NR(e.from,e.to,e.value,t),l=this.wrappers.length;for(;l>0&&(this.wrappers[l-1].rank-i.rank||this.wrappers[l-1].to-i.to)<0;)l--;this.wrappers.splice(l,0,i)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let i of this.wrappers){let l=t.lastChild;if(i.froma.wrapper.eq(i.wrapper)))===null||e===void 0?void 0:e.dom);t.append(o),t=o}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),i=this.cache.find(yd,void 0,1);return i&&(i.flags=t),i||new yd(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class AR{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:l,lineBreak:o,done:a}=this.cursor.next(this.skipCount);if(this.skipCount=0,a)throw new Error("Ran out of text content when drawing inline views");this.text=l;let u=this.textOff=Math.min(e,l.length);return o?null:l.slice(0,u)}let t=Math.min(this.text.length,this.textOff+e),i=this.text.slice(this.textOff,t);return this.textOff=t,i}}const bd=[co,Ma,eo,xi,yd,cl,tm];for(let n=0;n[]),this.index=bd.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,i=this.buckets[t];i.length<6?i.push(e):i[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,i=2){let l=e.bucket,o=this.buckets[l],a=this.index[l];for(let u=0;u{if(this.cache.add(a),a.isComposite())return!1},enter:a=>this.cache.add(a),leave:()=>{},break:()=>{}}}run(e,t){let i=t&&this.getCompositionContext(t.text);for(let l=0,o=0,a=0;;){let u=al){let d=f-l;this.preserve(d,!a,!u),l=f,o+=d}if(!u)break;t&&u.fromA<=t.range.fromA&&u.toA>=t.range.toA?(this.forward(u.fromA,t.range.fromA,t.range.fromA{if(a.isWidget())if(this.openWidget)this.builder.continueWidget(f-u);else{let d=f>0||u{a.isLine()?this.builder.addLineStart(a.attrs,this.cache.maybeReuse(a)):(this.cache.add(a),a instanceof xi&&l.unshift(a.mark)),this.openWidget=!1},leave:a=>{a.isLine()?l.length&&(l.length=o=0):a instanceof xi&&(l.shift(),o=Math.min(o,l.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let i=null,l=this.builder,o=-1,a=rt.spans(this.decorations,e,t,{point:(u,f,d,m,g,b)=>{if(d instanceof ao){if(this.disallowBlockEffectsFor[b]){if(d.block)throw new RangeError("Block decorations may not be specified via plugins");if(f>this.view.state.doc.lineAt(u).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(o=m.length,g>m.length)l.continueWidget(f-u);else{let v=d.widget||(d.block?Da.block:Da.inline),w=DR(d),S=this.cache.findWidget(v,f-u,w)||co.of(v,this.view,f-u,w);d.block?(d.startSide>0&&l.addLineStartIfNotCovered(i),l.addBlockWidget(S)):(l.ensureLine(i),l.addInlineWidget(S,m,g))}i=null}else i=RR(i,d);f>u&&this.text.skip(f-u)},span:(u,f,d,m)=>{for(let g=u;g-1&&(this.openWidget=a>o),this.openWidget||l.addLineStartIfNotCovered(i),this.openMarks=a}forward(e,t,i=1){t-e<=10?this.old.advance(t-e,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(e){let t=[],i=null;for(let l=e.parentNode;;l=l.parentNode){let o=Gt.get(l);if(l==this.view.contentDOM)break;o instanceof xi?t.push(o):o!=null&&o.isLine()?i=o:o instanceof cl||(l.nodeName=="DIV"&&!i?i=new Ma(l,oN):i||t.push(xi.of(new Eu({tagName:l.nodeName.toLowerCase(),attributes:lR(l)}),l)))}return i?{line:i,marks:t}:null}}function pS(n,e){let t=i=>{for(let l of i.children)if((e?l.isText():l.length)||t(l))return!0;return!1};return t(n)}function DR(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}const oN={class:"cm-line"};function RR(n,e){let t=e.spec.attributes,i=e.spec.class;return!t&&!i||(n||(n={class:"cm-line"}),t&&Ty(t,n),i&&(n.class+=" "+i)),n}function jR(n){let e=[];for(let t=n.parents.length;t>1;t--){let i=t==n.parents.length?n.tile:n.parents[t].tile;i instanceof xi&&e.push(i.mark)}return e}function l0(n){let e=Gt.get(n);return e&&e.setDOM(n.cloneNode()),n}class Da extends pl{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}}Da.inline=new Da("span");Da.block=new Da("div");const s0=new class extends pl{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class gS{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Fe.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new tm(e,e.contentDOM),this.updateInner([new Xi(0,0,0,e.state.doc.length)],null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:m,toA:g})=>gthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let l=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?l=this.domChanged.newSel.head:!FR(e.changes,this.hasComposition)&&!e.selectionSet&&(l=e.state.selection.main.head));let o=l>-1?LR(this.view,e.changes,l):null;if(this.domChanged=null,this.hasComposition){let{from:m,to:g}=this.hasComposition;i=new Xi(m,g,e.changes.mapPos(m,-1),e.changes.mapPos(g,1)).addToSet(i.slice())}this.hasComposition=o?{from:o.range.fromB,to:o.range.toB}:null,(Ce.ie||Ce.chrome)&&!o&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let a=this.decorations,u=this.blockWrappers;this.updateDeco();let f=PR(a,this.decorations,e.changes);f.length&&(i=Xi.extendWithRanges(i,f));let d=IR(u,this.blockWrappers,e.changes);return d.length&&(i=Xi.extendWithRanges(i,d)),o&&!i.some(m=>m.fromA<=o.range.fromA&&m.toA>=o.range.toA)&&(i=o.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,o),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(t||e.length){let a=this.tile,u=new MR(this.view,a,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&Gt.get(t.text)&&u.cache.reused.set(Gt.get(t.text),2),this.tile=u.run(e,t),Cx(a,u.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let o=Ce.chrome||Ce.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(o),o&&(o.written||i.selectionRange.focusNode!=o.node||!this.tile.dom.contains(o.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let l=[];if(this.view.viewport.from||this.view.viewport.to-1)&&tu(i,this.view.observer.selectionRange)&&!(l&&i.contains(l));if(!(o||t||a))return;let u=this.forceSelection;this.forceSelection=!1;let f=this.view.state.selection.main,d,m;if(f.empty?m=d=this.inlineDOMNearPos(f.anchor,f.assoc||1):(m=this.inlineDOMNearPos(f.head,f.head==f.from?1:-1),d=this.inlineDOMNearPos(f.anchor,f.anchor==f.from?1:-1)),Ce.gecko&&f.empty&&!this.hasComposition&&_R(d)){let b=document.createTextNode("");this.view.observer.ignore(()=>d.node.insertBefore(b,d.node.childNodes[d.offset]||null)),d=m=new ar(b,0),u=!0}let g=this.view.observer.selectionRange;(u||!g.focusNode||(!nu(d.node,d.offset,g.anchorNode,g.anchorOffset)||!nu(m.node,m.offset,g.focusNode,g.focusOffset))&&!this.suppressWidgetCursorChange(g,f))&&(this.view.observer.ignore(()=>{Ce.android&&Ce.chrome&&i.contains(g.focusNode)&&UR(g.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let b=pu(this.view.root);if(b)if(f.empty){if(Ce.gecko){let v=zR(d.node,d.offset);if(v&&v!=3){let w=(v==1?HO:IO)(d.node,d.offset);w&&(d=new ar(w.node,w.offset))}}b.collapse(d.node,d.offset),f.bidiLevel!=null&&b.caretBidiLevel!==void 0&&(b.caretBidiLevel=f.bidiLevel)}else if(b.extend){b.collapse(d.node,d.offset);try{b.extend(m.node,m.offset)}catch{}}else{let v=document.createRange();f.anchor>f.head&&([d,m]=[m,d]),v.setEnd(m.node,m.offset),v.setStart(d.node,d.offset),b.removeAllRanges(),b.addRange(v)}a&&this.view.root.activeElement==i&&(i.blur(),l&&l.focus())}),this.view.observer.setSelectionRange(d,m)),this.impreciseAnchor=d.precise?null:new ar(g.anchorNode,g.anchorOffset),this.impreciseHead=m.precise?null:new ar(g.focusNode,g.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&nu(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=pu(e.root),{anchorNode:l,anchorOffset:o}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let a=this.lineAt(t.head,t.assoc);if(!a)return;let u=a.posAtStart;if(t.head==u||t.head==u+a.length)return;let f=this.coordsAt(t.head,-1),d=this.coordsAt(t.head,1);if(!f||!d||f.bottom>d.top)return;let m=this.domAtPos(t.head+t.assoc,t.assoc);i.collapse(m.node,m.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let g=e.observer.selectionRange;e.docView.posFromDOM(g.anchorNode,g.anchorOffset)!=t.from&&i.collapse(l,o)}posFromDOM(e,t){let i=this.tile.nearest(e);if(!i)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let l=i.posAtStart;if(i.isComposite()){let o;if(e==i.dom)o=i.dom.childNodes[t];else{let a=fl(e)==0?0:t==0?-1:1;for(;;){let u=e.parentNode;if(u==i.dom)break;a==0&&u.firstChild!=u.lastChild&&(e==u.firstChild?a=-1:a=1),e=u}a<0?o=e:o=e.nextSibling}if(o==i.dom.firstChild)return l;for(;o&&!Gt.get(o);)o=o.nextSibling;if(!o)return l+i.length;for(let a=0,u=l;;a++){let f=i.children[a];if(f.dom==o)return u;u+=f.length+f.breakAfter}}else return i.isText()?e==i.dom?l+t:l+(t?i.length:0):l}domAtPos(e,t){let{tile:i,offset:l}=this.tile.resolveBlock(e,t);return i.isWidget()?i.domPosFor(l,t):i.domIn(l,t)}inlineDOMNearPos(e,t){let i,l=-1,o=!1,a,u=-1,f=!1;return this.tile.blockTiles((d,m)=>{if(d.isWidget()){if(d.flags&32&&m>=e)return!0;d.flags&16&&(o=!0)}else{let g=m+d.length;if(m<=e&&(i=d,l=e-m,o=g=e&&!a&&(a=d,u=e-m,f=m>e),m>e&&a)return!0}}),!i&&!a?this.domAtPos(e,t):(o&&a?i=null:f&&i&&(a=null),i&&t<0||!a?i.domIn(l,t):a.domIn(u,t))}coordsAt(e,t,i){let{tile:l,offset:o}=this.tile.resolveBlock(e,t);return l.isWidget()?l.widget instanceof o0?null:l.coordsInWidget(o,t,!0):l.coordsIn(o,t,i)}lineAt(e,t){let{tile:i}=this.tile.resolveBlock(e,t);return i.isLine()?i:null}coordsForChar(e){let{tile:t,offset:i}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function l(o,a){if(o.isComposite())for(let u of o.children){if(u.length>=a){let f=l(u,a);if(f)return f}if(a-=u.length,a<0)break}else if(o.isText()&&aMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,u=-1,f=this.view.textDirection==At.LTR,d=0,m=(g,b,v)=>{for(let w=0;wl);w++){let S=g.children[w],C=b+S.length,N=S.dom.getBoundingClientRect(),{height:j}=N;if(v&&!w&&(d+=N.top-v.top),S instanceof cl)C>i&&m(S,b,N);else if(b>=i&&(d>0&&t.push(-d),t.push(j+d),d=0,a)){let D=S.dom.lastChild,U=D?td(D):[];if(U.length){let H=U[U.length-1],M=f?H.right-N.left:N.right-H.left;M>u&&(u=M,this.minWidth=o,this.minWidthFrom=b,this.minWidthTo=C)}}v&&w==g.children.length-1&&(d+=v.bottom-N.bottom),b=C+S.breakAfter}};return m(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?At.RTL:At.LTR}measureTextSize(){let e=this.tile.blockTiles(a=>{if(a.isLine()&&a.children.length&&a.length<=20){let u=0,f;for(let d of a.children){if(!d.isText()||/[^ -~]/.test(d.text))return;let m=td(d.dom);if(m.length!=1)return;u+=m[0].width,f=m[0].height}if(u)return{lineHeight:a.dom.getBoundingClientRect().height,charWidth:u/a.length,textHeight:f}}});if(e)return e;let t=document.createElement("div"),i,l,o;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let a=td(t.firstChild)[0];i=t.getBoundingClientRect().height,l=a&&a.width?a.width/27:7,o=a&&a.height?a.height:i,t.remove()}),{lineHeight:i,charWidth:l,textHeight:o}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,l=0;;l++){let o=l==t.viewports.length?null:t.viewports[l],a=o?o.from-1:this.view.state.doc.length;if(a>i){let u=(t.lineBlockAt(a).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(Fe.replace({widget:new o0(u),block:!0,inclusive:!0,isBlockGap:!0}).range(i,a))}if(!o)break;i=o.to+1}return Fe.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Jd).map(o=>(this.dynamicDecorationMap[e++]=typeof o=="function")?o(this.view):o),i=!1,l=this.view.state.facet(jy).map((o,a)=>{let u=typeof o=="function";return u&&(i=!0),u?o(this.view):o});for(l.length&&(this.dynamicDecorationMap[e++]=i,t.push(rt.join(l))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];etypeof o=="function"?o(this.view):o)}scrollIntoView(e){if(e.isSnapshot){let d=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=d.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let d of this.view.state.facet(eN))try{if(d(this.view,e.range,e))return!0}catch(m){yi(this.view.state,m,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),l;if(!i)return;!t.empty&&(l=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,l.left),top:Math.min(i.top,l.top),right:Math.max(i.right,l.right),bottom:Math.max(i.bottom,l.bottom)});let o=_y(this.view),a={left:i.left-o.left,top:i.top-o.top,right:i.right+o.right,bottom:i.bottom+o.bottom},{offsetWidth:u,offsetHeight:f}=this.view.scrollDOM;if(aR(this.view.scrollDOM,a,t.head1&&(i.top>window.visualViewport.offsetTop+window.visualViewport.height||i.bottomi.isWidget()||i.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){Cx(this.tile)}}function Cx(n,e){let t=e==null?void 0:e.get(n);if(t!=1){t==null&&n.destroy();for(let i of n.children)Cx(i,e)}}function _R(n){return Cn(n.node)&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function aN(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let i=HO(t.focusNode,t.focusOffset),l=IO(t.focusNode,t.focusOffset),o=i||l;if(l&&i&&l.node!=i.node){let u=Gt.get(l.node);if(!u||u.isText()&&u.text!=l.node.nodeValue)o=l;else if(n.docView.lastCompositionAfterCursor){let f=Gt.get(i.node);!f||f.isText()&&f.text!=i.node.nodeValue||(o=l)}}if(n.docView.lastCompositionAfterCursor=o!=i,!o)return null;let a=e-o.offset;return{from:a,to:a+o.node.nodeValue.length,node:o.node}}function LR(n,e,t){let i=aN(n,t);if(!i)return null;let{node:l,from:o,to:a}=i,u=l.nodeValue;if(/[\n\r]/.test(u)||n.state.doc.sliceString(i.from,i.to)!=u)return null;let f=e.invertedDesc;return{range:new Xi(f.mapPos(o),f.mapPos(a),o,a),text:l}}function zR(n,e){return Cn(n)?(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e{ie.from&&(t=!0)}),t}class o0 extends pl{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function qR(n,e,t=1){let i=n.charCategorizer(e),l=n.doc.lineAt(e),o=e-l.from;if(l.length==0)return le.cursor(e);o==0?t=1:o==l.length&&(t=-1);let a=o,u=o;t<0?a=Sn(l.text,o,!1):u=Sn(l.text,o);let f=i(l.text.slice(a,u));for(;a>0;){let d=Sn(l.text,a,!1);if(i(l.text.slice(d,a))!=f)break;a=d}for(;un.defaultLineHeight*1.5){let u=n.viewState.heightOracle.textHeight,f=Math.floor((l-t.top-(n.defaultLineHeight-u)*.5)/u);o+=f*n.viewState.heightOracle.lineLength}let a=n.state.sliceDoc(t.from,t.to);return t.from+hx(a,o,n.state.tabSize)}function Ox(n,e,t){let i=n.lineBlockAt(e);if(Array.isArray(i.type)){let l;for(let o of i.type){if(o.from>e)break;if(!(o.toe)return o;(!l||o.type==Pn.Text&&(l.type!=o.type||(t<0?o.frome)))&&(l=o)}}return l||i}return i}function QR(n,e,t,i){let l=Ox(n,e.head,e.assoc||-1),o=!i||l.type!=Pn.Text||!(n.lineWrapping||l.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>l.from?e.head-1:e.head);if(o){let a=n.dom.getBoundingClientRect(),u=n.textDirectionAt(l.from),f=n.posAndSideAtCoords({x:t==(u==At.LTR)?a.right-1:a.left+1,y:(o.top+o.bottom)/2});if(f)return le.cursor(f.pos,f.assoc)}return le.cursor(t?l.to:l.from,t?1:-1)}function xS(n,e,t,i){let l=n.state.doc.lineAt(e.head),o=n.bidiSpans(l),a=n.textDirectionAt(l.from);for(let u=e,f=null;;){let d=bR(l,o,a,u,t),m=QO;if(!d){if(l.number==(t?n.state.doc.lines:1))return u;m=` +`,l=n.state.doc.line(l.number+(t?1:-1)),o=n.bidiSpans(l),d=t?le.cursor(l.from,-1):le.cursor(l.to,1)}if(f){if(!f(m))return u}else{if(!i)return d;f=i(m)}u=d}}function XR(n,e,t){let i=n.state.charCategorizer(e),l=i(t);return o=>{let a=i(o);return l==Ut.Space&&(l=a),l==a}}function $R(n,e,t,i){let l=e.head,o=t?1:-1;if(l==(t?n.state.doc.length:0))return le.cursor(l,e.assoc);let a=e.goalColumn,u,f=n.contentDOM.getBoundingClientRect(),d=n.coordsAtPos(l,e.assoc||((e.empty?t:e.head==e.from)?1:-1)),m=n.documentTop;if(d)a==null&&(a=d.left-f.left),u=o<0?d.top:d.bottom;else{let w=n.viewState.lineBlockAt(l);a==null&&(a=Math.min(f.right-f.left,n.defaultCharacterWidth*(l-w.from))),u=(o<0?w.top:w.bottom)+m}let g=f.left+a,b=n.viewState.heightOracle.textHeight>>1,v=i??b;for(let w=0;;w+=b){let S=u+(v+w)*o,C=Nx(n,{x:g,y:S},!1,o);if(t?S>f.bottom:Su:j{if(e>o&&el(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:le.cursor(i,in.viewState.docHeight)return new _r(n.state.doc.length,-1);if(d=n.elementAtHeight(f),i==null)break;if(d.type==Pn.Text){if(i<0?d.ton.viewport.to)break;let b=n.docView.coordsAt(i<0?d.from:d.to,i>0?-1:1);if(b&&(i<0?b.top<=f+o:b.bottom>=f+o))break}let g=n.viewState.heightOracle.textHeight/2;f=i>0?d.bottom+g:d.top-g}if(n.viewport.from>=d.to||n.viewport.to<=d.from){if(t)return null;if(d.type==Pn.Text){let g=VR(n,l,d,a,u);return new _r(g,g==d.from?1:-1)}}if(d.type!=Pn.Text)return f<(d.top+d.bottom)/2?new _r(d.from,1):new _r(d.to,-1);let m=n.docView.lineAt(d.from,2);return(!m||m.length!=d.length)&&(m=n.docView.lineAt(d.from,-2)),new YR(n,a,u,n.textDirectionAt(d.from)).scanTile(m,d.from)}class YR{constructor(e,t,i,l){this.view=e,this.x=t,this.y=i,this.baseDir=l,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to1||i.length&&(i[0].level!=this.baseDir||i[0].to+l.from>1;t:if(a.has(S)){for(let j=1;j=o&&(D-=w),!a.has(D)){S=D;break t}}break e}a.add(S);let C=t(S),N=0;if(C)for(let j=0;j1))if(D.bottomthis.y)(!d||d.top>D.top)&&(d=D),N=-1;else{let U=D.left>this.x?this.x-D.left:D.right(w+w+S)/3)return this.y=f.bottom-1,this.scan(e,t,!0);if(d&&d.top<(w+S+S)/3)return this.y=d.top+1,this.scan(e,t,!0)}let v=(u?this.dirAt(e[m],1):this.baseDir)==At.LTR;return{i:m,after:this.x>(b.left+b.right)/2==v}}scanText(e,t){let i=[];for(let o=0;o{let a=i[o]-t,u=i[o+1]-t;return gu(e.dom,a,u).getClientRects()});return l.after?new _r(i[l.i+1],-1):new _r(i[l.i],1)}scanTile(e,t){if(!e.length)return new _r(t,1);if(e.children.length==1){let u=e.children[0];if(u.isText())return this.scanText(u,t);if(u.isComposite())return this.scanTile(u,t)}let i=[t];for(let u=0,f=t;u{let f=e.children[u];return f.flags&48?null:(Cn(f.dom)?f.dom:gu(f.dom,0,f.length)).getClientRects()}),o=e.children[l.i],a=i[l.i];return o.isText()?this.scanText(o,a):o.isComposite()?this.scanTile(o,a):l.after?new _r(i[l.i+1],-1):new _r(a,1)}}const sa="￿";class GR{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(pt.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=sa}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let l=e;;){this.findPointBefore(i,l);let o=this.text.length;this.readNode(l);let a=Gt.get(l),u=l.nextSibling;if(u==t){a!=null&&a.breakAfter&&!u&&i!=this.view.contentDOM&&this.lineBreak();break}let f=Gt.get(u);(a&&f?a.breakAfter:(a?a.breakAfter:pd(l))||pd(u)&&(l.nodeName!="BR"||a!=null&&a.isWidget())&&this.text.length>o)&&!WR(u,t)&&this.lineBreak(),l=u}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,l=this.lineSeparator?null:/\r\n?|\n/g;;){let o=-1,a=1,u;if(this.lineSeparator?(o=t.indexOf(this.lineSeparator,i),a=this.lineSeparator.length):(u=l.exec(t))&&(o=u.index,a=u[0].length),this.append(t.slice(i,o<0?t.length:o)),o<0)break;if(this.lineBreak(),a>1)for(let f of this.points)f.node==e&&f.pos>this.text.length&&(f.pos-=a-1);i=o+a}}readNode(e){let t=Gt.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let l=i.iter();!l.next().done;)l.lineBreak?this.lineBreak():this.append(l.value)}else Aa(e)?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():Cn(e)&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(Aa(e)?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(KR(e,i.node,i.offset)?t:0))}}function KR(n,e,t){for(;;){if(!e||t-1;let{impreciseHead:o,impreciseAnchor:a}=e.docView,u=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=uN(e.docView.tile,t,i,0))){let f=o||a?[]:ej(e),d=new GR(f,e);d.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=d.text,this.newSel=tj(f,this.bounds.from)}else{let f=e.observer.selectionRange,d=o&&o.node==f.focusNode&&o.offset==f.focusOffset||!bx(e.contentDOM,f.focusNode)?u.main.head:e.docView.posFromDOM(f.focusNode,f.focusOffset),m=a&&a.node==f.anchorNode&&a.offset==f.anchorOffset||!bx(e.contentDOM,f.anchorNode)?u.main.anchor:e.docView.posFromDOM(f.anchorNode,f.anchorOffset),g=e.viewport;if((Ce.ios||Ce.chrome)&&d!=m&&Math.min(d,m)<=u.main.from&&Math.max(d,m)>=u.main.to&&(g.from>0||g.to-1&&u.ranges.length>1)this.newSel=u.replaceRange(le.range(m,d));else if(e.lineWrapping&&m==d&&!(u.main.empty&&u.main.head==d)&&e.inputState.lastTouchTime>Date.now()-100){let b=e.coordsAtPos(d,-1),v=0;b&&(v=e.inputState.lastTouchY<=b.bottom?-1:1),this.newSel=le.create([le.cursor(d,v)])}else this.newSel=le.single(m,d)}}}function uN(n,e,t,i){if(n.isComposite()){let l=-1,o=-1,a=-1,u=-1;for(let f=0,d=i,m=i;ft)return uN(g,e,t,d);if(b>=e&&l==-1&&(l=f,o=d),d>t&&g.dom.parentNode==n.dom){a=f,u=m;break}m=b,d=b+g.breakAfter}return{from:o,to:u<0?i+n.length:u,startDOM:(l?n.children[l-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:a=0?n.children[a].dom:null}}else return n.isText()?{from:i,to:i+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function fN(n,e){let t,{newSel:i}=e,{state:l}=n,o=l.selection.main,a=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:u,to:f}=e.bounds,d=o.from,m=null;(a===8||Ce.android&&e.text.length=u&&o.to<=f&&(e.typeOver||g!=e.text)&&g.slice(0,o.from-u)==e.text.slice(0,o.from-u)&&g.slice(o.to-u)==e.text.slice(b=e.text.length-(g.length-(o.to-u)))?t={from:o.from,to:o.to,insert:dt.of(e.text.slice(o.from-u,b).split(sa))}:(v=hN(g,e.text,d-u,m))&&(Ce.chrome&&a==13&&v.toB==v.from+2&&e.text.slice(v.from,v.toB)==sa+sa&&v.toB--,t={from:u+v.from,to:u+v.toA,insert:dt.of(e.text.slice(v.from,v.toB).split(sa))})}else i&&(!n.hasFocus&&l.facet(al)||Tx(i,o))&&(i=null);if(!t&&!i)return!1;if((Ce.mac||Ce.android)&&t&&t.from==t.to&&t.from==o.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=le.single(i.main.anchor-1,i.main.head-1)),t={from:t.from,to:t.to,insert:dt.of([t.insert.toString().replace("."," ")])}):l.doc.lineAt(o.from).toDate.now()-50?t={from:o.from,to:o.to,insert:l.toText(n.inputState.insertingText)}:Ce.chrome&&t&&t.from==t.to&&t.from==o.head&&t.insert.toString()==` + `&&n.lineWrapping&&(i&&(i=le.single(i.main.anchor-1,i.main.head-1)),t={from:o.from,to:o.to,insert:dt.of([" "])}),t)return Ly(n,t,i,a);if(i&&!Tx(i,o)){let u=!1,f="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(u=!0),f=n.inputState.lastSelectionOrigin,f=="select.pointer"&&(i=cN(l.facet(Du).map(d=>d(n)),i))),n.dispatch({selection:i,scrollIntoView:u,userEvent:f}),!0}else return!1}function Ly(n,e,t,i=-1){if(Ce.ios&&n.inputState.flushIOSKey(e))return!0;let l=n.state.selection.main;if(Ce.android&&(e.to==l.to&&(e.from==l.from||e.from==l.from-1&&n.state.sliceDoc(e.from,l.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&va(n.contentDOM,"Enter",13)||(e.from==l.from-1&&e.to==l.to&&e.insert.length==0||i==8&&e.insert.lengthl.head)&&va(n.contentDOM,"Backspace",8)||e.from==l.from&&e.to==l.to+1&&e.insert.length==0&&va(n.contentDOM,"Delete",46)))return!0;let o=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let a,u=()=>a||(a=JR(n,e,t));return n.state.facet(KO).some(f=>f(n,e.from,e.to,o,u))||n.dispatch(u()),!0}function JR(n,e,t){let i,l=n.state,o=l.selection.main,a=-1;if(e.from==e.to&&e.fromo.to){let f=e.fromg(n)),d,f);e.from==m&&(a=m)}if(a>-1)i={changes:e,selection:le.cursor(e.from+e.insert.length,-1)};else if(e.from>=o.from&&e.to<=o.to&&e.to-e.from>=(o.to-o.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let f=o.frome.to?l.sliceDoc(e.to,o.to):"";i=l.replaceSelection(n.state.toText(f+e.insert.sliceString(0,void 0,n.state.lineBreak)+d))}else{let f=l.changes(e),d=t&&t.main.to<=f.newLength?t.main:void 0;if(l.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=o.to+10&&e.to>=o.to-10){let m=n.state.sliceDoc(e.from,e.to),g,b=t&&aN(n,t.main.head);if(b){let w=e.insert.length-(e.to-e.from);g={from:b.from,to:b.to-w}}else g=n.state.doc.lineAt(o.head);let v=o.to-e.to;i=l.changeByRange(w=>{if(w.from==o.from&&w.to==o.to)return{changes:f,range:d||w.map(f)};let S=w.to-v,C=S-m.length;if(n.state.sliceDoc(C,S)!=m||S>=g.from&&C<=g.to)return{range:w};let N=l.changes({from:C,to:S,insert:e.insert}),j=w.to-o.to;return{changes:N,range:d?le.range(Math.max(0,d.anchor+j),Math.max(0,d.head+j)):w.map(N)}})}else i={changes:f,selection:d&&l.selection.replaceRange(d)}}let u="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,u+=".compose",n.inputState.compositionFirstChange&&(u+=".start",n.inputState.compositionFirstChange=!1)),l.update(i,{userEvent:u,scrollIntoView:!0})}function hN(n,e,t,i){let l=Math.min(n.length,e.length),o=0;for(;o0&&u>0&&n.charCodeAt(a-1)==e.charCodeAt(u-1);)a--,u--;if(i=="end"){let f=Math.max(0,o-Math.min(a,u));t-=a+f-o}if(a=a?o-t:0;o-=f,u=o+(u-a),a=o}else if(u=u?o-t:0;o-=f,a=o+(a-u),u=o}return{from:o,toA:a,toB:u}}function ej(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:o}=n.observer.selectionRange;return t&&(e.push(new yS(t,i)),(l!=t||o!=i)&&e.push(new yS(l,o))),e}function tj(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t<0||i<0?null:t==i?le.create([le.cursor(i+e,-1)]):le.single(t+e,i+e)}function Tx(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}class nj{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.touchActive=!1,this.lastTouchTime=0,this.lastTouchX=0,this.lastTouchY=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.lastIOSMomentumScroll=0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,Ce.safari&&e.contentDOM.addEventListener("input",()=>null),Ce.gecko&&yj(e.contentDOM.ownerDocument)}handleEvent(e){!fj(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let l of i.observers)l(this.view,t);for(let l of i.handlers){if(t.defaultPrevented)break;if(l(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=rj(e),i=this.handlers,l=this.view.contentDOM;for(let o in t)if(o!="scroll"){let a=!t[o].handlers.length,u=i[o];u&&a!=!u.handlers.length&&(l.removeEventListener(o,this.handleEvent),u=null),u||l.addEventListener(o,this.handleEvent,{passive:a})}for(let o in i)o!="scroll"&&!t[o]&&l.removeEventListener(o,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&mN.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Ce.android&&Ce.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(Ce.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(dN.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||lj.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};t.shiftKey&&Ce.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&ij(this.view.win)&&(t.shiftKey=!1);let i=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{this.pendingIOSKey==i&&this.flushIOSKey()},50),!0}return e.keyCode!=229&&this.view.observer.forceFlush(),!1}flushIOSKey(e){let t=this.pendingIOSKey;return!t||this.view.observer.pendingRecords().length||t.key=="Enter"&&e&&e.from0?!0:Ce.safari&&!Ce.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function ij(n){return n.visualViewport?n.visualViewport.height*n.visualViewport.scale/n.document.documentElement.clientHeight<.85:!1}function bS(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(l){yi(t.state,l)}}}function rj(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let l=i.spec,o=l&&l.plugin.domEventHandlers,a=l&&l.plugin.domEventObservers;if(o)for(let u in o){let f=o[u];f&&t(u).handlers.push(bS(i.value,f))}if(a)for(let u in a){let f=a[u];f&&t(u).observers.push(bS(i.value,f))}}for(let i in hr)t(i).handlers.push(hr[i]);for(let i in li)t(i).observers.push(li[i]);return e}const dN=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],lj="dthko",mN=[16,17,18,20,91,92,224,225],vh=6;function wh(n){return Math.max(0,n)*.7+8}function sj(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class oj{constructor(e,t,i,l){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=l,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=_O(e.contentDOM),this.atoms=e.state.facet(Du).map(a=>a(e));let o=e.contentDOM.ownerDocument;o.addEventListener("mousemove",this.move=this.move.bind(this)),o.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(pt.allowMultipleSelections)&&aj(e,t),this.dragging=uj(e,t)&&xN(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&sj(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,l=0,o=0,a=this.view.win.innerWidth,u=this.view.win.innerHeight;this.scrollParents.x&&({left:l,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:o,bottom:u}=this.scrollParents.y.getBoundingClientRect());let f=_y(this.view);e.clientX-f.left<=l+vh?t=-wh(l-e.clientX):e.clientX+f.right>=a-vh&&(t=wh(e.clientX-a)),e.clientY-f.top<=o+vh?i=-wh(o-e.clientY):e.clientY+f.bottom>=u-vh&&(i=wh(e.clientY-u)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&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=this.view.inputState.draggedContent=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(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=cN(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function aj(n,e){let t=n.state.facet(XO);return t.length?t[0](e):Ce.mac?e.metaKey:e.ctrlKey}function cj(n,e){let t=n.state.facet($O);return t.length?t[0](e):Ce.mac?!e.altKey:!e.ctrlKey}function uj(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=pu(n.root);if(!i||i.rangeCount==0)return!0;let l=i.getRangeAt(0).getClientRects();for(let o=0;o=e.clientX&&a.top<=e.clientY&&a.bottom>=e.clientY)return!0}return!1}function fj(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=Gt.get(t))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0}const hr=Object.create(null),li=Object.create(null),pN=Ce.ie&&Ce.ie_version<15||Ce.ios&&Ce.webkit_version<604;function hj(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),gN(n,t.value)},50)}function nm(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function gN(n,e){e=nm(n.state,My,e);let{state:t}=n,i,l=1,o=t.toText(e),a=o.lines==t.selection.ranges.length;if(Ax!=null&&t.selection.ranges.every(f=>f.empty)&&Ax==o.toString()){let f=-1;i=t.changeByRange(d=>{let m=t.doc.lineAt(d.from);if(m.from==f)return{range:d};f=m.from;let g=t.toText((a?o.line(l++).text:e)+t.lineBreak);return{changes:{from:m.from,insert:g},range:le.cursor(d.from+g.length,-1)}})}else a?i=t.changeByRange(f=>{let d=o.line(l++);return{changes:{from:f.from,to:f.to,insert:d.text},range:le.cursor(f.from+d.length,-1)}}):i=t.replaceSelection(o);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}li.scroll=n=>{let e=n.inputState;e.lastScrollTop=n.scrollDOM.scrollTop,e.lastScrollLeft=n.scrollDOM.scrollLeft,Ce.ios&&!e.touchActive&&(e.lastIOSMomentumScroll=Date.now())};li.wheel=li.mousewheel=n=>{n.inputState.lastWheelEvent=Date.now()};hr.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);li.touchstart=(n,e)=>{let t=n.inputState,i=e.targetTouches[0];t.touchActive=!0,t.lastTouchTime=Date.now(),i&&(t.lastTouchX=i.clientX,t.lastTouchY=i.clientY),t.setSelectionOrigin("select.pointer")};li.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};li.touchend=(n,e)=>{n.inputState.touchActive=!1};hr.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(YO))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=mj(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new oj(n,e,t,i)),i&&n.observer.ignore(()=>{BO(n.contentDOM);let o=n.root.activeElement;o&&!o.contains(n.contentDOM)&&o.blur()});let l=n.inputState.mouseSelection;if(l)return l.start(e),l.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function vS(n,e,t,i){if(i==1)return le.cursor(e,t);if(i==2)return qR(n.state,e,t);{let l=n.docView.lineAt(e,t),o=n.state.doc.lineAt(l?l.posAtEnd:e),a=l?l.posAtStart:o.from,u=l?l.posAtEnd:o.to;return uDate.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(kS+1)%3:1}function mj(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),i=xN(e),l=n.state.selection;return{update(o){o.docChanged&&(t.pos=o.changes.mapPos(t.pos),l=l.map(o.changes))},get(o,a,u){let f=n.posAndSideAtCoords({x:o.clientX,y:o.clientY},!1),d,m=vS(n,f.pos,f.assoc,i);if(t.pos!=f.pos&&!a){let g=vS(n,t.pos,t.assoc,i),b=Math.min(g.from,m.from),v=Math.max(g.to,m.to);m=b1&&(d=pj(l,f.pos))?d:u?l.addRange(m):le.create([m])}}}function pj(n,e){for(let t=0;t=e)return le.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}hr.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let l=n.docView.tile.nearest(e.target);if(l&&l.isWidget()){let o=l.posAtStart,a=o+l.length;(o>=t.to||a<=t.from)&&(t=le.undirectionalRange(o,a))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",nm(n.state,Dy,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};hr.dragend=n=>(n.inputState.draggedContent=null,!1);function CS(n,e,t,i){if(t=nm(n.state,My,t),!t)return;let l=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:o}=n.inputState,a=i&&o&&cj(n,e)?{from:o.from,to:o.to}:null,u={from:l,insert:t},f=n.state.changes(a?[a,u]:u);n.focus(),n.dispatch({changes:f,selection:{anchor:f.mapPos(l,-1),head:f.mapPos(l,1)},userEvent:a?"move.drop":"input.drop"}),n.inputState.draggedContent=null}hr.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),l=0,o=()=>{++l==t.length&&CS(n,e,i.filter(a=>a!=null).join(n.state.lineBreak),!1)};for(let a=0;a{/[\x00-\x08\x0e-\x1f]{2}/.test(u.result)||(i[a]=u.result),o()},u.readAsText(t[a])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return CS(n,e,i,!0),!0}return!1};hr.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=pN?null:e.clipboardData;return t?(gN(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(hj(n),!1)};function gj(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function xj(n){let e=[],t=[],i=!1;for(let l of n.selection.ranges)l.empty||(e.push(n.sliceDoc(l.from,l.to)),t.push(l));if(!e.length){let l=-1;for(let{from:o}of n.selection.ranges){let a=n.doc.lineAt(o);a.number>l&&(e.push(a.text),t.push({from:a.from,to:Math.min(n.doc.length,a.to+1)})),l=a.number}i=!0}return{text:nm(n,Dy,e.join(n.lineBreak)),ranges:t,linewise:i}}let Ax=null;hr.copy=hr.cut=(n,e)=>{if(!tu(n.contentDOM,n.observer.selectionRange))return!1;let{text:t,ranges:i,linewise:l}=xj(n.state);if(!t&&!l)return!1;Ax=l?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let o=pN?null:e.clipboardData;return o?(o.clearData(),o.setData("text/plain",t),!0):(gj(n,t),!1)};const yN=ml.define();function bN(n,e){let t=[];for(let i of n.facet(WO)){let l=i(n,e);l&&t.push(l)}return t.length?n.update({effects:t,annotations:yN.of(!0)}):null}function vN(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=bN(n.state,e);t?n.dispatch(t):n.update([])}},10)}li.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),vN(n)};li.blur=n=>{n.observer.clearSelectionRange(),vN(n)};li.compositionstart=li.compositionupdate=(n,e)=>{if(!n.observer.editContext&&(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0)){let{main:t}=n.state.selection;!t.empty&&n.lineBlockAt(t.from).from!=n.lineBlockAt(t.to).from&&!n.state.readOnly&&n.dispatch({changes:n.state.selection.ranges.filter(i=>!i.empty).map(i=>({from:i.from,to:i.to})),userEvent:"input"}),n.inputState.composing=0}};li.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,Ce.chrome&&Ce.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};li.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};hr.beforeinput=(n,e)=>{var t,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let o=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),a=e.getTargetRanges();if(o&&a.length){let u=a[0],f=n.posAtDOM(u.startContainer,u.startOffset),d=n.posAtDOM(u.endContainer,u.endOffset);return Ly(n,{from:f,to:d,insert:n.state.toText(o)},null),!0}}let l;if(Ce.chrome&&Ce.android&&(l=dN.find(o=>o.inputType==e.inputType))&&(n.observer.delayAndroidKey(l.key,l.keyCode),l.key=="Backspace"||l.key=="Delete")){let o=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var a;(((a=window.visualViewport)===null||a===void 0?void 0:a.height)||0)>o+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return Ce.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),Ce.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>li.compositionend(n,e),20),!1};const OS=new Set;function yj(n){OS.has(n)||(OS.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const NS=["pre-wrap","normal","pre-line","break-spaces"];let Ra=!1;function TS(){Ra=!1}class bj{constructor(e){this.lineWrapping=e,this.doc=dt.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return NS.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i-1,f=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=u;if(this.lineWrapping=u,this.lineHeight=t,this.charWidth=i,this.textHeight=l,this.lineLength=o,f){this.heightSamples={};for(let d=0;d0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>nd&&(Ra=!0),this.height=e)}replace(e,t,i){return ri.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,l){let o=this,a=i.doc;for(let u=l.length-1;u>=0;u--){let{fromA:f,toA:d,fromB:m,toB:g}=l[u],b=o.lineAt(f,Bt.ByPosNoHeight,i.setDoc(t),0,0),v=b.to>=d?b:o.lineAt(d,Bt.ByPosNoHeight,i,0,0);for(g+=v.to-d,d=v.to;u>0&&b.from<=l[u-1].toA;)f=l[u-1].fromA,m=l[u-1].fromB,u--,fo*2){let u=e[t-1];u.break?e.splice(--t,1,u.left,null,u.right):e.splice(--t,1,u.left,u.right),i+=1+u.break,l-=u.size}else if(o>l*2){let u=e[i];u.break?e.splice(i,1,u.left,null,u.right):e.splice(i,1,u.left,u.right),i+=2+u.break,o-=u.size}else break;else if(l=o&&a(this.lineAt(0,Bt.ByPos,i,l,o))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more&&this.setMeasuredHeight(l),this.outdated=!1,this}toString(){return`block(${this.length})`}}class ji extends wN{constructor(e,t,i){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(e,t){return new or(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,i){let l=i[0];return i.length==1&&(l instanceof ji||l instanceof _n&&l.flags&4)&&Math.abs(this.length-l.length)<10?(l instanceof _n?l=new ji(l.length,this.height,this.spaceAbove):l.height=this.height,this.outdated||(l.outdated=!1),l):ri.of(i)}updateHeight(e,t=0,i=!1,l){return l&&l.from<=t&&l.more?this.setMeasuredHeight(l):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(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 _n extends ri{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,l=e.doc.lineAt(t+this.length).number,o=l-i+1,a,u=0;if(e.lineWrapping){let f=Math.min(this.height,e.lineHeight*o);a=f/o,this.length>o+1&&(u=(this.height-f)/(this.length-o-1))}else a=this.height/o;return{firstLine:i,lastLine:l,perLine:a,perChar:u}}blockAt(e,t,i,l){let{firstLine:o,lastLine:a,perLine:u,perChar:f}=this.heightMetrics(t,l);if(t.lineWrapping){let d=l+(e0){let o=i[i.length-1];o instanceof _n?i[i.length-1]=new _n(o.length+l):i.push(null,new _n(l-1))}if(e>0){let o=i[0];o instanceof _n?i[0]=new _n(e+o.length):i.unshift(new _n(e-1),null)}return ri.of(i)}decomposeLeft(e,t){t.push(new _n(e-1),null)}decomposeRight(e,t){t.push(null,new _n(this.length-e-1))}updateHeight(e,t=0,i=!1,l){let o=t+this.length;if(l&&l.from<=t+this.length&&l.more){let a=[],u=Math.max(t,l.from),f=-1;for(l.from>t&&a.push(new _n(l.from-t-1).updateHeight(e,t));u<=o&&l.more;){let m=e.doc.lineAt(u).length;a.length&&a.push(null);let g=l.heights[l.index++],b=0;g<0&&(b=-g,g=l.heights[l.index++]),f==-1?f=g:Math.abs(g-f)>=nd&&(f=-2);let v=new ji(m,g,b);v.outdated=!1,a.push(v),u+=m+1}u<=o&&a.push(null,new _n(o-u).updateHeight(e,u));let d=ri.of(a);return(f<0||Math.abs(d.height-this.height)>=nd||Math.abs(f-this.heightMetrics(e,t).perLine)>=nd)&&(Ra=!0),vd(this,d)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class kj extends ri{constructor(e,t,i){super(e.length+(t?1:0)+i.length,e.height+i.height,(t?1:0)|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,l){let o=i+this.left.height;return eu))return d;let m=t==Bt.ByPosNoHeight?Bt.ByPosNoHeight:Bt.ByPos;return f?d.join(this.right.lineAt(u,m,i,a,u)):this.left.lineAt(u,m,i,l,o).join(d)}forEachLine(e,t,i,l,o,a){let u=l+this.left.height,f=o+this.left.length+this.break;if(this.break)e=f&&this.right.forEachLine(e,t,i,u,f,a);else{let d=this.lineAt(f,Bt.ByPos,i,l,o);e=e&&d.from<=t&&a(d),t>d.to&&this.right.forEachLine(Math.max(e,d.to+1),t,i,u,f,a)}}replace(e,t,i){let l=this.left.length+this.break;if(tthis.left.length)return this.balanced(this.left,this.right.replace(e-l,t-l,i));let o=[];e>0&&this.decomposeLeft(e,o);let a=o.length;for(let u of i)o.push(u);if(e>0&&AS(o,a-1),t=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,l=i+this.break;if(e>=l)return this.right.decomposeRight(e-l,t);e2*t.size||t.size>2*e.size?ri.of(this.break?[e,null,t]:[e,t]):(this.left=vd(this.left,e),this.right=vd(this.right,t),this.setHeight(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,i=!1,l){let{left:o,right:a}=this,u=t+o.length+this.break,f=null;return l&&l.from<=t+o.length&&l.more?f=o=o.updateHeight(e,t,i,l):o.updateHeight(e,t,i),l&&l.from<=u+a.length&&l.more?f=a=a.updateHeight(e,u,i,l):a.updateHeight(e,u,i),f?this.balanced(o,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function AS(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof _n&&(i=n[e+1])instanceof _n&&n.splice(e-1,3,new _n(t.length+1+i.length))}const Sj=5;class zy{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 i=Math.min(t,this.lineEnd),l=this.nodes[this.nodes.length-1];l instanceof ji?l.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new ji(i-this.pos,-1,0)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e=Sj)&&this.addLineDeco(l,o,a)}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 ji(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let i=new _n(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof ji)return e;let t=new ji(0,-1,0);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,i){let l=this.ensureLine();l.length+=i,l.collapsed+=i,l.widgetHeight=Math.max(l.widgetHeight,e),l.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof ji)&&!this.isCovered?this.nodes.push(new ji(0,-1,0)):(this.writtenTod.clientHeight||d.scrollWidth>d.clientWidth)&&m.overflow!="visible"){let g=d.getBoundingClientRect();o=Math.max(o,g.left),a=Math.min(a,g.right),u=Math.max(u,g.top),f=Math.min(d==n.parentNode?l.innerHeight:f,g.bottom)}d=m.position=="absolute"||m.position=="fixed"?d.offsetParent:d.parentNode}else if(d.nodeType==11)d=d.host;else break;return{left:o-t.left,right:Math.max(o,a)-t.left,top:u-(t.top+e),bottom:Math.max(u,f)-(t.top+e)}}function Tj(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left0&&e.top0}function Aj(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class c0{constructor(e,t,i,l){this.from=e,this.to=t,this.size=i,this.displaySize=l}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;itypeof l!="function"&&l.class=="cm-lineWrapping");this.heightOracle=new bj(i),this.stateDeco=MS(t),this.heightMap=ri.empty().applyChanges(this.stateDeco,dt.empty,this.heightOracle.setDoc(t.doc),[new Xi(0,0,0,t.doc.length)]);for(let l=0;l<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());l++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Fe.set(this.lineGaps.map(l=>l.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let l=i?t.head:t.anchor;if(!e.some(({from:o,to:a})=>l>=o&&l<=a)){let{from:o,to:a}=this.lineBlockAt(l);e.push(new kh(o,a))}}return this.viewports=e.sort((i,l)=>i.from-l.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?Ex:wd.get(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(Kc(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=MS(this.state);let l=e.changedRanges,o=Xi.extendWithRanges(l,Cj(i,this.stateDeco,e?e.changes:pn.empty(this.state.doc.length))),a=this.heightMap.height,u=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);TS(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),o),(this.heightMap.height!=a||Ra)&&(e.flags|=2),u?(this.scrollAnchorPos=e.changes.mapPos(u.from,-1),this.scrollAnchorHeight=u.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let f=o.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.headf.to)||!this.viewportIsAppropriate(f))&&(f=this.getViewport(0,t));let d=f.from!=this.viewport.from||f.to!=this.viewport.to;this.viewport=f,e.flags|=this.updateForViewport(),(d||!e.changes.empty||e.flags&2)&&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(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(JO)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,i=window.getComputedStyle(t),l=this.heightOracle,o=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?At.RTL:At.LTR;let a=this.heightOracle.mustRefreshForWrapping(o)||this.mustMeasureContent==="refresh",u=t.getBoundingClientRect(),f=a||this.mustMeasureContent||this.contentDOMHeight!=u.height;this.contentDOMHeight=u.height,this.mustMeasureContent=!1;let d=0,m=0;if(u.width&&u.height){let{scaleX:H,scaleY:M}=jO(t,u);(H>.005&&Math.abs(this.scaleX-H)>.005||M>.005&&Math.abs(this.scaleY-M)>.005)&&(this.scaleX=H,this.scaleY=M,d|=16,a=f=!0)}let g=(parseInt(i.paddingTop)||0)*this.scaleY,b=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=g||this.paddingBottom!=b)&&(this.paddingTop=g,this.paddingBottom=b,d|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(l.lineWrapping&&(f=!0),this.editorWidth=e.scrollDOM.clientWidth,d|=16);let v=_O(this.view.contentDOM,!1).y;v!=this.scrollParent&&(this.scrollParent=v,this.scrollAnchorHeight=-1,this.scrollOffset=0);let w=this.getScrollOffset();this.scrollOffset!=w&&(this.scrollAnchorHeight=-1,this.scrollOffset=w),this.scrolledToBottom=PO(this.scrollParent||e.win);let S=(this.printing?Aj:Nj)(t,this.paddingTop),C=S.top-this.pixelViewport.top,N=S.bottom-this.pixelViewport.bottom;this.pixelViewport=S;let j=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(j!=this.inView&&(this.inView=j,j&&(f=!0)),!this.inView&&!this.scrollTarget&&!Tj(e.dom))return 0;let D=u.width;if((this.contentDOMWidth!=D||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=u.width,this.editorHeight=e.scrollDOM.clientHeight,d|=16),f){let H=e.docView.measureVisibleLineHeights(this.viewport);if(l.mustRefreshForHeights(H)&&(a=!0),a||l.lineWrapping&&Math.abs(D-this.contentDOMWidth)>l.charWidth){let{lineHeight:M,charWidth:A,textHeight:L}=e.docView.measureTextSize();a=M>0&&l.refresh(o,M,A,L,Math.max(5,D/A),H),a&&(e.docView.minWidth=0,d|=16)}C>0&&N>0?m=Math.max(C,N):C<0&&N<0&&(m=Math.min(C,N)),TS();for(let M of this.viewports){let A=M.from==this.viewport.from?H:e.docView.measureVisibleLineHeights(M);this.heightMap=(a?ri.empty().applyChanges(this.stateDeco,dt.empty,this.heightOracle,[new Xi(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(l,0,a,new vj(M.from,A))}Ra&&(d|=2)}let U=!this.viewportIsAppropriate(this.viewport,m)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return U&&(d&2&&(d|=this.updateScaler()),this.viewport=this.getViewport(m,this.scrollTarget),d|=this.updateForViewport()),(d&2||U)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),d|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),d}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),l=this.heightMap,o=this.heightOracle,{visibleTop:a,visibleBottom:u}=this,f=new kh(l.lineAt(a-i*1e3,Bt.ByHeight,o,0,0).from,l.lineAt(u+(1-i)*1e3,Bt.ByHeight,o,0,0).to);if(t){let{head:d}=t.range;if(df.to){let m=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),g=l.lineAt(d,Bt.ByPos,o,0,0),b;t.y=="center"?b=(g.top+g.bottom)/2-m/2:t.y=="start"||t.y=="nearest"&&d=u+Math.max(10,Math.min(i,250)))&&l>a-2*1e3&&o>1,a=l<<1;if(this.defaultTextDirection!=At.LTR&&!i)return[];let u=[],f=(m,g,b,v)=>{if(g-mm&&NN.from>=b.from&&N.to<=b.to&&Math.abs(N.from-m)N.fromj));if(!C){if(gD.from<=g&&D.to>=g)){let D=t.moveToLineBoundary(le.cursor(g),!1,!0).head;D>m&&(g=D)}let N=this.gapSize(b,m,g,v),j=i||N<2e6?N:2e6;C=new c0(m,g,N,j)}u.push(C)},d=m=>{if(m.length2e6)for(let M of e)M.from>=m.from&&M.fromm.from&&f(m.from,v,m,g),wt.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];rt.spans(t,this.viewport.from,this.viewport.to,{span(o,a){i.push({from:o,to:a})},point(){}},20);let l=0;if(i.length!=this.visibleRanges.length)l=12;else for(let o=0;o=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Kc(this.heightMap.lineAt(e,Bt.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||Kc(this.heightMap.lineAt(this.scaler.fromDOM(e),Bt.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop*this.scaleY:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+12-this.paddingTop);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Kc(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 kh{constructor(e,t){this.from=e,this.to=t}}function Mj(n,e,t){let i=[],l=n,o=0;return rt.spans(t,n,e,{span(){},point(a,u){a>l&&(i.push({from:l,to:a}),o+=a-l),l=u}},20),l=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let l=0;;l++){let{from:o,to:a}=e[l],u=a-o;if(i<=u)return o+i;i-=u}}function Ch(n,e){let t=0;for(let{from:i,to:l}of n.ranges){if(e<=l){t+=e-i;break}t+=l-i}return t/n.total}function Dj(n,e){for(let t of n)if(e(t))return t}const Ex={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function MS(n){let e=n.facet(Jd).filter(i=>typeof i!="function"),t=n.facet(jy).filter(i=>typeof i!="function");return t.length&&e.push(rt.join(t)),e}class wd{constructor(e,t){this.scale=e,this.viewports=t}static get(e,t,i){let l=0,o=0,a=0,u=i.map(({from:d,to:m})=>{let g=t.lineAt(d,Bt.ByPos,e,0,0).top,b=t.lineAt(m,Bt.ByPos,e,0,0).bottom;return l+=b-g,{from:d,to:m,top:g,bottom:b,domTop:0,domBottom:0}});if(t.height-l<10)return Ex;let f=(7e6-l)/(t.height-l);for(let d of u)d.domTop=a+(d.top-o)*f,a=d.domBottom=d.domTop+(d.bottom-d.top),o=d.bottom;return new wd(f,u)}toDOM(e){for(let t=0,i=0,l=0;;t++){let o=tt.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function Kc(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new or(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(l=>Kc(l,e)):n._content)}const Oh=Ne.define({combine:n=>n.join(" ")}),Mx=Ne.define({combine:n=>n.indexOf(!0)>-1}),Dx=ls.newName(),kN=ls.newName(),SN=ls.newName(),CN={"&light":"."+kN,"&dark":"."+SN};function Rx(n,e,t){return new ls(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,l=>{if(l=="&")return n;if(!t||!t[l])throw new RangeError(`Unsupported selector: ${l}`);return t[l]}):n+" "+i}})}const Rj=Rx("."+Dx,{"&":{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,overflowAnchor:"none"},".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":{userSelect:"none",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:"#ddd"},".cm-selectionHandle":{backgroundColor:"currentColor",width:"1.5px"},".cm-selectionHandle-start::before, .cm-selectionHandle-end::before":{content:'""',backgroundColor:"inherit",borderRadius:"50%",width:"8px",height:"8px",position:"absolute",left:"-3.25px"},".cm-selectionHandle-start::before":{top:"-8px"},".cm-selectionHandle-end::before":{bottom:"-8px"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&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",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&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,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},".cm-panels-top":{top:"0"},".cm-panels-bottom":{bottom:"0"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"baseline",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{background:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 0) no-repeat",backgroundSize:".4em",backgroundPosition:"calc(min(50%, 0px)) center"},".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"}},CN),jj={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},u0=Ce.ie&&Ce.ie_version<=11;class _j{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new cR,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.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(Ce.ie&&Ce.ie_version<=11||Ce.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&Ce.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Ce.chrome&&Ce.chrome_version<126)&&(this.editContext=new zj(e),e.state.facet(al)&&(e.contentDOM.editContext=this.editContext.editContext)),u0&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.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),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate){this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.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(t=>{t.length>0&&t[t.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(this.pendingRecords().length>0),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(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,i)=>t!=e[i]))){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:i}=this,l=this.selectionRange;if(i.state.facet(al)?i.root.activeElement!=this.dom:!tu(this.dom,l))return;let o=l.anchorNode&&i.docView.tile.nearest(l.anchorNode);if(o&&o.isWidget()&&o.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(Ce.ie&&Ce.ie_version<=11||Ce.android&&Ce.chrome)&&!i.state.selection.main.empty&&l.focusNode&&nu(l.focusNode,l.focusOffset,l.anchorNode,l.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=pu(e.root);if(!t)return!1;let i=Ce.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Lj(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let l=tu(this.dom,i);return l&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let o=this.delayedAndroidKey;o&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=o.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&o.force&&va(this.dom,o.key,o.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(l)}(!this.delayedAndroidKey||e=="Enter")&&(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,i=-1,l=!1;for(let o of e){let a=this.readMutation(o);a&&(a.typeOver&&(l=!0),t==-1?{from:t,to:i}=a:(t=Math.min(a.from,t),i=Math.max(a.to,i)))}return{from:t,to:i,typeOver:l}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),l=this.selectionChanged&&tu(this.dom,this.selectionRange);if(e<0&&!l)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let o=new ZR(this.view,e,t,i);return this.view.docView.domChanged={newSel:o.newSel?o.newSel.main:null},o}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.selectionChanged,i=this.readChange();if(!i)return this.view.requestMeasure(),!1;let l=this.view.state,o=fN(this.view,i);return this.view.state==l&&(i.domChanged||t)&&this.view.update([]),o}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let i=DS(t,e.previousSibling||e.target.previousSibling,-1),l=DS(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:l?t.posBefore(l):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{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),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):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),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(al)!=e.state.facet(al)&&(e.view.contentDOM.editContext=e.state.facet(al)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let l of this.scrollTargets)l.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function DS(n,e,t){for(;e;){let i=Gt.get(e);if(i&&i.parent==n)return i;let l=e.parentNode;e=l!=n.dom?l:t>0?e.nextSibling:e.previousSibling}return null}function RS(n,e){let t=e.startContainer,i=e.startOffset,l=e.endContainer,o=e.endOffset,a=n.docView.domAtPos(n.state.selection.main.anchor,1);return nu(a.node,a.offset,l,o)&&([t,i,l,o]=[l,o,t,i]),{anchorNode:t,anchorOffset:i,focusNode:l,focusOffset:o}}function Lj(n,e){if(e.getComposedRanges){let l=e.getComposedRanges(n.root)[0];if(l)return RS(n,l)}let t=null;function i(l){l.preventDefault(),l.stopImmediatePropagation(),t=l.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?RS(n,t):null}class zj{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let l=e.state.selection.main,{anchor:o,head:a}=l,u=this.toEditorPos(i.updateRangeStart),f=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:u,drifted:!1});let d=f-u>i.text.length;u==this.from&&othis.to&&(f=o);let m=hN(e.state.sliceDoc(u,f),i.text,(d?l.from:l.to)-u,d?"end":null);if(!m){let b=le.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));Tx(b,l)||e.dispatch({selection:b,userEvent:"select"});return}let g={from:m.from+u,to:m.toA+u,insert:dt.of(i.text.slice(m.from,m.toB).split(` +`))};if((Ce.mac||Ce.android)&&g.from==a-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(g={from:u,to:f,insert:dt.of([i.text.replace("."," ")])}),this.pendingContextChange=g,!e.state.readOnly){let b=this.to-this.from+(g.to-g.from+g.insert.length);Ly(e,g,le.single(this.toEditorPos(i.selectionStart,b),this.toEditorPos(i.selectionEnd,b)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),g.from=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let l=[],o=null;for(let a=this.toEditorPos(i.rangeStart),u=this.toEditorPos(i.rangeEnd);a{let l=[];for(let o of i.getTextFormats()){let a=o.underlineStyle,u=o.underlineThickness;if(!/none/i.test(a)&&!/none/i.test(u)){let f=this.toEditorPos(o.rangeStart),d=this.toEditorPos(o.rangeEnd);if(f{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{let l=pu(i.root);l&&l.rangeCount&&this.editContext.updateSelectionBounds(l.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,l=this.pendingContextChange;return e.changes.iterChanges((o,a,u,f,d)=>{if(i)return;let m=d.length-(a-o);if(l&&a>=l.to)if(l.from==o&&l.to==a&&l.insert.eq(d)){l=this.pendingContextChange=null,t+=m,this.to+=m;return}else l=null,this.revertPending(e.state);if(o+=t,a+=t,a<=this.from)this.from+=m,this.to+=m;else if(othis.to||this.to-this.from+d.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(o),this.toContextPos(a),d.toString()),this.to+=m}t+=m}),l&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(l=>!l.isUserEvent("input.type")&&l.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),l=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=l)&&this.editContext.updateSelection(i,l)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class Ee{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&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.clearAnnouncement=-1,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.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(l=>l.forEach(o=>i(o,this)))||(l=>this.update(l)),this.dispatch=this.dispatch.bind(this),this._root=e.root||uR(e.parent)||document,this.viewState=new ES(this,e.state||pt.create(e)),e.scrollTo&&e.scrollTo.is(bh)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(da).map(l=>new r0(l));for(let l of this.plugins)l.update(this);this.observer=new _j(this),this.inputState=new nj(this),this.inputState.ensureHandlers(this.plugins),this.docView=new gS(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof gn?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,l,o=this.state;for(let b of e){if(b.startState!=o)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");o=b.state}if(this.destroyed){this.viewState.state=o;return}let a=this.hasFocus,u=0,f=null;e.some(b=>b.annotation(yN))?(this.inputState.notifiedFocused=a,u=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,f=bN(o,a),f||(u=1));let d=this.observer.delayedAndroidKey,m=null;if(d?(this.observer.clearDelayedAndroidKey(),m=this.observer.readChange(),(m&&!this.state.doc.eq(o.doc)||!this.state.selection.eq(o.selection))&&(m=null)):this.observer.clear(),o.facet(pt.phrases)!=this.state.facet(pt.phrases))return this.setState(o);l=xd.create(this,o,e),l.flags|=u;let g=this.viewState.scrollTarget;try{this.updateState=2;for(let b of e){if(g&&(g=g.map(b.changes)),b.scrollIntoView){let{main:v}=b.state.selection,{x:w,y:S}=this.state.facet(Ee.cursorScrollMargin);g=new wa(v.empty?v:le.cursor(v.head,v.head>v.anchor?-1:1),"nearest","nearest",S,w)}for(let v of b.effects)v.is(bh)&&(g=v.value.clip(this.state))}this.viewState.update(l,g),this.bidiCache=kd.update(this.bidiCache,l.changes),l.empty||(this.updatePlugins(l),this.inputState.update(l)),t=this.docView.update(l),this.state.facet(Gc)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(b=>b.isUserEvent("select.pointer")))}finally{this.updateState=0}if(l.startState.facet(Oh)!=l.state.facet(Oh)&&(this.viewState.mustMeasureContent=!0),(t||i||g||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!l.empty)for(let b of this.state.facet(Sx))try{b(l)}catch(v){yi(this.state,v,"update listener")}(f||m)&&Promise.resolve().then(()=>{f&&this.state==f.startState&&this.dispatch(f),m&&!fN(this,m)&&d.force&&va(this.contentDOM,d.key,d.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new ES(this,e),this.plugins=e.facet(da).map(i=>new r0(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new gS(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(da),i=e.state.facet(da);if(t!=i){let l=[];for(let o of i){let a=t.indexOf(o);if(a<0)l.push(new r0(o));else{let u=this.plugins[a];u.mustUpdate=e,l.push(u)}}for(let o of this.plugins)o.mustUpdate!=e&&o.destroy(this);this.plugins=l,this.pluginMap.clear()}else for(let l of this.plugins)l.mustUpdate=e;for(let l=0;l-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.viewState.scrollParent,l=this.viewState.getScrollOffset(),{scrollAnchorPos:o,scrollAnchorHeight:a,scaleY:u}=this.viewState;Math.abs(l-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let f=0;;f++){if(a<0){if(PO(i||this.win))o=-1,a=this.viewState.heightMap.height/this.viewState.scaleY;else{let w=this.viewState.scrollAnchorAt(l);o=w.from,a=w.top}u=this.viewState.scaleY}this.updateState=1;let d=this.viewState.measure();if(!d&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(f>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let m=[];d&4||([this.measureRequests,m]=[m,this.measureRequests]);let g=m.map(w=>{try{return w.read(this)}catch(S){return yi(this.state,S),jS}}),b=xd.create(this,this.state,[]),v=!1;b.flags|=d,t?t.flags|=d:t=b,this.updateState=2,b.empty||(this.updatePlugins(b),this.inputState.update(b),this.updateAttrs(),v=this.docView.update(b),v&&this.docViewUpdate());for(let w=0;w1||S<-1)&&!(Ce.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){l=l+S,i?o<0?i.scrollTop=i.scrollHeight:i.scrollTop+=S:this.win.scrollBy(0,S),a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let f of this.state.facet(Sx))f(t)}get themeClasses(){return Dx+" "+(this.state.facet(Mx)?SN:kN)+" "+this.state.facet(Oh)}updateAttrs(){let e=_S(this,nN,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(al)?"true":"false",class:"cm-content",style:`${Ce.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),_S(this,Ry,t);let i=this.observer.ignore(()=>{let l=uS(this.contentDOM,this.contentAttrs,t),o=uS(this.dom,this.editorAttrs,e);return l||o});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let l of i.effects)if(l.is(Ee.announce)){t&&(this.announceDOM.textContent="",this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=" "},200),t=!1);let o=this.announceDOM.appendChild(document.createElement("div"));o.textContent=l.value}}mountStyles(){this.styleModules=this.state.facet(Gc);let e=this.state.facet(Ee.cspNonce);ls.mount(this.root,this.styleModules.concat(Rj).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&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(e.key!=null){for(let t=0;ti.plugin==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,i){return a0(this,e,xS(this,e,t,i))}moveByGroup(e,t){return a0(this,e,xS(this,e,t,i=>XR(this,e.head,i)))}visualLineSide(e,t){return t?le.cursor(e.to,1):le.cursor(e.from,-1)}moveToLineBoundary(e,t,i=!0){return QR(this,e,t,i)}moveVertically(e,t,i){return a0(this,e,$R(this,e,t,i))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let i=Nx(this,e,t);return i&&i.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Nx(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.state.doc.lineAt(e),l=this.bidiSpans(i),o=l[Lr.find(l,e-i.from,-1,t)];return i.length&&(e==i.from&&t<0||e==i.to&&t>0)&&o.dir!=this.textDirectionAt(i.from)&&(e==i.to?(e=i.from+o.from,t=1):(e=i.from+o.to,t=-1)),this.docView.coordsAt(e,t,o.dir==At.RTL)}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(ZO)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Bj)return VO(e.length);let t=this.textDirectionAt(e.from),i;for(let o of this.bidiCache)if(o.from==e.from&&o.dir==t&&(o.fresh||qO(o.isolates,i=dS(this,e))))return o.order;i||(i=dS(this,e));let l=yR(e.text,t,i);return this.bidiCache.push(new kd(e.from,e.to,t,i,!0,l)),l}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Ce.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{BO(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.win.clearTimeout(this.clearAnnouncement),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){var i,l,o,a;return bh.of(new wa(typeof e=="number"?le.cursor(e):e,(i=t.y)!==null&&i!==void 0?i:"nearest",(l=t.x)!==null&&l!==void 0?l:"nearest",(o=t.yMargin)!==null&&o!==void 0?o:5,(a=t.xMargin)!==null&&a!==void 0?a:5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return bh.of(new wa(le.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return en.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return en.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=ls.newName(),l=[Oh.of(i),Gc.of(Rx(`.${i}`,e))];return t&&t.dark&&l.push(Mx.of(!0)),l}static baseTheme(e){return ho.lowest(Gc.of(Rx("."+Dx,e,CN)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),l=i&&Gt.get(i)||Gt.get(e);return((t=l==null?void 0:l.root)===null||t===void 0?void 0:t.view)||null}}Ee.styleModule=Gc;Ee.inputHandler=KO;Ee.clipboardInputFilter=My;Ee.clipboardOutputFilter=Dy;Ee.scrollHandler=eN;Ee.focusChangeEffect=WO;Ee.perLineTextDirection=ZO;Ee.exceptionSink=GO;Ee.updateListener=Sx;Ee.editable=al;Ee.mouseSelectionStyle=YO;Ee.dragMovesSelection=$O;Ee.clickAddsSelectionRange=XO;Ee.decorations=Jd;Ee.blockWrappers=iN;Ee.outerDecorations=jy;Ee.atomicRanges=Du;Ee.bidiIsolatedRanges=rN;Ee.cursorScrollMargin=Ne.define({combine:n=>{let e=5,t=5;for(let i of n)typeof i=="number"?e=t=i:{x:e,y:t}=i;return{x:e,y:t}}});Ee.scrollMargins=sN;Ee.darkTheme=Mx;Ee.cspNonce=Ne.define({combine:n=>n.length?n[0]:""});Ee.contentAttributes=Ry;Ee.editorAttributes=nN;Ee.lineWrapping=Ee.contentAttributes.of({class:"cm-lineWrapping"});Ee.announce=Ke.define();const Bj=4096,jS={};class kd{constructor(e,t,i,l,o,a){this.from=e,this.to=t,this.dir=i,this.isolates=l,this.fresh=o,this.order=a}static update(e,t){if(t.empty&&!e.some(o=>o.fresh))return e;let i=[],l=e.length?e[e.length-1].dir:At.LTR;for(let o=Math.max(0,e.length-10);o=0;l--){let o=i[l],a=typeof o=="function"?o(n):o;a&&Ty(a,t)}return t}const Pj=Ce.mac?"mac":Ce.windows?"win":Ce.linux?"linux":"key";function Hj(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let l,o,a,u;for(let f=0;fi.concat(l),[]))),t}function Uj(n,e,t){return NN(ON(n.state),e,n,t)}let Wl=null;const Fj=4e3;function qj(n,e=Pj){let t=Object.create(null),i=Object.create(null),l=(a,u)=>{let f=i[a];if(f==null)i[a]=u;else if(f!=u)throw new Error("Key binding "+a+" is used both as a regular binding and as a multi-stroke prefix")},o=(a,u,f,d,m)=>{var g,b;let v=t[a]||(t[a]=Object.create(null)),w=u.split(/ (?!$)/).map(N=>Hj(N,e));for(let N=1;N{let U=Wl={view:D,prefix:j,scope:a};return setTimeout(()=>{Wl==U&&(Wl=null)},Fj),!0}]})}let S=w.join(" ");l(S,!1);let C=v[S]||(v[S]={preventDefault:!1,stopPropagation:!1,run:((b=(g=v._any)===null||g===void 0?void 0:g.run)===null||b===void 0?void 0:b.slice())||[]});f&&C.run.push(f),d&&(C.preventDefault=!0),m&&(C.stopPropagation=!0)};for(let a of n){let u=a.scope?a.scope.split(" "):["editor"];if(a.any)for(let d of u){let m=t[d]||(t[d]=Object.create(null));m._any||(m._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:g}=a;for(let b in m)m[b].run.push(v=>g(v,jx))}let f=a[e]||a.key;if(f)for(let d of u)o(d,f,a.run,a.preventDefault,a.stopPropagation),a.shift&&o(d,"Shift-"+f,a.shift,a.preventDefault,a.stopPropagation)}return t}let jx=null;function NN(n,e,t,i){jx=e;let l=iR(e),o=pi(l,0),a=jr(o)==l.length&&l!=" ",u="",f=!1,d=!1,m=!1;Wl&&Wl.view==t&&Wl.scope==i&&(u=Wl.prefix+" ",mN.indexOf(e.keyCode)<0&&(d=!0,Wl=null));let g=new Set,b=C=>{if(C){for(let N of C.run)if(!g.has(N)&&(g.add(N),N(t)))return C.stopPropagation&&(m=!0),!0;C.preventDefault&&(C.stopPropagation&&(m=!0),d=!0)}return!1},v=n[i],w,S;return v&&(b(v[u+Nh(l,e,!a)])?f=!0:a&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Ce.windows&&e.ctrlKey&&e.altKey)&&!(Ce.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(w=ss[e.keyCode])&&w!=l?(b(v[u+Nh(w,e,!0)])||e.shiftKey&&(S=du[e.keyCode])!=l&&S!=w&&b(v[u+Nh(S,e,!1)]))&&(f=!0):a&&e.shiftKey&&b(v[u+Nh(l,e,!0)])&&(f=!0),!f&&b(v._any)&&(f=!0)),d&&(f=!0),f&&m&&e.stopPropagation(),jx=null,f}class ro{constructor(e,t,i,l,o){this.className=e,this.left=t,this.top=i,this.width=l,this.height=o}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(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,i){if(i.empty){let l=e.coordsAtPos(i.head,i.assoc||1);if(!l)return[];let o=TN(e);return[new ro(t,l.left-o.left,l.top-o.top,null,l.bottom-l.top)]}else return Vj(e,t,i)}}function TN(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==At.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function zS(n,e,t,i){let l=n.coordsAtPos(e,t*2);if(!l)return i;let o=n.dom.getBoundingClientRect(),a=(l.top+l.bottom)/2,u=n.posAtCoords({x:o.left+1,y:a}),f=n.posAtCoords({x:o.right-1,y:a});return u==null||f==null?i:{from:Math.max(i.from,Math.min(u,f)),to:Math.min(i.to,Math.max(u,f))}}function Vj(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let i=Math.max(t.from,n.viewport.from),l=Math.min(t.to,n.viewport.to),o=n.textDirection==At.LTR,a=n.contentDOM,u=a.getBoundingClientRect(),f=TN(n),d=a.querySelector(".cm-line"),m=d&&window.getComputedStyle(d),g=u.left+(m?parseInt(m.paddingLeft)+Math.min(0,parseInt(m.textIndent)):0),b=u.right-(m?parseInt(m.paddingRight):0),v=Ox(n,i,1),w=Ox(n,l,-1),S=v.type==Pn.Text?v:null,C=w.type==Pn.Text?w:null;if(S&&(n.lineWrapping||v.widgetLineBreaks)&&(S=zS(n,i,1,S)),C&&(n.lineWrapping||w.widgetLineBreaks)&&(C=zS(n,l,-1,C)),S&&C&&S.from==C.from&&S.to==C.to)return j(D(t.from,t.to,S));{let H=S?D(t.from,null,S):U(v,!1),M=C?D(null,t.to,C):U(w,!0),A=[];return(S||v).to<(C||w).from-(S&&C?1:0)||v.widgetLineBreaks>1&&H.bottom+n.defaultLineHeight/2I&&pe.from=Z)break;T>ce&&W(Math.max(G,ce),H==null&&G<=I,Math.min(T,Z),M==null&&T>=re,K.dir)}if(ce=oe.to+1,ce>=Z)break}return F.length==0&&W(I,H==null,re,M==null,n.textDirection),{top:L,bottom:ne,horizontal:F}}function U(H,M){let A=u.top+(M?H.top:H.bottom);return{top:A,bottom:A,horizontal:[]}}}function Qj(n,e){return n.constructor==e.constructor&&n.eq(e)}class Xj{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(id)!=e.state.facet(id)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,i=e.facet(id);for(;t!Qj(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let l of e)l.update&&t&&l.constructor&&this.drawn[i].constructor&&l.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(l.draw(),t);for(;t;){let l=t.nextSibling;t.remove(),t=l}this.drawn=e,Ce.webkit&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const id=Ne.define();function AN(n){return[en.define(e=>new Xj(e,n)),id.of(n)]}const _x=!Ce.ios,ja=Ne.define({combine(n){return Ur(n,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function $j(n={}){return[ja.of(n),Yj,Gj,Wj,JO.of(!0)]}function EN(n){return n.startState.facet(ja)!=n.state.facet(ja)}const Yj=AN({above:!0,markers(n){let{state:e}=n,t=e.facet(ja),i=[];for(let l of e.selection.ranges){let o=l==e.selection.main;if(l.empty||t.drawRangeCursor&&!(o&&Ce.ios&&t.iosSelectionHandles)){let a=o?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",u=l.empty?l:le.cursor(l.head,l.assoc);for(let f of ro.forRange(n,a,u))i.push(f)}}return i},update(n,e){n.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=EN(n);return t&&BS(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){BS(e.state,n)},class:"cm-cursorLayer"});function BS(n,e){e.style.animationDuration=n.facet(ja).cursorBlinkRate+"ms"}const Gj=AN({above:!1,markers(n){let e=[],{main:t,ranges:i}=n.state.selection;for(let l of i)if(!l.empty&&(_x||l!=t))for(let o of ro.forRange(n,"cm-selectionBackground",l))e.push(o);if(Ce.ios&&!t.empty&&n.state.facet(ja).iosSelectionHandles){for(let l of ro.forRange(n,"cm-selectionHandle cm-selectionHandle-start",le.cursor(t.from,1)))e.push(l);for(let l of ro.forRange(n,"cm-selectionHandle cm-selectionHandle-end",le.cursor(t.to,1)))e.push(l)}return e},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||EN(n)},class:"cm-selectionLayer"}),Kj=Ce.gecko&&Ce.gecko_version==153?"#ffffff01":"transparent",Wj=ho.highest(Ee.theme({".cm-line":{..._x?{"& ::selection, &::selection":{backgroundColor:`${Kj} !important`}}:{},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important",..._x?{"&::selection, & ::selection":{backgroundColor:"Highlight !important"}}:{}}}})),MN=Ke.define({map(n,e){return n==null?null:e.mapPos(n)}}),Wc=Xn.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is(MN)?i.value:t,n)}}),Zj=en.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field(Wc);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field(Wc)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field(Wc),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let i=n.scrollDOM.getBoundingClientRect();return{left:t.left-i.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-i.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field(Wc)!=n&&this.view.dispatch({effects:MN.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function Jj(){return[Wc,Zj]}function PS(n,e,t,i,l){e.lastIndex=0;for(let o=n.iterRange(t,i),a=t,u;!o.next().done;a+=o.value.length)if(!o.lineBreak)for(;u=e.exec(o.value);)l(a+u.index,u)}function e_(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:l,to:o}of t)l=Math.max(n.state.doc.lineAt(l).from,l-e),o=Math.min(n.state.doc.lineAt(o).to,o+e),i.length&&i[i.length-1].to>=l?i[i.length-1].to=o:i.push({from:l,to:o});return i}class t_{constructor(e){const{regexp:t,decoration:i,decorate:l,boundary:o,maxLength:a=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,l)this.addMatch=(u,f,d,m)=>l(m,d,d+u[0].length,u,f);else if(typeof i=="function")this.addMatch=(u,f,d,m)=>{let g=i(u,f,d);g&&m(d,d+u[0].length,g)};else if(i)this.addMatch=(u,f,d,m)=>m(d,d+u[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=o,this.maxLength=a}createDeco(e){let t=new Ir,i=t.add.bind(t);for(let{from:l,to:o}of e_(e,this.maxLength))PS(e.state.doc,this.regexp,l,o,(a,u)=>this.addMatch(u,e,a,i));return t.finish()}updateDeco(e,t){let i=1e9,l=-1;return e.docChanged&&e.changes.iterChanges((o,a,u,f)=>{f>=e.view.viewport.from&&u<=e.view.viewport.to&&(i=Math.min(u,i),l=Math.max(f,l))}),e.viewportMoved||l-i>1e3?this.createDeco(e.view):l>-1?this.updateRange(e.view,t.map(e.changes),i,l):t}updateRange(e,t,i,l){for(let o of e.visibleRanges){let a=Math.max(o.from,i),u=Math.min(o.to,l);if(u>=a){let f=e.state.doc.lineAt(a),d=f.tof.from;a--)if(this.boundary.test(f.text[a-1-f.from])){m=a;break}for(;ub.push(N.range(S,C));if(f==d)for(this.regexp.lastIndex=m-f.from;(v=this.regexp.exec(f.text))&&v.indexthis.addMatch(C,e,S,w));t=t.update({filterFrom:m,filterTo:g,filter:(S,C)=>Sg,add:b})}}return t}}const Lx=/x/.unicode!=null?"gu":"g",n_=new RegExp(`[\0-\b +--Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,Lx),i_={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 f0=null;function r_(){var n;if(f0==null&&typeof document<"u"&&document.body){let e=document.body.style;f0=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return f0||!1}const rd=Ne.define({combine(n){let e=Ur(n,{render:null,specialChars:n_,addSpecialChars:null});return(e.replaceTabs=!r_())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Lx)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Lx)),e}});function l_(n={}){return[rd.of(n),s_()]}let HS=null;function s_(){return HS||(HS=en.fromClass(class{constructor(n){this.view=n,this.decorations=Fe.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(rd)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new t_({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:l}=t.state,o=pi(e[0],0);if(o==9){let a=l.lineAt(i),u=t.state.tabSize,f=Ba(a.text,u,i-a.from);return Fe.replace({widget:new u_((u-f%u)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[o]||(this.decorationCache[o]=Fe.replace({widget:new c_(n,o)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(rd);n.startState.facet(rd)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const o_="•";function a_(n){return n>=32?o_:n==10?"␤":String.fromCharCode(9216+n)}class c_ extends pl{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=a_(this.code),i=e.state.phrase("Control character")+" "+(i_[this.code]||"0x"+this.code.toString(16)),l=this.options.render&&this.options.render(this.code,i,t);if(l)return l;let o=document.createElement("span");return o.textContent=t,o.title=i,o.setAttribute("aria-label",i),o.className="cm-specialChar",o}ignoreEvent(){return!1}}class u_ extends pl{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function f_(){return d_}const h_=Fe.line({class:"cm-activeLine"}),d_=en.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let l=n.lineBlockAt(i.head);l.from>e&&(t.push(h_.range(l.from)),e=l.from)}return Fe.set(t)}},{decorations:n=>n.decorations}),zx=2e3;function m_(n,e,t){let i=Math.min(e.line,t.line),l=Math.max(e.line,t.line),o=[];if(e.off>zx||t.off>zx||e.col<0||t.col<0){let a=Math.min(e.off,t.off),u=Math.max(e.off,t.off);for(let f=i;f<=l;f++){let d=n.doc.line(f);d.length<=u&&o.push(le.range(d.from+a,d.to+u))}}else{let a=Math.min(e.col,t.col),u=Math.max(e.col,t.col);for(let f=i;f<=l;f++){let d=n.doc.line(f),m=hx(d.text,a,n.tabSize,!0);if(m<0)o.push(le.cursor(d.to));else{let g=hx(d.text,u,n.tabSize);o.push(le.range(d.from+m,d.from+g))}}}return o}function p_(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function IS(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),l=t-i.from,o=l>zx?-1:l==i.length?p_(n,e.clientX):Ba(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:o,off:l}}function g_(n,e){let t=IS(n,e),i=n.state.selection;return t?{update(l){if(l.docChanged){let o=l.changes.mapPos(l.startState.doc.line(t.line).from),a=l.state.doc.lineAt(o);t={line:a.number,col:t.col,off:Math.min(t.off,a.length)},i=i.map(l.changes)}},get(l,o,a){let u=IS(n,l);if(!u)return i;let f=m_(n.state,t,u);return f.length?a?le.create(f.concat(i.ranges)):le.create(f):i}}:null}function x_(n){let e=(t=>t.altKey&&t.button==0);return Ee.mouseSelectionStyle.of((t,i)=>e(i)?g_(t,i):null)}const y_={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},b_={style:"cursor: crosshair"};function v_(n={}){let[e,t]=y_[n.key||"Alt"],i=en.fromClass(class{constructor(l){this.view=l,this.isDown=!1}set(l){this.isDown!=l&&(this.isDown=l,this.view.update([]))}},{eventObservers:{keydown(l){this.set(l.keyCode==e||t(l))},keyup(l){(l.keyCode==e||!t(l))&&this.set(!1)},mousemove(l){this.set(t(l))}}});return[i,Ee.contentAttributes.of(l=>{var o;return!((o=l.plugin(i))===null||o===void 0)&&o.isDown?b_:null})]}const Th="-10000px";class DN{constructor(e,t,i,l){this.facet=t,this.createTooltipView=i,this.removeTooltipView=l,this.input=e.state.facet(t),this.tooltips=this.input.filter(a=>a);let o=null;this.tooltipViews=this.tooltips.map(a=>o=i(a,o))}update(e,t){var i;let l=e.state.facet(this.facet),o=l.filter(f=>f);if(l===this.input){for(let f of this.tooltipViews)f.update&&f.update(e);return!1}let a=[],u=t?[]:null;for(let f=0;ft[d]=f),t.length=u.length),this.input=l,this.tooltips=o,this.tooltipViews=a,!0}}function RN(n){let e=n.dom.ownerDocument.documentElement,t=e.clientWidth,i=getComputedStyle(e);if(!/stable/.test(i.scrollbarGutter||""))return{left:0,right:t};let l=e.getBoundingClientRect(),o=n.win.scrollX;return{left:Math.max(0,l.left+o-parseFloat(i.marginLeft)),right:Math.min(t,l.right+o+parseFloat(i.marginRight))}}function w_(n){let{left:e,right:t}=RN(n);return{top:0,left:e,right:t,bottom:n.dom.ownerDocument.documentElement.clientHeight}}const h0=Ne.define({combine:n=>{var e,t,i;return{position:Ce.ios?"absolute":((e=n.find(l=>l.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(l=>l.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(l=>l.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||w_}}}),US=new WeakMap,Py=en.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(h0);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new DN(n,Hy,(t,i)=>this.createTooltip(t,i),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.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 n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(h0);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let l of this.manager.tooltipViews)l.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let l of this.manager.tooltipViews)this.container.appendChild(l.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),i=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let l=document.createElement("div");l.className="cm-tooltip-arrow",t.dom.appendChild(l)}return t.dom.style.position=this.position,t.dom.style.top=Th,t.dom.style.left="0px",this.container.insertBefore(t.dom,i),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(n=i.destroy)===null||n===void 0||n.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1,i=0;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:a}=this.manager.tooltipViews[0];if(Ce.safari){let u=a.getBoundingClientRect();t=Math.abs(u.top+1e4)>1||Math.abs(u.left)>1}else t=!!a.offsetParent&&a.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let a=this.parent.getBoundingClientRect();a.width&&a.height&&(n=a.width/this.parent.offsetWidth,e=a.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);else i=RN(this.view).left;let l=this.view.scrollDOM.getBoundingClientRect(),o=_y(this.view);return{visible:{left:l.left+o.left,top:l.top+o.top,right:l.right-o.right,bottom:l.bottom-o.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((a,u)=>{let f=this.manager.tooltipViews[u];return f.getCoords?f.getCoords(a.pos):this.view.coordsAtPos(a.pos)}),size:this.manager.tooltipViews.map(({dom:a})=>a.getBoundingClientRect()),space:this.view.state.facet(h0).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t,fixedLeft:i}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let u of this.manager.tooltipViews)u.dom.style.position="absolute"}let{visible:t,space:i,scaleX:l,scaleY:o}=n,a=[];for(let u=0;u=Math.min(t.bottom,i.bottom)||g.rightMath.min(t.right,i.right)+.1)){m.style.top=Th;continue}let v=f.arrow?d.dom.querySelector(".cm-tooltip-arrow"):null,w=v?7:0,S=b.right-b.left,C=(e=US.get(d))!==null&&e!==void 0?e:b.bottom-b.top,N=d.offset||S_,j=this.view.textDirection==At.LTR,D=b.width>i.right-i.left?j?i.left:i.right-b.width:j?Math.max(i.left,Math.min(g.left-(v?14:0)+N.x,i.right-S)):Math.min(Math.max(i.left,g.left-S+(v?14:0)-N.x),i.right-S),U=this.above[u];!f.strictSide&&(U?g.top-C-w-N.yi.bottom)&&U==i.bottom-g.bottom>g.top-i.top&&(U=this.above[u]=!U);let H=(U?g.top-i.top:i.bottom-g.bottom)-w;if(HD&&L.topM&&(M=U?L.top-C-2-w:L.bottom+w+2);if(this.position=="absolute"?(m.style.top=(M-n.parent.top)/o+"px",FS(m,(D-n.parent.left)/l)):(m.style.top=M/o+"px",FS(m,(D-n.fixedLeft)/l)),v){let L=g.left+(j?N.x:-N.x)-(D+14-7);v.style.left=L/l+"px"}d.overlap!==!0&&a.push({left:D,top:M,right:A,bottom:M+C}),m.classList.toggle("cm-tooltip-above",U),m.classList.toggle("cm-tooltip-below",!U),d.positioned&&d.positioned(n.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 n of this.manager.tooltipViews)n.dom.style.top=Th}},{eventObservers:{scroll(){this.maybeMeasure()}}});function FS(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const k_=Ee.baseTheme({".cm-tooltip":{zIndex:500,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"}}}),S_={x:0,y:0},Hy=Ne.define({enables:[Py,k_]}),Sd=Ne.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class im{static create(e){return new im(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new DN(e,Sd,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}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)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let l=i[e];if(l!==void 0){if(t===void 0)t=l;else if(t!==l)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const C_=Hy.compute([Sd],n=>{let e=n.facet(Sd);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:im.create,above:e[0].above,arrow:e.some(t=>t.arrow)}}),jN=Ne.define();class O_{constructor(e,t,i,l,o,a){this.view=e,this.source=t,this.field=i,this.locked=l,this.setHover=o,this.hoverTime=a,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(e){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.length)return;let e=Date.now()-this.lastMove.time;ea.bottom||t.xa.right+e.defaultCharacterWidth)return;let u=e.bidiSpans(e.state.doc.lineAt(l)).find(d=>d.from<=l&&d.to>=l),f=u&&u.dir==At.RTL?-1:1;o=t.x{if(u&&!(Array.isArray(u)&&!u.length)){let f=Array.isArray(u)?u:[u];l&&this.locked.set(f,l),e.dispatch({effects:this.setHover.of(f)})}};if(o&&"then"in o){let u=this.pending={pos:t};o.then(f=>{this.pending==u&&(this.pending=null,a(f))},f=>yi(e.state,f,"hover tooltip"))}else a(o)}get tooltip(){let e=this.view.plugin(Py),t=e?e.manager.tooltips.findIndex(i=>i.create==im.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;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{active:l,tooltip:o}=this;if(l.length&&!this.locked.has(l)&&o&&!N_(o.dom,e)||this.pending){let{pos:a}=l[0]||this.pending,u=(i=(t=l[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:a;(a==u?this.view.posAtCoords(this.lastMove)!=a:!T_(this.view,a,u,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length&&!this.locked.has(t)){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t);let{active:l}=this;l.length&&!this.locked.has(l)&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Ah=4;function N_(n,e){let{left:t,right:i,top:l,bottom:o}=n.getBoundingClientRect(),a;if(a=n.querySelector(".cm-tooltip-arrow")){let u=a.getBoundingClientRect();l=Math.min(u.top,l),o=Math.max(u.bottom,o)}return e.clientX>=t-Ah&&e.clientX<=i+Ah&&e.clientY>=l-Ah&&e.clientY<=o+Ah}function T_(n,e,t,i,l,o){let a=n.scrollDOM.getBoundingClientRect(),u=n.documentTop+n.documentPadding.top+n.contentHeight;if(a.left>i||a.rightl||Math.min(a.bottom,u)=e&&f<=t}function A_(n,e={}){let t=Ke.define(),i=new WeakMap,l=Xn.define({create(){return[]},update(a,u){let f=i.get(a);if(a.length&&(e.hideOnChange&&(u.docChanged||u.selection)?a=[]:f&&f(u)?a=[]:e.hideOn&&(a=a.filter(d=>!e.hideOn(u,d)))),u.docChanged&&a.length){let d=[];for(let m of a){let g=u.changes.mapPos(m.pos,-1,ii.TrackDel);if(g!=null){let b=Object.assign(Object.create(null),m);b.pos=g,b.end!=null&&(b.end=u.changes.mapPos(b.end)),d.push(b)}}a=d}for(let d of u.effects)d.is(t)&&(a=d.value,f=void 0),(d.is(M_)&&!d.value||d.value==l)&&(a=[]);return a.length&&f&&i.set(a,f),a},provide:a=>Sd.from(a)});const o=en.define(a=>new O_(a,n,l,i,t,e.hoverTime||300));return{active:l,extension:[l,o,jN.of(o),C_]}}function E_(n,e,t,i={}){var l;let o=n.state.facet(jN).map(a=>n.plugin(a)).filter(a=>!!a);if(i.tooltip&&i.tooltip.active){let a=o.find(u=>u.field==i.tooltip.active);a&&(o=[a])}for(let a of o)a.activateHover(n,e,t,(l=i.until)!==null&&l!==void 0?l:(()=>!1))}function _N(n,e){let t=n.plugin(Py);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const M_=Ke.define(),qS=Ne.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function rm(n,e){let t=n.plugin(LN),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const LN=en.fromClass(class{constructor(n){this.input=n.state.facet(xu),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(qS);this.top=new Eh(n,!0,e.topContainer),this.bottom=new Eh(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(qS);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new Eh(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new Eh(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(xu);if(t!=this.input){let i=t.filter(f=>f),l=[],o=[],a=[],u=[];for(let f of i){let d=this.specs.indexOf(f),m;d<0?(m=f(n.view),u.push(m)):(m=this.panels[d],m.update&&m.update(n)),l.push(m),(m.top?o:a).push(m)}this.specs=i,this.panels=l,this.top.sync(o),this.bottom.sync(a);for(let f of u)f.dom.classList.add("cm-panel"),f.mount&&f.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>Ee.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class Eh{constructor(e,t,i){this.view=e,this.top=t,this.container=i,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(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=VS(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=VS(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 VS(n){let e=n.nextSibling;return n.remove(),e}const xu=Ne.define({enables:LN});function D_(n,e){let t,i=new Promise(a=>t=a),l=a=>j_(a,e,t);n.state.field(ld,!1)?n.dispatch({effects:zN.of(l)}):n.dispatch({effects:Ke.appendConfig.of(ld.init(()=>[l]))});let o=BN.of(l);return{close:o,result:i.then(a=>((n.win.queueMicrotask||(f=>n.win.setTimeout(f,10)))(()=>{n.state.field(ld).indexOf(l)>-1&&n.dispatch({effects:o})}),a))}}function R_(n,e){let t=n.state.field(ld,!1)||[];for(let i of t){let l=rm(n,i);if(l&&l.dom.classList.contains(e))return l}return null}const ld=Xn.define({create(){return[]},update(n,e){for(let t of e.effects)t.is(zN)?n=[t.value].concat(n):t.is(BN)&&(n=n.filter(i=>i!=t.value));return n},provide:n=>xu.computeN([n],e=>e.field(n))}),zN=Ke.define(),BN=Ke.define();function j_(n,e,t){let i=e.content?e.content(n,()=>u(null)):null;if(!i){if(i=Tt("form"),e.input){let f=Tt("input",e.input);/^(text|password|number|email|tel|url)$/.test(f.type)&&f.classList.add("cm-textfield"),f.name||(f.name="input"),i.appendChild(Tt("label",(e.label||"")+": ",f))}else i.appendChild(document.createTextNode(e.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild(Tt("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let l=i.nodeName=="FORM"?[i]:i.querySelectorAll("form");for(let f=0;f{m.keyCode==27?(m.preventDefault(),u(null)):m.keyCode==13&&(m.preventDefault(),u(d))}),d.addEventListener("submit",m=>{m.preventDefault(),u(d)})}let o=Tt("div",i,Tt("button",{onclick:()=>u(null),"aria-label":n.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(o.className=e.class),o.classList.add("cm-dialog");let a=typeof e.focus=="string"?i.querySelector(e.focus):e.focus?i.querySelector("input")||i.querySelector("button"):null;function u(f){o.contains(o.ownerDocument.activeElement)&&n.focus(),t(f)}return{dom:o,top:e.top,mount:()=>{a&&("select"in a?a.select():"focus"in a&&a.focus())},destroy:()=>t(null)}}class hl extends rs{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}hl.prototype.elementClass="";hl.prototype.toDOM=void 0;hl.prototype.mapMode=ii.TrackBefore;hl.prototype.startSide=hl.prototype.endSide=-1;hl.prototype.point=!0;const sd=Ne.define(),__=Ne.define(),L_={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>rt.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},ru=Ne.define();function z_(n){return[PN(),ru.of({...L_,...n})]}const QS=Ne.define({combine:n=>n.some(e=>e)});function PN(n){return[B_]}const B_=en.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(ru).map(e=>new $S(n,e)),this.fixed=!n.state.facet(QS);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}if(n.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(QS)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=rt.iter(this.view.state.facet(sd),this.view.viewport.from),i=[],l=this.gutters.map(o=>new P_(o,this.view.viewport,-this.view.documentPadding.top));for(let o of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(o.type)){let a=!0;for(let u of o.type)if(u.type==Pn.Text&&a){Bx(t,i,u.from);for(let f of l)f.line(this.view,u,i);a=!1}else if(u.widget)for(let f of l)f.widget(this.view,u)}else if(o.type==Pn.Text){Bx(t,i,o.from);for(let a of l)a.line(this.view,o,i)}else if(o.widget)for(let a of l)a.widget(this.view,o);for(let o of l)o.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(ru),t=n.state.facet(ru),i=n.docChanged||n.heightChanged||n.viewportChanged||!rt.eq(n.startState.facet(sd),n.state.facet(sd),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let l of this.gutters)l.update(n)&&(i=!0);else{i=!0;let l=[];for(let o of t){let a=e.indexOf(o);a<0?l.push(new $S(this.view,o)):(this.gutters[a].update(n),l.push(this.gutters[a]))}for(let o of this.gutters)o.dom.remove(),l.indexOf(o)<0&&o.destroy();for(let o of l)o.config.side=="after"?this.getDOMAfter().appendChild(o.dom):this.dom.appendChild(o.dom);this.gutters=l}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>Ee.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let i=t.dom.offsetWidth*e.scaleX,l=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==At.LTR?{left:i,right:l}:{right:i,left:l}})});function XS(n){return Array.isArray(n)?n:[n]}function Bx(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class P_{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=rt.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:l}=this,o=(t.top-this.height)/e.scaleY,a=t.height/e.scaleY;if(this.i==l.elements.length){let u=new HN(e,a,o,i);l.elements.push(u),l.dom.appendChild(u.dom)}else l.elements[this.i].update(e,a,o,i);this.height=t.bottom,this.i++}line(e,t,i){let l=[];Bx(this.cursor,l,t.from),i.length&&(l=l.concat(i));let o=this.gutter.config.lineMarker(e,t,l);o&&l.unshift(o);let a=this.gutter;l.length==0&&!a.config.renderEmptyElements||this.addElement(e,t,l)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),l=i?[i]:null;for(let o of e.state.facet(__)){let a=o(e,t.widget,t);a&&(l||(l=[])).push(a)}l&&this.addElement(e,t,l)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class $S{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 i in t.domEventHandlers)this.dom.addEventListener(i,l=>{let o=l.target,a;if(o!=this.dom&&this.dom.contains(o)){for(;o.parentNode!=this.dom;)o=o.parentNode;let f=o.getBoundingClientRect();a=(f.top+f.bottom)/2}else a=l.clientY;let u=e.lineBlockAtHeight(a-e.documentTop);t.domEventHandlers[i](e,u,l)&&l.preventDefault()});this.markers=XS(t.markers(e)),t.initialSpacer&&(this.spacer=new HN(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=XS(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let l=this.config.updateSpacer(this.spacer.markers[0],e);l!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[l])}let i=e.view.viewport;return!rt.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class HN{constructor(e,t,i,l){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,l)}update(e,t,i,l){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),H_(this.markers,l)||this.setMarkers(e,l)}setMarkers(e,t){let i="cm-gutterElement",l=this.dom.firstChild;for(let o=0,a=0;;){let u=a,f=oo(u,f,d)||a(u,f,d):a}return i}})}});class d0 extends hl{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function m0(n,e){return n.state.facet(ma).formatNumber(e,n.state)}const F_=ru.compute([ma],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(I_)},lineMarker(e,t,i){return i.some(l=>l.toDOM)?null:new d0(m0(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let l of e.state.facet(U_)){let o=l(e,t,i);if(o)return o}return null},lineMarkerChange:e=>e.startState.facet(ma)!=e.state.facet(ma),initialSpacer(e){return new d0(m0(e,YS(e.state.doc.lines)))},updateSpacer(e,t){let i=m0(t.view,YS(t.view.state.doc.lines));return i==e.number?e:new d0(i)},domEventHandlers:n.facet(ma).domEventHandlers,side:"before"}));function q_(n={}){return[ma.of(n),PN(),F_]}function YS(n){let e=9;for(;e{let e=[],t=-1;for(let i of n.selection.ranges){let l=n.doc.lineAt(i.head).from;l>t&&(t=l,e.push(V_.range(l)))}return rt.of(e)});function X_(){return Q_}const IN=1024;let $_=0;class p0{constructor(e,t){this.from=e,this.to=t}}class et{constructor(e={}){this.id=$_++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=vi.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}et.closedBy=new et({deserialize:n=>n.split(" ")});et.openedBy=new et({deserialize:n=>n.split(" ")});et.group=new et({deserialize:n=>n.split(" ")});et.isolate=new et({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});et.contextHash=new et({perNode:!0});et.lookAhead=new et({perNode:!0});et.mounted=new et({perNode:!0});class lu{constructor(e,t,i,l=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=l}static get(e){return e&&e.props&&e.props[et.mounted.id]}}const Y_=Object.create(null);class vi{constructor(e,t,i,l=0){this.name=e,this.props=t,this.id=i,this.flags=l}static define(e){let t=e.props&&e.props.length?Object.create(null):Y_,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),l=new vi(e.name||"",t,e.id,i);if(e.props){for(let o of e.props)if(Array.isArray(o)||(o=o(l)),o){if(o[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[o[0].id]=o[1]}}return l}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(et.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let l of i.split(" "))t[l]=e[i];return i=>{for(let l=i.prop(et.group),o=-1;o<(l?l.length:0);o++){let a=t[o<0?i.name:l[o]];if(a)return a}}}}vi.none=new vi("",Object.create(null),0,8);class Iy{constructor(e){this.types=e;for(let t=0;t0;for(let f=this.cursor(a|Yt.IncludeAnonymous);;){let d=!1;if(f.from<=o&&f.to>=l&&(!u&&f.type.isAnonymous||t(f)!==!1)){if(f.firstChild())continue;d=!0}for(;d&&i&&(u||!f.type.isAnonymous)&&i(f),!f.nextSibling();){if(!f.parent())return;d=!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:qy(vi.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,l)=>new un(this.type,t,i,l,this.propValues),e.makeTree||((t,i,l)=>new un(vi.none,t,i,l)))}static build(e){return Z_(e)}}un.empty=new un(vi.none,[],[],0);class Uy{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 Uy(this.buffer,this.index)}}class as{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return vi.none}toString(){let e=[];for(let t=0;t0));f=a[f+3]);return u}slice(e,t,i){let l=this.buffer,o=new Uint16Array(t-e),a=0;for(let u=e,f=0;u=e&&te;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function yu(n,e,t,i){for(var l;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to0?u.length:-1;e!=d;e+=t){let m=u[e],g=f[e]+a.from,b;if(!(!(o&Yt.EnterBracketed&&m instanceof un&&(b=lu.get(m))&&!b.overlay&&b.bracketed&&i>=g&&i<=g+m.length)&&!UN(l,i,g,g+m.length))){if(m instanceof as){if(o&Yt.ExcludeBuffers)continue;let v=m.findChild(0,m.buffer.length,t,i-g,l);if(v>-1)return new Jl(new G_(a,m,e,g),null,v)}else if(o&Yt.IncludeAnonymous||!m.type.isAnonymous||Fy(m)){let v;if(!(o&Yt.IgnoreMounts)&&(v=lu.get(m))&&!v.overlay)return new Gi(v.tree,g,e,a);let w=new Gi(m,g,e,a);return o&Yt.IncludeAnonymous||!w.type.isAnonymous?w:w.nextChild(t<0?m.children.length-1:0,t,i,l,o)}}}if(o&Yt.IncludeAnonymous||!a.type.isAnonymous||(a.index>=0?e=a.index+t:e=t<0?-1:a._parent._tree.children.length,a=a._parent,!a))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)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let l;if(!(i&Yt.IgnoreOverlays)&&(l=lu.get(this._tree))&&l.overlay){let o=e-this.from,a=i&Yt.EnterBracketed&&l.bracketed;for(let{from:u,to:f}of l.overlay)if((t>0||a?u<=o:u=o:f>o))return new Gi(l.tree,l.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}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 KS(n,e,t,i){let l=n.cursor(),o=[];if(!l.firstChild())return o;if(t!=null){for(let a=!1;!a;)if(a=l.type.is(t),!l.nextSibling())return o}for(;;){if(i!=null&&l.type.is(i))return o;if(l.type.is(e)&&o.push(l.node),!l.nextSibling())return i==null?o:[]}}function Px(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class G_{constructor(e,t,i,l){this.parent=e,this.buffer=t,this.index=i,this.start=l}}class Jl extends FN{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,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.context.start,i);return o<0?null:new Jl(this.context,this,o)}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)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&Yt.ExcludeBuffers)return null;let{buffer:l}=this.context,o=l.findChild(this.index+4,l.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return o<0?null:new Jl(this.context,this,o)}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 Jl(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 Jl(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,l=this.index+4,o=i.buffer[this.index+3];if(o>l){let a=i.buffer[this.index+1];e.push(i.slice(l,o,a)),t.push(0)}return new un(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function qN(n){if(!n.length)return null;let e=0,t=n[0];for(let o=1;ot.from||a.to=e){let u=new Gi(a.tree,a.overlay[0].from+o.from,-1,o);(l||(l=[i])).push(yu(u,e,t,!1))}}return l?qN(l):i}class Hx{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~Yt.EnterBracketed,e instanceof Gi)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:l}=this.buffer;return this.type=t||l.set.types[l.buffer[e]],this.from=i+l.buffer[e+1],this.to=i+l.buffer[e+2],!0}yield(e){return e?e instanceof Gi?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:l}=this.buffer,o=l.findChild(this.index+4,l.buffer[this.index+3],e,t-this.buffer.start,i);return o<0?!1:(this.stack.push(this.index),this.yieldBuf(o))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&Yt.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Yt.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Yt.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let l=i<0?0:this.stack[i]+4;if(this.index!=l)return this.yieldBuf(t.findChild(l,this.index,-1,0,4))}else{let l=t.buffer[this.index+3];if(l<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(l)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:l}=this;if(l){if(e>0){if(this.index-1)for(let o=t+e,a=e<0?-1:i._tree.children.length;o!=a;o+=e){let u=i._tree.children[o];if(this.mode&Yt.IncludeAnonymous||u instanceof as||!u.type.isAnonymous||Fy(u))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 a=e;a;a=a._parent)if(a.index==l){if(l==this.index)return a;t=a,i=o+1;break e}l=this.stack[--o]}for(let l=i;l=0;o--){if(o<0)return Px(this._tree,e,l);let a=i[t.buffer[this.stack[o]]];if(!a.isAnonymous){if(e[l]&&e[l]!=a.name)return!1;l--}}return!0}}function Fy(n){return n.children.some(e=>e instanceof as||!e.type.isAnonymous||Fy(e))}function Z_(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:l=IN,reused:o=[],minRepeatType:a=i.types.length}=n,u=Array.isArray(t)?new Uy(t,t.length):t,f=i.types,d=0,m=0;function g(H,M,A,L,ne,F){let{id:W,start:I,end:re,size:pe}=u,ce=m,Z=d;if(pe<0)if(u.next(),pe==-1){let de=o[W];A.push(de),L.push(I-H);return}else if(pe==-3){d=W;return}else if(pe==-4){m=W;return}else throw new RangeError(`Unrecognized record size: ${pe}`);let oe=f[W],K,G,T=I-H;if(re-I<=l&&(G=C(u.pos-M,ne))){let de=new Uint16Array(G.size-G.skip),be=u.pos-G.size,z=de.length;for(;u.pos>be;)z=N(G.start,de,z);K=new as(de,re-G.start,i),T=G.start-H}else{let de=u.pos-pe;u.next();let be=[],z=[],R=W>=a?W:-1,Q=0,he=re,ge=ce;for(;u.pos>de;)R>=0&&u.id==R&&u.size>=0?(u.end<=he-l&&(w(be,z,I,Q,u.end,he,R,ge,Z),Q=be.length,he=u.end,ge=m),u.next()):F>2500?b(I,de,be,z):(R>=0&&u.size==-1&&o[u.id].type==i.types[R]&&(Q=0&&Q>0&&Q-1&&Q>0){let ze=v(oe,Z);K=qy(oe,be,z,0,be.length,0,re-I,ze,ze)}else K=S(oe,be,z,re-I,ce-re,Z)}A.push(K),L.push(T)}function b(H,M,A,L){let ne=[],F=0,W=-1;for(;u.pos>M;){let{id:I,start:re,end:pe,size:ce}=u;if(ce>4)u.next();else{if(W>-1&&re=0;pe-=3)I[ce++]=ne[pe],I[ce++]=ne[pe+1]-re,I[ce++]=ne[pe+2]-re,I[ce++]=ce;A.push(new as(I,ne[2]-re,i)),L.push(re-H)}}function v(H,M){return(A,L,ne)=>{let F=0,W=A.length-1,I,re;if(W>=0&&(I=A[W])instanceof un){if(!W&&I.type==H&&I.length==ne)return I;(re=I.prop(et.lookAhead))&&(F=L[W]+I.length+re-ne)}return S(H,A,L,ne,F,M)}}function w(H,M,A,L,ne,F,W,I,re){let pe=[],ce=[];for(;H.length>L;)pe.push(H.pop()),ce.push(M.pop()+A-ne);H.push(S(i.types[W],pe,ce,F-ne,I-F,re)),M.push(ne-A)}function S(H,M,A,L,ne,F,W){if(F){let I=[et.contextHash,F];W=W?[I].concat(W):[I]}if(ne>25){let I=[et.lookAhead,ne];W=W?[I].concat(W):[I]}return new un(H,M,A,L,W)}function C(H,M){let A=u.fork(),L=0,ne=0,F=0,W=A.end-l,I={size:0,start:0,skip:0};e:for(let re=A.pos-H;A.pos>re;){let pe=A.size;if(A.id==M&&pe>=0){I.size=L,I.start=ne,I.skip=F,F+=4,L+=4,A.next();continue}let ce=A.pos-pe;if(pe<0||ce=a?4:0,oe=A.start;for(A.next();A.pos>ce;){if(A.size<0)if(A.size==-3||A.size==-4)Z+=4;else break e;else A.id>=a&&(Z+=4);A.next()}ne=oe,L+=pe,F+=Z}return(M<0||L==H)&&(I.size=L,I.start=ne,I.skip=F),I.size>4?I:void 0}function N(H,M,A){let{id:L,start:ne,end:F,size:W}=u;if(u.next(),W>=0&&L4){let re=u.pos-(W-4);for(;u.pos>re;)A=N(H,M,A)}M[--A]=I,M[--A]=F-H,M[--A]=ne-H,M[--A]=L}else W==-3?d=L:W==-4&&(m=L);return A}let j=[],D=[];for(;u.pos>0;)g(n.start||0,n.bufferStart||0,j,D,-1,0);let U=(e=n.length)!==null&&e!==void 0?e:j.length?D[0]+j[0].length:0;return new un(f[n.topID],j.reverse(),D.reverse(),U)}const WS=new WeakMap;function od(n,e){if(!n.isAnonymous||e instanceof as||e.type!=n)return 1;let t=WS.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof un)){t=1;break}t+=od(n,i)}WS.set(e,t)}return t}function qy(n,e,t,i,l,o,a,u,f){let d=0;for(let w=i;w=m)break;M+=A}if(D==U+1){if(M>m){let A=w[U];v(A.children,A.positions,0,A.children.length,S[U]+j);continue}g.push(w[U])}else{let A=S[D-1]+w[D-1].length-H;g.push(qy(n,w,S,U,D,H,A,null,f))}b.push(H+j-o)}}return v(e,t,i,l,0),(u||f)(g,b,a)}class lo{constructor(e,t,i,l,o=!1,a=!1){this.from=e,this.to=t,this.tree=i,this.offset=l,this.open=(o?1:0)|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let l=[new lo(0,e.length,e,0,!1,i)];for(let o of t)o.to>e.length&&l.push(o);return l}static applyChanges(e,t,i=128){if(!t.length)return e;let l=[],o=1,a=e.length?e[0]:null;for(let u=0,f=0,d=0;;u++){let m=u=i)for(;a&&a.from=b.from||g<=b.to||d){let v=Math.max(b.from,f)-d,w=Math.min(b.to,g)-d;b=v>=w?null:new lo(v,w,b.tree,b.offset+d,u>0,!!m)}if(b&&l.push(b),a.to>g)break;a=onew p0(l.from,l.to)):[new p0(0,0)]:[new p0(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let l=this.startParse(e,t,i);for(;;){let o=l.advance();if(o)return o}}}class J_{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 et({perNode:!0});let eL=0,sl=class Ix{constructor(e,t,i,l){this.name=e,this.set=t,this.base=i,this.modified=l,this.id=eL++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof Ix&&(t=e),t!=null&&t.base)throw new Error("Can not derive from a modified tag");let l=new Ix(i,[],null,[]);if(l.set.push(l),t)for(let o of t.set)l.set.push(o);return l}static defineModifier(e){let t=new Cd(e);return i=>i.modified.indexOf(t)>-1?i:Cd.get(i.base||i,i.modified.concat(t).sort((l,o)=>l.id-o.id))}},tL=0;class Cd{constructor(e){this.name=e,this.instances=[],this.id=tL++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(u=>u.base==e&&nL(t,u.modified));if(i)return i;let l=[],o=new sl(e.name,l,e,t);for(let u of t)u.instances.push(o);let a=iL(t);for(let u of e.set)if(!u.modified.length)for(let f of a)l.push(Cd.get(u,f));return o}}function nL(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function iL(n){let e=[[]];for(let t=0;ti.length-t.length)}function QN(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let l of t.split(" "))if(l){let o=[],a=2,u=l;for(let g=0;;){if(u=="..."&&g>0&&g+3==l.length){a=1;break}let b=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(u);if(!b)throw new RangeError("Invalid path: "+l);if(o.push(b[0]=="*"?"":b[0][0]=='"'?JSON.parse(b[0]):b[0]),g+=b[0].length,g==l.length)break;let v=l[g++];if(g==l.length&&v=="!"){a=0;break}if(v!="/")throw new RangeError("Invalid path: "+l);u=l.slice(g)}let f=o.length-1,d=o[f];if(!d)throw new RangeError("Invalid path: "+l);let m=new bu(i,a,f>0?o.slice(0,f):null);e[d]=m.sort(e[d])}}return XN.add(e)}const XN=new et({combine(n,e){let t,i,l;for(;n||e;){if(!n||e&&n.depth<=e.depth?(l=e,e=e.next):(l=n,n=n.next),t&&t.mode==l.mode&&!l.context&&!t.context)continue;let o=new bu(l.tags,l.mode,l.context);t?t.next=o:i=o,t=o}return i}});class bu{constructor(e,t,i,l){this.tags=e,this.mode=t,this.context=i,this.next=l}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth{let a=l;for(let u of o)for(let f of u.set){let d=t[f.id];if(d){a=a?a+" "+d:d;break}}return a},scope:i}}function rL(n,e){let t=null;for(let i of n){let l=i.style(e);l&&(t=t?t+" "+l:l)}return t}function lL(n,e,t,i=0,l=n.length){let o=new sL(i,Array.isArray(e)?e:[e],t);o.highlightRange(n.cursor(),i,l,"",o.highlighters),o.flush(l)}class sL{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,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,i,l,o){let{type:a,from:u,to:f}=e;if(u>=i||f<=t)return;a.isTop&&(o=this.highlighters.filter(v=>!v.scope||v.scope(a)));let d=l,m=oL(e)||bu.empty,g=rL(o,m.tags);if(g&&(d&&(d+=" "),d+=g,m.mode==1&&(l+=(l?" ":"")+g)),this.startSpan(Math.max(t,u),d),m.opaque)return;let b=e.tree&&e.tree.prop(et.mounted);if(b&&b.overlay){let v=e.node.enter(b.overlay[0].from+u,1),w=this.highlighters.filter(C=>!C.scope||C.scope(b.tree.type)),S=e.firstChild();for(let C=0,N=u;;C++){let j=C=D||!e.nextSibling())););if(!j||D>i)break;N=j.to+u,N>t&&(this.highlightRange(v.cursor(),Math.max(t,j.from+u),Math.min(i,N),"",w),this.startSpan(Math.min(i,N),d))}S&&e.parent()}else if(e.firstChild()){b&&(l="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,l,o),this.startSpan(Math.min(i,e.to),d)}while(e.nextSibling());e.parent()}}}function oL(n){let e=n.type.prop(XN);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const Se=sl.define,Dh=Se(),Yl=Se(),ZS=Se(Yl),JS=Se(Yl),Gl=Se(),Rh=Se(Gl),g0=Se(Gl),Er=Se(),Xs=Se(Er),Tr=Se(),Ar=Se(),Ux=Se(),Uc=Se(Ux),jh=Se(),me={comment:Dh,lineComment:Se(Dh),blockComment:Se(Dh),docComment:Se(Dh),name:Yl,variableName:Se(Yl),typeName:ZS,tagName:Se(ZS),propertyName:JS,attributeName:Se(JS),className:Se(Yl),labelName:Se(Yl),namespace:Se(Yl),macroName:Se(Yl),literal:Gl,string:Rh,docString:Se(Rh),character:Se(Rh),attributeValue:Se(Rh),number:g0,integer:Se(g0),float:Se(g0),bool:Se(Gl),regexp:Se(Gl),escape:Se(Gl),color:Se(Gl),url:Se(Gl),keyword:Tr,self:Se(Tr),null:Se(Tr),atom:Se(Tr),unit:Se(Tr),modifier:Se(Tr),operatorKeyword:Se(Tr),controlKeyword:Se(Tr),definitionKeyword:Se(Tr),moduleKeyword:Se(Tr),operator:Ar,derefOperator:Se(Ar),arithmeticOperator:Se(Ar),logicOperator:Se(Ar),bitwiseOperator:Se(Ar),compareOperator:Se(Ar),updateOperator:Se(Ar),definitionOperator:Se(Ar),typeOperator:Se(Ar),controlOperator:Se(Ar),punctuation:Ux,separator:Se(Ux),bracket:Uc,angleBracket:Se(Uc),squareBracket:Se(Uc),paren:Se(Uc),brace:Se(Uc),content:Er,heading:Xs,heading1:Se(Xs),heading2:Se(Xs),heading3:Se(Xs),heading4:Se(Xs),heading5:Se(Xs),heading6:Se(Xs),contentSeparator:Se(Er),list:Se(Er),quote:Se(Er),emphasis:Se(Er),strong:Se(Er),link:Se(Er),monospace:Se(Er),strikethrough:Se(Er),inserted:Se(),deleted:Se(),changed:Se(),invalid:Se(),meta:jh,documentMeta:Se(jh),annotation:Se(jh),processingInstruction:Se(jh),definition:sl.defineModifier("definition"),constant:sl.defineModifier("constant"),function:sl.defineModifier("function"),standard:sl.defineModifier("standard"),local:sl.defineModifier("local"),special:sl.defineModifier("special")};for(let n in me){let e=me[n];e instanceof sl&&(e.name=n)}$N([{tag:me.link,class:"tok-link"},{tag:me.heading,class:"tok-heading"},{tag:me.emphasis,class:"tok-emphasis"},{tag:me.strong,class:"tok-strong"},{tag:me.keyword,class:"tok-keyword"},{tag:me.atom,class:"tok-atom"},{tag:me.bool,class:"tok-bool"},{tag:me.url,class:"tok-url"},{tag:me.labelName,class:"tok-labelName"},{tag:me.inserted,class:"tok-inserted"},{tag:me.deleted,class:"tok-deleted"},{tag:me.literal,class:"tok-literal"},{tag:me.string,class:"tok-string"},{tag:me.number,class:"tok-number"},{tag:[me.regexp,me.escape,me.special(me.string)],class:"tok-string2"},{tag:me.variableName,class:"tok-variableName"},{tag:me.local(me.variableName),class:"tok-variableName tok-local"},{tag:me.definition(me.variableName),class:"tok-variableName tok-definition"},{tag:me.special(me.variableName),class:"tok-variableName2"},{tag:me.definition(me.propertyName),class:"tok-propertyName tok-definition"},{tag:me.typeName,class:"tok-typeName"},{tag:me.namespace,class:"tok-namespace"},{tag:me.className,class:"tok-className"},{tag:me.macroName,class:"tok-macroName"},{tag:me.propertyName,class:"tok-propertyName"},{tag:me.operator,class:"tok-operator"},{tag:me.comment,class:"tok-comment"},{tag:me.meta,class:"tok-meta"},{tag:me.invalid,class:"tok-invalid"},{tag:me.punctuation,class:"tok-punctuation"}]);var x0;const pa=new et;function aL(n){return Ne.define({combine:n?e=>e.concat(n):void 0})}const cL=new et;class cr{constructor(e,t,i=[],l=""){this.data=e,this.name=l,pt.prototype.hasOwnProperty("tree")||Object.defineProperty(pt.prototype,"tree",{get(){return Qn(this)}}),this.parser=t,this.extension=[cs.of(this),pt.languageData.of((o,a,u)=>{let f=e2(o,a,u),d=f.type.prop(pa);if(!d)return[];let m=o.facet(d),g=f.type.prop(cL);if(g){let b=f.resolve(a-f.from,u);for(let v of g)if(v.test(b,o)){let w=o.facet(v.facet);return v.type=="replace"?w:w.concat(m)}}return m})].concat(i)}isActiveAt(e,t,i=-1){return e2(e,t,i).type.prop(pa)==this.data}findRegions(e){let t=e.facet(cs);if((t==null?void 0:t.data)==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],l=(o,a)=>{if(o.prop(pa)==this.data){i.push({from:a,to:a+o.length});return}let u=o.prop(et.mounted);if(u){if(u.tree.prop(pa)==this.data){if(u.overlay)for(let f of u.overlay)i.push({from:f.from+a,to:f.to+a});else i.push({from:a,to:a+o.length});return}else if(u.overlay){let f=i.length;if(l(u.tree,u.overlay[0].from+a),i.length>f)return}}for(let f=0;fi.isTop?t:void 0)]}),e.name)}configure(e,t){return new Od(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function Qn(n){let e=n.field(cr.state,!1);return e?e.tree:un.empty}class uL{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 i=this.cursorPos-this.string.length;return e=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let Fc=null;class Nd{constructor(e,t,i=[],l,o,a,u,f){this.parser=e,this.state=t,this.fragments=i,this.tree=l,this.treeLen=o,this.viewport=a,this.skipped=u,this.scheduleOn=f,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Nd(e,t,[],un.empty,0,i,[],null)}startParse(){return this.parser.startParse(new uL(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=un.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let l=Date.now()+e;e=()=>Date.now()>l}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t=this.treeLen&&((this.parse.stoppedAt==null||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(lo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Fc;Fc=this;try{return e()}finally{Fc=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=t2(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:l,treeLen:o,viewport:a,skipped:u}=this;if(this.takeTree(),!e.empty){let f=[];if(e.iterChangedRanges((d,m,g,b)=>f.push({fromA:d,toA:m,fromB:g,toB:b})),i=lo.applyChanges(i,f),l=un.empty,o=0,a={from:e.mapPos(a.from,-1),to:e.mapPos(a.to,1)},this.skipped.length){u=[];for(let d of this.skipped){let m=e.mapPos(d.from,1),g=e.mapPos(d.to,-1);me.from&&(this.fragments=t2(this.fragments,l,o),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(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 VN{createParse(t,i,l){let o=l[0].from,a=l[l.length-1].to;return{parsedPos:o,advance(){let f=Fc;if(f){for(let d of l)f.tempSkipped.push(d);e&&(f.scheduleOn=f.scheduleOn?Promise.all([f.scheduleOn,e]):e)}return this.parsedPos=a,new un(vi.none,[],[],a-o)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Fc}}function t2(n,e,t){return lo.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class _a{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),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new _a(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Nd.create(e.facet(cs).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new _a(i)}}cr.state=Xn.define({create:_a.init,update(n,e){for(let t of e.effects)if(t.is(cr.setState))return t.value;return e.startState.facet(cs)!=e.state.facet(cs)?_a.init(e.state):n.apply(e)}});let YN=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(YN=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const y0=typeof navigator<"u"&&(!((x0=navigator.scheduling)===null||x0===void 0)&&x0.isInputPending)?()=>navigator.scheduling.isInputPending():null,fL=en.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(cr.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(cr.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=YN(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndl+1e3,f=o.context.work(()=>y0&&y0()||Date.now()>a,l+(u?0:1e5));this.chunkBudget-=Date.now()-t,(f||this.chunkBudget<=0)&&(o.context.takeTree(),this.view.dispatch({effects:cr.setState.of(new _a(o.context))})),this.chunkBudget>0&&!(f&&!u)&&this.scheduleWork(),this.checkAsyncSchedule(o.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>yi(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),cs=Ne.define({combine(n){return n.length?n[0]:null},enables:n=>[cr.state,fL,Ee.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class hL{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const dL=Ne.define(),Vy=Ne.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Td(n){let e=n.facet(Vy);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function vu(n,e){let t="",i=n.tabSize,l=n.facet(Vy)[0];if(l==" "){for(;e>=i;)t+=" ",e-=i;l=" "}for(let o=0;o=e?mL(n,t,e):null}class lm{constructor(e,t={}){this.state=e,this.options=t,this.unit=Td(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:l,simulateDoubleBreak:o}=this.options;return l!=null&&l>=i.from&&l<=i.to?o&&l==e?{text:"",from:e}:(t<0?l-1&&(o+=a-this.countColumn(i,i.search(/\S|$/))),o}countColumn(e,t=e.length){return Ba(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:l}=this.lineAt(e,t),o=this.options.overrideIndentation;if(o){let a=o(l);if(a>-1)return a}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const GN=new et;function mL(n,e,t){let i=e.resolveStack(t),l=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(l!=i.node){let o=[];for(let a=l;a&&!(a.fromi.node.to||a.from==i.node.from&&a.type==i.node.type);a=a.parent)o.push(a);for(let a=o.length-1;a>=0;a--)i={node:o[a],next:i}}return KN(i,n,t)}function KN(n,e,t){for(let i=n;i;i=i.next){let l=gL(i.node);if(l)return l(Xy.create(e,t,i))}return 0}function pL(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function gL(n){let e=n.type.prop(GN);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(et.closedBy))){let l=n.lastChild,o=l&&i.indexOf(l.name)>-1;return a=>WN(a,!0,1,void 0,o&&!pL(a)?l.from:void 0)}return n.parent==null?xL:null}function xL(){return 0}class Xy extends lm{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new Xy(e,t,i)}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 i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(yL(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return KN(this.context.next,this.base,this.pos)}}function yL(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function bL(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let l=n.options.simulateBreak,o=n.state.doc.lineAt(t.from),a=l==null||l<=o.from?o.to:Math.min(o.to,l);for(let u=t.to;;){let f=e.childAfter(u);if(!f||f==i)return null;if(!f.type.isSkipped){if(f.from>=a)return null;let d=/^ */.exec(o.text.slice(t.to-o.from))[0].length;return{from:t.from,to:t.to+d}}u=f.to}}function n2({closing:n,align:e=!0,units:t=1}){return i=>WN(i,e,t,n)}function WN(n,e,t,i,l){let o=n.textAfter,a=o.match(/^\s*/)[0].length,u=i&&o.slice(a,a+i.length)==i||l==n.pos+a,f=e?bL(n):null;return f?u?n.column(f.from):n.column(f.to):n.baseIndent+(u?0:n.unit*t)}const vL=200;function wL(){return pt.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,l=t.lineAt(i);if(i>l.from+vL)return n;let o=t.sliceString(l.from,i);if(!e.some(d=>d.test(o)))return n;let{state:a}=n,u=-1,f=[];for(let{head:d}of a.selection.ranges){let m=a.doc.lineAt(d);if(m.from==u)continue;u=m.from;let g=Qy(a,m.from);if(g==null)continue;let b=/^\s*/.exec(m.text)[0],v=vu(a,g);b!=v&&f.push({from:m.from,to:m.from+b.length,insert:v})}return f.length?[n,{changes:f,sequential:!0}]:n})}const kL=Ne.define(),ZN=new et;function SL(n){let e=n.firstChild,t=n.lastChild;return e&&e.tot)continue;if(o&&u.from=e&&d.to>t&&(o=d)}}return o}function OL(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function Ad(n,e,t){for(let i of n.facet(kL)){let l=i(n,e,t);if(l)return l}return CL(n,e,t)}function JN(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const sm=Ke.define({map:JN}),Ru=Ke.define({map:JN});function eT(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(i=>i.from<=t&&i.to>=t)||e.push(n.lineBlockAt(t));return e}const uo=Xn.define({create(){return Fe.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((i,l)=>n=i2(n,i,l)),n=n.map(e.changes);let t=[];for(let i of e.effects)i.is(sm)&&!NL(n,i.value.from,i.value.to)?t.push(i.value):i.is(Ru)&&(n=n.update({filter:(l,o)=>i.value.from!=l||i.value.to!=o,filterFrom:i.value.from,filterTo:i.value.to}));if(t.length){let{preparePlaceholder:i}=e.state.facet(iT),l=t.map(o=>(i?Fe.replace({widget:new jL(i(e.state,o))}):r2).range(o.from,o.to));n=n.update({add:l})}return e.selection&&(n=i2(n,e.selection.main.head)),n},provide:n=>Ee.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(i,l)=>{t.push(i,l)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t{le&&(i=!0)}),i?n.update({filterFrom:e,filterTo:t,filter:(l,o)=>l>=t||o<=e}):n}function Ed(n,e,t){var i;let l=null;return(i=n.field(uo,!1))===null||i===void 0||i.between(e,t,(o,a)=>{(!l||l.from>o)&&(l={from:o,to:a})}),l}function NL(n,e,t){let i=!1;return n.between(e,e,(l,o)=>{l==e&&o==t&&(i=!0)}),i}function tT(n,e){return n.field(uo,!1)?e:e.concat(Ke.appendConfig.of(rT()))}const TL=n=>{for(let e of eT(n)){let t=Ad(n.state,e.from,e.to);if(t)return n.dispatch({effects:tT(n.state,[sm.of(t),nT(n,t)])}),!0}return!1},AL=n=>{if(!n.state.field(uo,!1))return!1;let e=[];for(let t of eT(n)){let i=Ed(n.state,t.from,t.to);i&&e.push(Ru.of(i),nT(n,i,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function nT(n,e,t=!0){let i=n.state.doc.lineAt(e.from).number,l=n.state.doc.lineAt(e.to).number;return Ee.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${l}.`)}const EL=n=>{let{state:e}=n,t=[];for(let i=0;i{let e=n.state.field(uo,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(i,l)=>{t.push(Ru.of({from:i,to:l}))}),n.dispatch({effects:t}),!0},DL=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:TL},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:AL},{key:"Ctrl-Alt-[",run:EL},{key:"Ctrl-Alt-]",run:ML}],RL={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},iT=Ne.define({combine(n){return Ur(n,RL)}});function rT(n){return[uo,zL]}function lT(n,e){let{state:t}=n,i=t.facet(iT),l=a=>{let u=n.lineBlockAt(n.posAtDOM(a.target)),f=Ed(n.state,u.from,u.to);f&&n.dispatch({effects:Ru.of(f)}),a.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(n,l,e);let o=document.createElement("span");return o.textContent=i.placeholderText,o.setAttribute("aria-label",t.phrase("folded code")),o.title=t.phrase("unfold"),o.className="cm-foldPlaceholder",o.onclick=l,o}const r2=Fe.replace({widget:new class extends pl{toDOM(n){return lT(n,null)}}});class jL extends pl{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return lT(e,this.value)}}const _L={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class b0 extends hl{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 LL(n={}){let e={..._L,...n},t=new b0(e,!0),i=new b0(e,!1),l=en.fromClass(class{constructor(a){this.from=a.viewport.from,this.markers=this.buildMarkers(a)}update(a){(a.docChanged||a.viewportChanged||a.startState.facet(cs)!=a.state.facet(cs)||a.startState.field(uo,!1)!=a.state.field(uo,!1)||Qn(a.startState)!=Qn(a.state)||e.foldingChanged(a))&&(this.markers=this.buildMarkers(a.view))}buildMarkers(a){let u=new Ir;for(let f of a.viewportLineBlocks){let d=Ed(a.state,f.from,f.to)?i:Ad(a.state,f.from,f.to)?t:null;d&&u.add(f.from,f.from,d)}return u.finish()}}),{domEventHandlers:o}=e;return[l,z_({class:"cm-foldGutter",markers(a){var u;return((u=a.plugin(l))===null||u===void 0?void 0:u.markers)||rt.empty},initialSpacer(){return new b0(e,!1)},domEventHandlers:{...o,click:(a,u,f)=>{if(o.click&&o.click(a,u,f))return!0;let d=Ed(a.state,u.from,u.to);if(d)return a.dispatch({effects:Ru.of(d)}),!0;let m=Ad(a.state,u.from,u.to);return m?(a.dispatch({effects:sm.of(m)}),!0):!1}}}),rT()]}const zL=Ee.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 ju{constructor(e,t){this.specs=e;let i;function l(u){let f=ls.newName();return(i||(i=Object.create(null)))["."+f]=u,f}const o=typeof t.all=="string"?t.all:t.all?l(t.all):void 0,a=t.scope;this.scope=a instanceof cr?u=>u.prop(pa)==a.data:a?u=>u==a:void 0,this.style=$N(e.map(u=>({tag:u.tag,class:u.class||l(Object.assign({},u,{tag:null}))})),{all:o}).style,this.module=i?new ls(i):null,this.themeType=t.themeType}static define(e,t){return new ju(e,t||{})}}const Fx=Ne.define(),sT=Ne.define({combine(n){return n.length?[n[0]]:null}});function v0(n){let e=n.facet(Fx);return e.length?e:n.facet(sT)}function oT(n,e){let t=[PL],i;return n instanceof ju&&(n.module&&t.push(Ee.styleModule.of(n.module)),i=n.themeType),e!=null&&e.fallback?t.push(sT.of(n)):i?t.push(Fx.computeN([Ee.darkTheme],l=>l.facet(Ee.darkTheme)==(i=="dark")?[n]:[])):t.push(Fx.of(n)),t}class BL{constructor(e){this.markCache=Object.create(null),this.tree=Qn(e.state),this.decorations=this.buildDeco(e,v0(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Qn(e.state),i=v0(e.state),l=i!=v0(e.startState),{viewport:o}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length=o.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||l)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=o.to)}buildDeco(e,t){if(!t||!this.tree.length)return Fe.none;let i=new Ir;for(let{from:l,to:o}of e.visibleRanges)lL(this.tree,t,(a,u,f)=>{i.add(a,u,this.markCache[f]||(this.markCache[f]=Fe.mark({class:f})))},l,o);return i.finish()}}const PL=ho.high(en.fromClass(BL,{decorations:n=>n.decorations})),HL=ju.define([{tag:me.meta,color:"#404740"},{tag:me.link,textDecoration:"underline"},{tag:me.heading,textDecoration:"underline",fontWeight:"bold"},{tag:me.emphasis,fontStyle:"italic"},{tag:me.strong,fontWeight:"bold"},{tag:me.strikethrough,textDecoration:"line-through"},{tag:me.keyword,color:"#708"},{tag:[me.atom,me.bool,me.url,me.contentSeparator,me.labelName],color:"#219"},{tag:[me.literal,me.inserted],color:"#164"},{tag:[me.string,me.deleted],color:"#a11"},{tag:[me.regexp,me.escape,me.special(me.string)],color:"#e40"},{tag:me.definition(me.variableName),color:"#00f"},{tag:me.local(me.variableName),color:"#30a"},{tag:[me.typeName,me.namespace],color:"#085"},{tag:me.className,color:"#167"},{tag:[me.special(me.variableName),me.macroName],color:"#256"},{tag:me.definition(me.propertyName),color:"#00c"},{tag:me.comment,color:"#940"},{tag:me.invalid,color:"#f00"}]),IL=Ee.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),aT=1e4,cT="()[]{}",uT=Ne.define({combine(n){return Ur(n,{afterCursor:!0,brackets:cT,maxScanDistance:aT,renderMatch:qL})}}),UL=Fe.mark({class:"cm-matchingBracket"}),FL=Fe.mark({class:"cm-nonmatchingBracket"});function qL(n){let e=[],t=n.matched?UL:FL;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function l2(n){let e=[],t=n.facet(uT);for(let i of n.selection.ranges){if(!i.empty)continue;let l=zr(n,i.head,-1,t)||i.head>0&&zr(n,i.head-1,1,t)||t.afterCursor&&(zr(n,i.head,1,t)||i.headn.decorations}),QL=[VL,IL];function XL(n={}){return[uT.of(n),QL]}const $L=new et;function qx(n,e,t){let i=n.prop(e<0?et.openedBy:et.closedBy);if(i)return i;if(n.name.length==1){let l=t.indexOf(n.name);if(l>-1&&l%2==(e<0?1:0))return[t[l+e]]}return null}function Vx(n){let e=n.type.prop($L);return e?e(n.node):n}function zr(n,e,t,i={}){let l=i.maxScanDistance||aT,o=i.brackets||cT,a=Qn(n),u=a.resolveInner(e,t);for(let f=u;f;f=f.parent){let d=qx(f.type,t,o);if(d&&f.from0?e>=m.from&&em.from&&e<=m.to))return YL(n,e,t,f,m,d,o)}}return GL(n,e,t,a,u.type,l,o)}function YL(n,e,t,i,l,o,a){let u=i.parent,f={from:l.from,to:l.to},d=0,m=u==null?void 0:u.cursor();if(m&&(t<0?m.childBefore(i.from):m.childAfter(i.to)))do if(t<0?m.to<=i.from:m.from>=i.to){if(d==0&&o.indexOf(m.type.name)>-1&&m.from0)return null;let d={from:t<0?e-1:e,to:t>0?e+1:e},m=n.doc.iterRange(e,t>0?n.doc.length:0),g=0;for(let b=0;!m.next().done&&b<=o;){let v=m.value;t<0&&(b+=v.length);let w=e+b*t;for(let S=t>0?0:v.length-1,C=t>0?v.length:-1;S!=C;S+=t){let N=a.indexOf(v[S]);if(!(N<0||i.resolveInner(w+S,1).type!=l))if(N%2==0==t>0)g++;else{if(g==1)return{start:d,end:{from:w+S,to:w+S+1},matched:N>>1==f>>1};g--}}t>0&&(b+=v.length)}return m.done?{start:d,matched:!1}:null}const KL=Object.create(null),s2=[vi.none],o2=[],a2=Object.create(null),WL=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])WL[n]=ZL(KL,e);function w0(n,e){o2.indexOf(n)>-1||(o2.push(n),console.warn(e))}function ZL(n,e){let t=[];for(let u of e.split(" ")){let f=[];for(let d of u.split(".")){let m=n[d]||me[d];m?typeof m=="function"?f.length?f=f.map(m):w0(d,`Modifier ${d} used at start of tag`):f.length?w0(d,`Tag ${d} used as modifier`):f=Array.isArray(m)?m:[m]:w0(d,`Unknown highlighting tag ${d}`)}for(let d of f)t.push(d)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),l=i+" "+t.map(u=>u.id),o=a2[l];if(o)return o.id;let a=a2[l]=vi.define({id:s2.length,name:i,props:[QN({[i]:t})]});return s2.push(a),a.id}At.RTL,At.LTR;const JL=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=Yy(n.state,t.from);return i.line?ez(n):i.block?nz(n):!1};function $y(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let l=n(e,t);return l?(i(t.update(l)),!0):!1}}const ez=$y(lz,0),tz=$y(fT,0),nz=$y((n,e)=>fT(n,e,rz(e)),0);function Yy(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const qc=50;function iz(n,{open:e,close:t},i,l){let o=n.sliceDoc(i-qc,i),a=n.sliceDoc(l,l+qc),u=/\s*$/.exec(o)[0].length,f=/^\s*/.exec(a)[0].length,d=o.length-u;if(o.slice(d-e.length,d)==e&&a.slice(f,f+t.length)==t)return{open:{pos:i-u,margin:u&&1},close:{pos:l+f,margin:f&&1}};let m,g;l-i<=2*qc?m=g=n.sliceDoc(i,l):(m=n.sliceDoc(i,i+qc),g=n.sliceDoc(l-qc,l));let b=/^\s*/.exec(m)[0].length,v=/\s*$/.exec(g)[0].length,w=g.length-v-t.length;return m.slice(b,b+e.length)==e&&g.slice(w,w+t.length)==t?{open:{pos:i+b+e.length,margin:/\s/.test(m.charAt(b+e.length))?1:0},close:{pos:l-v-t.length,margin:/\s/.test(g.charAt(w-1))?1:0}}:null}function rz(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),l=t.to<=i.to?i:n.doc.lineAt(t.to);l.from>i.from&&l.from==t.to&&(l=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let o=e.length-1;o>=0&&e[o].to>i.from?e[o].to=l.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:l.to})}return e}function fT(n,e,t=e.selection.ranges){let i=t.map(o=>Yy(e,o.from).block);if(!i.every(o=>o))return null;let l=t.map((o,a)=>iz(e,i[a],o.from,o.to));if(n!=2&&!l.every(o=>o))return{changes:e.changes(t.map((o,a)=>l[a]?[]:[{from:o.from,insert:i[a].open+" "},{from:o.to,insert:" "+i[a].close}]))};if(n!=1&&l.some(o=>o)){let o=[];for(let a=0,u;al&&(o==a||a>g.from)){l=g.from;let b=/^\s*/.exec(g.text)[0].length,v=b==g.length,w=g.text.slice(b,b+d.length)==d?b:-1;bo.comment<0&&(!o.empty||o.single))){let o=[];for(let{line:u,token:f,indent:d,empty:m,single:g}of i)(g||!m)&&o.push({from:u.from+d,insert:f+" "});let a=e.changes(o);return{changes:a,selection:e.selection.map(a,1)}}else if(n!=1&&i.some(o=>o.comment>=0)){let o=[];for(let{line:a,comment:u,token:f}of i)if(u>=0){let d=a.from+u,m=d+f.length;a.text[m-a.from]==" "&&m++,o.push({from:d,to:m})}return{changes:o}}return null}const Qx=ml.define(),sz=ml.define(),oz=Ne.define(),hT=Ne.define({combine(n){return Ur(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,l)=>e(i,l)||t(i,l)})}}),dT=Xn.define({create(){return Br.empty},update(n,e){let t=e.state.facet(hT),i=e.annotation(Qx);if(i){let f=bi.fromTransaction(e,i.selection),d=i.side,m=d==0?n.undone:n.done;return f?m=Md(m,m.length,t.minDepth,f):m=gT(m,e.startState.selection),new Br(d==0?i.rest:m,d==0?m:i.rest)}let l=e.annotation(sz);if((l=="full"||l=="before")&&(n=n.isolate()),e.annotation(gn.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let o=bi.fromTransaction(e),a=e.annotation(gn.time),u=e.annotation(gn.userEvent);return o?n=n.addChanges(o,a,u,t,e):e.selection&&(n=n.addSelection(e.startState.selection,a,u,t.newGroupDelay)),(l=="full"||l=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new Br(n.done.map(bi.fromJSON),n.undone.map(bi.fromJSON))}});function az(n={}){return[dT,hT.of(n),Ee.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?mT:e.inputType=="historyRedo"?Xx:null;return i?(e.preventDefault(),i(t)):!1}})]}function om(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let l=t.field(dT,!1);if(!l)return!1;let o=l.pop(n,t,e);return o?(i(o),!0):!1}}const mT=om(0,!1),Xx=om(1,!1),cz=om(0,!0),uz=om(1,!0);class bi{constructor(e,t,i,l,o){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=l,this.selectionsAfter=o}setSelAfter(e){return new bi(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(l=>l.toJSON())}}static fromJSON(e){return new bi(e.changes&&pn.fromJSON(e.changes),[],e.mapped&&Hr.fromJSON(e.mapped),e.startSelection&&le.fromJSON(e.startSelection),e.selectionsAfter.map(le.fromJSON))}static fromTransaction(e,t){let i=$i;for(let l of e.startState.facet(oz)){let o=l(e);o.length&&(i=i.concat(o))}return!i.length&&e.changes.empty?null:new bi(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,$i)}static selection(e){return new bi(void 0,$i,void 0,void 0,e)}}function Md(n,e,t,i){let l=e+1>t+20?e-t-1:0,o=n.slice(l,e);return o.push(i),o}function fz(n,e){let t=[],i=!1;return n.iterChangedRanges((l,o)=>t.push(l,o)),e.iterChangedRanges((l,o,a,u)=>{for(let f=0;f=d&&a<=m&&(i=!0)}}),i}function hz(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function pT(n,e){return n.length?e.length?n.concat(e):n:e}const $i=[],dz=200;function gT(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-dz));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),Md(n,n.length-1,1e9,t.setSelAfter(i)))}else return[bi.selection([e])]}function mz(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function k0(n,e){if(!n.length)return n;let t=n.length,i=$i;for(;t;){let l=pz(n[t-1],e,i);if(l.changes&&!l.changes.empty||l.effects.length){let o=n.slice(0,t);return o[t-1]=l,o}else e=l.mapped,t--,i=l.selectionsAfter}return i.length?[bi.selection(i)]:$i}function pz(n,e,t){let i=pT(n.selectionsAfter.length?n.selectionsAfter.map(u=>u.map(e)):$i,t);if(!n.changes)return bi.selection(i);let l=n.changes.map(e),o=e.mapDesc(n.changes,!0),a=n.mapped?n.mapped.composeDesc(o):o;return new bi(l,Ke.mapEffects(n.effects,e),a,n.startSelection.map(o),i)}const gz=/^(input\.type|delete)($|\.)/;class Br{constructor(e,t,i=0,l=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=l}isolate(){return this.prevTime?new Br(this.done,this.undone):this}addChanges(e,t,i,l,o){let a=this.done,u=a[a.length-1];return u&&u.changes&&!u.changes.empty&&e.changes&&(!i||gz.test(i))&&(!u.selectionsAfter.length&&t-this.prevTime0&&t-this.prevTimet.empty?n.moveByChar(t,e):am(t,e))}function $n(n){return n.textDirectionAt(n.state.selection.main.head)==At.LTR}const yT=n=>xT(n,!$n(n)),bT=n=>xT(n,$n(n));function vT(n,e){return mr(n,t=>t.empty?n.moveByGroup(t,e):am(t,e))}const yz=n=>vT(n,!$n(n)),bz=n=>vT(n,$n(n));function vz(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function cm(n,e,t){let i=Qn(n).resolveInner(e.head),l=t?et.closedBy:et.openedBy;for(let f=e.head;;){let d=t?i.childAfter(f):i.childBefore(f);if(!d)break;vz(n,d,l)?i=d:f=t?d.to:d.from}let o=i.type.prop(l),a,u;return o&&(a=t?zr(n,i.from,1):zr(n,i.to,-1))&&a.matched?u=t?a.end.to:a.end.from:u=t?i.to:i.from,le.cursor(u,t?-1:1)}const wz=n=>mr(n,e=>cm(n.state,e,!$n(n))),kz=n=>mr(n,e=>cm(n.state,e,$n(n)));function wT(n,e){return mr(n,t=>{if(!t.empty)return am(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const kT=n=>wT(n,!1),ST=n=>wT(n,!0);function CT(n){let e=n.scrollDOM.clientHeighta.empty?n.moveVertically(a,e,t.height):am(a,e));if(l.eq(i.selection))return!1;let o;if(t.selfScroll){let a=n.coordsAtPos(i.selection.main.head),u=n.scrollDOM.getBoundingClientRect(),f=u.top+t.marginTop,d=u.bottom-t.marginBottom;a&&a.top>f&&a.bottomOT(n,!1),$x=n=>OT(n,!0);function ds(n,e,t){let i=n.lineBlockAt(e.head),l=n.moveToLineBoundary(e,t);if(l.head==e.head&&l.head!=(t?i.to:i.from)&&(l=n.moveToLineBoundary(e,t,!1)),!t&&l.head==i.from&&i.length){let o=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;o&&e.head!=i.from+o&&(l=le.cursor(i.from+o))}return l}const Sz=n=>mr(n,e=>ds(n,e,!0)),Cz=n=>mr(n,e=>ds(n,e,!1)),Oz=n=>mr(n,e=>ds(n,e,!$n(n))),Nz=n=>mr(n,e=>ds(n,e,$n(n))),Tz=n=>mr(n,e=>n.moveToLineBoundary(e,!1,!1)),Az=n=>mr(n,e=>n.moveToLineBoundary(e,!0,!1));function Ez(n,e,t){let i=!1,l=Pa(n.selection,o=>{let a=zr(n,o.head,-1)||zr(n,o.head,1)||o.head>0&&zr(n,o.head-1,1)||o.headEz(n,e);function Ki(n,e,t){let i=Pa(n.state.selection,l=>{l.undirectional&&l.head>=l.anchor!=e&&(l=le.range(l.head,l.anchor));let o=t(l);return le.range(l.anchor,o.head,o.goalColumn,o.bidiLevel||void 0,o.assoc)});return i.eq(n.state.selection)?!1:(n.dispatch(dr(n.state,i)),!0)}function NT(n,e){return Ki(n,e,t=>n.moveByChar(t,e))}const TT=n=>NT(n,!$n(n)),AT=n=>NT(n,$n(n));function ET(n,e){return Ki(n,e,t=>n.moveByGroup(t,e))}const Dz=n=>ET(n,!$n(n)),Rz=n=>ET(n,$n(n)),jz=n=>{let e=!$n(n);return Ki(n,e,t=>cm(n.state,t,e))},_z=n=>{let e=$n(n);return Ki(n,e,t=>cm(n.state,t,e))};function MT(n,e){return Ki(n,e,t=>n.moveVertically(t,e))}const DT=n=>MT(n,!1),RT=n=>MT(n,!0);function jT(n,e){return Ki(n,e,t=>n.moveVertically(t,e,CT(n).height))}const u2=n=>jT(n,!1),f2=n=>jT(n,!0),Lz=n=>Ki(n,!0,e=>ds(n,e,!0)),zz=n=>Ki(n,!1,e=>ds(n,e,!1)),Bz=n=>{let e=!$n(n);return Ki(n,e,t=>ds(n,t,e))},Pz=n=>{let e=$n(n);return Ki(n,e,t=>ds(n,t,e))},Hz=n=>Ki(n,!1,e=>le.cursor(n.lineBlockAt(e.head).from)),Iz=n=>Ki(n,!0,e=>le.cursor(n.lineBlockAt(e.head).to)),h2=({state:n,dispatch:e})=>(e(dr(n,{anchor:0})),!0),d2=({state:n,dispatch:e})=>(e(dr(n,{anchor:n.doc.length})),!0),m2=({state:n,dispatch:e})=>(e(dr(n,{anchor:n.selection.main.anchor,head:0})),!0),p2=({state:n,dispatch:e})=>(e(dr(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),Uz=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),Fz=({state:n,dispatch:e})=>{let t=um(n).map(({from:i,to:l})=>le.undirectionalRange(i,Math.min(l+1,n.doc.length)));return e(n.update({selection:le.create(t),userEvent:"select"})),!0},qz=({state:n,dispatch:e})=>{let t=Pa(n.selection,i=>{let l=Qn(n),o=l.resolveStack(i.from,1);if(i.empty){let a=l.resolveStack(i.from,-1);a.node.from>=o.node.from&&a.node.to<=o.node.to&&(o=a)}for(let a=o;a;a=a.next){let{node:u}=a;if((u.from=i.to||u.to>i.to&&u.from<=i.from)&&a.next)return le.undirectionalRange(u.from,u.to)}return i});return t.eq(n.selection)?!1:(e(dr(n,t)),!0)};function _T(n,e){let{state:t}=n,i=t.selection,l=t.selection.ranges.slice();for(let o of t.selection.ranges){let a=t.doc.lineAt(o.head);if(e?a.to0)for(let u=o;;){let f=n.moveVertically(u,e);if(f.heada.to){l.some(d=>d.head==f.head)||l.push(f);break}else{if(f.head==u.head)break;u=f}}}return l.length==i.ranges.length?!1:(n.dispatch(dr(t,le.create(l,l.length-1))),!0)}const Vz=n=>_T(n,!1),Qz=n=>_T(n,!0),Xz=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=le.create([t.main]):t.main.empty||(i=le.create([le.cursor(t.main.head)])),i?(e(dr(n,i)),!0):!1};function _u(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,l=i.changeByRange(o=>{let{from:a,to:u}=o;if(a==u){let f=e(o);fa&&(t="delete.forward",f=_h(n,f,!0)),a=Math.min(a,f),u=Math.max(u,f)}else a=_h(n,a,!1),u=_h(n,u,!0);return a==u?{range:o}:{changes:{from:a,to:u},range:le.cursor(a,al(n)))i.between(e,e,(l,o)=>{le&&(e=t?o:l)});return e}const LT=(n,e,t)=>_u(n,i=>{let l=i.from,{state:o}=n,a=o.doc.lineAt(l),u,f;if(t&&!e&&l>a.from&&lLT(n,!1,!0),zT=n=>LT(n,!0,!1),BT=(n,e)=>_u(n,t=>{let i=t.head,{state:l}=n,o=l.doc.lineAt(i),a=l.charCategorizer(i);for(let u=null;;){if(i==(e?o.to:o.from)){i==t.head&&o.number!=(e?l.doc.lines:1)&&(i+=e?1:-1);break}let f=Sn(o.text,i-o.from,e)+o.from,d=o.text.slice(Math.min(i,f)-o.from,Math.max(i,f)-o.from),m=a(d);if(u!=null&&m!=u)break;(d!=" "||i!=t.head)&&(u=m),i=f}return i}),PT=n=>BT(n,!1),$z=n=>BT(n,!0),Yz=n=>_u(n,e=>{let t=n.lineBlockAt(e.head).to;return e.head_u(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),Kz=n=>_u(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:dt.of(["",""])},range:le.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},Zz=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let l=i.from,o=n.doc.lineAt(l),a=l==o.from?l-1:Sn(o.text,l-o.from,!1)+o.from,u=l==o.to?l+1:Sn(o.text,l-o.from,!0)+o.from;return{changes:{from:a,to:u,insert:n.doc.slice(l,u).append(n.doc.slice(a,l))},range:le.cursor(u)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function um(n){let e=[],t=-1;for(let i of n.selection.ranges){let l=n.doc.lineAt(i.from),o=n.doc.lineAt(i.to);if(!i.empty&&i.to==o.from&&(o=n.doc.lineAt(i.to-1)),t>=l.number){let a=e[e.length-1];a.to=o.to,a.ranges.push(i)}else e.push({from:l.from,to:o.to,ranges:[i]});t=o.number+1}return e}function HT(n,e,t){if(n.readOnly)return!1;let i=[],l=[];for(let o of um(n)){if(t?o.to==n.doc.length:o.from==0)continue;let a=n.doc.lineAt(t?o.to+1:o.from-1),u=a.length+1;if(t){i.push({from:o.to,to:a.to},{from:o.from,insert:a.text+n.lineBreak});for(let f of o.ranges)l.push(le.range(Math.min(n.doc.length,f.anchor+u),Math.min(n.doc.length,f.head+u)))}else{i.push({from:a.from,to:o.from},{from:o.to,insert:n.lineBreak+a.text});for(let f of o.ranges)l.push(le.range(f.anchor-u,f.head-u))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:le.create(l,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const Jz=({state:n,dispatch:e})=>HT(n,e,!1),e6=({state:n,dispatch:e})=>HT(n,e,!0);function IT(n,e,t){if(n.readOnly)return!1;let i=[];for(let o of um(n))t?i.push({from:o.from,insert:n.doc.slice(o.from,o.to)+n.lineBreak}):i.push({from:o.to,insert:n.lineBreak+n.doc.slice(o.from,o.to)});let l=n.changes(i);return e(n.update({changes:l,selection:n.selection.map(l,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const t6=({state:n,dispatch:e})=>IT(n,e,!1),n6=({state:n,dispatch:e})=>IT(n,e,!0),i6=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(um(e).map(({from:l,to:o})=>(l>0?l--:o{let o;if(n.lineWrapping){let a=n.lineBlockAt(l.head),u=n.coordsAtPos(l.head,l.assoc||1);u&&(o=a.bottom+n.documentTop-u.bottom+n.defaultLineHeight/2)}return n.moveVertically(l,!0,o)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function r6(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=Qn(n).resolveInner(e),i=t.childBefore(e),l=t.childAfter(e),o;return i&&l&&i.to<=e&&l.from>=e&&(o=i.type.prop(et.closedBy))&&o.indexOf(l.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(l.from).from&&!/\S/.test(n.sliceDoc(i.to,l.from))?{from:i.to,to:l.from}:null}const g2=UT(!1),l6=UT(!0);function UT(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(l=>{let{from:o,to:a}=l,u=e.doc.lineAt(o),f=!n&&o==a&&r6(e,o);n&&(o=a=(a<=u.to?u:e.doc.lineAt(a)).to);let d=new lm(e,{simulateBreak:o,simulateDoubleBreak:!!f}),m=Qy(d,o);for(m==null&&(m=Ba(/^\s*/.exec(e.doc.lineAt(o).text)[0],e.tabSize));au.from&&o{let l=[];for(let a=i.from;a<=i.to;){let u=n.doc.lineAt(a);u.number>t&&(i.empty||i.to>u.from)&&(e(u,l,i),t=u.number),a=u.to+1}let o=n.changes(l);return{changes:l,range:le.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}})}const s6=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new lm(n,{overrideIndentation:o=>{let a=t[o];return a??-1}}),l=Gy(n,(o,a,u)=>{let f=Qy(i,o.from);if(f==null)return;/\S/.test(o.text)||(f=0);let d=/^\s*/.exec(o.text)[0],m=vu(n,f);(d!=m||u.fromn.readOnly?!1:(e(n.update(Gy(n,(t,i)=>{i.push({from:t.from,insert:n.facet(Vy)})}),{userEvent:"input.indent"})),!0),a6=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(Gy(n,(t,i)=>{let l=/^\s*/.exec(t.text)[0];if(!l)return;let o=Ba(l,n.tabSize),a=0,u=vu(n,Math.max(0,o-Td(n)));for(;a(n.setTabFocusMode(),!0),u6=[{key:"Ctrl-b",run:yT,shift:TT,preventDefault:!0},{key:"Ctrl-f",run:bT,shift:AT},{key:"Ctrl-p",run:kT,shift:DT},{key:"Ctrl-n",run:ST,shift:RT},{key:"Ctrl-a",run:Tz,shift:Hz},{key:"Ctrl-e",run:Az,shift:Iz},{key:"Ctrl-d",run:zT},{key:"Ctrl-h",run:Yx},{key:"Ctrl-k",run:Yz},{key:"Ctrl-Alt-h",run:PT},{key:"Ctrl-o",run:Wz},{key:"Ctrl-t",run:Zz},{key:"Ctrl-v",run:$x}],f6=[{key:"ArrowLeft",run:yT,shift:TT,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:yz,shift:Dz,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:Oz,shift:Bz,preventDefault:!0},{key:"ArrowRight",run:bT,shift:AT,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:bz,shift:Rz,preventDefault:!0},{mac:"Cmd-ArrowRight",run:Nz,shift:Pz,preventDefault:!0},{key:"ArrowUp",run:kT,shift:DT,preventDefault:!0},{mac:"Cmd-ArrowUp",run:h2,shift:m2},{mac:"Ctrl-ArrowUp",run:c2,shift:u2},{key:"ArrowDown",run:ST,shift:RT,preventDefault:!0},{mac:"Cmd-ArrowDown",run:d2,shift:p2},{mac:"Ctrl-ArrowDown",run:$x,shift:f2},{key:"PageUp",run:c2,shift:u2},{key:"PageDown",run:$x,shift:f2},{key:"Home",run:Cz,shift:zz,preventDefault:!0},{key:"Mod-Home",run:h2,shift:m2},{key:"End",run:Sz,shift:Lz,preventDefault:!0},{key:"Mod-End",run:d2,shift:p2},{key:"Enter",run:g2,shift:g2},{key:"Mod-a",run:Uz},{key:"Backspace",run:Yx,shift:Yx,preventDefault:!0},{key:"Delete",run:zT,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:PT,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:$z,preventDefault:!0},{mac:"Mod-Backspace",run:Gz,preventDefault:!0},{mac:"Mod-Delete",run:Kz,preventDefault:!0}].concat(u6.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),h6=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:wz,shift:jz},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:kz,shift:_z},{key:"Alt-ArrowUp",run:Jz},{key:"Shift-Alt-ArrowUp",run:t6},{key:"Alt-ArrowDown",run:e6},{key:"Shift-Alt-ArrowDown",run:n6},{key:"Mod-Alt-ArrowUp",run:Vz},{key:"Mod-Alt-ArrowDown",run:Qz},{key:"Escape",run:Xz},{key:"Mod-Enter",run:l6},{key:"Alt-l",mac:"Ctrl-l",run:Fz},{key:"Mod-i",run:qz,preventDefault:!0},{key:"Mod-[",run:a6},{key:"Mod-]",run:o6},{key:"Mod-Alt-\\",run:s6},{key:"Shift-Mod-k",run:i6},{key:"Shift-Mod-\\",run:Mz},{key:"Mod-/",run:JL},{key:"Alt-A",mac:"Ctrl-A",run:tz},{key:"Ctrl-m",mac:"Shift-Alt-m",run:c6}].concat(f6),x2=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class La{constructor(e,t,i=0,l=e.length,o,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,l),this.bufferStart=i,this.normalize=o?u=>o(x2(u)):x2,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 pi(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=ky(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=jr(e);let l=this.normalize(t);if(l.length)for(let o=0,a=i,u=!0;;o++){let f=l.charCodeAt(o),d=this.match(f,a,u,this.bufferPos+this.bufferStart,o==l.length-1);if(d)return this.value=d,this;if(o==l.length-1)break;u&&othis.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 i=this.curLineStart+t.index,l=i+t[0].length;if(this.matchPos=Dd(this.text,l+(i==l?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(ithis.value.to)&&(!this.test||this.test(i,l,t)))return this.value={from:i,to:l,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=i||l.to<=t){let u=new ka(t,e.sliceString(t,i));return S0.set(e,u),u}if(l.from==t&&l.to==i)return l;let{text:o,from:a}=l;return a>t&&(o=e.sliceString(t,a)+o,a=t),l.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 i=this.flat.from+t.index,l=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,l,t)))return this.value={from:i,to:l,precise:!0,match:t},this.matchPos=Dd(this.text,l+(i==l?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=ka.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(qT.prototype[Symbol.iterator]=VT.prototype[Symbol.iterator]=function(){return this});function d6(n){try{return new RegExp(n,Ky),!0}catch{return!1}}function Dd(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e=56320&&i<57344;)e++;return e}const m6=n=>{let e=R_(n,"cm-goto-line");if(e){let a=e.dom.querySelector("input[type=text]");return a&&a.select(),!0}let{state:t}=n,i=String(t.doc.lineAt(n.state.selection.main.head).number),{close:l,result:o}=D_(n,{class:"cm-goto-line",label:t.phrase("Go to line"),input:{type:"text",name:"line",value:i},focus:!0,submitLabel:t.phrase("go")});return o.then(a=>{let u=a&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(a.elements.line.value);if(!u){n.dispatch({effects:l});return}let f=t.doc.lineAt(t.selection.main.head),[,d,m,g,b]=u,v=g?+g.slice(1):0,w=m?+m:f.number;if(m&&b){let N=w/100;d&&(N=N*(d=="-"?-1:1)+f.number/t.doc.lines),w=Math.round(t.doc.lines*N)}else m&&d&&(w=w*(d=="-"?-1:1)+f.number);let S=t.doc.line(Math.max(1,Math.min(t.doc.lines,w))),C=le.cursor(S.from+Math.max(0,Math.min(v,S.length)));n.dispatch({effects:[l,Ee.scrollIntoView(C.from,{y:"center"})],selection:C})}),!0},p6={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},g6=Ne.define({combine(n){return Ur(n,p6,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function x6(n){return[k6,w6]}const y6=Fe.mark({class:"cm-selectionMatch"}),b6=Fe.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function y2(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=Ut.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=Ut.Word)}function v6(n,e,t,i){return n(e.sliceDoc(t,t+1))==Ut.Word&&n(e.sliceDoc(i-1,i))==Ut.Word}const w6=en.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(g6),{state:t}=n,i=t.selection;if(i.ranges.length>1)return Fe.none;let l=i.main,o,a=null;if(l.empty){if(!e.highlightWordAroundCursor)return Fe.none;let f=t.wordAt(l.head);if(!f)return Fe.none;a=t.charCategorizer(l.head),o=t.sliceDoc(f.from,f.to)}else{let f=l.to-l.from;if(f200)return Fe.none;if(e.wholeWords){if(o=t.sliceDoc(l.from,l.to),a=t.charCategorizer(l.head),!(y2(a,t,l.from,l.to)&&v6(a,t,l.from,l.to)))return Fe.none}else if(o=t.sliceDoc(l.from,l.to),!o)return Fe.none}let u=[];for(let f of n.visibleRanges){let d=new La(t.doc,o,f.from,f.to);for(;!d.next().done;){let{from:m,to:g}=d.value;if((!a||y2(a,t,m,g))&&(l.empty&&m<=l.from&&g>=l.to?u.push(b6.range(m,g)):(m>=l.to||g<=l.from)&&u.push(y6.range(m,g)),u.length>e.maxMatches))return Fe.none}}return Fe.set(u)}},{decorations:n=>n.decorations}),k6=Ee.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),S6=({state:n,dispatch:e})=>{let{selection:t}=n,i=le.create(t.ranges.map(l=>n.wordAt(l.head)||le.cursor(l.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function C6(n,e){let{main:t,ranges:i}=n.selection,l=n.wordAt(t.head),o=l&&l.from==t.from&&l.to==t.to;for(let a=!1,u=new La(n.doc,e,i[i.length-1].to);;)if(u.next(),u.done){if(a)return null;u=new La(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),a=!0}else{if(a&&i.some(f=>f.from==u.value.from))continue;if(o){let f=n.wordAt(u.value.from);if(!f||f.from!=u.value.from||f.to!=u.value.to)continue}return u.value}}const O6=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(o=>o.from===o.to))return S6({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(o=>n.sliceDoc(o.from,o.to)!=i))return!1;let l=C6(n,i);return l?(e(n.update({selection:n.selection.addRange(le.range(l.from,l.to),!1),effects:Ee.scrollIntoView(l.to)})),!0):!1},Ha=Ne.define({combine(n){return Ur(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new H6(e),scrollToMatch:e=>Ee.scrollIntoView(e)})}});class QT{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||d6(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?` +`:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new D6(this):new A6(this)}getCursor(e,t=0,i){let l=e.doc?e:pt.create({doc:e});return i==null&&(i=l.doc.length),this.regexp?aa(this,l,t,i):oa(this,l,t,i)}}class XT{constructor(e){this.spec=e}}function N6(n,e,t){return(i,l,o,a)=>{if(t&&!t(i,l,o,a))return!1;let u=i>=a&&l<=a+o.length?o.slice(i-a,l-a):e.doc.sliceString(i,l);return n(u,e,i,l)}}function oa(n,e,t,i){let l;return n.wholeWord&&(l=T6(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(l=N6(n.test,e,l)),new La(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:o=>o.toLowerCase(),l)}function T6(n,e){return(t,i,l,o)=>((o>t||o+l.length=t)return null;l.push(i.value)}return l}highlight(e,t,i,l){let o=oa(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!o.next().done;)l(o.value.from,o.value.to)}}function E6(n,e,t){return(i,l,o)=>(!t||t(i,l,o))&&n(o[0],e,i,l)}function aa(n,e,t,i){let l;return n.wholeWord&&(l=M6(e.charCategorizer(e.selection.main.head))),n.test&&(l=E6(n.test,e,l)),new qT(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:l},t,i)}function Rd(n,e){return n.slice(Sn(n,e,!1),e)}function jd(n,e){return n.slice(e,Sn(n,e))}function M6(n){return(e,t,i)=>!i[0].length||(n(Rd(i.input,i.index))!=Ut.Word||n(jd(i.input,i.index))!=Ut.Word)&&(n(jd(i.input,i.index+i[0].length))!=Ut.Word||n(Rd(i.input,i.index+i[0].length))!=Ut.Word)}class D6 extends XT{nextMatch(e,t,i){let l=aa(this.spec,e,i,e.doc.length).next();return l.done&&(l=aa(this.spec,e,0,t).next()),l.done?null:l.value}prevMatchInRange(e,t,i){for(let l=1;;l++){let o=Math.max(t,i-l*1e4),a=aa(this.spec,e,o,i),u=null;for(;!a.next().done;)u=a.value;if(u&&(o==t||u.from>o+10))return u;if(o==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let l=i.length;l>0;l--){let o=+i.slice(0,l);if(o>0&&o=t)return null;l.push(i.value)}return l}highlight(e,t,i,l){let o=aa(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!o.next().done;)l(o.value.from,o.value.to)}}const wu=Ke.define(),Wy=Ke.define(),ns=Xn.define({create(n){return new C0(Gx(n).create(),null)},update(n,e){for(let t of e.effects)t.is(wu)?n=new C0(t.value.create(),n.panel):t.is(Wy)&&(n=new C0(n.query,t.value?Zy:null));return n},provide:n=>xu.from(n,e=>e.panel)});class C0{constructor(e,t){this.query=e,this.panel=t}}const R6=Fe.mark({class:"cm-searchMatch"}),j6=Fe.mark({class:"cm-searchMatch cm-searchMatch-selected"}),_6=en.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(ns))}update(n){let e=n.state.field(ns);(e!=n.startState.field(ns)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return Fe.none;let{view:t}=this,i=new Ir;for(let l=0,o=t.visibleRanges,a=o.length;lo[l+1].from-500;)f=o[++l].to;n.highlight(t.state,u,f,(d,m)=>{let g=t.state.selection.ranges.some(b=>b.from==d&&b.to==m);i.add(d,m,g?j6:R6)})}return i.finish()}},{decorations:n=>n.decorations});function Lu(n){return e=>{let t=e.state.field(ns,!1);return t&&t.query.spec.valid?n(e,t):GT(e)}}const _d=Lu((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let l=le.single(i.from,i.to),o=n.state.facet(Ha);return n.dispatch({selection:l,effects:[Jy(n,i),o.scrollToMatch(l.main,n)],userEvent:"select.search"}),YT(n),!0}),Ld=Lu((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,l=e.prevMatch(t,i,i);if(!l)return!1;let o=le.single(l.from,l.to),a=n.state.facet(Ha);return n.dispatch({selection:o,effects:[Jy(n,l),a.scrollToMatch(o.main,n)],userEvent:"select.search"}),YT(n),!0}),L6=Lu((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:le.create(t.map(i=>le.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),z6=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:l}=t.main,o=[],a=0;for(let u=new La(n.doc,n.sliceDoc(i,l));!u.next().done;){if(o.length>1e3)return!1;u.value.from==i&&(a=o.length),o.push(le.range(u.value.from,u.value.to))}return e(n.update({selection:le.create(o,a),userEvent:"select.search.matches"})),!0},b2=Lu((n,{query:e})=>{let{state:t}=n,{from:i,to:l}=t.selection.main;if(t.readOnly)return!1;let o=e.nextMatch(t,i,i);if(!o)return!1;let a=o,u=[],f,d,m=[];a.precise?a.from==i&&a.to==l&&(d=t.toText(e.getReplacement(a)),u.push({from:a.from,to:a.to,insert:d}),a=e.nextMatch(t,a.from,a.to),m.push(Ee.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+"."))):a=e.nextMatch(t,a.from,a.to);let g=n.state.changes(u);return a&&(f=le.single(a.from,a.to).map(g),m.push(Jy(n,a)),m.push(t.facet(Ha).scrollToMatch(f.main,n))),n.dispatch({changes:g,selection:f,effects:m,userEvent:"input.replace"}),!0}),B6=Lu((n,{query:e})=>{if(n.state.readOnly)return!1;let t=[];for(let l of e.matchAll(n.state,1e9)){let{from:o,to:a,precise:u}=l;u&&t.push({from:o,to:a,insert:e.getReplacement(l)})}if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:Ee.announce.of(i),userEvent:"input.replace.all"}),!0});function Zy(n){return n.state.facet(Ha).createPanel(n)}function Gx(n,e){var t,i,l,o,a;let u=n.selection.main,f=u.empty||u.to>u.from+100?"":n.sliceDoc(u.from,u.to);if(e&&!f)return e;let d=n.facet(Ha);return new QT({search:((t=e==null?void 0:e.literal)!==null&&t!==void 0?t:d.literal)?f:f.replace(/\n/g,"\\n"),caseSensitive:(i=e==null?void 0:e.caseSensitive)!==null&&i!==void 0?i:d.caseSensitive,literal:(l=e==null?void 0:e.literal)!==null&&l!==void 0?l:d.literal,regexp:(o=e==null?void 0:e.regexp)!==null&&o!==void 0?o:d.regexp,wholeWord:(a=e==null?void 0:e.wholeWord)!==null&&a!==void 0?a:d.wholeWord})}function $T(n){let e=rm(n,Zy);return e&&e.dom.querySelector("[main-field]")}function YT(n){let e=$T(n);e&&e==n.root.activeElement&&e.select()}const GT=n=>{let e=n.state.field(ns,!1);if(e&&e.panel){let t=$T(n);if(t&&t!=n.root.activeElement){let i=Gx(n.state,e.query.spec);i.valid&&n.dispatch({effects:wu.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[Wy.of(!0),e?wu.of(Gx(n.state,e.query.spec)):Ke.appendConfig.of(U6)]});return!0},KT=n=>{let e=n.state.field(ns,!1);if(!e||!e.panel)return!1;let t=rm(n,Zy);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:Wy.of(!1)}),!0},P6=[{key:"Mod-f",run:GT,scope:"editor search-panel"},{key:"F3",run:_d,shift:Ld,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:_d,shift:Ld,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:KT,scope:"editor search-panel"},{key:"Mod-Shift-l",run:z6},{key:"Mod-Alt-g",run:m6},{key:"Mod-d",run:O6,preventDefault:!0}];class H6{constructor(e){this.view=e;let t=this.query=e.state.field(ns).query.spec;this.commit=this.commit.bind(this),this.searchField=Tt("input",{value:t.search,placeholder:Mi(e,"Find"),"aria-label":Mi(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Tt("input",{value:t.replace,placeholder:Mi(e,"Replace"),"aria-label":Mi(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Tt("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=Tt("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=Tt("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(l,o,a){return Tt("button",{class:"cm-button",name:l,onclick:o,type:"button"},a)}this.dom=Tt("div",{onkeydown:l=>this.keydown(l),class:"cm-search"},[this.searchField,i("next",()=>_d(e),[Mi(e,"next")]),i("prev",()=>Ld(e),[Mi(e,"previous")]),i("select",()=>L6(e),[Mi(e,"all")]),Tt("label",null,[this.caseField,Mi(e,"match case")]),Tt("label",null,[this.reField,Mi(e,"regexp")]),Tt("label",null,[this.wordField,Mi(e,"by word")]),...e.state.readOnly?[]:[Tt("br"),this.replaceField,i("replace",()=>b2(e),[Mi(e,"replace")]),i("replaceAll",()=>B6(e),[Mi(e,"replace all")])],Tt("button",{name:"close",onclick:()=>KT(e),"aria-label":Mi(e,"close"),type:"button"},["×"])])}commit(){let e=new QT({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:wu.of(e)}))}keydown(e){Uj(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ld:_d)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),b2(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(wu)&&!i.value.eq(this.query)&&this.setQuery(i.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(Ha).top}}function Mi(n,e){return n.state.phrase(e)}const Lh=30,zh=/[\s\.,:;?!]/;function Jy(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),l=n.state.doc.lineAt(t).to,o=Math.max(i.from,e-Lh),a=Math.min(l,t+Lh),u=n.state.sliceDoc(o,a);if(o!=i.from){for(let f=0;fu.length-Lh;f--)if(!zh.test(u[f-1])&&zh.test(u[f])){u=u.slice(0,f);break}}return Ee.announce.of(`${n.state.phrase("current match")}. ${u} ${n.state.phrase("on line")} ${i.number}.`)}const I6=Ee.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"}}),U6=[ns,ho.low(_6),I6];class WT{constructor(e,t,i,l){this.state=e,this.pos=t,this.explicit=i,this.view=l,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Qn(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),i=Math.max(t.from,this.pos-250),l=t.text.slice(i-t.from,this.pos-t.from),o=l.search(ZT(e,!1));return o<0?null:{from:i+o,to:this.pos,text:l.slice(o)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function v2(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function F6(n){let e=Object.create(null),t=Object.create(null);for(let{label:l}of n){e[l[0]]=!0;for(let o=1;otypeof l=="string"?{label:l}:l),[t,i]=e.every(l=>/^\w+$/.test(l.label))?[/\w*$/,/\w+$/]:F6(e);return l=>{let o=l.matchBefore(i);return o||l.explicit?{from:o?o.from:l.pos,options:e,validFor:t}:null}}class w2{constructor(e,t,i,l){this.completion=e,this.source=t,this.match=i,this.score=l}}function so(n){return n.selection.main.from}function ZT(n,e){var t;let{source:i}=n,l=e&&i[0]!="^",o=i[i.length-1]!="$";return!l&&!o?n:new RegExp(`${l?"^":""}(?:${i})${o?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const JT=ml.define();function V6(n,e,t,i){let{main:l}=n.selection,o=t-l.from,a=i-l.from;return{...n.changeByRange(u=>{if(u!=l&&t!=i&&n.sliceDoc(u.from+o,u.from+a)!=n.sliceDoc(t,i))return{range:u};let f=n.toText(e);return{changes:{from:u.from+o,to:i==l.from?u.to:u.from+a,insert:f},range:le.cursor(u.from+o+f.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const k2=new WeakMap;function Q6(n){if(!Array.isArray(n))return n;let e=k2.get(n);return e||k2.set(n,e=q6(n)),e}const zd=Ke.define(),ku=Ke.define();class X6{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t=48&&H<=57||H>=97&&H<=122?2:H>=65&&H<=90?1:0:(M=ky(H))!=M.toLowerCase()?1:M!=M.toUpperCase()?2:0;(!j||A==1&&C||U==0&&A!=0)&&(t[g]==H||i[g]==H&&(b=!0)?a[g++]=j:a.length&&(N=!1)),U=A,j+=jr(H)}return g==f&&a[0]==0&&N?this.result(-100+(b?-200:0),a,e):v==f&&w==0?this.ret(-200-e.length+(S==e.length?0:-100),[0,S]):u>-1?this.ret(-700-e.length,[u,u+this.pattern.length]):v==f?this.ret(-900-e.length,[w,S]):g==f?this.result(-100+(b?-200:0)+-700+(N?0:-1100),a,e):t.length==2?null:this.result((l[0]?-700:0)+-200+-1100,l,e)}result(e,t,i){let l=[],o=0;for(let a of t){let u=a+(this.astral?jr(pi(i,a)):1);o&&l[o-1]==a?l[o-1]=u:(l[o++]=a,l[o++]=u)}return this.ret(e-i.length,l)}}class $6{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Y6,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>S2(e(i),t(i)),optionClass:(e,t)=>i=>S2(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function S2(n,e){return n?e?n+" "+e:n:e}function Y6(n,e,t,i,l,o){let a=n.textDirection==At.RTL,u=a,f=!1,d="top",m,g,b=e.left-l.left,v=l.right-e.right,w=i.right-i.left,S=i.bottom-i.top;if(u&&b=S||j>e.top?m=t.bottom-e.top:(d="bottom",m=e.bottom-t.top)}let C=(e.bottom-e.top)/o.offsetHeight,N=(e.right-e.left)/o.offsetWidth;return{style:`${d}: ${m/C}px; max-width: ${g/N}px`,class:"cm-completionInfo-"+(f?a?"left-narrow":"right-narrow":u?"left":"right")}}const eb=Ke.define();function G6(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(l=>"cm-completionIcon-"+l)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,l,o){let a=document.createElement("span");a.className="cm-completionLabel";let u=t.displayLabel||t.label,f=0;for(let d=0;df&&a.appendChild(document.createTextNode(u.slice(f,m)));let b=a.appendChild(document.createElement("span"));b.appendChild(document.createTextNode(u.slice(m,g))),b.className="cm-completionMatchedText",f=g}return ft.position-i.position).map(t=>t.render)}function O0(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let l=Math.floor(e/t);return{from:l*t,to:(l+1)*t}}let i=Math.ceil((n-e)/t);return{from:n-i*t,to:n-(i-1)*t}}class K6{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:f=>this.placeInfo(f),key:this},this.space=null,this.currentClass="";let l=e.state.field(t),{options:o,selected:a}=l.open,u=e.state.facet(kn);this.optionContent=G6(u),this.optionClass=u.optionClass,this.tooltipClass=u.tooltipClass,this.range=O0(o.length,a,u.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",f=>{let{options:d}=e.state.field(t).open;for(let m=f.target,g;m&&m!=this.dom;m=m.parentNode)if(m.nodeName=="LI"&&(g=/-(\d+)$/.exec(m.id))&&+g[1]this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;m!=null&&(e.dispatch({effects:eb.of(m)}),f.preventDefault())}}),this.dom.addEventListener("focusout",f=>{let d=e.state.field(this.stateField,!1);d&&d.tooltip&&e.state.facet(kn).closeOnBlur&&f.relatedTarget!=e.contentDOM&&e.dispatch({effects:ku.of(null)})}),this.showOptions(o,l.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField),l=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=l){let{options:o,selected:a,disabled:u}=i.open;(!l.open||l.open.options!=o)&&(this.range=O0(o.length,a,e.state.facet(kn).maxRenderedOptions),this.showOptions(o,i.id)),this.updateSel(),u!=((t=l.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!u)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected=this.range.to)&&(this.range=O0(t.options.length,t.selected,this.view.state.facet(kn).maxRenderedOptions),this.showOptions(t.options,e.id));let i=this.updateSelectedOption(t.selected);if(i){this.destroyInfo();let{completion:l}=t.options[t.selected],{info:o}=l;if(!o)return;let a=typeof o=="string"?document.createTextNode(o):o(l);if(!a)return;"then"in a?a.then(u=>{u&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(u,l)}).catch(u=>yi(this.view.state,u,"completion info")):(this.addInfoPane(a,l),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:l,destroy:o}=e;i.appendChild(l),this.infoDestroy=o||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,l=this.range.from;i;i=i.nextSibling,l++)i.nodeName!="LI"||!i.id?l--:l==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return t&&Z6(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),l=e.getBoundingClientRect(),o=this.space;if(!o){let a=this.dom.ownerDocument.documentElement;o={left:0,top:0,right:a.clientWidth,bottom:a.clientHeight}}return l.top>Math.min(o.bottom,t.bottom)-10||l.bottom{a.target==l&&a.preventDefault()});let o=null;for(let a=i.from;ai.from||i.from==0))if(o=b,typeof d!="string"&&d.header)l.appendChild(d.header(d));else{let v=l.appendChild(document.createElement("completion-section"));v.textContent=b}}const m=l.appendChild(document.createElement("li"));m.id=t+"-"+a,m.setAttribute("role","option");let g=this.optionClass(u);g&&(m.className=g);for(let b of this.optionContent){let v=b(u,this.view.state,this.view,f);v&&m.appendChild(v)}}return i.from&&l.classList.add("cm-completionListIncompleteTop"),i.tonew K6(t,n,e)}function Z6(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),l=t.height/n.offsetHeight;i.topt.bottom&&(n.scrollTop+=(i.bottom-t.bottom)/l)}function C2(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function J6(n,e){let t=[],i=null,l=null,o=m=>{t.push(m);let{section:g}=m.completion;if(g){i||(i=[]);let b=typeof g=="string"?g:g.name;i.some(v=>v.name==b)||i.push(typeof g=="string"?{name:b}:g)}},a=e.facet(kn);for(let m of n)if(m.hasResult()){let g=m.result.getMatch;if(m.result.filter===!1)for(let b of m.result.options)o(new w2(b,m.source,g?g(b):[],1e9-t.length));else{let b=e.sliceDoc(m.from,m.to),v,w=a.filterStrict?new $6(b):new X6(b);for(let S of m.result.options)if(v=w.match(S.label)){let C=S.displayLabel?g?g(S,v.matched):[]:v.matched,N=v.score+(S.boost||0);if(o(new w2(S,m.source,C,N)),typeof S.section=="object"&&S.section.rank==="dynamic"){let{name:j}=S.section;l||(l=Object.create(null)),l[j]=Math.max(N,l[j]||-1e9)}}}}if(i){let m=Object.create(null),g=0,b=(v,w)=>(v.rank==="dynamic"&&w.rank==="dynamic"?l[w.name]-l[v.name]:0)||(typeof v.rank=="number"?v.rank:1e9)-(typeof w.rank=="number"?w.rank:1e9)||(v.nameb.score-g.score||d(g.completion,b.completion))){let g=m.completion;!f||f.label!=g.label||f.detail!=g.detail||f.type!=null&&g.type!=null&&f.type!=g.type||f.apply!=g.apply||f.boost!=g.boost?u.push(m):C2(m.completion)>C2(f)&&(u[u.length-1]=m),f=m.completion}return u}class ga{constructor(e,t,i,l,o,a){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=l,this.selected=o,this.disabled=a}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new ga(this.options,O2(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,l,o,a){if(l&&!a&&e.some(d=>d.isPending))return l.setDisabled();let u=J6(e,t);if(!u.length)return l&&e.some(d=>d.isPending)?l.setDisabled():null;let f=t.facet(kn).selectOnOpen?0:-1;if(l&&l.selected!=f&&l.selected!=-1){let d=l.options[l.selected].completion;for(let m=0;mm.hasResult()?Math.min(d,m.from):d,1e8),create:lB,above:o.aboveCursor},l?l.timestamp:Date.now(),f,!1)}map(e){return new ga(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new ga(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Bd{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new Bd(iB,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(kn),o=(i.override||t.languageDataAt("autocomplete",so(t)).map(Q6)).map(f=>(this.active.find(m=>m.source==f)||new Yi(f,this.active.some(m=>m.state!=0)?1:0)).update(e,i));o.length==this.active.length&&o.every((f,d)=>f==this.active[d])&&(o=this.active);let a=this.open,u=e.effects.some(f=>f.is(tb));a&&e.docChanged&&(a=a.map(e.changes)),e.selection||o.some(f=>f.hasResult()&&e.changes.touchesRange(f.from,f.to))||!eB(o,this.active)||u?a=ga.build(o,t,this.id,a,i,u):a&&a.disabled&&!o.some(f=>f.isPending)&&(a=null),!a&&o.every(f=>!f.isPending)&&o.some(f=>f.hasResult())&&(o=o.map(f=>f.hasResult()?new Yi(f.source,0):f));for(let f of e.effects)f.is(eb)&&(a=a&&a.setSelected(f.value,this.id));return o==this.active&&a==this.open?this:new Bd(o,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?tB:nB}}function eB(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t-1&&(t["aria-activedescendant"]=n+"-"+e),t}const iB=[];function eA(n,e){if(n.isUserEvent("input.complete")){let i=n.annotation(JT);if(i&&e.activateOnCompletion(i))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class Yi{constructor(e,t,i=!1){this.source=e,this.state=t,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let i=eA(e,t),l=this;(i&8||i&16&&this.touches(e))&&(l=new Yi(l.source,0)),i&4&&l.state==0&&(l=new Yi(this.source,1)),l=l.updateFor(e,i);for(let o of e.effects)if(o.is(zd))l=new Yi(l.source,1,o.value);else if(o.is(ku))l=new Yi(l.source,0);else if(o.is(tb))for(let a of o.value)a.source==l.source&&(l=a);return l}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(so(e.state))}}class Sa extends Yi{constructor(e,t,i,l,o,a){super(e,3,t),this.limit=i,this.result=l,this.from=o,this.to=a}hasResult(){return!0}updateFor(e,t){var i;if(!(t&3))return this.map(e.changes);let l=this.result;l.map&&!e.changes.empty&&(l=l.map(l,e.changes));let o=e.changes.mapPos(this.from),a=e.changes.mapPos(this.to,1),u=so(e.state);if(u>a||!l||t&2&&(so(e.startState)==this.from||ut.map(e))}}),gi=Xn.define({create(){return Bd.start()},update(n,e){return n.update(e)},provide:n=>[Hy.from(n,e=>e.tooltip),Ee.contentAttributes.from(n,e=>e.attrs)]});function nb(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(gi).active.find(l=>l.source==e.source);return i instanceof Sa?(typeof t=="string"?n.dispatch({...V6(n.state,t,i.from,i.to),annotations:JT.of(e.completion)}):t(n,e.completion,i.from,i.to),!0):!1}const lB=W6(gi,nb);function Bh(n,e="option"){return t=>{let i=t.state.field(gi,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp-1?i.open.selected+l*(n?1:-1):n?0:a-1;return u<0?u=e=="page"?0:a-1:u>=a&&(u=e=="page"?a-1:0),t.dispatch({effects:eb.of(u)}),!0}}const sB=n=>{let e=n.state.field(gi,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestampn.state.field(gi,!1)?(n.dispatch({effects:zd.of(!0)}),!0):!1,oB=n=>{let e=n.state.field(gi,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:ku.of(null)}),!0)};class aB{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const cB=50,uB=1e3,fB=en.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(gi).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(gi),t=n.state.facet(kn);if(!n.selectionSet&&!n.docChanged&&n.startState.field(gi)==e)return;let i=n.transactions.some(o=>{let a=eA(o,t);return a&8||(o.selection||o.docChanged)&&!(a&3)});for(let o=0;ocB&&Date.now()-a.time>uB){for(let u of a.context.abortListeners)try{u()}catch(f){yi(this.view.state,f)}a.context.abortListeners=null,this.running.splice(o--,1)}else a.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(o=>o.effects.some(a=>a.is(zd)))&&(this.pendingStart=!0);let l=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(o=>o.isPending&&!this.running.some(a=>a.active.source==o.source))?setTimeout(()=>this.startUpdate(),l):-1,this.composing!=0)for(let o of n.transactions)o.isUserEvent("input.type")?this.composing=2:this.composing==2&&o.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(gi);for(let t of e.active)t.isPending&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(kn).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=so(e),i=new WT(e,t,n.explicit,this.view),l=new aB(n,i);this.running.push(l),Promise.resolve(n.source(i)).then(o=>{l.context.aborted||(l.done=o||null,this.scheduleAccept())},o=>{this.view.dispatch({effects:ku.of(null)}),yi(this.view.state,o)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(kn).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(kn),i=this.view.state.field(gi);for(let l=0;lu.source==o.active.source);if(a&&a.isPending)if(o.done==null){let u=new Yi(o.active.source,0);for(let f of o.updates)u=u.update(f,t);u.isPending||e.push(u)}else this.startQuery(a)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:tb.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(gi,!1);if(e&&e.tooltip&&this.view.state.facet(kn).closeOnBlur){let t=e.open&&_N(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:ku.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:zd.of(!1)}),20),this.composing=0}}}),hB=typeof navigator=="object"&&/Win/.test(navigator.platform),dB=ho.highest(Ee.domEventHandlers({keydown(n,e){let t=e.state.field(gi,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||!n.key||n.key.length>1||n.ctrlKey&&!(hB&&n.altKey)||n.metaKey)return!1;let i=t.open.options[t.open.selected],l=t.active.find(a=>a.source==i.source),o=i.completion.commitCharacters||l.result.commitCharacters;return o&&o.indexOf(n.key)>-1&&nb(e,i),!1}})),mB=Ee.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center",cursor:"pointer"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".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"}}}),Su={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},to=Ke.define({map(n,e){let t=e.mapPos(n,-1,ii.TrackAfter);return t??void 0}}),ib=new class extends rs{};ib.startSide=1;ib.endSide=-1;const tA=Xn.define({create(){return rt.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(to)&&(n=n.update({add:[ib.range(t.value,t.value+1)]}));return n}});function pB(){return[xB,tA]}const T0="()[]{}<>«»»«[]{}";function nA(n){for(let e=0;e{if((gB?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let l=n.state.selection.main;if(i.length>2||i.length==2&&jr(pi(i,0))==1||e!=l.from||t!=l.to)return!1;let o=vB(n.state,i);return o?(n.dispatch(o),!0):!1}),yB=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=iA(n,n.selection.main.head).brackets||Su.brackets,l=null,o=n.changeByRange(a=>{if(a.empty){let u=wB(n.doc,a.head);for(let f of i)if(f==u&&fm(n.doc,a.head)==nA(pi(f,0)))return{changes:{from:a.head-f.length,to:a.head+f.length},range:le.cursor(a.head-f.length)}}return{range:l=a}});return l||e(n.update(o,{scrollIntoView:!0,userEvent:"delete.backward"})),!l},bB=[{key:"Backspace",run:yB}];function vB(n,e){let t=iA(n,n.selection.main.head),i=t.brackets||Su.brackets;for(let l of i){let o=nA(pi(l,0));if(e==l)return o==l?CB(n,l,i.indexOf(l+l+l)>-1,t):kB(n,l,o,t.before||Su.before);if(e==o&&rA(n,n.selection.main.from))return SB(n,l,o)}return null}function rA(n,e){let t=!1;return n.field(tA).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function fm(n,e){let t=n.sliceString(e,e+2);return t.slice(0,jr(pi(t,0)))}function wB(n,e){let t=n.sliceString(e-2,e);return jr(pi(t,0))==t.length?t:t.slice(1)}function kB(n,e,t,i){let l=null,o=n.changeByRange(a=>{if(!a.empty)return{changes:[{insert:e,from:a.from},{insert:t,from:a.to}],effects:to.of(a.to+e.length),range:le.range(a.anchor+e.length,a.head+e.length)};let u=fm(n.doc,a.head);return!u||/\s/.test(u)||i.indexOf(u)>-1?{changes:{insert:e+t,from:a.head},effects:to.of(a.head+e.length),range:le.cursor(a.head+e.length)}:{range:l=a}});return l?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function SB(n,e,t){let i=null,l=n.changeByRange(o=>o.empty&&fm(n.doc,o.head)==t?{changes:{from:o.head,to:o.head+t.length,insert:t},range:le.cursor(o.head+t.length)}:i={range:o});return i?null:n.update(l,{scrollIntoView:!0,userEvent:"input.type"})}function CB(n,e,t,i){let l=i.stringPrefixes||Su.stringPrefixes,o=null,a=n.changeByRange(u=>{if(!u.empty)return{changes:[{insert:e,from:u.from},{insert:e,from:u.to}],effects:to.of(u.to+e.length),range:le.range(u.anchor+e.length,u.head+e.length)};let f=u.head,d=fm(n.doc,f),m;if(d==e){if(N2(n,f))return{changes:{insert:e+e,from:f},effects:to.of(f+e.length),range:le.cursor(f+e.length)};if(rA(n,f)){let b=t&&n.sliceDoc(f,f+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:f,to:f+b.length,insert:b},range:le.cursor(f+b.length)}}}else{if(t&&n.sliceDoc(f-2*e.length,f)==e+e&&(m=T2(n,f-2*e.length,l))>-1&&N2(n,m))return{changes:{insert:e+e+e+e,from:f},effects:to.of(f+e.length),range:le.cursor(f+e.length)};if(n.charCategorizer(f)(d)!=Ut.Word&&T2(n,f,l)>-1&&!OB(n,f,e,l))return{changes:{insert:e+e,from:f},effects:to.of(f+e.length),range:le.cursor(f+e.length)}}return{range:o=u}});return o?null:n.update(a,{scrollIntoView:!0,userEvent:"input.type"})}function N2(n,e){let t=Qn(n).resolveInner(e+1);return t.parent&&t.from==e}function OB(n,e,t,i){let l=Qn(n).resolveInner(e,-1),o=i.reduce((a,u)=>Math.max(a,u.length),0);for(let a=0;a<5;a++){let u=n.sliceDoc(l.from,Math.min(l.to,l.from+t.length+o)),f=u.indexOf(t);if(!f||f>-1&&i.indexOf(u.slice(0,f))>-1){let m=l.firstChild;for(;m&&m.from==l.from&&m.to-m.from>t.length+f;){if(n.sliceDoc(m.to-t.length,m.to)==t)return!1;m=m.firstChild}return!0}let d=l.to==e&&l.parent;if(!d)break;l=d}return!1}function T2(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=Ut.Word)return e;for(let l of t){let o=e-l.length;if(n.sliceDoc(o,e)==l&&i(n.sliceDoc(o-1,o))!=Ut.Word)return o}return-1}function NB(n={}){return[dB,gi,kn.of(n),fB,TB,mB]}const lA=[{key:"Ctrl-Space",run:N0},{mac:"Alt-`",run:N0},{mac:"Alt-i",run:N0},{key:"Escape",run:oB},{key:"ArrowDown",run:Bh(!0)},{key:"ArrowUp",run:Bh(!1)},{key:"PageDown",run:Bh(!0,"page")},{key:"PageUp",run:Bh(!1,"page")},{key:"Enter",run:sB}],TB=ho.highest(By.computeN([kn],n=>n.facet(kn).defaultKeymap?[lA]:[]));class A2{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class Zs{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let l=i.facet(Cu).markerFilter;l&&(e=l(e,i));let o=e.slice().sort((v,w)=>v.from-w.from||v.to-w.to),a=new Ir,u=[],f=0,d=i.doc.iter(),m=0,g=i.doc.length;for(let v=0;;){let w=v==o.length?null:o[v];if(!w&&!u.length)break;let S,C;if(u.length)S=f,C=u.reduce((D,U)=>Math.min(D,U.to),w&&w.from>S?w.from:1e8);else{if(S=w.from,S>g)break;C=w.to,u.push(w),v++}for(;vD.from||D.to==S))u.push(D),v++,C=Math.min(D.to,C);else{C=Math.min(D.from,C);break}}C=Math.min(C,g);let N=!1;if(u.some(D=>D.from==S&&(D.to==C||C==g))&&(N=S==C,!N&&C-S<10)){let D=S-(m+d.value.length);D>0&&(d.next(D),m=S);for(let U=S;;){if(U>=C){N=!0;break}if(!d.lineBreak&&m+d.value.length>U)break;U=m+d.value.length,m+=d.value.length,d.next()}}let j=IB(u);if(N)a.add(S,S,Fe.widget({widget:new zB(j),diagnostics:u.slice()}));else{let D=u.reduce((U,H)=>H.markClass?U+" "+H.markClass:U,"");a.add(S,C,Fe.mark({class:"cm-lintRange cm-lintRange-"+j+D,diagnostics:u.slice(),inclusiveEnd:u.some(U=>U.to>C)}))}if(f=C,f==g)break;for(let D=0;D{if(!(e&&a.diagnostics.indexOf(e)<0))if(!i)i=new A2(l,o,e||a.diagnostics[0]);else{if(a.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new A2(i.from,o,i.diagnostic)}}),i}function AB(n,e){let t=e.pos,i=e.end||t,l=n.state.facet(Cu).hideOn(n,t,i);if(l!=null)return l;let o=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(a=>a.is(sA))||n.changes.touchesRange(o.from,Math.max(o.to,i)))}function EB(n,e){return n.field(_i,!1)?e:e.concat(Ke.appendConfig.of(UB))}const sA=Ke.define(),rb=Ke.define(),oA=Ke.define(),_i=Xn.define({create(){return new Zs(Fe.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,l=n.panel;if(n.selected){let o=e.changes.mapPos(n.selected.from,1);i=us(t,n.selected.diagnostic,o)||us(t,null,o)}!t.size&&l&&e.state.facet(Cu).autoPanel&&(l=null),n=new Zs(t,l,i)}for(let t of e.effects)if(t.is(sA)){let i=e.state.facet(Cu).autoPanel?t.value.length?Ou.open:null:n.panel;n=Zs.init(t.value,i,e.state)}else t.is(rb)?n=new Zs(n.diagnostics,t.value?Ou.open:null,n.selected):t.is(oA)&&(n=new Zs(n.diagnostics,n.panel,t.value));return n},provide:n=>[xu.from(n,e=>e.panel),Ee.decorations.from(n,e=>e.diagnostics)]}),MB=Fe.mark({class:"cm-lintRange cm-lintRange-active"});function DB(n,e,t){let{diagnostics:i}=n.state.field(_i),l,o=-1,a=-1;i.between(e-(t<0?1:0),e+(t>0?1:0),(f,d,{spec:m})=>{if(e>=f&&e<=d&&(f==d||(e>f||t>0)&&(ecA(n,t,!1)))}const jB=n=>{let e=n.state.field(_i,!1);(!e||!e.panel)&&n.dispatch({effects:EB(n.state,[rb.of(!0)])});let t=rm(n,Ou.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},E2=n=>{let e=n.state.field(_i,!1);return!e||!e.panel?!1:(n.dispatch({effects:rb.of(!1)}),!0)},_B=n=>{let e=n.state.field(_i,!1);if(!e)return!1;let t=n.state.selection.main,i=us(e.diagnostics,null,t.to+1);return!i&&(i=us(e.diagnostics,null,0),!i||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),E_(n,i.from,1,{tooltip:uA,until:l=>l.docChanged||l.newSelection.main.headi.to}),!0)},LB=[{key:"Mod-Shift-m",run:jB,preventDefault:!0},{key:"F8",run:_B}],Cu=Ne.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...Ur(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:M2,tooltipFilter:M2,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,l,o)=>e(i,l,o)||t(i,l,o):e:t,autoPanel:(e,t)=>e||t})}}});function M2(n,e){return n?e?(t,i)=>e(n(t,i),i):n:e}function aA(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;io.toLowerCase()==l.toLowerCase())){e.push(l);continue e}}e.push("")}return e}function cA(n,e,t){var i;let l=t?aA(e.actions):[];return Tt("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},Tt("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((o,a)=>{let u=!1,f=v=>{if(v.preventDefault(),u)return;u=!0;let w=us(n.state.field(_i).diagnostics,e);w&&o.apply(n,w.from,w.to)},{name:d}=o,m=l[a]?d.indexOf(l[a]):-1,g=m<0?d:[d.slice(0,m),Tt("u",d.slice(m,m+1)),d.slice(m+1)],b=o.markClass?" "+o.markClass:"";return Tt("button",{type:"button",class:"cm-diagnosticAction"+b,onclick:f,onmousedown:f,"aria-label":` Action: ${d}${m<0?"":` (access key "${l[a]})"`}.`},g)}),e.source&&Tt("div",{class:"cm-diagnosticSource"},e.source))}class zB extends pl{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return Tt("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class D2{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=cA(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class Ou{constructor(e){this.view=e,this.items=[];let t=l=>{if(!(l.ctrlKey||l.altKey||l.metaKey)){if(l.keyCode==27)E2(this.view),this.view.focus();else if(l.keyCode==38||l.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(l.keyCode==40||l.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(l.keyCode==36)this.moveSelection(0);else if(l.keyCode==35)this.moveSelection(this.items.length-1);else if(l.keyCode==13)this.view.focus();else if(l.keyCode>=65&&l.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:o}=this.items[this.selectedIndex],a=aA(o.actions);for(let u=0;u{for(let o=0;oE2(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(_i).selected;if(!e)return-1;for(let t=0;t{for(let m of d.diagnostics){if(a.has(m))continue;a.add(m);let g=-1,b;for(let v=i;vi&&(this.items.splice(i,g-i),l=!0)),t&&b.diagnostic==t.diagnostic?b.dom.hasAttribute("aria-selected")||(b.dom.setAttribute("aria-selected","true"),o=b):b.dom.hasAttribute("aria-selected")&&b.dom.removeAttribute("aria-selected"),i++}});i({sel:o.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:u,panel:f})=>{let d=f.height/this.list.offsetHeight;u.topf.bottom&&(this.list.scrollTop+=(u.bottom-f.bottom)/d)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),l&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(_i),i=us(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:oA.of(i)})}static open(e){return new Ou(e)}}function BB(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,${encodeURIComponent(n)}')`}function Ph(n){return BB(``,'width="6" height="3"')}const PB=Ee.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-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:Ph("#f11")},".cm-lintRange-warning":{backgroundImage:Ph("orange")},".cm-lintRange-info":{backgroundImage:Ph("#999")},".cm-lintRange-hint":{backgroundImage:Ph("#66d")},".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-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".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}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function HB(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function IB(n){let e="hint",t=1;for(let i of n){let l=HB(i.severity);l>t&&(t=l,e=i.severity)}return e}const uA=A_(DB,{hideOn:AB}),UB=[_i,Ee.decorations.compute([_i],n=>{let{selected:e,panel:t}=n.field(_i);return!e||!t||e.from==e.to?Fe.none:Fe.set([MB.range(e.from,e.to)])}),uA,PB],FB=[q_(),X_(),l_(),az(),LL(),$j(),Jj(),pt.allowMultipleSelections.of(!0),wL(),oT(HL,{fallback:!0}),XL(),pB(),NB(),x_(),v_(),f_(),x6(),By.of([...bB,...h6,...P6,...xz,...DL,...lA,...LB])];var R2={};class Pd{constructor(e,t,i,l,o,a,u,f,d,m=0,g){this.p=e,this.stack=t,this.state=i,this.reducePos=l,this.pos=o,this.score=a,this.buffer=u,this.bufferBase=f,this.curContext=d,this.lookAhead=m,this.parent=g}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let l=e.parser.context;return new Pd(e,[],t,i,i,0,[],0,l?new j2(l,l.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 i=e>>19,l=e&65535,{parser:o}=this.p,a=this.reducePos=2e3&&!(!((t=this.p.parser.nodeSet.types[l])===null||t===void 0)&&t.isAnonymous)&&(d==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=m):this.p.lastBigReductionSizef;)this.stack.pop();this.reduceContext(l,d)}storeNode(e,t,i,l=4,o=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&this.buffer[a-4]==0&&this.buffer[a-1]>-1){if(t==i)return;if(this.buffer[a-2]>=t){this.buffer[a-2]=i;return}}}if(!o||this.pos==i)this.buffer.push(e,t,i,l);else{let a=this.buffer.length;if(a>0&&(this.buffer[a-4]!=0||this.buffer[a-1]<0)){let u=!1;for(let f=a;f>0&&this.buffer[f-2]>i;f-=4)if(this.buffer[f-1]>=0){u=!0;break}if(u)for(;a>0&&this.buffer[a-2]>i;)this.buffer[a]=this.buffer[a-4],this.buffer[a+1]=this.buffer[a-3],this.buffer[a+2]=this.buffer[a-2],this.buffer[a+3]=this.buffer[a-1],a-=4,l>4&&(l-=4)}this.buffer[a]=e,this.buffer[a+1]=t,this.buffer[a+2]=i,this.buffer[a+3]=l}}shift(e,t,i,l){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let o=e,{parser:a}=this.p;this.pos=l;let u=a.stateFlag(o,1);!u&&(l>i||t<=a.maxNode)&&(this.reducePos=l),this.pushState(o,u?i:Math.min(i,this.reducePos)),this.shiftContext(t,i),t<=a.maxNode&&this.buffer.push(t,i,l,4)}else this.pos=l,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,l,4)}apply(e,t,i,l){e&65536?this.reduce(e):this.shift(e,t,i,l)}useNode(e,t,i){let l=this.p.reused.length-1;(l<0||this.p.reused[l]!=e)&&(this.p.reused.push(e),l++);let o=this.reducePos=this.pos=i+e.length;this.pushState(t,i),this.buffer.push(l,i,o,-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&&e.buffer[t-4]==0&&(t-=4);t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),l=e.bufferBase+t;for(;e&&l==e.bufferBase;)e=e.parent;return new Pd(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,l,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new qB(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if((i&65536)==0)return!0;t.reduce(i)}}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 l=[];for(let o=0,a;of&1&&u==a)||l.push(t[o],a)}t=l}let i=[];for(let l=0;l>19,l=t&65535,o=this.stack.length-i*3;if(o<0||e.getGoto(this.stack[o],l,!1)<0){let a=this.findForcedReduction();if(a==null)return!1;t=a}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=[],i=(l,o)=>{if(!t.includes(l))return t.push(l),e.allActions(l,a=>{if(!(a&393216))if(a&65536){let u=(a>>19)-o;if(u>1){let f=a&65535,d=this.stack.length-u*3;if(d>=0&&e.getGoto(this.stack[d],f,!1)>=0)return u<<19|65536|f}}else{let u=i(a,o+1);if(u!=null)return u}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}}class j2{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class qB{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let l=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=l}}class Hd{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Hd(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Hd(this.stack,this.pos,this.index)}}function Hh(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let i=0,l=0;i=92&&a--,a>=34&&a--;let f=a-32;if(f>=46&&(f-=46,u=!0),o+=f,u)break;o*=46}t?t[l++]=o:t=new e(o)}return t}class ad{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const _2=new ad;class VB{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=_2,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 i=this.range,l=this.rangeIndex,o=this.pos+e;for(;oi.to:o>=i.to;){if(l==this.ranges.length-1)return null;let a=this.ranges[++l];o+=a.from-i.to,i=a}return o}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,l;if(t>=0&&t=this.chunk2Pos&&iu.to&&(this.chunk2=this.chunk2.slice(0,u.to-i)),l=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),l}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i=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=_2,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 i="";for(let l of this.ranges){if(l.from>=t)break;l.to>e&&(i+=this.input.read(Math.max(l.from,e),Math.min(l.to,t)))}return i}}class Ca{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;QB(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}Ca.prototype.contextual=Ca.prototype.fallback=Ca.prototype.extend=!1;Ca.prototype.fallback=Ca.prototype.extend=!1;class hm{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}}function QB(n,e,t,i,l,o){let a=0,u=1<0){let w=n[v];if(f.allows(w)&&(e.token.value==-1||e.token.value==w||XB(w,e.token.value,l,o))){e.acceptToken(w);break}}let m=e.next,g=0,b=n[a+2];if(e.next<0&&b>g&&n[d+b*3-3]==65535){a=n[d+b*3-1];continue e}for(;g>1,w=d+v+(v<<1),S=n[w],C=n[w+1]||65536;if(m=C)g=v+1;else{a=n[w+2],e.advance();continue e}}break}}function L2(n,e,t){for(let i=e,l;(l=n[i])!=65535;i++)if(l==t)return i-e;return-1}function XB(n,e,t,i){let l=L2(t,i,e);return l<0||L2(t,i,n)e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(n.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:n.length}}class $B{constructor(e,t){this.fragments=e,this.minRepeat=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.lastRepeat=null,this.lastRepeatPos=-1,this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?z2(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?z2(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(o instanceof un){let u=a>this.lastRepeatPos&&o.type.id>=this.minRepeat;if(a==e||u){let f=a+o.length,d;if(a>=this.safeFrom&&f<=this.safeTo&&(!(d=o.prop(et.lookAhead))||f+d=Math.max(this.safeFrom,e)&&(this.trees.push(o),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+o.length}}}class YB{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new ad)}getActions(e){let t=0,i=null,{parser:l}=e.p,{tokenizers:o}=l,a=l.stateSlot(e.state,3),u=e.curContext?e.curContext.hash:0,f=0;for(let d=0;dg.end+25&&(f=Math.max(g.lookAhead,f)),g.value!=0)){let b=t;if(g.extended>-1&&(t=this.addActions(e,g.extended,g.end,t)),t=this.addActions(e,g.value,g.end,t),!m.extend&&(i=g,t>b))break}}for(;this.actions.length>t;)this.actions.pop();return f&&e.setLookAhead(f),!i&&e.pos==this.stream.end&&(i=new ad,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new ad,{pos:i,p:l}=e;return t.start=i,t.end=Math.min(i+1,l.stream.end),t.value=i==l.stream.end?l.parser.eofTerm:0,t}updateCachedToken(e,t,i){let l=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(l,e),i),e.value>-1){let{parser:o}=i.p;for(let a=0;a=0&&i.p.parser.dialect.allows(u>>1)){(u&1)==0?e.value=u>>1:e.extended=u>>1;break}}}else e.value=0,e.end=this.stream.clipPos(l+1)}putAction(e,t,i,l){for(let o=0;oe.bufferLength*4?new $B(i,e.minRepeatTerm):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],l,o;if(this.bigReductionCount>300&&e.length==1){let[a]=e;for(;a.forceReduce()&&a.stack.length&&a.stack[a.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;at)i.push(u);else{if(this.advanceStack(u,i,e))continue;{l||(l=[],o=[]),l.push(u);let f=this.tokens.getMainToken(u);o.push(f.value,f.end)}}break}}if(!i.length){let a=l&&ZB(l);if(a)return Di&&console.log("Finish with "+this.stackID(a)),this.stackToTree(a);if(this.parser.strict)throw Di&&l&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&l){let a=this.stoppedAt!=null&&l[0].pos>this.stoppedAt?l[0]:this.runRecovery(l,o,i);if(a)return Di&&console.log("Force-finish "+this.stackID(a)),this.stackToTree(a.forceAll())}if(this.recovering){let a=this.recovering==1?1:this.recovering*3;if(i.length>a)for(i.sort((u,f)=>f.score-u.score);i.length>a;)i.pop();i.some(u=>u.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let a=0;a500&&d.buffer.length>500)if((u.score-d.score||u.buffer.length-d.buffer.length)>0)i.splice(f--,1);else{i.splice(a--,1);continue e}}}i.length>12&&(i.sort((a,u)=>u.score-a.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let a=1;a-1&&i.length&&(!o||(i.prop(et.contextHash)||0)==a))return e.useNode(i,u,t),i;if(i.children.length==0||i.positions[0]>0)break;let f=i.children[0];if(f instanceof un&&(!l||f.type.id>=this.parser.minRepeatTerm))i=f;else break}return null}advanceStack(e,t,i){let l=e.pos,{parser:o}=this,a=Di?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&l>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let d=e.reducePos0)return e.reduce(u),Di&&console.log(a+this.stackID(e)+` (via always-reduce ${o.getName(u&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let f=this.tokens.getActions(e);for(let d=0;dl?t.push(w):i.push(w)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return B2(e,t),!0}}runRecovery(e,t,i){let l=null,o=!1;for(let a=0;a ":"";if(u.deadEnd&&(o||(o=!0,u.restart(),Di&&console.log(m+this.stackID(u)+" (restarted)"),this.advanceFully(u,i))))continue;let g=u.split(),b=m;for(let v=0;v<10&&g.forceReduce()&&(Di&&console.log(b+this.stackID(g)+" (via force-reduce)"),!this.advanceFully(g,i));v++)Di&&(b=this.stackID(g)+" -> ");for(let v of u.recoverByInsert(f))Di&&console.log(m+this.stackID(v)+" (via recover-insert)"),this.advanceFully(v,i);this.stream.end>u.pos?(d==u.pos&&(d++,f=0),u.recoverByDelete(f,d),Di&&console.log(m+this.stackID(u)+` (via recover-delete ${this.parser.getName(f)})`),B2(u,i)):(!l||l.scoren;class WB{constructor(e){this.start=e.start,this.shift=e.shift||E0,this.reduce=e.reduce||E0,this.reuse=e.reuse||E0,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}}class Id extends VN{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let u=0;ue.topRules[u][1]),l=[];for(let u=0;u=0)o(m,f,u[d++]);else{let g=u[d+-m];for(let b=-m;b>0;b--)o(u[d++],f,g);d++}}}this.nodeSet=new Iy(t.map((u,f)=>vi.define({name:f>=this.minRepeatTerm?void 0:u,id:f,props:l[f],top:i.indexOf(f)>-1,error:f==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(f)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=IN;let a=Hh(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let u=0;utypeof u=="number"?new Ca(a,u):u),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,i){let l=new GB(this,e,t,i);for(let o of this.wrappers)l=o(l,e,t,i);return l}getGoto(e,t,i=!1){let l=this.goto;if(t>=l[0])return-1;for(let o=l[t+1];;){let a=l[o++],u=a&1,f=l[o++];if(u&&i)return f;for(let d=o+(a>>1);o0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),l=i?t(i):void 0;for(let o=this.stateSlot(e,1);l==null;o+=3){if(this.data[o]==65535)if(this.data[o+1]==1)o=ol(this.data,o+2);else break;l=t(ol(this.data,o+1))}return l}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=ol(this.data,i+2);else break;if((this.data[i+2]&1)==0){let l=this.data[i+1];t.some((o,a)=>a&1&&o==l)||t.push(this.data[i],l)}}return t}configure(e){let t=Object.assign(Object.create(Id.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let l=e.tokenizers.find(o=>o.from==i);return l?l.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,l)=>{let o=e.specializers.find(u=>u.from==i.external);if(!o)return i;let a=Object.assign(Object.assign({},i),{external:o.to});return t.specializers[l]=P2(a),a})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(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 t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let o of e.split(" ")){let a=t.indexOf(o);a>=0&&(i[a]=!0)}let l=null;for(let o=0;oi)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.scoren.external(t,i)<<1|e}return n.get}const ca=63,H2=64,JB=1,e9=2,fA=3,t9=4,hA=5,n9=6,i9=7,dA=65,r9=66,l9=8,s9=9,o9=10,a9=11,c9=12,mA=13,u9=19,f9=20,h9=29,d9=33,m9=34,p9=47,g9=0,lb=1,Kx=2,Nu=3,Wx=4;class Js{constructor(e,t,i){this.parent=e,this.depth=t,this.type=i,this.hash=(e?e.hash+e.hash<<8:0)+t+(t<<4)+i}}Js.top=new Js(null,-1,g9);function su(n,e){for(let t=0,i=e-n.pos-1;;i--,t++){let l=n.peek(i);if(dl(l)||l==-1)return t}}function Zx(n){return n==32||n==9}function dl(n){return n==10||n==13}function pA(n){return Zx(n)||dl(n)}function no(n){return n<0||pA(n)}const x9=new WB({start:Js.top,reduce(n,e){return n.type==Nu&&(e==f9||e==m9)?n.parent:n},shift(n,e,t,i){if(e==fA)return new Js(n,su(i,i.pos),lb);if(e==dA||e==hA)return new Js(n,su(i,i.pos),Kx);if(e==ca)return n.parent;if(e==u9||e==d9)return new Js(n,0,Nu);if(e==mA&&n.type==Wx)return n.parent;if(e==p9){let l=/[1-9]/.exec(i.read(i.pos,t.pos));if(l)return new Js(n,n.depth+ +l[0],Wx)}return n},hash(n){return n.hash}});function za(n,e,t=0){return n.peek(t)==e&&n.peek(t+1)==e&&n.peek(t+2)==e&&no(n.peek(t+3))}const y9=new hm((n,e)=>{if(n.next==-1&&e.canShift(H2))return n.acceptToken(H2);let t=n.peek(-1);if((dl(t)||t<0)&&e.context.type!=Nu){if(za(n,45))if(e.canShift(ca))n.acceptToken(ca);else return n.acceptToken(JB,3);if(za(n,46))if(e.canShift(ca))n.acceptToken(ca);else return n.acceptToken(e9,3);let i=0;for(;n.next==32;)i++,n.advance();(i{if(e.context.type==Nu){n.next==63&&(n.advance(),no(n.next)&&n.acceptToken(i9));return}if(n.next==45)n.advance(),no(n.next)&&n.acceptToken(e.context.type==lb&&e.context.depth==su(n,n.pos-1)?t9:fA);else if(n.next==63)n.advance(),no(n.next)&&n.acceptToken(e.context.type==Kx&&e.context.depth==su(n,n.pos-1)?n9:hA);else{let t=n.pos;for(;;)if(Zx(n.next)){if(n.pos==t)return;n.advance()}else if(n.next==33)gA(n);else if(n.next==38)Jx(n);else if(n.next==42){Jx(n);break}else if(n.next==39||n.next==34){if(sb(n,!0))break;return}else if(n.next==91||n.next==123){if(!w9(n))return;break}else{xA(n,!0,!1,0);break}for(;Zx(n.next);)n.advance();if(n.next==58){if(n.pos==t&&e.canShift(h9))return;let i=n.peek(1);no(i)&&n.acceptTokenTo(e.context.type==Kx&&e.context.depth==su(n,t)?r9:dA,t)}}},{contextual:!0});function v9(n){return n>32&&n<127&&n!=34&&n!=37&&n!=44&&n!=60&&n!=62&&n!=92&&n!=94&&n!=96&&n!=123&&n!=124&&n!=125}function I2(n){return n>=48&&n<=57||n>=97&&n<=102||n>=65&&n<=70}function U2(n,e){return n.next==37?(n.advance(),I2(n.next)&&n.advance(),I2(n.next)&&n.advance(),!0):v9(n.next)||e&&n.next==44?(n.advance(),!0):!1}function gA(n){if(n.advance(),n.next==60){for(n.advance();;)if(!U2(n,!0)){n.next==62&&n.advance();break}}else for(;U2(n,!1););}function Jx(n){for(n.advance();!no(n.next)&&Ud(n.next)!="f";)n.advance()}function sb(n,e){let t=n.next,i=!1,l=n.pos;for(n.advance();;){let o=n.next;if(o<0)break;if(n.advance(),o==t)if(o==39)if(n.next==39)n.advance();else break;else break;else if(o==92&&t==34)n.next>=0&&n.advance();else if(dl(o)){if(e)return!1;i=!0}else if(e&&n.pos>=l+1024)return!1}return!i}function w9(n){for(let e=[],t=n.pos+1024;;)if(n.next==91||n.next==123)e.push(n.next),n.advance();else if(n.next==39||n.next==34){if(!sb(n,!0))return!1}else if(n.next==93||n.next==125){if(e[e.length-1]!=n.next-2)return!1;if(e.pop(),n.advance(),!e.length)return!0}else{if(n.next<0||n.pos>t||dl(n.next))return!1;n.advance()}}const k9="iiisiiissisfissssssssssssisssiiissssssssssssssssssssssssssfsfssissssssssssssssssssssssssssfif";function Ud(n){return n<33?"u":n>125?"s":k9[n-33]}function M0(n,e){let t=Ud(n);return t!="u"&&!(e&&t=="f")}function xA(n,e,t,i){if(Ud(n.next)=="s"||(n.next==63||n.next==58||n.next==45)&&M0(n.peek(1),t))n.advance();else return!1;let l=n.pos;for(;;){let o=n.next,a=0,u=i+1;for(;pA(o);){if(dl(o)){if(e)return!1;u=0}else u++;o=n.peek(++a)}if(!(o>=0&&(o==58?M0(n.peek(a+1),t):o==35?n.peek(a-1)!=32:M0(o,t)))||!t&&u<=i||u==0&&!t&&(za(n,45,a)||za(n,46,a)))break;if(e&&Ud(o)=="f")return!1;for(let d=a;d>=0;d--)n.advance();if(e&&n.pos>l+1024)return!1}return!0}const S9=new hm((n,e)=>{if(n.next==33)gA(n),n.acceptToken(c9);else if(n.next==38||n.next==42){let t=n.next==38?o9:a9;Jx(n),n.acceptToken(t)}else n.next==39||n.next==34?(sb(n,!1),n.acceptToken(s9)):xA(n,!1,e.context.type==Nu,e.context.depth)&&n.acceptToken(l9)}),C9=new hm((n,e)=>{let t=e.context.type==Wx?e.context.depth:-1,i=n.pos;e:for(;;){let l=0,o=n.next;for(;o==32;)o=n.peek(++l);if(!l&&(za(n,45,l)||za(n,46,l))||!dl(o)&&(t<0&&(t=Math.max(e.context.depth+1,l)),lYAN>Y",stateData:";S~O!fOS!gOS^OS~OP_OQbORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!V[O!cTO~O`cO~P]OVkOWROXROYeOZfO[dOcPOmhOqQO~OboO~P!bOVtOWROXROYeOZfO[dOcPOmrOqQO~OpwO~P#WORSOTUOWROXROYYOZZO[XOcPOqQO!PVO!cTO~OSvP!avP!bvP~P#|OWROXROYeOZfO[dOcPOqQO~OmzO~P%OOm!OOUzP!azP!bzP!dzP~P#|O^!SO!b!QO!f!TO!g!RO~ORSOTUOWROXROcPOqQO!PVO!cTO~OY!UOP!QXQ!QX!V!QX!`!QXS!QX!a!QX!b!QXU!QXm!QX!d!QX~P&aO[!WOP!SXQ!SX!V!SX!`!SXS!SX!a!SX!b!SXU!SXm!SX!d!SX~P&aO^!ZO!W![O!b!YO!f!]O!g!YO~OP!_O!V[OQaX!`aX~OPaXQaX!VaX!`aX~P#|OP!bOQ!cO!V[O~OP_O!V[O~P#|OWROXROY!fOcPOqQObfXmfXofXpfX~OWROXRO[!hOcPOqQObhXmhXohXphX~ObeXmlXoeX~ObkXokX~P%OOm!kO~Om!lObnPonP~P%OOb!pOo!oO~Ob!pO~P!bOm!sOosXpsX~OosXpsX~P%OOm!uOotPptP~P%OOo!xOp!yO~Op!yO~P#WOS!|O!a#OO!b#OO~OUyX!ayX!byX!dyX~P#|Om#QO~OU#SO!a#UO!b#UO!d#RO~Om#WOUzX!azX!bzX!dzX~O]#XO~O!b#XO!g#YO~O^#ZO!b#XO!g#YO~OP!RXQ!RX!V!RX!`!RXS!RX!a!RX!b!RXU!RXm!RX!d!RX~P&aOP!TXQ!TX!V!TX!`!TXS!TX!a!TX!b!TXU!TXm!TX!d!TX~P&aO!b#^O!g#^O~O^#_O!b#^O!f#`O!g#^O~O^#_O!W#aO!b#^O!g#^O~OPaaQaa!Vaa!`aa~P#|OP#cO!V[OQ!XX!`!XX~OP!XXQ!XX!V!XX!`!XX~P#|OP_O!V[OQ!_X!`!_X~P#|OWROXROcPOqQObgXmgXogXpgX~OWROXROcPOqQObiXmiXoiXpiX~Obkaoka~P%OObnXonX~P%OOm#kO~Ob#lOo!oO~Oosapsa~P%OOotXptX~P%OOm#pO~Oo!xOp#qO~OSwP!awP!bwP~P#|OS!|O!a#vO!b#vO~OUya!aya!bya!dya~P#|Om#xO~P%OOm#{OU}P!a}P!b}P!d}P~P#|OU#SO!a$OO!b$OO!d#RO~O]$QO~O!b$QO!g$RO~O!b$SO!g$SO~O^$TO!b$SO!g$SO~O^$TO!b$SO!f$UO!g$SO~OP!XaQ!Xa!V!Xa!`!Xa~P#|Obnaona~P%OOotapta~P%OOo!xO~OU|X!a|X!b|X!d|X~P#|Om$ZO~Om$]OU}X!a}X!b}X!d}X~O]$^O~O!b$_O!g$_O~O^$`O!b$_O!g$_O~OU|a!a|a!b|a!d|a~P#|O!b$cO!g$cO~O",goto:",]!mPPPPPPPPPPPPPPPPP!nPP!v#v#|$`#|$c$f$j$nP%VPPP!v%Y%^%a%{&O%a&R&U&X&_&b%aP&e&{&e'O'RPP']'a'g'm's'y(XPPPPPPPP(_)e*X+c,VUaObcR#e!c!{ROPQSTUXY_bcdehknrtvz!O!U!W!_!b!c!f!h!k!l!s!u!|#Q#R#S#W#c#k#p#x#{$Z$]QmPR!qnqfPQThknrtv!k!l!s!u#R#k#pR!gdR!ieTlPnTjPnSiPnSqQvQ{TQ!mkQ!trQ!vtR#y#RR!nkTsQvR!wt!RWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]RySR#t!|R|TR|UQ!PUR#|#SR#z#RR#z#SyZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]R!VXR!XYa]O^abc!a!c!eT!da!eQnPR!rnQvQR!{vQ!}yR#u!}Q#T|R#}#TW^Obc!cS!^^!aT!aa!eQ!eaR#f!eW`Obc!cQxSS}U#SQ!`_Q#PzQ#V!OQ#b!_Q#d!bQ#s!|Q#w#QQ$P#WQ$V#cQ$Y#xQ$[#{Q$a$ZR$b$]xZOSU_bcz!O!_!b!c!|#Q#S#W#c#x#{$Z$]Q!VXQ!XYQ#[!UR#]!W!QWOSUXY_bcz!O!U!W!_!b!c!|#Q#S#W#c#x#{$Z$]pfPQThknrtv!k!l!s!u#R#k#pQ!gdQ!ieQ#g!fR#h!hSgPn^pQTkrtv#RQ!jhQ#i!kQ#j!lQ#n!sQ#o!uQ$W#kR$X#pQuQR!zv",nodeNames:"⚠ DirectiveEnd DocEnd - - ? ? ? Literal QuotedLiteral Anchor Alias Tag BlockLiteralContent Comment Stream BOM Document ] [ FlowSequence Item Tagged Anchored Anchored Tagged FlowMapping Pair Key : Pair , } { FlowMapping Pair Pair BlockSequence Item Item BlockMapping Pair Pair Key Pair Pair BlockLiteral BlockLiteralHeader Tagged Anchored Anchored Tagged Directive DirectiveName DirectiveContent Document",maxTerm:74,context:x9,nodeProps:[["isolate",-3,8,9,14,""],["openedBy",18,"[",32,"{"],["closedBy",19,"]",33,"}"]],propSources:[O9],skippedNodes:[0],repeatNodeCount:6,tokenData:"-Y~RnOX#PXY$QYZ$]Z]#P]^$]^p#Ppq$Qqs#Pst$btu#Puv$yv|#P|}&e}![#P![!]'O!]!`#P!`!a'i!a!}#P!}#O*g#O#P#P#P#Q+Q#Q#o#P#o#p+k#p#q'i#q#r,U#r;'S#P;'S;=`#z<%l?HT#P?HT?HU,o?HUO#PQ#UU!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PQ#kTOY#PZs#Pt;'S#P;'S;=`#z<%lO#PQ#}P;=`<%l#P~$VQ!f~XY$Qpq$Q~$bO!g~~$gS^~OY$bZ;'S$b;'S;=`$s<%lO$b~$vP;=`<%l$bR%OX!WQOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR%rX!WQ!VPOX%kXY#PZ]%k]^#P^p%kpq#hq;'S%k;'S;=`&_<%lO%kR&bP;=`<%l%kR&lUoP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'VUmP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR'p[!PP!WQOY#PZp#Ppq#hq{#P{|(f|}#P}!O(f!O!R#P!R![)p![;'S#P;'S;=`#z<%lO#PR(mW!PP!WQOY#PZp#Ppq#hq!R#P!R![)V![;'S#P;'S;=`#z<%lO#PR)^U!PP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR)wY!PP!WQOY#PZp#Ppq#hq{#P{|)V|}#P}!O)V!O;'S#P;'S;=`#z<%lO#PR*nUcP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+XUbP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR+rUqP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,]UpP!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#PR,vU`P!WQOY#PZp#Ppq#hq;'S#P;'S;=`#z<%lO#P",tokenizers:[y9,b9,S9,C9,0,1],topRules:{Stream:[0,15]},tokenPrec:0}),T9=Od.define({name:"yaml",parser:N9.configure({props:[GN.add({Stream:n=>{for(let e=n.node.resolve(n.pos,-1);e&&e.to>=n.pos;e=e.parent){if(e.name=="BlockLiteralContent"&&e.fromn.pos)return null}}return null},FlowMapping:n2({closing:"}"}),FlowSequence:n2({closing:"]"})}),ZN.add({"FlowMapping FlowSequence":SL,"Item Pair BlockLiteral":(n,e)=>({from:e.doc.lineAt(n.from).to,to:n.to})})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*[\]\}]$/}});function A9(){return new hL(T9)}const F2='button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), a[href], video[tabindex], [tabindex]:not([tabindex="-1"])';function ms({isOpen:n,onClose:e,dialogRef:t,initialFocusRef:i}){return E.useEffect(()=>{if(!n)return;const l=document.activeElement instanceof HTMLElement?document.activeElement:null,o=requestAnimationFrame(()=>{var f;const u=(i==null?void 0:i.current)??((f=t.current)==null?void 0:f.querySelector(F2))??t.current;u==null||u.focus()}),a=u=>{if(u.key!=="Tab")return;const f=t.current;if(!f)return;const d=Array.from(f.querySelectorAll(F2));if(!d.length)return;const m=d[0],g=d[d.length-1],b=document.activeElement;if(!(b instanceof Node&&f.contains(b))){u.preventDefault(),(u.shiftKey?g:m).focus();return}u.shiftKey&&(b===m||b===f)?(u.preventDefault(),g.focus()):!u.shiftKey&&(b===g||b===f)&&(u.preventDefault(),m.focus())};return window.addEventListener("keydown",a,!0),()=>{cancelAnimationFrame(o),l==null||l.focus(),window.removeEventListener("keydown",a,!0)}},[n]),l=>{l.key==="Escape"&&(l.preventDefault(),l.stopPropagation(),e())}}function io({isOpen:n,title:e,message:t,confirmLabel:i="Confirm",cancelLabel:l="Cancel",danger:o=!1,onConfirm:a,onCancel:u}){const f=E.useRef(null),d=E.useRef(null),m=ms({isOpen:n,onClose:u,dialogRef:f,initialFocusRef:d});return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",onClick:u,children:y.jsxs("div",{ref:f,role:"dialog","aria-modal":"true","aria-labelledby":"confirm-dialog-title",onKeyDown:m,onClick:g=>g.stopPropagation(),className:"animate-modal-in w-[400px] max-w-full rounded-2xl border border-frame-line glass-panel p-5",children:[y.jsxs("div",{className:"mb-3 flex items-center gap-2.5",children:[y.jsx("span",{className:`grid h-9 w-9 shrink-0 place-items-center rounded-lg ${o?"bg-status-danger-bg text-status-danger-text":"bg-chip-indigo-bg text-chip-indigo-text"}`,children:y.jsx(wy,{className:"h-5 w-5"})}),y.jsx("h2",{id:"confirm-dialog-title",className:"text-sm font-semibold text-ink",children:e})]}),y.jsx("div",{className:"mb-5 whitespace-pre-line text-xs text-ink-secondary",children:t}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx("button",{ref:d,type:"button",onClick:u,className:"min-h-9 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:l}),y.jsx("button",{type:"button",onClick:a,className:`min-h-9 rounded-lg border px-4 text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400 ${o?"border-status-danger-border bg-status-danger-bg/30 text-status-danger-text hover:bg-status-danger-bg/60":"btn-primary border-transparent bg-indigo-600 text-white hover:bg-indigo-500"}`,children:i})]})]})}):null}var E9=KC();const Dr=8,es=8,M9=400,q2={top:"bottom",bottom:"top",left:"right",right:"left"},D9={top:"-bottom-1 left-1/2 -translate-x-1/2",bottom:"-top-1 left-1/2 -translate-x-1/2",left:"-right-1 top-1/2 -translate-y-1/2",right:"-left-1 top-1/2 -translate-y-1/2"},R9={top:"border-b border-r",bottom:"border-t border-l",left:"border-t border-r",right:"border-b border-l"},V2=(n,e,t)=>{switch(n){case"top":return e.top-es-t.h>=Dr;case"bottom":return e.bottom+es+t.h<=window.innerHeight-Dr;case"left":return e.left-es-t.w>=Dr;default:return e.right+es+t.w<=window.innerWidth-Dr}},j9=(n,e,t)=>{if(n==="top"||n==="bottom"){const a=e.left+e.width/2-t.w/2,u=window.innerWidth-t.w-Dr;return{x:Math.min(Math.max(a,Dr),Math.max(Dr,u))-a,y:0}}const i=e.top+e.height/2-t.h/2,l=window.innerHeight-t.h-Dr;return{x:0,y:Math.min(Math.max(i,Dr),Math.max(Dr,l))-i}},Xe=({text:n,children:e,block:t=!0,placement:i="top",suppress:l=!1})=>{const o=E.useRef(null),a=E.useRef(null),u=E.useId(),f=E.useRef(null),[d,m]=E.useState(!1),[g,b]=E.useState(i),[v,w]=E.useState({x:0,y:0}),[S,C]=E.useState({left:-9999,top:-9999}),N=()=>{f.current!==null&&(window.clearTimeout(f.current),f.current=null)};E.useEffect(()=>{l&&(N(),m(!1))},[l]),E.useEffect(()=>()=>N(),[]);const j=E.useCallback(()=>{const M=o.current,A=a.current;if(!M||!A)return;const L=M.getBoundingClientRect(),ne={w:A.offsetWidth,h:A.offsetHeight},F=V2(i,L,ne)?i:V2(q2[i],L,ne)?q2[i]:i,W=j9(F,L,ne);b(F),w(W);const I=L.left+L.width/2,re=L.top+L.height/2;C(F==="top"?{left:I,top:L.top-es-ne.h}:F==="bottom"?{left:I,top:L.bottom+es}:F==="left"?{left:L.left-es-ne.w,top:re}:{left:L.right+es,top:re})},[i]);E.useEffect(()=>{if(!d)return;const M=()=>m(!1);return window.addEventListener("resize",M),window.addEventListener("scroll",M,!0),()=>{window.removeEventListener("resize",M),window.removeEventListener("scroll",M,!0)}},[d]);const D=M=>{if(l)return;N();const A=()=>{j(),m(!0)};M?A():f.current=window.setTimeout(A,M9)},U=()=>{N(),m(!1)};E.useEffect(()=>{if(!d)return;const M=A=>{A.key==="Escape"&&m(!1)};return document.addEventListener("keydown",M,!0),()=>document.removeEventListener("keydown",M,!0)},[d]),E.useEffect(()=>{if(!d)return;const M=()=>!!document.querySelector('[role="dialog"][aria-modal="true"], dialog[open]');if(M()){m(!1);return}const A=new MutationObserver(()=>{M()&&m(!1)});return A.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["role","aria-modal","open","class"]}),()=>A.disconnect()},[d]);const H={onMouseEnter:()=>D(!1),onMouseLeave:U,onFocus:()=>D(!0),onBlur:U,"aria-describedby":u};return y.jsxs("div",{ref:o,className:`group relative ${t?"flex min-w-0 flex-1 items-center":"inline-flex shrink-0 items-center"}`,onMouseEnter:()=>D(!1),onMouseLeave:U,onFocus:()=>D(!0),onBlur:U,children:[E.cloneElement(e,H),E9.createPortal(y.jsxs("span",{ref:a,id:u,role:"tooltip",className:`pointer-events-none invisible fixed z-[var(--z-tooltip)] w-max max-w-[calc(100vw-16px)] rounded-md border border-line bg-elevated px-2 py-1 text-left text-[11px] leading-relaxed text-ink shadow-lg ${d?"visible opacity-100":"opacity-0"}`,style:{left:S.left,top:S.top,transform:g==="top"||g==="bottom"?`translateX(calc(-50% + ${v.x}px))`:`translateY(calc(-50% + ${v.y}px))`},children:[n,y.jsx("span",{className:`absolute h-2 w-2 rotate-45 border-line bg-elevated ${D9[g]} ${R9[g]}`,style:g==="top"||g==="bottom"?{left:`calc(50% - ${v.x}px)`}:void 0})]}),document.body)]})},_9=[".profiles",".profiles.yaml"];function L9(n){const e=n.trim();if(!e)return null;const t=e.toLowerCase(),i=_9.find(l=>t.endsWith(l));if(i!==void 0){const l=e.slice(0,e.length-i.length);return!l.trim()||l!==l.trimEnd()?null:e}return t.includes(".")?null:`${e}.profiles`}function z9({open:n,onCancel:e,onConfirm:t}){const[i,l]=E.useState(null),[o,a]=E.useState(""),[u,f]=E.useState(""),[d,m]=E.useState(null),[g,b]=E.useState(!1),[v,w]=E.useState(null),[S,C]=E.useState(null),N=E.useRef(null),j=E.useRef(null),D=E.useRef(null),U=E.useCallback(async L=>{b(!0),w(null);try{const ne=await ZC(L);l(ne),a(ne.current_path)}catch(ne){w(ne instanceof Error?ne.message:String(ne))}finally{b(!1)}},[]);E.useEffect(()=>{if(!n)return;f(""),m(null),C(null),U(o);const L=requestAnimationFrame(()=>{var ne;return(ne=j.current)==null?void 0:ne.focus()});return()=>cancelAnimationFrame(L)},[n]);const H=ms({isOpen:n,onClose:e,dialogRef:N,initialFocusRef:j});function M(){if(!i)return;const L=L9(u);if(L===null){m("Not a ProFiles configuration file. Allowed extensions: .profiles, .profiles.yaml");return}m(null);const ne=o.trim()||i.current_path;if(o.trim()===i.current_path&&i.items.some(I=>!I.is_dir&&I.name===L)){C({filename:L,directory:ne});return}t({filename:L,directory:ne,overwrite:!1})}if(!n)return null;const A=(i==null?void 0:i.items.filter(L=>L.is_dir))??[];return y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-4 backdrop-blur-sm",onClick:e,children:y.jsxs("div",{ref:N,role:"dialog","aria-modal":"true","aria-labelledby":"save-as-dialog-title",onKeyDown:H,onClick:L=>L.stopPropagation(),className:"animate-modal-in flex max-h-[calc(100dvh-2rem)] w-[min(94vw,560px)] flex-col overflow-hidden rounded-xl border border-frame-line glass-panel sm:rounded-2xl",children:[y.jsx("div",{className:"flex shrink-0 items-center justify-between gap-3 border-b border-line px-5 py-3",children:y.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx("span",{className:"grid h-8 w-8 shrink-0 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(sO,{className:"h-4 w-4 text-chip-indigo-text"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"save-as-dialog-title",className:"text-sm font-semibold text-ink",children:"Save configuration as"}),y.jsx("p",{className:"truncate font-mono text-xs text-ink-muted",children:(i==null?void 0:i.current_path)||"…"})]})]})}),y.jsxs("div",{className:"border-b border-line px-5 py-3",children:[y.jsx("label",{htmlFor:"save-as-path",className:"mb-1.5 block text-xs font-medium text-ink-secondary",children:"Location"}),y.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[y.jsx("input",{ref:D,id:"save-as-path",type:"text",value:o,onChange:L=>a(L.target.value),onKeyDown:L=>{L.key==="Enter"&&U(o.trim())},placeholder:"/path/to/directory",className:"h-9 min-w-0 flex-1 rounded-lg border border-line bg-elevated px-2.5 font-mono text-sm text-ink outline-none placeholder:text-ink-faint transition-colors hover:bg-surface-strong focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-indigo-500/30"}),y.jsx("button",{type:"button",onClick:()=>void U(o.trim()),className:"inline-flex h-9 shrink-0 items-center rounded-lg border border-line bg-elevated px-3 text-sm font-medium text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Go"}),y.jsx(Xe,{text:"Home directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>void U(""),"aria-label":"Home directory",className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Gd,{className:"h-4 w-4"})})}),(i==null?void 0:i.parent_path)&&y.jsx(Xe,{text:"Parent directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>void U(i.parent_path),"aria-label":"Parent directory",className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Yd,{className:"h-4 w-4 rotate-180"})})})]})]}),y.jsx("div",{className:"min-h-24 flex-1 overflow-y-auto px-2 py-2 sm:px-3","aria-busy":g,children:g?y.jsxs("div",{className:"flex h-full items-center justify-center gap-2.5 text-sm text-ink-muted",children:[y.jsx(ul,{className:"h-5 w-5 animate-spin text-chip-indigo-text"}),y.jsx("span",{role:"status",children:"Loading directories…"})]}):v?y.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-2.5 text-center",children:[y.jsx("p",{className:"text-sm text-status-danger-text",children:v}),y.jsx("button",{type:"button",onClick:()=>void U(o||(i==null?void 0:i.current_path)||""),className:"min-h-9 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Retry"})]}):y.jsxs("ul",{className:"space-y-0.5",children:[A.map(L=>y.jsx("li",{children:y.jsxs("button",{type:"button",onClick:()=>void U(L.path),className:"flex min-h-9 w-full items-center gap-2.5 rounded-lg px-3 py-1.5 text-left text-sm text-ink-secondary transition-colors hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-400",children:[y.jsx(Au,{className:"h-4 w-4 shrink-0 text-chip-indigo-text"}),y.jsx("span",{className:"truncate",children:L.name})]})},L.path)),A.length===0&&y.jsxs("li",{className:"flex min-h-16 flex-col items-center justify-center gap-2 text-center text-sm text-ink-muted",children:[y.jsx(ts,{className:"h-6 w-6 text-ink-faint"}),"No subdirectories found"]})]})}),y.jsxs("div",{className:"shrink-0 border-t border-line px-5 py-3",children:[y.jsx("label",{htmlFor:"save-as-filename",className:"mb-1.5 block text-xs font-medium text-ink-secondary",children:"File name"}),y.jsx("input",{ref:j,id:"save-as-filename",type:"text",value:u,onChange:L=>{f(L.target.value),m(null)},onKeyDown:L=>{L.key==="Enter"&&u.trim()&&M()},placeholder:"machine.profiles",className:"h-9 w-full rounded-lg border border-line bg-elevated px-2.5 font-mono text-sm text-ink outline-none placeholder:text-ink-faint transition-colors hover:bg-surface-strong focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-indigo-500/30"}),d&&y.jsx("p",{role:"alert","data-testid":"save-as-error",className:"mt-1.5 text-xs text-status-danger-text",children:d}),y.jsxs("div",{className:"mt-3 flex justify-end gap-1.5",children:[y.jsx("button",{type:"button",onClick:e,className:"min-h-9 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Cancel"}),y.jsxs("button",{type:"button",onClick:M,disabled:!u.trim()||!i||g,title:"Save the configuration to the selected folder",className:"btn btn-primary min-h-9 rounded-lg px-4 text-sm font-semibold",children:[y.jsx(Pr,{className:"h-4 w-4"}),"Save"]})]})]})]})}),y.jsx(io,{isOpen:S!==null,title:"Replace configuration?",message:`A configuration named "${S==null?void 0:S.filename}" already exists in this folder. +Saving will replace it.`,confirmLabel:"Replace",cancelLabel:"Keep existing",danger:!0,onConfirm:()=>{const L=S;C(null),L&&t({...L,overwrite:!0})},onCancel:()=>C(null)})]})}const B9=800,P9=Ee.theme({"&":{height:"100%",fontSize:"12.5px",color:"var(--app-text-primary)",backgroundColor:"var(--app-editor-bg)"},".cm-scroller":{fontFamily:"'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",lineHeight:"1.6"},".cm-content":{caretColor:"var(--color-indigo-500, #6366f1)"},".cm-cursor, .cm-dropCursor":{borderLeftColor:"var(--color-indigo-500, #6366f1)"},"&.cm-focused":{outline:"none"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground":{backgroundColor:"var(--app-editor-selection)"},".cm-activeLine":{backgroundColor:"var(--app-editor-active-line)"},".cm-matchingBracket":{color:"inherit",backgroundColor:"var(--app-editor-selection)",outline:"1px solid var(--app-editor-border)"},".cm-nonmatchingBracket":{color:"inherit",outline:"1px solid var(--status-danger-border, #fb7185)"},".cm-gutters":{backgroundColor:"var(--app-editor-gutter-bg)",color:"var(--app-text-faint)",border:"none",borderRight:"1px solid var(--app-editor-border)"},".cm-activeLineGutter":{backgroundColor:"var(--app-editor-active-line)",color:"var(--app-text-secondary)"},".cm-panels":{backgroundColor:"var(--app-editor-bg)",color:"var(--app-text-primary)"},".cm-tooltip":{border:"1px solid var(--app-border)",backgroundColor:"var(--app-glass-panel-strong)",color:"var(--app-text-primary)"}}),H9=ju.define([{tag:me.lineComment,color:"var(--app-editor-syntax-comment)"},{tag:[me.propertyName,me.definition(me.propertyName)],color:"var(--app-editor-syntax-key)"},{tag:[me.string,me.special(me.string)],color:"var(--app-editor-syntax-string)"},{tag:me.content,color:"var(--app-editor-syntax-string)"},{tag:[me.keyword,me.typeName],color:"var(--app-editor-syntax-keyword)"},{tag:me.labelName,color:"var(--app-editor-syntax-label)"}]);function D0(n){return n.replace(/\r\n?/g,` +`)}function Ih(n,e){return n!==null&&n.state.doc.toString()!==e}function I9(n){return n instanceof yy&&Array.isArray(n.detail)?{text:n.message,issues:n.detail}:{text:n instanceof Error?n.message:String(n),issues:[]}}function U9({open:n,onClose:e,onApplied:t,onLoadConfig:i,reloadKey:l=0}){const[o,a]=E.useState({status:"loading"}),[u,f]=E.useState(!1),[d,m]=E.useState(!1),[g,b]=E.useState(null),[v,w]=E.useState([]),[S,C]=E.useState({kind:"unknown"}),[N,j]=E.useState(!1),[D,U]=E.useState({line:1,col:1}),[H,M]=E.useState(null),[A,L]=E.useState(null),[ne,F]=E.useState(null),[W,I]=E.useState(null),re=E.useRef(null),pe=E.useRef(null),ce=E.useRef(null),Z=E.useRef(null),oe=E.useRef(""),K=E.useRef(null),G=E.useRef(0),T=E.useRef(new Map),de=E.useRef(null),be=E.useRef(null),z=E.useRef(!1),R=E.useRef(()=>{}),Q=E.useRef(()=>{});z.current=A!==null||ne!==null||W!==null;const he=ms({isOpen:n,onClose:Te,dialogRef:re});E.useEffect(()=>{if(!n){oe.current="",K.current=null,ce.current=null,a({status:"loading"}),f(!1),m(!1),b(null),w([]),C({kind:"unknown"}),j(!1),U({line:1,col:1}),M(null),L(null),F(null),I(null),de.current!==null&&(clearTimeout(de.current),de.current=null),be.current=null,G.current+=1,T.current.clear();return}let ue=!1;return Hk().then(ye=>{if(ue)return;const De=D0(ye.content);oe.current=De,K.current=ye.content_hash??null,be.current=De,a({status:"ready",data:{...ye,content:De}})}).catch(ye=>{ue||(oe.current="",a({status:"error",message:ye instanceof Error?ye.message:String(ye)}))}),()=>{ue=!0}},[n,l]);const ge=E.useCallback(()=>{de.current!==null&&(clearTimeout(de.current),de.current=null)},[]),ze=E.useCallback(ue=>{z.current||ue!==be.current&&(ge(),de.current=window.setTimeout(()=>{if(de.current=null,T.current.has("test")){Q.current(ue);return}R.current()},B9))},[ge]);E.useEffect(()=>{if(!n||o.status!=="ready")return;const ue=pe.current;if(!ue)return;const ye=new Ee({doc:o.data.content,extensions:[FB,A9(),oT(H9),P9,Ee.updateListener.of(De=>{if(De.selectionSet||De.docChanged){const at=De.state.selection.main.head,vt=De.state.doc.lineAt(at);U({line:vt.number,col:at-vt.from+1})}De.docChanged&&(f(Ih(De.view,oe.current)),b(null),w([]),C({kind:"unknown"}),j(!1),ze(De.state.doc.toString()))})],parent:ue});return ce.current=ye,()=>{ye.destroy(),ce.current=null,ge()}},[n,o]);function Te(){if(Ih(ce.current,oe.current)){m(!0);return}e()}const He=E.useCallback(()=>{DM().catch(ue=>{console.error("Failed to open config file in OS editor:",ue)})},[]);function ke(){var ue;return((ue=ce.current)==null?void 0:ue.state.doc.toString())??oe.current}const Ae=E.useCallback(async(ue,ye)=>{if(T.current.has(ue))return;const De=++G.current;T.current.set(ue,De);try{await ye(De)}finally{T.current.get(ue)===De&&T.current.delete(ue)}},[]),Qt=E.useCallback(()=>Ae("new",async ue=>{b(null),w([]);try{const ye=await TM();if(ue!==G.current)return;const De=D0(ye.content);oe.current=De,K.current=null,f(!1),a(at=>at.status==="ready"?{status:"ready",data:{...at.data,filename:ye.filename,content:De,config_path:null}}:at),b({kind:"ok",text:"New configuration template loaded."})}catch(ye){if(ue!==G.current)return;b({kind:"error",text:ye instanceof Error?ye.message:String(ye)})}}),[Ae]),Ft=E.useCallback(()=>Ae("revert",async ue=>{b(null),w([]);try{const ye=await Hk();if(ue!==G.current)return;const De=D0(ye.content);oe.current=De,K.current=ye.content_hash??null,f(!1),a({status:"ready",data:{...ye,content:De}}),b({kind:"ok",text:"Configuration reloaded from disk."})}catch(ye){if(ue!==G.current)return;b({kind:"error",text:ye instanceof Error?ye.message:String(ye)})}}),[Ae]);function xn(){if(Ih(ce.current,oe.current)){M("new");return}Qt()}function Ht(){if(Ih(ce.current,oe.current)){M("revert");return}Ft()}const Ot=E.useCallback(()=>Ae("test",async ue=>{if(o.status!=="ready")return;ge();const ye=ke();be.current=ye,C({kind:"validating"});try{const De=await Ik(o.data.filename,ye);if(ue!==G.current)return;w(De.issues),De.valid?(C({kind:"valid"}),b({kind:"ok",text:"Configuration is valid."})):(C({kind:"invalid",count:De.issues.length}),j(!0),b({kind:"error",text:`Validation failed with ${De.issues.length} issue${De.issues.length===1?"":"s"}.`}))}catch(De){if(ue!==G.current)return;w([]),C({kind:"unknown"}),b({kind:"error",text:De instanceof Error?De.message:String(De)})}}),[o,Ae]);R.current=()=>void Ot(),Q.current=ze;const lt=E.useCallback(()=>Ae("apply",async ue=>{if(o.status==="ready")try{const ye=await WC(o.data.filename,ke());if(ue!==G.current)return;b({kind:"ok",text:"Configuration applied (session trial)."}),t==null||t(ye)}catch(ye){if(ue!==G.current)return;b({kind:"error",text:ye instanceof Error?ye.message:String(ye)})}}),[o,t,Ae]),tn=E.useCallback(ue=>new Promise(ye=>{L({issues:ue,resolve:De=>{L(null),ye(De)}})}),[]),Hn=E.useCallback(()=>new Promise(ue=>{F({resolve:ye=>{F(null),ue(ye)}})}),[]),qt=E.useCallback(()=>new Promise(ue=>{I({resolve:ye=>{I(null),ue(ye)}})}),[]),Kt=E.useCallback((ue,ye,De)=>{if(oe.current=ye,K.current=De,f(!1),w([]),C({kind:"unknown"}),L(null),F(null),ue.config_path){const at=ue.config_path.split(/[\\/]/).pop()||ue.title||"configuration";a(vt=>vt.status!=="ready"||!(vt.data.filename!==at||vt.data.config_path!==ue.config_path||vt.data.session_trial)?vt:{status:"ready",data:{...vt.data,filename:at,config_path:ue.config_path,session_trial:!1,content:ye}})}t==null||t(ue)},[t]),Oe=E.useCallback(ue=>{const ye=I9(ue);L(null),F(null),w(ye.issues),ye.issues.length>0?(C({kind:"invalid",count:ye.issues.length}),j(!0)):C({kind:"unknown"}),b({kind:"error",text:ye.text})},[]),qe=E.useCallback((ue,ye)=>Ae(ue,async De=>{if(o.status!=="ready")return;const at=ke();b(null),w([]),C({kind:"validating"});try{const vt=await Ik(ye,at);if(De!==G.current)return;let On=!1;if(vt.valid)C({kind:"valid"});else{if(C({kind:"invalid",count:vt.issues.length}),w(vt.issues),j(!0),On=await tn(vt.issues),De!==G.current)return;if(!On){b({kind:"error",text:"Save cancelled — fix the listed issues, or force-save anyway."});return}}if(ue==="save-as"){const Nn=await Hn();if(De!==G.current||Nn===null)return;const Et=await AM({content:at,filename:Nn.filename,directory:Nn.directory,force:On,overwrite:Nn.overwrite});if(De!==G.current)return;Kt(Et.config,at,Et.contentHash),b({kind:"ok",text:`Configuration saved as ${Nn.filename}.`})}else{let Nn;try{Nn=await Uk(at,On,{baselineHash:K.current})}catch(Et){if(!(Et instanceof yy)||Et.status!==409)throw Et;const Wt=await qt();if(De!==G.current)return;if(!Wt){Ft();return}Nn=await Uk(at,On,{baselineHash:K.current,overwriteChanges:!0})}if(De!==G.current)return;Kt(Nn.config,at,Nn.contentHash),b({kind:"ok",text:`Configuration saved to ${ye}.`})}}catch(vt){if(De!==G.current)return;Oe(vt)}}),[tn,Hn,qt,o,Kt,Oe,Ft,Ae]),$e=E.useCallback(()=>qe("save",o.status==="ready"?o.data.filename:""),[o,qe]),ht=E.useCallback(()=>qe("save-as",o.status==="ready"?o.data.filename:""),[o,qe]),te=E.useRef(()=>{});if(te.current=()=>{o.status==="ready"&&(A!==null||ne!==null||W!==null||d||H!==null||(o.data.config_path!==null?$e():lt()))},E.useEffect(()=>{if(!n)return;const ue=ye=>{(ye.metaKey||ye.ctrlKey)&&!ye.altKey&&!ye.shiftKey&&ye.key.toLowerCase()==="s"&&(ye.preventDefault(),ye.stopPropagation(),te.current())};return window.addEventListener("keydown",ue,!0),()=>window.removeEventListener("keydown",ue,!0)},[n]),!n)return null;const fe=o.status==="ready"?o.data.filename:"",_e=o.status==="ready"?o.data.session_trial:!1,Be=o.status!=="ready",bt=o.status==="ready"&&o.data.config_path!==null;return y.jsxs(y.Fragment,{children:[y.jsx("div",{ref:re,role:"dialog","aria-modal":"true","aria-labelledby":"config-editor-title",onKeyDown:he,onMouseDown:ue=>{Z.current=ue.target===ue.currentTarget?{x:ue.clientX,y:ue.clientY}:null},onClick:ue=>{const ye=Z.current;Z.current=null,!(!ye||ue.target!==ue.currentTarget)&&Te()},className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-3 backdrop-blur-sm sm:p-6",children:y.jsxs("div",{className:"animate-modal-in flex h-[90vh] w-full max-w-6xl flex-col overflow-hidden rounded-xl border border-frame-line glass-panel",onClick:ue=>ue.stopPropagation(),children:[y.jsxs("div",{"data-testid":"editor-header",className:"flex shrink-0 items-center justify-between gap-3 border-b border-line px-5 py-3",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-chip-indigo-bg text-chip-indigo-text",children:y.jsx(R4,{className:"h-4 w-4"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"config-editor-title",className:"text-sm font-semibold text-ink",children:"Configuration Editor"}),y.jsxs("p",{className:"truncate text-xs text-ink-muted",children:[fe||"…",_e?" • session trial (not anchored to disk)":""]})]})]}),y.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[y.jsxs("button",{type:"button",onClick:xn,disabled:Be,title:"Load the starter configuration template",className:"btn btn-secondary px-2.5 py-1.5",children:[y.jsx(z4,{className:"h-3.5 w-3.5"}),"New"]}),y.jsxs("button",{type:"button",onClick:()=>void Ot(),disabled:Be,title:"Validate the editor content in memory",className:"btn btn-secondary px-2.5 py-1.5",children:[y.jsx(I4,{className:"h-3.5 w-3.5"}),"Test"]}),y.jsxs("button",{type:"button",onClick:Ht,disabled:Be,title:"Discard edits and reload the file from disk",className:"btn btn-secondary px-2.5 py-1.5",children:[y.jsx(hD,{className:"h-3.5 w-3.5"}),"Revert"]}),bt&&y.jsxs("button",{type:"button",onClick:()=>void $e(),disabled:Be,title:"Save to the configuration file on disk (Ctrl/Cmd+S)",className:"btn btn-secondary px-2.5 py-1.5",children:[y.jsx(sO,{className:"h-3.5 w-3.5"}),"Save"]}),y.jsxs("button",{type:"button",onClick:()=>void ht(),disabled:Be,title:"Save the configuration to a new file — also anchors a session trial onto disk",className:"btn btn-secondary px-2.5 py-1.5",children:[y.jsx(mD,{className:"h-3.5 w-3.5"}),"Save As"]}),y.jsxs("button",{type:"button",onClick:()=>void lt(),disabled:Be,title:"Trial the editor content as the session configuration",className:"btn btn-primary px-2.5 py-1.5 font-semibold",children:[y.jsx(is,{className:"h-3.5 w-3.5"}),"Apply"]}),i&&y.jsxs("button",{type:"button",onClick:i,title:"Load a different .profiles file",className:"btn btn-secondary px-2.5 py-1.5",children:[y.jsx(fa,{className:"h-3.5 w-3.5"}),"Load config file…"]}),bt&&y.jsxs("button",{type:"button",onClick:He,title:"Open the configuration file with the OS default editor",className:"btn inline-flex items-center gap-1.5 rounded-md border border-line bg-surface px-2.5 py-1.5 text-xs font-medium text-ink-secondary hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:[y.jsx(rO,{className:"h-3.5 w-3.5"}),"Open in OS"]}),y.jsx("button",{type:"button",onClick:Te,"aria-label":"Close editor",className:"rounded-md p-1.5 text-ink-muted hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:y.jsx(Li,{className:"h-4 w-4"})})]})]}),y.jsxs("div",{className:"flex min-h-0 flex-1 gap-2 p-3 sm:p-4",children:[y.jsx("div",{"data-testid":"editor-card",className:"min-w-0 flex-1 overflow-hidden rounded-lg border border-[var(--app-editor-border)] bg-[var(--app-editor-bg)]",children:o.status==="loading"?y.jsx("div",{className:"flex h-full items-center justify-center",children:y.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent"})}):o.status==="error"?y.jsx("div",{className:"flex h-full items-center justify-center p-6",children:y.jsx("div",{className:"max-w-md rounded-md border border-status-danger-border bg-status-danger-bg p-4 text-center text-xs text-status-danger-text",children:o.message})}):y.jsx("div",{ref:pe,className:"h-full"})}),o.status==="ready"&&N&&y.jsxs("aside",{"data-testid":"problems-panel","aria-live":"polite",className:"flex w-[280px] shrink-0 flex-col overflow-hidden rounded-lg border border-line bg-surface",children:[y.jsxs("div",{className:"flex shrink-0 items-center justify-between border-b border-line px-3 py-1.5",children:[y.jsx("span",{className:"text-xs font-semibold text-ink-secondary",children:"Problems"}),y.jsx("button",{type:"button",onClick:()=>j(!1),"aria-label":"Close problems",className:"rounded-md p-1 text-ink-muted hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:y.jsx(Li,{className:"h-3.5 w-3.5"})})]}),y.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto p-2",children:v.length===0?y.jsx("p",{className:"px-2 py-1 text-xs text-ink-faint",children:"No problems detected."}):y.jsx("ul",{"data-testid":"editor-issues",className:"space-y-1",children:v.map((ue,ye)=>y.jsxs("li",{tabIndex:0,className:`flex items-start gap-2 rounded-md border px-2.5 py-1.5 text-xs ${ue.severity==="error"?"border-status-danger-border bg-status-danger-bg text-status-danger-text":ue.severity==="warning"?"border-chip-amber-border bg-chip-amber-bg text-chip-amber-text":"border-line bg-surface text-ink-secondary"}`,children:[ue.severity==="error"?y.jsx(uu,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}):ue.severity==="warning"?y.jsx(wy,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}):y.jsx(by,{className:"mt-0.5 h-3.5 w-3.5 shrink-0"}),y.jsx("span",{className:"min-w-0",children:ue.message})]},`${ue.severity}-${ye}`))})})]})]}),o.status==="ready"&&y.jsxs("footer",{"data-testid":"editor-footer",className:"flex shrink-0 items-center justify-between gap-3 border-t border-line px-5 py-1.5 text-xs",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-2",children:[y.jsxs("button",{type:"button","data-testid":"validity-chip",onClick:()=>j(ue=>!ue),title:"Toggle the problems panel","aria-pressed":N,className:`inline-flex shrink-0 items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-bold focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 ${S.kind==="valid"?"border-status-success-border bg-status-success-bg text-status-success-text":S.kind==="invalid"?"border-status-danger-border bg-status-danger-bg text-status-danger-text":"border-line bg-surface text-ink-muted"}`,children:[S.kind==="valid"?y.jsx(Pr,{className:"h-3 w-3"}):S.kind==="invalid"?y.jsx(uu,{className:"h-3 w-3"}):S.kind==="validating"?y.jsx(ul,{className:"h-3 w-3 animate-spin"}):y.jsx(d4,{className:"h-3 w-3"}),S.kind==="valid"?"Valid":S.kind==="invalid"?`${S.count} issue${S.count===1?"":"s"}`:S.kind==="validating"?"Validating…":"Not validated"]}),u&&y.jsxs("span",{role:"status",className:"inline-flex shrink-0 items-center gap-1 rounded-full border border-chip-amber-border bg-chip-amber-bg px-2 py-0.5 text-[10px] font-bold text-chip-amber-text",children:[y.jsx(p4,{className:"h-3 w-3"}),"Unsaved changes"]}),g!==null&&y.jsx("div",{"data-testid":"editor-status","aria-live":"polite",className:`min-w-0 truncate rounded-md border px-2 py-0.5 font-medium ${g.kind==="ok"?"border-status-success-border bg-status-success-bg text-status-success-text":"border-status-danger-border bg-status-danger-bg text-status-danger-text"}`,children:g.text})]}),y.jsxs("div",{className:"flex shrink-0 items-center gap-3 text-ink-muted",children:[y.jsxs("span",{className:"font-mono",children:["Ln ",D.line,", Col ",D.col]}),y.jsx("span",{className:"text-ink-faint",children:"YAML"}),y.jsx("span",{className:"max-w-[220px] truncate font-mono",children:fe})]})]})]})}),y.jsx(io,{isOpen:d,title:"Discard changes?",message:`The editor contains unsaved changes. +Closing now will discard them.`,confirmLabel:"Discard",cancelLabel:"Keep editing",danger:!0,onConfirm:()=>{m(!1),e()},onCancel:()=>m(!1)}),y.jsx(io,{isOpen:H!==null,title:"Replace current edits?",message:H==="revert"?`The editor contains unsaved changes. +Reverting will discard them and reload the file from disk.`:`The editor contains unsaved changes. +Loading the starter template will discard them.`,confirmLabel:"Replace",cancelLabel:"Keep editing",danger:!0,onConfirm:()=>{const ue=H;M(null),ue==="new"?Qt():ue==="revert"&&Ft()},onCancel:()=>M(null)}),y.jsx(io,{isOpen:A!==null,title:"Save with validation issues?",danger:!0,message:y.jsxs(y.Fragment,{children:[y.jsx("p",{children:"Saving will write these issues to disk; the file may fail to load until they are fixed."}),y.jsx("ul",{className:"mt-2 space-y-1",children:A==null?void 0:A.issues.map((ue,ye)=>y.jsx("li",{className:`rounded-md border px-3 py-1.5 text-xs ${ue.severity==="error"?"border-status-danger-border bg-status-danger-bg text-status-danger-text":"border-chip-amber-border bg-chip-amber-bg text-chip-amber-text"}`,children:ue.message},`${ue.severity}-${ye}`))})]}),confirmLabel:"Force save anyway",cancelLabel:"Go back and fix",onConfirm:()=>A==null?void 0:A.resolve(!0),onCancel:()=>A==null?void 0:A.resolve(!1)}),y.jsx(io,{isOpen:W!==null,title:"File changed on disk",danger:!0,message:`The configuration file was modified outside this editor since it was loaded. + +Reload disk version: discard your edits and load the file as it is on disk. +Overwrite anyway: save your edits and replace the file's current content.`,confirmLabel:"Overwrite anyway",cancelLabel:"Reload disk version",onConfirm:()=>W==null?void 0:W.resolve(!0),onCancel:()=>W==null?void 0:W.resolve(!1)}),y.jsx(z9,{open:ne!==null,onCancel:()=>ne==null?void 0:ne.resolve(null),onConfirm:ue=>ne==null?void 0:ne.resolve(ue)})]})}function F9({position:n,onClose:e,onLaunch:t,onLaunchWithArgs:i,onReveal:l,onOpenFolder:o,onOpenTerminal:a,onScanDirectory:u,onFilterFolder:f,onFilterExtension:d,onCopyPath:m,onCopyFilename:g,onCopyUri:b,onComputeHash:v,onVerifyHash:w,onProperties:S,onClearFile:C,onGenerateBarcode:N,showToast:j}){const[D,U]=E.useState(!1),[H,M]=E.useState(""),A=E.useRef(null),L=E.useRef(null),ne=E.useRef(null),[F,W]=E.useState(null);if(E.useEffect(()=>{var G;D&&((G=L.current)==null||G.showModal())},[D]),E.useLayoutEffect(()=>{if(!n){W(null);return}const G=()=>{const T=A.current;if(!T)return;const de=T.getBoundingClientRect(),be=8;W({left:Math.max(be,Math.min(n.x,window.innerWidth-de.width-be)),top:Math.max(be,Math.min(n.y,window.innerHeight-de.height-be))})};return G(),window.addEventListener("resize",G),()=>window.removeEventListener("resize",G)},[n]),E.useEffect(()=>{if(!n)return;ne.current=document.activeElement instanceof HTMLElement?document.activeElement:null;const G=window.requestAnimationFrame(()=>{var T,de;(de=(T=A.current)==null?void 0:T.querySelector("[role='menuitem']"))==null||de.focus()});return()=>{var T;window.cancelAnimationFrame(G),(T=ne.current)==null||T.focus()}},[n]),!n)return null;const{file:I,x:re,y:pe}=n,ce=()=>{i(I,H),U(!1),e()},Z=G=>{const T=G.lastIndexOf(".");return T!==-1?G.slice(T):""},oe=G=>{const T=Math.max(G.lastIndexOf("/"),G.lastIndexOf("\\"));return T!==-1?G.slice(0,T):G},K=G=>{const T=Math.max(G.lastIndexOf("/"),G.lastIndexOf("\\"));return T!==-1?G.slice(0,T):""};return y.jsxs(y.Fragment,{children:[y.jsx("div",{className:"fixed inset-0 z-[calc(var(--z-context-menu)-1)]",onClick:e,onContextMenu:G=>{G.preventDefault(),e()},"aria-hidden":"true"}),y.jsxs("div",{ref:A,role:"menu","aria-label":`Actions for ${I.filename}`,tabIndex:0,onKeyDown:G=>{var be,z,R,Q;["Escape","ArrowDown","ArrowUp","Home","End"].includes(G.key)&&G.stopPropagation();const T=Array.from(((be=A.current)==null?void 0:be.querySelectorAll("[role='menuitem']"))??[]),de=T.indexOf(document.activeElement);if(G.key==="Escape")G.preventDefault(),e();else if(G.key==="ArrowDown"||G.key==="ArrowUp"){G.preventDefault();const he=G.key==="ArrowDown"?1:-1;(z=T[(de+he+T.length)%T.length])==null||z.focus()}else G.key==="Home"?(G.preventDefault(),(R=T[0])==null||R.focus()):G.key==="End"&&(G.preventDefault(),(Q=T.at(-1))==null||Q.focus())},className:"animate-modal-in fixed z-[var(--z-context-menu)] max-h-[calc(100dvh-16px)] w-56 max-w-[calc(100vw-16px)] overflow-y-auto rounded-lg border border-line bg-surface-glass py-1 text-xs text-ink shadow-2xl backdrop-blur-md",style:F??{left:re,top:pe,visibility:"hidden"},children:[y.jsx("div",{className:"border-b border-line px-3 py-2 font-medium text-ink-muted truncate",children:I.filename}),y.jsxs("button",{role:"menuitem",onClick:()=>{t(I),e()},className:"flex w-full items-center gap-2 px-3 py-3 min-h-[44px] hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Launch ${I.filename}`,children:[y.jsx(is,{className:"h-3.5 w-3.5 fill-current text-status-success-text group-hover:text-white"}),y.jsx("span",{children:"Launch"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{U(!0)},className:"flex w-full items-center gap-2 px-3 py-3 min-h-[44px] hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Launch ${I.filename} with arguments`,children:[y.jsx(is,{className:"h-3.5 w-3.5 text-chip-indigo-text group-hover:text-white"}),y.jsx("span",{children:"Launch with arguments..."})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{l(I),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Reveal ${I.filename} in file manager`,children:[y.jsx(W0,{className:"h-3.5 w-3.5 text-chip-sky-text group-hover:text-white"}),y.jsx("span",{children:"Reveal in File Manager"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{o(I),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Open folder containing ${I.filename}`,children:[y.jsx(ts,{className:"h-3.5 w-3.5 text-chip-amber-text group-hover:text-white"}),y.jsx("span",{children:"Open Folder"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{a(I),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Open terminal in directory containing ${I.filename}`,children:[y.jsx(J0,{className:"h-3.5 w-3.5 text-status-success-text group-hover:text-white"}),y.jsx("span",{children:"Open Terminal in Directory"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{N(I),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":"Generate QR Code",children:[y.jsx(vy,{className:"h-3.5 w-3.5 text-chip-fuchsia-text group-hover:text-white"}),y.jsx("span",{children:"Generate QR Code"})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{const G=oe(I.path);u(G),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":"Scan to Directory",children:[y.jsx(ts,{className:"h-3.5 w-3.5 text-chip-indigo-text group-hover:text-white"}),y.jsx("span",{children:"Scan to Directory"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{const G=K(I.rel_path);G&&f(G),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Filter view to folder ${I.filename} is in`,children:[y.jsx(Z0,{className:"h-3.5 w-3.5 text-chip-indigo-text group-hover:text-white"}),y.jsx("span",{children:"Filter to Folder"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{const G=Z(I.filename);G&&d(G),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Filter view by extension ${Z(I.filename)}`,children:[y.jsx(Z0,{className:"h-3.5 w-3.5 text-chip-indigo-text group-hover:text-white"}),y.jsx("span",{children:"Filter by Extension"})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{m(I,!1),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy full path of ${I.filename}`,children:[y.jsx(mi,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Full Path"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{m(I,!0),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy path of ${I.filename} with forward slashes`,children:[y.jsx(mi,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Path (Forward Slashes)"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{g(I,!1),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy filename of ${I.filename}`,children:[y.jsx(mi,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Filename"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{g(I,!0),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy filename of ${I.filename} without extension`,children:[y.jsx(mi,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Filename (no ext)"})]}),y.jsxs("button",{role:"menuitem",onClick:async()=>{const G=oe(I.path);e();try{await navigator.clipboard.writeText(G),j==null||j(`Copied: ${G}`)}catch(T){j==null||j(`Copy failed: ${(T==null?void 0:T.message)??T}`,"error")}},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":"Copy Directory",children:[y.jsx(mi,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy Directory"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{b(I),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Copy URI of ${I.filename}`,children:[y.jsx(mi,{className:"h-3.5 w-3.5 text-ink-muted group-hover:text-white"}),y.jsx("span",{className:"truncate",children:"Copy URI"})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{v(I,"md5"),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Compute MD5 hash of ${I.filename}`,children:[y.jsx(ha,{className:"h-3.5 w-3.5 text-chip-purple-text group-hover:text-white"}),y.jsx("span",{children:"Compute MD5 Hash"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{v(I,"sha256"),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Compute SHA256 hash of ${I.filename}`,children:[y.jsx(ha,{className:"h-3.5 w-3.5 text-chip-purple-text group-hover:text-white"}),y.jsx("span",{children:"Compute SHA256 Hash"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{w(I,"md5"),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Verify MD5 hash of ${I.filename}`,children:[y.jsx(ha,{className:"h-3.5 w-3.5 text-chip-purple-text group-hover:text-white"}),y.jsx("span",{children:"Verify MD5 Hash"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{w(I,"sha256"),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Verify SHA256 hash of ${I.filename}`,children:[y.jsx(ha,{className:"h-3.5 w-3.5 text-chip-purple-text group-hover:text-white"}),y.jsx("span",{children:"Verify SHA256 Hash"})]}),y.jsx("div",{className:"my-1 border-t border-line"}),y.jsxs("button",{role:"menuitem",onClick:()=>{S(I),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`View properties of ${I.filename}`,children:[y.jsx(W0,{className:"h-3.5 w-3.5 text-chip-sky-text group-hover:text-white"}),y.jsx("span",{children:"Properties"})]}),y.jsxs("button",{role:"menuitem",onClick:()=>{C(I),e()},className:"flex w-full items-center gap-2 px-3 py-1.5 hover:bg-indigo-600 hover:text-white focus:outline-none focus:ring-2 focus:ring-indigo-500 active:scale-95 transition-transform group","aria-label":`Remove ${I.filename} from list`,children:[y.jsx(cO,{className:"h-3.5 w-3.5 text-status-danger-text group-hover:text-white"}),y.jsx("span",{children:"Delete"})]})]}),D&&y.jsx("dialog",{ref:L,className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 rounded-xl","aria-labelledby":"args-modal-title",onClick:G=>{G.target===L.current&&U(!1)},onCancel:G=>{G.preventDefault(),U(!1)},children:y.jsxs("div",{className:"animate-modal-in w-96 rounded-xl border border-frame-line glass-panel p-4",children:[y.jsx("h3",{id:"args-modal-title",className:"mb-2 text-sm font-semibold text-ink",children:"Launch with Arguments"}),y.jsx("p",{className:"mb-3 text-xs text-ink-muted truncate",children:I.filename}),y.jsx("input",{type:"text",autoFocus:!0,placeholder:"Arguments (e.g. --verbose --port 80)",value:H,onChange:G=>M(G.target.value),onKeyDown:G=>{G.key==="Enter"&&ce(),G.key==="Escape"&&U(!1)},className:"mb-4 w-full rounded-md border border-line bg-elevated px-3 py-2 text-xs text-ink outline-none focus:border-indigo-500 focus:ring-2 focus:ring-indigo-500","aria-label":"Command line arguments"}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx("button",{onClick:()=>U(!1),className:"rounded-md px-3 py-1.5 text-xs text-ink-muted hover:bg-elevated hover:text-ink focus:outline-none focus:ring-2 focus:ring-indigo-500","aria-label":"Cancel launch",children:"Cancel"}),y.jsx("button",{onClick:ce,className:"btn btn-primary px-3 py-1.5","aria-label":`Launch ${I.filename} with arguments`,children:"Launch"})]})]})})]})}function q9({isOpen:n,initialPath:e,onClose:t,onSelect:i}){const[l,o]=E.useState(null),[a,u]=E.useState(null),[f,d]=E.useState(""),[m,g]=E.useState(!1),[b,v]=E.useState(null),w=E.useRef(null),S=E.useRef(null),C=E.useRef(null);E.useEffect(()=>{var H;if(!n){(H=C.current)==null||H.focus();return}C.current=document.activeElement instanceof HTMLElement?document.activeElement:null,v(null),N(e||"");const U=requestAnimationFrame(()=>{var M;return(M=S.current)==null?void 0:M.focus()});return()=>{var M;cancelAnimationFrame(U),(M=C.current)==null||M.focus()}},[n]);const N=async U=>{g(!0),v(null);try{const H=await fetch(`/api/fs/browse?path=${encodeURIComponent(U)}`);if(!H.ok)throw new Error("Failed to browse directory");const M=await H.json();o(M),u(M.current_path),d(M.current_path)}catch(H){v(H.message||"Navigation failed")}finally{g(!1)}},j=()=>{const U=f.trim()||a;U&&(i(U),t())},D=U=>{var L;if(U.key==="Escape"){U.preventDefault(),t();return}if(U.key!=="Tab")return;const H=(L=w.current)==null?void 0:L.querySelectorAll('button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(!(H!=null&&H.length))return;const M=H[0],A=H[H.length-1];U.shiftKey&&document.activeElement===M?(U.preventDefault(),A.focus()):!U.shiftKey&&document.activeElement===A&&(U.preventDefault(),M.focus())};return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-3 backdrop-blur-sm sm:p-6",onClick:t,children:y.jsxs("div",{ref:w,role:"dialog","aria-modal":"true","aria-labelledby":"directory-picker-title",onKeyDown:D,className:"animate-modal-in flex h-[min(84dvh,760px)] max-h-[calc(100dvh-1.5rem)] w-[min(94vw,960px)] min-h-0 flex-col overflow-hidden rounded-xl border border-frame-line glass-panel sm:rounded-2xl",onClick:U=>U.stopPropagation(),children:[y.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-line px-4 py-3 sm:px-5",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx("span",{className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(ts,{className:"h-5 w-5 text-chip-indigo-text"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"directory-picker-title",className:"text-sm font-semibold text-ink",children:"Select a directory"}),y.jsx("p",{className:"truncate font-mono text-xs text-ink-muted",children:(l==null?void 0:l.current_path)||""})]})]}),y.jsx(Xe,{text:"Close",block:!1,children:y.jsx("button",{type:"button",onClick:t,"aria-label":"Close directory picker",className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg text-ink-muted transition-colors hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Li,{className:"h-4 w-4"})})})]}),y.jsxs("div",{className:"border-b border-line px-4 py-3 sm:px-5",children:[y.jsx("label",{htmlFor:"directory-picker-path",className:"mb-1.5 block text-xs font-medium text-ink-secondary",children:"Location"}),y.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[y.jsx("input",{ref:S,id:"directory-picker-path",type:"text",value:f,onChange:U=>d(U.target.value),onKeyDown:U=>{U.key==="Enter"&&N(f.trim())},placeholder:"/path/to/directory",className:"h-10 min-w-0 flex-1 rounded-lg border border-line bg-elevated px-2.5 font-mono text-sm text-ink outline-none placeholder:text-ink-faint transition-colors hover:bg-surface-strong focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-indigo-500/30"}),y.jsx("button",{type:"button",onClick:()=>N(f.trim()),className:"inline-flex h-10 shrink-0 items-center gap-1.5 rounded-lg border border-line bg-elevated px-3.5 text-sm font-medium text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Go"}),y.jsx(Xe,{text:"Home directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>N(""),"aria-label":"Home directory",className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Gd,{className:"h-4 w-4"})})}),(l==null?void 0:l.parent_path)&&y.jsx(Xe,{text:"Parent directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>N(l.parent_path),"aria-label":"Parent directory",className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Yd,{className:"h-4 w-4 rotate-180"})})})]})]}),y.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2 sm:px-3 sm:py-3","aria-busy":m,children:m?y.jsxs("div",{className:"flex h-full items-center justify-center gap-2.5 text-sm text-ink-muted",children:[y.jsx(ul,{className:"h-5 w-5 animate-spin text-chip-indigo-text"}),y.jsx("span",{role:"status",children:"Loading directories…"})]}):b?y.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-2.5 text-center",children:[y.jsx("p",{className:"text-sm text-status-danger-text",children:b}),y.jsx("button",{type:"button",onClick:()=>N(f||(l==null?void 0:l.current_path)||""),className:"min-h-10 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Retry"})]}):y.jsxs("ul",{className:"space-y-0.5",children:[l==null?void 0:l.items.filter(U=>U.is_dir).map(U=>y.jsx("li",{children:y.jsxs("button",{type:"button",onClick:()=>N(U.path),onDoubleClick:()=>{d(U.path),i(U.path),t()},className:`flex min-h-10 w-full items-center justify-between rounded-lg px-3 py-1.5 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-400 ${a===U.path?"bg-chip-indigo-bg text-chip-indigo-text":"text-ink-secondary hover:bg-elevated hover:text-ink"}`,children:[y.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx(Au,{className:"h-5 w-5 shrink-0 text-chip-indigo-text"}),y.jsx("span",{className:"truncate",children:U.name})]}),a===U.path&&y.jsx(Pr,{className:"h-4 w-4 shrink-0 text-chip-indigo-text"})]})},U.path)),(l==null?void 0:l.items.filter(U=>U.is_dir).length)===0&&y.jsxs("li",{className:"flex h-full min-h-36 flex-col items-center justify-center gap-2.5 text-center text-sm text-ink-muted",children:[y.jsx(ts,{className:"h-7 w-7 text-ink-faint"}),"No subdirectories found"]})]})}),y.jsxs("div",{className:"flex flex-col gap-2 border-t border-line px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:px-5",children:[y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("p",{className:"mb-0.5 text-xs font-medium text-ink-muted",children:"Selected folder"}),y.jsx("p",{className:"truncate font-mono text-sm text-ink",title:a||f,children:a||f||"—"})]}),y.jsxs("div",{className:"flex shrink-0 justify-end gap-1.5",children:[y.jsx("button",{type:"button",onClick:t,className:"min-h-10 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Cancel"}),y.jsxs("button",{type:"button",onClick:j,disabled:!f.trim(),className:"btn btn-primary min-h-10 rounded-lg px-4 text-sm font-semibold",children:[y.jsx(ts,{className:"h-4 w-4"}),"Select folder"]})]})]})]})}):null}function V9({visible:n,onFileSelected:e}){const t=E.useRef(null);return n?y.jsxs("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-drop-overlay)] flex items-center justify-center bg-black/65 backdrop-blur-sm",onClick:()=>{var i;return(i=t.current)==null?void 0:i.click()},"data-testid":"drop-config-overlay",children:[y.jsx("input",{ref:t,type:"file",accept:".profiles,.profiles.yaml,.profiles.yml,.yaml,.yml",className:"hidden",onChange:i=>{var o;const l=(o=i.target.files)==null?void 0:o[0];l&&e(l),i.target.value=""}}),y.jsxs("div",{className:"rounded-xl border-2 border-dashed border-chip-indigo-border bg-surface px-8 py-6 text-center shadow-2xl",children:[y.jsx("span",{className:"mx-auto mb-3 grid h-9 w-9 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(fa,{className:"h-5 w-5 text-chip-indigo-text"})}),y.jsx("p",{className:"text-sm font-semibold text-ink",children:"Drop configuration file"}),y.jsx("p",{className:"mt-1 text-xs text-ink-muted",children:".profiles, .profiles.yaml, .yml, .yaml — session-only preview"})]})]}):null}function Q9({items:n,columnTemplate:e,resizePointerRef:t,resizeMovedRef:i}){return y.jsx("div",{className:"grid select-none items-center border-b border-l-2 border-l-transparent border-line/40 bg-surface/60 font-medium text-ink-muted shadow-sm backdrop-blur-md",role:"row","aria-rowindex":1,"data-file-list-header":!0,style:{gridTemplateColumns:e},children:n.map((l,o)=>{const a=!!(l.onSort&&l.sortKey),u=l.active?l.direction==="asc"?"ascending":"descending":"none";return y.jsxs("div",{role:"columnheader","data-column-key":l.sortKey,className:`group relative flex items-center gap-1.5 truncate px-3 py-2 ${a?"cursor-pointer hover:text-ink transition-colors":""} ${l.active?"text-ink":""}`,...a?{"aria-sort":u,tabIndex:0,onClick:l.onSort,onKeyDown:f=>{var d;(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),(d=l.onSort)==null||d.call(l))}}:{},children:[l.icon,y.jsx("span",{className:"truncate",children:l.label}),a?l.active?l.direction==="asc"?y.jsx(e4,{className:"ml-auto h-3 w-3 shrink-0 text-chip-indigo-text"}):y.jsx(tO,{className:"ml-auto h-3 w-3 shrink-0 text-chip-indigo-text"}):y.jsx(Yk,{className:"ml-auto h-3 w-3 shrink-0 opacity-0 transition-opacity group-hover:opacity-40 hover:opacity-40"}):o>0&&y.jsx(Yk,{className:"ml-auto h-3 w-3 shrink-0 opacity-40"}),l.canResize&&l.onResizeBy&&y.jsx("div",{role:"separator","aria-orientation":"vertical","aria-label":`Resize ${l.label} column`,"aria-valuemin":xa,"aria-valuemax":Fd,"aria-valuenow":l.width??l.defaultWidth??cd,"aria-valuetext":`${l.width??l.defaultWidth??cd} pixels wide`,title:"Drag to resize; use arrow keys or click either side to adjust",tabIndex:0,onClick:f=>{var g;f.preventDefault(),f.stopPropagation();const d=i.current;if(i.current=!1,d)return;const m=f.currentTarget.getBoundingClientRect();(g=l.onResizeBy)==null||g.call(l,f.clientX{f.preventDefault(),f.stopPropagation();const d=f.currentTarget.parentElement;i.current=!1,t.current={pointerId:f.pointerId,startX:f.clientX,startWidth:l.width??(d==null?void 0:d.getBoundingClientRect().width)??l.defaultWidth??cd,resizeTo:l.onResizeTo},f.currentTarget.setPointerCapture(f.pointerId)},onPointerMove:f=>{const d=t.current;if(!d||d.pointerId!==f.pointerId)return;const m=f.clientX-d.startX;Math.abs(m)>2&&(i.current=!0),d.resizeTo(d.startWidth+m)},onPointerUp:f=>{var d;((d=t.current)==null?void 0:d.pointerId)===f.pointerId&&(f.currentTarget.releasePointerCapture(f.pointerId),t.current=null,window.setTimeout(()=>{i.current=!1},0))},onPointerCancel:()=>{t.current=null,i.current=!1},onKeyDown:f=>{var d,m;f.stopPropagation(),f.key==="ArrowLeft"||f.key==="ArrowRight"?(f.preventDefault(),(d=l.onResizeBy)==null||d.call(l,f.key==="ArrowLeft"?-Fh:Fh)):(f.key==="Home"||f.key==="End")&&(f.preventDefault(),(m=l.onResizeTo)==null||m.call(l,f.key==="Home"?xa:Fd))},className:"absolute inset-y-0 right-0 z-10 w-3 cursor-col-resize touch-none border-r border-transparent transition-colors hover:border-indigo-400 focus-visible:border-indigo-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500"})]},o)})})}const sr=28,Uh=12,R0=500,xa=80,Fd=960,cd=160,Fh=24,Q2=44,qh={File:2,Path:3,FileName:1,Type:1,Version:1};function X9({files:n,totalCount:e,rawLoadedCount:t,onLoadMore:i,loadingMore:l=!1,scanning:o=!1,hasScanned:a=!1,activeDirectory:u="",recursive:f=!1,onDisableRecursive:d,onOpenDirectory:m,onLoadConfig:g,filterText:b,onClearFilter:v,prefilterNote:w,columnHeaders:S,columnNames:C,selectedIndex:N,onSelectIndex:j,onLaunch:D,onContextMenu:U,rowColors:H,sort:M,onSortChange:A}){const L=["File"],ne=C.length>0?C:L,F=S.length>0?S:ne,W=Array.from({length:Math.max(ne.length,F.length)},(Oe,qe)=>({key:ne[qe]??L[0],header:F[qe]??ne[qe]??L[0]})),I=E.useRef(null),[re,pe]=E.useState(0),[ce,Z]=E.useState(600),[oe,K]=E.useState(0),[G,T]=E.useState({}),de=E.useRef(null),be=E.useRef(!1),z=ne.reduce((Oe,qe)=>Oe+(qh[qe]??1),1),R=(Oe,qe)=>{const $e=Math.min(Fd,Math.max(xa,Math.round(qe)));T(ht=>({...ht,[Oe]:$e}))},Q=(Oe,qe)=>{var te;const $e=Array.from(((te=I.current)==null?void 0:te.querySelectorAll("[data-column-key]"))??[]).find(fe=>fe.dataset.columnKey===Oe),ht=G[Oe]??($e==null?void 0:$e.getBoundingClientRect().width)??cd;R(Oe,ht+qe)},he=[`${Q2}px`,...ne.map(Oe=>G[Oe]?`${G[Oe]}px`:`minmax(${xa}px, ${qh[Oe]??1}fr)`)].join(" "),ge=E.useRef(!1),ze=E.useRef(null),Te=n.length,He=t??Te,ke=e??He,Ae=He{const Oe=I.current;if(!Oe)return;const qe=new ResizeObserver($e=>{for(const ht of $e)Z(ht.contentRect.height),K(ht.contentRect.width)});return qe.observe(Oe),Z(Oe.clientHeight||600),K(Oe.clientWidth||0),()=>qe.disconnect()},[]),E.useEffect(()=>{var fe;const Oe=I.current;if(!Oe||N<0||N>=Te)return;const qe=((fe=Oe.querySelector("[data-file-list-header]"))==null?void 0:fe.offsetHeight)??0,$e=qe+N*sr,ht=$e+sr;let te=Oe.scrollTop;$eOe.scrollTop+Oe.clientHeight&&(te=ht-Oe.clientHeight),te!==Oe.scrollTop&&(Oe.scrollTop=te,pe(te))},[N,Te]),E.useEffect(()=>{const Oe=I.current;if(!Oe)return;const qe=()=>{if(ge.current||!Ft||!i)return;const $e=Oe.scrollTop+Oe.clientHeight,ht=Te*sr;ht-$e$e&&(ge.current=!0,window.setTimeout(()=>{ge.current=!1},200),i())};return Oe.addEventListener("scroll",qe,{passive:!0}),window.addEventListener("scroll",qe,{passive:!0}),()=>{Oe.removeEventListener("scroll",qe),window.removeEventListener("scroll",qe)}},[n,Ft,i,Te]),E.useEffect(()=>{if(ge.current||!Ft||!i)return;const Oe=Te*sr,qe=re+ce;if(!(Oe-qeqe))return;const ht=`${Te}:${He}:${ke}`;ze.current=ht,i()});const xn=E.useCallback(Oe=>{pe(Oe.currentTarget.scrollTop)},[]),Ht=Math.max(0,Math.floor(re/sr)-Uh),Ot=Math.ceil(ce/sr)+Uh*2,lt=Math.min(Te,Ht+Ot),tn=Ht*sr,Hn=(Oe,qe)=>{if(qe)return{className:"bg-chip-indigo-bg border-l-4 border-chip-indigo-border text-ink",style:{}};for(const[$e,ht]of H)if(Oe.toLowerCase().includes($e.toLowerCase()))return{className:"hover:bg-elevated border-l-4 text-ink",style:{borderLeftColor:ht,borderLeftWidth:"4px"}};return{className:"border-l-4 border-transparent text-ink-secondary hover:bg-elevated/60",style:{borderLeftColor:"transparent",borderLeftWidth:"4px"}}},qt=(Ft?Te+Ot:Te)*sr,Kt="btn btn-secondary px-3 py-1.5";return y.jsxs("div",{ref:I,onScroll:xn,className:"flex-1 overflow-auto bg-app text-xs transition-colors duration-200 focus-visible:outline focus-visible:outline-2 focus-visible:outline-indigo-500 focus-visible:outline-offset-[-2px]","data-testid":"file-list","data-loaded-count":He,"aria-busy":o,role:"grid","aria-label":"Discovered files","aria-rowcount":Math.max(ke,Te===0?1:0)+1,"aria-colcount":ne.length+1,"aria-activedescendant":Te>0?`file-row-${N}`:void 0,tabIndex:0,children:[y.jsx("div",{className:"sticky top-0 z-10",role:"presentation",children:y.jsx(Q9,{columnTemplate:he,resizePointerRef:de,resizeMovedRef:be,items:[{label:"#",icon:y.jsx(Z0,{className:"h-3.5 w-3.5"})},...W.map(({key:Oe,header:qe})=>({label:qe,weight:qh[Oe]??1,width:G[Oe],defaultWidth:Math.min(Fd,Math.max(xa,Math.round((oe-Q2)*(qh[Oe]??1)/z))),canResize:!0,onResizeBy:$e=>Q(Oe,$e),onResizeTo:$e=>R(Oe,$e),sortKey:Oe,active:(M==null?void 0:M.column)===Oe,direction:M==null?void 0:M.direction,onSort:()=>{(M==null?void 0:M.column)!==Oe?A({column:Oe,direction:"asc"}):M.direction==="asc"?A({column:Oe,direction:"desc"}):A(null)}}))]})}),w&&Te>0&&y.jsxs("div",{role:"note","data-testid":"prefilter-note",className:"flex items-center gap-1.5 border-b border-line/40 bg-surface px-3 py-1 text-[11px] text-ink-faint",children:[y.jsx(by,{className:"h-3 w-3 shrink-0 text-ink-faint","aria-hidden":"true"}),y.jsx("span",{className:"min-w-0 truncate",children:w})]}),Te===0?y.jsx("div",{role:"row","aria-rowindex":2,"data-testid":"file-list-empty",children:y.jsx("div",{role:"gridcell","aria-colspan":ne.length+1,className:"p-8 text-center text-ink-faint",children:o?y.jsxs("div",{className:"flex flex-col items-center gap-2",children:[y.jsx(ul,{className:"h-5 w-5 animate-spin text-chip-indigo-text motion-reduce:animate-none"}),y.jsx("span",{children:"Scanning files..."})]}):!u.trim()&&g?y.jsxs("div",{className:"flex flex-col items-center gap-3",children:[y.jsx("span",{children:"Select a directory first."}),y.jsx("button",{type:"button",onClick:g,className:Kt,children:"Choose configuration"})]}):a?b.trim()?y.jsxs("div",{className:"flex flex-col items-center gap-3",children:[y.jsxs("span",{children:["No files match “",b,"”."]}),y.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[y.jsx("button",{type:"button",onClick:v,className:Kt,children:"Clear filter"}),f&&d&&y.jsx("button",{type:"button",onClick:d,className:Kt,children:"Turn off recursive"}),m&&y.jsx("button",{type:"button",onClick:m,className:Kt,children:"Open directory"})]})]}):y.jsxs("div",{className:"flex flex-col items-center gap-3",children:[y.jsx("span",{children:"No files found for the current directory and extension."}),y.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[f&&d&&y.jsx("button",{type:"button",onClick:d,className:Kt,children:"Turn off recursive"}),m&&y.jsx("button",{type:"button",onClick:m,className:Kt,children:"Open directory"})]})]}):y.jsx("span",{children:"Select a directory and scan to find files."})})}):y.jsxs("div",{className:"relative",style:{height:qt},role:"rowgroup",children:[l&&y.jsx("div",{className:"pointer-events-none absolute left-1/2 top-2 z-20 -translate-x-1/2","aria-hidden":"true",children:y.jsx(ul,{className:"h-4 w-4 animate-spin text-chip-indigo-text"})}),y.jsx("div",{style:{transform:`translateY(${tn}px)`},"data-testid":"file-list-window",role:"presentation",children:n.slice(Ht,lt).map((Oe,qe)=>{const $e=Ht+qe,ht=$e===N,te=Hn(Oe.filename,ht);return y.jsxs("div",{id:`file-row-${$e}`,"data-row-index":$e,role:"row","aria-rowindex":$e+2,"aria-selected":ht,onClick:()=>{var fe;j($e),(fe=I.current)==null||fe.focus()},onDoubleClick:()=>D(Oe),onContextMenu:fe=>U(fe,Oe,$e),className:`grid cursor-pointer items-center transition-colors ${te.className}`,style:{...te.style,height:sr,gridTemplateColumns:he},children:[y.jsxs("div",{className:"flex items-center justify-end gap-1 px-3 font-mono text-ink-faint",children:[Oe.has_hook&&y.jsx("span",{title:Oe.hook_pattern?`Launch workflow: ${Oe.hook_pattern}`:"Launch workflow configured","aria-label":"Workflow hook attached",className:"inline-flex items-center text-status-warning-text hover:brightness-95",children:y.jsx(uO,{className:"h-3 w-3 shrink-0"})}),y.jsx("span",{className:"hidden sm:inline",children:$e+1})]}),ne.map((fe,_e)=>{const Be=Oe.column_values[fe]||(fe==="File"?Oe.filename:"-");return y.jsx("div",{role:"gridcell","data-column-key":fe,className:"truncate px-3 font-mono",style:{minWidth:xa},title:fe==="Path"?Oe.path:Be,children:Be},_e)})]},Oe.path||$e)})}),Ae&&y.jsxs("div",{className:"pointer-events-none absolute bottom-2 left-1/2 -translate-x-1/2 rounded-full border border-line bg-surface-strong px-3 py-1 text-[11px] text-ink-muted shadow","data-testid":"file-list-paging",children:[l?y.jsx(GM,{className:"mr-1.5 h-4 w-4 animate-spin motion-reduce:animate-none text-ink-muted"}):null,"(",He," of ",ke," loaded)"]})]})]})}function ey({id:n,ariaLabel:e,value:t,options:i,onChange:l,placeholder:o,className:a="",inputClassName:u="",optionLabel:f=m=>m,onOpenChange:d}){const m=E.useId(),g=E.useRef(null),[b,v]=E.useState(!1),[w,S]=E.useState(""),[C,N]=E.useState(-1),j=i.filter(A=>f(A).toLocaleLowerCase().includes(w.toLocaleLowerCase())),D=C>=0&&j[C]?`${m}-option-${C}`:void 0;E.useEffect(()=>{const A=L=>{var ne;(ne=g.current)!=null&&ne.contains(L.target)||v(!1)};return document.addEventListener("mousedown",A),()=>document.removeEventListener("mousedown",A)},[]),E.useEffect(()=>{d==null||d(b)},[b,d]),E.useEffect(()=>{var A;C<0||(A=document.getElementById(`${m}-option-${C}`))==null||A.scrollIntoView({block:"nearest"})},[C,m]);const U=()=>{S(""),N(-1),v(!0)},H=A=>{l(A),S(""),N(-1),v(!1)},M=A=>{if(A.key==="ArrowDown"){if(A.preventDefault(),!b){U(),N(0);return}N(L=>Math.min(L+1,j.length-1))}else if(A.key==="ArrowUp"){if(A.preventDefault(),!b){U(),N(j.length-1);return}N(L=>L<=0?j.length-1:L-1)}else A.key==="Enter"&&b&&j[C]!==void 0?(A.preventDefault(),H(j[C])):A.key==="Escape"&&v(!1)};return y.jsxs("div",{ref:g,onBlur:A=>{var L;(L=g.current)!=null&&L.contains(A.relatedTarget)||v(!1)},className:`relative flex min-w-0 ${a}`,children:[y.jsx("input",{id:n,type:"text",role:"combobox","aria-label":e,"aria-autocomplete":"list","aria-expanded":b,"aria-controls":m,"aria-activedescendant":D,value:t,placeholder:o,onChange:A=>{l(A.target.value),S(A.target.value),N(-1),v(!0)},onKeyDown:M,className:`min-w-0 flex-1 rounded-l-md border border-line bg-elevated px-3 py-1.5 text-ink outline-none transition-colors hover:bg-surface-strong focus:border-indigo-500 ${u}`}),y.jsx("button",{type:"button","aria-label":`Show ${e.toLowerCase()} options`,"aria-expanded":b,title:`Show ${e.toLowerCase()} options`,onMouseDown:A=>A.preventDefault(),onClick:()=>b?v(!1):U(),className:"shrink-0 rounded-r-md border border-l-0 border-line bg-elevated px-2 text-ink-muted hover:bg-surface-strong hover:text-ink focus-visible:z-10 focus-visible:outline focus-visible:outline-2 focus-visible:outline-indigo-500 transition-colors",children:y.jsx(a4,{className:`h-3.5 w-3.5 transition-transform ${b?"rotate-180":""}`})}),b&&y.jsx("ul",{id:m,role:"listbox","aria-label":`${e} options`,className:"absolute left-0 top-full z-[var(--z-combobox-list)] mt-1 max-h-60 w-full min-w-48 overflow-y-auto rounded-md border border-line bg-surface py-1 text-ink shadow-xl",children:j.length>0?j.map((A,L)=>{const ne=f(A),F=L===C,W=A===t;return y.jsx("li",{id:`${m}-option-${L}`,role:"option","aria-selected":W,title:ne||void 0,onMouseEnter:()=>N(L),onMouseDown:I=>I.preventDefault(),onClick:()=>H(A),className:`cursor-pointer truncate px-3 py-1.5 ${F?"bg-elevated text-ink":"text-ink-secondary"} ${W?"font-semibold":""}`,children:ne||"(No filter)"},`${A}-${L}`)}):y.jsx("li",{className:"px-3 py-1.5 text-ink-muted",children:"No matching presets"})})]})}function $9({title:n,release:e,directories:t,activeDirectory:i,onDirectoryChange:l,onBrowseDirectory:o,onGoToParentDirectory:a,onGoToHomeDirectory:u,onOpenActiveDirectory:f,onOpenTerminal:d}){const[m,g]=E.useState(!1);return y.jsxs("header",{className:"relative z-30 flex flex-wrap items-center gap-3 border-b border-line bg-app/90 px-5 py-2 text-xs backdrop-blur-xl shadow-xs transition-all duration-200",children:[y.jsx("div",{className:"flex shrink-0 items-center gap-3",children:y.jsxs("div",{className:"flex items-center gap-3.5",children:[y.jsxs("div",{className:"relative flex h-9 w-9 items-center justify-center rounded-xl bg-gradient-to-br from-chip-indigo-bg to-chip-purple-bg text-chip-indigo-text border border-chip-indigo-border shadow-xs",children:[y.jsx(J0,{className:"h-4 w-4"}),y.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 flex h-2.5 w-2.5 items-center justify-center rounded-full bg-emerald-500 ring-2 ring-app"})]}),y.jsxs("div",{children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("h1",{className:"text-sm font-bold tracking-tight text-ink font-heading",children:"ProFiles"}),n&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-ink-faint",children:"/"}),y.jsx("span",{className:"text-xs font-medium text-chip-indigo-text bg-chip-indigo-bg px-2 py-0.5 rounded-md border border-chip-indigo-border/50",children:n})]})]}),y.jsxs("p",{className:"text-[11px] font-medium text-ink-muted tracking-wide mt-0.5",children:["Crafted by ",y.jsx("span",{className:"text-ink font-semibold",children:"Florent ALBANY"})," • ",y.jsxs("span",{className:"font-mono text-chip-indigo-text",children:["v",e||"0.0.0-dev"]})]})]})]})}),y.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[y.jsxs("label",{className:"flex shrink-0 items-center gap-1.5 font-medium text-ink-secondary text-xs",children:[y.jsx(Au,{className:"h-3.5 w-3.5 text-chip-indigo-text"}),y.jsx("span",{children:"Directory:"})]}),y.jsx(Xe,{text:"Select or type a directory path to scan files from.",suppress:m,children:y.jsx(ey,{id:"directory-combobox",ariaLabel:"Directory",value:i,options:t,onChange:l,onOpenChange:g,placeholder:"/path/to/directory",className:"w-full",inputClassName:"font-mono"})}),f&&y.jsx(Xe,{text:"Open the active directory in the OS file manager",block:!1,children:y.jsx("button",{type:"button",onClick:f,"aria-label":"Open active directory",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(WM,{className:"h-3.5 w-3.5"})})}),a&&y.jsx(Xe,{text:"Go to parent directory",block:!1,children:y.jsx("button",{type:"button",onClick:a,"aria-label":"Go to parent directory",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(Yd,{className:"h-3.5 w-3.5 rotate-180"})})}),o&&y.jsx(Xe,{text:"Browse for a folder on this system",block:!1,children:y.jsx("button",{type:"button",onClick:o,"aria-label":"Browse directory",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(ts,{className:"h-3.5 w-3.5"})})}),d&&y.jsx(Xe,{text:"Open the active directory in a terminal",block:!1,children:y.jsx("button",{type:"button",onClick:()=>d(i),"aria-label":"Open directory in terminal",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(J0,{className:"h-3.5 w-3.5"})})}),u&&y.jsx(Xe,{text:"Set directory to your home folder",block:!1,children:y.jsx("button",{type:"button",onClick:u,"aria-label":"Go to home directory",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(Gd,{className:"h-3.5 w-3.5"})})})]})]})}function Y9({message:n,onRetry:e,retrying:t=!1}){return y.jsx("div",{className:"flex flex-1 items-center justify-center p-8",role:"alert","data-testid":"init-error-panel",children:y.jsxs("div",{className:"w-full max-w-sm rounded-xl border border-line bg-surface p-6 text-center shadow-xl",children:[y.jsx("div",{className:"mx-auto mb-3 flex h-10 w-10 items-center justify-center rounded-full border border-status-danger-border bg-status-danger-bg",children:y.jsx(Zc,{className:"h-5 w-5 text-status-danger-text/80"})}),y.jsx("h3",{className:"text-sm font-semibold text-ink",children:"Couldn't load the app"}),y.jsx("p",{className:"mt-1 break-words text-xs text-ink-secondary",children:n}),y.jsxs("button",{type:"button",onClick:e,disabled:t,className:"btn btn-primary mx-auto mt-4 px-3.5 py-1.5 font-semibold shadow-sm",children:[y.jsx(Kd,{className:`h-3.5 w-3.5 ${t?"animate-spin motion-reduce:animate-none":""}`}),y.jsx("span",{children:t?"Retrying...":"Retry"})]})]})})}const X2=/"([^"]*)"|(\S+)/g,$2=/"([^"]*)"/g,G9="Unmatched quote";function K9(n){const e=[];let t;for(X2.lastIndex=0;(t=X2.exec(n))!==null;){const a=t[1]!==void 0?t[1]:t[2];a&&a.trim()&&e.push(a)}let i="",l=0;$2.lastIndex=0;let o;for(;(o=$2.exec(n))!==null;)i+=n.slice(l,o.index),l=o.index+o[0].length;return i+=n.slice(l),{terms:e,error:i.includes('"')?G9:null}}function yA(n){const e=n.trim();if(!e)return{error:null,groups:[]};const{terms:t,error:i}=K9(e);if(t.length===0)return{error:i,groups:[]};const l=[];let o={includes:[],excludes:[]};for(const a of t){if(a.toUpperCase()==="OR"){l.push(o),o={includes:[],excludes:[]};continue}a==="-"||a==="+"||(a.startsWith("-")&&a.length>1?o.excludes.push(a.slice(1)):a.startsWith("+")&&a.length>1?o.includes.push(a.slice(1)):o.includes.push(a))}return l.push(o),{error:i,groups:l}}const W9=256,$s=new Map;function Y2(n){return n.toLowerCase()}function Z9(n){const e=$s.get(n);if(e)return $s.delete(n),$s.set(n,e),e;const{groups:t}=yA(n),i={groups:t.map(l=>({includes:l.includes.map(Y2),excludes:l.excludes.map(Y2)}))};if($s.size>=W9){const l=$s.keys().next().value;l!==void 0&&$s.delete(l)}return $s.set(n,i),i}function J9(n,e){return e.includes.every(t=>n.includes(t))&&!e.excludes.some(t=>n.includes(t))}function e8(n,e){const{groups:t}=Z9(e);if(t.length===0)return!0;const i=n.toLowerCase();return t.some(l=>J9(i,l))}function t8({query:n,visible:e}){if(!e)return null;const t=yA(n);return t.error?y.jsx("div",{"data-testid":"filter-syntax-helper",className:"pointer-events-none absolute left-0 right-0 top-full z-[var(--z-syntax-helper)] mt-1 rounded-md border border-status-danger-border bg-surface-strong px-3 py-2 text-[11px] leading-5 text-status-danger-text/90 shadow-xl",children:t.error}):t.groups.length===0?null:y.jsxs("div",{"data-testid":"filter-syntax-helper",className:"pointer-events-none absolute left-0 right-0 top-full z-[var(--z-syntax-helper)] mt-1 rounded-md border border-line bg-surface-strong px-3 py-2 text-[11px] leading-5 text-ink-secondary shadow-xl",children:[y.jsx("span",{className:"mr-1.5 align-[1px] text-[10px] uppercase tracking-wide text-ink-muted",children:"reads as"}),t.groups.map((i,l)=>y.jsxs("span",{"data-testid":"filter-syntax-group",children:[l>0&&y.jsx("span",{className:"mx-1 font-mono text-chip-indigo-text",children:"OR"}),i.includes.map((o,a)=>y.jsxs("span",{children:[a>0&&y.jsx("span",{className:"text-ink-muted",children:" · "}),y.jsx("span",{className:"font-mono text-chip-indigo-text",children:o})]},`i-${a}`)),i.includes.length>0&&i.excludes.length>0&&y.jsx("span",{className:"text-ink-muted",children:" · "}),i.excludes.map((o,a)=>y.jsxs("span",{children:[a>0&&y.jsx("span",{className:"text-ink-muted",children:" · "}),y.jsx("span",{className:"text-ink-muted",children:"✕ "}),y.jsx("span",{className:"font-mono text-status-danger-text/70 line-through",children:o})]},`x-${a}`))]},l))]})}const G2=y.jsxs("span",{className:"flex flex-col gap-1 whitespace-nowrap text-left",children:[y.jsx("span",{className:"font-semibold",children:"Supported operators"}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:"a b"})," — AND (both terms)"]}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:"a OR b"})," — either term"]}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:"-a"})," — NOT (exclude)"]}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:"+a"})," — force include"]}),y.jsxs("span",{children:[y.jsx("code",{className:"font-mono text-chip-indigo-text",children:'"a b"'})," — exact phrase"]})]});function n8({extensions:n,activeExtension:e,onExtensionChange:t,filterOptions:i,filterText:l,onFilterTextChange:o,recursive:a,onRecursiveChange:u,onScan:f,scanning:d,barcodeMode:m,onBarcodeToggle:g,onCameraBarcodeClick:b,autoRescanActive:v,onTimerClick:w}){const[S,C]=E.useState(!1),[N,j]=E.useState(!1),[D,U]=E.useState(!1);return y.jsxs("div",{className:"flex w-full flex-wrap items-center gap-3 border-b border-line bg-surface-glass p-3 text-xs",children:[y.jsx(Xe,{text:G2,suppress:N,children:y.jsxs("div",{className:"relative min-w-0 flex-1 basis-64",onFocusCapture:H=>{H.target.tagName==="INPUT"&&C(!0)},onBlurCapture:H=>{H.target.tagName==="INPUT"&&C(!1)},children:[y.jsx(oO,{className:"pointer-events-none absolute left-3 top-1/2 z-10 h-4 w-4 -translate-y-1/2 text-ink-secondary"}),y.jsx(ey,{id:"filter-combobox",ariaLabel:"File filter",value:l,options:i||[],onChange:o,onOpenChange:j,placeholder:"Filter files: keyword, a OR b, -tag, exact phrase...",className:"w-full",inputClassName:"pl-9 pr-3",optionLabel:H=>H||"(No filter)"}),y.jsx(t8,{query:l,visible:S&&!N&&l.trim().length>0})]})}),y.jsx(Xe,{text:G2,block:!1,suppress:D,children:y.jsxs("div",{className:"flex shrink-0 items-center gap-1.5",children:[y.jsx("span",{className:"text-ink-muted",children:"Ext:"}),y.jsx(ey,{id:"extension-combobox",ariaLabel:"Extension filter",value:e,options:n,onChange:t,onOpenChange:U,placeholder:".py OR .toml",className:"w-44",inputClassName:"font-mono px-2.5"})]})}),y.jsx(Xe,{text:"Include subdirectories when scanning",block:!1,children:y.jsxs("label",{className:"flex shrink-0 cursor-pointer select-none items-center gap-1.5 text-ink-secondary",children:[y.jsx("input",{type:"checkbox",checked:a,onChange:H=>u(H.target.checked),className:"rounded border-line text-chip-indigo-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 focus-visible:ring-offset-1 focus-visible:ring-offset-app"}),y.jsx("span",{children:"Recursive"})]})}),y.jsx(Xe,{text:"Run the scan with the current criteria (Enter)",block:!1,children:y.jsxs("button",{onClick:f,disabled:d,className:"btn btn-primary shrink-0 px-3.5 py-1.5 font-semibold shadow-sm",children:[d?y.jsx(Kd,{className:"h-3.5 w-3.5 animate-spin motion-reduce:animate-none"}):y.jsx(is,{className:"h-3.5 w-3.5 fill-current"}),y.jsx("span",{children:d?"Scanning...":"Scan"})]})}),y.jsx(Xe,{text:v?"Auto-rescan is active. Click to configure.":"Configure periodic auto-rescan (hot-folder mode)",block:!1,children:y.jsx("button",{type:"button",onClick:w,"aria-label":"Configure timer / auto-rescan",className:`flex shrink-0 items-center justify-center rounded-md border p-1.5 text-ink-secondary hover:border-indigo-500 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 transition-colors ${v?"border-chip-indigo-border bg-chip-indigo-bg text-chip-indigo-text":"border-line bg-elevated"}`,children:y.jsx(aO,{className:`h-3.5 w-3.5 ${v?"animate-pulse":""}`})})}),y.jsx(Xe,{text:"Toggle barcode scanner mode (USB HID). When active, scan a barcode to auto-fill controls and trigger a scan.",block:!1,children:y.jsx("button",{type:"button",onClick:g,"aria-label":m?"Disable barcode mode":"Enable barcode mode",className:`flex shrink-0 items-center justify-center rounded-md border p-1.5 text-ink-secondary hover:border-indigo-500 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 transition-colors ${m?"border-chip-indigo-border bg-chip-indigo-bg text-chip-indigo-text":"border-line bg-elevated"}`,children:y.jsx(vy,{className:`h-3.5 w-3.5 ${m?"animate-pulse":""}`})})}),b&&y.jsx(Xe,{text:"Scan barcode or QR code using webcam / camera (Ctrl + Shift + B)",block:!1,children:y.jsx("button",{type:"button",onClick:b,"aria-label":"Scan barcode with camera",className:"btn btn-secondary shrink-0 p-1.5",children:y.jsx(nO,{className:"h-3.5 w-3.5"})})})]})}const i8=2e3,r8=500,l8=[{value:null,label:"ALL"},{value:"DEBUG",label:"DEBUG"},{value:"INFO",label:"INFO"},{value:"WARNING",label:"WARNING"},{value:"ERROR",label:"ERROR"},{value:"CRITICAL",label:"CRITICAL"}],K2={DEBUG:{icon:n4,className:"text-chip-sky-text"},INFO:{icon:by,className:"text-status-success-text"},WARNING:{icon:wy,className:"text-status-warning-text"},ERROR:{icon:uu,className:"text-status-danger-text"},CRITICAL:{icon:uu,className:"text-status-danger-text"},UNKNOWN:{icon:Na,className:"text-ink-faint"}};function s8({isOpen:n,onClose:e,onOpenExternally:t}){const[i,l]=E.useState([]),[o,a]=E.useState("profiles.log"),[u,f]=E.useState(0),[d,m]=E.useState(null),[g,b]=E.useState(""),[v,w]=E.useState(!1),[S,C]=E.useState(!0),[N,j]=E.useState(null),[D,U]=E.useState(!0),H=E.useRef(null),M=E.useRef(null),A=E.useRef(null),L=E.useRef(null),ne=E.useRef(S),F=E.useRef({level:d,search:g}),W=E.useRef(0),I=E.useRef(!0);ne.current=S,F.current={level:d,search:g};const re=E.useCallback(async()=>{const K=++W.current,{level:G,search:T}=F.current;w(!0);try{const de=await wM({limit:r8,level:G,search:T});if(W.current!==K)return;l(de.entries),a(de.path),f(de.size_bytes),j(null)}catch(de){if(W.current!==K)return;j((de==null?void 0:de.message)||"Failed to read the log file")}finally{W.current===K&&w(!1)}},[]);E.useEffect(()=>{n&&re()},[n,re]),E.useEffect(()=>{if(!n||!S)return;const K=window.setInterval(()=>{re()},i8);return()=>window.clearInterval(K)},[n,S,re]),E.useEffect(()=>{if(!n){I.current=!0;return}if(I.current){I.current=!1;return}const K=window.setTimeout(()=>void re(),250);return()=>window.clearTimeout(K)},[n,d,g,re]),E.useEffect(()=>{if(!D)return;const K=A.current;K&&(K.scrollTop=K.scrollHeight)},[i,D]),E.useEffect(()=>{if(!n)return;const K=document.activeElement instanceof HTMLElement?document.activeElement:null,G=requestAnimationFrame(()=>{var T;return(T=M.current)==null?void 0:T.focus()});return()=>{cancelAnimationFrame(G),K==null||K.focus()}},[n]);const pe=K=>{var be;if(K.key==="Escape"){K.preventDefault(),e();return}if(K.key!=="Tab")return;const G=(be=H.current)==null?void 0:be.querySelectorAll('button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(!(G!=null&&G.length))return;const T=G[0],de=G[G.length-1];K.shiftKey&&document.activeElement===T?(K.preventDefault(),de.focus()):!K.shiftKey&&document.activeElement===de&&(K.preventDefault(),T.focus())},ce=()=>{const K=A.current;if(!K)return;const G=K.scrollHeight-K.scrollTop-K.clientHeight<24;U(G)},Z=async()=>{try{await navigator.clipboard.writeText(i.map(K=>K.raw).join(` +`))}catch{}},oe=E.useMemo(()=>{const K=new Map;for(const G of i)K.set(G.level,(K.get(G.level)??0)+1);return K},[i]);return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-3 backdrop-blur-sm sm:p-6",onClick:e,children:y.jsxs("div",{ref:H,role:"dialog","aria-modal":"true","aria-labelledby":"log-viewer-title",onKeyDown:pe,className:"animate-modal-in flex h-[min(84dvh,760px)] w-[clamp(560px,85vw,1500px)] min-h-0 flex-col overflow-hidden rounded-xl border border-frame-line glass-panel sm:rounded-2xl",onClick:K=>K.stopPropagation(),children:[y.jsxs("div",{className:"flex flex-wrap items-center gap-3 border-b border-line px-5 py-4 sm:px-6",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[y.jsx("span",{className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(Na,{className:"h-5 w-5 text-chip-indigo-text","aria-hidden":"true"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"log-viewer-title",className:"text-base font-semibold text-ink",children:"Application logs"}),y.jsxs("p",{className:"truncate font-mono text-xs text-ink-muted",children:[o,y.jsxs("span",{className:"text-ink-faint",children:[" · ",W2(u)]})]})]})]}),y.jsxs("div",{className:"relative min-w-[220px] flex-1",children:[y.jsx(oO,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-ink-faint","aria-hidden":"true"}),y.jsx("input",{ref:L,type:"search",value:g,onChange:K=>b(K.target.value),placeholder:"Filter log lines…","aria-label":"Filter log lines",className:"w-full rounded-lg border border-line bg-elevated py-1.5 pl-8 pr-2.5 font-mono text-xs text-ink placeholder:text-ink-faint focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400"})]}),y.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[y.jsx(Xe,{text:S?"Pause live tail":"Resume live tail",block:!1,children:y.jsxs("button",{type:"button",onClick:()=>C(K=>!K),"aria-pressed":S,className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1.5 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400 ${S?"border-status-success-border bg-status-success-bg text-status-success-text":"border-line bg-elevated text-ink-muted hover:text-ink"}`,children:[y.jsx("span",{className:`h-2 w-2 rounded-full ${S?"bg-emerald-400":"bg-ink-faint"}`,"aria-hidden":"true"}),S?"Live":"Paused"]})}),y.jsx(Xe,{text:"Refresh now",block:!1,children:y.jsx("button",{type:"button",onClick:()=>void re(),disabled:v,className:"rounded-lg border border-line bg-elevated p-2 text-ink-muted hover:text-ink disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Kd,{className:`h-4 w-4 ${v?"animate-spin":""}`,"aria-hidden":"true"})})}),y.jsx(Xe,{text:"Copy visible lines",block:!1,children:y.jsx("button",{type:"button",onClick:()=>void Z(),disabled:i.length===0,className:"rounded-lg border border-line bg-elevated p-2 text-ink-muted hover:text-ink disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(mi,{className:"h-4 w-4","aria-hidden":"true"})})}),y.jsx(Xe,{text:"Open log file in the default application",block:!1,children:y.jsx("button",{type:"button",onClick:()=>{t==null||t(),e()},className:"rounded-lg border border-line bg-elevated p-2 text-ink-muted hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(rO,{className:"h-4 w-4","aria-hidden":"true"})})}),y.jsx(Xe,{text:"Close",block:!1,children:y.jsx("button",{ref:M,type:"button",onClick:e,className:"rounded-lg p-2 text-ink-muted hover:bg-hover-surface hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Li,{className:"h-4 w-4","aria-hidden":"true"})})})]})]}),y.jsxs("div",{ref:A,onScroll:ce,className:"min-h-0 flex-1 overflow-y-auto overscroll-contain bg-app px-2 py-2 font-mono text-xs leading-relaxed sm:px-3",children:[y.jsxs("div",{className:"sticky top-0 z-10 mb-1 flex items-center gap-2 rounded-md border border-line/40 bg-surface/60 px-2 py-1 text-[10px] font-bold uppercase tracking-wider text-ink-muted shadow-sm backdrop-blur-md",role:"row",children:[y.jsx("span",{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),y.jsx("span",{className:"w-[138px] shrink-0 text-ink/70",children:"Time"}),y.jsx("span",{className:"w-[52px] shrink-0 text-ink/70",children:"Level"}),y.jsx("span",{className:"w-[150px] shrink-0 text-ink/70",children:"Source"}),y.jsx("span",{className:"min-w-0 flex-1 text-ink/70",children:"Message"})]}),N&&y.jsx("p",{role:"alert",className:"px-3 py-6 text-center text-xs text-status-danger-text",children:N}),!N&&i.length===0&&!v&&y.jsx("p",{className:"px-3 py-6 text-center text-xs text-ink-faint",children:"No log entries match the current filters."}),y.jsx("ul",{className:"space-y-0.5",children:i.map((K,G)=>{const T=K2[K.level]??K2.UNKNOWN,de=T.icon,be=K.level==="ERROR"||K.level==="CRITICAL";return y.jsxs("li",{className:`group flex items-start gap-2 rounded px-2 py-1 ${be?"bg-status-danger-bg/40":"hover:bg-elevated/50"}`,children:[y.jsx("span",{className:T.className,children:y.jsx(de,{className:"mt-0.5 h-3.5 w-3.5","aria-hidden":"true"})}),y.jsx("span",{className:"w-[138px] shrink-0 text-ink-faint",children:K.timestamp}),y.jsx("span",{className:`w-[52px] shrink-0 text-[10px] font-semibold ${T.className}`,children:K.level}),y.jsx("span",{className:"w-[150px] shrink-0 truncate text-ink-faint",title:K.source,children:K.source}),y.jsx("span",{className:"min-w-0 flex-1 break-words text-ink-secondary",children:K.message})]},`${G}-${K.raw}`)})})]}),y.jsx("div",{className:"border-t border-line/60 bg-elevated/50 px-5 py-2.5 text-[11px] text-ink-faint shadow-sm backdrop-blur-md sm:px-6",children:y.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-2",children:[y.jsx("span",{className:"mr-auto min-w-0 max-w-full basis-full truncate sm:basis-auto",role:"status","aria-atomic":"true",children:v&&i.length===0?"Loading log entries…":`${i.length} of ${W2(u)} shown`}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("div",{className:"flex overflow-hidden rounded-lg border border-line/60 text-[11px] backdrop-blur-sm",role:"group","aria-label":"Filter by log level",children:l8.map(K=>{const G=d===K.value,T=K.value?oe.get(K.value)??0:i.length;return y.jsxs("button",{type:"button",onClick:()=>m(K.value),"aria-pressed":G,title:K.value?`Show ${K.value} and above`:"Show all levels",className:`flex items-center gap-1 px-2.5 py-1 font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-400 ${G?"bg-indigo-600 text-white":"text-ink-muted hover:bg-elevated hover:text-ink"}`,children:[K.label,y.jsx("span",{className:G?"text-chip-indigo-text":"text-ink-faint",children:T})]},K.label)})}),y.jsx(Xe,{text:"Scroll to the newest entry",block:!1,children:y.jsxs("button",{type:"button",onClick:()=>U(!0),"aria-pressed":D,className:`flex items-center gap-1.5 rounded-lg border px-2.5 py-1 text-xs font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400 ${D?"border-chip-indigo-border bg-chip-indigo-bg text-chip-indigo-text":"border-line bg-elevated text-ink-muted hover:text-ink"}`,children:[y.jsx(tO,{className:"h-3.5 w-3.5","aria-hidden":"true"}),y.jsx("span",{className:"hidden sm:inline",children:"Follow tail"})]})})]}),y.jsxs("span",{className:"hidden items-center gap-1.5 lg:flex",children:[y.jsx("span",{className:"hidden sm:inline",children:"Ctrl + Shift + L"}),y.jsx("span",{children:"toggles this viewer"})]})]})})]})}):null}function W2(n){return n<1024?`${n} B`:n<1024*1024?`${(n/1024).toFixed(1)} KB`:`${(n/(1024*1024)).toFixed(1)} MB`}function o8({isOpen:n,onClose:e}){const t=E.useRef(null),i=ms({isOpen:n,onClose:e,dialogRef:t});if(!n)return null;const l=[{key:"F5",desc:"Refresh / re-scan file list"},{key:"Ctrl + R",desc:"Reload configuration & scan"},{key:"Enter",desc:"Execute / launch selected file"},{key:"P",desc:"Open properties for selected file"},{key:"↑ / ↓",desc:"Navigate file list"},{key:"Home / End",desc:"Jump to first / last file"},{key:"PageUp / PageDown",desc:"Page through the file list"},{key:"Ctrl + D",desc:"Focus Directory field"},{key:"Ctrl + E",desc:"Focus Extension field"},{key:"Ctrl + F",desc:"Focus Filter / Search field"},{key:"Ctrl + L",desc:"Focus File List"},{key:"Ctrl + Shift + L",desc:"Open the log viewer"},{key:"Ctrl + ,",desc:"Open the config editor"},{key:"Ctrl + Shift + T",desc:"Toggle theme (Dark / Light)"},{key:"Ctrl + B",desc:"Toggle barcode scanner mode"},{key:"Ctrl + Shift + B",desc:"Open webcam / camera barcode scanner"},{key:"Ctrl + T",desc:"Open auto-rescan timer modal"},{key:"Ctrl + H",desc:"Set directory to home folder"},{key:"? or Ctrl + /",desc:"Show keyboard shortcuts"},{key:"Y / S / N",desc:"Answer workflow guard: Yes / Skip / No (prompt open)"},{key:"Enter",desc:"Confirm active workflow prompt (prompt open)"},{key:"Escape",desc:"Close dialogs / context menu"}];return y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",children:y.jsxs("div",{ref:t,role:"dialog","aria-modal":"true","aria-label":"Keyboard Shortcuts",onKeyDown:i,className:"animate-modal-in w-[450px] max-w-full rounded-2xl border border-frame-line glass-panel p-5",children:[y.jsxs("div",{className:"mb-4 flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2 font-semibold text-ink",children:[y.jsx(lO,{className:"h-5 w-5 text-chip-indigo-text"}),y.jsx("span",{children:"Keyboard Shortcuts"})]}),y.jsx("button",{onClick:e,className:"focus-ring rounded-lg p-1 text-ink-muted hover:bg-elevated hover:text-ink",children:y.jsx(Li,{className:"h-4 w-4"})})]}),y.jsx("div",{className:"max-h-[60vh] space-y-2 overflow-y-auto pr-1 text-xs",children:l.map(({key:o,desc:a})=>y.jsxs("div",{className:"flex items-center justify-between rounded-lg bg-elevated/50 px-3 py-2",children:[y.jsx("span",{className:"text-ink-secondary",children:a}),y.jsx("kbd",{className:"rounded bg-app px-2 py-0.5 font-mono text-[11px] font-semibold text-chip-indigo-text border border-line",children:o})]},o))}),y.jsx("div",{className:"mt-5 flex justify-end",children:y.jsx("button",{onClick:e,className:"btn btn-primary rounded-lg px-4 py-2 font-semibold",children:"Close"})})]})})}function a8({isOpen:n,activeConfigPath:e,configExists:t=!0,onClose:i,onLoaded:l}){const[o,a]=E.useState(null),[u,f]=E.useState(""),[d,m]=E.useState(null),[g,b]=E.useState(!1),[v,w]=E.useState(null),S=E.useRef(null),C=E.useRef(null),N=E.useRef(null),j=t===!1;E.useEffect(()=>{var W;if(!n){(W=N.current)==null||W.focus();return}N.current=document.activeElement instanceof HTMLElement?document.activeElement:null,w(null);const A=e??"",L=Math.max(A.lastIndexOf("/"),A.lastIndexOf("\\")),ne=L>0?A.slice(0,L):"";D(ne);const F=requestAnimationFrame(()=>{var I;return(I=C.current)==null?void 0:I.focus()});return()=>{var I;cancelAnimationFrame(F),(I=N.current)==null||I.focus()}},[n,e]);const D=async A=>{b(!0),w(null);try{const L=await EM(A);a(L),f(L.current_path),e&&L.items.some(ne=>ne.path===e)?m(e):m(null)}catch(L){w(L.message||"Navigation failed")}finally{b(!1)}},U=A=>{var W;if(A.key==="Escape"){A.preventDefault(),i();return}if(A.key!=="Tab")return;const L=(W=S.current)==null?void 0:W.querySelectorAll('button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(!(L!=null&&L.length))return;const ne=L[0],F=L[L.length-1];A.shiftKey&&document.activeElement===ne?(A.preventDefault(),F.focus()):!A.shiftKey&&document.activeElement===F&&(A.preventDefault(),ne.focus())},H=async()=>{var L;const A=d||(((L=o==null?void 0:o.items.find(ne=>ne.is_config))==null?void 0:L.path)??null);if(!A){w("Select a configuration file to load.");return}try{b(!0);const ne=await CM(A);l(ne),i()}catch(ne){w(ne.message||"Unable to load configuration")}finally{b(!1)}},M=async()=>{const A=(u||(o==null?void 0:o.current_path)||"").trim();if(!A){w("Choose a directory before creating a configuration.");return}try{b(!0);const L=await NM(A);l(L),i()}catch(L){w(L.message||"Unable to create configuration")}finally{b(!1)}};return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-3 backdrop-blur-sm sm:p-6",onClick:i,children:y.jsxs("div",{ref:S,role:"dialog","aria-modal":"true","aria-labelledby":"load-config-title",onKeyDown:U,className:"animate-modal-in flex h-[min(84dvh,760px)] max-h-[calc(100dvh-1.5rem)] w-[min(94vw,960px)] min-h-0 flex-col overflow-hidden rounded-xl border border-frame-line glass-panel sm:rounded-2xl",onClick:A=>A.stopPropagation(),children:[y.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-line px-4 py-3 sm:px-5",children:[y.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx("span",{className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg bg-chip-indigo-bg",children:y.jsx(fa,{className:"h-5 w-5 text-chip-indigo-text"})}),y.jsxs("div",{className:"min-w-0",children:[y.jsx("h2",{id:"load-config-title",className:"text-sm font-semibold text-ink",children:j?"Create configuration":"Load configuration"}),y.jsx("p",{className:"truncate font-mono text-xs text-ink-muted",children:(o==null?void 0:o.current_path)||""})]})]}),y.jsx(Xe,{text:"Close",block:!1,children:y.jsx("button",{type:"button",onClick:i,"aria-label":"Close configuration modal",className:"grid h-9 w-9 shrink-0 place-items-center rounded-lg text-ink-muted transition-colors hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Li,{className:"h-4 w-4"})})})]}),j&&y.jsx("div",{className:"border-b border-line bg-chip-indigo-bg/20 px-4 py-3 text-xs text-ink-secondary",children:"No configuration file was found. Create one here?"}),y.jsxs("div",{className:"border-b border-line px-4 py-3 sm:px-5",children:[y.jsx("label",{htmlFor:"config-path-input",className:"mb-1.5 block text-xs font-medium text-ink-secondary",children:"Configuration directory"}),y.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[y.jsx("input",{ref:C,id:"config-path-input",type:"text",value:u,onChange:A=>f(A.target.value),onKeyDown:A=>{A.key==="Enter"&&D(u.trim())},placeholder:"/path/to/directory",className:"h-10 min-w-0 flex-1 rounded-lg border border-line bg-elevated px-2.5 font-mono text-sm text-ink outline-none placeholder:text-ink-faint transition-colors hover:bg-surface-strong focus-visible:border-indigo-500 focus-visible:ring-2 focus-visible:ring-indigo-500/30"}),y.jsx("button",{type:"button",onClick:()=>D(u.trim()),className:"inline-flex h-10 shrink-0 items-center gap-1.5 rounded-lg border border-line bg-elevated px-3.5 text-sm font-medium text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Go"}),y.jsx(Xe,{text:"Home directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>D(""),"aria-label":"Home directory",className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Gd,{className:"h-4 w-4"})})}),(o==null?void 0:o.parent_path)&&y.jsx(Xe,{text:"Parent directory",block:!1,children:y.jsx("button",{type:"button",onClick:()=>D(o.parent_path),"aria-label":"Parent directory",className:"grid h-10 w-10 shrink-0 place-items-center rounded-lg border border-line bg-elevated text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:y.jsx(Yd,{className:"h-4 w-4 rotate-180"})})})]})]}),y.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-2 py-2 sm:px-3 sm:py-3","aria-busy":g,children:g?y.jsxs("div",{className:"flex h-full items-center justify-center gap-2.5 text-sm text-ink-muted",children:[y.jsx(ul,{className:"h-5 w-5 animate-spin text-chip-indigo-text"}),y.jsx("span",{role:"status",children:"Loading configuration files…"})]}):v?y.jsxs("div",{role:"alert",className:"flex h-full flex-col items-center justify-center gap-2.5 text-center",children:[y.jsx("p",{className:"text-sm text-status-danger-text",children:v}),y.jsx("button",{type:"button",onClick:()=>D(u||(o==null?void 0:o.current_path)||""),className:"min-h-10 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Retry"})]}):y.jsxs("ul",{className:"space-y-1",children:[o==null?void 0:o.items.map(A=>{if(A.is_dir)return y.jsx("li",{children:y.jsx("button",{onClick:()=>D(A.path),onDoubleClick:()=>D(A.path),className:"flex w-full items-center justify-between rounded-md px-3 py-1.5 text-left text-xs text-ink-secondary hover:bg-elevated",children:y.jsxs("span",{className:"flex items-center gap-2",children:[y.jsx(Au,{className:"h-3.5 w-3.5 text-chip-indigo-text"}),A.name]})})},A.path);const L=d===A.path;return y.jsx("li",{children:y.jsxs("button",{type:"button",onClick:()=>m(A.path),"aria-pressed":L,className:`flex w-full items-center justify-between rounded-lg px-3 py-1.5 text-left text-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-indigo-400 ${L?"bg-chip-indigo-bg text-chip-indigo-text":"text-ink-secondary hover:bg-elevated hover:text-ink"}`,children:[y.jsxs("span",{className:"flex min-w-0 items-center gap-2.5",children:[y.jsx(Na,{className:"h-5 w-5 shrink-0 text-chip-amber-text"}),y.jsx("span",{className:"truncate",children:A.name})]}),A.is_config&&y.jsx(fa,{className:"h-4 w-4 shrink-0 text-chip-indigo-text"}),L&&y.jsx(Pr,{className:"h-4 w-4 shrink-0 text-chip-indigo-text"})]})},A.path)}),(o==null?void 0:o.items.filter(A=>A.is_config).length)===0&&y.jsxs("li",{className:"flex h-full min-h-36 flex-col items-center justify-center gap-2.5 text-center text-sm text-ink-muted",children:[y.jsx(Na,{className:"h-7 w-7 text-ink-faint"}),"No configuration files found"]})]})}),y.jsxs("div",{className:"flex flex-col gap-2 border-t border-line px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:px-5",children:[y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("p",{className:"mb-0.5 text-xs font-medium text-ink-muted",children:"Selected file"}),y.jsx("p",{className:"truncate font-mono text-sm text-ink",title:d||u,children:d||u||"—"})]}),y.jsxs("div",{className:"flex shrink-0 justify-end gap-1.5",children:[y.jsx("button",{type:"button",onClick:i,className:"min-h-10 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Cancel"}),j?y.jsxs("button",{type:"button",onClick:M,disabled:!u.trim(),className:"btn btn-primary min-h-10 rounded-lg px-4 text-sm font-semibold",children:[y.jsx(fa,{className:"h-4 w-4"}),"Create configuration"]}):y.jsxs("button",{type:"button",onClick:H,disabled:!d,className:"btn btn-primary min-h-10 rounded-lg px-4 text-sm font-semibold",children:[y.jsx(fa,{className:"h-4 w-4"}),"Load configuration"]})]})]})]})}):null}function bA({isOpen:n,onClose:e,initialFilePath:t,md5:i}){const[l,o]=E.useState(null),[a,u]=E.useState(""),[f,d]=E.useState([]),[m,g]=E.useState(!1),[b,v]=E.useState(null),[w,S]=E.useState(null),[C,N]=E.useState(!1),[j,D]=E.useState(!1),[U,H]=E.useState(null),M=E.useRef(null),A=E.useRef(0),L=E.useRef(null),ne=ms({isOpen:n,onClose:e,dialogRef:M});E.useEffect(()=>{n||L.current!==null&&(window.clearTimeout(L.current),L.current=null)},[n]),E.useEffect(()=>{if(!n)return;async function T(){if(t){g(!0);try{const de=await Qk({filePath:t});o(de.image),u(de.content),F(de.content)}catch(de){v(de.message)}finally{g(!1)}}}T()},[n,t]);const F=T=>{const de=T.split(";").map(be=>{const z=be.split("=");return{key:z[0]||"",value:z[1]||""}}).filter(be=>be.key||be.value);d(de)},W=async T=>{const de=++A.current;try{const be=await Qk({content:T});if(A.current!==de)return;o(be.image),S(null)}catch(be){if(A.current!==de)return;S(be instanceof Error?be.message:"Failed to generate the barcode")}},I=T=>{const de=T.filter(be=>be.key.trim()).map(be=>`${be.key.trim()}=${be.value.trim()}`).join(";");if(u(de),L.current!==null&&(window.clearTimeout(L.current),L.current=null),!de){A.current+=1,o(null),S(null);return}L.current=window.setTimeout(()=>void W(de),250)},re=(T,de,be)=>{const z=[...f];z[T][de]=be,d(z),I(z)},pe=()=>{const T=[...f,{key:"",value:""}];d(T)},ce=T=>{const de=f.filter((be,z)=>z!==T);d(de),I(de)},Z=()=>{if(!i||f.some(de=>de.key.toLowerCase()==="md5"))return;const T=[...f,{key:"md5",value:i}];d(T),I(T)},oe=async()=>{if(l){H("Saving…");try{const T=await LM(l,`profiles-qr-${Date.now()}.png`);H(T.path||T.message)}catch(T){H(`Save failed: ${(T==null?void 0:T.message)??T}`)}finally{setTimeout(()=>H(null),6e3)}}},K=async()=>{try{await navigator.clipboard.writeText(a),N(!0),setTimeout(()=>N(!1),2e3)}catch(T){console.error("Copy failed",T)}},G=async()=>{if(l)try{const de=await(await fetch(l)).blob();await navigator.clipboard.write([new ClipboardItem({[de.type]:de})]),D(!0),setTimeout(()=>D(!1),2e3)}catch(T){console.error("Image copy failed",T)}};return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4",onClick:e,children:y.jsxs("div",{ref:M,role:"dialog","aria-modal":"true","aria-label":"QR Code Settings",onKeyDown:ne,className:"animate-modal-in w-full max-w-md rounded-xl border border-frame-line glass-panel p-6",onClick:T=>T.stopPropagation(),children:[y.jsxs("div",{className:"mb-4 flex items-center justify-between",children:[y.jsx("h3",{className:"text-sm font-semibold text-ink",children:"QR Code Settings"}),y.jsx("button",{onClick:e,className:"focus-ring rounded-md p-1 text-ink-muted hover:bg-elevated hover:text-ink",children:y.jsx(Li,{className:"h-4 w-4"})})]}),m?y.jsx("div",{className:"flex h-48 items-center justify-center",children:y.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent"})}):b?y.jsx("div",{className:"rounded-md border border-status-danger-border bg-status-danger-bg p-4 text-center text-xs text-status-danger-text",children:b}):y.jsxs("div",{className:"space-y-6",children:[y.jsxs("div",{className:"flex flex-col items-center gap-4",children:[y.jsxs("div",{className:"relative group",children:[y.jsx("div",{className:"h-48 w-48 overflow-hidden rounded-lg border border-line bg-white p-2",children:l?y.jsx("img",{src:l,alt:"QR Code",className:"h-full w-full object-contain"}):y.jsx("div",{className:"flex h-full items-center justify-center text-xs text-slate-400",children:"No content"})}),l&&y.jsx("div",{className:"absolute inset-0 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity bg-black/20 rounded-lg",children:y.jsxs("button",{onClick:G,className:"focus-ring flex items-center gap-2 rounded-md bg-white/90 p-2 text-xs font-medium text-slate-900 shadow-sm hover:bg-white",children:[j?y.jsx(Pr,{className:"h-3.5 w-3.5"}):y.jsx(mi,{className:"h-3.5 w-3.5"}),j?"Copied":"Copy Image"]})})]}),y.jsxs("div",{className:"flex w-full gap-2",children:[y.jsxs("button",{onClick:K,className:"btn btn-secondary flex-1 px-3 py-1.5",children:[C?y.jsx(Pr,{className:"h-3.5 w-3.5 text-status-success-text"}):y.jsx(mi,{className:"h-3.5 w-3.5"}),"Copy Content"]}),y.jsxs("button",{onClick:oe,disabled:!l,className:"btn btn-primary flex-1 px-3 py-1.5",children:[y.jsx(iO,{className:"h-3.5 w-3.5"}),"Save Image"]})]}),U&&y.jsx("p",{className:"break-all text-center text-[11px] text-ink-muted",role:"status",children:U}),w&&y.jsx("p",{role:"alert",className:"break-all text-center text-[11px] text-status-danger-text",children:w})]}),y.jsxs("div",{className:"space-y-3",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("label",{className:"text-xs font-medium text-ink-muted uppercase tracking-wider",children:"Payload Fields"}),y.jsxs("div",{className:"flex gap-2",children:[i&&!f.some(T=>T.key==="md5")&&y.jsxs("button",{onClick:Z,className:"btn-chip flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-bold text-chip-purple-text border border-chip-purple-border",children:[y.jsx(ha,{className:"h-3 w-3"})," Inc. MD5"]}),y.jsxs("button",{onClick:pe,className:"btn-chip flex items-center gap-1 rounded px-2 py-0.5 text-[10px] font-bold text-chip-indigo-text border border-chip-indigo-border",children:[y.jsx(sD,{className:"h-3 w-3"})," Add Field"]})]})]}),y.jsxs("div",{className:"max-h-48 space-y-2 overflow-y-auto pr-1 custom-scrollbar",children:[f.map((T,de)=>y.jsxs("div",{className:"flex gap-2 items-center slide-in",children:[y.jsx("input",{type:"text",placeholder:"key",value:T.key,onChange:be=>re(de,"key",be.target.value),className:"w-1/3 rounded border border-line bg-elevated px-2 py-1 text-xs text-ink focus:border-indigo-500 focus:outline-none"}),y.jsx("input",{type:"text",placeholder:"value",value:T.value,onChange:be=>re(de,"value",be.target.value),className:"flex-1 rounded border border-line bg-elevated px-2 py-1 text-xs text-ink focus:border-indigo-500 focus:outline-none"}),y.jsx("button",{onClick:()=>ce(de),className:"p-1 text-ink-muted hover:text-status-danger-text transition-colors","aria-label":"Remove field",children:y.jsx(cO,{className:"h-3.5 w-3.5"})})]},de)),f.length===0&&y.jsx("p",{className:"text-center py-4 text-xs text-ink-muted italic",children:"No fields defined"})]})]}),y.jsxs("div",{className:"pt-2 border-t border-line",children:[y.jsx("label",{className:"text-[10px] font-medium text-ink-muted uppercase tracking-wider block mb-1.5",children:"Raw Preview"}),y.jsx("div",{className:"rounded bg-elevated p-2 font-mono text-[10px] text-ink-secondary break-all border border-line",children:a||y.jsx("span",{className:"italic text-ink-muted/50",children:"empty"})})]})]})]})}):null}const Z2=["Bytes","KB","MB","GB","TB"];function vA(n){if(n===0)return"0 Bytes";const e=1024,t=Math.max(0,Math.min(Z2.length-1,Math.floor(Math.log(n)/Math.log(e))));return parseFloat((n/Math.pow(e,t)).toFixed(2))+" "+Z2[t]}function c8(n){const e=Math.max(n.lastIndexOf("\\"),n.lastIndexOf("/"));return e===-1?"":n.slice(0,e)}function u8(n){const e=[`File Properties: ${n.name}`,`Path: ${n.path}`,`Type: ${n.type}`,`Size: ${vA(n.size_bytes)}`,`Created: ${n.created}`,`Modified: ${n.modified}`];return n.md5&&e.push(`MD5: ${n.md5}`),n.sha256&&e.push(`SHA256: ${n.sha256}`),e.join(` +`)}function j0(n,e,t){return n.length<=e+t+1?n:`${n.slice(0,e)}…${n.slice(-t)}`}function f8(n){const e=n.includes("\\")?"\\":"/",t=n.split(/[\\/]/);return t.length<=5?n:[t[0],t[1],"…",t[t.length-2],t[t.length-1]].join(e)}const h8=[{ms:1e3*60,unit:"minute"},{ms:1e3*60*60,unit:"hour"},{ms:1e3*60*60*24,unit:"day"},{ms:1e3*60*60*24*30,unit:"month"},{ms:1e3*60*60*24*365,unit:"year"}];function J2(n,e=new Date){const t=new Date(n.replace(" ","T"));if(Number.isNaN(t.getTime()))return"just now";const i=e.getTime()-t.getTime();if(i<6e4)return"just now";let l="just now";for(const{ms:o,unit:a}of h8){if(i{var I;n||((I=D.current)==null||I.focus(),v(!1))},[n]),E.useEffect(()=>{if(!n||!e)return;const I=new AbortController;return U.current=I,o(null),N(null),u(!0),d(null),(async()=>{try{const re=await jM(e.path,I.signal);if(U.current!==I)return;o(re)}catch(re){if(U.current!==I||re instanceof DOMException&&re.name==="AbortError")return;d(re instanceof Error?re.message:"Failed to load properties")}finally{U.current===I&&u(!1)}})(),()=>{U.current=null,I.abort()}},[n,e]),E.useEffect(()=>{if(!n)return;const I=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=I}},[n]),E.useEffect(()=>{if(!n)return;const I=re=>{if(re.key==="Escape"){if(b)return;t();return}if(re.key!=="Tab")return;const pe=j.current;if(!pe)return;const ce=Array.from(pe.querySelectorAll('button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])')).filter(G=>G.offsetParent!==null);if(ce.length===0)return;const Z=ce[0],oe=ce[ce.length-1],K=document.activeElement instanceof HTMLElement?document.activeElement:null;re.shiftKey?(K===Z||!pe.contains(K))&&(re.preventDefault(),oe.focus()):K===oe&&(re.preventDefault(),Z.focus())};return window.addEventListener("keydown",I),()=>window.removeEventListener("keydown",I)},[n,b,t]),E.useEffect(()=>{if(!n)return;const I=document.activeElement instanceof HTMLElement?document.activeElement:null;D.current=I;const re=requestAnimationFrame(()=>{var pe,ce;(ce=(pe=j.current)==null?void 0:pe.querySelector("button"))==null||ce.focus()});return()=>cancelAnimationFrame(re)},[n]);const H=async(I,re)=>{try{await navigator.clipboard.writeText(I),g(re),setTimeout(()=>g(null),2e3)}catch(pe){console.error("Failed to copy:",pe)}},M=async(I,re,pe)=>{S(I),N(null);try{await pe(),N(re)}catch{N("Action failed")}finally{S(null)}},A=I=>`btn btn-chip rounded-md border px-3 py-2 text-xs ${{reveal:"bg-chip-sky-bg text-chip-sky-text border-chip-sky-border",launch:"border-emerald-500/30 bg-emerald-600 font-semibold text-white hover:bg-emerald-500",folder:"bg-chip-amber-bg text-chip-amber-text border-chip-amber-border"}[I]??"bg-chip-indigo-bg text-chip-indigo-text border-chip-indigo-border"}`,L=(I,re,pe,ce=!1,Z)=>y.jsxs("div",{className:"flex items-start gap-2 py-1.5 group",children:[y.jsxs("span",{className:"text-ink-muted min-w-[100px] text-xs",children:[I,":"]}),y.jsx("div",{className:"flex-1 min-w-0",children:y.jsx("span",{className:`text-ink text-xs break-all ${ce?"font-mono":""}`,children:Z??re})}),y.jsx(Xe,{text:"Copy to clipboard",block:!1,children:y.jsx("button",{onClick:()=>H(re,pe),className:"opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-elevated","aria-label":`Copy ${I}`,children:m===pe?y.jsx(Pr,{className:"h-3.5 w-3.5 text-status-success-text"}):y.jsx(mi,{className:"h-3.5 w-3.5 text-ink-muted"})})})]}),ne=(I,re,pe)=>y.jsxs("div",{className:"rounded-lg border border-line bg-elevated p-4",children:[y.jsxs("div",{className:"mb-1 flex items-center gap-2",children:[re,y.jsx("span",{className:"text-xs font-semibold uppercase tracking-wide text-ink-muted",children:I})]}),pe]}),F=()=>y.jsx(Xe,{text:"Click to copy full path",children:y.jsxs("button",{onClick:()=>void H(l.path,"path"),className:"group mb-3 flex w-full items-center gap-2 rounded-lg border border-line bg-elevated px-3 py-2 text-left hover:bg-surface",children:[y.jsx(Au,{className:"text-chip-amber-text h-4 w-4 flex-shrink-0"}),y.jsx("span",{className:"text-ink min-w-0 flex-1 truncate font-mono text-xs",children:f8(l.path)}),m==="path"?y.jsx(Pr,{className:"text-status-success-text h-3.5 w-3.5"}):y.jsx(mi,{className:"text-ink-muted h-3.5 w-3.5"})]})});if(!n||!e)return null;const W=e;return y.jsxs("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 backdrop-blur-md p-4",role:"dialog","aria-modal":"true","aria-labelledby":"properties-modal-title",children:[y.jsx("div",{className:"absolute inset-0",onClick:t,onContextMenu:I=>{I.preventDefault(),t()}}),y.jsxs("div",{ref:j,className:"animate-modal-in relative w-full max-w-4xl max-h-[90vh] overflow-hidden rounded-xl border border-frame-line glass-panel flex flex-col",children:[y.jsx("div",{className:"flex-shrink-0 border-b border-line px-6 py-4",children:y.jsxs("div",{className:"flex items-start justify-between gap-4",children:[y.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[y.jsx("div",{className:"rounded-lg bg-indigo-600 p-2 flex-shrink-0",children:y.jsx(Jg,{className:"h-5 w-5 text-white"})}),y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("h3",{id:"properties-modal-title",className:"text-base font-semibold text-ink truncate",children:"File Properties"}),y.jsx("p",{className:"text-xs text-ink-muted truncate",children:e.filename})]}),y.jsx(Xe,{text:"Copy all properties to clipboard",block:!1,children:y.jsx("button",{onClick:()=>{l&&H(u8(l),"all")},disabled:!l||a||f!==null,className:"btn-chip ml-2 flex items-center gap-1 rounded-md border border-chip-indigo-border bg-chip-indigo-bg p-1.5 text-chip-indigo-text","aria-label":"Copy all properties",children:m==="all"?y.jsx(Pr,{className:"h-4 w-4 text-status-success-text"}):y.jsx(mi,{className:"h-4 w-4"})})}),y.jsx(Xe,{text:"Generate Barcode/QR Code",block:!1,children:y.jsx("button",{onClick:()=>v(!0),className:"btn-chip rounded-md border border-chip-indigo-border bg-chip-indigo-bg p-1.5 text-chip-indigo-text",children:y.jsx(vy,{className:"h-4 w-4"})})})]}),y.jsx("button",{onClick:t,className:"focus-ring rounded-md p-1 text-ink-muted hover:bg-elevated hover:text-ink flex-shrink-0","aria-label":"Close",children:y.jsx(Li,{className:"h-4 w-4"})})]})}),y.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-4",children:[a&&y.jsx("div",{className:"flex items-center justify-center py-8",children:y.jsxs("div",{className:"flex flex-col items-center gap-2",children:[y.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-indigo-600 border-t-transparent"}),y.jsx("p",{className:"text-xs text-ink-muted",children:"Loading properties..."})]})}),f&&y.jsx("div",{className:"rounded-lg border border-status-danger-border bg-status-danger-bg p-4 text-center",children:y.jsx("p",{className:"text-xs text-status-danger-text",children:f})}),l&&!a&&!f&&y.jsxs("div",{children:[y.jsxs("div",{className:"mb-2 flex flex-wrap items-center gap-x-4 gap-y-1.5 rounded-lg border border-line bg-elevated px-4 py-2.5",children:[y.jsx("span",{className:"inline-flex items-center gap-1 rounded-md border border-chip-indigo-border bg-chip-indigo-bg px-2 py-0.5 text-xs font-semibold text-chip-indigo-text",children:l.type}),l.attributes.extension&&y.jsx("span",{className:"inline-flex items-center rounded-md border border-line bg-surface px-2 py-0.5 text-xs font-medium text-ink-muted",children:l.attributes.extension}),y.jsxs("span",{className:"text-xs text-ink-muted",title:`${l.size_bytes} bytes`,children:["Size ",y.jsx("strong",{className:"text-ink font-medium",children:vA(l.size_bytes)})]}),y.jsxs("span",{className:"text-xs text-ink-muted",title:l.created,children:["Created ",y.jsx("strong",{className:"text-ink font-medium",children:J2(l.created)})]}),y.jsxs("span",{className:"text-xs text-ink-muted",title:l.modified,children:["Modified ",y.jsx("strong",{className:"text-ink font-medium",children:J2(l.modified)})]}),l.md5&&y.jsx("span",{className:"inline-flex items-center rounded-md border border-chip-purple-border bg-chip-purple-bg px-2 py-0.5 font-mono text-xs font-medium text-chip-purple-text",title:`MD5 ${l.md5}`,children:j0(l.md5,4,4)}),l.attributes.is_symlink&&y.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-chip-fuchsia-border bg-chip-fuchsia-bg px-2 py-0.5 text-xs font-medium text-chip-fuchsia-text",children:[y.jsx(K4,{className:"h-3 w-3"})," Symlink"]})]}),F(),y.jsxs("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[ne("Hashes",y.jsx(ha,{className:"text-chip-purple-text h-3.5 w-3.5"}),y.jsxs("div",{className:"space-y-0.5",children:[L("MD5",l.md5,"md5",!0,j0(l.md5,10,6)),L("SHA256",l.sha256,"sha256",!0,j0(l.sha256,10,6))]})),ne("Timestamps",y.jsx(r4,{className:"text-chip-sky-text h-3.5 w-3.5"}),y.jsxs("div",{className:"space-y-0.5",children:[L("Created",l.created,"created",!0),L("Modified",l.modified,"modified",!0)]})),ne("Identity",y.jsx(Jg,{className:"text-chip-indigo-text h-3.5 w-3.5"}),y.jsxs("div",{className:"space-y-0.5",children:[L("Type",l.type,"type"),l.attributes.stem&&L("Stem",l.attributes.stem,"attrStem"),L("Extension",l.name.includes(".")?l.name.slice(l.name.lastIndexOf(".")):"None","extension"),L("Directory",c8(l.path)||"None","directory",!0)]})),ne("System",y.jsx(Jg,{className:"text-status-success-text h-3.5 w-3.5"}),y.jsxs("div",{children:[y.jsxs("div",{className:"mb-1 flex min-h-[24px] flex-wrap items-center gap-1.5",children:[l.attributes.is_readonly&&y.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-status-danger-border bg-status-danger-bg px-2 py-0.5 text-xs text-status-danger-text",children:[y.jsx(J4,{className:"h-3 w-3"})," Read-only"]}),l.attributes.is_hidden&&y.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md border border-line bg-elevated px-2 py-0.5 text-xs text-ink-muted",children:[y.jsx(T4,{className:"h-3 w-3"})," Hidden"]}),!l.attributes.is_readonly&&!l.attributes.is_hidden&&!l.attributes.is_symlink&&y.jsx("span",{className:"text-xs text-ink-muted",children:"No special flags"})]}),y.jsxs("div",{className:"space-y-0.5",children:[L("File Type",l.attributes.is_file?"Regular File":l.attributes.is_dir?"Directory":"Other","fileType"),l.attributes.permissions&&L("Permissions",l.attributes.permissions,"permissions",!0),l.attributes.owner_uid!==void 0&&L("Owner UID",String(l.attributes.owner_uid),"ownerUid"),l.attributes.group_gid!==void 0&&L("Group GID",String(l.attributes.group_gid),"groupGid")]})]}))]})]})]}),y.jsx("div",{className:"flex-shrink-0 border-t border-line px-6 py-3",children:y.jsxs("div",{className:"flex justify-between items-center gap-2",children:[y.jsx("p",{className:"min-w-0 text-xs text-ink-muted truncate",children:C??"Click the copy icon next to any field to copy its value"}),y.jsxs("div",{className:"flex items-center gap-2 whitespace-nowrap",children:[y.jsx(Xe,{text:"Show file in Explorer",block:!1,children:y.jsxs("button",{onClick:()=>void M("reveal","Revealed in Explorer",()=>JC(W.path)),disabled:w!==null,className:A("reveal"),children:[y.jsx(W0,{className:"h-3.5 w-3.5"})," Reveal"]})}),y.jsx(Xe,{text:"Launch file with default association",block:!1,children:y.jsxs("button",{onClick:()=>{i&&(S("launch"),Promise.resolve(i(W)).finally(()=>S(null)))},disabled:w!==null||!i,className:A("launch"),children:[y.jsx(is,{className:"h-3.5 w-3.5"})," Launch"]})}),y.jsx(Xe,{text:"Open containing folder",block:!1,children:y.jsxs("button",{onClick:()=>void M("folder","Opened folder",()=>K0(W.path)),disabled:w!==null,className:A("folder"),children:[y.jsx(ts,{className:"h-3.5 w-3.5"})," Open Folder"]})}),y.jsx("button",{onClick:t,className:"btn btn-primary px-4 py-2",children:"Close"})]})]})})]}),y.jsx(bA,{isOpen:b,onClose:()=>v(!1),initialFilePath:e.path,md5:l==null?void 0:l.md5})]})}const m8=["qr_code","code_128","code_39","ean_13","ean_8","upc_a","upc_e","data_matrix"],p8=250,g8=400,x8=.7;function y8(n,e=g8,t=x8){const i=n.videoWidth,l=n.videoHeight;if(!i||!l)return null;const o=Math.min(i,l),a=document.createElement("canvas");a.width=Math.min(e,o),a.height=a.width;const u=a.getContext("2d");if(!u)return null;u.drawImage(n,(i-o)/2,(l-o)/2,o,o,0,0,a.width,a.height);const f=a.toDataURL("image/jpeg",t);return f.slice(f.indexOf(",")+1)}function b8(n,e){const t=n.intervalMs??p8;let i=!1,l=!1;const o=()=>{i=!0,clearInterval(a)},a=setInterval(()=>{if(i||l)return;const u=n.capture();u&&(l=!0,n.decode(u).then(f=>{i||f.decoded&&(o(),e.onDetected(f.decoded))}).catch(f=>{i||(o(),e.onError(f instanceof Error?f.message:"Frame decoding failed"))}).finally(()=>{l=!1}))},t);return o}const v8=8e3;function w8({isOpen:n,onClose:e,onDetected:t}){const i=E.useRef(null),l=E.useRef(null),o=ms({isOpen:n,onClose:e,dialogRef:l}),a=E.useRef(null),u=E.useRef(null),f=E.useRef(null),[d,m]=E.useState(null),[g,b]=E.useState(!1),v=()=>{f.current&&(f.current(),f.current=null),u.current&&(cancelAnimationFrame(u.current),u.current=null),a.current&&(a.current.getTracks().forEach(C=>C.stop()),a.current=null),i.current&&(i.current.srcObject=null)};E.useEffect(()=>{if(!n){v(),m(null);return}let C=!0;async function N(){var D,U,H,M,A;if(m(null),b(!1),typeof window<"u"&&!window.isSecureContext&&window.location.hostname!=="localhost"&&window.location.hostname!=="127.0.0.1"){m("Camera access requires HTTPS or localhost. If connecting across a local network IP (e.g. 192.168.x.x), modern browsers disable camera access for insecure HTTP.");return}const j=((U=(D=navigator.mediaDevices)==null?void 0:D.getUserMedia)==null?void 0:U.bind(navigator.mediaDevices))||((H=navigator.getUserMedia)==null?void 0:H.bind(navigator))||((M=navigator.webkitGetUserMedia)==null?void 0:M.bind(navigator))||((A=navigator.mozGetUserMedia)==null?void 0:A.bind(navigator));if(!j){m(window.isSecureContext?"Camera access is not supported by your browser or environment.":"Camera access is blocked because the page is not served over a secure origin (HTTPS or localhost/127.0.0.1).");return}try{let L;const ne=await Promise.race([j({video:{facingMode:"environment",width:{ideal:1280},height:{ideal:720}}}),new Promise((F,W)=>{L=window.setTimeout(()=>W(new DOMException("Camera did not start in time","TimeoutError")),v8)})]).finally(()=>{L!==void 0&&window.clearTimeout(L)});if(!C){ne.getTracks().forEach(F=>F.stop());return}a.current=ne,i.current&&(i.current.srcObject=ne,await i.current.play()),"BarcodeDetector"in window?S():w()}catch(L){if(!C)return;console.error("Camera access error:",L),m(L.name==="NotAllowedError"||L.name==="PermissionDeniedError"?"Camera permission denied. Please allow camera access in your browser settings.":L.name==="TimeoutError"?"The camera did not start in time. On macOS, camera capture needs the packaged desktop app — a bare Python process cannot access the camera. Alternatively, open ProFiles in Chrome, Edge or Safari.":`Could not access camera: ${L.message||"Unknown error"}`)}}return N(),()=>{C=!1,v()}},[n]);const w=()=>{b(!0),f.current=b8({capture:()=>i.current?y8(i.current):null,decode:C=>RM({imageBase64:C,formats:[...m8]})},{onDetected:C=>{v(),t(C)},onError:C=>{v(),m(C)}})},S=()=>{const C=["qr_code","code_128","code_39","ean_13","ean_8","upc_a","upc_e","data_matrix"];let N;try{N=new window.BarcodeDetector({formats:C})}catch(D){console.warn("BarcodeDetector formats unsupported:",D),N=new window.BarcodeDetector}const j=async()=>{if(!i.current||i.current.readyState<2){u.current=requestAnimationFrame(j);return}try{const D=await N.detect(i.current);if(D&&D.length>0){const U=D[0].rawValue;if(U){v(),t(U);return}}}catch(D){console.debug("Frame detection error:",D)}u.current=requestAnimationFrame(j)};u.current=requestAnimationFrame(j)};return n?y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/70 p-4 backdrop-blur-sm",onClick:e,children:y.jsxs("div",{ref:l,role:"dialog","aria-modal":"true","aria-label":"Camera barcode scanner",onKeyDown:o,className:"relative w-full max-w-lg rounded-2xl border border-frame-line glass-panel p-6 flex flex-col",onClick:C=>C.stopPropagation(),children:[y.jsxs("div",{className:"mb-4 flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2 font-semibold text-ink",children:[y.jsx(nO,{className:"h-5 w-5 text-chip-indigo-text"}),y.jsx("span",{children:"Scan with Camera"})]}),y.jsx("button",{onClick:e,className:"focus-ring rounded-lg p-1 text-ink-muted hover:bg-elevated hover:text-ink transition-colors","aria-label":"Close",children:y.jsx(Li,{className:"h-4 w-4"})})]}),d?y.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[y.jsx("div",{className:"rounded-full bg-status-danger-bg p-3 text-status-danger-text mb-3",children:y.jsx(Zc,{className:"h-6 w-6"})}),y.jsx("p",{className:"text-xs text-status-danger-text max-w-xs",children:d}),y.jsx("button",{onClick:e,className:"btn btn-secondary mt-6 px-4 py-2",children:"Close"})]}):y.jsxs("div",{className:"flex flex-col items-center",children:[y.jsxs("div",{className:"relative aspect-video w-full overflow-hidden rounded-xl bg-black border border-line flex items-center justify-center",children:[y.jsx("video",{ref:i,playsInline:!0,muted:!0,className:"h-full w-full object-cover"}),y.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:y.jsxs("div",{className:"relative h-48 w-48 rounded-lg border-2 border-dashed border-indigo-400/80 bg-indigo-500/5 shadow-[0_0_0_9999px_rgba(0,0,0,0.45)]",children:[y.jsx("div",{className:"absolute top-0 left-0 h-4 w-4 border-t-2 border-l-2 border-indigo-400"}),y.jsx("div",{className:"absolute top-0 right-0 h-4 w-4 border-t-2 border-r-2 border-indigo-400"}),y.jsx("div",{className:"absolute bottom-0 left-0 h-4 w-4 border-b-2 border-l-2 border-indigo-400"}),y.jsx("div",{className:"absolute bottom-0 right-0 h-4 w-4 border-b-2 border-r-2 border-indigo-400"})]})})]}),y.jsx("p",{className:"mt-4 text-center text-xs text-ink-muted",children:g?"Hold a QR code or barcode steady in front of your camera — frames are decoded by the local ProFiles server (no native Barcode Detector in this browser).":"Hold a QR code or barcode steady in front of your camera to auto-scan."})]})]})}):null}function k8({isOpen:n,file:e,onConfirm:t,onDismiss:i}){const l=E.useRef(null);return E.useEffect(()=>{var o;if(n){const a=u=>{u.key==="Enter"?(u.preventDefault(),t()):u.key==="Escape"&&(u.preventDefault(),i())};return window.addEventListener("keydown",a),(o=l.current)==null||o.focus(),()=>window.removeEventListener("keydown",a)}},[n,t,i]),!n||!e?null:y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",onClick:i,children:y.jsxs("div",{role:"dialog","aria-modal":"true","aria-label":`1 file matched: ${e.filename}`,className:"animate-modal-in w-full max-w-sm rounded-xl border border-frame-line glass-panel p-5 flex flex-col gap-4",onClick:o=>o.stopPropagation(),children:[y.jsxs("div",{className:"flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2 font-semibold text-ink text-sm",children:[e.has_hook?y.jsx(ED,{className:"h-4 w-4 text-chip-purple-text"}):y.jsx(is,{className:"h-4 w-4 text-status-success-text"}),y.jsx("span",{children:"1 File Matched"})]}),y.jsx("button",{onClick:i,className:"focus-ring rounded p-1 text-ink-muted hover:bg-elevated hover:text-ink","aria-label":"Dismiss",children:y.jsx(Li,{className:"h-4 w-4"})})]}),y.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-line bg-elevated/50 p-3",children:[y.jsx(Na,{className:"h-5 w-5 text-chip-indigo-text shrink-0 mt-0.5"}),y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsx("h4",{className:"text-xs font-semibold text-ink truncate",children:e.filename}),y.jsx("p",{className:"text-[11px] text-ink-muted truncate mt-0.5",children:e.rel_path||e.path}),e.has_hook&&y.jsx("span",{className:"inline-block mt-1 text-[10px] text-chip-purple-text bg-chip-purple-bg px-1.5 py-0.5 rounded border border-chip-purple-border/50 font-medium",children:"Workflow Hook Configured"})]})]}),y.jsx("p",{className:"text-xs text-ink-muted text-center",children:"Launch this file now?"}),y.jsxs("div",{className:"flex gap-2",children:[y.jsx("button",{type:"button",onClick:i,className:"btn btn-secondary flex-1 px-3 py-1.5",children:"Dismiss (Esc)"}),y.jsxs("button",{ref:l,type:"button",onClick:t,className:"btn btn-primary flex-1 px-3 py-1.5 shadow-md",children:[y.jsx(is,{className:"h-3 w-3 fill-current"}),"Launch (Enter)"]})]})]})})}function S8({systemInfo:n,fileCount:e,theme:t,onToggleTheme:i,onOpenLog:l,onOpenConfig:o,onShowShortcuts:a,onReloadConfig:u,onExport:f,exportDisabled:d=!1,language:m="en",onLanguageChange:g,lanEnabled:b,onToggleLan:v}){return y.jsxs("footer",{className:"flex items-center justify-between border-t border-line bg-app px-4 py-2 text-[11px] text-ink-muted transition-colors duration-200",children:[y.jsx("div",{className:"flex items-center gap-4",children:n&&y.jsxs("div",{className:"flex items-center gap-1.5 rounded-full border border-line bg-surface px-2.5 py-0.5 text-ink-secondary",children:[y.jsx(XM,{className:"h-3 w-3 text-status-success-text"}),y.jsx("a",{href:`http://${n.hostname}:${window.location.port}`,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ProFiles on ${n.hostname}`,className:"font-mono hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 rounded px-1 py-0.5",children:n.hostname}),y.jsx("span",{className:"text-ink-faint",children:"|"}),y.jsx("a",{href:`http://${n.ip}:${window.location.port}`,target:"_blank",rel:"noopener noreferrer","aria-label":`Open ProFiles on ${n.ip}`,className:"font-mono hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 rounded px-1 py-0.5",children:n.ip}),y.jsx("span",{className:"text-ink-faint",children:"|"}),y.jsxs("span",{className:"flex items-center gap-1",title:"Session user",children:[y.jsx(ND,{className:"h-3 w-3 text-ink-faint"}),y.jsx("span",{children:n.username||"operator"})]}),v!==void 0&&y.jsxs(y.Fragment,{children:[y.jsx("span",{className:"text-ink-faint",children:"|"}),y.jsx(Xe,{text:"LAN access",block:!1,children:y.jsxs("button",{onClick:()=>v(b!==!0),disabled:b===null,"aria-pressed":b===!0,className:`focus-ring flex items-center gap-1 rounded px-1 py-0.5 text-[10px] ${b===null?"text-ink-faint cursor-not-allowed":b===!0?"text-status-success-text":"text-ink-muted hover:text-ink"}`,children:[y.jsx(iD,{className:"h-3 w-3"}),y.jsx("span",{children:"LAN"})]})})]})]})}),y.jsxs("div",{className:"flex items-center gap-3",children:[y.jsxs("span",{children:[y.jsx("strong",{className:"text-ink",children:e})," files found"]}),y.jsx("span",{className:"text-ink-faint",children:"|"}),y.jsx(Xe,{text:"Keyboard shortcuts (?)",block:!1,children:y.jsxs("button",{onClick:a,className:"focus-ring flex items-center gap-1 text-ink-muted hover:text-ink",children:[y.jsx(lO,{className:"h-3 w-3"}),y.jsx("span",{children:"Shortcuts"})]})}),y.jsx(Xe,{text:"Open the application log viewer",block:!1,children:y.jsxs("button",{onClick:l,className:"focus-ring flex items-center gap-1 text-ink-muted hover:text-ink",children:[y.jsx(Na,{className:"h-3 w-3"}),y.jsx("span",{children:"Logs"})]})}),y.jsx("span",{className:"text-ink-faint",children:"|"}),u&&y.jsx(Xe,{text:"Reload configuration from disk",block:!1,children:y.jsxs("button",{onClick:u,className:"focus-ring flex items-center gap-1 text-ink-muted hover:text-ink",children:[y.jsx(Kd,{className:"h-3 w-3"}),y.jsx("span",{children:"Reload"})]})}),f&&y.jsx(Xe,{text:"Export the current results as CSV",block:!1,children:y.jsxs("button",{onClick:f,disabled:d,className:"focus-ring flex items-center gap-1 rounded text-ink-muted hover:text-ink disabled:opacity-40 disabled:hover:text-ink-muted",children:[y.jsx(iO,{className:"h-3 w-3"}),y.jsx("span",{children:"Export CSV"})]})}),g&&y.jsxs("div",{className:"flex items-center overflow-hidden rounded border border-line text-[10px]",children:[y.jsx(Xe,{text:"English",block:!1,children:y.jsxs("button",{onClick:()=>g("en"),className:`flex items-center gap-1 px-1.5 py-0.5 transition-colors ${m==="en"?"bg-indigo-600 text-white focus-ring":"text-ink-muted hover:text-ink focus-ring"}`,children:[y.jsx(V4,{className:"h-3 w-3"}),y.jsx("span",{children:"EN"})]})}),y.jsx(Xe,{text:"Français",block:!1,children:y.jsx("button",{onClick:()=>g("fr"),className:`flex items-center gap-1 px-1.5 py-0.5 transition-colors ${m==="fr"?"bg-indigo-600 text-white focus-ring":"text-ink-muted hover:text-ink focus-ring"}`,children:y.jsx("span",{children:"FR"})})})]}),y.jsx(Xe,{text:"Open the configuration editor",block:!1,children:y.jsxs("button",{onClick:o,className:"focus-ring flex items-center gap-1 text-ink-muted hover:text-ink",children:[y.jsx(yD,{className:"h-3 w-3"}),y.jsx("span",{children:"Config"})]})}),y.jsx(Xe,{text:`Switch to ${t==="dark"?"light":"dark"} mode`,block:!1,children:y.jsxs("button",{onClick:i,className:"focus-ring flex items-center gap-1 rounded px-1.5 py-0.5 text-ink-muted hover:bg-elevated hover:text-status-warning-text",children:[t==="dark"?y.jsx(vD,{className:"h-3 w-3 text-status-warning-text"}):y.jsx(tD,{className:"h-3 w-3 text-chip-indigo-text"}),y.jsx("span",{children:t==="dark"?"Light":"Dark"})]})})]})]})}const C8=[{label:"5 seconds",seconds:5},{label:"10 seconds",seconds:10},{label:"30 seconds",seconds:30},{label:"1 minute",seconds:60},{label:"5 minutes",seconds:300}];function O8({isOpen:n,currentInterval:e,onClose:t,onSetInterval:i}){const l=E.useRef(null),o=ms({isOpen:n,onClose:t,dialogRef:l});if(!n)return null;const a=e>0,u=m=>{i(m)},f=m=>{m.preventDefault();const b=m.currentTarget.elements.namedItem("custom-interval"),v=parseInt(b.value,10);!isNaN(v)&&v>0&&i(v)},d=()=>{i(0)};return y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",children:y.jsxs("div",{ref:l,role:"dialog","aria-modal":"true","aria-label":"Auto-Rescan Timer",onKeyDown:o,className:"animate-modal-in w-[420px] max-w-full rounded-2xl border border-frame-line glass-panel p-5",children:[y.jsxs("div",{className:"mb-4 flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2 font-semibold text-ink",children:[y.jsx(aO,{className:"h-5 w-5 text-chip-indigo-text"}),y.jsx("span",{children:"Auto-Rescan Timer"})]}),y.jsx("button",{onClick:t,className:"focus-ring rounded-lg p-1 text-ink-muted hover:bg-elevated hover:text-ink",children:y.jsx(Li,{className:"h-4 w-4"})})]}),y.jsx("div",{className:"mb-4 rounded-lg bg-elevated/50 px-3 py-2 text-xs",children:a?y.jsxs("div",{className:"flex items-center gap-2 text-status-success-text",children:[y.jsx(b4,{className:"h-4 w-4 animate-pulse"}),y.jsxs("span",{children:["Auto-rescan every ",e,"s"]})]}):y.jsxs("div",{className:"flex items-center gap-2 text-ink-secondary",children:[y.jsx(x4,{className:"h-4 w-4"}),y.jsx("span",{children:"Auto-rescan is disabled"})]})}),y.jsxs("div",{className:"mb-4 space-y-1 text-xs",children:[y.jsx("p",{className:"text-ink-muted",children:"Presets:"}),y.jsx("div",{className:"grid grid-cols-2 gap-2",children:C8.map(m=>y.jsx("button",{onClick:()=>u(m.seconds),className:"rounded-lg border border-line bg-elevated/50 px-3 py-1.5 text-left font-medium text-ink-secondary hover:border-chip-indigo-border hover:bg-chip-indigo-bg/40 hover:text-chip-indigo-text focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:m.label},m.seconds))})]}),y.jsxs("form",{onSubmit:f,className:"mb-4",children:[y.jsxs("label",{className:"flex items-center gap-2 text-xs font-medium text-ink-secondary",children:[y.jsx(k4,{className:"h-3.5 w-3.5"}),y.jsx("span",{children:"Custom interval (seconds):"})]}),y.jsxs("div",{className:"mt-1 flex gap-2",children:[y.jsx("input",{type:"number",name:"custom-interval",min:"1",placeholder:"e.g. 45",className:"flex-1 rounded-lg border border-line bg-app px-2 py-1 text-xs text-ink placeholder-ink-faint focus:border-indigo-500 focus:outline-none"}),y.jsx("button",{type:"submit",className:"btn btn-primary rounded-lg px-3 py-1 font-semibold",children:"Set"})]})]}),a&&y.jsx("button",{onClick:d,className:"btn w-full rounded-lg border-line bg-elevated/50 px-3 py-2 text-status-warning-text hover:border-status-warning-border hover:bg-status-warning-bg/40",children:"Stop Auto-Rescan"}),y.jsx("div",{className:"flex justify-end gap-2 border-t border-line pt-3",children:y.jsx("button",{onClick:t,className:"rounded-lg border border-line bg-elevated px-4 py-2 text-xs font-semibold text-ink-secondary hover:bg-elevated/70 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:"Close"})})]})})}function N8(n,e){const t={};return(n[n.length-1]===""?[...n,""]:n).join((t.padRight?" ":"")+","+(t.padLeft===!1?"":" ")).trim()}const T8=/^[$_\p{ID_Start}][$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,A8=/^[$_\p{ID_Start}][-$_\u{200C}\u{200D}\p{ID_Continue}]*$/u,E8={};function eC(n,e){return(E8.jsx?A8:T8).test(n)}const M8=/[ \t\n\f\r]/g;function D8(n){return typeof n=="object"?n.type==="text"?tC(n.value):!1:tC(n)}function tC(n){return n.replace(M8,"")===""}class zu{constructor(e,t,i){this.normal=t,this.property=e,i&&(this.space=i)}}zu.prototype.normal={};zu.prototype.property={};zu.prototype.space=void 0;function wA(n,e){const t={},i={};for(const l of n)Object.assign(t,l.property),Object.assign(i,l.normal);return new zu(t,i,e)}function ty(n){return n.toLowerCase()}class wi{constructor(e,t){this.attribute=t,this.property=e}}wi.prototype.attribute="";wi.prototype.booleanish=!1;wi.prototype.boolean=!1;wi.prototype.commaOrSpaceSeparated=!1;wi.prototype.commaSeparated=!1;wi.prototype.defined=!1;wi.prototype.mustUseProperty=!1;wi.prototype.number=!1;wi.prototype.overloadedBoolean=!1;wi.prototype.property="";wi.prototype.spaceSeparated=!1;wi.prototype.space=void 0;let R8=0;const Qe=mo(),cn=mo(),ny=mo(),xe=mo(),Rt=mo(),oo=mo(),Ri=mo();function mo(){return 2**++R8}const iy=Object.freeze(Object.defineProperty({__proto__:null,boolean:Qe,booleanish:cn,commaOrSpaceSeparated:Ri,commaSeparated:oo,number:xe,overloadedBoolean:ny,spaceSeparated:Rt},Symbol.toStringTag,{value:"Module"})),_0=Object.keys(iy);class ob extends wi{constructor(e,t,i,l){let o=-1;if(super(e,t),nC(this,"space",l),typeof i=="number")for(;++o<_0.length;){const a=_0[o];nC(this,_0[o],(i&iy[a])===iy[a])}}}ob.prototype.defined=!0;function nC(n,e,t){t&&(n[e]=t)}function Ia(n){const e={},t={};for(const[i,l]of Object.entries(n.properties)){const o=new ob(i,n.transform(n.attributes||{},i),l,n.space);n.mustUseProperty&&n.mustUseProperty.includes(i)&&(o.mustUseProperty=!0),e[i]=o,t[ty(i)]=i,t[ty(o.attribute)]=i}return new zu(e,t,n.space)}const kA=Ia({properties:{ariaActiveDescendant:null,ariaAtomic:cn,ariaAutoComplete:null,ariaBusy:cn,ariaChecked:cn,ariaColCount:xe,ariaColIndex:xe,ariaColSpan:xe,ariaControls:Rt,ariaCurrent:null,ariaDescribedBy:Rt,ariaDetails:null,ariaDisabled:cn,ariaDropEffect:Rt,ariaErrorMessage:null,ariaExpanded:cn,ariaFlowTo:Rt,ariaGrabbed:cn,ariaHasPopup:null,ariaHidden:cn,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Rt,ariaLevel:xe,ariaLive:null,ariaModal:cn,ariaMultiLine:cn,ariaMultiSelectable:cn,ariaOrientation:null,ariaOwns:Rt,ariaPlaceholder:null,ariaPosInSet:xe,ariaPressed:cn,ariaReadOnly:cn,ariaRelevant:null,ariaRequired:cn,ariaRoleDescription:Rt,ariaRowCount:xe,ariaRowIndex:xe,ariaRowSpan:xe,ariaSelected:cn,ariaSetSize:xe,ariaSort:null,ariaValueMax:xe,ariaValueMin:xe,ariaValueNow:xe,ariaValueText:null,role:null},transform(n,e){return e==="role"?e:"aria-"+e.slice(4).toLowerCase()}});function SA(n,e){return e in n?n[e]:e}function CA(n,e){return SA(n,e.toLowerCase())}const j8=Ia({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:oo,acceptCharset:Rt,accessKey:Rt,action:null,allow:null,allowFullScreen:Qe,allowPaymentRequest:Qe,allowUserMedia:Qe,alpha:Qe,alt:null,as:null,async:Qe,autoCapitalize:null,autoComplete:Rt,autoFocus:Qe,autoPlay:Qe,blocking:Rt,capture:null,charSet:null,checked:Qe,cite:null,className:Rt,closedBy:null,colorSpace:null,cols:xe,colSpan:xe,command:null,commandFor:null,content:null,contentEditable:cn,controls:Qe,controlsList:Rt,coords:xe|oo,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Qe,defer:Qe,dir:null,dirName:null,disabled:Qe,download:ny,draggable:cn,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Qe,formTarget:null,headers:Rt,height:xe,hidden:ny,high:xe,href:null,hrefLang:null,htmlFor:Rt,httpEquiv:Rt,id:null,imageSizes:null,imageSrcSet:null,inert:Qe,inputMode:null,integrity:null,is:null,isMap:Qe,itemId:null,itemProp:Rt,itemRef:Rt,itemScope:Qe,itemType:Rt,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Qe,low:xe,manifest:null,max:null,maxLength:xe,media:null,method:null,min:null,minLength:xe,multiple:Qe,muted:Qe,name:null,nonce:null,noModule:Qe,noValidate:Qe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:Qe,optimum:xe,pattern:null,ping:Rt,placeholder:null,playsInline:Qe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Qe,referrerPolicy:null,rel:Rt,required:Qe,reversed:Qe,rows:xe,rowSpan:xe,sandbox:Rt,scope:null,scoped:Qe,seamless:Qe,selected:Qe,shadowRootClonable:Qe,shadowRootCustomElementRegistry:Qe,shadowRootDelegatesFocus:Qe,shadowRootMode:null,shadowRootSerializable:Qe,shape:null,size:xe,sizes:null,slot:null,span:xe,spellCheck:cn,src:null,srcDoc:null,srcLang:null,srcSet:null,start:xe,step:null,style:null,tabIndex:xe,target:null,title:null,translate:null,type:null,typeMustMatch:Qe,useMap:null,value:cn,width:xe,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Rt,axis:null,background:null,bgColor:null,border:xe,borderColor:null,bottomMargin:xe,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Qe,declare:Qe,event:null,face:null,frame:null,frameBorder:null,hSpace:xe,leftMargin:xe,link:null,longDesc:null,lowSrc:null,marginHeight:xe,marginWidth:xe,noResize:Qe,noHref:Qe,noShade:Qe,noWrap:Qe,object:null,profile:null,prompt:null,rev:null,rightMargin:xe,rules:null,scheme:null,scrolling:cn,standby:null,summary:null,text:null,topMargin:xe,valueType:null,version:null,vAlign:null,vLink:null,vSpace:xe,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:Qe,disablePictureInPicture:Qe,disableRemotePlayback:Qe,exportParts:oo,part:Rt,prefix:null,property:null,results:xe,security:null,unselectable:null},space:"html",transform:CA}),_8=Ia({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ri,accentHeight:xe,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:xe,amplitude:xe,arabicForm:null,ascent:xe,attributeName:null,attributeType:null,azimuth:xe,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:xe,by:null,calcMode:null,capHeight:xe,className:Rt,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:xe,diffuseConstant:xe,direction:null,display:null,dur:null,divisor:xe,dominantBaseline:null,download:Qe,dx:null,dy:null,edgeMode:null,editable:null,elevation:xe,enableBackground:null,end:null,event:null,exponent:xe,externalResourcesRequired:null,fill:null,fillOpacity:xe,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:oo,g2:oo,glyphName:oo,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:xe,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:xe,horizOriginX:xe,horizOriginY:xe,id:null,ideographic:xe,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:xe,k:xe,k1:xe,k2:xe,k3:xe,k4:xe,kernelMatrix:Ri,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:xe,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:xe,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:xe,overlineThickness:xe,paintOrder:null,panose1:null,path:null,pathLength:xe,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Rt,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:xe,pointsAtY:xe,pointsAtZ:xe,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ri,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ri,rev:Ri,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ri,requiredFeatures:Ri,requiredFonts:Ri,requiredFormats:Ri,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:xe,specularExponent:xe,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:xe,strikethroughThickness:xe,string:null,stroke:null,strokeDashArray:Ri,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:xe,strokeOpacity:xe,strokeWidth:null,style:null,surfaceScale:xe,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ri,tabIndex:xe,tableValues:null,target:null,targetX:xe,targetY:xe,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ri,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:xe,underlineThickness:xe,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:xe,values:null,vAlphabetic:xe,vMathematical:xe,vectorEffect:null,vHanging:xe,vIdeographic:xe,version:null,vertAdvY:xe,vertOriginX:xe,vertOriginY:xe,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:xe,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:SA}),OA=Ia({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(n,e){return"xlink:"+e.slice(5).toLowerCase()}}),NA=Ia({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:CA}),TA=Ia({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(n,e){return"xml:"+e.slice(3).toLowerCase()}}),L8={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"},z8=/[A-Z]/g,iC=/-[a-z]/g,B8=/^data[-\w.:]+$/i;function P8(n,e){const t=ty(e);let i=e,l=wi;if(t in n.normal)return n.property[n.normal[t]];if(t.length>4&&t.slice(0,4)==="data"&&B8.test(e)){if(e.charAt(4)==="-"){const o=e.slice(5).replace(iC,I8);i="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=e.slice(4);if(!iC.test(o)){let a=o.replace(z8,H8);a.charAt(0)!=="-"&&(a="-"+a),e="data"+a}}l=ob}return new l(i,e)}function H8(n){return"-"+n.toLowerCase()}function I8(n){return n.charAt(1).toUpperCase()}const U8=wA([kA,j8,OA,NA,TA],"html"),ab=wA([kA,_8,OA,NA,TA],"svg");function F8(n){return n.join(" ").trim()}var rC=/\/\*(?:[^*]|\*(?!\/))*\*\//g,q8=/\n/g,V8=/^\s*/,Q8=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,X8=/^:\s*/,$8=/^((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|url\((?:'(?:\\.|[^'\\])*'|"(?:\\.|[^"\\])*"|[^)]*)\)|[^};])+)/,Y8=/^[;\s]*/,G8=` +`,lC="/",sC="*",Vc="",K8="comment",W8="declaration";function Z8(n,e){if(typeof n!="string")throw new TypeError("First argument must be a string");if(!n)return[];e=e||{};var t=1,i=1;function l(w){var S=w.match(q8);S&&(t+=S.length);var C=w.lastIndexOf(G8);i=~C?w.length-C:i+w.length}function o(){var w={line:t,column:i};return function(S){return S.position=new a(w),d(),S}}function a(w){this.start=w,this.end={line:t,column:i},this.source=e.source}a.prototype.content=n;function u(w){var S=new Error(e.source+":"+t+":"+i+": "+w);if(S.reason=w,S.filename=e.source,S.line=t,S.column=i,S.source=n,!e.silent)throw S}function f(w){var S=w.exec(n);if(S){var C=S[0];return l(C),n=n.slice(C.length),S}}function d(){f(V8)}function m(w){for(var S;S=g();)w.push(S);return w}function g(){var w=o();if(!(lC!=n.charAt(0)||sC!=n.charAt(1))){for(var S=2;Vc!=n.charAt(S)&&(sC!=n.charAt(S)||lC!=n.charAt(S+1));)++S;if(S+=2,Vc===n.charAt(S-1))return u("End of comment missing");var C=n.slice(2,S-2);return i+=2,l(C),n=n.slice(S),i+=2,w({type:K8,comment:C})}}function b(){var w=o(),S=f(Q8);if(S){if(g(),!f(X8))return u("property missing ':'");var C=f($8),N=w({type:W8,property:S[0].replace(rC,Vc).trim(),value:C?C[0].replace(rC,Vc).trim():Vc});return f(Y8),N}}function v(){var w=[];m(w);for(var S;S=b();)w.push(S),m(w);return w}return d(),v()}function J8(n,e){let t=null;if(!n||typeof n!="string")return t;const i=Z8(n),l=typeof e=="function";return i.forEach(o=>{if(o.type!=="declaration")return;const{property:a,value:u}=o;l?e(a,u,o):u&&(t=t??{},t[a]=u)}),t}const AA=EA("end"),cb=EA("start");function EA(n){return e;function e(t){const i=t&&t.position&&t.position[n]||{};if(typeof i.line=="number"&&i.line>0&&typeof i.column=="number"&&i.column>0)return{line:i.line,column:i.column,offset:typeof i.offset=="number"&&i.offset>-1?i.offset:void 0}}}function eP(n){const e=cb(n),t=AA(n);if(e&&t)return{start:e,end:t}}function ou(n){return!n||typeof n!="object"?"":"position"in n||"type"in n?oC(n.position):"start"in n||"end"in n?oC(n):"line"in n||"column"in n?ry(n):""}function ry(n){return aC(n&&n.line)+":"+aC(n&&n.column)}function oC(n){return ry(n&&n.start)+"-"+ry(n&&n.end)}function aC(n){return n&&typeof n=="number"?n:1}class Yn extends Error{constructor(e,t,i){super(),typeof t=="string"&&(i=t,t=void 0);let l="",o={},a=!1;if(t&&("line"in t&&"column"in t?o={place:t}:"start"in t&&"end"in t?o={place:t}:"type"in t?o={ancestors:[t],place:t.position}:o={...t}),typeof e=="string"?l=e:!o.cause&&e&&(a=!0,l=e.message,o.cause=e),!o.ruleId&&!o.source&&typeof i=="string"){const f=i.indexOf(":");f===-1?o.ruleId=i:(o.source=i.slice(0,f),o.ruleId=i.slice(f+1))}if(!o.place&&o.ancestors&&o.ancestors){const f=o.ancestors[o.ancestors.length-1];f&&(o.place=f.position)}const u=o.place&&"start"in o.place?o.place.start:o.place;this.ancestors=o.ancestors||void 0,this.cause=o.cause||void 0,this.column=u?u.column:void 0,this.fatal=void 0,this.file="",this.message=l,this.line=u?u.line:void 0,this.name=ou(o.place)||"1:1",this.place=o.place||void 0,this.reason=this.message,this.ruleId=o.ruleId||void 0,this.source=o.source||void 0,this.stack=a&&o.cause&&typeof o.cause.stack=="string"?o.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}}Yn.prototype.file="";Yn.prototype.name="";Yn.prototype.reason="";Yn.prototype.message="";Yn.prototype.stack="";Yn.prototype.column=void 0;Yn.prototype.line=void 0;Yn.prototype.ancestors=void 0;Yn.prototype.cause=void 0;Yn.prototype.fatal=void 0;Yn.prototype.place=void 0;Yn.prototype.ruleId=void 0;Yn.prototype.source=void 0;const ub={}.hasOwnProperty,tP=new Map,nP=/[A-Z]/g,iP=/-([a-z])/g,rP=new Set(["table","tbody","thead","tfoot","tr"]),lP=new Set(["td","th"]),MA="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function sP(n,e){if(!e||e.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");const t=e.filePath||void 0;let i;if(e.development){if(typeof e.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");i=mP(t,e.jsxDEV)}else{if(typeof e.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof e.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");i=dP(t,e.jsx,e.jsxs)}const l={Fragment:e.Fragment,ancestors:[],components:e.components||{},create:i,elementAttributeNameCase:e.elementAttributeNameCase||"react",evaluater:e.createEvaluater?e.createEvaluater():void 0,filePath:t,ignoreInvalidStyle:e.ignoreInvalidStyle||!1,passKeys:e.passKeys!==!1,passNode:e.passNode||!1,schema:e.space==="svg"?ab:U8,stylePropertyNameCase:e.stylePropertyNameCase||"dom",tableCellAlignToStyle:e.tableCellAlignToStyle!==!1},o=DA(l,n,void 0);return o&&typeof o!="string"?o:l.create(n,l.Fragment,{children:o||void 0},void 0)}function DA(n,e,t){if(e.type==="element")return oP(n,e,t);if(e.type==="mdxFlowExpression"||e.type==="mdxTextExpression")return aP(n,e);if(e.type==="mdxJsxFlowElement"||e.type==="mdxJsxTextElement")return uP(n,e,t);if(e.type==="mdxjsEsm")return cP(n,e);if(e.type==="root")return fP(n,e,t);if(e.type==="text")return hP(n,e)}function oP(n,e,t){const i=n.schema;let l=i;e.tagName.toLowerCase()==="svg"&&i.space==="html"&&(l=ab,n.schema=l),n.ancestors.push(e);const o=jA(n,e.tagName,!1),a=pP(n,e);let u=hb(n,e);return rP.has(e.tagName)&&(u=u.filter(function(f){return typeof f=="string"?!D8(f):!0})),RA(n,a,o,e),fb(a,u),n.ancestors.pop(),n.schema=i,n.create(e,o,a,t)}function aP(n,e){if(e.data&&e.data.estree&&n.evaluater){const i=e.data.estree.body[0];return i.type,n.evaluater.evaluateExpression(i.expression)}Tu(n,e.position)}function cP(n,e){if(e.data&&e.data.estree&&n.evaluater)return n.evaluater.evaluateProgram(e.data.estree);Tu(n,e.position)}function uP(n,e,t){const i=n.schema;let l=i;e.name==="svg"&&i.space==="html"&&(l=ab,n.schema=l),n.ancestors.push(e);const o=e.name===null?n.Fragment:jA(n,e.name,!0),a=gP(n,e),u=hb(n,e);return RA(n,a,o,e),fb(a,u),n.ancestors.pop(),n.schema=i,n.create(e,o,a,t)}function fP(n,e,t){const i={};return fb(i,hb(n,e)),n.create(e,n.Fragment,i,t)}function hP(n,e){return e.value}function RA(n,e,t,i){typeof t!="string"&&t!==n.Fragment&&n.passNode&&(e.node=i)}function fb(n,e){if(e.length>0){const t=e.length>1?e:e[0];t&&(n.children=t)}}function dP(n,e,t){return i;function i(l,o,a,u){const d=Array.isArray(a.children)?t:e;return u?d(o,a,u):d(o,a)}}function mP(n,e){return t;function t(i,l,o,a){const u=Array.isArray(o.children),f=cb(i);return e(l,o,a,u,{columnNumber:f?f.column-1:void 0,fileName:n,lineNumber:f?f.line:void 0},void 0)}}function pP(n,e){const t={};let i,l;for(l in e.properties)if(l!=="children"&&ub.call(e.properties,l)){const o=xP(n,l,e.properties[l]);if(o){const[a,u]=o;n.tableCellAlignToStyle&&a==="align"&&typeof u=="string"&&lP.has(e.tagName)?i=u:t[a]=u}}if(i){const o=t.style||(t.style={});o[n.stylePropertyNameCase==="css"?"text-align":"textAlign"]=i}return t}function gP(n,e){const t={};for(const i of e.attributes)if(i.type==="mdxJsxExpressionAttribute")if(i.data&&i.data.estree&&n.evaluater){const o=i.data.estree.body[0];o.type;const a=o.expression;a.type;const u=a.properties[0];u.type,Object.assign(t,n.evaluater.evaluateExpression(u.argument))}else Tu(n,e.position);else{const{name:l}=i;let o;if(i.value&&typeof i.value=="object")if(i.value.data&&i.value.data.estree&&n.evaluater){const u=i.value.data.estree.body[0];u.type,o=n.evaluater.evaluateExpression(u.expression)}else Tu(n,e.position);else o=i.value===null?!0:i.value;t[l]=o}return t}function hb(n,e){const t=[];let i=-1;const l=n.passKeys?new Map:tP;for(;++il?0:l+e:e=e>l?l:e,t=t>0?t:0,i.length<1e4)a=Array.from(i),a.unshift(e,t),n.splice(...a);else for(t&&n.splice(e,t);o0?(ur(n,n.length,0,e),n):e}const fC={}.hasOwnProperty;function LA(n){const e={};let t=-1;for(;++t13&&t<32||t>126&&t<160||t>55295&&t<57344||t>64975&&t<65008||(t&65535)===65535||(t&65535)===65534||t>1114111?"�":String.fromCodePoint(t)}function fr(n){return n.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}const zn=ps(/[A-Za-z]/),Bn=ps(/[\dA-Za-z]/),TP=ps(/[#-'*+\--9=?A-Z^-~]/);function qd(n){return n!==null&&(n<32||n===127)}const ly=ps(/\d/),AP=ps(/[\dA-Fa-f]/),BA=ps(/[!-/:-@[-`{-~]/);function Ie(n){return n!==null&&n<-2}function _t(n){return n!==null&&(n<0||n===32)}function Je(n){return n===-2||n===-1||n===32}const dm=ps(new RegExp("\\p{P}|\\p{S}","u")),fo=ps(/\s/);function ps(n){return e;function e(t){return t!==null&&t>-1&&n.test(String.fromCharCode(t))}}function Ua(n){const e=[];let t=-1,i=0,l=0;for(;++t55295&&o<57344){const u=n.charCodeAt(t+1);o<56320&&u>56319&&u<57344?(a=String.fromCharCode(o,u),l=1):a="�"}else a=String.fromCharCode(o);a&&(e.push(n.slice(i,t),encodeURIComponent(a)),i=t+l+1,a=""),l&&(t+=l,l=0)}return e.join("")+n.slice(i)}function gt(n,e,t,i){const l=i?i-1:1/0;let o=0;return a;function a(f){return Je(f)?(n.enter(t),u(f)):e(f)}function u(f){return Je(f)&&o++=l?e(m):t(m)}}const EP={tokenize:MP};function MP(n){const e=n.attempt(this.parser.constructs.contentInitial,i,l);let t;return e;function i(u){if(u===null){n.consume(u);return}return n.enter("lineEnding"),n.consume(u),n.exit("lineEnding"),gt(n,e,"linePrefix")}function l(u){return n.enter("paragraph"),o(u)}function o(u){const f=n.enter("chunkText",{contentType:"text",previous:t});return t&&(t.next=f),t=f,a(u)}function a(u){if(u===null){n.exit("chunkText"),n.exit("paragraph"),n.consume(u);return}return Ie(u)?(n.consume(u),n.exit("chunkText"),o):(n.consume(u),a)}}let Vd=class{constructor(){this.index=new Map,this.map=[]}add(e,t,i){hC(this,e,t,i,!1)}addBefore(e,t,i){hC(this,e,t,i,!0)}consume(e){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let t=this.map.length;const i=[];for(;t>0;)t-=1,i.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];i.push(e.slice()),e.length=0;let l=i.pop();for(;l;){for(const o of l)e.push(o);l=i.pop()}this.map.length=0,this.index.clear()}};function hC(n,e,t,i,l){if(t===0&&i.length===0)return;const o=n.index.get(e);if(o){o[1]+=t,l?(i.push(...o[2]),o[2]=i):o[2].push(...i);return}const a=[e,t,i];n.map.push(a),n.index.set(e,a)}const DP={tokenize:RP},dC={tokenize:jP};function RP(n){const e=this,t=[];let i=0,l,o,a;return u;function u(D){if(ia))return;const A=e.events.length;let L=A,ne,F;for(;L--;)if(e.events[L][0]==="exit"&&e.events[L][1].type==="chunkFlow"){if(ne){F=e.events[L][1].end;break}ne=!0}for(N(i),M=A;MD;){const H=t[U];e.containerState=H[1],H[0].exit.call(e,n)}t.length=D}function j(){l.write([null]),o=void 0,l=void 0,e.containerState._closeFlow=void 0}}function jP(n,e,t){return gt(n,n.attempt(this.parser.constructs.document,e,t),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function fs(n){if(n===null||_t(n)||fo(n))return 1;if(dm(n))return 2}function mm(n,e,t){const i=[];let l=-1;for(;++l1&&n[t][1].end.offset-n[t][1].start.offset>1?2:1,a={...n[l][1].end},u={...n[t][1].start};mC(a,-o),mC(u,o);const f={type:o>1?"strongSequence":"emphasisSequence",start:a,end:{...n[l][1].end}},d={type:o>1?"strongSequence":"emphasisSequence",start:{...n[t][1].start},end:u},m={type:o>1?"strongText":"emphasisText",start:{...n[l][1].end},end:{...n[t][1].start}},g={type:o>1?"strong":"emphasis",start:{...f.start},end:{...d.end}};n[l][1].end={...f.start},n[t][1].start={...d.end},i=[],n[l][1].end.offset-n[l][1].start.offset&&(i=Qi(i,[["enter",n[l][1],e],["exit",n[l][1],e]])),i=Qi(i,[["enter",g,e],["enter",f,e],["exit",f,e],["enter",m,e]]),i=Qi(i,mm(e.parser.constructs.insideSpan.null,n.slice(l+1,t),e)),i=Qi(i,[["exit",m,e],["enter",d,e],["exit",d,e],["exit",g,e]]);let b=0;n[t][1].end.offset-n[t][1].start.offset&&(b=2,i=Qi(i,[["enter",n[t][1],e],["exit",n[t][1],e]])),ur(n,l-1,t-l+3,i),t=l+i.length-b-2;break}}for(t=-1;++t0&&Je(M)?gt(n,j,"linePrefix",o+1)(M):j(M)}function j(M){return M===null||Ie(M)?n.check(oy,S,U)(M):(n.enter("codeFlowValue"),D(M))}function D(M){return M===null||Ie(M)?(n.exit("codeFlowValue"),j(M)):(n.consume(M),D)}function U(M){return n.exit("codeFenced"),e(M)}function H(M,A,L){let ne=0;return F;function F(ce){return M.enter("lineEnding"),M.consume(ce),M.exit("lineEnding"),W}function W(ce){return M.enter("codeFencedFence"),Je(ce)?gt(M,I,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(ce):I(ce)}function I(ce){return ce===u?(M.enter("codeFencedFenceSequence"),re(ce)):L(ce)}function re(ce){return ce===u?(ne++,M.consume(ce),re):ne>=a?(M.exit("codeFencedFenceSequence"),Je(ce)?gt(M,pe,"whitespace")(ce):pe(ce)):L(ce)}function pe(ce){return ce===null||Ie(ce)?(M.exit("codeFencedFence"),A(ce)):L(ce)}}}const z0={name:"codeIndented",tokenize:$P},XP={partial:!0,tokenize:YP};function $P(n,e,t){return i;function i(u){return n.enter("codeIndented"),PA(n,l,t,"linePrefix",4,4)(u)}function l(u){return u===null?a(u):Ie(u)?n.attempt(XP,l,a)(u):(n.enter("codeFlowValue"),o(u))}function o(u){return u===null||Ie(u)?(n.exit("codeFlowValue"),l(u)):(n.consume(u),o)}function a(u){return n.exit("codeIndented"),e(u)}}function YP(n,e,t){const i=this;return l;function l(a){return i.parser.lazy[i.now().line]?t(a):Ie(a)?(n.enter("lineEnding"),n.consume(a),n.exit("lineEnding"),l):PA(n,e,o,"linePrefix",4,4)(a)}function o(a){return Ie(a)?l(a):t(a)}}const GP={name:"codeText",previous:WP,resolve:KP,tokenize:ZP};function KP(n){let e=n.length-4,t=3,i,l;if((n[t][1].type==="lineEnding"||n[t][1].type==="space")&&(n[e][1].type==="lineEnding"||n[e][1].type==="space")){for(i=t;++i=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return ethis.left.length?this.right.slice(this.right.length-i+this.left.length,this.right.length-e+this.left.length).reverse():this.left.slice(e).concat(this.right.slice(this.right.length-i+this.left.length).reverse())}splice(e,t,i){const l=t||0;this.setCursor(Math.trunc(e));const o=this.right.splice(this.right.length-l,Number.POSITIVE_INFINITY);return i&&Qc(this.left,i),o.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Qc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Qc(this.right,e.reverse())}setCursor(e){if(!(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0))if(e=4?e(a):n.interrupt(i.parser.constructs.flow,t,e)(a)}}function qA(n,e,t,i,l,o,a,u,f){const d=f||Number.POSITIVE_INFINITY;let m=0;return g;function g(N){return N===60?(n.enter(i),n.enter(l),n.enter(o),n.consume(N),n.exit(o),b):N===null||N===32||N===41||qd(N)?t(N):(n.enter(i),n.enter(a),n.enter(u),n.enter("chunkString",{contentType:"string"}),S(N))}function b(N){return N===62?(n.enter(o),n.consume(N),n.exit(o),n.exit(l),n.exit(i),e):(n.enter(u),n.enter("chunkString",{contentType:"string"}),v(N))}function v(N){return N===62?(n.exit("chunkString"),n.exit(u),b(N)):N===null||N===60||Ie(N)?t(N):(n.consume(N),N===92?w:v)}function w(N){return N===60||N===62||N===92?(n.consume(N),v):v(N)}function S(N){return!m&&(N===null||N===41||_t(N))?(n.exit("chunkString"),n.exit(u),n.exit(a),n.exit(i),e(N)):m999||v===null||v===91||v===93&&!f||v===94&&!u&&"_hiddenFootnoteSupport"in a.parser.constructs?t(v):v===93?(n.exit(o),n.enter(l),n.consume(v),n.exit(l),n.exit(i),e):Ie(v)?(n.enter("lineEnding"),n.consume(v),n.exit("lineEnding"),m):(n.enter("chunkString",{contentType:"string"}),g(v))}function g(v){return v===null||v===91||v===93||Ie(v)||u++>999?(n.exit("chunkString"),m(v)):(n.consume(v),f||(f=!Je(v)),v===92?b:g)}function b(v){return v===91||v===92||v===93?(n.consume(v),u++,g):g(v)}}function QA(n,e,t,i,l,o){let a;return u;function u(b){return b===34||b===39||b===40?(n.enter(i),n.enter(l),n.consume(b),n.exit(l),a=b===40?41:b,f):t(b)}function f(b){return b===a?(n.enter(l),n.consume(b),n.exit(l),n.exit(i),e):(n.enter(o),d(b))}function d(b){return b===a?(n.exit(o),f(a)):b===null?t(b):Ie(b)?(n.enter("lineEnding"),n.consume(b),n.exit("lineEnding"),gt(n,d,"linePrefix")):(n.enter("chunkString",{contentType:"string"}),m(b))}function m(b){return b===a||b===null||Ie(b)?(n.exit("chunkString"),d(b)):(n.consume(b),b===92?g:m)}function g(b){return b===a||b===92?(n.consume(b),m):m(b)}}function au(n,e){let t;return i;function i(l){return Ie(l)?(n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),t=!0,i):Je(l)?gt(n,i,t?"linePrefix":"lineSuffix")(l):e(l)}}const sH={name:"definition",tokenize:aH},oH={partial:!0,tokenize:cH};function aH(n,e,t){const i=this;let l;return o;function o(v){return n.enter("definition"),a(v)}function a(v){return VA.call(i,n,u,t,"definitionLabel","definitionLabelMarker","definitionLabelString")(v)}function u(v){return l=fr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)),v===58?(n.enter("definitionMarker"),n.consume(v),n.exit("definitionMarker"),f):t(v)}function f(v){return _t(v)?au(n,d)(v):d(v)}function d(v){return qA(n,m,t,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(v)}function m(v){return n.attempt(oH,g,g)(v)}function g(v){return Je(v)?gt(n,b,"whitespace")(v):b(v)}function b(v){return v===null||Ie(v)?(n.exit("definition"),i.parser.defined.push(l),e(v)):t(v)}}function cH(n,e,t){return i;function i(u){return _t(u)?au(n,l)(u):t(u)}function l(u){return QA(n,o,t,"definitionTitle","definitionTitleMarker","definitionTitleString")(u)}function o(u){return Je(u)?gt(n,a,"whitespace")(u):a(u)}function a(u){return u===null||Ie(u)?e(u):t(u)}}const uH={name:"hardBreakEscape",tokenize:fH};function fH(n,e,t){return i;function i(o){return n.enter("hardBreakEscape"),n.consume(o),l}function l(o){return Ie(o)?(n.exit("hardBreakEscape"),e(o)):t(o)}}const hH={name:"headingAtx",resolve:dH,tokenize:mH};function dH(n,e){let t=n.length-2,i=3;if(n[i][1].type==="whitespace"&&(i+=2),t-2>i&&n[t][1].type==="whitespace"&&(t-=2),n[t][1].type==="atxHeadingSequence"&&(i===t-1||t-4>i&&n[t-2][1].type==="whitespace")&&(t-=i+1===t?2:4),t>i){const l={type:"atxHeadingText",start:n[i][1].start,end:n[t][1].end},o={type:"chunkText",start:n[i][1].start,end:n[t][1].end,contentType:"text"};ur(n,i,t-i+1,[["enter",l,e],["enter",o,e],["exit",o,e],["exit",l,e]])}return n}function mH(n,e,t){let i=0;return l;function l(m){return n.enter("atxHeading"),o(m)}function o(m){return n.enter("atxHeadingSequence"),a(m)}function a(m){return m===35&&i++<6?(n.consume(m),a):m===null||_t(m)?(n.exit("atxHeadingSequence"),u(m)):t(m)}function u(m){return m===35?(n.enter("atxHeadingSequence"),f(m)):m===null||Ie(m)?(n.exit("atxHeading"),e(m)):Je(m)?gt(n,u,"whitespace")(m):(n.enter("atxHeadingText"),d(m))}function f(m){return m===35?(n.consume(m),f):(n.exit("atxHeadingSequence"),u(m))}function d(m){return m===null||m===35||_t(m)?(n.exit("atxHeadingText"),u(m)):(n.consume(m),d)}}const XA=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],ay=["pre","script","style","textarea"],pH={concrete:!0,name:"htmlFlow",resolveTo:xH,tokenize:yH},gH={partial:!0,tokenize:bH};function xH(n){let e=n.length;for(;e--&&!(n[e][0]==="enter"&&n[e][1].type==="htmlFlow"););return e>1&&n[e-2][1].type==="linePrefix"&&(n[e][1].start=n[e-2][1].start,n[e+1][1].start=n[e-2][1].start,n.splice(e-2,2)),n}function yH(n,e,t){const i=this;let l,o,a,u,f;return d;function d(z){return m(z)}function m(z){return n.enter("htmlFlow"),n.enter("htmlFlowData"),n.consume(z),g}function g(z){return z===33?(n.consume(z),b):z===47?(n.consume(z),o=!0,S):z===63?(n.consume(z),l=3,i.interrupt?e:T):zn(z)?(n.consume(z),a=String.fromCharCode(z),C):t(z)}function b(z){return z===45?(n.consume(z),l=2,v):z===91?(n.consume(z),l=5,u=0,w):zn(z)?(n.consume(z),l=4,i.interrupt?e:T):t(z)}function v(z){return z===45?(n.consume(z),i.interrupt?e:T):t(z)}function w(z){const R="CDATA[";return z===R.charCodeAt(u++)?(n.consume(z),u===R.length?i.interrupt?e:I:w):t(z)}function S(z){return zn(z)?(n.consume(z),a=String.fromCharCode(z),C):t(z)}function C(z){if(z===null||z===47||z===62||_t(z)){const R=z===47,Q=a.toLowerCase();return!R&&!o&&ay.includes(Q)?(l=1,i.interrupt?e(z):I(z)):XA.includes(a.toLowerCase())?(l=6,R?(n.consume(z),N):i.interrupt?e(z):I(z)):(l=7,i.interrupt&&!i.parser.lazy[i.now().line]?t(z):o?j(z):D(z))}return z===45||Bn(z)?(n.consume(z),a+=String.fromCharCode(z),C):t(z)}function N(z){return z===62?(n.consume(z),i.interrupt?e:I):t(z)}function j(z){return Je(z)?(n.consume(z),j):F(z)}function D(z){return z===47?(n.consume(z),F):z===58||z===95||zn(z)?(n.consume(z),U):Je(z)?(n.consume(z),D):F(z)}function U(z){return z===45||z===46||z===58||z===95||Bn(z)?(n.consume(z),U):H(z)}function H(z){return z===61?(n.consume(z),M):Je(z)?(n.consume(z),H):D(z)}function M(z){return z===null||z===60||z===61||z===62||z===96?t(z):z===34||z===39?(n.consume(z),f=z,A):Je(z)?(n.consume(z),M):L(z)}function A(z){return z===f?(n.consume(z),f=null,ne):z===null||Ie(z)?t(z):(n.consume(z),A)}function L(z){return z===null||z===34||z===39||z===47||z===60||z===61||z===62||z===96||_t(z)?H(z):(n.consume(z),L)}function ne(z){return z===47||z===62||Je(z)?D(z):t(z)}function F(z){return z===62?(n.consume(z),W):t(z)}function W(z){return z===null||Ie(z)?I(z):Je(z)?(n.consume(z),W):t(z)}function I(z){return z===45&&l===2?(n.consume(z),Z):z===60&&l===1?(n.consume(z),oe):z===62&&l===4?(n.consume(z),de):z===63&&l===3?(n.consume(z),T):z===93&&l===5?(n.consume(z),G):Ie(z)&&(l===6||l===7)?(n.exit("htmlFlowData"),n.check(gH,be,re)(z)):z===null||Ie(z)?(n.exit("htmlFlowData"),re(z)):(n.consume(z),I)}function re(z){return n.check(oy,pe,be)(z)}function pe(z){return n.enter("lineEnding"),n.consume(z),n.exit("lineEnding"),ce}function ce(z){return z===null||Ie(z)?re(z):(n.enter("htmlFlowData"),I(z))}function Z(z){return z===45?(n.consume(z),T):I(z)}function oe(z){return z===47?(n.consume(z),a="",K):I(z)}function K(z){if(z===62){const R=a.toLowerCase();return ay.includes(R)?(n.consume(z),de):I(z)}return zn(z)&&a.length<8?(n.consume(z),a+=String.fromCharCode(z),K):I(z)}function G(z){return z===93?(n.consume(z),T):I(z)}function T(z){return z===62?(n.consume(z),de):z===45&&l===2?(n.consume(z),T):I(z)}function de(z){return z===null||Ie(z)?(n.exit("htmlFlowData"),be(z)):(n.consume(z),de)}function be(z){return n.exit("htmlFlow"),e(z)}}function bH(n,e,t){return i;function i(l){return n.enter("lineEnding"),n.consume(l),n.exit("lineEnding"),n.attempt(Bu,e,t)}}const vH={name:"htmlText",tokenize:wH};function wH(n,e,t){const i=this;let l,o,a;return u;function u(T){return n.enter("htmlText"),n.enter("htmlTextData"),n.consume(T),f}function f(T){return T===33?(n.consume(T),d):T===47?(n.consume(T),H):T===63?(n.consume(T),D):zn(T)?(n.consume(T),L):t(T)}function d(T){return T===45?(n.consume(T),m):T===91?(n.consume(T),o=0,w):zn(T)?(n.consume(T),j):t(T)}function m(T){return T===45?(n.consume(T),v):t(T)}function g(T){return T===null?t(T):T===45?(n.consume(T),b):Ie(T)?(a=g,oe(T)):(n.consume(T),g)}function b(T){return T===45?(n.consume(T),v):g(T)}function v(T){return T===62?Z(T):T===45?b(T):g(T)}function w(T){const de="CDATA[";return T===de.charCodeAt(o++)?(n.consume(T),o===de.length?S:w):t(T)}function S(T){return T===null?t(T):T===93?(n.consume(T),C):Ie(T)?(a=S,oe(T)):(n.consume(T),S)}function C(T){return T===93?(n.consume(T),N):S(T)}function N(T){return T===62?Z(T):T===93?(n.consume(T),N):S(T)}function j(T){return T===null||T===62?Z(T):Ie(T)?(a=j,oe(T)):(n.consume(T),j)}function D(T){return T===null?t(T):T===63?(n.consume(T),U):Ie(T)?(a=D,oe(T)):(n.consume(T),D)}function U(T){return T===62?Z(T):D(T)}function H(T){return zn(T)?(n.consume(T),M):t(T)}function M(T){return T===45||Bn(T)?(n.consume(T),M):A(T)}function A(T){return Ie(T)?(a=A,oe(T)):Je(T)?(n.consume(T),A):Z(T)}function L(T){return T===45||Bn(T)?(n.consume(T),L):T===47||T===62||_t(T)?ne(T):t(T)}function ne(T){return T===47?(n.consume(T),Z):T===58||T===95||zn(T)?(n.consume(T),F):Ie(T)?(a=ne,oe(T)):Je(T)?(n.consume(T),ne):Z(T)}function F(T){return T===45||T===46||T===58||T===95||Bn(T)?(n.consume(T),F):W(T)}function W(T){return T===61?(n.consume(T),I):Ie(T)?(a=W,oe(T)):Je(T)?(n.consume(T),W):ne(T)}function I(T){return T===null||T===60||T===61||T===62||T===96?t(T):T===34||T===39?(n.consume(T),l=T,re):Ie(T)?(a=I,oe(T)):Je(T)?(n.consume(T),I):(n.consume(T),pe)}function re(T){return T===l?(n.consume(T),l=void 0,ce):T===null?t(T):Ie(T)?(a=re,oe(T)):(n.consume(T),re)}function pe(T){return T===null||T===34||T===39||T===60||T===61||T===96?t(T):T===47||T===62||_t(T)?ne(T):(n.consume(T),pe)}function ce(T){return T===47||T===62||_t(T)?ne(T):t(T)}function Z(T){return T===62?(n.consume(T),n.exit("htmlTextData"),n.exit("htmlText"),e):t(T)}function oe(T){return n.exit("htmlTextData"),n.enter("lineEnding"),n.consume(T),n.exit("lineEnding"),K}function K(T){return Je(T)?gt(n,G,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(T):G(T)}function G(T){return n.enter("htmlTextData"),a(T)}}const pb={name:"labelEnd",resolveAll:OH,resolveTo:NH,tokenize:TH},kH={tokenize:AH},SH={tokenize:EH},CH={tokenize:MH};function OH(n){let e=-1;const t=[];for(;++e0&&l[l.length-1]._balanced;)l.pop();o=l[l.length-1]}return u;function u(b){return o?o._inactive?g(b):(a=i.parser.defined.includes(fr(i.sliceSerialize({start:o.end,end:i.now()}))),n.enter("labelEnd"),n.enter("labelMarker"),n.consume(b),n.exit("labelMarker"),n.exit("labelEnd"),f):t(b)}function f(b){return b===40?n.attempt(kH,m,a?m:g)(b):b===91?n.attempt(SH,m,a?d:g)(b):a?m(b):g(b)}function d(b){return n.attempt(CH,m,g)(b)}function m(b){return l.pop(),e(b)}function g(b){return o._balanced=!0,t(b)}}function AH(n,e,t){return i;function i(g){return n.enter("resource"),n.enter("resourceMarker"),n.consume(g),n.exit("resourceMarker"),l}function l(g){return _t(g)?au(n,o)(g):o(g)}function o(g){return g===41?m(g):qA(n,a,u,"resourceDestination","resourceDestinationLiteral","resourceDestinationLiteralMarker","resourceDestinationRaw","resourceDestinationString",32)(g)}function a(g){return _t(g)?au(n,f)(g):m(g)}function u(g){return t(g)}function f(g){return g===34||g===39||g===40?QA(n,d,t,"resourceTitle","resourceTitleMarker","resourceTitleString")(g):m(g)}function d(g){return _t(g)?au(n,m)(g):m(g)}function m(g){return g===41?(n.enter("resourceMarker"),n.consume(g),n.exit("resourceMarker"),n.exit("resource"),e):t(g)}}function EH(n,e,t){const i=this;return l;function l(u){return VA.call(i,n,o,a,"reference","referenceMarker","referenceString")(u)}function o(u){return i.parser.defined.includes(fr(i.sliceSerialize(i.events[i.events.length-1][1]).slice(1,-1)))?e(u):t(u)}function a(u){return t(u)}}function MH(n,e,t){return i;function i(o){return n.enter("reference"),n.enter("referenceMarker"),n.consume(o),n.exit("referenceMarker"),l}function l(o){return o===93?(n.enter("referenceMarker"),n.consume(o),n.exit("referenceMarker"),n.exit("reference"),e):t(o)}}const DH={name:"labelStartImage",resolveAll:pb.resolveAll,tokenize:RH};function RH(n,e,t){const i=this;let l;return o;function o(f){return n.enter("labelImage"),n.enter("labelImageMarker"),n.consume(f),n.exit("labelImageMarker"),a}function a(f){return f===91?(n.enter("labelMarker"),n.consume(f),n.exit("labelMarker"),l=n.exit("labelImage"),u):t(f)}function u(f){return f===94&&"_hiddenFootnoteSupport"in i.parser.constructs?t(f):(i._labelStarts=i._labelStarts||[],i._labelStarts.push(l),e(f))}}const jH={name:"labelStartLink",resolveAll:pb.resolveAll,tokenize:_H};function _H(n,e,t){const i=this;let l;return o;function o(u){return n.enter("labelLink"),n.enter("labelMarker"),n.consume(u),n.exit("labelMarker"),l=n.exit("labelLink"),a}function a(u){return u===94&&"_hiddenFootnoteSupport"in i.parser.constructs?t(u):(i._labelStarts=i._labelStarts||[],i._labelStarts.push(l),e(u))}}const B0={name:"lineEnding",tokenize:LH};function LH(n,e){return t;function t(i){return n.enter("lineEnding"),n.consume(i),n.exit("lineEnding"),gt(n,e,"linePrefix")}}const ud={name:"thematicBreak",tokenize:zH};function zH(n,e,t){let i=0,l;return o;function o(d){return n.enter("thematicBreak"),a(d)}function a(d){return l=d,u(d)}function u(d){return d===l?(n.enter("thematicBreakSequence"),f(d)):i>=3&&(d===null||Ie(d))?(n.exit("thematicBreak"),e(d)):t(d)}function f(d){return d===l?(n.consume(d),i++,f):(n.exit("thematicBreakSequence"),Je(d)?gt(n,u,"whitespace")(d):u(d))}}const di={continuation:{tokenize:IH},exit:FH,name:"list",tokenize:HH},BH={partial:!0,tokenize:qH},PH={partial:!0,tokenize:UH};function HH(n,e,t){const i=this,l=i.events[i.events.length-1];let o=l&&l[1].type==="linePrefix"?l[2].sliceSerialize(l[1],!0).length:0,a=0;return u;function u(v){const w=i.containerState.type||(v===42||v===43||v===45?"listUnordered":"listOrdered");if(w==="listUnordered"?!i.containerState.marker||v===i.containerState.marker:ly(v)){if(i.containerState.type||(i.containerState.type=w,n.enter(w,{_container:!0})),w==="listUnordered")return n.enter("listItemPrefix"),v===42||v===45?n.check(ud,t,d)(v):d(v);if(!i.interrupt||v===49)return n.enter("listItemPrefix"),n.enter("listItemValue"),f(v)}return t(v)}function f(v){return ly(v)&&++a<10?(n.consume(v),f):(!i.interrupt||a<2)&&(i.containerState.marker?v===i.containerState.marker:v===41||v===46)?(n.exit("listItemValue"),d(v)):t(v)}function d(v){return n.enter("listItemMarker"),n.consume(v),n.exit("listItemMarker"),i.containerState.marker=i.containerState.marker||v,n.check(Bu,i.interrupt?t:m,n.attempt(BH,b,g))}function m(v){return i.containerState.initialBlankLine=!0,o++,b(v)}function g(v){return Je(v)?(n.enter("listItemPrefixWhitespace"),n.consume(v),n.exit("listItemPrefixWhitespace"),b):t(v)}function b(v){return i.containerState.size=o+i.sliceSerialize(n.exit("listItemPrefix"),!0).length,e(v)}}function IH(n,e,t){const i=this;return i.containerState._closeFlow=void 0,n.check(Bu,l,o);function l(u){return i.containerState.furtherBlankLines=i.containerState.furtherBlankLines||i.containerState.initialBlankLine,gt(n,e,"listItemIndent",i.containerState.size+1)(u)}function o(u){return i.containerState.furtherBlankLines||!Je(u)?(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,a(u)):(i.containerState.furtherBlankLines=void 0,i.containerState.initialBlankLine=void 0,n.attempt(PH,e,a)(u))}function a(u){return i.containerState._closeFlow=!0,i.interrupt=void 0,gt(n,n.attempt(di,e,t),"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(u)}}function UH(n,e,t){const i=this;return gt(n,l,"listItemIndent",i.containerState.size+1);function l(o){const a=i.events[i.events.length-1];return a&&a[1].type==="listItemIndent"&&a[2].sliceSerialize(a[1],!0).length===i.containerState.size?e(o):t(o)}}function FH(n){n.exit(this.containerState.type)}function qH(n,e,t){const i=this;return gt(n,l,"listItemPrefixWhitespace",i.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function l(o){const a=i.events[i.events.length-1];return!Je(o)&&a&&a[1].type==="listItemPrefixWhitespace"?e(o):t(o)}}const gC={name:"setextUnderline",resolveTo:VH,tokenize:QH};function VH(n,e){const t=new Vd;let i=n.length,l,o,a;for(;i--;)if(n[i][0]==="enter"){if(n[i][1].type==="content"){l=i;break}n[i][1].type==="paragraph"&&(o=i)}else n[i][1].type==="content"&&t.add(i,1,[]),!a&&n[i][1].type==="definition"&&(a=i);const u={type:"setextHeading",start:{...n[l][1].start},end:{...n[n.length-1][1].end}};return n[o][1].type="setextHeadingText",a?(t.add(o,0,[["enter",u,e]]),t.add(a+1,0,[["exit",n[l][1],e]]),n[l][1].end={...n[a][1].end}):n[l][1]=u,t.add(n.length,0,[["exit",u,e]]),t.consume(n),n}function QH(n,e,t){const i=this;let l;return o;function o(d){let m=i.events.length,g;for(;m--;)if(i.events[m][1].type!=="lineEnding"&&i.events[m][1].type!=="linePrefix"&&i.events[m][1].type!=="content"){g=i.events[m][1].type==="paragraph";break}return!i.parser.lazy[i.now().line]&&(i.interrupt||g)?(n.enter("setextHeadingLine"),l=d,a(d)):t(d)}function a(d){return n.enter("setextHeadingLineSequence"),u(d)}function u(d){return d===l?(n.consume(d),u):(n.exit("setextHeadingLineSequence"),Je(d)?gt(n,f,"lineSuffix")(d):f(d))}function f(d){return d===null||Ie(d)?(n.exit("setextHeadingLine"),e(d)):t(d)}}const XH={tokenize:$H};function $H(n){const e=this,t=n.attempt(Bu,i,n.attempt(this.parser.constructs.flowInitial,l,gt(n,n.attempt(this.parser.constructs.flow,l,n.attempt(tH,l)),"linePrefix")));return t;function i(o){if(o===null){n.consume(o);return}return n.enter("lineEndingBlank"),n.consume(o),n.exit("lineEndingBlank"),e.currentConstruct=void 0,t}function l(o){if(o===null){n.consume(o);return}return n.enter("lineEnding"),n.consume(o),n.exit("lineEnding"),e.currentConstruct=void 0,t}}const YH={resolveAll:YA()},GH=$A("string"),KH=$A("text");function $A(n){return{resolveAll:YA(n==="text"?WH:void 0),tokenize:e};function e(t){const i=this,l=this.parser.constructs[n],o=t.attempt(l,a,u);return a;function a(m){return d(m)?o(m):u(m)}function u(m){if(m===null){t.consume(m);return}return t.enter("data"),t.consume(m),f}function f(m){return d(m)?(t.exit("data"),o(m)):(t.consume(m),f)}function d(m){if(m===null)return!0;const g=l[m];let b=-1;if(g)for(;++b-1){const u=a[0];typeof u=="string"?a[0]=u.slice(i):a.shift()}o>0&&a.push(n[l].slice(0,o))}return a}function u7(n,e){let t=-1;const i=[];let l;for(;++t0&&l(e.beforeEnter,{..._e,sliceSerialize:te[ue][2].sliceSerialize},te[ue][1]),GA.call(ye,te[ue][1].type)&&ye[te[ue][1].type].call({..._e,sliceSerialize:te[ue][2].sliceSerialize},te[ue][1]),te[ue][0]==="exit"&&e.afterExit.length>0&&l(e.afterExit,{..._e,sliceSerialize:te[ue][2].sliceSerialize},te[ue][1])}if(_e.tokenStack.length>0){const ye=_e.tokenStack[_e.tokenStack.length-1];(ye[1]||yC).call(_e,void 0,ye[0])}for(fe.position={start:$l(te.length>0?te[0][1].start:{line:1,column:1,offset:0}),end:$l(te.length>0?te[te.length-2][1].end:{line:1,column:1,offset:0})},ue=-1;++ue0&&(i.className=["language-"+l[0]]);let o={type:"element",tagName:"code",properties:i,children:[{type:"text",value:t}]};return e.meta&&(o.data={meta:e.meta}),n.patch(e,o),o=n.applyData(e,o),o={type:"element",tagName:"pre",properties:{},children:[o]},n.patch(e,o),o}function C7(n,e){const t={type:"element",tagName:"del",properties:{},children:n.all(e)};return n.patch(e,t),n.applyData(e,t)}function O7(n,e){const t={type:"element",tagName:"em",properties:{},children:n.all(e)};return n.patch(e,t),n.applyData(e,t)}function N7(n,e){const t=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",i=String(e.identifier).toUpperCase(),l=Ua(i.toLowerCase()),o=n.footnoteOrder.indexOf(i);let a,u=n.footnoteCounts.get(i);u===void 0?(u=0,n.footnoteOrder.push(i),a=n.footnoteOrder.length):a=o+1,u+=1,n.footnoteCounts.set(i,u);const f={type:"element",tagName:"a",properties:{href:"#"+t+"fn-"+l,id:t+"fnref-"+l+(u>1?"-"+u:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(a)}]};n.patch(e,f);const d={type:"element",tagName:"sup",properties:{},children:[f]};return n.patch(e,d),n.applyData(e,d)}function T7(n,e){const t={type:"element",tagName:"h"+e.depth,properties:{},children:n.all(e)};return n.patch(e,t),n.applyData(e,t)}function A7(n,e){if(n.options.allowDangerousHtml){const t={type:"raw",value:e.value};return n.patch(e,t),n.applyData(e,t)}}function WA(n,e){const t=e.referenceType;let i="]";if(t==="collapsed"?i+="[]":t==="full"&&(i+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return[{type:"text",value:"!["+e.alt+i}];const l=n.all(e),o=l[0];o&&o.type==="text"?o.value="["+o.value:l.unshift({type:"text",value:"["});const a=l[l.length-1];return a&&a.type==="text"?a.value+=i:l.push({type:"text",value:i}),l}function E7(n,e){const t=String(e.identifier).toUpperCase(),i=n.definitionById.get(t);if(!i)return WA(n,e);const l={src:Ua(i.url||""),alt:e.alt};i.title!==null&&i.title!==void 0&&(l.title=i.title);const o={type:"element",tagName:"img",properties:l,children:[]};return n.patch(e,o),n.applyData(e,o)}function M7(n,e){const t={src:Ua(e.url)};e.alt!==null&&e.alt!==void 0&&(t.alt=e.alt),e.title!==null&&e.title!==void 0&&(t.title=e.title);const i={type:"element",tagName:"img",properties:t,children:[]};return n.patch(e,i),n.applyData(e,i)}function D7(n,e){const t={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};n.patch(e,t);const i={type:"element",tagName:"code",properties:{},children:[t]};return n.patch(e,i),n.applyData(e,i)}function R7(n,e){const t=String(e.identifier).toUpperCase(),i=n.definitionById.get(t);if(!i)return WA(n,e);const l={href:Ua(i.url||"")};i.title!==null&&i.title!==void 0&&(l.title=i.title);const o={type:"element",tagName:"a",properties:l,children:n.all(e)};return n.patch(e,o),n.applyData(e,o)}function j7(n,e){const t={href:Ua(e.url)};e.title!==null&&e.title!==void 0&&(t.title=e.title);const i={type:"element",tagName:"a",properties:t,children:n.all(e)};return n.patch(e,i),n.applyData(e,i)}function _7(n,e,t){const i=n.all(e),l=t?L7(t):ZA(e),o={},a=[];if(typeof e.checked=="boolean"){const m=i[0];let g;m&&m.type==="element"&&m.tagName==="p"?g=m:(g={type:"element",tagName:"p",properties:{},children:[]},i.unshift(g)),g.children.length>0&&g.children.unshift({type:"text",value:" "}),g.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:e.checked,disabled:!0},children:[]}),o.className=["task-list-item"]}let u=-1;for(;++u1}function z7(n,e){const t={},i=n.all(e);let l=-1;for(typeof e.start=="number"&&e.start!==1&&(t.start=e.start);++l0){const a={type:"element",tagName:"tbody",properties:{},children:n.wrap(t,!0)},u=cb(e.children[1]),f=AA(e.children[e.children.length-1]);u&&f&&(a.position={start:u,end:f}),l.push(a)}const o={type:"element",tagName:"table",properties:{},children:n.wrap(l,!0)};return n.patch(e,o),n.applyData(e,o)}function U7(n,e,t){const i=t?t.children:void 0,o=(i?i.indexOf(e):1)===0?"th":"td",a=t&&t.type==="table"?t.align:void 0,u=a?a.length:e.children.length;let f=-1;const d=[];for(;++f0,!0),i[0]),l=i.index+i[0].length,i=t.exec(e);return o.push(wC(e.slice(l),l>0,!1)),o.join("")}function wC(n,e,t){let i=0,l=n.length;if(e){let o=n.codePointAt(i);for(;o===bC||o===vC;)i++,o=n.codePointAt(i)}if(t){let o=n.codePointAt(l-1);for(;o===bC||o===vC;)l--,o=n.codePointAt(l-1)}return l>i?n.slice(i,l):""}function V7(n,e){const t={type:"text",value:q7(String(e.value))};return n.patch(e,t),n.applyData(e,t)}function Q7(n,e){const t={type:"element",tagName:"hr",properties:{},children:[]};return n.patch(e,t),n.applyData(e,t)}const X7={blockquote:w7,break:k7,code:S7,delete:C7,emphasis:O7,footnoteReference:N7,heading:T7,html:A7,imageReference:E7,image:M7,inlineCode:D7,linkReference:R7,link:j7,listItem:_7,list:z7,paragraph:B7,root:P7,strong:H7,table:I7,tableCell:F7,tableRow:U7,text:V7,thematicBreak:Q7,toml:Vh,yaml:Vh,definition:Vh,footnoteDefinition:Vh};function Vh(){}const JA=-1,pm=0,cu=1,Qd=2,gb=3,xb=4,yb=5,bb=6,eE=7,tE=8,{defineProperty:$7}=Object,nE=typeof self=="object"?self:globalThis,kC=(n,e)=>{switch(n){case"Function":case"SharedWorker":case"Worker":case"eval":case"setInterval":case"setTimeout":throw new TypeError("unable to deserialize "+n)}return new nE[n](e)},Y7=(n,e)=>{const t=(l,o)=>(n.set(o,l),l),i=l=>{if(n.has(l))return n.get(l);const[o,a]=e[l];switch(o){case pm:case JA:return t(a,l);case cu:{const u=t([],l);for(const f of a)u.push(i(f));return u}case Qd:{const u=t({},l);for(const[f,d]of a){const m=i(f),g=i(d);m==="__proto__"?$7(u,m,{value:g,configurable:!0,enumerable:!0,writable:!0}):u[m]=g}return u}case gb:return t(new Date(a),l);case xb:{const{source:u,flags:f}=a;return t(new RegExp(u,f),l)}case yb:{const u=t(new Map,l);for(const[f,d]of a)u.set(i(f),i(d));return u}case bb:{const u=t(new Set,l);for(const f of a)u.add(i(f));return u}case eE:{const{name:u,message:f}=a;return t(typeof nE[u]=="function"?kC(u,f):new Error(f),l)}case tE:return t(BigInt(a),l);case"BigInt":return t(Object(BigInt(a)),l);case"ArrayBuffer":return t(new Uint8Array(a).buffer,a);case"DataView":{const{buffer:u}=new Uint8Array(a);return t(new DataView(u),a)}case"-0":return-0}return t(kC(o,a),l)};return i},SC=n=>Y7(new Map,n)(0),Ks="",{toString:G7}={},{keys:K7,is:W7}=Object,Xc=n=>{const e=typeof n;if(e!=="object"||!n)return[pm,e];const t=G7.call(n).slice(8,-1);switch(t){case"Array":return[cu,Ks];case"Object":return[Qd,Ks];case"Date":return[gb,Ks];case"RegExp":return[xb,Ks];case"Map":return[yb,Ks];case"Set":return[bb,Ks];case"DataView":return[cu,t]}return t.includes("Array")?[cu,t]:n instanceof Error?[eE,n.name||"Error"]:[Qd,t]},Qh=([n,e])=>n===pm&&(e==="function"||e==="symbol"),Z7=(n,e,t,i)=>{const l=(a,u)=>{const f=i.push(a)-1;return t.set(u,f),f},o=a=>{if(t.has(a))return t.get(a);let[u,f]=Xc(a);switch(u){case pm:{let m=a;switch(f){case"bigint":u=tE,m=a.toString();break;case"number":if(!a&&W7(a,-0))return i.push(["-0"])-1;break;case"function":case"symbol":if(n)throw new TypeError("unable to serialize "+f);m=null;break;case"undefined":return l([JA],a)}return l([u,m],a)}case cu:{if(f){let b=a;return f==="DataView"?b=new Uint8Array(a.buffer):f==="ArrayBuffer"&&(b=new Uint8Array(a)),l([f,[...b]],a)}const m=[],g=l([u,m],a);for(const b of a)m.push(o(b));return g}case Qd:{if(f)switch(f){case"BigInt":return l([f,a.toString()],a);case"Boolean":case"Number":case"String":return l([f,a.valueOf()],a)}if(e&&"toJSON"in a)return o(a.toJSON());const m=[],g=l([u,m],a);for(const b of K7(a))(n||!Qh(Xc(a[b])))&&m.push([o(b),o(a[b])]);return g}case gb:return l([u,isNaN(a.getTime())?Ks:a.toISOString()],a);case xb:{const{source:m,flags:g}=a;return l([u,{source:m,flags:g}],a)}case yb:{const m=[],g=l([u,m],a);for(const[b,v]of a)(n||!(Qh(Xc(b))||Qh(Xc(v))))&&m.push([o(b),o(v)]);return g}case bb:{const m=[],g=l([u,m],a);for(const b of a)(n||!Qh(Xc(b)))&&m.push(o(b));return g}}const{message:d}=a;return l([u,{name:f,message:d}],a)};return o},CC=(n,{json:e,lossy:t}={})=>{const i=[];return Z7(!(e||t),!!e,new Map,i)(n),i},Xd=typeof structuredClone=="function"?(n,e)=>e&&("json"in e||"lossy"in e)?SC(CC(n,e)):structuredClone(n):(n,e)=>SC(CC(n,e));function J7(n,e){const t=[{type:"text",value:"↩"}];return e>1&&t.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(e)}]}),t}function eI(n,e){return"Back to reference "+(n+1)+(e>1?"-"+e:"")}function tI(n){const e=typeof n.options.clobberPrefix=="string"?n.options.clobberPrefix:"user-content-",t=n.options.footnoteBackContent||J7,i=n.options.footnoteBackLabel||eI,l=n.options.footnoteLabel||"Footnotes",o=n.options.footnoteLabelTagName||"h2",a=n.options.footnoteLabelProperties||{className:["sr-only"]},u=[];let f=-1;for(;++f0&&w.push({type:"text",value:" "});let j=typeof t=="string"?t:t(f,v);typeof j=="string"&&(j={type:"text",value:j}),w.push({type:"element",tagName:"a",properties:{href:"#"+e+"fnref-"+b+(v>1?"-"+v:""),dataFootnoteBackref:"",ariaLabel:typeof i=="string"?i:i(f,v),className:["data-footnote-backref"]},children:Array.isArray(j)?j:[j]})}const C=m[m.length-1];if(C&&C.type==="element"&&C.tagName==="p"){const j=C.children[C.children.length-1];j&&j.type==="text"?j.value+=" ":C.children.push({type:"text",value:" "}),C.children.push(...w)}else m.push(...w);const N={type:"element",tagName:"li",properties:{id:e+"fn-"+b},children:n.wrap(m,!0)};n.patch(d,N),u.push(N)}if(u.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:o,properties:{...Xd(a),id:"footnote-label"},children:[{type:"text",value:l}]},{type:"text",value:` +`},{type:"element",tagName:"ol",properties:{},children:n.wrap(u,!0)},{type:"text",value:` +`}]}}const gm=(function(n){if(n==null)return lI;if(typeof n=="function")return xm(n);if(typeof n=="object")return Array.isArray(n)?nI(n):iI(n);if(typeof n=="string")return rI(n);throw new Error("Expected function, string, or object as test")});function nI(n){const e=[];let t=-1;for(;++t":""))+")"})}return C;function C(){const N=!o||d(b,v,w[w.length-1]||void 0);let j=iE;if(u&&N&&(j=OC(u(b,w,v)),j[0]===fd))return j;if("children"in b&&b.children){const D=b;if(D.children&&j[0]!==cy){let U=(l?-1:D.children.length)+m;const H=[...w,D];for(;U>-1&&U0&&t.push({type:"text",value:` +`}),t}function NC(n){let e=0,t=n.charCodeAt(e);for(;t===9||t===32;)e++,t=n.charCodeAt(e);return n.slice(e)}function TC(n,e){const t=uI(n,e),i=t.one(n,void 0),l=tI(t),o=Array.isArray(i)?{type:"root",children:i}:i||{type:"root",children:[]};return l&&o.children.push({type:"text",value:` +`},l),o}function pI(n,e){return n&&"run"in n?async function(t,i){const l=TC(t,{file:i,...e});await n.run(l,i)}:function(t,i){return TC(t,{file:i,...n||e})}}function AC(n){if(n)throw n}var P0,EC;function gI(){if(EC)return P0;EC=1;var n=Object.prototype.hasOwnProperty,e=Object.prototype.toString,t=Object.defineProperty,i=Object.getOwnPropertyDescriptor,l=function(d){return typeof Array.isArray=="function"?Array.isArray(d):e.call(d)==="[object Array]"},o=function(d){if(!d||e.call(d)!=="[object Object]")return!1;var m=n.call(d,"constructor"),g=d.constructor&&d.constructor.prototype&&n.call(d.constructor.prototype,"isPrototypeOf");if(d.constructor&&!m&&!g)return!1;var b;for(b in d);return typeof b>"u"||n.call(d,b)},a=function(d,m){t&&m.name==="__proto__"?t(d,m.name,{enumerable:!0,configurable:!0,value:m.newValue,writable:!0}):d[m.name]=m.newValue},u=function(d,m){if(m==="__proto__")if(n.call(d,m)){if(i)return i(d,m).value}else return;return d[m]};return P0=function f(){var d,m,g,b,v,w,S=arguments[0],C=1,N=arguments.length,j=!1;for(typeof S=="boolean"&&(j=S,S=arguments[1]||{},C=2),(S==null||typeof S!="object"&&typeof S!="function")&&(S={});Ca.length;let f;u&&a.push(l);try{f=n.apply(this,a)}catch(d){const m=d;if(u&&t)throw m;return l(m)}u||(f&&f.then&&typeof f.then=="function"?f.then(o,l):f instanceof Error?l(f):o(f))}function l(a,...u){t||(t=!0,e(a,...u))}function o(a){l(null,a)}}const Mr={basename:vI,dirname:wI,extname:kI,join:SI,sep:"/"};function vI(n,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');Pu(n);let t=0,i=-1,l=n.length,o;if(e===void 0||e.length===0||e.length>n.length){for(;l--;)if(n.codePointAt(l)===47){if(o){t=l+1;break}}else i<0&&(o=!0,i=l+1);return i<0?"":n.slice(t,i)}if(e===n)return"";let a=-1,u=e.length-1;for(;l--;)if(n.codePointAt(l)===47){if(o){t=l+1;break}}else a<0&&(o=!0,a=l+1),u>-1&&(n.codePointAt(l)===e.codePointAt(u--)?u<0&&(i=l):(u=-1,i=a));return t===i?i=a:i<0&&(i=n.length),n.slice(t,i)}function wI(n){if(Pu(n),n.length===0)return".";let e=-1,t=n.length,i;for(;--t;)if(n.codePointAt(t)===47){if(i){e=t;break}}else i||(i=!0);return e<0?n.codePointAt(0)===47?"/":".":e===1&&n.codePointAt(0)===47?"//":n.slice(0,e)}function kI(n){Pu(n);let e=n.length,t=-1,i=0,l=-1,o=0,a;for(;e--;){const u=n.codePointAt(e);if(u===47){if(a){i=e+1;break}continue}t<0&&(a=!0,t=e+1),u===46?l<0?l=e:o!==1&&(o=1):l>-1&&(o=-1)}return l<0||t<0||o===0||o===1&&l===t-1&&l===i+1?"":n.slice(l,t)}function SI(...n){let e=-1,t;for(;++e0&&n.codePointAt(n.length-1)===47&&(t+="/"),e?"/"+t:t}function OI(n,e){let t="",i=0,l=-1,o=0,a=-1,u,f;for(;++a<=n.length;){if(a2){if(f=t.lastIndexOf("/"),f!==t.length-1){f<0?(t="",i=0):(t=t.slice(0,f),i=t.length-1-t.lastIndexOf("/")),l=a,o=0;continue}}else if(t.length>0){t="",i=0,l=a,o=0;continue}}e&&(t=t.length>0?t+"/..":"..",i=2)}else t.length>0?t+="/"+n.slice(l+1,a):t=n.slice(l+1,a),i=a-l-1;l=a,o=0}else u===46&&o>-1?o++:o=-1}return t}function Pu(n){if(typeof n!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(n))}const NI={cwd:TI};function TI(){return"/"}function my(n){return!!(n!==null&&typeof n=="object"&&"href"in n&&n.href&&"protocol"in n&&n.protocol&&n.auth===void 0)}function AI(n){if(typeof n=="string")n=new URL(n);else if(!my(n)){const e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+n+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(n.protocol!=="file:"){const e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return EI(n)}function EI(n){if(n.hostname!==""){const i=new TypeError('File URL host must be "localhost" or empty on darwin');throw i.code="ERR_INVALID_FILE_URL_HOST",i}const e=n.pathname;let t=-1;for(;++t0){let[v,...w]=m;const S=i[b][1];dy(S)&&dy(v)&&(v=H0(!0,S,v)),i[b]=[d,v,...w]}}}}const jI=new wb().freeze();function q0(n,e){if(typeof e!="function")throw new TypeError("Cannot `"+n+"` without `parser`")}function V0(n,e){if(typeof e!="function")throw new TypeError("Cannot `"+n+"` without `compiler`")}function Q0(n,e){if(e)throw new Error("Cannot call `"+n+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function DC(n){if(!dy(n)||typeof n.type!="string")throw new TypeError("Expected node, got `"+n+"`")}function RC(n,e,t){if(!t)throw new Error("`"+n+"` finished async. Use `"+e+"` instead")}function Xh(n){return _I(n)?n:new rE(n)}function _I(n){return!!(n&&typeof n=="object"&&"message"in n&&"messages"in n)}function LI(n){return typeof n=="string"||zI(n)}function zI(n){return!!(n&&typeof n=="object"&&"byteLength"in n&&"byteOffset"in n)}const BI="https://github.com/remarkjs/react-markdown/blob/main/changelog.md",jC=[],_C={allowDangerousHtml:!0},PI=/^(https?|ircs?|mailto|xmpp)$/i,HI=[{from:"astPlugins",id:"remove-buggy-html-in-markdown-parser"},{from:"allowDangerousHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"allowNode",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowElement"},{from:"allowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"allowedElements"},{from:"className",id:"remove-classname"},{from:"disallowedTypes",id:"replace-allownode-allowedtypes-and-disallowedtypes",to:"disallowedElements"},{from:"escapeHtml",id:"remove-buggy-html-in-markdown-parser"},{from:"includeElementIndex",id:"#remove-includeelementindex"},{from:"includeNodeIndex",id:"change-includenodeindex-to-includeelementindex"},{from:"linkTarget",id:"remove-linktarget"},{from:"plugins",id:"change-plugins-to-remarkplugins",to:"remarkPlugins"},{from:"rawSourcePos",id:"#remove-rawsourcepos"},{from:"renderers",id:"change-renderers-to-components",to:"components"},{from:"source",id:"change-source-to-children",to:"children"},{from:"sourcePos",id:"#remove-sourcepos"},{from:"transformImageUri",id:"#add-urltransform",to:"urlTransform"},{from:"transformLinkUri",id:"#add-urltransform",to:"urlTransform"}];function II(n){const e=UI(n),t=FI(n);return qI(e.runSync(e.parse(t),t),n)}function UI(n){const e=n.rehypePlugins||jC,t=n.remarkPlugins||jC,i=n.remarkRehypeOptions?{...n.remarkRehypeOptions,..._C}:_C;return jI().use(v7).use(t).use(pI,i).use(e)}function FI(n){const e=n.children||"",t=new rE;return typeof e=="string"&&(t.value=e),t}function qI(n,e){const t=e.allowedElements,i=e.allowElement,l=e.components,o=e.disallowedElements,a=e.skipHtml,u=e.unwrapDisallowed,f=e.urlTransform||VI;for(const m of HI)Object.hasOwn(e,m.from)&&(""+m.from+(m.to?"use `"+m.to+"` instead":"remove it")+BI+m.id,void 0);return vb(n,d),sP(n,{Fragment:y.Fragment,components:l,ignoreInvalidStyle:!0,jsx:y.jsx,jsxs:y.jsxs,passKeys:!0,passNode:!0});function d(m,g,b){if(m.type==="raw"&&b&&typeof g=="number")return a?b.children.splice(g,1):b.children[g]={type:"text",value:m.value},g;if(m.type==="element"){let v;for(v in L0)if(Object.hasOwn(L0,v)&&Object.hasOwn(m.properties,v)){const w=m.properties[v],S=L0[v];(S===null||S.includes(m.tagName))&&(m.properties[v]=f(String(w||""),v,m))}}if(m.type==="element"){let v=t?!t.includes(m.tagName):o?o.includes(m.tagName):!1;if(!v&&i&&typeof g=="number"&&(v=!i(m,g,b)),v&&b&&typeof g=="number")return u&&m.children?b.children.splice(g,1,...m.children):b.children.splice(g,1),g}}}function VI(n){const e=n.indexOf(":"),t=n.indexOf("?"),i=n.indexOf("#"),l=n.indexOf("/");return e===-1||l!==-1&&e>l||t!==-1&&e>t||i!==-1&&e>i||PI.test(n.slice(0,e))?n:""}function QI(n){if(typeof n!="string")throw new TypeError("Expected a string");return n.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}function lE(n,e,t){const l=gm((t||{}).ignore||[]),o=XI(e);let a=-1;for(;++a0?{type:"text",value:M}:void 0),M===!1)v.lastIndex=U+1;else{if(S!==U&&D({type:"text",value:d.value.slice(S,U)}),Array.isArray(M))for(const A of M)D(A);else M&&D(M);S=U+j[0].length,C=!0}if(!v.global)break;j=v.exec(d.value)}return C?(S?\]}]+$/.exec(n);if(!e)return[n,void 0];n=n.slice(0,e.index);let t=e[0],i=t.indexOf(")");const l=LC(n,"(");let o=LC(n,")");for(;i!==-1&&l>o;)n+=t.slice(0,i+1),t=t.slice(i+1),i=t.indexOf(")"),o++;return[n,t]}function sE(n,e){const t=n.input.charCodeAt(n.index-1);return(n.index===0||fo(t)||dm(t))&&(!e||t!==47)}oE.peek=yU;function uU(){this.buffer()}function fU(n){this.enter({type:"footnoteReference",identifier:"",label:""},n)}function hU(){this.buffer()}function dU(n){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},n)}function mU(n){const e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.identifier=fr(this.sliceSerialize(n)).toLowerCase(),t.label=e}function pU(n){this.exit(n)}function gU(n){const e=this.resume(),t=this.stack[this.stack.length-1];t.type,t.identifier=fr(this.sliceSerialize(n)).toLowerCase(),t.label=e}function xU(n){this.exit(n)}function yU(){return"["}function oE(n,e,t,i){const l=t.createTracker(i);let o=l.move("[^");const a=t.enter("footnoteReference"),u=t.enter("reference");return o+=l.move(t.safe(t.associationId(n),{after:"]",before:o})),u(),a(),o+=l.move("]"),o}function bU(){return{enter:{gfmFootnoteCallString:uU,gfmFootnoteCall:fU,gfmFootnoteDefinitionLabelString:hU,gfmFootnoteDefinition:dU},exit:{gfmFootnoteCallString:mU,gfmFootnoteCall:pU,gfmFootnoteDefinitionLabelString:gU,gfmFootnoteDefinition:xU}}}function vU(n){let e=!1;return n&&n.firstLineBlank&&(e=!0),{handlers:{footnoteDefinition:t,footnoteReference:oE},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function t(i,l,o,a){const u=o.createTracker(a);let f=u.move("[^");const d=o.enter("footnoteDefinition"),m=o.enter("label");return f+=u.move(o.safe(o.associationId(i),{before:f,after:"]"})),m(),f+=u.move("]:"),i.children&&i.children.length>0&&(u.shift(4),f+=u.move((e?` +`:" ")+o.indentLines(o.containerFlow(i,u.current()),e?aE:wU))),d(),f}}function wU(n,e,t){return e===0?n:aE(n,e,t)}function aE(n,e,t){return(t?"":" ")+n}const kU=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];kb.attention=TU;kb.peek=AU;function SU(){return{canContainEols:["delete"],enter:{strikethrough:OU},exit:{strikethrough:NU}}}function CU(){return{handlers:{delete:kb},unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:kU}]}}function OU(n){this.enter({type:"delete",children:[],position:void 0},n)}function NU(n){this.exit(n)}function kb(n,e,t,i){const l=t.createTracker(i),o=t.stack.includes("strikethrough")?"~":"~~",a=t.enter("strikethrough");let u=l.move(o);return u+=t.containerPhrasing(n,{...l.current(),before:u,after:"~"}),u+=l.move(o),a(),u}function TU(){return{construct:"strikethrough",markers:["~"],sizes:[2,1]}}function AU(){return"~"}function EU(n){return n.length}function MU(n,e){const t=e||{},i=(t.align||[]).concat(),l=t.stringLength||EU,o=[],a=[],u=[],f=[];let d=0,m=-1;for(;++md&&(d=n[m].length);++Nf[N])&&(f[N]=D)}S.push(j)}a[m]=S,u[m]=C}let g=-1;if(typeof i=="object"&&"length"in i)for(;++gf[g]&&(f[g]=j),v[g]=j),b[g]=D}a.splice(1,0,b),u.splice(1,0,v),m=-1;const w=[];for(;++m "),o.shift(2);const a=t.indentLines(t.containerFlow(n,o.current()),_U);return l(),a}function _U(n,e,t){return">"+(t?"":" ")+n}function LU(n,e){return BC(n,e.inConstruct,!0)&&!BC(n,e.notInConstruct,!1)}function BC(n,e,t){if(typeof e=="string"&&(e=[e]),!e||e.length===0)return t;let i=-1;for(;++ia&&(a=o):o=1,l=i+e.length,i=t.indexOf(e,l);return a}function BU(n,e){return!!(e.options.fences===!1&&n.value&&!n.lang&&/[^\n\r ]/.test(n.value)&&!/^[\t ]*(?:[\n\r]|$)|(?:^|[\n\r])[\t ]*$/.test(n.value))}function PU(n){const e=n.options.fence||"`";if(e!=="`"&&e!=="~")throw new Error("Cannot serialize code with `"+e+"` for `options.fence`, expected `` ` `` or `~`");return e}function HU(n,e,t,i){const l=PU(t),o=n.value||"";if(BU(n,t)){const g=t.enter("codeIndented"),b=t.indentLines(o,IU);return g(),b}const a=t.createTracker(i),u=l.repeat(Math.max(zU(o,l)+1,3)),f=t.enter("codeFenced"),d=l==="`"?"GraveAccent":"Tilde";let m=a.move(u);if(n.lang){const g=t.enter(`codeFencedLang${d}`);m+=a.move(t.safe(n.lang,{before:m,after:" ",encode:["`"],...a.current()})),g()}if(n.lang&&n.meta){const g=t.enter(`codeFencedMeta${d}`);m+=a.move(" "),m+=a.move(t.safe(n.meta,{before:m,after:` +`,encode:["`"],...a.current()})),g()}return m+=a.move(` +`),o&&(m+=a.move(o+` +`)),m+=a.move(u),f(),m}function IU(n,e,t){return(t?"":" ")+n}function Sb(n){const e=n.options.quote||'"';if(e!=='"'&&e!=="'")throw new Error("Cannot serialize title with `"+e+"` for `options.quote`, expected `\"`, or `'`");return e}function UU(n,e,t,i){const l=Sb(t),o=l==='"'?"Quote":"Apostrophe",a=t.enter("definition");let u=t.enter("label");const f=t.createTracker(i);let d=f.move("[");return d+=f.move(t.safe(t.associationId(n),{before:d,after:"]",...f.current()})),d+=f.move("]: "),u(),!n.url||/[\0- \u007F]/.test(n.url)?(u=t.enter("destinationLiteral"),d+=f.move("<"),d+=f.move(t.safe(n.url,{before:d,after:">",...f.current()})),d+=f.move(">")):(u=t.enter("destinationRaw"),d+=f.move(t.safe(n.url,{before:d,after:n.title?" ":` +`,...f.current()}))),u(),n.title&&(u=t.enter(`title${o}`),d+=f.move(" "+l),d+=f.move(t.safe(n.title,{before:d,after:l,...f.current()})),d+=f.move(l),u()),a(),d}function FU(n){const e=n.options.emphasis||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize emphasis with `"+e+"` for `options.emphasis`, expected `*`, or `_`");return e}function $d(n){const e=n.codePointAt(0);return e===void 0?"":String.fromCodePoint(e)}function Oa(n){const e=n.codePointAt(n.length-2);return e!==void 0&&e>65535?n.slice(-2):n.slice(-1)}function cE(n){return"&#x"+n.toString(16).toUpperCase()+";"}function HC(n,e,t){const i=fs(n),l=fs(e);return i===void 0?l===void 0?t==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:i===1?l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:l===void 0?{inside:!1,outside:!1}:l===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}function qU(n){if(n.charCodeAt(0)!==60)return;const e=n.charCodeAt(1);if(e===33){const u=n.charCodeAt(2);return u===45?2:u===91?5:zn(u)?4:void 0}if(e===63)return 3;const t=e===47,i=t?2:1;let l=i,o=n.charCodeAt(l);if(!zn(o))return;for(;o===45||Bn(o);)o=n.charCodeAt(++l);const a=n.slice(i,l).toLowerCase();return!t&&o!==47&&ay.includes(a)?1:XA.includes(a)?6:7}const VU=new Map([["*",!1],["_",!0]]);function QU(n,e,t){const i=new Set;for(const o of n){const a=t.get(o);if(a&&o.attention&&e.some(u=>u.attention===o.attention))for(const u of a.tokens)i.add(u.attention)}const l=[];for(const o of n)o.attention&&i.delete(o.attention)&&l.push(o.attention);return l.reverse(),l}function uE(n,e,t){const i=[],l=new Map,o=new Map;let a=0;for(;at.index)return{chosen:f,mistake:m,tokens:d}}}}function $U(n,e){const t=new Map;for(const i of n){const l=i.tokens[0].value.charAt(0);let o=t.get(l);o||(o=[],t.set(l,o));let a=i.close?o.length:0;for(;a--&&i.start1&&d>1?2:1:d,g=u.markers.slice(u.end-m,u.end),b=i.markers.slice(i.start,i.start+m),v=g[0],w=b[0];if(v===g[m-1]&&v.value.length===m&&w===b[m-1]&&w.value.length===m&&v.attention===w.attention)e.delete(v),e.delete(w);else{const S=[...new Set([...g,...b])];for(const C of S){const N=e.get(C);N&&N.push(...S)}}u.end-=m,i.start+=m,u.start===u.end&&o.splice(a,1),a=o.length}i.open&&i.start0?w[0].value:"",C=HC(b.charCodeAt(b.length-1),S.charCodeAt(0),m);C.inside&&$h(w,!0);const N=w.length>0?Oa(w[w.length-1].value):"",j=HC(v.charCodeAt(0),N.charCodeAt(N.length-1),m);j.inside&&$h(w,!1),C.outside&&b!==` +`&&b!=="\r"&&$h(l,!1),j.outside&&(o=v),l.push({value:d,attention:f},...w,{value:d,attention:f}),a=d.charAt(d.length-1)}return l}function ym(n,e,t){let i=new Map;const l=Ob(n,i,e,t);let o=l,a=uE(o,e,t);for(;a;){const f=XU(n,i,a,e,t);if(!f){o=l;break}i=f.chosen,o=f.tokens,a=f.mistake}let u="";for(const f of o)u+=f.value;return u}Nb.attention=fE;Nb.peek=KU;function Nb(n,e,t,i){const l=t.enter("phrasing"),o=Cb(n,fE,t,t.createTracker(i)),a=ym([o],i.before,i.after);return l(),a}function fE(n,e){return{construct:"emphasis",markers:FU(e)==="*"?["*","_"]:["_","*"],sizes:[1]}}function KU(n,e,t){return t.options.emphasis||"*"}function WU(n,e){let t=!1;return vb(n,function(i){if("value"in i&&/\r?\n|\r/.test(i.value)||i.type==="break")return t=!0,fd}),!!((!n.depth||n.depth<3)&&db(n)&&(e.options.setext||t))}function ZU(n,e,t,i){const l=Math.max(Math.min(6,n.depth||1),1),o=t.createTracker(i);if(WU(n,t)){const g=t.enter("headingSetext"),b=t.enter("phrasing"),v=t.containerPhrasing(n,{...o.current(),before:` +`,after:` +`});return b(),g(),v+` +`+(l===1?"=":"-").repeat(v.length-(Math.max(v.lastIndexOf("\r"),v.lastIndexOf(` +`))+1))}const a="#".repeat(l),u=t.enter("headingAtx"),f=t.enter("phrasing");o.move(a+" ");let d=t.containerPhrasing(n,{before:"# ",after:` +`,...o.current()});const m=d.charCodeAt(0);return(m===9||m===32)&&(d=cE(m)+d.slice(1)),d=d?a+" "+d:a,t.options.closeAtx&&(d+=" "+a),f(),u(),d}hE.peek=JU;function hE(n){return n.value||""}function JU(){return"<"}dE.peek=eF;function dE(n,e,t,i){const l=Sb(t),o=l==='"'?"Quote":"Apostrophe",a=t.enter("image");let u=t.enter("label");const f=t.createTracker(i);let d=f.move("![");return d+=f.move(t.safe(n.alt,{before:d,after:"]",...f.current()})),d+=f.move("]("),u(),!n.url&&n.title||/[\0- \u007F]/.test(n.url)?(u=t.enter("destinationLiteral"),d+=f.move("<"),d+=f.move(t.safe(n.url,{before:d,after:">",...f.current()})),d+=f.move(">")):(u=t.enter("destinationRaw"),d+=f.move(t.safe(n.url,{before:d,after:n.title?" ":")",...f.current()}))),u(),n.title&&(u=t.enter(`title${o}`),d+=f.move(" "+l),d+=f.move(t.safe(n.title,{before:d,after:l,...f.current()})),d+=f.move(l),u()),d+=f.move(")"),a(),d}function eF(){return"!"}mE.peek=tF;function mE(n,e,t,i){const l=n.referenceType,o=t.enter("imageReference");let a=t.enter("label");const u=t.createTracker(i);let f=u.move("![");const d=t.safe(n.alt,{before:f,after:"]",...u.current()});f+=u.move(d+"]["),a();const m=t.stack;t.stack=m.filter(function(b){return b!=="phrasing"}),a=t.enter("reference");const g=t.safe(t.associationId(n),{before:f,after:"]",...u.current()});return a(),t.stack=m,o(),l==="full"||!d||d!==g?f+=u.move(g+"]"):l==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function tF(){return"!"}pE.peek=nF;function pE(n,e,t){let i=n.value||"",l="`",o=-1;for(;new RegExp("(^|[^`])"+l+"([^`]|$)").test(i);)l+="`";for(/[^\n\r ]/.test(i)&&(/^[\n\r ]/.test(i)&&/[\n\r ]$/.test(i)||/^`|`$/.test(i))&&(i=" "+i+" ");++o\u007F]/.test(n.url))}xE.peek=iF;function xE(n,e,t,i){const l=Sb(t),o=l==='"'?"Quote":"Apostrophe",a=t.createTracker(i);if(gE(n,t)){const w=t.stack;t.stack=w.filter(function(N){return N!=="phrasing"});const S=t.enter("autolink");let C=a.move("<");return C+=a.move(t.containerPhrasing(n,{before:C,after:">",...a.current()})),C+=a.move(">"),S(),t.stack=w,C}const u=t.enter("link");let f=t.enter("label"),d=a.move("[");const m=t.containerPhrasing(n,{before:d,after:"](",...a.current()});d+=a.move(m),f(),d+=a.move("](");const g=/[\0- \u007F]/.test(n.url),b=i.before.charAt(i.before.length-1);let v=n.title||void 0;if(!v&&!g&&(b===` +`||b==="\r")){let w=0;for(;w",...a.current()})),d+=a.move(">")):(f=t.enter("destinationRaw"),d+=a.move(t.safe(n.url,{before:d,after:typeof v=="string"?" ":")",...a.current()}))),f(),typeof v=="string"&&(f=t.enter(`title${o}`),d+=a.move(" "+l),d+=a.move(t.safe(v,{before:d,after:l,...a.current()})),d+=a.move(l),f()),d+=a.move(")"),u(),d}function iF(n,e,t){return gE(n,t)?"<":"["}yE.peek=rF;function yE(n,e,t,i){const l=n.referenceType,o=t.enter("linkReference");let a=t.enter("label");const u=t.createTracker(i);let f=u.move("[");const d=t.containerPhrasing(n,{before:f,after:"]",...u.current()});f+=u.move(d+"]["),a();const m=t.stack;t.stack=m.filter(function(b){return b!=="phrasing"}),a=t.enter("reference");const g=t.safe(t.associationId(n),{before:f,after:"]",...u.current()});return a(),t.stack=m,o(),l==="full"||!d||d!==g?f+=u.move(g+"]"):l==="shortcut"?f=f.slice(0,-1):f+=u.move("]"),f}function rF(){return"["}function Tb(n){const e=n.options.bullet||"*";if(e!=="*"&&e!=="+"&&e!=="-")throw new Error("Cannot serialize items with `"+e+"` for `options.bullet`, expected `*`, `+`, or `-`");return e}function lF(n){const e=Tb(n),t=n.options.bulletOther;if(!t)return e==="*"?"-":"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(t===e)throw new Error("Expected `bullet` (`"+e+"`) and `bulletOther` (`"+t+"`) to be different");return t}function sF(n){const e=n.options.bulletOrdered||".";if(e!=="."&&e!==")")throw new Error("Cannot serialize items with `"+e+"` for `options.bulletOrdered`, expected `.` or `)`");return e}function bE(n){const e=n.options.rule||"*";if(e!=="*"&&e!=="-"&&e!=="_")throw new Error("Cannot serialize rules with `"+e+"` for `options.rule`, expected `*`, `-`, or `_`");return e}function oF(n,e,t,i){const l=t.enter("list"),o=t.bulletCurrent;let a=n.ordered?sF(t):Tb(t);const u=n.ordered?a==="."?")":".":lF(t);let f=e&&t.bulletLastUsed?a===t.bulletLastUsed:!1;if(!n.ordered){const m=n.children?n.children[0]:void 0;if((a==="*"||a==="-")&&m&&(!m.children||!m.children[0])&&t.stack[t.stack.length-1]==="list"&&t.stack[t.stack.length-2]==="listItem"&&t.stack[t.stack.length-3]==="list"&&t.stack[t.stack.length-4]==="listItem"&&t.indexStack[t.indexStack.length-1]===0&&t.indexStack[t.indexStack.length-2]===0&&t.indexStack[t.indexStack.length-3]===0&&(f=!0),bE(t)===a&&m){let g=-1;for(;++g-1?e.start:1)+(t.options.incrementListMarker===!1?0:e.children.indexOf(n))+o);let a=o.length+1;(l==="tab"||l==="mixed"&&(e&&e.type==="list"&&e.spread||n.spread))&&(a=Math.ceil(a/4)*4);const u=t.createTracker(i);u.move(o+" ".repeat(a-o.length)),u.shift(a);const f=t.enter("listItem"),d=t.indentLines(t.containerFlow(n,u.current()),m);return f(),d;function m(g,b,v){return b?(v?"":" ".repeat(a))+g:(v?o:o+" ".repeat(a-o.length))+g}}function uF(n,e,t,i){const l=t.enter("paragraph"),o=t.enter("phrasing"),a=t.containerPhrasing(n,i);return o(),l(),a}function fF(n,e,t,i){if(!n.children.some(function(u){return RU(u)}))return t.containerFlow(n,i);const o=t.enter("phrasing"),a=t.containerPhrasing(n,i);return o(),a}function hF(n){const e=n.options.strong||"*";if(e!=="*"&&e!=="_")throw new Error("Cannot serialize strong with `"+e+"` for `options.strong`, expected `*`, or `_`");return e}Ab.attention=vE;Ab.peek=dF;function Ab(n,e,t,i){const l=t.enter("phrasing"),o=Cb(n,vE,t,t.createTracker(i)),a=ym([o],i.before,i.after);return l(),a}function vE(n,e){return{construct:"strong",markers:hF(e)==="*"?["*","_"]:["_","*"],sizes:[2]}}function dF(n,e,t){return t.options.strong||"*"}function mF(n,e,t,i){const l=e?e.children:[],o=t.indexStack[t.indexStack.length-1];return t.safe(n.value,{...i,afterNode:l[o+1],beforeNode:l[o-1]})}function pF(n){const e=n.options.ruleRepetition||3;if(e<3)throw new Error("Cannot serialize rules with repetition `"+e+"` for `options.ruleRepetition`, expected `3` or more");return e}function gF(n,e,t){const i=(bE(t)+(t.options.ruleSpaces?" ":"")).repeat(pF(t));return t.options.ruleSpaces?i.slice(0,-1):i}const wE={blockquote:jU,break:PC,code:HU,definition:UU,emphasis:Nb,hardBreak:PC,heading:ZU,html:hE,image:dE,imageReference:mE,inlineCode:pE,link:xE,linkReference:yE,list:oF,listItem:cF,paragraph:uF,root:fF,strong:Ab,text:mF,thematicBreak:gF};function xF(){return{enter:{table:yF,tableData:IC,tableHeader:IC,tableRow:vF},exit:{codeText:wF,table:bF,tableData:G0,tableHeader:G0,tableRow:G0}}}function yF(n){const e=n._align;this.enter({type:"table",align:e.map(function(t){return t==="none"?null:t}),children:[]},n),this.data.inTable=!0}function bF(n){this.exit(n),this.data.inTable=void 0}function vF(n){this.enter({type:"tableRow",children:[]},n)}function G0(n){this.exit(n)}function IC(n){this.enter({type:"tableCell",children:[]},n)}function wF(n){let e=this.resume();this.data.inTable&&(e=e.replace(/\\([\\|])/g,kF));const t=this.stack[this.stack.length-1];t.type,t.value=e,this.exit(n)}function kF(n,e){return e==="|"?e:n}function SF(n){const e=n||{},t=e.tableCellPadding,i=e.tablePipeAlign,l=e.stringLength,o=t?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:b,table:a,tableCell:f,tableRow:u}};function a(v,w,S,C){return d(m(v,S,C),v.align)}function u(v,w,S,C){const N=g(v,S,C),j=d([N]);return j.slice(0,j.indexOf(` +`))}function f(v,w,S,C){const N=S.enter("tableCell"),j=S.enter("phrasing"),D=S.containerPhrasing(v,{...C,before:o,after:o});return j(),N(),D}function d(v,w){return MU(v,{align:w,alignDelimiters:i,padding:t,stringLength:l})}function m(v,w,S){const C=v.children;let N=-1;const j=[],D=w.enter("table");for(;++N0&&!t&&(n[n.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),t}const UF={tokenize:GF,partial:!0};function FF(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:XF,continuation:{tokenize:$F},exit:YF}},text:{91:{name:"gfmFootnoteCall",tokenize:QF},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:qF,resolveTo:VF}}}}function qF(n,e,t){const i=this;let l=i.events.length;const o=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let a;for(;l--;){const f=i.events[l][1];if(f.type==="labelImage"){a=f;break}if(f.type==="gfmFootnoteCall"||f.type==="labelLink"||f.type==="label"||f.type==="image"||f.type==="link")break}return u;function u(f){if(!a||!a._balanced)return t(f);const d=fr(i.sliceSerialize({start:a.end,end:i.now()}));return d.codePointAt(0)!==94||!o.includes(d.slice(1))?t(f):(n.enter("gfmFootnoteCallLabelMarker"),n.consume(f),n.exit("gfmFootnoteCallLabelMarker"),e(f))}}function VF(n,e){let t=n.length;for(;t--;)if(n[t][1].type==="labelImage"&&n[t][0]==="enter"){n[t][1];break}n[t+1][1].type="data",n[t+3][1].type="gfmFootnoteCallLabelMarker";const i={type:"gfmFootnoteCall",start:Object.assign({},n[t+3][1].start),end:Object.assign({},n[n.length-1][1].end)},l={type:"gfmFootnoteCallMarker",start:Object.assign({},n[t+3][1].end),end:Object.assign({},n[t+3][1].end)};l.end.column++,l.end.offset++,l.end._bufferIndex++;const o={type:"gfmFootnoteCallString",start:Object.assign({},l.end),end:Object.assign({},n[n.length-1][1].start)},a={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},u=[n[t+1],n[t+2],["enter",i,e],n[t+3],n[t+4],["enter",l,e],["exit",l,e],["enter",o,e],["enter",a,e],["exit",a,e],["exit",o,e],n[n.length-2],n[n.length-1],["exit",i,e]];return n.splice(t,n.length-t+1,...u),n}function QF(n,e,t){const i=this,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o=0,a;return u;function u(g){return n.enter("gfmFootnoteCall"),n.enter("gfmFootnoteCallLabelMarker"),n.consume(g),n.exit("gfmFootnoteCallLabelMarker"),f}function f(g){return g!==94?t(g):(n.enter("gfmFootnoteCallMarker"),n.consume(g),n.exit("gfmFootnoteCallMarker"),n.enter("gfmFootnoteCallString"),n.enter("chunkString").contentType="string",d)}function d(g){if(o>999||g===93&&!a||g===null||g===91||_t(g))return t(g);if(g===93){n.exit("chunkString");const b=n.exit("gfmFootnoteCallString");return l.includes(fr(i.sliceSerialize(b)))?(n.enter("gfmFootnoteCallLabelMarker"),n.consume(g),n.exit("gfmFootnoteCallLabelMarker"),n.exit("gfmFootnoteCall"),e):t(g)}return _t(g)||(a=!0),o++,n.consume(g),g===92?m:d}function m(g){return g===91||g===92||g===93?(n.consume(g),o++,d):d(g)}}function XF(n,e,t){const i=this,l=i.parser.gfmFootnotes||(i.parser.gfmFootnotes=[]);let o,a=0,u;return f;function f(w){return n.enter("gfmFootnoteDefinition")._container=!0,n.enter("gfmFootnoteDefinitionLabel"),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(w),n.exit("gfmFootnoteDefinitionLabelMarker"),d}function d(w){return w===94?(n.enter("gfmFootnoteDefinitionMarker"),n.consume(w),n.exit("gfmFootnoteDefinitionMarker"),n.enter("gfmFootnoteDefinitionLabelString"),n.enter("chunkString").contentType="string",m):t(w)}function m(w){if(a>999||w===93&&!u||w===null||w===91||_t(w))return t(w);if(w===93){n.exit("chunkString");const S=n.exit("gfmFootnoteDefinitionLabelString");return o=fr(i.sliceSerialize(S)),n.enter("gfmFootnoteDefinitionLabelMarker"),n.consume(w),n.exit("gfmFootnoteDefinitionLabelMarker"),n.exit("gfmFootnoteDefinitionLabel"),b}return _t(w)||(u=!0),a++,n.consume(w),w===92?g:m}function g(w){return w===91||w===92||w===93?(n.consume(w),a++,m):m(w)}function b(w){return w===58?(n.enter("definitionMarker"),n.consume(w),n.exit("definitionMarker"),l.includes(o)||l.push(o),gt(n,v,"gfmFootnoteDefinitionWhitespace")):t(w)}function v(w){return e(w)}}function $F(n,e,t){return n.check(Bu,e,n.attempt(UF,e,t))}function YF(n){n.exit("gfmFootnoteDefinition")}function GF(n,e,t){const i=this;return gt(n,l,"gfmFootnoteDefinitionIndent",5);function l(o){const a=i.events[i.events.length-1];return a&&a[1].type==="gfmFootnoteDefinitionIndent"&&a[2].sliceSerialize(a[1],!0).length===4?e(o):t(o)}}function KF(n){let t=(n||{}).singleTilde;const i={name:"strikethrough",tokenize:o,resolveAll:l};return t==null&&(t=!0),{text:{126:i},insideSpan:{null:[i]},attentionMarkers:{null:[126]}};function l(a,u){let f=-1;for(;++f1?f(w):(a.consume(w),g++,v);if(g<2&&!t)return f(w);const C=a.exit("strikethroughSequenceTemporary"),N=fs(w);return C._open=!N||N===2&&!!S,C._close=!S||S===2&&!!N,u(w)}}}class WF{constructor(){this.map=[],this.index=new Map}add(e,t,i){ZF(this,e,t,i)}consume(e){if(this.map.sort(function(o,a){return o[0]-a[0]}),this.map.length===0)return;let t=this.map.length;const i=[];for(;t>0;)t-=1,i.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];i.push(e.slice()),e.length=0;let l=i.pop();for(;l;){for(const o of l)e.push(o);l=i.pop()}this.map.length=0,this.index.clear()}}function ZF(n,e,t,i){if(t===0&&i.length===0)return;const l=n.index.get(e);if(l){l[1]+=t,l[2].push(...i);return}const o=[e,t,i];n.map.push(o),n.index.set(e,o)}function JF(n,e){let t=!1;const i=[];for(;e-1;){const{type:pe}=i.events[W][1];if(pe==="lineEnding"||pe==="linePrefix")W--;else break}const I=W>-1?i.events[W][1].type:null,re=I==="tableHead"||I==="tableRow"?M:f;return re===M&&i.parser.lazy[i.now().line]?t(F):re(F)}function f(F){return n.enter("tableHead"),n.enter("tableRow"),d(F)}function d(F){return F===124||(a=!0,o+=1),m(F)}function m(F){return F===null?t(F):Ie(F)?o>1?(o=0,i.interrupt=!0,n.exit("tableRow"),n.enter("lineEnding"),n.consume(F),n.exit("lineEnding"),v):t(F):Je(F)?gt(n,m,"whitespace")(F):(o+=1,a&&(a=!1,l+=1),F===124?(n.enter("tableCellDivider"),n.consume(F),n.exit("tableCellDivider"),a=!0,m):(n.enter("data"),g(F)))}function g(F){return F===null||F===124||_t(F)?(n.exit("data"),m(F)):(n.consume(F),F===92?b:g)}function b(F){return F===92||F===124?(n.consume(F),g):g(F)}function v(F){return i.interrupt=!1,i.parser.lazy[i.now().line]?t(F):(n.enter("tableDelimiterRow"),a=!1,Je(F)?gt(n,w,"linePrefix",i.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(F):w(F))}function w(F){return F===45||F===58?C(F):F===124?(a=!0,n.enter("tableCellDivider"),n.consume(F),n.exit("tableCellDivider"),S):H(F)}function S(F){return Je(F)?gt(n,C,"whitespace")(F):C(F)}function C(F){return F===58?(o+=1,a=!0,n.enter("tableDelimiterMarker"),n.consume(F),n.exit("tableDelimiterMarker"),N):F===45?(o+=1,N(F)):F===null||Ie(F)?U(F):H(F)}function N(F){return F===45?(n.enter("tableDelimiterFiller"),j(F)):H(F)}function j(F){return F===45?(n.consume(F),j):F===58?(a=!0,n.exit("tableDelimiterFiller"),n.enter("tableDelimiterMarker"),n.consume(F),n.exit("tableDelimiterMarker"),D):(n.exit("tableDelimiterFiller"),D(F))}function D(F){return Je(F)?gt(n,U,"whitespace")(F):U(F)}function U(F){return F===124?w(F):F===null||Ie(F)?!a||l!==o?H(F):(n.exit("tableDelimiterRow"),n.exit("tableHead"),e(F)):H(F)}function H(F){return t(F)}function M(F){return n.enter("tableRow"),A(F)}function A(F){return F===124?(n.enter("tableCellDivider"),n.consume(F),n.exit("tableCellDivider"),A):F===null||Ie(F)?(n.exit("tableRow"),e(F)):Je(F)?gt(n,A,"whitespace")(F):(n.enter("data"),L(F))}function L(F){return F===null||F===124||_t(F)?(n.exit("data"),A(F)):(n.consume(F),F===92?ne:L)}function ne(F){return F===92||F===124?(n.consume(F),L):L(F)}}function nq(n,e){let t=-1,i=!0,l=0,o=[0,0,0,0],a=[0,0,0,0],u=!1,f=0,d,m,g;const b=new WF;for(;++tt[2]+1){const w=t[2]+1,S=t[3]-t[2]-1;n.add(w,S,[])}}n.add(t[3]+1,0,[["exit",g,e]])}return l!==void 0&&(o.end=Object.assign({},ua(e.events,l)),n.add(l,0,[["exit",o,e]]),o=void 0),o}function FC(n,e,t,i,l){const o=[],a=ua(e.events,t);l&&(l.end=Object.assign({},a),o.push(["exit",l,e])),i.end=Object.assign({},a),o.push(["exit",i,e]),n.add(t+1,0,o)}function ua(n,e){const t=n[e],i=t[0]==="enter"?"start":"end";return t[1][i]}const iq={name:"tasklistCheck",tokenize:lq};function rq(){return{text:{91:iq}}}function lq(n,e,t){const i=this;return l;function l(f){return i.previous!==null||!i._gfmTasklistFirstContentOfListItem?t(f):(n.enter("taskListCheck"),n.enter("taskListCheckMarker"),n.consume(f),n.exit("taskListCheckMarker"),o)}function o(f){return _t(f)?(n.enter("taskListCheckValueUnchecked"),n.consume(f),n.exit("taskListCheckValueUnchecked"),a):f===88||f===120?(n.enter("taskListCheckValueChecked"),n.consume(f),n.exit("taskListCheckValueChecked"),a):t(f)}function a(f){return f===93?(n.enter("taskListCheckMarker"),n.consume(f),n.exit("taskListCheckMarker"),n.exit("taskListCheck"),u):t(f)}function u(f){return Ie(f)?e(f):Je(f)?n.check({tokenize:sq},e,t)(f):t(f)}}function sq(n,e,t){return gt(n,i,"whitespace");function i(l){return l===null?t(l):e(l)}}function oq(n){return LA([RF(),FF(),KF(n),eq(),rq()])}const aq={};function cq(n){const e=this,t=n||aq,i=e.data(),l=i.micromarkExtensions||(i.micromarkExtensions=[]),o=i.fromMarkdownExtensions||(i.fromMarkdownExtensions=[]),a=i.toMarkdownExtensions||(i.toMarkdownExtensions=[]);l.push(oq(t)),o.push(AF()),a.push(EF(t))}function uq(n){return n.replace(/\\n/g,` +`).replace(/\\t/g," ").replace(/\\"/g,'"').replace(/\\'/g,"'").replace(/\\\\/g,"\\")}const fq={h1:({children:n})=>y.jsx("h3",{className:"mt-3 mb-1.5 text-base font-bold text-ink first:mt-0",children:n}),h2:({children:n})=>y.jsx("h4",{className:"mt-3 mb-1 text-sm font-semibold text-ink first:mt-0",children:n}),h3:({children:n})=>y.jsx("h5",{className:"mt-2 mb-1 text-xs font-semibold text-ink first:mt-0",children:n}),p:({children:n})=>y.jsx("p",{className:"my-1.5 leading-relaxed first:mt-0 last:mb-0",children:n}),strong:({children:n})=>y.jsx("strong",{className:"font-semibold text-ink",children:n}),em:({children:n})=>y.jsx("em",{className:"italic text-ink-secondary",children:n}),del:({children:n})=>y.jsx("del",{className:"text-ink-muted line-through",children:n}),a:({children:n,href:e})=>y.jsx("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"text-chip-indigo-text underline underline-offset-2 hover:text-ink",children:n}),code:({children:n,className:e})=>y.jsx("code",{className:`break-words rounded bg-elevated px-1 py-0.5 font-mono text-chip-indigo-text whitespace-pre-wrap ${e??""}`,children:n}),pre:({children:n})=>y.jsx("pre",{className:"my-2 overflow-x-auto rounded-lg border border-line bg-elevated p-3 font-mono text-xs text-ink [&_code]:bg-transparent [&_code]:px-0 [&_code]:py-0 [&_code]:text-inherit",children:n}),ul:({children:n})=>y.jsx("ul",{className:"my-1.5 list-disc space-y-0.5 pl-5",children:n}),ol:({children:n})=>y.jsx("ol",{className:"my-1.5 list-decimal space-y-0.5 pl-5",children:n}),li:({children:n})=>y.jsx("li",{className:"leading-relaxed",children:n}),blockquote:({children:n})=>y.jsx("blockquote",{className:"my-2 border-l-2 border-line-strong pl-3 text-ink-secondary italic",children:n}),table:({children:n})=>y.jsx("div",{className:"my-2 overflow-x-auto",children:y.jsx("table",{className:"w-full border-collapse text-xs",children:n})}),th:({children:n})=>y.jsx("th",{className:"border border-line bg-elevated px-2 py-1 text-left font-semibold",children:n}),td:({children:n})=>y.jsx("td",{className:"border border-line px-2 py-1 align-top",children:n}),hr:()=>y.jsx("hr",{className:"my-3 border-line"}),img:({alt:n,src:e,title:t})=>y.jsx("img",{src:e,alt:n,title:t,loading:"lazy",referrerPolicy:"no-referrer",className:"my-2 max-w-full rounded-lg border border-line"})};function Gh({text:n}){return n?y.jsx(II,{remarkPlugins:[cq,WI],components:fq,children:uq(n)}):null}function ME(n){return n==="completed"||n==="aborted"||n==="failed"}function $c({label:n}){return y.jsx("kbd",{"aria-hidden":"true",className:"ml-1.5 inline-block rounded border border-line/60 bg-elevated/60 px-1 py-px font-mono text-[10px] font-normal leading-none opacity-90",children:n})}function qC(n){!n||ME(n.status)||PM(n.session_id).catch(()=>{})}const hq={running:"running",completed:"done",skipped:"skipped",failed:"failed",pending:"pending"};function Kh({text:n}){const[e,t]=E.useState(!1),i=E.useRef(void 0);E.useEffect(()=>()=>window.clearTimeout(i.current),[]);const l=async()=>{try{await navigator.clipboard.writeText(n),t(!0),window.clearTimeout(i.current),i.current=window.setTimeout(()=>t(!1),1500)}catch{}};return y.jsx("button",{type:"button",onClick:l,"aria-label":e?"Copied":"Copy content",title:e?"Copied!":"Copy content",className:"absolute right-2 top-2 rounded-md p-1.5 text-ink-muted hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:e?y.jsx(Pr,{className:"h-3.5 w-3.5"}):y.jsx(mi,{className:"h-3.5 w-3.5"})})}function dq({isOpen:n,onClose:e,directory:t,filename:i,release:l,args:o,onFinished:a}){var be,z;const[u,f]=E.useState(null),[d,m]=E.useState(!1),[g,b]=E.useState(null),[v,w]=E.useState(null),[S,C]=E.useState(!1),[N,j]=E.useState(0),D=E.useRef(null),U=E.useRef(!1),H=E.useRef(null),M=E.useRef(!1);E.useEffect(()=>{if(!n||!t||!i){f(null),b(null),C(!1),w(null),M.current=!1;return}let R=!0;return m(!0),b(null),C(!1),w(null),zM({directory:t,filename:i,release:l,args:o}).then(Q=>{R&&(f(Q),m(!1),(Q.status==="completed"||Q.status==="aborted"||Q.status==="failed")&&(a==null||a(Q.status,Q.final_message||"")))}).catch(Q=>{R&&((Q==null?void 0:Q.status)===404&&C(!0),b(Q.message||"Failed to start workflow"),m(!1))}),()=>{R=!1}},[n,t,i,l,o,N]);const A=async R=>{if(!(!u||U.current)){U.current=!0,m(!0);try{const Q=await BM(u.session_id,R);f(Q),(Q.status==="completed"||Q.status==="aborted"||Q.status==="failed")&&(a==null||a(Q.status,Q.final_message||""))}catch(Q){(Q==null?void 0:Q.status)===404?(C(!0),b(Q.message||"Workflow session on the server has expired.")):b(Q.message||"Failed to process workflow response")}finally{U.current=!1,m(!1)}}},L=E.useRef(u);L.current=u;const ne=E.useRef(A);ne.current=A;const F=E.useRef(v);F.current=v;const W=E.useRef([]),I=(R,Q)=>{var ze,Te;if(R.key!=="ArrowDown"&&R.key!=="ArrowUp"&&R.key!=="Home"&&R.key!=="End")return;R.preventDefault();const he=((ze=L.current)==null?void 0:ze.steps.length)??0;if(he===0)return;const ge=R.key==="ArrowDown"?(Q+1)%he:R.key==="ArrowUp"?(Q-1+he)%he:R.key==="Home"?0:he-1;w(ge),(Te=W.current[ge])==null||Te.focus()};E.useEffect(()=>()=>qC(L.current),[]);const re=()=>{M.current||(M.current=!0,qC(L.current),e())},pe=()=>{f(null),b(null),C(!1),w(null),M.current=!1,j(R=>R+1)},ce=ms({isOpen:n,onClose:re,dialogRef:D,initialFocusRef:H});if(E.useEffect(()=>{if(!n)return;const R=Q=>{var Ae,Qt,Ft;if(Q.key==="Escape"){Q.preventDefault(),re();return}const he=L.current;if(!he)return;if(ME(he.status)){Q.key==="Enter"&&!Q.repeat&&!Q.ctrlKey&&!Q.metaKey&&!Q.altKey&&!U.current&&((Ae=Q.target)==null?void 0:Ae.tagName)!=="BUTTON"&&((Qt=document.activeElement)==null?void 0:Qt.tagName)!=="BUTTON"&&(Q.preventDefault(),re());return}if(U.current||Q.repeat||Q.ctrlKey||Q.metaKey||Q.altKey)return;const ge=Q.target;if((ge==null?void 0:ge.tagName)==="INPUT"||(ge==null?void 0:ge.tagName)==="TEXTAREA"||ge!=null&&ge.isContentEditable)return;const ze=F.current,Te=ze===null||ze===he.current_index,He=he.status==="waiting_ask"?"yes":he.status==="waiting_notify"||he.status==="waiting_notice"?"ack":null;if(!Te||He===null)return;if(Q.key==="Enter"){const xn=Q.target;if((xn==null?void 0:xn.tagName)==="BUTTON"||((Ft=document.activeElement)==null?void 0:Ft.tagName)==="BUTTON")return;Q.preventDefault(),ne.current(He);return}if(he.status!=="waiting_ask")return;const ke=Q.key.toLowerCase();ke==="y"?(Q.preventDefault(),ne.current("yes")):ke==="s"?(Q.preventDefault(),ne.current("skip")):ke==="n"&&(Q.preventDefault(),ne.current("no"))};return window.addEventListener("keydown",R),()=>window.removeEventListener("keydown",R)},[n,e]),E.useEffect(()=>{if(!n||!u)return;const R=requestAnimationFrame(()=>{var Q;return(Q=H.current)==null?void 0:Q.focus()});return()=>cancelAnimationFrame(R)},[n,u==null?void 0:u.status]),!n)return null;const Z=v!==null?u==null?void 0:u.steps[v]:u==null?void 0:u.steps[u.current_index],oe=(u==null?void 0:u.status)==="completed"||(u==null?void 0:u.status)==="aborted"||(u==null?void 0:u.status)==="failed",K=!!u&&!oe&&!S&&(((be=u.status)==null?void 0:be.startsWith("waiting"))??!1),G=(((z=u==null?void 0:u.steps[(u==null?void 0:u.current_index)??-1])==null?void 0:z.phase)??"pre")==="post",de=!S&&(v===null||v===(u==null?void 0:u.current_index))&&(Z!=null&&Z.command)&&((u==null?void 0:u.status)==="waiting_notify"||(u==null?void 0:u.status)==="waiting_notice"||(u==null?void 0:u.status)==="waiting_ask")?y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Command:"}),y.jsxs("div",{className:"relative rounded-lg border border-line bg-surface-strong p-4 pr-10 font-mono text-xs text-ink leading-relaxed",children:[y.jsx(Kh,{text:Z.command}),Z.command]})]}):null;return y.jsx("div",{ref:D,role:"dialog","aria-modal":"true","aria-labelledby":"workflow-runner-title",onKeyDown:ce,className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-xs",children:y.jsxs("div",{className:"animate-modal-in flex h-[80vh] w-full max-w-5xl flex-col rounded-xl border border-frame-line glass-panel overflow-hidden",children:[y.jsxs("div",{className:"flex items-center justify-between border-b border-line px-5 py-3.5 bg-surface-strong/30 shrink-0",children:[y.jsxs("div",{className:"flex items-center gap-2.5",children:[y.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-chip-indigo-bg text-chip-indigo-text",children:y.jsx(uO,{className:"h-4 w-4"})}),y.jsxs("div",{children:[y.jsx("h2",{id:"workflow-runner-title",className:"text-sm font-semibold text-ink",children:"Launch Workflow Engine"}),y.jsxs("p",{className:"text-xs text-ink-muted",children:[i," ",u!=null&&u.pattern?`• Pattern: ${u.pattern}`:""]})]})]}),y.jsxs("div",{className:"flex items-center gap-1.5",children:[u&&!oe&&!S&&y.jsxs("button",{type:"button",disabled:!K||d,onClick:()=>A("bypass"),title:G?"Skip the remaining post-launch steps":"Skip the remaining steps and launch with the OS default app",className:"btn inline-flex items-center gap-1.5 rounded-md border border-line bg-surface px-3 py-1.5 text-xs font-medium text-status-warning-text hover:bg-status-warning-bg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500 disabled:cursor-not-allowed disabled:opacity-40",children:[y.jsx(uD,{className:"h-3.5 w-3.5"}),G?"Skip rest":"Launch now"]}),y.jsx("button",{type:"button",onClick:re,className:"rounded-md p-1.5 text-ink-muted hover:bg-elevated hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-500",children:y.jsx(Li,{className:"h-4 w-4"})})]})]}),y.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[y.jsxs("div",{className:"w-72 border-r border-line bg-surface-strong/20 p-4 overflow-y-auto flex flex-col gap-2 shrink-0",children:[y.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wider text-ink-muted px-1 mb-1",children:"Workflow Steps (Click to inspect)"}),u&&u.steps.length>0?y.jsx("ul",{role:"list",className:"flex flex-col gap-2",children:u.steps.map((R,Q)=>{const he=u.current_index===Q&&!oe,ge=v===Q||v===null&&he,ze=hq[R.status];return y.jsx("li",{children:y.jsxs("button",{ref:Te=>{W.current[Q]=Te},type:"button",tabIndex:ge?0:-1,"aria-current":ge?"step":void 0,onKeyDown:Te=>I(Te,Q),onClick:()=>w(Q),className:`flex items-start text-left gap-2.5 rounded-lg border px-3 py-2.5 transition-colors cursor-pointer w-full ${ge?"border-chip-indigo-border bg-chip-indigo-bg shadow-xs ring-1 ring-chip-indigo-border/40":"border-line/60 bg-surface/60 hover:bg-elevated/80"}`,children:[y.jsxs("div",{className:"mt-0.5 shrink-0",children:[R.status==="running"&&y.jsx(ul,{className:"h-4 w-4 animate-spin text-chip-indigo-text"}),R.status==="completed"&&y.jsx(Gk,{className:"h-4 w-4 text-status-success-text"}),R.status==="skipped"&&y.jsx(M4,{className:"h-4 w-4 text-status-warning-text"}),R.status==="failed"&&y.jsx(Zc,{className:"h-4 w-4 text-status-danger-text"}),R.status==="pending"&&y.jsx("div",{className:"h-4 w-4 rounded-full border border-line-strong flex items-center justify-center text-[10px] text-ink-faint font-mono",children:R.index})]}),y.jsxs("div",{className:"min-w-0 flex-1",children:[y.jsxs("div",{className:"flex items-center justify-between",children:[y.jsx("span",{className:"font-mono text-[11px] font-bold uppercase text-chip-indigo-text",children:R.action}),y.jsxs("span",{className:"text-[10px] font-mono text-ink-faint",children:["#",R.index," · ",ze]})]}),y.jsx("p",{className:"truncate font-mono text-[11px] text-ink-secondary mt-0.5",title:R.command,children:R.message?R.message.split(` +`)[0]:R.command}),R.note&&y.jsx("p",{className:"mt-1 text-[10px] text-ink-faint italic",children:R.note})]})]})},R.index)})}):y.jsx("div",{className:"p-4 text-center text-xs text-ink-faint",children:g||S?"Session unavailable — see the error panel.":"Loading steps..."})]}),y.jsxs("div",{className:"flex-1 flex flex-col bg-app",children:[y.jsx("div",{className:"flex-1 min-h-0 overflow-y-auto p-6",children:y.jsx("div",{className:"space-y-6",children:y.jsxs("div",{className:"rounded-xl border border-line bg-surface p-5 shadow-xs space-y-4",children:[y.jsxs("div",{className:"flex items-center justify-between border-b border-line pb-3",children:[y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("span",{className:"rounded bg-chip-indigo-bg px-2 py-0.5 font-mono text-xs font-semibold uppercase text-chip-indigo-text",children:(Z==null?void 0:Z.action)||(u==null?void 0:u.status)}),y.jsx("span",{className:"text-xs text-ink-muted",children:Z?`Step ${Z.index} of ${u==null?void 0:u.steps.length}`:"Status"}),v!==null&&v!==(u==null?void 0:u.current_index)&&y.jsx("button",{type:"button",onClick:()=>w(null),className:"text-[11px] text-chip-indigo-text hover:underline ml-2",children:"(Return to active step)"})]}),d&&y.jsx(ul,{className:"h-4 w-4 animate-spin text-chip-indigo-text"})]}),y.jsxs("div",{className:"space-y-3 text-xs text-ink font-sans leading-relaxed",children:[(v===null||v===(u==null?void 0:u.current_index))&&(u==null?void 0:u.status)==="waiting_notify"&&u.notify_message&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Notification Message:"}),y.jsx("div",{className:"rounded-lg border border-line bg-surface-strong p-4 text-ink",children:y.jsx(Gh,{text:u.notify_message})}),de]}),(v===null||v===(u==null?void 0:u.current_index))&&(u==null?void 0:u.status)==="waiting_notice"&&u.notice_message&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Notice:"}),y.jsx("div",{className:"rounded-lg border border-line bg-surface-strong p-4 text-ink",children:y.jsx(Gh,{text:u.notice_message})}),de,y.jsx("p",{className:"text-[11px] text-ink-faint",children:"The command will run when you continue."})]}),(v===null||v===(u==null?void 0:u.current_index))&&(u==null?void 0:u.status)==="waiting_ask"&&u.ask_prompt&&y.jsxs("div",{className:"space-y-2",children:[u.ask_message&&y.jsx("div",{className:"rounded-lg border border-line bg-surface-strong p-4 text-ink",children:y.jsx(Gh,{text:u.ask_message})}),y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-status-warning-text",children:"Confirmation Prompt:"}),y.jsx("div",{className:"rounded-lg border border-status-warning-border bg-status-warning-bg p-4 text-sm font-medium text-ink",children:u.ask_prompt}),de]}),oe&&v===null&&y.jsxs("div",{className:`rounded-xl border p-8 text-center space-y-4 ${(u==null?void 0:u.status)==="completed"?"border-status-success-border bg-status-success-bg text-status-success-text":"border-status-danger-border bg-status-danger-bg text-status-danger-text"}`,children:[y.jsx("div",{className:"inline-flex h-12 w-12 items-center justify-center rounded-full bg-surface/50 mx-auto",children:(u==null?void 0:u.status)==="completed"?y.jsx(Gk,{className:"h-6 w-6 text-status-success-text"}):y.jsx(Zc,{className:"h-6 w-6 text-status-danger-text"})}),y.jsxs("div",{className:"space-y-1",children:[y.jsx("h3",{className:"text-base font-bold",children:(u==null?void 0:u.status)==="completed"?"Workflow Finished":"Workflow Terminated"}),y.jsx("p",{className:"text-xs text-ink-secondary max-w-md mx-auto",children:(u==null?void 0:u.final_message)||"The launch sequence has ended."})]}),y.jsx("div",{className:"pt-2",children:y.jsx("button",{type:"button",onClick:e,className:"btn btn-primary px-8 py-2.5 font-bold shadow-lg",children:"Close Engine Runner"})})]}),oe&&v===null&&(u==null?void 0:u.last_output)&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Command Output:"}),y.jsxs("div",{className:"relative",children:[y.jsx(Kh,{text:u.last_output}),y.jsx("pre",{className:"max-h-48 overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-line bg-surface-strong p-4 font-mono text-xs text-ink",children:u.last_output})]})]}),!S&&!(oe&&v===null)&&!((v===null||v===(u==null?void 0:u.current_index))&&((u==null?void 0:u.status)==="waiting_notify"||(u==null?void 0:u.status)==="waiting_ask"||(u==null?void 0:u.status)==="waiting_notice"))&&y.jsxs("div",{className:"space-y-4",children:[(Z==null?void 0:Z.message)&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Message:"}),y.jsx("div",{className:"rounded-lg border border-line bg-surface-strong p-4 text-xs text-ink",children:y.jsx(Gh,{text:Z.message})})]}),y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Command:"}),y.jsx("div",{className:"relative rounded-lg border border-line bg-surface-strong p-4 font-mono text-xs text-ink leading-relaxed",children:Z!=null&&Z.command?y.jsxs(y.Fragment,{children:[y.jsx(Kh,{text:Z.command}),y.jsx("span",{className:"block pr-8",children:Z.command})]}):"Waiting..."})]}),(Z==null?void 0:Z.output)&&y.jsxs("div",{className:"space-y-2",children:[y.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-ink-muted",children:"Output:"}),y.jsxs("div",{className:"relative",children:[y.jsx(Kh,{text:Z.output}),y.jsx("pre",{className:"max-h-48 overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-line bg-surface-strong p-4 font-mono text-xs text-ink",children:Z.output})]})]}),(Z==null?void 0:Z.ask)&&y.jsxs("div",{className:"rounded-lg border border-status-warning-border bg-status-warning-bg p-3 text-xs text-status-warning-text",children:[y.jsx("span",{className:"font-semibold",children:"Workflow Guard:"})," ",Z.ask]}),(Z==null?void 0:Z.note)&&y.jsxs("div",{className:"rounded-lg border border-line bg-surface-strong p-3 text-xs text-ink-muted italic",children:[y.jsx("span",{className:"font-semibold text-ink-secondary not-italic uppercase text-[10px]",children:"Log:"})," ",Z.note]})]})]})]})})}),(g||S)&&y.jsx("div",{className:"shrink-0 px-6 pt-3",children:y.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-status-danger-border bg-status-danger-bg p-3 text-xs text-status-danger-text",children:[y.jsx(Zc,{className:"mt-0.5 h-4 w-4 shrink-0"}),y.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[y.jsx("p",{children:S?"Workflow session on the server has expired or ended.":g}),S?y.jsxs("div",{className:"space-y-2",children:[g&&y.jsxs("details",{className:"text-ink-muted",children:[y.jsx("summary",{className:"cursor-pointer select-none text-[11px] underline",children:"Raw error (for bug reports)"}),y.jsx("pre",{className:"mt-1 overflow-x-auto whitespace-pre-wrap break-words font-mono text-[11px]",children:g})]}),y.jsxs("div",{className:"flex items-center gap-2",children:[y.jsx("button",{type:"button",onClick:pe,className:"btn btn-primary px-4 py-1.5 text-xs font-semibold",children:"Restart workflow"}),y.jsx("button",{type:"button",onClick:re,className:"btn rounded-md border-line bg-surface px-4 py-1.5 text-xs",children:"Close"})]})]}):null]})]})}),y.jsxs("div",{className:"shrink-0 px-6 pt-4 pb-4 border-t border-line flex items-center justify-between bg-app",children:[y.jsx("div",{className:"text-xs text-ink-muted","aria-live":"polite",children:S?"Session unavailable — restart or close above.":(u==null?void 0:u.status)==="waiting_ask"&&(v===null||v===u.current_index)?"Action required to proceed:":(u==null?void 0:u.status)==="waiting_notify"&&(v===null||v===u.current_index)?"Acknowledge message to proceed:":(u==null?void 0:u.status)==="waiting_notice"&&(v===null||v===u.current_index)?"Continue to run the command:":oe?"Session terminated.":"Step in progress..."}),y.jsxs("div",{className:"flex items-center gap-2",children:[!S&&(u==null?void 0:u.status)==="waiting_notice"&&(v===null||v===u.current_index)&&y.jsxs("button",{type:"button",ref:H,disabled:d,onClick:()=>A("ack"),className:"btn btn-primary px-5 py-2 font-semibold shadow-sm",children:["Run Command",y.jsx($c,{label:"↵"})]}),!S&&(u==null?void 0:u.status)==="waiting_notify"&&(v===null||v===u.current_index)&&y.jsxs("button",{type:"button",ref:H,disabled:d,onClick:()=>A("ack"),className:"btn btn-primary px-5 py-2 font-semibold shadow-sm",children:["Continue Workflow",y.jsx($c,{label:"↵"})]}),!S&&(u==null?void 0:u.status)==="waiting_ask"&&(v===null||v===u.current_index)&&y.jsxs(y.Fragment,{children:[y.jsxs("button",{type:"button",disabled:d,onClick:()=>A("no"),className:"btn rounded-md border-line bg-surface px-4 py-2 text-status-danger-text hover:bg-status-danger-bg",children:["Abort Launch",y.jsx($c,{label:"N"})]}),y.jsxs("button",{type:"button",disabled:d,onClick:()=>A("skip"),className:"btn rounded-md border-line bg-surface px-4 py-2 text-status-warning-text hover:bg-status-warning-bg",children:["Skip Step",y.jsx($c,{label:"S"})]}),y.jsxs("button",{type:"button",ref:H,disabled:d,onClick:()=>A("yes"),className:"btn btn-primary px-5 py-2 font-semibold shadow-sm",children:["Execute Step",y.jsx($c,{label:"Y"})]})]}),oe&&y.jsx("button",{type:"button",ref:H,onClick:e,className:"btn btn-primary px-5 py-2 font-semibold shadow-sm",children:"Close Runner"})]})]})]})]})]})})}function VC({url:n,label:e,className:t="",onCopied:i,onCopyError:l}){const o=async()=>{try{await navigator.clipboard.writeText(n),i==null||i(n)}catch{l==null||l(n)}};return y.jsxs("span",{className:`flex items-center justify-between gap-2 ${t}`.trim(),children:[y.jsx("code",{className:"truncate font-mono text-[11px] text-ink",children:n}),y.jsx("button",{type:"button",onClick:o,"aria-label":e??`Copy ${n}`,title:e??"Copy",className:"focus-ring shrink-0 rounded p-1 text-ink-faint transition-colors hover:bg-elevated hover:text-ink",children:y.jsx(mi,{className:"h-3.5 w-3.5"})})]})}const mq=";",QC="=";function pq(n){const e=n.trim().toLowerCase();return e==="extension"||e==="file_ext"||e==="filetype"?"ext":e==="directory"||e==="path"||e==="folder"?"dir":e==="recurse"||e==="recursive_search"?"recursive":e==="filter_text"||e==="query"||e==="search"?"filter":e}function XC(n){const e=n.trim();if(!e.includes(QC))return{values:{filter:e},isPlainFilter:!0};const t={};for(const i of e.split(mq)){const l=i.trim();if(!l)continue;const o=l.indexOf(QC);if(o===-1)continue;const a=pq(l.slice(0,o)),u=l.slice(o+1).trim();switch(a){case"filter":t.filter=u;break;case"ext":t.ext=u;break;case"recursive":t.recursive=$C(u,!0);break;case"dir":t.dir=u;break;case"scan":t.scan=$C(u,!1);break}}return{values:t,isPlainFilter:!1}}function $C(n,e){const t=n.toLowerCase();return["0","false","no","off"].includes(t)?!1:["1","true","yes","on"].includes(t)?!0:e}function Yc(n){return/[",\n\r]/.test(n)?`"${n.replace(/"/g,'""')}"`:n}function gq(n,e,t,i){var f,d;const l=[],a=[["Exported",new Date().toISOString()],["App Version",(t==null?void 0:t.release)??"unknown"],["Config File",(t==null?void 0:t.config_path)??"none"],["Config Exists",String((t==null?void 0:t.config_exists)??!1)],["Directory",(t==null?void 0:t.active_directory)??""],["Extensions",((f=t==null?void 0:t.extensions)==null?void 0:f.join(" | "))??""],["Filter Text",i??((d=t==null?void 0:t.filters)==null?void 0:d[0])??""],["Recursive",String((t==null?void 0:t.recursive_search)??!0)],["Title",(t==null?void 0:t.title)??""],["Release",(t==null?void 0:t.release)??""]];for(const[m,g]of a)l.push(`${Yc(m)},${Yc(g)}`);l.push("");const u=e.length>0?e:["filename","path","rel_path"];l.push(u.map(Yc).join(","));for(const m of n){const g=u.map(b=>b in m?Yc(String(m[b]??"")):Yc(m.column_values[b]??""));l.push(g.join(","))}return l.join(`\r +`)}const xq=120,YC=800,yq=4e3,GC=20;function bq(){const[n,e]=E.useState("dark"),[t,i]=E.useState(null),[l,o]=E.useState(null),[a,u]=E.useState(""),[f,d]=E.useState(""),[m,g]=E.useState(""),[b,v]=E.useState(!0),[w,S]=E.useState([]),[C,N]=E.useState(0),[j,D]=E.useState(!1),[U,H]=E.useState(!1),[M,A]=E.useState(null),[L,ne]=E.useState(!1),[F,W]=E.useState(null),[I,re]=E.useState(0),[pe,ce]=E.useState(!1),Z=E.useRef(0),oe=E.useRef(null),K=E.useRef(null),[G,T]=E.useState(""),[de,be]=E.useState(null),[z,R]=E.useState(!1),[Q,he]=E.useState(null),[ge,ze]=E.useState(!1),[Te,He]=E.useState("en"),[ke,Ae]=E.useState(!1),[Qt,Ft]=E.useState(!1),[xn,Ht]=E.useState(!1),[Ot,lt]=E.useState(0),[tn,Hn]=E.useState(!1),[qt,Kt]=E.useState(null),[Oe,qe]=E.useState(null),[$e,ht]=E.useState(!1),[te,fe]=E.useState(!1),[_e,Be]=E.useState(null),[bt,ue]=E.useState(null),[ye,De]=E.useState(!1),at=E.useRef(""),[vt,On]=E.useState(!1),[Nn,Et]=E.useState(void 0),[Wt,Gn]=E.useState(null),[In,gs]=E.useState(""),[Hu,xs]=E.useState(!1),[ys,Fa]=E.useState(null),[Wi,Kn]=E.useState(0),ki=E.useRef(null),fn=E.useRef(null),ve=(B,P="info")=>{B&&(he({message:B,kind:P}),fn.current&&clearTimeout(fn.current),fn.current=setTimeout(()=>he(null),P==="error"?1e4:3500))},bm=()=>{fn.current&&clearTimeout(fn.current),he(null)},vm=B=>{Be(B)},Un=()=>{var P;K.current&&(clearTimeout(K.current),K.current=null),(P=oe.current)==null||P.abort(),oe.current=new AbortController;const B=++Z.current;return ce(!0),H(!1),B},Pt=B=>B===Z.current,Tn=B=>{Pt(B)&&ce(!1)},nn=E.useRef(null);E.useEffect(()=>{if(!m.trim()){T("");return}const B=window.setTimeout(()=>T(m),xq);return()=>window.clearTimeout(B)},[m]);const Mt=E.useMemo(()=>G.trim()===""?w:w.filter(B=>e8(B.rel_path,G)),[w,G]),bs=m.trim()&&w.length{const B=nn.current,P=B?Mt.findIndex(ie=>ie.path===B):-1;if(P>=0){re(ie=>P!==ie?P:ie);return}re(ie=>Math.min(ie,Math.max(0,Mt.length-1)))},[Mt]);const qa=async(B,P=F)=>{var Le;const ie=await Zg({offset:0,limit:R0,sort_by:P==null?void 0:P.column,sort_dir:P==null?void 0:P.direction,signal:(Le=oe.current)==null?void 0:Le.signal});return Pt(B)?(S(ie.items),N(ie.count),D(!0),!0):!1},zi=async(B,P)=>{var ie;return!Pt(B)||(await Fk(P,(ie=oe.current)==null?void 0:ie.signal),!Pt(B)||!await qa(B))?!1:(nn.current=null,re(0),!0)},Iu=async()=>{if(U||w.length>=C)return;const B=Z.current;H(!0);try{const P=await Zg({offset:w.length,limit:R0,sort_by:F==null?void 0:F.column,sort_dir:F==null?void 0:F.direction});if(!Pt(B))return;const ie=new Set(w.map(Le=>Le.path||Le.filename));S(Le=>[...Le,...P.items.filter(ut=>!ie.has(ut.path||ut.filename))]),N(P.count)}catch{ve("Couldn't load more results — scroll to try again.","error")}finally{Pt(B)&&H(!1)}},po=async()=>{if(ge)return;ze(!0),ve("Reloading configuration...");const B=Un();try{const P=await Wh();i(P);const ie=await OM();o(ie),e($k(ie.theme));const Le=ie.active_directory||a,ut=ie.extensions[0]??"",tt=ie.filters[0]??"";Le&&u(Le),d(ut),g(tt),v(ie.recursive_search),ie.reloaded===!1?ve(`Config file not found: ${ie.config_path||"(unknown path)"} — kept current configuration.`,"error"):ve("Configuration reloaded."),Le&&await zi(B,{directory:Le,extension:ut,filter_text:tt,recursive:ie.recursive_search})}catch(P){ve(`Failed to reload configuration: ${P.message}`,"error")}finally{ze(!1),Tn(B)}},pr=async B=>{const P=Un();o(B),e($k(B.theme));const ie=B.active_directory||a||(B.directories[0]??""),Le=B.extensions[0]??"",ut=B.filters[0]??"";if(ie&&u(ie),d(Le),g(ut),v(B.recursive_search),B.session_trial||ve(B.config_exists?`Loaded config: ${B.config_path}`:"Starter configuration created."),ie)try{await zi(P,{directory:ie,extension:Le,filter_text:ut,recursive:B.recursive_search})}catch(tt){ve(`Scan failed after config load: ${tt.message}`,"error")}finally{Tn(P)}else Tn(P)},[wm,Uu]=E.useState(!1),go=E.useRef(Zh()),vs=B=>{go.current=B,Uu(B.overlayVisible)},ws=E.useRef(()=>{}),Va=async B=>{try{const P=await B.text(),ie=await WC(B.name,P);await pr(ie),ve(`Session config applied: ${B.name}`)}catch(P){ve(P.message||"Failed to apply dropped configuration","error")}};ws.current=B=>{Va(B)};const xo=E.useRef(0),Qa=E.useRef(async()=>{});E.useEffect(()=>{Qa.current=async()=>{const B=await Bk();await pr(B)}}),E.useEffect(()=>{const B=async()=>{let ie=[];try{ie=(await bM(xo.current)).events}catch{return}for(const Le of ie){if(xo.current=Math.max(xo.current,Le.id),Le.config_applied)try{await Qa.current()}catch{}ve(Le.message)}},P=setInterval(()=>void B(),yq);return()=>clearInterval(P)},[]),E.useEffect(()=>{const B=tt=>{var dn;return Array.from(((dn=tt.dataTransfer)==null?void 0:dn.types)??[]).includes("Files")},P=tt=>{vs(Xk(go.current,"enter",B(tt)))},ie=tt=>{B(tt)&&tt.preventDefault()},Le=tt=>{vs(Xk(go.current,"leave",B(tt)))},ut=tt=>{var mt;tt.preventDefault(),vs(Zh());const dn=Array.from(((mt=tt.dataTransfer)==null?void 0:mt.files)??[]),We=UM(dn);if(!We){dn.length>0&&ve("Not a ProFiles configuration file.","error");return}ws.current(We)};return window.addEventListener("dragenter",P),window.addEventListener("dragover",ie),window.addEventListener("dragleave",Le),window.addEventListener("drop",ut),()=>{window.removeEventListener("dragenter",P),window.removeEventListener("dragover",ie),window.removeEventListener("dragleave",Le),window.removeEventListener("drop",ut)}},[]);const Zi=()=>{Ae(!0)},hn=async B=>{const P=Un();Ae(!1),u(B),ve(`Directory selected: ${B}`);let ie;try{ie=await Pk(B),o(ie)}catch(tt){console.error("select-directory failed:",tt)}if(!Pt(P))return;const Le=ie!=null&&ie.extensions.includes(f)?f:(ie==null?void 0:ie.extensions[0])??f,ut=ie!=null&&ie.filters.includes(m)?m:(ie==null?void 0:ie.filters[0])??m;d(Le),g(ut);try{await zi(P,{directory:B,extension:Le,filter_text:ut,recursive:b})}catch(tt){Pt(P)&&ve(`Scan failed: ${tt.message}`,"error")}finally{Tn(P)}},Fn=async(B,P)=>{if(!Pt(P))return;const ie=B.theme==="auto"?"dark":B.theme==="light"?"light":"dark";e(ie);try{localStorage.setItem("profiles-theme",ie)}catch{}o(B);const Le=B.active_directory||(B.directories.length>0?B.directories[0]:""),ut=B.extensions.length>0?B.extensions[0]:"",tt=B.filters.length>0?B.filters[0]:"";if(Le&&u(Le),ut&&d(ut),B.recursive_search!==void 0&&v(B.recursive_search),tt&&g(tt),B.config_exists||Ft(!0),Le)try{await zi(P,{directory:Le,extension:ut,filter_text:tt,recursive:B.recursive_search})}catch(dn){Pt(P)&&ve(`Initial scan failed: ${dn.message}`,"error")}},qr=async()=>{var P;(P=oe.current)==null||P.abort(),oe.current=new AbortController;const B=++Z.current;A(null),ne(!0);try{const ie=await Wh();i(ie);const Le=await Bk();await Fn(Le,B)}catch(ie){A((ie==null?void 0:ie.message)||"Couldn't fetch system info or configuration.")}finally{ne(!1)}};E.useEffect(()=>{qr()},[]),E.useEffect(()=>()=>{var B;K.current&&(clearTimeout(K.current),K.current=null),(B=oe.current)==null||B.abort()},[]);const ks=async B=>{const P=Un();u(B);try{const ie=await Pk(B);if(!Pt(P))return;o(ie);const Le=ie.extensions.includes(f)?f:ie.extensions[0]??"",ut=ie.filters.includes(m)?m:ie.filters[0]??"";d(Le),g(ut),await zi(P,{directory:B,extension:Le,filter_text:ut,recursive:b})}catch(ie){Pt(P)&&ve(`Directory change failed: ${ie.message}`,"error")}finally{Tn(P)}},xl=async()=>{if(!a)return;const B=Un();try{await zi(B,{directory:a,extension:f,filter_text:m,recursive:b})}catch(P){Pt(B)&&ve(`Scan failed: ${(P==null?void 0:P.message)??P}`,"error")}finally{Tn(B)}},yl=E.useRef(xl);E.useEffect(()=>{yl.current=xl});const Fu=B=>{g(B),K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{K.current=null,yl.current()},YC)},Ss=B=>{v(B),K.current&&clearTimeout(K.current),K.current=setTimeout(()=>{K.current=null,yl.current()},YC)},yo=async()=>{if(g(""),!a)return;const B=Un();try{await zi(B,{directory:a,extension:f,filter_text:"",recursive:b})}catch(P){Pt(B)&&ve(`Scan failed: ${(P==null?void 0:P.message)??P}`,"error")}finally{Tn(B)}},bo=async()=>{if(v(!1),!a)return;const B=Un();try{await zi(B,{directory:a,extension:f,filter_text:m,recursive:!1})}catch(P){Pt(B)&&ve(`Scan failed: ${P.message}`,"error")}finally{Tn(B)}},si=async(B,P)=>{if(B.has_hook){ue({file:B,args:P});return}try{await MM({directory:a,filename:B.rel_path,release:l==null?void 0:l.release,args:P}),ve(`Launched ${B.filename}`)}catch(ie){ve(`Launch error: ${ie.message}`,"error")}},Vr=()=>{Mt.length>0&&Mt[I]&&si(Mt[I])},Cs=B=>{var P;nn.current=((P=Mt[B])==null?void 0:P.path)??null,re(B)},bl=async(B,P)=>{si(B,P)},rn=async B=>{try{await JC(B.path),ve("Revealed in file manager.")}catch(P){ve(`Error: ${P.message}`,"error")}},qu=async B=>{try{await K0(B.path),ve("Folder opened in file manager.")}catch(P){ve(`Error: ${P.message}`,"error")}},Vu=async B=>{try{const P=await qk(B.path);ve(P.message||"Terminal opened.")}catch(P){ve(`Error: ${P.message}`,"error")}},Qu=async B=>{try{await ks(B),ve(`Scanned directory: ${B}`)}catch(P){ve(`Error: ${P.message}`,"error")}},Qr=B=>{g(B);const P=Un();zi(P,{directory:a,extension:f,filter_text:B,recursive:b}).catch(ie=>{Pt(P)&&ve(`Scan failed: ${(ie==null?void 0:ie.message)??ie}`,"error")}).finally(()=>Tn(P))},vl=B=>{d(B);const P=Un();zi(P,{directory:a,extension:B,filter_text:m,recursive:b}).catch(ie=>{Pt(P)&&ve(`Scan failed: ${(ie==null?void 0:ie.message)??ie}`,"error")}).finally(()=>Tn(P))},km=async(B,P)=>{const ie=P?B.path.replace(/\\/g,"/"):B.path;try{await navigator.clipboard.writeText(ie),ve("Path copied to clipboard.")}catch(Le){ve(`Copy failed: ${(Le==null?void 0:Le.message)??Le}`,"error")}},Xu=async(B,P)=>{let ie=B.filename;if(P){const Le=ie.lastIndexOf(".");Le!==-1&&(ie=ie.slice(0,Le))}try{await navigator.clipboard.writeText(ie),ve("Filename copied to clipboard.")}catch(Le){ve(`Copy failed: ${(Le==null?void 0:Le.message)??Le}`,"error")}},$u=async(B,P)=>{try{ve(`Computing ${P.toUpperCase()}...`);const ie=await Vk(B.path,P);await navigator.clipboard.writeText(ie.hash),ve(`${P.toUpperCase()} hash copied: ${ie.hash.slice(0,12)}...`)}catch(ie){ve(`Hash computation failed: ${ie.message}`,"error")}},Sm=async B=>{try{const P=new URL("file:///").href+B.path.replace(/\\/g,"/");await navigator.clipboard.writeText(P),ve("File URI copied to clipboard.")}catch(P){ve(`URI copy failed: ${P.message}`,"error")}},ct=async(B,P,ie)=>{ve(`Computing ${P.toUpperCase()}...`);try{const ut=(await Vk(B.path,P)).hash.toLowerCase()===ie.trim().toLowerCase();ve(ut?`✅ ${P.toUpperCase()} matches!`:`❌ ${P.toUpperCase()} mismatch`)}catch(Le){ve(`Verification failed: ${Le.message}`,"error")}},Yu=async(B,P)=>{let ie;try{ie=await navigator.clipboard.readText()}catch{gs(""),Gn({file:B,algorithm:P});return}if(!ie.trim()){ve("Clipboard is empty — copy a hash first, then try again.");return}await ct(B,P,ie)},Os=B=>{qe(B),Hn(!0)},vo=B=>{Kt(B)},Ji=async()=>{const B=qt;if(Kt(null),!!B)try{if(ve("Deleting file..."),!(await fetch("/api/actions/delete",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({file_path:B.path})})).ok)throw new Error("Failed to delete file");ve("File deleted successfully."),xl()}catch(P){ve(`Delete failed: ${P.message}`,"error")}},Wn=B=>{Et(B.path),On(!0)},Xa=async()=>{if(a)try{await K0(a),ve("Directory opened in file manager.")}catch(B){ve(`Error: ${B.message}`,"error")}},Cm=async B=>{if(B)try{await qk(B),ve("Terminal opened in directory.")}catch(P){ve(`Error: ${P.message}`,"error")}},wo=async()=>{try{await ks("~"),ve("Directory set to home folder.")}catch(B){ve(`Error: ${B.message}`,"error")}},Gu=async()=>{if(a)try{const B=await ZC(a);B.parent_path?(await ks(B.parent_path),ve("Moved to parent directory.")):ve("Already at root directory.")}catch(B){ve(`Error: ${B.message}`,"error")}},Om=async()=>{if(w.length===0){ve("No files to export.");return}try{const B=gq(w,(l==null?void 0:l.column_names)||[],l??void 0,m),P=`profiles-export-${new Date().toISOString().slice(0,19).replace(/[:.]/g,"-")}.csv`,ie=await _M(B,P);ve(`Exported ${w.length} loaded row${w.length===1?"":"s"}${m?` matching "${m}"`:""} — ${ie.message}`)}catch(B){ve(`Export failed: ${B.message}`,"error")}},oi=async B=>{var We,mt;xs(!1),ve("Barcode detected!");const ie=XC(B).values,Le=ie.dir!==void 0?ie.dir:a,ut=ie.ext!==void 0?ie.ext:f,tt=ie.filter!==void 0?ie.filter:m,dn=ie.recursive!==void 0?ie.recursive:b;if(ie.dir!==void 0&&u(ie.dir),ie.ext!==void 0&&d(ie.ext),ie.filter!==void 0&&g(ie.filter),ie.recursive!==void 0&&v(ie.recursive),Le){const xt=Un();try{await Fk({directory:Le,extension:ut,filter_text:tt,recursive:dn},(We=oe.current)==null?void 0:We.signal);const yn=await Zg({offset:0,limit:R0,sort_by:F==null?void 0:F.column,sort_dir:F==null?void 0:F.direction,signal:(mt=oe.current)==null?void 0:mt.signal});if(!Pt(xt))return;S(yn.items),N(yn.count),D(!0),nn.current=null,re(0),yn.count===1&&yn.items.length===1&&Fa(yn.items[0])}catch(yn){Pt(xt)&&ve(`Scan error: ${yn.message}`,"error")}finally{Tn(xt)}}},$a=()=>{De(B=>{const P=!B;return P?(at.current="",ve("Barcode mode ON — scan a barcode now.")):(at.current="",ve("Barcode mode OFF.")),P})},Ku=B=>{B.filter!==void 0&&g(B.filter),B.ext!==void 0&&d(B.ext),B.recursive!==void 0&&v(B.recursive),B.dir!==void 0&&u(B.dir),(B.scan===!0||B.filter!==void 0||B.ext!==void 0||B.recursive!==void 0||B.dir!==void 0)&&(De(!1),at.current="",setTimeout(()=>{yl.current()},50))};E.useEffect(()=>{if(!ye)return;const B=P=>{const ie=P.target;if(!(ie instanceof HTMLElement&&(ie.isContentEditable||ie instanceof HTMLInputElement||ie instanceof HTMLTextAreaElement||ie instanceof HTMLSelectElement)))if(P.key==="Enter"){const ut=at.current;if(!ut){at.current="";return}P.preventDefault(),at.current="";const tt=XC(ut);if(tt.isPlainFilter)ve(`Barcode filter: ${tt.values.filter}`),g(tt.values.filter||""),De(!1),setTimeout(()=>void yl.current(),50);else{const dn=tt.values,We=Object.entries(dn).map(([mt,xt])=>`${mt}=${xt}`).join(", ");ve(`Barcode applied: ${We}`),Ku(dn)}}else P.key==="Escape"?(De(!1),at.current="",ve("Barcode mode cancelled.")):P.key.length===1&&!P.ctrlKey&&!P.metaKey&&!P.altKey&&(at.current+=P.key)};return document.addEventListener("keydown",B,!0),()=>document.removeEventListener("keydown",B,!0)},[ye]),E.useEffect(()=>(Wi>0&&(ki.current=setInterval(()=>{yl.current()},Wi*1e3)),()=>{ki.current&&(clearInterval(ki.current),ki.current=null)}),[Wi]);const Ya=B=>{Kn(B),B>0?ve(`Auto-rescan every ${B}s.`):ve("Auto-rescan disabled.")},Xr=!!(de||z||ke||Qt||tn||$e||te||vt||Hu||ys||bt||qt);return E.useEffect(()=>{const B=P=>{var Le,ut,tt,dn;if(P.key==="Escape"){be(null),R(!1),ht(!1),fe(!1),vs(Zh());return}if(Xr)return;if(P.ctrlKey&&!P.shiftKey&&P.key.toLowerCase()==="l"){P.preventDefault(),(Le=document.querySelector("[data-testid='file-list']"))==null||Le.focus();return}const ie=P.target;if(!(ie instanceof HTMLElement&&ie.closest("button, a, [role='menuitem'], [role='option'], [role='columnheader'], [role='separator']"))){if(ie instanceof HTMLInputElement||ie instanceof HTMLSelectElement){P.key==="Enter"&&xl();return}if(P.key==="ContextMenu"||P.shiftKey&&P.key==="F10"){const We=Mt[I];if(!We)return;P.preventDefault();const mt=document.querySelector(`[data-row-index="${I}"]`),xt=mt==null?void 0:mt.getBoundingClientRect();be({x:xt?xt.left+24:24,y:xt?xt.top+xt.height/2:24,file:We});return}if(P.key==="F5"){P.preventDefault(),xl();return}if(P.ctrlKey&&P.key.toLowerCase()==="r"){P.preventDefault(),po();return}if(P.ctrlKey&&P.key.toLowerCase()==="d"){P.preventDefault(),(ut=document.querySelector("#directory-combobox"))==null||ut.focus();return}if(P.ctrlKey&&P.key.toLowerCase()==="e"){P.preventDefault(),(tt=document.querySelector("#extension-combobox"))==null||tt.focus();return}if(P.ctrlKey&&P.key.toLowerCase()==="f"){P.preventDefault(),(dn=document.querySelector("#filter-combobox"))==null||dn.focus();return}if(P.ctrlKey&&P.shiftKey&&P.key.toLowerCase()==="l"){P.preventDefault(),ht(We=>!We);return}if(P.ctrlKey&&P.key===","){P.preventDefault(),Ht(!0);return}if(P.ctrlKey&&P.shiftKey&&P.key.toLowerCase()==="t"){P.preventDefault(),e(We=>We==="dark"?"light":"dark");return}if(P.ctrlKey&&!P.shiftKey&&P.key.toLowerCase()==="b"){P.preventDefault(),De(We=>!We);return}if(P.ctrlKey&&P.shiftKey&&P.key.toLowerCase()==="b"){P.preventDefault(),xs(We=>!We);return}if(P.ctrlKey&&!P.shiftKey&&P.key.toLowerCase()==="t"){P.preventDefault(),fe(!0);return}if(P.ctrlKey&&!P.shiftKey&&P.key.toLowerCase()==="h"){P.preventDefault(),wo();return}if(P.key==="?"||P.ctrlKey&&P.key==="/"){P.preventDefault(),R(We=>!We);return}if(P.key.toLowerCase()==="p"&&!P.ctrlKey&&!P.shiftKey&&!P.altKey){const We=Mt[I];We&&(P.preventDefault(),Os(We));return}P.key==="ArrowDown"?(P.preventDefault(),re(We=>{var xt;const mt=Math.min(We+1,Math.max(0,Mt.length-1));return nn.current=((xt=Mt[mt])==null?void 0:xt.path)??null,mt})):P.key==="ArrowUp"?(P.preventDefault(),re(We=>{var xt;const mt=Math.max(We-1,0);return nn.current=((xt=Mt[mt])==null?void 0:xt.path)??null,mt})):P.key==="Home"?(P.preventDefault(),re(We=>{var mt;return nn.current=((mt=Mt[0])==null?void 0:mt.path)??null,We===0?We:0})):P.key==="End"?(P.preventDefault(),re(We=>{var xt;const mt=Math.max(0,Mt.length-1);return nn.current=((xt=Mt[mt])==null?void 0:xt.path)??null,We===mt?We:mt})):P.key==="PageUp"?(P.preventDefault(),re(We=>{var xt;const mt=Math.max(We-GC,0);return nn.current=((xt=Mt[mt])==null?void 0:xt.path)??null,mt})):P.key==="PageDown"?(P.preventDefault(),re(We=>{var xt;const mt=Math.min(We+GC,Math.max(0,Mt.length-1));return nn.current=((xt=Mt[mt])==null?void 0:xt.path)??null,mt})):P.key==="Enter"&&(P.preventDefault(),Vr())}};return window.addEventListener("keydown",B),()=>window.removeEventListener("keydown",B)},[Xr,Mt,I,a,f,m,b,ye]),E.useEffect(()=>{document.documentElement.setAttribute("data-theme",n);try{localStorage.setItem("profiles-theme",n)}catch{}},[n]),y.jsxs("div",{className:"flex h-dvh flex-col bg-elevated/30 p-1 font-sans text-ink transition-colors duration-200 sm:p-1.5",children:[y.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-frame-line bg-app shadow-[0_2px_6px_rgb(0_0_0/0.35)] transition-colors duration-200 sm:rounded-xl",children:[y.jsx($9,{title:(l==null?void 0:l.title)||"",release:(l==null?void 0:l.release)||"",directories:(l==null?void 0:l.directories)||[],activeDirectory:a,onDirectoryChange:ks,onBrowseDirectory:Zi,onGoToParentDirectory:Gu,onGoToHomeDirectory:wo,onOpenActiveDirectory:Xa,onOpenTerminal:Cm}),y.jsx(n8,{extensions:(l==null?void 0:l.extensions)||[],activeExtension:f,onExtensionChange:d,filterOptions:(l==null?void 0:l.filters)||[],filterText:m,onFilterTextChange:Fu,recursive:b,onRecursiveChange:Ss,onScan:xl,scanning:pe,barcodeMode:ye,onBarcodeToggle:$a,onCameraBarcodeClick:()=>xs(!0),autoRescanActive:Wi>0,onTimerClick:()=>fe(!0)}),M?y.jsx(Y9,{message:M,onRetry:()=>void qr(),retrying:L}):y.jsx(X9,{files:Mt,totalCount:C,rawLoadedCount:w.length,onLoadMore:Iu,loadingMore:U,scanning:pe,hasScanned:j,activeDirectory:a,recursive:b,onDisableRecursive:bo,onOpenDirectory:Xa,onLoadConfig:()=>Ft(!0),filterText:m,onClearFilter:yo,columnHeaders:(l==null?void 0:l.column_headers)||[],columnNames:(l==null?void 0:l.column_names)||[],selectedIndex:I,onSelectIndex:Cs,prefilterNote:bs,onLaunch:si,onContextMenu:(B,P,ie)=>{B.preventDefault(),nn.current=P.path,re(ie),be({x:B.clientX,y:B.clientY,file:P})},rowColors:(l==null?void 0:l.row_colors)||[],sort:F,onSortChange:B=>{W(B),nn.current=null,re(0);const P=Un();qa(P,B).catch(ie=>{Pt(P)&&ve(`Sort failed: ${ie.message}`,"error")}).finally(()=>Tn(P))}}),y.jsx(_D,{onExecute:Vr,scanning:pe,scanningDirectory:a,hasSelection:Mt.length>0,fileCount:Mt.length,totalCount:C,toastMessage:Q,onToastDismiss:bm}),y.jsx(S8,{systemInfo:t,fileCount:C,theme:n,onToggleTheme:()=>e(B=>B==="dark"?"light":"dark"),onOpenLog:()=>ht(!0),onOpenConfig:()=>Ht(!0),onShowShortcuts:()=>R(!0),onReloadConfig:po,onExport:Om,exportDisabled:w.length===0||pe,language:Te,onLanguageChange:He,lanEnabled:(t==null?void 0:t.lan_enabled)??null,onToggleLan:vm})]}),y.jsx(U9,{open:xn,onClose:()=>Ht(!1),onApplied:pr,onLoadConfig:()=>Ft(!0),reloadKey:Ot}),y.jsx(a8,{isOpen:Qt,activeConfigPath:l==null?void 0:l.config_path,configExists:l==null?void 0:l.config_exists,onClose:()=>Ft(!1),onLoaded:B=>{pr(B),lt(P=>P+1)}}),y.jsx(V9,{visible:wm,onFileSelected:B=>ws.current(B)}),y.jsx(q9,{isOpen:ke,initialPath:a,onClose:()=>Ae(!1),onSelect:hn}),y.jsx(F9,{position:de,onClose:()=>be(null),onLaunch:si,onLaunchWithArgs:bl,onReveal:rn,onOpenFolder:qu,onOpenTerminal:Vu,onScanDirectory:Qu,onFilterFolder:Qr,onFilterExtension:vl,onCopyPath:km,onCopyFilename:Xu,onCopyUri:Sm,onComputeHash:$u,onVerifyHash:Yu,onProperties:Os,onClearFile:vo,onGenerateBarcode:Wn,showToast:ve}),y.jsx(o8,{isOpen:z,onClose:()=>R(!1)}),y.jsx(d8,{isOpen:tn,file:Oe,onLaunch:si,onClose:()=>{Hn(!1),qe(null)}}),y.jsx(O8,{isOpen:te,currentInterval:Wi,onClose:()=>fe(!1),onSetInterval:Ya}),y.jsx(s8,{isOpen:$e,onClose:()=>ht(!1),onOpenExternally:()=>{vM().then(B=>ve(B.message)).catch(B=>ve(B instanceof Error?B.message:"Failed to open the log file","error"))}}),y.jsx(dq,{isOpen:!!bt,onClose:()=>ue(null),directory:a,filename:(bt==null?void 0:bt.file.rel_path)||"",release:l==null?void 0:l.release,args:bt==null?void 0:bt.args,onFinished:(B,P)=>{B==="completed"?ve(P||"Workflow launched successfully."):(B==="aborted"||B==="failed")&&ve(`Workflow stopped: ${P}`,"error")}}),y.jsx(bA,{isOpen:vt,onClose:()=>{On(!1),Et(void 0)},initialFilePath:Nn}),Wt&&y.jsx("div",{className:"animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/60 p-4 backdrop-blur-sm",onClick:()=>Gn(null),children:y.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"verify-hash-title",onKeyDown:B=>{B.key==="Escape"&&(B.preventDefault(),B.stopPropagation(),Gn(null))},onClick:B=>B.stopPropagation(),className:"animate-modal-in w-[440px] max-w-full rounded-2xl border border-frame-line glass-panel p-5",children:[y.jsxs("h2",{id:"verify-hash-title",className:"mb-1 text-sm font-semibold text-ink",children:["Verify ",Wt.algorithm.toUpperCase()]}),y.jsx("p",{className:"mb-3 text-xs text-ink-muted",children:"Clipboard access is unavailable here — paste the expected hash below."}),y.jsx("input",{autoFocus:!0,type:"text",value:In,onChange:B=>gs(B.target.value),placeholder:"Expected hash","aria-label":"Expected hash",className:"mb-4 w-full rounded-lg border border-line bg-elevated px-3 py-2 font-mono text-xs text-ink placeholder:text-ink-faint focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400"}),y.jsxs("div",{className:"flex justify-end gap-2",children:[y.jsx("button",{type:"button",onClick:()=>Gn(null),className:"min-h-9 rounded-lg border border-line bg-elevated px-3.5 text-sm text-ink-secondary transition-colors hover:bg-surface-strong hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Cancel"}),y.jsx("button",{type:"button",disabled:!In.trim(),onClick:()=>{const{file:B,algorithm:P}=Wt;Gn(null),ct(B,P,In)},className:"min-h-9 rounded-lg border border-transparent bg-indigo-600 px-4 text-sm font-semibold text-white transition-colors hover:bg-indigo-500 disabled:opacity-50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400",children:"Verify"})]})]})}),y.jsx(w8,{isOpen:Hu,onClose:()=>xs(!1),onDetected:oi}),y.jsx(io,{isOpen:!!qt,title:"Delete file",message:`Delete this file? + +${(qt==null?void 0:qt.path)??""} + +This action cannot be undone.`,confirmLabel:"Delete",danger:!0,onConfirm:Ji,onCancel:()=>Kt(null)}),y.jsx(io,{isOpen:_e!==null,title:_e?"Enable LAN access?":"Restrict to this machine?",message:_e?y.jsxs("span",{className:"block",children:["ProFiles will be reachable by anyone on this network:",y.jsx(VC,{url:`http://${t==null?void 0:t.hostname}:${window.location.port}`,label:"Copy hostname URL",className:"mt-1.5",onCopied:()=>ve("URL copied to clipboard."),onCopyError:()=>ve("Failed to copy URL.","error")}),y.jsx(VC,{url:`http://${t==null?void 0:t.ip}:${window.location.port}`,label:"Copy IP URL",className:"mt-1.5",onCopied:()=>ve("URL copied to clipboard."),onCopyError:()=>ve("Failed to copy URL.","error")})]}):"ProFiles will be reachable only on this machine.",confirmLabel:_e?"Enable LAN":"Restrict",onConfirm:async()=>{const B=_e;Be(null);try{await kM(B),ve(B?"Updating LAN binding…":"Restricting ProFiles to this machine…","info");const P=await SM(B);P&&i(P),(P==null?void 0:P.lan_enabled)===B?ve(B?"ProFiles is now reachable on the local network.":"ProFiles is restricted to this machine.","info"):ve("Failed to update LAN binding — the previous address is still active.","error")}catch(P){const ie=P instanceof Error?P.message:"Failed to update LAN binding";ve(`Failed to update LAN binding: ${ie}`,"error");const Le=await Wh();i(Le)}},onCancel:()=>Be(null)}),y.jsx(k8,{isOpen:!!ys,file:ys,onConfirm:()=>{if(ys){const B=ys;Fa(null),si(B)}},onDismiss:()=>Fa(null)})]})}class vq extends E.Component{constructor(){super(...arguments);ph(this,"state",{error:null})}static getDerivedStateFromError(t){return{error:t}}componentDidCatch(t,i){console.error("Application render error:",t,i.componentStack)}render(){return this.state.error?y.jsx("main",{className:"flex min-h-screen items-center justify-center bg-app p-6 text-ink",children:y.jsxs("section",{className:"w-full max-w-lg rounded-lg border border-line bg-surface p-6",children:[y.jsx("h1",{className:"text-base font-semibold",children:"ProFiles encountered an error"}),y.jsx("p",{className:"mt-2 text-sm text-ink-secondary",children:"The interface could not continue. Reload the application to try again."}),y.jsxs("details",{className:"mt-4 text-xs text-ink-muted",children:[y.jsx("summary",{className:"cursor-pointer",children:"Error details"}),y.jsx("pre",{className:"mt-2 max-h-40 overflow-auto whitespace-pre-wrap",children:this.state.error.message})]}),y.jsx("button",{type:"button",onClick:()=>window.location.reload(),className:"btn btn-primary mt-5 px-4 py-2 text-sm font-semibold",children:"Reload application"})]})}):this.props.children}}yM.createRoot(document.getElementById("root")).render(y.jsx(fM.StrictMode,{children:y.jsx(vq,{children:y.jsx(bq,{})})})); diff --git a/src/profiles/web/dist/index.html b/src/profiles/web/dist/index.html index 3688c25..ca8424b 100644 --- a/src/profiles/web/dist/index.html +++ b/src/profiles/web/dist/index.html @@ -5,8 +5,8 @@ ProFiles - - + +
diff --git a/src/profiles/web/dist/sw.js b/src/profiles/web/dist/sw.js index 02bbd73..0b29de9 100644 --- a/src/profiles/web/dist/sw.js +++ b/src/profiles/web/dist/sw.js @@ -1 +1 @@ -if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()}).then(()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(n,r)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(s[t])return;let o={};const d=e=>i(e,t),l={module:{uri:t},exports:o,require:d};s[t]=Promise.all(n.map(e=>l[e]||d(e))).then(e=>(r(...e),o))}}define(["./workbox-9c191d2f"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"index.html",revision:"f418486ad0d311a652f7776b453dcd9f"},{url:"assets/index-CY2LGDSY.js",revision:null},{url:"assets/index-BPqTLQSc.css",revision:null},{url:"manifest.webmanifest",revision:"5a42ebe8b55b07b5831cbbddda834829"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}); +if(!self.define){let e,s={};const i=(i,n)=>(i=new URL(i+".js",n).href,s[i]||new Promise(s=>{if("document"in self){const e=document.createElement("script");e.src=i,e.onload=s,document.head.appendChild(e)}else e=i,importScripts(i),s()}).then(()=>{let e=s[i];if(!e)throw new Error(`Module ${i} didn’t register its module`);return e}));self.define=(n,r)=>{const t=e||("document"in self?document.currentScript.src:"")||location.href;if(s[t])return;let o={};const l=e=>i(e,t),d={module:{uri:t},exports:o,require:l};s[t]=Promise.all(n.map(e=>d[e]||l(e))).then(e=>(r(...e),o))}}define(["./workbox-9c191d2f"],function(e){"use strict";self.skipWaiting(),e.clientsClaim(),e.precacheAndRoute([{url:"registerSW.js",revision:"1872c500de691dce40960bb85481de07"},{url:"index.html",revision:"2967646eb00205535969360d4cb8db5e"},{url:"assets/index-SVUzfHxO.js",revision:null},{url:"assets/index-C1MMTlfW.css",revision:null},{url:"manifest.webmanifest",revision:"5a42ebe8b55b07b5831cbbddda834829"}],{}),e.cleanupOutdatedCaches(),e.registerRoute(new e.NavigationRoute(e.createHandlerBoundToURL("index.html")))}); diff --git a/src/profiles/web/src/App.tsx b/src/profiles/web/src/App.tsx index a62a975..7b24902 100644 --- a/src/profiles/web/src/App.tsx +++ b/src/profiles/web/src/App.tsx @@ -136,6 +136,14 @@ export default function App() { const [showBarcodeModal, setShowBarcodeModal] = useState(false); const [barcodeFilePath, setBarcodeFilePath] = useState(undefined); + // Verify-hash manual entry — clipboard reads are refused on some webviews, + // so the expected hash is typed in instead (issue #141). + const [verifyHashPrompt, setVerifyHashPrompt] = useState<{ + file: ScannedFileItem; + algorithm: "md5" | "sha256"; + } | null>(null); + const [verifyHashInput, setVerifyHashInput] = useState(""); + // Camera Barcode Scanner & Single match prompt state const [showCameraScanner, setShowCameraScanner] = useState(false); const [singleMatchFile, setSingleMatchFile] = useState(null); @@ -900,16 +908,15 @@ export default function App() { } }; - const handleVerifyHash = async (file: ScannedFileItem, algorithm: "md5" | "sha256") => { + const runHashVerification = async ( + file: ScannedFileItem, + algorithm: "md5" | "sha256", + expectedHash: string, + ) => { + showToast(`Computing ${algorithm.toUpperCase()}...`); try { - const clipboardText = await navigator.clipboard.readText(); - if (!clipboardText.trim()) { - showToast("Clipboard is empty — copy a hash first, then try again."); - return; - } - showToast(`Computing ${algorithm.toUpperCase()}...`); const res = await computeHash(file.path, algorithm); - const match = res.hash.toLowerCase() === clipboardText.trim().toLowerCase(); + const match = res.hash.toLowerCase() === expectedHash.trim().toLowerCase(); if (match) { showToast(`✅ ${algorithm.toUpperCase()} matches!`); } else { @@ -920,6 +927,25 @@ export default function App() { } }; + const handleVerifyHash = async (file: ScannedFileItem, algorithm: "md5" | "sha256") => { + let clipboardText: string; + try { + clipboardText = await navigator.clipboard.readText(); + } catch { + // Clipboard reads are commonly refused inside the desktop webviews + // (WKWebView / WebKitGTK) — fall back to manual entry instead of dying + // with an "empty clipboard"-style error (issue #141). + setVerifyHashInput(""); + setVerifyHashPrompt({ file, algorithm }); + return; + } + if (!clipboardText.trim()) { + showToast("Clipboard is empty — copy a hash first, then try again."); + return; + } + await runHashVerification(file, algorithm, clipboardText); + }; + const handleProperties = (file: ScannedFileItem) => { setPropertiesFile(file); setShowPropertiesModal(true); @@ -1669,7 +1695,14 @@ export default function App() { isOpen={showLogViewer} onClose={() => setShowLogViewer(false)} onOpenExternally={() => { - openLogFile().then((r) => showToast(r.message)); + openLogFile() + .then((r) => showToast(r.message)) + .catch((err: unknown) => + showToast( + err instanceof Error ? err.message : "Failed to open the log file", + "error", + ), + ); }} /> @@ -1700,6 +1733,67 @@ export default function App() { initialFilePath={barcodeFilePath} /> + {/* Verify-hash manual entry (issue #141) — the clipboard-based path is + unavailable inside webviews that refuse clipboard reads. */} + {verifyHashPrompt && ( +
setVerifyHashPrompt(null)} + > +
{ + if (event.key === "Escape") { + event.preventDefault(); + event.stopPropagation(); + setVerifyHashPrompt(null); + } + }} + onClick={(event) => event.stopPropagation()} + className="animate-modal-in w-[440px] max-w-full rounded-2xl border border-frame-line glass-panel p-5" + > +

+ Verify {verifyHashPrompt.algorithm.toUpperCase()} +

+

+ Clipboard access is unavailable here — paste the expected hash below. +

+ setVerifyHashInput(event.target.value)} + placeholder="Expected hash" + aria-label="Expected hash" + className="mb-4 w-full rounded-lg border border-line bg-elevated px-3 py-2 font-mono text-xs text-ink placeholder:text-ink-faint focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-indigo-400" + /> +
+ + +
+
+
+ )} + {/* Camera Barcode Scanner Modal */} { +/** Shape returned by the `/api/actions/*` endpoints (ActionResult serialised). */ +export interface ActionResponse { + status: string; + message: string; + path?: string | null; +} + +export async function revealFile(filePath: string): Promise { const res = await fetch("/api/actions/reveal", { method: "POST", headers: { "Content-Type": "application/json" }, diff --git a/src/profiles/web/src/components/BarcodeModal.test.tsx b/src/profiles/web/src/components/BarcodeModal.test.tsx new file mode 100644 index 0000000..345d8ed --- /dev/null +++ b/src/profiles/web/src/components/BarcodeModal.test.tsx @@ -0,0 +1,111 @@ +// @vitest-environment jsdom +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; +import { cleanup, render, screen, waitFor } from "@testing-library/react"; +import userEvent from "@testing-library/user-event"; +import { BarcodeModal } from "./BarcodeModal"; +import { generateBarcode } from "../api/client"; + +vi.mock("../api/client", () => ({ + generateBarcode: vi.fn(), + saveImageToDisk: vi.fn(), +})); + +const generateSpy = vi.mocked(generateBarcode); + +/** Wait out the modal's 250 ms generate debounce. */ +const settleDebounce = () => new Promise((resolve) => setTimeout(resolve, 320)); + +function renderModal(props: Partial[0]> = {}) { + return render( + {}} {...props} />, + ); +} + +/** The key/value inputs exist per pair row — seed one empty pair first. */ +async function addEmptyPair(user: ReturnType) { + await user.click(screen.getByRole("button", { name: /add field/i })); + return screen.getByPlaceholderText("key"); +} + +beforeEach(() => { + vi.clearAllMocks(); + generateSpy.mockResolvedValue({ image: "data:image/png;base64,NEW", content: "" }); +}); + +afterEach(() => { + cleanup(); + document.body.innerHTML = ""; +}); + +describe("BarcodeModal", () => { + it("test_edits_debounce_into_single_generate", async () => { + const user = userEvent.setup(); + renderModal(); + + // Typing several characters into a key field schedules one debounced + // generate per edit burst, not one per keystroke (issue #140). + const keyInput = await addEmptyPair(user); + await user.type(keyInput, "abc"); + await waitFor(() => expect(generateSpy).toHaveBeenCalled()); + expect(generateSpy).toHaveBeenCalledTimes(1); + expect(generateSpy).toHaveBeenCalledWith({ content: "abc=" }); + + // The field keeps the newest content — the preview mirrors it. + expect(keyInput).toHaveValue("abc"); + expect(screen.getByText("abc=")).toBeTruthy(); + }); + + it("test_stale_generate_response_is_dropped", async () => { + const user = userEvent.setup(); + + let resolveFirst: (value: { image: string; content: string }) => void = () => {}; + generateSpy + .mockImplementationOnce(() => new Promise((resolve) => { resolveFirst = resolve; })) + .mockResolvedValueOnce({ image: "data:image/png;base64,SECOND", content: "" }); + + renderModal(); + const keyInput = await addEmptyPair(user); + await user.type(keyInput, "a"); + await waitFor(() => expect(generateSpy).toHaveBeenCalledTimes(1)); + + // A second edit fires a newer generate that resolves before the first. + await user.type(screen.getByPlaceholderText("value"), "b"); + await waitFor(() => expect(generateSpy).toHaveBeenCalledTimes(2)); + const img = await screen.findByAltText("QR Code"); + await waitFor(() => expect(img.getAttribute("src")).toBe("data:image/png;base64,SECOND")); + + // The stale first response lands last — it must not win (issue #140). + resolveFirst({ image: "data:image/png;base64,STALE", content: "" }); + await settleDebounce(); + expect(img.getAttribute("src")).toBe("data:image/png;base64,SECOND"); + }); + + it("test_generate_failure_is_surfaced", async () => { + const user = userEvent.setup(); + generateSpy.mockRejectedValue(new Error("barcode engine exploded")); + renderModal(); + + const keyInput = await addEmptyPair(user); + await user.type(keyInput, "a"); + // Failure must appear in the modal's alert area, not only the console + // (issue #140 — No Silent Failures). + const alert = await screen.findByRole("alert"); + expect(alert.textContent).toMatch(/barcode engine exploded/); + }); + + it("test_empty_content_clears_image_and_error", async () => { + const user = userEvent.setup(); + renderModal(); + + const keyInput = await addEmptyPair(user); + await user.type(keyInput, "a"); + await screen.findByAltText("QR Code"); + + // Removing the field empties the payload: the image and any previous + // generate error go away, with no further request. + await user.clear(keyInput); + await waitFor(() => expect(screen.queryByAltText("QR Code")).toBeNull()); + expect(screen.queryByRole("alert")).toBeNull(); + expect(generateSpy).toHaveBeenCalledTimes(1); + }); +}); diff --git a/src/profiles/web/src/components/BarcodeModal.tsx b/src/profiles/web/src/components/BarcodeModal.tsx index 835f338..5880281 100644 --- a/src/profiles/web/src/components/BarcodeModal.tsx +++ b/src/profiles/web/src/components/BarcodeModal.tsx @@ -21,12 +21,27 @@ export function BarcodeModal({ isOpen, onClose, initialFilePath, md5 }: BarcodeM const [pairs, setPairs] = useState([]); const [loading, setLoading] = useState(false); const [error, setError] = useState(null); + /** Failure of the *live* regenerate — shown inline without tearing down the editor. */ + const [generateError, setGenerateError] = useState(null); const [copied, setCopied] = useState(false); const [copiedImage, setCopiedImage] = useState(false); const [saveStatus, setSaveStatus] = useState(null); const modalRef = useRef(null); + /** Monotonic tag per generate call — a slow response for older content must + * never overwrite the image of a newer edit (issue #140). */ + const barcodeSeqRef = useRef(0); + const barcodeTimerRef = useRef(null); const handleDialogKeyDown = useModalA11y({ isOpen, onClose, dialogRef: modalRef }); + // Drop a pending debounced generate when the modal closes. + useEffect(() => { + if (isOpen) return; + if (barcodeTimerRef.current !== null) { + window.clearTimeout(barcodeTimerRef.current); + barcodeTimerRef.current = null; + } + }, [isOpen]); + // Initialize from file path or content useEffect(() => { if (!isOpen) return; @@ -57,32 +72,49 @@ export function BarcodeModal({ isOpen, onClose, initialFilePath, md5 }: BarcodeM setPairs(newPairs); }; - const updateBarcode = async (currentPairs: KeyValuePair[]) => { + const generateBarcodeFor = async (content: string) => { + const seq = ++barcodeSeqRef.current; + try { + const res = await generateBarcode({ content }); + if (barcodeSeqRef.current !== seq) return; // a newer edit superseded this response + setBarcodeImage(res.image); + setGenerateError(null); + } catch (err) { + if (barcodeSeqRef.current !== seq) return; + setGenerateError(err instanceof Error ? err.message : "Failed to generate the barcode"); + } + }; + + const updateBarcode = (currentPairs: KeyValuePair[]) => { const content = currentPairs .filter(p => p.key.trim()) .map(p => `${p.key.trim()}=${p.value.trim()}`) .join(";"); - + setRawContent(content); - + + if (barcodeTimerRef.current !== null) { + window.clearTimeout(barcodeTimerRef.current); + barcodeTimerRef.current = null; + } + if (!content) { + barcodeSeqRef.current += 1; // invalidate any in-flight generate setBarcodeImage(null); + setGenerateError(null); return; } - try { - const res = await generateBarcode({ content }); - setBarcodeImage(res.image); - } catch (err: any) { - console.error("Failed to re-generate barcode:", err); - } + // Debounce the round trip: firing per keystroke flooded the server and + // let out-of-order responses leave a stale image on screen (issue #140). + barcodeTimerRef.current = window.setTimeout(() => void generateBarcodeFor(content), 250); }; const handlePairChange = (index: number, field: keyof KeyValuePair, value: string) => { const newPairs = [...pairs]; newPairs[index][field] = value; setPairs(newPairs); - void updateBarcode(newPairs); + updateBarcode(newPairs); }; const addPair = () => { @@ -93,14 +125,14 @@ export function BarcodeModal({ isOpen, onClose, initialFilePath, md5 }: BarcodeM const removePair = (index: number) => { const newPairs = pairs.filter((_, i) => i !== index); setPairs(newPairs); - void updateBarcode(newPairs); + updateBarcode(newPairs); }; const addMd5 = () => { if (!md5 || pairs.some(p => p.key.toLowerCase() === "md5")) return; const newPairs = [...pairs, { key: "md5", value: md5 }]; setPairs(newPairs); - void updateBarcode(newPairs); + updateBarcode(newPairs); }; const handleSave = async () => { @@ -220,6 +252,11 @@ export function BarcodeModal({ isOpen, onClose, initialFilePath, md5 }: BarcodeM {saveStatus}

)} + {generateError && ( +

+ {generateError} +

+ )}
diff --git a/src/profiles/web/src/components/ConfigEditorModal.tsx b/src/profiles/web/src/components/ConfigEditorModal.tsx index 7f9d889..aa262b1 100644 --- a/src/profiles/web/src/components/ConfigEditorModal.tsx +++ b/src/profiles/web/src/components/ConfigEditorModal.tsx @@ -277,6 +277,13 @@ export function ConfigEditorModal({ const dialogRef = useRef(null); const editorHostRef = useRef(null); const editorViewRef = useRef(null); + /** + * Coordinates of a mousedown that started on the backdrop itself. A text + * selection drag that begins inside the editor and ends on the overlay + * must not count as a backdrop click and open the discard dialog + * mid-selection (issue #141). + */ + const backdropPressRef = useRef<{ x: number; y: number } | null>(null); /** Text the editor was seeded with — the baseline for the dirty check. */ const loadedTextRef = useRef(""); /** @@ -950,7 +957,18 @@ export function ConfigEditorModal({ aria-modal="true" aria-labelledby="config-editor-title" onKeyDown={handleDialogKeyDown} - onClick={requestClose} + onMouseDown={(event) => { + backdropPressRef.current = + event.target === event.currentTarget ? { x: event.clientX, y: event.clientY } : null; + }} + onClick={(event) => { + const press = backdropPressRef.current; + backdropPressRef.current = null; + // Close only when the press *and* the release both land on the + // backdrop — a selection drag ending here started elsewhere. + if (!press || event.target !== event.currentTarget) return; + requestClose(); + }} className="animate-overlay-in fixed inset-0 z-[var(--z-modal)] flex items-center justify-center bg-black/65 p-3 backdrop-blur-sm sm:p-6" >
)} {metadata.attributes.is_hidden && ( - + Hidden )} diff --git a/src/profiles/web/src/components/LogViewerModal.test.tsx b/src/profiles/web/src/components/LogViewerModal.test.tsx new file mode 100644 index 0000000..a2a5bd6 --- /dev/null +++ b/src/profiles/web/src/components/LogViewerModal.test.tsx @@ -0,0 +1,106 @@ +// @vitest-environment jsdom +import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; +import { cleanup, render, screen, waitFor } from "@testing-library/react"; +import userEvent from "@testing-library/user-event"; +import { LogViewerModal } from "./LogViewerModal"; +import { fetchLogEntries } from "../api/client"; +import type { LogEntry, LogResponse } from "../api/types"; + +vi.mock("../api/client", () => ({ + fetchLogEntries: vi.fn(), +})); + +const fetchSpy = vi.mocked(fetchLogEntries); + +function makeEntry(message: string): LogEntry { + return { + timestamp: "2026-11-07 10:00:00", + level: "INFO", + source: "test", + message, + event: "", + raw: message, + }; +} + +function makeResponse(message: string): LogResponse { + return { path: "profiles.log", size_bytes: 128, total_returned: 1, entries: [makeEntry(message)] }; +} + +/** Wait out the modal's 250 ms filter debounce. */ +const settleDebounce = () => new Promise((resolve) => setTimeout(resolve, 320)); + +function renderModal() { + return render( {}} />); +} + +beforeEach(() => { + vi.clearAllMocks(); + fetchSpy.mockResolvedValue(makeResponse("fresh")); +}); + +afterEach(() => { + cleanup(); + document.body.innerHTML = ""; +}); + +describe("LogViewerModal", () => { + it("test_single_fetch_on_open", async () => { + renderModal(); + await screen.findByText("fresh"); + + // Opening must load once: the debounced filter effect re-fires 250 ms + // after open, but must skip its first run (issue #139). + await settleDebounce(); + expect(fetchSpy).toHaveBeenCalledTimes(1); + }); + + it("test_filter_change_refetches_after_debounce", async () => { + const user = userEvent.setup(); + fetchSpy + .mockResolvedValueOnce(makeResponse("fresh")) + .mockResolvedValueOnce(makeResponse("filtered")); + renderModal(); + await screen.findByText("fresh"); + + await user.type(screen.getByLabelText("Filter log lines"), "abc"); + await waitFor( + () => expect(screen.getByText("filtered")).toBeTruthy(), + { timeout: 3000 }, + ); + expect(fetchSpy).toHaveBeenCalledTimes(2); + }); + + it("test_stale_response_never_overwrites_newer_results", async () => { + const user = userEvent.setup(); + + // The initial open load stalls; a filter change resolves first. + let resolveInitial: (value: LogResponse) => void = () => {}; + fetchSpy + .mockImplementationOnce(() => new Promise((resolve) => { resolveInitial = resolve; })) + .mockResolvedValueOnce(makeResponse("filtered results")); + + renderModal(); + await waitFor(() => expect(fetchSpy).toHaveBeenCalledTimes(1)); + + await user.type(screen.getByLabelText("Filter log lines"), "x"); + await waitFor(() => expect(fetchSpy).toHaveBeenCalledTimes(2)); + await screen.findByText("filtered results"); + + // The stale response for the *initial* filter lands last — it must be + // dropped instead of overwriting the newer results (issue #139). + resolveInitial(makeResponse("stale initial results")); + await settleDebounce(); + expect(screen.queryByText("stale initial results")).toBeNull(); + expect(screen.getByText("filtered results")).toBeTruthy(); + }); + + it("test_shortcut_hint_matches_binding", async () => { + renderModal(); + await screen.findByText("fresh"); + // Ctrl+Shift+L toggles the viewer in App — the footer must say so + // (issue #139), not claim it opens the file externally. + expect(screen.getByText("toggles this viewer")).toBeTruthy(); + expect(screen.queryByText("opens externally")).toBeNull(); + }); +}); diff --git a/src/profiles/web/src/components/LogViewerModal.tsx b/src/profiles/web/src/components/LogViewerModal.tsx index 25afe9a..e94f0fc 100644 --- a/src/profiles/web/src/components/LogViewerModal.tsx +++ b/src/profiles/web/src/components/LogViewerModal.tsx @@ -66,11 +66,18 @@ export function LogViewerModal({ isOpen, onClose, onOpenExternally }: LogViewerM /** Kept in a ref so the poll effect can re-read it without re-subscribing. */ const liveRef = useRef(live); const filterRef = useRef<{ level: LogLevel | null; search: string }>({ level, search }); + /** Monotonic tag per load call — a slow response for a previous filter must + * never overwrite the results of a newer one (issue #139). */ + const loadSeqRef = useRef(0); + /** Armed on close so the debounce effect skips its first run after the + * next open — the initial-fetch effect already loaded those filters. */ + const skipDebounceRef = useRef(true); liveRef.current = live; filterRef.current = { level, search }; const load = useCallback(async () => { + const seq = ++loadSeqRef.current; const { level: activeLevel, search: activeSearch } = filterRef.current; setLoading(true); try { @@ -79,14 +86,18 @@ export function LogViewerModal({ isOpen, onClose, onOpenExternally }: LogViewerM level: activeLevel, search: activeSearch, }); + if (loadSeqRef.current !== seq) return; setEntries(data.entries); setLogPath(data.path); setSizeBytes(data.size_bytes); setError(null); } catch (err) { + if (loadSeqRef.current !== seq) return; setError((err as Error)?.message || "Failed to read the log file"); } finally { - setLoading(false); + // Only the newest call owns the loading flag — a superseded response + // finishing late must not clear the spinner of the in-flight one. + if (loadSeqRef.current === seq) setLoading(false); } }, []); @@ -105,9 +116,19 @@ export function LogViewerModal({ isOpen, onClose, onOpenExternally }: LogViewerM return () => window.clearInterval(timer); }, [isOpen, live, load]); - // Debounce text filter input instead of firing a request per keystroke. + // Debounce text/level filter input instead of firing a request per + // keystroke. The first run after opening is skipped — the initial-fetch + // effect above already loaded the current filters, so firing here would + // double-fetch on every open (issue #139). useEffect(() => { - if (!isOpen) return; + if (!isOpen) { + skipDebounceRef.current = true; + return; + } + if (skipDebounceRef.current) { + skipDebounceRef.current = false; + return; + } const timer = window.setTimeout(() => void load(), 250); return () => window.clearTimeout(timer); }, [isOpen, level, search, load]); @@ -429,7 +450,7 @@ export function LogViewerModal({ isOpen, onClose, onOpenExternally }: LogViewerM Ctrl + Shift + L - opens externally + toggles this viewer
diff --git a/src/profiles/web/tsconfig.tsbuildinfo b/src/profiles/web/tsconfig.tsbuildinfo index 6038f13..0738bee 100644 --- a/src/profiles/web/tsconfig.tsbuildinfo +++ b/src/profiles/web/tsconfig.tsbuildinfo @@ -1 +1 @@ -{"root":["./src/app.configeditor.test.tsx","./src/app.tsx","./src/main.tsx","./src/setup-tests.ts","./src/vite-env.d.ts","./src/vitest.d.ts","./src/api/client.test.ts","./src/api/client.ts","./src/api/types.ts","./src/components/actionbar.tsx","./src/components/barcodemodal.tsx","./src/components/camerabarcodemodal.tsx","./src/components/configeditormodal.test.tsx","./src/components/configeditormodal.tsx","./src/components/confirmdialog.tsx","./src/components/contextmenu.tsx","./src/components/copyableurl.test.tsx","./src/components/copyableurl.tsx","./src/components/directorypickermodal.tsx","./src/components/dropconfigoverlay.tsx","./src/components/editablecombobox.tsx","./src/components/errorboundary.tsx","./src/components/filelisttable.tsx","./src/components/filepropertiesmodal.tsx","./src/components/filtersyntaxhelper.tsx","./src/components/headerbar.tsx","./src/components/initerrorpanel.tsx","./src/components/loadconfigmodal.tsx","./src/components/logviewermodal.tsx","./src/components/markdownmessage.test.tsx","./src/components/markdownmessage.tsx","./src/components/saveasdialog.test.tsx","./src/components/saveasdialog.tsx","./src/components/scanstatusstrip.tsx","./src/components/searchbar.tsx","./src/components/shortcutsmodal.tsx","./src/components/singlematchpromptmodal.tsx","./src/components/statusbar.test.tsx","./src/components/statusbar.tsx","./src/components/timermodal.tsx","./src/components/tooltip.tsx","./src/components/workflowrunnermodal.test.tsx","./src/components/workflowrunnermodal.tsx","./src/utils/barcodedecoder.test.ts","./src/utils/barcodedecoder.ts","./src/utils/barcodescanner.ts","./src/utils/configdrop.test.ts","./src/utils/configdrop.ts","./src/utils/exportcsv.ts","./src/utils/fileproperties.test.ts","./src/utils/fileproperties.ts","./src/utils/searchsyntax.test.ts","./src/utils/searchsyntax.ts","./src/utils/theme.test.ts","./src/utils/theme.ts","./src/utils/usemodala11y.test.tsx","./src/utils/usemodala11y.ts"],"version":"5.7.3"} \ No newline at end of file +{"root":["./src/app.configeditor.test.tsx","./src/app.tsx","./src/main.tsx","./src/setup-tests.ts","./src/vite-env.d.ts","./src/vitest.d.ts","./src/api/client.test.ts","./src/api/client.ts","./src/api/types.ts","./src/components/actionbar.tsx","./src/components/barcodemodal.test.tsx","./src/components/barcodemodal.tsx","./src/components/camerabarcodemodal.tsx","./src/components/configeditormodal.test.tsx","./src/components/configeditormodal.tsx","./src/components/confirmdialog.tsx","./src/components/contextmenu.tsx","./src/components/copyableurl.test.tsx","./src/components/copyableurl.tsx","./src/components/directorypickermodal.tsx","./src/components/dropconfigoverlay.tsx","./src/components/editablecombobox.tsx","./src/components/errorboundary.tsx","./src/components/filelisttable.tsx","./src/components/filepropertiesmodal.tsx","./src/components/filtersyntaxhelper.tsx","./src/components/headerbar.tsx","./src/components/initerrorpanel.tsx","./src/components/loadconfigmodal.tsx","./src/components/logviewermodal.test.tsx","./src/components/logviewermodal.tsx","./src/components/markdownmessage.test.tsx","./src/components/markdownmessage.tsx","./src/components/saveasdialog.test.tsx","./src/components/saveasdialog.tsx","./src/components/scanstatusstrip.tsx","./src/components/searchbar.tsx","./src/components/shortcutsmodal.tsx","./src/components/singlematchpromptmodal.tsx","./src/components/statusbar.test.tsx","./src/components/statusbar.tsx","./src/components/timermodal.tsx","./src/components/tooltip.tsx","./src/components/workflowrunnermodal.test.tsx","./src/components/workflowrunnermodal.tsx","./src/utils/barcodedecoder.test.ts","./src/utils/barcodedecoder.ts","./src/utils/barcodescanner.ts","./src/utils/configdrop.test.ts","./src/utils/configdrop.ts","./src/utils/exportcsv.ts","./src/utils/fileproperties.test.ts","./src/utils/fileproperties.ts","./src/utils/searchsyntax.test.ts","./src/utils/searchsyntax.ts","./src/utils/theme.test.ts","./src/utils/theme.ts","./src/utils/usemodala11y.test.tsx","./src/utils/usemodala11y.ts"],"version":"5.7.3"} \ No newline at end of file