@rse/ase 2.0.4 → 2.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dst/ase-config-schema.js +1 -1
  2. package/dst/ase-hook.js +12 -3
  3. package/dst/ase-setup-settings.js +111 -1
  4. package/dst/ase-setup.js +19 -7
  5. package/dst/ase-spec.js +184 -49
  6. package/dst/ase-task-board-tui-model.js +8 -1
  7. package/dst/ase-task-board-tui.js +26 -2
  8. package/dst/ase-task-board-web-client.js +10 -10
  9. package/dst/man/ase-artifact.md +1 -1
  10. package/dst/man/ase-config.md +5 -3
  11. package/dst/man/ase-mcp.md +1 -1
  12. package/dst/man/ase-setup-install.md +10 -1
  13. package/dst/man/ase-setup-status.md +6 -0
  14. package/dst/man/ase-setup-uninstall.md +3 -1
  15. package/dst/man/ase-setup-update.md +3 -0
  16. package/dst/man/ase-setup.md +4 -4
  17. package/dst/man/ase-spec-export.md +14 -3
  18. package/dst/man/ase-spec-init.md +10 -1
  19. package/dst/man/ase-spec-lint.md +2 -1
  20. package/dst/man/ase-spec-preview.md +10 -1
  21. package/dst/man/ase-spec-query.md +96 -0
  22. package/dst/man/ase-spec.md +32 -11
  23. package/dst/man/ase.md +3 -3
  24. package/package.json +21 -18
  25. package/plugin/.claude-plugin/icon.png +0 -0
  26. package/plugin/.claude-plugin/plugin.json +1 -1
  27. package/plugin/.codex-plugin/plugin.json +1 -1
  28. package/plugin/.github/plugin/plugin.json +1 -1
  29. package/plugin/meta/ase-format-spec.md +29 -5
  30. package/plugin/meta/ase-format-specbook.md +427 -47
  31. package/plugin/meta/ase-format-specbook.yaml +180 -78
  32. package/plugin/mods/ase-mods-common.ts +474 -0
  33. package/plugin/mods/ase-mods-evaluate.ts +227 -0
  34. package/plugin/mods/ase-mods-grill.ts +283 -0
  35. package/plugin/mods/ase-mods-help-browse.ts +410 -0
  36. package/plugin/mods/ase-mods-help-compose.ts +561 -0
  37. package/plugin/mods/ase-mods-help-find.ts +434 -0
  38. package/plugin/mods/ase-mods-help-hint.ts +134 -0
  39. package/plugin/mods/ase-mods-help-show.ts +142 -0
  40. package/plugin/mods/ase-mods.ts +220 -381
  41. package/plugin/skills/ase-code-lint/SKILL.md +15 -15
  42. package/plugin/skills/ase-code-lint/help.md +21 -8
  43. package/plugin/skills/ase-help-intent/SKILL.md +2 -1
  44. package/plugin/skills/ase-help-intent/data.md +42 -16
  45. package/plugin/skills/ase-spec-activate/SKILL.md +4 -1
  46. package/plugin/skills/ase-spec-lint/SKILL.md +15 -15
  47. package/plugin/skills/ase-spec-lint/help.md +21 -8
  48. package/plugin/mods/claude-code.d.ts +0 -13440
@@ -1,14 +1,14 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function l(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var u={},d=[],f=()=>{},p=()=>!1,m=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),h=e=>e.startsWith(`onUpdate:`),g=Object.assign,_=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},v=Object.prototype.hasOwnProperty,y=(e,t)=>v.call(e,t),b=Array.isArray,x=e=>re(e)===`[object Map]`,S=e=>re(e)===`[object Set]`,C=e=>re(e)===`[object Date]`,w=e=>typeof e==`function`,T=e=>typeof e==`string`,ee=e=>typeof e==`symbol`,E=e=>typeof e==`object`&&!!e,te=e=>(E(e)||w(e))&&w(e.then)&&w(e.catch),ne=Object.prototype.toString,re=e=>ne.call(e),ie=e=>re(e).slice(8,-1),ae=e=>re(e)===`[object Object]`,oe=e=>T(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,D=l(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),se=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},ce=/-\w/g,le=se(e=>e.replace(ce,e=>e.slice(1).toUpperCase())),ue=/\B([A-Z])/g,de=se(e=>e.replace(ue,`-$1`).toLowerCase()),fe=se(e=>e.charAt(0).toUpperCase()+e.slice(1)),pe=se(e=>e?`on${fe(e)}`:``),me=(e,t)=>!Object.is(e,t),he=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},ge=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},_e=e=>{let t=parseFloat(e);return isNaN(t)?e:t},ve,ye=()=>ve||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{};function be(e){if(b(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=T(r)?we(r):be(r);if(i)for(let e in i)t[e]=i[e]}return t}if(T(e)||E(e))return e}var xe=/;(?![^(]*\))/g,Se=/:([^]+)/,Ce=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function we(e){let t={};return e.replace(Ce,e=>e.startsWith(`/*`)?``:e).split(xe).forEach(e=>{if(e){let n=e.split(Se);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function O(e){let t=``;if(T(e))t=e;else if(b(e))for(let n=0;n<e.length;n++){let r=O(e[n]);r&&(t+=r+` `)}else if(E(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}var Te=l(`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly`);function Ee(e){return!!e||e===``}function De(e,t,n){if(e.length!==t.length)return!1;let r=!0;for(let i=0;r&&i<e.length;i++)r=je(e[i],t[i],n);return r}function Oe(e,t,n){if(e.size!==t.size)return!1;let r=Array.from(t),i=new Uint8Array(r.length);for(let t of e){let e=-1;for(let a=0;a<r.length;a++)if(!i[a]&&je(t,r[a],n)){e=a;break}if(e<0)return!1;i[e]=1}return!0}function ke(e,t,n){let r=x(e),i=x(t);if(r||i||(r=S(e),i=S(t),r||i))return r&&i?Oe(e,t,n):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e){let i=e.hasOwnProperty(r),a=t.hasOwnProperty(r);if(i&&!a||!i&&a||!je(e[r],t[r],n))return!1}return String(e)===String(t)}function Ae(e,t,n,r){n||=[new Map,new Map];let[i,a]=n;if(i.has(e)||a.has(t))return i.get(e)===t&&a.get(t)===e;i.set(e,t),a.set(t,e);let o=r(e,t,n);return i.delete(e),a.delete(t),o}function je(e,t,n){if(e===t)return!0;let r=C(e),i=C(t);return r||i?r&&i?e.getTime()===t.getTime():!1:(r=ee(e),i=ee(t),r||i?e===t:(r=b(e),i=b(t),r||i?r&&i?Ae(e,t,n,De):!1:(r=E(e),i=E(t),r||i?!r||!i?!1:Ae(e,t,n,ke):String(e)===String(t))))}var Me=e=>!!(e&&e.__v_isRef===!0),k=e=>T(e)?e:e==null?``:b(e)||E(e)&&(e.toString===ne||!w(e.toString))?Me(e)?k(e.value):JSON.stringify(e,Ne,2):String(e),Ne=(e,t)=>Me(t)?Ne(e,t.value):x(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Pe(t,r)+` =>`]=n,e),{})}:S(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Pe(e))}:ee(t)?Pe(t):E(t)&&!b(t)&&!ae(t)?String(t):t,Pe=(e,t=``)=>ee(e)?`Symbol(${e.description??t})`:e,Fe,Ie=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&Fe&&(Fe.active?(this.parent=Fe,this.index=(Fe.scopes||(Fe.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].pause()}for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}let n=this.effects.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}}run(e){if(this._active){let t=Fe;try{return Fe=this,e()}finally{Fe=t}}}on(){++this._on===1&&(this.prevScope=Fe,Fe=this)}off(){if(this._on>0&&--this._on===0){if(Fe===this)Fe=this.prevScope;else{let e=Fe;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){let e=this.scopes.slice();for(t=0,n=e.length;t<n;t++)e[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function Le(){return Fe}var Re,ze=new WeakSet,Be=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Fe&&(Fe.active?Fe.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ze.has(this)&&(ze.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||We(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,rt(this),qe(this);let e=Re,t=$e;Re=this,$e=!0;try{return this.fn()}finally{Je(this),Re=e,$e=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Ze(e);this.deps=this.depsTail=void 0,rt(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ze.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ye(this)&&this.run()}get dirty(){return Ye(this)}},Ve=0,He,Ue;function We(e,t=!1){e.flags|=8,t?(e.next=Ue,Ue=e):(e.next=He,He=e)}function Ge(){Ve++}function Ke(){if(--Ve>0)return;if(Ue){let e=Ue;for(Ue=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;He;){let t=He;for(He=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||=t}t=n}}if(e)throw e}function qe(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Je(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),Ze(r),Qe(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function Ye(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Xe(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Xe(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===it)||(e.globalVersion=it,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Ye(e))))return;e.flags|=2;let t=e.dep,n=Re,r=$e;Re=e,$e=!0;try{qe(e);let n=e.fn(e._value);(t.version===0||me(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{Re=n,$e=r,Je(e),e.flags&=-3}}function Ze(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)Ze(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Qe(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}var $e=!0,et=[];function tt(){et.push($e),$e=!1}function nt(){let e=et.pop();$e=e===void 0||e}function rt(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=Re;Re=void 0;try{t()}finally{Re=e}}}var it=0,at=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},ot=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Re||!$e||Re===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==Re)t=this.activeLink=new at(Re,this),Re.deps?(t.prevDep=Re.depsTail,Re.depsTail.nextDep=t,Re.depsTail=t):Re.deps=Re.depsTail=t,st(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=Re.depsTail,t.nextDep=void 0,Re.depsTail.nextDep=t,Re.depsTail=t,Re.deps===t&&(Re.deps=e)}return t}trigger(e){this.version++,it++,this.notify(e)}notify(e){Ge();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{Ke()}}};function st(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)st(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}var ct=new WeakMap,lt=Symbol(``),ut=Symbol(``),dt=Symbol(``);function ft(e,t,n){if($e&&Re){let t=ct.get(e);t||ct.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new ot),r.map=t,r.key=n),r.track()}}function pt(e,t,n,r,i,a){let o=ct.get(e);if(!o){it++;return}let s=e=>{e&&e.trigger()};if(Ge(),t===`clear`)o.forEach(s);else{let i=b(e),a=i&&oe(n);if(i&&n===`length`){let e=Number(r);o.forEach((t,n)=>{(n===`length`||n===dt||!ee(n)&&n>=e)&&s(t)})}else switch((n!==void 0||o.has(void 0))&&s(o.get(n)),a&&s(o.get(dt)),t){case`add`:i?a&&s(o.get(`length`)):(s(o.get(lt)),x(e)&&s(o.get(ut)));break;case`delete`:i||(s(o.get(lt)),x(e)&&s(o.get(ut)));break;case`set`:x(e)&&s(o.get(lt))}}Ke()}function mt(e){let t=nn(e);return t===e||(ft(t,`iterate`,dt),en(e))?t:$t(e)?Qt(e)?t.map(e=>on(an(e))):t.map(on):t.map(an)}function ht(e){return ft(e=nn(e),`iterate`,dt),e}function gt(e,t){return $t(e)?on(Qt(e)?an(t):t):an(t)}var _t={__proto__:null,[Symbol.iterator](){return vt(this,Symbol.iterator,e=>gt(this,e))},concat(...e){return mt(this).concat(...e.map(e=>b(e)?mt(e):e))},entries(){return vt(this,`entries`,e=>(e[1]=gt(this,e[1]),e))},every(e,t){return xt(this,`every`,e,t,void 0,arguments)},filter(e,t){return xt(this,`filter`,e,t,e=>e.map(e=>gt(this,e)),arguments)},find(e,t){return xt(this,`find`,e,t,e=>gt(this,e),arguments)},findIndex(e,t){return xt(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return xt(this,`findLast`,e,t,e=>gt(this,e),arguments)},findLastIndex(e,t){return xt(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return xt(this,`forEach`,e,t,void 0,arguments)},includes(...e){return Ct(this,`includes`,e)},indexOf(...e){return Ct(this,`indexOf`,e)},join(e){return mt(this).join(e)},lastIndexOf(...e){return Ct(this,`lastIndexOf`,e)},map(e,t){return xt(this,`map`,e,t,void 0,arguments)},pop(){return wt(this,`pop`)},push(...e){return wt(this,`push`,e)},reduce(e,...t){return St(this,`reduce`,e,t)},reduceRight(e,...t){return St(this,`reduceRight`,e,t)},shift(){return wt(this,`shift`)},some(e,t){return xt(this,`some`,e,t,void 0,arguments)},splice(...e){return wt(this,`splice`,e)},toReversed(){return mt(this).toReversed()},toSorted(e){return mt(this).toSorted(e)},toSpliced(...e){return mt(this).toSpliced(...e)},unshift(...e){return wt(this,`unshift`,e)},values(){return vt(this,`values`,e=>gt(this,e))}};function vt(e,t,n){let r=ht(e),i=r[t],a=i.call(r);if(r!==e&&!en(e)){if(a[Symbol.toStringTag]===`Array Iterator`){let e=Object.create(Object.getPrototypeOf(a));return e.next=()=>yt(a.next(),n),i!==bt[t]&&Object.defineProperties(e,{return:{get(){let e=a.return;return typeof e==`function`?e.bind(a):e}},throw:{get(){let e=a.throw;return typeof e==`function`?e.bind(a):e}}}),e}a._next=a.next,a.next=()=>yt(a._next(),n)}return a}function yt(e,t){return e.done||(e.value=t(e.value)),e}var bt=Array.prototype;function xt(e,t,n,r,i,a){let o=ht(e),s=o!==e&&!en(e),c=o[t];if(c!==bt[t]){let t=c.apply(e,a);return s?an(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,gt(e,t),r,e)}:n.length>2&&(l=function(t,r){return n.call(this,t,r,e)}));let u=c.call(o,l,r);return s&&i?i(u):u}function St(e,t,n,r){let i=ht(e),a=i!==e&&!en(e),o=n,s=!1;i!==e&&(a?(s=r.length===0,o=function(t,r,i){return s&&(s=!1,t=gt(e,t)),n.call(this,t,gt(e,r),i,e)}):n.length>3&&(o=function(t,r,i){return n.call(this,t,r,i,e)}));let c=i[t](o,...r);return s?gt(e,c):c}function Ct(e,t,n){let r=nn(e);ft(r,`iterate`,dt);let i=r[t](...n);return(i===-1||i===!1)&&tn(n[0])?(n[0]=nn(n[0]),r[t](...n)):i}function wt(e,t,n=[]){tt(),Ge();let r=nn(e)[t].apply(e,n);return Ke(),nt(),r}var Tt=l(`__proto__,__v_isRef,__isVue`),Et=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(ee));function Dt(e){ee(e)||(e=String(e));let t=nn(this);return ft(t,`has`,e),t.hasOwnProperty(e)}var Ot=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,i=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return i;if(t===`__v_raw`)return n===(r?i?Kt:Gt:i?Wt:Ut).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let a=b(e);if(!r){let e;if(a&&(e=_t[t]))return e;if(t===`hasOwnProperty`)return Dt}let o=Reflect.get(e,t,sn(e)?e:n);if((ee(t)?Et.has(t):Tt(t))||(r||ft(e,`get`,t),i))return o;if(sn(o)){let e=a&&oe(t)?o:o.value;return r&&E(e)?Xt(e):e}return E(o)?r?Xt(o):Jt(o):o}},kt=class extends Ot{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],a=b(e)&&oe(t);if(!this._isShallow){let e=$t(i);if(!en(n)&&!$t(n)&&(i=nn(i),n=nn(n)),!a&&sn(i)&&!sn(n))return e||(i.value=n),!0}let o=a?Number(t)<e.length:y(e,t),s=Reflect.set(e,t,n,sn(e)?e:r);return e===nn(r)&&s&&(o?me(n,i)&&pt(e,`set`,t,n,i):pt(e,`add`,t,n)),s}deleteProperty(e,t){let n=y(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&pt(e,`delete`,t,void 0,r),i}has(e,t){let n=Reflect.has(e,t);return(!ee(t)||!Et.has(t))&&ft(e,`has`,t),n}ownKeys(e){return ft(e,`iterate`,b(e)?`length`:lt),Reflect.ownKeys(e)}},At=class extends Ot{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},jt=new kt,Mt=new At,Nt=new kt(!0),Pt=e=>e,Ft=e=>Reflect.getPrototypeOf(e);function It(e,t,n){return function(...r){let i=this.__v_raw,a=nn(i),o=x(a),s=e===`entries`||e===Symbol.iterator&&o,c=e===`keys`&&o,l=i[e](...r),u=n?Pt:t?on:an;return!t&&ft(a,`iterate`,c?ut:lt),g(Object.create(l),{next(){let{value:e,done:t}=l.next();return t?{value:e,done:t}:{value:s?[u(e[0]),u(e[1])]:u(e),done:t}}})}}function Lt(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function Rt(e,t){let n={get(n){let r=this.__v_raw,i=nn(r),a=nn(n);e||(me(n,a)&&ft(i,`get`,n),ft(i,`get`,a));let{has:o}=Ft(i),s=t?Pt:e?on:an;if(o.call(i,n))return s(r.get(n));if(o.call(i,a))return s(r.get(a));r!==i&&r.get(n)},get size(){let t=this.__v_raw;return!e&&ft(nn(t),`iterate`,lt),t.size},has(t){let n=this.__v_raw,r=nn(n),i=nn(t);return e||(me(t,i)&&ft(r,`has`,t),ft(r,`has`,i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach(n,r){let i=this,a=i.__v_raw,o=nn(a),s=t?Pt:e?on:an;return!e&&ft(o,`iterate`,lt),a.forEach((e,t)=>n.call(r,s(e),s(t),i))}};return g(n,e?{add:Lt(`add`),set:Lt(`set`),delete:Lt(`delete`),clear:Lt(`clear`)}:{add(e){let n=nn(this),r=Ft(n),i=nn(e),a=!t&&!en(e)&&!$t(e)?i:e;return r.has.call(n,a)||me(e,a)&&r.has.call(n,e)||me(i,a)&&r.has.call(n,i)||(n.add(a),pt(n,`add`,a,a)),this},set(e,n){!t&&!en(n)&&!$t(n)&&(n=nn(n));let r=nn(this),{has:i,get:a}=Ft(r),o=i.call(r,e);o||=(e=nn(e),i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?me(n,s)&&pt(r,`set`,e,n,s):pt(r,`add`,e,n),this},delete(e){let t=nn(this),{has:n,get:r}=Ft(t),i=n.call(t,e);i||=(e=nn(e),n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&pt(t,`delete`,e,void 0,a),o},clear(){let e=nn(this),t=e.size!==0,n=e.clear();return t&&pt(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=It(r,e,t)}),n}function zt(e,t){let n=Rt(e,t);return(r,i,a)=>i===`__v_isReactive`?!e:i===`__v_isReadonly`?e:i===`__v_isShallow`?t:i===`__v_raw`?r:Reflect.get(y(n,i)&&i in r?n:r,i,a)}var Bt={get:zt(!1,!1)},Vt={get:zt(!1,!0)},Ht={get:zt(!0,!1)},Ut=new WeakMap,Wt=new WeakMap,Gt=new WeakMap,Kt=new WeakMap;function qt(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function Jt(e){return $t(e)?e:Zt(e,!1,jt,Bt,Ut)}function Yt(e){return Zt(e,!1,Nt,Vt,Wt)}function Xt(e){return Zt(e,!0,Mt,Ht,Gt)}function Zt(e,t,n,r,i){if(!E(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;let a=i.get(e);if(a)return a;let o=qt(ie(e));if(o===0)return e;let s=new Proxy(e,o===2?r:n);return i.set(e,s),s}function Qt(e){return $t(e)?Qt(e.__v_raw):!!(e&&e.__v_isReactive)}function $t(e){return!!(e&&e.__v_isReadonly)}function en(e){return!!(e&&e.__v_isShallow)}function tn(e){return e?!!e.__v_raw:!1}function nn(e){let t=e&&e.__v_raw;return t?nn(t):e}function rn(e){return!y(e,`__v_skip`)&&Object.isExtensible(e)&&ge(e,`__v_skip`,!0),e}var an=e=>E(e)?Jt(e):e,on=e=>E(e)?Xt(e):e;function sn(e){return e?e.__v_isRef===!0:!1}function A(e){return ln(e,!1)}function cn(e){return ln(e,!0)}function ln(e,t){return sn(e)?e:new un(e,t)}var un=class{constructor(e,t){this.dep=new ot,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:nn(e),this._value=t?e:an(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||en(e)||$t(e);e=n?e:nn(e),me(e,t)&&(this._rawValue=e,this._value=n?e:an(e),this.dep.trigger())}};function j(e){return sn(e)?e.value:e}var dn={get:(e,t,n)=>t===`__v_raw`?e:j(Reflect.get(e,t,n)),set:(e,t,n,r)=>{let i=e[t];return sn(i)&&!sn(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}};function fn(e){return Qt(e)?e:new Proxy(e,dn)}var pn=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new ot(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=it-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Re!==this)return We(this,!0),!0}get value(){let e=this.dep.track();return Xe(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function mn(e,t,n=!1){let r,i;return w(e)?r=e:(r=e.get,i=e.set),new pn(r,i,n)}var hn={},gn=new WeakMap,_n=void 0;function vn(e,t=!1,n=_n){if(n){let t=gn.get(n);t||gn.set(n,t=[]),t.push(e)}}function yn(e,t,n=u){let{immediate:r,deep:i,once:a,scheduler:o,augmentJob:s,call:c}=n,l=e=>i?e:en(e)||i===!1||i===0?bn(e,1):bn(e),d,p,m,h,g=!1,v=!1;if(sn(e)?(p=()=>e.value,g=en(e)):Qt(e)?(p=()=>l(e),g=!0):b(e)?(v=!0,g=e.some(e=>Qt(e)||en(e)),p=()=>e.map(e=>{if(sn(e))return e.value;if(Qt(e))return l(e);if(w(e))return c?c(e,2):e()})):p=w(e)?t?c?()=>c(e,2):e:()=>{if(m){tt();try{m()}finally{nt()}}let t=_n;_n=d;try{return c?c(e,3,[h]):e(h)}finally{_n=t}}:f,t&&i){let e=p,t=i===!0?1/0:i;p=()=>bn(e(),t)}let y=Le(),x=()=>{d.stop(),y&&y.active&&_(y.effects,d)};if(a&&t){let e=t;t=(...t)=>{try{return e(...t)}finally{x()}}}let S=v?Array(e.length).fill(hn):hn,C=e=>{if(d.flags&1&&(d.dirty||e)){if(t){let n=d.run();if(e||i||g||(v?n.some((e,t)=>me(e,S[t])):me(n,S))){let e=_n;tt();try{m&&m(),_n=d;let e=[n,S===hn?void 0:v&&S[0]===hn?[]:S,h];S=n,c?c(t,3,e):t(...e)}finally{_n=e,nt()}}}else d.run()}};return s&&s(C),d=new Be(p),d.scheduler=o?()=>o(C,!1):C,h=e=>vn(e,!1,d),m=d.onStop=()=>{let e=gn.get(d);if(e){if(c)c(e,4);else for(let t of e)t();gn.delete(d)}},t?r?C(!0):S=d.run():o?o(C.bind(null,!0),!0):d.run(),x.pause=d.pause.bind(d),x.resume=d.resume.bind(d),x.stop=x,x}function bn(e,t=1/0,n){if(t<=0||!E(e)||e.__v_skip||(n||=new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,sn(e))bn(e.value,t,n);else if(b(e))for(let r=0;r<e.length;r++)bn(e[r],t,n);else if(S(e)||x(e))e.forEach(e=>{bn(e,t,n)});else if(ae(e)){for(let r in e)bn(e[r],t,n);for(let r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&bn(e[r],t,n)}return e}function xn(e,t,n,r){try{return r?e(...r):e()}catch(e){Cn(e,t,n)}}function Sn(e,t,n,r){if(w(e)){let i=xn(e,t,n,r);return i&&te(i)&&i.catch(e=>{Cn(e,t,n)}),i}if(b(e)){let i=[];for(let a=0;a<e.length;a++)i.push(Sn(e[a],t,n,r));return i}}function Cn(e,t,n,r=!0){let i=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||u;if(t){let r=t.parent,i=t.proxy,o=`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){let t=r.ec;if(t){for(let n=0;n<t.length;n++)if(t[n](e,i,o)===!1)return}r=r.parent}if(a){tt(),xn(a,null,10,[e,i,o]),nt();return}}wn(e,n,i,r,o)}function wn(e,t,n,r=!0,i=!1){if(i)throw e;console.error(e)}var Tn=[],En=-1,Dn=[],On=null,kn=0,An=Promise.resolve(),jn=null;function Mn(e){let t=jn||An;return e?t.then(this?e.bind(this):e):t}function Nn(e){let t=En+1,n=Tn.length;for(;t<n;){let r=t+n>>>1,i=Tn[r],a=Vn(i);a<e||a===e&&i.flags&2?t=r+1:n=r}return t}function Pn(e){if(!(e.flags&1)){let t=Vn(e),n=Tn[Tn.length-1];!n||!(e.flags&2)&&t>=Vn(n)?Tn.push(e):Tn.splice(Nn(t),0,e),e.flags|=1,Fn()}}function Fn(){jn||=An.then(Hn)}function In(e){if(!b(e))On&&e.id===-1?On.splice(kn+1,0,e):e.flags&1||(Dn.push(e),e.flags|=1);else for(let t=0;t<e.length;t++)Dn.push(e[t]);Fn()}function Ln(e,t,n,r=En+1){for(;r<Tn.length;r++){let n=Tn[r];if(n&&n.flags&2){if(e&&n.id!==e.uid||t!==void 0&&!(n.id>=t))continue;Tn.splice(r,1),r=e?r-1:En,n.flags&4&&(n.flags&=-2),n(),n.flags&4||(n.flags&=-2)}}}function Rn(e,t,n=0){if(Dn.length){let e=Dn,r=0;if(t){e=[];for(let i=0;i<Dn.length;i++){let a=Dn[i];(a.i===void 0?t.has(a):!a.i||a.i.uid<n)?Dn[r++]=a:e.push(a)}}let i=[...new Set(e)].sort((e,t)=>Vn(e)-Vn(t));if(Dn.length=r,On){for(let e=0;e<i.length;e++)On.push(i[e]);return}for(On=i,kn=0;kn<On.length;kn++){let e=On[kn];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}On=null,kn=0}}var zn=!1;function Bn(e,t){if(zn){e();return}let n=t===void 0?void 0:new Set(Dn);e(),zn=!0;try{Ln(void 0,t),Rn(void 0,n,t)}finally{zn=!1}}var Vn=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Hn(e){try{for(En=0;En<Tn.length;En++){let e=Tn[En];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),xn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;En<Tn.length;En++){let e=Tn[En];e&&(e.flags&=-2)}En=-1,Tn.length=0,Rn(e),jn=null,(Tn.length||Dn.length)&&Hn(e)}}var Un=null,Wn=null;function Gn(e){let t=Un;return Un=e,Wn=e&&e.type.__scopeId||null,t}function Kn(e,t=Un,n){if(!t||e._n)return e;let r=(...n)=>{r._d&&ra(-1);let i=Gn(t),a=$i.length,o;try{o=e(...n)}finally{for(let e=$i.length;e>a;e--)ta();Gn(i),r._d&&ra(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function qn(e,t){if(Un===null)return e;let n=Ra(Un),r=e.dirs||=[];for(let e=0;e<t.length;e++){let[i,a,o,s=u]=t[e];i&&(w(i)&&(i={mounted:i,updated:i}),i.deep&&bn(a),r.push({dir:i,instance:n,value:a,oldValue:void 0,arg:o,modifiers:s}))}return e}function Jn(e,t,n,r){let i=e.dirs,a=t&&t.dirs;for(let o=0;o<i.length;o++){let s=i[o];a&&(s.oldValue=a[o].value);let c=s.dir[r];c&&(tt(),Sn(c,n,8,[e.el,s,e,t]),nt())}}function Yn(e,t){if(wa){let n=wa.provides,r=wa.parent&&wa.parent.provides;r===n&&(n=wa.provides=Object.create(r)),n[e]=t}}function Xn(e,t,n=!1){let r=Ta();if(r||ai){let i=ai?ai._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&e in i)return i[e];if(arguments.length>1)return n&&w(t)?t.call(r&&r.proxy):t}}var Zn=Symbol.for(`v-scx`),Qn=()=>Xn(Zn);function $n(e,t,n){return er(e,t,n)}function er(e,t,n=u){let{immediate:r,deep:i,flush:a,once:o}=n,s=g({},n),c=t&&r||!t&&a!==`post`,l;if(ja){if(a===`sync`){let e=Qn();l=e.__watcherHandles||=[]}else if(!c){let e=()=>{};return e.stop=f,e.resume=f,e.pause=f,e}}let d=wa;s.call=(e,t,n)=>Sn(e,d,t,n);let p=!1;a===`post`?s.scheduler=e=>{e.i=d,Li(e,d&&d.suspense)}:a!==`sync`&&(p=!0,s.scheduler=(e,t)=>{t?e():Pn(e)}),s.augmentJob=e=>{t&&(e.flags|=4),p&&(e.flags|=2,d&&(e.id=d.uid,e.i=d))};let m=yn(e,t,s);return ja&&(l?l.push(m):c&&m()),m}function tr(e,t,n){let r=this.proxy,i=T(e)?e.includes(`.`)?nr(r,e):()=>r[e]:e.bind(r,r),a;w(t)?a=t:(a=t.handler,n=t);let o=Oa(this),s=er(i,a.bind(r),n);return o(),s}function nr(e,t){let n=t.split(`.`);return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}var rr=Symbol(`_vte`),ir=e=>e.__isTeleport,ar=Symbol(`_leaveCb`);function or(e){let t=e[0];if(e.length>1){for(let n of e)if(n.type!==Zi){t=n;break}}return t}function sr(e){if(!_r(e))return ir(e.type)&&e.children?or(e.children):e;if(e.component)return e.component.subTree;let{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&w(n.default))return n.default()}}function cr(e,t){if(e.shapeFlag&6&&e.component){e.transition=t;let n=e.component.subTree;cr(ir(n.type)&&sr(n)||n,t)}else if(e.shapeFlag&128)e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback);else if(e.transition=t,e.type===M&&b(e.children)){let n=fi(e.children,!1);n&&cr(n,t)}}function lr(e){if(e.component)return lr(e.component.subTree);if(e.type===M){let t=b(e.children)&&fi(e.children,!1);return t?lr(t):void 0}if(e.type!==Zi)return e}function ur(e,t){return w(e)?g({name:e.name},t,{setup:e}):e}function dr(e){e.ids=[e.ids[0]+e.ids[2]+++`-`,0,0]}function fr(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}var pr=new WeakMap;function mr(e,t,n,r,i=!1){if(b(e)){e.forEach((e,a)=>mr(e,t&&(b(t)?t[a]:t),n,r,i));return}if(gr(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&mr(e,t,n,r.component.subTree);return}let a=r.shapeFlag&4?Ra(r.component):r.el,o=i?null:a,{i:s,r:c}=e,l=t&&t.r,d=s.refs===u?s.refs={}:s.refs,f=s.setupState,m=nn(f),h=f===u?p:e=>!fr(d,e)&&y(m,e),g=(e,t)=>!(t&&fr(d,t));if(l!=null&&l!==c){if(hr(t),T(l))d[l]=null,h(l)&&(f[l]=null);else if(sn(l)){let e=t;g(l,e.k)&&(l.value=null),e.k&&(d[e.k]=null)}}if(w(c))xn(c,s,12,[o,d]);else{let t=T(c),r=sn(c);if(t||r){let s=()=>{if(e.f){let n=t?h(c)?f[c]:d[c]:g(c)||!e.k?c.value:d[e.k];if(i)b(n)&&_(n,a);else if(b(n))n.includes(a)||n.push(a);else if(t)d[c]=[a],h(c)&&(f[c]=d[c]);else{let t=[a];g(c,e.k)&&(c.value=t),e.k&&(d[e.k]=t)}}else t?(d[c]=o,h(c)&&(f[c]=o)):r&&(g(c,e.k)&&(c.value=o),e.k&&(d[e.k]=o))};if(o){let t=()=>{s(),pr.delete(e)};t.id=-1,pr.set(e,t),Li(t,n)}else hr(e),s()}}}function hr(e){let t=pr.get(e);t&&(t.flags|=8,pr.delete(e))}ye().requestIdleCallback,ye().cancelIdleCallback;var gr=e=>!!e.type.__asyncLoader,_r=e=>e.type.__isKeepAlive;function vr(e,t){br(e,`a`,t)}function yr(e,t){br(e,`da`,t)}function br(e,t,n=wa){let r=e.__wdc||=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(Sr(t,r,n),n){let e=n.parent;for(;e&&e.parent;)_r(e.parent.vnode)&&xr(r,t,n,e),e=e.parent}}function xr(e,t,n,r){let i=Sr(t,e,r,!0);kr(()=>{_(r[t],i)},n)}function Sr(e,t,n=wa,r=!1){if(n){let i=n[e]||(n[e]=[]),a=t.__weh||=(...r)=>{tt();let i=Oa(n),a=Sn(t,n,e,r);return i(),nt(),a};return r?i.unshift(a):i.push(a),a}}var Cr=e=>(t,n=wa)=>{(!ja||e===`sp`)&&Sr(e,(...e)=>t(...e),n)},wr=Cr(`bm`),Tr=Cr(`m`),Er=Cr(`bu`),Dr=Cr(`u`),Or=Cr(`bum`),kr=Cr(`um`),Ar=Cr(`sp`),jr=Cr(`rtg`),Mr=Cr(`rtc`);function Nr(e,t=wa){Sr(`ec`,e,t)}var Pr=Symbol.for(`v-ndc`);function Fr(e,t,n,r){let i,a=n&&n[r],o=b(e);if(o||T(e)){let n=o&&Qt(e),r=!1,s=!1;n&&(r=!en(e),s=$t(e),e=ht(e)),i=Array(e.length);for(let n=0,o=e.length;n<o;n++)i[n]=t(r?s?on(an(e[n])):an(e[n]):e[n],n,void 0,a&&a[n])}else if(typeof e==`number`){if(!Number.isInteger(e)||e<0)i=[];else{i=Array(e);for(let n=0;n<e;n++)i[n]=t(n+1,n,void 0,a&&a[n])}}else if(E(e)){if(e[Symbol.iterator])i=Array.from(e,(e,n)=>t(e,n,void 0,a&&a[n]));else{let n=Object.keys(e);i=Array(n.length);for(let r=0,o=n.length;r<o;r++){let o=n[r];i[r]=t(e[o],o,r,a&&a[r])}}}else i=[];return n&&(n[r]=i),i}var Ir=e=>e?Aa(e)?Ra(e):Ir(e.parent):null,Lr=g(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Ir(e.parent),$root:e=>Ir(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Kr(e),$forceUpdate:e=>e.f||=()=>{Pn(e.update)},$nextTick:e=>e.n||=Mn.bind(e.proxy),$watch:e=>tr.bind(e)}),Rr=(e,t)=>e!==u&&!e.__isScriptSetup&&y(e,t),zr={get({_:e},t){if(t===`__v_skip`)return!0;let{ctx:n,setupState:r,data:i,props:a,accessCache:o,type:s,appContext:c}=e;if(t[0]!==`$`){let e=o[t];if(e!==void 0)switch(e){case 1:return r[t];case 2:return i[t];case 4:return n[t];case 3:return a[t]}else if(Rr(r,t))return o[t]=1,r[t];else if(i!==u&&y(i,t))return o[t]=2,i[t];else if(y(a,t))return o[t]=3,a[t];else if(n!==u&&y(n,t))return o[t]=4,n[t];else Vr&&(o[t]=0)}let l=Lr[t],d,f;if(l)return t===`$attrs`&&ft(e.attrs,`get`,``),l(e);if((d=s.__cssModules)&&(d=d[t]))return d;if(n!==u&&y(n,t))return o[t]=4,n[t];if(f=c.config.globalProperties,y(f,t))return f[t]},set({_:e},t,n){let{data:r,setupState:i,ctx:a}=e;return Rr(i,t)?(i[t]=n,!0):r!==u&&y(r,t)?(r[t]=n,!0):y(e.props,t)||t[0]===`$`&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:i,props:a,type:o}},s){let c;return!!(n[s]||e!==u&&s[0]!==`$`&&y(e,s)||Rr(t,s)||y(a,s)||y(r,s)||y(Lr,s)||y(i.config.globalProperties,s)||(c=o.__cssModules)&&c[s])},defineProperty(e,t,n){return n.get==null?y(n,`value`)&&this.set(e,t,n.value,null):e._.accessCache[t]=0,Reflect.defineProperty(e,t,n)}};function Br(e){return b(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}var Vr=!0;function Hr(e){let t=Kr(e),n=e.proxy,r=e.ctx;Vr=!1,t.beforeCreate&&Wr(t.beforeCreate,e,`bc`);let{data:i,computed:a,methods:o,watch:s,provide:c,inject:l,created:u,beforeMount:d,mounted:p,beforeUpdate:m,updated:h,activated:g,deactivated:_,beforeDestroy:v,beforeUnmount:y,destroyed:x,unmounted:S,render:C,renderTracked:T,renderTriggered:ee,errorCaptured:te,serverPrefetch:ne,expose:re,inheritAttrs:ie,components:ae,directives:oe,filters:D}=t;if(l&&Ur(l,r,null),o)for(let e in o){let t=o[e];w(t)&&(r[e]=t.bind(n))}if(i){let t=i.call(n,n);E(t)&&(e.data=Jt(t))}if(Vr=!0,a)for(let e in a){let t=a[e],i=R({get:w(t)?t.bind(n,n):w(t.get)?t.get.bind(n,n):f,set:!w(t)&&w(t.set)?t.set.bind(n):f});Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e})}if(s)for(let e in s)Gr(s[e],r,n,e);if(c){let e=w(c)?c.call(n):c;Reflect.ownKeys(e).forEach(t=>{Yn(t,e[t])})}u&&Wr(u,e,`c`);function se(e,t){b(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(se(wr,d),se(Tr,p),se(Er,m),se(Dr,h),se(vr,g),se(yr,_),se(Nr,te),se(Mr,T),se(jr,ee),se(Or,y),se(kr,S),se(Ar,ne),b(re)){if(re.length){let t=e.exposed||={};re.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||={}}C&&e.render===f&&(e.render=C),ie!=null&&(e.inheritAttrs=ie),ae&&(e.components=ae),oe&&(e.directives=oe),ne&&dr(e)}function Ur(e,t,n=f){b(e)&&(e=Zr(e));for(let n in e){let r=e[n],i;i=E(r)?`default`in r?Xn(r.from||n,r.default,!0):Xn(r.from||n):Xn(r),sn(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e}):t[n]=i}}function Wr(e,t,n){Sn(b(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function Gr(e,t,n,r){let i=r.includes(`.`)?nr(n,r):()=>n[r];if(T(e)){let n=t[e];w(n)&&$n(i,n)}else if(w(e))$n(i,e.bind(n));else if(E(e)){if(b(e))e.forEach(e=>Gr(e,t,n,r));else{let r=w(e.handler)?e.handler.bind(n):t[e.handler];w(r)&&$n(i,r,e)}}}function Kr(e){let t=e.type,{mixins:n,extends:r}=t,{mixins:i,optionsCache:a,config:{optionMergeStrategies:o}}=e.appContext,s=a.get(t),c;return s?c=s:!i.length&&!n&&!r?c=t:(c={},i.length&&i.forEach(e=>qr(c,e,o,!0)),qr(c,t,o)),E(t)&&a.set(t,c),c}function qr(e,t,n,r=!1){let{mixins:i,extends:a}=t;a&&qr(e,a,n,!0),i&&i.forEach(t=>qr(e,t,n,!0));for(let i in t)if(!(r&&i===`expose`)){let r=Jr[i]||n&&n[i];e[i]=r?r(e[i],t[i]):t[i]}return e}var Jr={data:Yr,props:ei,emits:ei,methods:$r,computed:$r,beforeCreate:Qr,created:Qr,beforeMount:Qr,mounted:Qr,beforeUpdate:Qr,updated:Qr,beforeDestroy:Qr,beforeUnmount:Qr,destroyed:Qr,unmounted:Qr,activated:Qr,deactivated:Qr,errorCaptured:Qr,serverPrefetch:Qr,components:$r,directives:$r,watch:ti,provide:Yr,inject:Xr};function Yr(e,t){return t?e?function(){return g(w(e)?e.call(this,this):e,w(t)?t.call(this,this):t)}:t:e}function Xr(e,t){return $r(Zr(e),Zr(t))}function Zr(e){if(b(e)){let t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Qr(e,t){return e?[...new Set([].concat(e,t))]:t}function $r(e,t){return e?g(Object.create(null),e,t):t}function ei(e,t){return e?b(e)&&b(t)?[...new Set([...e,...t])]:g(Object.create(null),Br(e),Br(t??{})):t}function ti(e,t){if(!e)return t;if(!t)return e;let n=g(Object.create(null),e);for(let r in t)n[r]=Qr(e[r],t[r]);return n}function ni(){return{app:null,config:{isNativeTag:p,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}var ri=0;function ii(e,t){return function(n,r=null){w(n)||(n=g({},n)),r!=null&&!E(r)&&(r=null);let i=ni(),a=new WeakSet,o=[],s=!1,c=i.app={_uid:ri++,_component:n,_props:r,_container:null,_context:i,_instance:null,version:Va,get config(){return i.config},set config(e){},use(e,...t){return a.has(e)||(e&&w(e.install)?(a.add(e),e.install(c,...t)):w(e)&&(a.add(e),e(c,...t))),c},mixin(e){return i.mixins.includes(e)||i.mixins.push(e),c},component(e,t){return t?(i.components[e]=t,c):i.components[e]},directive(e,t){return t?(i.directives[e]=t,c):i.directives[e]},mount(a,o,l){if(!s){let u=c._ceVNode||ua(n,r);return u.appContext=i,l===!0?l=`svg`:l===!1&&(l=void 0),o&&t?t(u,a):e(u,a,l),s=!0,c._container=a,a.__vue_app__=c,Ra(u.component)}},onUnmount(e){o.push(e)},unmount(){s&&(Sn(o,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(e,t){return i.provides[e]=t,c},runWithContext(e){let t=ai;ai=c;try{return e()}finally{ai=t}}};return c}}var ai=null,oi=(e,t)=>t===`modelValue`||t===`model-value`?e.modelModifiers:e[`${t}Modifiers`]||e[`${le(t)}Modifiers`]||e[`${de(t)}Modifiers`];function si(e,t,...n){if(e.isUnmounted)return;let r=e.vnode.props||u,i=n,a=t.startsWith(`update:`),o=a&&oi(r,t.slice(7));o&&(o.trim&&(i=n.map(e=>T(e)?e.trim():e)),o.number&&(i=i.map(_e)));let s,c=r[s=pe(t)]||r[s=pe(le(t))];!c&&a&&(c=r[s=pe(de(t))]),c&&Sn(c,e,6,i);let l=r[s+`Once`];if(l){if(!e.emitted)e.emitted={};else if(e.emitted[s])return;e.emitted[s]=!0,Sn(l,e,6,i)}}var ci=new WeakMap;function li(e,t,n=!1){let r=n?ci:t.emitsCache,i=r.get(e);if(i!==void 0)return i;let a=e.emits,o={},s=!1;if(!w(e)){let r=e=>{let n=li(e,t,!0);n&&(s=!0,g(o,n))};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}return!a&&!s?(E(e)&&r.set(e,null),null):(b(a)?a.forEach(e=>o[e]=null):g(o,a),E(e)&&r.set(e,o),o)}function ui(e,t){return!e||!m(t)?!1:(t=t.slice(2),t=t===`Once`?t:t.replace(/Once$/,``),y(e,t[0].toLowerCase()+t.slice(1))||y(e,de(t))||y(e,t))}function di(e){let{type:t,vnode:n,proxy:r,withProxy:i,propsOptions:[a],slots:o,attrs:s,emit:c,render:l,renderCache:u,props:d,data:f,setupState:p,ctx:m,inheritAttrs:g}=e,_=Gn(e),v,y;try{if(n.shapeFlag&4){let e=i||r,t=e;v=ha(l.call(t,e,u,d,p,f,m)),y=s}else{let e=t;v=ha(e.length>1?e(d,{attrs:s,slots:o,emit:c}):e(d,null)),y=t.props?s:pi(s)}}catch(t){$i.length=0,Cn(t,e,1),v=ua(Zi)}let b=v;if(y&&g!==!1){let e=Object.keys(y),{shapeFlag:t}=b;e.length&&t&7&&(a&&e.some(h)&&(y=mi(y,a)),b=pa(b,y,!1,!0))}return n.dirs&&(b=pa(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&cr(ir(b.type)&&sr(b)||b,n.transition),v=b,Gn(_),v}function fi(e,t=!0){let n;for(let t=0;t<e.length;t++){let r=e[t];if(oa(r)){if(r.type!==Zi||r.children===`v-if`){if(n)return;n=r}}else return}return n}var pi=e=>{let t;for(let n in e)(n===`class`||n===`style`||m(n))&&((t||={})[n]=e[n]);return t},mi=(e,t)=>{let n={};for(let r in e)(!h(r)||!(r.slice(9)in t))&&(n[r]=e[r]);return n};function hi(e,t,n){let{props:r,children:i,component:a}=e,{props:o,children:s,patchFlag:c}=t,l=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?gi(r,o,l):!!o;if(c&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t];if(_i(o,r,n)&&!ui(l,n))return!0}}}else return(i||s)&&(!s||!s.$stable)?!0:r===o?!1:r?!o||gi(r,o,l):!!o;return!1}function gi(e,t,n){let r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let i=0;i<r.length;i++){let a=r[i];if(!y(e,a)||_i(t,e,a)&&!ui(n,a))return!0}return!1}function _i(e,t,n){let r=e[n],i=t[n];return n===`style`&&E(r)&&E(i)?!je(r,i):r!==i}function vi({vnode:e,parent:t,suspense:n},r){for(;t;){let n=t.subTree;if(n.suspense&&n.suspense.activeBranch===e&&(n.suspense.vnode.el=n.el=r,e=n),n===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}var yi={},bi=()=>Object.create(yi),xi=e=>Object.getPrototypeOf(e)===yi;function Si(e,t,n,r=!1){let i={},a=bi();e.propsDefaults=Object.create(null),wi(e,t,i,a);for(let t in e.propsOptions[0])t in i||(i[t]=void 0);e.props=n?r?i:Yt(i):e.type.props?i:a,e.attrs=a}function Ci(e,t,n,r){let{props:i,attrs:a,vnode:{patchFlag:o}}=e,s=nn(i),[c]=e.propsOptions,l=!1;if((r||o>0)&&!(o&16)){if(o&8){let n=e.vnode.dynamicProps;for(let r=0;r<n.length;r++){let o=n[r];if(ui(e.emitsOptions,o))continue;let u=t[o];if(c){if(y(a,o))u!==a[o]&&(a[o]=u,l=!0);else{let t=le(o);i[t]=Ti(c,s,t,u,e,!1)}}else u!==a[o]&&(a[o]=u,l=!0)}}}else{wi(e,t,i,a)&&(l=!0);let r;for(let a in s)(!t||!y(t,a)&&((r=de(a))===a||!y(t,r)))&&(c?n&&(n[a]!==void 0||n[r]!==void 0)&&(i[a]=Ti(c,s,a,void 0,e,!0)):delete i[a]);if(a!==s)for(let e in a)(!t||!y(t,e))&&(delete a[e],l=!0)}l&&pt(e.attrs,`set`,``)}function wi(e,t,n,r){let[i,a]=e.propsOptions,o=!1,s;if(t)for(let c in t){if(D(c))continue;let l=t[c],u;i&&y(i,u=le(c))?!a||!a.includes(u)?n[u]=l:(s||={})[u]=l:ui(e.emitsOptions,c)||(!(c in r)||l!==r[c])&&(r[c]=l,o=!0)}if(a){let t=nn(n),r=s||u;for(let o=0;o<a.length;o++){let s=a[o];n[s]=Ti(i,t,s,r[s],e,!y(r,s))}}return o}function Ti(e,t,n,r,i,a){let o=e[n];if(o!=null){let e=y(o,`default`);if(e&&r===void 0){let e=o.default;if(o.type!==Function&&!o.skipFactory&&w(e)){let{propsDefaults:a}=i;if(n in a)r=a[n];else{let o=Oa(i);r=a[n]=e.call(null,t),o()}}else r=e;i.ce&&i.ce._setProp(n,r)}o[0]&&(a&&!e?r=!1:o[1]&&(r===``||r===de(n))&&(r=!0))}return r}var Ei=new WeakMap;function Di(e,t,n=!1){let r=n?Ei:t.propsCache,i=r.get(e);if(i)return i;let a=e.props,o={},s=[],c=!1;if(!w(e)){let r=e=>{c=!0;let[n,r]=Di(e,t,!0);g(o,n),r&&s.push(...r)};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}if(!a&&!c)return E(e)&&r.set(e,d),d;if(b(a))for(let e=0;e<a.length;e++){let t=le(a[e]);Oi(t)&&(o[t]=u)}else if(a)for(let e in a){let t=le(e);if(Oi(t)){let n=a[e],r=o[t]=b(n)||w(n)?{type:n}:g({},n),i=r.type,c=!1,l=!0;if(b(i))for(let e=0;e<i.length;++e){let t=i[e],n=w(t)&&t.name;if(n===`Boolean`){c=!0;break}n===`String`&&(l=!1)}else c=w(i)&&i.name===`Boolean`;r[0]=c,r[1]=l,(c||y(r,`default`))&&s.push(t)}}let l=[o,s];return E(e)&&r.set(e,l),l}function Oi(e){return e[0]!==`$`&&!D(e)}var ki=e=>e===`_`||e===`_ctx`||e===`$stable`,Ai=e=>b(e)?e.map(ha):[ha(e)],ji=(e,t,n)=>{if(t._n)return t;let r=Kn((...e)=>Ai(t(...e)),n);return r._c=!1,r},Mi=(e,t,n)=>{let r=e._ctx;for(let n in e){if(ki(n))continue;let i=e[n];if(w(i))t[n]=ji(n,i,r);else if(i!=null){let e=Ai(i);t[n]=()=>e}}},Ni=(e,t)=>{let n=Ai(t);e.slots.default=()=>n},Pi=(e,t,n)=>{for(let r in t)(n||!ki(r))&&(e[r]=t[r])},Fi=(e,t,n)=>{let r=e.slots=bi();if(e.vnode.shapeFlag&32){let e=t._;e?(Pi(r,t,n),n&&ge(r,`_`,e,!0)):Mi(t,r)}else t&&Ni(e,t)},Ii=(e,t,n)=>{let{vnode:r,slots:i}=e,a=!0,o=u;if(r.shapeFlag&32){let e=t._;e?n&&e===1?a=!1:Pi(i,t,n):(a=!t.$stable,Mi(t,i)),o=t}else t&&(Ni(e,t),o={default:1});if(a)for(let e in i)!ki(e)&&o[e]==null&&delete i[e]},Li=Yi;function Ri(e){return zi(e)}function zi(e,t){let n=ye();n.__VUE__=!0;let{insert:r,remove:i,patchProp:a,createElement:o,createText:s,createComment:c,setText:l,setElementText:p,parentNode:m,nextSibling:h,setScopeId:g=f,insertStaticContent:_}=e,v=(e,t,n,r=null,i=null,a=null,o=void 0,s=null,c=!!t.dynamicChildren)=>{if(e===t)return;e&&!sa(e,t)&&(r=xe(e),me(e,i,a,!0),e=null),t.patchFlag===-2&&(c=!1,t.dynamicChildren=null),t.dynamicChildren&&e&&e.dynamicChildren&&e.dynamicChildren.hasOnce&&(t.dynamicChildren===d&&(t.dynamicChildren=[]),t.dynamicChildren.hasOnce=!0);let{type:l,ref:u,shapeFlag:f}=t;switch(l){case Xi:y(e,t,n,r);break;case Zi:b(e,t,n,r);break;case Qi:e??x(t,n,r,o);break;case M:ie(e,t,n,r,i,a,o,s,c);break;default:f&1?w(e,t,n,r,i,a,o,s,c):f&6?ae(e,t,n,r,i,a,o,s,c):(f&64||f&128)&&l.process(e,t,n,r,i,a,o,s,c,Ce)}u!=null&&i?mr(u,e&&e.ref,a,t||e,!t):u==null&&e&&e.ref!=null&&mr(e.ref,null,a,e,!0)},y=(e,t,n,i)=>{if(e==null)r(t.el=s(t.children),n,i);else{let n=t.el=e.el;t.children!==e.children&&l(n,t.children)}},b=(e,t,n,i)=>{e==null?r(t.el=c(t.children||``),n,i):t.el=e.el},x=(e,t,n,r)=>{[e.el,e.anchor]=_(e.children,t,n,r,e.el,e.anchor)},S=({el:e,anchor:t},n,i)=>{let a;for(;e&&e!==t;)a=h(e),r(e,n,i),e=a;r(t,n,i)},C=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=h(e),i(e),e=n;i(t)},w=(e,t,n,r,i,a,o,s,c)=>{if(t.type===`svg`?o=`svg`:t.type===`math`&&(o=`mathml`),e==null)T(t,n,r,i,a,o,s,c);else{let n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),te(e,t,i,a,o,s,c)}finally{n&&n._endPatch()}}},T=(e,t,n,i,s,c,l,u)=>{let d,f,{props:m,shapeFlag:h,transition:g,dirs:_}=e;if(d=e.el=o(e.type,c,m&&m.is,m),h&8?p(d,e.children):h&16&&E(e.children,d,null,i,s,Bi(e,c),l,u),_&&Jn(e,null,i,`created`),ee(d,e,e.scopeId,l,i),m){for(let e in m)e!==`value`&&!D(e)&&a(d,e,null,m[e],c,i);`value`in m&&a(d,`value`,null,m.value,c),(f=m.onVnodeBeforeMount)&&ya(f,i,e)}_&&Jn(e,null,i,`beforeMount`);let v=Hi(s,g);v&&g.beforeEnter(d),r(d,t,n),((f=m&&m.onVnodeMounted)||v||_)&&Li(()=>{try{f&&ya(f,i,e),v&&g.enter(d),_&&Jn(e,null,i,`mounted`)}finally{}},s)},ee=(e,t,n,r,i)=>{if(n&&g(e,n),r)for(let t=0;t<r.length;t++)g(e,r[t]);if(i){let n=i.subTree;if(t===n||Ji(n.type)&&(n.ssContent===t||n.ssFallback===t)){let t=i.vnode;ee(e,t,t.scopeId,t.slotScopeIds,i.parent)}}},E=(e,t,n,r,i,a,o,s,c=0)=>{for(let l=c;l<e.length;l++){let c=e[l]=s?ga(e[l]):ha(e[l]);v(null,c,t,n,r,i,a,o,s)}},te=(e,t,n,r,i,o,s)=>{let c=t.el=e.el,{patchFlag:l,dynamicChildren:d,dirs:f}=t;l|=e.patchFlag&16;let m=e.props||u,h=t.props||u,g;if(n&&Vi(n,!1),(g=h.onVnodeBeforeUpdate)&&ya(g,n,t,e),f&&Jn(t,e,n,`beforeUpdate`),n&&Vi(n,!0),d&&(!e.dynamicChildren||e.dynamicChildren.length!==d.length)&&(l=0,s=!1,d=null),(m.innerHTML&&h.innerHTML==null||m.textContent&&h.textContent==null)&&p(c,``),d?ne(e.dynamicChildren,d,c,n,r,Bi(t,i),o):s||ue(e,t,c,null,n,r,Bi(t,i),o,!1),l>0){if(l&16)re(c,m,h,n,i);else if(l&2&&m.class!==h.class&&a(c,`class`,null,h.class,i),l&4&&a(c,`style`,m.style,h.style,i),l&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let r=e[t],o=m[r],s=h[r];(s!==o||r===`value`)&&a(c,r,o,s,i,n)}}l&1&&e.children!==t.children&&p(c,t.children)}else!s&&d==null&&re(c,m,h,n,i);((g=h.onVnodeUpdated)||f)&&Li(()=>{g&&ya(g,n,t,e),f&&Jn(t,e,n,`updated`)},r)},ne=(e,t,n,r,i,a,o)=>{for(let s=0;s<t.length;s++){let c=e[s],l=t[s],u=c.el||qi(c),d=u&&(c.type===M||!sa(c,l)||c.shapeFlag&198)?m(u):n;v(c,l,d,null,r,i,a,o,!0)}},re=(e,t,n,r,i)=>{if(t!==n){if(t!==u)for(let o in t)!D(o)&&!(o in n)&&a(e,o,t[o],null,i,r);for(let o in n){if(D(o))continue;let s=n[o],c=t[o];s!==c&&o!==`value`&&a(e,o,c,s,i,r)}`value`in n&&a(e,`value`,t.value,n.value,i)}},ie=(e,t,n,i,a,o,c,l,u)=>{let d=t.el=e?e.el:s(``),f=t.anchor=e?e.anchor:s(``),{patchFlag:p,dynamicChildren:m,slotScopeIds:h}=t;h&&(l=l?l.concat(h):h),e==null?(r(d,n,i),r(f,n,i),E(t.children||[],n,f,a,o,c,l,u)):p>0&&p&64&&m&&e.dynamicChildren&&e.dynamicChildren.length===m.length?(ne(e.dynamicChildren,m,n,a,o,c,l),(t.key!=null||a&&t===a.subTree)&&Ui(e,t,!0)):ue(e,t,n,f,a,o,c,l,u)},ae=(e,t,n,r,i,a,o,s,c)=>{t.slotScopeIds=s,e==null?t.shapeFlag&512?i.ctx.activate(t,n,r,o,c):oe(t,n,r,i,a,o,c):se(e,t,c)},oe=(e,t,n,r,i,a,o)=>{let s=e.component=Ca(e,r,i);if(_r(e)&&(s.ctx.renderer=Ce),Ma(s,!1,o),s.asyncDep){if(i&&i.registerDep(s,ce,o,a),!e.el){let r=s.subTree=ua(Zi);b(null,r,t,n),e.placeholder=r.el}}else ce(s,e,t,n,i,a,o)},se=(e,t,n)=>{let r=t.component=e.component;if(hi(e,t,n)){if(r.asyncDep&&!r.asyncResolved){t.el=e.el,t.placeholder=e.placeholder,le(r,t,n);return}r.next=t,r.update()}else t.el=e.el,t.placeholder=e.placeholder,r.vnode=t},ce=(e,t,n,r,i,a,o)=>{let s=()=>{if(e.isMounted){let{next:t,bu:n,u:r,parent:s,vnode:c}=e;{let n=Gi(e);if(n){t&&(t.el=c.el,le(e,t,o)),n.asyncDep.then(()=>{Li(()=>{e.isUnmounted||l()},i)});return}}let u=t,d;Vi(e,!1),t?(t.el=c.el,le(e,t,o)):t=c,n&&he(n),(d=t.props&&t.props.onVnodeBeforeUpdate)&&ya(d,s,t,c),Vi(e,!0);let f=di(e),p=e.subTree;e.subTree=f,v(p,f,m(p.el),xe(p),e,i,a),t.el=f.el,u===null&&vi(e,f.el),r&&Li(r,i),(d=t.props&&t.props.onVnodeUpdated)&&Li(()=>ya(d,s,t,c),i)}else{let o,{el:s,props:c}=t,{bm:l,m:u,parent:d,root:f,type:p}=e,m=gr(t);if(Vi(e,!1),l&&he(l),!m&&(o=c&&c.onVnodeBeforeMount)&&ya(o,d,t),Vi(e,!0),s&&O){let t=()=>{e.subTree=di(e),O(s,e.subTree,e,i,null)};m&&p.__asyncHydrate?p.__asyncHydrate(s,e,t):t()}else{f.ce&&f.ce._hasShadowRoot()&&f.ce._injectChildStyle(p,e.parent?e.parent.type:void 0);let o=e.subTree=di(e);v(null,o,n,r,e,i,a),t.el=o.el}if(u&&Li(u,i),!m&&(o=c&&c.onVnodeMounted)){let e=t;Li(()=>ya(o,d,e),i)}(t.shapeFlag&256||d&&gr(d.vnode)&&d.vnode.shapeFlag&256)&&e.a&&Li(e.a,i),e.isMounted=!0,t=n=r=null}};e.scope.on();let c=e.effect=new Be(s);e.scope.off();let l=e.update=c.run.bind(c),u=e.job=c.runIfDirty.bind(c);u.i=e,u.id=e.uid,c.scheduler=()=>Pn(u),Vi(e,!0),l()},le=(e,t,n)=>{t.component=e;let r=e.vnode.props;e.vnode=t,e.next=null,Ci(e,t.props,r,n),Ii(e,t.children,n),tt(),Ln(e),nt()},ue=(e,t,n,r,i,a,o,s,c=!1)=>{let l=e&&e.children,u=e?e.shapeFlag:0,d=t.children,{patchFlag:f,shapeFlag:m}=t;if(f>0){if(f&128){fe(l,d,n,r,i,a,o,s,c);return}if(f&256){de(l,d,n,r,i,a,o,s,c);return}}m&8?(u&16&&be(l,i,a),d!==l&&p(n,d)):u&16?m&16?fe(l,d,n,r,i,a,o,s,c):be(l,i,a,!0):(u&8&&p(n,``),m&16&&E(d,n,r,i,a,o,s,c))},de=(e,t,n,r,i,a,o,s,c)=>{e||=d,t||=d;let l=e.length,u=t.length,f=Math.min(l,u),p=0;for(;p<f;p++){let r=t[p]=c?ga(t[p]):ha(t[p]);v(e[p],r,n,null,i,a,o,s,c)}l>u?be(e,i,a,!0,!1,f):E(t,n,r,i,a,o,s,c,f)},fe=(e,t,n,r,i,a,o,s,c)=>{let l=0,u=t.length,f=e.length-1,p=u-1;for(;l<=f&&l<=p;){let r=e[l],u=t[l]=c?ga(t[l]):ha(t[l]);if(sa(r,u))v(r,u,n,null,i,a,o,s,c);else break;l++}for(;l<=f&&l<=p;){let r=e[f],l=t[p]=c?ga(t[p]):ha(t[p]);if(sa(r,l))v(r,l,n,null,i,a,o,s,c);else break;f--,p--}if(l>f){if(l<=p){let e=p+1,d=e<u?t[e].el:r;for(;l<=p;)v(null,t[l]=c?ga(t[l]):ha(t[l]),n,d,i,a,o,s,c),l++}}else if(l>p)for(;l<=f;)me(e[l],i,a,!0),l++;else{let m=l,h=l,g=new Map;for(l=h;l<=p;l++){let e=t[l]=c?ga(t[l]):ha(t[l]);e.key!=null&&g.set(e.key,l)}let _,y=0,b=p-h+1,x=!1,S=0,C=Array(b);for(l=0;l<b;l++)C[l]=0;for(l=m;l<=f;l++){let r=e[l];if(y>=b){me(r,i,a,!0);continue}let u;if(r.key!=null)u=g.get(r.key);else for(_=h;_<=p;_++)if(C[_-h]===0&&sa(r,t[_])){u=_;break}u===void 0?me(r,i,a,!0):(C[u-h]=l+1,u>=S?S=u:x=!0,v(r,t[u],n,null,i,a,o,s,c),y++)}let w=x?Wi(C):d;for(_=w.length-1,l=b-1;l>=0;l--){let e=h+l,d=t[e],f=t[e+1],p=e+1<u?f.el||qi(f):r;C[l]===0?v(null,d,n,p,i,a,o,s,c):x&&(_<0||l!==w[_]?pe(d,n,p,2):_--)}}},pe=(e,t,n,a,o=null)=>{let{el:s,type:c,transition:l,children:u,shapeFlag:d}=e;if(d&6)pe(e.component.subTree,t,n,a);else if(d&128)e.suspense.move(t,n,a);else if(d&64)c.move(e,t,n,Ce);else if(c===M){r(s,t,n);for(let e=0;e<u.length;e++)pe(u[e],t,n,a);r(e.anchor,t,n)}else if(c===Qi)S(e,t,n);else if(a!==2&&d&1&&l){if(a===0)l.persisted&&!s[ar]?r(s,t,n):(l.beforeEnter(s),r(s,t,n),Li(()=>l.enter(s),o));else{let{leave:a,delayLeave:o,afterLeave:c}=l,u=()=>{e.ctx.isUnmounted?i(s):r(s,t,n)},d=()=>{let e=s._isLeaving||!!s[ar];s._isLeaving&&s[ar](!0),l.persisted&&!e?u():a(s,()=>{u(),c&&c()})};o?o(s,u,d):d()}}else r(s,t,n)},me=(e,t,n,r=!1,i=!1)=>{let{type:a,props:o,ref:s,children:c,dynamicChildren:l,shapeFlag:u,patchFlag:d,dirs:f,cacheIndex:p,memo:m}=e;if((d===-2||l&&l.hasOnce)&&(i=!1),s!=null&&(tt(),mr(s,null,n,e,!0),nt()),p!=null&&(!e.ctx||e.ctx===t)&&(t.renderCache[p]=void 0),u&256){t.ctx.deactivate(e);return}let h=u&1&&f,g=!gr(e),_;if(g&&(_=o&&o.onVnodeBeforeUnmount)&&ya(_,t,e),u&6)ve(e.component,n,r);else{if(u&128){e.suspense.unmount(n,r);return}h&&Jn(e,null,t,`beforeUnmount`),u&64?e.type.remove(e,t,n,Ce,r):l&&!l.hasOnce&&(a!==M||d>0&&d&64)?be(l,t,n,!1,!0):(a===M&&d&384||!i&&u&16)&&be(c,t,n),r&&ge(e)}let v=m!=null&&p==null;(g&&(_=o&&o.onVnodeUnmounted)||h||v)&&Li(()=>{_&&ya(_,t,e),h&&Jn(e,null,t,`unmounted`),v&&(e.el=null)},n)},ge=e=>{let{type:t,el:n,anchor:r,transition:a}=e,o=t===M;if(o&&!a){_e(n,r);return}if(t===Qi){C(e),a&&!a.persisted&&a.afterLeave&&a.afterLeave();return}let s=o?lr(e):e,c=()=>{o?m(n)&&_e(n,r):i(n),a&&!a.persisted&&a.afterLeave&&a.afterLeave()};if(s&&s.shapeFlag&1&&a&&!a.persisted){let{leave:e,delayLeave:t}=a,n=s.el,r=()=>e(n,c);t?t(n,c,r):r()}else c()},_e=(e,t)=>{let n;for(;e!==t;)n=h(e),i(e),e=n;i(t)},ve=(e,t,n)=>{let{bum:r,scope:i,job:a,subTree:o,um:s,m:c,a:l}=e;Ki(c),Ki(l),r&&he(r),i.stop(),a?(a.flags|=8,me(o,e,t,n)):e.vnode.el&&o&&(o.transition=e.vnode.transition,me(o,e,t,n)),s&&Li(s,t),Li(()=>{e.isUnmounted=!0},t)},be=(e,t,n,r=!1,i=!1,a=0)=>{for(let o=a;o<e.length;o++)me(e[o],t,n,r,i)},xe=e=>{if(e.shapeFlag&6)return xe(e.component.subTree);if(e.shapeFlag&128)return e.suspense.next();let t=h(e.anchor||e.el),n=t&&t[rr];return n?h(n):t},Se=(e,t,n)=>{Bn(()=>{e==null?t._vnode&&me(t._vnode,null,null,!0):v(t._vnode||null,e,t,null,null,null,n),t._vnode=e},e&&t._vnode?void 0:e&&e.component?e.component.uid:Sa())},Ce={p:v,um:me,m:pe,r:ge,mt:oe,mc:E,pc:ue,pbc:ne,n:xe,o:e},we,O;return t&&([we,O]=t(Ce)),{render:Se,hydrate:we,createApp:ii(Se,we)}}function Bi({type:e,props:t},n){return n===`svg`&&e===`foreignObject`||n===`mathml`&&e===`annotation-xml`&&t&&t.encoding&&t.encoding.includes(`html`)?void 0:n}function Vi({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Hi(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Ui(e,t,n=!1){let r=e.children,i=t.children;if(b(r)&&b(i))for(let e=0;e<r.length;e++){let t=r[e],a=i[e];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[e]=ga(i[e]),a.el=t.el),!n&&a.patchFlag!==-2&&Ui(t,a)),a.type===Xi&&(a.patchFlag===-1&&(a=i[e]=ga(a)),a.el=t.el),a.type===Zi&&!a.el&&(a.el=t.el)}}function Wi(e){let t=e.slice(),n=[0],r,i,a,o,s,c=e.length;for(r=0;r<c;r++){let c=e[r];if(c!==0){if(i=n[n.length-1],e[i]<c){t[r]=i,n.push(r);continue}for(a=0,o=n.length-1;a<o;)s=a+o>>1,e[n[s]]<c?a=s+1:o=s;c<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,o=n[a-1];a-->0;)n[a]=o,o=t[o];return n}function Gi(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Gi(t)}function Ki(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function qi(e){if(e.placeholder)return e.placeholder;let t=e.component;return t?qi(t.subTree):null}var Ji=e=>e.__isSuspense;function Yi(e,t){t&&t.pendingBranch?b(e)?t.effects.push(...e):t.effects.push(e):In(e)}var M=Symbol.for(`v-fgt`),Xi=Symbol.for(`v-txt`),Zi=Symbol.for(`v-cmt`),Qi=Symbol.for(`v-stc`),$i=[],ea=null;function N(e=!1){$i.push(ea=e?null:[])}function ta(){$i.pop(),ea=$i[$i.length-1]||null}var na=1;function ra(e,t=!1){na+=e,e<0&&ea&&t&&(ea.hasOnce=!0)}function ia(e){return e.dynamicChildren=na>0?ea||d:null,ta(),na>0&&ea&&ea.push(e),e}function P(e,t,n,r,i,a){return ia(F(e,t,n,r,i,a,!0))}function aa(e,t,n,r,i){return ia(ua(e,t,n,r,i,!0))}function oa(e){return e?e.__v_isVNode===!0:!1}function sa(e,t){return e.type===t.type&&e.key===t.key}var ca=({key:e})=>e??null,la=({ref:e,ref_key:t,ref_for:n})=>(typeof e==`number`&&(e=``+e),e==null?null:T(e)||sn(e)||w(e)?{i:Un,r:e,k:t,f:!!n}:e);function F(e,t=null,n=null,r=0,i=null,a=e===M?0:1,o=!1,s=!1){let c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&ca(t),ref:t&&la(t),scopeId:Wn,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Un};return s?(_a(c,n),a&128&&e.normalize(c)):n&&(c.shapeFlag|=T(n)?8:16),na>0&&!o&&ea&&(c.patchFlag>0||a&6)&&c.patchFlag!==32&&ea.push(c),c}var ua=da;function da(e,t=null,n=null,r=0,i=null,a=!1){if((!e||e===Pr)&&(e=Zi),oa(e)){let r=pa(e,t,!0);return n&&_a(r,n),na>0&&!a&&ea&&(r.shapeFlag&6?ea[ea.indexOf(e)]=r:ea.push(r)),r.patchFlag=-2,r}if(za(e)&&(e=e.__vccOpts),t){t=fa(t);let{class:e,style:n}=t;e&&!T(e)&&(t.class=O(e)),E(n)&&(tn(n)&&!b(n)&&(n=g({},n)),t.style=be(n))}let o=T(e)?1:Ji(e)?128:ir(e)?64:E(e)?4:w(e)?2:0;return F(e,t,n,r,i,o,a,!0)}function fa(e){return e?tn(e)||xi(e)?g({},e):e:null}function pa(e,t,n=!1,r=!1){let{props:i,ref:a,patchFlag:o,children:s,transition:c}=e,l=t?va(i||{},t):i,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&ca(l),ref:t&&t.ref?n&&a?b(a)?a.concat(la(t)):[a,la(t)]:la(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==M?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&pa(e.ssContent),ssFallback:e.ssFallback&&pa(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce,cacheIndex:e.cacheIndex};return c&&r&&cr(u,c.clone(u)),u}function I(e=` `,t=0){return ua(Xi,null,e,t)}function ma(e,t){let n=ua(Qi,null,e);return n.staticCount=t,n}function L(e=``,t=!1){return t?(N(),aa(Zi,null,e)):ua(Zi,null,e)}function ha(e){return e==null||typeof e==`boolean`?ua(Zi):b(e)?ua(M,null,e.slice()):oa(e)?ga(e):ua(Xi,null,String(e))}function ga(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:pa(e)}function _a(e,t){let n=0,{shapeFlag:r}=e;if(t==null)t=null;else if(b(t))n=16;else if(typeof t==`object`){if(r&65){let n=t.default;n&&(n._c&&(n._d=!1),_a(e,n()),n._c&&(n._d=!0));return}{n=32;let r=t._;!r&&!xi(t)?t._ctx=Un:r===3&&Un&&(Un.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}}else if(w(t)){if(r&65){_a(e,{default:t});return}t={default:t,_ctx:Un},n=32}else t=String(t),r&64?(n=16,t=[I(t)]):n=8;e.children=t,e.shapeFlag|=n}function va(...e){let t={};for(let n=0;n<e.length;n++){let r=e[n];for(let e in r)if(e===`class`)t.class!==r.class&&(t.class=O([t.class,r.class]));else if(e===`style`)t.style=be([t.style,r.style]);else if(m(e)){let n=t[e],i=r[e];i&&n!==i&&!(b(n)&&n.includes(i))?t[e]=n?[].concat(n,i):i:i==null&&n==null&&!h(e)&&(t[e]=i)}else e!==``&&(t[e]=r[e])}return t}function ya(e,t,n,r=null){Sn(e,t,7,[n,r])}var ba=ni(),xa=0;function Sa(){return xa}function Ca(e,t,n){let r=e.type,i=(t?t.appContext:e.appContext)||ba,a={uid:xa++,vnode:e,type:r,parent:t,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Ie(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(i.provides),ids:t?t.ids:[``,0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Di(r,i),emitsOptions:li(r,i),emit:null,emitted:null,propsDefaults:u,inheritAttrs:r.inheritAttrs,ctx:u,data:u,props:u,attrs:u,slots:u,refs:u,setupState:u,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return a.ctx={_:a},a.root=t?t.root:a,a.emit=si.bind(null,a),e.ce&&e.ce(a),a}var wa=null,Ta=()=>wa||Un,Ea,Da;{let e=ye(),t=(t,n)=>{let r;return(r=e[t])||(r=e[t]=[]),r.push(n),e=>{r.length>1?r.forEach(t=>t(e)):r[0](e)}};Ea=t(`__VUE_INSTANCE_SETTERS__`,e=>wa=e),Da=t(`__VUE_SSR_SETTERS__`,e=>ja=e)}var Oa=e=>{let t=wa;return Ea(e),e.scope.on(),()=>{e.scope.off(),Ea(t)}},ka=()=>{wa&&wa.scope.off(),Ea(null)};function Aa(e){return e.vnode.shapeFlag&4}var ja=!1;function Ma(e,t=!1,n=!1){t&&Da(t);let{props:r,children:i}=e.vnode,a=Aa(e);Si(e,r,a,t),Fi(e,i,n||t);let o=a?Na(e,t):void 0;return t&&Da(!1),o}function Na(e,t){let n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,zr);let{setup:r}=n;if(r){tt();let n=e.setupContext=r.length>1?La(e):null,i=Oa(e),a=xn(r,e,0,[e.props,n]),o=te(a);if(nt(),i(),(o||e.sp)&&!gr(e)&&dr(e),o){if(a.then(ka,ka),t)return a.then(n=>{Da(!0);try{Pa(e,n,t)}finally{Da(!1)}}).catch(t=>{Cn(t,e,0)});e.asyncDep=a}else Pa(e,a,t)}else Fa(e,t)}function Pa(e,t,n){w(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:E(t)&&(e.setupState=fn(t)),Fa(e,n)}function Fa(e,t,n){let r=e.type;e.render||=r.render||f;{let t=Oa(e);tt();try{Hr(e)}finally{nt(),t()}}}var Ia={get(e,t){return ft(e,`get`,``),e[t]}};function La(e){return{attrs:new Proxy(e.attrs,Ia),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function Ra(e){return e.exposed?e.exposeProxy||=new Proxy(fn(rn(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Lr)return Lr[n](e)},has(e,t){return t in e||t in Lr}}):e.proxy}function za(e){return w(e)&&`__vccOpts`in e}var R=(e,t)=>mn(e,t,ja);function Ba(e,t,n){try{ra(-1);let r=arguments.length;return r===2?E(t)&&!b(t)?oa(t)?ua(e,null,[t]):ua(e,t):ua(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&oa(n)&&(n=[n]),ua(e,t,n))}finally{ra(1)}}var Va=`3.5.44`,Ha=void 0,Ua=typeof window<`u`&&window.trustedTypes;if(Ua)try{Ha=Ua.createPolicy(`vue`,{createHTML:e=>e})}catch{}var Wa=Ha?e=>Ha.createHTML(e):e=>e,Ga=`http://www.w3.org/2000/svg`,Ka=`http://www.w3.org/1998/Math/MathML`,qa=typeof document<`u`?document:null,Ja=qa&&qa.createElement(`template`),Ya={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let i=t===`svg`?qa.createElementNS(Ga,e):t===`mathml`?qa.createElementNS(Ka,e):n?qa.createElement(e,{is:n}):qa.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>qa.createTextNode(e),createComment:e=>qa.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>qa.querySelector(e),setScopeId(e,t){e.setAttribute(t,``)},insertStaticContent(e,t,n,r,i,a){let o=n?n.previousSibling:t.lastChild;if(i&&(i===a||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),i!==a&&(i=i.nextSibling););else{Ja.innerHTML=Wa(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=Ja.content;if(r===`svg`||r===`mathml`){let e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Xa=Symbol(`_vtc`);function Za(e,t,n){let r=e[Xa];r&&(t=(t?[t,...r]:[...r]).join(` `)),t==null?e.removeAttribute(`class`):n?e.setAttribute(`class`,t):e.className=t}var Qa=Symbol(`_vod`),$a=Symbol(`_vsh`),eo={name:`show`,beforeMount(e,{value:t},{transition:n}){e[Qa]=e.style.display===`none`?``:e.style.display,n&&t?n.beforeEnter(e):to(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),to(e,!0),r.enter(e)):r.leave(e,()=>{to(e,!1)}):to(e,t))},beforeUnmount(e,{value:t}){to(e,t)}};function to(e,t){e.style.display=t?e[Qa]:`none`,e[$a]=!t}var no=Symbol(``),ro=/(?:^|;)\s*display\s*:/;function io(e,t,n){let r=e.style,i=T(n),a=!1;if(n&&!i){if(t){if(T(t))for(let e of t.split(`;`)){let t=e.slice(0,e.indexOf(`:`)).trim();n[t]??oo(r,t,``)}else for(let e in t)n[e]??oo(r,e,``)}for(let i in n){i===`display`&&(a=!0);let o=n[i];o==null?oo(r,i,``):uo(e,i,!T(t)&&t?t[i]:void 0,o)||oo(r,i,o)}}else if(i){if(t!==n){let e=r[no];e&&(n+=`;`+e),r.cssText=n,a=ro.test(n)}}else t&&e.removeAttribute(`style`);Qa in e&&((!i||t!==n)&&(e[Qa]=a?r.display:``),e[$a]&&(r.display=`none`))}var ao=/\s*!important$/;function oo(e,t,n){if(b(n))n.forEach(n=>oo(e,t,n));else if(n??=``,t.startsWith(`--`))ao.test(n)?e.setProperty(t,n.replace(ao,``),`important`):e.setProperty(t,n);else{let r=lo(e,t);ao.test(n)?e.setProperty(de(r),n.replace(ao,``),`important`):e[r]=n}}var so=[`Webkit`,`Moz`,`ms`],co={};function lo(e,t){let n=co[t];if(n)return n;let r=le(t);if(r!==`filter`&&r in e)return co[t]=r;r=fe(r);for(let n=0;n<so.length;n++){let i=so[n]+r;if(i in e)return co[t]=i}return t}function uo(e,t,n,r){return e.tagName===`TEXTAREA`&&(t===`width`||t===`height`)&&T(r)&&n===r}var fo=`http://www.w3.org/1999/xlink`;function po(e,t,n,r,i,a=Te(t)){r&&t.startsWith(`xlink:`)?n==null?e.removeAttributeNS(fo,t.slice(6,t.length)):e.setAttributeNS(fo,t,n):n==null||a&&!Ee(n)?e.removeAttribute(t):e.setAttribute(t,a?``:ee(n)?String(n):n)}function mo(e,t,n,r,i){if(t===`innerHTML`||t===`textContent`){n!=null&&(e[t]=t===`innerHTML`?Wa(n):n);return}let a=e.tagName;if(t===`value`&&a!==`PROGRESS`&&!a.includes(`-`)){let r=a===`OPTION`?e.getAttribute(`value`)||``:e.value,i=n==null?e.type===`checkbox`?`on`:``:String(n);(r!==i||!(`_value`in e))&&(e.value=i),n??e.removeAttribute(t),e._value=n;return}let o=!1;if(n===``||n==null){let r=typeof e[t];r===`boolean`?n=Ee(n):n==null&&r===`string`?(n=``,o=!0):r===`number`&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(i||t)}function ho(e,t,n,r){e.addEventListener(t,n,r)}function go(e,t,n,r){e.removeEventListener(t,n,r)}var _o=Symbol(`_vei`);function vo(e,t,n,r,i=null){let a=e[_o]||(e[_o]={}),o=a[t];if(r&&o)o.value=r;else{let[n,s]=xo(t);r?ho(e,n,a[t]=To(r,i),s):o&&(go(e,n,o,s),a[t]=void 0)}}var yo=/(Once|Passive|Capture)$/,bo=/^on:?(?:Once|Passive|Capture)$/;function xo(e){let t,n;for(;(n=e.match(yo))&&!bo.test(e);)t||={},e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===`:`?e.slice(3):de(e.slice(2)),t]}var So=0,Co=Promise.resolve(),wo=()=>So||=(Co.then(()=>So=0),Date.now());function To(e,t){let n=e=>{if(!e._vts)e._vts=Date.now();else if(e._vts<=n.attached)return;let r=n.value;if(b(r)){let n=e.stopImmediatePropagation;e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0};let i=r.slice(),a=[e];for(let n=0;n<i.length&&!e._stopped;n++){let e=i[n];e&&Sn(e,t,5,a)}}else Sn(r,t,5,[e])};return n.value=e,n.attached=wo(),n}var Eo=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Do=(e,t,n,r,i,a)=>{let o=i===`svg`;t===`class`?Za(e,r,o):t===`style`?io(e,n,r):m(t)?h(t)||vo(e,t,n,r,a):(t[0]===`.`?(t=t.slice(1),1):t[0]===`^`?(t=t.slice(1),0):Oo(e,t,r,o))?(mo(e,t,r),!e.tagName.includes(`-`)&&(t===`value`||t===`checked`||t===`selected`)&&po(e,t,r,o,a,t!==`value`)):e._isVueCE&&(ko(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!T(r)))?mo(e,le(t),r,a,t):(t===`true-value`?e._trueValue=r:t===`false-value`&&(e._falseValue=r),po(e,t,r,o))};function Oo(e,t,n,r){if(r)return!!(t===`innerHTML`||t===`textContent`||t in e&&Eo(t)&&w(n));if(t===`spellcheck`||t===`draggable`||t===`translate`||t===`autocorrect`||t===`sandbox`&&e.tagName===`IFRAME`||t===`form`||t===`list`&&e.tagName===`INPUT`||t===`type`&&e.tagName===`TEXTAREA`)return!1;if(t===`width`||t===`height`){let t=e.tagName;if(t===`IMG`||t===`VIDEO`||t===`CANVAS`||t===`SOURCE`)return!1}return Eo(t)&&T(n)?!1:t in e}function ko(e,t){let n=e._def.props;if(!n)return!1;let r=le(t);return Array.isArray(n)?n.some(e=>le(e)===r):Object.keys(n).some(e=>le(e)===r)}var Ao=e=>{let t=e.props[`onUpdate:modelValue`]||!1;return b(t)?e=>he(t,e):t};function jo(e){e.target.composing=!0}function Mo(e){let t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event(`input`)))}var No=Symbol(`_assign`),Po=Symbol(`_initialValue`);function Fo(e,t,n){return t&&(e=e.trim()),n&&(e=_e(e)),e}var Io={created(e,{modifiers:{lazy:t,trim:n,number:r}},i){e.parentNode&&(e.type===`text`?e[Po]=e.defaultValue.replace(/[\r\n]/g,``):e.type===`textarea`&&(e[Po]=e.defaultValue.replace(/\r\n?/g,`
2
- `))),e[No]=Ao(i);let a=r||i.props&&i.props.type===`number`;ho(e,t?`change`:`input`,t=>{t.target.composing||e[No](Fo(e.value,n,a))}),(n||a)&&ho(e,`change`,()=>{e.value=Fo(e.value,n,a)}),t||(ho(e,`compositionstart`,jo),ho(e,`compositionend`,Mo),ho(e,`change`,Mo))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[Po];delete e[Po],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[No](Fo(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[No]=Ao(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?_e(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},Lo=[`ctrl`,`shift`,`alt`,`meta`],Ro={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>Lo.some(n=>e[`${n}Key`]&&!t.includes(n))},zo=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=Ro[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},Bo={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Vo=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=de(n.key);if(t.some(e=>e===r||Bo[e]===r))return e(n)}))},Ho=g({patchProp:Do},Ya),Uo;function Wo(){return Uo||=Ri(Ho)}var Go=((...e)=>{let t=Wo().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=qo(e);if(!r)return;let i=t._component;!w(i)&&!i.render&&!i.template&&(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,Ko(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t});function Ko(e){if(e instanceof SVGElement)return`svg`;if(typeof MathMLElement==`function`&&e instanceof MathMLElement)return`mathml`}function qo(e){return T(e)?document.querySelector(e):e}var Jo={key:0,class:`cepic`},Yo={class:`cid`},Xo=[`title`],Zo=[`title`],Qo={key:0},$o=ur({__name:`ase-task-board-web-client-title`,props:{id:{},epic:{},title:{},edit:{default:``},effort:{default:``}},setup(e){let t={pending:`✎`,active:`✎…`,failed:`✎✗`},n={pending:`edit by prompt requested`,active:`edit by prompt in progress`,failed:`edit by prompt failed (press E to retry)`},r=e=>e.split(/`([^`]+)`/).map((e,t)=>({text:e,code:t%2==1})).filter(e=>e.text!==``);return(i,a)=>(N(),P(M,null,[e.epic!==``&&e.epic!==e.id?(N(),P(`span`,Jo,`♛ `+k(e.epic)+` ▶`,1)):L(``,!0),F(`span`,Yo,k(e.epic===e.id?`♛ `:``)+`≡ `+k(e.id),1),e.edit===``?L(``,!0):(N(),P(`span`,{key:1,class:`cedit`,title:n[e.edit]},k(t[e.edit]),9,Xo)),e.effort===``?L(``,!0):(N(),P(`span`,{key:2,class:`ceffort`,title:`effort: ${e.effort}`},`⚖ `+k(e.effort),9,Zo)),(N(!0),P(M,null,Fr(r(e.title),(e,t)=>(N(),P(M,{key:t},[e.code?(N(),P(`code`,Qo,k(e.text),1)):(N(),P(M,{key:1},[I(k(e.text),1)],64))],64))),128))],64))}}),es={lanes:`task-lanes`,graph:`task-graph`,stats:`statistics`,agents:`agent-logs`,flow:`agent-graph`},ts=e=>e?[`lanes`,`graph`,`stats`,`agents`,`flow`]:[`lanes`,`graph`,`stats`],ns=(e,t)=>{let n=ts(t),r=n.indexOf(e);return`view ${es[n[(r+1)%n.length]]}/${es[n[(r+n.length-1)%n.length]]}`},rs=(e,t,n)=>{let r=[],i=n.collapsed.includes(e.groups[t].title);return e.groups[t].lanes.forEach((e,a)=>{i||n.minimized.includes(e.status)||e.cards.length===0?r.push({g:t,l:a,id:``}):e.cards.forEach(e=>r.push({g:t,l:a,id:e.id}))}),r},is=(e,t,n)=>e.groups.filter(e=>n<e.lanes.length&&!t.collapsed.includes(e.title)).map(e=>e.lanes[n].status),as=(e,t,n)=>{if(t.id!==``)for(let r=0;r<e.groups.length;r++){let i=e.groups[r].lanes.findIndex(e=>e.cards.some(e=>e.id===t.id));if(i>=0)return n.minimized.includes(e.groups[r].lanes[i].status)||n.collapsed.includes(e.groups[r].title)?{g:r,l:i,id:``}:{g:r,l:i,id:t.id}}let r=rs(e,Math.min(t.g,e.groups.length-1),n);return r.find(e=>e.l===t.l)??r[0]},os=new Map,ss=0,cs=A(null),ls=A(Date.now()),us=null;$n(cs,e=>{e!==null&&us===null?us=setInterval(()=>{ls.value=Date.now()},100):e===null&&us!==null&&(clearInterval(us),us=null)});var ds=R(()=>cs.value===null?``:`${(Math.max(0,ls.value-cs.value.since)/1e3).toFixed(1)}s`),fs=(e,t)=>{let n=/\/api\/([a-z]+)/.exec(e)?.[1]??``;if(n===`move`&&typeof t?.body==`string`){let{id:e,status:n}=JSON.parse(t.body);return{text:`moving task`,id:e,suffix:`to ${n}`}}let r={board:`loading tasks`,graph:`loading graph`,flow:`loading agent graph`,stats:`loading statistics`,new:`preparing new task`,toggle:`saving board state`};if(Object.hasOwn(r,n))return{text:r[n]};let i=t?.method??`GET`,a=/\/api\/task\/([^/?]+)\/edit$/.exec(e)?.[1],o=/\/api\/task\/([^/?]+)\/request$/.exec(e)?.[1];if(o!==void 0)return{text:`requesting task`,id:decodeURIComponent(o)};if(a!==void 0)return{text:`loading edit prompt of task`,id:decodeURIComponent(a)};let s=i===`DELETE`?`deleting`:i===`GET`?`loading`:`saving`,c=/\/api\/task\/([^/?]+)/.exec(e)?.[1];return c===void 0?{text:s}:{text:`${s} task`,id:decodeURIComponent(c)}},ps=async(e,t,n=!1)=>{let r=n?0:++ss,i=null;r>0&&(os.set(r,fs(e,t)),i=setTimeout(()=>{cs.value??={label:os.values().next().value??{text:``},since:Date.now()-800}},800));try{return await(await fetch(e,t)).json()}catch(e){return{error:e instanceof Error?e.message:String(e)}}finally{if(r>0){clearTimeout(i),os.delete(r);let e=os.values().next();cs.value!==null&&(cs.value=e.done===!0?null:{...cs.value,label:e.value})}}},z=A(null),ms=A(null),hs=A(null),gs=A(null),B=A(`lanes`),_s=A(``),vs=A(null),ys=A(``),bs=A(null),xs=A(``),V=A(null),Ss=A(null),Cs=A(`total`),H=A(null),U=A({g:0,l:0,id:``}),ws=A(!1),Ts=A(null),Es=A(null),Ds=A(null),Os=A(null),ks=A(null),W=A(null),As=Jt({all:!0,info:``}),js=A(0),Ms=A({}),Ns=Jt({less:!1,more:!1}),Ps=new Map,Fs=A(``),Is=``,Ls=null,Rs=0,zs=0,Bs=0,Vs=0,Hs=0,Us=A(null),Ws=A(null),Gs=A(null),Ks=A(null),qs=A(null),Js=A(null),Ys=A(null),Xs=cn(null),Zs=A(!1),Qs=cn(new Map),$s=e=>{Xs.value=e;let t=new Set(e?.agents.map(e=>e.id)??[]);[...Qs.value.keys()].some(e=>!t.has(e))&&(Qs.value=new Map([...Qs.value].filter(([e])=>t.has(e))))},ec=e=>{let t=new Map(Qs.value);for(let[n,{reset:r,lines:i}]of Object.entries(e))t.set(n,r?i:[...t.get(n)??[],...i].slice(-100));Qs.value=t},tc=R(()=>Xs.value?.agents??[]),nc=A(``),rc=R(()=>tc.value.find(e=>e.id===nc.value)??tc.value[0]??null),ic=A(null),ac=A(!0),oc=e=>{nc.value=e,ac.value=!0},sc=R(()=>z.value?.surface??{view:`lanes`,minimized:[],collapsed:[],titles:!1,keys:!0,standalone:!0}),cc=R(()=>sc.value.titles),lc=R(e=>{let t=new Map;for(let e of Xs.value?.agents??[])for(let n of e.tasks)t.set(n,[...t.get(n)??[],e.name]);return e!==void 0&&JSON.stringify([...e])===JSON.stringify([...t])?e:t}),uc=R(e=>{let t=new Set((Xs.value?.agents??[]).map(e=>e.name));return e!==void 0&&JSON.stringify([...e])===JSON.stringify([...t])?e:t}),dc=(e,t)=>{let n=lc.value.get(e);return n===void 0?t===``?[]:[{icon:uc.value.has(t)?`⚉`:`☺`,name:t}]:n.map(e=>({icon:`⚉`,name:e}))},fc=R(()=>{let e=new Map;for(let t of z.value?.groups??[])for(let n of t.lanes)for(let t of n.cards){let n=dc(t.id,t.assignee);n.length>0&&e.set(t.id,n)}return e}),pc=e=>{let t=Math.max(0,Math.floor(e/1e3));return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`},mc=e=>e.name===e.kind?e.name:`${e.name} (${e.kind})`,hc=A(Date.now()),gc=null;$n(B,e=>{e===`agents`&&gc===null?(hc.value=Date.now(),gc=setInterval(()=>{hc.value=Date.now()},1e3)):e!==`agents`&&gc!==null&&(clearInterval(gc),gc=null)},{immediate:!0});var _c=1e3,vc=cn(new Map),yc=null;$n(Xs,e=>{let t=Date.now(),n=new Map,r=!1;for(let i of e?.agents??[]){let e=vc.value.get(i.id);e!==void 0&&e.beat===i.beat?n.set(i.id,e):(n.set(i.id,{beat:i.beat,seen:t}),r=!0)}vc.value=n,r&&(hc.value=t,yc!==null&&clearTimeout(yc),yc=setTimeout(()=>{yc=null,hc.value=Date.now()},_c))});var bc=e=>hc.value-(vc.value.get(e)?.seen??0)<_c;$n(()=>[Zs.value,Xs.value,B.value],()=>{Zs.value&&Xs.value===null&&(B.value===`agents`||B.value===`flow`)&&Xc(`lanes`)});var xc=e=>(Xs.value?.agents??[]).filter(t=>`agent:${t.kind}:${t.mode??``}`===e).sort((e,t)=>(e.started??e.since)-(t.started??t.since)),Sc=e=>{let t=xc(e)[0];t!==void 0&&(oc(t.id),Xc(`agents`))},Cc=R(()=>{let e=z.value?.groups[U.value.g];return e!==void 0&&!sc.value.collapsed.includes(e.title)&&!sc.value.minimized.includes(e.lanes[U.value.l]?.status??``)}),wc=R(()=>ws.value&&Cc.value&&B.value===`lanes`);$n(Cc,e=>{e||(ws.value=!1)});var Tc=()=>{let e=Us.value;if(e===null)return;let t=[...e.querySelectorAll(`.group`)],n=t.map((e,t)=>({g:e,i:t})).filter(({g:t})=>t.offsetLeft+t.offsetWidth>e.scrollLeft+1&&t.offsetLeft<e.scrollLeft+e.clientWidth-1);As.all=n.length===t.length,As.info=n.length===0?``:`groups ${n[0].i+1}–${n[n.length-1].i+1} of ${t.length}`},Ec=e=>Us.value?.scrollBy({left:e,behavior:`smooth`});$n([z,B],()=>Mn(Tc),{deep:!0});var Dc=async(e=!1)=>{let t=++Bs,n=await ps(`/task-board/api/graph?filter=${encodeURIComponent(Is)}`,void 0,e);t===Bs&&(_s.value=n.error===void 0?n.svg===``?`<p class="mute">(no tasks)</p>`:n.svg:`<p class="warn">${n.error.replace(/[&<>]/g,e=>`&#${e.charCodeAt(0)};`)}</p>`,vs.value=n.error===void 0?n.stats:null)},Oc=(e,t)=>{let n=[...e?.querySelectorAll(`path.edge`)??[]];for(let e of n)e.classList.toggle(`sel`,t!==``&&(e.dataset.from===t||e.dataset.to===t));let r=n.filter(e=>e.classList.contains(`sel`)),i=n.findLast(e=>!e.classList.contains(`sel`));i!==void 0&&r.length>0&&i.after(...r)},kc=async(e=!1)=>{let t=++Vs,n=await ps(`/task-board/api/flow`,void 0,e);t===Vs&&(ys.value=n.error===void 0?n.svg===``?`<p class="mute">(no agents running)</p>`:n.svg:`<p class="warn">${n.error.replace(/[&<>]/g,e=>`&#${e.charCodeAt(0)};`)}</p>`,bs.value=n.error===void 0?n.stats:null)},Ac=async(e=!1)=>{let t=++Hs,n=await ps(`/task-board/api/stats?filter=${encodeURIComponent(Is)}&range=${Cs.value}`,void 0,e);t===Hs&&(Ss.value=n.error===void 0?null:n.error,n.error===void 0&&(V.value=n))},jc=[{range:`total`,label:`total`},{range:`30d`,label:`within last 30 days`},{range:`7d`,label:`within last 7 days`}],Mc=e=>{e!==Cs.value&&(Cs.value=e,Ac(!0))},Nc=e=>{let t=jc.findIndex(e=>e.range===Cs.value)+e;t>=0&&t<jc.length&&Mc(jc[t].range)},Pc=()=>{let e=Ks.value?.contentWindow??null;H.value!==null&&e!==null&&Ps.set(js.value,e.scrollY)},Fc=async(e,t=!1)=>{if(Ts.value!==null&&Ts.value.id!==e)return;let n=++Rs;Ls===e?Pc():(js.value=0,Ps.clear()),Ls=e;let r=await ps(`/task-board/api/task/${encodeURIComponent(e)}`,void 0,t);if(n!==Rs)return;if(r.error!==void 0){Ts.value===null?zc():Es.value={kind:`error`,message:r.error};return}let i=Math.min(js.value,r.tabs.length-1),a=i>0?await Bc(e,i,t):``;n===Rs&&(Ms.value=i>0?{[i]:a}:{},H.value=r,js.value=i,Mn(Uc))},Ic=e=>{Ls=e},Lc=[],Rc=e=>{Lc.push(e)},zc=()=>{for(let e of Lc)e();Rs++,Ls=null,H.value=null},Bc=async(e,t,n=!1)=>{let r=await ps(`/task-board/api/task/${encodeURIComponent(e)}/attachment/${t-1}/doc`,void 0,n);return r.error===void 0?r.doc:`<p class="warn">${r.error.replace(/[&<>]/g,e=>`&#${e.charCodeAt(0)};`)}</p>`},Vc=async e=>{if(e===0||H.value===null||Ms.value[e]!==void 0)return;let t=H.value.id,n=await Bc(t,e);H.value?.id===t&&(Ms.value[e]=n)},Hc=async e=>{H.value===null||Ts.value!==null||e<0||e>=H.value.tabs.length||e===js.value||(Pc(),js.value=e,Mn(()=>qs.value?.children[e]?.scrollIntoView({block:`nearest`,inline:`nearest`})),await Vc(e))},Uc=()=>{let e=qs.value;e!==null&&(Ns.less=e.scrollLeft>1,Ns.more=e.scrollLeft+e.clientWidth<e.scrollWidth-1)},Wc=async(e=!1)=>{let t=++zs,n=await ps(`/task-board/api/board?filter=${encodeURIComponent(Is)}`,void 0,e);t===zs&&(n.error===void 0?(ms.value=null,z.value===null&&(B.value=n.surface.view),z.value=n,B.value===`graph`?await Dc(e):B.value===`flow`?await kc(e):B.value===`stats`&&await Ac(e||V.value!==null),Ls!==null&&await Fc(Ls,e)):ms.value=n.error)},Gc=null;$n(Fs,e=>{Gc!==null&&clearTimeout(Gc),Gc=setTimeout(()=>{Gc=null,Is=e,Wc()},e===``?0:250)});var Kc=()=>{Fs.value=``,Js.value?.blur()},qc=e=>{if(z.value===null)return;let t=z.value.surface.titles!==e.titles||z.value.surface.standalone!==e.standalone;z.value.surface=e,t&&B.value===`graph`&&Dc()},Jc=async(e,t)=>{let n=await ps(`/task-board/api/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({list:e,entry:t})});n.error===void 0?(hs.value=null,qc(n)):hs.value=n.error},Yc=(e=!1)=>{let t=ts(Xs.value!==null);Xc(t[(t.indexOf(B.value)+(e?t.length-1:1))%t.length])},Xc=e=>{B.value=e,e!==`lanes`&&(Ys.value=null),e===`graph`?Dc():e===`flow`?kc():e===`stats`&&Ac(V.value!==null),ps(`/task-board/api/view`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({view:e})}).then(e=>{e.error!==void 0&&(hs.value=e.error)})},Zc=null,Qc=null,$c=null,el=A(!1),tl=A(null),nl=()=>{Zc=new EventSource(`/task-board/events`),Zc.addEventListener(`open`,()=>{el.value=!0,Qs.value=new Map,z.value!==null&&Wc(!0)}),Zc.addEventListener(`error`,()=>{el.value=!1,Zc?.readyState===EventSource.CLOSED&&(Zc.close(),$c=setTimeout(nl,5e3))}),Zc.addEventListener(`change`,()=>Wc(!0)),Zc.addEventListener(`surface`,e=>qc(JSON.parse(e.data))),Zc.addEventListener(`store`,e=>{tl.value=JSON.parse(e.data)}),Zc.addEventListener(`agents`,e=>{$s(JSON.parse(e.data)),Zs.value=!0,B.value===`flow`&&kc(!0)}),Zc.addEventListener(`logs`,e=>ec(JSON.parse(e.data)))},rl=()=>{nl(),Qc=setInterval(async()=>{el.value=(await ps(`/task-board/api/ping`,void 0,!0)).error===void 0&&Zc?.readyState===EventSource.OPEN},15e3)},il=()=>{Zc?.close(),$c!==null&&clearTimeout($c),Qc!==null&&clearInterval(Qc),Gc!==null&&clearTimeout(Gc),us!==null&&clearInterval(us),gc!==null&&clearInterval(gc),yc!==null&&clearTimeout(yc)},al=c(o(((e,t)=>{(function(e,n,r){if(!e)return;for(var i={8:`backspace`,9:`tab`,13:`enter`,16:`shift`,17:`ctrl`,18:`alt`,20:`capslock`,27:`esc`,32:`space`,33:`pageup`,34:`pagedown`,35:`end`,36:`home`,37:`left`,38:`up`,39:`right`,40:`down`,45:`ins`,46:`del`,91:`meta`,93:`meta`,224:`meta`},a={106:`*`,107:`+`,109:`-`,110:`.`,111:`/`,186:`;`,187:`=`,188:`,`,189:`-`,190:`.`,191:`/`,192:"`",219:`[`,220:`\\`,221:`]`,222:`'`},o={"~":"`","!":`1`,"@":`2`,"#":`3`,$:`4`,"%":`5`,"^":`6`,"&":`7`,"*":`8`,"(":`9`,")":`0`,_:`-`,"+":`=`,":":`;`,'"':`'`,"<":`,`,">":`.`,"?":`/`,"|":`\\`},s={option:`alt`,command:`meta`,return:`enter`,escape:`esc`,plus:`+`,mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?`meta`:`ctrl`},c,l=1;l<20;++l)i[111+l]=`f`+l;for(l=0;l<=9;++l)i[l+96]=l.toString();function u(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent(`on`+t,n)}function d(e){if(e.type==`keypress`){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return i[e.which]?i[e.which]:a[e.which]?a[e.which]:String.fromCharCode(e.which).toLowerCase()}function f(e,t){return e.sort().join(`,`)===t.sort().join(`,`)}function p(e){var t=[];return e.shiftKey&&t.push(`shift`),e.altKey&&t.push(`alt`),e.ctrlKey&&t.push(`ctrl`),e.metaKey&&t.push(`meta`),t}function m(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function h(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function g(e){return e==`shift`||e==`ctrl`||e==`alt`||e==`meta`}function _(){if(!c)for(var e in c={},i)e>95&&e<112||i.hasOwnProperty(e)&&(c[i[e]]=e);return c}function v(e,t,n){return n||=_()[e]?`keydown`:`keypress`,n==`keypress`&&t.length&&(n=`keydown`),n}function y(e){return e===`+`?[`+`]:(e=e.replace(/\+{2}/g,`+plus`),e.split(`+`))}function b(e,t){var n,r,i,a=[];for(n=y(e),i=0;i<n.length;++i)r=n[i],s[r]&&(r=s[r]),t&&t!=`keypress`&&o[r]&&(r=o[r],a.push(`shift`)),g(r)&&a.push(r);return t=v(r,a,t),{key:r,modifiers:a,action:t}}function x(e,t){return e===null||e===n?!1:e===t||x(e.parentNode,t)}function S(e){var t=this;if(e||=n,!(t instanceof S))return new S(e);t.target=e,t._callbacks={},t._directMap={};var r={},i,a=!1,o=!1,s=!1;function c(e){e||={};var t=!1,n;for(n in r)e[n]?t=!0:r[n]=0;t||(s=!1)}function l(e,n,i,a,o,s){var c,l,u=[],d=i.type;if(!t._callbacks[e])return[];for(d==`keyup`&&g(e)&&(n=[e]),c=0;c<t._callbacks[e].length;++c)if(l=t._callbacks[e][c],(a||!l.seq||r[l.seq]==l.level)&&d==l.action&&(d==`keypress`&&!i.metaKey&&!i.ctrlKey||f(n,l.modifiers))){var p=!a&&l.combo==o,m=a&&l.seq==a&&l.level==s;(p||m)&&t._callbacks[e].splice(c,1),u.push(l)}return u}function _(e,n,r,i){t.stopCallback(n,n.target||n.srcElement,r,i)||e(n,r)===!1&&(m(n),h(n))}t._handleKey=function(e,t,n){var r=l(e,t,n),i,a={},u=0,d=!1;for(i=0;i<r.length;++i)r[i].seq&&(u=Math.max(u,r[i].level));for(i=0;i<r.length;++i)if(r[i].seq){if(r[i].level!=u)continue;d=!0,a[r[i].seq]=1,_(r[i].callback,n,r[i].combo,r[i].seq)}else d||_(r[i].callback,n,r[i].combo);var f=n.type==`keypress`&&o;n.type==s&&!g(e)&&!f&&c(a),o=d&&n.type==`keydown`};function v(e){typeof e.which!=`number`&&(e.which=e.keyCode);var n=d(e);n&&(e.type==`keyup`&&a===n?a=!1:t.handleKey(n,p(e),e))}function y(){clearTimeout(i),i=setTimeout(c,1e3)}function x(e,t,n,i){r[e]=0;function o(t){return function(){s=t,++r[e],y()}}function l(t){_(n,t,e),i!==`keyup`&&(a=d(t)),setTimeout(c,10)}for(var u=0;u<t.length;++u){var f=u+1===t.length?l:o(i||b(t[u+1]).action);C(t[u],f,i,e,u)}}function C(e,n,r,i,a){t._directMap[e+`:`+r]=n,e=e.replace(/\s+/g,` `);var o=e.split(` `),s;o.length>1?x(e,o,n,r):(s=b(e,r),t._callbacks[s.key]=t._callbacks[s.key]||[],l(s.key,s.modifiers,{type:s.action},i,e,a),t._callbacks[s.key][i?`unshift`:`push`]({callback:n,modifiers:s.modifiers,action:s.action,seq:i,level:a,combo:e}))}t._bindMultiple=function(e,t,n){for(var r=0;r<e.length;++r)C(e[r],t,n)},u(e,`keypress`,v),u(e,`keydown`,v),u(e,`keyup`,v)}S.prototype.bind=function(e,t,n){var r=this;return e=e instanceof Array?e:[e],r._bindMultiple.call(r,e,t,n),r},S.prototype.unbind=function(e,t){var n=this;return n.bind.call(n,e,function(){},t)},S.prototype.trigger=function(e,t){var n=this;return n._directMap[e+`:`+t]&&n._directMap[e+`:`+t]({},e),n},S.prototype.reset=function(){var e=this;return e._callbacks={},e._directMap={},e},S.prototype.stopCallback=function(e,t){var n=this;if((` `+t.className+` `).indexOf(` mousetrap `)>-1||x(t,n.target))return!1;if(`composedPath`in e&&typeof e.composedPath==`function`){var r=e.composedPath()[0];r!==e.target&&(t=r)}return t.tagName==`INPUT`||t.tagName==`SELECT`||t.tagName==`TEXTAREA`||t.isContentEditable},S.prototype.handleKey=function(){var e=this;return e._handleKey.apply(e,arguments)},S.addKeycodes=function(e){for(var t in e)e.hasOwnProperty(t)&&(i[t]=e[t]);c=null},S.init=function(){var e=S(n);for(var t in e)t.charAt(0)!==`_`&&(S[t]=function(t){return function(){return e[t].apply(e,arguments)}}(t))},S.init(),e.Mousetrap=S,t!==void 0&&t.exports&&(t.exports=S),typeof define==`function`&&define.amd&&define(function(){return S})})(typeof window<`u`?window:null,typeof window<`u`?document:null)}))(),1),ol=[],sl=[];(()=>{let e=`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 t=0,n=0;t<e.length;t++)(t%2?sl:ol).push(n+=e[t])})();function cl(e){if(e<768)return!1;for(let t=0,n=ol.length;;){let r=t+n>>1;if(e<ol[r])n=r;else if(e>=sl[r])t=r+1;else return!0;if(t==n)return!1}}function ll(e){return e>=127462&&e<=127487}var ul=8205;function dl(e,t,n=!0,r=!0){return(n?fl:pl)(e,t,r)}function fl(e,t,n){if(t==e.length)return t;t&&hl(e.charCodeAt(t))&&gl(e.charCodeAt(t-1))&&t--;let r=ml(e,t);for(t+=_l(r);t<e.length;){let i=ml(e,t);if(r==ul||i==ul||n&&cl(i))t+=_l(i),r=i;else if(ll(i)){let n=0,r=t-2;for(;r>=0&&ll(ml(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function pl(e,t,n){for(;t>1;){let r=fl(e,t-2,n);if(r<t)return r;t--}return 0}function ml(e,t){let n=e.charCodeAt(t);if(!gl(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return hl(r)?(n-55296<<10)+(r-56320)+65536:n}function hl(e){return e>=56320&&e<57344}function gl(e){return e>=55296&&e<56320}function _l(e){return e<65536?1:2}var vl=class e{lineAt(e){if(e<0||e>this.length)throw 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 RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Ol(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),bl.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Ol(this,e,t);let n=[];return this.decompose(e,t,n,0),bl.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new wl(this),i=new wl(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new wl(this,e)}iterRange(e,t=this.length){return new Tl(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new El(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new yl(t):bl.from(yl.split(t,[]))}},yl=class e extends vl{constructor(e,t=xl(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new Dl(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(Cl(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=Sl(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=Ol(this,t,n);let i=Sl(this.text,Sl(r.text,Cl(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):bl.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t,t.exports),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,o)=>(o=n==null?{}:e(i(n)),s(r||!n||!n.__esModule||!a.call(n,`default`)?t(o,`default`,{value:n,enumerable:!0}):o,n));(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();function l(e){let t=Object.create(null);for(let n of e.split(`,`))t[n]=1;return e=>e in t}var u={},d=[],f=()=>{},p=()=>!1,m=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&(e.charCodeAt(2)>122||e.charCodeAt(2)<97),h=e=>e.startsWith(`onUpdate:`),g=Object.assign,_=(e,t)=>{let n=e.indexOf(t);n>-1&&e.splice(n,1)},v=Object.prototype.hasOwnProperty,y=(e,t)=>v.call(e,t),b=Array.isArray,x=e=>re(e)===`[object Map]`,S=e=>re(e)===`[object Set]`,C=e=>re(e)===`[object Date]`,w=e=>typeof e==`function`,T=e=>typeof e==`string`,ee=e=>typeof e==`symbol`,E=e=>typeof e==`object`&&!!e,te=e=>(E(e)||w(e))&&w(e.then)&&w(e.catch),ne=Object.prototype.toString,re=e=>ne.call(e),ie=e=>re(e).slice(8,-1),ae=e=>re(e)===`[object Object]`,oe=e=>T(e)&&e!==`NaN`&&e[0]!==`-`&&``+parseInt(e,10)===e,D=l(`,key,ref,ref_for,ref_key,onVnodeBeforeMount,onVnodeMounted,onVnodeBeforeUpdate,onVnodeUpdated,onVnodeBeforeUnmount,onVnodeUnmounted`),se=e=>{let t=Object.create(null);return(n=>t[n]||(t[n]=e(n)))},ce=/-\w/g,le=se(e=>e.replace(ce,e=>e.slice(1).toUpperCase())),ue=/\B([A-Z])/g,de=se(e=>e.replace(ue,`-$1`).toLowerCase()),fe=se(e=>e.charAt(0).toUpperCase()+e.slice(1)),pe=se(e=>e?`on${fe(e)}`:``),me=(e,t)=>!Object.is(e,t),he=(e,...t)=>{for(let n=0;n<e.length;n++)e[n](...t)},ge=(e,t,n,r=!1)=>{Object.defineProperty(e,t,{configurable:!0,enumerable:!1,writable:r,value:n})},_e=e=>{let t=parseFloat(e);return isNaN(t)?e:t},ve,ye=()=>ve||=typeof globalThis<`u`?globalThis:typeof self<`u`?self:typeof window<`u`?window:typeof global<`u`?global:{};function be(e){if(b(e)){let t={};for(let n=0;n<e.length;n++){let r=e[n],i=T(r)?we(r):be(r);if(i)for(let e in i)t[e]=i[e]}return t}if(T(e)||E(e))return e}var xe=/;(?![^(]*\))/g,Se=/:([^]+)/,Ce=/"(?:[^"\\]|\\[^])*"|'(?:[^'\\]|\\[^])*'|\\[^]|\/\*[^]*?\*\//g;function we(e){let t={};return e.replace(Ce,e=>e.startsWith(`/*`)?``:e).split(xe).forEach(e=>{if(e){let n=e.split(Se);n.length>1&&(t[n[0].trim()]=n[1].trim())}}),t}function O(e){let t=``;if(T(e))t=e;else if(b(e))for(let n=0;n<e.length;n++){let r=O(e[n]);r&&(t+=r+` `)}else if(E(e))for(let n in e)e[n]&&(t+=n+` `);return t.trim()}var Te=l(`itemscope,allowfullscreen,formnovalidate,ismap,nomodule,novalidate,playsinline,readonly`);function Ee(e){return!!e||e===``}function De(e,t,n){if(e.length!==t.length)return!1;let r=!0;for(let i=0;r&&i<e.length;i++)r=je(e[i],t[i],n);return r}function Oe(e,t,n){if(e.size!==t.size)return!1;let r=Array.from(t),i=new Uint8Array(r.length);for(let t of e){let e=-1;for(let a=0;a<r.length;a++)if(!i[a]&&je(t,r[a],n)){e=a;break}if(e<0)return!1;i[e]=1}return!0}function ke(e,t,n){let r=x(e),i=x(t);if(r||i||(r=S(e),i=S(t),r||i))return r&&i?Oe(e,t,n):!1;if(Object.keys(e).length!==Object.keys(t).length)return!1;for(let r in e){let i=e.hasOwnProperty(r),a=t.hasOwnProperty(r);if(i&&!a||!i&&a||!je(e[r],t[r],n))return!1}return String(e)===String(t)}function Ae(e,t,n,r){n||=[new Map,new Map];let[i,a]=n;if(i.has(e)||a.has(t))return i.get(e)===t&&a.get(t)===e;i.set(e,t),a.set(t,e);let o=r(e,t,n);return i.delete(e),a.delete(t),o}function je(e,t,n){if(e===t)return!0;let r=C(e),i=C(t);return r||i?r&&i?e.getTime()===t.getTime():!1:(r=ee(e),i=ee(t),r||i?e===t:(r=b(e),i=b(t),r||i?r&&i?Ae(e,t,n,De):!1:(r=E(e),i=E(t),r||i?!r||!i?!1:Ae(e,t,n,ke):String(e)===String(t))))}var Me=e=>!!(e&&e.__v_isRef===!0),k=e=>T(e)?e:e==null?``:b(e)||E(e)&&(e.toString===ne||!w(e.toString))?Me(e)?k(e.value):JSON.stringify(e,Ne,2):String(e),Ne=(e,t)=>Me(t)?Ne(e,t.value):x(t)?{[`Map(${t.size})`]:[...t.entries()].reduce((e,[t,n],r)=>(e[Pe(t,r)+` =>`]=n,e),{})}:S(t)?{[`Set(${t.size})`]:[...t.values()].map(e=>Pe(e))}:ee(t)?Pe(t):E(t)&&!b(t)&&!ae(t)?String(t):t,Pe=(e,t=``)=>ee(e)?`Symbol(${e.description??t})`:e,Fe,Ie=class{constructor(e=!1){this.detached=e,this._active=!0,this._on=0,this.effects=[],this.cleanups=[],this._isPaused=!1,this._warnOnRun=!0,this.__v_skip=!0,!e&&Fe&&(Fe.active?(this.parent=Fe,this.index=(Fe.scopes||(Fe.scopes=[])).push(this)-1):(this._active=!1,this._warnOnRun=!1))}get active(){return this._active}pause(){if(this._active){this._isPaused=!0;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].pause()}for(e=0,t=this.effects.length;e<t;e++)this.effects[e].pause()}}resume(){if(this._active&&this._isPaused){this._isPaused=!1;let e,t;if(this.scopes){let n=this.scopes.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}let n=this.effects.slice();for(e=0,t=n.length;e<t;e++)n[e].resume()}}run(e){if(this._active){let t=Fe;try{return Fe=this,e()}finally{Fe=t}}}on(){++this._on===1&&(this.prevScope=Fe,Fe=this)}off(){if(this._on>0&&--this._on===0){if(Fe===this)Fe=this.prevScope;else{let e=Fe;for(;e;){if(e.prevScope===this){e.prevScope=this.prevScope;break}e=e.prevScope}}this.prevScope=void 0}}stop(e){if(this._active){this._active=!1;let t,n;for(t=0,n=this.effects.length;t<n;t++)this.effects[t].stop();for(this.effects.length=0,t=0,n=this.cleanups.length;t<n;t++)this.cleanups[t]();if(this.cleanups.length=0,this.scopes){let e=this.scopes.slice();for(t=0,n=e.length;t<n;t++)e[t].stop(!0);this.scopes.length=0}if(!this.detached&&this.parent&&!e){let e=this.parent.scopes.pop();e&&e!==this&&(this.parent.scopes[this.index]=e,e.index=this.index)}this.parent=void 0}}};function Le(){return Fe}var Re,ze=new WeakSet,Be=class{constructor(e){this.fn=e,this.deps=void 0,this.depsTail=void 0,this.flags=5,this.next=void 0,this.cleanup=void 0,this.scheduler=void 0,Fe&&(Fe.active?Fe.effects.push(this):this.flags&=-2)}pause(){this.flags|=64}resume(){this.flags&64&&(this.flags&=-65,ze.has(this)&&(ze.delete(this),this.trigger()))}notify(){this.flags&2&&!(this.flags&32)||this.flags&8||We(this)}run(){if(!(this.flags&1))return this.fn();this.flags|=2,rt(this),qe(this);let e=Re,t=$e;Re=this,$e=!0;try{return this.fn()}finally{Je(this),Re=e,$e=t,this.flags&=-3}}stop(){if(this.flags&1){for(let e=this.deps;e;e=e.nextDep)Ze(e);this.deps=this.depsTail=void 0,rt(this),this.onStop&&this.onStop(),this.flags&=-2}}trigger(){this.flags&64?ze.add(this):this.scheduler?this.scheduler():this.runIfDirty()}runIfDirty(){Ye(this)&&this.run()}get dirty(){return Ye(this)}},Ve=0,He,Ue;function We(e,t=!1){e.flags|=8,t?(e.next=Ue,Ue=e):(e.next=He,He=e)}function Ge(){Ve++}function Ke(){if(--Ve>0)return;if(Ue){let e=Ue;for(Ue=void 0;e;){let t=e.next;e.next=void 0,e.flags&=-9,e=t}}let e;for(;He;){let t=He;for(He=void 0;t;){let n=t.next;if(t.next=void 0,t.flags&=-9,t.flags&1)try{t.trigger()}catch(t){e||=t}t=n}}if(e)throw e}function qe(e){for(let t=e.deps;t;t=t.nextDep)t.version=-1,t.prevActiveLink=t.dep.activeLink,t.dep.activeLink=t}function Je(e){let t,n=e.depsTail,r=n;for(;r;){let e=r.prevDep;r.version===-1?(r===n&&(n=e),Ze(r),Qe(r)):t=r,r.dep.activeLink=r.prevActiveLink,r.prevActiveLink=void 0,r=e}e.deps=t,e.depsTail=n}function Ye(e){for(let t=e.deps;t;t=t.nextDep)if(t.dep.version!==t.version||t.dep.computed&&(Xe(t.dep.computed)||t.dep.version!==t.version))return!0;return!!e._dirty}function Xe(e){if(e.flags&4&&!(e.flags&16)||(e.flags&=-17,e.globalVersion===it)||(e.globalVersion=it,!e.isSSR&&e.flags&128&&(!e.deps&&!e._dirty||!Ye(e))))return;e.flags|=2;let t=e.dep,n=Re,r=$e;Re=e,$e=!0;try{qe(e);let n=e.fn(e._value);(t.version===0||me(n,e._value))&&(e.flags|=128,e._value=n,t.version++)}catch(e){throw t.version++,e}finally{Re=n,$e=r,Je(e),e.flags&=-3}}function Ze(e,t=!1){let{dep:n,prevSub:r,nextSub:i}=e;if(r&&(r.nextSub=i,e.prevSub=void 0),i&&(i.prevSub=r,e.nextSub=void 0),n.subs===e&&(n.subs=r,!r&&n.computed)){n.computed.flags&=-5;for(let e=n.computed.deps;e;e=e.nextDep)Ze(e,!0)}!t&&!--n.sc&&n.map&&n.map.delete(n.key)}function Qe(e){let{prevDep:t,nextDep:n}=e;t&&(t.nextDep=n,e.prevDep=void 0),n&&(n.prevDep=t,e.nextDep=void 0)}var $e=!0,et=[];function tt(){et.push($e),$e=!1}function nt(){let e=et.pop();$e=e===void 0||e}function rt(e){let{cleanup:t}=e;if(e.cleanup=void 0,t){let e=Re;Re=void 0;try{t()}finally{Re=e}}}var it=0,at=class{constructor(e,t){this.sub=e,this.dep=t,this.version=t.version,this.nextDep=this.prevDep=this.nextSub=this.prevSub=this.prevActiveLink=void 0}},ot=class{constructor(e){this.computed=e,this.version=0,this.activeLink=void 0,this.subs=void 0,this.map=void 0,this.key=void 0,this.sc=0,this.__v_skip=!0}track(e){if(!Re||!$e||Re===this.computed)return;let t=this.activeLink;if(t===void 0||t.sub!==Re)t=this.activeLink=new at(Re,this),Re.deps?(t.prevDep=Re.depsTail,Re.depsTail.nextDep=t,Re.depsTail=t):Re.deps=Re.depsTail=t,st(t);else if(t.version===-1&&(t.version=this.version,t.nextDep)){let e=t.nextDep;e.prevDep=t.prevDep,t.prevDep&&(t.prevDep.nextDep=e),t.prevDep=Re.depsTail,t.nextDep=void 0,Re.depsTail.nextDep=t,Re.depsTail=t,Re.deps===t&&(Re.deps=e)}return t}trigger(e){this.version++,it++,this.notify(e)}notify(e){Ge();try{for(let e=this.subs;e;e=e.prevSub)e.sub.notify()&&e.sub.dep.notify()}finally{Ke()}}};function st(e){if(e.dep.sc++,e.sub.flags&4){let t=e.dep.computed;if(t&&!e.dep.subs){t.flags|=20;for(let e=t.deps;e;e=e.nextDep)st(e)}let n=e.dep.subs;n!==e&&(e.prevSub=n,n&&(n.nextSub=e)),e.dep.subs=e}}var ct=new WeakMap,lt=Symbol(``),ut=Symbol(``),dt=Symbol(``);function ft(e,t,n){if($e&&Re){let t=ct.get(e);t||ct.set(e,t=new Map);let r=t.get(n);r||(t.set(n,r=new ot),r.map=t,r.key=n),r.track()}}function pt(e,t,n,r,i,a){let o=ct.get(e);if(!o){it++;return}let s=e=>{e&&e.trigger()};if(Ge(),t===`clear`)o.forEach(s);else{let i=b(e),a=i&&oe(n);if(i&&n===`length`){let e=Number(r);o.forEach((t,n)=>{(n===`length`||n===dt||!ee(n)&&n>=e)&&s(t)})}else switch((n!==void 0||o.has(void 0))&&s(o.get(n)),a&&s(o.get(dt)),t){case`add`:i?a&&s(o.get(`length`)):(s(o.get(lt)),x(e)&&s(o.get(ut)));break;case`delete`:i||(s(o.get(lt)),x(e)&&s(o.get(ut)));break;case`set`:x(e)&&s(o.get(lt))}}Ke()}function mt(e){let t=nn(e);return t===e||(ft(t,`iterate`,dt),en(e))?t:$t(e)?Qt(e)?t.map(e=>on(an(e))):t.map(on):t.map(an)}function ht(e){return ft(e=nn(e),`iterate`,dt),e}function gt(e,t){return $t(e)?on(Qt(e)?an(t):t):an(t)}var _t={__proto__:null,[Symbol.iterator](){return vt(this,Symbol.iterator,e=>gt(this,e))},concat(...e){return mt(this).concat(...e.map(e=>b(e)?mt(e):e))},entries(){return vt(this,`entries`,e=>(e[1]=gt(this,e[1]),e))},every(e,t){return xt(this,`every`,e,t,void 0,arguments)},filter(e,t){return xt(this,`filter`,e,t,e=>e.map(e=>gt(this,e)),arguments)},find(e,t){return xt(this,`find`,e,t,e=>gt(this,e),arguments)},findIndex(e,t){return xt(this,`findIndex`,e,t,void 0,arguments)},findLast(e,t){return xt(this,`findLast`,e,t,e=>gt(this,e),arguments)},findLastIndex(e,t){return xt(this,`findLastIndex`,e,t,void 0,arguments)},forEach(e,t){return xt(this,`forEach`,e,t,void 0,arguments)},includes(...e){return Ct(this,`includes`,e)},indexOf(...e){return Ct(this,`indexOf`,e)},join(e){return mt(this).join(e)},lastIndexOf(...e){return Ct(this,`lastIndexOf`,e)},map(e,t){return xt(this,`map`,e,t,void 0,arguments)},pop(){return wt(this,`pop`)},push(...e){return wt(this,`push`,e)},reduce(e,...t){return St(this,`reduce`,e,t)},reduceRight(e,...t){return St(this,`reduceRight`,e,t)},shift(){return wt(this,`shift`)},some(e,t){return xt(this,`some`,e,t,void 0,arguments)},splice(...e){return wt(this,`splice`,e)},toReversed(){return mt(this).toReversed()},toSorted(e){return mt(this).toSorted(e)},toSpliced(...e){return mt(this).toSpliced(...e)},unshift(...e){return wt(this,`unshift`,e)},values(){return vt(this,`values`,e=>gt(this,e))}};function vt(e,t,n){let r=ht(e),i=r[t],a=i.call(r);if(r!==e&&!en(e)){if(a[Symbol.toStringTag]===`Array Iterator`){let e=Object.create(Object.getPrototypeOf(a));return e.next=()=>yt(a.next(),n),i!==bt[t]&&Object.defineProperties(e,{return:{get(){let e=a.return;return typeof e==`function`?e.bind(a):e}},throw:{get(){let e=a.throw;return typeof e==`function`?e.bind(a):e}}}),e}a._next=a.next,a.next=()=>yt(a._next(),n)}return a}function yt(e,t){return e.done||(e.value=t(e.value)),e}var bt=Array.prototype;function xt(e,t,n,r,i,a){let o=ht(e),s=o!==e&&!en(e),c=o[t];if(c!==bt[t]){let t=c.apply(e,a);return s?an(t):t}let l=n;o!==e&&(s?l=function(t,r){return n.call(this,gt(e,t),r,e)}:n.length>2&&(l=function(t,r){return n.call(this,t,r,e)}));let u=c.call(o,l,r);return s&&i?i(u):u}function St(e,t,n,r){let i=ht(e),a=i!==e&&!en(e),o=n,s=!1;i!==e&&(a?(s=r.length===0,o=function(t,r,i){return s&&(s=!1,t=gt(e,t)),n.call(this,t,gt(e,r),i,e)}):n.length>3&&(o=function(t,r,i){return n.call(this,t,r,i,e)}));let c=i[t](o,...r);return s?gt(e,c):c}function Ct(e,t,n){let r=nn(e);ft(r,`iterate`,dt);let i=r[t](...n);return(i===-1||i===!1)&&tn(n[0])?(n[0]=nn(n[0]),r[t](...n)):i}function wt(e,t,n=[]){tt(),Ge();let r=nn(e)[t].apply(e,n);return Ke(),nt(),r}var Tt=l(`__proto__,__v_isRef,__isVue`),Et=new Set(Object.getOwnPropertyNames(Symbol).filter(e=>e!==`arguments`&&e!==`caller`).map(e=>Symbol[e]).filter(ee));function Dt(e){ee(e)||(e=String(e));let t=nn(this);return ft(t,`has`,e),t.hasOwnProperty(e)}var Ot=class{constructor(e=!1,t=!1){this._isReadonly=e,this._isShallow=t}get(e,t,n){if(t===`__v_skip`)return e.__v_skip;let r=this._isReadonly,i=this._isShallow;if(t===`__v_isReactive`)return!r;if(t===`__v_isReadonly`)return r;if(t===`__v_isShallow`)return i;if(t===`__v_raw`)return n===(r?i?Kt:Gt:i?Wt:Ut).get(e)||Object.getPrototypeOf(e)===Object.getPrototypeOf(n)?e:void 0;let a=b(e);if(!r){let e;if(a&&(e=_t[t]))return e;if(t===`hasOwnProperty`)return Dt}let o=Reflect.get(e,t,sn(e)?e:n);if((ee(t)?Et.has(t):Tt(t))||(r||ft(e,`get`,t),i))return o;if(sn(o)){let e=a&&oe(t)?o:o.value;return r&&E(e)?Xt(e):e}return E(o)?r?Xt(o):Jt(o):o}},kt=class extends Ot{constructor(e=!1){super(!1,e)}set(e,t,n,r){let i=e[t],a=b(e)&&oe(t);if(!this._isShallow){let e=$t(i);if(!en(n)&&!$t(n)&&(i=nn(i),n=nn(n)),!a&&sn(i)&&!sn(n))return e||(i.value=n),!0}let o=a?Number(t)<e.length:y(e,t),s=Reflect.set(e,t,n,sn(e)?e:r);return e===nn(r)&&s&&(o?me(n,i)&&pt(e,`set`,t,n,i):pt(e,`add`,t,n)),s}deleteProperty(e,t){let n=y(e,t),r=e[t],i=Reflect.deleteProperty(e,t);return i&&n&&pt(e,`delete`,t,void 0,r),i}has(e,t){let n=Reflect.has(e,t);return ee(t)&&Et.has(t)||ft(e,`has`,t),n}ownKeys(e){return ft(e,`iterate`,b(e)?`length`:lt),Reflect.ownKeys(e)}},At=class extends Ot{constructor(e=!1){super(!0,e)}set(e,t){return!0}deleteProperty(e,t){return!0}},jt=new kt,Mt=new At,Nt=new kt(!0),Pt=e=>e,Ft=e=>Reflect.getPrototypeOf(e);function It(e,t,n){return function(...r){let i=this.__v_raw,a=nn(i),o=x(a),s=e===`entries`||e===Symbol.iterator&&o,c=e===`keys`&&o,l=i[e](...r),u=n?Pt:t?on:an;return!t&&ft(a,`iterate`,c?ut:lt),g(Object.create(l),{next(){let{value:e,done:t}=l.next();return t?{value:e,done:t}:{value:s?[u(e[0]),u(e[1])]:u(e),done:t}}})}}function Lt(e){return function(...t){return e===`delete`?!1:e===`clear`?void 0:this}}function Rt(e,t){let n={get(n){let r=this.__v_raw,i=nn(r),a=nn(n);e||(me(n,a)&&ft(i,`get`,n),ft(i,`get`,a));let{has:o}=Ft(i),s=t?Pt:e?on:an;if(o.call(i,n))return s(r.get(n));if(o.call(i,a))return s(r.get(a));r!==i&&r.get(n)},get size(){let t=this.__v_raw;return!e&&ft(nn(t),`iterate`,lt),t.size},has(t){let n=this.__v_raw,r=nn(n),i=nn(t);return e||(me(t,i)&&ft(r,`has`,t),ft(r,`has`,i)),t===i?n.has(t):n.has(t)||n.has(i)},forEach(n,r){let i=this,a=i.__v_raw,o=nn(a),s=t?Pt:e?on:an;return!e&&ft(o,`iterate`,lt),a.forEach((e,t)=>n.call(r,s(e),s(t),i))}};return g(n,e?{add:Lt(`add`),set:Lt(`set`),delete:Lt(`delete`),clear:Lt(`clear`)}:{add(e){let n=nn(this),r=Ft(n),i=nn(e),a=!t&&!en(e)&&!$t(e)?i:e;return r.has.call(n,a)||me(e,a)&&r.has.call(n,e)||me(i,a)&&r.has.call(n,i)||(n.add(a),pt(n,`add`,a,a)),this},set(e,n){t||en(n)||$t(n)||(n=nn(n));let r=nn(this),{has:i,get:a}=Ft(r),o=i.call(r,e);o||=(e=nn(e),i.call(r,e));let s=a.call(r,e);return r.set(e,n),o?me(n,s)&&pt(r,`set`,e,n,s):pt(r,`add`,e,n),this},delete(e){let t=nn(this),{has:n,get:r}=Ft(t),i=n.call(t,e);i||=(e=nn(e),n.call(t,e));let a=r?r.call(t,e):void 0,o=t.delete(e);return i&&pt(t,`delete`,e,void 0,a),o},clear(){let e=nn(this),t=e.size!==0,n=e.clear();return t&&pt(e,`clear`,void 0,void 0,void 0),n}}),[`keys`,`values`,`entries`,Symbol.iterator].forEach(r=>{n[r]=It(r,e,t)}),n}function zt(e,t){let n=Rt(e,t);return(r,i,a)=>i===`__v_isReactive`?!e:i===`__v_isReadonly`?e:i===`__v_isShallow`?t:i===`__v_raw`?r:Reflect.get(y(n,i)&&i in r?n:r,i,a)}var Bt={get:zt(!1,!1)},Vt={get:zt(!1,!0)},Ht={get:zt(!0,!1)},Ut=new WeakMap,Wt=new WeakMap,Gt=new WeakMap,Kt=new WeakMap;function qt(e){switch(e){case`Object`:case`Array`:return 1;case`Map`:case`Set`:case`WeakMap`:case`WeakSet`:return 2;default:return 0}}function Jt(e){return $t(e)?e:Zt(e,!1,jt,Bt,Ut)}function Yt(e){return Zt(e,!1,Nt,Vt,Wt)}function Xt(e){return Zt(e,!0,Mt,Ht,Gt)}function Zt(e,t,n,r,i){if(!E(e)||e.__v_raw&&!(t&&e.__v_isReactive)||e.__v_skip||!Object.isExtensible(e))return e;let a=i.get(e);if(a)return a;let o=qt(ie(e));if(o===0)return e;let s=new Proxy(e,o===2?r:n);return i.set(e,s),s}function Qt(e){return $t(e)?Qt(e.__v_raw):!!(e&&e.__v_isReactive)}function $t(e){return!!(e&&e.__v_isReadonly)}function en(e){return!!(e&&e.__v_isShallow)}function tn(e){return e?!!e.__v_raw:!1}function nn(e){let t=e&&e.__v_raw;return t?nn(t):e}function rn(e){return!y(e,`__v_skip`)&&Object.isExtensible(e)&&ge(e,`__v_skip`,!0),e}var an=e=>E(e)?Jt(e):e,on=e=>E(e)?Xt(e):e;function sn(e){return e?e.__v_isRef===!0:!1}function A(e){return ln(e,!1)}function cn(e){return ln(e,!0)}function ln(e,t){return sn(e)?e:new un(e,t)}var un=class{constructor(e,t){this.dep=new ot,this.__v_isRef=!0,this.__v_isShallow=!1,this._rawValue=t?e:nn(e),this._value=t?e:an(e),this.__v_isShallow=t}get value(){return this.dep.track(),this._value}set value(e){let t=this._rawValue,n=this.__v_isShallow||en(e)||$t(e);e=n?e:nn(e),me(e,t)&&(this._rawValue=e,this._value=n?e:an(e),this.dep.trigger())}};function j(e){return sn(e)?e.value:e}var dn={get:(e,t,n)=>t===`__v_raw`?e:j(Reflect.get(e,t,n)),set:(e,t,n,r)=>{let i=e[t];return sn(i)&&!sn(n)?(i.value=n,!0):Reflect.set(e,t,n,r)}};function fn(e){return Qt(e)?e:new Proxy(e,dn)}var pn=class{constructor(e,t,n){this.fn=e,this.setter=t,this._value=void 0,this.dep=new ot(this),this.__v_isRef=!0,this.deps=void 0,this.depsTail=void 0,this.flags=16,this.globalVersion=it-1,this.next=void 0,this.effect=this,this.__v_isReadonly=!t,this.isSSR=n}notify(){if(this.flags|=16,!(this.flags&8)&&Re!==this)return We(this,!0),!0}get value(){let e=this.dep.track();return Xe(this),e&&(e.version=this.dep.version),this._value}set value(e){this.setter&&this.setter(e)}};function mn(e,t,n=!1){let r,i;return w(e)?r=e:(r=e.get,i=e.set),new pn(r,i,n)}var hn={},gn=new WeakMap,_n=void 0;function vn(e,t=!1,n=_n){if(n){let t=gn.get(n);t||gn.set(n,t=[]),t.push(e)}}function yn(e,t,n=u){let{immediate:r,deep:i,once:a,scheduler:o,augmentJob:s,call:c}=n,l=e=>i?e:en(e)||i===!1||i===0?bn(e,1):bn(e),d,p,m,h,g=!1,v=!1;if(sn(e)?(p=()=>e.value,g=en(e)):Qt(e)?(p=()=>l(e),g=!0):b(e)?(v=!0,g=e.some(e=>Qt(e)||en(e)),p=()=>e.map(e=>{if(sn(e))return e.value;if(Qt(e))return l(e);if(w(e))return c?c(e,2):e()})):p=w(e)?t?c?()=>c(e,2):e:()=>{if(m){tt();try{m()}finally{nt()}}let t=_n;_n=d;try{return c?c(e,3,[h]):e(h)}finally{_n=t}}:f,t&&i){let e=p,t=i===!0?1/0:i;p=()=>bn(e(),t)}let y=Le(),x=()=>{d.stop(),y&&y.active&&_(y.effects,d)};if(a&&t){let e=t;t=(...t)=>{try{return e(...t)}finally{x()}}}let S=v?Array(e.length).fill(hn):hn,C=e=>{if(d.flags&1&&(d.dirty||e)){if(t){let n=d.run();if(e||i||g||(v?n.some((e,t)=>me(e,S[t])):me(n,S))){let e=_n;tt();try{m&&m(),_n=d;let e=[n,S===hn?void 0:v&&S[0]===hn?[]:S,h];S=n,c?c(t,3,e):t(...e)}finally{_n=e,nt()}}}else d.run()}};return s&&s(C),d=new Be(p),d.scheduler=o?()=>o(C,!1):C,h=e=>vn(e,!1,d),m=d.onStop=()=>{let e=gn.get(d);if(e){if(c)c(e,4);else for(let t of e)t();gn.delete(d)}},t?r?C(!0):S=d.run():o?o(C.bind(null,!0),!0):d.run(),x.pause=d.pause.bind(d),x.resume=d.resume.bind(d),x.stop=x,x}function bn(e,t=1/0,n){if(t<=0||!E(e)||e.__v_skip||(n||=new Map,(n.get(e)||0)>=t))return e;if(n.set(e,t),t--,sn(e))bn(e.value,t,n);else if(b(e))for(let r=0;r<e.length;r++)bn(e[r],t,n);else if(S(e)||x(e))e.forEach(e=>{bn(e,t,n)});else if(ae(e)){for(let r in e)bn(e[r],t,n);for(let r of Object.getOwnPropertySymbols(e))Object.prototype.propertyIsEnumerable.call(e,r)&&bn(e[r],t,n)}return e}function xn(e,t,n,r){try{return r?e(...r):e()}catch(e){Cn(e,t,n)}}function Sn(e,t,n,r){if(w(e)){let i=xn(e,t,n,r);return i&&te(i)&&i.catch(e=>{Cn(e,t,n)}),i}if(b(e)){let i=[];for(let a=0;a<e.length;a++)i.push(Sn(e[a],t,n,r));return i}}function Cn(e,t,n,r=!0){let i=t?t.vnode:null,{errorHandler:a,throwUnhandledErrorInProduction:o}=t&&t.appContext.config||u;if(t){let r=t.parent,i=t.proxy,o=`https://vuejs.org/error-reference/#runtime-${n}`;for(;r;){let t=r.ec;if(t){for(let n=0;n<t.length;n++)if(t[n](e,i,o)===!1)return}r=r.parent}if(a){tt(),xn(a,null,10,[e,i,o]),nt();return}}wn(e,n,i,r,o)}function wn(e,t,n,r=!0,i=!1){if(i)throw e;console.error(e)}var Tn=[],En=-1,Dn=[],On=null,kn=0,An=Promise.resolve(),jn=null;function Mn(e){let t=jn||An;return e?t.then(this?e.bind(this):e):t}function Nn(e){let t=En+1,n=Tn.length;for(;t<n;){let r=t+n>>>1,i=Tn[r],a=Vn(i);a<e||a===e&&i.flags&2?t=r+1:n=r}return t}function Pn(e){if(!(e.flags&1)){let t=Vn(e),n=Tn[Tn.length-1];!n||!(e.flags&2)&&t>=Vn(n)?Tn.push(e):Tn.splice(Nn(t),0,e),e.flags|=1,Fn()}}function Fn(){jn||=An.then(Hn)}function In(e){if(!b(e))On&&e.id===-1?On.splice(kn+1,0,e):e.flags&1||(Dn.push(e),e.flags|=1);else for(let t=0;t<e.length;t++)Dn.push(e[t]);Fn()}function Ln(e,t,n,r=En+1){for(;r<Tn.length;r++){let n=Tn[r];if(n&&n.flags&2){if(e&&n.id!==e.uid||t!==void 0&&!(n.id>=t))continue;Tn.splice(r,1),r=e?r-1:En,n.flags&4&&(n.flags&=-2),n(),n.flags&4||(n.flags&=-2)}}}function Rn(e,t,n=0){if(Dn.length){let e=Dn,r=0;if(t){e=[];for(let i=0;i<Dn.length;i++){let a=Dn[i];(a.i===void 0?t.has(a):!a.i||a.i.uid<n)?Dn[r++]=a:e.push(a)}}let i=[...new Set(e)].sort((e,t)=>Vn(e)-Vn(t));if(Dn.length=r,On){for(let e=0;e<i.length;e++)On.push(i[e]);return}for(On=i,kn=0;kn<On.length;kn++){let e=On[kn];e.flags&4&&(e.flags&=-2),e.flags&8||e(),e.flags&=-2}On=null,kn=0}}var zn=!1;function Bn(e,t){if(zn){e();return}let n=t===void 0?void 0:new Set(Dn);e(),zn=!0;try{Ln(void 0,t),Rn(void 0,n,t)}finally{zn=!1}}var Vn=e=>e.id==null?e.flags&2?-1:1/0:e.id;function Hn(e){try{for(En=0;En<Tn.length;En++){let e=Tn[En];e&&!(e.flags&8)&&(e.flags&4&&(e.flags&=-2),xn(e,e.i,e.i?15:14),e.flags&4||(e.flags&=-2))}}finally{for(;En<Tn.length;En++){let e=Tn[En];e&&(e.flags&=-2)}En=-1,Tn.length=0,Rn(e),jn=null,(Tn.length||Dn.length)&&Hn(e)}}var Un=null,Wn=null;function Gn(e){let t=Un;return Un=e,Wn=e&&e.type.__scopeId||null,t}function Kn(e,t=Un,n){if(!t||e._n)return e;let r=(...n)=>{r._d&&ra(-1);let i=Gn(t),a=$i.length,o;try{o=e(...n)}finally{for(let e=$i.length;e>a;e--)ta();Gn(i),r._d&&ra(1)}return o};return r._n=!0,r._c=!0,r._d=!0,r}function qn(e,t){if(Un===null)return e;let n=Ra(Un),r=e.dirs||=[];for(let e=0;e<t.length;e++){let[i,a,o,s=u]=t[e];i&&(w(i)&&(i={mounted:i,updated:i}),i.deep&&bn(a),r.push({dir:i,instance:n,value:a,oldValue:void 0,arg:o,modifiers:s}))}return e}function Jn(e,t,n,r){let i=e.dirs,a=t&&t.dirs;for(let o=0;o<i.length;o++){let s=i[o];a&&(s.oldValue=a[o].value);let c=s.dir[r];c&&(tt(),Sn(c,n,8,[e.el,s,e,t]),nt())}}function Yn(e,t){if(wa){let n=wa.provides,r=wa.parent&&wa.parent.provides;r===n&&(n=wa.provides=Object.create(r)),n[e]=t}}function Xn(e,t,n=!1){let r=Ta();if(r||ai){let i=ai?ai._context.provides:r?r.parent==null||r.ce?r.vnode.appContext&&r.vnode.appContext.provides:r.parent.provides:void 0;if(i&&e in i)return i[e];if(arguments.length>1)return n&&w(t)?t.call(r&&r.proxy):t}}var Zn=Symbol.for(`v-scx`),Qn=()=>Xn(Zn);function $n(e,t,n){return er(e,t,n)}function er(e,t,n=u){let{immediate:r,deep:i,flush:a,once:o}=n,s=g({},n),c=t&&r||!t&&a!==`post`,l;if(ja){if(a===`sync`){let e=Qn();l=e.__watcherHandles||=[]}else if(!c){let e=()=>{};return e.stop=f,e.resume=f,e.pause=f,e}}let d=wa;s.call=(e,t,n)=>Sn(e,d,t,n);let p=!1;a===`post`?s.scheduler=e=>{e.i=d,Li(e,d&&d.suspense)}:a!==`sync`&&(p=!0,s.scheduler=(e,t)=>{t?e():Pn(e)}),s.augmentJob=e=>{t&&(e.flags|=4),p&&(e.flags|=2,d&&(e.id=d.uid,e.i=d))};let m=yn(e,t,s);return ja&&(l?l.push(m):c&&m()),m}function tr(e,t,n){let r=this.proxy,i=T(e)?e.includes(`.`)?nr(r,e):()=>r[e]:e.bind(r,r),a;w(t)?a=t:(a=t.handler,n=t);let o=Oa(this),s=er(i,a.bind(r),n);return o(),s}function nr(e,t){let n=t.split(`.`);return()=>{let t=e;for(let e=0;e<n.length&&t;e++)t=t[n[e]];return t}}var rr=Symbol(`_vte`),ir=e=>e.__isTeleport,ar=Symbol(`_leaveCb`);function or(e){let t=e[0];if(e.length>1){for(let n of e)if(n.type!==Zi){t=n;break}}return t}function sr(e){if(!_r(e))return ir(e.type)&&e.children?or(e.children):e;if(e.component)return e.component.subTree;let{shapeFlag:t,children:n}=e;if(n){if(t&16)return n[0];if(t&32&&w(n.default))return n.default()}}function cr(e,t){if(e.shapeFlag&6&&e.component){e.transition=t;let n=e.component.subTree;cr(ir(n.type)&&sr(n)||n,t)}else if(e.shapeFlag&128)e.ssContent.transition=t.clone(e.ssContent),e.ssFallback.transition=t.clone(e.ssFallback);else if(e.transition=t,e.type===M&&b(e.children)){let n=fi(e.children,!1);n&&cr(n,t)}}function lr(e){if(e.component)return lr(e.component.subTree);if(e.type===M){let t=b(e.children)&&fi(e.children,!1);return t?lr(t):void 0}if(e.type!==Zi)return e}function ur(e,t){return w(e)?g({name:e.name},t,{setup:e}):e}function dr(e){e.ids=[e.ids[0]+e.ids[2]+++`-`,0,0]}function fr(e,t){let n;return!!((n=Object.getOwnPropertyDescriptor(e,t))&&!n.configurable)}var pr=new WeakMap;function mr(e,t,n,r,i=!1){if(b(e)){e.forEach((e,a)=>mr(e,t&&(b(t)?t[a]:t),n,r,i));return}if(gr(r)&&!i){r.shapeFlag&512&&r.type.__asyncResolved&&r.component.subTree.component&&mr(e,t,n,r.component.subTree);return}let a=r.shapeFlag&4?Ra(r.component):r.el,o=i?null:a,{i:s,r:c}=e,l=t&&t.r,d=s.refs===u?s.refs={}:s.refs,f=s.setupState,m=nn(f),h=f===u?p:e=>!fr(d,e)&&y(m,e),g=(e,t)=>!(t&&fr(d,t));if(l!=null&&l!==c){if(hr(t),T(l))d[l]=null,h(l)&&(f[l]=null);else if(sn(l)){let e=t;g(l,e.k)&&(l.value=null),e.k&&(d[e.k]=null)}}if(w(c))xn(c,s,12,[o,d]);else{let t=T(c),r=sn(c);if(t||r){let s=()=>{if(e.f){let n=t?h(c)?f[c]:d[c]:g(c)||!e.k?c.value:d[e.k];if(i)b(n)&&_(n,a);else if(b(n))n.includes(a)||n.push(a);else if(t)d[c]=[a],h(c)&&(f[c]=d[c]);else{let t=[a];g(c,e.k)&&(c.value=t),e.k&&(d[e.k]=t)}}else t?(d[c]=o,h(c)&&(f[c]=o)):r&&(g(c,e.k)&&(c.value=o),e.k&&(d[e.k]=o))};if(o){let t=()=>{s(),pr.delete(e)};t.id=-1,pr.set(e,t),Li(t,n)}else hr(e),s()}}}function hr(e){let t=pr.get(e);t&&(t.flags|=8,pr.delete(e))}ye().requestIdleCallback,ye().cancelIdleCallback;var gr=e=>!!e.type.__asyncLoader,_r=e=>e.type.__isKeepAlive;function vr(e,t){br(e,`a`,t)}function yr(e,t){br(e,`da`,t)}function br(e,t,n=wa){let r=e.__wdc||=()=>{let t=n;for(;t;){if(t.isDeactivated)return;t=t.parent}return e()};if(Sr(t,r,n),n){let e=n.parent;for(;e&&e.parent;)_r(e.parent.vnode)&&xr(r,t,n,e),e=e.parent}}function xr(e,t,n,r){let i=Sr(t,e,r,!0);kr(()=>{_(r[t],i)},n)}function Sr(e,t,n=wa,r=!1){if(n){let i=n[e]||(n[e]=[]),a=t.__weh||=(...r)=>{tt();let i=Oa(n),a=Sn(t,n,e,r);return i(),nt(),a};return r?i.unshift(a):i.push(a),a}}var Cr=e=>(t,n=wa)=>{ja&&e!==`sp`||Sr(e,(...e)=>t(...e),n)},wr=Cr(`bm`),Tr=Cr(`m`),Er=Cr(`bu`),Dr=Cr(`u`),Or=Cr(`bum`),kr=Cr(`um`),Ar=Cr(`sp`),jr=Cr(`rtg`),Mr=Cr(`rtc`);function Nr(e,t=wa){Sr(`ec`,e,t)}var Pr=Symbol.for(`v-ndc`);function Fr(e,t,n,r){let i,a=n&&n[r],o=b(e);if(o||T(e)){let n=o&&Qt(e),r=!1,s=!1;n&&(r=!en(e),s=$t(e),e=ht(e)),i=Array(e.length);for(let n=0,o=e.length;n<o;n++)i[n]=t(r?s?on(an(e[n])):an(e[n]):e[n],n,void 0,a&&a[n])}else if(typeof e==`number`){if(!Number.isInteger(e)||e<0)i=[];else{i=Array(e);for(let n=0;n<e;n++)i[n]=t(n+1,n,void 0,a&&a[n])}}else if(E(e)){if(e[Symbol.iterator])i=Array.from(e,(e,n)=>t(e,n,void 0,a&&a[n]));else{let n=Object.keys(e);i=Array(n.length);for(let r=0,o=n.length;r<o;r++){let o=n[r];i[r]=t(e[o],o,r,a&&a[r])}}}else i=[];return n&&(n[r]=i),i}var Ir=e=>e?Aa(e)?Ra(e):Ir(e.parent):null,Lr=g(Object.create(null),{$:e=>e,$el:e=>e.vnode.el,$data:e=>e.data,$props:e=>e.props,$attrs:e=>e.attrs,$slots:e=>e.slots,$refs:e=>e.refs,$parent:e=>Ir(e.parent),$root:e=>Ir(e.root),$host:e=>e.ce,$emit:e=>e.emit,$options:e=>Kr(e),$forceUpdate:e=>e.f||=()=>{Pn(e.update)},$nextTick:e=>e.n||=Mn.bind(e.proxy),$watch:e=>tr.bind(e)}),Rr=(e,t)=>e!==u&&!e.__isScriptSetup&&y(e,t),zr={get({_:e},t){if(t===`__v_skip`)return!0;let{ctx:n,setupState:r,data:i,props:a,accessCache:o,type:s,appContext:c}=e;if(t[0]!==`$`){let e=o[t];if(e!==void 0)switch(e){case 1:return r[t];case 2:return i[t];case 4:return n[t];case 3:return a[t]}else if(Rr(r,t))return o[t]=1,r[t];else if(i!==u&&y(i,t))return o[t]=2,i[t];else if(y(a,t))return o[t]=3,a[t];else if(n!==u&&y(n,t))return o[t]=4,n[t];else Vr&&(o[t]=0)}let l=Lr[t],d,f;if(l)return t===`$attrs`&&ft(e.attrs,`get`,``),l(e);if((d=s.__cssModules)&&(d=d[t]))return d;if(n!==u&&y(n,t))return o[t]=4,n[t];if(f=c.config.globalProperties,y(f,t))return f[t]},set({_:e},t,n){let{data:r,setupState:i,ctx:a}=e;return Rr(i,t)?(i[t]=n,!0):r!==u&&y(r,t)?(r[t]=n,!0):y(e.props,t)||t[0]===`$`&&t.slice(1)in e?!1:(a[t]=n,!0)},has({_:{data:e,setupState:t,accessCache:n,ctx:r,appContext:i,props:a,type:o}},s){let c;return!!(n[s]||e!==u&&s[0]!==`$`&&y(e,s)||Rr(t,s)||y(a,s)||y(r,s)||y(Lr,s)||y(i.config.globalProperties,s)||(c=o.__cssModules)&&c[s])},defineProperty(e,t,n){return n.get==null?y(n,`value`)&&this.set(e,t,n.value,null):e._.accessCache[t]=0,Reflect.defineProperty(e,t,n)}};function Br(e){return b(e)?e.reduce((e,t)=>(e[t]=null,e),{}):e}var Vr=!0;function Hr(e){let t=Kr(e),n=e.proxy,r=e.ctx;Vr=!1,t.beforeCreate&&Wr(t.beforeCreate,e,`bc`);let{data:i,computed:a,methods:o,watch:s,provide:c,inject:l,created:u,beforeMount:d,mounted:p,beforeUpdate:m,updated:h,activated:g,deactivated:_,beforeDestroy:v,beforeUnmount:y,destroyed:x,unmounted:S,render:C,renderTracked:T,renderTriggered:ee,errorCaptured:te,serverPrefetch:ne,expose:re,inheritAttrs:ie,components:ae,directives:oe,filters:D}=t;if(l&&Ur(l,r,null),o)for(let e in o){let t=o[e];w(t)&&(r[e]=t.bind(n))}if(i){let t=i.call(n,n);E(t)&&(e.data=Jt(t))}if(Vr=!0,a)for(let e in a){let t=a[e],i=R({get:w(t)?t.bind(n,n):w(t.get)?t.get.bind(n,n):f,set:!w(t)&&w(t.set)?t.set.bind(n):f});Object.defineProperty(r,e,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e})}if(s)for(let e in s)Gr(s[e],r,n,e);if(c){let e=w(c)?c.call(n):c;Reflect.ownKeys(e).forEach(t=>{Yn(t,e[t])})}u&&Wr(u,e,`c`);function se(e,t){b(t)?t.forEach(t=>e(t.bind(n))):t&&e(t.bind(n))}if(se(wr,d),se(Tr,p),se(Er,m),se(Dr,h),se(vr,g),se(yr,_),se(Nr,te),se(Mr,T),se(jr,ee),se(Or,y),se(kr,S),se(Ar,ne),b(re)){if(re.length){let t=e.exposed||={};re.forEach(e=>{Object.defineProperty(t,e,{get:()=>n[e],set:t=>n[e]=t,enumerable:!0})})}else e.exposed||={}}C&&e.render===f&&(e.render=C),ie!=null&&(e.inheritAttrs=ie),ae&&(e.components=ae),oe&&(e.directives=oe),ne&&dr(e)}function Ur(e,t,n=f){b(e)&&(e=Zr(e));for(let n in e){let r=e[n],i;i=E(r)?`default`in r?Xn(r.from||n,r.default,!0):Xn(r.from||n):Xn(r),sn(i)?Object.defineProperty(t,n,{enumerable:!0,configurable:!0,get:()=>i.value,set:e=>i.value=e}):t[n]=i}}function Wr(e,t,n){Sn(b(e)?e.map(e=>e.bind(t.proxy)):e.bind(t.proxy),t,n)}function Gr(e,t,n,r){let i=r.includes(`.`)?nr(n,r):()=>n[r];if(T(e)){let n=t[e];w(n)&&$n(i,n)}else if(w(e))$n(i,e.bind(n));else if(E(e)){if(b(e))e.forEach(e=>Gr(e,t,n,r));else{let r=w(e.handler)?e.handler.bind(n):t[e.handler];w(r)&&$n(i,r,e)}}}function Kr(e){let t=e.type,{mixins:n,extends:r}=t,{mixins:i,optionsCache:a,config:{optionMergeStrategies:o}}=e.appContext,s=a.get(t),c;return s?c=s:!i.length&&!n&&!r?c=t:(c={},i.length&&i.forEach(e=>qr(c,e,o,!0)),qr(c,t,o)),E(t)&&a.set(t,c),c}function qr(e,t,n,r=!1){let{mixins:i,extends:a}=t;a&&qr(e,a,n,!0),i&&i.forEach(t=>qr(e,t,n,!0));for(let i in t)if(!(r&&i===`expose`)){let r=Jr[i]||n&&n[i];e[i]=r?r(e[i],t[i]):t[i]}return e}var Jr={data:Yr,props:ei,emits:ei,methods:$r,computed:$r,beforeCreate:Qr,created:Qr,beforeMount:Qr,mounted:Qr,beforeUpdate:Qr,updated:Qr,beforeDestroy:Qr,beforeUnmount:Qr,destroyed:Qr,unmounted:Qr,activated:Qr,deactivated:Qr,errorCaptured:Qr,serverPrefetch:Qr,components:$r,directives:$r,watch:ti,provide:Yr,inject:Xr};function Yr(e,t){return t?e?function(){return g(w(e)?e.call(this,this):e,w(t)?t.call(this,this):t)}:t:e}function Xr(e,t){return $r(Zr(e),Zr(t))}function Zr(e){if(b(e)){let t={};for(let n=0;n<e.length;n++)t[e[n]]=e[n];return t}return e}function Qr(e,t){return e?[...new Set([].concat(e,t))]:t}function $r(e,t){return e?g(Object.create(null),e,t):t}function ei(e,t){return e?b(e)&&b(t)?[...new Set([...e,...t])]:g(Object.create(null),Br(e),Br(t??{})):t}function ti(e,t){if(!e)return t;if(!t)return e;let n=g(Object.create(null),e);for(let r in t)n[r]=Qr(e[r],t[r]);return n}function ni(){return{app:null,config:{isNativeTag:p,performance:!1,globalProperties:{},optionMergeStrategies:{},errorHandler:void 0,warnHandler:void 0,compilerOptions:{}},mixins:[],components:{},directives:{},provides:Object.create(null),optionsCache:new WeakMap,propsCache:new WeakMap,emitsCache:new WeakMap}}var ri=0;function ii(e,t){return function(n,r=null){w(n)||(n=g({},n)),r!=null&&!E(r)&&(r=null);let i=ni(),a=new WeakSet,o=[],s=!1,c=i.app={_uid:ri++,_component:n,_props:r,_container:null,_context:i,_instance:null,version:Va,get config(){return i.config},set config(e){},use(e,...t){return a.has(e)||(e&&w(e.install)?(a.add(e),e.install(c,...t)):w(e)&&(a.add(e),e(c,...t))),c},mixin(e){return i.mixins.includes(e)||i.mixins.push(e),c},component(e,t){return t?(i.components[e]=t,c):i.components[e]},directive(e,t){return t?(i.directives[e]=t,c):i.directives[e]},mount(a,o,l){if(!s){let u=c._ceVNode||ua(n,r);return u.appContext=i,l===!0?l=`svg`:l===!1&&(l=void 0),o&&t?t(u,a):e(u,a,l),s=!0,c._container=a,a.__vue_app__=c,Ra(u.component)}},onUnmount(e){o.push(e)},unmount(){s&&(Sn(o,c._instance,16),e(null,c._container),delete c._container.__vue_app__)},provide(e,t){return i.provides[e]=t,c},runWithContext(e){let t=ai;ai=c;try{return e()}finally{ai=t}}};return c}}var ai=null,oi=(e,t)=>t===`modelValue`||t===`model-value`?e.modelModifiers:e[`${t}Modifiers`]||e[`${le(t)}Modifiers`]||e[`${de(t)}Modifiers`];function si(e,t,...n){if(e.isUnmounted)return;let r=e.vnode.props||u,i=n,a=t.startsWith(`update:`),o=a&&oi(r,t.slice(7));o&&(o.trim&&(i=n.map(e=>T(e)?e.trim():e)),o.number&&(i=i.map(_e)));let s,c=r[s=pe(t)]||r[s=pe(le(t))];!c&&a&&(c=r[s=pe(de(t))]),c&&Sn(c,e,6,i);let l=r[s+`Once`];if(l){if(!e.emitted)e.emitted={};else if(e.emitted[s])return;e.emitted[s]=!0,Sn(l,e,6,i)}}var ci=new WeakMap;function li(e,t,n=!1){let r=n?ci:t.emitsCache,i=r.get(e);if(i!==void 0)return i;let a=e.emits,o={},s=!1;if(!w(e)){let r=e=>{let n=li(e,t,!0);n&&(s=!0,g(o,n))};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}return!a&&!s?(E(e)&&r.set(e,null),null):(b(a)?a.forEach(e=>o[e]=null):g(o,a),E(e)&&r.set(e,o),o)}function ui(e,t){return!e||!m(t)?!1:(t=t.slice(2),t=t===`Once`?t:t.replace(/Once$/,``),y(e,t[0].toLowerCase()+t.slice(1))||y(e,de(t))||y(e,t))}function di(e){let{type:t,vnode:n,proxy:r,withProxy:i,propsOptions:[a],slots:o,attrs:s,emit:c,render:l,renderCache:u,props:d,data:f,setupState:p,ctx:m,inheritAttrs:g}=e,_=Gn(e),v,y;try{if(n.shapeFlag&4){let e=i||r,t=e;v=ha(l.call(t,e,u,d,p,f,m)),y=s}else{let e=t;v=ha(e.length>1?e(d,{attrs:s,slots:o,emit:c}):e(d,null)),y=t.props?s:pi(s)}}catch(t){$i.length=0,Cn(t,e,1),v=ua(Zi)}let b=v;if(y&&g!==!1){let e=Object.keys(y),{shapeFlag:t}=b;e.length&&t&7&&(a&&e.some(h)&&(y=mi(y,a)),b=pa(b,y,!1,!0))}return n.dirs&&(b=pa(b,null,!1,!0),b.dirs=b.dirs?b.dirs.concat(n.dirs):n.dirs),n.transition&&cr(ir(b.type)&&sr(b)||b,n.transition),v=b,Gn(_),v}function fi(e,t=!0){let n;for(let t=0;t<e.length;t++){let r=e[t];if(oa(r)){if(r.type!==Zi||r.children===`v-if`){if(n)return;n=r}}else return}return n}var pi=e=>{let t;for(let n in e)(n===`class`||n===`style`||m(n))&&((t||={})[n]=e[n]);return t},mi=(e,t)=>{let n={};for(let r in e)h(r)&&r.slice(9)in t||(n[r]=e[r]);return n};function hi(e,t,n){let{props:r,children:i,component:a}=e,{props:o,children:s,patchFlag:c}=t,l=a.emitsOptions;if(t.dirs||t.transition)return!0;if(n&&c>=0){if(c&1024)return!0;if(c&16)return r?gi(r,o,l):!!o;if(c&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let n=e[t];if(_i(o,r,n)&&!ui(l,n))return!0}}}else return(i||s)&&(!s||!s.$stable)?!0:r===o?!1:r?!o||gi(r,o,l):!!o;return!1}function gi(e,t,n){let r=Object.keys(t);if(r.length!==Object.keys(e).length)return!0;for(let i=0;i<r.length;i++){let a=r[i];if(!y(e,a)||_i(t,e,a)&&!ui(n,a))return!0}return!1}function _i(e,t,n){let r=e[n],i=t[n];return n===`style`&&E(r)&&E(i)?!je(r,i):r!==i}function vi({vnode:e,parent:t,suspense:n},r){for(;t;){let n=t.subTree;if(n.suspense&&n.suspense.activeBranch===e&&(n.suspense.vnode.el=n.el=r,e=n),n===e)(e=t.vnode).el=r,t=t.parent;else break}n&&n.activeBranch===e&&(n.vnode.el=r)}var yi={},bi=()=>Object.create(yi),xi=e=>Object.getPrototypeOf(e)===yi;function Si(e,t,n,r=!1){let i={},a=bi();e.propsDefaults=Object.create(null),wi(e,t,i,a);for(let t in e.propsOptions[0])t in i||(i[t]=void 0);e.props=n?r?i:Yt(i):e.type.props?i:a,e.attrs=a}function Ci(e,t,n,r){let{props:i,attrs:a,vnode:{patchFlag:o}}=e,s=nn(i),[c]=e.propsOptions,l=!1;if((r||o>0)&&!(o&16)){if(o&8){let n=e.vnode.dynamicProps;for(let r=0;r<n.length;r++){let o=n[r];if(ui(e.emitsOptions,o))continue;let u=t[o];if(c){if(y(a,o))u!==a[o]&&(a[o]=u,l=!0);else{let t=le(o);i[t]=Ti(c,s,t,u,e,!1)}}else u!==a[o]&&(a[o]=u,l=!0)}}}else{wi(e,t,i,a)&&(l=!0);let r;for(let a in s)t&&(y(t,a)||(r=de(a))!==a&&y(t,r))||(c?n&&(n[a]!==void 0||n[r]!==void 0)&&(i[a]=Ti(c,s,a,void 0,e,!0)):delete i[a]);if(a!==s)for(let e in a)t&&y(t,e)||(delete a[e],l=!0)}l&&pt(e.attrs,`set`,``)}function wi(e,t,n,r){let[i,a]=e.propsOptions,o=!1,s;if(t)for(let c in t){if(D(c))continue;let l=t[c],u;i&&y(i,u=le(c))?!a||!a.includes(u)?n[u]=l:(s||={})[u]=l:ui(e.emitsOptions,c)||c in r&&l===r[c]||(r[c]=l,o=!0)}if(a){let t=nn(n),r=s||u;for(let o=0;o<a.length;o++){let s=a[o];n[s]=Ti(i,t,s,r[s],e,!y(r,s))}}return o}function Ti(e,t,n,r,i,a){let o=e[n];if(o!=null){let e=y(o,`default`);if(e&&r===void 0){let e=o.default;if(o.type!==Function&&!o.skipFactory&&w(e)){let{propsDefaults:a}=i;if(n in a)r=a[n];else{let o=Oa(i);r=a[n]=e.call(null,t),o()}}else r=e;i.ce&&i.ce._setProp(n,r)}o[0]&&(a&&!e?r=!1:o[1]&&(r===``||r===de(n))&&(r=!0))}return r}var Ei=new WeakMap;function Di(e,t,n=!1){let r=n?Ei:t.propsCache,i=r.get(e);if(i)return i;let a=e.props,o={},s=[],c=!1;if(!w(e)){let r=e=>{c=!0;let[n,r]=Di(e,t,!0);g(o,n),r&&s.push(...r)};!n&&t.mixins.length&&t.mixins.forEach(r),e.extends&&r(e.extends),e.mixins&&e.mixins.forEach(r)}if(!a&&!c)return E(e)&&r.set(e,d),d;if(b(a))for(let e=0;e<a.length;e++){let t=le(a[e]);Oi(t)&&(o[t]=u)}else if(a)for(let e in a){let t=le(e);if(Oi(t)){let n=a[e],r=o[t]=b(n)||w(n)?{type:n}:g({},n),i=r.type,c=!1,l=!0;if(b(i))for(let e=0;e<i.length;++e){let t=i[e],n=w(t)&&t.name;if(n===`Boolean`){c=!0;break}n===`String`&&(l=!1)}else c=w(i)&&i.name===`Boolean`;r[0]=c,r[1]=l,(c||y(r,`default`))&&s.push(t)}}let l=[o,s];return E(e)&&r.set(e,l),l}function Oi(e){return e[0]!==`$`&&!D(e)}var ki=e=>e===`_`||e===`_ctx`||e===`$stable`,Ai=e=>b(e)?e.map(ha):[ha(e)],ji=(e,t,n)=>{if(t._n)return t;let r=Kn((...e)=>Ai(t(...e)),n);return r._c=!1,r},Mi=(e,t,n)=>{let r=e._ctx;for(let n in e){if(ki(n))continue;let i=e[n];if(w(i))t[n]=ji(n,i,r);else if(i!=null){let e=Ai(i);t[n]=()=>e}}},Ni=(e,t)=>{let n=Ai(t);e.slots.default=()=>n},Pi=(e,t,n)=>{for(let r in t)(n||!ki(r))&&(e[r]=t[r])},Fi=(e,t,n)=>{let r=e.slots=bi();if(e.vnode.shapeFlag&32){let e=t._;e?(Pi(r,t,n),n&&ge(r,`_`,e,!0)):Mi(t,r)}else t&&Ni(e,t)},Ii=(e,t,n)=>{let{vnode:r,slots:i}=e,a=!0,o=u;if(r.shapeFlag&32){let e=t._;e?n&&e===1?a=!1:Pi(i,t,n):(a=!t.$stable,Mi(t,i)),o=t}else t&&(Ni(e,t),o={default:1});if(a)for(let e in i)!ki(e)&&o[e]==null&&delete i[e]},Li=Yi;function Ri(e){return zi(e)}function zi(e,t){let n=ye();n.__VUE__=!0;let{insert:r,remove:i,patchProp:a,createElement:o,createText:s,createComment:c,setText:l,setElementText:p,parentNode:m,nextSibling:h,setScopeId:g=f,insertStaticContent:_}=e,v=(e,t,n,r=null,i=null,a=null,o=void 0,s=null,c=!!t.dynamicChildren)=>{if(e===t)return;e&&!sa(e,t)&&(r=xe(e),me(e,i,a,!0),e=null),t.patchFlag===-2&&(c=!1,t.dynamicChildren=null),t.dynamicChildren&&e&&e.dynamicChildren&&e.dynamicChildren.hasOnce&&(t.dynamicChildren===d&&(t.dynamicChildren=[]),t.dynamicChildren.hasOnce=!0);let{type:l,ref:u,shapeFlag:f}=t;switch(l){case Xi:y(e,t,n,r);break;case Zi:b(e,t,n,r);break;case Qi:e??x(t,n,r,o);break;case M:ie(e,t,n,r,i,a,o,s,c);break;default:f&1?w(e,t,n,r,i,a,o,s,c):f&6?ae(e,t,n,r,i,a,o,s,c):(f&64||f&128)&&l.process(e,t,n,r,i,a,o,s,c,Ce)}u!=null&&i?mr(u,e&&e.ref,a,t||e,!t):u==null&&e&&e.ref!=null&&mr(e.ref,null,a,e,!0)},y=(e,t,n,i)=>{if(e==null)r(t.el=s(t.children),n,i);else{let n=t.el=e.el;t.children!==e.children&&l(n,t.children)}},b=(e,t,n,i)=>{e==null?r(t.el=c(t.children||``),n,i):t.el=e.el},x=(e,t,n,r)=>{[e.el,e.anchor]=_(e.children,t,n,r,e.el,e.anchor)},S=({el:e,anchor:t},n,i)=>{let a;for(;e&&e!==t;)a=h(e),r(e,n,i),e=a;r(t,n,i)},C=({el:e,anchor:t})=>{let n;for(;e&&e!==t;)n=h(e),i(e),e=n;i(t)},w=(e,t,n,r,i,a,o,s,c)=>{if(t.type===`svg`?o=`svg`:t.type===`math`&&(o=`mathml`),e==null)T(t,n,r,i,a,o,s,c);else{let n=e.el&&e.el._isVueCE?e.el:null;try{n&&n._beginPatch(),te(e,t,i,a,o,s,c)}finally{n&&n._endPatch()}}},T=(e,t,n,i,s,c,l,u)=>{let d,f,{props:m,shapeFlag:h,transition:g,dirs:_}=e;if(d=e.el=o(e.type,c,m&&m.is,m),h&8?p(d,e.children):h&16&&E(e.children,d,null,i,s,Bi(e,c),l,u),_&&Jn(e,null,i,`created`),ee(d,e,e.scopeId,l,i),m){for(let e in m)e!==`value`&&!D(e)&&a(d,e,null,m[e],c,i);`value`in m&&a(d,`value`,null,m.value,c),(f=m.onVnodeBeforeMount)&&ya(f,i,e)}_&&Jn(e,null,i,`beforeMount`);let v=Hi(s,g);v&&g.beforeEnter(d),r(d,t,n),((f=m&&m.onVnodeMounted)||v||_)&&Li(()=>{try{f&&ya(f,i,e),v&&g.enter(d),_&&Jn(e,null,i,`mounted`)}finally{}},s)},ee=(e,t,n,r,i)=>{if(n&&g(e,n),r)for(let t=0;t<r.length;t++)g(e,r[t]);if(i){let n=i.subTree;if(t===n||Ji(n.type)&&(n.ssContent===t||n.ssFallback===t)){let t=i.vnode;ee(e,t,t.scopeId,t.slotScopeIds,i.parent)}}},E=(e,t,n,r,i,a,o,s,c=0)=>{for(let l=c;l<e.length;l++){let c=e[l]=s?ga(e[l]):ha(e[l]);v(null,c,t,n,r,i,a,o,s)}},te=(e,t,n,r,i,o,s)=>{let c=t.el=e.el,{patchFlag:l,dynamicChildren:d,dirs:f}=t;l|=e.patchFlag&16;let m=e.props||u,h=t.props||u,g;if(n&&Vi(n,!1),(g=h.onVnodeBeforeUpdate)&&ya(g,n,t,e),f&&Jn(t,e,n,`beforeUpdate`),n&&Vi(n,!0),d&&(!e.dynamicChildren||e.dynamicChildren.length!==d.length)&&(l=0,s=!1,d=null),(m.innerHTML&&h.innerHTML==null||m.textContent&&h.textContent==null)&&p(c,``),d?ne(e.dynamicChildren,d,c,n,r,Bi(t,i),o):s||ue(e,t,c,null,n,r,Bi(t,i),o,!1),l>0){if(l&16)re(c,m,h,n,i);else if(l&2&&m.class!==h.class&&a(c,`class`,null,h.class,i),l&4&&a(c,`style`,m.style,h.style,i),l&8){let e=t.dynamicProps;for(let t=0;t<e.length;t++){let r=e[t],o=m[r],s=h[r];(s!==o||r===`value`)&&a(c,r,o,s,i,n)}}l&1&&e.children!==t.children&&p(c,t.children)}else!s&&d==null&&re(c,m,h,n,i);((g=h.onVnodeUpdated)||f)&&Li(()=>{g&&ya(g,n,t,e),f&&Jn(t,e,n,`updated`)},r)},ne=(e,t,n,r,i,a,o)=>{for(let s=0;s<t.length;s++){let c=e[s],l=t[s],u=c.el||qi(c),d=u&&(c.type===M||!sa(c,l)||c.shapeFlag&198)?m(u):n;v(c,l,d,null,r,i,a,o,!0)}},re=(e,t,n,r,i)=>{if(t!==n){if(t!==u)for(let o in t)!D(o)&&!(o in n)&&a(e,o,t[o],null,i,r);for(let o in n){if(D(o))continue;let s=n[o],c=t[o];s!==c&&o!==`value`&&a(e,o,c,s,i,r)}`value`in n&&a(e,`value`,t.value,n.value,i)}},ie=(e,t,n,i,a,o,c,l,u)=>{let d=t.el=e?e.el:s(``),f=t.anchor=e?e.anchor:s(``),{patchFlag:p,dynamicChildren:m,slotScopeIds:h}=t;h&&(l=l?l.concat(h):h),e==null?(r(d,n,i),r(f,n,i),E(t.children||[],n,f,a,o,c,l,u)):p>0&&p&64&&m&&e.dynamicChildren&&e.dynamicChildren.length===m.length?(ne(e.dynamicChildren,m,n,a,o,c,l),(t.key!=null||a&&t===a.subTree)&&Ui(e,t,!0)):ue(e,t,n,f,a,o,c,l,u)},ae=(e,t,n,r,i,a,o,s,c)=>{t.slotScopeIds=s,e==null?t.shapeFlag&512?i.ctx.activate(t,n,r,o,c):oe(t,n,r,i,a,o,c):se(e,t,c)},oe=(e,t,n,r,i,a,o)=>{let s=e.component=Ca(e,r,i);if(_r(e)&&(s.ctx.renderer=Ce),Ma(s,!1,o),s.asyncDep){if(i&&i.registerDep(s,ce,o,a),!e.el){let r=s.subTree=ua(Zi);b(null,r,t,n),e.placeholder=r.el}}else ce(s,e,t,n,i,a,o)},se=(e,t,n)=>{let r=t.component=e.component;if(hi(e,t,n)){if(r.asyncDep&&!r.asyncResolved){t.el=e.el,t.placeholder=e.placeholder,le(r,t,n);return}r.next=t,r.update()}else t.el=e.el,t.placeholder=e.placeholder,r.vnode=t},ce=(e,t,n,r,i,a,o)=>{let s=()=>{if(e.isMounted){let{next:t,bu:n,u:r,parent:s,vnode:c}=e;{let n=Gi(e);if(n){t&&(t.el=c.el,le(e,t,o)),n.asyncDep.then(()=>{Li(()=>{e.isUnmounted||l()},i)});return}}let u=t,d;Vi(e,!1),t?(t.el=c.el,le(e,t,o)):t=c,n&&he(n),(d=t.props&&t.props.onVnodeBeforeUpdate)&&ya(d,s,t,c),Vi(e,!0);let f=di(e),p=e.subTree;e.subTree=f,v(p,f,m(p.el),xe(p),e,i,a),t.el=f.el,u===null&&vi(e,f.el),r&&Li(r,i),(d=t.props&&t.props.onVnodeUpdated)&&Li(()=>ya(d,s,t,c),i)}else{let o,{el:s,props:c}=t,{bm:l,m:u,parent:d,root:f,type:p}=e,m=gr(t);if(Vi(e,!1),l&&he(l),!m&&(o=c&&c.onVnodeBeforeMount)&&ya(o,d,t),Vi(e,!0),s&&O){let t=()=>{e.subTree=di(e),O(s,e.subTree,e,i,null)};m&&p.__asyncHydrate?p.__asyncHydrate(s,e,t):t()}else{f.ce&&f.ce._hasShadowRoot()&&f.ce._injectChildStyle(p,e.parent?e.parent.type:void 0);let o=e.subTree=di(e);v(null,o,n,r,e,i,a),t.el=o.el}if(u&&Li(u,i),!m&&(o=c&&c.onVnodeMounted)){let e=t;Li(()=>ya(o,d,e),i)}(t.shapeFlag&256||d&&gr(d.vnode)&&d.vnode.shapeFlag&256)&&e.a&&Li(e.a,i),e.isMounted=!0,t=n=r=null}};e.scope.on();let c=e.effect=new Be(s);e.scope.off();let l=e.update=c.run.bind(c),u=e.job=c.runIfDirty.bind(c);u.i=e,u.id=e.uid,c.scheduler=()=>Pn(u),Vi(e,!0),l()},le=(e,t,n)=>{t.component=e;let r=e.vnode.props;e.vnode=t,e.next=null,Ci(e,t.props,r,n),Ii(e,t.children,n),tt(),Ln(e),nt()},ue=(e,t,n,r,i,a,o,s,c=!1)=>{let l=e&&e.children,u=e?e.shapeFlag:0,d=t.children,{patchFlag:f,shapeFlag:m}=t;if(f>0){if(f&128){fe(l,d,n,r,i,a,o,s,c);return}if(f&256){de(l,d,n,r,i,a,o,s,c);return}}m&8?(u&16&&be(l,i,a),d!==l&&p(n,d)):u&16?m&16?fe(l,d,n,r,i,a,o,s,c):be(l,i,a,!0):(u&8&&p(n,``),m&16&&E(d,n,r,i,a,o,s,c))},de=(e,t,n,r,i,a,o,s,c)=>{e||=d,t||=d;let l=e.length,u=t.length,f=Math.min(l,u),p=0;for(;p<f;p++){let r=t[p]=c?ga(t[p]):ha(t[p]);v(e[p],r,n,null,i,a,o,s,c)}l>u?be(e,i,a,!0,!1,f):E(t,n,r,i,a,o,s,c,f)},fe=(e,t,n,r,i,a,o,s,c)=>{let l=0,u=t.length,f=e.length-1,p=u-1;for(;l<=f&&l<=p;){let r=e[l],u=t[l]=c?ga(t[l]):ha(t[l]);if(sa(r,u))v(r,u,n,null,i,a,o,s,c);else break;l++}for(;l<=f&&l<=p;){let r=e[f],l=t[p]=c?ga(t[p]):ha(t[p]);if(sa(r,l))v(r,l,n,null,i,a,o,s,c);else break;f--,p--}if(l>f){if(l<=p){let e=p+1,d=e<u?t[e].el:r;for(;l<=p;)v(null,t[l]=c?ga(t[l]):ha(t[l]),n,d,i,a,o,s,c),l++}}else if(l>p)for(;l<=f;)me(e[l],i,a,!0),l++;else{let m=l,h=l,g=new Map;for(l=h;l<=p;l++){let e=t[l]=c?ga(t[l]):ha(t[l]);e.key!=null&&g.set(e.key,l)}let _,y=0,b=p-h+1,x=!1,S=0,C=Array(b);for(l=0;l<b;l++)C[l]=0;for(l=m;l<=f;l++){let r=e[l];if(y>=b){me(r,i,a,!0);continue}let u;if(r.key!=null)u=g.get(r.key);else for(_=h;_<=p;_++)if(C[_-h]===0&&sa(r,t[_])){u=_;break}u===void 0?me(r,i,a,!0):(C[u-h]=l+1,u>=S?S=u:x=!0,v(r,t[u],n,null,i,a,o,s,c),y++)}let w=x?Wi(C):d;for(_=w.length-1,l=b-1;l>=0;l--){let e=h+l,d=t[e],f=t[e+1],p=e+1<u?f.el||qi(f):r;C[l]===0?v(null,d,n,p,i,a,o,s,c):x&&(_<0||l!==w[_]?pe(d,n,p,2):_--)}}},pe=(e,t,n,a,o=null)=>{let{el:s,type:c,transition:l,children:u,shapeFlag:d}=e;if(d&6)pe(e.component.subTree,t,n,a);else if(d&128)e.suspense.move(t,n,a);else if(d&64)c.move(e,t,n,Ce);else if(c===M){r(s,t,n);for(let e=0;e<u.length;e++)pe(u[e],t,n,a);r(e.anchor,t,n)}else if(c===Qi)S(e,t,n);else if(a!==2&&d&1&&l){if(a===0)l.persisted&&!s[ar]?r(s,t,n):(l.beforeEnter(s),r(s,t,n),Li(()=>l.enter(s),o));else{let{leave:a,delayLeave:o,afterLeave:c}=l,u=()=>{e.ctx.isUnmounted?i(s):r(s,t,n)},d=()=>{let e=s._isLeaving||!!s[ar];s._isLeaving&&s[ar](!0),l.persisted&&!e?u():a(s,()=>{u(),c&&c()})};o?o(s,u,d):d()}}else r(s,t,n)},me=(e,t,n,r=!1,i=!1)=>{let{type:a,props:o,ref:s,children:c,dynamicChildren:l,shapeFlag:u,patchFlag:d,dirs:f,cacheIndex:p,memo:m}=e;if((d===-2||l&&l.hasOnce)&&(i=!1),s!=null&&(tt(),mr(s,null,n,e,!0),nt()),p==null||e.ctx&&e.ctx!==t||(t.renderCache[p]=void 0),u&256){t.ctx.deactivate(e);return}let h=u&1&&f,g=!gr(e),_;if(g&&(_=o&&o.onVnodeBeforeUnmount)&&ya(_,t,e),u&6)ve(e.component,n,r);else{if(u&128){e.suspense.unmount(n,r);return}h&&Jn(e,null,t,`beforeUnmount`),u&64?e.type.remove(e,t,n,Ce,r):l&&!l.hasOnce&&(a!==M||d>0&&d&64)?be(l,t,n,!1,!0):(a===M&&d&384||!i&&u&16)&&be(c,t,n),r&&ge(e)}let v=m!=null&&p==null;(g&&(_=o&&o.onVnodeUnmounted)||h||v)&&Li(()=>{_&&ya(_,t,e),h&&Jn(e,null,t,`unmounted`),v&&(e.el=null)},n)},ge=e=>{let{type:t,el:n,anchor:r,transition:a}=e,o=t===M;if(o&&!a){_e(n,r);return}if(t===Qi){C(e),a&&!a.persisted&&a.afterLeave&&a.afterLeave();return}let s=o?lr(e):e,c=()=>{o?m(n)&&_e(n,r):i(n),a&&!a.persisted&&a.afterLeave&&a.afterLeave()};if(s&&s.shapeFlag&1&&a&&!a.persisted){let{leave:e,delayLeave:t}=a,n=s.el,r=()=>e(n,c);t?t(n,c,r):r()}else c()},_e=(e,t)=>{let n;for(;e!==t;)n=h(e),i(e),e=n;i(t)},ve=(e,t,n)=>{let{bum:r,scope:i,job:a,subTree:o,um:s,m:c,a:l}=e;Ki(c),Ki(l),r&&he(r),i.stop(),a?(a.flags|=8,me(o,e,t,n)):e.vnode.el&&o&&(o.transition=e.vnode.transition,me(o,e,t,n)),s&&Li(s,t),Li(()=>{e.isUnmounted=!0},t)},be=(e,t,n,r=!1,i=!1,a=0)=>{for(let o=a;o<e.length;o++)me(e[o],t,n,r,i)},xe=e=>{if(e.shapeFlag&6)return xe(e.component.subTree);if(e.shapeFlag&128)return e.suspense.next();let t=h(e.anchor||e.el),n=t&&t[rr];return n?h(n):t},Se=(e,t,n)=>{Bn(()=>{e==null?t._vnode&&me(t._vnode,null,null,!0):v(t._vnode||null,e,t,null,null,null,n),t._vnode=e},e&&t._vnode?void 0:e&&e.component?e.component.uid:Sa())},Ce={p:v,um:me,m:pe,r:ge,mt:oe,mc:E,pc:ue,pbc:ne,n:xe,o:e},we,O;return t&&([we,O]=t(Ce)),{render:Se,hydrate:we,createApp:ii(Se,we)}}function Bi({type:e,props:t},n){return n===`svg`&&e===`foreignObject`||n===`mathml`&&e===`annotation-xml`&&t&&t.encoding&&t.encoding.includes(`html`)?void 0:n}function Vi({effect:e,job:t},n){n?(e.flags|=32,t.flags|=4):(e.flags&=-33,t.flags&=-5)}function Hi(e,t){return(!e||e&&!e.pendingBranch)&&t&&!t.persisted}function Ui(e,t,n=!1){let r=e.children,i=t.children;if(b(r)&&b(i))for(let e=0;e<r.length;e++){let t=r[e],a=i[e];a.shapeFlag&1&&!a.dynamicChildren&&((a.patchFlag<=0||a.patchFlag===32)&&(a=i[e]=ga(i[e]),a.el=t.el),!n&&a.patchFlag!==-2&&Ui(t,a)),a.type===Xi&&(a.patchFlag===-1&&(a=i[e]=ga(a)),a.el=t.el),a.type===Zi&&!a.el&&(a.el=t.el)}}function Wi(e){let t=e.slice(),n=[0],r,i,a,o,s,c=e.length;for(r=0;r<c;r++){let c=e[r];if(c!==0){if(i=n[n.length-1],e[i]<c){t[r]=i,n.push(r);continue}for(a=0,o=n.length-1;a<o;)s=a+o>>1,e[n[s]]<c?a=s+1:o=s;c<e[n[a]]&&(a>0&&(t[r]=n[a-1]),n[a]=r)}}for(a=n.length,o=n[a-1];a-->0;)n[a]=o,o=t[o];return n}function Gi(e){let t=e.subTree.component;if(t)return t.asyncDep&&!t.asyncResolved?t:Gi(t)}function Ki(e){if(e)for(let t=0;t<e.length;t++)e[t].flags|=8}function qi(e){if(e.placeholder)return e.placeholder;let t=e.component;return t?qi(t.subTree):null}var Ji=e=>e.__isSuspense;function Yi(e,t){t&&t.pendingBranch?b(e)?t.effects.push(...e):t.effects.push(e):In(e)}var M=Symbol.for(`v-fgt`),Xi=Symbol.for(`v-txt`),Zi=Symbol.for(`v-cmt`),Qi=Symbol.for(`v-stc`),$i=[],ea=null;function N(e=!1){$i.push(ea=e?null:[])}function ta(){$i.pop(),ea=$i[$i.length-1]||null}var na=1;function ra(e,t=!1){na+=e,e<0&&ea&&t&&(ea.hasOnce=!0)}function ia(e){return e.dynamicChildren=na>0?ea||d:null,ta(),na>0&&ea&&ea.push(e),e}function P(e,t,n,r,i,a){return ia(F(e,t,n,r,i,a,!0))}function aa(e,t,n,r,i){return ia(ua(e,t,n,r,i,!0))}function oa(e){return e?e.__v_isVNode===!0:!1}function sa(e,t){return e.type===t.type&&e.key===t.key}var ca=({key:e})=>e??null,la=({ref:e,ref_key:t,ref_for:n})=>(typeof e==`number`&&(e=``+e),e==null?null:T(e)||sn(e)||w(e)?{i:Un,r:e,k:t,f:!!n}:e);function F(e,t=null,n=null,r=0,i=null,a=e===M?0:1,o=!1,s=!1){let c={__v_isVNode:!0,__v_skip:!0,type:e,props:t,key:t&&ca(t),ref:t&&la(t),scopeId:Wn,slotScopeIds:null,children:n,component:null,suspense:null,ssContent:null,ssFallback:null,dirs:null,transition:null,el:null,anchor:null,target:null,targetStart:null,targetAnchor:null,staticCount:0,shapeFlag:a,patchFlag:r,dynamicProps:i,dynamicChildren:null,appContext:null,ctx:Un};return s?(_a(c,n),a&128&&e.normalize(c)):n&&(c.shapeFlag|=T(n)?8:16),na>0&&!o&&ea&&(c.patchFlag>0||a&6)&&c.patchFlag!==32&&ea.push(c),c}var ua=da;function da(e,t=null,n=null,r=0,i=null,a=!1){if(e&&e!==Pr||(e=Zi),oa(e)){let r=pa(e,t,!0);return n&&_a(r,n),na>0&&!a&&ea&&(r.shapeFlag&6?ea[ea.indexOf(e)]=r:ea.push(r)),r.patchFlag=-2,r}if(za(e)&&(e=e.__vccOpts),t){t=fa(t);let{class:e,style:n}=t;e&&!T(e)&&(t.class=O(e)),E(n)&&(tn(n)&&!b(n)&&(n=g({},n)),t.style=be(n))}let o=T(e)?1:Ji(e)?128:ir(e)?64:E(e)?4:w(e)?2:0;return F(e,t,n,r,i,o,a,!0)}function fa(e){return e?tn(e)||xi(e)?g({},e):e:null}function pa(e,t,n=!1,r=!1){let{props:i,ref:a,patchFlag:o,children:s,transition:c}=e,l=t?va(i||{},t):i,u={__v_isVNode:!0,__v_skip:!0,type:e.type,props:l,key:l&&ca(l),ref:t&&t.ref?n&&a?b(a)?a.concat(la(t)):[a,la(t)]:la(t):a,scopeId:e.scopeId,slotScopeIds:e.slotScopeIds,children:s,target:e.target,targetStart:e.targetStart,targetAnchor:e.targetAnchor,staticCount:e.staticCount,shapeFlag:e.shapeFlag,patchFlag:t&&e.type!==M?o===-1?16:o|16:o,dynamicProps:e.dynamicProps,dynamicChildren:e.dynamicChildren,appContext:e.appContext,dirs:e.dirs,transition:c,component:e.component,suspense:e.suspense,ssContent:e.ssContent&&pa(e.ssContent),ssFallback:e.ssFallback&&pa(e.ssFallback),placeholder:e.placeholder,el:e.el,anchor:e.anchor,ctx:e.ctx,ce:e.ce,cacheIndex:e.cacheIndex};return c&&r&&cr(u,c.clone(u)),u}function I(e=` `,t=0){return ua(Xi,null,e,t)}function ma(e,t){let n=ua(Qi,null,e);return n.staticCount=t,n}function L(e=``,t=!1){return t?(N(),aa(Zi,null,e)):ua(Zi,null,e)}function ha(e){return e==null||typeof e==`boolean`?ua(Zi):b(e)?ua(M,null,e.slice()):oa(e)?ga(e):ua(Xi,null,String(e))}function ga(e){return e.el===null&&e.patchFlag!==-1||e.memo?e:pa(e)}function _a(e,t){let n=0,{shapeFlag:r}=e;if(t==null)t=null;else if(b(t))n=16;else if(typeof t==`object`){if(r&65){let n=t.default;n&&(n._c&&(n._d=!1),_a(e,n()),n._c&&(n._d=!0));return}{n=32;let r=t._;!r&&!xi(t)?t._ctx=Un:r===3&&Un&&(Un.slots._===1?t._=1:(t._=2,e.patchFlag|=1024))}}else if(w(t)){if(r&65){_a(e,{default:t});return}t={default:t,_ctx:Un},n=32}else t=String(t),r&64?(n=16,t=[I(t)]):n=8;e.children=t,e.shapeFlag|=n}function va(...e){let t={};for(let n=0;n<e.length;n++){let r=e[n];for(let e in r)if(e===`class`)t.class!==r.class&&(t.class=O([t.class,r.class]));else if(e===`style`)t.style=be([t.style,r.style]);else if(m(e)){let n=t[e],i=r[e];i&&n!==i&&!(b(n)&&n.includes(i))?t[e]=n?[].concat(n,i):i:i==null&&n==null&&!h(e)&&(t[e]=i)}else e!==``&&(t[e]=r[e])}return t}function ya(e,t,n,r=null){Sn(e,t,7,[n,r])}var ba=ni(),xa=0;function Sa(){return xa}function Ca(e,t,n){let r=e.type,i=(t?t.appContext:e.appContext)||ba,a={uid:xa++,vnode:e,type:r,parent:t,appContext:i,root:null,next:null,subTree:null,effect:null,update:null,job:null,scope:new Ie(!0),render:null,proxy:null,exposed:null,exposeProxy:null,withProxy:null,provides:t?t.provides:Object.create(i.provides),ids:t?t.ids:[``,0,0],accessCache:null,renderCache:[],components:null,directives:null,propsOptions:Di(r,i),emitsOptions:li(r,i),emit:null,emitted:null,propsDefaults:u,inheritAttrs:r.inheritAttrs,ctx:u,data:u,props:u,attrs:u,slots:u,refs:u,setupState:u,setupContext:null,suspense:n,suspenseId:n?n.pendingId:0,asyncDep:null,asyncResolved:!1,isMounted:!1,isUnmounted:!1,isDeactivated:!1,bc:null,c:null,bm:null,m:null,bu:null,u:null,um:null,bum:null,da:null,a:null,rtg:null,rtc:null,ec:null,sp:null};return a.ctx={_:a},a.root=t?t.root:a,a.emit=si.bind(null,a),e.ce&&e.ce(a),a}var wa=null,Ta=()=>wa||Un,Ea,Da;{let e=ye(),t=(t,n)=>{let r;return(r=e[t])||(r=e[t]=[]),r.push(n),e=>{r.length>1?r.forEach(t=>t(e)):r[0](e)}};Ea=t(`__VUE_INSTANCE_SETTERS__`,e=>wa=e),Da=t(`__VUE_SSR_SETTERS__`,e=>ja=e)}var Oa=e=>{let t=wa;return Ea(e),e.scope.on(),()=>{e.scope.off(),Ea(t)}},ka=()=>{wa&&wa.scope.off(),Ea(null)};function Aa(e){return e.vnode.shapeFlag&4}var ja=!1;function Ma(e,t=!1,n=!1){t&&Da(t);let{props:r,children:i}=e.vnode,a=Aa(e);Si(e,r,a,t),Fi(e,i,n||t);let o=a?Na(e,t):void 0;return t&&Da(!1),o}function Na(e,t){let n=e.type;e.accessCache=Object.create(null),e.proxy=new Proxy(e.ctx,zr);let{setup:r}=n;if(r){tt();let n=e.setupContext=r.length>1?La(e):null,i=Oa(e),a=xn(r,e,0,[e.props,n]),o=te(a);if(nt(),i(),(o||e.sp)&&!gr(e)&&dr(e),o){if(a.then(ka,ka),t)return a.then(n=>{Da(!0);try{Pa(e,n,t)}finally{Da(!1)}}).catch(t=>{Cn(t,e,0)});e.asyncDep=a}else Pa(e,a,t)}else Fa(e,t)}function Pa(e,t,n){w(t)?e.type.__ssrInlineRender?e.ssrRender=t:e.render=t:E(t)&&(e.setupState=fn(t)),Fa(e,n)}function Fa(e,t,n){let r=e.type;e.render||=r.render||f;{let t=Oa(e);tt();try{Hr(e)}finally{nt(),t()}}}var Ia={get(e,t){return ft(e,`get`,``),e[t]}};function La(e){return{attrs:new Proxy(e.attrs,Ia),slots:e.slots,emit:e.emit,expose:t=>{e.exposed=t||{}}}}function Ra(e){return e.exposed?e.exposeProxy||=new Proxy(fn(rn(e.exposed)),{get(t,n){if(n in t)return t[n];if(n in Lr)return Lr[n](e)},has(e,t){return t in e||t in Lr}}):e.proxy}function za(e){return w(e)&&`__vccOpts`in e}var R=(e,t)=>mn(e,t,ja);function Ba(e,t,n){try{ra(-1);let r=arguments.length;return r===2?E(t)&&!b(t)?oa(t)?ua(e,null,[t]):ua(e,t):ua(e,null,t):(r>3?n=Array.prototype.slice.call(arguments,2):r===3&&oa(n)&&(n=[n]),ua(e,t,n))}finally{ra(1)}}var Va=`3.5.44`,Ha=void 0,Ua=typeof window<`u`&&window.trustedTypes;if(Ua)try{Ha=Ua.createPolicy(`vue`,{createHTML:e=>e})}catch{}var Wa=Ha?e=>Ha.createHTML(e):e=>e,Ga=`http://www.w3.org/2000/svg`,Ka=`http://www.w3.org/1998/Math/MathML`,qa=typeof document<`u`?document:null,Ja=qa&&qa.createElement(`template`),Ya={insert:(e,t,n)=>{t.insertBefore(e,n||null)},remove:e=>{let t=e.parentNode;t&&t.removeChild(e)},createElement:(e,t,n,r)=>{let i=t===`svg`?qa.createElementNS(Ga,e):t===`mathml`?qa.createElementNS(Ka,e):n?qa.createElement(e,{is:n}):qa.createElement(e);return e===`select`&&r&&r.multiple!=null&&i.setAttribute(`multiple`,r.multiple),i},createText:e=>qa.createTextNode(e),createComment:e=>qa.createComment(e),setText:(e,t)=>{e.nodeValue=t},setElementText:(e,t)=>{e.textContent=t},parentNode:e=>e.parentNode,nextSibling:e=>e.nextSibling,querySelector:e=>qa.querySelector(e),setScopeId(e,t){e.setAttribute(t,``)},insertStaticContent(e,t,n,r,i,a){let o=n?n.previousSibling:t.lastChild;if(i&&(i===a||i.nextSibling))for(;t.insertBefore(i.cloneNode(!0),n),i!==a&&(i=i.nextSibling););else{Ja.innerHTML=Wa(r===`svg`?`<svg>${e}</svg>`:r===`mathml`?`<math>${e}</math>`:e);let i=Ja.content;if(r===`svg`||r===`mathml`){let e=i.firstChild;for(;e.firstChild;)i.appendChild(e.firstChild);i.removeChild(e)}t.insertBefore(i,n)}return[o?o.nextSibling:t.firstChild,n?n.previousSibling:t.lastChild]}},Xa=Symbol(`_vtc`);function Za(e,t,n){let r=e[Xa];r&&(t=(t?[t,...r]:[...r]).join(` `)),t==null?e.removeAttribute(`class`):n?e.setAttribute(`class`,t):e.className=t}var Qa=Symbol(`_vod`),$a=Symbol(`_vsh`),eo={name:`show`,beforeMount(e,{value:t},{transition:n}){e[Qa]=e.style.display===`none`?``:e.style.display,n&&t?n.beforeEnter(e):to(e,t)},mounted(e,{value:t},{transition:n}){n&&t&&n.enter(e)},updated(e,{value:t,oldValue:n},{transition:r}){!t!=!n&&(r?t?(r.beforeEnter(e),to(e,!0),r.enter(e)):r.leave(e,()=>{to(e,!1)}):to(e,t))},beforeUnmount(e,{value:t}){to(e,t)}};function to(e,t){e.style.display=t?e[Qa]:`none`,e[$a]=!t}var no=Symbol(``),ro=/(?:^|;)\s*display\s*:/;function io(e,t,n){let r=e.style,i=T(n),a=!1;if(n&&!i){if(t){if(T(t))for(let e of t.split(`;`)){let t=e.slice(0,e.indexOf(`:`)).trim();n[t]??oo(r,t,``)}else for(let e in t)n[e]??oo(r,e,``)}for(let i in n){i===`display`&&(a=!0);let o=n[i];o==null?oo(r,i,``):uo(e,i,!T(t)&&t?t[i]:void 0,o)||oo(r,i,o)}}else if(i){if(t!==n){let e=r[no];e&&(n+=`;`+e),r.cssText=n,a=ro.test(n)}}else t&&e.removeAttribute(`style`);Qa in e&&(i&&t===n||(e[Qa]=a?r.display:``),e[$a]&&(r.display=`none`))}var ao=/\s*!important$/;function oo(e,t,n){if(b(n))n.forEach(n=>oo(e,t,n));else if(n??=``,t.startsWith(`--`))ao.test(n)?e.setProperty(t,n.replace(ao,``),`important`):e.setProperty(t,n);else{let r=lo(e,t);ao.test(n)?e.setProperty(de(r),n.replace(ao,``),`important`):e[r]=n}}var so=[`Webkit`,`Moz`,`ms`],co={};function lo(e,t){let n=co[t];if(n)return n;let r=le(t);if(r!==`filter`&&r in e)return co[t]=r;r=fe(r);for(let n=0;n<so.length;n++){let i=so[n]+r;if(i in e)return co[t]=i}return t}function uo(e,t,n,r){return e.tagName===`TEXTAREA`&&(t===`width`||t===`height`)&&T(r)&&n===r}var fo=`http://www.w3.org/1999/xlink`;function po(e,t,n,r,i,a=Te(t)){r&&t.startsWith(`xlink:`)?n==null?e.removeAttributeNS(fo,t.slice(6,t.length)):e.setAttributeNS(fo,t,n):n==null||a&&!Ee(n)?e.removeAttribute(t):e.setAttribute(t,a?``:ee(n)?String(n):n)}function mo(e,t,n,r,i){if(t===`innerHTML`||t===`textContent`){n!=null&&(e[t]=t===`innerHTML`?Wa(n):n);return}let a=e.tagName;if(t===`value`&&a!==`PROGRESS`&&!a.includes(`-`)){let r=a===`OPTION`?e.getAttribute(`value`)||``:e.value,i=n==null?e.type===`checkbox`?`on`:``:String(n);r===i&&`_value`in e||(e.value=i),n??e.removeAttribute(t),e._value=n;return}let o=!1;if(n===``||n==null){let r=typeof e[t];r===`boolean`?n=Ee(n):n==null&&r===`string`?(n=``,o=!0):r===`number`&&(n=0,o=!0)}try{e[t]=n}catch{}o&&e.removeAttribute(i||t)}function ho(e,t,n,r){e.addEventListener(t,n,r)}function go(e,t,n,r){e.removeEventListener(t,n,r)}var _o=Symbol(`_vei`);function vo(e,t,n,r,i=null){let a=e[_o]||(e[_o]={}),o=a[t];if(r&&o)o.value=r;else{let[n,s]=xo(t);r?ho(e,n,a[t]=To(r,i),s):o&&(go(e,n,o,s),a[t]=void 0)}}var yo=/(Once|Passive|Capture)$/,bo=/^on:?(?:Once|Passive|Capture)$/;function xo(e){let t,n;for(;(n=e.match(yo))&&!bo.test(e);)t||={},e=e.slice(0,e.length-n[1].length),t[n[1].toLowerCase()]=!0;return[e[2]===`:`?e.slice(3):de(e.slice(2)),t]}var So=0,Co=Promise.resolve(),wo=()=>So||=(Co.then(()=>So=0),Date.now());function To(e,t){let n=e=>{if(!e._vts)e._vts=Date.now();else if(e._vts<=n.attached)return;let r=n.value;if(b(r)){let n=e.stopImmediatePropagation;e.stopImmediatePropagation=()=>{n.call(e),e._stopped=!0};let i=r.slice(),a=[e];for(let n=0;n<i.length&&!e._stopped;n++){let e=i[n];e&&Sn(e,t,5,a)}}else Sn(r,t,5,[e])};return n.value=e,n.attached=wo(),n}var Eo=e=>e.charCodeAt(0)===111&&e.charCodeAt(1)===110&&e.charCodeAt(2)>96&&e.charCodeAt(2)<123,Do=(e,t,n,r,i,a)=>{let o=i===`svg`;t===`class`?Za(e,r,o):t===`style`?io(e,n,r):m(t)?h(t)||vo(e,t,n,r,a):(t[0]===`.`?(t=t.slice(1),1):t[0]===`^`?(t=t.slice(1),0):Oo(e,t,r,o))?(mo(e,t,r),e.tagName.includes(`-`)||t!==`value`&&t!==`checked`&&t!==`selected`||po(e,t,r,o,a,t!==`value`)):e._isVueCE&&(ko(e,t)||e._def.__asyncLoader&&(/[A-Z]/.test(t)||!T(r)))?mo(e,le(t),r,a,t):(t===`true-value`?e._trueValue=r:t===`false-value`&&(e._falseValue=r),po(e,t,r,o))};function Oo(e,t,n,r){if(r)return!!(t===`innerHTML`||t===`textContent`||t in e&&Eo(t)&&w(n));if(t===`spellcheck`||t===`draggable`||t===`translate`||t===`autocorrect`||t===`sandbox`&&e.tagName===`IFRAME`||t===`form`||t===`list`&&e.tagName===`INPUT`||t===`type`&&e.tagName===`TEXTAREA`)return!1;if(t===`width`||t===`height`){let t=e.tagName;if(t===`IMG`||t===`VIDEO`||t===`CANVAS`||t===`SOURCE`)return!1}return Eo(t)&&T(n)?!1:t in e}function ko(e,t){let n=e._def.props;if(!n)return!1;let r=le(t);return Array.isArray(n)?n.some(e=>le(e)===r):Object.keys(n).some(e=>le(e)===r)}var Ao=e=>{let t=e.props[`onUpdate:modelValue`]||!1;return b(t)?e=>he(t,e):t};function jo(e){e.target.composing=!0}function Mo(e){let t=e.target;t.composing&&(t.composing=!1,t.dispatchEvent(new Event(`input`)))}var No=Symbol(`_assign`),Po=Symbol(`_initialValue`);function Fo(e,t,n){return t&&(e=e.trim()),n&&(e=_e(e)),e}var Io={created(e,{modifiers:{lazy:t,trim:n,number:r}},i){e.parentNode&&(e.type===`text`?e[Po]=e.defaultValue.replace(/[\r\n]/g,``):e.type===`textarea`&&(e[Po]=e.defaultValue.replace(/\r\n?/g,`
2
+ `))),e[No]=Ao(i);let a=r||i.props&&i.props.type===`number`;ho(e,t?`change`:`input`,t=>{t.target.composing||e[No](Fo(e.value,n,a))}),(n||a)&&ho(e,`change`,()=>{e.value=Fo(e.value,n,a)}),t||(ho(e,`compositionstart`,jo),ho(e,`compositionend`,Mo),ho(e,`change`,Mo))},mounted(e,{value:t,modifiers:{trim:n,number:r}}){let i=t??``,a=e[Po];delete e[Po],a!==void 0&&(e.type===`text`||e.type===`textarea`)&&e.value!==a?e[No](Fo(e.value,n,r)):e.value=i},beforeUpdate(e,{value:t,oldValue:n,modifiers:{lazy:r,trim:i,number:a}},o){if(e[No]=Ao(o),e.composing)return;let s=(a||e.type===`number`)&&!/^0\d/.test(e.value)?_e(e.value):e.value,c=t??``;if(s===c)return;let l=e.getRootNode();(l instanceof Document||l instanceof ShadowRoot)&&l.activeElement===e&&e.type!==`range`&&(r&&t===n||i&&e.value.trim()===c)||(e.value=c)}},Lo=[`ctrl`,`shift`,`alt`,`meta`],Ro={stop:e=>e.stopPropagation(),prevent:e=>e.preventDefault(),self:e=>e.target!==e.currentTarget,ctrl:e=>!e.ctrlKey,shift:e=>!e.shiftKey,alt:e=>!e.altKey,meta:e=>!e.metaKey,left:e=>`button`in e&&e.button!==0,middle:e=>`button`in e&&e.button!==1,right:e=>`button`in e&&e.button!==2,exact:(e,t)=>Lo.some(n=>e[`${n}Key`]&&!t.includes(n))},zo=(e,t)=>{if(!e)return e;let n=e._withMods||={},r=t.join(`.`);return n[r]||(n[r]=((n,...r)=>{for(let e=0;e<t.length;e++){let r=Ro[t[e]];if(r&&r(n,t))return}return e(n,...r)}))},Bo={esc:`escape`,space:` `,up:`arrow-up`,left:`arrow-left`,right:`arrow-right`,down:`arrow-down`,delete:`backspace`},Vo=(e,t)=>{let n=e._withKeys||={},r=t.join(`.`);return n[r]||(n[r]=(n=>{if(!(`key`in n))return;let r=de(n.key);if(t.some(e=>e===r||Bo[e]===r))return e(n)}))},Ho=g({patchProp:Do},Ya),Uo;function Wo(){return Uo||=Ri(Ho)}var Go=((...e)=>{let t=Wo().createApp(...e),{mount:n}=t;return t.mount=e=>{let r=qo(e);if(!r)return;let i=t._component;w(i)||i.render||i.template||(i.template=r.innerHTML),r.nodeType===1&&(r.textContent=``);let a=n(r,!1,Ko(r));return r instanceof Element&&(r.removeAttribute(`v-cloak`),r.setAttribute(`data-v-app`,``)),a},t});function Ko(e){if(e instanceof SVGElement)return`svg`;if(typeof MathMLElement==`function`&&e instanceof MathMLElement)return`mathml`}function qo(e){return T(e)?document.querySelector(e):e}var Jo={key:0,class:`cepic`},Yo={class:`cid`},Xo=[`title`],Zo=[`title`],Qo={key:0},$o=ur({__name:`ase-task-board-web-client-title`,props:{id:{},epic:{},title:{},edit:{default:``},effort:{default:``}},setup(e){let t={pending:`✎`,active:`✎…`,failed:`✎✗`},n={pending:`edit by prompt requested`,active:`edit by prompt in progress`,failed:`edit by prompt failed (press E to retry)`},r=e=>e.split(/`([^`]+)`/).map((e,t)=>({text:e,code:t%2==1})).filter(e=>e.text!==``);return(i,a)=>(N(),P(M,null,[e.epic!==``&&e.epic!==e.id?(N(),P(`span`,Jo,`♛ `+k(e.epic)+` ▶`,1)):L(``,!0),F(`span`,Yo,k(e.epic===e.id?`♛ `:``)+`≡ `+k(e.id),1),e.edit===``?L(``,!0):(N(),P(`span`,{key:1,class:`cedit`,title:n[e.edit]},k(t[e.edit]),9,Xo)),e.effort===``?L(``,!0):(N(),P(`span`,{key:2,class:`ceffort`,title:`effort: ${e.effort}`},`⚖ `+k(e.effort),9,Zo)),(N(!0),P(M,null,Fr(r(e.title),(e,t)=>(N(),P(M,{key:t},[e.code?(N(),P(`code`,Qo,k(e.text),1)):(N(),P(M,{key:1},[I(k(e.text),1)],64))],64))),128))],64))}}),es={lanes:`task-lanes`,graph:`task-graph`,stats:`statistics`,agents:`agent-logs`,flow:`agent-graph`},ts=e=>e?[`lanes`,`graph`,`stats`,`agents`,`flow`]:[`lanes`,`graph`,`stats`],ns=(e,t)=>{let n=ts(t),r=n.indexOf(e);return`view ${es[n[(r+1)%n.length]]}/${es[n[(r+n.length-1)%n.length]]}`},rs=(e,t,n)=>{let r=[],i=n.collapsed.includes(e.groups[t].title);return e.groups[t].lanes.forEach((e,a)=>{i||n.minimized.includes(e.status)||e.cards.length===0?r.push({g:t,l:a,id:``}):e.cards.forEach(e=>r.push({g:t,l:a,id:e.id}))}),r},is=(e,t,n)=>e.groups.filter(e=>n<e.lanes.length&&!t.collapsed.includes(e.title)).map(e=>e.lanes[n].status),as=(e,t,n)=>{if(t.id!==``)for(let r=0;r<e.groups.length;r++){let i=e.groups[r].lanes.findIndex(e=>e.cards.some(e=>e.id===t.id));if(i>=0)return n.minimized.includes(e.groups[r].lanes[i].status)||n.collapsed.includes(e.groups[r].title)?{g:r,l:i,id:``}:{g:r,l:i,id:t.id}}let r=rs(e,Math.min(t.g,e.groups.length-1),n);return r.find(e=>e.l===t.l)??r[0]},os=new Map,ss=0,cs=A(null),ls=A(Date.now()),us=null;$n(cs,e=>{e!==null&&us===null?us=setInterval(()=>{ls.value=Date.now()},100):e===null&&us!==null&&(clearInterval(us),us=null)});var ds=R(()=>cs.value===null?``:`${(Math.max(0,ls.value-cs.value.since)/1e3).toFixed(1)}s`),fs=(e,t)=>{let n=/\/api\/([a-z]+)/.exec(e)?.[1]??``;if(n===`move`&&typeof t?.body==`string`){let{id:e,status:n}=JSON.parse(t.body);return{text:`moving task`,id:e,suffix:`to ${n}`}}let r={board:`loading tasks`,graph:`loading graph`,flow:`loading agent graph`,stats:`loading statistics`,new:`preparing new task`,toggle:`saving board state`};if(Object.hasOwn(r,n))return{text:r[n]};let i=t?.method??`GET`,a=/\/api\/task\/([^/?]+)\/edit$/.exec(e)?.[1],o=/\/api\/task\/([^/?]+)\/request$/.exec(e)?.[1];if(o!==void 0)return{text:`requesting task`,id:decodeURIComponent(o)};if(a!==void 0)return{text:`loading edit prompt of task`,id:decodeURIComponent(a)};let s=i===`DELETE`?`deleting`:i===`GET`?`loading`:`saving`,c=/\/api\/task\/([^/?]+)/.exec(e)?.[1];return c===void 0?{text:s}:{text:`${s} task`,id:decodeURIComponent(c)}},ps=async(e,t,n=!1)=>{let r=n?0:++ss,i=null;r>0&&(os.set(r,fs(e,t)),i=setTimeout(()=>{cs.value??={label:os.values().next().value??{text:``},since:Date.now()-800}},800));try{return await(await fetch(e,t)).json()}catch(e){return{error:e instanceof Error?e.message:String(e)}}finally{if(r>0){clearTimeout(i),os.delete(r);let e=os.values().next();cs.value!==null&&(cs.value=e.done===!0?null:{...cs.value,label:e.value})}}},z=A(null),ms=A(null),hs=A(null),gs=A(null),B=A(`lanes`),_s=A(``),vs=A(null),ys=A(``),bs=A(null),xs=A(``),V=A(null),Ss=A(null),Cs=A(`total`),H=A(null),U=A({g:0,l:0,id:``}),ws=A(!1),Ts=A(null),Es=A(null),Ds=A(null),Os=A(null),ks=A(null),W=A(null),As=Jt({all:!0,info:``}),js=A(0),Ms=A({}),Ns=Jt({less:!1,more:!1}),Ps=new Map,Fs=A(``),Is=``,Ls=null,Rs=0,zs=0,Bs=0,Vs=0,Hs=0,Us=A(null),Ws=A(null),Gs=A(null),Ks=A(null),qs=A(null),Js=A(null),Ys=A(null),Xs=cn(null),Zs=A(!1),Qs=cn(new Map),$s=e=>{Xs.value=e;let t=new Set(e?.agents.map(e=>e.id)??[]);[...Qs.value.keys()].some(e=>!t.has(e))&&(Qs.value=new Map([...Qs.value].filter(([e])=>t.has(e))))},ec=e=>{let t=new Map(Qs.value);for(let[n,{reset:r,lines:i}]of Object.entries(e))t.set(n,r?i:[...t.get(n)??[],...i].slice(-100));Qs.value=t},tc=R(()=>Xs.value?.agents??[]),nc=A(``),rc=R(()=>tc.value.find(e=>e.id===nc.value)??tc.value[0]??null),ic=A(null),ac=A(!0),oc=e=>{nc.value=e,ac.value=!0},sc=R(()=>z.value?.surface??{view:`lanes`,minimized:[],collapsed:[],titles:!1,keys:!0,standalone:!0}),cc=R(()=>sc.value.titles),lc=R(e=>{let t=new Map;for(let e of Xs.value?.agents??[])for(let n of e.tasks)t.set(n,[...t.get(n)??[],e.name]);return e!==void 0&&JSON.stringify([...e])===JSON.stringify([...t])?e:t}),uc=R(e=>{let t=new Set((Xs.value?.agents??[]).map(e=>e.name));return e!==void 0&&JSON.stringify([...e])===JSON.stringify([...t])?e:t}),dc=(e,t)=>{let n=lc.value.get(e);return n===void 0?t===``?[]:[{icon:uc.value.has(t)?`⚉`:`☺`,name:t}]:n.map(e=>({icon:`⚉`,name:e}))},fc=R(()=>{let e=new Map;for(let t of z.value?.groups??[])for(let n of t.lanes)for(let t of n.cards){let n=dc(t.id,t.assignee);n.length>0&&e.set(t.id,n)}return e}),pc=e=>{let t=Math.max(0,Math.floor(e/1e3));return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m`:t<86400?`${Math.floor(t/3600)}h`:`${Math.floor(t/86400)}d`},mc=e=>e.name===e.kind?e.name:`${e.name} (${e.kind})`,hc=A(Date.now()),gc=null;$n(B,e=>{e===`agents`&&gc===null?(hc.value=Date.now(),gc=setInterval(()=>{hc.value=Date.now()},1e3)):e!==`agents`&&gc!==null&&(clearInterval(gc),gc=null)},{immediate:!0});var _c=1e3,vc=cn(new Map),yc=null;$n(Xs,e=>{let t=Date.now(),n=new Map,r=!1;for(let i of e?.agents??[]){let e=vc.value.get(i.id);e!==void 0&&e.beat===i.beat?n.set(i.id,e):(n.set(i.id,{beat:i.beat,seen:t}),r=!0)}vc.value=n,r&&(hc.value=t,yc!==null&&clearTimeout(yc),yc=setTimeout(()=>{yc=null,hc.value=Date.now()},_c))});var bc=e=>hc.value-(vc.value.get(e)?.seen??0)<_c;$n(()=>[Zs.value,Xs.value,B.value],()=>{Zs.value&&Xs.value===null&&(B.value===`agents`||B.value===`flow`)&&Xc(`lanes`)});var xc=e=>(Xs.value?.agents??[]).filter(t=>`agent:${t.kind}:${t.mode??``}`===e).sort((e,t)=>(e.started??e.since)-(t.started??t.since)),Sc=e=>{let t=xc(e)[0];t!==void 0&&(oc(t.id),Xc(`agents`))},Cc=R(()=>{let e=z.value?.groups[U.value.g];return e!==void 0&&!sc.value.collapsed.includes(e.title)&&!sc.value.minimized.includes(e.lanes[U.value.l]?.status??``)}),wc=R(()=>ws.value&&Cc.value&&B.value===`lanes`);$n(Cc,e=>{e||(ws.value=!1)});var Tc=()=>{let e=Us.value;if(e===null)return;let t=[...e.querySelectorAll(`.group`)],n=t.map((e,t)=>({g:e,i:t})).filter(({g:t})=>t.offsetLeft+t.offsetWidth>e.scrollLeft+1&&t.offsetLeft<e.scrollLeft+e.clientWidth-1);As.all=n.length===t.length,As.info=n.length===0?``:`groups ${n[0].i+1}–${n[n.length-1].i+1} of ${t.length}`},Ec=e=>Us.value?.scrollBy({left:e,behavior:`smooth`});$n([z,B],()=>Mn(Tc),{deep:!0});var Dc=async(e=!1)=>{let t=++Bs,n=await ps(`/task-board/api/graph?filter=${encodeURIComponent(Is)}`,void 0,e);t===Bs&&(_s.value=n.error===void 0?n.svg===``?`<p class="mute">(no tasks)</p>`:n.svg:`<p class="warn">${n.error.replace(/[&<>]/g,e=>`&#${e.charCodeAt(0)};`)}</p>`,vs.value=n.error===void 0?n.stats:null)},Oc=(e,t)=>{let n=[...e?.querySelectorAll(`path.edge`)??[]];for(let e of n)e.classList.toggle(`sel`,t!==``&&(e.dataset.from===t||e.dataset.to===t));let r=n.filter(e=>e.classList.contains(`sel`)),i=n.findLast(e=>!e.classList.contains(`sel`));i!==void 0&&r.length>0&&i.after(...r)},kc=async(e=!1)=>{let t=++Vs,n=await ps(`/task-board/api/flow`,void 0,e);t===Vs&&(ys.value=n.error===void 0?n.svg===``?`<p class="mute">(no agents running)</p>`:n.svg:`<p class="warn">${n.error.replace(/[&<>]/g,e=>`&#${e.charCodeAt(0)};`)}</p>`,bs.value=n.error===void 0?n.stats:null)},Ac=async(e=!1)=>{let t=++Hs,n=await ps(`/task-board/api/stats?filter=${encodeURIComponent(Is)}&range=${Cs.value}`,void 0,e);t===Hs&&(Ss.value=n.error===void 0?null:n.error,n.error===void 0&&(V.value=n))},jc=[{range:`total`,label:`total`},{range:`30d`,label:`within last 30 days`},{range:`7d`,label:`within last 7 days`}],Mc=e=>{e!==Cs.value&&(Cs.value=e,Ac(!0))},Nc=e=>{let t=jc.findIndex(e=>e.range===Cs.value)+e;t>=0&&t<jc.length&&Mc(jc[t].range)},Pc=()=>{let e=Ks.value?.contentWindow??null;H.value!==null&&e!==null&&Ps.set(js.value,e.scrollY)},Fc=async(e,t=!1)=>{if(Ts.value!==null&&Ts.value.id!==e)return;let n=++Rs;Ls===e?Pc():(js.value=0,Ps.clear()),Ls=e;let r=await ps(`/task-board/api/task/${encodeURIComponent(e)}`,void 0,t);if(n!==Rs)return;if(r.error!==void 0){Ts.value===null?zc():Es.value={kind:`error`,message:r.error};return}let i=Math.min(js.value,r.tabs.length-1),a=i>0?await Bc(e,i,t):``;n===Rs&&(Ms.value=i>0?{[i]:a}:{},H.value=r,js.value=i,Mn(Uc))},Ic=e=>{Ls=e},Lc=[],Rc=e=>{Lc.push(e)},zc=()=>{for(let e of Lc)e();Rs++,Ls=null,H.value=null},Bc=async(e,t,n=!1)=>{let r=await ps(`/task-board/api/task/${encodeURIComponent(e)}/attachment/${t-1}/doc`,void 0,n);return r.error===void 0?r.doc:`<p class="warn">${r.error.replace(/[&<>]/g,e=>`&#${e.charCodeAt(0)};`)}</p>`},Vc=async e=>{if(e===0||H.value===null||Ms.value[e]!==void 0)return;let t=H.value.id,n=await Bc(t,e);H.value?.id===t&&(Ms.value[e]=n)},Hc=async e=>{H.value===null||Ts.value!==null||e<0||e>=H.value.tabs.length||e===js.value||(Pc(),js.value=e,Mn(()=>qs.value?.children[e]?.scrollIntoView({block:`nearest`,inline:`nearest`})),await Vc(e))},Uc=()=>{let e=qs.value;e!==null&&(Ns.less=e.scrollLeft>1,Ns.more=e.scrollLeft+e.clientWidth<e.scrollWidth-1)},Wc=async(e=!1)=>{let t=++zs,n=await ps(`/task-board/api/board?filter=${encodeURIComponent(Is)}`,void 0,e);t===zs&&(n.error===void 0?(ms.value=null,z.value===null&&(B.value=n.surface.view),z.value=n,B.value===`graph`?await Dc(e):B.value===`flow`?await kc(e):B.value===`stats`&&await Ac(e||V.value!==null),Ls!==null&&await Fc(Ls,e)):ms.value=n.error)},Gc=null;$n(Fs,e=>{Gc!==null&&clearTimeout(Gc),Gc=setTimeout(()=>{Gc=null,Is=e,Wc()},e===``?0:250)});var Kc=()=>{Fs.value=``,Js.value?.blur()},qc=e=>{if(z.value===null)return;let t=z.value.surface.titles!==e.titles||z.value.surface.standalone!==e.standalone;z.value.surface=e,t&&B.value===`graph`&&Dc()},Jc=async(e,t)=>{let n=await ps(`/task-board/api/toggle`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({list:e,entry:t})});n.error===void 0?(hs.value=null,qc(n)):hs.value=n.error},Yc=(e=!1)=>{let t=ts(Xs.value!==null);Xc(t[(t.indexOf(B.value)+(e?t.length-1:1))%t.length])},Xc=e=>{B.value=e,e!==`lanes`&&(Ys.value=null),e===`graph`?Dc():e===`flow`?kc():e===`stats`&&Ac(V.value!==null),ps(`/task-board/api/view`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({view:e})}).then(e=>{e.error!==void 0&&(hs.value=e.error)})},Zc=null,Qc=null,$c=null,el=A(!1),tl=A(null),nl=()=>{Zc=new EventSource(`/task-board/events`),Zc.addEventListener(`open`,()=>{el.value=!0,Qs.value=new Map,z.value!==null&&Wc(!0)}),Zc.addEventListener(`error`,()=>{el.value=!1,Zc?.readyState===EventSource.CLOSED&&(Zc.close(),$c=setTimeout(nl,5e3))}),Zc.addEventListener(`change`,()=>Wc(!0)),Zc.addEventListener(`surface`,e=>qc(JSON.parse(e.data))),Zc.addEventListener(`store`,e=>{tl.value=JSON.parse(e.data)}),Zc.addEventListener(`agents`,e=>{$s(JSON.parse(e.data)),Zs.value=!0,B.value===`flow`&&kc(!0)}),Zc.addEventListener(`logs`,e=>ec(JSON.parse(e.data)))},rl=()=>{nl(),Qc=setInterval(async()=>{el.value=(await ps(`/task-board/api/ping`,void 0,!0)).error===void 0&&Zc?.readyState===EventSource.OPEN},15e3)},il=()=>{Zc?.close(),$c!==null&&clearTimeout($c),Qc!==null&&clearInterval(Qc),Gc!==null&&clearTimeout(Gc),us!==null&&clearInterval(us),gc!==null&&clearInterval(gc),yc!==null&&clearTimeout(yc)},al=c(o(((e,t)=>{(function(e,n,r){if(!e)return;for(var i={8:`backspace`,9:`tab`,13:`enter`,16:`shift`,17:`ctrl`,18:`alt`,20:`capslock`,27:`esc`,32:`space`,33:`pageup`,34:`pagedown`,35:`end`,36:`home`,37:`left`,38:`up`,39:`right`,40:`down`,45:`ins`,46:`del`,91:`meta`,93:`meta`,224:`meta`},a={106:`*`,107:`+`,109:`-`,110:`.`,111:`/`,186:`;`,187:`=`,188:`,`,189:`-`,190:`.`,191:`/`,192:"`",219:`[`,220:`\\`,221:`]`,222:`'`},o={"~":"`","!":`1`,"@":`2`,"#":`3`,$:`4`,"%":`5`,"^":`6`,"&":`7`,"*":`8`,"(":`9`,")":`0`,_:`-`,"+":`=`,":":`;`,'"':`'`,"<":`,`,">":`.`,"?":`/`,"|":`\\`},s={option:`alt`,command:`meta`,return:`enter`,escape:`esc`,plus:`+`,mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?`meta`:`ctrl`},c,l=1;l<20;++l)i[111+l]=`f`+l;for(l=0;l<=9;++l)i[l+96]=l.toString();function u(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent(`on`+t,n)}function d(e){if(e.type==`keypress`){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return i[e.which]?i[e.which]:a[e.which]?a[e.which]:String.fromCharCode(e.which).toLowerCase()}function f(e,t){return e.sort().join(`,`)===t.sort().join(`,`)}function p(e){var t=[];return e.shiftKey&&t.push(`shift`),e.altKey&&t.push(`alt`),e.ctrlKey&&t.push(`ctrl`),e.metaKey&&t.push(`meta`),t}function m(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function h(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function g(e){return e==`shift`||e==`ctrl`||e==`alt`||e==`meta`}function _(){if(!c)for(var e in c={},i)e>95&&e<112||i.hasOwnProperty(e)&&(c[i[e]]=e);return c}function v(e,t,n){return n||=_()[e]?`keydown`:`keypress`,n==`keypress`&&t.length&&(n=`keydown`),n}function y(e){return e===`+`?[`+`]:(e=e.replace(/\+{2}/g,`+plus`),e.split(`+`))}function b(e,t){var n,r,i,a=[];for(n=y(e),i=0;i<n.length;++i)r=n[i],s[r]&&(r=s[r]),t&&t!=`keypress`&&o[r]&&(r=o[r],a.push(`shift`)),g(r)&&a.push(r);return t=v(r,a,t),{key:r,modifiers:a,action:t}}function x(e,t){return e===null||e===n?!1:e===t||x(e.parentNode,t)}function S(e){var t=this;if(e||=n,!(t instanceof S))return new S(e);t.target=e,t._callbacks={},t._directMap={};var r={},i,a=!1,o=!1,s=!1;function c(e){e||={};var t=!1,n;for(n in r)e[n]?t=!0:r[n]=0;t||(s=!1)}function l(e,n,i,a,o,s){var c,l,u=[],d=i.type;if(!t._callbacks[e])return[];for(d==`keyup`&&g(e)&&(n=[e]),c=0;c<t._callbacks[e].length;++c)if(l=t._callbacks[e][c],(a||!l.seq||r[l.seq]==l.level)&&d==l.action&&(d==`keypress`&&!i.metaKey&&!i.ctrlKey||f(n,l.modifiers))){var p=!a&&l.combo==o,m=a&&l.seq==a&&l.level==s;(p||m)&&t._callbacks[e].splice(c,1),u.push(l)}return u}function _(e,n,r,i){t.stopCallback(n,n.target||n.srcElement,r,i)||e(n,r)===!1&&(m(n),h(n))}t._handleKey=function(e,t,n){var r=l(e,t,n),i,a={},u=0,d=!1;for(i=0;i<r.length;++i)r[i].seq&&(u=Math.max(u,r[i].level));for(i=0;i<r.length;++i)if(r[i].seq){if(r[i].level!=u)continue;d=!0,a[r[i].seq]=1,_(r[i].callback,n,r[i].combo,r[i].seq)}else d||_(r[i].callback,n,r[i].combo);var f=n.type==`keypress`&&o;n.type==s&&!g(e)&&!f&&c(a),o=d&&n.type==`keydown`};function v(e){typeof e.which!=`number`&&(e.which=e.keyCode);var n=d(e);n&&(e.type==`keyup`&&a===n?a=!1:t.handleKey(n,p(e),e))}function y(){clearTimeout(i),i=setTimeout(c,1e3)}function x(e,t,n,i){r[e]=0;function o(t){return function(){s=t,++r[e],y()}}function l(t){_(n,t,e),i!==`keyup`&&(a=d(t)),setTimeout(c,10)}for(var u=0;u<t.length;++u){var f=u+1===t.length?l:o(i||b(t[u+1]).action);C(t[u],f,i,e,u)}}function C(e,n,r,i,a){t._directMap[e+`:`+r]=n,e=e.replace(/\s+/g,` `);var o=e.split(` `),s;o.length>1?x(e,o,n,r):(s=b(e,r),t._callbacks[s.key]=t._callbacks[s.key]||[],l(s.key,s.modifiers,{type:s.action},i,e,a),t._callbacks[s.key][i?`unshift`:`push`]({callback:n,modifiers:s.modifiers,action:s.action,seq:i,level:a,combo:e}))}t._bindMultiple=function(e,t,n){for(var r=0;r<e.length;++r)C(e[r],t,n)},u(e,`keypress`,v),u(e,`keydown`,v),u(e,`keyup`,v)}S.prototype.bind=function(e,t,n){var r=this;return e=e instanceof Array?e:[e],r._bindMultiple.call(r,e,t,n),r},S.prototype.unbind=function(e,t){var n=this;return n.bind.call(n,e,function(){},t)},S.prototype.trigger=function(e,t){var n=this;return n._directMap[e+`:`+t]&&n._directMap[e+`:`+t]({},e),n},S.prototype.reset=function(){var e=this;return e._callbacks={},e._directMap={},e},S.prototype.stopCallback=function(e,t){var n=this;if((` `+t.className+` `).indexOf(` mousetrap `)>-1||x(t,n.target))return!1;if(`composedPath`in e&&typeof e.composedPath==`function`){var r=e.composedPath()[0];r!==e.target&&(t=r)}return t.tagName==`INPUT`||t.tagName==`SELECT`||t.tagName==`TEXTAREA`||t.isContentEditable},S.prototype.handleKey=function(){var e=this;return e._handleKey.apply(e,arguments)},S.addKeycodes=function(e){for(var t in e)e.hasOwnProperty(t)&&(i[t]=e[t]);c=null},S.init=function(){var e=S(n);for(var t in e)t.charAt(0)!==`_`&&(S[t]=function(t){return function(){return e[t].apply(e,arguments)}}(t))},S.init(),e.Mousetrap=S,t!==void 0&&t.exports&&(t.exports=S),typeof define==`function`&&define.amd&&define(function(){return S})})(typeof window<`u`?window:null,typeof window<`u`?document:null)}))(),1),ol=[],sl=[];(()=>{let e=`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 t=0,n=0;t<e.length;t++)(t%2?sl:ol).push(n+=e[t])})();function cl(e){if(e<768)return!1;for(let t=0,n=ol.length;;){let r=t+n>>1;if(e<ol[r])n=r;else if(e>=sl[r])t=r+1;else return!0;if(t==n)return!1}}function ll(e){return e>=127462&&e<=127487}var ul=8205;function dl(e,t,n=!0,r=!0){return(n?fl:pl)(e,t,r)}function fl(e,t,n){if(t==e.length)return t;t&&hl(e.charCodeAt(t))&&gl(e.charCodeAt(t-1))&&t--;let r=ml(e,t);for(t+=_l(r);t<e.length;){let i=ml(e,t);if(r==ul||i==ul||n&&cl(i))t+=_l(i),r=i;else if(ll(i)){let n=0,r=t-2;for(;r>=0&&ll(ml(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function pl(e,t,n){for(;t>1;){let r=fl(e,t-2,n);if(r<t)return r;t--}return 0}function ml(e,t){let n=e.charCodeAt(t);if(!gl(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return hl(r)?(n-55296<<10)+(r-56320)+65536:n}function hl(e){return e>=56320&&e<57344}function gl(e){return e>=55296&&e<56320}function _l(e){return e<65536?1:2}var vl=class e{lineAt(e){if(e<0||e>this.length)throw 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 RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=Ol(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),bl.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Ol(this,e,t);let n=[];return this.decompose(e,t,n,0),bl.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new wl(this),i=new wl(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new wl(this,e)}iterRange(e,t=this.length){return new Tl(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new El(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new yl(t):bl.from(yl.split(t,[]))}},yl=class e extends vl{constructor(e,t=xl(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new Dl(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(Cl(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=Sl(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=Ol(this,t,n);let i=Sl(this.text,Sl(r.text,Cl(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):bl.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`
3
3
  `){[e,t]=Ol(this,e,t);let r=``;for(let i=0,a=0;i<=t&&a<this.text.length;a++){let o=this.text[a],s=i+o.length;i>e&&a&&(r+=n),e<s&&t>i&&(r+=o.slice(Math.max(0,e-i),t-i)),i=s+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let a of t)r.push(a),i+=a.length+1,r.length==32&&(n.push(new e(r,i)),r=[],i=-1);return i>-1&&n.push(new e(r,i)),n}},bl=class e extends vl{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.children[i],o=r+a.length,s=n+a.lines-1;if((t?s:o)>=e)return a.lineInner(e,t,n,r);r=o+1,n=s+1}}decompose(e,t,n,r){for(let i=0,a=0;a<=t&&i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(e<=s&&t>=a){let i=r&(a<=e|(s>=t?2:0));a>=e&&s<=t&&!i?n.push(o):o.decompose(e-a,t-a,n,i)}a=s+1}}replace(t,n,r){if([t,n]=Ol(this,t,n),r.lines<this.lines)for(let i=0,a=0;i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(t>=a&&n<=s){let c=o.replace(t-a,n-a,r),l=this.lines-o.lines+c.lines;if(c.lines<l>>4&&c.lines>l>>6){let a=this.children.slice();return a[i]=c,new e(a,this.length-(n-t)+r.length)}return super.replace(a,s,c)}a=s+1}return super.replace(t,n,r)}sliceString(e,t=this.length,n=`
4
4
  `){[e,t]=Ol(this,e,t);let r=``;for(let i=0,a=0;i<this.children.length&&a<=t;i++){let o=this.children[i],s=a+o.length;a>e&&i&&(r+=n),e<s&&t>a&&(r+=o.sliceString(e-a,t-a,n)),a=s+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,n){if(!(t instanceof e))return 0;let r=0,[i,a,o,s]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,a+=n){if(i==o||a==s)return r;let e=this.children[i],c=t.children[a];if(e!=c)return r+e.scanIdentical(c,n);r+=e.length+1}}static from(t,n=t.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let e=[];for(let n of t)n.flatten(e);return new yl(e,n)}let i=Math.max(32,r>>5),a=i<<1,o=i>>1,s=[],c=0,l=-1,u=[];function d(t){let n;if(t.lines>a&&t instanceof e)for(let e of t.children)d(e);else t.lines>o&&(c>o||!c)?(f(),s.push(t)):t instanceof yl&&c&&(n=u[u.length-1])instanceof yl&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new yl(n.text.concat(t.text),n.length+1+t.length)):(c+t.lines>i&&f(),c+=t.lines,l+=t.length+1,u.push(t))}function f(){c!=0&&(s.push(u.length==1?u[0]:e.from(u,l)),l=-1,c=u.length=0)}for(let e of t)d(e);return f(),s.length==1?s[0]:new e(s,n)}};vl.empty=new yl([``],0);function xl(e){let t=-1;for(let n of e)t+=n.length+1;return t}function Sl(e,t,n=0,r=1e9){for(let i=0,a=0,o=!0;a<e.length&&i<=r;a++){let s=e[a],c=i+s.length;c>=n&&(c>r&&(s=s.slice(0,r-i)),i<n&&(s=s.slice(n-i)),o?(t[t.length-1]+=s,o=!1):t.push(s)),i=c+1}return t}function Cl(e,t,n){return Sl(e,[``],t,n)}var wl=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value=``,this.nodes=[e],this.offsets=[t>0?1:(e instanceof yl?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],a=i>>1,o=r instanceof yl?r.text.length:r.children.length;if(a==(t>0?o:0)){if(n==0)return this.done=!0,this.value=``,this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
5
5
  `,this;e--}else if(r instanceof yl){let i=r.text[a+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=e==0?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[a+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof yl?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},Tl=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new wl(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value=``,this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=``}},El=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value=``,this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value=``,this.afterBreak=!1):t?(this.done=!0,this.value=``):n?this.afterBreak?this.value=``:(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<`u`&&(vl.prototype[Symbol.iterator]=function(){return this.iter()},wl.prototype[Symbol.iterator]=Tl.prototype[Symbol.iterator]=El.prototype[Symbol.iterator]=function(){return this});var Dl=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function Ol(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function kl(e,t,n=!0,r=!0){return dl(e,t,n,r)}function Al(e){return e>=56320&&e<57344}function jl(e){return e>=55296&&e<56320}function Ml(e,t){let n=e.charCodeAt(t);if(!jl(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return Al(r)?(n-55296<<10)+(r-56320)+65536:n}function Nl(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function Pl(e){return e<65536?1:2}var Fl=/\r\n?|\n/,Il=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})(Il||={}),Ll=class e{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let i=this.sections[t++],a=this.sections[t++];a<0?(e(n,r,i),r+=i):r+=a,n+=i}}iterChangedRanges(e,t=!1){Vl(this,e,t)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let n=this.sections[e++],r=this.sections[e++];r<0?t.push(n,r):t.push(r,n)}return new e(t)}composeDesc(e){return this.empty?e:e.empty?this:Ul(this,e)}mapDesc(e,t=!1){return e.empty?this:Hl(this,e,t)}mapPos(e,t=-1,n=Il.Simple){let r=0,i=0;for(let a=0;a<this.sections.length;){let o=this.sections[a++],s=this.sections[a++],c=r+o;if(s<0){if(c>e)return i+(e-r);i+=o}else{if(n!=Il.Simple&&c>=e&&(n==Il.TrackDel&&r<e&&c>e||n==Il.TrackBefore&&r<e||n==Il.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!o)return e==r||t<0?i:i+s;i+=s}r=c}if(e>r)throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let i=this.sections[n++],a=this.sections[n++],o=r+i;if(a>=0&&r<=t&&o>=e)return r<e&&o>t?`cover`:!0;r=o}return!1}toString(){let e=``;for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?` `:``)+n+(r>=0?`:`+r:``)}return e}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!=`number`))throw RangeError(`Invalid JSON representation of ChangeDesc`);return new e(t)}static create(t){return new e(t)}},Rl=class e extends Ll{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError(`Applying change set to a document with the wrong length`);return Vl(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return Hl(this,e,t,!0)}invert(t){let n=this.sections.slice(),r=[];for(let e=0,i=0;e<n.length;e+=2){let a=n[e],o=n[e+1];if(o>=0){n[e]=o,n[e+1]=a;let s=e>>1;for(;r.length<s;)r.push(vl.empty);r.push(a?t.slice(i,i+a):vl.empty)}i+=a}return new e(n,r)}compose(e){return this.empty?e:e.empty?this:Ul(this,e,!0)}map(e,t=!1){return e.empty?this:Hl(this,e,t,!0)}iterChanges(e,t=!1){Vl(this,e,t)}get desc(){return Ll.create(this.sections)}filter(t){let n=[],r=[],i=[],a=new Wl(this);done:for(let e=0,o=0;;){let s=e==t.length?1e9:t[e++];for(;o<s||o==s&&a.len==0;){if(a.done)break done;let e=Math.min(a.len,s-o);zl(i,e,-1);let t=a.ins==-1?-1:a.off==0?a.ins:0;zl(n,e,t),t>0&&Bl(r,n,a.text),a.forward(e),o+=e}let c=t[e++];for(;o<c;){if(a.done)break done;let e=Math.min(a.len,c-o);zl(n,e,-1),zl(i,e,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(e),o+=e}}return{changes:new e(n,r),filtered:Ll.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):r==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(t,n,r){let i=[],a=[],o=0,s=null;function c(t=!1){if(!t&&!i.length)return;o<n&&zl(i,n-o,-1);let r=new e(i,a);s=s?s.compose(r.map(s)):r,i=[],a=[],o=0}function l(t){if(Array.isArray(t))for(let e of t)l(e);else if(t instanceof e){if(t.length!=n)throw RangeError(`Mismatched change set length (got ${t.length}, expected ${n})`);c(),s=s?s.compose(t.map(s)):t}else{let{from:e,to:s=e,insert:l}=t;if(e>s||e<0||s>n)throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${n})`);let u=l?typeof l==`string`?vl.of(l.split(r||Fl)):l:vl.empty,d=u.length;if(e==s&&d==0)return;e<o&&c(),e>o&&zl(i,e-o,-1),zl(i,s-e,d),Bl(a,i,u),o=s}}return l(t),c(!s),s}static empty(t){return new e(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw RangeError(`Invalid JSON representation of ChangeSet`);let n=[],r=[];for(let e=0;e<t.length;e++){let i=t[e];if(typeof i==`number`)n.push(i,-1);else if(!Array.isArray(i)||typeof i[0]!=`number`||i.some((e,t)=>t&&typeof e!=`string`))throw RangeError(`Invalid JSON representation of ChangeSet`);else if(i.length==1)n.push(i[0],0);else{for(;r.length<e;)r.push(vl.empty);r[e]=vl.of(i.slice(1)),n.push(i[0],r[e].length)}}return new e(n,r)}static createSet(t,n){return new e(t,n)}};function zl(e,t,n,r=!1){if(t==0&&n<=0)return;let i=e.length-2;i>=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&t==0&&e[i]==0?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function Bl(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(vl.empty);e.push(n)}}function Vl(e,t,n){let r=e.inserted;for(let i=0,a=0,o=0;o<e.sections.length;){let s=e.sections[o++],c=e.sections[o++];if(c<0)i+=s,a+=s;else{let l=i,u=a,d=vl.empty;for(;l+=s,u+=c,c&&r&&(d=d.append(r[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)s=e.sections[o++],c=e.sections[o++];t(i,l,a,u,d),i=l,a=u}}}function Hl(e,t,n,r=!1){let i=[],a=r?[]:null,o=new Wl(e),s=new Wl(t);for(let e=-1;;)if(o.done&&s.len||s.done&&o.len)throw Error(`Mismatched change set lengths`);else if(o.ins==-1&&s.ins==-1){let e=Math.min(o.len,s.len);zl(i,e,-1),o.forward(e),s.forward(e)}else if(s.ins>=0&&(o.ins<0||e==o.i||o.off==0&&(s.len<o.len||s.len==o.len&&!n))){let t=s.len;for(zl(i,s.ins,-1);t;){let n=Math.min(o.len,t);o.ins>=0&&e<o.i&&o.len<=n&&(zl(i,0,o.ins),a&&Bl(a,i,o.text),e=o.i),o.forward(n),t-=n}s.next()}else if(o.ins>=0){let t=0,n=o.len;for(;n;)if(s.ins==-1){let e=Math.min(n,s.len);t+=e,n-=e,s.forward(e)}else if(s.ins==0&&s.len<n)n-=s.len,s.next();else break;zl(i,t,e<o.i?o.ins:0),a&&e<o.i&&Bl(a,i,o.text),e=o.i,o.forward(o.len-n)}else if(o.done&&s.done)return a?Rl.createSet(i,a):Ll.create(i);else throw Error(`Mismatched change set lengths`)}function Ul(e,t,n=!1){let r=[],i=n?[]:null,a=new Wl(e),o=new Wl(t);for(let e=!1;;)if(a.done&&o.done)return i?Rl.createSet(r,i):Ll.create(r);else if(a.ins==0)zl(r,a.len,0,e),a.next();else if(o.len==0&&!o.done)zl(r,0,o.ins,e),i&&Bl(i,r,o.text),o.next();else if(a.done||o.done)throw Error(`Mismatched change set lengths`);else{let t=Math.min(a.len2,o.len),n=r.length;if(a.ins==-1){let n=o.ins==-1?-1:o.off?0:o.ins;zl(r,t,n,e),i&&n&&Bl(i,r,o.text)}else o.ins==-1?(zl(r,a.off?0:a.len,t,e),i&&Bl(i,r,a.textBit(t))):(zl(r,a.off?0:a.len,o.off?0:o.ins,e),i&&!o.off&&Bl(i,r,o.text));e=(a.ins>t||o.ins>=0&&o.len>t)&&(e||r.length>n),a.forward2(t),o.forward(t)}}var Wl=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?vl.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?vl.empty:t[n].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)}},Gl=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}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(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new e(r,i,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return G.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return G.range(this.anchor,r,void 0,void 0,n)}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 RangeError(`Invalid JSON representation for SelectionRange`);return G.range(e.anchor,e.head)}static create(t,n,r,i){return new e(t,n,r,i)}},G=class e{constructor(e,t){this.ranges=e,this.mainIndex=t}map(t,n=-1){return t.empty?this:e.create(this.ranges.map(e=>e.map(t,n)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new e([this.main],0)}addRange(t,n=!0){return e.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,e.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!=`number`||t.main>=t.ranges.length)throw RangeError(`Invalid JSON representation for EditorSelection`);return new e(t.ranges.map(e=>Gl.fromJSON(e)),t.main)}static single(t,n=t){return new e([e.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw RangeError(`A selection needs at least one range`);for(let r=0,i=0;i<t.length;i++){let a=t[i];if(a.empty?a.from<=r:a.from<r)return e.normalized(t.slice(),n);r=a.to}return new e(t,n)}static cursor(e,t=0,n,r){return Gl.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n)),r)}static range(e,t,n,r,i){let a=r==null?7:Math.min(6,r);return!i&&e!=t&&(i=t<e?1:-1),i&&(a|=i<0?8:16),t<e?Gl.create(t,e,a|32,n):Gl.create(e,t,a,n)}static undirectionalRange(e,t){return Gl.create(e,t,64,void 0)}static normalized(t,n=0){let r=t[n];t.sort((e,t)=>e.from-t.from),n=t.indexOf(r);for(let r=1;r<t.length;r++){let i=t[r],a=t[r-1];if(i.empty?i.from<=a.to:i.from<a.to){let o=a.from,s=Math.max(i.to,a.to);r<=n&&n--,t.splice(--r,2,i.anchor>i.head?e.range(s,o):e.range(o,s))}}return new e(t,n)}};function Kl(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var ql=0,K=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=ql++,this.default=e([]),this.extensions=typeof i==`function`?i(this):i}get reader(){return this}static define(t={}){return new e(t.combine||(e=>e),t.compareInput||((e,t)=>e===t),t.compare||(t.combine?(e,t)=>e===t:Jl),!!t.static,t.enables)}of(e){return new Yl([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new Yl(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new Yl(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function Jl(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var Yl=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=ql++}dynamicSlot(e){let t=this.value,n=this.facet.compareInput,r=this.id,i=e[r]>>1,a=this.type==2,o=!1,s=!1,c=[];for(let t of this.dependencies)t==`doc`?o=!0:t==`selection`?s=!0:(e[t.id]??1)&1||c.push(e[t.id]);return{create(e){return e.values[i]=t(e),1},update(e,r){if(o&&r.docChanged||s&&(r.docChanged||r.selection)||Zl(e,c)){let r=t(e);if(a?!Xl(r,e.values[i],n):!n(r,e.values[i]))return e.values[i]=r,1}return 0},reconfigure:(e,o)=>{let s,c=o.config.address[r];if(c!=null){let r=uu(o,c);if(this.dependencies.every(t=>t instanceof K?o.facet(t)===e.facet(t):t instanceof eu?o.field(t,!1)==e.field(t,!1):!0)||(a?Xl(s=t(e),r,n):n(s=t(e),r)))return e.values[i]=r,0}else s=t(e);return e.values[i]=s,1}}}get extension(){return this}};function Xl(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function Zl(e,t){let n=!1;for(let r of t)lu(e,r)&1&&(n=!0);return n}function Ql(e,t,n){let r=n.map(t=>e[t.id]),i=n.map(e=>e.type),a=r.filter(e=>!(e&1)),o=e[t.id]>>1;function s(e){let n=[];for(let t=0;t<r.length;t++){let a=uu(e,r[t]);if(i[t]==2)for(let e of a)n.push(e);else n.push(a)}return t.combine(n)}return{create(e){for(let t of r)lu(e,t);return e.values[o]=s(e),1},update(e,n){if(!Zl(e,a))return 0;let r=s(e);return t.compare(r,e.values[o])?0:(e.values[o]=r,1)},reconfigure(e,i){let a=Zl(e,r),c=i.config.facets[t.id],l=i.facet(t);if(c&&!a&&Jl(n,c))return e.values[o]=l,0;let u=s(e);return t.compare(u,l)?(e.values[o]=l,0):(e.values[o]=u,1)}}}var $l=K.define({static:!0}),eu=class e{constructor(e,t,n,r,i){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=i,this.provides=void 0}static define(t){let n=new e(ql++,t.create,t.update,t.compare||((e,t)=>e===t),t);return t.provide&&(n.provides=t.provide(n)),n}create(e){return(e.facet($l).find(e=>e.field==this)?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r=e.facet($l),i=n.facet($l),a;return(a=r.find(e=>e.field==this))&&a!=i.find(e=>e.field==this)?(e.values[t]=a.create(e),1):n.config.address[this.id]==null?(e.values[t]=this.create(e),1):(e.values[t]=n.field(this),0)}}}init(e){return[this,$l.of({field:this,create:e})]}get extension(){return this}},tu={lowest:4,low:3,default:2,high:1,highest:0};function nu(e){return t=>new iu(t,e)}var ru={highest:nu(tu.highest),high:nu(tu.high),default:nu(tu.default),low:nu(tu.low),lowest:nu(tu.lowest)},iu=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},au=class e{of(e){return new ou(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},ou=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},su=class e{constructor(e,t,n,r,i,a){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(t,n,r){let i=[],a=Object.create(null),o=new Map;for(let e of cu(t,n,o))e instanceof eu?i.push(e):(a[e.facet.id]||(a[e.facet.id]=[])).push(e);let s=Object.create(null),c=[],l=[];for(let e of i)s[e.id]=l.length<<1,l.push(t=>e.slot(t));let u=r?.config.facets;for(let e in a){let t=a[e],n=t[0].facet,i=u&&u[e]||[];if(t.every(e=>e.type==0)){if(s[n.id]=c.length<<1|1,Jl(i,t))c.push(r.facet(n));else{let e=n.combine(t.map(e=>e.value));c.push(r&&n.compare(e,r.facet(n))?r.facet(n):e)}}else{for(let e of t)e.type==0?(s[e.id]=c.length<<1|1,c.push(e.value)):(s[e.id]=l.length<<1,l.push(t=>e.dynamicSlot(t)));s[n.id]=l.length<<1,l.push(e=>Ql(e,n,t))}}let d=l.map(e=>e(s));return new e(t,o,d,s,c,a)}};function cu(e,t,n){let r=[[],[],[],[],[]],i=new Map;function a(e,o){let s=i.get(e);if(s!=null){if(s<=o)return;let t=r[s].indexOf(e);t>-1&&r[s].splice(t,1),e instanceof ou&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof ou){if(n.has(e.compartment))throw RangeError(`Duplicate use of compartment in extensions`);let r=t.get(e.compartment)||e.inner;n.set(e.compartment,r),a(r,o)}else if(e instanceof iu)a(e.inner,e.prec);else if(e instanceof eu)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof Yl)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,tu.default);else{let t=e.extension;if(!t)throw Error(`Unrecognized extension value in extension set (${e}).`);if(t==e)throw Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(t,o)}}return a(e,tu.default),r.reduce((e,t)=>e.concat(t))}function lu(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw Error(`Cyclic dependency between fields and/or facets`);if(r&2)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function uu(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var du=K.define(),fu=K.define({combine:e=>e.some(e=>e),static:!0}),pu=K.define({combine:e=>e.length?e[0]:void 0,static:!0}),mu=K.define(),hu=K.define(),gu=K.define(),_u=K.define({combine:e=>e.length?e[0]:!1}),vu=class{constructor(e,t){this.type=e,this.value=t}static define(){return new yu}},yu=class{of(e){return new vu(this,e)}},bu=class{constructor(e){this.map=e}of(e){return new xu(this,e)}},xu=class e{constructor(e,t){this.type=e,this.value=t}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new e(this.type,n)}is(e){return this.type==e}static define(e={}){return new bu(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}};xu.reconfigure=xu.define(),xu.appendConfig=xu.define();var Su=class e{constructor(t,n,r,i,a,o){this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,r&&Kl(r,n.newLength),a.some(t=>t.type==e.time)||(this.annotations=a.concat(e.time.of(Date.now())))}static create(t,n,r,i,a,o){return new e(t,n,r,i,a,o)}get newDoc(){return 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(t){let n=this.annotation(e.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]==`.`))}};Su.time=vu.define(),Su.userEvent=vu.define(),Su.addToHistory=vu.define(),Su.remote=vu.define();function Cu(e,t){let n=[];for(let r=0,i=0;;){let a,o;if(r<e.length&&(i==t.length||t[i]>=e[r]))a=e[r++],o=e[r++];else if(i<t.length)a=t[i++],o=t[i++];else return n;!n.length||n[n.length-1]<a?n.push(a,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function wu(e,t,n){let r,i,a;return n?(r=t.changes,i=Rl.empty(t.changes.length),a=e.changes.compose(t.changes)):(r=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),a=e.changes.compose(r)),{changes:a,selection:t.selection?t.selection.map(i):e.selection?.map(r),effects:xu.mapEffects(e.effects,r).concat(xu.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function Tu(e,t,n){let r=t.selection,i=Au(t.annotations);return t.userEvent&&(i=i.concat(Su.userEvent.of(t.userEvent))),{changes:t.changes instanceof Rl?t.changes:Rl.of(t.changes||[],n,e.facet(pu)),selection:r&&(r instanceof G?r:G.single(r.anchor,r.head)),effects:Au(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function Eu(e,t,n){let r=Tu(e,t.length?t[0]:{},e.doc.length);t.length&&t[0].filter===!1&&(n=!1);for(let i=1;i<t.length;i++){t[i].filter===!1&&(n=!1);let a=!!t[i].sequential;r=wu(r,Tu(e,t[i],a?r.changes.newLength:e.doc.length),a)}let i=Su.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return Ou(n?Du(i):i)}function Du(e){let t=e.startState,n=!0;for(let r of t.facet(mu)){let t=r(e);if(t===!1){n=!1;break}Array.isArray(t)&&(n=n===!0?t:Cu(n,t))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=Rl.empty(t.doc.length);else{let t=e.changes.filter(n);r=t.changes,i=t.filtered.mapDesc(t.changes).invertedDesc}e=Su.create(t,r,e.selection&&e.selection.map(i),xu.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(hu);for(let n=r.length-1;n>=0;n--){let i=r[n](e);e=i instanceof Su?i:Array.isArray(i)&&i.length==1&&i[0]instanceof Su?i[0]:Eu(t,Au(i),!1)}return e}function Ou(e){let t=e.startState,n=t.facet(gu),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=wu(r,Tu(t,a,e.changes.newLength),!0))}return r==e?e:Su.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var ku=[];function Au(e){return e==null?ku:Array.isArray(e)?e:[e]}var ju=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(ju||={}),Mu=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Nu;try{Nu=RegExp(`[\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{}function Pu(e){if(Nu)return Nu.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>`€`&&(n.toUpperCase()!=n.toLowerCase()||Mu.test(n)))return!0}return!1}function Fu(e){return t=>{if(!/\S/.test(t))return ju.Space;if(Pu(t))return ju.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return ju.Word;return ju.Other}}var Iu=class e{constructor(e,t,n,r,i,a){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)lu(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw RangeError(`Field is not present in this state`)}else return lu(this,n),uu(this,n)}update(...e){return Eu(this,e,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:i}=n;for(let e of t.effects)e.is(au.reconfigure)?(n&&=(i=new Map,n.compartments.forEach((e,t)=>i.set(t,e)),null),i.set(e.value.compartment,e.value.extension)):e.is(xu.reconfigure)?(n=null,r=e.value):e.is(xu.appendConfig)&&(n=null,r=Au(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=su.resolve(r,i,this),a=new e(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values);let o=t.startState.facet(fu)?t.newSelection:t.newSelection.asSingle();new e(n,t.newDoc,o,a,(e,n)=>n.update(e,t),t)}replaceSelection(e){return typeof e==`string`&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:G.cursor(t.from+e.length,-1)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],a=Au(n.effects);for(let n=1;n<t.ranges.length;n++){let o=e(t.ranges[n]),s=this.changes(o.changes),c=s.map(r);for(let e=0;e<n;e++)i[e]=i[e].map(c);let l=r.mapDesc(s,!0);i.push(o.range.map(l)),r=r.compose(c),a=xu.mapEffects(a,c).concat(xu.mapEffects(Au(o.effects),l))}return{changes:r,selection:G.create(i,t.mainIndex),effects:a}}changes(t=[]){return t instanceof Rl?t:Rl.of(t,this.doc.length,this.facet(e.lineSeparator))}toText(t){return vl.of(t.split(this.facet(e.lineSeparator)||Fl))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(lu(this,t),uu(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof eu&&this.config.address[r.id]!=null&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(t,n={},r){if(!t||typeof t.doc!=`string`)throw RangeError(`Invalid JSON representation for EditorState`);let i=[];if(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(t,e)){let n=r[e],a=t[e];i.push(n.init(e=>n.spec.fromJSON(a,e)))}}return e.create({doc:t.doc,selection:G.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=su.resolve(t.extensions||[],new Map),r=t.doc instanceof vl?t.doc:vl.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||Fl)),i=t.selection?t.selection instanceof G?t.selection:G.single(t.selection.anchor,t.selection.head):G.single(0);return Kl(i,r.length),n.staticFacet(fu)||(i=i.asSingle()),new e(n,r,i,n.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(e.tabSize)}get lineBreak(){return this.facet(e.lineSeparator)||`
6
6
  `}get readOnly(){return this.facet(_u)}phrase(t,...n){for(let n of this.facet(e.phrases))if(Object.prototype.hasOwnProperty.call(n,t)){t=n[t];break}return n.length&&(t=t.replace(/\$(\$|\d*)/g,(e,t)=>{if(t==`$`)return`$`;let r=+(t||1);return!r||r>n.length?e:n[r-1]})),t}languageDataAt(e,t,n=-1){let r=[];for(let i of this.facet(du))for(let a of i(this,t,n))Object.prototype.hasOwnProperty.call(a,e)&&r.push(a[e]);return r}charCategorizer(e){let t=this.languageDataAt(`wordChars`,e);return Fu(t.length?t[0]:``)}wordAt(e){let{text:t,from:n,length:r}=this.doc.lineAt(e),i=this.charCategorizer(e),a=e-n,o=e-n;for(;a>0;){let e=kl(t,a,!1);if(i(t.slice(e,a))!=ju.Word)break;a=e}for(;o<r;){let e=kl(t,o);if(i(t.slice(o,e))!=ju.Word)break;o=e}return a==o?null:G.range(a+n,o+n)}};Iu.allowMultipleSelections=fu,Iu.tabSize=K.define({combine:e=>e.length?e[0]:4}),Iu.lineSeparator=pu,Iu.readOnly=_u,Iu.phrases=K.define({compare(e,t){let n=Object.keys(e),r=Object.keys(t);return n.length==r.length&&n.every(n=>e[n]==t[n])}}),Iu.languageData=du,Iu.changeFilter=mu,Iu.transactionFilter=hu,Iu.transactionExtender=gu,au.reconfigure=xu.define();function Lu(e,t,n={}){let r={};for(let t of e)for(let e of Object.keys(t)){let i=t[e],a=r[e];if(a===void 0)r[e]=i;else if(a!==i&&i!==void 0){if(Object.hasOwnProperty.call(n,e))r[e]=n[e](a,i);else throw Error(`Config merge conflict for field `+e)}}for(let e in t)r[e]===void 0&&(r[e]=t[e]);return r}var Ru=class{eq(e){return this==e}range(e,t=e){return Bu.create(e,t,this)}};Ru.prototype.startSide=Ru.prototype.endSide=0,Ru.prototype.point=!1,Ru.prototype.mapMode=Il.TrackDel;function zu(e,t){return e==t||e.constructor==t.constructor&&e.eq(t)}var Bu=class e{constructor(e,t,n){this.from=e,this.to=t,this.value=n}static create(t,n,r){return new e(t,n,r)}};function Vu(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}var Hu=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return Wu(this.to)}findIndex(e,t,n,r=0){let i=n?this.to:this.from;for(let a=r,o=i.length;;){if(a==o)return a;let r=a+o>>1,s=i[r]-e||(n?this.value[r].endSide:this.value[r].startSide)-t;if(r==a)return s>=0?a:o;s>=0?o=r:a=r+1}}between(e,t,n,r){for(let i=this.findIndex(t,-1e9,!0),a=this.findIndex(n,1e9,!1,i);i<a;i++)if(r(this.from[i]+e,this.to[i]+e,this.value[i])===!1)return!1}map(t,n,r,i,a){let o=[],s=[],c=[],l=-1,u=-1;iter:for(let e=0;e<this.value.length;e++){let d=this.value[e],f=this.from[e]+t,p=this.to[e]+t,m,h;if(f==p){let e=n.mapPos(f,d.startSide,d.mapMode);if(e==null||(m=h=e,d.startSide!=d.endSide&&(h=n.mapPos(f,d.endSide),h<m)))continue}else if(m=n.mapPos(f,d.startSide),h=n.mapPos(p,d.endSide),m>h||m==h&&d.startSide>0&&d.endSide<=0)continue;if(!((h-m||d.endSide-d.startSide)<0)){if(l<0&&(l=m),d.point&&(u=Math.max(u,h-m)),(m-r||d.startSide-i)>=0)o.push(d),s.push(m-l),c.push(h-l),r=h,i=d.endSide;else{if(m==h)for(let e=o.length;e>0;e--){if((m-(c[e-1]+l)||d.startSide-o[e-1].endSide)>=0){o.splice(e,0,d),s.splice(e,0,m-l),c.splice(e,0,h-l);continue iter}if((m-(s[e-1]+l)||d.endSide-o[e-1].startSide)>0)break}a(m,h,d)}}}return{mapped:o.length?new e(s,c,o,u):null,pos:l}}},Uu=class e{constructor(e,t,n,r){this.chunkPos=e,this.chunk=t,this.nextLayer=n,this.maxPoint=r}static create(t,n,r,i){return new e(t,n,r,i)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(t){let{add:n=[],sort:r=!1,filterFrom:i=0,filterTo:a=this.length}=t,o=t.filter;if(n.length==0&&!o)return this;if(r&&(n=n.slice().sort(Vu)),this.isEmpty)return n.length?e.of(n):this;let s=new Ju(this,null,-1).goto(0),c=0,l=[],u=new Ku;for(;s.value||c<n.length;)if(c<n.length&&(s.from-n[c].from||s.startSide-n[c].value.startSide)>=0){let e=n[c++];u.addInner(e.from,e.to,e.value,!1)||l.push(e)}else s.rangeIndex==1&&s.chunkIndex<this.chunk.length&&(c==n.length||this.chunkEnd(s.chunkIndex)<n[c].from)&&(!o||i>this.chunkEnd(s.chunkIndex)||a<this.chunkPos[s.chunkIndex])&&u.addChunk(this.chunkPos[s.chunkIndex],this.chunk[s.chunkIndex])?s.nextChunk():((!o||i>s.to||a<s.from||o(s.from,s.to,s.value))&&(u.addInner(s.from,s.to,s.value,!1)||l.push(Bu.create(s.from,s.to,s.value))),s.next());return u.finishInner(this.nextLayer.isEmpty&&!l.length?e.empty:this.nextLayer.update({add:l,filter:o,filterFrom:i,filterTo:a}))}map(t){if(t.empty||this.isEmpty)return this;let n=[],r=[],i=-1,a,o=(e,t,n)=>{a||=new Ku,a.addRange(e,t,n,!1)};for(let e=0;e<this.chunk.length;e++){let a=this.chunkPos[e],s=this.chunk[e],c=t.touchesRange(a,a+s.length);if(c===!1)i=Math.max(i,s.maxPoint),n.push(s),r.push(t.mapPos(a));else if(c===!0){let[e,c]=n.length?[Wu(r)+Wu(n).length,Wu(Wu(n).value).endSide]:[-1,-1],{mapped:l,pos:u}=s.map(a,t,e,c,o);l&&(i=Math.max(i,l.maxPoint),n.push(l),r.push(u))}}let s=this.nextLayer.map(t);return a&&(s=a.finishInner(s)),n.length==0?s:new e(r,n,s||e.empty,i)}between(e,t,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let i=this.chunkPos[r],a=this.chunk[r];if(t>=i&&e<=i+a.length&&a.between(i,e-i,t-i,n)===!1)return}this.nextLayer.between(e,t,n)}}iter(e=0){return Yu.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Yu.from(e).goto(t)}static compare(e,t,n,r,i=-1){let a=e.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),o=t.filter(e=>e.maxPoint>0||!e.isEmpty&&e.maxPoint>=i),s=qu(a,o,n),c=new Zu(a,s,i),l=new Zu(o,s,i);n.iterGaps((e,t,n)=>Qu(c,e,l,t,n,r)),n.empty&&n.length==0&&Qu(c,0,l,0,0,r)}static eq(e,t,n=0,r){r??=1e9-1;let i=e.filter(e=>!e.isEmpty&&t.indexOf(e)<0),a=t.filter(t=>!t.isEmpty&&e.indexOf(t)<0);if(i.length!=a.length)return!1;if(!i.length)return!0;let o=qu(i,a),s=new Zu(i,o,0).goto(n),c=new Zu(a,o,0).goto(n);for(;;){if(s.to!=c.to||!$u(s.active,c.active)||s.point&&(!c.point||!zu(s.point,c.point)))return!1;if(s.to>r)return!0;s.next(),c.next()}}static spans(e,t,n,r,i=-1){let a=new Zu(e,null,i).goto(t),o=t,s=a.openStart;for(;;){let e=Math.min(a.to,n);if(a.point){let n=a.activeForPoint(a.to),i=a.pointFrom<t?n.length+1:a.point.startSide<0?n.length:Math.min(n.length,s);r.point(o,e,a.point,n,i,a.pointRank),s=Math.min(a.openEnd(e),n.length)}else e>o&&(r.span(o,e,a.active,s),s=a.openEnd(e));if(a.to>n)return s+(a.point&&a.to>n?1:0);o=a.to,a.next()}}static of(e,t=!1){let n=new Ku;for(let r of e instanceof Bu?[e]:t?Gu(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(t){if(!t.length)return e.empty;let n=Wu(t);for(let r=t.length-2;r>=0;r--)for(let i=t[r];i!=e.empty;i=i.nextLayer)n=new e(i.chunkPos,i.chunk,n,Math.max(i.maxPoint,n.maxPoint));return n}};Uu.empty=new Uu([],[],null,-1);function Wu(e){return e[e.length-1]}function Gu(e){if(e.length>1)for(let t=e[0],n=1;n<e.length;n++){let r=e[n];if(Vu(t,r)>0)return e.slice().sort(Vu);t=r}return e}Uu.empty.nextLayer=Uu.empty;var Ku=class e{finishChunk(e){this.chunks.push(new Hu(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,n){this.addRange(e,t,n,!0)}addRange(t,n,r,i){this.addInner(t,n,r,i)||(this.nextLayer||=new e).addRange(t,n,r,i)}addInner(e,t,n,r){let i=e-this.lastTo||n.startSide-this.last.endSide;if(r&&i<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw Error("Ranges must be added sorted by `from` position and `startSide`");return i<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=n,this.lastFrom=e,this.lastTo=t,this.value.push(n),n.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let n=t.value.length-1;return this.last=t.value[n],this.lastFrom=t.from[n]+e,this.lastTo=t.to[n]+e,!0}finish(){return this.finishInner(Uu.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=Uu.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function qu(e,t,n){let r=new Map;for(let t of e)for(let e=0;e<t.chunk.length;e++)t.chunk[e].maxPoint<=0&&r.set(t.chunk[e],t.chunkPos[e]);let i=new Set;for(let e of t)for(let t=0;t<e.chunk.length;t++){let a=r.get(e.chunk[t]);a!=null&&(n?n.mapPos(a):a)==e.chunkPos[t]&&!n?.touchesRange(a,a+e.chunk[t].length)&&i.add(e.chunk[t])}return i}var Ju=class{constructor(e,t,n,r=0){this.layer=e,this.skip=t,this.minPoint=n,this.rank=r}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,n){for(;this.chunkIndex<this.layer.chunk.length;){let t=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(t)||this.layer.chunkEnd(this.chunkIndex)<e||t.maxPoint<this.minPoint))break;this.chunkIndex++,n=!1}if(this.chunkIndex<this.layer.chunk.length){let r=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!n||this.rangeIndex<r)&&this.setRangeIndex(r)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],n=e+t.from[this.rangeIndex];if(this.from=n,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}},Yu=class e{constructor(e){this.heap=e}static from(t,n=null,r=-1){let i=[];for(let e=0;e<t.length;e++)for(let a=t[e];!a.isEmpty;a=a.nextLayer)a.maxPoint>=r&&i.push(new Ju(a,n,r,e));return i.length==1?i[0]:new e(i)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let n of this.heap)n.goto(e,t);for(let e=this.heap.length>>1;e>=0;e--)Xu(this.heap,e);return this.next(),this}forward(e,t){for(let n of this.heap)n.forward(e,t);for(let e=this.heap.length>>1;e>=0;e--)Xu(this.heap,e);(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(),Xu(this.heap,0)}}};function Xu(e,t){for(let n=e[t];;){let r=(t<<1)+1;if(r>=e.length)break;let i=e[r];if(r+1<e.length&&i.compare(e[r+1])>=0&&(i=e[r+1],r++),n.compare(i)<0)break;e[r]=n,e[t]=i,t=r}}var Zu=class{constructor(e,t,n){this.minPoint=n,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=Yu.from(e,t,n)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){ed(this.active,e),ed(this.activeTo,e),ed(this.activeRank,e),this.minActive=nd(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:i}=this.cursor;for(;t<this.activeRank.length&&(i-this.activeRank[t]||r-this.activeTo[t])>0;)t++;td(this.active,t,n),td(this.activeTo,t,r),td(this.activeRank,t,i),e&&td(e,t,this.cursor.from),this.minActive=nd(this.active,this.activeTo)}next(){let e=this.to,t=this.point;this.point=null;let n=this.openStart<0?[]:null;for(;;){let r=this.minActive;if(r>-1&&(this.activeTo[r]-this.cursor.from||this.active[r].endSide-this.cursor.startSide)<0){if(this.activeTo[r]>e){this.to=this.activeTo[r],this.endSide=this.active[r].endSide;break}this.removeActive(r),n&&ed(n,r)}else if(!this.cursor.value){this.to=this.endSide=1e9;break}else if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let e=this.cursor.value;if(!e.point)this.addActive(n),this.cursor.next();else if(t&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=e,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=e.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}}if(n){this.openStart=0;for(let t=n.length-1;t>=0&&n[t]<e;t--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let n=this.active.length-1;n>=0&&!(this.activeRank[n]<this.pointRank);n--)(this.activeTo[n]>e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}};function Qu(e,t,n,r,i,a){e.goto(t),n.goto(r);let o=r+i,s=r,c=r-t,l=!!a.boundChange;for(let t=!1;;){let r=e.to+c-n.to,i=r||e.endSide-n.endSide,u=i<0?e.to+c:n.to,d=Math.min(u,o);if(e.point||n.point?(e.point&&n.point&&zu(e.point,n.point)&&$u(e.activeForPoint(e.to),n.activeForPoint(n.to))||a.comparePoint(s,d,e.point,n.point),t=!1):(t&&=(a.boundChange(s),!1),d>s&&!$u(e.active,n.active)&&a.compareRange(s,d,e.active,n.active),l&&d<o&&(r||e.openEnd(u)!=n.openEnd(u))&&(t=!0)),u>o)break;s=u,i<=0&&e.next(),i>=0&&n.next()}}function $u(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!=t[n]&&!zu(e[n],t[n]))return!1;return!0}function ed(e,t){for(let n=t,r=e.length-1;n<r;n++)e[n]=e[n+1];e.pop()}function td(e,t,n){for(let n=e.length-1;n>=t;n--)e[n+1]=e[n];e[t]=n}function nd(e,t){let n=-1,r=1e9;for(let i=0;i<t.length;i++)(t[i]-r||e[i].endSide-e[n].endSide)<0&&(n=i,r=t[i]);return n}function rd(e,t,n=e.length){let r=0;for(let i=0;i<n&&i<e.length;)e.charCodeAt(i)==9?(r+=t-r%t,i++):(r++,i=kl(e,i));return r}function id(e,t,n,r){for(let r=0,i=0;;){if(i>=t)return r;if(r==e.length)break;i+=e.charCodeAt(r)==9?n-i%n:1,r=kl(e,r)}return r===!0?-1:e.length}for(var ad=`ͼ`,od=typeof Symbol>`u`?`__ͼ`:Symbol.for(ad),sd=typeof Symbol>`u`?`__styleSet`+Math.floor(Math.random()*1e8):Symbol(`styleSet`),cd=typeof globalThis<`u`?globalThis:typeof window<`u`?window:{},ld=class{constructor(e,t){this.rules=[];let{finish:n}=t||{};function r(e){return/^@/.test(e)?[e]:e.split(/,\s*/)}function i(e,t,a,o){let s=[],c=/^@(\w+)\b/.exec(e[0]),l=c&&c[1]==`keyframes`;if(c&&t==null)return a.push(e[0]+`;`);for(let n in t){let o=t[n];if(/&/.test(n))i(n.split(/,\s*/).map(t=>e.map(e=>t.replace(/&/,e))).reduce((e,t)=>e.concat(t)),o,a);else if(o&&typeof o==`object`){if(!c)throw RangeError(`The value of a property (`+n+`) should be a primitive value.`);i(r(n),o,s,l)}else o!=null&&s.push(n.replace(/_.*/,``).replace(/[A-Z]/g,e=>`-`+e.toLowerCase())+`: `+o+`;`)}(s.length||l)&&a.push((n&&!c&&!o?e.map(n):e).join(`, `)+` {`+s.join(` `)+`}`)}for(let t in e)i(r(t),e[t],this.rules)}getRules(){return this.rules.join(`
7
7
  `)}static newName(){let e=cd[od]||1;return cd[od]=e+1,ad+e.toString(36)}static mount(e,t,n){let r=e[sd],i=n&&n.nonce;r?i&&r.setNonce(i):r=new dd(e,i),r.mount(Array.isArray(t)?t:[t],e)}},ud=new Map,dd=class{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=ud.get(n);if(t)return e[sd]=t;this.sheet=new r.CSSStyleSheet,ud.set(n,this)}else this.styleTag=n.createElement(`style`),t&&this.styleTag.setAttribute(`nonce`,t);this.modules=[],e[sd]=this}mount(e,t){let n=this.sheet,r=0,i=0,a=!1;for(let t=0;t<e.length;t++){let o=e[t],s=this.modules.indexOf(o);if(s<i&&s>-1&&(this.modules.splice(s,1),a=!0,i--,s=-1),s==-1){if(this.modules.splice(i++,0,o),a=!0,n)for(let e=0;e<o.rules.length;e++)n.insertRule(o.rules[e],r++)}else{for(;i<s;)r+=this.modules[i++].rules.length;r+=o.rules.length,i++}}if(n)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{if(a){let e=``;for(let t=0;t<this.modules.length;t++)e+=this.modules[t].getRules()+`
8
- `;this.styleTag.textContent=e}let e=t.head||t;this.styleTag.parentNode!=e&&e.insertBefore(this.styleTag,e.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute(`nonce`)!=e&&this.styleTag.setAttribute(`nonce`,e)}},fd={8:`Backspace`,9:`Tab`,10:`Enter`,12:`NumLock`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,44:`PrintScreen`,45:`Insert`,46:`Delete`,59:`;`,61:`=`,91:`Meta`,92:`Meta`,106:`*`,107:`+`,108:`,`,109:`-`,110:`.`,111:`/`,144:`NumLock`,145:`ScrollLock`,160:`Shift`,161:`Shift`,162:`Control`,163:`Control`,164:`Alt`,165:`Alt`,173:`-`,186:`;`,187:`=`,188:`,`,189:`-`,190:`.`,191:`/`,192:"`",219:`[`,220:`\\`,221:`]`,222:`'`},pd={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},md=typeof navigator<`u`&&/Mac/.test(navigator.platform),hd=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),gd=0;gd<10;gd++)fd[48+gd]=fd[96+gd]=String(gd);for(var gd=1;gd<=24;gd++)fd[gd+111]=`F`+gd;for(var gd=65;gd<=90;gd++)fd[gd]=String.fromCharCode(gd+32),pd[gd]=String.fromCharCode(gd);for(var _d in fd)pd.hasOwnProperty(_d)||(pd[_d]=fd[_d]);function vd(e){var t=!(md&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||hd&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?pd:fd)[e.keyCode]||e.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 yd(){var e=arguments[0];typeof e==`string`&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&typeof n==`object`&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i==`string`?e.setAttribute(r,i):i!=null&&(e[r]=i)}t++}for(;t<arguments.length;t++)bd(e,arguments[t]);return e}function bd(e,t){if(typeof t==`string`)e.appendChild(document.createTextNode(t));else if(t!=null){if(t.nodeType!=null)e.appendChild(t);else if(Array.isArray(t))for(var n=0;n<t.length;n++)bd(e,t[n]);else throw RangeError(`Unsupported child node: `+t)}}var xd=typeof navigator<`u`?navigator:{userAgent:``,vendor:``,platform:``},Sd=typeof document<`u`?document:{documentElement:{style:{}}},Cd=/Edge\/(\d+)/.exec(xd.userAgent),wd=/MSIE \d/.test(xd.userAgent),Td=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(xd.userAgent),Ed=!!(wd||Td||Cd),Dd=!Ed&&/gecko\/(\d+)/i.test(xd.userAgent),Od=!Ed&&/Chrome\/(\d+)/.exec(xd.userAgent),kd=`webkitFontSmoothing`in Sd.documentElement.style,Ad=!Ed&&/Apple Computer/.test(xd.vendor),jd=Ad&&(/Mobile\/\w+/.test(xd.userAgent)||xd.maxTouchPoints>2),q={mac:jd||/Mac/.test(xd.platform),windows:/Win/.test(xd.platform),linux:/Linux|X11/.test(xd.platform),ie:Ed,ie_version:wd?Sd.documentMode||6:Td?+Td[1]:Cd?+Cd[1]:0,gecko:Dd,gecko_version:Dd?+(/Firefox\/(\d+)/.exec(xd.userAgent)||[0,0])[1]:0,chrome:!!Od,chrome_version:Od?+Od[1]:0,ios:jd,android:/Android\b/.test(xd.userAgent),webkit:kd,webkit_version:kd?+(/\bAppleWebKit\/(\d+)/.exec(xd.userAgent)||[0,0])[1]:0,safari:Ad,safari_version:Ad?+(/\bVersion\/(\d+(\.\d+)?)/.exec(xd.userAgent)||[0,0])[1]:0,tabSize:Sd.documentElement.style.tabSize==null?`-moz-tab-size`:`tab-size`};function Md(e,t){for(let n in e)n==`class`&&t.class?t.class+=` `+e.class:n==`style`&&t.style?t.style+=`;`+e.style:t[n]=e[n];return t}var Nd=Object.create(null);function Pd(e,t,n){if(e==t)return!0;e||=Nd,t||=Nd;let r=Object.keys(e),i=Object.keys(t);if(r.length-0!=i.length-0)return!1;for(let a of r)if(a!=n&&(i.indexOf(a)==-1||e[a]!==t[a]))return!1;return!0}function Fd(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;t[r]??e.removeAttribute(r)}for(let n in t){let r=t[n];n==`style`?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}function Id(e,t,n){let r=!1;if(t)for(let i in t)n&&i in n||(r=!0,i==`style`?e.style.cssText=``:e.removeAttribute(i));if(n)for(let i in n)t&&t[i]==n[i]||(r=!0,i==`style`?e.style.cssText=n[i]:e.setAttribute(i,n[i]));return r}function Ld(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}var Rd=class{eq(e){return!1}updateDOM(e,t,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},zd=(function(e){return e[e.Text=0]=`Text`,e[e.WidgetBefore=1]=`WidgetBefore`,e[e.WidgetAfter=2]=`WidgetAfter`,e[e.WidgetRange=3]=`WidgetRange`,e})(zd||={}),Bd=class extends Ru{constructor(e,t,n,r){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new Vd(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Ud(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:i,end:a}=Wd(e,t);n=(i?t?-3e8:-1:5e8)-1,r=(a?t?2e8:1:-6e8)+1}return new Ud(e,n,r,t,e.widget||null,!0)}static line(e){return new Hd(e)}static set(e,t=!1){return Uu.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};Bd.none=Uu.empty;var Vd=class e extends Bd{constructor(e){let{start:t,end:n}=Wd(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||`span`,this.attrs=e.class&&e.attributes?Md(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Nd}eq(t){return this==t||t instanceof e&&this.tagName==t.tagName&&Pd(this.attrs,t.attrs)}range(e,t=e){if(e>=t)throw RangeError(`Mark decorations may not be empty`);return super.range(e,t)}};Vd.prototype.point=!1;var Hd=class e extends Bd{constructor(e){super(-2e8,-2e8,null,e)}eq(t){return t instanceof e&&this.spec.class==t.spec.class&&Pd(this.spec.attributes,t.spec.attributes)}range(e,t=e){if(t!=e)throw RangeError(`Line decoration ranges must be zero-length`);return super.range(e,t)}};Hd.prototype.mapMode=Il.TrackBefore,Hd.prototype.point=!0;var Ud=class e extends Bd{constructor(e,t,n,r,i,a){super(t,n,i,e),this.block=r,this.isReplace=a,this.mapMode=r?t<=0?Il.TrackBefore:Il.TrackAfter:Il.TrackDel}get type(){return this.startSide==this.endSide?this.startSide<=0?zd.WidgetBefore:zd.WidgetAfter:zd.WidgetRange}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof e&&Gd(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw RangeError(`Invalid range for replacement decoration`);if(!this.isReplace&&t!=e)throw RangeError(`Widget decorations can only have zero-length ranges`);return super.range(e,t)}};Ud.prototype.point=!0;function Wd(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n??=e.inclusive,r??=e.inclusive,{start:n??t,end:r??t}}function Gd(e,t){return e==t||!!(e&&t&&e.compare(t))}function Kd(e,t,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=e?n[i]=Math.max(n[i],t):n.push(e,t)}var qd=class e extends Ru{constructor(e,t,n){super(),this.tagName=e,this.attributes=t,this.rank=n}eq(t){return t==this||t instanceof e&&this.tagName==t.tagName&&Pd(this.attributes,t.attributes)}static create(t){return new e(t.tagName,t.attributes||Nd,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(e,t=!1){return Uu.of(e,t)}};qd.prototype.startSide=qd.prototype.endSide=-1;var Jd=e=>e.nodeType==1,Yd=e=>e.nodeType==3;function Xd(e){let t;return t=e.nodeType==11?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function Zd(e,t){return t?e==t||e.contains(t.nodeType==1?t:t.parentNode):!1}function Qd(e,t){if(!t.anchorNode)return!1;try{return Zd(e,t.anchorNode)}catch{return!1}}function $d(e){return Yd(e)?_f(e,0,e.nodeValue.length).getClientRects():Jd(e)?e.getClientRects():[]}function ef(e,t,n,r){return n?rf(e,t,n,r,-1)||rf(e,t,n,r,1):!1}function tf(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function nf(e){return Jd(e)&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function rf(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:af(e))){if(e.nodeName==`DIV`)return!1;let n=e.parentNode;if(!n||!Jd(n))return!1;t=tf(e)+(i<0?0:1),e=n}else if(Jd(e)){if(e=e.childNodes[t+(i<0?-1:0)],Jd(e)&&(e.nodeName==`IMG`||e.nodeName==`BR`||e.contentEditable==`false`))return!1;t=i<0?af(e):0}else return!1}}function af(e){return Yd(e)?e.nodeValue.length:e.childNodes.length}function of(e,t){let{left:n,right:r}=e;if(n==r)return e;let i=t?n:r;return{left:i,right:i,top:e.top,bottom:e.bottom}}function sf(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function cf(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function lf(e,t,n,r,i,a,o,s){let c=e.ownerDocument,l=c.defaultView||window;for(let u=e,d=!1;u&&!d;)if(Jd(u)){let e,f=u==c.body,p=1,m=1,h=!0,g=!0;if(f)e=sf(l);else{let t=getComputedStyle(u);if(/^(fixed|sticky)$/.test(t.position)&&(d=!0),(u.scrollHeight<=u.clientHeight||!/auto|scroll/.test(t.overflowY))&&(g=!1),(u.scrollWidth<=u.clientWidth||!/auto|scroll/.test(t.overflowX))&&(h=!1),!h&&!g){u=u.assignedSlot||u.parentNode;continue}let n=u.getBoundingClientRect();({scaleX:p,scaleY:m}=cf(u,n)),e={left:n.left,right:n.left+u.clientWidth*p,top:n.top,bottom:n.top+u.clientHeight*m}}let _=0,v=0;if(g){if(i==`nearest`)t.top<e.top+o?(v=t.top-(e.top+o),n>0&&t.bottom>e.bottom+v&&(v=t.bottom-e.bottom+o)):t.bottom>e.bottom-o&&(v=t.bottom-e.bottom+o,n<0&&t.top-v<e.top&&(v=t.top-(e.top+o)));else{let r=t.bottom-t.top,a=e.bottom-e.top;v=(i==`center`&&r<=a?t.top+r/2-a/2:i==`start`||i==`center`&&n<0?t.top-o:t.bottom-a+o)-e.top}}if(h&&(r==`nearest`?t.left<e.left+a?(_=t.left-(e.left+a),n>0&&t.right>e.right+_&&(_=t.right-e.right+a)):t.right>e.right-a&&(_=t.right-e.right+a,n<0&&t.left<e.left+_&&(_=t.left-(e.left+a))):_=(r==`center`?t.left+(t.right-t.left)/2-(e.right-e.left)/2:r==`start`==s?t.left-a:t.right-(e.right-e.left)+a)-e.left),_||v){if(f)l.scrollBy(_,v);else{let e=0,n=0;if(v){let e=u.scrollTop;u.scrollTop+=v/m,n=(u.scrollTop-e)*m}if(_){let t=u.scrollLeft;u.scrollLeft+=_/p,e=(u.scrollLeft-t)*p}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&Math.abs(e-_)<1&&(r=`nearest`),n&&Math.abs(n-v)<1&&(i=`nearest`)}}if(f)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function uf(e,t=!0){let n=e.ownerDocument,r=null,i=null;for(let a=e.parentNode;a&&!(a==n.body||(!t||r)&&i);)if(Jd(a))!i&&a.scrollHeight>a.clientHeight&&/scroll|auto/.test(getComputedStyle(a).overflowY)&&(i=a),t&&!r&&a.scrollWidth>a.clientWidth&&/scroll|auto/.test(getComputedStyle(a).overflowX)&&(r=a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;return{x:r,y:i}}var df=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?af(t):0),n,Math.min(e.focusOffset,n?af(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}};function ff(e){let t=[];for(let n=e;n;n=n.nodeType==11?n.host:n.parentNode)Jd(n)&&t.push({node:n,left:n.scrollLeft,top:n.scrollTop});return t}function pf(e,t=!0){for(let{node:n,left:r,top:i}of e)t&&n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}var mf=null;q.safari&&q.safari_version>=26&&(mf=!1);function hf(e){if(e.setActive)return e.setActive();if(mf)return e.focus(mf);let t=ff(e);e.focus(mf==null?{get preventScroll(){return mf={preventScroll:!0},!0}}:void 0),mf||(mf=!1,pf(t))}var gf;function _f(e,t,n=t){let r=gf||=document.createRange();return r.setEnd(e,n),r.setStart(e,t),r}function vf(e,t,n,r){let i={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let a=new KeyboardEvent(`keydown`,i);a.synthetic=!0,e.dispatchEvent(a);let o=new KeyboardEvent(`keyup`,i);return o.synthetic=!0,e.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented}function yf(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function bf(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,af(n));;)if(r){if(!Jd(n))return!1;let e=n.childNodes[r-1];e.contentEditable==`false`?r--:(n=e,r=af(n))}else if(n==e)return!0;else r=tf(n),n=n.parentNode}function xf(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function Sf(e,t){for(let n=e,r=t;;)if(Yd(n)&&r>0)return{node:n,offset:r};else if(Jd(n)&&r>0){if(n.contentEditable==`false`)return null;n=n.childNodes[r-1],r=af(n)}else if(n.parentNode&&!nf(n))r=tf(n),n=n.parentNode;else return null}function Cf(e,t){for(let n=e,r=t;;)if(Yd(n)&&r<n.nodeValue.length)return{node:n,offset:r};else if(Jd(n)&&r<n.childNodes.length){if(n.contentEditable==`false`)return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!nf(n))r=tf(n)+1,n=n.parentNode;else return null}var wf=class e{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(t,n){return new e(t.parentNode,tf(t),n)}static after(t,n){return new e(t.parentNode,tf(t)+1,n)}},Tf=(function(e){return e[e.LTR=0]=`LTR`,e[e.RTL=1]=`RTL`,e})(Tf||={}),Ef=Tf.LTR,Df=Tf.RTL;function Of(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<e[n]);return t}var kf=Of(`88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008`),Af=Of(`4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333`),jf=Object.create(null),Mf=[];for(let e of[`()`,`[]`,`{}`]){let t=e.charCodeAt(0),n=e.charCodeAt(1);jf[t]=n,jf[n]=-t}function Nf(e){return e<=247?kf[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?Af[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}var Pf=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,Ff=class{get dir(){return this.level%2?Df:Ef}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,r){let i=-1;for(let a=0;a<e.length;a++){let o=e[a];if(o.from<=t&&o.to>=t){if(o.level==n)return a;(i<0||(r==0?e[i].level>o.level:r<0?o.from<t:o.to>t))&&(i=a)}}if(i<0)throw RangeError(`Index out of range`);return i}};function If(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!If(r.inner,i.inner))return!1}return!0}var Lf=[];function Rf(e,t,n,r,i){for(let a=0;a<=r.length;a++){let o=a?r[a-1].to:t,s=a<r.length?r[a].from:n,c=a?256:i;for(let t=o,n=c,r=c;t<s;t++){let i=Nf(e.charCodeAt(t));i==512?i=n:i==8&&r==4&&(i=16),Lf[t]=i==4?2:i,i&7&&(r=i),n=i}for(let e=o,t=c,r=c;e<s;e++){let i=Lf[e];if(i==128)e<s-1&&t==Lf[e+1]&&t&24?i=Lf[e]=t:Lf[e]=256;else if(i==64){let i=e+1;for(;i<s&&Lf[i]==64;)i++;let a=e&&t==8||i<n&&Lf[i]==8?r==1?1:8:256;for(let t=e;t<i;t++)Lf[t]=a;e=i-1}else i==8&&r==1&&(Lf[e]=1);t=i,i&7&&(r=i)}}}function zf(e,t,n,r,i){let a=i==1?2:1;for(let o=0,s=0,c=0;o<=r.length;o++){let l=o?r[o-1].to:t,u=o<r.length?r[o].from:n;for(let t=l,n,r,o;t<u;t++)if(r=jf[n=e.charCodeAt(t)]){if(r<0){for(let e=s-3;e>=0;e-=3)if(Mf[e+1]==-r){let n=Mf[e+2],r=n&2?i:n&4?n&1?a:i:0;r&&(Lf[t]=Lf[Mf[e]]=r),s=e;break}}else if(Mf.length==189)break;else Mf[s++]=t,Mf[s++]=n,Mf[s++]=c}else if((o=Lf[t])==2||o==1){let e=o==i;c=+!e;for(let t=s-3;t>=0;t-=3){let n=Mf[t+2];if(n&2)break;if(e)Mf[t+2]|=2;else{if(n&4)break;Mf[t+2]|=4}}}}}function Bf(e,t,n,r){for(let i=0,a=r;i<=n.length;i++){let o=i?n[i-1].to:e,s=i<n.length?n[i].from:t;for(let c=o;c<s;){let o=Lf[c];if(o==256){let o=c+1;for(;;)if(o==s){if(i==n.length)break;o=n[i++].to,s=i<n.length?n[i].from:t}else if(Lf[o]==256)o++;else break;let l=a==1,u=l==((o<t?Lf[o]:r)==1)?l?1:2:r;for(let t=o,r=i,a=r?n[r-1].to:e;t>c;)t==a&&(t=n[--r].from,a=r?n[r-1].to:e),Lf[--t]=u;c=o}else a=o,c++}}}function Vf(e,t,n,r,i,a,o){let s=r%2?2:1;if(r%2==i%2)for(let c=t,l=0;c<n;){let t=!0,u=!1;if(l==a.length||c<a[l].from){let e=Lf[c];e!=s&&(t=!1,u=e==16)}let d=!t&&s==1?[]:null,f=t?r:r+1,p=c;run:for(;;)if(l<a.length&&p==a[l].from){if(u)break run;let m=a[l];if(!t)for(let e=m.to,t=l+1;;){if(e==n)break run;if(t<a.length&&a[t].from==e)e=a[t++].to;else if(Lf[e]==s)break run;else break}l++,d?d.push(m):(m.from>c&&o.push(new Ff(c,m.from,f)),Hf(e,m.direction==Ef==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.to),p=m.to}else if(p==n||(t?Lf[p]!=s:Lf[p]==s))break;else p++;d?Vf(e,c,p,r+1,i,d,o):c<p&&o.push(new Ff(c,p,f)),c=p}else for(let c=n,l=a.length;c>t;){let n=!0,u=!1;if(!l||c>a[l-1].to){let e=Lf[c-1];e!=s&&(n=!1,u=e==16)}let d=!n&&s==1?[]:null,f=n?r:r+1,p=c;run:for(;;)if(l&&p==a[l-1].to){if(u)break run;let m=a[--l];if(!n)for(let e=m.from,n=l;;){if(e==t)break run;if(n&&a[n-1].to==e)e=a[--n].from;else if(Lf[e-1]==s)break run;else break}d?d.push(m):(m.to<c&&o.push(new Ff(m.to,c,f)),Hf(e,m.direction==Ef==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.from),p=m.from}else if(p==t||(n?Lf[p-1]!=s:Lf[p-1]==s))break;else p--;d?Vf(e,p,c,r+1,i,d,o):p<c&&o.push(new Ff(p,c,f)),c=p}}function Hf(e,t,n,r,i,a,o){let s=t%2?2:1;Rf(e,i,a,r,s),zf(e,i,a,r,s),Bf(i,a,r,s),Vf(e,i,a,t,n,r,o)}function Uf(e,t,n){if(!e)return[new Ff(0,0,+(t==Df))];if(t==Ef&&!n.length&&!Pf.test(e))return Wf(e.length);if(n.length)for(;e.length>Lf.length;)Lf[Lf.length]=256;let r=[],i=t==Ef?0:1;return Hf(e,i,i,n,0,e.length,r),r}function Wf(e){return[new Ff(0,e,0)]}var Gf=``;function Kf(e,t,n,r,i){if(!e.length)return null;let a=r.head-e.from,o;if(r.head==e.from&&r.assoc<0){if(!i)return null;a=t[o=0].side(!1,n)}else if(r.head==e.to&&r.assoc>0){if(i)return null;a=t[o=t.length-1].side(!0,n)}else o=Ff.find(t,a,r.bidiLevel??-1,r.assoc);let s=t[o],c=s.side(i,n);if(a==c){let e=o+=i?1:-1;if(e<0||e>=t.length)return null;s=t[o=e],a=s.side(!i,n),c=s.side(i,n)}let l=kl(e.text,a,s.forward(i,n));(l<s.from||l>s.to)&&(l=c),Gf=e.text.slice(Math.min(a,l),Math.max(a,l));let u=o==(i?t.length-1:0)?null:t[o+(i?1:-1)];if(l==c){if(!u)return i?G.cursor(e.to,1):G.cursor(e.from,-1);if(u.level+ +!i<s.level)return G.cursor(u.side(!i,n)+e.from,u.forward(i,n)?1:-1,u.level)}return G.cursor(l+e.from,s.forward(i,n)?-1:1,s.level)}function qf(e,t,n){for(let r=t;r<n;r++){let t=Nf(e.charCodeAt(r));if(t==1)return Ef;if(t==2||t==4)return Df}}var Jf=K.define(),Yf=K.define(),Xf=K.define(),Zf=K.define(),Qf=K.define(),$f=K.define(),ep=K.define(),tp=K.define(),np=K.define(),rp=K.define({combine:e=>e.some(e=>e)}),ip=K.define({combine:e=>e.some(e=>e)}),ap=K.define(),op=class e{constructor(e,t,n,r,i,a=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=i,this.isSnapshot=a}map(t){return t.empty?this:new e(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new e(G.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},sp=xu.define({map:(e,t)=>e.map(t)}),cp=xu.define();function lp(e,t,n){let r=e.facet(Zf);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+`:`,t):console.error(t))}var up=K.define({combine:e=>!e.length||e[0]}),dp=0,fp=K.define({combine(e){return e.filter((t,n)=>{for(let r=0;r<n;r++)if(e[r].plugin==t.plugin)return!1;return!0})}}),pp=class e{constructor(e,t,n,r,i){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(fp.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(fp.of({plugin:this,arg:e}))}static define(t,n){let{eventHandlers:r,eventObservers:i,provide:a,decorations:o}=n||{};return new e(dp++,t,r,i,e=>{let t=[];return o&&t.push(_p.of(t=>{let n=t.plugin(e);return n?o(n):Bd.none})),a&&t.push(a(e)),t})}static fromClass(t,n){return e.define((e,n)=>new t(e,n),n)}},mp=class{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.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){lp(e.state,t,`CodeMirror plugin crashed`),this.deactivate()}}else if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(lp(e.state,t,`CodeMirror plugin crashed`),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}return this}destroy(e){if(this.value?.destroy)try{this.value.destroy()}catch(t){lp(e.state,t,`CodeMirror plugin crashed`)}}deactivate(){this.spec=this.value=null}},hp=K.define(),gp=K.define(),_p=K.define(),vp=K.define(),yp=K.define(),bp=K.define(),xp=K.define();function Sp(e,t){let n=e.state.facet(xp);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return Uu.spans(r,t.from,t.to,{point(){},span(e,n,r,a){let o=e-t.from,s=n-t.from,c=i;for(let e=r.length-1;e>=0;e--,a--){let t=r[e].spec.bidiIsolate,n;if(a>0&&c.length&&(n=c[c.length-1]).to==o&&n.direction==t)n.to=s,c=n.inner;else{let e={from:o,to:s,direction:t,inner:[]};c.push(e),c=e.inner}}}}),Cp(t.text,i)}function Cp(e,t){for(let n of t){if(n.direction==null){for(let t=n.from,r=0;t<n.to;r++){let i=r<n.inner.length?n.inner[r]:null,a=qf(e,t,i?i.from:n.to);if(a){n.direction=a;break}if(!i)break;t=i.to}n.direction??=Tf.LTR}Cp(e,n.inner)}return t}var wp=K.define();function Tp(e){let t=0,n=0,r=0,i=0;for(let a of e.state.facet(wp)){let o=a(e);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:t,right:n,top:r,bottom:i}}var Ep=K.define(),Dp=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(t){return new e(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(t,n){if(n.length==0)return t;let r=[];for(let i=0,a=0,o=0;;){let s=i<t.length?t[i].fromB:1e9,c=a<n.length?n[a]:1e9,l=Math.min(s,c);if(l==1e9)break;let u=l+o,d=l,f=u;for(;;)if(a<n.length&&n[a]<=d){let e=n[a+1];a+=2,d=Math.max(d,e);for(let e=i;e<t.length&&t[e].fromB<=d;e++)o=t[e].toA-t[e].toB;f=Math.max(f,e+o)}else if(i<t.length&&t[i].fromB<=d){let e=t[i++];d=Math.max(d,e.toB),f=Math.max(f,e.toA),o=e.toA-e.toB}else break;r.push(new e(u,f,l,d))}return r}},Op=class e{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Rl.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let r=[];this.changes.iterChangedRanges((e,t,n,i)=>r.push(new Dp(e,t,n,i))),this.changedRanges=r}static create(t,n,r){return new e(t,n,r)}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}},kp=[],Ap=class{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return kp}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 e=this.domAttrs;e&&Fd(this.dom,e)}}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 n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw RangeError(`Invalid child in posBefore`)}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,n){return null}domPosFor(e,t){let n=tf(this.dom),r=this.length?e>0:t>0;return new wf(this.parent.dom,n+ +!!r,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 Np)return e;return null}static get(e){return e.cmTile}},jp=class extends Ap{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,n=null,r,i=e?.node==t?e:null,a=0;for(let o of this.children){if(o.sync(e),a+=o.length+o.breakAfter,r=n?n.nextSibling:t.firstChild,i&&r!=o.dom&&(i.written=!0),o.dom.parentNode==t)for(;r&&r!=o.dom;)r=Mp(r);else t.insertBefore(o.dom,r);n=o.dom}for(r=n?n.nextSibling:t.firstChild,i&&r&&(i.written=!0);r;)r=Mp(r);this.length=a}};function Mp(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var Np=class extends jp{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=Ap.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,r=0,i=0;;)if(r==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&i++,r=t.pop()}else{let a=n.children[r++];if(a instanceof Pp)t.push(r),n=a,r=0;else{let t=i+a.length,n=e(a,i);if(n!==void 0)return n;i=t+a.breakAfter}}}resolveBlock(e,t){let n,r=-1,i,a=-1;if(this.blockTiles((o,s)=>{let c=s+o.length;if(e>=s&&e<=c){if(o.isWidget()&&t>=-1&&t<=1){if(o.flags&32)return!0;o.flags&16&&(n=void 0)}(s<e||e==c&&(t<-1?o.length:o.covers(1)))&&(!n||!o.isWidget()&&n.isWidget())&&(n=o,r=e-s),(c>e||e==s&&(t>1?o.length:o.covers(-1)))&&(!i||!o.isWidget()&&i.isWidget())&&(i=o,a=e-s)}}),!n&&!i)throw Error(`No tile at position `+e);return n&&t<0||!i?{tile:n,offset:r}:{tile:i,offset:a}}},Pp=class e extends jp{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(t,n){let r=new e(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}},Fp=class e extends jp{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(t,n,r){let i=new e(n||document.createElement(`div`),t);return(!n||!r)&&(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,n=!1){let r=null,i=-1,a=null,o=-1;function s(e,c){for(let l=0,u=0;l<e.children.length&&u<=c;l++){let d=e.children[l],f=u+d.length;f>=c&&(d.isComposite()?s(d,c-u):(!a||n&&a.isHidden&&(t>0&&!(a.flags&32)||n&&Lp(a,d)))&&(f>c||d.flags&32&&t<=1)?(a=d,o=c-u):(u<c||d.flags&16&&!(n&&d.isHidden)&&t>=-1)&&(r=d,i=c-u)),u=f}}s(this,e);let c=(t<0?r:a)||r||a;return c?{tile:c,offset:c==r?i:o}:null}coordsIn(e,t,n){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),t,n):Ip(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:e,offset:r}=n;if(this.dom.contains(e.dom))return e.isText()?new wf(e.dom,Math.min(e.dom.nodeValue.length,r)):e.domPosFor(r,e.flags&16?1:e.flags&32?-1:t);let i=n.tile.parent,a=!1;for(let e of i.children){if(a)return new wf(e.dom,0);e==n.tile&&(a=!0)}}return new wf(this.dom,0)}};function Ip(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=$d(t);return n[n.length-1]||null}function Lp(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}var Rp=class e extends jp{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(t,n){let r=new e(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}},zp=class e extends Ap{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t,n){let r=this.dom.nodeValue.length;e>r&&(e=r);let i=e,a=e,o=0;e==0&&t<0||e==r&&t>=0?q.chrome||q.gecko||(e?(i--,o=1):a<r&&(a++,o=-1)):t<0?i--:a<r&&a++;let s=_f(this.dom,i,a).getClientRects();if(!s.length)return null;let c=s[(o?o<0:t>=0)?0:s.length-1];return q.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(s,e=>e.width)||c),n==null?c:of(c,(o?o>0:t<0)==n)}static of(t,n){let r=new e(n||document.createTextNode(t),t);return n||(r.flags|=2),r}},Bp=class e extends Ap{constructor(e,t,n,r){super(e,t,r),this.widget=n}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,n){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(n)return of(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let t=this.dom.getClientRects(),n=null;if(!t.length)return null;let r=this.flags&16?!0:this.flags&32?!1:e>0;for(let i=r?t.length-1:0;n=t[i],!(e>0?i==0:i==t.length-1||n.top<n.bottom);i+=r?-1:1);return of(n,!r)}}get overrideDOMText(){if(!this.length)return vl.empty;let{root:e}=this;if(!e)return vl.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,n,r,i,a){return a||(a=t.toDOM(n),t.editable||(a.contentEditable=`false`)),new e(a,r,t,i)}},Vp=class extends Ap{constructor(e){let t=document.createElement(`img`);t.className=`cm-widgetBuffer`,t.setAttribute(`aria-hidden`,`true`),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return vl.empty}coordsIn(e,t,n){let r=this.dom.getBoundingClientRect();return n==null?r:of(r,t>0==n)}},Hp=class{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:r,index:i,beforeBreak:a,parents:o}=this;for(;e||t>0;)if(!r.isComposite()){let t=r.length;if(i<t&&e){let a=Math.min(e,t-i);n&&n.skip(r,i,i+a),e-=a,i+=a}if(i==t)a=!!r.breakAfter,{tile:r,index:i}=o.pop(),i++;else if(!e)break}else if(a){if(!e)break;n&&n.break(),e--,a=!1}else if(i==r.children.length){if(!e&&!o.length)break;n&&n.leave(r),a=!!r.breakAfter,{tile:r,index:i}=o.pop(),i++}else{let s=r.children[i],c=s.breakAfter;(t>0?s.length<=e:s.length<e)&&(!n||n.skip(s,0,s.length)!==!1||!s.isComposite)?(a=!!c,i++,e-=s.length):(o.push({tile:r,index:i}),r=s,i=0,n&&s.isComposite()&&n.enter(s))}return this.tile=r,this.index=i,this.beforeBreak=a,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}},Up=class{constructor(e,t,n,r){this.from=e,this.to=t,this.wrapper=n,this.rank=r}},Wp=class{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,r){this.flushBuffer();let i=this.ensureMarks(t,n),a=i.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+e.length<512){this.cache.reused.set(a,2);let t=i.children[i.children.length-1]=new zp(a.dom,a.text+e);t.parent=i}else i.append(r||zp.of(e,this.cache.find(zp)?.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?em(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=n;for(let e=t.marks.length-1;e>=0;e--){let n=t.marks[e],i=r.lastChild;if(i instanceof Rp&&i.mark.eq(n.mark))i.dom!=n.dom&&i.setDOM(em(n.dom)),r=i;else{let{dom:e}=n;this.cache.reused.get(n)&&Ap.get(n.dom)&&(e=em(n.dom));let t=Rp.of(n.mark,e);r.append(t),r=t}this.cache.reused.set(n,2)}let i=Ap.get(e.text);i&&this.cache.reused.set(i,2);let a=new zp(e.text,e.text.nodeValue);a.flags|=8,this.pos=e.range.toB,r.append(a)}addInlineWidget(e,t,n){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let i=this.ensureMarks(t,n);!r&&!(e.flags&16)&&i.append(this.getBuffer(1)),i.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).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){e||=Zp;let n=Fp.start(e,t||this.cache.find(Fp)?.dom,!!t);this.getBlockPos().append(this.lastBlock=this.curLine=n)}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){let n=this.curLine;for(let r=e.length-1;r>=0;r--){let i=e[r],a;if(t>0&&(a=n.lastChild)&&a instanceof Rp&&a.mark.eq(i))n=a,t--;else{let e=Rp.of(i,this.cache.find(Rp,e=>e.mark.eq(i))?.dom);n.append(e),n=e,t=0}}return n}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!Yp(this.curLine,!1)||e.dom.nodeName!=`BR`&&e.isWidget()&&!(q.ios&&Yp(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(nm,0,32)||new Bp(nm.toDOM(),0,nm,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&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,n=new Up(e.from,e.to,e.value,t),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-n.rank||this.wrappers[r-1].to-n.to)<0;)r--;this.wrappers.splice(r,0,n)}this.wrapperPos=this.pos}getBlockPos(){this.updateBlockWrappers();let e=this.root;for(let t of this.wrappers){let n=e.lastChild;if(t.from<this.pos&&n instanceof Pp&&n.wrapper.eq(t.wrapper))e=n;else{let n=Pp.of(t.wrapper,this.cache.find(Pp,e=>e.wrapper.eq(t.wrapper))?.dom);e.append(n),e=n}}return e}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),n=this.cache.find(Vp,void 0,1);return n&&(n.flags=t),n||new Vp(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},Gp=class{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:t,lineBreak:n,done:r}=this.cursor.next(this.skipCount);if(this.skipCount=0,r)throw Error(`Ran out of text content when drawing inline views`);this.text=t;let i=this.textOff=Math.min(e,t.length);return n?null:t.slice(0,i)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}},Kp=[Bp,Fp,zp,Rp,Vp,Pp,Np];for(let e=0;e<Kp.length;e++)Kp[e].bucket=e;var qp=class{constructor(e){this.view=e,this.buckets=Kp.map(()=>[]),this.index=Kp.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let r=e.bucket,i=this.buckets[r],a=this.index[r];for(let e=0;e<i.length;e++){let o=(e+a)%i.length,s=i[o];if((!t||t(s))&&!this.reused.has(s))return i.splice(o,1),o<a&&this.index[r]--,this.reused.set(s,n),s}return null}findWidget(e,t,n){let r=this.buckets[0];if(r.length)for(let i=0,a=0;;i++){if(i==r.length){if(a)return null;a=1,i=0}let o=r[i];if(!this.reused.has(o)&&(a==0?o.widget.compare(e):o.widget.constructor==e.constructor&&e.updateDOM(o.dom,this.view,o.widget)))return r.splice(i,1),i<this.index[0]&&this.index[0]--,o.widget==e&&o.length==t&&(o.flags&497)==n?(this.reused.set(o,1),o):(this.reused.set(o,2),new Bp(o.dom,t,e,o.flags&-498|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}},Jp=class{constructor(e,t,n,r,i){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new qp(e),this.text=new Gp(e.state.doc),this.builder=new Wp(this.cache,new Np(e,e.contentDOM),Uu.iter(n)),this.cache.reused.set(t,2),this.old=new Hp(t),this.reuseWalker={skip:(e,t,n)=>{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let r=0,i=0,a=0;;){let o=a<e.length?e[a++]:null,s=o?o.fromA:this.old.root.length;if(s>r){let e=s-r;this.preserve(e,!a,!o),r=s,i+=e}if(!o)break;t&&o.fromA<=t.range.fromA&&o.toA>=t.range.toA?(this.forward(o.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(i,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,o.toA),this.emit(t.range.toB,o.toB)):(this.forward(o.fromA,o.toA),this.emit(i,o.toB)),i=o.toB,r=o.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let r=$p(this.old),i=this.openMarks;this.old.advance(e,n?1:-1,{skip:(e,t,n)=>{if(e.isWidget()){if(this.openWidget)this.builder.continueWidget(n-t);else{let a=n>0||t<e.length?Bp.of(e.widget,this.view,n-t,e.flags&496,this.cache.maybeReuse(e)):this.cache.reuse(e);a.flags&256?(a.flags&=-2,this.builder.addBlockWidget(a)):(this.builder.ensureLine(null),this.builder.addInlineWidget(a,r,i),i=r.length)}}else if(e.isText())this.builder.ensureLine(null),!t&&n==e.length&&!this.cache.reused.has(e)?this.builder.addText(e.text,r,i,this.cache.reuse(e)):(this.cache.add(e),this.builder.addText(e.text.slice(t,n),r,i)),i=r.length;else if(e.isLine())e.flags&=-2,this.cache.reused.set(e,1),this.builder.addLine(e);else if(e instanceof Vp)this.cache.add(e);else if(e instanceof Rp)this.builder.ensureLine(null),this.builder.addMark(e,r,i),this.cache.reused.set(e,1),i=r.length;else return!1;this.openWidget=!1},enter:e=>{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof Rp&&r.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?r.length&&=i=0:e instanceof Rp&&(r.shift(),i=Math.min(i,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,i=-1,a=Uu.spans(this.decorations,e,t,{point:(e,t,a,o,s,c)=>{if(a instanceof Ud){if(this.disallowBlockEffectsFor[c]){if(a.block)throw RangeError(`Block decorations may not be specified via plugins`);if(t>this.view.state.doc.lineAt(e).to)throw RangeError(`Decorations that replace line breaks may not be specified via plugins`)}if(i=o.length,s>o.length)r.continueWidget(t-e);else{let i=a.widget||(a.block?tm.block:tm.inline),c=Xp(a),l=this.cache.findWidget(i,t-e,c)||Bp.of(i,this.view,t-e,c);a.block?(a.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(l)):(r.ensureLine(n),r.addInlineWidget(l,o,s))}n=null}else n=Qp(n,a);t>e&&this.text.skip(t-e)},span:(e,t,a,o)=>{for(let i=e;i<t;){let s=this.text.next(Math.min(512,t-i));s==null?(r.addLineStartIfNotCovered(n),r.addBreak(),i++):(r.ensureLine(n),r.addText(s,a,i==e?o:a.length),i+=s.length),n=null}i=a.length}});i>-1&&(this.openWidget=a>i),this.openWidget||r.addLineStartIfNotCovered(n),this.openMarks=a}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let e=Ap.get(r);if(r==this.view.contentDOM)break;e instanceof Rp?t.push(e):e?.isLine()?n=e:e instanceof Pp||(r.nodeName==`DIV`&&!n?n=new Fp(r,Zp):n||t.push(Rp.of(new Vd({tagName:r.nodeName.toLowerCase(),attributes:Ld(r)}),r)))}return n?{line:n,marks:t}:null}};function Yp(e,t){let n=e=>{for(let r of e.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}function Xp(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}var Zp={class:`cm-line`};function Qp(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||={class:`cm-line`},n&&Md(n,e),r&&(e.class+=` `+r)),e}function $p(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof Rp&&t.push(r.mark)}return t}function em(e){let t=Ap.get(e);return t&&t.setDOM(e.cloneNode()),e}var tm=class extends Rd{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}};tm.inline=new tm(`span`),tm.block=new tm(`div`);var nm=new class extends Rd{toDOM(){return document.createElement(`br`)}get isHidden(){return!0}get editable(){return!0}},rm=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Bd.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 Np(e,e.contentDOM),this.updateInner([new Dp(0,0,0,e.state.doc.length)],null)}update(e){let t=e.changedRanges;this.minWidth>0&&t.length&&(t.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.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 n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(this.domChanged?.newSel?n=this.domChanged.newSel.head:!mm(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let r=n>-1?sm(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){let{from:n,to:r}=this.hasComposition;t=new Dp(n,r,e.changes.mapPos(n,-1),e.changes.mapPos(r,1)).addToSet(t.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(q.ie||q.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,a=this.blockWrappers;this.updateDeco();let o=um(i,this.decorations,e.changes);o.length&&(t=Dp.extendWithRanges(t,o));let s=fm(a,this.blockWrappers,e.changes);return s.length&&(t=Dp.extendWithRanges(t,s)),r&&!t.some(e=>e.fromA<=r.range.fromA&&e.toA>=r.range.toA)&&(t=r.range.addToSet(t.slice())),this.tile.flags&2&&t.length==0?!1:(this.updateInner(t,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let n=this.tile,r=new Jp(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&Ap.get(t.text)&&r.cache.reused.set(Ap.get(t.text),2),this.tile=r.run(e,t),im(n,r.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 r=q.chrome||q.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),r&&(r.written||n.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node))&&(this.forceSelection=!0),this.tile.dom.style.height=``});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.tile.children)e.isWidget()&&e.widget instanceof hm&&r.push(e.dom);n.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(cp)&&(this.editContextFormatting=e.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:n}=this.tile,r=this.view.root.activeElement,i=r==n,a=!i&&!(this.view.state.facet(up)||n.tabIndex>-1)&&Qd(n,this.view.observer.selectionRange)&&!(r&&n.contains(r));if(!(i||t||a))return;let o=this.forceSelection;this.forceSelection=!1;let s=this.view.state.selection.main,c,l;if(s.empty?l=c=this.inlineDOMNearPos(s.anchor,s.assoc||1):(l=this.inlineDOMNearPos(s.head,s.head==s.from?1:-1),c=this.inlineDOMNearPos(s.anchor,s.anchor==s.from?1:-1)),q.gecko&&s.empty&&!this.hasComposition&&am(c)){let e=document.createTextNode(``);this.view.observer.ignore(()=>c.node.insertBefore(e,c.node.childNodes[c.offset]||null)),c=l=new wf(e,0),o=!0}let u=this.view.observer.selectionRange;(o||!u.focusNode||(!ef(c.node,c.offset,u.anchorNode,u.anchorOffset)||!ef(l.node,l.offset,u.focusNode,u.focusOffset))&&!this.suppressWidgetCursorChange(u,s))&&(this.view.observer.ignore(()=>{q.android&&q.chrome&&n.contains(u.focusNode)&&pm(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=Xd(this.view.root);if(e){if(s.empty){if(q.gecko){let e=cm(c.node,c.offset);if(e&&e!=3){let t=(e==1?Sf:Cf)(c.node,c.offset);t&&(c=new wf(t.node,t.offset))}}e.collapse(c.node,c.offset),s.bidiLevel!=null&&e.caretBidiLevel!==void 0&&(e.caretBidiLevel=s.bidiLevel)}else if(e.extend){e.collapse(c.node,c.offset);try{e.extend(l.node,l.offset)}catch{}}else{let t=document.createRange();s.anchor>s.head&&([c,l]=[l,c]),t.setEnd(l.node,l.offset),t.setStart(c.node,c.offset),e.removeAllRanges(),e.addRange(t)}}a&&this.view.root.activeElement==n&&(n.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,l)),this.impreciseAnchor=c.precise?null:new wf(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new wf(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&ef(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,n=Xd(e.root),{anchorNode:r,anchorOffset:i}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let a=this.lineAt(t.head,t.assoc);if(!a)return;let o=a.posAtStart;if(t.head==o||t.head==o+a.length)return;let s=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!s||!c||s.bottom>c.top)return;let l=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(l.node,l.offset),n.modify(`move`,t.assoc<0?`forward`:`backward`,`lineboundary`),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&n.collapse(r,i)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=n.posAtStart;if(n.isComposite()){let i;if(e==n.dom)i=n.dom.childNodes[t];else{let r=af(e)==0?0:t==0?-1:1;for(;;){let t=e.parentNode;if(t==n.dom)break;r==0&&t.firstChild!=t.lastChild&&(r=e==t.firstChild?-1:1),e=t}i=r<0?e:e.nextSibling}if(i==n.dom.firstChild)return r;for(;i&&!Ap.get(i);)i=i.nextSibling;if(!i)return r+n.length;for(let e=0,t=r;;e++){let r=n.children[e];if(r.dom==i)return t;t+=r.length+r.breakAfter}}else if(n.isText())return e==n.dom?r+t:r+(t?n.length:0);else return r}domAtPos(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(r,t):n.domIn(r,t)}inlineDOMNearPos(e,t){let n,r=-1,i=!1,a,o=-1,s=!1;return this.tile.blockTiles((t,c)=>{if(t.isWidget()){if(t.flags&32&&c>=e)return!0;t.flags&16&&(i=!0)}else{let l=c+t.length;if(c<=e&&(n=t,r=e-c,i=l<e),l>=e&&!a&&(a=t,o=e-c,s=c>e),c>e&&a)return!0}}),!n&&!a?this.domAtPos(e,t):(i&&a?n=null:s&&n&&(a=null),n&&t<0||!a?n.domIn(r,t):a.domIn(o,t))}coordsAt(e,t,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof hm?null:r.coordsInWidget(i,t,!0):r.coordsIn(i,t,n)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(e,t){if(e.isComposite())for(let n of e.children){if(n.length>=t){let e=r(n,t);if(e)return e}if(t-=n.length,t<0)break}else if(e.isText()&&t<e.length){let n=kl(e.text,t);if(n==t)return null;let r=_f(e.dom,t,n).getClientRects();for(let e=0;e<r.length;e++){let t=r[e];if(e==r.length-1||t.top<t.bottom&&t.left<t.right)return t}}return null}return r(t,n)}measureVisibleLineHeights(e){let t=[],{from:n,to:r}=e,i=this.view.contentDOM.clientWidth,a=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,s=this.view.textDirection==Tf.LTR,c=0,l=(e,u,d)=>{for(let f=0;f<e.children.length&&!(u>r);f++){let r=e.children[f],p=u+r.length,m=r.dom.getBoundingClientRect(),{height:h}=m;if(d&&!f&&(c+=m.top-d.top),r instanceof Pp)p>n&&l(r,u,m);else if(u>=n&&(c>0&&t.push(-c),t.push(h+c),c=0,a)){let e=r.dom.lastChild,t=e?$d(e):[];if(t.length){let e=t[t.length-1],n=s?e.right-m.left:m.right-e.left;n>o&&(o=n,this.minWidth=i,this.minWidthFrom=u,this.minWidthTo=p)}}d&&f==e.children.length-1&&(c+=d.bottom-m.bottom),u=p+r.breakAfter}};return l(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction==`rtl`?Tf.RTL:Tf.LTR}measureTextSize(){let e=this.tile.blockTiles(e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t=0,n;for(let r of e.children){if(!r.isText()||/[^ -~]/.test(r.text))return;let e=$d(r.dom);if(e.length!=1)return;t+=e[0].width,n=e[0].height}if(t)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:t/e.length,textHeight:n}}});if(e)return e;let t=document.createElement(`div`),n,r,i;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 e=$d(t.firstChild)[0];n=t.getBoundingClientRect().height,r=e&&e.width?e.width/27:7,i=e&&e.height?e.height:n,t.remove()}),{lineHeight:n,charWidth:r,textHeight:i}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let i=r==t.viewports.length?null:t.viewports[r],a=i?i.from-1:this.view.state.doc.length;if(a>n){let r=(t.lineBlockAt(a).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(Bd.replace({widget:new hm(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,a))}if(!i)break;n=i.to+1}return Bd.set(e)}updateDeco(){let e=1,t=this.view.state.facet(_p).map(t=>(this.dynamicDecorationMap[e++]=typeof t==`function`)?t(this.view):t),n=!1,r=this.view.state.facet(yp).map((e,t)=>{let r=typeof e==`function`;return r&&(n=!0),r?e(this.view):e});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(Uu.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(vp).map(e=>typeof e==`function`?e(this.view):e)}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=t.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let t of this.view.state.facet(ap))try{if(t(this.view,e.range,e))return!0}catch(e){lp(this.view.state,e,`scroll handler`)}let{range:t}=e,n=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),r;if(!n)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let i=Tp(this.view),a={left:n.left-i.left,top:n.top-i.top,right:n.right+i.right,bottom:n.bottom+i.bottom},{offsetWidth:o,offsetHeight:s}=this.view.scrollDOM;if(lf(this.view.scrollDOM,a,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,o),-o),Math.max(Math.min(e.yMargin,s),-s),this.view.textDirection==Tf.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.visualViewport.offsetTop)){let e=this.view.docView.lineAt(t.head,1);if(e){let t=ff(e.dom);e.dom.scrollIntoView({block:`nearest`}),pf(t,!1)}}}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){im(this.tile)}};function im(e,t){let n=t?.get(e);if(n!=1){n??e.destroy();for(let n of e.children)im(n,t)}}function am(e){return Jd(e.node)&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable==`false`)&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable==`false`)}function om(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=Sf(n.focusNode,n.focusOffset),i=Cf(n.focusNode,n.focusOffset),a=r||i;if(i&&r&&i.node!=r.node){let t=Ap.get(i.node);if(!t||t.isText()&&t.text!=i.node.nodeValue)a=i;else if(e.docView.lastCompositionAfterCursor){let e=Ap.get(r.node);!e||e.isText()&&e.text!=r.node.nodeValue||(a=i)}}if(e.docView.lastCompositionAfterCursor=a!=r,!a)return null;let o=t-a.offset;return{from:o,to:o+a.node.nodeValue.length,node:a.node}}function sm(e,t,n){let r=om(e,n);if(!r)return null;let{node:i,from:a,to:o}=r,s=i.nodeValue;if(/[\n\r]/.test(s)||e.state.doc.sliceString(r.from,r.to)!=s)return null;let c=t.invertedDesc;return{range:new Dp(c.mapPos(a),c.mapPos(o),a,o),text:i}}function cm(e,t){return Jd(e)?(t&&e.childNodes[t-1].contentEditable==`false`?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable==`false`?2:0):0}var lm=class{constructor(){this.changes=[]}compareRange(e,t){Kd(e,t,this.changes)}comparePoint(e,t){Kd(e,t,this.changes)}boundChange(e){Kd(e,e,this.changes)}};function um(e,t,n){let r=new lm;return Uu.compare(e,t,n,r),r.changes}var dm=class{constructor(){this.changes=[]}compareRange(e,t){Kd(e,t,this.changes)}comparePoint(){}boundChange(e){Kd(e,e,this.changes)}};function fm(e,t,n){let r=new dm;return Uu.compare(e,t,n,r),r.changes}function pm(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(Jd(n)&&n.contentEditable==`false`)return!0;return!1}function mm(e,t){let n=!1;return t&&e.iterChangedRanges((e,r)=>{e<t.to&&r>t.from&&(n=!0)}),n}var hm=class extends Rd{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 gm(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),a=t-i.from;if(i.length==0)return G.cursor(t);a==0?n=1:a==i.length&&(n=-1);let o=a,s=a;n<0?o=kl(i.text,a,!1):s=kl(i.text,a);let c=r(i.text.slice(o,s));for(;o>0;){let e=kl(i.text,o,!1);if(r(i.text.slice(e,o))!=c)break;o=e}for(;s<i.length;){let e=kl(i.text,s);if(r(i.text.slice(s,e))!=c)break;s=e}return G.undirectionalRange(o+i.from,s+i.from)}function _m(e,t,n,r,i){let a=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let t=e.viewState.heightOracle.textHeight,r=Math.floor((i-n.top-(e.defaultLineHeight-t)*.5)/t);a+=r*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+id(o,a,e.state.tabSize)}function vm(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let e;for(let i of r.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;(!e||i.type==zd.Text&&(e.type!=i.type||(n<0?i.from<t:i.to>t)))&&(e=i)}}return e||r}return r}function ym(e,t,n,r){let i=vm(e,t.head,t.assoc||-1),a=!r||i.type!=zd.Text||!(e.lineWrapping||i.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>i.from?t.head-1:t.head);if(a){let t=e.dom.getBoundingClientRect(),r=e.textDirectionAt(i.from),o=e.posAndSideAtCoords({x:n==(r==Tf.LTR)?t.right-1:t.left+1,y:(a.top+a.bottom)/2});if(o)return G.cursor(o.pos,o.assoc)}return G.cursor(n?i.to:i.from,n?1:-1)}function bm(e,t,n,r){let i=e.state.doc.lineAt(t.head),a=e.bidiSpans(i),o=e.textDirectionAt(i.from);for(let s=t,c=null;;){let t=Kf(i,a,o,s,n),l=Gf;if(!t){if(i.number==(n?e.state.doc.lines:1))return s;l=`
9
- `,i=e.state.doc.line(i.number+(n?1:-1)),a=e.bidiSpans(i),t=n?G.cursor(i.from,-1):G.cursor(i.to,1)}if(!c){if(!r)return t;c=r(l)}else if(!c(l))return s;s=t}}function xm(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return e=>{let t=r(e);return i==ju.Space&&(i=t),i==t}}function Sm(e,t,n,r){let i=t.head,a=n?1:-1;if(i==(n?e.state.doc.length:0))return G.cursor(i,t.assoc);let o=t.goalColumn,s,c=e.contentDOM.getBoundingClientRect(),l=e.coordsAtPos(i,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),u=e.documentTop;if(l)o??=l.left-c.left,s=a<0?l.top:l.bottom;else{let t=e.viewState.lineBlockAt(i);o??=Math.min(c.right-c.left,e.defaultCharacterWidth*(i-t.from)),s=(a<0?t.top:t.bottom)+u}let d=c.left+o,f=e.viewState.heightOracle.textHeight>>1,p=r??f;for(let t=0;;t+=f){let r=s+(p+t)*a,i=Dm(e,{x:d,y:r},!1,a);if(n?r>c.bottom:r<c.top)return G.cursor(i.pos,i.assoc);let l=e.coordsAtPos(i.pos,i.assoc),u=l?(l.top+l.bottom)/2:0;if(!l||(n?u>s:u<s))return G.cursor(i.pos,i.assoc,void 0,o)}}function Cm(e,t,n){for(;;){let r=0;for(let i of e)i.between(t-1,t+1,(e,i,a)=>{if(t>e&&t<i){let a=r||n||(t-e<i-t?-1:1);t=a<0?e:i,r=a}});if(!r)return t}}function wm(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let i=t.ranges[r],a=null;if(i.empty){let t=Cm(e,i.from,0);t!=i.from&&(a=G.cursor(t,-1))}else{let t=Cm(e,i.from,-1),n=Cm(e,i.to,1);(t!=i.from||n!=i.to)&&(a=i.undirectional?G.undirectionalRange(i.from,i.to):G.range(i.from==i.anchor?t:n,i.from==i.head?t:n))}a&&(n||=t.ranges.slice(),n[r]=a)}return n?G.create(n,t.mainIndex):t}function Tm(e,t,n){let r=Cm(e.state.facet(bp).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:G.cursor(r,r<n.from?1:-1)}var Em=class{constructor(e,t){this.pos=e,this.assoc=t}};function Dm(e,t,n,r){let i=e.contentDOM.getBoundingClientRect(),a=i.top+e.viewState.paddingTop,{x:o,y:s}=t,c=s-a,l;for(;;){if(c<0)return new Em(0,1);if(c>e.viewState.docHeight)return new Em(e.state.doc.length,-1);if(l=e.elementAtHeight(c),r==null)break;if(l.type==zd.Text){if(r<0?l.to<e.viewport.from:l.from>e.viewport.to)break;let t=e.docView.coordsAt(r<0?l.from:l.to,r>0?-1:1);if(t&&(r<0?t.top<=c+a:t.bottom>=c+a))break}let t=e.viewState.heightOracle.textHeight/2;c=r>0?l.bottom+t:l.top-t}if(e.viewport.from>=l.to||e.viewport.to<=l.from){if(n)return null;if(l.type==zd.Text){let t=_m(e,i,l,o,s);return new Em(t,t==l.from?1:-1)}}if(l.type!=zd.Text)return c<(l.top+l.bottom)/2?new Em(l.from,1):new Em(l.to,-1);let u=e.docView.lineAt(l.from,2);return(!u||u.length!=l.length)&&(u=e.docView.lineAt(l.from,-2)),new Om(e,o,s,e.textDirectionAt(l.from)).scanTile(u,l.from)}var Om=class{constructor(e,t,n,r){this.view=e,this.x=t,this.y=n,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[Ff.find(r,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[Ff.find(r,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:r}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+r.from<t)}scan(e,t,n=!1){let r=0,i=e.length-1,a=new Set,o=this.bidiIn(e[0],e[i]),s,c,l=-1,u=1e9,d;search:for(;r<i;){let n=i-r,f=r+i>>1;adjust:if(a.has(f)){for(let e=1;e<n;e++){let t=f+e;if(t>=i&&(t-=n),!a.has(t)){f=t;break adjust}}break search}a.add(f);let p=t(f),m=0;if(p)for(let e=0;e<p.length;e++){let t=p[e];if(!(t.width==0&&p.length>1)){if(t.bottom<this.y)(!s||s.bottom<t.bottom)&&(s=t),m=1;else if(t.top>this.y)(!c||c.top>t.top)&&(c=t),m=-1;else{let e=t.left>this.x?this.x-t.left:t.right<this.x?this.x-t.right:0,n=Math.abs(e);n<u&&(l=f,u=n,d=t),e&&(m=e<0==(this.baseDir==Tf.LTR)?-1:1)}}}m==-1&&(!o||this.baseDirAt(e[f],1))?i=f:m==1&&(!o||this.baseDirAt(e[f+1],-1))&&(r=f+1)}if(!d){if(!c&&!s)return{i:0,after:!1};let n=s&&(!c||this.y-s.bottom<c.top-this.y)?s:c;return this.y=(n.top+n.bottom)/2,this.scan(e,t,!0)}if(u&&!n){let{top:n,bottom:r}=d;if(s&&s.bottom>(n+n+r)/3)return this.y=s.bottom-1,this.scan(e,t,!0);if(c&&c.top<(n+r+r)/3)return this.y=c.top+1,this.scan(e,t,!0)}let f=(o?this.dirAt(e[l],1):this.baseDir)==Tf.LTR;return{i:l,after:this.x>(d.left+d.right)/2==f}}scanText(e,t){let n=[];for(let r=0;r<e.length;r=kl(e.text,r))n.push(t+r);n.push(t+e.length);let r=this.scan(n,r=>{let i=n[r]-t,a=n[r+1]-t;return _f(e.dom,i,a).getClientRects()});return r.after?new Em(n[r.i+1],-1):new Em(n[r.i],1)}scanTile(e,t){if(!e.length)return new Em(t,1);if(e.children.length==1){let n=e.children[0];if(n.isText())return this.scanText(n,t);if(n.isComposite())return this.scanTile(n,t)}let n=[t];for(let r=0,i=t;r<e.children.length;r++)n.push(i+=e.children[r].length);let r=this.scan(n,t=>{let n=e.children[t];return n.flags&48?null:(Jd(n.dom)?n.dom:_f(n.dom,0,n.length)).getClientRects()}),i=e.children[r.i],a=n[r.i];return i.isText()?this.scanText(i,a):i.isComposite()?this.scanTile(i,a):r.after?new Em(n[r.i+1],-1):new Em(a,1)}},km=`￿`,Am=class{constructor(e,t){this.points=e,this.view=t,this.text=``,this.lineSeparator=t.state.facet(Iu.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=km}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let e=this.text.length;this.readNode(r);let i=Ap.get(r),a=r.nextSibling;if(a==t){i?.breakAfter&&!a&&n!=this.view.contentDOM&&this.lineBreak();break}let o=Ap.get(a);(i&&o?i.breakAfter:(i?i.breakAfter:nf(r))||nf(a)&&(r.nodeName!=`BR`||i?.isWidget())&&this.text.length>e)&&!Mm(a,t)&&this.lineBreak(),r=a}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,a=1,o;if(this.lineSeparator?(i=t.indexOf(this.lineSeparator,n),a=this.lineSeparator.length):(o=r.exec(t))&&(i=o.index,a=o[0].length),this.append(t.slice(n,i<0?t.length:i)),i<0)break;if(this.lineBreak(),a>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=a-1);n=i+a}}readNode(e){let t=Ap.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else Yd(e)?this.readTextNode(e):e.nodeName==`BR`?e.nextSibling&&this.lineBreak():Jd(e)&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(Yd(e)?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(jm(e,n.node,n.offset)?t:0))}};function jm(e,t,n){for(;;){if(!t||n<af(t))return!1;if(t==e)return!0;n=tf(t)+1,t=t.parentNode}}function Mm(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=Ap.get(e);if(!t?.isWidget())return!1;t&&(n||=[]).push(t)}if(n){for(let e of n)if(e.overrideDOMText?.length)return!1}return!0}var Nm=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},Pm=class{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text=``,this.domChanged=t>-1;let{impreciseHead:i,impreciseAnchor:a}=e.docView,o=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=Fm(e.docView.tile,t,n,0))){let t=i||a?[]:Bm(e),n=new Am(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=Vm(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!Zd(e.contentDOM,t.focusNode)?o.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=a&&a.node==t.anchorNode&&a.offset==t.anchorOffset||!Zd(e.contentDOM,t.anchorNode)?o.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((q.ios||q.chrome)&&n!=r&&Math.min(n,r)<=o.main.from&&Math.max(n,r)>=o.main.to&&(s.from>0||s.to<e.state.doc.length)){let t=Math.min(n,r),i=Math.max(n,r),a=s.from-t,o=s.to-i;(a==0||a==1||t==0)&&(o==0||o==-1||i==e.state.doc.length)&&(n=0,r=e.state.doc.length)}if(e.inputState.composing>-1&&o.ranges.length>1)this.newSel=o.replaceRange(G.range(r,n));else if(e.lineWrapping&&r==n&&!(o.main.empty&&o.main.head==n)&&e.inputState.lastTouchTime>Date.now()-100){let t=e.coordsAtPos(n,-1),r=0;t&&(r=e.inputState.lastTouchY<=t.bottom?-1:1),this.newSel=G.create([G.cursor(n,r)])}else this.newSel=G.single(r,n)}}};function Fm(e,t,n,r){if(e.isComposite()){let i=-1,a=-1,o=-1,s=-1;for(let c=0,l=r,u=r;c<e.children.length;c++){let r=e.children[c],d=l+r.length;if(l<t&&d>n)return Fm(r,t,n,l);if(d>=t&&i==-1&&(i=c,a=l),l>n&&r.dom.parentNode==e.dom){o=c,s=u;break}u=d,l=d+r.breakAfter}return{from:a,to:s<0?r+e.length:s,startDOM:(i?e.children[i-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function Im(e,t){let n,{newSel:r}=t,{state:i}=e,a=i.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:e,to:r}=t.bounds,s=a.from,c=null;(o===8||q.android&&t.text.length<r-e)&&(s=a.to,c=`end`);let l=i.doc.sliceString(e,r,km),u,d;!a.empty&&a.from>=e&&a.to<=r&&(t.typeOver||l!=t.text)&&l.slice(0,a.from-e)==t.text.slice(0,a.from-e)&&l.slice(a.to-e)==t.text.slice(u=t.text.length-(l.length-(a.to-e)))?n={from:a.from,to:a.to,insert:vl.of(t.text.slice(a.from-e,u).split(km))}:(d=zm(l,t.text,s-e,c))&&(q.chrome&&o==13&&d.toB==d.from+2&&t.text.slice(d.from,d.toB)==`￿￿`&&d.toB--,n={from:e+d.from,to:e+d.toA,insert:vl.of(t.text.slice(d.from,d.toB).split(km))})}else r&&(!e.hasFocus&&i.facet(up)||Hm(r,a))&&(r=null);if(!n&&!r)return!1;if((q.mac||q.android)&&n&&n.from==n.to&&n.from==a.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute(`autocorrect`)==`off`?(r&&n.insert.length==2&&(r=G.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:vl.of([n.insert.toString().replace(`.`,` `)])}):i.doc.lineAt(a.from).to<a.to&&e.docView.lineHasWidget(a.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:a.from,to:a.to,insert:i.toText(e.inputState.insertingText)}:q.chrome&&n&&n.from==n.to&&n.from==a.head&&n.insert.toString()==`
10
- `&&e.lineWrapping&&(r&&=G.single(r.main.anchor-1,r.main.head-1),n={from:a.from,to:a.to,insert:vl.of([` `])}),n)return Lm(e,n,r,o);if(r&&!Hm(r,a)){let t=!1,n=`select`;return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin==`select`&&(t=!0),n=e.inputState.lastSelectionOrigin,n==`select.pointer`&&(r=wm(i.facet(bp).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}return!1}function Lm(e,t,n,r=-1){if(q.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(q.android&&(t.to==i.to&&(t.from==i.from||t.from==i.from-1&&e.state.sliceDoc(t.from,i.from)==` `)&&t.insert.length==1&&t.insert.lines==2&&vf(e.contentDOM,`Enter`,13)||(t.from==i.from-1&&t.to==i.to&&t.insert.length==0||r==8&&t.insert.length<t.to-t.from&&t.to>i.head)&&vf(e.contentDOM,`Backspace`,8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&vf(e.contentDOM,`Delete`,46)))return!0;let a=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,s=()=>o||=Rm(e,t,n);return e.state.facet($f).some(n=>n(e,t.from,t.to,a,s))||e.dispatch(s()),!0}function Rm(e,t,n){let r,i=e.state,a=i.selection.main,o=-1;if(t.from==t.to&&t.from<a.from||t.from>a.to){let n=t.from<a.from?-1:1,r=n<0?a.from:a.to,s=Cm(i.facet(bp).map(t=>t(e)),r,n);t.from==s&&(o=s)}if(o>-1)r={changes:t,selection:G.cursor(t.from+t.insert.length,-1)};else if(t.from>=a.from&&t.to<=a.to&&t.to-t.from>=(a.to-a.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=a.from<t.from?i.sliceDoc(a.from,t.from):``,o=a.to>t.to?i.sliceDoc(t.to,a.to):``;r=i.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=i.changes(t),s=n&&n.main.to<=o.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=a.to+10&&t.to>=a.to-10){let c=e.state.sliceDoc(t.from,t.to),l,u=n&&om(e,n.main.head);if(u){let e=t.insert.length-(t.to-t.from);l={from:u.from,to:u.to-e}}else l=e.state.doc.lineAt(a.head);let d=a.to-t.to;r=i.changeByRange(n=>{if(n.from==a.from&&n.to==a.to)return{changes:o,range:s||n.map(o)};let r=n.to-d,u=r-c.length;if(e.state.sliceDoc(u,r)!=c||r>=l.from&&u<=l.to)return{range:n};let f=i.changes({from:u,to:r,insert:t.insert}),p=n.to-a.to;return{changes:f,range:s?G.range(Math.max(0,s.anchor+p),Math.max(0,s.head+p)):n.map(f)}})}else r={changes:o,selection:s&&i.selection.replaceRange(s)}}let s=`input.type`;return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,s+=`.compose`,e.inputState.compositionFirstChange&&(s+=`.start`,e.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:s,scrollIntoView:!0})}function zm(e,t,n,r){let i=Math.min(e.length,t.length),a=0;for(;a<i&&e.charCodeAt(a)==t.charCodeAt(a);)a++;if(a==i&&e.length==t.length)return null;let o=e.length,s=t.length;for(;o>0&&s>0&&e.charCodeAt(o-1)==t.charCodeAt(s-1);)o--,s--;if(r==`end`){let e=Math.max(0,a-Math.min(o,s));n-=o+e-a}if(o<a&&e.length<t.length){let e=n<=a&&n>=o?a-n:0;a-=e,s=a+(s-o),o=a}else if(s<a){let e=n<=a&&n>=s?a-n:0;a-=e,o=a+(o-s),s=a}return{from:a,toA:o,toB:s}}function Bm(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}=e.observer.selectionRange;return n&&(t.push(new Nm(n,r)),(i!=n||a!=r)&&t.push(new Nm(i,a))),t}function Vm(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n<0||r<0?null:n==r?G.create([G.cursor(r+t,-1)]):G.single(n+t,r+t)}function Hm(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}var Um=class{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,q.safari&&e.contentDOM.addEventListener(`input`,()=>null),q.gecko&&Eh(e.contentDOM.ownerDocument)}handleEvent(e){rh(this.view,e)&&!this.ignoreDuringComposition(e)&&(e.type==`keydown`&&this.keydown(e)||(this.view.updateState==0?this.runHandlers(e.type,e):Promise.resolve().then(()=>this.runHandlers(e.type,e))))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Km(e),n=this.handlers,r=this.view.contentDOM;for(let e in t)if(e!=`scroll`){let i=!t[e].handlers.length,a=n[e];a&&i!=!a.handlers.length&&(r.removeEventListener(e,this.handleEvent),a=null),a||r.addEventListener(e,this.handleEvent,{passive:i})}for(let e in n)e!=`scroll`&&!t[e]&&r.removeEventListener(e,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&&Ym.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),q.android&&q.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(q.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(qm.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||Jm.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};t.shiftKey&&q.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&Wm(this.view.win)&&(t.shiftKey=!1);let n=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{this.pendingIOSKey==n&&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.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,vf(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:q.safari&&!q.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 Wm(e){return e.visualViewport?e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<.85:!1}function Gm(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){lp(n.state,e)}}}function Km(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,r=e&&e.plugin.domEventHandlers,i=e&&e.plugin.domEventObservers;if(r)for(let e in r){let i=r[e];i&&n(e).handlers.push(Gm(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(Gm(t.value,r))}}for(let e in ih)n(e).handlers.push(ih[e]);for(let e in ah)n(e).observers.push(ah[e]);return t}var qm=[{key:`Backspace`,keyCode:8,inputType:`deleteContentBackward`},{key:`Enter`,keyCode:13,inputType:`insertParagraph`},{key:`Enter`,keyCode:13,inputType:`insertLineBreak`},{key:`Delete`,keyCode:46,inputType:`deleteContentForward`}],Jm=`dthko`,Ym=[16,17,18,20,91,92,224,225],Xm=6;function Zm(e){return Math.max(0,e)*.7+8}function Qm(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}var $m=class{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=uf(e.contentDOM),this.atoms=e.state.facet(bp).map(t=>t(e));let i=e.contentDOM.ownerDocument;i.addEventListener(`mousemove`,this.move=this.move.bind(this)),i.addEventListener(`mouseup`,this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(Iu.allowMultipleSelections)&&eh(e,t),this.dragging=nh(e,t)&&hh(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&&Qm(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,r=0,i=0,a=this.view.win.innerWidth,o=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:o}=this.scrollParents.y.getBoundingClientRect());let s=Tp(this.view);e.clientX-s.left<=r+Xm?t=-Zm(r-e.clientX):e.clientX+s.right>=a-Xm&&(t=Zm(e.clientX-a)),e.clientY-s.top<=i+Xm?n=-Zm(i-e.clientY):e.clientY+s.bottom>=o-Xm&&(n=Zm(e.clientY-o)),this.setScrollSpeed(t,n)}up(e){this.dragging??this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener(`mousemove`,this.move),e.removeEventListener(`mouseup`,this.up),this.view.inputState.mouseSelection=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,n=wm(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:`select.pointer`}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent(`input.type`))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};function eh(e,t){let n=e.state.facet(Jf);return n.length?n[0](t):q.mac?t.metaKey:t.ctrlKey}function th(e,t){let n=e.state.facet(Yf);return n.length?n[0](t):q.mac?!t.altKey:!t.ctrlKey}function nh(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=Xd(e.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let e=0;e<i.length;e++){let n=i[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}function rh(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,r;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=Ap.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}var ih=Object.create(null),ah=Object.create(null),oh=q.ie&&q.ie_version<15||q.ios&&q.webkit_version<604;function sh(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement(`textarea`));n.style.cssText=`position: fixed; left: -10000px; top: 10px`,n.focus(),setTimeout(()=>{e.focus(),n.remove(),lh(e,n.value)},50)}function ch(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function lh(e,t){t=ch(e.state,tp,t);let{state:n}=e,r,i=1,a=n.toText(t),o=a.lines==n.selection.ranges.length;if(xh!=null&&n.selection.ranges.every(e=>e.empty)&&xh==a.toString()){let e=-1;r=n.changeByRange(r=>{let s=n.doc.lineAt(r.from);if(s.from==e)return{range:r};e=s.from;let c=n.toText((o?a.line(i++).text:t)+n.lineBreak);return{changes:{from:s.from,insert:c},range:G.cursor(r.from+c.length,-1)}})}else r=o?n.changeByRange(e=>{let t=a.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:G.cursor(e.from+t.length,-1)}}):n.replaceSelection(a);e.dispatch(r,{userEvent:`input.paste`,scrollIntoView:!0})}ah.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,q.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())},ah.wheel=ah.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},ih.keydown=(e,t)=>(e.inputState.setSelectionOrigin(`select`),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),ah.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin(`select.pointer`)},ah.touchmove=e=>{e.inputState.setSelectionOrigin(`select.pointer`)},ah.touchend=(e,t)=>{e.inputState.touchActive=!1},ih.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(Xf))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=gh(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new $m(e,t,n,r)),r&&e.observer.ignore(()=>{hf(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let i=e.inputState.mouseSelection;if(i)return i.start(t),i.dragging===!1}else e.inputState.setSelectionOrigin(`select.pointer`);return!1};function uh(e,t,n,r){if(r==1)return G.cursor(t,n);if(r==2)return gm(e.state,t,n);{let r=e.docView.lineAt(t,n),i=e.state.doc.lineAt(r?r.posAtEnd:t),a=r?r.posAtStart:i.from,o=r?r.posAtEnd:i.to;return o<e.state.doc.length&&o==i.to&&o++,G.undirectionalRange(a,o)}}var dh=q.ie&&q.ie_version<=11,fh=null,ph=0,mh=0;function hh(e){if(!dh)return e.detail;let t=fh,n=mh;return fh=e,mh=Date.now(),ph=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(ph+1)%3:1}function gh(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=hh(t),i=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),i=i.map(e.changes))},get(t,a,o){let s=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),c,l=uh(e,s.pos,s.assoc,r);if(n.pos!=s.pos&&!a){let t=uh(e,n.pos,n.assoc,r),i=Math.min(t.from,l.from),a=Math.max(t.to,l.to);l=i<l.from?G.range(i,a,l.assoc):G.range(a,i,l.assoc)}return a?i.replaceRange(i.main.extend(l.from,l.to,l.assoc)):o&&r==1&&i.ranges.length>1&&(c=_h(i,s.pos))?c:o?i.addRange(l):G.create([l])}}}function _h(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:i}=e.ranges[n];if(r<=t&&i>=t)return G.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-+(e.mainIndex>n))}return null}ih.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let e=r.posAtStart,t=e+r.length;(e>=n.to||t<=n.from)&&(n=G.undirectionalRange(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData(`Text`,ch(e.state,np,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed=`copyMove`),!1},ih.dragend=e=>(e.inputState.draggedContent=null,!1);function vh(e,t,n,r){if(n=ch(e.state,tp,n),!n)return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:a}=e.inputState,o=r&&a&&th(e,t)?{from:a.from,to:a.to}:null,s={from:i,insert:n},c=e.state.changes(o?[o,s]:s);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(i,-1),head:c.mapPos(i,1)},userEvent:o?`move.drop`:`input.drop`}),e.inputState.draggedContent=null}ih.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,a=()=>{++i==n.length&&vh(e,t,r.filter(e=>e!=null).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=a,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(r[e]=t.result),a()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData(`Text`);if(n)return vh(e,t,n,!0),!0}return!1},ih.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=oh?null:t.clipboardData;return n?(lh(e,n.getData(`text/plain`)||n.getData(`text/uri-list`)),!0):(sh(e),!1)};function yh(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement(`textarea`));r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}function bh(e){let t=[],n=[],r=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let i=-1;for(let{from:r}of e.selection.ranges){let a=e.doc.lineAt(r);a.number>i&&(t.push(a.text),n.push({from:a.from,to:Math.min(e.doc.length,a.to+1)})),i=a.number}r=!0}return{text:ch(e,np,t.join(e.lineBreak)),ranges:n,linewise:r}}var xh=null;ih.copy=ih.cut=(e,t)=>{if(!Qd(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=bh(e.state);if(!n&&!i)return!1;xh=i?n:null,t.type==`cut`&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:`delete.cut`});let a=oh?null:t.clipboardData;return a?(a.clearData(),a.setData(`text/plain`,n),!0):(yh(e,n),!1)};var Sh=vu.define();function Ch(e,t){let n=[];for(let r of e.facet(ep)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:Sh.of(!0)}):null}function wh(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Ch(e.state,t);n?e.dispatch(n):e.update([])}},10)}ah.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),wh(e)},ah.blur=e=>{e.observer.clearSelectionRange(),wh(e)},ah.compositionstart=ah.compositionupdate=(e,t)=>{if(!e.observer.editContext&&(e.inputState.compositionFirstChange??(e.inputState.compositionFirstChange=!0),e.inputState.composing<0)){let{main:t}=e.state.selection;!t.empty&&e.lineBlockAt(t.from).from!=e.lineBlockAt(t.to).from&&!e.state.readOnly&&e.dispatch({changes:e.state.selection.ranges.filter(e=>!e.empty).map(e=>({from:e.from,to:e.to})),userEvent:`input`}),e.inputState.composing=0}},ah.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,q.chrome&&q.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},ah.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},ih.beforeinput=(e,t)=>{if((t.inputType==`insertText`||t.inputType==`insertCompositionText`)&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType==`insertReplacementText`&&e.observer.editContext){let n=t.dataTransfer?.getData(`text/plain`),r=t.getTargetRanges();if(n&&r.length){let t=r[0];return Lm(e,{from:e.posAtDOM(t.startContainer,t.startOffset),to:e.posAtDOM(t.endContainer,t.endOffset),insert:e.state.toText(n)},null),!0}}let n;if(q.chrome&&q.android&&(n=qm.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(n.key,n.keyCode),n.key==`Backspace`||n.key==`Delete`)){let t=window.visualViewport?.height||0;setTimeout(()=>{(window.visualViewport?.height||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return q.ios&&t.inputType==`deleteContentForward`&&e.observer.flushSoon(),q.safari&&t.inputType==`insertText`&&e.inputState.composing>=0&&setTimeout(()=>ah.compositionend(e,t),20),!1};var Th=new Set;function Eh(e){Th.has(e)||(Th.add(e),e.addEventListener(`copy`,()=>{}),e.addEventListener(`cut`,()=>{}))}var Dh=[`pre-wrap`,`normal`,`pre-line`,`break-spaces`],Oh=!1;function kh(){Oh=!1}var Ah=class{constructor(e){this.lineWrapping=e,this.doc=vl.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){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 Dh.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(r*10)]||(t=!0,this.heightSamples[Math.floor(r*10)]=!0)}return t}refresh(e,t,n,r,i,a){let o=Dh.indexOf(e)>-1,s=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=i,s){this.heightSamples={};for(let e=0;e<a.length;e++){let t=a[e];t<0?e++:this.heightSamples[Math.floor(t*10)]=!0}}return s}},jh=class{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}},Mh=class e{constructor(e,t,n,r,i){this.from=e,this.length=t,this.top=n,this.height=r,this._content=i}get type(){return typeof this._content==`number`?zd.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Ud?this._content.widget:null}get widgetLineBreaks(){return typeof this._content==`number`?this._content:0}join(t){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new e(this.from,this.length+t.length,this.top,this.height+t.height,n)}},Nh=(function(e){return e[e.ByPos=0]=`ByPos`,e[e.ByHeight=1]=`ByHeight`,e[e.ByPosNoHeight=2]=`ByPosNoHeight`,e})(Nh||={}),Ph=.001,Fh=class e{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Ph&&(Oh=!0),this.height=e)}replace(t,n,r){return e.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let i=this,a=n.doc;for(let o=r.length-1;o>=0;o--){let{fromA:s,toA:c,fromB:l,toB:u}=r[o],d=i.lineAt(s,Nh.ByPosNoHeight,n.setDoc(t),0,0),f=d.to>=c?d:i.lineAt(c,Nh.ByPosNoHeight,n,0,0);for(u+=f.to-c,c=f.to;o>0&&d.from<=r[o-1].toA;)s=r[o-1].fromA,l=r[o-1].fromB,o--,s<d.from&&(d=i.lineAt(s,Nh.ByPosNoHeight,n,0,0));l+=d.from-s,s=d.from;let p=Wh.build(n.setDoc(a),e,l,u);i=Ih(i,i.replace(s,c,p))}return i.updateHeight(n,0)}static empty(){return new zh(0,0,0)}static of(t){if(t.length==1)return t[0];let n=0,r=t.length,i=0,a=0;for(;;)if(n==r){if(i>a*2){let e=t[n-1];e.break?t.splice(--n,1,e.left,null,e.right):t.splice(--n,1,e.left,e.right),r+=1+e.break,i-=e.size}else if(a>i*2){let e=t[r];e.break?t.splice(r,1,e.left,null,e.right):t.splice(r,1,e.left,e.right),r+=2+e.break,a-=e.size}else break}else if(i<a){let e=t[n++];e&&(i+=e.size)}else{let e=t[--r];e&&(a+=e.size)}let o=!1;return t[n-1]==null?(o=!0,n--):t[n]??(o=!0,r++),new Vh(e.of(t.slice(0,n)),o,e.of(t.slice(r)))}};function Ih(e,t){return e==t?e:(e.constructor!=t.constructor&&(Oh=!0),t)}Fh.prototype.size=1;var Lh=Bd.replace({}),Rh=class extends Fh{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new Mh(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,r){return this.spaceAbove&&e<n+this.spaceAbove?new Mh(r,0,n,this.spaceAbove,Lh):this.mainBlock(n,r)}lineAt(e,t,n,r,i){let a=this.mainBlock(r,i);return this.spaceAbove?this.blockAt(0,n,r,i).join(a):a}forEachLine(e,t,n,r,i,a){e<=i+this.length&&t>=i&&a(this.lineAt(0,Nh.ByPos,n,r,i))}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,n=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}},zh=class e extends Rh{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new Mh(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,r){let i=r[0];return r.length==1&&(i instanceof e||i instanceof Bh&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Bh?i=new e(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):Fh.of(r)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(n||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:``})`}},Bh=class e extends Fh{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,i=r-n+1,a,o=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*i);a=t/i,this.length>i+1&&(o=(this.height-t)/(this.length-i-1))}else a=this.height/i;return{firstLine:n,lastLine:r,perLine:a,perChar:o}}blockAt(e,t,n,r){let{firstLine:i,lastLine:a,perLine:o,perChar:s}=this.heightMetrics(t,r);if(t.lineWrapping){let i=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),a=t.doc.lineAt(i),c=o+a.length*s,l=Math.max(n,e-c/2);return new Mh(a.from,a.length,l,c,0)}{let r=Math.max(0,Math.min(a-i,Math.floor((e-n)/o))),{from:s,length:c}=t.doc.line(i+r);return new Mh(s,c,n+o*r,o,0)}}lineAt(e,t,n,r,i){if(t==Nh.ByHeight)return this.blockAt(e,n,r,i);if(t==Nh.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new Mh(t,r-t,0,0,0)}let{firstLine:a,perLine:o,perChar:s}=this.heightMetrics(n,i),c=n.doc.lineAt(e),l=o+c.length*s,u=c.number-a,d=r+o*u+s*(c.from-i-u);return new Mh(c.from,c.length,Math.max(r,Math.min(d,r+this.height-l)),l,0)}forEachLine(e,t,n,r,i,a){e=Math.max(e,i),t=Math.min(t,i+this.length);let{firstLine:o,perLine:s,perChar:c}=this.heightMetrics(n,i);for(let l=e,u=r;l<=t;){let t=n.doc.lineAt(l);if(l==e){let n=t.number-o;u+=s*n+c*(e-i-n)}let r=s+c*t.length;a(new Mh(t.from,t.length,u,r,0)),u+=r,l=t.to+1}}replace(t,n,r){let i=this.length-n;if(i>0){let t=r[r.length-1];t instanceof e?r[r.length-1]=new e(t.length+i):r.push(null,new e(i-1))}if(t>0){let n=r[0];n instanceof e?r[0]=new e(t+n.length):r.unshift(new e(t-1),null)}return Fh.of(r)}decomposeLeft(t,n){n.push(new e(t-1),null)}decomposeRight(t,n){n.push(null,new e(this.length-t-1))}updateHeight(t,n=0,r=!1,i){let a=n+this.length;if(i&&i.from<=n+this.length&&i.more){let r=[],o=Math.max(n,i.from),s=-1;for(i.from>n&&r.push(new e(i.from-n-1).updateHeight(t,n));o<=a&&i.more;){let e=t.doc.lineAt(o).length;r.length&&r.push(null);let n=i.heights[i.index++],a=0;n<0&&(a=-n,n=i.heights[i.index++]),s==-1?s=n:Math.abs(n-s)>=Ph&&(s=-2);let c=new zh(e,n,a);c.outdated=!1,r.push(c),o+=e+1}o<=a&&r.push(null,new e(a-o).updateHeight(t,o));let c=Fh.of(r);return(s<0||Math.abs(c.height-this.height)>=Ph||Math.abs(s-this.heightMetrics(t,n).perLine)>=Ph)&&(Oh=!0),Ih(this,c)}return(r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}},Vh=class extends Fh{constructor(e,t,n){super(e.length+ +!!t+n.length,e.height+n.height,+!!t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,r){let i=n+this.left.height;return e<i?this.left.blockAt(e,t,n,r):this.right.blockAt(e,t,i,r+this.left.length+this.break)}lineAt(e,t,n,r,i){let a=r+this.left.height,o=i+this.left.length+this.break,s=t==Nh.ByHeight?e<a:e<o,c=s?this.left.lineAt(e,t,n,r,i):this.right.lineAt(e,t,n,a,o);if(this.break||(s?c.to<o:c.from>o))return c;let l=t==Nh.ByPosNoHeight?Nh.ByPosNoHeight:Nh.ByPos;return s?c.join(this.right.lineAt(o,l,n,a,o)):this.left.lineAt(o,l,n,r,i).join(c)}forEachLine(e,t,n,r,i,a){let o=r+this.left.height,s=i+this.left.length+this.break;if(this.break)e<s&&this.left.forEachLine(e,t,n,r,i,a),t>=s&&this.right.forEachLine(e,t,n,o,s,a);else{let c=this.lineAt(s,Nh.ByPos,n,r,i);e<c.from&&this.left.forEachLine(e,Math.min(t,c.from-1),n,r,i,a),c.to>=e&&c.from<=t&&a(c),t>c.to&&this.right.forEachLine(Math.max(e,c.to+1),t,n,o,s,a)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let i=[];e>0&&this.decomposeLeft(e,i);let a=i.length;for(let e of n)i.push(e);if(e>0&&Hh(i,a-1),t<this.length){let e=i.length;this.decomposeRight(t,i),Hh(i,e)}return Fh.of(i)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Fh.of(this.break?[e,null,t]:[e,t]):(this.left=Ih(this.left,e),this.right=Ih(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,n=!1,r){let{left:i,right:a}=this,o=t+i.length+this.break,s=null;return r&&r.from<=t+i.length&&r.more?s=i=i.updateHeight(e,t,n,r):i.updateHeight(e,t,n),r&&r.from<=o+a.length&&r.more?s=a=a.updateHeight(e,o,n,r):a.updateHeight(e,o,n),s?this.balanced(i,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?` `:`-`)+this.right}};function Hh(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof Bh&&(r=e[t+1])instanceof Bh&&e.splice(t-1,3,new Bh(n.length+1+r.length))}var Uh=5,Wh=class e{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof zh?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new zh(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,i=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let a=t-e;n.block?this.addBlock(new Rh(a,r,n)):(a||i||r>=Uh)&&this.addLineDeco(r,i,a)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new zh(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new Bh(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof zh)return e;let t=new zh(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+=e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos+=n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof zh)&&!this.isCovered?this.nodes.push(new zh(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let e of this.nodes)e instanceof zh&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(t,n,r,i){let a=new e(r,t);return Uu.spans(n,r,i,a,0),a.finish(r)}};function Gh(e,t,n){let r=new Kh;return Uu.compare(e,t,n,r,0),r.changes}var Kh=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&Kd(e,t,this.changes,5)}};function qh(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,i=r.defaultView||window,a=Math.max(0,n.left),o=Math.min(i.innerWidth,n.right),s=Math.max(0,n.top),c=Math.min(i.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=r.body;)if(Jd(t)){let n=window.getComputedStyle(t);if((t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)&&n.overflow!=`visible`){let n=t.getBoundingClientRect();a=Math.max(a,n.left),o=Math.min(o,n.right),s=Math.max(s,n.top),c=Math.min(t==e.parentNode?i.innerHeight:c,n.bottom)}t=n.position==`absolute`||n.position==`fixed`?t.offsetParent:t.parentNode}else if(t.nodeType==11)t=t.host;else break;return{left:a-n.left,right:Math.max(a,o)-n.left,top:s-(n.top+t),bottom:Math.max(s,c)-(n.top+t)}}function Jh(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}function Yh(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}var Xh=class{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(e,t){return Bd.replace({widget:new Zh(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}},Zh=class extends Rd{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement(`div`);return this.vertical?e.style.height=this.size+`px`:(e.style.width=this.size+`px`,e.style.height=`2px`,e.style.display=`inline-block`),e}get estimatedHeight(){return this.vertical?this.size:-1}},Qh=class{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=ig,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Tf.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(gp).some(e=>typeof e!=`function`&&e.class==`cm-lineWrapping`);this.heightOracle=new Ah(n),this.stateDeco=ag(t),this.heightMap=Fh.empty().applyChanges(this.stateDeco,vl.empty,this.heightOracle.setDoc(t.doc),[new Dp(0,0,0,t.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Bd.set(this.lineGaps.map(e=>e.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>r>=e&&r<=t)){let{from:t,to:n}=this.lineBlockAt(r);e.push(new $h(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?ig:og.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(sg(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=ag(this.state);let r=e.changedRanges,i=Dp.extendWithRanges(r,Gh(n,this.stateDeco,e?e.changes:Rl.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);kh(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||Oh)&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let s=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<s.from||t.range.head>s.to)||!this.viewportIsAppropriate(s))&&(s=this.getViewport(0,t));let c=s.from!=this.viewport.from||s.to!=this.viewport.to;this.viewport=s,e.flags|=this.updateForViewport(),(c||!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(ip)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,i=n.whiteSpace;this.defaultTextDirection=n.direction==`rtl`?Tf.RTL:Tf.LTR;let a=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent===`refresh`,o=t.getBoundingClientRect(),s=a||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let c=0,l=0;if(o.width&&o.height){let{scaleX:e,scaleY:n}=cf(t,o);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,c|=16,a=s=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=u||this.paddingBottom!=d)&&(this.paddingTop=u,this.paddingBottom=d,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(s=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let f=uf(this.view.contentDOM,!1).y;f!=this.scrollParent&&(this.scrollParent=f,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=xf(this.scrollParent||e.win);let m=(this.printing?Yh:qh)(t,this.paddingTop),h=m.top-this.pixelViewport.top,g=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let _=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(_!=this.inView&&(this.inView=_,_&&(s=!0)),!this.inView&&!this.scrollTarget&&!Jh(e.dom))return 0;let v=o.width;if((this.contentDOMWidth!=v||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),s){let t=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(t)&&(a=!0),a||r.lineWrapping&&Math.abs(v-this.contentDOMWidth)>r.charWidth){let{lineHeight:n,charWidth:o,textHeight:s}=e.docView.measureTextSize();a=n>0&&r.refresh(i,n,o,s,Math.max(5,v/o),t),a&&(e.docView.minWidth=0,c|=16)}h>0&&g>0?l=Math.max(h,g):h<0&&g<0&&(l=Math.min(h,g)),kh();for(let n of this.viewports){let i=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(a?Fh.empty().applyChanges(this.stateDeco,vl.empty,this.heightOracle,[new Dp(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new jh(n.from,i))}Oh&&(c|=2)}let y=!this.viewportIsAppropriate(this.viewport,l)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return y&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(l,this.scrollTarget),c|=this.updateForViewport()),(c&2||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:a,visibleBottom:o}=this,s=new $h(r.lineAt(a-n*1e3,Nh.ByHeight,i,0,0).from,r.lineAt(o+(1-n)*1e3,Nh.ByHeight,i,0,0).to);if(t){let{head:e}=t.range;if(e<s.from||e>s.to){let n=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),a=r.lineAt(e,Nh.ByPos,i,0,0),o;o=t.y==`center`?(a.top+a.bottom)/2-n/2:t.y==`start`||t.y==`nearest`&&e<s.from?a.top:a.bottom-n,s=new $h(r.lineAt(o-500,Nh.ByHeight,i,0,0).from,r.lineAt(o+n+500,Nh.ByHeight,i,0,0).to)}}return s}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new $h(this.heightMap.lineAt(n,Nh.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Nh.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,Nh.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,Nh.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:o}=this;return(e==0||r<=a-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||i>=o+Math.max(10,Math.min(n,250)))&&r>a-2e3&&i<o+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new Xh(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,i=r>>1,a=r<<1;if(this.defaultTextDirection!=Tf.LTR&&!n)return[];let o=[],s=(r,a,c,l)=>{if(a-r<i)return;let u=this.state.selection.main,d=[u.from];u.empty||d.push(u.to);for(let e of d)if(e>r&&e<a){s(r,e-10,c,l),s(e+10,a,c,l);return}let f=rg(e,e=>e.from>=c.from&&e.to<=c.to&&Math.abs(e.from-r)<i&&Math.abs(e.to-a)<i&&!d.some(t=>e.from<t&&e.to>t));if(!f){if(a<c.to&&t&&n&&t.visibleRanges.some(e=>e.from<=a&&e.to>=a)){let e=t.moveToLineBoundary(G.cursor(a),!1,!0).head;e>r&&(a=e)}let e=this.gapSize(c,r,a,l);f=new Xh(r,a,e,n||e<2e6?e:2e6)}o.push(f)},c=t=>{if(t.length<a||t.type!=zd.Text)return;let i=eg(t.from,t.to,this.stateDeco);if(i.total<a)return;let o=this.scrollTarget?this.scrollTarget.range.head:null,c,l;if(n){let e=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,n,a;if(o!=null){let r=ng(i,o),s=((this.visibleBottom-this.visibleTop)/2+e)/t.height;n=r-s,a=r+s}else n=(this.visibleTop-t.top-e)/t.height,a=(this.visibleBottom-t.top+e)/t.height;c=tg(i,n),l=tg(i,a)}else{let n=i.total*this.heightOracle.charWidth,a=r*this.heightOracle.charWidth,s=0;if(n>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+s<this.pixelViewport.left&&(s=n.size-n.displaySize);let u=this.pixelViewport.left+s,d=this.pixelViewport.right+s,f,p;if(o!=null){let e=ng(i,o),t=((d-u)/2+a)/n;f=e-t,p=e+t}else f=(u-a)/n,p=(d+a)/n;c=tg(i,f),l=tg(i,p)}c>t.from&&s(t.from,c,t,i),l<t.to&&s(l,t.to,t,i)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(c):c(e);return o}gapSize(e,t,n,r){let i=ng(r,n)-ng(r,t);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){Xh.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Bd.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];Uu.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let t=0;t<n.length&&!(r&8);t++){let i=this.visibleRanges[t],a=n[t];(i.from!=a.from||i.to!=a.to)&&(r|=4,e&&e.mapPos(i.from,-1)==a.from&&e.mapPos(i.to,1)==a.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||sg(this.heightMap.lineAt(e,Nh.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)||sg(this.heightMap.lineAt(this.scaler.fromDOM(e),Nh.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 sg(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}},$h=class{constructor(e,t){this.from=e,this.to=t}};function eg(e,t,n){let r=[],i=e,a=0;return Uu.spans(n,e,t,{span(){},point(e,t){e>i&&(r.push({from:i,to:e}),a+=e-i),i=t}},20),i<t&&(r.push({from:i,to:t}),a+=t-i),{total:a,ranges:r}}function tg({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:i}=t[e],a=i-n;if(r<=a)return n+r;r-=a}}function ng(e,t){let n=0;for(let{from:r,to:i}of e.ranges){if(t<=i){n+=t-r;break}n+=i-r}return n/e.total}function rg(e,t){for(let n of e)if(t(n))return n}var ig={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function ag(e){let t=e.facet(_p).filter(e=>typeof e!=`function`),n=e.facet(yp).filter(e=>typeof e!=`function`);return n.length&&t.push(Uu.join(n)),t}var og=class e{constructor(e,t){this.scale=e,this.viewports=t}static get(t,n,r){let i=0,a=0,o=0,s=r.map(({from:e,to:r})=>{let a=n.lineAt(e,Nh.ByPos,t,0,0).top,o=n.lineAt(r,Nh.ByPos,t,0,0).bottom;return i+=o-a,{from:e,to:r,top:a,bottom:o,domTop:0,domBottom:0}});if(n.height-i<10)return ig;let c=(7e6-i)/(n.height-i);for(let e of s)e.domTop=o+(e.top-a)*c,o=e.domBottom=e.domTop+(e.bottom-e.top),a=e.bottom;return new e(c,s)}toDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.top)return r+(e-n)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);n=i.bottom,r=i.domBottom}}fromDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.domTop)return n+(e-r)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);n=i.bottom,r=i.domBottom}}eq(t){return t instanceof e&&this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((e,n)=>e.from==t.viewports[n].from&&e.to==t.viewports[n].to)}};function sg(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new Mh(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>sg(e,t)):e._content)}var cg=K.define({combine:e=>e.join(` `)}),lg=K.define({combine:e=>e.indexOf(!0)>-1}),ug=ld.newName(),dg=ld.newName(),fg=ld.newName(),pg={"&light":`.`+dg,"&dark":`.`+fg};function mg(e,t,n){return new ld(t,{finish(t){return/&/.test(t)?t.replace(/&\w*/,t=>{if(t==`&`)return e;if(!n||!n[t])throw RangeError(`Unsupported selector: ${t}`);return n[t]}):e+` `+t}})}var hg=mg(`.`+ug,{"&":{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,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,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`}},pg),gg={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},_g=q.ie&&q.ie_version<=11,vg=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new df,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 e of t)this.queue.push(e);(q.ie&&q.ie_version<=11||q.ios&&e.composing)&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&q.android&&e.constructor.EDIT_CONTEXT!==!1&&!(q.chrome&&q.chrome_version<126)&&(this.editContext=new Sg(e),e.state.facet(up)&&(e.contentDOM.editContext=this.editContext.editContext)),_g&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia(`print`)),typeof ResizeObserver==`function`&&(this.resizeScroll=new ResizeObserver(()=>{this.view.docView?.lastUpdate<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver==`function`&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent(`Event`)))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent(`Event`))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers(`scroll`,e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(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,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(up)?n.root.activeElement!=this.dom:!Qd(this.dom,r))return;let i=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);i&&i.isWidget()&&i.widget.ignoreEvent(e)?t||(this.selectionChanged=!1):(q.ie&&q.ie_version<=11||q.android&&q.chrome)&&!n.state.selection.main.empty&&r.focusNode&&ef(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Xd(e.root);if(!t)return!1;let n=q.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&xg(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=Qd(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&bf(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(Jd(n))!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||=this.scrollTargets.slice(0,e),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener(`scroll`,this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener(`scroll`,this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||=(this.observer.observe(this.dom,gg),_g&&this.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),_g&&this.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&vf(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}(!this.delayedAndroidKey||e==`Enter`)&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!this.delayedAndroidKey?.force})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let i of e){let e=this.readMutation(i);e&&(e.typeOver&&(r=!0),t==-1?{from:t,to:n}=e:(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&Qd(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new Pm(this.view,e,t,n);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.selectionChanged,n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=Im(this.view,n);return this.view.state==r&&(n.domChanged||t)&&this.view.update([]),i}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 n=yg(t,e.previousSibling||e.target.previousSibling,-1),r=yg(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}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(up)!=e.state.facet(up)&&(e.view.contentDOM.editContext=e.state.facet(up)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)==null||e.disconnect(),(t=this.gapIntersection)==null||t.disconnect(),(n=this.resizeScroll)==null||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener(`scroll`,this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}};function yg(e,t,n){for(;t;){let r=Ap.get(t);if(r&&r.parent==e)return r;let i=t.parentNode;t=i==e.dom?n>0?t.nextSibling:t.previousSibling:i}return null}function bg(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return ef(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function xg(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return bg(e,n)}let n=null;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener(`beforeinput`,r,!0),e.dom.ownerDocument.execCommand(`indent`),e.contentDOM.removeEventListener(`beforeinput`,r,!0),n?bg(e,n):null}var Sg=class{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=n=>{let r=e.state.selection.main,{anchor:i,head:a}=r,o=this.toEditorPos(n.updateRangeStart),s=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:o,drifted:!1});let c=s-o>n.text.length;o==this.from&&i<this.from?o=i:s==this.to&&i>this.to&&(s=i);let l=zm(e.state.sliceDoc(o,s),n.text,(c?r.from:r.to)-o,c?`end`:null);if(!l){let t=G.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));Hm(t,r)||e.dispatch({selection:t,userEvent:`select`});return}let u={from:l.from+o,to:l.toA+o,insert:vl.of(n.text.slice(l.from,l.toB).split(`
11
- `))};if((q.mac||q.android)&&u.from==a-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute(`autocorrect`)==`off`&&(u={from:o,to:s,insert:vl.of([n.text.replace(`.`,` `)])}),this.pendingContextChange=u,!e.state.readOnly){let t=this.to-this.from+(u.to-u.from+u.insert.length);Lm(e,u,G.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from<u.to&&!u.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],i=null;for(let t=this.toEditorPos(n.rangeStart),a=this.toEditorPos(n.rangeEnd);t<a;t++){let n=e.coordsForChar(t);i=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||i||new DOMRect,r.push(i)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,r=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(r)){let i=this.toEditorPos(e.rangeStart),a=this.toEditorPos(e.rangeEnd);if(i<a){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+` `:t==`Dashed`?`dashed `:t==`Squiggle`?`wavy `:``}${/thin/i.test(r)?1:2}px`;n.push(Bd.mark({attributes:{style:e}}).range(i,a))}}}e.dispatch({effects:cp.of(Bd.set(n))})},this.handlers.compositionstart=()=>{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:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{let t=Xd(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((i,a,o,s,c)=>{if(n)return;let l=c.length-(a-i);if(r&&a>=r.to){if(r.from==i&&r.to==a&&r.insert.eq(c)){r=this.pendingContextChange=null,t+=l,this.to+=l;return}r=null,this.revertPending(e.state)}if(i+=t,a+=t,a<=this.from)this.from+=l,this.to+=l;else if(i<this.to){if(i<this.from||a>this.to||this.to-this.from+c.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(a),c.toString()),this.to+=l}t+=l}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent(`input.type`)&&e.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,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.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])}},J=class e{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={}){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:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(e=>e.forEach(e=>t(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||yf(e.parent)||document,this.viewState=new Qh(this,e.state||Iu.create(e)),e.scrollTo&&e.scrollTo.is(sp)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(fp).map(e=>new mp(e));for(let e of this.plugins)e.update(this);this.observer=new vg(this),this.inputState=new Um(this),this.inputState.ensureHandlers(this.plugins),this.docView=new rm(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),document.fonts?.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent=`refresh`,this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof Su?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(t){if(this.updateState!=0)throw Error(`Calls to EditorView.update are not allowed while an update is in progress`);let n=!1,r=!1,i,a=this.state;for(let e of t){if(e.startState!=a)throw RangeError(`Trying to update state with a transaction that doesn't start from the previous state.`);a=e.state}if(this.destroyed){this.viewState.state=a;return}let o=this.hasFocus,s=0,c=null;t.some(e=>e.annotation(Sh))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=Ch(a,o),c||(s=1));let l=this.observer.delayedAndroidKey,u=null;if(l?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(u=null)):this.observer.clear(),a.facet(Iu.phrases)!=this.state.facet(Iu.phrases))return this.setState(a);i=Op.create(this,a,t),i.flags|=s;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let n of t){if(d&&=d.map(n.changes),n.scrollIntoView){let{main:t}=n.state.selection,{x:r,y:i}=this.state.facet(e.cursorScrollMargin);d=new op(t.empty?t:G.cursor(t.head,t.head>t.anchor?-1:1),`nearest`,`nearest`,i,r)}for(let e of n.effects)e.is(sp)&&(d=e.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=Tg.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(Ep)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(e=>e.isUserEvent(`select.pointer`)))}finally{this.updateState=0}if(i.startState.facet(cg)!=i.state.facet(cg)&&(this.viewState.mustMeasureContent=!0),(n||r||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let e of this.state.facet(Qf))try{e(i)}catch(e){lp(this.state,e,`update listener`)}(c||u)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),u&&!Im(this,u)&&l.force&&vf(this.contentDOM,l.key,l.keyCode)})}setState(e){if(this.updateState!=0)throw 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 e of this.plugins)e.destroy(this);this.viewState=new Qh(this,e),this.plugins=e.facet(fp).map(e=>new mp(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new rm(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(fp),n=e.state.facet(fp);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new mp(i));else{let t=this.plugins[n];t.mustUpdate=e,r.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){lp(this.state,e,`doc view update listener`)}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-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,n=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:a,scaleY:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(a<0){if(xf(n||this.win))i=-1,a=this.viewState.heightMap.height/this.viewState.scaleY;else{let e=this.viewState.scrollAnchorAt(r);i=e.from,a=e.top}o=this.viewState.scaleY}this.updateState=1;let s=this.viewState.measure();if(!s&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(e>5){console.warn(this.measureRequests.length?`Measure loop restarted more than 5 times`:`Viewport failed to stabilize`);break}let c=[];s&4||([this.measureRequests,c]=[c,this.measureRequests]);let l=c.map(e=>{try{return e.read(this)}catch(e){return lp(this.state,e),wg}}),u=Op.create(this,this.state,[]),d=!1;u.flags|=s,t?t.flags|=s:t=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),d=this.docView.update(u),d&&this.docViewUpdate());for(let e=0;e<c.length;e++)if(l[e]!=wg)try{let t=c[e];t.write&&t.write(l[e],this)}catch(e){lp(this.state,e)}if(d&&this.docView.updateSelection(!0),!u.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}{let e=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)/this.viewState.scaleY-a/o;if((e>1||e<-1)&&!(q.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r+=e,n?i<0?n.scrollTop=n.scrollHeight:n.scrollTop+=e:this.win.scrollBy(0,e),a=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(Qf))e(t)}get themeClasses(){return ug+` `+(this.state.facet(lg)?fg:dg)+` `+this.state.facet(cg)}updateAttrs(){let e=Eg(this,hp,{class:`cm-editor`+(this.hasFocus?` cm-focused `:` `)+this.themeClasses}),t={spellcheck:`false`,autocorrect:`off`,autocapitalize:`off`,writingsuggestions:`false`,translate:`no`,contenteditable:this.state.facet(up)?`true`:`false`,class:`cm-content`,style:`${q.tabSize}: ${this.state.tabSize}`,role:`textbox`,"aria-multiline":`true`};this.state.readOnly&&(t[`aria-readonly`]=`true`),Eg(this,gp,t);let n=this.observer.ignore(()=>{let n=Id(this.contentDOM,this.contentAttrs,t),r=Id(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(t){let n=!0;for(let r of t)for(let t of r.effects)if(t.is(e.announce)){n&&=(this.announceDOM.textContent=``,this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=`\xA0`},200),!1);let e=this.announceDOM.appendChild(document.createElement(`div`));e.textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Ep);let t=this.state.facet(e.cspNonce);ld.mount(this.root,this.styleModules.concat(hg).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw 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;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.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,n){return Tm(this,e,bm(this,e,t,n))}moveByGroup(e,t){return Tm(this,e,bm(this,e,t,t=>xm(this,e.head,t)))}visualLineSide(e,t){return t?G.cursor(e.to,1):G.cursor(e.from,-1)}moveToLineBoundary(e,t,n=!0){return ym(this,e,t,n)}moveVertically(e,t,n){return Tm(this,e,Sm(this,e,t,n))}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 n=Dm(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Dm(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.state.doc.lineAt(e),r=this.bidiSpans(n),i=r[Ff.find(r,e-n.from,-1,t)];return n.length&&(e==n.from&&t<0||e==n.to&&t>0)&&i.dir!=this.textDirectionAt(n.from)&&(e==n.to?(e=n.from+i.from,t=1):(e=n.from+i.to,t=-1)),this.docView.coordsAt(e,t,i.dir==Tf.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(rp)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Cg)return Wf(e.length);let t=this.textDirectionAt(e.from),n;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||If(r.isolates,n=Sp(this,e))))return r.order;n||=Sp(this,e);let r=Uf(e.text,t,n);return this.bidiCache.push(new Tg(e.from,e.to,t,n,!0,r)),r}get hasFocus(){return(this.dom.ownerDocument.hasFocus()||q.safari&&this.inputState?.lastContextMenu>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{hf(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={}){return sp.of(new op(typeof e==`number`?G.cursor(e):e,t.y??`nearest`,t.x??`nearest`,t.yMargin??5,t.xMargin??5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return sp.of(new op(G.cursor(n.from),`start`,`start`,n.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 pp.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return pp.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=ld.newName(),r=[cg.of(n),Ep.of(mg(`.${n}`,e))];return t&&t.dark&&r.push(lg.of(!0)),r}static baseTheme(e){return ru.lowest(Ep.of(mg(`.`+ug,e,pg)))}static findFromDOM(e){let t=e.querySelector(`.cm-content`);return(t&&Ap.get(t)||Ap.get(e))?.root?.view||null}};J.styleModule=Ep,J.inputHandler=$f,J.clipboardInputFilter=tp,J.clipboardOutputFilter=np,J.scrollHandler=ap,J.focusChangeEffect=ep,J.perLineTextDirection=rp,J.exceptionSink=Zf,J.updateListener=Qf,J.editable=up,J.mouseSelectionStyle=Xf,J.dragMovesSelection=Yf,J.clickAddsSelectionRange=Jf,J.decorations=_p,J.blockWrappers=vp,J.outerDecorations=yp,J.atomicRanges=bp,J.bidiIsolatedRanges=xp,J.cursorScrollMargin=K.define({combine:e=>{let t=5,n=5;for(let r of e)typeof r==`number`?t=n=r:{x:t,y:n}=r;return{x:t,y:n}}}),J.scrollMargins=wp,J.darkTheme=lg,J.cspNonce=K.define({combine:e=>e.length?e[0]:``}),J.contentAttributes=gp,J.editorAttributes=hp,J.lineWrapping=J.contentAttributes.of({class:`cm-lineWrapping`}),J.announce=xu.define();var Cg=4096,wg={},Tg=class e{constructor(e,t,n,r,i,a){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=i,this.order=a}static update(t,n){if(n.empty&&!t.some(e=>e.fresh))return t;let r=[],i=t.length?t[t.length-1].dir:Tf.LTR;for(let a=Math.max(0,t.length-10);a<t.length;a++){let o=t[a];o.dir==i&&!n.touchesRange(o.from,o.to)&&r.push(new e(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}};function Eg(e,t,n){for(let r=e.state.facet(t),i=r.length-1;i>=0;i--){let t=r[i],a=typeof t==`function`?t(e):t;a&&Md(a,n)}return n}var Dg=q.mac?`mac`:q.windows?`win`:q.linux?`linux`:`key`;function Og(e,t){let n=e.split(/-(?!$)/),r=n[n.length-1];r==`Space`&&(r=` `);let i,a,o,s;for(let e=0;e<n.length-1;++e){let r=n[e];if(/^(cmd|meta|m)$/i.test(r))s=!0;else if(/^a(lt)?$/i.test(r))i=!0;else if(/^(c|ctrl|control)$/i.test(r))a=!0;else if(/^s(hift)?$/i.test(r))o=!0;else if(/^mod$/i.test(r))t==`mac`?s=!0:a=!0;else throw Error(`Unrecognized modifier name: `+r)}return i&&(r=`Alt-`+r),a&&(r=`Ctrl-`+r),s&&(r=`Meta-`+r),o&&(r=`Shift-`+r),r}function kg(e,t,n){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n!==!1&&t.shiftKey&&(e=`Shift-`+e),e}var Ag=ru.default(J.domEventHandlers({keydown(e,t){return zg(Ng(t.state),e,t,`editor`)}})),jg=K.define({enables:Ag}),Mg=new WeakMap;function Ng(e){let t=e.facet(jg),n=Mg.get(t);return n||Mg.set(t,n=Lg(t.reduce((e,t)=>e.concat(t),[]))),n}function Pg(e,t,n){return zg(Ng(e.state),t,e,n)}var Fg=null,Ig=4e3;function Lg(e,t=Dg){let n=Object.create(null),r=Object.create(null),i=(e,t)=>{let n=r[e];if(n==null)r[e]=t;else if(n!=t)throw Error(`Key binding `+e+` is used both as a regular binding and as a multi-stroke prefix`)},a=(e,r,a,o,s)=>{let c=n[e]||(n[e]=Object.create(null)),l=r.split(/ (?!$)/).map(e=>Og(e,t));for(let t=1;t<l.length;t++){let n=l.slice(0,t).join(` `);i(n,!0),c[n]||(c[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let r=Fg={view:t,prefix:n,scope:e};return setTimeout(()=>{Fg==r&&(Fg=null)},Ig),!0}]})}let u=l.join(` `);i(u,!1);let d=c[u]||(c[u]={preventDefault:!1,stopPropagation:!1,run:(c._any?.run)?.slice()||[]});a&&d.run.push(a),o&&(d.preventDefault=!0),s&&(d.stopPropagation=!0)};for(let r of e){let e=r.scope?r.scope.split(` `):[`editor`];if(r.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||={preventDefault:!1,stopPropagation:!1,run:[]};let{any:i}=r;for(let t in e)e[t].run.push(e=>i(e,Rg))}let i=r[t]||r.key;if(i)for(let t of e)a(t,i,r.run,r.preventDefault,r.stopPropagation),r.shift&&a(t,`Shift-`+i,r.shift,r.preventDefault,r.stopPropagation)}return n}var Rg=null;function zg(e,t,n,r){Rg=t;let i=vd(t),a=Pl(Ml(i,0))==i.length&&i!=` `,o=``,s=!1,c=!1,l=!1;Fg&&Fg.view==n&&Fg.scope==r&&(o=Fg.prefix+` `,Ym.indexOf(t.keyCode)<0&&(c=!0,Fg=null));let u=new Set,d=e=>{if(e){for(let t of e.run)if(!u.has(t)&&(u.add(t),t(n)))return e.stopPropagation&&(l=!0),!0;e.preventDefault&&(e.stopPropagation&&(l=!0),c=!0)}return!1},f=e[r],p,m;return f&&(d(f[o+kg(i,t,!a)])?s=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(q.windows&&t.ctrlKey&&t.altKey)&&!(q.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=fd[t.keyCode])&&p!=i?(d(f[o+kg(p,t,!0)])||t.shiftKey&&(m=pd[t.keyCode])!=i&&m!=p&&d(f[o+kg(m,t,!1)]))&&(s=!0):a&&t.shiftKey&&d(f[o+kg(i,t,!0)])&&(s=!0),!s&&d(f._any)&&(s=!0)),c&&(s=!0),s&&l&&t.stopPropagation(),Rg=null,s}var Bg=class e{constructor(e,t,n,r,i){this.className=e,this.left=t,this.top=n,this.width=r,this.height=i}draw(){let e=document.createElement(`div`);return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+`px`,e.style.top=this.top+`px`,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(t,n,r){if(r.empty){let i=t.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let a=Vg(t);return[new e(n,i.left-a.left,i.top-a.top,null,i.bottom-i.top)]}return Ug(t,n,r)}};function Vg(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Tf.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function Hg(e,t,n,r){let i=e.coordsAtPos(t,n*2);if(!i)return r;let a=e.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,s=e.posAtCoords({x:a.left+1,y:o}),c=e.posAtCoords({x:a.right-1,y:o});return s==null||c==null?r:{from:Math.max(r.from,Math.min(s,c)),to:Math.min(r.to,Math.max(s,c))}}function Ug(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),i=Math.min(n.to,e.viewport.to),a=e.textDirection==Tf.LTR,o=e.contentDOM,s=o.getBoundingClientRect(),c=Vg(e),l=o.querySelector(`.cm-line`),u=l&&window.getComputedStyle(l),d=s.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=s.right-(u?parseInt(u.paddingRight):0),p=vm(e,r,1),m=vm(e,i,-1),h=p.type==zd.Text?p:null,g=m.type==zd.Text?m:null;if(h&&(e.lineWrapping||p.widgetLineBreaks)&&(h=Hg(e,r,1,h)),g&&(e.lineWrapping||m.widgetLineBreaks)&&(g=Hg(e,i,-1,g)),h&&g&&h.from==g.from&&h.to==g.to)return v(y(n.from,n.to,h));{let t=h?y(n.from,null,h):b(p,!1),r=g?y(null,n.to,g):b(m,!0),i=[];return(h||p).to<(g||m).from-(h&&g?1:0)||p.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2<r.top?i.push(_(d,t.bottom,f,r.top)):t.bottom<r.top&&e.elementAtHeight((t.bottom+r.top)/2).type==zd.Text&&(t.bottom=r.top=(t.bottom+r.top)/2),v(t).concat(i).concat(v(r))}function _(e,n,r,i){return new Bg(t,e-c.left,n-c.top,Math.max(0,r-e),i-n)}function v({top:e,bottom:t,horizontal:n}){let r=[];for(let i=0;i<n.length;i+=2)r.push(_(n[i],e,n[i+1],t));return r}function y(t,n,r){let i=1e9,o=-1e9,s=[];function c(t,n,c,l,u){let p=e.coordsAtPos(t,t==r.to?-2:2),m=e.coordsAtPos(c,c==r.from?2:-2);p&&m&&(i=Math.min(p.top,m.top,i),o=Math.max(p.bottom,m.bottom,o),u==Tf.LTR?s.push(a&&n?d:p.left,a&&l?f:m.right):s.push(!a&&l?d:m.left,!a&&n?f:p.right))}let l=t??r.from,u=n??r.to;for(let r of e.visibleRanges)if(r.to>l&&r.from<u)for(let i=Math.max(r.from,l),a=Math.min(r.to,u);;){let r=e.state.doc.lineAt(i);for(let o of e.bidiSpans(r)){let e=o.from+r.from,s=o.to+r.from;if(e>=a)break;s>i&&c(Math.max(e,i),t==null&&e<=l,Math.min(s,a),n==null&&s>=u,o.dir)}if(i=r.to+1,i>=a)break}return s.length==0&&c(l,t==null,u,n==null,e.textDirection),{top:i,bottom:o,horizontal:s}}function b(e,t){let n=s.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}function Wg(e,t){return e.constructor==t.constructor&&e.eq(t)}var Gg=class{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(Kg)!=e.state.facet(Kg)&&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,n=e.facet(Kg);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((e,t)=>!Wg(e,this.drawn[t]))){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e,q.webkit&&(this.dom.style.display=this.dom.firstChild?``:`none`)}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},Kg=K.define();function qg(e){return[pp.define(t=>new Gg(t,e)),Kg.of(e)]}var Jg=!q.ios,Yg=K.define({combine(e){return Lu(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function Xg(e={}){return[Yg.of(e),$g,t_,r_,ip.of(!0)]}function Zg(e){return e.facet(Yg)}function Qg(e){return e.startState.facet(Yg)!=e.state.facet(Yg)}var $g=qg({above:!0,markers(e){let{state:t}=e,n=t.facet(Yg),r=[];for(let i of t.selection.ranges){let a=i==t.selection.main;if(i.empty||n.drawRangeCursor&&!(a&&q.ios&&n.iosSelectionHandles)){let t=a?`cm-cursor cm-cursor-primary`:`cm-cursor cm-cursor-secondary`,n=i.empty?i:G.cursor(i.head,i.assoc);for(let i of Bg.forRange(e,t,n))r.push(i)}}return r},update(e,t){e.transactions.some(e=>e.selection)&&(t.style.animationName=t.style.animationName==`cm-blink`?`cm-blink2`:`cm-blink`);let n=Qg(e);return n&&e_(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){e_(t.state,e)},class:`cm-cursorLayer`});function e_(e,t){t.style.animationDuration=e.facet(Yg).cursorBlinkRate+`ms`}var t_=qg({above:!1,markers(e){let t=[],{main:n,ranges:r}=e.state.selection;for(let i of r)if(!i.empty&&(Jg||i!=n))for(let n of Bg.forRange(e,`cm-selectionBackground`,i))t.push(n);if(q.ios&&!n.empty&&e.state.facet(Yg).iosSelectionHandles){for(let r of Bg.forRange(e,`cm-selectionHandle cm-selectionHandle-start`,G.cursor(n.from,1)))t.push(r);for(let r of Bg.forRange(e,`cm-selectionHandle cm-selectionHandle-end`,G.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||Qg(e)},class:`cm-selectionLayer`}),n_=q.gecko&&q.gecko_version==153?`#ffffff01`:`transparent`,r_=ru.highest(J.theme({".cm-line":{...Jg?{"& ::selection, &::selection":{backgroundColor:`${n_} !important`}}:{},caretColor:`transparent !important`},".cm-content":{caretColor:`transparent !important`,"& :focus":{caretColor:`initial !important`,...Jg?{"&::selection, & ::selection":{backgroundColor:`Highlight !important`}}:{}}}}));/x/.unicode;var i_=`-10000px`,a_=class{constructor(e,t,n,r){this.facet=t,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let i=null;this.tooltipViews=this.tooltips.map(e=>i=n(e,i))}update(e,t){var n;let r=e.state.facet(this.facet),i=r.filter(e=>e);if(r===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let a=[],o=t?[]:null;for(let n=0;n<i.length;n++){let r=i[n],s=-1;if(r){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==r.create&&(s=e)}if(s<0)a[n]=this.createTooltipView(r,n?a[n-1]:null),o&&(o[n]=!!r.above);else{let r=a[n]=this.tooltipViews[s];o&&(o[n]=t[s]),r.update&&r.update(e)}}}for(let e of this.tooltipViews)a.indexOf(e)<0&&(this.removeTooltipView(e),(n=e.destroy)==null||n.call(e));return t&&(o.forEach((e,n)=>t[n]=e),t.length=o.length),this.input=r,this.tooltips=i,this.tooltipViews=a,!0}};function o_(e){let t=e.dom.ownerDocument.documentElement,n=t.clientWidth,r=getComputedStyle(t);if(!/stable/.test(r.scrollbarGutter||``))return{left:0,right:n};let i=t.getBoundingClientRect(),a=e.win.scrollX;return{left:Math.max(0,i.left+a-parseFloat(r.marginLeft)),right:Math.min(n,i.right+a+parseFloat(r.marginRight))}}function s_(e){let{left:t,right:n}=o_(e);return{top:0,left:t,right:n,bottom:e.dom.ownerDocument.documentElement.clientHeight}}var c_=K.define({combine:e=>({position:q.ios?`absolute`:e.find(e=>e.position)?.position||`fixed`,parent:e.find(e=>e.parent)?.parent||null,tooltipSpace:e.find(e=>e.tooltipSpace)?.tooltipSpace||s_})}),l_=new WeakMap,u_=pp.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(c_);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver==`function`?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new a_(e,m_,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver=typeof IntersectionObserver==`function`?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener(`resize`,this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement(`div`),this.container.style.position=`relative`,this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(c_);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add(`cm-tooltip`),e.arrow&&!n.dom.querySelector(`.cm-tooltip > .cm-tooltip-arrow`)){let e=document.createElement(`div`);e.className=`cm-tooltip-arrow`,n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=i_,n.dom.style.left=`0px`,this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener(`resize`,this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),(e=t.destroy)==null||e.call(t);this.parent&&this.container.remove(),(t=this.resizeObserver)==null||t.disconnect(),(n=this.intersectionObserver)==null||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1,r=0;if(this.position==`fixed`&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(q.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||this.position==`absolute`){if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState)}else r=o_(this.view).left;let i=this.view.scrollDOM.getBoundingClientRect(),a=Tp(this.view);return{visible:{left:i.left+a.left,top:i.top+a.top,right:i.right-a.right,bottom:i.bottom-a.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(c_).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n,fixedLeft:r}}writeMeasure(e){if(e.makeAbsolute){this.madeAbsolute=!0,this.position=`absolute`;for(let e of this.manager.tooltipViews)e.dom.style.position=`absolute`}let{visible:t,space:n,scaleX:r,scaleY:i}=e,a=[];for(let o=0;o<this.manager.tooltips.length;o++){let s=this.manager.tooltips[o],c=this.manager.tooltipViews[o],{dom:l}=c,u=e.pos[o],d=e.size[o];if(!u||s.clip!==!1&&(u.bottom<=Math.max(t.top,n.top)||u.top>=Math.min(t.bottom,n.bottom)||u.right<Math.max(t.left,n.left)-.1||u.left>Math.min(t.right,n.right)+.1)){l.style.top=i_;continue}let f=s.arrow?c.dom.querySelector(`.cm-tooltip-arrow`):null,p=f?7:0,m=d.right-d.left,h=l_.get(c)??d.bottom-d.top,g=c.offset||p_,_=this.view.textDirection==Tf.LTR,v=d.width>n.right-n.left?_?n.left:n.right-d.width:_?Math.max(n.left,Math.min(u.left-(f?14:0)+g.x,n.right-m)):Math.min(Math.max(n.left,u.left-m+(f?14:0)-g.x),n.right-m),y=this.above[o];!s.strictSide&&(y?u.top-h-p-g.y<n.top:u.bottom+h+p+g.y>n.bottom)&&y==n.bottom-u.bottom>u.top-n.top&&(y=this.above[o]=!y);let b=(y?u.top-n.top:n.bottom-u.bottom)-p;if(b<h&&c.resize!==!1){if(b<this.view.defaultLineHeight){l.style.top=i_;continue}l_.set(c,h),l.style.height=(h=b)/i+`px`}else l.style.height&&(l.style.height=``);let x=y?u.top-h-p-g.y:u.bottom+p+g.y,S=v+m;if(c.overlap!==!0)for(let e of a)e.left<S&&e.right>v&&e.top<x+h&&e.bottom>x&&(x=y?e.top-h-2-p:e.bottom+p+2);if(this.position==`absolute`?(l.style.top=(x-e.parent.top)/i+`px`,d_(l,(v-e.parent.left)/r)):(l.style.top=x/i+`px`,d_(l,(v-e.fixedLeft)/r)),f){let e=u.left+(_?g.x:-g.x)-(v+14-7);f.style.left=e/r+`px`}c.overlap!==!0&&a.push({left:v,top:x,right:S,bottom:x+h}),l.classList.toggle(`cm-tooltip-above`,y),l.classList.toggle(`cm-tooltip-below`,!y),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=i_}},{eventObservers:{scroll(){this.maybeMeasure()}}});function d_(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+`px`)}var f_=J.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`}}}),p_={x:0,y:0},m_=K.define({enables:[u_,f_]}),h_=K.define({combine(e){let t,n;for(let r of e)t||=r.topContainer,n||=r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function g_(e,t){let n=e.plugin(__),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}var __=pp.fromClass(class{constructor(e){this.input=e.state.facet(b_),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(h_);this.top=new v_(e,!0,t.topContainer),this.bottom=new v_(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}update(e){let t=e.state.facet(h_);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new v_(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new v_(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(b_);if(n!=this.input){let t=n.filter(e=>e),r=[],i=[],a=[],o=[];for(let n of t){let t=this.specs.indexOf(n),s;t<0?(s=n(e.view),o.push(s)):(s=this.panels[t],s.update&&s.update(e)),r.push(s),(s.top?i:a).push(s)}this.specs=t,this.panels=r,this.top.sync(i),this.bottom.sync(a);for(let e of o)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>J.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})}),v_=class{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes=``,this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&=(this.dom.remove(),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 e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=y_(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=y_(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 y_(e){let t=e.nextSibling;return e.remove(),t}var b_=K.define({enables:__}),x_=class extends Ru{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};x_.prototype.elementClass=``,x_.prototype.toDOM=void 0,x_.prototype.mapMode=Il.TrackBefore,x_.prototype.startSide=x_.prototype.endSide=-1,x_.prototype.point=!0;var S_=1024,C_=0,w_=class{constructor(e,t){this.from=e,this.to=t}},Y=class{constructor(e={}){this.id=C_++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error(`This node type doesn't define a deserialize function`)}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError(`Can't add per-node props to node types`);return typeof e!=`function`&&(e=D_.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};Y.closedBy=new Y({deserialize:e=>e.split(` `)}),Y.openedBy=new Y({deserialize:e=>e.split(` `)}),Y.group=new Y({deserialize:e=>e.split(` `)}),Y.isolate=new Y({deserialize:e=>{if(e&&e!=`rtl`&&e!=`ltr`&&e!=`auto`)throw RangeError(`Invalid value for isolate: `+e);return e||`auto`}}),Y.contextHash=new Y({perNode:!0}),Y.lookAhead=new Y({perNode:!0}),Y.mounted=new Y({perNode:!0});var T_=class{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[Y.mounted.id]}},E_=Object.create(null),D_=class e{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(t){let n=t.props&&t.props.length?Object.create(null):E_,r=+!!t.top|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new e(t.name||``,n,t.id,r);if(t.props){for(let e of t.props)if(Array.isArray(e)||(e=e(i)),e){if(e[0].perNode)throw RangeError(`Can't store a per-node prop on a node type`);n[e[0].id]=e[1]}}return i}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(Y.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(` `))t[r]=e[n];return e=>{for(let n=e.prop(Y.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};D_.none=new D_(``,Object.create(null),0,8);var O_=class e{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw RangeError(`Node type ids should correspond to array positions when creating a node set`)}extend(...t){let n=[];for(let e of this.types){let r=null;for(let n of t){let t=n(e);if(t){r||=Object.assign({},e.props);let n=t[1],i=t[0];i.combine&&i.id in r&&(n=i.combine(r[i.id],n)),r[i.id]=n}}n.push(r?new D_(e.name,r,e.id,e.flags):e)}return new e(n)}},k_=new WeakMap,A_=new WeakMap,j_;(function(e){e[e.ExcludeBuffers=1]=`ExcludeBuffers`,e[e.IncludeAnonymous=2]=`IncludeAnonymous`,e[e.IgnoreMounts=4]=`IgnoreMounts`,e[e.IgnoreOverlays=8]=`IgnoreOverlays`,e[e.EnterBracketed=16]=`EnterBracketed`})(j_||={});var M_=class e{constructor(e,t,n,r,i){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props[typeof e==`number`?e:e.id]=t}}toString(){let e=T_.get(this);if(e&&!e.overlay)return e.tree.toString();let t=``;for(let e of this.children){let n=e.toString();n&&(t&&(t+=`,`),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?`(`+t+`)`:``):t}cursor(e=0){return new K_(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new K_(k_.get(this)||this.topNode);return r.moveTo(e,t),k_.set(this,r._tree),r}get topNode(){return new R_(this,0,0,null)}resolve(e,t=0){let n=I_(k_.get(this)||this.topNode,e,t,!1);return k_.set(this,n),n}resolveInner(e,t=0){let n=I_(A_.get(this)||this.topNode,e,t,!0);return A_.set(this,n),n}resolveStack(e,t=0){return G_(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,a=e.mode||0,o=(a&j_.IncludeAnonymous)>0;for(let e=this.cursor(a|j_.IncludeAnonymous);;){let a=!1;if(e.from<=i&&e.to>=r&&(!o&&e.type.isAnonymous||t(e)!==!1)){if(e.firstChild())continue;a=!0}for(;a&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;a=!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(t={}){return this.children.length<=8?this:Z_(D_.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new e(this.type,t,n,r,this.propValues),t.makeTree||((t,n,r)=>new e(D_.none,t,n,r)))}static build(e){return J_(e)}};M_.empty=new M_(D_.none,[],[],0);var N_=class e{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 e(this.buffer,this.index)}},P_=class e{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return D_.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(`,`)}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),e+=4,n==e)return i;let a=[];for(;e<n;)a.push(this.childString(e)),e=this.buffer[e+3];return i+`(`+a.join(`,`)+`)`}findChild(e,t,n,r,i){let{buffer:a}=this,o=-1;for(let s=e;s!=t&&!(F_(i,r,a[s+1],a[s+2])&&(o=s,n>0));s=a[s+3]);return o}slice(t,n,r){let i=this.buffer,a=new Uint16Array(n-t),o=0;for(let e=t,s=0;e<n;){a[s++]=i[e++],a[s++]=i[e++]-r;let n=a[s++]=i[e++]-r;a[s++]=i[e++]-t,o=Math.max(o,n)}return new e(a,o,this.set)}};function F_(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function I_(e,t,n,r){for(;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!r&&e instanceof R_&&e.index<0?null:e.parent;if(!t)return e;e=t}let i=r?0:j_.IgnoreOverlays;if(r)for(let r=e,a=r.parent;a;r=a,a=r.parent)r instanceof R_&&r.index<0&&a.enter(t,n,i)?.from!=r.from&&(e=a);for(;;){let r=e.enter(t,n,i);if(!r)return e;e=r}}var L_=class{cursor(e=0){return new K_(this,e)}getChild(e,t=null,n=null){let r=z_(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return z_(this,e,t,n)}resolve(e,t=0){return I_(this,e,t,!1)}resolveInner(e,t=0){return I_(this,e,t,!0)}matchContext(e){return B_(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}},R_=class e extends L_{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,r,i,a=0){for(let o=this;;){for(let{children:s,positions:c}=o._tree,l=n>0?s.length:-1;t!=l;t+=n){let l=s[t],u=c[t]+o.from,d;if(a&j_.EnterBracketed&&l instanceof M_&&(d=T_.get(l))&&!d.overlay&&d.bracketed&&r>=u&&r<=u+l.length||F_(i,r,u,u+l.length)){if(l instanceof P_){if(a&j_.ExcludeBuffers)continue;let e=l.findChild(0,l.buffer.length,n,r-u,i);if(e>-1)return new H_(new V_(o,l,t,u),null,e)}else if(a&j_.IncludeAnonymous||!l.type.isAnonymous||q_(l)){let s;if(!(a&j_.IgnoreMounts)&&(s=T_.get(l))&&!s.overlay)return new e(s.tree,u,t,o);let c=new e(l,u,t,o);return a&j_.IncludeAnonymous||!c.type.isAnonymous?c:c.nextChild(n<0?l.children.length-1:0,n,r,i,a)}}}if(a&j_.IncludeAnonymous||!o.type.isAnonymous||(t=o.index>=0?o.index+n:n<0?-1:o._parent._tree.children.length,o=o._parent,!o))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(t,n,r=0){let i;if(!(r&j_.IgnoreOverlays)&&(i=T_.get(this._tree))&&i.overlay){let a=t-this.from,o=r&j_.EnterBracketed&&i.bracketed;for(let{from:t,to:r}of i.overlay)if((n>0||o?t<=a:t<a)&&(n<0||o?r>=a:r>a))return new e(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}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 z_(e,t,n,r){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(n!=null){for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return a}for(;;){if(r!=null&&i.type.is(r))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return r==null?a:[]}}function B_(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}var V_=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},H_=class e extends L_{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(t,n,r){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.context.start,r);return a<0?null:new e(this.context,this,a)}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(t,n,r=0){if(r&j_.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return a<0?null:new e(this.context,this,a)}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:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new e(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new e(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let a=n.buffer[this.index+1];e.push(n.slice(r,i,a)),t.push(0)}return new M_(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function U_(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(i.from>n.from||i.to<n.to)&&(n=i,t=r)}let r=n instanceof R_&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new W_(i,n)}var W_=class{constructor(e,t){this.heads=e,this.node=t}get next(){return U_(this.heads)}};function G_(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof R_?r:r.context.parent;e;e=e.parent)if(e.index<0){let a=e.parent;(i||=[r]).push(a.resolve(t,n)),e=a}else{let a=T_.get(e.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new R_(a.tree,a.overlay[0].from+e.from,-1,e);(i||=[r]).push(I_(o,t,n,!1))}}return i?U_(i):r}var K_=class{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&~j_.EnterBracketed,e instanceof R_)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.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:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof R_?(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,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}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,n=this.mode){return this.buffer?n&j_.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&j_.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&j_.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,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&j_.IncludeAnonymous||e instanceof P_||!e.type.isAnonymous||q_(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)scan:for(let r=this.index,i=this.stack.length;i>=0;){for(let a=e;a;a=a._parent)if(a.index==r){if(r==this.index)return a;t=a,n=i+1;break scan}r=this.stack[--i]}for(let e=n;e<this.stack.length;e++)t=new H_(this.buffer,t,this.stack[e]);return this.bufferNode=new H_(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return B_(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return B_(this._tree,e,r);let a=n[t.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[r]&&e[r]!=a.name)return!1;r--}}return!0}};function q_(e){return e.children.some(e=>e instanceof P_||!e.type.isAnonymous||q_(e))}function J_(e){let{buffer:t,nodeSet:n,maxBufferLength:r=S_,reused:i=[],minRepeatType:a=n.types.length}=e,o=Array.isArray(t)?new N_(t,t.length):t,s=n.types,c=0,l=0;function u(e,t,_,v,y,b){let{id:x,start:S,end:C,size:w}=o,T=l,ee=c;if(w<0){if(o.next(),w==-1){let t=i[x];_.push(t),v.push(S-e);return}if(w==-3){c=x;return}if(w==-4){l=x;return}throw RangeError(`Unrecognized record size: ${w}`)}let E=s[x],te,ne,re=S-e;if(C-S<=r&&(ne=h(o.pos-t,y))){let t=new Uint16Array(ne.size-ne.skip),r=o.pos-ne.size,i=t.length;for(;o.pos>r;)i=g(ne.start,t,i);te=new P_(t,C-ne.start,n),re=ne.start-e}else{let e=o.pos-w;o.next();let t=[],n=[],i=x>=a?x:-1,s=0,c=C;for(;o.pos>e;)i>=0&&o.id==i&&o.size>=0?(o.end<=c-r&&(p(t,n,S,s,o.end,c,i,T,ee),s=t.length,c=o.end),o.next()):b>2500?d(S,e,t,n):u(S,e,t,n,i,b+1);if(i>=0&&s>0&&s<t.length&&p(t,n,S,s,S,c,i,T,ee),t.reverse(),n.reverse(),i>-1&&s>0){let e=f(E,ee);te=Z_(E,t,n,0,t.length,0,C-S,e,e)}else te=m(E,t,n,C-S,T-C,ee)}_.push(te),v.push(re)}function d(e,t,i,a){let s=[],c=0,l=-1;for(;o.pos>t;){let{id:e,start:t,end:n,size:i}=o;if(i>4)o.next();else if(l>-1&&t<l)break;else l<0&&(l=n-r),s.push(e,t,n),c++,o.next()}if(c){let t=new Uint16Array(c*4),r=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-r,t[n++]=s[e+2]-r,t[n++]=n;i.push(new P_(t,s[2]-r,n)),a.push(r-e)}}function f(e,t){return(n,r,i)=>{let a=0,o=n.length-1,s,c;if(o>=0&&(s=n[o])instanceof M_){if(!o&&s.type==e&&s.length==i)return s;(c=s.prop(Y.lookAhead))&&(a=r[o]+s.length+c)}return m(e,n,r,i,a,t)}}function p(e,t,r,i,a,o,s,c,l){let u=[],d=[];for(;e.length>i;)u.push(e.pop()),d.push(t.pop()+r-a);e.push(m(n.types[s],u,d,o-a,c-o,l)),t.push(a-r)}function m(e,t,n,r,i,a,o){if(a){let e=[Y.contextHash,a];o=o?[e].concat(o):[e]}if(i>25){let e=[Y.lookAhead,i];o=o?[e].concat(o):[e]}return new M_(e,t,n,r,o)}function h(e,t){let n=o.fork(),i=0,s=0,c=0,l=n.end-r,u={size:0,start:0,skip:0};scan:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){u.size=i,u.start=s,u.skip=c,c+=4,i+=4,n.next();continue}let o=n.pos-e;if(e<0||o<r||n.start<l)break;let d=n.id>=a?4:0,f=n.start;for(n.next();n.pos>o;){if(n.size<0){if(n.size==-3||n.size==-4)d+=4;else break scan}else n.id>=a&&(d+=4);n.next()}s=f,i+=e,c+=d}return(t<0||i==e)&&(u.size=i,u.start=s,u.skip=c),u.size>4?u:void 0}function g(e,t,n){let{id:r,start:i,end:s,size:u}=o;if(o.next(),u>=0&&r<a){let a=n;if(u>4){let r=o.pos-(u-4);for(;o.pos>r;)n=g(e,t,n)}t[--n]=a,t[--n]=s-e,t[--n]=i-e,t[--n]=r}else u==-3?c=r:u==-4&&(l=r);return n}let _=[],v=[];for(;o.pos>0;)u(e.start||0,e.bufferStart||0,_,v,-1,0);let y=e.length??(_.length?v[0]+_[0].length:0);return new M_(s[e.topID],_.reverse(),v.reverse(),y)}var Y_=new WeakMap;function X_(e,t){if(!e.isAnonymous||t instanceof P_||t.type!=e)return 1;let n=Y_.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof M_)){n=1;break}n+=X_(e,r)}Y_.set(t,n)}return n}function Z_(e,t,n,r,i,a,o,s,c){let l=0;for(let n=r;n<i;n++)l+=X_(e,t[n]);let u=Math.ceil(l*1.5/8),d=[],f=[];function p(t,n,r,i,o){for(let s=r;s<i;){let r=s,l=n[s],m=X_(e,t[s]);for(s++;s<i;s++){let n=X_(e,t[s]);if(m+n>=u)break;m+=n}if(s==r+1){if(m>u){let e=t[r];p(e.children,e.positions,0,e.children.length,n[r]+o);continue}d.push(t[r])}else{let i=n[s-1]+t[s-1].length-l;d.push(Z_(e,t,n,r,s,l,i,null,c))}f.push(l+o-a)}}return p(t,n,r,i,0),(s||c)(d,f,o)}var Q_=class{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof H_?this.setBuffer(e.context.buffer,e.index,t):e instanceof R_&&this.map.set(e.tree,t)}get(e){return e instanceof H_?this.getBuffer(e.context.buffer,e.index):e instanceof R_?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}},$_=class e{constructor(e,t,n,r,i=!1,a=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=!!i|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let i=[new e(0,t.length,t,0,!1,r)];for(let e of n)e.to>t.length&&i.push(e);return i}static applyChanges(t,n,r=128){if(!n.length)return t;let i=[],a=1,o=t.length?t[0]:null;for(let s=0,c=0,l=0;;s++){let u=s<n.length?n[s]:null,d=u?u.fromA:1e9;if(d-c>=r)for(;o&&o.from<d;){let n=o;if(c>=n.from||d<=n.to||l){let t=Math.max(n.from,c)-l,r=Math.min(n.to,d)-l;n=t>=r?null:new e(t,r,n.tree,n.offset+l,s>0,!!u)}if(n&&i.push(n),o.to>d)break;o=a<t.length?t[a++]:null}if(!u)break;c=u.toA,l=u.toA-u.toB}return i}},ev=class{startParse(e,t,n){return typeof e==`string`&&(e=new tv(e)),n=n?n.length?n.map(e=>new w_(e.from,e.to)):[new w_(0,0)]:[new w_(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}},tv=class{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)}};function nv(e){return(t,n,r,i)=>new sv(t,e,n,r,i)}var rv=class{constructor(e,t,n,r,i,a){this.parser=e,this.parse=t,this.overlay=n,this.bracketed=r,this.target=i,this.from=a}};function iv(e){if(!e.length||e.some(e=>e.from>=e.to))throw RangeError(`Invalid inner parse ranges given: `+JSON.stringify(e))}var av=class{constructor(e,t,n,r,i,a,o,s){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=i,this.bracketed=a,this.target=o,this.prev=s,this.depth=0,this.ranges=[]}},ov=new Y({perNode:!0}),sv=class{constructor(e,t,n,r,i){this.nest=t,this.input=n,this.fragments=r,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),this.stoppedAt!=null)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return this.stoppedAt!=null&&(e=new M_(e.type,e.children,e.positions,e.length,e.propValues.concat([[ov,this.stoppedAt]]))),e}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[Y.mounted.id]=new T_(t,e.overlay,e.parser,e.bracketed),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new fv(this.fragments),t=null,n=null,r=new K_(new R_(this.baseTree,this.ranges[0].from,0,null),j_.IncludeAnonymous|j_.IgnoreMounts);scan:for(let i,a;;){let o=!0,s;if(this.stoppedAt!=null&&r.from>=this.stoppedAt)o=!1;else if(e.hasNode(r)){if(t){let e=t.mounts.find(e=>e.frag.from<=r.from&&e.frag.to>=r.to&&e.mount.overlay);if(e)for(let n of e.mount.overlay){let i=n.from+e.pos,a=n.to+e.pos;i>=r.from&&a<=r.to&&!t.ranges.some(e=>e.from<a&&e.to>i)&&t.ranges.push({from:i,to:a})}}o=!1}else if(n&&(a=cv(n.ranges,r.from,r.to)))o=a!=2;else if(!r.type.isAnonymous&&(i=this.nest(r,this.input))&&(r.from<r.to||!i.overlay)){r.tree||(uv(r),t&&t.depth++,n&&n.depth++);let a=e.findMounts(r.from,i.parser);if(typeof i.overlay==`function`)t=new av(i.parser,i.overlay,a,this.inner.length,r.from,!!i.bracketed,r.tree,t);else{let e=pv(this.ranges,i.overlay||(r.from<r.to?[new w_(r.from,r.to)]:[]));e.length&&iv(e),(e.length||!i.overlay)&&this.inner.push(new rv(i.parser,e.length?i.parser.startParse(this.input,hv(a,e),e):i.parser.startParse(``),i.overlay?i.overlay.map(e=>new w_(e.from-r.from,e.to-r.from)):null,!!i.bracketed,r.tree,e.length?e[0].from:r.from)),i.overlay?e.length&&(n={ranges:e,depth:0,prev:n}):o=!1}}else if(t&&(s=t.predicate(r))&&(s===!0&&(s=new w_(r.from,r.to)),s.from<s.to)){let e=t.ranges.length-1;e>=0&&t.ranges[e].to==s.from?t.ranges[e]={from:t.ranges[e].from,to:s.to}:t.ranges.push(s)}if(o&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break scan;if(t&&!--t.depth){let e=pv(this.ranges,t.ranges);e.length&&(iv(e),this.inner.splice(t.index,0,new rv(t.parser,t.parser.startParse(this.input,hv(t.mounts,e),e),t.ranges.map(e=>new w_(e.from-t.start,e.to-t.start)),t.bracketed,t.target,e[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}};function cv(e,t,n){for(let r of e){if(r.from>=n)break;if(r.to>t)return r.from<=t&&r.to>=n?2:1}return 0}function lv(e,t,n,r,i,a){if(t<n){let o=e.buffer[t+1];r.push(e.slice(t,n,o)),i.push(o-a)}}function uv(e){let{node:t}=e,n=[],r=t.context.buffer;do n.push(e.index),e.parent();while(!e.tree);let i=e.tree,a=i.children.indexOf(r),o=i.children[a],s=o.buffer,c=[a];function l(e,r,i,a,u,d){let f=n[d],p=[],m=[];lv(o,e,f,p,m,a);let h=s[f+1],g=s[f+2];c.push(p.length);let _=d?l(f+4,s[f+3],o.set.types[s[f]],h,g-h,d-1):t.toTree();return p.push(_),m.push(h-a),lv(o,s[f+3],r,p,m,a),new M_(i,p,m,u)}i.children[a]=l(0,s.length,D_.none,0,o.length,n.length-1);for(let t of c){let n=e.tree.children[t],r=e.tree.positions[t];e.yield(new R_(n,r+e.from,t,e._tree))}}var dv=class{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(j_.IncludeAnonymous|j_.IgnoreMounts|j_.ExcludeBuffers)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)if(!(t.to>=n&&t.enter(n,1,j_.IncludeAnonymous|j_.IgnoreOverlays|j_.ExcludeBuffers))){if(t.to<=n)t.next(!1)||(this.done=!0);else break}}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof M_)t=t.children[0];else break}return!1}},fv=class{constructor(e){if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let t=this.curFrag=e[0];this.curTo=t.tree.prop(ov)??t.to,this.inner=new dv(t.tree,-t.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=e.tree.prop(ov)??e.to,this.inner=new dv(e.tree,-e.offset)}}findMounts(e,t){let n=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let e=this.inner.cursor.node;e;e=e.parent){let r=e.tree?.prop(Y.mounted);if(r&&r.parser==t)for(let t=this.fragI;t<this.fragments.length;t++){let i=this.fragments[t];if(i.from>=e.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:e.from-i.offset,mount:r})}}}return n}};function pv(e,t){let n=null,r=t;for(let i=1,a=0;i<e.length;i++){let o=e[i-1].to,s=e[i].from;for(;a<r.length;a++){let e=r[a];if(e.from>=s)break;e.to<=o||(n||(r=n=t.slice()),e.from<o?(n[a]=new w_(e.from,o),e.to>s&&n.splice(a+1,0,new w_(s,e.to))):e.to>s?n[a--]=new w_(s,e.to):n.splice(a--,1))}}return r}function mv(e,t,n,r){let i=0,a=0,o=!1,s=!1,c=-1e9,l=[];for(;;){let u=i==e.length?1e9:o?e[i].to:e[i].from,d=a==t.length?1e9:s?t[a].to:t[a].from;if(o!=s){let e=Math.max(c,n),t=Math.min(u,d,r);e<t&&l.push(new w_(e,t))}if(c=Math.min(u,d),c==1e9)break;u==c&&(o?(o=!1,i++):o=!0),d==c&&(s?(s=!1,a++):s=!0)}return l}function hv(e,t){let n=[];for(let{pos:r,mount:i,frag:a}of e){let e=r+(i.overlay?i.overlay[0].from:0),o=e+i.tree.length,s=Math.max(a.from,e),c=Math.min(a.to,o);if(i.overlay){let o=mv(t,i.overlay.map(e=>new w_(e.from+r,e.to+r)),s,c);for(let t=0,r=s;;t++){let s=t==o.length,l=s?c:o[t].from;if(l>r&&n.push(new $_(r,l,i.tree,-e,a.from>=r||a.openStart,a.to<=l||a.openEnd)),s)break;r=o[t].to}}else n.push(new $_(s,c,i.tree,-e,a.from>=e||a.openStart,a.to<=o||a.openEnd))}return n}var gv=0,_v=class e{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=gv++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(t,n){let r=typeof t==`string`?t:`?`;if(t instanceof e&&(n=t),n?.base)throw Error(`Can not derive from a modified tag`);let i=new e(r,[],null,[]);if(i.set.push(i),n)for(let e of n.set)i.set.push(e);return i}static defineModifier(e){let t=new yv(e);return e=>e.modified.indexOf(t)>-1?e:yv.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}},vv=0,yv=class e{constructor(e){this.name=e,this.instances=[],this.id=vv++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(e=>e.base==t&&bv(n,e.modified));if(r)return r;let i=[],a=new _v(t.name,i,t,n);for(let e of n)e.instances.push(a);let o=xv(n);for(let n of t.set)if(!n.modified.length)for(let t of o)i.push(e.get(n,t));return a}};function bv(e,t){return e.length==t.length&&e.every((e,n)=>e==t[n])}function xv(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,i=t.length;r<i;r++)t.push(t[r].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}function Sv(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let e of n.split(` `))if(e){let n=[],i=2,a=e;for(let t=0;;){if(a==`...`&&t>0&&t+3==e.length){i=1;break}let r=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!r)throw RangeError(`Invalid path: `+e);if(n.push(r[0]==`*`?``:r[0][0]==`"`?JSON.parse(r[0]):r[0]),t+=r[0].length,t==e.length)break;let o=e[t++];if(t==e.length&&o==`!`){i=0;break}if(o!=`/`)throw RangeError(`Invalid path: `+e);a=e.slice(t)}let o=n.length-1,s=n[o];if(!s)throw RangeError(`Invalid path: `+e);t[s]=new wv(r,i,o>0?n.slice(0,o):null).sort(t[s])}}return Cv.add(t)}var Cv=new Y({combine(e,t){let n,r,i;for(;e||t;){if(!e||t&&e.depth<=t.depth?(i=t,t=t.next):(i=e,e=e.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let a=new wv(i.tags,i.mode,i.context);n?n.next=a:r=a,n=a}return r}}),wv=class{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}};wv.empty=new wv([],2,null);function Tv(e,t){let n=Object.create(null);for(let t of e)if(!Array.isArray(t.tag))n[t.tag.id]=t.class;else for(let e of t.tag)n[e.id]=t.class;let{scope:r,all:i=null}=t||{};return{style:e=>{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+` `+r:r;break}}return t},scope:r}}function Ev(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+` `+e:e)}return n}function Dv(e,t,n,r=0,i=e.length){let a=new Ov(r,Array.isArray(t)?t:[t],n);a.highlightRange(e.cursor(),r,i,``,a.highlighters),a.flush(i)}var Ov=class{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=``}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,i){let{type:a,from:o,to:s}=e;if(o>=n||s<=t)return;a.isTop&&(i=this.highlighters.filter(e=>!e.scope||e.scope(a)));let c=r,l=kv(e)||wv.empty,u=Ev(i,l.tags);if(u&&(c&&(c+=` `),c+=u,l.mode==1&&(r+=(r?` `:``)+u)),this.startSpan(Math.max(t,o),c),l.opaque)return;let d=e.tree&&e.tree.prop(Y.mounted);if(d&&d.overlay){let a=e.node.enter(d.overlay[0].from+o,1),l=this.highlighters.filter(e=>!e.scope||e.scope(d.tree.type)),u=e.firstChild();for(let f=0,p=o;;f++){let m=f<d.overlay.length?d.overlay[f]:null,h=m?m.from+o:s,g=Math.max(t,p),_=Math.min(n,h);if(g<_&&u)for(;e.from<_&&(this.highlightRange(e,g,_,r,i),this.startSpan(Math.min(_,e.to),c),!(e.to>=h||!e.nextSibling())););if(!m||h>n)break;p=m.to+o,p>t&&(this.highlightRange(a.cursor(),Math.max(t,m.from+o),Math.min(n,p),``,l),this.startSpan(Math.min(n,p),c))}u&&e.parent()}else if(e.firstChild()){d&&(r=``);do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}};function kv(e){let t=e.type.prop(Cv);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var X=_v.define,Av=X(),jv=X(),Mv=X(jv),Nv=X(jv),Pv=X(),Fv=X(Pv),Iv=X(Pv),Lv=X(),Rv=X(Lv),zv=X(),Bv=X(),Vv=X(),Hv=X(Vv),Uv=X(),Z={comment:Av,lineComment:X(Av),blockComment:X(Av),docComment:X(Av),name:jv,variableName:X(jv),typeName:Mv,tagName:X(Mv),propertyName:Nv,attributeName:X(Nv),className:X(jv),labelName:X(jv),namespace:X(jv),macroName:X(jv),literal:Pv,string:Fv,docString:X(Fv),character:X(Fv),attributeValue:X(Fv),number:Iv,integer:X(Iv),float:X(Iv),bool:X(Pv),regexp:X(Pv),escape:X(Pv),color:X(Pv),url:X(Pv),keyword:zv,self:X(zv),null:X(zv),atom:X(zv),unit:X(zv),modifier:X(zv),operatorKeyword:X(zv),controlKeyword:X(zv),definitionKeyword:X(zv),moduleKeyword:X(zv),operator:Bv,derefOperator:X(Bv),arithmeticOperator:X(Bv),logicOperator:X(Bv),bitwiseOperator:X(Bv),compareOperator:X(Bv),updateOperator:X(Bv),definitionOperator:X(Bv),typeOperator:X(Bv),controlOperator:X(Bv),punctuation:Vv,separator:X(Vv),bracket:Hv,angleBracket:X(Hv),squareBracket:X(Hv),paren:X(Hv),brace:X(Hv),content:Lv,heading:Rv,heading1:X(Rv),heading2:X(Rv),heading3:X(Rv),heading4:X(Rv),heading5:X(Rv),heading6:X(Rv),contentSeparator:X(Lv),list:X(Lv),quote:X(Lv),emphasis:X(Lv),strong:X(Lv),link:X(Lv),monospace:X(Lv),strikethrough:X(Lv),inserted:X(),deleted:X(),changed:X(),invalid:X(),meta:Uv,documentMeta:X(Uv),annotation:X(Uv),processingInstruction:X(Uv),definition:_v.defineModifier(`definition`),constant:_v.defineModifier(`constant`),function:_v.defineModifier(`function`),standard:_v.defineModifier(`standard`),local:_v.defineModifier(`local`),special:_v.defineModifier(`special`)};for(let e in Z){let t=Z[e];t instanceof _v&&(t.name=e)}Tv([{tag:Z.link,class:`tok-link`},{tag:Z.heading,class:`tok-heading`},{tag:Z.emphasis,class:`tok-emphasis`},{tag:Z.strong,class:`tok-strong`},{tag:Z.keyword,class:`tok-keyword`},{tag:Z.atom,class:`tok-atom`},{tag:Z.bool,class:`tok-bool`},{tag:Z.url,class:`tok-url`},{tag:Z.labelName,class:`tok-labelName`},{tag:Z.inserted,class:`tok-inserted`},{tag:Z.deleted,class:`tok-deleted`},{tag:Z.literal,class:`tok-literal`},{tag:Z.string,class:`tok-string`},{tag:Z.number,class:`tok-number`},{tag:[Z.regexp,Z.escape,Z.special(Z.string)],class:`tok-string2`},{tag:Z.variableName,class:`tok-variableName`},{tag:Z.local(Z.variableName),class:`tok-variableName tok-local`},{tag:Z.definition(Z.variableName),class:`tok-variableName tok-definition`},{tag:Z.special(Z.variableName),class:`tok-variableName2`},{tag:Z.definition(Z.propertyName),class:`tok-propertyName tok-definition`},{tag:Z.typeName,class:`tok-typeName`},{tag:Z.namespace,class:`tok-namespace`},{tag:Z.className,class:`tok-className`},{tag:Z.macroName,class:`tok-macroName`},{tag:Z.propertyName,class:`tok-propertyName`},{tag:Z.operator,class:`tok-operator`},{tag:Z.comment,class:`tok-comment`},{tag:Z.meta,class:`tok-meta`},{tag:Z.invalid,class:`tok-invalid`},{tag:Z.punctuation,class:`tok-punctuation`}]);function Wv(e,t,n,r=0,i=0){t??(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));let a=i;for(let i=r;i<t;i++)e.charCodeAt(i)==9?a+=n-a%n:a++;return a}var Gv=class{constructor(e,t,n,r){this.string=e,this.tabSize=t,this.indentUnit=n,this.overrideIndent=r,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let t=this.string.charAt(this.pos),n;if(n=typeof e==`string`?t==e:t&&(e instanceof RegExp?e.test(t):e(t)),n)return++this.pos,t}eatWhile(e){let t=this.pos;for(;this.eat(e););return this.pos>t}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Wv(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){return this.overrideIndent??Wv(this.string,null,this.tabSize)}match(e,t,n){if(typeof e==`string`){let r=e=>n?e.toLowerCase():e;return r(this.string.substr(this.pos,e.length))==r(e)?(t!==!1&&(this.pos+=e.length),!0):null}{let n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}}current(){return this.string.slice(this.start,this.pos)}},Kv=new Y;function qv(e){return K.define({combine:e?t=>t.concat(e):void 0})}var Jv=new Y,Yv=class{constructor(e,t,n=[],r=``){this.data=e,this.name=r,Iu.prototype.hasOwnProperty(`tree`)||Object.defineProperty(Iu.prototype,"tree",{get(){return Qv(this)}}),this.parser=t,this.extension=[cy.of(this),Iu.languageData.of((e,t,n)=>{let r=Xv(e,t,n),i=r.type.prop(Kv);if(!i)return[];let a=e.facet(i),o=r.type.prop(Jv);if(o){let i=r.resolve(t-r.from,n);for(let t of o)if(t.test(i,e)){let n=e.facet(t.facet);return t.type==`replace`?n:n.concat(a)}}return a})].concat(n)}isActiveAt(e,t,n=-1){return Xv(e,t,n).type.prop(Kv)==this.data}findRegions(e){let t=e.facet(cy);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(Kv)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(Y.mounted);if(i){if(i.tree.prop(Kv)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let i=e.children[n];i instanceof M_&&r(i,e.positions[n]+t)}};return r(Qv(e),0),n}get allowsNesting(){return!0}};Yv.setState=xu.define();function Xv(e,t,n){let r=e.facet(cy),i=Qv(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,j_.ExcludeBuffers|j_.EnterBracketed))e.type.isTop&&(i=e);return i}var Zv=class e extends Yv{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(t){let n=qv(t.languageData);return new e(n,t.parser.configure({props:[Kv.add(e=>e.isTop?n:void 0)]}),t.name)}configure(t,n){return new e(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function Qv(e){let t=e.field(Yv.state,!1);return t?t.tree:M_.empty}function $v(e,t,n=50){let r=e.field(Yv.state,!1)?.context;if(!r)return null;let i=r.viewport;r.updateViewport({from:0,to:t});let a=r.isDone(t)||r.work(n,t)?r.tree:null;return r.updateViewport(i),a}var ey=class{constructor(e){this.doc=e,this.cursorPos=0,this.string=``,this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}},ty=null,ny=class e{constructor(e,t,n=[],r,i,a,o,s){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=a,this.skipped=o,this.scheduleOn=s,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new e(t,n,[],M_.empty,0,r,[],null)}startParse(){return this.parser.startParse(new ey(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=M_.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{if(typeof e==`number`){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||=this.startParse(),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let n=this.parse.advance();if(n){if(this.fragments=this.withoutTempSkipped($_.addTree(n,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=this.parse.stoppedAt??this.state.doc.length,this.tree=n,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=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($_.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=ty;ty=this;try{return e()}finally{ty=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=ry(e,t.from,t.to);return e}changes(t,n){let{fragments:r,tree:i,treeLen:a,viewport:o,skipped:s}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges((t,n,r,i)=>e.push({fromA:t,toA:n,fromB:r,toB:i})),r=$_.applyChanges(r,e),i=M_.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){s=[];for(let e of this.skipped){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);n<r&&s.push({from:n,to:r})}}}return new e(this.parser,n,r,i,a,o,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:r}=this.skipped[t];n<e.to&&r>e.from&&(this.fragments=ry(this.fragments,n,r),this.skipped.splice(t--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&=(this.takeTree(),null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends ev{createParse(t,n,r){let i=r[0].from,a=r[r.length-1].to;return{parsedPos:i,advance(){let t=ty;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=a,new M_(D_.none,[],[],a-i)},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 ty}};function ry(e,t,n){return $_.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var iy=class e{constructor(e){this.context=e,this.tree=e.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new e(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=ny.create(t.facet(cy).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}};Yv.state=eu.define({create:iy.init,update(e,t){for(let e of t.effects)if(e.is(Yv.setState))return e.value;return t.startState.facet(cy)==t.state.facet(cy)?e.apply(t):iy.init(t.state)}});var ay=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<`u`&&(ay=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});var oy=typeof navigator<`u`&&navigator.scheduling?.isInputPending?()=>navigator.scheduling.isInputPending():null,sy=pp.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(Yv.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(Yv.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=ay(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,i=n.field(Yv.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!oy?Math.max(25,e.timeRemaining()-5):1e9),o=i.context.treeLen<r&&n.doc.length>r+1e3,s=i.context.work(()=>oy&&oy()||Date.now()>a,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(s||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Yv.setState.of(new iy(i.context))})),this.chunkBudget>0&&(!s||o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&=(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>lp(this.view.state,e)).then(()=>this.workScheduled--),null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),cy=K.define({combine(e){return e.length?e[0]:null},enables:e=>[Yv.state,sy,J.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),ly=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},uy=class e{constructor(e,t,n,r,i,a=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=r,this.loadFunc=i,this.support=a,this.loading=null}load(){return this.loading||=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e})}static of(t){let{load:n,support:r}=t;if(!n){if(!r)throw RangeError(`Must pass either 'load' or 'support' to LanguageDescription.of`);n=()=>Promise.resolve(r)}return new e(t.name,(t.alias||[]).concat(t.name).map(e=>e.toLowerCase()),t.extensions||[],t.filename,n,r)}static matchFilename(e,t){for(let n of e)if(n.filename&&n.filename.test(t))return n;let n=/\.([^.]+)$/.exec(t);if(n){for(let t of e)if(t.extensions.indexOf(n[1])>-1)return t}return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let n of e)if(n.alias.some(e=>e==t))return n;if(n)for(let n of e)for(let e of n.alias){let r=t.indexOf(e);if(r>-1&&(e.length>2||!/\w/.test(t[r-1])&&!/\w/.test(t[r+e.length])))return n}return null}},dy=K.define(),fy=K.define({combine:e=>{if(!e.length)return` `;let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw Error(`Invalid indent unit: `+JSON.stringify(e[0]));return t}});function py(e){let t=e.facet(fy);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function my(e,t){let n=``,r=e.tabSize,i=e.facet(fy)[0];if(i==` `){for(;t>=r;)n+=` `,t-=r;i=` `}for(let e=0;e<t;e++)n+=i;return n}function hy(e,t){e instanceof Iu&&(e=new gy(e));for(let n of e.state.facet(dy)){let r=n(e,t);if(r!==void 0)return r}let n=Qv(e.state);return n.length>=t?vy(e,n,t):null}var gy=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=py(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return r!=null&&r>=n.from&&r<=n.to?i&&r==e?{text:``,from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return``;let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.countColumn(n,e-r),a=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return a>-1&&(i+=a-this.countColumn(n,n.search(/\S|$/))),i}countColumn(e,t=e.length){return rd(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(r);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},_y=new Y;function vy(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t&&!(t.from<r.node.from||t.to>r.node.to||t.from==r.node.from&&t.type==r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return yy(r,e,n)}function yy(e,t,n){for(let r=e;r;r=r.next){let e=xy(r.node);if(e)return e(Cy.create(t,n,r))}return 0}function by(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function xy(e){let t=e.type.prop(_y);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(Y.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>Dy(e,!0,1,void 0,n&&!by(e)?t.from:void 0)}return e.parent==null?Sy:null}function Sy(){return 0}var Cy=class e extends gy{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(t,n,r){return new e(t,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(wy(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return yy(this.context.next,this.base,this.pos)}};function wy(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function Ty(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,a=e.state.doc.lineAt(n.from),o=i==null||i<=a.from?a.to:Math.min(a.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped){if(i.from>=o)return null;let e=/^ */.exec(a.text.slice(n.to-a.from))[0].length;return{from:n.from,to:n.to+e}}e=i.to}}function Ey({closing:e,align:t=!0,units:n=1}){return r=>Dy(r,t,n,e)}function Dy(e,t,n,r,i){let a=e.textAfter,o=a.match(/^\s*/)[0].length,s=r&&a.slice(o,o+r.length)==r||i==e.pos+o,c=t?Ty(e):null;return c?s?e.column(c.from):e.column(c.to):e.baseIndent+(s?0:e.unit*n)}var Oy=e=>e.baseIndent;function ky({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}var Ay=K.define(),jy=new Y;function My(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}function Ny(e,t,n){let r=Qv(e);if(r.length<n)return null;let i=r.resolveStack(n,1),a=null;for(let o=i;o;o=o.next){let i=o.node;if(i.to<=n||i.from>n)continue;if(a&&i.from<t)break;let s=i.type.prop(jy);if(s&&(i.to<r.length-50||r.length==e.doc.length||!Py(i))){let r=s(i,e);r&&r.from<=n&&r.from>=t&&r.to>n&&(a=r)}}return a}function Py(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function Fy(e,t,n){for(let r of e.facet(Ay)){let i=r(e,t,n);if(i)return i}return Ny(e,t,n)}function Iy(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}var Ly=xu.define({map:Iy}),Ry=xu.define({map:Iy});function zy(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(e=>e.from<=n&&e.to>=n)||t.push(e.lineBlockAt(n));return t}var By=eu.define({create(){return Bd.none},update(e,t){t.isUserEvent(`delete`)&&t.changes.iterChangedRanges((t,n)=>e=Vy(e,t,n)),e=e.map(t.changes);let n=[];for(let r of t.effects)r.is(Ly)&&!Uy(e,r.value.from,r.value.to)?n.push(r.value):r.is(Ry)&&(e=e.update({filter:(e,t)=>r.value.from!=e||r.value.to!=t,filterFrom:r.value.from,filterTo:r.value.to}));if(n.length){let{preparePlaceholder:r}=t.state.facet(Jy),i=n.map(e=>(r?Bd.replace({widget:new Qy(r(t.state,e))}):Zy).range(e.from,e.to));e=e.update({add:i})}return t.selection&&(e=Vy(e,t.selection.main.head)),e},provide:e=>J.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw RangeError(`Invalid JSON for fold state`);let t=[];for(let n=0;n<e.length;){let r=e[n++],i=e[n++];if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid JSON for fold state`);t.push(Zy.range(r,i))}return Bd.set(t,!0)}});function Vy(e,t,n=t){let r=!1;return e.between(t,n,(e,i)=>{e<n&&i>t&&(r=!0)}),r?e.update({filterFrom:t,filterTo:n,filter:(e,r)=>e>=n||r<=t}):e}function Hy(e,t,n){var r;let i=null;return(r=e.field(By,!1))==null||r.between(t,n,(e,t)=>{(!i||i.from>e)&&(i={from:e,to:t})}),i}function Uy(e,t,n){let r=!1;return e.between(t,t,(e,i)=>{e==t&&i==n&&(r=!0)}),r}function Wy(e,t){return e.field(By,!1)?t:t.concat(xu.appendConfig.of(Yy()))}var Gy=e=>{for(let t of zy(e)){let n=Fy(e.state,t.from,t.to);if(n)return e.dispatch({effects:Wy(e.state,[Ly.of(n),Ky(e,n)])}),!0}return!1};function Ky(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return J.announce.of(`${e.state.phrase(n?`Folded lines`:`Unfolded lines`)} ${r} ${e.state.phrase(`to`)} ${i}.`)}var qy={placeholderDOM:null,preparePlaceholder:null,placeholderText:`…`},Jy=K.define({combine(e){return Lu(e,qy)}});function Yy(e){let t=[By,$y];return e&&t.push(Jy.of(e)),t}function Xy(e,t){let{state:n}=e,r=n.facet(Jy),i=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=Hy(e.state,n.from,n.to);r&&e.dispatch({effects:Ry.of(r)}),t.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let a=document.createElement(`span`);return a.textContent=r.placeholderText,a.setAttribute(`aria-label`,n.phrase(`folded code`)),a.title=n.phrase(`unfold`),a.className=`cm-foldPlaceholder`,a.onclick=i,a}var Zy=Bd.replace({widget:new class extends Rd{toDOM(e){return Xy(e,null)}}}),Qy=class extends Rd{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return Xy(e,this.value)}},$y=J.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`}}),eb=class e{constructor(e,t){this.specs=e;let n;function r(e){let t=ld.newName();return(n||=Object.create(null))[`.`+t]=e,t}let i=typeof t.all==`string`?t.all:t.all?r(t.all):void 0,a=t.scope;this.scope=a instanceof Yv?e=>e.prop(Kv)==a.data:a?e=>e==a:void 0,this.style=Tv(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new ld(n):null,this.themeType=t.themeType}static define(t,n){return new e(t,n||{})}},tb=K.define(),nb=K.define({combine(e){return e.length?[e[0]]:null}});function rb(e){let t=e.facet(tb);return t.length?t:e.facet(nb)}function ib(e,t){let n=[ob],r;return e instanceof eb&&(e.module&&n.push(J.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push(nb.of(e)):r?n.push(tb.computeN([J.darkTheme],t=>t.facet(J.darkTheme)==(r==`dark`)?[e]:[])):n.push(tb.of(e)),n}var ab=class{constructor(e){this.markCache=Object.create(null),this.tree=Qv(e.state),this.decorations=this.buildDeco(e,rb(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Qv(e.state),n=rb(e.state),r=n!=rb(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!r&&t.type==this.tree.type&&a>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return Bd.none;let n=new Ku;for(let{from:r,to:i}of e.visibleRanges)Dv(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=Bd.mark({class:r})))},r,i);return n.finish()}},ob=ru.high(pp.fromClass(ab,{decorations:e=>e.decorations}));Z.meta,Z.link,Z.heading,Z.emphasis,Z.strong,Z.strikethrough,Z.keyword,Z.atom,Z.bool,Z.url,Z.contentSeparator,Z.labelName,Z.literal,Z.inserted,Z.string,Z.deleted,Z.regexp,Z.escape,Z.string,Z.variableName,Z.variableName,Z.typeName,Z.namespace,Z.className,Z.variableName,Z.macroName,Z.propertyName,Z.comment,Z.invalid;var sb=1e4,cb=`()[]{}`,lb=new Y;function ub(e,t,n){let r=e.prop(t<0?Y.openedBy:Y.closedBy);if(r)return r;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==+(t<0))return[n[r+t]]}return null}function db(e){let t=e.type.prop(lb);return t?t(e.node):e}function fb(e,t,n,r={}){let i=r.maxScanDistance||sb,a=r.brackets||cb,o=Qv(e),s=o.resolveInner(t,n);for(let r=s;r;r=r.parent){let i=ub(r.type,n,a);if(i&&r.from<r.to){let o=db(r);if(o&&(n>0?t>=o.from&&t<o.to:t>o.from&&t<=o.to))return pb(e,t,n,r,o,i,a)}}return mb(e,t,n,o,s.type,i,a)}function pb(e,t,n,r,i,a,o){let s=r.parent,c={from:i.from,to:i.to},l=0,u=s?.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(l==0&&a.indexOf(u.type.name)>-1&&u.from<u.to){let e=db(u);return{start:c,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(ub(u.type,n,o))l++;else if(ub(u.type,-n,o)){if(l==0){let e=db(u);return{start:c,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}l--}}while(n<0?u.prevSibling():u.nextSibling());return{start:c,matched:!1}}function mb(e,t,n,r,i,a,o){if(n<0?!t:t==e.doc.length)return null;let s=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),c=o.indexOf(s);if(c<0||c%2==0!=n>0)return null;let l={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),d=0;for(let e=0;!u.next().done&&e<=a;){let a=u.value;n<0&&(e+=a.length);let s=t+e*n;for(let e=n>0?0:a.length-1,t=n>0?a.length:-1;e!=t;e+=n){let t=o.indexOf(a[e]);if(!(t<0||r.resolveInner(s+e,1).type!=i)){if(t%2==0==n>0)d++;else if(d==1)return{start:l,end:{from:s+e,to:s+e+1},matched:t>>1==c>>1};else d--}}n>0&&(e+=a.length)}return u.done?{start:l,matched:!1}:null}var hb=Object.create(null),gb=[D_.none],_b=[],vb=Object.create(null),yb=Object.create(null);for(let[e,t]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`]])yb[e]=xb(hb,t);function bb(e,t){_b.indexOf(e)>-1||(_b.push(e),console.warn(t))}function xb(e,t){let n=[];for(let r of t.split(` `)){let t=[];for(let n of r.split(`.`)){let r=e[n]||Z[n];r?typeof r==`function`?t.length?t=t.map(r):bb(n,`Modifier ${n} used at start of tag`):t.length?bb(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:bb(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,`_`),i=r+` `+n.map(e=>e.id),a=vb[i];if(a)return a.id;let o=vb[i]=D_.define({id:gb.length,name:r,props:[Sv({[r]:n})]});return gb.push(o),o.id}Tf.RTL,Tf.LTR;var Sb=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Db(e.state,n.from);return r.line?wb(e):r.block?Eb(e):!1};function Cb(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var wb=Cb(Mb,0),Tb=Cb(jb,0),Eb=Cb((e,t)=>jb(e,t,Ab(t)),0);function Db(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var Ob=50;function kb(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-Ob,r),o=e.sliceDoc(i,i+Ob),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=100?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+Ob),d=e.sliceDoc(i-Ob,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function Ab(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function jb(e,t,n=t.selection.ranges){let r=n.map(e=>Db(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>kb(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function Mb(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=Db(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var Nb=vu.define(),Pb=vu.define(),Fb=K.define(),Ib=K.define({combine(e){return Lu(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),Lb=eu.define({create(){return nx.empty},update(e,t){let n=t.state.facet(Ib),r=t.annotation(Nb);if(r){let i=Wb.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?Gb(o,o.length,n.minDepth,i):Zb(o,t.startState.selection),new nx(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(Pb);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(Su.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=Wb.fromTransaction(t),o=t.annotation(Su.time),s=t.annotation(Su.userEvent);return a?e=e.addChanges(a,o,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,s,n.newGroupDelay)),(i==`full`||i==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new nx(e.done.map(Wb.fromJSON),e.undone.map(Wb.fromJSON))}});function Rb(e={}){return[Lb,Ib.of(e),J.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?Bb:e.inputType==`historyRedo`?Vb:null;return n?(e.preventDefault(),n(t)):!1}})]}function zb(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(Lb,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var Bb=zb(0,!1),Vb=zb(1,!1),Hb=zb(0,!0),Ub=zb(1,!0),Wb=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new e(t.changes&&Rl.fromJSON(t.changes),[],t.mapped&&Ll.fromJSON(t.mapped),t.startSelection&&G.fromJSON(t.startSelection),t.selectionsAfter.map(G.fromJSON))}static fromTransaction(t,n){let r=Yb;for(let e of t.startState.facet(Fb)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Yb)}static selection(t){return new e(void 0,Yb,void 0,void 0,t)}};function Gb(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function Kb(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function qb(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function Jb(e,t){return e.length?t.length?e.concat(t):e:t}var Yb=[],Xb=200;function Zb(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Xb));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),Gb(e,e.length-1,1e9,n.setSelAfter(r)))}return[Wb.selection([t])]}function Qb(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function $b(e,t){if(!e.length)return e;let n=e.length,r=Yb;for(;n;){let i=ex(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[Wb.selection(r)]:Yb}function ex(e,t,n){let r=Jb(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):Yb,n);if(!e.changes)return Wb.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new Wb(i,xu.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var tx=/^(input\.type|delete)($|\.)/,nx=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||tx.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,Kb(s.changes,t.changes))||r==`input.type.compose`)?Gb(o,o.length-1,i.minDepth,new Wb(t.changes.compose(s.changes),Jb(xu.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,Yb)):Gb(o,o.length,i.minDepth,t),new e(o,Yb,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:Yb;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&qb(a[a.length-1],t)?this:new e(Zb(this.done,t),this.undone,n,r)}addMapping(t){return new e($b(this.done,t),$b(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:Nb.of({side:e,rest:Qb(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?Yb:r.slice(0,r.length-1);return i.mapped&&(n=$b(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Nb.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};nx.empty=new nx(Yb,Yb);var rx=[{key:`Mod-z`,run:Bb,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:Vb,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:Vb,preventDefault:!0},{key:`Mod-u`,run:Hb,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Ub,preventDefault:!0}];function ix(e,t){return G.create(e.ranges.map(t),e.mainIndex)}function ax(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function ox({state:e,dispatch:t},n){let r=ix(e.selection,n);return!r.eq(e.selection,!0)&&(t(ax(e,r)),!0)}function sx(e,t){return G.cursor(t?e.to:e.from)}function cx(e,t){return ox(e,n=>n.empty?e.moveByChar(n,t):sx(n,t))}function lx(e){return e.textDirectionAt(e.state.selection.main.head)==Tf.LTR}var ux=e=>cx(e,!lx(e)),dx=e=>cx(e,lx(e)),fx=e=>cx(e,!0),px=e=>cx(e,!1);function mx(e,t){return ox(e,n=>n.empty?e.moveByGroup(n,t):sx(n,t))}var hx=e=>mx(e,!lx(e)),gx=e=>mx(e,lx(e));typeof Intl<`u`&&Intl.Segmenter;function _x(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function vx(e,t,n){let r=Qv(e).resolveInner(t.head),i=n?Y.closedBy:Y.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;_x(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?fb(e,r.from,1):fb(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,G.cursor(s,n?-1:1)}var yx=e=>ox(e,t=>vx(e.state,t,!lx(e))),bx=e=>ox(e,t=>vx(e.state,t,lx(e)));function xx(e,t){return ox(e,n=>{if(!n.empty)return sx(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var Sx=e=>xx(e,!1),Cx=e=>xx(e,!0);function wx(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(J.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function Tx(e,t){let n=wx(e),{state:r}=e,i=ix(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):sx(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=J.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(ax(r,i),{effects:a}),!0}var Ex=e=>Tx(e,!1),Dx=e=>Tx(e,!0);function Ox(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=G.cursor(r.from+n))}return i}var kx=e=>ox(e,t=>Ox(e,t,!0)),Ax=e=>ox(e,t=>Ox(e,t,!1)),jx=e=>ox(e,t=>Ox(e,t,!lx(e))),Mx=e=>ox(e,t=>Ox(e,t,lx(e))),Nx=e=>ox(e,t=>e.moveToLineBoundary(t,!1,!1)),Px=e=>ox(e,t=>e.moveToLineBoundary(t,!0,!1));function Fx(e,t,n){let r=!1,i=ix(e.selection,t=>{let i=fb(e,t.head,-1)||fb(e,t.head,1)||t.head>0&&fb(e,t.head-1,1)||t.head<e.doc.length&&fb(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let a=i.start.from==t.head?i.end.to:i.end.from;return n?G.range(t.anchor,a):G.cursor(a)});return r?(t(ax(e,i)),!0):!1}var Ix=({state:e,dispatch:t})=>Fx(e,t,!1);function Lx(e,t,n){let r=ix(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=G.range(e.head,e.anchor));let r=n(e);return G.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return!r.eq(e.state.selection)&&(e.dispatch(ax(e.state,r)),!0)}function Rx(e,t){return Lx(e,t,n=>e.moveByChar(n,t))}var zx=e=>Rx(e,!lx(e)),Bx=e=>Rx(e,lx(e)),Vx=e=>Rx(e,!0),Hx=e=>Rx(e,!1);function Ux(e,t){return Lx(e,t,n=>e.moveByGroup(n,t))}var Wx=e=>Ux(e,!lx(e)),Gx=e=>Ux(e,lx(e)),Kx=e=>Ux(e,!0),qx=e=>Ux(e,!1),Jx=e=>{let t=!lx(e);return Lx(e,t,n=>vx(e.state,n,t))},Yx=e=>{let t=lx(e);return Lx(e,t,n=>vx(e.state,n,t))};function Xx(e,t){return Lx(e,t,n=>e.moveVertically(n,t))}var Zx=e=>Xx(e,!1),Qx=e=>Xx(e,!0);function $x(e,t){return Lx(e,t,n=>e.moveVertically(n,t,wx(e).height))}var eS=e=>$x(e,!1),tS=e=>$x(e,!0),nS=e=>Lx(e,!0,t=>Ox(e,t,!0)),rS=e=>Lx(e,!1,t=>Ox(e,t,!1)),iS=e=>{let t=!lx(e);return Lx(e,t,n=>Ox(e,n,t))},aS=e=>{let t=lx(e);return Lx(e,t,n=>Ox(e,n,t))},oS=e=>Lx(e,!1,t=>G.cursor(e.lineBlockAt(t.head).from)),sS=e=>Lx(e,!0,t=>G.cursor(e.lineBlockAt(t.head).to)),cS=({state:e,dispatch:t})=>(t(ax(e,{anchor:0})),!0),lS=({state:e,dispatch:t})=>(t(ax(e,{anchor:e.doc.length})),!0),uS=({state:e,dispatch:t})=>(t(ax(e,{anchor:e.selection.main.anchor,head:0})),!0),dS=({state:e,dispatch:t})=>(t(ax(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),fS=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),pS=({state:e,dispatch:t})=>{let n=MS(e).map(({from:t,to:n})=>G.undirectionalRange(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:G.create(n),userEvent:`select`})),!0},mS=({state:e,dispatch:t})=>{let n=ix(e.selection,t=>{let n=Qv(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return G.undirectionalRange(n.from,n.to)}return t});return!n.eq(e.selection)&&(t(ax(e,n)),!0)};function hS(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(ax(n,G.create(i,i.length-1))),!0)}var gS=e=>hS(e,!1),_S=e=>hS(e,!0),vS=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=G.create([n.main]):n.main.empty||(r=G.create([G.cursor(n.main.head)])),r?(t(ax(e,r)),!0):!1};function yS(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);o<i?(n=`delete.backward`,o=bS(e,o,!1)):o>i&&(n=`delete.forward`,o=bS(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=bS(e,i,!1),a=bS(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:G.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?J.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function bS(e,t,n){if(e instanceof J)for(let r of e.state.facet(J.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var xS=(e,t,n)=>yS(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),s,c;if(n&&!t&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(s=o.text.slice(0,i-o.from))){if(s[s.length-1]==` `)return i-1;let e=rd(s,a.tabSize)%py(a)||py(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=kl(o.text,i-o.from,t,t)+o.from,c==i&&o.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,i-o.from))&&(c=kl(o.text,c-o.from,!1,!1)+o.from);return c}),SS=e=>xS(e,!1,!0),CS=e=>xS(e,!0,!1),wS=(e,t)=>yS(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let s=kl(a.text,r-a.from,t)+a.from,c=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),l=o(c);if(e!=null&&l!=e)break;(c!=` `||r!=n.head)&&(e=l),r=s}return r}),TS=e=>wS(e,!1),ES=e=>wS(e,!0),DS=e=>yS(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),OS=e=>yS(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),kS=e=>yS(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),AS=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:vl.of([``,``])},range:G.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},jS=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:kl(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:kl(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:G.cursor(a)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function MS(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function NS(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of MS(e)){if(n?t.to==e.doc.length:t.from==0)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n){r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak});for(let n of t.ranges)i.push(G.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text});for(let e of t.ranges)i.push(G.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:G.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var PS=({state:e,dispatch:t})=>NS(e,t,!1),FS=({state:e,dispatch:t})=>NS(e,t,!0);function IS(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of MS(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var LS=({state:e,dispatch:t})=>IS(e,t,!1),RS=({state:e,dispatch:t})=>IS(e,t,!0),zS=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(MS(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=ix(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function BS(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=Qv(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(Y.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var VS=US(!1),HS=US(!0);function US(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&BS(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new gy(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=hy(s,r);for(c??=rd(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize);i<a.to&&/\s/.test(a.text[i-a.from]);)i++;o?{from:r,to:i}=o:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let l=[``,my(t,c)];return o&&l.push(my(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:vl.of(l)},range:G.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function WS(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:G.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var GS=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new gy(e,{overrideIndentation:e=>n[e]??-1}),i=WS(e,(t,i,a)=>{let o=hy(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=my(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},KS=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(WS(e,(t,n)=>{n.push({from:t.from,insert:e.facet(fy)})}),{userEvent:`input.indent`})),!0),qS=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(WS(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=rd(r,e.tabSize),a=0,o=my(e,Math.max(0,i-py(e)));for(;a<r.length&&a<o.length&&r.charCodeAt(a)==o.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:o.slice(a)})}),{userEvent:`delete.dedent`})),!0),JS=e=>(e.setTabFocusMode(),!0),YS=[{key:`Ctrl-b`,run:ux,shift:zx,preventDefault:!0},{key:`Ctrl-f`,run:dx,shift:Bx},{key:`Ctrl-p`,run:Sx,shift:Zx},{key:`Ctrl-n`,run:Cx,shift:Qx},{key:`Ctrl-a`,run:Nx,shift:oS},{key:`Ctrl-e`,run:Px,shift:sS},{key:`Ctrl-d`,run:CS},{key:`Ctrl-h`,run:SS},{key:`Ctrl-k`,run:DS},{key:`Ctrl-Alt-h`,run:TS},{key:`Ctrl-o`,run:AS},{key:`Ctrl-t`,run:jS},{key:`Ctrl-v`,run:Dx}],XS=[{key:`ArrowLeft`,run:ux,shift:zx,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:hx,shift:Wx,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:jx,shift:iS,preventDefault:!0},{key:`ArrowRight`,run:dx,shift:Bx,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:gx,shift:Gx,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:Mx,shift:aS,preventDefault:!0},{key:`ArrowUp`,run:Sx,shift:Zx,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:cS,shift:uS},{mac:`Ctrl-ArrowUp`,run:Ex,shift:eS},{key:`ArrowDown`,run:Cx,shift:Qx,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:lS,shift:dS},{mac:`Ctrl-ArrowDown`,run:Dx,shift:tS},{key:`PageUp`,run:Ex,shift:eS},{key:`PageDown`,run:Dx,shift:tS},{key:`Home`,run:Ax,shift:rS,preventDefault:!0},{key:`Mod-Home`,run:cS,shift:uS},{key:`End`,run:kx,shift:nS,preventDefault:!0},{key:`Mod-End`,run:lS,shift:dS},{key:`Enter`,run:VS,shift:VS},{key:`Mod-a`,run:fS},{key:`Backspace`,run:SS,shift:SS,preventDefault:!0},{key:`Delete`,run:CS,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:TS,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:ES,preventDefault:!0},{mac:`Mod-Backspace`,run:OS,preventDefault:!0},{mac:`Mod-Delete`,run:kS,preventDefault:!0}].concat(YS.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),ZS=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:yx,shift:Jx},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:bx,shift:Yx},{key:`Alt-ArrowUp`,run:PS},{key:`Shift-Alt-ArrowUp`,run:LS},{key:`Alt-ArrowDown`,run:FS},{key:`Shift-Alt-ArrowDown`,run:RS},{key:`Mod-Alt-ArrowUp`,run:gS},{key:`Mod-Alt-ArrowDown`,run:_S},{key:`Escape`,run:vS},{key:`Mod-Enter`,run:HS},{key:`Alt-l`,mac:`Ctrl-l`,run:pS},{key:`Mod-i`,run:mS,preventDefault:!0},{key:`Mod-[`,run:qS},{key:`Mod-]`,run:KS},{key:`Mod-Alt-\\`,run:GS},{key:`Shift-Mod-k`,run:zS},{key:`Shift-Mod-\\`,run:Ix},{key:`Mod-/`,run:Sb},{key:`Alt-A`,mac:`Ctrl-A`,run:Tb},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:JS}].concat(XS),QS={key:`Tab`,run:KS,shift:qS},$S=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Qv(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(oC(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function eC(e){let t=Object.keys(e).join(``),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,``)),`[${n?`\\w`:``}${t.replace(/[^\w\s]/g,`\\$&`)}]`}function tC(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=eC(t)+eC(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function nC(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:tC(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function rC(e,t){return n=>{for(let t=Qv(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}var iC=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function aC(e){return e.selection.main.from}function oC(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var sC=vu.define();function cC(e,t,n,r){let{main:i}=e.selection,a=n-i.from,o=r-i.from;return{...e.changeByRange(s=>{if(s!=i&&n!=r&&e.sliceDoc(s.from+a,s.from+o)!=e.sliceDoc(n,r))return{range:s};let c=e.toText(t);return{changes:{from:s.from+a,to:r==i.from?s.to:s.from+o,insert:c},range:G.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var lC=new WeakMap;function uC(e){if(!Array.isArray(e))return e;let t=lC.get(e);return t||lC.set(e,t=nC(e)),t}var dC=xu.define(),fC=xu.define(),pC=class{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<e.length;){let n=Ml(e,t),r=Pl(n);this.chars.push(n);let i=e.slice(t,t+r),a=i.toUpperCase();this.folded.push(Ml(a==i?i.toLowerCase():a,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:i,byWord:a}=this;if(t.length==1){let r=Ml(e,0),i=Pl(r),a=i==e.length?0:-100;if(r!=t[0]){if(r==n[0])a+=-200;else return null}return this.ret(a,[0,i])}let o=e.indexOf(this.pattern);if(o==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let s=t.length,c=0;if(o<0){for(let i=0,a=Math.min(e.length,200);i<a&&c<s;){let a=Ml(e,i);(a==t[c]||a==n[c])&&(r[c++]=i),i+=Pl(a)}if(c<s)return null}let l=0,u=0,d=!1,f=0,p=-1,m=-1,h=/[a-z]/.test(e),g=!0;for(let r=0,c=Math.min(e.length,200),_=0;r<c&&u<s;){let c=Ml(e,r);o<0&&(l<s&&c==t[l]&&(i[l++]=r),f<s&&(c==t[f]||c==n[f]?(f==0&&(p=r),m=r+1,f++):f=0));let v,y=c<255?c>=48&&c<=57||c>=97&&c<=122?2:+(c>=65&&c<=90):(v=Nl(c))==v.toLowerCase()?v==v.toUpperCase()?0:2:1;(!r||y==1&&h||_==0&&y!=0)&&(t[u]==c||n[u]==c&&(d=!0)?a[u++]=r:a.length&&(g=!1)),_=y,r+=Pl(c)}return u==s&&a[0]==0&&g?this.result(-100+(d?-200:0),a,e):f==s&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):f==s?this.ret(-900-e.length,[p,m]):u==s?this.result(-100+(d?-200:0)+-700+(g?0:-1100),a,e):t.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?Pl(Ml(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}},mC=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},hC=K.define({combine(e){return Lu(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>``,optionClass:()=>``,aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:_C,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)=>n=>gC(e(n),t(n)),optionClass:(e,t)=>n=>gC(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function gC(e,t){return e?t?e+` `+t:e:t}function _C(e,t,n,r,i,a){let o=e.textDirection==Tf.RTL,s=o,c=!1,l=`top`,u,d,f=t.left-i.left,p=i.right-t.right,m=r.right-r.left,h=r.bottom-r.top;if(s&&f<Math.min(m,p)?s=!1:!s&&p<Math.min(m,f)&&(s=!0),m<=(s?f:p))u=Math.max(i.top,Math.min(n.top,i.bottom-h))-t.top,d=Math.min(400,s?f:p);else{c=!0,d=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=h||e>t.top?u=n.bottom-t.top:(l=`bottom`,u=t.bottom-n.top)}let g=(t.bottom-t.top)/a.offsetHeight,_=(t.right-t.left)/a.offsetWidth;return{style:`${l}: ${u/g}px; max-width: ${d/_}px`,class:`cm-completionInfo-`+(c?o?`left-narrow`:`right-narrow`:s?`left`:`right`)}}var vC=xu.define();function yC(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement(`div`);return t.classList.add(`cm-completionIcon`),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>`cm-completionIcon-`+e)),t.setAttribute(`aria-hidden`,`true`),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement(`span`);i.className=`cm-completionLabel`;let a=e.displayLabel||e.label,o=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>o&&i.appendChild(document.createTextNode(a.slice(o,t)));let s=i.appendChild(document.createElement(`span`));s.appendChild(document.createTextNode(a.slice(t,n))),s.className=`cm-completionMatchedText`,o=n}return o<a.length&&i.appendChild(document.createTextNode(a.slice(o))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement(`span`);return t.className=`cm-completionDetail`,t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}function bC(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}var xC=class{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass=``;let r=e.state.field(t),{options:i,selected:a}=r.open,o=e.state.facet(hC);this.optionContent=yC(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=bC(i.length,a,o.maxRenderedOptions),this.dom=document.createElement(`div`),this.dom.className=`cm-tooltip-autocomplete`,this.updateTooltipClass(e.state),this.dom.addEventListener(`mousedown`,n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if(t.nodeName==`LI`&&(i=/-(\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}if(n.target==this.list){let t=this.list.classList.contains(`cm-completionListIncompleteTop`)&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains(`cm-completionListIncompleteBottom`)&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;t!=null&&(e.dispatch({effects:vC.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(hC).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:fC.of(null)})}),this.showOptions(i,r.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){let t=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),t!=n){let{options:r,selected:i,disabled:a}=t.open;(!n.open||n.open.options!=r)&&(this.range=bC(r.length,i,e.state.facet(hC).maxRenderedOptions),this.showOptions(r,t.id)),this.updateSel(),a!=n.open?.disabled&&this.dom.classList.toggle(`cm-tooltip-autocomplete-disabled`,!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(` `))e&&this.dom.classList.remove(e);for(let e of t.split(` `))e&&this.dom.classList.add(e);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.from||t.selected>=this.range.to)&&(this.range=bC(t.options.length,t.selected,this.view.state.facet(hC).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let a=typeof i==`string`?document.createTextNode(i):i(r);if(!a)return;`then`in a?a.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>lp(this.view.state,e,`completion info`)):(this.addInfoPane(a,r),n.setAttribute(`aria-describedby`,this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement(`div`);if(n.className=`cm-tooltip cm-completionInfo`,n.id=`cm-completionInfo-`+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!=`LI`||!n.id?r--:r==e?n.hasAttribute(`aria-selected`)||(n.setAttribute(`aria-selected`,`true`),t=n):n.hasAttribute(`aria-selected`)&&(n.removeAttribute(`aria-selected`),n.removeAttribute(`aria-describedby`));return t&&CC(this.list,t),t}measureInfo(){let e=this.dom.querySelector(`[aria-selected]`);if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(hC).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className=`cm-tooltip cm-completionInfo `+(e.class||``)):this.info.style.cssText=`top: -1e6px`)}createListBox(e,t,n){let r=document.createElement(`ul`);r.id=t,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-expanded`,`true`),r.setAttribute(`aria-label`,this.view.state.phrase(`Completions`)),r.addEventListener(`mousedown`,e=>{e.target==r&&e.preventDefault()});let i=null;for(let a=n.from;a<n.to;a++){let{completion:o,match:s}=e[a],{section:c}=o;if(c){let e=typeof c==`string`?c:c.name;if(e!=i&&(a>n.from||n.from==0)){if(i=e,typeof c!=`string`&&c.header)r.appendChild(c.header(c));else{let t=r.appendChild(document.createElement(`completion-section`));t.textContent=e}}}let l=r.appendChild(document.createElement(`li`));l.id=t+`-`+a,l.setAttribute(`role`,`option`);let u=this.optionClass(o);u&&(l.className=u);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,s);t&&l.appendChild(t)}}return n.from&&r.classList.add(`cm-completionListIncompleteTop`),n.to<e.length&&r.classList.add(`cm-completionListIncompleteBottom`),r}destroyInfo(){this.info&&=(this.infoDestroy&&this.infoDestroy(),this.info.remove(),null)}destroy(){this.destroyInfo()}};function SC(e,t){return n=>new xC(n,e,t)}function CC(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function wC(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function TC(e,t){let n=[],r=null,i=null,a=e=>{n.push(e);let{section:t}=e.completion;if(t){r||=[];let e=typeof t==`string`?t:t.name;r.some(t=>t.name==e)||r.push(typeof t==`string`?{name:e}:t)}},o=t.facet(hC);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(r.result.filter===!1)for(let t of r.result.options)a(new iC(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new mC(n):new pC(n);for(let t of r.result.options)if(s=c.match(t.label)){let n=t.displayLabel?e?e(t,s.matched):[]:s.matched,o=s.score+(t.boost||0);if(a(new iC(t,r.source,n,o)),typeof t.section==`object`&&t.section.rank===`dynamic`){let{name:e}=t.section;i||=Object.create(null),i[e]=Math.max(o,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,a=(e,t)=>(e.rank===`dynamic`&&t.rank===`dynamic`?i[t.name]-i[e.name]:0)||(typeof e.rank==`number`?e.rank:1e9)-(typeof t.rank==`number`?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(a))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e[typeof n==`string`?n:n.name])}}let s=[],c=null,l=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||l(e.completion,t.completion))){let t=e.completion;!c||c.label!=t.label||c.detail!=t.detail||c.type!=null&&t.type!=null&&c.type!=t.type||c.apply!=t.apply||c.boost!=t.boost?s.push(e):wC(e.completion)>wC(c)&&(s[s.length-1]=e),c=e.completion}return s}var EC=class e{constructor(e,t,n,r,i,a){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new e(this.options,jC(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,a,o){if(i&&!o&&t.some(e=>e.isPending))return i.setDisabled();let s=TC(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(hC).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){c=t;break}}return new e(s,jC(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:BC,above:a.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new e(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new e(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},DC=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(MC,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(hC),i=(r.override||n.languageDataAt(`autocomplete`,aC(n)).map(uC)).map(e=>(this.active.find(t=>t.source==e)||new PC(e,+!!this.active.some(e=>e.state!=0))).update(t,r));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let a=this.open,o=t.effects.some(e=>e.is(LC));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!OC(i,this.active)||o?a=EC.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(e=>e.isPending)&&(a=null),!a&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new PC(e.source,0):e));for(let e of t.effects)e.is(vC)&&(a&&=a.setSelected(e.value,this.id));return i==this.active&&a==this.open?this:new e(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?kC:AC}};function OC(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,a=r==t.length;if(i||a)return i==a;if(e[n++].result!=t[r++].result)return!1}}var kC={"aria-autocomplete":`list`},AC={};function jC(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var MC=[];function NC(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(sC);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent(`input.type`);return n&&t.activateOnTyping?5:n?1:e.isUserEvent(`delete.backward`)?2:e.selection?8:e.docChanged?16:0}var PC=class e{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=NC(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new e(i.source,0)),r&4&&i.state==0&&(i=new e(this.source,1)),i=i.updateFor(t,r);for(let n of t.effects)if(n.is(dC))i=new e(i.source,1,n.value);else if(n.is(fC))i=new e(i.source,0);else if(n.is(LC))for(let e of n.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(aC(e.state))}},FC=class e extends PC{constructor(e,t,n,r,i,a){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=a}hasResult(){return!0}updateFor(t,n){if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),o=aC(t.state);if(o>a||!r||n&2&&(aC(t.startState)==this.from||o<this.limit))return new PC(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return IC(r.validFor,t.state,i,a)?new e(this.source,this.explicit,s,r,i,a):r.update&&(r=r.update(r,i,a,new $S(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??aC(t.state)):new PC(this.source,1,this.explicit)}map(t){if(t.empty)return this;let n=this.result.map?this.result.map(this.result,t):this.result;return n?new e(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new PC(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function IC(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):oC(e,!0).test(i)}var LC=xu.define({map(e,t){return e.map(e=>e.map(t))}}),RC=eu.define({create(){return DC.start()},update(e,t){return e.update(t)},provide:e=>[m_.from(e,e=>e.tooltip),J.contentAttributes.from(e,e=>e.attrs)]});function zC(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(RC).active.find(e=>e.source==t.source);return r instanceof FC&&(typeof n==`string`?e.dispatch({...cC(e.state,n,r.from,r.to),annotations:sC.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}var BC=SC(RC,zC),VC=e=>e.state.field(RC,!1)?(e.dispatch({effects:dC.of(!0)}),!0):!1;typeof navigator==`object`&&navigator.platform;var HC=J.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`}}}),UC=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},WC=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(t){let n=t.mapPos(this.from,-1,Il.TrackDel),r=t.mapPos(this.to,1,Il.TrackDel);return n==null||r==null?null:new e(this.field,n,r)}},GC=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),a=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=a,o=/^\t*/.exec(i)[0].length;for(let t=0;t<o;t++)n+=e.facet(fy);r.push(t+n.length-o),i=n+i.slice(o)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new WC(e.field,r[e.line]+e.from,r[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1;t===0&&(t=1e9);let c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new UC(s,r.length,a.index,a.index+c.length)),e=e.slice(0,a.index)+o+e.slice(a.index+a[0].length)}e=e.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(e)}return new e(r,i)}},KC=Bd.widget({widget:new class extends Rd{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),qC=Bd.mark({class:`cm-snippetField`}),JC=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=Bd.set(e.map(e=>(e.from==e.to?KC:qC).range(e.from,e.to)),!0)}map(t){let n=[];for(let e of this.ranges){let r=e.map(t);if(!r)return null;n.push(r)}return new e(n,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},YC=xu.define({map(e,t){return e&&e.map(t)}}),XC=xu.define(),ZC=eu.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(YC))return n.value;if(n.is(XC)&&e)return new JC(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>J.decorations.from(e,e=>e?e.deco:Bd.none)});function QC(e,t){return G.create(e.filter(e=>e.field==t).map(e=>G.range(e.from,e.to)))}function $C(e){let t=GC.parse(e);return(e,n,r,i)=>{let{text:a,ranges:o}=t.instantiate(e.state,r),{main:s}=e.state.selection,c={changes:{from:r,to:i==s.from?s.to:i,insert:vl.of(a)},scrollIntoView:!0,annotations:n?[sC.of(n),Su.userEvent.of(`input.complete`)]:void 0};if(o.length&&(c.selection=QC(o,0)),o.some(e=>e.field>0)){let t=new JC(o,0),n=c.effects=[YC.of(t)];e.state.field(ZC,!1)===void 0&&n.push(xu.appendConfig.of([ZC,rw,aw,HC]))}e.dispatch(e.state.update(c))}}function ew(e){return({state:t,dispatch:n})=>{let r=t.field(ZC,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,a=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:QC(r.ranges,i),effects:YC.of(a?null:new JC(r.ranges,i)),scrollIntoView:!0})),!0}}var tw=[{key:`Tab`,run:ew(1),shift:ew(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(ZC,!1)?(t(e.update({effects:YC.of(null)})),!0):!1}],nw=K.define({combine(e){return e.length?e[0]:tw}}),rw=ru.highest(jg.compute([nw],e=>e.facet(nw)));function iw(e,t){return{...t,apply:$C(e)}}var aw=J.domEventHandlers({mousedown(e,t){let n=t.state.field(ZC,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(e=>e.from<=r&&e.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:QC(n.ranges,i.field),effects:YC.of(n.ranges.some(e=>e.field>i.field)?new JC(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),ow=new class extends Ru{};ow.startSide=1,ow.endSide=-1,typeof navigator==`object`&&navigator.userAgent;function sw(e){let t=e.field(RC,!1);return t&&t.active.some(e=>e.isPending)?`pending`:t&&t.active.some(e=>e.state!=0)?`active`:null}var cw=class e{static create(t,n,r,i,a){let o=i+(i<<8)+t+(n<<4)|0;return new e(t,n,r,o,a,[],[])}constructor(e,t,n,r,i,a,o){this.type=e,this.value=t,this.from=n,this.hash=r,this.end=i,this.children=a,this.positions=o,this.blankFirstLine=!1,this.hashProp=[[Y.contextHash,r]]}addChild(e,t){e.prop(Y.contextHash)!=this.hash&&(e=new M_(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let n=this.children.length-1;return n>=0&&(t=Math.max(t,this.positions[n]+this.children[n].length+this.from)),new M_(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(e,t,n)=>new M_(D_.none,e,t,n,this.hashProp)})}},Q;(function(e){e[e.Document=1]=`Document`,e[e.CodeBlock=2]=`CodeBlock`,e[e.FencedCode=3]=`FencedCode`,e[e.Blockquote=4]=`Blockquote`,e[e.HorizontalRule=5]=`HorizontalRule`,e[e.BulletList=6]=`BulletList`,e[e.OrderedList=7]=`OrderedList`,e[e.ListItem=8]=`ListItem`,e[e.ATXHeading1=9]=`ATXHeading1`,e[e.ATXHeading2=10]=`ATXHeading2`,e[e.ATXHeading3=11]=`ATXHeading3`,e[e.ATXHeading4=12]=`ATXHeading4`,e[e.ATXHeading5=13]=`ATXHeading5`,e[e.ATXHeading6=14]=`ATXHeading6`,e[e.SetextHeading1=15]=`SetextHeading1`,e[e.SetextHeading2=16]=`SetextHeading2`,e[e.HTMLBlock=17]=`HTMLBlock`,e[e.LinkReference=18]=`LinkReference`,e[e.Paragraph=19]=`Paragraph`,e[e.CommentBlock=20]=`CommentBlock`,e[e.ProcessingInstructionBlock=21]=`ProcessingInstructionBlock`,e[e.Escape=22]=`Escape`,e[e.Entity=23]=`Entity`,e[e.HardBreak=24]=`HardBreak`,e[e.Emphasis=25]=`Emphasis`,e[e.StrongEmphasis=26]=`StrongEmphasis`,e[e.Link=27]=`Link`,e[e.Image=28]=`Image`,e[e.InlineCode=29]=`InlineCode`,e[e.HTMLTag=30]=`HTMLTag`,e[e.Comment=31]=`Comment`,e[e.ProcessingInstruction=32]=`ProcessingInstruction`,e[e.Autolink=33]=`Autolink`,e[e.HeaderMark=34]=`HeaderMark`,e[e.QuoteMark=35]=`QuoteMark`,e[e.ListMark=36]=`ListMark`,e[e.LinkMark=37]=`LinkMark`,e[e.EmphasisMark=38]=`EmphasisMark`,e[e.CodeMark=39]=`CodeMark`,e[e.CodeText=40]=`CodeText`,e[e.CodeInfo=41]=`CodeInfo`,e[e.LinkTitle=42]=`LinkTitle`,e[e.LinkLabel=43]=`LinkLabel`,e[e.URL=44]=`URL`})(Q||={});var lw=class{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}},uw=class{constructor(){this.text=``,this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return mw(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,n=0){for(let r=t;r<e;r++)n+=this.text.charCodeAt(r)==9?4-n%4:1;return n}findColumn(e){let t=0;for(let n=0;t<this.text.length&&n<e;t++)n+=this.text.charCodeAt(t)==9?4-n%4:1;return t}scrub(){if(!this.baseIndent)return this.text;let e=``;for(let t=0;t<this.basePos;t++)e+=` `;return e+this.text.slice(this.basePos)}};function dw(e,t,n){if(n.pos==n.text.length||e!=t.block&&n.indent>=t.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let r=(e.type==Q.OrderedList?xw:bw)(n,t,!1);return r>0&&(e.type!=Q.BulletList||vw(n,t,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==e.value}var fw={[Q.Blockquote](e,t,n){return n.next==62&&(n.markers.push(Yw(Q.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(pw(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0)},[Q.ListItem](e,t,n){return!(n.next<0?e.blankFirstLine&&e.children.length==1:n.indent<n.baseIndent+e.value)&&(n.moveBaseColumn(n.baseIndent+e.value),!0)},[Q.OrderedList]:dw,[Q.BulletList]:dw,[Q.Document](){return!0}};function pw(e){return e==32||e==9||e==10||e==13}function mw(e,t=0){for(;t<e.length&&pw(e.charCodeAt(t));)t++;return t}function hw(e,t,n){for(;t>n&&pw(e.charCodeAt(t-1));)t--;return t}function gw(e){if(e.next!=96&&e.next!=126)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;if(t<e.pos+3)return-1;if(e.next==96){for(let n=t;n<e.text.length;n++)if(e.text.charCodeAt(n)==96)return-1}return t}function _w(e){return e.next==62?e.text.charCodeAt(e.pos+1)==32?2:1:-1}function vw(e,t,n){if(e.next!=42&&e.next!=45&&e.next!=95)return-1;let r=1;for(let t=e.pos+1;t<e.text.length;t++){let n=e.text.charCodeAt(t);if(n==e.next)r++;else if(!pw(n))return-1}return n&&e.next==45&&Cw(e)>-1&&e.depth==t.stack.length&&t.parser.leafBlockParsers.indexOf(Fw.SetextHeading)>-1||r<3?-1:1}function yw(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function bw(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||pw(e.text.charCodeAt(e.pos+1)))&&(!n||yw(t,Q.BulletList)||e.skipSpace(e.pos+2)<e.text.length)?1:-1}function xw(e,t,n){let r=e.pos,i=e.next;for(;i>=48&&i<=57;){if(r++,r==e.text.length)return-1;i=e.text.charCodeAt(r)}return r==e.pos||r>e.pos+9||i!=46&&i!=41||r<e.text.length-1&&!pw(e.text.charCodeAt(r+1))||n&&!yw(t,Q.OrderedList)&&(e.skipSpace(r+1)==e.text.length||r>e.pos+1||e.next!=49)?-1:r+1-e.pos}function Sw(e){if(e.next!=35)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==35;)t++;if(t<e.text.length&&!pw(e.text.charCodeAt(t)))return-1;let n=t-e.pos;return n>6?-1:n}function Cw(e){if(e.next!=45&&e.next!=61||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;let n=t;for(;t<e.text.length&&pw(e.text.charCodeAt(t));)t++;return t==e.text.length?n:-1}var ww=/^[ \t]*$/,Tw=/-->/,Ew=/\?>/,Dw=[[/^<(?:script|pre|style|textarea)(?:\s|>|$)/i,/<\/(?:script|pre|style|textarea)>/i],[/^\s*<!--/,Tw],[/^\s*<\?/,Ew],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?: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|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,ww],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,ww]];function Ow(e,t,n){if(e.next!=60)return-1;let r=e.text.slice(e.pos);for(let e=0,t=Dw.length-+!!n;e<t;e++)if(Dw[e][0].test(r))return e;return-1}function kw(e,t){let n=e.countIndent(t,e.pos,e.indent),r=e.skipSpace(t),i=e.countIndent(r,t,n);return i>=n+5||r==e.text.length?n+1:i}function Aw(e,t,n){let r=e.length-1;r>=0&&e[r].to==t&&e[r].type==Q.CodeText?e[r].to=n:e.push(Yw(Q.CodeText,t,n))}var jw={LinkReference:void 0,IndentedCode(e,t){let n=t.baseIndent+4;if(t.indent<n)return!1;let r=t.findColumn(n),i=e.lineStart+r,a=e.lineStart+t.text.length,o=[],s=[];for(Aw(o,i,a);e.nextLine()&&t.depth>=e.stack.length;)if(t.pos==t.text.length){Aw(s,e.lineStart-1,e.lineStart);for(let e of t.markers)s.push(e)}else if(t.indent<n)break;else{if(s.length){for(let e of s)e.type==Q.CodeText?Aw(o,e.from,e.to):o.push(e);s=[]}Aw(o,e.lineStart-1,e.lineStart);for(let e of t.markers)o.push(e);a=e.lineStart+t.text.length;let n=e.lineStart+t.findColumn(t.baseIndent+4);n<a&&Aw(o,n,a)}return s.length&&(s=s.filter(e=>e.type!=Q.CodeText),s.length&&(t.markers=s.concat(t.markers))),e.addNode(e.buffer.writeElements(o,-i).finish(Q.CodeBlock,a-i),i),!0},FencedCode(e,t){let n=gw(t);if(n<0)return!1;let r=e.lineStart+t.pos,i=t.next,a=n-t.pos,o=t.skipSpace(n),s=hw(t.text,t.text.length,o),c=[Yw(Q.CodeMark,r,r+a)];o<s&&c.push(Yw(Q.CodeInfo,e.lineStart+o,e.lineStart+s));for(let n=!0,r=!0,o=!1;e.nextLine()&&t.depth>=e.stack.length;n=!1){let s=t.pos;if(t.indent-t.baseIndent<4)for(;s<t.text.length&&t.text.charCodeAt(s)==i;)s++;if(s-t.pos>=a&&t.skipSpace(s)==t.text.length){for(let e of t.markers)c.push(e);r&&o&&Aw(c,e.lineStart-1,e.lineStart),c.push(Yw(Q.CodeMark,e.lineStart+t.pos,e.lineStart+s)),e.nextLine();break}{o=!0,n||(Aw(c,e.lineStart-1,e.lineStart),r=!1);for(let e of t.markers)c.push(e);let i=e.lineStart+t.basePos,a=e.lineStart+t.text.length;i<a&&(Aw(c,i,a),r=!1)}}return e.addNode(e.buffer.writeElements(c,-r).finish(Q.FencedCode,e.prevLineEnd()-r),r),!0},Blockquote(e,t){let n=_w(t);return n<0?!1:(e.startContext(Q.Blockquote,t.pos),e.addNode(Q.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1),t.moveBase(t.pos+n),null)},HorizontalRule(e,t){if(vw(t,e,!1)<0)return!1;let n=e.lineStart+t.pos;return e.nextLine(),e.addNode(Q.HorizontalRule,n),!0},BulletList(e,t){let n=bw(t,e,!1);if(n<0)return!1;e.block.type!=Q.BulletList&&e.startContext(Q.BulletList,t.basePos,t.next);let r=kw(t,t.pos+1);return e.startContext(Q.ListItem,t.basePos,r-t.baseIndent),e.addNode(Q.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),e.block.blankFirstLine=r>=t.text.length,null},OrderedList(e,t){let n=xw(t,e,!1);if(n<0)return!1;e.block.type!=Q.OrderedList&&e.startContext(Q.OrderedList,t.basePos,t.text.charCodeAt(t.pos+n-1));let r=kw(t,t.pos+n);return e.startContext(Q.ListItem,t.basePos,r-t.baseIndent),e.addNode(Q.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),e.block.blankFirstLine=r==t.text.length,null},ATXHeading(e,t){let n=Sw(t);if(n<0)return!1;let r=t.pos,i=e.lineStart+r,a=hw(t.text,t.text.length,r),o=a;for(;o>r&&t.text.charCodeAt(o-1)==t.next;)o--;(o==a||o==r||!pw(t.text.charCodeAt(o-1)))&&(o=t.text.length);let s=e.buffer.write(Q.HeaderMark,0,n).writeElements(e.parser.parseInline(t.text.slice(r+n+1,o),i+n+1),-i);o<t.text.length&&s.write(Q.HeaderMark,o-r,a-r);let c=s.finish(Q.ATXHeading1-1+n,t.text.length-r);return e.nextLine(),e.addNode(c,i),!0},HTMLBlock(e,t){let n=Ow(t,e,!1);if(n<0)return!1;let r=e.lineStart+t.pos,i=Dw[n][1],a=[],o=i!=ww;for(;!i.test(t.text)&&e.nextLine();){if(t.depth<e.stack.length){o=!1;break}for(let e of t.markers)a.push(e)}o&&e.nextLine();let s=i==Tw?Q.CommentBlock:i==Ew?Q.ProcessingInstructionBlock:Q.HTMLBlock,c=e.prevLineEnd();return e.addNode(e.buffer.writeElements(a,-r).finish(s,c-r),r),!0},SetextHeading:void 0},Mw=class{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,t,n){if(this.stage==-1)return!1;let r=n.content+`
8
+ `;this.styleTag.textContent=e}let e=t.head||t;this.styleTag.parentNode!=e&&e.insertBefore(this.styleTag,e.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute(`nonce`)!=e&&this.styleTag.setAttribute(`nonce`,e)}},fd={8:`Backspace`,9:`Tab`,10:`Enter`,12:`NumLock`,13:`Enter`,16:`Shift`,17:`Control`,18:`Alt`,20:`CapsLock`,27:`Escape`,32:` `,33:`PageUp`,34:`PageDown`,35:`End`,36:`Home`,37:`ArrowLeft`,38:`ArrowUp`,39:`ArrowRight`,40:`ArrowDown`,44:`PrintScreen`,45:`Insert`,46:`Delete`,59:`;`,61:`=`,91:`Meta`,92:`Meta`,106:`*`,107:`+`,108:`,`,109:`-`,110:`.`,111:`/`,144:`NumLock`,145:`ScrollLock`,160:`Shift`,161:`Shift`,162:`Control`,163:`Control`,164:`Alt`,165:`Alt`,173:`-`,186:`;`,187:`=`,188:`,`,189:`-`,190:`.`,191:`/`,192:"`",219:`[`,220:`\\`,221:`]`,222:`'`},pd={48:`)`,49:`!`,50:`@`,51:`#`,52:`$`,53:`%`,54:`^`,55:`&`,56:`*`,57:`(`,59:`:`,61:`+`,173:`_`,186:`:`,187:`+`,188:`<`,189:`_`,190:`>`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},md=typeof navigator<`u`&&/Mac/.test(navigator.platform),hd=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),gd=0;gd<10;gd++)fd[48+gd]=fd[96+gd]=String(gd);for(var gd=1;gd<=24;gd++)fd[gd+111]=`F`+gd;for(var gd=65;gd<=90;gd++)fd[gd]=String.fromCharCode(gd+32),pd[gd]=String.fromCharCode(gd);for(var _d in fd)pd.hasOwnProperty(_d)||(pd[_d]=fd[_d]);function vd(e){var t=!(md&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||hd&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?pd:fd)[e.keyCode]||e.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 yd(){var e=arguments[0];typeof e==`string`&&(e=document.createElement(e));var t=1,n=arguments[1];if(n&&typeof n==`object`&&n.nodeType==null&&!Array.isArray(n)){for(var r in n)if(Object.prototype.hasOwnProperty.call(n,r)){var i=n[r];typeof i==`string`?e.setAttribute(r,i):i!=null&&(e[r]=i)}t++}for(;t<arguments.length;t++)bd(e,arguments[t]);return e}function bd(e,t){if(typeof t==`string`)e.appendChild(document.createTextNode(t));else if(t!=null){if(t.nodeType!=null)e.appendChild(t);else if(Array.isArray(t))for(var n=0;n<t.length;n++)bd(e,t[n]);else throw RangeError(`Unsupported child node: `+t)}}var xd=typeof navigator<`u`?navigator:{userAgent:``,vendor:``,platform:``},Sd=typeof document<`u`?document:{documentElement:{style:{}}},Cd=/Edge\/(\d+)/.exec(xd.userAgent),wd=/MSIE \d/.test(xd.userAgent),Td=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(xd.userAgent),Ed=!!(wd||Td||Cd),Dd=!Ed&&/gecko\/(\d+)/i.test(xd.userAgent),Od=!Ed&&/Chrome\/(\d+)/.exec(xd.userAgent),kd=`webkitFontSmoothing`in Sd.documentElement.style,Ad=!Ed&&/Apple Computer/.test(xd.vendor),jd=Ad&&(/Mobile\/\w+/.test(xd.userAgent)||xd.maxTouchPoints>2),q={mac:jd||/Mac/.test(xd.platform),windows:/Win/.test(xd.platform),linux:/Linux|X11/.test(xd.platform),ie:Ed,ie_version:wd?Sd.documentMode||6:Td?+Td[1]:Cd?+Cd[1]:0,gecko:Dd,gecko_version:Dd?+(/Firefox\/(\d+)/.exec(xd.userAgent)||[0,0])[1]:0,chrome:!!Od,chrome_version:Od?+Od[1]:0,ios:jd,android:/Android\b/.test(xd.userAgent),webkit:kd,webkit_version:kd?+(/\bAppleWebKit\/(\d+)/.exec(xd.userAgent)||[0,0])[1]:0,safari:Ad,safari_version:Ad?+(/\bVersion\/(\d+(\.\d+)?)/.exec(xd.userAgent)||[0,0])[1]:0,tabSize:Sd.documentElement.style.tabSize==null?`-moz-tab-size`:`tab-size`};function Md(e,t){for(let n in e)n==`class`&&t.class?t.class+=` `+e.class:n==`style`&&t.style?t.style+=`;`+e.style:t[n]=e[n];return t}var Nd=Object.create(null);function Pd(e,t,n){if(e==t)return!0;e||=Nd,t||=Nd;let r=Object.keys(e),i=Object.keys(t);if(r.length-0!=i.length-0)return!1;for(let a of r)if(a!=n&&(i.indexOf(a)==-1||e[a]!==t[a]))return!1;return!0}function Fd(e,t){for(let n=e.attributes.length-1;n>=0;n--){let r=e.attributes[n].name;t[r]??e.removeAttribute(r)}for(let n in t){let r=t[n];n==`style`?e.style.cssText=r:e.getAttribute(n)!=r&&e.setAttribute(n,r)}}function Id(e,t,n){let r=!1;if(t)for(let i in t)n&&i in n||(r=!0,i==`style`?e.style.cssText=``:e.removeAttribute(i));if(n)for(let i in n)t&&t[i]==n[i]||(r=!0,i==`style`?e.style.cssText=n[i]:e.setAttribute(i,n[i]));return r}function Ld(e){let t=Object.create(null);for(let n=0;n<e.attributes.length;n++){let r=e.attributes[n];t[r.name]=r.value}return t}var Rd=class{eq(e){return!1}updateDOM(e,t,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,n){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}},zd=(function(e){return e[e.Text=0]=`Text`,e[e.WidgetBefore=1]=`WidgetBefore`,e[e.WidgetAfter=2]=`WidgetAfter`,e[e.WidgetRange=3]=`WidgetRange`,e})(zd||={}),Bd=class extends Ru{constructor(e,t,n,r){super(),this.startSide=e,this.endSide=t,this.widget=n,this.spec=r}get heightRelevant(){return!1}static mark(e){return new Vd(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),n=!!e.block;return t+=n&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Ud(e,t,t,n,e.widget||null,!1)}static replace(e){let t=!!e.block,n,r;if(e.isBlockGap)n=-5e8,r=4e8;else{let{start:i,end:a}=Wd(e,t);n=(i?t?-3e8:-1:5e8)-1,r=(a?t?2e8:1:-6e8)+1}return new Ud(e,n,r,t,e.widget||null,!0)}static line(e){return new Hd(e)}static set(e,t=!1){return Uu.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};Bd.none=Uu.empty;var Vd=class e extends Bd{constructor(e){let{start:t,end:n}=Wd(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||`span`,this.attrs=e.class&&e.attributes?Md(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||Nd}eq(t){return this==t||t instanceof e&&this.tagName==t.tagName&&Pd(this.attrs,t.attrs)}range(e,t=e){if(e>=t)throw RangeError(`Mark decorations may not be empty`);return super.range(e,t)}};Vd.prototype.point=!1;var Hd=class e extends Bd{constructor(e){super(-2e8,-2e8,null,e)}eq(t){return t instanceof e&&this.spec.class==t.spec.class&&Pd(this.spec.attributes,t.spec.attributes)}range(e,t=e){if(t!=e)throw RangeError(`Line decoration ranges must be zero-length`);return super.range(e,t)}};Hd.prototype.mapMode=Il.TrackBefore,Hd.prototype.point=!0;var Ud=class e extends Bd{constructor(e,t,n,r,i,a){super(t,n,i,e),this.block=r,this.isReplace=a,this.mapMode=r?t<=0?Il.TrackBefore:Il.TrackAfter:Il.TrackDel}get type(){return this.startSide==this.endSide?this.startSide<=0?zd.WidgetBefore:zd.WidgetAfter:zd.WidgetRange}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof e&&Gd(this.widget,t.widget)&&this.block==t.block&&this.startSide==t.startSide&&this.endSide==t.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw RangeError(`Invalid range for replacement decoration`);if(!this.isReplace&&t!=e)throw RangeError(`Widget decorations can only have zero-length ranges`);return super.range(e,t)}};Ud.prototype.point=!0;function Wd(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n??=e.inclusive,r??=e.inclusive,{start:n??t,end:r??t}}function Gd(e,t){return e==t||!!(e&&t&&e.compare(t))}function Kd(e,t,n,r=0){let i=n.length-1;i>=0&&n[i]+r>=e?n[i]=Math.max(n[i],t):n.push(e,t)}var qd=class e extends Ru{constructor(e,t,n){super(),this.tagName=e,this.attributes=t,this.rank=n}eq(t){return t==this||t instanceof e&&this.tagName==t.tagName&&Pd(this.attributes,t.attributes)}static create(t){return new e(t.tagName,t.attributes||Nd,t.rank==null?50:Math.max(0,Math.min(t.rank,100)))}static set(e,t=!1){return Uu.of(e,t)}};qd.prototype.startSide=qd.prototype.endSide=-1;var Jd=e=>e.nodeType==1,Yd=e=>e.nodeType==3;function Xd(e){let t;return t=e.nodeType==11?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function Zd(e,t){return t?e==t||e.contains(t.nodeType==1?t:t.parentNode):!1}function Qd(e,t){if(!t.anchorNode)return!1;try{return Zd(e,t.anchorNode)}catch{return!1}}function $d(e){return Yd(e)?_f(e,0,e.nodeValue.length).getClientRects():Jd(e)?e.getClientRects():[]}function ef(e,t,n,r){return n?rf(e,t,n,r,-1)||rf(e,t,n,r,1):!1}function tf(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function nf(e){return Jd(e)&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function rf(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:af(e))){if(e.nodeName==`DIV`)return!1;let n=e.parentNode;if(!n||!Jd(n))return!1;t=tf(e)+(i<0?0:1),e=n}else if(Jd(e)){if(e=e.childNodes[t+(i<0?-1:0)],Jd(e)&&(e.nodeName==`IMG`||e.nodeName==`BR`||e.contentEditable==`false`))return!1;t=i<0?af(e):0}else return!1}}function af(e){return Yd(e)?e.nodeValue.length:e.childNodes.length}function of(e,t){let{left:n,right:r}=e;if(n==r)return e;let i=t?n:r;return{left:i,right:i,top:e.top,bottom:e.bottom}}function sf(e){let t=e.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.innerWidth,top:0,bottom:e.innerHeight}}function cf(e,t){let n=t.width/e.offsetWidth,r=t.height/e.offsetHeight;return(n>.995&&n<1.005||!isFinite(n)||Math.abs(t.width-e.offsetWidth)<1)&&(n=1),(r>.995&&r<1.005||!isFinite(r)||Math.abs(t.height-e.offsetHeight)<1)&&(r=1),{scaleX:n,scaleY:r}}function lf(e,t,n,r,i,a,o,s){let c=e.ownerDocument,l=c.defaultView||window;for(let u=e,d=!1;u&&!d;)if(Jd(u)){let e,f=u==c.body,p=1,m=1,h=!0,g=!0;if(f)e=sf(l);else{let t=getComputedStyle(u);if(/^(fixed|sticky)$/.test(t.position)&&(d=!0),(u.scrollHeight<=u.clientHeight||!/auto|scroll/.test(t.overflowY))&&(g=!1),(u.scrollWidth<=u.clientWidth||!/auto|scroll/.test(t.overflowX))&&(h=!1),!h&&!g){u=u.assignedSlot||u.parentNode;continue}let n=u.getBoundingClientRect();({scaleX:p,scaleY:m}=cf(u,n)),e={left:n.left,right:n.left+u.clientWidth*p,top:n.top,bottom:n.top+u.clientHeight*m}}let _=0,v=0;if(g){if(i==`nearest`)t.top<e.top+o?(v=t.top-(e.top+o),n>0&&t.bottom>e.bottom+v&&(v=t.bottom-e.bottom+o)):t.bottom>e.bottom-o&&(v=t.bottom-e.bottom+o,n<0&&t.top-v<e.top&&(v=t.top-(e.top+o)));else{let r=t.bottom-t.top,a=e.bottom-e.top;v=(i==`center`&&r<=a?t.top+r/2-a/2:i==`start`||i==`center`&&n<0?t.top-o:t.bottom-a+o)-e.top}}if(h&&(r==`nearest`?t.left<e.left+a?(_=t.left-(e.left+a),n>0&&t.right>e.right+_&&(_=t.right-e.right+a)):t.right>e.right-a&&(_=t.right-e.right+a,n<0&&t.left<e.left+_&&(_=t.left-(e.left+a))):_=(r==`center`?t.left+(t.right-t.left)/2-(e.right-e.left)/2:r==`start`==s?t.left-a:t.right-(e.right-e.left)+a)-e.left),_||v){if(f)l.scrollBy(_,v);else{let e=0,n=0;if(v){let e=u.scrollTop;u.scrollTop+=v/m,n=(u.scrollTop-e)*m}if(_){let t=u.scrollLeft;u.scrollLeft+=_/p,e=(u.scrollLeft-t)*p}t={left:t.left-e,top:t.top-n,right:t.right-e,bottom:t.bottom-n},e&&Math.abs(e-_)<1&&(r=`nearest`),n&&Math.abs(n-v)<1&&(i=`nearest`)}}if(f)break;(t.top<e.top||t.bottom>e.bottom||t.left<e.left||t.right>e.right)&&(t={left:Math.max(t.left,e.left),right:Math.min(t.right,e.right),top:Math.max(t.top,e.top),bottom:Math.min(t.bottom,e.bottom)}),u=u.assignedSlot||u.parentNode}else if(u.nodeType==11)u=u.host;else break}function uf(e,t=!0){let n=e.ownerDocument,r=null,i=null;for(let a=e.parentNode;a&&!(a==n.body||(!t||r)&&i);)if(Jd(a))!i&&a.scrollHeight>a.clientHeight&&/scroll|auto/.test(getComputedStyle(a).overflowY)&&(i=a),t&&!r&&a.scrollWidth>a.clientWidth&&/scroll|auto/.test(getComputedStyle(a).overflowX)&&(r=a),a=a.assignedSlot||a.parentNode;else if(a.nodeType==11)a=a.host;else break;return{x:r,y:i}}var df=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:n}=e;this.set(t,Math.min(e.anchorOffset,t?af(t):0),n,Math.min(e.focusOffset,n?af(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}};function ff(e){let t=[];for(let n=e;n;n=n.nodeType==11?n.host:n.parentNode)Jd(n)&&t.push({node:n,left:n.scrollLeft,top:n.scrollTop});return t}function pf(e,t=!0){for(let{node:n,left:r,top:i}of e)t&&n.scrollTop!=i&&(n.scrollTop=i),n.scrollLeft!=r&&(n.scrollLeft=r)}var mf=null;q.safari&&q.safari_version>=26&&(mf=!1);function hf(e){if(e.setActive)return e.setActive();if(mf)return e.focus(mf);let t=ff(e);e.focus(mf==null?{get preventScroll(){return mf={preventScroll:!0},!0}}:void 0),mf||(mf=!1,pf(t))}var gf;function _f(e,t,n=t){let r=gf||=document.createRange();return r.setEnd(e,n),r.setStart(e,t),r}function vf(e,t,n,r){let i={key:t,code:t,keyCode:n,which:n,cancelable:!0};r&&({altKey:i.altKey,ctrlKey:i.ctrlKey,shiftKey:i.shiftKey,metaKey:i.metaKey}=r);let a=new KeyboardEvent(`keydown`,i);a.synthetic=!0,e.dispatchEvent(a);let o=new KeyboardEvent(`keyup`,i);return o.synthetic=!0,e.dispatchEvent(o),a.defaultPrevented||o.defaultPrevented}function yf(e){for(;e;){if(e&&(e.nodeType==9||e.nodeType==11&&e.host))return e;e=e.assignedSlot||e.parentNode}return null}function bf(e,t){let n=t.focusNode,r=t.focusOffset;if(!n||t.anchorNode!=n||t.anchorOffset!=r)return!1;for(r=Math.min(r,af(n));;)if(r){if(!Jd(n))return!1;let e=n.childNodes[r-1];e.contentEditable==`false`?r--:(n=e,r=af(n))}else if(n==e)return!0;else r=tf(n),n=n.parentNode}function xf(e){return e instanceof Window?e.pageYOffset>Math.max(0,e.document.documentElement.scrollHeight-e.innerHeight-4):e.scrollTop>Math.max(1,e.scrollHeight-e.clientHeight-4)}function Sf(e,t){for(let n=e,r=t;;)if(Yd(n)&&r>0)return{node:n,offset:r};else if(Jd(n)&&r>0){if(n.contentEditable==`false`)return null;n=n.childNodes[r-1],r=af(n)}else if(n.parentNode&&!nf(n))r=tf(n),n=n.parentNode;else return null}function Cf(e,t){for(let n=e,r=t;;)if(Yd(n)&&r<n.nodeValue.length)return{node:n,offset:r};else if(Jd(n)&&r<n.childNodes.length){if(n.contentEditable==`false`)return null;n=n.childNodes[r],r=0}else if(n.parentNode&&!nf(n))r=tf(n)+1,n=n.parentNode;else return null}var wf=class e{constructor(e,t,n=!0){this.node=e,this.offset=t,this.precise=n}static before(t,n){return new e(t.parentNode,tf(t),n)}static after(t,n){return new e(t.parentNode,tf(t)+1,n)}},Tf=(function(e){return e[e.LTR=0]=`LTR`,e[e.RTL=1]=`RTL`,e})(Tf||={}),Ef=Tf.LTR,Df=Tf.RTL;function Of(e){let t=[];for(let n=0;n<e.length;n++)t.push(1<<e[n]);return t}var kf=Of(`88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008`),Af=Of(`4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333`),jf=Object.create(null),Mf=[];for(let e of[`()`,`[]`,`{}`]){let t=e.charCodeAt(0),n=e.charCodeAt(1);jf[t]=n,jf[n]=-t}function Nf(e){return e<=247?kf[e]:1424<=e&&e<=1524?2:1536<=e&&e<=1785?Af[e-1536]:1774<=e&&e<=2220?4:8192<=e&&e<=8204?256:64336<=e&&e<=65023?4:1}var Pf=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,Ff=class{get dir(){return this.level%2?Df:Ef}constructor(e,t,n){this.from=e,this.to=t,this.level=n}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,n,r){let i=-1;for(let a=0;a<e.length;a++){let o=e[a];if(o.from<=t&&o.to>=t){if(o.level==n)return a;(i<0||(r==0?e[i].level>o.level:r<0?o.from<t:o.to>t))&&(i=a)}}if(i<0)throw RangeError(`Index out of range`);return i}};function If(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.direction!=i.direction||!If(r.inner,i.inner))return!1}return!0}var Lf=[];function Rf(e,t,n,r,i){for(let a=0;a<=r.length;a++){let o=a?r[a-1].to:t,s=a<r.length?r[a].from:n,c=a?256:i;for(let t=o,n=c,r=c;t<s;t++){let i=Nf(e.charCodeAt(t));i==512?i=n:i==8&&r==4&&(i=16),Lf[t]=i==4?2:i,i&7&&(r=i),n=i}for(let e=o,t=c,r=c;e<s;e++){let i=Lf[e];if(i==128)e<s-1&&t==Lf[e+1]&&t&24?i=Lf[e]=t:Lf[e]=256;else if(i==64){let i=e+1;for(;i<s&&Lf[i]==64;)i++;let a=e&&t==8||i<n&&Lf[i]==8?r==1?1:8:256;for(let t=e;t<i;t++)Lf[t]=a;e=i-1}else i==8&&r==1&&(Lf[e]=1);t=i,i&7&&(r=i)}}}function zf(e,t,n,r,i){let a=i==1?2:1;for(let o=0,s=0,c=0;o<=r.length;o++){let l=o?r[o-1].to:t,u=o<r.length?r[o].from:n;for(let t=l,n,r,o;t<u;t++)if(r=jf[n=e.charCodeAt(t)]){if(r<0){for(let e=s-3;e>=0;e-=3)if(Mf[e+1]==-r){let n=Mf[e+2],r=n&2?i:n&4?n&1?a:i:0;r&&(Lf[t]=Lf[Mf[e]]=r),s=e;break}}else if(Mf.length==189)break;else Mf[s++]=t,Mf[s++]=n,Mf[s++]=c}else if((o=Lf[t])==2||o==1){let e=o==i;c=+!e;for(let t=s-3;t>=0;t-=3){let n=Mf[t+2];if(n&2)break;if(e)Mf[t+2]|=2;else{if(n&4)break;Mf[t+2]|=4}}}}}function Bf(e,t,n,r){for(let i=0,a=r;i<=n.length;i++){let o=i?n[i-1].to:e,s=i<n.length?n[i].from:t;for(let c=o;c<s;){let o=Lf[c];if(o==256){let o=c+1;for(;;)if(o==s){if(i==n.length)break;o=n[i++].to,s=i<n.length?n[i].from:t}else if(Lf[o]==256)o++;else break;let l=a==1,u=l==((o<t?Lf[o]:r)==1)?l?1:2:r;for(let t=o,r=i,a=r?n[r-1].to:e;t>c;)t==a&&(t=n[--r].from,a=r?n[r-1].to:e),Lf[--t]=u;c=o}else a=o,c++}}}function Vf(e,t,n,r,i,a,o){let s=r%2?2:1;if(r%2==i%2)for(let c=t,l=0;c<n;){let t=!0,u=!1;if(l==a.length||c<a[l].from){let e=Lf[c];e!=s&&(t=!1,u=e==16)}let d=!t&&s==1?[]:null,f=t?r:r+1,p=c;run:for(;;)if(l<a.length&&p==a[l].from){if(u)break run;let m=a[l];if(!t)for(let e=m.to,t=l+1;;){if(e==n)break run;if(t<a.length&&a[t].from==e)e=a[t++].to;else if(Lf[e]==s)break run;else break}l++,d?d.push(m):(m.from>c&&o.push(new Ff(c,m.from,f)),Hf(e,m.direction==Ef==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.to),p=m.to}else if(p==n||(t?Lf[p]!=s:Lf[p]==s))break;else p++;d?Vf(e,c,p,r+1,i,d,o):c<p&&o.push(new Ff(c,p,f)),c=p}else for(let c=n,l=a.length;c>t;){let n=!0,u=!1;if(!l||c>a[l-1].to){let e=Lf[c-1];e!=s&&(n=!1,u=e==16)}let d=!n&&s==1?[]:null,f=n?r:r+1,p=c;run:for(;;)if(l&&p==a[l-1].to){if(u)break run;let m=a[--l];if(!n)for(let e=m.from,n=l;;){if(e==t)break run;if(n&&a[n-1].to==e)e=a[--n].from;else if(Lf[e-1]==s)break run;else break}d?d.push(m):(m.to<c&&o.push(new Ff(m.to,c,f)),Hf(e,m.direction==Ef==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.from),p=m.from}else if(p==t||(n?Lf[p-1]!=s:Lf[p-1]==s))break;else p--;d?Vf(e,p,c,r+1,i,d,o):p<c&&o.push(new Ff(p,c,f)),c=p}}function Hf(e,t,n,r,i,a,o){let s=t%2?2:1;Rf(e,i,a,r,s),zf(e,i,a,r,s),Bf(i,a,r,s),Vf(e,i,a,t,n,r,o)}function Uf(e,t,n){if(!e)return[new Ff(0,0,+(t==Df))];if(t==Ef&&!n.length&&!Pf.test(e))return Wf(e.length);if(n.length)for(;e.length>Lf.length;)Lf[Lf.length]=256;let r=[],i=t==Ef?0:1;return Hf(e,i,i,n,0,e.length,r),r}function Wf(e){return[new Ff(0,e,0)]}var Gf=``;function Kf(e,t,n,r,i){if(!e.length)return null;let a=r.head-e.from,o;if(r.head==e.from&&r.assoc<0){if(!i)return null;a=t[o=0].side(!1,n)}else if(r.head==e.to&&r.assoc>0){if(i)return null;a=t[o=t.length-1].side(!0,n)}else o=Ff.find(t,a,r.bidiLevel??-1,r.assoc);let s=t[o],c=s.side(i,n);if(a==c){let e=o+=i?1:-1;if(e<0||e>=t.length)return null;s=t[o=e],a=s.side(!i,n),c=s.side(i,n)}let l=kl(e.text,a,s.forward(i,n));(l<s.from||l>s.to)&&(l=c),Gf=e.text.slice(Math.min(a,l),Math.max(a,l));let u=o==(i?t.length-1:0)?null:t[o+(i?1:-1)];if(l==c){if(!u)return i?G.cursor(e.to,1):G.cursor(e.from,-1);if(u.level+ +!i<s.level)return G.cursor(u.side(!i,n)+e.from,u.forward(i,n)?1:-1,u.level)}return G.cursor(l+e.from,s.forward(i,n)?-1:1,s.level)}function qf(e,t,n){for(let r=t;r<n;r++){let t=Nf(e.charCodeAt(r));if(t==1)return Ef;if(t==2||t==4)return Df}}var Jf=K.define(),Yf=K.define(),Xf=K.define(),Zf=K.define(),Qf=K.define(),$f=K.define(),ep=K.define(),tp=K.define(),np=K.define(),rp=K.define({combine:e=>e.some(e=>e)}),ip=K.define({combine:e=>e.some(e=>e)}),ap=K.define(),op=class e{constructor(e,t,n,r,i,a=!1){this.range=e,this.y=t,this.x=n,this.yMargin=r,this.xMargin=i,this.isSnapshot=a}map(t){return t.empty?this:new e(this.range.map(t),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(t){return this.range.to<=t.doc.length?this:new e(G.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},sp=xu.define({map:(e,t)=>e.map(t)}),cp=xu.define();function lp(e,t,n){let r=e.facet(Zf);r.length?r[0](t):window.onerror&&window.onerror(String(t),n,void 0,void 0,t)||(n?console.error(n+`:`,t):console.error(t))}var up=K.define({combine:e=>!e.length||e[0]}),dp=0,fp=K.define({combine(e){return e.filter((t,n)=>{for(let r=0;r<n;r++)if(e[r].plugin==t.plugin)return!1;return!0})}}),pp=class e{constructor(e,t,n,r,i){this.id=e,this.create=t,this.domEventHandlers=n,this.domEventObservers=r,this.baseExtensions=i(this),this.extension=this.baseExtensions.concat(fp.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(fp.of({plugin:this,arg:e}))}static define(t,n){let{eventHandlers:r,eventObservers:i,provide:a,decorations:o}=n||{};return new e(dp++,t,r,i,e=>{let t=[];return o&&t.push(_p.of(t=>{let n=t.plugin(e);return n?o(n):Bd.none})),a&&t.push(a(e)),t})}static fromClass(t,n){return e.define((e,n)=>new t(e,n),n)}},mp=class{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.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){lp(e.state,t,`CodeMirror plugin crashed`),this.deactivate()}}else if(this.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(lp(e.state,t,`CodeMirror plugin crashed`),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}return this}destroy(e){if(this.value?.destroy)try{this.value.destroy()}catch(t){lp(e.state,t,`CodeMirror plugin crashed`)}}deactivate(){this.spec=this.value=null}},hp=K.define(),gp=K.define(),_p=K.define(),vp=K.define(),yp=K.define(),bp=K.define(),xp=K.define();function Sp(e,t){let n=e.state.facet(xp);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return Uu.spans(r,t.from,t.to,{point(){},span(e,n,r,a){let o=e-t.from,s=n-t.from,c=i;for(let e=r.length-1;e>=0;e--,a--){let t=r[e].spec.bidiIsolate,n;if(a>0&&c.length&&(n=c[c.length-1]).to==o&&n.direction==t)n.to=s,c=n.inner;else{let e={from:o,to:s,direction:t,inner:[]};c.push(e),c=e.inner}}}}),Cp(t.text,i)}function Cp(e,t){for(let n of t){if(n.direction==null){for(let t=n.from,r=0;t<n.to;r++){let i=r<n.inner.length?n.inner[r]:null,a=qf(e,t,i?i.from:n.to);if(a){n.direction=a;break}if(!i)break;t=i.to}n.direction??=Tf.LTR}Cp(e,n.inner)}return t}var wp=K.define();function Tp(e){let t=0,n=0,r=0,i=0;for(let a of e.state.facet(wp)){let o=a(e);o&&(o.left!=null&&(t=Math.max(t,o.left)),o.right!=null&&(n=Math.max(n,o.right)),o.top!=null&&(r=Math.max(r,o.top)),o.bottom!=null&&(i=Math.max(i,o.bottom)))}return{left:t,right:n,top:r,bottom:i}}var Ep=K.define(),Dp=class e{constructor(e,t,n,r){this.fromA=e,this.toA=t,this.fromB=n,this.toB=r}join(t){return new e(Math.min(this.fromA,t.fromA),Math.max(this.toA,t.toA),Math.min(this.fromB,t.fromB),Math.max(this.toB,t.toB))}addToSet(e){let t=e.length,n=this;for(;t>0;t--){let r=e[t-1];if(!(r.fromA>n.toA)){if(r.toA<n.fromA)break;n=n.join(r),e.splice(t-1,1)}}return e.splice(t,0,n),e}static extendWithRanges(t,n){if(n.length==0)return t;let r=[];for(let i=0,a=0,o=0;;){let s=i<t.length?t[i].fromB:1e9,c=a<n.length?n[a]:1e9,l=Math.min(s,c);if(l==1e9)break;let u=l+o,d=l,f=u;for(;;)if(a<n.length&&n[a]<=d){let e=n[a+1];a+=2,d=Math.max(d,e);for(let e=i;e<t.length&&t[e].fromB<=d;e++)o=t[e].toA-t[e].toB;f=Math.max(f,e+o)}else if(i<t.length&&t[i].fromB<=d){let e=t[i++];d=Math.max(d,e.toB),f=Math.max(f,e.toA),o=e.toA-e.toB}else break;r.push(new e(u,f,l,d))}return r}},Op=class e{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=Rl.empty(this.startState.doc.length);for(let e of n)this.changes=this.changes.compose(e.changes);let r=[];this.changes.iterChangedRanges((e,t,n,i)=>r.push(new Dp(e,t,n,i))),this.changedRanges=r}static create(t,n,r){return new e(t,n,r)}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}},kp=[],Ap=class{constructor(e,t,n=0){this.dom=e,this.length=t,this.flags=n,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return kp}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 e=this.domAttrs;e&&Fd(this.dom,e)}}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 n=t;for(let t of this.children){if(t==e)return n;n+=t.length+t.breakAfter}throw RangeError(`Invalid child in posBefore`)}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t,n){return null}domPosFor(e,t){let n=tf(this.dom),r=this.length?e>0:t>0;return new wf(this.parent.dom,n+ +!!r,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 Np)return e;return null}static get(e){return e.cmTile}},jp=class extends Ap{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,n=null,r,i=e?.node==t?e:null,a=0;for(let o of this.children){if(o.sync(e),a+=o.length+o.breakAfter,r=n?n.nextSibling:t.firstChild,i&&r!=o.dom&&(i.written=!0),o.dom.parentNode==t)for(;r&&r!=o.dom;)r=Mp(r);else t.insertBefore(o.dom,r);n=o.dom}for(r=n?n.nextSibling:t.firstChild,i&&r&&(i.written=!0);r;)r=Mp(r);this.length=a}};function Mp(e){let t=e.nextSibling;return e.parentNode.removeChild(e),t}var Np=class extends jp{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=Ap.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],n=this,r=0,i=0;;)if(r==n.children.length){if(!t.length)return;n=n.parent,n.breakAfter&&i++,r=t.pop()}else{let a=n.children[r++];if(a instanceof Pp)t.push(r),n=a,r=0;else{let t=i+a.length,n=e(a,i);if(n!==void 0)return n;i=t+a.breakAfter}}}resolveBlock(e,t){let n,r=-1,i,a=-1;if(this.blockTiles((o,s)=>{let c=s+o.length;if(e>=s&&e<=c){if(o.isWidget()&&t>=-1&&t<=1){if(o.flags&32)return!0;o.flags&16&&(n=void 0)}(s<e||e==c&&(t<-1?o.length:o.covers(1)))&&(!n||!o.isWidget()&&n.isWidget())&&(n=o,r=e-s),(c>e||e==s&&(t>1?o.length:o.covers(-1)))&&(!i||!o.isWidget()&&i.isWidget())&&(i=o,a=e-s)}}),!n&&!i)throw Error(`No tile at position `+e);return n&&t<0||!i?{tile:n,offset:r}:{tile:i,offset:a}}},Pp=class e extends jp{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(t,n){let r=new e(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}},Fp=class e extends jp{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(t,n,r){let i=new e(n||document.createElement(`div`),t);return n&&r||(i.flags|=4),i}get domAttrs(){return this.attrs}resolveInline(e,t,n=!1){let r=null,i=-1,a=null,o=-1;function s(e,c){for(let l=0,u=0;l<e.children.length&&u<=c;l++){let d=e.children[l],f=u+d.length;f>=c&&(d.isComposite()?s(d,c-u):(!a||n&&a.isHidden&&(t>0&&!(a.flags&32)||n&&Lp(a,d)))&&(f>c||d.flags&32&&t<=1)?(a=d,o=c-u):(u<c||d.flags&16&&!(n&&d.isHidden)&&t>=-1)&&(r=d,i=c-u)),u=f}}s(this,e);let c=(t<0?r:a)||r||a;return c?{tile:c,offset:c==r?i:o}:null}coordsIn(e,t,n){let r=this.resolveInline(e,t,!0);return r?r.tile.coordsIn(Math.max(0,r.offset),t,n):Ip(this)}domIn(e,t){let n=this.resolveInline(e,t);if(n){let{tile:e,offset:r}=n;if(this.dom.contains(e.dom))return e.isText()?new wf(e.dom,Math.min(e.dom.nodeValue.length,r)):e.domPosFor(r,e.flags&16?1:e.flags&32?-1:t);let i=n.tile.parent,a=!1;for(let e of i.children){if(a)return new wf(e.dom,0);e==n.tile&&(a=!0)}}return new wf(this.dom,0)}};function Ip(e){let t=e.dom.lastChild;if(!t)return e.dom.getBoundingClientRect();let n=$d(t);return n[n.length-1]||null}function Lp(e,t){let n=e.coordsIn(0,1),r=t.coordsIn(0,1);return n&&r&&r.top<n.bottom}var Rp=class e extends jp{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(t,n){let r=new e(n||document.createElement(t.tagName),t);return n||(r.flags|=4),r}},zp=class e extends Ap{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t,n){let r=this.dom.nodeValue.length;e>r&&(e=r);let i=e,a=e,o=0;e==0&&t<0||e==r&&t>=0?q.chrome||q.gecko||(e?(i--,o=1):a<r&&(a++,o=-1)):t<0?i--:a<r&&a++;let s=_f(this.dom,i,a).getClientRects();if(!s.length)return null;let c=s[(o?o<0:t>=0)?0:s.length-1];return q.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(s,e=>e.width)||c),n==null?c:of(c,(o?o>0:t<0)==n)}static of(t,n){let r=new e(n||document.createTextNode(t),t);return n||(r.flags|=2),r}},Bp=class e extends Ap{constructor(e,t,n,r){super(e,t,r),this.widget=n}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,n){let r=this.widget.coordsAt(this.dom,e,t);if(r)return r;if(n)return of(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let t=this.dom.getClientRects(),n=null;if(!t.length)return null;let r=this.flags&16?!0:this.flags&32?!1:e>0;for(let i=r?t.length-1:0;n=t[i],!(e>0?i==0:i==t.length-1||n.top<n.bottom);i+=r?-1:1);return of(n,!r)}}get overrideDOMText(){if(!this.length)return vl.empty;let{root:e}=this;if(!e)return vl.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(t,n,r,i,a){return a||(a=t.toDOM(n),t.editable||(a.contentEditable=`false`)),new e(a,r,t,i)}},Vp=class extends Ap{constructor(e){let t=document.createElement(`img`);t.className=`cm-widgetBuffer`,t.setAttribute(`aria-hidden`,`true`),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return vl.empty}coordsIn(e,t,n){let r=this.dom.getBoundingClientRect();return n==null?r:of(r,t>0==n)}},Hp=class{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,n){let{tile:r,index:i,beforeBreak:a,parents:o}=this;for(;e||t>0;)if(!r.isComposite()){let t=r.length;if(i<t&&e){let a=Math.min(e,t-i);n&&n.skip(r,i,i+a),e-=a,i+=a}if(i==t)a=!!r.breakAfter,{tile:r,index:i}=o.pop(),i++;else if(!e)break}else if(a){if(!e)break;n&&n.break(),e--,a=!1}else if(i==r.children.length){if(!e&&!o.length)break;n&&n.leave(r),a=!!r.breakAfter,{tile:r,index:i}=o.pop(),i++}else{let s=r.children[i],c=s.breakAfter;(t>0?s.length<=e:s.length<e)&&(!n||n.skip(s,0,s.length)!==!1||!s.isComposite)?(a=!!c,i++,e-=s.length):(o.push({tile:r,index:i}),r=s,i=0,n&&s.isComposite()&&n.enter(s))}return this.tile=r,this.index=i,this.beforeBreak=a,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}},Up=class{constructor(e,t,n,r){this.from=e,this.to=t,this.wrapper=n,this.rank=r}},Wp=class{constructor(e,t,n){this.cache=e,this.root=t,this.blockWrappers=n,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,n,r){this.flushBuffer();let i=this.ensureMarks(t,n),a=i.lastChild;if(a&&a.isText()&&!(a.flags&8)&&a.length+e.length<512){this.cache.reused.set(a,2);let t=i.children[i.children.length-1]=new zp(a.dom,a.text+e);t.parent=i}else i.append(r||zp.of(e,this.cache.find(zp)?.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let n=this.curLine;n.dom!=t.line.dom&&(n.setDOM(this.cache.reused.has(t.line)?em(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let r=n;for(let e=t.marks.length-1;e>=0;e--){let n=t.marks[e],i=r.lastChild;if(i instanceof Rp&&i.mark.eq(n.mark))i.dom!=n.dom&&i.setDOM(em(n.dom)),r=i;else{let{dom:e}=n;this.cache.reused.get(n)&&Ap.get(n.dom)&&(e=em(n.dom));let t=Rp.of(n.mark,e);r.append(t),r=t}this.cache.reused.set(n,2)}let i=Ap.get(e.text);i&&this.cache.reused.set(i,2);let a=new zp(e.text,e.text.nodeValue);a.flags|=8,this.pos=e.range.toB,r.append(a)}addInlineWidget(e,t,n){let r=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);r||this.flushBuffer();let i=this.ensureMarks(t,n);!r&&!(e.flags&16)&&i.append(this.getBuffer(1)),i.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,n){this.flushBuffer(),this.ensureMarks(t,n).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){e||=Zp;let n=Fp.start(e,t||this.cache.find(Fp)?.dom,!!t);this.getBlockPos().append(this.lastBlock=this.curLine=n)}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){let n=this.curLine;for(let r=e.length-1;r>=0;r--){let i=e[r],a;if(t>0&&(a=n.lastChild)&&a instanceof Rp&&a.mark.eq(i))n=a,t--;else{let e=Rp.of(i,this.cache.find(Rp,e=>e.mark.eq(i))?.dom);n.append(e),n=e,t=0}}return n}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!Yp(this.curLine,!1)||e.dom.nodeName!=`BR`&&e.isWidget()&&!(q.ios&&Yp(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(nm,0,32)||new Bp(nm.toDOM(),0,nm,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&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=e.rank*102+e.value.rank,n=new Up(e.from,e.to,e.value,t),r=this.wrappers.length;for(;r>0&&(this.wrappers[r-1].rank-n.rank||this.wrappers[r-1].to-n.to)<0;)r--;this.wrappers.splice(r,0,n)}this.wrapperPos=this.pos}getBlockPos(){this.updateBlockWrappers();let e=this.root;for(let t of this.wrappers){let n=e.lastChild;if(t.from<this.pos&&n instanceof Pp&&n.wrapper.eq(t.wrapper))e=n;else{let n=Pp.of(t.wrapper,this.cache.find(Pp,e=>e.wrapper.eq(t.wrapper))?.dom);e.append(n),e=n}}return e}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),n=this.cache.find(Vp,void 0,1);return n&&(n.flags=t),n||new Vp(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}},Gp=class{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:t,lineBreak:n,done:r}=this.cursor.next(this.skipCount);if(this.skipCount=0,r)throw Error(`Ran out of text content when drawing inline views`);this.text=t;let i=this.textOff=Math.min(e,t.length);return n?null:t.slice(0,i)}let t=Math.min(this.text.length,this.textOff+e),n=this.text.slice(this.textOff,t);return this.textOff=t,n}},Kp=[Bp,Fp,zp,Rp,Vp,Pp,Np];for(let e=0;e<Kp.length;e++)Kp[e].bucket=e;var qp=class{constructor(e){this.view=e,this.buckets=Kp.map(()=>[]),this.index=Kp.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,n=this.buckets[t];n.length<6?n.push(e):n[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,n=2){let r=e.bucket,i=this.buckets[r],a=this.index[r];for(let e=0;e<i.length;e++){let o=(e+a)%i.length,s=i[o];if((!t||t(s))&&!this.reused.has(s))return i.splice(o,1),o<a&&this.index[r]--,this.reused.set(s,n),s}return null}findWidget(e,t,n){let r=this.buckets[0];if(r.length)for(let i=0,a=0;;i++){if(i==r.length){if(a)return null;a=1,i=0}let o=r[i];if(!this.reused.has(o)&&(a==0?o.widget.compare(e):o.widget.constructor==e.constructor&&e.updateDOM(o.dom,this.view,o.widget)))return r.splice(i,1),i<this.index[0]&&this.index[0]--,o.widget==e&&o.length==t&&(o.flags&497)==n?(this.reused.set(o,1),o):(this.reused.set(o,2),new Bp(o.dom,t,e,o.flags&-498|n))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}},Jp=class{constructor(e,t,n,r,i){this.view=e,this.decorations=r,this.disallowBlockEffectsFor=i,this.openWidget=!1,this.openMarks=0,this.cache=new qp(e),this.text=new Gp(e.state.doc),this.builder=new Wp(this.cache,new Np(e,e.contentDOM),Uu.iter(n)),this.cache.reused.set(t,2),this.old=new Hp(t),this.reuseWalker={skip:(e,t,n)=>{if(this.cache.add(e),e.isComposite())return!1},enter:e=>this.cache.add(e),leave:()=>{},break:()=>{}}}run(e,t){let n=t&&this.getCompositionContext(t.text);for(let r=0,i=0,a=0;;){let o=a<e.length?e[a++]:null,s=o?o.fromA:this.old.root.length;if(s>r){let e=s-r;this.preserve(e,!a,!o),r=s,i+=e}if(!o)break;t&&o.fromA<=t.range.fromA&&o.toA>=t.range.toA?(this.forward(o.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(i,t.range.fromB),this.builder.flushBuffer(),this.cache.clear(),this.builder.addComposition(t,n),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,o.toA),this.emit(t.range.toB,o.toB)):(this.forward(o.fromA,o.toA),this.emit(i,o.toB)),i=o.toB,r=o.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,n){let r=$p(this.old),i=this.openMarks;this.old.advance(e,n?1:-1,{skip:(e,t,n)=>{if(e.isWidget()){if(this.openWidget)this.builder.continueWidget(n-t);else{let a=n>0||t<e.length?Bp.of(e.widget,this.view,n-t,e.flags&496,this.cache.maybeReuse(e)):this.cache.reuse(e);a.flags&256?(a.flags&=-2,this.builder.addBlockWidget(a)):(this.builder.ensureLine(null),this.builder.addInlineWidget(a,r,i),i=r.length)}}else if(e.isText())this.builder.ensureLine(null),!t&&n==e.length&&!this.cache.reused.has(e)?this.builder.addText(e.text,r,i,this.cache.reuse(e)):(this.cache.add(e),this.builder.addText(e.text.slice(t,n),r,i)),i=r.length;else if(e.isLine())e.flags&=-2,this.cache.reused.set(e,1),this.builder.addLine(e);else if(e instanceof Vp)this.cache.add(e);else if(e instanceof Rp)this.builder.ensureLine(null),this.builder.addMark(e,r,i),this.cache.reused.set(e,1),i=r.length;else return!1;this.openWidget=!1},enter:e=>{e.isLine()?this.builder.addLineStart(e.attrs,this.cache.maybeReuse(e)):(this.cache.add(e),e instanceof Rp&&r.unshift(e.mark)),this.openWidget=!1},leave:e=>{e.isLine()?r.length&&=i=0:e instanceof Rp&&(r.shift(),i=Math.min(i,r.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let n=null,r=this.builder,i=-1,a=Uu.spans(this.decorations,e,t,{point:(e,t,a,o,s,c)=>{if(a instanceof Ud){if(this.disallowBlockEffectsFor[c]){if(a.block)throw RangeError(`Block decorations may not be specified via plugins`);if(t>this.view.state.doc.lineAt(e).to)throw RangeError(`Decorations that replace line breaks may not be specified via plugins`)}if(i=o.length,s>o.length)r.continueWidget(t-e);else{let i=a.widget||(a.block?tm.block:tm.inline),c=Xp(a),l=this.cache.findWidget(i,t-e,c)||Bp.of(i,this.view,t-e,c);a.block?(a.startSide>0&&r.addLineStartIfNotCovered(n),r.addBlockWidget(l)):(r.ensureLine(n),r.addInlineWidget(l,o,s))}n=null}else n=Qp(n,a);t>e&&this.text.skip(t-e)},span:(e,t,a,o)=>{for(let i=e;i<t;){let s=this.text.next(Math.min(512,t-i));s==null?(r.addLineStartIfNotCovered(n),r.addBreak(),i++):(r.ensureLine(n),r.addText(s,a,i==e?o:a.length),i+=s.length),n=null}i=a.length}});i>-1&&(this.openWidget=a>i),this.openWidget||r.addLineStartIfNotCovered(n),this.openMarks=a}forward(e,t,n=1){t-e<=10?this.old.advance(t-e,n,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,n,this.reuseWalker))}getCompositionContext(e){let t=[],n=null;for(let r=e.parentNode;;r=r.parentNode){let e=Ap.get(r);if(r==this.view.contentDOM)break;e instanceof Rp?t.push(e):e?.isLine()?n=e:e instanceof Pp||(r.nodeName==`DIV`&&!n?n=new Fp(r,Zp):n||t.push(Rp.of(new Vd({tagName:r.nodeName.toLowerCase(),attributes:Ld(r)}),r)))}return n?{line:n,marks:t}:null}};function Yp(e,t){let n=e=>{for(let r of e.children)if((t?r.isText():r.length)||n(r))return!0;return!1};return n(e)}function Xp(e){let t=e.isReplace?(e.startSide<0?64:0)|(e.endSide>0?128:0):e.startSide>0?32:16;return e.block&&(t|=256),t}var Zp={class:`cm-line`};function Qp(e,t){let n=t.spec.attributes,r=t.spec.class;return!n&&!r||(e||={class:`cm-line`},n&&Md(n,e),r&&(e.class+=` `+r)),e}function $p(e){let t=[];for(let n=e.parents.length;n>1;n--){let r=n==e.parents.length?e.tile:e.parents[n].tile;r instanceof Rp&&t.push(r.mark)}return t}function em(e){let t=Ap.get(e);return t&&t.setDOM(e.cloneNode()),e}var tm=class extends Rd{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}};tm.inline=new tm(`span`),tm.block=new tm(`div`);var nm=new class extends Rd{toDOM(){return document.createElement(`br`)}get isHidden(){return!0}get editable(){return!0}},rm=class{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=Bd.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 Np(e,e.contentDOM),this.updateInner([new Dp(0,0,0,e.state.doc.length)],null)}update(e){let t=e.changedRanges;this.minWidth>0&&t.length&&(t.every(({fromA:e,toA:t})=>t<this.minWidthFrom||e>this.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 n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(this.domChanged?.newSel?n=this.domChanged.newSel.head:!mm(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let r=n>-1?sm(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){let{from:n,to:r}=this.hasComposition;t=new Dp(n,r,e.changes.mapPos(n,-1),e.changes.mapPos(r,1)).addToSet(t.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(q.ie||q.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,a=this.blockWrappers;this.updateDeco();let o=um(i,this.decorations,e.changes);o.length&&(t=Dp.extendWithRanges(t,o));let s=fm(a,this.blockWrappers,e.changes);return s.length&&(t=Dp.extendWithRanges(t,s)),r&&!t.some(e=>e.fromA<=r.range.fromA&&e.toA>=r.range.toA)&&(t=r.range.addToSet(t.slice())),this.tile.flags&2&&t.length==0?!1:(this.updateInner(t,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:n}=this.view;n.ignore(()=>{if(t||e.length){let n=this.tile,r=new Jp(this.view,n,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&Ap.get(t.text)&&r.cache.reused.set(Ap.get(t.text),2),this.tile=r.run(e,t),im(n,r.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 r=q.chrome||q.ios?{node:n.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),r&&(r.written||n.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node))&&(this.forceSelection=!0),this.tile.dom.style.height=``});let r=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let e of this.tile.children)e.isWidget()&&e.widget instanceof hm&&r.push(e.dom);n.updateGaps(r)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(cp)&&(this.editContextFormatting=e.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:n}=this.tile,r=this.view.root.activeElement,i=r==n,a=!i&&!(this.view.state.facet(up)||n.tabIndex>-1)&&Qd(n,this.view.observer.selectionRange)&&!(r&&n.contains(r));if(!(i||t||a))return;let o=this.forceSelection;this.forceSelection=!1;let s=this.view.state.selection.main,c,l;if(s.empty?l=c=this.inlineDOMNearPos(s.anchor,s.assoc||1):(l=this.inlineDOMNearPos(s.head,s.head==s.from?1:-1),c=this.inlineDOMNearPos(s.anchor,s.anchor==s.from?1:-1)),q.gecko&&s.empty&&!this.hasComposition&&am(c)){let e=document.createTextNode(``);this.view.observer.ignore(()=>c.node.insertBefore(e,c.node.childNodes[c.offset]||null)),c=l=new wf(e,0),o=!0}let u=this.view.observer.selectionRange;!o&&u.focusNode&&(ef(c.node,c.offset,u.anchorNode,u.anchorOffset)&&ef(l.node,l.offset,u.focusNode,u.focusOffset)||this.suppressWidgetCursorChange(u,s))||(this.view.observer.ignore(()=>{q.android&&q.chrome&&n.contains(u.focusNode)&&pm(u.focusNode,n)&&(n.blur(),n.focus({preventScroll:!0}));let e=Xd(this.view.root);if(e){if(s.empty){if(q.gecko){let e=cm(c.node,c.offset);if(e&&e!=3){let t=(e==1?Sf:Cf)(c.node,c.offset);t&&(c=new wf(t.node,t.offset))}}e.collapse(c.node,c.offset),s.bidiLevel!=null&&e.caretBidiLevel!==void 0&&(e.caretBidiLevel=s.bidiLevel)}else if(e.extend){e.collapse(c.node,c.offset);try{e.extend(l.node,l.offset)}catch{}}else{let t=document.createRange();s.anchor>s.head&&([c,l]=[l,c]),t.setEnd(l.node,l.offset),t.setStart(c.node,c.offset),e.removeAllRanges(),e.addRange(t)}}a&&this.view.root.activeElement==n&&(n.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(c,l)),this.impreciseAnchor=c.precise?null:new wf(u.anchorNode,u.anchorOffset),this.impreciseHead=l.precise?null:new wf(u.focusNode,u.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&ef(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,n=Xd(e.root),{anchorNode:r,anchorOffset:i}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let a=this.lineAt(t.head,t.assoc);if(!a)return;let o=a.posAtStart;if(t.head==o||t.head==o+a.length)return;let s=this.coordsAt(t.head,-1),c=this.coordsAt(t.head,1);if(!s||!c||s.bottom>c.top)return;let l=this.domAtPos(t.head+t.assoc,t.assoc);n.collapse(l.node,l.offset),n.modify(`move`,t.assoc<0?`forward`:`backward`,`lineboundary`),e.observer.readSelectionRange();let u=e.observer.selectionRange;e.docView.posFromDOM(u.anchorNode,u.anchorOffset)!=t.from&&n.collapse(r,i)}posFromDOM(e,t){let n=this.tile.nearest(e);if(!n)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let r=n.posAtStart;if(n.isComposite()){let i;if(e==n.dom)i=n.dom.childNodes[t];else{let r=af(e)==0?0:t==0?-1:1;for(;;){let t=e.parentNode;if(t==n.dom)break;r==0&&t.firstChild!=t.lastChild&&(r=e==t.firstChild?-1:1),e=t}i=r<0?e:e.nextSibling}if(i==n.dom.firstChild)return r;for(;i&&!Ap.get(i);)i=i.nextSibling;if(!i)return r+n.length;for(let e=0,t=r;;e++){let r=n.children[e];if(r.dom==i)return t;t+=r.length+r.breakAfter}}else if(n.isText())return e==n.dom?r+t:r+(t?n.length:0);else return r}domAtPos(e,t){let{tile:n,offset:r}=this.tile.resolveBlock(e,t);return n.isWidget()?n.domPosFor(r,t):n.domIn(r,t)}inlineDOMNearPos(e,t){let n,r=-1,i=!1,a,o=-1,s=!1;return this.tile.blockTiles((t,c)=>{if(t.isWidget()){if(t.flags&32&&c>=e)return!0;t.flags&16&&(i=!0)}else{let l=c+t.length;if(c<=e&&(n=t,r=e-c,i=l<e),l>=e&&!a&&(a=t,o=e-c,s=c>e),c>e&&a)return!0}}),!n&&!a?this.domAtPos(e,t):(i&&a?n=null:s&&n&&(a=null),n&&t<0||!a?n.domIn(r,t):a.domIn(o,t))}coordsAt(e,t,n){let{tile:r,offset:i}=this.tile.resolveBlock(e,t);return r.isWidget()?r.widget instanceof hm?null:r.coordsInWidget(i,t,!0):r.coordsIn(i,t,n)}lineAt(e,t){let{tile:n}=this.tile.resolveBlock(e,t);return n.isLine()?n:null}coordsForChar(e){let{tile:t,offset:n}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function r(e,t){if(e.isComposite())for(let n of e.children){if(n.length>=t){let e=r(n,t);if(e)return e}if(t-=n.length,t<0)break}else if(e.isText()&&t<e.length){let n=kl(e.text,t);if(n==t)return null;let r=_f(e.dom,t,n).getClientRects();for(let e=0;e<r.length;e++){let t=r[e];if(e==r.length-1||t.top<t.bottom&&t.left<t.right)return t}}return null}return r(t,n)}measureVisibleLineHeights(e){let t=[],{from:n,to:r}=e,i=this.view.contentDOM.clientWidth,a=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,s=this.view.textDirection==Tf.LTR,c=0,l=(e,u,d)=>{for(let f=0;f<e.children.length&&!(u>r);f++){let r=e.children[f],p=u+r.length,m=r.dom.getBoundingClientRect(),{height:h}=m;if(d&&!f&&(c+=m.top-d.top),r instanceof Pp)p>n&&l(r,u,m);else if(u>=n&&(c>0&&t.push(-c),t.push(h+c),c=0,a)){let e=r.dom.lastChild,t=e?$d(e):[];if(t.length){let e=t[t.length-1],n=s?e.right-m.left:m.right-e.left;n>o&&(o=n,this.minWidth=i,this.minWidthFrom=u,this.minWidthTo=p)}}d&&f==e.children.length-1&&(c+=d.bottom-m.bottom),u=p+r.breakAfter}};return l(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction==`rtl`?Tf.RTL:Tf.LTR}measureTextSize(){let e=this.tile.blockTiles(e=>{if(e.isLine()&&e.children.length&&e.length<=20){let t=0,n;for(let r of e.children){if(!r.isText()||/[^ -~]/.test(r.text))return;let e=$d(r.dom);if(e.length!=1)return;t+=e[0].width,n=e[0].height}if(t)return{lineHeight:e.dom.getBoundingClientRect().height,charWidth:t/e.length,textHeight:n}}});if(e)return e;let t=document.createElement(`div`),n,r,i;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 e=$d(t.firstChild)[0];n=t.getBoundingClientRect().height,r=e&&e.width?e.width/27:7,i=e&&e.height?e.height:n,t.remove()}),{lineHeight:n,charWidth:r,textHeight:i}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let n=0,r=0;;r++){let i=r==t.viewports.length?null:t.viewports[r],a=i?i.from-1:this.view.state.doc.length;if(a>n){let r=(t.lineBlockAt(a).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(Bd.replace({widget:new hm(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,a))}if(!i)break;n=i.to+1}return Bd.set(e)}updateDeco(){let e=1,t=this.view.state.facet(_p).map(t=>(this.dynamicDecorationMap[e++]=typeof t==`function`)?t(this.view):t),n=!1,r=this.view.state.facet(yp).map((e,t)=>{let r=typeof e==`function`;return r&&(n=!0),r?e(this.view):e});for(r.length&&(this.dynamicDecorationMap[e++]=n,t.push(Uu.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(vp).map(e=>typeof e==`function`?e(this.view):e)}scrollIntoView(e){if(e.isSnapshot){let t=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=t.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let t of this.view.state.facet(ap))try{if(t(this.view,e.range,e))return!0}catch(e){lp(this.view.state,e,`scroll handler`)}let{range:t}=e,n=this.coordsAt(t.head,t.assoc||(t.head>t.anchor?-1:1)),r;if(!n)return;!t.empty&&(r=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(n={left:Math.min(n.left,r.left),top:Math.min(n.top,r.top),right:Math.max(n.right,r.right),bottom:Math.max(n.bottom,r.bottom)});let i=Tp(this.view),a={left:n.left-i.left,top:n.top-i.top,right:n.right+i.right,bottom:n.bottom+i.bottom},{offsetWidth:o,offsetHeight:s}=this.view.scrollDOM;if(lf(this.view.scrollDOM,a,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,o),-o),Math.max(Math.min(e.yMargin,s),-s),this.view.textDirection==Tf.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(n.top>window.visualViewport.offsetTop+window.visualViewport.height||n.bottom<window.visualViewport.offsetTop)){let e=this.view.docView.lineAt(t.head,1);if(e){let t=ff(e.dom);e.dom.scrollIntoView({block:`nearest`}),pf(t,!1)}}}lineHasWidget(e){let t=e=>e.isWidget()||e.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){im(this.tile)}};function im(e,t){let n=t?.get(e);if(n!=1){n??e.destroy();for(let n of e.children)im(n,t)}}function am(e){return Jd(e.node)&&e.node.firstChild&&(e.offset==0||e.node.childNodes[e.offset-1].contentEditable==`false`)&&(e.offset==e.node.childNodes.length||e.node.childNodes[e.offset].contentEditable==`false`)}function om(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=Sf(n.focusNode,n.focusOffset),i=Cf(n.focusNode,n.focusOffset),a=r||i;if(i&&r&&i.node!=r.node){let t=Ap.get(i.node);if(!t||t.isText()&&t.text!=i.node.nodeValue)a=i;else if(e.docView.lastCompositionAfterCursor){let e=Ap.get(r.node);!e||e.isText()&&e.text!=r.node.nodeValue||(a=i)}}if(e.docView.lastCompositionAfterCursor=a!=r,!a)return null;let o=t-a.offset;return{from:o,to:o+a.node.nodeValue.length,node:a.node}}function sm(e,t,n){let r=om(e,n);if(!r)return null;let{node:i,from:a,to:o}=r,s=i.nodeValue;if(/[\n\r]/.test(s)||e.state.doc.sliceString(r.from,r.to)!=s)return null;let c=t.invertedDesc;return{range:new Dp(c.mapPos(a),c.mapPos(o),a,o),text:i}}function cm(e,t){return Jd(e)?(t&&e.childNodes[t-1].contentEditable==`false`?1:0)|(t<e.childNodes.length&&e.childNodes[t].contentEditable==`false`?2:0):0}var lm=class{constructor(){this.changes=[]}compareRange(e,t){Kd(e,t,this.changes)}comparePoint(e,t){Kd(e,t,this.changes)}boundChange(e){Kd(e,e,this.changes)}};function um(e,t,n){let r=new lm;return Uu.compare(e,t,n,r),r.changes}var dm=class{constructor(){this.changes=[]}compareRange(e,t){Kd(e,t,this.changes)}comparePoint(){}boundChange(e){Kd(e,e,this.changes)}};function fm(e,t,n){let r=new dm;return Uu.compare(e,t,n,r),r.changes}function pm(e,t){for(let n=e;n&&n!=t;n=n.assignedSlot||n.parentNode)if(Jd(n)&&n.contentEditable==`false`)return!0;return!1}function mm(e,t){let n=!1;return t&&e.iterChangedRanges((e,r)=>{e<t.to&&r>t.from&&(n=!0)}),n}var hm=class extends Rd{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 gm(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),a=t-i.from;if(i.length==0)return G.cursor(t);a==0?n=1:a==i.length&&(n=-1);let o=a,s=a;n<0?o=kl(i.text,a,!1):s=kl(i.text,a);let c=r(i.text.slice(o,s));for(;o>0;){let e=kl(i.text,o,!1);if(r(i.text.slice(e,o))!=c)break;o=e}for(;s<i.length;){let e=kl(i.text,s);if(r(i.text.slice(s,e))!=c)break;s=e}return G.undirectionalRange(o+i.from,s+i.from)}function _m(e,t,n,r,i){let a=Math.round((r-t.left)*e.defaultCharacterWidth);if(e.lineWrapping&&n.height>e.defaultLineHeight*1.5){let t=e.viewState.heightOracle.textHeight,r=Math.floor((i-n.top-(e.defaultLineHeight-t)*.5)/t);a+=r*e.viewState.heightOracle.lineLength}let o=e.state.sliceDoc(n.from,n.to);return n.from+id(o,a,e.state.tabSize)}function vm(e,t,n){let r=e.lineBlockAt(t);if(Array.isArray(r.type)){let e;for(let i of r.type){if(i.from>t)break;if(!(i.to<t)){if(i.from<t&&i.to>t)return i;(!e||i.type==zd.Text&&(e.type!=i.type||(n<0?i.from<t:i.to>t)))&&(e=i)}}return e||r}return r}function ym(e,t,n,r){let i=vm(e,t.head,t.assoc||-1),a=!r||i.type!=zd.Text||!(e.lineWrapping||i.widgetLineBreaks)?null:e.coordsAtPos(t.assoc<0&&t.head>i.from?t.head-1:t.head);if(a){let t=e.dom.getBoundingClientRect(),r=e.textDirectionAt(i.from),o=e.posAndSideAtCoords({x:n==(r==Tf.LTR)?t.right-1:t.left+1,y:(a.top+a.bottom)/2});if(o)return G.cursor(o.pos,o.assoc)}return G.cursor(n?i.to:i.from,n?1:-1)}function bm(e,t,n,r){let i=e.state.doc.lineAt(t.head),a=e.bidiSpans(i),o=e.textDirectionAt(i.from);for(let s=t,c=null;;){let t=Kf(i,a,o,s,n),l=Gf;if(!t){if(i.number==(n?e.state.doc.lines:1))return s;l=`
9
+ `,i=e.state.doc.line(i.number+(n?1:-1)),a=e.bidiSpans(i),t=n?G.cursor(i.from,-1):G.cursor(i.to,1)}if(!c){if(!r)return t;c=r(l)}else if(!c(l))return s;s=t}}function xm(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return e=>{let t=r(e);return i==ju.Space&&(i=t),i==t}}function Sm(e,t,n,r){let i=t.head,a=n?1:-1;if(i==(n?e.state.doc.length:0))return G.cursor(i,t.assoc);let o=t.goalColumn,s,c=e.contentDOM.getBoundingClientRect(),l=e.coordsAtPos(i,t.assoc||((t.empty?n:t.head==t.from)?1:-1)),u=e.documentTop;if(l)o??=l.left-c.left,s=a<0?l.top:l.bottom;else{let t=e.viewState.lineBlockAt(i);o??=Math.min(c.right-c.left,e.defaultCharacterWidth*(i-t.from)),s=(a<0?t.top:t.bottom)+u}let d=c.left+o,f=e.viewState.heightOracle.textHeight>>1,p=r??f;for(let t=0;;t+=f){let r=s+(p+t)*a,i=Dm(e,{x:d,y:r},!1,a);if(n?r>c.bottom:r<c.top)return G.cursor(i.pos,i.assoc);let l=e.coordsAtPos(i.pos,i.assoc),u=l?(l.top+l.bottom)/2:0;if(!l||(n?u>s:u<s))return G.cursor(i.pos,i.assoc,void 0,o)}}function Cm(e,t,n){for(;;){let r=0;for(let i of e)i.between(t-1,t+1,(e,i,a)=>{if(t>e&&t<i){let a=r||n||(t-e<i-t?-1:1);t=a<0?e:i,r=a}});if(!r)return t}}function wm(e,t){let n=null;for(let r=0;r<t.ranges.length;r++){let i=t.ranges[r],a=null;if(i.empty){let t=Cm(e,i.from,0);t!=i.from&&(a=G.cursor(t,-1))}else{let t=Cm(e,i.from,-1),n=Cm(e,i.to,1);(t!=i.from||n!=i.to)&&(a=i.undirectional?G.undirectionalRange(i.from,i.to):G.range(i.from==i.anchor?t:n,i.from==i.head?t:n))}a&&(n||=t.ranges.slice(),n[r]=a)}return n?G.create(n,t.mainIndex):t}function Tm(e,t,n){let r=Cm(e.state.facet(bp).map(t=>t(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:G.cursor(r,r<n.from?1:-1)}var Em=class{constructor(e,t){this.pos=e,this.assoc=t}};function Dm(e,t,n,r){let i=e.contentDOM.getBoundingClientRect(),a=i.top+e.viewState.paddingTop,{x:o,y:s}=t,c=s-a,l;for(;;){if(c<0)return new Em(0,1);if(c>e.viewState.docHeight)return new Em(e.state.doc.length,-1);if(l=e.elementAtHeight(c),r==null)break;if(l.type==zd.Text){if(r<0?l.to<e.viewport.from:l.from>e.viewport.to)break;let t=e.docView.coordsAt(r<0?l.from:l.to,r>0?-1:1);if(t&&(r<0?t.top<=c+a:t.bottom>=c+a))break}let t=e.viewState.heightOracle.textHeight/2;c=r>0?l.bottom+t:l.top-t}if(e.viewport.from>=l.to||e.viewport.to<=l.from){if(n)return null;if(l.type==zd.Text){let t=_m(e,i,l,o,s);return new Em(t,t==l.from?1:-1)}}if(l.type!=zd.Text)return c<(l.top+l.bottom)/2?new Em(l.from,1):new Em(l.to,-1);let u=e.docView.lineAt(l.from,2);return u&&u.length==l.length||(u=e.docView.lineAt(l.from,-2)),new Om(e,o,s,e.textDirectionAt(l.from)).scanTile(u,l.from)}var Om=class{constructor(e,t,n,r){this.view=e,this.x=t,this.y=n,this.baseDir=r,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[Ff.find(r,e-n.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:n,spans:r}=this.bidiSpansAt(e);return r[Ff.find(r,e-n.from,-1,t)].dir}bidiIn(e,t){let{spans:n,line:r}=this.bidiSpansAt(e);return n.length>1||n.length&&(n[0].level!=this.baseDir||n[0].to+r.from<t)}scan(e,t,n=!1){let r=0,i=e.length-1,a=new Set,o=this.bidiIn(e[0],e[i]),s,c,l=-1,u=1e9,d;search:for(;r<i;){let n=i-r,f=r+i>>1;adjust:if(a.has(f)){for(let e=1;e<n;e++){let t=f+e;if(t>=i&&(t-=n),!a.has(t)){f=t;break adjust}}break search}a.add(f);let p=t(f),m=0;if(p)for(let e=0;e<p.length;e++){let t=p[e];if(!(t.width==0&&p.length>1)){if(t.bottom<this.y)(!s||s.bottom<t.bottom)&&(s=t),m=1;else if(t.top>this.y)(!c||c.top>t.top)&&(c=t),m=-1;else{let e=t.left>this.x?this.x-t.left:t.right<this.x?this.x-t.right:0,n=Math.abs(e);n<u&&(l=f,u=n,d=t),e&&(m=e<0==(this.baseDir==Tf.LTR)?-1:1)}}}m==-1&&(!o||this.baseDirAt(e[f],1))?i=f:m==1&&(!o||this.baseDirAt(e[f+1],-1))&&(r=f+1)}if(!d){if(!c&&!s)return{i:0,after:!1};let n=s&&(!c||this.y-s.bottom<c.top-this.y)?s:c;return this.y=(n.top+n.bottom)/2,this.scan(e,t,!0)}if(u&&!n){let{top:n,bottom:r}=d;if(s&&s.bottom>(n+n+r)/3)return this.y=s.bottom-1,this.scan(e,t,!0);if(c&&c.top<(n+r+r)/3)return this.y=c.top+1,this.scan(e,t,!0)}let f=(o?this.dirAt(e[l],1):this.baseDir)==Tf.LTR;return{i:l,after:this.x>(d.left+d.right)/2==f}}scanText(e,t){let n=[];for(let r=0;r<e.length;r=kl(e.text,r))n.push(t+r);n.push(t+e.length);let r=this.scan(n,r=>{let i=n[r]-t,a=n[r+1]-t;return _f(e.dom,i,a).getClientRects()});return r.after?new Em(n[r.i+1],-1):new Em(n[r.i],1)}scanTile(e,t){if(!e.length)return new Em(t,1);if(e.children.length==1){let n=e.children[0];if(n.isText())return this.scanText(n,t);if(n.isComposite())return this.scanTile(n,t)}let n=[t];for(let r=0,i=t;r<e.children.length;r++)n.push(i+=e.children[r].length);let r=this.scan(n,t=>{let n=e.children[t];return n.flags&48?null:(Jd(n.dom)?n.dom:_f(n.dom,0,n.length)).getClientRects()}),i=e.children[r.i],a=n[r.i];return i.isText()?this.scanText(i,a):i.isComposite()?this.scanTile(i,a):r.after?new Em(n[r.i+1],-1):new Em(a,1)}},km=`￿`,Am=class{constructor(e,t){this.points=e,this.view=t,this.text=``,this.lineSeparator=t.state.facet(Iu.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=km}readRange(e,t){if(!e)return this;let n=e.parentNode;for(let r=e;;){this.findPointBefore(n,r);let e=this.text.length;this.readNode(r);let i=Ap.get(r),a=r.nextSibling;if(a==t){i?.breakAfter&&!a&&n!=this.view.contentDOM&&this.lineBreak();break}let o=Ap.get(a);(i&&o?i.breakAfter:(i?i.breakAfter:nf(r))||nf(a)&&(r.nodeName!=`BR`||i?.isWidget())&&this.text.length>e)&&!Mm(a,t)&&this.lineBreak(),r=a}return this.findPointBefore(n,t),this}readTextNode(e){let t=e.nodeValue;for(let n of this.points)n.node==e&&(n.pos=this.text.length+Math.min(n.offset,t.length));for(let n=0,r=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,a=1,o;if(this.lineSeparator?(i=t.indexOf(this.lineSeparator,n),a=this.lineSeparator.length):(o=r.exec(t))&&(i=o.index,a=o[0].length),this.append(t.slice(n,i<0?t.length:i)),i<0)break;if(this.lineBreak(),a>1)for(let t of this.points)t.node==e&&t.pos>this.text.length&&(t.pos-=a-1);n=i+a}}readNode(e){let t=Ap.get(e),n=t&&t.overrideDOMText;if(n!=null){this.findPointInside(e,n.length);for(let e=n.iter();!e.next().done;)e.lineBreak?this.lineBreak():this.append(e.value)}else Yd(e)?this.readTextNode(e):e.nodeName==`BR`?e.nextSibling&&this.lineBreak():Jd(e)&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let n of this.points)n.node==e&&e.childNodes[n.offset]==t&&(n.pos=this.text.length)}findPointInside(e,t){for(let n of this.points)(Yd(e)?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(jm(e,n.node,n.offset)?t:0))}};function jm(e,t,n){for(;;){if(!t||n<af(t))return!1;if(t==e)return!0;n=tf(t)+1,t=t.parentNode}}function Mm(e,t){let n;for(;e!=t&&e;e=e.nextSibling){let t=Ap.get(e);if(!t?.isWidget())return!1;t&&(n||=[]).push(t)}if(n){for(let e of n)if(e.overrideDOMText?.length)return!1}return!0}var Nm=class{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}},Pm=class{constructor(e,t,n,r){this.typeOver=r,this.bounds=null,this.text=``,this.domChanged=t>-1;let{impreciseHead:i,impreciseAnchor:a}=e.docView,o=e.state.selection;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=Fm(e.docView.tile,t,n,0))){let t=i||a?[]:Bm(e),n=new Am(t,e);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=Vm(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!Zd(e.contentDOM,t.focusNode)?o.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=a&&a.node==t.anchorNode&&a.offset==t.anchorOffset||!Zd(e.contentDOM,t.anchorNode)?o.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),s=e.viewport;if((q.ios||q.chrome)&&n!=r&&Math.min(n,r)<=o.main.from&&Math.max(n,r)>=o.main.to&&(s.from>0||s.to<e.state.doc.length)){let t=Math.min(n,r),i=Math.max(n,r),a=s.from-t,o=s.to-i;a!=0&&a!=1&&t!=0||o!=0&&o!=-1&&i!=e.state.doc.length||(n=0,r=e.state.doc.length)}if(e.inputState.composing>-1&&o.ranges.length>1)this.newSel=o.replaceRange(G.range(r,n));else if(e.lineWrapping&&r==n&&!(o.main.empty&&o.main.head==n)&&e.inputState.lastTouchTime>Date.now()-100){let t=e.coordsAtPos(n,-1),r=0;t&&(r=e.inputState.lastTouchY<=t.bottom?-1:1),this.newSel=G.create([G.cursor(n,r)])}else this.newSel=G.single(r,n)}}};function Fm(e,t,n,r){if(e.isComposite()){let i=-1,a=-1,o=-1,s=-1;for(let c=0,l=r,u=r;c<e.children.length;c++){let r=e.children[c],d=l+r.length;if(l<t&&d>n)return Fm(r,t,n,l);if(d>=t&&i==-1&&(i=c,a=l),l>n&&r.dom.parentNode==e.dom){o=c,s=u;break}u=d,l=d+r.breakAfter}return{from:a,to:s<0?r+e.length:s,startDOM:(i?e.children[i-1].dom.nextSibling:null)||e.dom.firstChild,endDOM:o<e.children.length&&o>=0?e.children[o].dom:null}}return e.isText()?{from:r,to:r+e.length,startDOM:e.dom,endDOM:e.dom.nextSibling}:null}function Im(e,t){let n,{newSel:r}=t,{state:i}=e,a=i.selection.main,o=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:e,to:r}=t.bounds,s=a.from,c=null;(o===8||q.android&&t.text.length<r-e)&&(s=a.to,c=`end`);let l=i.doc.sliceString(e,r,km),u,d;!a.empty&&a.from>=e&&a.to<=r&&(t.typeOver||l!=t.text)&&l.slice(0,a.from-e)==t.text.slice(0,a.from-e)&&l.slice(a.to-e)==t.text.slice(u=t.text.length-(l.length-(a.to-e)))?n={from:a.from,to:a.to,insert:vl.of(t.text.slice(a.from-e,u).split(km))}:(d=zm(l,t.text,s-e,c))&&(q.chrome&&o==13&&d.toB==d.from+2&&t.text.slice(d.from,d.toB)==`￿￿`&&d.toB--,n={from:e+d.from,to:e+d.toA,insert:vl.of(t.text.slice(d.from,d.toB).split(km))})}else r&&(!e.hasFocus&&i.facet(up)||Hm(r,a))&&(r=null);if(!n&&!r)return!1;if((q.mac||q.android)&&n&&n.from==n.to&&n.from==a.head-1&&/^\. ?$/.test(n.insert.toString())&&e.contentDOM.getAttribute(`autocorrect`)==`off`?(r&&n.insert.length==2&&(r=G.single(r.main.anchor-1,r.main.head-1)),n={from:n.from,to:n.to,insert:vl.of([n.insert.toString().replace(`.`,` `)])}):i.doc.lineAt(a.from).to<a.to&&e.docView.lineHasWidget(a.to)&&e.inputState.insertingTextAt>Date.now()-50?n={from:a.from,to:a.to,insert:i.toText(e.inputState.insertingText)}:q.chrome&&n&&n.from==n.to&&n.from==a.head&&n.insert.toString()==`
10
+ `&&e.lineWrapping&&(r&&=G.single(r.main.anchor-1,r.main.head-1),n={from:a.from,to:a.to,insert:vl.of([` `])}),n)return Lm(e,n,r,o);if(r&&!Hm(r,a)){let t=!1,n=`select`;return e.inputState.lastSelectionTime>Date.now()-50&&(e.inputState.lastSelectionOrigin==`select`&&(t=!0),n=e.inputState.lastSelectionOrigin,n==`select.pointer`&&(r=wm(i.facet(bp).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}return!1}function Lm(e,t,n,r=-1){if(q.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(q.android&&(t.to==i.to&&(t.from==i.from||t.from==i.from-1&&e.state.sliceDoc(t.from,i.from)==` `)&&t.insert.length==1&&t.insert.lines==2&&vf(e.contentDOM,`Enter`,13)||(t.from==i.from-1&&t.to==i.to&&t.insert.length==0||r==8&&t.insert.length<t.to-t.from&&t.to>i.head)&&vf(e.contentDOM,`Backspace`,8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&vf(e.contentDOM,`Delete`,46)))return!0;let a=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,s=()=>o||=Rm(e,t,n);return e.state.facet($f).some(n=>n(e,t.from,t.to,a,s))||e.dispatch(s()),!0}function Rm(e,t,n){let r,i=e.state,a=i.selection.main,o=-1;if(t.from==t.to&&t.from<a.from||t.from>a.to){let n=t.from<a.from?-1:1,r=n<0?a.from:a.to,s=Cm(i.facet(bp).map(t=>t(e)),r,n);t.from==s&&(o=s)}if(o>-1)r={changes:t,selection:G.cursor(t.from+t.insert.length,-1)};else if(t.from>=a.from&&t.to<=a.to&&t.to-t.from>=(a.to-a.from)/3&&(!n||n.main.empty&&n.main.from==t.from+t.insert.length)&&e.inputState.composing<0){let n=a.from<t.from?i.sliceDoc(a.from,t.from):``,o=a.to>t.to?i.sliceDoc(t.to,a.to):``;r=i.replaceSelection(e.state.toText(n+t.insert.sliceString(0,void 0,e.state.lineBreak)+o))}else{let o=i.changes(t),s=n&&n.main.to<=o.newLength?n.main:void 0;if(i.selection.ranges.length>1&&(e.inputState.composing>=0||e.inputState.compositionPendingChange)&&t.to<=a.to+10&&t.to>=a.to-10){let c=e.state.sliceDoc(t.from,t.to),l,u=n&&om(e,n.main.head);if(u){let e=t.insert.length-(t.to-t.from);l={from:u.from,to:u.to-e}}else l=e.state.doc.lineAt(a.head);let d=a.to-t.to;r=i.changeByRange(n=>{if(n.from==a.from&&n.to==a.to)return{changes:o,range:s||n.map(o)};let r=n.to-d,u=r-c.length;if(e.state.sliceDoc(u,r)!=c||r>=l.from&&u<=l.to)return{range:n};let f=i.changes({from:u,to:r,insert:t.insert}),p=n.to-a.to;return{changes:f,range:s?G.range(Math.max(0,s.anchor+p),Math.max(0,s.head+p)):n.map(f)}})}else r={changes:o,selection:s&&i.selection.replaceRange(s)}}let s=`input.type`;return(e.composing||e.inputState.compositionPendingChange&&e.inputState.compositionEndedAt>Date.now()-50)&&(e.inputState.compositionPendingChange=!1,s+=`.compose`,e.inputState.compositionFirstChange&&(s+=`.start`,e.inputState.compositionFirstChange=!1)),i.update(r,{userEvent:s,scrollIntoView:!0})}function zm(e,t,n,r){let i=Math.min(e.length,t.length),a=0;for(;a<i&&e.charCodeAt(a)==t.charCodeAt(a);)a++;if(a==i&&e.length==t.length)return null;let o=e.length,s=t.length;for(;o>0&&s>0&&e.charCodeAt(o-1)==t.charCodeAt(s-1);)o--,s--;if(r==`end`){let e=Math.max(0,a-Math.min(o,s));n-=o+e-a}if(o<a&&e.length<t.length){let e=n<=a&&n>=o?a-n:0;a-=e,s=a+(s-o),o=a}else if(s<a){let e=n<=a&&n>=s?a-n:0;a-=e,o=a+(o-s),s=a}return{from:a,toA:o,toB:s}}function Bm(e){let t=[];if(e.root.activeElement!=e.contentDOM)return t;let{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}=e.observer.selectionRange;return n&&(t.push(new Nm(n,r)),(i!=n||a!=r)&&t.push(new Nm(i,a))),t}function Vm(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n<0||r<0?null:n==r?G.create([G.cursor(r+t,-1)]):G.single(n+t,r+t)}function Hm(e,t){return t.head==e.main.head&&t.anchor==e.main.anchor}var Um=class{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,q.safari&&e.contentDOM.addEventListener(`input`,()=>null),q.gecko&&Eh(e.contentDOM.ownerDocument)}handleEvent(e){rh(this.view,e)&&!this.ignoreDuringComposition(e)&&(e.type==`keydown`&&this.keydown(e)||(this.view.updateState==0?this.runHandlers(e.type,e):Promise.resolve().then(()=>this.runHandlers(e.type,e))))}runHandlers(e,t){let n=this.handlers[e];if(n){for(let e of n.observers)e(this.view,t);for(let e of n.handlers){if(t.defaultPrevented)break;if(e(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Km(e),n=this.handlers,r=this.view.contentDOM;for(let e in t)if(e!=`scroll`){let i=!t[e].handlers.length,a=n[e];a&&i!=!a.handlers.length&&(r.removeEventListener(e,this.handleEvent),a=null),a||r.addEventListener(e,this.handleEvent,{passive:i})}for(let e in n)e!=`scroll`&&!t[e]&&r.removeEventListener(e,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&&Ym.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),q.android&&q.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;if(q.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&(qm.some(t=>t.keyCode==e.keyCode)&&!e.ctrlKey||Jm.indexOf(e.key)>-1&&e.ctrlKey)){let t={ctrlKey:e.ctrlKey,altKey:e.altKey,metaKey:e.metaKey,shiftKey:e.shiftKey};t.shiftKey&&q.ios&&!/^(off|none)$/.test(this.view.contentDOM.autocapitalize)&&Wm(this.view.win)&&(t.shiftKey=!1);let n=this.pendingIOSKey={key:e.key,keyCode:e.keyCode,mods:t};return setTimeout(()=>{this.pendingIOSKey==n&&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.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,vf(this.view.contentDOM,t.key,t.keyCode,t.mods))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:q.safari&&!q.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 Wm(e){return e.visualViewport?e.visualViewport.height*e.visualViewport.scale/e.document.documentElement.clientHeight<.85:!1}function Gm(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){lp(n.state,e)}}}function Km(e){let t=Object.create(null);function n(e){return t[e]||(t[e]={observers:[],handlers:[]})}for(let t of e){let e=t.spec,r=e&&e.plugin.domEventHandlers,i=e&&e.plugin.domEventObservers;if(r)for(let e in r){let i=r[e];i&&n(e).handlers.push(Gm(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(Gm(t.value,r))}}for(let e in ih)n(e).handlers.push(ih[e]);for(let e in ah)n(e).observers.push(ah[e]);return t}var qm=[{key:`Backspace`,keyCode:8,inputType:`deleteContentBackward`},{key:`Enter`,keyCode:13,inputType:`insertParagraph`},{key:`Enter`,keyCode:13,inputType:`insertLineBreak`},{key:`Delete`,keyCode:46,inputType:`deleteContentForward`}],Jm=`dthko`,Ym=[16,17,18,20,91,92,224,225],Xm=6;function Zm(e){return Math.max(0,e)*.7+8}function Qm(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}var $m=class{constructor(e,t,n,r){this.view=e,this.startEvent=t,this.style=n,this.mustSelect=r,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=uf(e.contentDOM),this.atoms=e.state.facet(bp).map(t=>t(e));let i=e.contentDOM.ownerDocument;i.addEventListener(`mousemove`,this.move=this.move.bind(this)),i.addEventListener(`mouseup`,this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(Iu.allowMultipleSelections)&&eh(e,t),this.dragging=nh(e,t)&&hh(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&&Qm(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,n=0,r=0,i=0,a=this.view.win.innerWidth,o=this.view.win.innerHeight;this.scrollParents.x&&({left:r,right:a}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:i,bottom:o}=this.scrollParents.y.getBoundingClientRect());let s=Tp(this.view);e.clientX-s.left<=r+Xm?t=-Zm(r-e.clientX):e.clientX+s.right>=a-Xm&&(t=Zm(e.clientX-a)),e.clientY-s.top<=i+Xm?n=-Zm(i-e.clientY):e.clientY+s.bottom>=o-Xm&&(n=Zm(e.clientY-o)),this.setScrollSpeed(t,n)}up(e){this.dragging??this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener(`mousemove`,this.move),e.removeEventListener(`mouseup`,this.up),this.view.inputState.mouseSelection=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,n=wm(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!n.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:n,userEvent:`select.pointer`}),this.mustSelect=!1}update(e){e.transactions.some(e=>e.isUserEvent(`input.type`))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};function eh(e,t){let n=e.state.facet(Jf);return n.length?n[0](t):q.mac?t.metaKey:t.ctrlKey}function th(e,t){let n=e.state.facet(Yf);return n.length?n[0](t):q.mac?!t.altKey:!t.ctrlKey}function nh(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=Xd(e.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let e=0;e<i.length;e++){let n=i[e];if(n.left<=t.clientX&&n.right>=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}function rh(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target,r;n!=e.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=Ap.get(n))&&r.isWidget()&&!r.isHidden&&r.widget.ignoreEvent(t))return!1;return!0}var ih=Object.create(null),ah=Object.create(null),oh=q.ie&&q.ie_version<15||q.ios&&q.webkit_version<604;function sh(e){let t=e.dom.parentNode;if(!t)return;let n=t.appendChild(document.createElement(`textarea`));n.style.cssText=`position: fixed; left: -10000px; top: 10px`,n.focus(),setTimeout(()=>{e.focus(),n.remove(),lh(e,n.value)},50)}function ch(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function lh(e,t){t=ch(e.state,tp,t);let{state:n}=e,r,i=1,a=n.toText(t),o=a.lines==n.selection.ranges.length;if(xh!=null&&n.selection.ranges.every(e=>e.empty)&&xh==a.toString()){let e=-1;r=n.changeByRange(r=>{let s=n.doc.lineAt(r.from);if(s.from==e)return{range:r};e=s.from;let c=n.toText((o?a.line(i++).text:t)+n.lineBreak);return{changes:{from:s.from,insert:c},range:G.cursor(r.from+c.length,-1)}})}else r=o?n.changeByRange(e=>{let t=a.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:G.cursor(e.from+t.length,-1)}}):n.replaceSelection(a);e.dispatch(r,{userEvent:`input.paste`,scrollIntoView:!0})}ah.scroll=e=>{let t=e.inputState;t.lastScrollTop=e.scrollDOM.scrollTop,t.lastScrollLeft=e.scrollDOM.scrollLeft,q.ios&&!t.touchActive&&(t.lastIOSMomentumScroll=Date.now())},ah.wheel=ah.mousewheel=e=>{e.inputState.lastWheelEvent=Date.now()},ih.keydown=(e,t)=>(e.inputState.setSelectionOrigin(`select`),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),ah.touchstart=(e,t)=>{let n=e.inputState,r=t.targetTouches[0];n.touchActive=!0,n.lastTouchTime=Date.now(),r&&(n.lastTouchX=r.clientX,n.lastTouchY=r.clientY),n.setSelectionOrigin(`select.pointer`)},ah.touchmove=e=>{e.inputState.setSelectionOrigin(`select.pointer`)},ah.touchend=(e,t)=>{e.inputState.touchActive=!1},ih.mousedown=(e,t)=>{if(e.observer.flush(),e.inputState.lastTouchTime>Date.now()-2e3)return!1;let n=null;for(let r of e.state.facet(Xf))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=gh(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new $m(e,t,n,r)),r&&e.observer.ignore(()=>{hf(e.contentDOM);let t=e.root.activeElement;t&&!t.contains(e.contentDOM)&&t.blur()});let i=e.inputState.mouseSelection;if(i)return i.start(t),i.dragging===!1}else e.inputState.setSelectionOrigin(`select.pointer`);return!1};function uh(e,t,n,r){if(r==1)return G.cursor(t,n);if(r==2)return gm(e.state,t,n);{let r=e.docView.lineAt(t,n),i=e.state.doc.lineAt(r?r.posAtEnd:t),a=r?r.posAtStart:i.from,o=r?r.posAtEnd:i.to;return o<e.state.doc.length&&o==i.to&&o++,G.undirectionalRange(a,o)}}var dh=q.ie&&q.ie_version<=11,fh=null,ph=0,mh=0;function hh(e){if(!dh)return e.detail;let t=fh,n=mh;return fh=e,mh=Date.now(),ph=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(ph+1)%3:1}function gh(e,t){let n=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),r=hh(t),i=e.state.selection;return{update(e){e.docChanged&&(n.pos=e.changes.mapPos(n.pos),i=i.map(e.changes))},get(t,a,o){let s=e.posAndSideAtCoords({x:t.clientX,y:t.clientY},!1),c,l=uh(e,s.pos,s.assoc,r);if(n.pos!=s.pos&&!a){let t=uh(e,n.pos,n.assoc,r),i=Math.min(t.from,l.from),a=Math.max(t.to,l.to);l=i<l.from?G.range(i,a,l.assoc):G.range(a,i,l.assoc)}return a?i.replaceRange(i.main.extend(l.from,l.to,l.assoc)):o&&r==1&&i.ranges.length>1&&(c=_h(i,s.pos))?c:o?i.addRange(l):G.create([l])}}}function _h(e,t){for(let n=0;n<e.ranges.length;n++){let{from:r,to:i}=e.ranges[n];if(r<=t&&i>=t)return G.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-+(e.mainIndex>n))}return null}ih.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.tile.nearest(t.target);if(r&&r.isWidget()){let e=r.posAtStart,t=e+r.length;(e>=n.to||t<=n.from)&&(n=G.undirectionalRange(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData(`Text`,ch(e.state,np,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed=`copyMove`),!1},ih.dragend=e=>(e.inputState.draggedContent=null,!1);function vh(e,t,n,r){if(n=ch(e.state,tp,n),!n)return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:a}=e.inputState,o=r&&a&&th(e,t)?{from:a.from,to:a.to}:null,s={from:i,insert:n},c=e.state.changes(o?[o,s]:s);e.focus(),e.dispatch({changes:c,selection:{anchor:c.mapPos(i,-1),head:c.mapPos(i,1)},userEvent:o?`move.drop`:`input.drop`}),e.inputState.draggedContent=null}ih.drop=(e,t)=>{if(!t.dataTransfer)return!1;if(e.state.readOnly)return!0;let n=t.dataTransfer.files;if(n&&n.length){let r=Array(n.length),i=0,a=()=>{++i==n.length&&vh(e,t,r.filter(e=>e!=null).join(e.state.lineBreak),!1)};for(let e=0;e<n.length;e++){let t=new FileReader;t.onerror=a,t.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(r[e]=t.result),a()},t.readAsText(n[e])}return!0}{let n=t.dataTransfer.getData(`Text`);if(n)return vh(e,t,n,!0),!0}return!1},ih.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=oh?null:t.clipboardData;return n?(lh(e,n.getData(`text/plain`)||n.getData(`text/uri-list`)),!0):(sh(e),!1)};function yh(e,t){let n=e.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement(`textarea`));r.style.cssText=`position: fixed; left: -10000px; top: 10px`,r.value=t,r.focus(),r.selectionEnd=t.length,r.selectionStart=0,setTimeout(()=>{r.remove(),e.focus()},50)}function bh(e){let t=[],n=[],r=!1;for(let r of e.selection.ranges)r.empty||(t.push(e.sliceDoc(r.from,r.to)),n.push(r));if(!t.length){let i=-1;for(let{from:r}of e.selection.ranges){let a=e.doc.lineAt(r);a.number>i&&(t.push(a.text),n.push({from:a.from,to:Math.min(e.doc.length,a.to+1)})),i=a.number}r=!0}return{text:ch(e,np,t.join(e.lineBreak)),ranges:n,linewise:r}}var xh=null;ih.copy=ih.cut=(e,t)=>{if(!Qd(e.contentDOM,e.observer.selectionRange))return!1;let{text:n,ranges:r,linewise:i}=bh(e.state);if(!n&&!i)return!1;xh=i?n:null,t.type==`cut`&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:`delete.cut`});let a=oh?null:t.clipboardData;return a?(a.clearData(),a.setData(`text/plain`,n),!0):(yh(e,n),!1)};var Sh=vu.define();function Ch(e,t){let n=[];for(let r of e.facet(ep)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:Sh.of(!0)}):null}function wh(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=Ch(e.state,t);n?e.dispatch(n):e.update([])}},10)}ah.focus=e=>{e.inputState.lastFocusTime=Date.now(),!e.scrollDOM.scrollTop&&(e.inputState.lastScrollTop||e.inputState.lastScrollLeft)&&(e.scrollDOM.scrollTop=e.inputState.lastScrollTop,e.scrollDOM.scrollLeft=e.inputState.lastScrollLeft),wh(e)},ah.blur=e=>{e.observer.clearSelectionRange(),wh(e)},ah.compositionstart=ah.compositionupdate=(e,t)=>{if(!e.observer.editContext&&(e.inputState.compositionFirstChange??(e.inputState.compositionFirstChange=!0),e.inputState.composing<0)){let{main:t}=e.state.selection;!t.empty&&e.lineBlockAt(t.from).from!=e.lineBlockAt(t.to).from&&!e.state.readOnly&&e.dispatch({changes:e.state.selection.ranges.filter(e=>!e.empty).map(e=>({from:e.from,to:e.to})),userEvent:`input`}),e.inputState.composing=0}},ah.compositionend=e=>{e.observer.editContext||(e.inputState.composing=-1,e.inputState.compositionEndedAt=Date.now(),e.inputState.compositionPendingKey=!0,e.inputState.compositionPendingChange=e.observer.pendingRecords().length>0,e.inputState.compositionFirstChange=null,q.chrome&&q.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},ah.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},ih.beforeinput=(e,t)=>{if((t.inputType==`insertText`||t.inputType==`insertCompositionText`)&&(e.inputState.insertingText=t.data,e.inputState.insertingTextAt=Date.now()),t.inputType==`insertReplacementText`&&e.observer.editContext){let n=t.dataTransfer?.getData(`text/plain`),r=t.getTargetRanges();if(n&&r.length){let t=r[0];return Lm(e,{from:e.posAtDOM(t.startContainer,t.startOffset),to:e.posAtDOM(t.endContainer,t.endOffset),insert:e.state.toText(n)},null),!0}}let n;if(q.chrome&&q.android&&(n=qm.find(e=>e.inputType==t.inputType))&&(e.observer.delayAndroidKey(n.key,n.keyCode),n.key==`Backspace`||n.key==`Delete`)){let t=window.visualViewport?.height||0;setTimeout(()=>{(window.visualViewport?.height||0)>t+10&&e.hasFocus&&(e.contentDOM.blur(),e.focus())},100)}return q.ios&&t.inputType==`deleteContentForward`&&e.observer.flushSoon(),q.safari&&t.inputType==`insertText`&&e.inputState.composing>=0&&setTimeout(()=>ah.compositionend(e,t),20),!1};var Th=new Set;function Eh(e){Th.has(e)||(Th.add(e),e.addEventListener(`copy`,()=>{}),e.addEventListener(`cut`,()=>{}))}var Dh=[`pre-wrap`,`normal`,`pre-line`,`break-spaces`],Oh=!1;function kh(){Oh=!1}var Ah=class{constructor(e){this.lineWrapping=e,this.doc=vl.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let n=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(n+=Math.max(0,Math.ceil((t-e-n*this.lineLength*.5)/this.lineLength))),this.lineHeight*n}heightForLine(e){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 Dh.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n<e.length;n++){let r=e[n];r<0?n++:this.heightSamples[Math.floor(r*10)]||(t=!0,this.heightSamples[Math.floor(r*10)]=!0)}return t}refresh(e,t,n,r,i,a){let o=Dh.indexOf(e)>-1,s=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=o;if(this.lineWrapping=o,this.lineHeight=t,this.charWidth=n,this.textHeight=r,this.lineLength=i,s){this.heightSamples={};for(let e=0;e<a.length;e++){let t=a[e];t<0?e++:this.heightSamples[Math.floor(t*10)]=!0}}return s}},jh=class{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}},Mh=class e{constructor(e,t,n,r,i){this.from=e,this.length=t,this.top=n,this.height=r,this._content=i}get type(){return typeof this._content==`number`?zd.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Ud?this._content.widget:null}get widgetLineBreaks(){return typeof this._content==`number`?this._content:0}join(t){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(t._content)?t._content:[t]);return new e(this.from,this.length+t.length,this.top,this.height+t.height,n)}},Nh=(function(e){return e[e.ByPos=0]=`ByPos`,e[e.ByHeight=1]=`ByHeight`,e[e.ByPosNoHeight=2]=`ByPosNoHeight`,e})(Nh||={}),Ph=.001,Fh=class e{constructor(e,t,n=2){this.length=e,this.height=t,this.flags=n}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Ph&&(Oh=!0),this.height=e)}replace(t,n,r){return e.of(r)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,n,r){let i=this,a=n.doc;for(let o=r.length-1;o>=0;o--){let{fromA:s,toA:c,fromB:l,toB:u}=r[o],d=i.lineAt(s,Nh.ByPosNoHeight,n.setDoc(t),0,0),f=d.to>=c?d:i.lineAt(c,Nh.ByPosNoHeight,n,0,0);for(u+=f.to-c,c=f.to;o>0&&d.from<=r[o-1].toA;)s=r[o-1].fromA,l=r[o-1].fromB,o--,s<d.from&&(d=i.lineAt(s,Nh.ByPosNoHeight,n,0,0));l+=d.from-s,s=d.from;let p=Wh.build(n.setDoc(a),e,l,u);i=Ih(i,i.replace(s,c,p))}return i.updateHeight(n,0)}static empty(){return new zh(0,0,0)}static of(t){if(t.length==1)return t[0];let n=0,r=t.length,i=0,a=0;for(;;)if(n==r){if(i>a*2){let e=t[n-1];e.break?t.splice(--n,1,e.left,null,e.right):t.splice(--n,1,e.left,e.right),r+=1+e.break,i-=e.size}else if(a>i*2){let e=t[r];e.break?t.splice(r,1,e.left,null,e.right):t.splice(r,1,e.left,e.right),r+=2+e.break,a-=e.size}else break}else if(i<a){let e=t[n++];e&&(i+=e.size)}else{let e=t[--r];e&&(a+=e.size)}let o=!1;return t[n-1]==null?(o=!0,n--):t[n]??(o=!0,r++),new Vh(e.of(t.slice(0,n)),o,e.of(t.slice(r)))}};function Ih(e,t){return e==t?e:(e.constructor!=t.constructor&&(Oh=!0),t)}Fh.prototype.size=1;var Lh=Bd.replace({}),Rh=class extends Fh{constructor(e,t,n){super(e,t),this.deco=n,this.spaceAbove=0}mainBlock(e,t){return new Mh(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,n,r){return this.spaceAbove&&e<n+this.spaceAbove?new Mh(r,0,n,this.spaceAbove,Lh):this.mainBlock(n,r)}lineAt(e,t,n,r,i){let a=this.mainBlock(r,i);return this.spaceAbove?this.blockAt(0,n,r,i).join(a):a}forEachLine(e,t,n,r,i,a){e<=i+this.length&&t>=i&&a(this.lineAt(0,Nh.ByPos,n,r,i))}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,n=!1,r){return r&&r.from<=t&&r.more&&this.setMeasuredHeight(r),this.outdated=!1,this}toString(){return`block(${this.length})`}},zh=class e extends Rh{constructor(e,t,n){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=n}mainBlock(e,t){return new Mh(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(t,n,r){let i=r[0];return r.length==1&&(i instanceof e||i instanceof Bh&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof Bh?i=new e(i.length,this.height,this.spaceAbove):i.height=this.height,this.outdated||(i.outdated=!1),i):Fh.of(r)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setMeasuredHeight(r):(n||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:``})`}},Bh=class e extends Fh{constructor(e){super(e,0)}heightMetrics(e,t){let n=e.doc.lineAt(t).number,r=e.doc.lineAt(t+this.length).number,i=r-n+1,a,o=0;if(e.lineWrapping){let t=Math.min(this.height,e.lineHeight*i);a=t/i,this.length>i+1&&(o=(this.height-t)/(this.length-i-1))}else a=this.height/i;return{firstLine:n,lastLine:r,perLine:a,perChar:o}}blockAt(e,t,n,r){let{firstLine:i,lastLine:a,perLine:o,perChar:s}=this.heightMetrics(t,r);if(t.lineWrapping){let i=r+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-n)/this.height))*this.length)),a=t.doc.lineAt(i),c=o+a.length*s,l=Math.max(n,e-c/2);return new Mh(a.from,a.length,l,c,0)}{let r=Math.max(0,Math.min(a-i,Math.floor((e-n)/o))),{from:s,length:c}=t.doc.line(i+r);return new Mh(s,c,n+o*r,o,0)}}lineAt(e,t,n,r,i){if(t==Nh.ByHeight)return this.blockAt(e,n,r,i);if(t==Nh.ByPosNoHeight){let{from:t,to:r}=n.doc.lineAt(e);return new Mh(t,r-t,0,0,0)}let{firstLine:a,perLine:o,perChar:s}=this.heightMetrics(n,i),c=n.doc.lineAt(e),l=o+c.length*s,u=c.number-a,d=r+o*u+s*(c.from-i-u);return new Mh(c.from,c.length,Math.max(r,Math.min(d,r+this.height-l)),l,0)}forEachLine(e,t,n,r,i,a){e=Math.max(e,i),t=Math.min(t,i+this.length);let{firstLine:o,perLine:s,perChar:c}=this.heightMetrics(n,i);for(let l=e,u=r;l<=t;){let t=n.doc.lineAt(l);if(l==e){let n=t.number-o;u+=s*n+c*(e-i-n)}let r=s+c*t.length;a(new Mh(t.from,t.length,u,r,0)),u+=r,l=t.to+1}}replace(t,n,r){let i=this.length-n;if(i>0){let t=r[r.length-1];t instanceof e?r[r.length-1]=new e(t.length+i):r.push(null,new e(i-1))}if(t>0){let n=r[0];n instanceof e?r[0]=new e(t+n.length):r.unshift(new e(t-1),null)}return Fh.of(r)}decomposeLeft(t,n){n.push(new e(t-1),null)}decomposeRight(t,n){n.push(null,new e(this.length-t-1))}updateHeight(t,n=0,r=!1,i){let a=n+this.length;if(i&&i.from<=n+this.length&&i.more){let r=[],o=Math.max(n,i.from),s=-1;for(i.from>n&&r.push(new e(i.from-n-1).updateHeight(t,n));o<=a&&i.more;){let e=t.doc.lineAt(o).length;r.length&&r.push(null);let n=i.heights[i.index++],a=0;n<0&&(a=-n,n=i.heights[i.index++]),s==-1?s=n:Math.abs(n-s)>=Ph&&(s=-2);let c=new zh(e,n,a);c.outdated=!1,r.push(c),o+=e+1}o<=a&&r.push(null,new e(a-o).updateHeight(t,o));let c=Fh.of(r);return(s<0||Math.abs(c.height-this.height)>=Ph||Math.abs(s-this.heightMetrics(t,n).perLine)>=Ph)&&(Oh=!0),Ih(this,c)}return(r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1),this}toString(){return`gap(${this.length})`}},Vh=class extends Fh{constructor(e,t,n){super(e.length+ +!!t+n.length,e.height+n.height,+!!t|(e.outdated||n.outdated?2:0)),this.left=e,this.right=n,this.size=e.size+n.size}get break(){return this.flags&1}blockAt(e,t,n,r){let i=n+this.left.height;return e<i?this.left.blockAt(e,t,n,r):this.right.blockAt(e,t,i,r+this.left.length+this.break)}lineAt(e,t,n,r,i){let a=r+this.left.height,o=i+this.left.length+this.break,s=t==Nh.ByHeight?e<a:e<o,c=s?this.left.lineAt(e,t,n,r,i):this.right.lineAt(e,t,n,a,o);if(this.break||(s?c.to<o:c.from>o))return c;let l=t==Nh.ByPosNoHeight?Nh.ByPosNoHeight:Nh.ByPos;return s?c.join(this.right.lineAt(o,l,n,a,o)):this.left.lineAt(o,l,n,r,i).join(c)}forEachLine(e,t,n,r,i,a){let o=r+this.left.height,s=i+this.left.length+this.break;if(this.break)e<s&&this.left.forEachLine(e,t,n,r,i,a),t>=s&&this.right.forEachLine(e,t,n,o,s,a);else{let c=this.lineAt(s,Nh.ByPos,n,r,i);e<c.from&&this.left.forEachLine(e,Math.min(t,c.from-1),n,r,i,a),c.to>=e&&c.from<=t&&a(c),t>c.to&&this.right.forEachLine(Math.max(e,c.to+1),t,n,o,s,a)}}replace(e,t,n){let r=this.left.length+this.break;if(t<r)return this.balanced(this.left.replace(e,t,n),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-r,t-r,n));let i=[];e>0&&this.decomposeLeft(e,i);let a=i.length;for(let e of n)i.push(e);if(e>0&&Hh(i,a-1),t<this.length){let e=i.length;this.decomposeRight(t,i),Hh(i,e)}return Fh.of(i)}decomposeLeft(e,t){let n=this.left.length;if(e<=n)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(n++,e>=n&&t.push(null)),e>n&&this.right.decomposeLeft(e-n,t)}decomposeRight(e,t){let n=this.left.length,r=n+this.break;if(e>=r)return this.right.decomposeRight(e-r,t);e<n&&this.left.decomposeRight(e,t),this.break&&e<r&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?Fh.of(this.break?[e,null,t]:[e,t]):(this.left=Ih(this.left,e),this.right=Ih(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,n=!1,r){let{left:i,right:a}=this,o=t+i.length+this.break,s=null;return r&&r.from<=t+i.length&&r.more?s=i=i.updateHeight(e,t,n,r):i.updateHeight(e,t,n),r&&r.from<=o+a.length&&r.more?s=a=a.updateHeight(e,o,n,r):a.updateHeight(e,o,n),s?this.balanced(i,a):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?` `:`-`)+this.right}};function Hh(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof Bh&&(r=e[t+1])instanceof Bh&&e.splice(t-1,3,new Bh(n.length+1+r.length))}var Uh=5,Wh=class e{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let e=Math.min(t,this.lineEnd),n=this.nodes[this.nodes.length-1];n instanceof zh?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new zh(e-this.pos,-1,0)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e<t||n.heightRelevant){let r=n.widget?n.widget.estimatedHeight:0,i=n.widget?n.widget.lineBreaks:0;r<0&&(r=this.oracle.lineHeight);let a=t-e;n.block?this.addBlock(new Rh(a,r,n)):(a||i||r>=Uh)&&this.addLineDeco(r,i,a)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new zh(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let n=new Bh(t-e);return this.oracle.doc.lineAt(e).to==t&&(n.flags|=4),n}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof zh)return e;let t=new zh(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+=e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,n){let r=this.ensureLine();r.length+=n,r.collapsed+=n,r.widgetHeight=Math.max(r.widgetHeight,e),r.breaks+=t,this.writtenTo=this.pos+=n}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof zh)&&!this.isCovered?this.nodes.push(new zh(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let n=e;for(let e of this.nodes)e instanceof zh&&e.updateHeight(this.oracle,n),n+=e?e.length:1;return this.nodes}static build(t,n,r,i){let a=new e(r,t);return Uu.spans(n,r,i,a,0),a.finish(r)}};function Gh(e,t,n){let r=new Kh;return Uu.compare(e,t,n,r,0),r.changes}var Kh=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,n,r){(e<t||n&&n.heightRelevant||r&&r.heightRelevant)&&Kd(e,t,this.changes,5)}};function qh(e,t){let n=e.getBoundingClientRect(),r=e.ownerDocument,i=r.defaultView||window,a=Math.max(0,n.left),o=Math.min(i.innerWidth,n.right),s=Math.max(0,n.top),c=Math.min(i.innerHeight,n.bottom);for(let t=e.parentNode;t&&t!=r.body;)if(Jd(t)){let n=window.getComputedStyle(t);if((t.scrollHeight>t.clientHeight||t.scrollWidth>t.clientWidth)&&n.overflow!=`visible`){let n=t.getBoundingClientRect();a=Math.max(a,n.left),o=Math.min(o,n.right),s=Math.max(s,n.top),c=Math.min(t==e.parentNode?i.innerHeight:c,n.bottom)}t=n.position==`absolute`||n.position==`fixed`?t.offsetParent:t.parentNode}else if(t.nodeType==11)t=t.host;else break;return{left:a-n.left,right:Math.max(a,o)-n.left,top:s-(n.top+t),bottom:Math.max(s,c)-(n.top+t)}}function Jh(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left<n.innerWidth&&t.right>0&&t.top<n.innerHeight&&t.bottom>0}function Yh(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}var Xh=class{constructor(e,t,n,r){this.from=e,this.to=t,this.size=n,this.displaySize=r}static same(e,t){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r.from!=i.from||r.to!=i.to||r.size!=i.size)return!1}return!0}draw(e,t){return Bd.replace({widget:new Zh(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}},Zh=class extends Rd{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement(`div`);return this.vertical?e.style.height=this.size+`px`:(e.style.width=this.size+`px`,e.style.height=`2px`,e.style.display=`inline-block`),e}get estimatedHeight(){return this.vertical?this.size:-1}},Qh=class{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=ig,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Tf.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=t.facet(gp).some(e=>typeof e!=`function`&&e.class==`cm-lineWrapping`);this.heightOracle=new Ah(n),this.stateDeco=ag(t),this.heightMap=Fh.empty().applyChanges(this.stateDeco,vl.empty,this.heightOracle.setDoc(t.doc),[new Dp(0,0,0,t.doc.length)]);for(let e=0;e<2&&(this.viewport=this.getViewport(0,null),this.updateForViewport());e++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Bd.set(this.lineGaps.map(e=>e.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let r=n?t.head:t.anchor;if(!e.some(({from:e,to:t})=>r>=e&&r<=t)){let{from:t,to:n}=this.lineBlockAt(r);e.push(new $h(t,n))}}return this.viewports=e.sort((e,t)=>e.from-t.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?ig:og.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(sg(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=ag(this.state);let r=e.changedRanges,i=Dp.extendWithRanges(r,Gh(n,this.stateDeco,e?e.changes:Rl.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);kh(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||Oh)&&(e.flags|=2),o?(this.scrollAnchorPos=e.changes.mapPos(o.from,-1),this.scrollAnchorHeight=o.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=a);let s=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<s.from||t.range.head>s.to)||!this.viewportIsAppropriate(s))&&(s=this.getViewport(0,t));let c=s.from!=this.viewport.from||s.to!=this.viewport.to;this.viewport=s,e.flags|=this.updateForViewport(),(c||!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(ip)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,i=n.whiteSpace;this.defaultTextDirection=n.direction==`rtl`?Tf.RTL:Tf.LTR;let a=this.heightOracle.mustRefreshForWrapping(i)||this.mustMeasureContent===`refresh`,o=t.getBoundingClientRect(),s=a||this.mustMeasureContent||this.contentDOMHeight!=o.height;this.contentDOMHeight=o.height,this.mustMeasureContent=!1;let c=0,l=0;if(o.width&&o.height){let{scaleX:e,scaleY:n}=cf(t,o);(e>.005&&Math.abs(this.scaleX-e)>.005||n>.005&&Math.abs(this.scaleY-n)>.005)&&(this.scaleX=e,this.scaleY=n,c|=16,a=s=!0)}let u=(parseInt(n.paddingTop)||0)*this.scaleY,d=(parseInt(n.paddingBottom)||0)*this.scaleY;(this.paddingTop!=u||this.paddingBottom!=d)&&(this.paddingTop=u,this.paddingBottom=d,c|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(r.lineWrapping&&(s=!0),this.editorWidth=e.scrollDOM.clientWidth,c|=16);let f=uf(this.view.contentDOM,!1).y;f!=this.scrollParent&&(this.scrollParent=f,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=xf(this.scrollParent||e.win);let m=(this.printing?Yh:qh)(t,this.paddingTop),h=m.top-this.pixelViewport.top,g=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let _=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(_!=this.inView&&(this.inView=_,_&&(s=!0)),!this.inView&&!this.scrollTarget&&!Jh(e.dom))return 0;let v=o.width;if((this.contentDOMWidth!=v||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=o.width,this.editorHeight=e.scrollDOM.clientHeight,c|=16),s){let t=e.docView.measureVisibleLineHeights(this.viewport);if(r.mustRefreshForHeights(t)&&(a=!0),a||r.lineWrapping&&Math.abs(v-this.contentDOMWidth)>r.charWidth){let{lineHeight:n,charWidth:o,textHeight:s}=e.docView.measureTextSize();a=n>0&&r.refresh(i,n,o,s,Math.max(5,v/o),t),a&&(e.docView.minWidth=0,c|=16)}h>0&&g>0?l=Math.max(h,g):h<0&&g<0&&(l=Math.min(h,g)),kh();for(let n of this.viewports){let i=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(a?Fh.empty().applyChanges(this.stateDeco,vl.empty,this.heightOracle,[new Dp(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new jh(n.from,i))}Oh&&(c|=2)}let y=!this.viewportIsAppropriate(this.viewport,l)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return y&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(l,this.scrollTarget),c|=this.updateForViewport()),(c&2||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(a?[]:this.lineGaps,e)),c|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),c}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let n=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),r=this.heightMap,i=this.heightOracle,{visibleTop:a,visibleBottom:o}=this,s=new $h(r.lineAt(a-n*1e3,Nh.ByHeight,i,0,0).from,r.lineAt(o+(1-n)*1e3,Nh.ByHeight,i,0,0).to);if(t){let{head:e}=t.range;if(e<s.from||e>s.to){let n=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),a=r.lineAt(e,Nh.ByPos,i,0,0),o;o=t.y==`center`?(a.top+a.bottom)/2-n/2:t.y==`start`||t.y==`nearest`&&e<s.from?a.top:a.bottom-n,s=new $h(r.lineAt(o-500,Nh.ByHeight,i,0,0).from,r.lineAt(o+n+500,Nh.ByHeight,i,0,0).to)}}return s}mapViewport(e,t){let n=t.mapPos(e.from,-1),r=t.mapPos(e.to,1);return new $h(this.heightMap.lineAt(n,Nh.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(r,Nh.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},n=0){if(!this.inView)return!0;let{top:r}=this.heightMap.lineAt(e,Nh.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(t,Nh.ByPos,this.heightOracle,0,0),{visibleTop:a,visibleBottom:o}=this;return(e==0||r<=a-Math.max(10,Math.min(-n,250)))&&(t==this.state.doc.length||i>=o+Math.max(10,Math.min(n,250)))&&r>a-2e3&&i<o+2e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let n=[];for(let r of e)t.touchesRange(r.from,r.to)||n.push(new Xh(t.mapPos(r.from),t.mapPos(r.to),r.size,r.displaySize));return n}ensureLineGaps(e,t){let n=this.heightOracle.lineWrapping,r=n?1e4:2e3,i=r>>1,a=r<<1;if(this.defaultTextDirection!=Tf.LTR&&!n)return[];let o=[],s=(r,a,c,l)=>{if(a-r<i)return;let u=this.state.selection.main,d=[u.from];u.empty||d.push(u.to);for(let e of d)if(e>r&&e<a){s(r,e-10,c,l),s(e+10,a,c,l);return}let f=rg(e,e=>e.from>=c.from&&e.to<=c.to&&Math.abs(e.from-r)<i&&Math.abs(e.to-a)<i&&!d.some(t=>e.from<t&&e.to>t));if(!f){if(a<c.to&&t&&n&&t.visibleRanges.some(e=>e.from<=a&&e.to>=a)){let e=t.moveToLineBoundary(G.cursor(a),!1,!0).head;e>r&&(a=e)}let e=this.gapSize(c,r,a,l);f=new Xh(r,a,e,n||e<2e6?e:2e6)}o.push(f)},c=t=>{if(t.length<a||t.type!=zd.Text)return;let i=eg(t.from,t.to,this.stateDeco);if(i.total<a)return;let o=this.scrollTarget?this.scrollTarget.range.head:null,c,l;if(n){let e=r/this.heightOracle.lineLength*this.heightOracle.lineHeight,n,a;if(o!=null){let r=ng(i,o),s=((this.visibleBottom-this.visibleTop)/2+e)/t.height;n=r-s,a=r+s}else n=(this.visibleTop-t.top-e)/t.height,a=(this.visibleBottom-t.top+e)/t.height;c=tg(i,n),l=tg(i,a)}else{let n=i.total*this.heightOracle.charWidth,a=r*this.heightOracle.charWidth,s=0;if(n>2e6)for(let n of e)n.from>=t.from&&n.from<t.to&&n.size!=n.displaySize&&n.from*this.heightOracle.charWidth+s<this.pixelViewport.left&&(s=n.size-n.displaySize);let u=this.pixelViewport.left+s,d=this.pixelViewport.right+s,f,p;if(o!=null){let e=ng(i,o),t=((d-u)/2+a)/n;f=e-t,p=e+t}else f=(u-a)/n,p=(d+a)/n;c=tg(i,f),l=tg(i,p)}c>t.from&&s(t.from,c,t,i),l<t.to&&s(l,t.to,t,i)};for(let e of this.viewportLines)Array.isArray(e.type)?e.type.forEach(c):c(e);return o}gapSize(e,t,n,r){let i=ng(r,n)-ng(r,t);return this.heightOracle.lineWrapping?e.height*i:r.total*this.heightOracle.charWidth*i}updateLineGaps(e){Xh.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Bd.set(e.map(e=>e.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];Uu.spans(t,this.viewport.from,this.viewport.to,{span(e,t){n.push({from:e,to:t})},point(){}},20);let r=0;if(n.length!=this.visibleRanges.length)r=12;else for(let t=0;t<n.length&&!(r&8);t++){let i=this.visibleRanges[t],a=n[t];(i.from!=a.from||i.to!=a.to)&&(r|=4,e&&e.mapPos(i.from,-1)==a.from&&e.mapPos(i.to,1)==a.to||(r|=8))}return this.visibleRanges=n,r}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||sg(this.heightMap.lineAt(e,Nh.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)||sg(this.heightMap.lineAt(this.scaler.fromDOM(e),Nh.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 sg(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}},$h=class{constructor(e,t){this.from=e,this.to=t}};function eg(e,t,n){let r=[],i=e,a=0;return Uu.spans(n,e,t,{span(){},point(e,t){e>i&&(r.push({from:i,to:e}),a+=e-i),i=t}},20),i<t&&(r.push({from:i,to:t}),a+=t-i),{total:a,ranges:r}}function tg({total:e,ranges:t},n){if(n<=0)return t[0].from;if(n>=1)return t[t.length-1].to;let r=Math.floor(e*n);for(let e=0;;e++){let{from:n,to:i}=t[e],a=i-n;if(r<=a)return n+r;r-=a}}function ng(e,t){let n=0;for(let{from:r,to:i}of e.ranges){if(t<=i){n+=t-r;break}n+=i-r}return n/e.total}function rg(e,t){for(let n of e)if(t(n))return n}var ig={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}};function ag(e){let t=e.facet(_p).filter(e=>typeof e!=`function`),n=e.facet(yp).filter(e=>typeof e!=`function`);return n.length&&t.push(Uu.join(n)),t}var og=class e{constructor(e,t){this.scale=e,this.viewports=t}static get(t,n,r){let i=0,a=0,o=0,s=r.map(({from:e,to:r})=>{let a=n.lineAt(e,Nh.ByPos,t,0,0).top,o=n.lineAt(r,Nh.ByPos,t,0,0).bottom;return i+=o-a,{from:e,to:r,top:a,bottom:o,domTop:0,domBottom:0}});if(n.height-i<10)return ig;let c=(7e6-i)/(n.height-i);for(let e of s)e.domTop=o+(e.top-a)*c,o=e.domBottom=e.domTop+(e.bottom-e.top),a=e.bottom;return new e(c,s)}toDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.top)return r+(e-n)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);n=i.bottom,r=i.domBottom}}fromDOM(e){for(let t=0,n=0,r=0;;t++){let i=t<this.viewports.length?this.viewports[t]:null;if(!i||e<i.domTop)return n+(e-r)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);n=i.bottom,r=i.domBottom}}eq(t){return t instanceof e&&this.scale==t.scale&&this.viewports.length==t.viewports.length&&this.viewports.every((e,n)=>e.from==t.viewports[n].from&&e.to==t.viewports[n].to)}};function sg(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new Mh(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>sg(e,t)):e._content)}var cg=K.define({combine:e=>e.join(` `)}),lg=K.define({combine:e=>e.indexOf(!0)>-1}),ug=ld.newName(),dg=ld.newName(),fg=ld.newName(),pg={"&light":`.`+dg,"&dark":`.`+fg};function mg(e,t,n){return new ld(t,{finish(t){return/&/.test(t)?t.replace(/&\w*/,t=>{if(t==`&`)return e;if(!n||!n[t])throw RangeError(`Unsupported selector: ${t}`);return n[t]}):e+` `+t}})}var hg=mg(`.`+ug,{"&":{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,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,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`}},pg),gg={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},_g=q.ie&&q.ie_version<=11,vg=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new df,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 e of t)this.queue.push(e);(q.ie&&q.ie_version<=11||q.ios&&e.composing)&&t.some(e=>e.type==`childList`&&e.removedNodes.length||e.type==`characterData`&&e.oldValue.length>e.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&q.android&&e.constructor.EDIT_CONTEXT!==!1&&!(q.chrome&&q.chrome_version<126)&&(this.editContext=new Sg(e),e.state.facet(up)&&(e.contentDOM.editContext=this.editContext.editContext)),_g&&(this.onCharData=e=>{this.queue.push({target:e.target,type:`characterData`,oldValue:e.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia(`print`)),typeof ResizeObserver==`function`&&(this.resizeScroll=new ResizeObserver(()=>{this.view.docView?.lastUpdate<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver==`function`&&(this.intersection=new IntersectionObserver(e=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent(`Event`)))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent(`Event`))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers(`scroll`,e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(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,n)=>t!=e[n]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:n}=this,r=this.selectionRange;if(n.state.facet(up)?n.root.activeElement!=this.dom:!Qd(this.dom,r))return;let i=r.anchorNode&&n.docView.tile.nearest(r.anchorNode);i&&i.isWidget()&&i.widget.ignoreEvent(e)?t||(this.selectionChanged=!1):(q.ie&&q.ie_version<=11||q.android&&q.chrome)&&!n.state.selection.main.empty&&r.focusNode&&ef(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=Xd(e.root);if(!t)return!1;let n=q.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&xg(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=Qd(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&bf(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let n=this.dom;n;)if(Jd(n))!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==n?e++:t||=this.scrollTargets.slice(0,e),t&&t.push(n),n=n.assignedSlot||n.parentNode;else if(n.nodeType==11)n=n.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let e of this.scrollTargets)e.removeEventListener(`scroll`,this.onScroll);for(let e of this.scrollTargets=t)e.addEventListener(`scroll`,this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||=(this.observer.observe(this.dom,gg),_g&&this.dom.addEventListener(`DOMCharacterDataModified`,this.onCharData),!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),_g&&this.dom.removeEventListener(`DOMCharacterDataModified`,this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){if(!this.delayedAndroidKey){let e=()=>{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&vf(this.dom,e.key,e.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(e)}this.delayedAndroidKey&&e!=`Enter`||(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!this.delayedAndroidKey?.force})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,n=-1,r=!1;for(let i of e){let e=this.readMutation(i);e&&(e.typeOver&&(r=!0),t==-1?{from:t,to:n}=e:(t=Math.min(e.from,t),n=Math.max(e.to,n)))}return{from:t,to:n,typeOver:r}}readChange(){let{from:e,to:t,typeOver:n}=this.processRecords(),r=this.selectionChanged&&Qd(this.dom,this.selectionRange);if(e<0&&!r)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let i=new Pm(this.view,e,t,n);return this.view.docView.domChanged={newSel:i.newSel?i.newSel.main:null},i}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.selectionChanged,n=this.readChange();if(!n)return this.view.requestMeasure(),!1;let r=this.view.state,i=Im(this.view,n);return this.view.state==r&&(n.domChanged||t)&&this.view.update([]),i}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 n=yg(t,e.previousSibling||e.target.previousSibling,-1),r=yg(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}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(up)!=e.state.facet(up)&&(e.view.contentDOM.editContext=e.state.facet(up)?this.editContext.editContext:null))}destroy(){var e,t,n;this.stop(),(e=this.intersection)==null||e.disconnect(),(t=this.gapIntersection)==null||t.disconnect(),(n=this.resizeScroll)==null||n.disconnect();for(let e of this.scrollTargets)e.removeEventListener(`scroll`,this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}};function yg(e,t,n){for(;t;){let r=Ap.get(t);if(r&&r.parent==e)return r;let i=t.parentNode;t=i==e.dom?n>0?t.nextSibling:t.previousSibling:i}return null}function bg(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor,1);return ef(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function xg(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return bg(e,n)}let n=null;function r(e){e.preventDefault(),e.stopImmediatePropagation(),n=e.getTargetRanges()[0]}return e.contentDOM.addEventListener(`beforeinput`,r,!0),e.dom.ownerDocument.execCommand(`indent`),e.contentDOM.removeEventListener(`beforeinput`,r,!0),n?bg(e,n):null}var Sg=class{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=n=>{let r=e.state.selection.main,{anchor:i,head:a}=r,o=this.toEditorPos(n.updateRangeStart),s=this.toEditorPos(n.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:n.updateRangeStart,editorBase:o,drifted:!1});let c=s-o>n.text.length;o==this.from&&i<this.from?o=i:s==this.to&&i>this.to&&(s=i);let l=zm(e.state.sliceDoc(o,s),n.text,(c?r.from:r.to)-o,c?`end`:null);if(!l){let t=G.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));Hm(t,r)||e.dispatch({selection:t,userEvent:`select`});return}let u={from:l.from+o,to:l.toA+o,insert:vl.of(n.text.slice(l.from,l.toB).split(`
11
+ `))};if((q.mac||q.android)&&u.from==a-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute(`autocorrect`)==`off`&&(u={from:o,to:s,insert:vl.of([n.text.replace(`.`,` `)])}),this.pendingContextChange=u,!e.state.readOnly){let t=this.to-this.from+(u.to-u.from+u.insert.length);Lm(e,u,G.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from<u.to&&!u.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,n.updateRangeStart-1),Math.min(t.text.length,n.updateRangeStart+1)))&&this.handlers.compositionend(n)},this.handlers.characterboundsupdate=n=>{let r=[],i=null;for(let t=this.toEditorPos(n.rangeStart),a=this.toEditorPos(n.rangeEnd);t<a;t++){let n=e.coordsForChar(t);i=n&&new DOMRect(n.left,n.top,n.right-n.left,n.bottom-n.top)||i||new DOMRect,r.push(i)}t.updateCharacterBounds(n.rangeStart,r)},this.handlers.textformatupdate=t=>{let n=[];for(let e of t.getTextFormats()){let t=e.underlineStyle,r=e.underlineThickness;if(!/none/i.test(t)&&!/none/i.test(r)){let i=this.toEditorPos(e.rangeStart),a=this.toEditorPos(e.rangeEnd);if(i<a){let e=`text-decoration: underline ${/^[a-z]/.test(t)?t+` `:t==`Dashed`?`dashed `:t==`Squiggle`?`wavy `:``}${/thin/i.test(r)?1:2}px`;n.push(Bd.mark({attributes:{style:e}}).range(i,a))}}}e.dispatch({effects:cp.of(Bd.set(n))})},this.handlers.compositionstart=()=>{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:t}=this.composing;this.composing=null,t&&this.reset(e.state)}};for(let e in this.handlers)t.addEventListener(e,this.handlers[e]);this.measureReq={read:e=>{let t=Xd(e.root);t&&t.rangeCount&&this.editContext.updateSelectionBounds(t.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,n=!1,r=this.pendingContextChange;return e.changes.iterChanges((i,a,o,s,c)=>{if(n)return;let l=c.length-(a-i);if(r&&a>=r.to){if(r.from==i&&r.to==a&&r.insert.eq(c)){r=this.pendingContextChange=null,t+=l,this.to+=l;return}r=null,this.revertPending(e.state)}if(i+=t,a+=t,a<=this.from)this.from+=l,this.to+=l;else if(i<this.to){if(i<this.from||a>this.to||this.to-this.from+c.length>3e4){n=!0;return}this.editContext.updateText(this.toContextPos(i),this.toContextPos(a),c.toString()),this.to+=l}t+=l}),r&&!n&&this.revertPending(e.state),!n}update(e){let t=this.pendingContextChange,n=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(n.from,n.to)&&e.transactions.some(e=>!e.isUserEvent(`input.type`)&&e.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,n=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),r=this.toContextPos(t.head);(this.editContext.selectionStart!=n||this.editContext.selectionEnd!=r)&&this.editContext.updateSelection(n,r)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>3e4)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let n=this.composing;return n&&n.drifted?n.editorBase+(e-n.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])}},J=class e{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={}){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:t}=e;this.dispatchTransactions=e.dispatchTransactions||t&&(e=>e.forEach(e=>t(e,this)))||(e=>this.update(e)),this.dispatch=this.dispatch.bind(this),this._root=e.root||yf(e.parent)||document,this.viewState=new Qh(this,e.state||Iu.create(e)),e.scrollTo&&e.scrollTo.is(sp)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(fp).map(e=>new mp(e));for(let e of this.plugins)e.update(this);this.observer=new vg(this),this.inputState=new Um(this),this.inputState.ensureHandlers(this.plugins),this.docView=new rm(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),document.fonts?.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent=`refresh`,this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof Su?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(t){if(this.updateState!=0)throw Error(`Calls to EditorView.update are not allowed while an update is in progress`);let n=!1,r=!1,i,a=this.state;for(let e of t){if(e.startState!=a)throw RangeError(`Trying to update state with a transaction that doesn't start from the previous state.`);a=e.state}if(this.destroyed){this.viewState.state=a;return}let o=this.hasFocus,s=0,c=null;t.some(e=>e.annotation(Sh))?(this.inputState.notifiedFocused=o,s=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,c=Ch(a,o),c||(s=1));let l=this.observer.delayedAndroidKey,u=null;if(l?(this.observer.clearDelayedAndroidKey(),u=this.observer.readChange(),(u&&!this.state.doc.eq(a.doc)||!this.state.selection.eq(a.selection))&&(u=null)):this.observer.clear(),a.facet(Iu.phrases)!=this.state.facet(Iu.phrases))return this.setState(a);i=Op.create(this,a,t),i.flags|=s;let d=this.viewState.scrollTarget;try{this.updateState=2;for(let n of t){if(d&&=d.map(n.changes),n.scrollIntoView){let{main:t}=n.state.selection,{x:r,y:i}=this.state.facet(e.cursorScrollMargin);d=new op(t.empty?t:G.cursor(t.head,t.head>t.anchor?-1:1),`nearest`,`nearest`,i,r)}for(let e of n.effects)e.is(sp)&&(d=e.value.clip(this.state))}this.viewState.update(i,d),this.bidiCache=Tg.update(this.bidiCache,i.changes),i.empty||(this.updatePlugins(i),this.inputState.update(i)),n=this.docView.update(i),this.state.facet(Ep)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(t),this.docView.updateSelection(n,t.some(e=>e.isUserEvent(`select.pointer`)))}finally{this.updateState=0}if(i.startState.facet(cg)!=i.state.facet(cg)&&(this.viewState.mustMeasureContent=!0),(n||r||d||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),n&&this.docViewUpdate(),!i.empty)for(let e of this.state.facet(Qf))try{e(i)}catch(e){lp(this.state,e,`update listener`)}(c||u)&&Promise.resolve().then(()=>{c&&this.state==c.startState&&this.dispatch(c),u&&!Im(this,u)&&l.force&&vf(this.contentDOM,l.key,l.keyCode)})}setState(e){if(this.updateState!=0)throw 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 e of this.plugins)e.destroy(this);this.viewState=new Qh(this,e),this.plugins=e.facet(fp).map(e=>new mp(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new rm(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(fp),n=e.state.facet(fp);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new mp(i));else{let t=this.plugins[n];t.mustUpdate=e,r.push(t)}}for(let t of this.plugins)t.mustUpdate!=e&&t.destroy(this);this.plugins=r,this.pluginMap.clear()}else for(let t of this.plugins)t.mustUpdate=e;for(let e=0;e<this.plugins.length;e++)this.plugins[e].update(this);t!=n&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(e){lp(this.state,e,`doc view update listener`)}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-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,n=this.viewState.scrollParent,r=this.viewState.getScrollOffset(),{scrollAnchorPos:i,scrollAnchorHeight:a,scaleY:o}=this.viewState;Math.abs(r-this.viewState.scrollOffset)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(a<0){if(xf(n||this.win))i=-1,a=this.viewState.heightMap.height/this.viewState.scaleY;else{let e=this.viewState.scrollAnchorAt(r);i=e.from,a=e.top}o=this.viewState.scaleY}this.updateState=1;let s=this.viewState.measure();if(!s&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(e>5){console.warn(this.measureRequests.length?`Measure loop restarted more than 5 times`:`Viewport failed to stabilize`);break}let c=[];s&4||([this.measureRequests,c]=[c,this.measureRequests]);let l=c.map(e=>{try{return e.read(this)}catch(e){return lp(this.state,e),wg}}),u=Op.create(this,this.state,[]),d=!1;u.flags|=s,t?t.flags|=s:t=u,this.updateState=2,u.empty||(this.updatePlugins(u),this.inputState.update(u),this.updateAttrs(),d=this.docView.update(u),d&&this.docViewUpdate());for(let e=0;e<c.length;e++)if(l[e]!=wg)try{let t=c[e];t.write&&t.write(l[e],this)}catch(e){lp(this.state,e)}if(d&&this.docView.updateSelection(!0),!u.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight){if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,a=-1;continue}{let e=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)/this.viewState.scaleY-a/o;if((e>1||e<-1)&&!(q.ios&&this.inputState.lastIOSMomentumScroll>Date.now()-100)&&(n==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){r+=e,n?i<0?n.scrollTop=n.scrollHeight:n.scrollTop+=e:this.win.scrollBy(0,e),a=-1;continue}}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(Qf))e(t)}get themeClasses(){return ug+` `+(this.state.facet(lg)?fg:dg)+` `+this.state.facet(cg)}updateAttrs(){let e=Eg(this,hp,{class:`cm-editor`+(this.hasFocus?` cm-focused `:` `)+this.themeClasses}),t={spellcheck:`false`,autocorrect:`off`,autocapitalize:`off`,writingsuggestions:`false`,translate:`no`,contenteditable:this.state.facet(up)?`true`:`false`,class:`cm-content`,style:`${q.tabSize}: ${this.state.tabSize}`,role:`textbox`,"aria-multiline":`true`};this.state.readOnly&&(t[`aria-readonly`]=`true`),Eg(this,gp,t);let n=this.observer.ignore(()=>{let n=Id(this.contentDOM,this.contentAttrs,t),r=Id(this.dom,this.editorAttrs,e);return n||r});return this.editorAttrs=e,this.contentAttrs=t,n}showAnnouncements(t){let n=!0;for(let r of t)for(let t of r.effects)if(t.is(e.announce)){n&&=(this.announceDOM.textContent=``,this.win.clearTimeout(this.clearAnnouncement),this.clearAnnouncement=this.win.setTimeout(()=>{this.announceDOM.textContent=`\xA0`},200),!1);let e=this.announceDOM.appendChild(document.createElement(`div`));e.textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(Ep);let t=this.state.facet(e.cspNonce);ld.mount(this.root,this.styleModules.concat(hg).reverse(),t?{nonce:t}:void 0)}readMeasured(){if(this.updateState==2)throw 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;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(t=>t.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,n){return Tm(this,e,bm(this,e,t,n))}moveByGroup(e,t){return Tm(this,e,bm(this,e,t,t=>xm(this,e.head,t)))}visualLineSide(e,t){return t?G.cursor(e.to,1):G.cursor(e.from,-1)}moveToLineBoundary(e,t,n=!0){return ym(this,e,t,n)}moveVertically(e,t,n){return Tm(this,e,Sm(this,e,t,n))}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 n=Dm(this,e,t);return n&&n.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),Dm(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.state.doc.lineAt(e),r=this.bidiSpans(n),i=r[Ff.find(r,e-n.from,-1,t)];return n.length&&(e==n.from&&t<0||e==n.to&&t>0)&&i.dir!=this.textDirectionAt(n.from)&&(e==n.to?(e=n.from+i.from,t=1):(e=n.from+i.to,t=-1)),this.docView.coordsAt(e,t,i.dir==Tf.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(rp)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Cg)return Wf(e.length);let t=this.textDirectionAt(e.from),n;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||If(r.isolates,n=Sp(this,e))))return r.order;n||=Sp(this,e);let r=Uf(e.text,t,n);return this.bidiCache.push(new Tg(e.from,e.to,t,n,!0,r)),r}get hasFocus(){return(this.dom.ownerDocument.hasFocus()||q.safari&&this.inputState?.lastContextMenu>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{hf(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={}){return sp.of(new op(typeof e==`number`?G.cursor(e):e,t.y??`nearest`,t.x??`nearest`,t.yMargin??5,t.xMargin??5))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return sp.of(new op(G.cursor(n.from),`start`,`start`,n.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 pp.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return pp.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=ld.newName(),r=[cg.of(n),Ep.of(mg(`.${n}`,e))];return t&&t.dark&&r.push(lg.of(!0)),r}static baseTheme(e){return ru.lowest(Ep.of(mg(`.`+ug,e,pg)))}static findFromDOM(e){let t=e.querySelector(`.cm-content`);return(t&&Ap.get(t)||Ap.get(e))?.root?.view||null}};J.styleModule=Ep,J.inputHandler=$f,J.clipboardInputFilter=tp,J.clipboardOutputFilter=np,J.scrollHandler=ap,J.focusChangeEffect=ep,J.perLineTextDirection=rp,J.exceptionSink=Zf,J.updateListener=Qf,J.editable=up,J.mouseSelectionStyle=Xf,J.dragMovesSelection=Yf,J.clickAddsSelectionRange=Jf,J.decorations=_p,J.blockWrappers=vp,J.outerDecorations=yp,J.atomicRanges=bp,J.bidiIsolatedRanges=xp,J.cursorScrollMargin=K.define({combine:e=>{let t=5,n=5;for(let r of e)typeof r==`number`?t=n=r:{x:t,y:n}=r;return{x:t,y:n}}}),J.scrollMargins=wp,J.darkTheme=lg,J.cspNonce=K.define({combine:e=>e.length?e[0]:``}),J.contentAttributes=gp,J.editorAttributes=hp,J.lineWrapping=J.contentAttributes.of({class:`cm-lineWrapping`}),J.announce=xu.define();var Cg=4096,wg={},Tg=class e{constructor(e,t,n,r,i,a){this.from=e,this.to=t,this.dir=n,this.isolates=r,this.fresh=i,this.order=a}static update(t,n){if(n.empty&&!t.some(e=>e.fresh))return t;let r=[],i=t.length?t[t.length-1].dir:Tf.LTR;for(let a=Math.max(0,t.length-10);a<t.length;a++){let o=t[a];o.dir==i&&!n.touchesRange(o.from,o.to)&&r.push(new e(n.mapPos(o.from,1),n.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return r}};function Eg(e,t,n){for(let r=e.state.facet(t),i=r.length-1;i>=0;i--){let t=r[i],a=typeof t==`function`?t(e):t;a&&Md(a,n)}return n}var Dg=q.mac?`mac`:q.windows?`win`:q.linux?`linux`:`key`;function Og(e,t){let n=e.split(/-(?!$)/),r=n[n.length-1];r==`Space`&&(r=` `);let i,a,o,s;for(let e=0;e<n.length-1;++e){let r=n[e];if(/^(cmd|meta|m)$/i.test(r))s=!0;else if(/^a(lt)?$/i.test(r))i=!0;else if(/^(c|ctrl|control)$/i.test(r))a=!0;else if(/^s(hift)?$/i.test(r))o=!0;else if(/^mod$/i.test(r))t==`mac`?s=!0:a=!0;else throw Error(`Unrecognized modifier name: `+r)}return i&&(r=`Alt-`+r),a&&(r=`Ctrl-`+r),s&&(r=`Meta-`+r),o&&(r=`Shift-`+r),r}function kg(e,t,n){return t.altKey&&(e=`Alt-`+e),t.ctrlKey&&(e=`Ctrl-`+e),t.metaKey&&(e=`Meta-`+e),n!==!1&&t.shiftKey&&(e=`Shift-`+e),e}var Ag=ru.default(J.domEventHandlers({keydown(e,t){return zg(Ng(t.state),e,t,`editor`)}})),jg=K.define({enables:Ag}),Mg=new WeakMap;function Ng(e){let t=e.facet(jg),n=Mg.get(t);return n||Mg.set(t,n=Lg(t.reduce((e,t)=>e.concat(t),[]))),n}function Pg(e,t,n){return zg(Ng(e.state),t,e,n)}var Fg=null,Ig=4e3;function Lg(e,t=Dg){let n=Object.create(null),r=Object.create(null),i=(e,t)=>{let n=r[e];if(n==null)r[e]=t;else if(n!=t)throw Error(`Key binding `+e+` is used both as a regular binding and as a multi-stroke prefix`)},a=(e,r,a,o,s)=>{let c=n[e]||(n[e]=Object.create(null)),l=r.split(/ (?!$)/).map(e=>Og(e,t));for(let t=1;t<l.length;t++){let n=l.slice(0,t).join(` `);i(n,!0),c[n]||(c[n]={preventDefault:!0,stopPropagation:!1,run:[t=>{let r=Fg={view:t,prefix:n,scope:e};return setTimeout(()=>{Fg==r&&(Fg=null)},Ig),!0}]})}let u=l.join(` `);i(u,!1);let d=c[u]||(c[u]={preventDefault:!1,stopPropagation:!1,run:(c._any?.run)?.slice()||[]});a&&d.run.push(a),o&&(d.preventDefault=!0),s&&(d.stopPropagation=!0)};for(let r of e){let e=r.scope?r.scope.split(` `):[`editor`];if(r.any)for(let t of e){let e=n[t]||(n[t]=Object.create(null));e._any||={preventDefault:!1,stopPropagation:!1,run:[]};let{any:i}=r;for(let t in e)e[t].run.push(e=>i(e,Rg))}let i=r[t]||r.key;if(i)for(let t of e)a(t,i,r.run,r.preventDefault,r.stopPropagation),r.shift&&a(t,`Shift-`+i,r.shift,r.preventDefault,r.stopPropagation)}return n}var Rg=null;function zg(e,t,n,r){Rg=t;let i=vd(t),a=Pl(Ml(i,0))==i.length&&i!=` `,o=``,s=!1,c=!1,l=!1;Fg&&Fg.view==n&&Fg.scope==r&&(o=Fg.prefix+` `,Ym.indexOf(t.keyCode)<0&&(c=!0,Fg=null));let u=new Set,d=e=>{if(e){for(let t of e.run)if(!u.has(t)&&(u.add(t),t(n)))return e.stopPropagation&&(l=!0),!0;e.preventDefault&&(e.stopPropagation&&(l=!0),c=!0)}return!1},f=e[r],p,m;return f&&(d(f[o+kg(i,t,!a)])?s=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(q.windows&&t.ctrlKey&&t.altKey)&&!(q.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=fd[t.keyCode])&&p!=i?(d(f[o+kg(p,t,!0)])||t.shiftKey&&(m=pd[t.keyCode])!=i&&m!=p&&d(f[o+kg(m,t,!1)]))&&(s=!0):a&&t.shiftKey&&d(f[o+kg(i,t,!0)])&&(s=!0),!s&&d(f._any)&&(s=!0)),c&&(s=!0),s&&l&&t.stopPropagation(),Rg=null,s}var Bg=class e{constructor(e,t,n,r,i){this.className=e,this.left=t,this.top=n,this.width=r,this.height=i}draw(){let e=document.createElement(`div`);return e.className=this.className,this.adjust(e),e}update(e,t){return t.className==this.className&&(this.adjust(e),!0)}adjust(e){e.style.left=this.left+`px`,e.style.top=this.top+`px`,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(t,n,r){if(r.empty){let i=t.coordsAtPos(r.head,r.assoc||1);if(!i)return[];let a=Vg(t);return[new e(n,i.left-a.left,i.top-a.top,null,i.bottom-i.top)]}return Ug(t,n,r)}};function Vg(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==Tf.LTR?t.left:t.right-e.scrollDOM.clientWidth*e.scaleX)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function Hg(e,t,n,r){let i=e.coordsAtPos(t,n*2);if(!i)return r;let a=e.dom.getBoundingClientRect(),o=(i.top+i.bottom)/2,s=e.posAtCoords({x:a.left+1,y:o}),c=e.posAtCoords({x:a.right-1,y:o});return s==null||c==null?r:{from:Math.max(r.from,Math.min(s,c)),to:Math.min(r.to,Math.max(s,c))}}function Ug(e,t,n){if(n.to<=e.viewport.from||n.from>=e.viewport.to)return[];let r=Math.max(n.from,e.viewport.from),i=Math.min(n.to,e.viewport.to),a=e.textDirection==Tf.LTR,o=e.contentDOM,s=o.getBoundingClientRect(),c=Vg(e),l=o.querySelector(`.cm-line`),u=l&&window.getComputedStyle(l),d=s.left+(u?parseInt(u.paddingLeft)+Math.min(0,parseInt(u.textIndent)):0),f=s.right-(u?parseInt(u.paddingRight):0),p=vm(e,r,1),m=vm(e,i,-1),h=p.type==zd.Text?p:null,g=m.type==zd.Text?m:null;if(h&&(e.lineWrapping||p.widgetLineBreaks)&&(h=Hg(e,r,1,h)),g&&(e.lineWrapping||m.widgetLineBreaks)&&(g=Hg(e,i,-1,g)),h&&g&&h.from==g.from&&h.to==g.to)return v(y(n.from,n.to,h));{let t=h?y(n.from,null,h):b(p,!1),r=g?y(null,n.to,g):b(m,!0),i=[];return(h||p).to<(g||m).from-(h&&g?1:0)||p.widgetLineBreaks>1&&t.bottom+e.defaultLineHeight/2<r.top?i.push(_(d,t.bottom,f,r.top)):t.bottom<r.top&&e.elementAtHeight((t.bottom+r.top)/2).type==zd.Text&&(t.bottom=r.top=(t.bottom+r.top)/2),v(t).concat(i).concat(v(r))}function _(e,n,r,i){return new Bg(t,e-c.left,n-c.top,Math.max(0,r-e),i-n)}function v({top:e,bottom:t,horizontal:n}){let r=[];for(let i=0;i<n.length;i+=2)r.push(_(n[i],e,n[i+1],t));return r}function y(t,n,r){let i=1e9,o=-1e9,s=[];function c(t,n,c,l,u){let p=e.coordsAtPos(t,t==r.to?-2:2),m=e.coordsAtPos(c,c==r.from?2:-2);p&&m&&(i=Math.min(p.top,m.top,i),o=Math.max(p.bottom,m.bottom,o),u==Tf.LTR?s.push(a&&n?d:p.left,a&&l?f:m.right):s.push(!a&&l?d:m.left,!a&&n?f:p.right))}let l=t??r.from,u=n??r.to;for(let r of e.visibleRanges)if(r.to>l&&r.from<u)for(let i=Math.max(r.from,l),a=Math.min(r.to,u);;){let r=e.state.doc.lineAt(i);for(let o of e.bidiSpans(r)){let e=o.from+r.from,s=o.to+r.from;if(e>=a)break;s>i&&c(Math.max(e,i),t==null&&e<=l,Math.min(s,a),n==null&&s>=u,o.dir)}if(i=r.to+1,i>=a)break}return s.length==0&&c(l,t==null,u,n==null,e.textDirection),{top:i,bottom:o,horizontal:s}}function b(e,t){let n=s.top+(t?e.top:e.bottom);return{top:n,bottom:n,horizontal:[]}}}function Wg(e,t){return e.constructor==t.constructor&&e.eq(t)}var Gg=class{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(Kg)!=e.state.facet(Kg)&&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,n=e.facet(Kg);for(;t<n.length&&n[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((e,t)=>!Wg(e,this.drawn[t]))){let t=this.dom.firstChild,n=0;for(let r of e)r.update&&t&&r.constructor&&this.drawn[n].constructor&&r.update(t,this.drawn[n])?(t=t.nextSibling,n++):this.dom.insertBefore(r.draw(),t);for(;t;){let e=t.nextSibling;t.remove(),t=e}this.drawn=e,q.webkit&&(this.dom.style.display=this.dom.firstChild?``:`none`)}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},Kg=K.define();function qg(e){return[pp.define(t=>new Gg(t,e)),Kg.of(e)]}var Jg=!q.ios,Yg=K.define({combine(e){return Lu(e,{cursorBlinkRate:1200,drawRangeCursor:!0,iosSelectionHandles:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function Xg(e={}){return[Yg.of(e),$g,t_,r_,ip.of(!0)]}function Zg(e){return e.facet(Yg)}function Qg(e){return e.startState.facet(Yg)!=e.state.facet(Yg)}var $g=qg({above:!0,markers(e){let{state:t}=e,n=t.facet(Yg),r=[];for(let i of t.selection.ranges){let a=i==t.selection.main;if(i.empty||n.drawRangeCursor&&!(a&&q.ios&&n.iosSelectionHandles)){let t=a?`cm-cursor cm-cursor-primary`:`cm-cursor cm-cursor-secondary`,n=i.empty?i:G.cursor(i.head,i.assoc);for(let i of Bg.forRange(e,t,n))r.push(i)}}return r},update(e,t){e.transactions.some(e=>e.selection)&&(t.style.animationName=t.style.animationName==`cm-blink`?`cm-blink2`:`cm-blink`);let n=Qg(e);return n&&e_(e.state,t),e.docChanged||e.selectionSet||n},mount(e,t){e_(t.state,e)},class:`cm-cursorLayer`});function e_(e,t){t.style.animationDuration=e.facet(Yg).cursorBlinkRate+`ms`}var t_=qg({above:!1,markers(e){let t=[],{main:n,ranges:r}=e.state.selection;for(let i of r)if(!i.empty&&(Jg||i!=n))for(let n of Bg.forRange(e,`cm-selectionBackground`,i))t.push(n);if(q.ios&&!n.empty&&e.state.facet(Yg).iosSelectionHandles){for(let r of Bg.forRange(e,`cm-selectionHandle cm-selectionHandle-start`,G.cursor(n.from,1)))t.push(r);for(let r of Bg.forRange(e,`cm-selectionHandle cm-selectionHandle-end`,G.cursor(n.to,1)))t.push(r)}return t},update(e,t){return e.docChanged||e.selectionSet||e.viewportChanged||Qg(e)},class:`cm-selectionLayer`}),n_=q.gecko&&q.gecko_version==153?`#ffffff01`:`transparent`,r_=ru.highest(J.theme({".cm-line":{...Jg?{"& ::selection, &::selection":{backgroundColor:`${n_} !important`}}:{},caretColor:`transparent !important`},".cm-content":{caretColor:`transparent !important`,"& :focus":{caretColor:`initial !important`,...Jg?{"&::selection, & ::selection":{backgroundColor:`Highlight !important`}}:{}}}}));/x/.unicode;var i_=`-10000px`,a_=class{constructor(e,t,n,r){this.facet=t,this.createTooltipView=n,this.removeTooltipView=r,this.input=e.state.facet(t),this.tooltips=this.input.filter(e=>e);let i=null;this.tooltipViews=this.tooltips.map(e=>i=n(e,i))}update(e,t){var n;let r=e.state.facet(this.facet),i=r.filter(e=>e);if(r===this.input){for(let t of this.tooltipViews)t.update&&t.update(e);return!1}let a=[],o=t?[]:null;for(let n=0;n<i.length;n++){let r=i[n],s=-1;if(r){for(let e=0;e<this.tooltips.length;e++){let t=this.tooltips[e];t&&t.create==r.create&&(s=e)}if(s<0)a[n]=this.createTooltipView(r,n?a[n-1]:null),o&&(o[n]=!!r.above);else{let r=a[n]=this.tooltipViews[s];o&&(o[n]=t[s]),r.update&&r.update(e)}}}for(let e of this.tooltipViews)a.indexOf(e)<0&&(this.removeTooltipView(e),(n=e.destroy)==null||n.call(e));return t&&(o.forEach((e,n)=>t[n]=e),t.length=o.length),this.input=r,this.tooltips=i,this.tooltipViews=a,!0}};function o_(e){let t=e.dom.ownerDocument.documentElement,n=t.clientWidth,r=getComputedStyle(t);if(!/stable/.test(r.scrollbarGutter||``))return{left:0,right:n};let i=t.getBoundingClientRect(),a=e.win.scrollX;return{left:Math.max(0,i.left+a-parseFloat(r.marginLeft)),right:Math.min(n,i.right+a+parseFloat(r.marginRight))}}function s_(e){let{left:t,right:n}=o_(e);return{top:0,left:t,right:n,bottom:e.dom.ownerDocument.documentElement.clientHeight}}var c_=K.define({combine:e=>({position:q.ios?`absolute`:e.find(e=>e.position)?.position||`fixed`,parent:e.find(e=>e.parent)?.parent||null,tooltipSpace:e.find(e=>e.tooltipSpace)?.tooltipSpace||s_})}),l_=new WeakMap,u_=pp.fromClass(class{constructor(e){this.view=e,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let t=e.state.facet(c_);this.position=t.position,this.parent=t.parent,this.classes=e.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver==`function`?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new a_(e,m_,(e,t)=>this.createTooltip(e,t),e=>{this.resizeObserver&&this.resizeObserver.unobserve(e.dom),e.dom.remove()}),this.above=this.manager.tooltips.map(e=>!!e.above),this.intersectionObserver=typeof IntersectionObserver==`function`?new IntersectionObserver(e=>{Date.now()>this.lastTransaction-50&&e.length>0&&e[e.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),e.win.addEventListener(`resize`,this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement(`div`),this.container.style.position=`relative`,this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let e of this.manager.tooltipViews)this.intersectionObserver.observe(e.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(e){e.transactions.length&&(this.lastTransaction=Date.now());let t=this.manager.update(e,this.above);t&&this.observeIntersection();let n=t||e.geometryChanged,r=e.state.facet(c_);if(r.position!=this.position&&!this.madeAbsolute){this.position=r.position;for(let e of this.manager.tooltipViews)e.dom.style.position=this.position;n=!0}if(r.parent!=this.parent){this.parent&&this.container.remove(),this.parent=r.parent,this.createContainer();for(let e of this.manager.tooltipViews)this.container.appendChild(e.dom);n=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);n&&this.maybeMeasure()}createTooltip(e,t){let n=e.create(this.view),r=t?t.dom:null;if(n.dom.classList.add(`cm-tooltip`),e.arrow&&!n.dom.querySelector(`.cm-tooltip > .cm-tooltip-arrow`)){let e=document.createElement(`div`);e.className=`cm-tooltip-arrow`,n.dom.appendChild(e)}return n.dom.style.position=this.position,n.dom.style.top=i_,n.dom.style.left=`0px`,this.container.insertBefore(n.dom,r),n.mount&&n.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(n.dom),n}destroy(){var e,t,n;this.view.win.removeEventListener(`resize`,this.measureSoon);for(let t of this.manager.tooltipViews)t.dom.remove(),(e=t.destroy)==null||e.call(t);this.parent&&this.container.remove(),(t=this.resizeObserver)==null||t.disconnect(),(n=this.intersectionObserver)==null||n.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let e=1,t=1,n=!1,r=0;if(this.position==`fixed`&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(q.safari){let t=e.getBoundingClientRect();n=Math.abs(t.top+1e4)>1||Math.abs(t.left)>1}else n=!!e.offsetParent&&e.offsetParent!=this.container.ownerDocument.body}if(n||this.position==`absolute`){if(this.parent){let n=this.parent.getBoundingClientRect();n.width&&n.height&&(e=n.width/this.parent.offsetWidth,t=n.height/this.parent.offsetHeight)}else({scaleX:e,scaleY:t}=this.view.viewState)}else r=o_(this.view).left;let i=this.view.scrollDOM.getBoundingClientRect(),a=Tp(this.view);return{visible:{left:i.left+a.left,top:i.top+a.top,right:i.right-a.right,bottom:i.bottom-a.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((e,t)=>{let n=this.manager.tooltipViews[t];return n.getCoords?n.getCoords(e.pos):this.view.coordsAtPos(e.pos)}),size:this.manager.tooltipViews.map(({dom:e})=>e.getBoundingClientRect()),space:this.view.state.facet(c_).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n,fixedLeft:r}}writeMeasure(e){if(e.makeAbsolute){this.madeAbsolute=!0,this.position=`absolute`;for(let e of this.manager.tooltipViews)e.dom.style.position=`absolute`}let{visible:t,space:n,scaleX:r,scaleY:i}=e,a=[];for(let o=0;o<this.manager.tooltips.length;o++){let s=this.manager.tooltips[o],c=this.manager.tooltipViews[o],{dom:l}=c,u=e.pos[o],d=e.size[o];if(!u||s.clip!==!1&&(u.bottom<=Math.max(t.top,n.top)||u.top>=Math.min(t.bottom,n.bottom)||u.right<Math.max(t.left,n.left)-.1||u.left>Math.min(t.right,n.right)+.1)){l.style.top=i_;continue}let f=s.arrow?c.dom.querySelector(`.cm-tooltip-arrow`):null,p=f?7:0,m=d.right-d.left,h=l_.get(c)??d.bottom-d.top,g=c.offset||p_,_=this.view.textDirection==Tf.LTR,v=d.width>n.right-n.left?_?n.left:n.right-d.width:_?Math.max(n.left,Math.min(u.left-(f?14:0)+g.x,n.right-m)):Math.min(Math.max(n.left,u.left-m+(f?14:0)-g.x),n.right-m),y=this.above[o];!s.strictSide&&(y?u.top-h-p-g.y<n.top:u.bottom+h+p+g.y>n.bottom)&&y==n.bottom-u.bottom>u.top-n.top&&(y=this.above[o]=!y);let b=(y?u.top-n.top:n.bottom-u.bottom)-p;if(b<h&&c.resize!==!1){if(b<this.view.defaultLineHeight){l.style.top=i_;continue}l_.set(c,h),l.style.height=(h=b)/i+`px`}else l.style.height&&(l.style.height=``);let x=y?u.top-h-p-g.y:u.bottom+p+g.y,S=v+m;if(c.overlap!==!0)for(let e of a)e.left<S&&e.right>v&&e.top<x+h&&e.bottom>x&&(x=y?e.top-h-2-p:e.bottom+p+2);if(this.position==`absolute`?(l.style.top=(x-e.parent.top)/i+`px`,d_(l,(v-e.parent.left)/r)):(l.style.top=x/i+`px`,d_(l,(v-e.fixedLeft)/r)),f){let e=u.left+(_?g.x:-g.x)-(v+14-7);f.style.left=e/r+`px`}c.overlap!==!0&&a.push({left:v,top:x,right:S,bottom:x+h}),l.classList.toggle(`cm-tooltip-above`,y),l.classList.toggle(`cm-tooltip-below`,!y),c.positioned&&c.positioned(e.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let e of this.manager.tooltipViews)e.dom.style.top=i_}},{eventObservers:{scroll(){this.maybeMeasure()}}});function d_(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+`px`)}var f_=J.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`}}}),p_={x:0,y:0},m_=K.define({enables:[u_,f_]}),h_=K.define({combine(e){let t,n;for(let r of e)t||=r.topContainer,n||=r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function g_(e,t){let n=e.plugin(__),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}var __=pp.fromClass(class{constructor(e){this.input=e.state.facet(b_),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(h_);this.top=new v_(e,!0,t.topContainer),this.bottom=new v_(e,!1,t.bottomContainer),this.top.sync(this.panels.filter(e=>e.top)),this.bottom.sync(this.panels.filter(e=>!e.top));for(let e of this.panels)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}update(e){let t=e.state.facet(h_);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new v_(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new v_(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(b_);if(n!=this.input){let t=n.filter(e=>e),r=[],i=[],a=[],o=[];for(let n of t){let t=this.specs.indexOf(n),s;t<0?(s=n(e.view),o.push(s)):(s=this.panels[t],s.update&&s.update(e)),r.push(s),(s.top?i:a).push(s)}this.specs=t,this.panels=r,this.top.sync(i),this.bottom.sync(a);for(let e of o)e.dom.classList.add(`cm-panel`),e.mount&&e.mount()}else for(let t of this.panels)t.update&&t.update(e)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:e=>J.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})}),v_=class{constructor(e,t,n){this.view=e,this.top=t,this.container=n,this.dom=void 0,this.classes=``,this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&=(this.dom.remove(),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 e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=y_(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=y_(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 y_(e){let t=e.nextSibling;return e.remove(),t}var b_=K.define({enables:__}),x_=class extends Ru{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};x_.prototype.elementClass=``,x_.prototype.toDOM=void 0,x_.prototype.mapMode=Il.TrackBefore,x_.prototype.startSide=x_.prototype.endSide=-1,x_.prototype.point=!0;var S_=1024,C_=0,w_=class{constructor(e,t){this.from=e,this.to=t}},Y=class{constructor(e={}){this.id=C_++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw Error(`This node type doesn't define a deserialize function`)}),this.combine=e.combine||null}add(e){if(this.perNode)throw RangeError(`Can't add per-node props to node types`);return typeof e!=`function`&&(e=D_.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};Y.closedBy=new Y({deserialize:e=>e.split(` `)}),Y.openedBy=new Y({deserialize:e=>e.split(` `)}),Y.group=new Y({deserialize:e=>e.split(` `)}),Y.isolate=new Y({deserialize:e=>{if(e&&e!=`rtl`&&e!=`ltr`&&e!=`auto`)throw RangeError(`Invalid value for isolate: `+e);return e||`auto`}}),Y.contextHash=new Y({perNode:!0}),Y.lookAhead=new Y({perNode:!0}),Y.mounted=new Y({perNode:!0});var T_=class{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[Y.mounted.id]}},E_=Object.create(null),D_=class e{constructor(e,t,n,r=0){this.name=e,this.props=t,this.id=n,this.flags=r}static define(t){let n=t.props&&t.props.length?Object.create(null):E_,r=+!!t.top|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new e(t.name||``,n,t.id,r);if(t.props){for(let e of t.props)if(Array.isArray(e)||(e=e(i)),e){if(e[0].perNode)throw RangeError(`Can't store a per-node prop on a node type`);n[e[0].id]=e[1]}}return i}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(Y.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let n in e)for(let r of n.split(` `))t[r]=e[n];return e=>{for(let n=e.prop(Y.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};D_.none=new D_(``,Object.create(null),0,8);var O_=class e{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw RangeError(`Node type ids should correspond to array positions when creating a node set`)}extend(...t){let n=[];for(let e of this.types){let r=null;for(let n of t){let t=n(e);if(t){r||=Object.assign({},e.props);let n=t[1],i=t[0];i.combine&&i.id in r&&(n=i.combine(r[i.id],n)),r[i.id]=n}}n.push(r?new D_(e.name,r,e.id,e.flags):e)}return new e(n)}},k_=new WeakMap,A_=new WeakMap,j_;(function(e){e[e.ExcludeBuffers=1]=`ExcludeBuffers`,e[e.IncludeAnonymous=2]=`IncludeAnonymous`,e[e.IgnoreMounts=4]=`IgnoreMounts`,e[e.IgnoreOverlays=8]=`IgnoreOverlays`,e[e.EnterBracketed=16]=`EnterBracketed`})(j_||={});var M_=class e{constructor(e,t,n,r,i){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props[typeof e==`number`?e:e.id]=t}}toString(){let e=T_.get(this);if(e&&!e.overlay)return e.tree.toString();let t=``;for(let e of this.children){let n=e.toString();n&&(t&&(t+=`,`),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?`(`+t+`)`:``):t}cursor(e=0){return new K_(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new K_(k_.get(this)||this.topNode);return r.moveTo(e,t),k_.set(this,r._tree),r}get topNode(){return new R_(this,0,0,null)}resolve(e,t=0){let n=I_(k_.get(this)||this.topNode,e,t,!1);return k_.set(this,n),n}resolveInner(e,t=0){let n=I_(A_.get(this)||this.topNode,e,t,!0);return A_.set(this,n),n}resolveStack(e,t=0){return G_(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,a=e.mode||0,o=(a&j_.IncludeAnonymous)>0;for(let e=this.cursor(a|j_.IncludeAnonymous);;){let a=!1;if(e.from<=i&&e.to>=r&&(!o&&e.type.isAnonymous||t(e)!==!1)){if(e.firstChild())continue;a=!0}for(;a&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;a=!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(t={}){return this.children.length<=8?this:Z_(D_.none,this.children,this.positions,0,this.children.length,0,this.length,(t,n,r)=>new e(this.type,t,n,r,this.propValues),t.makeTree||((t,n,r)=>new e(D_.none,t,n,r)))}static build(e){return J_(e)}};M_.empty=new M_(D_.none,[],[],0);var N_=class e{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 e(this.buffer,this.index)}},P_=class e{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return D_.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(`,`)}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),e+=4,n==e)return i;let a=[];for(;e<n;)a.push(this.childString(e)),e=this.buffer[e+3];return i+`(`+a.join(`,`)+`)`}findChild(e,t,n,r,i){let{buffer:a}=this,o=-1;for(let s=e;s!=t&&!(F_(i,r,a[s+1],a[s+2])&&(o=s,n>0));s=a[s+3]);return o}slice(t,n,r){let i=this.buffer,a=new Uint16Array(n-t),o=0;for(let e=t,s=0;e<n;){a[s++]=i[e++],a[s++]=i[e++]-r;let n=a[s++]=i[e++]-r;a[s++]=i[e++]-t,o=Math.max(o,n)}return new e(a,o,this.set)}};function F_(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function I_(e,t,n,r){for(;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!r&&e instanceof R_&&e.index<0?null:e.parent;if(!t)return e;e=t}let i=r?0:j_.IgnoreOverlays;if(r)for(let r=e,a=r.parent;a;r=a,a=r.parent)r instanceof R_&&r.index<0&&a.enter(t,n,i)?.from!=r.from&&(e=a);for(;;){let r=e.enter(t,n,i);if(!r)return e;e=r}}var L_=class{cursor(e=0){return new K_(this,e)}getChild(e,t=null,n=null){let r=z_(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return z_(this,e,t,n)}resolve(e,t=0){return I_(this,e,t,!1)}resolveInner(e,t=0){return I_(this,e,t,!0)}matchContext(e){return B_(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}},R_=class e extends L_{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,r,i,a=0){for(let o=this;;){for(let{children:s,positions:c}=o._tree,l=n>0?s.length:-1;t!=l;t+=n){let l=s[t],u=c[t]+o.from,d;if(a&j_.EnterBracketed&&l instanceof M_&&(d=T_.get(l))&&!d.overlay&&d.bracketed&&r>=u&&r<=u+l.length||F_(i,r,u,u+l.length)){if(l instanceof P_){if(a&j_.ExcludeBuffers)continue;let e=l.findChild(0,l.buffer.length,n,r-u,i);if(e>-1)return new H_(new V_(o,l,t,u),null,e)}else if(a&j_.IncludeAnonymous||!l.type.isAnonymous||q_(l)){let s;if(!(a&j_.IgnoreMounts)&&(s=T_.get(l))&&!s.overlay)return new e(s.tree,u,t,o);let c=new e(l,u,t,o);return a&j_.IncludeAnonymous||!c.type.isAnonymous?c:c.nextChild(n<0?l.children.length-1:0,n,r,i,a)}}}if(a&j_.IncludeAnonymous||!o.type.isAnonymous||(t=o.index>=0?o.index+n:n<0?-1:o._parent._tree.children.length,o=o._parent,!o))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(t,n,r=0){let i;if(!(r&j_.IgnoreOverlays)&&(i=T_.get(this._tree))&&i.overlay){let a=t-this.from,o=r&j_.EnterBracketed&&i.bracketed;for(let{from:t,to:r}of i.overlay)if((n>0||o?t<=a:t<a)&&(n<0||o?r>=a:r>a))return new e(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}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 z_(e,t,n,r){let i=e.cursor(),a=[];if(!i.firstChild())return a;if(n!=null){for(let e=!1;!e;)if(e=i.type.is(n),!i.nextSibling())return a}for(;;){if(r!=null&&i.type.is(r))return a;if(i.type.is(t)&&a.push(i.node),!i.nextSibling())return r==null?a:[]}}function B_(e,t,n=t.length-1){for(let r=e;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(t[n]&&t[n]!=r.name)return!1;n--}}return!0}var V_=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},H_=class e extends L_{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(t,n,r){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.context.start,r);return a<0?null:new e(this.context,this,a)}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(t,n,r=0){if(r&j_.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return a<0?null:new e(this.context,this,a)}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:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new e(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new e(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let a=n.buffer[this.index+1];e.push(n.slice(r,i,a)),t.push(0)}return new M_(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function U_(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(i.from>n.from||i.to<n.to)&&(n=i,t=r)}let r=n instanceof R_&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new W_(i,n)}var W_=class{constructor(e,t){this.heads=e,this.node=t}get next(){return U_(this.heads)}};function G_(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof R_?r:r.context.parent;e;e=e.parent)if(e.index<0){let a=e.parent;(i||=[r]).push(a.resolve(t,n)),e=a}else{let a=T_.get(e.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new R_(a.tree,a.overlay[0].from+e.from,-1,e);(i||=[r]).push(I_(o,t,n,!1))}}return i?U_(i):r}var K_=class{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&~j_.EnterBracketed,e instanceof R_)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let t=e._parent;t;t=t._parent)this.stack.unshift(t.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:n,buffer:r}=this.buffer;return this.type=t||r.set.types[r.buffer[e]],this.from=n+r.buffer[e+1],this.to=n+r.buffer[e+2],!0}yield(e){return e?e instanceof R_?(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,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}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,n=this.mode){return this.buffer?n&j_.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&j_.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&j_.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,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&j_.IncludeAnonymous||e instanceof P_||!e.type.isAnonymous||q_(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)scan:for(let r=this.index,i=this.stack.length;i>=0;){for(let a=e;a;a=a._parent)if(a.index==r){if(r==this.index)return a;t=a,n=i+1;break scan}r=this.stack[--i]}for(let e=n;e<this.stack.length;e++)t=new H_(this.buffer,t,this.stack[e]);return this.bufferNode=new H_(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return B_(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return B_(this._tree,e,r);let a=n[t.buffer[this.stack[i]]];if(!a.isAnonymous){if(e[r]&&e[r]!=a.name)return!1;r--}}return!0}};function q_(e){return e.children.some(e=>e instanceof P_||!e.type.isAnonymous||q_(e))}function J_(e){let{buffer:t,nodeSet:n,maxBufferLength:r=S_,reused:i=[],minRepeatType:a=n.types.length}=e,o=Array.isArray(t)?new N_(t,t.length):t,s=n.types,c=0,l=0;function u(e,t,_,v,y,b){let{id:x,start:S,end:C,size:w}=o,T=l,ee=c;if(w<0){if(o.next(),w==-1){let t=i[x];_.push(t),v.push(S-e);return}if(w==-3){c=x;return}if(w==-4){l=x;return}throw RangeError(`Unrecognized record size: ${w}`)}let E=s[x],te,ne,re=S-e;if(C-S<=r&&(ne=h(o.pos-t,y))){let t=new Uint16Array(ne.size-ne.skip),r=o.pos-ne.size,i=t.length;for(;o.pos>r;)i=g(ne.start,t,i);te=new P_(t,C-ne.start,n),re=ne.start-e}else{let e=o.pos-w;o.next();let t=[],n=[],i=x>=a?x:-1,s=0,c=C,h=T;for(;o.pos>e;)i>=0&&o.id==i&&o.size>=0?(o.end<=c-r&&(p(t,n,S,s,o.end,c,i,h,ee),s=t.length,c=o.end,h=l),o.next()):b>2500?d(S,e,t,n):u(S,e,t,n,i,b+1);if(i>=0&&s>0&&s<t.length&&p(t,n,S,s,S,c,i,h,ee),t.reverse(),n.reverse(),i>-1&&s>0){let e=f(E,ee);te=Z_(E,t,n,0,t.length,0,C-S,e,e)}else te=m(E,t,n,C-S,T-C,ee)}_.push(te),v.push(re)}function d(e,t,i,a){let s=[],c=0,l=-1;for(;o.pos>t;){let{id:e,start:t,end:n,size:i}=o;if(i>4)o.next();else if(l>-1&&t<l)break;else l<0&&(l=n-r),s.push(e,t,n),c++,o.next()}if(c){let t=new Uint16Array(c*4),r=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-r,t[n++]=s[e+2]-r,t[n++]=n;i.push(new P_(t,s[2]-r,n)),a.push(r-e)}}function f(e,t){return(n,r,i)=>{let a=0,o=n.length-1,s,c;if(o>=0&&(s=n[o])instanceof M_){if(!o&&s.type==e&&s.length==i)return s;(c=s.prop(Y.lookAhead))&&(a=r[o]+s.length+c-i)}return m(e,n,r,i,a,t)}}function p(e,t,r,i,a,o,s,c,l){let u=[],d=[];for(;e.length>i;)u.push(e.pop()),d.push(t.pop()+r-a);e.push(m(n.types[s],u,d,o-a,c-o,l)),t.push(a-r)}function m(e,t,n,r,i,a,o){if(a){let e=[Y.contextHash,a];o=o?[e].concat(o):[e]}if(i>25){let e=[Y.lookAhead,i];o=o?[e].concat(o):[e]}return new M_(e,t,n,r,o)}function h(e,t){let n=o.fork(),i=0,s=0,c=0,l=n.end-r,u={size:0,start:0,skip:0};scan:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){u.size=i,u.start=s,u.skip=c,c+=4,i+=4,n.next();continue}let o=n.pos-e;if(e<0||o<r||n.start<l)break;let d=n.id>=a?4:0,f=n.start;for(n.next();n.pos>o;){if(n.size<0){if(n.size==-3||n.size==-4)d+=4;else break scan}else n.id>=a&&(d+=4);n.next()}s=f,i+=e,c+=d}return(t<0||i==e)&&(u.size=i,u.start=s,u.skip=c),u.size>4?u:void 0}function g(e,t,n){let{id:r,start:i,end:s,size:u}=o;if(o.next(),u>=0&&r<a){let a=n;if(u>4){let r=o.pos-(u-4);for(;o.pos>r;)n=g(e,t,n)}t[--n]=a,t[--n]=s-e,t[--n]=i-e,t[--n]=r}else u==-3?c=r:u==-4&&(l=r);return n}let _=[],v=[];for(;o.pos>0;)u(e.start||0,e.bufferStart||0,_,v,-1,0);let y=e.length??(_.length?v[0]+_[0].length:0);return new M_(s[e.topID],_.reverse(),v.reverse(),y)}var Y_=new WeakMap;function X_(e,t){if(!e.isAnonymous||t instanceof P_||t.type!=e)return 1;let n=Y_.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof M_)){n=1;break}n+=X_(e,r)}Y_.set(t,n)}return n}function Z_(e,t,n,r,i,a,o,s,c){let l=0;for(let n=r;n<i;n++)l+=X_(e,t[n]);let u=Math.ceil(l*1.5/8),d=[],f=[];function p(t,n,r,i,o){for(let s=r;s<i;){let r=s,l=n[s],m=X_(e,t[s]);for(s++;s<i;s++){let n=X_(e,t[s]);if(m+n>=u)break;m+=n}if(s==r+1){if(m>u){let e=t[r];p(e.children,e.positions,0,e.children.length,n[r]+o);continue}d.push(t[r])}else{let i=n[s-1]+t[s-1].length-l;d.push(Z_(e,t,n,r,s,l,i,null,c))}f.push(l+o-a)}}return p(t,n,r,i,0),(s||c)(d,f,o)}var Q_=class{constructor(){this.map=new WeakMap}setBuffer(e,t,n){let r=this.map.get(e);r||this.map.set(e,r=new Map),r.set(t,n)}getBuffer(e,t){let n=this.map.get(e);return n&&n.get(t)}set(e,t){e instanceof H_?this.setBuffer(e.context.buffer,e.index,t):e instanceof R_&&this.map.set(e.tree,t)}get(e){return e instanceof H_?this.getBuffer(e.context.buffer,e.index):e instanceof R_?this.map.get(e.tree):void 0}cursorSet(e,t){e.buffer?this.setBuffer(e.buffer.buffer,e.index,t):this.map.set(e.tree,t)}cursorGet(e){return e.buffer?this.getBuffer(e.buffer.buffer,e.index):this.map.get(e.tree)}},$_=class e{constructor(e,t,n,r,i=!1,a=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=!!i|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let i=[new e(0,t.length,t,0,!1,r)];for(let e of n)e.to>t.length&&i.push(e);return i}static applyChanges(t,n,r=128){if(!n.length)return t;let i=[],a=1,o=t.length?t[0]:null;for(let s=0,c=0,l=0;;s++){let u=s<n.length?n[s]:null,d=u?u.fromA:1e9;if(d-c>=r)for(;o&&o.from<d;){let n=o;if(c>=n.from||d<=n.to||l){let t=Math.max(n.from,c)-l,r=Math.min(n.to,d)-l;n=t>=r?null:new e(t,r,n.tree,n.offset+l,s>0,!!u)}if(n&&i.push(n),o.to>d)break;o=a<t.length?t[a++]:null}if(!u)break;c=u.toA,l=u.toA-u.toB}return i}},ev=class{startParse(e,t,n){return typeof e==`string`&&(e=new tv(e)),n=n?n.length?n.map(e=>new w_(e.from,e.to)):[new w_(0,0)]:[new w_(0,e.length)],this.createParse(e,t||[],n)}parse(e,t,n){let r=this.startParse(e,t,n);for(;;){let e=r.advance();if(e)return e}}},tv=class{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)}};function nv(e){return(t,n,r,i)=>new sv(t,e,n,r,i)}var rv=class{constructor(e,t,n,r,i,a){this.parser=e,this.parse=t,this.overlay=n,this.bracketed=r,this.target=i,this.from=a}};function iv(e){if(!e.length||e.some(e=>e.from>=e.to))throw RangeError(`Invalid inner parse ranges given: `+JSON.stringify(e))}var av=class{constructor(e,t,n,r,i,a,o,s){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=i,this.bracketed=a,this.target=o,this.prev=s,this.depth=0,this.ranges=[]}},ov=new Y({perNode:!0}),sv=class{constructor(e,t,n,r,i){this.nest=t,this.input=n,this.fragments=r,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),this.stoppedAt!=null)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return this.stoppedAt!=null&&(e=new M_(e.type,e.children,e.positions,e.length,e.propValues.concat([[ov,this.stoppedAt]]))),e}let e=this.inner[this.innerDone],t=e.parse.advance();if(t){this.innerDone++;let n=Object.assign(Object.create(null),e.target.props);n[Y.mounted.id]=new T_(t,e.overlay,e.parser,e.bracketed),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new fv(this.fragments),t=null,n=null,r=new K_(new R_(this.baseTree,this.ranges[0].from,0,null),j_.IncludeAnonymous|j_.IgnoreMounts);scan:for(let i,a;;){let o=!0,s;if(this.stoppedAt!=null&&r.from>=this.stoppedAt)o=!1;else if(e.hasNode(r)){if(t){let e=t.mounts.find(e=>e.frag.from<=r.from&&e.frag.to>=r.to&&e.mount.overlay);if(e)for(let n of e.mount.overlay){let i=n.from+e.pos,a=n.to+e.pos;i>=r.from&&a<=r.to&&!t.ranges.some(e=>e.from<a&&e.to>i)&&t.ranges.push({from:i,to:a})}}o=!1}else if(n&&(a=cv(n.ranges,r.from,r.to)))o=a!=2;else if(!r.type.isAnonymous&&(i=this.nest(r,this.input))&&(r.from<r.to||!i.overlay)){r.tree||(uv(r),t&&t.depth++,n&&n.depth++);let a=e.findMounts(r.from,i.parser);if(typeof i.overlay==`function`)t=new av(i.parser,i.overlay,a,this.inner.length,r.from,!!i.bracketed,r.tree,t);else{let e=pv(this.ranges,i.overlay||(r.from<r.to?[new w_(r.from,r.to)]:[]));e.length&&iv(e),(e.length||!i.overlay)&&this.inner.push(new rv(i.parser,e.length?i.parser.startParse(this.input,hv(a,e),e):i.parser.startParse(``),i.overlay?i.overlay.map(e=>new w_(e.from-r.from,e.to-r.from)):null,!!i.bracketed,r.tree,e.length?e[0].from:r.from)),i.overlay?e.length&&(n={ranges:e,depth:0,prev:n}):o=!1}}else if(t&&(s=t.predicate(r))&&(s===!0&&(s=new w_(r.from,r.to)),s.from<s.to)){let e=t.ranges.length-1;e>=0&&t.ranges[e].to==s.from?t.ranges[e]={from:t.ranges[e].from,to:s.to}:t.ranges.push(s)}if(o&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break scan;if(t&&!--t.depth){let e=pv(this.ranges,t.ranges);e.length&&(iv(e),this.inner.splice(t.index,0,new rv(t.parser,t.parser.startParse(this.input,hv(t.mounts,e),e),t.ranges.map(e=>new w_(e.from-t.start,e.to-t.start)),t.bracketed,t.target,e[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}};function cv(e,t,n){for(let r of e){if(r.from>=n)break;if(r.to>t)return r.from<=t&&r.to>=n?2:1}return 0}function lv(e,t,n,r,i,a){if(t<n){let o=e.buffer[t+1];r.push(e.slice(t,n,o)),i.push(o-a)}}function uv(e){let{node:t}=e,n=[],r=t.context.buffer;do n.push(e.index),e.parent();while(!e.tree);let i=e.tree,a=i.children.indexOf(r),o=i.children[a],s=o.buffer,c=[a];function l(e,r,i,a,u,d){let f=n[d],p=[],m=[];lv(o,e,f,p,m,a);let h=s[f+1],g=s[f+2];c.push(p.length);let _=d?l(f+4,s[f+3],o.set.types[s[f]],h,g-h,d-1):t.toTree();return p.push(_),m.push(h-a),lv(o,s[f+3],r,p,m,a),new M_(i,p,m,u)}i.children[a]=l(0,s.length,D_.none,0,o.length,n.length-1);for(let t of c){let n=e.tree.children[t],r=e.tree.positions[t];e.yield(new R_(n,r+e.from,t,e._tree))}}var dv=class{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(j_.IncludeAnonymous|j_.IgnoreMounts|j_.ExcludeBuffers)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)if(!(t.to>=n&&t.enter(n,1,j_.IncludeAnonymous|j_.IgnoreOverlays|j_.ExcludeBuffers))){if(t.to<=n)t.next(!1)||(this.done=!0);else break}}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof M_)t=t.children[0];else break}return!1}},fv=class{constructor(e){if(this.fragments=e,this.curTo=0,this.fragI=0,e.length){let t=this.curFrag=e[0];this.curTo=t.tree.prop(ov)??t.to,this.inner=new dv(t.tree,-t.offset)}else this.curFrag=this.inner=null}hasNode(e){for(;this.curFrag&&e.from>=this.curTo;)this.nextFrag();return this.curFrag&&this.curFrag.from<=e.from&&this.curTo>=e.to&&this.inner.hasNode(e)}nextFrag(){if(this.fragI++,this.fragI==this.fragments.length)this.curFrag=this.inner=null;else{let e=this.curFrag=this.fragments[this.fragI];this.curTo=e.tree.prop(ov)??e.to,this.inner=new dv(e.tree,-e.offset)}}findMounts(e,t){let n=[];if(this.inner){this.inner.cursor.moveTo(e,1);for(let e=this.inner.cursor.node;e;e=e.parent){let r=e.tree?.prop(Y.mounted);if(r&&r.parser==t)for(let t=this.fragI;t<this.fragments.length;t++){let i=this.fragments[t];if(i.from>=e.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:e.from-i.offset,mount:r})}}}return n}};function pv(e,t){let n=null,r=t;for(let i=1,a=0;i<e.length;i++){let o=e[i-1].to,s=e[i].from;for(;a<r.length;a++){let e=r[a];if(e.from>=s)break;e.to<=o||(n||(r=n=t.slice()),e.from<o?(n[a]=new w_(e.from,o),e.to>s&&n.splice(a+1,0,new w_(s,e.to))):e.to>s?n[a--]=new w_(s,e.to):n.splice(a--,1))}}return r}function mv(e,t,n,r){let i=0,a=0,o=!1,s=!1,c=-1e9,l=[];for(;;){let u=i==e.length?1e9:o?e[i].to:e[i].from,d=a==t.length?1e9:s?t[a].to:t[a].from;if(o!=s){let e=Math.max(c,n),t=Math.min(u,d,r);e<t&&l.push(new w_(e,t))}if(c=Math.min(u,d),c==1e9)break;u==c&&(o?(o=!1,i++):o=!0),d==c&&(s?(s=!1,a++):s=!0)}return l}function hv(e,t){let n=[];for(let{pos:r,mount:i,frag:a}of e){let e=r+(i.overlay?i.overlay[0].from:0),o=e+i.tree.length,s=Math.max(a.from,e),c=Math.min(a.to,o);if(i.overlay){let o=mv(t,i.overlay.map(e=>new w_(e.from+r,e.to+r)),s,c);for(let t=0,r=s;;t++){let s=t==o.length,l=s?c:o[t].from;if(l>r&&n.push(new $_(r,l,i.tree,-e,a.from>=r||a.openStart,a.to<=l||a.openEnd)),s)break;r=o[t].to}}else n.push(new $_(s,c,i.tree,-e,a.from>=e||a.openStart,a.to<=o||a.openEnd))}return n}var gv=0,_v=class e{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=gv++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(t,n){let r=typeof t==`string`?t:`?`;if(t instanceof e&&(n=t),n?.base)throw Error(`Can not derive from a modified tag`);let i=new e(r,[],null,[]);if(i.set.push(i),n)for(let e of n.set)i.set.push(e);return i}static defineModifier(e){let t=new yv(e);return e=>e.modified.indexOf(t)>-1?e:yv.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}},vv=0,yv=class e{constructor(e){this.name=e,this.instances=[],this.id=vv++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(e=>e.base==t&&bv(n,e.modified));if(r)return r;let i=[],a=new _v(t.name,i,t,n);for(let e of n)e.instances.push(a);let o=xv(n);for(let n of t.set)if(!n.modified.length)for(let t of o)i.push(e.get(n,t));return a}};function bv(e,t){return e.length==t.length&&e.every((e,n)=>e==t[n])}function xv(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,i=t.length;r<i;r++)t.push(t[r].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}function Sv(e){let t=Object.create(null);for(let n in e){let r=e[n];Array.isArray(r)||(r=[r]);for(let e of n.split(` `))if(e){let n=[],i=2,a=e;for(let t=0;;){if(a==`...`&&t>0&&t+3==e.length){i=1;break}let r=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(a);if(!r)throw RangeError(`Invalid path: `+e);if(n.push(r[0]==`*`?``:r[0][0]==`"`?JSON.parse(r[0]):r[0]),t+=r[0].length,t==e.length)break;let o=e[t++];if(t==e.length&&o==`!`){i=0;break}if(o!=`/`)throw RangeError(`Invalid path: `+e);a=e.slice(t)}let o=n.length-1,s=n[o];if(!s)throw RangeError(`Invalid path: `+e);t[s]=new wv(r,i,o>0?n.slice(0,o):null).sort(t[s])}}return Cv.add(t)}var Cv=new Y({combine(e,t){let n,r,i;for(;e||t;){if(!e||t&&e.depth<=t.depth?(i=t,t=t.next):(i=e,e=e.next),n&&n.mode==i.mode&&!i.context&&!n.context)continue;let a=new wv(i.tags,i.mode,i.context);n?n.next=a:r=a,n=a}return r}}),wv=class{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}};wv.empty=new wv([],2,null);function Tv(e,t){let n=Object.create(null);for(let t of e)if(!Array.isArray(t.tag))n[t.tag.id]=t.class;else for(let e of t.tag)n[e.id]=t.class;let{scope:r,all:i=null}=t||{};return{style:e=>{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+` `+r:r;break}}return t},scope:r}}function Ev(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+` `+e:e)}return n}function Dv(e,t,n,r=0,i=e.length){let a=new Ov(r,Array.isArray(t)?t:[t],n);a.highlightRange(e.cursor(),r,i,``,a.highlighters),a.flush(i)}var Ov=class{constructor(e,t,n){this.at=e,this.highlighters=t,this.span=n,this.class=``}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,n,r,i){let{type:a,from:o,to:s}=e;if(o>=n||s<=t)return;a.isTop&&(i=this.highlighters.filter(e=>!e.scope||e.scope(a)));let c=r,l=kv(e)||wv.empty,u=Ev(i,l.tags);if(u&&(c&&(c+=` `),c+=u,l.mode==1&&(r+=(r?` `:``)+u)),this.startSpan(Math.max(t,o),c),l.opaque)return;let d=e.tree&&e.tree.prop(Y.mounted);if(d&&d.overlay){let a=e.node.enter(d.overlay[0].from+o,1),l=this.highlighters.filter(e=>!e.scope||e.scope(d.tree.type)),u=e.firstChild();for(let f=0,p=o;;f++){let m=f<d.overlay.length?d.overlay[f]:null,h=m?m.from+o:s,g=Math.max(t,p),_=Math.min(n,h);if(g<_&&u)for(;e.from<_&&(this.highlightRange(e,g,_,r,i),this.startSpan(Math.min(_,e.to),c),!(e.to>=h||!e.nextSibling())););if(!m||h>n)break;p=m.to+o,p>t&&(this.highlightRange(a.cursor(),Math.max(t,m.from+o),Math.min(n,p),``,l),this.startSpan(Math.min(n,p),c))}u&&e.parent()}else if(e.firstChild()){d&&(r=``);do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}};function kv(e){let t=e.type.prop(Cv);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var X=_v.define,Av=X(),jv=X(),Mv=X(jv),Nv=X(jv),Pv=X(),Fv=X(Pv),Iv=X(Pv),Lv=X(),Rv=X(Lv),zv=X(),Bv=X(),Vv=X(),Hv=X(Vv),Uv=X(),Z={comment:Av,lineComment:X(Av),blockComment:X(Av),docComment:X(Av),name:jv,variableName:X(jv),typeName:Mv,tagName:X(Mv),propertyName:Nv,attributeName:X(Nv),className:X(jv),labelName:X(jv),namespace:X(jv),macroName:X(jv),literal:Pv,string:Fv,docString:X(Fv),character:X(Fv),attributeValue:X(Fv),number:Iv,integer:X(Iv),float:X(Iv),bool:X(Pv),regexp:X(Pv),escape:X(Pv),color:X(Pv),url:X(Pv),keyword:zv,self:X(zv),null:X(zv),atom:X(zv),unit:X(zv),modifier:X(zv),operatorKeyword:X(zv),controlKeyword:X(zv),definitionKeyword:X(zv),moduleKeyword:X(zv),operator:Bv,derefOperator:X(Bv),arithmeticOperator:X(Bv),logicOperator:X(Bv),bitwiseOperator:X(Bv),compareOperator:X(Bv),updateOperator:X(Bv),definitionOperator:X(Bv),typeOperator:X(Bv),controlOperator:X(Bv),punctuation:Vv,separator:X(Vv),bracket:Hv,angleBracket:X(Hv),squareBracket:X(Hv),paren:X(Hv),brace:X(Hv),content:Lv,heading:Rv,heading1:X(Rv),heading2:X(Rv),heading3:X(Rv),heading4:X(Rv),heading5:X(Rv),heading6:X(Rv),contentSeparator:X(Lv),list:X(Lv),quote:X(Lv),emphasis:X(Lv),strong:X(Lv),link:X(Lv),monospace:X(Lv),strikethrough:X(Lv),inserted:X(),deleted:X(),changed:X(),invalid:X(),meta:Uv,documentMeta:X(Uv),annotation:X(Uv),processingInstruction:X(Uv),definition:_v.defineModifier(`definition`),constant:_v.defineModifier(`constant`),function:_v.defineModifier(`function`),standard:_v.defineModifier(`standard`),local:_v.defineModifier(`local`),special:_v.defineModifier(`special`)};for(let e in Z){let t=Z[e];t instanceof _v&&(t.name=e)}Tv([{tag:Z.link,class:`tok-link`},{tag:Z.heading,class:`tok-heading`},{tag:Z.emphasis,class:`tok-emphasis`},{tag:Z.strong,class:`tok-strong`},{tag:Z.keyword,class:`tok-keyword`},{tag:Z.atom,class:`tok-atom`},{tag:Z.bool,class:`tok-bool`},{tag:Z.url,class:`tok-url`},{tag:Z.labelName,class:`tok-labelName`},{tag:Z.inserted,class:`tok-inserted`},{tag:Z.deleted,class:`tok-deleted`},{tag:Z.literal,class:`tok-literal`},{tag:Z.string,class:`tok-string`},{tag:Z.number,class:`tok-number`},{tag:[Z.regexp,Z.escape,Z.special(Z.string)],class:`tok-string2`},{tag:Z.variableName,class:`tok-variableName`},{tag:Z.local(Z.variableName),class:`tok-variableName tok-local`},{tag:Z.definition(Z.variableName),class:`tok-variableName tok-definition`},{tag:Z.special(Z.variableName),class:`tok-variableName2`},{tag:Z.definition(Z.propertyName),class:`tok-propertyName tok-definition`},{tag:Z.typeName,class:`tok-typeName`},{tag:Z.namespace,class:`tok-namespace`},{tag:Z.className,class:`tok-className`},{tag:Z.macroName,class:`tok-macroName`},{tag:Z.propertyName,class:`tok-propertyName`},{tag:Z.operator,class:`tok-operator`},{tag:Z.comment,class:`tok-comment`},{tag:Z.meta,class:`tok-meta`},{tag:Z.invalid,class:`tok-invalid`},{tag:Z.punctuation,class:`tok-punctuation`}]);function Wv(e,t,n,r=0,i=0){t??(t=e.search(/[^\s\u00a0]/),t==-1&&(t=e.length));let a=i;for(let i=r;i<t;i++)e.charCodeAt(i)==9?a+=n-a%n:a++;return a}var Gv=class{constructor(e,t,n,r){this.string=e,this.tabSize=t,this.indentUnit=n,this.overrideIndent=r,this.pos=0,this.start=0,this.lastColumnPos=0,this.lastColumnValue=0}eol(){return this.pos>=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)}eat(e){let t=this.string.charAt(this.pos),n;if(n=typeof e==`string`?t==e:t&&(e instanceof RegExp?e.test(t):e(t)),n)return++this.pos,t}eatWhile(e){let t=this.pos;for(;this.eat(e););return this.pos>t}eatSpace(){let e=this.pos;for(;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e}skipToEnd(){this.pos=this.string.length}skipTo(e){let t=this.string.indexOf(e,this.pos);if(t>-1)return this.pos=t,!0}backUp(e){this.pos-=e}column(){return this.lastColumnPos<this.start&&(this.lastColumnValue=Wv(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue}indentation(){return this.overrideIndent??Wv(this.string,null,this.tabSize)}match(e,t,n){if(typeof e==`string`){let r=e=>n?e.toLowerCase():e;return r(this.string.substr(this.pos,e.length))==r(e)?(t!==!1&&(this.pos+=e.length),!0):null}{let n=this.string.slice(this.pos).match(e);return n&&n.index>0?null:(n&&t!==!1&&(this.pos+=n[0].length),n)}}current(){return this.string.slice(this.start,this.pos)}},Kv=new Y;function qv(e){return K.define({combine:e?t=>t.concat(e):void 0})}var Jv=new Y,Yv=class{constructor(e,t,n=[],r=``){this.data=e,this.name=r,Iu.prototype.hasOwnProperty(`tree`)||Object.defineProperty(Iu.prototype,"tree",{get(){return Qv(this)}}),this.parser=t,this.extension=[cy.of(this),Iu.languageData.of((e,t,n)=>{let r=Xv(e,t,n),i=r.type.prop(Kv);if(!i)return[];let a=e.facet(i),o=r.type.prop(Jv);if(o){let i=r.resolve(t-r.from,n);for(let t of o)if(t.test(i,e)){let n=e.facet(t.facet);return t.type==`replace`?n:n.concat(a)}}return a})].concat(n)}isActiveAt(e,t,n=-1){return Xv(e,t,n).type.prop(Kv)==this.data}findRegions(e){let t=e.facet(cy);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let n=[],r=(e,t)=>{if(e.prop(Kv)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(Y.mounted);if(i){if(i.tree.prop(Kv)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let i=e.children[n];i instanceof M_&&r(i,e.positions[n]+t)}};return r(Qv(e),0),n}get allowsNesting(){return!0}};Yv.setState=xu.define();function Xv(e,t,n){let r=e.facet(cy),i=Qv(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,j_.ExcludeBuffers|j_.EnterBracketed))e.type.isTop&&(i=e);return i}var Zv=class e extends Yv{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(t){let n=qv(t.languageData);return new e(n,t.parser.configure({props:[Kv.add(e=>e.isTop?n:void 0)]}),t.name)}configure(t,n){return new e(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function Qv(e){let t=e.field(Yv.state,!1);return t?t.tree:M_.empty}function $v(e,t,n=50){let r=e.field(Yv.state,!1)?.context;if(!r)return null;let i=r.viewport;r.updateViewport({from:0,to:t});let a=r.isDone(t)||r.work(n,t)?r.tree:null;return r.updateViewport(i),a}var ey=class{constructor(e){this.doc=e,this.cursorPos=0,this.string=``,this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}},ty=null,ny=class e{constructor(e,t,n=[],r,i,a,o,s){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=a,this.skipped=o,this.scheduleOn=s,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new e(t,n,[],M_.empty,0,r,[],null)}startParse(){return this.parser.startParse(new ey(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=M_.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{if(typeof e==`number`){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||=this.startParse(),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let n=this.parse.advance();if(n){if(this.fragments=this.withoutTempSkipped($_.addTree(n,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=this.parse.stoppedAt??this.state.doc.length,this.tree=n,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=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($_.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=ty;ty=this;try{return e()}finally{ty=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=ry(e,t.from,t.to);return e}changes(t,n){let{fragments:r,tree:i,treeLen:a,viewport:o,skipped:s}=this;if(this.takeTree(),!t.empty){let e=[];if(t.iterChangedRanges((t,n,r,i)=>e.push({fromA:t,toA:n,fromB:r,toB:i})),r=$_.applyChanges(r,e),i=M_.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){s=[];for(let e of this.skipped){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);n<r&&s.push({from:n,to:r})}}}return new e(this.parser,n,r,i,a,o,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:r}=this.skipped[t];n<e.to&&r>e.from&&(this.fragments=ry(this.fragments,n,r),this.skipped.splice(t--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&=(this.takeTree(),null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends ev{createParse(t,n,r){let i=r[0].from,a=r[r.length-1].to;return{parsedPos:i,advance(){let t=ty;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=a,new M_(D_.none,[],[],a-i)},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 ty}};function ry(e,t,n){return $_.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var iy=class e{constructor(e){this.context=e,this.tree=e.tree}apply(t){if(!t.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(t.changes,t.state),r=this.context.treeLen==t.startState.doc.length?void 0:Math.max(t.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new e(n)}static init(t){let n=Math.min(3e3,t.doc.length),r=ny.create(t.facet(cy).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}};Yv.state=eu.define({create:iy.init,update(e,t){for(let e of t.effects)if(e.is(Yv.setState))return e.value;return t.startState.facet(cy)==t.state.facet(cy)?e.apply(t):iy.init(t.state)}});var ay=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<`u`&&(ay=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});var oy=typeof navigator<`u`&&navigator.scheduling?.isInputPending?()=>navigator.scheduling.isInputPending():null,sy=pp.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(Yv.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(Yv.state);t.tree==t.context.tree&&t.context.isDone(e.doc.length)||(this.working=ay(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,i=n.field(Yv.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!oy?Math.max(25,e.timeRemaining()-5):1e9),o=i.context.treeLen<r&&n.doc.length>r+1e3,s=i.context.work(()=>oy&&oy()||Date.now()>a,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(s||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:Yv.setState.of(new iy(i.context))})),this.chunkBudget>0&&(!s||o)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&=(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(e=>lp(this.view.state,e)).then(()=>this.workScheduled--),null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),cy=K.define({combine(e){return e.length?e[0]:null},enables:e=>[Yv.state,sy,J.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),ly=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},uy=class e{constructor(e,t,n,r,i,a=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=r,this.loadFunc=i,this.support=a,this.loading=null}load(){return this.loading||=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e})}static of(t){let{load:n,support:r}=t;if(!n){if(!r)throw RangeError(`Must pass either 'load' or 'support' to LanguageDescription.of`);n=()=>Promise.resolve(r)}return new e(t.name,(t.alias||[]).concat(t.name).map(e=>e.toLowerCase()),t.extensions||[],t.filename,n,r)}static matchFilename(e,t){for(let n of e)if(n.filename&&n.filename.test(t))return n;let n=/\.([^.]+)$/.exec(t);if(n){for(let t of e)if(t.extensions.indexOf(n[1])>-1)return t}return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let n of e)if(n.alias.some(e=>e==t))return n;if(n)for(let n of e)for(let e of n.alias){let r=t.indexOf(e);if(r>-1&&(e.length>2||!/\w/.test(t[r-1])&&!/\w/.test(t[r+e.length])))return n}return null}},dy=K.define(),fy=K.define({combine:e=>{if(!e.length)return` `;let t=e[0];if(!t||/\S/.test(t)||Array.from(t).some(e=>e!=t[0]))throw Error(`Invalid indent unit: `+JSON.stringify(e[0]));return t}});function py(e){let t=e.facet(fy);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function my(e,t){let n=``,r=e.tabSize,i=e.facet(fy)[0];if(i==` `){for(;t>=r;)n+=` `,t-=r;i=` `}for(let e=0;e<t;e++)n+=i;return n}function hy(e,t){e instanceof Iu&&(e=new gy(e));for(let n of e.state.facet(dy)){let r=n(e,t);if(r!==void 0)return r}let n=Qv(e.state);return n.length>=t?vy(e,n,t):null}var gy=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=py(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return r!=null&&r>=n.from&&r<=n.to?i&&r==e?{text:``,from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return``;let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.countColumn(n,e-r),a=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return a>-1&&(i+=a-this.countColumn(n,n.search(/\S|$/))),i}countColumn(e,t=e.length){return rd(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.options.overrideIndentation;if(i){let e=i(r);if(e>-1)return e}return this.countColumn(n,n.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},_y=new Y;function vy(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t&&!(t.from<r.node.from||t.to>r.node.to||t.from==r.node.from&&t.type==r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return yy(r,e,n)}function yy(e,t,n){for(let r=e;r;r=r.next){let e=xy(r.node);if(e)return e(Cy.create(t,n,r))}return 0}function by(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function xy(e){let t=e.type.prop(_y);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(Y.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>Dy(e,!0,1,void 0,n&&!by(e)?t.from:void 0)}return e.parent==null?Sy:null}function Sy(){return 0}var Cy=class e extends gy{constructor(e,t,n){super(e.state,e.options),this.base=e,this.pos=t,this.context=n}get node(){return this.context.node}static create(t,n,r){return new e(t,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let n=e.resolve(t.from);for(;n.parent&&n.parent.from==n.from;)n=n.parent;if(wy(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return yy(this.context.next,this.base,this.pos)}};function wy(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function Ty(e){let t=e.node,n=t.childAfter(t.from),r=t.lastChild;if(!n)return null;let i=e.options.simulateBreak,a=e.state.doc.lineAt(n.from),o=i==null||i<=a.from?a.to:Math.min(a.to,i);for(let e=n.to;;){let i=t.childAfter(e);if(!i||i==r)return null;if(!i.type.isSkipped){if(i.from>=o)return null;let e=/^ */.exec(a.text.slice(n.to-a.from))[0].length;return{from:n.from,to:n.to+e}}e=i.to}}function Ey({closing:e,align:t=!0,units:n=1}){return r=>Dy(r,t,n,e)}function Dy(e,t,n,r,i){let a=e.textAfter,o=a.match(/^\s*/)[0].length,s=r&&a.slice(o,o+r.length)==r||i==e.pos+o,c=t?Ty(e):null;return c?s?e.column(c.from):e.column(c.to):e.baseIndent+(s?0:e.unit*n)}var Oy=e=>e.baseIndent;function ky({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}var Ay=K.define(),jy=new Y;function My(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}function Ny(e,t,n){let r=Qv(e);if(r.length<n)return null;let i=r.resolveStack(n,1),a=null;for(let o=i;o;o=o.next){let i=o.node;if(i.to<=n||i.from>n)continue;if(a&&i.from<t)break;let s=i.type.prop(jy);if(s&&(i.to<r.length-50||r.length==e.doc.length||!Py(i))){let r=s(i,e);r&&r.from<=n&&r.from>=t&&r.to>n&&(a=r)}}return a}function Py(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function Fy(e,t,n){for(let r of e.facet(Ay)){let i=r(e,t,n);if(i)return i}return Ny(e,t,n)}function Iy(e,t){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);return n>=r?void 0:{from:n,to:r}}var Ly=xu.define({map:Iy}),Ry=xu.define({map:Iy});function zy(e){let t=[];for(let{head:n}of e.state.selection.ranges)t.some(e=>e.from<=n&&e.to>=n)||t.push(e.lineBlockAt(n));return t}var By=eu.define({create(){return Bd.none},update(e,t){t.isUserEvent(`delete`)&&t.changes.iterChangedRanges((t,n)=>e=Vy(e,t,n)),e=e.map(t.changes);let n=[];for(let r of t.effects)r.is(Ly)&&!Uy(e,r.value.from,r.value.to)?n.push(r.value):r.is(Ry)&&(e=e.update({filter:(e,t)=>r.value.from!=e||r.value.to!=t,filterFrom:r.value.from,filterTo:r.value.to}));if(n.length){let{preparePlaceholder:r}=t.state.facet(Jy),i=n.map(e=>(r?Bd.replace({widget:new Qy(r(t.state,e))}):Zy).range(e.from,e.to));e=e.update({add:i})}return t.selection&&(e=Vy(e,t.selection.main.head)),e},provide:e=>J.decorations.from(e),toJSON(e,t){let n=[];return e.between(0,t.doc.length,(e,t)=>{n.push(e,t)}),n},fromJSON(e){if(!Array.isArray(e)||e.length%2)throw RangeError(`Invalid JSON for fold state`);let t=[];for(let n=0;n<e.length;){let r=e[n++],i=e[n++];if(typeof r!=`number`||typeof i!=`number`)throw RangeError(`Invalid JSON for fold state`);t.push(Zy.range(r,i))}return Bd.set(t,!0)}});function Vy(e,t,n=t){let r=!1;return e.between(t,n,(e,i)=>{e<n&&i>t&&(r=!0)}),r?e.update({filterFrom:t,filterTo:n,filter:(e,r)=>e>=n||r<=t}):e}function Hy(e,t,n){var r;let i=null;return(r=e.field(By,!1))==null||r.between(t,n,(e,t)=>{(!i||i.from>e)&&(i={from:e,to:t})}),i}function Uy(e,t,n){let r=!1;return e.between(t,t,(e,i)=>{e==t&&i==n&&(r=!0)}),r}function Wy(e,t){return e.field(By,!1)?t:t.concat(xu.appendConfig.of(Yy()))}var Gy=e=>{for(let t of zy(e)){let n=Fy(e.state,t.from,t.to);if(n)return e.dispatch({effects:Wy(e.state,[Ly.of(n),Ky(e,n)])}),!0}return!1};function Ky(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return J.announce.of(`${e.state.phrase(n?`Folded lines`:`Unfolded lines`)} ${r} ${e.state.phrase(`to`)} ${i}.`)}var qy={placeholderDOM:null,preparePlaceholder:null,placeholderText:`…`},Jy=K.define({combine(e){return Lu(e,qy)}});function Yy(e){let t=[By,$y];return e&&t.push(Jy.of(e)),t}function Xy(e,t){let{state:n}=e,r=n.facet(Jy),i=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=Hy(e.state,n.from,n.to);r&&e.dispatch({effects:Ry.of(r)}),t.preventDefault()};if(r.placeholderDOM)return r.placeholderDOM(e,i,t);let a=document.createElement(`span`);return a.textContent=r.placeholderText,a.setAttribute(`aria-label`,n.phrase(`folded code`)),a.title=n.phrase(`unfold`),a.className=`cm-foldPlaceholder`,a.onclick=i,a}var Zy=Bd.replace({widget:new class extends Rd{toDOM(e){return Xy(e,null)}}}),Qy=class extends Rd{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return Xy(e,this.value)}},$y=J.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`}}),eb=class e{constructor(e,t){this.specs=e;let n;function r(e){let t=ld.newName();return(n||=Object.create(null))[`.`+t]=e,t}let i=typeof t.all==`string`?t.all:t.all?r(t.all):void 0,a=t.scope;this.scope=a instanceof Yv?e=>e.prop(Kv)==a.data:a?e=>e==a:void 0,this.style=Tv(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new ld(n):null,this.themeType=t.themeType}static define(t,n){return new e(t,n||{})}},tb=K.define(),nb=K.define({combine(e){return e.length?[e[0]]:null}});function rb(e){let t=e.facet(tb);return t.length?t:e.facet(nb)}function ib(e,t){let n=[ob],r;return e instanceof eb&&(e.module&&n.push(J.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push(nb.of(e)):r?n.push(tb.computeN([J.darkTheme],t=>t.facet(J.darkTheme)==(r==`dark`)?[e]:[])):n.push(tb.of(e)),n}var ab=class{constructor(e){this.markCache=Object.create(null),this.tree=Qv(e.state),this.decorations=this.buildDeco(e,rb(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=Qv(e.state),n=rb(e.state),r=n!=rb(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!r&&t.type==this.tree.type&&a>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return Bd.none;let n=new Ku;for(let{from:r,to:i}of e.visibleRanges)Dv(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=Bd.mark({class:r})))},r,i);return n.finish()}},ob=ru.high(pp.fromClass(ab,{decorations:e=>e.decorations}));Z.meta,Z.link,Z.heading,Z.emphasis,Z.strong,Z.strikethrough,Z.keyword,Z.atom,Z.bool,Z.url,Z.contentSeparator,Z.labelName,Z.literal,Z.inserted,Z.string,Z.deleted,Z.regexp,Z.escape,Z.string,Z.variableName,Z.variableName,Z.typeName,Z.namespace,Z.className,Z.variableName,Z.macroName,Z.propertyName,Z.comment,Z.invalid;var sb=1e4,cb=`()[]{}`,lb=new Y;function ub(e,t,n){let r=e.prop(t<0?Y.openedBy:Y.closedBy);if(r)return r;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==+(t<0))return[n[r+t]]}return null}function db(e){let t=e.type.prop(lb);return t?t(e.node):e}function fb(e,t,n,r={}){let i=r.maxScanDistance||sb,a=r.brackets||cb,o=Qv(e),s=o.resolveInner(t,n);for(let r=s;r;r=r.parent){let i=ub(r.type,n,a);if(i&&r.from<r.to){let o=db(r);if(o&&(n>0?t>=o.from&&t<o.to:t>o.from&&t<=o.to))return pb(e,t,n,r,o,i,a)}}return mb(e,t,n,o,s.type,i,a)}function pb(e,t,n,r,i,a,o){let s=r.parent,c={from:i.from,to:i.to},l=0,u=s?.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(l==0&&a.indexOf(u.type.name)>-1&&u.from<u.to){let e=db(u);return{start:c,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(ub(u.type,n,o))l++;else if(ub(u.type,-n,o)){if(l==0){let e=db(u);return{start:c,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}l--}}while(n<0?u.prevSibling():u.nextSibling());return{start:c,matched:!1}}function mb(e,t,n,r,i,a,o){if(n<0?!t:t==e.doc.length)return null;let s=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),c=o.indexOf(s);if(c<0||c%2==0!=n>0)return null;let l={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),d=0;for(let e=0;!u.next().done&&e<=a;){let a=u.value;n<0&&(e+=a.length);let s=t+e*n;for(let e=n>0?0:a.length-1,t=n>0?a.length:-1;e!=t;e+=n){let t=o.indexOf(a[e]);if(!(t<0||r.resolveInner(s+e,1).type!=i)){if(t%2==0==n>0)d++;else if(d==1)return{start:l,end:{from:s+e,to:s+e+1},matched:t>>1==c>>1};else d--}}n>0&&(e+=a.length)}return u.done?{start:l,matched:!1}:null}var hb=Object.create(null),gb=[D_.none],_b=[],vb=Object.create(null),yb=Object.create(null);for(let[e,t]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`]])yb[e]=xb(hb,t);function bb(e,t){_b.indexOf(e)>-1||(_b.push(e),console.warn(t))}function xb(e,t){let n=[];for(let r of t.split(` `)){let t=[];for(let n of r.split(`.`)){let r=e[n]||Z[n];r?typeof r==`function`?t.length?t=t.map(r):bb(n,`Modifier ${n} used at start of tag`):t.length?bb(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:bb(n,`Unknown highlighting tag ${n}`)}for(let e of t)n.push(e)}if(!n.length)return 0;let r=t.replace(/ /g,`_`),i=r+` `+n.map(e=>e.id),a=vb[i];if(a)return a.id;let o=vb[i]=D_.define({id:gb.length,name:r,props:[Sv({[r]:n})]});return gb.push(o),o.id}Tf.RTL,Tf.LTR;var Sb=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Db(e.state,n.from);return r.line?wb(e):r.block?Eb(e):!1};function Cb(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let i=e(t,n);return i?(r(n.update(i)),!0):!1}}var wb=Cb(Mb,0),Tb=Cb(jb,0),Eb=Cb((e,t)=>jb(e,t,Ab(t)),0);function Db(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var Ob=50;function kb(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-Ob,r),o=e.sliceDoc(i,i+Ob),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=100?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+Ob),d=e.sliceDoc(i-Ob,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function Ab(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from),i=n.to<=r.to?r:e.doc.lineAt(n.to);i.from>r.from&&i.from==n.to&&(i=n.to==r.to+1?r:e.doc.lineAt(n.to-1));let a=t.length-1;a>=0&&t[a].to>r.from?t[a].to=i.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:i.to})}return t}function jb(e,t,n=t.selection.ranges){let r=n.map(e=>Db(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>kb(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function Mb(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=Db(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var Nb=vu.define(),Pb=vu.define(),Fb=K.define(),Ib=K.define({combine(e){return Lu(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}}),Lb=eu.define({create(){return nx.empty},update(e,t){let n=t.state.facet(Ib),r=t.annotation(Nb);if(r){let i=Wb.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?Gb(o,o.length,n.minDepth,i):Zb(o,t.startState.selection),new nx(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(Pb);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(Su.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=Wb.fromTransaction(t),o=t.annotation(Su.time),s=t.annotation(Su.userEvent);return a?e=e.addChanges(a,o,s,n,t):t.selection&&(e=e.addSelection(t.startState.selection,o,s,n.newGroupDelay)),(i==`full`||i==`after`)&&(e=e.isolate()),e},toJSON(e){return{done:e.done.map(e=>e.toJSON()),undone:e.undone.map(e=>e.toJSON())}},fromJSON(e){return new nx(e.done.map(Wb.fromJSON),e.undone.map(Wb.fromJSON))}});function Rb(e={}){return[Lb,Ib.of(e),J.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?Bb:e.inputType==`historyRedo`?Vb:null;return n?(e.preventDefault(),n(t)):!1}})]}function zb(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(Lb,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var Bb=zb(0,!1),Vb=zb(1,!1),Hb=zb(0,!0),Ub=zb(1,!0),Wb=class e{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(t){return new e(this.changes,this.effects,this.mapped,this.startSelection,t)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(t){return new e(t.changes&&Rl.fromJSON(t.changes),[],t.mapped&&Ll.fromJSON(t.mapped),t.startSelection&&G.fromJSON(t.startSelection),t.selectionsAfter.map(G.fromJSON))}static fromTransaction(t,n){let r=Yb;for(let e of t.startState.facet(Fb)){let n=e(t);n.length&&(r=r.concat(n))}return!r.length&&t.changes.empty?null:new e(t.changes.invert(t.startState.doc),r,void 0,n||t.startState.selection,Yb)}static selection(t){return new e(void 0,Yb,void 0,void 0,t)}};function Gb(e,t,n,r){let i=t+1>n+20?t-n-1:0,a=e.slice(i,t);return a.push(r),a}function Kb(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function qb(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function Jb(e,t){return e.length?t.length?e.concat(t):e:t}var Yb=[],Xb=200;function Zb(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Xb));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),Gb(e,e.length-1,1e9,n.setSelAfter(r)))}return[Wb.selection([t])]}function Qb(e){let t=e[e.length-1],n=e.slice();return n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1)),n}function $b(e,t){if(!e.length)return e;let n=e.length,r=Yb;for(;n;){let i=ex(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[Wb.selection(r)]:Yb}function ex(e,t,n){let r=Jb(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):Yb,n);if(!e.changes)return Wb.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new Wb(i,xu.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var tx=/^(input\.type|delete)($|\.)/,nx=class e{constructor(e,t,n=0,r=void 0){this.done=e,this.undone=t,this.prevTime=n,this.prevUserEvent=r}isolate(){return this.prevTime?new e(this.done,this.undone):this}addChanges(t,n,r,i,a){let o=this.done,s=o[o.length-1];return o=s&&s.changes&&!s.changes.empty&&t.changes&&(!r||tx.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime<i.newGroupDelay&&i.joinToEvent(a,Kb(s.changes,t.changes))||r==`input.type.compose`)?Gb(o,o.length-1,i.minDepth,new Wb(t.changes.compose(s.changes),Jb(xu.mapEffects(t.effects,s.changes),s.effects),s.mapped,s.startSelection,Yb)):Gb(o,o.length,i.minDepth,t),new e(o,Yb,n,r)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:Yb;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&qb(a[a.length-1],t)?this:new e(Zb(this.done,t),this.undone,n,r)}addMapping(t){return new e($b(this.done,t),$b(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:Nb.of({side:e,rest:Qb(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?Yb:r.slice(0,r.length-1);return i.mapped&&(n=$b(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Nb.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};nx.empty=new nx(Yb,Yb);var rx=[{key:`Mod-z`,run:Bb,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:Vb,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:Vb,preventDefault:!0},{key:`Mod-u`,run:Hb,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:Ub,preventDefault:!0}];function ix(e,t){return G.create(e.ranges.map(t),e.mainIndex)}function ax(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function ox({state:e,dispatch:t},n){let r=ix(e.selection,n);return!r.eq(e.selection,!0)&&(t(ax(e,r)),!0)}function sx(e,t){return G.cursor(t?e.to:e.from)}function cx(e,t){return ox(e,n=>n.empty?e.moveByChar(n,t):sx(n,t))}function lx(e){return e.textDirectionAt(e.state.selection.main.head)==Tf.LTR}var ux=e=>cx(e,!lx(e)),dx=e=>cx(e,lx(e)),fx=e=>cx(e,!0),px=e=>cx(e,!1);function mx(e,t){return ox(e,n=>n.empty?e.moveByGroup(n,t):sx(n,t))}var hx=e=>mx(e,!lx(e)),gx=e=>mx(e,lx(e));typeof Intl<`u`&&Intl.Segmenter;function _x(e,t,n){if(t.type.prop(n))return!0;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function vx(e,t,n){let r=Qv(e).resolveInner(t.head),i=n?Y.closedBy:Y.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;_x(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?fb(e,r.from,1):fb(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,G.cursor(s,n?-1:1)}var yx=e=>ox(e,t=>vx(e.state,t,!lx(e))),bx=e=>ox(e,t=>vx(e.state,t,lx(e)));function xx(e,t){return ox(e,n=>{if(!n.empty)return sx(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var Sx=e=>xx(e,!1),Cx=e=>xx(e,!0);function wx(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(J.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function Tx(e,t){let n=wx(e),{state:r}=e,i=ix(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):sx(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=J.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(ax(r,i),{effects:a}),!0}var Ex=e=>Tx(e,!1),Dx=e=>Tx(e,!0);function Ox(e,t,n){let r=e.lineBlockAt(t.head),i=e.moveToLineBoundary(t,n);if(i.head==t.head&&i.head!=(n?r.to:r.from)&&(i=e.moveToLineBoundary(t,n,!1)),!n&&i.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(i=G.cursor(r.from+n))}return i}var kx=e=>ox(e,t=>Ox(e,t,!0)),Ax=e=>ox(e,t=>Ox(e,t,!1)),jx=e=>ox(e,t=>Ox(e,t,!lx(e))),Mx=e=>ox(e,t=>Ox(e,t,lx(e))),Nx=e=>ox(e,t=>e.moveToLineBoundary(t,!1,!1)),Px=e=>ox(e,t=>e.moveToLineBoundary(t,!0,!1));function Fx(e,t,n){let r=!1,i=ix(e.selection,t=>{let i=fb(e,t.head,-1)||fb(e,t.head,1)||t.head>0&&fb(e,t.head-1,1)||t.head<e.doc.length&&fb(e,t.head+1,-1);if(!i||!i.end)return t;r=!0;let a=i.start.from==t.head?i.end.to:i.end.from;return n?G.range(t.anchor,a):G.cursor(a)});return r?(t(ax(e,i)),!0):!1}var Ix=({state:e,dispatch:t})=>Fx(e,t,!1);function Lx(e,t,n){let r=ix(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=t&&(e=G.range(e.head,e.anchor));let r=n(e);return G.range(e.anchor,r.head,r.goalColumn,r.bidiLevel||void 0,r.assoc)});return!r.eq(e.state.selection)&&(e.dispatch(ax(e.state,r)),!0)}function Rx(e,t){return Lx(e,t,n=>e.moveByChar(n,t))}var zx=e=>Rx(e,!lx(e)),Bx=e=>Rx(e,lx(e)),Vx=e=>Rx(e,!0),Hx=e=>Rx(e,!1);function Ux(e,t){return Lx(e,t,n=>e.moveByGroup(n,t))}var Wx=e=>Ux(e,!lx(e)),Gx=e=>Ux(e,lx(e)),Kx=e=>Ux(e,!0),qx=e=>Ux(e,!1),Jx=e=>{let t=!lx(e);return Lx(e,t,n=>vx(e.state,n,t))},Yx=e=>{let t=lx(e);return Lx(e,t,n=>vx(e.state,n,t))};function Xx(e,t){return Lx(e,t,n=>e.moveVertically(n,t))}var Zx=e=>Xx(e,!1),Qx=e=>Xx(e,!0);function $x(e,t){return Lx(e,t,n=>e.moveVertically(n,t,wx(e).height))}var eS=e=>$x(e,!1),tS=e=>$x(e,!0),nS=e=>Lx(e,!0,t=>Ox(e,t,!0)),rS=e=>Lx(e,!1,t=>Ox(e,t,!1)),iS=e=>{let t=!lx(e);return Lx(e,t,n=>Ox(e,n,t))},aS=e=>{let t=lx(e);return Lx(e,t,n=>Ox(e,n,t))},oS=e=>Lx(e,!1,t=>G.cursor(e.lineBlockAt(t.head).from)),sS=e=>Lx(e,!0,t=>G.cursor(e.lineBlockAt(t.head).to)),cS=({state:e,dispatch:t})=>(t(ax(e,{anchor:0})),!0),lS=({state:e,dispatch:t})=>(t(ax(e,{anchor:e.doc.length})),!0),uS=({state:e,dispatch:t})=>(t(ax(e,{anchor:e.selection.main.anchor,head:0})),!0),dS=({state:e,dispatch:t})=>(t(ax(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),fS=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),pS=({state:e,dispatch:t})=>{let n=MS(e).map(({from:t,to:n})=>G.undirectionalRange(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:G.create(n),userEvent:`select`})),!0},mS=({state:e,dispatch:t})=>{let n=ix(e.selection,t=>{let n=Qv(e),r=n.resolveStack(t.from,1);if(t.empty){let e=n.resolveStack(t.from,-1);e.node.from>=r.node.from&&e.node.to<=r.node.to&&(r=e)}for(let e=r;e;e=e.next){let{node:n}=e;if((n.from<t.from&&n.to>=t.to||n.to>t.to&&n.from<=t.from)&&e.next)return G.undirectionalRange(n.from,n.to)}return t});return!n.eq(e.selection)&&(t(ax(e,n)),!0)};function hS(e,t){let{state:n}=e,r=n.selection,i=n.selection.ranges.slice();for(let r of n.selection.ranges){let a=n.doc.lineAt(r.head);if(t?a.to<e.state.doc.length:a.from>0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.head<a.from||r.head>a.to){i.some(e=>e.head==r.head)||i.push(r);break}if(r.head==n.head)break;n=r}}return i.length!=r.ranges.length&&(e.dispatch(ax(n,G.create(i,i.length-1))),!0)}var gS=e=>hS(e,!1),_S=e=>hS(e,!0),vS=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=G.create([n.main]):n.main.empty||(r=G.create([G.cursor(n.main.head)])),r?(t(ax(e,r)),!0):!1};function yS(e,t){if(e.state.readOnly)return!1;let n=`delete.selection`,{state:r}=e,i=r.changeByRange(r=>{let{from:i,to:a}=r;if(i==a){let o=t(r);o<i?(n=`delete.backward`,o=bS(e,o,!1)):o>i&&(n=`delete.forward`,o=bS(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=bS(e,i,!1),a=bS(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:G.cursor(i,i<r.head?-1:1)}});return!i.changes.empty&&(e.dispatch(r.update(i,{scrollIntoView:!0,userEvent:n,effects:n==`delete.selection`?J.announce.of(r.phrase(`Selection deleted`)):void 0})),!0)}function bS(e,t,n){if(e instanceof J)for(let r of e.state.facet(J.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var xS=(e,t,n)=>yS(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),s,c;if(n&&!t&&i>o.from&&i<o.from+200&&!/[^ \t]/.test(s=o.text.slice(0,i-o.from))){if(s[s.length-1]==` `)return i-1;let e=rd(s,a.tabSize)%py(a)||py(a);for(let t=0;t<e&&s[s.length-1-t]==` `;t++)i--;c=i}else c=kl(o.text,i-o.from,t,t)+o.from,c==i&&o.number!=(t?a.doc.lines:1)?c+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(o.text.slice(c-o.from,i-o.from))&&(c=kl(o.text,c-o.from,!1,!1)+o.from);return c}),SS=e=>xS(e,!1,!0),CS=e=>xS(e,!0,!1),wS=(e,t)=>yS(e,n=>{let r=n.head,{state:i}=e,a=i.doc.lineAt(r),o=i.charCategorizer(r);for(let e=null;;){if(r==(t?a.to:a.from)){r==n.head&&a.number!=(t?i.doc.lines:1)&&(r+=t?1:-1);break}let s=kl(a.text,r-a.from,t)+a.from,c=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),l=o(c);if(e!=null&&l!=e)break;(c!=` `||r!=n.head)&&(e=l),r=s}return r}),TS=e=>wS(e,!1),ES=e=>wS(e,!0),DS=e=>yS(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),OS=e=>yS(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),kS=e=>yS(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),AS=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:vl.of([``,``])},range:G.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},jS=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=e.changeByRange(t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n),i=n==r.from?n-1:kl(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:kl(r.text,n-r.from,!0)+r.from;return{changes:{from:i,to:a,insert:e.doc.slice(n,a).append(e.doc.slice(i,n))},range:G.cursor(a)}});return!n.changes.empty&&(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function MS(e){let t=[],n=-1;for(let r of e.selection.ranges){let i=e.doc.lineAt(r.from),a=e.doc.lineAt(r.to);if(!r.empty&&r.to==a.from&&(a=e.doc.lineAt(r.to-1)),n>=i.number){let e=t[t.length-1];e.to=a.to,e.ranges.push(r)}else t.push({from:i.from,to:a.to,ranges:[r]});n=a.number+1}return t}function NS(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of MS(e)){if(n?t.to==e.doc.length:t.from==0)continue;let a=e.doc.lineAt(n?t.to+1:t.from-1),o=a.length+1;if(n){r.push({from:t.to,to:a.to},{from:t.from,insert:a.text+e.lineBreak});for(let n of t.ranges)i.push(G.range(Math.min(e.doc.length,n.anchor+o),Math.min(e.doc.length,n.head+o)))}else{r.push({from:a.from,to:t.from},{from:t.to,insert:e.lineBreak+a.text});for(let e of t.ranges)i.push(G.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:G.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var PS=({state:e,dispatch:t})=>NS(e,t,!1),FS=({state:e,dispatch:t})=>NS(e,t,!0);function IS(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of MS(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var LS=({state:e,dispatch:t})=>IS(e,t,!1),RS=({state:e,dispatch:t})=>IS(e,t,!0),zS=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(MS(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=ix(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function BS(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=Qv(e).resolveInner(t),r=n.childBefore(t),i=n.childAfter(t),a;return r&&i&&r.to<=t&&i.from>=t&&(a=r.type.prop(Y.closedBy))&&a.indexOf(i.name)>-1&&e.doc.lineAt(r.to).from==e.doc.lineAt(i.from).from&&!/\S/.test(e.sliceDoc(r.to,i.from))?{from:r.to,to:i.from}:null}var VS=US(!1),HS=US(!0);function US(e){return({state:t,dispatch:n})=>{if(t.readOnly)return!1;let r=t.changeByRange(n=>{let{from:r,to:i}=n,a=t.doc.lineAt(r),o=!e&&r==i&&BS(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new gy(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=hy(s,r);for(c??=rd(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize);i<a.to&&/\s/.test(a.text[i-a.from]);)i++;o?{from:r,to:i}=o:r>a.from&&r<a.from+100&&!/\S/.test(a.text.slice(0,r))&&(r=a.from);let l=[``,my(t,c)];return o&&l.push(my(t,s.lineIndent(a.from,-1))),{changes:{from:r,to:i,insert:vl.of(l)},range:G.cursor(r+1+l[1].length)}});return n(t.update(r,{scrollIntoView:!0,userEvent:`input`})),!0}}function WS(e,t){let n=-1;return e.changeByRange(r=>{let i=[];for(let a=r.from;a<=r.to;){let o=e.doc.lineAt(a);o.number>n&&(r.empty||r.to>o.from)&&(t(o,i,r),n=o.number),a=o.to+1}let a=e.changes(i);return{changes:i,range:G.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var GS=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new gy(e,{overrideIndentation:e=>n[e]??-1}),i=WS(e,(t,i,a)=>{let o=hy(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=my(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},KS=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(WS(e,(t,n)=>{n.push({from:t.from,insert:e.facet(fy)})}),{userEvent:`input.indent`})),!0),qS=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update(WS(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=rd(r,e.tabSize),a=0,o=my(e,Math.max(0,i-py(e)));for(;a<r.length&&a<o.length&&r.charCodeAt(a)==o.charCodeAt(a);)a++;n.push({from:t.from+a,to:t.from+r.length,insert:o.slice(a)})}),{userEvent:`delete.dedent`})),!0),JS=e=>(e.setTabFocusMode(),!0),YS=[{key:`Ctrl-b`,run:ux,shift:zx,preventDefault:!0},{key:`Ctrl-f`,run:dx,shift:Bx},{key:`Ctrl-p`,run:Sx,shift:Zx},{key:`Ctrl-n`,run:Cx,shift:Qx},{key:`Ctrl-a`,run:Nx,shift:oS},{key:`Ctrl-e`,run:Px,shift:sS},{key:`Ctrl-d`,run:CS},{key:`Ctrl-h`,run:SS},{key:`Ctrl-k`,run:DS},{key:`Ctrl-Alt-h`,run:TS},{key:`Ctrl-o`,run:AS},{key:`Ctrl-t`,run:jS},{key:`Ctrl-v`,run:Dx}],XS=[{key:`ArrowLeft`,run:ux,shift:zx,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:hx,shift:Wx,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:jx,shift:iS,preventDefault:!0},{key:`ArrowRight`,run:dx,shift:Bx,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:gx,shift:Gx,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:Mx,shift:aS,preventDefault:!0},{key:`ArrowUp`,run:Sx,shift:Zx,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:cS,shift:uS},{mac:`Ctrl-ArrowUp`,run:Ex,shift:eS},{key:`ArrowDown`,run:Cx,shift:Qx,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:lS,shift:dS},{mac:`Ctrl-ArrowDown`,run:Dx,shift:tS},{key:`PageUp`,run:Ex,shift:eS},{key:`PageDown`,run:Dx,shift:tS},{key:`Home`,run:Ax,shift:rS,preventDefault:!0},{key:`Mod-Home`,run:cS,shift:uS},{key:`End`,run:kx,shift:nS,preventDefault:!0},{key:`Mod-End`,run:lS,shift:dS},{key:`Enter`,run:VS,shift:VS},{key:`Mod-a`,run:fS},{key:`Backspace`,run:SS,shift:SS,preventDefault:!0},{key:`Delete`,run:CS,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:TS,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:ES,preventDefault:!0},{mac:`Mod-Backspace`,run:OS,preventDefault:!0},{mac:`Mod-Delete`,run:kS,preventDefault:!0}].concat(YS.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),ZS=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:yx,shift:Jx},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:bx,shift:Yx},{key:`Alt-ArrowUp`,run:PS},{key:`Shift-Alt-ArrowUp`,run:LS},{key:`Alt-ArrowDown`,run:FS},{key:`Shift-Alt-ArrowDown`,run:RS},{key:`Mod-Alt-ArrowUp`,run:gS},{key:`Mod-Alt-ArrowDown`,run:_S},{key:`Escape`,run:vS},{key:`Mod-Enter`,run:HS},{key:`Alt-l`,mac:`Ctrl-l`,run:pS},{key:`Mod-i`,run:mS,preventDefault:!0},{key:`Mod-[`,run:qS},{key:`Mod-]`,run:KS},{key:`Mod-Alt-\\`,run:GS},{key:`Shift-Mod-k`,run:zS},{key:`Shift-Mod-\\`,run:Ix},{key:`Mod-/`,run:Sb},{key:`Alt-A`,mac:`Ctrl-A`,run:Tb},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:JS}].concat(XS),QS={key:`Tab`,run:KS,shift:qS},$S=class{constructor(e,t,n,r){this.state=e,this.pos=t,this.explicit=n,this.view=r,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=Qv(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),n=Math.max(t.from,this.pos-250),r=t.text.slice(n-t.from,this.pos-t.from),i=r.search(oC(e,!1));return i<0?null:{from:n+i,to:this.pos,text:r.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,n){e==`abort`&&this.abortListeners&&(this.abortListeners.push(t),n&&n.onDocChange&&(this.abortOnDocChange=!0))}};function eC(e){let t=Object.keys(e).join(``),n=/\w/.test(t);return n&&(t=t.replace(/\w/g,``)),`[${n?`\\w`:``}${t.replace(/[^\w\s]/g,`\\$&`)}]`}function tC(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=eC(t)+eC(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function nC(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:tC(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function rC(e,t){return n=>{for(let t=Qv(n.state).resolveInner(n.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(n)}}var iC=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function aC(e){return e.selection.main.from}function oC(e,t){let{source:n}=e,r=t&&n[0]!=`^`,i=n[n.length-1]!=`$`;return!r&&!i?e:RegExp(`${r?`^`:``}(?:${n})${i?`$`:``}`,e.flags??(e.ignoreCase?`i`:``))}var sC=vu.define();function cC(e,t,n,r){let{main:i}=e.selection,a=n-i.from,o=r-i.from;return{...e.changeByRange(s=>{if(s!=i&&n!=r&&e.sliceDoc(s.from+a,s.from+o)!=e.sliceDoc(n,r))return{range:s};let c=e.toText(t);return{changes:{from:s.from+a,to:r==i.from?s.to:s.from+o,insert:c},range:G.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var lC=new WeakMap;function uC(e){if(!Array.isArray(e))return e;let t=lC.get(e);return t||lC.set(e,t=nC(e)),t}var dC=xu.define(),fC=xu.define(),pC=class{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<e.length;){let n=Ml(e,t),r=Pl(n);this.chars.push(n);let i=e.slice(t,t+r),a=i.toUpperCase();this.folded.push(Ml(a==i?i.toLowerCase():a,0)),t+=r}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:n,any:r,precise:i,byWord:a}=this;if(t.length==1){let r=Ml(e,0),i=Pl(r),a=i==e.length?0:-100;if(r!=t[0]){if(r==n[0])a+=-200;else return null}return this.ret(a,[0,i])}let o=e.indexOf(this.pattern);if(o==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let s=t.length,c=0;if(o<0){for(let i=0,a=Math.min(e.length,200);i<a&&c<s;){let a=Ml(e,i);(a==t[c]||a==n[c])&&(r[c++]=i),i+=Pl(a)}if(c<s)return null}let l=0,u=0,d=!1,f=0,p=-1,m=-1,h=/[a-z]/.test(e),g=!0;for(let r=0,c=Math.min(e.length,200),_=0;r<c&&u<s;){let c=Ml(e,r);o<0&&(l<s&&c==t[l]&&(i[l++]=r),f<s&&(c==t[f]||c==n[f]?(f==0&&(p=r),m=r+1,f++):f=0));let v,y=c<255?c>=48&&c<=57||c>=97&&c<=122?2:+(c>=65&&c<=90):(v=Nl(c))==v.toLowerCase()?v==v.toUpperCase()?0:2:1;(!r||y==1&&h||_==0&&y!=0)&&(t[u]==c||n[u]==c&&(d=!0)?a[u++]=r:a.length&&(g=!1)),_=y,r+=Pl(c)}return u==s&&a[0]==0&&g?this.result(-100+(d?-200:0),a,e):f==s&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):o>-1?this.ret(-700-e.length,[o,o+this.pattern.length]):f==s?this.ret(-900-e.length,[p,m]):u==s?this.result(-100+(d?-200:0)+-700+(g?0:-1100),a,e):t.length==2?null:this.result((r[0]?-700:0)+-200+-1100,r,e)}result(e,t,n){let r=[],i=0;for(let e of t){let t=e+(this.astral?Pl(Ml(n,e)):1);i&&r[i-1]==e?r[i-1]=t:(r[i++]=e,r[i++]=t)}return this.ret(e-n.length,r)}},mC=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},hC=K.define({combine(e){return Lu(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>``,optionClass:()=>``,aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:_C,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)=>n=>gC(e(n),t(n)),optionClass:(e,t)=>n=>gC(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function gC(e,t){return e?t?e+` `+t:e:t}function _C(e,t,n,r,i,a){let o=e.textDirection==Tf.RTL,s=o,c=!1,l=`top`,u,d,f=t.left-i.left,p=i.right-t.right,m=r.right-r.left,h=r.bottom-r.top;if(s&&f<Math.min(m,p)?s=!1:!s&&p<Math.min(m,f)&&(s=!0),m<=(s?f:p))u=Math.max(i.top,Math.min(n.top,i.bottom-h))-t.top,d=Math.min(400,s?f:p);else{c=!0,d=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=h||e>t.top?u=n.bottom-t.top:(l=`bottom`,u=t.bottom-n.top)}let g=(t.bottom-t.top)/a.offsetHeight,_=(t.right-t.left)/a.offsetWidth;return{style:`${l}: ${u/g}px; max-width: ${d/_}px`,class:`cm-completionInfo-`+(c?o?`left-narrow`:`right-narrow`:s?`left`:`right`)}}var vC=xu.define();function yC(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement(`div`);return t.classList.add(`cm-completionIcon`),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>`cm-completionIcon-`+e)),t.setAttribute(`aria-hidden`,`true`),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement(`span`);i.className=`cm-completionLabel`;let a=e.displayLabel||e.label,o=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>o&&i.appendChild(document.createTextNode(a.slice(o,t)));let s=i.appendChild(document.createElement(`span`));s.appendChild(document.createTextNode(a.slice(t,n))),s.className=`cm-completionMatchedText`,o=n}return o<a.length&&i.appendChild(document.createTextNode(a.slice(o))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement(`span`);return t.className=`cm-completionDetail`,t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}function bC(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}var xC=class{constructor(e,t,n){this.view=e,this.stateField=t,this.applyCompletion=n,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this},this.space=null,this.currentClass=``;let r=e.state.field(t),{options:i,selected:a}=r.open,o=e.state.facet(hC);this.optionContent=yC(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=bC(i.length,a,o.maxRenderedOptions),this.dom=document.createElement(`div`),this.dom.className=`cm-tooltip-autocomplete`,this.updateTooltipClass(e.state),this.dom.addEventListener(`mousedown`,n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if(t.nodeName==`LI`&&(i=/-(\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}if(n.target==this.list){let t=this.list.classList.contains(`cm-completionListIncompleteTop`)&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains(`cm-completionListIncompleteBottom`)&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;t!=null&&(e.dispatch({effects:vC.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(hC).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:fC.of(null)})}),this.showOptions(i,r.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){let t=e.state.field(this.stateField),n=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),t!=n){let{options:r,selected:i,disabled:a}=t.open;n.open&&n.open.options==r||(this.range=bC(r.length,i,e.state.facet(hC).maxRenderedOptions),this.showOptions(r,t.id)),this.updateSel(),a!=n.open?.disabled&&this.dom.classList.toggle(`cm-tooltip-autocomplete-disabled`,!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(` `))e&&this.dom.classList.remove(e);for(let e of t.split(` `))e&&this.dom.classList.add(e);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.from||t.selected>=this.range.to)&&(this.range=bC(t.options.length,t.selected,this.view.state.facet(hC).maxRenderedOptions),this.showOptions(t.options,e.id));let n=this.updateSelectedOption(t.selected);if(n){this.destroyInfo();let{completion:r}=t.options[t.selected],{info:i}=r;if(!i)return;let a=typeof i==`string`?document.createTextNode(i):i(r);if(!a)return;`then`in a?a.then(t=>{t&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(t,r)}).catch(e=>lp(this.view.state,e,`completion info`)):(this.addInfoPane(a,r),n.setAttribute(`aria-describedby`,this.info.id))}}addInfoPane(e,t){this.destroyInfo();let n=this.info=document.createElement(`div`);if(n.className=`cm-tooltip cm-completionInfo`,n.id=`cm-completionInfo-`+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)n.appendChild(e),this.infoDestroy=null;else{let{dom:t,destroy:r}=e;n.appendChild(t),this.infoDestroy=r||null}this.dom.appendChild(n),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let n=this.list.firstChild,r=this.range.from;n;n=n.nextSibling,r++)n.nodeName!=`LI`||!n.id?r--:r==e?n.hasAttribute(`aria-selected`)||(n.setAttribute(`aria-selected`,`true`),t=n):n.hasAttribute(`aria-selected`)&&(n.removeAttribute(`aria-selected`),n.removeAttribute(`aria-describedby`));return t&&CC(this.list,t),t}measureInfo(){let e=this.dom.querySelector(`[aria-selected]`);if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(hC).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className=`cm-tooltip cm-completionInfo `+(e.class||``)):this.info.style.cssText=`top: -1e6px`)}createListBox(e,t,n){let r=document.createElement(`ul`);r.id=t,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-expanded`,`true`),r.setAttribute(`aria-label`,this.view.state.phrase(`Completions`)),r.addEventListener(`mousedown`,e=>{e.target==r&&e.preventDefault()});let i=null;for(let a=n.from;a<n.to;a++){let{completion:o,match:s}=e[a],{section:c}=o;if(c){let e=typeof c==`string`?c:c.name;if(e!=i&&(a>n.from||n.from==0)){if(i=e,typeof c!=`string`&&c.header)r.appendChild(c.header(c));else{let t=r.appendChild(document.createElement(`completion-section`));t.textContent=e}}}let l=r.appendChild(document.createElement(`li`));l.id=t+`-`+a,l.setAttribute(`role`,`option`);let u=this.optionClass(o);u&&(l.className=u);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,s);t&&l.appendChild(t)}}return n.from&&r.classList.add(`cm-completionListIncompleteTop`),n.to<e.length&&r.classList.add(`cm-completionListIncompleteBottom`),r}destroyInfo(){this.info&&=(this.infoDestroy&&this.infoDestroy(),this.info.remove(),null)}destroy(){this.destroyInfo()}};function SC(e,t){return n=>new xC(n,e,t)}function CC(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function wC(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function TC(e,t){let n=[],r=null,i=null,a=e=>{n.push(e);let{section:t}=e.completion;if(t){r||=[];let e=typeof t==`string`?t:t.name;r.some(t=>t.name==e)||r.push(typeof t==`string`?{name:e}:t)}},o=t.facet(hC);for(let r of e)if(r.hasResult()){let e=r.result.getMatch;if(r.result.filter===!1)for(let t of r.result.options)a(new iC(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new mC(n):new pC(n);for(let t of r.result.options)if(s=c.match(t.label)){let n=t.displayLabel?e?e(t,s.matched):[]:s.matched,o=s.score+(t.boost||0);if(a(new iC(t,r.source,n,o)),typeof t.section==`object`&&t.section.rank===`dynamic`){let{name:e}=t.section;i||=Object.create(null),i[e]=Math.max(o,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,a=(e,t)=>(e.rank===`dynamic`&&t.rank===`dynamic`?i[t.name]-i[e.name]:0)||(typeof e.rank==`number`?e.rank:1e9)-(typeof t.rank==`number`?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(a))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e[typeof n==`string`?n:n.name])}}let s=[],c=null,l=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||l(e.completion,t.completion))){let t=e.completion;!c||c.label!=t.label||c.detail!=t.detail||c.type!=null&&t.type!=null&&c.type!=t.type||c.apply!=t.apply||c.boost!=t.boost?s.push(e):wC(e.completion)>wC(c)&&(s[s.length-1]=e),c=e.completion}return s}var EC=class e{constructor(e,t,n,r,i,a){this.options=e,this.attrs=t,this.tooltip=n,this.timestamp=r,this.selected=i,this.disabled=a}setSelected(t,n){return t==this.selected||t>=this.options.length?this:new e(this.options,jC(n,t),this.tooltip,this.timestamp,t,this.disabled)}static build(t,n,r,i,a,o){if(i&&!o&&t.some(e=>e.isPending))return i.setDisabled();let s=TC(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(hC).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){c=t;break}}return new e(s,jC(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:BC,above:a.aboveCursor},i?i.timestamp:Date.now(),c,!1)}map(t){return new e(this.options,this.attrs,{...this.tooltip,pos:t.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new e(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}},DC=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(MC,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(hC),i=(r.override||n.languageDataAt(`autocomplete`,aC(n)).map(uC)).map(e=>(this.active.find(t=>t.source==e)||new PC(e,+!!this.active.some(e=>e.state!=0))).update(t,r));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let a=this.open,o=t.effects.some(e=>e.is(LC));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!OC(i,this.active)||o?a=EC.build(i,n,this.id,a,r,o):a&&a.disabled&&!i.some(e=>e.isPending)&&(a=null),!a&&i.every(e=>!e.isPending)&&i.some(e=>e.hasResult())&&(i=i.map(e=>e.hasResult()?new PC(e.source,0):e));for(let e of t.effects)e.is(vC)&&(a&&=a.setSelected(e.value,this.id));return i==this.active&&a==this.open?this:new e(i,this.id,a)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?kC:AC}};function OC(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,a=r==t.length;if(i||a)return i==a;if(e[n++].result!=t[r++].result)return!1}}var kC={"aria-autocomplete":`list`},AC={};function jC(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var MC=[];function NC(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(sC);if(n&&t.activateOnCompletion(n))return 12}let n=e.isUserEvent(`input.type`);return n&&t.activateOnTyping?5:n?1:e.isUserEvent(`delete.backward`)?2:e.selection?8:e.docChanged?16:0}var PC=class e{constructor(e,t,n=!1){this.source=e,this.state=t,this.explicit=n}hasResult(){return!1}get isPending(){return this.state==1}update(t,n){let r=NC(t,n),i=this;(r&8||r&16&&this.touches(t))&&(i=new e(i.source,0)),r&4&&i.state==0&&(i=new e(this.source,1)),i=i.updateFor(t,r);for(let n of t.effects)if(n.is(dC))i=new e(i.source,1,n.value);else if(n.is(fC))i=new e(i.source,0);else if(n.is(LC))for(let e of n.value)e.source==i.source&&(i=e);return i}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(aC(e.state))}},FC=class e extends PC{constructor(e,t,n,r,i,a){super(e,3,t),this.limit=n,this.result=r,this.from=i,this.to=a}hasResult(){return!0}updateFor(t,n){if(!(n&3))return this.map(t.changes);let r=this.result;r.map&&!t.changes.empty&&(r=r.map(r,t.changes));let i=t.changes.mapPos(this.from),a=t.changes.mapPos(this.to,1),o=aC(t.state);if(o>a||!r||n&2&&(aC(t.startState)==this.from||o<this.limit))return new PC(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return IC(r.validFor,t.state,i,a)?new e(this.source,this.explicit,s,r,i,a):r.update&&(r=r.update(r,i,a,new $S(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??aC(t.state)):new PC(this.source,1,this.explicit)}map(t){if(t.empty)return this;let n=this.result.map?this.result.map(this.result,t):this.result;return n?new e(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new PC(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function IC(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):oC(e,!0).test(i)}var LC=xu.define({map(e,t){return e.map(e=>e.map(t))}}),RC=eu.define({create(){return DC.start()},update(e,t){return e.update(t)},provide:e=>[m_.from(e,e=>e.tooltip),J.contentAttributes.from(e,e=>e.attrs)]});function zC(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(RC).active.find(e=>e.source==t.source);return r instanceof FC&&(typeof n==`string`?e.dispatch({...cC(e.state,n,r.from,r.to),annotations:sC.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}var BC=SC(RC,zC),VC=e=>e.state.field(RC,!1)?(e.dispatch({effects:dC.of(!0)}),!0):!1;typeof navigator==`object`&&navigator.platform;var HC=J.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`}}}),UC=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},WC=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(t){let n=t.mapPos(this.from,-1,Il.TrackDel),r=t.mapPos(this.to,1,Il.TrackDel);return n==null||r==null?null:new e(this.field,n,r)}},GC=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),a=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=a,o=/^\t*/.exec(i)[0].length;for(let t=0;t<o;t++)n+=e.facet(fy);r.push(t+n.length-o),i=n+i.slice(o)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new WC(e.field,r[e.line]+e.from,r[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1;t===0&&(t=1e9);let c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new UC(s,r.length,a.index,a.index+c.length)),e=e.slice(0,a.index)+o+e.slice(a.index+a[0].length)}e=e.replace(/\\([{}])/g,(e,t,n)=>{for(let e of i)e.line==r.length&&e.from>n&&(e.from--,e.to--);return t}),r.push(e)}return new e(r,i)}},KC=Bd.widget({widget:new class extends Rd{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),qC=Bd.mark({class:`cm-snippetField`}),JC=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=Bd.set(e.map(e=>(e.from==e.to?KC:qC).range(e.from,e.to)),!0)}map(t){let n=[];for(let e of this.ranges){let r=e.map(t);if(!r)return null;n.push(r)}return new e(n,this.active)}selectionInsideField(e){return e.ranges.every(e=>this.ranges.some(t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))}},YC=xu.define({map(e,t){return e&&e.map(t)}}),XC=xu.define(),ZC=eu.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(YC))return n.value;if(n.is(XC)&&e)return new JC(e.ranges,n.value)}return e&&t.docChanged&&(e=e.map(t.changes)),e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null),e},provide:e=>J.decorations.from(e,e=>e?e.deco:Bd.none)});function QC(e,t){return G.create(e.filter(e=>e.field==t).map(e=>G.range(e.from,e.to)))}function $C(e){let t=GC.parse(e);return(e,n,r,i)=>{let{text:a,ranges:o}=t.instantiate(e.state,r),{main:s}=e.state.selection,c={changes:{from:r,to:i==s.from?s.to:i,insert:vl.of(a)},scrollIntoView:!0,annotations:n?[sC.of(n),Su.userEvent.of(`input.complete`)]:void 0};if(o.length&&(c.selection=QC(o,0)),o.some(e=>e.field>0)){let t=new JC(o,0),n=c.effects=[YC.of(t)];e.state.field(ZC,!1)===void 0&&n.push(xu.appendConfig.of([ZC,rw,aw,HC]))}e.dispatch(e.state.update(c))}}function ew(e){return({state:t,dispatch:n})=>{let r=t.field(ZC,!1);if(!r||e<0&&r.active==0)return!1;let i=r.active+e,a=e>0&&!r.ranges.some(t=>t.field==i+e);return n(t.update({selection:QC(r.ranges,i),effects:YC.of(a?null:new JC(r.ranges,i)),scrollIntoView:!0})),!0}}var tw=[{key:`Tab`,run:ew(1),shift:ew(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(ZC,!1)?(t(e.update({effects:YC.of(null)})),!0):!1}],nw=K.define({combine(e){return e.length?e[0]:tw}}),rw=ru.highest(jg.compute([nw],e=>e.facet(nw)));function iw(e,t){return{...t,apply:$C(e)}}var aw=J.domEventHandlers({mousedown(e,t){let n=t.state.field(ZC,!1),r;if(!n||(r=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return!1;let i=n.ranges.find(e=>e.from<=r&&e.to>=r);return!i||i.field==n.active?!1:(t.dispatch({selection:QC(n.ranges,i.field),effects:YC.of(n.ranges.some(e=>e.field>i.field)?new JC(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),ow=new class extends Ru{};ow.startSide=1,ow.endSide=-1,typeof navigator==`object`&&navigator.userAgent;function sw(e){let t=e.field(RC,!1);return t&&t.active.some(e=>e.isPending)?`pending`:t&&t.active.some(e=>e.state!=0)?`active`:null}var cw=class e{static create(t,n,r,i,a){let o=i+(i<<8)+t+(n<<4)|0;return new e(t,n,r,o,a,[],[])}constructor(e,t,n,r,i,a,o){this.type=e,this.value=t,this.from=n,this.hash=r,this.end=i,this.children=a,this.positions=o,this.blankFirstLine=!1,this.hashProp=[[Y.contextHash,r]]}addChild(e,t){e.prop(Y.contextHash)!=this.hash&&(e=new M_(e.type,e.children,e.positions,e.length,this.hashProp)),this.children.push(e),this.positions.push(t)}toTree(e,t=this.end){let n=this.children.length-1;return n>=0&&(t=Math.max(t,this.positions[n]+this.children[n].length+this.from)),new M_(e.types[this.type],this.children,this.positions,t-this.from).balance({makeTree:(e,t,n)=>new M_(D_.none,e,t,n,this.hashProp)})}},Q;(function(e){e[e.Document=1]=`Document`,e[e.CodeBlock=2]=`CodeBlock`,e[e.FencedCode=3]=`FencedCode`,e[e.Blockquote=4]=`Blockquote`,e[e.HorizontalRule=5]=`HorizontalRule`,e[e.BulletList=6]=`BulletList`,e[e.OrderedList=7]=`OrderedList`,e[e.ListItem=8]=`ListItem`,e[e.ATXHeading1=9]=`ATXHeading1`,e[e.ATXHeading2=10]=`ATXHeading2`,e[e.ATXHeading3=11]=`ATXHeading3`,e[e.ATXHeading4=12]=`ATXHeading4`,e[e.ATXHeading5=13]=`ATXHeading5`,e[e.ATXHeading6=14]=`ATXHeading6`,e[e.SetextHeading1=15]=`SetextHeading1`,e[e.SetextHeading2=16]=`SetextHeading2`,e[e.HTMLBlock=17]=`HTMLBlock`,e[e.LinkReference=18]=`LinkReference`,e[e.Paragraph=19]=`Paragraph`,e[e.CommentBlock=20]=`CommentBlock`,e[e.ProcessingInstructionBlock=21]=`ProcessingInstructionBlock`,e[e.Escape=22]=`Escape`,e[e.Entity=23]=`Entity`,e[e.HardBreak=24]=`HardBreak`,e[e.Emphasis=25]=`Emphasis`,e[e.StrongEmphasis=26]=`StrongEmphasis`,e[e.Link=27]=`Link`,e[e.Image=28]=`Image`,e[e.InlineCode=29]=`InlineCode`,e[e.HTMLTag=30]=`HTMLTag`,e[e.Comment=31]=`Comment`,e[e.ProcessingInstruction=32]=`ProcessingInstruction`,e[e.Autolink=33]=`Autolink`,e[e.HeaderMark=34]=`HeaderMark`,e[e.QuoteMark=35]=`QuoteMark`,e[e.ListMark=36]=`ListMark`,e[e.LinkMark=37]=`LinkMark`,e[e.EmphasisMark=38]=`EmphasisMark`,e[e.CodeMark=39]=`CodeMark`,e[e.CodeText=40]=`CodeText`,e[e.CodeInfo=41]=`CodeInfo`,e[e.LinkTitle=42]=`LinkTitle`,e[e.LinkLabel=43]=`LinkLabel`,e[e.URL=44]=`URL`})(Q||={});var lw=class{constructor(e,t){this.start=e,this.content=t,this.marks=[],this.parsers=[]}},uw=class{constructor(){this.text=``,this.baseIndent=0,this.basePos=0,this.depth=0,this.markers=[],this.pos=0,this.indent=0,this.next=-1}forward(){this.basePos>this.pos&&this.forwardInner()}forwardInner(){let e=this.skipSpace(this.basePos);this.indent=this.countIndent(e,this.pos,this.indent),this.pos=e,this.next=e==this.text.length?-1:this.text.charCodeAt(e)}skipSpace(e){return mw(this.text,e)}reset(e){for(this.text=e,this.baseIndent=this.basePos=this.pos=this.indent=0,this.forwardInner(),this.depth=1;this.markers.length;)this.markers.pop()}moveBase(e){this.basePos=e,this.baseIndent=this.countIndent(e,this.pos,this.indent)}moveBaseColumn(e){this.baseIndent=e,this.basePos=this.findColumn(e)}addMarker(e){this.markers.push(e)}countIndent(e,t=0,n=0){for(let r=t;r<e;r++)n+=this.text.charCodeAt(r)==9?4-n%4:1;return n}findColumn(e){let t=0;for(let n=0;t<this.text.length&&n<e;t++)n+=this.text.charCodeAt(t)==9?4-n%4:1;return t}scrub(){if(!this.baseIndent)return this.text;let e=``;for(let t=0;t<this.basePos;t++)e+=` `;return e+this.text.slice(this.basePos)}};function dw(e,t,n){if(n.pos==n.text.length||e!=t.block&&n.indent>=t.stack[n.depth+1].value+n.baseIndent)return!0;if(n.indent>=n.baseIndent+4)return!1;let r=(e.type==Q.OrderedList?xw:bw)(n,t,!1);return r>0&&(e.type!=Q.BulletList||vw(n,t,!1)<0)&&n.text.charCodeAt(n.pos+r-1)==e.value}var fw={[Q.Blockquote](e,t,n){return n.next==62&&(n.markers.push(Yw(Q.QuoteMark,t.lineStart+n.pos,t.lineStart+n.pos+1)),n.moveBase(n.pos+(pw(n.text.charCodeAt(n.pos+1))?2:1)),e.end=t.lineStart+n.text.length,!0)},[Q.ListItem](e,t,n){return!(n.next<0?e.blankFirstLine&&e.children.length==1:n.indent<n.baseIndent+e.value)&&(n.moveBaseColumn(n.baseIndent+e.value),!0)},[Q.OrderedList]:dw,[Q.BulletList]:dw,[Q.Document](){return!0}};function pw(e){return e==32||e==9||e==10||e==13}function mw(e,t=0){for(;t<e.length&&pw(e.charCodeAt(t));)t++;return t}function hw(e,t,n){for(;t>n&&pw(e.charCodeAt(t-1));)t--;return t}function gw(e){if(e.next!=96&&e.next!=126)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;if(t<e.pos+3)return-1;if(e.next==96){for(let n=t;n<e.text.length;n++)if(e.text.charCodeAt(n)==96)return-1}return t}function _w(e){return e.next==62?e.text.charCodeAt(e.pos+1)==32?2:1:-1}function vw(e,t,n){if(e.next!=42&&e.next!=45&&e.next!=95)return-1;let r=1;for(let t=e.pos+1;t<e.text.length;t++){let n=e.text.charCodeAt(t);if(n==e.next)r++;else if(!pw(n))return-1}return n&&e.next==45&&Cw(e)>-1&&e.depth==t.stack.length&&t.parser.leafBlockParsers.indexOf(Fw.SetextHeading)>-1||r<3?-1:1}function yw(e,t){for(let n=e.stack.length-1;n>=0;n--)if(e.stack[n].type==t)return!0;return!1}function bw(e,t,n){return(e.next==45||e.next==43||e.next==42)&&(e.pos==e.text.length-1||pw(e.text.charCodeAt(e.pos+1)))&&(!n||yw(t,Q.BulletList)||e.skipSpace(e.pos+2)<e.text.length)?1:-1}function xw(e,t,n){let r=e.pos,i=e.next;for(;i>=48&&i<=57;){if(r++,r==e.text.length)return-1;i=e.text.charCodeAt(r)}return r==e.pos||r>e.pos+9||i!=46&&i!=41||r<e.text.length-1&&!pw(e.text.charCodeAt(r+1))||n&&!yw(t,Q.OrderedList)&&(e.skipSpace(r+1)==e.text.length||r>e.pos+1||e.next!=49)?-1:r+1-e.pos}function Sw(e){if(e.next!=35)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==35;)t++;if(t<e.text.length&&!pw(e.text.charCodeAt(t)))return-1;let n=t-e.pos;return n>6?-1:n}function Cw(e){if(e.next!=45&&e.next!=61||e.indent>=e.baseIndent+4)return-1;let t=e.pos+1;for(;t<e.text.length&&e.text.charCodeAt(t)==e.next;)t++;let n=t;for(;t<e.text.length&&pw(e.text.charCodeAt(t));)t++;return t==e.text.length?n:-1}var ww=/^[ \t]*$/,Tw=/-->/,Ew=/\?>/,Dw=[[/^<(?:script|pre|style|textarea)(?:\s|>|$)/i,/<\/(?:script|pre|style|textarea)>/i],[/^\s*<!--/,Tw],[/^\s*<\?/,Ew],[/^\s*<![A-Z]/,/>/],[/^\s*<!\[CDATA\[/,/\]\]>/],[/^\s*<\/?(?: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|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul)(?:\s|\/?>|$)/i,ww],[/^\s*(?:<\/[a-z][\w-]*\s*>|<[a-z][\w-]*(\s+[a-z:_][\w-.]*(?:\s*=\s*(?:[^\s"'=<>`]+|'[^']*'|"[^"]*"))?)*\s*>)\s*$/i,ww]];function Ow(e,t,n){if(e.next!=60)return-1;let r=e.text.slice(e.pos);for(let e=0,t=Dw.length-+!!n;e<t;e++)if(Dw[e][0].test(r))return e;return-1}function kw(e,t){let n=e.countIndent(t,e.pos,e.indent),r=e.skipSpace(t),i=e.countIndent(r,t,n);return i>=n+5||r==e.text.length?n+1:i}function Aw(e,t,n){let r=e.length-1;r>=0&&e[r].to==t&&e[r].type==Q.CodeText?e[r].to=n:e.push(Yw(Q.CodeText,t,n))}var jw={LinkReference:void 0,IndentedCode(e,t){let n=t.baseIndent+4;if(t.indent<n)return!1;let r=t.findColumn(n),i=e.lineStart+r,a=e.lineStart+t.text.length,o=[],s=[];for(Aw(o,i,a);e.nextLine()&&t.depth>=e.stack.length;)if(t.pos==t.text.length){Aw(s,e.lineStart-1,e.lineStart);for(let e of t.markers)s.push(e)}else if(t.indent<n)break;else{if(s.length){for(let e of s)e.type==Q.CodeText?Aw(o,e.from,e.to):o.push(e);s=[]}Aw(o,e.lineStart-1,e.lineStart);for(let e of t.markers)o.push(e);a=e.lineStart+t.text.length;let n=e.lineStart+t.findColumn(t.baseIndent+4);n<a&&Aw(o,n,a)}return s.length&&(s=s.filter(e=>e.type!=Q.CodeText),s.length&&(t.markers=s.concat(t.markers))),e.addNode(e.buffer.writeElements(o,-i).finish(Q.CodeBlock,a-i),i),!0},FencedCode(e,t){let n=gw(t);if(n<0)return!1;let r=e.lineStart+t.pos,i=t.next,a=n-t.pos,o=t.skipSpace(n),s=hw(t.text,t.text.length,o),c=[Yw(Q.CodeMark,r,r+a)];o<s&&c.push(Yw(Q.CodeInfo,e.lineStart+o,e.lineStart+s));for(let n=!0,r=!0,o=!1;e.nextLine()&&t.depth>=e.stack.length;n=!1){let s=t.pos;if(t.indent-t.baseIndent<4)for(;s<t.text.length&&t.text.charCodeAt(s)==i;)s++;if(s-t.pos>=a&&t.skipSpace(s)==t.text.length){for(let e of t.markers)c.push(e);r&&o&&Aw(c,e.lineStart-1,e.lineStart),c.push(Yw(Q.CodeMark,e.lineStart+t.pos,e.lineStart+s)),e.nextLine();break}{o=!0,n||(Aw(c,e.lineStart-1,e.lineStart),r=!1);for(let e of t.markers)c.push(e);let i=e.lineStart+t.basePos,a=e.lineStart+t.text.length;i<a&&(Aw(c,i,a),r=!1)}}return e.addNode(e.buffer.writeElements(c,-r).finish(Q.FencedCode,e.prevLineEnd()-r),r),!0},Blockquote(e,t){let n=_w(t);return n<0?!1:(e.startContext(Q.Blockquote,t.pos),e.addNode(Q.QuoteMark,e.lineStart+t.pos,e.lineStart+t.pos+1),t.moveBase(t.pos+n),null)},HorizontalRule(e,t){if(vw(t,e,!1)<0)return!1;let n=e.lineStart+t.pos;return e.nextLine(),e.addNode(Q.HorizontalRule,n),!0},BulletList(e,t){let n=bw(t,e,!1);if(n<0)return!1;e.block.type!=Q.BulletList&&e.startContext(Q.BulletList,t.basePos,t.next);let r=kw(t,t.pos+1);return e.startContext(Q.ListItem,t.basePos,r-t.baseIndent),e.addNode(Q.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),e.block.blankFirstLine=r>=t.text.length,null},OrderedList(e,t){let n=xw(t,e,!1);if(n<0)return!1;e.block.type!=Q.OrderedList&&e.startContext(Q.OrderedList,t.basePos,t.text.charCodeAt(t.pos+n-1));let r=kw(t,t.pos+n);return e.startContext(Q.ListItem,t.basePos,r-t.baseIndent),e.addNode(Q.ListMark,e.lineStart+t.pos,e.lineStart+t.pos+n),t.moveBaseColumn(r),e.block.blankFirstLine=r==t.text.length,null},ATXHeading(e,t){let n=Sw(t);if(n<0)return!1;let r=t.pos,i=e.lineStart+r,a=hw(t.text,t.text.length,r),o=a;for(;o>r&&t.text.charCodeAt(o-1)==t.next;)o--;o!=a&&o!=r&&pw(t.text.charCodeAt(o-1))||(o=t.text.length);let s=e.buffer.write(Q.HeaderMark,0,n).writeElements(e.parser.parseInline(t.text.slice(r+n+1,o),i+n+1),-i);o<t.text.length&&s.write(Q.HeaderMark,o-r,a-r);let c=s.finish(Q.ATXHeading1-1+n,t.text.length-r);return e.nextLine(),e.addNode(c,i),!0},HTMLBlock(e,t){let n=Ow(t,e,!1);if(n<0)return!1;let r=e.lineStart+t.pos,i=Dw[n][1],a=[],o=i!=ww;for(;!i.test(t.text)&&e.nextLine();){if(t.depth<e.stack.length){o=!1;break}for(let e of t.markers)a.push(e)}o&&e.nextLine();let s=i==Tw?Q.CommentBlock:i==Ew?Q.ProcessingInstructionBlock:Q.HTMLBlock,c=e.prevLineEnd();return e.addNode(e.buffer.writeElements(a,-r).finish(s,c-r),r),!0},SetextHeading:void 0},Mw=class{constructor(e){this.stage=0,this.elts=[],this.pos=0,this.start=e.start,this.advance(e.content)}nextLine(e,t,n){if(this.stage==-1)return!1;let r=n.content+`
12
12
  `+t.scrub(),i=this.advance(r);return i>-1&&i<r.length&&this.complete(e,n,i)}finish(e,t){return(this.stage==2||this.stage==3)&&mw(t.content,this.pos)==t.content.length&&this.complete(e,t,t.content.length)}complete(e,t,n){return e.addLeafElement(t,Yw(Q.LinkReference,this.start,this.start+n,this.elts)),!0}nextStage(e){return e?(this.pos=e.to-this.start,this.elts.push(e),this.stage++,!0):(e===!1&&(this.stage=-1),!1)}advance(e){for(;;)if(this.stage==-1)return-1;else if(this.stage==0){if(!this.nextStage(sT(e,this.pos,this.start,!0)))return-1;if(e.charCodeAt(this.pos)!=58)return this.stage=-1;this.elts.push(Yw(Q.LinkMark,this.pos+this.start,this.pos+this.start+1)),this.pos++}else if(this.stage==1){if(!this.nextStage(aT(e,mw(e,this.pos),this.start)))return-1}else if(this.stage==2){let t=mw(e,this.pos),n=0;if(t>this.pos){let r=oT(e,t,this.start);if(r){let t=Nw(e,r.to-this.start);t>0&&(this.nextStage(r),n=t)}}return n||=Nw(e,this.pos),n>0&&n<e.length?n:-1}else return Nw(e,this.pos)}};function Nw(e,t){for(;t<e.length;t++){let n=e.charCodeAt(t);if(n==10)break;if(!pw(n))return-1}return t}var Pw=class{nextLine(e,t,n){let r=t.depth<e.stack.length?-1:Cw(t),i=t.next;if(r<0)return!1;let a=Yw(Q.HeaderMark,e.lineStart+t.pos,e.lineStart+r);return e.nextLine(),e.addLeafElement(n,Yw(i==61?Q.SetextHeading1:Q.SetextHeading2,n.start,e.prevLineEnd(),[...e.parser.parseInline(n.content,n.start),a])),!0}finish(){return!1}},Fw={LinkReference(e,t){return t.content.charCodeAt(0)==91?new Mw(t):null},SetextHeading(){return new Pw}},Iw=[(e,t)=>Sw(t)>=0,(e,t)=>gw(t)>=0,(e,t)=>_w(t)>=0,(e,t)=>bw(t,e,!0)>=0,(e,t)=>xw(t,e,!0)>=0,(e,t)=>vw(t,e,!0)>=0,(e,t)=>Ow(t,e,!0)>=0],Lw={text:``,end:0},Rw=class{constructor(e,t,n,r){this.parser=e,this.input=t,this.ranges=r,this.line=new uw,this.atEnd=!1,this.reusePlaceholders=new Map,this.stoppedAt=null,this.rangeI=0,this.to=r[r.length-1].to,this.lineStart=this.absoluteLineStart=this.absoluteLineEnd=r[0].from,this.block=cw.create(Q.Document,0,this.lineStart,0,0),this.stack=[this.block],this.fragments=n.length?new dT(n,t):null,this.readLine()}get parsedPos(){return this.absoluteLineStart}advance(){if(this.stoppedAt!=null&&this.absoluteLineStart>this.stoppedAt)return this.finish();let{line:e}=this;for(;;){for(let t=0;;){let n=e.depth<this.stack.length?this.stack[this.stack.length-1]:null;for(;t<e.markers.length&&(!n||e.markers[t].from<n.end);){let n=e.markers[t++];this.addNode(n.type,n.from,n.to)}if(!n)break;this.finishContext()}if(e.pos<e.text.length)break;if(!this.nextLine())return this.finish()}if(this.fragments&&this.reuseFragment(e.basePos))return null;start:for(;;){for(let t of this.parser.blockParsers)if(t){let n=t(this,e);if(n!=0){if(n==1)return null;e.forward();continue start}}break}if(e.pos==e.text.length)return this.nextLine()?null:this.finish();let t=new lw(this.lineStart+e.pos,e.text.slice(e.pos));for(let e of this.parser.leafBlockParsers)if(e){let n=e(this,t);n&&t.parsers.push(n)}lines:for(;this.nextLine()&&e.pos!=e.text.length;){if(e.indent<e.baseIndent+4){for(let n of this.parser.endLeafBlock)if(n(this,e,t))break lines}for(let n of t.parsers)if(n.nextLine(this,e,t))return null;t.content+=`
13
13
  `+e.scrub();for(let n of e.markers)t.marks.push(n)}return this.finishLeaf(t),null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw RangeError(`Can't move stoppedAt forward`);this.stoppedAt=e}reuseFragment(e){if(!this.fragments.moveTo(this.absoluteLineStart+e,this.absoluteLineStart)||!this.fragments.matches(this.block.hash))return!1;let t=this.fragments.takeNodes(this);return t?(this.absoluteLineStart+=t,this.lineStart=pT(this.absoluteLineStart,this.ranges),this.moveRangeI(),this.absoluteLineStart<this.to?(this.lineStart++,this.absoluteLineStart++,this.readLine()):(this.atEnd=!0,this.readLine()),!0):!1}get depth(){return this.stack.length}parentType(e=this.depth-1){return this.parser.nodeSet.types[this.stack[e].type]}nextLine(){return this.lineStart+=this.line.text.length,this.absoluteLineEnd>=this.to?(this.absoluteLineStart=this.absoluteLineEnd,this.atEnd=!0,this.readLine(),!1):(this.lineStart++,this.absoluteLineStart=this.absoluteLineEnd+1,this.moveRangeI(),this.readLine(),!0)}peekLine(){return this.scanLine(this.absoluteLineEnd+1).text}moveRangeI(){for(;this.rangeI<this.ranges.length-1&&this.absoluteLineStart>=this.ranges[this.rangeI].to;)this.rangeI++,this.absoluteLineStart=Math.max(this.absoluteLineStart,this.ranges[this.rangeI].from)}scanLine(e){let t=Lw;if(t.end=e,e>=this.to)t.text=``;else if(t.text=this.lineChunkAt(e),t.end+=t.text.length,this.ranges.length>1){let e=this.absoluteLineStart,n=this.rangeI;for(;this.ranges[n].to<t.end;){n++;let r=this.ranges[n].from,i=this.lineChunkAt(r);t.end=r+i.length,t.text=t.text.slice(0,this.ranges[n-1].to-e)+i,e=t.end-t.text.length}}return t}readLine(){let{line:e}=this,{text:t,end:n}=this.scanLine(this.absoluteLineStart);for(this.absoluteLineEnd=n,e.reset(t);e.depth<this.stack.length;e.depth++){let t=this.stack[e.depth],n=this.parser.skipContextMarkup[t.type];if(!n)throw Error(`Unhandled block context `+Q[t.type]);let r=this.line.markers.length;if(!n(t,this,e)){this.line.markers.length>r&&(t.end=this.line.markers[this.line.markers.length-1].to),e.forward();break}e.forward()}}lineChunkAt(e){let t=this.input.chunk(e),n;if(this.input.lineChunks)n=t==`
14
14
  `?``:t;else{let e=t.indexOf(`
@@ -35,10 +35,10 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
35
35
  \${}
36
36
  }`,{label:`interface`,detail:`definition`,type:`keyword`}),iw("type ${name} = ${type}",{label:`type`,detail:`definition`,type:`keyword`}),iw(`enum \${name} {
37
37
  \${}
38
- }`,{label:`enum`,detail:`definition`,type:`keyword`})]),ck=new Q_,lk=new Set([`Script`,`Block`,`FunctionExpression`,`FunctionDeclaration`,`ArrowFunction`,`MethodDeclaration`,`ForStatement`]);function uk(e){return(t,n)=>{let r=t.node.getChild(`VariableDefinition`);return r&&n(r,e),!0}}var dk=[`FunctionDeclaration`],fk={FunctionDeclaration:uk(`function`),ClassDeclaration:uk(`class`),ClassExpression:()=>!0,EnumDeclaration:uk(`constant`),TypeAliasDeclaration:uk(`type`),NamespaceDeclaration:uk(`namespace`),VariableDefinition(e,t){e.matchContext(dk)||t(e,`variable`)},TypeDefinition(e,t){t(e,`type`)},__proto__:null};function pk(e,t){let n=ck.get(t);if(n)return n;let r=[],i=!0;function a(t,n){let i=e.sliceString(t.from,t.to);r.push({label:i,type:n})}return t.cursor(j_.IncludeAnonymous).iterate(t=>{if(i)i=!1;else if(t.name){let e=fk[t.name];if(e&&e(t,a)||lk.has(t.name))return!1}else if(t.to-t.from>8192){for(let n of pk(e,t.node))r.push(n);return!1}}),ck.set(t,r),r}var mk=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,hk=[`TemplateString`,`String`,`RegExp`,`LineComment`,`BlockComment`,`VariableDefinition`,`TypeDefinition`,`Label`,`PropertyDefinition`,`PropertyName`,`PrivatePropertyDefinition`,`PrivatePropertyName`,`JSXText`,`JSXAttributeValue`,`JSXOpenTag`,`JSXCloseTag`,`JSXSelfClosingTag`,`.`,`?.`];function gk(e){let t=Qv(e.state).resolveInner(e.pos,-1);if(hk.indexOf(t.name)>-1)return null;let n=t.name==`VariableName`||t.to-t.from<20&&mk.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let n=t;n;n=n.parent)lk.has(n.name)&&(r=r.concat(pk(e.state.doc,n)));return{options:r,from:n?t.from:e.pos,validFor:mk}}var _k=Zv.define({name:`javascript`,parser:ak.configure({props:[_y.add({IfStatement:ky({except:/^\s*({|else\b)/}),TryStatement:ky({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Oy,SwitchBody:e=>{let t=e.textAfter,n=/^\s*\}/.test(t),r=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:r?1:2)*e.unit},Block:Ey({closing:`}`}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":ky({except:/^\s*{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),jy.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":My,BlockComment(e){return{from:e.from+2,to:e.to-2}},JSXElement(e){let t=e.firstChild;if(!t||t.name==`JSXSelfClosingTag`)return null;let n=e.lastChild;return{from:t.to,to:n.type.isError?e.to:n.from}},"JSXSelfClosingTag JSXOpenTag"(e){let t=e.firstChild?.nextSibling,n=e.lastChild;return!t||t.type.isError?null:{from:t.to,to:n.type.isError?e.to:n.from}}})]}),languageData:{closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,"`"]},commentTokens:{line:`//`,block:{open:`/*`,close:`*/`}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:`$`}}),vk={test:e=>/^JSX/.test(e.name),facet:qv({commentTokens:{block:{open:`{/*`,close:`*/}`}}})},yk=_k.configure({dialect:`ts`},`typescript`),bk=_k.configure({dialect:`jsx`,props:[Jv.add(e=>e.isTop?[vk]:void 0)]}),xk=_k.configure({dialect:`jsx ts`,props:[Jv.add(e=>e.isTop?[vk]:void 0)]},`typescript`),Sk=e=>({label:e,type:`keyword`}),Ck=`break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield`.split(` `).map(Sk),wk=Ck.concat([`declare`,`implements`,`private`,`protected`,`public`].map(Sk));function Tk(e={}){let t=e.jsx?e.typescript?xk:bk:e.typescript?yk:_k,n=e.typescript?sk.concat(wk):ok.concat(Ck);return new ly(t,[_k.data.of({autocomplete:rC(hk,nC(n))}),_k.data.of({autocomplete:gk}),e.jsx?kk:[]])}function Ek(e){for(;;){if(e.name==`JSXOpenTag`||e.name==`JSXSelfClosingTag`||e.name==`JSXFragmentTag`)return e;if(e.name==`JSXEscape`||!e.parent)return null;e=e.parent}}function Dk(e,t,n=e.length){for(let r=t?.firstChild;r;r=r.nextSibling)if(r.name==`JSXIdentifier`||r.name==`JSXBuiltin`||r.name==`JSXNamespacedName`||r.name==`JSXMemberExpression`)return e.sliceString(r.from,Math.min(r.to,n));return``}var Ok=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),kk=J.inputHandler.of((e,t,n,r,i)=>{if((Ok?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||r!=`>`&&r!=`/`||!_k.isActiveAt(e.state,t,-1))return!1;let a=i(),{state:o}=a,s=o.changeByRange(e=>{let{head:t}=e,n=Qv(o).resolveInner(t-1,-1),i;if(n.name==`JSXStartTag`&&(n=n.parent),!(o.doc.sliceString(t-1,t)!=r||n.name==`JSXAttributeValue`&&n.to>t)){if(r==`>`&&n.name==`JSXFragmentTag`)return{range:e,changes:{from:t,insert:`</>`}};if(r==`/`&&n.name==`JSXStartCloseTag`){let e=n.parent,r=e.parent;if(r&&e.from==t-2&&((i=Dk(o.doc,r.firstChild,t))||r.firstChild?.name==`JSXFragmentTag`)){let e=`${i}>`;return{range:G.cursor(t+e.length,-1),changes:{from:t,insert:e}}}}else if(r==`>`){let r=Ek(n);if(r&&r.name==`JSXOpenTag`&&!/^\/?>|^<\//.test(o.doc.sliceString(t,t+2))&&(i=Dk(o.doc,r,t)))return{range:e,changes:{from:t,insert:`</${i}>`}}}}return{range:e}});return!s.changes.empty&&(e.dispatch([a,o.update(s,{userEvent:`input.complete`,scrollIntoView:!0})]),!0)}),Ak=[`_blank`,`_self`,`_top`,`_parent`],jk=[`ascii`,`utf-8`,`utf-16`,`latin1`,`latin1`],Mk=[`get`,`post`,`put`,`delete`],Nk=[`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`],Pk=[`true`,`false`],$={},Fk={a:{attrs:{href:null,ping:null,type:null,media:null,target:Ak,hreflang:null}},abbr:$,address:$,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:[`default`,`rect`,`circle`,`poly`]}},article:$,aside:$,audio:{attrs:{src:null,mediagroup:null,crossorigin:[`anonymous`,`use-credentials`],preload:[`none`,`metadata`,`auto`],autoplay:[`autoplay`],loop:[`loop`],controls:[`controls`]}},b:$,base:{attrs:{href:null,target:Ak}},bdi:$,bdo:$,blockquote:{attrs:{cite:null}},body:$,br:$,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:[`autofocus`],disabled:[`autofocus`],formenctype:Nk,formmethod:Mk,formnovalidate:[`novalidate`],formtarget:Ak,type:[`submit`,`reset`,`button`]}},canvas:{attrs:{width:null,height:null}},caption:$,center:$,cite:$,code:$,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:[`command`,`checkbox`,`radio`],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:[`disabled`],checked:[`checked`]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:[`disabled`],multiple:[`multiple`]}},datalist:{attrs:{data:null}},dd:$,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:[`open`]}},dfn:$,div:$,dl:$,dt:$,em:$,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:[`disabled`],form:null,name:null}},figcaption:$,figure:$,footer:$,form:{attrs:{action:null,name:null,"accept-charset":jk,autocomplete:[`on`,`off`],enctype:Nk,method:Mk,novalidate:[`novalidate`],target:Ak}},h1:$,h2:$,h3:$,h4:$,h5:$,h6:$,head:{children:[`title`,`base`,`link`,`style`,`meta`,`script`,`noscript`,`command`]},header:$,hgroup:$,hr:$,html:{attrs:{manifest:null}},i:$,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:[`allow-top-navigation`,`allow-same-origin`,`allow-forms`,`allow-scripts`],seamless:[`seamless`]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:[`anonymous`,`use-credentials`]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:[`audio/*`,`video/*`,`image/*`],autocomplete:[`on`,`off`],autofocus:[`autofocus`],checked:[`checked`],disabled:[`disabled`],formenctype:Nk,formmethod:Mk,formnovalidate:[`novalidate`],formtarget:Ak,multiple:[`multiple`],readonly:[`readonly`],required:[`required`],type:[`hidden`,`text`,`search`,`tel`,`url`,`email`,`password`,`datetime`,`date`,`month`,`week`,`time`,`datetime-local`,`number`,`range`,`color`,`checkbox`,`radio`,`file`,`submit`,`image`,`reset`,`button`]}},ins:{attrs:{cite:null,datetime:null}},kbd:$,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:[`autofocus`],disabled:[`disabled`],keytype:[`RSA`]}},label:{attrs:{for:null,form:null}},legend:$,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:[`all`,`16x16`,`16x16 32x32`,`16x16 32x32 64x64`]}},map:{attrs:{name:null}},mark:$,menu:{attrs:{label:null,type:[`list`,`context`,`toolbar`]}},meta:{attrs:{content:null,charset:jk,name:[`viewport`,`application-name`,`author`,`description`,`generator`,`keywords`],"http-equiv":[`content-language`,`content-type`,`default-style`,`refresh`]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:$,noscript:$,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:[`typemustmatch`]}},ol:{attrs:{reversed:[`reversed`],start:null,type:[`1`,`a`,`A`,`i`,`I`]},children:[`li`,`script`,`template`,`ul`,`ol`]},optgroup:{attrs:{disabled:[`disabled`],label:null}},option:{attrs:{disabled:[`disabled`],label:null,selected:[`selected`],value:null}},output:{attrs:{for:null,form:null,name:null}},p:$,param:{attrs:{name:null,value:null}},pre:$,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:$,rt:$,ruby:$,samp:$,script:{attrs:{type:[`text/javascript`],src:null,async:[`async`],defer:[`defer`],charset:jk}},section:$,select:{attrs:{form:null,name:null,size:null,autofocus:[`autofocus`],disabled:[`disabled`],multiple:[`multiple`]}},slot:{attrs:{name:null}},small:$,source:{attrs:{src:null,type:null,media:null}},span:$,strong:$,style:{attrs:{type:[`text/css`],media:null,scoped:null}},sub:$,summary:$,sup:$,table:$,tbody:$,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:$,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:[`autofocus`],disabled:[`disabled`],readonly:[`readonly`],required:[`required`],wrap:[`soft`,`hard`]}},tfoot:$,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:[`row`,`col`,`rowgroup`,`colgroup`]}},thead:$,time:{attrs:{datetime:null}},title:$,tr:$,track:{attrs:{src:null,label:null,default:null,kind:[`subtitles`,`captions`,`descriptions`,`chapters`,`metadata`],srclang:null}},ul:{children:[`li`,`script`,`template`,`ul`,`ol`]},var:$,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:[`anonymous`,`use-credentials`],preload:[`auto`,`metadata`,`none`],autoplay:[`autoplay`],mediagroup:[`movie`],muted:[`muted`],controls:[`controls`]}},wbr:$},Ik={accesskey:null,class:null,contenteditable:Pk,contextmenu:null,dir:[`ltr`,`rtl`,`auto`],draggable:[`true`,`false`,`auto`],dropzone:[`copy`,`move`,`link`,`string:`,`file:`],hidden:[`hidden`],id:null,inert:[`inert`],itemid:null,itemprop:null,itemref:null,itemscope:[`itemscope`],itemtype:null,lang:[`ar`,`bn`,`de`,`en-GB`,`en-US`,`es`,`fr`,`hi`,`id`,`ja`,`pa`,`pt`,`ru`,`tr`,`zh`],spellcheck:Pk,autocorrect:Pk,autocapitalize:Pk,style:null,tabindex:null,title:null,translate:[`yes`,`no`],rel:[`stylesheet`,`alternate`,`author`,`bookmark`,`help`,`license`,`next`,`nofollow`,`noreferrer`,`prefetch`,`prev`,`search`,`tag`],role:`alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer`.split(` `),"aria-activedescendant":null,"aria-atomic":Pk,"aria-autocomplete":[`inline`,`list`,`both`,`none`],"aria-busy":Pk,"aria-checked":[`true`,`false`,`mixed`,`undefined`],"aria-controls":null,"aria-describedby":null,"aria-disabled":Pk,"aria-dropeffect":null,"aria-expanded":[`true`,`false`,`undefined`],"aria-flowto":null,"aria-grabbed":[`true`,`false`,`undefined`],"aria-haspopup":Pk,"aria-hidden":Pk,"aria-invalid":[`true`,`false`,`grammar`,`spelling`],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":[`off`,`polite`,`assertive`],"aria-multiline":Pk,"aria-multiselectable":Pk,"aria-owns":null,"aria-posinset":null,"aria-pressed":[`true`,`false`,`mixed`,`undefined`],"aria-readonly":Pk,"aria-relevant":null,"aria-required":Pk,"aria-selected":[`true`,`false`,`undefined`],"aria-setsize":null,"aria-sort":[`ascending`,`descending`,`none`,`other`],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Lk=`beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload`.split(` `).map(e=>`on`+e);for(let e of Lk)Ik[e]=null;var Rk=class{constructor(e,t){this.tags={...Fk,...e},this.globalAttrs={...Ik,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};Rk.default=new Rk;function zk(e,t,n=e.length){if(!t)return``;let r=t.firstChild,i=r&&r.getChild(`TagName`);return i?e.sliceString(i.from,Math.min(i.to,n)):``}function Bk(e,t=!1){for(;e;e=e.parent)if(e.name==`Element`){if(t)t=!1;else return e}return null}function Vk(e,t,n){return n.tags[zk(e,Bk(t))]?.children||n.allTags}function Hk(e,t){let n=[];for(let r=Bk(t);r&&!r.type.isTop;r=Bk(r.parent)){let i=zk(e,r);if(i&&r.lastChild.name==`CloseTag`)break;i&&n.indexOf(i)<0&&(t.name==`EndTag`||t.from>=r.firstChild.to)&&n.push(i)}return n}var Uk=/^[:\-\.\w\u00b7-\uffff]*$/;function Wk(e,t,n,r,i){let a=/\s*>/.test(e.sliceDoc(i,i+5))?``:`>`,o=Bk(n,n.name==`StartTag`||n.name==`TagName`);return{from:r,to:i,options:Vk(e.doc,o,t).map(e=>({label:e,type:`type`})).concat(Hk(e.doc,n).map((e,t)=>({label:`/`+e,apply:`/`+e+a,type:`type`,boost:99-t}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function Gk(e,t,n,r){let i=/\s*>/.test(e.sliceDoc(r,r+5))?``:`>`;return{from:n,to:r,options:Hk(e.doc,t).map((e,t)=>({label:e,apply:e+i,type:`type`,boost:99-t})),validFor:Uk}}function Kk(e,t,n,r){let i=[],a=0;for(let r of Vk(e.doc,n,t))i.push({label:`<`+r,type:`type`});for(let t of Hk(e.doc,n))i.push({label:`</`+t+`>`,type:`type`,boost:99-a++});return{from:r,to:r,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function qk(e,t,n,r,i){let a=Bk(n),o=a?t.tags[zk(e.doc,a)]:null,s=o&&o.attrs?Object.keys(o.attrs):[];return{from:r,to:i,options:(o&&o.globalAttrs===!1?s:s.length?s.concat(t.globalAttrNames):t.globalAttrNames).map(e=>({label:e,type:`property`})),validFor:Uk}}function Jk(e,t,n,r,i){let a=n.parent?.getChild(`AttributeName`),o=[],s;if(a){let c=e.sliceDoc(a.from,a.to),l=t.globalAttrs[c];if(!l){let r=Bk(n),i=r?t.tags[zk(e.doc,r)]:null;l=i?.attrs&&i.attrs[c]}if(l){let t=e.sliceDoc(r,i).toLowerCase(),n=`"`,a=`"`;/^['"]/.test(t)?(s=t[0]==`"`?/^[^"]*$/:/^[^']*$/,n=``,a=e.sliceDoc(i,i+1)==t[0]?``:t[0],t=t.slice(1),r++):s=/^[^\s<>='"]*$/;for(let e of l)o.push({label:e,apply:n+e+a,type:`constant`})}}return{from:r,to:i,options:o,validFor:s}}function Yk(e,t){let{state:n,pos:r}=t,i=Qv(n).resolveInner(r,-1),a=i.resolve(r);for(let e=r,t;a==i&&(t=i.childBefore(e));){let n=t.lastChild;if(!n||!n.type.isError||n.from<n.to)break;a=i=t,e=n.from}return i.name==`TagName`?i.parent&&/CloseTag$/.test(i.parent.name)?Gk(n,i,i.from,r):Wk(n,e,i,i.from,r):i.name==`StartTag`||i.name==`IncompleteTag`?Wk(n,e,i,r,r):i.name==`StartCloseTag`||i.name==`IncompleteCloseTag`?Gk(n,i,r,r):i.name==`OpenTag`||i.name==`SelfClosingTag`||i.name==`AttributeName`?qk(n,e,i,i.name==`AttributeName`?i.from:r,r):i.name==`Is`||i.name==`AttributeValue`||i.name==`UnquotedAttributeValue`?Jk(n,e,i,i.name==`Is`?r:i.from,r):t.explicit&&(a.name==`Element`||a.name==`Text`||a.name==`Document`)?Kk(n,e,i,r):null}function Xk(e){return Yk(Rk.default,e)}function Zk(e){let{extraTags:t,extraGlobalAttributes:n}=e,r=n||t?new Rk(t,n):Rk.default;return e=>Yk(r,e)}var Qk=_k.parser.configure({top:`SingleExpression`}),$k=[{tag:`script`,attrs:e=>e.type==`text/typescript`||e.lang==`ts`,parser:yk.parser},{tag:`script`,attrs:e=>e.type==`text/babel`||e.type==`text/jsx`,parser:bk.parser},{tag:`script`,attrs:e=>e.type==`text/typescript-jsx`,parser:xk.parser},{tag:`script`,attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:Qk},{tag:`script`,attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:_k.parser},{tag:`style`,attrs(e){return(!e.lang||e.lang==`css`)&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:SO.parser}],eA=[{name:`style`,parser:SO.parser.configure({top:`Styles`})}].concat(Lk.map(e=>({name:e,parser:_k.parser}))),tA=Zv.define({name:`html`,parser:yD.configure({props:[_y.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let t=null,n;for(let n=e.node;;){let e=n.lastChild;if(!e||e.name!=`Element`||e.to!=n.to)break;t=n=e}return t&&!((n=t.lastChild)&&(n.name==`CloseTag`||n.name==`SelfClosingTag`))?e.lineIndent(t.from)+e.unit:null}}),jy.add({Element(e){let t=e.firstChild,n=e.lastChild;return!t||t.name!=`OpenTag`?null:{from:t.to,to:n.name==`CloseTag`?n.from:e.to}}}),lb.add({"OpenTag CloseTag":e=>e.getChild(`TagName`)})]}),languageData:{commentTokens:{block:{open:`<!--`,close:`-->`}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:`-_`}}),nA=tA.configure({wrap:CD($k,eA)});function rA(e={}){let t=``,n;return e.matchClosingTags===!1&&(t=`noMatch`),e.selfClosingTags===!0&&(t=(t?t+` `:``)+`selfClosing`),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(n=CD((e.nestedLanguages||[]).concat($k),(e.nestedAttributes||[]).concat(eA))),new ly(n?tA.configure({wrap:n,dialect:t}):t?nA.configure({dialect:t}):nA,[nA.data.of({autocomplete:Zk(e)}),e.autoCloseTags===!1?[]:oA,Tk().support,CO().support])}var iA=new Set(`area base br col command embed frame hr img input keygen link meta param source track wbr menuitem`.split(` `));function aA(e,t,n){for(;;){if(t.lastChild?.name!=`CloseTag`)return!1;let r=t.parent;if(!r||zk(e,r)!=n)return!0;t=r}}var oA=J.inputHandler.of((e,t,n,r,i)=>{if(e.composing||e.state.readOnly||t!=n||r!=`>`&&r!=`/`||!nA.isActiveAt(e.state,t,-1))return!1;let a=i(),{state:o}=a,s=o.changeByRange(e=>{let t=o.doc.sliceString(e.from-1,e.to)==r,{head:n}=e,i=Qv(o).resolveInner(n,-1),a;if(t&&r==`>`&&i.name==`EndTag`){let t=i.parent;if((a=zk(o.doc,t.parent,n))&&!iA.has(a)&&!aA(o.doc,t.parent,a))return{range:e,changes:{from:n,to:n+ +(o.doc.sliceString(n,n+1)===`>`),insert:`</${a}>`}}}else if(t&&r==`/`&&i.name==`IncompleteCloseTag`){let e=i.parent;if(i.from==n-2&&e.lastChild?.name!=`CloseTag`&&(a=zk(o.doc,e,n))&&!iA.has(a)){let e=n+ +(o.doc.sliceString(n,n+1)===`>`),t=`${a}>`;return{range:G.cursor(n+t.length,-1),changes:{from:n,to:e,insert:t}}}}return{range:e}});return!s.changes.empty&&(e.dispatch([a,o.update(s,{userEvent:`input.complete`,scrollIntoView:!0})]),!0)}),sA=qv({commentTokens:{block:{open:`<!--`,close:`-->`}}}),cA=new Y,lA=hT.configure({props:[jy.add(e=>!e.is(`Block`)||e.is(`Document`)||uA(e)!=null||dA(e)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),cA.add(uA),_y.add({Document:()=>null}),Kv.add({Document:sA})]});function uA(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function dA(e){return e.name==`OrderedList`||e.name==`BulletList`}function fA(e,t){let n=e;for(;;){let e=n.nextSibling,r;if(!e||(r=uA(e.type))!=null&&r<=t)break;n=e}return n.to}var pA=Ay.of((e,t,n)=>{for(let r=Qv(e).resolveInner(n,-1);r&&!(r.from<t);r=r.parent){let e=r.type.prop(cA);if(e==null)continue;let t=fA(r,e);if(t>n)return{from:n,to:t}}return null});function mA(e){return new Yv(sA,e,[],`markdown`)}var hA=mA(lA),gA=mA(lA.configure([FT,RT,LT,zT,{props:[jy.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]));function _A(e,t){return n=>{if(n&&e){let t=null;if(n=/\S*/.exec(n)[0],t=typeof e==`function`?e(n):uy.matchLanguageName(e,n,!0),t instanceof uy)return t.support?t.support.language.parser:ny.getSkippingParser(t.load());if(t)return t.parser}return t?t.parser:null}}var vA=class{constructor(e,t,n,r,i,a,o){this.node=e,this.from=t,this.to=n,this.spaceBefore=r,this.spaceAfter=i,this.type=a,this.item=o}blank(e,t=!0){let n=this.spaceBefore+(this.node.name==`Blockquote`?`>`:``);if(e!=null){for(;n.length<e;)n+=` `;return n}for(let e=this.to-this.from-n.length-this.spaceAfter.length;e>0;e--)n+=` `;return n+(t?this.spaceAfter:``)}marker(e,t){let n=this.node.name==`OrderedList`?String(+bA(this.item,e)[2]+t):``;return this.spaceBefore+n+this.type+this.spaceAfter}};function yA(e,t){let n=[],r=[];for(let t=e;t;t=t.parent){if(t.name==`FencedCode`)return r;(t.name==`ListItem`||t.name==`Blockquote`)&&n.push(t)}for(let e=n.length-1;e>=0;e--){let i=n[e],a,o=t.lineAt(i.from),s=i.from-o.from;if(i.name==`Blockquote`&&(a=/^ *>( ?)/.exec(o.text.slice(s))))r.push(new vA(i,s,s+a[0].length,``,a[1],`>`,null));else if(i.name==`ListItem`&&i.parent.name==`OrderedList`&&(a=/^( *)\d+([.)])( *)/.exec(o.text.slice(s)))){let e=a[3],t=a[0].length;e.length>=4&&(e=e.slice(0,e.length-4),t-=4),r.push(new vA(i.parent,s,s+t,a[1],e,a[2],i))}else if(i.name==`ListItem`&&i.parent.name==`BulletList`&&(a=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(o.text.slice(s)))){let e=a[4],t=a[0].length;e.length>4&&(e=e.slice(0,e.length-4),t-=4);let n=a[2];a[3]&&(n+=a[3].replace(/[xX]/,` `)),r.push(new vA(i.parent,s,s+t,a[1],e,n,i))}}return r}function bA(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function xA(e,t,n,r=0){for(let i=-1,a=e;;){if(a.name==`ListItem`){let e=bA(a,t),o=+e[2];if(i>=0){if(o!=i+1)return;n.push({from:a.from+e[1].length,to:a.from+e[0].length,insert:String(i+2+r)})}i=o}let e=a.nextSibling;if(!e)break;a=e}}function SA(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(fy)!=` `)return e;let r=rd(e,4,n),i=``;for(let e=r;e>0;)e>=4?(i+=` `,e-=4):(i+=` `,e--);return i+e.slice(n)}var CA=((e={})=>({state:t,dispatch:n})=>{let r=Qv(t),{doc:i}=t,a=null,o=t.changeByRange(n=>{if(!n.empty||!gA.isActiveAt(t,n.from,-1)&&!gA.isActiveAt(t,n.from,1))return a={range:n};let o=n.from,s=i.lineAt(o),c=yA(r.resolveInner(o,-1),i);for(;c.length&&c[c.length-1].from>o-s.from;)c.pop();if(!c.length)return a={range:n};let l=c[c.length-1];if(l.to-l.spaceAfter.length>o-s.from)return a={range:n};let u=o>=l.to-l.spaceAfter.length&&!/\S/.test(s.text.slice(l.to));if(l.item&&u){if(l.item.from<s.from&&!/^[\s>]*$/.test(s.text.slice(0,l.to)))return a={range:n};let r=l.node.firstChild,u=l.node.getChild(`ListItem`,`ListItem`);if(r.to>=o||u&&u.to<o||s.from>0&&!/[^\s>]/.test(i.lineAt(s.from-1).text)||e.nonTightLists===!1){let e=c.length>1?c[c.length-2]:null,t,n=``;e&&e.item?(t=s.from+e.from,n=e.marker(i,1)):t=s.from+(e?e.to:0);let r=[{from:t,to:o,insert:n}];return l.node.name==`OrderedList`&&xA(l.item,i,r,-2),e&&e.node.name==`OrderedList`&&xA(e.item,i,r),{range:G.cursor(t+n.length),changes:r}}{let e=EA(c,t,s);return{range:G.cursor(o+e.length+1),changes:{from:s.from,insert:e+t.lineBreak}}}}if(l.node.name==`Blockquote`&&u&&s.from){let e=i.lineAt(s.from-1),r=/>\s*$/.exec(e.text);if(r&&r.index==l.from){let i=t.changes([{from:e.from+r.index,to:e.to},{from:s.from+l.from,to:s.to}]);return{range:n.map(i),changes:i}}}let d=[];l.node.name==`OrderedList`&&xA(l.item,i,d);let f=l.item&&l.item.from<s.from,p=``;if(!f||/^[\s\d.)\-+*>]*/.exec(s.text)[0].length>=l.to)for(let e=0,t=c.length-1;e<=t;e++)p+=e==t&&!f?c[e].marker(i,1):c[e].blank(e<t?rd(s.text,4,c[e+1].from)-p.length:null);let m=o;for(;m>s.from&&/\s/.test(s.text.charAt(m-s.from-1));)m--;return p=SA(p,t),TA(l.node,t.doc)&&(p=EA(c,t,s)+t.lineBreak+p),d.push({from:m,to:o,insert:t.lineBreak+p}),{range:G.cursor(m+p.length+1),changes:d}});return!a&&(n(t.update(o,{scrollIntoView:!0,userEvent:`input`})),!0)})();function wA(e){return e.name==`QuoteMark`||e.name==`ListMark`}function TA(e,t){if(e.name!=`OrderedList`&&e.name!=`BulletList`)return!1;let n=e.firstChild,r=e.getChild(`ListItem`,`ListItem`);if(!r)return!1;let i=t.lineAt(n.to),a=t.lineAt(r.from),o=/^[\s>]*$/.test(i.text);return i.number+ +!o<a.number}function EA(e,t,n){let r=``;for(let t=0,i=e.length-2;t<=i;t++)r+=e[t].blank(t<i?rd(n.text,4,e[t+1].from)-r.length:null,t<i);return SA(r,t)}function DA(e,t){let n=e.resolveInner(t,-1),r=t;wA(n)&&(r=n.from,n=n.parent);for(let e;e=n.childBefore(r);)if(wA(e))r=e.from;else if(e.name==`OrderedList`||e.name==`BulletList`)n=e.lastChild,r=n.to;else break;return n}var OA=[{key:`Enter`,run:CA},{key:`Backspace`,run:({state:e,dispatch:t})=>{let n=Qv(e),r=null,i=e.changeByRange(t=>{let i=t.from,{doc:a}=e;if(t.empty&&gA.isActiveAt(e,t.from)){let t=a.lineAt(i),r=yA(DA(n,i),a);if(r.length){let n=r[r.length-1],a=n.to-n.spaceAfter.length+ +!!n.spaceAfter;if(i-t.from>a&&!/\S/.test(t.text.slice(a,i-t.from)))return{range:G.cursor(t.from+a),changes:{from:t.from+a,to:i}};if(i-t.from==a&&(n.item&&t.from<=n.item.from||/^[\s>]*$/.test(t.text.slice(0,n.to)))){let r=t.from+n.from;if(n.item&&n.node.from<n.item.from&&/\S/.test(t.text.slice(n.from,n.to))){let i=n.blank(rd(t.text,4,n.to)-rd(t.text,4,n.from));return r==t.from&&(i=SA(i,e)),{range:G.cursor(r+i.length),changes:{from:r,to:t.from+n.to,insert:i}}}if(r<i)return{range:G.cursor(r),changes:{from:r,to:i}}}}}return r={range:t}});return!r&&(t(e.update(i,{scrollIntoView:!0,userEvent:`delete`})),!0)}}],kA=rA({matchClosingTags:!1});function AA(e={}){let{codeLanguages:t,defaultCodeLanguage:n,addKeymap:r=!0,base:{parser:i}=hA,completeHTMLTags:a=!0,pasteURLAsLink:o=!0,htmlTagLanguage:s=kA}=e;if(!(i instanceof Bw))throw RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=e.extensions?[e.extensions]:[],l=[s.support,pA],u;o&&l.push(FA),n instanceof ly?(l.push(n.support),u=n.language):n&&(u=n);let d=t||u?_A(t,u):void 0;c.push(_T({codeParser:d,htmlParser:s.language.parser})),r&&l.push(ru.high(jg.of(OA)));let f=mA(i.configure(c));return a&&l.push(f.data.of({autocomplete:jA})),new ly(f,l)}function jA(e){let{state:t,pos:n}=e,r=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(n-25,n));if(!r)return null;let i=Qv(t).resolveInner(n,-1);for(;i&&!i.type.isTop;){if(i.name==`CodeBlock`||i.name==`FencedCode`||i.name==`ProcessingInstructionBlock`||i.name==`CommentBlock`||i.name==`Link`||i.name==`Image`)return null;i=i.parent}return{from:n-r[0].length,to:n,options:NA(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}var MA=null;function NA(){if(MA)return MA;let e=Xk(new $S(Iu.create({extensions:kA}),0,!0));return MA=e?e.options:[]}var PA=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,FA=J.domEventHandlers({paste:(e,t)=>{let{main:n}=t.state.selection;if(n.empty)return!1;let r=e.clipboardData?.getData(`text/plain`);if(!r||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(r)||(/^www\./.test(r)&&(r=`https://`+r),!gA.isActiveAt(t.state,n.from,1)))return!1;let i=Qv(t.state),a=!1;return i.iterate({from:n.from,to:n.to,enter:e=>{(e.from>n.from||PA.test(e.name))&&(a=!0)},leave:e=>{e.to<n.to&&(a=!0)}}),!a&&(t.dispatch({changes:[{from:n.from,insert:`[`},{from:n.to,insert:`](${r})`}],userEvent:`input.paste`,scrollIntoView:!0}),!0)}});function IA(e){var t=e.Pos;function n(e,t,n){if(t.line===n.line&&t.ch>=n.ch-1){var r=e.getLine(t.line).charCodeAt(t.ch);55296<=r&&r<=55551&&(n.ch+=1)}return{start:t,end:n}}var r=[{keys:`<Left>`,type:`keyToKey`,toKeys:`h`},{keys:`<Right>`,type:`keyToKey`,toKeys:`l`},{keys:`<Up>`,type:`keyToKey`,toKeys:`k`},{keys:`<Down>`,type:`keyToKey`,toKeys:`j`},{keys:`g<Up>`,type:`keyToKey`,toKeys:`gk`},{keys:`g<Down>`,type:`keyToKey`,toKeys:`gj`},{keys:`<Space>`,type:`keyToKey`,toKeys:`l`},{keys:`<BS>`,type:`keyToKey`,toKeys:`h`},{keys:`<Del>`,type:`keyToKey`,toKeys:`x`},{keys:`<C-Space>`,type:`keyToKey`,toKeys:`W`},{keys:`<C-BS>`,type:`keyToKey`,toKeys:`B`},{keys:`<S-Space>`,type:`keyToKey`,toKeys:`w`},{keys:`<S-BS>`,type:`keyToKey`,toKeys:`b`},{keys:`<C-n>`,type:`keyToKey`,toKeys:`j`},{keys:`<C-p>`,type:`keyToKey`,toKeys:`k`},{keys:`<C-[>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-c>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-[>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`<C-c>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`<C-Esc>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-Esc>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`s`,type:`keyToKey`,toKeys:`cl`,context:`normal`},{keys:`s`,type:`keyToKey`,toKeys:`c`,context:`visual`},{keys:`S`,type:`keyToKey`,toKeys:`cc`,context:`normal`},{keys:`S`,type:`keyToKey`,toKeys:`VdO`,context:`visual`},{keys:`<Home>`,type:`keyToKey`,toKeys:`0`},{keys:`<End>`,type:`keyToKey`,toKeys:`$`},{keys:`<PageUp>`,type:`keyToKey`,toKeys:`<C-b>`},{keys:`<PageDown>`,type:`keyToKey`,toKeys:`<C-f>`},{keys:`<CR>`,type:`keyToKey`,toKeys:`j^`,context:`normal`},{keys:`<Ins>`,type:`keyToKey`,toKeys:`i`,context:`normal`},{keys:`<Ins>`,type:`action`,action:`toggleOverwrite`,context:`insert`},{keys:`H`,type:`motion`,motion:`moveToTopLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`M`,type:`motion`,motion:`moveToMiddleLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`L`,type:`motion`,motion:`moveToBottomLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`h`,type:`motion`,motion:`moveByCharacters`,motionArgs:{forward:!1}},{keys:`l`,type:`motion`,motion:`moveByCharacters`,motionArgs:{forward:!0}},{keys:`j`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,linewise:!0}},{keys:`k`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!1,linewise:!0}},{keys:`gj`,type:`motion`,motion:`moveByDisplayLines`,motionArgs:{forward:!0}},{keys:`gk`,type:`motion`,motion:`moveByDisplayLines`,motionArgs:{forward:!1}},{keys:`w`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!1}},{keys:`W`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:`e`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:`E`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:`b`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1}},{keys:`B`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:`ge`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:`gE`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:`{`,type:`motion`,motion:`moveByParagraph`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`}`,type:`motion`,motion:`moveByParagraph`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`(`,type:`motion`,motion:`moveBySentence`,motionArgs:{forward:!1}},{keys:`)`,type:`motion`,motion:`moveBySentence`,motionArgs:{forward:!0}},{keys:`<C-f>`,type:`motion`,motion:`moveByPage`,motionArgs:{forward:!0}},{keys:`<C-b>`,type:`motion`,motion:`moveByPage`,motionArgs:{forward:!1}},{keys:`<C-d>`,type:`motion`,motion:`moveByScroll`,motionArgs:{forward:!0,explicitRepeat:!0}},{keys:`<C-u>`,type:`motion`,motion:`moveByScroll`,motionArgs:{forward:!1,explicitRepeat:!0}},{keys:`gg`,type:`motion`,motion:`moveToLineOrEdgeOfDocument`,motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:`G`,type:`motion`,motion:`moveToLineOrEdgeOfDocument`,motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:`g$`,type:`motion`,motion:`moveToEndOfDisplayLine`},{keys:`g^`,type:`motion`,motion:`moveToStartOfDisplayLine`},{keys:`g0`,type:`motion`,motion:`moveToStartOfDisplayLine`},{keys:`0`,type:`motion`,motion:`moveToStartOfLine`},{keys:`^`,type:`motion`,motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`+`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,toFirstChar:!0}},{keys:`-`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!1,toFirstChar:!0}},{keys:`_`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:`$`,type:`motion`,motion:`moveToEol`,motionArgs:{inclusive:!0}},{keys:`%`,type:`motion`,motion:`moveToMatchedSymbol`,motionArgs:{inclusive:!0,toJumplist:!0}},{keys:`f<character>`,type:`motion`,motion:`moveToCharacter`,motionArgs:{forward:!0,inclusive:!0}},{keys:`F<character>`,type:`motion`,motion:`moveToCharacter`,motionArgs:{forward:!1}},{keys:`t<character>`,type:`motion`,motion:`moveTillCharacter`,motionArgs:{forward:!0,inclusive:!0}},{keys:`T<character>`,type:`motion`,motion:`moveTillCharacter`,motionArgs:{forward:!1}},{keys:`;`,type:`motion`,motion:`repeatLastCharacterSearch`,motionArgs:{forward:!0}},{keys:`,`,type:`motion`,motion:`repeatLastCharacterSearch`,motionArgs:{forward:!1}},{keys:`'<register>`,type:`motion`,motion:`goToMark`,motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<register>",type:`motion`,motion:`goToMark`,motionArgs:{toJumplist:!0}},{keys:"]`",type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!0}},{keys:"[`",type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!1}},{keys:`]'`,type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!0,linewise:!0}},{keys:`['`,type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!1,linewise:!0}},{keys:`]p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:`[p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:`]<character>`,type:`motion`,motion:`moveToSymbol`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`[<character>`,type:`motion`,motion:`moveToSymbol`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`|`,type:`motion`,motion:`moveToColumn`},{keys:`o`,type:`motion`,motion:`moveToOtherHighlightedEnd`,context:`visual`},{keys:`O`,type:`motion`,motion:`moveToOtherHighlightedEnd`,motionArgs:{sameLine:!0},context:`visual`},{keys:`d`,type:`operator`,operator:`delete`},{keys:`y`,type:`operator`,operator:`yank`},{keys:`c`,type:`operator`,operator:`change`},{keys:`=`,type:`operator`,operator:`indentAuto`},{keys:`>`,type:`operator`,operator:`indent`,operatorArgs:{indentRight:!0}},{keys:`<`,type:`operator`,operator:`indent`,operatorArgs:{indentRight:!1}},{keys:`g~`,type:`operator`,operator:`changeCase`},{keys:`gu`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!0},isEdit:!0},{keys:`gU`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!1},isEdit:!0},{keys:`gc`,type:`operator`,operator:`toggleComment`,isEdit:!0},{keys:`n`,type:`motion`,motion:`findNext`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`N`,type:`motion`,motion:`findNext`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`gn`,type:`motion`,motion:`findAndSelectNextInclusive`,motionArgs:{forward:!0}},{keys:`gN`,type:`motion`,motion:`findAndSelectNextInclusive`,motionArgs:{forward:!1}},{keys:`gq`,type:`operator`,operator:`hardWrap`},{keys:`gw`,type:`operator`,operator:`hardWrap`,operatorArgs:{keepCursor:!0}},{keys:`g?`,type:`operator`,operator:`rot13`},{keys:`x`,type:`operatorMotion`,operator:`delete`,motion:`moveByCharacters`,motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:`X`,type:`operatorMotion`,operator:`delete`,motion:`moveByCharacters`,motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:`D`,type:`operatorMotion`,operator:`delete`,motion:`moveToEol`,motionArgs:{inclusive:!0},context:`normal`},{keys:`D`,type:`operator`,operator:`delete`,operatorArgs:{linewise:!0},context:`visual`},{keys:`Y`,type:`operatorMotion`,operator:`yank`,motion:`expandToLine`,motionArgs:{linewise:!0},context:`normal`},{keys:`Y`,type:`operator`,operator:`yank`,operatorArgs:{linewise:!0},context:`visual`},{keys:`C`,type:`operatorMotion`,operator:`change`,motion:`moveToEol`,motionArgs:{inclusive:!0},context:`normal`},{keys:`C`,type:`operator`,operator:`change`,operatorArgs:{linewise:!0},context:`visual`},{keys:`~`,type:`operatorMotion`,operator:`changeCase`,motion:`moveByCharacters`,motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:`normal`},{keys:`~`,type:`operator`,operator:`changeCase`,context:`visual`},{keys:`<C-u>`,type:`operatorMotion`,operator:`delete`,motion:`moveToStartOfLine`,context:`insert`},{keys:`<C-w>`,type:`operatorMotion`,operator:`delete`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1},context:`insert`},{keys:`<C-w>`,type:`idle`,context:`normal`},{keys:`<C-i>`,type:`action`,action:`jumpListWalk`,actionArgs:{forward:!0}},{keys:`<C-o>`,type:`action`,action:`jumpListWalk`,actionArgs:{forward:!1}},{keys:`<C-e>`,type:`action`,action:`scroll`,actionArgs:{forward:!0,linewise:!0}},{keys:`<C-y>`,type:`action`,action:`scroll`,actionArgs:{forward:!1,linewise:!0}},{keys:`a`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`charAfter`},context:`normal`},{keys:`A`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`eol`},context:`normal`},{keys:`A`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`endOfSelectedArea`},context:`visual`},{keys:`i`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`inplace`},context:`normal`},{keys:`gi`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`lastEdit`},context:`normal`},{keys:`I`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`firstNonBlank`},context:`normal`},{keys:`gI`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`bol`},context:`normal`},{keys:`I`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`startOfSelectedArea`},context:`visual`},{keys:`o`,type:`action`,action:`newLineAndEnterInsertMode`,isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:`normal`},{keys:`O`,type:`action`,action:`newLineAndEnterInsertMode`,isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:`normal`},{keys:`v`,type:`action`,action:`toggleVisualMode`},{keys:`V`,type:`action`,action:`toggleVisualMode`,actionArgs:{linewise:!0}},{keys:`<C-v>`,type:`action`,action:`toggleVisualMode`,actionArgs:{blockwise:!0}},{keys:`<C-q>`,type:`action`,action:`toggleVisualMode`,actionArgs:{blockwise:!0}},{keys:`gv`,type:`action`,action:`reselectLastSelection`},{keys:`J`,type:`action`,action:`joinLines`,isEdit:!0},{keys:`gJ`,type:`action`,action:`joinLines`,actionArgs:{keepSpaces:!0},isEdit:!0},{keys:`p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:`P`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:`r<character>`,type:`action`,action:`replace`,isEdit:!0},{keys:`@<register>`,type:`action`,action:`replayMacro`},{keys:`q<register>`,type:`action`,action:`enterMacroRecordMode`},{keys:`R`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{replace:!0},context:`normal`},{keys:`R`,type:`operator`,operator:`change`,operatorArgs:{linewise:!0,fullLine:!0},context:`visual`,exitVisualBlock:!0},{keys:`u`,type:`action`,action:`undo`,context:`normal`},{keys:`u`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!0},context:`visual`,isEdit:!0},{keys:`U`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!1},context:`visual`,isEdit:!0},{keys:`<C-r>`,type:`action`,action:`redo`},{keys:`m<register>`,type:`action`,action:`setMark`},{keys:`"<register>`,type:`action`,action:`setRegister`},{keys:`<C-r><register>`,type:`action`,action:`insertRegister`,context:`insert`,isEdit:!0},{keys:`<C-o>`,type:`action`,action:`oneNormalCommand`,context:`insert`},{keys:`zz`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`center`}},{keys:`z.`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`center`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`zt`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`top`}},{keys:`z<CR>`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`top`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`zb`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`bottom`}},{keys:`z-`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`bottom`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`.`,type:`action`,action:`repeatLastEdit`},{keys:`<C-a>`,type:`action`,action:`incrementNumberToken`,isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:`<C-x>`,type:`action`,action:`incrementNumberToken`,isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:`<C-t>`,type:`action`,action:`indent`,actionArgs:{indentRight:!0},context:`insert`},{keys:`<C-d>`,type:`action`,action:`indent`,actionArgs:{indentRight:!1},context:`insert`},{keys:`a<register>`,type:`motion`,motion:`textObjectManipulation`},{keys:`i<register>`,type:`motion`,motion:`textObjectManipulation`,motionArgs:{textObjectInner:!0}},{keys:`/`,type:`search`,searchArgs:{forward:!0,querySrc:`prompt`,toJumplist:!0}},{keys:`?`,type:`search`,searchArgs:{forward:!1,querySrc:`prompt`,toJumplist:!0}},{keys:`*`,type:`search`,searchArgs:{forward:!0,querySrc:`wordUnderCursor`,wholeWordOnly:!0,toJumplist:!0}},{keys:`#`,type:`search`,searchArgs:{forward:!1,querySrc:`wordUnderCursor`,wholeWordOnly:!0,toJumplist:!0}},{keys:`g*`,type:`search`,searchArgs:{forward:!0,querySrc:`wordUnderCursor`,toJumplist:!0}},{keys:`g#`,type:`search`,searchArgs:{forward:!1,querySrc:`wordUnderCursor`,toJumplist:!0}},{keys:`:`,type:`ex`}],i=Object.create(null),a=r.length,o=[{name:`colorscheme`,shortName:`colo`},{name:`map`},{name:`imap`,shortName:`im`},{name:`nmap`,shortName:`nm`},{name:`vmap`,shortName:`vm`},{name:`omap`,shortName:`om`},{name:`noremap`,shortName:`no`},{name:`nnoremap`,shortName:`nn`},{name:`vnoremap`,shortName:`vn`},{name:`inoremap`,shortName:`ino`},{name:`onoremap`,shortName:`ono`},{name:`unmap`},{name:`mapclear`,shortName:`mapc`},{name:`nmapclear`,shortName:`nmapc`},{name:`vmapclear`,shortName:`vmapc`},{name:`imapclear`,shortName:`imapc`},{name:`omapclear`,shortName:`omapc`},{name:`write`,shortName:`w`},{name:`undo`,shortName:`u`},{name:`redo`,shortName:`red`},{name:`set`,shortName:`se`},{name:`setlocal`,shortName:`setl`},{name:`setglobal`,shortName:`setg`},{name:`sort`,shortName:`sor`},{name:`substitute`,shortName:`s`,possiblyAsync:!0},{name:`startinsert`,shortName:`start`},{name:`nohlsearch`,shortName:`noh`},{name:`yank`,shortName:`y`},{name:`put`,shortName:`pu`},{name:`delmarks`,shortName:`delm`},{name:`marks`,excludeFromCommandHistory:!0},{name:`registers`,shortName:`reg`,excludeFromCommandHistory:!0},{name:`vglobal`,shortName:`v`},{name:`delete`,shortName:`d`},{name:`join`,shortName:`j`},{name:`normal`,shortName:`norm`},{name:`global`,shortName:`g`}],s=xe(``);function c(t){t.setOption(`disableInput`,!0),t.setOption(`showCursorWhenSelecting`,!1),e.signal(t,`vim-mode-change`,{mode:`normal`}),t.on(`cursorActivity`,_n),oe(t),e.on(t.getInputField(),`paste`,u(t))}function l(t){t.setOption(`disableInput`,!1),t.off(`cursorActivity`,_n),e.off(t.getInputField(),`paste`,u(t)),t.state.vim=null,Yt&&clearTimeout(Yt)}function u(e){var t=e.state.vim;return t.onPasteFn||=function(){t.insertMode||(e.setCursor(Le(e.getCursor(),0,1)),Ne.enterInsertMode(e,{},t))},t.onPasteFn}var d=/[\d]/,f=[e.isWordChar,function(t){return t&&!e.isWordChar(t)&&!/\s/.test(t)}],p=[function(e){return/\S/.test(e)}],m=[`<`,`>`],h=[`-`,`"`,`.`,`:`,`_`,`/`,`+`],g=/^\w$/,_=/^[A-Z]$/;try{_=RegExp(`^[\\p{Lu}]$`,`u`)}catch{}function v(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function y(e){return/^[a-z]$/.test(e)}function b(e){return`()[]{}`.indexOf(e)!=-1}function x(e){return d.test(e)}function S(e){return _.test(e)}function C(e){return/^\s*$/.test(e)}function w(e){return`.?!`.indexOf(e)!=-1}function T(e,t){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}var ee={};function E(e,t,n,r,i){if(t===void 0&&!i)throw Error(`defaultValue is required unless callback is provided`);if(n||=`string`,ee[e]={type:n,defaultValue:t,callback:i},r)for(var a=0;a<r.length;a++)ee[r[a]]=ee[e];t&&te(e,t)}function te(e,t,n,r){var i=ee[e];r||={};var a=r.scope;if(!i)return Error(`Unknown option: `+e);if(i.type==`boolean`){if(t&&t!==!0)return Error(`Invalid argument: `+e+`=`+t);t!==!1&&(t=!0)}i.callback?(a!==`local`&&i.callback(t,void 0),a!==`global`&&n&&i.callback(t,n)):(a!==`local`&&(i.value=i.type==`boolean`?!!t:t),a!==`global`&&n&&(n.state.vim.options[e]={value:t}))}function ne(e,t,n){var r=ee[e];n||={};var i=n.scope;if(!r)return Error(`Unknown option: `+e);if(r.callback){let e=t&&r.callback(void 0,t);return i!==`global`&&e!==void 0?e:i===`local`?void 0:r.callback()}return(i!==`global`&&t&&t.state.vim.options[e]||i!==`local`&&r||{}).value}E(`filetype`,void 0,`string`,[`ft`],function(e,t){if(t!==void 0){if(e===void 0){let e=t.getOption(`mode`);return e==`null`?``:e}{let n=e==``?`null`:e;t.setOption(`mode`,n)}}}),E(`textwidth`,80,`number`,[`tw`],function(e,t){if(t!==void 0){if(e===void 0)return t.getOption(`textwidth`);var n=Math.round(e);n>1&&t.setOption(`textwidth`,n)}});var re=function(){var e=100,t=-1,n=0,r=0,i=Array(e);function a(a,o,s){var c=i[t%e];function l(n){var r=++t%e,o=i[r];o&&o.clear(),i[r]=a.setBookmark(n)}if(c){var u=c.find();u&&!Ue(u,o)&&l(o)}else l(o);l(s),n=t,r=t-e+1,r<0&&(r=0)}function o(a,o){t+=o,t>n?t=n:t<r&&(t=r);var s=i[(e+t)%e];if(s&&!s.find()){var c=o>0?1:-1,l,u=a.getCursor();do if(t+=c,s=i[(e+t)%e],s&&(l=s.find())&&!Ue(u,l))break;while(t<n&&t>r)}return s}function s(e,n){var r=t,i=o(e,n);return t=r,i&&i.find()}return{cachedCursor:void 0,add:a,find:s,move:o}},ie=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class ae{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=ie()}exitMacroRecordMode(){var e=D.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1}enterMacroRecordMode(e,t){var n=D.registerController.getRegister(t);if(n){if(n.clear(),this.latestRegister=t,e.openDialog){var r=Ht(`span`,{class:`cm-vim-message`},`recording @`+t);this.onRecordingDone=e.openDialog(r,function(){},{bottom:!0})}this.isRecording=!0}}}function oe(e){return e.state.vim||(e.state.vim={inputState:new Se,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:void 0,sel:{anchor:new t(0,0),head:new t(0,0)},options:{},expectLiteralNext:!1,status:``}),e.state.vim}var D;function se(){for(var e in D={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:re(),macroModeState:new ae,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:``},registerController:new Ee({}),searchHistoryController:new De,exCommandHistoryController:new De},ee){var t=ee[e];t.value=t.defaultValue}}class ce{constructor(e,t){this.keyName=e,this.key=t.key,this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.shiftKey=t.shiftKey}}var le,ue={enterVimMode:c,leaveVimMode:l,buildKeyMap:function(){},getRegisterController:function(){return D.registerController},resetVimGlobalState_:se,getVimGlobalState_:function(){return D},maybeInitVimState_:oe,suppressErrorLogging:!1,InsertModeKey:ce,map:function(e,t,n){sn.map(e,t,n)},unmap:function(e,t){return sn.unmap(e,t)},noremap:function(e,t,n){sn.map(e,t,n,!0)},mapclear:function(e){var t=r.length,n=a,i=r.slice(0,t-n);if(r=r.slice(t-n),e)for(var o=i.length-1;o>=0;o--){var s=i[o];if(e!==s.context){if(s.context)this._mapCommand(s);else{var c=[`normal`,`insert`,`visual`];for(var l in c)if(c[l]!==e){var u=Object.assign({},s);u.context=c[l],this._mapCommand(u)}}}}},langmap:be,vimKeyFromEvent:ye,setOption:te,getOption:ne,defineOption:E,defineEx:function(e,t,n){if(!t)t=e;else if(e.indexOf(t)!==0)throw Error(`(Vim.defineEx) "`+t+`" is not a prefix of "`+e+`", command not registered`);on[e]=n,sn.commandMap_[t]={name:e,shortName:t,type:`api`}},handleKey:function(e,t,n){var r=this.findKey(e,t,n);if(typeof r==`function`)return r()},multiSelectHandleKey:wn,findKey:function(t,n,i){var a=oe(t),o=t;function s(){var e=D.macroModeState;if(e.isRecording){if(n==`q`)return e.exitMacroRecordMode(),Ce(o),!0;i!=`mapping`&&pn(e,n)}}function c(){if(n==`<Esc>`){if(a.visualMode)st(o);else if(a.insertMode)cn(o);else return;return Ce(o),!0}}function l(){if(c())return!0;a.inputState.keyBuffer.push(n);var e=a.inputState.keyBuffer.join(``),t=n.length==1,i=Oe.matchCommand(e,r,a.inputState,`insert`),s=a.inputState.changeQueue;if(i.type==`none`)return Ce(o),!1;if(i.type==`partial`){if(i.expectLiteralNext&&(a.expectLiteralNext=!0),le&&window.clearTimeout(le),le=t&&window.setTimeout(function(){a.insertMode&&a.inputState.keyBuffer.length&&Ce(o)},ne(`insertModeEscKeysTimeout`)),t){var l=o.listSelections();(!s||s.removed.length!=l.length)&&(s=a.inputState.changeQueue=new we),s.inserted+=n;for(var u=0;u<l.length;u++){var d=Ge(l[u].anchor,l[u].head),f=Ke(l[u].anchor,l[u].head),p=o.getRange(d,o.state.overwrite?Le(f,0,1):f);s.removed[u]=(s.removed[u]||``)+p}}return!t}if(i.type==`full`&&(a.inputState.keyBuffer.length=0),a.expectLiteralNext=!1,le&&window.clearTimeout(le),i.command&&s){for(var l=o.listSelections(),u=0;u<l.length;u++){var m=l[u].head;o.replaceRange(s.removed[u]||``,Le(m,0,-s.inserted.length),m,`+input`)}D.macroModeState.lastInsertModeChanges.changes.pop()}return i.command||Ce(o),i.command}function u(){if(s()||c())return!0;a.inputState.keyBuffer.push(n);var e=a.inputState.keyBuffer.join(``);if(/^[1-9]\d*$/.test(e))return!0;var t=/^(\d*)(.*)$/.exec(e);if(!t)return Ce(o),!1;var i=a.visualMode?`visual`:`normal`,l=t[2]||t[1];a.inputState.operatorShortcut&&a.inputState.operatorShortcut.slice(-1)==l&&(l=a.inputState.operatorShortcut);var u=Oe.matchCommand(l,r,a.inputState,i);return u.type==`none`?(Ce(o),!1):u.type==`partial`?(u.expectLiteralNext&&(a.expectLiteralNext=!0),!0):u.type==`clear`?(Ce(o),!0):(a.expectLiteralNext=!1,a.inputState.keyBuffer.length=0,t=/^(\d*)(.*)$/.exec(e),t&&t[1]&&t[1]!=`0`&&a.inputState.pushRepeatDigit(t[1]),u.command)}var d=a.insertMode?l():u();if(d===!1)return!a.insertMode&&(n.length===1||e.isMac&&/<A-.>/.test(n))?function(){return!0}:void 0;if(d===!0)return function(){return!0};if(d)return function(){return o.operation(function(){o.curOp.isVimOp=!0;try{if(typeof d!=`object`)return;d.type==`keyToKey`?he(o,d.toKeys,d):Oe.processCommand(o,a,d)}catch(e){throw o.state.vim=void 0,oe(o),ue.suppressErrorLogging||console.log(e),e}return!0})}},handleEx:function(e,t){sn.processCommand(e,t)},defineMotion:Ae,defineAction:Pe,defineOperator:k,mapCommand:dn,_mapCommand:ln,defineRegister:Te,exitVisualMode:st,exitInsertMode:cn},de=[],fe=!1,pe;function me(e){if(!pe)throw Error(`No prompt to send key to`);if(e[0]==`<`){var t=e.toLowerCase().slice(1,-1);if(t=t.split(`-`).pop()||``,t==`lt`)e=`<`;else if(t==`space`)e=` `;else if(t==`cr`)e=`
38
+ }`,{label:`enum`,detail:`definition`,type:`keyword`})]),ck=new Q_,lk=new Set([`Script`,`Block`,`FunctionExpression`,`FunctionDeclaration`,`ArrowFunction`,`MethodDeclaration`,`ForStatement`]);function uk(e){return(t,n)=>{let r=t.node.getChild(`VariableDefinition`);return r&&n(r,e),!0}}var dk=[`FunctionDeclaration`],fk={FunctionDeclaration:uk(`function`),ClassDeclaration:uk(`class`),ClassExpression:()=>!0,EnumDeclaration:uk(`constant`),TypeAliasDeclaration:uk(`type`),NamespaceDeclaration:uk(`namespace`),VariableDefinition(e,t){e.matchContext(dk)||t(e,`variable`)},TypeDefinition(e,t){t(e,`type`)},__proto__:null};function pk(e,t){let n=ck.get(t);if(n)return n;let r=[],i=!0;function a(t,n){let i=e.sliceString(t.from,t.to);r.push({label:i,type:n})}return t.cursor(j_.IncludeAnonymous).iterate(t=>{if(i)i=!1;else if(t.name){let e=fk[t.name];if(e&&e(t,a)||lk.has(t.name))return!1}else if(t.to-t.from>8192){for(let n of pk(e,t.node))r.push(n);return!1}}),ck.set(t,r),r}var mk=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,hk=[`TemplateString`,`String`,`RegExp`,`LineComment`,`BlockComment`,`VariableDefinition`,`TypeDefinition`,`Label`,`PropertyDefinition`,`PropertyName`,`PrivatePropertyDefinition`,`PrivatePropertyName`,`JSXText`,`JSXAttributeValue`,`JSXOpenTag`,`JSXCloseTag`,`JSXSelfClosingTag`,`.`,`?.`];function gk(e){let t=Qv(e.state).resolveInner(e.pos,-1);if(hk.indexOf(t.name)>-1)return null;let n=t.name==`VariableName`||t.to-t.from<20&&mk.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let n=t;n;n=n.parent)lk.has(n.name)&&(r=r.concat(pk(e.state.doc,n)));return{options:r,from:n?t.from:e.pos,validFor:mk}}var _k=Zv.define({name:`javascript`,parser:ak.configure({props:[_y.add({IfStatement:ky({except:/^\s*({|else\b)/}),TryStatement:ky({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Oy,SwitchBody:e=>{let t=e.textAfter,n=/^\s*\}/.test(t),r=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:r?1:2)*e.unit},Block:Ey({closing:`}`}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":ky({except:/^\s*{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),jy.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":My,BlockComment(e){return{from:e.from+2,to:e.to-2}},JSXElement(e){let t=e.firstChild;if(!t||t.name==`JSXSelfClosingTag`)return null;let n=e.lastChild;return{from:t.to,to:n.type.isError?e.to:n.from}},"JSXSelfClosingTag JSXOpenTag"(e){let t=e.firstChild?.nextSibling,n=e.lastChild;return!t||t.type.isError?null:{from:t.to,to:n.type.isError?e.to:n.from}}})]}),languageData:{closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,"`"]},commentTokens:{line:`//`,block:{open:`/*`,close:`*/`}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:`$`}}),vk={test:e=>/^JSX/.test(e.name),facet:qv({commentTokens:{block:{open:`{/*`,close:`*/}`}}})},yk=_k.configure({dialect:`ts`},`typescript`),bk=_k.configure({dialect:`jsx`,props:[Jv.add(e=>e.isTop?[vk]:void 0)]}),xk=_k.configure({dialect:`jsx ts`,props:[Jv.add(e=>e.isTop?[vk]:void 0)]},`typescript`),Sk=e=>({label:e,type:`keyword`}),Ck=`break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield`.split(` `).map(Sk),wk=Ck.concat([`declare`,`implements`,`private`,`protected`,`public`].map(Sk));function Tk(e={}){let t=e.jsx?e.typescript?xk:bk:e.typescript?yk:_k,n=e.typescript?sk.concat(wk):ok.concat(Ck);return new ly(t,[_k.data.of({autocomplete:rC(hk,nC(n))}),_k.data.of({autocomplete:gk}),e.jsx?kk:[]])}function Ek(e){for(;;){if(e.name==`JSXOpenTag`||e.name==`JSXSelfClosingTag`||e.name==`JSXFragmentTag`)return e;if(e.name==`JSXEscape`||!e.parent)return null;e=e.parent}}function Dk(e,t,n=e.length){for(let r=t?.firstChild;r;r=r.nextSibling)if(r.name==`JSXIdentifier`||r.name==`JSXBuiltin`||r.name==`JSXNamespacedName`||r.name==`JSXMemberExpression`)return e.sliceString(r.from,Math.min(r.to,n));return``}var Ok=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),kk=J.inputHandler.of((e,t,n,r,i)=>{if((Ok?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||r!=`>`&&r!=`/`||!_k.isActiveAt(e.state,t,-1))return!1;let a=i(),{state:o}=a,s=o.changeByRange(e=>{let{head:t}=e,n=Qv(o).resolveInner(t-1,-1),i;if(n.name==`JSXStartTag`&&(n=n.parent),!(o.doc.sliceString(t-1,t)!=r||n.name==`JSXAttributeValue`&&n.to>t)){if(r==`>`&&n.name==`JSXFragmentTag`)return{range:e,changes:{from:t,insert:`</>`}};if(r==`/`&&n.name==`JSXStartCloseTag`){let e=n.parent,r=e.parent;if(r&&e.from==t-2&&((i=Dk(o.doc,r.firstChild,t))||r.firstChild?.name==`JSXFragmentTag`)){let e=`${i}>`;return{range:G.cursor(t+e.length,-1),changes:{from:t,insert:e}}}}else if(r==`>`){let r=Ek(n);if(r&&r.name==`JSXOpenTag`&&!/^\/?>|^<\//.test(o.doc.sliceString(t,t+2))&&(i=Dk(o.doc,r,t)))return{range:e,changes:{from:t,insert:`</${i}>`}}}}return{range:e}});return!s.changes.empty&&(e.dispatch([a,o.update(s,{userEvent:`input.complete`,scrollIntoView:!0})]),!0)}),Ak=[`_blank`,`_self`,`_top`,`_parent`],jk=[`ascii`,`utf-8`,`utf-16`,`latin1`,`latin1`],Mk=[`get`,`post`,`put`,`delete`],Nk=[`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`],Pk=[`true`,`false`],$={},Fk={a:{attrs:{href:null,ping:null,type:null,media:null,target:Ak,hreflang:null}},abbr:$,address:$,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:[`default`,`rect`,`circle`,`poly`]}},article:$,aside:$,audio:{attrs:{src:null,mediagroup:null,crossorigin:[`anonymous`,`use-credentials`],preload:[`none`,`metadata`,`auto`],autoplay:[`autoplay`],loop:[`loop`],controls:[`controls`]}},b:$,base:{attrs:{href:null,target:Ak}},bdi:$,bdo:$,blockquote:{attrs:{cite:null}},body:$,br:$,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:[`autofocus`],disabled:[`autofocus`],formenctype:Nk,formmethod:Mk,formnovalidate:[`novalidate`],formtarget:Ak,type:[`submit`,`reset`,`button`]}},canvas:{attrs:{width:null,height:null}},caption:$,center:$,cite:$,code:$,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:[`command`,`checkbox`,`radio`],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:[`disabled`],checked:[`checked`]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:[`disabled`],multiple:[`multiple`]}},datalist:{attrs:{data:null}},dd:$,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:[`open`]}},dfn:$,div:$,dl:$,dt:$,em:$,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:[`disabled`],form:null,name:null}},figcaption:$,figure:$,footer:$,form:{attrs:{action:null,name:null,"accept-charset":jk,autocomplete:[`on`,`off`],enctype:Nk,method:Mk,novalidate:[`novalidate`],target:Ak}},h1:$,h2:$,h3:$,h4:$,h5:$,h6:$,head:{children:[`title`,`base`,`link`,`style`,`meta`,`script`,`noscript`,`command`]},header:$,hgroup:$,hr:$,html:{attrs:{manifest:null}},i:$,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:[`allow-top-navigation`,`allow-same-origin`,`allow-forms`,`allow-scripts`],seamless:[`seamless`]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:[`anonymous`,`use-credentials`]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:[`audio/*`,`video/*`,`image/*`],autocomplete:[`on`,`off`],autofocus:[`autofocus`],checked:[`checked`],disabled:[`disabled`],formenctype:Nk,formmethod:Mk,formnovalidate:[`novalidate`],formtarget:Ak,multiple:[`multiple`],readonly:[`readonly`],required:[`required`],type:[`hidden`,`text`,`search`,`tel`,`url`,`email`,`password`,`datetime`,`date`,`month`,`week`,`time`,`datetime-local`,`number`,`range`,`color`,`checkbox`,`radio`,`file`,`submit`,`image`,`reset`,`button`]}},ins:{attrs:{cite:null,datetime:null}},kbd:$,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:[`autofocus`],disabled:[`disabled`],keytype:[`RSA`]}},label:{attrs:{for:null,form:null}},legend:$,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:[`all`,`16x16`,`16x16 32x32`,`16x16 32x32 64x64`]}},map:{attrs:{name:null}},mark:$,menu:{attrs:{label:null,type:[`list`,`context`,`toolbar`]}},meta:{attrs:{content:null,charset:jk,name:[`viewport`,`application-name`,`author`,`description`,`generator`,`keywords`],"http-equiv":[`content-language`,`content-type`,`default-style`,`refresh`]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:$,noscript:$,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:[`typemustmatch`]}},ol:{attrs:{reversed:[`reversed`],start:null,type:[`1`,`a`,`A`,`i`,`I`]},children:[`li`,`script`,`template`,`ul`,`ol`]},optgroup:{attrs:{disabled:[`disabled`],label:null}},option:{attrs:{disabled:[`disabled`],label:null,selected:[`selected`],value:null}},output:{attrs:{for:null,form:null,name:null}},p:$,param:{attrs:{name:null,value:null}},pre:$,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:$,rt:$,ruby:$,samp:$,script:{attrs:{type:[`text/javascript`],src:null,async:[`async`],defer:[`defer`],charset:jk}},section:$,select:{attrs:{form:null,name:null,size:null,autofocus:[`autofocus`],disabled:[`disabled`],multiple:[`multiple`]}},slot:{attrs:{name:null}},small:$,source:{attrs:{src:null,type:null,media:null}},span:$,strong:$,style:{attrs:{type:[`text/css`],media:null,scoped:null}},sub:$,summary:$,sup:$,table:$,tbody:$,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:$,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:[`autofocus`],disabled:[`disabled`],readonly:[`readonly`],required:[`required`],wrap:[`soft`,`hard`]}},tfoot:$,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:[`row`,`col`,`rowgroup`,`colgroup`]}},thead:$,time:{attrs:{datetime:null}},title:$,tr:$,track:{attrs:{src:null,label:null,default:null,kind:[`subtitles`,`captions`,`descriptions`,`chapters`,`metadata`],srclang:null}},ul:{children:[`li`,`script`,`template`,`ul`,`ol`]},var:$,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:[`anonymous`,`use-credentials`],preload:[`auto`,`metadata`,`none`],autoplay:[`autoplay`],mediagroup:[`movie`],muted:[`muted`],controls:[`controls`]}},wbr:$},Ik={accesskey:null,class:null,contenteditable:Pk,contextmenu:null,dir:[`ltr`,`rtl`,`auto`],draggable:[`true`,`false`,`auto`],dropzone:[`copy`,`move`,`link`,`string:`,`file:`],hidden:[`hidden`],id:null,inert:[`inert`],itemid:null,itemprop:null,itemref:null,itemscope:[`itemscope`],itemtype:null,lang:[`ar`,`bn`,`de`,`en-GB`,`en-US`,`es`,`fr`,`hi`,`id`,`ja`,`pa`,`pt`,`ru`,`tr`,`zh`],spellcheck:Pk,autocorrect:Pk,autocapitalize:Pk,style:null,tabindex:null,title:null,translate:[`yes`,`no`],rel:[`stylesheet`,`alternate`,`author`,`bookmark`,`help`,`license`,`next`,`nofollow`,`noreferrer`,`prefetch`,`prev`,`search`,`tag`],role:`alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer`.split(` `),"aria-activedescendant":null,"aria-atomic":Pk,"aria-autocomplete":[`inline`,`list`,`both`,`none`],"aria-busy":Pk,"aria-checked":[`true`,`false`,`mixed`,`undefined`],"aria-controls":null,"aria-describedby":null,"aria-disabled":Pk,"aria-dropeffect":null,"aria-expanded":[`true`,`false`,`undefined`],"aria-flowto":null,"aria-grabbed":[`true`,`false`,`undefined`],"aria-haspopup":Pk,"aria-hidden":Pk,"aria-invalid":[`true`,`false`,`grammar`,`spelling`],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":[`off`,`polite`,`assertive`],"aria-multiline":Pk,"aria-multiselectable":Pk,"aria-owns":null,"aria-posinset":null,"aria-pressed":[`true`,`false`,`mixed`,`undefined`],"aria-readonly":Pk,"aria-relevant":null,"aria-required":Pk,"aria-selected":[`true`,`false`,`undefined`],"aria-setsize":null,"aria-sort":[`ascending`,`descending`,`none`,`other`],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},Lk=`beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload`.split(` `).map(e=>`on`+e);for(let e of Lk)Ik[e]=null;var Rk=class{constructor(e,t){this.tags={...Fk,...e},this.globalAttrs={...Ik,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};Rk.default=new Rk;function zk(e,t,n=e.length){if(!t)return``;let r=t.firstChild,i=r&&r.getChild(`TagName`);return i?e.sliceString(i.from,Math.min(i.to,n)):``}function Bk(e,t=!1){for(;e;e=e.parent)if(e.name==`Element`){if(t)t=!1;else return e}return null}function Vk(e,t,n){return n.tags[zk(e,Bk(t))]?.children||n.allTags}function Hk(e,t){let n=[];for(let r=Bk(t);r&&!r.type.isTop;r=Bk(r.parent)){let i=zk(e,r);if(i&&r.lastChild.name==`CloseTag`)break;i&&n.indexOf(i)<0&&(t.name==`EndTag`||t.from>=r.firstChild.to)&&n.push(i)}return n}var Uk=/^[:\-\.\w\u00b7-\uffff]*$/;function Wk(e,t,n,r,i){let a=/\s*>/.test(e.sliceDoc(i,i+5))?``:`>`,o=Bk(n,n.name==`StartTag`||n.name==`TagName`);return{from:r,to:i,options:Vk(e.doc,o,t).map(e=>({label:e,type:`type`})).concat(Hk(e.doc,n).map((e,t)=>({label:`/`+e,apply:`/`+e+a,type:`type`,boost:99-t}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function Gk(e,t,n,r){let i=/\s*>/.test(e.sliceDoc(r,r+5))?``:`>`;return{from:n,to:r,options:Hk(e.doc,t).map((e,t)=>({label:e,apply:e+i,type:`type`,boost:99-t})),validFor:Uk}}function Kk(e,t,n,r){let i=[],a=0;for(let r of Vk(e.doc,n,t))i.push({label:`<`+r,type:`type`});for(let t of Hk(e.doc,n))i.push({label:`</`+t+`>`,type:`type`,boost:99-a++});return{from:r,to:r,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function qk(e,t,n,r,i){let a=Bk(n),o=a?t.tags[zk(e.doc,a)]:null,s=o&&o.attrs?Object.keys(o.attrs):[];return{from:r,to:i,options:(o&&o.globalAttrs===!1?s:s.length?s.concat(t.globalAttrNames):t.globalAttrNames).map(e=>({label:e,type:`property`})),validFor:Uk}}function Jk(e,t,n,r,i){let a=n.parent?.getChild(`AttributeName`),o=[],s;if(a){let c=e.sliceDoc(a.from,a.to),l=t.globalAttrs[c];if(!l){let r=Bk(n),i=r?t.tags[zk(e.doc,r)]:null;l=i?.attrs&&i.attrs[c]}if(l){let t=e.sliceDoc(r,i).toLowerCase(),n=`"`,a=`"`;/^['"]/.test(t)?(s=t[0]==`"`?/^[^"]*$/:/^[^']*$/,n=``,a=e.sliceDoc(i,i+1)==t[0]?``:t[0],t=t.slice(1),r++):s=/^[^\s<>='"]*$/;for(let e of l)o.push({label:e,apply:n+e+a,type:`constant`})}}return{from:r,to:i,options:o,validFor:s}}function Yk(e,t){let{state:n,pos:r}=t,i=Qv(n).resolveInner(r,-1),a=i.resolve(r);for(let e=r,t;a==i&&(t=i.childBefore(e));){let n=t.lastChild;if(!n||!n.type.isError||n.from<n.to)break;a=i=t,e=n.from}return i.name==`TagName`?i.parent&&/CloseTag$/.test(i.parent.name)?Gk(n,i,i.from,r):Wk(n,e,i,i.from,r):i.name==`StartTag`||i.name==`IncompleteTag`?Wk(n,e,i,r,r):i.name==`StartCloseTag`||i.name==`IncompleteCloseTag`?Gk(n,i,r,r):i.name==`OpenTag`||i.name==`SelfClosingTag`||i.name==`AttributeName`?qk(n,e,i,i.name==`AttributeName`?i.from:r,r):i.name==`Is`||i.name==`AttributeValue`||i.name==`UnquotedAttributeValue`?Jk(n,e,i,i.name==`Is`?r:i.from,r):t.explicit&&(a.name==`Element`||a.name==`Text`||a.name==`Document`)?Kk(n,e,i,r):null}function Xk(e){return Yk(Rk.default,e)}function Zk(e){let{extraTags:t,extraGlobalAttributes:n}=e,r=n||t?new Rk(t,n):Rk.default;return e=>Yk(r,e)}var Qk=_k.parser.configure({top:`SingleExpression`}),$k=[{tag:`script`,attrs:e=>e.type==`text/typescript`||e.lang==`ts`,parser:yk.parser},{tag:`script`,attrs:e=>e.type==`text/babel`||e.type==`text/jsx`,parser:bk.parser},{tag:`script`,attrs:e=>e.type==`text/typescript-jsx`,parser:xk.parser},{tag:`script`,attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:Qk},{tag:`script`,attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:_k.parser},{tag:`style`,attrs(e){return(!e.lang||e.lang==`css`)&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:SO.parser}],eA=[{name:`style`,parser:SO.parser.configure({top:`Styles`})}].concat(Lk.map(e=>({name:e,parser:_k.parser}))),tA=Zv.define({name:`html`,parser:yD.configure({props:[_y.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let t=null,n;for(let n=e.node;;){let e=n.lastChild;if(!e||e.name!=`Element`||e.to!=n.to)break;t=n=e}return t&&!((n=t.lastChild)&&(n.name==`CloseTag`||n.name==`SelfClosingTag`))?e.lineIndent(t.from)+e.unit:null}}),jy.add({Element(e){let t=e.firstChild,n=e.lastChild;return!t||t.name!=`OpenTag`?null:{from:t.to,to:n.name==`CloseTag`?n.from:e.to}}}),lb.add({"OpenTag CloseTag":e=>e.getChild(`TagName`)})]}),languageData:{commentTokens:{block:{open:`<!--`,close:`-->`}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:`-_`}}),nA=tA.configure({wrap:CD($k,eA)});function rA(e={}){let t=``,n;return e.matchClosingTags===!1&&(t=`noMatch`),e.selfClosingTags===!0&&(t=(t?t+` `:``)+`selfClosing`),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(n=CD((e.nestedLanguages||[]).concat($k),(e.nestedAttributes||[]).concat(eA))),new ly(n?tA.configure({wrap:n,dialect:t}):t?nA.configure({dialect:t}):nA,[nA.data.of({autocomplete:Zk(e)}),e.autoCloseTags===!1?[]:oA,Tk().support,CO().support])}var iA=new Set(`area base br col command embed frame hr img input keygen link meta param source track wbr menuitem`.split(` `));function aA(e,t,n){for(;;){if(t.lastChild?.name!=`CloseTag`)return!1;let r=t.parent;if(!r||zk(e,r)!=n)return!0;t=r}}var oA=J.inputHandler.of((e,t,n,r,i)=>{if(e.composing||e.state.readOnly||t!=n||r!=`>`&&r!=`/`||!nA.isActiveAt(e.state,t,-1))return!1;let a=i(),{state:o}=a,s=o.changeByRange(e=>{let t=o.doc.sliceString(e.from-1,e.to)==r,{head:n}=e,i=Qv(o).resolveInner(n,-1),a;if(t&&r==`>`&&i.name==`EndTag`){let t=i.parent;if((a=zk(o.doc,t.parent,n))&&!iA.has(a)&&!aA(o.doc,t.parent,a))return{range:e,changes:{from:n,to:n+ +(o.doc.sliceString(n,n+1)===`>`),insert:`</${a}>`}}}else if(t&&r==`/`&&i.name==`IncompleteCloseTag`){let e=i.parent;if(i.from==n-2&&e.lastChild?.name!=`CloseTag`&&(a=zk(o.doc,e,n))&&!iA.has(a)){let e=n+ +(o.doc.sliceString(n,n+1)===`>`),t=`${a}>`;return{range:G.cursor(n+t.length,-1),changes:{from:n,to:e,insert:t}}}}return{range:e}});return!s.changes.empty&&(e.dispatch([a,o.update(s,{userEvent:`input.complete`,scrollIntoView:!0})]),!0)}),sA=qv({commentTokens:{block:{open:`<!--`,close:`-->`}}}),cA=new Y,lA=hT.configure({props:[jy.add(e=>!e.is(`Block`)||e.is(`Document`)||uA(e)!=null||dA(e)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),cA.add(uA),_y.add({Document:()=>null}),Kv.add({Document:sA})]});function uA(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function dA(e){return e.name==`OrderedList`||e.name==`BulletList`}function fA(e,t){let n=e;for(;;){let e=n.nextSibling,r;if(!e||(r=uA(e.type))!=null&&r<=t)break;n=e}return n.to}var pA=Ay.of((e,t,n)=>{for(let r=Qv(e).resolveInner(n,-1);r&&!(r.from<t);r=r.parent){let e=r.type.prop(cA);if(e==null)continue;let t=fA(r,e);if(t>n)return{from:n,to:t}}return null});function mA(e){return new Yv(sA,e,[],`markdown`)}var hA=mA(lA),gA=mA(lA.configure([FT,RT,LT,zT,{props:[jy.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]));function _A(e,t){return n=>{if(n&&e){let t=null;if(n=/\S*/.exec(n)[0],t=typeof e==`function`?e(n):uy.matchLanguageName(e,n,!0),t instanceof uy)return t.support?t.support.language.parser:ny.getSkippingParser(t.load());if(t)return t.parser}return t?t.parser:null}}var vA=class{constructor(e,t,n,r,i,a,o){this.node=e,this.from=t,this.to=n,this.spaceBefore=r,this.spaceAfter=i,this.type=a,this.item=o}blank(e,t=!0){let n=this.spaceBefore+(this.node.name==`Blockquote`?`>`:``);if(e!=null){for(;n.length<e;)n+=` `;return n}for(let e=this.to-this.from-n.length-this.spaceAfter.length;e>0;e--)n+=` `;return n+(t?this.spaceAfter:``)}marker(e,t){let n=this.node.name==`OrderedList`?String(+bA(this.item,e)[2]+t):``;return this.spaceBefore+n+this.type+this.spaceAfter}};function yA(e,t){let n=[],r=[];for(let t=e;t;t=t.parent){if(t.name==`FencedCode`)return r;(t.name==`ListItem`||t.name==`Blockquote`)&&n.push(t)}for(let e=n.length-1;e>=0;e--){let i=n[e],a,o=t.lineAt(i.from),s=i.from-o.from;if(i.name==`Blockquote`&&(a=/^ *>( ?)/.exec(o.text.slice(s))))r.push(new vA(i,s,s+a[0].length,``,a[1],`>`,null));else if(i.name==`ListItem`&&i.parent.name==`OrderedList`&&(a=/^( *)\d+([.)])( *)/.exec(o.text.slice(s)))){let e=a[3],t=a[0].length;e.length>=4&&(e=e.slice(0,e.length-4),t-=4),r.push(new vA(i.parent,s,s+t,a[1],e,a[2],i))}else if(i.name==`ListItem`&&i.parent.name==`BulletList`&&(a=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(o.text.slice(s)))){let e=a[4],t=a[0].length;e.length>4&&(e=e.slice(0,e.length-4),t-=4);let n=a[2];a[3]&&(n+=a[3].replace(/[xX]/,` `)),r.push(new vA(i.parent,s,s+t,a[1],e,n,i))}}return r}function bA(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function xA(e,t,n,r=0){for(let i=-1,a=e;;){if(a.name==`ListItem`){let e=bA(a,t),o=+e[2];if(i>=0){if(o!=i+1)return;n.push({from:a.from+e[1].length,to:a.from+e[0].length,insert:String(i+2+r)})}i=o}let e=a.nextSibling;if(!e)break;a=e}}function SA(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(fy)!=` `)return e;let r=rd(e,4,n),i=``;for(let e=r;e>0;)e>=4?(i+=` `,e-=4):(i+=` `,e--);return i+e.slice(n)}var CA=((e={})=>({state:t,dispatch:n})=>{let r=Qv(t),{doc:i}=t,a=null,o=t.changeByRange(n=>{if(!n.empty||!gA.isActiveAt(t,n.from,-1)&&!gA.isActiveAt(t,n.from,1))return a={range:n};let o=n.from,s=i.lineAt(o),c=yA(r.resolveInner(o,-1),i);for(;c.length&&c[c.length-1].from>o-s.from;)c.pop();if(!c.length)return a={range:n};let l=c[c.length-1];if(l.to-l.spaceAfter.length>o-s.from)return a={range:n};let u=o>=l.to-l.spaceAfter.length&&!/\S/.test(s.text.slice(l.to));if(l.item&&u){if(l.item.from<s.from&&!/^[\s>]*$/.test(s.text.slice(0,l.to)))return a={range:n};let r=l.node.firstChild,u=l.node.getChild(`ListItem`,`ListItem`);if(r.to>=o||u&&u.to<o||s.from>0&&!/[^\s>]/.test(i.lineAt(s.from-1).text)||e.nonTightLists===!1){let e=c.length>1?c[c.length-2]:null,t,n=``;e&&e.item?(t=s.from+e.from,n=e.marker(i,1)):t=s.from+(e?e.to:0);let r=[{from:t,to:o,insert:n}];return l.node.name==`OrderedList`&&xA(l.item,i,r,-2),e&&e.node.name==`OrderedList`&&xA(e.item,i,r),{range:G.cursor(t+n.length),changes:r}}{let e=EA(c,t,s);return{range:G.cursor(o+e.length+1),changes:{from:s.from,insert:e+t.lineBreak}}}}if(l.node.name==`Blockquote`&&u&&s.from){let e=i.lineAt(s.from-1),r=/>\s*$/.exec(e.text);if(r&&r.index==l.from){let i=t.changes([{from:e.from+r.index,to:e.to},{from:s.from+l.from,to:s.to}]);return{range:n.map(i),changes:i}}}let d=[];l.node.name==`OrderedList`&&xA(l.item,i,d);let f=l.item&&l.item.from<s.from,p=``;if(!f||/^[\s\d.)\-+*>]*/.exec(s.text)[0].length>=l.to)for(let e=0,t=c.length-1;e<=t;e++)p+=e==t&&!f?c[e].marker(i,1):c[e].blank(e<t?rd(s.text,4,c[e+1].from)-p.length:null);let m=o;for(;m>s.from&&/\s/.test(s.text.charAt(m-s.from-1));)m--;return p=SA(p,t),TA(l.node,t.doc)&&(p=EA(c,t,s)+t.lineBreak+p),d.push({from:m,to:o,insert:t.lineBreak+p}),{range:G.cursor(m+p.length+1),changes:d}});return!a&&(n(t.update(o,{scrollIntoView:!0,userEvent:`input`})),!0)})();function wA(e){return e.name==`QuoteMark`||e.name==`ListMark`}function TA(e,t){if(e.name!=`OrderedList`&&e.name!=`BulletList`)return!1;let n=e.firstChild,r=e.getChild(`ListItem`,`ListItem`);if(!r)return!1;let i=t.lineAt(n.to),a=t.lineAt(r.from),o=/^[\s>]*$/.test(i.text);return i.number+ +!o<a.number}function EA(e,t,n){let r=``;for(let t=0,i=e.length-2;t<=i;t++)r+=e[t].blank(t<i?rd(n.text,4,e[t+1].from)-r.length:null,t<i);return SA(r,t)}function DA(e,t){let n=e.resolveInner(t,-1),r=t;wA(n)&&(r=n.from,n=n.parent);for(let e;e=n.childBefore(r);)if(wA(e))r=e.from;else if(e.name==`OrderedList`||e.name==`BulletList`)n=e.lastChild,r=n.to;else break;return n}var OA=[{key:`Enter`,run:CA},{key:`Backspace`,run:({state:e,dispatch:t})=>{let n=Qv(e),r=null,i=e.changeByRange(t=>{let i=t.from,{doc:a}=e;if(t.empty&&gA.isActiveAt(e,t.from)){let t=a.lineAt(i),r=yA(DA(n,i),a);if(r.length){let n=r[r.length-1],a=n.to-n.spaceAfter.length+ +!!n.spaceAfter;if(i-t.from>a&&!/\S/.test(t.text.slice(a,i-t.from)))return{range:G.cursor(t.from+a),changes:{from:t.from+a,to:i}};if(i-t.from==a&&(n.item&&t.from<=n.item.from||/^[\s>]*$/.test(t.text.slice(0,n.to)))){let r=t.from+n.from;if(n.item&&n.node.from<n.item.from&&/\S/.test(t.text.slice(n.from,n.to))){let i=n.blank(rd(t.text,4,n.to)-rd(t.text,4,n.from));return r==t.from&&(i=SA(i,e)),{range:G.cursor(r+i.length),changes:{from:r,to:t.from+n.to,insert:i}}}if(r<i)return{range:G.cursor(r),changes:{from:r,to:i}}}}}return r={range:t}});return!r&&(t(e.update(i,{scrollIntoView:!0,userEvent:`delete`})),!0)}}],kA=rA({matchClosingTags:!1});function AA(e={}){let{codeLanguages:t,defaultCodeLanguage:n,addKeymap:r=!0,base:{parser:i}=hA,completeHTMLTags:a=!0,pasteURLAsLink:o=!0,htmlTagLanguage:s=kA}=e;if(!(i instanceof Bw))throw RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=e.extensions?[e.extensions]:[],l=[s.support,pA],u;o&&l.push(FA),n instanceof ly?(l.push(n.support),u=n.language):n&&(u=n);let d=t||u?_A(t,u):void 0;c.push(_T({codeParser:d,htmlParser:s.language.parser})),r&&l.push(ru.high(jg.of(OA)));let f=mA(i.configure(c));return a&&l.push(f.data.of({autocomplete:jA})),new ly(f,l)}function jA(e){let{state:t,pos:n}=e,r=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(n-25,n));if(!r)return null;let i=Qv(t).resolveInner(n,-1);for(;i&&!i.type.isTop;){if(i.name==`CodeBlock`||i.name==`FencedCode`||i.name==`ProcessingInstructionBlock`||i.name==`CommentBlock`||i.name==`Link`||i.name==`Image`)return null;i=i.parent}return{from:n-r[0].length,to:n,options:NA(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}var MA=null;function NA(){if(MA)return MA;let e=Xk(new $S(Iu.create({extensions:kA}),0,!0));return MA=e?e.options:[]}var PA=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,FA=J.domEventHandlers({paste:(e,t)=>{let{main:n}=t.state.selection;if(n.empty)return!1;let r=e.clipboardData?.getData(`text/plain`);if(!r||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(r)||(/^www\./.test(r)&&(r=`https://`+r),!gA.isActiveAt(t.state,n.from,1)))return!1;let i=Qv(t.state),a=!1;return i.iterate({from:n.from,to:n.to,enter:e=>{(e.from>n.from||PA.test(e.name))&&(a=!0)},leave:e=>{e.to<n.to&&(a=!0)}}),!a&&(t.dispatch({changes:[{from:n.from,insert:`[`},{from:n.to,insert:`](${r})`}],userEvent:`input.paste`,scrollIntoView:!0}),!0)}});function IA(e){var t=e.Pos;function n(e,t,n){if(t.line===n.line&&t.ch>=n.ch-1){var r=e.getLine(t.line).charCodeAt(t.ch);55296<=r&&r<=55551&&(n.ch+=1)}return{start:t,end:n}}var r=[{keys:`<Left>`,type:`keyToKey`,toKeys:`h`},{keys:`<Right>`,type:`keyToKey`,toKeys:`l`},{keys:`<Up>`,type:`keyToKey`,toKeys:`k`},{keys:`<Down>`,type:`keyToKey`,toKeys:`j`},{keys:`g<Up>`,type:`keyToKey`,toKeys:`gk`},{keys:`g<Down>`,type:`keyToKey`,toKeys:`gj`},{keys:`<Space>`,type:`keyToKey`,toKeys:`l`},{keys:`<BS>`,type:`keyToKey`,toKeys:`h`},{keys:`<Del>`,type:`keyToKey`,toKeys:`x`},{keys:`<C-Space>`,type:`keyToKey`,toKeys:`W`},{keys:`<C-BS>`,type:`keyToKey`,toKeys:`B`},{keys:`<S-Space>`,type:`keyToKey`,toKeys:`w`},{keys:`<S-BS>`,type:`keyToKey`,toKeys:`b`},{keys:`<C-n>`,type:`keyToKey`,toKeys:`j`},{keys:`<C-p>`,type:`keyToKey`,toKeys:`k`},{keys:`<C-[>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-c>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-[>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`<C-c>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`<C-Esc>`,type:`keyToKey`,toKeys:`<Esc>`},{keys:`<C-Esc>`,type:`keyToKey`,toKeys:`<Esc>`,context:`insert`},{keys:`s`,type:`keyToKey`,toKeys:`cl`,context:`normal`},{keys:`s`,type:`keyToKey`,toKeys:`c`,context:`visual`},{keys:`S`,type:`keyToKey`,toKeys:`cc`,context:`normal`},{keys:`S`,type:`keyToKey`,toKeys:`VdO`,context:`visual`},{keys:`<Home>`,type:`keyToKey`,toKeys:`0`},{keys:`<End>`,type:`keyToKey`,toKeys:`$`},{keys:`<PageUp>`,type:`keyToKey`,toKeys:`<C-b>`},{keys:`<PageDown>`,type:`keyToKey`,toKeys:`<C-f>`},{keys:`<CR>`,type:`keyToKey`,toKeys:`j^`,context:`normal`},{keys:`<Ins>`,type:`keyToKey`,toKeys:`i`,context:`normal`},{keys:`<Ins>`,type:`action`,action:`toggleOverwrite`,context:`insert`},{keys:`H`,type:`motion`,motion:`moveToTopLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`M`,type:`motion`,motion:`moveToMiddleLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`L`,type:`motion`,motion:`moveToBottomLine`,motionArgs:{linewise:!0,toJumplist:!0}},{keys:`h`,type:`motion`,motion:`moveByCharacters`,motionArgs:{forward:!1}},{keys:`l`,type:`motion`,motion:`moveByCharacters`,motionArgs:{forward:!0}},{keys:`j`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,linewise:!0}},{keys:`k`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!1,linewise:!0}},{keys:`gj`,type:`motion`,motion:`moveByDisplayLines`,motionArgs:{forward:!0}},{keys:`gk`,type:`motion`,motion:`moveByDisplayLines`,motionArgs:{forward:!1}},{keys:`w`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!1}},{keys:`W`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!1,bigWord:!0}},{keys:`e`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!0,inclusive:!0}},{keys:`E`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!0,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:`b`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1}},{keys:`B`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1,bigWord:!0}},{keys:`ge`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!0,inclusive:!0}},{keys:`gE`,type:`motion`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!0,bigWord:!0,inclusive:!0}},{keys:`{`,type:`motion`,motion:`moveByParagraph`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`}`,type:`motion`,motion:`moveByParagraph`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`(`,type:`motion`,motion:`moveBySentence`,motionArgs:{forward:!1}},{keys:`)`,type:`motion`,motion:`moveBySentence`,motionArgs:{forward:!0}},{keys:`<C-f>`,type:`motion`,motion:`moveByPage`,motionArgs:{forward:!0}},{keys:`<C-b>`,type:`motion`,motion:`moveByPage`,motionArgs:{forward:!1}},{keys:`<C-d>`,type:`motion`,motion:`moveByScroll`,motionArgs:{forward:!0,explicitRepeat:!0}},{keys:`<C-u>`,type:`motion`,motion:`moveByScroll`,motionArgs:{forward:!1,explicitRepeat:!0}},{keys:`gg`,type:`motion`,motion:`moveToLineOrEdgeOfDocument`,motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:`G`,type:`motion`,motion:`moveToLineOrEdgeOfDocument`,motionArgs:{forward:!0,explicitRepeat:!0,linewise:!0,toJumplist:!0}},{keys:`g$`,type:`motion`,motion:`moveToEndOfDisplayLine`},{keys:`g^`,type:`motion`,motion:`moveToStartOfDisplayLine`},{keys:`g0`,type:`motion`,motion:`moveToStartOfDisplayLine`},{keys:`0`,type:`motion`,motion:`moveToStartOfLine`},{keys:`^`,type:`motion`,motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`+`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,toFirstChar:!0}},{keys:`-`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!1,toFirstChar:!0}},{keys:`_`,type:`motion`,motion:`moveByLines`,motionArgs:{forward:!0,toFirstChar:!0,repeatOffset:-1}},{keys:`$`,type:`motion`,motion:`moveToEol`,motionArgs:{inclusive:!0}},{keys:`%`,type:`motion`,motion:`moveToMatchedSymbol`,motionArgs:{inclusive:!0,toJumplist:!0}},{keys:`f<character>`,type:`motion`,motion:`moveToCharacter`,motionArgs:{forward:!0,inclusive:!0}},{keys:`F<character>`,type:`motion`,motion:`moveToCharacter`,motionArgs:{forward:!1}},{keys:`t<character>`,type:`motion`,motion:`moveTillCharacter`,motionArgs:{forward:!0,inclusive:!0}},{keys:`T<character>`,type:`motion`,motion:`moveTillCharacter`,motionArgs:{forward:!1}},{keys:`;`,type:`motion`,motion:`repeatLastCharacterSearch`,motionArgs:{forward:!0}},{keys:`,`,type:`motion`,motion:`repeatLastCharacterSearch`,motionArgs:{forward:!1}},{keys:`'<register>`,type:`motion`,motion:`goToMark`,motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`<register>",type:`motion`,motion:`goToMark`,motionArgs:{toJumplist:!0}},{keys:"]`",type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!0}},{keys:"[`",type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!1}},{keys:`]'`,type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!0,linewise:!0}},{keys:`['`,type:`motion`,motion:`jumpToMark`,motionArgs:{forward:!1,linewise:!0}},{keys:`]p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!0,isEdit:!0,matchIndent:!0}},{keys:`[p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!1,isEdit:!0,matchIndent:!0}},{keys:`]<character>`,type:`motion`,motion:`moveToSymbol`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`[<character>`,type:`motion`,motion:`moveToSymbol`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`|`,type:`motion`,motion:`moveToColumn`},{keys:`o`,type:`motion`,motion:`moveToOtherHighlightedEnd`,context:`visual`},{keys:`O`,type:`motion`,motion:`moveToOtherHighlightedEnd`,motionArgs:{sameLine:!0},context:`visual`},{keys:`d`,type:`operator`,operator:`delete`},{keys:`y`,type:`operator`,operator:`yank`},{keys:`c`,type:`operator`,operator:`change`},{keys:`=`,type:`operator`,operator:`indentAuto`},{keys:`>`,type:`operator`,operator:`indent`,operatorArgs:{indentRight:!0}},{keys:`<`,type:`operator`,operator:`indent`,operatorArgs:{indentRight:!1}},{keys:`g~`,type:`operator`,operator:`changeCase`},{keys:`gu`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!0},isEdit:!0},{keys:`gU`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!1},isEdit:!0},{keys:`gc`,type:`operator`,operator:`toggleComment`,isEdit:!0},{keys:`n`,type:`motion`,motion:`findNext`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`N`,type:`motion`,motion:`findNext`,motionArgs:{forward:!1,toJumplist:!0}},{keys:`gn`,type:`motion`,motion:`findAndSelectNextInclusive`,motionArgs:{forward:!0}},{keys:`gN`,type:`motion`,motion:`findAndSelectNextInclusive`,motionArgs:{forward:!1}},{keys:`gq`,type:`operator`,operator:`hardWrap`},{keys:`gw`,type:`operator`,operator:`hardWrap`,operatorArgs:{keepCursor:!0}},{keys:`g?`,type:`operator`,operator:`rot13`},{keys:`x`,type:`operatorMotion`,operator:`delete`,motion:`moveByCharacters`,motionArgs:{forward:!0},operatorMotionArgs:{visualLine:!1}},{keys:`X`,type:`operatorMotion`,operator:`delete`,motion:`moveByCharacters`,motionArgs:{forward:!1},operatorMotionArgs:{visualLine:!0}},{keys:`D`,type:`operatorMotion`,operator:`delete`,motion:`moveToEol`,motionArgs:{inclusive:!0},context:`normal`},{keys:`D`,type:`operator`,operator:`delete`,operatorArgs:{linewise:!0},context:`visual`},{keys:`Y`,type:`operatorMotion`,operator:`yank`,motion:`expandToLine`,motionArgs:{linewise:!0},context:`normal`},{keys:`Y`,type:`operator`,operator:`yank`,operatorArgs:{linewise:!0},context:`visual`},{keys:`C`,type:`operatorMotion`,operator:`change`,motion:`moveToEol`,motionArgs:{inclusive:!0},context:`normal`},{keys:`C`,type:`operator`,operator:`change`,operatorArgs:{linewise:!0},context:`visual`},{keys:`~`,type:`operatorMotion`,operator:`changeCase`,motion:`moveByCharacters`,motionArgs:{forward:!0},operatorArgs:{shouldMoveCursor:!0},context:`normal`},{keys:`~`,type:`operator`,operator:`changeCase`,context:`visual`},{keys:`<C-u>`,type:`operatorMotion`,operator:`delete`,motion:`moveToStartOfLine`,context:`insert`},{keys:`<C-w>`,type:`operatorMotion`,operator:`delete`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1},context:`insert`},{keys:`<C-w>`,type:`idle`,context:`normal`},{keys:`<C-i>`,type:`action`,action:`jumpListWalk`,actionArgs:{forward:!0}},{keys:`<C-o>`,type:`action`,action:`jumpListWalk`,actionArgs:{forward:!1}},{keys:`<C-e>`,type:`action`,action:`scroll`,actionArgs:{forward:!0,linewise:!0}},{keys:`<C-y>`,type:`action`,action:`scroll`,actionArgs:{forward:!1,linewise:!0}},{keys:`a`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`charAfter`},context:`normal`},{keys:`A`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`eol`},context:`normal`},{keys:`A`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`endOfSelectedArea`},context:`visual`},{keys:`i`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`inplace`},context:`normal`},{keys:`gi`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`lastEdit`},context:`normal`},{keys:`I`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`firstNonBlank`},context:`normal`},{keys:`gI`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`bol`},context:`normal`},{keys:`I`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{insertAt:`startOfSelectedArea`},context:`visual`},{keys:`o`,type:`action`,action:`newLineAndEnterInsertMode`,isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!0},context:`normal`},{keys:`O`,type:`action`,action:`newLineAndEnterInsertMode`,isEdit:!0,interlaceInsertRepeat:!0,actionArgs:{after:!1},context:`normal`},{keys:`v`,type:`action`,action:`toggleVisualMode`},{keys:`V`,type:`action`,action:`toggleVisualMode`,actionArgs:{linewise:!0}},{keys:`<C-v>`,type:`action`,action:`toggleVisualMode`,actionArgs:{blockwise:!0}},{keys:`<C-q>`,type:`action`,action:`toggleVisualMode`,actionArgs:{blockwise:!0}},{keys:`gv`,type:`action`,action:`reselectLastSelection`},{keys:`J`,type:`action`,action:`joinLines`,isEdit:!0},{keys:`gJ`,type:`action`,action:`joinLines`,actionArgs:{keepSpaces:!0},isEdit:!0},{keys:`p`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!0,isEdit:!0}},{keys:`P`,type:`action`,action:`paste`,isEdit:!0,actionArgs:{after:!1,isEdit:!0}},{keys:`r<character>`,type:`action`,action:`replace`,isEdit:!0},{keys:`@<register>`,type:`action`,action:`replayMacro`},{keys:`q<register>`,type:`action`,action:`enterMacroRecordMode`},{keys:`R`,type:`action`,action:`enterInsertMode`,isEdit:!0,actionArgs:{replace:!0},context:`normal`},{keys:`R`,type:`operator`,operator:`change`,operatorArgs:{linewise:!0,fullLine:!0},context:`visual`,exitVisualBlock:!0},{keys:`u`,type:`action`,action:`undo`,context:`normal`},{keys:`u`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!0},context:`visual`,isEdit:!0},{keys:`U`,type:`operator`,operator:`changeCase`,operatorArgs:{toLower:!1},context:`visual`,isEdit:!0},{keys:`<C-r>`,type:`action`,action:`redo`},{keys:`m<register>`,type:`action`,action:`setMark`},{keys:`"<register>`,type:`action`,action:`setRegister`},{keys:`<C-r><register>`,type:`action`,action:`insertRegister`,context:`insert`,isEdit:!0},{keys:`<C-o>`,type:`action`,action:`oneNormalCommand`,context:`insert`},{keys:`zz`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`center`}},{keys:`z.`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`center`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`zt`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`top`}},{keys:`z<CR>`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`top`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`zb`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`bottom`}},{keys:`z-`,type:`action`,action:`scrollToCursor`,actionArgs:{position:`bottom`},motion:`moveToFirstNonWhiteSpaceCharacter`},{keys:`.`,type:`action`,action:`repeatLastEdit`},{keys:`<C-a>`,type:`action`,action:`incrementNumberToken`,isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:`<C-x>`,type:`action`,action:`incrementNumberToken`,isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:`<C-t>`,type:`action`,action:`indent`,actionArgs:{indentRight:!0},context:`insert`},{keys:`<C-d>`,type:`action`,action:`indent`,actionArgs:{indentRight:!1},context:`insert`},{keys:`a<register>`,type:`motion`,motion:`textObjectManipulation`},{keys:`i<register>`,type:`motion`,motion:`textObjectManipulation`,motionArgs:{textObjectInner:!0}},{keys:`/`,type:`search`,searchArgs:{forward:!0,querySrc:`prompt`,toJumplist:!0}},{keys:`?`,type:`search`,searchArgs:{forward:!1,querySrc:`prompt`,toJumplist:!0}},{keys:`*`,type:`search`,searchArgs:{forward:!0,querySrc:`wordUnderCursor`,wholeWordOnly:!0,toJumplist:!0}},{keys:`#`,type:`search`,searchArgs:{forward:!1,querySrc:`wordUnderCursor`,wholeWordOnly:!0,toJumplist:!0}},{keys:`g*`,type:`search`,searchArgs:{forward:!0,querySrc:`wordUnderCursor`,toJumplist:!0}},{keys:`g#`,type:`search`,searchArgs:{forward:!1,querySrc:`wordUnderCursor`,toJumplist:!0}},{keys:`:`,type:`ex`}],i=Object.create(null),a=r.length,o=[{name:`colorscheme`,shortName:`colo`},{name:`map`},{name:`imap`,shortName:`im`},{name:`nmap`,shortName:`nm`},{name:`vmap`,shortName:`vm`},{name:`omap`,shortName:`om`},{name:`noremap`,shortName:`no`},{name:`nnoremap`,shortName:`nn`},{name:`vnoremap`,shortName:`vn`},{name:`inoremap`,shortName:`ino`},{name:`onoremap`,shortName:`ono`},{name:`unmap`},{name:`mapclear`,shortName:`mapc`},{name:`nmapclear`,shortName:`nmapc`},{name:`vmapclear`,shortName:`vmapc`},{name:`imapclear`,shortName:`imapc`},{name:`omapclear`,shortName:`omapc`},{name:`write`,shortName:`w`},{name:`undo`,shortName:`u`},{name:`redo`,shortName:`red`},{name:`set`,shortName:`se`},{name:`setlocal`,shortName:`setl`},{name:`setglobal`,shortName:`setg`},{name:`sort`,shortName:`sor`},{name:`substitute`,shortName:`s`,possiblyAsync:!0},{name:`startinsert`,shortName:`start`},{name:`nohlsearch`,shortName:`noh`},{name:`yank`,shortName:`y`},{name:`put`,shortName:`pu`},{name:`delmarks`,shortName:`delm`},{name:`marks`,excludeFromCommandHistory:!0},{name:`registers`,shortName:`reg`,excludeFromCommandHistory:!0},{name:`vglobal`,shortName:`v`},{name:`delete`,shortName:`d`},{name:`join`,shortName:`j`},{name:`normal`,shortName:`norm`},{name:`global`,shortName:`g`}],s=xe(``);function c(t){t.setOption(`disableInput`,!0),t.setOption(`showCursorWhenSelecting`,!1),e.signal(t,`vim-mode-change`,{mode:`normal`}),t.on(`cursorActivity`,_n),oe(t),e.on(t.getInputField(),`paste`,u(t))}function l(t){t.setOption(`disableInput`,!1),t.off(`cursorActivity`,_n),e.off(t.getInputField(),`paste`,u(t)),t.state.vim=null,Yt&&clearTimeout(Yt)}function u(e){var t=e.state.vim;return t.onPasteFn||=function(){t.insertMode||(e.setCursor(Le(e.getCursor(),0,1)),Ne.enterInsertMode(e,{},t))},t.onPasteFn}var d=/[\d]/,f=[e.isWordChar,function(t){return t&&!e.isWordChar(t)&&!/\s/.test(t)}],p=[function(e){return/\S/.test(e)}],m=[`<`,`>`],h=[`-`,`"`,`.`,`:`,`_`,`/`,`+`],g=/^\w$/,_=/^[A-Z]$/;try{_=RegExp(`^[\\p{Lu}]$`,`u`)}catch{}function v(e,t){return t>=e.firstLine()&&t<=e.lastLine()}function y(e){return/^[a-z]$/.test(e)}function b(e){return`()[]{}`.indexOf(e)!=-1}function x(e){return d.test(e)}function S(e){return _.test(e)}function C(e){return/^\s*$/.test(e)}function w(e){return`.?!`.indexOf(e)!=-1}function T(e,t){for(var n=0;n<t.length;n++)if(t[n]==e)return!0;return!1}var ee={};function E(e,t,n,r,i){if(t===void 0&&!i)throw Error(`defaultValue is required unless callback is provided`);if(n||=`string`,ee[e]={type:n,defaultValue:t,callback:i},r)for(var a=0;a<r.length;a++)ee[r[a]]=ee[e];t&&te(e,t)}function te(e,t,n,r){var i=ee[e];r||={};var a=r.scope;if(!i)return Error(`Unknown option: `+e);if(i.type==`boolean`){if(t&&t!==!0)return Error(`Invalid argument: `+e+`=`+t);t!==!1&&(t=!0)}i.callback?(a!==`local`&&i.callback(t,void 0),a!==`global`&&n&&i.callback(t,n)):(a!==`local`&&(i.value=i.type==`boolean`?!!t:t),a!==`global`&&n&&(n.state.vim.options[e]={value:t}))}function ne(e,t,n){var r=ee[e];n||={};var i=n.scope;if(!r)return Error(`Unknown option: `+e);if(r.callback){let e=t&&r.callback(void 0,t);return i!==`global`&&e!==void 0?e:i===`local`?void 0:r.callback()}return(i!==`global`&&t&&t.state.vim.options[e]||i!==`local`&&r||{}).value}E(`filetype`,void 0,`string`,[`ft`],function(e,t){if(t!==void 0){if(e===void 0){let e=t.getOption(`mode`);return e==`null`?``:e}{let n=e==``?`null`:e;t.setOption(`mode`,n)}}}),E(`textwidth`,80,`number`,[`tw`],function(e,t){if(t!==void 0){if(e===void 0)return t.getOption(`textwidth`);var n=Math.round(e);n>1&&t.setOption(`textwidth`,n)}});var re=function(){var e=100,t=-1,n=0,r=0,i=Array(e);function a(a,o,s){var c=i[t%e];function l(n){var r=++t%e,o=i[r];o&&o.clear(),i[r]=a.setBookmark(n)}if(c){var u=c.find();u&&!Ue(u,o)&&l(o)}else l(o);l(s),n=t,r=t-e+1,r<0&&(r=0)}function o(a,o){t+=o,t>n?t=n:t<r&&(t=r);var s=i[(e+t)%e];if(s&&!s.find()){var c=o>0?1:-1,l,u=a.getCursor();do if(t+=c,s=i[(e+t)%e],s&&(l=s.find())&&!Ue(u,l))break;while(t<n&&t>r)}return s}function s(e,n){var r=t,i=o(e,n);return t=r,i&&i.find()}return{cachedCursor:void 0,add:a,find:s,move:o}},ie=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class ae{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=ie()}exitMacroRecordMode(){var e=D.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1}enterMacroRecordMode(e,t){var n=D.registerController.getRegister(t);if(n){if(n.clear(),this.latestRegister=t,e.openDialog){var r=Ht(`span`,{class:`cm-vim-message`},`recording @`+t);this.onRecordingDone=e.openDialog(r,function(){},{bottom:!0})}this.isRecording=!0}}}function oe(e){return e.state.vim||(e.state.vim={inputState:new Se,lastEditInputState:void 0,lastEditActionCommand:void 0,lastHPos:-1,lastHSPos:-1,lastMotion:null,marks:{},insertMode:!1,insertModeReturn:!1,insertModeRepeat:void 0,visualMode:!1,visualLine:!1,visualBlock:!1,lastSelection:null,lastPastedText:void 0,sel:{anchor:new t(0,0),head:new t(0,0)},options:{},expectLiteralNext:!1,status:``}),e.state.vim}var D;function se(){for(var e in D={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:re(),macroModeState:new ae,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:``},registerController:new Ee({}),searchHistoryController:new De,exCommandHistoryController:new De},ee){var t=ee[e];t.value=t.defaultValue}}class ce{constructor(e,t){this.keyName=e,this.key=t.key,this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.shiftKey=t.shiftKey}}var le,ue={enterVimMode:c,leaveVimMode:l,buildKeyMap:function(){},getRegisterController:function(){return D.registerController},resetVimGlobalState_:se,getVimGlobalState_:function(){return D},maybeInitVimState_:oe,suppressErrorLogging:!1,InsertModeKey:ce,map:function(e,t,n){sn.map(e,t,n)},unmap:function(e,t){return sn.unmap(e,t)},noremap:function(e,t,n){sn.map(e,t,n,!0)},mapclear:function(e){var t=r.length,n=a,i=r.slice(0,t-n);if(r=r.slice(t-n),e)for(var o=i.length-1;o>=0;o--){var s=i[o];if(e!==s.context){if(s.context)this._mapCommand(s);else{var c=[`normal`,`insert`,`visual`];for(var l in c)if(c[l]!==e){var u=Object.assign({},s);u.context=c[l],this._mapCommand(u)}}}}},langmap:be,vimKeyFromEvent:ye,setOption:te,getOption:ne,defineOption:E,defineEx:function(e,t,n){if(!t)t=e;else if(e.indexOf(t)!==0)throw Error(`(Vim.defineEx) "`+t+`" is not a prefix of "`+e+`", command not registered`);on[e]=n,sn.commandMap_[t]={name:e,shortName:t,type:`api`}},handleKey:function(e,t,n){var r=this.findKey(e,t,n);if(typeof r==`function`)return r()},multiSelectHandleKey:wn,findKey:function(t,n,i){var a=oe(t),o=t;function s(){var e=D.macroModeState;if(e.isRecording){if(n==`q`)return e.exitMacroRecordMode(),Ce(o),!0;i!=`mapping`&&pn(e,n)}}function c(){if(n==`<Esc>`){if(a.visualMode)st(o);else if(a.insertMode)cn(o);else return;return Ce(o),!0}}function l(){if(c())return!0;a.inputState.keyBuffer.push(n);var e=a.inputState.keyBuffer.join(``),t=n.length==1,i=Oe.matchCommand(e,r,a.inputState,`insert`),s=a.inputState.changeQueue;if(i.type==`none`)return Ce(o),!1;if(i.type==`partial`){if(i.expectLiteralNext&&(a.expectLiteralNext=!0),le&&window.clearTimeout(le),le=t&&window.setTimeout(function(){a.insertMode&&a.inputState.keyBuffer.length&&Ce(o)},ne(`insertModeEscKeysTimeout`)),t){var l=o.listSelections();s&&s.removed.length==l.length||(s=a.inputState.changeQueue=new we),s.inserted+=n;for(var u=0;u<l.length;u++){var d=Ge(l[u].anchor,l[u].head),f=Ke(l[u].anchor,l[u].head),p=o.getRange(d,o.state.overwrite?Le(f,0,1):f);s.removed[u]=(s.removed[u]||``)+p}}return!t}if(i.type==`full`&&(a.inputState.keyBuffer.length=0),a.expectLiteralNext=!1,le&&window.clearTimeout(le),i.command&&s){for(var l=o.listSelections(),u=0;u<l.length;u++){var m=l[u].head;o.replaceRange(s.removed[u]||``,Le(m,0,-s.inserted.length),m,`+input`)}D.macroModeState.lastInsertModeChanges.changes.pop()}return i.command||Ce(o),i.command}function u(){if(s()||c())return!0;a.inputState.keyBuffer.push(n);var e=a.inputState.keyBuffer.join(``);if(/^[1-9]\d*$/.test(e))return!0;var t=/^(\d*)(.*)$/.exec(e);if(!t)return Ce(o),!1;var i=a.visualMode?`visual`:`normal`,l=t[2]||t[1];a.inputState.operatorShortcut&&a.inputState.operatorShortcut.slice(-1)==l&&(l=a.inputState.operatorShortcut);var u=Oe.matchCommand(l,r,a.inputState,i);return u.type==`none`?(Ce(o),!1):u.type==`partial`?(u.expectLiteralNext&&(a.expectLiteralNext=!0),!0):u.type==`clear`?(Ce(o),!0):(a.expectLiteralNext=!1,a.inputState.keyBuffer.length=0,t=/^(\d*)(.*)$/.exec(e),t&&t[1]&&t[1]!=`0`&&a.inputState.pushRepeatDigit(t[1]),u.command)}var d=a.insertMode?l():u();if(d===!1)return!a.insertMode&&(n.length===1||e.isMac&&/<A-.>/.test(n))?function(){return!0}:void 0;if(d===!0)return function(){return!0};if(d)return function(){return o.operation(function(){o.curOp.isVimOp=!0;try{if(typeof d!=`object`)return;d.type==`keyToKey`?he(o,d.toKeys,d):Oe.processCommand(o,a,d)}catch(e){throw o.state.vim=void 0,oe(o),ue.suppressErrorLogging||console.log(e),e}return!0})}},handleEx:function(e,t){sn.processCommand(e,t)},defineMotion:Ae,defineAction:Pe,defineOperator:k,mapCommand:dn,_mapCommand:ln,defineRegister:Te,exitVisualMode:st,exitInsertMode:cn},de=[],fe=!1,pe;function me(e){if(!pe)throw Error(`No prompt to send key to`);if(e[0]==`<`){var t=e.toLowerCase().slice(1,-1);if(t=t.split(`-`).pop()||``,t==`lt`)e=`<`;else if(t==`space`)e=` `;else if(t==`cr`)e=`
39
39
  `;else if(ve[t]){var n=pe.value||``,r={key:ve[t],target:{value:n,selectionEnd:n.length,selectionStart:n.length}};pe.onKeyDown&&pe.onKeyDown(r,pe.value,a),pe&&pe.onKeyUp&&pe.onKeyUp(r,pe.value,a);return}}if(e==`
40
40
  `){var i=pe;pe=null,i.onClose&&i.onClose(i.value)}else pe.value=(pe.value||``)+e;function a(e){pe&&(typeof e==`string`?pe.value=e:pe=null)}}function he(e,t,n){var r=fe;if(n){if(de.indexOf(n)!=-1)return;de.push(n),fe=n.noremap!=0}try{for(var i=oe(e),a=/<(?:[CSMA]-)*\w+>|./gi,o;o=a.exec(t);){var s=o[0],c=i.insertMode;if(pe)me(s);else if(!ue.handleKey(e,s,`mapping`)&&c&&i.insertMode){if(s[0]==`<`){var l=s.toLowerCase().slice(1,-1);if(l=l.split(`-`).pop()||``,l==`lt`)s=`<`;else if(l==`space`)s=` `;else if(l==`cr`)s=`
41
- `;else if(ve.hasOwnProperty(l)){s=ve[l],xn(e,s);continue}else s=s[0],a.lastIndex=o.index+1}e.replaceSelection(s)}}}finally{if(de.pop(),fe=de.length?r:!1,!de.length&&pe){var u=pe;pe=null,Gt(e,u)}}}var ge={Return:`CR`,Backspace:`BS`,Delete:`Del`,Escape:`Esc`,Insert:`Ins`,ArrowLeft:`Left`,ArrowRight:`Right`,ArrowUp:`Up`,ArrowDown:`Down`,Enter:`CR`," ":`Space`},_e={Shift:1,Alt:1,Command:1,Control:1,CapsLock:1,AltGraph:1,Dead:1,Unidentified:1},ve={};`Left|Right|Up|Down|End|Home`.split(`|`).concat(Object.keys(ge)).forEach(function(e){ve[(ge[e]||``).toLowerCase()]=ve[e.toLowerCase()]=e});function ye(t,n){var r=t.key;if(!_e[r]){r.length>1&&r[0]==`n`&&(r=r.replace(`Numpad`,``)),r=ge[r]||r;var a=``;if(t.ctrlKey&&(a+=`C-`),t.altKey&&(a+=`A-`),t.metaKey&&(a+=`M-`),e.isMac&&a==`A-`&&r.length==1&&(a=a.slice(2)),(a||r.length>1)&&t.shiftKey&&(a+=`S-`),n&&!n.expectLiteralNext&&r.length==1){if(s.keymap&&r in s.keymap)(s.remapCtrl!=0||!a)&&(r=s.keymap[r]);else if(r.charCodeAt(0)>128&&!i[r]){var o=t.code?.slice(-1)||``;t.shiftKey||(o=o.toLowerCase()),o&&(r=o,!a&&t.altKey&&(a=`A-`))}}return a+=r,a.length>1&&(a=`<`+a+`>`),a}}function be(e,t){s.string!==e&&(s=xe(e)),s.remapCtrl=t}function xe(e){let t={};if(!e)return{keymap:t,string:``};function n(e){return e.split(/\\?(.)/).filter(Boolean)}return e.split(/((?:[^\\,]|\\.)+),/).map(e=>{if(!e)return;let r=e.split(/((?:[^\\;]|\\.)+);/);if(r.length==3){let e=n(r[1]),i=n(r[2]);if(e.length!==i.length)return;for(let n=0;n<e.length;++n)t[e[n]]=i[n]}else if(r.length==1){let r=n(e);if(r.length%2!=0)return;for(let e=0;e<r.length;e+=2)t[r[e]]=r[e+1]}}),{keymap:t,string:e}}E(`langmap`,void 0,`string`,[`lmap`],function(e,t){if(e===void 0)return s.string;be(e)});class Se{constructor(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=void 0,this.changeQueue=null}pushRepeatDigit(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)}getRepeat(){var e=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(e=1,this.prefixRepeat.length>0&&(e*=parseInt(this.prefixRepeat.join(``),10)),this.motionRepeat.length>0&&(e*=parseInt(this.motionRepeat.join(``),10))),e}}function Ce(t,n){t.state.vim.inputState=new Se,t.state.vim.expectLiteralNext=!1,e.signal(t,`vim-command-done`,n)}function we(){this.removed=[],this.inserted=``}class O{constructor(e,t,n){this.clear(),this.keyBuffer=[e||``],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!t,this.blockwise=!!n}setText(e,t,n){this.keyBuffer=[e||``],this.linewise=!!t,this.blockwise=!!n}pushText(e,t){t&&(this.linewise||this.keyBuffer.push(`
41
+ `;else if(ve.hasOwnProperty(l)){s=ve[l],xn(e,s);continue}else s=s[0],a.lastIndex=o.index+1}e.replaceSelection(s)}}}finally{if(de.pop(),fe=de.length?r:!1,!de.length&&pe){var u=pe;pe=null,Gt(e,u)}}}var ge={Return:`CR`,Backspace:`BS`,Delete:`Del`,Escape:`Esc`,Insert:`Ins`,ArrowLeft:`Left`,ArrowRight:`Right`,ArrowUp:`Up`,ArrowDown:`Down`,Enter:`CR`," ":`Space`},_e={Shift:1,Alt:1,Command:1,Control:1,CapsLock:1,AltGraph:1,Dead:1,Unidentified:1},ve={};`Left|Right|Up|Down|End|Home`.split(`|`).concat(Object.keys(ge)).forEach(function(e){ve[(ge[e]||``).toLowerCase()]=ve[e.toLowerCase()]=e});function ye(t,n){var r=t.key;if(!_e[r]){r.length>1&&r[0]==`n`&&(r=r.replace(`Numpad`,``)),r=ge[r]||r;var a=``;if(t.ctrlKey&&(a+=`C-`),t.altKey&&(a+=`A-`),t.metaKey&&(a+=`M-`),e.isMac&&a==`A-`&&r.length==1&&(a=a.slice(2)),(a||r.length>1)&&t.shiftKey&&(a+=`S-`),n&&!n.expectLiteralNext&&r.length==1){if(s.keymap&&r in s.keymap)s.remapCtrl==0&&a||(r=s.keymap[r]);else if(r.charCodeAt(0)>128&&!i[r]){var o=t.code?.slice(-1)||``;t.shiftKey||(o=o.toLowerCase()),o&&(r=o,!a&&t.altKey&&(a=`A-`))}}return a+=r,a.length>1&&(a=`<`+a+`>`),a}}function be(e,t){s.string!==e&&(s=xe(e)),s.remapCtrl=t}function xe(e){let t={};if(!e)return{keymap:t,string:``};function n(e){return e.split(/\\?(.)/).filter(Boolean)}return e.split(/((?:[^\\,]|\\.)+),/).map(e=>{if(!e)return;let r=e.split(/((?:[^\\;]|\\.)+);/);if(r.length==3){let e=n(r[1]),i=n(r[2]);if(e.length!==i.length)return;for(let n=0;n<e.length;++n)t[e[n]]=i[n]}else if(r.length==1){let r=n(e);if(r.length%2!=0)return;for(let e=0;e<r.length;e+=2)t[r[e]]=r[e+1]}}),{keymap:t,string:e}}E(`langmap`,void 0,`string`,[`lmap`],function(e,t){if(e===void 0)return s.string;be(e)});class Se{constructor(){this.prefixRepeat=[],this.motionRepeat=[],this.operator=null,this.operatorArgs=null,this.motion=null,this.motionArgs=null,this.keyBuffer=[],this.registerName=void 0,this.changeQueue=null}pushRepeatDigit(e){this.operator?this.motionRepeat=this.motionRepeat.concat(e):this.prefixRepeat=this.prefixRepeat.concat(e)}getRepeat(){var e=0;return(this.prefixRepeat.length>0||this.motionRepeat.length>0)&&(e=1,this.prefixRepeat.length>0&&(e*=parseInt(this.prefixRepeat.join(``),10)),this.motionRepeat.length>0&&(e*=parseInt(this.motionRepeat.join(``),10))),e}}function Ce(t,n){t.state.vim.inputState=new Se,t.state.vim.expectLiteralNext=!1,e.signal(t,`vim-command-done`,n)}function we(){this.removed=[],this.inserted=``}class O{constructor(e,t,n){this.clear(),this.keyBuffer=[e||``],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!!t,this.blockwise=!!n}setText(e,t,n){this.keyBuffer=[e||``],this.linewise=!!t,this.blockwise=!!n}pushText(e,t){t&&(this.linewise||this.keyBuffer.push(`
42
42
  `),this.linewise=!0),this.keyBuffer.push(e)}pushInsertModeChanges(e){this.insertModeChanges.push(ie(e))}pushSearchQuery(e){this.searchQueries.push(e)}clear(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1}toString(){return this.keyBuffer.join(``)}}function Te(e,t){var n=D.registerController.registers;if(!e||e.length!=1)throw Error(`Register name must be 1 character`);if(n[e])throw Error(`Register already defined `+e);n[e]=t,h.push(e)}class Ee{constructor(e){this.registers=e,this.unnamedRegister=e[`"`]=new O,e[`.`]=new O,e[`:`]=new O,e[`/`]=new O,e[`+`]=new O}pushText(e,t,n,r,i){if(e!==`_`){r&&n.charAt(n.length-1)!==`
43
43
  `&&(n+=`
44
44
  `);var a=this.isValidRegister(e)?this.getRegister(e):null;if(!a||!e){switch(t){case`yank`:this.registers[0]=new O(n,r,i);break;case`delete`:case`change`:n.indexOf(`
@@ -53,9 +53,9 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
53
53
  `)a.visualMode||r.replaceRange(``,s,l),(e.commands.newlineAndIndentContinueComment||e.commands.newlineAndIndent)(r);else{var p=r.getRange(s,l);if(p=p.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,o),p=p.replace(/[^\n]/g,o),a.visualBlock){var m=Array(r.getOption(`tabSize`)+1).join(` `);p=r.getSelection(),p=p.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,o);var h=p.replace(/\t/g,m).replace(/[^\n]/g,o).split(`
54
54
  `);r.replaceSelections(h)}else r.replaceRange(p,s,l);a.visualMode?(s=We(u[0].anchor,u[0].head)?u[0].anchor:u[0].head,r.setCursor(s),st(r,!1)):r.setCursor(Le(l,0,-1))}},incrementNumberToken:function(e,n){for(var r=e.getCursor(),i=e.getLine(r.line),a=/(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi,o,s,c,l;(o=a.exec(i))!==null&&(s=o.index,c=s+o[0].length,!(r.ch<c)););if(!(!n.backtrack&&c<=r.ch)){if(o){var u=o[2]||o[4],d=o[3]||o[5],f=n.increase?1:-1,p={"0b":2,0:8,"":10,"0x":16}[u.toLowerCase()];l=(parseInt(o[1]+d,p)+f*n.repeat).toString(p);var m=u?Array(d.length-l.length+1+o[1].length).join(`0`):``;l=l.charAt(0)===`-`?`-`+u+m+l.substr(1):u+m+l;var h=new t(r.line,s),g=new t(r.line,c);e.replaceRange(l,h,g)}else return;e.setCursor(new t(r.line,s+l.length-1))}},repeatLastEdit:function(e,t,n){var r=n.lastEditInputState;if(r){var i=t.repeat;i&&t.repeatIsExplicit?r.repeatOverride=i:i=r.repeatOverride||i,bn(e,n,i,!1)}},indent:function(e,t){e.indentLine(e.getCursor().line,t.indentRight)},exitInsertMode:function(e,t){cn(e)}};function Pe(e,t){Ne[e]=t}function Fe(e,n,r){var i=e.state.vim,a=i.insertMode||i.visualMode,o=Math.min(Math.max(e.firstLine(),n.line),e.lastLine()),s=e.getLine(o),c=s.length-1+Number(!!a),l=Math.min(Math.max(0,n.ch),c),u=s.charCodeAt(l);if(56320<=u&&u<=57343){var d=1;r&&r.line==o&&r.ch>l&&(d=-1),l+=d,l>c&&(l-=2)}return new t(o,l)}function Ie(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}function Le(e,n,r){return typeof n==`object`&&(r=n.ch,n=n.line),new t(e.line+n,e.ch+r)}function Re(e,t,n,r){r.operator&&(n=`operatorPending`);for(var i,o=[],s=[],c=fe?t.length-a:0;c<t.length;c++){var l=t[c];n==`insert`&&l.context!=`insert`||l.context&&l.context!=n||r.operator&&l.type==`action`||!(i=ze(e,l.keys))||(i==`partial`&&o.push(l),i==`full`&&s.push(l))}return{partial:o,full:s}}function ze(e,t){let n=t.slice(-11)==`<character>`,r=t.slice(-10)==`<register>`;if(n||r){var i=t.length-(n?11:10),a=e.slice(0,i),o=t.slice(0,i);return a==o&&e.length>i?`full`:o.indexOf(a)==0&&`partial`}return e==t?`full`:t.indexOf(e)==0&&`partial`}function Be(e){var t=/^.*(<[^>]+>)$/.exec(e),n=t?t[1]:e.slice(-1);if(n.length>1)switch(n){case`<CR>`:case`<S-CR>`:n=`
55
55
  `;break;case`<Space>`:case`<S-Space>`:n=` `;break;default:n=``}return n}function Ve(e,t,n){return function(){for(var r=0;r<n;r++)t(e)}}function He(e){return new t(e.line,e.ch)}function Ue(e,t){return e.ch==t.ch&&e.line==t.line}function We(e,t){return e.line<t.line||e.line==t.line&&e.ch<t.ch}function Ge(e,t){return arguments.length>2&&(t=Ge.apply(void 0,Array.prototype.slice.call(arguments,1))),We(e,t)?e:t}function Ke(e,t){return arguments.length>2&&(t=Ke.apply(void 0,Array.prototype.slice.call(arguments,1))),We(e,t)?t:e}function qe(e,t,n){var r=We(e,t),i=We(t,n);return r&&i}function Je(e,t){return e.getLine(t).length}function Ye(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,``)}function Xe(e){return e.replace(/([.?*+$\[\]\/\\(){}|\-])/g,`\\$1`)}function Ze(e,n,r){var i=Je(e,n),a=Array(r-i+1).join(` `);e.setCursor(new t(n,i)),e.replaceRange(a,e.getCursor())}function Qe(e,n){var r=[],i=e.listSelections(),a=He(e.clipPos(n)),o=!Ue(n,a),s=et(i,e.getCursor(`head`)),c=Ue(i[s].head,i[s].anchor),l=i.length-1,u=l-s>s?l:0,d=i[u].anchor,f=Math.min(d.line,a.line),p=Math.max(d.line,a.line),m=d.ch,h=a.ch,g=i[u].head.ch-m,_=h-m;g>0&&_<=0?(m++,o||h--):g<0&&_>=0?(m--,c||h++):g<0&&_==-1&&(m--,h++);for(var v=f;v<=p;v++){var y={anchor:new t(v,m),head:new t(v,h)};r.push(y)}return e.setSelections(r),n.ch=h,d.ch=m,d}function $e(e,t,n){for(var r=[],i=0;i<n;i++){var a=Le(t,i,0);r.push({anchor:a,head:a})}e.setSelections(r,0)}function et(e,t,n){for(var r=0;r<e.length;r++){var i=n!=`head`&&Ue(e[r].anchor,t),a=n!=`anchor`&&Ue(e[r].head,t);if(i||a)return r}return-1}function tt(e,t){var n=e.listSelections(),r=n[0],i=n[n.length-1];return[We(r.anchor,r.head)?r.anchor:r.head,We(i.anchor,i.head)?i.head:i.anchor]}function nt(e,t){var n=t.sel.anchor,r=t.sel.head;t.lastPastedText&&=(r=e.posFromIndex(e.indexFromPos(n)+t.lastPastedText.length),void 0),t.lastSelection={anchorMark:e.setBookmark(n),headMark:e.setBookmark(r),anchor:He(n),head:He(r),visualMode:t.visualMode,visualLine:t.visualLine,visualBlock:t.visualBlock}}function rt(e,n,r,i){var a=e.state.vim.sel,o=i?n:a.head,s=i?n:a.anchor,c;return We(r,n)&&(c=r,r=n,n=c),We(o,s)?(o=Ge(n,o),s=Ke(s,r)):(s=Ge(n,s),o=Ke(o,r),o=Le(o,0,-1),o.ch==-1&&o.line!=e.firstLine()&&(o=new t(o.line-1,Je(e,o.line-1)))),[s,o]}function it(e,t,n){var r=e.state.vim;t||=r.sel,n||=r.visualLine?`line`:r.visualBlock?`block`:`char`;var i=at(e,t,n);e.setSelections(i.ranges,i.primary)}function at(e,n,r,i){var a=He(n.head),o=He(n.anchor);if(r==`char`){var s=+(!i&&!We(n.head,n.anchor)),c=+!!We(n.head,n.anchor);return a=Le(n.head,0,s),o=Le(n.anchor,0,c),{ranges:[{anchor:o,head:a}],primary:0}}if(r==`line`){if(We(n.head,n.anchor))a.ch=0,o.ch=Je(e,o.line);else{o.ch=0;var l=e.lastLine();a.line>l&&(a.line=l),a.ch=Je(e,a.line)}return{ranges:[{anchor:o,head:a}],primary:0}}if(r==`block`){var u=Math.min(o.line,a.line),d=o.ch,f=Math.max(o.line,a.line),p=a.ch;d<p?p+=1:d+=1;for(var m=f-u+1,h=a.line==u?0:m-1,g=[],_=0;_<m;_++)g.push({anchor:new t(u+_,d),head:new t(u+_,p)});return{ranges:g,primary:h}}throw`never happens`}function ot(e){var t=e.getCursor(`head`);return e.getSelection().length==1&&(t=Ge(t,e.getCursor(`anchor`))),t}function st(t,n){var r=t.state.vim;n!==!1&&t.setCursor(Fe(t,r.sel.head)),nt(t,r),r.visualMode=!1,r.visualLine=!1,r.visualBlock=!1,r.insertMode||e.signal(t,`vim-mode-change`,{mode:`normal`})}function ct(e,t,n){var r=e.getRange(t,n);if(/\n\s*$/.test(r)){var i=r.split(`
56
- `);i.pop();for(var a=i.pop();i.length>0&&a&&C(a);a=i.pop())n.line--,n.ch=0;a?(n.line--,n.ch=Je(e,n.line)):n.ch=0}}function lt(e,t,n){t.ch=0,n.ch=0,n.line++}function ut(e){if(!e)return 0;var t=e.search(/\S/);return t==-1?e.length:t}function dt(e,{inclusive:n,innerWord:r,bigWord:i,noSymbol:a,multiline:o},s){var c=s||ot(e),l=e.getLine(c.line),u=l,d=c.line,m=d,h=c.ch,g,_=a?f[0]:p[0];if(r&&/\s/.test(l.charAt(h)))_=function(e){return/\s/.test(e)};else{for(;!_(l.charAt(h));)if(h++,h>=l.length){if(!o)return null;h--,g=vt(e,c,!0,i,!0);break}i?_=p[0]:(_=f[0],_(l.charAt(h))||(_=f[1]))}for(var v=h,y=h;_(l.charAt(y))&&y>=0;)y--;if(y++,g)v=g.to,m=g.line,u=e.getLine(m),!u&&v==0&&v++;else for(;_(l.charAt(v))&&v<l.length;)v++;if(n){var b=v,x=c.ch<=y&&/\s/.test(l.charAt(c.ch));if(!x)for(;/\s/.test(u.charAt(v))&&v<u.length;)v++;if(b==v||x){for(var S=y;/\s/.test(l.charAt(y-1))&&y>0;)y--;!y&&!x&&(y=S)}}return{start:new t(d,y),end:new t(m,v)}}function ft(t,n,r){var i=n;if(!e.findMatchingTag||!e.findEnclosingTag)return{start:i,end:i};var a=e.findMatchingTag(t,n)||e.findEnclosingTag(t,n);return!a||!a.open||!a.close?{start:i,end:i}:r?{start:a.open.from,end:a.close.to}:{start:a.open.to,end:a.close.from}}function pt(e,t,n){Ue(t,n)||D.jumpList.add(e,t,n)}function mt(e,t){D.lastCharacterSearch.increment=e,D.lastCharacterSearch.forward=t.forward,D.lastCharacterSearch.selectedCharacter=t.selectedCharacter}var ht={"(":`bracket`,")":`bracket`,"{":`bracket`,"}":`bracket`,"[":`section`,"]":`section`,"*":`comment`,"/":`comment`,m:`method`,M:`method`,"#":`preprocess`},gt={bracket:{isComplete:function(e){if(e.nextCh===e.symb){if(e.depth++,e.depth>=1)return!0}else e.nextCh===e.reverseSymb&&e.depth--;return!1}},section:{init:function(e){e.curMoveThrough=!0,e.symb=(e.forward?`]`:`[`)===e.symb?`{`:`}`},isComplete:function(e){return e.index===0&&e.nextCh===e.symb}},comment:{isComplete:function(e){var t=e.lastCh===`*`&&e.nextCh===`/`;return e.lastCh=e.nextCh,t}},method:{init:function(e){e.symb=e.symb===`m`?`{`:`}`,e.reverseSymb=e.symb===`{`?`}`:`{`},isComplete:function(e){return e.nextCh===e.symb}},preprocess:{init:function(e){e.index=0},isComplete:function(e){if(e.nextCh===`#`){var t=e.lineText.match(/^#(\w+)/)?.[1];if(t===`endif`){if(e.forward&&e.depth===0)return!0;e.depth++}else if(t===`if`){if(!e.forward&&e.depth===0)return!0;e.depth--}if(t===`else`&&e.depth===0)return!0}return!1}}};function _t(e,n,r,i){var a=He(e.getCursor()),o=r?1:-1,s=r?e.lineCount():-1,c=a.ch,l=a.line,u=e.getLine(l),d={lineText:u,nextCh:u.charAt(c),lastCh:null,index:c,symb:i,reverseSymb:(r?{")":`(`,"}":`{`}:{"(":`)`,"{":`}`})[i],forward:r,depth:0,curMoveThrough:!1},f=ht[i];if(!f)return a;var p=gt[f].init,m=gt[f].isComplete;for(p&&p(d);l!==s&&n;){if(d.index+=o,d.nextCh=d.lineText.charAt(d.index),!d.nextCh){if(l+=o,d.lineText=e.getLine(l)||``,o>0)d.index=0;else{var h=d.lineText.length;d.index=h>0?h-1:0}d.nextCh=d.lineText.charAt(d.index)}m(d)&&(a.line=l,a.ch=d.index,n--)}return d.nextCh||d.curMoveThrough?new t(l,d.index):a}function vt(e,t,n,r,i){var a=t.line,o=t.ch,s=e.getLine(a),c=n?1:-1,l=r?p:f;if(i&&s==``){if(a+=c,s=e.getLine(a),!v(e,a))return null;o=n?0:s.length}for(;;){if(i&&s==``)return{from:0,to:0,line:a};for(var u=c>0?s.length:-1,d=u,m=u;o!=u;){for(var h=!1,g=0;g<l.length&&!h;++g)if(l[g](s.charAt(o))){for(d=o;o!=u&&l[g](s.charAt(o));)o+=c;if(m=o,h=d!=m,d==t.ch&&a==t.line&&m==d+c)continue;return{from:Math.min(d,m+1),to:Math.max(d,m),line:a}}h||(o+=c)}if(a+=c,!v(e,a))return null;s=e.getLine(a),o=c>0?0:s.length}}function yt(e,n,r,i,a,o){var s=He(n),c=[];(i&&!a||!i&&a)&&r++;for(var l=!(i&&a),u=0;u<r;u++){var d=vt(e,n,i,o,l);if(!d){var f=Je(e,e.lastLine());c.push(i?{line:e.lastLine(),from:f,to:f}:{line:0,from:0,to:0});break}c.push(d),n=new t(d.line,i?d.to-1:d.from)}var p=c.length!=r,m=c[0],h=c.pop();return i&&!a?(!p&&(m.from!=s.ch||m.line!=s.line)&&(h=c.pop()),h&&new t(h.line,h.from)):i&&a?h&&new t(h.line,h.to-1):!i&&a?(!p&&(m.to!=s.ch||m.line!=s.line)&&(h=c.pop()),h&&new t(h.line,h.to)):h&&new t(h.line,h.from)}function bt(e,n,r,i,a){var o=new t(n.line+r.repeat-1,1/0),s=e.clipPos(o);return s.ch--,a||(i.lastHPos=1/0,i.lastHSPos=e.charCoords(s,`div`).left),o}function xt(e,n,r,i,a){if(i){for(var o=a||e.getCursor(),s=o.ch,c,l=0;l<n;l++){var u=e.getLine(o.line);if(c=wt(s,u,i,r,!0),c==-1)return;s=c}if(c!=null)return new t(e.getCursor().line,c)}}function St(e,n){var r=e.getCursor().line;return Fe(e,new t(r,n-1))}function Ct(e,t,n,r){(T(n,m)||g.test(n))&&(t.marks[n]&&t.marks[n].clear(),t.marks[n]=e.setBookmark(r))}function wt(e,t,n,r,i){var a;return r?(a=t.indexOf(n,e+1),a!=-1&&!i&&--a):(a=t.lastIndexOf(n,e-1),a!=-1&&!i&&(a+=1)),a}function Tt(e,n,r,i,a){var o=n.line,s=e.firstLine(),c=e.lastLine(),l,u,d=o;function f(t){return!e.getLine(t)}function p(e,t,n){return n?f(e)!=f(e+t):!f(e)&&f(e+t)}if(i){for(;s<=d&&d<=c&&r>0;)p(d,i)&&r--,d+=i;return{start:new t(d,0),end:n}}var m=e.state.vim;if(m.visualLine&&p(o,1,!0)){var h=m.sel.anchor;p(h.line,-1,!0)&&(!a||h.line!=o)&&(o+=1)}var g=f(o);for(d=o;d<=c&&r;d++)p(d,1,!0)&&(!a||f(d)!=g)&&r--;for(u=new t(d,0),d>c&&!g?g=!0:a=!1,d=o;d>s&&(a&&f(d)!=g&&d!=o||!p(d,-1,!0));d--);return l=new t(d,0),{start:l,end:u}}function Et(e,n,r,i,a){function o(e){e.line!==null&&(e.pos+e.dir<0||e.pos+e.dir>=e.line.length?e.line=null:e.pos+=e.dir)}function s(e,t,n,r){var i={line:e.getLine(t),ln:t,pos:n,dir:r};if(i.line===``)return{ln:i.ln,pos:i.pos};var s=i.pos;for(o(i);i.line!==null;){if(s=i.pos,w(i.line[i.pos])){if(a){for(o(i);i.line!==null&&C(i.line[i.pos]);)s=i.pos,o(i);return{ln:i.ln,pos:s+1}}return{ln:i.ln,pos:i.pos+1}}o(i)}return{ln:i.ln,pos:s+1}}function c(e,t,n,r){var i=e.getLine(t),s={line:i,ln:t,pos:n,dir:r};if(s.line===``)return{ln:s.ln,pos:s.pos};var c=s.pos;for(o(s);s.line!==null;){if(!C(s.line[s.pos])&&!w(s.line[s.pos]))c=s.pos;else if(w(s.line[s.pos]))return a&&C(s.line[s.pos+1])?{ln:s.ln,pos:s.pos+1}:{ln:s.ln,pos:c};o(s)}return s.line=i,a&&C(s.line[s.pos])?{ln:s.ln,pos:s.pos}:{ln:s.ln,pos:c}}for(var l={ln:n.line,pos:n.ch};r>0;)l=i<0?c(e,l.ln,l.pos,i):s(e,l.ln,l.pos,i),r--;return new t(l.ln,l.pos)}function Dt(e,n,r,i){function a(e,t){if(t.line!==null){if(t.pos+t.dir<0||t.pos+t.dir>=t.line.length){if(t.ln+=t.dir,!v(e,t.ln)){t.line=null;return}t.line=e.getLine(t.ln),t.pos=t.dir>0?0:t.line.length-1}else t.pos+=t.dir}}function o(e,t,n,r){var i=e.getLine(t),o=i===``,s={line:i,ln:t,pos:n,dir:r},c={ln:s.ln,pos:s.pos},l=s.line===``;for(a(e,s);s.line!==null;){if(c.ln=s.ln,c.pos=s.pos,s.line===``&&!l||o&&s.line!==``&&!C(s.line[s.pos]))return{ln:s.ln,pos:s.pos};w(s.line[s.pos])&&!o&&(s.pos===s.line.length-1||C(s.line[s.pos+1]))&&(o=!0),a(e,s)}var i=e.getLine(c.ln);c.pos=0;for(var u=i.length-1;u>=0;--u)if(!C(i[u])){c.pos=u;break}return c}function s(e,t,n,r){var i=e.getLine(t),o={line:i,ln:t,pos:n,dir:r},s=o.ln,c=null,l=o.line===``;for(a(e,o);o.line!==null;){if(o.line===``&&!l)return c===null?{ln:o.ln,pos:o.pos}:{ln:s,pos:c};if(w(o.line[o.pos])&&c!==null&&(o.ln!==s||o.pos+1!==c))return{ln:s,pos:c};o.line!==``&&!C(o.line[o.pos])&&(l=!1,s=o.ln,c=o.pos),a(e,o)}var i=e.getLine(s);c=0;for(var u=0;u<i.length;++u)if(!C(i[u])){c=u;break}return{ln:s,pos:c}}for(var c={ln:n.line,pos:n.ch};r>0;)c=i<0?s(e,c.ln,c.pos,i):o(e,c.ln,c.pos,i),r--;return new t(c.ln,c.pos)}function Ot(e,n,r,i){var a=n,o={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/,"<":/[<>]/,">":/[<>]/}[r],s={"(":`(`,")":`(`,"[":`[`,"]":`[`,"{":`{`,"}":`{`,"<":`<`,">":`<`}[r],c=+(e.getLine(a.line).charAt(a.ch)===s),l=e.scanForBracket(new t(a.line,a.ch+c),-1,void 0,{bracketRegex:o}),u=e.scanForBracket(new t(a.line,a.ch+c),1,void 0,{bracketRegex:o});if(!l||!u)return null;var d=l.pos,f=u.pos;if(d.line==f.line&&d.ch>f.ch||d.line>f.line){var p=d;d=f,f=p}return i?f.ch+=1:d.ch+=1,{start:d,end:f}}function kt(e,n,r,i){var a=He(n),o=e.getLine(a.line).split(``),s,c,l,u,d=o.indexOf(r);if(a.ch<d)a.ch=d;else if(d<a.ch&&o[a.ch]==r){var f=/string/.test(e.getTokenTypeAt(Le(n,0,1))),p=/string/.test(e.getTokenTypeAt(n));(!f||p)&&(c=a.ch,--a.ch)}if(o[a.ch]==r&&!c)s=a.ch+1;else for(l=a.ch;l>-1&&!s;l--)o[l]==r&&(s=l+1);if(s&&!c)for(l=s,u=o.length;l<u&&!c;l++)o[l]==r&&(c=l);return!s||!c?{start:a,end:a}:(i&&(--s,++c),{start:new t(a.line,s),end:new t(a.line,c)})}E(`pcre`,!0,`boolean`);class At{constructor(){this.highlightTimeout}getQuery(){return D.query}setQuery(e){D.query=e}getOverlay(){return this.searchOverlay}setOverlay(e){this.searchOverlay=e}isReversed(){return D.isReversed}setReversed(e){D.isReversed=e}getScrollbarAnnotate(){return this.annotate}setScrollbarAnnotate(e){this.annotate=e}}function jt(e){var t=e.state.vim;return t.searchState_||=new At}function Mt(e){return Pt(e,`/`)}function Nt(e){return Ft(e,`/`)}function Pt(e,t){var n=Ft(e,t)||[];if(!n.length)return[];var r=[];if(n[0]===0){for(var i=0;i<n.length;i++)typeof n[i]==`number`&&r.push(e.substring(n[i]+1,n[i+1]));return r}}function Ft(e,t){t||=`/`;for(var n=!1,r=[],i=0;i<e.length;i++){var a=e.charAt(i);!n&&a==t&&r.push(i),n=!n&&a==`\\`}return r}function It(e){var t={V:`|(){+?*.[$^`,M:`|(){+?*.[`,m:`|(){+?`,v:`<>`},n={">":`(?<=[\\w])(?=[^\\w]|$)`,"<":`(?<=[^\\w]|^)(?=[\\w])`},r=t.m,i=e.replace(/\\.|[\[|(){+*?.$^<>]/g,function(e){if(e[0]===`\\`){var i=e[1];return i===`}`||r.indexOf(i)!=-1?i:i in t?(r=t[i],``):i in n?n[i]:e}return r.indexOf(e)==-1?e:n[e]||`\\`+e}),a=i.indexOf(`\\zs`);return a!=-1&&(i=`(?<=`+i.slice(0,a)+`)`+i.slice(a+3)),a=i.indexOf(`\\ze`),a!=-1&&(i=i.slice(0,a)+`(?=`+i.slice(a+3)+`)`),i}var Lt={"\\n":`
56
+ `);i.pop();for(var a=i.pop();i.length>0&&a&&C(a);a=i.pop())n.line--,n.ch=0;a?(n.line--,n.ch=Je(e,n.line)):n.ch=0}}function lt(e,t,n){t.ch=0,n.ch=0,n.line++}function ut(e){if(!e)return 0;var t=e.search(/\S/);return t==-1?e.length:t}function dt(e,{inclusive:n,innerWord:r,bigWord:i,noSymbol:a,multiline:o},s){var c=s||ot(e),l=e.getLine(c.line),u=l,d=c.line,m=d,h=c.ch,g,_=a?f[0]:p[0];if(r&&/\s/.test(l.charAt(h)))_=function(e){return/\s/.test(e)};else{for(;!_(l.charAt(h));)if(h++,h>=l.length){if(!o)return null;h--,g=vt(e,c,!0,i,!0);break}i?_=p[0]:(_=f[0],_(l.charAt(h))||(_=f[1]))}for(var v=h,y=h;_(l.charAt(y))&&y>=0;)y--;if(y++,g)v=g.to,m=g.line,u=e.getLine(m),!u&&v==0&&v++;else for(;_(l.charAt(v))&&v<l.length;)v++;if(n){var b=v,x=c.ch<=y&&/\s/.test(l.charAt(c.ch));if(!x)for(;/\s/.test(u.charAt(v))&&v<u.length;)v++;if(b==v||x){for(var S=y;/\s/.test(l.charAt(y-1))&&y>0;)y--;!y&&!x&&(y=S)}}return{start:new t(d,y),end:new t(m,v)}}function ft(t,n,r){var i=n;if(!e.findMatchingTag||!e.findEnclosingTag)return{start:i,end:i};var a=e.findMatchingTag(t,n)||e.findEnclosingTag(t,n);return!a||!a.open||!a.close?{start:i,end:i}:r?{start:a.open.from,end:a.close.to}:{start:a.open.to,end:a.close.from}}function pt(e,t,n){Ue(t,n)||D.jumpList.add(e,t,n)}function mt(e,t){D.lastCharacterSearch.increment=e,D.lastCharacterSearch.forward=t.forward,D.lastCharacterSearch.selectedCharacter=t.selectedCharacter}var ht={"(":`bracket`,")":`bracket`,"{":`bracket`,"}":`bracket`,"[":`section`,"]":`section`,"*":`comment`,"/":`comment`,m:`method`,M:`method`,"#":`preprocess`},gt={bracket:{isComplete:function(e){if(e.nextCh===e.symb){if(e.depth++,e.depth>=1)return!0}else e.nextCh===e.reverseSymb&&e.depth--;return!1}},section:{init:function(e){e.curMoveThrough=!0,e.symb=(e.forward?`]`:`[`)===e.symb?`{`:`}`},isComplete:function(e){return e.index===0&&e.nextCh===e.symb}},comment:{isComplete:function(e){var t=e.lastCh===`*`&&e.nextCh===`/`;return e.lastCh=e.nextCh,t}},method:{init:function(e){e.symb=e.symb===`m`?`{`:`}`,e.reverseSymb=e.symb===`{`?`}`:`{`},isComplete:function(e){return e.nextCh===e.symb}},preprocess:{init:function(e){e.index=0},isComplete:function(e){if(e.nextCh===`#`){var t=e.lineText.match(/^#(\w+)/)?.[1];if(t===`endif`){if(e.forward&&e.depth===0)return!0;e.depth++}else if(t===`if`){if(!e.forward&&e.depth===0)return!0;e.depth--}if(t===`else`&&e.depth===0)return!0}return!1}}};function _t(e,n,r,i){var a=He(e.getCursor()),o=r?1:-1,s=r?e.lineCount():-1,c=a.ch,l=a.line,u=e.getLine(l),d={lineText:u,nextCh:u.charAt(c),lastCh:null,index:c,symb:i,reverseSymb:(r?{")":`(`,"}":`{`}:{"(":`)`,"{":`}`})[i],forward:r,depth:0,curMoveThrough:!1},f=ht[i];if(!f)return a;var p=gt[f].init,m=gt[f].isComplete;for(p&&p(d);l!==s&&n;){if(d.index+=o,d.nextCh=d.lineText.charAt(d.index),!d.nextCh){if(l+=o,d.lineText=e.getLine(l)||``,o>0)d.index=0;else{var h=d.lineText.length;d.index=h>0?h-1:0}d.nextCh=d.lineText.charAt(d.index)}m(d)&&(a.line=l,a.ch=d.index,n--)}return d.nextCh||d.curMoveThrough?new t(l,d.index):a}function vt(e,t,n,r,i){var a=t.line,o=t.ch,s=e.getLine(a),c=n?1:-1,l=r?p:f;if(i&&s==``){if(a+=c,s=e.getLine(a),!v(e,a))return null;o=n?0:s.length}for(;;){if(i&&s==``)return{from:0,to:0,line:a};for(var u=c>0?s.length:-1,d=u,m=u;o!=u;){for(var h=!1,g=0;g<l.length&&!h;++g)if(l[g](s.charAt(o))){for(d=o;o!=u&&l[g](s.charAt(o));)o+=c;if(m=o,h=d!=m,d==t.ch&&a==t.line&&m==d+c)continue;return{from:Math.min(d,m+1),to:Math.max(d,m),line:a}}h||(o+=c)}if(a+=c,!v(e,a))return null;s=e.getLine(a),o=c>0?0:s.length}}function yt(e,n,r,i,a,o){var s=He(n),c=[];(i&&!a||!i&&a)&&r++;for(var l=!(i&&a),u=0;u<r;u++){var d=vt(e,n,i,o,l);if(!d){var f=Je(e,e.lastLine());c.push(i?{line:e.lastLine(),from:f,to:f}:{line:0,from:0,to:0});break}c.push(d),n=new t(d.line,i?d.to-1:d.from)}var p=c.length!=r,m=c[0],h=c.pop();return i&&!a?(p||m.from==s.ch&&m.line==s.line||(h=c.pop()),h&&new t(h.line,h.from)):i&&a?h&&new t(h.line,h.to-1):!i&&a?(p||m.to==s.ch&&m.line==s.line||(h=c.pop()),h&&new t(h.line,h.to)):h&&new t(h.line,h.from)}function bt(e,n,r,i,a){var o=new t(n.line+r.repeat-1,1/0),s=e.clipPos(o);return s.ch--,a||(i.lastHPos=1/0,i.lastHSPos=e.charCoords(s,`div`).left),o}function xt(e,n,r,i,a){if(i){for(var o=a||e.getCursor(),s=o.ch,c,l=0;l<n;l++){var u=e.getLine(o.line);if(c=wt(s,u,i,r,!0),c==-1)return;s=c}if(c!=null)return new t(e.getCursor().line,c)}}function St(e,n){var r=e.getCursor().line;return Fe(e,new t(r,n-1))}function Ct(e,t,n,r){(T(n,m)||g.test(n))&&(t.marks[n]&&t.marks[n].clear(),t.marks[n]=e.setBookmark(r))}function wt(e,t,n,r,i){var a;return r?(a=t.indexOf(n,e+1),a!=-1&&!i&&--a):(a=t.lastIndexOf(n,e-1),a!=-1&&!i&&(a+=1)),a}function Tt(e,n,r,i,a){var o=n.line,s=e.firstLine(),c=e.lastLine(),l,u,d=o;function f(t){return!e.getLine(t)}function p(e,t,n){return n?f(e)!=f(e+t):!f(e)&&f(e+t)}if(i){for(;s<=d&&d<=c&&r>0;)p(d,i)&&r--,d+=i;return{start:new t(d,0),end:n}}var m=e.state.vim;if(m.visualLine&&p(o,1,!0)){var h=m.sel.anchor;p(h.line,-1,!0)&&(a&&h.line==o||(o+=1))}var g=f(o);for(d=o;d<=c&&r;d++)p(d,1,!0)&&(a&&f(d)==g||r--);for(u=new t(d,0),d>c&&!g?g=!0:a=!1,d=o;d>s&&(a&&f(d)!=g&&d!=o||!p(d,-1,!0));d--);return l=new t(d,0),{start:l,end:u}}function Et(e,n,r,i,a){function o(e){e.line!==null&&(e.pos+e.dir<0||e.pos+e.dir>=e.line.length?e.line=null:e.pos+=e.dir)}function s(e,t,n,r){var i={line:e.getLine(t),ln:t,pos:n,dir:r};if(i.line===``)return{ln:i.ln,pos:i.pos};var s=i.pos;for(o(i);i.line!==null;){if(s=i.pos,w(i.line[i.pos])){if(a){for(o(i);i.line!==null&&C(i.line[i.pos]);)s=i.pos,o(i);return{ln:i.ln,pos:s+1}}return{ln:i.ln,pos:i.pos+1}}o(i)}return{ln:i.ln,pos:s+1}}function c(e,t,n,r){var i=e.getLine(t),s={line:i,ln:t,pos:n,dir:r};if(s.line===``)return{ln:s.ln,pos:s.pos};var c=s.pos;for(o(s);s.line!==null;){if(!C(s.line[s.pos])&&!w(s.line[s.pos]))c=s.pos;else if(w(s.line[s.pos]))return a&&C(s.line[s.pos+1])?{ln:s.ln,pos:s.pos+1}:{ln:s.ln,pos:c};o(s)}return s.line=i,a&&C(s.line[s.pos])?{ln:s.ln,pos:s.pos}:{ln:s.ln,pos:c}}for(var l={ln:n.line,pos:n.ch};r>0;)l=i<0?c(e,l.ln,l.pos,i):s(e,l.ln,l.pos,i),r--;return new t(l.ln,l.pos)}function Dt(e,n,r,i){function a(e,t){if(t.line!==null){if(t.pos+t.dir<0||t.pos+t.dir>=t.line.length){if(t.ln+=t.dir,!v(e,t.ln)){t.line=null;return}t.line=e.getLine(t.ln),t.pos=t.dir>0?0:t.line.length-1}else t.pos+=t.dir}}function o(e,t,n,r){var i=e.getLine(t),o=i===``,s={line:i,ln:t,pos:n,dir:r},c={ln:s.ln,pos:s.pos},l=s.line===``;for(a(e,s);s.line!==null;){if(c.ln=s.ln,c.pos=s.pos,s.line===``&&!l||o&&s.line!==``&&!C(s.line[s.pos]))return{ln:s.ln,pos:s.pos};w(s.line[s.pos])&&!o&&(s.pos===s.line.length-1||C(s.line[s.pos+1]))&&(o=!0),a(e,s)}var i=e.getLine(c.ln);c.pos=0;for(var u=i.length-1;u>=0;--u)if(!C(i[u])){c.pos=u;break}return c}function s(e,t,n,r){var i=e.getLine(t),o={line:i,ln:t,pos:n,dir:r},s=o.ln,c=null,l=o.line===``;for(a(e,o);o.line!==null;){if(o.line===``&&!l)return c===null?{ln:o.ln,pos:o.pos}:{ln:s,pos:c};if(w(o.line[o.pos])&&c!==null&&(o.ln!==s||o.pos+1!==c))return{ln:s,pos:c};o.line!==``&&!C(o.line[o.pos])&&(l=!1,s=o.ln,c=o.pos),a(e,o)}var i=e.getLine(s);c=0;for(var u=0;u<i.length;++u)if(!C(i[u])){c=u;break}return{ln:s,pos:c}}for(var c={ln:n.line,pos:n.ch};r>0;)c=i<0?s(e,c.ln,c.pos,i):o(e,c.ln,c.pos,i),r--;return new t(c.ln,c.pos)}function Ot(e,n,r,i){var a=n,o={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/,"<":/[<>]/,">":/[<>]/}[r],s={"(":`(`,")":`(`,"[":`[`,"]":`[`,"{":`{`,"}":`{`,"<":`<`,">":`<`}[r],c=+(e.getLine(a.line).charAt(a.ch)===s),l=e.scanForBracket(new t(a.line,a.ch+c),-1,void 0,{bracketRegex:o}),u=e.scanForBracket(new t(a.line,a.ch+c),1,void 0,{bracketRegex:o});if(!l||!u)return null;var d=l.pos,f=u.pos;if(d.line==f.line&&d.ch>f.ch||d.line>f.line){var p=d;d=f,f=p}return i?f.ch+=1:d.ch+=1,{start:d,end:f}}function kt(e,n,r,i){var a=He(n),o=e.getLine(a.line).split(``),s,c,l,u,d=o.indexOf(r);if(a.ch<d)a.ch=d;else if(d<a.ch&&o[a.ch]==r){var f=/string/.test(e.getTokenTypeAt(Le(n,0,1))),p=/string/.test(e.getTokenTypeAt(n));(!f||p)&&(c=a.ch,--a.ch)}if(o[a.ch]==r&&!c)s=a.ch+1;else for(l=a.ch;l>-1&&!s;l--)o[l]==r&&(s=l+1);if(s&&!c)for(l=s,u=o.length;l<u&&!c;l++)o[l]==r&&(c=l);return!s||!c?{start:a,end:a}:(i&&(--s,++c),{start:new t(a.line,s),end:new t(a.line,c)})}E(`pcre`,!0,`boolean`);class At{constructor(){this.highlightTimeout}getQuery(){return D.query}setQuery(e){D.query=e}getOverlay(){return this.searchOverlay}setOverlay(e){this.searchOverlay=e}isReversed(){return D.isReversed}setReversed(e){D.isReversed=e}getScrollbarAnnotate(){return this.annotate}setScrollbarAnnotate(e){this.annotate=e}}function jt(e){var t=e.state.vim;return t.searchState_||=new At}function Mt(e){return Pt(e,`/`)}function Nt(e){return Ft(e,`/`)}function Pt(e,t){var n=Ft(e,t)||[];if(!n.length)return[];var r=[];if(n[0]===0){for(var i=0;i<n.length;i++)typeof n[i]==`number`&&r.push(e.substring(n[i]+1,n[i+1]));return r}}function Ft(e,t){t||=`/`;for(var n=!1,r=[],i=0;i<e.length;i++){var a=e.charAt(i);!n&&a==t&&r.push(i),n=!n&&a==`\\`}return r}function It(e){var t={V:`|(){+?*.[$^`,M:`|(){+?*.[`,m:`|(){+?`,v:`<>`},n={">":`(?<=[\\w])(?=[^\\w]|$)`,"<":`(?<=[^\\w]|^)(?=[\\w])`},r=t.m,i=e.replace(/\\.|[\[|(){+*?.$^<>]/g,function(e){if(e[0]===`\\`){var i=e[1];return i===`}`||r.indexOf(i)!=-1?i:i in t?(r=t[i],``):i in n?n[i]:e}return r.indexOf(e)==-1?e:n[e]||`\\`+e}),a=i.indexOf(`\\zs`);return a!=-1&&(i=`(?<=`+i.slice(0,a)+`)`+i.slice(a+3)),a=i.indexOf(`\\ze`),a!=-1&&(i=i.slice(0,a)+`(?=`+i.slice(a+3)+`)`),i}var Lt={"\\n":`
57
57
  `,"\\r":`\r`,"\\t":` `};function Rt(e){for(var t=!1,n=[],r=-1;r<e.length;r++){var i=e.charAt(r)||``,a=e.charAt(r+1)||``;Lt[i+a]?(n.push(Lt[i+a]),r++):t?(n.push(i),t=!1):i===`\\`?(t=!0,x(a)||a===`$`?n.push(`$`):a!==`/`&&a!==`\\`&&n.push(`\\`)):(i===`$`&&n.push(`$`),n.push(i),a===`/`&&n.push(`\\`))}return n.join(``)}var zt={"\\/":`/`,"\\\\":`\\`,"\\n":`
58
- `,"\\r":`\r`,"\\t":` `,"\\&":`&`};function Bt(t){for(var n=new e.StringStream(t),r=[];!n.eol();){for(;n.peek()&&n.peek()!=`\\`;)r.push(n.next());var i=!1;for(var a in zt)if(n.match(a,!0)){i=!0,r.push(zt[a]);break}i||r.push(n.next())}return r.join(``)}function Vt(e,t,n){D.registerController.getRegister(`/`).setText(e);var r=Nt(e),i,a;return r.length?(i=e.substring(0,r[0]),a=e.substring(r[0]).indexOf(`i`)!=-1):i=e,i?(ne(`pcre`)||(i=It(i)),n&&(t=/^[^A-Z]*$/.test(i)),new RegExp(i,t||a?`im`:`m`)):null}function Ht(e){typeof e==`string`&&(e=document.createElement(e));for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n){if(typeof n!=`object`&&(n=document.createTextNode(n)),n.nodeType)e.appendChild(n);else for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(r[0]===`$`?e.style[r.slice(1)]=n[r]:typeof n[r]==`function`?e[r]=n[r]:e.setAttribute(r,n[r]))}}return e}function Ut(e,t,n,r){var i=Ht(`div`,{$color:`red`,$whiteSpace:`pre`,class:`cm-vim-message`},t);e.openNotification?n?(i=Ht(`div`,{},i,Ht(`div`,{},`Press ENTER or type command to continue`)),e.state.closeVimNotification&&e.state.closeVimNotification(),e.state.closeVimNotification=e.openNotification(i,{bottom:!0,duration:0})):e.openNotification(i,{bottom:!0,duration:r||15e3}):r||alert(i.innerText)}function Wt(e,t){return Ht(`div`,{$display:`flex`,$flex:1},Ht(`span`,{$fontFamily:`monospace`,$whiteSpace:`pre`,$flex:1,$display:`flex`},e,Ht(`input`,{type:`text`,autocorrect:`off`,autocapitalize:`off`,spellcheck:`false`,$flex:1})),t&&Ht(`span`,{$color:`#888`},t))}function Gt(e,t){if(de.length)t.value||=``,pe=t;else{var n=Wt(t.prefix,t.desc);if(e.openDialog)e.openDialog(n,t.onClose,{onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,bottom:!0,selectValueOnOpen:!1,value:t.value});else{var r=``;typeof t.prefix!=`string`&&t.prefix&&(r+=t.prefix.textContent),t.desc&&(r+=` `+t.desc),t.onClose?.(prompt(r,``))}}}function Kt(e,t){return e instanceof RegExp&&t instanceof RegExp&&e.flags==t.flags&&e.source==t.source}function qt(e,t,n,r){if(t){var i=jt(e),a=Vt(t,!!n,!!r);if(a)return Xt(e,a),Kt(a,i.getQuery())||i.setQuery(a),a}}function Jt(e){if(e.source.charAt(0)==`^`)var t=!0;return{token:function(n){if(t&&!n.sol())n.skipToEnd();else{var r=n.match(e,!1);if(r)return r[0].length==0?(n.next(),`searching`):!n.sol()&&(n.backUp(1),!e.exec(n.next()+r[0]))?(n.next(),null):(n.match(e),`searching`);for(;!n.eol()&&(n.next(),!n.match(e,!1)););}},query:e}}var Yt=0;function Xt(e,t){clearTimeout(Yt);var n=jt(e);n.highlightTimeout=Yt,Yt=setTimeout(function(){if(e.state.vim){var n=jt(e);n.highlightTimeout=void 0;var r=n.getOverlay();(!r||t!=r.query)&&(r&&e.removeOverlay(r),r=Jt(t),e.addOverlay(r),e.showMatchesOnScrollbar&&(n.getScrollbarAnnotate()&&n.getScrollbarAnnotate().clear(),n.setScrollbarAnnotate(e.showMatchesOnScrollbar(t))),n.setOverlay(r))}},50)}function Zt(e,n,r,i){return e.operation(function(){i===void 0&&(i=1);for(var a=e.getCursor(),o=e.getSearchCursor(r,a),s=0;s<i;s++){var c=o.find(n);if(s==0&&c&&Ue(o.from(),a)){var l=n?o.from():o.to();c=o.find(n),c&&!c[0]&&Ue(o.from(),l)&&e.getLine(l.line).length==l.ch&&(c=o.find(n))}if(!c&&(o=e.getSearchCursor(r,n?new t(e.lastLine()):new t(e.firstLine(),0)),!o.find(n)))return}return o.from()})}function Qt(e,n,r,i,a){return e.operation(function(){i===void 0&&(i=1);var o=e.getCursor(),s=e.getSearchCursor(r,o),c=s.find(!n);!a.visualMode&&c&&Ue(s.from(),o)&&s.find(!n);for(var l=0;l<i;l++)if(c=s.find(n),!c&&(s=e.getSearchCursor(r,n?new t(e.lastLine()):new t(e.firstLine(),0)),!s.find(n)))return;var u=s.from(),d=s.to();return u&&d&&[u,d]})}function $t(e){var t=jt(e);t.highlightTimeout&&=(clearTimeout(t.highlightTimeout),void 0),e.removeOverlay(jt(e).getOverlay()),t.setOverlay(null),t.getScrollbarAnnotate()&&(t.getScrollbarAnnotate().clear(),t.setScrollbarAnnotate(null))}function en(e,t,n){return typeof e!=`number`&&(e=e.line),t instanceof Array?T(e,t):typeof n==`number`?e>=t&&e<=n:e==t}function tn(e){var t=e.getScrollInfo(),n=6,r=10,i=e.coordsChar({left:0,top:n+t.top},`local`),a=t.clientHeight-r+t.top,o=e.coordsChar({left:0,top:a},`local`);return{top:i.line,bottom:o.line}}function nn(e,n,r){if(r==`'`||r=="`")return D.jumpList.find(e,-1)||new t(0,0);if(r==`.`)return rn(e);var i=n.marks[r];return i&&i.find()}function rn(e){if(e.getLastEditEnd)return e.getLastEditEnd();for(var t=e.doc.history.done,n=t.length;n--;)if(t[n].changes)return He(t[n].changes[0].to)}class an{constructor(){this.commandMap_,this.buildCommandMap_()}processCommand(e,t,n){var r=this;e.operation(function(){e.curOp&&(e.curOp.isVimOp=!0),r._processCommand(e,t,n)})}_processCommand(t,n,r){var i=t.state.vim,a=D.registerController.getRegister(`:`),o=a.toString(),s=new e.StringStream(n);a.setText(n);var c=r||{};c.input=n;try{this.parseInput_(t,s,c)}catch(e){Ut(t,e+``);return}i.visualMode&&st(t);var l,u;if(!c.commandName)c.line!==void 0&&(u=`move`);else if(l=this.matchCommand_(c.commandName),l){if(u=l.name,l.excludeFromCommandHistory&&a.setText(o),this.parseCommandArgs_(s,c,l),l.type==`exToKey`){he(t,l.toKeys||``,l);return}if(l.type==`exToEx`){this.processCommand(t,l.toInput||``);return}}if(!u)Ut(t,`Not an editor command ":`+n+`"`);else try{on[u](t,c),(!l||!l.possiblyAsync)&&c.callback&&c.callback()}catch(e){throw Ut(t,e+``),e}}parseInput_(e,t,n){if(t.eatWhile(`:`),t.eat(`%`))n.line=e.firstLine(),n.lineEnd=e.lastLine();else if(t.eat(`*`)){var r=e.state.vim.lastSelection,i=r?.anchorMark.find()?.line||0,a=r?.headMark.find()?.line||0;n.line=Math.max(i,a),n.lineEnd=Math.min(i,a)}else n.line=this.parseLineSpec_(e,t),n.line!==void 0&&t.eat(`,`)&&(n.lineEnd=this.parseLineSpec_(e,t));n.line==null?e.state.vim.visualMode?(n.selectionLine=nn(e,e.state.vim,`<`)?.line,n.selectionLineEnd=nn(e,e.state.vim,`>`)?.line):n.selectionLine=e.getCursor().line:(n.selectionLine=n.line,n.selectionLineEnd=n.lineEnd),t.eatSpace();var o=t.match(/^(\w+|!!|@@|[!#&*<=>@~])/);return n.commandName=o?o[1]:(t.match(/.*/)||[``])[0],n}parseLineSpec_(e,t){var n=t.match(/^([\d]+)/);if(n)return this.parseLineSpecOffset_(e,t,parseInt(n[1],10)-1);switch(t.next()){case`.`:return this.parseLineSpecOffset_(e,t,e.getCursor().line);case`$`:return this.parseLineSpecOffset_(e,t,e.lastLine());case`'`:var r=t.next()||``,i=nn(e,e.state.vim,r);if(!i)throw Error(`Mark not set`);return this.parseLineSpecOffset_(e,t,i.line);case`-`:case`+`:case`/`:case`?`:return t.backUp(1),this.parseLineSpecOffset_(e,t,e.getCursor().line);default:t.backUp(1);return}}parseLineSpecOffset_(e,n,r){for(;;){var i=n.match(/^([\/\?]|\\[\?\/])|([+-]?)(\d*)/);if(!i||!i[0])break;if(i[1]){var a=``,o=!i[1].endsWith(`?`);if(i[1].length==1){var s=n.match(o?/^([^\/\\]|\\\/)*/:/^([^\/\?]|\\\?)*/);n.match(o?/^\/?/:/^\??/),a=s&&s[0]}a||=D.registerController.getRegister(`/`)?.toString()||``;var c=new RegExp(a),l=e.getSearchCursor(c,new t(r+ +!!o,0));o?l.findNext():l.findPrevious();var u=l.from();if(!u)throw Error(`Pattern not found`+c);r=u.line}else{var d=parseInt(i[2]+(i[3]||`1`),10);r+=d}}return r}parseCommandArgs_(e,t,n){if(!e.eol()){t.argString=e.match(/.*/)?.[0];var r=n.argDelimiter||/\s+/,i=Ye(t.argString||``).split(r);i.length&&i[0]&&(t.args=i)}}matchCommand_(e){for(var t=e.length;t>0;t--){var n=e.substring(0,t);if(this.commandMap_[n]){var r=this.commandMap_[n];if(r.name.indexOf(e)===0)return r}}}buildCommandMap_(){this.commandMap_={};for(var e=0;e<o.length;e++){var t=o[e],n=t.shortName||t.name;this.commandMap_[n]=t}}map(e,t,n,r){if(e!=`:`&&e.charAt(0)==`:`){if(n)throw Error(`Mode not supported for ex mappings`);var i=e.substring(1);t!=`:`&&t.charAt(0)==`:`?this.commandMap_[i]={name:i,type:`exToEx`,toInput:t.substring(1),user:!0}:this.commandMap_[i]={name:i,type:`exToKey`,toKeys:t,user:!0}}else{var a={keys:e,type:`keyToKey`,toKeys:t,noremap:!!r};n&&(a.context=n),ln(a)}}unmap(e,t){if(e!=`:`&&e.charAt(0)==`:`){if(t)throw Error(`Mode not supported for ex mappings`);var n=e.substring(1);if(this.commandMap_[n]&&this.commandMap_[n].user)return delete this.commandMap_[n],!0}else for(var i=e,a=0;a<r.length;a++)if(i==r[a].keys&&r[a].context===t)return r.splice(a,1),j(i),!0}}var on={colorscheme:function(e,t){!t.args||t.args.length<1?Ut(e,e.getOption(`theme`)):e.setOption(`theme`,t.args[0])},map:function(e,t,n,r){var i=t.args;!i||i.length<2?e&&Ut(e,`Invalid mapping: `+t.input):sn.map(i[0],i[1],n,r)},imap:function(e,t){this.map(e,t,`insert`)},nmap:function(e,t){this.map(e,t,`normal`)},vmap:function(e,t){this.map(e,t,`visual`)},omap:function(e,t){this.map(e,t,`operatorPending`)},noremap:function(e,t){this.map(e,t,void 0,!0)},inoremap:function(e,t){this.map(e,t,`insert`,!0)},nnoremap:function(e,t){this.map(e,t,`normal`,!0)},vnoremap:function(e,t){this.map(e,t,`visual`,!0)},onoremap:function(e,t){this.map(e,t,`operatorPending`,!0)},unmap:function(e,t,n){var r=t.args;(!r||r.length<1||!sn.unmap(r[0],n))&&e&&Ut(e,`No such mapping: `+t.input)},mapclear:function(e,t){ue.mapclear()},imapclear:function(e,t){ue.mapclear(`insert`)},nmapclear:function(e,t){ue.mapclear(`normal`)},vmapclear:function(e,t){ue.mapclear(`visual`)},omapclear:function(e,t){ue.mapclear(`operatorPending`)},move:function(e,t){Oe.processCommand(e,e.state.vim,{keys:``,type:`motion`,motion:`moveToLineOrEdgeOfDocument`,motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:t.line+1})},set:function(e,t){var n=t.args,r=t.setCfg||{};if(!n||n.length<1)e&&Ut(e,`Invalid mapping: `+t.input);else{var i=n[0].split(`=`),a=i.shift()||``,o=i.length>0?i.join(`=`):void 0,s=!1,c=!1;if(a.charAt(a.length-1)==`?`){if(o)throw Error(`Trailing characters: `+t.argString);a=a.substring(0,a.length-1),s=!0}else a.charAt(a.length-1)==`!`&&(a=a.substring(0,a.length-1),c=!0);o===void 0&&a.substring(0,2)==`no`&&(a=a.substring(2),o=!1);var l=ee[a]&&ee[a].type==`boolean`;if(l&&(c?o=!ne(a,e,r):o??=!0),!l&&o===void 0||s){var u=ne(a,e,r);u instanceof Error?Ut(e,u.message):u===!0||u===!1?Ut(e,` `+(u?``:`no`)+a):Ut(e,` `+a+`=`+u)}else{var d=te(a,o,e,r);d instanceof Error&&Ut(e,d.message)}}},setlocal:function(e,t){t.setCfg={scope:`local`},this.set(e,t)},setglobal:function(e,t){t.setCfg={scope:`global`},this.set(e,t)},registers:function(e,t){var n=t.args,r=D.registerController.registers,i=`----------Registers----------
58
+ `,"\\r":`\r`,"\\t":` `,"\\&":`&`};function Bt(t){for(var n=new e.StringStream(t),r=[];!n.eol();){for(;n.peek()&&n.peek()!=`\\`;)r.push(n.next());var i=!1;for(var a in zt)if(n.match(a,!0)){i=!0,r.push(zt[a]);break}i||r.push(n.next())}return r.join(``)}function Vt(e,t,n){D.registerController.getRegister(`/`).setText(e);var r=Nt(e),i,a;return r.length?(i=e.substring(0,r[0]),a=e.substring(r[0]).indexOf(`i`)!=-1):i=e,i?(ne(`pcre`)||(i=It(i)),n&&(t=/^[^A-Z]*$/.test(i)),new RegExp(i,t||a?`im`:`m`)):null}function Ht(e){typeof e==`string`&&(e=document.createElement(e));for(var t=1;t<arguments.length;t++){var n=arguments[t];if(n){if(typeof n!=`object`&&(n=document.createTextNode(n)),n.nodeType)e.appendChild(n);else for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(r[0]===`$`?e.style[r.slice(1)]=n[r]:typeof n[r]==`function`?e[r]=n[r]:e.setAttribute(r,n[r]))}}return e}function Ut(e,t,n,r){var i=Ht(`div`,{$color:`red`,$whiteSpace:`pre`,class:`cm-vim-message`},t);e.openNotification?n?(i=Ht(`div`,{},i,Ht(`div`,{},`Press ENTER or type command to continue`)),e.state.closeVimNotification&&e.state.closeVimNotification(),e.state.closeVimNotification=e.openNotification(i,{bottom:!0,duration:0})):e.openNotification(i,{bottom:!0,duration:r||15e3}):r||alert(i.innerText)}function Wt(e,t){return Ht(`div`,{$display:`flex`,$flex:1},Ht(`span`,{$fontFamily:`monospace`,$whiteSpace:`pre`,$flex:1,$display:`flex`},e,Ht(`input`,{type:`text`,autocorrect:`off`,autocapitalize:`off`,spellcheck:`false`,$flex:1})),t&&Ht(`span`,{$color:`#888`},t))}function Gt(e,t){if(de.length)t.value||=``,pe=t;else{var n=Wt(t.prefix,t.desc);if(e.openDialog)e.openDialog(n,t.onClose,{onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,bottom:!0,selectValueOnOpen:!1,value:t.value});else{var r=``;typeof t.prefix!=`string`&&t.prefix&&(r+=t.prefix.textContent),t.desc&&(r+=` `+t.desc),t.onClose?.(prompt(r,``))}}}function Kt(e,t){return e instanceof RegExp&&t instanceof RegExp&&e.flags==t.flags&&e.source==t.source}function qt(e,t,n,r){if(t){var i=jt(e),a=Vt(t,!!n,!!r);if(a)return Xt(e,a),Kt(a,i.getQuery())||i.setQuery(a),a}}function Jt(e){if(e.source.charAt(0)==`^`)var t=!0;return{token:function(n){if(t&&!n.sol())n.skipToEnd();else{var r=n.match(e,!1);if(r)return r[0].length==0?(n.next(),`searching`):!n.sol()&&(n.backUp(1),!e.exec(n.next()+r[0]))?(n.next(),null):(n.match(e),`searching`);for(;!n.eol()&&(n.next(),!n.match(e,!1)););}},query:e}}var Yt=0;function Xt(e,t){clearTimeout(Yt);var n=jt(e);n.highlightTimeout=Yt,Yt=setTimeout(function(){if(e.state.vim){var n=jt(e);n.highlightTimeout=void 0;var r=n.getOverlay();r&&t==r.query||(r&&e.removeOverlay(r),r=Jt(t),e.addOverlay(r),e.showMatchesOnScrollbar&&(n.getScrollbarAnnotate()&&n.getScrollbarAnnotate().clear(),n.setScrollbarAnnotate(e.showMatchesOnScrollbar(t))),n.setOverlay(r))}},50)}function Zt(e,n,r,i){return e.operation(function(){i===void 0&&(i=1);for(var a=e.getCursor(),o=e.getSearchCursor(r,a),s=0;s<i;s++){var c=o.find(n);if(s==0&&c&&Ue(o.from(),a)){var l=n?o.from():o.to();c=o.find(n),c&&!c[0]&&Ue(o.from(),l)&&e.getLine(l.line).length==l.ch&&(c=o.find(n))}if(!c&&(o=e.getSearchCursor(r,n?new t(e.lastLine()):new t(e.firstLine(),0)),!o.find(n)))return}return o.from()})}function Qt(e,n,r,i,a){return e.operation(function(){i===void 0&&(i=1);var o=e.getCursor(),s=e.getSearchCursor(r,o),c=s.find(!n);!a.visualMode&&c&&Ue(s.from(),o)&&s.find(!n);for(var l=0;l<i;l++)if(c=s.find(n),!c&&(s=e.getSearchCursor(r,n?new t(e.lastLine()):new t(e.firstLine(),0)),!s.find(n)))return;var u=s.from(),d=s.to();return u&&d&&[u,d]})}function $t(e){var t=jt(e);t.highlightTimeout&&=(clearTimeout(t.highlightTimeout),void 0),e.removeOverlay(jt(e).getOverlay()),t.setOverlay(null),t.getScrollbarAnnotate()&&(t.getScrollbarAnnotate().clear(),t.setScrollbarAnnotate(null))}function en(e,t,n){return typeof e!=`number`&&(e=e.line),t instanceof Array?T(e,t):typeof n==`number`?e>=t&&e<=n:e==t}function tn(e){var t=e.getScrollInfo(),n=6,r=10,i=e.coordsChar({left:0,top:n+t.top},`local`),a=t.clientHeight-r+t.top,o=e.coordsChar({left:0,top:a},`local`);return{top:i.line,bottom:o.line}}function nn(e,n,r){if(r==`'`||r=="`")return D.jumpList.find(e,-1)||new t(0,0);if(r==`.`)return rn(e);var i=n.marks[r];return i&&i.find()}function rn(e){if(e.getLastEditEnd)return e.getLastEditEnd();for(var t=e.doc.history.done,n=t.length;n--;)if(t[n].changes)return He(t[n].changes[0].to)}class an{constructor(){this.commandMap_,this.buildCommandMap_()}processCommand(e,t,n){var r=this;e.operation(function(){e.curOp&&(e.curOp.isVimOp=!0),r._processCommand(e,t,n)})}_processCommand(t,n,r){var i=t.state.vim,a=D.registerController.getRegister(`:`),o=a.toString(),s=new e.StringStream(n);a.setText(n);var c=r||{};c.input=n;try{this.parseInput_(t,s,c)}catch(e){Ut(t,e+``);return}i.visualMode&&st(t);var l,u;if(!c.commandName)c.line!==void 0&&(u=`move`);else if(l=this.matchCommand_(c.commandName),l){if(u=l.name,l.excludeFromCommandHistory&&a.setText(o),this.parseCommandArgs_(s,c,l),l.type==`exToKey`){he(t,l.toKeys||``,l);return}if(l.type==`exToEx`){this.processCommand(t,l.toInput||``);return}}if(!u)Ut(t,`Not an editor command ":`+n+`"`);else try{on[u](t,c),l&&l.possiblyAsync||!c.callback||c.callback()}catch(e){throw Ut(t,e+``),e}}parseInput_(e,t,n){if(t.eatWhile(`:`),t.eat(`%`))n.line=e.firstLine(),n.lineEnd=e.lastLine();else if(t.eat(`*`)){var r=e.state.vim.lastSelection,i=r?.anchorMark.find()?.line||0,a=r?.headMark.find()?.line||0;n.line=Math.max(i,a),n.lineEnd=Math.min(i,a)}else n.line=this.parseLineSpec_(e,t),n.line!==void 0&&t.eat(`,`)&&(n.lineEnd=this.parseLineSpec_(e,t));n.line==null?e.state.vim.visualMode?(n.selectionLine=nn(e,e.state.vim,`<`)?.line,n.selectionLineEnd=nn(e,e.state.vim,`>`)?.line):n.selectionLine=e.getCursor().line:(n.selectionLine=n.line,n.selectionLineEnd=n.lineEnd),t.eatSpace();var o=t.match(/^(\w+|!!|@@|[!#&*<=>@~])/);return n.commandName=o?o[1]:(t.match(/.*/)||[``])[0],n}parseLineSpec_(e,t){var n=t.match(/^([\d]+)/);if(n)return this.parseLineSpecOffset_(e,t,parseInt(n[1],10)-1);switch(t.next()){case`.`:return this.parseLineSpecOffset_(e,t,e.getCursor().line);case`$`:return this.parseLineSpecOffset_(e,t,e.lastLine());case`'`:var r=t.next()||``,i=nn(e,e.state.vim,r);if(!i)throw Error(`Mark not set`);return this.parseLineSpecOffset_(e,t,i.line);case`-`:case`+`:case`/`:case`?`:return t.backUp(1),this.parseLineSpecOffset_(e,t,e.getCursor().line);default:t.backUp(1);return}}parseLineSpecOffset_(e,n,r){for(;;){var i=n.match(/^([\/\?]|\\[\?\/])|([+-]?)(\d*)/);if(!i||!i[0])break;if(i[1]){var a=``,o=!i[1].endsWith(`?`);if(i[1].length==1){var s=n.match(o?/^([^\/\\]|\\\/)*/:/^([^\/\?]|\\\?)*/);n.match(o?/^\/?/:/^\??/),a=s&&s[0]}a||=D.registerController.getRegister(`/`)?.toString()||``;var c=new RegExp(a),l=e.getSearchCursor(c,new t(r+ +!!o,0));o?l.findNext():l.findPrevious();var u=l.from();if(!u)throw Error(`Pattern not found`+c);r=u.line}else{var d=parseInt(i[2]+(i[3]||`1`),10);r+=d}}return r}parseCommandArgs_(e,t,n){if(!e.eol()){t.argString=e.match(/.*/)?.[0];var r=n.argDelimiter||/\s+/,i=Ye(t.argString||``).split(r);i.length&&i[0]&&(t.args=i)}}matchCommand_(e){for(var t=e.length;t>0;t--){var n=e.substring(0,t);if(this.commandMap_[n]){var r=this.commandMap_[n];if(r.name.indexOf(e)===0)return r}}}buildCommandMap_(){this.commandMap_={};for(var e=0;e<o.length;e++){var t=o[e],n=t.shortName||t.name;this.commandMap_[n]=t}}map(e,t,n,r){if(e!=`:`&&e.charAt(0)==`:`){if(n)throw Error(`Mode not supported for ex mappings`);var i=e.substring(1);t!=`:`&&t.charAt(0)==`:`?this.commandMap_[i]={name:i,type:`exToEx`,toInput:t.substring(1),user:!0}:this.commandMap_[i]={name:i,type:`exToKey`,toKeys:t,user:!0}}else{var a={keys:e,type:`keyToKey`,toKeys:t,noremap:!!r};n&&(a.context=n),ln(a)}}unmap(e,t){if(e!=`:`&&e.charAt(0)==`:`){if(t)throw Error(`Mode not supported for ex mappings`);var n=e.substring(1);if(this.commandMap_[n]&&this.commandMap_[n].user)return delete this.commandMap_[n],!0}else for(var i=e,a=0;a<r.length;a++)if(i==r[a].keys&&r[a].context===t)return r.splice(a,1),j(i),!0}}var on={colorscheme:function(e,t){!t.args||t.args.length<1?Ut(e,e.getOption(`theme`)):e.setOption(`theme`,t.args[0])},map:function(e,t,n,r){var i=t.args;!i||i.length<2?e&&Ut(e,`Invalid mapping: `+t.input):sn.map(i[0],i[1],n,r)},imap:function(e,t){this.map(e,t,`insert`)},nmap:function(e,t){this.map(e,t,`normal`)},vmap:function(e,t){this.map(e,t,`visual`)},omap:function(e,t){this.map(e,t,`operatorPending`)},noremap:function(e,t){this.map(e,t,void 0,!0)},inoremap:function(e,t){this.map(e,t,`insert`,!0)},nnoremap:function(e,t){this.map(e,t,`normal`,!0)},vnoremap:function(e,t){this.map(e,t,`visual`,!0)},onoremap:function(e,t){this.map(e,t,`operatorPending`,!0)},unmap:function(e,t,n){var r=t.args;(!r||r.length<1||!sn.unmap(r[0],n))&&e&&Ut(e,`No such mapping: `+t.input)},mapclear:function(e,t){ue.mapclear()},imapclear:function(e,t){ue.mapclear(`insert`)},nmapclear:function(e,t){ue.mapclear(`normal`)},vmapclear:function(e,t){ue.mapclear(`visual`)},omapclear:function(e,t){ue.mapclear(`operatorPending`)},move:function(e,t){Oe.processCommand(e,e.state.vim,{keys:``,type:`motion`,motion:`moveToLineOrEdgeOfDocument`,motionArgs:{forward:!1,explicitRepeat:!0,linewise:!0},repeatOverride:t.line+1})},set:function(e,t){var n=t.args,r=t.setCfg||{};if(!n||n.length<1)e&&Ut(e,`Invalid mapping: `+t.input);else{var i=n[0].split(`=`),a=i.shift()||``,o=i.length>0?i.join(`=`):void 0,s=!1,c=!1;if(a.charAt(a.length-1)==`?`){if(o)throw Error(`Trailing characters: `+t.argString);a=a.substring(0,a.length-1),s=!0}else a.charAt(a.length-1)==`!`&&(a=a.substring(0,a.length-1),c=!0);o===void 0&&a.substring(0,2)==`no`&&(a=a.substring(2),o=!1);var l=ee[a]&&ee[a].type==`boolean`;if(l&&(c?o=!ne(a,e,r):o??=!0),!l&&o===void 0||s){var u=ne(a,e,r);u instanceof Error?Ut(e,u.message):u===!0||u===!1?Ut(e,` `+(u?``:`no`)+a):Ut(e,` `+a+`=`+u)}else{var d=te(a,o,e,r);d instanceof Error&&Ut(e,d.message)}}},setlocal:function(e,t){t.setCfg={scope:`local`},this.set(e,t)},setglobal:function(e,t){t.setCfg={scope:`global`},this.set(e,t)},registers:function(e,t){var n=t.args,r=D.registerController.registers,i=`----------Registers----------
59
59
 
60
60
  `;if(n)for(var a=n.join(``),o=0;o<a.length;o++){var s=a.charAt(o);if(D.registerController.isValidRegister(s)){var c=r[s]||new O;i+=`"`+s+` `+c.toString()+`
61
61
  `}}else for(var s in r){var l=r[s].toString();l.length&&(i+=`"`+s+` `+l+`