diff --git a/buboard-dist/assets/index-BhcwbkF3.js b/buboard-dist/assets/index-BhcwbkF3.js new file mode 100644 index 0000000..4ab9932 --- /dev/null +++ b/buboard-dist/assets/index-BhcwbkF3.js @@ -0,0 +1,152 @@ +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),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n)),l=(e=>typeof require<`u`?require:typeof Proxy<`u`?new Proxy(e,{get:(e,t)=>(typeof require<`u`?require:e)[t]}):e)(function(e){if(typeof require<`u`)return require.apply(this,arguments);throw Error('Calling `require` for "'+e+"\" in an environment that doesn't expose the `require` function.")});(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),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var u=Array.isArray,d=Array.prototype.indexOf,f=Array.from;Object.keys;var p=Object.defineProperty,m=Object.getOwnPropertyDescriptor,h=Object.getOwnPropertyDescriptors,g=Object.prototype,_=Array.prototype,v=Object.getPrototypeOf,y=Object.isExtensible;function b(e){return typeof e==`function`}function x(e){return e()}function S(e){for(var t=0;t{e=n,t=r}),resolve:e,reject:t}}function w(e,t){if(Array.isArray(e))return e;if(t===void 0||!(Symbol.iterator in e))return Array.from(e);let n=[];for(let r of e)if(n.push(r),n.length===t)break;return n}const T=1024,E=2048,D=4096,O=8192,k=65536,A=1<<19,j=1<<20,M=32768,ee=1<<21,N=1<<23,P=Symbol(`$state`),F=Symbol(`legacy props`),I=Symbol(``),L=new class extends Error{name=`StaleReactionError`;message="The reaction that called `getAbortSignal()` was re-run or destroyed"};function te(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function ne(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function re(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function ie(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function ae(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function oe(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function se(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function ce(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function le(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function ue(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function de(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}const fe={},pe=Symbol();function me(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function he(){console.warn(`https://svelte.dev/e/select_multiple_invalid_value`)}function ge(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}let R=!1;function _e(e){R=e}let z;function ve(e){if(e===null)throw me(),fe;return z=e}function ye(){return ve(Kt(z))}function B(e){if(R){if(Kt(z)!==null)throw me(),fe;z=e}}function be(e=1){if(R){for(var t=e,n=z;t--;)n=Kt(n);z=n}}function xe(e=!0){for(var t=0,n=z;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else (r===`[`||r===`[!`)&&(t+=1)}var i=Kt(n);e&&n.remove(),n=i}}function Se(e){if(!e||e.nodeType!==8)throw me(),fe;return e.data}function Ce(e){return e===this.v}function we(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Te(e){return!we(e,this.v)}let Ee=!1;function De(){Ee=!0}var Oe=[];function ke(e,t=!1,n=!1){return Ae(e,new Map,``,Oe,null,n)}function Ae(e,t,n,r,i=null,a=!1){if(typeof e==`object`&&e){var o=t.get(e);if(o!==void 0)return o;if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(u(e)){var s=Array(e.length);t.set(e,s),i!==null&&t.set(i,s);for(var c=0;c{t===Fe&&Ie()})}Fe.push(e)}function Re(e){var t=In;if(t===null)return Nn.f|=N,e;if(t.f&32768)ze(e,t);else{if(!(t.f&128))throw e;t.b.error(e)}}function ze(e,t){for(;t!==null;){if(t.f&128)try{t.b.error(e);return}catch(t){e=t}t=t.parent}throw e}var Be=new Set;let Ve=null,He=null;var Ue=[],We=null,Ge=!1;let Ke=!1;var qe=class e{committed=!1;current=new Map;previous=new Map;#e=new Set;#t=new Set;#n=0;#r=0;#i=null;#a=[];#o=[];skipped_effects=new Set;is_fork=!1;is_deferred(){return this.is_fork||this.#r>0}process(e){Ue=[],this.apply();var t={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(let n of e)this.#s(n,t);this.is_fork||this.#u(),this.is_deferred()?(this.#c(t.effects),this.#c(t.render_effects),this.#c(t.block_effects)):(Ve=null,Ze(t.render_effects),Ze(t.effects),this.#i?.resolve()),He=null}#s(e,t){e.f^=T;for(var n=e.first;n!==null;){var r=n.f,i=(r&96)!=0,a=i&&(r&1024)!=0||(r&8192)!=0||this.skipped_effects.has(n);if(n.f&128&&n.b?.is_pending()&&(t={parent:t,effect:n,effects:[],render_effects:[],block_effects:[]}),!a&&n.fn!==null){i?n.f^=T:r&4?t.effects.push(n):Yn(n)&&(n.f&16&&t.block_effects.push(n),er(n));var o=n.first;if(o!==null){n=o;continue}}var s=n.parent;for(n=n.next;n===null&&s!==null;)s===t.effect&&(this.#c(t.effects),this.#c(t.render_effects),this.#c(t.block_effects),t=t.parent),n=s.next,s=s.parent}}#c(e){for(let t of e)(t.f&2048?this.#a:this.#o).push(t),this.#l(t.deps),ar(t,T)}#l(e){if(e!==null)for(let t of e)!(t.f&2)||!(t.f&32768)||(t.f^=M,this.#l(t.deps))}capture(e,t){this.previous.has(e)||this.previous.set(e,t),e.f&8388608||(this.current.set(e,e.v),He?.set(e,e.v))}activate(){Ve=this,this.apply()}deactivate(){Ve===this&&(Ve=null,He=null)}flush(){if(this.activate(),Ue.length>0){if(Je(),Ve!==null&&Ve!==this)return}else this.#n===0&&this.process([]);this.deactivate()}discard(){for(let e of this.#t)e(this);this.#t.clear()}#u(){if(this.#r===0){for(let e of this.#e)e();this.#e.clear()}this.#n===0&&this.#d()}#d(){if(Be.size>1){this.previous.clear();var e=He,t=!0,n={parent:null,effect:null,effects:[],render_effects:[],block_effects:[]};for(let e of Be){if(e===this){t=!1;continue}let i=[];for(let[n,r]of this.current){if(e.current.has(n))if(t&&r!==e.current.get(n))e.current.set(n,r);else continue;i.push(n)}if(i.length===0)continue;let a=[...e.current.keys()].filter(e=>!this.current.has(e));if(a.length>0){var r=Ue;Ue=[];let t=new Set,o=new Map;for(let e of i)Qe(e,a,t,o);if(Ue.length>0){Ve=e,e.apply();for(let t of Ue)e.#s(t,n);e.deactivate()}Ue=r}}Ve=null,He=e}this.committed=!0,Be.delete(this)}increment(e){this.#n+=1,e&&(this.#r+=1)}decrement(e){--this.#n,e&&--this.#r,this.revive()}revive(){for(let e of this.#a)ar(e,E),et(e);for(let e of this.#o)ar(e,D),et(e);this.#a=[],this.#o=[],this.flush()}oncommit(e){this.#e.add(e)}ondiscard(e){this.#t.add(e)}settled(){return(this.#i??=C()).promise}static ensure(){if(Ve===null){let t=Ve=new e;Be.add(Ve),e.enqueue(()=>{Ve===t&&t.flush()})}return Ve}static enqueue(e){Le(e)}apply(){}};function Je(){var e=kn;Ge=!0;try{var t=0;for(An(!0);Ue.length>0;){var n=qe.ensure();t++>1e3&&Ye(),n.process(Ue),Et.clear()}}finally{Ge=!1,An(e),We=null}}function Ye(){try{oe()}catch(e){ze(e,We)}}let Xe=null;function Ze(e){var t=e.length;if(t!==0){for(var n=0;n0)){Et.clear();for(let e of Xe){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Xe.has(n)&&(Xe.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||er(n)}}Xe.clear()}}Xe=null}}function Qe(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(let i of e.reactions){let e=i.f;e&2?Qe(i,t,n,r):e&4194320&&!(e&2048)&&$e(i,t,r)&&(ar(i,E),et(i))}}function $e(e,t,n){let r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(let r of e.deps){if(t.includes(r))return!0;if(r.f&2&&$e(r,t,n))return n.set(r,!0),!0}return n.set(e,!1),!1}function et(e){for(var t=We=e;t.parent!==null;){t=t.parent;var n=t.f;if(Ge&&t===In&&n&16&&!(n&262144))return;if(n&96){if(!(n&1024))return;t.f^=T}}Ue.push(t)}function tt(e){let t=0,n=Ot(0),r;return()=>{rn()&&(G(n),fn(()=>(t===0&&(r=rr(()=>e(()=>Pt(n)))),t+=1,()=>{Le(()=>{--t,t===0&&(r?.(),r=void 0,Pt(n))})})))}}var nt=A|65664;function rt(e,t,n){new it(e,t,n)}var it=class{parent;#e=!1;#t;#n=R?z:null;#r;#i;#a;#o=null;#s=null;#c=null;#l=null;#u=null;#d=0;#f=0;#p=!1;#m=null;#h=tt(()=>(this.#m=Ot(this.#d),()=>{this.#m=null}));constructor(e,t,n){this.#t=e,this.#r=t,this.#i=n,this.parent=In.b,this.#e=!!this.#r.pending,this.#a=mn(()=>{if(In.b=this,R){let e=this.#n;ye(),e.nodeType===8&&e.data===`[!`?this.#_():this.#g()}else{var e=this.#v();try{this.#o=gn(()=>n(e))}catch(e){this.error(e)}this.#f>0?this.#b():this.#e=!1}return()=>{this.#u?.remove()}},nt),R&&(this.#t=z)}#g(){try{this.#o=gn(()=>this.#i(this.#t))}catch(e){this.error(e)}this.#e=!1}#_(){let e=this.#r.pending;e&&(this.#s=gn(()=>e(this.#t)),qe.enqueue(()=>{var e=this.#v();this.#o=this.#y(()=>(qe.ensure(),gn(()=>this.#i(e)))),this.#f>0?this.#b():(Cn(this.#s,()=>{this.#s=null}),this.#e=!1)}))}#v(){var e=this.#t;return this.#e&&(this.#u=Wt(),this.#t.before(this.#u),e=this.#u),e}is_pending(){return this.#e||!!this.parent&&this.parent.is_pending()}has_pending_snippet(){return!!this.#r.pending}#y(e){var t=In,n=Nn,r=V;Ln(this.#a),Fn(this.#a),je(this.#a.ctx);try{return e()}catch(e){return Re(e),null}finally{Ln(t),Fn(n),je(r)}}#b(){let e=this.#r.pending;this.#o!==null&&(this.#l=document.createDocumentFragment(),this.#l.append(this.#u),On(this.#o,this.#l)),this.#s===null&&(this.#s=gn(()=>e(this.#t)))}#x(e){if(!this.has_pending_snippet()){this.parent&&this.parent.#x(e);return}this.#f+=e,this.#f===0&&(this.#e=!1,this.#s&&Cn(this.#s,()=>{this.#s=null}),this.#l&&=(this.#t.before(this.#l),null))}update_pending_count(e){this.#x(e),this.#d+=e,this.#m&&jt(this.#m,this.#d)}get_effect_pending(){return this.#h(),G(this.#m)}error(e){var t=this.#r.onerror;let n=this.#r.failed;if(this.#p||!t&&!n)throw e;this.#o&&=(bn(this.#o),null),this.#s&&=(bn(this.#s),null),this.#c&&=(bn(this.#c),null),R&&(ve(this.#n),be(),ve(xe()));var r=!1,i=!1;let a=()=>{if(r){ge();return}r=!0,i&&de(),qe.ensure(),this.#d=0,this.#c!==null&&Cn(this.#c,()=>{this.#c=null}),this.#e=this.has_pending_snippet(),this.#o=this.#y(()=>(this.#p=!1,gn(()=>this.#i(this.#t)))),this.#f>0?this.#b():this.#e=!1};var o=Nn;try{Fn(null),i=!0,t?.(e,a),i=!1}catch(e){ze(e,this.#a&&this.#a.parent)}finally{Fn(o)}n&&Le(()=>{this.#c=this.#y(()=>{qe.ensure(),this.#p=!0;try{return gn(()=>{n(this.#t,()=>e,()=>a)})}catch(e){return ze(e,this.#a.parent),null}finally{this.#p=!1}})})}};let at=null;function ot(e){at=e}function st(e,t){return t}function ct(e,t,n){for(var r=[],i=t.length,a=0;a{var a=r.length===0&&n!==null;if(a){var o=n,s=o.parentNode;Jt(s),s.append(o),e.items.clear(),pt(e,t[0].prev,t[i-1].next)}for(var c=0;c{var e=n();return u(e)?e:e==null?[]:f(e)}),_,v=!0;function y(){ut(x,_,o,t,r),h!==null&&(_.length===0?(h.fragment?(o.before(h.fragment),h.fragment=null):En(h.effect),b.first=h.effect):Cn(h.effect,()=>{h=null}))}var b=mn(()=>{_=G(g);var e=_.length;let l=!1;R&&Se(o)===`[!`!=(e===0)&&(o=xe(),ve(o),_e(!1),l=!0);for(var u=new Set,f=Ve,m=null,b=Yt(),x=0;xa(o))};else{var T=document.createDocumentFragment(),E=Wt();T.append(E),h={fragment:T,effect:gn(()=>a(E))}}if(R&&e>0&&ve(xe()),!v)if(b){for(let[e,t]of s)u.has(e)||f.skipped_effects.add(t.e);f.oncommit(y),f.ondiscard(()=>{})}else y();l&&_e(!0),G(g)}),x={effect:b,flags:t,items:s,first:c};v=!1,R&&(o=z)}function ut(e,t,n,r,i){var a=(r&8)!=0,o=t.length,s=e.items,c=e.first,l,u=null,d,p=[],m=[],h,g,_,v;if(a)for(v=0;vo;if(c!==null||l!==void 0){for(var T=l===void 0?[]:f(l);c!==null;)c.e.f&8192||T.push(c),c=c.next;var E=T.length;if(w=s.size-E>o,E>0){var D=r&4&&o===0?n:null;if(a){for(v=0;v{if(d!==void 0)for(_ of d)_.a?.apply()})}function dt(e,t,n,r,i,a,o,s){var c=at,l=(o&1)!=0,u=(o&16)==0,d=l?u?At(n,!1,!1):Ot(n):n,f=o&2?Ot(i):i,p={i:f,v:d,k:r,a:null,e:null,o:!1,prev:t,next:null};at=p;try{return e===null&&document.createDocumentFragment().append(e=Wt()),p.e=gn(()=>a(e,d,f,s)),t!==null&&(t.next=p),p}finally{at=c}}function ft(e,t,n){for(var r=e.next?e.next.e.nodes_start:n,i=t?t.e.nodes_start:n,a=e.e.nodes_start;a!==null&&a!==r;){var o=Kt(a);i.before(a),a=o}}function pt(e,t,n){t===null?(e.first=n,e.effect.first=n&&n.e):(t.e.next&&(t.e.next.prev=null),t.next=n,t.e.next=n&&n.e),n!==null&&(n.e.prev&&(n.e.prev.next=null),n.prev=t,n.e.prev=t&&t.e)}function mt(e,t,n,r){let i=Pe()?_t:bt;if(n.length===0&&e.length===0){r(t.map(i));return}var a=Ve,o=In,s=ht();function c(){Promise.all(n.map(e=>vt(e))).then(e=>{s();try{r([...t.map(i),...e])}catch(e){o.f&16384||ze(e,o)}a?.deactivate(),gt()}).catch(e=>{ze(e,o)})}e.length>0?Promise.all(e).then(()=>{s();try{return c()}finally{a?.deactivate(),gt()}}):c()}function ht(){var e=In,t=Nn,n=V,r=Ve;return function(i=!0){Ln(e),Fn(t),je(n),i&&r?.activate()}}function gt(){Ln(null),Fn(null),je(null)}function _t(e){var t=2|E,n=Nn!==null&&Nn.f&2?Nn:null;return In!==null&&(In.f|=A),{ctx:V,deps:null,effects:null,equals:Ce,f:t,fn:e,reactions:null,rv:0,v:pe,wv:0,parent:n??In,ac:null}}function vt(e,t){let n=In;n===null&&ne();var r=n.b,i=void 0,a=Ot(pe),o=!Nn,s=new Map;return dn(()=>{var t=C();i=t.promise;try{Promise.resolve(e()).then(t.resolve,t.reject).then(()=>{n===Ve&&n.committed&&n.deactivate(),gt()})}catch(e){t.reject(e),gt()}var n=Ve;if(o){var c=!r.is_pending();r.update_pending_count(1),n.increment(c),s.get(n)?.reject(L),s.delete(n),s.set(n,t)}let l=(e,t=void 0)=>{if(n.activate(),t)t!==L&&(a.f|=N,jt(a,t));else{a.f&8388608&&(a.f^=N),jt(a,e);for(let[e,t]of s){if(s.delete(e),e===n)break;t.reject(L)}}o&&(r.update_pending_count(-1),n.decrement(c))};t.promise.then(l,e=>l(null,e||`unknown`))}),an(()=>{for(let e of s.values())e.reject(L)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function yt(e){let t=_t(e);return zn(t),t}function bt(e){let t=_t(e);return t.equals=Te,t}function xt(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;n0&&!Dt&&Mt()}return t}function Mt(){Dt=!1;var e=kn;An(!0);let t=Array.from(Tt);try{for(let e of t)e.f&1024&&ar(e,D),Yn(e)&&er(e)}finally{An(e)}Tt.clear()}function Nt(e,t=1){var n=G(e),r=t===1?n++:n--;return H(e,n),r}function Pt(e){H(e,e.v+1)}function Ft(e,t){var n=e.reactions;if(n!==null)for(var r=Pe(),i=n.length,a=0;a{if(Kn===o)return e();var t=Nn,n=Kn;Fn(null),qn(o);var r=e();return Fn(t),qn(n),r};return r&&n.set(`length`,kt(e.length,a)),new Proxy(e,{defineProperty(e,t,r){(!(`value`in r)||r.configurable===!1||r.enumerable===!1||r.writable===!1)&&ce();var i=n.get(t);return i===void 0?i=s(()=>{var e=kt(r.value,a);return n.set(t,e),e}):H(i,r.value,!0),!0},deleteProperty(e,t){var r=n.get(t);if(r===void 0){if(t in e){let e=s(()=>kt(pe,a));n.set(t,e),Pt(i)}}else H(r,pe),Pt(i);return!0},get(t,r,i){if(r===P)return e;var o=n.get(r),c=r in t;if(o===void 0&&(!c||m(t,r)?.writable)&&(o=s(()=>kt(It(c?t[r]:pe),a)),n.set(r,o)),o!==void 0){var l=G(o);return l===pe?void 0:l}return Reflect.get(t,r,i)},getOwnPropertyDescriptor(e,t){var r=Reflect.getOwnPropertyDescriptor(e,t);if(r&&`value`in r){var i=n.get(t);i&&(r.value=G(i))}else if(r===void 0){var a=n.get(t),o=a?.v;if(a!==void 0&&o!==pe)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return r},has(e,t){if(t===P)return!0;var r=n.get(t),i=r!==void 0&&r.v!==pe||Reflect.has(e,t);return(r!==void 0||In!==null&&(!i||m(e,t)?.writable))&&(r===void 0&&(r=s(()=>kt(i?It(e[t]):pe,a)),n.set(t,r)),G(r)===pe)?!1:i},set(e,t,o,c){var l=n.get(t),u=t in e;if(r&&t===`length`)for(var d=o;dkt(pe,a)),n.set(d+``,f)):H(f,pe)}if(l===void 0)(!u||m(e,t)?.writable)&&(l=s(()=>kt(void 0,a)),H(l,It(o)),n.set(t,l));else{u=l.v!==pe;var p=s(()=>It(o));H(l,p)}var h=Reflect.getOwnPropertyDescriptor(e,t);if(h?.set&&h.set.call(c,o),!u){if(r&&typeof t==`string`){var g=n.get(`length`),_=Number(t);Number.isInteger(_)&&_>=g.v&&H(g,_+1)}Pt(i)}return!0},ownKeys(e){G(i);var t=Reflect.ownKeys(e).filter(e=>{var t=n.get(e);return t===void 0||t.v!==pe});for(var[r,a]of n)a.v!==pe&&!(r in e)&&t.push(r);return t},setPrototypeOf(){le()}})}function Lt(e){try{if(typeof e==`object`&&e&&P in e)return e[P]}catch{}return e}function Rt(e,t){return Object.is(Lt(e),Lt(t))}var zt,Bt,Vt,Ht;function Ut(){if(zt===void 0){zt=window,document,Bt=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;Vt=m(t,`firstChild`).get,Ht=m(t,`nextSibling`).get,y(e)&&(e.__click=void 0,e.__className=void 0,e.__attributes=null,e.__style=void 0,e.__e=void 0),y(n)&&(n.__t=void 0)}}function Wt(e=``){return document.createTextNode(e)}function Gt(e){return Vt.call(e)}function Kt(e){return Ht.call(e)}function U(e,t){if(!R)return Gt(e);var n=Gt(z);if(n===null)n=z.appendChild(Wt());else if(t&&n.nodeType!==3){var r=Wt();return n?.before(r),ve(r),r}return ve(n),n}function qt(e,t=!1){if(!R){var n=Gt(e);return n instanceof Comment&&n.data===``?Kt(n):n}if(t&&z?.nodeType!==3){var r=Wt();return z?.before(r),ve(r),r}return z}function W(e,t=1,n=!1){let r=R?z:e;for(var i;t--;)i=r,r=Kt(r);if(!R)return r;if(n&&r?.nodeType!==3){var a=Wt();return r===null?i?.after(a):r.before(a),ve(a),a}return ve(r),r}function Jt(e){e.textContent=``}function Yt(){return!1}function Xt(e,t){if(t){let t=document.body;e.autofocus=!0,Le(()=>{document.activeElement===t&&e.focus()})}}var Zt=!1;function Qt(){Zt||(Zt=!0,document.addEventListener(`reset`,e=>{Promise.resolve().then(()=>{if(!e.defaultPrevented)for(let t of e.target.elements)t.__on_r?.()})},{capture:!0}))}function $t(e){var t=Nn,n=In;Fn(null),Ln(null);try{return e()}finally{Fn(t),Ln(n)}}function en(e){In===null&&(Nn===null&&ae(e),ie()),jn&&re(e)}function tn(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function nn(e,t,n){var r=In;r!==null&&r.f&8192&&(e|=O);var i={ctx:V,deps:null,nodes_start:null,nodes_end:null,f:e|2560,first:null,fn:t,last:null,next:null,parent:r,b:r&&r.b,prev:null,teardown:null,transitions:null,wv:0,ac:null};if(n)try{er(i),i.f|=32768}catch(e){throw bn(i),e}else t!==null&&et(i);var a=i;if(n&&a.deps===null&&a.teardown===null&&a.nodes_start===null&&a.first===a.last&&!(a.f&524288)&&(a=a.first,e&16&&e&65536&&a!==null&&(a.f|=k)),a!==null&&(a.parent=r,r!==null&&tn(a,r),Nn!==null&&Nn.f&2&&!(e&64))){var o=Nn;(o.effects??=[]).push(a)}return i}function rn(){return Nn!==null&&!Pn}function an(e){let t=nn(8,null,!1);return ar(t,T),t.teardown=e,t}function on(e){en(`$effect`);var t=In.f;if(!Nn&&t&32&&!(t&32768)){var n=V;(n.e??=[]).push(e)}else return sn(e)}function sn(e){return nn(4|j,e,!1)}function cn(e){return en(`$effect.pre`),nn(8|j,e,!0)}function ln(e){qe.ensure();let t=nn(64|A,e,!0);return(e={})=>new Promise(n=>{e.outro?Cn(t,()=>{bn(t),n(void 0)}):(bn(t),n(void 0))})}function un(e){return nn(4,e,!1)}function dn(e){return nn(4194304|A,e,!0)}function fn(e,t=0){return nn(8|t,e,!0)}function pn(e,t=[],n=[],r=[]){mt(r,t,n,t=>{nn(8,()=>e(...t.map(G)),!0)})}function mn(e,t=0){return nn(16|t,e,!0)}function hn(e,t=0){return nn(16777216|t,e,!0)}function gn(e){return nn(32|A,e,!0)}function _n(e){var t=e.teardown;if(t!==null){let e=jn,n=Nn;Mn(!0),Fn(null);try{t.call(null)}finally{Mn(e),Fn(n)}}}function vn(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&$t(()=>{e.abort(L)});var r=n.next;n.f&64?n.parent=null:bn(n,t),n=r}}function yn(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||bn(t),t=n}}function bn(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes_start!==null&&e.nodes_end!==null&&(xn(e.nodes_start,e.nodes_end),n=!0),vn(e,t&&!n),$n(e,0),ar(e,16384);var r=e.transitions;if(r!==null)for(let e of r)e.stop();_n(e);var i=e.parent;i!==null&&i.first!==null&&Sn(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=e.ac=null}function xn(e,t){for(;e!==null;){var n=e===t?null:Kt(e);e.remove(),e=n}}function Sn(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Cn(e,t,n=!0){var r=[];Tn(e,r,!0),wn(r,()=>{n&&bn(e),t&&t()})}function wn(e,t){var n=e.length;if(n>0){var r=()=>--n||t();for(var i of e)i.out(r)}else t()}function Tn(e,t,n){if(!(e.f&8192)){if(e.f^=O,e.transitions!==null)for(let r of e.transitions)(r.is_global||n)&&t.push(r);for(var r=e.first;r!==null;){var i=r.next,a=(r.f&65536)!=0||(r.f&32)!=0&&(e.f&16)!=0;Tn(r,t,a?n:!1),r=i}}}function En(e){Dn(e,!0)}function Dn(e,t){if(e.f&8192){e.f^=O,e.f&1024||(ar(e,E),et(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&65536)!=0||(n.f&32)!=0;Dn(n,i?t:!1),n=r}if(e.transitions!==null)for(let n of e.transitions)(n.is_global||t)&&n.in()}}function On(e,t){for(var n=e.nodes_start,r=e.nodes_end;n!==null;){var i=n===r?null:Kt(n);t.append(n),n=i}}let kn=!1;function An(e){kn=e}let jn=!1;function Mn(e){jn=e}let Nn=null,Pn=!1;function Fn(e){Nn=e}let In=null;function Ln(e){In=e}let Rn=null;function zn(e){Nn!==null&&(Rn===null?Rn=[e]:Rn.push(e))}var Bn=null,Vn=0;let Hn=null;function Un(e){Hn=e}let Wn=1;var Gn=0;let Kn=Gn;function qn(e){Kn=e}function Jn(){return++Wn}function Yn(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~M),t&4096){var n=e.deps;if(n!==null)for(var r=n.length,i=0;ie.wv)return!0}t&512&&He===null&&ar(e,T)}return!1}function Xn(e,t,n=!0){var r=e.reactions;if(r!==null&&!Rn?.includes(e))for(var i=0;i{e.ac.abort(L)}),e.ac=null);try{e.f|=ee;var u=e.fn,d=u(),f=e.deps;if(Bn!==null){var p;if($n(e,Vn),f!==null&&Vn>0)for(f.length=Vn+Bn.length,p=0;pn?.call(this,e))}return e.startsWith(`pointer`)||e.startsWith(`touch`)||e===`wheel`?Le(()=>{t.addEventListener(e,i,r)}):t.addEventListener(e,i,r),i}function xr(e,t,n,r,i){var a={capture:r,passive:i},o=br(e,t,n,a);(t===document.body||t===window||t===document||t instanceof HTMLMediaElement)&&an(()=>{t.removeEventListener(e,o,a)})}function Sr(e){for(var t=0;t{throw e});throw f}}finally{e.__root=t,delete e.currentTarget,Fn(u),Ln(d)}}}function Tr(e){var t=document.createElement(`template`);return t.innerHTML=e.replaceAll(``,``),t.content}function Er(e,t){var n=In;n.nodes_start===null&&(n.nodes_start=e,n.nodes_end=t)}function Dr(e,t){var n=(t&1)!=0,r=(t&2)!=0,i,a=!e.startsWith(``);return()=>{if(R)return Er(z,null),z;i===void 0&&(i=Tr(a?e:``+e),n||(i=Gt(i)));var t=r||Bt?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=Gt(t),s=t.lastChild;Er(o,s)}else Er(t,t);return t}}function Or(e,t,n=`svg`){var r=!e.startsWith(``),i=(t&1)!=0,a=`<${n}>${r?e:``+e}`,o;return()=>{if(R)return Er(z,null),z;if(!o){var e=Gt(Tr(a));if(i)for(o=document.createDocumentFragment();Gt(e);)o.appendChild(Gt(e));else o=Gt(e)}var t=o.cloneNode(!0);if(i){var n=Gt(t),r=t.lastChild;Er(n,r)}else Er(t,t);return t}}function kr(e,t){return Or(e,t,`svg`)}function Ar(){if(R)return Er(z,null),z;var e=document.createDocumentFragment(),t=document.createComment(``),n=Wt();return e.append(t,n),Er(t,n),e}function jr(e,t){if(R){var n=In;(!(n.f&32768)||n.nodes_end===null)&&(n.nodes_end=z),ye();return}e!==null&&e.before(t)}function Mr(e,t){var n=t==null?``:typeof t==`object`?t+``:t;n!==(e.__t??=e.nodeValue)&&(e.__t=n,e.nodeValue=n+``)}function Nr(e,t){return Fr(e,t)}var Pr=new Map;function Fr(e,{target:t,anchor:n,props:r={},events:i,context:a,intro:o=!0}){Ut();var s=new Set,c=e=>{for(var n=0;n{var o=n??t.appendChild(Wt());return rt(o,{pending:()=>{}},t=>{if(a){Me({});var n=V;n.c=a}if(i&&(r.$$events=i),R&&Er(t,null),l=e(t,r)||{},R&&(In.nodes_end=z,z===null||z.nodeType!==8||z.data!==`]`))throw me(),fe;a&&Ne()}),()=>{for(var e of s){t.removeEventListener(e,wr);var r=Pr.get(e);--r===0?(document.removeEventListener(e,wr),Pr.delete(e)):Pr.set(e,r)}yr.delete(c),o!==n&&o.parentNode?.removeChild(o)}});return Ir.set(l,u),l}var Ir=new WeakMap,Lr=class{anchor;#e=new Map;#t=new Map;#n=new Map;#r=new Set;#i=!0;constructor(e,t=!0){this.anchor=e,this.#i=t}#a=()=>{var e=Ve;if(this.#e.has(e)){var t=this.#e.get(e),n=this.#t.get(t);if(n)En(n),this.#r.delete(t);else{var r=this.#n.get(t);r&&(this.#t.set(t,r.effect),this.#n.delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of this.#e){if(this.#e.delete(t),t===e)break;let r=this.#n.get(n);r&&(bn(r.effect),this.#n.delete(n))}for(let[e,r]of this.#t){if(e===t||this.#r.has(e))continue;let i=()=>{if(Array.from(this.#e.values()).includes(e)){var t=document.createDocumentFragment();On(r,t),t.append(Wt()),this.#n.set(e,{effect:r,fragment:t})}else bn(r);this.#r.delete(e),this.#t.delete(e)};this.#i||!n?(this.#r.add(e),Cn(r,i,!1)):i()}}};#o=e=>{this.#e.delete(e);let t=Array.from(this.#e.values());for(let[e,n]of this.#n)t.includes(e)||(bn(n.effect),this.#n.delete(e))};ensure(e,t){var n=Ve,r=Yt();if(t&&!this.#t.has(e)&&!this.#n.has(e))if(r){var i=document.createDocumentFragment(),a=Wt();i.append(a),this.#n.set(e,{effect:gn(()=>t(a)),fragment:i})}else this.#t.set(e,gn(()=>t(this.anchor)));if(this.#e.set(n,e),r){for(let[t,r]of this.#t)t===e?n.skipped_effects.delete(r):n.skipped_effects.add(r);for(let[t,r]of this.#n)t===e?n.skipped_effects.delete(r.effect):n.skipped_effects.add(r.effect);n.oncommit(this.#a),n.ondiscard(this.#o)}else R&&(this.anchor=z),this.#a()}};function Rr(e,t,n=!1){R&&ye();var r=new Lr(e),i=n?k:0;function a(t,n){if(R&&t===(Se(e)===`[!`)){var i=xe();ve(i),r.anchor=i,_e(!1),r.ensure(t,n),_e(!0);return}r.ensure(t,n)}mn(()=>{var e=!1;t((t,n=!0)=>{e=!0,a(n,t)}),e||a(!1,null)},i)}function zr(e,t,n=!1,r=!1,i=!1){var a=e,o=``;pn(()=>{var e=In;if(o===(o=t()??``)){R&&ye();return}if(e.nodes_start!==null&&(xn(e.nodes_start,e.nodes_end),e.nodes_start=e.nodes_end=null),o!==``){if(R){for(var i=z.data,s=ye(),c=s;s!==null&&(s.nodeType!==8||s.data!==``);)c=s,s=Kt(s);if(s===null)throw me(),fe;Er(z,c),a=ve(s);return}var l=o+``;n?l=`${l}`:r&&(l=`${l}`);var u=Tr(l);if((n||r)&&(u=Gt(u)),Er(Gt(u),u.lastChild),n||r)for(;Gt(u);)a.before(Gt(u));else a.before(u)}})}function Br(e,t,n,r,i){R&&ye();var a=t.$$slots?.[n],o=!1;a===!0&&(a=t[n===`default`?`children`:n],o=!0),a===void 0?i!==null&&i(e):a(e,o?()=>r:r)}function Vr(e,t,n,r,i,a){let o=R;R&&ye();var s=null;R&&z.nodeType===1&&(s=z,ye());var c=R?z:e,l=at,u=new Lr(c,!1);mn(()=>{let e=t()||null;var a=i?i():n||e===`svg`?`http://www.w3.org/2000/svg`:null;if(e===null){u.ensure(null,null);return}return u.ensure(e,t=>{var n=at;if(ot(l),e){if(s=R?s:a?document.createElementNS(a,e):document.createElement(e),Er(s,s),r){R&&_r(e)&&s.append(document.createComment(``));var i=R?Gt(s):s.appendChild(Wt());R&&(i===null?_e(!1):ve(i)),r(s,i)}In.nodes_end=s,t.before(s)}ot(n),R&&ve(t)}),()=>{}},k),an(()=>{}),o&&(_e(!0),ve(c))}function Hr(e,t){let n=null,r=R;var i;if(R){n=z;for(var a=Gt(document.head);a!==null&&(a.nodeType!==8||a.data!==e);)a=Kt(a);if(a===null)_e(!1);else{var o=Kt(a);a.remove(),ve(o)}}R||(i=document.head.appendChild(Wt()));try{mn(()=>t(i),262144)}finally{r&&(_e(!0),ve(n))}}function Ur(e,t){var n=void 0,r;hn(()=>{n!==(n=t())&&(r&&=(bn(r),null),n&&(r=gn(()=>{un(()=>n(e))})))})}function Wr(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t=0;){var s=o+a;(o===0||qr.includes(r[o-1]))&&(s===r.length||qr.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function Yr(e,t=!1){var n=t?` !important;`:`;`,r=``;for(var i in e){var a=e[i];a!=null&&a!==``&&(r+=` `+i+`: `+a+n)}return r}function Xr(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function Zr(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(Xr)),i&&c.push(...Object.keys(i).map(Xr));var l=0,u=-1;let t=e.length;for(var d=0;d{ti(e,e.__value)});t.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`value`]}),an(()=>{t.disconnect()})}function ri(e){return`__value`in e?e.__value:e.value}const ii=Symbol(`class`),ai=Symbol(`style`);var oi=Symbol(`is custom element`),si=Symbol(`is html`);function ci(e){if(R){var t=!1,n=()=>{if(!t){if(t=!0,e.hasAttribute(`value`)){var n=e.value;di(e,`value`,null),e.value=n}if(e.hasAttribute(`checked`)){var r=e.checked;di(e,`checked`,null),e.checked=r}}};e.__on_r=n,Le(n),Qt()}}function li(e,t){var n=mi(e);n.value===(n.value=t??void 0)||e.value===t&&(t!==0||e.nodeName!==`PROGRESS`)||(e.value=t??``)}function ui(e,t){t?e.hasAttribute(`selected`)||e.setAttribute(`selected`,``):e.removeAttribute(`selected`)}function di(e,t,n,r){var i=mi(e);R&&(i[t]=e.getAttribute(t),t===`src`||t===`srcset`||t===`href`&&e.nodeName===`LINK`)||i[t]!==(i[t]=n)&&(t===`loading`&&(e[I]=n),n==null?e.removeAttribute(t):typeof n!=`string`&&gi(e).includes(t)?e[t]=n:e.setAttribute(t,n))}function fi(e,t,n,r,i=!1,a=!1){if(R&&i&&e.tagName===`INPUT`){var o=e;(o.type===`checkbox`?`defaultChecked`:`defaultValue`)in n||ci(o)}var s=mi(e),c=s[oi],l=!s[si];let u=R&&c;u&&_e(!1);var d=t||{},f=e.tagName===`OPTION`;for(var p in t)p in n||(n[p]=null);n.class?n.class=Kr(n.class):(r||n[ii])&&(n.class=null),n[ai]&&(n.style??=null);var m=gi(e);for(let i in n){let o=n[i];if(f&&i===`value`&&o==null){e.value=e.__value=``,d[i]=o;continue}if(i===`class`){Qr(e,e.namespaceURI===`http://www.w3.org/1999/xhtml`,o,r,t?.[ii],n[ii]),d[i]=o,d[ii]=n[ii];continue}if(i===`style`){ei(e,o,t?.[ai],n[ai]),d[i]=o,d[ai]=n[ai];continue}var h=d[i];if(!(o===h&&!(o===void 0&&e.hasAttribute(i)))){d[i]=o;var g=i[0]+i[1];if(g!==`$$`)if(g===`on`){let t={},n=`$$`+i,r=i.slice(2);var _=ur(r);if(cr(r)&&(r=r.slice(0,-7),t.capture=!0),!_&&h){if(o!=null)continue;e.removeEventListener(r,d[n],t),d[n]=null}if(o!=null)if(_)e[`__${r}`]=o,Sr([r]);else{function a(e){d[i].call(this,e)}d[n]=br(r,e,a,t)}else _&&(e[`__${r}`]=void 0)}else if(i===`style`)di(e,i,o);else if(i===`autofocus`)Xt(e,!!o);else if(!c&&(i===`__value`||i===`value`&&o!=null))e.value=e.__value=o;else if(i===`selected`&&f)ui(e,o);else{var v=i;l||(v=pr(v));var y=v===`defaultValue`||v===`defaultChecked`;if(o==null&&!c&&!y)if(s[i]=null,v===`value`||v===`checked`){let n=e,r=t===void 0;if(v===`value`){let e=n.defaultValue;n.removeAttribute(v),n.defaultValue=e,n.value=n.__value=r?e:null}else{let e=n.defaultChecked;n.removeAttribute(v),n.defaultChecked=e,n.checked=r?e:!1}}else e.removeAttribute(i);else y||m.includes(v)&&(c||typeof o!=`string`)?(e[v]=o,v in s&&(s[v]=pe)):typeof o!=`function`&&di(e,v,o,a)}}}return u&&_e(!0),d}function pi(e,t,n=[],r=[],i=[],a,o=!1,s=!1){mt(i,n,r,n=>{var r=void 0,i={},c=e.nodeName===`SELECT`,l=!1;if(hn(()=>{var u=t(...n.map(G)),d=fi(e,r,u,a,o,s);l&&c&&`value`in u&&ti(e,u.value);for(let e of Object.getOwnPropertySymbols(i))u[e]||bn(i[e]);for(let t of Object.getOwnPropertySymbols(u)){var f=u[t];t.description===`@attach`&&(!r||f!==r[t])&&(i[t]&&bn(i[t]),i[t]=gn(()=>Ur(e,()=>f))),d[t]=f}r=d}),c){var u=e;un(()=>{ti(u,r.value,!0),ni(u)})}l=!0})}function mi(e){return e.__attributes??={[oi]:e.nodeName.includes(`-`),[si]:e.namespaceURI===`http://www.w3.org/1999/xhtml`}}var hi=new Map;function gi(e){var t=e.getAttribute(`is`)||e.nodeName,n=hi.get(t);if(n)return n;hi.set(t,n=[]);for(var r,i=e,a=Element.prototype;a!==i;){for(var o in r=h(i),r)r[o].set&&n.push(o);i=v(i)}return n}function _i(e,t){return e===t||e?.[P]===t}function vi(e={},t,n,r){return un(()=>{var i,a;return fn(()=>{i=a,a=r?.()||[],rr(()=>{e!==n(...a)&&(t(e,...a),i&&_i(n(...i),e)&&t(null,...i))})}),()=>{Le(()=>{a&&_i(n(...a),e)&&t(null,...a)})}}),e}function yi(e=!1){let t=V,n=t.l.u;if(!n)return;let r=()=>or(t.s);if(e){let e=0,n={},i=_t(()=>{let r=!1,i=t.s;for(let e in i)i[e]!==n[e]&&(n[e]=i[e],r=!0);return r&&e++,e});r=()=>G(i)}n.b.length&&cn(()=>{bi(t,r),S(n.b)}),on(()=>{let e=rr(()=>n.m.map(x));return()=>{for(let t of e)typeof t==`function`&&t()}}),n.a.length&&on(()=>{bi(t,r),S(n.a)})}function bi(e,t){if(e.l.s)for(let t of e.l.s)G(t);t()}var xi=!1;function Si(e){var t=xi;try{return xi=!1,[e(),xi]}finally{xi=t}}var Ci={get(e,t){if(!e.exclude.includes(t))return G(e.version),t in e.special?e.special[t]():e.props[t]},set(e,t,n){if(!(t in e.special)){var r=In;try{Ln(e.parent_effect),e.special[t]=Di({get[t](){return e.props[t]}},t,4)}finally{Ln(r)}}return e.special[t](n),Nt(e.version),!0},getOwnPropertyDescriptor(e,t){if(!e.exclude.includes(t)&&t in e.props)return{enumerable:!0,configurable:!0,value:e.props[t]}},deleteProperty(e,t){return e.exclude.includes(t)?!0:(e.exclude.push(t),Nt(e.version),!0)},has(e,t){return e.exclude.includes(t)?!1:t in e.props},ownKeys(e){return Reflect.ownKeys(e.props).filter(t=>!e.exclude.includes(t))}};function wi(e,t){return new Proxy({props:e,exclude:t,special:{},version:Ot(0),parent_effect:In},Ci)}var Ti={get(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(b(r)&&(r=r()),typeof r==`object`&&r&&t in r)return r[t]}},set(e,t,n){let r=e.props.length;for(;r--;){let i=e.props[r];b(i)&&(i=i());let a=m(i,t);if(a&&a.set)return a.set(n),!0}return!1},getOwnPropertyDescriptor(e,t){let n=e.props.length;for(;n--;){let r=e.props[n];if(b(r)&&(r=r()),typeof r==`object`&&r&&t in r){let e=m(r,t);return e&&!e.configurable&&(e.configurable=!0),e}}},has(e,t){if(t===P||t===F)return!1;for(let n of e.props)if(b(n)&&(n=n()),n!=null&&t in n)return!0;return!1},ownKeys(e){let t=[];for(let n of e.props)if(b(n)&&(n=n()),n){for(let e in n)t.includes(e)||t.push(e);for(let e of Object.getOwnPropertySymbols(n))t.includes(e)||t.push(e)}return t}};function Ei(...e){return new Proxy({props:e},Ti)}function Di(e,t,n,r){var i=!Ee||(n&2)!=0,a=(n&8)!=0,o=(n&16)!=0,s=r,c=!0,l=()=>(c&&(c=!1,s=o?rr(r):r),s),u;if(a){var d=P in e||F in e;u=m(e,t)?.set??(d&&t in e?n=>e[t]=n:void 0)}var f,p=!1;a?[f,p]=Si(()=>e[t]):f=e[t],f===void 0&&r!==void 0&&(f=l(),u&&(i&&se(t),u(f)));var h=i?()=>{var n=e[t];return n===void 0?l():(c=!0,n)}:()=>{var n=e[t];return n!==void 0&&(s=void 0),n===void 0?s:n};if(i&&!(n&4))return h;if(u){var g=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||g||p)&&u(t?h():e),e):h()})}var _=!1,v=(n&1?_t:bt)(()=>(_=!1,h()));a&&G(v);var y=In;return(function(e,t){if(arguments.length>0){let n=t?G(v):i&&a?It(e):e;return H(v,n),_=!0,s!==void 0&&(s=n),e}return jn&&_||y.f&16384?v.v:G(v)})}function Oi(e){V===null&&te(`onMount`),Ee&&V.l!==null?Ai(V).m.push(e):on(()=>{let t=rr(e);if(typeof t==`function`)return t})}function ki(e){V===null&&te(`onDestroy`),Oi(()=>()=>rr(e))}function Ai(e){var t=e.l;return t.u??={a:[],b:[],m:[]}}typeof window<`u`&&((window.__svelte??={}).v??=new Set).add(`5`),De();var ji={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":2,"stroke-linecap":`round`,"stroke-linejoin":`round`},Mi=kr(``);function Ni(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=wi(n,[`name`,`color`,`size`,`strokeWidth`,`absoluteStrokeWidth`,`iconNode`]);Me(t,!1);let i=Di(t,`name`,8,void 0),a=Di(t,`color`,8,`currentColor`),o=Di(t,`size`,8,24),s=Di(t,`strokeWidth`,8,2),c=Di(t,`absoluteStrokeWidth`,8,!1),l=Di(t,`iconNode`,24,()=>[]),u=(...e)=>e.filter((e,t,n)=>!!e&&n.indexOf(e)===t).join(` `);yi();var d=Mi();pi(d,(e,t)=>({...ji,...r,width:o(),height:o(),stroke:a(),"stroke-width":e,class:t}),[()=>(or(c()),or(s()),or(o()),rr(()=>c()?Number(s())*24/Number(o()):s())),()=>(or(i()),or(n),rr(()=>u(`lucide-icon`,`lucide`,i()?`lucide-${i()}`:``,n.class)))]);var f=U(d);lt(f,1,l,st,(e,t)=>{var n=yt(()=>w(G(t),2));let r=()=>G(n)[0],i=()=>G(n)[1];var a=Ar();Vr(qt(a),r,!0,(e,t)=>{pi(e,()=>({...i()}))}),jr(e,a)}),Br(W(f),t,`default`,{},null),B(d),jr(e,d),Ne()}function Pi(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`path`,{d:`m16 18 6-6-6-6`}],[`path`,{d:`m8 6-6 6 6 6`}]];Ni(e,Ei({name:`code`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function Fi(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`path`,{d:`M14 3a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`}],[`path`,{d:`M19 3a1 1 0 0 1 1 1v5a1 1 0 0 1-1 1`}],[`path`,{d:`m7 15 3 3`}],[`path`,{d:`m7 21 3-3H5a2 2 0 0 1-2-2v-2`}],[`rect`,{x:`14`,y:`14`,width:`7`,height:`7`,rx:`1`}],[`rect`,{x:`3`,y:`3`,width:`7`,height:`7`,rx:`1`}]];Ni(e,Ei({name:`combine`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function Ii(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`path`,{d:`M12 15V3`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}],[`path`,{d:`m7 10 5 5 5-5`}]];Ni(e,Ei({name:`download`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function Li(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`}],[`path`,{d:`m2 2 20 20`}]];Ni(e,Ei({name:`eye-off`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function Ri(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`}]];Ni(e,Ei({name:`eye`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function zi(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`circle`,{cx:`12`,cy:`12`,r:`10`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`}],[`path`,{d:`M2 12h20`}]];Ni(e,Ei({name:`globe`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function Bi(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}],[`path`,{d:`M3 9h18`}],[`path`,{d:`M3 15h18`}],[`path`,{d:`M9 3v18`}],[`path`,{d:`M15 3v18`}]];Ni(e,Ei({name:`grid-3x3`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function Vi(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`}],[`circle`,{cx:`9`,cy:`9`,r:`2`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`}]];Ni(e,Ei({name:`image`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function Hi(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`}]];Ni(e,Ei({name:`layers`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function Ui(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}],[`path`,{d:`M7 11V7a5 5 0 0 1 9.9-1`}]];Ni(e,Ei({name:`lock-open`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function Wi(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`rect`,{width:`18`,height:`11`,x:`3`,y:`11`,rx:`2`,ry:`2`}],[`path`,{d:`M7 11V7a5 5 0 0 1 10 0v4`}]];Ni(e,Ei({name:`lock`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function Gi(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`path`,{d:`M9 18V5l12-2v13`}],[`circle`,{cx:`6`,cy:`18`,r:`3`}],[`circle`,{cx:`18`,cy:`16`,r:`3`}]];Ni(e,Ei({name:`music`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function Ki(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`path`,{d:`m14.622 17.897-10.68-2.913`}],[`path`,{d:`M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z`}],[`path`,{d:`M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15`}]];Ni(e,Ei({name:`paintbrush`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function qi(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`path`,{d:`M12 22a1 1 0 0 1 0-20 10 9 0 0 1 10 9 5 5 0 0 1-5 5h-2.25a1.75 1.75 0 0 0-1.4 2.8l.3.4a1.75 1.75 0 0 1-1.4 2.8z`}],[`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`}],[`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`}],[`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`}],[`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`}]];Ni(e,Ei({name:`palette`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function Ji(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`}]];Ni(e,Ei({name:`square`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function Yi(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`path`,{d:`M10 11v6`}],[`path`,{d:`M14 11v6`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`}],[`path`,{d:`M3 6h18`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`}]];Ni(e,Ei({name:`trash-2`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function Xi(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`path`,{d:`M12 4v16`}],[`path`,{d:`M4 7V5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2`}],[`path`,{d:`M9 20h6`}]];Ni(e,Ei({name:`type`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function Zi(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`path`,{d:`M12 3v12`}],[`path`,{d:`m17 8-5-5-5 5`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`}]];Ni(e,Ei({name:`upload`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function Qi(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`path`,{d:`m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5`}],[`rect`,{x:`2`,y:`6`,width:`14`,height:`12`,rx:`2`}]];Ni(e,Ei({name:`video`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function $i(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`path`,{d:`M18 6 6 18`}],[`path`,{d:`m6 6 12 12`}]];Ni(e,Ei({name:`x`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}function ea(e,t){let n=wi(t,[`children`,`$$slots`,`$$events`,`$$legacy`]),r=[[`circle`,{cx:`11`,cy:`11`,r:`8`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`}]];Ni(e,Ei({name:`zoom-in`},()=>n,{get iconNode(){return r},children:(e,n)=>{var r=Ar();Br(qt(r),t,`default`,{},null),jr(e,r)},$$slots:{default:!0}}))}var ta=[`forEach`,`isDisjointFrom`,`isSubsetOf`,`isSupersetOf`],na=[`difference`,`intersection`,`symmetricDifference`,`union`],ra=!1,ia=class e extends Set{#e=new Map;#t=kt(0);#n=kt(0);#r=Kn||-1;constructor(e){if(super(),e){for(var t of e)super.add(t);this.#n.v=super.size}ra||this.#a()}#i(e){return Kn===this.#r?kt(e):Ot(e)}#a(){ra=!0;var t=e.prototype,n=Set.prototype;for(let e of ta)t[e]=function(...t){return G(this.#t),n[e].apply(this,t)};for(let r of na)t[r]=function(...t){return G(this.#t),new e(n[r].apply(this,t))}}has(e){var t=super.has(e),n=this.#e,r=n.get(e);if(r===void 0){if(!t)return G(this.#t),!1;r=this.#i(!0),n.set(e,r)}return G(r),t}add(e){return super.has(e)||(super.add(e),H(this.#n,super.size),Pt(this.#t)),this}delete(e){var t=super.delete(e),n=this.#e,r=n.get(e);return r!==void 0&&(n.delete(e),H(r,!1)),t&&(H(this.#n,super.size),Pt(this.#t)),t}clear(){if(super.size!==0){super.clear();var e=this.#e;for(var t of e.values())H(t,!1);e.clear(),H(this.#n,0),Pt(this.#t)}}keys(){return this.values()}values(){return G(this.#t),super.values()}entries(){return G(this.#t),super.entries()}[Symbol.iterator](){return this.keys()}get size(){return G(this.#n)}},aa=class extends Map{#e=new Map;#t=kt(0);#n=kt(0);#r=Kn||-1;constructor(e){if(super(),e){for(var[t,n]of e)super.set(t,n);this.#n.v=super.size}}#i(e){return Kn===this.#r?kt(e):Ot(e)}has(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.get(e)!==void 0)n=this.#i(0),t.set(e,n);else return G(this.#t),!1;return G(n),!0}forEach(e,t){this.#a(),super.forEach(e,t)}get(e){var t=this.#e,n=t.get(e);if(n===void 0)if(super.get(e)!==void 0)n=this.#i(0),t.set(e,n);else{G(this.#t);return}return G(n),super.get(e)}set(e,t){var n=this.#e,r=n.get(e),i=super.get(e),a=super.set(e,t),o=this.#t;if(r===void 0)r=this.#i(0),n.set(e,r),H(this.#n,super.size),Pt(o);else if(i!==t){Pt(r);var s=o.reactions===null?null:new Set(o.reactions);(s===null||!r.reactions?.every(e=>s.has(e)))&&Pt(o)}return a}delete(e){var t=this.#e,n=t.get(e),r=super.delete(e);return n!==void 0&&(t.delete(e),H(this.#n,super.size),H(n,-1),Pt(this.#t)),r}clear(){if(super.size!==0){super.clear();var e=this.#e;H(this.#n,0);for(var t of e.values())H(t,-1);Pt(this.#t),e.clear()}}#a(){G(this.#t);var e=this.#e;if(this.#n.v!==e.size){for(var t of super.keys())if(!e.has(t)){var n=this.#i(0);e.set(t,n)}}for([,n]of this.#e)G(n)}keys(){return G(this.#t),super.keys()}values(){return this.#a(),super.values()}entries(){return this.#a(),super.entries()}[Symbol.iterator](){return this.entries()}get size(){return G(this.#n),super.size}};URLSearchParams,Symbol.iterator;var oa=`buboard`,sa=1,ca=`state`,la=`buboard`,ua=`* { + box-sizing: border-box; + margin: 0; + padding: 0; +} + +html, body { + width: 100%; + height: 100%; +} + +body { + font-family: 'Departure Mono', monospace; + color: #fff; + overflow: hidden; +}`,da=`:root { + /* Theme */ + --bg: #1a1a1a; + --surface: #282c34; + --border: #333; + --accent: #4a9eff; + --text: #fff; + --text-dim: #666; + + /* Syntax */ + --cm-keyword: #c678dd; + --cm-variable: #e06c75; + --cm-function: #61afef; + --cm-string: #98c379; + --cm-comment: #7d8799; + --cm-number: #d19a66; + --cm-operator: #56b6c2; +}`;function fa(){return new Promise((e,t)=>{let n=indexedDB.open(oa,sa);n.onerror=()=>t(n.error),n.onsuccess=()=>e(n.result),n.onupgradeneeded=()=>{n.result.createObjectStore(ca)}})}function pa(){let e=kt(It({version:1,items:[],sharedCss:ua,appCss:da,flags:{}})),t=kt(It({})),n=kt(It({x:0,y:0,zoom:1})),r=kt(It(new ia)),i=kt(null),a=kt(!1),o=kt(null),s=kt(It([])),c=kt(!1),l=kt(!1),u=kt(null),d=null,f=null,p=yt(()=>G(e).items.length>0?Math.max(...G(e).items.map(e=>e.zIndex)):0);async function m(){d&&=(clearTimeout(d),null);try{let n={};for(let[e,r]of Object.entries(G(t)))n[e]={blob:r.blob,filename:r.filename};let r=await fa(),i=r.transaction(ca,`readwrite`),a=i.objectStore(ca);a.put(ke(G(e)),`manifest`),a.put(n,`assets`),await new Promise((e,t)=>{i.oncomplete=()=>e(),i.onerror=()=>t(i.error)}),r.close(),H(u,null)}catch(e){throw H(u,e instanceof Error?e.message:`Failed to save`,!0),e}}function h(){d&&clearTimeout(d),d=setTimeout(()=>{m()},500)}async function g(){try{let n=await fa(),{manifest:r,assets:i}=await(()=>new Promise(e=>{let t=n.transaction(ca,`readonly`),r=t.objectStore(ca),i=r.get(`manifest`),a=r.get(`assets`);t.oncomplete=()=>{e({manifest:i.result??null,assets:a.result??null})},t.onerror=()=>e({manifest:null,assets:null})}))();if(n.close(),r&&r.version===1){let n={};if(i)for(let[e,t]of Object.entries(i)){let r=URL.createObjectURL(t.blob);n[e]={blob:t.blob,url:r,filename:t.filename}}for(let e of r.items)if(e.assetId&&n[e.assetId]){let t=n[e.assetId].url;e.html=e.html.replace(/src="[^"]*"/g,`src="${t}"`)}H(e,{...r,flags:r.flags??{}},!0),H(t,n,!0);return}}catch(e){console.error(`Failed to restore from IndexedDB:`,e)}try{let n=localStorage.getItem(la);if(!n)return;let r=JSON.parse(n);if(r.manifest.version!==1)return;let i={};for(let[e,t]of Object.entries(r.assets)){let n=await(await fetch(t.dataUrl)).blob();i[e]={blob:n,url:URL.createObjectURL(n),filename:t.filename}}for(let e of r.manifest.items)if(e.assetId&&i[e.assetId]){let t=i[e.assetId].url;e.html=e.html.replace(/src="[^"]*"/g,`src="${t}"`)}H(e,{...r.manifest,flags:r.manifest.flags??{}},!0),H(t,i,!0),await m(),localStorage.removeItem(la)}catch(e){console.error(`Failed to migrate from localStorage:`,e)}}function _(t){G(e).items.push(t),h()}function v(t,n){let r=G(e).items.find(e=>e.id===t);r&&(Object.assign(r,n),h())}function y(n){let a=G(e).items.findIndex(e=>e.id===n);if(a===-1)return;let o=G(e).items[a];o.assetId&&G(t)[o.assetId]&&(URL.revokeObjectURL(G(t)[o.assetId].url),delete G(t)[o.assetId]),G(e).items.splice(a,1),G(r).delete(n),G(i)===n&&H(i,null),h()}function b(e,n){G(t)[e]=n,h()}function x(t){G(e).items.push(...t),h()}function S(e){Object.assign(G(t),e),h()}async function C(n,r){Object.assign(G(t),n),G(e).items.push(...r),await m()}function w(t){return G(e).items.find(e=>e.id===t)}function T(e){H(r,new ia(e?[e]:[]),!0)}function E(e){let t=new ia(G(r));t.has(e)?t.delete(e):t.add(e),H(r,t,!0)}function D(){H(r,new ia,!0)}function O(e){H(i,e,!0),e&&H(a,!1)}function k(e){H(a,e,!0),e&&H(i,null)}function A(e){H(c,e,!0),e&&(D(),ee(null),O(null),k(!1))}function j(e){H(l,e,!0)}function M(e){return G(l)?Math.round(e/20)*20:e}function ee(e){H(o,e,!0)}function N(t){G(e).sharedCss=t,h()}function P(t){G(e).appCss=t,h()}function F(t){let n=G(e).items.find(e=>e.id===t);n&&(n.zIndex=G(p)+1,h())}function I(){G(r).size!==0&&H(s,G(e).items.filter(e=>G(r).has(e.id)).map(({id:e,...t})=>t),!0)}function L(e,t){if(G(s).length===0)return[];let n=[],r=G(s).reduce((e,t)=>e+t.x,0)/G(s).length,i=G(s).reduce((e,t)=>e+t.y,0)/G(s).length;for(let a of G(s)){let o=crypto.randomUUID(),s=a.x-r,c=a.y-i;_({...a,id:o,x:e+s,y:t+c,zIndex:G(p)+1}),n.push(o)}return n}function te(e,t){return I(),L(e,t)}function ne(){let e=[...G(r)];for(let t of e)y(t)}function re(t,n){for(let i of G(r)){let r=G(e).items.find(e=>e.id===i);r&&(r.x+=t,r.y+=n)}h()}function ie(t){let n=G(e).items.find(e=>e.id===t);!n||n.zIndex<=0||(--n.zIndex,h())}function ae(t){let n=G(e).items.find(e=>e.id===t);n&&(n.zIndex+=1,h())}function oe(e,t){G(n).x+=e,G(n).y+=t}function se(e,t,r){let i=Math.max(.1,Math.min(10,G(n).zoom*e)),a=i/G(n).zoom;G(n).x=t-(t-G(n).x)*a,G(n).y=r-(r-G(n).y)*a,G(n).zoom=i}function ce(e){G(n).zoom=Math.max(.1,Math.min(10,e))}function le(){me(0,0,1)}function ue(t){return!!G(e).flags?.[t]}function de(t){G(e).flags||(G(e).flags={}),G(e).flags[t]={x:G(n).x,y:G(n).y,zoom:G(n).zoom},h()}function fe(t){G(e).flags?.[t]&&(delete G(e).flags[t],h())}function pe(e){return e<.5?4*e*e*e:1-(-2*e+2)**3/2}function me(e,t,r){f&&cancelAnimationFrame(f);let i=G(n).x,a=G(n).y,o=G(n).zoom,s=performance.now();function c(l){let u=l-s,d=Math.min(u/600,1),p=pe(d);G(n).x=i+(e-i)*p,G(n).y=a+(t-a)*p,G(n).zoom=o+(r-o)*p,f=d<1?requestAnimationFrame(c):null}f=requestAnimationFrame(c)}function he(t){let n=G(e).flags?.[t];n&&me(n.x,n.y,n.zoom)}function ge(){Object.values(G(t)).forEach(e=>URL.revokeObjectURL(e.url)),H(e,{version:1,items:[],sharedCss:ua,appCss:da,flags:{}},!0),H(t,{},!0),H(n,{x:0,y:0,zoom:1},!0),H(r,new ia,!0),H(i,null),H(a,!1),H(o,null),indexedDB.deleteDatabase(oa)}async function R(s,c){Object.values(G(t)).forEach(e=>URL.revokeObjectURL(e.url));for(let e of s.items)if(e.assetId&&c[e.assetId]){let t=c[e.assetId].url;e.html=e.html.replace(/src="[^"]*"/g,`src="${t}"`)}H(e,s,!0),H(t,c,!0),H(n,{x:0,y:0,zoom:1},!0),H(r,new ia,!0),H(i,null),H(a,!1),H(o,null),await m()}return g(),{get manifest(){return G(e)},get assets(){return G(t)},get viewport(){return G(n)},get selectedIds(){return G(r)},get editingId(){return G(i)},get editingGlobal(){return G(a)},get focusedId(){return G(o)},get locked(){return G(c)},get snapToGrid(){return G(l)},get persistenceError(){return G(u)},get maxZIndex(){return G(p)},addItem:_,addItems:x,updateItem:v,removeItem:y,addAsset:b,addAssets:S,mergeData:C,getItem:w,select:T,toggleSelection:E,clearSelection:D,edit:O,editGlobal:k,setLocked:A,setSnapToGrid:j,snap:M,focus:ee,updateSharedCss:N,updateAppCss:P,bringToFront:F,copySelected:I,pasteItems:L,duplicateSelected:te,removeSelected:ne,moveSelected:re,sendBackward:ie,bringForward:ae,pan:oe,zoomAt:se,setZoom:ce,resetViewport:le,hasFlag:ue,setFlag:de,clearFlag:fe,gotoFlag:he,reset:ge,load:R}}const K=pa();function ma(e,t,n,r){let i=r*Math.PI/180,a=Math.cos(i),o=Math.sin(i),s=0,c=0;return e.includes(`w`)?s=-t/2:e.includes(`e`)&&(s=t/2),e.includes(`n`)?c=-n/2:e.includes(`s`)&&(c=n/2),{x:s*a-c*o,y:s*o+c*a}}function ha(e,t,n){return e/t>n?{width:t*n,height:t}:{width:e,height:e/n}}var ga=Dr(`
`),_a=Dr(`
`),va=Dr(`
`);function ya(e,t){Me(t,!0);let n=yt(()=>K.selectedIds.has(t.item.id)),r=yt(()=>K.focusedId===t.item.id),i=kt(!1),a=kt(!1),o=kt(!1),s={x:0,y:0,itemX:0,itemY:0},c=new aa,l={x:0,y:0,width:0,height:0,itemX:0,itemY:0,corner:``,aspectRatio:1},u={angle:0,startAngle:0},d=yt(()=>()=>{let e=1/K.viewport.zoom;return Math.min(16/12,Math.max(8/12,e))}),f=yt(()=>()=>G(i)||G(o)?`grabbing`:`move`),p=yt(()=>()=>` + + + + + +${t.item.html} +`);function m(e){if(e.button===0&&!G(r)){e.stopPropagation(),e.shiftKey?K.toggleSelection(t.item.id):G(n)||(K.select(t.item.id),K.bringToFront(t.item.id)),H(i,!0),s={x:e.clientX,y:e.clientY,itemX:t.item.x,itemY:t.item.y},c=new aa;for(let e of K.selectedIds){let t=K.getItem(e);t&&c.set(e,{x:t.x,y:t.y})}}}function h(e,n){e.stopPropagation(),H(a,!0),l={x:e.clientX,y:e.clientY,width:t.item.width,height:t.item.height,itemX:t.item.x,itemY:t.item.y,corner:n,aspectRatio:t.item.width/t.item.height}}function g(e){e.stopPropagation(),H(o,!0);let n=document.querySelector(`[data-item-id="${t.item.id}"]`);if(!n)return;let r=n.getBoundingClientRect(),i=r.left+r.width/2,a=r.top+r.height/2;u={angle:t.item.rotation,startAngle:Math.atan2(e.clientY-a,e.clientX-i)*(180/Math.PI)}}function _(e){if(G(i)){let t=(e.clientX-s.x)/K.viewport.zoom,n=(e.clientY-s.y)/K.viewport.zoom;for(let[e,r]of c)K.updateItem(e,{x:K.snap(r.x+t),y:K.snap(r.y+n)})}else if(G(a)){let n=(e.clientX-l.x)/K.viewport.zoom,r=(e.clientY-l.y)/K.viewport.zoom,i=Math.cos(t.item.rotation*Math.PI/180),a=Math.sin(t.item.rotation*Math.PI/180),o=n*i+r*a,s=-n*a+r*i,c=l.width,u=l.height;if(l.corner.includes(`e`)&&(c=Math.max(20,l.width+o)),l.corner.includes(`w`)&&(c=Math.max(20,l.width-o)),l.corner.includes(`s`)&&(u=Math.max(20,l.height+s)),l.corner.includes(`n`)&&(u=Math.max(20,l.height-s)),e.shiftKey){let e=ha(c,u,l.aspectRatio);c=e.width,u=e.height}let d=K.snap(c),f=K.snap(u),p=d-l.width,m=f-l.height,h=ma(l.corner,p,m,t.item.rotation);K.updateItem(t.item.id,{width:d,height:f,x:K.snap(l.itemX+h.x),y:K.snap(l.itemY+h.y)})}else if(G(o)){let n=document.querySelector(`[data-item-id="${t.item.id}"]`);if(!n)return;let r=n.getBoundingClientRect(),i=r.left+r.width/2,a=r.top+r.height/2,o=Math.atan2(e.clientY-a,e.clientX-i)*(180/Math.PI),s=u.angle+(o-u.startAngle);s=(s%360+360)%360,K.updateItem(t.item.id,{rotation:s})}}function v(){H(i,!1),H(a,!1),H(o,!1)}function y(e){if(!G(n)||K.editingId||G(r))return;let t=e.target?.tagName;t===`INPUT`||t===`TEXTAREA`||e.target?.isContentEditable||(e.key===`Delete`||e.key===`Backspace`)&&K.removeSelected()}function b(e){e.stopPropagation(),K.select(t.item.id),K.focus(t.item.id),K.edit(t.item.id)}var x=va();xr(`mousemove`,zt,_),xr(`mouseup`,zt,v),xr(`keydown`,zt,y);let S;x.__mousedown=m,x.__dblclick=b;var C=U(x),w=W(C,2),T=e=>{jr(e,ga())};Rr(w,e=>{G(r)||e(T)});var E=W(w,2),D=e=>{var t=_a(),n=U(t);n.__mousedown=e=>h(e,`nw`);var r=W(n,2);r.__mousedown=e=>h(e,`ne`);var i=W(r,2);i.__mousedown=e=>h(e,`sw`);var a=W(i,2);a.__mousedown=e=>h(e,`se`);var o=W(a,2);o.__mousedown=g,be(2),B(t),jr(e,t)};Rr(E,e=>{G(n)&&e(D)}),B(x),pn((e,i,a)=>{S=Qr(x,1,`item svelte-zefpzk`,null,S,{selected:G(n),focused:G(r)}),di(x,`data-item-id`,t.item.id),ei(x,` + left: ${t.item.x-t.item.width/2}px; + top: ${t.item.y-t.item.height/2}px; + width: ${t.item.width??``}px; + height: ${t.item.height??``}px; + transform: rotate(${t.item.rotation??``}deg); + z-index: ${t.item.zIndex??``}; + cursor: ${e??``}; + --handle-scale: ${i??``}; + ${K.locked?`pointer-events: none;`:``} + `),di(C,`srcdoc`,a)},[()=>G(f)(),()=>G(d)(),()=>G(p)()]),jr(e,x),Ne()}Sr([`mousedown`,`dblclick`]);var ba=Dr(`
`);function xa(e,t){Me(t,!1);let n=At(),r=!1,i=!1,a=0,o=0;function s(e){(e.button===1||e.button===0&&(e.shiftKey||e.target===G(n)))&&(r=!0,i=!1,a=e.clientX,o=e.clientY,e.preventDefault())}function c(e){if(!r)return;let t=e.clientX-a,n=e.clientY-o;(t!==0||n!==0)&&(i=!0),a=e.clientX,o=e.clientY,K.pan(t,n)}function l(e){r&&!i&&e.target===G(n)&&(K.clearSelection(),K.focus(null)),r=!1}function u(e){e.preventDefault();let t=.995**(e.deltaY*(e.deltaMode===1?16:1)),r=G(n).getBoundingClientRect(),i=e.clientX-r.left,a=e.clientY-r.top;K.zoomAt(t,i,a)}function d(e){if(e.preventDefault(),K.locked)return;let t=e.dataTransfer?.files;if(!t||t.length===0)return;let r=G(n).getBoundingClientRect(),i=K.snap((e.clientX-r.left-K.viewport.x)/K.viewport.zoom),a=K.snap((e.clientY-r.top-K.viewport.y)/K.viewport.zoom);for(let e of t)f(e,i,a)}function f(e,t,n){let r=crypto.randomUUID(),i=crypto.randomUUID(),a=URL.createObjectURL(e);if(e.type.startsWith(`image/`)){let o=new Image;o.onload=()=>{K.addAsset(i,{blob:e,url:a,filename:e.name}),K.addItem({id:r,assetId:i,html:``,css:`img { + width: 100%; + height: 100%; + object-fit: contain; +}`,x:t,y:n,width:o.naturalWidth,height:o.naturalHeight,rotation:0,zIndex:K.maxZIndex+1})},o.src=a}else if(e.type.startsWith(`audio/`))K.addAsset(i,{blob:e,url:a,filename:e.name}),K.addItem({id:r,assetId:i,html:``,css:`audio { + width: 100%; +}`,x:t,y:n,width:300,height:54,rotation:0,zIndex:K.maxZIndex+1});else if(e.type.startsWith(`video/`)){let o=document.createElement(`video`);o.onloadedmetadata=()=>{K.addAsset(i,{blob:e,url:a,filename:e.name}),K.addItem({id:r,assetId:i,html:``,css:`video { + width: 100%; + height: 100%; +}`,x:t,y:n,width:o.videoWidth||640,height:o.videoHeight||360,rotation:0,zIndex:K.maxZIndex+1})},o.src=a}}function p(e){e.preventDefault()}function m(e){if(K.editingId||K.editingGlobal||K.focusedId)return;let t=e.target?.tagName;if(t===`INPUT`||t===`TEXTAREA`||e.target?.isContentEditable)return;if(e.key===`Escape`){K.clearSelection(),K.focus(null);return}if(K.locked)return;let r=e.metaKey||e.ctrlKey,i=G(n).getBoundingClientRect(),a=(i.width/2-K.viewport.x)/K.viewport.zoom,o=(i.height/2-K.viewport.y)/K.viewport.zoom,s=K.selectedIds.size>0,c=K.selectedIds.size===1,l=c?[...K.selectedIds][0]:null;if(r&&e.key===`c`&&s)e.preventDefault(),K.copySelected();else if(r&&e.key===`v`){e.preventDefault();let t=K.pasteItems(a,o);t.length>0&&K.select(t[0]);for(let e=1;e0&&K.select(t[0]);for(let e=1;eK.manifest.items,e=>e.id,(e,t)=>{ya(e,{get item(){return G(t)}})}),B(g),B(h),vi(h,e=>H(n,e),()=>G(n)),pn(()=>ei(g,`transform: translate(${K.viewport.x??``}px, ${K.viewport.y??``}px) scale(${K.viewport.zoom??``})`)),xr(`wheel`,h,u),xr(`drop`,h,d),xr(`dragover`,h,p),jr(e,h),Ne()}Sr([`mousedown`]);var Sa=c(o(((e,t)=>{(function(n){typeof e==`object`&&t!==void 0?t.exports=n():typeof define==`function`&&define.amd?define([],n):(typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:this).JSZip=n()})(function(){return function e(t,n,r){function i(o,s){if(!n[o]){if(!t[o]){var c=typeof l==`function`&&l;if(!s&&c)return c(o,!0);if(a)return a(o,!0);var u=Error(`Cannot find module '`+o+`'`);throw u.code=`MODULE_NOT_FOUND`,u}var d=n[o]={exports:{}};t[o][0].call(d.exports,function(e){var n=t[o][1][e];return i(n||e)},d,d.exports,e,t,n,r)}return n[o].exports}for(var a=typeof l==`function`&&l,o=0;o>2,s=(3&t)<<4|n>>4,c=1>6:64,l=2>4,n=(15&o)<<4|(s=a.indexOf(e.charAt(l++)))>>2,r=(3&s)<<6|(c=a.indexOf(e.charAt(l++))),f[u++]=t,s!==64&&(f[u++]=n),c!==64&&(f[u++]=r);return f}},{"./support":30,"./utils":32}],2:[function(e,t,n){var r=e(`./external`),i=e(`./stream/DataWorker`),a=e(`./stream/Crc32Probe`),o=e(`./stream/DataLengthProbe`);function s(e,t,n,r,i){this.compressedSize=e,this.uncompressedSize=t,this.crc32=n,this.compression=r,this.compressedContent=i}s.prototype={getContentWorker:function(){var e=new i(r.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new o(`data_length`)),t=this;return e.on(`end`,function(){if(this.streamInfo.data_length!==t.uncompressedSize)throw Error(`Bug : uncompressed data size mismatch`)}),e},getCompressedWorker:function(){return new i(r.Promise.resolve(this.compressedContent)).withStreamInfo(`compressedSize`,this.compressedSize).withStreamInfo(`uncompressedSize`,this.uncompressedSize).withStreamInfo(`crc32`,this.crc32).withStreamInfo(`compression`,this.compression)}},s.createWorkerFrom=function(e,t,n){return e.pipe(new a).pipe(new o(`uncompressedSize`)).pipe(t.compressWorker(n)).pipe(new o(`compressedSize`)).withStreamInfo(`compression`,t)},t.exports=s},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(e,t,n){var r=e(`./stream/GenericWorker`);n.STORE={magic:`\0\0`,compressWorker:function(){return new r(`STORE compression`)},uncompressWorker:function(){return new r(`STORE decompression`)}},n.DEFLATE=e(`./flate`)},{"./flate":7,"./stream/GenericWorker":28}],4:[function(e,t,n){var r=e(`./utils`),i=function(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t){return e!==void 0&&e.length?r.getTypeOf(e)===`string`?function(e,t,n,r){var a=i,o=r+n;e^=-1;for(var s=r;s>>8^a[255&(e^t.charCodeAt(s))];return-1^e}(0|t,e,e.length,0):function(e,t,n,r){var a=i,o=r+n;e^=-1;for(var s=r;s>>8^a[255&(e^t[s])];return-1^e}(0|t,e,e.length,0):0}},{"./utils":32}],5:[function(e,t,n){n.base64=!1,n.binary=!1,n.dir=!1,n.createFolders=!0,n.date=null,n.compression=null,n.compressionOptions=null,n.comment=null,n.unixPermissions=null,n.dosPermissions=null},{}],6:[function(e,t,n){var r=null;r=typeof Promise<`u`?Promise:e(`lie`),t.exports={Promise:r}},{lie:37}],7:[function(e,t,n){var r=typeof Uint8Array<`u`&&typeof Uint16Array<`u`&&typeof Uint32Array<`u`,i=e(`pako`),a=e(`./utils`),o=e(`./stream/GenericWorker`),s=r?`uint8array`:`array`;function c(e,t){o.call(this,`FlateWorker/`+e),this._pako=null,this._pakoAction=e,this._pakoOptions=t,this.meta={}}n.magic=`\b\0`,a.inherits(c,o),c.prototype.processChunk=function(e){this.meta=e.meta,this._pako===null&&this._createPako(),this._pako.push(a.transformTo(s,e.data),!1)},c.prototype.flush=function(){o.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},c.prototype.cleanUp=function(){o.prototype.cleanUp.call(this),this._pako=null},c.prototype._createPako=function(){this._pako=new i[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var e=this;this._pako.onData=function(t){e.push({data:t,meta:e.meta})}},n.compressWorker=function(e){return new c(`Deflate`,e)},n.uncompressWorker=function(){return new c(`Inflate`,{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(e,t,n){function r(e,t){var n,r=``;for(n=0;n>>=8;return r}function i(e,t,n,i,o,u){var d,f,p=e.file,m=e.compression,h=u!==s.utf8encode,g=a.transformTo(`string`,u(p.name)),_=a.transformTo(`string`,s.utf8encode(p.name)),v=p.comment,y=a.transformTo(`string`,u(v)),b=a.transformTo(`string`,s.utf8encode(v)),x=_.length!==p.name.length,S=b.length!==v.length,C=``,w=``,T=``,E=p.dir,D=p.date,O={crc32:0,compressedSize:0,uncompressedSize:0};t&&!n||(O.crc32=e.crc32,O.compressedSize=e.compressedSize,O.uncompressedSize=e.uncompressedSize);var k=0;t&&(k|=8),h||!x&&!S||(k|=2048);var A=0,j=0;E&&(A|=16),o===`UNIX`?(j=798,A|=function(e,t){var n=e;return e||(n=t?16893:33204),(65535&n)<<16}(p.unixPermissions,E)):(j=20,A|=function(e){return 63&(e||0)}(p.dosPermissions)),d=D.getUTCHours(),d<<=6,d|=D.getUTCMinutes(),d<<=5,d|=D.getUTCSeconds()/2,f=D.getUTCFullYear()-1980,f<<=4,f|=D.getUTCMonth()+1,f<<=5,f|=D.getUTCDate(),x&&(w=r(1,1)+r(c(g),4)+_,C+=`up`+r(w.length,2)+w),S&&(T=r(1,1)+r(c(y),4)+b,C+=`uc`+r(T.length,2)+T);var M=``;return M+=` +\0`,M+=r(k,2),M+=m.magic,M+=r(d,2),M+=r(f,2),M+=r(O.crc32,4),M+=r(O.compressedSize,4),M+=r(O.uncompressedSize,4),M+=r(g.length,2),M+=r(C.length,2),{fileRecord:l.LOCAL_FILE_HEADER+M+g+C,dirRecord:l.CENTRAL_FILE_HEADER+r(j,2)+M+r(y.length,2)+`\0\0\0\0`+r(A,4)+r(i,4)+g+C+y}}var a=e(`../utils`),o=e(`../stream/GenericWorker`),s=e(`../utf8`),c=e(`../crc32`),l=e(`../signature`);function u(e,t,n,r){o.call(this,`ZipFileWorker`),this.bytesWritten=0,this.zipComment=t,this.zipPlatform=n,this.encodeFileName=r,this.streamFiles=e,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}a.inherits(u,o),u.prototype.push=function(e){var t=e.meta.percent||0,n=this.entriesCount,r=this._sources.length;this.accumulate?this.contentBuffer.push(e):(this.bytesWritten+=e.data.length,o.prototype.push.call(this,{data:e.data,meta:{currentFile:this.currentFile,percent:n?(t+100*(n-r-1))/n:100}}))},u.prototype.openedSource=function(e){this.currentSourceOffset=this.bytesWritten,this.currentFile=e.file.name;var t=this.streamFiles&&!e.file.dir;if(t){var n=i(e,t,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:n.fileRecord,meta:{percent:0}})}else this.accumulate=!0},u.prototype.closedSource=function(e){this.accumulate=!1;var t=this.streamFiles&&!e.file.dir,n=i(e,t,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(n.dirRecord),t)this.push({data:function(e){return l.DATA_DESCRIPTOR+r(e.crc32,4)+r(e.compressedSize,4)+r(e.uncompressedSize,4)}(e),meta:{percent:100}});else for(this.push({data:n.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},u.prototype.flush=function(){for(var e=this.bytesWritten,t=0;t=this.index;t--)n=(n<<8)+this.byteAt(t);return this.index+=e,n},readString:function(e){return r.transformTo(`string`,this.readData(e))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var e=this.readInt(4);return new Date(Date.UTC(1980+(e>>25&127),(e>>21&15)-1,e>>16&31,e>>11&31,e>>5&63,(31&e)<<1))}},t.exports=i},{"../utils":32}],19:[function(e,t,n){var r=e(`./Uint8ArrayReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(e,t,n){var r=e(`./DataReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.byteAt=function(e){return this.data.charCodeAt(this.zero+e)},i.prototype.lastIndexOfSignature=function(e){return this.data.lastIndexOf(e)-this.zero},i.prototype.readAndCheckSignature=function(e){return e===this.readData(4)},i.prototype.readData=function(e){this.checkOffset(e);var t=this.data.slice(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./DataReader":18}],21:[function(e,t,n){var r=e(`./ArrayReader`);function i(e){r.call(this,e)}e(`../utils`).inherits(i,r),i.prototype.readData=function(e){if(this.checkOffset(e),e===0)return new Uint8Array;var t=this.data.subarray(this.zero+this.index,this.zero+this.index+e);return this.index+=e,t},t.exports=i},{"../utils":32,"./ArrayReader":17}],22:[function(e,t,n){var r=e(`../utils`),i=e(`../support`),a=e(`./ArrayReader`),o=e(`./StringReader`),s=e(`./NodeBufferReader`),c=e(`./Uint8ArrayReader`);t.exports=function(e){var t=r.getTypeOf(e);return r.checkSupport(t),t!==`string`||i.uint8array?t===`nodebuffer`?new s(e):i.uint8array?new c(r.transformTo(`uint8array`,e)):new a(r.transformTo(`array`,e)):new o(e)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(e,t,n){n.LOCAL_FILE_HEADER=`PK`,n.CENTRAL_FILE_HEADER=`PK`,n.CENTRAL_DIRECTORY_END=`PK`,n.ZIP64_CENTRAL_DIRECTORY_LOCATOR=`PK\x07`,n.ZIP64_CENTRAL_DIRECTORY_END=`PK`,n.DATA_DESCRIPTOR=`PK\x07\b`},{}],24:[function(e,t,n){var r=e(`./GenericWorker`),i=e(`../utils`);function a(e){r.call(this,`ConvertWorker to `+e),this.destType=e}i.inherits(a,r),a.prototype.processChunk=function(e){this.push({data:i.transformTo(this.destType,e.data),meta:e.meta})},t.exports=a},{"../utils":32,"./GenericWorker":28}],25:[function(e,t,n){var r=e(`./GenericWorker`),i=e(`../crc32`);function a(){r.call(this,`Crc32Probe`),this.withStreamInfo(`crc32`,0)}e(`../utils`).inherits(a,r),a.prototype.processChunk=function(e){this.streamInfo.crc32=i(e.data,this.streamInfo.crc32||0),this.push(e)},t.exports=a},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(e,t,n){var r=e(`../utils`),i=e(`./GenericWorker`);function a(e){i.call(this,`DataLengthProbe for `+e),this.propName=e,this.withStreamInfo(e,0)}r.inherits(a,i),a.prototype.processChunk=function(e){if(e){var t=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=t+e.data.length}i.prototype.processChunk.call(this,e)},t.exports=a},{"../utils":32,"./GenericWorker":28}],27:[function(e,t,n){var r=e(`../utils`),i=e(`./GenericWorker`);function a(e){i.call(this,`DataWorker`);var t=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type=``,this._tickScheduled=!1,e.then(function(e){t.dataIsReady=!0,t.data=e,t.max=e&&e.length||0,t.type=r.getTypeOf(e),t.isPaused||t._tickAndRepeat()},function(e){t.error(e)})}r.inherits(a,i),a.prototype.cleanUp=function(){i.prototype.cleanUp.call(this),this.data=null},a.prototype.resume=function(){return!!i.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,r.delay(this._tickAndRepeat,[],this)),!0)},a.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(r.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},a.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var e=null,t=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case`string`:e=this.data.substring(this.index,t);break;case`uint8array`:e=this.data.subarray(this.index,t);break;case`array`:case`nodebuffer`:e=this.data.slice(this.index,t)}return this.index=t,this.push({data:e,meta:{percent:this.max?this.index/this.max*100:0}})},t.exports=a},{"../utils":32,"./GenericWorker":28}],28:[function(e,t,n){function r(e){this.name=e||`default`,this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}r.prototype={push:function(e){this.emit(`data`,e)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit(`end`),this.cleanUp(),this.isFinished=!0}catch(e){this.emit(`error`,e)}return!0},error:function(e){return!this.isFinished&&(this.isPaused?this.generatedError=e:(this.isFinished=!0,this.emit(`error`,e),this.previous&&this.previous.error(e),this.cleanUp()),!0)},on:function(e,t){return this._listeners[e].push(t),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(e,t){if(this._listeners[e])for(var n=0;n `+e:e}},t.exports=r},{}],29:[function(e,t,n){var r=e(`../utils`),i=e(`./ConvertWorker`),a=e(`./GenericWorker`),o=e(`../base64`),s=e(`../support`),c=e(`../external`),l=null;if(s.nodestream)try{l=e(`../nodejs/NodejsStreamOutputAdapter`)}catch{}function u(e,t){return new c.Promise(function(n,i){var a=[],s=e._internalType,c=e._outputType,l=e._mimeType;e.on(`data`,function(e,n){a.push(e),t&&t(n)}).on(`error`,function(e){a=[],i(e)}).on(`end`,function(){try{n(function(e,t,n){switch(e){case`blob`:return r.newBlob(r.transformTo(`arraybuffer`,t),n);case`base64`:return o.encode(t);default:return r.transformTo(e,t)}}(c,function(e,t){var n,r=0,i=null,a=0;for(n=0;n`u`)n.blob=!1;else{var r=new ArrayBuffer(0);try{n.blob=new Blob([r],{type:`application/zip`}).size===0}catch{try{var i=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);i.append(r),n.blob=i.getBlob(`application/zip`).size===0}catch{n.blob=!1}}}try{n.nodestream=!!e(`readable-stream`).Readable}catch{n.nodestream=!1}},{"readable-stream":16}],31:[function(e,t,n){for(var r=e(`./utils`),i=e(`./support`),a=e(`./nodejsUtils`),o=e(`./stream/GenericWorker`),s=Array(256),c=0;c<256;c++)s[c]=252<=c?6:248<=c?5:240<=c?4:224<=c?3:192<=c?2:1;s[254]=s[254]=1;function l(){o.call(this,`utf-8 decode`),this.leftOver=null}function u(){o.call(this,`utf-8 encode`)}n.utf8encode=function(e){return i.nodebuffer?a.newBufferFrom(e,`utf-8`):function(e){var t,n,r,a,o,s=e.length,c=0;for(a=0;a>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t}(e)},n.utf8decode=function(e){return i.nodebuffer?r.transformTo(`nodebuffer`,e).toString(`utf-8`):function(e){var t,n,i,a,o=e.length,c=Array(2*o);for(t=n=0;t>10&1023,c[n++]=56320|1023&i)}return c.length!==n&&(c.subarray?c=c.subarray(0,n):c.length=n),r.applyFromCharCode(c)}(e=r.transformTo(i.uint8array?`uint8array`:`array`,e))},r.inherits(l,o),l.prototype.processChunk=function(e){var t=r.transformTo(i.uint8array?`uint8array`:`array`,e.data);if(this.leftOver&&this.leftOver.length){if(i.uint8array){var a=t;(t=new Uint8Array(a.length+this.leftOver.length)).set(this.leftOver,0),t.set(a,this.leftOver.length)}else t=this.leftOver.concat(t);this.leftOver=null}var o=function(e,t){var n;for((t||=e.length)>e.length&&(t=e.length),n=t-1;0<=n&&(192&e[n])==128;)n--;return n<0||n===0?t:n+s[e[n]]>t?n:t}(t),c=t;o!==t.length&&(i.uint8array?(c=t.subarray(0,o),this.leftOver=t.subarray(o,t.length)):(c=t.slice(0,o),this.leftOver=t.slice(o,t.length))),this.push({data:n.utf8decode(c),meta:e.meta})},l.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:n.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},n.Utf8DecodeWorker=l,r.inherits(u,o),u.prototype.processChunk=function(e){this.push({data:n.utf8encode(e.data),meta:e.meta})},n.Utf8EncodeWorker=u},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(e,t,n){var r=e(`./support`),i=e(`./base64`),a=e(`./nodejsUtils`),o=e(`./external`);function s(e){return e}function c(e,t){for(var n=0;n>8;this.dir=!!(16&this.externalFileAttributes),e==0&&(this.dosPermissions=63&this.externalFileAttributes),e==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!==`/`||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var e=r(this.extraFields[1].value);this.uncompressedSize===i.MAX_VALUE_32BITS&&(this.uncompressedSize=e.readInt(8)),this.compressedSize===i.MAX_VALUE_32BITS&&(this.compressedSize=e.readInt(8)),this.localHeaderOffset===i.MAX_VALUE_32BITS&&(this.localHeaderOffset=e.readInt(8)),this.diskNumberStart===i.MAX_VALUE_32BITS&&(this.diskNumberStart=e.readInt(4))}},readExtraFields:function(e){var t,n,r,i=e.index+this.extraFieldsLength;for(this.extraFields||={};e.index+4>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t},n.buf2binstring=function(e){return c(e,e.length)},n.binstring2buf=function(e){for(var t=new r.Buf8(e.length),n=0,i=t.length;n>10&1023,l[r++]=56320|1023&i)}return c(l,r)},n.utf8border=function(e,t){var n;for((t||=e.length)>e.length&&(t=e.length),n=t-1;0<=n&&(192&e[n])==128;)n--;return n<0||n===0?t:n+o[e[n]]>t?n:t}},{"./common":41}],43:[function(e,t,n){t.exports=function(e,t,n,r){for(var i=65535&e|0,a=e>>>16&65535|0,o=0;n!==0;){for(n-=o=2e3>>1:e>>>1;t[n]=e}return t}();t.exports=function(e,t,n,i){var a=r,o=i+n;e^=-1;for(var s=i;s>>8^a[255&(e^t[s])];return-1^e}},{}],46:[function(e,t,n){var r,i=e(`../utils/common`),a=e(`./trees`),o=e(`./adler32`),s=e(`./crc32`),c=e(`./messages`),l=0,u=4,d=0,f=-2,p=-1,m=4,h=2,g=8,_=9,v=286,y=30,b=19,x=2*v+1,S=15,C=3,w=258,T=w+C+1,E=42,D=113,O=1,k=2,A=3,j=4;function M(e,t){return e.msg=c[t],t}function ee(e){return(e<<1)-(4e.avail_out&&(n=e.avail_out),n!==0&&(i.arraySet(e.output,t.pending_buf,t.pending_out,n,e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,t.pending===0&&(t.pending_out=0))}function F(e,t){a._tr_flush_block(e,0<=e.block_start?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,P(e.strm)}function I(e,t){e.pending_buf[e.pending++]=t}function L(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t}function te(e,t){var n,r,i=e.max_chain_length,a=e.strstart,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-T?e.strstart-(e.w_size-T):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+w,p=l[a+o-1],m=l[a+o];e.prev_length>=e.good_match&&(i>>=2),s>e.lookahead&&(s=e.lookahead);do if(l[(n=t)+o]===m&&l[n+o-1]===p&&l[n]===l[a]&&l[++n]===l[a+1]){a+=2,n++;do;while(l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&l[++a]===l[++n]&&ac&&--i!=0);return o<=e.lookahead?o:e.lookahead}function ne(e){var t,n,r,a,c,l,u,d,f,p,m=e.w_size;do{if(a=e.window_size-e.lookahead-e.strstart,e.strstart>=m+(m-T)){for(i.arraySet(e.window,e.window,m,m,0),e.match_start-=m,e.strstart-=m,e.block_start-=m,t=n=e.hash_size;r=e.head[--t],e.head[t]=m<=r?r-m:0,--n;);for(t=n=m;r=e.prev[--t],e.prev[t]=m<=r?r-m:0,--n;);a+=m}if(e.strm.avail_in===0)break;if(l=e.strm,u=e.window,d=e.strstart+e.lookahead,f=a,p=void 0,p=l.avail_in,f=C)for(c=e.strstart-e.insert,e.ins_h=e.window[c],e.ins_h=(e.ins_h<=C&&(e.ins_h=(e.ins_h<=C)if(r=a._tr_tally(e,e.strstart-e.match_start,e.match_length-C),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=C){for(e.match_length--;e.strstart++,e.ins_h=(e.ins_h<=C&&(e.ins_h=(e.ins_h<=C&&e.match_length<=e.prev_length){for(i=e.strstart+e.lookahead-C,r=a._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-C),e.lookahead-=e.prev_length-1,e.prev_length-=2;++e.strstart<=i&&(e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(ne(e),e.lookahead===0&&t===l)return O;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((e.strstart===0||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,F(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-T&&(F(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(F(e,!0),e.strm.avail_out===0?A:j):(e.strstart>e.block_start&&(F(e,!1),e.strm.avail_out),O)}),new ae(4,4,8,4,re),new ae(4,5,16,8,re),new ae(4,6,32,32,re),new ae(4,4,16,16,ie),new ae(8,16,32,32,ie),new ae(8,16,128,128,ie),new ae(8,32,128,256,ie),new ae(32,128,258,1024,ie),new ae(32,258,258,4096,ie)],n.deflateInit=function(e,t){return le(e,t,g,15,8,0)},n.deflateInit2=le,n.deflateReset=ce,n.deflateResetKeep=se,n.deflateSetHeader=function(e,t){return e&&e.state&&e.state.wrap===2?(e.state.gzhead=t,d):f},n.deflate=function(e,t){var n,i,o,c;if(!e||!e.state||5>8&255),I(i,i.gzhead.time>>16&255),I(i,i.gzhead.time>>24&255),I(i,i.level===9?2:2<=i.strategy||i.level<2?4:0),I(i,255&i.gzhead.os),i.gzhead.extra&&i.gzhead.extra.length&&(I(i,255&i.gzhead.extra.length),I(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(e.adler=s(e.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=69):(I(i,0),I(i,0),I(i,0),I(i,0),I(i,0),I(i,i.level===9?2:2<=i.strategy||i.level<2?4:0),I(i,3),i.status=D);else{var p=g+(i.w_bits-8<<4)<<8;p|=(2<=i.strategy||i.level<2?0:i.level<6?1:i.level===6?2:3)<<6,i.strstart!==0&&(p|=32),p+=31-p%31,i.status=D,L(i,p),i.strstart!==0&&(L(i,e.adler>>>16),L(i,65535&e.adler)),e.adler=1}if(i.status===69)if(i.gzhead.extra){for(o=i.pending;i.gzindex<(65535&i.gzhead.extra.length)&&(i.pending!==i.pending_buf_size||(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),P(e),o=i.pending,i.pending!==i.pending_buf_size));)I(i,255&i.gzhead.extra[i.gzindex]),i.gzindex++;i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=73)}else i.status=73;if(i.status===73)if(i.gzhead.name){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),P(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),c===0&&(i.gzindex=0,i.status=91)}else i.status=91;if(i.status===91)if(i.gzhead.comment){o=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>o&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),P(e),o=i.pending,i.pending===i.pending_buf_size)){c=1;break}c=i.gzindexo&&(e.adler=s(e.adler,i.pending_buf,i.pending-o,o)),c===0&&(i.status=103)}else i.status=103;if(i.status===103&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&P(e),i.pending+2<=i.pending_buf_size&&(I(i,255&e.adler),I(i,e.adler>>8&255),e.adler=0,i.status=D)):i.status=D),i.pending!==0){if(P(e),e.avail_out===0)return i.last_flush=-1,d}else if(e.avail_in===0&&ee(t)<=ee(n)&&t!==u)return M(e,-5);if(i.status===666&&e.avail_in!==0)return M(e,-5);if(e.avail_in!==0||i.lookahead!==0||t!==l&&i.status!==666){var m=i.strategy===2?function(e,t){for(var n;;){if(e.lookahead===0&&(ne(e),e.lookahead===0)){if(t===l)return O;break}if(e.match_length=0,n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(F(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(F(e,!0),e.strm.avail_out===0?A:j):e.last_lit&&(F(e,!1),e.strm.avail_out===0)?O:k}(i,t):i.strategy===3?function(e,t){for(var n,r,i,o,s=e.window;;){if(e.lookahead<=w){if(ne(e),e.lookahead<=w&&t===l)return O;if(e.lookahead===0)break}if(e.match_length=0,e.lookahead>=C&&0e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=C?(n=a._tr_tally(e,1,e.match_length-C),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=a._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(F(e,!1),e.strm.avail_out===0))return O}return e.insert=0,t===u?(F(e,!0),e.strm.avail_out===0?A:j):e.last_lit&&(F(e,!1),e.strm.avail_out===0)?O:k}(i,t):r[i.level].func(i,t);if(m!==A&&m!==j||(i.status=666),m===O||m===A)return e.avail_out===0&&(i.last_flush=-1),d;if(m===k&&(t===1?a._tr_align(i):t!==5&&(a._tr_stored_block(i,0,0,!1),t===3&&(N(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),P(e),e.avail_out===0))return i.last_flush=-1,d}return t===u?i.wrap<=0?1:(i.wrap===2?(I(i,255&e.adler),I(i,e.adler>>8&255),I(i,e.adler>>16&255),I(i,e.adler>>24&255),I(i,255&e.total_in),I(i,e.total_in>>8&255),I(i,e.total_in>>16&255),I(i,e.total_in>>24&255)):(L(i,e.adler>>>16),L(i,65535&e.adler)),P(e),0=n.w_size&&(s===0&&(N(n.head),n.strstart=0,n.block_start=0,n.insert=0),p=new i.Buf8(n.w_size),i.arraySet(p,t,m-n.w_size,n.w_size,0),t=p,m=n.w_size),c=e.avail_in,l=e.next_in,u=e.input,e.avail_in=m,e.next_in=0,e.input=t,ne(n);n.lookahead>=C;){for(r=n.strstart,a=n.lookahead-(C-1);n.ins_h=(n.ins_h<>>=b=y>>>24,m-=b,(b=y>>>16&255)==0)E[a++]=65535&y;else{if(!(16&b)){if(!(64&b)){y=h[(65535&y)+(p&(1<>>=b,m-=b),m<15&&(p+=T[r++]<>>=b=y>>>24,m-=b,!(16&(b=y>>>16&255))){if(!(64&b)){y=g[(65535&y)+(p&(1<>>=b,m-=b,(b=a-o)>3,p&=(1<<(m-=x<<3))-1,e.next_in=r,e.next_out=a,e.avail_in=r>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24)}function g(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new r.Buf16(320),this.work=new r.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function _(e){var t;return e&&e.state?(t=e.state,e.total_in=e.total_out=t.total=0,e.msg=``,t.wrap&&(e.adler=1&t.wrap),t.mode=f,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new r.Buf32(p),t.distcode=t.distdyn=new r.Buf32(m),t.sane=1,t.back=-1,u):d}function v(e){var t;return e&&e.state?((t=e.state).wsize=0,t.whave=0,t.wnext=0,_(e)):d}function y(e,t){var n,r;return e&&e.state?(r=e.state,t<0?(n=0,t=-t):(n=1+(t>>4),t<48&&(t&=15)),t&&(t<8||15=o.wsize?(r.arraySet(o.window,t,n-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(i<(a=o.wsize-o.wnext)&&(a=i),r.arraySet(o.window,t,n-i,a,o.wnext),(i-=a)?(r.arraySet(o.window,t,n-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,n.check=a(n.check,ne,2,0),x=b=0,n.mode=2;break}if(n.flags=0,n.head&&(n.head.done=!1),!(1&n.wrap)||(((255&b)<<8)+(b>>8))%31){e.msg=`incorrect header check`,n.mode=30;break}if((15&b)!=8){e.msg=`unknown compression method`,n.mode=30;break}if(x-=4,P=8+(15&(b>>>=4)),n.wbits===0)n.wbits=P;else if(P>n.wbits){e.msg=`invalid window size`,n.mode=30;break}n.dmax=1<>8&1),512&n.flags&&(ne[0]=255&b,ne[1]=b>>>8&255,n.check=a(n.check,ne,2,0)),x=b=0,n.mode=3;case 3:for(;x<32;){if(v===0)break e;v--,b+=p[g++]<>>8&255,ne[2]=b>>>16&255,ne[3]=b>>>24&255,n.check=a(n.check,ne,4,0)),x=b=0,n.mode=4;case 4:for(;x<16;){if(v===0)break e;v--,b+=p[g++]<>8),512&n.flags&&(ne[0]=255&b,ne[1]=b>>>8&255,n.check=a(n.check,ne,2,0)),x=b=0,n.mode=5;case 5:if(1024&n.flags){for(;x<16;){if(v===0)break e;v--,b+=p[g++]<>>8&255,n.check=a(n.check,ne,2,0)),x=b=0}else n.head&&(n.head.extra=null);n.mode=6;case 6:if(1024&n.flags&&(v<(E=n.length)&&(E=v),E&&(n.head&&(P=n.head.extra_len-n.length,n.head.extra||(n.head.extra=Array(n.head.extra_len)),r.arraySet(n.head.extra,p,g,E,P)),512&n.flags&&(n.check=a(n.check,p,E,g)),v-=E,g+=E,n.length-=E),n.length))break e;n.length=0,n.mode=7;case 7:if(2048&n.flags){if(v===0)break e;for(E=0;P=p[g+ E++],n.head&&P&&n.length<65536&&(n.head.name+=String.fromCharCode(P)),P&&E>9&1,n.head.done=!0),e.adler=n.check=0,n.mode=12;break;case 10:for(;x<32;){if(v===0)break e;v--,b+=p[g++]<>>=7&x,x-=7&x,n.mode=27;break}for(;x<3;){if(v===0)break e;v--,b+=p[g++]<>>=1)){case 0:n.mode=14;break;case 1:if(w(n),n.mode=20,t!==6)break;b>>>=2,x-=2;break e;case 2:n.mode=17;break;case 3:e.msg=`invalid block type`,n.mode=30}b>>>=2,x-=2;break;case 14:for(b>>>=7&x,x-=7&x;x<32;){if(v===0)break e;v--,b+=p[g++]<>>16^65535)){e.msg=`invalid stored block lengths`,n.mode=30;break}if(n.length=65535&b,x=b=0,n.mode=15,t===6)break e;case 15:n.mode=16;case 16:if(E=n.length){if(v>>=5,x-=5,n.ndist=1+(31&b),b>>>=5,x-=5,n.ncode=4+(15&b),b>>>=4,x-=4,286>>=3,x-=3}for(;n.have<19;)n.lens[re[n.have++]]=0;if(n.lencode=n.lendyn,n.lenbits=7,I={bits:n.lenbits},F=s(0,n.lens,0,19,n.lencode,0,n.work,I),n.lenbits=I.bits,F){e.msg=`invalid code lengths set`,n.mode=30;break}n.have=0,n.mode=19;case 19:for(;n.have>>16&255,j=65535&te,!((k=te>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=k,x-=k,n.lens[n.have++]=j;else{if(j===16){for(L=k+2;x>>=k,x-=k,n.have===0){e.msg=`invalid bit length repeat`,n.mode=30;break}P=n.lens[n.have-1],E=3+(3&b),b>>>=2,x-=2}else if(j===17){for(L=k+3;x>>=k)),b>>>=3,x-=3}else{for(L=k+7;x>>=k)),b>>>=7,x-=7}if(n.have+E>n.nlen+n.ndist){e.msg=`invalid bit length repeat`,n.mode=30;break}for(;E--;)n.lens[n.have++]=P}}if(n.mode===30)break;if(n.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,n.mode=30;break}if(n.lenbits=9,I={bits:n.lenbits},F=s(c,n.lens,0,n.nlen,n.lencode,0,n.work,I),n.lenbits=I.bits,F){e.msg=`invalid literal/lengths set`,n.mode=30;break}if(n.distbits=6,n.distcode=n.distdyn,I={bits:n.distbits},F=s(l,n.lens,n.nlen,n.ndist,n.distcode,0,n.work,I),n.distbits=I.bits,F){e.msg=`invalid distances set`,n.mode=30;break}if(n.mode=20,t===6)break e;case 20:n.mode=21;case 21:if(6<=v&&258<=y){e.next_out=_,e.avail_out=y,e.next_in=g,e.avail_in=v,n.hold=b,n.bits=x,o(e,C),_=e.next_out,m=e.output,y=e.avail_out,g=e.next_in,p=e.input,v=e.avail_in,b=n.hold,x=n.bits,n.mode===12&&(n.back=-1);break}for(n.back=0;A=(te=n.lencode[b&(1<>>16&255,j=65535&te,!((k=te>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>M)])>>>16&255,j=65535&te,!(M+(k=te>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=M,x-=M,n.back+=M}if(b>>>=k,x-=k,n.back+=k,n.length=j,A===0){n.mode=26;break}if(32&A){n.back=-1,n.mode=12;break}if(64&A){e.msg=`invalid literal/length code`,n.mode=30;break}n.extra=15&A,n.mode=22;case 22:if(n.extra){for(L=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}n.was=n.length,n.mode=23;case 23:for(;A=(te=n.distcode[b&(1<>>16&255,j=65535&te,!((k=te>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>M)])>>>16&255,j=65535&te,!(M+(k=te>>>24)<=x);){if(v===0)break e;v--,b+=p[g++]<>>=M,x-=M,n.back+=M}if(b>>>=k,x-=k,n.back+=k,64&A){e.msg=`invalid distance code`,n.mode=30;break}n.offset=j,n.extra=15&A,n.mode=24;case 24:if(n.extra){for(L=n.extra;x>>=n.extra,x-=n.extra,n.back+=n.extra}if(n.offset>n.dmax){e.msg=`invalid distance too far back`,n.mode=30;break}n.mode=25;case 25:if(y===0)break e;if(E=C-y,n.offset>E){if((E=n.offset-E)>n.whave&&n.sane){e.msg=`invalid distance too far back`,n.mode=30;break}D=E>n.wnext?(E-=n.wnext,n.wsize-E):n.wnext-E,E>n.length&&(E=n.length),O=n.window}else O=m,D=_-n.offset,E=n.length;for(yv?(b=I[L+d[w]],ee[N+d[w]]):(b=96,0),p=1<>k)+(m-=p)]=y<<24|b<<16|x|0,m!==0;);for(p=1<>=1;if(p===0?M=0:(M&=p-1,M+=p),w++,--P[C]==0){if(C===E)break;C=t[n+d[w]]}if(D>>7)]}function I(e,t){e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255}function L(e,t,n){e.bi_valid>h-n?(e.bi_buf|=t<>h-e.bi_valid,e.bi_valid+=n-h):(e.bi_buf|=t<>>=1,n<<=1,0<--t;);return n>>>1}function re(e,t,n){var r,i,a=Array(m+1),o=0;for(r=1;r<=m;r++)a[r]=o=o+n[r-1]<<1;for(i=0;i<=t;i++){var s=e[2*i+1];s!==0&&(e[2*i]=ne(a[s]++,s))}}function ie(e){var t;for(t=0;t>1;1<=n;n--)se(e,a,n);for(i=c;n=e.heap[1],e.heap[1]=e.heap[e.heap_len--],se(e,a,1),r=e.heap[1],e.heap[--e.heap_max]=n,e.heap[--e.heap_max]=r,a[2*i]=a[2*n]+a[2*r],e.depth[i]=(e.depth[n]>=e.depth[r]?e.depth[n]:e.depth[r])+1,a[2*n+1]=a[2*r+1]=i,e.heap[1]=i++,se(e,a,1),2<=e.heap_len;);e.heap[--e.heap_max]=e.heap[1],function(e,t){var n,r,i,a,o,s,c=t.dyn_tree,l=t.max_code,u=t.stat_desc.static_tree,d=t.stat_desc.has_stree,f=t.stat_desc.extra_bits,h=t.stat_desc.extra_base,g=t.stat_desc.max_length,_=0;for(a=0;a<=m;a++)e.bl_count[a]=0;for(c[2*e.heap[e.heap_max]+1]=0,n=e.heap_max+1;n>=7;r>>=1)if(1&n&&e.dyn_ltree[2*t]!==0)return i;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return a;for(t=32;t>>3,(s=e.static_len+3+7>>>3)<=o&&(o=s)):o=s=n+5,n+4<=o&&t!==-1?pe(e,t,n,r):e.strategy===4||s===o?(L(e,2+(r?1:0),3),ce(e,T,E)):(L(e,4+(r?1:0),3),function(e,t,n,r){var i;for(L(e,t-257,5),L(e,n-1,5),L(e,r-4,4),i=0;i>>8&255,e.pending_buf[e.d_buf+2*e.last_lit+1]=255&t,e.pending_buf[e.l_buf+e.last_lit]=255&n,e.last_lit++,t===0?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(O[n]+l+1)]++,e.dyn_dtree[2*F(t)]++),e.last_lit===e.lit_bufsize-1},n._tr_align=function(e){L(e,2,3),te(e,_,T),function(e){e.bi_valid===16?(I(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):8<=e.bi_valid&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)}(e)}},{"../utils/common":41}],53:[function(e,t,n){t.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=``,this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(e,t,n){(function(e){(function(e,t){if(!e.setImmediate){var n,r,i,a,o=1,s={},c=!1,l=e.document,u=Object.getPrototypeOf&&Object.getPrototypeOf(e);u=u&&u.setTimeout?u:e,n={}.toString.call(e.process)===`[object process]`?function(e){process.nextTick(function(){f(e)})}:function(){if(e.postMessage&&!e.importScripts){var t=!0,n=e.onmessage;return e.onmessage=function(){t=!1},e.postMessage(``,`*`),e.onmessage=n,t}}()?(a=`setImmediate$`+Math.random()+`$`,e.addEventListener?e.addEventListener(`message`,p,!1):e.attachEvent(`onmessage`,p),function(t){e.postMessage(a+t,`*`)}):e.MessageChannel?((i=new MessageChannel).port1.onmessage=function(e){f(e.data)},function(e){i.port2.postMessage(e)}):l&&`onreadystatechange`in l.createElement(`script`)?(r=l.documentElement,function(e){var t=l.createElement(`script`);t.onreadystatechange=function(){f(e),t.onreadystatechange=null,r.removeChild(t),t=null},r.appendChild(t)}):function(e){setTimeout(f,0,e)},u.setImmediate=function(e){typeof e!=`function`&&(e=Function(``+e));for(var t=Array(arguments.length-1),r=0;r`u`?e===void 0?this:e:self)}).call(this,typeof global<`u`?global:typeof self<`u`?self:typeof window<`u`?window:{})},{}]},{},[10])(10)})}))(),1);async function Ca(){try{let e=new Sa.default,t=e.folder(`assets`);if(!t)throw Error(`Failed to create assets folder`);let n={version:1,items:K.manifest.items.map(e=>({...e})),sharedCss:K.manifest.sharedCss,appCss:K.manifest.appCss,flags:K.manifest.flags??{}};for(let e of n.items)if(e.assetId){let n=K.assets[e.assetId];if(n){let r=n.filename.split(`.`).pop()||`bin`,i=`${e.assetId}.${r}`;t.file(i,n.blob)}}e.file(`manifest.json`,JSON.stringify(n));let r=await e.generateAsync({type:`blob`,compression:`DEFLATE`,compressionOptions:{level:9}}),i=URL.createObjectURL(r),a=document.createElement(`a`);return a.href=i,a.download=`board.bub`,a.click(),URL.revokeObjectURL(i),{success:!0}}catch(e){return{success:!1,error:e instanceof Error?e.message:`Export failed`}}}async function wa(e){try{let t=await Sa.default.loadAsync(e),n=t.file(`manifest.json`);if(!n)throw Error(`Invalid .bub file: missing manifest.json`);let r=await n.async(`string`),i=JSON.parse(r);if(i.version!==1)throw Error(`Unsupported manifest version: ${i.version}`);let a={version:1,items:i.items,sharedCss:i.sharedCss??``,appCss:i.appCss??``,flags:i.flags??{}},o={},s=new Map;for(let e of a.items)if(e.assetId){let n=t.folder(`assets`)?.file(RegExp(`^${e.assetId}\\.`));if(n&&n.length>0){let t=n[0],r=await t.async(`blob`),i=URL.createObjectURL(r),a=t.name.split(`/`).pop()||`asset`;o[e.assetId]={blob:r,url:i,filename:a},s.set(e.assetId,i)}}for(let e of a.items)if(e.assetId&&s.has(e.assetId)){let t=s.get(e.assetId);e.html=e.html.replace(/src="[^"]*"/g,`src="${t}"`)}return await K.load(a,o),{success:!0}}catch(e){return{success:!1,error:e instanceof Error?e.message:`Import failed`}}}async function Ta(e){try{let t=await Sa.default.loadAsync(e),n=t.file(`manifest.json`);if(!n)throw Error(`Invalid .bub file: missing manifest.json`);let r=await n.async(`string`),i=JSON.parse(r);if(i.version!==1)throw Error(`Unsupported manifest version: ${i.version}`);let a=i.items;if(a.length===0)return{success:!0,itemCount:0};let o=new Map,s={};for(let e of a)if(e.assetId&&!o.has(e.assetId)){let n=crypto.randomUUID();o.set(e.assetId,n);let r=t.folder(`assets`)?.file(RegExp(`^${e.assetId}\\.`));if(r&&r.length>0){let e=r[0],t=await e.async(`blob`);s[n]={blob:t,url:URL.createObjectURL(t),filename:e.name.split(`/`).pop()||`asset`}}}let c=Math.min(...a.map(e=>e.zIndex)),l=K.maxZIndex+1-c,u=a.map(e=>{let t=crypto.randomUUID(),n=e.assetId?o.get(e.assetId):void 0,r=e.html;return n&&s[n]&&(r=r.replace(/src="[^"]*"/g,`src="${s[n].url}"`)),{...e,id:t,assetId:n,zIndex:e.zIndex+l,html:r}});return await K.mergeData(s,u),{success:!0,itemCount:u.length}}catch(e){return{success:!1,error:e instanceof Error?e.message:`Merge failed`}}}var Ea=Dr(`
`);function Da(e,t){Me(t,!0);let n=yt(()=>K.locked),r=kt(void 0),i=kt(void 0),a=kt(void 0);function o(){return{x:K.snap(-K.viewport.x/K.viewport.zoom+400),y:K.snap(-K.viewport.y/K.viewport.zoom+300)}}function s(){let e=crypto.randomUUID(),t=o();K.addItem({id:e,html:``,css:``,x:t.x,y:t.y,width:200,height:200,rotation:0,zIndex:K.maxZIndex+1}),K.select(e)}function c(){let e=crypto.randomUUID(),t=o();K.addItem({id:e,html:`

Text

`,css:`p { + color: #fff; + font-size: 24px; + font-family: 'Departure Mono', monospace; +}`,x:t.x,y:t.y,width:200,height:50,rotation:0,zIndex:K.maxZIndex+1}),K.select(e)}function l(){let e=prompt(`Enter URL to embed:`);if(!e)return;let t=crypto.randomUUID(),n=o();K.addItem({id:t,html:``,css:`iframe { + width: 100%; + height: 100%; + border: none; +}`,x:n.x,y:n.y,width:640,height:480,rotation:0,zIndex:K.maxZIndex+1}),K.select(t)}function u(e){let t=e.target.files?.[0];t&&(p(t),e.target.value=``)}function d(e){let t=e.target.files?.[0];t&&(m(t),e.target.value=``)}function f(e){let t=e.target.files?.[0];t&&(h(t),e.target.value=``)}function p(e){let t=crypto.randomUUID(),n=crypto.randomUUID(),r=URL.createObjectURL(e),i=o(),a=document.createElement(`img`);a.onload=()=>{K.addAsset(n,{blob:e,url:r,filename:e.name}),K.addItem({id:t,assetId:n,html:``,css:`img { + width: 100%; + height: 100%; + object-fit: contain; +}`,x:i.x,y:i.y,width:a.naturalWidth,height:a.naturalHeight,rotation:0,zIndex:K.maxZIndex+1}),K.select(t)},a.src=r}function m(e){let t=crypto.randomUUID(),n=crypto.randomUUID(),r=URL.createObjectURL(e),i=o();K.addAsset(n,{blob:e,url:r,filename:e.name}),K.addItem({id:t,assetId:n,html:``,css:`audio { + width: 100%; +}`,x:i.x,y:i.y,width:300,height:54,rotation:0,zIndex:K.maxZIndex+1}),K.select(t)}function h(e){let t=crypto.randomUUID(),n=crypto.randomUUID(),r=URL.createObjectURL(e),i=o(),a=document.createElement(`video`);a.onloadedmetadata=()=>{K.addAsset(n,{blob:e,url:r,filename:e.name}),K.addItem({id:t,assetId:n,html:``,css:`video { + width: 100%; + height: 100%; +}`,x:i.x,y:i.y,width:a.videoWidth||640,height:a.videoHeight||360,rotation:0,zIndex:K.maxZIndex+1}),K.select(t)},a.src=r}var g=Ar(),_=qt(g),v=e=>{var t=Ea(),n=U(t);n.__click=s,Ji(U(n),{size:14}),B(n);var o=W(n,2);o.__click=c,Xi(U(o),{size:14}),B(o);var p=W(o,2);p.__click=()=>G(r).click(),Vi(U(p),{size:14}),B(p);var m=W(p,2);m.__click=()=>G(i).click(),Gi(U(m),{size:14}),B(m);var h=W(m,2);h.__click=()=>G(a).click(),Qi(U(h),{size:14}),B(h);var g=W(h,2);g.__click=l,zi(U(g),{size:14}),B(g);var _=W(g,2);_.__change=u,vi(_,e=>H(r,e),()=>G(r));var v=W(_,2);v.__change=d,vi(v,e=>H(i,e),()=>G(i));var y=W(v,2);y.__change=f,vi(y,e=>H(a,e),()=>G(a)),B(t),jr(e,t)};Rr(_,e=>{G(n)||e(v)}),jr(e,g),Ne()}Sr([`click`,`change`]);var Oa=Dr(``),ka=Dr(``),Aa=Dr(`
Buboard
`);function ja(e,t){Me(t,!0);let n,r;async function i(){let e=await Ca();e.success||alert(e.error||`Export failed`)}function a(){n.click()}async function o(e){let t=e.target,n=t.files?.[0];if(!n)return;let r=await wa(n);r.success||alert(r.error||`Import failed`),t.value=``}function s(){r.click()}async function c(e){let t=e.target,n=t.files;if(!(!n||n.length===0)){for(let e of n){let t=await Ta(e);t.success||alert(t.error||`Merge failed for ${e.name}`)}t.value=``}}function l(){confirm(`Clear the canvas? This cannot be undone.`)&&K.reset()}function u(e){let t=parseFloat(e.target.value);K.setZoom(t)}function d(e){K.hasFlag(e)?K.gotoFlag(e):K.setFlag(e)}function f(e,t){e.preventDefault(),K.clearFlag(t)}let p=yt(()=>Math.round(K.viewport.zoom*100)),m=yt(()=>Math.round(-K.viewport.x/K.viewport.zoom)),h=yt(()=>Math.round(-K.viewport.y/K.viewport.zoom)),g=[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`];var _=Aa(),v=W(U(_),2);Da(v,{});var y=W(v,2);lt(y,20,()=>g,e=>e,(e,t)=>{var n=Oa();let r;n.__click=()=>d(t),n.__contextmenu=e=>f(e,t);var i=U(n,!0);B(n),pn(e=>{r=Qr(n,1,`flag svelte-1dqac8y`,null,r,e),di(n,`title`,`Position ${t??``}`),Mr(i,t)},[()=>({filled:K.hasFlag(t)})]),jr(e,n)}),B(y);var b=W(y,4),x=U(b);B(b);var S=W(b,2),C=U(S);ci(C),C.__input=u;var w=W(C,2);w.__click=()=>K.resetViewport();var T=U(w);ea(T,{size:12});var E=W(T,2),D=U(E);B(E),B(w),B(S);var O=W(S,2);O.__click=()=>K.editGlobal(!0),Ki(U(O),{size:14}),B(O);var k=W(O,2);k.__click=l,Yi(U(k),{size:14}),B(k);var A=W(k,2);A.__click=a,Zi(U(A),{size:14}),B(A);var j=W(A,2);j.__click=s,Fi(U(j),{size:14}),B(j);var M=W(j,2);M.__click=i,Ii(U(M),{size:14}),B(M);var ee=W(M,2);ee.__click=()=>K.setSnapToGrid(!K.snapToGrid);let N;Bi(U(ee),{size:14}),B(ee);var P=W(ee,2);P.__click=()=>K.setLocked(!K.locked);let F;var I=U(P),L=e=>{Ui(e,{size:14})},te=e=>{Wi(e,{size:14})};Rr(I,e=>{K.locked?e(L):e(te,!1)}),B(P);var ne=W(P,2),re=e=>{var n=ka();n.__click=function(...e){t.onHide?.apply(this,e)},Li(U(n),{size:14}),B(n),jr(e,n)};Rr(ne,e=>{t.onHide&&e(re)});var ie=W(ne,2);ie.__change=o,vi(ie,e=>n=e,()=>n);var ae=W(ie,2);ae.__change=c,vi(ae,e=>r=e,()=>r),B(_),pn(()=>{Mr(x,`${G(m)??``}, ${G(h)??``}`),li(C,K.viewport.zoom),Mr(D,`${G(p)??``}%`),O.disabled=K.locked,k.disabled=K.locked,A.disabled=K.locked,j.disabled=K.locked,di(ee,`title`,K.snapToGrid?`Disable snap to grid`:`Snap to grid`),N=Qr(ee,1,`svelte-1dqac8y`,null,N,{active:K.snapToGrid}),di(P,`title`,K.locked?`Unlock`:`Lock`),F=Qr(P,1,`svelte-1dqac8y`,null,F,{active:K.locked})}),jr(e,_),Ne()}Sr([`click`,`contextmenu`,`input`,`change`]);var Ma=[],Na=[];(()=>{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,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l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=0;t>1;if(e=Na[r])t=r+1;else return!0;if(t==n)return!1}}function Fa(e){return e>=127462&&e<=127487}var Ia=8205;function La(e,t,n=!0,r=!0){return(n?Ra:za)(e,t,r)}function Ra(e,t,n){if(t==e.length)return t;t&&Va(e.charCodeAt(t))&&Ha(e.charCodeAt(t-1))&&t--;let r=Ba(e,t);for(t+=Ua(r);t=0&&Fa(Ba(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function za(e,t,n){for(;t>0;){let r=Ra(e,t-2,n);if(r=56320&&e<57344}function Ha(e){return e>=55296&&e<56320}function Ua(e){return e<65536?1:2}var Wa=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]=eo(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),Ka.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]=eo(this,e,t);let n=[];return this.decompose(e,t,n,0),Ka.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 Xa(this),i=new Xa(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 Xa(this,e)}iterRange(e,t=this.length){return new Za(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 Qa(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 Ga(t):Ka.from(Ga.split(t,[]))}},Ga=class e extends Wa{constructor(e,t=qa(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 $a(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(Ya(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=Ja(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]=eo(this,t,n);let i=Ja(this.text,Ja(r.text,Ya(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):Ka.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=` +`){[e,t]=eo(this,e,t);let r=``;for(let i=0,a=0;i<=t&&ae&&a&&(r+=n),ei&&(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}},Ka=class e extends Wa{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=a){let i=r&((a<=e?1:0)|(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]=eo(this,t,n),r.lines=a&&n<=s){let c=o.replace(t-a,n-a,r),l=this.lines-o.lines+c.lines;if(c.lines>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=` +`){[e,t]=eo(this,e,t);let r=``;for(let i=0,a=0;ie&&i&&(r+=n),ea&&(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 Ga(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 Ga&&c&&(n=u[u.length-1])instanceof Ga&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new Ga(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)}};Wa.empty=new Ga([``],0);function qa(e){let t=-1;for(let n of e)t+=n.length+1;return t}function Ja(e,t,n=0,r=1e9){for(let i=0,a=0,o=!0;a=n&&(c>r&&(s=s.slice(0,r-i)),i0?1:(e instanceof Ga?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 Ga?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=` +`,this;e--}else if(r instanceof Ga){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 Ga?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)}},Za=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new Xa(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!=``}},Qa=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`&&(Wa.prototype[Symbol.iterator]=function(){return this.iter()},Xa.prototype[Symbol.iterator]=Za.prototype[Symbol.iterator]=Qa.prototype[Symbol.iterator]=function(){return this});var $a=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 eo(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function to(e,t,n=!0,r=!0){return La(e,t,n,r)}function no(e){return e>=56320&&e<57344}function ro(e){return e>=55296&&e<56320}function io(e,t){let n=e.charCodeAt(t);if(!ro(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return no(r)?(n-55296<<10)+(r-56320)+65536:n}function ao(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function oo(e){return e<65536?1:2}var so=/\r\n?|\n/,co=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})(co||={}),lo=class e{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;te)return i+(e-r);i+=o}else{if(n!=co.Simple&&c>=e&&(n==co.TrackDel&&re||n==co.TrackBefore&&re))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=0&&r<=t&&o>=e)return rt?`cover`:!0;r=o}return!1}toString(){let e=``;for(let t=0;t=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)}},uo=class e extends lo{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 mo(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return ho(this,e,t,!0)}invert(t){let n=this.sections.slice(),r=[];for(let e=0,i=0;e=0){n[e]=o,n[e+1]=a;let s=e>>1;for(;r.length0&&po(r,n,a.text),a.forward(e),o+=e}let c=t[e++];for(;o>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;os||e<0||s>n)throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${n})`);let u=l?typeof l==`string`?Wa.of(l.split(r||so)):l:Wa.empty,d=u.length;if(e==s&&d==0)return;eo&&fo(i,e-o,-1),fo(i,s-e,d),po(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;et&&typeof e!=`string`))throw RangeError(`Invalid JSON representation of ChangeSet`);else if(i.length==1)n.push(i[0],0);else{for(;r.length=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 po(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r>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 ho(e,t,n,r=!1){let i=[],a=r?[]:null,o=new _o(e),s=new _o(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);fo(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=0&&e=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.lent||o.ins>=0&&o.len>t)&&(e||r.length>n),a.forward2(t),o.forward(t)}}var _o=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i>1;return t>=e.length?Wa.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?Wa.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)}},vo=class e{constructor(e,t,n){this.from=e,this.to=t,this.flags=n}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(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)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return q.range(e,t);let n=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return q.range(this.anchor,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&(!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 q.range(e.anchor,e.head)}static create(t,n,r){return new e(t,n,r)}},q=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;ne.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=>vo.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;ie?8:0)|i)}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;ri.head?e.range(s,o):e.range(o,s))}}return new e(t,n)}};function yo(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var bo=0,J=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=bo++,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:xo),!!t.static,t.enables)}of(e){return new So([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new So(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new So(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function xo(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var So=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=bo++}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)||wo(e,c)){let r=t(e);if(a?!Co(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=Lo(o,c);if(this.dependencies.every(t=>t instanceof J?o.facet(t)===e.facet(t):t instanceof Do?o.field(t,!1)==e.field(t,!1):!0)||(a?Co(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}}}};function Co(e,t,n){if(e.length!=t.length)return!1;for(let r=0;re[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;te===t),t);return t.provide&&(n.provides=t.provide(n)),n}create(e){return(e.facet(Eo).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(Eo),i=n.facet(Eo),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,Eo.of({field:this,create:e})]}get extension(){return this}},Oo={lowest:4,low:3,default:2,high:1,highest:0};function ko(e){return t=>new jo(t,e)}var Ao={highest:ko(Oo.highest),high:ko(Oo.high),default:ko(Oo.default),low:ko(Oo.low),lowest:ko(Oo.lowest)},jo=class{constructor(e,t){this.inner=e,this.prec=t}},Mo=class e{of(e){return new No(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},No=class{constructor(e,t){this.compartment=e,this.inner=t}},Po=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>1]}static resolve(t,n,r){let i=[],a=Object.create(null),o=new Map;for(let e of Fo(t,n,o))e instanceof Do?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,xo(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=>To(e,n,t))}}return new e(t,o,l.map(e=>e(s)),s,c,a)}};function Fo(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 No&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof No){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 jo)a(e.inner,e.prec);else if(e instanceof Do)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof So)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,Oo.default);else{let t=e.extension;if(!t)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,Oo.default),r.reduce((e,t)=>e.concat(t))}function Io(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 Lo(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var Ro=J.define(),zo=J.define({combine:e=>e.some(e=>e),static:!0}),Bo=J.define({combine:e=>e.length?e[0]:void 0,static:!0}),Vo=J.define(),Ho=J.define(),Uo=J.define(),Wo=J.define({combine:e=>e.length?e[0]:!1}),Go=class{constructor(e,t){this.type=e,this.value=t}static define(){return new Ko}},Ko=class{of(e){return new Go(this,e)}},qo=class{constructor(e){this.map=e}of(e){return new Jo(this,e)}},Jo=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 qo(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}};Jo.reconfigure=Jo.define(),Jo.appendConfig=Jo.define();var Yo=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&&yo(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]==`.`))}};Yo.time=Go.define(),Yo.userEvent=Go.define(),Yo.addToHistory=Go.define(),Yo.remote=Go.define();function Xo(e,t){let n=[];for(let r=0,i=0;;){let a,o;if(r=e[r]))a=e[r++],o=e[r++];else if(i=0;n--){let i=r[n](e);e=i instanceof Yo?i:Array.isArray(i)&&i.length==1&&i[0]instanceof Yo?i[0]:$o(t,rs(i),!1)}return e}function ts(e){let t=e.startState,n=t.facet(Uo),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=Zo(r,Qo(t,a,e.changes.newLength),!0))}return r==e?e:Yo.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var ns=[];function rs(e){return e==null?ns:Array.isArray(e)?e:[e]}var is=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(is||={}),as=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,os;try{os=RegExp(`[\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{}function ss(e){if(os)return os.test(e);for(let t=0;t`€`&&(n.toUpperCase()!=n.toLowerCase()||as.test(n)))return!0}return!1}function cs(e){return t=>{if(!/\S/.test(t))return is.Space;if(ss(t))return is.Word;for(let n=0;n-1)return is.Word;return is.Other}}var ls=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;ei.set(t,e)),null),i.set(e.value.compartment,e.value.extension)):e.is(Jo.reconfigure)?(n=null,r=e.value):e.is(Jo.appendConfig)&&(n=null,r=rs(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=Po.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(zo)?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:q.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],a=rs(n.effects);for(let n=1;nn.spec.fromJSON(a,e)))}}return e.create({doc:t.doc,selection:q.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=Po.resolve(t.extensions||[],new Map),r=t.doc instanceof Wa?t.doc:Wa.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||so)),i=t.selection?t.selection instanceof q?t.selection:q.single(t.selection.anchor,t.selection.head):q.single(0);return yo(i,r.length),n.staticFacet(zo)||(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)||` +`}get readOnly(){return this.facet(Wo)}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(Ro))for(let a of i(this,t,n))Object.prototype.hasOwnProperty.call(a,e)&&r.push(a[e]);return r}charCategorizer(e){return cs(this.languageDataAt(`wordChars`,e).join(``))}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=to(t,a,!1);if(i(t.slice(e,a))!=is.Word)break;a=e}for(;oe.length?e[0]:4}),ls.lineSeparator=Bo,ls.readOnly=Wo,ls.phrases=J.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])}}),ls.languageData=Ro,ls.changeFilter=Vo,ls.transactionFilter=Ho,ls.transactionExtender=Uo,Mo.reconfigure=Jo.define();function us(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 ds=class{eq(e){return this==e}range(e,t=e){return fs.create(e,t,this)}};ds.prototype.startSide=ds.prototype.endSide=0,ds.prototype.point=!1,ds.prototype.mapMode=co.TrackDel;var fs=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 ps(e,t){return e.from-t.from||e.value.startSide-t.value.startSide}var ms=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.value=n,this.maxPoint=r}get length(){return this.to[this.to.length-1]}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);if||d==f&&c.startSide>0&&c.endSide<=0)continue;(f-d||c.endSide-c.startSide)<0||(o<0&&(o=d),c.point&&(s=Math.max(s,f-d)),r.push(c),i.push(d-o),a.push(f-o))}return{mapped:r.length?new e(i,a,r,s):null,pos:o}}},hs=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(ps)),this.isEmpty)return n.length?e.of(n):this;let s=new ys(this,null,-1).goto(0),c=0,l=[],u=new _s;for(;s.value||c=0){let e=n[c++];u.addInner(e.from,e.to,e.value)||l.push(e)}else s.rangeIndex==1&&s.chunkIndexthis.chunkEnd(s.chunkIndex)||as.to||a=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 bs.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return bs.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=vs(a,o,n),c=new Ss(a,s,i),l=new Ss(o,s,i);n.iterGaps((e,t,n)=>Cs(c,e,l,t,n,r)),n.empty&&n.length==0&&Cs(c,0,l,0,0,r)}static eq(e,t,n=0,r){r??=999999999;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=vs(i,a),s=new Ss(i,o,0).goto(n),c=new Ss(a,o,0).goto(n);for(;;){if(s.to!=c.to||!ws(s.active,c.active)||s.point&&(!c.point||!s.point.eq(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 Ss(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.pointFromo&&(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 _s;for(let r of e instanceof fs?[e]:t?gs(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(t){if(!t.length)return e.empty;let n=t[t.length-1];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}};hs.empty=new hs([],[],null,-1);function gs(e){if(e.length>1)for(let t=e[0],n=1;n0)return e.slice().sort(ps);t=r}return e}hs.empty.nextLayer=hs.empty;var _s=class e{finishChunk(e){this.chunks.push(new ms(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(t,n,r){this.addInner(t,n,r)||(this.nextLayer||=new e).add(t,n,r)}addInner(e,t,n){let r=e-this.lastTo||n.startSide-this.last.endSide;if(r<=0&&(e-this.lastFrom||n.startSide-this.last.startSide)<0)throw Error("Ranges must be added sorted by `from` position and `startSide`");return r<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(hs.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=hs.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}};function vs(e,t,n){let r=new Map;for(let t of e)for(let e=0;e=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex=r&&i.push(new ys(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--)xs(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--)xs(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(),xs(this.heap,0)}}};function xs(e,t){for(let n=e[t];;){let r=(t<<1)+1;if(r>=e.length)break;let i=e[r];if(r+1=0&&(i=e[r+1],r++),n.compare(i)<0)break;e[r]=n,e[t]=i,t=r}}var Ss=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=bs.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){Ts(this.active,e),Ts(this.activeTo,e),Ts(this.activeRank,e),this.minActive=Ds(this.active,this.activeTo)}addActive(e){let t=0,{value:n,to:r,rank:i}=this.cursor;for(;t0;)t++;Es(this.active,t,n),Es(this.activeTo,t,r),Es(this.activeRank,t,i),e&&Es(e,t,this.cursor.from),this.minActive=Ds(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&&Ts(n,r)}else if(this.cursor.value)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=0&&n[t]=0&&!(this.activeRank[n]e||this.activeTo[n]==e&&this.active[n].endSide>=this.point.endSide)&&t.push(this.active[n]);return t.reverse()}openEnd(e){let t=0;for(let n=this.activeTo.length-1;n>=0&&this.activeTo[n]>e;n--)t++;return t}};function Cs(e,t,n,r,i,a){e.goto(t),n.goto(r);let o=r+i,s=r,c=r-t;for(;;){let t=e.to+c-n.to,r=t||e.endSide-n.endSide,i=r<0?e.to+c:n.to,l=Math.min(i,o);if(e.point||n.point?e.point&&n.point&&(e.point==n.point||e.point.eq(n.point))&&ws(e.activeForPoint(e.to),n.activeForPoint(n.to))||a.comparePoint(s,l,e.point,n.point):l>s&&!ws(e.active,n.active)&&a.compareRange(s,l,e.active,n.active),i>o)break;(t||e.openEnd!=n.openEnd)&&a.boundChange&&a.boundChange(i),s=i,r<=0&&e.next(),r>=0&&n.next()}}function ws(e,t){if(e.length!=t.length)return!1;for(let n=0;n=t;n--)e[n+1]=e[n];e[t]=n}function Ds(e,t){let n=-1,r=1e9;for(let i=0;i=t)return r;if(r==e.length)break;i+=e.charCodeAt(r)==9?n-i%n:1,r=to(e,r)}return r===!0?-1:e.length}for(var As=`ͼ`,js=typeof Symbol>`u`?`__`+As:Symbol.for(As),Ms=typeof Symbol>`u`?`__styleSet`+Math.floor(Math.random()*1e8):Symbol(`styleSet`),Ns=typeof globalThis<`u`?globalThis:typeof window<`u`?window:{},Ps=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(` +`)}static newName(){let e=Ns[js]||1;return Ns[js]=e+1,As+e.toString(36)}static mount(e,t,n){let r=e[Ms],i=n&&n.nonce;r?i&&r.setNonce(i):r=new Is(e,i),r.mount(Array.isArray(t)?t:[t],e)}},Fs=new Map,Is=class{constructor(e,t){let n=e.ownerDocument||e,r=n.defaultView;if(!e.head&&e.adoptedStyleSheets&&r.CSSStyleSheet){let t=Fs.get(n);if(t)return e[Ms]=t;this.sheet=new r.CSSStyleSheet,Fs.set(n,this)}else this.styleTag=n.createElement(`style`),t&&this.styleTag.setAttribute(`nonce`,t);this.modules=[],e[Ms]=this}mount(e,t){let n=this.sheet,r=0,i=0;for(let t=0;t-1&&(this.modules.splice(o,1),i--,o=-1),o==-1){if(this.modules.splice(i++,0,a),n)for(let e=0;e`,191:`?`,192:`~`,219:`{`,220:`|`,221:`}`,222:`"`},zs=typeof navigator<`u`&&/Mac/.test(navigator.platform),Bs=typeof navigator<`u`&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Vs=0;Vs<10;Vs++)Ls[48+Vs]=Ls[96+Vs]=String(Vs);for(var Vs=1;Vs<=24;Vs++)Ls[Vs+111]=`F`+Vs;for(var Vs=65;Vs<=90;Vs++)Ls[Vs]=String.fromCharCode(Vs+32),Rs[Vs]=String.fromCharCode(Vs);for(var Hs in Ls)Rs.hasOwnProperty(Hs)||(Rs[Hs]=Ls[Hs]);function Us(e){var t=!(zs&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Bs&&e.shiftKey&&e.key&&e.key.length==1||e.key==`Unidentified`)&&e.key||(e.shiftKey?Rs:Ls)[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 Ws(){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(;t2),Y={mac:nc||/Mac/.test(Ks.platform),windows:/Win/.test(Ks.platform),linux:/Linux|X11/.test(Ks.platform),ie:Zs,ie_version:Ys?qs.documentMode||6:Xs?+Xs[1]:Js?+Js[1]:0,gecko:Qs,gecko_version:Qs?+(/Firefox\/(\d+)/.exec(Ks.userAgent)||[0,0])[1]:0,chrome:!!$s,chrome_version:$s?+$s[1]:0,ios:nc,android:/Android\b/.test(Ks.userAgent),webkit:ec,webkit_version:ec?+(/\bAppleWebKit\/(\d+)/.exec(Ks.userAgent)||[0,0])[1]:0,safari:tc,safari_version:tc?+(/\bVersion\/(\d+(\.\d+)?)/.exec(Ks.userAgent)||[0,0])[1]:0,tabSize:qs.documentElement.style.tabSize==null?`-moz-tab-size`:`tab-size`};function rc(e){let t;return t=e.nodeType==11?e.getSelection?e:e.ownerDocument:e,t.getSelection()}function ic(e,t){return t?e==t||e.contains(t.nodeType==1?t:t.parentNode):!1}function ac(e,t){if(!t.anchorNode)return!1;try{return ic(e,t.anchorNode)}catch{return!1}}function oc(e){return e.nodeType==3?xc(e,0,e.nodeValue.length).getClientRects():e.nodeType==1?e.getClientRects():[]}function sc(e,t,n,r){return n?uc(e,t,n,r,-1)||uc(e,t,n,r,1):!1}function cc(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t}function lc(e){return e.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(e.nodeName)}function uc(e,t,n,r,i){for(;;){if(e==n&&t==r)return!0;if(t==(i<0?0:dc(e))){if(e.nodeName==`DIV`)return!1;let n=e.parentNode;if(!n||n.nodeType!=1)return!1;t=cc(e)+(i<0?0:1),e=n}else if(e.nodeType==1){if(e=e.childNodes[t+(i<0?-1:0)],e.nodeType==1&&e.contentEditable==`false`)return!1;t=i<0?dc(e):0}else return!1}}function dc(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function fc(e,t){let n=t?e.left:e.right;return{left:n,right:n,top:e.top,bottom:e.bottom}}function pc(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 mc(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 hc(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(u.nodeType==1){let e,f=u==c.body,p=1,m=1;if(f)e=pc(l);else{if(/^(fixed|sticky)$/.test(getComputedStyle(u).position)&&(d=!0),u.scrollHeight<=u.clientHeight&&u.scrollWidth<=u.clientWidth){u=u.assignedSlot||u.parentNode;continue}let t=u.getBoundingClientRect();({scaleX:p,scaleY:m}=mc(u,t)),e={left:t.left,right:t.left+u.clientWidth*p,top:t.top,bottom:t.top+u.clientHeight*m}}let h=0,g=0;if(i==`nearest`)t.top0&&t.bottom>e.bottom+g&&(g=t.bottom-e.bottom+o)):t.bottom>e.bottom&&(g=t.bottom-e.bottom+o,n<0&&t.top-g0&&t.right>e.right+h&&(h=t.right-e.right+a)):t.right>e.right&&(h=t.right-e.right+a,n<0&&t.lefte.bottom||t.lefte.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 gc(e){let t=e.ownerDocument,n,r;for(let i=e.parentNode;i&&!(i==t.body||n&&r);)if(i.nodeType==1)!r&&i.scrollHeight>i.clientHeight&&(r=i),!n&&i.scrollWidth>i.clientWidth&&(n=i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;return{x:n,y:r}}var _c=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?dc(t):0),n,Math.min(e.focusOffset,n?dc(n):0))}set(e,t,n,r){this.anchorNode=e,this.anchorOffset=t,this.focusNode=n,this.focusOffset=r}},vc=null;Y.safari&&Y.safari_version>=26&&(vc=!1);function yc(e){if(e.setActive)return e.setActive();if(vc)return e.focus(vc);let t=[];for(let n=e;n&&(t.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(e.focus(vc==null?{get preventScroll(){return vc={preventScroll:!0},!0}}:void 0),!vc){vc=!1;for(let e=0;eMath.max(1,e.scrollHeight-e.clientHeight-4)}function Dc(e,t){for(let n=e,r=t;;)if(n.nodeType==3&&r>0)return{node:n,offset:r};else if(n.nodeType==1&&r>0){if(n.contentEditable==`false`)return null;n=n.childNodes[r-1],r=dc(n)}else if(n.parentNode&&!lc(n))r=cc(n),n=n.parentNode;else return null}function Oc(e,t){for(let n=e,r=t;;)if(n.nodeType==3&&rt)return n.domBoundsAround(e,t,c);if(u>=e&&r==-1&&(r=s,i=c),c>t&&n.dom.parentNode==this.dom){a=s,o=l;break}l=u,c=u+n.breakAfter}return{from:i,to:o<0?n+this.length:o,startDOM:(r?this.children[r-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:a=0?this.children[a].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let t=this.parent;t;t=t.parent){if(e&&(t.flags|=2),t.flags&1)return;t.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom!=e&&(this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this)}get rootView(){for(let e=this;;){let t=e.parent;if(!t)return e;e=t}}replaceChildren(e,t,n=Ac){this.markDirty();for(let r=e;rthis.pos||e==this.pos&&(t>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let n=this.children[--this.i];this.pos-=n.length+n.breakAfter}}};function Pc(e,t,n,r,i,a,o,s,c){let{children:l}=e,u=l.length?l[t]:null,d=a.length?a[a.length-1]:null,f=d?d.breakAfter:o;if(!(t==r&&u&&!o&&!f&&a.length<2&&u.merge(n,i,a.length?d:null,n==0,s,c))){if(r0&&(!o&&a.length&&u.merge(n,u.length,a[0],!1,s,0)?u.breakAfter=a.shift().breakAfter:(nIc||r.flags&8)?!1:(this.text=this.text.slice(0,t)+(r?r.text:``)+this.text.slice(n),this.markDirty(),!0)}split(t){let n=new e(this.text.slice(t));return this.text=this.text.slice(0,t),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,t){return e==this.dom?t:t?this.text.length:0}domAtPos(e){return new kc(this.dom,e)}domBoundsAround(e,t,n){return{from:n,to:n+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,t){return zc(this.dom,e,t)}},Rc=class e extends jc{constructor(e,t=[],n=0){super(),this.mark=e,this.children=t,this.length=n;for(let e of t)e.setParent(this)}setAttrs(e){if(wc(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let t in this.mark.attrs)e.setAttribute(t,this.mark.attrs[t]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,t)}merge(t,n,r,i,a,o){return r&&(!(r instanceof e&&r.mark.eq(this.mark))||t&&a<=0||nt&&n.push(r=t&&(i=a),r=o,a++}let o=this.length-t;return this.length=t,i>-1&&(this.children.length=i,this.markDirty()),new e(this.mark,n,o)}domAtPos(e){return Hc(this,e)}coordsAt(e,t){return Wc(this,e,t)}};function zc(e,t,n){let r=e.nodeValue.length;t>r&&(t=r);let i=t,a=t,o=0;t==0&&n<0||t==r&&n>=0?Y.chrome||Y.gecko||(t?(i--,o=1):a=0)?0:s.length-1];return Y.safari&&!o&&c.width==0&&(c=Array.prototype.find.call(s,e=>e.width)||c),o?fc(c,o<0):c||null}var Bc=class e extends jc{static create(t,n,r){return new e(t,n,r)}constructor(e,t,n){super(),this.widget=e,this.length=t,this.side=n,this.prevWidget=null}split(t){let n=e.create(this.widget,this.length-t,this.side);return this.length-=t,n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.widget.editable||(this.dom.contentEditable=`false`))}getSide(){return this.side}merge(t,n,r,i,a,o){return r&&(!(r instanceof e)||!this.widget.compare(r.widget)||t>0&&a<=0||n0)?kc.before(this.dom):kc.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,t){let n=this.widget.coordsAt(this.dom,e,t);if(n)return n;let r=this.dom.getClientRects(),i=null;if(!r.length)return null;let a=this.side?this.side<0:e>0;for(let t=a?r.length-1:0;i=r[t],!(e>0?t==0:t==r.length-1||i.top0?kc.before(this.dom):kc.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return Wa.empty}get isHidden(){return!0}};Lc.prototype.children=Bc.prototype.children=Vc.prototype.children=Ac;function Hc(e,t){let n=e.dom,{children:r}=e,i=0;for(let e=0;ie&&t0;e--){let t=r[e-1];if(t.dom.parentNode==n)return t.domAtPos(t.length)}for(let e=i;e0&&t instanceof Rc&&i.length&&(r=i[i.length-1])instanceof Rc&&r.mark.eq(t.mark)?Uc(r,t.children[0],n-1):(i.push(t),t.setParent(e)),e.length+=t.length}function Wc(e,t,n){let r=null,i=-1,a=null,o=-1;function s(e,t){for(let c=0,l=0;c=t&&(u.children.length?s(u,t-l):(!a||a.isHidden&&(n>0||Kc(a,u)))&&(d>t||l==d&&u.getSide()>0)?(a=u,o=t-l):(l-1?1:0)!=i.length-(n&&i.indexOf(n)>-1?1:0))return!1;for(let a of r)if(a!=n&&(i.indexOf(a)==-1||e[a]!==t[a]))return!1;return!0}function Xc(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 Zc(e){let t=Object.create(null);for(let n=0;n0?3e8:-4e8:t>0?1e8:-1e8,new rl(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}=il(e,t);n=(i?t?-3e8:-1:5e8)-1,r=(a?t?2e8:1:-6e8)+1}return new rl(e,n,r,t,e.widget||null,!0)}static line(e){return new nl(e)}static set(e,t=!1){return hs.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};el.none=hs.empty;var tl=class e extends el{constructor(e){let{start:t,end:n}=il(e);super(t?-1:5e8,n?1:-6e8,null,e),this.tagName=e.tagName||`span`,this.class=e.class||``,this.attrs=e.attributes||null}eq(t){return this==t||t instanceof e&&this.tagName==t.tagName&&(this.class||this.attrs?.class)==(t.class||t.attrs?.class)&&Yc(this.attrs,t.attrs,`class`)}range(e,t=e){if(e>=t)throw RangeError(`Mark decorations may not be empty`);return super.range(e,t)}};tl.prototype.point=!1;var nl=class e extends el{constructor(e){super(-2e8,-2e8,null,e)}eq(t){return t instanceof e&&this.spec.class==t.spec.class&&Yc(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)}};nl.prototype.mapMode=co.TrackBefore,nl.prototype.point=!0;var rl=class e extends el{constructor(e,t,n,r,i,a){super(t,n,i,e),this.block=r,this.isReplace=a,this.mapMode=r?t<=0?co.TrackBefore:co.TrackAfter:co.TrackDel}get type(){return this.startSide==this.endSide?this.startSide<=0?$c.WidgetBefore:$c.WidgetAfter:$c.WidgetRange}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(t){return t instanceof e&&al(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)}};rl.prototype.point=!0;function il(e,t=!1){let{inclusiveStart:n,inclusiveEnd:r}=e;return n??=e.inclusive,r??=e.inclusive,{start:n??t,end:r??t}}function al(e,t){return e==t||!!(e&&t&&e.compare(t))}function ol(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 sl=class e extends jc{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(t,n,r,i,a,o){if(r){if(!(r instanceof e))return!1;this.dom||r.transferDOM(this)}return i&&this.setDeco(r?r.attrs:null),Fc(this,t,n,r?r.children.slice():[],a,o),!0}split(t){let n=new e;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i:r,off:i}=this.childPos(t);i&&(n.append(this.children[r].split(i),0),this.children[r].merge(i,this.children[r].length,null,!1,0,0),r++);for(let e=r;e0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=t,n}transferDOM(e){this.dom&&=(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,null)}setDeco(e){Yc(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,t){Uc(this,e,t)}addLineDeco(e){let t=e.spec.attributes,n=e.spec.class;t&&(this.attrs=qc(t,this.attrs||{})),n&&(this.attrs=qc({class:n},this.attrs||{}))}domAtPos(e){return Hc(this,e)}reuseDOM(e){e.nodeName==`DIV`&&(this.setDOM(e),this.flags|=6)}sync(e,t){this.dom?this.flags&4&&(wc(this.dom),this.dom.className=`cm-line`,this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement(`div`)),this.dom.className=`cm-line`,this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(Xc(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add(`cm-line`),this.prevAttrs=void 0),super.sync(e,t);let n=this.dom.lastChild;for(;n&&jc.get(n)instanceof Rc;)n=n.lastChild;if(!n||!this.length||n.nodeName!=`BR`&&jc.get(n)?.isEditable==0&&(!Y.ios||!this.children.some(e=>e instanceof Lc))){let e=document.createElement(`BR`);e.cmIgnore=!0,this.dom.appendChild(e)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,t;for(let n of this.children){if(!(n instanceof Lc)||/[^ -~]/.test(n.text))return null;let r=oc(n.dom);if(r.length!=1)return null;e+=r[0].width,t=r[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:t}:null}coordsAt(e,t){let n=Wc(this,e,t);if(!this.children.length&&n&&this.parent){let{heightOracle:e}=this.parent.view.viewState,t=n.bottom-n.top;if(Math.abs(t-e.lineHeight)<2&&e.textHeight=n){if(a instanceof e)return a;if(o>n)break}i=o+a.breakAfter}return null}},cl=class e extends jc{constructor(e,t,n){super(),this.widget=e,this.length=t,this.deco=n,this.breakAfter=0,this.prevWidget=null}merge(t,n,r,i,a,o){return r&&(!(r instanceof e)||!this.widget.compare(r.widget)||t>0&&a<=0||n0}},ll=class extends Qc{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}},ul=class e{constructor(e,t,n,r){this.doc=e,this.pos=t,this.end=n,this.disallowBlockEffectsFor=r,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text=``,this.textOff=0,this.cursor=e.iter(),this.skip=t}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!(e.breakAfter||e instanceof cl&&e.deco.endSide<0)}getLine(){return this.curLine||(this.content.push(this.curLine=new sl),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&=(this.curLine.append(dl(new Vc(-1),e),e.length),0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,!this.posCovered()&&!(e&&this.content.length&&this.content[this.content.length-1]instanceof cl)&&this.getLine()}buildText(e,t,n){for(;e>0;){if(this.textOff==this.text.length){let{value:t,lineBreak:n,done:r}=this.cursor.next(this.skip);if(this.skip=0,r)throw Error(`Ran out of text content when drawing inline views`);if(n){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=t,this.textOff=0}let r=Math.min(this.text.length-this.textOff,e),i=Math.min(r,512);this.flushBuffer(t.slice(t.length-n)),this.getLine().append(dl(new Lc(this.text.slice(this.textOff,this.textOff+i)),t),n),this.atCursorPos=!0,this.textOff+=i,e-=i,n=r<=i?0:t.length}}span(e,t,n,r){this.buildText(t-e,n,r),this.pos=t,this.openStart<0&&(this.openStart=r)}point(e,t,n,r,i,a){if(this.disallowBlockEffectsFor[a]&&n instanceof rl){if(n.block)throw RangeError(`Block decorations may not be specified via plugins`);if(t>this.doc.lineAt(this.pos).to)throw RangeError(`Decorations that replace line breaks may not be specified via plugins`)}let o=t-e;if(n instanceof rl)if(n.block)n.startSide>0&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new cl(n.widget||fl.block,o,n));else{let a=Bc.create(n.widget||fl.inline,o,o?0:n.startSide),s=this.atCursorPos&&!a.isEditable&&i<=r.length&&(e0),c=!a.isEditable&&(er.length||n.startSide<=0),l=this.getLine();this.pendingBuffer==2&&!s&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(r),s&&(l.append(dl(new Vc(1),r),i),i=r.length+Math.max(0,i-r.length)),l.append(dl(a,r),i),this.atCursorPos=c,this.pendingBuffer=c?er.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=r.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(n);o&&(this.textOff+o<=this.text.length?this.textOff+=o:(this.skip+=o-(this.text.length-this.textOff),this.text=``,this.textOff=0),this.pos=t),this.openStart<0&&(this.openStart=i)}static build(t,n,r,i,a){let o=new e(t,n,r,a);return o.openEnd=hs.spans(i,n,r,o),o.openStart<0&&(o.openStart=o.openEnd),o.finish(o.openEnd),o}};function dl(e,t){for(let n of t)e=new Rc(n,[e],e.length);return e}var fl=class extends Qc{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}};fl.inline=new fl(`span`),fl.block=new fl(`div`);var pl=(function(e){return e[e.LTR=0]=`LTR`,e[e.RTL=1]=`RTL`,e})(pl||={}),ml=pl.LTR,hl=pl.RTL;function gl(e){let t=[];for(let n=0;n=t){if(o.level==n)return a;(i<0||(r==0?e[i].level>o.level:r<0?o.fromt))&&(i=a)}}if(i<0)throw RangeError(`Index out of range`);return i}};function wl(e,t){if(e.length!=t.length)return!1;for(let n=0;n=0;e-=3)if(bl[e+1]==-r){let n=bl[e+2],r=n&2?i:n&4?n&1?a:i:0;r&&(Tl[t]=Tl[bl[e]]=r),s=e;break}}else if(bl.length==189)break;else bl[s++]=t,bl[s++]=n,bl[s++]=c;else if((o=Tl[t])==2||o==1){let e=o==i;c=e?0:1;for(let t=s-3;t>=0;t-=3){let n=bl[t+2];if(n&2)break;if(e)bl[t+2]|=2;else{if(n&4)break;bl[t+2]|=4}}}}}function Ol(e,t,n,r){for(let i=0,a=r;i<=n.length;i++){let o=i?n[i-1].to:e,s=ic;)t==a&&(t=n[--r].from,a=r?n[r-1].to:e),Tl[--t]=u;c=o}else a=o,c++}}}function kl(e,t,n,r,i,a,o){let s=r%2?2:1;if(r%2==i%2)for(let c=t,l=0;cc&&o.push(new Cl(c,m.from,f)),Al(e,m.direction==ml==!(f%2)?r:r+1,i,m.inner,m.from,m.to,o),c=m.to),p=m.to}else if(p==n||(t?Tl[p]!=s:Tl[p]==s))break;else p++;d?kl(e,c,p,r+1,i,d,o):ct;){let n=!0,u=!1;if(!l||c>a[l-1].to){let e=Tl[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(Tl[e-1]==s)break run;else break}d?d.push(m):(m.toTl.length;)Tl[Tl.length]=256;let r=[],i=t==ml?0:1;return Al(e,i,i,n,0,e.length,r),r}function Ml(e){return[new Cl(0,e,0)]}var Nl=``;function Pl(e,t,n,r,i){let a=r.head-e.from,o=Cl.find(t,a,r.bidiLevel??-1,r.assoc),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=to(e.text,a,s.forward(i,n));(ls.to)&&(l=c),Nl=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)];return u&&l==c&&u.level+(i?0:1)e.some(e=>e)}),Kl=J.define({combine:e=>e.some(e=>e)}),ql=J.define(),Jl=class e{constructor(e,t=`nearest`,n=`nearest`,r=5,i=5,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(q.cursor(t.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}},Yl=Jo.define({map:(e,t)=>e.map(t)}),Xl=Jo.define();function Zl(e,t,n){let r=e.facet(zl);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 Ql=J.define({combine:e=>e.length?e[0]:!0}),$l=0,eu=J.define({combine(e){return e.filter((t,n)=>{for(let r=0;r{let t=[];return o&&t.push(au.of(t=>{let n=t.plugin(e);return n?o(n):el.none})),a&&t.push(a(e)),t})}static fromClass(t,n){return e.define((e,n)=>new t(e,n),n)}},nu=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.mustUpdate){let e=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(e)}catch(t){if(Zl(e.state,t,`CodeMirror plugin crashed`),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){Zl(e.state,t,`CodeMirror plugin crashed`),this.deactivate()}return this}destroy(e){if(this.value?.destroy)try{this.value.destroy()}catch(t){Zl(e.state,t,`CodeMirror plugin crashed`)}}deactivate(){this.spec=this.value=null}},ru=J.define(),iu=J.define(),au=J.define(),ou=J.define(),su=J.define(),cu=J.define();function lu(e,t){let n=e.state.facet(cu);if(!n.length)return n;let r=n.map(t=>t instanceof Function?t(e):t),i=[];return hs.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 n=r[e].spec.bidiIsolate,i;if(n??=Fl(t.text,o,s),a>0&&c.length&&(i=c[c.length-1]).to==o&&i.direction==n)i.to=s,c=i.inner;else{let e={from:o,to:s,direction:n,inner:[]};c.push(e),c=e.inner}}}}),i}var uu=J.define();function du(e){let t=0,n=0,r=0,i=0;for(let a of e.state.facet(uu)){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 fu=J.define(),pu=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.toAu)break;a+=2}if(!c)return r;new e(c.fromA,c.toA,c.fromB,c.toB).addToSet(r),o=c.toA,s=c.toB}}},mu=class e{constructor(e,t,n){this.view=e,this.state=t,this.transactions=n,this.flags=0,this.startState=e.state,this.changes=uo.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 pu(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}},hu=class extends jc{get length(){return this.view.state.doc.length}constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.markedForComposition=new Set,this.editContextFormatting=el.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.setDOM(e.contentDOM),this.children=[new sl],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new pu(0,0,0,e.state.doc.length)],0,null)}update(e){let t=e.changedRanges;this.minWidth>0&&t.length&&(t.every(({fromA:e,toA:t})=>tthis.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let n=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(this.domChanged?.newSel?n=this.domChanged.newSel.head:!Cu(e.changes,this.hasComposition)&&!e.selectionSet&&(n=e.state.selection.main.head));let r=n>-1?vu(this.view,e.changes,n):null;if(this.domChanged=null,this.hasComposition){this.markedForComposition.clear();let{from:n,to:r}=this.hasComposition;t=new pu(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,(Y.ie||Y.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let i=this.decorations,a=xu(i,this.updateDeco(),e.changes);return t=pu.extendWithRanges(t,a),!(this.flags&7)&&t.length==0?!1:(this.updateInner(t,e.startState.doc.length,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t,n){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,t,n);let{observer:r}=this.view;r.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+`px`,this.dom.style.flexBasis=this.minWidth?this.minWidth+`px`:``;let e=Y.chrome||Y.ios?{node:r.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,e),this.flags&=-8,e&&(e.written||r.selectionRange.focusNode!=e.node)&&(this.forceSelection=!0),this.dom.style.height=``}),this.markedForComposition.forEach(e=>e.flags&=-9);let i=[];if(this.view.viewport.from||this.view.viewport.to=0?r[e]:null;if(!t)break;let{fromA:a,toA:o,fromB:s,toB:c}=t,l,u,d,f;if(n&&n.range.fromBs){let e=ul.build(this.view.state.doc,s,n.range.fromB,this.decorations,this.dynamicDecorationMap),t=ul.build(this.view.state.doc,n.range.toB,c,this.decorations,this.dynamicDecorationMap);u=e.breakAtStart,d=e.openStart,f=t.openEnd;let r=this.compositionView(n);t.breakAtStart?r.breakAfter=1:t.content.length&&r.merge(r.length,r.length,t.content[0],!1,t.openStart,0)&&(r.breakAfter=t.content[0].breakAfter,t.content.shift()),e.content.length&&r.merge(0,0,e.content[e.content.length-1],!0,0,e.openEnd)&&e.content.pop(),l=e.content.concat(r).concat(t.content)}else ({content:l,breakAtStart:u,openStart:d,openEnd:f}=ul.build(this.view.state.doc,s,c,this.decorations,this.dynamicDecorationMap));let{i:p,off:m}=i.findPos(o,1),{i:h,off:g}=i.findPos(a,-1);Pc(this,h,g,p,m,l,u,d,f)}n&&this.fixCompositionDOM(n)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let e of t.effects)e.is(Xl)&&(this.editContextFormatting=e.value)}compositionView(e){let t=new Lc(e.text.nodeValue);t.flags|=8;for(let{deco:n}of e.marks)t=new Rc(n,[t],t.length);let n=new sl;return n.append(t,0),n}fixCompositionDOM(e){let t=(e,t)=>{t.flags|=8|(t.children.some(e=>e.flags&7)?1:0),this.markedForComposition.add(t);let n=jc.get(e);n&&n!=t&&(n.dom=null),t.setDOM(e)},n=this.childPos(e.range.fromB,1),r=this.children[n.i];t(e.line,r);for(let i=e.marks.length-1;i>=-1;i--)n=r.childPos(n.off,1),r=r.children[n.i],t(i>=0?e.marks[i].node:e.text,r)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let n=this.view.root.activeElement,r=n==this.dom,i=!r&&!(this.view.state.facet(Ql)||this.dom.tabIndex>-1)&&ac(this.dom,this.view.observer.selectionRange)&&!(n&&this.dom.contains(n));if(!(r||t||i))return;let a=this.forceSelection;this.forceSelection=!1;let o=this.view.state.selection.main,s=this.moveToLine(this.domAtPos(o.anchor)),c=o.empty?s:this.moveToLine(this.domAtPos(o.head));if(Y.gecko&&o.empty&&!this.hasComposition&&gu(s)){let e=document.createTextNode(``);this.view.observer.ignore(()=>s.node.insertBefore(e,s.node.childNodes[s.offset]||null)),s=c=new kc(e,0),a=!0}let l=this.view.observer.selectionRange;(a||!l.focusNode||(!sc(s.node,s.offset,l.anchorNode,l.anchorOffset)||!sc(c.node,c.offset,l.focusNode,l.focusOffset))&&!this.suppressWidgetCursorChange(l,o))&&(this.view.observer.ignore(()=>{Y.android&&Y.chrome&&this.dom.contains(l.focusNode)&&Su(l.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let e=rc(this.view.root);if(e)if(o.empty){if(Y.gecko){let e=yu(s.node,s.offset);if(e&&e!=3){let t=(e==1?Dc:Oc)(s.node,s.offset);t&&(s=new kc(t.node,t.offset))}}e.collapse(s.node,s.offset),o.bidiLevel!=null&&e.caretBidiLevel!==void 0&&(e.caretBidiLevel=o.bidiLevel)}else if(e.extend){e.collapse(s.node,s.offset);try{e.extend(c.node,c.offset)}catch{}}else{let t=document.createRange();o.anchor>o.head&&([s,c]=[c,s]),t.setEnd(c.node,c.offset),t.setStart(s.node,s.offset),e.removeAllRanges(),e.addRange(t)}i&&this.view.root.activeElement==this.dom&&(this.dom.blur(),n&&n.focus())}),this.view.observer.setSelectionRange(s,c)),this.impreciseAnchor=s.precise?null:new kc(l.anchorNode,l.anchorOffset),this.impreciseHead=c.precise?null:new kc(l.focusNode,l.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&sc(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=rc(e.root),{anchorNode:r,anchorOffset:i}=e.observer.selectionRange;if(!n||!t.empty||!t.assoc||!n.modify)return;let a=sl.find(this,t.head);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);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)}moveToLine(e){let t=this.dom,n;if(e.node!=t)return e;for(let r=e.offset;!n&&r=0;r--){let e=jc.get(t.childNodes[r]);e instanceof sl&&(n=e.domAtPos(e.length))}return n?new kc(n.node,n.offset,!0):e}nearest(e){for(let t=e;t;){let e=jc.get(t);if(e&&e.rootView==this)return e;t=t.parentNode}return null}posFromDOM(e,t){let n=this.nearest(e);if(!n)throw RangeError(`Trying to find position for a DOM position outside of the document`);return n.localPosFromDOM(e,t)+n.posAtStart}domAtPos(e){let{i:t,off:n}=this.childCursor().findPos(e,-1);for(;t=0;a--){let o=this.children[a],s=i-o.breakAfter,c=s-o.length;if(se||o.covers(1))&&(!n||o instanceof sl&&!(n instanceof sl&&t>=0)))n=o,r=c;else if(n&&c==e&&s==e&&o instanceof cl&&Math.abs(t)<2){if(o.deco.startSide<0)break;a&&(n=null)}i=c}return n?n.coordsAt(e-r,t):null}coordsForChar(e){let{i:t,off:n}=this.childPos(e,1),r=this.children[t];if(!(r instanceof sl))return null;for(;r.children.length;){let{i:e,off:t}=r.childPos(n,1);for(;;e++){if(e==r.children.length)return null;if((r=r.children[e]).length)break}n=t}if(!(r instanceof Lc))return null;let i=to(r.text,n);if(i==n)return null;let a=xc(r.dom,n,i).getClientRects();for(let e=0;eMath.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,o=-1,s=this.view.textDirection==pl.LTR;for(let e=0,c=0;cr)break;if(e>=n){let n=l.dom.getBoundingClientRect();if(t.push(n.height),a){let t=l.dom.lastChild,r=t?oc(t):[];if(r.length){let t=r[r.length-1],a=s?t.right-n.left:n.right-t.left;a>o&&(o=a,this.minWidth=i,this.minWidthFrom=e,this.minWidthTo=u)}}}e=u+l.breakAfter}return t}textDirectionAt(e){let{i:t}=this.childPos(e,1);return getComputedStyle(this.children[t].dom).direction==`rtl`?pl.RTL:pl.LTR}measureTextSize(){for(let e of this.children)if(e instanceof sl){let t=e.measureTextSize();if(t)return t}let e=document.createElement(`div`),t,n,r;return e.className=`cm-line`,e.style.width=`99999px`,e.style.position=`absolute`,e.textContent=`abc def ghi jkl mno pqr stu`,this.view.observer.ignore(()=>{this.dom.appendChild(e);let i=oc(e.firstChild)[0];t=e.getBoundingClientRect().height,n=i?i.width/27:7,r=i?i.height:t,e.remove()}),{lineHeight:t,charWidth:n,textHeight:r}}childCursor(e=this.length){let t=this.children.length;return t&&(e-=this.children[--t].length),new Nc(this.children,e,t)}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.length;if(a>n){let r=(t.lineBlockAt(a).bottom-t.lineBlockAt(n).top)/this.view.scaleY;e.push(el.replace({widget:new ll(r),block:!0,inclusive:!0,isBlockGap:!0}).range(n,a))}if(!i)break;n=i.to+1}return el.set(e)}updateDeco(){let e=1,t=this.view.state.facet(au).map(t=>(this.dynamicDecorationMap[e++]=typeof t==`function`)?t(this.view):t),n=!1,r=this.view.state.facet(ou).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(hs.join(r))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];et.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=du(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;hc(this.view.scrollDOM,a,t.heade instanceof Bc||e.children.some(n);return n(this.children[t])}};function gu(e){return e.node.nodeType==1&&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 _u(e,t){let n=e.observer.selectionRange;if(!n.focusNode)return null;let r=Dc(n.focusNode,n.focusOffset),i=Oc(n.focusNode,n.focusOffset),a=r||i;if(i&&r&&i.node!=r.node){let t=jc.get(i.node);if(!t||t instanceof Lc&&t.text!=i.node.nodeValue)a=i;else if(e.docView.lastCompositionAfterCursor){let e=jc.get(r.node);!e||e instanceof Lc&&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 vu(e,t,n){let r=_u(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,l=new pu(c.mapPos(a),c.mapPos(o),a,o),u=[];for(let t=i.parentNode;;t=t.parentNode){let n=jc.get(t);if(n instanceof Rc)u.push({node:t,deco:n.mark});else if(n instanceof sl||t.nodeName==`DIV`&&t.parentNode==e.contentDOM)return{range:l,text:i,marks:u,line:t};else if(t!=e.contentDOM)u.push({node:t,deco:new tl({inclusive:!0,attributes:Zc(t),tagName:t.tagName.toLowerCase()})});else return null}}function yu(e,t){return e.nodeType==1?(t&&e.childNodes[t-1].contentEditable==`false`?1:0)|(t{et.from&&(n=!0)}),n}function wu(e,t,n=1){let r=e.charCategorizer(t),i=e.doc.lineAt(t),a=t-i.from;if(i.length==0)return q.cursor(t);a==0?n=1:a==i.length&&(n=-1);let o=a,s=a;n<0?o=to(i.text,a,!1):s=to(i.text,a);let c=r(i.text.slice(o,s));for(;o>0;){let e=to(i.text,o,!1);if(r(i.text.slice(e,o))!=c)break;o=e}for(;se?t.left-e:Math.max(0,e-t.right)}function Eu(e,t){return t.top>e?t.top-e:Math.max(0,e-t.bottom)}function Du(e,t){return e.topt.top+1}function Ou(e,t){return te.bottom?{top:e.top,left:e.left,right:e.right,bottom:t}:e}function Au(e,t,n){let r,i,a,o,s=!1,c,l,u,d;for(let f=e.firstChild;f;f=f.nextSibling){let e=oc(f);for(let p=0;pg||o==g&&a>h)&&(r=f,i=m,a=h,o=g,s=h?t0:pm.bottom&&(!u||u.bottomm.top)&&(l=f,d=m):u&&Du(u,m)?u=ku(u,m.bottom):d&&Du(d,m)&&(d=Ou(d,m.top))}}if(u&&u.bottom>=n?(r=c,i=u):d&&d.top<=n&&(r=l,i=d),!r)return{node:e,offset:0};let f=Math.max(i.left,Math.min(i.right,t));return r.nodeType==3?ju(r,f,n):s&&r.contentEditable!=`false`?Au(r,f,n):{node:e,offset:Array.prototype.indexOf.call(e.childNodes,r)+(t>=(i.left+i.right)/2?1:0)}}function ju(e,t,n){let r=e.nodeValue.length,i=-1,a=1e9,o=0;for(let s=0;sn?l.top-n:n-l.bottom)-1;if(l.left-1<=t&&l.right+1>=t&&u=(l.left+l.right)/2,r=n;if(Y.chrome||Y.gecko){let t=xc(e,s).getBoundingClientRect();Math.abs(t.left-l.right)<.1&&(r=!n)}if(u<=0)return{node:e,offset:s+(r?1:0)};i=s+(r?1:0),a=u}}}return{node:e,offset:i>-1?i:o>0?e.nodeValue.length:0}}function Mu(e,t,n,r=-1){let i=e.contentDOM.getBoundingClientRect(),a=i.top+e.viewState.paddingTop,o,{docHeight:s}=e.viewState,{x:c,y:l}=t,u=l-a;if(u<0)return 0;if(u>s)return e.state.doc.length;for(let t=e.viewState.heightOracle.textHeight/2,i=!1;o=e.elementAtHeight(u),o.type!=$c.Text;)for(;u=r>0?o.bottom+t:o.top-t,!(u>=0&&u<=s);){if(i)return n?null:0;i=!0,r=-r}l=a+u;let d=o.from;if(de.viewport.to)return e.viewport.to==e.state.doc.length?e.state.doc.length:n?null:Nu(e,i,o,c,l);let f=e.dom.ownerDocument,p=e.root.elementFromPoint?e.root:f,m=p.elementFromPoint(c,l);m&&!e.contentDOM.contains(m)&&(m=null),m||(c=Math.max(i.left+1,Math.min(i.right-1,c)),m=p.elementFromPoint(c,l),m&&!e.contentDOM.contains(m)&&(m=null));let h,g=-1;if(m&&e.docView.nearest(m)?.isEditable!=0){if(f.caretPositionFromPoint){let e=f.caretPositionFromPoint(c,l);e&&({offsetNode:h,offset:g}=e)}else if(f.caretRangeFromPoint){let e=f.caretRangeFromPoint(c,l);e&&({startContainer:h,startOffset:g}=e)}h&&(!e.contentDOM.contains(h)||Y.safari&&Fu(h,g,c)||Y.chrome&&Iu(h,g,c))&&(h=void 0),h&&(g=Math.min(dc(h),g))}if(!h||!e.docView.dom.contains(h)){let t=sl.find(e.docView,d);if(!t)return u>o.top+o.height/2?o.to:o.from;({node:h,offset:g}=Au(t.dom,c,l))}let _=e.docView.nearest(h);if(!_)return null;if(_.isWidget&&_.dom?.nodeType==1){let e=_.dom.getBoundingClientRect();return t.ye.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+ks(o,a,e.state.tabSize)}function Pu(e,t,n){let r,i=e;if(e.nodeType!=3||t!=(r=e.nodeValue.length))return!1;for(;;){let e=i.nextSibling;if(e){if(e.nodeName==`BR`)break;return!1}else{let e=i.parentNode;if(!e||e.nodeName==`DIV`)break;i=e}}return xc(e,r-1,r).getBoundingClientRect().right>n}function Fu(e,t,n){return Pu(e,t,n)}function Iu(e,t,n){if(t!=0)return Pu(e,t,n);for(let t=e;;){let e=t.parentNode;if(!e||e.nodeType!=1||e.firstChild!=t)return!1;if(e.classList.contains(`cm-line`))break;t=e}return n-(e.nodeType==1?e.getBoundingClientRect():xc(e,0,Math.max(e.nodeValue.length,1)).getBoundingClientRect()).left>5}function Lu(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.tot)return i;(!e||i.type==$c.Text&&(e.type!=i.type||(n<0?i.fromt)))&&(e=i)}}return e||r}return r}function Ru(e,t,n,r){let i=Lu(e,t.head,t.assoc||-1),a=!r||i.type!=$c.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.posAtCoords({x:n==(r==pl.LTR)?t.right-1:t.left+1,y:(a.top+a.bottom)/2});if(o!=null)return q.cursor(o,n?-1:1)}return q.cursor(n?i.to:i.from,n?-1:1)}function zu(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=Pl(i,a,o,s,n),l=Nl;if(!t){if(i.number==(n?e.state.doc.lines:1))return s;l=` +`,i=e.state.doc.line(i.number+(n?1:-1)),a=e.bidiSpans(i),t=e.visualLineSide(i,!n)}if(c){if(!c(l))return s}else{if(!r)return t;c=r(l)}s=t}}function Bu(e,t,n){let r=e.state.charCategorizer(t),i=r(n);return e=>{let t=r(e);return i==is.Space&&(i=t),i==t}}function Vu(e,t,n,r){let i=t.head,a=n?1:-1;if(i==(n?e.state.doc.length:0))return q.cursor(i,t.assoc);let o=t.goalColumn,s,c=e.contentDOM.getBoundingClientRect(),l=e.coordsAtPos(i,t.assoc||-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=r??e.viewState.heightOracle.textHeight>>1;for(let t=0;;t+=10){let n=s+(f+t)*a,r=Mu(e,{x:d,y:n},!1,a);if(nc.bottom||(a<0?ri)){let t=e.docView.coordsForChar(r),i=!t||n{if(t>e&&tt(e)),n.from,t.head>n.from?-1:1);return r==n.from?n:q.cursor(r,re)&&!Ju(i,t)&&this.lineBreak(),r=i}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){if(e.cmIgnore)return;let t=jc.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 e.nodeType==3?this.readTextNode(e):e.nodeName==`BR`?e.nextSibling&&this.lineBreak():e.nodeType==1&&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)(e.nodeType==3?n.node==e:e.contains(n.node))&&(n.pos=this.text.length+(qu(e,n.node,n.offset)?t:0))}};function qu(e,t,n){for(;;){if(!t||n-1;let{impreciseHead:i,impreciseAnchor:a}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=e.docView.domBoundsAround(t,n,0))){let t=i||a?[]:td(e),n=new Ku(t,e.state);n.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=n.text,this.newSel=nd(t,this.bounds.from)}else{let t=e.observer.selectionRange,n=i&&i.node==t.focusNode&&i.offset==t.focusOffset||!ic(e.contentDOM,t.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(t.focusNode,t.focusOffset),r=a&&a.node==t.anchorNode&&a.offset==t.anchorOffset||!ic(e.contentDOM,t.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(t.anchorNode,t.anchorOffset),o=e.viewport;if((Y.ios||Y.chrome)&&e.state.selection.main.empty&&n!=r&&(o.from>0||o.to-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(q.range(r,n)):this.newSel=q.single(r,n)}}};function Zu(e,t){let n,{newSel:r}=t,i=e.state.selection.main,a=e.inputState.lastKeyTime>Date.now()-100?e.inputState.lastKeyCode:-1;if(t.bounds){let{from:r,to:o}=t.bounds,s=i.from,c=null;(a===8||Y.android&&t.text.length=i.from&&n.to<=i.to&&(n.from!=i.from||n.to!=i.to)&&i.to-i.from-(n.to-n.from)<=4?n={from:i.from,to:i.to,insert:e.state.doc.slice(i.from,n.from).append(n.insert).append(e.state.doc.slice(n.to,i.to))}:e.state.doc.lineAt(i.from).toDate.now()-50?n={from:i.from,to:i.to,insert:e.state.toText(e.inputState.insertingText)}:Y.chrome&&n&&n.from==n.to&&n.from==i.head&&n.insert.toString()==` + `&&e.lineWrapping&&(r&&=q.single(r.main.anchor-1,r.main.head-1),n={from:i.from,to:i.to,insert:Wa.of([` `])}),n)return Qu(e,n,r,a);if(r&&!r.main.eq(i)){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=Uu(e.state.facet(su).map(t=>t(e)),r))),e.dispatch({selection:r,scrollIntoView:t,userEvent:n}),!0}else return!1}function Qu(e,t,n,r=-1){if(Y.ios&&e.inputState.flushIOSKey(t))return!0;let i=e.state.selection.main;if(Y.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&&Sc(e.contentDOM,`Enter`,13)||(t.from==i.from-1&&t.to==i.to&&t.insert.length==0||r==8&&t.insert.lengthi.head)&&Sc(e.contentDOM,`Backspace`,8)||t.from==i.from&&t.to==i.to+1&&t.insert.length==0&&Sc(e.contentDOM,`Delete`,46)))return!0;let a=t.insert.toString();e.inputState.composing>=0&&e.inputState.composing++;let o,s=()=>o||=$u(e,t,n);return e.state.facet(Vl).some(n=>n(e,t.from,t.to,a,s))||e.dispatch(s()),!0}function $u(e,t,n){let r,i=e.state,a=i.selection.main,o=-1;if(t.from==t.to&&t.froma.to){let n=t.fromt(e)),r,n);t.from==s&&(o=s)}if(o>-1)r={changes:t,selection:q.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.fromt.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&&_u(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?q.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 ed(e,t,n,r){let i=Math.min(e.length,t.length),a=0;for(;a0&&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=o?a-n:0;a-=e,s=a+(s-o),o=a}else if(s=s?a-n:0;a-=e,o=a+(o-s),s=a}return{from:a,toA:o,toB:s}}function td(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 Yu(n,r)),(i!=n||a!=r)&&t.push(new Yu(i,a))),t}function nd(e,t){if(e.length==0)return null;let n=e[0].pos,r=e.length==2?e[1].pos:n;return n>-1&&r>-1?q.single(n+t,r+t):null}var rd=class{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.pendingIOSKey=void 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,Y.safari&&e.contentDOM.addEventListener(`input`,()=>null),Y.gecko&&Hd(e.contentDOM.ownerDocument)}handleEvent(e){!gd(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=ad(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&&cd.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),Y.android&&Y.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return Y.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=od.find(t=>t.keyCode==e.keyCode))&&!e.ctrlKey||sd.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key==`Enter`&&e&&e.from0?!0:Y.safari&&!Y.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 id(e,t){return(n,r)=>{try{return t.call(e,r,n)}catch(e){Zl(n.state,e)}}}function ad(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(id(t.value,i))}if(i)for(let e in i){let r=i[e];r&&n(e).observers.push(id(t.value,r))}}for(let e in _d)n(e).handlers.push(_d[e]);for(let e in vd)n(e).observers.push(vd[e]);return t}var od=[{key:`Backspace`,keyCode:8,inputType:`deleteContentBackward`},{key:`Enter`,keyCode:13,inputType:`insertParagraph`},{key:`Enter`,keyCode:13,inputType:`insertLineBreak`},{key:`Delete`,keyCode:46,inputType:`deleteContentForward`}],sd=`dthko`,cd=[16,17,18,20,91,92,224,225],ld=6;function ud(e){return Math.max(0,e)*.7+8}function dd(e,t){return Math.max(Math.abs(e.clientX-t.clientX),Math.abs(e.clientY-t.clientY))}var fd=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=gc(e.contentDOM),this.atoms=e.state.facet(su).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(ls.allowMultipleSelections)&&pd(e,t),this.dragging=hd(e,t)&&jd(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&&dd(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=du(this.view);e.clientX-s.left<=r+ld?t=-ud(r-e.clientX):e.clientX+s.right>=a-ld&&(t=ud(e.clientX-a)),e.clientY-s.top<=i+ld?n=-ud(i-e.clientY):e.clientY+s.bottom>=o-ld&&(n=ud(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=Uu(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 pd(e,t){let n=e.state.facet(Il);return n.length?n[0](t):Y.mac?t.metaKey:t.ctrlKey}function md(e,t){let n=e.state.facet(Ll);return n.length?n[0](t):Y.mac?!t.altKey:!t.ctrlKey}function hd(e,t){let{main:n}=e.state.selection;if(n.empty)return!1;let r=rc(e.root);if(!r||r.rangeCount==0)return!0;let i=r.getRangeAt(0).getClientRects();for(let e=0;e=t.clientX&&n.top<=t.clientY&&n.bottom>=t.clientY)return!0}return!1}function gd(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=jc.get(n))&&r.ignoreEvent(t))return!1;return!0}var _d=Object.create(null),vd=Object.create(null),yd=Y.ie&&Y.ie_version<15||Y.ios&&Y.webkit_version<604;function bd(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(),Sd(e,n.value)},50)}function xd(e,t,n){for(let r of e.facet(t))n=r(n,e);return n}function Sd(e,t){t=xd(e.state,Ul,t);let{state:n}=e,r,i=1,a=n.toText(t),o=a.lines==n.selection.ranges.length;if(Ld!=null&&n.selection.ranges.every(e=>e.empty)&&Ld==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:q.cursor(r.from+c.length)}})}else r=o?n.changeByRange(e=>{let t=a.line(i++);return{changes:{from:e.from,to:e.to,insert:t.text},range:q.cursor(e.from+t.length)}}):n.replaceSelection(a);e.dispatch(r,{userEvent:`input.paste`,scrollIntoView:!0})}vd.scroll=e=>{e.inputState.lastScrollTop=e.scrollDOM.scrollTop,e.inputState.lastScrollLeft=e.scrollDOM.scrollLeft},_d.keydown=(e,t)=>(e.inputState.setSelectionOrigin(`select`),t.keyCode==27&&e.inputState.tabFocusMode!=0&&(e.inputState.tabFocusMode=Date.now()+2e3),!1),vd.touchstart=(e,t)=>{e.inputState.lastTouchTime=Date.now(),e.inputState.setSelectionOrigin(`select.pointer`)},vd.touchmove=e=>{e.inputState.setSelectionOrigin(`select.pointer`)},_d.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(Rl))if(n=r(e,t),n)break;if(!n&&t.button==0&&(n=Md(e,t)),n){let r=!e.hasFocus;e.inputState.startMouseSelection(new fd(e,t,n,r)),r&&e.observer.ignore(()=>{yc(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 Cd(e,t,n,r){if(r==1)return q.cursor(t,n);if(r==2)return wu(e.state,t,n);{let n=sl.find(e.docView,t),r=e.state.doc.lineAt(n?n.posAtEnd:t),i=n?n.posAtStart:r.from,a=n?n.posAtEnd:r.to;return at>=n.top&&t<=n.bottom&&e>=n.left&&e<=n.right;function Td(e,t,n,r){let i=sl.find(e.docView,t);if(!i)return 1;let a=t-i.posAtStart;if(a==0)return 1;if(a==i.length)return-1;let o=i.coordsAt(a,-1);if(o&&wd(n,r,o))return-1;let s=i.coordsAt(a,1);return s&&wd(n,r,s)?1:o&&o.bottom>=r?-1:1}function Ed(e,t){let n=e.posAtCoords({x:t.clientX,y:t.clientY},!1);return{pos:n,bias:Td(e,n,t.clientX,t.clientY)}}var Dd=Y.ie&&Y.ie_version<=11,Od=null,kd=0,Ad=0;function jd(e){if(!Dd)return e.detail;let t=Od,n=Ad;return Od=e,Ad=Date.now(),kd=!t||n>Date.now()-400&&Math.abs(t.clientX-e.clientX)<2&&Math.abs(t.clientY-e.clientY)<2?(kd+1)%3:1}function Md(e,t){let n=Ed(e,t),r=jd(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=Ed(e,t),c,l=Cd(e,s.pos,s.bias,r);if(n.pos!=s.pos&&!a){let t=Cd(e,n.pos,n.bias,r),i=Math.min(t.from,l.from),a=Math.max(t.to,l.to);l=i1&&(c=Nd(i,s.pos))?c:o?i.addRange(l):q.create([l])}}}function Nd(e,t){for(let n=0;n=t)return q.create(e.ranges.slice(0,n).concat(e.ranges.slice(n+1)),e.mainIndex==n?0:e.mainIndex-(e.mainIndex>n?1:0))}return null}_d.dragstart=(e,t)=>{let{selection:{main:n}}=e.state;if(t.target.draggable){let r=e.docView.nearest(t.target);if(r&&r.isWidget){let e=r.posAtStart,t=e+r.length;(e>=n.to||t<=n.from)&&(n=q.range(e,t))}}let{inputState:r}=e;return r.mouseSelection&&(r.mouseSelection.dragging=!0),r.draggedContent=n,t.dataTransfer&&(t.dataTransfer.setData(`Text`,xd(e.state,Wl,e.state.sliceDoc(n.from,n.to))),t.dataTransfer.effectAllowed=`copyMove`),!1},_d.dragend=e=>(e.inputState.draggedContent=null,!1);function Pd(e,t,n,r){if(n=xd(e.state,Ul,n),!n)return;let i=e.posAtCoords({x:t.clientX,y:t.clientY},!1),{draggedContent:a}=e.inputState,o=r&&a&&md(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}_d.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&&Pd(e,t,r.filter(e=>e!=null).join(e.state.lineBreak),!1)};for(let e=0;e{/[\x00-\x08\x0e-\x1f]{2}/.test(t.result)||(r[e]=t.result),a()},t.readAsText(n[e])}return!0}else{let n=t.dataTransfer.getData(`Text`);if(n)return Pd(e,t,n,!0),!0}return!1},_d.paste=(e,t)=>{if(e.state.readOnly)return!0;e.observer.flush();let n=yd?null:t.clipboardData;return n?(Sd(e,n.getData(`text/plain`)||n.getData(`text/uri-list`)),!0):(bd(e),!1)};function Fd(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 Id(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:xd(e,Wl,t.join(e.lineBreak)),ranges:n,linewise:r}}var Ld=null;_d.copy=_d.cut=(e,t)=>{let{text:n,ranges:r,linewise:i}=Id(e.state);if(!n&&!i)return!1;Ld=i?n:null,t.type==`cut`&&!e.state.readOnly&&e.dispatch({changes:r,scrollIntoView:!0,userEvent:`delete.cut`});let a=yd?null:t.clipboardData;return a?(a.clearData(),a.setData(`text/plain`,n),!0):(Fd(e,n),!1)};var Rd=Go.define();function zd(e,t){let n=[];for(let r of e.facet(Hl)){let i=r(e,t);i&&n.push(i)}return n.length?e.update({effects:n,annotations:Rd.of(!0)}):null}function Bd(e){setTimeout(()=>{let t=e.hasFocus;if(t!=e.inputState.notifiedFocused){let n=zd(e.state,t);n?e.dispatch(n):e.update([])}},10)}vd.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),Bd(e)},vd.blur=e=>{e.observer.clearSelectionRange(),Bd(e)},vd.compositionstart=vd.compositionupdate=e=>{e.observer.editContext||(e.inputState.compositionFirstChange??(e.inputState.compositionFirstChange=!0),e.inputState.composing<0&&(e.inputState.composing=0))},vd.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,Y.chrome&&Y.android?e.observer.flushSoon():e.inputState.compositionPendingChange?Promise.resolve().then(()=>e.observer.flush()):setTimeout(()=>{e.inputState.composing<0&&e.docView.hasComposition&&e.update([])},50))},vd.contextmenu=e=>{e.inputState.lastContextMenu=Date.now()},_d.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 Qu(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(Y.chrome&&Y.android&&(n=od.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 Y.ios&&t.inputType==`deleteContentForward`&&e.observer.flushSoon(),Y.safari&&t.inputType==`insertText`&&e.inputState.composing>=0&&setTimeout(()=>vd.compositionend(e,t),20),!1};var Vd=new Set;function Hd(e){Vd.has(e)||(Vd.add(e),e.addEventListener(`copy`,()=>{}),e.addEventListener(`cut`,()=>{}))}var Ud=[`pre-wrap`,`normal`,`pre-line`,`break-spaces`],Wd=!1;function Gd(){Wd=!1}var Kd=class{constructor(e){this.lineWrapping=e,this.doc=Wa.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 Ud.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let n=0;n-1,s=Math.round(t)!=Math.round(this.lineHeight)||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;e0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>Xd&&(Wd=!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,Yd.ByPosNoHeight,n.setDoc(t),0,0),f=d.to>=c?d:i.lineAt(c,Yd.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--,sa*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=i&&a(this.blockAt(0,n,r,i))}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more&&this.setHeight(r.heights[r.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}},ef=class e extends $d{constructor(e,t){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,t,n,r){return new Jd(r,this.length,n,this.height,this.breaks)}replace(t,n,r){let i=r[0];return r.length==1&&(i instanceof e||i instanceof tf&&i.flags&4)&&Math.abs(this.length-i.length)<10?(i instanceof tf?i=new e(i.length,this.height):i.height=this.height,this.outdated||(i.outdated=!1),i):Zd.of(r)}updateHeight(e,t=0,n=!1,r){return r&&r.from<=t&&r.more?this.setHeight(r.heights[r.index++]):(n||this.outdated)&&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:``})`}},tf=class e extends Zd{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+(e0){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 Zd.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++];s==-1?s=n:Math.abs(n-s)>=Xd&&(s=-2);let a=new ef(e,n);a.outdated=!1,r.push(a),o+=e+1}o<=a&&r.push(null,new e(a-o).updateHeight(t,o));let c=Zd.of(r);return(s<0||Math.abs(c.height-this.height)>=Xd||Math.abs(s-this.heightMetrics(t,n).perLine)>=Xd)&&(Wd=!0),Qd(this,c)}else (r||this.outdated)&&(this.setHeight(t.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}},nf=class extends Zd{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 eo))return c;let l=t==Yd.ByPosNoHeight?Yd.ByPosNoHeight:Yd.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.right.forEachLine(e,t,n,o,s,a);else{let c=this.lineAt(s,Yd.ByPos,n,r,i);e=e&&c.from<=t&&a(c),t>c.to&&this.right.forEachLine(c.to+1,t,n,o,s,a)}}replace(e,t,n){let r=this.left.length+this.break;if(tthis.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&&rf(i,a-1),t=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);e2*t.size||t.size>2*e.size?Zd.of(this.break?[e,null,t]:[e,t]):(this.left=Qd(this.left,e),this.right=Qd(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 rf(e,t){let n,r;e[t]==null&&(n=e[t-1])instanceof tf&&(r=e[t+1])instanceof tf&&e.splice(t-1,3,new tf(n.length+1+r.length))}var af=5,of=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 ef?n.length+=e-this.pos:(e>this.pos||!this.isCovered)&&this.nodes.push(new ef(e-this.pos,-1)),this.writtenTo=e,t>e&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,n){if(e=af)&&this.addLineDeco(r,i,a)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenToe&&this.nodes.push(new ef(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,t){let n=new tf(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 ef)return e;let t=new ef(0,-1);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos+=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 ef)&&!this.isCovered?this.nodes.push(new ef(0,-1)):(this.writtenTon.clientHeight||n.scrollWidth>n.clientWidth)&&r.overflow!=`visible`){let r=n.getBoundingClientRect();a=Math.max(a,r.left),o=Math.min(o,r.right),s=Math.max(s,r.top),c=Math.min(t==e.parentNode?i.innerHeight:c,r.bottom)}t=r.position==`absolute`||r.position==`fixed`?n.offsetParent:n.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 uf(e){let t=e.getBoundingClientRect(),n=e.ownerDocument.defaultView||window;return t.left0&&t.top0}function df(e,t){let n=e.getBoundingClientRect();return{left:0,right:n.right-n.left,top:t,bottom:n.bottom-(n.top+t)}}var ff=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;ntypeof e!=`function`&&e.class==`cm-lineWrapping`)),this.stateDeco=e.facet(au).filter(e=>typeof e!=`function`),this.heightMap=Zd.empty().applyChanges(this.stateDeco,Wa.empty,this.heightOracle.setDoc(e.doc),[new pu(0,0,0,e.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=el.set(this.lineGaps.map(e=>e.draw(this,!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let n=0;n<=1;n++){let 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 hf(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?bf:new xf(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(Sf(e,this.scaler))})}update(e,t=null){this.state=e.state;let n=this.stateDeco;this.stateDeco=this.state.facet(au).filter(e=>typeof e!=`function`);let r=e.changedRanges,i=pu.extendWithRanges(r,sf(n,this.stateDeco,e?e.changes:uo.empty(this.state.doc.length))),a=this.heightMap.height,o=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);Gd(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),(this.heightMap.height!=a||Wd)&&(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.heads.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.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(Kl)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let t=e.contentDOM,n=window.getComputedStyle(t),r=this.heightOracle,i=n.whiteSpace;this.defaultTextDirection=n.direction==`rtl`?pl.RTL:pl.LTR;let a=this.heightOracle.mustRefreshForWrapping(i),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}=mc(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=e.scrollDOM.scrollTop*this.scaleY;this.scrollTop!=f&&(this.scrollAnchorHeight=-1,this.scrollTop=f),this.scrolledToBottom=Ec(e.scrollDOM);let p=(this.printing?df:lf)(t,this.paddingTop),m=p.top-this.pixelViewport.top,h=p.bottom-this.pixelViewport.bottom;this.pixelViewport=p;let g=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(g!=this.inView&&(this.inView=g,g&&(s=!0)),!this.inView&&!this.scrollTarget&&!uf(e.dom))return 0;let _=o.width;if((this.contentDOMWidth!=_||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(_-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,_/o),t),a&&(e.docView.minWidth=0,c|=16)}m>0&&h>0?l=Math.max(m,h):m<0&&h<0&&(l=Math.min(m,h)),Gd();for(let n of this.viewports){let i=n.from==this.viewport.from?t:e.docView.measureVisibleLineHeights(n);this.heightMap=(a?Zd.empty().applyChanges(this.stateDeco,Wa.empty,this.heightOracle,[new pu(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(r,0,a,new qd(n.from,i))}Wd&&(c|=2)}let v=!this.viewportIsAppropriate(this.viewport,l)||this.scrollTarget&&(this.scrollTarget.range.headthis.viewport.to);return v&&(c&2&&(c|=this.updateScaler()),this.viewport=this.getViewport(l,this.scrollTarget),c|=this.updateForViewport()),(c&2||v)&&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 hf(r.lineAt(a-n*1e3,Yd.ByHeight,i,0,0).from,r.lineAt(o+(1-n)*1e3,Yd.ByHeight,i,0,0).to);if(t){let{head:e}=t.range;if(es.to){let n=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),a=r.lineAt(e,Yd.ByPos,i,0,0),o;o=t.y==`center`?(a.top+a.bottom)/2-n/2:t.y==`start`||t.y==`nearest`&&e=o+Math.max(10,Math.min(n,250)))&&r>a-2*1e3&&i>1,a=r<<1;if(this.defaultTextDirection!=pl.LTR&&!n)return[];let o=[],s=(r,a,c,l)=>{if(a-rr&&ee.from>=c.from&&e.to<=c.to&&Math.abs(e.from-r)e.fromt));if(!f){if(ae.from<=a&&e.to>=a)){let e=t.moveToLineBoundary(q.cursor(a),!1,!0).head;e>r&&(a=e)}let e=this.gapSize(c,r,a,l);f=new ff(r,a,e,n||e<2e6?e:2e6)}o.push(f)},c=t=>{if(t.length2e6)for(let n of e)n.from>=t.from&&n.fromt.from&&s(t.from,c,t,i),le.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let n=[];hs.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=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||Sf(this.heightMap.lineAt(e,Yd.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)||Sf(this.heightMap.lineAt(this.scaler.fromDOM(e),Yd.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return Sf(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}},hf=class{constructor(e,t){this.from=e,this.to=t}};function gf(e,t,n){let r=[],i=e,a=0;return hs.spans(n,e,t,{span(){},point(e,t){e>i&&(r.push({from:i,to:e}),a+=e-i),i=t}},20),i=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 vf(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 yf(e,t){for(let n of e)if(t(n))return n}var bf={toDOM(e){return e},fromDOM(e){return e},scale:1,eq(e){return e==this}},xf=class e{constructor(e,t,n){let r=0,i=0,a=0;this.viewports=n.map(({from:n,to:i})=>{let a=t.lineAt(n,Yd.ByPos,e,0,0).top,o=t.lineAt(i,Yd.ByPos,e,0,0).bottom;return r+=o-a,{from:n,to:i,top:a,bottom:o,domTop:0,domBottom:0}}),this.scale=(7e6-r)/(t.height-r);for(let e of this.viewports)e.domTop=a+(e.top-i)*this.scale,a=e.domBottom=e.domTop+(e.bottom-e.top),i=e.bottom}toDOM(e){for(let t=0,n=0,r=0;;t++){let i=te.from==t.viewports[n].from&&e.to==t.viewports[n].to):!1}};function Sf(e,t){if(t.scale==1)return e;let n=t.toDOM(e.top),r=t.toDOM(e.bottom);return new Jd(e.from,e.length,n,r-n,Array.isArray(e._content)?e._content.map(e=>Sf(e,t)):e._content)}var Cf=J.define({combine:e=>e.join(` `)}),wf=J.define({combine:e=>e.indexOf(!0)>-1}),Tf=Ps.newName(),Ef=Ps.newName(),Df=Ps.newName(),Of={"&light":`.`+Ef,"&dark":`.`+Df};function kf(e,t,n){return new Ps(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 Af=kf(`.`+Tf,{"&":{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":{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-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`},"&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:`text-top`,height:`1em`,width:0,display:`inline`},".cm-placeholder":{color:`#888`,display:`inline-block`,verticalAlign:`top`,userSelect:`none`},".cm-highlightSpace":{backgroundImage:`radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)`,backgroundPosition:`center`},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,')`,backgroundSize:`auto 100%`,backgroundPosition:`right 90%`,backgroundRepeat:`no-repeat`},".cm-trailingSpace":{backgroundColor:`#ff332255`},".cm-button":{verticalAlign:`middle`,color:`inherit`,fontSize:`70%`,padding:`.2em 1em`,borderRadius:`1px`},"&light .cm-button":{backgroundImage:`linear-gradient(#eff1f5, #d9d9df)`,border:`1px solid #888`,"&:active":{backgroundImage:`linear-gradient(#b4b4b4, #d0d3d6)`}},"&dark .cm-button":{backgroundImage:`linear-gradient(#393939, #111)`,border:`1px solid #888`,"&:active":{backgroundImage:`linear-gradient(#111, #333)`}},".cm-textfield":{verticalAlign:`middle`,color:`inherit`,fontSize:`70%`,border:`1px solid silver`,padding:`.2em .5em`},"&light .cm-textfield":{backgroundColor:`white`},"&dark .cm-textfield":{border:`1px solid #555`,backgroundColor:`inherit`}},Of),jf={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},Mf=Y.ie&&Y.ie_version<=11,Nf=class{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new _c,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);(Y.ie&&Y.ie_version<=11||Y.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&&Y.android&&e.constructor.EDIT_CONTEXT!==!1&&!(Y.chrome&&Y.chrome_version<126)&&(this.editContext=new Lf(e),e.state.facet(Ql)&&(e.contentDOM.editContext=this.editContext.editContext)),Mf&&(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{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),e.length>0&&e[e.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent(`Event`)))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(e=>{e.length>0&&e[e.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent(`Event`))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers(`scroll`,e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.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(Ql)?n.root.activeElement!=this.dom:!ac(this.dom,r))return;let i=r.anchorNode&&n.docView.nearest(r.anchorNode);if(i&&i.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(Y.ie&&Y.ie_version<=11||Y.android&&Y.chrome)&&!n.state.selection.main.empty&&r.focusNode&&sc(r.focusNode,r.focusOffset,r.anchorNode,r.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=rc(e.root);if(!t)return!1;let n=Y.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&If(this.view,t)||t;if(!n||this.selectionRange.eq(n))return!1;let r=ac(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime{let e=this.delayedAndroidKey;e&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=e.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&e.force&&Sc(this.dom,e.key,e.keyCode))})),(!this.delayedAndroidKey||e==`Enter`)&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,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&&ac(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 Xu(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.readChange();if(!t)return this.view.requestMeasure(),!1;let n=this.view.state,r=Zu(this.view,t);return this.view.state==n&&(t.domChanged||t.newSel&&!t.newSel.main.eq(this.view.state.selection.main))&&this.view.update([]),r}readMutation(e){let t=this.view.docView.nearest(e.target);if(!t||t.ignoreMutation(e))return null;if(t.markDirty(e.type==`attributes`),e.type==`attributes`&&(t.flags|=4),e.type==`childList`){let n=Pf(t,e.previousSibling||e.target.previousSibling,-1),r=Pf(t,e.nextSibling||e.target.nextSibling,1);return{from:n?t.posAfter(n):t.posAtStart,to:r?t.posBefore(r):t.posAtEnd,typeOver:!1}}else if(e.type==`characterData`)return{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue};else return 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(Ql)!=e.state.facet(Ql)&&(e.view.contentDOM.editContext=e.state.facet(Ql)?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 Pf(e,t,n){for(;t;){let r=jc.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 Ff(e,t){let n=t.startContainer,r=t.startOffset,i=t.endContainer,a=t.endOffset,o=e.docView.domAtPos(e.state.selection.main.anchor);return sc(o.node,o.offset,i,a)&&([n,r,i,a]=[i,a,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:a}}function If(e,t){if(t.getComposedRanges){let n=t.getComposedRanges(e.root)[0];if(n)return Ff(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?Ff(e,n):null}var Lf=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)});for(let n in 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&&ithis.to&&(s=i);let l=ed(e.state.sliceDoc(o,s),n.text,(c?r.from:r.to)-o,c?`end`:null);if(!l){let t=q.single(this.toEditorPos(n.selectionStart),this.toEditorPos(n.selectionEnd));t.main.eq(r)||e.dispatch({selection:t,userEvent:`select`});return}let u={from:l.from+o,to:l.toA+o,insert:Wa.of(n.text.slice(l.from,l.toB).split(` +`))};if((Y.mac||Y.android)&&u.from==a-1&&/^\. ?$/.test(n.text)&&e.contentDOM.getAttribute(`autocorrect`)==`off`&&(u={from:o,to:s,insert:Wa.of([n.text.replace(`.`,` `)])}),this.pendingContextChange=u,!e.state.readOnly){let t=this.to-this.from+(u.to-u.from+u.insert.length);Qu(e,u,q.single(this.toEditorPos(n.selectionStart,t),this.toEditorPos(n.selectionEnd,t)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),u.from=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{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{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)}},this.handlers)t.addEventListener(n,this.handlers[n]);this.measureReq={read:e=>{this.editContext.updateControlBounds(e.contentDOM.getBoundingClientRect());let t=rc(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}else r=null,this.revertPending(e.state);if(i+=t,a+=t,a<=this.from)this.from+=l,this.to+=l;else if(ithis.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.to1e4*3)}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])}},X=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.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||Cc(e.parent)||document,this.viewState=new mf(e.state||ls.create(e)),e.scrollTo&&e.scrollTo.is(Yl)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(eu).map(e=>new nu(e));for(let e of this.plugins)e.update(this);this.observer=new Nf(this),this.inputState=new rd(this),this.inputState.ensureHandlers(this.plugins),this.docView=new hu(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),document.fonts?.ready&&document.fonts.ready.then(()=>this.requestMeasure())}dispatch(...e){let t=e.length==1&&e[0]instanceof Yo?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw Error(`Calls to EditorView.update are not allowed while an update is in progress`);let t=!1,n=!1,r,i=this.state;for(let t of e){if(t.startState!=i)throw RangeError(`Trying to update state with a transaction that doesn't start from the previous state.`);i=t.state}if(this.destroyed){this.viewState.state=i;return}let a=this.hasFocus,o=0,s=null;e.some(e=>e.annotation(Rd))?(this.inputState.notifiedFocused=a,o=1):a!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=a,s=zd(i,a),s||(o=1));let c=this.observer.delayedAndroidKey,l=null;if(c?(this.observer.clearDelayedAndroidKey(),l=this.observer.readChange(),(l&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(l=null)):this.observer.clear(),i.facet(ls.phrases)!=this.state.facet(ls.phrases))return this.setState(i);r=mu.create(this,i,e),r.flags|=o;let u=this.viewState.scrollTarget;try{this.updateState=2;for(let t of e){if(u&&=u.map(t.changes),t.scrollIntoView){let{main:e}=t.state.selection;u=new Jl(e.empty?e:q.cursor(e.head,e.head>e.anchor?-1:1))}for(let e of t.effects)e.is(Yl)&&(u=e.value.clip(this.state))}this.viewState.update(r,u),this.bidiCache=Bf.update(this.bidiCache,r.changes),r.empty||(this.updatePlugins(r),this.inputState.update(r)),t=this.docView.update(r),this.state.facet(fu)!=this.styleModules&&this.mountStyles(),n=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(e=>e.isUserEvent(`select.pointer`)))}finally{this.updateState=0}if(r.startState.facet(Cf)!=r.state.facet(Cf)&&(this.viewState.mustMeasureContent=!0),(t||n||u||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!r.empty)for(let e of this.state.facet(Bl))try{e(r)}catch(e){Zl(this.state,e,`update listener`)}(s||l)&&Promise.resolve().then(()=>{s&&this.state==s.startState&&this.dispatch(s),l&&!Zu(this,l)&&c.force&&Sc(this.contentDOM,c.key,c.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 mf(e),this.plugins=e.facet(eu).map(e=>new nu(e)),this.pluginMap.clear();for(let e of this.plugins)e.update(this);this.docView.destroy(),this.docView=new hu(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(eu),n=e.state.facet(eu);if(t!=n){let r=[];for(let i of n){let n=t.indexOf(i);if(n<0)r.push(new nu(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-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.scrollDOM,r=n.scrollTop*this.scaleY,{scrollAnchorPos:i,scrollAnchorHeight:a}=this.viewState;Math.abs(r-this.viewState.scrollTop)>1&&(a=-1),this.viewState.scrollAnchorHeight=-1;try{for(let e=0;;e++){if(a<0)if(Ec(n))i=-1,a=this.viewState.heightMap.height;else{let e=this.viewState.scrollAnchorAt(r);i=e.from,a=e.top}this.updateState=1;let o=this.viewState.measure(this);if(!o&&!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 s=[];o&4||([this.measureRequests,s]=[s,this.measureRequests]);let c=s.map(e=>{try{return e.read(this)}catch(e){return Zl(this.state,e),zf}}),l=mu.create(this,this.state,[]),u=!1;l.flags|=o,t?t.flags|=o:t=l,this.updateState=2,l.empty||(this.updatePlugins(l),this.inputState.update(l),this.updateAttrs(),u=this.docView.update(l),u&&this.docViewUpdate());for(let e=0;e1||e<-1){r+=e,n.scrollTop=r/this.scaleY,a=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let e of this.state.facet(Bl))e(t)}get themeClasses(){return Tf+` `+(this.state.facet(wf)?Df:Ef)+` `+this.state.facet(Cf)}updateAttrs(){let e=Vf(this,ru,{class:`cm-editor`+(this.hasFocus?` cm-focused `:` `)+this.themeClasses}),t={spellcheck:`false`,autocorrect:`off`,autocapitalize:`off`,writingsuggestions:`false`,translate:`no`,contenteditable:this.state.facet(Ql)?`true`:`false`,class:`cm-content`,style:`${Y.tabSize}: ${this.state.tabSize}`,role:`textbox`,"aria-multiline":`true`};this.state.readOnly&&(t[`aria-readonly`]=`true`),Vf(this,iu,t);let n=this.observer.ignore(()=>{let n=Xc(this.contentDOM,this.contentAttrs,t),r=Xc(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=``),n=!1;let e=this.announceDOM.appendChild(document.createElement(`div`));e.textContent=t.value}}mountStyles(){this.styleModules=this.state.facet(fu);let t=this.state.facet(e.cspNonce);Ps.mount(this.root,this.styleModules.concat(Af).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;tt.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 Wu(this,e,zu(this,e,t,n))}moveByGroup(e,t){return Wu(this,e,zu(this,e,t,t=>Bu(this,e.head,t)))}visualLineSide(e,t){let n=this.bidiSpans(e),r=this.textDirectionAt(e.from),i=n[t?n.length-1:0];return q.cursor(i.side(t,r)+e.from,i.forward(!t,r)?1:-1)}moveToLineBoundary(e,t,n=!0){return Ru(this,e,t,n)}moveVertically(e,t,n){return Wu(this,e,Vu(this,e,t,n))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){return this.readMeasured(),Mu(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let n=this.docView.coordsAt(e,t);if(!n||n.left==n.right)return n;let r=this.state.doc.lineAt(e),i=this.bidiSpans(r),a=i[Cl.find(i,e-r.from,-1,t)];return fc(n,a.dir==pl.LTR==t>0)}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(Gl)||ethis.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Rf)return Ml(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||wl(r.isolates,n=lu(this,e))))return r.order;n||=lu(this,e);let r=jl(e.text,t,n);return this.bidiCache.push(new Bf(e.from,e.to,t,n,!0,r)),r}get hasFocus(){return(this.dom.ownerDocument.hasFocus()||Y.safari&&this.inputState?.lastContextMenu>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{yc(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.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Yl.of(new Jl(typeof e==`number`?q.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,n=this.viewState.scrollAnchorAt(e);return Yl.of(new Jl(q.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 tu.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return tu.define(()=>({}),{eventObservers:e})}static theme(e,t){let n=Ps.newName(),r=[Cf.of(n),fu.of(kf(`.${n}`,e))];return t&&t.dark&&r.push(wf.of(!0)),r}static baseTheme(e){return Ao.lowest(fu.of(kf(`.`+Tf,e,Of)))}static findFromDOM(e){let t=e.querySelector(`.cm-content`);return(t&&jc.get(t)||jc.get(e))?.rootView?.view||null}};X.styleModule=fu,X.inputHandler=Vl,X.clipboardInputFilter=Ul,X.clipboardOutputFilter=Wl,X.scrollHandler=ql,X.focusChangeEffect=Hl,X.perLineTextDirection=Gl,X.exceptionSink=zl,X.updateListener=Bl,X.editable=Ql,X.mouseSelectionStyle=Rl,X.dragMovesSelection=Ll,X.clickAddsSelectionRange=Il,X.decorations=au,X.outerDecorations=ou,X.atomicRanges=su,X.bidiIsolatedRanges=cu,X.scrollMargins=uu,X.darkTheme=wf,X.cspNonce=J.define({combine:e=>e.length?e[0]:``}),X.contentAttributes=iu,X.editorAttributes=ru,X.lineWrapping=X.contentAttributes.of({class:`cm-lineWrapping`}),X.announce=Jo.define();var Rf=4096,zf={},Bf=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:pl.LTR;for(let a=Math.max(0,t.length-10);a=0;i--){let t=r[i],a=typeof t==`function`?t(e):t;a&&qc(a,n)}return n}var Hf=Y.mac?`mac`:Y.windows?`win`:Y.linux?`linux`:`key`;function Uf(e,t){let n=e.split(/-(?!$)/),r=n[n.length-1];r==`Space`&&(r=` `);let i,a,o,s;for(let e=0;ee.concat(t),[]))),n}function Yf(e,t,n){return ep(Jf(e.state),t,e,n)}var Xf=null,Zf=4e3;function Qf(e,t=Hf){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=>Uf(e,t));for(let t=1;t{let r=Xf={view:t,prefix:n,scope:e};return setTimeout(()=>{Xf==r&&(Xf=null)},Zf),!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,$f))}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 $f=null;function ep(e,t,n,r){$f=t;let i=Us(t),a=oo(io(i,0))==i.length&&i!=` `,o=``,s=!1,c=!1,l=!1;Xf&&Xf.view==n&&Xf.scope==r&&(o=Xf.prefix+` `,cd.indexOf(t.keyCode)<0&&(c=!0,Xf=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+Wf(i,t,!a)])?s=!0:a&&(t.altKey||t.metaKey||t.ctrlKey)&&!(Y.windows&&t.ctrlKey&&t.altKey)&&!(Y.mac&&t.altKey&&!(t.ctrlKey||t.metaKey))&&(p=Ls[t.keyCode])&&p!=i?(d(f[o+Wf(p,t,!0)])||t.shiftKey&&(m=Rs[t.keyCode])!=i&&m!=p&&d(f[o+Wf(m,t,!1)]))&&(s=!0):a&&t.shiftKey&&d(f[o+Wf(i,t,!0)])&&(s=!0),!s&&d(f._any)&&(s=!0)),c&&(s=!0),s&&l&&t.stopPropagation(),$f=null,s}var tp=J.define({combine(e){return us(e,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function np(e){return e.facet(tp)}/x/.unicode;var rp=`-10000px`,ip=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;nt[n]=e),t.length=o.length),this.input=r,this.tooltips=i,this.tooltipViews=a,!0}};function ap(e){let t=e.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:t.clientHeight,right:t.clientWidth}}var op=J.define({combine:e=>({position:Y.ios?`absolute`:e.find(e=>e.position)?.position||`fixed`,parent:e.find(e=>e.parent)?.parent||null,tooltipSpace:e.find(e=>e.tooltipSpace)?.tooltipSpace||ap})}),sp=new WeakMap,cp=tu.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(op);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 ip(e,fp,(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(op);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=rp,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;if(this.position==`fixed`&&this.manager.tooltipViews.length){let{dom:e}=this.manager.tooltipViews[0];if(Y.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);let r=this.view.scrollDOM.getBoundingClientRect(),i=du(this.view);return{visible:{left:r.left+i.left,top:r.top+i.top,right:r.right-i.right,bottom:r.bottom-i.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(op).tooltipSpace(this.view),scaleX:e,scaleY:t,makeAbsolute:n}}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=Math.min(t.bottom,n.bottom)||u.rightMath.min(t.right,n.right)+.1)){l.style.top=rp;continue}let f=s.arrow?c.dom.querySelector(`.cm-tooltip-arrow`):null,p=f?7:0,m=d.right-d.left,h=sp.get(c)??d.bottom-d.top,g=c.offset||dp,_=this.view.textDirection==pl.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.yn.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(bv&&e.topx&&(x=y?e.top-h-2-p:e.bottom+p+2);if(this.position==`absolute`?(l.style.top=(x-e.parent.top)/i+`px`,lp(l,(v-e.parent.left)/r)):(l.style.top=x/i+`px`,lp(l,v/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=rp}},{eventObservers:{scroll(){this.maybeMeasure()}}});function lp(e,t){let n=parseInt(e.style.left,10);(isNaN(n)||Math.abs(t-n)>1)&&(e.style.left=t+`px`)}var up=X.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`}}}),dp={x:0,y:0},fp=J.define({enables:[cp,up]}),pp=J.define({combine(e){let t,n;for(let r of e)t||=r.topContainer,n||=r.bottomContainer;return{topContainer:t,bottomContainer:n}}});function mp(e,t){let n=e.plugin(hp),r=n?n.specs.indexOf(t):-1;return r>-1?n.panels[r]:null}var hp=tu.fromClass(class{constructor(e){this.input=e.state.facet(vp),this.specs=this.input.filter(e=>e),this.panels=this.specs.map(t=>t(e));let t=e.state.facet(pp);this.top=new gp(e,!0,t.topContainer),this.bottom=new gp(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(pp);this.top.container!=t.topContainer&&(this.top.sync([]),this.top=new gp(e.view,!0,t.topContainer)),this.bottom.container!=t.bottomContainer&&(this.bottom.sync([]),this.bottom=new gp(e.view,!1,t.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let n=e.state.facet(vp);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=>X.scrollMargins.of(t=>{let n=t.plugin(e);return n&&{top:n.top.scrollMargin(),bottom:n.bottom.scrollMargin()}})}),gp=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`,this.dom.style[this.top?`top`:`bottom`]=`0`;let e=this.container||this.view.dom;e.insertBefore(this.dom,this.top?e.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=_p(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=_p(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 _p(e){let t=e.nextSibling;return e.remove(),t}var vp=J.define({enables:hp}),yp=class extends ds{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};yp.prototype.elementClass=``,yp.prototype.toDOM=void 0,yp.prototype.mapMode=co.TrackBefore,yp.prototype.startSide=yp.prototype.endSide=-1,yp.prototype.point=!0;var bp=1024,xp=0,Sp=class{constructor(e,t){this.from=e,this.to=t}},Cp=class{constructor(e={}){this.id=xp++,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=Ep.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};Cp.closedBy=new Cp({deserialize:e=>e.split(` `)}),Cp.openedBy=new Cp({deserialize:e=>e.split(` `)}),Cp.group=new Cp({deserialize:e=>e.split(` `)}),Cp.isolate=new Cp({deserialize:e=>{if(e&&e!=`rtl`&&e!=`ltr`&&e!=`auto`)throw RangeError(`Invalid value for isolate: `+e);return e||`auto`}}),Cp.contextHash=new Cp({perNode:!0}),Cp.lookAhead=new Cp({perNode:!0}),Cp.mounted=new Cp({perNode:!0});var wp=class{constructor(e,t,n){this.tree=e,this.overlay=t,this.parser=n}static get(e){return e&&e.props&&e.props[Cp.mounted.id]}},Tp=Object.create(null),Ep=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):Tp,r=(t.top?1:0)|(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(Cp.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(Cp.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};Ep.none=new Ep(``,Object.create(null),0,8);var Dp=class e{constructor(e){this.types=e;for(let t=0;t0;for(let e=this.cursor(a|Ap.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:Xp(Ep.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(Ep.none,t,n,r)))}static build(e){return qp(e)}};jp.empty=new jp(Ep.none,[],[],0);var Mp=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)}},Np=class e{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return Ep.none}toString(){let e=[];for(let t=0;t0));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=t&&nt;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function Fp(e,t,n,r){for(;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to0?s.length:-1;t!=l;t+=n){let l=s[t],u=c[t]+o.from;if(Pp(i,r,u,u+l.length)){if(l instanceof Np){if(a&Ap.ExcludeBuffers)continue;let e=l.findChild(0,l.buffer.length,n,r-u,i);if(e>-1)return new Vp(new Bp(o,l,t,u),null,e)}else if(a&Ap.IncludeAnonymous||!l.type.isAnonymous||Kp(l)){let s;if(!(a&Ap.IgnoreMounts)&&(s=wp.get(l))&&!s.overlay)return new e(s.tree,u,t,o);let c=new e(l,u,t,o);return a&Ap.IncludeAnonymous||!c.type.isAnonymous?c:c.nextChild(n<0?l.children.length-1:0,n,r,i)}}}if(a&Ap.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&Ap.IgnoreOverlays)&&(i=wp.get(this._tree))&&i.overlay){let r=t-this.from;for(let{from:t,to:a}of i.overlay)if((n>0?t<=r:t=r:a>r))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 Rp(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 zp(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 Bp=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},Vp=class e extends Ip{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&Ap.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 jp(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function Hp(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;rn.from||i.to=t){let o=new Lp(a.tree,a.overlay[0].from+e.from,-1,e);(i||=[r]).push(Fp(o,t,n,!1))}}return i?Hp(i):r}var Gp=class{get name(){return this.type.name}constructor(e,t=0){if(this.mode=t,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Lp)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 Lp?(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&Ap.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ap.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ap.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)):!1}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-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&Ap.IncludeAnonymous||e instanceof Np||!e.type.isAnonymous||Kp(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to=0;){for(let 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=0;i--){if(i<0)return zp(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 Kp(e){return e.children.some(e=>e instanceof Np||!e.type.isAnonymous||Kp(e))}function qp(e){let{buffer:t,nodeSet:n,maxBufferLength:r=bp,reused:i=[],minRepeatType:a=n.types.length}=e,o=Array.isArray(t)?new Mp(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,E=c;if(w<0)if(o.next(),w==-1){let t=i[x];_.push(t),v.push(S-e);return}else if(w==-3){c=x;return}else if(w==-4){l=x;return}else throw RangeError(`Unrecognized record size: ${w}`);let D=s[x],O,k,A=S-e;if(C-S<=r&&(k=h(o.pos-t,y))){let t=new Uint16Array(k.size-k.skip),r=o.pos-k.size,i=t.length;for(;o.pos>r;)i=g(k.start,t,i);O=new Np(t,C-k.start,n),A=k.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,E),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-1&&s>0){let e=f(D,E);O=Xp(D,t,n,0,t.length,0,C-S,e,e)}else O=m(D,t,n,C-S,T-C,E)}_.push(O),v.push(A)}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=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 Np(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 jp){if(!o&&s.type==e&&s.length==i)return s;(c=s.prop(Cp.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=[Cp.contextHash,a];o=o?[e].concat(o):[e]}if(i>25){let e=[Cp.lookAhead,i];o=o?[e].concat(o):[e]}return new jp(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=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&&r4){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 jp(s[e.topID],_.reverse(),v.reverse(),y)}var Jp=new WeakMap;function Yp(e,t){if(!e.isAnonymous||t instanceof Np||t.type!=e)return 1;let n=Jp.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof jp)){n=1;break}n+=Yp(e,r)}Jp.set(t,n)}return n}function Xp(e,t,n,r,i,a,o,s,c){let l=0;for(let n=r;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(Xp(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 Zp=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 Vp?this.setBuffer(e.context.buffer,e.index,t):e instanceof Lp&&this.map.set(e.tree,t)}get(e){return e instanceof Vp?this.getBuffer(e.context.buffer,e.index):e instanceof Lp?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)}},Qp=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?1:0)|(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=r)for(;o&&o.from=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=anew Sp(e.from,e.to)):[new Sp(0,0)]:[new Sp(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}}},em=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 tm(e){return(t,n,r,i)=>new om(t,e,n,r,i)}var nm=class{constructor(e,t,n,r,i){this.parser=e,this.parse=t,this.overlay=n,this.target=r,this.from=i}};function rm(e){if(!e.length||e.some(e=>e.from>=e.to))throw RangeError(`Invalid inner parse ranges given: `+JSON.stringify(e))}var im=class{constructor(e,t,n,r,i,a,o){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=i,this.target=a,this.prev=o,this.depth=0,this.ranges=[]}},am=new Cp({perNode:!0}),om=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 jp(e.type,e.children,e.positions,e.length,e.propValues.concat([[am,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[Cp.mounted.id]=new wp(t,e.overlay,e.parser),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.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.fromi)&&t.ranges.push({from:i,to:a})}}o=!1}else if(n&&(a=sm(n.ranges,r.from,r.to)))o=a!=2;else if(!r.type.isAnonymous&&(i=this.nest(r,this.input))&&(r.fromnew Sp(e.from-r.from,e.to-r.from)):null,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 Sp(r.from,r.to)),s.from=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=fm(this.ranges,t.ranges);e.length&&(rm(e),this.inner.splice(t.index,0,new nm(t.parser,t.parser.startParse(this.input,mm(t.mounts,e),e),t.ranges.map(e=>new Sp(e.from-t.start,e.to-t.start)),t.target,e[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}};function sm(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 cm(e,t,n,r,i,a){if(t=e&&t.enter(n,1,Ap.IgnoreOverlays|Ap.ExcludeBuffers)||t.next(!1)||(this.done=!0)}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 jp)t=t.children[0];else break}return!1}},dm=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(am)??t.to,this.inner=new um(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(am)??e.to,this.inner=new um(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(Cp.mounted);if(r&&r.parser==t)for(let t=this.fragI;t=e.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:e.from-i.offset,mount:r})}}}return n}};function fm(e,t){let n=null,r=t;for(let i=1,a=0;i=s)break;e.to<=o||(n||(r=n=t.slice()),e.froms&&n.splice(a+1,0,new Sp(s,e.to))):e.to>s?n[a--]=new Sp(s,e.to):n.splice(a--,1))}}return r}function pm(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);enew Sp(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 Qp(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 Qp(s,c,i.tree,-e,a.from>=e||a.openStart,a.to<=o||a.openEnd))}return n}var hm=class e{constructor(e,t,n,r,i,a,o,s,c,l=0,u){this.p=e,this.stack=t,this.state=n,this.reducePos=r,this.pos=i,this.score=a,this.buffer=o,this.bufferBase=s,this.curContext=c,this.lookAhead=l,this.parent=u}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?`!`+this.score:``}`}static start(t,n,r=0){let i=t.parser.context;return new e(t,[],n,r,r,0,[],0,i?new gm(i,i.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){let t=e>>19,n=e&65535,{parser:r}=this.p,i=this.reducePos=2e3&&!this.p.parser.nodeSet.types[n]?.isAnonymous&&(s==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSizeo;)this.stack.pop();this.reduceContext(n,s)}storeNode(e,t,n,r=4,i=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]0&&e.buffer[r-4]==0&&e.buffer[r-1]>-1){if(t==n)return;if(e.buffer[r-2]>=t){e.buffer[r-2]=n;return}}}if(!i||this.pos==n)this.buffer.push(e,t,n,r);else{let i=this.buffer.length;if(i>0&&(this.buffer[i-4]!=0||this.buffer[i-1]<0)){let e=!1;for(let t=i;t>0&&this.buffer[t-2]>n;t-=4)if(this.buffer[t-1]>=0){e=!0;break}if(e)for(;i>0&&this.buffer[i-2]>n;)this.buffer[i]=this.buffer[i-4],this.buffer[i+1]=this.buffer[i-3],this.buffer[i+2]=this.buffer[i-2],this.buffer[i+3]=this.buffer[i-1],i-=4,r>4&&(r-=4)}this.buffer[i]=e,this.buffer[i+1]=t,this.buffer[i+2]=n,this.buffer[i+3]=r}}shift(e,t,n,r){if(e&131072)this.pushState(e&65535,this.pos);else if(e&262144)this.pos=r,this.shiftContext(t,n),t<=this.p.parser.maxNode&&this.buffer.push(t,n,r,4);else{let i=e,{parser:a}=this.p;(r>this.pos||t<=a.maxNode)&&(this.pos=r,a.stateFlag(i,1)||(this.reducePos=r)),this.pushState(i,n),this.shiftContext(t,n),t<=a.maxNode&&this.buffer.push(t,n,r,4)}}apply(e,t,n,r){e&65536?this.reduce(e):this.shift(e,t,n,r)}useNode(e,t){let n=this.p.reused.length-1;(n<0||this.p.reused[n]!=e)&&(this.p.reused.push(e),n++);let r=this.pos;this.reducePos=this.pos=r+e.length,this.pushState(t,r),this.buffer.push(n,r,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let t=this,n=t.buffer.length;for(;n>0&&t.buffer[n-2]>t.reducePos;)n-=4;let r=t.buffer.slice(n),i=t.bufferBase+n;for(;t&&i==t.bufferBase;)t=t.parent;return new e(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,r,i,this.curContext,this.lookAhead,t)}recoverByDelete(e,t){let n=e<=this.p.parser.maxNode;n&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,n?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new _m(this);;){let n=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(n==0)return!1;if(!(n&65536))return!0;t.reduce(n)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let n=[];for(let r=0,i;rt&1&&e==r)||n.push(t[e],r)}t=n}let n=[];for(let e=0;e>19,r=t&65535,i=this.stack.length-n*3;if(i<0||e.getGoto(this.stack[i],r,!1)<0){let e=this.findForcedReduction();if(e==null)return!1;t=e}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],n=(r,i)=>{if(!t.includes(r))return t.push(r),e.allActions(r,t=>{if(!(t&393216))if(t&65536){let n=(t>>19)-i;if(n>1){let r=t&65535,i=this.stack.length-n*3;if(i>=0&&e.getGoto(this.stack[i],r,!1)>=0)return n<<19|65536|r}}else{let e=n(t,i+1);if(e!=null)return e}})};return n(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t0&&this.emitLookAhead()}},gm=class{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}},_m=class{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,n=e>>19;n==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(n-1)*3,this.state=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0)}},vm=class e{constructor(e,t,n){this.stack=e,this.pos=t,this.index=n,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(t,n=t.bufferBase+t.buffer.length){return new e(t,n,n-t.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new e(this.stack,this.pos,this.index)}};function ym(e,t=Uint16Array){if(typeof e!=`string`)return e;let n=null;for(let r=0,i=0;r=92&&t--,t>=34&&t--;let i=t-32;if(i>=46&&(i-=46,n=!0),a+=i,n)break;a*=46}n?n[i++]=a:n=new t(a)}return n}var bm=class{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}},xm=new bm,Sm=class{constructor(e,t){this.input=e,this.ranges=t,this.chunk=``,this.chunkOff=0,this.chunk2=``,this.chunk2Pos=0,this.next=-1,this.token=xm,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let n=this.range,r=this.rangeIndex,i=this.pos+e;for(;in.to:i>=n.to;){if(r==this.ranges.length-1)return null;let e=this.ranges[++r];i+=e.from-n.to,n=e}return i}clipPos(e){if(e>=this.range.from&&ee)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,n,r;if(t>=0&&t=this.chunk2Pos&&nt.to&&(this.chunk2=this.chunk2.slice(0,t.to-n)),r=this.chunk2.charCodeAt(0)}}return n>=this.token.lookAhead&&(this.token.lookAhead=n+1),r}acceptToken(e,t=0){let n=t?this.resolveOffset(t,-1):this.pos;if(n==null||n=this.chunk2Pos&&this.posthis.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk=``,this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=xm,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let n=``;for(let r of this.ranges){if(r.from>=t)break;r.to>e&&(n+=this.input.read(Math.max(r.from,e),Math.min(r.to,t)))}return n}},Cm=class{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:n}=t.p;Em(this.data,e,t,this.id,n.data,n.tokenPrecTable)}};Cm.prototype.contextual=Cm.prototype.fallback=Cm.prototype.extend=!1;var wm=class{constructor(e,t,n){this.precTable=t,this.elseToken=n,this.data=typeof e==`string`?ym(e):e}token(e,t){let n=e.pos,r=0;for(;;){let n=e.next<0,i=e.resolveOffset(1,1);if(Em(this.data,e,t,0,this.data,this.precTable),e.token.value>-1)break;if(this.elseToken==null)return;if(n||r++,i==null)break;e.reset(i,e.token)}r&&(e.reset(n,e.token),e.acceptToken(this.elseToken,r))}};wm.prototype.contextual=Cm.prototype.fallback=Cm.prototype.extend=!1;var Tm=class{constructor(e,t={}){this.token=e,this.contextual=!!t.contextual,this.fallback=!!t.fallback,this.extend=!!t.extend}};function Em(e,t,n,r,i,a){let o=0,s=1<0){let n=e[r];if(c.allows(n)&&(t.token.value==-1||t.token.value==n||Om(n,t.token.value,i,a))){t.acceptToken(n);break}}let r=t.next,l=0,u=e[o+2];if(t.next<0&&u>l&&e[n+u*3-3]==65535){o=e[n+u*3-1];continue scan}for(;l>1,a=n+i+(i<<1),s=e[a],c=e[a+1]||65536;if(r=c)l=i+1;else{o=e[a+2],t.advance();continue scan}}break}}function Dm(e,t,n){for(let r=t,i;(i=e[r])!=65535;r++)if(i==n)return r-t;return-1}function Om(e,t,n,r){let i=Dm(n,r,t);return i<0||Dm(n,r,e)t)&&!r.type.isError)return n<0?Math.max(0,Math.min(r.to-1,t-25)):Math.min(e.length,Math.max(r.from+1,t+25));if(n<0?r.prevSibling():r.nextSibling())break;if(!r.parent())return n<0?0:e.length}}var Mm=class{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?jm(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?jm(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(ee)return this.nextStart=a,null;if(i instanceof jp){if(a==e){if(a=Math.max(this.safeFrom,e)&&(this.trees.push(i),this.start.push(a),this.index.push(0))}else this.index[t]++,this.nextStart=a+i.length}}},Nm=class{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(e=>new bm)}getActions(e){let t=0,n=null,{parser:r}=e.p,{tokenizers:i}=r,a=r.stateSlot(e.state,3),o=e.curContext?e.curContext.hash:0,s=0;for(let r=0;rl.end+25&&(s=Math.max(l.lookAhead,s)),l.value!=0)){let r=t;if(l.extended>-1&&(t=this.addActions(e,l.extended,l.end,t)),t=this.addActions(e,l.value,l.end,t),!c.extend&&(n=l,t>r))break}}for(;this.actions.length>t;)this.actions.pop();return s&&e.setLookAhead(s),!n&&e.pos==this.stream.end&&(n=new bm,n.value=e.p.parser.eofTerm,n.start=n.end=e.pos,t=this.addActions(e,n.value,n.end,t)),this.mainToken=n,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new bm,{pos:n,p:r}=e;return t.start=n,t.end=Math.min(n+1,r.stream.end),t.value=n==r.stream.end?r.parser.eofTerm:0,t}updateCachedToken(e,t,n){let r=this.stream.clipPos(n.pos);if(t.token(this.stream.reset(r,e),n),e.value>-1){let{parser:t}=n.p;for(let r=0;r=0&&n.p.parser.dialect.allows(i>>1)){i&1?e.extended=i>>1:e.value=i>>1;break}}}else e.value=0,e.end=this.stream.clipPos(r+1)}putAction(e,t,n,r){for(let t=0;te.bufferLength*4?new Mm(n,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,n=this.stacks=[],r,i;if(this.bigReductionCount>300&&e.length==1){let[t]=e;for(;t.forceReduce()&&t.stack.length&&t.stack[t.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let a=0;at)n.push(o);else if(this.advanceStack(o,n,e))continue;else{r||(r=[],i=[]),r.push(o);let e=this.tokens.getMainToken(o);i.push(e.value,e.end)}break}}if(!n.length){let e=r&&Vm(r);if(e)return km&&console.log(`Finish with `+this.stackID(e)),this.stackToTree(e);if(this.parser.strict)throw km&&r&&console.log(`Stuck with token `+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):`none`)),SyntaxError(`No parse at `+t);this.recovering||=5}if(this.recovering&&r){let e=this.stoppedAt!=null&&r[0].pos>this.stoppedAt?r[0]:this.runRecovery(r,i,n);if(e)return km&&console.log(`Force-finish `+this.stackID(e)),this.stackToTree(e.forceAll())}if(this.recovering){let e=this.recovering==1?1:this.recovering*3;if(n.length>e)for(n.sort((e,t)=>t.score-e.score);n.length>e;)n.pop();n.some(e=>e.reducePos>t)&&this.recovering--}else if(n.length>1){outer:for(let e=0;e500&&i.buffer.length>500)if((t.score-i.score||t.buffer.length-i.buffer.length)>0)n.splice(r--,1);else{n.splice(e--,1);continue outer}}}n.length>12&&n.splice(12,n.length-12)}this.minStackPos=n[0].pos;for(let e=1;e `:``;if(this.stoppedAt!=null&&r>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let t=e.curContext&&e.curContext.tracker.strict,n=t?e.curContext.hash:0;for(let o=this.fragments.nodeAt(r);o;){let r=this.parser.nodeSet.types[o.type.id]==o.type?i.getGoto(e.state,o.type.id):-1;if(r>-1&&o.length&&(!t||(o.prop(Cp.contextHash)||0)==n))return e.useNode(o,r),km&&console.log(a+this.stackID(e)+` (via reuse of ${i.getName(o.type.id)})`),!0;if(!(o instanceof jp)||o.children.length==0||o.positions[0]>0)break;let s=o.children[0];if(s instanceof jp&&o.positions[0]==0)o=s;else break}}let o=i.stateSlot(e.state,4);if(o>0)return e.reduce(o),km&&console.log(a+this.stackID(e)+` (via always-reduce ${i.getName(o&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let s=this.tokens.getActions(e);for(let o=0;or?t.push(f):n.push(f)}return!1}advanceFully(e,t){let n=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>n)return Fm(e,t),!0}}runRecovery(e,t,n){let r=null,i=!1;for(let a=0;a `:``;if(o.deadEnd&&(i||(i=!0,o.restart(),km&&console.log(l+this.stackID(o)+` (restarted)`),this.advanceFully(o,n))))continue;let u=o.split(),d=l;for(let e=0;e<10&&u.forceReduce()&&(km&&console.log(d+this.stackID(u)+` (via force-reduce)`),!this.advanceFully(u,n));e++)km&&(d=this.stackID(u)+` -> `);for(let e of o.recoverByInsert(s))km&&console.log(l+this.stackID(e)+` (via recover-insert)`),this.advanceFully(e,n);this.stream.end>o.pos?(c==o.pos&&(c++,s=0),o.recoverByDelete(s,c),km&&console.log(l+this.stackID(o)+` (via recover-delete ${this.parser.getName(s)})`),Fm(o,n)):(!r||r.scoree,Rm=class{constructor(e){this.start=e.start,this.shift=e.shift||Lm,this.reduce=e.reduce||Lm,this.reuse=e.reuse||Lm,this.hash=e.hash||(()=>0),this.strict=e.strict!==!1}},zm=class e extends $p{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(` `);this.minRepeatTerm=t.length;for(let n=0;ne.topRules[t][1]),r=[];for(let e=0;e=0)i(r,e,t[n++]);else{let a=t[n+-r];for(let o=-r;o>0;o--)i(t[n++],e,a);n++}}}this.nodeSet=new Dp(t.map((t,i)=>Ep.define({name:i>=this.minRepeatTerm?void 0:t,id:i,props:r[i],top:n.indexOf(i)>-1,error:i==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(i)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=bp;let a=ym(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let e=0;etypeof e==`number`?new Cm(a,e):e),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,n){let r=new Pm(this,e,t,n);for(let i of this.wrappers)r=i(r,e,t,n);return r}getGoto(e,t,n=!1){let r=this.goto;if(t>=r[0])return-1;for(let i=r[t+1];;){let t=r[i++],a=t&1,o=r[i++];if(a&&n)return o;for(let n=i+(t>>1);i0}validAction(e,t){return!!this.allActions(e,e=>e==t?!0:null)}allActions(e,t){let n=this.stateSlot(e,4),r=n?t(n):void 0;for(let n=this.stateSlot(e,1);r==null;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Bm(this.data,n+2);else break;r=t(Bm(this.data,n+1))}return r}nextStates(e){let t=[];for(let n=this.stateSlot(e,1);;n+=3){if(this.data[n]==65535)if(this.data[n+1]==1)n=Bm(this.data,n+2);else break;if(!(this.data[n+2]&1)){let e=this.data[n+1];t.some((t,n)=>n&1&&t==e)||t.push(this.data[n],e)}}return t}configure(t){let n=Object.assign(Object.create(e.prototype),this);if(t.props&&(n.nodeSet=this.nodeSet.extend(...t.props)),t.top){let e=this.topRules[t.top];if(!e)throw RangeError(`Invalid top rule name ${t.top}`);n.top=e}return t.tokenizers&&(n.tokenizers=this.tokenizers.map(e=>{let n=t.tokenizers.find(t=>t.from==e);return n?n.to:e})),t.specializers&&(n.specializers=this.specializers.slice(),n.specializerSpecs=this.specializerSpecs.map((e,r)=>{let i=t.specializers.find(t=>t.from==e.external);if(!i)return e;let a=Object.assign(Object.assign({},e),{external:i.to});return n.specializers[r]=Hm(a),a})),t.contextTracker&&(n.context=t.contextTracker),t.dialect&&(n.dialect=this.parseDialect(t.dialect)),t.strict!=null&&(n.strict=t.strict),t.wrap&&(n.wrappers=n.wrappers.concat(t.wrap)),t.bufferLength!=null&&(n.bufferLength=t.bufferLength),n}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),n=t.map(()=>!1);if(e)for(let r of e.split(` `)){let e=t.indexOf(r);e>=0&&(n[e]=!0)}let r=null;for(let e=0;ee)&&n.p.parser.stateFlag(n.state,2)&&(!t||t.scoree.external(n,r)<<1|t}return e.get}var Um=0,Wm=class e{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=Um++}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 Km(e);return e=>e.modified.indexOf(t)>-1?e:Km.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}},Gm=0,Km=class e{constructor(e){this.name=e,this.instances=[],this.id=Gm++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(e=>e.base==t&&qm(n,e.modified));if(r)return r;let i=[],a=new Wm(t.name,i,t,n);for(let e of n)e.instances.push(a);let o=Jm(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 qm(e,t){return e.length==t.length&&e.every((e,n)=>e==t[n])}function Jm(e){let t=[[]];for(let n=0;nt.length-e.length)}function Ym(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 Zm(r,i,o>0?n.slice(0,o):null).sort(t[s])}}return Xm.add(t)}var Xm=new Cp({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 Zm(i.tags,i.mode,i.context);n?n.next=a:r=a,n=a}return r}}),Zm=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{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 $m(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+` `+e:e)}return n}function eh(e,t,n,r=0,i=e.length){let a=new th(r,Array.isArray(t)?t:[t],n);a.highlightRange(e.cursor(),r,i,``,a.highlighters),a.flush(i)}var th=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=nh(e)||Zm.empty,u=$m(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(Cp.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=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)continue;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 nh(e){let t=e.type.prop(Xm);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var Z=Wm.define,rh=Z(),ih=Z(),ah=Z(ih),oh=Z(ih),sh=Z(),ch=Z(sh),lh=Z(sh),uh=Z(),dh=Z(uh),fh=Z(),ph=Z(),mh=Z(),hh=Z(mh),gh=Z(),Q={comment:rh,lineComment:Z(rh),blockComment:Z(rh),docComment:Z(rh),name:ih,variableName:Z(ih),typeName:ah,tagName:Z(ah),propertyName:oh,attributeName:Z(oh),className:Z(ih),labelName:Z(ih),namespace:Z(ih),macroName:Z(ih),literal:sh,string:ch,docString:Z(ch),character:Z(ch),attributeValue:Z(ch),number:lh,integer:Z(lh),float:Z(lh),bool:Z(sh),regexp:Z(sh),escape:Z(sh),color:Z(sh),url:Z(sh),keyword:fh,self:Z(fh),null:Z(fh),atom:Z(fh),unit:Z(fh),modifier:Z(fh),operatorKeyword:Z(fh),controlKeyword:Z(fh),definitionKeyword:Z(fh),moduleKeyword:Z(fh),operator:ph,derefOperator:Z(ph),arithmeticOperator:Z(ph),logicOperator:Z(ph),bitwiseOperator:Z(ph),compareOperator:Z(ph),updateOperator:Z(ph),definitionOperator:Z(ph),typeOperator:Z(ph),controlOperator:Z(ph),punctuation:mh,separator:Z(mh),bracket:hh,angleBracket:Z(hh),squareBracket:Z(hh),paren:Z(hh),brace:Z(hh),content:uh,heading:dh,heading1:Z(dh),heading2:Z(dh),heading3:Z(dh),heading4:Z(dh),heading5:Z(dh),heading6:Z(dh),contentSeparator:Z(uh),list:Z(uh),quote:Z(uh),emphasis:Z(uh),strong:Z(uh),link:Z(uh),monospace:Z(uh),strikethrough:Z(uh),inserted:Z(),deleted:Z(),changed:Z(),invalid:Z(),meta:gh,documentMeta:Z(gh),annotation:Z(gh),processingInstruction:Z(gh),definition:Wm.defineModifier(`definition`),constant:Wm.defineModifier(`constant`),function:Wm.defineModifier(`function`),standard:Wm.defineModifier(`standard`),local:Wm.defineModifier(`local`),special:Wm.defineModifier(`special`)};for(let e in Q){let t=Q[e];t instanceof Wm&&(t.name=e)}Qm([{tag:Q.link,class:`tok-link`},{tag:Q.heading,class:`tok-heading`},{tag:Q.emphasis,class:`tok-emphasis`},{tag:Q.strong,class:`tok-strong`},{tag:Q.keyword,class:`tok-keyword`},{tag:Q.atom,class:`tok-atom`},{tag:Q.bool,class:`tok-bool`},{tag:Q.url,class:`tok-url`},{tag:Q.labelName,class:`tok-labelName`},{tag:Q.inserted,class:`tok-inserted`},{tag:Q.deleted,class:`tok-deleted`},{tag:Q.literal,class:`tok-literal`},{tag:Q.string,class:`tok-string`},{tag:Q.number,class:`tok-number`},{tag:[Q.regexp,Q.escape,Q.special(Q.string)],class:`tok-string2`},{tag:Q.variableName,class:`tok-variableName`},{tag:Q.local(Q.variableName),class:`tok-variableName tok-local`},{tag:Q.definition(Q.variableName),class:`tok-variableName tok-definition`},{tag:Q.special(Q.variableName),class:`tok-variableName2`},{tag:Q.definition(Q.propertyName),class:`tok-propertyName tok-definition`},{tag:Q.typeName,class:`tok-typeName`},{tag:Q.namespace,class:`tok-namespace`},{tag:Q.className,class:`tok-className`},{tag:Q.macroName,class:`tok-macroName`},{tag:Q.propertyName,class:`tok-propertyName`},{tag:Q.operator,class:`tok-operator`},{tag:Q.comment,class:`tok-comment`},{tag:Q.meta,class:`tok-meta`},{tag:Q.invalid,class:`tok-invalid`},{tag:Q.punctuation,class:`tok-punctuation`}]);var _h=55,vh=1,yh=56,bh=2,xh=57,Sh=3,Ch=4,wh=5,Th=6,Eh=7,Dh=8,Oh=9,kh=10,Ah=11,jh=12,Mh=13,Nh=58,Ph=14,Fh=15,Ih=59,Lh=21,Rh=23,zh=24,Bh=25,Vh=27,Hh=28,Uh=29,Wh=32,Gh=35,Kh=37,qh=38,Jh=0,Yh=1,Xh={area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},Zh={dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},Qh={dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}};function $h(e){return e==45||e==46||e==58||e>=65&&e<=90||e==95||e>=97&&e<=122||e>=161}var eg=null,tg=null,ng=0;function rg(e,t){let n=e.pos+t;if(ng==n&&tg==e)return eg;let r=e.peek(t),i=``;for(;$h(r);)i+=String.fromCharCode(r),r=e.peek(++t);return tg=e,ng=n,eg=i?i.toLowerCase():r==sg||r==cg?void 0:null}var ig=60,ag=62,og=47,sg=63,cg=33,lg=45;function ug(e,t){this.name=e,this.parent=t}var dg=[Th,kh,Eh,Dh,Oh],fg=new Rm({start:null,shift(e,t,n,r){return dg.indexOf(t)>-1?new ug(rg(r,1)||``,e):e},reduce(e,t){return t==Lh&&e?e.parent:e},reuse(e,t,n,r){let i=t.type.id;return i==Th||i==Kh?new ug(rg(r,1)||``,e):e},strict:!1}),pg=new Tm((e,t)=>{if(e.next!=ig){e.next<0&&t.context&&e.acceptToken(Nh);return}e.advance();let n=e.next==og;n&&e.advance();let r=rg(e,0);if(r===void 0)return;if(!r)return e.acceptToken(n?Fh:Ph);let i=t.context?t.context.name:null;if(n){if(r==i)return e.acceptToken(Ah);if(i&&Zh[i])return e.acceptToken(Nh,-2);if(t.dialectEnabled(Jh))return e.acceptToken(jh);for(let e=t.context;e;e=e.parent)if(e.name==r)return;e.acceptToken(Mh)}else{if(r==`script`)return e.acceptToken(Eh);if(r==`style`)return e.acceptToken(Dh);if(r==`textarea`)return e.acceptToken(Oh);if(Xh.hasOwnProperty(r))return e.acceptToken(kh);i&&Qh[i]&&Qh[i][r]?e.acceptToken(Nh,-1):e.acceptToken(Th)}},{contextual:!0}),mg=new Tm(e=>{for(let t=0,n=0;;n++){if(e.next<0){n&&e.acceptToken(Ih);break}if(e.next==lg)t++;else if(e.next==ag&&t>=2){n>=3&&e.acceptToken(Ih,-2);break}else t=0;e.advance()}});function hg(e){for(;e;e=e.parent)if(e.name==`svg`||e.name==`math`)return!0;return!1}var gg=new Tm((e,t)=>{if(e.next==og&&e.peek(1)==ag){let n=t.dialectEnabled(Yh)||hg(t.context);e.acceptToken(n?wh:Ch,2)}else e.next==ag&&e.acceptToken(Ch,1)});function _g(e,t,n){let r=2+e.length;return new Tm(i=>{for(let a=0,o=0,s=0;;s++){if(i.next<0){s&&i.acceptToken(t);break}if(a==0&&i.next==ig||a==1&&i.next==og||a>=2&&ao?i.acceptToken(t,-o):i.acceptToken(n,-(o-2));break}else if((i.next==10||i.next==13)&&s){i.acceptToken(t,1);break}else a=o=0;i.advance()}})}var vg=_g(`script`,_h,vh),yg=_g(`style`,yh,bh),bg=_g(`textarea`,xh,Sh),xg=Ym({"Text RawText IncompleteTag IncompleteCloseTag":Q.content,"StartTag StartCloseTag SelfClosingEndTag EndTag":Q.angleBracket,TagName:Q.tagName,"MismatchedCloseTag/TagName":[Q.tagName,Q.invalid],AttributeName:Q.attributeName,"AttributeValue UnquotedAttributeValue":Q.attributeValue,Is:Q.definitionOperator,"EntityReference CharacterReference":Q.character,Comment:Q.blockComment,ProcessingInst:Q.processingInstruction,DoctypeDecl:Q.documentMeta}),Sg=zm.deserialize({version:14,states:",xOVO!rOOO!ZQ#tO'#CrO!`Q#tO'#C{O!eQ#tO'#DOO!jQ#tO'#DRO!oQ#tO'#DTO!tOaO'#CqO#PObO'#CqO#[OdO'#CqO$kO!rO'#CqOOO`'#Cq'#CqO$rO$fO'#DUO$zQ#tO'#DWO%PQ#tO'#DXOOO`'#Dl'#DlOOO`'#DZ'#DZQVO!rOOO%UQ&rO,59^O%aQ&rO,59gO%lQ&rO,59jO%wQ&rO,59mO&SQ&rO,59oOOOa'#D_'#D_O&_OaO'#CyO&jOaO,59]OOOb'#D`'#D`O&rObO'#C|O&}ObO,59]OOOd'#Da'#DaO'VOdO'#DPO'bOdO,59]OOO`'#Db'#DbO'jO!rO,59]O'qQ#tO'#DSOOO`,59],59]OOOp'#Dc'#DcO'vO$fO,59pOOO`,59p,59pO(OQ#|O,59rO(TQ#|O,59sOOO`-E7X-E7XO(YQ&rO'#CtOOQW'#D['#D[O(hQ&rO1G.xOOOa1G.x1G.xOOO`1G/Z1G/ZO(sQ&rO1G/ROOOb1G/R1G/RO)OQ&rO1G/UOOOd1G/U1G/UO)ZQ&rO1G/XOOO`1G/X1G/XO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Oc!uOd!uO!a!{O!b!uO~Ob!xOc!xOd!xO!c!{O!d!xO~OT~cbd!ey|!e~`,goto:"%q!aPPPPPPPPPPPPPPPPPPPPP!b!hP!nPP!zP!}#Q#T#Z#^#a#g#j#m#s#y!bP!b!bP$P$V$m$s$y%P%V%]%cPPPPPPPP%iX^OX`pXUOX`pezabcde{!O!Q!S!UR!q!dRhUR!XhXVOX`pRkVR!XkXWOX`pRnWR!XnXXOX`pQrXR!XpXYOX`pQ`ORx`Q{aQ!ObQ!QcQ!SdQ!UeZ!e{!O!Q!S!UQ!v!oR!z!vQ!y!pR!|!yQgUR!VgQjVR!YjQmWR![mQpXR!^pQtZR!`tS_O`ToXp",nodeNames:`⚠ StartCloseTag StartCloseTag StartCloseTag EndTag SelfClosingEndTag StartTag StartTag StartTag StartTag StartTag StartCloseTag StartCloseTag StartCloseTag IncompleteTag IncompleteCloseTag Document Text EntityReference CharacterReference InvalidEntity Element OpenTag TagName Attribute AttributeName Is AttributeValue UnquotedAttributeValue ScriptText CloseTag OpenTag StyleText CloseTag OpenTag TextareaText CloseTag OpenTag CloseTag SelfClosingTag Comment ProcessingInst MismatchedCloseTag CloseTag DoctypeDecl`,maxTerm:68,context:fg,nodeProps:[[`closedBy`,-10,1,2,3,7,8,9,10,11,12,13,`EndTag`,6,`EndTag SelfClosingEndTag`,-4,22,31,34,37,`CloseTag`],[`openedBy`,4,`StartTag StartCloseTag`,5,`StartTag`,-4,30,33,36,38,`OpenTag`],[`group`,-10,14,15,18,19,20,21,40,41,42,43,`Entity`,17,`Entity TextContent`,-3,29,32,35,`TextContent Entity`],[`isolate`,-11,22,30,31,33,34,36,37,38,39,42,43,`ltr`,-3,27,28,40,``]],propSources:[xg],skippedNodes:[0],repeatNodeCount:9,tokenData:"!]tw8twx7Sx!P8t!P!Q5u!Q!]8t!]!^/^!^!a7S!a#S8t#S#T;{#T#s8t#s$f5u$f;'S8t;'S;=`>V<%l?Ah8t?Ah?BY5u?BY?Mn8t?MnO5u!Z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l!6Vq!7]V!dpOv!5kvx!6Vx!`!5k!`!a!7r!a;'S!5k;'S;=`!8V<%lO!5kq!7yS!dpyPOv(Vx;'S(V;'S;=`(h<%lO(Vq!8YP;=`<%l!5ka!8bX!b`Or!8]rs!6Vsv!8]vw!6Vw!a!8]!a!b!8}!b;'S!8];'S;=`!:V<%lO!8]a!9SX!b`Or!8]rs!6Vsv!8]vw!6Vw!`!8]!`!a!9o!a;'S!8];'S;=`!:V<%lO!8]a!9vT!b`yPOr)esv)ew;'S)e;'S;=`)y<%lO)ea!:YP;=`<%l!8]!R!:dY!b`!dpOr!4trs!5ksv!4tvw!6Vwx!8]x!`!4t!`!a!;S!a;'S!4t;'S;=`!;r<%lO!4t!R!;]V!b`!dpyPOr*Vrs(Vsv*Vwx)ex;'S*V;'S;=`*s<%lO*V!R!;uP;=`<%l!4t!V!{let s=e.type.id;if(s==Uh)return Tg(e,t,n);if(s==Wh)return Tg(e,t,r);if(s==Gh)return Tg(e,t,i);if(s==Lh&&a.length){let n=e.node,r=n.firstChild,i=r&&wg(r,t),o;if(i){for(let e of a)if(e.tag==i&&(!e.attrs||e.attrs(o||=Cg(r,t)))){let t=n.lastChild,i=t.type.id==qh?t.from:n.to;if(i>r.to)return{parser:e.parser,overlay:[{from:r.to,to:i}]}}}}if(o&&s==zh){let n=e.node,r;if(r=n.firstChild){let e=o[t.read(r.from,r.to)];if(e)for(let r of e){if(r.tagName&&r.tagName!=wg(n.parent,t))continue;let e=n.lastChild;if(e.type.id==Vh){let t=e.from+1,n=e.lastChild,i=e.to-(n&&n.isError?0:1);if(i>t)return{parser:r.parser,overlay:[{from:t,to:i}]}}else if(e.type.id==Hh)return{parser:r.parser,overlay:[{from:e.from,to:e.to}]}}}}return null})}var Dg=122,Og=1,kg=123,Ag=124,jg=2,Mg=125,Ng=3,Pg=4,Fg=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],Ig=58,Lg=40,Rg=95,zg=91,Bg=45,Vg=46,Hg=35,Ug=37,Wg=38,Gg=92,Kg=10,qg=42;function Jg(e){return e>=65&&e<=90||e>=97&&e<=122||e>=161}function Yg(e){return e>=48&&e<=57}function Xg(e){return Yg(e)||e>=97&&e<=102||e>=65&&e<=70}var Zg=(e,t,n)=>(r,i)=>{for(let a=!1,o=0,s=0;;s++){let{next:c}=r;if(Jg(c)||c==Bg||c==Rg||a&&Yg(c))!a&&(c!=Bg||s>0)&&(a=!0),o===s&&c==Bg&&o++,r.advance();else if(c==Gg&&r.peek(1)!=Kg){if(r.advance(),Xg(r.next)){do r.advance();while(Xg(r.next));r.next==32&&r.advance()}else r.next>-1&&r.advance();a=!0}else{a&&r.acceptToken(o==2&&i.canShift(jg)?t:c==Lg?n:e);break}}},Qg=new Tm(Zg(kg,jg,Ag)),$g=new Tm(Zg(Mg,Ng,Pg)),e_=new Tm(e=>{if(Fg.includes(e.peek(-1))){let{next:t}=e;(Jg(t)||t==Rg||t==Hg||t==Vg||t==qg||t==zg||t==Ig&&Jg(e.peek(1))||t==Bg||t==Wg)&&e.acceptToken(Dg)}}),t_=new Tm(e=>{if(!Fg.includes(e.peek(-1))){let{next:t}=e;if(t==Ug&&(e.advance(),e.acceptToken(Og)),Jg(t)){do e.advance();while(Jg(e.next)||Yg(e.next));e.acceptToken(Og)}}}),n_=Ym({"AtKeyword import charset namespace keyframes media supports":Q.definitionKeyword,"from to selector":Q.keyword,NamespaceName:Q.namespace,KeyframeName:Q.labelName,KeyframeRangeName:Q.operatorKeyword,TagName:Q.tagName,ClassName:Q.className,PseudoClassName:Q.constant(Q.className),IdName:Q.labelName,"FeatureName PropertyName":Q.propertyName,AttributeName:Q.attributeName,NumberLiteral:Q.number,KeywordQuery:Q.keyword,UnaryQueryOp:Q.operatorKeyword,"CallTag ValueName":Q.atom,VariableName:Q.variableName,Callee:Q.operatorKeyword,Unit:Q.unit,"UniversalSelector NestingSelector":Q.definitionOperator,"MatchOp CompareOp":Q.compareOperator,"ChildOp SiblingOp, LogicOp":Q.logicOperator,BinOp:Q.arithmeticOperator,Important:Q.modifier,Comment:Q.blockComment,ColorLiteral:Q.color,"ParenthesizedContent StringLiteral":Q.string,":":Q.punctuation,"PseudoOp #":Q.derefOperator,"; ,":Q.separator,"( )":Q.paren,"[ ]":Q.squareBracket,"{ }":Q.brace}),r_={__proto__:null,lang:38,"nth-child":38,"nth-last-child":38,"nth-of-type":38,"nth-last-of-type":38,dir:38,"host-context":38,if:84,url:124,"url-prefix":124,domain:124,regexp:124},i_={__proto__:null,or:98,and:98,not:106,only:106,layer:170},a_={__proto__:null,selector:112,layer:166},o_={__proto__:null,"@import":162,"@media":174,"@charset":178,"@namespace":182,"@keyframes":188,"@supports":200,"@scope":204},s_={__proto__:null,to:207},c_=zm.deserialize({version:14,states:"EbQYQdOOO#qQdOOP#xO`OOOOQP'#Cf'#CfOOQP'#Ce'#CeO#}QdO'#ChO$nQaO'#CcO$xQdO'#CkO%TQdO'#DpO%YQdO'#DrO%_QdO'#DuO%_QdO'#DxOOQP'#FV'#FVO&eQhO'#EhOOQS'#FU'#FUOOQS'#Ek'#EkQYQdOOO&lQdO'#EOO&PQhO'#EUO&lQdO'#EWO'aQdO'#EYO'lQdO'#E]O'tQhO'#EcO(VQdO'#EeO(bQaO'#CfO)VQ`O'#D{O)[Q`O'#F`O)gQdO'#F`QOQ`OOP)qO&jO'#CaPOOO)C@t)C@tOOQP'#Cj'#CjOOQP,59S,59SO#}QdO,59SO)|QdO,59VO%TQdO,5:[O%YQdO,5:^O%_QdO,5:aO%_QdO,5:cO%_QdO,5:dO%_QdO'#ErO*XQ`O,58}O*aQdO'#DzOOQS,58},58}OOQP'#Cn'#CnOOQO'#Dn'#DnOOQP,59V,59VO*hQ`O,59VO*mQ`O,59VOOQP'#Dq'#DqOOQP,5:[,5:[OOQO'#Ds'#DsO*rQpO,5:^O+]QaO,5:aO+sQaO,5:dOOQW'#DZ'#DZO,ZQhO'#DdO,xQhO'#FaO't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!hO[!a`#}YOy%Qz!O%Q!O!P;Z!P!Q%Q!Q![=w![!g%Q!g!hyS!^YOy%Qz;'S%Q;'S;=`%c<%lO%Qj?[WvWOy%Qz!O%Q!O!P:r!P!Q%Q!Q![=w![;'S%Q;'S;=`%c<%lO%Qj?yU]YOy%Qz!Q%Q!Q![;Z![;'S%Q;'S;=`%c<%lO%Q~@bTvWOy%Qz{@q{;'S%Q;'S;=`%c<%lO%Q~@xS!a`#t~Oy%Qz;'S%Q;'S;=`%c<%lO%QjAZ[#}YOy%Qz!O%Q!O!P;Z!P!Q%Q!Q![=w![!g%Q!g!hr_[e]||-1},{term:125,get:e=>i_[e]||-1},{term:4,get:e=>a_[e]||-1},{term:25,get:e=>o_[e]||-1},{term:123,get:e=>s_[e]||-1}],tokenPrec:1963}),l_=new Cp;function u_(e){return J.define({combine:e?t=>t.concat(e):void 0})}var d_=new Cp,f_=class{constructor(e,t,n=[],r=``){this.data=e,this.name=r,ls.prototype.hasOwnProperty(`tree`)||Object.defineProperty(ls.prototype,`tree`,{get(){return h_(this)}}),this.parser=t,this.extension=[T_.of(this),ls.languageData.of((e,t,n)=>{let r=p_(e,t,n),i=r.type.prop(l_);if(!i)return[];let a=e.facet(i),o=r.type.prop(d_);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 p_(e,t,n).type.prop(l_)==this.data}findRegions(e){let t=e.facet(T_);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(l_)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(Cp.mounted);if(i){if(i.tree.prop(l_)==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}else if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;ne.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 h_(e){let t=e.field(f_.state,!1);return t?t.tree:jp.empty}function g_(e,t,n=50){let r=e.field(f_.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 __=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=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}},v_=null,y_=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,[],jp.empty,0,r,[],null)}startParse(){return this.parser.startParse(new __(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=jp.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.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(Qp.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=v_;v_=this;try{return e()}finally{v_=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=b_(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=Qp.applyChanges(r,e),i=jp.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);ne.from&&(this.fragments=b_(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 $p{createParse(t,n,r){let i=r[0].from,a=r[r.length-1].to;return{parsedPos:i,advance(){let t=v_;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 jp(Ep.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 v_}};function b_(e,t,n){return Qp.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var x_=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=y_.create(t.facet(T_).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}};f_.state=Do.define({create:x_.init,update(e,t){for(let e of t.effects)if(e.is(f_.setState))return e.value;return t.startState.facet(T_)==t.state.facet(T_)?e.apply(t):x_.init(t.state)}});var S_=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<`u`&&(S_=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});var C_=typeof navigator<`u`&&navigator.scheduling?.isInputPending?()=>navigator.scheduling.isInputPending():null,w_=tu.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field(f_.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field(f_.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=S_(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEndr+1e3,s=i.context.work(()=>C_&&C_()||Date.now()>a,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(s||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:f_.setState.of(new x_(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=>Zl(this.view.state,e)).then(()=>this.workScheduled--),null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),T_=J.define({combine(e){return e.length?e[0]:null},enables:e=>[f_.state,w_,X.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),E_=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},D_=J.define(),O_=J.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 k_(e){let t=e.facet(O_);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function A_(e,t){let n=``,r=e.tabSize,i=e.facet(O_)[0];if(i==` `){for(;t>=r;)n+=` `,t-=r;i=` `}for(let e=0;e=t?P_(e,n,t):null}var M_=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=k_(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-1&&(i+=a-this.countColumn(n,n.search(/\S|$/))),i}countColumn(e,t=e.length){return Os(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}},N_=new Cp;function P_(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.fromr.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 F_(r,e,n)}function F_(e,t,n){for(let r=e;r;r=r.next){let e=L_(r.node);if(e)return e(z_.create(t,n,r))}return 0}function I_(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function L_(e){let t=e.type.prop(N_);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(Cp.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>U_(e,!0,1,void 0,n&&!I_(e)?t.from:void 0)}return e.parent==null?R_:null}function R_(){return 0}var z_=class e extends M_{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(B_(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return F_(this.context.next,this.base,this.pos)}};function B_(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function V_(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 H_({closing:e,align:t=!0,units:n=1}){return r=>U_(r,t,n,e)}function U_(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?V_(e):null;return c?s?e.column(c.from):e.column(c.to):e.baseIndent+(s?0:e.unit*n)}var W_=e=>e.baseIndent;function G_({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}var K_=J.define(),q_=new Cp;function J_(e){let t=e.firstChild,n=e.lastChild;return t&&t.ton)continue;if(a&&i.from=t&&r.to>n&&(a=r)}}return a}function X_(e){let t=e.lastChild;return t&&t.to==e.to&&t.type.isError}function Z_(e,t,n){for(let r of e.facet(K_)){let i=r(e,t,n);if(i)return i}return Y_(e,t,n)}function Q_(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 $_=Jo.define({map:Q_}),ev=Jo.define({map:Q_});function tv(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 nv=Do.define({create(){return el.none},update(e,t){t.isUserEvent(`delete`)&&t.changes.iterChangedRanges((t,n)=>e=rv(e,t,n)),e=e.map(t.changes);for(let n of t.effects)if(n.is($_)&&!av(e,n.value.from,n.value.to)){let{preparePlaceholder:r}=t.state.facet(uv),i=r?el.replace({widget:new mv(r(t.state,n.value))}):pv;e=e.update({add:[i.range(n.value.from,n.value.to)]})}else n.is(ev)&&(e=e.update({filter:(e,t)=>n.value.from!=e||n.value.to!=t,filterFrom:n.value.from,filterTo:n.value.to}));return t.selection&&(e=rv(e,t.selection.main.head)),e},provide:e=>X.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{et&&(r=!0)}),r?e.update({filterFrom:t,filterTo:n,filter:(e,r)=>e>=n||r<=t}):e}function iv(e,t,n){var r;let i=null;return(r=e.field(nv,!1))==null||r.between(t,n,(e,t)=>{(!i||i.from>e)&&(i={from:e,to:t})}),i}function av(e,t,n){let r=!1;return e.between(t,t,(e,i)=>{e==t&&i==n&&(r=!0)}),r}function ov(e,t){return e.field(nv,!1)?t:t.concat(Jo.appendConfig.of(dv()))}var sv=e=>{for(let t of tv(e)){let n=Z_(e.state,t.from,t.to);if(n)return e.dispatch({effects:ov(e.state,[$_.of(n),cv(e,n)])}),!0}return!1};function cv(e,t,n=!0){let r=e.state.doc.lineAt(t.from).number,i=e.state.doc.lineAt(t.to).number;return X.announce.of(`${e.state.phrase(n?`Folded lines`:`Unfolded lines`)} ${r} ${e.state.phrase(`to`)} ${i}.`)}var lv={placeholderDOM:null,preparePlaceholder:null,placeholderText:`…`},uv=J.define({combine(e){return us(e,lv)}});function dv(e){let t=[nv,hv];return e&&t.push(uv.of(e)),t}function fv(e,t){let{state:n}=e,r=n.facet(uv),i=t=>{let n=e.lineBlockAt(e.posAtDOM(t.target)),r=iv(e.state,n.from,n.to);r&&e.dispatch({effects:ev.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 pv=el.replace({widget:new class extends Qc{toDOM(e){return fv(e,null)}}}),mv=class extends Qc{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return fv(e,this.value)}},hv=X.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`}}),gv=class e{constructor(e,t){this.specs=e;let n;function r(e){let t=Ps.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 f_?e=>e.prop(l_)==a.data:a?e=>e==a:void 0,this.style=Qm(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new Ps(n):null,this.themeType=t.themeType}static define(t,n){return new e(t,n||{})}},_v=J.define(),vv=J.define({combine(e){return e.length?[e[0]]:null}});function yv(e){let t=e.facet(_v);return t.length?t:e.facet(vv)}function bv(e,t){let n=[Sv],r;return e instanceof gv&&(e.module&&n.push(X.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push(vv.of(e)):r?n.push(_v.computeN([X.darkTheme],t=>t.facet(X.darkTheme)==(r==`dark`)?[e]:[])):n.push(_v.of(e)),n}var xv=class{constructor(e){this.markCache=Object.create(null),this.tree=h_(e.state),this.decorations=this.buildDeco(e,yv(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=h_(e.state),n=yv(e.state),r=n!=yv(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length=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 el.none;let n=new _s;for(let{from:r,to:i}of e.visibleRanges)eh(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=el.mark({class:r})))},r,i);return n.finish()}},Sv=Ao.high(tu.fromClass(xv,{decorations:e=>e.decorations}));Q.meta,Q.link,Q.heading,Q.emphasis,Q.strong,Q.strikethrough,Q.keyword,Q.atom,Q.bool,Q.url,Q.contentSeparator,Q.labelName,Q.literal,Q.inserted,Q.string,Q.deleted,Q.regexp,Q.escape,Q.string,Q.variableName,Q.variableName,Q.typeName,Q.namespace,Q.className,Q.variableName,Q.macroName,Q.propertyName,Q.comment,Q.invalid;var Cv=1e4,wv=`()[]{}`,Tv=new Cp;function Ev(e,t,n){let r=e.prop(t<0?Cp.openedBy:Cp.closedBy);if(r)return r;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==(t<0?1:0))return[n[r+t]]}return null}function Dv(e){let t=e.type.prop(Tv);return t?t(e.node):e}function Ov(e,t,n,r={}){let i=r.maxScanDistance||Cv,a=r.brackets||wv,o=h_(e),s=o.resolveInner(t,n);for(let r=s;r;r=r.parent){let i=Ev(r.type,n,a);if(i&&r.from0?t>=o.from&&to.from&&t<=o.to))return kv(e,t,n,r,o,i,a)}}return Av(e,t,n,o,s.type,i,a)}function kv(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.from0)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}function jv(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=this.string.length}sol(){return this.pos==0}peek(){return this.string.charAt(this.pos)||void 0}next(){if(this.post}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.lastColumnPosn?e.toLowerCase():e;return r(this.string.substr(this.pos,e.length))==r(e)?(t!==!1&&(this.pos+=e.length),!0):null}else{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)}},Nv=Object.create(null),Pv=[Ep.none],Fv=[],Iv=Object.create(null),Lv=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`]])Lv[e]=zv(Nv,t);function Rv(e,t){Fv.indexOf(e)>-1||(Fv.push(e),console.warn(t))}function zv(e,t){let n=[];for(let r of t.split(` `)){let t=[];for(let n of r.split(`.`)){let r=e[n]||Q[n];r?typeof r==`function`?t.length?t=t.map(r):Rv(n,`Modifier ${n} used at start of tag`):t.length?Rv(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:Rv(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=Iv[i];if(a)return a.id;let o=Iv[i]=Ep.define({id:Pv.length,name:r,props:[Ym({[r]:n})]});return Pv.push(o),o.id}pl.RTL,pl.LTR;var Bv=null;function Vv(){if(!Bv&&typeof document==`object`&&document.body){let{style:e}=document.body,t=[],n=new Set;for(let r in e)r!=`cssText`&&r!=`cssFloat`&&typeof e[r]==`string`&&(/[A-Z]/.test(r)&&(r=r.replace(/[A-Z]/g,e=>`-`+e.toLowerCase())),n.has(r)||(t.push(r),n.add(r)));Bv=t.sort().map(e=>({type:`property`,label:e,apply:e+`: `}))}return Bv||[]}var Hv=`active.after.any-link.autofill.backdrop.before.checked.cue.default.defined.disabled.empty.enabled.file-selector-button.first.first-child.first-letter.first-line.first-of-type.focus.focus-visible.focus-within.fullscreen.has.host.host-context.hover.in-range.indeterminate.invalid.is.lang.last-child.last-of-type.left.link.marker.modal.not.nth-child.nth-last-child.nth-last-of-type.nth-of-type.only-child.only-of-type.optional.out-of-range.part.placeholder.placeholder-shown.read-only.read-write.required.right.root.scope.selection.slotted.target.target-text.valid.visited.where`.split(`.`).map(e=>({type:`class`,label:e})),Uv=`above.absolute.activeborder.additive.activecaption.after-white-space.ahead.alias.all.all-scroll.alphabetic.alternate.always.antialiased.appworkspace.asterisks.attr.auto.auto-flow.avoid.avoid-column.avoid-page.avoid-region.axis-pan.background.backwards.baseline.below.bidi-override.blink.block.block-axis.bold.bolder.border.border-box.both.bottom.break.break-all.break-word.bullets.button.button-bevel.buttonface.buttonhighlight.buttonshadow.buttontext.calc.capitalize.caps-lock-indicator.caption.captiontext.caret.cell.center.checkbox.circle.cjk-decimal.clear.clip.close-quote.col-resize.collapse.color.color-burn.color-dodge.column.column-reverse.compact.condensed.contain.content.contents.content-box.context-menu.continuous.copy.counter.counters.cover.crop.cross.crosshair.currentcolor.cursive.cyclic.darken.dashed.decimal.decimal-leading-zero.default.default-button.dense.destination-atop.destination-in.destination-out.destination-over.difference.disc.discard.disclosure-closed.disclosure-open.document.dot-dash.dot-dot-dash.dotted.double.down.e-resize.ease.ease-in.ease-in-out.ease-out.element.ellipse.ellipsis.embed.end.ethiopic-abegede-gez.ethiopic-halehame-aa-er.ethiopic-halehame-gez.ew-resize.exclusion.expanded.extends.extra-condensed.extra-expanded.fantasy.fast.fill.fill-box.fixed.flat.flex.flex-end.flex-start.footnotes.forwards.from.geometricPrecision.graytext.grid.groove.hand.hard-light.help.hidden.hide.higher.highlight.highlighttext.horizontal.hsl.hsla.hue.icon.ignore.inactiveborder.inactivecaption.inactivecaptiontext.infinite.infobackground.infotext.inherit.initial.inline.inline-axis.inline-block.inline-flex.inline-grid.inline-table.inset.inside.intrinsic.invert.italic.justify.keep-all.landscape.large.larger.left.level.lighter.lighten.line-through.linear.linear-gradient.lines.list-item.listbox.listitem.local.logical.loud.lower.lower-hexadecimal.lower-latin.lower-norwegian.lowercase.ltr.luminosity.manipulation.match.matrix.matrix3d.medium.menu.menutext.message-box.middle.min-intrinsic.mix.monospace.move.multiple.multiple_mask_images.multiply.n-resize.narrower.ne-resize.nesw-resize.no-close-quote.no-drop.no-open-quote.no-repeat.none.normal.not-allowed.nowrap.ns-resize.numbers.numeric.nw-resize.nwse-resize.oblique.opacity.open-quote.optimizeLegibility.optimizeSpeed.outset.outside.outside-shape.overlay.overline.padding.padding-box.painted.page.paused.perspective.pinch-zoom.plus-darker.plus-lighter.pointer.polygon.portrait.pre.pre-line.pre-wrap.preserve-3d.progress.push-button.radial-gradient.radio.read-only.read-write.read-write-plaintext-only.rectangle.region.relative.repeat.repeating-linear-gradient.repeating-radial-gradient.repeat-x.repeat-y.reset.reverse.rgb.rgba.ridge.right.rotate.rotate3d.rotateX.rotateY.rotateZ.round.row.row-resize.row-reverse.rtl.run-in.running.s-resize.sans-serif.saturation.scale.scale3d.scaleX.scaleY.scaleZ.screen.scroll.scrollbar.scroll-position.se-resize.self-start.self-end.semi-condensed.semi-expanded.separate.serif.show.single.skew.skewX.skewY.skip-white-space.slide.slider-horizontal.slider-vertical.sliderthumb-horizontal.sliderthumb-vertical.slow.small.small-caps.small-caption.smaller.soft-light.solid.source-atop.source-in.source-out.source-over.space.space-around.space-between.space-evenly.spell-out.square.start.static.status-bar.stretch.stroke.stroke-box.sub.subpixel-antialiased.svg_masks.super.sw-resize.symbolic.symbols.system-ui.table.table-caption.table-cell.table-column.table-column-group.table-footer-group.table-header-group.table-row.table-row-group.text.text-bottom.text-top.textarea.textfield.thick.thin.threeddarkshadow.threedface.threedhighlight.threedlightshadow.threedshadow.to.top.transform.translate.translate3d.translateX.translateY.translateZ.transparent.ultra-condensed.ultra-expanded.underline.unidirectional-pan.unset.up.upper-latin.uppercase.url.var.vertical.vertical-text.view-box.visible.visibleFill.visiblePainted.visibleStroke.visual.w-resize.wait.wave.wider.window.windowframe.windowtext.words.wrap.wrap-reverse.x-large.x-small.xor.xx-large.xx-small`.split(`.`).map(e=>({type:`keyword`,label:e})).concat(`aliceblue.antiquewhite.aqua.aquamarine.azure.beige.bisque.black.blanchedalmond.blue.blueviolet.brown.burlywood.cadetblue.chartreuse.chocolate.coral.cornflowerblue.cornsilk.crimson.cyan.darkblue.darkcyan.darkgoldenrod.darkgray.darkgreen.darkkhaki.darkmagenta.darkolivegreen.darkorange.darkorchid.darkred.darksalmon.darkseagreen.darkslateblue.darkslategray.darkturquoise.darkviolet.deeppink.deepskyblue.dimgray.dodgerblue.firebrick.floralwhite.forestgreen.fuchsia.gainsboro.ghostwhite.gold.goldenrod.gray.grey.green.greenyellow.honeydew.hotpink.indianred.indigo.ivory.khaki.lavender.lavenderblush.lawngreen.lemonchiffon.lightblue.lightcoral.lightcyan.lightgoldenrodyellow.lightgray.lightgreen.lightpink.lightsalmon.lightseagreen.lightskyblue.lightslategray.lightsteelblue.lightyellow.lime.limegreen.linen.magenta.maroon.mediumaquamarine.mediumblue.mediumorchid.mediumpurple.mediumseagreen.mediumslateblue.mediumspringgreen.mediumturquoise.mediumvioletred.midnightblue.mintcream.mistyrose.moccasin.navajowhite.navy.oldlace.olive.olivedrab.orange.orangered.orchid.palegoldenrod.palegreen.paleturquoise.palevioletred.papayawhip.peachpuff.peru.pink.plum.powderblue.purple.rebeccapurple.red.rosybrown.royalblue.saddlebrown.salmon.sandybrown.seagreen.seashell.sienna.silver.skyblue.slateblue.slategray.snow.springgreen.steelblue.tan.teal.thistle.tomato.turquoise.violet.wheat.white.whitesmoke.yellow.yellowgreen`.split(`.`).map(e=>({type:`constant`,label:e}))),Wv=`a.abbr.address.article.aside.b.bdi.bdo.blockquote.body.br.button.canvas.caption.cite.code.col.colgroup.dd.del.details.dfn.dialog.div.dl.dt.em.figcaption.figure.footer.form.header.hgroup.h1.h2.h3.h4.h5.h6.hr.html.i.iframe.img.input.ins.kbd.label.legend.li.main.meter.nav.ol.output.p.pre.ruby.section.select.small.source.span.strong.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.tr.u.ul`.split(`.`).map(e=>({type:`type`,label:e})),Gv=[`@charset`,`@color-profile`,`@container`,`@counter-style`,`@font-face`,`@font-feature-values`,`@font-palette-values`,`@import`,`@keyframes`,`@layer`,`@media`,`@namespace`,`@page`,`@position-try`,`@property`,`@scope`,`@starting-style`,`@supports`,`@view-transition`].map(e=>({type:`keyword`,label:e})),Kv=/^(\w[\w-]*|-\w[\w-]*|)$/,qv=/^-(-[\w-]*)?$/;function Jv(e,t){if((e.name==`(`||e.type.isError)&&(e=e.parent||e),e.name!=`ArgList`)return!1;let n=e.parent?.firstChild;return n?.name==`Callee`?t.sliceString(n.from,n.to)==`var`:!1}var Yv=new Zp,Xv=[`Declaration`];function Zv(e){for(let t=e;;){if(t.type.isTop)return t;if(!(t=t.parent))return e}}function Qv(e,t,n){if(t.to-t.from>4096){let r=Yv.get(t);if(r)return r;let i=[],a=new Set,o=t.cursor(Ap.IncludeAnonymous);if(o.firstChild())do for(let t of Qv(e,o.node,n))a.has(t.label)||(a.add(t.label),i.push(t));while(o.nextSibling());return Yv.set(t,i),i}else{let r=[],i=new Set;return t.cursor().iterate(t=>{if(n(t)&&t.matchContext(Xv)&&t.node.nextSibling?.name==`:`){let n=e.sliceString(t.from,t.to);i.has(n)||(i.add(n),r.push({label:n,type:`variable`}))}}),r}}var $v=(e=>t=>{let{state:n,pos:r}=t,i=h_(n).resolveInner(r,-1),a=i.type.isError&&i.from==i.to-1&&n.doc.sliceString(i.from,i.to)==`-`;if(i.name==`PropertyName`||(a||i.name==`TagName`)&&/^(Block|Styles)$/.test(i.resolve(i.to).name))return{from:i.from,options:Vv(),validFor:Kv};if(i.name==`ValueName`)return{from:i.from,options:Uv,validFor:Kv};if(i.name==`PseudoClassName`)return{from:i.from,options:Hv,validFor:Kv};if(e(i)||(t.explicit||a)&&Jv(i,n.doc))return{from:e(i)||a?i.from:r,options:Qv(n.doc,Zv(i),e),validFor:qv};if(i.name==`TagName`){for(let{parent:e}=i;e;e=e.parent)if(e.name==`Block`)return{from:i.from,options:Vv(),validFor:Kv};return{from:i.from,options:Wv,validFor:Kv}}if(i.name==`AtKeyword`)return{from:i.from,options:Gv,validFor:Kv};if(!t.explicit)return null;let o=i.resolve(r),s=o.childBefore(r);return s&&s.name==`:`&&o.name==`PseudoClassSelector`?{from:r,options:Hv,validFor:Kv}:s&&s.name==`:`&&o.name==`Declaration`||o.name==`ArgList`?{from:r,options:Uv,validFor:Kv}:o.name==`Block`||o.name==`Styles`?{from:r,options:Vv(),validFor:Kv}:null})(e=>e.name==`VariableName`),ey=m_.define({name:`css`,parser:c_.configure({props:[N_.add({Declaration:G_()}),q_.add({"Block KeyframeList":J_})]}),languageData:{commentTokens:{block:{open:`/*`,close:`*/`}},indentOnInput:/^\s*\}$/,wordChars:`-`}});function ty(){return new E_(ey,ey.data.of({autocomplete:$v}))}var ny=316,ry=317,iy=1,ay=2,oy=3,sy=4,cy=318,ly=320,uy=321,dy=5,fy=6,py=0,my=[9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288],hy=125,gy=59,_y=47,vy=42,yy=43,by=45,xy=60,Sy=44,Cy=63,wy=46,Ty=91,Ey=new Rm({start:!1,shift(e,t){return t==dy||t==fy||t==ly?e:t==uy},strict:!1}),Dy=new Tm((e,t)=>{let{next:n}=e;(n==hy||n==-1||t.context)&&e.acceptToken(cy)},{contextual:!0,fallback:!0}),Oy=new Tm((e,t)=>{let{next:n}=e,r;my.indexOf(n)>-1||n==_y&&((r=e.peek(1))==_y||r==vy)||n!=hy&&n!=gy&&n!=-1&&!t.context&&e.acceptToken(ny)},{contextual:!0}),ky=new Tm((e,t)=>{e.next==Ty&&!t.context&&e.acceptToken(ry)},{contextual:!0}),Ay=new Tm((e,t)=>{let{next:n}=e;if(n==yy||n==by){if(e.advance(),n==e.next){e.advance();let n=!t.context&&t.canShift(iy);e.acceptToken(n?iy:ay)}}else n==Cy&&e.peek(1)==wy&&(e.advance(),e.advance(),(e.next<48||e.next>57)&&e.acceptToken(oy))},{contextual:!0});function jy(e,t){return e>=65&&e<=90||e>=97&&e<=122||e==95||e>=192||!t&&e>=48&&e<=57}var My=new Tm((e,t)=>{if(e.next!=xy||!t.dialectEnabled(py)||(e.advance(),e.next==_y))return;let n=0;for(;my.indexOf(e.next)>-1;)e.advance(),n++;if(jy(e.next,!0)){for(e.advance(),n++;jy(e.next,!1);)e.advance(),n++;for(;my.indexOf(e.next)>-1;)e.advance(),n++;if(e.next==Sy)return;for(let t=0;;t++){if(t==7){if(!jy(e.next,!0))return;break}if(e.next!=`extends`.charCodeAt(t))break;e.advance(),n++}}e.acceptToken(sy,-n)}),Ny=Ym({"get set async static":Q.modifier,"for while do if else switch try catch finally return throw break continue default case defer":Q.controlKeyword,"in of await yield void typeof delete instanceof as satisfies":Q.operatorKeyword,"let var const using function class extends":Q.definitionKeyword,"import export from":Q.moduleKeyword,"with debugger new":Q.keyword,TemplateString:Q.special(Q.string),super:Q.atom,BooleanLiteral:Q.bool,this:Q.self,null:Q.null,Star:Q.modifier,VariableName:Q.variableName,"CallExpression/VariableName TaggedTemplateExpression/VariableName":Q.function(Q.variableName),VariableDefinition:Q.definition(Q.variableName),Label:Q.labelName,PropertyName:Q.propertyName,PrivatePropertyName:Q.special(Q.propertyName),"CallExpression/MemberExpression/PropertyName":Q.function(Q.propertyName),"FunctionDeclaration/VariableDefinition":Q.function(Q.definition(Q.variableName)),"ClassDeclaration/VariableDefinition":Q.definition(Q.className),"NewExpression/VariableName":Q.className,PropertyDefinition:Q.definition(Q.propertyName),PrivatePropertyDefinition:Q.definition(Q.special(Q.propertyName)),UpdateOp:Q.updateOperator,"LineComment Hashbang":Q.lineComment,BlockComment:Q.blockComment,Number:Q.number,String:Q.string,Escape:Q.escape,ArithOp:Q.arithmeticOperator,LogicOp:Q.logicOperator,BitOp:Q.bitwiseOperator,CompareOp:Q.compareOperator,RegExp:Q.regexp,Equals:Q.definitionOperator,Arrow:Q.function(Q.punctuation),": Spread":Q.punctuation,"( )":Q.paren,"[ ]":Q.squareBracket,"{ }":Q.brace,"InterpolationStart InterpolationEnd":Q.special(Q.brace),".":Q.derefOperator,", ;":Q.separator,"@":Q.meta,TypeName:Q.typeName,TypeDefinition:Q.definition(Q.typeName),"type enum interface implements namespace module declare":Q.definitionKeyword,"abstract global Privacy readonly override":Q.modifier,"is keyof unique infer asserts":Q.operatorKeyword,JSXAttributeValue:Q.attributeValue,JSXText:Q.content,"JSXStartTag JSXStartCloseTag JSXSelfCloseEndTag JSXEndTag":Q.angleBracket,"JSXIdentifier JSXNameSpacedName":Q.tagName,"JSXAttribute/JSXIdentifier JSXAttribute/JSXNameSpacedName":Q.attributeName,"JSXBuiltin/JSXIdentifier":Q.standard(Q.tagName)}),Py={__proto__:null,export:20,as:25,from:33,default:36,async:41,function:42,in:52,out:55,const:56,extends:60,this:64,true:72,false:72,null:84,void:88,typeof:92,super:108,new:142,delete:154,yield:163,await:167,class:172,public:235,private:235,protected:235,readonly:237,instanceof:256,satisfies:259,import:292,keyof:349,unique:353,infer:359,asserts:395,is:397,abstract:417,implements:419,type:421,let:424,var:426,using:429,interface:435,enum:439,namespace:445,module:447,declare:451,global:455,defer:471,for:476,of:485,while:488,with:492,do:496,if:500,else:502,switch:506,case:512,try:518,catch:522,finally:526,return:530,throw:534,break:538,continue:542,debugger:546},Fy={__proto__:null,async:129,get:131,set:133,declare:195,public:197,private:197,protected:197,static:199,abstract:201,override:203,readonly:209,accessor:211,new:401},Iy={__proto__:null,"<":193},Ly=zm.deserialize({version:14,states:"$F|Q%TQlOOO%[QlOOO'_QpOOP(lO`OOO*zQ!0MxO'#CiO+RO#tO'#CjO+aO&jO'#CjO+oO#@ItO'#DaO.QQlO'#DgO.bQlO'#DrO%[QlO'#DzO0fQlO'#ESOOQ!0Lf'#E['#E[O1PQ`O'#EXOOQO'#Ep'#EpOOQO'#Il'#IlO1XQ`O'#GsO1dQ`O'#EoO1iQ`O'#EoO3hQ!0MxO'#JrO6[Q!0MxO'#JsO6uQ`O'#F]O6zQ,UO'#FtOOQ!0Lf'#Ff'#FfO7VO7dO'#FfO9XQMhO'#F|O9`Q`O'#F{OOQ!0Lf'#Js'#JsOOQ!0Lb'#Jr'#JrO9eQ`O'#GwOOQ['#K_'#K_O9pQ`O'#IYO9uQ!0LrO'#IZOOQ['#J`'#J`OOQ['#I_'#I_Q`QlOOQ`QlOOO9}Q!L^O'#DvO:UQlO'#EOO:]QlO'#EQO9kQ`O'#GsO:dQMhO'#CoO:rQ`O'#EnO:}Q`O'#EyO;hQMhO'#FeO;xQ`O'#GsOOQO'#K`'#K`O;}Q`O'#K`O<]Q`O'#G{O<]Q`O'#G|O<]Q`O'#HOO9kQ`O'#HRO=SQ`O'#HUO>kQ`O'#CeO>{Q`O'#HcO?TQ`O'#HiO?TQ`O'#HkO`QlO'#HmO?TQ`O'#HoO?TQ`O'#HrO?YQ`O'#HxO?_Q!0LsO'#IOO%[QlO'#IQO?jQ!0LsO'#ISO?uQ!0LsO'#IUO9uQ!0LrO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m%{%|%}Q-W'VU-k'e'f'gS-o'k'uQ0Q*jS1Q+n+oQ2o-YS2{-l-mQ3S-tS4p0R0UQ5b1RQ6v2uQ6y2|Q7O3TU7{4r4s4vQ9z7}R;O9{S$wi>PR*{%VU%Ui%V>PR0f*yQ$viS(u#v+iS)c$b$cQ)e$dQ*[$xS*e${*YQ*t%OQ*u%QQ+Q%^Q+R%_Q+V%cQ.lPQ=}>XQ>O>YQ>Z>]R>[>^Q+O%]Q.nSR#[WR'Z!el!tQ!r!v!y!z'`'l'm'n-e-u1o5{5}S'V!e-]U*j$|*Z*oS-Y'W'_S0U*k*qQ0^*rQ2u-cQ4v0[R4{0_R({#xQ!fQT-d'`-e]!qQ!r'`-e1o5{Q#p]R'i < TypeParamList in out const TypeDefinition extends ThisType this LiteralType ArithOp Number BooleanLiteral TemplateType InterpolationEnd Interpolation InterpolationStart NullType null VoidType void TypeofType typeof MemberExpression . PropertyName [ TemplateString Escape Interpolation super RegExp ] ArrayExpression Spread , } { ObjectExpression Property async get set PropertyDefinition Block : NewTarget new NewExpression ) ( ArgList UnaryExpression delete LogicOp BitOp YieldExpression yield AwaitExpression await ParenthesizedExpression ClassExpression class ClassBody MethodDeclaration Decorator @ MemberExpression PrivatePropertyName CallExpression TypeArgList CompareOp < declare Privacy static abstract override PrivatePropertyDefinition PropertyDeclaration readonly accessor Optional TypeAnnotation Equals StaticBlock FunctionExpression ArrowFunction ParamList ParamList ArrayPattern ObjectPattern PatternProperty Privacy readonly Arrow MemberExpression BinaryExpression ArithOp ArithOp ArithOp ArithOp BitOp CompareOp instanceof satisfies CompareOp BitOp BitOp BitOp LogicOp LogicOp ConditionalExpression LogicOp LogicOp AssignmentExpression UpdateOp PostfixExpression CallExpression InstantiationExpression TaggedTemplateExpression DynamicImport import ImportMeta JSXElement JSXSelfCloseEndTag JSXSelfClosingTag JSXIdentifier JSXBuiltin JSXIdentifier JSXNamespacedName JSXMemberExpression JSXSpreadAttribute JSXAttribute JSXAttributeValue JSXEscape JSXEndTag JSXOpenTag JSXFragmentTag JSXText JSXEscape JSXStartCloseTag JSXCloseTag PrefixCast < ArrowFunction TypeParamList SequenceExpression InstantiationExpression KeyofType keyof UniqueType unique ImportType InferredType infer TypeName ParenthesizedType FunctionSignature ParamList NewSignature IndexedType TupleType Label ArrayType ReadonlyType ObjectType MethodType PropertyType IndexSignature PropertyDefinition CallSignature TypePredicate asserts is NewSignature new UnionType LogicOp IntersectionType LogicOp ConditionalType ParameterizedType ClassDeclaration abstract implements type VariableDeclaration let var using TypeAliasDeclaration InterfaceDeclaration interface EnumDeclaration enum EnumBody NamespaceDeclaration namespace module AmbientDeclaration declare GlobalDeclaration global ClassDeclaration ClassBody AmbientFunctionDeclaration ExportGroup VariableName VariableName ImportDeclaration defer ImportGroup ForStatement for ForSpec ForInSpec ForOfSpec of WhileStatement while WithStatement with DoStatement do IfStatement if else SwitchStatement switch SwitchBody CaseLabel case DefaultLabel TryStatement try CatchClause catch FinallyClause finally ReturnStatement return ThrowStatement throw BreakStatement break ContinueStatement continue DebuggerStatement debugger LabeledStatement ExpressionStatement SingleExpression SingleClassItem`,maxTerm:380,context:Ey,nodeProps:[[`isolate`,-8,5,6,14,37,39,51,53,55,``],[`group`,-26,9,17,19,68,207,211,215,216,218,221,224,234,237,243,245,247,249,252,258,264,266,268,270,272,274,275,`Statement`,-34,13,14,32,35,36,42,51,54,55,57,62,70,72,76,80,82,84,85,110,111,120,121,136,139,141,142,143,144,145,147,148,167,169,171,`Expression`,-23,31,33,37,41,43,45,173,175,177,178,180,181,182,184,185,186,188,189,190,201,203,205,206,`Type`,-3,88,103,109,`ClassItem`],[`openedBy`,23,`<`,38,`InterpolationStart`,56,`[`,60,`{`,73,`(`,160,`JSXStartCloseTag`],[`closedBy`,-2,24,168,`>`,40,`InterpolationEnd`,50,`]`,61,`}`,74,`)`,165,`JSXEndTag`]],propSources:[Ny],skippedNodes:[0,5,6,278],repeatNodeCount:37,tokenData:"$Fq07[R!bOX%ZXY+gYZ-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Q![Er![!^%Z!^!_*g!_!c%Z!c!}Er!}#O%Z#O#P&c#P#R%Z#R#SEr#S#T%Z#T#oEr#o#p*g#p$g%Z$g;'SEr;'S;=`I|<%lOEr",tokenizers:[Oy,ky,Ay,My,2,3,4,5,6,7,8,9,10,11,12,13,14,Dy,new wm("$S~RRtu[#O#Pg#S#T#|~_P#o#pb~gOx~~jVO#i!P#i#j!U#j#l!P#l#m!q#m;'S!P;'S;=`#v<%lO!P~!UO!U~~!XS!Q![!e!c!i!e#T#Z!e#o#p#Z~!hR!Q![!q!c!i!q#T#Z!q~!tR!Q![!}!c!i!}#T#Z!}~#QR!Q![!P!c!i!P#T#Z!P~#^R!Q![#g!c!i#g#T#Z#g~#jS!Q![#g!c!i#g#T#Z#g#q#r!P~#yP;=`<%l!P~$RO(c~~",141,340),new wm(`j~RQYZXz{^~^O(Q~~aP!P!Qd~iO(R~~`,25,323)],topRules:{Script:[0,7],SingleExpression:[1,276],SingleClassItem:[2,277]},dialects:{jsx:0,ts:15175},dynamicPrecedences:{80:1,82:1,94:1,169:1,199:1},specialized:[{term:327,get:e=>Py[e]||-1},{term:343,get:e=>Fy[e]||-1},{term:95,get:e=>Iy[e]||-1}],tokenPrec:15201}),Ry=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=h_(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(Gy(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 zy(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 By(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;etypeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:By(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function Hy(e,t){return n=>{for(let t=h_(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 Uy=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function Wy(e){return e.selection.main.from}function Gy(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 Ky=Go.define();function qy(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:q.cursor(s.from+a+c.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var Jy=new WeakMap;function Yy(e){if(!Array.isArray(e))return e;let t=Jy.get(e);return t||Jy.set(e,t=Vy(e)),t}var Xy=Jo.define(),Zy=Jo.define(),Qy=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=48&&c<=57||c>=97&&c<=122?2:c>=65&&c<=90?1:0:(v=ao(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+=oo(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?oo(io(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)}},$y=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>``,optionClass:()=>``,aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:nb,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=>tb(e(n),t(n)),optionClass:(e,t)=>n=>tb(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function tb(e,t){return e?t?e+` `+t:e:t}function nb(e,t,n,r,i,a){let o=e.textDirection==pl.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=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`)}}function rb(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;eo&&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 oe.position-t.position).map(e=>e.render)}function ib(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.floor((e-t)/n);return{from:e-(r+1)*n,to:e-r*n}}var ab=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(eb);this.optionContent=rb(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=ib(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]{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(eb).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:Zy.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=ib(r.length,i,e.state.facet(eb).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.to)&&(this.range=ib(t.options.length,t.selected,this.view.state.facet(eb).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=>Zl(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&&sb(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{e.target==r&&e.preventDefault()});let i=null;for(let a=n.from;an.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.tonew ab(n,e,t)}function sb(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.topn.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function cb(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function lb(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(eb);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 Uy(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new $y(n):new Qy(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 Uy(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.namet.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):cb(e.completion)>cb(c)&&(s[s.length-1]=e),c=e.completion}return s}var ub=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,hb(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=lb(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(eb).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;tt.hasResult()?Math.min(e,t.from):e,1e8),create:Tb,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)}},db=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(gb,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(eb),i=(r.override||n.languageDataAt(`autocomplete`,Wy(n)).map(Yy)).map(e=>(this.active.find(t=>t.source==e)||new vb(e,this.active.some(e=>e.state!=0)?1: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(xb));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!fb(i,this.active)||o?a=ub.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 vb(e.source,0):e));for(let e of t.effects)e.is(Sb)&&(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?pb:mb}};function fb(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var gb=[];function _b(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(Ky);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 vb=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=_b(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(Xy))i=new e(i.source,1,n.value);else if(n.is(Zy))i=new e(i.source,0);else if(n.is(xb))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(Wy(e.state))}},yb=class e extends vb{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=Wy(t.state);if(o>a||!r||n&2&&(Wy(t.startState)==this.from||oe.map(t))}}),Sb=Jo.define(),Cb=Do.define({create(){return db.start()},update(e,t){return e.update(t)},provide:e=>[fp.from(e,e=>e.tooltip),X.contentAttributes.from(e,e=>e.attrs)]});function wb(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(Cb).active.find(e=>e.source==t.source);return r instanceof yb?(typeof n==`string`?e.dispatch({...qy(e.state,n,r.from,r.to),annotations:Ky.of(t.completion)}):n(e,t.completion,r.from,r.to),!0):!1}var Tb=ob(Cb,wb),Eb=e=>e.state.field(Cb,!1)?(e.dispatch({effects:Xy.of(!0)}),!0):!1;typeof navigator==`object`&&navigator.platform;var Db=X.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden auto`,maxWidth_fallback:`700px`,maxWidth:`min(700px, 95vw)`,minWidth:`250px`,maxHeight:`10em`,height:`100%`,listStyle:`none`,margin:0,padding:0,"& > li, & > completion-section":{padding:`1px 3px`,lineHeight:1.2},"& > li":{overflowX:`hidden`,textOverflow:`ellipsis`,cursor:`pointer`},"& > completion-section":{display:`list-item`,borderBottom:`1px solid silver`,paddingLeft:`0.5em`,opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#17c`,color:`white`},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#777`},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#347`,color:`white`},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#444`},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:`"···"`,opacity:.5,display:`block`,textAlign:`center`},".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`}}}),Ob=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},kb=class e{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(t){let n=t.mapPos(this.from,-1,co.TrackDel),r=t.mapPos(this.to,1,co.TrackDel);return n==null||r==null?null:new e(this.field,n,r)}},Ab=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;tnew kb(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,c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e=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 Ob(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)}},jb=el.widget({widget:new class extends Qc{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),Mb=el.mark({class:`cm-snippetField`}),Nb=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=el.set(e.map(e=>(e.from==e.to?jb:Mb).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))}},Pb=Jo.define({map(e,t){return e&&e.map(t)}}),Fb=Jo.define(),Ib=Do.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(Pb))return n.value;if(n.is(Fb)&&e)return new Nb(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=>X.decorations.from(e,e=>e?e.deco:el.none)});function Lb(e,t){return q.create(e.filter(e=>e.field==t).map(e=>q.range(e.from,e.to)))}function Rb(e){let t=Ab.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:Wa.of(a)},scrollIntoView:!0,annotations:n?[Ky.of(n),Yo.userEvent.of(`input.complete`)]:void 0};if(o.length&&(c.selection=Lb(o,0)),o.some(e=>e.field>0)){let t=new Nb(o,0),n=c.effects=[Pb.of(t)];e.state.field(Ib,!1)===void 0&&n.push(Jo.appendConfig.of([Ib,Hb,Wb,Db]))}e.dispatch(e.state.update(c))}}function zb(e){return({state:t,dispatch:n})=>{let r=t.field(Ib,!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:Lb(r.ranges,i),effects:Pb.of(a?null:new Nb(r.ranges,i)),scrollIntoView:!0})),!0}}var Bb=[{key:`Tab`,run:zb(1),shift:zb(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(Ib,!1)?(t(e.update({effects:Pb.of(null)})),!0):!1}],Vb=J.define({combine(e){return e.length?e[0]:Bb}}),Hb=Ao.highest(Kf.compute([Vb],e=>e.facet(Vb)));function Ub(e,t){return{...t,apply:Rb(e)}}var Wb=X.domEventHandlers({mousedown(e,t){let n=t.state.field(Ib,!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:Lb(n.ranges,i.field),effects:Pb.of(n.ranges.some(e=>e.field>i.field)?new Nb(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),Gb=new class extends ds{};Gb.startSide=1,Gb.endSide=-1,typeof navigator==`object`&&navigator.userAgent;function Kb(e){let t=e.field(Cb,!1);return t&&t.active.some(e=>e.isPending)?`pending`:t&&t.active.some(e=>e.state!=0)?`active`:null}var qb=[Ub("function ${name}(${params}) {\n ${}\n}",{label:`function`,detail:`definition`,type:`keyword`}),Ub("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n ${}\n}",{label:`for`,detail:`loop`,type:`keyword`}),Ub("for (let ${name} of ${collection}) {\n ${}\n}",{label:`for`,detail:`of loop`,type:`keyword`}),Ub(`do { + \${} +} while (\${})`,{label:`do`,detail:`loop`,type:`keyword`}),Ub(`while (\${}) { + \${} +}`,{label:`while`,detail:`loop`,type:`keyword`}),Ub(`try { + \${} +} catch (\${error}) { + \${} +}`,{label:`try`,detail:`/ catch block`,type:`keyword`}),Ub(`if (\${}) { + \${} +}`,{label:`if`,detail:`block`,type:`keyword`}),Ub(`if (\${}) { + \${} +} else { + \${} +}`,{label:`if`,detail:`/ else block`,type:`keyword`}),Ub(`class \${name} { + constructor(\${params}) { + \${} + } +}`,{label:`class`,detail:`definition`,type:`keyword`}),Ub('import {${names}} from "${module}"\n${}',{label:`import`,detail:`named`,type:`keyword`}),Ub('import ${name} from "${module}"\n${}',{label:`import`,detail:`default`,type:`keyword`})],Jb=qb.concat([Ub(`interface \${name} { + \${} +}`,{label:`interface`,detail:`definition`,type:`keyword`}),Ub("type ${name} = ${type}",{label:`type`,detail:`definition`,type:`keyword`}),Ub(`enum \${name} { + \${} +}`,{label:`enum`,detail:`definition`,type:`keyword`})]),Yb=new Zp,Xb=new Set([`Script`,`Block`,`FunctionExpression`,`FunctionDeclaration`,`ArrowFunction`,`MethodDeclaration`,`ForStatement`]);function Zb(e){return(t,n)=>{let r=t.node.getChild(`VariableDefinition`);return r&&n(r,e),!0}}var Qb=[`FunctionDeclaration`],$b={FunctionDeclaration:Zb(`function`),ClassDeclaration:Zb(`class`),ClassExpression:()=>!0,EnumDeclaration:Zb(`constant`),TypeAliasDeclaration:Zb(`type`),NamespaceDeclaration:Zb(`namespace`),VariableDefinition(e,t){e.matchContext(Qb)||t(e,`variable`)},TypeDefinition(e,t){t(e,`type`)},__proto__:null};function ex(e,t){let n=Yb.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(Ap.IncludeAnonymous).iterate(t=>{if(i)i=!1;else if(t.name){let e=$b[t.name];if(e&&e(t,a)||Xb.has(t.name))return!1}else if(t.to-t.from>8192){for(let n of ex(e,t.node))r.push(n);return!1}}),Yb.set(t,r),r}var tx=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,nx=[`TemplateString`,`String`,`RegExp`,`LineComment`,`BlockComment`,`VariableDefinition`,`TypeDefinition`,`Label`,`PropertyDefinition`,`PropertyName`,`PrivatePropertyDefinition`,`PrivatePropertyName`,`JSXText`,`JSXAttributeValue`,`JSXOpenTag`,`JSXCloseTag`,`JSXSelfClosingTag`,`.`,`?.`];function rx(e){let t=h_(e.state).resolveInner(e.pos,-1);if(nx.indexOf(t.name)>-1)return null;let n=t.name==`VariableName`||t.to-t.from<20&&tx.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let n=t;n;n=n.parent)Xb.has(n.name)&&(r=r.concat(ex(e.state.doc,n)));return{options:r,from:n?t.from:e.pos,validFor:tx}}var ix=m_.define({name:`javascript`,parser:Ly.configure({props:[N_.add({IfStatement:G_({except:/^\s*({|else\b)/}),TryStatement:G_({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:W_,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:H_({closing:`}`}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":G_({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}}),q_.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":J_,BlockComment(e){return{from:e.from+2,to:e.to-2}}})]}),languageData:{closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,"`"]},commentTokens:{line:`//`,block:{open:`/*`,close:`*/`}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:`$`}}),ax={test:e=>/^JSX/.test(e.name),facet:u_({commentTokens:{block:{open:`{/*`,close:`*/}`}}})},ox=ix.configure({dialect:`ts`},`typescript`),sx=ix.configure({dialect:`jsx`,props:[d_.add(e=>e.isTop?[ax]:void 0)]}),cx=ix.configure({dialect:`jsx ts`,props:[d_.add(e=>e.isTop?[ax]:void 0)]},`typescript`),lx=e=>({label:e,type:`keyword`}),ux=`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(lx),dx=ux.concat([`declare`,`implements`,`private`,`protected`,`public`].map(lx));function fx(e={}){let t=e.jsx?e.typescript?cx:sx:e.typescript?ox:ix,n=e.typescript?Jb.concat(dx):qb.concat(ux);return new E_(t,[ix.data.of({autocomplete:Hy(nx,Vy(n))}),ix.data.of({autocomplete:rx}),e.jsx?gx:[]])}function px(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 mx(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 hx=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),gx=X.inputHandler.of((e,t,n,r,i)=>{if((hx?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||r!=`>`&&r!=`/`||!ix.isActiveAt(e.state,t,-1))return!1;let a=i(),{state:o}=a,s=o.changeByRange(e=>{let{head:t}=e,n=h_(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=mx(o.doc,r.firstChild,t))||r.firstChild?.name==`JSXFragmentTag`)){let e=`${i}>`;return{range:q.cursor(t+e.length,-1),changes:{from:t,insert:e}}}}else if(r==`>`){let r=px(n);if(r&&r.name==`JSXOpenTag`&&!/^\/?>|^<\//.test(o.doc.sliceString(t,t+2))&&(i=mx(o.doc,r,t)))return{range:e,changes:{from:t,insert:``}}}}return{range:e}});return s.changes.empty?!1:(e.dispatch([a,o.update(s,{userEvent:`input.complete`,scrollIntoView:!0})]),!0)}),_x=[`_blank`,`_self`,`_top`,`_parent`],vx=[`ascii`,`utf-8`,`utf-16`,`latin1`,`latin1`],yx=[`get`,`post`,`put`,`delete`],bx=[`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`],xx=[`true`,`false`],$={},Sx={a:{attrs:{href:null,ping:null,type:null,media:null,target:_x,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:_x}},bdi:$,bdo:$,blockquote:{attrs:{cite:null}},body:$,br:$,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:[`autofocus`],disabled:[`autofocus`],formenctype:bx,formmethod:yx,formnovalidate:[`novalidate`],formtarget:_x,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":vx,autocomplete:[`on`,`off`],enctype:bx,method:yx,novalidate:[`novalidate`],target:_x}},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:bx,formmethod:yx,formnovalidate:[`novalidate`],formtarget:_x,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:vx,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:vx}},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:$},Cx={accesskey:null,class:null,contenteditable:xx,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:xx,autocorrect:xx,autocapitalize:xx,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":xx,"aria-autocomplete":[`inline`,`list`,`both`,`none`],"aria-busy":xx,"aria-checked":[`true`,`false`,`mixed`,`undefined`],"aria-controls":null,"aria-describedby":null,"aria-disabled":xx,"aria-dropeffect":null,"aria-expanded":[`true`,`false`,`undefined`],"aria-flowto":null,"aria-grabbed":[`true`,`false`,`undefined`],"aria-haspopup":xx,"aria-hidden":xx,"aria-invalid":[`true`,`false`,`grammar`,`spelling`],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":[`off`,`polite`,`assertive`],"aria-multiline":xx,"aria-multiselectable":xx,"aria-owns":null,"aria-posinset":null,"aria-pressed":[`true`,`false`,`mixed`,`undefined`],"aria-readonly":xx,"aria-relevant":null,"aria-required":xx,"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},wx=`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 wx)Cx[e]=null;var Tx=class{constructor(e,t){this.tags={...Sx,...e},this.globalAttrs={...Cx,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};Tx.default=new Tx;function Ex(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 Dx(e,t=!1){for(;e;e=e.parent)if(e.name==`Element`)if(t)t=!1;else return e;return null}function Ox(e,t,n){return n.tags[Ex(e,Dx(t))]?.children||n.allTags}function kx(e,t){let n=[];for(let r=Dx(t);r&&!r.type.isTop;r=Dx(r.parent)){let i=Ex(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 Ax=/^[:\-\.\w\u00b7-\uffff]*$/;function jx(e,t,n,r,i){let a=/\s*>/.test(e.sliceDoc(i,i+5))?``:`>`,o=Dx(n,n.name==`StartTag`||n.name==`TagName`);return{from:r,to:i,options:Ox(e.doc,o,t).map(e=>({label:e,type:`type`})).concat(kx(e.doc,n).map((e,t)=>({label:`/`+e,apply:`/`+e+a,type:`type`,boost:99-t}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function Mx(e,t,n,r){let i=/\s*>/.test(e.sliceDoc(r,r+5))?``:`>`;return{from:n,to:r,options:kx(e.doc,t).map((e,t)=>({label:e,apply:e+i,type:`type`,boost:99-t})),validFor:Ax}}function Nx(e,t,n,r){let i=[],a=0;for(let r of Ox(e.doc,n,t))i.push({label:`<`+r,type:`type`});for(let t of kx(e.doc,n))i.push({label:``,type:`type`,boost:99-a++});return{from:r,to:r,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Px(e,t,n,r,i){let a=Dx(n),o=a?t.tags[Ex(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:Ax}}function Fx(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=Dx(n),i=r?t.tags[Ex(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 Ix(e,t){let{state:n,pos:r}=t,i=h_(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.fromIx(r,e)}var Rx=ix.parser.configure({top:`SingleExpression`}),zx=[{tag:`script`,attrs:e=>e.type==`text/typescript`||e.lang==`ts`,parser:ox.parser},{tag:`script`,attrs:e=>e.type==`text/babel`||e.type==`text/jsx`,parser:sx.parser},{tag:`script`,attrs:e=>e.type==`text/typescript-jsx`,parser:cx.parser},{tag:`script`,attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:Rx},{tag:`script`,attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:ix.parser},{tag:`style`,attrs(e){return(!e.lang||e.lang==`css`)&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:ey.parser}],Bx=[{name:`style`,parser:ey.parser.configure({top:`Styles`})}].concat(wx.map(e=>({name:e,parser:ix.parser}))),Vx=m_.define({name:`html`,parser:Sg.configure({props:[N_.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].lengthe.getChild(`TagName`)})]}),languageData:{commentTokens:{block:{open:``}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:`-_`}}),Hx=Vx.configure({wrap:Eg(zx,Bx)});function Ux(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=Eg((e.nestedLanguages||[]).concat(zx),(e.nestedAttributes||[]).concat(Bx))),new E_(n?Vx.configure({wrap:n,dialect:t}):t?Hx.configure({dialect:t}):Hx,[Hx.data.of({autocomplete:Lx(e)}),e.autoCloseTags===!1?[]:Gx,fx().support,ty().support])}var Wx=new Set(`area base br col command embed frame hr img input keygen link meta param source track wbr menuitem`.split(` `)),Gx=X.inputHandler.of((e,t,n,r,i)=>{if(e.composing||e.state.readOnly||t!=n||r!=`>`&&r!=`/`||!Hx.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=h_(o).resolveInner(n,-1),a;if(t&&r==`>`&&i.name==`EndTag`){let t=i.parent;if(t.parent?.lastChild?.name!=`CloseTag`&&(a=Ex(o.doc,t.parent,n))&&!Wx.has(a))return{range:e,changes:{from:n,to:n+(o.doc.sliceString(n,n+1)===`>`?1:0),insert:``}}}else if(t&&r==`/`&&i.name==`IncompleteCloseTag`){let e=i.parent;if(i.from==n-2&&e.lastChild?.name!=`CloseTag`&&(a=Ex(o.doc,e,n))&&!Wx.has(a)){let e=n+(o.doc.sliceString(n,n+1)===`>`?1:0),t=`${a}>`;return{range:q.cursor(n+t.length,-1),changes:{from:n,to:e,insert:t}}}}return{range:e}});return s.changes.empty?!1:(e.dispatch([a,o.update(s,{userEvent:`input.complete`,scrollIntoView:!0})]),!0)}),Kx=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=Zx(e.state,n.from);return r.line?Jx(e):r.block?Xx(e):!1};function qx(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 Jx=qx(nS,0),Yx=qx(tS,0),Xx=qx((e,t)=>tS(e,t,eS(t)),0);function Zx(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var Qx=50;function $x(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-Qx,r),o=e.sliceDoc(i,i+Qx),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<=2*Qx?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+Qx),d=e.sliceDoc(i-Qx,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))?1:0},close:{pos:i-p-n.length,margin:/\s/.test(d.charAt(m-1))?1:0}}:null}function eS(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 tS(e,t,n=t.selection.ranges){let r=n.map(e=>Zx(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>$x(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;ti&&(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;ee.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)}}else 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 rS=Go.define(),iS=Go.define(),aS=J.define(),oS=J.define({combine(e){return us(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)})}}),sS=Do.define({create(){return CS.empty},update(e,t){let n=t.state.facet(oS),r=t.annotation(rS);if(r){let i=dS.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?fS(o,o.length,n.minDepth,i):vS(o,t.startState.selection),new CS(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(iS);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(Yo.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=dS.fromTransaction(t),o=t.annotation(Yo.time),s=t.annotation(Yo.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 CS(e.done.map(dS.fromJSON),e.undone.map(dS.fromJSON))}});function cS(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(sS,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var lS=cS(0,!1),uS=cS(1,!1),dS=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&&uo.fromJSON(t.changes),[],t.mapped&&lo.fromJSON(t.mapped),t.startSelection&&q.fromJSON(t.startSelection),t.selectionsAfter.map(q.fromJSON))}static fromTransaction(t,n){let r=gS;for(let e of t.startState.facet(aS)){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,gS)}static selection(t){return new e(void 0,gS,void 0,void 0,t)}};function fS(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 pS(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=t&&i<=o&&(r=!0)}}),r}function mS(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function hS(e,t){return e.length?t.length?e.concat(t):e:t}var gS=[],_S=200;function vS(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-_S));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),fS(e,e.length-1,1e9,n.setSelAfter(r)))}else return[dS.selection([t])]}function yS(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 bS(e,t){if(!e.length)return e;let n=e.length,r=gS;for(;n;){let i=xS(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}else t=i.mapped,n--,r=i.selectionsAfter}return r.length?[dS.selection(r)]:gS}function xS(e,t,n){let r=hS(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):gS,n);if(!e.changes)return dS.selection(r);let i=e.changes.map(t),a=t.mapDesc(e.changes,!0),o=e.mapped?e.mapped.composeDesc(a):a;return new dS(i,Jo.mapEffects(e.effects,t),o,e.startSelection.map(a),r)}var SS=/^(input\.type|delete)($|\.)/,CS=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||SS.test(r))&&(!s.selectionsAfter.length&&n-this.prevTime0&&n-this.prevTimen.empty?e.moveByChar(n,t):DS(n,t))}function kS(e){return e.textDirectionAt(e.state.selection.main.head)==pl.LTR}var AS=e=>OS(e,!kS(e)),jS=e=>OS(e,kS(e)),MS=e=>OS(e,!0),NS=e=>OS(e,!1);function PS(e,t){return ES(e,n=>n.empty?e.moveByGroup(n,t):DS(n,t))}var FS=e=>PS(e,!kS(e)),IS=e=>PS(e,kS(e));typeof Intl<`u`&&Intl.Segmenter;function LS(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 RS(e,t,n){let r=h_(e).resolveInner(t.head),i=n?Cp.closedBy:Cp.openedBy;for(let a=t.head;;){let t=n?r.childAfter(a):r.childBefore(a);if(!t)break;LS(e,t,i)?r=t:a=n?t.to:t.from}let a=r.type.prop(i),o,s;return s=a&&(o=n?Ov(e,r.from,1):Ov(e,r.to,-1))&&o.matched?n?o.end.to:o.end.from:n?r.to:r.from,q.cursor(s,n?-1:1)}var zS=e=>ES(e,t=>RS(e.state,t,!kS(e))),BS=e=>ES(e,t=>RS(e.state,t,kS(e)));function VS(e,t){return ES(e,n=>{if(!n.empty)return DS(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var HS=e=>VS(e,!1),US=e=>VS(e,!0);function WS(e){let t=e.scrollDOM.clientHeightr.empty?e.moveVertically(r,t,n.height):DS(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.bottomGS(e,!1),qS=e=>GS(e,!0);function JS(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=q.cursor(r.from+n))}return i}var YS=e=>ES(e,t=>JS(e,t,!0)),XS=e=>ES(e,t=>JS(e,t,!1)),ZS=e=>ES(e,t=>JS(e,t,!kS(e))),QS=e=>ES(e,t=>JS(e,t,kS(e))),$S=e=>ES(e,t=>q.cursor(e.lineBlockAt(t.head).from,1)),eC=e=>ES(e,t=>q.cursor(e.lineBlockAt(t.head).to,-1));function tC(e,t,n){let r=!1,i=wS(e.selection,t=>{let i=Ov(e,t.head,-1)||Ov(e,t.head,1)||t.head>0&&Ov(e,t.head-1,1)||t.headtC(e,t,!1);function rC(e,t){let n=wS(e.state.selection,e=>{let n=t(e);return q.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)});return n.eq(e.state.selection)?!1:(e.dispatch(TS(e.state,n)),!0)}function iC(e,t){return rC(e,n=>e.moveByChar(n,t))}var aC=e=>iC(e,!kS(e)),oC=e=>iC(e,kS(e)),sC=e=>iC(e,!0),cC=e=>iC(e,!1);function lC(e,t){return rC(e,n=>e.moveByGroup(n,t))}var uC=e=>lC(e,!kS(e)),dC=e=>lC(e,kS(e)),fC=e=>lC(e,!0),pC=e=>lC(e,!1),mC=e=>rC(e,t=>RS(e.state,t,!kS(e))),hC=e=>rC(e,t=>RS(e.state,t,kS(e)));function gC(e,t){return rC(e,n=>e.moveVertically(n,t))}var _C=e=>gC(e,!1),vC=e=>gC(e,!0);function yC(e,t){return rC(e,n=>e.moveVertically(n,t,WS(e).height))}var bC=e=>yC(e,!1),xC=e=>yC(e,!0),SC=e=>rC(e,t=>JS(e,t,!0)),CC=e=>rC(e,t=>JS(e,t,!1)),wC=e=>rC(e,t=>JS(e,t,!kS(e))),TC=e=>rC(e,t=>JS(e,t,kS(e))),EC=e=>rC(e,t=>q.cursor(e.lineBlockAt(t.head).from)),DC=e=>rC(e,t=>q.cursor(e.lineBlockAt(t.head).to)),OC=({state:e,dispatch:t})=>(t(TS(e,{anchor:0})),!0),kC=({state:e,dispatch:t})=>(t(TS(e,{anchor:e.doc.length})),!0),AC=({state:e,dispatch:t})=>(t(TS(e,{anchor:e.selection.main.anchor,head:0})),!0),jC=({state:e,dispatch:t})=>(t(TS(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),MC=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),NC=({state:e,dispatch:t})=>{let n=QC(e).map(({from:t,to:n})=>q.range(t,Math.min(n+1,e.doc.length)));return t(e.update({selection:q.create(n),userEvent:`select`})),!0},PC=({state:e,dispatch:t})=>{let n=wS(e.selection,t=>{let n=h_(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.to||n.to>t.to&&n.from<=t.from)&&e.next)return q.range(n.to,n.from)}return t});return n.eq(e.selection)?!1:(t(TS(e,n)),!0)};function FC(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.to0)for(let n=r;;){let r=e.moveVertically(n,t);if(r.heada.to){i.some(e=>e.head==r.head)||i.push(r);break}else if(r.head==n.head)break;else n=r}}return i.length==r.ranges.length?!1:(e.dispatch(TS(n,q.create(i,i.length-1))),!0)}var IC=e=>FC(e,!1),LC=e=>FC(e,!0),RC=({state:e,dispatch:t})=>{let n=e.selection,r=null;return n.ranges.length>1?r=q.create([n.main]):n.main.empty||(r=q.create([q.cursor(n.main.head)])),r?(t(TS(e,r)),!0):!1};function zC(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);oi&&(n=`delete.forward`,o=BC(e,o,!0)),i=Math.min(i,o),a=Math.max(a,o)}else i=BC(e,i,!1),a=BC(e,a,!0);return i==a?{range:r}:{changes:{from:i,to:a},range:q.cursor(i,it(e)))r.between(t,t,(e,r)=>{et&&(t=n?r:e)});return t}var VC=(e,t,n)=>zC(e,r=>{let i=r.from,{state:a}=e,o=a.doc.lineAt(i),s,c;if(n&&!t&&i>o.from&&iVC(e,!1,!0),UC=e=>VC(e,!0,!1),WC=(e,t)=>zC(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=to(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}),GC=e=>WC(e,!1),KC=e=>WC(e,!0),qC=e=>zC(e,t=>{let n=e.lineBlockAt(t.head).to;return t.headzC(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),YC=e=>zC(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head{if(e.readOnly)return!1;let n=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:Wa.of([``,``])},range:q.cursor(e.from)}));return t(e.update(n,{scrollIntoView:!0,userEvent:`input`})),!0},ZC=({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:to(r.text,n-r.from,!1)+r.from,a=n==r.to?n+1:to(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:q.cursor(a)}});return n.changes.empty?!1:(t(e.update(n,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function QC(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 $C(e,t,n){if(e.readOnly)return!1;let r=[],i=[];for(let t of QC(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(q.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(q.range(e.anchor-o,e.head-o))}}return r.length?(t(e.update({changes:r,scrollIntoView:!0,selection:q.create(i,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var ew=({state:e,dispatch:t})=>$C(e,t,!1),tw=({state:e,dispatch:t})=>$C(e,t,!0);function nw(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of QC(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)});return t(e.update({changes:r,scrollIntoView:!0,userEvent:`input.copyline`})),!0}var rw=({state:e,dispatch:t})=>nw(e,t,!1),iw=({state:e,dispatch:t})=>nw(e,t,!0),aw=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(QC(t).map(({from:e,to:n})=>(e>0?e--:n{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 ow(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=h_(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(Cp.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 sw=lw(!1),cw=lw(!0);function lw(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&&ow(t,r);e&&(r=i=(i<=a.to?a:t.doc.lineAt(i)).to);let s=new M_(t,{simulateBreak:r,simulateDoubleBreak:!!o}),c=j_(s,r);for(c??=Os(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize);ia.from&&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:q.range(a.mapPos(r.anchor,1),a.mapPos(r.head,1))}})}var dw=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new M_(e,{overrideIndentation:e=>n[e]??-1}),i=uw(e,(t,i,a)=>{let o=j_(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=A_(e,o);(s!=c||a.frome.readOnly?!1:(t(e.update(uw(e,(t,n)=>{n.push({from:t.from,insert:e.facet(O_)})}),{userEvent:`input.indent`})),!0),pw=({state:e,dispatch:t})=>e.readOnly?!1:(t(e.update(uw(e,(t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let i=Os(r,e.tabSize),a=0,o=A_(e,Math.max(0,i-k_(e)));for(;a(e.setTabFocusMode(),!0),hw=[{key:`Ctrl-b`,run:AS,shift:aC,preventDefault:!0},{key:`Ctrl-f`,run:jS,shift:oC},{key:`Ctrl-p`,run:HS,shift:_C},{key:`Ctrl-n`,run:US,shift:vC},{key:`Ctrl-a`,run:$S,shift:EC},{key:`Ctrl-e`,run:eC,shift:DC},{key:`Ctrl-d`,run:UC},{key:`Ctrl-h`,run:HC},{key:`Ctrl-k`,run:qC},{key:`Ctrl-Alt-h`,run:GC},{key:`Ctrl-o`,run:XC},{key:`Ctrl-t`,run:ZC},{key:`Ctrl-v`,run:qS}],gw=[{key:`ArrowLeft`,run:AS,shift:aC,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:FS,shift:uC,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:ZS,shift:wC,preventDefault:!0},{key:`ArrowRight`,run:jS,shift:oC,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:IS,shift:dC,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:QS,shift:TC,preventDefault:!0},{key:`ArrowUp`,run:HS,shift:_C,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:OC,shift:AC},{mac:`Ctrl-ArrowUp`,run:KS,shift:bC},{key:`ArrowDown`,run:US,shift:vC,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:kC,shift:jC},{mac:`Ctrl-ArrowDown`,run:qS,shift:xC},{key:`PageUp`,run:KS,shift:bC},{key:`PageDown`,run:qS,shift:xC},{key:`Home`,run:XS,shift:CC,preventDefault:!0},{key:`Mod-Home`,run:OC,shift:AC},{key:`End`,run:YS,shift:SC,preventDefault:!0},{key:`Mod-End`,run:kC,shift:jC},{key:`Enter`,run:sw,shift:sw},{key:`Mod-a`,run:MC},{key:`Backspace`,run:HC,shift:HC,preventDefault:!0},{key:`Delete`,run:UC,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:GC,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:KC,preventDefault:!0},{mac:`Mod-Backspace`,run:JC,preventDefault:!0},{mac:`Mod-Delete`,run:YC,preventDefault:!0}].concat(hw.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),_w=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:zS,shift:mC},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:BS,shift:hC},{key:`Alt-ArrowUp`,run:ew},{key:`Shift-Alt-ArrowUp`,run:rw},{key:`Alt-ArrowDown`,run:tw},{key:`Shift-Alt-ArrowDown`,run:iw},{key:`Mod-Alt-ArrowUp`,run:IC},{key:`Mod-Alt-ArrowDown`,run:LC},{key:`Escape`,run:RC},{key:`Mod-Enter`,run:cw},{key:`Alt-l`,mac:`Ctrl-l`,run:NC},{key:`Mod-i`,run:PC,preventDefault:!0},{key:`Mod-[`,run:pw},{key:`Mod-]`,run:fw},{key:`Mod-Alt-\\`,run:dw},{key:`Shift-Mod-k`,run:aw},{key:`Shift-Mod-\\`,run:nC},{key:`Mod-/`,run:Kx},{key:`Alt-A`,run:Yx},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:mw}].concat(gw),vw=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,yw=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(vw(e)):vw,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return io(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=ao(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=oo(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n;;e++){let a=r.charCodeAt(e),o=this.match(a,i,this.bufferPos+this.bufferStart);if(e==r.length-1){if(o)return this.value=o,this;break}i==n&&ethis.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=Dw(this.text,r+(n==r?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(nthis.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return Cw.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,match:t},this.matchPos=Dw(this.text,n+(e==n?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=ww.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(Sw.prototype[Symbol.iterator]=Tw.prototype[Symbol.iterator]=function(){return this});function Ew(e){try{return new RegExp(e,xw),!0}catch{return!1}}function Dw(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t=56320&&r<57344;)t++;return t}var Ow=J.define({combine(e){return us(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new iT(e),scrollToMatch:e=>X.scrollIntoView(e)})}}),kw=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||Ew(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?` +`:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord}create(){return this.regexp?new Rw(this):new Nw(this)}getCursor(e,t=0,n){let r=e.doc?e:ls.create({doc:e});return n??=r.doc.length,this.regexp?Pw(this,r,t,n):jw(this,r,t,n)}},Aw=class{constructor(e){this.spec=e}};function jw(e,t,n,r){return new yw(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),e.wholeWord?Mw(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function Mw(e,t){return(n,r,i,a)=>((a>n||a+i.length=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=jw(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function Pw(e,t,n,r){return new Sw(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?Lw(t.charCategorizer(t.selection.main.head)):void 0},n,r)}function Fw(e,t){return e.slice(to(e,t,!1),t)}function Iw(e,t){return e.slice(t,to(e,t))}function Lw(e){return(t,n,r)=>!r[0].length||(e(Fw(r.input,r.index))!=is.Word||e(Iw(r.input,r.index))!=is.Word)&&(e(Iw(r.input,r.index+r[0].length))!=is.Word||e(Fw(r.input,r.index+r[0].length))!=is.Word)}var Rw=class extends Aw{nextMatch(e,t,n){let r=Pw(this.spec,e,n,e.doc.length).next();return r.done&&(r=Pw(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=Pw(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=Pw(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},zw=Jo.define(),Bw=Jo.define(),Vw=Do.define({create(e){return new Hw($w(e).create(),null)},update(e,t){for(let n of t.effects)n.is(zw)?e=new Hw(n.value.create(),e.panel):n.is(Bw)&&(e=new Hw(e.query,n.value?Qw:null));return e},provide:e=>vp.from(e,e=>e.panel)}),Hw=class{constructor(e,t){this.query=e,this.panel=t}},Uw=el.mark({class:`cm-searchMatch`}),Ww=el.mark({class:`cm-searchMatch cm-searchMatch-selected`}),Gw=tu.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Vw))}update(e){let t=e.state.field(Vw);(t!=e.startState.field(Vw)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return el.none;let{view:n}=this,r=new _s;for(let t=0,i=n.visibleRanges,a=i.length;ti[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?Ww:Uw)})}return r.finish()}},{decorations:e=>e.decorations});function Kw(e){return t=>{let n=t.state.field(Vw,!1);return n&&n.query.spec.valid?e(t,n):nT(t)}}var qw=Kw((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=q.single(r.from,r.to),a=e.state.facet(Ow);return e.dispatch({selection:i,effects:[cT(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),tT(e),!0}),Jw=Kw((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=q.single(i.from,i.to),o=e.state.facet(Ow);return e.dispatch({selection:a,effects:[cT(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),tT(e),!0}),Yw=Kw((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:q.create(n.map(e=>q.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),Xw=Kw((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(X.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`)));let d=e.state.changes(s);return o&&(c=q.single(o.from,o.to).map(d),u.push(cT(e,o)),u.push(n.facet(Ow).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),Zw=Kw((e,{query:t})=>{if(e.state.readOnly)return!1;let n=t.matchAll(e.state,1e9).map(e=>{let{from:n,to:r}=e;return{from:n,to:r,insert:t.getReplacement(e)}});if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:X.announce.of(r),userEvent:`input.replace.all`}),!0});function Qw(e){return e.state.facet(Ow).createPanel(e)}function $w(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(Ow);return new kw({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function eT(e){let t=mp(e,Qw);return t&&t.dom.querySelector(`[main-field]`)}function tT(e){let t=eT(e);t&&t==e.root.activeElement&&t.select()}var nT=e=>{let t=e.state.field(Vw,!1);if(t&&t.panel){let n=eT(e);if(n&&n!=e.root.activeElement){let r=$w(e.state,t.query.spec);r.valid&&e.dispatch({effects:zw.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[Bw.of(!0),t?zw.of($w(e.state,t.query.spec)):Jo.appendConfig.of(uT)]});return!0},rT=e=>{let t=e.state.field(Vw,!1);if(!t||!t.panel)return!1;let n=mp(e,Qw);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Bw.of(!1)}),!0},iT=class{constructor(e){this.view=e;let t=this.query=e.state.field(Vw).query.spec;this.commit=this.commit.bind(this),this.searchField=Ws(`input`,{value:t.search,placeholder:aT(e,`Find`),"aria-label":aT(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=Ws(`input`,{value:t.replace,placeholder:aT(e,`Replace`),"aria-label":aT(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=Ws(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=Ws(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=Ws(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return Ws(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=Ws(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>qw(e),[aT(e,`next`)]),n(`prev`,()=>Jw(e),[aT(e,`previous`)]),n(`select`,()=>Yw(e),[aT(e,`all`)]),Ws(`label`,null,[this.caseField,aT(e,`match case`)]),Ws(`label`,null,[this.reField,aT(e,`regexp`)]),Ws(`label`,null,[this.wordField,aT(e,`by word`)]),...e.state.readOnly?[]:[Ws(`br`),this.replaceField,n(`replace`,()=>Xw(e),[aT(e,`replace`)]),n(`replaceAll`,()=>Zw(e),[aT(e,`replace all`)])],Ws(`button`,{name:`close`,onclick:()=>rT(e),"aria-label":aT(e,`close`),type:`button`},[`×`])])}commit(){let e=new kw({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:zw.of(e)}))}keydown(e){Yf(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Jw:qw)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Xw(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(zw)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Ow).top}};function aT(e,t){return e.state.phrase(t)}var oT=30,sT=/[\s\.,:;?!]/;function cT(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-oT),o=Math.min(i,n+oT),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;es.length-oT;e--)if(!sT.test(s[e-1])&&sT.test(s[e])){s=s.slice(0,e);break}}return X.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var lT=X.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),uT=[Vw,Ao.low(Gw),lT];function dT(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:``,type:`keyToKey`,toKeys:`h`},{keys:``,type:`keyToKey`,toKeys:`l`},{keys:``,type:`keyToKey`,toKeys:`k`},{keys:``,type:`keyToKey`,toKeys:`j`},{keys:`g`,type:`keyToKey`,toKeys:`gk`},{keys:`g`,type:`keyToKey`,toKeys:`gj`},{keys:``,type:`keyToKey`,toKeys:`l`},{keys:``,type:`keyToKey`,toKeys:`h`},{keys:``,type:`keyToKey`,toKeys:`x`},{keys:``,type:`keyToKey`,toKeys:`W`},{keys:``,type:`keyToKey`,toKeys:`B`},{keys:``,type:`keyToKey`,toKeys:`w`},{keys:``,type:`keyToKey`,toKeys:`b`},{keys:``,type:`keyToKey`,toKeys:`j`},{keys:``,type:`keyToKey`,toKeys:`k`},{keys:``,type:`keyToKey`,toKeys:``},{keys:``,type:`keyToKey`,toKeys:``},{keys:``,type:`keyToKey`,toKeys:``,context:`insert`},{keys:``,type:`keyToKey`,toKeys:``,context:`insert`},{keys:``,type:`keyToKey`,toKeys:``},{keys:``,type:`keyToKey`,toKeys:``,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:``,type:`keyToKey`,toKeys:`0`},{keys:``,type:`keyToKey`,toKeys:`$`},{keys:``,type:`keyToKey`,toKeys:``},{keys:``,type:`keyToKey`,toKeys:``},{keys:``,type:`keyToKey`,toKeys:`j^`,context:`normal`},{keys:``,type:`keyToKey`,toKeys:`i`,context:`normal`},{keys:``,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:``,type:`motion`,motion:`moveByPage`,motionArgs:{forward:!0}},{keys:``,type:`motion`,motion:`moveByPage`,motionArgs:{forward:!1}},{keys:``,type:`motion`,motion:`moveByScroll`,motionArgs:{forward:!0,explicitRepeat:!0}},{keys:``,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`,type:`motion`,motion:`moveToCharacter`,motionArgs:{forward:!0,inclusive:!0}},{keys:`F`,type:`motion`,motion:`moveToCharacter`,motionArgs:{forward:!1}},{keys:`t`,type:`motion`,motion:`moveTillCharacter`,motionArgs:{forward:!0,inclusive:!0}},{keys:`T`,type:`motion`,motion:`moveTillCharacter`,motionArgs:{forward:!1}},{keys:`;`,type:`motion`,motion:`repeatLastCharacterSearch`,motionArgs:{forward:!0}},{keys:`,`,type:`motion`,motion:`repeatLastCharacterSearch`,motionArgs:{forward:!1}},{keys:`'`,type:`motion`,motion:`goToMark`,motionArgs:{toJumplist:!0,linewise:!0}},{keys:"`",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:`]`,type:`motion`,motion:`moveToSymbol`,motionArgs:{forward:!0,toJumplist:!0}},{keys:`[`,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:`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:``,type:`operatorMotion`,operator:`delete`,motion:`moveToStartOfLine`,context:`insert`},{keys:``,type:`operatorMotion`,operator:`delete`,motion:`moveByWords`,motionArgs:{forward:!1,wordEnd:!1},context:`insert`},{keys:``,type:`idle`,context:`normal`},{keys:``,type:`action`,action:`jumpListWalk`,actionArgs:{forward:!0}},{keys:``,type:`action`,action:`jumpListWalk`,actionArgs:{forward:!1}},{keys:``,type:`action`,action:`scroll`,actionArgs:{forward:!0,linewise:!0}},{keys:``,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:``,type:`action`,action:`toggleVisualMode`,actionArgs:{blockwise:!0}},{keys:``,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`,type:`action`,action:`replace`,isEdit:!0},{keys:`@`,type:`action`,action:`replayMacro`},{keys:`q`,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:``,type:`action`,action:`redo`},{keys:`m`,type:`action`,action:`setMark`},{keys:`"`,type:`action`,action:`setRegister`},{keys:``,type:`action`,action:`insertRegister`,context:`insert`,isEdit:!0},{keys:``,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`,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:``,type:`action`,action:`incrementNumberToken`,isEdit:!0,actionArgs:{increase:!0,backtrack:!1}},{keys:``,type:`action`,action:`incrementNumberToken`,isEdit:!0,actionArgs:{increase:!1,backtrack:!1}},{keys:``,type:`action`,action:`indent`,actionArgs:{indentRight:!0},context:`insert`},{keys:``,type:`action`,action:`indent`,actionArgs:{indentRight:!1},context:`insert`},{keys:`a`,type:`motion`,motion:`textObjectManipulation`},{keys:`i`,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:`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=de(``);function c(t){t.setOption(`disableInput`,!0),t.setOption(`showCursorWhenSelecting`,!1),e.signal(t,`vim-mode-change`,{mode:`normal`}),t.on(`cursorActivity`,rn),ee(t),e.on(t.getInputField(),`paste`,u(t))}function l(t){t.setOption(`disableInput`,!1),t.off(`cursorActivity`,rn),e.off(t.getInputField(),`paste`,u(t)),t.state.vim=null,It&&clearTimeout(It)}function u(e){var t=e.state.vim;return t.onPasteFn||=function(){t.insertMode||(e.setCursor(Ee(e.getCursor(),0,1)),Se.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;n1&&t.setOption(`textwidth`,n)}});var A=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&&!je(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:t0?1:-1,l,u=a.getCursor();do if(t+=c,s=i[(e+t)%e],s&&(l=s.find())&&!je(u,l))break;while(tr)}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}},j=function(e){return e?{changes:e.changes,expectCursorActivityForChange:e.expectCursorActivityForChange}:{changes:[],expectCursorActivityForChange:!1}};class M{constructor(){this.latestRegister=void 0,this.isPlaying=!1,this.isRecording=!1,this.replaySearchQueries=[],this.onRecordingDone=void 0,this.lastInsertModeChanges=j()}exitMacroRecordMode(){var e=N.macroModeState;e.onRecordingDone&&e.onRecordingDone(),e.onRecordingDone=void 0,e.isRecording=!1}enterMacroRecordMode(e,t){var n=N.registerController.getRegister(t);if(n){if(n.clear(),this.latestRegister=t,e.openDialog){var r=At(`span`,{class:`cm-vim-message`},`recording @`+t);this.onRecordingDone=e.openDialog(r,function(){},{bottom:!0})}this.isRecording=!0}}}function ee(e){return e.state.vim||(e.state.vim={inputState:new fe,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 N;function P(){for(var e in N={searchQuery:null,searchIsReversed:!1,lastSubstituteReplacePart:void 0,jumpList:A(),macroModeState:new M,lastCharacterSearch:{increment:0,forward:!0,selectedCharacter:``},registerController:new R({}),searchHistoryController:new _e,exCommandHistoryController:new _e},E){var t=E[e];t.value=t.defaultValue}}class F{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 I,L={enterVimMode:c,leaveVimMode:l,buildKeyMap:function(){},getRegisterController:function(){return N.registerController},resetVimGlobalState_:P,getVimGlobalState_:function(){return N},maybeInitVimState_:ee,suppressErrorLogging:!1,InsertModeKey:F,map:function(e,t,n){U.map(e,t,n)},unmap:function(e,t){return U.unmap(e,t)},noremap:function(e,t,n){U.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:ue,vimKeyFromEvent:le,setOption:O,getOption:k,defineOption:D,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`);Kt[e]=n,U.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:dn,findKey:function(t,n,i){var a=ee(t),o=t;function s(){var e=N.macroModeState;if(e.isRecording){if(n==`q`)return e.exitMacroRecordMode(),pe(o),!0;i!=`mapping`&&$t(e,n)}}function c(){if(n==``){if(a.visualMode)Ye(o);else if(a.insertMode)W(o);else return;return pe(o),!0}}function l(){if(c())return!0;a.inputState.keyBuffer.push(n);var e=a.inputState.keyBuffer.join(``),t=n.length==1,i=z.matchCommand(e,r,a.inputState,`insert`),s=a.inputState.changeQueue;if(i.type==`none`)return pe(o),!1;if(i.type==`partial`){if(i.expectLiteralNext&&(a.expectLiteralNext=!0),I&&window.clearTimeout(I),I=t&&window.setTimeout(function(){a.insertMode&&a.inputState.keyBuffer.length&&pe(o)},k(`insertModeEscKeysTimeout`)),t){var l=o.listSelections();(!s||s.removed.length!=l.length)&&(s=a.inputState.changeQueue=new me),s.inserted+=n;for(var u=0;u/.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`?ae(o,d.toKeys,d):z.processCommand(o,a,d)}catch(e){throw o.state.vim=void 0,ee(o),L.suppressErrorLogging||console.log(e),e}return!0})}},handleEx:function(e,t){U.processCommand(e,t)},defineMotion:ye,defineAction:Ce,defineOperator:xe,mapCommand:Zt,_mapCommand:Jt,defineRegister:ge,exitVisualMode:Ye,exitInsertMode:W},te=[],ne=!1,re;function ie(e){if(!re)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=` +`;else if(ce[t]){var n=re.value||``,r={key:ce[t],target:{value:n,selectionEnd:n.length,selectionStart:n.length}};re.onKeyDown&&re.onKeyDown(r,re.value,a),re&&re.onKeyUp&&re.onKeyUp(r,re.value,a);return}}if(e==` +`){var i=re;re=null,i.onClose&&i.onClose(i.value)}else re.value=(re.value||``)+e;function a(e){re&&(typeof e==`string`?re.value=e:re=null)}}function ae(e,t,n){var r=ne;if(n){if(te.indexOf(n)!=-1)return;te.push(n),ne=n.noremap!=0}try{for(var i=ee(e),a=/<(?:[CSMA]-)*\w+>|./gi,o;o=a.exec(t);){var s=o[0],c=i.insertMode;if(re){ie(s);continue}if(!L.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=` +`;else if(ce.hasOwnProperty(l)){s=ce[l],cn(e,s);continue}else s=s[0],a.lastIndex=o.index+1}e.replaceSelection(s)}}}finally{if(te.pop(),ne=te.length?r:!1,!te.length&&re){var u=re;re=null,Mt(e,u)}}}var oe={Return:`CR`,Backspace:`BS`,Delete:`Del`,Escape:`Esc`,Insert:`Ins`,ArrowLeft:`Left`,ArrowRight:`Right`,ArrowUp:`Up`,ArrowDown:`Down`,Enter:`CR`," ":`Space`},se={Shift:1,Alt:1,Command:1,Control:1,CapsLock:1,AltGraph:1,Dead:1,Unidentified:1},ce={};`Left|Right|Up|Down|End|Home`.split(`|`).concat(Object.keys(oe)).forEach(function(e){ce[(oe[e]||``).toLowerCase()]=ce[e.toLowerCase()]=e});function le(t,n){var r=t.key;if(!se[r]){r.length>1&&r[0]==`n`&&(r=r.replace(`Numpad`,``)),r=oe[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 ue(e,t){s.string!==e&&(s=de(e)),s.remapCtrl=t}function de(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;n0||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 pe(t,n){t.state.vim.inputState=new fe,t.state.vim.expectLiteralNext=!1,e.signal(t,`vim-command-done`,n)}function me(){this.removed=[],this.inserted=``}class he{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(` +`),this.linewise=!0),this.keyBuffer.push(e)}pushInsertModeChanges(e){this.insertModeChanges.push(j(e))}pushSearchQuery(e){this.searchQueries.push(e)}clear(){this.keyBuffer=[],this.insertModeChanges=[],this.searchQueries=[],this.linewise=!1}toString(){return this.keyBuffer.join(``)}}function ge(e,t){var n=N.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 R{constructor(e){this.registers=e,this.unnamedRegister=e[`"`]=new he,e[`.`]=new he,e[`:`]=new he,e[`/`]=new he,e[`+`]=new he}pushText(e,t,n,r,i){if(e!==`_`){r&&n.charAt(n.length-1)!==` +`&&(n+=` +`);var a=this.isValidRegister(e)?this.getRegister(e):null;if(!a||!e){switch(t){case`yank`:this.registers[0]=new he(n,r,i);break;case`delete`:case`change`:n.indexOf(` +`)==-1?this.registers[`-`]=new he(n,r):(this.shiftNumericRegisters_(),this.registers[1]=new he(n,r));break}this.unnamedRegister.setText(n,r,i);return}S(e)?a.pushText(n,r):a.setText(n,r,i),e===`+`&&navigator.clipboard.writeText(n),this.unnamedRegister.setText(a.toString(),r)}}getRegister(e){return this.isValidRegister(e)?(e=e.toLowerCase(),this.registers[e]||(this.registers[e]=new he),this.registers[e]):this.unnamedRegister}isValidRegister(e){return e&&(T(e,h)||g.test(e))}shiftNumericRegisters_(){for(var e=9;e>=2;e--)this.registers[e]=this.getRegister(``+(e-1))}}class _e{constructor(){this.historyBuffer=[],this.iterator=0,this.initialPrefix=null}nextMatch(e,t){var n=this.historyBuffer,r=t?-1:1;this.initialPrefix===null&&(this.initialPrefix=e);for(var i=this.iterator+r;t?i>=0:i=n.length)return this.iterator=n.length,this.initialPrefix;if(i<0)return e}pushInput(e){var t=this.historyBuffer.indexOf(e);t>-1&&this.historyBuffer.splice(t,1),e.length&&this.historyBuffer.push(e)}reset(){this.initialPrefix=null,this.iterator=this.historyBuffer.length}}var z={matchCommand:function(e,t,n,r){var i=De(e,t,r,n),a=i.full[0];if(!a)return i.partial.length?{type:`partial`,expectLiteralNext:i.partial.length==1&&i.partial[0].keys.slice(-11)==``}:{type:`none`};if(a.keys.slice(-11)==``||a.keys.slice(-10)==``){var o=ke(e);if(!o||o.length>1)return{type:`clear`};n.selectedCharacter=o}return{type:`full`,command:a}},processCommand:function(e,t,n){switch(t.inputState.repeatOverride=n.repeatOverride,n.type){case`motion`:this.processMotion(e,t,n);break;case`operator`:this.processOperator(e,t,n);break;case`operatorMotion`:this.processOperatorMotion(e,t,n);break;case`action`:this.processAction(e,t,n);break;case`search`:this.processSearch(e,t,n);break;case`ex`:case`keyToEx`:this.processEx(e,t,n);break}},processMotion:function(e,t,n){t.inputState.motion=n.motion,t.inputState.motionArgs=Te(n.motionArgs),this.evalInput(e,t)},processOperator:function(e,t,n){var r=t.inputState;if(r.operator)if(r.operator==n.operator){r.motion=`expandToLine`,r.motionArgs={linewise:!0,repeat:1},this.evalInput(e,t);return}else pe(e);r.operator=n.operator,r.operatorArgs=Te(n.operatorArgs),n.keys.length>1&&(r.operatorShortcut=n.keys),n.exitVisualBlock&&(t.visualBlock=!1,Ke(e)),t.visualMode&&this.evalInput(e,t)},processOperatorMotion:function(e,t,n){var r=t.visualMode,i=Te(n.operatorMotionArgs);i&&r&&i.visualLine&&(t.visualLine=!0),this.processOperator(e,t,n),r||this.processMotion(e,t,n)},processAction:function(e,t,n){var r=t.inputState,i=r.getRepeat(),a=!!i,o=Te(n.actionArgs)||{repeat:1};r.selectedCharacter&&(o.selectedCharacter=r.selectedCharacter),n.operator&&this.processOperator(e,t,n),n.motion&&this.processMotion(e,t,n),(n.motion||n.operator)&&this.evalInput(e,t),o.repeat=i||1,o.repeatIsExplicit=a,o.registerName=r.registerName,pe(e),t.lastMotion=null,n.isEdit&&this.recordLastEdit(t,r,n),Se[n.action](e,o,t)},processSearch:function(t,n,r){if(!t.getSearchCursor)return;var i=r.searchArgs.forward,a=r.searchArgs.wholeWordOnly;yt(t).setReversed(!i);var o=i?`/`:`?`,s=yt(t).getQuery(),c=t.getScrollInfo(),l=``;function u(e,i,a){N.searchHistoryController.pushInput(e),N.searchHistoryController.reset();try{Pt(t,e,i,a)}catch{H(t,`Invalid regex: `+e),pe(t);return}z.processMotion(t,n,{keys:``,type:`motion`,motion:`findNext`,motionArgs:{forward:!0,toJumplist:r.searchArgs.toJumplist}})}function d(e){t.scrollTo(c.left,c.top),u(e,!0,!0);var n=N.macroModeState;n.isRecording&&tn(n,e)}function f(){return k(`pcre`)?`(JavaScript regexp: set pcre)`:`(Vim regexp: set nopcre)`}function p(e,t,n){var r=le(e),i,a;r==``||r==``?(i=r==``,a=e.target?e.target.selectionEnd:0,t=N.searchHistoryController.nextMatch(t,i)||``,n(t),a&&e.target&&(e.target.selectionEnd=e.target.selectionStart=Math.min(a,e.target.value.length))):r&&r!=``&&r!=``&&N.searchHistoryController.reset(),l=t,m()}function m(){var e;try{e=Pt(t,l,!0,!0)}catch{}e?t.scrollIntoView(Rt(t,!i,e),30):(Bt(t),t.scrollTo(c.left,c.top))}function h(n,r,i){var a=le(n);a==``||a==``||a==``||a==``&&r==``?(N.searchHistoryController.pushInput(r),N.searchHistoryController.reset(),Pt(t,s?.source||``),Bt(t),t.scrollTo(c.left,c.top),e.e_stop(n),pe(t),i(),t.focus()):a==``||a==``?e.e_stop(n):a==``&&(e.e_stop(n),i(``))}switch(r.searchArgs.querySrc){case`prompt`:var g=N.macroModeState;g.isPlaying?u(g.replaySearchQueries.shift()||``,!0,!1):Mt(t,{onClose:d,prefix:o,desc:At(`span`,{$cursor:`pointer`,onmousedown:function(e){e.preventDefault(),O(`pcre`,!k(`pcre`)),this.textContent=f(),m()}},f()),onKeyUp:p,onKeyDown:h});break;case`wordUnderCursor`:var _=$e(t,{noSymbol:!0}),v=!0;if(_||(_=$e(t,{noSymbol:!1}),v=!1),!_){H(t,`No word under cursor`),pe(t);return}let e=t.getLine(_.start.line).substring(_.start.ch,_.end.ch);e=v&&a?`\\b`+e+`\\b`:Re(e),N.jumpList.cachedCursor=t.getCursor(),t.setCursor(_.start),u(e,!0,!1);break}},processEx:function(t,n,r){function i(e){N.exCommandHistoryController.pushInput(e),N.exCommandHistoryController.reset(),U.processCommand(t,e),t.state.vim&&pe(t),Bt(t)}function a(n,r,i){var a=le(n),o,s;(a==``||a==``||a==``||a==``&&r==``)&&(N.exCommandHistoryController.pushInput(r),N.exCommandHistoryController.reset(),e.e_stop(n),pe(t),Bt(t),i(),t.focus()),a==``||a==``?(e.e_stop(n),o=a==``,s=n.target?n.target.selectionEnd:0,r=N.exCommandHistoryController.nextMatch(r,o)||``,i(r),s&&n.target&&(n.target.selectionEnd=n.target.selectionStart=Math.min(s,n.target.value.length))):a==``?(e.e_stop(n),i(``)):a&&a!=``&&a!=``&&N.exCommandHistoryController.reset()}function o(n,r){var i=new e.StringStream(r),a={};try{if(U.parseInput_(t,i,a),a.commandName!=`s`){Bt(t);return}var o=U.matchCommand_(a.commandName);if(!o||(U.parseCommandArgs_(i,a,o),!a.argString))return;var s=kt(a.argString.slice(1),!0,!0);s&&Lt(t,s)}catch{}}if(r.type==`keyToEx`)U.processCommand(t,r.exArgs.input);else{var s={onClose:i,onKeyDown:a,onKeyUp:o,prefix:`:`};n.visualMode&&(s.value=`'<,'>`,s.selectValueOnOpen=!1),Mt(t,s)}},evalInput:function(e,r){var i=r.inputState,a=i.motion,o=i.motionArgs||{repeat:1},s=i.operator,c=i.operatorArgs||{},l=i.registerName,u=r.sel,d=V(r.visualMode?we(e,u.head):e.getCursor(`head`)),f=V(r.visualMode?we(e,u.anchor):e.getCursor(`anchor`)),p=V(d),m=V(f),h,g,_;if(s&&this.recordLastEdit(r,i),_=i.repeatOverride===void 0?i.getRepeat():i.repeatOverride,_>0&&o.explicitRepeat?o.repeatIsExplicit=!0:(o.noRepeat||!o.explicitRepeat&&_===0)&&(_=1,o.repeatIsExplicit=!1),i.selectedCharacter&&(o.selectedCharacter=c.selectedCharacter=i.selectedCharacter),o.repeat=_,pe(e),a){var v=ve[a](e,d,o,r,i);if(r.lastMotion=ve[a],!v)return;if(o.toJumplist){var y=N.jumpList,b=y.cachedCursor;b?(tt(e,b,v),delete y.cachedCursor):tt(e,d,v)}v instanceof Array?(g=v[0],h=v[1]):h=v,h||=V(d),r.visualMode?(r.visualBlock&&h.ch===1/0||(h=we(e,h,p)),g&&=we(e,g),g||=m,u.anchor=g,u.head=h,Ke(e),dt(e,r,`<`,Me(g,h)?g:h),dt(e,r,`>`,Me(g,h)?h:g)):s||(h=we(e,h,p),e.setCursor(h.line,h.ch))}if(s){if(c.lastSel){g=m;var x=c.lastSel,S=Math.abs(x.head.line-x.anchor.line),C=Math.abs(x.head.ch-x.anchor.ch);h=x.visualLine?new t(m.line+S,m.ch):x.visualBlock?new t(m.line+S,m.ch+C):x.head.line==x.anchor.line?new t(m.line,m.ch+C):new t(m.line+S,m.ch),r.visualMode=!0,r.visualLine=x.visualLine,r.visualBlock=x.visualBlock,u=r.sel={anchor:g,head:h},Ke(e)}else r.visualMode&&(c.lastSel={anchor:V(u.anchor),head:V(u.head),visualBlock:r.visualBlock,visualLine:r.visualLine});var w,T,E,D,O;if(r.visualMode){w=Ne(u.head,u.anchor),T=Pe(u.head,u.anchor),E=r.visualLine||c.linewise,D=r.visualBlock?`block`:E?`line`:`char`;var k=n(e,w,T);if(O=qe(e,{anchor:k.start,head:k.end},D),E){var A=O.ranges;if(D==`block`)for(var j=0;jc:d.lineu&&a.line==u?ct(e,n,r,i,!0):(r.toFirstChar&&(o=Qe(e.getLine(c)),i.lastHPos=o),i.lastHSPos=e.charCoords(new t(c,o),`div`).left,new t(c,o))},moveByDisplayLines:function(e,n,r,i){var a=n;switch(i.lastMotion){case this.moveByDisplayLines:case this.moveByScroll:case this.moveByLines:case this.moveToColumn:case this.moveToEol:break;default:i.lastHSPos=e.charCoords(a,`div`).left}var o=r.repeat,s=e.findPosV(a,r.forward?o:-o,`line`,i.lastHSPos);if(s.hitSide)if(r.forward){var c={top:e.charCoords(s,`div`).top+8,left:i.lastHSPos};s=e.coordsChar(c,`div`)}else{var l=e.charCoords(new t(e.firstLine(),0),`div`);l.left=i.lastHSPos,s=e.coordsChar(l,`div`)}return i.lastHPos=s.ch,s},moveByPage:function(e,t,n){var r=t,i=n.repeat;return e.findPosV(r,n.forward?i:-i,`page`)},moveByParagraph:function(e,t,n){var r=n.forward?1:-1;return pt(e,t,n.repeat,r).start},moveBySentence:function(e,t,n){var r=n.forward?1:-1;return ht(e,t,n.repeat,r)},moveByScroll:function(e,t,n,r){var i=e.getScrollInfo(),a=null,o=n.repeat;o||=i.clientHeight/(2*e.defaultTextHeight());var s=e.charCoords(t,`local`);if(n.repeat=o,a=ve.moveByDisplayLines(e,t,n,r),!a)return null;var c=e.charCoords(a,`local`);return e.scrollTo(null,i.top+c.top-s.top),a},moveByWords:function(e,t,n){return st(e,t,n.repeat,!!n.forward,!!n.wordEnd,!!n.bigWord)},moveTillCharacter:function(e,t,n){var r=n.repeat,i=lt(e,r,n.forward,n.selectedCharacter,t),a=n.forward?-1:1;return nt(a,n),i?(i.ch+=a,i):null},moveToCharacter:function(e,t,n){var r=n.repeat;return nt(0,n),lt(e,r,n.forward,n.selectedCharacter,t)||t},moveToSymbol:function(e,t,n){var r=n.repeat;return n.selectedCharacter&&at(e,r,n.forward,n.selectedCharacter)||t},moveToColumn:function(e,t,n,r){var i=n.repeat;return r.lastHPos=i-1,r.lastHSPos=e.charCoords(t,`div`).left,ut(e,i)},moveToEol:function(e,t,n,r){return ct(e,t,n,r,!1)},moveToFirstNonWhiteSpaceCharacter:function(e,n){var r=n;return new t(r.line,Qe(e.getLine(r.line)))},moveToMatchedSymbol:function(e,n){for(var r=n,i=r.line,a=r.ch,o=e.getLine(i),s;a`?/[(){}[\]<>]/:/[(){}[\]]/;return e.findMatchingBracket(new t(i,a),{bracketRegex:l}).to}else return r},moveToStartOfLine:function(e,n){return new t(n.line,0)},moveToLineOrEdgeOfDocument:function(e,n,r){var i=r.forward?e.lastLine():e.firstLine();return r.repeatIsExplicit&&(i=r.repeat-e.getOption(`firstLineNumber`)),new t(i,Qe(e.getLine(i)))},moveToStartOfDisplayLine:function(e){return e.execCommand(`goLineLeft`),e.getCursor()},moveToEndOfDisplayLine:function(e){e.execCommand(`goLineRight`);var t=e.getCursor();return t.sticky==`before`&&t.ch--,t},textObjectManipulation:function(e,t,n,r){var i={"(":`)`,")":`(`,"{":`}`,"}":`{`,"[":`]`,"]":`[`,"<":`>`,">":`<`},a={"'":!0,'"':!0,"`":!0},o=n.selectedCharacter||``;o==`b`?o=`(`:o==`B`&&(o=`{`);var s=!n.textObjectInner,c,l;if(i[o]){if(l=!0,c=gt(e,t,o,s),!c){var u=e.getSearchCursor(RegExp(`\\`+o,`g`),t);u.find()&&(c=gt(e,u.from(),o,s))}}else if(a[o])l=!0,c=_t(e,t,o,s);else if(o===`W`||o===`w`)for(var d=n.repeat||1;d-- >0;){var f=$e(e,{inclusive:s,innerWord:!s,bigWord:o===`W`,noSymbol:o===`W`,multiline:!0},c&&c.end);f&&(c||=f,c.end=f.end)}else if(o===`p`)if(c=pt(e,t,n.repeat,0,s),n.linewise=!0,r.visualMode)r.visualLine||=!0;else{var p=r.inputState.operatorArgs;p&&(p.linewise=!0),c.end.line--}else if(o===`t`)c=et(e,t,s);else if(o===`s`){var m=e.getLine(t.line);t.ch>0&&w(m[t.ch])&&--t.ch;var h=mt(e,t,n.repeat,1,s),g=mt(e,t,n.repeat,-1,s);C(e.getLine(g.line)[g.ch])&&C(e.getLine(h.line)[h.ch-1])&&(g={line:g.line,ch:g.ch+1}),c={start:g,end:h}}return c?e.state.vim.visualMode?Ge(e,c.start,c.end,l):[c.start,c.end]:null},repeatLastCharacterSearch:function(e,t,n){var r=N.lastCharacterSearch,i=n.repeat,a=n.forward===r.forward,o=(r.increment?1:0)*(a?-1:1);e.moveH(-o,`char`),n.inclusive=!!a;var s=lt(e,i,a,r.selectedCharacter);return s?(s.ch+=o,s):(e.moveH(o,`char`),t)}};function ye(e,t){ve[e]=t}function B(e,t){for(var n=[],r=0;rs.line&&(c=new t(c.line-1,Number.MAX_VALUE))),e.replaceRange(``,s,c),i=s}N.registerController.pushText(n.registerName,`change`,a,n.linewise,r.length>1),Se.enterInsertMode(e,{head:i},e.state.vim)},delete:function(e,n,r){var i,a,o=e.state.vim;if(o.visualBlock){a=e.getSelection();var s=B(``,r.length);e.replaceSelections(s),i=Ne(r[0].head,r[0].anchor)}else{var c=r[0].anchor,l=r[0].head;n.linewise&&l.line!=e.firstLine()&&c.line==e.lastLine()&&c.line==l.line-1&&(c.line==e.firstLine()?c.ch=0:c=new t(c.line-1,Ie(e,c.line-1))),a=e.getRange(c,l),e.replaceRange(``,c,l),i=c,n.linewise&&(i=ve.moveToFirstNonWhiteSpaceCharacter(e,c))}return N.registerController.pushText(n.registerName,`delete`,a,n.linewise,o.visualBlock),we(e,i)},indent:function(e,t,n){var r=e.state.vim,i=r.visualMode&&t.repeat||1;if(r.visualBlock){for(var a=e.getOption(`tabSize`),o=e.getOption(`indentWithTabs`)?` `:` `.repeat(a),s,c=n.length-1;c>=0;c--)if(s=Ne(n[c].anchor,n[c].head),t.indentRight)e.replaceRange(o.repeat(i),s,s);else{for(var l=e.getLine(s.line),u=0,d=0;da&&n.linewise&&s--,n.keepCursor?i:new t(s,0)}},changeCase:function(e,t,n,r,i){for(var a=e.getSelections(),o=[],s=t.toLower,c=0;c{let t=e.charCodeAt(0);return t>=65&&t<=90?String.fromCharCode(65+(t-65+13)%26):t>=97&&t<=122?String.fromCharCode(97+(t-97+13)%26):e}).join(``);o.push(e)}return e.replaceSelections(o),t.shouldMoveCursor?i:!e.state.vim.visualMode&&t.linewise&&n[0].anchor.line+1==n[0].head.line?ve.moveToFirstNonWhiteSpaceCharacter(e,r):t.linewise?r:Ne(n[0].anchor,n[0].head)}};function xe(e,t){be[e]=t}var Se={jumpListWalk:function(e,t,n){if(!n.visualMode){var r=t.repeat||1,i=t.forward,a=N.jumpList.move(e,i?r:-r),o=a?a.find():void 0;o||=e.getCursor(),e.setCursor(o)}},scroll:function(e,t,n){if(!n.visualMode){var r=t.repeat||1,i=e.defaultTextHeight(),a=e.getScrollInfo().top,o=i*r,s=t.forward?a+o:a-o,c=V(e.getCursor()),l=e.charCoords(c,`local`);if(t.forward)s>l.top?(c.line+=(s-l.top)/i,c.line=Math.ceil(c.line),e.setCursor(c),l=e.charCoords(c,`local`),e.scrollTo(null,l.top)):e.scrollTo(null,s);else{var u=s+e.getScrollInfo().clientHeight;u=s.anchor.line?Ee(s.head,0,1):new t(s.anchor.line,0)}else if(o==`inplace`){if(a.visualMode)return}else o==`lastEdit`&&(c=Wt(r)||c);r.setOption(`disableInput`,!1),i&&i.replace?(r.toggleOverwrite(!0),r.setOption(`keyMap`,`vim-replace`),e.signal(r,`vim-mode-change`,{mode:`replace`})):(r.toggleOverwrite(!1),r.setOption(`keyMap`,`vim-insert`),e.signal(r,`vim-mode-change`,{mode:`insert`})),N.macroModeState.isPlaying||(r.on(`change`,nn),a.insertEnd&&a.insertEnd.clear(),a.insertEnd=r.setBookmark(c,{insertLeft:!0}),e.on(r.getInputField(),`keydown`,on)),a.visualMode&&Ye(r),Ve(r,c,l)}},toggleVisualMode:function(r,i,a){var o=i.repeat,s=r.getCursor(),c;if(a.visualMode)a.visualLine!=!!i.linewise||a.visualBlock!=!!i.blockwise?(a.visualLine=!!i.linewise,a.visualBlock=!!i.blockwise,e.signal(r,`vim-mode-change`,{mode:`visual`,subMode:a.visualLine?`linewise`:a.visualBlock?`blockwise`:``}),Ke(r)):Ye(r);else{a.visualMode=!0,a.visualLine=!!i.linewise,a.visualBlock=!!i.blockwise,c=we(r,new t(s.line,s.ch+o-1));var l=n(r,s,c);a.sel={anchor:l.start,head:l.end},e.signal(r,`vim-mode-change`,{mode:`visual`,subMode:a.visualLine?`linewise`:a.visualBlock?`blockwise`:``}),Ke(r),dt(r,a,`<`,Ne(s,c)),dt(r,a,`>`,Pe(s,c))}},reselectLastSelection:function(t,n,r){var i=r.lastSelection;if(r.visualMode&&We(t,r),i){var a=i.anchorMark.find(),o=i.headMark.find();if(!a||!o)return;r.sel={anchor:a,head:o},r.visualMode=!0,r.visualLine=i.visualLine,r.visualBlock=i.visualBlock,Ke(t),dt(t,r,`<`,Ne(a,o)),dt(t,r,`>`,Pe(a,o)),e.signal(t,`vim-mode-change`,{mode:`visual`,subMode:r.visualLine?`linewise`:r.visualBlock?`blockwise`:``})}},joinLines:function(e,n,r){var i,a;if(r.visualMode){if(i=e.getCursor(`anchor`),a=e.getCursor(`head`),Me(a,i)){var o=a;a=i,i=o}a.ch=Ie(e,a.line)-1}else{var s=Math.max(n.repeat,2);i=e.getCursor(),a=we(e,new t(i.line+s-1,1/0))}for(var c=0,l=i.line;l{this.continuePaste(e,t,n,i,r)});else{var i=r.toString();this.continuePaste(e,t,n,i,r)}},continuePaste:function(e,n,r,i,a){var o=V(e.getCursor());if(i){if(n.matchIndent){var s=e.getOption(`tabSize`),c=function(e){var t=e.split(` `).length-1,n=e.split(` `).length-1;return t*s+n*1},l=c(e.getLine(e.getCursor().line).match(/^\s*/)[0]),u=i.replace(/\n$/,``),d=i!==u,f=c(i.match(/^\s*/)[0]),i=u.replace(/^\s*/gm,function(t){var n=l+(c(t)-f);if(n<0)return``;if(e.getOption(`indentWithTabs`)){var r=Math.floor(n/s);return Array(r+1).join(` `)}else return Array(n+1).join(` `)});i+=d?` +`:``}n.repeat>1&&(i=Array(n.repeat+1).join(i));var p=a.linewise,m=a.blockwise,h=m?i.split(` +`):void 0;if(h){p&&h.pop();for(var g=0;ge.lastLine()&&e.replaceRange(` +`,new t(T,0)),Ie(e,T)d.length&&(c=d.length),l=new t(s.line,c)}var f=n(r,s,l);if(s=f.start,l=f.end,o==` +`)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(` +`);r.replaceSelections(h)}else r.replaceRange(p,s,l);a.visualMode?(s=Me(u[0].anchor,u[0].head)?u[0].anchor:u[0].head,r.setCursor(s),Ye(r,!1)):r.setCursor(Ee(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.chl&&(d=-1),l+=d,l>c&&(l-=2)}return new t(o,l)}function Te(e){var t={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t}function Ee(e,n,r){return typeof n==`object`&&(r=n.ch,n=n.line),new t(e.line+n,e.ch+r)}function De(e,t,n,r){r.operator&&(n=`operatorPending`);for(var i,o=[],s=[],c=ne?t.length-a:0;c`,r=t.slice(-10)==``;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`:!1}else return e==t?`full`:t.indexOf(e)==0?`partial`:!1}function ke(e){var t=/^.*(<[^>]+>)$/.exec(e),n=t?t[1]:e.slice(-1);if(n.length>1)switch(n){case``:case``:n=` +`;break;case``:case``:n=` `;break;default:n=``;break}return n}function Ae(e,t,n){return function(){for(var r=0;r2&&(t=Ne.apply(void 0,Array.prototype.slice.call(arguments,1))),Me(e,t)?e:t}function Pe(e,t){return arguments.length>2&&(t=Pe.apply(void 0,Array.prototype.slice.call(arguments,1))),Me(e,t)?t:e}function Fe(e,t,n){var r=Me(e,t),i=Me(t,n);return r&&i}function Ie(e,t){return e.getLine(t).length}function Le(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,``)}function Re(e){return e.replace(/([.?*+$\[\]\/\\(){}|\-])/g,`\\$1`)}function ze(e,n,r){var i=Ie(e,n),a=Array(r-i+1).join(` `);e.setCursor(new t(n,i)),e.replaceRange(a,e.getCursor())}function Be(e,n){var r=[],i=e.listSelections(),a=V(e.clipPos(n)),o=!je(n,a),s=He(i,e.getCursor(`head`)),c=je(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 Ve(e,t,n){for(var r=[],i=0;il&&(a.line=l),a.ch=Ie(e,a.line)}return{ranges:[{anchor:o,head:a}],primary:0}}else if(r==`block`){var u=Math.min(o.line,a.line),d=o.ch,f=Math.max(o.line,a.line),p=a.ch;d0&&a&&C(a);a=i.pop())n.line--,n.ch=0;a?(n.line--,n.ch=Ie(e,n.line)):n.ch=0}}function Ze(e,t,n){t.ch=0,n.ch=0,n.line++}function Qe(e){if(!e)return 0;var t=e.search(/\S/);return t==-1?e.length:t}function $e(e,{inclusive:n,innerWord:r,bigWord:i,noSymbol:a,multiline:o},s){var c=s||Je(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=ot(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))&&v0;)y--;!y&&!x&&(y=S)}}return{start:new t(d,y),end:new t(m,v)}}function et(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 tt(e,t,n){je(t,n)||N.jumpList.add(e,t,n)}function nt(e,t){N.lastCharacterSearch.increment=e,N.lastCharacterSearch.forward=t.forward,N.lastCharacterSearch.selectedCharacter=t.selectedCharacter}var rt={"(":`bracket`,")":`bracket`,"{":`bracket`,"}":`bracket`,"[":`section`,"]":`section`,"*":`comment`,"/":`comment`,m:`method`,M:`method`,"#":`preprocess`},it={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 at(e,n,r,i){var a=V(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=rt[i];if(!f)return a;var p=it[f].init,m=it[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 ot(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;g0?0:s.length}}function st(e,n,r,i,a,o){var s=V(n),c=[];(i&&!a||!i&&a)&&r++;for(var l=!(i&&a),u=0;u0;)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 mt(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}}else 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 ht(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;u0;)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 gt(e,n,r,i){var a=n,o={"(":/[()]/,")":/[()]/,"[":/[[\]]/,"]":/[[\]]/,"{":/[{}]/,"}":/[{}]/,"<":/[<>]/,">":/[<>]/}[r],s={"(":`(`,")":`(`,"[":`[`,"]":`[`,"{":`{`,"}":`{`,"<":`<`,">":`<`}[r],c=e.getLine(a.line).charAt(a.ch)===s?1:0,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 _t(e,n,r,i){var a=V(n),o=e.getLine(a.line).split(``),s,c,l,u,d=o.indexOf(r);if(a.ch-1&&!s;l--)o[l]==r&&(s=l+1);if(s&&!c)for(l=s,u=o.length;l`},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}else 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 Tt={"\\n":` +`,"\\r":`\r`,"\\t":` `};function Et(e){for(var t=!1,n=[],r=-1;r=t&&e<=n:e==t}function Ht(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 Ut(e,n,r){if(r==`'`||r=="`")return N.jumpList.find(e,-1)||new t(0,0);if(r==`.`)return Wt(e);var i=n.marks[r];return i&&i.find()}function Wt(e){if(e.getLastEditEnd)return e.getLastEditEnd();for(var t=e.doc.history.done,n=t.length;n--;)if(t[n].changes)return V(t[n].changes[0].to)}class Gt{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=N.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){throw H(t,e+``),e}i.visualMode&&Ye(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`){ae(t,l.toKeys||``,l);return}else if(l.type==`exToEx`){this.processCommand(t,l.toInput||``);return}}if(!u){H(t,`Not an editor command ":`+n+`"`);return}try{Kt[u](t,c),(!l||!l.possiblyAsync)&&c.callback&&c.callback()}catch(e){throw H(t,e+``),e}}parseInput_(e,t,n){t.eatWhile(`:`),t.eat(`%`)?(n.line=e.firstLine(),n.lineEnd=e.lastLine()):(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=Ut(e,e.state.vim,`<`)?.line,n.selectionLineEnd=Ut(e,e.state.vim,`>`)?.line):n.selectionLine=e.getCursor().line:(n.selectionLine=n.line,n.selectionLineEnd=n.lineEnd);var r=t.match(/^(\w+|!!|@@|[!#&*<=>@~])/);return r?n.commandName=r[1]:n.commandName=(t.match(/.*/)||[``])[0],n}parseLineSpec_(e,t){var n=t.match(/^(\d+)/);if(n)return parseInt(n[1],10)-1;switch(t.next()){case`.`:return this.parseLineSpecOffset_(t,e.getCursor().line);case`$`:return this.parseLineSpecOffset_(t,e.lastLine());case`'`:var r=t.next()||``,i=Ut(e,e.state.vim,r);if(!i)throw Error(`Mark not set`);return this.parseLineSpecOffset_(t,i.line);case`-`:case`+`:return t.backUp(1),this.parseLineSpecOffset_(t,e.getCursor().line);default:t.backUp(1);return}}parseLineSpecOffset_(e,t){var n=e.match(/^([+-])?(\d+)/);if(n){var r=parseInt(n[2],10);n[1]==`-`?t-=r:t+=r}return t}parseCommandArgs_(e,t,n){if(!e.eol()){t.argString=e.match(/.*/)?.[0];var r=n.argDelimiter||/\s+/,i=Le(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;e0?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=E[a]&&E[a].type==`boolean`;if(l&&(c?o=!k(a,e,r):o??=!0),!l&&o===void 0||s){var u=k(a,e,r);u instanceof Error?H(e,u.message):u===!0||u===!1?H(e,` `+(u?``:`no`)+a):H(e,` `+a+`=`+u)}else{var d=O(a,o,e,r);d instanceof Error&&H(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=N.registerController.registers,i=`----------Registers---------- + +`;if(n)for(var a=n.join(``),o=0;o1)return`Invalid arguments`;s=l&&`decimal`||u&&`hex`||d&&`octal`}n[2]&&(c=new RegExp(n[2].substr(1,n[2].length-2),a?`i`:``))}}var u=l();if(u){H(n,u+`: `+r.argString);return}var d=r.line||n.firstLine(),f=r.lineEnd||r.line||n.lastLine();if(d==f)return;var p=new t(d,0),m=new t(f,Ie(n,f)),h=n.getRange(p,m).split(` +`),g=s==`decimal`?/(-?)([\d]+)/:s==`hex`?/(-?)(?:0x)?([0-9a-f]+)/i:s==`octal`?/([0-7]+)/:null,_=s==`decimal`?10:s==`hex`?16:s==`octal`?8:void 0,v=[],y=[];if(s||c)for(var b=0;b=u){H(t,`Invalid argument: `+n.argString.substring(a));return}for(var d=0;d<=u-l;d++){var f=String.fromCharCode(l+d);delete r.marks[f]}}else{H(t,`Invalid argument: `+s+`-`);return}}else o&&delete r.marks[o]}}},U=new Gt;L.defineEx(`version`,`ve`,e=>{H(e,`Codemirror-vim version: 6.3.0`)});function qt(t,n,r,i,a,o,s,c,l){t.state.vim.exMode=!0;var u=!1,d=0,f,p,m;function h(){t.operation(function(){for(;!u;)g(),v();y()})}function g(){var e=``,n=o.match||o.pos&&o.pos.match;e=n?c.replace(/\$(\d{1,3}|[$&])/g,function(e,t){if(t==`$`)return`$`;if(t==`&`)return n[0];for(var r=t;parseInt(r)>=n.length&&r.length>0;)r=r.slice(0,r.length-1);return r?n[r]+t.slice(r.length,t.length):e}):t.getRange(o.from(),o.to()).replace(s,c);var r=o.to().line;o.replace(e),p=o.to().line,a+=p-r,m=p`:case``:case``:y(i);break}return u&&y(i),!0}if(v(),u){H(t,`No matches for `+s+(k(`pcre`)?` (set nopcre to use vim regexps)`:``));return}if(!n){h(),l&&l();return}Mt(t,{prefix:At(`span`,`replace with `,At(`strong`,c),` (y/n/a/q/l)`),onKeyDown:b})}function W(t,n){var r=t.state.vim,i=N.macroModeState,a=N.registerController.getRegister(`.`),o=i.isPlaying,s=i.lastInsertModeChanges;o||(t.off(`change`,nn),r.insertEnd&&r.insertEnd.clear(),r.insertEnd=void 0,e.off(t.getInputField(),`keydown`,on)),!o&&r.insertModeRepeat&&r.insertModeRepeat>1&&(sn(t,r,r.insertModeRepeat-1,!0),r.lastEditInputState.repeatOverride=r.insertModeRepeat),delete r.insertModeRepeat,r.insertMode=!1,n||t.setCursor(t.getCursor().line,t.getCursor().ch-1),t.setOption(`keyMap`,`vim`),t.setOption(`disableInput`,!0),t.toggleOverwrite(!1),a.setText(s.changes.join(``)),e.signal(t,`vim-mode-change`,{mode:`normal`}),i.isRecording&&en(i)}function Jt(e){r.unshift(e),e.keys&&Yt(e.keys)}function Yt(e){e.split(/(<(?:[CSMA]-)*\w+>|.)/i).forEach(function(e){e&&(i[e]||(i[e]=0),i[e]++)})}function Xt(e){e.split(/(<(?:[CSMA]-)*\w+>|.)/i).forEach(function(e){i[e]&&i[e]--})}function Zt(e,t,n,r,i){var a={keys:e,type:t};for(var o in a[t]=n,a[t+`Args`]=r,i)a[o]=i[o];Jt(a)}D(`insertModeEscKeysTimeout`,200,`number`);function Qt(e,t,n,r){var i=N.registerController.getRegister(r);if(r==`:`){i.keyBuffer[0]&&U.processCommand(e,i.keyBuffer[0]),n.isPlaying=!1;return}var a=i.keyBuffer,o=0;n.isPlaying=!0,n.replaySearchQueries=i.searchQueries.slice(0);for(var s=0;s|./gi;l=d.exec(c);)if(u=l[0],L.handleKey(e,u,`macro`),t.insertMode){var f=i.insertModeChanges[o++].changes;N.macroModeState.lastInsertModeChanges.changes=f,ln(e,f,1),W(e)}n.isPlaying=!1}function $t(e,t){if(!e.isPlaying){var n=e.latestRegister,r=N.registerController.getRegister(n);r&&r.pushText(t)}}function en(e){if(!e.isPlaying){var t=e.latestRegister,n=N.registerController.getRegister(t);n&&n.pushInsertModeChanges&&n.pushInsertModeChanges(e.lastInsertModeChanges)}}function tn(e,t){if(!e.isPlaying){var n=e.latestRegister,r=N.registerController.getRegister(n);r&&r.pushSearchQuery&&r.pushSearchQuery(t)}}function nn(e,t){var n=N.macroModeState,r=n.lastInsertModeChanges;if(!n.isPlaying)for(var i=e.state.vim;t;){if(r.expectCursorActivityForChange=!0,r.ignoreCount>1)r.ignoreCount--;else if(t.origin==`+input`||t.origin==`paste`||t.origin===void 0){var a=e.listSelections().length;a>1&&(r.ignoreCount=a);var o=t.text.join(` +`);if(r.maybeReset&&=(r.changes=[],!1),o)if(e.state.overwrite&&!/\n/.test(o))r.changes.push([o]);else{if(o.length>1){var s=i&&i.insertEnd&&i.insertEnd.find(),c=e.getCursor();if(s&&s.line==c.line){var l=s.ch-c.ch;l>0&&l`,Pe(i,r))}else n.insertMode||(n.lastHPos=t.getCursor().ch)}function on(t){var n=N.macroModeState.lastInsertModeChanges,r=e.keyName?e.keyName(t):t.key;r&&(r.indexOf(`Delete`)!=-1||r.indexOf(`Backspace`)!=-1)&&(n.maybeReset&&=(n.changes=[],!1),n.changes.push(new F(r,t)))}function sn(e,t,n,r){var i=N.macroModeState;i.isPlaying=!0;var a=t.lastEditActionCommand,o=t.inputState;function s(){a?z.processAction(e,t,a):z.evalInput(e,t)}function c(n){if(i.lastInsertModeChanges.changes.length>0){n=t.lastEditActionCommand?n:1;var r=i.lastInsertModeChanges;ln(e,r.changes,n)}}if(t.inputState=t.lastEditInputState,a&&a.interlaceInsertRepeat)for(var l=0;l`)return pe(i),!0}var c=i.isInMultiSelectMode();if(r.wasInVisualBlock&&!c?r.wasInVisualBlock=!1:c&&r.visualBlock&&(r.wasInVisualBlock=!0),t==``&&!r.insertMode&&!r.visualMode&&c&&r.status==``)pe(i);else if(o||!c||i.inVirtualSelectionMode)a=L.handleKey(i,t,n);else{var l=un(r),u=r.inputState.changeQueueList||[];i.operation(function(){i.curOp&&(i.curOp.isVimOp=!0);var e=0;i.forEachSelection(function(){i.state.vim.inputState.changeQueue=u[e];var r=i.getCursor(`head`),o=i.getCursor(`anchor`),s=Me(r,o)?0:-1,c=Me(r,o)?-1:0;r=Ee(r,0,s),o=Ee(o,0,c),i.state.vim.sel.head=r,i.state.vim.sel.anchor=o,a=L.handleKey(i,t,n),i.virtualSelection&&(u[e]=i.state.vim.inputState.changeQueue,i.state.vim=un(l)),e++}),i.curOp?.cursorActivity&&!a&&(i.curOp.cursorActivity=!1),i.state.vim=r,r.inputState.changeQueueList=u,r.inputState.changeQueue=null},!0)}return a&&!r.visualMode&&!r.insertMode&&r.visualMode!=i.somethingSelected()&&an(i,r),a}return P(),L}function fT(e,t){var n=t.ch,r=t.line+1;r<1&&(r=1,n=0),r>e.lines&&(r=e.lines,n=Number.MAX_VALUE);var i=e.line(r);return Math.min(i.from+Math.max(0,n),i.to)}function pT(e,t){let n=e.lineAt(t);return{line:n.number-1,ch:t-n.from}}var mT=class{constructor(e,t){this.line=e,this.ch=t}};function hT(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else{var r=e._handlers||={};r[t]=(r[t]||[]).concat(n)}}function gT(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else{var r=e._handlers,i=r&&r[t];if(i){var a=i.indexOf(n);a>-1&&(r[t]=i.slice(0,a).concat(i.slice(a+1)))}}}function _T(e,t,...n){var r=e._handlers?.[t];if(r)for(var i=0;iYf(e.cm6,{key:`Left`},`editor`),Right:e=>Yf(e.cm6,{key:`Right`},`editor`),Up:e=>Yf(e.cm6,{key:`Up`},`editor`),Down:e=>Yf(e.cm6,{key:`Down`},`editor`),Backspace:e=>Yf(e.cm6,{key:`Backspace`},`editor`),Delete:e=>Yf(e.cm6,{key:`Delete`},`editor`)},CT=class e{openDialog(e,t,n){return kT(this,e,t,n)}openNotification(e,t){return ET(this,e,t)}constructor(e){this.state={},this.marks=Object.create(null),this.$mid=0,this.options={},this._handlers={},this.$lastChangeEndOffset=0,this.virtualSelection=null,this.cm6=e,this.onChange=this.onChange.bind(this),this.onSelectionChange=this.onSelectionChange.bind(this)}on(e,t){hT(this,e,t)}off(e,t){gT(this,e,t)}signal(e,t,n){_T(this,e,t,n)}indexFromPos(e){return fT(this.cm6.state.doc,e)}posFromIndex(e){return pT(this.cm6.state.doc,e)}foldCode(e){let t=this.cm6,n=t.state.selection.ranges,r=this.cm6.state.doc,i=fT(r,e),a=q.create([q.range(i,i)],0).ranges;t.state.selection.ranges=a,sv(t),t.state.selection.ranges=n}firstLine(){return 0}lastLine(){return this.cm6.state.doc.lines-1}lineCount(){return this.cm6.state.doc.lines}setCursor(e,t){typeof e==`object`&&(t=e.ch,e=e.line);var n=fT(this.cm6.state.doc,{line:e,ch:t||0});this.cm6.dispatch({selection:{anchor:n}},{scrollIntoView:!this.curOp}),this.curOp&&!this.curOp.isVimOp&&this.onBeforeEndOperation()}getCursor(e){var t=this.cm6.state.selection.main,n=e==`head`||!e?t.head:e==`anchor`?t.anchor:e==`start`?t.from:e==`end`?t.to:null;if(n==null)throw Error(`Invalid cursor type`);return this.posFromIndex(n)}listSelections(){var e=this.cm6.state.doc;return this.cm6.state.selection.ranges.map(t=>({anchor:pT(e,t.anchor),head:pT(e,t.head)}))}setSelections(e,t){var n=this.cm6.state.doc,r=e.map(e=>{var t=fT(n,e.head),r=fT(n,e.anchor);return t==r?q.cursor(t,1):q.range(r,t)});this.cm6.dispatch({selection:q.create(r,t)})}setSelection(e,t,n){this.setSelections([{anchor:e,head:t}],0),n&&n.origin==`*mouse`&&this.onBeforeEndOperation()}getLine(e){var t=this.cm6.state.doc;return e<0||e>=t.lines?``:this.cm6.state.doc.line(e+1).text}getLineHandle(e){return this.$lineHandleChanges||=[],{row:e,index:this.indexFromPos(new mT(e,0))}}getLineNumber(e){var t=this.$lineHandleChanges;if(!t)return null;for(var n=e.index,r=0;r({from:t.from,to:t.to,insert:e[n]||``}));bT(this,{changes:t})}getSelection(){return this.getSelections().join(` +`)}getSelections(){var e=this.cm6;return e.state.selection.ranges.map(t=>e.state.sliceDoc(t.from,t.to))}somethingSelected(){return this.cm6.state.selection.ranges.some(e=>!e.empty)}getInputField(){return this.cm6.contentDOM}clipPos(e){var t=this.cm6.state.doc,n=e.ch,r=e.line+1;r<1&&(r=1,n=0),r>t.lines&&(r=t.lines,n=Number.MAX_VALUE);var i=t.line(r);return n=Math.min(Math.max(0,n),i.to-i.from),new mT(r-1,n)}getValue(){return this.cm6.state.doc.toString()}setValue(e){var t=this.cm6;return t.dispatch({changes:{from:0,to:t.state.doc.length,insert:e},selection:q.range(0,0)})}focus(){return this.cm6.focus()}blur(){return this.cm6.contentDOM.blur()}defaultTextHeight(){return this.cm6.defaultLineHeight}findMatchingBracket(e,t){var n=this.cm6.state,r=fT(n.doc,e),i=Ov(n,r+1,-1);return i&&i.end||(i=Ov(n,r,1),i&&i.end)?{to:pT(n.doc,i.end.from)}:{to:void 0}}scanForBracket(e,t,n,r){return MT(this,e,t,n,r)}indentLine(e,t){t?this.indentMore():this.indentLess()}indentMore(){fw(this.cm6)}indentLess(){pw(this.cm6)}execCommand(t){if(t==`indentAuto`)e.commands.indentAuto(this);else if(t==`goLineLeft`)XS(this.cm6);else if(t==`goLineRight`){YS(this.cm6);let e=this.cm6.state,t=e.selection.main.head;tt.length)return null;let r=c(t,e).next();return r.done?null:r.value}var u=1e4;function d(e,t){var r=n.cm6.state.doc;for(let n=1;;n++){let i=Math.max(e,t-n*u),a=c(r,i,t),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==e||o.from>i+10))return o;if(i==e)return null}}return{findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){var t=n.cm6.state.doc;return r=e?d(0,r?a?r.to-1:r.from:o):l(r?a?r.to+1:r.to:o),i=r&&{from:pT(t,r.from),to:pT(t,r.to),match:r.match},a=r?r.from==r.to:!1,r&&r.match},from:function(){return i?.from},to:function(){return i?.to},replace:function(e){r&&(bT(n,{changes:{from:r.from,to:r.to,insert:e}}),r.to=r.from+e.length,i&&(i.to=pT(n.cm6.state.doc,r.to)))},get match(){return i&&i.match}}}findPosV(e,t,n,r){let{cm6:i}=this,a=i.state.doc,o=n==`page`?i.dom.clientHeight:0,s=fT(a,e),c=q.cursor(s,1,void 0,r),l=Math.round(Math.abs(t));for(let e=0;e0,o):n==`line`&&(c=i.moveVertically(c,t>0));let u=pT(a,c.head);return(t<0&&c.head==0&&r!=0&&e.line==0&&e.ch!=0||t>0&&c.head==a.length&&u.ch!=r&&e.line==u.line)&&(u.hitSide=!0),u}charCoords(e,t){var n=this.cm6.contentDOM.getBoundingClientRect(),r=fT(this.cm6.state.doc,e),i=this.cm6.coordsAtPos(r),a=-n.top;return{left:(i?.left||0)-n.left,top:(i?.top||0)+a,bottom:(i?.bottom||0)+a}}coordsChar(e,t){var n=this.cm6.contentDOM.getBoundingClientRect(),r=this.cm6.posAtCoords({x:e.left+n.left,y:e.top+n.top})||0;return pT(this.cm6.state.doc,r)}getScrollInfo(){var e=this.cm6.scrollDOM;return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight,width:e.scrollWidth,clientHeight:e.clientHeight,clientWidth:e.clientWidth}}scrollTo(e,t){e!=null&&(this.cm6.scrollDOM.scrollLeft=e),t!=null&&(this.cm6.scrollDOM.scrollTop=t)}scrollIntoView(e,t){if(e){var n=this.indexFromPos(e);this.cm6.dispatch({effects:X.scrollIntoView(n)})}else this.cm6.dispatch({scrollIntoView:!0,userEvent:`scroll`})}getWrapperElement(){return this.cm6.dom}getMode(){return{name:this.getOption(`mode`)}}setSize(e,t){this.cm6.dom.style.width=e+4+`px`,this.cm6.dom.style.height=t+`px`,this.refresh()}refresh(){this.cm6.measure()}destroy(){this.removeOverlay()}getLastEditEnd(){return this.posFromIndex(this.$lastChangeEndOffset)}onChange(e){for(let t in this.$lineHandleChanges&&this.$lineHandleChanges.push(e),this.marks)this.marks[t].update(e.changes);this.virtualSelection&&(this.virtualSelection.ranges=this.virtualSelection.ranges.map(t=>t.map(e.changes)));var t=this.curOp=this.curOp||{};e.changes.iterChanges((e,n,r,i,a)=>{(t.$changeStart==null||t.$changeStart>r)&&(t.$changeStart=r),this.$lastChangeEndOffset=i;var o={text:a.toJSON()};t.lastChange?t.lastChange.next=t.lastChange=o:t.lastChange=t.change=o},!0),t.changeHandlers||=this._handlers.change&&this._handlers.change.slice()}onSelectionChange(){var e=this.curOp=this.curOp||{};e.cursorActivityHandlers||=this._handlers.cursorActivity&&this._handlers.cursorActivity.slice(),this.curOp.cursorActivity=!0}operation(e,t){this.curOp||={$d:0},this.curOp.$d++;try{var n=e()}finally{this.curOp&&(this.curOp.$d--,this.curOp.$d||this.onBeforeEndOperation())}return n}onBeforeEndOperation(){var e=this.curOp,t=!1;e&&(e.change&&vT(e.changeHandlers,this,e.change),e&&e.cursorActivity&&(vT(e.cursorActivityHandlers,this,null),e.isVimOp&&(t=!0)),this.curOp=null),t&&this.scrollIntoView()}moveH(e,t){if(t==`char`){var n=this.getCursor();this.setCursor(n.line,n.ch+e)}}setOption(e,t){switch(e){case`keyMap`:this.state.keyMap=t;break;case`textwidth`:this.state.textwidth=t;break}}getOption(e){switch(e){case`firstLineNumber`:return 1;case`tabSize`:return this.cm6.state.tabSize||4;case`readOnly`:return this.cm6.state.readOnly;case`indentWithTabs`:return this.cm6.state.facet(O_)==` `;case`indentUnit`:return this.cm6.state.facet(O_).length||2;case`textwidth`:return this.state.textwidth;case`keyMap`:return this.state.keyMap||`vim`}}toggleOverwrite(e){this.state.overwrite=e}getTokenTypeAt(e){var t=this.indexFromPos(e),n=(g_(this.cm6.state,t)?.resolve(t))?.type?.name||``;return/comment/i.test(n)?`comment`:/string/i.test(n)?`string`:``}overWriteSelection(e){var t=this.cm6.state.doc,n=this.cm6.state.selection,r=n.ranges.map(e=>{if(e.empty){var n=e.to1}virtualSelectionMode(){return!!this.virtualSelection}forEachSelection(e){var t=this.cm6.state.selection;this.virtualSelection=q.create(t.ranges,t.mainIndex);for(var n=0;nbT(e,t)})},indentAuto:function(e){dw(e.cm6)},newlineAndIndentContinueComment:void 0,save:void 0},CT.isWordChar=function(e){return yT.test(e)},CT.keys=ST,CT.addClass=function(e,t){},CT.rmClass=function(e,t){},CT.e_preventDefault=function(e){e.preventDefault()},CT.e_stop=function(e){var t,n;(t=e?.stopPropagation)==null||t.call(e),(n=e?.preventDefault)==null||n.call(e)},CT.lookupKey=function(e,t,n){var r=CT.keys[e];!r&&/^Arrow/.test(e)&&(r=CT.keys[e.slice(5)]),r&&n(r)},CT.on=hT,CT.off=gT,CT.signal=_T,CT.findMatchingTag=NT,CT.findEnclosingTag=PT,CT.keyName=void 0;function wT(e,t,n){var r=document.createElement(`div`);return r.appendChild(t),r}function TT(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}function ET(e,t,n){TT(e,s);var r=wT(e,t,n&&n.bottom),i=!1,a,o=n&&n.duration!==void 0?n.duration:5e3;function s(){i||(i=!0,clearTimeout(a),r.remove(),OT(e,r))}return r.onclick=function(e){e.preventDefault(),s()},DT(e,r),o&&(a=setTimeout(s,o)),s}function DT(e,t){var n=e.state.dialog;e.state.dialog=t,t.style.flex=`1`,t&&n!==t&&(n&&n.contains(document.activeElement)&&e.focus(),n&&n.parentElement?n.parentElement.replaceChild(t,n):n&&n.remove(),CT.signal(e,`dialog`))}function OT(e,t){e.state.dialog==t&&(e.state.dialog=null,CT.signal(e,`dialog`))}function kT(e,t,n,r){r||={},TT(e,void 0);var i=wT(e,t,r.bottom),a=!1;DT(e,i);function o(t){if(typeof t==`string`)s.value=t;else{if(a)return;a=!0,OT(e,i),e.state.dialog||e.focus(),r.onClose&&r.onClose(i)}}var s=i.getElementsByTagName(`input`)[0];return s&&(r.value&&(s.value=r.value,r.selectValueOnOpen!==!1&&s.select()),r.onInput&&CT.on(s,`input`,function(e){r.onInput(e,s.value,o)}),r.onKeyUp&&CT.on(s,`keyup`,function(e){r.onKeyUp(e,s.value,o)}),CT.on(s,`keydown`,function(e){r&&r.onKeyDown&&r.onKeyDown(e,s.value,o)||(e.keyCode==13&&n&&n(s.value),(e.keyCode==27||r.closeOnEnter!==!1&&e.keyCode==13)&&(s.blur(),CT.e_stop(e),o()))}),r.closeOnBlur!==!1&&CT.on(s,`blur`,function(){setTimeout(function(){document.activeElement!==s&&o()})}),s.focus()),o}var AT={"(":`)>`,")":`(<`,"[":`]>`,"]":`[<`,"{":`}>`,"}":`{<`,"<":`>>`,">":`<<`};function jT(e){return e&&e.bracketRegex||/[(){}[\]]/}function MT(e,t,n,r,i){for(var a=i&&i.maxScanLineLength||1e4,o=i&&i.maxScanLines||1e3,s=[],c=jT(i),l=n>0?Math.min(t.line+o,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-o),u=t.line;u!=l;u+=n){var d=e.getLine(u);if(d){var f=n>0?0:d.length-1,p=n>0?d.length:-1;if(!(d.length>a))for(u==t.line&&(f=t.ch-(n<0?1:0));f!=p;f+=n){var m=d.charAt(f);if(c.test(m)){var h=AT[m];if(h&&h.charAt(1)==`>`==n>0)s.push(m);else if(s.length)s.pop();else return{pos:new mT(u,f),ch:m}}}}}return u-n==(n>0?e.lastLine():e.firstLine())?!1:null}function NT(e,t){return null}function PT(e,t){var n=e.cm6.state,r=e.indexFromPos(t);rn){var s=p(o,n,5);if(s){var c=/^\s*/.exec(o)?.[0];e.replaceRange(` +`+c,new mT(i,s.start),new mT(i,s.end))}a++}else if(r&&/\S/.test(o)&&i!=a){var l=e.getLine(i+1);if(l&&/\S/.test(l)){var u=o.replace(/\s+$/,``),d=l.replace(/^\s+/,``),f=u+` `+d,s=p(f,n,5);s&&s.start>u.length||f.lengthn)return{start:o.index,end:o.index+o[2].length};if(a&&a[2])return s=t+a[2].length,{start:s,end:s+a[3].length}}}}var RT=np||function(){let e={cursorBlinkRate:1200};return function(){return e}}(),zT=class{constructor(e,t,n,r,i,a,o,s,c,l){this.left=e,this.top=t,this.height=n,this.fontFamily=r,this.fontSize=i,this.fontWeight=a,this.color=o,this.className=s,this.letter=c,this.partial=l}draw(){let e=document.createElement(`div`);return e.className=this.className,this.adjust(e),e}adjust(e){e.style.left=this.left+`px`,e.style.top=this.top+`px`,e.style.height=this.height+`px`,e.style.lineHeight=this.height+`px`,e.style.fontFamily=this.fontFamily,e.style.fontSize=this.fontSize,e.style.fontWeight=this.fontWeight,e.style.color=this.partial?`transparent`:this.color,e.className=this.className,e.textContent=this.letter}eq(e){return this.left==e.left&&this.top==e.top&&this.height==e.height&&this.fontFamily==e.fontFamily&&this.fontSize==e.fontSize&&this.fontWeight==e.fontWeight&&this.color==e.color&&this.className==e.className&&this.letter==e.letter}},BT=class{constructor(e,t){this.view=e,this.rangePieces=[],this.cursors=[],this.cm=t,this.measureReq={read:this.readPos.bind(this),write:this.drawSel.bind(this)},this.cursorLayer=e.scrollDOM.appendChild(document.createElement(`div`)),this.cursorLayer.className=`cm-cursorLayer cm-vimCursorLayer`,this.cursorLayer.setAttribute(`aria-hidden`,`true`),e.requestMeasure(this.measureReq),this.setBlinkRate()}setBlinkRate(){let e=RT(this.cm.cm6.state).cursorBlinkRate;this.cursorLayer.style.animationDuration=e+`ms`}update(e){(e.selectionSet||e.geometryChanged||e.viewportChanged)&&(this.view.requestMeasure(this.measureReq),this.cursorLayer.style.animationName=this.cursorLayer.style.animationName==`cm-blink`?`cm-blink2`:`cm-blink`),VT(e)&&this.setBlinkRate()}scheduleRedraw(){this.view.requestMeasure(this.measureReq)}readPos(){let{state:e}=this.view,t=[];for(let n of e.selection.ranges){let r=n==e.selection.main,i=WT(this.cm,this.view,n,r);i&&t.push(i)}return{cursors:t}}drawSel({cursors:e}){if(e.length!=this.cursors.length||e.some((e,t)=>!e.eq(this.cursors[t]))){let t=this.cursorLayer.children;if(t.length!==e.length){this.cursorLayer.textContent=``;for(let t of e)this.cursorLayer.appendChild(t.draw())}else e.forEach((e,n)=>e.adjust(t[n]));this.cursors=e}}destroy(){this.cursorLayer.remove()}};function VT(e){return RT(e.startState)!=RT(e.state)}var HT=Ao.highest(X.theme({".cm-vimMode .cm-line":{"& ::selection":{backgroundColor:`transparent !important`},"&::selection":{backgroundColor:`transparent !important`},caretColor:`transparent !important`},".cm-fat-cursor":{position:`absolute`,background:`#ff9696`,border:`none`,whiteSpace:`pre`},"&:not(.cm-focused) .cm-fat-cursor":{background:`none`,outline:`solid 1px #ff9696`,color:`transparent !important`}}));function UT(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==pl.LTR?t.left:t.right-e.scrollDOM.clientWidth)-e.scrollDOM.scrollLeft*e.scaleX,top:t.top-e.scrollDOM.scrollTop*e.scaleY}}function WT(e,t,n,r){var i;let a=n.head,o=!1,s=1,c=e.state.vim;if(c&&(!c.insertMode||e.state.overwrite)){if(o=!0,c.visualBlock&&!r)return null;n.anchor1&&(a--,e=t.state.sliceDoc(a,a+1));let n=t.coordsAtPos(a,1);if(!n)return null;let o=UT(t),c=t.domAtPos(a),u=c?c.node:t.contentDOM;for(u instanceof Text&&c.offset>=u.data.length&&u.parentElement?.nextSibling&&(u=u.parentElement?.nextSibling,c={node:u,offset:0});c&&c.node instanceof HTMLElement;)u=c.node,c={node:c.node.childNodes[c.offset],offset:0};if(!(u instanceof HTMLElement)){if(!u.parentNode)return null;u=u.parentNode}let d=getComputedStyle(u),f=n.left,p=(i=t).coordsForChar?.call(i,a);if(p&&(f=p.left),!e||e==` +`||e==`\r`)e=`\xA0`;else if(e==` `){e=`\xA0`;var l=t.coordsAtPos(a+1,-1);l&&(f=l.left-(l.left-n.left)/parseInt(d.tabSize))}else /[\uD800-\uDBFF]/.test(e)&&a{t.state.vim&&(t.state.vim.status=``),this.blockCursor.scheduleRedraw(),this.updateStatus()}),this.cm.on(`vim-mode-change`,e=>{t.state.vim&&(t.state.vim.mode=e.mode,e.subMode&&(t.state.vim.mode+=` block`),t.state.vim.status=``,this.blockCursor.scheduleRedraw(),this.updateClass(),this.updateStatus())}),this.cm.on(`dialog`,()=>{this.cm.state.statusbar?this.updateStatus():e.dispatch({effects:QT.of(!!this.cm.state.dialog)})}),this.dom=document.createElement(`span`),this.spacer=document.createElement(`span`),this.spacer.style.flex=`1`,this.statusButton=document.createElement(`span`),this.statusButton.onclick=e=>{KT.handleKey(this.cm,``,`user`),this.cm.focus()},this.statusButton.style.cssText=`cursor: pointer`}update(e){if((e.viewportChanged||e.docChanged)&&this.query&&this.highlight(this.query),e.docChanged&&this.cm.onChange(e),e.selectionSet&&this.cm.onSelectionChange(),e.viewportChanged,this.cm.curOp&&!this.cm.curOp.isVimOp&&this.cm.onBeforeEndOperation(),e.transactions){for(let t of e.transactions)for(let e of t.effects)if(e.is(zw))if(!e.value?.forVim)this.highlight(null);else{let t=e.value.create();this.highlight(t)}}this.blockCursor.update(e)}updateClass(){let e=this.cm.state;!e.vim||e.vim.insertMode&&!e.overwrite?this.view.scrollDOM.classList.remove(`cm-vimMode`):this.view.scrollDOM.classList.add(`cm-vimMode`)}updateStatus(){let e=this.cm.state.statusbar,t=this.cm.state.vim;if(!e||!t)return;let n=this.cm.state.dialog;if(n)n.parentElement!=e&&(e.textContent=``,e.appendChild(n));else{e.textContent=``;var r=(t.mode||`normal`).toUpperCase();t.insertModeReturn&&(r+=`(C-O)`),this.statusButton.textContent=`--${r}--`,e.appendChild(this.statusButton),e.appendChild(this.spacer)}this.dom.textContent=t.status,e.appendChild(this.dom)}destroy(){KT.leaveVimMode(this.cm),this.updateClass(),this.blockCursor.destroy(),delete this.view.cm}highlight(e){if(this.query=e,!e)return this.decorations=el.none;let{view:t}=this,n=new _s;for(let r=0,i=t.visibleRanges,a=i.length;ri[r+1].from-2*qT;)s=i[++r].to;e.highlight(t.state,o,s,(e,t)=>{n.add(e,t,ZT)})}return this.decorations=n.finish()}handleKey(e,t){let n=this.cm,r=n.state.vim;if(!r)return;let i=KT.vimKeyFromEvent(e,r);if(CT.signal(this.cm,`inputEvent`,{type:`handleKey`,key:i}),!i)return;if(i==``&&!r.insertMode&&!r.visualMode&&this.query){let e=r.searchState_;e&&(n.removeOverlay(e.getOverlay()),e.setOverlay(null))}if(i===``&&!CT.isMac&&n.somethingSelected())return this.waitForCopy=!0,!0;r.status=(r.status||``)+i;let a=KT.multiSelectHandleKey(n,i,`user`);return r=KT.maybeInitVimState_(n),!a&&r.insertMode&&n.state.overwrite&&(e.key&&e.key.length==1&&!/\n/.test(e.key)?(a=!0,n.overWriteSelection(e.key)):e.key==`Backspace`&&(a=!0,CT.commands.cursorCharLeft(n))),a&&(CT.signal(this.cm,`vim-keypress`,i),e.preventDefault(),e.stopPropagation(),this.blockCursor.scheduleRedraw()),this.updateStatus(),!!a}},{eventHandlers:{copy:function(e,t){this.waitForCopy&&(this.waitForCopy=!1,Promise.resolve().then(()=>{var e=this.cm,t=e.state.vim;t&&(t.insertMode?e.setSelection(e.getCursor(),e.getCursor()):e.operation(()=>{e.curOp&&(e.curOp.isVimOp=!0),KT.handleKey(e,``,`user`)}))}))},compositionstart:function(e,t){this.useNextTextInput=!0,CT.signal(this.cm,`inputEvent`,e)},compositionupdate:function(e,t){CT.signal(this.cm,`inputEvent`,e)},compositionend:function(e,t){CT.signal(this.cm,`inputEvent`,e)},keypress:function(e,t){CT.signal(this.cm,`inputEvent`,e),this.lastKeydown==`Dead`&&this.handleKey(e,t)},keydown:function(e,t){CT.signal(this.cm,`inputEvent`,e),this.lastKeydown=e.key,this.lastKeydown==`Unidentified`||this.lastKeydown==`Process`||this.lastKeydown==`Dead`?this.useNextTextInput=!0:(this.useNextTextInput=!1,this.handleKey(e,t))}},provide:()=>[X.inputHandler.of((e,t,n,r)=>{var i=rE(e);if(!i)return!1;var a=i.state?.vim,o=i.state.vimPlugin;if(a&&!a.insertMode&&!i.curOp?.isVimOp){if(r===`\0\0`)return!0;if(CT.signal(i,`inputEvent`,{type:`text`,text:r,from:t,to:n}),r.length==1&&o.useNextTextInput){if(a.expectLiteralNext&&e.composing)return o.compositionText=r,!1;if(o.compositionText){var s=o.compositionText;o.compositionText=``;var c=e.state.selection.main.head;if(s===e.state.sliceDoc(c-s.length,c)){var l=i.getCursor();i.replaceRange(``,i.posFromIndex(c-s.length),l)}}return o.handleKey({key:r,preventDefault:()=>{},stopPropagation:()=>{}}),XT(e),!0}}return!1})],decorations:e=>e.decorations});function XT(e){var t=e.scrollDOM.parentElement;if(t){if(GT){e.contentDOM.textContent=`\0\0`,e.contentDOM.dispatchEvent(new CustomEvent(`compositionend`));return}var n=e.scrollDOM.nextSibling,r=window.getSelection(),i=r&&{anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset};e.scrollDOM.remove(),t.insertBefore(e.scrollDOM,n);try{i&&r&&(r.setPosition(i.anchorNode,i.anchorOffset),i.focusNode&&r.extend(i.focusNode,i.focusOffset))}catch(e){console.error(e)}e.focus(),e.contentDOM.dispatchEvent(new CustomEvent(`compositionend`))}}var ZT=el.mark({class:`cm-searchMatch`}),QT=Jo.define(),$T=Do.define({create:()=>!1,update(e,t){for(let n of t.effects)n.is(QT)&&(e=n.value);return e},provide:e=>vp.from(e,e=>e?eE:null)});function eE(e){let t=document.createElement(`div`);t.className=`cm-vim-panel`;let n=e.cm;return n.state.dialog&&t.appendChild(n.state.dialog),{top:!1,dom:t}}function tE(e){let t=document.createElement(`div`);t.className=`cm-vim-panel`;let n=e.cm;return n.state.statusbar=t,n.state.vimPlugin.updateStatus(),{dom:t}}function nE(e={}){return[JT,YT,HT,e.status?vp.of(tE):$T]}function rE(e){return e.cm||null}var iE=np||function(){let e={cursorBlinkRate:1200};return function(){return e}}(),aE=class{constructor(e,t,n,r,i,a,o,s,c,l){this.left=e,this.top=t,this.height=n,this.fontFamily=r,this.fontSize=i,this.fontWeight=a,this.color=o,this.className=s,this.letter=c,this.partial=l}draw(){let e=document.createElement(`div`);return e.className=this.className,this.adjust(e),e}adjust(e){e.style.left=this.left+`px`,e.style.top=this.top+`px`,e.style.height=this.height+`px`,e.style.lineHeight=this.height+`px`,e.style.fontFamily=this.fontFamily,e.style.fontSize=this.fontSize,e.style.fontWeight=this.fontWeight,e.style.color=this.partial?`transparent`:this.color,e.className=this.className,e.textContent=this.letter}eq(e){return this.left==e.left&&this.top==e.top&&this.height==e.height&&this.fontFamily==e.fontFamily&&this.fontSize==e.fontSize&&this.fontWeight==e.fontWeight&&this.color==e.color&&this.className==e.className&&this.letter==e.letter}},oE=class{constructor(e,t){this.view=e,this.rangePieces=[],this.cursors=[],this.em=t,this.measureReq={read:this.readPos.bind(this),write:this.drawSel.bind(this)},this.cursorLayer=e.scrollDOM.appendChild(document.createElement(`div`)),this.cursorLayer.className=`cm-cursorLayer cm-vimCursorLayer`,this.cursorLayer.setAttribute(`aria-hidden`,`true`),e.requestMeasure(this.measureReq),this.setBlinkRate()}setBlinkRate(){let e=iE(this.view.state).cursorBlinkRate;this.cursorLayer.style.animationDuration=e+`ms`}update(e){(e.selectionSet||e.geometryChanged||e.viewportChanged)&&(this.view.requestMeasure(this.measureReq),this.cursorLayer.style.animationName=this.cursorLayer.style.animationName==`cm-blink`?`cm-blink2`:`cm-blink`),sE(e)&&this.setBlinkRate()}scheduleRedraw(){this.view.requestMeasure(this.measureReq)}readPos(){let{state:e}=this.view,t=[];for(let n of e.selection.ranges){let r=n==e.selection.main,i=uE(this.em,this.view,n,r);i&&t.push(i)}return{cursors:t}}drawSel({cursors:e}){if(e.length!=this.cursors.length||e.some((e,t)=>!e.eq(this.cursors[t]))){let t=this.cursorLayer.children;if(t.length!==e.length){this.cursorLayer.textContent=``;for(let t of e)this.cursorLayer.appendChild(t.draw())}else e.forEach((e,n)=>e.adjust(t[n]));this.cursors=e}}destroy(){this.cursorLayer.remove()}};function sE(e){return iE(e.startState)!=iE(e.state)}var cE=Ao.highest(X.theme({".cm-line":{"& ::selection":{backgroundColor:`transparent !important`},"&::selection":{backgroundColor:`transparent !important`},caretColor:`transparent !important`},".cm-fat-cursor":{position:`absolute`,background:`#ff9696`,border:`none`,whiteSpace:`pre`},"&:not(.cm-focused) .cm-fat-cursor":{background:`none`,outline:`solid 1px #ff9696`,color:`transparent !important`}}));function lE(e){let t=e.scrollDOM.getBoundingClientRect();return{left:(e.textDirection==pl.LTR?t.left:t.right-e.scrollDOM.clientWidth)-e.scrollDOM.scrollLeft,top:t.top-e.scrollDOM.scrollTop}}function uE(e,t,n,r){var i;let a=n.head,o=1;(e.$data.count||e.$data.keyChain)&&(o=.5);{let e=a1&&(a--,e=t.state.sliceDoc(a,a+1));let n=t.coordsAtPos(a,1);if(!n)return null;let c=lE(t),l=t.domAtPos(a),u=l?l.node:t.contentDOM;for(;l&&l.node instanceof HTMLElement;)u=l.node,l={node:l.node.childNodes[l.offset],offset:0};if(!(u instanceof HTMLElement)){if(!u.parentNode)return null;u=u.parentNode}let d=getComputedStyle(u),f=n.left,p=(i=t).coordsForChar?.call(i,a);if(p&&(f=p.left),!e||e==` +`||e==`\r`)e=`\xA0`;else if(e==` `){e=`\xA0`;var s=t.coordsAtPos(a+1,-1);s&&(f=s.left-(s.left-n.left)/parseInt(d.tabSize))}else /[\uD800-\uDBFF]/.test(e)&&a!1,update(e,t){for(let n of t.effects)n.is(pE)&&(e=n.value);return e},provide:e=>vp.from(e,e=>e?hE:null)});function hE(e){let t=document.createElement(`div`);return t.className=`cm-vim-panel`,{top:!1,dom:t}}function gE(e={}){return[dE,fE,cE,mE]}var _E={Return:`Return`,Escape:`Esc`,Insert:`Ins`,ArrowLeft:`Left`,ArrowRight:`Right`,ArrowUp:`Up`,ArrowDown:`Down`,Enter:`Return`,Divide:`/`,Slash:`/`,Multiply:`*`,Subtract:`-`,Minus:`-`,Equal:`=`},vE={Shift:1,Alt:1,Command:1,Control:1,CapsLock:1},yE={},bE=class e{constructor(e){this.view=e,this.$data={count:0,keyChain:``,lastCommand:``},this.$emacsMarkRing=[],this.$emacsMark=null}static bindKey(e,t){e.split(`|`).forEach(function(e){let n=``,r=e.split(/\s+/);r.forEach(function(e,i){let a=e.split(/-(?=.)/),o=a.pop();a.length&&(n+=a.sort().join(`-`)+`-`),n+=o,i===r.length-1?yE[n]=t:(yE[n]=`null`,n+=` `)})})}static getKey(e){var t=e.code,n=e.key;if(vE[n])return[``,``,``];t.length>1&&(t[0]==`N`&&(t=t.replace(/^Numpad/,``)),t[0]==`K`&&(t=t.replace(/^Key/,``))),t=_E[t]||t,t.length==1&&(t=t.toLowerCase());var r=``;return e.ctrlKey&&(r+=`C-`),e.metaKey&&(r+=`CMD-`),e.altKey&&(r+=`M-`),e.shiftKey&&(r+=`S-`),[t,r,n]}static addCommands(t){Object.keys(t).forEach(function(n){var r=t[n];typeof r==`function`&&(r={exec:r}),e.commands[n]=r})}static execCommand(e,t,n,r=1){var i=void 0;if(r<0&&(r=-r),typeof e==`function`)for(var a=0;a1&&e.handlesCount&&(n||={},typeof n==`object`&&(n.count=r),r=1);for(var a=0;athis.updateMark(t,e)).filter(Boolean)}updateMark(e,t){if(e){var n=e.map(function(e){return t.mapPos(e,1,co.TrackDel)}).filter(e=>e!=null);return n.length==0?null:n}}emacsMark(){return this.$emacsMark}setEmacsMark(e){this.$emacsMark=e}pushEmacsMark(e,t){var n=this.$emacsMark;n&&xE(this.$emacsMarkRing,n),!e||t?this.setEmacsMark(e):xE(this.$emacsMarkRing,e)}popEmacsMark(){var e=this.emacsMark();return e?(this.setEmacsMark(null),e):this.$emacsMarkRing.pop()}getLastEmacsMark(){return this.$emacsMark||this.$emacsMarkRing.slice(-1)[0]}getCopyText(){var e=this.view.state;return e.selection.ranges.map(t=>e.sliceDoc(t.from,t.to)).join(` +`)}clearSelection(){var e=this.view,t=e.state.selection;if(!t.ranges.some(e=>e.from!=e.to))return!1;var n=t.ranges.map(e=>q.range(e.head,e.head));return e.dispatch({selection:q.create(n,t.mainIndex)}),!0}onPaste(e){var t=this.view,n=t.state.selection,r;if(n.ranges.length>1){var i=e.split(` +`);i.length==n.ranges.length&&(r=i)}var a=0,o=t.state.changeByRange(t=>{var n=r?r[a]:e;return a++,{changes:{from:t.from,to:t.to,insert:n},range:q.cursor(t.from+n.length)}});t.dispatch(o)}selectionToEmacsMark(){return this.view.state.selection.ranges.map(e=>e.head)}};bE.commands={};function xE(e,t){e.length&&e[e.length-1]+``==t+``||e.push(t)}var SE={"Up|C-p":{command:`goOrSelect`,args:[HS,_C]},"Down|C-n":{command:`goOrSelect`,args:[US,vC]},"Left|C-b":{command:`goOrSelect`,args:[NS,cC]},"Right|C-f":{command:`goOrSelect`,args:[MS,sC]},"C-Left|M-b":{command:`goOrSelect`,args:[FS,uC]},"C-Right|M-f":{command:`goOrSelect`,args:[IS,dC]},"Home|C-a":{command:`goOrSelect`,args:[$S,EC]},"End|C-e":{command:`goOrSelect`,args:[eC,DC]},"C-Home|S-M-,":{command:`goOrSelect`,args:[OC,AC]},"C-End|S-M-.":{command:`goOrSelect`,args:[kC,jC]},"S-Up|S-C-p":_C,"S-Down|S-C-n":vC,"S-Left|S-C-b":cC,"S-Right|S-C-f":sC,"S-C-Left|S-M-b":pC,"S-C-Right|S-M-f":fC,"S-Home|S-C-a":EC,"S-End|S-C-e":DC,"S-C-Home":AC,"S-C-End":jC,"C-l":`recenterTopBottom`,"M-s":`centerSelection`,"M-g":`gotoline`,"C-x C-p|C-x h":MC,"PageDown|C-v|C-Down":{command:`goOrSelect`,args:[qS,xC]},"PageUp|M-v|C-Up":{command:`goOrSelect`,args:[KS,xC]},"S-C-Down":xC,"S-C-Up":bC,"C-s":nT,"C-r":nT,"M-C-s":`findnext`,"M-C-r":`findprevious`,"S-M-5":`replace`,Backspace:HC,"Delete|C-d":UC,"Return|C-m":{command:`insertstring`,args:` +`},"C-o":XC,"M-d|C-Delete":{command:`killWord`,args:`right`},"C-Backspace|M-Backspace|M-Delete":{command:`killWord`,args:`left`},"C-k":`killLine`,"M-h":`selectParagraph`,"M-@|M-S-2":`markWord`,"C-y|S-Delete":`yank`,"M-y":`yankRotate`,"C-g":`keyboardQuit`,"C-w|C-S-w":`killRegion`,"M-w":`killRingSave`,"C-Space":`setMark`,"C-x C-x":`exchangePointAndMark`,"C-t":ZC,"M-u":{command:`changeCase`,args:{dir:1}},"M-l":{command:`changeCase`,args:{dir:-1}},"C-x C-u":{command:`changeCase`,args:{dir:1,region:!0}},"C-x C-l":{command:`changeCase`,args:{dir:1,region:!0}},"M-/":Eb,"C-u":`universalArgument`,"M-;":Kx,"C-/|C-x u|S-C--|C-z":lS,"S-C-/|S-C-x u|C--|S-C-z":uS,"C-x r":`selectRectangularRegion`,"M-x":{command:`focusCommandLine`,args:`M-x `},Esc:`unsetTransientMark`};for(let e in SE)SE[e];function CE(e,t){return getComputedStyle(document.documentElement).getPropertyValue(e).trim()||t}function wE(){let e=CE(`--surface`,`#282c34`),t=CE(`--border`,`#333`),n=CE(`--accent`,`#4a9eff`),r=CE(`--text`,`#fff`),i=CE(`--text-dim`,`#666`),a=CE(`--cm-keyword`,`#c678dd`),o=CE(`--cm-variable`,`#e06c75`),s=CE(`--cm-function`,`#61afef`),c=CE(`--cm-string`,`#98c379`),l=CE(`--cm-comment`,`#7d8799`),u=CE(`--cm-number`,`#d19a66`),d=CE(`--cm-operator`,`#56b6c2`);return[X.theme({"&":{backgroundColor:e,color:`#abb2bf`,height:`100%`},".cm-scroller":{overflow:`auto`,fontFamily:`'Departure Mono', monospace`},".cm-content":{caretColor:n},".cm-cursor, .cm-dropCursor":{borderLeftColor:n},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:`#3E4451`},".cm-panels":{backgroundColor:e,color:`#abb2bf`},".cm-panels.cm-panels-top":{borderBottom:`1px solid ${t}`},".cm-panels.cm-panels-bottom":{borderTop:`1px solid ${t}`},".cm-searchMatch":{backgroundColor:`#72a1ff59`,outline:`1px solid ${t}`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`#6199ff2f`},".cm-activeLine":{backgroundColor:`#2c313c50`},".cm-selectionMatch":{backgroundColor:`#aafe661a`},"&.cm-focused .cm-matchingBracket, &.cm-focused .cm-nonmatchingBracket":{backgroundColor:`#bad0f847`},".cm-gutters":{backgroundColor:e,color:i,border:`none`},".cm-activeLineGutter":{backgroundColor:`#2c313c50`},".cm-foldPlaceholder":{backgroundColor:`transparent`,border:`none`,color:i},".cm-tooltip":{border:`none`,backgroundColor:e},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:`transparent`,borderBottomColor:`transparent`},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:e,borderBottomColor:e},".cm-tooltip-autocomplete":{"& > ul > li[aria-selected]":{backgroundColor:n,color:r}}},{dark:!0}),bv(gv.define([{tag:Q.keyword,color:a},{tag:[Q.name,Q.deleted,Q.character,Q.propertyName,Q.macroName],color:o},{tag:[Q.function(Q.variableName),Q.labelName],color:s},{tag:[Q.color,Q.constant(Q.name),Q.standard(Q.name)],color:u},{tag:[Q.definition(Q.name),Q.separator],color:`#abb2bf`},{tag:[Q.typeName,Q.className,Q.number,Q.changed,Q.annotation,Q.modifier,Q.self,Q.namespace],color:u},{tag:[Q.operator,Q.operatorKeyword,Q.url,Q.escape,Q.regexp,Q.link,Q.special(Q.string)],color:d},{tag:[Q.meta,Q.comment],color:l,fontStyle:`italic`},{tag:Q.strong,fontWeight:`bold`},{tag:Q.emphasis,fontStyle:`italic`},{tag:Q.strikethrough,textDecoration:`line-through`},{tag:Q.link,color:l,textDecoration:`underline`},{tag:Q.heading,fontWeight:`bold`,color:o},{tag:[Q.atom,Q.bool,Q.special(Q.variableName)],color:u},{tag:[Q.processingInstruction,Q.string,Q.inserted],color:c},{tag:Q.invalid,color:`#ff0000`},{tag:Q.tagName,color:o},{tag:Q.attributeName,color:u},{tag:Q.attributeValue,color:c},{tag:Q.propertyName,color:s}]))]}var TE=Dr(` `,1),EE=Dr(`
`,1),DE=Dr(`
`);function OE(e,t){Me(t,!0);let n=new Mo,r=new Mo,i=Di(t,`mode`,3,`item`),a=kt(It(i()===`item`?`html`:`shared`)),o=kt(`normal`),s=kt(null);function c(e){switch(e){case`vim`:return nE();case`emacs`:return gE();default:return[]}}function l(){let e=[`normal`,`vim`,`emacs`];H(o,e[(e.indexOf(G(o))+1)%e.length],!0)}let u=kt(void 0),d=kt(void 0),f=kt(void 0),p=kt(void 0),m=null,h=null,g=null,_=null;function v(e,i,a){let s=[r.of(c(G(o))),Kf.of(_w),n.of(wE()),i===`html`?Ux():ty(),X.updateListener.of(e=>{if(e.docChanged&&t.item){let n=e.state.doc.toString();i===`html`?K.updateItem(t.item.id,{html:n}):K.updateItem(t.item.id,{css:n})}})];return new X({state:ls.create({doc:a,extensions:s}),parent:e})}function y(e,t,i){let a=[r.of(c(G(o))),Kf.of(_w),n.of(wE()),ty(),X.updateListener.of(e=>{if(e.docChanged){let n=e.state.doc.toString();t===`shared`?K.updateSharedCss(n):K.updateAppCss(n)}})];return new X({state:ls.create({doc:i,extensions:a}),parent:e})}Oi(()=>{i()===`item`&&t.item&&(G(u)&&(m=v(G(u),`html`,t.item.html)),G(d)&&(h=v(G(d),`css`,t.item.css))),G(f)&&(g=y(G(f),`shared`,K.manifest.sharedCss)),G(p)&&(_=y(G(p),`app`,K.manifest.appCss))}),ki(()=>{m?.destroy(),h?.destroy(),g?.destroy(),_?.destroy()});let b=kt(It(K.manifest.appCss));on(()=>{let e=K.manifest.appCss;e!==G(b)&&(H(b,e,!0),setTimeout(()=>{let e=wE();m?.dispatch({effects:n.reconfigure(e)}),h?.dispatch({effects:n.reconfigure(e)}),g?.dispatch({effects:n.reconfigure(e)}),_?.dispatch({effects:n.reconfigure(e)})},50))}),on(()=>{let e=c(G(o));m?.dispatch({effects:r.reconfigure(e)}),h?.dispatch({effects:r.reconfigure(e)}),g?.dispatch({effects:r.reconfigure(e)}),_?.dispatch({effects:r.reconfigure(e)})}),on(()=>{i()===`item`&&t.item&&t.item.id!==G(s)&&(H(s,t.item.id,!0),m&&m.dispatch({changes:{from:0,to:m.state.doc.length,insert:t.item.html}}),h&&h.dispatch({changes:{from:0,to:h.state.doc.length,insert:t.item.css}}))});var x=DE(),S=U(x),C=U(S),w=U(C),T=e=>{var t=TE(),n=qt(t);n.__click=()=>H(a,`html`);let r;Pi(U(n),{size:12}),B(n);var i=W(n,2);i.__click=()=>H(a,`css`);let o;qi(U(i),{size:12}),B(i),pn(()=>{r=Qr(n,1,`svelte-1h8xysy`,null,r,{active:G(a)===`html`}),o=Qr(i,1,`svelte-1h8xysy`,null,o,{active:G(a)===`css`})}),jr(e,t)};Rr(w,e=>{i()===`item`&&e(T)});var E=W(w,2);E.__click=()=>H(a,`shared`);let D;Hi(U(E),{size:12}),B(E);var O=W(E,2);O.__click=()=>H(a,`app`);let k;zi(U(O),{size:12}),B(O),B(C);var A=W(C,2);A.__click=l;var j=U(A,!0);B(A);var M=W(A,2);M.__click=function(...e){t.onClose?.apply(this,e)},$i(U(M),{size:12}),B(M),B(S);var ee=W(S,2),N=U(ee),P=e=>{var t=EE(),n=qt(t);let r;vi(n,e=>H(u,e),()=>G(u));var i=W(n,2);let o;vi(i,e=>H(d,e),()=>G(d)),pn(()=>{r=Qr(n,1,`editor svelte-1h8xysy`,null,r,{hidden:G(a)!==`html`}),o=Qr(i,1,`editor svelte-1h8xysy`,null,o,{hidden:G(a)!==`css`})}),jr(e,t)};Rr(N,e=>{i()===`item`&&e(P)});var F=W(N,2);let I;vi(F,e=>H(f,e),()=>G(f));var L=W(F,2);let te;vi(L,e=>H(p,e),()=>G(p)),B(ee),B(x),pn(()=>{D=Qr(E,1,`svelte-1h8xysy`,null,D,{active:G(a)===`shared`}),k=Qr(O,1,`svelte-1h8xysy`,null,k,{active:G(a)===`app`}),di(A,`title`,`Editor mode: ${G(o)??``}`),Mr(j,G(o)),I=Qr(F,1,`editor svelte-1h8xysy`,null,I,{hidden:G(a)!==`shared`}),te=Qr(L,1,`editor svelte-1h8xysy`,null,te,{hidden:G(a)!==`app`})}),jr(e,x),Ne()}Sr([`click`]);var kE=Dr(`
`,1),AE=Dr(``),jE=Dr(`
`),ME=Dr(`
`);function NE(e,t){Me(t,!0);let n=yt(()=>K.editingId?K.getItem(K.editingId):null),r=yt(()=>G(n)||K.editingGlobal),i=kt(320),a=kt(!1),o=kt(!1);on(()=>{(K.editingId||K.editingGlobal)&&H(o,!1)});function s(e){e.preventDefault(),H(a,!0)}function c(e){if(!G(a))return;let t=window.innerWidth-e.clientX;H(i,Math.max(200,Math.min(800,t)),!0)}function l(){H(a,!1)}var u=ME();Hr(`1n46o8q`,e=>{var t=Ar();zr(qt(t),()=>``),jr(e,t)}),xr(`mousemove`,zt,c),xr(`mouseup`,zt,l);let d;var f=U(u),p=e=>{ja(e,{onHide:()=>{H(o,!0),K.setLocked(!0)}})};Rr(f,e=>{G(o)||e(p)});var m=W(f,2),h=U(m);xa(U(h),{}),B(h);var g=W(h,2),_=e=>{var t=kE(),r=qt(t);r.__mousedown=s;var a=W(r,2),o=U(a),c=e=>{OE(e,{mode:`item`,get item(){return G(n)},onClose:()=>K.edit(null)})},l=e=>{OE(e,{mode:`global`,onClose:()=>K.editGlobal(!1)})};Rr(o,e=>{G(n)?e(c):e(l,!1)}),B(a),pn(()=>ei(a,`width: ${G(i)??``}px`)),jr(e,t)};Rr(g,e=>{G(r)&&!G(o)&&e(_)}),B(m);var v=W(m,2),y=e=>{var t=jE(),n=U(t);n.__click=()=>{H(o,!1),K.setLocked(!1)},Ri(U(n),{size:14}),B(n),lt(W(n,2),16,()=>[`1`,`2`,`3`,`4`,`5`,`6`,`7`,`8`,`9`],e=>e,(e,t)=>{var n=AE();let r;n.__click=()=>K.hasFlag(t)?K.gotoFlag(t):K.setFlag(t),n.__contextmenu=e=>{e.preventDefault(),K.clearFlag(t)};var i=U(n,!0);B(n),pn(e=>{r=Qr(n,1,`flag svelte-1n46o8q`,null,r,e),di(n,`title`,`Position ${t??``}`),Mr(i,t)},[()=>({filled:K.hasFlag(t)})]),jr(e,n)}),B(t),jr(e,t)};Rr(v,e=>{G(o)&&e(y)}),B(u),pn(()=>d=Qr(u,1,`app svelte-1n46o8q`,null,d,{resizing:G(a)})),jr(e,u),Ne()}Sr([`mousedown`,`click`,`contextmenu`]),Nr(NE,{target:document.getElementById(`app`)}); \ No newline at end of file diff --git a/buboard-dist/assets/index-CVqZQDnN.css b/buboard-dist/assets/index-CVqZQDnN.css new file mode 100644 index 0000000..0a2c4c3 --- /dev/null +++ b/buboard-dist/assets/index-CVqZQDnN.css @@ -0,0 +1 @@ +@font-face{font-family:Departure Mono;src:url(/fonts/DepartureMono-Regular.woff2)format("woff2"),url(/fonts/DepartureMono-Regular.woff)format("woff");font-weight:400;font-style:normal;font-display:swap}*{box-sizing:border-box;margin:0;padding:0}:root{color:var(--text,#fff);background:var(--bg,#1a1a1a);font-family:Departure Mono,monospace}html,body,#app{width:100%;height:100%;overflow:hidden}.item.svelte-zefpzk{box-sizing:border-box;position:absolute}.item.selected.svelte-zefpzk{outline:2px solid var(--accent,#4a9eff)}.item.focused.svelte-zefpzk{outline:2px solid var(--accent,#4a9eff);outline-style:dashed}.content.svelte-zefpzk{background:0 0;border:none;width:100%;height:100%;display:block}.interaction-layer.svelte-zefpzk{position:absolute;inset:0}.handles.svelte-zefpzk{inset:calc(-6px*var(--handle-scale,1));pointer-events:none;position:absolute}.handle.svelte-zefpzk{width:calc(12px*var(--handle-scale,1));height:calc(12px*var(--handle-scale,1));background:var(--accent,#4a9eff);pointer-events:auto;position:absolute}.handle.nw.svelte-zefpzk{cursor:nw-resize;top:0;left:0}.handle.ne.svelte-zefpzk{cursor:ne-resize;top:0;right:0}.handle.sw.svelte-zefpzk{cursor:sw-resize;bottom:0;left:0}.handle.se.svelte-zefpzk{cursor:se-resize;bottom:0;right:0}.handle.rotate.svelte-zefpzk{top:calc(-30px*var(--handle-scale,1));cursor:grab;left:50%;transform:translate(-50%)}.handle.rotate.svelte-zefpzk:active{cursor:grabbing}.rotate-line.svelte-zefpzk{top:calc(-24px*var(--handle-scale,1));width:1px;height:calc(18px*var(--handle-scale,1));background:var(--accent,#4a9eff);pointer-events:none;position:absolute;left:50%;transform:translate(-50%)}.canvas.svelte-b9mh77{background:var(--bg,#1a1a1a);background-image:radial-gradient(circle,var(--border,#333)1px,transparent 1px);cursor:grab;background-size:20px 20px;width:100%;height:100%;position:relative;overflow:hidden}.canvas.svelte-b9mh77:active{cursor:grabbing}.viewport.svelte-b9mh77{transform-origin:0 0;position:absolute;top:0;left:0}.palette.svelte-pykroq{gap:4px;display:flex}button.svelte-pykroq{background:var(--surface,#282c34);color:var(--text-dim,#666);border:1px solid var(--border,#333);cursor:pointer;padding:4px 8px}button.svelte-pykroq:hover{background:var(--accent,#4a9eff);color:var(--text,#fff)}.toolbar.svelte-1dqac8y{background:var(--surface,#282c34);border-bottom:1px solid var(--border,#333);flex-shrink:0;gap:4px;padding:4px 8px;display:flex}.app-name.svelte-1dqac8y{color:var(--text-dim,#666);align-items:center;padding:0 8px 0 4px;font-size:12px;font-weight:700;display:flex}.spacer.svelte-1dqac8y{flex:1}.flags.svelte-1dqac8y{gap:2px;display:flex}.flag.svelte-1dqac8y{width:24px;height:24px;padding:0;font-size:11px;font-weight:700}.flag.filled.svelte-1dqac8y{background:var(--accent,#4a9eff);color:var(--text,#fff)}button.svelte-1dqac8y{background:var(--surface,#282c34);color:var(--text-dim,#666);border:1px solid var(--border,#333);cursor:pointer;padding:4px 8px}button.svelte-1dqac8y:hover,button.active.svelte-1dqac8y{background:var(--accent,#4a9eff);color:var(--text,#fff)}button.svelte-1dqac8y:disabled{opacity:.4;cursor:not-allowed}button.svelte-1dqac8y:disabled:hover{background:var(--surface,#282c34);color:var(--text-dim,#666)}.zoom.svelte-1dqac8y{align-items:center;gap:4px;display:flex}.zoom.svelte-1dqac8y input[type=range]:where(.svelte-1dqac8y){appearance:none;background:var(--border,#333);cursor:pointer;border:none;width:80px;height:4px}.zoom.svelte-1dqac8y input[type=range]:where(.svelte-1dqac8y)::-webkit-slider-thumb{appearance:none;background:var(--text-dim,#666);cursor:pointer;width:12px;height:12px}.zoom.svelte-1dqac8y input[type=range]:where(.svelte-1dqac8y)::-moz-range-thumb{background:var(--text-dim,#666);cursor:pointer;border:none;width:12px;height:12px}.zoom.svelte-1dqac8y input[type=range]:where(.svelte-1dqac8y):hover::-webkit-slider-thumb{background:var(--accent,#4a9eff)}.zoom.svelte-1dqac8y input[type=range]:where(.svelte-1dqac8y):hover::-moz-range-thumb{background:var(--accent,#4a9eff)}.coords.svelte-1dqac8y{color:var(--text-dim,#666);font-variant-numeric:tabular-nums;align-items:center;padding:0 8px;font-size:11px;display:flex}.zoom-reset.svelte-1dqac8y{align-items:center;gap:4px;min-width:52px;padding:2px 6px;font-size:11px;display:flex}.panel.svelte-1h8xysy{background:var(--surface,#282c34);border-left:1px solid var(--border,#333);flex-direction:column;width:100%;height:100%;display:flex}.header.svelte-1h8xysy{background:var(--surface,#282c34);border-bottom:1px solid var(--border,#333);flex-shrink:0;display:flex}.tabs.svelte-1h8xysy{flex:1;display:flex}.tabs.svelte-1h8xysy button:where(.svelte-1h8xysy){color:var(--text-dim,#666);cursor:pointer;background:0 0;border:none;padding:6px 10px}.tabs.svelte-1h8xysy button:where(.svelte-1h8xysy):hover{color:var(--text,#fff)}.tabs.svelte-1h8xysy button.active:where(.svelte-1h8xysy){color:var(--accent,#4a9eff)}.mode.svelte-1h8xysy{color:var(--text-dim,#666);cursor:pointer;text-transform:uppercase;background:0 0;border:none;padding:6px 8px;font-size:10px}.mode.svelte-1h8xysy:hover{color:var(--text,#fff)}.close.svelte-1h8xysy{color:var(--text-dim,#666);cursor:pointer;background:0 0;border:none;padding:6px 8px}.close.svelte-1h8xysy:hover{color:var(--text,#fff)}.editor-container.svelte-1h8xysy{flex:1;position:relative;overflow:hidden}.editor.svelte-1h8xysy{position:absolute;inset:0}.editor.hidden.svelte-1h8xysy{display:none}.app.svelte-1n46o8q{flex-direction:column;width:100vw;height:100vh;display:flex;overflow:hidden}.app.resizing.svelte-1n46o8q{cursor:ew-resize;-webkit-user-select:none;user-select:none}.workspace.svelte-1n46o8q{flex:1;display:flex;overflow:hidden}.canvas-container.svelte-1n46o8q{flex:1;overflow:hidden}.resize-handle.svelte-1n46o8q{background:var(--border,#333);cursor:ew-resize;flex-shrink:0;width:4px}.resize-handle.svelte-1n46o8q:hover{background:var(--accent,#4a9eff)}.editor-panel.svelte-1n46o8q{flex-shrink:0}.presentation-controls.svelte-1n46o8q{flex-direction:column;gap:2px;display:flex;position:fixed;top:8px;right:8px}.presentation-controls.svelte-1n46o8q button:where(.svelte-1n46o8q){background:var(--surface,#282c34);color:var(--text-dim,#666);border:1px solid var(--border,#333);cursor:pointer;justify-content:center;align-items:center;padding:6px;display:flex}.presentation-controls.svelte-1n46o8q button:where(.svelte-1n46o8q):hover{background:var(--accent,#4a9eff);color:var(--text,#fff)}.presentation-controls.svelte-1n46o8q .flag:where(.svelte-1n46o8q){width:26px;height:24px;padding:0;font-size:11px;font-weight:700}.presentation-controls.svelte-1n46o8q .flag.filled:where(.svelte-1n46o8q){background:var(--accent,#4a9eff);color:var(--text,#fff)} diff --git a/buboard-dist/fonts/DepartureMono-Regular.woff b/buboard-dist/fonts/DepartureMono-Regular.woff new file mode 100644 index 0000000..b7bb672 Binary files /dev/null and b/buboard-dist/fonts/DepartureMono-Regular.woff differ diff --git a/buboard-dist/fonts/DepartureMono-Regular.woff2 b/buboard-dist/fonts/DepartureMono-Regular.woff2 new file mode 100644 index 0000000..b4a23dc Binary files /dev/null and b/buboard-dist/fonts/DepartureMono-Regular.woff2 differ diff --git a/buboard-dist/index.html b/buboard-dist/index.html new file mode 100644 index 0000000..75f6f76 --- /dev/null +++ b/buboard-dist/index.html @@ -0,0 +1,14 @@ + + + + + + + buboard + + + + +
+ + diff --git a/src/App.svelte b/src/App.svelte index 10fa61b..075260b 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -56,7 +56,7 @@ {#if editingItem} appState.edit(null)} /> {:else} - appState.editGlobal(false)} /> + appState.setEditingGlobal(false)} /> {/if} {/if} diff --git a/src/lib/Canvas.svelte b/src/lib/Canvas.svelte index 580d6a1..6d15e5c 100644 --- a/src/lib/Canvas.svelte +++ b/src/lib/Canvas.svelte @@ -1,12 +1,12 @@ @@ -210,10 +211,10 @@ >
- {#each state.manifest.items as item (item.id)} + {#each boardState.manifest.items as item (item.id)} {/each}
diff --git a/src/lib/Editor.svelte b/src/lib/Editor.svelte index 9134817..3df4401 100644 --- a/src/lib/Editor.svelte +++ b/src/lib/Editor.svelte @@ -1,6 +1,6 @@