@invariant.guru/cli 0.8.1 → 0.8.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/README.md +18 -1
- package/dist/main.js +829 -792
- package/dist/ui/assets/{Editor-0hQt3BGG.js → Editor-Cmu6OATc.js} +2 -2
- package/dist/ui/assets/LoopGraph-DHwsLYLI.js +7 -0
- package/dist/ui/assets/LoopGraph-DLioOiRN.css +1 -0
- package/dist/ui/assets/{MarkdownBody-BZDzSb5s.js → MarkdownBody-D1FGeowJ.js} +4 -4
- package/dist/ui/assets/{Preview-DDmkokv0.js → Preview-GmEy6X9-.js} +1 -1
- package/dist/ui/assets/index-BPjCUrMm.js +262 -0
- package/dist/ui/assets/index-BX0KjLJ0.css +1 -0
- package/dist/ui/index.html +2 -2
- package/package.json +4 -1
- package/dist/ui/assets/index-CviOvvQi.js +0 -260
- package/dist/ui/assets/index-DJDYH97C.css +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,
|
|
1
|
+
import{n as e,p as t,s as n,t as r,u as i}from"./index-BPjCUrMm.js";var a=t(i()),o=[],s=[];(()=>{let e=`lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o`.split(`,`).map(e=>e?parseInt(e,36):1);for(let t=0,n=0;t<e.length;t++)(t%2?s:o).push(n+=e[t])})();function c(e){if(e<768)return!1;for(let t=0,n=o.length;;){let r=t+n>>1;if(e<o[r])n=r;else if(e>=s[r])t=r+1;else return!0;if(t==n)return!1}}function l(e){return e>=127462&&e<=127487}var u=8205;function d(e,t,n=!0,r=!0){return(n?f:p)(e,t,r)}function f(e,t,n){if(t==e.length)return t;t&&h(e.charCodeAt(t))&&g(e.charCodeAt(t-1))&&t--;let r=m(e,t);for(t+=_(r);t<e.length;){let i=m(e,t);if(r==u||i==u||n&&c(i))t+=_(i),r=i;else if(l(i)){let n=0,r=t-2;for(;r>=0&&l(m(e,r));)n++,r-=2;if(n%2==0)break;t+=2}else break}return t}function p(e,t,n){for(;t>1;){let r=f(e,t-2,n);if(r<t)return r;t--}return 0}function m(e,t){let n=e.charCodeAt(t);if(!g(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return h(r)?(n-55296<<10)+(r-56320)+65536:n}function h(e){return e>=56320&&e<57344}function g(e){return e>=55296&&e<56320}function _(e){return e<65536?1:2}var v=class e{lineAt(e){if(e<0||e>this.length)throw RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,n){[e,t]=se(this,e,t);let r=[];return this.decompose(0,e,r,2),n.length&&n.decompose(0,n.length,r,3),this.decompose(t,this.length,r,1),ee.from(r,this.length-(t-e)+n.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=se(this,e,t);let n=[];return this.decompose(e,t,n,0),ee.from(n,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),n=this.length-this.scanIdentical(e,-1),r=new re(this),i=new re(e);for(let e=t,a=t;;){if(r.next(e),i.next(e),e=0,r.lineBreak!=i.lineBreak||r.done!=i.done||r.value!=i.value)return!1;if(a+=r.value.length,r.done||a>=n)return!0}}iter(e=1){return new re(this,e)}iterRange(e,t=this.length){return new ie(this,e,t)}iterLines(e,t){let n;if(e==null)n=this.iter();else{t??=this.lines+1;let r=this.line(e).from;n=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new ae(n)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(t){if(t.length==0)throw RangeError(`A document must have at least one line`);return t.length==1&&!t[0]?e.empty:t.length<=32?new y(t):ee.from(y.split(t,[]))}},y=class e extends v{constructor(e,t=te(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.text[i],o=r+a.length;if((t?n:o)>=e)return new oe(r,o,n,a);r=o+1,n++}}decompose(t,n,r,i){let a=t<=0&&n>=this.length?this:new e(ne(this.text,t,n),Math.min(n,this.length)-Math.max(0,t));if(i&1){let t=r.pop(),n=b(a.text,t.text.slice(),0,a.length);if(n.length<=32)r.push(new e(n,t.length+a.length));else{let t=n.length>>1;r.push(new e(n.slice(0,t)),new e(n.slice(t)))}}else r.push(a)}replace(t,n,r){if(!(r instanceof e))return super.replace(t,n,r);[t,n]=se(this,t,n);let i=b(this.text,b(r.text,ne(this.text,0,t)),n),a=this.length+r.length-(n-t);return i.length<=32?new e(i,a):ee.from(e.split(i,[]),a)}sliceString(e,t=this.length,n=`
|
|
2
2
|
`){[e,t]=se(this,e,t);let r=``;for(let i=0,a=0;i<=t&&a<this.text.length;a++){let o=this.text[a],s=i+o.length;i>e&&a&&(r+=n),e<s&&t>i&&(r+=o.slice(Math.max(0,e-i),t-i)),i=s+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(t,n){let r=[],i=-1;for(let a of t)r.push(a),i+=a.length+1,r.length==32&&(n.push(new e(r,i)),r=[],i=-1);return i>-1&&n.push(new e(r,i)),n}},ee=class e extends v{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let t of e)this.lines+=t.lines}lineInner(e,t,n,r){for(let i=0;;i++){let a=this.children[i],o=r+a.length,s=n+a.lines-1;if((t?s:o)>=e)return a.lineInner(e,t,n,r);r=o+1,n=s+1}}decompose(e,t,n,r){for(let i=0,a=0;a<=t&&i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(e<=s&&t>=a){let i=r&(a<=e|(s>=t?2:0));a>=e&&s<=t&&!i?n.push(o):o.decompose(e-a,t-a,n,i)}a=s+1}}replace(t,n,r){if([t,n]=se(this,t,n),r.lines<this.lines)for(let i=0,a=0;i<this.children.length;i++){let o=this.children[i],s=a+o.length;if(t>=a&&n<=s){let c=o.replace(t-a,n-a,r),l=this.lines-o.lines+c.lines;if(c.lines<l>>4&&c.lines>l>>6){let a=this.children.slice();return a[i]=c,new e(a,this.length-(n-t)+r.length)}return super.replace(a,s,c)}a=s+1}return super.replace(t,n,r)}sliceString(e,t=this.length,n=`
|
|
3
3
|
`){[e,t]=se(this,e,t);let r=``;for(let i=0,a=0;i<this.children.length&&a<=t;i++){let o=this.children[i],s=a+o.length;a>e&&i&&(r+=n),e<s&&t>a&&(r+=o.sliceString(e-a,t-a,n)),a=s+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(t,n){if(!(t instanceof e))return 0;let r=0,[i,a,o,s]=n>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;i+=n,a+=n){if(i==o||a==s)return r;let e=this.children[i],c=t.children[a];if(e!=c)return r+e.scanIdentical(c,n);r+=e.length+1}}static from(t,n=t.reduce((e,t)=>e+t.length+1,-1)){let r=0;for(let e of t)r+=e.lines;if(r<32){let e=[];for(let n of t)n.flatten(e);return new y(e,n)}let i=Math.max(32,r>>5),a=i<<1,o=i>>1,s=[],c=0,l=-1,u=[];function d(t){let n;if(t.lines>a&&t instanceof e)for(let e of t.children)d(e);else t.lines>o&&(c>o||!c)?(f(),s.push(t)):t instanceof y&&c&&(n=u[u.length-1])instanceof y&&t.lines+n.lines<=32?(c+=t.lines,l+=t.length+1,u[u.length-1]=new y(n.text.concat(t.text),n.length+1+t.length)):(c+t.lines>i&&f(),c+=t.lines,l+=t.length+1,u.push(t))}function f(){c!=0&&(s.push(u.length==1?u[0]:e.from(u,l)),l=-1,c=u.length=0)}for(let e of t)d(e);return f(),s.length==1?s[0]:new e(s,n)}};v.empty=new y([``],0);function te(e){let t=-1;for(let n of e)t+=n.length+1;return t}function b(e,t,n=0,r=1e9){for(let i=0,a=0,o=!0;a<e.length&&i<=r;a++){let s=e[a],c=i+s.length;c>=n&&(c>r&&(s=s.slice(0,r-i)),i<n&&(s=s.slice(n-i)),o?(t[t.length-1]+=s,o=!1):t.push(s)),i=c+1}return t}function ne(e,t,n){return b(e,[``],t,n)}var re=class{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value=``,this.nodes=[e],this.offsets=[t>0?1:(e instanceof y?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let n=this.nodes.length-1,r=this.nodes[n],i=this.offsets[n],a=i>>1,o=r instanceof y?r.text.length:r.children.length;if(a==(t>0?o:0)){if(n==0)return this.done=!0,this.value=``,this;t>0&&this.offsets[n-1]++,this.nodes.pop(),this.offsets.pop()}else if((i&1)==(t>0?0:1)){if(this.offsets[n]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
4
4
|
`,this;e--}else if(r instanceof y){let i=r.text[a+(t<0?-1:0)];if(this.offsets[n]+=t,i.length>Math.max(0,e))return this.value=e==0?i:t>0?i.slice(e):i.slice(0,i.length-e),this;e-=i.length}else{let i=r.children[a+(t<0?-1:0)];e>i.length?(e-=i.length,this.offsets[n]+=t):(t<0&&this.offsets[n]--,this.nodes.push(i),this.offsets.push(t>0?1:(i instanceof y?i.text.length:i.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},ie=class{constructor(e,t,n){this.value=``,this.done=!1,this.cursor=new re(e,t>n?-1:1),this.pos=t>n?e.length:0,this.from=Math.min(t,n),this.to=Math.max(t,n)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value=``,this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let n=t<0?this.pos-this.from:this.to-this.pos;e>n&&(e=n),n-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=n?r:t<0?r.slice(r.length-n):r.slice(0,n),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=``}},ae=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value=``,this.done=!1}next(e=0){let{done:t,lineBreak:n,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value=``,this.afterBreak=!1):t?(this.done=!0,this.value=``):n?this.afterBreak?this.value=``:(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<`u`&&(v.prototype[Symbol.iterator]=function(){return this.iter()},re.prototype[Symbol.iterator]=ie.prototype[Symbol.iterator]=ae.prototype[Symbol.iterator]=function(){return this});var oe=class{constructor(e,t,n,r){this.from=e,this.to=t,this.number=n,this.text=r}get length(){return this.to-this.from}};function se(e,t,n){return t=Math.max(0,Math.min(e.length,t)),[t,Math.max(t,Math.min(e.length,n))]}function x(e,t,n=!0,r=!0){return d(e,t,n,r)}function ce(e){return e>=56320&&e<57344}function le(e){return e>=55296&&e<56320}function ue(e,t){let n=e.charCodeAt(t);if(!le(n)||t+1==e.length)return n;let r=e.charCodeAt(t+1);return ce(r)?(n-55296<<10)+(r-56320)+65536:n}function de(e){return e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode((e>>10)+55296,(e&1023)+56320))}function fe(e){return e<65536?1:2}var pe=/\r\n?|\n/,me=(function(e){return e[e.Simple=0]=`Simple`,e[e.TrackDel=1]=`TrackDel`,e[e.TrackBefore=2]=`TrackBefore`,e[e.TrackAfter=3]=`TrackAfter`,e})(me||={}),he=class e{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t+1];e+=n<0?this.sections[t]:n}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,n=0,r=0;t<this.sections.length;){let i=this.sections[t++],a=this.sections[t++];a<0?(e(n,r,i),r+=i):r+=a,n+=i}}iterChangedRanges(e,t=!1){ve(this,e,t)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let n=this.sections[e++],r=this.sections[e++];r<0?t.push(n,r):t.push(r,n)}return new e(t)}composeDesc(e){return this.empty?e:e.empty?this:be(this,e)}mapDesc(e,t=!1){return e.empty?this:ye(this,e,t)}mapPos(e,t=-1,n=me.Simple){let r=0,i=0;for(let a=0;a<this.sections.length;){let o=this.sections[a++],s=this.sections[a++],c=r+o;if(s<0){if(c>e)return i+(e-r);i+=o}else{if(n!=me.Simple&&c>=e&&(n==me.TrackDel&&r<e&&c>e||n==me.TrackBefore&&r<e||n==me.TrackAfter&&c>e))return null;if(c>e||c==e&&t<0&&!o)return e==r||t<0?i:i+s;i+=s}r=c}if(e>r)throw RangeError(`Position ${e} is out of range for changeset of length ${r}`);return i}touchesRange(e,t=e){for(let n=0,r=0;n<this.sections.length&&r<=t;){let i=this.sections[n++],a=this.sections[n++],o=r+i;if(a>=0&&r<=t&&o>=e)return r<e&&o>t?`cover`:!0;r=o}return!1}toString(){let e=``;for(let t=0;t<this.sections.length;){let n=this.sections[t++],r=this.sections[t++];e+=(e?` `:``)+n+(r>=0?`:`+r:``)}return e}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!=`number`))throw RangeError(`Invalid JSON representation of ChangeDesc`);return new e(t)}static create(t){return new e(t)}},ge=class e extends he{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw RangeError(`Applying change set to a document with the wrong length`);return ve(this,(t,n,r,i,a)=>e=e.replace(r,r+(n-t),a),!1),e}mapDesc(e,t=!1){return ye(this,e,t,!0)}invert(t){let n=this.sections.slice(),r=[];for(let e=0,i=0;e<n.length;e+=2){let a=n[e],o=n[e+1];if(o>=0){n[e]=o,n[e+1]=a;let s=e>>1;for(;r.length<s;)r.push(v.empty);r.push(a?t.slice(i,i+a):v.empty)}i+=a}return new e(n,r)}compose(e){return this.empty?e:e.empty?this:be(this,e,!0)}map(e,t=!1){return e.empty?this:ye(this,e,t,!0)}iterChanges(e,t=!1){ve(this,e,t)}get desc(){return he.create(this.sections)}filter(t){let n=[],r=[],i=[],a=new xe(this);done:for(let e=0,o=0;;){let s=e==t.length?1e9:t[e++];for(;o<s||o==s&&a.len==0;){if(a.done)break done;let e=Math.min(a.len,s-o);S(i,e,-1);let t=a.ins==-1?-1:a.off==0?a.ins:0;S(n,e,t),t>0&&_e(r,n,a.text),a.forward(e),o+=e}let c=t[e++];for(;o<c;){if(a.done)break done;let e=Math.min(a.len,c-o);S(n,e,-1),S(i,e,a.ins==-1?-1:a.off==0?a.ins:0),a.forward(e),o+=e}}return{changes:new e(n,r),filtered:he.create(i)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let n=this.sections[t],r=this.sections[t+1];r<0?e.push(n):r==0?e.push([n]):e.push([n].concat(this.inserted[t>>1].toJSON()))}return e}static of(t,n,r){let i=[],a=[],o=0,s=null;function c(t=!1){if(!t&&!i.length)return;o<n&&S(i,n-o,-1);let r=new e(i,a);s=s?s.compose(r.map(s)):r,i=[],a=[],o=0}function l(t){if(Array.isArray(t))for(let e of t)l(e);else if(t instanceof e){if(t.length!=n)throw RangeError(`Mismatched change set length (got ${t.length}, expected ${n})`);c(),s=s?s.compose(t.map(s)):t}else{let{from:e,to:s=e,insert:l}=t;if(e>s||e<0||s>n)throw RangeError(`Invalid change range ${e} to ${s} (in doc of length ${n})`);let u=l?typeof l==`string`?v.of(l.split(r||pe)):l:v.empty,d=u.length;if(e==s&&d==0)return;e<o&&c(),e>o&&S(i,e-o,-1),S(i,s-e,d),_e(a,i,u),o=s}}return l(t),c(!s),s}static empty(t){return new e(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw RangeError(`Invalid JSON representation of ChangeSet`);let n=[],r=[];for(let e=0;e<t.length;e++){let i=t[e];if(typeof i==`number`)n.push(i,-1);else if(!Array.isArray(i)||typeof i[0]!=`number`||i.some((e,t)=>t&&typeof e!=`string`))throw RangeError(`Invalid JSON representation of ChangeSet`);else if(i.length==1)n.push(i[0],0);else{for(;r.length<e;)r.push(v.empty);r[e]=v.of(i.slice(1)),n.push(i[0],r[e].length)}}return new e(n,r)}static createSet(t,n){return new e(t,n)}};function S(e,t,n,r=!1){if(t==0&&n<=0)return;let i=e.length-2;i>=0&&n<=0&&n==e[i+1]?e[i]+=t:i>=0&&t==0&&e[i]==0?e[i+1]+=n:r?(e[i]+=t,e[i+1]+=n):e.push(t,n)}function _e(e,t,n){if(n.length==0)return;let r=t.length-2>>1;if(r<e.length)e[e.length-1]=e[e.length-1].append(n);else{for(;e.length<r;)e.push(v.empty);e.push(n)}}function ve(e,t,n){let r=e.inserted;for(let i=0,a=0,o=0;o<e.sections.length;){let s=e.sections[o++],c=e.sections[o++];if(c<0)i+=s,a+=s;else{let l=i,u=a,d=v.empty;for(;l+=s,u+=c,c&&r&&(d=d.append(r[o-2>>1])),!(n||o==e.sections.length||e.sections[o+1]<0);)s=e.sections[o++],c=e.sections[o++];t(i,l,a,u,d),i=l,a=u}}}function ye(e,t,n,r=!1){let i=[],a=r?[]:null,o=new xe(e),s=new xe(t);for(let e=-1;;)if(o.done&&s.len||s.done&&o.len)throw Error(`Mismatched change set lengths`);else if(o.ins==-1&&s.ins==-1){let e=Math.min(o.len,s.len);S(i,e,-1),o.forward(e),s.forward(e)}else if(s.ins>=0&&(o.ins<0||e==o.i||o.off==0&&(s.len<o.len||s.len==o.len&&!n))){let t=s.len;for(S(i,s.ins,-1);t;){let n=Math.min(o.len,t);o.ins>=0&&e<o.i&&o.len<=n&&(S(i,0,o.ins),a&&_e(a,i,o.text),e=o.i),o.forward(n),t-=n}s.next()}else if(o.ins>=0){let t=0,n=o.len;for(;n;)if(s.ins==-1){let e=Math.min(n,s.len);t+=e,n-=e,s.forward(e)}else if(s.ins==0&&s.len<n)n-=s.len,s.next();else break;S(i,t,e<o.i?o.ins:0),a&&e<o.i&&_e(a,i,o.text),e=o.i,o.forward(o.len-n)}else if(o.done&&s.done)return a?ge.createSet(i,a):he.create(i);else throw Error(`Mismatched change set lengths`)}function be(e,t,n=!1){let r=[],i=n?[]:null,a=new xe(e),o=new xe(t);for(let e=!1;;)if(a.done&&o.done)return i?ge.createSet(r,i):he.create(r);else if(a.ins==0)S(r,a.len,0,e),a.next();else if(o.len==0&&!o.done)S(r,0,o.ins,e),i&&_e(i,r,o.text),o.next();else if(a.done||o.done)throw Error(`Mismatched change set lengths`);else{let t=Math.min(a.len2,o.len),n=r.length;if(a.ins==-1){let n=o.ins==-1?-1:o.off?0:o.ins;S(r,t,n,e),i&&n&&_e(i,r,o.text)}else o.ins==-1?(S(r,a.off?0:a.len,t,e),i&&_e(i,r,a.textBit(t))):(S(r,a.off?0:a.len,o.off?0:o.ins,e),i&&!o.off&&_e(i,r,o.text));e=(a.ins>t||o.ins>=0&&o.len>t)&&(e||r.length>n),a.forward2(t),o.forward(t)}}var xe=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?v.empty:e[t]}textBit(e){let{inserted:t}=this.set,n=this.i-2>>1;return n>=t.length&&!e?v.empty:t[n].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},Se=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.flags=n,this.goalColumn=r}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get undirectional(){return(this.flags&64)>0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}map(t,n=-1){let r,i;return this.empty?r=i=t.mapPos(this.from,n):(r=t.mapPos(this.from,1),i=t.mapPos(this.to,-1)),r==this.from&&i==this.to?this:new e(r,i,this.flags,this.goalColumn)}extend(e,t=e,n=0){if(e<=this.anchor&&t>=this.anchor)return C.range(e,t,void 0,void 0,n);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return C.range(this.anchor,r,void 0,void 0,n)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!=`number`||typeof e.head!=`number`)throw RangeError(`Invalid JSON representation for SelectionRange`);return C.range(e.anchor,e.head)}static create(t,n,r,i){return new e(t,n,r,i)}},C=class e{constructor(e,t){this.ranges=e,this.mainIndex=t}map(t,n=-1){return t.empty?this:e.create(this.ranges.map(e=>e.map(t,n)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new e([this.main],0)}addRange(t,n=!0){return e.create([t].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(t,n=this.mainIndex){let r=this.ranges.slice();return r[n]=t,e.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!=`number`||t.main>=t.ranges.length)throw RangeError(`Invalid JSON representation for EditorSelection`);return new e(t.ranges.map(e=>Se.fromJSON(e)),t.main)}static single(t,n=t){return new e([e.range(t,n)],0)}static create(t,n=0){if(t.length==0)throw RangeError(`A selection needs at least one range`);for(let r=0,i=0;i<t.length;i++){let a=t[i];if(a.empty?a.from<=r:a.from<r)return e.normalized(t.slice(),n);r=a.to}return new e(t,n)}static cursor(e,t=0,n,r){return Se.create(e,e,(t==0?0:t<0?8:16)|(n==null?7:Math.min(6,n)),r)}static range(e,t,n,r,i){let a=r==null?7:Math.min(6,r);return!i&&e!=t&&(i=t<e?1:-1),i&&(a|=i<0?8:16),t<e?Se.create(t,e,a|32,n):Se.create(e,t,a,n)}static undirectionalRange(e,t){return Se.create(e,t,64,void 0)}static normalized(t,n=0){let r=t[n];t.sort((e,t)=>e.from-t.from),n=t.indexOf(r);for(let r=1;r<t.length;r++){let i=t[r],a=t[r-1];if(i.empty?i.from<=a.to:i.from<a.to){let o=a.from,s=Math.max(i.to,a.to);r<=n&&n--,t.splice(--r,2,i.anchor>i.head?e.range(s,o):e.range(o,s))}}return new e(t,n)}};function Ce(e,t){for(let n of e.ranges)if(n.to>t)throw RangeError(`Selection points outside of document`)}var we=0,w=class e{constructor(e,t,n,r,i){this.combine=e,this.compareInput=t,this.compare=n,this.isStatic=r,this.id=we++,this.default=e([]),this.extensions=typeof i==`function`?i(this):i}get reader(){return this}static define(t={}){return new e(t.combine||(e=>e),t.compareInput||((e,t)=>e===t),t.compare||(t.combine?(e,t)=>e===t:Te),!!t.static,t.enables)}of(e){return new Ee([],this,0,e)}compute(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new Ee(e,this,1,t)}computeN(e,t){if(this.isStatic)throw Error(`Can't compute a static facet`);return new Ee(e,this,2,t)}from(e,t){return t||=e=>e,this.compute([e],n=>t(n.field(e)))}};function Te(e,t){return e==t||e.length==t.length&&e.every((e,n)=>e===t[n])}var Ee=class{constructor(e,t,n,r){this.dependencies=e,this.facet=t,this.type=n,this.value=r,this.id=we++}dynamicSlot(e){let t=this.value,n=this.facet.compareInput,r=this.id,i=e[r]>>1,a=this.type==2,o=!1,s=!1,c=[];for(let t of this.dependencies)t==`doc`?o=!0:t==`selection`?s=!0:(e[t.id]??1)&1||c.push(e[t.id]);return{create(e){return e.values[i]=t(e),1},update(e,r){if(o&&r.docChanged||s&&(r.docChanged||r.selection)||Oe(e,c)){let r=t(e);if(a?!De(r,e.values[i],n):!n(r,e.values[i]))return e.values[i]=r,1}return 0},reconfigure:(e,o)=>{let s,c=o.config.address[r];if(c!=null){let r=Ve(o,c);if(this.dependencies.every(t=>t instanceof w?o.facet(t)===e.facet(t):t instanceof je?o.field(t,!1)==e.field(t,!1):!0)||(a?De(s=t(e),r,n):n(s=t(e),r)))return e.values[i]=r,0}else s=t(e);return e.values[i]=s,1}}}get extension(){return this}};function De(e,t,n){if(e.length!=t.length)return!1;for(let r=0;r<e.length;r++)if(!n(e[r],t[r]))return!1;return!0}function Oe(e,t){let n=!1;for(let r of t)Be(e,r)&1&&(n=!0);return n}function ke(e,t,n){let r=n.map(t=>e[t.id]),i=n.map(e=>e.type),a=r.filter(e=>!(e&1)),o=e[t.id]>>1;function s(e){let n=[];for(let t=0;t<r.length;t++){let a=Ve(e,r[t]);if(i[t]==2)for(let e of a)n.push(e);else n.push(a)}return t.combine(n)}return{create(e){for(let t of r)Be(e,t);return e.values[o]=s(e),1},update(e,n){if(!Oe(e,a))return 0;let r=s(e);return t.compare(r,e.values[o])?0:(e.values[o]=r,1)},reconfigure(e,i){let a=Oe(e,r),c=i.config.facets[t.id],l=i.facet(t);if(c&&!a&&Te(n,c))return e.values[o]=l,0;let u=s(e);return t.compare(u,l)?(e.values[o]=l,0):(e.values[o]=u,1)}}}var Ae=w.define({static:!0}),je=class e{constructor(e,t,n,r,i){this.id=e,this.createF=t,this.updateF=n,this.compareF=r,this.spec=i,this.provides=void 0}static define(t){let n=new e(we++,t.create,t.update,t.compare||((e,t)=>e===t),t);return t.provide&&(n.provides=t.provide(n)),n}create(e){return(e.facet(Ae).find(e=>e.field==this)?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:e=>(e.values[t]=this.create(e),1),update:(e,n)=>{let r=e.values[t],i=this.updateF(r,n);return this.compareF(r,i)?0:(e.values[t]=i,1)},reconfigure:(e,n)=>{let r=e.facet(Ae),i=n.facet(Ae),a;return(a=r.find(e=>e.field==this))&&a!=i.find(e=>e.field==this)?(e.values[t]=a.create(e),1):n.config.address[this.id]==null?(e.values[t]=this.create(e),1):(e.values[t]=n.field(this),0)}}}init(e){return[this,Ae.of({field:this,create:e})]}get extension(){return this}},Me={lowest:4,low:3,default:2,high:1,highest:0};function Ne(e){return t=>new Fe(t,e)}var Pe={highest:Ne(Me.highest),high:Ne(Me.high),default:Ne(Me.default),low:Ne(Me.low),lowest:Ne(Me.lowest)},Fe=class{constructor(e,t){this.inner=e,this.prec=t}get extension(){return this}},Ie=class e{of(e){return new Le(this,e)}reconfigure(t){return e.reconfigure.of({compartment:this,extension:t})}get(e){return e.config.compartments.get(this)}},Le=class{constructor(e,t){this.compartment=e,this.inner=t}get extension(){return this}},Re=class e{constructor(e,t,n,r,i,a){for(this.base=e,this.compartments=t,this.dynamicSlots=n,this.address=r,this.staticValues=i,this.facets=a,this.statusTemplate=[];this.statusTemplate.length<n.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(t,n,r){let i=[],a=Object.create(null),o=new Map;for(let e of ze(t,n,o))e instanceof je?i.push(e):(a[e.facet.id]||(a[e.facet.id]=[])).push(e);let s=Object.create(null),c=[],l=[];for(let e of i)s[e.id]=l.length<<1,l.push(t=>e.slot(t));let u=r?.config.facets;for(let e in a){let t=a[e],n=t[0].facet,i=u&&u[e]||[];if(t.every(e=>e.type==0)){if(s[n.id]=c.length<<1|1,Te(i,t))c.push(r.facet(n));else{let e=n.combine(t.map(e=>e.value));c.push(r&&n.compare(e,r.facet(n))?r.facet(n):e)}}else{for(let e of t)e.type==0?(s[e.id]=c.length<<1|1,c.push(e.value)):(s[e.id]=l.length<<1,l.push(t=>e.dynamicSlot(t)));s[n.id]=l.length<<1,l.push(e=>ke(e,n,t))}}let d=l.map(e=>e(s));return new e(t,o,d,s,c,a)}};function ze(e,t,n){let r=[[],[],[],[],[]],i=new Map;function a(e,o){let s=i.get(e);if(s!=null){if(s<=o)return;let t=r[s].indexOf(e);t>-1&&r[s].splice(t,1),e instanceof Le&&n.delete(e.compartment)}if(i.set(e,o),Array.isArray(e))for(let t of e)a(t,o);else if(e instanceof Le){if(n.has(e.compartment))throw RangeError(`Duplicate use of compartment in extensions`);let r=t.get(e.compartment)||e.inner;n.set(e.compartment,r),a(r,o)}else if(e instanceof Fe)a(e.inner,e.prec);else if(e instanceof je)r[o].push(e),e.provides&&a(e.provides,o);else if(e instanceof Ee)r[o].push(e),e.facet.extensions&&a(e.facet.extensions,Me.default);else{let t=e.extension;if(!t)throw Error(`Unrecognized extension value in extension set (${e}).`);if(t==e)throw Error(`Unrecognized extension value in extension set (${e}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);a(t,o)}}return a(e,Me.default),r.reduce((e,t)=>e.concat(t))}function Be(e,t){if(t&1)return 2;let n=t>>1,r=e.status[n];if(r==4)throw Error(`Cyclic dependency between fields and/or facets`);if(r&2)return r;e.status[n]=4;let i=e.computeSlot(e,e.config.dynamicSlots[n]);return e.status[n]=2|i}function Ve(e,t){return t&1?e.config.staticValues[t>>1]:e.values[t>>1]}var He=w.define(),Ue=w.define({combine:e=>e.some(e=>e),static:!0}),We=w.define({combine:e=>e.length?e[0]:void 0,static:!0}),Ge=w.define(),Ke=w.define(),qe=w.define(),Je=w.define({combine:e=>e.length?e[0]:!1}),Ye=class{constructor(e,t){this.type=e,this.value=t}static define(){return new Xe}},Xe=class{of(e){return new Ye(this,e)}},Ze=class{constructor(e){this.map=e}of(e){return new T(this,e)}},T=class e{constructor(e,t){this.type=e,this.value=t}map(t){let n=this.type.map(this.value,t);return n===void 0?void 0:n==this.value?this:new e(this.type,n)}is(e){return this.type==e}static define(e={}){return new Ze(e.map||(e=>e))}static mapEffects(e,t){if(!e.length)return e;let n=[];for(let r of e){let e=r.map(t);e&&n.push(e)}return n}};T.reconfigure=T.define(),T.appendConfig=T.define();var E=class e{constructor(t,n,r,i,a,o){this.startState=t,this.changes=n,this.selection=r,this.effects=i,this.annotations=a,this.scrollIntoView=o,this._doc=null,this._state=null,r&&Ce(r,n.newLength),a.some(t=>t.type==e.time)||(this.annotations=a.concat(e.time.of(Date.now())))}static create(t,n,r,i,a,o){return new e(t,n,r,i,a,o)}get newDoc(){return this._doc||=this.changes.apply(this.startState.doc)}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let n=this.annotation(e.userEvent);return!!(n&&(n==t||n.length>t.length&&n.slice(0,t.length)==t&&n[t.length]==`.`))}};E.time=Ye.define(),E.userEvent=Ye.define(),E.addToHistory=Ye.define(),E.remote=Ye.define();function Qe(e,t){let n=[];for(let r=0,i=0;;){let a,o;if(r<e.length&&(i==t.length||t[i]>=e[r]))a=e[r++],o=e[r++];else if(i<t.length)a=t[i++],o=t[i++];else return n;!n.length||n[n.length-1]<a?n.push(a,o):n[n.length-1]<o&&(n[n.length-1]=o)}}function $e(e,t,n){let r,i,a;return n?(r=t.changes,i=ge.empty(t.changes.length),a=e.changes.compose(t.changes)):(r=t.changes.map(e.changes),i=e.changes.mapDesc(t.changes,!0),a=e.changes.compose(r)),{changes:a,selection:t.selection?t.selection.map(i):e.selection?.map(r),effects:T.mapEffects(e.effects,r).concat(T.mapEffects(t.effects,i)),annotations:e.annotations.length?e.annotations.concat(t.annotations):t.annotations,scrollIntoView:e.scrollIntoView||t.scrollIntoView}}function et(e,t,n){let r=t.selection,i=at(t.annotations);return t.userEvent&&(i=i.concat(E.userEvent.of(t.userEvent))),{changes:t.changes instanceof ge?t.changes:ge.of(t.changes||[],n,e.facet(We)),selection:r&&(r instanceof C?r:C.single(r.anchor,r.head)),effects:at(t.effects),annotations:i,scrollIntoView:!!t.scrollIntoView}}function tt(e,t,n){let r=et(e,t.length?t[0]:{},e.doc.length);t.length&&t[0].filter===!1&&(n=!1);for(let i=1;i<t.length;i++){t[i].filter===!1&&(n=!1);let a=!!t[i].sequential;r=$e(r,et(e,t[i],a?r.changes.newLength:e.doc.length),a)}let i=E.create(e,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return rt(n?nt(i):i)}function nt(e){let t=e.startState,n=!0;for(let r of t.facet(Ge)){let t=r(e);if(t===!1){n=!1;break}Array.isArray(t)&&(n=n===!0?t:Qe(n,t))}if(n!==!0){let r,i;if(n===!1)i=e.changes.invertedDesc,r=ge.empty(t.doc.length);else{let t=e.changes.filter(n);r=t.changes,i=t.filtered.mapDesc(t.changes).invertedDesc}e=E.create(t,r,e.selection&&e.selection.map(i),T.mapEffects(e.effects,i),e.annotations,e.scrollIntoView)}let r=t.facet(Ke);for(let n=r.length-1;n>=0;n--){let i=r[n](e);e=i instanceof E?i:Array.isArray(i)&&i.length==1&&i[0]instanceof E?i[0]:tt(t,at(i),!1)}return e}function rt(e){let t=e.startState,n=t.facet(qe),r=e;for(let i=n.length-1;i>=0;i--){let a=n[i](e);a&&Object.keys(a).length&&(r=$e(r,et(t,a,e.changes.newLength),!0))}return r==e?e:E.create(t,e.changes,e.selection,r.effects,r.annotations,r.scrollIntoView)}var it=[];function at(e){return e==null?it:Array.isArray(e)?e:[e]}var D=(function(e){return e[e.Word=0]=`Word`,e[e.Space=1]=`Space`,e[e.Other=2]=`Other`,e})(D||={}),ot=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,st;try{st=RegExp(`[\\p{Alphabetic}\\p{Number}_]`,`u`)}catch{}function ct(e){if(st)return st.test(e);for(let t=0;t<e.length;t++){let n=e[t];if(/\w/.test(n)||n>``&&(n.toUpperCase()!=n.toLowerCase()||ot.test(n)))return!0}return!1}function lt(e){return t=>{if(!/\S/.test(t))return D.Space;if(ct(t))return D.Word;for(let n=0;n<e.length;n++)if(t.indexOf(e[n])>-1)return D.Word;return D.Other}}var O=class e{constructor(e,t,n,r,i,a){this.config=e,this.doc=t,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=i,a&&(a._state=this);for(let e=0;e<this.config.dynamicSlots.length;e++)Be(this,e<<1);this.computeSlot=null}field(e,t=!0){let n=this.config.address[e.id];if(n==null){if(t)throw RangeError(`Field is not present in this state`);return}return Be(this,n),Ve(this,n)}update(...e){return tt(this,e,!0)}applyTransaction(t){let n=this.config,{base:r,compartments:i}=n;for(let e of t.effects)e.is(Ie.reconfigure)?(n&&=(i=new Map,n.compartments.forEach((e,t)=>i.set(t,e)),null),i.set(e.value.compartment,e.value.extension)):e.is(T.reconfigure)?(n=null,r=e.value):e.is(T.appendConfig)&&(n=null,r=at(r).concat(e.value));let a;n?a=t.startState.values.slice():(n=Re.resolve(r,i,this),a=new e(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(e,t)=>t.reconfigure(e,this),null).values);let o=t.startState.facet(Ue)?t.newSelection:t.newSelection.asSingle();new e(n,t.newDoc,o,a,(e,n)=>n.update(e,t),t)}replaceSelection(e){return typeof e==`string`&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:C.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,n=e(t.ranges[0]),r=this.changes(n.changes),i=[n.range],a=at(n.effects);for(let n=1;n<t.ranges.length;n++){let o=e(t.ranges[n]),s=this.changes(o.changes),c=s.map(r);for(let e=0;e<n;e++)i[e]=i[e].map(c);let l=r.mapDesc(s,!0);i.push(o.range.map(l)),r=r.compose(c),a=T.mapEffects(a,c).concat(T.mapEffects(at(o.effects),l))}return{changes:r,selection:C.create(i,t.mainIndex),effects:a}}changes(t=[]){return t instanceof ge?t:ge.of(t,this.doc.length,this.facet(e.lineSeparator))}toText(t){return v.of(t.split(this.facet(e.lineSeparator)||pe))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Be(this,t),Ve(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof je&&this.config.address[r.id]!=null&&(t[n]=r.spec.toJSON(this.field(e[n]),this))}return t}static fromJSON(t,n={},r){if(!t||typeof t.doc!=`string`)throw RangeError(`Invalid JSON representation for EditorState`);let i=[];if(r){for(let e in r)if(Object.prototype.hasOwnProperty.call(t,e)){let n=r[e],a=t[e];i.push(n.init(e=>n.spec.fromJSON(a,e)))}}return e.create({doc:t.doc,selection:C.fromJSON(t.selection),extensions:n.extensions?i.concat([n.extensions]):i})}static create(t={}){let n=Re.resolve(t.extensions||[],new Map),r=t.doc instanceof v?t.doc:v.of((t.doc||``).split(n.staticFacet(e.lineSeparator)||pe)),i=t.selection?t.selection instanceof C?t.selection:C.single(t.selection.anchor,t.selection.head):C.single(0);return Ce(i,r.length),n.staticFacet(Ue)||(i=i.asSingle()),new e(n,r,i,n.dynamicSlots.map(()=>null),(e,t)=>t.create(e),null)}get tabSize(){return this.facet(e.tabSize)}get lineBreak(){return this.facet(e.lineSeparator)||`
|
|
@@ -35,4 +35,4 @@ import{n as e,o as t,s as n,t as r,u as i}from"./index-CviOvvQi.js";var a=i(n())
|
|
|
35
35
|
}`,{label:`interface`,detail:`definition`,type:`keyword`}),X("type ${name} = ${type}",{label:`type`,detail:`definition`,type:`keyword`}),X(`enum \${name} {
|
|
36
36
|
\${}
|
|
37
37
|
}`,{label:`enum`,detail:`definition`,type:`keyword`})]),uv=new lc,dv=new Set([`Script`,`Block`,`FunctionExpression`,`FunctionDeclaration`,`ArrowFunction`,`MethodDeclaration`,`ForStatement`]);function fv(e){return(t,n)=>{let r=t.node.getChild(`VariableDefinition`);return r&&n(r,e),!0}}var pv=[`FunctionDeclaration`],mv={FunctionDeclaration:fv(`function`),ClassDeclaration:fv(`class`),ClassExpression:()=>!0,EnumDeclaration:fv(`constant`),TypeAliasDeclaration:fv(`type`),NamespaceDeclaration:fv(`namespace`),VariableDefinition(e,t){e.matchContext(pv)||t(e,`variable`)},TypeDefinition(e,t){t(e,`type`)},__proto__:null};function hv(e,t){let n=uv.get(t);if(n)return n;let r=[],i=!0;function a(t,n){let i=e.sliceString(t.from,t.to);r.push({label:i,type:n})}return t.cursor(W.IncludeAnonymous).iterate(t=>{if(i)i=!1;else if(t.name){let e=mv[t.name];if(e&&e(t,a)||dv.has(t.name))return!1}else if(t.to-t.from>8192){for(let n of hv(e,t.node))r.push(n);return!1}}),uv.set(t,r),r}var gv=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/,_v=[`TemplateString`,`String`,`RegExp`,`LineComment`,`BlockComment`,`VariableDefinition`,`TypeDefinition`,`Label`,`PropertyDefinition`,`PropertyName`,`PrivatePropertyDefinition`,`PrivatePropertyName`,`JSXText`,`JSXAttributeValue`,`JSXOpenTag`,`JSXCloseTag`,`JSXSelfClosingTag`,`.`,`?.`];function vv(e){let t=J(e.state).resolveInner(e.pos,-1);if(_v.indexOf(t.name)>-1)return null;let n=t.name==`VariableName`||t.to-t.from<20&&gv.test(e.state.sliceDoc(t.from,t.to));if(!n&&!e.explicit)return null;let r=[];for(let n=t;n;n=n.parent)dv.has(n.name)&&(r=r.concat(hv(e.state.doc,n)));return{options:r,from:n?t.from:e.pos,validFor:gv}}var yv=ol.define({name:`javascript`,parser:sv.configure({props:[wl.add({IfStatement:Il({except:/^\s*({|else\b)/}),TryStatement:Il({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:Fl,SwitchBody:e=>{let t=e.textAfter,n=/^\s*\}/.test(t),r=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:r?1:2)*e.unit},Block:Nl({closing:`}`}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":Il({except:/^\s*{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),Bl.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":Vl,BlockComment(e){return{from:e.from+2,to:e.to-2}},JSXElement(e){let t=e.firstChild;if(!t||t.name==`JSXSelfClosingTag`)return null;let n=e.lastChild;return{from:t.to,to:n.type.isError?e.to:n.from}},"JSXSelfClosingTag JSXOpenTag"(e){let t=e.firstChild?.nextSibling,n=e.lastChild;return!t||t.type.isError?null:{from:t.to,to:n.type.isError?e.to:n.from}}})]}),languageData:{closeBrackets:{brackets:[`(`,`[`,`{`,`'`,`"`,"`"]},commentTokens:{line:`//`,block:{open:`/*`,close:`*/`}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:`$`}}),bv={test:e=>/^JSX/.test(e.name),facet:nl({commentTokens:{block:{open:`{/*`,close:`*/}`}}})},xv=yv.configure({dialect:`ts`},`typescript`),Sv=yv.configure({dialect:`jsx`,props:[rl.add(e=>e.isTop?[bv]:void 0)]}),Cv=yv.configure({dialect:`jsx ts`,props:[rl.add(e=>e.isTop?[bv]:void 0)]},`typescript`),wv=e=>({label:e,type:`keyword`}),Tv=`break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield`.split(` `).map(wv),Ev=Tv.concat([`declare`,`implements`,`private`,`protected`,`public`].map(wv));function Dv(e={}){let t=e.jsx?e.typescript?Cv:Sv:e.typescript?xv:yv,n=e.typescript?lv.concat(Ev):cv.concat(Tv);return new gl(t,[yv.data.of({autocomplete:qf(_v,Kf(n))}),yv.data.of({autocomplete:vv}),e.jsx?jv:[]])}function Ov(e){for(;;){if(e.name==`JSXOpenTag`||e.name==`JSXSelfClosingTag`||e.name==`JSXFragmentTag`)return e;if(e.name==`JSXEscape`||!e.parent)return null;e=e.parent}}function kv(e,t,n=e.length){for(let r=t?.firstChild;r;r=r.nextSibling)if(r.name==`JSXIdentifier`||r.name==`JSXBuiltin`||r.name==`JSXNamespacedName`||r.name==`JSXMemberExpression`)return e.sliceString(r.from,Math.min(r.to,n));return``}var Av=typeof navigator==`object`&&/Android\b/.test(navigator.userAgent),jv=V.inputHandler.of((e,t,n,r,i)=>{if((Av?e.composing:e.compositionStarted)||e.state.readOnly||t!=n||r!=`>`&&r!=`/`||!yv.isActiveAt(e.state,t,-1))return!1;let a=i(),{state:o}=a,s=o.changeByRange(e=>{let{head:t}=e,n=J(o).resolveInner(t-1,-1),i;if(n.name==`JSXStartTag`&&(n=n.parent),!(o.doc.sliceString(t-1,t)!=r||n.name==`JSXAttributeValue`&&n.to>t)){if(r==`>`&&n.name==`JSXFragmentTag`)return{range:e,changes:{from:t,insert:`</>`}};if(r==`/`&&n.name==`JSXStartCloseTag`){let e=n.parent,r=e.parent;if(r&&e.from==t-2&&((i=kv(o.doc,r.firstChild,t))||r.firstChild?.name==`JSXFragmentTag`)){let e=`${i}>`;return{range:C.cursor(t+e.length,-1),changes:{from:t,insert:e}}}}else if(r==`>`){let r=Ov(n);if(r&&r.name==`JSXOpenTag`&&!/^\/?>|^<\//.test(o.doc.sliceString(t,t+2))&&(i=kv(o.doc,r,t)))return{range:e,changes:{from:t,insert:`</${i}>`}}}}return{range:e}});return!s.changes.empty&&(e.dispatch([a,o.update(s,{userEvent:`input.complete`,scrollIntoView:!0})]),!0)}),Mv=[`_blank`,`_self`,`_top`,`_parent`],Nv=[`ascii`,`utf-8`,`utf-16`,`latin1`,`latin1`],Pv=[`get`,`post`,`put`,`delete`],Fv=[`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`],Iv=[`true`,`false`],$={},Lv={a:{attrs:{href:null,ping:null,type:null,media:null,target:Mv,hreflang:null}},abbr:$,address:$,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:[`default`,`rect`,`circle`,`poly`]}},article:$,aside:$,audio:{attrs:{src:null,mediagroup:null,crossorigin:[`anonymous`,`use-credentials`],preload:[`none`,`metadata`,`auto`],autoplay:[`autoplay`],loop:[`loop`],controls:[`controls`]}},b:$,base:{attrs:{href:null,target:Mv}},bdi:$,bdo:$,blockquote:{attrs:{cite:null}},body:$,br:$,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:[`autofocus`],disabled:[`autofocus`],formenctype:Fv,formmethod:Pv,formnovalidate:[`novalidate`],formtarget:Mv,type:[`submit`,`reset`,`button`]}},canvas:{attrs:{width:null,height:null}},caption:$,center:$,cite:$,code:$,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:[`command`,`checkbox`,`radio`],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:[`disabled`],checked:[`checked`]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:[`disabled`],multiple:[`multiple`]}},datalist:{attrs:{data:null}},dd:$,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:[`open`]}},dfn:$,div:$,dl:$,dt:$,em:$,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:[`disabled`],form:null,name:null}},figcaption:$,figure:$,footer:$,form:{attrs:{action:null,name:null,"accept-charset":Nv,autocomplete:[`on`,`off`],enctype:Fv,method:Pv,novalidate:[`novalidate`],target:Mv}},h1:$,h2:$,h3:$,h4:$,h5:$,h6:$,head:{children:[`title`,`base`,`link`,`style`,`meta`,`script`,`noscript`,`command`]},header:$,hgroup:$,hr:$,html:{attrs:{manifest:null}},i:$,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:[`allow-top-navigation`,`allow-same-origin`,`allow-forms`,`allow-scripts`],seamless:[`seamless`]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:[`anonymous`,`use-credentials`]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:[`audio/*`,`video/*`,`image/*`],autocomplete:[`on`,`off`],autofocus:[`autofocus`],checked:[`checked`],disabled:[`disabled`],formenctype:Fv,formmethod:Pv,formnovalidate:[`novalidate`],formtarget:Mv,multiple:[`multiple`],readonly:[`readonly`],required:[`required`],type:[`hidden`,`text`,`search`,`tel`,`url`,`email`,`password`,`datetime`,`date`,`month`,`week`,`time`,`datetime-local`,`number`,`range`,`color`,`checkbox`,`radio`,`file`,`submit`,`image`,`reset`,`button`]}},ins:{attrs:{cite:null,datetime:null}},kbd:$,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:[`autofocus`],disabled:[`disabled`],keytype:[`RSA`]}},label:{attrs:{for:null,form:null}},legend:$,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:[`all`,`16x16`,`16x16 32x32`,`16x16 32x32 64x64`]}},map:{attrs:{name:null}},mark:$,menu:{attrs:{label:null,type:[`list`,`context`,`toolbar`]}},meta:{attrs:{content:null,charset:Nv,name:[`viewport`,`application-name`,`author`,`description`,`generator`,`keywords`],"http-equiv":[`content-language`,`content-type`,`default-style`,`refresh`]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:$,noscript:$,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:[`typemustmatch`]}},ol:{attrs:{reversed:[`reversed`],start:null,type:[`1`,`a`,`A`,`i`,`I`]},children:[`li`,`script`,`template`,`ul`,`ol`]},optgroup:{attrs:{disabled:[`disabled`],label:null}},option:{attrs:{disabled:[`disabled`],label:null,selected:[`selected`],value:null}},output:{attrs:{for:null,form:null,name:null}},p:$,param:{attrs:{name:null,value:null}},pre:$,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:$,rt:$,ruby:$,samp:$,script:{attrs:{type:[`text/javascript`],src:null,async:[`async`],defer:[`defer`],charset:Nv}},section:$,select:{attrs:{form:null,name:null,size:null,autofocus:[`autofocus`],disabled:[`disabled`],multiple:[`multiple`]}},slot:{attrs:{name:null}},small:$,source:{attrs:{src:null,type:null,media:null}},span:$,strong:$,style:{attrs:{type:[`text/css`],media:null,scoped:null}},sub:$,summary:$,sup:$,table:$,tbody:$,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:$,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:[`autofocus`],disabled:[`disabled`],readonly:[`readonly`],required:[`required`],wrap:[`soft`,`hard`]}},tfoot:$,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:[`row`,`col`,`rowgroup`,`colgroup`]}},thead:$,time:{attrs:{datetime:null}},title:$,tr:$,track:{attrs:{src:null,label:null,default:null,kind:[`subtitles`,`captions`,`descriptions`,`chapters`,`metadata`],srclang:null}},ul:{children:[`li`,`script`,`template`,`ul`,`ol`]},var:$,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:[`anonymous`,`use-credentials`],preload:[`auto`,`metadata`,`none`],autoplay:[`autoplay`],mediagroup:[`movie`],muted:[`muted`],controls:[`controls`]}},wbr:$},Rv={accesskey:null,class:null,contenteditable:Iv,contextmenu:null,dir:[`ltr`,`rtl`,`auto`],draggable:[`true`,`false`,`auto`],dropzone:[`copy`,`move`,`link`,`string:`,`file:`],hidden:[`hidden`],id:null,inert:[`inert`],itemid:null,itemprop:null,itemref:null,itemscope:[`itemscope`],itemtype:null,lang:[`ar`,`bn`,`de`,`en-GB`,`en-US`,`es`,`fr`,`hi`,`id`,`ja`,`pa`,`pt`,`ru`,`tr`,`zh`],spellcheck:Iv,autocorrect:Iv,autocapitalize:Iv,style:null,tabindex:null,title:null,translate:[`yes`,`no`],rel:[`stylesheet`,`alternate`,`author`,`bookmark`,`help`,`license`,`next`,`nofollow`,`noreferrer`,`prefetch`,`prev`,`search`,`tag`],role:`alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer`.split(` `),"aria-activedescendant":null,"aria-atomic":Iv,"aria-autocomplete":[`inline`,`list`,`both`,`none`],"aria-busy":Iv,"aria-checked":[`true`,`false`,`mixed`,`undefined`],"aria-controls":null,"aria-describedby":null,"aria-disabled":Iv,"aria-dropeffect":null,"aria-expanded":[`true`,`false`,`undefined`],"aria-flowto":null,"aria-grabbed":[`true`,`false`,`undefined`],"aria-haspopup":Iv,"aria-hidden":Iv,"aria-invalid":[`true`,`false`,`grammar`,`spelling`],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":[`off`,`polite`,`assertive`],"aria-multiline":Iv,"aria-multiselectable":Iv,"aria-owns":null,"aria-posinset":null,"aria-pressed":[`true`,`false`,`mixed`,`undefined`],"aria-readonly":Iv,"aria-relevant":null,"aria-required":Iv,"aria-selected":[`true`,`false`,`undefined`],"aria-setsize":null,"aria-sort":[`ascending`,`descending`,`none`,`other`],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null},zv=`beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload`.split(` `).map(e=>`on`+e);for(let e of zv)Rv[e]=null;var Bv=class{constructor(e,t){this.tags={...Lv,...e},this.globalAttrs={...Rv,...t},this.allTags=Object.keys(this.tags),this.globalAttrNames=Object.keys(this.globalAttrs)}};Bv.default=new Bv;function Vv(e,t,n=e.length){if(!t)return``;let r=t.firstChild,i=r&&r.getChild(`TagName`);return i?e.sliceString(i.from,Math.min(i.to,n)):``}function Hv(e,t=!1){for(;e;e=e.parent)if(e.name==`Element`){if(t)t=!1;else return e}return null}function Uv(e,t,n){return n.tags[Vv(e,Hv(t))]?.children||n.allTags}function Wv(e,t){let n=[];for(let r=Hv(t);r&&!r.type.isTop;r=Hv(r.parent)){let i=Vv(e,r);if(i&&r.lastChild.name==`CloseTag`)break;i&&n.indexOf(i)<0&&(t.name==`EndTag`||t.from>=r.firstChild.to)&&n.push(i)}return n}var Gv=/^[:\-\.\w\u00b7-\uffff]*$/;function Kv(e,t,n,r,i){let a=/\s*>/.test(e.sliceDoc(i,i+5))?``:`>`,o=Hv(n,n.name==`StartTag`||n.name==`TagName`);return{from:r,to:i,options:Uv(e.doc,o,t).map(e=>({label:e,type:`type`})).concat(Wv(e.doc,n).map((e,t)=>({label:`/`+e,apply:`/`+e+a,type:`type`,boost:99-t}))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function qv(e,t,n,r){let i=/\s*>/.test(e.sliceDoc(r,r+5))?``:`>`;return{from:n,to:r,options:Wv(e.doc,t).map((e,t)=>({label:e,apply:e+i,type:`type`,boost:99-t})),validFor:Gv}}function Jv(e,t,n,r){let i=[],a=0;for(let r of Uv(e.doc,n,t))i.push({label:`<`+r,type:`type`});for(let t of Wv(e.doc,n))i.push({label:`</`+t+`>`,type:`type`,boost:99-a++});return{from:r,to:r,options:i,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function Yv(e,t,n,r,i){let a=Hv(n),o=a?t.tags[Vv(e.doc,a)]:null,s=o&&o.attrs?Object.keys(o.attrs):[];return{from:r,to:i,options:(o&&o.globalAttrs===!1?s:s.length?s.concat(t.globalAttrNames):t.globalAttrNames).map(e=>({label:e,type:`property`})),validFor:Gv}}function Xv(e,t,n,r,i){let a=n.parent?.getChild(`AttributeName`),o=[],s;if(a){let c=e.sliceDoc(a.from,a.to),l=t.globalAttrs[c];if(!l){let r=Hv(n),i=r?t.tags[Vv(e.doc,r)]:null;l=i?.attrs&&i.attrs[c]}if(l){let t=e.sliceDoc(r,i).toLowerCase(),n=`"`,a=`"`;/^['"]/.test(t)?(s=t[0]==`"`?/^[^"]*$/:/^[^']*$/,n=``,a=e.sliceDoc(i,i+1)==t[0]?``:t[0],t=t.slice(1),r++):s=/^[^\s<>='"]*$/;for(let e of l)o.push({label:e,apply:n+e+a,type:`constant`})}}return{from:r,to:i,options:o,validFor:s}}function Zv(e,t){let{state:n,pos:r}=t,i=J(n).resolveInner(r,-1),a=i.resolve(r);for(let e=r,t;a==i&&(t=i.childBefore(e));){let n=t.lastChild;if(!n||!n.type.isError||n.from<n.to)break;a=i=t,e=n.from}return i.name==`TagName`?i.parent&&/CloseTag$/.test(i.parent.name)?qv(n,i,i.from,r):Kv(n,e,i,i.from,r):i.name==`StartTag`||i.name==`IncompleteTag`?Kv(n,e,i,r,r):i.name==`StartCloseTag`||i.name==`IncompleteCloseTag`?qv(n,i,r,r):i.name==`OpenTag`||i.name==`SelfClosingTag`||i.name==`AttributeName`?Yv(n,e,i,i.name==`AttributeName`?i.from:r,r):i.name==`Is`||i.name==`AttributeValue`||i.name==`UnquotedAttributeValue`?Xv(n,e,i,i.name==`Is`?r:i.from,r):t.explicit&&(a.name==`Element`||a.name==`Text`||a.name==`Document`)?Jv(n,e,i,r):null}function Qv(e){return Zv(Bv.default,e)}function $v(e){let{extraTags:t,extraGlobalAttributes:n}=e,r=n||t?new Bv(t,n):Bv.default;return e=>Zv(r,e)}var ey=yv.parser.configure({top:`SingleExpression`}),ty=[{tag:`script`,attrs:e=>e.type==`text/typescript`||e.lang==`ts`,parser:xv.parser},{tag:`script`,attrs:e=>e.type==`text/babel`||e.type==`text/jsx`,parser:Sv.parser},{tag:`script`,attrs:e=>e.type==`text/typescript-jsx`,parser:Cv.parser},{tag:`script`,attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:ey},{tag:`script`,attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:yv.parser},{tag:`style`,attrs(e){return(!e.lang||e.lang==`css`)&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:w_.parser}],ny=[{name:`style`,parser:w_.parser.configure({top:`Styles`})}].concat(zv.map(e=>({name:e,parser:yv.parser}))),ry=ol.define({name:`html`,parser:Cg.configure({props:[wl.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let t=null,n;for(let n=e.node;;){let e=n.lastChild;if(!e||e.name!=`Element`||e.to!=n.to)break;t=n=e}return t&&!((n=t.lastChild)&&(n.name==`CloseTag`||n.name==`SelfClosingTag`))?e.lineIndent(t.from)+e.unit:null}}),Bl.add({Element(e){let t=e.firstChild,n=e.lastChild;return!t||t.name!=`OpenTag`?null:{from:t.to,to:n.name==`CloseTag`?n.from:e.to}}}),au.add({"OpenTag CloseTag":e=>e.getChild(`TagName`)})]}),languageData:{commentTokens:{block:{open:`<!--`,close:`-->`}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:`-_`}}),iy=ry.configure({wrap:Dg(ty,ny)});function ay(e={}){let t=``,n;return e.matchClosingTags===!1&&(t=`noMatch`),e.selfClosingTags===!0&&(t=(t?t+` `:``)+`selfClosing`),(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(n=Dg((e.nestedLanguages||[]).concat(ty),(e.nestedAttributes||[]).concat(ny))),new gl(n?ry.configure({wrap:n,dialect:t}):t?iy.configure({dialect:t}):iy,[iy.data.of({autocomplete:$v(e)}),e.autoCloseTags===!1?[]:cy,Dv().support,T_().support])}var oy=new Set(`area base br col command embed frame hr img input keygen link meta param source track wbr menuitem`.split(` `));function sy(e,t,n){for(;;){if(t.lastChild?.name!=`CloseTag`)return!1;let r=t.parent;if(!r||Vv(e,r)!=n)return!0;t=r}}var cy=V.inputHandler.of((e,t,n,r,i)=>{if(e.composing||e.state.readOnly||t!=n||r!=`>`&&r!=`/`||!iy.isActiveAt(e.state,t,-1))return!1;let a=i(),{state:o}=a,s=o.changeByRange(e=>{let t=o.doc.sliceString(e.from-1,e.to)==r,{head:n}=e,i=J(o).resolveInner(n,-1),a;if(t&&r==`>`&&i.name==`EndTag`){let t=i.parent;if((a=Vv(o.doc,t.parent,n))&&!oy.has(a)&&!sy(o.doc,t.parent,a))return{range:e,changes:{from:n,to:n+ +(o.doc.sliceString(n,n+1)===`>`),insert:`</${a}>`}}}else if(t&&r==`/`&&i.name==`IncompleteCloseTag`){let e=i.parent;if(i.from==n-2&&e.lastChild?.name!=`CloseTag`&&(a=Vv(o.doc,e,n))&&!oy.has(a)){let e=n+ +(o.doc.sliceString(n,n+1)===`>`),t=`${a}>`;return{range:C.cursor(n+t.length,-1),changes:{from:n,to:e,insert:t}}}}return{range:e}});return!s.changes.empty&&(e.dispatch([a,o.update(s,{userEvent:`input.complete`,scrollIntoView:!0})]),!0)}),ly=nl({commentTokens:{block:{open:`<!--`,close:`-->`}}}),uy=new H,dy=ym.configure({props:[Bl.add(e=>!e.is(`Block`)||e.is(`Document`)||fy(e)!=null||py(e)?void 0:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})),uy.add(fy),wl.add({Document:()=>null}),tl.add({Document:ly})]});function fy(e){let t=/^(?:ATX|Setext)Heading(\d)$/.exec(e.name);return t?+t[1]:void 0}function py(e){return e.name==`OrderedList`||e.name==`BulletList`}function my(e,t){let n=e;for(;;){let e=n.nextSibling,r;if(!e||(r=fy(e.type))!=null&&r<=t)break;n=e}return n.to}var hy=zl.of((e,t,n)=>{for(let r=J(e).resolveInner(n,-1);r&&!(r.from<t);r=r.parent){let e=r.type.prop(uy);if(e==null)continue;let t=my(r,e);if(t>n)return{from:n,to:t}}return null});function gy(e){return new il(ly,e,[],`markdown`)}var _y=gy(dy),vy=gy(dy.configure([zm,Hm,Vm,Um,{props:[Bl.add({Table:(e,t)=>({from:t.doc.lineAt(e.from).to,to:e.to})})]}]));function yy(e,t){return n=>{if(n&&e){let t=null;if(n=/\S*/.exec(n)[0],t=typeof e==`function`?e(n):_l.matchLanguageName(e,n,!0),t instanceof _l)return t.support?t.support.language.parser:ll.getSkippingParser(t.load());if(t)return t.parser}return t?t.parser:null}}var by=class{constructor(e,t,n,r,i,a,o){this.node=e,this.from=t,this.to=n,this.spaceBefore=r,this.spaceAfter=i,this.type=a,this.item=o}blank(e,t=!0){let n=this.spaceBefore+(this.node.name==`Blockquote`?`>`:``);if(e!=null){for(;n.length<e;)n+=` `;return n}for(let e=this.to-this.from-n.length-this.spaceAfter.length;e>0;e--)n+=` `;return n+(t?this.spaceAfter:``)}marker(e,t){let n=this.node.name==`OrderedList`?String(+Sy(this.item,e)[2]+t):``;return this.spaceBefore+n+this.type+this.spaceAfter}};function xy(e,t){let n=[],r=[];for(let t=e;t;t=t.parent){if(t.name==`FencedCode`)return r;(t.name==`ListItem`||t.name==`Blockquote`)&&n.push(t)}for(let e=n.length-1;e>=0;e--){let i=n[e],a,o=t.lineAt(i.from),s=i.from-o.from;if(i.name==`Blockquote`&&(a=/^ *>( ?)/.exec(o.text.slice(s))))r.push(new by(i,s,s+a[0].length,``,a[1],`>`,null));else if(i.name==`ListItem`&&i.parent.name==`OrderedList`&&(a=/^( *)\d+([.)])( *)/.exec(o.text.slice(s)))){let e=a[3],t=a[0].length;e.length>=4&&(e=e.slice(0,e.length-4),t-=4),r.push(new by(i.parent,s,s+t,a[1],e,a[2],i))}else if(i.name==`ListItem`&&i.parent.name==`BulletList`&&(a=/^( *)([-+*])( {1,4}\[[ xX]\])?( +)/.exec(o.text.slice(s)))){let e=a[4],t=a[0].length;e.length>4&&(e=e.slice(0,e.length-4),t-=4);let n=a[2];a[3]&&(n+=a[3].replace(/[xX]/,` `)),r.push(new by(i.parent,s,s+t,a[1],e,n,i))}}return r}function Sy(e,t){return/^(\s*)(\d+)(?=[.)])/.exec(t.sliceString(e.from,e.from+10))}function Cy(e,t,n,r=0){for(let i=-1,a=e;;){if(a.name==`ListItem`){let e=Sy(a,t),o=+e[2];if(i>=0){if(o!=i+1)return;n.push({from:a.from+e[1].length,to:a.from+e[0].length,insert:String(i+2+r)})}i=o}let e=a.nextSibling;if(!e)break;a=e}}function wy(e,t){let n=/^[ \t]*/.exec(e)[0].length;if(!n||t.facet(yl)!=` `)return e;let r=Ot(e,4,n),i=``;for(let e=r;e>0;)e>=4?(i+=` `,e-=4):(i+=` `,e--);return i+e.slice(n)}var Ty=((e={})=>({state:t,dispatch:n})=>{let r=J(t),{doc:i}=t,a=null,o=t.changeByRange(n=>{if(!n.empty||!vy.isActiveAt(t,n.from,-1)&&!vy.isActiveAt(t,n.from,1))return a={range:n};let o=n.from,s=i.lineAt(o),c=xy(r.resolveInner(o,-1),i);for(;c.length&&c[c.length-1].from>o-s.from;)c.pop();if(!c.length)return a={range:n};let l=c[c.length-1];if(l.to-l.spaceAfter.length>o-s.from)return a={range:n};let u=o>=l.to-l.spaceAfter.length&&!/\S/.test(s.text.slice(l.to));if(l.item&&u){if(l.item.from<s.from&&!/^[\s>]*$/.test(s.text.slice(0,l.to)))return a={range:n};let r=l.node.firstChild,u=l.node.getChild(`ListItem`,`ListItem`);if(r.to>=o||u&&u.to<o||s.from>0&&!/[^\s>]/.test(i.lineAt(s.from-1).text)||e.nonTightLists===!1){let e=c.length>1?c[c.length-2]:null,t,n=``;e&&e.item?(t=s.from+e.from,n=e.marker(i,1)):t=s.from+(e?e.to:0);let r=[{from:t,to:o,insert:n}];return l.node.name==`OrderedList`&&Cy(l.item,i,r,-2),e&&e.node.name==`OrderedList`&&Cy(e.item,i,r),{range:C.cursor(t+n.length),changes:r}}{let e=Oy(c,t,s);return{range:C.cursor(o+e.length+1),changes:{from:s.from,insert:e+t.lineBreak}}}}if(l.node.name==`Blockquote`&&u&&s.from){let e=i.lineAt(s.from-1),r=/>\s*$/.exec(e.text);if(r&&r.index==l.from){let i=t.changes([{from:e.from+r.index,to:e.to},{from:s.from+l.from,to:s.to}]);return{range:n.map(i),changes:i}}}let d=[];l.node.name==`OrderedList`&&Cy(l.item,i,d);let f=l.item&&l.item.from<s.from,p=``;if(!f||/^[\s\d.)\-+*>]*/.exec(s.text)[0].length>=l.to)for(let e=0,t=c.length-1;e<=t;e++)p+=e==t&&!f?c[e].marker(i,1):c[e].blank(e<t?Ot(s.text,4,c[e+1].from)-p.length:null);let m=o;for(;m>s.from&&/\s/.test(s.text.charAt(m-s.from-1));)m--;return p=wy(p,t),Dy(l.node,t.doc)&&(p=Oy(c,t,s)+t.lineBreak+p),d.push({from:m,to:o,insert:t.lineBreak+p}),{range:C.cursor(m+p.length+1),changes:d}});return!a&&(n(t.update(o,{scrollIntoView:!0,userEvent:`input`})),!0)})();function Ey(e){return e.name==`QuoteMark`||e.name==`ListMark`}function Dy(e,t){if(e.name!=`OrderedList`&&e.name!=`BulletList`)return!1;let n=e.firstChild,r=e.getChild(`ListItem`,`ListItem`);if(!r)return!1;let i=t.lineAt(n.to),a=t.lineAt(r.from),o=/^[\s>]*$/.test(i.text);return i.number+ +!o<a.number}function Oy(e,t,n){let r=``;for(let t=0,i=e.length-2;t<=i;t++)r+=e[t].blank(t<i?Ot(n.text,4,e[t+1].from)-r.length:null,t<i);return wy(r,t)}function ky(e,t){let n=e.resolveInner(t,-1),r=t;Ey(n)&&(r=n.from,n=n.parent);for(let e;e=n.childBefore(r);)if(Ey(e))r=e.from;else if(e.name==`OrderedList`||e.name==`BulletList`)n=e.lastChild,r=n.to;else break;return n}var Ay=[{key:`Enter`,run:Ty},{key:`Backspace`,run:({state:e,dispatch:t})=>{let n=J(e),r=null,i=e.changeByRange(t=>{let i=t.from,{doc:a}=e;if(t.empty&&vy.isActiveAt(e,t.from)){let t=a.lineAt(i),r=xy(ky(n,i),a);if(r.length){let n=r[r.length-1],a=n.to-n.spaceAfter.length+ +!!n.spaceAfter;if(i-t.from>a&&!/\S/.test(t.text.slice(a,i-t.from)))return{range:C.cursor(t.from+a),changes:{from:t.from+a,to:i}};if(i-t.from==a&&(n.item&&t.from<=n.item.from||/^[\s>]*$/.test(t.text.slice(0,n.to)))){let r=t.from+n.from;if(n.item&&n.node.from<n.item.from&&/\S/.test(t.text.slice(n.from,n.to))){let i=n.blank(Ot(t.text,4,n.to)-Ot(t.text,4,n.from));return r==t.from&&(i=wy(i,e)),{range:C.cursor(r+i.length),changes:{from:r,to:t.from+n.to,insert:i}}}if(r<i)return{range:C.cursor(r),changes:{from:r,to:i}}}}}return r={range:t}});return!r&&(t(e.update(i,{scrollIntoView:!0,userEvent:`delete`})),!0)}}],jy=ay({matchClosingTags:!1});function My(e={}){let{codeLanguages:t,defaultCodeLanguage:n,addKeymap:r=!0,base:{parser:i}=_y,completeHTMLTags:a=!0,pasteURLAsLink:o=!0,htmlTagLanguage:s=jy}=e;if(!(i instanceof Kp))throw RangeError("Base parser provided to `markdown` should be a Markdown parser");let c=e.extensions?[e.extensions]:[],l=[s.support,hy],u;o&&l.push(Ly),n instanceof gl?(l.push(n.support),u=n.language):n&&(u=n);let d=t||u?yy(t,u):void 0;c.push(xm({codeParser:d,htmlParser:s.language.parser})),r&&l.push(Pe.high(Wo.of(Ay)));let f=gy(i.configure(c));return a&&l.push(f.data.of({autocomplete:Ny})),new gl(f,l)}function Ny(e){let{state:t,pos:n}=e,r=/<[:\-\.\w\u00b7-\uffff]*$/.exec(t.sliceDoc(n-25,n));if(!r)return null;let i=J(t).resolveInner(n,-1);for(;i&&!i.type.isTop;){if(i.name==`CodeBlock`||i.name==`FencedCode`||i.name==`ProcessingInstructionBlock`||i.name==`CommentBlock`||i.name==`Link`||i.name==`Image`)return null;i=i.parent}return{from:n-r[0].length,to:n,options:Fy(),validFor:/^<[:\-\.\w\u00b7-\uffff]*$/}}var Py=null;function Fy(){if(Py)return Py;let e=Qv(new Uf(O.create({extensions:jy}),0,!0));return Py=e?e.options:[]}var Iy=/code|horizontalrule|html|link|comment|processing|escape|entity|image|mark|url/i,Ly=V.domEventHandlers({paste:(e,t)=>{let{main:n}=t.state.selection;if(n.empty)return!1;let r=e.clipboardData?.getData(`text/plain`);if(!r||!/^(https?:\/\/|mailto:|xmpp:|www\.)/.test(r)||(/^www\./.test(r)&&(r=`https://`+r),!vy.isActiveAt(t.state,n.from,1)))return!1;let i=J(t.state),a=!1;return i.iterate({from:n.from,to:n.to,enter:e=>{(e.from>n.from||Iy.test(e.name))&&(a=!0)},leave:e=>{e.to<n.to&&(a=!0)}}),!a&&(t.dispatch({changes:[{from:n.from,insert:`[`},{from:n.to,insert:`](${r})`}],userEvent:`input.paste`,scrollIntoView:!0}),!0)}}),Ry=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFKD`):e=>e,zy=class{constructor(e,t,n=0,r=e.length,i,a){this.test=a,this.value={from:0,to:0,precise:!1},this.done=!1,this.matches=[],this.buffer=``,this.bufferPos=0,this.iter=e.iterRange(n,r),this.bufferStart=n,this.normalize=i?e=>i(Ry(e)):Ry,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return ue(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=de(e),n=this.bufferStart+this.bufferPos;this.bufferPos+=fe(e);let r=this.normalize(t);if(r.length)for(let e=0,i=n,a=!0;;e++){let n=r.charCodeAt(e),o=this.match(n,i,a,this.bufferPos+this.bufferStart,e==r.length-1);if(o)return this.value=o,this;if(e==r.length-1)break;a&&e<t.length&&t.charCodeAt(e)==n?i++:a=!1}}}match(e,t,n,r,i){let a=null;for(let t=0;t<this.matches.length;){let n=this.matches[t],o=!1;this.query.charCodeAt(n.index)==e&&(n.index==this.query.length-1?a={from:n.from,to:r,precise:i&&n.precise}:(n.index++,o=!0)),o?t++:this.matches.splice(t,1)}return this.query.charCodeAt(0)==e&&(this.query.length==1?a={from:t,to:r,precise:n&&i}:this.matches.push({from:t,index:1,precise:n})),a&&this.test&&!this.test(a.from,a.to,this.buffer,this.bufferStart)&&(a=null),a}};typeof Symbol<`u`&&(zy.prototype[Symbol.iterator]=function(){return this});var By={from:-1,to:-1,match:/.*/.exec(``),precise:!0},Vy=`gm`+(/x/.unicode==null?``:`u`),Hy=class{constructor(e,t,n,r=0,i=e.length){if(this.text=e,this.to=i,this.curLine=``,this.done=!1,this.value=By,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new Gy(e,t,n,r,i);this.re=new RegExp(t,Vy+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.iter=e.iter();let a=e.lineAt(r);this.curLineStart=a.from,this.matchPos=qy(e,r),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine=``:(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine=``:this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let n=this.curLineStart+t.index,r=n+t[0].length;if(this.matchPos=qy(this.text,r+ +(n==r)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<r||n>this.value.to)&&(!this.test||this.test(n,r,t)))return this.value={from:n,to:r,precise:!0,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}},Uy=new WeakMap,Wy=class e{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(t,n,r){let i=Uy.get(t);if(!i||i.from>=r||i.to<=n){let i=new e(n,t.sliceString(n,r));return Uy.set(t,i),i}if(i.from==n&&i.to==r)return i;let{text:a,from:o}=i;return o>n&&(a=t.sliceString(n,o)+a,o=n),i.to<r&&(a+=t.sliceString(i.to,r)),Uy.set(t,new e(o,a)),new e(n,a.slice(n-o,r-o))}},Gy=class{constructor(e,t,n,r,i){this.text=e,this.to=i,this.done=!1,this.value=By,this.matchPos=qy(e,r),this.re=new RegExp(t,Vy+(n?.ignoreCase?`i`:``)),this.test=n?.test,this.flat=Wy.get(e,r,this.chunkEnd(r+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let e=this.flat.from+t.index,n=e+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(e,n,t)))return this.value={from:e,to:n,precise:!0,match:t},this.matchPos=qy(this.text,n+ +(e==n)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Wy.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}};typeof Symbol<`u`&&(Hy.prototype[Symbol.iterator]=Gy.prototype[Symbol.iterator]=function(){return this});function Ky(e){try{return new RegExp(e,Vy),!0}catch{return!1}}function qy(e,t){if(t>=e.length)return t;let n=e.lineAt(t),r;for(;t<n.to&&(r=n.text.charCodeAt(t-n.from))>=56320&&r<57344;)t++;return t}var Jy=e=>{let{state:t}=e,n=String(t.doc.lineAt(e.state.selection.main.head).number),{close:r,result:i}=As(e,{label:t.phrase(`Go to line`),input:{type:`text`,name:`line`,value:n},focus:!0,submitLabel:t.phrase(`go`)});return i.then(n=>{let i=n&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(n.elements.line.value);if(!i){e.dispatch({effects:r});return}let a=t.doc.lineAt(t.selection.main.head),[,o,s,c,l]=i,u=c?+c.slice(1):0,d=s?+s:a.number;if(s&&l){let e=d/100;o&&(e=e*(o==`-`?-1:1)+a.number/t.doc.lines),d=Math.round(t.doc.lines*e)}else s&&o&&(d=d*(o==`-`?-1:1)+a.number);let f=t.doc.line(Math.max(1,Math.min(t.doc.lines,d))),p=C.cursor(f.from+Math.max(0,Math.min(u,f.length)));e.dispatch({effects:[r,V.scrollIntoView(p.from,{y:`center`})],selection:p})}),!0},Yy={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},Xy=w.define({combine(e){return ut(e,Yy,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function Zy(e){let t=[rb,nb];return e&&t.push(Xy.of(e)),t}var Qy=F.mark({class:`cm-selectionMatch`}),$y=F.mark({class:`cm-selectionMatch cm-selectionMatch-main`});function eb(e,t,n,r){return(n==0||e(t.sliceDoc(n-1,n))!=D.Word)&&(r==t.doc.length||e(t.sliceDoc(r,r+1))!=D.Word)}function tb(e,t,n,r){return e(t.sliceDoc(n,n+1))==D.Word&&e(t.sliceDoc(r-1,r))==D.Word}var nb=kr.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(Xy),{state:n}=e,r=n.selection;if(r.ranges.length>1)return F.none;let i=r.main,a,o=null;if(i.empty){if(!t.highlightWordAroundCursor)return F.none;let e=n.wordAt(i.head);if(!e)return F.none;o=n.charCategorizer(i.head),a=n.sliceDoc(e.from,e.to)}else{let e=i.to-i.from;if(e<t.minSelectionLength||e>200)return F.none;if(t.wholeWords){if(a=n.sliceDoc(i.from,i.to),o=n.charCategorizer(i.head),!(eb(o,n,i.from,i.to)&&tb(o,n,i.from,i.to)))return F.none}else if(a=n.sliceDoc(i.from,i.to),!a)return F.none}let s=[];for(let r of e.visibleRanges){let e=new zy(n.doc,a,r.from,r.to);for(;!e.next().done;){let{from:r,to:a}=e.value;if((!o||eb(o,n,r,a))&&(i.empty&&r<=i.from&&a>=i.to?s.push($y.range(r,a)):(r>=i.to||a<=i.from)&&s.push(Qy.range(r,a)),s.length>t.maxMatches))return F.none}}return F.set(s)}},{decorations:e=>e.decorations}),rb=V.baseTheme({".cm-selectionMatch":{backgroundColor:`#99ff7780`},".cm-searchMatch .cm-selectionMatch":{backgroundColor:`transparent`}}),ib=({state:e,dispatch:t})=>{let{selection:n}=e,r=C.create(n.ranges.map(t=>e.wordAt(t.head)||C.cursor(t.head)),n.mainIndex);return!r.eq(n)&&(t(e.update({selection:r})),!0)};function ab(e,t){let{main:n,ranges:r}=e.selection,i=e.wordAt(n.head),a=i&&i.from==n.from&&i.to==n.to;for(let n=!1,i=new zy(e.doc,t,r[r.length-1].to);;)if(i.next(),i.done){if(n)return null;i=new zy(e.doc,t,0,Math.max(0,r[r.length-1].from-1)),n=!0}else{if(n&&r.some(e=>e.from==i.value.from))continue;if(a){let t=e.wordAt(i.value.from);if(!t||t.from!=i.value.from||t.to!=i.value.to)continue}return i.value}}var ob=({state:e,dispatch:t})=>{let{ranges:n}=e.selection;if(n.some(e=>e.from===e.to))return ib({state:e,dispatch:t});let r=e.sliceDoc(n[0].from,n[0].to);if(e.selection.ranges.some(t=>e.sliceDoc(t.from,t.to)!=r))return!1;let i=ab(e,r);return i?(t(e.update({selection:e.selection.addRange(C.range(i.from,i.to),!1),effects:V.scrollIntoView(i.to)})),!0):!1},sb=w.define({combine(e){return ut(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Hb(e),scrollToMatch:e=>V.scrollIntoView(e)})}});function cb(e){return e?[sb.of(e),Jb]:Jb}var lb=class{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||``,this.valid=!!this.search&&(!this.regexp||Ky(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(e,t)=>t==`n`?`
|
|
38
|
-
`:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new bb(this):new mb(this)}getCursor(e,t=0,n){let r=e.doc?e:O.create({doc:e});return n??=r.doc.length,this.regexp?gb(this,r,t,n):fb(this,r,t,n)}},ub=class{constructor(e){this.spec=e}};function db(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function fb(e,t,n,r){let i;return e.wholeWord&&(i=pb(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=db(e.test,t,i)),new zy(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function pb(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(_b(i,n-a))!=D.Word||t(vb(i,n-a))!=D.Word)&&(t(vb(i,r-a))!=D.Word||t(_b(i,r-a))!=D.Word))}var mb=class extends ub{constructor(e){super(e)}nextMatch(e,t,n){let r=fb(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=fb(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=fb(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=fb(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=fb(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function hb(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function gb(e,t,n,r){let i;return e.wholeWord&&(i=yb(t.charCategorizer(t.selection.main.head))),e.test&&(i=hb(e.test,t,i)),new Hy(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function _b(e,t){return e.slice(x(e,t,!1),t)}function vb(e,t){return e.slice(t,x(e,t))}function yb(e){return(t,n,r)=>!r[0].length||(e(_b(r.input,r.index))!=D.Word||e(vb(r.input,r.index))!=D.Word)&&(e(vb(r.input,r.index+r[0].length))!=D.Word||e(_b(r.input,r.index+r[0].length))!=D.Word)}var bb=class extends ub{nextMatch(e,t,n){let r=gb(this.spec,e,n,e.doc.length).next();return r.done&&(r=gb(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=gb(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=gb(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=gb(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},xb=T.define(),Sb=T.define(),Cb=je.define({create(e){return new wb(Ib(e).create(),null)},update(e,t){for(let n of t.effects)n.is(xb)?e=new wb(n.value.create(),e.panel):n.is(Sb)&&(e=new wb(e.query,n.value?Fb:null));return e},provide:e=>ks.from(e,e=>e.panel)}),wb=class{constructor(e,t){this.query=e,this.panel=t}},Tb=F.mark({class:`cm-searchMatch`}),Eb=F.mark({class:`cm-searchMatch cm-searchMatch-selected`}),Db=kr.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Cb))}update(e){let t=e.state.field(Cb);(t!=e.startState.field(Cb)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return F.none;let{view:n}=this,r=new _t;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?Eb:Tb)})}return r.finish()}},{decorations:e=>e.decorations});function Ob(e){return t=>{let n=t.state.field(Cb,!1);return n&&n.query.spec.valid?e(t,n):zb(t)}}var kb=Ob((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=C.single(r.from,r.to),a=e.state.facet(sb);return e.dispatch({selection:i,effects:[Kb(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Rb(e),!0}),Ab=Ob((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=C.single(i.from,i.to),o=e.state.facet(sb);return e.dispatch({selection:a,effects:[Kb(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Rb(e),!0}),jb=Ob((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:C.create(n.map(e=>C.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),Mb=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new zy(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(C.range(t.value.from,t.value.to))}return t(e.update({selection:C.create(a,o),userEvent:`select.search.matches`})),!0},Nb=Ob((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.precise?o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(V.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`))):o=t.nextMatch(n,o.from,o.to);let d=e.state.changes(s);return o&&(c=C.single(o.from,o.to).map(d),u.push(Kb(e,o)),u.push(n.facet(sb).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),Pb=Ob((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:V.announce.of(r),userEvent:`input.replace.all`}),!0});function Fb(e){return e.state.facet(sb).createPanel(e)}function Ib(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(sb);return new lb({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function Lb(e){let t=Ts(e,Fb);return t&&t.dom.querySelector(`[main-field]`)}function Rb(e){let t=Lb(e);t&&t==e.root.activeElement&&t.select()}var zb=e=>{let t=e.state.field(Cb,!1);if(t&&t.panel){let n=Lb(e);if(n&&n!=e.root.activeElement){let r=Ib(e.state,t.query.spec);r.valid&&e.dispatch({effects:xb.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[Sb.of(!0),t?xb.of(Ib(e.state,t.query.spec)):T.appendConfig.of(Jb)]});return!0},Bb=e=>{let t=e.state.field(Cb,!1);if(!t||!t.panel)return!1;let n=Ts(e,Fb);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Sb.of(!1)}),!0},Vb=[{key:`Mod-f`,run:zb,scope:`editor search-panel`},{key:`F3`,run:kb,shift:Ab,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:kb,shift:Ab,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:Bb,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:Mb},{key:`Mod-Alt-g`,run:Jy},{key:`Mod-d`,run:ob,preventDefault:!0}],Hb=class{constructor(e){this.view=e;let t=this.query=e.state.field(Cb).query.spec;this.commit=this.commit.bind(this),this.searchField=j(`input`,{value:t.search,placeholder:Ub(e,`Find`),"aria-label":Ub(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=j(`input`,{value:t.replace,placeholder:Ub(e,`Replace`),"aria-label":Ub(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=j(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=j(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=j(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return j(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=j(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>kb(e),[Ub(e,`next`)]),n(`prev`,()=>Ab(e),[Ub(e,`previous`)]),n(`select`,()=>jb(e),[Ub(e,`all`)]),j(`label`,null,[this.caseField,Ub(e,`match case`)]),j(`label`,null,[this.reField,Ub(e,`regexp`)]),j(`label`,null,[this.wordField,Ub(e,`by word`)]),...e.state.readOnly?[]:[j(`br`),this.replaceField,n(`replace`,()=>Nb(e),[Ub(e,`replace`)]),n(`replaceAll`,()=>Pb(e),[Ub(e,`replace all`)])],j(`button`,{name:`close`,onclick:()=>Bb(e),"aria-label":Ub(e,`close`),type:`button`},[`×`])])}commit(){let e=new lb({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:xb.of(e)}))}keydown(e){qo(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ab:kb)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Nb(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(xb)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(sb).top}};function Ub(e,t){return e.state.phrase(t)}var Wb=30,Gb=/[\s\.,:;?!]/;function Kb(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-Wb),o=Math.min(i,n+Wb),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<Wb;e++)if(!Gb.test(s[e+1])&&Gb.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-Wb;e--)if(!Gb.test(s[e-1])&&Gb.test(s[e])){s=s.slice(0,e);break}}return V.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var qb=V.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),Jb=[Cb,Pe.low(Db),qb],Yb=Hl.define([{tag:q.heading1,fontSize:`1.5em`,fontWeight:`650`,color:`var(--ds-text-primary)`,lineHeight:`1.9`},{tag:q.heading2,fontSize:`1.25em`,fontWeight:`640`,color:`var(--ds-text-primary)`,lineHeight:`1.9`},{tag:q.heading3,fontSize:`1.08em`,fontWeight:`640`,color:`var(--ds-text-primary)`},{tag:[q.heading4,q.heading5,q.heading6],fontWeight:`640`,color:`var(--ds-text-secondary)`},{tag:q.strong,fontWeight:`680`,color:`var(--ds-text-primary)`},{tag:q.emphasis,fontStyle:`italic`,color:`var(--ds-text-primary)`},{tag:q.strikethrough,textDecoration:`line-through`,color:`var(--ds-text-muted)`},{tag:q.link,color:`var(--ds-accent)`,textDecoration:`underline`},{tag:q.url,color:`var(--ds-accent)`},{tag:q.monospace,fontFamily:`var(--ds-font-mono)`,color:`var(--ds-code-text)`,background:`var(--ds-editor-code-bg)`},{tag:q.quote,color:`var(--ds-text-secondary)`,fontStyle:`italic`},{tag:q.list,color:`var(--ds-accent)`},{tag:q.processingInstruction,color:`var(--ds-text-muted)`},{tag:q.meta,color:`var(--ds-text-muted)`},{tag:q.comment,color:`var(--ds-text-muted)`,fontStyle:`italic`},{tag:q.keyword,color:`var(--ds-code-keyword)`},{tag:q.string,color:`var(--ds-code-string)`},{tag:q.number,color:`var(--ds-code-number)`},{tag:[q.tagName,q.angleBracket],color:`var(--ds-code-name)`},{tag:q.attributeName,color:`var(--ds-code-attr)`}]),Xb=V.theme({"&":{color:`var(--ds-text-primary)`,backgroundColor:`transparent`,fontSize:`var(--ds-font-md)`,height:`100%`},".cm-scroller":{fontFamily:`var(--ds-font-mono)`,lineHeight:`1.7`,padding:`var(--ds-space-5) 0 40vh`},".cm-content":{caretColor:`var(--ds-accent)`,maxWidth:`calc(var(--ds-measure-editor) + 2 * var(--ds-space-5))`,margin:`0 auto`,padding:`0 var(--ds-space-5)`},".cm-line":{padding:`0`},"&.cm-focused":{outline:`none`},".cm-cursor, .cm-dropCursor":{borderLeftColor:`var(--ds-accent)`,borderLeftWidth:`2px`},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:`var(--ds-editor-selection)`},".cm-activeLine":{backgroundColor:`var(--ds-editor-active-line)`},".cm-gutters":{display:`none`},".cm-selectionMatch":{backgroundColor:`var(--ds-editor-selection-match)`},".cm-searchMatch":{backgroundColor:`var(--ds-editor-search)`,outline:`1px solid var(--ds-editor-search-ring)`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`var(--ds-editor-search-selected)`},".cm-panels":{backgroundColor:`var(--ds-surface-raised)`,color:`var(--ds-text-primary)`,border:`1px solid var(--ds-border)`},".cm-panel input, .cm-panel button":{backgroundColor:`var(--ds-surface)`,color:`var(--ds-text-primary)`,border:`1px solid var(--ds-border)`,borderRadius:`var(--ds-radius-sm)`,padding:`2px 6px`}}),Zb=new Ie;function Qb(e){return V.darkTheme.of(r(e).colorScheme===`dark`)}function $b(e){return Zb.reconfigure(Qb(e))}function ex(e){return[Xb,Zb.of(Qb(e)),Kl(Yb)]}var tx=t(),nx=`/Users/yann/dev/invariant-guru/invariant-cli/apps/cli/ui/src/features/sessions/Editor.tsx`;function rx({value:t,onChange:n,onSave:r}){let i=e(),o=(0,a.useRef)(null),s=(0,a.useRef)(null),c=(0,a.useRef)(n),l=(0,a.useRef)(r);c.current=n,l.current=r;let u=(0,a.useRef)(i);return u.current=i,(0,a.useEffect)(()=>{if(!o.current)return;let e=[Pu(),cs(),Cs(),hs(),Zy(),iu(),Rl(),cb({top:!0}),V.lineWrapping,My({base:vy,codeLanguages:[]}),...ex(u.current),Wo.of([{key:`Mod-s`,preventDefault:!0,run:()=>(l.current(),!0)},...Vb,...$u,...Vf,Hf]),V.updateListener.of(e=>{e.docChanged&&c.current(e.state.doc.toString())})],n=new V({state:O.create({doc:t,extensions:e}),parent:o.current});return s.current=n,n.focus(),()=>{n.destroy(),s.current=null}},[]),(0,a.useEffect)(()=>{s.current?.dispatch({effects:$b(i)})},[i]),(0,a.useEffect)(()=>{let e=s.current;if(!e)return;let n=e.state.doc.toString();if(n===t)return;let r=e.state.selection.main;e.dispatch({changes:{from:0,to:n.length,insert:t},selection:{anchor:Math.min(r.anchor,t.length)}})},[t]),(0,tx.jsxDEV)(`div`,{className:`editor`,ref:o},void 0,!1,{fileName:nx,lineNumber:105,columnNumber:10},this)}export{rx as Editor};
|
|
38
|
+
`:t==`r`?`\r`:t==`t`?` `:`\\`)}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new bb(this):new mb(this)}getCursor(e,t=0,n){let r=e.doc?e:O.create({doc:e});return n??=r.doc.length,this.regexp?gb(this,r,t,n):fb(this,r,t,n)}},ub=class{constructor(e){this.spec=e}};function db(e,t,n){return(r,i,a,o)=>n&&!n(r,i,a,o)?!1:e(r>=o&&i<=o+a.length?a.slice(r-o,i-o):t.doc.sliceString(r,i),t,r,i)}function fb(e,t,n,r){let i;return e.wholeWord&&(i=pb(t.doc,t.charCategorizer(t.selection.main.head))),e.test&&(i=db(e.test,t,i)),new zy(t.doc,e.unquoted,n,r,e.caseSensitive?void 0:e=>e.toLowerCase(),i)}function pb(e,t){return(n,r,i,a)=>((a>n||a+i.length<r)&&(a=Math.max(0,n-2),i=e.sliceString(a,Math.min(e.length,r+2))),(t(_b(i,n-a))!=D.Word||t(vb(i,n-a))!=D.Word)&&(t(vb(i,r-a))!=D.Word||t(_b(i,r-a))!=D.Word))}var mb=class extends ub{constructor(e){super(e)}nextMatch(e,t,n){let r=fb(this.spec,e,n,e.doc.length).nextOverlapping();if(r.done){let n=Math.min(e.doc.length,t+this.spec.unquoted.length);r=fb(this.spec,e,0,n).nextOverlapping()}return r.done||r.value.from==t&&r.value.to==n?null:r.value}prevMatchInRange(e,t,n){for(let r=n;;){let n=Math.max(t,r-1e4-this.spec.unquoted.length),i=fb(this.spec,e,n,r),a=null;for(;!i.nextOverlapping().done;)a=i.value;if(a)return a;if(n==t)return null;r-=1e4}}prevMatch(e,t,n){let r=this.prevMatchInRange(e,0,t);return r||=this.prevMatchInRange(e,Math.max(0,n-this.spec.unquoted.length),e.doc.length),r&&(r.from!=t||r.to!=n)?r:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let n=fb(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=fb(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}};function hb(e,t,n){return(r,i,a)=>(!n||n(r,i,a))&&e(a[0],t,r,i)}function gb(e,t,n,r){let i;return e.wholeWord&&(i=yb(t.charCategorizer(t.selection.main.head))),e.test&&(i=hb(e.test,t,i)),new Hy(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:i},n,r)}function _b(e,t){return e.slice(x(e,t,!1),t)}function vb(e,t){return e.slice(t,x(e,t))}function yb(e){return(t,n,r)=>!r[0].length||(e(_b(r.input,r.index))!=D.Word||e(vb(r.input,r.index))!=D.Word)&&(e(vb(r.input,r.index+r[0].length))!=D.Word||e(_b(r.input,r.index+r[0].length))!=D.Word)}var bb=class extends ub{nextMatch(e,t,n){let r=gb(this.spec,e,n,e.doc.length).next();return r.done&&(r=gb(this.spec,e,0,t).next()),r.done?null:r.value}prevMatchInRange(e,t,n){for(let r=1;;r++){let i=Math.max(t,n-r*1e4),a=gb(this.spec,e,i,n),o=null;for(;!a.next().done;)o=a.value;if(o&&(i==t||o.from>i+10))return o;if(i==t)return null}}prevMatch(e,t,n){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,n,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,n)=>{if(n==`&`)return e.match[0];if(n==`$`)return`$`;for(let t=n.length;t>0;t--){let r=+n.slice(0,t);if(r>0&&r<e.match.length)return e.match[r]+n.slice(t)}return t})}matchAll(e,t){let n=gb(this.spec,e,0,e.doc.length),r=[];for(;!n.next().done;){if(r.length>=t)return null;r.push(n.value)}return r}highlight(e,t,n,r){let i=gb(this.spec,e,Math.max(0,t-250),Math.min(n+250,e.doc.length));for(;!i.next().done;)r(i.value.from,i.value.to)}},xb=T.define(),Sb=T.define(),Cb=je.define({create(e){return new wb(Ib(e).create(),null)},update(e,t){for(let n of t.effects)n.is(xb)?e=new wb(n.value.create(),e.panel):n.is(Sb)&&(e=new wb(e.query,n.value?Fb:null));return e},provide:e=>ks.from(e,e=>e.panel)}),wb=class{constructor(e,t){this.query=e,this.panel=t}},Tb=F.mark({class:`cm-searchMatch`}),Eb=F.mark({class:`cm-searchMatch cm-searchMatch-selected`}),Db=kr.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(Cb))}update(e){let t=e.state.field(Cb);(t!=e.startState.field(Cb)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return F.none;let{view:n}=this,r=new _t;for(let t=0,i=n.visibleRanges,a=i.length;t<a;t++){let{from:o,to:s}=i[t];for(;t<a-1&&s>i[t+1].from-500;)s=i[++t].to;e.highlight(n.state,o,s,(e,t)=>{let i=n.state.selection.ranges.some(n=>n.from==e&&n.to==t);r.add(e,t,i?Eb:Tb)})}return r.finish()}},{decorations:e=>e.decorations});function Ob(e){return t=>{let n=t.state.field(Cb,!1);return n&&n.query.spec.valid?e(t,n):zb(t)}}var kb=Ob((e,{query:t})=>{let{to:n}=e.state.selection.main,r=t.nextMatch(e.state,n,n);if(!r)return!1;let i=C.single(r.from,r.to),a=e.state.facet(sb);return e.dispatch({selection:i,effects:[Kb(e,r),a.scrollToMatch(i.main,e)],userEvent:`select.search`}),Rb(e),!0}),Ab=Ob((e,{query:t})=>{let{state:n}=e,{from:r}=n.selection.main,i=t.prevMatch(n,r,r);if(!i)return!1;let a=C.single(i.from,i.to),o=e.state.facet(sb);return e.dispatch({selection:a,effects:[Kb(e,i),o.scrollToMatch(a.main,e)],userEvent:`select.search`}),Rb(e),!0}),jb=Ob((e,{query:t})=>{let n=t.matchAll(e.state,1e3);return!n||!n.length?!1:(e.dispatch({selection:C.create(n.map(e=>C.range(e.from,e.to))),userEvent:`select.search.matches`}),!0)}),Mb=({state:e,dispatch:t})=>{let n=e.selection;if(n.ranges.length>1||n.main.empty)return!1;let{from:r,to:i}=n.main,a=[],o=0;for(let t=new zy(e.doc,e.sliceDoc(r,i));!t.next().done;){if(a.length>1e3)return!1;t.value.from==r&&(o=a.length),a.push(C.range(t.value.from,t.value.to))}return t(e.update({selection:C.create(a,o),userEvent:`select.search.matches`})),!0},Nb=Ob((e,{query:t})=>{let{state:n}=e,{from:r,to:i}=n.selection.main;if(n.readOnly)return!1;let a=t.nextMatch(n,r,r);if(!a)return!1;let o=a,s=[],c,l,u=[];o.precise?o.from==r&&o.to==i&&(l=n.toText(t.getReplacement(o)),s.push({from:o.from,to:o.to,insert:l}),o=t.nextMatch(n,o.from,o.to),u.push(V.announce.of(n.phrase(`replaced match on line $`,n.doc.lineAt(r).number)+`.`))):o=t.nextMatch(n,o.from,o.to);let d=e.state.changes(s);return o&&(c=C.single(o.from,o.to).map(d),u.push(Kb(e,o)),u.push(n.facet(sb).scrollToMatch(c.main,e))),e.dispatch({changes:d,selection:c,effects:u,userEvent:`input.replace`}),!0}),Pb=Ob((e,{query:t})=>{if(e.state.readOnly)return!1;let n=[];for(let r of t.matchAll(e.state,1e9)){let{from:e,to:i,precise:a}=r;a&&n.push({from:e,to:i,insert:t.getReplacement(r)})}if(!n.length)return!1;let r=e.state.phrase(`replaced $ matches`,n.length)+`.`;return e.dispatch({changes:n,effects:V.announce.of(r),userEvent:`input.replace.all`}),!0});function Fb(e){return e.state.facet(sb).createPanel(e)}function Ib(e,t){let n=e.selection.main,r=n.empty||n.to>n.from+100?``:e.sliceDoc(n.from,n.to);if(t&&!r)return t;let i=e.facet(sb);return new lb({search:t?.literal??i.literal?r:r.replace(/\n/g,`\\n`),caseSensitive:t?.caseSensitive??i.caseSensitive,literal:t?.literal??i.literal,regexp:t?.regexp??i.regexp,wholeWord:t?.wholeWord??i.wholeWord})}function Lb(e){let t=Ts(e,Fb);return t&&t.dom.querySelector(`[main-field]`)}function Rb(e){let t=Lb(e);t&&t==e.root.activeElement&&t.select()}var zb=e=>{let t=e.state.field(Cb,!1);if(t&&t.panel){let n=Lb(e);if(n&&n!=e.root.activeElement){let r=Ib(e.state,t.query.spec);r.valid&&e.dispatch({effects:xb.of(r)}),n.focus(),n.select()}}else e.dispatch({effects:[Sb.of(!0),t?xb.of(Ib(e.state,t.query.spec)):T.appendConfig.of(Jb)]});return!0},Bb=e=>{let t=e.state.field(Cb,!1);if(!t||!t.panel)return!1;let n=Ts(e,Fb);return n&&n.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Sb.of(!1)}),!0},Vb=[{key:`Mod-f`,run:zb,scope:`editor search-panel`},{key:`F3`,run:kb,shift:Ab,scope:`editor search-panel`,preventDefault:!0},{key:`Mod-g`,run:kb,shift:Ab,scope:`editor search-panel`,preventDefault:!0},{key:`Escape`,run:Bb,scope:`editor search-panel`},{key:`Mod-Shift-l`,run:Mb},{key:`Mod-Alt-g`,run:Jy},{key:`Mod-d`,run:ob,preventDefault:!0}],Hb=class{constructor(e){this.view=e;let t=this.query=e.state.field(Cb).query.spec;this.commit=this.commit.bind(this),this.searchField=j(`input`,{value:t.search,placeholder:Ub(e,`Find`),"aria-label":Ub(e,`Find`),class:`cm-textfield`,name:`search`,form:``,"main-field":`true`,onchange:this.commit,onkeyup:this.commit}),this.replaceField=j(`input`,{value:t.replace,placeholder:Ub(e,`Replace`),"aria-label":Ub(e,`Replace`),class:`cm-textfield`,name:`replace`,form:``,onchange:this.commit,onkeyup:this.commit}),this.caseField=j(`input`,{type:`checkbox`,name:`case`,form:``,checked:t.caseSensitive,onchange:this.commit}),this.reField=j(`input`,{type:`checkbox`,name:`re`,form:``,checked:t.regexp,onchange:this.commit}),this.wordField=j(`input`,{type:`checkbox`,name:`word`,form:``,checked:t.wholeWord,onchange:this.commit});function n(e,t,n){return j(`button`,{class:`cm-button`,name:e,onclick:t,type:`button`},n)}this.dom=j(`div`,{onkeydown:e=>this.keydown(e),class:`cm-search`},[this.searchField,n(`next`,()=>kb(e),[Ub(e,`next`)]),n(`prev`,()=>Ab(e),[Ub(e,`previous`)]),n(`select`,()=>jb(e),[Ub(e,`all`)]),j(`label`,null,[this.caseField,Ub(e,`match case`)]),j(`label`,null,[this.reField,Ub(e,`regexp`)]),j(`label`,null,[this.wordField,Ub(e,`by word`)]),...e.state.readOnly?[]:[j(`br`),this.replaceField,n(`replace`,()=>Nb(e),[Ub(e,`replace`)]),n(`replaceAll`,()=>Pb(e),[Ub(e,`replace all`)])],j(`button`,{name:`close`,onclick:()=>Bb(e),"aria-label":Ub(e,`close`),type:`button`},[`×`])])}commit(){let e=new lb({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:xb.of(e)}))}keydown(e){qo(this.view,e,`search-panel`)?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Ab:kb)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),Nb(this.view))}update(e){for(let t of e.transactions)for(let e of t.effects)e.is(xb)&&!e.value.eq(this.query)&&this.setQuery(e.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(sb).top}};function Ub(e,t){return e.state.phrase(t)}var Wb=30,Gb=/[\s\.,:;?!]/;function Kb(e,{from:t,to:n}){let r=e.state.doc.lineAt(t),i=e.state.doc.lineAt(n).to,a=Math.max(r.from,t-Wb),o=Math.min(i,n+Wb),s=e.state.sliceDoc(a,o);if(a!=r.from){for(let e=0;e<Wb;e++)if(!Gb.test(s[e+1])&&Gb.test(s[e])){s=s.slice(e);break}}if(o!=i){for(let e=s.length-1;e>s.length-Wb;e--)if(!Gb.test(s[e-1])&&Gb.test(s[e])){s=s.slice(0,e);break}}return V.announce.of(`${e.state.phrase(`current match`)}. ${s} ${e.state.phrase(`on line`)} ${r.number}.`)}var qb=V.baseTheme({".cm-panel.cm-search":{padding:`2px 6px 4px`,position:`relative`,"& [name=close]":{position:`absolute`,top:`0`,right:`4px`,backgroundColor:`inherit`,border:`none`,font:`inherit`,padding:0,margin:0},"& input, & button, & label":{margin:`.2em .6em .2em 0`},"& input[type=checkbox]":{marginRight:`.2em`},"& label":{fontSize:`80%`,whiteSpace:`pre`}},"&light .cm-searchMatch":{backgroundColor:`#ffff0054`},"&dark .cm-searchMatch":{backgroundColor:`#00ffff8a`},"&light .cm-searchMatch-selected":{backgroundColor:`#ff6a0054`},"&dark .cm-searchMatch-selected":{backgroundColor:`#ff00ff8a`}}),Jb=[Cb,Pe.low(Db),qb],Yb=Hl.define([{tag:q.heading1,fontSize:`1.5em`,fontWeight:`650`,color:`var(--ds-text-primary)`,lineHeight:`1.9`},{tag:q.heading2,fontSize:`1.25em`,fontWeight:`640`,color:`var(--ds-text-primary)`,lineHeight:`1.9`},{tag:q.heading3,fontSize:`1.08em`,fontWeight:`640`,color:`var(--ds-text-primary)`},{tag:[q.heading4,q.heading5,q.heading6],fontWeight:`640`,color:`var(--ds-text-secondary)`},{tag:q.strong,fontWeight:`680`,color:`var(--ds-text-primary)`},{tag:q.emphasis,fontStyle:`italic`,color:`var(--ds-text-primary)`},{tag:q.strikethrough,textDecoration:`line-through`,color:`var(--ds-text-muted)`},{tag:q.link,color:`var(--ds-accent)`,textDecoration:`underline`},{tag:q.url,color:`var(--ds-accent)`},{tag:q.monospace,fontFamily:`var(--ds-font-mono)`,color:`var(--ds-code-text)`,background:`var(--ds-editor-code-bg)`},{tag:q.quote,color:`var(--ds-text-secondary)`,fontStyle:`italic`},{tag:q.list,color:`var(--ds-accent)`},{tag:q.processingInstruction,color:`var(--ds-text-muted)`},{tag:q.meta,color:`var(--ds-text-muted)`},{tag:q.comment,color:`var(--ds-text-muted)`,fontStyle:`italic`},{tag:q.keyword,color:`var(--ds-code-keyword)`},{tag:q.string,color:`var(--ds-code-string)`},{tag:q.number,color:`var(--ds-code-number)`},{tag:[q.tagName,q.angleBracket],color:`var(--ds-code-name)`},{tag:q.attributeName,color:`var(--ds-code-attr)`}]),Xb=V.theme({"&":{color:`var(--ds-text-primary)`,backgroundColor:`transparent`,fontSize:`var(--ds-font-md)`,height:`100%`},".cm-scroller":{fontFamily:`var(--ds-font-mono)`,lineHeight:`1.7`,padding:`var(--ds-space-5) 0 40vh`},".cm-content":{caretColor:`var(--ds-accent)`,maxWidth:`calc(var(--ds-measure-editor) + 2 * var(--ds-space-5))`,margin:`0 auto`,padding:`0 var(--ds-space-5)`},".cm-line":{padding:`0`},"&.cm-focused":{outline:`none`},".cm-cursor, .cm-dropCursor":{borderLeftColor:`var(--ds-accent)`,borderLeftWidth:`2px`},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:`var(--ds-editor-selection)`},".cm-activeLine":{backgroundColor:`var(--ds-editor-active-line)`},".cm-gutters":{display:`none`},".cm-selectionMatch":{backgroundColor:`var(--ds-editor-selection-match)`},".cm-searchMatch":{backgroundColor:`var(--ds-editor-search)`,outline:`1px solid var(--ds-editor-search-ring)`},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:`var(--ds-editor-search-selected)`},".cm-panels":{backgroundColor:`var(--ds-surface-raised)`,color:`var(--ds-text-primary)`,border:`1px solid var(--ds-border)`},".cm-panel input, .cm-panel button":{backgroundColor:`var(--ds-surface)`,color:`var(--ds-text-primary)`,border:`1px solid var(--ds-border)`,borderRadius:`var(--ds-radius-sm)`,padding:`2px 6px`}}),Zb=new Ie;function Qb(e){return V.darkTheme.of(r(e).colorScheme===`dark`)}function $b(e){return Zb.reconfigure(Qb(e))}function ex(e){return[Xb,Zb.of(Qb(e)),Kl(Yb)]}var tx=n(),nx=`/Users/yann/dev/invariant-guru/invariant-cli/apps/cli/ui/src/features/sessions/Editor.tsx`;function rx({value:t,onChange:n,onSave:r}){let i=e(),o=(0,a.useRef)(null),s=(0,a.useRef)(null),c=(0,a.useRef)(n),l=(0,a.useRef)(r);c.current=n,l.current=r;let u=(0,a.useRef)(i);return u.current=i,(0,a.useEffect)(()=>{if(!o.current)return;let e=[Pu(),cs(),Cs(),hs(),Zy(),iu(),Rl(),cb({top:!0}),V.lineWrapping,My({base:vy,codeLanguages:[]}),...ex(u.current),Wo.of([{key:`Mod-s`,preventDefault:!0,run:()=>(l.current(),!0)},...Vb,...$u,...Vf,Hf]),V.updateListener.of(e=>{e.docChanged&&c.current(e.state.doc.toString())})],n=new V({state:O.create({doc:t,extensions:e}),parent:o.current});return s.current=n,n.focus(),()=>{n.destroy(),s.current=null}},[]),(0,a.useEffect)(()=>{s.current?.dispatch({effects:$b(i)})},[i]),(0,a.useEffect)(()=>{let e=s.current;if(!e)return;let n=e.state.doc.toString();if(n===t)return;let r=e.state.selection.main;e.dispatch({changes:{from:0,to:n.length,insert:t},selection:{anchor:Math.min(r.anchor,t.length)}})},[t]),(0,tx.jsxDEV)(`div`,{className:`editor`,ref:o},void 0,!1,{fileName:nx,lineNumber:105,columnNumber:10},this)}export{rx as Editor};
|