UNPKG

@sync-in/server

Version:

The secure, open-source platform for file storage, sharing, collaboration, and sync

6 lines 310 kB
import{a as se,b as Gr}from"./chunk-KAVP6UXH.js";var Fn=[],Qr=[];(()=>{let s="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(t=>t?parseInt(t,36):1);for(let t=0,e=0;t<s.length;t++)(t%2?Qr:Fn).push(e=e+s[t])})();function oh(s){if(s<768)return!1;for(let t=0,e=Fn.length;;){let i=t+e>>1;if(s<Fn[i])e=i;else if(s>=Qr[i])t=i+1;else return!0;if(t==e)return!1}}function Yr(s){return s>=127462&&s<=127487}var Xr=8205;function Zr(s,t,e=!0,i=!0){return(e?to:lh)(s,t,i)}function to(s,t,e){if(t==s.length)return t;t&&eo(s.charCodeAt(t))&&io(s.charCodeAt(t-1))&&t--;let i=Hn(s,t);for(t+=Jr(i);t<s.length;){let n=Hn(s,t);if(i==Xr||n==Xr||e&&oh(n))t+=Jr(n),i=n;else if(Yr(n)){let r=0,o=t-2;for(;o>=0&&Yr(Hn(s,o));)r++,o-=2;if(r%2==0)break;t+=2}else break}return t}function lh(s,t,e){for(;t>0;){let i=to(s,t-2,e);if(i<t)return i;t--}return 0}function Hn(s,t){let e=s.charCodeAt(t);if(!io(e)||t+1==s.length)return e;let i=s.charCodeAt(t+1);return eo(i)?(e-55296<<10)+(i-56320)+65536:e}function eo(s){return s>=56320&&s<57344}function io(s){return s>=55296&&s<56320}function Jr(s){return s<65536?1:2}var I=class s{lineAt(t){if(t<0||t>this.length)throw new RangeError(`Invalid position ${t} in document of length ${this.length}`);return this.lineInner(t,!1,1,0)}line(t){if(t<1||t>this.lines)throw new RangeError(`Invalid line number ${t} in ${this.lines}-line document`);return this.lineInner(t,!0,1,0)}replace(t,e,i){[t,e]=Me(this,t,e);let n=[];return this.decompose(0,t,n,2),i.length&&i.decompose(0,i.length,n,3),this.decompose(e,this.length,n,1),Se.from(n,this.length-(e-t)+i.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=Me(this,t,e);let i=[];return this.decompose(t,e,i,0),Se.from(i,e-t)}eq(t){if(t==this)return!0;if(t.length!=this.length||t.lines!=this.lines)return!1;let e=this.scanIdentical(t,1),i=this.length-this.scanIdentical(t,-1),n=new le(this),r=new le(t);for(let o=e,l=e;;){if(n.next(o),r.next(o),o=0,n.lineBreak!=r.lineBreak||n.done!=r.done||n.value!=r.value)return!1;if(l+=n.value.length,n.done||l>=i)return!0}}iter(t=1){return new le(this,t)}iterRange(t,e=this.length){return new Oi(this,t,e)}iterLines(t,e){let i;if(t==null)i=this.iter();else{e==null&&(e=this.lines+1);let n=this.line(t).from;i=this.iterRange(n,Math.max(n,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new Di(i)}toString(){return this.sliceString(0)}toJSON(){let t=[];return this.flatten(t),t}constructor(){}static of(t){if(t.length==0)throw new RangeError("A document must have at least one line");return t.length==1&&!t[0]?s.empty:t.length<=32?new at(t):Se.from(at.split(t,[]))}},at=class s extends I{constructor(t,e=ah(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,i,n){for(let r=0;;r++){let o=this.text[r],l=n+o.length;if((e?i:l)>=t)return new zn(n,l,i,o);n=l+1,i++}}decompose(t,e,i,n){let r=t<=0&&e>=this.length?this:new s(no(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(n&1){let o=i.pop(),l=Ti(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new s(l,o.length+r.length));else{let a=l.length>>1;i.push(new s(l.slice(0,a)),new s(l.slice(a)))}}else i.push(r)}replace(t,e,i){if(!(i instanceof s))return super.replace(t,e,i);[t,e]=Me(this,t,e);let n=Ti(this.text,Ti(i.text,no(this.text,0,t)),e),r=this.length+i.length-(e-t);return n.length<=32?new s(n,r):Se.from(s.split(n,[]),r)}sliceString(t,e=this.length,i=` `){[t,e]=Me(this,t,e);let n="";for(let r=0,o=0;r<=e&&o<this.text.length;o++){let l=this.text[o],a=r+l.length;r>t&&o&&(n+=i),t<a&&e>r&&(n+=l.slice(Math.max(0,t-r),e-r)),r=a+1}return n}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let i=[],n=-1;for(let r of t)i.push(r),n+=r.length+1,i.length==32&&(e.push(new s(i,n)),i=[],n=-1);return n>-1&&e.push(new s(i,n)),e}},Se=class s extends I{constructor(t,e){super(),this.children=t,this.length=e,this.lines=0;for(let i of t)this.lines+=i.lines}lineInner(t,e,i,n){for(let r=0;;r++){let o=this.children[r],l=n+o.length,a=i+o.lines-1;if((e?a:l)>=t)return o.lineInner(t,e,i,n);n=l+1,i=a+1}}decompose(t,e,i,n){for(let r=0,o=0;o<=e&&r<this.children.length;r++){let l=this.children[r],a=o+l.length;if(t<=a&&e>=o){let h=n&((o<=t?1:0)|(a>=e?2:0));o>=t&&a<=e&&!h?i.push(l):l.decompose(t-o,e-o,i,h)}o=a+1}}replace(t,e,i){if([t,e]=Me(this,t,e),i.lines<this.lines)for(let n=0,r=0;n<this.children.length;n++){let o=this.children[n],l=r+o.length;if(t>=r&&e<=l){let a=o.replace(t-r,e-r,i),h=this.lines-o.lines+a.lines;if(a.lines<h>>4&&a.lines>h>>6){let f=this.children.slice();return f[n]=a,new s(f,this.length-(e-t)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(t,e,i)}sliceString(t,e=this.length,i=` `){[t,e]=Me(this,t,e);let n="";for(let r=0,o=0;r<this.children.length&&o<=e;r++){let l=this.children[r],a=o+l.length;o>t&&r&&(n+=i),t<a&&e>o&&(n+=l.sliceString(t-o,e-o,i)),o=a+1}return n}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof s))return 0;let i=0,[n,r,o,l]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;n+=e,r+=e){if(n==o||r==l)return i;let a=this.children[n],h=t.children[r];if(a!=h)return i+a.scanIdentical(h,e);i+=a.length+1}}static from(t,e=t.reduce((i,n)=>i+n.length+1,-1)){let i=0;for(let d of t)i+=d.lines;if(i<32){let d=[];for(let p of t)p.flatten(d);return new at(d,e)}let n=Math.max(32,i>>5),r=n<<1,o=n>>1,l=[],a=0,h=-1,f=[];function c(d){let p;if(d.lines>r&&d instanceof s)for(let g of d.children)c(g);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof at&&a&&(p=f[f.length-1])instanceof at&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,f[f.length-1]=new at(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>n&&u(),a+=d.lines,h+=d.length+1,f.push(d))}function u(){a!=0&&(l.push(f.length==1?f[0]:s.from(f,h)),h=-1,a=f.length=0)}for(let d of t)c(d);return u(),l.length==1?l[0]:new s(l,e)}};I.empty=new at([""],0);function ah(s){let t=-1;for(let e of s)t+=e.length+1;return t}function Ti(s,t,e=0,i=1e9){for(let n=0,r=0,o=!0;r<s.length&&n<=i;r++){let l=s[r],a=n+l.length;a>=e&&(a>i&&(l=l.slice(0,i-n)),n<e&&(l=l.slice(e-n)),o?(t[t.length-1]+=l,o=!1):t.push(l)),n=a+1}return t}function no(s,t,e){return Ti(s,[""],t,e)}var le=class{constructor(t,e=1){this.dir=e,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[t],this.offsets=[e>0?1:(t instanceof at?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,n=this.nodes[i],r=this.offsets[i],o=r>>1,l=n instanceof at?n.text.length:n.children.length;if(o==(e>0?l:0)){if(i==0)return this.done=!0,this.value="",this;e>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(e>0?0:1)){if(this.offsets[i]+=e,t==0)return this.lineBreak=!0,this.value=` `,this;t--}else if(n instanceof at){let a=n.text[o+(e<0?-1:0)];if(this.offsets[i]+=e,a.length>Math.max(0,t))return this.value=t==0?a:e>0?a.slice(t):a.slice(0,a.length-t),this;t-=a.length}else{let a=n.children[o+(e<0?-1:0)];t>a.length?(t-=a.length,this.offsets[i]+=e):(e<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(e>0?1:(a instanceof at?a.text.length:a.children.length)<<1))}}}next(t=0){return t<0&&(this.nextInner(-t,-this.dir),t=this.value.length),this.nextInner(t,this.dir)}},Oi=class{constructor(t,e,i){this.value="",this.done=!1,this.cursor=new le(t,e>i?-1:1),this.pos=e>i?t.length:0,this.from=Math.min(e,i),this.to=Math.max(e,i)}nextInner(t,e){if(e<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;t+=Math.max(0,e<0?this.pos-this.to:this.from-this.pos);let i=e<0?this.pos-this.from:this.to-this.pos;t>i&&(t=i),i-=t;let{value:n}=this.cursor.next(t);return this.pos+=(n.length+t)*e,this.value=n.length<=i?n:e<0?n.slice(n.length-i):n.slice(0,i),this.done=!this.value,this}next(t=0){return t<0?t=Math.max(t,this.from-this.pos):t>0&&(t=Math.min(t,this.to-this.pos)),this.nextInner(t,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},Di=class{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:i,value:n}=this.inner.next(t);return e&&this.afterBreak?(this.value="",this.afterBreak=!1):e?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=n,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<"u"&&(I.prototype[Symbol.iterator]=function(){return this.iter()},le.prototype[Symbol.iterator]=Oi.prototype[Symbol.iterator]=Di.prototype[Symbol.iterator]=function(){return this});var zn=class{constructor(t,e,i,n){this.from=t,this.to=e,this.number=i,this.text=n}get length(){return this.to-this.from}};function Me(s,t,e){return t=Math.max(0,Math.min(s.length,t)),[t,Math.max(t,Math.min(s.length,e))]}function ht(s,t,e=!0,i=!0){return Zr(s,t,e,i)}function hh(s){return s>=56320&&s<57344}function fh(s){return s>=55296&&s<56320}function Zn(s,t){let e=s.charCodeAt(t);if(!fh(e)||t+1==s.length)return e;let i=s.charCodeAt(t+1);return hh(i)?(e-55296<<10)+(i-56320)+65536:e}function Eu(s){return s<=65535?String.fromCharCode(s):(s-=65536,String.fromCharCode((s>>10)+55296,(s&1023)+56320))}function fo(s){return s<65536?1:2}var qn=/\r\n?|\n/,it=(function(s){return s[s.Simple=0]="Simple",s[s.TrackDel=1]="TrackDel",s[s.TrackBefore=2]="TrackBefore",s[s.TrackAfter=3]="TrackAfter",s})(it||(it={})),ae=class s{constructor(t){this.sections=t}get length(){let t=0;for(let e=0;e<this.sections.length;e+=2)t+=this.sections[e];return t}get newLength(){let t=0;for(let e=0;e<this.sections.length;e+=2){let i=this.sections[e+1];t+=i<0?this.sections[e]:i}return t}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(t){for(let e=0,i=0,n=0;e<this.sections.length;){let r=this.sections[e++],o=this.sections[e++];o<0?(t(i,n,r),n+=r):n+=o,i+=r}}iterChangedRanges(t,e=!1){Kn(this,t,e)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let i=this.sections[e++],n=this.sections[e++];n<0?t.push(i,n):t.push(n,i)}return new s(t)}composeDesc(t){return this.empty?t:t.empty?this:co(this,t)}mapDesc(t,e=!1){return t.empty?this:jn(this,t,e)}mapPos(t,e=-1,i=it.Simple){let n=0,r=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=n+l;if(a<0){if(h>t)return r+(t-n);r+=l}else{if(i!=it.Simple&&h>=t&&(i==it.TrackDel&&n<t&&h>t||i==it.TrackBefore&&n<t||i==it.TrackAfter&&h>t))return null;if(h>t||h==t&&e<0&&!l)return t==n||e<0?r:r+a;r+=a}n=h}if(t>n)throw new RangeError(`Position ${t} is out of range for changeset of length ${n}`);return r}touchesRange(t,e=t){for(let i=0,n=0;i<this.sections.length&&n<=e;){let r=this.sections[i++],o=this.sections[i++],l=n+r;if(o>=0&&n<=e&&l>=t)return n<t&&l>e?"cover":!0;n=l}return!1}toString(){let t="";for(let e=0;e<this.sections.length;){let i=this.sections[e++],n=this.sections[e++];t+=(t?" ":"")+i+(n>=0?":"+n:"")}return t}toJSON(){return this.sections}static fromJSON(t){if(!Array.isArray(t)||t.length%2||t.some(e=>typeof e!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new s(t)}static create(t){return new s(t)}},ft=class s extends ae{constructor(t,e){super(t),this.inserted=e}apply(t){if(this.length!=t.length)throw new RangeError("Applying change set to a document with the wrong length");return Kn(this,(e,i,n,r,o)=>t=t.replace(n,n+(i-e),o),!1),t}mapDesc(t,e=!1){return jn(this,t,e,!0)}invert(t){let e=this.sections.slice(),i=[];for(let n=0,r=0;n<e.length;n+=2){let o=e[n],l=e[n+1];if(l>=0){e[n]=l,e[n+1]=o;let a=n>>1;for(;i.length<a;)i.push(I.empty);i.push(o?t.slice(r,r+o):I.empty)}r+=o}return new s(e,i)}compose(t){return this.empty?t:t.empty?this:co(this,t,!0)}map(t,e=!1){return t.empty?this:jn(this,t,e,!0)}iterChanges(t,e=!1){Kn(this,t,e)}get desc(){return ae.create(this.sections)}filter(t){let e=[],i=[],n=[],r=new he(this);t:for(let o=0,l=0;;){let a=o==t.length?1e9:t[o++];for(;l<a||l==a&&r.len==0;){if(r.done)break t;let f=Math.min(r.len,a-l);Z(n,f,-1);let c=r.ins==-1?-1:r.off==0?r.ins:0;Z(e,f,c),c>0&&_t(i,e,r.text),r.forward(f),l+=f}let h=t[o++];for(;l<h;){if(r.done)break t;let f=Math.min(r.len,h-l);Z(e,f,-1),Z(n,f,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(f),l+=f}}return{changes:new s(e,i),filtered:ae.create(n)}}toJSON(){let t=[];for(let e=0;e<this.sections.length;e+=2){let i=this.sections[e],n=this.sections[e+1];n<0?t.push(i):n==0?t.push([i]):t.push([i].concat(this.inserted[e>>1].toJSON()))}return t}static of(t,e,i){let n=[],r=[],o=0,l=null;function a(f=!1){if(!f&&!n.length)return;o<e&&Z(n,e-o,-1);let c=new s(n,r);l=l?l.compose(c.map(l)):c,n=[],r=[],o=0}function h(f){if(Array.isArray(f))for(let c of f)h(c);else if(f instanceof s){if(f.length!=e)throw new RangeError(`Mismatched change set length (got ${f.length}, expected ${e})`);a(),l=l?l.compose(f.map(l)):f}else{let{from:c,to:u=c,insert:d}=f;if(c>u||c<0||u>e)throw new RangeError(`Invalid change range ${c} to ${u} (in doc of length ${e})`);let p=d?typeof d=="string"?I.of(d.split(i||qn)):d:I.empty,g=p.length;if(c==u&&g==0)return;c<o&&a(),c>o&&Z(n,c-o,-1),Z(n,u-c,g),_t(r,n,p),o=u}}return h(t),a(!l),l}static empty(t){return new s(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let e=[],i=[];for(let n=0;n<t.length;n++){let r=t[n];if(typeof r=="number")e.push(r,-1);else{if(!Array.isArray(r)||typeof r[0]!="number"||r.some((o,l)=>l&&typeof o!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(r.length==1)e.push(r[0],0);else{for(;i.length<n;)i.push(I.empty);i[n]=I.of(r.slice(1)),e.push(r[0],i[n].length)}}}return new s(e,i)}static createSet(t,e){return new s(t,e)}};function Z(s,t,e,i=!1){if(t==0&&e<=0)return;let n=s.length-2;n>=0&&e<=0&&e==s[n+1]?s[n]+=t:n>=0&&t==0&&s[n]==0?s[n+1]+=e:i?(s[n]+=t,s[n+1]+=e):s.push(t,e)}function _t(s,t,e){if(e.length==0)return;let i=t.length-2>>1;if(i<s.length)s[s.length-1]=s[s.length-1].append(e);else{for(;s.length<i;)s.push(I.empty);s.push(e)}}function Kn(s,t,e){let i=s.inserted;for(let n=0,r=0,o=0;o<s.sections.length;){let l=s.sections[o++],a=s.sections[o++];if(a<0)n+=l,r+=l;else{let h=n,f=r,c=I.empty;for(;h+=l,f+=a,a&&i&&(c=c.append(i[o-2>>1])),!(e||o==s.sections.length||s.sections[o+1]<0);)l=s.sections[o++],a=s.sections[o++];t(n,h,r,f,c),n=h,r=f}}}function jn(s,t,e,i=!1){let n=[],r=i?[]:null,o=new he(s),l=new he(t);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);Z(n,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&&!e))){let h=l.len;for(Z(n,l.ins,-1);h;){let f=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=f&&(Z(n,0,o.ins),r&&_t(r,n,o.text),a=o.i),o.forward(f),h-=f}l.next()}else if(o.ins>=0){let h=0,f=o.len;for(;f;)if(l.ins==-1){let c=Math.min(f,l.len);h+=c,f-=c,l.forward(c)}else if(l.ins==0&&l.len<f)f-=l.len,l.next();else break;Z(n,h,a<o.i?o.ins:0),r&&a<o.i&&_t(r,n,o.text),a=o.i,o.forward(o.len-f)}else{if(o.done&&l.done)return r?ft.createSet(n,r):ae.create(n);throw new Error("Mismatched change set lengths")}}}function co(s,t,e=!1){let i=[],n=e?[]:null,r=new he(s),o=new he(t);for(let l=!1;;){if(r.done&&o.done)return n?ft.createSet(i,n):ae.create(i);if(r.ins==0)Z(i,r.len,0,l),r.next();else if(o.len==0&&!o.done)Z(i,0,o.ins,l),n&&_t(n,i,o.text),o.next();else{if(r.done||o.done)throw new Error("Mismatched change set lengths");{let a=Math.min(r.len2,o.len),h=i.length;if(r.ins==-1){let f=o.ins==-1?-1:o.off?0:o.ins;Z(i,a,f,l),n&&f&&_t(n,i,o.text)}else o.ins==-1?(Z(i,r.off?0:r.len,a,l),n&&_t(n,i,r.textBit(a))):(Z(i,r.off?0:r.len,o.off?0:o.ins,l),n&&!o.off&&_t(n,i,o.text));l=(r.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}var he=class{constructor(t){this.set=t,this.i=0,this.next()}next(){let{sections:t}=this.set;this.i<t.length?(this.len=t[this.i++],this.ins=t[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:t}=this.set,e=this.i-2>>1;return e>=t.length?I.empty:t[e]}textBit(t){let{inserted:e}=this.set,i=this.i-2>>1;return i>=e.length&&!t?I.empty:e[i].slice(this.off,t==null?void 0:this.off+t)}forward(t){t==this.len?this.next():(this.len-=t,this.off+=t)}forward2(t){this.ins==-1?this.forward(t):t==this.ins?this.next():(this.ins-=t,this.off+=t)}},ke=class s{constructor(t,e,i){this.from=t,this.to=e,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 t=this.flags&7;return t==7?null:t}get goalColumn(){let t=this.flags>>6;return t==16777215?void 0:t}map(t,e=-1){let i,n;return this.empty?i=n=t.mapPos(this.from,e):(i=t.mapPos(this.from,1),n=t.mapPos(this.to,-1)),i==this.from&&n==this.to?this:new s(i,n,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return T.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return T.range(this.anchor,i)}eq(t,e=!1){return this.anchor==t.anchor&&this.head==t.head&&(!e||!this.empty||this.assoc==t.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(t){if(!t||typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return T.range(t.anchor,t.head)}static create(t,e,i){return new s(t,e,i)}},T=class s{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:s.create(this.ranges.map(i=>i.map(t,e)),this.mainIndex)}eq(t,e=!1){if(this.ranges.length!=t.ranges.length||this.mainIndex!=t.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(t.ranges[i],e))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new s([this.main],0)}addRange(t,e=!0){return s.create([t].concat(this.ranges),e?0:this.mainIndex+1)}replaceRange(t,e=this.mainIndex){let i=this.ranges.slice();return i[e]=t,s.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(t=>t.toJSON()),main:this.mainIndex}}static fromJSON(t){if(!t||!Array.isArray(t.ranges)||typeof t.main!="number"||t.main>=t.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new s(t.ranges.map(e=>ke.fromJSON(e)),t.main)}static single(t,e=t){return new s([s.range(t,e)],0)}static create(t,e=0){if(t.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,n=0;n<t.length;n++){let r=t[n];if(r.empty?r.from<=i:r.from<i)return s.normalized(t.slice(),e);i=r.to}return new s(t,e)}static cursor(t,e=0,i,n){return ke.create(t,t,(e==0?0:e<0?8:16)|(i==null?7:Math.min(6,i))|(n??16777215)<<6)}static range(t,e,i,n){let r=(i??16777215)<<6|(n==null?7:Math.min(6,n));return e<t?ke.create(e,t,48|r):ke.create(t,e,(e>t?8:0)|r)}static normalized(t,e=0){let i=t[e];t.sort((n,r)=>n.from-r.from),e=t.indexOf(i);for(let n=1;n<t.length;n++){let r=t[n],o=t[n-1];if(r.empty?r.from<=o.to:r.from<o.to){let l=o.from,a=Math.max(r.to,o.to);n<=e&&e--,t.splice(--n,2,r.anchor>r.head?s.range(a,l):s.range(l,a))}}return new s(t,e)}};function uo(s,t){for(let e of s.ranges)if(e.to>t)throw new RangeError("Selection points outside of document")}var ts=0,A=class s{constructor(t,e,i,n,r){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=n,this.id=ts++,this.default=t([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(t={}){return new s(t.combine||(e=>e),t.compareInput||((e,i)=>e===i),t.compare||(t.combine?(e,i)=>e===i:es),!!t.static,t.enables)}of(t){return new Ce([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ce(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new Ce(t,this,2,e)}from(t,e){return e||(e=i=>i),this.compute([t],i=>e(i.field(t)))}};function es(s,t){return s==t||s.length==t.length&&s.every((e,i)=>e===t[i])}var Ce=class{constructor(t,e,i,n){this.dependencies=t,this.facet=e,this.type=i,this.value=n,this.id=ts++}dynamicSlot(t){var e;let i=this.value,n=this.facet.compareInput,r=this.id,o=t[r]>>1,l=this.type==2,a=!1,h=!1,f=[];for(let c of this.dependencies)c=="doc"?a=!0:c=="selection"?h=!0:(((e=t[c.id])!==null&&e!==void 0?e:1)&1)==0&&f.push(t[c.id]);return{create(c){return c.values[o]=i(c),1},update(c,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||$n(c,f)){let d=i(c);if(l?!so(d,c.values[o],n):!n(d,c.values[o]))return c.values[o]=d,1}return 0},reconfigure:(c,u)=>{let d,p=u.config.address[r];if(p!=null){let g=Pi(u,p);if(this.dependencies.every(m=>m instanceof A?u.facet(m)===c.facet(m):m instanceof ct?u.field(m,!1)==c.field(m,!1):!0)||(l?so(d=i(c),g,n):n(d=i(c),g)))return c.values[o]=g,0}else d=i(c);return c.values[o]=d,1}}}};function so(s,t,e){if(s.length!=t.length)return!1;for(let i=0;i<s.length;i++)if(!e(s[i],t[i]))return!1;return!0}function $n(s,t){let e=!1;for(let i of t)qe(s,i)&1&&(e=!0);return e}function ch(s,t,e){let i=e.map(a=>s[a.id]),n=e.map(a=>a.type),r=i.filter(a=>!(a&1)),o=s[t.id]>>1;function l(a){let h=[];for(let f=0;f<i.length;f++){let c=Pi(a,i[f]);if(n[f]==2)for(let u of c)h.push(u);else h.push(c)}return t.combine(h)}return{create(a){for(let h of i)qe(a,h);return a.values[o]=l(a),1},update(a,h){if(!$n(a,r))return 0;let f=l(a);return t.compare(f,a.values[o])?0:(a.values[o]=f,1)},reconfigure(a,h){let f=$n(a,i),c=h.config.facets[t.id],u=h.facet(t);if(c&&!f&&es(e,c))return a.values[o]=u,0;let d=l(a);return t.compare(d,u)?(a.values[o]=u,0):(a.values[o]=d,1)}}}var Ci=A.define({static:!0}),ct=class s{constructor(t,e,i,n,r){this.id=t,this.createF=e,this.updateF=i,this.compareF=n,this.spec=r,this.provides=void 0}static define(t){let e=new s(ts++,t.create,t.update,t.compare||((i,n)=>i===n),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(Ci).find(i=>i.field==this);return(e?.create||this.createF)(t)}slot(t){let e=t[this.id]>>1;return{create:i=>(i.values[e]=this.create(i),1),update:(i,n)=>{let r=i.values[e],o=this.updateF(r,n);return this.compareF(r,o)?0:(i.values[e]=o,1)},reconfigure:(i,n)=>{let r=i.facet(Ci),o=n.facet(Ci),l;return(l=r.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[e]=l.create(i),1):n.config.address[this.id]!=null?(i.values[e]=n.field(this),0):(i.values[e]=this.create(i),1)}}}init(t){return[this,Ci.of({field:this,create:t})]}get extension(){return this}},re={lowest:4,low:3,default:2,high:1,highest:0};function ze(s){return t=>new Bi(t,s)}var Te={highest:ze(re.highest),high:ze(re.high),default:ze(re.default),low:ze(re.low),lowest:ze(re.lowest)},Bi=class{constructor(t,e){this.inner=t,this.prec=e}},Ei=class s{of(t){return new Ke(this,t)}reconfigure(t){return s.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}},Ke=class{constructor(t,e){this.compartment=t,this.inner=e}},Ri=class s{constructor(t,e,i,n,r,o){for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=n,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(t){let e=this.address[t.id];return e==null?t.default:this.staticValues[e>>1]}static resolve(t,e,i){let n=[],r=Object.create(null),o=new Map;for(let u of uh(t,e,o))u instanceof ct?n.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of n)l[u.id]=h.length<<1,h.push(d=>u.slot(d));let f=i?.config.facets;for(let u in r){let d=r[u],p=d[0].facet,g=f&&f[u]||[];if(d.every(m=>m.type==0))if(l[p.id]=a.length<<1|1,es(g,d))a.push(i.facet(p));else{let m=p.combine(d.map(b=>b.value));a.push(i&&p.compare(m,i.facet(p))?i.facet(p):m)}else{for(let m of d)m.type==0?(l[m.id]=a.length<<1|1,a.push(m.value)):(l[m.id]=h.length<<1,h.push(b=>m.dynamicSlot(b)));l[p.id]=h.length<<1,h.push(m=>ch(m,p,d))}}let c=h.map(u=>u(l));return new s(t,o,c,l,a,r)}};function uh(s,t,e){let i=[[],[],[],[],[]],n=new Map;function r(o,l){let a=n.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof Ke&&e.delete(o.compartment)}if(n.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof Ke){if(e.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=t.get(o.compartment)||o.inner;e.set(o.compartment,h),r(h,l)}else if(o instanceof Bi)r(o.inner,o.prec);else if(o instanceof ct)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof Ce)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,re.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.`);r(h,l)}}return r(s,re.default),i.reduce((o,l)=>o.concat(l))}function qe(s,t){if(t&1)return 2;let e=t>>1,i=s.status[e];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;s.status[e]=4;let n=s.computeSlot(s,s.config.dynamicSlots[e]);return s.status[e]=2|n}function Pi(s,t){return t&1?s.config.staticValues[t>>1]:s.values[t>>1]}var ro=A.define(),Wn=A.define({combine:s=>s.some(t=>t),static:!0}),po=A.define({combine:s=>s.length?s[0]:void 0,static:!0}),go=A.define(),mo=A.define(),bo=A.define(),oo=A.define({combine:s=>s.length?s[0]:!1}),Vt=class{constructor(t,e){this.type=t,this.value=e}static define(){return new _n}},_n=class{of(t){return new Vt(this,t)}},Un=class{constructor(t){this.map=t}of(t){return new U(this,t)}},U=(()=>{class s{constructor(e,i){this.type=e,this.value=i}map(e){let i=this.type.map(this.value,e);return i===void 0?void 0:i==this.value?this:new s(this.type,i)}is(e){return this.type==e}static define(e={}){return new Un(e.map||(i=>i))}static mapEffects(e,i){if(!e.length)return e;let n=[];for(let r of e){let o=r.map(i);o&&n.push(o)}return n}}return s.reconfigure=s.define(),s.appendConfig=s.define(),s})(),Ut=(()=>{class s{constructor(e,i,n,r,o,l){this.startState=e,this.changes=i,this.selection=n,this.effects=r,this.annotations=o,this.scrollIntoView=l,this._doc=null,this._state=null,n&&uo(n,i.newLength),o.some(a=>a.type==s.time)||(this.annotations=o.concat(s.time.of(Date.now())))}static create(e,i,n,r,o,l){return new s(e,i,n,r,o,l)}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 i of this.annotations)if(i.type==e)return i.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let i=this.annotation(s.userEvent);return!!(i&&(i==e||i.length>e.length&&i.slice(0,e.length)==e&&i[e.length]=="."))}}return s.time=Vt.define(),s.userEvent=Vt.define(),s.addToHistory=Vt.define(),s.remote=Vt.define(),s})();function dh(s,t){let e=[];for(let i=0,n=0;;){let r,o;if(i<s.length&&(n==t.length||t[n]>=s[i]))r=s[i++],o=s[i++];else if(n<t.length)r=t[n++],o=t[n++];else return e;!e.length||e[e.length-1]<r?e.push(r,o):e[e.length-1]<o&&(e[e.length-1]=o)}}function yo(s,t,e){var i;let n,r,o;return e?(n=t.changes,r=ft.empty(t.changes.length),o=s.changes.compose(t.changes)):(n=t.changes.map(s.changes),r=s.changes.mapDesc(t.changes,!0),o=s.changes.compose(n)),{changes:o,selection:t.selection?t.selection.map(r):(i=s.selection)===null||i===void 0?void 0:i.map(n),effects:U.mapEffects(s.effects,n).concat(U.mapEffects(t.effects,r)),annotations:s.annotations.length?s.annotations.concat(t.annotations):t.annotations,scrollIntoView:s.scrollIntoView||t.scrollIntoView}}function Gn(s,t,e){let i=t.selection,n=Ae(t.annotations);return t.userEvent&&(n=n.concat(Ut.userEvent.of(t.userEvent))),{changes:t.changes instanceof ft?t.changes:ft.of(t.changes||[],e,s.facet(po)),selection:i&&(i instanceof T?i:T.single(i.anchor,i.head)),effects:Ae(t.effects),annotations:n,scrollIntoView:!!t.scrollIntoView}}function wo(s,t,e){let i=Gn(s,t.length?t[0]:{},s.doc.length);t.length&&t[0].filter===!1&&(e=!1);for(let r=1;r<t.length;r++){t[r].filter===!1&&(e=!1);let o=!!t[r].sequential;i=yo(i,Gn(s,t[r],o?i.changes.newLength:s.doc.length),o)}let n=Ut.create(s,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return gh(e?ph(n):n)}function ph(s){let t=s.startState,e=!0;for(let n of t.facet(go)){let r=n(s);if(r===!1){e=!1;break}Array.isArray(r)&&(e=e===!0?r:dh(e,r))}if(e!==!0){let n,r;if(e===!1)r=s.changes.invertedDesc,n=ft.empty(t.doc.length);else{let o=s.changes.filter(e);n=o.changes,r=o.filtered.mapDesc(o.changes).invertedDesc}s=Ut.create(t,n,s.selection&&s.selection.map(r),U.mapEffects(s.effects,r),s.annotations,s.scrollIntoView)}let i=t.facet(mo);for(let n=i.length-1;n>=0;n--){let r=i[n](s);r instanceof Ut?s=r:Array.isArray(r)&&r.length==1&&r[0]instanceof Ut?s=r[0]:s=wo(t,Ae(r),!1)}return s}function gh(s){let t=s.startState,e=t.facet(bo),i=s;for(let n=e.length-1;n>=0;n--){let r=e[n](s);r&&Object.keys(r).length&&(i=yo(i,Gn(t,r,s.changes.newLength),!0))}return i==s?s:Ut.create(t,s.changes,s.selection,i.effects,i.annotations,i.scrollIntoView)}var mh=[];function Ae(s){return s==null?mh:Array.isArray(s)?s:[s]}var Et=(function(s){return s[s.Word=0]="Word",s[s.Space=1]="Space",s[s.Other=2]="Other",s})(Et||(Et={})),bh=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Yn;try{Yn=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function yh(s){if(Yn)return Yn.test(s);for(let t=0;t<s.length;t++){let e=s[t];if(/\w/.test(e)||e>"\x80"&&(e.toUpperCase()!=e.toLowerCase()||bh.test(e)))return!0}return!1}function wh(s){return t=>{if(!/\S/.test(t))return Et.Space;if(yh(t))return Et.Word;for(let e=0;e<s.length;e++)if(t.indexOf(s[e])>-1)return Et.Word;return Et.Other}}var gt=(()=>{class s{constructor(e,i,n,r,o,l){this.config=e,this.doc=i,this.selection=n,this.values=r,this.status=e.statusTemplate.slice(),this.computeSlot=o,l&&(l._state=this);for(let a=0;a<this.config.dynamicSlots.length;a++)qe(this,a<<1);this.computeSlot=null}field(e,i=!0){let n=this.config.address[e.id];if(n==null){if(i)throw new RangeError("Field is not present in this state");return}return qe(this,n),Pi(this,n)}update(...e){return wo(this,e,!0)}applyTransaction(e){let i=this.config,{base:n,compartments:r}=i;for(let a of e.effects)a.is(Ei.reconfigure)?(i&&(r=new Map,i.compartments.forEach((h,f)=>r.set(f,h)),i=null),r.set(a.value.compartment,a.value.extension)):a.is(U.reconfigure)?(i=null,n=a.value):a.is(U.appendConfig)&&(i=null,n=Ae(n).concat(a.value));let o;i?o=e.startState.values.slice():(i=Ri.resolve(n,r,this),o=new s(i,this.doc,this.selection,i.dynamicSlots.map(()=>null),(h,f)=>f.reconfigure(h,this),null).values);let l=e.startState.facet(Wn)?e.newSelection:e.newSelection.asSingle();new s(i,e.newDoc,l,o,(a,h)=>h.update(a,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:e},range:T.cursor(i.from+e.length)}))}changeByRange(e){let i=this.selection,n=e(i.ranges[0]),r=this.changes(n.changes),o=[n.range],l=Ae(n.effects);for(let a=1;a<i.ranges.length;a++){let h=e(i.ranges[a]),f=this.changes(h.changes),c=f.map(r);for(let d=0;d<a;d++)o[d]=o[d].map(c);let u=r.mapDesc(f,!0);o.push(h.range.map(u)),r=r.compose(c),l=U.mapEffects(l,c).concat(U.mapEffects(Ae(h.effects),u))}return{changes:r,selection:T.create(o,i.mainIndex),effects:l}}changes(e=[]){return e instanceof ft?e:ft.of(e,this.doc.length,this.facet(s.lineSeparator))}toText(e){return I.of(e.split(this.facet(s.lineSeparator)||qn))}sliceDoc(e=0,i=this.doc.length){return this.doc.sliceString(e,i,this.lineBreak)}facet(e){let i=this.config.address[e.id];return i==null?e.default:(qe(this,i),Pi(this,i))}toJSON(e){let i={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let n in e){let r=e[n];r instanceof ct&&this.config.address[r.id]!=null&&(i[n]=r.spec.toJSON(this.field(e[n]),this))}return i}static fromJSON(e,i={},n){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let r=[];if(n){for(let o in n)if(Object.prototype.hasOwnProperty.call(e,o)){let l=n[o],a=e[o];r.push(l.init(h=>l.spec.fromJSON(a,h)))}}return s.create({doc:e.doc,selection:T.fromJSON(e.selection),extensions:i.extensions?r.concat([i.extensions]):r})}static create(e={}){let i=Ri.resolve(e.extensions||[],new Map),n=e.doc instanceof I?e.doc:I.of((e.doc||"").split(i.staticFacet(s.lineSeparator)||qn)),r=e.selection?e.selection instanceof T?e.selection:T.single(e.selection.anchor,e.selection.head):T.single(0);return uo(r,n.length),i.staticFacet(Wn)||(r=r.asSingle()),new s(i,n,r,i.dynamicSlots.map(()=>null),(o,l)=>l.create(o),null)}get tabSize(){return this.facet(s.tabSize)}get lineBreak(){return this.facet(s.lineSeparator)||` `}get readOnly(){return this.facet(oo)}phrase(e,...i){for(let n of this.facet(s.phrases))if(Object.prototype.hasOwnProperty.call(n,e)){e=n[e];break}return i.length&&(e=e.replace(/\$(\$|\d*)/g,(n,r)=>{if(r=="$")return"$";let o=+(r||1);return!o||o>i.length?n:i[o-1]})),e}languageDataAt(e,i,n=-1){let r=[];for(let o of this.facet(ro))for(let l of o(this,i,n))Object.prototype.hasOwnProperty.call(l,e)&&r.push(l[e]);return r}charCategorizer(e){let i=this.languageDataAt("wordChars",e);return wh(i.length?i[0]:"")}wordAt(e){let{text:i,from:n,length:r}=this.doc.lineAt(e),o=this.charCategorizer(e),l=e-n,a=e-n;for(;l>0;){let h=ht(i,l,!1);if(o(i.slice(h,l))!=Et.Word)break;l=h}for(;a<r;){let h=ht(i,a);if(o(i.slice(a,h))!=Et.Word)break;a=h}return l==a?null:T.range(l+n,a+n)}}return s.allowMultipleSelections=Wn,s.tabSize=A.define({combine:t=>t.length?t[0]:4}),s.lineSeparator=po,s.readOnly=oo,s.phrases=A.define({compare(t,e){let i=Object.keys(t),n=Object.keys(e);return i.length==n.length&&i.every(r=>t[r]==e[r])}}),s.languageData=ro,s.changeFilter=go,s.transactionFilter=mo,s.transactionExtender=bo,s})();Ei.reconfigure=U.define();function fe(s,t,e={}){let i={};for(let n of s)for(let r of Object.keys(n)){let o=n[r],l=i[r];if(l===void 0)i[r]=o;else if(!(l===o||o===void 0))if(Object.hasOwnProperty.call(e,r))i[r]=e[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let n in t)i[n]===void 0&&(i[n]=t[n]);return i}var Rt=class{eq(t){return this==t}range(t,e=t){return je.create(t,e,this)}};Rt.prototype.startSide=Rt.prototype.endSide=0;Rt.prototype.point=!1;Rt.prototype.mapMode=it.TrackDel;function is(s,t){return s==t||s.constructor==t.constructor&&s.eq(t)}var je=class s{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(t,e,i){return new s(t,e,i)}};function Xn(s,t){return s.from-t.from||s.value.startSide-t.value.startSide}var Jn=class s{constructor(t,e,i,n){this.from=t,this.to=e,this.value=i,this.maxPoint=n}get length(){return this.to[this.to.length-1]}findIndex(t,e,i,n=0){let r=i?this.to:this.from;for(let o=n,l=r.length;;){if(o==l)return o;let a=o+l>>1,h=r[a]-t||(i?this.value[a].endSide:this.value[a].startSide)-e;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(t,e,i,n){for(let r=this.findIndex(e,-1e9,!0),o=this.findIndex(i,1e9,!1,r);r<o;r++)if(n(this.from[r]+t,this.to[r]+t,this.value[r])===!1)return!1}map(t,e){let i=[],n=[],r=[],o=-1,l=-1;for(let a=0;a<this.value.length;a++){let h=this.value[a],f=this.from[a]+t,c=this.to[a]+t,u,d;if(f==c){let p=e.mapPos(f,h.startSide,h.mapMode);if(p==null||(u=d=p,h.startSide!=h.endSide&&(d=e.mapPos(f,h.endSide),d<u)))continue}else if(u=e.mapPos(f,h.startSide),d=e.mapPos(c,h.endSide),u>d||u==d&&h.startSide>0&&h.endSide<=0)continue;(d-u||h.endSide-h.startSide)<0||(o<0&&(o=u),h.point&&(l=Math.max(l,d-u)),i.push(h),n.push(u-o),r.push(d-o))}return{mapped:i.length?new s(n,r,i,l):null,pos:o}}},W=(()=>{class s{constructor(e,i,n,r){this.chunkPos=e,this.chunk=i,this.nextLayer=n,this.maxPoint=r}static create(e,i,n,r){return new s(e,i,n,r)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let i of this.chunk)e+=i.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:i=[],sort:n=!1,filterFrom:r=0,filterTo:o=this.length}=e,l=e.filter;if(i.length==0&&!l)return this;if(n&&(i=i.slice().sort(Xn)),this.isEmpty)return i.length?s.of(i):this;let a=new Li(this,null,-1).goto(0),h=0,f=[],c=new zt;for(;a.value||h<i.length;)if(h<i.length&&(a.from-i[h].from||a.startSide-i[h].value.startSide)>=0){let u=i[h++];c.addInner(u.from,u.to,u.value)||f.push(u)}else a.rangeIndex==1&&a.chunkIndex<this.chunk.length&&(h==i.length||this.chunkEnd(a.chunkIndex)<i[h].from)&&(!l||r>this.chunkEnd(a.chunkIndex)||o<this.chunkPos[a.chunkIndex])&&c.addChunk(this.chunkPos[a.chunkIndex],this.chunk[a.chunkIndex])?a.nextChunk():((!l||r>a.to||o<a.from||l(a.from,a.to,a.value))&&(c.addInner(a.from,a.to,a.value)||f.push(je.create(a.from,a.to,a.value))),a.next());return c.finishInner(this.nextLayer.isEmpty&&!f.length?s.empty:this.nextLayer.update({add:f,filter:l,filterFrom:r,filterTo:o}))}map(e){if(e.empty||this.isEmpty)return this;let i=[],n=[],r=-1;for(let l=0;l<this.chunk.length;l++){let a=this.chunkPos[l],h=this.chunk[l],f=e.touchesRange(a,a+h.length);if(f===!1)r=Math.max(r,h.maxPoint),i.push(h),n.push(e.mapPos(a));else if(f===!0){let{mapped:c,pos:u}=h.map(a,e);c&&(r=Math.max(r,c.maxPoint),i.push(c),n.push(u))}}let o=this.nextLayer.map(e);return i.length==0?o:new s(n,i,o||s.empty,r)}between(e,i,n){if(!this.isEmpty){for(let r=0;r<this.chunk.length;r++){let o=this.chunkPos[r],l=this.chunk[r];if(i>=o&&e<=o+l.length&&l.between(o,e-o,i-o,n)===!1)return}this.nextLayer.between(e,i,n)}}iter(e=0){return $e.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,i=0){return $e.from(e).goto(i)}static compare(e,i,n,r,o=-1){let l=e.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=o),a=i.filter(u=>u.maxPoint>0||!u.isEmpty&&u.maxPoint>=o),h=lo(l,a,n),f=new oe(l,h,o),c=new oe(a,h,o);n.iterGaps((u,d,p)=>ao(f,u,c,d,p,r)),n.empty&&n.length==0&&ao(f,0,c,0,0,r)}static eq(e,i,n=0,r){r==null&&(r=999999999);let o=e.filter(c=>!c.isEmpty&&i.indexOf(c)<0),l=i.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(o.length!=l.length)return!1;if(!o.length)return!0;let a=lo(o,l),h=new oe(o,a,0).goto(n),f=new oe(l,a,0).goto(n);for(;;){if(h.to!=f.to||!Qn(h.active,f.active)||h.point&&(!f.point||!is(h.point,f.point)))return!1;if(h.to>r)return!0;h.next(),f.next()}}static spans(e,i,n,r,o=-1){let l=new oe(e,null,o).goto(i),a=i,h=l.openStart;for(;;){let f=Math.min(l.to,n);if(l.point){let c=l.activeForPoint(l.to),u=l.pointFrom<i?c.length+1:l.point.startSide<0?c.length:Math.min(c.length,h);r.point(a,f,l.point,c,u,l.pointRank),h=Math.min(l.openEnd(f),c.length)}else f>a&&(r.span(a,f,l.active,h),h=l.openEnd(f));if(l.to>n)return h+(l.point&&l.to>n?1:0);a=l.to,l.next()}}static of(e,i=!1){let n=new zt;for(let r of e instanceof je?[e]:i?xh(e):e)n.add(r.from,r.to,r.value);return n.finish()}static join(e){if(!e.length)return s.empty;let i=e[e.length-1];for(let n=e.length-2;n>=0;n--)for(let r=e[n];r!=s.empty;r=r.nextLayer)i=new s(r.chunkPos,r.chunk,i,Math.max(r.maxPoint,i.maxPoint));return i}}return s.empty=new s([],[],null,-1),s})();function xh(s){if(s.length>1)for(let t=s[0],e=1;e<s.length;e++){let i=s[e];if(Xn(t,i)>0)return s.slice().sort(Xn);t=i}return s}W.empty.nextLayer=W.empty;var zt=class s{finishChunk(t){this.chunks.push(new Jn(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,t&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(t,e,i){this.addInner(t,e,i)||(this.nextLayer||(this.nextLayer=new s)).add(t,e,i)}addInner(t,e,i){let n=t-this.lastTo||i.startSide-this.last.endSide;if(n<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return n<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=t),this.from.push(t-this.chunkStart),this.to.push(e-this.chunkStart),this.last=i,this.lastFrom=t,this.lastTo=e,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,e-t)),!0)}addChunk(t,e){if((t-this.lastTo||e.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,e.maxPoint),this.chunks.push(e),this.chunkPos.push(t);let i=e.value.length-1;return this.last=e.value[i],this.lastFrom=e.from[i]+t,this.lastTo=e.to[i]+t,!0}finish(){return this.finishInner(W.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let e=W.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}};function lo(s,t,e){let i=new Map;for(let r of s)for(let o=0;o<r.chunk.length;o++)r.chunk[o].maxPoint<=0&&i.set(r.chunk[o],r.chunkPos[o]);let n=new Set;for(let r of t)for(let o=0;o<r.chunk.length;o++){let l=i.get(r.chunk[o]);l!=null&&(e?e.mapPos(l):l)==r.chunkPos[o]&&!e?.touchesRange(l,l+r.chunk[o].length)&&n.add(r.chunk[o])}return n}var Li=class{constructor(t,e,i,n=0){this.layer=t,this.skip=e,this.minPoint=i,this.rank=n}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(t,e=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(t,e,!1),this}gotoInner(t,e,i){for(;this.chunkIndex<this.layer.chunk.length;){let n=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(n)||this.layer.chunkEnd(this.chunkIndex)<t||n.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let n=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!i||this.rangeIndex<n)&&this.setRangeIndex(n)}this.next()}forward(t,e){(this.to-t||this.endSide-e)<0&&this.gotoInner(t,e,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let t=this.layer.chunkPos[this.chunkIndex],e=this.layer.chunk[this.chunkIndex],i=t+e.from[this.rangeIndex];if(this.from=i,this.to=t+e.to[this.rangeIndex],this.value=e.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(t){if(t==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=t}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(t){return this.from-t.from||this.startSide-t.startSide||this.rank-t.rank||this.to-t.to||this.endSide-t.endSide}},$e=class s{constructor(t){this.heap=t}static from(t,e=null,i=-1){let n=[];for(let r=0;r<t.length;r++)for(let o=t[r];!o.isEmpty;o=o.nextLayer)o.maxPoint>=i&&n.push(new Li(o,e,i,r));return n.length==1?n[0]:new s(n)}get startSide(){return this.value?this.value.startSide:0}goto(t,e=-1e9){for(let i of this.heap)i.goto(t,e);for(let i=this.heap.length>>1;i>=0;i--)Vn(this.heap,i);return this.next(),this}forward(t,e){for(let i of this.heap)i.forward(t,e);for(let i=this.heap.length>>1;i>=0;i--)Vn(this.heap,i);(this.to-t||this.value.endSide-e)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let t=this.heap[0];this.from=t.from,this.to=t.to,this.value=t.value,this.rank=t.rank,t.value&&t.next(),Vn(this.heap,0)}}};function Vn(s,t){for(let e=s[t];;){let i=(t<<1)+1;if(i>=s.length)break;let n=s[i];if(i+1<s.length&&n.compare(s[i+1])>=0&&(n=s[i+1],i++),e.compare(n)<0)break;s[i]=e,s[t]=n,t=i}}var oe=class{constructor(t,e,i){this.minPoint=i,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=$e.from(t,e,i)}goto(t,e=-1e9){return this.cursor.goto(t,e),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=t,this.endSide=e,this.openStart=-1,this.next(),this}forward(t,e){for(;this.minActive>-1&&(this.activeTo[this.minActive]-t||this.active[this.minActive].endSide-e)<0;)this.removeActive(this.minActive);this.cursor.forward(t,e)}removeActive(t){Ai(this.active,t),Ai(this.activeTo,t),Ai(this.activeRank,t),this.minActive=ho(this.active,this.activeTo)}addActive(t){let e=0,{value:i,to:n,rank:r}=this.cursor;for(;e<this.activeRank.length&&(r-this.activeRank[e]||n-this.activeTo[e])>0;)e++;Mi(this.active,e,i),Mi(this.activeTo,e,n),Mi(this.activeRank,e,r),t&&Mi(t,e,this.cursor.from),this.minActive=ho(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let n=this.minActive;if(n>-1&&(this.activeTo[n]-this.cursor.from||this.active[n].endSide-this.cursor.startSide)<0){if(this.activeTo[n]>t){this.to=this.activeTo[n],this.endSide=this.active[n].endSide;break}this.removeActive(n),i&&Ai(i,n)}else if(this.cursor.value)if(this.cursor.from>t){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let r=this.cursor.value;if(!r.point)this.addActive(i),this.cursor.next();else if(e&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=r,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=r.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(i){this.openStart=0;for(let n=i.length-1;n>=0&&i[n]<t;n--)this.openStart++}}activeForPoint(t){if(!this.active.length)return this.active;let e=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>t||this.activeTo[i]==t&&this.active[i].endSide>=this.point.endSide)&&e.push(this.active[i]);return e.reverse()}openEnd(t){let e=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>t;i--)e++;return e}};function ao(s,t,e,i,n,r){s.goto(t),e.goto(i);let o=i+n,l=i,a=i-t,h=!!r.boundChange;for(let f=!1;;){let c=s.to+a-e.to,u=c||s.endSide-e.endSide,d=u<0?s.to+a:e.to,p=Math.min(d,o);if(s.point||e.point?(s.point&&e.point&&is(s.point,e.point)&&Qn(s.activeForPoint(s.to),e.activeForPoint(e.to))||r.comparePoint(l,p,s.point,e.point),f=!1):(f&&r.boundChange(l),p>l&&!Qn(s.active,e.active)&&r.compareRange(l,p,s.active,e.active),h&&p<o&&(c||s.openEnd(d)!=e.openEnd(d))&&(f=!0)),d>o)break;l=d,u<=0&&s.next(),u>=0&&e.next()}}function Qn(s,t){if(s.length!=t.length)return!1;for(let e=0;e<s.length;e++)if(s[e]!=t[e]&&!is(s[e],t[e]))return!1;return!0}function Ai(s,t){for(let e=t,i=s.length-1;e<i;e++)s[e]=s[e+1];s.pop()}function Mi(s,t,e){for(let i=s.length-1;i>=t;i--)s[i+1]=s[i];s[t]=e}function ho(s,t){let e=-1,i=1e9;for(let n=0;n<t.length;n++)(t[n]-i||s[n].endSide-s[e].endSide)<0&&(e=n,i=t[n]);return e}function _e(s,t,e=s.length){let i=0;for(let n=0;n<e&&n<s.length;)s.charCodeAt(n)==9?(i+=t-i%t,n++):(i++,n=ht(s,n));return i}function Ni(s,t,e,i){for(let n=0,r=0;;){if(r>=t)return n;if(n==s.length)break;r+=s.charCodeAt(n)==9?e-r%e:1,n=ht(s,n)}return i===!0?-1:s.length}var xo=typeof Symbol>"u"?"__\u037C":Symbol.for("\u037C"),ns=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),vo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},mt=class{constructor(t,e){this.rules=[];let{finish:i}=e||{};function n(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,a,h){let f=[],c=/^@(\w+)\b/.exec(o[0]),u=c&&c[1]=="keyframes";if(c&&l==null)return a.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))r(d.split(/,\s*/).map(g=>o.map(m=>g.replace(/&/,m))).reduce((g,m)=>g.concat(m)),p,a);else if(p&&typeof p=="object"){if(!c)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(n(d),p,f,u)}else p!=null&&f.push(d.replace(/_.*/,"").replace(/[A-Z]/g,g=>"-"+g.toLowerCase())+": "+p+";")}(f.length||u)&&a.push((i&&!c&&!h?o.map(i):o).join(", ")+" {"+f.join(" ")+"}")}for(let o in t)r(n(o),t[o],this.rules)}getRules(){return this.rules.join(` `)}static newName(){let t=vo[xo]||1;return vo[xo]=t+1,"\u037C"+t.toString(36)}static mount(t,e,i){let n=t[ns],r=i&&i.nonce;n?r&&n.setNonce(r):n=new ss(t,r),n.mount(Array.isArray(e)?e:[e],t)}},ko=new Map,ss=class{constructor(t,e){let i=t.ownerDocument||t,n=i.defaultView;if(!t.head&&t.adoptedStyleSheet