@engenty/wizards-runtime 0.12.1 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/runtime/dist/agents/studio-assistant.js +17 -1
- package/apps/runtime/dist/app.js +4 -2
- package/apps/runtime/dist/db/live-triggers.js +13 -3
- package/apps/runtime/dist/db/migrations/tenant/0027_space_skill.sql +48 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/0027_snapshot.json +4120 -0
- package/apps/runtime/dist/db/migrations/tenant/meta/_journal.json +7 -0
- package/apps/runtime/dist/db/schema.js +31 -0
- package/apps/runtime/dist/docs/dev/skills.md +116 -0
- package/apps/runtime/dist/docs/user-guide/skills.md +85 -0
- package/apps/runtime/dist/engine/steps.js +10 -1
- package/apps/runtime/dist/harness/model.js +4 -0
- package/apps/runtime/dist/live/views.js +2 -0
- package/apps/runtime/dist/models.js +4 -0
- package/apps/runtime/dist/prompts/goose.md +7 -0
- package/apps/runtime/dist/prompts/step.md +19 -1
- package/apps/runtime/dist/prompts/tools.md +33 -0
- package/apps/runtime/dist/routes/skills.js +84 -0
- package/apps/runtime/dist/services/skills-registry.js +209 -0
- package/apps/runtime/dist/services/skills.js +478 -0
- package/apps/runtime/dist/sync/records.js +81 -1
- package/apps/runtime/dist/texts.js +39 -0
- package/apps/runtime/dist/tools/index.js +4 -2
- package/apps/runtime/dist/tools/net-guard.js +8 -4
- package/apps/runtime/dist/tools/skills.js +197 -0
- package/apps/web/dist/assets/{AboutDialog-uGYGy2R2.js → AboutDialog-CLgnoYTI.js} +1 -1
- package/apps/web/dist/assets/{ChangelogDialog-BWaEdlt3.js → ChangelogDialog-CKLgFL6r.js} +1 -1
- package/apps/web/dist/assets/CodeEditor-B3nto_26.js +2 -0
- package/apps/web/dist/assets/EditorPage-D9JDdAAI.js +3 -0
- package/apps/web/dist/assets/{FlowPreview-DXpzFBRj.js → FlowPreview-zJCtixSi.js} +1 -1
- package/apps/web/dist/assets/Marketplace-D4e0Oac9.js +2 -0
- package/apps/web/dist/assets/{NewWizardChannels-B5wuTm7J.js → NewWizardChannels-B4N7GIYh.js} +1 -1
- package/apps/web/dist/assets/{NewWizardPage-Ci1ZsTJk.js → NewWizardPage-Dpt0Mzk8.js} +1 -1
- package/apps/web/dist/assets/{OnboardingPage-QkdluEZk.js → OnboardingPage-CDoYVjRC.js} +1 -1
- package/apps/web/dist/assets/PreviewPane-DPB5nEd5.js +10 -0
- package/apps/web/dist/assets/ProjectPage-408YOoNa.js +10 -0
- package/apps/web/dist/assets/{PublicRunner-Bt8gMxit.js → PublicRunner-BZ66xdRX.js} +1 -1
- package/apps/web/dist/assets/{ReadOnly-Cap_e5ke.js → ReadOnly-C9oGMkUB.js} +1 -1
- package/apps/web/dist/assets/{SettingsPage-C2rmXm_Q.js → SettingsPage-Dq3AZwJS.js} +2 -2
- package/apps/web/dist/assets/{SetupPage-CbqGgFPZ.js → SetupPage-CP3lbyZc.js} +1 -1
- package/apps/web/dist/assets/{SharePage-DEeVGatD.js → SharePage-DdMm1Y8K.js} +1 -1
- package/apps/web/dist/assets/SkillEditor-b5NMFB90.js +1 -0
- package/apps/web/dist/assets/changelog-82-DHogQ.js +1 -0
- package/apps/web/dist/assets/code-xml-Hx7YxCg0.js +1 -0
- package/apps/web/dist/assets/{dist-BwhPmMDu.js → dist-BdDd1FxP.js} +1 -1
- package/apps/web/dist/assets/dist-EBVTpvRr.js +10 -0
- package/apps/web/dist/assets/dist-GlRRx9Xl.js +1 -0
- package/apps/web/dist/assets/dist-H1UN89OA.js +1 -0
- package/apps/web/dist/assets/eye-BkMFLnYu.js +1 -0
- package/apps/web/dist/assets/i18n-CKKh3Pn0.js +55 -0
- package/apps/web/dist/assets/index-Cy2NHzAx.js +49 -0
- package/apps/web/dist/assets/index-wR_-1hfN.css +1 -0
- package/apps/web/dist/assets/json-CEsfHdlZ.js +1 -0
- package/apps/web/dist/assets/{lock-D-CjMpqn.js → lock-CGXM95Mi.js} +1 -1
- package/apps/web/dist/assets/markdown-5-I9_izp.js +29 -0
- package/apps/web/dist/assets/{oss-credits-CUpVhKSr.js → oss-credits-DpRWUPjD.js} +1 -1
- package/apps/web/dist/assets/{phone-CXSrxw3H.js → phone-DMfwuh9V.js} +1 -1
- package/apps/web/dist/assets/{runners-D71NjXtA.js → runners-D5qz6b_s.js} +1 -1
- package/apps/web/dist/assets/{session-B2LtqeDq.js → session-DRy0k0nh.js} +1 -1
- package/apps/web/dist/assets/{theme-Dab079EV.js → theme-DNPm6r4e.js} +2 -2
- package/apps/web/dist/assets/{ui-DQX_CQ7c.js → ui-CwFQAfE-.js} +2 -2
- package/apps/web/dist/assets/{upload-hLkuT3Q6.js → upload-DQJwLSGj.js} +1 -1
- package/apps/web/dist/assets/{useMutation-C3XBoSVf.js → useMutation-C20c2EH3.js} +1 -1
- package/apps/web/dist/assets/{volume-2-DIxdTlaA.js → volume-2-CC5qamYT.js} +1 -1
- package/apps/web/dist/index.html +9 -8
- package/apps/web/dist/mcp/flow.html +66 -66
- package/node_modules/@engenty/wizards/dist/plugin/studio.d.ts +3 -2
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.d.ts +6 -0
- package/node_modules/@engenty/wizards-shared/dist/feature-flags.js +6 -0
- package/node_modules/@engenty/wizards-shared/dist/live.d.ts +1 -1
- package/node_modules/@engenty/wizards-shared/dist/run.d.ts +1 -0
- package/node_modules/@engenty/wizards-shared/dist/run.js +2 -0
- package/node_modules/@engenty/wizards-shared/dist/skills.d.ts +165 -0
- package/node_modules/@engenty/wizards-shared/dist/skills.js +346 -0
- package/node_modules/@engenty/wizards-shared/dist/sync.d.ts +4 -2
- package/node_modules/@engenty/wizards-shared/dist/sync.js +2 -1
- package/package.json +7 -7
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/plugin.json +1 -1
- package/apps/web/dist/assets/CodeEditor-B5hV1IvK.js +0 -2
- package/apps/web/dist/assets/EditorPage-j9BOx5-V.js +0 -3
- package/apps/web/dist/assets/Marketplace-DSo6uZF6.js +0 -2
- package/apps/web/dist/assets/PreviewPane-swAH89un.js +0 -10
- package/apps/web/dist/assets/ProjectPage-Djv5EOYU.js +0 -1
- package/apps/web/dist/assets/changelog-DAY6ZEyy.js +0 -1
- package/apps/web/dist/assets/dist-DVpDdhG9.js +0 -1
- package/apps/web/dist/assets/dist-DzdNG7Sf.js +0 -10
- package/apps/web/dist/assets/i18n-B3J2ypKu.js +0 -55
- package/apps/web/dist/assets/index-Dxwbli0m.css +0 -1
- package/apps/web/dist/assets/index-WY5lJ_-h.js +0 -49
- package/apps/web/dist/assets/json-D2GVvTXK.js +0 -1
- package/apps/web/dist/assets/markdown-DwdMW7q0.js +0 -29
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as e,B as t,D as n,F as r,H as i,I as a,L as o,M as s,N as c,O as l,P as u,R as d,S as f,T as p,V as m,W as h,a as g,j as _,k as v,m as y,n as b,o as x,p as S,r as C,t as w,u as ee,x as te,y as ne,z as T}from"./dist-EBVTpvRr.js";var E=1024,re=0,D=class{constructor(e,t){this.from=e,this.to=t}},O=class{constructor(e={}){this.id=re++,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=A.match(e)),t=>{let n=e(t);return n===void 0?null:[this,n]}}};O.closedBy=new O({deserialize:e=>e.split(` `)}),O.openedBy=new O({deserialize:e=>e.split(` `)}),O.group=new O({deserialize:e=>e.split(` `)}),O.isolate=new O({deserialize:e=>{if(e&&e!=`rtl`&&e!=`ltr`&&e!=`auto`)throw RangeError(`Invalid value for isolate: `+e);return e||`auto`}}),O.contextHash=new O({perNode:!0}),O.lookAhead=new O({perNode:!0}),O.mounted=new O({perNode:!0});var k=class{constructor(e,t,n,r=!1){this.tree=e,this.overlay=t,this.parser=n,this.bracketed=r}static get(e){return e&&e.props&&e.props[O.mounted.id]}},ie=Object.create(null),A=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):ie,r=+!!t.top|(t.skipped?2:0)|(t.error?4:0)|(t.name==null?8:0),i=new e(t.name||``,n,t.id,r);if(t.props){for(let e of t.props)if(Array.isArray(e)||(e=e(i)),e){if(e[0].perNode)throw RangeError(`Can't store a per-node prop on a node type`);n[e[0].id]=e[1]}}return i}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e==`string`){if(this.name==e)return!0;let t=this.prop(O.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(O.group),r=-1;r<(n?n.length:0);r++){let i=t[r<0?e.name:n[r]];if(i)return i}}}};A.none=new A(``,Object.create(null),0,8);var ae=class e{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw RangeError(`Node type ids should correspond to array positions when creating a node set`)}extend(...t){let n=[];for(let e of this.types){let r=null;for(let n of t){let t=n(e);if(t){r||=Object.assign({},e.props);let n=t[1],i=t[0];i.combine&&i.id in r&&(n=i.combine(r[i.id],n)),r[i.id]=n}}n.push(r?new A(e.name,r,e.id,e.flags):e)}return new e(n)}},oe=new WeakMap,se=new WeakMap,j;(function(e){e[e.ExcludeBuffers=1]=`ExcludeBuffers`,e[e.IncludeAnonymous=2]=`IncludeAnonymous`,e[e.IgnoreMounts=4]=`IgnoreMounts`,e[e.IgnoreOverlays=8]=`IgnoreOverlays`,e[e.EnterBracketed=16]=`EnterBracketed`})(j||={});var M=class e{constructor(e,t,n,r,i){if(this.type=e,this.children=t,this.positions=n,this.length=r,this.props=null,i&&i.length){this.props=Object.create(null);for(let[e,t]of i)this.props[typeof e==`number`?e:e.id]=t}}toString(){let e=k.get(this);if(e&&!e.overlay)return e.tree.toString();let t=``;for(let e of this.children){let n=e.toString();n&&(t&&(t+=`,`),t+=n)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?`(`+t+`)`:``):t}cursor(e=0){return new ye(this.topNode,e)}cursorAt(e,t=0,n=0){let r=new ye(oe.get(this)||this.topNode);return r.moveTo(e,t),oe.set(this,r._tree),r}get topNode(){return new P(this,0,0,null)}resolve(e,t=0){let n=ue(oe.get(this)||this.topNode,e,t,!1);return oe.set(this,n),n}resolveInner(e,t=0){let n=ue(se.get(this)||this.topNode,e,t,!0);return se.set(this,n),n}resolveStack(e,t=0){return ve(this,e,t)}iterate(e){let{enter:t,leave:n,from:r=0,to:i=this.length}=e,a=e.mode||0,o=(a&j.IncludeAnonymous)>0;for(let e=this.cursor(a|j.IncludeAnonymous);;){let a=!1;if(e.from<=i&&e.to>=r&&(!o&&e.type.isAnonymous||t(e)!==!1)){if(e.firstChild())continue;a=!0}for(;a&&n&&(o||!e.type.isAnonymous)&&n(e),!e.nextSibling();){if(!e.parent())return;a=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(t={}){return this.children.length<=8?this:we(A.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(A.none,t,n,r)))}static build(e){return xe(e)}};M.empty=new M(A.none,[],[],0);var ce=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)}},N=class e{constructor(e,t,n){this.buffer=e,this.length=t,this.set=n}get type(){return A.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(`,`)}childString(e){let t=this.buffer[e],n=this.buffer[e+3],r=this.set.types[t],i=r.name;if(/\W/.test(i)&&!r.isError&&(i=JSON.stringify(i)),e+=4,n==e)return i;let a=[];for(;e<n;)a.push(this.childString(e)),e=this.buffer[e+3];return i+`(`+a.join(`,`)+`)`}findChild(e,t,n,r,i){let{buffer:a}=this,o=-1;for(let s=e;s!=t&&!(le(i,r,a[s+1],a[s+2])&&(o=s,n>0));s=a[s+3]);return o}slice(t,n,r){let i=this.buffer,a=new Uint16Array(n-t),o=0;for(let e=t,s=0;e<n;){a[s++]=i[e++],a[s++]=i[e++]-r;let n=a[s++]=i[e++]-r;a[s++]=i[e++]-t,o=Math.max(o,n)}return new e(a,o,this.set)}};function le(e,t,n,r){switch(e){case-2:return n<t;case-1:return r>=t&&n<t;case 0:return n<t&&r>t;case 1:return n<=t&&r>t;case 2:return r>t;case 4:return!0}}function ue(e,t,n,r){for(;e.from==e.to||(n<1?e.from>=t:e.from>t)||(n>-1?e.to<=t:e.to<t);){let t=!r&&e instanceof P&&e.index<0?null:e.parent;if(!t)return e;e=t}let i=r?0:j.IgnoreOverlays;if(r)for(let r=e,a=r.parent;a;r=a,a=r.parent)r instanceof P&&r.index<0&&a.enter(t,n,i)?.from!=r.from&&(e=a);for(;;){let r=e.enter(t,n,i);if(!r)return e;e=r}}var de=class{cursor(e=0){return new ye(this,e)}getChild(e,t=null,n=null){let r=fe(this,e,t,n);return r.length?r[0]:null}getChildren(e,t=null,n=null){return fe(this,e,t,n)}resolve(e,t=0){return ue(this,e,t,!1)}resolveInner(e,t=0){return ue(this,e,t,!0)}matchContext(e){return pe(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),n=this;for(;t;){let e=t.lastChild;if(!e||e.to!=t.to)break;e.type.isError&&e.from==e.to?(n=t,t=e.prevSibling):t=e}return n}get node(){return this}get next(){return this.parent}},P=class e extends de{constructor(e,t,n,r){super(),this._tree=e,this.from=t,this.index=n,this._parent=r}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(t,n,r,i,a=0){for(let o=this;;){for(let{children:s,positions:c}=o._tree,l=n>0?s.length:-1;t!=l;t+=n){let l=s[t],u=c[t]+o.from,d;if(a&j.EnterBracketed&&l instanceof M&&(d=k.get(l))&&!d.overlay&&d.bracketed&&r>=u&&r<=u+l.length||le(i,r,u,u+l.length)){if(l instanceof N){if(a&j.ExcludeBuffers)continue;let e=l.findChild(0,l.buffer.length,n,r-u,i);if(e>-1)return new he(new me(o,l,t,u),null,e)}else if(a&j.IncludeAnonymous||!l.type.isAnonymous||be(l)){let s;if(!(a&j.IgnoreMounts)&&(s=k.get(l))&&!s.overlay)return new e(s.tree,u,t,o);let c=new e(l,u,t,o);return a&j.IncludeAnonymous||!c.type.isAnonymous?c:c.nextChild(n<0?l.children.length-1:0,n,r,i,a)}}}if(a&j.IncludeAnonymous||!o.type.isAnonymous||(t=o.index>=0?o.index+n:n<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(t,n,r=0){let i;if(!(r&j.IgnoreOverlays)&&(i=k.get(this._tree))&&i.overlay){let a=t-this.from,o=r&j.EnterBracketed&&i.bracketed;for(let{from:t,to:r}of i.overlay)if((n>0||o?t<=a:t<a)&&(n<0||o?r>=a:r>a))return new e(i.tree,i.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,t,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}};function fe(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 pe(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 me=class{constructor(e,t,n,r){this.parent=e,this.buffer=t,this.index=n,this.start=r}},he=class e extends de{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,n){super(),this.context=e,this._parent=t,this.index=n,this.type=e.buffer.set.types[e.buffer.buffer[n]]}child(t,n,r){let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],t,n-this.context.start,r);return a<0?null:new e(this.context,this,a)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(t,n,r=0){if(r&j.ExcludeBuffers)return null;let{buffer:i}=this.context,a=i.findChild(this.index+4,i.buffer[this.index+3],n>0?1:-1,t-this.context.start,n);return a<0?null:new e(this.context,this,a)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:t}=this.context,n=t.buffer[this.index+3];return n<(this._parent?t.buffer[this._parent.index+3]:t.buffer.length)?new e(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:t}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new e(this.context,this._parent,t.findChild(n,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:n}=this.context,r=this.index+4,i=n.buffer[this.index+3];if(i>r){let a=n.buffer[this.index+1];e.push(n.slice(r,i,a)),t.push(0)}return new M(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}};function ge(e){if(!e.length)return null;let t=0,n=e[0];for(let r=1;r<e.length;r++){let i=e[r];(i.from>n.from||i.to<n.to)&&(n=i,t=r)}let r=n instanceof P&&n.index<0?null:n.parent,i=e.slice();return r?i[t]=r:i.splice(t,1),new _e(i,n)}var _e=class{constructor(e,t){this.heads=e,this.node=t}get next(){return ge(this.heads)}};function ve(e,t,n){let r=e.resolveInner(t,n),i=null;for(let e=r instanceof P?r:r.context.parent;e;e=e.parent)if(e.index<0){let a=e.parent;(i||=[r]).push(a.resolve(t,n)),e=a}else{let a=k.get(e.tree);if(a&&a.overlay&&a.overlay[0].from<=t&&a.overlay[a.overlay.length-1].to>=t){let o=new P(a.tree,a.overlay[0].from+e.from,-1,e);(i||=[r]).push(ue(o,t,n,!1))}}return i?ge(i):r}var ye=class{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~j.EnterBracketed,e instanceof P)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 P?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,n){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,n,this.mode));let{buffer:r}=this.buffer,i=r.findChild(this.index+4,r.buffer[this.index+3],e,t-this.buffer.start,n);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,n=this.mode){return this.buffer?n&j.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,n))}parent(){if(!this.buffer)return this.yieldNode(this.mode&j.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&j.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,n=this.stack.length-1;if(e<0){let e=n<0?0:this.stack[n]+4;if(this.index!=e)return this.yieldBuf(t.findChild(e,this.index,-1,0,4))}else{let e=t.buffer[this.index+3];if(e<(n<0?t.buffer.length:t.buffer[this.stack[n]+3]))return this.yieldBuf(e)}return n<0&&this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode))}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,n,{buffer:r}=this;if(r){if(e>0){if(this.index<r.buffer.buffer.length)return!1}else for(let e=0;e<this.index;e++)if(r.buffer.buffer[e+3]<this.index)return!1;({index:t,parent:n}=r)}else({index:t,_parent:n}=this._tree);for(;n;{index:t,_parent:n}=n)if(t>-1)for(let r=t+e,i=e<0?-1:n._tree.children.length;r!=i;r+=e){let e=n._tree.children[r];if(this.mode&j.IncludeAnonymous||e instanceof N||!e.type.isAnonymous||be(e))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,n=0;if(e&&e.context==this.buffer)scan:for(let r=this.index,i=this.stack.length;i>=0;){for(let a=e;a;a=a._parent)if(a.index==r){if(r==this.index)return a;t=a,n=i+1;break scan}r=this.stack[--i]}for(let e=n;e<this.stack.length;e++)t=new he(this.buffer,t,this.stack[e]);return this.bufferNode=new he(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let n=0;;){let r=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){n++;continue}this.type.isAnonymous||(r=!0)}for(;;){if(r&&t&&t(this),r=this.type.isAnonymous,!n)return;if(this.nextSibling())break;this.parent(),n--,r=!0}}}matchContext(e){if(!this.buffer)return pe(this.node.parent,e);let{buffer:t}=this.buffer,{types:n}=t.set;for(let r=e.length-1,i=this.stack.length-1;r>=0;i--){if(i<0)return pe(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 be(e){return e.children.some(e=>e instanceof N||!e.type.isAnonymous||be(e))}function xe(e){let{buffer:t,nodeSet:n,maxBufferLength:r=E,reused:i=[],minRepeatType:a=n.types.length}=e,o=Array.isArray(t)?new ce(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,ee=l,te=c;if(w<0){if(o.next(),w==-1){let t=i[x];_.push(t),v.push(S-e);return}if(w==-3){c=x;return}if(w==-4){l=x;return}throw RangeError(`Unrecognized record size: ${w}`)}let ne=s[x],T,E,re=S-e;if(C-S<=r&&(E=h(o.pos-t,y))){let t=new Uint16Array(E.size-E.skip),r=o.pos-E.size,i=t.length;for(;o.pos>r;)i=g(E.start,t,i);T=new N(t,C-E.start,n),re=E.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,ee,te),s=t.length,c=o.end),o.next()):b>2500?d(S,e,t,n):u(S,e,t,n,i,b+1);if(i>=0&&s>0&&s<t.length&&p(t,n,S,s,S,c,i,ee,te),t.reverse(),n.reverse(),i>-1&&s>0){let e=f(ne,te);T=we(ne,t,n,0,t.length,0,C-S,e,e)}else T=m(ne,t,n,C-S,ee-C,te)}_.push(T),v.push(re)}function d(e,t,i,a){let s=[],c=0,l=-1;for(;o.pos>t;){let{id:e,start:t,end:n,size:i}=o;if(i>4)o.next();else if(l>-1&&t<l)break;else l<0&&(l=n-r),s.push(e,t,n),c++,o.next()}if(c){let t=new Uint16Array(c*4),r=s[s.length-2];for(let e=s.length-3,n=0;e>=0;e-=3)t[n++]=s[e],t[n++]=s[e+1]-r,t[n++]=s[e+2]-r,t[n++]=n;i.push(new N(t,s[2]-r,n)),a.push(r-e)}}function f(e,t){return(n,r,i)=>{let a=0,o=n.length-1,s,c;if(o>=0&&(s=n[o])instanceof M){if(!o&&s.type==e&&s.length==i)return s;(c=s.prop(O.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=[O.contextHash,a];o=o?[e].concat(o):[e]}if(i>25){let e=[O.lookAhead,i];o=o?[e].concat(o):[e]}return new M(e,t,n,r,o)}function h(e,t){let n=o.fork(),i=0,s=0,c=0,l=n.end-r,u={size:0,start:0,skip:0};scan:for(let r=n.pos-e;n.pos>r;){let e=n.size;if(n.id==t&&e>=0){u.size=i,u.start=s,u.skip=c,c+=4,i+=4,n.next();continue}let o=n.pos-e;if(e<0||o<r||n.start<l)break;let d=n.id>=a?4:0,f=n.start;for(n.next();n.pos>o;){if(n.size<0){if(n.size==-3||n.size==-4)d+=4;else break scan}else n.id>=a&&(d+=4);n.next()}s=f,i+=e,c+=d}return(t<0||i==e)&&(u.size=i,u.start=s,u.skip=c),u.size>4?u:void 0}function g(e,t,n){let{id:r,start:i,end:s,size:u}=o;if(o.next(),u>=0&&r<a){let a=n;if(u>4){let r=o.pos-(u-4);for(;o.pos>r;)n=g(e,t,n)}t[--n]=a,t[--n]=s-e,t[--n]=i-e,t[--n]=r}else u==-3?c=r:u==-4&&(l=r);return n}let _=[],v=[];for(;o.pos>0;)u(e.start||0,e.bufferStart||0,_,v,-1,0);let y=e.length??(_.length?v[0]+_[0].length:0);return new M(s[e.topID],_.reverse(),v.reverse(),y)}var Se=new WeakMap;function Ce(e,t){if(!e.isAnonymous||t instanceof N||t.type!=e)return 1;let n=Se.get(t);if(n==null){n=1;for(let r of t.children){if(r.type!=e||!(r instanceof M)){n=1;break}n+=Ce(e,r)}Se.set(t,n)}return n}function we(e,t,n,r,i,a,o,s,c){let l=0;for(let n=r;n<i;n++)l+=Ce(e,t[n]);let u=Math.ceil(l*1.5/8),d=[],f=[];function p(t,n,r,i,o){for(let s=r;s<i;){let r=s,l=n[s],m=Ce(e,t[s]);for(s++;s<i;s++){let n=Ce(e,t[s]);if(m+n>=u)break;m+=n}if(s==r+1){if(m>u){let e=t[r];p(e.children,e.positions,0,e.children.length,n[r]+o);continue}d.push(t[r])}else{let i=n[s-1]+t[s-1].length-l;d.push(we(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 Te=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 he?this.setBuffer(e.context.buffer,e.index,t):e instanceof P&&this.map.set(e.tree,t)}get(e){return e instanceof he?this.getBuffer(e.context.buffer,e.index):e instanceof P?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)}},F=class e{constructor(e,t,n,r,i=!1,a=!1){this.from=e,this.to=t,this.tree=n,this.offset=r,this.open=!!i|(a?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(t,n=[],r=!1){let i=[new e(0,t.length,t,0,!1,r)];for(let e of n)e.to>t.length&&i.push(e);return i}static applyChanges(t,n,r=128){if(!n.length)return t;let i=[],a=1,o=t.length?t[0]:null;for(let s=0,c=0,l=0;;s++){let u=s<n.length?n[s]:null,d=u?u.fromA:1e9;if(d-c>=r)for(;o&&o.from<d;){let n=o;if(c>=n.from||d<=n.to||l){let t=Math.max(n.from,c)-l,r=Math.min(n.to,d)-l;n=t>=r?null:new e(t,r,n.tree,n.offset+l,s>0,!!u)}if(n&&i.push(n),o.to>d)break;o=a<t.length?t[a++]:null}if(!u)break;c=u.toA,l=u.toA-u.toB}return i}},Ee=class{startParse(e,t,n){return typeof e==`string`&&(e=new De(e)),n=n?n.length?n.map(e=>new D(e.from,e.to)):[new D(0,0)]:[new D(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}}},De=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 Oe(e){return(t,n,r,i)=>new Ne(t,e,n,r,i)}var ke=class{constructor(e,t,n,r,i,a){this.parser=e,this.parse=t,this.overlay=n,this.bracketed=r,this.target=i,this.from=a}};function Ae(e){if(!e.length||e.some(e=>e.from>=e.to))throw RangeError(`Invalid inner parse ranges given: `+JSON.stringify(e))}var je=class{constructor(e,t,n,r,i,a,o,s){this.parser=e,this.predicate=t,this.mounts=n,this.index=r,this.start=i,this.bracketed=a,this.target=o,this.prev=s,this.depth=0,this.ranges=[]}},Me=new O({perNode:!0}),Ne=class{constructor(e,t,n,r,i){this.nest=t,this.input=n,this.fragments=r,this.ranges=i,this.inner=[],this.innerDone=0,this.baseTree=null,this.stoppedAt=null,this.baseParse=e}advance(){if(this.baseParse){let e=this.baseParse.advance();if(!e)return null;if(this.baseParse=null,this.baseTree=e,this.startInner(),this.stoppedAt!=null)for(let e of this.inner)e.parse.stopAt(this.stoppedAt)}if(this.innerDone==this.inner.length){let e=this.baseTree;return this.stoppedAt!=null&&(e=new M(e.type,e.children,e.positions,e.length,e.propValues.concat([[Me,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[O.mounted.id]=new k(t,e.overlay,e.parser,e.bracketed),e.target.props=n}return null}get parsedPos(){if(this.baseParse)return 0;let e=this.input.length;for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].from<e&&(e=Math.min(e,this.inner[t].parse.parsedPos));return e}stopAt(e){if(this.stoppedAt=e,this.baseParse)this.baseParse.stopAt(e);else for(let t=this.innerDone;t<this.inner.length;t++)this.inner[t].parse.stopAt(e)}startInner(){let e=new Re(this.fragments),t=null,n=null,r=new ye(new P(this.baseTree,this.ranges[0].from,0,null),j.IncludeAnonymous|j.IgnoreMounts);scan:for(let i,a;;){let o=!0,s;if(this.stoppedAt!=null&&r.from>=this.stoppedAt)o=!1;else if(e.hasNode(r)){if(t){let e=t.mounts.find(e=>e.frag.from<=r.from&&e.frag.to>=r.to&&e.mount.overlay);if(e)for(let n of e.mount.overlay){let i=n.from+e.pos,a=n.to+e.pos;i>=r.from&&a<=r.to&&!t.ranges.some(e=>e.from<a&&e.to>i)&&t.ranges.push({from:i,to:a})}}o=!1}else if(n&&(a=Pe(n.ranges,r.from,r.to)))o=a!=2;else if(!r.type.isAnonymous&&(i=this.nest(r,this.input))&&(r.from<r.to||!i.overlay)){r.tree||(Ie(r),t&&t.depth++,n&&n.depth++);let a=e.findMounts(r.from,i.parser);if(typeof i.overlay==`function`)t=new je(i.parser,i.overlay,a,this.inner.length,r.from,!!i.bracketed,r.tree,t);else{let e=ze(this.ranges,i.overlay||(r.from<r.to?[new D(r.from,r.to)]:[]));e.length&&Ae(e),(e.length||!i.overlay)&&this.inner.push(new ke(i.parser,e.length?i.parser.startParse(this.input,Ve(a,e),e):i.parser.startParse(``),i.overlay?i.overlay.map(e=>new D(e.from-r.from,e.to-r.from)):null,!!i.bracketed,r.tree,e.length?e[0].from:r.from)),i.overlay?e.length&&(n={ranges:e,depth:0,prev:n}):o=!1}}else if(t&&(s=t.predicate(r))&&(s===!0&&(s=new D(r.from,r.to)),s.from<s.to)){let e=t.ranges.length-1;e>=0&&t.ranges[e].to==s.from?t.ranges[e]={from:t.ranges[e].from,to:s.to}:t.ranges.push(s)}if(o&&r.firstChild())t&&t.depth++,n&&n.depth++;else for(;!r.nextSibling();){if(!r.parent())break scan;if(t&&!--t.depth){let e=ze(this.ranges,t.ranges);e.length&&(Ae(e),this.inner.splice(t.index,0,new ke(t.parser,t.parser.startParse(this.input,Ve(t.mounts,e),e),t.ranges.map(e=>new D(e.from-t.start,e.to-t.start)),t.bracketed,t.target,e[0].from))),t=t.prev}n&&!--n.depth&&(n=n.prev)}}}};function Pe(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 Fe(e,t,n,r,i,a){if(t<n){let o=e.buffer[t+1];r.push(e.slice(t,n,o)),i.push(o-a)}}function Ie(e){let{node:t}=e,n=[],r=t.context.buffer;do n.push(e.index),e.parent();while(!e.tree);let i=e.tree,a=i.children.indexOf(r),o=i.children[a],s=o.buffer,c=[a];function l(e,r,i,a,u,d){let f=n[d],p=[],m=[];Fe(o,e,f,p,m,a);let h=s[f+1],g=s[f+2];c.push(p.length);let _=d?l(f+4,s[f+3],o.set.types[s[f]],h,g-h,d-1):t.toTree();return p.push(_),m.push(h-a),Fe(o,s[f+3],r,p,m,a),new M(i,p,m,u)}i.children[a]=l(0,s.length,A.none,0,o.length,n.length-1);for(let t of c){let n=e.tree.children[t],r=e.tree.positions[t];e.yield(new P(n,r+e.from,t,e._tree))}}var Le=class{constructor(e,t){this.offset=t,this.done=!1,this.cursor=e.cursor(j.IncludeAnonymous|j.IgnoreMounts|j.ExcludeBuffers)}moveTo(e){let{cursor:t}=this,n=e-this.offset;for(;!this.done&&t.from<n;)if(!(t.to>=n&&t.enter(n,1,j.IncludeAnonymous|j.IgnoreOverlays|j.ExcludeBuffers))){if(t.to<=n)t.next(!1)||(this.done=!0);else break}}hasNode(e){if(this.moveTo(e.from),!this.done&&this.cursor.from+this.offset==e.from&&this.cursor.tree)for(let t=this.cursor.tree;;){if(t==e.tree)return!0;if(t.children.length&&t.positions[0]==0&&t.children[0]instanceof M)t=t.children[0];else break}return!1}},Re=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(Me)??t.to,this.inner=new Le(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(Me)??e.to,this.inner=new Le(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(O.mounted);if(r&&r.parser==t)for(let t=this.fragI;t<this.fragments.length;t++){let i=this.fragments[t];if(i.from>=e.to)break;i.tree==this.curFrag.tree&&n.push({frag:i,pos:e.from-i.offset,mount:r})}}}return n}};function ze(e,t){let n=null,r=t;for(let i=1,a=0;i<e.length;i++){let o=e[i-1].to,s=e[i].from;for(;a<r.length;a++){let e=r[a];if(e.from>=s)break;e.to<=o||(n||(r=n=t.slice()),e.from<o?(n[a]=new D(e.from,o),e.to>s&&n.splice(a+1,0,new D(s,e.to))):e.to>s?n[a--]=new D(s,e.to):n.splice(a--,1))}}return r}function Be(e,t,n,r){let i=0,a=0,o=!1,s=!1,c=-1e9,l=[];for(;;){let u=i==e.length?1e9:o?e[i].to:e[i].from,d=a==t.length?1e9:s?t[a].to:t[a].from;if(o!=s){let e=Math.max(c,n),t=Math.min(u,d,r);e<t&&l.push(new D(e,t))}if(c=Math.min(u,d),c==1e9)break;u==c&&(o?(o=!1,i++):o=!0),d==c&&(s?(s=!1,a++):s=!0)}return l}function Ve(e,t){let n=[];for(let{pos:r,mount:i,frag:a}of e){let e=r+(i.overlay?i.overlay[0].from:0),o=e+i.tree.length,s=Math.max(a.from,e),c=Math.min(a.to,o);if(i.overlay){let o=Be(t,i.overlay.map(e=>new D(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 F(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 F(s,c,i.tree,-e,a.from>=e||a.openStart,a.to<=o||a.openEnd))}return n}var He=0,I=class e{constructor(e,t,n,r){this.name=e,this.set=t,this.base=n,this.modified=r,this.id=He++}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 We(e);return e=>e.modified.indexOf(t)>-1?e:We.get(e.base||e,e.modified.concat(t).sort((e,t)=>e.id-t.id))}},Ue=0,We=class e{constructor(e){this.name=e,this.instances=[],this.id=Ue++}static get(t,n){if(!n.length)return t;let r=n[0].instances.find(e=>e.base==t&&Ge(n,e.modified));if(r)return r;let i=[],a=new I(t.name,i,t,n);for(let e of n)e.instances.push(a);let o=Ke(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 Ge(e,t){return e.length==t.length&&e.every((e,n)=>e==t[n])}function Ke(e){let t=[[]];for(let n=0;n<e.length;n++)for(let r=0,i=t.length;r<i;r++)t.push(t[r].concat(e[n]));return t.sort((e,t)=>t.length-e.length)}function qe(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 Ye(r,i,o>0?n.slice(0,o):null).sort(t[s])}}return Je.add(t)}var Je=new O({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 Ye(i.tags,i.mode,i.context);n?n.next=a:r=a,n=a}return r}}),Ye=class{constructor(e,t,n,r){this.tags=e,this.mode=t,this.context=n,this.next=r}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}};Ye.empty=new Ye([],2,null);function Xe(e,t){let n=Object.create(null);for(let t of e)if(!Array.isArray(t.tag))n[t.tag.id]=t.class;else for(let e of t.tag)n[e.id]=t.class;let{scope:r,all:i=null}=t||{};return{style:e=>{let t=i;for(let r of e)for(let e of r.set){let r=n[e.id];if(r){t=t?t+` `+r:r;break}}return t},scope:r}}function Ze(e,t){let n=null;for(let r of e){let e=r.style(t);e&&(n=n?n+` `+e:e)}return n}function Qe(e,t,n,r=0,i=e.length){let a=new $e(r,Array.isArray(t)?t:[t],n);a.highlightRange(e.cursor(),r,i,``,a.highlighters),a.flush(i)}var $e=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=et(e)||Ye.empty,u=Ze(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(O.mounted);if(d&&d.overlay){let a=e.node.enter(d.overlay[0].from+o,1),l=this.highlighters.filter(e=>!e.scope||e.scope(d.tree.type)),u=e.firstChild();for(let f=0,p=o;;f++){let m=f<d.overlay.length?d.overlay[f]:null,h=m?m.from+o:s,g=Math.max(t,p),_=Math.min(n,h);if(g<_&&u)for(;e.from<_&&(this.highlightRange(e,g,_,r,i),this.startSpan(Math.min(_,e.to),c),!(e.to>=h||!e.nextSibling())););if(!m||h>n)break;p=m.to+o,p>t&&(this.highlightRange(a.cursor(),Math.max(t,m.from+o),Math.min(n,p),``,l),this.startSpan(Math.min(n,p),c))}u&&e.parent()}else if(e.firstChild()){d&&(r=``);do if(!(e.to<=t)){if(e.from>=n)break;this.highlightRange(e,t,n,r,i),this.startSpan(Math.min(n,e.to),c)}while(e.nextSibling());e.parent()}}};function et(e){let t=e.type.prop(Je);for(;t&&t.context&&!e.matchContext(t.context);)t=t.next;return t||null}var L=I.define,tt=L(),R=L(),nt=L(R),rt=L(R),z=L(),it=L(z),at=L(z),B=L(),V=L(B),H=L(),U=L(),ot=L(),st=L(ot),ct=L(),W={comment:tt,lineComment:L(tt),blockComment:L(tt),docComment:L(tt),name:R,variableName:L(R),typeName:nt,tagName:L(nt),propertyName:rt,attributeName:L(rt),className:L(R),labelName:L(R),namespace:L(R),macroName:L(R),literal:z,string:it,docString:L(it),character:L(it),attributeValue:L(it),number:at,integer:L(at),float:L(at),bool:L(z),regexp:L(z),escape:L(z),color:L(z),url:L(z),keyword:H,self:L(H),null:L(H),atom:L(H),unit:L(H),modifier:L(H),operatorKeyword:L(H),controlKeyword:L(H),definitionKeyword:L(H),moduleKeyword:L(H),operator:U,derefOperator:L(U),arithmeticOperator:L(U),logicOperator:L(U),bitwiseOperator:L(U),compareOperator:L(U),updateOperator:L(U),definitionOperator:L(U),typeOperator:L(U),controlOperator:L(U),punctuation:ot,separator:L(ot),bracket:st,angleBracket:L(st),squareBracket:L(st),paren:L(st),brace:L(st),content:B,heading:V,heading1:L(V),heading2:L(V),heading3:L(V),heading4:L(V),heading5:L(V),heading6:L(V),contentSeparator:L(B),list:L(B),quote:L(B),emphasis:L(B),strong:L(B),link:L(B),monospace:L(B),strikethrough:L(B),inserted:L(),deleted:L(),changed:L(),invalid:L(),meta:ct,documentMeta:L(ct),annotation:L(ct),processingInstruction:L(ct),definition:I.defineModifier(`definition`),constant:I.defineModifier(`constant`),function:I.defineModifier(`function`),standard:I.defineModifier(`standard`),local:I.defineModifier(`local`),special:I.defineModifier(`special`)};for(let e in W){let t=W[e];t instanceof I&&(t.name=e)}Xe([{tag:W.link,class:`tok-link`},{tag:W.heading,class:`tok-heading`},{tag:W.emphasis,class:`tok-emphasis`},{tag:W.strong,class:`tok-strong`},{tag:W.keyword,class:`tok-keyword`},{tag:W.atom,class:`tok-atom`},{tag:W.bool,class:`tok-bool`},{tag:W.url,class:`tok-url`},{tag:W.labelName,class:`tok-labelName`},{tag:W.inserted,class:`tok-inserted`},{tag:W.deleted,class:`tok-deleted`},{tag:W.literal,class:`tok-literal`},{tag:W.string,class:`tok-string`},{tag:W.number,class:`tok-number`},{tag:[W.regexp,W.escape,W.special(W.string)],class:`tok-string2`},{tag:W.variableName,class:`tok-variableName`},{tag:W.local(W.variableName),class:`tok-variableName tok-local`},{tag:W.definition(W.variableName),class:`tok-variableName tok-definition`},{tag:W.special(W.variableName),class:`tok-variableName2`},{tag:W.definition(W.propertyName),class:`tok-propertyName tok-definition`},{tag:W.typeName,class:`tok-typeName`},{tag:W.namespace,class:`tok-namespace`},{tag:W.className,class:`tok-className`},{tag:W.macroName,class:`tok-macroName`},{tag:W.propertyName,class:`tok-propertyName`},{tag:W.operator,class:`tok-operator`},{tag:W.comment,class:`tok-comment`},{tag:W.meta,class:`tok-meta`},{tag:W.invalid,class:`tok-invalid`},{tag:W.punctuation,class:`tok-punctuation`}]);var G=new O;function lt(e){return v.define({combine:e?t=>t.concat(e):void 0})}var ut=new O,K=class{constructor(e,t,n=[],r=``){this.data=e,this.name=r,l.prototype.hasOwnProperty(`tree`)||Object.defineProperty(l.prototype,"tree",{get(){return q(this)}}),this.parser=t,this.extension=[J.of(this),l.languageData.of((e,t,n)=>{let r=dt(e,t,n),i=r.type.prop(G);if(!i)return[];let a=e.facet(i),o=r.type.prop(ut);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 dt(e,t,n).type.prop(G)==this.data}findRegions(e){let t=e.facet(J);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(G)==this.data){n.push({from:t,to:t+e.length});return}let i=e.prop(O.mounted);if(i){if(i.tree.prop(G)==this.data){if(i.overlay)for(let e of i.overlay)n.push({from:e.from+t,to:e.to+t});else n.push({from:t,to:t+e.length});return}if(i.overlay){let e=n.length;if(r(i.tree,i.overlay[0].from+t),n.length>e)return}}for(let n=0;n<e.children.length;n++){let i=e.children[n];i instanceof M&&r(i,e.positions[n]+t)}};return r(q(e),0),n}get allowsNesting(){return!0}};K.setState=r.define();function dt(e,t,n){let r=e.facet(J),i=q(e).topNode;if(!r||r.allowsNesting)for(let e=i;e;e=e.enter(t,n,j.ExcludeBuffers|j.EnterBracketed))e.type.isTop&&(i=e);return i}var ft=class e extends K{constructor(e,t,n){super(e,t,[],n),this.parser=t}static define(t){let n=lt(t.languageData);return new e(n,t.parser.configure({props:[G.add(e=>e.isTop?n:void 0)]}),t.name)}configure(t,n){return new e(this.data,this.parser.configure(t),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function q(e){let t=e.field(K.state,!1);return t?t.tree:M.empty}var pt=class{constructor(e){this.doc=e,this.cursorPos=0,this.string=``,this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let n=this.cursorPos-this.string.length;return e<n||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-n,t-n)}},mt=null,ht=class e{constructor(e,t,n=[],r,i,a,o,s){this.parser=e,this.state=t,this.fragments=n,this.tree=r,this.treeLen=i,this.viewport=a,this.skipped=o,this.scheduleOn=s,this.parse=null,this.tempSkipped=[]}static create(t,n,r){return new e(t,n,[],M.empty,0,r,[],null)}startParse(){return this.parser.startParse(new pt(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=M.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{if(typeof e==`number`){let t=Date.now()+e;e=()=>Date.now()>t}for(this.parse||=this.startParse(),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let n=this.parse.advance();if(n){if(this.fragments=this.withoutTempSkipped(F.addTree(n,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=this.parse.stoppedAt??this.state.doc.length,this.tree=n,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0}if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(F.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=mt;mt=this;try{return e()}finally{mt=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=gt(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=F.applyChanges(r,e),i=M.empty,a=0,o={from:t.mapPos(o.from,-1),to:t.mapPos(o.to,1)},this.skipped.length){s=[];for(let e of this.skipped){let n=t.mapPos(e.from,1),r=t.mapPos(e.to,-1);n<r&&s.push({from:n,to:r})}}}return new e(this.parser,n,r,i,a,o,s,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let t=0;t<this.skipped.length;t++){let{from:n,to:r}=this.skipped[t];n<e.to&&r>e.from&&(this.fragments=gt(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 Ee{createParse(t,n,r){let i=r[0].from,a=r[r.length-1].to;return{parsedPos:i,advance(){let t=mt;if(t){for(let e of r)t.tempSkipped.push(e);e&&(t.scheduleOn=t.scheduleOn?Promise.all([t.scheduleOn,e]):e)}return this.parsedPos=a,new M(A.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 mt}};function gt(e,t,n){return F.applyChanges(e,[{fromA:t,toA:n,fromB:t,toB:n}])}var _t=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=ht.create(t.facet(J).parser,t,{from:0,to:n});return r.work(20,n)||r.takeTree(),new e(r)}};K.state=a.define({create:_t.init,update(e,t){for(let e of t.effects)if(e.is(K.setState))return e.value;return t.startState.facet(J)==t.state.facet(J)?e.apply(t):_t.init(t.state)}});var vt=e=>{let t=setTimeout(()=>e(),500);return()=>clearTimeout(t)};typeof requestIdleCallback<`u`&&(vt=e=>{let t=-1,n=setTimeout(()=>{t=requestIdleCallback(e,{timeout:400})},100);return()=>t<0?clearTimeout(n):cancelIdleCallback(t)});var yt=typeof navigator<`u`&&navigator.scheduling?.isInputPending?()=>navigator.scheduling.isInputPending():null,bt=g.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(K.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(K.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=vt(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:n,viewport:{to:r}}=this.view,i=n.field(K.state);if(i.tree==i.context.tree&&i.context.isDone(r+1e5))return;let a=Date.now()+Math.min(this.chunkBudget,100,e&&!yt?Math.max(25,e.timeRemaining()-5):1e9),o=i.context.treeLen<r&&n.doc.length>r+1e3,s=i.context.work(()=>yt&&yt()||Date.now()>a,r+(o?0:1e5));this.chunkBudget-=Date.now()-t,(s||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:K.setState.of(new _t(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=>y(this.view.state,e)).then(()=>this.workScheduled--),null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),J=v.define({combine(e){return e.length?e[0]:null},enables:e=>[K.state,bt,C.contentAttributes.compute([e],t=>{let n=t.facet(e);return n&&n.name?{"data-language":n.name}:{}})]}),xt=class{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}},St=class e{constructor(e,t,n,r,i,a=void 0){this.name=e,this.alias=t,this.extensions=n,this.filename=r,this.loadFunc=i,this.support=a,this.loading=null}load(){return this.loading||=this.loadFunc().then(e=>this.support=e,e=>{throw this.loading=null,e})}static of(t){let{load:n,support:r}=t;if(!n){if(!r)throw RangeError(`Must pass either 'load' or 'support' to LanguageDescription.of`);n=()=>Promise.resolve(r)}return new e(t.name,(t.alias||[]).concat(t.name).map(e=>e.toLowerCase()),t.extensions||[],t.filename,n,r)}static matchFilename(e,t){for(let n of e)if(n.filename&&n.filename.test(t))return n;let n=/\.([^.]+)$/.exec(t);if(n){for(let t of e)if(t.extensions.indexOf(n[1])>-1)return t}return null}static matchLanguageName(e,t,n=!0){t=t.toLowerCase();for(let n of e)if(n.alias.some(e=>e==t))return n;if(n)for(let n of e)for(let e of n.alias){let r=t.indexOf(e);if(r>-1&&(e.length>2||!/\w/.test(t[r-1])&&!/\w/.test(t[r+e.length])))return n}return null}},Ct=v.define(),wt=v.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 Tt(e){let t=e.facet(wt);return t.charCodeAt(0)==9?e.tabSize*t.length:t.length}function Et(e,t){let n=``,r=e.tabSize,i=e.facet(wt)[0];if(i==` `){for(;t>=r;)n+=` `,t-=r;i=` `}for(let e=0;e<t;e++)n+=i;return n}function Dt(e,t){e instanceof l&&(e=new Ot(e));for(let n of e.state.facet(Ct)){let r=n(e,t);if(r!==void 0)return r}let n=q(e.state);return n.length>=t?At(e,n,t):null}var Ot=class{constructor(e,t={}){this.state=e,this.options=t,this.unit=Tt(e)}lineAt(e,t=1){let n=this.state.doc.lineAt(e),{simulateBreak:r,simulateDoubleBreak:i}=this.options;return r!=null&&r>=n.from&&r<=n.to?i&&r==e?{text:``,from:e}:(t<0?r<e:r<=e)?{text:n.text.slice(r-n.from),from:r}:{text:n.text.slice(0,r-n.from),from:n.from}:n}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return``;let{text:n,from:r}=this.lineAt(e,t);return n.slice(e-r,Math.min(n.length,e+100-r))}column(e,t=1){let{text:n,from:r}=this.lineAt(e,t),i=this.countColumn(n,e-r),a=this.options.overrideIndentation?this.options.overrideIndentation(r):-1;return a>-1&&(i+=a-this.countColumn(n,n.search(/\S|$/))),i}countColumn(e,t=e.length){return i(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}},kt=new O;function At(e,t,n){let r=t.resolveStack(n),i=t.resolveInner(n,-1).resolve(n,0).enterUnfinishedNodesBefore(n);if(i!=r.node){let e=[];for(let t=i;t&&!(t.from<r.node.from||t.to>r.node.to||t.from==r.node.from&&t.type==r.node.type);t=t.parent)e.push(t);for(let t=e.length-1;t>=0;t--)r={node:e[t],next:r}}return jt(r,e,n)}function jt(e,t,n){for(let r=e;r;r=r.next){let e=Nt(r.node);if(e)return e(Ft.create(t,n,r))}return 0}function Mt(e){return e.pos==e.options.simulateBreak&&e.options.simulateDoubleBreak}function Nt(e){let t=e.type.prop(kt);if(t)return t;let n=e.firstChild,r;if(n&&(r=n.type.prop(O.closedBy))){let t=e.lastChild,n=t&&r.indexOf(t.name)>-1;return e=>zt(e,!0,1,void 0,n&&!Mt(e)?t.from:void 0)}return e.parent==null?Pt:null}function Pt(){return 0}var Ft=class e extends Ot{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(It(n,e))break;t=this.state.doc.lineAt(n.from)}return this.lineIndent(t.from)}continue(){return jt(this.context.next,this.base,this.pos)}};function It(e,t){for(let n=t;n;n=n.parent)if(e==n)return!0;return!1}function Lt(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 Rt({closing:e,align:t=!0,units:n=1}){return r=>zt(r,t,n,e)}function zt(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?Lt(e):null;return c?s?e.column(c.from):e.column(c.to):e.baseIndent+(s?0:e.unit*n)}var Bt=e=>e.baseIndent;function Vt({except:e,units:t=1}={}){return n=>{let r=e&&e.test(n.textAfter);return n.baseIndent+(r?0:t*n.unit)}}var Ht=v.define(),Ut=new O;function Wt(e){let t=e.firstChild,n=e.lastChild;return t&&t.to<n.from?{from:t.to,to:n.type.isError?e.to:n.from}:null}var Gt=class e{constructor(e,t){this.specs=e;let n;function r(e){let t=te.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 K?e=>e.prop(G)==a.data:a?e=>e==a:void 0,this.style=Xe(e.map(e=>({tag:e.tag,class:e.class||r(Object.assign({},e,{tag:null}))})),{all:i}).style,this.module=n?new te(n):null,this.themeType=t.themeType}static define(t,n){return new e(t,n||{})}},Kt=v.define(),qt=v.define({combine(e){return e.length?[e[0]]:null}});function Jt(e){let t=e.facet(Kt);return t.length?t:e.facet(qt)}function Yt(e,t){let n=[Zt],r;return e instanceof Gt&&(e.module&&n.push(C.styleModule.of(e.module)),r=e.themeType),t?.fallback?n.push(qt.of(e)):r?n.push(Kt.computeN([C.darkTheme],t=>t.facet(C.darkTheme)==(r==`dark`)?[e]:[])):n.push(Kt.of(e)),n}var Xt=class{constructor(e){this.markCache=Object.create(null),this.tree=q(e.state),this.decorations=this.buildDeco(e,Jt(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=q(e.state),n=Jt(e.state),r=n!=Jt(e.startState),{viewport:i}=e.view,a=e.changes.mapPos(this.decoratedTo,1);t.length<i.to&&!r&&t.type==this.tree.type&&a>=i.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=a):(t!=this.tree||e.viewportChanged||r)&&(this.tree=t,this.decorations=this.buildDeco(e.view,n),this.decoratedTo=i.to)}buildDeco(e,t){if(!t||!this.tree.length)return w.none;let n=new c;for(let{from:r,to:i}of e.visibleRanges)Qe(this.tree,t,(e,t,r)=>{n.add(e,t,this.markCache[r]||(this.markCache[r]=w.mark({class:r})))},r,i);return n.finish()}},Zt=_.high(g.fromClass(Xt,{decorations:e=>e.decorations}));W.meta,W.link,W.heading,W.emphasis,W.strong,W.strikethrough,W.keyword,W.atom,W.bool,W.url,W.contentSeparator,W.labelName,W.literal,W.inserted,W.string,W.deleted,W.regexp,W.escape,W.string,W.variableName,W.variableName,W.typeName,W.namespace,W.className,W.variableName,W.macroName,W.propertyName,W.comment,W.invalid;var Qt=1e4,$t=`()[]{}`,en=new O;function tn(e,t,n){let r=e.prop(t<0?O.openedBy:O.closedBy);if(r)return r;if(e.name.length==1){let r=n.indexOf(e.name);if(r>-1&&r%2==+(t<0))return[n[r+t]]}return null}function nn(e){let t=e.type.prop(en);return t?t(e.node):e}function rn(e,t,n,r={}){let i=r.maxScanDistance||Qt,a=r.brackets||$t,o=q(e),s=o.resolveInner(t,n);for(let r=s;r;r=r.parent){let i=tn(r.type,n,a);if(i&&r.from<r.to){let o=nn(r);if(o&&(n>0?t>=o.from&&t<o.to:t>o.from&&t<=o.to))return an(e,t,n,r,o,i,a)}}return on(e,t,n,o,s.type,i,a)}function an(e,t,n,r,i,a,o){let s=r.parent,c={from:i.from,to:i.to},l=0,u=s?.cursor();if(u&&(n<0?u.childBefore(r.from):u.childAfter(r.to)))do if(n<0?u.to<=r.from:u.from>=r.to){if(l==0&&a.indexOf(u.type.name)>-1&&u.from<u.to){let e=nn(u);return{start:c,end:e?{from:e.from,to:e.to}:void 0,matched:!0}}if(tn(u.type,n,o))l++;else if(tn(u.type,-n,o)){if(l==0){let e=nn(u);return{start:c,end:e&&e.from<e.to?{from:e.from,to:e.to}:void 0,matched:!1}}l--}}while(n<0?u.prevSibling():u.nextSibling());return{start:c,matched:!1}}function on(e,t,n,r,i,a,o){if(n<0?!t:t==e.doc.length)return null;let s=n<0?e.sliceDoc(t-1,t):e.sliceDoc(t,t+1),c=o.indexOf(s);if(c<0||c%2==0!=n>0)return null;let l={from:n<0?t-1:t,to:n>0?t+1:t},u=e.doc.iterRange(t,n>0?e.doc.length:0),d=0;for(let e=0;!u.next().done&&e<=a;){let a=u.value;n<0&&(e+=a.length);let s=t+e*n;for(let e=n>0?0:a.length-1,t=n>0?a.length:-1;e!=t;e+=n){let t=o.indexOf(a[e]);if(!(t<0||r.resolveInner(s+e,1).type!=i)){if(t%2==0==n>0)d++;else if(d==1)return{start:l,end:{from:s+e,to:s+e+1},matched:t>>1==c>>1};else d--}}n>0&&(e+=a.length)}return u.done?{start:l,matched:!1}:null}var sn=Object.create(null),cn=[A.none],ln=[],un=Object.create(null),dn=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`]])dn[e]=pn(sn,t);function fn(e,t){ln.indexOf(e)>-1||(ln.push(e),console.warn(t))}function pn(e,t){let n=[];for(let r of t.split(` `)){let t=[];for(let n of r.split(`.`)){let r=e[n]||W[n];r?typeof r==`function`?t.length?t=t.map(r):fn(n,`Modifier ${n} used at start of tag`):t.length?fn(n,`Tag ${n} used as modifier`):t=Array.isArray(r)?r:[r]:fn(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=un[i];if(a)return a.id;let o=un[i]=A.define({id:cn.length,name:r,props:[qe({[r]:n})]});return cn.push(o),o.id}b.RTL,b.LTR;var mn=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=q(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(bn(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 hn(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 gn(e){let t=Object.create(null),n=Object.create(null);for(let{label:r}of e){t[r[0]]=!0;for(let e=1;e<r.length;e++)n[r[e]]=!0}let r=hn(t)+hn(n)+`*$`;return[RegExp(`^`+r),new RegExp(r)]}function _n(e){let t=e.map(e=>typeof e==`string`?{label:e}:e),[n,r]=t.every(e=>/^\w+$/.test(e.label))?[/\w*$/,/\w+$/]:gn(t);return e=>{let i=e.matchBefore(r);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:n}:null}}function vn(e,t){return n=>{for(let t=q(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 yn=class{constructor(e,t,n,r){this.completion=e,this.source=t,this.match=n,this.score=r}};function Y(e){return e.selection.main.from}function bn(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 xn=f.define();function Sn(e,t,r,i){let{main:a}=e.selection,o=r-a.from,s=i-a.from;return{...e.changeByRange(c=>{if(c!=a&&r!=i&&e.sliceDoc(c.from+o,c.from+s)!=e.sliceDoc(r,i))return{range:c};let l=e.toText(t);return{changes:{from:c.from+o,to:i==a.from?c.to:c.from+s,insert:l},range:n.cursor(c.from+o+l.length)}}),scrollIntoView:!0,userEvent:`input.complete`}}var Cn=new WeakMap;function wn(e){if(!Array.isArray(e))return e;let t=Cn.get(e);return t||Cn.set(e,t=_n(e)),t}var Tn=r.define(),En=r.define(),Dn=class{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let n=0;n<e.length;){let r=T(e,n),i=t(r);this.chars.push(r);let a=e.slice(n,n+i),o=a.toUpperCase();this.folded.push(T(o==a?a.toLowerCase():o,0)),n+=i}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:n,folded:r,any:i,precise:a,byWord:o}=this;if(n.length==1){let i=T(e,0),a=t(i),o=a==e.length?0:-100;if(i!=n[0]){if(i==r[0])o+=-200;else return null}return this.ret(o,[0,a])}let s=e.indexOf(this.pattern);if(s==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let c=n.length,l=0;if(s<0){for(let a=0,o=Math.min(e.length,200);a<o&&l<c;){let o=T(e,a);(o==n[l]||o==r[l])&&(i[l++]=a),a+=t(o)}if(l<c)return null}let u=0,d=0,f=!1,p=0,m=-1,g=-1,_=/[a-z]/.test(e),v=!0;for(let i=0,l=Math.min(e.length,200),y=0;i<l&&d<c;){let l=T(e,i);s<0&&(u<c&&l==n[u]&&(a[u++]=i),p<c&&(l==n[p]||l==r[p]?(p==0&&(m=i),g=i+1,p++):p=0));let b,x=l<255?l>=48&&l<=57||l>=97&&l<=122?2:+(l>=65&&l<=90):(b=h(l))==b.toLowerCase()?b==b.toUpperCase()?0:2:1;(!i||x==1&&_||y==0&&x!=0)&&(n[d]==l||r[d]==l&&(f=!0)?o[d++]=i:o.length&&(v=!1)),y=x,i+=t(l)}return d==c&&o[0]==0&&v?this.result(-100+(f?-200:0),o,e):p==c&&m==0?this.ret(-200-e.length+(g==e.length?0:-100),[0,g]):s>-1?this.ret(-700-e.length,[s,s+this.pattern.length]):p==c?this.ret(-900-e.length,[m,g]):d==c?this.result(-100+(f?-200:0)+-700+(v?0:-1100),o,e):n.length==2?null:this.result((i[0]?-700:0)+-200+-1100,i,e)}result(e,n,r){let i=[],a=0;for(let e of n){let n=e+(this.astral?t(T(r,e)):1);a&&i[a-1]==e?i[a-1]=n:(i[a++]=e,i[a++]=n)}return this.ret(e-r.length,i)}},On=class{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),n=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return n==null?null:(this.matched=[0,t.length],this.score=n+(e.length==this.pattern.length?0:-100),this)}},X=v.define({combine(e){return m(e,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>``,optionClass:()=>``,aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:An,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=>kn(e(n),t(n)),optionClass:(e,t)=>n=>kn(e(n),t(n)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function kn(e,t){return e?t?e+` `+t:e:t}function An(e,t,n,r,i,a){let o=e.textDirection==b.RTL,s=o,c=!1,l=`top`,u,d,f=t.left-i.left,p=i.right-t.right,m=r.right-r.left,h=r.bottom-r.top;if(s&&f<Math.min(m,p)?s=!1:!s&&p<Math.min(m,f)&&(s=!0),m<=(s?f:p))u=Math.max(i.top,Math.min(n.top,i.bottom-h))-t.top,d=Math.min(400,s?f:p);else{c=!0,d=Math.min(400,(o?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;e>=h||e>t.top?u=n.bottom-t.top:(l=`bottom`,u=t.bottom-n.top)}let g=(t.bottom-t.top)/a.offsetHeight,_=(t.right-t.left)/a.offsetWidth;return{style:`${l}: ${u/g}px; max-width: ${d/_}px`,class:`cm-completionInfo-`+(c?o?`left-narrow`:`right-narrow`:s?`left`:`right`)}}var jn=r.define();function Mn(e){let t=e.addToOptions.slice();return e.icons&&t.push({render(e){let t=document.createElement(`div`);return t.classList.add(`cm-completionIcon`),e.type&&t.classList.add(...e.type.split(/\s+/g).map(e=>`cm-completionIcon-`+e)),t.setAttribute(`aria-hidden`,`true`),t},position:20}),t.push({render(e,t,n,r){let i=document.createElement(`span`);i.className=`cm-completionLabel`;let a=e.displayLabel||e.label,o=0;for(let e=0;e<r.length;){let t=r[e++],n=r[e++];t>o&&i.appendChild(document.createTextNode(a.slice(o,t)));let s=i.appendChild(document.createElement(`span`));s.appendChild(document.createTextNode(a.slice(t,n))),s.className=`cm-completionMatchedText`,o=n}return o<a.length&&i.appendChild(document.createTextNode(a.slice(o))),i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement(`span`);return t.className=`cm-completionDetail`,t.textContent=e.detail,t},position:80}),t.sort((e,t)=>e.position-t.position).map(e=>e.render)}function Nn(e,t,n){if(e<=n)return{from:0,to:e};if(t<0&&(t=0),t<=e>>1){let e=Math.floor(t/n);return{from:e*n,to:(e+1)*n}}let r=Math.ceil((e-t)/n);return{from:e-r*n,to:e-(r-1)*n}}var Pn=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(X);this.optionContent=Mn(o),this.optionClass=o.optionClass,this.tooltipClass=o.tooltipClass,this.range=Nn(i.length,a,o.maxRenderedOptions),this.dom=document.createElement(`div`),this.dom.className=`cm-tooltip-autocomplete`,this.updateTooltipClass(e.state),this.dom.addEventListener(`mousedown`,n=>{let{options:r}=e.state.field(t).open;for(let t=n.target,i;t&&t!=this.dom;t=t.parentNode)if(t.nodeName==`LI`&&(i=/-(\d+)$/.exec(t.id))&&+i[1]<r.length){this.applyCompletion(e,r[+i[1]]),n.preventDefault();return}if(n.target==this.list){let t=this.list.classList.contains(`cm-completionListIncompleteTop`)&&n.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains(`cm-completionListIncompleteBottom`)&&n.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;t!=null&&(e.dispatch({effects:jn.of(t)}),n.preventDefault())}}),this.dom.addEventListener(`focusout`,t=>{let n=e.state.field(this.stateField,!1);n&&n.tooltip&&e.state.facet(X).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:En.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=Nn(r.length,i,e.state.facet(X).maxRenderedOptions),this.showOptions(r,t.id)),this.updateSel(),a!=n.open?.disabled&&this.dom.classList.toggle(`cm-tooltip-autocomplete-disabled`,!!a)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(` `))e&&this.dom.classList.remove(e);for(let e of t.split(` `))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=Nn(t.options.length,t.selected,this.view.state.facet(X).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=>y(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&&In(this.list,t),t}measureInfo(){let e=this.dom.querySelector(`[aria-selected]`);if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),n=this.info.getBoundingClientRect(),r=e.getBoundingClientRect(),i=this.space;if(!i){let e=this.dom.ownerDocument.documentElement;i={left:0,top:0,right:e.clientWidth,bottom:e.clientHeight}}return r.top>Math.min(i.bottom,t.bottom)-10||r.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(X).positionInfo(this.view,t,r,n,i,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className=`cm-tooltip cm-completionInfo `+(e.class||``)):this.info.style.cssText=`top: -1e6px`)}createListBox(e,t,n){let r=document.createElement(`ul`);r.id=t,r.setAttribute(`role`,`listbox`),r.setAttribute(`aria-expanded`,`true`),r.setAttribute(`aria-label`,this.view.state.phrase(`Completions`)),r.addEventListener(`mousedown`,e=>{e.target==r&&e.preventDefault()});let i=null;for(let a=n.from;a<n.to;a++){let{completion:o,match:s}=e[a],{section:c}=o;if(c){let e=typeof c==`string`?c:c.name;if(e!=i&&(a>n.from||n.from==0)){if(i=e,typeof c!=`string`&&c.header)r.appendChild(c.header(c));else{let t=r.appendChild(document.createElement(`completion-section`));t.textContent=e}}}let l=r.appendChild(document.createElement(`li`));l.id=t+`-`+a,l.setAttribute(`role`,`option`);let u=this.optionClass(o);u&&(l.className=u);for(let e of this.optionContent){let t=e(o,this.view.state,this.view,s);t&&l.appendChild(t)}}return n.from&&r.classList.add(`cm-completionListIncompleteTop`),n.to<e.length&&r.classList.add(`cm-completionListIncompleteBottom`),r}destroyInfo(){this.info&&=(this.infoDestroy&&this.infoDestroy(),this.info.remove(),null)}destroy(){this.destroyInfo()}};function Fn(e,t){return n=>new Pn(n,e,t)}function In(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=n.height/e.offsetHeight;r.top<n.top?e.scrollTop-=(n.top-r.top)/i:r.bottom>n.bottom&&(e.scrollTop+=(r.bottom-n.bottom)/i)}function Ln(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+ +!!e.type}function Rn(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(X);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 yn(t,r.source,e?e(t):[],1e9-n.length));else{let n=t.sliceDoc(r.from,r.to),s,c=o.filterStrict?new On(n):new Dn(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 yn(t,r.source,n,o)),typeof t.section==`object`&&t.section.rank===`dynamic`){let{name:e}=t.section;i||=Object.create(null),i[e]=Math.max(o,i[e]||-1e9)}}}}if(r){let e=Object.create(null),t=0,a=(e,t)=>(e.rank===`dynamic`&&t.rank===`dynamic`?i[t.name]-i[e.name]:0)||(typeof e.rank==`number`?e.rank:1e9)-(typeof t.rank==`number`?t.rank:1e9)||(e.name<t.name?-1:1);for(let n of r.sort(a))t-=1e5,e[n.name]=t;for(let t of n){let{section:n}=t.completion;n&&(t.score+=e[typeof n==`string`?n:n.name])}}let s=[],c=null,l=o.compareCompletions;for(let e of n.sort((e,t)=>t.score-e.score||l(e.completion,t.completion))){let t=e.completion;!c||c.label!=t.label||c.detail!=t.detail||c.type!=null&&t.type!=null&&c.type!=t.type||c.apply!=t.apply||c.boost!=t.boost?s.push(e):Ln(e.completion)>Ln(c)&&(s[s.length-1]=e),c=e.completion}return s}var zn=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,Wn(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=Rn(t,n);if(!s.length)return i&&t.some(e=>e.isPending)?i.setDisabled():null;let c=n.facet(X).selectOnOpen?0:-1;if(i&&i.selected!=c&&i.selected!=-1){let e=i.options[i.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){c=t;break}}return new e(s,Wn(r,c),{pos:t.reduce((e,t)=>t.hasResult()?Math.min(e,t.from):e,1e8),create:Zn,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)}},Bn=class e{constructor(e,t,n){this.active=e,this.id=t,this.open=n}static start(){return new e(Gn,`cm-ac-`+Math.floor(Math.random()*2e6).toString(36),null)}update(t){let{state:n}=t,r=n.facet(X),i=(r.override||n.languageDataAt(`autocomplete`,Y(n)).map(wn)).map(e=>(this.active.find(t=>t.source==e)||new Z(e,+!!this.active.some(e=>e.state!=0))).update(t,r));i.length==this.active.length&&i.every((e,t)=>e==this.active[t])&&(i=this.active);let a=this.open,o=t.effects.some(e=>e.is(Yn));a&&t.docChanged&&(a=a.map(t.changes)),t.selection||i.some(e=>e.hasResult()&&t.changes.touchesRange(e.from,e.to))||!Vn(i,this.active)||o?a=zn.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 Z(e.source,0):e));for(let e of t.effects)e.is(jn)&&(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?Hn:Un}};function Vn(e,t){if(e==t)return!0;for(let n=0,r=0;;){for(;n<e.length&&!e[n].hasResult();)n++;for(;r<t.length&&!t[r].hasResult();)r++;let i=n==e.length,a=r==t.length;if(i||a)return i==a;if(e[n++].result!=t[r++].result)return!1}}var Hn={"aria-autocomplete":`list`},Un={};function Wn(e,t){let n={"aria-autocomplete":`list`,"aria-haspopup":`listbox`,"aria-controls":e};return t>-1&&(n[`aria-activedescendant`]=e+`-`+t),n}var Gn=[];function Kn(e,t){if(e.isUserEvent(`input.complete`)){let n=e.annotation(xn);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 Z=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=Kn(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(Tn))i=new e(i.source,1,n.value);else if(n.is(En))i=new e(i.source,0);else if(n.is(Yn))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(Y(e.state))}},qn=class e extends Z{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=Y(t.state);if(o>a||!r||n&2&&(Y(t.startState)==this.from||o<this.limit))return new Z(this.source,n&4?1:0);let s=t.changes.mapPos(this.limit);return Jn(r.validFor,t.state,i,a)?new e(this.source,this.explicit,s,r,i,a):r.update&&(r=r.update(r,i,a,new mn(t.state,o,!1)))?new e(this.source,this.explicit,s,r,r.from,r.to??Y(t.state)):new Z(this.source,1,this.explicit)}map(t){if(t.empty)return this;let n=this.result.map?this.result.map(this.result,t):this.result;return n?new e(this.source,this.explicit,t.mapPos(this.limit),n,t.mapPos(this.from),t.mapPos(this.to,1)):new Z(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}};function Jn(e,t,n,r){if(!e)return!1;let i=t.sliceDoc(n,r);return typeof e==`function`?e(i,n,r,t):bn(e,!0).test(i)}var Yn=r.define({map(e,t){return e.map(e=>e.map(t))}}),Q=a.define({create(){return Bn.start()},update(e,t){return e.update(t)},provide:e=>[ne.from(e,e=>e.tooltip),C.contentAttributes.from(e,e=>e.attrs)]});function Xn(e,t){let n=t.completion.apply||t.completion.label,r=e.state.field(Q).active.find(e=>e.source==t.source);return r instanceof qn&&(typeof n==`string`?e.dispatch({...Sn(e.state,n,r.from,r.to),annotations:xn.of(t.completion)}):n(e,t.completion,r.from,r.to),!0)}var Zn=Fn(Q,Xn);function Qn(e,t=`option`){return n=>{let r=n.state.field(Q,!1);if(!r||!r.open||r.open.disabled||Date.now()-r.open.timestamp<n.state.facet(X).interactionDelay)return!1;let i=1,a;t==`page`&&(a=ee(n,r.open.tooltip))&&(i=Math.max(2,Math.floor(a.dom.offsetHeight/a.dom.querySelector(`li`).offsetHeight)-1));let{length:o}=r.open.options,s=r.open.selected>-1?r.open.selected+i*(e?1:-1):e?0:o-1;return s<0?s=t==`page`?0:o-1:s>=o&&(s=t==`page`?o-1:0),n.dispatch({effects:jn.of(s)}),!0}}var $n=e=>{let t=e.state.field(Q,!1);return e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(X).interactionDelay?!1:Xn(e,t.open.options[t.open.selected])},er=e=>e.state.field(Q,!1)?(e.dispatch({effects:Tn.of(!0)}),!0):!1,tr=e=>{let t=e.state.field(Q,!1);return!t||!t.active.some(e=>e.state!=0)?!1:(e.dispatch({effects:En.of(null)}),!0)},nr=class{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}},rr=50,ir=1e3,ar=g.fromClass(class{constructor(e){this.view=e,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let t of e.state.field(Q).active)t.isPending&&this.startQuery(t)}update(e){let t=e.state.field(Q),n=e.state.facet(X);if(!e.selectionSet&&!e.docChanged&&e.startState.field(Q)==t)return;let r=e.transactions.some(e=>{let t=Kn(e,n);return t&8||(e.selection||e.docChanged)&&!(t&3)});for(let t=0;t<this.running.length;t++){let n=this.running[t];if(r||n.context.abortOnDocChange&&e.docChanged||n.updates.length+e.transactions.length>rr&&Date.now()-n.time>ir){for(let e of n.context.abortListeners)try{e()}catch(e){y(this.view.state,e)}n.context.abortListeners=null,this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),e.transactions.some(e=>e.effects.some(e=>e.is(Tn)))&&(this.pendingStart=!0);let i=this.pendingStart?50:n.activateOnTypingDelay;if(this.debounceUpdate=t.active.some(e=>e.isPending&&!this.running.some(t=>t.active.source==e.source))?setTimeout(()=>this.startUpdate(),i):-1,this.composing!=0)for(let t of e.transactions)t.isUserEvent(`input.type`)?this.composing=2:this.composing==2&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:e}=this.view,t=e.field(Q);for(let e of t.active)e.isPending&&!this.running.some(t=>t.active.source==e.source)&&this.startQuery(e);this.running.length&&t.open&&t.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(X).updateSyncTime))}startQuery(e){let{state:t}=this.view,n=new mn(t,Y(t),e.explicit,this.view),r=new nr(e,n);this.running.push(r),Promise.resolve(e.source(n)).then(e=>{r.context.aborted||(r.done=e||null,this.scheduleAccept())},e=>{this.view.dispatch({effects:En.of(null)}),y(this.view.state,e)})}scheduleAccept(){this.running.every(e=>e.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(X).updateSyncTime))}accept(){this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(X),n=this.view.state.field(Q);for(let r=0;r<this.running.length;r++){let i=this.running[r];if(i.done===void 0)continue;if(this.running.splice(r--,1),i.done){let n=Y(i.updates.length?i.updates[0].startState:this.view.state),r=Math.min(n,i.done.from+ +!i.active.explicit),a=new qn(i.active.source,i.active.explicit,r,i.done,i.done.from,i.done.to??n);for(let e of i.updates)a=a.update(e,t);if(a.hasResult()){e.push(a);continue}}let a=n.active.find(e=>e.source==i.active.source);if(a&&a.isPending){if(i.done==null){let n=new Z(i.active.source,0);for(let e of i.updates)n=n.update(e,t);n.isPending||e.push(n)}else this.startQuery(a)}}(e.length||n.open&&n.open.disabled)&&this.view.dispatch({effects:Yn.of(e)})}},{eventHandlers:{blur(e){let t=this.view.state.field(Q,!1);if(t&&t.tooltip&&this.view.state.facet(X).closeOnBlur){let n=t.open&&ee(this.view,t.open.tooltip);(!n||!n.dom.contains(e.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:En.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Tn.of(!1)}),20),this.composing=0}}}),or=typeof navigator==`object`&&/Win/.test(navigator.platform),sr=_.highest(C.domEventHandlers({keydown(e,t){let n=t.state.field(Q,!1);if(!n||!n.open||n.open.disabled||n.open.selected<0||e.key.length>1||e.ctrlKey&&!(or&&e.altKey)||e.metaKey)return!1;let r=n.open.options[n.open.selected],i=n.active.find(e=>e.source==r.source),a=r.completion.commitCharacters||i.result.commitCharacters;return a&&a.indexOf(e.key)>-1&&Xn(t,r),!1}})),cr=C.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:`monospace`,whiteSpace:`nowrap`,overflow:`hidden auto`,maxWidth_fallback:`700px`,maxWidth:`min(700px, 95vw)`,minWidth:`250px`,maxHeight:`10em`,height:`100%`,listStyle:`none`,margin:0,padding:0,"& > li, & > completion-section":{padding:`1px 3px`,lineHeight:1.2},"& > li":{overflowX:`hidden`,textOverflow:`ellipsis`,cursor:`pointer`},"& > completion-section":{display:`list-item`,borderBottom:`1px solid silver`,paddingLeft:`0.5em`,opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#17c`,color:`white`},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#777`},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:`#347`,color:`white`},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:`#444`},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:`"···"`,opacity:.5,display:`block`,textAlign:`center`,cursor:`pointer`},".cm-tooltip.cm-completionInfo":{position:`absolute`,padding:`3px 9px`,width:`max-content`,maxWidth:`400px`,boxSizing:`border-box`,whiteSpace:`pre-line`},".cm-completionInfo.cm-completionInfo-left":{right:`100%`},".cm-completionInfo.cm-completionInfo-right":{left:`100%`},".cm-completionInfo.cm-completionInfo-left-narrow":{right:`30px`},".cm-completionInfo.cm-completionInfo-right-narrow":{left:`30px`},"&light .cm-snippetField":{backgroundColor:`#00000022`},"&dark .cm-snippetField":{backgroundColor:`#ffffff22`},".cm-snippetFieldPosition":{verticalAlign:`text-top`,width:0,height:`1.15em`,display:`inline-block`,margin:`0 -0.7px -.7em`,borderLeft:`1.4px dotted #888`},".cm-completionMatchedText":{textDecoration:`underline`},".cm-completionDetail":{marginLeft:`0.5em`,fontStyle:`italic`},".cm-completionIcon":{fontSize:`90%`,width:`.8em`,display:`inline-block`,textAlign:`center`,paddingRight:`.6em`,opacity:`0.6`,boxSizing:`content-box`},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:`'ƒ'`}},".cm-completionIcon-class":{"&:after":{content:`'○'`}},".cm-completionIcon-interface":{"&:after":{content:`'◌'`}},".cm-completionIcon-variable":{"&:after":{content:`'𝑥'`}},".cm-completionIcon-constant":{"&:after":{content:`'𝐶'`}},".cm-completionIcon-type":{"&:after":{content:`'𝑡'`}},".cm-completionIcon-enum":{"&:after":{content:`'∪'`}},".cm-completionIcon-property":{"&:after":{content:`'□'`}},".cm-completionIcon-keyword":{"&:after":{content:`'🔑︎'`}},".cm-completionIcon-namespace":{"&:after":{content:`'▢'`}},".cm-completionIcon-text":{"&:after":{content:`'abc'`,fontSize:`50%`,verticalAlign:`middle`}}}),lr=class{constructor(e,t,n,r){this.field=e,this.line=t,this.from=n,this.to=r}},ur=class t{constructor(e,t,n){this.field=e,this.from=t,this.to=n}map(n){let r=n.mapPos(this.from,-1,e.TrackDel),i=n.mapPos(this.to,1,e.TrackDel);return r==null||i==null?null:new t(this.field,r,i)}},dr=class e{constructor(e,t){this.lines=e,this.fieldPositions=t}instantiate(e,t){let n=[],r=[t],i=e.doc.lineAt(t),a=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(n.length){let n=a,o=/^\t*/.exec(i)[0].length;for(let t=0;t<o;t++)n+=e.facet(wt);r.push(t+n.length-o),i=n+i.slice(o)}n.push(i),t+=i.length+1}return{text:n,ranges:this.fieldPositions.map(e=>new ur(e.field,r[e.line]+e.from,r[e.line]+e.to))}}static parse(t){let n=[],r=[],i=[],a;for(let e of t.split(/\r\n?|\n/)){for(;a=/[#$]\{(?:(\d+)(?::([^{}]*))?|((?:\\[{}]|[^{}])*))\}/.exec(e);){let t=a[1]?+a[1]:null,o=a[2]||a[3]||``,s=-1;t===0&&(t=1e9);let c=o.replace(/\\[{}]/g,e=>e[1]);for(let e=0;e<n.length;e++)(t==null?c&&n[e].name==c:n[e].seq==t)&&(s=e);if(s<0){let e=0;for(;e<n.length&&(t==null||n[e].seq!=null&&n[e].seq<t);)e++;n.splice(e,0,{seq:t,name:c}),s=e;for(let e of i)e.field>=s&&e.field++}for(let e of i)if(e.line==r.length&&e.from>a.index){let t=a[2]?3+(a[1]||``).length:2;e.from-=t,e.to-=t}i.push(new lr(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)}},fr=w.widget({widget:new class extends x{toDOM(){let e=document.createElement(`span`);return e.className=`cm-snippetFieldPosition`,e}ignoreEvent(){return!1}}}),pr=w.mark({class:`cm-snippetField`}),mr=class e{constructor(e,t){this.ranges=e,this.active=t,this.deco=w.set(e.map(e=>(e.from==e.to?fr:pr).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))}},hr=r.define({map(e,t){return e&&e.map(t)}}),gr=r.define(),_r=a.define({create(){return null},update(e,t){for(let n of t.effects){if(n.is(hr))return n.value;if(n.is(gr)&&e)return new mr(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=>C.decorations.from(e,e=>e?e.deco:w.none)});function vr(e,t){return n.create(e.filter(e=>e.field==t).map(e=>n.range(e.from,e.to)))}function yr(e){let t=dr.parse(e);return(e,n,i,a)=>{let{text:s,ranges:c}=t.instantiate(e.state,i),{main:l}=e.state.selection,u={changes:{from:i,to:a==l.from?l.to:a,insert:o.of(s)},scrollIntoView:!0,annotations:n?[xn.of(n),d.userEvent.of(`input.complete`)]:void 0};if(c.length&&(u.selection=vr(c,0)),c.some(e=>e.field>0)){let t=new mr(c,0),n=u.effects=[hr.of(t)];e.state.field(_r,!1)===void 0&&n.push(r.appendConfig.of([_r,Cr,Tr,cr]))}e.dispatch(e.state.update(u))}}function br(e){return({state:t,dispatch:n})=>{let r=t.field(_r,!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:vr(r.ranges,i),effects:hr.of(a?null:new mr(r.ranges,i)),scrollIntoView:!0})),!0}}var xr=[{key:`Tab`,run:br(1),shift:br(-1)},{key:`Escape`,run:({state:e,dispatch:t})=>e.field(_r,!1)?(t(e.update({effects:hr.of(null)})),!0):!1}],Sr=v.define({combine(e){return e.length?e[0]:xr}}),Cr=_.highest(S.compute([Sr],e=>e.facet(Sr)));function wr(e,t){return{...t,apply:yr(e)}}var Tr=C.domEventHandlers({mousedown(e,t){let n=t.state.field(_r,!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:vr(n.ranges,i.field),effects:hr.of(n.ranges.some(e=>e.field>i.field)?new mr(n.ranges,i.field):null),scrollIntoView:!0}),!0)}}),Er={brackets:[`(`,`[`,`{`,`'`,`"`],before:`)]}:;>`,stringPrefixes:[]},$=r.define({map(t,n){return n.mapPos(t,-1,e.TrackAfter)??void 0}}),Dr=new class extends u{};Dr.startSide=1,Dr.endSide=-1;var Or=a.define({create(){return s.empty},update(e,t){if(e=e.map(t.changes),t.selection){let n=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=n.from&&e<=n.to})}for(let n of t.effects)n.is($)&&(e=e.update({add:[Dr.range(n.value,n.value+1)]}));return e}});function kr(){return[Pr,Or]}var Ar=`()[]{}<>«»»«[]{}`;function jr(e){for(let t=0;t<16;t+=2)if(Ar.charCodeAt(t)==e)return Ar.charAt(t+1);return h(e<128?e:e+1)}function Mr(e,t){return e.languageDataAt(`closeBrackets`,t)[0]||Er}var Nr=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),Pr=C.inputHandler.of((e,n,r,i)=>{if((Nr?e.composing:e.compositionStarted)||e.state.readOnly)return!1;let a=e.state.selection.main;if(i.length>2||i.length==2&&t(T(i,0))==1||n!=a.from||r!=a.to)return!1;let o=Fr(e.state,i);return o?(e.dispatch(o),!0):!1});function Fr(e,t){let n=Mr(e,e.selection.main.head),r=n.brackets||Er.brackets;for(let i of r){let a=jr(T(i,0));if(t==i)return a==i?Br(e,i,r.indexOf(i+i+i)>-1,n):Rr(e,i,a,n.before||Er.before);if(t==a&&Ir(e,e.selection.main.from))return zr(e,i,a)}return null}function Ir(e,t){let n=!1;return e.field(Or).between(0,e.doc.length,e=>{e==t&&(n=!0)}),n}function Lr(e,n){let r=e.sliceString(n,n+2);return r.slice(0,t(T(r,0)))}function Rr(e,t,r,i){let a=null,o=e.changeByRange(o=>{if(!o.empty)return{changes:[{insert:t,from:o.from},{insert:r,from:o.to}],effects:$.of(o.to+t.length),range:n.range(o.anchor+t.length,o.head+t.length)};let s=Lr(e.doc,o.head);return!s||/\s/.test(s)||i.indexOf(s)>-1?{changes:{insert:t+r,from:o.head},effects:$.of(o.head+t.length),range:n.cursor(o.head+t.length)}:{range:a=o}});return a?null:e.update(o,{scrollIntoView:!0,userEvent:`input.type`})}function zr(e,t,r){let i=null,a=e.changeByRange(t=>t.empty&&Lr(e.doc,t.head)==r?{changes:{from:t.head,to:t.head+r.length,insert:r},range:n.cursor(t.head+r.length)}:i={range:t});return i?null:e.update(a,{scrollIntoView:!0,userEvent:`input.type`})}function Br(e,t,r,i){let a=i.stringPrefixes||Er.stringPrefixes,o=null,s=e.changeByRange(i=>{if(!i.empty)return{changes:[{insert:t,from:i.from},{insert:t,from:i.to}],effects:$.of(i.to+t.length),range:n.range(i.anchor+t.length,i.head+t.length)};let s=i.head,c=Lr(e.doc,s),l;if(c==t){if(Vr(e,s))return{changes:{insert:t+t,from:s},effects:$.of(s+t.length),range:n.cursor(s+t.length)};if(Ir(e,s)){let i=r&&e.sliceDoc(s,s+t.length*3)==t+t+t?t+t+t:t;return{changes:{from:s,to:s+i.length,insert:i},range:n.cursor(s+i.length)}}}else if(r&&e.sliceDoc(s-2*t.length,s)==t+t&&(l=Ur(e,s-2*t.length,a))>-1&&Vr(e,l))return{changes:{insert:t+t+t+t,from:s},effects:$.of(s+t.length),range:n.cursor(s+t.length)};else if(e.charCategorizer(s)(c)!=p.Word&&Ur(e,s,a)>-1&&!Hr(e,s,t,a))return{changes:{insert:t+t,from:s},effects:$.of(s+t.length),range:n.cursor(s+t.length)};return{range:o=i}});return o?null:e.update(s,{scrollIntoView:!0,userEvent:`input.type`})}function Vr(e,t){let n=q(e).resolveInner(t+1);return n.parent&&n.from==t}function Hr(e,t,n,r){let i=q(e).resolveInner(t,-1),a=r.reduce((e,t)=>Math.max(e,t.length),0);for(let o=0;o<5;o++){let o=e.sliceDoc(i.from,Math.min(i.to,i.from+n.length+a)),s=o.indexOf(n);if(!s||s>-1&&r.indexOf(o.slice(0,s))>-1){let t=i.firstChild;for(;t&&t.from==i.from&&t.to-t.from>n.length+s;){if(e.sliceDoc(t.to-n.length,t.to)==n)return!1;t=t.firstChild}return!0}let c=i.to==t&&i.parent;if(!c)break;i=c}return!1}function Ur(e,t,n){let r=e.charCategorizer(t);if(r(e.sliceDoc(t-1,t))!=p.Word)return t;for(let i of n){let n=t-i.length;if(e.sliceDoc(n,t)==i&&r(e.sliceDoc(n-1,n))!=p.Word)return n}return-1}function Wr(e={}){return[sr,Q,X.of(e),ar,Kr,cr]}var Gr=[{key:`Ctrl-Space`,run:er},{mac:"Alt-`",run:er},{mac:`Alt-i`,run:er},{key:`Escape`,run:tr},{key:`ArrowDown`,run:Qn(!0)},{key:`ArrowUp`,run:Qn(!1)},{key:`PageDown`,run:Qn(!0,`page`)},{key:`PageUp`,run:Qn(!1,`page`)},{key:`Enter`,run:$n}],Kr=_.highest(S.computeN([X],e=>e.facet(X).defaultKeymap?[Gr]:[]));export{Yt as A,Te as B,Dt as C,G as D,wt as E,E as F,M as H,j as I,O as L,I as M,qe as N,rn as O,W as P,ae as R,Tt as S,Et as T,Oe as U,Ee as V,Rt as _,vn as a,Ut as b,Ot as c,St as d,xt as f,lt as g,Vt as h,_n as i,q as j,ut as k,ft as l,en as m,Wr as n,wr as o,ht as p,kr as r,Gt as s,mn as t,K as u,Bt as v,kt as w,Ht as x,Wt as y,A as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as e,D as t,F as n,H as r,I as i,L as a,R as o,S as s,U as c,V as l,k as u,n as d,r as f,w as p}from"./dist-EBVTpvRr.js";import{C as m,E as ee,L as h,O as g,S as _,T as v,c as y,j as b}from"./dist-GlRRx9Xl.js";var te=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=S(e.state,n.from);return r.line?ne(e):r.block?ie(e):!1};function x(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 ne=x(se,0),re=x(w,0),ie=x((e,t)=>w(e,t,oe(t)),0);function S(e,t){let n=e.languageDataAt(`commentTokens`,t,1);return n.length?n[0]:{}}var C=50;function ae(e,{open:t,close:n},r,i){let a=e.sliceDoc(r-C,r),o=e.sliceDoc(i,i+C),s=/\s*$/.exec(a)[0].length,c=/^\s*/.exec(o)[0].length,l=a.length-s;if(a.slice(l-t.length,l)==t&&o.slice(c,c+n.length)==n)return{open:{pos:r-s,margin:s&&1},close:{pos:i+c,margin:c&&1}};let u,d;i-r<=100?u=d=e.sliceDoc(r,i):(u=e.sliceDoc(r,r+C),d=e.sliceDoc(i-C,i));let f=/^\s*/.exec(u)[0].length,p=/\s*$/.exec(d)[0].length,m=d.length-p-n.length;return u.slice(f,f+t.length)==t&&d.slice(m,m+n.length)==n?{open:{pos:r+f+t.length,margin:+!!/\s/.test(u.charAt(f+t.length))},close:{pos:i-p-n.length,margin:+!!/\s/.test(d.charAt(m-1))}}:null}function oe(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 w(e,t,n=t.selection.ranges){let r=n.map(e=>S(t,e.from).block);if(!r.every(e=>e))return null;let i=n.map((e,n)=>ae(t,r[n],e.from,e.to));if(e!=2&&!i.every(e=>e))return{changes:t.changes(n.map((e,t)=>i[t]?[]:[{from:e.from,insert:r[t].open+` `},{from:e.to,insert:` `+r[t].close}]))};if(e!=1&&i.some(e=>e)){let e=[];for(let t=0,n;t<i.length;t++)if(n=i[t]){let i=r[t],{open:a,close:o}=n;e.push({from:a.pos-i.open.length,to:a.pos+a.margin},{from:o.pos-o.margin,to:o.pos+i.close.length})}return{changes:e}}return null}function se(e,t,n=t.selection.ranges){let r=[],i=-1;ranges:for(let{from:e,to:a}of n){let n=r.length,o=1e9,s;for(let n=e;n<=a;){let c=t.doc.lineAt(n);if(s==null&&(s=S(t,c.from).line,!s))continue ranges;if(c.from>i&&(e==a||a>c.from)){i=c.from;let e=/^\s*/.exec(c.text)[0].length,t=e==c.length,n=c.text.slice(e,e+s.length)==s?e:-1;e<c.text.length&&e<o&&(o=e),r.push({line:c,comment:n,token:s,indent:e,empty:t,single:!1})}n=c.to+1}if(o<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=o);r.length==n+1&&(r[n].single=!0)}if(e!=2&&r.some(e=>e.comment<0&&(!e.empty||e.single))){let e=[];for(let{line:t,token:n,indent:i,empty:a,single:o}of r)(o||!a)&&e.push({from:t.from+i,insert:n+` `});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(e!=1&&r.some(e=>e.comment>=0)){let e=[];for(let{line:t,comment:n,token:i}of r)if(n>=0){let r=t.from+n,a=r+i.length;t.text[a-t.from]==` `&&a++,e.push({from:r,to:a})}return{changes:e}}return null}var T=s.define(),ce=s.define(),le=u.define(),ue=u.define({combine(e){return l(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)})}}),de=i.define({create(){return P.empty},update(e,t){let n=t.state.facet(ue),r=t.annotation(T);if(r){let i=O.fromTransaction(t,r.selection),a=r.side,o=a==0?e.undone:e.done;return o=i?k(o,o.length,n.minDepth,i):M(o,t.startState.selection),new P(a==0?r.rest:o,a==0?o:r.rest)}let i=t.annotation(ce);if((i==`full`||i==`before`)&&(e=e.isolate()),t.annotation(o.addToHistory)===!1)return t.changes.empty?e:e.addMapping(t.changes.desc);let a=O.fromTransaction(t),s=t.annotation(o.time),c=t.annotation(o.userEvent);return a?e=e.addChanges(a,s,c,n,t):t.selection&&(e=e.addSelection(t.startState.selection,s,c,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 P(e.done.map(O.fromJSON),e.undone.map(O.fromJSON))}});function fe(e={}){return[de,ue.of(e),f.domEventHandlers({beforeinput(e,t){let n=e.inputType==`historyUndo`?pe:e.inputType==`historyRedo`?D:null;return n?(e.preventDefault(),n(t)):!1}})]}function E(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return!1;let i=n.field(de,!1);if(!i)return!1;let a=i.pop(e,n,t);return a?(r(a),!0):!1}}var pe=E(0,!1),D=E(1,!1),me=E(0,!0),he=E(1,!0),O=class n{constructor(e,t,n,r,i){this.changes=e,this.effects=t,this.mapped=n,this.startSelection=r,this.selectionsAfter=i}setSelAfter(e){return new n(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){return{changes:this.changes?.toJSON(),mapped:this.mapped?.toJSON(),startSelection:this.startSelection?.toJSON(),selectionsAfter:this.selectionsAfter.map(e=>e.toJSON())}}static fromJSON(r){return new n(r.changes&&p.fromJSON(r.changes),[],r.mapped&&e.fromJSON(r.mapped),r.startSelection&&t.fromJSON(r.startSelection),r.selectionsAfter.map(t.fromJSON))}static fromTransaction(e,t){let r=j;for(let t of e.startState.facet(le)){let n=t(e);n.length&&(r=r.concat(n))}return!r.length&&e.changes.empty?null:new n(e.changes.invert(e.startState.doc),r,void 0,t||e.startState.selection,j)}static selection(e){return new n(void 0,j,void 0,void 0,e)}};function k(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 ge(e,t){let n=[],r=!1;return e.iterChangedRanges((e,t)=>n.push(e,t)),t.iterChangedRanges((e,t,i,a)=>{for(let e=0;e<n.length;){let t=n[e++],o=n[e++];a>=t&&i<=o&&(r=!0)}}),r}function _e(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter((e,n)=>e.empty!=t.ranges[n].empty).length===0}function A(e,t){return e.length?t.length?e.concat(t):e:t}var j=[],ve=200;function M(e,t){if(e.length){let n=e[e.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-ve));return r.length&&r[r.length-1].eq(t)?e:(r.push(t),k(e,e.length-1,1e9,n.setSelAfter(r)))}return[O.selection([t])]}function ye(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 N(e,t){if(!e.length)return e;let n=e.length,r=j;for(;n;){let i=be(e[n-1],t,r);if(i.changes&&!i.changes.empty||i.effects.length){let t=e.slice(0,n);return t[n-1]=i,t}t=i.mapped,n--,r=i.selectionsAfter}return r.length?[O.selection(r)]:j}function be(e,t,r){let i=A(e.selectionsAfter.length?e.selectionsAfter.map(e=>e.map(t)):j,r);if(!e.changes)return O.selection(i);let a=e.changes.map(t),o=t.mapDesc(e.changes,!0),s=e.mapped?e.mapped.composeDesc(o):o;return new O(a,n.mapEffects(e.effects,t),s,e.startSelection.map(o),i)}var xe=/^(input\.type|delete)($|\.)/,P=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,r,i,a,o){let s=this.done,c=s[s.length-1];return s=c&&c.changes&&!c.changes.empty&&t.changes&&(!i||xe.test(i))&&(!c.selectionsAfter.length&&r-this.prevTime<a.newGroupDelay&&a.joinToEvent(o,ge(c.changes,t.changes))||i==`input.type.compose`)?k(s,s.length-1,a.minDepth,new O(t.changes.compose(c.changes),A(n.mapEffects(t.effects,c.changes),c.effects),c.mapped,c.startSelection,j)):k(s,s.length,a.minDepth,t),new e(s,j,r,i)}addSelection(t,n,r,i){let a=this.done.length?this.done[this.done.length-1].selectionsAfter:j;return a.length>0&&n-this.prevTime<i&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&_e(a[a.length-1],t)?this:new e(M(this.done,t),this.undone,n,r)}addMapping(t){return new e(N(this.done,t),N(this.undone,t),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let i=r[r.length-1],a=i.selectionsAfter[0]||(i.startSelection?i.startSelection.map(i.changes.invertedDesc,1):t.selection);if(n&&i.selectionsAfter.length)return t.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:T.of({side:e,rest:ye(r),selection:a}),userEvent:e==0?`select.undo`:`select.redo`,scrollIntoView:!0});if(i.changes){let n=r.length==1?j:r.slice(0,r.length-1);return i.mapped&&(n=N(n,i.mapped)),t.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:T.of({side:e,rest:n,selection:a}),filter:!1,userEvent:e==0?`undo`:`redo`,scrollIntoView:!0})}return null}};P.empty=new P(j,j);var Se=[{key:`Mod-z`,run:pe,preventDefault:!0},{key:`Mod-y`,mac:`Mod-Shift-z`,run:D,preventDefault:!0},{linux:`Ctrl-Shift-z`,run:D,preventDefault:!0},{key:`Mod-u`,run:me,preventDefault:!0},{key:`Alt-u`,mac:`Mod-Shift-u`,run:he,preventDefault:!0}];function F(e,n){return t.create(e.ranges.map(n),e.mainIndex)}function I(e,t){return e.update({selection:t,scrollIntoView:!0,userEvent:`select`})}function L({state:e,dispatch:t},n){let r=F(e.selection,n);return!r.eq(e.selection,!0)&&(t(I(e,r)),!0)}function R(e,n){return t.cursor(n?e.to:e.from)}function z(e,t){return L(e,n=>n.empty?e.moveByChar(n,t):R(n,t))}function B(e){return e.textDirectionAt(e.state.selection.main.head)==d.LTR}var V=e=>z(e,!B(e)),H=e=>z(e,B(e));function U(e,t){return L(e,n=>n.empty?e.moveByGroup(n,t):R(n,t))}var Ce=e=>U(e,!B(e)),we=e=>U(e,B(e));typeof Intl<`u`&&Intl.Segmenter;function Te(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 W(e,n,r){let i=b(e).resolveInner(n.head),a=r?h.closedBy:h.openedBy;for(let t=n.head;;){let n=r?i.childAfter(t):i.childBefore(t);if(!n)break;Te(e,n,a)?i=n:t=r?n.to:n.from}let o=i.type.prop(a),s,c;return c=o&&(s=r?g(e,i.from,1):g(e,i.to,-1))&&s.matched?r?s.end.to:s.end.from:r?i.to:i.from,t.cursor(c,r?-1:1)}var Ee=e=>L(e,t=>W(e.state,t,!B(e))),De=e=>L(e,t=>W(e.state,t,B(e)));function Oe(e,t){return L(e,n=>{if(!n.empty)return R(n,t);let r=e.moveVertically(n,t);return r.head==n.head?e.moveToLineBoundary(n,t):r})}var ke=e=>Oe(e,!1),Ae=e=>Oe(e,!0);function G(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2,n=0,r=0,i;if(t){for(let t of e.state.facet(f.scrollMargins)){let i=t(e);i?.top&&(n=Math.max(i?.top,n)),i?.bottom&&(r=Math.max(i?.bottom,r))}i=e.scrollDOM.clientHeight-n-r}else i=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:t,height:Math.max(e.defaultLineHeight,i-5)}}function je(e,t){let n=G(e),{state:r}=e,i=F(r.selection,r=>r.empty?e.moveVertically(r,t,n.height):R(r,t));if(i.eq(r.selection))return!1;let a;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head),o=e.scrollDOM.getBoundingClientRect(),s=o.top+n.marginTop,c=o.bottom-n.marginBottom;t&&t.top>s&&t.bottom<c&&(a=f.scrollIntoView(i.main.head,{y:`start`,yMargin:t.top-s}))}return e.dispatch(I(r,i),{effects:a}),!0}var Me=e=>je(e,!1),K=e=>je(e,!0);function q(e,n,r){let i=e.lineBlockAt(n.head),a=e.moveToLineBoundary(n,r);if(a.head==n.head&&a.head!=(r?i.to:i.from)&&(a=e.moveToLineBoundary(n,r,!1)),!r&&a.head==i.from&&i.length){let r=/^\s*/.exec(e.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&n.head!=i.from+r&&(a=t.cursor(i.from+r))}return a}var Ne=e=>L(e,t=>q(e,t,!0)),Pe=e=>L(e,t=>q(e,t,!1)),Fe=e=>L(e,t=>q(e,t,!B(e))),Ie=e=>L(e,t=>q(e,t,B(e))),Le=e=>L(e,t=>e.moveToLineBoundary(t,!1,!1)),Re=e=>L(e,t=>e.moveToLineBoundary(t,!0,!1));function ze(e,n,r){let i=!1,a=F(e.selection,n=>{let a=g(e,n.head,-1)||g(e,n.head,1)||n.head>0&&g(e,n.head-1,1)||n.head<e.doc.length&&g(e,n.head+1,-1);if(!a||!a.end)return n;i=!0;let o=a.start.from==n.head?a.end.to:a.end.from;return r?t.range(n.anchor,o):t.cursor(o)});return i?(n(I(e,a)),!0):!1}var Be=({state:e,dispatch:t})=>ze(e,t,!1);function J(e,n,r){let i=F(e.state.selection,e=>{e.undirectional&&e.head>=e.anchor!=n&&(e=t.range(e.head,e.anchor));let i=r(e);return t.range(e.anchor,i.head,i.goalColumn,i.bidiLevel||void 0,i.assoc)});return!i.eq(e.state.selection)&&(e.dispatch(I(e.state,i)),!0)}function Ve(e,t){return J(e,t,n=>e.moveByChar(n,t))}var He=e=>Ve(e,!B(e)),Ue=e=>Ve(e,B(e));function We(e,t){return J(e,t,n=>e.moveByGroup(n,t))}var Ge=e=>We(e,!B(e)),Ke=e=>We(e,B(e)),qe=e=>{let t=!B(e);return J(e,t,n=>W(e.state,n,t))},Je=e=>{let t=B(e);return J(e,t,n=>W(e.state,n,t))};function Ye(e,t){return J(e,t,n=>e.moveVertically(n,t))}var Xe=e=>Ye(e,!1),Ze=e=>Ye(e,!0);function Qe(e,t){return J(e,t,n=>e.moveVertically(n,t,G(e).height))}var $e=e=>Qe(e,!1),et=e=>Qe(e,!0),tt=e=>J(e,!0,t=>q(e,t,!0)),nt=e=>J(e,!1,t=>q(e,t,!1)),rt=e=>{let t=!B(e);return J(e,t,n=>q(e,n,t))},it=e=>{let t=B(e);return J(e,t,n=>q(e,n,t))},at=e=>J(e,!1,n=>t.cursor(e.lineBlockAt(n.head).from)),ot=e=>J(e,!0,n=>t.cursor(e.lineBlockAt(n.head).to)),st=({state:e,dispatch:t})=>(t(I(e,{anchor:0})),!0),ct=({state:e,dispatch:t})=>(t(I(e,{anchor:e.doc.length})),!0),lt=({state:e,dispatch:t})=>(t(I(e,{anchor:e.selection.main.anchor,head:0})),!0),ut=({state:e,dispatch:t})=>(t(I(e,{anchor:e.selection.main.anchor,head:e.doc.length})),!0),dt=({state:e,dispatch:t})=>(t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:`select`})),!0),ft=({state:e,dispatch:n})=>{let r=Q(e).map(({from:n,to:r})=>t.undirectionalRange(n,Math.min(r+1,e.doc.length)));return n(e.update({selection:t.create(r),userEvent:`select`})),!0},pt=({state:e,dispatch:n})=>{let r=F(e.selection,n=>{let r=b(e),i=r.resolveStack(n.from,1);if(n.empty){let e=r.resolveStack(n.from,-1);e.node.from>=i.node.from&&e.node.to<=i.node.to&&(i=e)}for(let e=i;e;e=e.next){let{node:r}=e;if((r.from<n.from&&r.to>=n.to||r.to>n.to&&r.from<=n.from)&&e.next)return t.undirectionalRange(r.from,r.to)}return n});return!r.eq(e.selection)&&(n(I(e,r)),!0)};function mt(e,n){let{state:r}=e,i=r.selection,a=r.selection.ranges.slice();for(let t of r.selection.ranges){let i=r.doc.lineAt(t.head);if(n?i.to<e.state.doc.length:i.from>0)for(let r=t;;){let t=e.moveVertically(r,n);if(t.head<i.from||t.head>i.to){a.some(e=>e.head==t.head)||a.push(t);break}if(t.head==r.head)break;r=t}}return a.length!=i.ranges.length&&(e.dispatch(I(r,t.create(a,a.length-1))),!0)}var ht=e=>mt(e,!1),gt=e=>mt(e,!0),_t=({state:e,dispatch:n})=>{let r=e.selection,i=null;return r.ranges.length>1?i=t.create([r.main]):r.main.empty||(i=t.create([t.cursor(r.main.head)])),i?(n(I(e,i)),!0):!1};function Y(e,n){if(e.state.readOnly)return!1;let r=`delete.selection`,{state:i}=e,a=i.changeByRange(i=>{let{from:a,to:o}=i;if(a==o){let t=n(i);t<a?(r=`delete.backward`,t=X(e,t,!1)):t>a&&(r=`delete.forward`,t=X(e,t,!0)),a=Math.min(a,t),o=Math.max(o,t)}else a=X(e,a,!1),o=X(e,o,!0);return a==o?{range:i}:{changes:{from:a,to:o},range:t.cursor(a,a<i.head?-1:1)}});return!a.changes.empty&&(e.dispatch(i.update(a,{scrollIntoView:!0,userEvent:r,effects:r==`delete.selection`?f.announce.of(i.phrase(`Selection deleted`)):void 0})),!0)}function X(e,t,n){if(e instanceof f)for(let r of e.state.facet(f.atomicRanges).map(t=>t(e)))r.between(t,t,(e,r)=>{e<t&&r>t&&(t=n?r:e)});return t}var vt=(e,t,n)=>Y(e,i=>{let a=i.from,{state:o}=e,s=o.doc.lineAt(a),l,u;if(n&&!t&&a>s.from&&a<s.from+200&&!/[^ \t]/.test(l=s.text.slice(0,a-s.from))){if(l[l.length-1]==` `)return a-1;let e=r(l,o.tabSize)%_(o)||_(o);for(let t=0;t<e&&l[l.length-1-t]==` `;t++)a--;u=a}else u=c(s.text,a-s.from,t,t)+s.from,u==a&&s.number!=(t?o.doc.lines:1)?u+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(s.text.slice(u-s.from,a-s.from))&&(u=c(s.text,u-s.from,!1,!1)+s.from);return u}),Z=e=>vt(e,!1,!0),yt=e=>vt(e,!0,!1),bt=(e,t)=>Y(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=c(a.text,r-a.from,t)+a.from,l=a.text.slice(Math.min(r,s)-a.from,Math.max(r,s)-a.from),u=o(l);if(e!=null&&u!=e)break;(l!=` `||r!=n.head)&&(e=u),r=s}return r}),xt=e=>bt(e,!1),St=e=>bt(e,!0),Ct=e=>Y(e,t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),wt=e=>Y(e,t=>{let n=e.moveToLineBoundary(t,!1).head;return t.head>n?n:Math.max(0,t.head-1)}),Tt=e=>Y(e,t=>{let n=e.moveToLineBoundary(t,!0).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}),Et=({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:a.of([``,``])},range:t.cursor(e.from)}));return n(e.update(r,{scrollIntoView:!0,userEvent:`input`})),!0},Dt=({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(n=>{if(!n.empty||n.from==0||n.from==e.doc.length)return{range:n};let r=n.from,i=e.doc.lineAt(r),a=r==i.from?r-1:c(i.text,r-i.from,!1)+i.from,o=r==i.to?r+1:c(i.text,r-i.from,!0)+i.from;return{changes:{from:a,to:o,insert:e.doc.slice(r,o).append(e.doc.slice(a,r))},range:t.cursor(o)}});return!r.changes.empty&&(n(e.update(r,{scrollIntoView:!0,userEvent:`move.character`})),!0)};function Q(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 Ot(e,n,r){if(e.readOnly)return!1;let i=[],a=[];for(let n of Q(e)){if(r?n.to==e.doc.length:n.from==0)continue;let o=e.doc.lineAt(r?n.to+1:n.from-1),s=o.length+1;if(r){i.push({from:n.to,to:o.to},{from:n.from,insert:o.text+e.lineBreak});for(let r of n.ranges)a.push(t.range(Math.min(e.doc.length,r.anchor+s),Math.min(e.doc.length,r.head+s)))}else{i.push({from:o.from,to:n.from},{from:n.to,insert:e.lineBreak+o.text});for(let e of n.ranges)a.push(t.range(e.anchor-s,e.head-s))}}return i.length?(n(e.update({changes:i,scrollIntoView:!0,selection:t.create(a,e.selection.mainIndex),userEvent:`move.line`})),!0):!1}var kt=({state:e,dispatch:t})=>Ot(e,t,!1),At=({state:e,dispatch:t})=>Ot(e,t,!0);function jt(e,t,n){if(e.readOnly)return!1;let r=[];for(let t of Q(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});let i=e.changes(r);return t(e.update({changes:i,selection:e.selection.map(i,n?1:-1),scrollIntoView:!0,userEvent:`input.copyline`})),!0}var Mt=({state:e,dispatch:t})=>jt(e,t,!1),Nt=({state:e,dispatch:t})=>jt(e,t,!0),Pt=e=>{if(e.state.readOnly)return!1;let{state:t}=e,n=t.changes(Q(t).map(({from:e,to:n})=>(e>0?e--:n<t.doc.length&&n++,{from:e,to:n}))),r=F(t.selection,t=>{let n;if(e.lineWrapping){let r=e.lineBlockAt(t.head),i=e.coordsAtPos(t.head,t.assoc||1);i&&(n=r.bottom+e.documentTop-i.bottom+e.defaultLineHeight/2)}return e.moveVertically(t,!0,n)}).map(n);return e.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:`delete.line`}),!0};function Ft(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=b(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(h.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 It=Rt(!1),Lt=Rt(!0);function Rt(e){return({state:n,dispatch:i})=>{if(n.readOnly)return!1;let o=n.changeByRange(i=>{let{from:o,to:s}=i,c=n.doc.lineAt(o),l=!e&&o==s&&Ft(n,o);e&&(o=s=(s<=c.to?c:n.doc.lineAt(s)).to);let u=new y(n,{simulateBreak:o,simulateDoubleBreak:!!l}),d=m(u,o);for(d??=r(/^\s*/.exec(n.doc.lineAt(o).text)[0],n.tabSize);s<c.to&&/\s/.test(c.text[s-c.from]);)s++;l?{from:o,to:s}=l:o>c.from&&o<c.from+100&&!/\S/.test(c.text.slice(0,o))&&(o=c.from);let f=[``,v(n,d)];return l&&f.push(v(n,u.lineIndent(c.from,-1))),{changes:{from:o,to:s,insert:a.of(f)},range:t.cursor(o+1+f[1].length)}});return i(n.update(o,{scrollIntoView:!0,userEvent:`input`})),!0}}function $(e,n){let r=-1;return e.changeByRange(i=>{let a=[];for(let t=i.from;t<=i.to;){let o=e.doc.lineAt(t);o.number>r&&(i.empty||i.to>o.from)&&(n(o,a,i),r=o.number),t=o.to+1}let o=e.changes(a);return{changes:a,range:t.range(o.mapPos(i.anchor,1),o.mapPos(i.head,1))}})}var zt=({state:e,dispatch:t})=>{if(e.readOnly)return!1;let n=Object.create(null),r=new y(e,{overrideIndentation:e=>n[e]??-1}),i=$(e,(t,i,a)=>{let o=m(r,t.from);if(o==null)return;/\S/.test(t.text)||(o=0);let s=/^\s*/.exec(t.text)[0],c=v(e,o);(s!=c||a.from<t.from+s.length)&&(n[t.from]=o,i.push({from:t.from,to:t.from+s.length,insert:c}))});return i.changes.empty||t(e.update(i,{userEvent:`indent`})),!0},Bt=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update($(e,(t,n)=>{n.push({from:t.from,insert:e.facet(ee)})}),{userEvent:`input.indent`})),!0),Vt=({state:e,dispatch:t})=>!e.readOnly&&(t(e.update($(e,(t,n)=>{let i=/^\s*/.exec(t.text)[0];if(!i)return;let a=r(i,e.tabSize),o=0,s=v(e,Math.max(0,a-_(e)));for(;o<i.length&&o<s.length&&i.charCodeAt(o)==s.charCodeAt(o);)o++;n.push({from:t.from+o,to:t.from+i.length,insert:s.slice(o)})}),{userEvent:`delete.dedent`})),!0),Ht=e=>(e.setTabFocusMode(),!0),Ut=[{key:`Ctrl-b`,run:V,shift:He,preventDefault:!0},{key:`Ctrl-f`,run:H,shift:Ue},{key:`Ctrl-p`,run:ke,shift:Xe},{key:`Ctrl-n`,run:Ae,shift:Ze},{key:`Ctrl-a`,run:Le,shift:at},{key:`Ctrl-e`,run:Re,shift:ot},{key:`Ctrl-d`,run:yt},{key:`Ctrl-h`,run:Z},{key:`Ctrl-k`,run:Ct},{key:`Ctrl-Alt-h`,run:xt},{key:`Ctrl-o`,run:Et},{key:`Ctrl-t`,run:Dt},{key:`Ctrl-v`,run:K}],Wt=[{key:`ArrowLeft`,run:V,shift:He,preventDefault:!0},{key:`Mod-ArrowLeft`,mac:`Alt-ArrowLeft`,run:Ce,shift:Ge,preventDefault:!0},{mac:`Cmd-ArrowLeft`,run:Fe,shift:rt,preventDefault:!0},{key:`ArrowRight`,run:H,shift:Ue,preventDefault:!0},{key:`Mod-ArrowRight`,mac:`Alt-ArrowRight`,run:we,shift:Ke,preventDefault:!0},{mac:`Cmd-ArrowRight`,run:Ie,shift:it,preventDefault:!0},{key:`ArrowUp`,run:ke,shift:Xe,preventDefault:!0},{mac:`Cmd-ArrowUp`,run:st,shift:lt},{mac:`Ctrl-ArrowUp`,run:Me,shift:$e},{key:`ArrowDown`,run:Ae,shift:Ze,preventDefault:!0},{mac:`Cmd-ArrowDown`,run:ct,shift:ut},{mac:`Ctrl-ArrowDown`,run:K,shift:et},{key:`PageUp`,run:Me,shift:$e},{key:`PageDown`,run:K,shift:et},{key:`Home`,run:Pe,shift:nt,preventDefault:!0},{key:`Mod-Home`,run:st,shift:lt},{key:`End`,run:Ne,shift:tt,preventDefault:!0},{key:`Mod-End`,run:ct,shift:ut},{key:`Enter`,run:It,shift:It},{key:`Mod-a`,run:dt},{key:`Backspace`,run:Z,shift:Z,preventDefault:!0},{key:`Delete`,run:yt,preventDefault:!0},{key:`Mod-Backspace`,mac:`Alt-Backspace`,run:xt,preventDefault:!0},{key:`Mod-Delete`,mac:`Alt-Delete`,run:St,preventDefault:!0},{mac:`Mod-Backspace`,run:wt,preventDefault:!0},{mac:`Mod-Delete`,run:Tt,preventDefault:!0}].concat(Ut.map(e=>({mac:e.key,run:e.run,shift:e.shift}))),Gt=[{key:`Alt-ArrowLeft`,mac:`Ctrl-ArrowLeft`,run:Ee,shift:qe},{key:`Alt-ArrowRight`,mac:`Ctrl-ArrowRight`,run:De,shift:Je},{key:`Alt-ArrowUp`,run:kt},{key:`Shift-Alt-ArrowUp`,run:Mt},{key:`Alt-ArrowDown`,run:At},{key:`Shift-Alt-ArrowDown`,run:Nt},{key:`Mod-Alt-ArrowUp`,run:ht},{key:`Mod-Alt-ArrowDown`,run:gt},{key:`Escape`,run:_t},{key:`Mod-Enter`,run:Lt},{key:`Alt-l`,mac:`Ctrl-l`,run:ft},{key:`Mod-i`,run:pt,preventDefault:!0},{key:`Mod-[`,run:Vt},{key:`Mod-]`,run:Bt},{key:`Mod-Alt-\\`,run:zt},{key:`Shift-Mod-k`,run:Pt},{key:`Shift-Mod-\\`,run:Be},{key:`Mod-/`,run:te},{key:`Alt-A`,mac:`Ctrl-A`,run:re},{key:`Ctrl-m`,mac:`Shift-Alt-m`,run:Ht}].concat(Wt);export{Bt as a,Vt as i,fe as n,Se as r,Gt as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Xn as e}from"./ui-CwFQAfE-.js";var t={name:`eye`,size:24,node:[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};t.node;var n=e(t);export{n as t};
|