unleash-server
Version:
Unleash is an enterprise ready feature flag service. It provides different strategies for handling feature flags.
6 lines • 393 kB
JavaScript
let Vs=[],ra=[];(()=>{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(t=>t?parseInt(t,36):1);for(let t=0,e=0;t<n.length;t++)(t%2?ra:Vs).push(e=e+n[t])})();function af(n){if(n<768)return!1;for(let t=0,e=Vs.length;;){let i=t+e>>1;if(n<Vs[i])e=i;else if(n>=ra[i])t=i+1;else return!0;if(t==e)return!1}}function go(n){return n>=127462&&n<=127487}const yo=8205;function hf(n,t,e=!0,i=!0){return(e?oa:cf)(n,t,i)}function oa(n,t,e){if(t==n.length)return t;t&&la(n.charCodeAt(t))&&aa(n.charCodeAt(t-1))&&t--;let i=ds(n,t);for(t+=bo(i);t<n.length;){let s=ds(n,t);if(i==yo||s==yo||e&&af(s))t+=bo(s),i=s;else if(go(s)){let r=0,o=t-2;for(;o>=0&&go(ds(n,o));)r++,o-=2;if(r%2==0)break;t+=2}else break}return t}function cf(n,t,e){for(;t>0;){let i=oa(n,t-2,e);if(i<t)return i;t--}return 0}function ds(n,t){let e=n.charCodeAt(t);if(!aa(e)||t+1==n.length)return e;let i=n.charCodeAt(t+1);return la(i)?(e-55296<<10)+(i-56320)+65536:e}function la(n){return n>=56320&&n<57344}function aa(n){return n>=55296&&n<56320}function bo(n){return n<65536?1:2}class z{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]=_e(this,t,e);let s=[];return this.decompose(0,t,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(e,this.length,s,1),Yt.from(s,this.length-(e-t)+i.length)}append(t){return this.replace(this.length,this.length,t)}slice(t,e=this.length){[t,e]=_e(this,t,e);let i=[];return this.decompose(t,e,i,0),Yt.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),s=new bi(this),r=new bi(t);for(let o=e,l=e;;){if(s.next(o),r.next(o),o=0,s.lineBreak!=r.lineBreak||s.done!=r.done||s.value!=r.value)return!1;if(l+=s.value.length,s.done||l>=i)return!0}}iter(t=1){return new bi(this,t)}iterRange(t,e=this.length){return new ha(this,t,e)}iterLines(t,e){let i;if(t==null)i=this.iter();else{e==null&&(e=this.lines+1);let s=this.line(t).from;i=this.iterRange(s,Math.max(s,e==this.lines+1?this.length:e<=1?0:this.line(e-1).to))}return new ca(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]?z.empty:t.length<=32?new J(t):Yt.from(J.split(t,[]))}}class J extends z{constructor(t,e=ff(t)){super(),this.text=t,this.length=e}get lines(){return this.text.length}get children(){return null}lineInner(t,e,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((e?i:l)>=t)return new uf(s,l,i,o);s=l+1,i++}}decompose(t,e,i,s){let r=t<=0&&e>=this.length?this:new J(xo(this.text,t,e),Math.min(e,this.length)-Math.max(0,t));if(s&1){let o=i.pop(),l=pn(r.text,o.text.slice(),0,r.length);if(l.length<=32)i.push(new J(l,o.length+r.length));else{let a=l.length>>1;i.push(new J(l.slice(0,a)),new J(l.slice(a)))}}else i.push(r)}replace(t,e,i){if(!(i instanceof J))return super.replace(t,e,i);[t,e]=_e(this,t,e);let s=pn(this.text,pn(i.text,xo(this.text,0,t)),e),r=this.length+i.length-(e-t);return s.length<=32?new J(s,r):Yt.from(J.split(s,[]),r)}sliceString(t,e=this.length,i=`
`){[t,e]=_e(this,t,e);let s="";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&&(s+=i),t<a&&e>r&&(s+=l.slice(Math.max(0,t-r),e-r)),r=a+1}return s}flatten(t){for(let e of this.text)t.push(e)}scanIdentical(){return 0}static split(t,e){let i=[],s=-1;for(let r of t)i.push(r),s+=r.length+1,i.length==32&&(e.push(new J(i,s)),i=[],s=-1);return s>-1&&e.push(new J(i,s)),e}}class Yt extends z{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,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((e?a:l)>=t)return o.lineInner(t,e,i,s);s=l+1,i=a+1}}decompose(t,e,i,s){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=s&((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]=_e(this,t,e),i.lines<this.lines)for(let s=0,r=0;s<this.children.length;s++){let o=this.children[s],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 c=this.children.slice();return c[s]=a,new Yt(c,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]=_e(this,t,e);let s="";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&&(s+=i),t<a&&e>o&&(s+=l.sliceString(t-o,e-o,i)),o=a+1}return s}flatten(t){for(let e of this.children)e.flatten(t)}scanIdentical(t,e){if(!(t instanceof Yt))return 0;let i=0,[s,r,o,l]=e>0?[0,0,this.children.length,t.children.length]:[this.children.length-1,t.children.length-1,-1,-1];for(;;s+=e,r+=e){if(s==o||r==l)return i;let a=this.children[s],h=t.children[r];if(a!=h)return i+a.scanIdentical(h,e);i+=a.length+1}}static from(t,e=t.reduce((i,s)=>i+s.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 J(d,e)}let s=Math.max(32,i>>5),r=s<<1,o=s>>1,l=[],a=0,h=-1,c=[];function f(d){let p;if(d.lines>r&&d instanceof Yt)for(let m of d.children)f(m);else d.lines>o&&(a>o||!a)?(u(),l.push(d)):d instanceof J&&a&&(p=c[c.length-1])instanceof J&&d.lines+p.lines<=32?(a+=d.lines,h+=d.length+1,c[c.length-1]=new J(p.text.concat(d.text),p.length+1+d.length)):(a+d.lines>s&&u(),a+=d.lines,h+=d.length+1,c.push(d))}function u(){a!=0&&(l.push(c.length==1?c[0]:Yt.from(c,h)),h=-1,a=c.length=0)}for(let d of t)f(d);return u(),l.length==1?l[0]:new Yt(l,e)}}z.empty=new J([""],0);function ff(n){let t=-1;for(let e of n)t+=e.length+1;return t}function pn(n,t,e=0,i=1e9){for(let s=0,r=0,o=!0;r<n.length&&s<=i;r++){let l=n[r],a=s+l.length;a>=e&&(a>i&&(l=l.slice(0,i-s)),s<e&&(l=l.slice(e-s)),o?(t[t.length-1]+=l,o=!1):t.push(l)),s=a+1}return t}function xo(n,t,e){return pn(n,[""],t,e)}class bi{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 J?t.text.length:t.children.length)<<1]}nextInner(t,e){for(this.done=this.lineBreak=!1;;){let i=this.nodes.length-1,s=this.nodes[i],r=this.offsets[i],o=r>>1,l=s instanceof J?s.text.length:s.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(s instanceof J){let a=s.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=s.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 J?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)}}class ha{constructor(t,e,i){this.value="",this.done=!1,this.cursor=new bi(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:s}=this.cursor.next(t);return this.pos+=(s.length+t)*e,this.value=s.length<=i?s:e<0?s.slice(s.length-i):s.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!=""}}class ca{constructor(t){this.inner=t,this.afterBreak=!0,this.value="",this.done=!1}next(t=0){let{done:e,lineBreak:i,value:s}=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=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(z.prototype[Symbol.iterator]=function(){return this.iter()},bi.prototype[Symbol.iterator]=ha.prototype[Symbol.iterator]=ca.prototype[Symbol.iterator]=function(){return this});class uf{constructor(t,e,i,s){this.from=t,this.to=e,this.number=i,this.text=s}get length(){return this.to-this.from}}function _e(n,t,e){return t=Math.max(0,Math.min(n.length,t)),[t,Math.max(t,Math.min(n.length,e))]}function at(n,t,e=!0,i=!0){return hf(n,t,e,i)}function df(n){return n>=56320&&n<57344}function pf(n){return n>=55296&&n<56320}function xt(n,t){let e=n.charCodeAt(t);if(!pf(e)||t+1==n.length)return e;let i=n.charCodeAt(t+1);return df(i)?(e-55296<<10)+(i-56320)+65536:e}function Fr(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function Qt(n){return n<65536?1:2}const Ws=/\r\n?|\n/;var pt=function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n}(pt||(pt={}));class te{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,s=0;e<this.sections.length;){let r=this.sections[e++],o=this.sections[e++];o<0?(t(i,s,r),s+=r):s+=o,i+=r}}iterChangedRanges(t,e=!1){zs(this,t,e)}get invertedDesc(){let t=[];for(let e=0;e<this.sections.length;){let i=this.sections[e++],s=this.sections[e++];s<0?t.push(i,s):t.push(s,i)}return new te(t)}composeDesc(t){return this.empty?t:t.empty?this:fa(this,t)}mapDesc(t,e=!1){return t.empty?this:$s(this,t,e)}mapPos(t,e=-1,i=pt.Simple){let s=0,r=0;for(let o=0;o<this.sections.length;){let l=this.sections[o++],a=this.sections[o++],h=s+l;if(a<0){if(h>t)return r+(t-s);r+=l}else{if(i!=pt.Simple&&h>=t&&(i==pt.TrackDel&&s<t&&h>t||i==pt.TrackBefore&&s<t||i==pt.TrackAfter&&h>t))return null;if(h>t||h==t&&e<0&&!l)return t==s||e<0?r:r+a;r+=a}s=h}if(t>s)throw new RangeError(`Position ${t} is out of range for changeset of length ${s}`);return r}touchesRange(t,e=t){for(let i=0,s=0;i<this.sections.length&&s<=e;){let r=this.sections[i++],o=this.sections[i++],l=s+r;if(o>=0&&s<=e&&l>=t)return s<t&&l>e?"cover":!0;s=l}return!1}toString(){let t="";for(let e=0;e<this.sections.length;){let i=this.sections[e++],s=this.sections[e++];t+=(t?" ":"")+i+(s>=0?":"+s:"")}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 te(t)}static create(t){return new te(t)}}class et extends te{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 zs(this,(e,i,s,r,o)=>t=t.replace(s,s+(i-e),o),!1),t}mapDesc(t,e=!1){return $s(this,t,e,!0)}invert(t){let e=this.sections.slice(),i=[];for(let s=0,r=0;s<e.length;s+=2){let o=e[s],l=e[s+1];if(l>=0){e[s]=l,e[s+1]=o;let a=s>>1;for(;i.length<a;)i.push(z.empty);i.push(o?t.slice(r,r+o):z.empty)}r+=o}return new et(e,i)}compose(t){return this.empty?t:t.empty?this:fa(this,t,!0)}map(t,e=!1){return t.empty?this:$s(this,t,e,!0)}iterChanges(t,e=!1){zs(this,t,e)}get desc(){return te.create(this.sections)}filter(t){let e=[],i=[],s=[],r=new Si(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 c=Math.min(r.len,a-l);ht(s,c,-1);let f=r.ins==-1?-1:r.off==0?r.ins:0;ht(e,c,f),f>0&&ue(i,e,r.text),r.forward(c),l+=c}let h=t[o++];for(;l<h;){if(r.done)break t;let c=Math.min(r.len,h-l);ht(e,c,-1),ht(s,c,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(c),l+=c}}return{changes:new et(e,i),filtered:te.create(s)}}toJSON(){let t=[];for(let e=0;e<this.sections.length;e+=2){let i=this.sections[e],s=this.sections[e+1];s<0?t.push(i):s==0?t.push([i]):t.push([i].concat(this.inserted[e>>1].toJSON()))}return t}static of(t,e,i){let s=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!s.length)return;o<e&&ht(s,e-o,-1);let f=new et(s,r);l=l?l.compose(f.map(l)):f,s=[],r=[],o=0}function h(c){if(Array.isArray(c))for(let f of c)h(f);else if(c instanceof et){if(c.length!=e)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${e})`);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>e)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${e})`);let p=d?typeof d=="string"?z.of(d.split(i||Ws)):d:z.empty,m=p.length;if(f==u&&m==0)return;f<o&&a(),f>o&&ht(s,f-o,-1),ht(s,u-f,m),ue(r,s,p),o=u}}return h(t),a(!l),l}static empty(t){return new et(t?[t,-1]:[],[])}static fromJSON(t){if(!Array.isArray(t))throw new RangeError("Invalid JSON representation of ChangeSet");let e=[],i=[];for(let s=0;s<t.length;s++){let r=t[s];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<s;)i.push(z.empty);i[s]=z.of(r.slice(1)),e.push(r[0],i[s].length)}}}return new et(e,i)}static createSet(t,e){return new et(t,e)}}function ht(n,t,e,i=!1){if(t==0&&e<=0)return;let s=n.length-2;s>=0&&e<=0&&e==n[s+1]?n[s]+=t:s>=0&&t==0&&n[s]==0?n[s+1]+=e:i?(n[s]+=t,n[s+1]+=e):n.push(t,e)}function ue(n,t,e){if(e.length==0)return;let i=t.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(e);else{for(;n.length<i;)n.push(z.empty);n.push(e)}}function zs(n,t,e){let i=n.inserted;for(let s=0,r=0,o=0;o<n.sections.length;){let l=n.sections[o++],a=n.sections[o++];if(a<0)s+=l,r+=l;else{let h=s,c=r,f=z.empty;for(;h+=l,c+=a,a&&i&&(f=f.append(i[o-2>>1])),!(e||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];t(s,h,r,c,f),s=h,r=c}}}function $s(n,t,e,i=!1){let s=[],r=i?[]:null,o=new Si(n),l=new Si(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);ht(s,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(ht(s,l.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=c&&(ht(s,0,o.ins),r&&ue(r,s,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;ht(s,h,a<o.i?o.ins:0),r&&a<o.i&&ue(r,s,o.text),a=o.i,o.forward(o.len-c)}else{if(o.done&&l.done)return r?et.createSet(s,r):te.create(s);throw new Error("Mismatched change set lengths")}}}function fa(n,t,e=!1){let i=[],s=e?[]:null,r=new Si(n),o=new Si(t);for(let l=!1;;){if(r.done&&o.done)return s?et.createSet(i,s):te.create(i);if(r.ins==0)ht(i,r.len,0,l),r.next();else if(o.len==0&&!o.done)ht(i,0,o.ins,l),s&&ue(s,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 c=o.ins==-1?-1:o.off?0:o.ins;ht(i,a,c,l),s&&c&&ue(s,i,o.text)}else o.ins==-1?(ht(i,r.off?0:r.len,a,l),s&&ue(s,i,r.textBit(a))):(ht(i,r.off?0:r.len,o.off?0:o.ins,l),s&&!o.off&&ue(s,i,o.text));l=(r.ins>a||o.ins>=0&&o.len>a)&&(l||i.length>h),r.forward2(a),o.forward(a)}}}}class Si{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?z.empty:t[e]}textBit(t){let{inserted:e}=this.set,i=this.i-2>>1;return i>=e.length&&!t?z.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)}}class De{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,s;return this.empty?i=s=t.mapPos(this.from,e):(i=t.mapPos(this.from,1),s=t.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new De(i,s,this.flags)}extend(t,e=t){if(t<=this.anchor&&e>=this.anchor)return b.range(t,e);let i=Math.abs(t-this.anchor)>Math.abs(e-this.anchor)?t:e;return b.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 b.range(t.anchor,t.head)}static create(t,e,i){return new De(t,e,i)}}class b{constructor(t,e){this.ranges=t,this.mainIndex=e}map(t,e=-1){return t.empty?this:b.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 b([this.main],0)}addRange(t,e=!0){return b.create([t].concat(this.ranges),e?0:this.mainIndex+1)}replaceRange(t,e=this.mainIndex){let i=this.ranges.slice();return i[e]=t,b.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 b(t.ranges.map(e=>De.fromJSON(e)),t.main)}static single(t,e=t){return new b([b.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,s=0;s<t.length;s++){let r=t[s];if(r.empty?r.from<=i:r.from<i)return b.normalized(t.slice(),e);i=r.to}return new b(t,e)}static cursor(t,e=0,i,s){return De.create(t,t,(e==0?0:e<0?8:16)|(i==null?7:Math.min(6,i))|(s??16777215)<<6)}static range(t,e,i,s){let r=(i??16777215)<<6|(s==null?7:Math.min(6,s));return e<t?De.create(e,t,48|r):De.create(t,e,(e>t?8:0)|r)}static normalized(t,e=0){let i=t[e];t.sort((s,r)=>s.from-r.from),e=t.indexOf(i);for(let s=1;s<t.length;s++){let r=t[s],o=t[s-1];if(r.empty?r.from<=o.to:r.from<o.to){let l=o.from,a=Math.max(r.to,o.to);s<=e&&e--,t.splice(--s,2,r.anchor>r.head?b.range(a,l):b.range(l,a))}}return new b(t,e)}}function ua(n,t){for(let e of n.ranges)if(e.to>t)throw new RangeError("Selection points outside of document")}let Hr=0;class O{constructor(t,e,i,s,r){this.combine=t,this.compareInput=e,this.compare=i,this.isStatic=s,this.id=Hr++,this.default=t([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(t={}){return new O(t.combine||(e=>e),t.compareInput||((e,i)=>e===i),t.compare||(t.combine?(e,i)=>e===i:Vr),!!t.static,t.enables)}of(t){return new mn([],this,0,t)}compute(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new mn(t,this,1,e)}computeN(t,e){if(this.isStatic)throw new Error("Can't compute a static facet");return new mn(t,this,2,e)}from(t,e){return e||(e=i=>i),this.compute([t],i=>e(i.field(t)))}}function Vr(n,t){return n==t||n.length==t.length&&n.every((e,i)=>e===t[i])}class mn{constructor(t,e,i,s){this.dependencies=t,this.facet=e,this.type=i,this.value=s,this.id=Hr++}dynamicSlot(t){var e;let i=this.value,s=this.facet.compareInput,r=this.id,o=t[r]>>1,l=this.type==2,a=!1,h=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?h=!0:((e=t[f.id])!==null&&e!==void 0?e:1)&1||c.push(t[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||qs(f,c)){let d=i(f);if(l?!wo(d,f.values[o],s):!s(d,f.values[o]))return f.values[o]=d,1}return 0},reconfigure:(f,u)=>{let d,p=u.config.address[r];if(p!=null){let m=Mn(u,p);if(this.dependencies.every(g=>g instanceof O?u.facet(g)===f.facet(g):g instanceof nt?u.field(g,!1)==f.field(g,!1):!0)||(l?wo(d=i(f),m,s):s(d=i(f),m)))return f.values[o]=m,0}else d=i(f);return f.values[o]=d,1}}}}function wo(n,t,e){if(n.length!=t.length)return!1;for(let i=0;i<n.length;i++)if(!e(n[i],t[i]))return!1;return!0}function qs(n,t){let e=!1;for(let i of t)xi(n,i)&1&&(e=!0);return e}function mf(n,t,e){let i=e.map(a=>n[a.id]),s=e.map(a=>a.type),r=i.filter(a=>!(a&1)),o=n[t.id]>>1;function l(a){let h=[];for(let c=0;c<i.length;c++){let f=Mn(a,i[c]);if(s[c]==2)for(let u of f)h.push(u);else h.push(f)}return t.combine(h)}return{create(a){for(let h of i)xi(a,h);return a.values[o]=l(a),1},update(a,h){if(!qs(a,r))return 0;let c=l(a);return t.compare(c,a.values[o])?0:(a.values[o]=c,1)},reconfigure(a,h){let c=qs(a,i),f=h.config.facets[t.id],u=h.facet(t);if(f&&!c&&Vr(e,f))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)}}}const qi=O.define({static:!0});class nt{constructor(t,e,i,s,r){this.id=t,this.createF=e,this.updateF=i,this.compareF=s,this.spec=r,this.provides=void 0}static define(t){let e=new nt(Hr++,t.create,t.update,t.compare||((i,s)=>i===s),t);return t.provide&&(e.provides=t.provide(e)),e}create(t){let e=t.facet(qi).find(i=>i.field==this);return((e==null?void 0: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,s)=>{let r=i.values[e],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[e]=o,1)},reconfigure:(i,s)=>{let r=i.facet(qi),o=s.facet(qi),l;return(l=r.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[e]=l.create(i),1):s.config.address[this.id]!=null?(i.values[e]=s.field(this),0):(i.values[e]=this.create(i),1)}}}init(t){return[this,qi.of({field:this,create:t})]}get extension(){return this}}const Oe={lowest:4,low:3,default:2,high:1,highest:0};function li(n){return t=>new da(t,n)}const Fe={highest:li(Oe.highest),high:li(Oe.high),default:li(Oe.default),low:li(Oe.low),lowest:li(Oe.lowest)};class da{constructor(t,e){this.inner=t,this.prec=e}}class Jn{of(t){return new js(this,t)}reconfigure(t){return Jn.reconfigure.of({compartment:this,extension:t})}get(t){return t.config.compartments.get(this)}}class js{constructor(t,e){this.compartment=t,this.inner=e}}class An{constructor(t,e,i,s,r,o){for(this.base=t,this.compartments=e,this.dynamicSlots=i,this.address=s,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 s=[],r=Object.create(null),o=new Map;for(let u of gf(t,e,o))u instanceof nt?s.push(u):(r[u.facet.id]||(r[u.facet.id]=[])).push(u);let l=Object.create(null),a=[],h=[];for(let u of s)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 r){let d=r[u],p=d[0].facet,m=c&&c[u]||[];if(d.every(g=>g.type==0))if(l[p.id]=a.length<<1|1,Vr(m,d))a.push(i.facet(p));else{let g=p.combine(d.map(y=>y.value));a.push(i&&p.compare(g,i.facet(p))?i.facet(p):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(y=>g.dynamicSlot(y)));l[p.id]=h.length<<1,h.push(g=>mf(g,p,d))}}let f=h.map(u=>u(l));return new An(t,o,f,l,a,r)}}function gf(n,t,e){let i=[[],[],[],[],[]],s=new Map;function r(o,l){let a=s.get(o);if(a!=null){if(a<=l)return;let h=i[a].indexOf(o);h>-1&&i[a].splice(h,1),o instanceof js&&e.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof js){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 da)r(o.inner,o.prec);else if(o instanceof nt)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof mn)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,Oe.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(n,Oe.default),i.reduce((o,l)=>o.concat(l))}function xi(n,t){if(t&1)return 2;let e=t>>1,i=n.status[e];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[e]=4;let s=n.computeSlot(n,n.config.dynamicSlots[e]);return n.status[e]=2|s}function Mn(n,t){return t&1?n.config.staticValues[t>>1]:n.values[t>>1]}const pa=O.define(),Ks=O.define({combine:n=>n.some(t=>t),static:!0}),ma=O.define({combine:n=>n.length?n[0]:void 0,static:!0}),ga=O.define(),ya=O.define(),ba=O.define(),xa=O.define({combine:n=>n.length?n[0]:!1});class le{constructor(t,e){this.type=t,this.value=e}static define(){return new yf}}class yf{of(t){return new le(this,t)}}class bf{constructor(t){this.map=t}of(t){return new B(this,t)}}class B{constructor(t,e){this.type=t,this.value=e}map(t){let e=this.type.map(this.value,t);return e===void 0?void 0:e==this.value?this:new B(this.type,e)}is(t){return this.type==t}static define(t={}){return new bf(t.map||(e=>e))}static mapEffects(t,e){if(!t.length)return t;let i=[];for(let s of t){let r=s.map(e);r&&i.push(r)}return i}}B.reconfigure=B.define();B.appendConfig=B.define();class it{constructor(t,e,i,s,r,o){this.startState=t,this.changes=e,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&ua(i,e.newLength),r.some(l=>l.type==it.time)||(this.annotations=r.concat(it.time.of(Date.now())))}static create(t,e,i,s,r,o){return new it(t,e,i,s,r,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(t){for(let e of this.annotations)if(e.type==t)return e.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(t){let e=this.annotation(it.userEvent);return!!(e&&(e==t||e.length>t.length&&e.slice(0,t.length)==t&&e[t.length]=="."))}}it.time=le.define();it.userEvent=le.define();it.addToHistory=le.define();it.remote=le.define();function xf(n,t){let e=[];for(let i=0,s=0;;){let r,o;if(i<n.length&&(s==t.length||t[s]>=n[i]))r=n[i++],o=n[i++];else if(s<t.length)r=t[s++],o=t[s++];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 wa(n,t,e){var i;let s,r,o;return e?(s=t.changes,r=et.empty(t.changes.length),o=n.changes.compose(t.changes)):(s=t.changes.map(n.changes),r=n.changes.mapDesc(t.changes,!0),o=n.changes.compose(s)),{changes:o,selection:t.selection?t.selection.map(r):(i=n.selection)===null||i===void 0?void 0:i.map(s),effects:B.mapEffects(n.effects,s).concat(B.mapEffects(t.effects,r)),annotations:n.annotations.length?n.annotations.concat(t.annotations):t.annotations,scrollIntoView:n.scrollIntoView||t.scrollIntoView}}function Us(n,t,e){let i=t.selection,s=Ue(t.annotations);return t.userEvent&&(s=s.concat(it.userEvent.of(t.userEvent))),{changes:t.changes instanceof et?t.changes:et.of(t.changes||[],e,n.facet(ma)),selection:i&&(i instanceof b?i:b.single(i.anchor,i.head)),effects:Ue(t.effects),annotations:s,scrollIntoView:!!t.scrollIntoView}}function ka(n,t,e){let i=Us(n,t.length?t[0]:{},n.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=wa(i,Us(n,t[r],o?i.changes.newLength:n.doc.length),o)}let s=it.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return kf(e?wf(s):s)}function wf(n){let t=n.startState,e=!0;for(let s of t.facet(ga)){let r=s(n);if(r===!1){e=!1;break}Array.isArray(r)&&(e=e===!0?r:xf(e,r))}if(e!==!0){let s,r;if(e===!1)r=n.changes.invertedDesc,s=et.empty(t.doc.length);else{let o=n.changes.filter(e);s=o.changes,r=o.filtered.mapDesc(o.changes).invertedDesc}n=it.create(t,s,n.selection&&n.selection.map(r),B.mapEffects(n.effects,r),n.annotations,n.scrollIntoView)}let i=t.facet(ya);for(let s=i.length-1;s>=0;s--){let r=i[s](n);r instanceof it?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof it?n=r[0]:n=ka(t,Ue(r),!1)}return n}function kf(n){let t=n.startState,e=t.facet(ba),i=n;for(let s=e.length-1;s>=0;s--){let r=e[s](n);r&&Object.keys(r).length&&(i=wa(i,Us(t,r,n.changes.newLength),!0))}return i==n?n:it.create(t,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const vf=[];function Ue(n){return n==null?vf:Array.isArray(n)?n:[n]}var Y=function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n}(Y||(Y={}));const Sf=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let Gs;try{Gs=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Cf(n){if(Gs)return Gs.test(n);for(let t=0;t<n.length;t++){let e=n[t];if(/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||Sf.test(e)))return!0}return!1}function Af(n){return t=>{if(!/\S/.test(t))return Y.Space;if(Cf(t))return Y.Word;for(let e=0;e<n.length;e++)if(t.indexOf(n[e])>-1)return Y.Word;return Y.Other}}class W{constructor(t,e,i,s,r,o){this.config=t,this.doc=e,this.selection=i,this.values=s,this.status=t.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)xi(this,l<<1);this.computeSlot=null}field(t,e=!0){let i=this.config.address[t.id];if(i==null){if(e)throw new RangeError("Field is not present in this state");return}return xi(this,i),Mn(this,i)}update(...t){return ka(this,t,!0)}applyTransaction(t){let e=this.config,{base:i,compartments:s}=e;for(let l of t.effects)l.is(Jn.reconfigure)?(e&&(s=new Map,e.compartments.forEach((a,h)=>s.set(h,a)),e=null),s.set(l.value.compartment,l.value.extension)):l.is(B.reconfigure)?(e=null,i=l.value):l.is(B.appendConfig)&&(e=null,i=Ue(i).concat(l.value));let r;e?r=t.startState.values.slice():(e=An.resolve(i,s,this),r=new W(e,this.doc,this.selection,e.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=t.startState.facet(Ks)?t.newSelection:t.newSelection.asSingle();new W(e,t.newDoc,o,r,(l,a)=>a.update(l,t),t)}replaceSelection(t){return typeof t=="string"&&(t=this.toText(t)),this.changeByRange(e=>({changes:{from:e.from,to:e.to,insert:t},range:b.cursor(e.from+t.length)}))}changeByRange(t){let e=this.selection,i=t(e.ranges[0]),s=this.changes(i.changes),r=[i.range],o=Ue(i.effects);for(let l=1;l<e.ranges.length;l++){let a=t(e.ranges[l]),h=this.changes(a.changes),c=h.map(s);for(let u=0;u<l;u++)r[u]=r[u].map(c);let f=s.mapDesc(h,!0);r.push(a.range.map(f)),s=s.compose(c),o=B.mapEffects(o,c).concat(B.mapEffects(Ue(a.effects),f))}return{changes:s,selection:b.create(r,e.mainIndex),effects:o}}changes(t=[]){return t instanceof et?t:et.of(t,this.doc.length,this.facet(W.lineSeparator))}toText(t){return z.of(t.split(this.facet(W.lineSeparator)||Ws))}sliceDoc(t=0,e=this.doc.length){return this.doc.sliceString(t,e,this.lineBreak)}facet(t){let e=this.config.address[t.id];return e==null?t.default:(xi(this,e),Mn(this,e))}toJSON(t){let e={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(t)for(let i in t){let s=t[i];s instanceof nt&&this.config.address[s.id]!=null&&(e[i]=s.spec.toJSON(this.field(t[i]),this))}return e}static fromJSON(t,e={},i){if(!t||typeof t.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(i){for(let r in i)if(Object.prototype.hasOwnProperty.call(t,r)){let o=i[r],l=t[r];s.push(o.init(a=>o.spec.fromJSON(l,a)))}}return W.create({doc:t.doc,selection:b.fromJSON(t.selection),extensions:e.extensions?s.concat([e.extensions]):s})}static create(t={}){let e=An.resolve(t.extensions||[],new Map),i=t.doc instanceof z?t.doc:z.of((t.doc||"").split(e.staticFacet(W.lineSeparator)||Ws)),s=t.selection?t.selection instanceof b?t.selection:b.single(t.selection.anchor,t.selection.head):b.single(0);return ua(s,i.length),e.staticFacet(Ks)||(s=s.asSingle()),new W(e,i,s,e.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(W.tabSize)}get lineBreak(){return this.facet(W.lineSeparator)||`
`}get readOnly(){return this.facet(xa)}phrase(t,...e){for(let i of this.facet(W.phrases))if(Object.prototype.hasOwnProperty.call(i,t)){t=i[t];break}return e.length&&(t=t.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>e.length?i:e[r-1]})),t}languageDataAt(t,e,i=-1){let s=[];for(let r of this.facet(pa))for(let o of r(this,e,i))Object.prototype.hasOwnProperty.call(o,t)&&s.push(o[t]);return s}charCategorizer(t){return Af(this.languageDataAt("wordChars",t).join(""))}wordAt(t){let{text:e,from:i,length:s}=this.doc.lineAt(t),r=this.charCategorizer(t),o=t-i,l=t-i;for(;o>0;){let a=at(e,o,!1);if(r(e.slice(a,o))!=Y.Word)break;o=a}for(;l<s;){let a=at(e,l);if(r(e.slice(l,a))!=Y.Word)break;l=a}return o==l?null:b.range(o+i,l+i)}}W.allowMultipleSelections=Ks;W.tabSize=O.define({combine:n=>n.length?n[0]:4});W.lineSeparator=ma;W.readOnly=xa;W.phrases=O.define({compare(n,t){let e=Object.keys(n),i=Object.keys(t);return e.length==i.length&&e.every(s=>n[s]==t[s])}});W.languageData=pa;W.changeFilter=ga;W.transactionFilter=ya;W.transactionExtender=ba;Jn.reconfigure=B.define();function Wt(n,t,e={}){let i={};for(let s of n)for(let r of Object.keys(s)){let o=s[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 s in t)i[s]===void 0&&(i[s]=t[s]);return i}class Be{eq(t){return this==t}range(t,e=t){return Ys.create(t,e,this)}}Be.prototype.startSide=Be.prototype.endSide=0;Be.prototype.point=!1;Be.prototype.mapMode=pt.TrackDel;let Ys=class va{constructor(t,e,i){this.from=t,this.to=e,this.value=i}static create(t,e,i){return new va(t,e,i)}};function Qs(n,t){return n.from-t.from||n.value.startSide-t.value.startSide}class Wr{constructor(t,e,i,s){this.from=t,this.to=e,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(t,e,i,s=0){let r=i?this.to:this.from;for(let o=s,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,s){for(let r=this.findIndex(e,-1e9,!0),o=this.findIndex(i,1e9,!1,r);r<o;r++)if(s(this.from[r]+t,this.to[r]+t,this.value[r])===!1)return!1}map(t,e){let i=[],s=[],r=[],o=-1,l=-1;for(let a=0;a<this.value.length;a++){let h=this.value[a],c=this.from[a]+t,f=this.to[a]+t,u,d;if(c==f){let p=e.mapPos(c,h.startSide,h.mapMode);if(p==null||(u=d=p,h.startSide!=h.endSide&&(d=e.mapPos(c,h.endSide),d<u)))continue}else if(u=e.mapPos(c,h.startSide),d=e.mapPos(f,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),s.push(u-o),r.push(d-o))}return{mapped:i.length?new Wr(s,r,i,l):null,pos:o}}}class F{constructor(t,e,i,s){this.chunkPos=t,this.chunk=e,this.nextLayer=i,this.maxPoint=s}static create(t,e,i,s){return new F(t,e,i,s)}get length(){let t=this.chunk.length-1;return t<0?0:Math.max(this.chunkEnd(t),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let t=this.nextLayer.size;for(let e of this.chunk)t+=e.value.length;return t}chunkEnd(t){return this.chunkPos[t]+this.chunk[t].length}update(t){let{add:e=[],sort:i=!1,filterFrom:s=0,filterTo:r=this.length}=t,o=t.filter;if(e.length==0&&!o)return this;if(i&&(e=e.slice().sort(Qs)),this.isEmpty)return e.length?F.of(e):this;let l=new Sa(this,null,-1).goto(0),a=0,h=[],c=new be;for(;l.value||a<e.length;)if(a<e.length&&(l.from-e[a].from||l.startSide-e[a].value.startSide)>=0){let f=e[a++];c.addInner(f.from,f.to,f.value)||h.push(f)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==e.length||this.chunkEnd(l.chunkIndex)<e[a].from)&&(!o||s>this.chunkEnd(l.chunkIndex)||r<this.chunkPos[l.chunkIndex])&&c.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!o||s>l.to||r<l.from||o(l.from,l.to,l.value))&&(c.addInner(l.from,l.to,l.value)||h.push(Ys.create(l.from,l.to,l.value))),l.next());return c.finishInner(this.nextLayer.isEmpty&&!h.length?F.empty:this.nextLayer.update({add:h,filter:o,filterFrom:s,filterTo:r}))}map(t){if(t.empty||this.isEmpty)return this;let e=[],i=[],s=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],a=this.chunk[o],h=t.touchesRange(l,l+a.length);if(h===!1)s=Math.max(s,a.maxPoint),e.push(a),i.push(t.mapPos(l));else if(h===!0){let{mapped:c,pos:f}=a.map(l,t);c&&(s=Math.max(s,c.maxPoint),e.push(c),i.push(f))}}let r=this.nextLayer.map(t);return e.length==0?r:new F(i,e,r||F.empty,s)}between(t,e,i){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let r=this.chunkPos[s],o=this.chunk[s];if(e>=r&&t<=r+o.length&&o.between(r,t-r,e-r,i)===!1)return}this.nextLayer.between(t,e,i)}}iter(t=0){return Ci.from([this]).goto(t)}get isEmpty(){return this.nextLayer==this}static iter(t,e=0){return Ci.from(t).goto(e)}static compare(t,e,i,s,r=-1){let o=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),l=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),a=ko(o,l,i),h=new ai(o,a,r),c=new ai(l,a,r);i.iterGaps((f,u,d)=>vo(h,f,c,u,d,s)),i.empty&&i.length==0&&vo(h,0,c,0,0,s)}static eq(t,e,i=0,s){s==null&&(s=999999999);let r=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0),o=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let l=ko(r,o),a=new ai(r,l,0).goto(i),h=new ai(o,l,0).goto(i);for(;;){if(a.to!=h.to||!Xs(a.active,h.active)||a.point&&(!h.point||!a.point.eq(h.point)))return!1;if(a.to>s)return!0;a.next(),h.next()}}static spans(t,e,i,s,r=-1){let o=new ai(t,null,r).goto(e),l=e,a=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFrom<e?c.length+1:o.point.startSide<0?c.length:Math.min(c.length,a);s.point(l,h,o.point,c,f,o.pointRank),a=Math.min(o.openEnd(h),c.length)}else h>l&&(s.span(l,h,o.active,a),a=o.openEnd(h));if(o.to>i)return a+(o.point&&o.to>i?1:0);l=o.to,o.next()}}static of(t,e=!1){let i=new be;for(let s of t instanceof Ys?[t]:e?Mf(t):t)i.add(s.from,s.to,s.value);return i.finish()}static join(t){if(!t.length)return F.empty;let e=t[t.length-1];for(let i=t.length-2;i>=0;i--)for(let s=t[i];s!=F.empty;s=s.nextLayer)e=new F(s.chunkPos,s.chunk,e,Math.max(s.maxPoint,e.maxPoint));return e}}F.empty=new F([],[],null,-1);function Mf(n){if(n.length>1)for(let t=n[0],e=1;e<n.length;e++){let i=n[e];if(Qs(t,i)>0)return n.slice().sort(Qs);t=i}return n}F.empty.nextLayer=F.empty;class be{finishChunk(t){this.chunks.push(new Wr(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 be)).add(t,e,i)}addInner(t,e,i){let s=t-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(t-this.lastFrom||i.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return s<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(F.empty)}finishInner(t){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return t;let e=F.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(t):t,this.setMaxPoint);return this.from=null,e}}function ko(n,t,e){let i=new Map;for(let r of n)for(let o=0;o<r.chunk.length;o++)r.chunk[o].maxPoint<=0&&i.set(r.chunk[o],r.chunkPos[o]);let s=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!=null&&e.touchesRange(l,l+r.chunk[o].length))&&s.add(r.chunk[o])}return s}class Sa{constructor(t,e,i,s=0){this.layer=t,this.skip=e,this.minPoint=i,this.rank=s}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 s=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(s)||this.layer.chunkEnd(this.chunkIndex)<t||s.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(t-this.layer.chunkPos[this.chunkIndex],e,!0);(!i||this.rangeIndex<s)&&this.setRangeIndex(s)}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}}class Ci{constructor(t){this.heap=t}static from(t,e=null,i=-1){let s=[];for(let r=0;r<t.length;r++)for(let o=t[r];!o.isEmpty;o=o.nextLayer)o.maxPoint>=i&&s.push(new Sa(o,e,i,r));return s.length==1?s[0]:new Ci(s)}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--)ps(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--)ps(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(),ps(this.heap,0)}}}function ps(n,t){for(let e=n[t];;){let i=(t<<1)+1;if(i>=n.length)break;let s=n[i];if(i+1<n.length&&s.compare(n[i+1])>=0&&(s=n[i+1],i++),e.compare(s)<0)break;n[i]=e,n[t]=s,t=i}}class ai{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=Ci.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){ji(this.active,t),ji(this.activeTo,t),ji(this.activeRank,t),this.minActive=So(this.active,this.activeTo)}addActive(t){let e=0,{value:i,to:s,rank:r}=this.cursor;for(;e<this.activeRank.length&&(r-this.activeRank[e]||s-this.activeTo[e])>0;)e++;Ki(this.active,e,i),Ki(this.activeTo,e,s),Ki(this.activeRank,e,r),t&&Ki(t,e,this.cursor.from),this.minActive=So(this.active,this.activeTo)}next(){let t=this.to,e=this.point;this.point=null;let i=this.openStart<0?[]:null;for(;;){let s=this.minActive;if(s>-1&&(this.activeTo[s]-this.cursor.from||this.active[s].endSide-this.cursor.startSide)<0){if(this.activeTo[s]>t){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),i&&ji(i,s)}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 s=i.length-1;s>=0&&i[s]<t;s--)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 vo(n,t,e,i,s,r){n.goto(t),e.goto(i);let o=i+s,l=i,a=i-t;for(;;){let h=n.to+a-e.to,c=h||n.endSide-e.endSide,f=c<0?n.to+a:e.to,u=Math.min(f,o);if(n.point||e.point?n.point&&e.point&&(n.point==e.point||n.point.eq(e.point))&&Xs(n.activeForPoint(n.to),e.activeForPoint(e.to))||r.comparePoint(l,u,n.point,e.point):u>l&&!Xs(n.active,e.active)&&r.compareRange(l,u,n.active,e.active),f>o)break;(h||n.openEnd!=e.openEnd)&&r.boundChange&&r.boundChange(f),l=f,c<=0&&n.next(),c>=0&&e.next()}}function Xs(n,t){if(n.length!=t.length)return!1;for(let e=0;e<n.length;e++)if(n[e]!=t[e]&&!n[e].eq(t[e]))return!1;return!0}function ji(n,t){for(let e=t,i=n.length-1;e<i;e++)n[e]=n[e+1];n.pop()}function Ki(n,t,e){for(let i=n.length-1;i>=t;i--)n[i+1]=n[i];n[t]=e}function So(n,t){let e=-1,i=1e9;for(let s=0;s<t.length;s++)(t[s]-i||n[s].endSide-n[e].endSide)<0&&(e=s,i=t[s]);return e}function ri(n,t,e=n.length){let i=0;for(let s=0;s<e&&s<n.length;)n.charCodeAt(s)==9?(i+=t-i%t,s++):(i++,s=at(n,s));return i}function Js(n,t,e,i){for(let s=0,r=0;;){if(r>=t)return s;if(s==n.length)break;r+=n.charCodeAt(s)==9?e-r%e:1,s=at(n,s)}return i===!0?-1:n.length}const _s="ͼ",Co=typeof Symbol>"u"?"__"+_s:Symbol.for(_s),Zs=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Ao=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class xe{constructor(t,e){this.rules=[];let{finish:i}=e||{};function s(o){return/^@/.test(o)?[o]:o.split(/,\s*/)}function r(o,l,a,h){let c=[],f=/^@(\w+)\b/.exec(o[0]),u=f&&f[1]=="keyframes";if(f&&l==null)return a.push(o[0]+";");for(let d in l){let p=l[d];if(/&/.test(d))r(d.split(/,\s*/).map(m=>o.map(g=>m.replace(/&/,g))).reduce((m,g)=>m.concat(g)),p,a);else if(p&&typeof p=="object"){if(!f)throw new RangeError("The value of a property ("+d+") should be a primitive value.");r(s(d),p,c,u)}else p!=null&&c.push(d.replace(/_.*/,"").replace(/[A-Z]/g,m=>"-"+m.toLowerCase())+": "+p+";")}(c.length||u)&&a.push((i&&!f&&!h?o.map(i):o).join(", ")+" {"+c.join(" ")+"}")}for(let o in t)r(s(o),t[o],this.rules)}getRules(){return this.rules.join(`
`)}static newName(){let t=Ao[Co]||1;return Ao[Co]=t+1,_s+t.toString(36)}static mount(t,e,i){let s=t[Zs],r=i&&i.nonce;s?r&&s.setNonce(r):s=new Of(t,r),s.mount(Array.isArray(e)?e:[e],t)}}let Mo=new Map;class Of{constructor(t,e){let i=t.ownerDocument||t,s=i.defaultView;if(!t.head&&t.adoptedStyleSheets&&s.CSSStyleSheet){let r=Mo.get(i);if(r)return t[Zs]=r;this.sheet=new s.CSSStyleSheet,Mo.set(i,this)}else this.styleTag=i.createElement("style"),e&&this.styleTag.setAttribute("nonce",e);this.modules=[],t[Zs]=this}mount(t,e){let i=this.sheet,s=0,r=0;for(