@agent-cms/agentcms 0.1.0 → 0.1.1
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 +2 -2
- package/changelog.json +11 -0
- package/dist/admin/admin-files.json +4 -4
- package/dist/admin/assets/{CodeEditor-DcFzGUt8.js → CodeEditor-Wx1WlF3h.js} +1 -1
- package/dist/admin/assets/{index-CLZ1gQZl.js → index-DFVZw8E0.js} +23 -23
- package/dist/admin/assets/{sql-wasm-CYl3LXH_.js → sql-wasm-Bfkbn6Oa.js} +1 -1
- package/dist/admin/index.html +2 -2
- package/dist/admin/plugins/core-seo/bundle.js +2 -2
- package/dist/admin/plugins/flexweg-search/bundle.js +15 -15
- package/dist/admin/themes/marketplace-core/bundle.js +1 -1
- package/dist/agent/agentcms.mjs +7 -7
- package/dist/agent/chunks/{hosting-D_uj-Mt1.mjs → hosting-BftlDdsL.mjs} +3 -3
- package/dist/agent/chunks/{index-CrvEoyi0.mjs → index-BG05qslv.mjs} +29 -29
- package/dist/agent/chunks/{install-DkCCcKAO.mjs → install-DnmgOT3F.mjs} +4 -4
- package/dist/agent/chunks/{plan-EYKegfhp.mjs → plan-BrM8ztEp.mjs} +2 -2
- package/dist/agent/chunks/{registry-lkfb_E9O.mjs → registry-C9TSnZ77.mjs} +6 -6
- package/dist/agent/chunks/{siteAdd-BqcYt8nu.mjs → siteAdd-BcXhN9fk.mjs} +4 -4
- package/dist/version.json +1 -1
- package/package.json +2 -2
- package/plugin/.claude-plugin/plugin.json +1 -1
- package/plugin/skills/agentcms-install/SKILL.md +15 -15
- package/plugin/skills/agentcms-install/references/flexweg.md +1 -1
- package/plugin/skills/agentcms-install/references/github.md +2 -2
- package/plugin/skills/agentcms-install/references/gitlab.md +1 -1
- package/plugin/skills/agentcms-install/references/s3.md +2 -2
- package/plugin/skills/agentcms-manage/SKILL.md +11 -11
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# AgentCMS
|
|
2
2
|
|
|
3
3
|
A WordPress-style content management system that publishes a 100% static site to any static host — [Flexweg](https://www.flexweg.com), GitHub Pages, Cloudflare Pages, GitLab Pages, an S3-compatible bucket, your own PHP server, a local folder or a ZIP you upload by hand. The admin is a React + TypeScript single-page app with **four interchangeable data backends**, chosen at install time:
|
|
4
4
|
|
|
@@ -70,7 +70,7 @@ Posts are stored as Markdown in Firestore. When an admin clicks **Publish**, the
|
|
|
70
70
|
## Project layout
|
|
71
71
|
|
|
72
72
|
```
|
|
73
|
-
|
|
73
|
+
agentcms/
|
|
74
74
|
├── src/
|
|
75
75
|
│ ├── core/ CMS-wide infrastructure (types, slug, render, markdown, plugin registry)
|
|
76
76
|
│ ├── services/ Firebase + Flexweg API clients, publisher
|
package/changelog.json
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$comment": "Newest first. Read by agents (agentcms status) to tell users what changed and what to run. `breaking`: an older admin, skill or site setup stops working without action. `actions`: steps a hosted site needs after updating — deploy-admin, regenerate-all, sync-theme-assets. Keep every entry in English.",
|
|
3
3
|
"versions": [
|
|
4
|
+
{
|
|
5
|
+
"version": "0.1.1",
|
|
6
|
+
"date": "2026-10-23",
|
|
7
|
+
"breaking": false,
|
|
8
|
+
"changes": [
|
|
9
|
+
"Renamed to AgentCMS everywhere: admin (title, header, setup wizard, terms — 7 languages), the generator meta tag of published pages, config.js header, commit messages, docs and examples. Stored identifiers (export format, browser keys, plugin ids, @flexweg/cms-runtime) are unchanged, so existing sites and exports keep working."
|
|
10
|
+
],
|
|
11
|
+
"actions": [
|
|
12
|
+
"deploy-admin"
|
|
13
|
+
]
|
|
14
|
+
},
|
|
4
15
|
{
|
|
5
16
|
"version": "0.1.0",
|
|
6
17
|
"date": "2026-10-23",
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.1.
|
|
2
|
+
"version": "0.1.1",
|
|
3
3
|
"dataSchema": 1,
|
|
4
4
|
"files": [
|
|
5
|
-
"assets/CodeEditor-
|
|
5
|
+
"assets/CodeEditor-Wx1WlF3h.js",
|
|
6
6
|
"assets/flexweg-logo-CdtuqAFA.png",
|
|
7
|
-
"assets/index-
|
|
7
|
+
"assets/index-DFVZw8E0.js",
|
|
8
8
|
"assets/index-DMcGogR2.css",
|
|
9
|
+
"assets/sql-wasm-Bfkbn6Oa.js",
|
|
9
10
|
"assets/sql-wasm-C1U8OeUW.wasm",
|
|
10
|
-
"assets/sql-wasm-CYl3LXH_.js",
|
|
11
11
|
"assets/sql-wasm-V5jTDcrT.js",
|
|
12
12
|
"external.default.json",
|
|
13
13
|
"index.html",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{k as Rd,b as Md,s as jd,r as ge,j as Xs,u as Wd,c as zd}from"./index-
|
|
1
|
+
import{k as Rd,b as Md,s as jd,r as ge,j as Xs,u as Wd,c as zd}from"./index-DFVZw8E0.js";function As(){return As=Object.assign?Object.assign.bind():function(n){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var i in t)({}).hasOwnProperty.call(t,i)&&(n[i]=t[i])}return n},As.apply(null,arguments)}function Yd(n,e){if(n==null)return{};var t={};for(var i in n)if({}.hasOwnProperty.call(n,i)){if(e.indexOf(i)!==-1)continue;t[i]=n[i]}return t}let Rs=[],Fh=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,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 e=0,t=0;e<n.length;e++)(e%2?Fh:Rs).push(t=t+n[e])})();function Vd(n){if(n<768)return!1;for(let e=0,t=Rs.length;;){let i=e+t>>1;if(n<Rs[i])t=i;else if(n>=Fh[i])e=i+1;else return!0;if(e==t)return!1}}function vl(n){return n>=127462&&n<=127487}const Pl=8205;function Ed(n,e,t=!0,i=!0){return(t?Hh:_d)(n,e,i)}function Hh(n,e,t){if(e==n.length)return e;e&&Kh(n.charCodeAt(e))&&Jh(n.charCodeAt(e-1))&&e--;let i=Ir(n,e);for(e+=Tl(i);e<n.length;){let r=Ir(n,e);if(i==Pl||r==Pl||t&&Vd(r))e+=Tl(r),i=r;else if(vl(r)){let s=0,o=e-2;for(;o>=0&&vl(Ir(n,o));)s++,o-=2;if(s%2==0)break;e+=2}else break}return e}function _d(n,e,t){for(;e>0;){let i=Hh(n,e-2,t);if(i<e)return i;e--}return 0}function Ir(n,e){let t=n.charCodeAt(e);if(!Jh(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Kh(i)?(t-55296<<10)+(i-56320)+65536:t}function Kh(n){return n>=56320&&n<57344}function Jh(n){return n>=55296&&n<56320}function Tl(n){return n<65536?1:2}class L{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=hi(this,e,t);let r=[];return this.decompose(0,e,r,2),i.length&&i.decompose(0,i.length,r,3),this.decompose(t,this.length,r,1),tt.from(r,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=hi(this,e,t);let i=[];return this.decompose(e,t,i,0),tt.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),r=new ji(this),s=new ji(e);for(let o=t,l=t;;){if(r.next(o),s.next(o),o=0,r.lineBreak!=s.lineBreak||r.done!=s.done||r.value!=s.value)return!1;if(l+=r.value.length,r.done||l>=i)return!0}}iter(e=1){return new ji(this,e)}iterRange(e,t=this.length){return new ec(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let r=this.line(e).from;i=this.iterRange(r,Math.max(r,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new tc(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?L.empty:e.length<=32?new ie(e):tt.from(ie.split(e,[]))}}class ie extends L{constructor(e,t=Dd(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.text[s],l=r+o.length;if((t?i:l)>=e)return new Ld(r,l,i,o);r=l+1,i++}}decompose(e,t,i,r){let s=e<=0&&t>=this.length?this:new ie(Cl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(r&1){let o=i.pop(),l=En(s.text,o.text.slice(),0,s.length);if(l.length<=32)i.push(new ie(l,o.length+s.length));else{let a=l.length>>1;i.push(new ie(l.slice(0,a)),new ie(l.slice(a)))}}else i.push(s)}replace(e,t,i){if(!(i instanceof ie))return super.replace(e,t,i);[e,t]=hi(this,e,t);let r=En(this.text,En(i.text,Cl(this.text,0,e)),t),s=this.length+i.length-(t-e);return r.length<=32?new ie(r,s):tt.from(ie.split(r,[]),s)}sliceString(e,t=this.length,i=`
|
|
2
2
|
`){[e,t]=hi(this,e,t);let r="";for(let s=0,o=0;s<=t&&o<this.text.length;o++){let l=this.text[o],a=s+l.length;s>e&&o&&(r+=i),e<a&&t>s&&(r+=l.slice(Math.max(0,e-s),t-s)),s=a+1}return r}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],r=-1;for(let s of e)i.push(s),r+=s.length+1,i.length==32&&(t.push(new ie(i,r)),i=[],r=-1);return r>-1&&t.push(new ie(i,r)),t}}class tt extends L{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,r){for(let s=0;;s++){let o=this.children[s],l=r+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,r);r=l+1,i=a+1}}decompose(e,t,i,r){for(let s=0,o=0;o<=t&&s<this.children.length;s++){let l=this.children[s],a=o+l.length;if(e<=a&&t>=o){let h=r&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=hi(this,e,t),i.lines<this.lines)for(let r=0,s=0;r<this.children.length;r++){let o=this.children[r],l=s+o.length;if(e>=s&&t<=l){let a=o.replace(e-s,t-s,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let c=this.children.slice();return c[r]=a,new tt(c,this.length-(t-e)+i.length)}return super.replace(s,l,a)}s=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=`
|
|
3
3
|
`){[e,t]=hi(this,e,t);let r="";for(let s=0,o=0;s<this.children.length&&o<=t;s++){let l=this.children[s],a=o+l.length;o>e&&s&&(r+=i),e<a&&t>o&&(r+=l.sliceString(e-o,t-o,i)),o=a+1}return r}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof tt))return 0;let i=0,[r,s,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;r+=t,s+=t){if(r==o||s==l)return i;let a=this.children[r],h=e.children[s];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,r)=>i+r.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let O of e)O.flatten(d);return new ie(d,t)}let r=Math.max(32,i>>5),s=r<<1,o=r>>1,l=[],a=0,h=-1,c=[];function f(d){let O;if(d.lines>s&&d instanceof tt)for(let p of d.children)f(p);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof ie&&a&&(O=c[c.length-1])instanceof ie&&d.lines+O.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new ie(O.text.concat(d.text),O.length+1+d.length)):(a+d.lines>r&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:tt.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new tt(l,t)}}L.empty=new ie([""],0);function Dd(n){let e=-1;for(let t of n)e+=t.length+1;return e}function En(n,e,t=0,i=1e9){for(let r=0,s=0,o=!0;s<n.length&&r<=i;s++){let l=n[s],a=r+l.length;a>=t&&(a>i&&(l=l.slice(0,i-r)),r<t&&(l=l.slice(t-r)),o?(e[e.length-1]+=l,o=!1):e.push(l)),r=a+1}return e}function Cl(n,e,t){return En(n,[""],e,t)}class ji{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 ie?e.text.length:e.children.length)<<1]}nextInner(e,t){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,r=this.nodes[i],s=this.offsets[i],o=s>>1,l=r instanceof ie?r.text.length:r.children.length;if(o==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((s&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=`
|
|
4
4
|
`,this;e--}else if(r instanceof ie){let a=r.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=r.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof ie?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class ec{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new ji(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:r}=this.cursor.next(e);return this.pos+=(r.length+e)*t,this.value=r.length<=i?r:t<0?r.slice(r.length-i):r.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class tc{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:r}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=r,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(L.prototype[Symbol.iterator]=function(){return this.iter()},ji.prototype[Symbol.iterator]=ec.prototype[Symbol.iterator]=tc.prototype[Symbol.iterator]=function(){return this});class Ld{constructor(e,t,i,r){this.from=e,this.to=t,this.number=i,this.text=r}get length(){return this.to-this.from}}function hi(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function he(n,e,t=!0,i=!0){return Ed(n,e,t,i)}function qd(n){return n>=56320&&n<57344}function Bd(n){return n>=55296&&n<56320}function $e(n,e){let t=n.charCodeAt(e);if(!Bd(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return qd(i)?(t-55296<<10)+(i-56320)+65536:t}function Xo(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function it(n){return n<65536?1:2}const Ms=/\r\n?|\n/;var ue=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(ue||(ue={}));class at{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 i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,r=0;t<this.sections.length;){let s=this.sections[t++],o=this.sections[t++];o<0?(e(i,r,s),r+=s):r+=o,i+=s}}iterChangedRanges(e,t=!1){js(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];r<0?e.push(i,r):e.push(r,i)}return new at(e)}composeDesc(e){return this.empty?e:e.empty?this:ic(this,e)}mapDesc(e,t=!1){return e.empty?this:Ws(this,e,t)}mapPos(e,t=-1,i=ue.Simple){let r=0,s=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=r+l;if(a<0){if(h>e)return s+(e-r);s+=l}else{if(i!=ue.Simple&&h>=e&&(i==ue.TrackDel&&r<e&&h>e||i==ue.TrackBefore&&r<e||i==ue.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!l)return e==r||t<0?s:s+a;s+=a}r=h}if(e>r)throw new RangeError(`Position ${e} is out of range for changeset of length ${r}`);return s}touchesRange(e,t=e){for(let i=0,r=0;i<this.sections.length&&r<=t;){let s=this.sections[i++],o=this.sections[i++],l=r+s;if(o>=0&&r<=t&&l>=e)return r<e&&l>t?"cover":!0;r=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],r=this.sections[t++];e+=(e?" ":"")+i+(r>=0?":"+r:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new at(e)}static create(e){return new at(e)}}class oe extends at{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return js(this,(t,i,r,s,o)=>e=e.replace(r,r+(i-t),o),!1),e}mapDesc(e,t=!1){return Ws(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let r=0,s=0;r<t.length;r+=2){let o=t[r],l=t[r+1];if(l>=0){t[r]=l,t[r+1]=o;let a=r>>1;for(;i.length<a;)i.push(L.empty);i.push(o?e.slice(s,s+o):L.empty)}s+=o}return new oe(t,i)}compose(e){return this.empty?e:e.empty?this:ic(this,e,!0)}map(e,t=!1){return e.empty?this:Ws(this,e,t,!0)}iterChanges(e,t=!1){js(this,e,t)}get desc(){return at.create(this.sections)}filter(e){let t=[],i=[],r=[],s=new Di(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&s.len==0;){if(s.done)break e;let c=Math.min(s.len,a-l);Se(r,c,-1);let f=s.ins==-1?-1:s.off==0?s.ins:0;Se(t,c,f),f>0&&wt(i,t,s.text),s.forward(c),l+=c}let h=e[o++];for(;l<h;){if(s.done)break e;let c=Math.min(s.len,h-l);Se(t,c,-1),Se(r,c,s.ins==-1?-1:s.off==0?s.ins:0),s.forward(c),l+=c}}return{changes:new oe(t,i),filtered:at.create(r)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],r=this.sections[t+1];r<0?e.push(i):r==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let r=[],s=[],o=0,l=null;function a(c=!1){if(!c&&!r.length)return;o<t&&Se(r,t-o,-1);let f=new oe(r,s);l=l?l.compose(f.map(l)):f,r=[],s=[],o=0}function h(c){if(Array.isArray(c))for(let f of c)h(f);else if(c instanceof oe){if(c.length!=t)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${t})`);a(),l=l?l.compose(c.map(l)):c}else{let{from:f,to:u=f,insert:d}=c;if(f>u||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let O=d?typeof d=="string"?L.of(d.split(i||Ms)):d:L.empty,p=O.length;if(f==u&&p==0)return;f<o&&a(),f>o&&Se(r,f-o,-1),Se(r,u-f,p),wt(s,r,O),o=u}}return h(e),a(!l),l}static empty(e){return new oe(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let r=0;r<e.length;r++){let s=e[r];if(typeof s=="number")t.push(s,-1);else{if(!Array.isArray(s)||typeof s[0]!="number"||s.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(s.length==1)t.push(s[0],0);else{for(;i.length<r;)i.push(L.empty);i[r]=L.of(s.slice(1)),t.push(s[0],i[r].length)}}}return new oe(t,i)}static createSet(e,t){return new oe(e,t)}}function Se(n,e,t,i=!1){if(e==0&&t<=0)return;let r=n.length-2;r>=0&&t<=0&&t==n[r+1]?n[r]+=e:r>=0&&e==0&&n[r]==0?n[r+1]+=t:i?(n[r]+=e,n[r+1]+=t):n.push(e,t)}function wt(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(L.empty);n.push(t)}}function js(n,e,t){let i=n.inserted;for(let r=0,s=0,o=0;o<n.sections.length;){let l=n.sections[o++],a=n.sections[o++];if(a<0)r+=l,s+=l;else{let h=r,c=s,f=L.empty;for(;h+=l,c+=a,a&&i&&(f=f.append(i[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(r,h,s,c,f),r=h,s=c}}}function Ws(n,e,t,i=!1){let r=[],s=i?[]:null,o=new Di(n),l=new Di(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);Se(r,h,-1),o.forward(h),l.forward(h)}else if(l.ins>=0&&(o.ins<0||a==o.i||o.off==0&&(l.len<o.len||l.len==o.len&&!t))){let h=l.len;for(Se(r,l.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=c&&(Se(r,0,o.ins),s&&wt(s,r,o.text),a=o.i),o.forward(c),h-=c}l.next()}else if(o.ins>=0){let h=0,c=o.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);h+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;Se(r,h,a<o.i?o.ins:0),s&&a<o.i&&wt(s,r,o.text),a=o.i,o.forward(o.len-c)}else{if(o.done&&l.done)return s?oe.createSet(r,s):at.create(r);throw new Error("Mismatched change set lengths")}}}function ic(n,e,t=!1){let i=[],r=t?[]:null,s=new Di(n),o=new Di(e);for(let l=!1;;){if(s.done&&o.done)return r?oe.createSet(i,r):at.create(i);if(s.ins==0)Se(i,s.len,0,l),s.next();else if(o.len==0&&!o.done)Se(i,0,o.ins,l),r&&wt(r,i,o.text),o.next();else{if(s.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(s.len2,o.len),h=i.length;if(s.ins==-1){let c=o.ins==-1?-1:o.off?0:o.ins;Se(i,a,c,l),r&&c&&wt(r,i,o.text)}else o.ins==-1?(Se(i,s.off?0:s.len,a,l),r&&wt(r,i,s.textBit(a))):(Se(i,s.off?0:s.len,o.off?0:o.ins,l),r&&!o.off&&wt(r,i,o.text));l=(s.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),s.forward2(a),o.forward(a)}}}}class Di{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?L.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?L.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Yt{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,r;return this.empty?i=r=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),r=e.mapPos(this.to,-1)),i==this.from&&r==this.to?this:new Yt(i,r,this.flags)}extend(e,t=e,i=0){if(e<=this.anchor&&t>=this.anchor)return b.range(e,t,void 0,void 0,i);let r=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return b.range(this.anchor,r,void 0,void 0,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return b.range(e.anchor,e.head)}static create(e,t,i){return new Yt(e,t,i)}}class b{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:b.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new b([this.main],0)}addRange(e,t=!0){return b.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,b.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new b(e.ranges.map(t=>Yt.fromJSON(t)),e.main)}static single(e,t=e){return new b([b.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,r=0;r<e.length;r++){let s=e[r];if(s.empty?s.from<=i:s.from<i)return b.normalized(e.slice(),t);i=s.to}return new b(e,t)}static cursor(e,t=0,i,r){return Yt.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(r??16777215)<<6)}static range(e,t,i,r,s){let o=(i??16777215)<<6|(r==null?7:Math.min(6,r));return!s&&e!=t&&(s=t<e?1:-1),t<e?Yt.create(t,e,48|o):Yt.create(e,t,(s?s<0?8:16:0)|o)}static normalized(e,t=0){let i=e[t];e.sort((r,s)=>r.from-s.from),t=e.indexOf(i);for(let r=1;r<e.length;r++){let s=e[r],o=e[r-1];if(s.empty?s.from<=o.to:s.from<o.to){let l=o.from,a=Math.max(s.to,o.to);r<=t&&t--,e.splice(--r,2,s.anchor>s.head?b.range(a,l):b.range(l,a))}}return new b(e,t)}}function nc(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let Ao=0;class T{constructor(e,t,i,r,s){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=r,this.id=Ao++,this.default=e([]),this.extensions=typeof s=="function"?s(this):s}get reader(){return this}static define(e={}){return new T(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:Ro),!!e.static,e.enables)}of(e){return new _n([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new _n(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new _n(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function Ro(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class _n{constructor(e,t,i,r){this.dependencies=e,this.facet=t,this.type=i,this.value=r,this.id=Ao++}dynamicSlot(e){var t;let i=this.value,r=this.facet.compareInput,s=this.id,o=e[s]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||zs(f,c)){let d=i(f);if(l?!Zl(d,f.values[o],r):!r(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,O=u.config.address[s];if(O!=null){let p=Jn(u,O);if(this.dependencies.every(g=>g instanceof T?u.facet(g)===f.facet(g):g instanceof Oe?u.field(g,!1)==f.field(g,!1):!0)||(l?Zl(d=i(f),p,r):r(d=i(f),p)))return f.values[o]=p,0}else d=i(f);return f.values[o]=d,1}}}}function Zl(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function zs(n,e){let t=!1;for(let i of e)Wi(n,i)&1&&(t=!0);return t}function Id(n,e,t){let i=t.map(a=>n[a.id]),r=t.map(a=>a.type),s=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;c<i.length;c++){let f=Jn(a,i[c]);if(r[c]==2)for(let u of f)h.push(u);else h.push(f)}return e.combine(h)}return{create(a){for(let h of i)Wi(a,h);return a.values[o]=l(a),1},update(a,h){if(!zs(a,s))return 0;let c=l(a);return e.compare(c,a.values[o])?0:(a.values[o]=c,1)},reconfigure(a,h){let c=zs(a,i),f=h.config.facets[e.id],u=h.facet(e);if(f&&!c&&Ro(t,f))return a.values[o]=u,0;let d=l(a);return e.compare(d,u)?(a.values[o]=u,0):(a.values[o]=d,1)}}}const gn=T.define({static:!0});class Oe{constructor(e,t,i,r,s){this.id=e,this.createF=t,this.updateF=i,this.compareF=r,this.spec=s,this.provides=void 0}static define(e){let t=new Oe(Ao++,e.create,e.update,e.compare||((i,r)=>i===r),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(gn).find(i=>i.field==this);return((t==null?void 0:t.create)||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,r)=>{let s=i.values[t],o=this.updateF(s,r);return this.compareF(s,o)?0:(i.values[t]=o,1)},reconfigure:(i,r)=>{let s=i.facet(gn),o=r.facet(gn),l;return(l=s.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):r.config.address[this.id]!=null?(i.values[t]=r.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,gn.of({field:this,create:e})]}get extension(){return this}}const Wt={lowest:4,low:3,default:2,high:1,highest:0};function ki(n){return e=>new rc(e,n)}const Xt={highest:ki(Wt.highest),high:ki(Wt.high),default:ki(Wt.default),low:ki(Wt.low),lowest:ki(Wt.lowest)};class rc{constructor(e,t){this.inner=e,this.prec=t}}class Cr{of(e){return new Ys(this,e)}reconfigure(e){return Cr.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Ys{constructor(e,t){this.compartment=e,this.inner=t}}class Kn{constructor(e,t,i,r,s,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=r,this.staticValues=s,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let r=[],s=Object.create(null),o=new Map;for(let u of Nd(e,t,o))u instanceof Oe?r.push(u):(s[u.facet.id]||(s[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of r)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let c=i==null?void 0:i.config.facets;for(let u in s){let d=s[u],O=d[0].facet,p=c&&c[u]||[];if(d.every(g=>g.type==0))if(l[O.id]=a.length<<1|1,Ro(p,d))a.push(i.facet(O));else{let g=O.combine(d.map(S=>S.value));a.push(i&&O.compare(g,i.facet(O))?i.facet(O):g)}else{for(let g of d)g.type==0?(l[g.id]=a.length<<1|1,a.push(g.value)):(l[g.id]=h.length<<1,h.push(S=>g.dynamicSlot(S)));l[O.id]=h.length<<1,h.push(g=>Id(g,O,d))}}let f=h.map(u=>u(l));return new Kn(e,o,f,l,a,s)}}function Nd(n,e,t){let i=[[],[],[],[],[]],r=new Map;function s(o,l){let a=r.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof Ys&&t.delete(o.compartment)}if(r.set(o,l),Array.isArray(o))for(let h of o)s(h,l);else if(o instanceof Ys){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),s(h,l)}else if(o instanceof rc)s(o.inner,o.prec);else if(o instanceof Oe)i[l].push(o),o.provides&&s(o.provides,l);else if(o instanceof _n)i[l].push(o),o.facet.extensions&&s(o.facet.extensions,Wt.default);else{let h=o.extension;if(!h)throw new Error(`Unrecognized extension value in extension set (${o}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);s(h,l)}}return s(n,Wt.default),i.reduce((o,l)=>o.concat(l))}function Wi(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let r=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|r}function Jn(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const sc=T.define(),Vs=T.define({combine:n=>n.some(e=>e),static:!0}),oc=T.define({combine:n=>n.length?n[0]:void 0,static:!0}),lc=T.define(),ac=T.define(),hc=T.define(),cc=T.define({combine:n=>n.length?n[0]:!1});class ct{constructor(e,t){this.type=e,this.value=t}static define(){return new Gd}}class Gd{of(e){return new ct(this,e)}}class Ud{constructor(e){this.map=e}of(e){return new j(this,e)}}class j{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new j(this.type,t)}is(e){return this.type==e}static define(e={}){return new Ud(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let r of e){let s=r.map(t);s&&i.push(s)}return i}}j.reconfigure=j.define();j.appendConfig=j.define();class re{constructor(e,t,i,r,s,o){this.startState=e,this.changes=t,this.selection=i,this.effects=r,this.annotations=s,this.scrollIntoView=o,this._doc=null,this._state=null,i&&nc(i,t.newLength),s.some(l=>l.type==re.time)||(this.annotations=s.concat(re.time.of(Date.now())))}static create(e,t,i,r,s,o){return new re(e,t,i,r,s,o)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(re.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}re.time=ct.define();re.userEvent=ct.define();re.addToHistory=ct.define();re.remote=ct.define();function Fd(n,e){let t=[];for(let i=0,r=0;;){let s,o;if(i<n.length&&(r==e.length||e[r]>=n[i]))s=n[i++],o=n[i++];else if(r<e.length)s=e[r++],o=e[r++];else return t;!t.length||t[t.length-1]<s?t.push(s,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function fc(n,e,t){var i;let r,s,o;return t?(r=e.changes,s=oe.empty(e.changes.length),o=n.changes.compose(e.changes)):(r=e.changes.map(n.changes),s=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(r)),{changes:o,selection:e.selection?e.selection.map(s):(i=n.selection)===null||i===void 0?void 0:i.map(r),effects:j.mapEffects(n.effects,r).concat(j.mapEffects(e.effects,s)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function Es(n,e,t){let i=e.selection,r=ti(e.annotations);return e.userEvent&&(r=r.concat(re.userEvent.of(e.userEvent))),{changes:e.changes instanceof oe?e.changes:oe.of(e.changes||[],t,n.facet(oc)),selection:i&&(i instanceof b?i:b.single(i.anchor,i.head)),effects:ti(e.effects),annotations:r,scrollIntoView:!!e.scrollIntoView}}function uc(n,e,t){let i=Es(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let s=1;s<e.length;s++){e[s].filter===!1&&(t=!1);let o=!!e[s].sequential;i=fc(i,Es(n,e[s],o?i.changes.newLength:n.doc.length),o)}let r=re.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return Kd(t?Hd(r):r)}function Hd(n){let e=n.startState,t=!0;for(let r of e.facet(lc)){let s=r(n);if(s===!1){t=!1;break}Array.isArray(s)&&(t=t===!0?s:Fd(t,s))}if(t!==!0){let r,s;if(t===!1)s=n.changes.invertedDesc,r=oe.empty(e.doc.length);else{let o=n.changes.filter(t);r=o.changes,s=o.filtered.mapDesc(o.changes).invertedDesc}n=re.create(e,r,n.selection&&n.selection.map(s),j.mapEffects(n.effects,s),n.annotations,n.scrollIntoView)}let i=e.facet(ac);for(let r=i.length-1;r>=0;r--){let s=i[r](n);s instanceof re?n=s:Array.isArray(s)&&s.length==1&&s[0]instanceof re?n=s[0]:n=uc(e,ti(s),!1)}return n}function Kd(n){let e=n.startState,t=e.facet(hc),i=n;for(let r=t.length-1;r>=0;r--){let s=t[r](n);s&&Object.keys(s).length&&(i=fc(i,Es(e,s,n.changes.newLength),!0))}return i==n?n:re.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const Jd=[];function ti(n){return n==null?Jd:Array.isArray(n)?n:[n]}var H=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(H||(H={}));const eO=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let _s;try{_s=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function tO(n){if(_s)return _s.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>""&&(t.toUpperCase()!=t.toLowerCase()||eO.test(t)))return!0}return!1}function iO(n){return e=>{if(!/\S/.test(e))return H.Space;if(tO(e))return H.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return H.Word;return H.Other}}class D{constructor(e,t,i,r,s,o){this.config=e,this.doc=t,this.selection=i,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=s,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)Wi(this,l<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Wi(this,i),Jn(this,i)}update(...e){return uc(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:r}=t;for(let l of e.effects)l.is(Cr.reconfigure)?(t&&(r=new Map,t.compartments.forEach((a,h)=>r.set(h,a)),t=null),r.set(l.value.compartment,l.value.extension)):l.is(j.reconfigure)?(t=null,i=l.value):l.is(j.appendConfig)&&(t=null,i=ti(i).concat(l.value));let s;t?s=e.startState.values.slice():(t=Kn.resolve(i,r,this),s=new D(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(Vs)?e.newSelection:e.newSelection.asSingle();new D(t,e.newDoc,o,s,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:b.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),r=this.changes(i.changes),s=[i.range],o=ti(i.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),h=this.changes(a.changes),c=h.map(r);for(let u=0;u<l;u++)s[u]=s[u].map(c);let f=r.mapDesc(h,!0);s.push(a.range.map(f)),r=r.compose(c),o=j.mapEffects(o,c).concat(j.mapEffects(ti(a.effects),f))}return{changes:r,selection:b.create(s,t.mainIndex),effects:o}}changes(e=[]){return e instanceof oe?e:oe.of(e,this.doc.length,this.facet(D.lineSeparator))}toText(e){return L.of(e.split(this.facet(D.lineSeparator)||Ms))}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:(Wi(this,t),Jn(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let r=e[i];r instanceof Oe&&this.config.address[r.id]!=null&&(t[i]=r.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(i){for(let s in i)if(Object.prototype.hasOwnProperty.call(e,s)){let o=i[s],l=e[s];r.push(o.init(a=>o.spec.fromJSON(l,a)))}}return D.create({doc:e.doc,selection:b.fromJSON(e.selection),extensions:t.extensions?r.concat([t.extensions]):r})}static create(e={}){let t=Kn.resolve(e.extensions||[],new Map),i=e.doc instanceof L?e.doc:L.of((e.doc||"").split(t.staticFacet(D.lineSeparator)||Ms)),r=e.selection?e.selection instanceof b?e.selection:b.single(e.selection.anchor,e.selection.head):b.single(0);return nc(r,i.length),t.staticFacet(Vs)||(r=r.asSingle()),new D(t,i,r,t.dynamicSlots.map(()=>null),(s,o)=>o.create(s),null)}get tabSize(){return this.facet(D.tabSize)}get lineBreak(){return this.facet(D.lineSeparator)||`
|