this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

init

Juliet ceb9a7bb

+140
88x31.webp

This is a binary file and will not be displayed.

+12
assets/editor-DQE52n0t.js
··· 1 + import{o as Su,e as Cu,a as Au,u as Mu,t as Tu}from"./index-B_dCXHrJ.js";let Gr=[],Mh=[];(()=>{let n="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(e=>e?parseInt(e,36):1);for(let e=0,t=0;e<n.length;e++)(e%2?Mh:Gr).push(t=t+n[e])})();function Ou(n){if(n<768)return!1;for(let e=0,t=Gr.length;;){let i=e+t>>1;if(n<Gr[i])t=i;else if(n>=Mh[i])e=i+1;else return!0;if(e==t)return!1}}function Tl(n){return n>=127462&&n<=127487}const Ol=8205;function Du(n,e,t=!0,i=!0){return(t?Th:Ru)(n,e,i)}function Th(n,e,t){if(e==n.length)return e;e&&Oh(n.charCodeAt(e))&&Dh(n.charCodeAt(e-1))&&e--;let i=Js(n,e);for(e+=Dl(i);e<n.length;){let s=Js(n,e);if(i==Ol||s==Ol||t&&Ou(s))e+=Dl(s),i=s;else if(Tl(s)){let r=0,o=e-2;for(;o>=0&&Tl(Js(n,o));)r++,o-=2;if(r%2==0)break;e+=2}else break}return e}function Ru(n,e,t){for(;e>0;){let i=Th(n,e-2,t);if(i<e)return i;e--}return 0}function Js(n,e){let t=n.charCodeAt(e);if(!Dh(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Oh(i)?(t-55296<<10)+(i-56320)+65536:t}function Oh(n){return n>=56320&&n<57344}function Dh(n){return n>=55296&&n<56320}function Dl(n){return n<65536?1:2}class F{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,t,i){[e,t]=Si(this,e,t);let s=[];return this.decompose(0,e,s,2),i.length&&i.decompose(0,i.length,s,3),this.decompose(t,this.length,s,1),et.from(s,this.length-(t-e)+i.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,t=this.length){[e,t]=Si(this,e,t);let i=[];return this.decompose(e,t,i,0),et.from(i,t-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let t=this.scanIdentical(e,1),i=this.length-this.scanIdentical(e,-1),s=new qi(this),r=new qi(e);for(let o=t,l=t;;){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(e=1){return new qi(this,e)}iterRange(e,t=this.length){return new Rh(this,e,t)}iterLines(e,t){let i;if(e==null)i=this.iter();else{t==null&&(t=this.lines+1);let s=this.line(e).from;i=this.iterRange(s,Math.max(s,t==this.lines+1?this.length:t<=1?0:this.line(t-1).to))}return new Bh(i)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?F.empty:e.length<=32?new J(e):et.from(J.split(e,[]))}}class J extends F{constructor(e,t=Bu(e)){super(),this.text=e,this.length=t}get lines(){return this.text.length}get children(){return null}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.text[r],l=s+o.length;if((t?i:l)>=e)return new Pu(s,l,i,o);s=l+1,i++}}decompose(e,t,i,s){let r=e<=0&&t>=this.length?this:new J(Rl(this.text,e,t),Math.min(t,this.length)-Math.max(0,e));if(s&1){let o=i.pop(),l=Zn(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(e,t,i){if(!(i instanceof J))return super.replace(e,t,i);[e,t]=Si(this,e,t);let s=Zn(this.text,Zn(i.text,Rl(this.text,0,e)),t),r=this.length+i.length-(t-e);return s.length<=32?new J(s,r):et.from(J.split(s,[]),r)}sliceString(e,t=this.length,i=` 2 + `){[e,t]=Si(this,e,t);let s="";for(let r=0,o=0;r<=t&&o<this.text.length;o++){let l=this.text[o],a=r+l.length;r>e&&o&&(s+=i),e<a&&t>r&&(s+=l.slice(Math.max(0,e-r),t-r)),r=a+1}return s}flatten(e){for(let t of this.text)e.push(t)}scanIdentical(){return 0}static split(e,t){let i=[],s=-1;for(let r of e)i.push(r),s+=r.length+1,i.length==32&&(t.push(new J(i,s)),i=[],s=-1);return s>-1&&t.push(new J(i,s)),t}}class et extends F{constructor(e,t){super(),this.children=e,this.length=t,this.lines=0;for(let i of e)this.lines+=i.lines}lineInner(e,t,i,s){for(let r=0;;r++){let o=this.children[r],l=s+o.length,a=i+o.lines-1;if((t?a:l)>=e)return o.lineInner(e,t,i,s);s=l+1,i=a+1}}decompose(e,t,i,s){for(let r=0,o=0;o<=t&&r<this.children.length;r++){let l=this.children[r],a=o+l.length;if(e<=a&&t>=o){let h=s&((o<=e?1:0)|(a>=t?2:0));o>=e&&a<=t&&!h?i.push(l):l.decompose(e-o,t-o,i,h)}o=a+1}}replace(e,t,i){if([e,t]=Si(this,e,t),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(e>=r&&t<=l){let a=o.replace(e-r,t-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 et(c,this.length-(t-e)+i.length)}return super.replace(r,l,a)}r=l+1}return super.replace(e,t,i)}sliceString(e,t=this.length,i=` 3 + `){[e,t]=Si(this,e,t);let s="";for(let r=0,o=0;r<this.children.length&&o<=t;r++){let l=this.children[r],a=o+l.length;o>e&&r&&(s+=i),e<a&&t>o&&(s+=l.sliceString(e-o,t-o,i)),o=a+1}return s}flatten(e){for(let t of this.children)t.flatten(e)}scanIdentical(e,t){if(!(e instanceof et))return 0;let i=0,[s,r,o,l]=t>0?[0,0,this.children.length,e.children.length]:[this.children.length-1,e.children.length-1,-1,-1];for(;;s+=t,r+=t){if(s==o||r==l)return i;let a=this.children[s],h=e.children[r];if(a!=h)return i+a.scanIdentical(h,t);i+=a.length+1}}static from(e,t=e.reduce((i,s)=>i+s.length+1,-1)){let i=0;for(let d of e)i+=d.lines;if(i<32){let d=[];for(let p of e)p.flatten(d);return new J(d,t)}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 et)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]:et.from(c,h)),h=-1,a=c.length=0)}for(let d of e)f(d);return u(),l.length==1?l[0]:new et(l,t)}}F.empty=new J([""],0);function Bu(n){let e=-1;for(let t of n)e+=t.length+1;return e}function Zn(n,e,t=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>=t&&(a>i&&(l=l.slice(0,i-s)),s<t&&(l=l.slice(t-s)),o?(e[e.length-1]+=l,o=!1):e.push(l)),s=a+1}return e}function Rl(n,e,t){return Zn(n,[""],e,t)}class qi{constructor(e,t=1){this.dir=t,this.done=!1,this.lineBreak=!1,this.value="",this.nodes=[e],this.offsets=[t>0?1:(e instanceof J?e.text.length:e.children.length)<<1]}nextInner(e,t){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==(t>0?l:0)){if(i==0)return this.done=!0,this.value="",this;t>0&&this.offsets[i-1]++,this.nodes.pop(),this.offsets.pop()}else if((r&1)==(t>0?0:1)){if(this.offsets[i]+=t,e==0)return this.lineBreak=!0,this.value=` 4 + `,this;e--}else if(s instanceof J){let a=s.text[o+(t<0?-1:0)];if(this.offsets[i]+=t,a.length>Math.max(0,e))return this.value=e==0?a:t>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=s.children[o+(t<0?-1:0)];e>a.length?(e-=a.length,this.offsets[i]+=t):(t<0&&this.offsets[i]--,this.nodes.push(a),this.offsets.push(t>0?1:(a instanceof J?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}}class Rh{constructor(e,t,i){this.value="",this.done=!1,this.cursor=new qi(e,t>i?-1:1),this.pos=t>i?e.length:0,this.from=Math.min(t,i),this.to=Math.max(t,i)}nextInner(e,t){if(t<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,t<0?this.pos-this.to:this.from-this.pos);let i=t<0?this.pos-this.from:this.to-this.pos;e>i&&(e=i),i-=e;let{value:s}=this.cursor.next(e);return this.pos+=(s.length+e)*t,this.value=s.length<=i?s:t<0?s.slice(s.length-i):s.slice(0,i),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}}class Bh{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:t,lineBreak:i,value:s}=this.inner.next(e);return t&&this.afterBreak?(this.value="",this.afterBreak=!1):t?(this.done=!0,this.value=""):i?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=s,this.afterBreak=!1),this}get lineBreak(){return!1}}typeof Symbol<"u"&&(F.prototype[Symbol.iterator]=function(){return this.iter()},qi.prototype[Symbol.iterator]=Rh.prototype[Symbol.iterator]=Bh.prototype[Symbol.iterator]=function(){return this});class Pu{constructor(e,t,i,s){this.from=e,this.to=t,this.number=i,this.text=s}get length(){return this.to-this.from}}function Si(n,e,t){return e=Math.max(0,Math.min(n.length,e)),[e,Math.max(e,Math.min(n.length,t))]}function ne(n,e,t=!0,i=!0){return Du(n,e,t,i)}function Lu(n){return n>=56320&&n<57344}function Eu(n){return n>=55296&&n<56320}function be(n,e){let t=n.charCodeAt(e);if(!Eu(t)||e+1==n.length)return t;let i=n.charCodeAt(e+1);return Lu(i)?(t-55296<<10)+(i-56320)+65536:t}function Vo(n){return n<=65535?String.fromCharCode(n):(n-=65536,String.fromCharCode((n>>10)+55296,(n&1023)+56320))}function tt(n){return n<65536?1:2}const Qr=/\r\n?|\n/;var pe=(function(n){return n[n.Simple=0]="Simple",n[n.TrackDel=1]="TrackDel",n[n.TrackBefore=2]="TrackBefore",n[n.TrackAfter=3]="TrackAfter",n})(pe||(pe={}));class lt{constructor(e){this.sections=e}get length(){let e=0;for(let t=0;t<this.sections.length;t+=2)e+=this.sections[t];return e}get newLength(){let e=0;for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t+1];e+=i<0?this.sections[t]:i}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let t=0,i=0,s=0;t<this.sections.length;){let r=this.sections[t++],o=this.sections[t++];o<0?(e(i,s,r),s+=r):s+=o,i+=r}}iterChangedRanges(e,t=!1){Yr(this,e,t)}get invertedDesc(){let e=[];for(let t=0;t<this.sections.length;){let i=this.sections[t++],s=this.sections[t++];s<0?e.push(i,s):e.push(s,i)}return new lt(e)}composeDesc(e){return this.empty?e:e.empty?this:Ph(this,e)}mapDesc(e,t=!1){return e.empty?this:_r(this,e,t)}mapPos(e,t=-1,i=pe.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>e)return r+(e-s);r+=l}else{if(i!=pe.Simple&&h>=e&&(i==pe.TrackDel&&s<e&&h>e||i==pe.TrackBefore&&s<e||i==pe.TrackAfter&&h>e))return null;if(h>e||h==e&&t<0&&!l)return e==s||t<0?r:r+a;r+=a}s=h}if(e>s)throw new RangeError(`Position ${e} is out of range for changeset of length ${s}`);return r}touchesRange(e,t=e){for(let i=0,s=0;i<this.sections.length&&s<=t;){let r=this.sections[i++],o=this.sections[i++],l=s+r;if(o>=0&&s<=t&&l>=e)return s<e&&l>t?"cover":!0;s=l}return!1}toString(){let e="";for(let t=0;t<this.sections.length;){let i=this.sections[t++],s=this.sections[t++];e+=(e?" ":"")+i+(s>=0?":"+s:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(t=>typeof t!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new lt(e)}static create(e){return new lt(e)}}class ee extends lt{constructor(e,t){super(e),this.inserted=t}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Yr(this,(t,i,s,r,o)=>e=e.replace(s,s+(i-t),o),!1),e}mapDesc(e,t=!1){return _r(this,e,t,!0)}invert(e){let t=this.sections.slice(),i=[];for(let s=0,r=0;s<t.length;s+=2){let o=t[s],l=t[s+1];if(l>=0){t[s]=l,t[s+1]=o;let a=s>>1;for(;i.length<a;)i.push(F.empty);i.push(o?e.slice(r,r+o):F.empty)}r+=o}return new ee(t,i)}compose(e){return this.empty?e:e.empty?this:Ph(this,e,!0)}map(e,t=!1){return e.empty?this:_r(this,e,t,!0)}iterChanges(e,t=!1){Yr(this,e,t)}get desc(){return lt.create(this.sections)}filter(e){let t=[],i=[],s=[],r=new _i(this);e:for(let o=0,l=0;;){let a=o==e.length?1e9:e[o++];for(;l<a||l==a&&r.len==0;){if(r.done)break e;let c=Math.min(r.len,a-l);ae(s,c,-1);let f=r.ins==-1?-1:r.off==0?r.ins:0;ae(t,c,f),f>0&&St(i,t,r.text),r.forward(c),l+=c}let h=e[o++];for(;l<h;){if(r.done)break e;let c=Math.min(r.len,h-l);ae(t,c,-1),ae(s,c,r.ins==-1?-1:r.off==0?r.ins:0),r.forward(c),l+=c}}return{changes:new ee(t,i),filtered:lt.create(s)}}toJSON(){let e=[];for(let t=0;t<this.sections.length;t+=2){let i=this.sections[t],s=this.sections[t+1];s<0?e.push(i):s==0?e.push([i]):e.push([i].concat(this.inserted[t>>1].toJSON()))}return e}static of(e,t,i){let s=[],r=[],o=0,l=null;function a(c=!1){if(!c&&!s.length)return;o<t&&ae(s,t-o,-1);let f=new ee(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 ee){if(c.length!=t)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${t})`);a(),l=l?l.compose(c.map(l)):c}else{let{from:f,to:u=f,insert:d}=c;if(f>u||f<0||u>t)throw new RangeError(`Invalid change range ${f} to ${u} (in doc of length ${t})`);let p=d?typeof d=="string"?F.of(d.split(i||Qr)):d:F.empty,m=p.length;if(f==u&&m==0)return;f<o&&a(),f>o&&ae(s,f-o,-1),ae(s,u-f,m),St(r,s,p),o=u}}return h(e),a(!l),l}static empty(e){return new ee(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let t=[],i=[];for(let s=0;s<e.length;s++){let r=e[s];if(typeof r=="number")t.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)t.push(r[0],0);else{for(;i.length<s;)i.push(F.empty);i[s]=F.of(r.slice(1)),t.push(r[0],i[s].length)}}}return new ee(t,i)}static createSet(e,t){return new ee(e,t)}}function ae(n,e,t,i=!1){if(e==0&&t<=0)return;let s=n.length-2;s>=0&&t<=0&&t==n[s+1]?n[s]+=e:s>=0&&e==0&&n[s]==0?n[s+1]+=t:i?(n[s]+=e,n[s+1]+=t):n.push(e,t)}function St(n,e,t){if(t.length==0)return;let i=e.length-2>>1;if(i<n.length)n[n.length-1]=n[n.length-1].append(t);else{for(;n.length<i;)n.push(F.empty);n.push(t)}}function Yr(n,e,t){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=F.empty;for(;h+=l,c+=a,a&&i&&(f=f.append(i[o-2>>1])),!(t||o==n.sections.length||n.sections[o+1]<0);)l=n.sections[o++],a=n.sections[o++];e(s,h,r,c,f),s=h,r=c}}}function _r(n,e,t,i=!1){let s=[],r=i?[]:null,o=new _i(n),l=new _i(e);for(let a=-1;;){if(o.done&&l.len||l.done&&o.len)throw new Error("Mismatched change set lengths");if(o.ins==-1&&l.ins==-1){let h=Math.min(o.len,l.len);ae(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&&!t))){let h=l.len;for(ae(s,l.ins,-1);h;){let c=Math.min(o.len,h);o.ins>=0&&a<o.i&&o.len<=c&&(ae(s,0,o.ins),r&&St(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;ae(s,h,a<o.i?o.ins:0),r&&a<o.i&&St(r,s,o.text),a=o.i,o.forward(o.len-c)}else{if(o.done&&l.done)return r?ee.createSet(s,r):lt.create(s);throw new Error("Mismatched change set lengths")}}}function Ph(n,e,t=!1){let i=[],s=t?[]:null,r=new _i(n),o=new _i(e);for(let l=!1;;){if(r.done&&o.done)return s?ee.createSet(i,s):lt.create(i);if(r.ins==0)ae(i,r.len,0,l),r.next();else if(o.len==0&&!o.done)ae(i,0,o.ins,l),s&&St(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;ae(i,a,c,l),s&&c&&St(s,i,o.text)}else o.ins==-1?(ae(i,r.off?0:r.len,a,l),s&&St(s,i,r.textBit(a))):(ae(i,r.off?0:r.len,o.off?0:o.ins,l),s&&!o.off&&St(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 _i{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,t=this.i-2>>1;return t>=e.length?F.empty:e[t]}textBit(e){let{inserted:t}=this.set,i=this.i-2>>1;return i>=t.length&&!e?F.empty:t[i].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}}class Ut{constructor(e,t,i){this.from=e,this.to=t,this.flags=i}get anchor(){return this.flags&32?this.to:this.from}get head(){return this.flags&32?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&8?-1:this.flags&16?1:0}get bidiLevel(){let e=this.flags&7;return e==7?null:e}get goalColumn(){let e=this.flags>>6;return e==16777215?void 0:e}map(e,t=-1){let i,s;return this.empty?i=s=e.mapPos(this.from,t):(i=e.mapPos(this.from,1),s=e.mapPos(this.to,-1)),i==this.from&&s==this.to?this:new Ut(i,s,this.flags)}extend(e,t=e){if(e<=this.anchor&&t>=this.anchor)return x.range(e,t);let i=Math.abs(e-this.anchor)>Math.abs(t-this.anchor)?e:t;return x.range(this.anchor,i)}eq(e,t=!1){return this.anchor==e.anchor&&this.head==e.head&&this.goalColumn==e.goalColumn&&(!t||!this.empty||this.assoc==e.assoc)}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return x.range(e.anchor,e.head)}static create(e,t,i){return new Ut(e,t,i)}}class x{constructor(e,t){this.ranges=e,this.mainIndex=t}map(e,t=-1){return e.empty?this:x.create(this.ranges.map(i=>i.map(e,t)),this.mainIndex)}eq(e,t=!1){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let i=0;i<this.ranges.length;i++)if(!this.ranges[i].eq(e.ranges[i],t))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new x([this.main],0)}addRange(e,t=!0){return x.create([e].concat(this.ranges),t?0:this.mainIndex+1)}replaceRange(e,t=this.mainIndex){let i=this.ranges.slice();return i[t]=e,x.create(i,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new x(e.ranges.map(t=>Ut.fromJSON(t)),e.main)}static single(e,t=e){return new x([x.range(e,t)],0)}static create(e,t=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let i=0,s=0;s<e.length;s++){let r=e[s];if(r.empty?r.from<=i:r.from<i)return x.normalized(e.slice(),t);i=r.to}return new x(e,t)}static cursor(e,t=0,i,s){return Ut.create(e,e,(t==0?0:t<0?8:16)|(i==null?7:Math.min(6,i))|(s??16777215)<<6)}static range(e,t,i,s){let r=(i??16777215)<<6|(s==null?7:Math.min(6,s));return t<e?Ut.create(t,e,48|r):Ut.create(e,t,(t>e?8:0)|r)}static normalized(e,t=0){let i=e[t];e.sort((s,r)=>s.from-r.from),t=e.indexOf(i);for(let s=1;s<e.length;s++){let r=e[s],o=e[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<=t&&t--,e.splice(--s,2,r.anchor>r.head?x.range(a,l):x.range(l,a))}}return new x(e,t)}}function Lh(n,e){for(let t of n.ranges)if(t.to>e)throw new RangeError("Selection points outside of document")}let zo=0;class O{constructor(e,t,i,s,r){this.combine=e,this.compareInput=t,this.compare=i,this.isStatic=s,this.id=zo++,this.default=e([]),this.extensions=typeof r=="function"?r(this):r}get reader(){return this}static define(e={}){return new O(e.combine||(t=>t),e.compareInput||((t,i)=>t===i),e.compare||(e.combine?(t,i)=>t===i:$o),!!e.static,e.enables)}of(e){return new es([],this,0,e)}compute(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new es(e,this,1,t)}computeN(e,t){if(this.isStatic)throw new Error("Can't compute a static facet");return new es(e,this,2,t)}from(e,t){return t||(t=i=>i),this.compute([e],i=>t(i.field(e)))}}function $o(n,e){return n==e||n.length==e.length&&n.every((t,i)=>t===e[i])}class es{constructor(e,t,i,s){this.dependencies=e,this.facet=t,this.type=i,this.value=s,this.id=zo++}dynamicSlot(e){var t;let i=this.value,s=this.facet.compareInput,r=this.id,o=e[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:(((t=e[f.id])!==null&&t!==void 0?t:1)&1)==0&&c.push(e[f.id]);return{create(f){return f.values[o]=i(f),1},update(f,u){if(a&&u.docChanged||h&&(u.docChanged||u.selection)||Xr(f,c)){let d=i(f);if(l?!Bl(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=cs(u,p);if(this.dependencies.every(b=>b instanceof O?u.facet(b)===f.facet(b):b instanceof ce?u.field(b,!1)==f.field(b,!1):!0)||(l?Bl(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 Bl(n,e,t){if(n.length!=e.length)return!1;for(let i=0;i<n.length;i++)if(!t(n[i],e[i]))return!1;return!0}function Xr(n,e){let t=!1;for(let i of e)Ki(n,i)&1&&(t=!0);return t}function Iu(n,e,t){let i=t.map(a=>n[a.id]),s=t.map(a=>a.type),r=i.filter(a=>!(a&1)),o=n[e.id]>>1;function l(a){let h=[];for(let c=0;c<i.length;c++){let f=cs(a,i[c]);if(s[c]==2)for(let u of f)h.push(u);else h.push(f)}return e.combine(h)}return{create(a){for(let h of i)Ki(a,h);return a.values[o]=l(a),1},update(a,h){if(!Xr(a,r))return 0;let c=l(a);return e.compare(c,a.values[o])?0:(a.values[o]=c,1)},reconfigure(a,h){let c=Xr(a,i),f=h.config.facets[e.id],u=h.facet(e);if(f&&!c&&$o(t,f))return a.values[o]=u,0;let d=l(a);return e.compare(d,u)?(a.values[o]=u,0):(a.values[o]=d,1)}}}const wn=O.define({static:!0});class ce{constructor(e,t,i,s,r){this.id=e,this.createF=t,this.updateF=i,this.compareF=s,this.spec=r,this.provides=void 0}static define(e){let t=new ce(zo++,e.create,e.update,e.compare||((i,s)=>i===s),e);return e.provide&&(t.provides=e.provide(t)),t}create(e){let t=e.facet(wn).find(i=>i.field==this);return(t?.create||this.createF)(e)}slot(e){let t=e[this.id]>>1;return{create:i=>(i.values[t]=this.create(i),1),update:(i,s)=>{let r=i.values[t],o=this.updateF(r,s);return this.compareF(r,o)?0:(i.values[t]=o,1)},reconfigure:(i,s)=>{let r=i.facet(wn),o=s.facet(wn),l;return(l=r.find(a=>a.field==this))&&l!=o.find(a=>a.field==this)?(i.values[t]=l.create(i),1):s.config.address[this.id]!=null?(i.values[t]=s.field(this),0):(i.values[t]=this.create(i),1)}}}init(e){return[this,wn.of({field:this,create:e})]}get extension(){return this}}const $t={lowest:4,low:3,default:2,high:1,highest:0};function Li(n){return e=>new Eh(e,n)}const ni={highest:Li($t.highest),high:Li($t.high),default:Li($t.default),low:Li($t.low),lowest:Li($t.lowest)};class Eh{constructor(e,t){this.inner=e,this.prec=t}}class un{of(e){return new Jr(this,e)}reconfigure(e){return un.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}}class Jr{constructor(e,t){this.compartment=e,this.inner=t}}class hs{constructor(e,t,i,s,r,o){for(this.base=e,this.compartments=t,this.dynamicSlots=i,this.address=s,this.staticValues=r,this.facets=o,this.statusTemplate=[];this.statusTemplate.length<i.length;)this.statusTemplate.push(0)}staticFacet(e){let t=this.address[e.id];return t==null?e.default:this.staticValues[t>>1]}static resolve(e,t,i){let s=[],r=Object.create(null),o=new Map;for(let u of Nu(e,t,o))u instanceof ce?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?.config.facets;for(let u in r){let d=r[u],p=d[0].facet,m=c&&c[u]||[];if(d.every(b=>b.type==0))if(l[p.id]=a.length<<1|1,$o(m,d))a.push(i.facet(p));else{let b=p.combine(d.map(y=>y.value));a.push(i&&p.compare(b,i.facet(p))?i.facet(p):b)}else{for(let b of d)b.type==0?(l[b.id]=a.length<<1|1,a.push(b.value)):(l[b.id]=h.length<<1,h.push(y=>b.dynamicSlot(y)));l[p.id]=h.length<<1,h.push(b=>Iu(b,p,d))}}let f=h.map(u=>u(l));return new hs(e,o,f,l,a,r)}}function Nu(n,e,t){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 Jr&&t.delete(o.compartment)}if(s.set(o,l),Array.isArray(o))for(let h of o)r(h,l);else if(o instanceof Jr){if(t.has(o.compartment))throw new RangeError("Duplicate use of compartment in extensions");let h=e.get(o.compartment)||o.inner;t.set(o.compartment,h),r(h,l)}else if(o instanceof Eh)r(o.inner,o.prec);else if(o instanceof ce)i[l].push(o),o.provides&&r(o.provides,l);else if(o instanceof es)i[l].push(o),o.facet.extensions&&r(o.facet.extensions,$t.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,$t.default),i.reduce((o,l)=>o.concat(l))}function Ki(n,e){if(e&1)return 2;let t=e>>1,i=n.status[t];if(i==4)throw new Error("Cyclic dependency between fields and/or facets");if(i&2)return i;n.status[t]=4;let s=n.computeSlot(n,n.config.dynamicSlots[t]);return n.status[t]=2|s}function cs(n,e){return e&1?n.config.staticValues[e>>1]:n.values[e>>1]}const Ih=O.define(),Zr=O.define({combine:n=>n.some(e=>e),static:!0}),Nh=O.define({combine:n=>n.length?n[0]:void 0,static:!0}),Wh=O.define(),Fh=O.define(),Hh=O.define(),Vh=O.define({combine:n=>n.length?n[0]:!1});class bt{constructor(e,t){this.type=e,this.value=t}static define(){return new Wu}}class Wu{of(e){return new bt(this,e)}}class Fu{constructor(e){this.map=e}of(e){return new L(this,e)}}class L{constructor(e,t){this.type=e,this.value=t}map(e){let t=this.type.map(this.value,e);return t===void 0?void 0:t==this.value?this:new L(this.type,t)}is(e){return this.type==e}static define(e={}){return new Fu(e.map||(t=>t))}static mapEffects(e,t){if(!e.length)return e;let i=[];for(let s of e){let r=s.map(t);r&&i.push(r)}return i}}L.reconfigure=L.define();L.appendConfig=L.define();class te{constructor(e,t,i,s,r,o){this.startState=e,this.changes=t,this.selection=i,this.effects=s,this.annotations=r,this.scrollIntoView=o,this._doc=null,this._state=null,i&&Lh(i,t.newLength),r.some(l=>l.type==te.time)||(this.annotations=r.concat(te.time.of(Date.now())))}static create(e,t,i,s,r,o){return new te(e,t,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(e){for(let t of this.annotations)if(t.type==e)return t.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let t=this.annotation(te.userEvent);return!!(t&&(t==e||t.length>e.length&&t.slice(0,e.length)==e&&t[e.length]=="."))}}te.time=bt.define();te.userEvent=bt.define();te.addToHistory=bt.define();te.remote=bt.define();function Hu(n,e){let t=[];for(let i=0,s=0;;){let r,o;if(i<n.length&&(s==e.length||e[s]>=n[i]))r=n[i++],o=n[i++];else if(s<e.length)r=e[s++],o=e[s++];else return t;!t.length||t[t.length-1]<r?t.push(r,o):t[t.length-1]<o&&(t[t.length-1]=o)}}function zh(n,e,t){var i;let s,r,o;return t?(s=e.changes,r=ee.empty(e.changes.length),o=n.changes.compose(e.changes)):(s=e.changes.map(n.changes),r=n.changes.mapDesc(e.changes,!0),o=n.changes.compose(s)),{changes:o,selection:e.selection?e.selection.map(r):(i=n.selection)===null||i===void 0?void 0:i.map(s),effects:L.mapEffects(n.effects,s).concat(L.mapEffects(e.effects,r)),annotations:n.annotations.length?n.annotations.concat(e.annotations):e.annotations,scrollIntoView:n.scrollIntoView||e.scrollIntoView}}function eo(n,e,t){let i=e.selection,s=mi(e.annotations);return e.userEvent&&(s=s.concat(te.userEvent.of(e.userEvent))),{changes:e.changes instanceof ee?e.changes:ee.of(e.changes||[],t,n.facet(Nh)),selection:i&&(i instanceof x?i:x.single(i.anchor,i.head)),effects:mi(e.effects),annotations:s,scrollIntoView:!!e.scrollIntoView}}function $h(n,e,t){let i=eo(n,e.length?e[0]:{},n.doc.length);e.length&&e[0].filter===!1&&(t=!1);for(let r=1;r<e.length;r++){e[r].filter===!1&&(t=!1);let o=!!e[r].sequential;i=zh(i,eo(n,e[r],o?i.changes.newLength:n.doc.length),o)}let s=te.create(n,i.changes,i.selection,i.effects,i.annotations,i.scrollIntoView);return zu(t?Vu(s):s)}function Vu(n){let e=n.startState,t=!0;for(let s of e.facet(Wh)){let r=s(n);if(r===!1){t=!1;break}Array.isArray(r)&&(t=t===!0?r:Hu(t,r))}if(t!==!0){let s,r;if(t===!1)r=n.changes.invertedDesc,s=ee.empty(e.doc.length);else{let o=n.changes.filter(t);s=o.changes,r=o.filtered.mapDesc(o.changes).invertedDesc}n=te.create(e,s,n.selection&&n.selection.map(r),L.mapEffects(n.effects,r),n.annotations,n.scrollIntoView)}let i=e.facet(Fh);for(let s=i.length-1;s>=0;s--){let r=i[s](n);r instanceof te?n=r:Array.isArray(r)&&r.length==1&&r[0]instanceof te?n=r[0]:n=$h(e,mi(r),!1)}return n}function zu(n){let e=n.startState,t=e.facet(Hh),i=n;for(let s=t.length-1;s>=0;s--){let r=t[s](n);r&&Object.keys(r).length&&(i=zh(i,eo(e,r,n.changes.newLength),!0))}return i==n?n:te.create(e,n.changes,n.selection,i.effects,i.annotations,i.scrollIntoView)}const $u=[];function mi(n){return n==null?$u:Array.isArray(n)?n:[n]}var Q=(function(n){return n[n.Word=0]="Word",n[n.Space=1]="Space",n[n.Other=2]="Other",n})(Q||(Q={}));const qu=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;let to;try{to=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function Ku(n){if(to)return to.test(n);for(let e=0;e<n.length;e++){let t=n[e];if(/\w/.test(t)||t>"€"&&(t.toUpperCase()!=t.toLowerCase()||qu.test(t)))return!0}return!1}function ju(n){return e=>{if(!/\S/.test(e))return Q.Space;if(Ku(e))return Q.Word;for(let t=0;t<n.length;t++)if(e.indexOf(n[t])>-1)return Q.Word;return Q.Other}}class H{constructor(e,t,i,s,r,o){this.config=e,this.doc=t,this.selection=i,this.values=s,this.status=e.statusTemplate.slice(),this.computeSlot=r,o&&(o._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)Ki(this,l<<1);this.computeSlot=null}field(e,t=!0){let i=this.config.address[e.id];if(i==null){if(t)throw new RangeError("Field is not present in this state");return}return Ki(this,i),cs(this,i)}update(...e){return $h(this,e,!0)}applyTransaction(e){let t=this.config,{base:i,compartments:s}=t;for(let l of e.effects)l.is(un.reconfigure)?(t&&(s=new Map,t.compartments.forEach((a,h)=>s.set(h,a)),t=null),s.set(l.value.compartment,l.value.extension)):l.is(L.reconfigure)?(t=null,i=l.value):l.is(L.appendConfig)&&(t=null,i=mi(i).concat(l.value));let r;t?r=e.startState.values.slice():(t=hs.resolve(i,s,this),r=new H(t,this.doc,this.selection,t.dynamicSlots.map(()=>null),(a,h)=>h.reconfigure(a,this),null).values);let o=e.startState.facet(Zr)?e.newSelection:e.newSelection.asSingle();new H(t,e.newDoc,o,r,(l,a)=>a.update(l,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(t=>({changes:{from:t.from,to:t.to,insert:e},range:x.cursor(t.from+e.length)}))}changeByRange(e){let t=this.selection,i=e(t.ranges[0]),s=this.changes(i.changes),r=[i.range],o=mi(i.effects);for(let l=1;l<t.ranges.length;l++){let a=e(t.ranges[l]),h=this.changes(a.changes),c=h.map(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=L.mapEffects(o,c).concat(L.mapEffects(mi(a.effects),f))}return{changes:s,selection:x.create(r,t.mainIndex),effects:o}}changes(e=[]){return e instanceof ee?e:ee.of(e,this.doc.length,this.facet(H.lineSeparator))}toText(e){return F.of(e.split(this.facet(H.lineSeparator)||Qr))}sliceDoc(e=0,t=this.doc.length){return this.doc.sliceString(e,t,this.lineBreak)}facet(e){let t=this.config.address[e.id];return t==null?e.default:(Ki(this,t),cs(this,t))}toJSON(e){let t={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let i in e){let s=e[i];s instanceof ce&&this.config.address[s.id]!=null&&(t[i]=s.spec.toJSON(this.field(e[i]),this))}return t}static fromJSON(e,t={},i){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let s=[];if(i){for(let r in i)if(Object.prototype.hasOwnProperty.call(e,r)){let o=i[r],l=e[r];s.push(o.init(a=>o.spec.fromJSON(l,a)))}}return H.create({doc:e.doc,selection:x.fromJSON(e.selection),extensions:t.extensions?s.concat([t.extensions]):s})}static create(e={}){let t=hs.resolve(e.extensions||[],new Map),i=e.doc instanceof F?e.doc:F.of((e.doc||"").split(t.staticFacet(H.lineSeparator)||Qr)),s=e.selection?e.selection instanceof x?e.selection:x.single(e.selection.anchor,e.selection.head):x.single(0);return Lh(s,i.length),t.staticFacet(Zr)||(s=s.asSingle()),new H(t,i,s,t.dynamicSlots.map(()=>null),(r,o)=>o.create(r),null)}get tabSize(){return this.facet(H.tabSize)}get lineBreak(){return this.facet(H.lineSeparator)||` 5 + `}get readOnly(){return this.facet(Vh)}phrase(e,...t){for(let i of this.facet(H.phrases))if(Object.prototype.hasOwnProperty.call(i,e)){e=i[e];break}return t.length&&(e=e.replace(/\$(\$|\d*)/g,(i,s)=>{if(s=="$")return"$";let r=+(s||1);return!r||r>t.length?i:t[r-1]})),e}languageDataAt(e,t,i=-1){let s=[];for(let r of this.facet(Ih))for(let o of r(this,t,i))Object.prototype.hasOwnProperty.call(o,e)&&s.push(o[e]);return s}charCategorizer(e){let t=this.languageDataAt("wordChars",e);return ju(t.length?t[0]:"")}wordAt(e){let{text:t,from:i,length:s}=this.doc.lineAt(e),r=this.charCategorizer(e),o=e-i,l=e-i;for(;o>0;){let a=ne(t,o,!1);if(r(t.slice(a,o))!=Q.Word)break;o=a}for(;l<s;){let a=ne(t,l);if(r(t.slice(l,a))!=Q.Word)break;l=a}return o==l?null:x.range(o+i,l+i)}}H.allowMultipleSelections=Zr;H.tabSize=O.define({combine:n=>n.length?n[0]:4});H.lineSeparator=Nh;H.readOnly=Vh;H.phrases=O.define({compare(n,e){let t=Object.keys(n),i=Object.keys(e);return t.length==i.length&&t.every(s=>n[s]==e[s])}});H.languageData=Ih;H.changeFilter=Wh;H.transactionFilter=Fh;H.transactionExtender=Hh;un.reconfigure=L.define();function at(n,e,t={}){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(t,r))i[r]=t[r](l,o);else throw new Error("Config merge conflict for field "+r)}for(let s in e)i[s]===void 0&&(i[s]=e[s]);return i}class Tt{eq(e){return this==e}range(e,t=e){return io.create(e,t,this)}}Tt.prototype.startSide=Tt.prototype.endSide=0;Tt.prototype.point=!1;Tt.prototype.mapMode=pe.TrackDel;function qo(n,e){return n==e||n.constructor==e.constructor&&n.eq(e)}let io=class qh{constructor(e,t,i){this.from=e,this.to=t,this.value=i}static create(e,t,i){return new qh(e,t,i)}};function no(n,e){return n.from-e.from||n.value.startSide-e.value.startSide}class Ko{constructor(e,t,i,s){this.from=e,this.to=t,this.value=i,this.maxPoint=s}get length(){return this.to[this.to.length-1]}findIndex(e,t,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]-e||(i?this.value[a].endSide:this.value[a].startSide)-t;if(a==o)return h>=0?o:l;h>=0?l=a:o=a+1}}between(e,t,i,s){for(let r=this.findIndex(t,-1e9,!0),o=this.findIndex(i,1e9,!1,r);r<o;r++)if(s(this.from[r]+e,this.to[r]+e,this.value[r])===!1)return!1}map(e,t){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]+e,f=this.to[a]+e,u,d;if(c==f){let p=t.mapPos(c,h.startSide,h.mapMode);if(p==null||(u=d=p,h.startSide!=h.endSide&&(d=t.mapPos(c,h.endSide),d<u)))continue}else if(u=t.mapPos(c,h.startSide),d=t.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 Ko(s,r,i,l):null,pos:o}}}class N{constructor(e,t,i,s){this.chunkPos=e,this.chunk=t,this.nextLayer=i,this.maxPoint=s}static create(e,t,i,s){return new N(e,t,i,s)}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 t of this.chunk)e+=t.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:t=[],sort:i=!1,filterFrom:s=0,filterTo:r=this.length}=e,o=e.filter;if(t.length==0&&!o)return this;if(i&&(t=t.slice().sort(no)),this.isEmpty)return t.length?N.of(t):this;let l=new Kh(this,null,-1).goto(0),a=0,h=[],c=new pt;for(;l.value||a<t.length;)if(a<t.length&&(l.from-t[a].from||l.startSide-t[a].value.startSide)>=0){let f=t[a++];c.addInner(f.from,f.to,f.value)||h.push(f)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==t.length||this.chunkEnd(l.chunkIndex)<t[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(io.create(l.from,l.to,l.value))),l.next());return c.finishInner(this.nextLayer.isEmpty&&!h.length?N.empty:this.nextLayer.update({add:h,filter:o,filterFrom:s,filterTo:r}))}map(e){if(e.empty||this.isEmpty)return this;let t=[],i=[],s=-1;for(let o=0;o<this.chunk.length;o++){let l=this.chunkPos[o],a=this.chunk[o],h=e.touchesRange(l,l+a.length);if(h===!1)s=Math.max(s,a.maxPoint),t.push(a),i.push(e.mapPos(l));else if(h===!0){let{mapped:c,pos:f}=a.map(l,e);c&&(s=Math.max(s,c.maxPoint),t.push(c),i.push(f))}}let r=this.nextLayer.map(e);return t.length==0?r:new N(i,t,r||N.empty,s)}between(e,t,i){if(!this.isEmpty){for(let s=0;s<this.chunk.length;s++){let r=this.chunkPos[s],o=this.chunk[s];if(t>=r&&e<=r+o.length&&o.between(r,e-r,t-r,i)===!1)return}this.nextLayer.between(e,t,i)}}iter(e=0){return Xi.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,t=0){return Xi.from(e).goto(t)}static compare(e,t,i,s,r=-1){let o=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),l=t.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=r),a=Pl(o,l,i),h=new Ei(o,a,r),c=new Ei(l,a,r);i.iterGaps((f,u,d)=>Ll(h,f,c,u,d,s)),i.empty&&i.length==0&&Ll(h,0,c,0,0,s)}static eq(e,t,i=0,s){s==null&&(s=999999999);let r=e.filter(c=>!c.isEmpty&&t.indexOf(c)<0),o=t.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(r.length!=o.length)return!1;if(!r.length)return!0;let l=Pl(r,o),a=new Ei(r,l,0).goto(i),h=new Ei(o,l,0).goto(i);for(;;){if(a.to!=h.to||!so(a.active,h.active)||a.point&&(!h.point||!qo(a.point,h.point)))return!1;if(a.to>s)return!0;a.next(),h.next()}}static spans(e,t,i,s,r=-1){let o=new Ei(e,null,r).goto(t),l=t,a=o.openStart;for(;;){let h=Math.min(o.to,i);if(o.point){let c=o.activeForPoint(o.to),f=o.pointFrom<t?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(e,t=!1){let i=new pt;for(let s of e instanceof io?[e]:t?Uu(e):e)i.add(s.from,s.to,s.value);return i.finish()}static join(e){if(!e.length)return N.empty;let t=e[e.length-1];for(let i=e.length-2;i>=0;i--)for(let s=e[i];s!=N.empty;s=s.nextLayer)t=new N(s.chunkPos,s.chunk,t,Math.max(s.maxPoint,t.maxPoint));return t}}N.empty=new N([],[],null,-1);function Uu(n){if(n.length>1)for(let e=n[0],t=1;t<n.length;t++){let i=n[t];if(no(e,i)>0)return n.slice().sort(no);e=i}return n}N.empty.nextLayer=N.empty;class pt{finishChunk(e){this.chunks.push(new Ko(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,e&&(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(e,t,i){this.addInner(e,t,i)||(this.nextLayer||(this.nextLayer=new pt)).add(e,t,i)}addInner(e,t,i){let s=e-this.lastTo||i.startSide-this.last.endSide;if(s<=0&&(e-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=e),this.from.push(e-this.chunkStart),this.to.push(t-this.chunkStart),this.last=i,this.lastFrom=e,this.lastTo=t,this.value.push(i),i.point&&(this.maxPoint=Math.max(this.maxPoint,t-e)),!0)}addChunk(e,t){if((e-this.lastTo||t.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,t.maxPoint),this.chunks.push(t),this.chunkPos.push(e);let i=t.value.length-1;return this.last=t.value[i],this.lastFrom=t.from[i]+e,this.lastTo=t.to[i]+e,!0}finish(){return this.finishInner(N.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let t=N.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,t}}function Pl(n,e,t){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 e)for(let o=0;o<r.chunk.length;o++){let l=i.get(r.chunk[o]);l!=null&&(t?t.mapPos(l):l)==r.chunkPos[o]&&!t?.touchesRange(l,l+r.chunk[o].length)&&s.add(r.chunk[o])}return s}class Kh{constructor(e,t,i,s=0){this.layer=e,this.skip=t,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(e,t=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,t,!1),this}gotoInner(e,t,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)<e||s.maxPoint<this.minPoint))break;this.chunkIndex++,i=!1}if(this.chunkIndex<this.layer.chunk.length){let s=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],t,!0);(!i||this.rangeIndex<s)&&this.setRangeIndex(s)}this.next()}forward(e,t){(this.to-e||this.endSide-t)<0&&this.gotoInner(e,t,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],t=this.layer.chunk[this.chunkIndex],i=e+t.from[this.rangeIndex];if(this.from=i,this.to=e+t.to[this.rangeIndex],this.value=t.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==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=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}}class Xi{constructor(e){this.heap=e}static from(e,t=null,i=-1){let s=[];for(let r=0;r<e.length;r++)for(let o=e[r];!o.isEmpty;o=o.nextLayer)o.maxPoint>=i&&s.push(new Kh(o,t,i,r));return s.length==1?s[0]:new Xi(s)}get startSide(){return this.value?this.value.startSide:0}goto(e,t=-1e9){for(let i of this.heap)i.goto(e,t);for(let i=this.heap.length>>1;i>=0;i--)Zs(this.heap,i);return this.next(),this}forward(e,t){for(let i of this.heap)i.forward(e,t);for(let i=this.heap.length>>1;i>=0;i--)Zs(this.heap,i);(this.to-e||this.value.endSide-t)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Zs(this.heap,0)}}}function Zs(n,e){for(let t=n[e];;){let i=(e<<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++),t.compare(s)<0)break;n[i]=t,n[e]=s,e=i}}class Ei{constructor(e,t,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=Xi.from(e,t,i)}goto(e,t=-1e9){return this.cursor.goto(e,t),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=t,this.openStart=-1,this.next(),this}forward(e,t){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-t)<0;)this.removeActive(this.minActive);this.cursor.forward(e,t)}removeActive(e){vn(this.active,e),vn(this.activeTo,e),vn(this.activeRank,e),this.minActive=El(this.active,this.activeTo)}addActive(e){let t=0,{value:i,to:s,rank:r}=this.cursor;for(;t<this.activeRank.length&&(r-this.activeRank[t]||s-this.activeTo[t])>0;)t++;Sn(this.active,t,i),Sn(this.activeTo,t,s),Sn(this.activeRank,t,r),e&&Sn(e,t,this.cursor.from),this.minActive=El(this.active,this.activeTo)}next(){let e=this.to,t=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]>e){this.to=this.activeTo[s],this.endSide=this.active[s].endSide;break}this.removeActive(s),i&&vn(i,s)}else if(this.cursor.value)if(this.cursor.from>e){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(t&&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]<e;s--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let t=[];for(let i=this.active.length-1;i>=0&&!(this.activeRank[i]<this.pointRank);i--)(this.activeTo[i]>e||this.activeTo[i]==e&&this.active[i].endSide>=this.point.endSide)&&t.push(this.active[i]);return t.reverse()}openEnd(e){let t=0;for(let i=this.activeTo.length-1;i>=0&&this.activeTo[i]>e;i--)t++;return t}}function Ll(n,e,t,i,s,r){n.goto(e),t.goto(i);let o=i+s,l=i,a=i-e,h=!!r.boundChange;for(let c=!1;;){let f=n.to+a-t.to,u=f||n.endSide-t.endSide,d=u<0?n.to+a:t.to,p=Math.min(d,o);if(n.point||t.point?(n.point&&t.point&&qo(n.point,t.point)&&so(n.activeForPoint(n.to),t.activeForPoint(t.to))||r.comparePoint(l,p,n.point,t.point),c=!1):(c&&r.boundChange(l),p>l&&!so(n.active,t.active)&&r.compareRange(l,p,n.active,t.active),h&&p<o&&(f||n.openEnd(d)!=t.openEnd(d))&&(c=!0)),d>o)break;l=d,u<=0&&n.next(),u>=0&&t.next()}}function so(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!=e[t]&&!qo(n[t],e[t]))return!1;return!0}function vn(n,e){for(let t=e,i=n.length-1;t<i;t++)n[t]=n[t+1];n.pop()}function Sn(n,e,t){for(let i=n.length-1;i>=e;i--)n[i+1]=n[i];n[e]=t}function El(n,e){let t=-1,i=1e9;for(let s=0;s<e.length;s++)(e[s]-i||n[s].endSide-n[t].endSide)<0&&(t=s,i=e[s]);return t}function Di(n,e,t=n.length){let i=0;for(let s=0;s<t&&s<n.length;)n.charCodeAt(s)==9?(i+=e-i%e,s++):(i++,s=ne(n,s));return i}function ro(n,e,t,i){for(let s=0,r=0;;){if(r>=e)return s;if(s==n.length)break;r+=n.charCodeAt(s)==9?t-r%t:1,s=ne(n,s)}return i===!0?-1:n.length}const oo="ͼ",Il=typeof Symbol>"u"?"__"+oo:Symbol.for(oo),lo=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),Nl=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};class Ot{constructor(e,t){this.rules=[];let{finish:i}=t||{};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(b=>m.replace(/&/,b))).reduce((m,b)=>m.concat(b)),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 e)r(s(o),e[o],this.rules)}getRules(){return this.rules.join(` 6 + `)}static newName(){let e=Nl[Il]||1;return Nl[Il]=e+1,oo+e.toString(36)}static mount(e,t,i){let s=e[lo],r=i&&i.nonce;s?r&&s.setNonce(r):s=new Gu(e,r),s.mount(Array.isArray(t)?t:[t],e)}}let Wl=new Map;class Gu{constructor(e,t){let i=e.ownerDocument||e,s=i.defaultView;if(!e.head&&e.adoptedStyleSheets&&s.CSSStyleSheet){let r=Wl.get(i);if(r)return e[lo]=r;this.sheet=new s.CSSStyleSheet,Wl.set(i,this)}else this.styleTag=i.createElement("style"),t&&this.styleTag.setAttribute("nonce",t);this.modules=[],e[lo]=this}mount(e,t){let i=this.sheet,s=0,r=0;for(let o=0;o<e.length;o++){let l=e[o],a=this.modules.indexOf(l);if(a<r&&a>-1&&(this.modules.splice(a,1),r--,a=-1),a==-1){if(this.modules.splice(r++,0,l),i)for(let h=0;h<l.rules.length;h++)i.insertRule(l.rules[h],s++)}else{for(;r<a;)s+=this.modules[r++].rules.length;s+=l.rules.length,r++}}if(i)t.adoptedStyleSheets.indexOf(this.sheet)<0&&(t.adoptedStyleSheets=[this.sheet,...t.adoptedStyleSheets]);else{let o="";for(let a=0;a<this.modules.length;a++)o+=this.modules[a].getRules()+` 7 + `;this.styleTag.textContent=o;let l=t.head||t;this.styleTag.parentNode!=l&&l.insertBefore(this.styleTag,l.firstChild)}}setNonce(e){this.styleTag&&this.styleTag.getAttribute("nonce")!=e&&this.styleTag.setAttribute("nonce",e)}}var Dt={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Ji={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Qu=typeof navigator<"u"&&/Mac/.test(navigator.platform),Yu=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var oe=0;oe<10;oe++)Dt[48+oe]=Dt[96+oe]=String(oe);for(var oe=1;oe<=24;oe++)Dt[oe+111]="F"+oe;for(var oe=65;oe<=90;oe++)Dt[oe]=String.fromCharCode(oe+32),Ji[oe]=String.fromCharCode(oe);for(var er in Dt)Ji.hasOwnProperty(er)||(Ji[er]=Dt[er]);function _u(n){var e=Qu&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||Yu&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Ji:Dt)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}function $(){var n=arguments[0];typeof n=="string"&&(n=document.createElement(n));var e=1,t=arguments[1];if(t&&typeof t=="object"&&t.nodeType==null&&!Array.isArray(t)){for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var s=t[i];typeof s=="string"?n.setAttribute(i,s):s!=null&&(n[i]=s)}e++}for(;e<arguments.length;e++)jh(n,arguments[e]);return n}function jh(n,e){if(typeof e=="string")n.appendChild(document.createTextNode(e));else if(e!=null)if(e.nodeType!=null)n.appendChild(e);else if(Array.isArray(e))for(var t=0;t<e.length;t++)jh(n,e[t]);else throw new RangeError("Unsupported child node: "+e)}let de=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},ao=typeof document<"u"?document:{documentElement:{style:{}}};const ho=/Edge\/(\d+)/.exec(de.userAgent),Uh=/MSIE \d/.test(de.userAgent),co=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(de.userAgent),Fs=!!(Uh||co||ho),Fl=!Fs&&/gecko\/(\d+)/i.test(de.userAgent),tr=!Fs&&/Chrome\/(\d+)/.exec(de.userAgent),Xu="webkitFontSmoothing"in ao.documentElement.style,fo=!Fs&&/Apple Computer/.test(de.vendor),Hl=fo&&(/Mobile\/\w+/.test(de.userAgent)||de.maxTouchPoints>2);var M={mac:Hl||/Mac/.test(de.platform),windows:/Win/.test(de.platform),linux:/Linux|X11/.test(de.platform),ie:Fs,ie_version:Uh?ao.documentMode||6:co?+co[1]:ho?+ho[1]:0,gecko:Fl,gecko_version:Fl?+(/Firefox\/(\d+)/.exec(de.userAgent)||[0,0])[1]:0,chrome:!!tr,chrome_version:tr?+tr[1]:0,ios:Hl,android:/Android\b/.test(de.userAgent),webkit_version:Xu?+(/\bAppleWebKit\/(\d+)/.exec(de.userAgent)||[0,0])[1]:0,safari:fo,safari_version:fo?+(/\bVersion\/(\d+(\.\d+)?)/.exec(de.userAgent)||[0,0])[1]:0,tabSize:ao.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"};function jo(n,e){for(let t in n)t=="class"&&e.class?e.class+=" "+n.class:t=="style"&&e.style?e.style+=";"+n.style:e[t]=n[t];return e}const fs=Object.create(null);function Uo(n,e,t){if(n==e)return!0;n||(n=fs),e||(e=fs);let i=Object.keys(n),s=Object.keys(e);if(i.length-0!=s.length-0)return!1;for(let r of i)if(r!=t&&(s.indexOf(r)==-1||n[r]!==e[r]))return!1;return!0}function Ju(n,e){for(let t=n.attributes.length-1;t>=0;t--){let i=n.attributes[t].name;e[i]==null&&n.removeAttribute(i)}for(let t in e){let i=e[t];t=="style"?n.style.cssText=i:n.getAttribute(t)!=i&&n.setAttribute(t,i)}}function Vl(n,e,t){let i=!1;if(e)for(let s in e)t&&s in t||(i=!0,s=="style"?n.style.cssText="":n.removeAttribute(s));if(t)for(let s in t)e&&e[s]==t[s]||(i=!0,s=="style"?n.style.cssText=t[s]:n.setAttribute(s,t[s]));return i}function Zu(n){let e=Object.create(null);for(let t=0;t<n.attributes.length;t++){let i=n.attributes[t];e[i.name]=i.value}return e}class yt{eq(e){return!1}updateDOM(e,t){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,t,i){return null}get isHidden(){return!1}get editable(){return!1}destroy(e){}}var le=(function(n){return n[n.Text=0]="Text",n[n.WidgetBefore=1]="WidgetBefore",n[n.WidgetAfter=2]="WidgetAfter",n[n.WidgetRange=3]="WidgetRange",n})(le||(le={}));class B extends Tt{constructor(e,t,i,s){super(),this.startSide=e,this.endSide=t,this.widget=i,this.spec=s}get heightRelevant(){return!1}static mark(e){return new dn(e)}static widget(e){let t=Math.max(-1e4,Math.min(1e4,e.side||0)),i=!!e.block;return t+=i&&!e.inlineOrder?t>0?3e8:-4e8:t>0?1e8:-1e8,new Zt(e,t,t,i,e.widget||null,!1)}static replace(e){let t=!!e.block,i,s;if(e.isBlockGap)i=-5e8,s=4e8;else{let{start:r,end:o}=Gh(e,t);i=(r?t?-3e8:-1:5e8)-1,s=(o?t?2e8:1:-6e8)+1}return new Zt(e,i,s,t,e.widget||null,!0)}static line(e){return new pn(e)}static set(e,t=!1){return N.of(e,t)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}}B.none=N.empty;class dn extends B{constructor(e){let{start:t,end:i}=Gh(e);super(t?-1:5e8,i?1:-6e8,null,e),this.tagName=e.tagName||"span",this.attrs=e.class&&e.attributes?jo(e.attributes,{class:e.class}):e.class?{class:e.class}:e.attributes||fs}eq(e){return this==e||e instanceof dn&&this.tagName==e.tagName&&Uo(this.attrs,e.attrs)}range(e,t=e){if(e>=t)throw new RangeError("Mark decorations may not be empty");return super.range(e,t)}}dn.prototype.point=!1;class pn extends B{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof pn&&this.spec.class==e.spec.class&&Uo(this.spec.attributes,e.spec.attributes)}range(e,t=e){if(t!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,t)}}pn.prototype.mapMode=pe.TrackBefore;pn.prototype.point=!0;class Zt extends B{constructor(e,t,i,s,r,o){super(t,i,r,e),this.block=s,this.isReplace=o,this.mapMode=s?t<=0?pe.TrackBefore:pe.TrackAfter:pe.TrackDel}get type(){return this.startSide!=this.endSide?le.WidgetRange:this.startSide<=0?le.WidgetBefore:le.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof Zt&&ed(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,t=e){if(this.isReplace&&(e>t||e==t&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&t!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,t)}}Zt.prototype.point=!0;function Gh(n,e=!1){let{inclusiveStart:t,inclusiveEnd:i}=n;return t==null&&(t=n.inclusive),i==null&&(i=n.inclusive),{start:t??e,end:i??e}}function ed(n,e){return n==e||!!(n&&e&&n.compare(e))}function bi(n,e,t,i=0){let s=t.length-1;s>=0&&t[s]+i>=n?t[s]=Math.max(t[s],e):t.push(n,e)}class Zi extends Tt{constructor(e,t){super(),this.tagName=e,this.attributes=t}eq(e){return e==this||e instanceof Zi&&this.tagName==e.tagName&&Uo(this.attributes,e.attributes)}static create(e){return new Zi(e.tagName,e.attributes||fs)}static set(e,t=!1){return N.of(e,t)}}Zi.prototype.startSide=Zi.prototype.endSide=-1;function en(n){let e;return n.nodeType==11?e=n.getSelection?n:n.ownerDocument:e=n,e.getSelection()}function uo(n,e){return e?n==e||n.contains(e.nodeType!=1?e.parentNode:e):!1}function ji(n,e){if(!e.anchorNode)return!1;try{return uo(n,e.anchorNode)}catch{return!1}}function ts(n){return n.nodeType==3?tn(n,0,n.nodeValue.length).getClientRects():n.nodeType==1?n.getClientRects():[]}function Ui(n,e,t,i){return t?zl(n,e,t,i,-1)||zl(n,e,t,i,1):!1}function Rt(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e}function us(n){return n.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(n.nodeName)}function zl(n,e,t,i,s){for(;;){if(n==t&&e==i)return!0;if(e==(s<0?0:gt(n))){if(n.nodeName=="DIV")return!1;let r=n.parentNode;if(!r||r.nodeType!=1)return!1;e=Rt(n)+(s<0?0:1),n=r}else if(n.nodeType==1){if(n=n.childNodes[e+(s<0?-1:0)],n.nodeType==1&&n.contentEditable=="false")return!1;e=s<0?gt(n):0}else return!1}}function gt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function ds(n,e){let t=e?n.left:n.right;return{left:t,right:t,top:n.top,bottom:n.bottom}}function td(n){let e=n.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.innerWidth,top:0,bottom:n.innerHeight}}function Qh(n,e){let t=e.width/n.offsetWidth,i=e.height/n.offsetHeight;return(t>.995&&t<1.005||!isFinite(t)||Math.abs(e.width-n.offsetWidth)<1)&&(t=1),(i>.995&&i<1.005||!isFinite(i)||Math.abs(e.height-n.offsetHeight)<1)&&(i=1),{scaleX:t,scaleY:i}}function id(n,e,t,i,s,r,o,l){let a=n.ownerDocument,h=a.defaultView||window;for(let c=n,f=!1;c&&!f;)if(c.nodeType==1){let u,d=c==a.body,p=1,m=1;if(d)u=td(h);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let w=c.getBoundingClientRect();({scaleX:p,scaleY:m}=Qh(c,w)),u={left:w.left,right:w.left+c.clientWidth*p,top:w.top,bottom:w.top+c.clientHeight*m}}let b=0,y=0;if(s=="nearest")e.top<u.top?(y=e.top-(u.top+o),t>0&&e.bottom>u.bottom+y&&(y=e.bottom-u.bottom+o)):e.bottom>u.bottom&&(y=e.bottom-u.bottom+o,t<0&&e.top-y<u.top&&(y=e.top-(u.top+o)));else{let w=e.bottom-e.top,k=u.bottom-u.top;y=(s=="center"&&w<=k?e.top+w/2-k/2:s=="start"||s=="center"&&t<0?e.top-o:e.bottom-k+o)-u.top}if(i=="nearest"?e.left<u.left?(b=e.left-(u.left+r),t>0&&e.right>u.right+b&&(b=e.right-u.right+r)):e.right>u.right&&(b=e.right-u.right+r,t<0&&e.left<u.left+b&&(b=e.left-(u.left+r))):b=(i=="center"?e.left+(e.right-e.left)/2-(u.right-u.left)/2:i=="start"==l?e.left-r:e.right-(u.right-u.left)+r)-u.left,b||y)if(d)h.scrollBy(b,y);else{let w=0,k=0;if(y){let D=c.scrollTop;c.scrollTop+=y/m,k=(c.scrollTop-D)*m}if(b){let D=c.scrollLeft;c.scrollLeft+=b/p,w=(c.scrollLeft-D)*p}e={left:e.left-w,top:e.top-k,right:e.right-w,bottom:e.bottom-k},w&&Math.abs(w-b)<1&&(i="nearest"),k&&Math.abs(k-y)<1&&(s="nearest")}if(d)break;(e.top<u.top||e.bottom>u.bottom||e.left<u.left||e.right>u.right)&&(e={left:Math.max(e.left,u.left),right:Math.min(e.right,u.right),top:Math.max(e.top,u.top),bottom:Math.min(e.bottom,u.bottom)}),c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function Yh(n,e=!0){let t=n.ownerDocument,i=null,s=null;for(let r=n.parentNode;r&&!(r==t.body||(!e||i)&&s);)if(r.nodeType==1)!s&&r.scrollHeight>r.clientHeight&&(s=r),e&&!i&&r.scrollWidth>r.clientWidth&&(i=r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;return{x:i,y:s}}class nd{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:t,focusNode:i}=e;this.set(t,Math.min(e.anchorOffset,t?gt(t):0),i,Math.min(e.focusOffset,i?gt(i):0))}set(e,t,i,s){this.anchorNode=e,this.anchorOffset=t,this.focusNode=i,this.focusOffset=s}}let Ht=null;M.safari&&M.safari_version>=26&&(Ht=!1);function _h(n){if(n.setActive)return n.setActive();if(Ht)return n.focus(Ht);let e=[];for(let t=n;t&&(e.push(t,t.scrollTop,t.scrollLeft),t!=t.ownerDocument);t=t.parentNode);if(n.focus(Ht==null?{get preventScroll(){return Ht={preventScroll:!0},!0}}:void 0),!Ht){Ht=!1;for(let t=0;t<e.length;){let i=e[t++],s=e[t++],r=e[t++];i.scrollTop!=s&&(i.scrollTop=s),i.scrollLeft!=r&&(i.scrollLeft=r)}}}let $l;function tn(n,e,t=e){let i=$l||($l=document.createRange());return i.setEnd(n,t),i.setStart(n,e),i}function yi(n,e,t,i){let s={key:e,code:e,keyCode:t,which:t,cancelable:!0};i&&({altKey:s.altKey,ctrlKey:s.ctrlKey,shiftKey:s.shiftKey,metaKey:s.metaKey}=i);let r=new KeyboardEvent("keydown",s);r.synthetic=!0,n.dispatchEvent(r);let o=new KeyboardEvent("keyup",s);return o.synthetic=!0,n.dispatchEvent(o),r.defaultPrevented||o.defaultPrevented}function sd(n){for(;n;){if(n&&(n.nodeType==9||n.nodeType==11&&n.host))return n;n=n.assignedSlot||n.parentNode}return null}function rd(n,e){let t=e.focusNode,i=e.focusOffset;if(!t||e.anchorNode!=t||e.anchorOffset!=i)return!1;for(i=Math.min(i,gt(t));;)if(i){if(t.nodeType!=1)return!1;let s=t.childNodes[i-1];s.contentEditable=="false"?i--:(t=s,i=gt(t))}else{if(t==n)return!0;i=Rt(t),t=t.parentNode}}function Xh(n){return n instanceof Window?n.pageYOffset>Math.max(0,n.document.documentElement.scrollHeight-n.innerHeight-4):n.scrollTop>Math.max(1,n.scrollHeight-n.clientHeight-4)}function Jh(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i>0)return{node:t,offset:i};if(t.nodeType==1&&i>0){if(t.contentEditable=="false")return null;t=t.childNodes[i-1],i=gt(t)}else if(t.parentNode&&!us(t))i=Rt(t),t=t.parentNode;else return null}}function Zh(n,e){for(let t=n,i=e;;){if(t.nodeType==3&&i<t.nodeValue.length)return{node:t,offset:i};if(t.nodeType==1&&i<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[i],i=0}else if(t.parentNode&&!us(t))i=Rt(t)+1,t=t.parentNode;else return null}}class ze{constructor(e,t,i=!0){this.node=e,this.offset=t,this.precise=i}static before(e,t){return new ze(e.parentNode,Rt(e),t)}static after(e,t){return new ze(e.parentNode,Rt(e)+1,t)}}var j=(function(n){return n[n.LTR=0]="LTR",n[n.RTL=1]="RTL",n})(j||(j={}));const ei=j.LTR,Go=j.RTL;function ec(n){let e=[];for(let t=0;t<n.length;t++)e.push(1<<+n[t]);return e}const od=ec("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),ld=ec("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),po=Object.create(null),Qe=[];for(let n of["()","[]","{}"]){let e=n.charCodeAt(0),t=n.charCodeAt(1);po[e]=t,po[t]=-e}function tc(n){return n<=247?od[n]:1424<=n&&n<=1524?2:1536<=n&&n<=1785?ld[n-1536]:1774<=n&&n<=2220?4:8192<=n&&n<=8204?256:64336<=n&&n<=65023?4:1}const ad=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/;class nt{get dir(){return this.level%2?Go:ei}constructor(e,t,i){this.from=e,this.to=t,this.level=i}side(e,t){return this.dir==t==e?this.to:this.from}forward(e,t){return e==(this.dir==t)}static find(e,t,i,s){let r=-1;for(let o=0;o<e.length;o++){let l=e[o];if(l.from<=t&&l.to>=t){if(l.level==i)return o;(r<0||(s!=0?s<0?l.from<t:l.to>t:e[r].level>l.level))&&(r=o)}}if(r<0)throw new RangeError("Index out of range");return r}}function ic(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++){let i=n[t],s=e[t];if(i.from!=s.from||i.to!=s.to||i.direction!=s.direction||!ic(i.inner,s.inner))return!1}return!0}const K=[];function hd(n,e,t,i,s){for(let r=0;r<=i.length;r++){let o=r?i[r-1].to:e,l=r<i.length?i[r].from:t,a=r?256:s;for(let h=o,c=a,f=a;h<l;h++){let u=tc(n.charCodeAt(h));u==512?u=c:u==8&&f==4&&(u=16),K[h]=u==4?2:u,u&7&&(f=u),c=u}for(let h=o,c=a,f=a;h<l;h++){let u=K[h];if(u==128)h<l-1&&c==K[h+1]&&c&24?u=K[h]=c:K[h]=256;else if(u==64){let d=h+1;for(;d<l&&K[d]==64;)d++;let p=h&&c==8||d<t&&K[d]==8?f==1?1:8:256;for(let m=h;m<d;m++)K[m]=p;h=d-1}else u==8&&f==1&&(K[h]=1);c=u,u&7&&(f=u)}}}function cd(n,e,t,i,s){let r=s==1?2:1;for(let o=0,l=0,a=0;o<=i.length;o++){let h=o?i[o-1].to:e,c=o<i.length?i[o].from:t;for(let f=h,u,d,p;f<c;f++)if(d=po[u=n.charCodeAt(f)])if(d<0){for(let m=l-3;m>=0;m-=3)if(Qe[m+1]==-d){let b=Qe[m+2],y=b&2?s:b&4?b&1?r:s:0;y&&(K[f]=K[Qe[m]]=y),l=m;break}}else{if(Qe.length==189)break;Qe[l++]=f,Qe[l++]=u,Qe[l++]=a}else if((p=K[f])==2||p==1){let m=p==s;a=m?0:1;for(let b=l-3;b>=0;b-=3){let y=Qe[b+2];if(y&2)break;if(m)Qe[b+2]|=2;else{if(y&4)break;Qe[b+2]|=4}}}}}function fd(n,e,t,i){for(let s=0,r=i;s<=t.length;s++){let o=s?t[s-1].to:n,l=s<t.length?t[s].from:e;for(let a=o;a<l;){let h=K[a];if(h==256){let c=a+1;for(;;)if(c==l){if(s==t.length)break;c=t[s++].to,l=s<t.length?t[s].from:e}else if(K[c]==256)c++;else break;let f=r==1,u=(c<e?K[c]:i)==1,d=f==u?f?1:2:i;for(let p=c,m=s,b=m?t[m-1].to:n;p>a;)p==b&&(p=t[--m].from,b=m?t[m-1].to:n),K[--p]=d;a=c}else r=h,a++}}}function go(n,e,t,i,s,r,o){let l=i%2?2:1;if(i%2==s%2)for(let a=e,h=0;a<t;){let c=!0,f=!1;if(h==r.length||a<r[h].from){let m=K[a];m!=l&&(c=!1,f=m==16)}let u=!c&&l==1?[]:null,d=c?i:i+1,p=a;e:for(;;)if(h<r.length&&p==r[h].from){if(f)break e;let m=r[h];if(!c)for(let b=m.to,y=h+1;;){if(b==t)break e;if(y<r.length&&r[y].from==b)b=r[y++].to;else{if(K[b]==l)break e;break}}if(h++,u)u.push(m);else{m.from>a&&o.push(new nt(a,m.from,d));let b=m.direction==ei!=!(d%2);mo(n,b?i+1:i,s,m.inner,m.from,m.to,o),a=m.to}p=m.to}else{if(p==t||(c?K[p]!=l:K[p]==l))break;p++}u?go(n,a,p,i+1,s,u,o):a<p&&o.push(new nt(a,p,d)),a=p}else for(let a=t,h=r.length;a>e;){let c=!0,f=!1;if(!h||a>r[h-1].to){let m=K[a-1];m!=l&&(c=!1,f=m==16)}let u=!c&&l==1?[]:null,d=c?i:i+1,p=a;e:for(;;)if(h&&p==r[h-1].to){if(f)break e;let m=r[--h];if(!c)for(let b=m.from,y=h;;){if(b==e)break e;if(y&&r[y-1].to==b)b=r[--y].from;else{if(K[b-1]==l)break e;break}}if(u)u.push(m);else{m.to<a&&o.push(new nt(m.to,a,d));let b=m.direction==ei!=!(d%2);mo(n,b?i+1:i,s,m.inner,m.from,m.to,o),a=m.from}p=m.from}else{if(p==e||(c?K[p-1]!=l:K[p-1]==l))break;p--}u?go(n,p,a,i+1,s,u,o):p<a&&o.push(new nt(p,a,d)),a=p}}function mo(n,e,t,i,s,r,o){let l=e%2?2:1;hd(n,s,r,i,l),cd(n,s,r,i,l),fd(s,r,i,l),go(n,s,r,e,t,i,o)}function ud(n,e,t){if(!n)return[new nt(0,0,e==Go?1:0)];if(e==ei&&!t.length&&!ad.test(n))return nc(n.length);if(t.length)for(;n.length>K.length;)K[K.length]=256;let i=[],s=e==ei?0:1;return mo(n,s,s,t,0,n.length,i),i}function nc(n){return[new nt(0,n,0)]}let sc="";function dd(n,e,t,i,s){var r;let o=i.head-n.from,l=nt.find(e,o,(r=i.bidiLevel)!==null&&r!==void 0?r:-1,i.assoc),a=e[l],h=a.side(s,t);if(o==h){let u=l+=s?1:-1;if(u<0||u>=e.length)return null;a=e[l=u],o=a.side(!s,t),h=a.side(s,t)}let c=ne(n.text,o,a.forward(s,t));(c<a.from||c>a.to)&&(c=h),sc=n.text.slice(Math.min(o,c),Math.max(o,c));let f=l==(s?e.length-1:0)?null:e[l+(s?1:-1)];return f&&c==h&&f.level+(s?0:1)<a.level?x.cursor(f.side(!s,t)+n.from,f.forward(s,t)?1:-1,f.level):x.cursor(c+n.from,a.forward(s,t)?-1:1,a.level)}function pd(n,e,t){for(let i=e;i<t;i++){let s=tc(n.charCodeAt(i));if(s==1)return ei;if(s==2||s==4)return Go}return ei}const rc=O.define(),oc=O.define(),lc=O.define(),ac=O.define(),bo=O.define(),hc=O.define(),cc=O.define(),Qo=O.define(),Yo=O.define(),fc=O.define({combine:n=>n.some(e=>e)}),uc=O.define({combine:n=>n.some(e=>e)}),dc=O.define();class xi{constructor(e,t="nearest",i="nearest",s=5,r=5,o=!1){this.range=e,this.y=t,this.x=i,this.yMargin=s,this.xMargin=r,this.isSnapshot=o}map(e){return e.empty?this:new xi(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}clip(e){return this.range.to<=e.doc.length?this:new xi(x.cursor(e.doc.length),this.y,this.x,this.yMargin,this.xMargin,this.isSnapshot)}}const Cn=L.define({map:(n,e)=>n.map(e)}),pc=L.define();function ge(n,e,t){let i=n.facet(ac);i.length?i[0](e):window.onerror&&window.onerror(String(e),t,void 0,void 0,e)||(t?console.error(t+":",e):console.error(e))}const ut=O.define({combine:n=>n.length?n[0]:!0});let gd=0;const fi=O.define({combine(n){return n.filter((e,t)=>{for(let i=0;i<t;i++)if(n[i].plugin==e.plugin)return!1;return!0})}});class X{constructor(e,t,i,s,r){this.id=e,this.create=t,this.domEventHandlers=i,this.domEventObservers=s,this.baseExtensions=r(this),this.extension=this.baseExtensions.concat(fi.of({plugin:this,arg:void 0}))}of(e){return this.baseExtensions.concat(fi.of({plugin:this,arg:e}))}static define(e,t){const{eventHandlers:i,eventObservers:s,provide:r,decorations:o}=t||{};return new X(gd++,e,i,s,l=>{let a=[];return o&&a.push(Hs.of(h=>{let c=h.plugin(l);return c?o(c):B.none})),r&&a.push(r(l)),a})}static fromClass(e,t){return X.define((i,s)=>new e(i,s),t)}}class ir{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}get plugin(){return this.spec&&this.spec.plugin}update(e){if(this.value){if(this.mustUpdate){let t=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(t)}catch(i){if(ge(t.state,i,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.plugin.create(e,this.spec.arg)}catch(t){ge(e.state,t,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var t;if(!((t=this.value)===null||t===void 0)&&t.destroy)try{this.value.destroy()}catch(i){ge(e.state,i,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}}const gc=O.define(),_o=O.define(),Hs=O.define(),mc=O.define(),Xo=O.define(),gn=O.define(),bc=O.define();function ql(n,e){let t=n.state.facet(bc);if(!t.length)return t;let i=t.map(r=>r instanceof Function?r(n):r),s=[];return N.spans(i,e.from,e.to,{point(){},span(r,o,l,a){let h=r-e.from,c=o-e.from,f=s;for(let u=l.length-1;u>=0;u--,a--){let d=l[u].spec.bidiIsolate,p;if(d==null&&(d=pd(e.text,h,c)),a>0&&f.length&&(p=f[f.length-1]).to==h&&p.direction==d)p.to=c,f=p.inner;else{let m={from:h,to:c,direction:d,inner:[]};f.push(m),f=m.inner}}}}),s}const yc=O.define();function Jo(n){let e=0,t=0,i=0,s=0;for(let r of n.state.facet(yc)){let o=r(n);o&&(o.left!=null&&(e=Math.max(e,o.left)),o.right!=null&&(t=Math.max(t,o.right)),o.top!=null&&(i=Math.max(i,o.top)),o.bottom!=null&&(s=Math.max(s,o.bottom)))}return{left:e,right:t,top:i,bottom:s}}const Vi=O.define();class Le{constructor(e,t,i,s){this.fromA=e,this.toA=t,this.fromB=i,this.toB=s}join(e){return new Le(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let t=e.length,i=this;for(;t>0;t--){let s=e[t-1];if(!(s.fromA>i.toA)){if(s.toA<i.fromA)break;i=i.join(s),e.splice(t-1,1)}}return e.splice(t,0,i),e}static extendWithRanges(e,t){if(t.length==0)return e;let i=[];for(let s=0,r=0,o=0;;){let l=s<e.length?e[s].fromB:1e9,a=r<t.length?t[r]:1e9,h=Math.min(l,a);if(h==1e9)break;let c=h+o,f=h,u=c;for(;;)if(r<t.length&&t[r]<=f){let d=t[r+1];r+=2,f=Math.max(f,d);for(let p=s;p<e.length&&e[p].fromB<=f;p++)o=e[p].toA-e[p].toB;u=Math.max(u,d+o)}else if(s<e.length&&e[s].fromB<=f){let d=e[s++];f=Math.max(f,d.toB),u=Math.max(u,d.toA),o=d.toA-d.toB}else break;i.push(new Le(c,u,h,f))}return i}}class ps{constructor(e,t,i){this.view=e,this.state=t,this.transactions=i,this.flags=0,this.startState=e.state,this.changes=ee.empty(this.startState.doc.length);for(let r of i)this.changes=this.changes.compose(r.changes);let s=[];this.changes.iterChangedRanges((r,o,l,a)=>s.push(new Le(r,o,l,a))),this.changedRanges=s}static create(e,t,i){return new ps(e,t,i)}get viewportChanged(){return(this.flags&4)>0}get viewportMoved(){return(this.flags&8)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&18)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}}const md=[];class _{constructor(e,t,i=0){this.dom=e,this.length=t,this.flags=i,this.parent=null,e.cmTile=this}get breakAfter(){return this.flags&1}get children(){return md}isWidget(){return!1}get isHidden(){return!1}isComposite(){return!1}isLine(){return!1}isText(){return!1}isBlock(){return!1}get domAttrs(){return null}sync(e){if(this.flags|=2,this.flags&4){this.flags&=-5;let t=this.domAttrs;t&&Ju(this.dom,t)}}toString(){return this.constructor.name+(this.children.length?`(${this.children})`:"")+(this.breakAfter?"#":"")}destroy(){this.parent=null}setDOM(e){this.dom=e,e.cmTile=this}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e,t=this.posAtStart){let i=t;for(let s of this.children){if(s==e)return i;i+=s.length+s.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}covers(e){return!0}coordsIn(e,t){return null}domPosFor(e,t){let i=Rt(this.dom),s=this.length?e>0:t>0;return new ze(this.parent.dom,i+(s?1:0),e==0||e==this.length)}markDirty(e){this.flags&=-3,e&&(this.flags|=4),this.parent&&this.parent.flags&2&&this.parent.markDirty(!1)}get overrideDOMText(){return null}get root(){for(let e=this;e;e=e.parent)if(e instanceof zs)return e;return null}static get(e){return e.cmTile}}class Vs extends _{constructor(e){super(e,0),this._children=[]}isComposite(){return!0}get children(){return this._children}get lastChild(){return this.children.length?this.children[this.children.length-1]:null}append(e){this.children.push(e),e.parent=this}sync(e){if(this.flags&2)return;super.sync(e);let t=this.dom,i=null,s,r=e?.node==t?e:null,o=0;for(let l of this.children){if(l.sync(e),o+=l.length+l.breakAfter,s=i?i.nextSibling:t.firstChild,r&&s!=l.dom&&(r.written=!0),l.dom.parentNode==t)for(;s&&s!=l.dom;)s=Kl(s);else t.insertBefore(l.dom,s);i=l.dom}for(s=i?i.nextSibling:t.firstChild,r&&s&&(r.written=!0);s;)s=Kl(s);this.length=o}}function Kl(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class zs extends Vs{constructor(e,t){super(t),this.view=e}owns(e){for(;e;e=e.parent)if(e==this)return!0;return!1}isBlock(){return!0}nearest(e){for(;;){if(!e)return null;let t=_.get(e);if(t&&this.owns(t))return t;e=e.parentNode}}blockTiles(e){for(let t=[],i=this,s=0,r=0;;)if(s==i.children.length){if(!t.length)return;i=i.parent,i.breakAfter&&r++,s=t.pop()}else{let o=i.children[s++];if(o instanceof dt)t.push(s),i=o,s=0;else{let l=r+o.length,a=e(o,r);if(a!==void 0)return a;r=l+o.breakAfter}}}resolveBlock(e,t){let i,s=-1,r,o=-1;if(this.blockTiles((l,a)=>{let h=a+l.length;if(e>=a&&e<=h){if(l.isWidget()&&t>=-1&&t<=1){if(l.flags&32)return!0;l.flags&16&&(i=void 0)}(a<e||e==h&&(t<-1?l.length:l.covers(1)))&&(!i||!l.isWidget()&&i.isWidget())&&(i=l,s=e-a),(h>e||e==a&&(t>1?l.length:l.covers(-1)))&&(!r||!l.isWidget()&&r.isWidget())&&(r=l,o=e-a)}}),!i&&!r)throw new Error("No tile at position "+e);return i&&t<0||!r?{tile:i,offset:s}:{tile:r,offset:o}}}class dt extends Vs{constructor(e,t){super(e),this.wrapper=t}isBlock(){return!0}covers(e){return this.children.length?e<0?this.children[0].covers(-1):this.lastChild.covers(1):!1}get domAttrs(){return this.wrapper.attributes}static of(e,t){let i=new dt(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}}class Ci extends Vs{constructor(e,t){super(e),this.attrs=t}isLine(){return!0}static start(e,t,i){let s=new Ci(t||document.createElement("div"),e);return(!t||!i)&&(s.flags|=4),s}get domAttrs(){return this.attrs}resolveInline(e,t,i){let s=null,r=-1,o=null,l=-1;function a(c,f){for(let u=0,d=0;u<c.children.length&&d<=f;u++){let p=c.children[u],m=d+p.length;m>=f&&(p.isComposite()?a(p,f-d):(!o||o.isHidden&&(t>0||i&&yd(o,p)))&&(m>f||p.flags&32)?(o=p,l=f-d):(d<f||p.flags&16&&!p.isHidden)&&(s=p,r=f-d)),d=m}}a(this,e);let h=(t<0?s:o)||s||o;return h?{tile:h,offset:h==s?r:l}:null}coordsIn(e,t){let i=this.resolveInline(e,t,!0);return i?i.tile.coordsIn(Math.max(0,i.offset),t):bd(this)}domIn(e,t){let i=this.resolveInline(e,t);if(i){let{tile:s,offset:r}=i;if(this.dom.contains(s.dom))return s.isText()?new ze(s.dom,Math.min(s.dom.nodeValue.length,r)):s.domPosFor(r,s.flags&16?1:s.flags&32?-1:t);let o=i.tile.parent,l=!1;for(let a of o.children){if(l)return new ze(a.dom,0);a==i.tile&&(l=!0)}}return new ze(this.dom,0)}}function bd(n){let e=n.dom.lastChild;if(!e)return n.dom.getBoundingClientRect();let t=ts(e);return t[t.length-1]||null}function yd(n,e){let t=n.coordsIn(0,1),i=e.coordsIn(0,1);return t&&i&&i.top<t.bottom}class xe extends Vs{constructor(e,t){super(e),this.mark=t}get domAttrs(){return this.mark.attrs}static of(e,t){let i=new xe(t||document.createElement(e.tagName),e);return t||(i.flags|=4),i}}class Gt extends _{constructor(e,t){super(e,t.length),this.text=t}sync(e){this.flags&2||(super.sync(e),this.dom.nodeValue!=this.text&&(e&&e.node==this.dom&&(e.written=!0),this.dom.nodeValue=this.text))}isText(){return!0}toString(){return JSON.stringify(this.text)}coordsIn(e,t){let i=this.dom.nodeValue.length;e>i&&(e=i);let s=e,r=e,o=0;e==0&&t<0||e==i&&t>=0?M.chrome||M.gecko||(e?(s--,o=1):r<i&&(r++,o=-1)):t<0?s--:r<i&&r++;let l=tn(this.dom,s,r).getClientRects();if(!l.length)return null;let a=l[(o?o<0:t>=0)?0:l.length-1];return M.safari&&!o&&a.width==0&&(a=Array.prototype.find.call(l,h=>h.width)||a),o?ds(a,o<0):a||null}static of(e,t){let i=new Gt(t||document.createTextNode(e),e);return t||(i.flags|=2),i}}class ti extends _{constructor(e,t,i,s){super(e,t,s),this.widget=i}isWidget(){return!0}get isHidden(){return this.widget.isHidden}covers(e){return this.flags&48?!1:(this.flags&(e<0?64:128))>0}coordsIn(e,t){return this.coordsInWidget(e,t,!1)}coordsInWidget(e,t,i){let s=this.widget.coordsAt(this.dom,e,t);if(s)return s;if(i)return ds(this.dom.getBoundingClientRect(),this.length?e==0:t<=0);{let r=this.dom.getClientRects(),o=null;if(!r.length)return null;let l=this.flags&16?!0:this.flags&32?!1:e>0;for(let a=l?r.length-1:0;o=r[a],!(e>0?a==0:a==r.length-1||o.top<o.bottom);a+=l?-1:1);return ds(o,!l)}}get overrideDOMText(){if(!this.length)return F.empty;let{root:e}=this;if(!e)return F.empty;let t=this.posAtStart;return e.view.state.doc.slice(t,t+this.length)}destroy(){super.destroy(),this.widget.destroy(this.dom)}static of(e,t,i,s,r){return r||(r=e.toDOM(t),e.editable||(r.contentEditable="false")),new ti(r,i,e,s)}}class gs extends _{constructor(e){let t=document.createElement("img");t.className="cm-widgetBuffer",t.setAttribute("aria-hidden","true"),super(t,0,e)}get isHidden(){return!0}get overrideDOMText(){return F.empty}coordsIn(e){return this.dom.getBoundingClientRect()}}class xd{constructor(e){this.index=0,this.beforeBreak=!1,this.parents=[],this.tile=e}advance(e,t,i){let{tile:s,index:r,beforeBreak:o,parents:l}=this;for(;e||t>0;)if(s.isComposite())if(o){if(!e)break;i&&i.break(),e--,o=!1}else if(r==s.children.length){if(!e&&!l.length)break;i&&i.leave(s),o=!!s.breakAfter,{tile:s,index:r}=l.pop(),r++}else{let a=s.children[r],h=a.breakAfter;(t>0?a.length<=e:a.length<e)&&(!i||i.skip(a,0,a.length)!==!1||!a.isComposite)?(o=!!h,r++,e-=a.length):(l.push({tile:s,index:r}),s=a,r=0,i&&a.isComposite()&&i.enter(a))}else if(r==s.length)o=!!s.breakAfter,{tile:s,index:r}=l.pop(),r++;else if(e){let a=Math.min(e,s.length-r);i&&i.skip(s,r,r+a),e-=a,r+=a}else break;return this.tile=s,this.index=r,this.beforeBreak=o,this}get root(){return this.parents.length?this.parents[0].tile:this.tile}}class kd{constructor(e,t,i,s){this.from=e,this.to=t,this.wrapper=i,this.rank=s}}class wd{constructor(e,t,i){this.cache=e,this.root=t,this.blockWrappers=i,this.curLine=null,this.lastBlock=null,this.afterWidget=null,this.pos=0,this.wrappers=[],this.wrapperPos=0}addText(e,t,i,s){var r;this.flushBuffer();let o=this.ensureMarks(t,i),l=o.lastChild;if(l&&l.isText()&&!(l.flags&8)&&l.length+e.length<512){this.cache.reused.set(l,2);let a=o.children[o.children.length-1]=new Gt(l.dom,l.text+e);a.parent=o}else o.append(s||Gt.of(e,(r=this.cache.find(Gt))===null||r===void 0?void 0:r.dom));this.pos+=e.length,this.afterWidget=null}addComposition(e,t){let i=this.curLine;i.dom!=t.line.dom&&(i.setDOM(this.cache.reused.has(t.line)?nr(t.line.dom):t.line.dom),this.cache.reused.set(t.line,2));let s=i;for(let l=t.marks.length-1;l>=0;l--){let a=t.marks[l],h=s.lastChild;if(h instanceof xe&&h.mark.eq(a.mark))h.dom!=a.dom&&h.setDOM(nr(a.dom)),s=h;else{if(this.cache.reused.get(a)){let f=_.get(a.dom);f&&f.setDOM(nr(a.dom))}let c=xe.of(a.mark,a.dom);s.append(c),s=c}this.cache.reused.set(a,2)}let r=_.get(e.text);r&&this.cache.reused.set(r,2);let o=new Gt(e.text,e.text.nodeValue);o.flags|=8,s.append(o)}addInlineWidget(e,t,i){let s=this.afterWidget&&e.flags&48&&(this.afterWidget.flags&48)==(e.flags&48);s||this.flushBuffer();let r=this.ensureMarks(t,i);!s&&!(e.flags&16)&&r.append(this.getBuffer(1)),r.append(e),this.pos+=e.length,this.afterWidget=e}addMark(e,t,i){this.flushBuffer(),this.ensureMarks(t,i).append(e),this.pos+=e.length,this.afterWidget=null}addBlockWidget(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}continueWidget(e){let t=this.afterWidget||this.lastBlock;t.length+=e,this.pos+=e}addLineStart(e,t){var i;e||(e=xc);let s=Ci.start(e,t||((i=this.cache.find(Ci))===null||i===void 0?void 0:i.dom),!!t);this.getBlockPos().append(this.lastBlock=this.curLine=s)}addLine(e){this.getBlockPos().append(e),this.pos+=e.length,this.lastBlock=e,this.endLine()}addBreak(){this.lastBlock.flags|=1,this.endLine(),this.pos++}addLineStartIfNotCovered(e){this.blockPosCovered()||this.addLineStart(e)}ensureLine(e){this.curLine||this.addLineStart(e)}ensureMarks(e,t){var i;let s=this.curLine;for(let r=e.length-1;r>=0;r--){let o=e[r],l;if(t>0&&(l=s.lastChild)&&l instanceof xe&&l.mark.eq(o))s=l,t--;else{let a=xe.of(o,(i=this.cache.find(xe,h=>h.mark.eq(o)))===null||i===void 0?void 0:i.dom);s.append(a),s=a,t=0}}return s}endLine(){if(this.curLine){this.flushBuffer();let e=this.curLine.lastChild;(!e||!jl(this.curLine,!1)||e.dom.nodeName!="BR"&&e.isWidget()&&!(M.ios&&jl(this.curLine,!0)))&&this.curLine.append(this.cache.findWidget(sr,0,32)||new ti(sr.toDOM(),0,sr,32)),this.curLine=this.afterWidget=null}}updateBlockWrappers(){this.wrapperPos>this.pos+1e4&&(this.blockWrappers.goto(this.pos),this.wrappers.length=0);for(let e=this.wrappers.length-1;e>=0;e--)this.wrappers[e].to<this.pos&&this.wrappers.splice(e,1);for(let e=this.blockWrappers;e.value&&e.from<=this.pos;e.next())if(e.to>=this.pos){let t=new kd(e.from,e.to,e.value,e.rank),i=this.wrappers.length;for(;i>0&&(this.wrappers[i-1].rank-t.rank||this.wrappers[i-1].to-t.to)<0;)i--;this.wrappers.splice(i,0,t)}this.wrapperPos=this.pos}getBlockPos(){var e;this.updateBlockWrappers();let t=this.root;for(let i of this.wrappers){let s=t.lastChild;if(i.from<this.pos&&s instanceof dt&&s.wrapper.eq(i.wrapper))t=s;else{let r=dt.of(i.wrapper,(e=this.cache.find(dt,o=>o.wrapper.eq(i.wrapper)))===null||e===void 0?void 0:e.dom);t.append(r),t=r}}return t}blockPosCovered(){let e=this.lastBlock;return e!=null&&!e.breakAfter&&(!e.isWidget()||(e.flags&160)>0)}getBuffer(e){let t=2|(e<0?16:32),i=this.cache.find(gs,void 0,1);return i&&(i.flags=t),i||new gs(t)}flushBuffer(){this.afterWidget&&!(this.afterWidget.flags&32)&&(this.afterWidget.parent.append(this.getBuffer(-1)),this.afterWidget=null)}}class vd{constructor(e){this.skipCount=0,this.text="",this.textOff=0,this.cursor=e.iter()}skip(e){this.textOff+e<=this.text.length?this.textOff+=e:(this.skipCount+=e-(this.text.length-this.textOff),this.text="",this.textOff=0)}next(e){if(this.textOff==this.text.length){let{value:s,lineBreak:r,done:o}=this.cursor.next(this.skipCount);if(this.skipCount=0,o)throw new Error("Ran out of text content when drawing inline views");this.text=s;let l=this.textOff=Math.min(e,s.length);return r?null:s.slice(0,l)}let t=Math.min(this.text.length,this.textOff+e),i=this.text.slice(this.textOff,t);return this.textOff=t,i}}const ms=[ti,Ci,Gt,xe,gs,dt,zs];for(let n=0;n<ms.length;n++)ms[n].bucket=n;class Sd{constructor(e){this.view=e,this.buckets=ms.map(()=>[]),this.index=ms.map(()=>0),this.reused=new Map}add(e){let t=e.constructor.bucket,i=this.buckets[t];i.length<6?i.push(e):i[this.index[t]=(this.index[t]+1)%6]=e}find(e,t,i=2){let s=e.bucket,r=this.buckets[s],o=this.index[s];for(let l=r.length-1;l>=0;l--){let a=(l+o)%r.length,h=r[a];if((!t||t(h))&&!this.reused.has(h))return r.splice(a,1),a<o&&this.index[s]--,this.reused.set(h,i),h}return null}findWidget(e,t,i){let s=this.buckets[0];if(s.length)for(let r=0,o=0;;r++){if(r==s.length){if(o)return null;o=1,r=0}let l=s[r];if(!this.reused.has(l)&&(o==0?l.widget.compare(e):l.widget.constructor==e.constructor&&e.updateDOM(l.dom,this.view)))return s.splice(r,1),r<this.index[0]&&this.index[0]--,l.widget==e&&l.length==t&&(l.flags&497)==i?(this.reused.set(l,1),l):(this.reused.set(l,2),new ti(l.dom,t,e,l.flags&-498|i))}}reuse(e){return this.reused.set(e,1),e}maybeReuse(e,t=2){if(!this.reused.has(e))return this.reused.set(e,t),e.dom}clear(){for(let e=0;e<this.buckets.length;e++)this.buckets[e].length=this.index[e]=0}}class Cd{constructor(e,t,i,s,r){this.view=e,this.decorations=s,this.disallowBlockEffectsFor=r,this.openWidget=!1,this.openMarks=0,this.cache=new Sd(e),this.text=new vd(e.state.doc),this.builder=new wd(this.cache,new zs(e,e.contentDOM),N.iter(i)),this.cache.reused.set(t,2),this.old=new xd(t),this.reuseWalker={skip:(o,l,a)=>{if(this.cache.add(o),o.isComposite())return!1},enter:o=>this.cache.add(o),leave:()=>{},break:()=>{}}}run(e,t){let i=t&&this.getCompositionContext(t.text);for(let s=0,r=0,o=0;;){let l=o<e.length?e[o++]:null,a=l?l.fromA:this.old.root.length;if(a>s){let h=a-s;this.preserve(h,!o,!l),s=a,r+=h}if(!l)break;t&&l.fromA<=t.range.fromA&&l.toA>=t.range.toA?(this.forward(l.fromA,t.range.fromA,t.range.fromA<t.range.toA?1:-1),this.emit(r,t.range.fromB),this.cache.clear(),this.builder.addComposition(t,i),this.text.skip(t.range.toB-t.range.fromB),this.forward(t.range.fromA,l.toA),this.emit(t.range.toB,l.toB)):(this.forward(l.fromA,l.toA),this.emit(r,l.toB)),r=l.toB,s=l.toA}return this.builder.curLine&&this.builder.endLine(),this.builder.root}preserve(e,t,i){let s=Td(this.old),r=this.openMarks;this.old.advance(e,i?1:-1,{skip:(o,l,a)=>{if(o.isWidget())if(this.openWidget)this.builder.continueWidget(a-l);else{let h=a>0||l<o.length?ti.of(o.widget,this.view,a-l,o.flags&496,this.cache.maybeReuse(o)):this.cache.reuse(o);h.flags&256?(h.flags&=-2,this.builder.addBlockWidget(h)):(this.builder.ensureLine(null),this.builder.addInlineWidget(h,s,r),r=s.length)}else if(o.isText())this.builder.ensureLine(null),!l&&a==o.length&&!this.cache.reused.has(o)?this.builder.addText(o.text,s,r,this.cache.reuse(o)):(this.cache.add(o),this.builder.addText(o.text.slice(l,a),s,r)),r=s.length;else if(o.isLine())o.flags&=-2,this.cache.reused.set(o,1),this.builder.addLine(o);else if(o instanceof gs)this.cache.add(o);else if(o instanceof xe)this.builder.ensureLine(null),this.builder.addMark(o,s,r),this.cache.reused.set(o,1),r=s.length;else return!1;this.openWidget=!1},enter:o=>{o.isLine()?this.builder.addLineStart(o.attrs,this.cache.maybeReuse(o)):(this.cache.add(o),o instanceof xe&&s.unshift(o.mark)),this.openWidget=!1},leave:o=>{o.isLine()?s.length&&(s.length=r=0):o instanceof xe&&(s.shift(),r=Math.min(r,s.length))},break:()=>{this.builder.addBreak(),this.openWidget=!1}}),this.text.skip(e)}emit(e,t){let i=null,s=this.builder,r=0,o=N.spans(this.decorations,e,t,{point:(l,a,h,c,f,u)=>{if(h instanceof Zt){if(this.disallowBlockEffectsFor[u]){if(h.block)throw new RangeError("Block decorations may not be specified via plugins");if(a>this.view.state.doc.lineAt(l).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}if(r=c.length,f>c.length)s.continueWidget(a-l);else{let d=h.widget||(h.block?Ai.block:Ai.inline),p=Ad(h),m=this.cache.findWidget(d,a-l,p)||ti.of(d,this.view,a-l,p);h.block?(h.startSide>0&&s.addLineStartIfNotCovered(i),s.addBlockWidget(m)):(s.ensureLine(i),s.addInlineWidget(m,c,f))}i=null}else i=Md(i,h);a>l&&this.text.skip(a-l)},span:(l,a,h,c)=>{for(let f=l;f<a;){let u=this.text.next(Math.min(512,a-f));u==null?(s.addLineStartIfNotCovered(i),s.addBreak(),f++):(s.ensureLine(i),s.addText(u,h,f==l?c:h.length),f+=u.length),i=null}}});s.addLineStartIfNotCovered(i),this.openWidget=o>r,this.openMarks=o}forward(e,t,i=1){t-e<=10?this.old.advance(t-e,i,this.reuseWalker):(this.old.advance(5,-1,this.reuseWalker),this.old.advance(t-e-10,-1),this.old.advance(5,i,this.reuseWalker))}getCompositionContext(e){let t=[],i=null;for(let s=e.parentNode;;s=s.parentNode){let r=_.get(s);if(s==this.view.contentDOM)break;r instanceof xe?t.push(r):r?.isLine()?i=r:r instanceof dt||(s.nodeName=="DIV"&&!i&&s!=this.view.contentDOM?i=new Ci(s,xc):i||t.push(xe.of(new dn({tagName:s.nodeName.toLowerCase(),attributes:Zu(s)}),s)))}return{line:i,marks:t}}}function jl(n,e){let t=i=>{for(let s of i.children)if((e?s.isText():s.length)||t(s))return!0;return!1};return t(n)}function Ad(n){let e=n.isReplace?(n.startSide<0?64:0)|(n.endSide>0?128:0):n.startSide>0?32:16;return n.block&&(e|=256),e}const xc={class:"cm-line"};function Md(n,e){let t=e.spec.attributes,i=e.spec.class;return!t&&!i||(n||(n={class:"cm-line"}),t&&jo(t,n),i&&(n.class+=" "+i)),n}function Td(n){let e=[];for(let t=n.parents.length;t>1;t--){let i=t==n.parents.length?n.tile:n.parents[t].tile;i instanceof xe&&e.push(i.mark)}return e}function nr(n){let e=_.get(n);return e&&e.setDOM(n.cloneNode()),n}class Ai extends yt{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}}Ai.inline=new Ai("span");Ai.block=new Ai("div");const sr=new class extends yt{toDOM(){return document.createElement("br")}get isHidden(){return!0}get editable(){return!0}};class Ul{constructor(e){this.view=e,this.decorations=[],this.blockWrappers=[],this.dynamicDecorationMap=[!1],this.domChanged=null,this.hasComposition=null,this.editContextFormatting=B.none,this.lastCompositionAfterCursor=!1,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.updateDeco(),this.tile=new zs(e,e.contentDOM),this.updateInner([new Le(0,0,0,e.state.doc.length)],null)}update(e){var t;let i=e.changedRanges;this.minWidth>0&&i.length&&(i.every(({fromA:c,toA:f})=>f<this.minWidthFrom||c>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0),this.updateEditContextFormatting(e);let s=-1;this.view.inputState.composing>=0&&!this.view.observer.editContext&&(!((t=this.domChanged)===null||t===void 0)&&t.newSel?s=this.domChanged.newSel.head:!Nd(e.changes,this.hasComposition)&&!e.selectionSet&&(s=e.state.selection.main.head));let r=s>-1?Dd(this.view,e.changes,s):null;if(this.domChanged=null,this.hasComposition){let{from:c,to:f}=this.hasComposition;i=new Le(c,f,e.changes.mapPos(c,-1),e.changes.mapPos(f,1)).addToSet(i.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(M.ie||M.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,l=this.blockWrappers;this.updateDeco();let a=Pd(o,this.decorations,e.changes);a.length&&(i=Le.extendWithRanges(i,a));let h=Ed(l,this.blockWrappers,e.changes);return h.length&&(i=Le.extendWithRanges(i,h)),r&&!i.some(c=>c.fromA<=r.range.fromA&&c.toA>=r.range.toA)&&(i=r.range.addToSet(i.slice())),this.tile.flags&2&&i.length==0?!1:(this.updateInner(i,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,t){this.view.viewState.mustMeasureContent=!0;let{observer:i}=this.view;i.ignore(()=>{if(t||e.length){let o=this.tile,l=new Cd(this.view,o,this.blockWrappers,this.decorations,this.dynamicDecorationMap);t&&_.get(t.text)&&l.cache.reused.set(_.get(t.text),2),this.tile=l.run(e,t),yo(o,l.cache.reused)}this.tile.dom.style.height=this.view.viewState.contentHeight/this.view.scaleY+"px",this.tile.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let r=M.chrome||M.ios?{node:i.selectionRange.focusNode,written:!1}:void 0;this.tile.sync(r),r&&(r.written||i.selectionRange.focusNode!=r.node||!this.tile.dom.contains(r.node))&&(this.forceSelection=!0),this.tile.dom.style.height=""});let s=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let r of this.tile.children)r.isWidget()&&r.widget instanceof rr&&s.push(r.dom);i.updateGaps(s)}updateEditContextFormatting(e){this.editContextFormatting=this.editContextFormatting.map(e.changes);for(let t of e.transactions)for(let i of t.effects)i.is(pc)&&(this.editContextFormatting=i.value)}updateSelection(e=!1,t=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let{dom:i}=this.tile,s=this.view.root.activeElement,r=s==i,o=!r&&!(this.view.state.facet(ut)||i.tabIndex>-1)&&ji(i,this.view.observer.selectionRange)&&!(s&&i.contains(s));if(!(r||t||o))return;let l=this.forceSelection;this.forceSelection=!1;let a=this.view.state.selection.main,h,c;if(a.empty?c=h=this.inlineDOMNearPos(a.anchor,a.assoc||1):(c=this.inlineDOMNearPos(a.head,a.head==a.from?1:-1),h=this.inlineDOMNearPos(a.anchor,a.anchor==a.from?1:-1)),M.gecko&&a.empty&&!this.hasComposition&&Od(h)){let u=document.createTextNode("");this.view.observer.ignore(()=>h.node.insertBefore(u,h.node.childNodes[h.offset]||null)),h=c=new ze(u,0),l=!0}let f=this.view.observer.selectionRange;(l||!f.focusNode||(!Ui(h.node,h.offset,f.anchorNode,f.anchorOffset)||!Ui(c.node,c.offset,f.focusNode,f.focusOffset))&&!this.suppressWidgetCursorChange(f,a))&&(this.view.observer.ignore(()=>{M.android&&M.chrome&&i.contains(f.focusNode)&&Id(f.focusNode,i)&&(i.blur(),i.focus({preventScroll:!0}));let u=en(this.view.root);if(u)if(a.empty){if(M.gecko){let d=Rd(h.node,h.offset);if(d&&d!=3){let p=(d==1?Jh:Zh)(h.node,h.offset);p&&(h=new ze(p.node,p.offset))}}u.collapse(h.node,h.offset),a.bidiLevel!=null&&u.caretBidiLevel!==void 0&&(u.caretBidiLevel=a.bidiLevel)}else if(u.extend){u.collapse(h.node,h.offset);try{u.extend(c.node,c.offset)}catch{}}else{let d=document.createRange();a.anchor>a.head&&([h,c]=[c,h]),d.setEnd(c.node,c.offset),d.setStart(h.node,h.offset),u.removeAllRanges(),u.addRange(d)}o&&this.view.root.activeElement==i&&(i.blur(),s&&s.focus())}),this.view.observer.setSelectionRange(h,c)),this.impreciseAnchor=h.precise?null:new ze(f.anchorNode,f.anchorOffset),this.impreciseHead=c.precise?null:new ze(f.focusNode,f.focusOffset)}suppressWidgetCursorChange(e,t){return this.hasComposition&&t.empty&&Ui(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)&&this.posFromDOM(e.focusNode,e.focusOffset)==t.head}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,t=e.state.selection.main,i=en(e.root),{anchorNode:s,anchorOffset:r}=e.observer.selectionRange;if(!i||!t.empty||!t.assoc||!i.modify)return;let o=this.lineAt(t.head,t.assoc);if(!o)return;let l=o.posAtStart;if(t.head==l||t.head==l+o.length)return;let a=this.coordsAt(t.head,-1),h=this.coordsAt(t.head,1);if(!a||!h||a.bottom>h.top)return;let c=this.domAtPos(t.head+t.assoc,t.assoc);i.collapse(c.node,c.offset),i.modify("move",t.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=t.from&&i.collapse(s,r)}posFromDOM(e,t){let i=this.tile.nearest(e);if(!i)return this.tile.dom.compareDocumentPosition(e)&2?0:this.view.state.doc.length;let s=i.posAtStart;if(i.isComposite()){let r;if(e==i.dom)r=i.dom.childNodes[t];else{let o=gt(e)==0?0:t==0?-1:1;for(;;){let l=e.parentNode;if(l==i.dom)break;o==0&&l.firstChild!=l.lastChild&&(e==l.firstChild?o=-1:o=1),e=l}o<0?r=e:r=e.nextSibling}if(r==i.dom.firstChild)return s;for(;r&&!_.get(r);)r=r.nextSibling;if(!r)return s+i.length;for(let o=0,l=s;;o++){let a=i.children[o];if(a.dom==r)return l;l+=a.length+a.breakAfter}}else return i.isText()?e==i.dom?s+t:s+(t?i.length:0):s}domAtPos(e,t){let{tile:i,offset:s}=this.tile.resolveBlock(e,t);return i.isWidget()?i.domPosFor(e,t):i.domIn(s,t)}inlineDOMNearPos(e,t){let i,s=-1,r=!1,o,l=-1,a=!1;return this.tile.blockTiles((h,c)=>{if(h.isWidget()){if(h.flags&32&&c>=e)return!0;h.flags&16&&(r=!0)}else{let f=c+h.length;if(c<=e&&(i=h,s=e-c,r=f<e),f>=e&&!o&&(o=h,l=e-c,a=c>e),c>e&&o)return!0}}),!i&&!o?this.domAtPos(e,t):(r&&o?i=null:a&&i&&(o=null),i&&t<0||!o?i.domIn(s,t):o.domIn(l,t))}coordsAt(e,t){let{tile:i,offset:s}=this.tile.resolveBlock(e,t);return i.isWidget()?i.widget instanceof rr?null:i.coordsInWidget(s,t,!0):i.coordsIn(s,t)}lineAt(e,t){let{tile:i}=this.tile.resolveBlock(e,t);return i.isLine()?i:null}coordsForChar(e){let{tile:t,offset:i}=this.tile.resolveBlock(e,1);if(!t.isLine())return null;function s(r,o){if(r.isComposite())for(let l of r.children){if(l.length>=o){let a=s(l,o);if(a)return a}if(o-=l.length,o<0)break}else if(r.isText()&&o<r.length){let l=ne(r.text,o);if(l==o)return null;let a=tn(r.dom,o,l).getClientRects();for(let h=0;h<a.length;h++){let c=a[h];if(h==a.length-1||c.top<c.bottom&&c.left<c.right)return c}}return null}return s(t,i)}measureVisibleLineHeights(e){let t=[],{from:i,to:s}=e,r=this.view.contentDOM.clientWidth,o=r>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==j.LTR,h=0,c=(f,u,d)=>{for(let p=0;p<f.children.length&&!(u>s);p++){let m=f.children[p],b=u+m.length,y=m.dom.getBoundingClientRect(),{height:w}=y;if(d&&!p&&(h+=y.top-d.top),m instanceof dt)b>i&&c(m,u,y);else if(u>=i&&(h>0&&t.push(-h),t.push(w+h),h=0,o)){let k=m.dom.lastChild,D=k?ts(k):[];if(D.length){let v=D[D.length-1],S=a?v.right-y.left:y.right-v.left;S>l&&(l=S,this.minWidth=r,this.minWidthFrom=u,this.minWidthTo=b)}}d&&p==f.children.length-1&&(h+=d.bottom-y.bottom),u=b+m.breakAfter}};return c(this.tile,0,null),t}textDirectionAt(e){let{tile:t}=this.tile.resolveBlock(e,1);return getComputedStyle(t.dom).direction=="rtl"?j.RTL:j.LTR}measureTextSize(){let e=this.tile.blockTiles(o=>{if(o.isLine()&&o.children.length&&o.length<=20){let l=0,a;for(let h of o.children){if(!h.isText()||/[^ -~]/.test(h.text))return;let c=ts(h.dom);if(c.length!=1)return;l+=c[0].width,a=c[0].height}if(l)return{lineHeight:o.dom.getBoundingClientRect().height,charWidth:l/o.length,textHeight:a}}});if(e)return e;let t=document.createElement("div"),i,s,r;return t.className="cm-line",t.style.width="99999px",t.style.position="absolute",t.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.tile.dom.appendChild(t);let o=ts(t.firstChild)[0];i=t.getBoundingClientRect().height,s=o&&o.width?o.width/27:7,r=o&&o.height?o.height:i,t.remove()}),{lineHeight:i,charWidth:s,textHeight:r}}computeBlockGapDeco(){let e=[],t=this.view.viewState;for(let i=0,s=0;;s++){let r=s==t.viewports.length?null:t.viewports[s],o=r?r.from-1:this.view.state.doc.length;if(o>i){let l=(t.lineBlockAt(o).bottom-t.lineBlockAt(i).top)/this.view.scaleY;e.push(B.replace({widget:new rr(l),block:!0,inclusive:!0,isBlockGap:!0}).range(i,o))}if(!r)break;i=r.to+1}return B.set(e)}updateDeco(){let e=1,t=this.view.state.facet(Hs).map(r=>(this.dynamicDecorationMap[e++]=typeof r=="function")?r(this.view):r),i=!1,s=this.view.state.facet(Xo).map((r,o)=>{let l=typeof r=="function";return l&&(i=!0),l?r(this.view):r});for(s.length&&(this.dynamicDecorationMap[e++]=i,t.push(N.join(s))),this.decorations=[this.editContextFormatting,...t,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco];e<this.decorations.length;)this.dynamicDecorationMap[e++]=!1;this.blockWrappers=this.view.state.facet(mc).map(r=>typeof r=="function"?r(this.view):r)}scrollIntoView(e){if(e.isSnapshot){let h=this.view.viewState.lineBlockAt(e.range.head);this.view.scrollDOM.scrollTop=h.top-e.yMargin,this.view.scrollDOM.scrollLeft=e.xMargin;return}for(let h of this.view.state.facet(dc))try{if(h(this.view,e.range,e))return!0}catch(c){ge(this.view.state,c,"scroll handler")}let{range:t}=e,i=this.coordsAt(t.head,t.empty?t.assoc:t.head>t.anchor?-1:1),s;if(!i)return;!t.empty&&(s=this.coordsAt(t.anchor,t.anchor>t.head?-1:1))&&(i={left:Math.min(i.left,s.left),top:Math.min(i.top,s.top),right:Math.max(i.right,s.right),bottom:Math.max(i.bottom,s.bottom)});let r=Jo(this.view),o={left:i.left-r.left,top:i.top-r.top,right:i.right+r.right,bottom:i.bottom+r.bottom},{offsetWidth:l,offsetHeight:a}=this.view.scrollDOM;if(id(this.view.scrollDOM,o,t.head<t.anchor?-1:1,e.x,e.y,Math.max(Math.min(e.xMargin,l),-l),Math.max(Math.min(e.yMargin,a),-a),this.view.textDirection==j.LTR),window.visualViewport&&window.innerHeight-window.visualViewport.height>1&&(i.top>window.pageYOffset+window.visualViewport.offsetTop+window.visualViewport.height||i.bottom<window.pageYOffset+window.visualViewport.offsetTop)){let h=this.view.docView.lineAt(t.head,1);h&&h.dom.scrollIntoView({block:"nearest"})}}lineHasWidget(e){let t=i=>i.isWidget()||i.children.some(t);return t(this.tile.resolveBlock(e,1).tile)}destroy(){yo(this.tile)}}function yo(n,e){let t=e?.get(n);if(t!=1){t==null&&n.destroy();for(let i of n.children)yo(i,e)}}function Od(n){return n.node.nodeType==1&&n.node.firstChild&&(n.offset==0||n.node.childNodes[n.offset-1].contentEditable=="false")&&(n.offset==n.node.childNodes.length||n.node.childNodes[n.offset].contentEditable=="false")}function kc(n,e){let t=n.observer.selectionRange;if(!t.focusNode)return null;let i=Jh(t.focusNode,t.focusOffset),s=Zh(t.focusNode,t.focusOffset),r=i||s;if(s&&i&&s.node!=i.node){let l=_.get(s.node);if(!l||l.isText()&&l.text!=s.node.nodeValue)r=s;else if(n.docView.lastCompositionAfterCursor){let a=_.get(i.node);!a||a.isText()&&a.text!=i.node.nodeValue||(r=s)}}if(n.docView.lastCompositionAfterCursor=r!=i,!r)return null;let o=e-r.offset;return{from:o,to:o+r.node.nodeValue.length,node:r.node}}function Dd(n,e,t){let i=kc(n,t);if(!i)return null;let{node:s,from:r,to:o}=i,l=s.nodeValue;if(/[\n\r]/.test(l)||n.state.doc.sliceString(i.from,i.to)!=l)return null;let a=e.invertedDesc;return{range:new Le(a.mapPos(r),a.mapPos(o),r,o),text:s}}function Rd(n,e){return n.nodeType!=1?0:(e&&n.childNodes[e-1].contentEditable=="false"?1:0)|(e<n.childNodes.length&&n.childNodes[e].contentEditable=="false"?2:0)}let Bd=class{constructor(){this.changes=[]}compareRange(e,t){bi(e,t,this.changes)}comparePoint(e,t){bi(e,t,this.changes)}boundChange(e){bi(e,e,this.changes)}};function Pd(n,e,t){let i=new Bd;return N.compare(n,e,t,i),i.changes}class Ld{constructor(){this.changes=[]}compareRange(e,t){bi(e,t,this.changes)}comparePoint(){}boundChange(e){bi(e,e,this.changes)}}function Ed(n,e,t){let i=new Ld;return N.compare(n,e,t,i),i.changes}function Id(n,e){for(let t=n;t&&t!=e;t=t.assignedSlot||t.parentNode)if(t.nodeType==1&&t.contentEditable=="false")return!0;return!1}function Nd(n,e){let t=!1;return e&&n.iterChangedRanges((i,s)=>{i<e.to&&s>e.from&&(t=!0)}),t}class rr extends yt{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return e.className="cm-gap",this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get editable(){return!0}get estimatedHeight(){return this.height}ignoreEvent(){return!1}}function Wd(n,e,t=1){let i=n.charCategorizer(e),s=n.doc.lineAt(e),r=e-s.from;if(s.length==0)return x.cursor(e);r==0?t=1:r==s.length&&(t=-1);let o=r,l=r;t<0?o=ne(s.text,r,!1):l=ne(s.text,r);let a=i(s.text.slice(o,l));for(;o>0;){let h=ne(s.text,o,!1);if(i(s.text.slice(h,o))!=a)break;o=h}for(;l<s.length;){let h=ne(s.text,l);if(i(s.text.slice(l,h))!=a)break;l=h}return x.range(o+s.from,l+s.from)}function Fd(n,e,t,i,s){let r=Math.round((i-e.left)*n.defaultCharacterWidth);if(n.lineWrapping&&t.height>n.defaultLineHeight*1.5){let l=n.viewState.heightOracle.textHeight,a=Math.floor((s-t.top-(n.defaultLineHeight-l)*.5)/l);r+=a*n.viewState.heightOracle.lineLength}let o=n.state.sliceDoc(t.from,t.to);return t.from+ro(o,r,n.state.tabSize)}function xo(n,e,t){let i=n.lineBlockAt(e);if(Array.isArray(i.type)){let s;for(let r of i.type){if(r.from>e)break;if(!(r.to<e)){if(r.from<e&&r.to>e)return r;(!s||r.type==le.Text&&(s.type!=r.type||(t<0?r.from<e:r.to>e)))&&(s=r)}}return s||i}return i}function Hd(n,e,t,i){let s=xo(n,e.head,e.assoc||-1),r=!i||s.type!=le.Text||!(n.lineWrapping||s.widgetLineBreaks)?null:n.coordsAtPos(e.assoc<0&&e.head>s.from?e.head-1:e.head);if(r){let o=n.dom.getBoundingClientRect(),l=n.textDirectionAt(s.from),a=n.posAtCoords({x:t==(l==j.LTR)?o.right-1:o.left+1,y:(r.top+r.bottom)/2});if(a!=null)return x.cursor(a,t?-1:1)}return x.cursor(t?s.to:s.from,t?-1:1)}function Gl(n,e,t,i){let s=n.state.doc.lineAt(e.head),r=n.bidiSpans(s),o=n.textDirectionAt(s.from);for(let l=e,a=null;;){let h=dd(s,r,o,l,t),c=sc;if(!h){if(s.number==(t?n.state.doc.lines:1))return l;c=` 8 + `,s=n.state.doc.line(s.number+(t?1:-1)),r=n.bidiSpans(s),h=n.visualLineSide(s,!t)}if(a){if(!a(c))return l}else{if(!i)return h;a=i(c)}l=h}}function Vd(n,e,t){let i=n.state.charCategorizer(e),s=i(t);return r=>{let o=i(r);return s==Q.Space&&(s=o),s==o}}function zd(n,e,t,i){let s=e.head,r=t?1:-1;if(s==(t?n.state.doc.length:0))return x.cursor(s,e.assoc);let o=e.goalColumn,l,a=n.contentDOM.getBoundingClientRect(),h=n.coordsAtPos(s,(e.empty?e.assoc:0)||(t?1:-1)),c=n.documentTop;if(h)o==null&&(o=h.left-a.left),l=r<0?h.top:h.bottom;else{let p=n.viewState.lineBlockAt(s);o==null&&(o=Math.min(a.right-a.left,n.defaultCharacterWidth*(s-p.from))),l=(r<0?p.top:p.bottom)+c}let f=a.left+o,u=i??n.viewState.heightOracle.textHeight>>1,d=ko(n,{x:f,y:l+u*r},!1,r);return x.cursor(d.pos,d.assoc,void 0,o)}function Gi(n,e,t){for(;;){let i=0;for(let s of n)s.between(e-1,e+1,(r,o,l)=>{if(e>r&&e<o){let a=i||t||(e-r<o-e?-1:1);e=a<0?r:o,i=a}});if(!i)return e}}function wc(n,e){let t=null;for(let i=0;i<e.ranges.length;i++){let s=e.ranges[i],r=null;if(s.empty){let o=Gi(n,s.from,0);o!=s.from&&(r=x.cursor(o,-1))}else{let o=Gi(n,s.from,-1),l=Gi(n,s.to,1);(o!=s.from||l!=s.to)&&(r=x.range(s.from==s.anchor?o:l,s.from==s.head?o:l))}r&&(t||(t=e.ranges.slice()),t[i]=r)}return t?x.create(t,e.mainIndex):e}function or(n,e,t){let i=Gi(n.state.facet(gn).map(s=>s(n)),t.from,e.head>t.from?-1:1);return i==t.from?t:x.cursor(i,i<t.from?1:-1)}class it{constructor(e,t){this.pos=e,this.assoc=t}}function ko(n,e,t,i){let s=n.contentDOM.getBoundingClientRect(),r=s.top+n.viewState.paddingTop,{x:o,y:l}=e,a=l-r,h;for(;;){if(a<0)return new it(0,1);if(a>n.viewState.docHeight)return new it(n.state.doc.length,-1);if(h=n.elementAtHeight(a),i==null)break;if(h.type==le.Text){if(i<0?h.to<n.viewport.from:h.from>n.viewport.to)break;let u=n.docView.coordsAt(i<0?h.from:h.to,i>0?-1:1);if(u&&(i<0?u.top<=a+r:u.bottom>=a+r))break}let f=n.viewState.heightOracle.textHeight/2;a=i>0?h.bottom+f:h.top-f}if(n.viewport.from>=h.to||n.viewport.to<=h.from){if(t)return null;if(h.type==le.Text){let f=Fd(n,s,h,o,l);return new it(f,f==h.from?1:-1)}}if(h.type!=le.Text)return a<(h.top+h.bottom)/2?new it(h.from,1):new it(h.to,-1);let c=n.docView.lineAt(h.from,2);return(!c||c.length!=h.length)&&(c=n.docView.lineAt(h.from,-2)),new $d(n,o,l,n.textDirectionAt(h.from)).scanTile(c,h.from)}class $d{constructor(e,t,i,s){this.view=e,this.x=t,this.y=i,this.baseDir=s,this.line=null,this.spans=null}bidiSpansAt(e){return(!this.line||this.line.from>e||this.line.to<e)&&(this.line=this.view.state.doc.lineAt(e),this.spans=this.view.bidiSpans(this.line)),this}baseDirAt(e,t){let{line:i,spans:s}=this.bidiSpansAt(e);return s[nt.find(s,e-i.from,-1,t)].level==this.baseDir}dirAt(e,t){let{line:i,spans:s}=this.bidiSpansAt(e);return s[nt.find(s,e-i.from,-1,t)].dir}bidiIn(e,t){let{spans:i,line:s}=this.bidiSpansAt(e);return i.length>1||i.length&&(i[0].level!=this.baseDir||i[0].to+s.from<t)}scan(e,t){let i=0,s=e.length-1,r=new Set,o=this.bidiIn(e[0],e[s]),l,a,h=-1,c=1e9,f;e:for(;i<s;){let d=s-i,p=i+s>>1;t:if(r.has(p)){let b=i+Math.floor(Math.random()*d);for(let y=0;y<d;y++){if(!r.has(b)){p=b;break t}b++,b==s&&(b=i)}break e}r.add(p);let m=t(p);if(m)for(let b=0;b<m.length;b++){let y=m[b],w=0;if(y.bottom<this.y)(!l||l.bottom<y.bottom)&&(l=y),w=1;else if(y.top>this.y)(!a||a.top>y.top)&&(a=y),w=-1;else{let k=y.left>this.x?this.x-y.left:y.right<this.x?this.x-y.right:0,D=Math.abs(k);D<c&&(h=p,c=D,f=y),k&&(w=k<0==(this.baseDir==j.LTR)?-1:1)}w==-1&&(!o||this.baseDirAt(e[p],1))?s=p:w==1&&(!o||this.baseDirAt(e[p+1],-1))&&(i=p+1)}}if(!f){let d=l&&(!a||this.y-l.bottom<a.top-this.y)?l:a;return this.y=(d.top+d.bottom)/2,this.scan(e,t)}let u=(o?this.dirAt(e[h],1):this.baseDir)==j.LTR;return{i:h,after:this.x>(f.left+f.right)/2==u}}scanText(e,t){let i=[];for(let r=0;r<e.length;r=ne(e.text,r))i.push(t+r);i.push(t+e.length);let s=this.scan(i,r=>{let o=i[r]-t,l=i[r+1]-t;return tn(e.dom,o,l).getClientRects()});return s.after?new it(i[s.i+1],-1):new it(i[s.i],1)}scanTile(e,t){if(!e.length)return new it(t,1);if(e.children.length==1){let l=e.children[0];if(l.isText())return this.scanText(l,t);if(l.isComposite())return this.scanTile(l,t)}let i=[t];for(let l=0,a=t;l<e.children.length;l++)i.push(a+=e.children[l].length);let s=this.scan(i,l=>{let a=e.children[l];return a.flags&48?null:(a.dom.nodeType==1?a.dom:tn(a.dom,0,a.length)).getClientRects()}),r=e.children[s.i],o=i[s.i];return r.isText()?this.scanText(r,o):r.isComposite()?this.scanTile(r,o):s.after?new it(i[s.i+1],-1):new it(o,1)}}const li="￿";class qd{constructor(e,t){this.points=e,this.view=t,this.text="",this.lineSeparator=t.state.facet(H.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=li}readRange(e,t){if(!e)return this;let i=e.parentNode;for(let s=e;;){this.findPointBefore(i,s);let r=this.text.length;this.readNode(s);let o=_.get(s),l=s.nextSibling;if(l==t){o?.breakAfter&&!l&&i!=this.view.contentDOM&&this.lineBreak();break}let a=_.get(l);(o&&a?o.breakAfter:(o?o.breakAfter:us(s))||us(l)&&(s.nodeName!="BR"||o?.isWidget())&&this.text.length>r)&&!jd(l,t)&&this.lineBreak(),s=l}return this.findPointBefore(i,t),this}readTextNode(e){let t=e.nodeValue;for(let i of this.points)i.node==e&&(i.pos=this.text.length+Math.min(i.offset,t.length));for(let i=0,s=this.lineSeparator?null:/\r\n?|\n/g;;){let r=-1,o=1,l;if(this.lineSeparator?(r=t.indexOf(this.lineSeparator,i),o=this.lineSeparator.length):(l=s.exec(t))&&(r=l.index,o=l[0].length),this.append(t.slice(i,r<0?t.length:r)),r<0)break;if(this.lineBreak(),o>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=o-1);i=r+o}}readNode(e){let t=_.get(e),i=t&&t.overrideDOMText;if(i!=null){this.findPointInside(e,i.length);for(let s=i.iter();!s.next().done;)s.lineBreak?this.lineBreak():this.append(s.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,t){for(let i of this.points)i.node==e&&e.childNodes[i.offset]==t&&(i.pos=this.text.length)}findPointInside(e,t){for(let i of this.points)(e.nodeType==3?i.node==e:e.contains(i.node))&&(i.pos=this.text.length+(Kd(e,i.node,i.offset)?t:0))}}function Kd(n,e,t){for(;;){if(!e||t<gt(e))return!1;if(e==n)return!0;t=Rt(e)+1,e=e.parentNode}}function jd(n,e){let t;for(;!(n==e||!n);n=n.nextSibling){let i=_.get(n);if(!i?.isWidget())return!1;i&&(t||(t=[])).push(i)}if(t)for(let i of t){let s=i.overrideDOMText;if(s?.length)return!1}return!0}class Ql{constructor(e,t){this.node=e,this.offset=t,this.pos=-1}}class Ud{constructor(e,t,i,s){this.typeOver=s,this.bounds=null,this.text="",this.domChanged=t>-1;let{impreciseHead:r,impreciseAnchor:o}=e.docView;if(e.state.readOnly&&t>-1)this.newSel=null;else if(t>-1&&(this.bounds=vc(e.docView.tile,t,i,0))){let l=r||o?[]:Qd(e),a=new qd(l,e);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=Yd(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=r&&r.node==l.focusNode&&r.offset==l.focusOffset||!uo(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),h=o&&o.node==l.anchorNode&&o.offset==l.anchorOffset||!uo(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset),c=e.viewport;if((M.ios||M.chrome)&&e.state.selection.main.empty&&a!=h&&(c.from>0||c.to<e.state.doc.length)){let f=Math.min(a,h),u=Math.max(a,h),d=c.from-f,p=c.to-u;(d==0||d==1||f==0)&&(p==0||p==-1||u==e.state.doc.length)&&(a=0,h=e.state.doc.length)}e.inputState.composing>-1&&e.state.selection.ranges.length>1?this.newSel=e.state.selection.replaceRange(x.range(h,a)):this.newSel=x.single(h,a)}}}function vc(n,e,t,i){if(n.isComposite()){let s=-1,r=-1,o=-1,l=-1;for(let a=0,h=i,c=i;a<n.children.length;a++){let f=n.children[a],u=h+f.length;if(h<e&&u>t)return vc(f,e,t,h);if(u>=e&&s==-1&&(s=a,r=h),h>t&&f.dom.parentNode==n.dom){o=a,l=c;break}c=u,h=u+f.breakAfter}return{from:r,to:l<0?i+n.length:l,startDOM:(s?n.children[s-1].dom.nextSibling:null)||n.dom.firstChild,endDOM:o<n.children.length&&o>=0?n.children[o].dom:null}}else return n.isText()?{from:i,to:i+n.length,startDOM:n.dom,endDOM:n.dom.nextSibling}:null}function Sc(n,e){let t,{newSel:i}=e,{state:s}=n,r=s.selection.main,o=n.inputState.lastKeyTime>Date.now()-100?n.inputState.lastKeyCode:-1;if(e.bounds){let{from:l,to:a}=e.bounds,h=r.from,c=null;(o===8||M.android&&e.text.length<a-l)&&(h=r.to,c="end");let f=s.doc.sliceString(l,a,li),u,d;!r.empty&&r.from>=l&&r.to<=a&&(e.typeOver||f!=e.text)&&f.slice(0,r.from-l)==e.text.slice(0,r.from-l)&&f.slice(r.to-l)==e.text.slice(u=e.text.length-(f.length-(r.to-l)))?t={from:r.from,to:r.to,insert:F.of(e.text.slice(r.from-l,u).split(li))}:(d=Cc(f,e.text,h-l,c))&&(M.chrome&&o==13&&d.toB==d.from+2&&e.text.slice(d.from,d.toB)==li+li&&d.toB--,t={from:l+d.from,to:l+d.toA,insert:F.of(e.text.slice(d.from,d.toB).split(li))})}else i&&(!n.hasFocus&&s.facet(ut)||bs(i,r))&&(i=null);if(!t&&!i)return!1;if((M.mac||M.android)&&t&&t.from==t.to&&t.from==r.head-1&&/^\. ?$/.test(t.insert.toString())&&n.contentDOM.getAttribute("autocorrect")=="off"?(i&&t.insert.length==2&&(i=x.single(i.main.anchor-1,i.main.head-1)),t={from:t.from,to:t.to,insert:F.of([t.insert.toString().replace("."," ")])}):s.doc.lineAt(r.from).to<r.to&&n.docView.lineHasWidget(r.to)&&n.inputState.insertingTextAt>Date.now()-50?t={from:r.from,to:r.to,insert:s.toText(n.inputState.insertingText)}:M.chrome&&t&&t.from==t.to&&t.from==r.head&&t.insert.toString()==` 9 + `&&n.lineWrapping&&(i&&(i=x.single(i.main.anchor-1,i.main.head-1)),t={from:r.from,to:r.to,insert:F.of([" "])}),t)return Zo(n,t,i,o);if(i&&!bs(i,r)){let l=!1,a="select";return n.inputState.lastSelectionTime>Date.now()-50&&(n.inputState.lastSelectionOrigin=="select"&&(l=!0),a=n.inputState.lastSelectionOrigin,a=="select.pointer"&&(i=wc(s.facet(gn).map(h=>h(n)),i))),n.dispatch({selection:i,scrollIntoView:l,userEvent:a}),!0}else return!1}function Zo(n,e,t,i=-1){if(M.ios&&n.inputState.flushIOSKey(e))return!0;let s=n.state.selection.main;if(M.android&&(e.to==s.to&&(e.from==s.from||e.from==s.from-1&&n.state.sliceDoc(e.from,s.from)==" ")&&e.insert.length==1&&e.insert.lines==2&&yi(n.contentDOM,"Enter",13)||(e.from==s.from-1&&e.to==s.to&&e.insert.length==0||i==8&&e.insert.length<e.to-e.from&&e.to>s.head)&&yi(n.contentDOM,"Backspace",8)||e.from==s.from&&e.to==s.to+1&&e.insert.length==0&&yi(n.contentDOM,"Delete",46)))return!0;let r=e.insert.toString();n.inputState.composing>=0&&n.inputState.composing++;let o,l=()=>o||(o=Gd(n,e,t));return n.state.facet(hc).some(a=>a(n,e.from,e.to,r,l))||n.dispatch(l()),!0}function Gd(n,e,t){let i,s=n.state,r=s.selection.main,o=-1;if(e.from==e.to&&e.from<r.from||e.from>r.to){let a=e.from<r.from?-1:1,h=a<0?r.from:r.to,c=Gi(s.facet(gn).map(f=>f(n)),h,a);e.from==c&&(o=c)}if(o>-1)i={changes:e,selection:x.cursor(e.from+e.insert.length,-1)};else if(e.from>=r.from&&e.to<=r.to&&e.to-e.from>=(r.to-r.from)/3&&(!t||t.main.empty&&t.main.from==e.from+e.insert.length)&&n.inputState.composing<0){let a=r.from<e.from?s.sliceDoc(r.from,e.from):"",h=r.to>e.to?s.sliceDoc(e.to,r.to):"";i=s.replaceSelection(n.state.toText(a+e.insert.sliceString(0,void 0,n.state.lineBreak)+h))}else{let a=s.changes(e),h=t&&t.main.to<=a.newLength?t.main:void 0;if(s.selection.ranges.length>1&&(n.inputState.composing>=0||n.inputState.compositionPendingChange)&&e.to<=r.to+10&&e.to>=r.to-10){let c=n.state.sliceDoc(e.from,e.to),f,u=t&&kc(n,t.main.head);if(u){let p=e.insert.length-(e.to-e.from);f={from:u.from,to:u.to-p}}else f=n.state.doc.lineAt(r.head);let d=r.to-e.to;i=s.changeByRange(p=>{if(p.from==r.from&&p.to==r.to)return{changes:a,range:h||p.map(a)};let m=p.to-d,b=m-c.length;if(n.state.sliceDoc(b,m)!=c||m>=f.from&&b<=f.to)return{range:p};let y=s.changes({from:b,to:m,insert:e.insert}),w=p.to-r.to;return{changes:y,range:h?x.range(Math.max(0,h.anchor+w),Math.max(0,h.head+w)):p.map(y)}})}else i={changes:a,selection:h&&s.selection.replaceRange(h)}}let l="input.type";return(n.composing||n.inputState.compositionPendingChange&&n.inputState.compositionEndedAt>Date.now()-50)&&(n.inputState.compositionPendingChange=!1,l+=".compose",n.inputState.compositionFirstChange&&(l+=".start",n.inputState.compositionFirstChange=!1)),s.update(i,{userEvent:l,scrollIntoView:!0})}function Cc(n,e,t,i){let s=Math.min(n.length,e.length),r=0;for(;r<s&&n.charCodeAt(r)==e.charCodeAt(r);)r++;if(r==s&&n.length==e.length)return null;let o=n.length,l=e.length;for(;o>0&&l>0&&n.charCodeAt(o-1)==e.charCodeAt(l-1);)o--,l--;if(i=="end"){let a=Math.max(0,r-Math.min(o,l));t-=o+a-r}if(o<r&&n.length<e.length){let a=t<=r&&t>=o?r-t:0;r-=a,l=r+(l-o),o=r}else if(l<r){let a=t<=r&&t>=l?r-t:0;r-=a,o=r+(o-l),l=r}return{from:r,toA:o,toB:l}}function Qd(n){let e=[];if(n.root.activeElement!=n.contentDOM)return e;let{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}=n.observer.selectionRange;return t&&(e.push(new Ql(t,i)),(s!=t||r!=i)&&e.push(new Ql(s,r))),e}function Yd(n,e){if(n.length==0)return null;let t=n[0].pos,i=n.length==2?n[1].pos:t;return t>-1&&i>-1?x.single(t+e,i+e):null}function bs(n,e){return e.head==n.main.head&&e.anchor==n.main.anchor}class _d{setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}constructor(e){this.view=e,this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.lastWheelEvent=0,this.pendingIOSKey=void 0,this.tabFocusMode=-1,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastContextMenu=0,this.scrollHandlers=[],this.handlers=Object.create(null),this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.insertingText="",this.insertingTextAt=0,this.mouseSelection=null,this.draggedContent=null,this.handleEvent=this.handleEvent.bind(this),this.notifiedFocused=e.hasFocus,M.safari&&e.contentDOM.addEventListener("input",()=>null),M.gecko&&fp(e.contentDOM.ownerDocument)}handleEvent(e){!sp(this.view,e)||this.ignoreDuringComposition(e)||e.type=="keydown"&&this.keydown(e)||(this.view.updateState!=0?Promise.resolve().then(()=>this.runHandlers(e.type,e)):this.runHandlers(e.type,e))}runHandlers(e,t){let i=this.handlers[e];if(i){for(let s of i.observers)s(this.view,t);for(let s of i.handlers){if(t.defaultPrevented)break;if(s(this.view,t)){t.preventDefault();break}}}}ensureHandlers(e){let t=Xd(e),i=this.handlers,s=this.view.contentDOM;for(let r in t)if(r!="scroll"){let o=!t[r].handlers.length,l=i[r];l&&o!=!l.handlers.length&&(s.removeEventListener(r,this.handleEvent),l=null),l||s.addEventListener(r,this.handleEvent,{passive:o})}for(let r in i)r!="scroll"&&!t[r]&&s.removeEventListener(r,this.handleEvent);this.handlers=t}keydown(e){if(this.lastKeyCode=e.keyCode,this.lastKeyTime=Date.now(),e.keyCode==9&&this.tabFocusMode>-1&&(!this.tabFocusMode||Date.now()<=this.tabFocusMode))return!0;if(this.tabFocusMode>0&&e.keyCode!=27&&Mc.indexOf(e.keyCode)<0&&(this.tabFocusMode=-1),M.android&&M.chrome&&!e.synthetic&&(e.keyCode==13||e.keyCode==8))return this.view.observer.delayAndroidKey(e.key,e.keyCode),!0;let t;return M.ios&&!e.synthetic&&!e.altKey&&!e.metaKey&&((t=Ac.find(i=>i.keyCode==e.keyCode))&&!e.ctrlKey||Jd.indexOf(e.key)>-1&&e.ctrlKey&&!e.shiftKey)?(this.pendingIOSKey=t||e,setTimeout(()=>this.flushIOSKey(),250),!0):(e.keyCode!=229&&this.view.observer.forceFlush(),!1)}flushIOSKey(e){let t=this.pendingIOSKey;return!t||t.key=="Enter"&&e&&e.from<e.to&&/^\S+$/.test(e.insert.toString())?!1:(this.pendingIOSKey=void 0,yi(this.view.contentDOM,t.key,t.keyCode,t instanceof KeyboardEvent?t:void 0))}ignoreDuringComposition(e){return!/^key/.test(e.type)||e.synthetic?!1:this.composing>0?!0:M.safari&&!M.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.view.observer.update(e),this.mouseSelection&&this.mouseSelection.update(e),this.draggedContent&&e.docChanged&&(this.draggedContent=this.draggedContent.map(e.changes)),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}}function Yl(n,e){return(t,i)=>{try{return e.call(n,i,t)}catch(s){ge(t.state,s)}}}function Xd(n){let e=Object.create(null);function t(i){return e[i]||(e[i]={observers:[],handlers:[]})}for(let i of n){let s=i.spec,r=s&&s.plugin.domEventHandlers,o=s&&s.plugin.domEventObservers;if(r)for(let l in r){let a=r[l];a&&t(l).handlers.push(Yl(i.value,a))}if(o)for(let l in o){let a=o[l];a&&t(l).observers.push(Yl(i.value,a))}}for(let i in qe)t(i).handlers.push(qe[i]);for(let i in we)t(i).observers.push(we[i]);return e}const Ac=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],Jd="dthko",Mc=[16,17,18,20,91,92,224,225],An=6;function Mn(n){return Math.max(0,n)*.7+8}function Zd(n,e){return Math.max(Math.abs(n.clientX-e.clientX),Math.abs(n.clientY-e.clientY))}class ep{constructor(e,t,i,s){this.view=e,this.startEvent=t,this.style=i,this.mustSelect=s,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=t,this.scrollParents=Yh(e.contentDOM),this.atoms=e.state.facet(gn).map(o=>o(e));let r=e.contentDOM.ownerDocument;r.addEventListener("mousemove",this.move=this.move.bind(this)),r.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=t.shiftKey,this.multiple=e.state.facet(H.allowMultipleSelections)&&tp(e,t),this.dragging=np(e,t)&&Dc(t)==1?null:!1}start(e){this.dragging===!1&&this.select(e)}move(e){if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&Zd(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let t=0,i=0,s=0,r=0,o=this.view.win.innerWidth,l=this.view.win.innerHeight;this.scrollParents.x&&({left:s,right:o}=this.scrollParents.x.getBoundingClientRect()),this.scrollParents.y&&({top:r,bottom:l}=this.scrollParents.y.getBoundingClientRect());let a=Jo(this.view);e.clientX-a.left<=s+An?t=-Mn(s-e.clientX):e.clientX+a.right>=o-An&&(t=Mn(e.clientX-o)),e.clientY-a.top<=r+An?i=-Mn(r-e.clientY):e.clientY+a.bottom>=l-An&&(i=Mn(e.clientY-l)),this.setScrollSpeed(t,i)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=this.view.inputState.draggedContent=null}setScrollSpeed(e,t){this.scrollSpeed={x:e,y:t},e||t?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){let{x:e,y:t}=this.scrollSpeed;e&&this.scrollParents.x&&(this.scrollParents.x.scrollLeft+=e,e=0),t&&this.scrollParents.y&&(this.scrollParents.y.scrollTop+=t,t=0),(e||t)&&this.view.win.scrollBy(e,t),this.dragging===!1&&this.select(this.lastEvent)}select(e){let{view:t}=this,i=wc(this.atoms,this.style.get(e,this.extend,this.multiple));(this.mustSelect||!i.eq(t.state.selection,this.dragging===!1))&&this.view.dispatch({selection:i,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.transactions.some(t=>t.isUserEvent("input.type"))?this.destroy():this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}}function tp(n,e){let t=n.state.facet(rc);return t.length?t[0](e):M.mac?e.metaKey:e.ctrlKey}function ip(n,e){let t=n.state.facet(oc);return t.length?t[0](e):M.mac?!e.altKey:!e.ctrlKey}function np(n,e){let{main:t}=n.state.selection;if(t.empty)return!1;let i=en(n.root);if(!i||i.rangeCount==0)return!0;let s=i.getRangeAt(0).getClientRects();for(let r=0;r<s.length;r++){let o=s[r];if(o.left<=e.clientX&&o.right>=e.clientX&&o.top<=e.clientY&&o.bottom>=e.clientY)return!0}return!1}function sp(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target,i;t!=n.contentDOM;t=t.parentNode)if(!t||t.nodeType==11||(i=_.get(t))&&i.isWidget()&&!i.isHidden&&i.widget.ignoreEvent(e))return!1;return!0}const qe=Object.create(null),we=Object.create(null),Tc=M.ie&&M.ie_version<15||M.ios&&M.webkit_version<604;function rp(n){let e=n.dom.parentNode;if(!e)return;let t=e.appendChild(document.createElement("textarea"));t.style.cssText="position: fixed; left: -10000px; top: 10px",t.focus(),setTimeout(()=>{n.focus(),t.remove(),Oc(n,t.value)},50)}function $s(n,e,t){for(let i of n.facet(e))t=i(t,n);return t}function Oc(n,e){e=$s(n.state,Qo,e);let{state:t}=n,i,s=1,r=t.toText(e),o=r.lines==t.selection.ranges.length;if(wo!=null&&t.selection.ranges.every(a=>a.empty)&&wo==r.toString()){let a=-1;i=t.changeByRange(h=>{let c=t.doc.lineAt(h.from);if(c.from==a)return{range:h};a=c.from;let f=t.toText((o?r.line(s++).text:e)+t.lineBreak);return{changes:{from:c.from,insert:f},range:x.cursor(h.from+f.length)}})}else o?i=t.changeByRange(a=>{let h=r.line(s++);return{changes:{from:a.from,to:a.to,insert:h.text},range:x.cursor(a.from+h.length)}}):i=t.replaceSelection(r);n.dispatch(i,{userEvent:"input.paste",scrollIntoView:!0})}we.scroll=n=>{n.inputState.lastScrollTop=n.scrollDOM.scrollTop,n.inputState.lastScrollLeft=n.scrollDOM.scrollLeft};we.wheel=we.mousewheel=n=>{n.inputState.lastWheelEvent=Date.now()};qe.keydown=(n,e)=>(n.inputState.setSelectionOrigin("select"),e.keyCode==27&&n.inputState.tabFocusMode!=0&&(n.inputState.tabFocusMode=Date.now()+2e3),!1);we.touchstart=(n,e)=>{n.inputState.lastTouchTime=Date.now(),n.inputState.setSelectionOrigin("select.pointer")};we.touchmove=n=>{n.inputState.setSelectionOrigin("select.pointer")};qe.mousedown=(n,e)=>{if(n.observer.flush(),n.inputState.lastTouchTime>Date.now()-2e3)return!1;let t=null;for(let i of n.state.facet(lc))if(t=i(n,e),t)break;if(!t&&e.button==0&&(t=lp(n,e)),t){let i=!n.hasFocus;n.inputState.startMouseSelection(new ep(n,e,t,i)),i&&n.observer.ignore(()=>{_h(n.contentDOM);let r=n.root.activeElement;r&&!r.contains(n.contentDOM)&&r.blur()});let s=n.inputState.mouseSelection;if(s)return s.start(e),s.dragging===!1}else n.inputState.setSelectionOrigin("select.pointer");return!1};function _l(n,e,t,i){if(i==1)return x.cursor(e,t);if(i==2)return Wd(n.state,e,t);{let s=n.docView.lineAt(e,t),r=n.state.doc.lineAt(s?s.posAtEnd:e),o=s?s.posAtStart:r.from,l=s?s.posAtEnd:r.to;return l<n.state.doc.length&&l==r.to&&l++,x.range(o,l)}}const op=M.ie&&M.ie_version<=11;let Xl=null,Jl=0,Zl=0;function Dc(n){if(!op)return n.detail;let e=Xl,t=Zl;return Xl=n,Zl=Date.now(),Jl=!e||t>Date.now()-400&&Math.abs(e.clientX-n.clientX)<2&&Math.abs(e.clientY-n.clientY)<2?(Jl+1)%3:1}function lp(n,e){let t=n.posAndSideAtCoords({x:e.clientX,y:e.clientY},!1),i=Dc(e),s=n.state.selection;return{update(r){r.docChanged&&(t.pos=r.changes.mapPos(t.pos),s=s.map(r.changes))},get(r,o,l){let a=n.posAndSideAtCoords({x:r.clientX,y:r.clientY},!1),h,c=_l(n,a.pos,a.assoc,i);if(t.pos!=a.pos&&!o){let f=_l(n,t.pos,t.assoc,i),u=Math.min(f.from,c.from),d=Math.max(f.to,c.to);c=u<c.from?x.range(u,d):x.range(d,u)}return o?s.replaceRange(s.main.extend(c.from,c.to)):l&&i==1&&s.ranges.length>1&&(h=ap(s,a.pos))?h:l?s.addRange(c):x.create([c])}}}function ap(n,e){for(let t=0;t<n.ranges.length;t++){let{from:i,to:s}=n.ranges[t];if(i<=e&&s>=e)return x.create(n.ranges.slice(0,t).concat(n.ranges.slice(t+1)),n.mainIndex==t?0:n.mainIndex-(n.mainIndex>t?1:0))}return null}qe.dragstart=(n,e)=>{let{selection:{main:t}}=n.state;if(e.target.draggable){let s=n.docView.tile.nearest(e.target);if(s&&s.isWidget()){let r=s.posAtStart,o=r+s.length;(r>=t.to||o<=t.from)&&(t=x.range(r,o))}}let{inputState:i}=n;return i.mouseSelection&&(i.mouseSelection.dragging=!0),i.draggedContent=t,e.dataTransfer&&(e.dataTransfer.setData("Text",$s(n.state,Yo,n.state.sliceDoc(t.from,t.to))),e.dataTransfer.effectAllowed="copyMove"),!1};qe.dragend=n=>(n.inputState.draggedContent=null,!1);function ea(n,e,t,i){if(t=$s(n.state,Qo,t),!t)return;let s=n.posAtCoords({x:e.clientX,y:e.clientY},!1),{draggedContent:r}=n.inputState,o=i&&r&&ip(n,e)?{from:r.from,to:r.to}:null,l={from:s,insert:t},a=n.state.changes(o?[o,l]:l);n.focus(),n.dispatch({changes:a,selection:{anchor:a.mapPos(s,-1),head:a.mapPos(s,1)},userEvent:o?"move.drop":"input.drop"}),n.inputState.draggedContent=null}qe.drop=(n,e)=>{if(!e.dataTransfer)return!1;if(n.state.readOnly)return!0;let t=e.dataTransfer.files;if(t&&t.length){let i=Array(t.length),s=0,r=()=>{++s==t.length&&ea(n,e,i.filter(o=>o!=null).join(n.state.lineBreak),!1)};for(let o=0;o<t.length;o++){let l=new FileReader;l.onerror=r,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(i[o]=l.result),r()},l.readAsText(t[o])}return!0}else{let i=e.dataTransfer.getData("Text");if(i)return ea(n,e,i,!0),!0}return!1};qe.paste=(n,e)=>{if(n.state.readOnly)return!0;n.observer.flush();let t=Tc?null:e.clipboardData;return t?(Oc(n,t.getData("text/plain")||t.getData("text/uri-list")),!0):(rp(n),!1)};function hp(n,e){let t=n.dom.parentNode;if(!t)return;let i=t.appendChild(document.createElement("textarea"));i.style.cssText="position: fixed; left: -10000px; top: 10px",i.value=e,i.focus(),i.selectionEnd=e.length,i.selectionStart=0,setTimeout(()=>{i.remove(),n.focus()},50)}function cp(n){let e=[],t=[],i=!1;for(let s of n.selection.ranges)s.empty||(e.push(n.sliceDoc(s.from,s.to)),t.push(s));if(!e.length){let s=-1;for(let{from:r}of n.selection.ranges){let o=n.doc.lineAt(r);o.number>s&&(e.push(o.text),t.push({from:o.from,to:Math.min(n.doc.length,o.to+1)})),s=o.number}i=!0}return{text:$s(n,Yo,e.join(n.lineBreak)),ranges:t,linewise:i}}let wo=null;qe.copy=qe.cut=(n,e)=>{if(!ji(n.contentDOM,n.observer.selectionRange))return!1;let{text:t,ranges:i,linewise:s}=cp(n.state);if(!t&&!s)return!1;wo=s?t:null,e.type=="cut"&&!n.state.readOnly&&n.dispatch({changes:i,scrollIntoView:!0,userEvent:"delete.cut"});let r=Tc?null:e.clipboardData;return r?(r.clearData(),r.setData("text/plain",t),!0):(hp(n,t),!1)};const Rc=bt.define();function Bc(n,e){let t=[];for(let i of n.facet(cc)){let s=i(n,e);s&&t.push(s)}return t.length?n.update({effects:t,annotations:Rc.of(!0)}):null}function Pc(n){setTimeout(()=>{let e=n.hasFocus;if(e!=n.inputState.notifiedFocused){let t=Bc(n.state,e);t?n.dispatch(t):n.update([])}},10)}we.focus=n=>{n.inputState.lastFocusTime=Date.now(),!n.scrollDOM.scrollTop&&(n.inputState.lastScrollTop||n.inputState.lastScrollLeft)&&(n.scrollDOM.scrollTop=n.inputState.lastScrollTop,n.scrollDOM.scrollLeft=n.inputState.lastScrollLeft),Pc(n)};we.blur=n=>{n.observer.clearSelectionRange(),Pc(n)};we.compositionstart=we.compositionupdate=n=>{n.observer.editContext||(n.inputState.compositionFirstChange==null&&(n.inputState.compositionFirstChange=!0),n.inputState.composing<0&&(n.inputState.composing=0))};we.compositionend=n=>{n.observer.editContext||(n.inputState.composing=-1,n.inputState.compositionEndedAt=Date.now(),n.inputState.compositionPendingKey=!0,n.inputState.compositionPendingChange=n.observer.pendingRecords().length>0,n.inputState.compositionFirstChange=null,M.chrome&&M.android?n.observer.flushSoon():n.inputState.compositionPendingChange?Promise.resolve().then(()=>n.observer.flush()):setTimeout(()=>{n.inputState.composing<0&&n.docView.hasComposition&&n.update([])},50))};we.contextmenu=n=>{n.inputState.lastContextMenu=Date.now()};qe.beforeinput=(n,e)=>{var t,i;if((e.inputType=="insertText"||e.inputType=="insertCompositionText")&&(n.inputState.insertingText=e.data,n.inputState.insertingTextAt=Date.now()),e.inputType=="insertReplacementText"&&n.observer.editContext){let r=(t=e.dataTransfer)===null||t===void 0?void 0:t.getData("text/plain"),o=e.getTargetRanges();if(r&&o.length){let l=o[0],a=n.posAtDOM(l.startContainer,l.startOffset),h=n.posAtDOM(l.endContainer,l.endOffset);return Zo(n,{from:a,to:h,insert:n.state.toText(r)},null),!0}}let s;if(M.chrome&&M.android&&(s=Ac.find(r=>r.inputType==e.inputType))&&(n.observer.delayAndroidKey(s.key,s.keyCode),s.key=="Backspace"||s.key=="Delete")){let r=((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0;setTimeout(()=>{var o;(((o=window.visualViewport)===null||o===void 0?void 0:o.height)||0)>r+10&&n.hasFocus&&(n.contentDOM.blur(),n.focus())},100)}return M.ios&&e.inputType=="deleteContentForward"&&n.observer.flushSoon(),M.safari&&e.inputType=="insertText"&&n.inputState.composing>=0&&setTimeout(()=>we.compositionend(n,e),20),!1};const ta=new Set;function fp(n){ta.has(n)||(ta.add(n),n.addEventListener("copy",()=>{}),n.addEventListener("cut",()=>{}))}const ia=["pre-wrap","normal","pre-line","break-spaces"];let Mi=!1;function na(){Mi=!1}class up{constructor(e){this.lineWrapping=e,this.doc=F.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30}heightForGap(e,t){let i=this.doc.lineAt(t).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(i+=Math.max(0,Math.ceil((t-e-i*this.lineLength*.5)/this.lineLength))),this.lineHeight*i}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/Math.max(1,this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return ia.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let t=!1;for(let i=0;i<e.length;i++){let s=e[i];s<0?i++:this.heightSamples[Math.floor(s*10)]||(t=!0,this.heightSamples[Math.floor(s*10)]=!0)}return t}refresh(e,t,i,s,r,o){let l=ia.indexOf(e)>-1,a=Math.abs(t-this.lineHeight)>.3||this.lineWrapping!=l||Math.abs(i-this.charWidth)>.1;if(this.lineWrapping=l,this.lineHeight=t,this.charWidth=i,this.textHeight=s,this.lineLength=r,a){this.heightSamples={};for(let h=0;h<o.length;h++){let c=o[h];c<0?h++:this.heightSamples[Math.floor(c*10)]=!0}}return a}}class dp{constructor(e,t){this.from=e,this.heights=t,this.index=0}get more(){return this.index<this.heights.length}}class Ve{constructor(e,t,i,s,r){this.from=e,this.length=t,this.top=i,this.height=s,this._content=r}get type(){return typeof this._content=="number"?le.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Zt?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let t=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new Ve(this.from,this.length+e.length,this.top,this.height+e.height,t)}}var G=(function(n){return n[n.ByPos=0]="ByPos",n[n.ByHeight=1]="ByHeight",n[n.ByPosNoHeight=2]="ByPosNoHeight",n})(G||(G={}));const is=.001;class me{constructor(e,t,i=2){this.length=e,this.height=t,this.flags=i}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e){this.height!=e&&(Math.abs(this.height-e)>is&&(Mi=!0),this.height=e)}replace(e,t,i){return me.of(i)}decomposeLeft(e,t){t.push(this)}decomposeRight(e,t){t.push(this)}applyChanges(e,t,i,s){let r=this,o=i.doc;for(let l=s.length-1;l>=0;l--){let{fromA:a,toA:h,fromB:c,toB:f}=s[l],u=r.lineAt(a,G.ByPosNoHeight,i.setDoc(t),0,0),d=u.to>=h?u:r.lineAt(h,G.ByPosNoHeight,i,0,0);for(f+=d.to-h,h=d.to;l>0&&u.from<=s[l-1].toA;)a=s[l-1].fromA,c=s[l-1].fromB,l--,a<u.from&&(u=r.lineAt(a,G.ByPosNoHeight,i,0,0));c+=u.from-a,a=u.from;let p=el.build(i.setDoc(o),e,c,f);r=ys(r,r.replace(a,h,p))}return r.updateHeight(i,0)}static empty(){return new Me(0,0,0)}static of(e){if(e.length==1)return e[0];let t=0,i=e.length,s=0,r=0;for(;;)if(t==i)if(s>r*2){let l=e[t-1];l.break?e.splice(--t,1,l.left,null,l.right):e.splice(--t,1,l.left,l.right),i+=1+l.break,s-=l.size}else if(r>s*2){let l=e[i];l.break?e.splice(i,1,l.left,null,l.right):e.splice(i,1,l.left,l.right),i+=2+l.break,r-=l.size}else break;else if(s<r){let l=e[t++];l&&(s+=l.size)}else{let l=e[--i];l&&(r+=l.size)}let o=0;return e[t-1]==null?(o=1,t--):e[t]==null&&(o=1,i++),new gp(me.of(e.slice(0,t)),o,me.of(e.slice(i)))}}function ys(n,e){return n==e?n:(n.constructor!=e.constructor&&(Mi=!0),e)}me.prototype.size=1;const pp=B.replace({});class Lc extends me{constructor(e,t,i){super(e,t),this.deco=i,this.spaceAbove=0}mainBlock(e,t){return new Ve(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.deco||0)}blockAt(e,t,i,s){return this.spaceAbove&&e<i+this.spaceAbove?new Ve(s,0,i,this.spaceAbove,pp):this.mainBlock(i,s)}lineAt(e,t,i,s,r){let o=this.mainBlock(s,r);return this.spaceAbove?this.blockAt(0,i,s,r).join(o):o}forEachLine(e,t,i,s,r,o){e<=r+this.length&&t>=r&&o(this.lineAt(0,G.ByPos,i,s,r))}setMeasuredHeight(e){let t=e.heights[e.index++];t<0?(this.spaceAbove=-t,t=e.heights[e.index++]):this.spaceAbove=0,this.setHeight(t)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more&&this.setMeasuredHeight(s),this.outdated=!1,this}toString(){return`block(${this.length})`}}class Me extends Lc{constructor(e,t,i){super(e,t,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0,this.spaceAbove=i}mainBlock(e,t){return new Ve(t,this.length,e+this.spaceAbove,this.height-this.spaceAbove,this.breaks)}replace(e,t,i){let s=i[0];return i.length==1&&(s instanceof Me||s instanceof re&&s.flags&4)&&Math.abs(this.length-s.length)<10?(s instanceof re?s=new Me(s.length,this.height,this.spaceAbove):s.height=this.height,this.outdated||(s.outdated=!1),s):me.of(i)}updateHeight(e,t=0,i=!1,s){return s&&s.from<=t&&s.more?this.setMeasuredHeight(s):(i||this.outdated)&&(this.spaceAbove=0,this.setHeight(Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight)),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}}class re extends me{constructor(e){super(e,0)}heightMetrics(e,t){let i=e.doc.lineAt(t).number,s=e.doc.lineAt(t+this.length).number,r=s-i+1,o,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*r);o=a/r,this.length>r+1&&(l=(this.height-a)/(this.length-r-1))}else o=this.height/r;return{firstLine:i,lastLine:s,perLine:o,perChar:l}}blockAt(e,t,i,s){let{firstLine:r,lastLine:o,perLine:l,perChar:a}=this.heightMetrics(t,s);if(t.lineWrapping){let h=s+(e<t.lineHeight?0:Math.round(Math.max(0,Math.min(1,(e-i)/this.height))*this.length)),c=t.doc.lineAt(h),f=l+c.length*a,u=Math.max(i,e-f/2);return new Ve(c.from,c.length,u,f,0)}else{let h=Math.max(0,Math.min(o-r,Math.floor((e-i)/l))),{from:c,length:f}=t.doc.line(r+h);return new Ve(c,f,i+l*h,l,0)}}lineAt(e,t,i,s,r){if(t==G.ByHeight)return this.blockAt(e,i,s,r);if(t==G.ByPosNoHeight){let{from:d,to:p}=i.doc.lineAt(e);return new Ve(d,p-d,0,0,0)}let{firstLine:o,perLine:l,perChar:a}=this.heightMetrics(i,r),h=i.doc.lineAt(e),c=l+h.length*a,f=h.number-o,u=s+l*f+a*(h.from-r-f);return new Ve(h.from,h.length,Math.max(s,Math.min(u,s+this.height-c)),c,0)}forEachLine(e,t,i,s,r,o){e=Math.max(e,r),t=Math.min(t,r+this.length);let{firstLine:l,perLine:a,perChar:h}=this.heightMetrics(i,r);for(let c=e,f=s;c<=t;){let u=i.doc.lineAt(c);if(c==e){let p=u.number-l;f+=a*p+h*(e-r-p)}let d=a+h*u.length;o(new Ve(u.from,u.length,f,d,0)),f+=d,c=u.to+1}}replace(e,t,i){let s=this.length-t;if(s>0){let r=i[i.length-1];r instanceof re?i[i.length-1]=new re(r.length+s):i.push(null,new re(s-1))}if(e>0){let r=i[0];r instanceof re?i[0]=new re(e+r.length):i.unshift(new re(e-1),null)}return me.of(i)}decomposeLeft(e,t){t.push(new re(e-1),null)}decomposeRight(e,t){t.push(null,new re(this.length-e-1))}updateHeight(e,t=0,i=!1,s){let r=t+this.length;if(s&&s.from<=t+this.length&&s.more){let o=[],l=Math.max(t,s.from),a=-1;for(s.from>t&&o.push(new re(s.from-t-1).updateHeight(e,t));l<=r&&s.more;){let c=e.doc.lineAt(l).length;o.length&&o.push(null);let f=s.heights[s.index++],u=0;f<0&&(u=-f,f=s.heights[s.index++]),a==-1?a=f:Math.abs(f-a)>=is&&(a=-2);let d=new Me(c,f,u);d.outdated=!1,o.push(d),l+=c+1}l<=r&&o.push(null,new re(r-l).updateHeight(e,l));let h=me.of(o);return(a<0||Math.abs(h.height-this.height)>=is||Math.abs(a-this.heightMetrics(e,t).perLine)>=is)&&(Mi=!0),ys(this,h)}else(i||this.outdated)&&(this.setHeight(e.heightForGap(t,t+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}}class gp extends me{constructor(e,t,i){super(e.length+t+i.length,e.height+i.height,t|(e.outdated||i.outdated?2:0)),this.left=e,this.right=i,this.size=e.size+i.size}get break(){return this.flags&1}blockAt(e,t,i,s){let r=i+this.left.height;return e<r?this.left.blockAt(e,t,i,s):this.right.blockAt(e,t,r,s+this.left.length+this.break)}lineAt(e,t,i,s,r){let o=s+this.left.height,l=r+this.left.length+this.break,a=t==G.ByHeight?e<o:e<l,h=a?this.left.lineAt(e,t,i,s,r):this.right.lineAt(e,t,i,o,l);if(this.break||(a?h.to<l:h.from>l))return h;let c=t==G.ByPosNoHeight?G.ByPosNoHeight:G.ByPos;return a?h.join(this.right.lineAt(l,c,i,o,l)):this.left.lineAt(l,c,i,s,r).join(h)}forEachLine(e,t,i,s,r,o){let l=s+this.left.height,a=r+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,t,i,s,r,o),t>=a&&this.right.forEachLine(e,t,i,l,a,o);else{let h=this.lineAt(a,G.ByPos,i,s,r);e<h.from&&this.left.forEachLine(e,h.from-1,i,s,r,o),h.to>=e&&h.from<=t&&o(h),t>h.to&&this.right.forEachLine(h.to+1,t,i,l,a,o)}}replace(e,t,i){let s=this.left.length+this.break;if(t<s)return this.balanced(this.left.replace(e,t,i),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-s,t-s,i));let r=[];e>0&&this.decomposeLeft(e,r);let o=r.length;for(let l of i)r.push(l);if(e>0&&sa(r,o-1),t<this.length){let l=r.length;this.decomposeRight(t,r),sa(r,l)}return me.of(r)}decomposeLeft(e,t){let i=this.left.length;if(e<=i)return this.left.decomposeLeft(e,t);t.push(this.left),this.break&&(i++,e>=i&&t.push(null)),e>i&&this.right.decomposeLeft(e-i,t)}decomposeRight(e,t){let i=this.left.length,s=i+this.break;if(e>=s)return this.right.decomposeRight(e-s,t);e<i&&this.left.decomposeRight(e,t),this.break&&e<s&&t.push(null),t.push(this.right)}balanced(e,t){return e.size>2*t.size||t.size>2*e.size?me.of(this.break?[e,null,t]:[e,t]):(this.left=ys(this.left,e),this.right=ys(this.right,t),this.setHeight(e.height+t.height),this.outdated=e.outdated||t.outdated,this.size=e.size+t.size,this.length=e.length+this.break+t.length,this)}updateHeight(e,t=0,i=!1,s){let{left:r,right:o}=this,l=t+r.length+this.break,a=null;return s&&s.from<=t+r.length&&s.more?a=r=r.updateHeight(e,t,i,s):r.updateHeight(e,t,i),s&&s.from<=l+o.length&&s.more?a=o=o.updateHeight(e,l,i,s):o.updateHeight(e,l,i),a?this.balanced(r,o):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}}function sa(n,e){let t,i;n[e]==null&&(t=n[e-1])instanceof re&&(i=n[e+1])instanceof re&&n.splice(e-1,3,new re(t.length+1+i.length))}const mp=5;class el{constructor(e,t){this.pos=e,this.oracle=t,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,t){if(this.lineStart>-1){let i=Math.min(t,this.lineEnd),s=this.nodes[this.nodes.length-1];s instanceof Me?s.length+=i-this.pos:(i>this.pos||!this.isCovered)&&this.nodes.push(new Me(i-this.pos,-1,0)),this.writtenTo=i,t>i&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=t}point(e,t,i){if(e<t||i.heightRelevant){let s=i.widget?i.widget.estimatedHeight:0,r=i.widget?i.widget.lineBreaks:0;s<0&&(s=this.oracle.lineHeight);let o=t-e;i.block?this.addBlock(new Lc(o,s,i)):(o||r||s>=mp)&&this.addLineDeco(s,r,o)}else t>e&&this.span(e,t);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:t}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=t,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Me(this.pos-e,-1,0)),this.writtenTo=this.pos}blankContent(e,t){let i=new re(t-e);return this.oracle.doc.lineAt(e).to==t&&(i.flags|=4),i}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Me)return e;let t=new Me(0,-1,0);return this.nodes.push(t),t}addBlock(e){this.enterLine();let t=e.deco;t&&t.startSide>0&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,t&&t.endSide>0&&(this.covering=e)}addLineDeco(e,t,i){let s=this.ensureLine();s.length+=i,s.collapsed+=i,s.widgetHeight=Math.max(s.widgetHeight,e),s.breaks+=t,this.writtenTo=this.pos=this.pos+i}finish(e){let t=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(t instanceof Me)&&!this.isCovered?this.nodes.push(new Me(0,-1,0)):(this.writtenTo<this.pos||t==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let i=e;for(let s of this.nodes)s instanceof Me&&s.updateHeight(this.oracle,i),i+=s?s.length:1;return this.nodes}static build(e,t,i,s){let r=new el(i,e);return N.spans(t,i,s,r,0),r.finish(i)}}function bp(n,e,t){let i=new yp;return N.compare(n,e,t,i,0),i.changes}class yp{constructor(){this.changes=[]}compareRange(){}comparePoint(e,t,i,s){(e<t||i&&i.heightRelevant||s&&s.heightRelevant)&&bi(e,t,this.changes,5)}}function xp(n,e){let t=n.getBoundingClientRect(),i=n.ownerDocument,s=i.defaultView||window,r=Math.max(0,t.left),o=Math.min(s.innerWidth,t.right),l=Math.max(0,t.top),a=Math.min(s.innerHeight,t.bottom);for(let h=n.parentNode;h&&h!=i.body;)if(h.nodeType==1){let c=h,f=window.getComputedStyle(c);if((c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let u=c.getBoundingClientRect();r=Math.max(r,u.left),o=Math.min(o,u.right),l=Math.max(l,u.top),a=Math.min(h==n.parentNode?s.innerHeight:a,u.bottom)}h=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(h.nodeType==11)h=h.host;else break;return{left:r-t.left,right:Math.max(r,o)-t.left,top:l-(t.top+e),bottom:Math.max(l,a)-(t.top+e)}}function kp(n){let e=n.getBoundingClientRect(),t=n.ownerDocument.defaultView||window;return e.left<t.innerWidth&&e.right>0&&e.top<t.innerHeight&&e.bottom>0}function wp(n,e){let t=n.getBoundingClientRect();return{left:0,right:t.right-t.left,top:e,bottom:t.bottom-(t.top+e)}}class lr{constructor(e,t,i,s){this.from=e,this.to=t,this.size=i,this.displaySize=s}static same(e,t){if(e.length!=t.length)return!1;for(let i=0;i<e.length;i++){let s=e[i],r=t[i];if(s.from!=r.from||s.to!=r.to||s.size!=r.size)return!1}return!0}draw(e,t){return B.replace({widget:new vp(this.displaySize*(t?e.scaleY:e.scaleX),t)}).range(this.from,this.to)}}class vp extends yt{constructor(e,t){super(),this.size=e,this.vertical=t}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}}class ra{constructor(e,t){this.view=e,this.state=t,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scaleX=1,this.scaleY=1,this.scrollOffset=0,this.scrolledToBottom=!1,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=oa,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=j.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let i=t.facet(_o).some(s=>typeof s!="function"&&s.class=="cm-lineWrapping");this.heightOracle=new up(i),this.stateDeco=la(t),this.heightMap=me.empty().applyChanges(this.stateDeco,F.empty,this.heightOracle.setDoc(t.doc),[new Le(0,0,0,t.doc.length)]);for(let s=0;s<2&&(this.viewport=this.getViewport(0,null),!!this.updateForViewport());s++);this.updateViewportLines(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=B.set(this.lineGaps.map(s=>s.draw(this,!1))),this.scrollParent=e.scrollDOM,this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:t}=this.state.selection;for(let i=0;i<=1;i++){let s=i?t.head:t.anchor;if(!e.some(({from:r,to:o})=>s>=r&&s<=o)){let{from:r,to:o}=this.lineBlockAt(s);e.push(new Tn(r,o))}}return this.viewports=e.sort((i,s)=>i.from-s.from),this.updateScaler()}updateScaler(){let e=this.scaler;return this.scaler=this.heightMap.height<=7e6?oa:new tl(this.heightOracle,this.heightMap,this.viewports),e.eq(this.scaler)?0:2}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(zi(e,this.scaler))})}update(e,t=null){this.state=e.state;let i=this.stateDeco;this.stateDeco=la(this.state);let s=e.changedRanges,r=Le.extendWithRanges(s,bp(i,this.stateDeco,e?e.changes:ee.empty(this.state.doc.length))),o=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollOffset);na(),this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),r),(this.heightMap.height!=o||Mi)&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=o);let a=r.length?this.mapViewport(this.viewport,e.changes):this.viewport;(t&&(t.range.head<a.from||t.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,t));let h=a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,e.flags|=this.updateForViewport(),(h||!e.changes.empty||e.flags&2)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(e.changes),t&&(this.scrollTarget=t),!this.mustEnforceCursorAssoc&&(e.selectionSet||e.focusChanged)&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(uc)&&(this.mustEnforceCursorAssoc=!0)}measure(){let{view:e}=this,t=e.contentDOM,i=window.getComputedStyle(t),s=this.heightOracle,r=i.whiteSpace;this.defaultTextDirection=i.direction=="rtl"?j.RTL:j.LTR;let o=this.heightOracle.mustRefreshForWrapping(r)||this.mustMeasureContent==="refresh",l=t.getBoundingClientRect(),a=o||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let h=0,c=0;if(l.width&&l.height){let{scaleX:v,scaleY:S}=Qh(t,l);(v>.005&&Math.abs(this.scaleX-v)>.005||S>.005&&Math.abs(this.scaleY-S)>.005)&&(this.scaleX=v,this.scaleY=S,h|=16,o=a=!0)}let f=(parseInt(i.paddingTop)||0)*this.scaleY,u=(parseInt(i.paddingBottom)||0)*this.scaleY;(this.paddingTop!=f||this.paddingBottom!=u)&&(this.paddingTop=f,this.paddingBottom=u,h|=18),this.editorWidth!=e.scrollDOM.clientWidth&&(s.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,h|=16);let d=Yh(this.view.contentDOM,!1).y;d!=this.scrollParent&&(this.scrollParent=d,this.scrollAnchorHeight=-1,this.scrollOffset=0);let p=this.getScrollOffset();this.scrollOffset!=p&&(this.scrollAnchorHeight=-1,this.scrollOffset=p),this.scrolledToBottom=Xh(this.scrollParent||e.win);let m=(this.printing?wp:xp)(t,this.paddingTop),b=m.top-this.pixelViewport.top,y=m.bottom-this.pixelViewport.bottom;this.pixelViewport=m;let w=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(w!=this.inView&&(this.inView=w,w&&(a=!0)),!this.inView&&!this.scrollTarget&&!kp(e.dom))return 0;let k=l.width;if((this.contentDOMWidth!=k||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,h|=16),a){let v=e.docView.measureVisibleLineHeights(this.viewport);if(s.mustRefreshForHeights(v)&&(o=!0),o||s.lineWrapping&&Math.abs(k-this.contentDOMWidth)>s.charWidth){let{lineHeight:S,charWidth:C,textHeight:P}=e.docView.measureTextSize();o=S>0&&s.refresh(r,S,C,P,Math.max(5,k/C),v),o&&(e.docView.minWidth=0,h|=16)}b>0&&y>0?c=Math.max(b,y):b<0&&y<0&&(c=Math.min(b,y)),na();for(let S of this.viewports){let C=S.from==this.viewport.from?v:e.docView.measureVisibleLineHeights(S);this.heightMap=(o?me.empty().applyChanges(this.stateDeco,F.empty,this.heightOracle,[new Le(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(s,0,o,new dp(S.from,C))}Mi&&(h|=2)}let D=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return D&&(h&2&&(h|=this.updateScaler()),this.viewport=this.getViewport(c,this.scrollTarget),h|=this.updateForViewport()),(h&2||D)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(o?[]:this.lineGaps,e)),h|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),h}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,t){let i=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),s=this.heightMap,r=this.heightOracle,{visibleTop:o,visibleBottom:l}=this,a=new Tn(s.lineAt(o-i*1e3,G.ByHeight,r,0,0).from,s.lineAt(l+(1-i)*1e3,G.ByHeight,r,0,0).to);if(t){let{head:h}=t.range;if(h<a.from||h>a.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=s.lineAt(h,G.ByPos,r,0,0),u;t.y=="center"?u=(f.top+f.bottom)/2-c/2:t.y=="start"||t.y=="nearest"&&h<a.from?u=f.top:u=f.bottom-c,a=new Tn(s.lineAt(u-1e3/2,G.ByHeight,r,0,0).from,s.lineAt(u+c+1e3/2,G.ByHeight,r,0,0).to)}}return a}mapViewport(e,t){let i=t.mapPos(e.from,-1),s=t.mapPos(e.to,1);return new Tn(this.heightMap.lineAt(i,G.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(s,G.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:t},i=0){if(!this.inView)return!0;let{top:s}=this.heightMap.lineAt(e,G.ByPos,this.heightOracle,0,0),{bottom:r}=this.heightMap.lineAt(t,G.ByPos,this.heightOracle,0,0),{visibleTop:o,visibleBottom:l}=this;return(e==0||s<=o-Math.max(10,Math.min(-i,250)))&&(t==this.state.doc.length||r>=l+Math.max(10,Math.min(i,250)))&&s>o-2*1e3&&r<l+2*1e3}mapLineGaps(e,t){if(!e.length||t.empty)return e;let i=[];for(let s of e)t.touchesRange(s.from,s.to)||i.push(new lr(t.mapPos(s.from),t.mapPos(s.to),s.size,s.displaySize));return i}ensureLineGaps(e,t){let i=this.heightOracle.lineWrapping,s=i?1e4:2e3,r=s>>1,o=s<<1;if(this.defaultTextDirection!=j.LTR&&!i)return[];let l=[],a=(c,f,u,d)=>{if(f-c<r)return;let p=this.state.selection.main,m=[p.from];p.empty||m.push(p.to);for(let y of m)if(y>c&&y<f){a(c,y-10,u,d),a(y+10,f,u,d);return}let b=Cp(e,y=>y.from>=u.from&&y.to<=u.to&&Math.abs(y.from-c)<r&&Math.abs(y.to-f)<r&&!m.some(w=>y.from<w&&y.to>w));if(!b){if(f<u.to&&t&&i&&t.visibleRanges.some(k=>k.from<=f&&k.to>=f)){let k=t.moveToLineBoundary(x.cursor(f),!1,!0).head;k>c&&(f=k)}let y=this.gapSize(u,c,f,d),w=i||y<2e6?y:2e6;b=new lr(c,f,y,w)}l.push(b)},h=c=>{if(c.length<o||c.type!=le.Text)return;let f=Sp(c.from,c.to,this.stateDeco);if(f.total<o)return;let u=this.scrollTarget?this.scrollTarget.range.head:null,d,p;if(i){let m=s/this.heightOracle.lineLength*this.heightOracle.lineHeight,b,y;if(u!=null){let w=Dn(f,u),k=((this.visibleBottom-this.visibleTop)/2+m)/c.height;b=w-k,y=w+k}else b=(this.visibleTop-c.top-m)/c.height,y=(this.visibleBottom-c.top+m)/c.height;d=On(f,b),p=On(f,y)}else{let m=f.total*this.heightOracle.charWidth,b=s*this.heightOracle.charWidth,y=0;if(m>2e6)for(let S of e)S.from>=c.from&&S.from<c.to&&S.size!=S.displaySize&&S.from*this.heightOracle.charWidth+y<this.pixelViewport.left&&(y=S.size-S.displaySize);let w=this.pixelViewport.left+y,k=this.pixelViewport.right+y,D,v;if(u!=null){let S=Dn(f,u),C=((k-w)/2+b)/m;D=S-C,v=S+C}else D=(w-b)/m,v=(k+b)/m;d=On(f,D),p=On(f,v)}d>c.from&&a(c.from,d,c,f),p<c.to&&a(p,c.to,c,f)};for(let c of this.viewportLines)Array.isArray(c.type)?c.type.forEach(h):h(c);return l}gapSize(e,t,i,s){let r=Dn(s,i)-Dn(s,t);return this.heightOracle.lineWrapping?e.height*r:s.total*this.heightOracle.charWidth*r}updateLineGaps(e){lr.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=B.set(e.map(t=>t.draw(this,this.heightOracle.lineWrapping))))}computeVisibleRanges(e){let t=this.stateDeco;this.lineGaps.length&&(t=t.concat(this.lineGapDeco));let i=[];N.spans(t,this.viewport.from,this.viewport.to,{span(r,o){i.push({from:r,to:o})},point(){}},20);let s=0;if(i.length!=this.visibleRanges.length)s=12;else for(let r=0;r<i.length&&!(s&8);r++){let o=this.visibleRanges[r],l=i[r];(o.from!=l.from||o.to!=l.to)&&(s|=4,e&&e.mapPos(o.from,-1)==l.from&&e.mapPos(o.to,1)==l.to||(s|=8))}return this.visibleRanges=i,s}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(t=>t.from<=e&&t.to>=e)||zi(this.heightMap.lineAt(e,G.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return e>=this.viewportLines[0].top&&e<=this.viewportLines[this.viewportLines.length-1].bottom&&this.viewportLines.find(t=>t.top<=e&&t.bottom>=e)||zi(this.heightMap.lineAt(this.scaler.fromDOM(e),G.ByHeight,this.heightOracle,0,0),this.scaler)}getScrollOffset(){return(this.scrollParent==this.view.scrollDOM?this.scrollParent.scrollTop:(this.scrollParent?this.scrollParent.getBoundingClientRect().top:0)-this.view.contentDOM.getBoundingClientRect().top)*this.scaleY}scrollAnchorAt(e){let t=this.lineBlockAtHeight(e+8);return t.from>=this.viewport.from||this.viewportLines[0].top-e>200?t:this.viewportLines[0]}elementAtHeight(e){return zi(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}}class Tn{constructor(e,t){this.from=e,this.to=t}}function Sp(n,e,t){let i=[],s=n,r=0;return N.spans(t,n,e,{span(){},point(o,l){o>s&&(i.push({from:s,to:o}),r+=o-s),s=l}},20),s<e&&(i.push({from:s,to:e}),r+=e-s),{total:r,ranges:i}}function On({total:n,ranges:e},t){if(t<=0)return e[0].from;if(t>=1)return e[e.length-1].to;let i=Math.floor(n*t);for(let s=0;;s++){let{from:r,to:o}=e[s],l=o-r;if(i<=l)return r+i;i-=l}}function Dn(n,e){let t=0;for(let{from:i,to:s}of n.ranges){if(e<=s){t+=e-i;break}t+=s-i}return t/n.total}function Cp(n,e){for(let t of n)if(e(t))return t}const oa={toDOM(n){return n},fromDOM(n){return n},scale:1,eq(n){return n==this}};function la(n){let e=n.facet(Hs).filter(i=>typeof i!="function"),t=n.facet(Xo).filter(i=>typeof i!="function");return t.length&&e.push(N.join(t)),e}class tl{constructor(e,t,i){let s=0,r=0,o=0;this.viewports=i.map(({from:l,to:a})=>{let h=t.lineAt(l,G.ByPos,e,0,0).top,c=t.lineAt(a,G.ByPos,e,0,0).bottom;return s+=c-h,{from:l,to:a,top:h,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-s)/(t.height-s);for(let l of this.viewports)l.domTop=o+(l.top-r)*this.scale,o=l.domBottom=l.domTop+(l.bottom-l.top),r=l.bottom}toDOM(e){for(let t=0,i=0,s=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.top)return s+(e-i)*this.scale;if(e<=r.bottom)return r.domTop+(e-r.top);i=r.bottom,s=r.domBottom}}fromDOM(e){for(let t=0,i=0,s=0;;t++){let r=t<this.viewports.length?this.viewports[t]:null;if(!r||e<r.domTop)return i+(e-s)/this.scale;if(e<=r.domBottom)return r.top+(e-r.domTop);i=r.bottom,s=r.domBottom}}eq(e){return e instanceof tl?this.scale==e.scale&&this.viewports.length==e.viewports.length&&this.viewports.every((t,i)=>t.from==e.viewports[i].from&&t.to==e.viewports[i].to):!1}}function zi(n,e){if(e.scale==1)return n;let t=e.toDOM(n.top),i=e.toDOM(n.bottom);return new Ve(n.from,n.length,t,i-t,Array.isArray(n._content)?n._content.map(s=>zi(s,e)):n._content)}const Rn=O.define({combine:n=>n.join(" ")}),vo=O.define({combine:n=>n.indexOf(!0)>-1}),So=Ot.newName(),Ec=Ot.newName(),Ic=Ot.newName(),Nc={"&light":"."+Ec,"&dark":"."+Ic};function Co(n,e,t){return new Ot(e,{finish(i){return/&/.test(i)?i.replace(/&\w*/,s=>{if(s=="&")return n;if(!t||!t[s])throw new RangeError(`Unsupported selector: ${s}`);return t[s]}):n+" "+i}})}const Ap=Co("."+So,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0,overflowAnchor:"none"},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",minHeight:"100%",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#ddd"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},".cm-iso":{unicodeBidi:"isolate"},".cm-announced":{position:"fixed",top:"-10000px"},"@media print":{".cm-announced":{display:"none"}},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",zIndex:200},".cm-gutters-before":{insetInlineStart:0},".cm-gutters-after":{insetInlineEnd:0},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",border:"0px solid #ddd","&.cm-gutters-before":{borderRightWidth:"1px"},"&.cm-gutters-after":{borderLeftWidth:"1px"}},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0,zIndex:300},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-dialog":{padding:"2px 19px 4px 6px",position:"relative","& label":{fontSize:"80%"}},".cm-dialog-close":{position:"absolute",top:"3px",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",fontSize:"14px",padding:"0"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top",userSelect:"none"},".cm-highlightSpace":{backgroundImage:"radial-gradient(circle at 50% 55%, #aaa 20%, transparent 5%)",backgroundPosition:"center"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},Nc),Mp={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},ar=M.ie&&M.ie_version<=11;class Tp{constructor(e){this.view=e,this.active=!1,this.editContext=null,this.selectionRange=new nd,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.printQuery=null,this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(t=>{for(let i of t)this.queue.push(i);(M.ie&&M.ie_version<=11||M.ios&&e.composing)&&t.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),window.EditContext&&M.android&&e.constructor.EDIT_CONTEXT!==!1&&!(M.chrome&&M.chrome_version<126)&&(this.editContext=new Dp(e),e.state.facet(ut)&&(e.contentDOM.editContext=this.editContext.editContext)),ar&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),window.matchMedia&&(this.printQuery=window.matchMedia("print")),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var t;((t=this.view.docView)===null||t===void 0?void 0:t.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(t=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),t.length>0&&t[t.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(t=>{t.length>0&&t[t.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runHandlers("scroll",e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.editContext&&this.view.requestMeasure(this.editContext.measureReq),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(e){(e.type=="change"||!e.type)&&!e.matches||(this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500))}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((t,i)=>t!=e[i]))){this.gapIntersection.disconnect();for(let t of e)this.gapIntersection.observe(t);this.gaps=e}}onSelectionChange(e){let t=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:i}=this,s=this.selectionRange;if(i.state.facet(ut)?i.root.activeElement!=this.dom:!ji(this.dom,s))return;let r=s.anchorNode&&i.docView.tile.nearest(s.anchorNode);if(r&&r.isWidget()&&r.widget.ignoreEvent(e)){t||(this.selectionChanged=!1);return}(M.ie&&M.ie_version<=11||M.android&&M.chrome)&&!i.state.selection.main.empty&&s.focusNode&&Ui(s.focusNode,s.focusOffset,s.anchorNode,s.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,t=en(e.root);if(!t)return!1;let i=M.safari&&e.root.nodeType==11&&e.root.activeElement==this.dom&&Op(this.view,t)||t;if(!i||this.selectionRange.eq(i))return!1;let s=ji(this.dom,i);return s&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&rd(this.dom,i)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(i),s&&(this.selectionChanged=!0),!0)}setSelectionRange(e,t){this.selectionRange.set(e.node,e.offset,t.node,t.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,t=null;for(let i=this.dom;i;)if(i.nodeType==1)!t&&e<this.scrollTargets.length&&this.scrollTargets[e]==i?e++:t||(t=this.scrollTargets.slice(0,e)),t&&t.push(i),i=i.assignedSlot||i.parentNode;else if(i.nodeType==11)i=i.host;else break;if(e<this.scrollTargets.length&&!t&&(t=this.scrollTargets.slice(0,e)),t){for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);for(let i of this.scrollTargets=t)i.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,Mp),ar&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),ar&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,t){var i;if(!this.delayedAndroidKey){let s=()=>{let r=this.delayedAndroidKey;r&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=r.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&r.force&&yi(this.dom,r.key,r.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(s)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:t,force:this.lastChange<Date.now()-50||!!(!((i=this.delayedAndroidKey)===null||i===void 0)&&i.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let t=-1,i=-1,s=!1;for(let r of e){let o=this.readMutation(r);o&&(o.typeOver&&(s=!0),t==-1?{from:t,to:i}=o:(t=Math.min(o.from,t),i=Math.max(o.to,i)))}return{from:t,to:i,typeOver:s}}readChange(){let{from:e,to:t,typeOver:i}=this.processRecords(),s=this.selectionChanged&&ji(this.dom,this.selectionRange);if(e<0&&!s)return null;e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1;let r=new Ud(this.view,e,t,i);return this.view.docView.domChanged={newSel:r.newSel?r.newSel.main:null},r}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let t=this.readChange();if(!t)return this.view.requestMeasure(),!1;let i=this.view.state,s=Sc(this.view,t);return this.view.state==i&&(t.domChanged||t.newSel&&!bs(this.view.state.selection,t.newSel.main))&&this.view.update([]),s}readMutation(e){let t=this.view.docView.tile.nearest(e.target);if(!t||t.isWidget())return null;if(t.markDirty(e.type=="attributes"),e.type=="childList"){let i=aa(t,e.previousSibling||e.target.previousSibling,-1),s=aa(t,e.nextSibling||e.target.nextSibling,1);return{from:i?t.posAfter(i):t.posAtStart,to:s?t.posBefore(s):t.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:t.posAtStart,to:t.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),this.printQuery?this.printQuery.addEventListener?this.printQuery.addEventListener("change",this.onPrint):this.printQuery.addListener(this.onPrint):e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),this.printQuery?this.printQuery.removeEventListener?this.printQuery.removeEventListener("change",this.onPrint):this.printQuery.removeListener(this.onPrint):e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}update(e){this.editContext&&(this.editContext.update(e),e.startState.facet(ut)!=e.state.facet(ut)&&(e.view.contentDOM.editContext=e.state.facet(ut)?this.editContext.editContext:null))}destroy(){var e,t,i;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(t=this.gapIntersection)===null||t===void 0||t.disconnect(),(i=this.resizeScroll)===null||i===void 0||i.disconnect();for(let s of this.scrollTargets)s.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey),this.editContext&&(this.view.contentDOM.editContext=null,this.editContext.destroy())}}function aa(n,e,t){for(;e;){let i=_.get(e);if(i&&i.parent==n)return i;let s=e.parentNode;e=s!=n.dom?s:t>0?e.nextSibling:e.previousSibling}return null}function ha(n,e){let t=e.startContainer,i=e.startOffset,s=e.endContainer,r=e.endOffset,o=n.docView.domAtPos(n.state.selection.main.anchor,1);return Ui(o.node,o.offset,s,r)&&([t,i,s,r]=[s,r,t,i]),{anchorNode:t,anchorOffset:i,focusNode:s,focusOffset:r}}function Op(n,e){if(e.getComposedRanges){let s=e.getComposedRanges(n.root)[0];if(s)return ha(n,s)}let t=null;function i(s){s.preventDefault(),s.stopImmediatePropagation(),t=s.getTargetRanges()[0]}return n.contentDOM.addEventListener("beforeinput",i,!0),n.dom.ownerDocument.execCommand("indent"),n.contentDOM.removeEventListener("beforeinput",i,!0),t?ha(n,t):null}class Dp{constructor(e){this.from=0,this.to=0,this.pendingContextChange=null,this.handlers=Object.create(null),this.composing=null,this.resetRange(e.state);let t=this.editContext=new window.EditContext({text:e.state.doc.sliceString(this.from,this.to),selectionStart:this.toContextPos(Math.max(this.from,Math.min(this.to,e.state.selection.main.anchor))),selectionEnd:this.toContextPos(e.state.selection.main.head)});this.handlers.textupdate=i=>{let s=e.state.selection.main,{anchor:r,head:o}=s,l=this.toEditorPos(i.updateRangeStart),a=this.toEditorPos(i.updateRangeEnd);e.inputState.composing>=0&&!this.composing&&(this.composing={contextBase:i.updateRangeStart,editorBase:l,drifted:!1});let h=a-l>i.text.length;l==this.from&&r<this.from?l=r:a==this.to&&r>this.to&&(a=r);let c=Cc(e.state.sliceDoc(l,a),i.text,(h?s.from:s.to)-l,h?"end":null);if(!c){let u=x.single(this.toEditorPos(i.selectionStart),this.toEditorPos(i.selectionEnd));bs(u,s)||e.dispatch({selection:u,userEvent:"select"});return}let f={from:c.from+l,to:c.toA+l,insert:F.of(i.text.slice(c.from,c.toB).split(` 10 + `))};if((M.mac||M.android)&&f.from==o-1&&/^\. ?$/.test(i.text)&&e.contentDOM.getAttribute("autocorrect")=="off"&&(f={from:l,to:a,insert:F.of([i.text.replace("."," ")])}),this.pendingContextChange=f,!e.state.readOnly){let u=this.to-this.from+(f.to-f.from+f.insert.length);Zo(e,f,x.single(this.toEditorPos(i.selectionStart,u),this.toEditorPos(i.selectionEnd,u)))}this.pendingContextChange&&(this.revertPending(e.state),this.setSelection(e.state)),f.from<f.to&&!f.insert.length&&e.inputState.composing>=0&&!/[\\p{Alphabetic}\\p{Number}_]/.test(t.text.slice(Math.max(0,i.updateRangeStart-1),Math.min(t.text.length,i.updateRangeStart+1)))&&this.handlers.compositionend(i)},this.handlers.characterboundsupdate=i=>{let s=[],r=null;for(let o=this.toEditorPos(i.rangeStart),l=this.toEditorPos(i.rangeEnd);o<l;o++){let a=e.coordsForChar(o);r=a&&new DOMRect(a.left,a.top,a.right-a.left,a.bottom-a.top)||r||new DOMRect,s.push(r)}t.updateCharacterBounds(i.rangeStart,s)},this.handlers.textformatupdate=i=>{let s=[];for(let r of i.getTextFormats()){let o=r.underlineStyle,l=r.underlineThickness;if(!/none/i.test(o)&&!/none/i.test(l)){let a=this.toEditorPos(r.rangeStart),h=this.toEditorPos(r.rangeEnd);if(a<h){let c=`text-decoration: underline ${/^[a-z]/.test(o)?o+" ":o=="Dashed"?"dashed ":o=="Squiggle"?"wavy ":""}${/thin/i.test(l)?1:2}px`;s.push(B.mark({attributes:{style:c}}).range(a,h))}}}e.dispatch({effects:pc.of(B.set(s))})},this.handlers.compositionstart=()=>{e.inputState.composing<0&&(e.inputState.composing=0,e.inputState.compositionFirstChange=!0)},this.handlers.compositionend=()=>{if(e.inputState.composing=-1,e.inputState.compositionFirstChange=null,this.composing){let{drifted:i}=this.composing;this.composing=null,i&&this.reset(e.state)}};for(let i in this.handlers)t.addEventListener(i,this.handlers[i]);this.measureReq={read:i=>{this.editContext.updateControlBounds(i.contentDOM.getBoundingClientRect());let s=en(i.root);s&&s.rangeCount&&this.editContext.updateSelectionBounds(s.getRangeAt(0).getBoundingClientRect())}}}applyEdits(e){let t=0,i=!1,s=this.pendingContextChange;return e.changes.iterChanges((r,o,l,a,h)=>{if(i)return;let c=h.length-(o-r);if(s&&o>=s.to)if(s.from==r&&s.to==o&&s.insert.eq(h)){s=this.pendingContextChange=null,t+=c,this.to+=c;return}else s=null,this.revertPending(e.state);if(r+=t,o+=t,o<=this.from)this.from+=c,this.to+=c;else if(r<this.to){if(r<this.from||o>this.to||this.to-this.from+h.length>3e4){i=!0;return}this.editContext.updateText(this.toContextPos(r),this.toContextPos(o),h.toString()),this.to+=c}t+=c}),s&&!i&&this.revertPending(e.state),!i}update(e){let t=this.pendingContextChange,i=e.startState.selection.main;this.composing&&(this.composing.drifted||!e.changes.touchesRange(i.from,i.to)&&e.transactions.some(s=>!s.isUserEvent("input.type")&&s.changes.touchesRange(this.from,this.to)))?(this.composing.drifted=!0,this.composing.editorBase=e.changes.mapPos(this.composing.editorBase)):!this.applyEdits(e)||!this.rangeIsValid(e.state)?(this.pendingContextChange=null,this.reset(e.state)):(e.docChanged||e.selectionSet||t)&&this.setSelection(e.state),(e.geometryChanged||e.docChanged||e.selectionSet)&&e.view.requestMeasure(this.measureReq)}resetRange(e){let{head:t}=e.selection.main;this.from=Math.max(0,t-1e4),this.to=Math.min(e.doc.length,t+1e4)}reset(e){this.resetRange(e),this.editContext.updateText(0,this.editContext.text.length,e.doc.sliceString(this.from,this.to)),this.setSelection(e)}revertPending(e){let t=this.pendingContextChange;this.pendingContextChange=null,this.editContext.updateText(this.toContextPos(t.from),this.toContextPos(t.from+t.insert.length),e.doc.sliceString(t.from,t.to))}setSelection(e){let{main:t}=e.selection,i=this.toContextPos(Math.max(this.from,Math.min(this.to,t.anchor))),s=this.toContextPos(t.head);(this.editContext.selectionStart!=i||this.editContext.selectionEnd!=s)&&this.editContext.updateSelection(i,s)}rangeIsValid(e){let{head:t}=e.selection.main;return!(this.from>0&&t-this.from<500||this.to<e.doc.length&&this.to-t<500||this.to-this.from>1e4*3)}toEditorPos(e,t=this.to-this.from){e=Math.min(e,t);let i=this.composing;return i&&i.drifted?i.editorBase+(e-i.contextBase):e+this.from}toContextPos(e){let t=this.composing;return t&&t.drifted?t.contextBase+(e-t.editorBase):e-this.from}destroy(){for(let e in this.handlers)this.editContext.removeEventListener(e,this.handlers[e])}}class T{get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return!!this.inputState&&this.inputState.composing>0}get compositionStarted(){return!!this.inputState&&this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}constructor(e={}){var t;this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.className="cm-announced",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),e.parent&&e.parent.appendChild(this.dom);let{dispatch:i}=e;this.dispatchTransactions=e.dispatchTransactions||i&&(s=>s.forEach(r=>i(r,this)))||(s=>this.update(s)),this.dispatch=this.dispatch.bind(this),this._root=e.root||sd(e.parent)||document,this.viewState=new ra(this,e.state||H.create(e)),e.scrollTo&&e.scrollTo.is(Cn)&&(this.viewState.scrollTarget=e.scrollTo.value.clip(this.viewState.state)),this.plugins=this.state.facet(fi).map(s=>new ir(s));for(let s of this.plugins)s.update(this);this.observer=new Tp(this),this.inputState=new _d(this),this.inputState.ensureHandlers(this.plugins),this.docView=new Ul(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),!((t=document.fonts)===null||t===void 0)&&t.ready&&document.fonts.ready.then(()=>{this.viewState.mustMeasureContent="refresh",this.requestMeasure()})}dispatch(...e){let t=e.length==1&&e[0]instanceof te?e:e.length==1&&Array.isArray(e[0])?e[0]:[this.state.update(...e)];this.dispatchTransactions(t,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let t=!1,i=!1,s,r=this.state;for(let u of e){if(u.startState!=r)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");r=u.state}if(this.destroyed){this.viewState.state=r;return}let o=this.hasFocus,l=0,a=null;e.some(u=>u.annotation(Rc))?(this.inputState.notifiedFocused=o,l=1):o!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=o,a=Bc(r,o),a||(l=1));let h=this.observer.delayedAndroidKey,c=null;if(h?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(r.doc)||!this.state.selection.eq(r.selection))&&(c=null)):this.observer.clear(),r.facet(H.phrases)!=this.state.facet(H.phrases))return this.setState(r);s=ps.create(this,r,e),s.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let u of e){if(f&&(f=f.map(u.changes)),u.scrollIntoView){let{main:d}=u.state.selection;f=new xi(d.empty?d:x.cursor(d.head,d.head>d.anchor?-1:1))}for(let d of u.effects)d.is(Cn)&&(f=d.value.clip(this.state))}this.viewState.update(s,f),this.bidiCache=xs.update(this.bidiCache,s.changes),s.empty||(this.updatePlugins(s),this.inputState.update(s)),t=this.docView.update(s),this.state.facet(Vi)!=this.styleModules&&this.mountStyles(),i=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(t,e.some(u=>u.isUserEvent("select.pointer")))}finally{this.updateState=0}if(s.startState.facet(Rn)!=s.state.facet(Rn)&&(this.viewState.mustMeasureContent=!0),(t||i||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),t&&this.docViewUpdate(),!s.empty)for(let u of this.state.facet(bo))try{u(s)}catch(d){ge(this.state,d,"update listener")}(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!Sc(this,c)&&h.force&&yi(this.contentDOM,h.key,h.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let t=this.hasFocus;try{for(let i of this.plugins)i.destroy(this);this.viewState=new ra(this,e),this.plugins=e.facet(fi).map(i=>new ir(i)),this.pluginMap.clear();for(let i of this.plugins)i.update(this);this.docView.destroy(),this.docView=new Ul(this),this.inputState.ensureHandlers(this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}t&&this.focus(),this.requestMeasure()}updatePlugins(e){let t=e.startState.facet(fi),i=e.state.facet(fi);if(t!=i){let s=[];for(let r of i){let o=t.indexOf(r);if(o<0)s.push(new ir(r));else{let l=this.plugins[o];l.mustUpdate=e,s.push(l)}}for(let r of this.plugins)r.mustUpdate!=e&&r.destroy(this);this.plugins=s,this.pluginMap.clear()}else for(let s of this.plugins)s.mustUpdate=e;for(let s=0;s<this.plugins.length;s++)this.plugins[s].update(this);t!=i&&this.inputState.ensureHandlers(this.plugins)}docViewUpdate(){for(let e of this.plugins){let t=e.value;if(t&&t.docViewUpdate)try{t.docViewUpdate(this)}catch(i){ge(this.state,i,"doc view update listener")}}}measure(e=!0){if(this.destroyed)return;if(this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.observer.delayedAndroidKey){this.measureScheduled=-1,this.requestMeasure();return}this.measureScheduled=0,e&&this.observer.forceFlush();let t=null,i=this.viewState.scrollParent,s=this.viewState.getScrollOffset(),{scrollAnchorPos:r,scrollAnchorHeight:o}=this.viewState;Math.abs(s-this.viewState.scrollOffset)>1&&(o=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(o<0)if(Xh(i||this.win))r=-1,o=this.viewState.heightMap.height;else{let d=this.viewState.scrollAnchorAt(s);r=d.from,o=d.top}this.updateState=1;let a=this.viewState.measure();if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let h=[];a&4||([this.measureRequests,h]=[h,this.measureRequests]);let c=h.map(d=>{try{return d.read(this)}catch(p){return ge(this.state,p),ca}}),f=ps.create(this,this.state,[]),u=!1;f.flags|=a,t?t.flags|=a:t=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),u=this.docView.update(f),u&&this.docViewUpdate());for(let d=0;d<h.length;d++)if(c[d]!=ca)try{let p=h[d];p.write&&p.write(c[d],this)}catch(p){ge(this.state,p)}if(u&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null,o=-1;continue}else{let p=((r<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(r).top)-o)/this.scaleY;if((p>1||p<-1)&&(i==this.scrollDOM||this.hasFocus||Math.max(this.inputState.lastWheelEvent,this.inputState.lastTouchTime)>Date.now()-100)){s=s+p,i?i.scrollTop+=p:this.win.scrollBy(0,p),o=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(t&&!t.empty)for(let l of this.state.facet(bo))l(t)}get themeClasses(){return So+" "+(this.state.facet(vo)?Ic:Ec)+" "+this.state.facet(Rn)}updateAttrs(){let e=fa(this,gc,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),t={spellcheck:"false",autocorrect:"off",autocapitalize:"off",writingsuggestions:"false",translate:"no",contenteditable:this.state.facet(ut)?"true":"false",class:"cm-content",style:`${M.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(t["aria-readonly"]="true"),fa(this,_o,t);let i=this.observer.ignore(()=>{let s=Vl(this.contentDOM,this.contentAttrs,t),r=Vl(this.dom,this.editorAttrs,e);return s||r});return this.editorAttrs=e,this.contentAttrs=t,i}showAnnouncements(e){let t=!0;for(let i of e)for(let s of i.effects)if(s.is(T.announce)){t&&(this.announceDOM.textContent=""),t=!1;let r=this.announceDOM.appendChild(document.createElement("div"));r.textContent=s.value}}mountStyles(){this.styleModules=this.state.facet(Vi);let e=this.state.facet(T.cspNonce);Ot.mount(this.root,this.styleModules.concat(Ap).reverse(),e?{nonce:e}:void 0)}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let t=0;t<this.measureRequests.length;t++)if(this.measureRequests[t].key===e.key){this.measureRequests[t]=e;return}}this.measureRequests.push(e)}}plugin(e){let t=this.pluginMap.get(e);return(t===void 0||t&&t.plugin!=e)&&this.pluginMap.set(e,t=this.plugins.find(i=>i.plugin==e)||null),t&&t.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}get scaleX(){return this.viewState.scaleX}get scaleY(){return this.viewState.scaleY}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,t,i){return or(this,e,Gl(this,e,t,i))}moveByGroup(e,t){return or(this,e,Gl(this,e,t,i=>Vd(this,e.head,i)))}visualLineSide(e,t){let i=this.bidiSpans(e),s=this.textDirectionAt(e.from),r=i[t?i.length-1:0];return x.cursor(r.side(t,s)+e.from,r.forward(!t,s)?1:-1)}moveToLineBoundary(e,t,i=!0){return Hd(this,e,t,i)}moveVertically(e,t,i){return or(this,e,zd(this,e,t,i))}domAtPos(e,t=1){return this.docView.domAtPos(e,t)}posAtDOM(e,t=0){return this.docView.posFromDOM(e,t)}posAtCoords(e,t=!0){this.readMeasured();let i=ko(this,e,t);return i&&i.pos}posAndSideAtCoords(e,t=!0){return this.readMeasured(),ko(this,e,t)}coordsAtPos(e,t=1){this.readMeasured();let i=this.docView.coordsAt(e,t);if(!i||i.left==i.right)return i;let s=this.state.doc.lineAt(e),r=this.bidiSpans(s),o=r[nt.find(r,e-s.from,-1,t)];return ds(i,o.dir==j.LTR==t>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(fc)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>Rp)return nc(e.length);let t=this.textDirectionAt(e.from),i;for(let r of this.bidiCache)if(r.from==e.from&&r.dir==t&&(r.fresh||ic(r.isolates,i=ql(this,e))))return r.order;i||(i=ql(this,e));let s=ud(e.text,t,i);return this.bidiCache.push(new xs(e.from,e.to,t,i,!0,s)),s}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||M.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{_h(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){this.root.activeElement==this.contentDOM&&this.contentDOM.blur();for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.docView.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,t={}){return Cn.of(new xi(typeof e=="number"?x.cursor(e):e,t.y,t.x,t.yMargin,t.xMargin))}scrollSnapshot(){let{scrollTop:e,scrollLeft:t}=this.scrollDOM,i=this.viewState.scrollAnchorAt(e);return Cn.of(new xi(x.cursor(i.from),"start","start",i.top-e,t,!0))}setTabFocusMode(e){e==null?this.inputState.tabFocusMode=this.inputState.tabFocusMode<0?0:-1:typeof e=="boolean"?this.inputState.tabFocusMode=e?0:-1:this.inputState.tabFocusMode!=0&&(this.inputState.tabFocusMode=Date.now()+e)}static domEventHandlers(e){return X.define(()=>({}),{eventHandlers:e})}static domEventObservers(e){return X.define(()=>({}),{eventObservers:e})}static theme(e,t){let i=Ot.newName(),s=[Rn.of(i),Vi.of(Co(`.${i}`,e))];return t&&t.dark&&s.push(vo.of(!0)),s}static baseTheme(e){return ni.lowest(Vi.of(Co("."+So,e,Nc)))}static findFromDOM(e){var t;let i=e.querySelector(".cm-content"),s=i&&_.get(i)||_.get(e);return((t=s?.root)===null||t===void 0?void 0:t.view)||null}}T.styleModule=Vi;T.inputHandler=hc;T.clipboardInputFilter=Qo;T.clipboardOutputFilter=Yo;T.scrollHandler=dc;T.focusChangeEffect=cc;T.perLineTextDirection=fc;T.exceptionSink=ac;T.updateListener=bo;T.editable=ut;T.mouseSelectionStyle=lc;T.dragMovesSelection=oc;T.clickAddsSelectionRange=rc;T.decorations=Hs;T.blockWrappers=mc;T.outerDecorations=Xo;T.atomicRanges=gn;T.bidiIsolatedRanges=bc;T.scrollMargins=yc;T.darkTheme=vo;T.cspNonce=O.define({combine:n=>n.length?n[0]:""});T.contentAttributes=_o;T.editorAttributes=gc;T.lineWrapping=T.contentAttributes.of({class:"cm-lineWrapping"});T.announce=L.define();const Rp=4096,ca={};class xs{constructor(e,t,i,s,r,o){this.from=e,this.to=t,this.dir=i,this.isolates=s,this.fresh=r,this.order=o}static update(e,t){if(t.empty&&!e.some(r=>r.fresh))return e;let i=[],s=e.length?e[e.length-1].dir:j.LTR;for(let r=Math.max(0,e.length-10);r<e.length;r++){let o=e[r];o.dir==s&&!t.touchesRange(o.from,o.to)&&i.push(new xs(t.mapPos(o.from,1),t.mapPos(o.to,-1),o.dir,o.isolates,!1,o.order))}return i}}function fa(n,e,t){for(let i=n.state.facet(e),s=i.length-1;s>=0;s--){let r=i[s],o=typeof r=="function"?r(n):r;o&&jo(o,t)}return t}const Bp=M.mac?"mac":M.windows?"win":M.linux?"linux":"key";function Pp(n,e){const t=n.split(/-(?!$)/);let i=t[t.length-1];i=="Space"&&(i=" ");let s,r,o,l;for(let a=0;a<t.length-1;++a){const h=t[a];if(/^(cmd|meta|m)$/i.test(h))l=!0;else if(/^a(lt)?$/i.test(h))s=!0;else if(/^(c|ctrl|control)$/i.test(h))r=!0;else if(/^s(hift)?$/i.test(h))o=!0;else if(/^mod$/i.test(h))e=="mac"?l=!0:r=!0;else throw new Error("Unrecognized modifier name: "+h)}return s&&(i="Alt-"+i),r&&(i="Ctrl-"+i),l&&(i="Meta-"+i),o&&(i="Shift-"+i),i}function Bn(n,e,t){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t!==!1&&e.shiftKey&&(n="Shift-"+n),n}const Lp=ni.default(T.domEventHandlers({keydown(n,e){return Fc(Wc(e.state),n,e,"editor")}})),qs=O.define({enables:Lp}),ua=new WeakMap;function Wc(n){let e=n.facet(qs),t=ua.get(e);return t||ua.set(e,t=Np(e.reduce((i,s)=>i.concat(s),[]))),t}function Ep(n,e,t){return Fc(Wc(n.state),e,n,t)}let vt=null;const Ip=4e3;function Np(n,e=Bp){let t=Object.create(null),i=Object.create(null),s=(o,l)=>{let a=i[o];if(a==null)i[o]=l;else if(a!=l)throw new Error("Key binding "+o+" is used both as a regular binding and as a multi-stroke prefix")},r=(o,l,a,h,c)=>{var f,u;let d=t[o]||(t[o]=Object.create(null)),p=l.split(/ (?!$)/).map(y=>Pp(y,e));for(let y=1;y<p.length;y++){let w=p.slice(0,y).join(" ");s(w,!0),d[w]||(d[w]={preventDefault:!0,stopPropagation:!1,run:[k=>{let D=vt={view:k,prefix:w,scope:o};return setTimeout(()=>{vt==D&&(vt=null)},Ip),!0}]})}let m=p.join(" ");s(m,!1);let b=d[m]||(d[m]={preventDefault:!1,stopPropagation:!1,run:((u=(f=d._any)===null||f===void 0?void 0:f.run)===null||u===void 0?void 0:u.slice())||[]});a&&b.run.push(a),h&&(b.preventDefault=!0),c&&(b.stopPropagation=!0)};for(let o of n){let l=o.scope?o.scope.split(" "):["editor"];if(o.any)for(let h of l){let c=t[h]||(t[h]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});let{any:f}=o;for(let u in c)c[u].run.push(d=>f(d,Ao))}let a=o[e]||o.key;if(a)for(let h of l)r(h,a,o.run,o.preventDefault,o.stopPropagation),o.shift&&r(h,"Shift-"+a,o.shift,o.preventDefault,o.stopPropagation)}return t}let Ao=null;function Fc(n,e,t,i){Ao=e;let s=_u(e),r=be(s,0),o=tt(r)==s.length&&s!=" ",l="",a=!1,h=!1,c=!1;vt&&vt.view==t&&vt.scope==i&&(l=vt.prefix+" ",Mc.indexOf(e.keyCode)<0&&(h=!0,vt=null));let f=new Set,u=b=>{if(b){for(let y of b.run)if(!f.has(y)&&(f.add(y),y(t)))return b.stopPropagation&&(c=!0),!0;b.preventDefault&&(b.stopPropagation&&(c=!0),h=!0)}return!1},d=n[i],p,m;return d&&(u(d[l+Bn(s,e,!o)])?a=!0:o&&(e.altKey||e.metaKey||e.ctrlKey)&&!(M.windows&&e.ctrlKey&&e.altKey)&&!(M.mac&&e.altKey&&!(e.ctrlKey||e.metaKey))&&(p=Dt[e.keyCode])&&p!=s?(u(d[l+Bn(p,e,!0)])||e.shiftKey&&(m=Ji[e.keyCode])!=s&&m!=p&&u(d[l+Bn(m,e,!1)]))&&(a=!0):o&&e.shiftKey&&u(d[l+Bn(s,e,!0)])&&(a=!0),!a&&u(d._any)&&(a=!0)),h&&(a=!0),a&&c&&e.stopPropagation(),Ao=null,a}class mn{constructor(e,t,i,s,r){this.className=e,this.left=t,this.top=i,this.width=s,this.height=r}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,t){return t.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,t,i){if(i.empty){let s=e.coordsAtPos(i.head,i.assoc||1);if(!s)return[];let r=Hc(e);return[new mn(t,s.left-r.left,s.top-r.top,null,s.bottom-s.top)]}else return Wp(e,t,i)}}function Hc(n){let e=n.scrollDOM.getBoundingClientRect();return{left:(n.textDirection==j.LTR?e.left:e.right-n.scrollDOM.clientWidth*n.scaleX)-n.scrollDOM.scrollLeft*n.scaleX,top:e.top-n.scrollDOM.scrollTop*n.scaleY}}function da(n,e,t,i){let s=n.coordsAtPos(e,t*2);if(!s)return i;let r=n.dom.getBoundingClientRect(),o=(s.top+s.bottom)/2,l=n.posAtCoords({x:r.left+1,y:o}),a=n.posAtCoords({x:r.right-1,y:o});return l==null||a==null?i:{from:Math.max(i.from,Math.min(l,a)),to:Math.min(i.to,Math.max(l,a))}}function Wp(n,e,t){if(t.to<=n.viewport.from||t.from>=n.viewport.to)return[];let i=Math.max(t.from,n.viewport.from),s=Math.min(t.to,n.viewport.to),r=n.textDirection==j.LTR,o=n.contentDOM,l=o.getBoundingClientRect(),a=Hc(n),h=o.querySelector(".cm-line"),c=h&&window.getComputedStyle(h),f=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),u=l.right-(c?parseInt(c.paddingRight):0),d=xo(n,i,1),p=xo(n,s,-1),m=d.type==le.Text?d:null,b=p.type==le.Text?p:null;if(m&&(n.lineWrapping||d.widgetLineBreaks)&&(m=da(n,i,1,m)),b&&(n.lineWrapping||p.widgetLineBreaks)&&(b=da(n,s,-1,b)),m&&b&&m.from==b.from&&m.to==b.to)return w(k(t.from,t.to,m));{let v=m?k(t.from,null,m):D(d,!1),S=b?k(null,t.to,b):D(p,!0),C=[];return(m||d).to<(b||p).from-(m&&b?1:0)||d.widgetLineBreaks>1&&v.bottom+n.defaultLineHeight/2<S.top?C.push(y(f,v.bottom,u,S.top)):v.bottom<S.top&&n.elementAtHeight((v.bottom+S.top)/2).type==le.Text&&(v.bottom=S.top=(v.bottom+S.top)/2),w(v).concat(C).concat(w(S))}function y(v,S,C,P){return new mn(e,v-a.left,S-a.top,Math.max(0,C-v),P-S)}function w({top:v,bottom:S,horizontal:C}){let P=[];for(let W=0;W<C.length;W+=2)P.push(y(C[W],v,C[W+1],S));return P}function k(v,S,C){let P=1e9,W=-1e9,q=[];function I(V,U,ue,Se,Ue){let se=n.coordsAtPos(V,V==C.to?-2:2),Oe=n.coordsAtPos(ue,ue==C.from?2:-2);!se||!Oe||(P=Math.min(se.top,Oe.top,P),W=Math.max(se.bottom,Oe.bottom,W),Ue==j.LTR?q.push(r&&U?f:se.left,r&&Se?u:Oe.right):q.push(!r&&Se?f:Oe.left,!r&&U?u:se.right))}let R=v??C.from,z=S??C.to;for(let V of n.visibleRanges)if(V.to>R&&V.from<z)for(let U=Math.max(V.from,R),ue=Math.min(V.to,z);;){let Se=n.state.doc.lineAt(U);for(let Ue of n.bidiSpans(Se)){let se=Ue.from+Se.from,Oe=Ue.to+Se.from;if(se>=ue)break;Oe>U&&I(Math.max(se,U),v==null&&se<=R,Math.min(Oe,ue),S==null&&Oe>=z,Ue.dir)}if(U=Se.to+1,U>=ue)break}return q.length==0&&I(R,v==null,z,S==null,n.textDirection),{top:P,bottom:W,horizontal:q}}function D(v,S){let C=l.top+(S?v.top:v.bottom);return{top:C,bottom:C,horizontal:[]}}}function Fp(n,e){return n.constructor==e.constructor&&n.eq(e)}class Hp{constructor(e,t){this.view=e,this.layer=t,this.drawn=[],this.scaleX=1,this.scaleY=1,this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),t.above&&this.dom.classList.add("cm-layer-above"),t.class&&this.dom.classList.add(t.class),this.scale(),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),t.mount&&t.mount(this.dom,e)}update(e){e.startState.facet(ns)!=e.state.facet(ns)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&(this.scale(),e.view.requestMeasure(this.measureReq))}docViewUpdate(e){this.layer.updateOnDocViewUpdate!==!1&&e.requestMeasure(this.measureReq)}setOrder(e){let t=0,i=e.facet(ns);for(;t<i.length&&i[t]!=this.layer;)t++;this.dom.style.zIndex=String((this.layer.above?150:-1)-t)}measure(){return this.layer.markers(this.view)}scale(){let{scaleX:e,scaleY:t}=this.view;(e!=this.scaleX||t!=this.scaleY)&&(this.scaleX=e,this.scaleY=t,this.dom.style.transform=`scale(${1/e}, ${1/t})`)}draw(e){if(e.length!=this.drawn.length||e.some((t,i)=>!Fp(t,this.drawn[i]))){let t=this.dom.firstChild,i=0;for(let s of e)s.update&&t&&s.constructor&&this.drawn[i].constructor&&s.update(t,this.drawn[i])?(t=t.nextSibling,i++):this.dom.insertBefore(s.draw(),t);for(;t;){let s=t.nextSibling;t.remove(),t=s}this.drawn=e,M.safari&&M.safari_version>=26&&(this.dom.style.display=this.dom.firstChild?"":"none")}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}}const ns=O.define();function Vc(n){return[X.define(e=>new Hp(e,n)),ns.of(n)]}const nn=O.define({combine(n){return at(n,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,t)=>Math.min(e,t),drawRangeCursor:(e,t)=>e||t})}});function Vp(n={}){return[nn.of(n),zp,$p,qp,uc.of(!0)]}function zc(n){return n.startState.facet(nn)!=n.state.facet(nn)}const zp=Vc({above:!0,markers(n){let{state:e}=n,t=e.facet(nn),i=[];for(let s of e.selection.ranges){let r=s==e.selection.main;if(s.empty||t.drawRangeCursor){let o=r?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=s.empty?s:x.cursor(s.head,s.head>s.anchor?-1:1);for(let a of mn.forRange(n,o,l))i.push(a)}}return i},update(n,e){n.transactions.some(i=>i.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let t=zc(n);return t&&pa(n.state,e),n.docChanged||n.selectionSet||t},mount(n,e){pa(e.state,n)},class:"cm-cursorLayer"});function pa(n,e){e.style.animationDuration=n.facet(nn).cursorBlinkRate+"ms"}const $p=Vc({above:!1,markers(n){return n.state.selection.ranges.map(e=>e.empty?[]:mn.forRange(n,"cm-selectionBackground",e)).reduce((e,t)=>e.concat(t))},update(n,e){return n.docChanged||n.selectionSet||n.viewportChanged||zc(n)},class:"cm-selectionLayer"}),qp=ni.highest(T.theme({".cm-line":{"& ::selection, &::selection":{backgroundColor:"transparent !important"},caretColor:"transparent !important"},".cm-content":{caretColor:"transparent !important","& :focus":{caretColor:"initial !important","&::selection, & ::selection":{backgroundColor:"Highlight !important"}}}})),$c=L.define({map(n,e){return n==null?null:e.mapPos(n)}}),$i=ce.define({create(){return null},update(n,e){return n!=null&&(n=e.changes.mapPos(n)),e.effects.reduce((t,i)=>i.is($c)?i.value:t,n)}}),Kp=X.fromClass(class{constructor(n){this.view=n,this.cursor=null,this.measureReq={read:this.readPos.bind(this),write:this.drawCursor.bind(this)}}update(n){var e;let t=n.state.field($i);t==null?this.cursor!=null&&((e=this.cursor)===null||e===void 0||e.remove(),this.cursor=null):(this.cursor||(this.cursor=this.view.scrollDOM.appendChild(document.createElement("div")),this.cursor.className="cm-dropCursor"),(n.startState.field($i)!=t||n.docChanged||n.geometryChanged)&&this.view.requestMeasure(this.measureReq))}readPos(){let{view:n}=this,e=n.state.field($i),t=e!=null&&n.coordsAtPos(e);if(!t)return null;let i=n.scrollDOM.getBoundingClientRect();return{left:t.left-i.left+n.scrollDOM.scrollLeft*n.scaleX,top:t.top-i.top+n.scrollDOM.scrollTop*n.scaleY,height:t.bottom-t.top}}drawCursor(n){if(this.cursor){let{scaleX:e,scaleY:t}=this.view;n?(this.cursor.style.left=n.left/e+"px",this.cursor.style.top=n.top/t+"px",this.cursor.style.height=n.height/t+"px"):this.cursor.style.left="-100000px"}}destroy(){this.cursor&&this.cursor.remove()}setDropPos(n){this.view.state.field($i)!=n&&this.view.dispatch({effects:$c.of(n)})}},{eventObservers:{dragover(n){this.setDropPos(this.view.posAtCoords({x:n.clientX,y:n.clientY}))},dragleave(n){(n.target==this.view.contentDOM||!this.view.contentDOM.contains(n.relatedTarget))&&this.setDropPos(null)},dragend(){this.setDropPos(null)},drop(){this.setDropPos(null)}}});function jp(){return[$i,Kp]}function ga(n,e,t,i,s){e.lastIndex=0;for(let r=n.iterRange(t,i),o=t,l;!r.next().done;o+=r.value.length)if(!r.lineBreak)for(;l=e.exec(r.value);)s(o+l.index,l)}function Up(n,e){let t=n.visibleRanges;if(t.length==1&&t[0].from==n.viewport.from&&t[0].to==n.viewport.to)return t;let i=[];for(let{from:s,to:r}of t)s=Math.max(n.state.doc.lineAt(s).from,s-e),r=Math.min(n.state.doc.lineAt(r).to,r+e),i.length&&i[i.length-1].to>=s?i[i.length-1].to=r:i.push({from:s,to:r});return i}class Gp{constructor(e){const{regexp:t,decoration:i,decorate:s,boundary:r,maxLength:o=1e3}=e;if(!t.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=t,s)this.addMatch=(l,a,h,c)=>s(c,h,h+l[0].length,l,a);else if(typeof i=="function")this.addMatch=(l,a,h,c)=>{let f=i(l,a,h);f&&c(h,h+l[0].length,f)};else if(i)this.addMatch=(l,a,h,c)=>c(h,h+l[0].length,i);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=r,this.maxLength=o}createDeco(e){let t=new pt,i=t.add.bind(t);for(let{from:s,to:r}of Up(e,this.maxLength))ga(e.state.doc,this.regexp,s,r,(o,l)=>this.addMatch(l,e,o,i));return t.finish()}updateDeco(e,t){let i=1e9,s=-1;return e.docChanged&&e.changes.iterChanges((r,o,l,a)=>{a>=e.view.viewport.from&&l<=e.view.viewport.to&&(i=Math.min(l,i),s=Math.max(a,s))}),e.viewportMoved||s-i>1e3?this.createDeco(e.view):s>-1?this.updateRange(e.view,t.map(e.changes),i,s):t}updateRange(e,t,i,s){for(let r of e.visibleRanges){let o=Math.max(r.from,i),l=Math.min(r.to,s);if(l>=o){let a=e.state.doc.lineAt(o),h=a.to<l?e.state.doc.lineAt(l):a,c=Math.max(r.from,a.from),f=Math.min(r.to,h.to);if(this.boundary){for(;o>a.from;o--)if(this.boundary.test(a.text[o-1-a.from])){c=o;break}for(;l<h.to;l++)if(this.boundary.test(h.text[l-h.from])){f=l;break}}let u=[],d,p=(m,b,y)=>u.push(y.range(m,b));if(a==h)for(this.regexp.lastIndex=c-a.from;(d=this.regexp.exec(a.text))&&d.index<f-a.from;)this.addMatch(d,e,d.index+a.from,p);else ga(e.state.doc,this.regexp,c,f,(m,b)=>this.addMatch(b,e,m,p));t=t.update({filterFrom:c,filterTo:f,filter:(m,b)=>m<c||b>f,add:u})}}return t}}const Mo=/x/.unicode!=null?"gu":"g",Qp=new RegExp(`[\0-\b 11 + --Ÿ­؜​‎‏\u2028\u2029‭‮⁦⁧⁩\uFEFF-]`,Mo),Yp={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"};let hr=null;function _p(){var n;if(hr==null&&typeof document<"u"&&document.body){let e=document.body.style;hr=((n=e.tabSize)!==null&&n!==void 0?n:e.MozTabSize)!=null}return hr||!1}const ss=O.define({combine(n){let e=at(n,{render:null,specialChars:Qp,addSpecialChars:null});return(e.replaceTabs=!_p())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Mo)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Mo)),e}});function Xp(n={}){return[ss.of(n),Jp()]}let ma=null;function Jp(){return ma||(ma=X.fromClass(class{constructor(n){this.view=n,this.decorations=B.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(n.state.facet(ss)),this.decorations=this.decorator.createDeco(n)}makeDecorator(n){return new Gp({regexp:n.specialChars,decoration:(e,t,i)=>{let{doc:s}=t.state,r=be(e[0],0);if(r==9){let o=s.lineAt(i),l=t.state.tabSize,a=Di(o.text,l,i-o.from);return B.replace({widget:new ig((l-a%l)*this.view.defaultCharacterWidth/this.view.scaleX)})}return this.decorationCache[r]||(this.decorationCache[r]=B.replace({widget:new tg(n,r)}))},boundary:n.replaceTabs?void 0:/[^]/})}update(n){let e=n.state.facet(ss);n.startState.facet(ss)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(n.view)):this.decorations=this.decorator.updateDeco(n,this.decorations)}},{decorations:n=>n.decorations}))}const Zp="•";function eg(n){return n>=32?Zp:n==10?"␤":String.fromCharCode(9216+n)}class tg extends yt{constructor(e,t){super(),this.options=e,this.code=t}eq(e){return e.code==this.code}toDOM(e){let t=eg(this.code),i=e.state.phrase("Control character")+" "+(Yp[this.code]||"0x"+this.code.toString(16)),s=this.options.render&&this.options.render(this.code,i,t);if(s)return s;let r=document.createElement("span");return r.textContent=t,r.title=i,r.setAttribute("aria-label",i),r.className="cm-specialChar",r}ignoreEvent(){return!1}}class ig extends yt{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}}function ng(){return rg}const sg=B.line({class:"cm-activeLine"}),rg=X.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.docChanged||n.selectionSet)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=-1,t=[];for(let i of n.state.selection.ranges){let s=n.lineBlockAt(i.head);s.from>e&&(t.push(sg.range(s.from)),e=s.from)}return B.set(t)}},{decorations:n=>n.decorations}),To=2e3;function og(n,e,t){let i=Math.min(e.line,t.line),s=Math.max(e.line,t.line),r=[];if(e.off>To||t.off>To||e.col<0||t.col<0){let o=Math.min(e.off,t.off),l=Math.max(e.off,t.off);for(let a=i;a<=s;a++){let h=n.doc.line(a);h.length<=l&&r.push(x.range(h.from+o,h.to+l))}}else{let o=Math.min(e.col,t.col),l=Math.max(e.col,t.col);for(let a=i;a<=s;a++){let h=n.doc.line(a),c=ro(h.text,o,n.tabSize,!0);if(c<0)r.push(x.cursor(h.to));else{let f=ro(h.text,l,n.tabSize);r.push(x.range(h.from+c,h.from+f))}}}return r}function lg(n,e){let t=n.coordsAtPos(n.viewport.from);return t?Math.round(Math.abs((t.left-e)/n.defaultCharacterWidth)):-1}function ba(n,e){let t=n.posAtCoords({x:e.clientX,y:e.clientY},!1),i=n.state.doc.lineAt(t),s=t-i.from,r=s>To?-1:s==i.length?lg(n,e.clientX):Di(i.text,n.state.tabSize,t-i.from);return{line:i.number,col:r,off:s}}function ag(n,e){let t=ba(n,e),i=n.state.selection;return t?{update(s){if(s.docChanged){let r=s.changes.mapPos(s.startState.doc.line(t.line).from),o=s.state.doc.lineAt(r);t={line:o.number,col:t.col,off:Math.min(t.off,o.length)},i=i.map(s.changes)}},get(s,r,o){let l=ba(n,s);if(!l)return i;let a=og(n.state,t,l);return a.length?o?x.create(a.concat(i.ranges)):x.create(a):i}}:null}function hg(n){let e=(t=>t.altKey&&t.button==0);return T.mouseSelectionStyle.of((t,i)=>e(i)?ag(t,i):null)}const cg={Alt:[18,n=>!!n.altKey],Control:[17,n=>!!n.ctrlKey],Shift:[16,n=>!!n.shiftKey],Meta:[91,n=>!!n.metaKey]},fg={style:"cursor: crosshair"};function ug(n={}){let[e,t]=cg[n.key||"Alt"],i=X.fromClass(class{constructor(s){this.view=s,this.isDown=!1}set(s){this.isDown!=s&&(this.isDown=s,this.view.update([]))}},{eventObservers:{keydown(s){this.set(s.keyCode==e||t(s))},keyup(s){(s.keyCode==e||!t(s))&&this.set(!1)},mousemove(s){this.set(t(s))}}});return[i,T.contentAttributes.of(s=>{var r;return!((r=s.plugin(i))===null||r===void 0)&&r.isDown?fg:null})]}const Pn="-10000px";class qc{constructor(e,t,i,s){this.facet=t,this.createTooltipView=i,this.removeTooltipView=s,this.input=e.state.facet(t),this.tooltips=this.input.filter(o=>o);let r=null;this.tooltipViews=this.tooltips.map(o=>r=i(o,r))}update(e,t){var i;let s=e.state.facet(this.facet),r=s.filter(a=>a);if(s===this.input){for(let a of this.tooltipViews)a.update&&a.update(e);return!1}let o=[],l=t?[]:null;for(let a=0;a<r.length;a++){let h=r[a],c=-1;if(h){for(let f=0;f<this.tooltips.length;f++){let u=this.tooltips[f];u&&u.create==h.create&&(c=f)}if(c<0)o[a]=this.createTooltipView(h,a?o[a-1]:null),l&&(l[a]=!!h.above);else{let f=o[a]=this.tooltipViews[c];l&&(l[a]=t[c]),f.update&&f.update(e)}}}for(let a of this.tooltipViews)o.indexOf(a)<0&&(this.removeTooltipView(a),(i=a.destroy)===null||i===void 0||i.call(a));return t&&(l.forEach((a,h)=>t[h]=a),t.length=l.length),this.input=s,this.tooltips=r,this.tooltipViews=o,!0}}function dg(n){let e=n.dom.ownerDocument.documentElement;return{top:0,left:0,bottom:e.clientHeight,right:e.clientWidth}}const cr=O.define({combine:n=>{var e,t,i;return{position:M.ios?"absolute":((e=n.find(s=>s.position))===null||e===void 0?void 0:e.position)||"fixed",parent:((t=n.find(s=>s.parent))===null||t===void 0?void 0:t.parent)||null,tooltipSpace:((i=n.find(s=>s.tooltipSpace))===null||i===void 0?void 0:i.tooltipSpace)||dg}}}),ya=new WeakMap,il=X.fromClass(class{constructor(n){this.view=n,this.above=[],this.inView=!0,this.madeAbsolute=!1,this.lastTransaction=0,this.measureTimeout=-1;let e=n.state.facet(cr);this.position=e.position,this.parent=e.parent,this.classes=n.themeClasses,this.createContainer(),this.measureReq={read:this.readMeasure.bind(this),write:this.writeMeasure.bind(this),key:this},this.resizeObserver=typeof ResizeObserver=="function"?new ResizeObserver(()=>this.measureSoon()):null,this.manager=new qc(n,nl,(t,i)=>this.createTooltip(t,i),t=>{this.resizeObserver&&this.resizeObserver.unobserve(t.dom),t.dom.remove()}),this.above=this.manager.tooltips.map(t=>!!t.above),this.intersectionObserver=typeof IntersectionObserver=="function"?new IntersectionObserver(t=>{Date.now()>this.lastTransaction-50&&t.length>0&&t[t.length-1].intersectionRatio<1&&this.measureSoon()},{threshold:[1]}):null,this.observeIntersection(),n.win.addEventListener("resize",this.measureSoon=this.measureSoon.bind(this)),this.maybeMeasure()}createContainer(){this.parent?(this.container=document.createElement("div"),this.container.style.position="relative",this.container.className=this.view.themeClasses,this.parent.appendChild(this.container)):this.container=this.view.dom}observeIntersection(){if(this.intersectionObserver){this.intersectionObserver.disconnect();for(let n of this.manager.tooltipViews)this.intersectionObserver.observe(n.dom)}}measureSoon(){this.measureTimeout<0&&(this.measureTimeout=setTimeout(()=>{this.measureTimeout=-1,this.maybeMeasure()},50))}update(n){n.transactions.length&&(this.lastTransaction=Date.now());let e=this.manager.update(n,this.above);e&&this.observeIntersection();let t=e||n.geometryChanged,i=n.state.facet(cr);if(i.position!=this.position&&!this.madeAbsolute){this.position=i.position;for(let s of this.manager.tooltipViews)s.dom.style.position=this.position;t=!0}if(i.parent!=this.parent){this.parent&&this.container.remove(),this.parent=i.parent,this.createContainer();for(let s of this.manager.tooltipViews)this.container.appendChild(s.dom);t=!0}else this.parent&&this.view.themeClasses!=this.classes&&(this.classes=this.container.className=this.view.themeClasses);t&&this.maybeMeasure()}createTooltip(n,e){let t=n.create(this.view),i=e?e.dom:null;if(t.dom.classList.add("cm-tooltip"),n.arrow&&!t.dom.querySelector(".cm-tooltip > .cm-tooltip-arrow")){let s=document.createElement("div");s.className="cm-tooltip-arrow",t.dom.appendChild(s)}return t.dom.style.position=this.position,t.dom.style.top=Pn,t.dom.style.left="0px",this.container.insertBefore(t.dom,i),t.mount&&t.mount(this.view),this.resizeObserver&&this.resizeObserver.observe(t.dom),t}destroy(){var n,e,t;this.view.win.removeEventListener("resize",this.measureSoon);for(let i of this.manager.tooltipViews)i.dom.remove(),(n=i.destroy)===null||n===void 0||n.call(i);this.parent&&this.container.remove(),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),(t=this.intersectionObserver)===null||t===void 0||t.disconnect(),clearTimeout(this.measureTimeout)}readMeasure(){let n=1,e=1,t=!1;if(this.position=="fixed"&&this.manager.tooltipViews.length){let{dom:r}=this.manager.tooltipViews[0];if(M.safari){let o=r.getBoundingClientRect();t=Math.abs(o.top+1e4)>1||Math.abs(o.left)>1}else t=!!r.offsetParent&&r.offsetParent!=this.container.ownerDocument.body}if(t||this.position=="absolute")if(this.parent){let r=this.parent.getBoundingClientRect();r.width&&r.height&&(n=r.width/this.parent.offsetWidth,e=r.height/this.parent.offsetHeight)}else({scaleX:n,scaleY:e}=this.view.viewState);let i=this.view.scrollDOM.getBoundingClientRect(),s=Jo(this.view);return{visible:{left:i.left+s.left,top:i.top+s.top,right:i.right-s.right,bottom:i.bottom-s.bottom},parent:this.parent?this.container.getBoundingClientRect():this.view.dom.getBoundingClientRect(),pos:this.manager.tooltips.map((r,o)=>{let l=this.manager.tooltipViews[o];return l.getCoords?l.getCoords(r.pos):this.view.coordsAtPos(r.pos)}),size:this.manager.tooltipViews.map(({dom:r})=>r.getBoundingClientRect()),space:this.view.state.facet(cr).tooltipSpace(this.view),scaleX:n,scaleY:e,makeAbsolute:t}}writeMeasure(n){var e;if(n.makeAbsolute){this.madeAbsolute=!0,this.position="absolute";for(let l of this.manager.tooltipViews)l.dom.style.position="absolute"}let{visible:t,space:i,scaleX:s,scaleY:r}=n,o=[];for(let l=0;l<this.manager.tooltips.length;l++){let a=this.manager.tooltips[l],h=this.manager.tooltipViews[l],{dom:c}=h,f=n.pos[l],u=n.size[l];if(!f||a.clip!==!1&&(f.bottom<=Math.max(t.top,i.top)||f.top>=Math.min(t.bottom,i.bottom)||f.right<Math.max(t.left,i.left)-.1||f.left>Math.min(t.right,i.right)+.1)){c.style.top=Pn;continue}let d=a.arrow?h.dom.querySelector(".cm-tooltip-arrow"):null,p=d?7:0,m=u.right-u.left,b=(e=ya.get(h))!==null&&e!==void 0?e:u.bottom-u.top,y=h.offset||gg,w=this.view.textDirection==j.LTR,k=u.width>i.right-i.left?w?i.left:i.right-u.width:w?Math.max(i.left,Math.min(f.left-(d?14:0)+y.x,i.right-m)):Math.min(Math.max(i.left,f.left-m+(d?14:0)-y.x),i.right-m),D=this.above[l];!a.strictSide&&(D?f.top-b-p-y.y<i.top:f.bottom+b+p+y.y>i.bottom)&&D==i.bottom-f.bottom>f.top-i.top&&(D=this.above[l]=!D);let v=(D?f.top-i.top:i.bottom-f.bottom)-p;if(v<b&&h.resize!==!1){if(v<this.view.defaultLineHeight){c.style.top=Pn;continue}ya.set(h,b),c.style.height=(b=v)/r+"px"}else c.style.height&&(c.style.height="");let S=D?f.top-b-p-y.y:f.bottom+p+y.y,C=k+m;if(h.overlap!==!0)for(let P of o)P.left<C&&P.right>k&&P.top<S+b&&P.bottom>S&&(S=D?P.top-b-2-p:P.bottom+p+2);if(this.position=="absolute"?(c.style.top=(S-n.parent.top)/r+"px",xa(c,(k-n.parent.left)/s)):(c.style.top=S/r+"px",xa(c,k/s)),d){let P=f.left+(w?y.x:-y.x)-(k+14-7);d.style.left=P/s+"px"}h.overlap!==!0&&o.push({left:k,top:S,right:C,bottom:S+b}),c.classList.toggle("cm-tooltip-above",D),c.classList.toggle("cm-tooltip-below",!D),h.positioned&&h.positioned(n.space)}}maybeMeasure(){if(this.manager.tooltips.length&&(this.view.inView&&this.view.requestMeasure(this.measureReq),this.inView!=this.view.inView&&(this.inView=this.view.inView,!this.inView)))for(let n of this.manager.tooltipViews)n.dom.style.top=Pn}},{eventObservers:{scroll(){this.maybeMeasure()}}});function xa(n,e){let t=parseInt(n.style.left,10);(isNaN(t)||Math.abs(e-t)>1)&&(n.style.left=e+"px")}const pg=T.baseTheme({".cm-tooltip":{zIndex:500,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:"14px",position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}}),gg={x:0,y:0},nl=O.define({enables:[il,pg]}),ks=O.define({combine:n=>n.reduce((e,t)=>e.concat(t),[])});class Ks{static create(e){return new Ks(e)}constructor(e){this.view=e,this.mounted=!1,this.dom=document.createElement("div"),this.dom.classList.add("cm-tooltip-hover"),this.manager=new qc(e,ks,(t,i)=>this.createHostedView(t,i),t=>t.dom.remove())}createHostedView(e,t){let i=e.create(this.view);return i.dom.classList.add("cm-tooltip-section"),this.dom.insertBefore(i.dom,t?t.dom.nextSibling:this.dom.firstChild),this.mounted&&i.mount&&i.mount(this.view),i}mount(e){for(let t of this.manager.tooltipViews)t.mount&&t.mount(e);this.mounted=!0}positioned(e){for(let t of this.manager.tooltipViews)t.positioned&&t.positioned(e)}update(e){this.manager.update(e)}destroy(){var e;for(let t of this.manager.tooltipViews)(e=t.destroy)===null||e===void 0||e.call(t)}passProp(e){let t;for(let i of this.manager.tooltipViews){let s=i[e];if(s!==void 0){if(t===void 0)t=s;else if(t!==s)return}}return t}get offset(){return this.passProp("offset")}get getCoords(){return this.passProp("getCoords")}get overlap(){return this.passProp("overlap")}get resize(){return this.passProp("resize")}}const mg=nl.compute([ks],n=>{let e=n.facet(ks);return e.length===0?null:{pos:Math.min(...e.map(t=>t.pos)),end:Math.max(...e.map(t=>{var i;return(i=t.end)!==null&&i!==void 0?i:t.pos})),create:Ks.create,above:e[0].above,arrow:e.some(t=>t.arrow)}});class bg{constructor(e,t,i,s,r){this.view=e,this.source=t,this.field=i,this.setHover=s,this.hoverTime=r,this.hoverTimeout=-1,this.restartTimeout=-1,this.pending=null,this.lastMove={x:0,y:0,target:e.dom,time:0},this.checkHover=this.checkHover.bind(this),e.dom.addEventListener("mouseleave",this.mouseleave=this.mouseleave.bind(this)),e.dom.addEventListener("mousemove",this.mousemove=this.mousemove.bind(this))}update(){this.pending&&(this.pending=null,clearTimeout(this.restartTimeout),this.restartTimeout=setTimeout(()=>this.startHover(),20))}get active(){return this.view.state.field(this.field)}checkHover(){if(this.hoverTimeout=-1,this.active.length)return;let e=Date.now()-this.lastMove.time;e<this.hoverTime?this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime-e):this.startHover()}startHover(){clearTimeout(this.restartTimeout);let{view:e,lastMove:t}=this,i=e.docView.tile.nearest(t.target);if(!i)return;let s,r=1;if(i.isWidget())s=i.posAtStart;else{if(s=e.posAtCoords(t),s==null)return;let l=e.coordsAtPos(s);if(!l||t.y<l.top||t.y>l.bottom||t.x<l.left-e.defaultCharacterWidth||t.x>l.right+e.defaultCharacterWidth)return;let a=e.bidiSpans(e.state.doc.lineAt(s)).find(c=>c.from<=s&&c.to>=s),h=a&&a.dir==j.RTL?-1:1;r=t.x<l.left?-h:h}let o=this.source(e,s,r);if(o?.then){let l=this.pending={pos:s};o.then(a=>{this.pending==l&&(this.pending=null,a&&!(Array.isArray(a)&&!a.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(a)?a:[a])}))},a=>ge(e.state,a,"hover tooltip"))}else o&&!(Array.isArray(o)&&!o.length)&&e.dispatch({effects:this.setHover.of(Array.isArray(o)?o:[o])})}get tooltip(){let e=this.view.plugin(il),t=e?e.manager.tooltips.findIndex(i=>i.create==Ks.create):-1;return t>-1?e.manager.tooltipViews[t]:null}mousemove(e){var t,i;this.lastMove={x:e.clientX,y:e.clientY,target:e.target,time:Date.now()},this.hoverTimeout<0&&(this.hoverTimeout=setTimeout(this.checkHover,this.hoverTime));let{active:s,tooltip:r}=this;if(s.length&&r&&!yg(r.dom,e)||this.pending){let{pos:o}=s[0]||this.pending,l=(i=(t=s[0])===null||t===void 0?void 0:t.end)!==null&&i!==void 0?i:o;(o==l?this.view.posAtCoords(this.lastMove)!=o:!xg(this.view,o,l,e.clientX,e.clientY))&&(this.view.dispatch({effects:this.setHover.of([])}),this.pending=null)}}mouseleave(e){clearTimeout(this.hoverTimeout),this.hoverTimeout=-1;let{active:t}=this;if(t.length){let{tooltip:i}=this;i&&i.dom.contains(e.relatedTarget)?this.watchTooltipLeave(i.dom):this.view.dispatch({effects:this.setHover.of([])})}}watchTooltipLeave(e){let t=i=>{e.removeEventListener("mouseleave",t),this.active.length&&!this.view.dom.contains(i.relatedTarget)&&this.view.dispatch({effects:this.setHover.of([])})};e.addEventListener("mouseleave",t)}destroy(){clearTimeout(this.hoverTimeout),clearTimeout(this.restartTimeout),this.view.dom.removeEventListener("mouseleave",this.mouseleave),this.view.dom.removeEventListener("mousemove",this.mousemove)}}const Ln=4;function yg(n,e){let{left:t,right:i,top:s,bottom:r}=n.getBoundingClientRect(),o;if(o=n.querySelector(".cm-tooltip-arrow")){let l=o.getBoundingClientRect();s=Math.min(l.top,s),r=Math.max(l.bottom,r)}return e.clientX>=t-Ln&&e.clientX<=i+Ln&&e.clientY>=s-Ln&&e.clientY<=r+Ln}function xg(n,e,t,i,s,r){let o=n.scrollDOM.getBoundingClientRect(),l=n.documentTop+n.documentPadding.top+n.contentHeight;if(o.left>i||o.right<i||o.top>s||Math.min(o.bottom,l)<s)return!1;let a=n.posAtCoords({x:i,y:s},!1);return a>=e&&a<=t}function kg(n,e={}){let t=L.define(),i=ce.define({create(){return[]},update(s,r){if(s.length&&(e.hideOnChange&&(r.docChanged||r.selection)?s=[]:e.hideOn&&(s=s.filter(o=>!e.hideOn(r,o))),r.docChanged)){let o=[];for(let l of s){let a=r.changes.mapPos(l.pos,-1,pe.TrackDel);if(a!=null){let h=Object.assign(Object.create(null),l);h.pos=a,h.end!=null&&(h.end=r.changes.mapPos(h.end)),o.push(h)}}s=o}for(let o of r.effects)o.is(t)&&(s=o.value),o.is(wg)&&(s=[]);return s},provide:s=>ks.from(s)});return{active:i,extension:[i,X.define(s=>new bg(s,n,i,t,e.hoverTime||300)),mg]}}function Kc(n,e){let t=n.plugin(il);if(!t)return null;let i=t.manager.tooltips.indexOf(e);return i<0?null:t.manager.tooltipViews[i]}const wg=L.define(),ka=O.define({combine(n){let e,t;for(let i of n)e=e||i.topContainer,t=t||i.bottomContainer;return{topContainer:e,bottomContainer:t}}});function sl(n,e){let t=n.plugin(jc),i=t?t.specs.indexOf(e):-1;return i>-1?t.panels[i]:null}const jc=X.fromClass(class{constructor(n){this.input=n.state.facet(sn),this.specs=this.input.filter(t=>t),this.panels=this.specs.map(t=>t(n));let e=n.state.facet(ka);this.top=new En(n,!0,e.topContainer),this.bottom=new En(n,!1,e.bottomContainer),this.top.sync(this.panels.filter(t=>t.top)),this.bottom.sync(this.panels.filter(t=>!t.top));for(let t of this.panels)t.dom.classList.add("cm-panel"),t.mount&&t.mount()}update(n){let e=n.state.facet(ka);this.top.container!=e.topContainer&&(this.top.sync([]),this.top=new En(n.view,!0,e.topContainer)),this.bottom.container!=e.bottomContainer&&(this.bottom.sync([]),this.bottom=new En(n.view,!1,e.bottomContainer)),this.top.syncClasses(),this.bottom.syncClasses();let t=n.state.facet(sn);if(t!=this.input){let i=t.filter(a=>a),s=[],r=[],o=[],l=[];for(let a of i){let h=this.specs.indexOf(a),c;h<0?(c=a(n.view),l.push(c)):(c=this.panels[h],c.update&&c.update(n)),s.push(c),(c.top?r:o).push(c)}this.specs=i,this.panels=s,this.top.sync(r),this.bottom.sync(o);for(let a of l)a.dom.classList.add("cm-panel"),a.mount&&a.mount()}else for(let i of this.panels)i.update&&i.update(n)}destroy(){this.top.sync([]),this.bottom.sync([])}},{provide:n=>T.scrollMargins.of(e=>{let t=e.plugin(n);return t&&{top:t.top.scrollMargin(),bottom:t.bottom.scrollMargin()}})});class En{constructor(e,t,i){this.view=e,this.top=t,this.container=i,this.dom=void 0,this.classes="",this.panels=[],this.syncClasses()}sync(e){for(let t of this.panels)t.destroy&&e.indexOf(t)<0&&t.destroy();this.panels=e,this.syncDOM()}syncDOM(){if(this.panels.length==0){this.dom&&(this.dom.remove(),this.dom=void 0);return}if(!this.dom){this.dom=document.createElement("div"),this.dom.className=this.top?"cm-panels cm-panels-top":"cm-panels cm-panels-bottom",this.dom.style[this.top?"top":"bottom"]="0";let t=this.container||this.view.dom;t.insertBefore(this.dom,this.top?t.firstChild:null)}let e=this.dom.firstChild;for(let t of this.panels)if(t.dom.parentNode==this.dom){for(;e!=t.dom;)e=wa(e);e=e.nextSibling}else this.dom.insertBefore(t.dom,e);for(;e;)e=wa(e)}scrollMargin(){return!this.dom||this.container?0:Math.max(0,this.top?this.dom.getBoundingClientRect().bottom-Math.max(0,this.view.scrollDOM.getBoundingClientRect().top):Math.min(innerHeight,this.view.scrollDOM.getBoundingClientRect().bottom)-this.dom.getBoundingClientRect().top)}syncClasses(){if(!(!this.container||this.classes==this.view.themeClasses)){for(let e of this.classes.split(" "))e&&this.container.classList.remove(e);for(let e of(this.classes=this.view.themeClasses).split(" "))e&&this.container.classList.add(e)}}}function wa(n){let e=n.nextSibling;return n.remove(),e}const sn=O.define({enables:jc});function vg(n,e){let t,i=new Promise(o=>t=o),s=o=>Sg(o,e,t);n.state.field(fr,!1)?n.dispatch({effects:Uc.of(s)}):n.dispatch({effects:L.appendConfig.of(fr.init(()=>[s]))});let r=Gc.of(s);return{close:r,result:i.then(o=>((n.win.queueMicrotask||(a=>n.win.setTimeout(a,10)))(()=>{n.state.field(fr).indexOf(s)>-1&&n.dispatch({effects:r})}),o))}}const fr=ce.define({create(){return[]},update(n,e){for(let t of e.effects)t.is(Uc)?n=[t.value].concat(n):t.is(Gc)&&(n=n.filter(i=>i!=t.value));return n},provide:n=>sn.computeN([n],e=>e.field(n))}),Uc=L.define(),Gc=L.define();function Sg(n,e,t){let i=e.content?e.content(n,()=>o(null)):null;if(!i){if(i=$("form"),e.input){let l=$("input",e.input);/^(text|password|number|email|tel|url)$/.test(l.type)&&l.classList.add("cm-textfield"),l.name||(l.name="input"),i.appendChild($("label",(e.label||"")+": ",l))}else i.appendChild(document.createTextNode(e.label||""));i.appendChild(document.createTextNode(" ")),i.appendChild($("button",{class:"cm-button",type:"submit"},e.submitLabel||"OK"))}let s=i.nodeName=="FORM"?[i]:i.querySelectorAll("form");for(let l=0;l<s.length;l++){let a=s[l];a.addEventListener("keydown",h=>{h.keyCode==27?(h.preventDefault(),o(null)):h.keyCode==13&&(h.preventDefault(),o(a))}),a.addEventListener("submit",h=>{h.preventDefault(),o(a)})}let r=$("div",i,$("button",{onclick:()=>o(null),"aria-label":n.state.phrase("close"),class:"cm-dialog-close",type:"button"},["×"]));e.class&&(r.className=e.class),r.classList.add("cm-dialog");function o(l){r.contains(r.ownerDocument.activeElement)&&n.focus(),t(l)}return{dom:r,top:e.top,mount:()=>{if(e.focus){let l;typeof e.focus=="string"?l=i.querySelector(e.focus):l=i.querySelector("input")||i.querySelector("button"),l&&"select"in l?l.select():l&&"focus"in l&&l.focus()}}}}class mt extends Tt{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}}mt.prototype.elementClass="";mt.prototype.toDOM=void 0;mt.prototype.mapMode=pe.TrackBefore;mt.prototype.startSide=mt.prototype.endSide=-1;mt.prototype.point=!0;const rs=O.define(),Cg=O.define(),Ag={class:"",renderEmptyElements:!1,elementStyle:"",markers:()=>N.empty,lineMarker:()=>null,widgetMarker:()=>null,lineMarkerChange:null,initialSpacer:null,updateSpacer:null,domEventHandlers:{},side:"before"},Qi=O.define();function Mg(n){return[Qc(),Qi.of({...Ag,...n})]}const va=O.define({combine:n=>n.some(e=>e)});function Qc(n){return[Tg]}const Tg=X.fromClass(class{constructor(n){this.view=n,this.domAfter=null,this.prevViewport=n.viewport,this.dom=document.createElement("div"),this.dom.className="cm-gutters cm-gutters-before",this.dom.setAttribute("aria-hidden","true"),this.dom.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.gutters=n.state.facet(Qi).map(e=>new Ca(n,e)),this.fixed=!n.state.facet(va);for(let e of this.gutters)e.config.side=="after"?this.getDOMAfter().appendChild(e.dom):this.dom.appendChild(e.dom);this.fixed&&(this.dom.style.position="sticky"),this.syncGutters(!1),n.scrollDOM.insertBefore(this.dom,n.contentDOM)}getDOMAfter(){return this.domAfter||(this.domAfter=document.createElement("div"),this.domAfter.className="cm-gutters cm-gutters-after",this.domAfter.setAttribute("aria-hidden","true"),this.domAfter.style.minHeight=this.view.contentHeight/this.view.scaleY+"px",this.domAfter.style.position=this.fixed?"sticky":"",this.view.scrollDOM.appendChild(this.domAfter)),this.domAfter}update(n){if(this.updateGutters(n)){let e=this.prevViewport,t=n.view.viewport,i=Math.min(e.to,t.to)-Math.max(e.from,t.from);this.syncGutters(i<(t.to-t.from)*.8)}if(n.geometryChanged){let e=this.view.contentHeight/this.view.scaleY+"px";this.dom.style.minHeight=e,this.domAfter&&(this.domAfter.style.minHeight=e)}this.view.state.facet(va)!=!this.fixed&&(this.fixed=!this.fixed,this.dom.style.position=this.fixed?"sticky":"",this.domAfter&&(this.domAfter.style.position=this.fixed?"sticky":"")),this.prevViewport=n.view.viewport}syncGutters(n){let e=this.dom.nextSibling;n&&(this.dom.remove(),this.domAfter&&this.domAfter.remove());let t=N.iter(this.view.state.facet(rs),this.view.viewport.from),i=[],s=this.gutters.map(r=>new Og(r,this.view.viewport,-this.view.documentPadding.top));for(let r of this.view.viewportLineBlocks)if(i.length&&(i=[]),Array.isArray(r.type)){let o=!0;for(let l of r.type)if(l.type==le.Text&&o){Oo(t,i,l.from);for(let a of s)a.line(this.view,l,i);o=!1}else if(l.widget)for(let a of s)a.widget(this.view,l)}else if(r.type==le.Text){Oo(t,i,r.from);for(let o of s)o.line(this.view,r,i)}else if(r.widget)for(let o of s)o.widget(this.view,r);for(let r of s)r.finish();n&&(this.view.scrollDOM.insertBefore(this.dom,e),this.domAfter&&this.view.scrollDOM.appendChild(this.domAfter))}updateGutters(n){let e=n.startState.facet(Qi),t=n.state.facet(Qi),i=n.docChanged||n.heightChanged||n.viewportChanged||!N.eq(n.startState.facet(rs),n.state.facet(rs),n.view.viewport.from,n.view.viewport.to);if(e==t)for(let s of this.gutters)s.update(n)&&(i=!0);else{i=!0;let s=[];for(let r of t){let o=e.indexOf(r);o<0?s.push(new Ca(this.view,r)):(this.gutters[o].update(n),s.push(this.gutters[o]))}for(let r of this.gutters)r.dom.remove(),s.indexOf(r)<0&&r.destroy();for(let r of s)r.config.side=="after"?this.getDOMAfter().appendChild(r.dom):this.dom.appendChild(r.dom);this.gutters=s}return i}destroy(){for(let n of this.gutters)n.destroy();this.dom.remove(),this.domAfter&&this.domAfter.remove()}},{provide:n=>T.scrollMargins.of(e=>{let t=e.plugin(n);if(!t||t.gutters.length==0||!t.fixed)return null;let i=t.dom.offsetWidth*e.scaleX,s=t.domAfter?t.domAfter.offsetWidth*e.scaleX:0;return e.textDirection==j.LTR?{left:i,right:s}:{right:i,left:s}})});function Sa(n){return Array.isArray(n)?n:[n]}function Oo(n,e,t){for(;n.value&&n.from<=t;)n.from==t&&e.push(n.value),n.next()}class Og{constructor(e,t,i){this.gutter=e,this.height=i,this.i=0,this.cursor=N.iter(e.markers,t.from)}addElement(e,t,i){let{gutter:s}=this,r=(t.top-this.height)/e.scaleY,o=t.height/e.scaleY;if(this.i==s.elements.length){let l=new Yc(e,o,r,i);s.elements.push(l),s.dom.appendChild(l.dom)}else s.elements[this.i].update(e,o,r,i);this.height=t.bottom,this.i++}line(e,t,i){let s=[];Oo(this.cursor,s,t.from),i.length&&(s=s.concat(i));let r=this.gutter.config.lineMarker(e,t,s);r&&s.unshift(r);let o=this.gutter;s.length==0&&!o.config.renderEmptyElements||this.addElement(e,t,s)}widget(e,t){let i=this.gutter.config.widgetMarker(e,t.widget,t),s=i?[i]:null;for(let r of e.state.facet(Cg)){let o=r(e,t.widget,t);o&&(s||(s=[])).push(o)}s&&this.addElement(e,t,s)}finish(){let e=this.gutter;for(;e.elements.length>this.i;){let t=e.elements.pop();e.dom.removeChild(t.dom),t.destroy()}}}class Ca{constructor(e,t){this.view=e,this.config=t,this.elements=[],this.spacer=null,this.dom=document.createElement("div"),this.dom.className="cm-gutter"+(this.config.class?" "+this.config.class:"");for(let i in t.domEventHandlers)this.dom.addEventListener(i,s=>{let r=s.target,o;if(r!=this.dom&&this.dom.contains(r)){for(;r.parentNode!=this.dom;)r=r.parentNode;let a=r.getBoundingClientRect();o=(a.top+a.bottom)/2}else o=s.clientY;let l=e.lineBlockAtHeight(o-e.documentTop);t.domEventHandlers[i](e,l,s)&&s.preventDefault()});this.markers=Sa(t.markers(e)),t.initialSpacer&&(this.spacer=new Yc(e,0,0,[t.initialSpacer(e)]),this.dom.appendChild(this.spacer.dom),this.spacer.dom.style.cssText+="visibility: hidden; pointer-events: none")}update(e){let t=this.markers;if(this.markers=Sa(this.config.markers(e.view)),this.spacer&&this.config.updateSpacer){let s=this.config.updateSpacer(this.spacer.markers[0],e);s!=this.spacer.markers[0]&&this.spacer.update(e.view,0,0,[s])}let i=e.view.viewport;return!N.eq(this.markers,t,i.from,i.to)||(this.config.lineMarkerChange?this.config.lineMarkerChange(e):!1)}destroy(){for(let e of this.elements)e.destroy()}}class Yc{constructor(e,t,i,s){this.height=-1,this.above=0,this.markers=[],this.dom=document.createElement("div"),this.dom.className="cm-gutterElement",this.update(e,t,i,s)}update(e,t,i,s){this.height!=t&&(this.height=t,this.dom.style.height=t+"px"),this.above!=i&&(this.dom.style.marginTop=(this.above=i)?i+"px":""),Dg(this.markers,s)||this.setMarkers(e,s)}setMarkers(e,t){let i="cm-gutterElement",s=this.dom.firstChild;for(let r=0,o=0;;){let l=o,a=r<t.length?t[r++]:null,h=!1;if(a){let c=a.elementClass;c&&(i+=" "+c);for(let f=o;f<this.markers.length;f++)if(this.markers[f].compare(a)){l=f,h=!0;break}}else l=this.markers.length;for(;o<l;){let c=this.markers[o++];if(c.toDOM){c.destroy(s);let f=s.nextSibling;s.remove(),s=f}}if(!a)break;a.toDOM&&(h?s=s.nextSibling:this.dom.insertBefore(a.toDOM(e),s)),h&&o++}this.dom.className=i,this.markers=t}destroy(){this.setMarkers(null,[])}}function Dg(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].compare(e[t]))return!1;return!0}const Rg=O.define(),Bg=O.define(),ui=O.define({combine(n){return at(n,{formatNumber:String,domEventHandlers:{}},{domEventHandlers(e,t){let i=Object.assign({},e);for(let s in t){let r=i[s],o=t[s];i[s]=r?(l,a,h)=>r(l,a,h)||o(l,a,h):o}return i}})}});class ur extends mt{constructor(e){super(),this.number=e}eq(e){return this.number==e.number}toDOM(){return document.createTextNode(this.number)}}function dr(n,e){return n.state.facet(ui).formatNumber(e,n.state)}const Pg=Qi.compute([ui],n=>({class:"cm-lineNumbers",renderEmptyElements:!1,markers(e){return e.state.facet(Rg)},lineMarker(e,t,i){return i.some(s=>s.toDOM)?null:new ur(dr(e,e.state.doc.lineAt(t.from).number))},widgetMarker:(e,t,i)=>{for(let s of e.state.facet(Bg)){let r=s(e,t,i);if(r)return r}return null},lineMarkerChange:e=>e.startState.facet(ui)!=e.state.facet(ui),initialSpacer(e){return new ur(dr(e,Aa(e.state.doc.lines)))},updateSpacer(e,t){let i=dr(t.view,Aa(t.view.state.doc.lines));return i==e.number?e:new ur(i)},domEventHandlers:n.facet(ui).domEventHandlers,side:"before"}));function Lg(n={}){return[ui.of(n),Qc(),Pg]}function Aa(n){let e=9;for(;e<n;)e=e*10+9;return e}const Eg=new class extends mt{constructor(){super(...arguments),this.elementClass="cm-activeLineGutter"}},Ig=rs.compute(["selection"],n=>{let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.head).from;s>t&&(t=s,e.push(Eg.range(s)))}return N.of(e)});function Ng(){return Ig}const _c=1024;let Wg=0;class pr{constructor(e,t){this.from=e,this.to=t}}class E{constructor(e={}){this.id=Wg++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")}),this.combine=e.combine||null}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=ve.match(e)),t=>{let i=e(t);return i===void 0?null:[this,i]}}}E.closedBy=new E({deserialize:n=>n.split(" ")});E.openedBy=new E({deserialize:n=>n.split(" ")});E.group=new E({deserialize:n=>n.split(" ")});E.isolate=new E({deserialize:n=>{if(n&&n!="rtl"&&n!="ltr"&&n!="auto")throw new RangeError("Invalid value for isolate: "+n);return n||"auto"}});E.contextHash=new E({perNode:!0});E.lookAhead=new E({perNode:!0});E.mounted=new E({perNode:!0});class Yi{constructor(e,t,i,s=!1){this.tree=e,this.overlay=t,this.parser=i,this.bracketed=s}static get(e){return e&&e.props&&e.props[E.mounted.id]}}const Fg=Object.create(null);class ve{constructor(e,t,i,s=0){this.name=e,this.props=t,this.id=i,this.flags=s}static define(e){let t=e.props&&e.props.length?Object.create(null):Fg,i=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),s=new ve(e.name||"",t,e.id,i);if(e.props){for(let r of e.props)if(Array.isArray(r)||(r=r(s)),r){if(r[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");t[r[0].id]=r[1]}}return s}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let t=this.prop(E.group);return t?t.indexOf(e)>-1:!1}return this.id==e}static match(e){let t=Object.create(null);for(let i in e)for(let s of i.split(" "))t[s]=e[i];return i=>{for(let s=i.prop(E.group),r=-1;r<(s?s.length:0);r++){let o=t[r<0?i.name:s[r]];if(o)return o}}}}ve.none=new ve("",Object.create(null),0,8);class rl{constructor(e){this.types=e;for(let t=0;t<e.length;t++)if(e[t].id!=t)throw new RangeError("Node type ids should correspond to array positions when creating a node set")}extend(...e){let t=[];for(let i of this.types){let s=null;for(let r of e){let o=r(i);if(o){s||(s=Object.assign({},i.props));let l=o[1],a=o[0];a.combine&&a.id in s&&(l=a.combine(s[a.id],l)),s[a.id]=l}}t.push(s?new ve(i.name,s,i.id,i.flags):i)}return new rl(t)}}const In=new WeakMap,Ma=new WeakMap;var Y;(function(n){n[n.ExcludeBuffers=1]="ExcludeBuffers",n[n.IncludeAnonymous=2]="IncludeAnonymous",n[n.IgnoreMounts=4]="IgnoreMounts",n[n.IgnoreOverlays=8]="IgnoreOverlays",n[n.EnterBracketed=16]="EnterBracketed"})(Y||(Y={}));class Z{constructor(e,t,i,s,r){if(this.type=e,this.children=t,this.positions=i,this.length=s,this.props=null,r&&r.length){this.props=Object.create(null);for(let[o,l]of r)this.props[typeof o=="number"?o:o.id]=l}}toString(){let e=Yi.get(this);if(e&&!e.overlay)return e.tree.toString();let t="";for(let i of this.children){let s=i.toString();s&&(t&&(t+=","),t+=s)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(t.length?"("+t+")":""):t}cursor(e=0){return new Ro(this.topNode,e)}cursorAt(e,t=0,i=0){let s=In.get(this)||this.topNode,r=new Ro(s);return r.moveTo(e,t),In.set(this,r._tree),r}get topNode(){return new Ne(this,0,0,null)}resolve(e,t=0){let i=rn(In.get(this)||this.topNode,e,t,!1);return In.set(this,i),i}resolveInner(e,t=0){let i=rn(Ma.get(this)||this.topNode,e,t,!0);return Ma.set(this,i),i}resolveStack(e,t=0){return zg(this,e,t)}iterate(e){let{enter:t,leave:i,from:s=0,to:r=this.length}=e,o=e.mode||0,l=(o&Y.IncludeAnonymous)>0;for(let a=this.cursor(o|Y.IncludeAnonymous);;){let h=!1;if(a.from<=r&&a.to>=s&&(!l&&a.type.isAnonymous||t(a)!==!1)){if(a.firstChild())continue;h=!0}for(;h&&i&&(l||!a.type.isAnonymous)&&i(a),!a.nextSibling();){if(!a.parent())return;h=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let t in this.props)e.push([+t,this.props[t]]);return e}balance(e={}){return this.children.length<=8?this:al(ve.none,this.children,this.positions,0,this.children.length,0,this.length,(t,i,s)=>new Z(this.type,t,i,s,this.propValues),e.makeTree||((t,i,s)=>new Z(ve.none,t,i,s)))}static build(e){return $g(e)}}Z.empty=new Z(ve.none,[],[],0);class ol{constructor(e,t){this.buffer=e,this.index=t}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new ol(this.buffer,this.index)}}class Bt{constructor(e,t,i){this.buffer=e,this.length=t,this.set=i}get type(){return ve.none}toString(){let e=[];for(let t=0;t<this.buffer.length;)e.push(this.childString(t)),t=this.buffer[t+3];return e.join(",")}childString(e){let t=this.buffer[e],i=this.buffer[e+3],s=this.set.types[t],r=s.name;if(/\W/.test(r)&&!s.isError&&(r=JSON.stringify(r)),e+=4,i==e)return r;let o=[];for(;e<i;)o.push(this.childString(e)),e=this.buffer[e+3];return r+"("+o.join(",")+")"}findChild(e,t,i,s,r){let{buffer:o}=this,l=-1;for(let a=e;a!=t&&!(Xc(r,s,o[a+1],o[a+2])&&(l=a,i>0));a=o[a+3]);return l}slice(e,t,i){let s=this.buffer,r=new Uint16Array(t-e),o=0;for(let l=e,a=0;l<t;){r[a++]=s[l++],r[a++]=s[l++]-i;let h=r[a++]=s[l++]-i;r[a++]=s[l++]-e,o=Math.max(o,h)}return new Bt(r,o,this.set)}}function Xc(n,e,t,i){switch(n){case-2:return t<e;case-1:return i>=e&&t<e;case 0:return t<e&&i>e;case 1:return t<=e&&i>e;case 2:return i>e;case 4:return!0}}function rn(n,e,t,i){for(var s;n.from==n.to||(t<1?n.from>=e:n.from>e)||(t>-1?n.to<=e:n.to<e);){let o=!i&&n instanceof Ne&&n.index<0?null:n.parent;if(!o)return n;n=o}let r=i?0:Y.IgnoreOverlays;if(i)for(let o=n,l=o.parent;l;o=l,l=o.parent)o instanceof Ne&&o.index<0&&((s=l.enter(e,t,r))===null||s===void 0?void 0:s.from)!=o.from&&(n=l);for(;;){let o=n.enter(e,t,r);if(!o)return n;n=o}}class Jc{cursor(e=0){return new Ro(this,e)}getChild(e,t=null,i=null){let s=Ta(this,e,t,i);return s.length?s[0]:null}getChildren(e,t=null,i=null){return Ta(this,e,t,i)}resolve(e,t=0){return rn(this,e,t,!1)}resolveInner(e,t=0){return rn(this,e,t,!0)}matchContext(e){return Do(this.parent,e)}enterUnfinishedNodesBefore(e){let t=this.childBefore(e),i=this;for(;t;){let s=t.lastChild;if(!s||s.to!=t.to)break;s.type.isError&&s.from==s.to?(i=t,t=s.prevSibling):t=s}return i}get node(){return this}get next(){return this.parent}}class Ne extends Jc{constructor(e,t,i,s){super(),this._tree=e,this.from=t,this.index=i,this._parent=s}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,t,i,s,r=0){for(let o=this;;){for(let{children:l,positions:a}=o._tree,h=t>0?l.length:-1;e!=h;e+=t){let c=l[e],f=a[e]+o.from,u;if(!(!(r&Y.EnterBracketed&&c instanceof Z&&(u=Yi.get(c))&&!u.overlay&&u.bracketed&&i>=f&&i<=f+c.length)&&!Xc(s,i,f,f+c.length))){if(c instanceof Bt){if(r&Y.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,t,i-f,s);if(d>-1)return new Ct(new Hg(o,c,e,f),null,d)}else if(r&Y.IncludeAnonymous||!c.type.isAnonymous||ll(c)){let d;if(!(r&Y.IgnoreMounts)&&(d=Yi.get(c))&&!d.overlay)return new Ne(d.tree,f,e,o);let p=new Ne(c,f,e,o);return r&Y.IncludeAnonymous||!p.type.isAnonymous?p:p.nextChild(t<0?c.children.length-1:0,t,i,s,r)}}}if(r&Y.IncludeAnonymous||!o.type.isAnonymous||(o.index>=0?e=o.index+t:e=t<0?-1:o._parent._tree.children.length,o=o._parent,!o))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}prop(e){return this._tree.prop(e)}enter(e,t,i=0){let s;if(!(i&Y.IgnoreOverlays)&&(s=Yi.get(this._tree))&&s.overlay){let r=e-this.from,o=i&Y.EnterBracketed&&s.bracketed;for(let{from:l,to:a}of s.overlay)if((t>0||o?l<=r:l<r)&&(t<0||o?a>=r:a>r))return new Ne(s.tree,s.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,t,i)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}get tree(){return this._tree}toTree(){return this._tree}toString(){return this._tree.toString()}}function Ta(n,e,t,i){let s=n.cursor(),r=[];if(!s.firstChild())return r;if(t!=null){for(let o=!1;!o;)if(o=s.type.is(t),!s.nextSibling())return r}for(;;){if(i!=null&&s.type.is(i))return r;if(s.type.is(e)&&r.push(s.node),!s.nextSibling())return i==null?r:[]}}function Do(n,e,t=e.length-1){for(let i=n;t>=0;i=i.parent){if(!i)return!1;if(!i.type.isAnonymous){if(e[t]&&e[t]!=i.name)return!1;t--}}return!0}class Hg{constructor(e,t,i,s){this.parent=e,this.buffer=t,this.index=i,this.start=s}}class Ct extends Jc{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,t,i){super(),this.context=e,this._parent=t,this.index=i,this.type=e.buffer.set.types[e.buffer.buffer[i]]}child(e,t,i){let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.context.start,i);return r<0?null:new Ct(this.context,this,r)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}prop(e){return this.type.prop(e)}enter(e,t,i=0){if(i&Y.ExcludeBuffers)return null;let{buffer:s}=this.context,r=s.findChild(this.index+4,s.buffer[this.index+3],t>0?1:-1,e-this.context.start,t);return r<0?null:new Ct(this.context,this,r)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,t=e.buffer[this.index+3];return t<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new Ct(this.context,this._parent,t):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,t=this._parent?this._parent.index+4:0;return this.index==t?this.externalSibling(-1):new Ct(this.context,this._parent,e.findChild(t,this.index,-1,0,4))}get tree(){return null}toTree(){let e=[],t=[],{buffer:i}=this.context,s=this.index+4,r=i.buffer[this.index+3];if(r>s){let o=i.buffer[this.index+1];e.push(i.slice(s,r,o)),t.push(0)}return new Z(this.type,e,t,this.to-this.from)}toString(){return this.context.buffer.childString(this.index)}}function Zc(n){if(!n.length)return null;let e=0,t=n[0];for(let r=1;r<n.length;r++){let o=n[r];(o.from>t.from||o.to<t.to)&&(t=o,e=r)}let i=t instanceof Ne&&t.index<0?null:t.parent,s=n.slice();return i?s[e]=i:s.splice(e,1),new Vg(s,t)}class Vg{constructor(e,t){this.heads=e,this.node=t}get next(){return Zc(this.heads)}}function zg(n,e,t){let i=n.resolveInner(e,t),s=null;for(let r=i instanceof Ne?i:i.context.parent;r;r=r.parent)if(r.index<0){let o=r.parent;(s||(s=[i])).push(o.resolve(e,t)),r=o}else{let o=Yi.get(r.tree);if(o&&o.overlay&&o.overlay[0].from<=e&&o.overlay[o.overlay.length-1].to>=e){let l=new Ne(o.tree,o.overlay[0].from+r.from,-1,r);(s||(s=[i])).push(rn(l,e,t,!1))}}return s?Zc(s):i}class Ro{get name(){return this.type.name}constructor(e,t=0){if(this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,this.mode=t&~Y.EnterBracketed,e instanceof Ne)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let i=e._parent;i;i=i._parent)this.stack.unshift(i.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,t){this.index=e;let{start:i,buffer:s}=this.buffer;return this.type=t||s.set.types[s.buffer[e]],this.from=i+s.buffer[e+1],this.to=i+s.buffer[e+2],!0}yield(e){return e?e instanceof Ne?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,t,i){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,t,i,this.mode));let{buffer:s}=this.buffer,r=s.findChild(this.index+4,s.buffer[this.index+3],e,t-this.buffer.start,i);return r<0?!1:(this.stack.push(this.index),this.yieldBuf(r))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,t,i=this.mode){return this.buffer?i&Y.ExcludeBuffers?!1:this.enterChild(1,e,t):this.yield(this._tree.enter(e,t,i))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Y.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Y.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:t}=this.buffer,i=this.stack.length-1;if(e<0){let s=i<0?0:this.stack[i]+4;if(this.index!=s)return this.yieldBuf(t.findChild(s,this.index,-1,0,4))}else{let s=t.buffer[this.index+3];if(s<(i<0?t.buffer.length:t.buffer[this.stack[i]+3]))return this.yieldBuf(s)}return i<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let t,i,{buffer:s}=this;if(s){if(e>0){if(this.index<s.buffer.buffer.length)return!1}else for(let r=0;r<this.index;r++)if(s.buffer.buffer[r+3]<this.index)return!1;({index:t,parent:i}=s)}else({index:t,_parent:i}=this._tree);for(;i;{index:t,_parent:i}=i)if(t>-1)for(let r=t+e,o=e<0?-1:i._tree.children.length;r!=o;r+=e){let l=i._tree.children[r];if(this.mode&Y.IncludeAnonymous||l instanceof Bt||!l.type.isAnonymous||ll(l))return!1}return!0}move(e,t){if(t&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,t=0){for(;(this.from==this.to||(t<1?this.from>=e:this.from>e)||(t>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,t););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,t=null,i=0;if(e&&e.context==this.buffer)e:for(let s=this.index,r=this.stack.length;r>=0;){for(let o=e;o;o=o._parent)if(o.index==s){if(s==this.index)return o;t=o,i=r+1;break e}s=this.stack[--r]}for(let s=i;s<this.stack.length;s++)t=new Ct(this.buffer,t,this.stack[s]);return this.bufferNode=new Ct(this.buffer,t,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,t){for(let i=0;;){let s=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){i++;continue}this.type.isAnonymous||(s=!0)}for(;;){if(s&&t&&t(this),s=this.type.isAnonymous,!i)return;if(this.nextSibling())break;this.parent(),i--,s=!0}}}matchContext(e){if(!this.buffer)return Do(this.node.parent,e);let{buffer:t}=this.buffer,{types:i}=t.set;for(let s=e.length-1,r=this.stack.length-1;s>=0;r--){if(r<0)return Do(this._tree,e,s);let o=i[t.buffer[this.stack[r]]];if(!o.isAnonymous){if(e[s]&&e[s]!=o.name)return!1;s--}}return!0}}function ll(n){return n.children.some(e=>e instanceof Bt||!e.type.isAnonymous||ll(e))}function $g(n){var e;let{buffer:t,nodeSet:i,maxBufferLength:s=_c,reused:r=[],minRepeatType:o=i.types.length}=n,l=Array.isArray(t)?new ol(t,t.length):t,a=i.types,h=0,c=0;function f(v,S,C,P,W,q){let{id:I,start:R,end:z,size:V}=l,U=c,ue=h;if(V<0)if(l.next(),V==-1){let ht=r[I];C.push(ht),P.push(R-v);return}else if(V==-3){h=I;return}else if(V==-4){c=I;return}else throw new RangeError(`Unrecognized record size: ${V}`);let Se=a[I],Ue,se,Oe=R-v;if(z-R<=s&&(se=b(l.pos-S,W))){let ht=new Uint16Array(se.size-se.skip),De=l.pos-se.size,Ge=ht.length;for(;l.pos>De;)Ge=y(se.start,ht,Ge);Ue=new Bt(ht,z-se.start,i),Oe=se.start-v}else{let ht=l.pos-V;l.next();let De=[],Ge=[],It=I>=o?I:-1,si=0,kn=z;for(;l.pos>ht;)It>=0&&l.id==It&&l.size>=0?(l.end<=kn-s&&(p(De,Ge,R,si,l.end,kn,It,U,ue),si=De.length,kn=l.end),l.next()):q>2500?u(R,ht,De,Ge):f(R,ht,De,Ge,It,q+1);if(It>=0&&si>0&&si<De.length&&p(De,Ge,R,si,R,kn,It,U,ue),De.reverse(),Ge.reverse(),It>-1&&si>0){let Ml=d(Se,ue);Ue=al(Se,De,Ge,0,De.length,0,z-R,Ml,Ml)}else Ue=m(Se,De,Ge,z-R,U-z,ue)}C.push(Ue),P.push(Oe)}function u(v,S,C,P){let W=[],q=0,I=-1;for(;l.pos>S;){let{id:R,start:z,end:V,size:U}=l;if(U>4)l.next();else{if(I>-1&&z<I)break;I<0&&(I=V-s),W.push(R,z,V),q++,l.next()}}if(q){let R=new Uint16Array(q*4),z=W[W.length-2];for(let V=W.length-3,U=0;V>=0;V-=3)R[U++]=W[V],R[U++]=W[V+1]-z,R[U++]=W[V+2]-z,R[U++]=U;C.push(new Bt(R,W[2]-z,i)),P.push(z-v)}}function d(v,S){return(C,P,W)=>{let q=0,I=C.length-1,R,z;if(I>=0&&(R=C[I])instanceof Z){if(!I&&R.type==v&&R.length==W)return R;(z=R.prop(E.lookAhead))&&(q=P[I]+R.length+z)}return m(v,C,P,W,q,S)}}function p(v,S,C,P,W,q,I,R,z){let V=[],U=[];for(;v.length>P;)V.push(v.pop()),U.push(S.pop()+C-W);v.push(m(i.types[I],V,U,q-W,R-q,z)),S.push(W-C)}function m(v,S,C,P,W,q,I){if(q){let R=[E.contextHash,q];I=I?[R].concat(I):[R]}if(W>25){let R=[E.lookAhead,W];I=I?[R].concat(I):[R]}return new Z(v,S,C,P,I)}function b(v,S){let C=l.fork(),P=0,W=0,q=0,I=C.end-s,R={size:0,start:0,skip:0};e:for(let z=C.pos-v;C.pos>z;){let V=C.size;if(C.id==S&&V>=0){R.size=P,R.start=W,R.skip=q,q+=4,P+=4,C.next();continue}let U=C.pos-V;if(V<0||U<z||C.start<I)break;let ue=C.id>=o?4:0,Se=C.start;for(C.next();C.pos>U;){if(C.size<0)if(C.size==-3||C.size==-4)ue+=4;else break e;else C.id>=o&&(ue+=4);C.next()}W=Se,P+=V,q+=ue}return(S<0||P==v)&&(R.size=P,R.start=W,R.skip=q),R.size>4?R:void 0}function y(v,S,C){let{id:P,start:W,end:q,size:I}=l;if(l.next(),I>=0&&P<o){let R=C;if(I>4){let z=l.pos-(I-4);for(;l.pos>z;)C=y(v,S,C)}S[--C]=R,S[--C]=q-v,S[--C]=W-v,S[--C]=P}else I==-3?h=P:I==-4&&(c=P);return C}let w=[],k=[];for(;l.pos>0;)f(n.start||0,n.bufferStart||0,w,k,-1,0);let D=(e=n.length)!==null&&e!==void 0?e:w.length?k[0]+w[0].length:0;return new Z(a[n.topID],w.reverse(),k.reverse(),D)}const Oa=new WeakMap;function os(n,e){if(!n.isAnonymous||e instanceof Bt||e.type!=n)return 1;let t=Oa.get(e);if(t==null){t=1;for(let i of e.children){if(i.type!=n||!(i instanceof Z)){t=1;break}t+=os(n,i)}Oa.set(e,t)}return t}function al(n,e,t,i,s,r,o,l,a){let h=0;for(let p=i;p<s;p++)h+=os(n,e[p]);let c=Math.ceil(h*1.5/8),f=[],u=[];function d(p,m,b,y,w){for(let k=b;k<y;){let D=k,v=m[k],S=os(n,p[k]);for(k++;k<y;k++){let C=os(n,p[k]);if(S+C>=c)break;S+=C}if(k==D+1){if(S>c){let C=p[D];d(C.children,C.positions,0,C.children.length,m[D]+w);continue}f.push(p[D])}else{let C=m[k-1]+p[k-1].length-v;f.push(al(n,p,m,D,k,v,C,null,a))}u.push(v+w-r)}}return d(e,t,i,s,0),(l||a)(f,u,o)}class Xt{constructor(e,t,i,s,r=!1,o=!1){this.from=e,this.to=t,this.tree=i,this.offset=s,this.open=(r?1:0)|(o?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,t=[],i=!1){let s=[new Xt(0,e.length,e,0,!1,i)];for(let r of t)r.to>e.length&&s.push(r);return s}static applyChanges(e,t,i=128){if(!t.length)return e;let s=[],r=1,o=e.length?e[0]:null;for(let l=0,a=0,h=0;;l++){let c=l<t.length?t[l]:null,f=c?c.fromA:1e9;if(f-a>=i)for(;o&&o.from<f;){let u=o;if(a>=u.from||f<=u.to||h){let d=Math.max(u.from,a)-h,p=Math.min(u.to,f)-h;u=d>=p?null:new Xt(d,p,u.tree,u.offset+h,l>0,!!c)}if(u&&s.push(u),o.to>f)break;o=r<e.length?e[r++]:null}if(!c)break;a=c.toA,h=c.toA-c.toB}return s}}class ef{startParse(e,t,i){return typeof e=="string"&&(e=new qg(e)),i=i?i.length?i.map(s=>new pr(s.from,s.to)):[new pr(0,0)]:[new pr(0,e.length)],this.createParse(e,t||[],i)}parse(e,t,i){let s=this.startParse(e,t,i);for(;;){let r=s.advance();if(r)return r}}}class qg{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,t){return this.string.slice(e,t)}}new E({perNode:!0});let Kg=0;class Pe{constructor(e,t,i,s){this.name=e,this.set=t,this.base=i,this.modified=s,this.id=Kg++}toString(){let{name:e}=this;for(let t of this.modified)t.name&&(e=`${t.name}(${e})`);return e}static define(e,t){let i=typeof e=="string"?e:"?";if(e instanceof Pe&&(t=e),t?.base)throw new Error("Can not derive from a modified tag");let s=new Pe(i,[],null,[]);if(s.set.push(s),t)for(let r of t.set)s.set.push(r);return s}static defineModifier(e){let t=new ws(e);return i=>i.modified.indexOf(t)>-1?i:ws.get(i.base||i,i.modified.concat(t).sort((s,r)=>s.id-r.id))}}let jg=0;class ws{constructor(e){this.name=e,this.instances=[],this.id=jg++}static get(e,t){if(!t.length)return e;let i=t[0].instances.find(l=>l.base==e&&Ug(t,l.modified));if(i)return i;let s=[],r=new Pe(e.name,s,e,t);for(let l of t)l.instances.push(r);let o=Gg(t);for(let l of e.set)if(!l.modified.length)for(let a of o)s.push(ws.get(l,a));return r}}function Ug(n,e){return n.length==e.length&&n.every((t,i)=>t==e[i])}function Gg(n){let e=[[]];for(let t=0;t<n.length;t++)for(let i=0,s=e.length;i<s;i++)e.push(e[i].concat(n[t]));return e.sort((t,i)=>i.length-t.length)}function tf(n){let e=Object.create(null);for(let t in n){let i=n[t];Array.isArray(i)||(i=[i]);for(let s of t.split(" "))if(s){let r=[],o=2,l=s;for(let f=0;;){if(l=="..."&&f>0&&f+3==s.length){o=1;break}let u=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!u)throw new RangeError("Invalid path: "+s);if(r.push(u[0]=="*"?"":u[0][0]=='"'?JSON.parse(u[0]):u[0]),f+=u[0].length,f==s.length)break;let d=s[f++];if(f==s.length&&d=="!"){o=0;break}if(d!="/")throw new RangeError("Invalid path: "+s);l=s.slice(f)}let a=r.length-1,h=r[a];if(!h)throw new RangeError("Invalid path: "+s);let c=new on(i,o,a>0?r.slice(0,a):null);e[h]=c.sort(e[h])}}return nf.add(e)}const nf=new E({combine(n,e){let t,i,s;for(;n||e;){if(!n||e&&n.depth>=e.depth?(s=e,e=e.next):(s=n,n=n.next),t&&t.mode==s.mode&&!s.context&&!t.context)continue;let r=new on(s.tags,s.mode,s.context);t?t.next=r:i=r,t=r}return i}});class on{constructor(e,t,i,s){this.tags=e,this.mode=t,this.context=i,this.next=s}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}}on.empty=new on([],2,null);function sf(n,e){let t=Object.create(null);for(let r of n)if(!Array.isArray(r.tag))t[r.tag.id]=r.class;else for(let o of r.tag)t[o.id]=r.class;let{scope:i,all:s=null}=e||{};return{style:r=>{let o=s;for(let l of r)for(let a of l.set){let h=t[a.id];if(h){o=o?o+" "+h:h;break}}return o},scope:i}}function Qg(n,e){let t=null;for(let i of n){let s=i.style(e);s&&(t=t?t+" "+s:s)}return t}function Yg(n,e,t,i=0,s=n.length){let r=new _g(i,Array.isArray(e)?e:[e],t);r.highlightRange(n.cursor(),i,s,"",r.highlighters),r.flush(s)}class _g{constructor(e,t,i){this.at=e,this.highlighters=t,this.span=i,this.class=""}startSpan(e,t){t!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=t)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,t,i,s,r){let{type:o,from:l,to:a}=e;if(l>=i||a<=t)return;o.isTop&&(r=this.highlighters.filter(d=>!d.scope||d.scope(o)));let h=s,c=Xg(e)||on.empty,f=Qg(r,c.tags);if(f&&(h&&(h+=" "),h+=f,c.mode==1&&(s+=(s?" ":"")+f)),this.startSpan(Math.max(t,l),h),c.opaque)return;let u=e.tree&&e.tree.prop(E.mounted);if(u&&u.overlay){let d=e.node.enter(u.overlay[0].from+l,1),p=this.highlighters.filter(b=>!b.scope||b.scope(u.tree.type)),m=e.firstChild();for(let b=0,y=l;;b++){let w=b<u.overlay.length?u.overlay[b]:null,k=w?w.from+l:a,D=Math.max(t,y),v=Math.min(i,k);if(D<v&&m)for(;e.from<v&&(this.highlightRange(e,D,v,s,r),this.startSpan(Math.min(v,e.to),h),!(e.to>=k||!e.nextSibling())););if(!w||k>i)break;y=w.to+l,y>t&&(this.highlightRange(d.cursor(),Math.max(t,w.from+l),Math.min(i,y),"",p),this.startSpan(Math.min(i,y),h))}m&&e.parent()}else if(e.firstChild()){u&&(s="");do if(!(e.to<=t)){if(e.from>=i)break;this.highlightRange(e,t,i,s,r),this.startSpan(Math.min(i,e.to),h)}while(e.nextSibling());e.parent()}}}function Xg(n){let e=n.type.prop(nf);for(;e&&e.context&&!n.matchContext(e.context);)e=e.next;return e||null}const A=Pe.define,Nn=A(),kt=A(),Da=A(kt),Ra=A(kt),wt=A(),Wn=A(wt),gr=A(wt),Xe=A(),Nt=A(Xe),Ye=A(),_e=A(),Bo=A(),Ii=A(Bo),Fn=A(),g={comment:Nn,lineComment:A(Nn),blockComment:A(Nn),docComment:A(Nn),name:kt,variableName:A(kt),typeName:Da,tagName:A(Da),propertyName:Ra,attributeName:A(Ra),className:A(kt),labelName:A(kt),namespace:A(kt),macroName:A(kt),literal:wt,string:Wn,docString:A(Wn),character:A(Wn),attributeValue:A(Wn),number:gr,integer:A(gr),float:A(gr),bool:A(wt),regexp:A(wt),escape:A(wt),color:A(wt),url:A(wt),keyword:Ye,self:A(Ye),null:A(Ye),atom:A(Ye),unit:A(Ye),modifier:A(Ye),operatorKeyword:A(Ye),controlKeyword:A(Ye),definitionKeyword:A(Ye),moduleKeyword:A(Ye),operator:_e,derefOperator:A(_e),arithmeticOperator:A(_e),logicOperator:A(_e),bitwiseOperator:A(_e),compareOperator:A(_e),updateOperator:A(_e),definitionOperator:A(_e),typeOperator:A(_e),controlOperator:A(_e),punctuation:Bo,separator:A(Bo),bracket:Ii,angleBracket:A(Ii),squareBracket:A(Ii),paren:A(Ii),brace:A(Ii),content:Xe,heading:Nt,heading1:A(Nt),heading2:A(Nt),heading3:A(Nt),heading4:A(Nt),heading5:A(Nt),heading6:A(Nt),contentSeparator:A(Xe),list:A(Xe),quote:A(Xe),emphasis:A(Xe),strong:A(Xe),link:A(Xe),monospace:A(Xe),strikethrough:A(Xe),inserted:A(),deleted:A(),changed:A(),invalid:A(),meta:Fn,documentMeta:A(Fn),annotation:A(Fn),processingInstruction:A(Fn),definition:Pe.defineModifier("definition"),constant:Pe.defineModifier("constant"),function:Pe.defineModifier("function"),standard:Pe.defineModifier("standard"),local:Pe.defineModifier("local"),special:Pe.defineModifier("special")};for(let n in g){let e=g[n];e instanceof Pe&&(e.name=n)}sf([{tag:g.link,class:"tok-link"},{tag:g.heading,class:"tok-heading"},{tag:g.emphasis,class:"tok-emphasis"},{tag:g.strong,class:"tok-strong"},{tag:g.keyword,class:"tok-keyword"},{tag:g.atom,class:"tok-atom"},{tag:g.bool,class:"tok-bool"},{tag:g.url,class:"tok-url"},{tag:g.labelName,class:"tok-labelName"},{tag:g.inserted,class:"tok-inserted"},{tag:g.deleted,class:"tok-deleted"},{tag:g.literal,class:"tok-literal"},{tag:g.string,class:"tok-string"},{tag:g.number,class:"tok-number"},{tag:[g.regexp,g.escape,g.special(g.string)],class:"tok-string2"},{tag:g.variableName,class:"tok-variableName"},{tag:g.local(g.variableName),class:"tok-variableName tok-local"},{tag:g.definition(g.variableName),class:"tok-variableName tok-definition"},{tag:g.special(g.variableName),class:"tok-variableName2"},{tag:g.definition(g.propertyName),class:"tok-propertyName tok-definition"},{tag:g.typeName,class:"tok-typeName"},{tag:g.namespace,class:"tok-namespace"},{tag:g.className,class:"tok-className"},{tag:g.macroName,class:"tok-macroName"},{tag:g.propertyName,class:"tok-propertyName"},{tag:g.operator,class:"tok-operator"},{tag:g.comment,class:"tok-comment"},{tag:g.meta,class:"tok-meta"},{tag:g.invalid,class:"tok-invalid"},{tag:g.punctuation,class:"tok-punctuation"}]);var mr;const di=new E;function Jg(n){return O.define({combine:n?e=>e.concat(n):void 0})}const Zg=new E;class $e{constructor(e,t,i=[],s=""){this.data=e,this.name=s,H.prototype.hasOwnProperty("tree")||Object.defineProperty(H.prototype,"tree",{get(){return he(this)}}),this.parser=t,this.extension=[Pt.of(this),H.languageData.of((r,o,l)=>{let a=Ba(r,o,l),h=a.type.prop(di);if(!h)return[];let c=r.facet(h),f=a.type.prop(Zg);if(f){let u=a.resolve(o-a.from,l);for(let d of f)if(d.test(u,r)){let p=r.facet(d.facet);return d.type=="replace"?p:p.concat(c)}}return c})].concat(i)}isActiveAt(e,t,i=-1){return Ba(e,t,i).type.prop(di)==this.data}findRegions(e){let t=e.facet(Pt);if(t?.data==this.data)return[{from:0,to:e.doc.length}];if(!t||!t.allowsNesting)return[];let i=[],s=(r,o)=>{if(r.prop(di)==this.data){i.push({from:o,to:o+r.length});return}let l=r.prop(E.mounted);if(l){if(l.tree.prop(di)==this.data){if(l.overlay)for(let a of l.overlay)i.push({from:a.from+o,to:a.to+o});else i.push({from:o,to:o+r.length});return}else if(l.overlay){let a=i.length;if(s(l.tree,l.overlay[0].from+o),i.length>a)return}}for(let a=0;a<r.children.length;a++){let h=r.children[a];h instanceof Z&&s(h,r.positions[a]+o)}};return s(he(e),0),i}get allowsNesting(){return!0}}$e.setState=L.define();function Ba(n,e,t){let i=n.facet(Pt),s=he(n).topNode;if(!i||i.allowsNesting)for(let r=s;r;r=r.enter(e,t,Y.ExcludeBuffers|Y.EnterBracketed))r.type.isTop&&(s=r);return s}class vs extends $e{constructor(e,t,i){super(e,t,[],i),this.parser=t}static define(e){let t=Jg(e.languageData);return new vs(t,e.parser.configure({props:[di.add(i=>i.isTop?t:void 0)]}),e.name)}configure(e,t){return new vs(this.data,this.parser.configure(e),t||this.name)}get allowsNesting(){return this.parser.hasWrappers()}}function he(n){let e=n.field($e.state,!1);return e?e.tree:Z.empty}class em{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,t){let i=this.cursorPos-this.string.length;return e<i||t>=this.cursorPos?this.doc.sliceString(e,t):this.string.slice(e-i,t-i)}}let Ni=null;class Ss{constructor(e,t,i=[],s,r,o,l,a){this.parser=e,this.state=t,this.fragments=i,this.tree=s,this.treeLen=r,this.viewport=o,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,t,i){return new Ss(e,t,[],Z.empty,0,i,[],null)}startParse(){return this.parser.startParse(new em(this.state.doc),this.fragments)}work(e,t){return t!=null&&t>=this.state.doc.length&&(t=void 0),this.tree!=Z.empty&&this.isDone(t??this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var i;if(typeof e=="number"){let s=Date.now()+e;e=()=>Date.now()>s}for(this.parse||(this.parse=this.startParse()),t!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>t)&&t<this.state.doc.length&&this.parse.stopAt(t);;){let s=this.parse.advance();if(s)if(this.fragments=this.withoutTempSkipped(Xt.addTree(s,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(i=this.parse.stoppedAt)!==null&&i!==void 0?i:this.state.doc.length,this.tree=s,this.parse=null,this.treeLen<(t??this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,t;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(t=this.parse.advance()););}),this.treeLen=e,this.tree=t,this.fragments=this.withoutTempSkipped(Xt.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let t=Ni;Ni=this;try{return e()}finally{Ni=t}}withoutTempSkipped(e){for(let t;t=this.tempSkipped.pop();)e=Pa(e,t.from,t.to);return e}changes(e,t){let{fragments:i,tree:s,treeLen:r,viewport:o,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((h,c,f,u)=>a.push({fromA:h,toA:c,fromB:f,toB:u})),i=Xt.applyChanges(i,a),s=Z.empty,r=0,o={from:e.mapPos(o.from,-1),to:e.mapPos(o.to,1)},this.skipped.length){l=[];for(let h of this.skipped){let c=e.mapPos(h.from,1),f=e.mapPos(h.to,-1);c<f&&l.push({from:c,to:f})}}}return new Ss(this.parser,t,i,s,r,o,l,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let t=this.skipped.length;for(let i=0;i<this.skipped.length;i++){let{from:s,to:r}=this.skipped[i];s<e.to&&r>e.from&&(this.fragments=Pa(this.fragments,s,r),this.skipped.splice(i--,1))}return this.skipped.length>=t?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,t){this.skipped.push({from:e,to:t})}static getSkippingParser(e){return new class extends ef{createParse(t,i,s){let r=s[0].from,o=s[s.length-1].to;return{parsedPos:r,advance(){let a=Ni;if(a){for(let h of s)a.tempSkipped.push(h);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=o,new Z(ve.none,[],[],o-r)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let t=this.fragments;return this.treeLen>=e&&t.length&&t[0].from==0&&t[0].to>=e}static get(){return Ni}}function Pa(n,e,t){return Xt.applyChanges(n,[{fromA:e,toA:t,fromB:e,toB:t}])}class Ti{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let t=this.context.changes(e.changes,e.state),i=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),t.viewport.to);return t.work(20,i)||t.takeTree(),new Ti(t)}static init(e){let t=Math.min(3e3,e.doc.length),i=Ss.create(e.facet(Pt).parser,e,{from:0,to:t});return i.work(20,t)||i.takeTree(),new Ti(i)}}$e.state=ce.define({create:Ti.init,update(n,e){for(let t of e.effects)if(t.is($e.setState))return t.value;return e.startState.facet(Pt)!=e.state.facet(Pt)?Ti.init(e.state):n.apply(e)}});let rf=n=>{let e=setTimeout(()=>n(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(rf=n=>{let e=-1,t=setTimeout(()=>{e=requestIdleCallback(n,{timeout:400})},100);return()=>e<0?clearTimeout(t):cancelIdleCallback(e)});const br=typeof navigator<"u"&&(!((mr=navigator.scheduling)===null||mr===void 0)&&mr.isInputPending)?()=>navigator.scheduling.isInputPending():null,tm=X.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let t=this.view.state.field($e.state).context;(t.updateViewport(e.view.viewport)||this.view.viewport.to>t.treeLen)&&this.scheduleWork(),(e.docChanged||e.selectionSet)&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(t)}scheduleWork(){if(this.working)return;let{state:e}=this.view,t=e.field($e.state);(t.tree!=t.context.tree||!t.context.isDone(e.doc.length))&&(this.working=rf(this.work))}work(e){this.working=null;let t=Date.now();if(this.chunkEnd<t&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=t+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:i,viewport:{to:s}}=this.view,r=i.field($e.state);if(r.tree==r.context.tree&&r.context.isDone(s+1e5))return;let o=Date.now()+Math.min(this.chunkBudget,100,e&&!br?Math.max(25,e.timeRemaining()-5):1e9),l=r.context.treeLen<s&&i.doc.length>s+1e3,a=r.context.work(()=>br&&br()||Date.now()>o,s+(l?0:1e5));this.chunkBudget-=Date.now()-t,(a||this.chunkBudget<=0)&&(r.context.takeTree(),this.view.dispatch({effects:$e.setState.of(new Ti(r.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(r.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(t=>ge(this.view.state,t)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Pt=O.define({combine(n){return n.length?n[0]:null},enables:n=>[$e.state,tm,T.contentAttributes.compute([n],e=>{let t=e.facet(n);return t&&t.name?{"data-language":t.name}:{}})]});class im{constructor(e,t=[]){this.language=e,this.support=t,this.extension=[e,t]}}const nm=O.define(),hl=O.define({combine:n=>{if(!n.length)return" ";let e=n[0];if(!e||/\S/.test(e)||Array.from(e).some(t=>t!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(n[0]));return e}});function Cs(n){let e=n.facet(hl);return e.charCodeAt(0)==9?n.tabSize*e.length:e.length}function ln(n,e){let t="",i=n.tabSize,s=n.facet(hl)[0];if(s==" "){for(;e>=i;)t+=" ",e-=i;s=" "}for(let r=0;r<e;r++)t+=s;return t}function cl(n,e){n instanceof H&&(n=new js(n));for(let i of n.state.facet(nm)){let s=i(n,e);if(s!==void 0)return s}let t=he(n.state);return t.length>=e?sm(n,t,e):null}class js{constructor(e,t={}){this.state=e,this.options=t,this.unit=Cs(e)}lineAt(e,t=1){let i=this.state.doc.lineAt(e),{simulateBreak:s,simulateDoubleBreak:r}=this.options;return s!=null&&s>=i.from&&s<=i.to?r&&s==e?{text:"",from:e}:(t<0?s<e:s<=e)?{text:i.text.slice(s-i.from),from:s}:{text:i.text.slice(0,s-i.from),from:i.from}:i}textAfterPos(e,t=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:i,from:s}=this.lineAt(e,t);return i.slice(e-s,Math.min(i.length,e+100-s))}column(e,t=1){let{text:i,from:s}=this.lineAt(e,t),r=this.countColumn(i,e-s),o=this.options.overrideIndentation?this.options.overrideIndentation(s):-1;return o>-1&&(r+=o-this.countColumn(i,i.search(/\S|$/))),r}countColumn(e,t=e.length){return Di(e,this.state.tabSize,t)}lineIndent(e,t=1){let{text:i,from:s}=this.lineAt(e,t),r=this.options.overrideIndentation;if(r){let o=r(s);if(o>-1)return o}return this.countColumn(i,i.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}}const of=new E;function sm(n,e,t){let i=e.resolveStack(t),s=e.resolveInner(t,-1).resolve(t,0).enterUnfinishedNodesBefore(t);if(s!=i.node){let r=[];for(let o=s;o&&!(o.from<i.node.from||o.to>i.node.to||o.from==i.node.from&&o.type==i.node.type);o=o.parent)r.push(o);for(let o=r.length-1;o>=0;o--)i={node:r[o],next:i}}return lf(i,n,t)}function lf(n,e,t){for(let i=n;i;i=i.next){let s=om(i.node);if(s)return s(fl.create(e,t,i))}return 0}function rm(n){return n.pos==n.options.simulateBreak&&n.options.simulateDoubleBreak}function om(n){let e=n.type.prop(of);if(e)return e;let t=n.firstChild,i;if(t&&(i=t.type.prop(E.closedBy))){let s=n.lastChild,r=s&&i.indexOf(s.name)>-1;return o=>cm(o,!0,1,void 0,r&&!rm(o)?s.from:void 0)}return n.parent==null?lm:null}function lm(){return 0}class fl extends js{constructor(e,t,i){super(e.state,e.options),this.base=e,this.pos=t,this.context=i}get node(){return this.context.node}static create(e,t,i){return new fl(e,t,i)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let t=this.state.doc.lineAt(e.from);for(;;){let i=e.resolve(t.from);for(;i.parent&&i.parent.from==i.from;)i=i.parent;if(am(i,e))break;t=this.state.doc.lineAt(i.from)}return this.lineIndent(t.from)}continue(){return lf(this.context.next,this.base,this.pos)}}function am(n,e){for(let t=e;t;t=t.parent)if(n==t)return!0;return!1}function hm(n){let e=n.node,t=e.childAfter(e.from),i=e.lastChild;if(!t)return null;let s=n.options.simulateBreak,r=n.state.doc.lineAt(t.from),o=s==null||s<=r.from?r.to:Math.min(r.to,s);for(let l=t.to;;){let a=e.childAfter(l);if(!a||a==i)return null;if(!a.type.isSkipped){if(a.from>=o)return null;let h=/^ */.exec(r.text.slice(t.to-r.from))[0].length;return{from:t.from,to:t.to+h}}l=a.to}}function cm(n,e,t,i,s){let r=n.textAfter,o=r.match(/^\s*/)[0].length,l=i&&r.slice(o,o+i.length)==i||s==n.pos+o,a=hm(n);return a?l?n.column(a.from):n.column(a.to):n.baseIndent+(l?0:n.unit*t)}function La({except:n,units:e=1}={}){return t=>{let i=n&&n.test(t.textAfter);return t.baseIndent+(i?0:e*t.unit)}}const fm=200;function um(){return H.transactionFilter.of(n=>{if(!n.docChanged||!n.isUserEvent("input.type")&&!n.isUserEvent("input.complete"))return n;let e=n.startState.languageDataAt("indentOnInput",n.startState.selection.main.head);if(!e.length)return n;let t=n.newDoc,{head:i}=n.newSelection.main,s=t.lineAt(i);if(i>s.from+fm)return n;let r=t.sliceString(s.from,i);if(!e.some(h=>h.test(r)))return n;let{state:o}=n,l=-1,a=[];for(let{head:h}of o.selection.ranges){let c=o.doc.lineAt(h);if(c.from==l)continue;l=c.from;let f=cl(o,c.from);if(f==null)continue;let u=/^\s*/.exec(c.text)[0],d=ln(o,f);u!=d&&a.push({from:c.from,to:c.from+u.length,insert:d})}return a.length?[n,{changes:a,sequential:!0}]:n})}const dm=O.define(),af=new E;function pm(n){let e=n.firstChild,t=n.lastChild;return e&&e.to<t.from?{from:e.to,to:t.type.isError?n.to:t.from}:null}function gm(n,e,t){let i=he(n);if(i.length<t)return null;let s=i.resolveStack(t,1),r=null;for(let o=s;o;o=o.next){let l=o.node;if(l.to<=t||l.from>t)continue;if(r&&l.from<e)break;let a=l.type.prop(af);if(a&&(l.to<i.length-50||i.length==n.doc.length||!mm(l))){let h=a(l,n);h&&h.from<=t&&h.from>=e&&h.to>t&&(r=h)}}return r}function mm(n){let e=n.lastChild;return e&&e.to==n.to&&e.type.isError}function As(n,e,t){for(let i of n.facet(dm)){let s=i(n,e,t);if(s)return s}return gm(n,e,t)}function hf(n,e){let t=e.mapPos(n.from,1),i=e.mapPos(n.to,-1);return t>=i?void 0:{from:t,to:i}}const Us=L.define({map:hf}),bn=L.define({map:hf});function cf(n){let e=[];for(let{head:t}of n.state.selection.ranges)e.some(i=>i.from<=t&&i.to>=t)||e.push(n.lineBlockAt(t));return e}const ii=ce.define({create(){return B.none},update(n,e){e.isUserEvent("delete")&&e.changes.iterChangedRanges((t,i)=>n=Ea(n,t,i)),n=n.map(e.changes);for(let t of e.effects)if(t.is(Us)&&!bm(n,t.value.from,t.value.to)){let{preparePlaceholder:i}=e.state.facet(df),s=i?B.replace({widget:new Cm(i(e.state,t.value))}):Ia;n=n.update({add:[s.range(t.value.from,t.value.to)]})}else t.is(bn)&&(n=n.update({filter:(i,s)=>t.value.from!=i||t.value.to!=s,filterFrom:t.value.from,filterTo:t.value.to}));return e.selection&&(n=Ea(n,e.selection.main.head)),n},provide:n=>T.decorations.from(n),toJSON(n,e){let t=[];return n.between(0,e.doc.length,(i,s)=>{t.push(i,s)}),t},fromJSON(n){if(!Array.isArray(n)||n.length%2)throw new RangeError("Invalid JSON for fold state");let e=[];for(let t=0;t<n.length;){let i=n[t++],s=n[t++];if(typeof i!="number"||typeof s!="number")throw new RangeError("Invalid JSON for fold state");e.push(Ia.range(i,s))}return B.set(e,!0)}});function Ea(n,e,t=e){let i=!1;return n.between(e,t,(s,r)=>{s<t&&r>e&&(i=!0)}),i?n.update({filterFrom:e,filterTo:t,filter:(s,r)=>s>=t||r<=e}):n}function Ms(n,e,t){var i;let s=null;return(i=n.field(ii,!1))===null||i===void 0||i.between(e,t,(r,o)=>{(!s||s.from>r)&&(s={from:r,to:o})}),s}function bm(n,e,t){let i=!1;return n.between(e,e,(s,r)=>{s==e&&r==t&&(i=!0)}),i}function ff(n,e){return n.field(ii,!1)?e:e.concat(L.appendConfig.of(pf()))}const ym=n=>{for(let e of cf(n)){let t=As(n.state,e.from,e.to);if(t)return n.dispatch({effects:ff(n.state,[Us.of(t),uf(n,t)])}),!0}return!1},xm=n=>{if(!n.state.field(ii,!1))return!1;let e=[];for(let t of cf(n)){let i=Ms(n.state,t.from,t.to);i&&e.push(bn.of(i),uf(n,i,!1))}return e.length&&n.dispatch({effects:e}),e.length>0};function uf(n,e,t=!0){let i=n.state.doc.lineAt(e.from).number,s=n.state.doc.lineAt(e.to).number;return T.announce.of(`${n.state.phrase(t?"Folded lines":"Unfolded lines")} ${i} ${n.state.phrase("to")} ${s}.`)}const km=n=>{let{state:e}=n,t=[];for(let i=0;i<e.doc.length;){let s=n.lineBlockAt(i),r=As(e,s.from,s.to);r&&t.push(Us.of(r)),i=(r?n.lineBlockAt(r.to):s).to+1}return t.length&&n.dispatch({effects:ff(n.state,t)}),!!t.length},wm=n=>{let e=n.state.field(ii,!1);if(!e||!e.size)return!1;let t=[];return e.between(0,n.state.doc.length,(i,s)=>{t.push(bn.of({from:i,to:s}))}),n.dispatch({effects:t}),!0},vm=[{key:"Ctrl-Shift-[",mac:"Cmd-Alt-[",run:ym},{key:"Ctrl-Shift-]",mac:"Cmd-Alt-]",run:xm},{key:"Ctrl-Alt-[",run:km},{key:"Ctrl-Alt-]",run:wm}],Sm={placeholderDOM:null,preparePlaceholder:null,placeholderText:"…"},df=O.define({combine(n){return at(n,Sm)}});function pf(n){return[ii,Tm]}function gf(n,e){let{state:t}=n,i=t.facet(df),s=o=>{let l=n.lineBlockAt(n.posAtDOM(o.target)),a=Ms(n.state,l.from,l.to);a&&n.dispatch({effects:bn.of(a)}),o.preventDefault()};if(i.placeholderDOM)return i.placeholderDOM(n,s,e);let r=document.createElement("span");return r.textContent=i.placeholderText,r.setAttribute("aria-label",t.phrase("folded code")),r.title=t.phrase("unfold"),r.className="cm-foldPlaceholder",r.onclick=s,r}const Ia=B.replace({widget:new class extends yt{toDOM(n){return gf(n,null)}}});class Cm extends yt{constructor(e){super(),this.value=e}eq(e){return this.value==e.value}toDOM(e){return gf(e,this.value)}}const Am={openText:"⌄",closedText:"›",markerDOM:null,domEventHandlers:{},foldingChanged:()=>!1};class yr extends mt{constructor(e,t){super(),this.config=e,this.open=t}eq(e){return this.config==e.config&&this.open==e.open}toDOM(e){if(this.config.markerDOM)return this.config.markerDOM(this.open);let t=document.createElement("span");return t.textContent=this.open?this.config.openText:this.config.closedText,t.title=e.state.phrase(this.open?"Fold line":"Unfold line"),t}}function Mm(n={}){let e={...Am,...n},t=new yr(e,!0),i=new yr(e,!1),s=X.fromClass(class{constructor(o){this.from=o.viewport.from,this.markers=this.buildMarkers(o)}update(o){(o.docChanged||o.viewportChanged||o.startState.facet(Pt)!=o.state.facet(Pt)||o.startState.field(ii,!1)!=o.state.field(ii,!1)||he(o.startState)!=he(o.state)||e.foldingChanged(o))&&(this.markers=this.buildMarkers(o.view))}buildMarkers(o){let l=new pt;for(let a of o.viewportLineBlocks){let h=Ms(o.state,a.from,a.to)?i:As(o.state,a.from,a.to)?t:null;h&&l.add(a.from,a.from,h)}return l.finish()}}),{domEventHandlers:r}=e;return[s,Mg({class:"cm-foldGutter",markers(o){var l;return((l=o.plugin(s))===null||l===void 0?void 0:l.markers)||N.empty},initialSpacer(){return new yr(e,!1)},domEventHandlers:{...r,click:(o,l,a)=>{if(r.click&&r.click(o,l,a))return!0;let h=Ms(o.state,l.from,l.to);if(h)return o.dispatch({effects:bn.of(h)}),!0;let c=As(o.state,l.from,l.to);return c?(o.dispatch({effects:Us.of(c)}),!0):!1}}}),pf()]}const Tm=T.baseTheme({".cm-foldPlaceholder":{backgroundColor:"#eee",border:"1px solid #ddd",color:"#888",borderRadius:".2em",margin:"0 1px",padding:"0 1px",cursor:"pointer"},".cm-foldGutter span":{padding:"0 1px",cursor:"pointer"}});class Ri{constructor(e,t){this.specs=e;let i;function s(l){let a=Ot.newName();return(i||(i=Object.create(null)))["."+a]=l,a}const r=typeof t.all=="string"?t.all:t.all?s(t.all):void 0,o=t.scope;this.scope=o instanceof $e?l=>l.prop(di)==o.data:o?l=>l==o:void 0,this.style=sf(e.map(l=>({tag:l.tag,class:l.class||s(Object.assign({},l,{tag:null}))})),{all:r}).style,this.module=i?new Ot(i):null,this.themeType=t.themeType}static define(e,t){return new Ri(e,t||{})}}const Po=O.define(),mf=O.define({combine(n){return n.length?[n[0]]:null}});function xr(n){let e=n.facet(Po);return e.length?e:n.facet(mf)}function ul(n,e){let t=[Dm],i;return n instanceof Ri&&(n.module&&t.push(T.styleModule.of(n.module)),i=n.themeType),e?.fallback?t.push(mf.of(n)):i?t.push(Po.computeN([T.darkTheme],s=>s.facet(T.darkTheme)==(i=="dark")?[n]:[])):t.push(Po.of(n)),t}class Om{constructor(e){this.markCache=Object.create(null),this.tree=he(e.state),this.decorations=this.buildDeco(e,xr(e.state)),this.decoratedTo=e.viewport.to}update(e){let t=he(e.state),i=xr(e.state),s=i!=xr(e.startState),{viewport:r}=e.view,o=e.changes.mapPos(this.decoratedTo,1);t.length<r.to&&!s&&t.type==this.tree.type&&o>=r.to?(this.decorations=this.decorations.map(e.changes),this.decoratedTo=o):(t!=this.tree||e.viewportChanged||s)&&(this.tree=t,this.decorations=this.buildDeco(e.view,i),this.decoratedTo=r.to)}buildDeco(e,t){if(!t||!this.tree.length)return B.none;let i=new pt;for(let{from:s,to:r}of e.visibleRanges)Yg(this.tree,t,(o,l,a)=>{i.add(o,l,this.markCache[a]||(this.markCache[a]=B.mark({class:a})))},s,r);return i.finish()}}const Dm=ni.high(X.fromClass(Om,{decorations:n=>n.decorations})),Rm=Ri.define([{tag:g.meta,color:"#404740"},{tag:g.link,textDecoration:"underline"},{tag:g.heading,textDecoration:"underline",fontWeight:"bold"},{tag:g.emphasis,fontStyle:"italic"},{tag:g.strong,fontWeight:"bold"},{tag:g.strikethrough,textDecoration:"line-through"},{tag:g.keyword,color:"#708"},{tag:[g.atom,g.bool,g.url,g.contentSeparator,g.labelName],color:"#219"},{tag:[g.literal,g.inserted],color:"#164"},{tag:[g.string,g.deleted],color:"#a11"},{tag:[g.regexp,g.escape,g.special(g.string)],color:"#e40"},{tag:g.definition(g.variableName),color:"#00f"},{tag:g.local(g.variableName),color:"#30a"},{tag:[g.typeName,g.namespace],color:"#085"},{tag:g.className,color:"#167"},{tag:[g.special(g.variableName),g.macroName],color:"#256"},{tag:g.definition(g.propertyName),color:"#00c"},{tag:g.comment,color:"#940"},{tag:g.invalid,color:"#f00"}]),Bm=T.baseTheme({"&.cm-focused .cm-matchingBracket":{backgroundColor:"#328c8252"},"&.cm-focused .cm-nonmatchingBracket":{backgroundColor:"#bb555544"}}),bf=1e4,yf="()[]{}",xf=O.define({combine(n){return at(n,{afterCursor:!0,brackets:yf,maxScanDistance:bf,renderMatch:Em})}}),Pm=B.mark({class:"cm-matchingBracket"}),Lm=B.mark({class:"cm-nonmatchingBracket"});function Em(n){let e=[],t=n.matched?Pm:Lm;return e.push(t.range(n.start.from,n.start.to)),n.end&&e.push(t.range(n.end.from,n.end.to)),e}function Na(n){let e=[],t=n.facet(xf);for(let i of n.selection.ranges){if(!i.empty)continue;let s=st(n,i.head,-1,t)||i.head>0&&st(n,i.head-1,1,t)||t.afterCursor&&(st(n,i.head,1,t)||i.head<n.doc.length&&st(n,i.head+1,-1,t));s&&(e=e.concat(t.renderMatch(s,n)))}return B.set(e,!0)}const Im=X.fromClass(class{constructor(n){this.paused=!1,this.decorations=Na(n.state)}update(n){(n.docChanged||n.selectionSet||this.paused)&&(n.view.composing?(this.decorations=this.decorations.map(n.changes),this.paused=!0):(this.decorations=Na(n.state),this.paused=!1))}},{decorations:n=>n.decorations}),Nm=[Im,Bm];function Wm(n={}){return[xf.of(n),Nm]}const Fm=new E;function Lo(n,e,t){let i=n.prop(e<0?E.openedBy:E.closedBy);if(i)return i;if(n.name.length==1){let s=t.indexOf(n.name);if(s>-1&&s%2==(e<0?1:0))return[t[s+e]]}return null}function Eo(n){let e=n.type.prop(Fm);return e?e(n.node):n}function st(n,e,t,i={}){let s=i.maxScanDistance||bf,r=i.brackets||yf,o=he(n),l=o.resolveInner(e,t);for(let a=l;a;a=a.parent){let h=Lo(a.type,t,r);if(h&&a.from<a.to){let c=Eo(a);if(c&&(t>0?e>=c.from&&e<c.to:e>c.from&&e<=c.to))return Hm(n,e,t,a,c,h,r)}}return Vm(n,e,t,o,l.type,s,r)}function Hm(n,e,t,i,s,r,o){let l=i.parent,a={from:s.from,to:s.to},h=0,c=l?.cursor();if(c&&(t<0?c.childBefore(i.from):c.childAfter(i.to)))do if(t<0?c.to<=i.from:c.from>=i.to){if(h==0&&r.indexOf(c.type.name)>-1&&c.from<c.to){let f=Eo(c);return{start:a,end:f?{from:f.from,to:f.to}:void 0,matched:!0}}else if(Lo(c.type,t,o))h++;else if(Lo(c.type,-t,o)){if(h==0){let f=Eo(c);return{start:a,end:f&&f.from<f.to?{from:f.from,to:f.to}:void 0,matched:!1}}h--}}while(t<0?c.prevSibling():c.nextSibling());return{start:a,matched:!1}}function Vm(n,e,t,i,s,r,o){let l=t<0?n.sliceDoc(e-1,e):n.sliceDoc(e,e+1),a=o.indexOf(l);if(a<0||a%2==0!=t>0)return null;let h={from:t<0?e-1:e,to:t>0?e+1:e},c=n.doc.iterRange(e,t>0?n.doc.length:0),f=0;for(let u=0;!c.next().done&&u<=r;){let d=c.value;t<0&&(u+=d.length);let p=e+u*t;for(let m=t>0?0:d.length-1,b=t>0?d.length:-1;m!=b;m+=t){let y=o.indexOf(d[m]);if(!(y<0||i.resolveInner(p+m,1).type!=s))if(y%2==0==t>0)f++;else{if(f==1)return{start:h,end:{from:p+m,to:p+m+1},matched:y>>1==a>>1};f--}}t>0&&(u+=d.length)}return c.done?{start:h,matched:!1}:null}const zm=Object.create(null),Wa=[ve.none],Fa=[],Ha=Object.create(null),$m=Object.create(null);for(let[n,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])$m[n]=qm(zm,e);function kr(n,e){Fa.indexOf(n)>-1||(Fa.push(n),console.warn(e))}function qm(n,e){let t=[];for(let l of e.split(" ")){let a=[];for(let h of l.split(".")){let c=n[h]||g[h];c?typeof c=="function"?a.length?a=a.map(c):kr(h,`Modifier ${h} used at start of tag`):a.length?kr(h,`Tag ${h} used as modifier`):a=Array.isArray(c)?c:[c]:kr(h,`Unknown highlighting tag ${h}`)}for(let h of a)t.push(h)}if(!t.length)return 0;let i=e.replace(/ /g,"_"),s=i+" "+t.map(l=>l.id),r=Ha[s];if(r)return r.id;let o=Ha[s]=ve.define({id:Wa.length,name:i,props:[tf({[i]:t})]});return Wa.push(o),o.id}j.RTL,j.LTR;const Km=n=>{let{state:e}=n,t=e.doc.lineAt(e.selection.main.from),i=pl(n.state,t.from);return i.line?jm(n):i.block?Gm(n):!1};function dl(n,e){return({state:t,dispatch:i})=>{if(t.readOnly)return!1;let s=n(e,t);return s?(i(t.update(s)),!0):!1}}const jm=dl(_m,0),Um=dl(kf,0),Gm=dl((n,e)=>kf(n,e,Ym(e)),0);function pl(n,e){let t=n.languageDataAt("commentTokens",e,1);return t.length?t[0]:{}}const Wi=50;function Qm(n,{open:e,close:t},i,s){let r=n.sliceDoc(i-Wi,i),o=n.sliceDoc(s,s+Wi),l=/\s*$/.exec(r)[0].length,a=/^\s*/.exec(o)[0].length,h=r.length-l;if(r.slice(h-e.length,h)==e&&o.slice(a,a+t.length)==t)return{open:{pos:i-l,margin:l&&1},close:{pos:s+a,margin:a&&1}};let c,f;s-i<=2*Wi?c=f=n.sliceDoc(i,s):(c=n.sliceDoc(i,i+Wi),f=n.sliceDoc(s-Wi,s));let u=/^\s*/.exec(c)[0].length,d=/\s*$/.exec(f)[0].length,p=f.length-d-t.length;return c.slice(u,u+e.length)==e&&f.slice(p,p+t.length)==t?{open:{pos:i+u+e.length,margin:/\s/.test(c.charAt(u+e.length))?1:0},close:{pos:s-d-t.length,margin:/\s/.test(f.charAt(p-1))?1:0}}:null}function Ym(n){let e=[];for(let t of n.selection.ranges){let i=n.doc.lineAt(t.from),s=t.to<=i.to?i:n.doc.lineAt(t.to);s.from>i.from&&s.from==t.to&&(s=t.to==i.to+1?i:n.doc.lineAt(t.to-1));let r=e.length-1;r>=0&&e[r].to>i.from?e[r].to=s.to:e.push({from:i.from+/^\s*/.exec(i.text)[0].length,to:s.to})}return e}function kf(n,e,t=e.selection.ranges){let i=t.map(r=>pl(e,r.from).block);if(!i.every(r=>r))return null;let s=t.map((r,o)=>Qm(e,i[o],r.from,r.to));if(n!=2&&!s.every(r=>r))return{changes:e.changes(t.map((r,o)=>s[o]?[]:[{from:r.from,insert:i[o].open+" "},{from:r.to,insert:" "+i[o].close}]))};if(n!=1&&s.some(r=>r)){let r=[];for(let o=0,l;o<s.length;o++)if(l=s[o]){let a=i[o],{open:h,close:c}=l;r.push({from:h.pos-a.open.length,to:h.pos+h.margin},{from:c.pos-c.margin,to:c.pos+a.close.length})}return{changes:r}}return null}function _m(n,e,t=e.selection.ranges){let i=[],s=-1;e:for(let{from:r,to:o}of t){let l=i.length,a=1e9,h;for(let c=r;c<=o;){let f=e.doc.lineAt(c);if(h==null&&(h=pl(e,f.from).line,!h))continue e;if(f.from>s&&(r==o||o>f.from)){s=f.from;let u=/^\s*/.exec(f.text)[0].length,d=u==f.length,p=f.text.slice(u,u+h.length)==h?u:-1;u<f.text.length&&u<a&&(a=u),i.push({line:f,comment:p,token:h,indent:u,empty:d,single:!1})}c=f.to+1}if(a<1e9)for(let c=l;c<i.length;c++)i[c].indent<i[c].line.text.length&&(i[c].indent=a);i.length==l+1&&(i[l].single=!0)}if(n!=2&&i.some(r=>r.comment<0&&(!r.empty||r.single))){let r=[];for(let{line:l,token:a,indent:h,empty:c,single:f}of i)(f||!c)&&r.push({from:l.from+h,insert:a+" "});let o=e.changes(r);return{changes:o,selection:e.selection.map(o,1)}}else if(n!=1&&i.some(r=>r.comment>=0)){let r=[];for(let{line:o,comment:l,token:a}of i)if(l>=0){let h=o.from+l,c=h+a.length;o.text[c-o.from]==" "&&c++,r.push({from:h,to:c})}return{changes:r}}return null}const Io=bt.define(),Xm=bt.define(),Jm=O.define(),wf=O.define({combine(n){return at(n,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(i,s)=>e(i,s)||t(i,s)})}}),vf=ce.define({create(){return rt.empty},update(n,e){let t=e.state.facet(wf),i=e.annotation(Io);if(i){let a=ke.fromTransaction(e,i.selection),h=i.side,c=h==0?n.undone:n.done;return a?c=Ts(c,c.length,t.minDepth,a):c=Af(c,e.startState.selection),new rt(h==0?i.rest:c,h==0?c:i.rest)}let s=e.annotation(Xm);if((s=="full"||s=="before")&&(n=n.isolate()),e.annotation(te.addToHistory)===!1)return e.changes.empty?n:n.addMapping(e.changes.desc);let r=ke.fromTransaction(e),o=e.annotation(te.time),l=e.annotation(te.userEvent);return r?n=n.addChanges(r,o,l,t,e):e.selection&&(n=n.addSelection(e.startState.selection,o,l,t.newGroupDelay)),(s=="full"||s=="after")&&(n=n.isolate()),n},toJSON(n){return{done:n.done.map(e=>e.toJSON()),undone:n.undone.map(e=>e.toJSON())}},fromJSON(n){return new rt(n.done.map(ke.fromJSON),n.undone.map(ke.fromJSON))}});function Zm(n={}){return[vf,wf.of(n),T.domEventHandlers({beforeinput(e,t){let i=e.inputType=="historyUndo"?Sf:e.inputType=="historyRedo"?No:null;return i?(e.preventDefault(),i(t)):!1}})]}function Gs(n,e){return function({state:t,dispatch:i}){if(!e&&t.readOnly)return!1;let s=t.field(vf,!1);if(!s)return!1;let r=s.pop(n,t,e);return r?(i(r),!0):!1}}const Sf=Gs(0,!1),No=Gs(1,!1),e0=Gs(0,!0),t0=Gs(1,!0);class ke{constructor(e,t,i,s,r){this.changes=e,this.effects=t,this.mapped=i,this.startSelection=s,this.selectionsAfter=r}setSelAfter(e){return new ke(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,i;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(i=this.startSelection)===null||i===void 0?void 0:i.toJSON(),selectionsAfter:this.selectionsAfter.map(s=>s.toJSON())}}static fromJSON(e){return new ke(e.changes&&ee.fromJSON(e.changes),[],e.mapped&&lt.fromJSON(e.mapped),e.startSelection&&x.fromJSON(e.startSelection),e.selectionsAfter.map(x.fromJSON))}static fromTransaction(e,t){let i=Ee;for(let s of e.startState.facet(Jm)){let r=s(e);r.length&&(i=i.concat(r))}return!i.length&&e.changes.empty?null:new ke(e.changes.invert(e.startState.doc),i,void 0,t||e.startState.selection,Ee)}static selection(e){return new ke(void 0,Ee,void 0,void 0,e)}}function Ts(n,e,t,i){let s=e+1>t+20?e-t-1:0,r=n.slice(s,e);return r.push(i),r}function i0(n,e){let t=[],i=!1;return n.iterChangedRanges((s,r)=>t.push(s,r)),e.iterChangedRanges((s,r,o,l)=>{for(let a=0;a<t.length;){let h=t[a++],c=t[a++];l>=h&&o<=c&&(i=!0)}}),i}function n0(n,e){return n.ranges.length==e.ranges.length&&n.ranges.filter((t,i)=>t.empty!=e.ranges[i].empty).length===0}function Cf(n,e){return n.length?e.length?n.concat(e):n:e}const Ee=[],s0=200;function Af(n,e){if(n.length){let t=n[n.length-1],i=t.selectionsAfter.slice(Math.max(0,t.selectionsAfter.length-s0));return i.length&&i[i.length-1].eq(e)?n:(i.push(e),Ts(n,n.length-1,1e9,t.setSelAfter(i)))}else return[ke.selection([e])]}function r0(n){let e=n[n.length-1],t=n.slice();return t[n.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),t}function wr(n,e){if(!n.length)return n;let t=n.length,i=Ee;for(;t;){let s=o0(n[t-1],e,i);if(s.changes&&!s.changes.empty||s.effects.length){let r=n.slice(0,t);return r[t-1]=s,r}else e=s.mapped,t--,i=s.selectionsAfter}return i.length?[ke.selection(i)]:Ee}function o0(n,e,t){let i=Cf(n.selectionsAfter.length?n.selectionsAfter.map(l=>l.map(e)):Ee,t);if(!n.changes)return ke.selection(i);let s=n.changes.map(e),r=e.mapDesc(n.changes,!0),o=n.mapped?n.mapped.composeDesc(r):r;return new ke(s,L.mapEffects(n.effects,e),o,n.startSelection.map(r),i)}const l0=/^(input\.type|delete)($|\.)/;class rt{constructor(e,t,i=0,s=void 0){this.done=e,this.undone=t,this.prevTime=i,this.prevUserEvent=s}isolate(){return this.prevTime?new rt(this.done,this.undone):this}addChanges(e,t,i,s,r){let o=this.done,l=o[o.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!i||l0.test(i))&&(!l.selectionsAfter.length&&t-this.prevTime<s.newGroupDelay&&s.joinToEvent(r,i0(l.changes,e.changes))||i=="input.type.compose")?o=Ts(o,o.length-1,s.minDepth,new ke(e.changes.compose(l.changes),Cf(L.mapEffects(e.effects,l.changes),l.effects),l.mapped,l.startSelection,Ee)):o=Ts(o,o.length,s.minDepth,e),new rt(o,Ee,t,i)}addSelection(e,t,i,s){let r=this.done.length?this.done[this.done.length-1].selectionsAfter:Ee;return r.length>0&&t-this.prevTime<s&&i==this.prevUserEvent&&i&&/^select($|\.)/.test(i)&&n0(r[r.length-1],e)?this:new rt(Af(this.done,e),this.undone,t,i)}addMapping(e){return new rt(wr(this.done,e),wr(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,i){let s=e==0?this.done:this.undone;if(s.length==0)return null;let r=s[s.length-1],o=r.selectionsAfter[0]||(r.startSelection?r.startSelection.map(r.changes.invertedDesc,1):t.selection);if(i&&r.selectionsAfter.length)return t.update({selection:r.selectionsAfter[r.selectionsAfter.length-1],annotations:Io.of({side:e,rest:r0(s),selection:o}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(r.changes){let l=s.length==1?Ee:s.slice(0,s.length-1);return r.mapped&&(l=wr(l,r.mapped)),t.update({changes:r.changes,selection:r.startSelection,effects:r.effects,annotations:Io.of({side:e,rest:l,selection:o}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}}rt.empty=new rt(Ee,Ee);const a0=[{key:"Mod-z",run:Sf,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:No,preventDefault:!0},{linux:"Ctrl-Shift-z",run:No,preventDefault:!0},{key:"Mod-u",run:e0,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:t0,preventDefault:!0}];function Bi(n,e){return x.create(n.ranges.map(e),n.mainIndex)}function Ke(n,e){return n.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function je({state:n,dispatch:e},t){let i=Bi(n.selection,t);return i.eq(n.selection,!0)?!1:(e(Ke(n,i)),!0)}function Qs(n,e){return x.cursor(e?n.to:n.from)}function Mf(n,e){return je(n,t=>t.empty?n.moveByChar(t,e):Qs(t,e))}function fe(n){return n.textDirectionAt(n.state.selection.main.head)==j.LTR}const Tf=n=>Mf(n,!fe(n)),Of=n=>Mf(n,fe(n));function Df(n,e){return je(n,t=>t.empty?n.moveByGroup(t,e):Qs(t,e))}const h0=n=>Df(n,!fe(n)),c0=n=>Df(n,fe(n));function f0(n,e,t){if(e.type.prop(t))return!0;let i=e.to-e.from;return i&&(i>2||/[^\s,.;:]/.test(n.sliceDoc(e.from,e.to)))||e.firstChild}function Ys(n,e,t){let i=he(n).resolveInner(e.head),s=t?E.closedBy:E.openedBy;for(let a=e.head;;){let h=t?i.childAfter(a):i.childBefore(a);if(!h)break;f0(n,h,s)?i=h:a=t?h.to:h.from}let r=i.type.prop(s),o,l;return r&&(o=t?st(n,i.from,1):st(n,i.to,-1))&&o.matched?l=t?o.end.to:o.end.from:l=t?i.to:i.from,x.cursor(l,t?-1:1)}const u0=n=>je(n,e=>Ys(n.state,e,!fe(n))),d0=n=>je(n,e=>Ys(n.state,e,fe(n)));function Rf(n,e){return je(n,t=>{if(!t.empty)return Qs(t,e);let i=n.moveVertically(t,e);return i.head!=t.head?i:n.moveToLineBoundary(t,e)})}const Bf=n=>Rf(n,!1),Pf=n=>Rf(n,!0);function Lf(n){let e=n.scrollDOM.clientHeight<n.scrollDOM.scrollHeight-2,t=0,i=0,s;if(e){for(let r of n.state.facet(T.scrollMargins)){let o=r(n);o?.top&&(t=Math.max(o?.top,t)),o?.bottom&&(i=Math.max(o?.bottom,i))}s=n.scrollDOM.clientHeight-t-i}else s=(n.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:t,marginBottom:i,selfScroll:e,height:Math.max(n.defaultLineHeight,s-5)}}function Ef(n,e){let t=Lf(n),{state:i}=n,s=Bi(i.selection,o=>o.empty?n.moveVertically(o,e,t.height):Qs(o,e));if(s.eq(i.selection))return!1;let r;if(t.selfScroll){let o=n.coordsAtPos(i.selection.main.head),l=n.scrollDOM.getBoundingClientRect(),a=l.top+t.marginTop,h=l.bottom-t.marginBottom;o&&o.top>a&&o.bottom<h&&(r=T.scrollIntoView(s.main.head,{y:"start",yMargin:o.top-a}))}return n.dispatch(Ke(i,s),{effects:r}),!0}const Va=n=>Ef(n,!1),Wo=n=>Ef(n,!0);function Et(n,e,t){let i=n.lineBlockAt(e.head),s=n.moveToLineBoundary(e,t);if(s.head==e.head&&s.head!=(t?i.to:i.from)&&(s=n.moveToLineBoundary(e,t,!1)),!t&&s.head==i.from&&i.length){let r=/^\s*/.exec(n.state.sliceDoc(i.from,Math.min(i.from+100,i.to)))[0].length;r&&e.head!=i.from+r&&(s=x.cursor(i.from+r))}return s}const p0=n=>je(n,e=>Et(n,e,!0)),g0=n=>je(n,e=>Et(n,e,!1)),m0=n=>je(n,e=>Et(n,e,!fe(n))),b0=n=>je(n,e=>Et(n,e,fe(n))),y0=n=>je(n,e=>x.cursor(n.lineBlockAt(e.head).from,1)),x0=n=>je(n,e=>x.cursor(n.lineBlockAt(e.head).to,-1));function k0(n,e,t){let i=!1,s=Bi(n.selection,r=>{let o=st(n,r.head,-1)||st(n,r.head,1)||r.head>0&&st(n,r.head-1,1)||r.head<n.doc.length&&st(n,r.head+1,-1);if(!o||!o.end)return r;i=!0;let l=o.start.from==r.head?o.end.to:o.end.from;return x.cursor(l)});return i?(e(Ke(n,s)),!0):!1}const w0=({state:n,dispatch:e})=>k0(n,e);function We(n,e){let t=Bi(n.state.selection,i=>{let s=e(i);return x.range(i.anchor,s.head,s.goalColumn,s.bidiLevel||void 0)});return t.eq(n.state.selection)?!1:(n.dispatch(Ke(n.state,t)),!0)}function If(n,e){return We(n,t=>n.moveByChar(t,e))}const Nf=n=>If(n,!fe(n)),Wf=n=>If(n,fe(n));function Ff(n,e){return We(n,t=>n.moveByGroup(t,e))}const v0=n=>Ff(n,!fe(n)),S0=n=>Ff(n,fe(n)),C0=n=>We(n,e=>Ys(n.state,e,!fe(n))),A0=n=>We(n,e=>Ys(n.state,e,fe(n)));function Hf(n,e){return We(n,t=>n.moveVertically(t,e))}const Vf=n=>Hf(n,!1),zf=n=>Hf(n,!0);function $f(n,e){return We(n,t=>n.moveVertically(t,e,Lf(n).height))}const za=n=>$f(n,!1),$a=n=>$f(n,!0),M0=n=>We(n,e=>Et(n,e,!0)),T0=n=>We(n,e=>Et(n,e,!1)),O0=n=>We(n,e=>Et(n,e,!fe(n))),D0=n=>We(n,e=>Et(n,e,fe(n))),R0=n=>We(n,e=>x.cursor(n.lineBlockAt(e.head).from)),B0=n=>We(n,e=>x.cursor(n.lineBlockAt(e.head).to)),qa=({state:n,dispatch:e})=>(e(Ke(n,{anchor:0})),!0),Ka=({state:n,dispatch:e})=>(e(Ke(n,{anchor:n.doc.length})),!0),ja=({state:n,dispatch:e})=>(e(Ke(n,{anchor:n.selection.main.anchor,head:0})),!0),Ua=({state:n,dispatch:e})=>(e(Ke(n,{anchor:n.selection.main.anchor,head:n.doc.length})),!0),P0=({state:n,dispatch:e})=>(e(n.update({selection:{anchor:0,head:n.doc.length},userEvent:"select"})),!0),L0=({state:n,dispatch:e})=>{let t=_s(n).map(({from:i,to:s})=>x.range(i,Math.min(s+1,n.doc.length)));return e(n.update({selection:x.create(t),userEvent:"select"})),!0},E0=({state:n,dispatch:e})=>{let t=Bi(n.selection,i=>{let s=he(n),r=s.resolveStack(i.from,1);if(i.empty){let o=s.resolveStack(i.from,-1);o.node.from>=r.node.from&&o.node.to<=r.node.to&&(r=o)}for(let o=r;o;o=o.next){let{node:l}=o;if((l.from<i.from&&l.to>=i.to||l.to>i.to&&l.from<=i.from)&&o.next)return x.range(l.to,l.from)}return i});return t.eq(n.selection)?!1:(e(Ke(n,t)),!0)};function qf(n,e){let{state:t}=n,i=t.selection,s=t.selection.ranges.slice();for(let r of t.selection.ranges){let o=t.doc.lineAt(r.head);if(e?o.to<n.state.doc.length:o.from>0)for(let l=r;;){let a=n.moveVertically(l,e);if(a.head<o.from||a.head>o.to){s.some(h=>h.head==a.head)||s.push(a);break}else{if(a.head==l.head)break;l=a}}}return s.length==i.ranges.length?!1:(n.dispatch(Ke(t,x.create(s,s.length-1))),!0)}const I0=n=>qf(n,!1),N0=n=>qf(n,!0),W0=({state:n,dispatch:e})=>{let t=n.selection,i=null;return t.ranges.length>1?i=x.create([t.main]):t.main.empty||(i=x.create([x.cursor(t.main.head)])),i?(e(Ke(n,i)),!0):!1};function yn(n,e){if(n.state.readOnly)return!1;let t="delete.selection",{state:i}=n,s=i.changeByRange(r=>{let{from:o,to:l}=r;if(o==l){let a=e(r);a<o?(t="delete.backward",a=Hn(n,a,!1)):a>o&&(t="delete.forward",a=Hn(n,a,!0)),o=Math.min(o,a),l=Math.max(l,a)}else o=Hn(n,o,!1),l=Hn(n,l,!0);return o==l?{range:r}:{changes:{from:o,to:l},range:x.cursor(o,o<r.head?-1:1)}});return s.changes.empty?!1:(n.dispatch(i.update(s,{scrollIntoView:!0,userEvent:t,effects:t=="delete.selection"?T.announce.of(i.phrase("Selection deleted")):void 0})),!0)}function Hn(n,e,t){if(n instanceof T)for(let i of n.state.facet(T.atomicRanges).map(s=>s(n)))i.between(e,e,(s,r)=>{s<e&&r>e&&(e=t?r:s)});return e}const Kf=(n,e,t)=>yn(n,i=>{let s=i.from,{state:r}=n,o=r.doc.lineAt(s),l,a;if(t&&!e&&s>o.from&&s<o.from+200&&!/[^ \t]/.test(l=o.text.slice(0,s-o.from))){if(l[l.length-1]==" ")return s-1;let h=Di(l,r.tabSize),c=h%Cs(r)||Cs(r);for(let f=0;f<c&&l[l.length-1-f]==" ";f++)s--;a=s}else a=ne(o.text,s-o.from,e,e)+o.from,a==s&&o.number!=(e?r.doc.lines:1)?a+=e?1:-1:!e&&/[\ufe00-\ufe0f]/.test(o.text.slice(a-o.from,s-o.from))&&(a=ne(o.text,a-o.from,!1,!1)+o.from);return a}),Fo=n=>Kf(n,!1,!0),jf=n=>Kf(n,!0,!1),Uf=(n,e)=>yn(n,t=>{let i=t.head,{state:s}=n,r=s.doc.lineAt(i),o=s.charCategorizer(i);for(let l=null;;){if(i==(e?r.to:r.from)){i==t.head&&r.number!=(e?s.doc.lines:1)&&(i+=e?1:-1);break}let a=ne(r.text,i-r.from,e)+r.from,h=r.text.slice(Math.min(i,a)-r.from,Math.max(i,a)-r.from),c=o(h);if(l!=null&&c!=l)break;(h!=" "||i!=t.head)&&(l=c),i=a}return i}),Gf=n=>Uf(n,!1),F0=n=>Uf(n,!0),H0=n=>yn(n,e=>{let t=n.lineBlockAt(e.head).to;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),V0=n=>yn(n,e=>{let t=n.moveToLineBoundary(e,!1).head;return e.head>t?t:Math.max(0,e.head-1)}),z0=n=>yn(n,e=>{let t=n.moveToLineBoundary(e,!0).head;return e.head<t?t:Math.min(n.state.doc.length,e.head+1)}),$0=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>({changes:{from:i.from,to:i.to,insert:F.of(["",""])},range:x.cursor(i.from)}));return e(n.update(t,{scrollIntoView:!0,userEvent:"input"})),!0},q0=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=n.changeByRange(i=>{if(!i.empty||i.from==0||i.from==n.doc.length)return{range:i};let s=i.from,r=n.doc.lineAt(s),o=s==r.from?s-1:ne(r.text,s-r.from,!1)+r.from,l=s==r.to?s+1:ne(r.text,s-r.from,!0)+r.from;return{changes:{from:o,to:l,insert:n.doc.slice(s,l).append(n.doc.slice(o,s))},range:x.cursor(l)}});return t.changes.empty?!1:(e(n.update(t,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function _s(n){let e=[],t=-1;for(let i of n.selection.ranges){let s=n.doc.lineAt(i.from),r=n.doc.lineAt(i.to);if(!i.empty&&i.to==r.from&&(r=n.doc.lineAt(i.to-1)),t>=s.number){let o=e[e.length-1];o.to=r.to,o.ranges.push(i)}else e.push({from:s.from,to:r.to,ranges:[i]});t=r.number+1}return e}function Qf(n,e,t){if(n.readOnly)return!1;let i=[],s=[];for(let r of _s(n)){if(t?r.to==n.doc.length:r.from==0)continue;let o=n.doc.lineAt(t?r.to+1:r.from-1),l=o.length+1;if(t){i.push({from:r.to,to:o.to},{from:r.from,insert:o.text+n.lineBreak});for(let a of r.ranges)s.push(x.range(Math.min(n.doc.length,a.anchor+l),Math.min(n.doc.length,a.head+l)))}else{i.push({from:o.from,to:r.from},{from:r.to,insert:n.lineBreak+o.text});for(let a of r.ranges)s.push(x.range(a.anchor-l,a.head-l))}}return i.length?(e(n.update({changes:i,scrollIntoView:!0,selection:x.create(s,n.selection.mainIndex),userEvent:"move.line"})),!0):!1}const K0=({state:n,dispatch:e})=>Qf(n,e,!1),j0=({state:n,dispatch:e})=>Qf(n,e,!0);function Yf(n,e,t){if(n.readOnly)return!1;let i=[];for(let r of _s(n))t?i.push({from:r.from,insert:n.doc.slice(r.from,r.to)+n.lineBreak}):i.push({from:r.to,insert:n.lineBreak+n.doc.slice(r.from,r.to)});let s=n.changes(i);return e(n.update({changes:s,selection:n.selection.map(s,t?1:-1),scrollIntoView:!0,userEvent:"input.copyline"})),!0}const U0=({state:n,dispatch:e})=>Yf(n,e,!1),G0=({state:n,dispatch:e})=>Yf(n,e,!0),Q0=n=>{if(n.state.readOnly)return!1;let{state:e}=n,t=e.changes(_s(e).map(({from:s,to:r})=>(s>0?s--:r<e.doc.length&&r++,{from:s,to:r}))),i=Bi(e.selection,s=>{let r;if(n.lineWrapping){let o=n.lineBlockAt(s.head),l=n.coordsAtPos(s.head,s.assoc||1);l&&(r=o.bottom+n.documentTop-l.bottom+n.defaultLineHeight/2)}return n.moveVertically(s,!0,r)}).map(t);return n.dispatch({changes:t,selection:i,scrollIntoView:!0,userEvent:"delete.line"}),!0};function Y0(n,e){if(/\(\)|\[\]|\{\}/.test(n.sliceDoc(e-1,e+1)))return{from:e,to:e};let t=he(n).resolveInner(e),i=t.childBefore(e),s=t.childAfter(e),r;return i&&s&&i.to<=e&&s.from>=e&&(r=i.type.prop(E.closedBy))&&r.indexOf(s.name)>-1&&n.doc.lineAt(i.to).from==n.doc.lineAt(s.from).from&&!/\S/.test(n.sliceDoc(i.to,s.from))?{from:i.to,to:s.from}:null}const Ga=_f(!1),_0=_f(!0);function _f(n){return({state:e,dispatch:t})=>{if(e.readOnly)return!1;let i=e.changeByRange(s=>{let{from:r,to:o}=s,l=e.doc.lineAt(r),a=!n&&r==o&&Y0(e,r);n&&(r=o=(o<=l.to?l:e.doc.lineAt(o)).to);let h=new js(e,{simulateBreak:r,simulateDoubleBreak:!!a}),c=cl(h,r);for(c==null&&(c=Di(/^\s*/.exec(e.doc.lineAt(r).text)[0],e.tabSize));o<l.to&&/\s/.test(l.text[o-l.from]);)o++;a?{from:r,to:o}=a:r>l.from&&r<l.from+100&&!/\S/.test(l.text.slice(0,r))&&(r=l.from);let f=["",ln(e,c)];return a&&f.push(ln(e,h.lineIndent(l.from,-1))),{changes:{from:r,to:o,insert:F.of(f)},range:x.cursor(r+1+f[1].length)}});return t(e.update(i,{scrollIntoView:!0,userEvent:"input"})),!0}}function gl(n,e){let t=-1;return n.changeByRange(i=>{let s=[];for(let o=i.from;o<=i.to;){let l=n.doc.lineAt(o);l.number>t&&(i.empty||i.to>l.from)&&(e(l,s,i),t=l.number),o=l.to+1}let r=n.changes(s);return{changes:s,range:x.range(r.mapPos(i.anchor,1),r.mapPos(i.head,1))}})}const X0=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let t=Object.create(null),i=new js(n,{overrideIndentation:r=>{let o=t[r];return o??-1}}),s=gl(n,(r,o,l)=>{let a=cl(i,r.from);if(a==null)return;/\S/.test(r.text)||(a=0);let h=/^\s*/.exec(r.text)[0],c=ln(n,a);(h!=c||l.from<r.from+h.length)&&(t[r.from]=a,o.push({from:r.from,to:r.from+h.length,insert:c}))});return s.changes.empty||e(n.update(s,{userEvent:"indent"})),!0},Xf=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(gl(n,(t,i)=>{i.push({from:t.from,insert:n.facet(hl)})}),{userEvent:"input.indent"})),!0),Jf=({state:n,dispatch:e})=>n.readOnly?!1:(e(n.update(gl(n,(t,i)=>{let s=/^\s*/.exec(t.text)[0];if(!s)return;let r=Di(s,n.tabSize),o=0,l=ln(n,Math.max(0,r-Cs(n)));for(;o<s.length&&o<l.length&&s.charCodeAt(o)==l.charCodeAt(o);)o++;i.push({from:t.from+o,to:t.from+s.length,insert:l.slice(o)})}),{userEvent:"delete.dedent"})),!0),J0=n=>(n.setTabFocusMode(),!0),Z0=[{key:"Ctrl-b",run:Tf,shift:Nf,preventDefault:!0},{key:"Ctrl-f",run:Of,shift:Wf},{key:"Ctrl-p",run:Bf,shift:Vf},{key:"Ctrl-n",run:Pf,shift:zf},{key:"Ctrl-a",run:y0,shift:R0},{key:"Ctrl-e",run:x0,shift:B0},{key:"Ctrl-d",run:jf},{key:"Ctrl-h",run:Fo},{key:"Ctrl-k",run:H0},{key:"Ctrl-Alt-h",run:Gf},{key:"Ctrl-o",run:$0},{key:"Ctrl-t",run:q0},{key:"Ctrl-v",run:Wo}],eb=[{key:"ArrowLeft",run:Tf,shift:Nf,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:h0,shift:v0,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:m0,shift:O0,preventDefault:!0},{key:"ArrowRight",run:Of,shift:Wf,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:c0,shift:S0,preventDefault:!0},{mac:"Cmd-ArrowRight",run:b0,shift:D0,preventDefault:!0},{key:"ArrowUp",run:Bf,shift:Vf,preventDefault:!0},{mac:"Cmd-ArrowUp",run:qa,shift:ja},{mac:"Ctrl-ArrowUp",run:Va,shift:za},{key:"ArrowDown",run:Pf,shift:zf,preventDefault:!0},{mac:"Cmd-ArrowDown",run:Ka,shift:Ua},{mac:"Ctrl-ArrowDown",run:Wo,shift:$a},{key:"PageUp",run:Va,shift:za},{key:"PageDown",run:Wo,shift:$a},{key:"Home",run:g0,shift:T0,preventDefault:!0},{key:"Mod-Home",run:qa,shift:ja},{key:"End",run:p0,shift:M0,preventDefault:!0},{key:"Mod-End",run:Ka,shift:Ua},{key:"Enter",run:Ga,shift:Ga},{key:"Mod-a",run:P0},{key:"Backspace",run:Fo,shift:Fo,preventDefault:!0},{key:"Delete",run:jf,preventDefault:!0},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Gf,preventDefault:!0},{key:"Mod-Delete",mac:"Alt-Delete",run:F0,preventDefault:!0},{mac:"Mod-Backspace",run:V0,preventDefault:!0},{mac:"Mod-Delete",run:z0,preventDefault:!0}].concat(Z0.map(n=>({mac:n.key,run:n.run,shift:n.shift}))),tb=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:u0,shift:C0},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:d0,shift:A0},{key:"Alt-ArrowUp",run:K0},{key:"Shift-Alt-ArrowUp",run:U0},{key:"Alt-ArrowDown",run:j0},{key:"Shift-Alt-ArrowDown",run:G0},{key:"Mod-Alt-ArrowUp",run:I0},{key:"Mod-Alt-ArrowDown",run:N0},{key:"Escape",run:W0},{key:"Mod-Enter",run:_0},{key:"Alt-l",mac:"Ctrl-l",run:L0},{key:"Mod-i",run:E0,preventDefault:!0},{key:"Mod-[",run:Jf},{key:"Mod-]",run:Xf},{key:"Mod-Alt-\\",run:X0},{key:"Shift-Mod-k",run:Q0},{key:"Shift-Mod-\\",run:w0},{key:"Mod-/",run:Km},{key:"Alt-A",run:Um},{key:"Ctrl-m",mac:"Shift-Alt-m",run:J0}].concat(eb),ib={key:"Tab",run:Xf,shift:Jf};var Qa={};class Os{constructor(e,t,i,s,r,o,l,a,h,c=0,f){this.p=e,this.stack=t,this.state=i,this.reducePos=s,this.pos=r,this.score=o,this.buffer=l,this.bufferBase=a,this.curContext=h,this.lookAhead=c,this.parent=f}toString(){return`[${this.stack.filter((e,t)=>t%3==0).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(e,t,i=0){let s=e.parser.context;return new Os(e,[],t,i,i,0,[],0,s?new Ya(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(e,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=e}reduce(e){var t;let i=e>>19,s=e&65535,{parser:r}=this.p,o=this.reducePos<this.pos-25&&this.setLookAhead(this.pos),l=r.dynamicPrecedence(s);if(l&&(this.score+=l),i==0){this.pushState(r.getGoto(this.state,s,!0),this.reducePos),s<r.minRepeatTerm&&this.storeNode(s,this.reducePos,this.reducePos,o?8:4,!0),this.reduceContext(s,this.reducePos);return}let a=this.stack.length-(i-1)*3-(e&262144?6:0),h=a?this.stack[a-2]:this.p.ranges[0].from,c=this.reducePos-h;c>=2e3&&!(!((t=this.p.parser.nodeSet.types[s])===null||t===void 0)&&t.isAnonymous)&&(h==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=c):this.p.lastBigReductionSize<c&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=h,this.p.lastBigReductionSize=c));let f=a?this.stack[a-1]:0,u=this.bufferBase+this.buffer.length-f;if(s<r.minRepeatTerm||e&131072){let d=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(s,h,d,u+4,!0)}if(e&262144)this.state=this.stack[a];else{let d=this.stack[a-3];this.state=r.getGoto(d,s,!0)}for(;this.stack.length>a;)this.stack.pop();this.reduceContext(s,h)}storeNode(e,t,i,s=4,r=!1){if(e==0&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let o=this,l=this.buffer.length;if(l==0&&o.parent&&(l=o.bufferBase-o.parent.bufferBase,o=o.parent),l>0&&o.buffer[l-4]==0&&o.buffer[l-1]>-1){if(t==i)return;if(o.buffer[l-2]>=t){o.buffer[l-2]=i;return}}}if(!r||this.pos==i)this.buffer.push(e,t,i,s);else{let o=this.buffer.length;if(o>0&&(this.buffer[o-4]!=0||this.buffer[o-1]<0)){let l=!1;for(let a=o;a>0&&this.buffer[a-2]>i;a-=4)if(this.buffer[a-1]>=0){l=!0;break}if(l)for(;o>0&&this.buffer[o-2]>i;)this.buffer[o]=this.buffer[o-4],this.buffer[o+1]=this.buffer[o-3],this.buffer[o+2]=this.buffer[o-2],this.buffer[o+3]=this.buffer[o-1],o-=4,s>4&&(s-=4)}this.buffer[o]=e,this.buffer[o+1]=t,this.buffer[o+2]=i,this.buffer[o+3]=s}}shift(e,t,i,s){if(e&131072)this.pushState(e&65535,this.pos);else if((e&262144)==0){let r=e,{parser:o}=this.p;this.pos=s;let l=o.stateFlag(r,1);!l&&(s>i||t<=o.maxNode)&&(this.reducePos=s),this.pushState(r,l?i:Math.min(i,this.reducePos)),this.shiftContext(t,i),t<=o.maxNode&&this.buffer.push(t,i,s,4)}else this.pos=s,this.shiftContext(t,i),t<=this.p.parser.maxNode&&this.buffer.push(t,i,s,4)}apply(e,t,i,s){e&65536?this.reduce(e):this.shift(e,t,i,s)}useNode(e,t){let i=this.p.reused.length-1;(i<0||this.p.reused[i]!=e)&&(this.p.reused.push(e),i++);let s=this.pos;this.reducePos=this.pos=s+e.length,this.pushState(t,s),this.buffer.push(i,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,e,this,this.p.stream.reset(this.pos-e.length)))}split(){let e=this,t=e.buffer.length;for(;t>0&&e.buffer[t-2]>e.reducePos;)t-=4;let i=e.buffer.slice(t),s=e.bufferBase+t;for(;e&&s==e.bufferBase;)e=e.parent;return new Os(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,i,s,this.curContext,this.lookAhead,e)}recoverByDelete(e,t){let i=e<=this.p.parser.maxNode;i&&this.storeNode(e,this.pos,t,4),this.storeNode(0,this.pos,t,i?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(e){for(let t=new nb(this);;){let i=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,e);if(i==0)return!1;if((i&65536)==0)return!0;t.reduce(i)}}recoverByInsert(e){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.length>8||this.stack.length>=120){let s=[];for(let r=0,o;r<t.length;r+=2)(o=t[r+1])!=this.state&&this.p.parser.hasAction(o,e)&&s.push(t[r],o);if(this.stack.length<120)for(let r=0;s.length<8&&r<t.length;r+=2){let o=t[r+1];s.some((l,a)=>a&1&&l==o)||s.push(t[r],o)}t=s}let i=[];for(let s=0;s<t.length&&i.length<4;s+=2){let r=t[s+1];if(r==this.state)continue;let o=this.split();o.pushState(r,this.pos),o.storeNode(0,o.pos,o.pos,4,!0),o.shiftContext(t[s],this.pos),o.reducePos=this.pos,o.score-=200,i.push(o)}return i}forceReduce(){let{parser:e}=this.p,t=e.stateSlot(this.state,5);if((t&65536)==0)return!1;if(!e.validAction(this.state,t)){let i=t>>19,s=t&65535,r=this.stack.length-i*3;if(r<0||e.getGoto(this.stack[r],s,!1)<0){let o=this.findForcedReduction();if(o==null)return!1;t=o}this.storeNode(0,this.pos,this.pos,4,!0),this.score-=100}return this.reducePos=this.pos,this.reduce(t),!0}findForcedReduction(){let{parser:e}=this.p,t=[],i=(s,r)=>{if(!t.includes(s))return t.push(s),e.allActions(s,o=>{if(!(o&393216))if(o&65536){let l=(o>>19)-r;if(l>1){let a=o&65535,h=this.stack.length-l*3;if(h>=0&&e.getGoto(this.stack[h],a,!1)>=0)return l<<19|65536|a}}else{let l=i(o,r+1);if(l!=null)return l}})};return i(this.state,0)}forceAll(){for(;!this.p.parser.stateFlag(this.state,2);)if(!this.forceReduce()){this.storeNode(0,this.pos,this.pos,4,!0);break}return this}get deadEnd(){if(this.stack.length!=3)return!1;let{parser:e}=this.p;return e.data[e.stateSlot(this.state,1)]==65535&&!e.stateSlot(this.state,4)}restart(){this.storeNode(0,this.pos,this.pos,4,!0),this.state=this.stack[0],this.stack.length=0}sameState(e){if(this.state!=e.state||this.stack.length!=e.stack.length)return!1;for(let t=0;t<this.stack.length;t+=3)if(this.stack[t]!=e.stack[t])return!1;return!0}get parser(){return this.p.parser}dialectEnabled(e){return this.p.parser.dialect.flags[e]}shiftContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.shift(this.curContext.context,e,this,this.p.stream.reset(t)))}reduceContext(e,t){this.curContext&&this.updateContext(this.curContext.tracker.reduce(this.curContext.context,e,this,this.p.stream.reset(t)))}emitContext(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-3)&&this.buffer.push(this.curContext.hash,this.pos,this.pos,-3)}emitLookAhead(){let e=this.buffer.length-1;(e<0||this.buffer[e]!=-4)&&this.buffer.push(this.lookAhead,this.pos,this.pos,-4)}updateContext(e){if(e!=this.curContext.context){let t=new Ya(this.curContext.tracker,e);t.hash!=this.curContext.hash&&this.emitContext(),this.curContext=t}}setLookAhead(e){return e<=this.lookAhead?!1:(this.emitLookAhead(),this.lookAhead=e,!0)}close(){this.curContext&&this.curContext.tracker.strict&&this.emitContext(),this.lookAhead>0&&this.emitLookAhead()}}class Ya{constructor(e,t){this.tracker=e,this.context=t,this.hash=e.strict?e.hash(t):0}}class nb{constructor(e){this.start=e,this.state=e.state,this.stack=e.stack,this.base=this.stack.length}reduce(e){let t=e&65535,i=e>>19;i==0?(this.stack==this.start.stack&&(this.stack=this.stack.slice()),this.stack.push(this.state,0,0),this.base+=3):this.base-=(i-1)*3;let s=this.start.p.parser.getGoto(this.stack[this.base-3],t,!0);this.state=s}}class Ds{constructor(e,t,i){this.stack=e,this.pos=t,this.index=i,this.buffer=e.buffer,this.index==0&&this.maybeNext()}static create(e,t=e.bufferBase+e.buffer.length){return new Ds(e,t,t-e.bufferBase)}maybeNext(){let e=this.stack.parent;e!=null&&(this.index=this.stack.bufferBase-e.bufferBase,this.stack=e,this.buffer=e.buffer)}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}next(){this.index-=4,this.pos-=4,this.index==0&&this.maybeNext()}fork(){return new Ds(this.stack,this.pos,this.index)}}function Vn(n,e=Uint16Array){if(typeof n!="string")return n;let t=null;for(let i=0,s=0;i<n.length;){let r=0;for(;;){let o=n.charCodeAt(i++),l=!1;if(o==126){r=65535;break}o>=92&&o--,o>=34&&o--;let a=o-32;if(a>=46&&(a-=46,l=!0),r+=a,l)break;r*=46}t?t[s++]=r:t=new e(r)}return t}class ls{constructor(){this.start=-1,this.value=-1,this.end=-1,this.extended=-1,this.lookAhead=0,this.mask=0,this.context=0}}const _a=new ls;class sb{constructor(e,t){this.input=e,this.ranges=t,this.chunk="",this.chunkOff=0,this.chunk2="",this.chunk2Pos=0,this.next=-1,this.token=_a,this.rangeIndex=0,this.pos=this.chunkPos=t[0].from,this.range=t[0],this.end=t[t.length-1].to,this.readNext()}resolveOffset(e,t){let i=this.range,s=this.rangeIndex,r=this.pos+e;for(;r<i.from;){if(!s)return null;let o=this.ranges[--s];r-=i.from-o.to,i=o}for(;t<0?r>i.to:r>=i.to;){if(s==this.ranges.length-1)return null;let o=this.ranges[++s];r+=o.from-i.to,i=o}return r}clipPos(e){if(e>=this.range.from&&e<this.range.to)return e;for(let t of this.ranges)if(t.to>e)return Math.max(e,t.from);return this.end}peek(e){let t=this.chunkOff+e,i,s;if(t>=0&&t<this.chunk.length)i=this.pos+e,s=this.chunk.charCodeAt(t);else{let r=this.resolveOffset(e,1);if(r==null)return-1;if(i=r,i>=this.chunk2Pos&&i<this.chunk2Pos+this.chunk2.length)s=this.chunk2.charCodeAt(i-this.chunk2Pos);else{let o=this.rangeIndex,l=this.range;for(;l.to<=i;)l=this.ranges[++o];this.chunk2=this.input.chunk(this.chunk2Pos=i),i+this.chunk2.length>l.to&&(this.chunk2=this.chunk2.slice(0,l.to-i)),s=this.chunk2.charCodeAt(0)}}return i>=this.token.lookAhead&&(this.token.lookAhead=i+1),s}acceptToken(e,t=0){let i=t?this.resolveOffset(t,-1):this.pos;if(i==null||i<this.token.start)throw new RangeError("Token end out of bounds");this.token.value=e,this.token.end=i}acceptTokenTo(e,t){this.token.value=e,this.token.end=t}getChunk(){if(this.pos>=this.chunk2Pos&&this.pos<this.chunk2Pos+this.chunk2.length){let{chunk:e,chunkPos:t}=this;this.chunk=this.chunk2,this.chunkPos=this.chunk2Pos,this.chunk2=e,this.chunk2Pos=t,this.chunkOff=this.pos-this.chunkPos}else{this.chunk2=this.chunk,this.chunk2Pos=this.chunkPos;let e=this.input.chunk(this.pos),t=this.pos+e.length;this.chunk=t>this.range.to?e.slice(0,this.range.to-this.pos):e,this.chunkPos=this.pos,this.chunkOff=0}}readNext(){return this.chunkOff>=this.chunk.length&&(this.getChunk(),this.chunkOff==this.chunk.length)?this.next=-1:this.next=this.chunk.charCodeAt(this.chunkOff)}advance(e=1){for(this.chunkOff+=e;this.pos+e>=this.range.to;){if(this.rangeIndex==this.ranges.length-1)return this.setDone();e-=this.range.to-this.pos,this.range=this.ranges[++this.rangeIndex],this.pos=this.range.from}return this.pos+=e,this.pos>=this.token.lookAhead&&(this.token.lookAhead=this.pos+1),this.readNext()}setDone(){return this.pos=this.chunkPos=this.end,this.range=this.ranges[this.rangeIndex=this.ranges.length-1],this.chunk="",this.next=-1}reset(e,t){if(t?(this.token=t,t.start=e,t.lookAhead=e+1,t.value=t.extended=-1):this.token=_a,this.pos!=e){if(this.pos=e,e==this.end)return this.setDone(),this;for(;e<this.range.from;)this.range=this.ranges[--this.rangeIndex];for(;e>=this.range.to;)this.range=this.ranges[++this.rangeIndex];e>=this.chunkPos&&e<this.chunkPos+this.chunk.length?this.chunkOff=e-this.chunkPos:(this.chunk="",this.chunkOff=0),this.readNext()}return this}read(e,t){if(e>=this.chunkPos&&t<=this.chunkPos+this.chunk.length)return this.chunk.slice(e-this.chunkPos,t-this.chunkPos);if(e>=this.chunk2Pos&&t<=this.chunk2Pos+this.chunk2.length)return this.chunk2.slice(e-this.chunk2Pos,t-this.chunk2Pos);if(e>=this.range.from&&t<=this.range.to)return this.input.read(e,t);let i="";for(let s of this.ranges){if(s.from>=t)break;s.to>e&&(i+=this.input.read(Math.max(s.from,e),Math.min(s.to,t)))}return i}}class ki{constructor(e,t){this.data=e,this.id=t}token(e,t){let{parser:i}=t.p;rb(this.data,e,t,this.id,i.data,i.tokenPrecTable)}}ki.prototype.contextual=ki.prototype.fallback=ki.prototype.extend=!1;ki.prototype.fallback=ki.prototype.extend=!1;function rb(n,e,t,i,s,r){let o=0,l=1<<i,{dialect:a}=t.p.parser;e:for(;(l&n[o])!=0;){let h=n[o+1];for(let d=o+3;d<h;d+=2)if((n[d+1]&l)>0){let p=n[d];if(a.allows(p)&&(e.token.value==-1||e.token.value==p||ob(p,e.token.value,s,r))){e.acceptToken(p);break}}let c=e.next,f=0,u=n[o+2];if(e.next<0&&u>f&&n[h+u*3-3]==65535){o=n[h+u*3-1];continue e}for(;f<u;){let d=f+u>>1,p=h+d+(d<<1),m=n[p],b=n[p+1]||65536;if(c<m)u=d;else if(c>=b)f=d+1;else{o=n[p+2],e.advance();continue e}}break}}function Xa(n,e,t){for(let i=e,s;(s=n[i])!=65535;i++)if(s==t)return i-e;return-1}function ob(n,e,t,i){let s=Xa(t,i,e);return s<0||Xa(t,i,n)<s}const Ce=typeof process<"u"&&Qa&&/\bparse\b/.test(Qa.LOG);let vr=null;function Ja(n,e,t){let i=n.cursor(Y.IncludeAnonymous);for(i.moveTo(e);;)if(!(t<0?i.childBefore(e):i.childAfter(e)))for(;;){if((t<0?i.to<e:i.from>e)&&!i.type.isError)return t<0?Math.max(0,Math.min(i.to-1,e-25)):Math.min(n.length,Math.max(i.from+1,e+25));if(t<0?i.prevSibling():i.nextSibling())break;if(!i.parent())return t<0?0:n.length}}class lb{constructor(e,t){this.fragments=e,this.nodeSet=t,this.i=0,this.fragment=null,this.safeFrom=-1,this.safeTo=-1,this.trees=[],this.start=[],this.index=[],this.nextFragment()}nextFragment(){let e=this.fragment=this.i==this.fragments.length?null:this.fragments[this.i++];if(e){for(this.safeFrom=e.openStart?Ja(e.tree,e.from+e.offset,1)-e.offset:e.from,this.safeTo=e.openEnd?Ja(e.tree,e.to+e.offset,-1)-e.offset:e.to;this.trees.length;)this.trees.pop(),this.start.pop(),this.index.pop();this.trees.push(e.tree),this.start.push(-e.offset),this.index.push(0),this.nextStart=this.safeFrom}else this.nextStart=1e9}nodeAt(e){if(e<this.nextStart)return null;for(;this.fragment&&this.safeTo<=e;)this.nextFragment();if(!this.fragment)return null;for(;;){let t=this.trees.length-1;if(t<0)return this.nextFragment(),null;let i=this.trees[t],s=this.index[t];if(s==i.children.length){this.trees.pop(),this.start.pop(),this.index.pop();continue}let r=i.children[s],o=this.start[t]+i.positions[s];if(o>e)return this.nextStart=o,null;if(r instanceof Z){if(o==e){if(o<this.safeFrom)return null;let l=o+r.length;if(l<=this.safeTo){let a=r.prop(E.lookAhead);if(!a||l+a<this.fragment.to)return r}}this.index[t]++,o+r.length>=Math.max(this.safeFrom,e)&&(this.trees.push(r),this.start.push(o),this.index.push(0))}else this.index[t]++,this.nextStart=o+r.length}}}class ab{constructor(e,t){this.stream=t,this.tokens=[],this.mainToken=null,this.actions=[],this.tokens=e.tokenizers.map(i=>new ls)}getActions(e){let t=0,i=null,{parser:s}=e.p,{tokenizers:r}=s,o=s.stateSlot(e.state,3),l=e.curContext?e.curContext.hash:0,a=0;for(let h=0;h<r.length;h++){if((1<<h&o)==0)continue;let c=r[h],f=this.tokens[h];if(!(i&&!c.fallback)&&((c.contextual||f.start!=e.pos||f.mask!=o||f.context!=l)&&(this.updateCachedToken(f,c,e),f.mask=o,f.context=l),f.lookAhead>f.end+25&&(a=Math.max(f.lookAhead,a)),f.value!=0)){let u=t;if(f.extended>-1&&(t=this.addActions(e,f.extended,f.end,t)),t=this.addActions(e,f.value,f.end,t),!c.extend&&(i=f,t>u))break}}for(;this.actions.length>t;)this.actions.pop();return a&&e.setLookAhead(a),!i&&e.pos==this.stream.end&&(i=new ls,i.value=e.p.parser.eofTerm,i.start=i.end=e.pos,t=this.addActions(e,i.value,i.end,t)),this.mainToken=i,this.actions}getMainToken(e){if(this.mainToken)return this.mainToken;let t=new ls,{pos:i,p:s}=e;return t.start=i,t.end=Math.min(i+1,s.stream.end),t.value=i==s.stream.end?s.parser.eofTerm:0,t}updateCachedToken(e,t,i){let s=this.stream.clipPos(i.pos);if(t.token(this.stream.reset(s,e),i),e.value>-1){let{parser:r}=i.p;for(let o=0;o<r.specialized.length;o++)if(r.specialized[o]==e.value){let l=r.specializers[o](this.stream.read(e.start,e.end),i);if(l>=0&&i.p.parser.dialect.allows(l>>1)){(l&1)==0?e.value=l>>1:e.extended=l>>1;break}}}else e.value=0,e.end=this.stream.clipPos(s+1)}putAction(e,t,i,s){for(let r=0;r<s;r+=3)if(this.actions[r]==e)return s;return this.actions[s++]=e,this.actions[s++]=t,this.actions[s++]=i,s}addActions(e,t,i,s){let{state:r}=e,{parser:o}=e.p,{data:l}=o;for(let a=0;a<2;a++)for(let h=o.stateSlot(r,a?2:1);;h+=3){if(l[h]==65535)if(l[h+1]==1)h=ft(l,h+2);else{s==0&&l[h+1]==2&&(s=this.putAction(ft(l,h+2),t,i,s));break}l[h]==t&&(s=this.putAction(ft(l,h+1),t,i,s))}return s}}class hb{constructor(e,t,i,s){this.parser=e,this.input=t,this.ranges=s,this.recovering=0,this.nextStackID=9812,this.minStackPos=0,this.reused=[],this.stoppedAt=null,this.lastBigReductionStart=-1,this.lastBigReductionSize=0,this.bigReductionCount=0,this.stream=new sb(t,s),this.tokens=new ab(e,this.stream),this.topTerm=e.top[1];let{from:r}=s[0];this.stacks=[Os.start(this,e.top[0],r)],this.fragments=i.length&&this.stream.end-r>e.bufferLength*4?new lb(i,e.nodeSet):null}get parsedPos(){return this.minStackPos}advance(){let e=this.stacks,t=this.minStackPos,i=this.stacks=[],s,r;if(this.bigReductionCount>300&&e.length==1){let[o]=e;for(;o.forceReduce()&&o.stack.length&&o.stack[o.stack.length-2]>=this.lastBigReductionStart;);this.bigReductionCount=this.lastBigReductionSize=0}for(let o=0;o<e.length;o++){let l=e[o];for(;;){if(this.tokens.mainToken=null,l.pos>t)i.push(l);else{if(this.advanceStack(l,i,e))continue;{s||(s=[],r=[]),s.push(l);let a=this.tokens.getMainToken(l);r.push(a.value,a.end)}}break}}if(!i.length){let o=s&&fb(s);if(o)return Ce&&console.log("Finish with "+this.stackID(o)),this.stackToTree(o);if(this.parser.strict)throw Ce&&s&&console.log("Stuck with token "+(this.tokens.mainToken?this.parser.getName(this.tokens.mainToken.value):"none")),new SyntaxError("No parse at "+t);this.recovering||(this.recovering=5)}if(this.recovering&&s){let o=this.stoppedAt!=null&&s[0].pos>this.stoppedAt?s[0]:this.runRecovery(s,r,i);if(o)return Ce&&console.log("Force-finish "+this.stackID(o)),this.stackToTree(o.forceAll())}if(this.recovering){let o=this.recovering==1?1:this.recovering*3;if(i.length>o)for(i.sort((l,a)=>a.score-l.score);i.length>o;)i.pop();i.some(l=>l.reducePos>t)&&this.recovering--}else if(i.length>1){e:for(let o=0;o<i.length-1;o++){let l=i[o];for(let a=o+1;a<i.length;a++){let h=i[a];if(l.sameState(h)||l.buffer.length>500&&h.buffer.length>500)if((l.score-h.score||l.buffer.length-h.buffer.length)>0)i.splice(a--,1);else{i.splice(o--,1);continue e}}}i.length>12&&(i.sort((o,l)=>l.score-o.score),i.splice(12,i.length-12))}this.minStackPos=i[0].pos;for(let o=1;o<i.length;o++)i[o].pos<this.minStackPos&&(this.minStackPos=i[o].pos);return null}stopAt(e){if(this.stoppedAt!=null&&this.stoppedAt<e)throw new RangeError("Can't move stoppedAt forward");this.stoppedAt=e}advanceStack(e,t,i){let s=e.pos,{parser:r}=this,o=Ce?this.stackID(e)+" -> ":"";if(this.stoppedAt!=null&&s>this.stoppedAt)return e.forceReduce()?e:null;if(this.fragments){let h=e.curContext&&e.curContext.tracker.strict,c=h?e.curContext.hash:0;for(let f=this.fragments.nodeAt(s);f;){let u=this.parser.nodeSet.types[f.type.id]==f.type?r.getGoto(e.state,f.type.id):-1;if(u>-1&&f.length&&(!h||(f.prop(E.contextHash)||0)==c))return e.useNode(f,u),Ce&&console.log(o+this.stackID(e)+` (via reuse of ${r.getName(f.type.id)})`),!0;if(!(f instanceof Z)||f.children.length==0||f.positions[0]>0)break;let d=f.children[0];if(d instanceof Z&&f.positions[0]==0)f=d;else break}}let l=r.stateSlot(e.state,4);if(l>0)return e.reduce(l),Ce&&console.log(o+this.stackID(e)+` (via always-reduce ${r.getName(l&65535)})`),!0;if(e.stack.length>=8400)for(;e.stack.length>6e3&&e.forceReduce(););let a=this.tokens.getActions(e);for(let h=0;h<a.length;){let c=a[h++],f=a[h++],u=a[h++],d=h==a.length||!i,p=d?e:e.split(),m=this.tokens.mainToken;if(p.apply(c,f,m?m.start:p.pos,u),Ce&&console.log(o+this.stackID(p)+` (via ${(c&65536)==0?"shift":`reduce of ${r.getName(c&65535)}`} for ${r.getName(f)} @ ${s}${p==e?"":", split"})`),d)return!0;p.pos>s?t.push(p):i.push(p)}return!1}advanceFully(e,t){let i=e.pos;for(;;){if(!this.advanceStack(e,null,null))return!1;if(e.pos>i)return Za(e,t),!0}}runRecovery(e,t,i){let s=null,r=!1;for(let o=0;o<e.length;o++){let l=e[o],a=t[o<<1],h=t[(o<<1)+1],c=Ce?this.stackID(l)+" -> ":"";if(l.deadEnd&&(r||(r=!0,l.restart(),Ce&&console.log(c+this.stackID(l)+" (restarted)"),this.advanceFully(l,i))))continue;let f=l.split(),u=c;for(let d=0;d<10&&f.forceReduce()&&(Ce&&console.log(u+this.stackID(f)+" (via force-reduce)"),!this.advanceFully(f,i));d++)Ce&&(u=this.stackID(f)+" -> ");for(let d of l.recoverByInsert(a))Ce&&console.log(c+this.stackID(d)+" (via recover-insert)"),this.advanceFully(d,i);this.stream.end>l.pos?(h==l.pos&&(h++,a=0),l.recoverByDelete(a,h),Ce&&console.log(c+this.stackID(l)+` (via recover-delete ${this.parser.getName(a)})`),Za(l,i)):(!s||s.score<f.score)&&(s=f)}return s}stackToTree(e){return e.close(),Z.build({buffer:Ds.create(e),nodeSet:this.parser.nodeSet,topID:this.topTerm,maxBufferLength:this.parser.bufferLength,reused:this.reused,start:this.ranges[0].from,length:e.pos-this.ranges[0].from,minRepeatType:this.parser.minRepeatTerm})}stackID(e){let t=(vr||(vr=new WeakMap)).get(e);return t||vr.set(e,t=String.fromCodePoint(this.nextStackID++)),t+e}}function Za(n,e){for(let t=0;t<e.length;t++){let i=e[t];if(i.pos==n.pos&&i.sameState(n)){e[t].score<n.score&&(e[t]=n);return}}e.push(n)}class cb{constructor(e,t,i){this.source=e,this.flags=t,this.disabled=i}allows(e){return!this.disabled||this.disabled[e]==0}}class Rs extends ef{constructor(e){if(super(),this.wrappers=[],e.version!=14)throw new RangeError(`Parser version (${e.version}) doesn't match runtime version (14)`);let t=e.nodeNames.split(" ");this.minRepeatTerm=t.length;for(let l=0;l<e.repeatNodeCount;l++)t.push("");let i=Object.keys(e.topRules).map(l=>e.topRules[l][1]),s=[];for(let l=0;l<t.length;l++)s.push([]);function r(l,a,h){s[l].push([a,a.deserialize(String(h))])}if(e.nodeProps)for(let l of e.nodeProps){let a=l[0];typeof a=="string"&&(a=E[a]);for(let h=1;h<l.length;){let c=l[h++];if(c>=0)r(c,a,l[h++]);else{let f=l[h+-c];for(let u=-c;u>0;u--)r(l[h++],a,f);h++}}}this.nodeSet=new rl(t.map((l,a)=>ve.define({name:a>=this.minRepeatTerm?void 0:l,id:a,props:s[a],top:i.indexOf(a)>-1,error:a==0,skipped:e.skippedNodes&&e.skippedNodes.indexOf(a)>-1}))),e.propSources&&(this.nodeSet=this.nodeSet.extend(...e.propSources)),this.strict=!1,this.bufferLength=_c;let o=Vn(e.tokenData);this.context=e.context,this.specializerSpecs=e.specialized||[],this.specialized=new Uint16Array(this.specializerSpecs.length);for(let l=0;l<this.specializerSpecs.length;l++)this.specialized[l]=this.specializerSpecs[l].term;this.specializers=this.specializerSpecs.map(eh),this.states=Vn(e.states,Uint32Array),this.data=Vn(e.stateData),this.goto=Vn(e.goto),this.maxTerm=e.maxTerm,this.tokenizers=e.tokenizers.map(l=>typeof l=="number"?new ki(o,l):l),this.topRules=e.topRules,this.dialects=e.dialects||{},this.dynamicPrecedences=e.dynamicPrecedences||null,this.tokenPrecTable=e.tokenPrec,this.termNames=e.termNames||null,this.maxNode=this.nodeSet.types.length-1,this.dialect=this.parseDialect(),this.top=this.topRules[Object.keys(this.topRules)[0]]}createParse(e,t,i){let s=new hb(this,e,t,i);for(let r of this.wrappers)s=r(s,e,t,i);return s}getGoto(e,t,i=!1){let s=this.goto;if(t>=s[0])return-1;for(let r=s[t+1];;){let o=s[r++],l=o&1,a=s[r++];if(l&&i)return a;for(let h=r+(o>>1);r<h;r++)if(s[r]==e)return a;if(l)return-1}}hasAction(e,t){let i=this.data;for(let s=0;s<2;s++)for(let r=this.stateSlot(e,s?2:1),o;;r+=3){if((o=i[r])==65535)if(i[r+1]==1)o=i[r=ft(i,r+2)];else{if(i[r+1]==2)return ft(i,r+2);break}if(o==t||o==0)return ft(i,r+1)}return 0}stateSlot(e,t){return this.states[e*6+t]}stateFlag(e,t){return(this.stateSlot(e,0)&t)>0}validAction(e,t){return!!this.allActions(e,i=>i==t?!0:null)}allActions(e,t){let i=this.stateSlot(e,4),s=i?t(i):void 0;for(let r=this.stateSlot(e,1);s==null;r+=3){if(this.data[r]==65535)if(this.data[r+1]==1)r=ft(this.data,r+2);else break;s=t(ft(this.data,r+1))}return s}nextStates(e){let t=[];for(let i=this.stateSlot(e,1);;i+=3){if(this.data[i]==65535)if(this.data[i+1]==1)i=ft(this.data,i+2);else break;if((this.data[i+2]&1)==0){let s=this.data[i+1];t.some((r,o)=>o&1&&r==s)||t.push(this.data[i],s)}}return t}configure(e){let t=Object.assign(Object.create(Rs.prototype),this);if(e.props&&(t.nodeSet=this.nodeSet.extend(...e.props)),e.top){let i=this.topRules[e.top];if(!i)throw new RangeError(`Invalid top rule name ${e.top}`);t.top=i}return e.tokenizers&&(t.tokenizers=this.tokenizers.map(i=>{let s=e.tokenizers.find(r=>r.from==i);return s?s.to:i})),e.specializers&&(t.specializers=this.specializers.slice(),t.specializerSpecs=this.specializerSpecs.map((i,s)=>{let r=e.specializers.find(l=>l.from==i.external);if(!r)return i;let o=Object.assign(Object.assign({},i),{external:r.to});return t.specializers[s]=eh(o),o})),e.contextTracker&&(t.context=e.contextTracker),e.dialect&&(t.dialect=this.parseDialect(e.dialect)),e.strict!=null&&(t.strict=e.strict),e.wrap&&(t.wrappers=t.wrappers.concat(e.wrap)),e.bufferLength!=null&&(t.bufferLength=e.bufferLength),t}hasWrappers(){return this.wrappers.length>0}getName(e){return this.termNames?this.termNames[e]:String(e<=this.maxNode&&this.nodeSet.types[e].name||e)}get eofTerm(){return this.maxNode+1}get topNode(){return this.nodeSet.types[this.top[1]]}dynamicPrecedence(e){let t=this.dynamicPrecedences;return t==null?0:t[e]||0}parseDialect(e){let t=Object.keys(this.dialects),i=t.map(()=>!1);if(e)for(let r of e.split(" ")){let o=t.indexOf(r);o>=0&&(i[o]=!0)}let s=null;for(let r=0;r<t.length;r++)if(!i[r])for(let o=this.dialects[t[r]],l;(l=this.data[o++])!=65535;)(s||(s=new Uint8Array(this.maxTerm+1)))[l]=1;return new cb(e,i,s)}static deserialize(e){return new Rs(e)}}function ft(n,e){return n[e]|n[e+1]<<16}function fb(n){let e=null;for(let t of n){let i=t.p.stoppedAt;(t.pos==t.p.stream.end||i!=null&&t.pos>i)&&t.p.parser.stateFlag(t.state,2)&&(!e||e.score<t.score)&&(e=t)}return e}function eh(n){if(n.external){let e=n.extend?1:0;return(t,i)=>n.external(t,i)<<1|e}return n.get}const ub=tf({String:g.string,Number:g.number,"True False":g.bool,PropertyName:g.propertyName,Null:g.null,", :":g.separator,"[ ]":g.squareBracket,"{ }":g.brace}),db=Rs.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[ub],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),pb=()=>n=>{try{JSON.parse(n.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const t=gb(e,n.state.doc);return[{from:t,message:e.message,severity:"error",to:t}]}return[]};function gb(n,e){let t;return(t=n.message.match(/at position (\d+)/))?Math.min(+t[1],e.length):(t=n.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+t[1]).from+ +t[2]-1,e.length):0}const mb=vs.define({name:"json",parser:db.configure({props:[of.add({Object:La({except:/^\s*\}/}),Array:La({except:/^\s*\]/})}),af.add({"Object Array":pm})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function bb(){return new im(mb)}class th{constructor(e,t,i){this.from=e,this.to=t,this.diagnostic=i}}class qt{constructor(e,t,i){this.diagnostics=e,this.panel=t,this.selected=i}static init(e,t,i){let s=i.facet(ot).markerFilter;s&&(e=s(e,i));let r=e.slice().sort((d,p)=>d.from-p.from||d.to-p.to),o=new pt,l=[],a=0,h=i.doc.iter(),c=0,f=i.doc.length;for(let d=0;;){let p=d==r.length?null:r[d];if(!p&&!l.length)break;let m,b;if(l.length)m=a,b=l.reduce((k,D)=>Math.min(k,D.to),p&&p.from>m?p.from:1e8);else{if(m=p.from,m>f)break;b=p.to,l.push(p),d++}for(;d<r.length;){let k=r[d];if(k.from==m&&(k.to>k.from||k.to==m))l.push(k),d++,b=Math.min(k.to,b);else{b=Math.min(k.from,b);break}}b=Math.min(b,f);let y=!1;if(l.some(k=>k.from==m&&(k.to==b||b==f))&&(y=m==b,!y&&b-m<10)){let k=m-(c+h.value.length);k>0&&(h.next(k),c=m);for(let D=m;;){if(D>=b){y=!0;break}if(!h.lineBreak&&c+h.value.length>D)break;D=c+h.value.length,c+=h.value.length,h.next()}}let w=Lb(l);if(y)o.add(m,m,B.widget({widget:new Db(w),diagnostics:l.slice()}));else{let k=l.reduce((D,v)=>v.markClass?D+" "+v.markClass:D,"");o.add(m,b,B.mark({class:"cm-lintRange cm-lintRange-"+w+k,diagnostics:l.slice(),inclusiveEnd:l.some(D=>D.to>b)}))}if(a=b,a==f)break;for(let k=0;k<l.length;k++)l[k].to<=a&&l.splice(k--,1)}let u=o.finish();return new qt(u,t,Lt(u))}}function Lt(n,e=null,t=0){let i=null;return n.between(t,1e9,(s,r,{spec:o})=>{if(!(e&&o.diagnostics.indexOf(e)<0))if(!i)i=new th(s,r,e||o.diagnostics[0]);else{if(o.diagnostics.indexOf(i.diagnostic)<0)return!1;i=new th(i.from,r,i.diagnostic)}}),i}function yb(n,e){let t=e.pos,i=e.end||t,s=n.state.facet(ot).hideOn(n,t,i);if(s!=null)return s;let r=n.startState.doc.lineAt(e.pos);return!!(n.effects.some(o=>o.is(ml))||n.changes.touchesRange(r.from,Math.max(r.to,i)))}function Zf(n,e){return n.field(Te,!1)?e:e.concat(L.appendConfig.of(nu))}function xb(n,e){return{effects:Zf(n,[ml.of(e)])}}const ml=L.define(),bl=L.define(),eu=L.define(),Te=ce.define({create(){return new qt(B.none,null,null)},update(n,e){if(e.docChanged&&n.diagnostics.size){let t=n.diagnostics.map(e.changes),i=null,s=n.panel;if(n.selected){let r=e.changes.mapPos(n.selected.from,1);i=Lt(t,n.selected.diagnostic,r)||Lt(t,null,r)}!t.size&&s&&e.state.facet(ot).autoPanel&&(s=null),n=new qt(t,s,i)}for(let t of e.effects)if(t.is(ml)){let i=e.state.facet(ot).autoPanel?t.value.length?an.open:null:n.panel;n=qt.init(t.value,i,e.state)}else t.is(bl)?n=new qt(n.diagnostics,t.value?an.open:null,n.selected):t.is(eu)&&(n=new qt(n.diagnostics,n.panel,t.value));return n},provide:n=>[sn.from(n,e=>e.panel),T.decorations.from(n,e=>e.diagnostics)]}),kb=B.mark({class:"cm-lintRange cm-lintRange-active"});function wb(n,e,t){let{diagnostics:i}=n.state.field(Te),s,r=-1,o=-1;i.between(e-(t<0?1:0),e+(t>0?1:0),(a,h,{spec:c})=>{if(e>=a&&e<=h&&(a==h||(e>a||t>0)&&(e<h||t<0)))return s=c.diagnostics,r=a,o=h,!1});let l=n.state.facet(ot).tooltipFilter;return s&&l&&(s=l(s,n.state)),s?{pos:r,end:o,above:n.state.doc.lineAt(r).to<o,create(){return{dom:vb(n,s)}}}:null}function vb(n,e){return $("ul",{class:"cm-tooltip-lint"},e.map(t=>iu(n,t,!1)))}const Sb=n=>{let e=n.state.field(Te,!1);(!e||!e.panel)&&n.dispatch({effects:Zf(n.state,[bl.of(!0)])});let t=sl(n,an.open);return t&&t.dom.querySelector(".cm-panel-lint ul").focus(),!0},ih=n=>{let e=n.state.field(Te,!1);return!e||!e.panel?!1:(n.dispatch({effects:bl.of(!1)}),!0)},Cb=n=>{let e=n.state.field(Te,!1);if(!e)return!1;let t=n.state.selection.main,i=Lt(e.diagnostics,null,t.to+1);return!i&&(i=Lt(e.diagnostics,null,0),!i||i.from==t.from&&i.to==t.to)?!1:(n.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0}),!0)},Ab=[{key:"Mod-Shift-m",run:Sb,preventDefault:!0},{key:"F8",run:Cb}],Mb=X.fromClass(class{constructor(n){this.view=n,this.timeout=-1,this.set=!0;let{delay:e}=n.state.facet(ot);this.lintTime=Date.now()+e,this.run=this.run.bind(this),this.timeout=setTimeout(this.run,e)}run(){clearTimeout(this.timeout);let n=Date.now();if(n<this.lintTime-10)this.timeout=setTimeout(this.run,this.lintTime-n);else{this.set=!1;let{state:e}=this.view,{sources:t}=e.facet(ot);t.length&&Tb(t.map(i=>Promise.resolve(i(this.view))),i=>{this.view.state.doc==e.doc&&this.view.dispatch(xb(this.view.state,i.reduce((s,r)=>s.concat(r))))},i=>{ge(this.view.state,i)})}}update(n){let e=n.state.facet(ot);(n.docChanged||e!=n.startState.facet(ot)||e.needsRefresh&&e.needsRefresh(n))&&(this.lintTime=Date.now()+e.delay,this.set||(this.set=!0,this.timeout=setTimeout(this.run,e.delay)))}force(){this.set&&(this.lintTime=Date.now(),this.run())}destroy(){clearTimeout(this.timeout)}});function Tb(n,e,t){let i=[],s=-1;for(let r of n)r.then(o=>{i.push(o),clearTimeout(s),i.length==n.length?e(i):s=setTimeout(()=>e(i),200)},t)}const ot=O.define({combine(n){return{sources:n.map(e=>e.source).filter(e=>e!=null),...at(n.map(e=>e.config),{delay:750,markerFilter:null,tooltipFilter:null,needsRefresh:null,hideOn:()=>null},{delay:Math.max,markerFilter:nh,tooltipFilter:nh,needsRefresh:(e,t)=>e?t?i=>e(i)||t(i):e:t,hideOn:(e,t)=>e?t?(i,s,r)=>e(i,s,r)||t(i,s,r):e:t,autoPanel:(e,t)=>e||t})}}});function nh(n,e){return n?e?(t,i)=>e(n(t,i),i):n:e}function Ob(n,e={}){return[ot.of({source:n,config:e}),Mb,nu]}function tu(n){let e=[];if(n)e:for(let{name:t}of n){for(let i=0;i<t.length;i++){let s=t[i];if(/[a-zA-Z]/.test(s)&&!e.some(r=>r.toLowerCase()==s.toLowerCase())){e.push(s);continue e}}e.push("")}return e}function iu(n,e,t){var i;let s=t?tu(e.actions):[];return $("li",{class:"cm-diagnostic cm-diagnostic-"+e.severity},$("span",{class:"cm-diagnosticText"},e.renderMessage?e.renderMessage(n):e.message),(i=e.actions)===null||i===void 0?void 0:i.map((r,o)=>{let l=!1,a=d=>{if(d.preventDefault(),l)return;l=!0;let p=Lt(n.state.field(Te).diagnostics,e);p&&r.apply(n,p.from,p.to)},{name:h}=r,c=s[o]?h.indexOf(s[o]):-1,f=c<0?h:[h.slice(0,c),$("u",h.slice(c,c+1)),h.slice(c+1)],u=r.markClass?" "+r.markClass:"";return $("button",{type:"button",class:"cm-diagnosticAction"+u,onclick:a,onmousedown:a,"aria-label":` Action: ${h}${c<0?"":` (access key "${s[o]})"`}.`},f)}),e.source&&$("div",{class:"cm-diagnosticSource"},e.source))}class Db extends yt{constructor(e){super(),this.sev=e}eq(e){return e.sev==this.sev}toDOM(){return $("span",{class:"cm-lintPoint cm-lintPoint-"+this.sev})}}class sh{constructor(e,t){this.diagnostic=t,this.id="item_"+Math.floor(Math.random()*4294967295).toString(16),this.dom=iu(e,t,!0),this.dom.id=this.id,this.dom.setAttribute("role","option")}}class an{constructor(e){this.view=e,this.items=[];let t=s=>{if(!(s.ctrlKey||s.altKey||s.metaKey)){if(s.keyCode==27)ih(this.view),this.view.focus();else if(s.keyCode==38||s.keyCode==33)this.moveSelection((this.selectedIndex-1+this.items.length)%this.items.length);else if(s.keyCode==40||s.keyCode==34)this.moveSelection((this.selectedIndex+1)%this.items.length);else if(s.keyCode==36)this.moveSelection(0);else if(s.keyCode==35)this.moveSelection(this.items.length-1);else if(s.keyCode==13)this.view.focus();else if(s.keyCode>=65&&s.keyCode<=90&&this.selectedIndex>=0){let{diagnostic:r}=this.items[this.selectedIndex],o=tu(r.actions);for(let l=0;l<o.length;l++)if(o[l].toUpperCase().charCodeAt(0)==s.keyCode){let a=Lt(this.view.state.field(Te).diagnostics,r);a&&r.actions[l].apply(e,a.from,a.to)}}else return;s.preventDefault()}},i=s=>{for(let r=0;r<this.items.length;r++)this.items[r].dom.contains(s.target)&&this.moveSelection(r)};this.list=$("ul",{tabIndex:0,role:"listbox","aria-label":this.view.state.phrase("Diagnostics"),onkeydown:t,onclick:i}),this.dom=$("div",{class:"cm-panel-lint"},this.list,$("button",{type:"button",name:"close","aria-label":this.view.state.phrase("close"),onclick:()=>ih(this.view)},"×")),this.update()}get selectedIndex(){let e=this.view.state.field(Te).selected;if(!e)return-1;for(let t=0;t<this.items.length;t++)if(this.items[t].diagnostic==e.diagnostic)return t;return-1}update(){let{diagnostics:e,selected:t}=this.view.state.field(Te),i=0,s=!1,r=null,o=new Set;for(e.between(0,this.view.state.doc.length,(l,a,{spec:h})=>{for(let c of h.diagnostics){if(o.has(c))continue;o.add(c);let f=-1,u;for(let d=i;d<this.items.length;d++)if(this.items[d].diagnostic==c){f=d;break}f<0?(u=new sh(this.view,c),this.items.splice(i,0,u),s=!0):(u=this.items[f],f>i&&(this.items.splice(i,f-i),s=!0)),t&&u.diagnostic==t.diagnostic?u.dom.hasAttribute("aria-selected")||(u.dom.setAttribute("aria-selected","true"),r=u):u.dom.hasAttribute("aria-selected")&&u.dom.removeAttribute("aria-selected"),i++}});i<this.items.length&&!(this.items.length==1&&this.items[0].diagnostic.from<0);)s=!0,this.items.pop();this.items.length==0&&(this.items.push(new sh(this.view,{from:-1,to:-1,severity:"info",message:this.view.state.phrase("No diagnostics")})),s=!0),r?(this.list.setAttribute("aria-activedescendant",r.id),this.view.requestMeasure({key:this,read:()=>({sel:r.dom.getBoundingClientRect(),panel:this.list.getBoundingClientRect()}),write:({sel:l,panel:a})=>{let h=a.height/this.list.offsetHeight;l.top<a.top?this.list.scrollTop-=(a.top-l.top)/h:l.bottom>a.bottom&&(this.list.scrollTop+=(l.bottom-a.bottom)/h)}})):this.selectedIndex<0&&this.list.removeAttribute("aria-activedescendant"),s&&this.sync()}sync(){let e=this.list.firstChild;function t(){let i=e;e=i.nextSibling,i.remove()}for(let i of this.items)if(i.dom.parentNode==this.list){for(;e!=i.dom;)t();e=i.dom.nextSibling}else this.list.insertBefore(i.dom,e);for(;e;)t()}moveSelection(e){if(this.selectedIndex<0)return;let t=this.view.state.field(Te),i=Lt(t.diagnostics,this.items[e].diagnostic);i&&this.view.dispatch({selection:{anchor:i.from,head:i.to},scrollIntoView:!0,effects:eu.of(i)})}static open(e){return new an(e)}}function Rb(n,e='viewBox="0 0 40 40"'){return`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" ${e}>${encodeURIComponent(n)}</svg>')`}function zn(n){return Rb(`<path d="m0 2.5 l2 -1.5 l1 0 l2 1.5 l1 0" stroke="${n}" fill="none" stroke-width=".7"/>`,'width="6" height="3"')}const Bb=T.baseTheme({".cm-diagnostic":{padding:"3px 6px 3px 8px",marginLeft:"-1px",display:"block",whiteSpace:"pre-wrap"},".cm-diagnostic-error":{borderLeft:"5px solid #d11"},".cm-diagnostic-warning":{borderLeft:"5px solid orange"},".cm-diagnostic-info":{borderLeft:"5px solid #999"},".cm-diagnostic-hint":{borderLeft:"5px solid #66d"},".cm-diagnosticAction":{font:"inherit",border:"none",padding:"2px 4px",backgroundColor:"#444",color:"white",borderRadius:"3px",marginLeft:"8px",cursor:"pointer"},".cm-diagnosticSource":{fontSize:"70%",opacity:.7},".cm-lintRange":{backgroundPosition:"left bottom",backgroundRepeat:"repeat-x",paddingBottom:"0.7px"},".cm-lintRange-error":{backgroundImage:zn("#d11")},".cm-lintRange-warning":{backgroundImage:zn("orange")},".cm-lintRange-info":{backgroundImage:zn("#999")},".cm-lintRange-hint":{backgroundImage:zn("#66d")},".cm-lintRange-active":{backgroundColor:"#ffdd9980"},".cm-tooltip-lint":{padding:0,margin:0},".cm-lintPoint":{position:"relative","&:after":{content:'""',position:"absolute",bottom:0,left:"-2px",borderLeft:"3px solid transparent",borderRight:"3px solid transparent",borderBottom:"4px solid #d11"}},".cm-lintPoint-warning":{"&:after":{borderBottomColor:"orange"}},".cm-lintPoint-info":{"&:after":{borderBottomColor:"#999"}},".cm-lintPoint-hint":{"&:after":{borderBottomColor:"#66d"}},".cm-panel.cm-panel-lint":{position:"relative","& ul":{maxHeight:"100px",overflowY:"auto","& [aria-selected]":{backgroundColor:"#ddd","& u":{textDecoration:"underline"}},"&:focus [aria-selected]":{background_fallback:"#bdf",backgroundColor:"Highlight",color_fallback:"white",color:"HighlightText"},"& u":{textDecoration:"none"},padding:0,margin:0},"& [name=close]":{position:"absolute",top:"0",right:"2px",background:"inherit",border:"none",font:"inherit",padding:0,margin:0}},"&dark .cm-lintRange-active":{backgroundColor:"#86714a80"},"&dark .cm-panel.cm-panel-lint ul":{"& [aria-selected]":{backgroundColor:"#2e343e"}}});function Pb(n){return n=="error"?4:n=="warning"?3:n=="info"?2:1}function Lb(n){let e="hint",t=1;for(let i of n){let s=Pb(i.severity);s>t&&(t=s,e=i.severity)}return e}const nu=[Te,T.decorations.compute([Te],n=>{let{selected:e,panel:t}=n.field(Te);return!e||!t||e.from==e.to?B.none:B.set([kb.range(e.from,e.to)])}),kg(wb,{hideOn:yb}),Bb],Sr={fontSize:"14px",fontFamily:"JetBrains Mono, Consolas, monospace",lineHeight:"1.6"},Eb={borderLeftWidth:"2px"},Re={insertedTextDecoration:"none",deletedTextDecoration:"line-through",insertedLinePadding:"1px 3px",borderRadious:"3px"},Wt={border:"none",paddingRight:"8px",fontSize:"0.9em",fontWeight:"500",lineHeight:"1.78"},Cr={border:"none",borderRadius:"4px",padding:"2px 10px"},Ib={borderRadius:"2px"},Ar={borderRadius:"2px"},Mr={borderRadius:"4px",padding:"0 5px",margin:"0 2px"},Tr={width:"12px",height:"12px",borderRadius:"6px"},$n={borderRadius:"4px",padding:"2px 6px"},ri={borderRadius:"4px",borderRadiusSelected:"3px",lineHeight:"1.3",padding:"4px 8px",paddingRight:"8px"},Or="#1e2124",Je="#e2e2e2",Fi="#5c88da",Nb="#b8b8b8",Wb="#ffffff",Dr="#e4e4e4",Qt="#909090",Fb="#000000",Hb="#e06c75",xt="#f39c12",Kt="#ffcb6b",qn="#98c379",Kn="#56b6c2",ct="#61afef",Vt="#c678dd",Vb="#be5046",Yt="#e06c75",Hi="#252529",rh="#3a5991aa",oh="#3a3d4166",jn="#2a2c31",Rr=Wb,zb="#3a599140",$b=Vt,lh="#1e462c50",ah="#5c1e2340",Br="#73c991",Pr="#f07178",qb=T.theme({"&":{color:Je,backgroundColor:Or,fontSize:Sr.fontSize,fontFamily:Sr.fontFamily},".cm-content":{caretColor:Rr,lineHeight:Sr.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:Rr,borderLeftWidth:Eb.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${Rr}99`,color:Or},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:rh,color:Je},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:"#4a74c480",outline:`1px solid ${Fi}`,color:Je,borderRadius:$n.borderRadius,"& span":{color:Je}},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#5c88da90",color:Je,padding:$n.padding,"& span":{color:Je}},".cm-search.cm-panel.cm-textfield":{color:Dr,borderRadius:$n.borderRadius,padding:$n.padding},".cm-panels":{backgroundColor:Hi,color:Dr,borderRadius:"0 0 4px 4px"},".cm-panels.cm-panels-top":{borderBottom:"1px solid #3a3a3a"},".cm-panels.cm-panels-bottom":{borderTop:"1px solid #3a3a3a"},".cm-panel button":{backgroundColor:Hi,color:Dr,border:Cr.border,borderRadius:Cr.borderRadius,padding:Cr.padding},".cm-panel button:hover":{backgroundColor:"#35373d"},".cm-activeLine":{backgroundColor:oh,borderRadius:Ib.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:Hi,color:Qt,border:Wt.border,borderRight:"1px solid #35383d",paddingRight:Wt.paddingRight},".cm-activeLineGutter":{backgroundColor:oh,color:Nb,fontWeight:Wt.fontWeight},".cm-lineNumbers":{fontSize:Wt.fontSize,lineHeight:Wt.lineHeight},".cm-foldGutter":{fontSize:Wt.fontSize,lineHeight:Wt.lineHeight},".cm-foldGutter .cm-gutterElement":{color:Qt,cursor:"pointer"},".cm-foldGutter .cm-gutterElement:hover":{color:Je},".cm-insertedLine":{textDecoration:Re.insertedTextDecoration,backgroundColor:lh,color:Br,padding:Re.insertedLinePadding,borderRadius:Re.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:Re.insertedTextDecoration,backgroundColor:`${lh} !important`,color:Br,padding:Re.insertedLinePadding,borderRadius:Re.borderRadious,border:`1px solid ${Br}40`},"ins.cm-insertedLine .cm-changedText":{background:"transparent !important"},".cm-deletedLine":{textDecoration:Re.deletedTextDecoration,backgroundColor:ah,color:Pr,padding:Re.insertedLinePadding,borderRadius:Re.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:Re.deletedTextDecoration,backgroundColor:`${ah} !important`,color:Pr,padding:Re.insertedLinePadding,borderRadius:Re.borderRadious,border:`1px solid ${Pr}40`},"del .cm-deletedText, del .cm-changedText":{background:"transparent !important"},".cm-tooltip":{backgroundColor:jn,border:"1px solid #3a3a3a",borderRadius:ri.borderRadius,padding:ri.padding,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.3)"},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:jn,border:"none"},"& > ul > li":{padding:ri.padding,lineHeight:ri.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:rh,color:Je,borderRadius:ri.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:Qt,paddingRight:ri.paddingRight},"& > ul > li > span.cm-completionDetail":{color:Qt,fontStyle:"italic"}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:jn,borderBottomColor:jn},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${Yt}`},"&-warning":{borderLeft:`3px solid ${Kt}`},"&-info":{borderLeft:`3px solid ${ct}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${Yt}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${Kt}`},".cm-matchingBracket":{backgroundColor:zb,outline:`1px solid ${$b}60`,borderRadius:Ar.borderRadius},".cm-nonmatchingBracket":{backgroundColor:"#e06c7540",outline:`1px solid ${Yt}`,borderRadius:Ar.borderRadius},".cm-selectionMatch":{backgroundColor:"#4a74c440",outline:`1px solid ${Fi}50`,borderRadius:Ar.borderRadius},".cm-foldPlaceholder":{backgroundColor:"transparent",color:Fi,border:`1px dotted ${Fi}70`,borderRadius:Mr.borderRadius,padding:Mr.padding,margin:Mr.margin},"&.cm-focused":{outline:"none",boxShadow:`0 0 0 2px ${Or}, 0 0 0 3px ${Fi}40`},"& .cm-scroller::-webkit-scrollbar":{width:Tr.width,height:Tr.height},"& .cm-scroller::-webkit-scrollbar-track":{background:Hi},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:"#444448",borderRadius:Tr.borderRadius,border:`3px solid ${Hi}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:"#55555a"},".cm-ghostText":{opacity:"0.5",color:"#b8b8b8"}},{dark:!0}),Kb=Ri.define([{tag:g.keyword,color:Kt,fontWeight:"bold"},{tag:g.controlKeyword,color:Kt,fontWeight:"bold"},{tag:g.moduleKeyword,color:Kt,fontWeight:"bold"},{tag:[g.name,g.deleted,g.character,g.macroName],color:ct},{tag:[g.variableName],color:ct},{tag:[g.propertyName],color:Kn,fontStyle:"normal"},{tag:[g.typeName],color:Kn},{tag:[g.className],color:Kn,fontStyle:"italic"},{tag:[g.namespace],color:ct,fontStyle:"italic"},{tag:[g.operator,g.operatorKeyword],color:Vt},{tag:[g.bracket],color:Vt},{tag:[g.brace],color:Vt},{tag:[g.punctuation],color:Vt},{tag:[g.function(g.variableName),g.labelName],color:ct},{tag:[g.definition(g.variableName)],color:ct},{tag:g.number,color:xt},{tag:g.changed,color:xt},{tag:g.annotation,color:Yt,fontStyle:"italic"},{tag:g.modifier,color:xt,fontStyle:"italic"},{tag:g.self,color:xt},{tag:[g.color,g.constant(g.name),g.standard(g.name)],color:xt},{tag:[g.atom,g.bool,g.special(g.variableName)],color:xt},{tag:[g.processingInstruction,g.inserted],color:qn},{tag:[g.special(g.string),g.regexp],color:qn},{tag:g.string,color:qn},{tag:g.definition(g.typeName),color:Kn,fontWeight:"bold"},{tag:g.meta,color:Hb},{tag:g.comment,fontStyle:"italic",color:Qt},{tag:g.docComment,fontStyle:"italic",color:Qt},{tag:[g.tagName],color:Kt},{tag:[g.attributeName],color:ct},{tag:[g.heading],fontWeight:"bold",color:Kt},{tag:[g.strong],fontWeight:"bold",color:xt,textShadow:`0 0 2px ${Fb}`},{tag:[g.emphasis],fontStyle:"italic",color:ct},{tag:[g.link],color:Vb,fontWeight:"500",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[g.url],color:qn,textDecoration:"underline",textUnderlineOffset:"2px"},{tag:[g.invalid],color:Je,textDecoration:"underline wavy",borderBottom:`1px wavy ${Yt}`},{tag:[g.strikethrough],color:Yt,textDecoration:"line-through"},{tag:g.constant(g.name),color:xt},{tag:g.deleted,color:Yt},{tag:g.squareBracket,color:Vt},{tag:g.angleBracket,color:Vt},{tag:g.monospace,color:Je},{tag:[g.contentSeparator],color:ct},{tag:g.quote,color:Qt}]),hh=[qb,ul(Kb)],Lr={fontSize:"14px",fontFamily:"JetBrains Mono, Consolas, monospace",lineHeight:"1.6"},jb={borderLeftWidth:"2px"},Be={insertedTextDecoration:"none",deletedTextDecoration:"line-through",insertedLinePadding:"1px 3px",borderRadious:"3px"},Ft={border:"none",paddingRight:"8px",fontSize:"0.9em",fontWeight:"500",lineHeight:"1.78"},Er={border:"none",borderRadius:"4px",padding:"2px 10px"},Ub={borderRadius:"2px"},Ir={borderRadius:"2px"},Nr={borderRadius:"4px",padding:"0 5px",margin:"0 2px"},Wr={width:"12px",height:"12px",borderRadius:"6px"},Un={borderRadius:"4px",padding:"2px 6px"},oi={borderRadius:"4px",borderRadiusSelected:"3px",lineHeight:"1.3",padding:"4px 8px",paddingRight:"8px"},Ze="#1c2434",su="#2d3748",Gn="#4a5568",pi="#718096",Gb="#edf2f750",Qb="#f7fafc",as="#f0f4f8",ai="#0c7792",Fe="#0369a1",He="#2b6cb0",zt="#1a365d",ch="#c53030",Qn="#dd6b20",jt="#d69e2e",Yb="#2f855a",_b="#805ad5",At="#e53e3e",fh=as,Xb="#ebf4ff40",Fr="#ffffff",Yn=Qb,Jb="#90cdf480",Zb="#63b3ed40",Hr=su,ey="#0c779220",ty=He,uh="#e6ffec60",dh="#ffebe9a0",Vr="#24783b",zr="#cf222e",iy=T.theme({"&":{color:Ze,backgroundColor:Fr,fontSize:Lr.fontSize,fontFamily:Lr.fontFamily},".cm-content":{caretColor:Hr,lineHeight:Lr.lineHeight},".cm-cursor, .cm-dropCursor":{borderLeftColor:Hr,borderLeftWidth:jb.borderLeftWidth},".cm-fat-cursor":{backgroundColor:`${Hr}99`,color:Fr},"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:Jb,color:zt},".cm-selectionLayer":{zIndex:100},".cm-searchMatch":{backgroundColor:"#63b3ed40",outline:`1px solid ${He}`,color:Ze,borderRadius:Un.borderRadius,"& span":{color:Ze}},".cm-searchMatch.cm-searchMatch-selected":{backgroundColor:"#63b3ed70",color:Ze,padding:Un.padding,"& span":{color:Ze}},".cm-search.cm-panel.cm-textfield":{color:Gn,borderRadius:Un.borderRadius,padding:Un.padding},".cm-panels":{backgroundColor:fh,color:pi,borderRadius:"4px"},".cm-panels.cm-panels-top":{borderBottom:"1px solid #e2e8f0"},".cm-panels.cm-panels-bottom":{borderTop:"1px solid #e2e8f0"},".cm-panel button":{backgroundColor:fh,color:Gn,border:Er.border,borderRadius:Er.borderRadius,padding:Er.padding},".cm-panel button:hover":{backgroundColor:"#e2e8f0"},".cm-activeLine":{backgroundColor:Xb,borderRadius:Ub.borderRadius,zIndex:1},".cm-gutters":{backgroundColor:as,color:Gn,border:Ft.border,borderRight:"1px solid #e2e8f0",paddingRight:Ft.paddingRight},".cm-activeLineGutter":{backgroundColor:Gb,color:Ze,fontWeight:Ft.fontWeight},".cm-lineNumbers":{fontSize:Ft.fontSize,lineHeight:Ft.lineHeight},".cm-foldGutter":{fontSize:Ft.fontSize,lineHeight:Ft.lineHeight},".cm-foldGutter .cm-gutterElement":{color:Gn,cursor:"pointer"},".cm-foldGutter .cm-gutterElement:hover":{color:Ze},".cm-insertedLine":{textDecoration:Be.insertedTextDecoration,backgroundColor:uh,color:Vr,padding:Be.insertedLinePadding,borderRadius:Be.borderRadious},"ins.cm-insertedLine, ins.cm-insertedLine:not(:has(.cm-changedText))":{textDecoration:Be.insertedTextDecoration,backgroundColor:`${uh} !important`,color:Vr,padding:Be.insertedLinePadding,borderRadius:Be.borderRadious,border:`1px solid ${Vr}30`},"ins.cm-insertedLine .cm-changedText":{background:"transparent !important"},".cm-deletedLine":{textDecoration:Be.deletedTextDecoration,backgroundColor:dh,color:zr,padding:Be.insertedLinePadding,borderRadius:Be.borderRadious},"del.cm-deletedLine, del, del:not(:has(.cm-deletedText))":{textDecoration:Be.deletedTextDecoration,backgroundColor:`${dh} !important`,color:zr,padding:Be.insertedLinePadding,borderRadius:Be.borderRadious,border:`1px solid ${zr}30`},"del .cm-deletedText, del .cm-changedText":{background:"transparent !important"},".cm-tooltip":{backgroundColor:Yn,border:"1px solid #e2e8f0",borderRadius:oi.borderRadius,padding:oi.padding,boxShadow:"0 2px 8px rgba(0, 0, 0, 0.1)"},".cm-tooltip-autocomplete":{"& > ul":{backgroundColor:Yn,border:"none"},"& > ul > li":{padding:oi.padding,lineHeight:oi.lineHeight},"& > ul > li[aria-selected]":{backgroundColor:"#0c779220",color:Ze,borderRadius:oi.borderRadiusSelected},"& > ul > li > span.cm-completionIcon":{color:pi,paddingRight:oi.paddingRight},"& > ul > li > span.cm-completionDetail":{color:pi,fontStyle:"italic"}},".cm-tooltip .cm-tooltip-arrow:before":{borderTopColor:"transparent",borderBottomColor:"transparent"},".cm-tooltip .cm-tooltip-arrow:after":{borderTopColor:Yn,borderBottomColor:Yn},".cm-diagnostic":{"&-error":{borderLeft:`3px solid ${At}`},"&-warning":{borderLeft:`3px solid ${jt}`},"&-info":{borderLeft:`3px solid ${ai}`}},".cm-lintPoint-error":{borderBottom:`2px wavy ${At}`},".cm-lintPoint-warning":{borderBottom:`2px wavy ${jt}`},".cm-matchingBracket":{backgroundColor:ey,outline:`1px solid ${ty}`,borderRadius:Ir.borderRadius},".cm-nonmatchingBracket":{backgroundColor:`${At}20`,outline:`1px solid ${At}`,borderRadius:Ir.borderRadius},".cm-selectionMatch":{backgroundColor:Zb,outline:`1px solid ${He}30`,borderRadius:Ir.borderRadius},".cm-foldPlaceholder":{backgroundColor:"transparent",color:pi,border:`1px dotted ${He}50`,borderRadius:Nr.borderRadius,padding:Nr.padding,margin:Nr.margin},"&.cm-focused":{outline:"none",boxShadow:`0 0 0 2px ${Fr}, 0 0 0 3px ${He}30`},"& .cm-scroller::-webkit-scrollbar":{width:Wr.width,height:Wr.height},"& .cm-scroller::-webkit-scrollbar-track":{background:as},"& .cm-scroller::-webkit-scrollbar-thumb":{backgroundColor:"#cbd5e0",borderRadius:Wr.borderRadius,border:`3px solid ${as}`},"& .cm-scroller::-webkit-scrollbar-thumb:hover":{backgroundColor:"#a0aec0"},".cm-ghostText":{opacity:"0.5",color:"#718096"}},{dark:!1}),ny=Ri.define([{tag:g.keyword,color:zt,fontWeight:"bold"},{tag:g.controlKeyword,color:zt,fontWeight:"bold"},{tag:g.moduleKeyword,color:zt,fontWeight:"bold"},{tag:[g.name,g.deleted,g.character,g.macroName],color:He},{tag:[g.variableName],color:He},{tag:[g.propertyName],color:He,fontStyle:"normal"},{tag:[g.typeName],color:jt},{tag:[g.className],color:jt,fontStyle:"italic"},{tag:[g.namespace],color:He,fontStyle:"italic"},{tag:[g.operator,g.operatorKeyword],color:Yb},{tag:[g.bracket],color:ai},{tag:[g.brace],color:ai},{tag:[g.punctuation],color:ai},{tag:[g.function(g.variableName),g.labelName],color:Fe},{tag:[g.definition(g.variableName)],color:He},{tag:g.number,color:Fe},{tag:g.changed,color:Fe},{tag:g.annotation,color:At,fontStyle:"italic"},{tag:g.modifier,color:Fe,fontStyle:"italic"},{tag:g.self,color:Fe},{tag:[g.color,g.constant(g.name),g.standard(g.name)],color:zt},{tag:[g.atom,g.bool,g.special(g.variableName)],color:Qn},{tag:[g.processingInstruction,g.inserted],color:ai},{tag:[g.special(g.string),g.regexp],color:ch},{tag:g.string,color:Qn},{tag:g.definition(g.typeName),color:jt,fontWeight:"bold"},{tag:g.meta,color:Fe},{tag:g.comment,fontStyle:"italic",color:pi},{tag:g.docComment,fontStyle:"italic",color:pi},{tag:[g.tagName],color:_b},{tag:[g.attributeName],color:jt},{tag:[g.heading],fontWeight:"bold",color:Fe},{tag:[g.strong],fontWeight:"bold",color:He},{tag:[g.emphasis],fontStyle:"italic",color:zt},{tag:[g.link],color:ai,fontWeight:"500",textDecoration:"underline",textUnderlinePosition:"under"},{tag:[g.url],color:Qn,textDecoration:"underline",textUnderlineOffset:"2px"},{tag:[g.invalid],color:Ze,textDecoration:"underline wavy",borderBottom:`1px wavy ${At}`},{tag:[g.strikethrough],color:At,textDecoration:"line-through"},{tag:g.constant(g.name),color:zt},{tag:g.deleted,color:At},{tag:g.squareBracket,color:ch},{tag:g.angleBracket,color:Qn},{tag:g.heading1,fontWeight:"bold",color:Fe},{tag:g.special(g.heading1),fontWeight:"bold",color:Fe},{tag:[g.heading2,g.heading3,g.heading4],fontWeight:"bold",color:Fe},{tag:[g.heading5,g.heading6],color:Fe},{tag:g.monospace,color:Ze},{tag:[g.contentSeparator],color:jt},{tag:g.quote,color:su}]),ph=[iy,ul(ny)],gh=typeof String.prototype.normalize=="function"?n=>n.normalize("NFKD"):n=>n;class Oi{constructor(e,t,i=0,s=e.length,r,o){this.test=o,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=e.iterRange(i,s),this.bufferStart=i,this.normalize=r?l=>r(gh(l)):gh,this.query=this.normalize(t)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return be(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let e=this.peek();if(e<0)return this.done=!0,this;let t=Vo(e),i=this.bufferStart+this.bufferPos;this.bufferPos+=tt(e);let s=this.normalize(t);if(s.length)for(let r=0,o=i;;r++){let l=s.charCodeAt(r),a=this.match(l,o,this.bufferPos+this.bufferStart);if(r==s.length-1){if(a)return this.value=a,this;break}o==i&&r<t.length&&t.charCodeAt(r)==l&&o++}}}match(e,t,i){let s=null;for(let r=0;r<this.matches.length;r+=2){let o=this.matches[r],l=!1;this.query.charCodeAt(o)==e&&(o==this.query.length-1?s={from:this.matches[r+1],to:i}:(this.matches[r]++,l=!0)),l||(this.matches.splice(r,2),r-=2)}return this.query.charCodeAt(0)==e&&(this.query.length==1?s={from:t,to:i}:this.matches.push(1,t)),s&&this.test&&!this.test(s.from,s.to,this.buffer,this.bufferStart)&&(s=null),s}}typeof Symbol<"u"&&(Oi.prototype[Symbol.iterator]=function(){return this});const ru={from:-1,to:-1,match:/.*/.exec("")},yl="gm"+(/x/.unicode==null?"":"u");class ou{constructor(e,t,i,s=0,r=e.length){if(this.text=e,this.to=r,this.curLine="",this.done=!1,this.value=ru,/\\[sWDnr]|\n|\r|\[\^/.test(t))return new lu(e,t,i,s,r);this.re=new RegExp(t,yl+(i?.ignoreCase?"i":"")),this.test=i?.test,this.iter=e.iter();let o=e.lineAt(s);this.curLineStart=o.from,this.matchPos=Bs(e,s),this.getLine(this.curLineStart)}getLine(e){this.iter.next(e),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let e=this.matchPos-this.curLineStart;;){this.re.lastIndex=e;let t=this.matchPos<=this.to&&this.re.exec(this.curLine);if(t){let i=this.curLineStart+t.index,s=i+t[0].length;if(this.matchPos=Bs(this.text,s+(i==s?1:0)),i==this.curLineStart+this.curLine.length&&this.nextLine(),(i<s||i>this.value.to)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this;e=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),e=0;else return this.done=!0,this}}}const $r=new WeakMap;class wi{constructor(e,t){this.from=e,this.text=t}get to(){return this.from+this.text.length}static get(e,t,i){let s=$r.get(e);if(!s||s.from>=i||s.to<=t){let l=new wi(t,e.sliceString(t,i));return $r.set(e,l),l}if(s.from==t&&s.to==i)return s;let{text:r,from:o}=s;return o>t&&(r=e.sliceString(t,o)+r,o=t),s.to<i&&(r+=e.sliceString(s.to,i)),$r.set(e,new wi(o,r)),new wi(t,r.slice(t-o,i-o))}}class lu{constructor(e,t,i,s,r){this.text=e,this.to=r,this.done=!1,this.value=ru,this.matchPos=Bs(e,s),this.re=new RegExp(t,yl+(i?.ignoreCase?"i":"")),this.test=i?.test,this.flat=wi.get(e,s,this.chunkEnd(s+5e3))}chunkEnd(e){return e>=this.to?this.to:this.text.lineAt(e).to}next(){for(;;){let e=this.re.lastIndex=this.matchPos-this.flat.from,t=this.re.exec(this.flat.text);if(t&&!t[0]&&t.index==e&&(this.re.lastIndex=e+1,t=this.re.exec(this.flat.text)),t){let i=this.flat.from+t.index,s=i+t[0].length;if((this.flat.to>=this.to||t.index+t[0].length<=this.flat.text.length-10)&&(!this.test||this.test(i,s,t)))return this.value={from:i,to:s,match:t},this.matchPos=Bs(this.text,s+(i==s?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=wi.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(ou.prototype[Symbol.iterator]=lu.prototype[Symbol.iterator]=function(){return this});function sy(n){try{return new RegExp(n,yl),!0}catch{return!1}}function Bs(n,e){if(e>=n.length)return e;let t=n.lineAt(e),i;for(;e<t.to&&(i=t.text.charCodeAt(e-t.from))>=56320&&i<57344;)e++;return e}const ry=n=>{let{state:e}=n,t=String(e.doc.lineAt(n.state.selection.main.head).number),{close:i,result:s}=vg(n,{label:e.phrase("Go to line"),input:{type:"text",name:"line",value:t},focus:!0,submitLabel:e.phrase("go")});return s.then(r=>{let o=r&&/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.elements.line.value);if(!o){n.dispatch({effects:i});return}let l=e.doc.lineAt(e.selection.main.head),[,a,h,c,f]=o,u=c?+c.slice(1):0,d=h?+h:l.number;if(h&&f){let b=d/100;a&&(b=b*(a=="-"?-1:1)+l.number/e.doc.lines),d=Math.round(e.doc.lines*b)}else h&&a&&(d=d*(a=="-"?-1:1)+l.number);let p=e.doc.line(Math.max(1,Math.min(e.doc.lines,d))),m=x.cursor(p.from+Math.max(0,Math.min(u,p.length)));n.dispatch({effects:[i,T.scrollIntoView(m.from,{y:"center"})],selection:m})}),!0},oy={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},ly=O.define({combine(n){return at(n,oy,{highlightWordAroundCursor:(e,t)=>e||t,minSelectionLength:Math.min,maxMatches:Math.min})}});function ay(n){return[dy,uy]}const hy=B.mark({class:"cm-selectionMatch"}),cy=B.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function mh(n,e,t,i){return(t==0||n(e.sliceDoc(t-1,t))!=Q.Word)&&(i==e.doc.length||n(e.sliceDoc(i,i+1))!=Q.Word)}function fy(n,e,t,i){return n(e.sliceDoc(t,t+1))==Q.Word&&n(e.sliceDoc(i-1,i))==Q.Word}const uy=X.fromClass(class{constructor(n){this.decorations=this.getDeco(n)}update(n){(n.selectionSet||n.docChanged||n.viewportChanged)&&(this.decorations=this.getDeco(n.view))}getDeco(n){let e=n.state.facet(ly),{state:t}=n,i=t.selection;if(i.ranges.length>1)return B.none;let s=i.main,r,o=null;if(s.empty){if(!e.highlightWordAroundCursor)return B.none;let a=t.wordAt(s.head);if(!a)return B.none;o=t.charCategorizer(s.head),r=t.sliceDoc(a.from,a.to)}else{let a=s.to-s.from;if(a<e.minSelectionLength||a>200)return B.none;if(e.wholeWords){if(r=t.sliceDoc(s.from,s.to),o=t.charCategorizer(s.head),!(mh(o,t,s.from,s.to)&&fy(o,t,s.from,s.to)))return B.none}else if(r=t.sliceDoc(s.from,s.to),!r)return B.none}let l=[];for(let a of n.visibleRanges){let h=new Oi(t.doc,r,a.from,a.to);for(;!h.next().done;){let{from:c,to:f}=h.value;if((!o||mh(o,t,c,f))&&(s.empty&&c<=s.from&&f>=s.to?l.push(cy.range(c,f)):(c>=s.to||f<=s.from)&&l.push(hy.range(c,f)),l.length>e.maxMatches))return B.none}}return B.set(l)}},{decorations:n=>n.decorations}),dy=T.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),py=({state:n,dispatch:e})=>{let{selection:t}=n,i=x.create(t.ranges.map(s=>n.wordAt(s.head)||x.cursor(s.head)),t.mainIndex);return i.eq(t)?!1:(e(n.update({selection:i})),!0)};function gy(n,e){let{main:t,ranges:i}=n.selection,s=n.wordAt(t.head),r=s&&s.from==t.from&&s.to==t.to;for(let o=!1,l=new Oi(n.doc,e,i[i.length-1].to);;)if(l.next(),l.done){if(o)return null;l=new Oi(n.doc,e,0,Math.max(0,i[i.length-1].from-1)),o=!0}else{if(o&&i.some(a=>a.from==l.value.from))continue;if(r){let a=n.wordAt(l.value.from);if(!a||a.from!=l.value.from||a.to!=l.value.to)continue}return l.value}}const my=({state:n,dispatch:e})=>{let{ranges:t}=n.selection;if(t.some(r=>r.from===r.to))return py({state:n,dispatch:e});let i=n.sliceDoc(t[0].from,t[0].to);if(n.selection.ranges.some(r=>n.sliceDoc(r.from,r.to)!=i))return!1;let s=gy(n,i);return s?(e(n.update({selection:n.selection.addRange(x.range(s.from,s.to),!1),effects:T.scrollIntoView(s.to)})),!0):!1},Pi=O.define({combine(n){return at(n,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:e=>new Ry(e),scrollToMatch:e=>T.scrollIntoView(e)})}});class au{constructor(e){this.search=e.search,this.caseSensitive=!!e.caseSensitive,this.literal=!!e.literal,this.regexp=!!e.regexp,this.replace=e.replace||"",this.valid=!!this.search&&(!this.regexp||sy(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!e.wholeWord,this.test=e.test}unquote(e){return this.literal?e:e.replace(/\\([nrt\\])/g,(t,i)=>i=="n"?` 12 + `:i=="r"?"\r":i=="t"?" ":"\\")}eq(e){return this.search==e.search&&this.replace==e.replace&&this.caseSensitive==e.caseSensitive&&this.regexp==e.regexp&&this.wholeWord==e.wholeWord&&this.test==e.test}create(){return this.regexp?new vy(this):new xy(this)}getCursor(e,t=0,i){let s=e.doc?e:H.create({doc:e});return i==null&&(i=s.doc.length),this.regexp?ci(this,s,t,i):hi(this,s,t,i)}}class hu{constructor(e){this.spec=e}}function by(n,e,t){return(i,s,r,o)=>{if(t&&!t(i,s,r,o))return!1;let l=i>=o&&s<=o+r.length?r.slice(i-o,s-o):e.doc.sliceString(i,s);return n(l,e,i,s)}}function hi(n,e,t,i){let s;return n.wholeWord&&(s=yy(e.doc,e.charCategorizer(e.selection.main.head))),n.test&&(s=by(n.test,e,s)),new Oi(e.doc,n.unquoted,t,i,n.caseSensitive?void 0:r=>r.toLowerCase(),s)}function yy(n,e){return(t,i,s,r)=>((r>t||r+s.length<i)&&(r=Math.max(0,t-2),s=n.sliceString(r,Math.min(n.length,i+2))),(e(Ps(s,t-r))!=Q.Word||e(Ls(s,t-r))!=Q.Word)&&(e(Ls(s,i-r))!=Q.Word||e(Ps(s,i-r))!=Q.Word))}class xy extends hu{constructor(e){super(e)}nextMatch(e,t,i){let s=hi(this.spec,e,i,e.doc.length).nextOverlapping();if(s.done){let r=Math.min(e.doc.length,t+this.spec.unquoted.length);s=hi(this.spec,e,0,r).nextOverlapping()}return s.done||s.value.from==t&&s.value.to==i?null:s.value}prevMatchInRange(e,t,i){for(let s=i;;){let r=Math.max(t,s-1e4-this.spec.unquoted.length),o=hi(this.spec,e,r,s),l=null;for(;!o.nextOverlapping().done;)l=o.value;if(l)return l;if(r==t)return null;s-=1e4}}prevMatch(e,t,i){let s=this.prevMatchInRange(e,0,t);return s||(s=this.prevMatchInRange(e,Math.max(0,i-this.spec.unquoted.length),e.doc.length)),s&&(s.from!=t||s.to!=i)?s:null}getReplacement(e){return this.spec.unquote(this.spec.replace)}matchAll(e,t){let i=hi(this.spec,e,0,e.doc.length),s=[];for(;!i.next().done;){if(s.length>=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=hi(this.spec,e,Math.max(0,t-this.spec.unquoted.length),Math.min(i+this.spec.unquoted.length,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}function ky(n,e,t){return(i,s,r)=>(!t||t(i,s,r))&&n(r[0],e,i,s)}function ci(n,e,t,i){let s;return n.wholeWord&&(s=wy(e.charCategorizer(e.selection.main.head))),n.test&&(s=ky(n.test,e,s)),new ou(e.doc,n.search,{ignoreCase:!n.caseSensitive,test:s},t,i)}function Ps(n,e){return n.slice(ne(n,e,!1),e)}function Ls(n,e){return n.slice(e,ne(n,e))}function wy(n){return(e,t,i)=>!i[0].length||(n(Ps(i.input,i.index))!=Q.Word||n(Ls(i.input,i.index))!=Q.Word)&&(n(Ls(i.input,i.index+i[0].length))!=Q.Word||n(Ps(i.input,i.index+i[0].length))!=Q.Word)}class vy extends hu{nextMatch(e,t,i){let s=ci(this.spec,e,i,e.doc.length).next();return s.done&&(s=ci(this.spec,e,0,t).next()),s.done?null:s.value}prevMatchInRange(e,t,i){for(let s=1;;s++){let r=Math.max(t,i-s*1e4),o=ci(this.spec,e,r,i),l=null;for(;!o.next().done;)l=o.value;if(l&&(r==t||l.from>r+10))return l;if(r==t)return null}}prevMatch(e,t,i){return this.prevMatchInRange(e,0,t)||this.prevMatchInRange(e,i,e.doc.length)}getReplacement(e){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(t,i)=>{if(i=="&")return e.match[0];if(i=="$")return"$";for(let s=i.length;s>0;s--){let r=+i.slice(0,s);if(r>0&&r<e.match.length)return e.match[r]+i.slice(s)}return t})}matchAll(e,t){let i=ci(this.spec,e,0,e.doc.length),s=[];for(;!i.next().done;){if(s.length>=t)return null;s.push(i.value)}return s}highlight(e,t,i,s){let r=ci(this.spec,e,Math.max(0,t-250),Math.min(i+250,e.doc.length));for(;!r.next().done;)s(r.value.from,r.value.to)}}const hn=L.define(),xl=L.define(),Mt=ce.define({create(n){return new qr(Ho(n).create(),null)},update(n,e){for(let t of e.effects)t.is(hn)?n=new qr(t.value.create(),n.panel):t.is(xl)&&(n=new qr(n.query,t.value?kl:null));return n},provide:n=>sn.from(n,e=>e.panel)});class qr{constructor(e,t){this.query=e,this.panel=t}}const Sy=B.mark({class:"cm-searchMatch"}),Cy=B.mark({class:"cm-searchMatch cm-searchMatch-selected"}),Ay=X.fromClass(class{constructor(n){this.view=n,this.decorations=this.highlight(n.state.field(Mt))}update(n){let e=n.state.field(Mt);(e!=n.startState.field(Mt)||n.docChanged||n.selectionSet||n.viewportChanged)&&(this.decorations=this.highlight(e))}highlight({query:n,panel:e}){if(!e||!n.spec.valid)return B.none;let{view:t}=this,i=new pt;for(let s=0,r=t.visibleRanges,o=r.length;s<o;s++){let{from:l,to:a}=r[s];for(;s<o-1&&a>r[s+1].from-500;)a=r[++s].to;n.highlight(t.state,l,a,(h,c)=>{let f=t.state.selection.ranges.some(u=>u.from==h&&u.to==c);i.add(h,c,f?Cy:Sy)})}return i.finish()}},{decorations:n=>n.decorations});function xn(n){return e=>{let t=e.state.field(Mt,!1);return t&&t.query.spec.valid?n(e,t):uu(e)}}const Es=xn((n,{query:e})=>{let{to:t}=n.state.selection.main,i=e.nextMatch(n.state,t,t);if(!i)return!1;let s=x.single(i.from,i.to),r=n.state.facet(Pi);return n.dispatch({selection:s,effects:[wl(n,i),r.scrollToMatch(s.main,n)],userEvent:"select.search"}),fu(n),!0}),Is=xn((n,{query:e})=>{let{state:t}=n,{from:i}=t.selection.main,s=e.prevMatch(t,i,i);if(!s)return!1;let r=x.single(s.from,s.to),o=n.state.facet(Pi);return n.dispatch({selection:r,effects:[wl(n,s),o.scrollToMatch(r.main,n)],userEvent:"select.search"}),fu(n),!0}),My=xn((n,{query:e})=>{let t=e.matchAll(n.state,1e3);return!t||!t.length?!1:(n.dispatch({selection:x.create(t.map(i=>x.range(i.from,i.to))),userEvent:"select.search.matches"}),!0)}),Ty=({state:n,dispatch:e})=>{let t=n.selection;if(t.ranges.length>1||t.main.empty)return!1;let{from:i,to:s}=t.main,r=[],o=0;for(let l=new Oi(n.doc,n.sliceDoc(i,s));!l.next().done;){if(r.length>1e3)return!1;l.value.from==i&&(o=r.length),r.push(x.range(l.value.from,l.value.to))}return e(n.update({selection:x.create(r,o),userEvent:"select.search.matches"})),!0},bh=xn((n,{query:e})=>{let{state:t}=n,{from:i,to:s}=t.selection.main;if(t.readOnly)return!1;let r=e.nextMatch(t,i,i);if(!r)return!1;let o=r,l=[],a,h,c=[];o.from==i&&o.to==s&&(h=t.toText(e.getReplacement(o)),l.push({from:o.from,to:o.to,insert:h}),o=e.nextMatch(t,o.from,o.to),c.push(T.announce.of(t.phrase("replaced match on line $",t.doc.lineAt(i).number)+".")));let f=n.state.changes(l);return o&&(a=x.single(o.from,o.to).map(f),c.push(wl(n,o)),c.push(t.facet(Pi).scrollToMatch(a.main,n))),n.dispatch({changes:f,selection:a,effects:c,userEvent:"input.replace"}),!0}),Oy=xn((n,{query:e})=>{if(n.state.readOnly)return!1;let t=e.matchAll(n.state,1e9).map(s=>{let{from:r,to:o}=s;return{from:r,to:o,insert:e.getReplacement(s)}});if(!t.length)return!1;let i=n.state.phrase("replaced $ matches",t.length)+".";return n.dispatch({changes:t,effects:T.announce.of(i),userEvent:"input.replace.all"}),!0});function kl(n){return n.state.facet(Pi).createPanel(n)}function Ho(n,e){var t,i,s,r,o;let l=n.selection.main,a=l.empty||l.to>l.from+100?"":n.sliceDoc(l.from,l.to);if(e&&!a)return e;let h=n.facet(Pi);return new au({search:((t=e?.literal)!==null&&t!==void 0?t:h.literal)?a:a.replace(/\n/g,"\\n"),caseSensitive:(i=e?.caseSensitive)!==null&&i!==void 0?i:h.caseSensitive,literal:(s=e?.literal)!==null&&s!==void 0?s:h.literal,regexp:(r=e?.regexp)!==null&&r!==void 0?r:h.regexp,wholeWord:(o=e?.wholeWord)!==null&&o!==void 0?o:h.wholeWord})}function cu(n){let e=sl(n,kl);return e&&e.dom.querySelector("[main-field]")}function fu(n){let e=cu(n);e&&e==n.root.activeElement&&e.select()}const uu=n=>{let e=n.state.field(Mt,!1);if(e&&e.panel){let t=cu(n);if(t&&t!=n.root.activeElement){let i=Ho(n.state,e.query.spec);i.valid&&n.dispatch({effects:hn.of(i)}),t.focus(),t.select()}}else n.dispatch({effects:[xl.of(!0),e?hn.of(Ho(n.state,e.query.spec)):L.appendConfig.of(Py)]});return!0},du=n=>{let e=n.state.field(Mt,!1);if(!e||!e.panel)return!1;let t=sl(n,kl);return t&&t.dom.contains(n.root.activeElement)&&n.focus(),n.dispatch({effects:xl.of(!1)}),!0},Dy=[{key:"Mod-f",run:uu,scope:"editor search-panel"},{key:"F3",run:Es,shift:Is,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:Es,shift:Is,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:du,scope:"editor search-panel"},{key:"Mod-Shift-l",run:Ty},{key:"Mod-Alt-g",run:ry},{key:"Mod-d",run:my,preventDefault:!0}];class Ry{constructor(e){this.view=e;let t=this.query=e.state.field(Mt).query.spec;this.commit=this.commit.bind(this),this.searchField=$("input",{value:t.search,placeholder:Ae(e,"Find"),"aria-label":Ae(e,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=$("input",{value:t.replace,placeholder:Ae(e,"Replace"),"aria-label":Ae(e,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=$("input",{type:"checkbox",name:"case",form:"",checked:t.caseSensitive,onchange:this.commit}),this.reField=$("input",{type:"checkbox",name:"re",form:"",checked:t.regexp,onchange:this.commit}),this.wordField=$("input",{type:"checkbox",name:"word",form:"",checked:t.wholeWord,onchange:this.commit});function i(s,r,o){return $("button",{class:"cm-button",name:s,onclick:r,type:"button"},o)}this.dom=$("div",{onkeydown:s=>this.keydown(s),class:"cm-search"},[this.searchField,i("next",()=>Es(e),[Ae(e,"next")]),i("prev",()=>Is(e),[Ae(e,"previous")]),i("select",()=>My(e),[Ae(e,"all")]),$("label",null,[this.caseField,Ae(e,"match case")]),$("label",null,[this.reField,Ae(e,"regexp")]),$("label",null,[this.wordField,Ae(e,"by word")]),...e.state.readOnly?[]:[$("br"),this.replaceField,i("replace",()=>bh(e),[Ae(e,"replace")]),i("replaceAll",()=>Oy(e),[Ae(e,"replace all")])],$("button",{name:"close",onclick:()=>du(e),"aria-label":Ae(e,"close"),type:"button"},["×"])])}commit(){let e=new au({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});e.eq(this.query)||(this.query=e,this.view.dispatch({effects:hn.of(e)}))}keydown(e){Ep(this.view,e,"search-panel")?e.preventDefault():e.keyCode==13&&e.target==this.searchField?(e.preventDefault(),(e.shiftKey?Is:Es)(this.view)):e.keyCode==13&&e.target==this.replaceField&&(e.preventDefault(),bh(this.view))}update(e){for(let t of e.transactions)for(let i of t.effects)i.is(hn)&&!i.value.eq(this.query)&&this.setQuery(i.value)}setQuery(e){this.query=e,this.searchField.value=e.search,this.replaceField.value=e.replace,this.caseField.checked=e.caseSensitive,this.reField.checked=e.regexp,this.wordField.checked=e.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Pi).top}}function Ae(n,e){return n.state.phrase(e)}const _n=30,Xn=/[\s\.,:;?!]/;function wl(n,{from:e,to:t}){let i=n.state.doc.lineAt(e),s=n.state.doc.lineAt(t).to,r=Math.max(i.from,e-_n),o=Math.min(s,t+_n),l=n.state.sliceDoc(r,o);if(r!=i.from){for(let a=0;a<_n;a++)if(!Xn.test(l[a+1])&&Xn.test(l[a])){l=l.slice(a);break}}if(o!=s){for(let a=l.length-1;a>l.length-_n;a--)if(!Xn.test(l[a-1])&&Xn.test(l[a])){l=l.slice(0,a);break}}return T.announce.of(`${n.state.phrase("current match")}. ${l} ${n.state.phrase("on line")} ${i.number}.`)}const By=T.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Py=[Mt,ni.low(Ay),By];class pu{constructor(e,t,i,s){this.state=e,this.pos=t,this.explicit=i,this.view=s,this.abortListeners=[],this.abortOnDocChange=!1}tokenBefore(e){let t=he(this.state).resolveInner(this.pos,-1);for(;t&&e.indexOf(t.name)<0;)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos),i=Math.max(t.from,this.pos-250),s=t.text.slice(i-t.from,this.pos-t.from),r=s.search(gu(e,!1));return r<0?null:{from:i+r,to:this.pos,text:s.slice(r)}}get aborted(){return this.abortListeners==null}addEventListener(e,t,i){e=="abort"&&this.abortListeners&&(this.abortListeners.push(t),i&&i.onDocChange&&(this.abortOnDocChange=!0))}}function yh(n){let e=Object.keys(n).join(""),t=/\w/.test(e);return t&&(e=e.replace(/\w/g,"")),`[${t?"\\w":""}${e.replace(/[^\w\s]/g,"\\$&")}]`}function Ly(n){let e=Object.create(null),t=Object.create(null);for(let{label:s}of n){e[s[0]]=!0;for(let r=1;r<s.length;r++)t[s[r]]=!0}let i=yh(e)+yh(t)+"*$";return[new RegExp("^"+i),new RegExp(i)]}function Ey(n){let e=n.map(s=>typeof s=="string"?{label:s}:s),[t,i]=e.every(s=>/^\w+$/.test(s.label))?[/\w*$/,/\w+$/]:Ly(e);return s=>{let r=s.matchBefore(i);return r||s.explicit?{from:r?r.from:s.pos,options:e,validFor:t}:null}}class xh{constructor(e,t,i,s){this.completion=e,this.source=t,this.match=i,this.score=s}}function Jt(n){return n.selection.main.from}function gu(n,e){var t;let{source:i}=n,s=e&&i[0]!="^",r=i[i.length-1]!="$";return!s&&!r?n:new RegExp(`${s?"^":""}(?:${i})${r?"$":""}`,(t=n.flags)!==null&&t!==void 0?t:n.ignoreCase?"i":"")}const mu=bt.define();function Iy(n,e,t,i){let{main:s}=n.selection,r=t-s.from,o=i-s.from;return{...n.changeByRange(l=>{if(l!=s&&t!=i&&n.sliceDoc(l.from+r,l.from+o)!=n.sliceDoc(t,i))return{range:l};let a=n.toText(e);return{changes:{from:l.from+r,to:i==s.from?l.to:l.from+o,insert:a},range:x.cursor(l.from+r+a.length)}}),scrollIntoView:!0,userEvent:"input.complete"}}const kh=new WeakMap;function Ny(n){if(!Array.isArray(n))return n;let e=kh.get(n);return e||kh.set(n,e=Ey(n)),e}const Ns=L.define(),cn=L.define();class Wy{constructor(e){this.pattern=e,this.chars=[],this.folded=[],this.any=[],this.precise=[],this.byWord=[],this.score=0,this.matched=[];for(let t=0;t<e.length;){let i=be(e,t),s=tt(i);this.chars.push(i);let r=e.slice(t,t+s),o=r.toUpperCase();this.folded.push(be(o==r?r.toLowerCase():o,0)),t+=s}this.astral=e.length!=this.chars.length}ret(e,t){return this.score=e,this.matched=t,this}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return null;let{chars:t,folded:i,any:s,precise:r,byWord:o}=this;if(t.length==1){let w=be(e,0),k=tt(w),D=k==e.length?0:-100;if(w!=t[0])if(w==i[0])D+=-200;else return null;return this.ret(D,[0,k])}let l=e.indexOf(this.pattern);if(l==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let a=t.length,h=0;if(l<0){for(let w=0,k=Math.min(e.length,200);w<k&&h<a;){let D=be(e,w);(D==t[h]||D==i[h])&&(s[h++]=w),w+=tt(D)}if(h<a)return null}let c=0,f=0,u=!1,d=0,p=-1,m=-1,b=/[a-z]/.test(e),y=!0;for(let w=0,k=Math.min(e.length,200),D=0;w<k&&f<a;){let v=be(e,w);l<0&&(c<a&&v==t[c]&&(r[c++]=w),d<a&&(v==t[d]||v==i[d]?(d==0&&(p=w),m=w+1,d++):d=0));let S,C=v<255?v>=48&&v<=57||v>=97&&v<=122?2:v>=65&&v<=90?1:0:(S=Vo(v))!=S.toLowerCase()?1:S!=S.toUpperCase()?2:0;(!w||C==1&&b||D==0&&C!=0)&&(t[f]==v||i[f]==v&&(u=!0)?o[f++]=w:o.length&&(y=!1)),D=C,w+=tt(v)}return f==a&&o[0]==0&&y?this.result(-100+(u?-200:0),o,e):d==a&&p==0?this.ret(-200-e.length+(m==e.length?0:-100),[0,m]):l>-1?this.ret(-700-e.length,[l,l+this.pattern.length]):d==a?this.ret(-900-e.length,[p,m]):f==a?this.result(-100+(u?-200:0)+-700+(y?0:-1100),o,e):t.length==2?null:this.result((s[0]?-700:0)+-200+-1100,s,e)}result(e,t,i){let s=[],r=0;for(let o of t){let l=o+(this.astral?tt(be(i,o)):1);r&&s[r-1]==o?s[r-1]=l:(s[r++]=o,s[r++]=l)}return this.ret(e-i.length,s)}}class Fy{constructor(e){this.pattern=e,this.matched=[],this.score=0,this.folded=e.toLowerCase()}match(e){if(e.length<this.pattern.length)return null;let t=e.slice(0,this.pattern.length),i=t==this.pattern?0:t.toLowerCase()==this.folded?-200:null;return i==null?null:(this.matched=[0,t.length],this.score=i+(e.length==this.pattern.length?0:-100),this)}}const ie=O.define({combine(n){return at(n,{activateOnTyping:!0,activateOnCompletion:()=>!1,activateOnTypingDelay:100,selectOnOpen:!0,override:null,closeOnBlur:!0,maxRenderedOptions:100,defaultKeymap:!0,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:!1,icons:!0,addToOptions:[],positionInfo:Hy,filterStrict:!1,compareCompletions:(e,t)=>(e.sortText||e.label).localeCompare(t.sortText||t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>i=>wh(e(i),t(i)),optionClass:(e,t)=>i=>wh(e(i),t(i)),addToOptions:(e,t)=>e.concat(t),filterStrict:(e,t)=>e||t})}});function wh(n,e){return n?e?n+" "+e:n:e}function Hy(n,e,t,i,s,r){let o=n.textDirection==j.RTL,l=o,a=!1,h="top",c,f,u=e.left-s.left,d=s.right-e.right,p=i.right-i.left,m=i.bottom-i.top;if(l&&u<Math.min(p,d)?l=!1:!l&&d<Math.min(p,u)&&(l=!0),p<=(l?u:d))c=Math.max(s.top,Math.min(t.top,s.bottom-m))-e.top,f=Math.min(400,l?u:d);else{a=!0,f=Math.min(400,(o?e.right:s.right-e.left)-30);let w=s.bottom-e.bottom;w>=m||w>e.top?c=t.bottom-e.top:(h="bottom",c=e.bottom-t.top)}let b=(e.bottom-e.top)/r.offsetHeight,y=(e.right-e.left)/r.offsetWidth;return{style:`${h}: ${c/b}px; max-width: ${f/y}px`,class:"cm-completionInfo-"+(a?o?"left-narrow":"right-narrow":l?"left":"right")}}const vl=L.define();function Vy(n){let e=n.addToOptions.slice();return n.icons&&e.push({render(t){let i=document.createElement("div");return i.classList.add("cm-completionIcon"),t.type&&i.classList.add(...t.type.split(/\s+/g).map(s=>"cm-completionIcon-"+s)),i.setAttribute("aria-hidden","true"),i},position:20}),e.push({render(t,i,s,r){let o=document.createElement("span");o.className="cm-completionLabel";let l=t.displayLabel||t.label,a=0;for(let h=0;h<r.length;){let c=r[h++],f=r[h++];c>a&&o.appendChild(document.createTextNode(l.slice(a,c)));let u=o.appendChild(document.createElement("span"));u.appendChild(document.createTextNode(l.slice(c,f))),u.className="cm-completionMatchedText",a=f}return a<l.length&&o.appendChild(document.createTextNode(l.slice(a))),o},position:50},{render(t){if(!t.detail)return null;let i=document.createElement("span");return i.className="cm-completionDetail",i.textContent=t.detail,i},position:80}),e.sort((t,i)=>t.position-i.position).map(t=>t.render)}function Kr(n,e,t){if(n<=t)return{from:0,to:n};if(e<0&&(e=0),e<=n>>1){let s=Math.floor(e/t);return{from:s*t,to:(s+1)*t}}let i=Math.floor((n-e)/t);return{from:n-(i+1)*t,to:n-i*t}}class zy{constructor(e,t,i){this.view=e,this.stateField=t,this.applyCompletion=i,this.info=null,this.infoDestroy=null,this.placeInfoReq={read:()=>this.measureInfo(),write:a=>this.placeInfo(a),key:this},this.space=null,this.currentClass="";let s=e.state.field(t),{options:r,selected:o}=s.open,l=e.state.facet(ie);this.optionContent=Vy(l),this.optionClass=l.optionClass,this.tooltipClass=l.tooltipClass,this.range=Kr(r.length,o,l.maxRenderedOptions),this.dom=document.createElement("div"),this.dom.className="cm-tooltip-autocomplete",this.updateTooltipClass(e.state),this.dom.addEventListener("mousedown",a=>{let{options:h}=e.state.field(t).open;for(let c=a.target,f;c&&c!=this.dom;c=c.parentNode)if(c.nodeName=="LI"&&(f=/-(\d+)$/.exec(c.id))&&+f[1]<h.length){this.applyCompletion(e,h[+f[1]]),a.preventDefault();return}if(a.target==this.list){let c=this.list.classList.contains("cm-completionListIncompleteTop")&&a.clientY<this.list.firstChild.getBoundingClientRect().top?this.range.from-1:this.list.classList.contains("cm-completionListIncompleteBottom")&&a.clientY>this.list.lastChild.getBoundingClientRect().bottom?this.range.to:null;c!=null&&(e.dispatch({effects:vl.of(c)}),a.preventDefault())}}),this.dom.addEventListener("focusout",a=>{let h=e.state.field(this.stateField,!1);h&&h.tooltip&&e.state.facet(ie).closeOnBlur&&a.relatedTarget!=e.contentDOM&&e.dispatch({effects:cn.of(null)})}),this.showOptions(r,s.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove(),this.list=this.dom.appendChild(this.createListBox(e,t,this.range)),this.list.addEventListener("scroll",()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)})}update(e){var t;let i=e.state.field(this.stateField),s=e.startState.field(this.stateField);if(this.updateTooltipClass(e.state),i!=s){let{options:r,selected:o,disabled:l}=i.open;(!s.open||s.open.options!=r)&&(this.range=Kr(r.length,o,e.state.facet(ie).maxRenderedOptions),this.showOptions(r,i.id)),this.updateSel(),l!=((t=s.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let i of this.currentClass.split(" "))i&&this.dom.classList.remove(i);for(let i of t.split(" "))i&&this.dom.classList.add(i);this.currentClass=t}}positioned(e){this.space=e,this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to)&&(this.range=Kr(t.options.length,t.selected,this.view.state.facet(ie).maxRenderedOptions),this.showOptions(t.options,e.id));let i=this.updateSelectedOption(t.selected);if(i){this.destroyInfo();let{completion:s}=t.options[t.selected],{info:r}=s;if(!r)return;let o=typeof r=="string"?document.createTextNode(r):r(s);if(!o)return;"then"in o?o.then(l=>{l&&this.view.state.field(this.stateField,!1)==e&&this.addInfoPane(l,s)}).catch(l=>ge(this.view.state,l,"completion info")):(this.addInfoPane(o,s),i.setAttribute("aria-describedby",this.info.id))}}addInfoPane(e,t){this.destroyInfo();let i=this.info=document.createElement("div");if(i.className="cm-tooltip cm-completionInfo",i.id="cm-completionInfo-"+Math.floor(Math.random()*65535).toString(16),e.nodeType!=null)i.appendChild(e),this.infoDestroy=null;else{let{dom:s,destroy:r}=e;i.appendChild(s),this.infoDestroy=r||null}this.dom.appendChild(i),this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let i=this.list.firstChild,s=this.range.from;i;i=i.nextSibling,s++)i.nodeName!="LI"||!i.id?s--:s==e?i.hasAttribute("aria-selected")||(i.setAttribute("aria-selected","true"),t=i):i.hasAttribute("aria-selected")&&(i.removeAttribute("aria-selected"),i.removeAttribute("aria-describedby"));return t&&qy(this.list,t),t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect(),i=this.info.getBoundingClientRect(),s=e.getBoundingClientRect(),r=this.space;if(!r){let o=this.dom.ownerDocument.documentElement;r={left:0,top:0,right:o.clientWidth,bottom:o.clientHeight}}return s.top>Math.min(r.bottom,t.bottom)-10||s.bottom<Math.max(r.top,t.top)+10?null:this.view.state.facet(ie).positionInfo(this.view,t,s,i,r,this.dom)}placeInfo(e){this.info&&(e?(e.style&&(this.info.style.cssText=e.style),this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")):this.info.style.cssText="top: -1e6px")}createListBox(e,t,i){const s=document.createElement("ul");s.id=t,s.setAttribute("role","listbox"),s.setAttribute("aria-expanded","true"),s.setAttribute("aria-label",this.view.state.phrase("Completions")),s.addEventListener("mousedown",o=>{o.target==s&&o.preventDefault()});let r=null;for(let o=i.from;o<i.to;o++){let{completion:l,match:a}=e[o],{section:h}=l;if(h){let u=typeof h=="string"?h:h.name;if(u!=r&&(o>i.from||i.from==0))if(r=u,typeof h!="string"&&h.header)s.appendChild(h.header(h));else{let d=s.appendChild(document.createElement("completion-section"));d.textContent=u}}const c=s.appendChild(document.createElement("li"));c.id=t+"-"+o,c.setAttribute("role","option");let f=this.optionClass(l);f&&(c.className=f);for(let u of this.optionContent){let d=u(l,this.view.state,this.view,a);d&&c.appendChild(d)}}return i.from&&s.classList.add("cm-completionListIncompleteTop"),i.to<e.length&&s.classList.add("cm-completionListIncompleteBottom"),s}destroyInfo(){this.info&&(this.infoDestroy&&this.infoDestroy(),this.info.remove(),this.info=null)}destroy(){this.destroyInfo()}}function $y(n,e){return t=>new zy(t,n,e)}function qy(n,e){let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),s=t.height/n.offsetHeight;i.top<t.top?n.scrollTop-=(t.top-i.top)/s:i.bottom>t.bottom&&(n.scrollTop+=(i.bottom-t.bottom)/s)}function vh(n){return(n.boost||0)*100+(n.apply?10:0)+(n.info?5:0)+(n.type?1:0)}function Ky(n,e){let t=[],i=null,s=null,r=c=>{t.push(c);let{section:f}=c.completion;if(f){i||(i=[]);let u=typeof f=="string"?f:f.name;i.some(d=>d.name==u)||i.push(typeof f=="string"?{name:u}:f)}},o=e.facet(ie);for(let c of n)if(c.hasResult()){let f=c.result.getMatch;if(c.result.filter===!1)for(let u of c.result.options)r(new xh(u,c.source,f?f(u):[],1e9-t.length));else{let u=e.sliceDoc(c.from,c.to),d,p=o.filterStrict?new Fy(u):new Wy(u);for(let m of c.result.options)if(d=p.match(m.label)){let b=m.displayLabel?f?f(m,d.matched):[]:d.matched,y=d.score+(m.boost||0);if(r(new xh(m,c.source,b,y)),typeof m.section=="object"&&m.section.rank==="dynamic"){let{name:w}=m.section;s||(s=Object.create(null)),s[w]=Math.max(y,s[w]||-1e9)}}}}if(i){let c=Object.create(null),f=0,u=(d,p)=>(d.rank==="dynamic"&&p.rank==="dynamic"?s[p.name]-s[d.name]:0)||(typeof d.rank=="number"?d.rank:1e9)-(typeof p.rank=="number"?p.rank:1e9)||(d.name<p.name?-1:1);for(let d of i.sort(u))f-=1e5,c[d.name]=f;for(let d of t){let{section:p}=d.completion;p&&(d.score+=c[typeof p=="string"?p:p.name])}}let l=[],a=null,h=o.compareCompletions;for(let c of t.sort((f,u)=>u.score-f.score||h(f.completion,u.completion))){let f=c.completion;!a||a.label!=f.label||a.detail!=f.detail||a.type!=null&&f.type!=null&&a.type!=f.type||a.apply!=f.apply||a.boost!=f.boost?l.push(c):vh(c.completion)>vh(a)&&(l[l.length-1]=c),a=c.completion}return l}class gi{constructor(e,t,i,s,r,o){this.options=e,this.attrs=t,this.tooltip=i,this.timestamp=s,this.selected=r,this.disabled=o}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new gi(this.options,Sh(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,i,s,r,o){if(s&&!o&&e.some(h=>h.isPending))return s.setDisabled();let l=Ky(e,t);if(!l.length)return s&&e.some(h=>h.isPending)?s.setDisabled():null;let a=t.facet(ie).selectOnOpen?0:-1;if(s&&s.selected!=a&&s.selected!=-1){let h=s.options[s.selected].completion;for(let c=0;c<l.length;c++)if(l[c].completion==h){a=c;break}}return new gi(l,Sh(i,a),{pos:e.reduce((h,c)=>c.hasResult()?Math.min(h,c.from):h,1e8),create:_y,above:r.aboveCursor},s?s.timestamp:Date.now(),a,!1)}map(e){return new gi(this.options,this.attrs,{...this.tooltip,pos:e.mapPos(this.tooltip.pos)},this.timestamp,this.selected,this.disabled)}setDisabled(){return new gi(this.options,this.attrs,this.tooltip,this.timestamp,this.selected,!0)}}class Ws{constructor(e,t,i){this.active=e,this.id=t,this.open=i}static start(){return new Ws(Qy,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,i=t.facet(ie),r=(i.override||t.languageDataAt("autocomplete",Jt(t)).map(Ny)).map(a=>(this.active.find(c=>c.source==a)||new Ie(a,this.active.some(c=>c.state!=0)?1:0)).update(e,i));r.length==this.active.length&&r.every((a,h)=>a==this.active[h])&&(r=this.active);let o=this.open,l=e.effects.some(a=>a.is(Sl));o&&e.docChanged&&(o=o.map(e.changes)),e.selection||r.some(a=>a.hasResult()&&e.changes.touchesRange(a.from,a.to))||!jy(r,this.active)||l?o=gi.build(r,t,this.id,o,i,l):o&&o.disabled&&!r.some(a=>a.isPending)&&(o=null),!o&&r.every(a=>!a.isPending)&&r.some(a=>a.hasResult())&&(r=r.map(a=>a.hasResult()?new Ie(a.source,0):a));for(let a of e.effects)a.is(vl)&&(o=o&&o.setSelected(a.value,this.id));return r==this.active&&o==this.open?this:new Ws(r,this.id,o)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:this.active.length?Uy:Gy}}function jy(n,e){if(n==e)return!0;for(let t=0,i=0;;){for(;t<n.length&&!n[t].hasResult();)t++;for(;i<e.length&&!e[i].hasResult();)i++;let s=t==n.length,r=i==e.length;if(s||r)return s==r;if(n[t++].result!=e[i++].result)return!1}}const Uy={"aria-autocomplete":"list"},Gy={};function Sh(n,e){let t={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":n};return e>-1&&(t["aria-activedescendant"]=n+"-"+e),t}const Qy=[];function bu(n,e){if(n.isUserEvent("input.complete")){let i=n.annotation(mu);if(i&&e.activateOnCompletion(i))return 12}let t=n.isUserEvent("input.type");return t&&e.activateOnTyping?5:t?1:n.isUserEvent("delete.backward")?2:n.selection?8:n.docChanged?16:0}class Ie{constructor(e,t,i=!1){this.source=e,this.state=t,this.explicit=i}hasResult(){return!1}get isPending(){return this.state==1}update(e,t){let i=bu(e,t),s=this;(i&8||i&16&&this.touches(e))&&(s=new Ie(s.source,0)),i&4&&s.state==0&&(s=new Ie(this.source,1)),s=s.updateFor(e,i);for(let r of e.effects)if(r.is(Ns))s=new Ie(s.source,1,r.value);else if(r.is(cn))s=new Ie(s.source,0);else if(r.is(Sl))for(let o of r.value)o.source==s.source&&(s=o);return s}updateFor(e,t){return this.map(e.changes)}map(e){return this}touches(e){return e.changes.touchesRange(Jt(e.state))}}class vi extends Ie{constructor(e,t,i,s,r,o){super(e,3,t),this.limit=i,this.result=s,this.from=r,this.to=o}hasResult(){return!0}updateFor(e,t){var i;if(!(t&3))return this.map(e.changes);let s=this.result;s.map&&!e.changes.empty&&(s=s.map(s,e.changes));let r=e.changes.mapPos(this.from),o=e.changes.mapPos(this.to,1),l=Jt(e.state);if(l>o||!s||t&2&&(Jt(e.startState)==this.from||l<this.limit))return new Ie(this.source,t&4?1:0);let a=e.changes.mapPos(this.limit);return Yy(s.validFor,e.state,r,o)?new vi(this.source,this.explicit,a,s,r,o):s.update&&(s=s.update(s,r,o,new pu(e.state,l,!1)))?new vi(this.source,this.explicit,a,s,s.from,(i=s.to)!==null&&i!==void 0?i:Jt(e.state)):new Ie(this.source,1,this.explicit)}map(e){return e.empty?this:(this.result.map?this.result.map(this.result,e):this.result)?new vi(this.source,this.explicit,e.mapPos(this.limit),this.result,e.mapPos(this.from),e.mapPos(this.to,1)):new Ie(this.source,0)}touches(e){return e.changes.touchesRange(this.from,this.to)}}function Yy(n,e,t,i){if(!n)return!1;let s=e.sliceDoc(t,i);return typeof n=="function"?n(s,t,i,e):gu(n,!0).test(s)}const Sl=L.define({map(n,e){return n.map(t=>t.map(e))}}),ye=ce.define({create(){return Ws.start()},update(n,e){return n.update(e)},provide:n=>[nl.from(n,e=>e.tooltip),T.contentAttributes.from(n,e=>e.attrs)]});function Cl(n,e){const t=e.completion.apply||e.completion.label;let i=n.state.field(ye).active.find(s=>s.source==e.source);return i instanceof vi?(typeof t=="string"?n.dispatch({...Iy(n.state,t,i.from,i.to),annotations:mu.of(e.completion)}):t(n,e.completion,i.from,i.to),!0):!1}const _y=$y(ye,Cl);function Jn(n,e="option"){return t=>{let i=t.state.field(ye,!1);if(!i||!i.open||i.open.disabled||Date.now()-i.open.timestamp<t.state.facet(ie).interactionDelay)return!1;let s=1,r;e=="page"&&(r=Kc(t,i.open.tooltip))&&(s=Math.max(2,Math.floor(r.dom.offsetHeight/r.dom.querySelector("li").offsetHeight)-1));let{length:o}=i.open.options,l=i.open.selected>-1?i.open.selected+s*(n?1:-1):n?0:o-1;return l<0?l=e=="page"?0:o-1:l>=o&&(l=e=="page"?o-1:0),t.dispatch({effects:vl.of(l)}),!0}}const Xy=n=>{let e=n.state.field(ye,!1);return n.state.readOnly||!e||!e.open||e.open.selected<0||e.open.disabled||Date.now()-e.open.timestamp<n.state.facet(ie).interactionDelay?!1:Cl(n,e.open.options[e.open.selected])},jr=n=>n.state.field(ye,!1)?(n.dispatch({effects:Ns.of(!0)}),!0):!1,Jy=n=>{let e=n.state.field(ye,!1);return!e||!e.active.some(t=>t.state!=0)?!1:(n.dispatch({effects:cn.of(null)}),!0)};class Zy{constructor(e,t){this.active=e,this.context=t,this.time=Date.now(),this.updates=[],this.done=void 0}}const e1=50,t1=1e3,i1=X.fromClass(class{constructor(n){this.view=n,this.debounceUpdate=-1,this.running=[],this.debounceAccept=-1,this.pendingStart=!1,this.composing=0;for(let e of n.state.field(ye).active)e.isPending&&this.startQuery(e)}update(n){let e=n.state.field(ye),t=n.state.facet(ie);if(!n.selectionSet&&!n.docChanged&&n.startState.field(ye)==e)return;let i=n.transactions.some(r=>{let o=bu(r,t);return o&8||(r.selection||r.docChanged)&&!(o&3)});for(let r=0;r<this.running.length;r++){let o=this.running[r];if(i||o.context.abortOnDocChange&&n.docChanged||o.updates.length+n.transactions.length>e1&&Date.now()-o.time>t1){for(let l of o.context.abortListeners)try{l()}catch(a){ge(this.view.state,a)}o.context.abortListeners=null,this.running.splice(r--,1)}else o.updates.push(...n.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate),n.transactions.some(r=>r.effects.some(o=>o.is(Ns)))&&(this.pendingStart=!0);let s=this.pendingStart?50:t.activateOnTypingDelay;if(this.debounceUpdate=e.active.some(r=>r.isPending&&!this.running.some(o=>o.active.source==r.source))?setTimeout(()=>this.startUpdate(),s):-1,this.composing!=0)for(let r of n.transactions)r.isUserEvent("input.type")?this.composing=2:this.composing==2&&r.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1,this.pendingStart=!1;let{state:n}=this.view,e=n.field(ye);for(let t of e.active)t.isPending&&!this.running.some(i=>i.active.source==t.source)&&this.startQuery(t);this.running.length&&e.open&&e.open.disabled&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ie).updateSyncTime))}startQuery(n){let{state:e}=this.view,t=Jt(e),i=new pu(e,t,n.explicit,this.view),s=new Zy(n,i);this.running.push(s),Promise.resolve(n.source(i)).then(r=>{s.context.aborted||(s.done=r||null,this.scheduleAccept())},r=>{this.view.dispatch({effects:cn.of(null)}),ge(this.view.state,r)})}scheduleAccept(){this.running.every(n=>n.done!==void 0)?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout(()=>this.accept(),this.view.state.facet(ie).updateSyncTime))}accept(){var n;this.debounceAccept>-1&&clearTimeout(this.debounceAccept),this.debounceAccept=-1;let e=[],t=this.view.state.facet(ie),i=this.view.state.field(ye);for(let s=0;s<this.running.length;s++){let r=this.running[s];if(r.done===void 0)continue;if(this.running.splice(s--,1),r.done){let l=Jt(r.updates.length?r.updates[0].startState:this.view.state),a=Math.min(l,r.done.from+(r.active.explicit?0:1)),h=new vi(r.active.source,r.active.explicit,a,r.done,r.done.from,(n=r.done.to)!==null&&n!==void 0?n:l);for(let c of r.updates)h=h.update(c,t);if(h.hasResult()){e.push(h);continue}}let o=i.active.find(l=>l.source==r.active.source);if(o&&o.isPending)if(r.done==null){let l=new Ie(r.active.source,0);for(let a of r.updates)l=l.update(a,t);l.isPending||e.push(l)}else this.startQuery(o)}(e.length||i.open&&i.open.disabled)&&this.view.dispatch({effects:Sl.of(e)})}},{eventHandlers:{blur(n){let e=this.view.state.field(ye,!1);if(e&&e.tooltip&&this.view.state.facet(ie).closeOnBlur){let t=e.open&&Kc(this.view,e.open.tooltip);(!t||!t.dom.contains(n.relatedTarget))&&setTimeout(()=>this.view.dispatch({effects:cn.of(null)}),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout(()=>this.view.dispatch({effects:Ns.of(!1)}),20),this.composing=0}}}),n1=typeof navigator=="object"&&/Win/.test(navigator.platform),s1=ni.highest(T.domEventHandlers({keydown(n,e){let t=e.state.field(ye,!1);if(!t||!t.open||t.open.disabled||t.open.selected<0||n.key.length>1||n.ctrlKey&&!(n1&&n.altKey)||n.metaKey)return!1;let i=t.open.options[t.open.selected],s=t.active.find(o=>o.source==i.source),r=i.completion.commitCharacters||s.result.commitCharacters;return r&&r.indexOf(n.key)>-1&&Cl(e,i),!1}})),r1=T.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box",whiteSpace:"pre-line"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}}),fn={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},_t=L.define({map(n,e){let t=e.mapPos(n,-1,pe.TrackAfter);return t??void 0}}),Al=new class extends Tt{};Al.startSide=1;Al.endSide=-1;const yu=ce.define({create(){return N.empty},update(n,e){if(n=n.map(e.changes),e.selection){let t=e.state.doc.lineAt(e.selection.main.head);n=n.update({filter:i=>i>=t.from&&i<=t.to})}for(let t of e.effects)t.is(_t)&&(n=n.update({add:[Al.range(t.value,t.value+1)]}));return n}});function o1(){return[a1,yu]}const Ur="()[]{}<>«»»«[]{}";function xu(n){for(let e=0;e<Ur.length;e+=2)if(Ur.charCodeAt(e)==n)return Ur.charAt(e+1);return Vo(n<128?n:n+1)}function ku(n,e){return n.languageDataAt("closeBrackets",e)[0]||fn}const l1=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),a1=T.inputHandler.of((n,e,t,i)=>{if((l1?n.composing:n.compositionStarted)||n.state.readOnly)return!1;let s=n.state.selection.main;if(i.length>2||i.length==2&&tt(be(i,0))==1||e!=s.from||t!=s.to)return!1;let r=f1(n.state,i);return r?(n.dispatch(r),!0):!1}),h1=({state:n,dispatch:e})=>{if(n.readOnly)return!1;let i=ku(n,n.selection.main.head).brackets||fn.brackets,s=null,r=n.changeByRange(o=>{if(o.empty){let l=u1(n.doc,o.head);for(let a of i)if(a==l&&Xs(n.doc,o.head)==xu(be(a,0)))return{changes:{from:o.head-a.length,to:o.head+a.length},range:x.cursor(o.head-a.length)}}return{range:s=o}});return s||e(n.update(r,{scrollIntoView:!0,userEvent:"delete.backward"})),!s},c1=[{key:"Backspace",run:h1}];function f1(n,e){let t=ku(n,n.selection.main.head),i=t.brackets||fn.brackets;for(let s of i){let r=xu(be(s,0));if(e==s)return r==s?g1(n,s,i.indexOf(s+s+s)>-1,t):d1(n,s,r,t.before||fn.before);if(e==r&&wu(n,n.selection.main.from))return p1(n,s,r)}return null}function wu(n,e){let t=!1;return n.field(yu).between(0,n.doc.length,i=>{i==e&&(t=!0)}),t}function Xs(n,e){let t=n.sliceString(e,e+2);return t.slice(0,tt(be(t,0)))}function u1(n,e){let t=n.sliceString(e-2,e);return tt(be(t,0))==t.length?t:t.slice(1)}function d1(n,e,t,i){let s=null,r=n.changeByRange(o=>{if(!o.empty)return{changes:[{insert:e,from:o.from},{insert:t,from:o.to}],effects:_t.of(o.to+e.length),range:x.range(o.anchor+e.length,o.head+e.length)};let l=Xs(n.doc,o.head);return!l||/\s/.test(l)||i.indexOf(l)>-1?{changes:{insert:e+t,from:o.head},effects:_t.of(o.head+e.length),range:x.cursor(o.head+e.length)}:{range:s=o}});return s?null:n.update(r,{scrollIntoView:!0,userEvent:"input.type"})}function p1(n,e,t){let i=null,s=n.changeByRange(r=>r.empty&&Xs(n.doc,r.head)==t?{changes:{from:r.head,to:r.head+t.length,insert:t},range:x.cursor(r.head+t.length)}:i={range:r});return i?null:n.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function g1(n,e,t,i){let s=i.stringPrefixes||fn.stringPrefixes,r=null,o=n.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:_t.of(l.to+e.length),range:x.range(l.anchor+e.length,l.head+e.length)};let a=l.head,h=Xs(n.doc,a),c;if(h==e){if(Ch(n,a))return{changes:{insert:e+e,from:a},effects:_t.of(a+e.length),range:x.cursor(a+e.length)};if(wu(n,a)){let u=t&&n.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+u.length,insert:u},range:x.cursor(a+u.length)}}}else{if(t&&n.sliceDoc(a-2*e.length,a)==e+e&&(c=Ah(n,a-2*e.length,s))>-1&&Ch(n,c))return{changes:{insert:e+e+e+e,from:a},effects:_t.of(a+e.length),range:x.cursor(a+e.length)};if(n.charCategorizer(a)(h)!=Q.Word&&Ah(n,a,s)>-1&&!m1(n,a,e,s))return{changes:{insert:e+e,from:a},effects:_t.of(a+e.length),range:x.cursor(a+e.length)}}return{range:r=l}});return r?null:n.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function Ch(n,e){let t=he(n).resolveInner(e+1);return t.parent&&t.from==e}function m1(n,e,t,i){let s=he(n).resolveInner(e,-1),r=i.reduce((o,l)=>Math.max(o,l.length),0);for(let o=0;o<5;o++){let l=n.sliceDoc(s.from,Math.min(s.to,s.from+t.length+r)),a=l.indexOf(t);if(!a||a>-1&&i.indexOf(l.slice(0,a))>-1){let c=s.firstChild;for(;c&&c.from==s.from&&c.to-c.from>t.length+a;){if(n.sliceDoc(c.to-t.length,c.to)==t)return!1;c=c.firstChild}return!0}let h=s.to==e&&s.parent;if(!h)break;s=h}return!1}function Ah(n,e,t){let i=n.charCategorizer(e);if(i(n.sliceDoc(e-1,e))!=Q.Word)return e;for(let s of t){let r=e-s.length;if(n.sliceDoc(r,e)==s&&i(n.sliceDoc(r-1,r))!=Q.Word)return r}return-1}function b1(n={}){return[s1,ye,ie.of(n),i1,y1,r1]}const vu=[{key:"Ctrl-Space",run:jr},{mac:"Alt-`",run:jr},{mac:"Alt-i",run:jr},{key:"Escape",run:Jy},{key:"ArrowDown",run:Jn(!0)},{key:"ArrowUp",run:Jn(!1)},{key:"PageDown",run:Jn(!0,"page")},{key:"PageUp",run:Jn(!1,"page")},{key:"Enter",run:Xy}],y1=ni.highest(qs.computeN([ie],n=>n.facet(ie).defaultKeymap?[vu]:[])),x1=[Lg(),Ng(),Xp(),Zm(),Mm(),Vp(),jp(),H.allowMultipleSelections.of(!0),um(),ul(Rm,{fallback:!0}),Wm(),o1(),b1(),hg(),ug(),ng(),ay(),qs.of([...c1,...tb,...Dy,...a0,...vm,...vu,...Ab])];var k1=Tu('<div id=editor class="h-full cursor-auto border-[0.5px] border-neutral-300 dark:border-neutral-700">');const C1=n=>{let e,t=new un,i;const s=()=>{i.dispatch({effects:t.reconfigure(window.matchMedia("(prefers-color-scheme: dark)").matches?hh:ph)})};return Su(()=>{const r=T.theme({".cm-content":{fontFamily:"'Roboto Mono', monospace",fontSize:"12px"},".cm-scroller":{overflow:"auto"},"&":{height:"100%"}});window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",s),i=new T({doc:n.content,parent:e,extensions:[x1,r,bb(),qs.of([ib]),Ob(pb()),t.of(document.documentElement.classList.contains("dark")?hh:ph),T.lineWrapping]}),Cu.view=i}),Au(()=>window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",s)),(()=>{var r=k1(),o=e;return typeof o=="function"?Mu(o,r):e=r,r})()};export{C1 as Editor};
+36
assets/index-B_dCXHrJ.js
··· 1 + (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const a of s)if(a.type==="childList")for(const l of a.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(s){const a={};return s.integrity&&(a.integrity=s.integrity),s.referrerPolicy&&(a.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?a.credentials="include":s.crossOrigin==="anonymous"?a.credentials="omit":a.credentials="same-origin",a}function r(s){if(s.ep)return;s.ep=!0;const a=n(s);fetch(s.href,a)}})();const se={context:void 0,registry:void 0,effects:void 0,done:!1,getContextId(){return Xi(this.context.count)},getNextContextId(){return Xi(this.context.count++)}};function Xi(e){const t=String(e),n=t.length-1;return se.context.id+(n?String.fromCharCode(96+n):"")+t}function Yt(e){se.context=e}const Mc=!1,Fh=(e,t)=>e===t,He=Symbol("solid-proxy"),Bc=typeof Proxy=="function",Kr=Symbol("solid-track"),zs={equals:Fh};let Fr=null,Fc=Hc;const ht=1,Hr=2,zc={owned:null,cleanups:null,context:null,owner:null},Ha={};var ue=null;let W=null,zh=null,we=null,Ye=null,Ve=null,fa=0;function Ln(e,t){const n=we,r=ue,s=e.length===0,a=t===void 0?r:t,l=s?zc:{owned:null,cleanups:null,context:a?a.context:null,owner:a},i=s?e:()=>e(()=>Me(()=>pn(l)));ue=l,we=null;try{return ct(i,!0)}finally{we=n,ue=r}}function T(e,t){t=t?Object.assign({},zs,t):zs;const n={value:e,observers:null,observerSlots:null,comparator:t.equals||void 0},r=s=>(typeof s=="function"&&(W&&W.running&&W.sources.has(n)?s=s(n.tValue):s=s(n.value)),Kc(n,s));return[Vc.bind(n),r]}function Ji(e,t,n){const r=as(e,t,!0,ht);Sr(r)}function z(e,t,n){const r=as(e,t,!1,ht);Sr(r)}function Ue(e,t,n){Fc=Zh;const r=as(e,t,!1,ht),s=Dn&&mt(Dn);s&&(r.suspense=s),(!n||!n.render)&&(r.user=!0),Ve?Ve.push(r):Sr(r)}function ce(e,t,n){n=n?Object.assign({},zs,n):zs;const r=as(e,t,!0,0);return r.observers=null,r.observerSlots=null,r.comparator=n.equals||void 0,Sr(r),Vc.bind(r)}function Vh(e){return e&&typeof e=="object"&&"then"in e}function Ht(e,t,n){let r,s,a;typeof t=="function"?(r=e,s=t,a={}):(r=!0,s=e,a=t||{});let l=null,i=Ha,o=null,c=!1,d=!1,h="initialValue"in a,g=typeof r=="function"&&ce(r);const p=new Set,[x,y]=(a.storage||T)(a.initialValue),[b,$]=T(void 0),[w,v]=T(void 0,{equals:!1}),[_,E]=T(h?"ready":"unresolved");se.context&&(o=se.getNextContextId(),a.ssrLoadFrom==="initial"?i=a.initialValue:se.load&&se.has(o)&&(i=se.load(o)));function S(I,M,Y,F){return l===I&&(l=null,F!==void 0&&(h=!0),(I===i||M===i)&&a.onHydrated&&queueMicrotask(()=>a.onHydrated(F,{value:M})),i=Ha,W&&I&&c?(W.promises.delete(I),c=!1,ct(()=>{W.running=!0,C(M,Y)},!1)):C(M,Y)),M}function C(I,M){ct(()=>{M===void 0&&y(()=>I),E(M!==void 0?"errored":h?"ready":"unresolved"),$(M);for(const Y of p.keys())Y.decrement();p.clear()},!1)}function A(){const I=Dn&&mt(Dn),M=x(),Y=b();if(Y!==void 0&&!l)throw Y;return we&&!we.user&&I&&Ji(()=>{w(),l&&(I.resolved&&W&&c?W.promises.add(l):p.has(I)||(I.increment(),p.add(I)))}),M}function D(I=!0){if(I!==!1&&d)return;d=!1;const M=g?g():r;if(c=W&&W.running,M==null||M===!1){S(l,Me(x));return}W&&l&&W.promises.delete(l);let Y;const F=i!==Ha?i:Me(()=>{try{return s(M,{value:x(),refetching:I})}catch(B){Y=B}});if(Y!==void 0){S(l,void 0,Ts(Y),M);return}else if(!Vh(F))return S(l,F,void 0,M),F;return l=F,"v"in F?(F.s===1?S(l,F.v,void 0,M):S(l,void 0,Ts(F.v),M),F):(d=!0,queueMicrotask(()=>d=!1),ct(()=>{E(h?"refreshing":"pending"),v()},!1),F.then(B=>S(F,B,void 0,M),B=>S(F,void 0,Ts(B),M)))}Object.defineProperties(A,{state:{get:()=>_()},error:{get:()=>b()},loading:{get(){const I=_();return I==="pending"||I==="refreshing"}},latest:{get(){if(!h)return A();const I=b();if(I&&!l)throw I;return x()}}});let N=ue;return g?Ji(()=>(N=ue,D(!1))):D(!1),[A,{refetch:I=>ha(N,()=>D(I)),mutate:y}]}function ir(e){return ct(e,!1)}function Me(e){if(we===null)return e();const t=we;we=null;try{return e()}finally{we=t}}function Jl(e,t,n){const r=Array.isArray(e);let s,a=n&&n.defer;return l=>{let i;if(r){i=Array(e.length);for(let c=0;c<e.length;c++)i[c]=e[c]()}else i=e();if(a)return a=!1,l;const o=Me(()=>t(i,s,l));return s=i,o}}function pt(e){Ue(()=>Me(e))}function Ce(e){return ue===null||(ue.cleanups===null?ue.cleanups=[e]:ue.cleanups.push(e)),e}function Kh(e,t){Fr||(Fr=Symbol("error")),ue=as(void 0,void 0,!0),ue.context={...ue.context,[Fr]:[t]},W&&W.running&&W.sources.add(ue);try{return e()}catch(n){ls(n)}finally{ue=ue.owner}}function qr(){return we}function Wr(){return ue}function ha(e,t){const n=ue,r=we;ue=e,we=null;try{return ct(t,!0)}catch(s){ls(s)}finally{ue=n,we=r}}function Hh(e){if(W&&W.running)return e(),W.done;const t=we,n=ue;return Promise.resolve().then(()=>{we=t,ue=n;let r;return Dn&&(r=W||(W={sources:new Set,effects:[],promises:new Set,disposed:new Set,queue:new Set,running:!0}),r.done||(r.done=new Promise(s=>r.resolve=s)),r.running=!0),ct(e,!1),we=ue=null,r?r.done:void 0})}const[m3,Yi]=T(!1);function qh(e){Ve.push.apply(Ve,e),e.length=0}function Bn(e,t){const n=Symbol("context");return{id:n,Provider:Xh(n),defaultValue:e}}function mt(e){let t;return ue&&ue.context&&(t=ue.context[e.id])!==void 0?t:e.defaultValue}function ga(e){const t=ce(e),n=ce(()=>gl(t()));return n.toArray=()=>{const r=n();return Array.isArray(r)?r:r!=null?[r]:[]},n}let Dn;function Wh(){return Dn||(Dn=Bn())}function Vc(){const e=W&&W.running;if(this.sources&&(e?this.tState:this.state))if((e?this.tState:this.state)===ht)Sr(this);else{const t=Ye;Ye=null,ct(()=>Ks(this),!1),Ye=t}if(we){const t=this.observers?this.observers.length:0;we.sources?(we.sources.push(this),we.sourceSlots.push(t)):(we.sources=[this],we.sourceSlots=[t]),this.observers?(this.observers.push(we),this.observerSlots.push(we.sources.length-1)):(this.observers=[we],this.observerSlots=[we.sources.length-1])}return e&&W.sources.has(this)?this.tValue:this.value}function Kc(e,t,n){let r=W&&W.running&&W.sources.has(e)?e.tValue:e.value;if(!e.comparator||!e.comparator(r,t)){if(W){const s=W.running;(s||!n&&W.sources.has(e))&&(W.sources.add(e),e.tValue=t),s||(e.value=t)}else e.value=t;e.observers&&e.observers.length&&ct(()=>{for(let s=0;s<e.observers.length;s+=1){const a=e.observers[s],l=W&&W.running;l&&W.disposed.has(a)||((l?!a.tState:!a.state)&&(a.pure?Ye.push(a):Ve.push(a),a.observers&&qc(a)),l?a.tState=ht:a.state=ht)}if(Ye.length>1e6)throw Ye=[],new Error},!1)}return t}function Sr(e){if(!e.fn)return;pn(e);const t=fa;Qi(e,W&&W.running&&W.sources.has(e)?e.tValue:e.value,t),W&&!W.running&&W.sources.has(e)&&queueMicrotask(()=>{ct(()=>{W&&(W.running=!0),we=ue=e,Qi(e,e.tValue,t),we=ue=null},!1)})}function Qi(e,t,n){let r;const s=ue,a=we;we=ue=e;try{r=e.fn(t)}catch(l){return e.pure&&(W&&W.running?(e.tState=ht,e.tOwned&&e.tOwned.forEach(pn),e.tOwned=void 0):(e.state=ht,e.owned&&e.owned.forEach(pn),e.owned=null)),e.updatedAt=n+1,ls(l)}finally{we=a,ue=s}(!e.updatedAt||e.updatedAt<=n)&&(e.updatedAt!=null&&"observers"in e?Kc(e,r,!0):W&&W.running&&e.pure?(W.sources.add(e),e.tValue=r):e.value=r,e.updatedAt=n)}function as(e,t,n,r=ht,s){const a={fn:e,state:r,updatedAt:null,owned:null,sources:null,sourceSlots:null,cleanups:null,value:t,owner:ue,context:ue?ue.context:null,pure:n};return W&&W.running&&(a.state=0,a.tState=r),ue===null||ue!==zc&&(W&&W.running&&ue.pure?ue.tOwned?ue.tOwned.push(a):ue.tOwned=[a]:ue.owned?ue.owned.push(a):ue.owned=[a]),a}function Vs(e){const t=W&&W.running;if((t?e.tState:e.state)===0)return;if((t?e.tState:e.state)===Hr)return Ks(e);if(e.suspense&&Me(e.suspense.inFallback))return e.suspense.effects.push(e);const n=[e];for(;(e=e.owner)&&(!e.updatedAt||e.updatedAt<fa);){if(t&&W.disposed.has(e))return;(t?e.tState:e.state)&&n.push(e)}for(let r=n.length-1;r>=0;r--){if(e=n[r],t){let s=e,a=n[r+1];for(;(s=s.owner)&&s!==a;)if(W.disposed.has(s))return}if((t?e.tState:e.state)===ht)Sr(e);else if((t?e.tState:e.state)===Hr){const s=Ye;Ye=null,ct(()=>Ks(e,n[0]),!1),Ye=s}}}function ct(e,t){if(Ye)return e();let n=!1;t||(Ye=[]),Ve?n=!0:Ve=[],fa++;try{const r=e();return Gh(n),r}catch(r){n||(Ve=null),Ye=null,ls(r)}}function Gh(e){if(Ye&&(Hc(Ye),Ye=null),e)return;let t;if(W){if(!W.promises.size&&!W.queue.size){const r=W.sources,s=W.disposed;Ve.push.apply(Ve,W.effects),t=W.resolve;for(const a of Ve)"tState"in a&&(a.state=a.tState),delete a.tState;W=null,ct(()=>{for(const a of s)pn(a);for(const a of r){if(a.value=a.tValue,a.owned)for(let l=0,i=a.owned.length;l<i;l++)pn(a.owned[l]);a.tOwned&&(a.owned=a.tOwned),delete a.tValue,delete a.tOwned,a.tState=0}Yi(!1)},!1)}else if(W.running){W.running=!1,W.effects.push.apply(W.effects,Ve),Ve=null,Yi(!0);return}}const n=Ve;Ve=null,n.length&&ct(()=>Fc(n),!1),t&&t()}function Hc(e){for(let t=0;t<e.length;t++)Vs(e[t])}function Zh(e){let t,n=0;for(t=0;t<e.length;t++){const r=e[t];r.user?e[n++]=r:Vs(r)}if(se.context){if(se.count){se.effects||(se.effects=[]),se.effects.push(...e.slice(0,n));return}Yt()}for(se.effects&&(se.done||!se.count)&&(e=[...se.effects,...e],n+=se.effects.length,delete se.effects),t=0;t<n;t++)Vs(e[t])}function Ks(e,t){const n=W&&W.running;n?e.tState=0:e.state=0;for(let r=0;r<e.sources.length;r+=1){const s=e.sources[r];if(s.sources){const a=n?s.tState:s.state;a===ht?s!==t&&(!s.updatedAt||s.updatedAt<fa)&&Vs(s):a===Hr&&Ks(s,t)}}}function qc(e){const t=W&&W.running;for(let n=0;n<e.observers.length;n+=1){const r=e.observers[n];(t?!r.tState:!r.state)&&(t?r.tState=Hr:r.state=Hr,r.pure?Ye.push(r):Ve.push(r),r.observers&&qc(r))}}function pn(e){let t;if(e.sources)for(;e.sources.length;){const n=e.sources.pop(),r=e.sourceSlots.pop(),s=n.observers;if(s&&s.length){const a=s.pop(),l=n.observerSlots.pop();r<s.length&&(a.sourceSlots[l]=r,s[r]=a,n.observerSlots[r]=l)}}if(e.tOwned){for(t=e.tOwned.length-1;t>=0;t--)pn(e.tOwned[t]);delete e.tOwned}if(W&&W.running&&e.pure)Wc(e,!0);else if(e.owned){for(t=e.owned.length-1;t>=0;t--)pn(e.owned[t]);e.owned=null}if(e.cleanups){for(t=e.cleanups.length-1;t>=0;t--)e.cleanups[t]();e.cleanups=null}W&&W.running?e.tState=0:e.state=0}function Wc(e,t){if(t||(e.tState=0,W.disposed.add(e)),e.owned)for(let n=0;n<e.owned.length;n++)Wc(e.owned[n])}function Ts(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"Unknown error",{cause:e})}function eo(e,t,n){try{for(const r of t)r(e)}catch(r){ls(r,n&&n.owner||null)}}function ls(e,t=ue){const n=Fr&&t&&t.context&&t.context[Fr],r=Ts(e);if(!n)throw r;Ve?Ve.push({fn(){eo(r,n,t)},state:ht}):eo(r,n,t)}function gl(e){if(typeof e=="function"&&!e.length)return gl(e());if(Array.isArray(e)){const t=[];for(let n=0;n<e.length;n++){const r=gl(e[n]);Array.isArray(r)?t.push.apply(t,r):t.push(r)}return t}return e}function Xh(e,t){return function(r){let s;return z(()=>s=Me(()=>(ue.context={...ue.context,[e]:r.value},ga(()=>r.children))),void 0),s}}const Jh=Symbol("fallback");function to(e){for(let t=0;t<e.length;t++)e[t]()}function Yh(e,t,n={}){let r=[],s=[],a=[],l=0,i=t.length>1?[]:null;return Ce(()=>to(a)),()=>{let o=e()||[],c=o.length,d,h;return o[Kr],Me(()=>{let p,x,y,b,$,w,v,_,E;if(c===0)l!==0&&(to(a),a=[],r=[],s=[],l=0,i&&(i=[])),n.fallback&&(r=[Jh],s[0]=Ln(S=>(a[0]=S,n.fallback())),l=1);else if(l===0){for(s=new Array(c),h=0;h<c;h++)r[h]=o[h],s[h]=Ln(g);l=c}else{for(y=new Array(c),b=new Array(c),i&&($=new Array(c)),w=0,v=Math.min(l,c);w<v&&r[w]===o[w];w++);for(v=l-1,_=c-1;v>=w&&_>=w&&r[v]===o[_];v--,_--)y[_]=s[v],b[_]=a[v],i&&($[_]=i[v]);for(p=new Map,x=new Array(_+1),h=_;h>=w;h--)E=o[h],d=p.get(E),x[h]=d===void 0?-1:d,p.set(E,h);for(d=w;d<=v;d++)E=r[d],h=p.get(E),h!==void 0&&h!==-1?(y[h]=s[d],b[h]=a[d],i&&($[h]=i[d]),h=x[h],p.set(E,h)):a[d]();for(h=w;h<c;h++)h in y?(s[h]=y[h],a[h]=b[h],i&&(i[h]=$[h],i[h](h))):s[h]=Ln(g);s=s.slice(0,l=c),r=o.slice(0)}return s});function g(p){if(a[h]=p,i){const[x,y]=T(h);return i[h]=y,t(o[h],x)}return t(o[h])}}}function u(e,t){return Me(()=>e(t||{}))}function bs(){return!0}const pl={get(e,t,n){return t===He?n:e.get(t)},has(e,t){return t===He?!0:e.has(t)},set:bs,deleteProperty:bs,getOwnPropertyDescriptor(e,t){return{configurable:!0,enumerable:!0,get(){return e.get(t)},set:bs,deleteProperty:bs}},ownKeys(e){return e.keys()}};function qa(e){return(e=typeof e=="function"?e():e)?e:{}}function Qh(){for(let e=0,t=this.length;e<t;++e){const n=this[e]();if(n!==void 0)return n}}function ml(...e){let t=!1;for(let l=0;l<e.length;l++){const i=e[l];t=t||!!i&&He in i,e[l]=typeof i=="function"?(t=!0,ce(i)):i}if(Bc&&t)return new Proxy({get(l){for(let i=e.length-1;i>=0;i--){const o=qa(e[i])[l];if(o!==void 0)return o}},has(l){for(let i=e.length-1;i>=0;i--)if(l in qa(e[i]))return!0;return!1},keys(){const l=[];for(let i=0;i<e.length;i++)l.push(...Object.keys(qa(e[i])));return[...new Set(l)]}},pl);const n={},r=Object.create(null);for(let l=e.length-1;l>=0;l--){const i=e[l];if(!i)continue;const o=Object.getOwnPropertyNames(i);for(let c=o.length-1;c>=0;c--){const d=o[c];if(d==="__proto__"||d==="constructor")continue;const h=Object.getOwnPropertyDescriptor(i,d);if(!r[d])r[d]=h.get?{enumerable:!0,configurable:!0,get:Qh.bind(n[d]=[h.get.bind(i)])}:h.value!==void 0?h:void 0;else{const g=n[d];g&&(h.get?g.push(h.get.bind(i)):h.value!==void 0&&g.push(()=>h.value))}}}const s={},a=Object.keys(r);for(let l=a.length-1;l>=0;l--){const i=a[l],o=r[i];o&&o.get?Object.defineProperty(s,i,o):s[i]=o?o.value:void 0}return s}function e0(e,...t){const n=t.length;if(Bc&&He in e){const s=n>1?t.flat():t[0],a=t.map(l=>new Proxy({get(i){return l.includes(i)?e[i]:void 0},has(i){return l.includes(i)&&i in e},keys(){return l.filter(i=>i in e)}},pl));return a.push(new Proxy({get(l){return s.includes(l)?void 0:e[l]},has(l){return s.includes(l)?!1:l in e},keys(){return Object.keys(e).filter(l=>!s.includes(l))}},pl)),a}const r=[];for(let s=0;s<=n;s++)r[s]={};for(const s of Object.getOwnPropertyNames(e)){let a=n;for(let o=0;o<t.length;o++)if(t[o].includes(s)){a=o;break}const l=Object.getOwnPropertyDescriptor(e,s);!l.get&&!l.set&&l.enumerable&&l.writable&&l.configurable?r[a][s]=l.value:Object.defineProperty(r[a],s,l)}return r}function t0(e){let t,n;const r=s=>{const a=se.context;if(a){const[i,o]=T();se.count||(se.count=0),se.count++,(n||(n=e())).then(c=>{!se.done&&Yt(a),se.count--,o(()=>c.default),Yt()}),t=i}else if(!t){const[i]=Ht(()=>(n||(n=e())).then(o=>o.default));t=i}let l;return ce(()=>(l=t())?Me(()=>{if(!a||se.done)return l(s);const i=se.context;Yt(a);const o=l(s);return Yt(i),o}):"")};return r.preload=()=>n||((n=e()).then(s=>t=()=>s.default),n),r}let n0=0;function r0(){return se.context?se.getNextContextId():`cl-${n0++}`}const Gc=e=>`Stale read from <${e}>.`;function oe(e){const t="fallback"in e&&{fallback:()=>e.fallback};return ce(Yh(()=>e.each,e.children,t||void 0))}function k(e){const t=e.keyed,n=ce(()=>e.when,void 0,void 0),r=t?n:ce(n,void 0,{equals:(s,a)=>!s==!a});return ce(()=>{const s=r();if(s){const a=e.children;return typeof a=="function"&&a.length>0?Me(()=>a(t?s:()=>{if(!Me(r))throw Gc("Show");return n()})):a}return e.fallback},void 0,void 0)}function Zc(e){const t=ga(()=>e.children),n=ce(()=>{const r=t(),s=Array.isArray(r)?r:[r];let a=()=>{};for(let l=0;l<s.length;l++){const i=l,o=s[l],c=a,d=ce(()=>c()?void 0:o.when,void 0,void 0),h=o.keyed?d:ce(d,void 0,{equals:(g,p)=>!g==!p});a=()=>c()||(h()?[i,d,o]:void 0)}return a});return ce(()=>{const r=n()();if(!r)return e.fallback;const[s,a,l]=r,i=l.children;return typeof i=="function"&&i.length>0?Me(()=>i(l.keyed?a():()=>{if(Me(n)()?.[0]!==s)throw Gc("Match");return a()})):i},void 0,void 0)}function or(e){return e}let tr;function s0(){tr&&[...tr].forEach(e=>e())}function dn(e){let t;se.context&&se.load&&(t=se.load(se.getContextId()));const[n,r]=T(t,void 0);return tr||(tr=new Set),tr.add(r),Ce(()=>tr.delete(r)),ce(()=>{let s;if(s=n()){const a=e.fallback;return typeof a=="function"&&a.length?Me(()=>a(s,()=>r())):a}return Kh(()=>e.children,r)},void 0,void 0)}const a0=Bn();function cr(e){let t=0,n,r,s,a,l;const[i,o]=T(!1),c=Wh(),d={increment:()=>{++t===1&&o(!0)},decrement:()=>{--t===0&&o(!1)},inFallback:i,effects:[],resolved:!1},h=Wr();if(se.context&&se.load){const x=se.getContextId();let y=se.load(x);if(y&&(typeof y!="object"||y.s!==1?s=y:se.gather(x)),s&&s!=="$$f"){const[b,$]=T(void 0,{equals:!1});a=b,s.then(()=>{if(se.done)return $();se.gather(x),Yt(r),$(),Yt()},w=>{l=w,$()})}}const g=mt(a0);g&&(n=g.register(d.inFallback));let p;return Ce(()=>p&&p()),u(c.Provider,{value:d,get children(){return ce(()=>{if(l)throw l;if(r=se.context,a)return a(),a=void 0;r&&s==="$$f"&&Yt();const x=ce(()=>e.children);return ce(y=>{const b=d.inFallback(),{showContent:$=!0,showFallback:w=!0}=n?n():{};if((!b||s&&s!=="$$f")&&$)return d.resolved=!0,p&&p(),p=r=s=void 0,qh(d.effects),x();if(w)return p?y:Ln(v=>(p=v,r&&(Yt({id:r.id+"F",count:0}),r=void 0),e.fallback),h)})})}})}const l0=["allowfullscreen","async","alpha","autofocus","autoplay","checked","controls","default","disabled","formnovalidate","hidden","indeterminate","inert","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","readonly","required","reversed","seamless","selected","adauctionheaders","browsingtopics","credentialless","defaultchecked","defaultmuted","defaultselected","defer","disablepictureinpicture","disableremoteplayback","preservespitch","shadowrootclonable","shadowrootcustomelementregistry","shadowrootdelegatesfocus","shadowrootserializable","sharedstoragewritable"],i0=new Set(["className","value","readOnly","noValidate","formNoValidate","isMap","noModule","playsInline","adAuctionHeaders","allowFullscreen","browsingTopics","defaultChecked","defaultMuted","defaultSelected","disablePictureInPicture","disableRemotePlayback","preservesPitch","shadowRootClonable","shadowRootCustomElementRegistry","shadowRootDelegatesFocus","shadowRootSerializable","sharedStorageWritable",...l0]),o0=new Set(["innerHTML","textContent","innerText","children"]),c0=Object.assign(Object.create(null),{className:"class",htmlFor:"for"}),d0=Object.assign(Object.create(null),{class:"className",novalidate:{$:"noValidate",FORM:1},formnovalidate:{$:"formNoValidate",BUTTON:1,INPUT:1},ismap:{$:"isMap",IMG:1},nomodule:{$:"noModule",SCRIPT:1},playsinline:{$:"playsInline",VIDEO:1},readonly:{$:"readOnly",INPUT:1,TEXTAREA:1},adauctionheaders:{$:"adAuctionHeaders",IFRAME:1},allowfullscreen:{$:"allowFullscreen",IFRAME:1},browsingtopics:{$:"browsingTopics",IMG:1},defaultchecked:{$:"defaultChecked",INPUT:1},defaultmuted:{$:"defaultMuted",AUDIO:1,VIDEO:1},defaultselected:{$:"defaultSelected",OPTION:1},disablepictureinpicture:{$:"disablePictureInPicture",VIDEO:1},disableremoteplayback:{$:"disableRemotePlayback",AUDIO:1,VIDEO:1},preservespitch:{$:"preservesPitch",AUDIO:1,VIDEO:1},shadowrootclonable:{$:"shadowRootClonable",TEMPLATE:1},shadowrootdelegatesfocus:{$:"shadowRootDelegatesFocus",TEMPLATE:1},shadowrootserializable:{$:"shadowRootSerializable",TEMPLATE:1},sharedstoragewritable:{$:"sharedStorageWritable",IFRAME:1,IMG:1}});function u0(e,t){const n=d0[e];return typeof n=="object"?n[t]?n.$:void 0:n}const f0=new Set(["beforeinput","click","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"]),h0={xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace"},X=e=>ce(()=>e());function g0(e,t,n){let r=n.length,s=t.length,a=r,l=0,i=0,o=t[s-1].nextSibling,c=null;for(;l<s||i<a;){if(t[l]===n[i]){l++,i++;continue}for(;t[s-1]===n[a-1];)s--,a--;if(s===l){const d=a<r?i?n[i-1].nextSibling:n[a-i]:o;for(;i<a;)e.insertBefore(n[i++],d)}else if(a===i)for(;l<s;)(!c||!c.has(t[l]))&&t[l].remove(),l++;else if(t[l]===n[a-1]&&n[i]===t[s-1]){const d=t[--s].nextSibling;e.insertBefore(n[i++],t[l++].nextSibling),e.insertBefore(n[--a],d),t[s]=n[a]}else{if(!c){c=new Map;let h=i;for(;h<a;)c.set(n[h],h++)}const d=c.get(t[l]);if(d!=null)if(i<d&&d<a){let h=l,g=1,p;for(;++h<s&&h<a&&!((p=c.get(t[h]))==null||p!==d+g);)g++;if(g>d-i){const x=t[l];for(;i<d;)e.insertBefore(n[i++],x)}else e.replaceChild(n[i++],t[l++])}else l++;else t[l++].remove()}}}const no="_$DX_DELEGATE";function p0(e,t,n,r={}){let s;return Ln(a=>{s=a,t===document?e():f(t,e(),t.firstChild?null:void 0,n)},r.owner),()=>{s(),t.textContent=""}}function m(e,t,n,r){let s;const a=()=>{const i=document.createElement("template");return i.innerHTML=e,i.content.firstChild},l=()=>(s||(s=a())).cloneNode(!0);return l.cloneNode=l,l}function ke(e,t=window.document){const n=t[no]||(t[no]=new Set);for(let r=0,s=e.length;r<s;r++){const a=e[r];n.has(a)||(n.add(a),t.addEventListener(a,y0))}}function ae(e,t,n){Er(e)||(n==null?e.removeAttribute(t):e.setAttribute(t,n))}function m0(e,t,n,r){Er(e)||(r==null?e.removeAttributeNS(t,n):e.setAttributeNS(t,n,r))}function b0(e,t,n){Er(e)||(n?e.setAttribute(t,""):e.removeAttribute(t))}function he(e,t){Er(e)||(t==null?e.removeAttribute("class"):e.className=t)}function $t(e,t,n,r){if(r)Array.isArray(n)?(e[`$$${t}`]=n[0],e[`$$${t}Data`]=n[1]):e[`$$${t}`]=n;else if(Array.isArray(n)){const s=n[0];e.addEventListener(t,n[0]=a=>s.call(e,n[1],a))}else e.addEventListener(t,n,typeof n!="function"&&n)}function ye(e,t,n={}){const r=Object.keys(t||{}),s=Object.keys(n);let a,l;for(a=0,l=s.length;a<l;a++){const i=s[a];!i||i==="undefined"||t[i]||(ro(e,i,!1),delete n[i])}for(a=0,l=r.length;a<l;a++){const i=r[a],o=!!t[i];!i||i==="undefined"||n[i]===o||!o||(ro(e,i,!0),n[i]=o)}return n}function Xc(e,t,n){if(!t)return n?ae(e,"style"):t;const r=e.style;if(typeof t=="string")return r.cssText=t;typeof n=="string"&&(r.cssText=n=void 0),n||(n={}),t||(t={});let s,a;for(a in n)t[a]==null&&r.removeProperty(a),delete n[a];for(a in t)s=t[a],s!==n[a]&&(r.setProperty(a,s),n[a]=s);return n}function Hs(e,t,n){n!=null?e.style.setProperty(t,n):e.style.removeProperty(t)}function bl(e,t={},n,r){const s={};return r||z(()=>s.children=Gr(e,t.children,s.children)),z(()=>typeof t.ref=="function"&&Ne(t.ref,e)),z(()=>x0(e,t,n,!0,s,!0)),s}function Ne(e,t,n){return Me(()=>e(t,n))}function f(e,t,n,r){if(n!==void 0&&!r&&(r=[]),typeof t!="function")return Gr(e,t,r,n);z(s=>Gr(e,t(),s,n),r)}function x0(e,t,n,r,s={},a=!1){t||(t={});for(const l in s)if(!(l in t)){if(l==="children")continue;s[l]=so(e,l,null,s[l],n,a,t)}for(const l in t){if(l==="children")continue;const i=t[l];s[l]=so(e,l,i,s[l],n,a,t)}}function Er(e){return!!se.context&&!se.done&&(!e||e.isConnected)}function v0(e){return e.toLowerCase().replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function ro(e,t,n){const r=t.trim().split(/\s+/);for(let s=0,a=r.length;s<a;s++)e.classList.toggle(r[s],n)}function so(e,t,n,r,s,a,l){let i,o,c,d,h;if(t==="style")return Xc(e,n,r);if(t==="classList")return ye(e,n,r);if(n===r)return r;if(t==="ref")a||n(e);else if(t.slice(0,3)==="on:"){const g=t.slice(3);r&&e.removeEventListener(g,r,typeof r!="function"&&r),n&&e.addEventListener(g,n,typeof n!="function"&&n)}else if(t.slice(0,10)==="oncapture:"){const g=t.slice(10);r&&e.removeEventListener(g,r,!0),n&&e.addEventListener(g,n,!0)}else if(t.slice(0,2)==="on"){const g=t.slice(2).toLowerCase(),p=f0.has(g);if(!p&&r){const x=Array.isArray(r)?r[0]:r;e.removeEventListener(g,x)}(p||n)&&($t(e,g,n,p),p&&ke([g]))}else if(t.slice(0,5)==="attr:")ae(e,t.slice(5),n);else if(t.slice(0,5)==="bool:")b0(e,t.slice(5),n);else if((h=t.slice(0,5)==="prop:")||(c=o0.has(t))||!s&&((d=u0(t,e.tagName))||(o=i0.has(t)))||(i=e.nodeName.includes("-")||"is"in l)){if(h)t=t.slice(5),o=!0;else if(Er(e))return n;t==="class"||t==="className"?he(e,n):i&&!o&&!c?e[v0(t)]=n:e[d||t]=n}else{const g=s&&t.indexOf(":")>-1&&h0[t.split(":")[0]];g?m0(e,g,t,n):ae(e,c0[t]||t,n)}return n}function y0(e){if(se.registry&&se.events&&se.events.find(([o,c])=>c===e))return;let t=e.target;const n=`$$${e.type}`,r=e.target,s=e.currentTarget,a=o=>Object.defineProperty(e,"target",{configurable:!0,value:o}),l=()=>{const o=t[n];if(o&&!t.disabled){const c=t[`${n}Data`];if(c!==void 0?o.call(t,c,e):o.call(t,e),e.cancelBubble)return}return t.host&&typeof t.host!="string"&&!t.host._$host&&t.contains(e.target)&&a(t.host),!0},i=()=>{for(;l()&&(t=t._$host||t.parentNode||t.host););};if(Object.defineProperty(e,"currentTarget",{configurable:!0,get(){return t||document}}),se.registry&&!se.done&&(se.done=_$HY.done=!0),e.composedPath){const o=e.composedPath();a(o[0]);for(let c=0;c<o.length-2&&(t=o[c],!!l());c++){if(t._$host){t=t._$host,i();break}if(t.parentNode===s)break}}else i();a(r)}function Gr(e,t,n,r,s){const a=Er(e);if(a){!n&&(n=[...e.childNodes]);let o=[];for(let c=0;c<n.length;c++){const d=n[c];d.nodeType===8&&d.data.slice(0,2)==="!$"?d.remove():o.push(d)}n=o}for(;typeof n=="function";)n=n();if(t===n)return n;const l=typeof t,i=r!==void 0;if(e=i&&n[0]&&n[0].parentNode||e,l==="string"||l==="number"){if(a||l==="number"&&(t=t.toString(),t===n))return n;if(i){let o=n[0];o&&o.nodeType===3?o.data!==t&&(o.data=t):o=document.createTextNode(t),n=Gn(e,n,r,o)}else n!==""&&typeof n=="string"?n=e.firstChild.data=t:n=e.textContent=t}else if(t==null||l==="boolean"){if(a)return n;n=Gn(e,n,r)}else{if(l==="function")return z(()=>{let o=t();for(;typeof o=="function";)o=o();n=Gr(e,o,n,r)}),()=>n;if(Array.isArray(t)){const o=[],c=n&&Array.isArray(n);if(xl(o,t,n,s))return z(()=>n=Gr(e,o,n,r,!0)),()=>n;if(a){if(!o.length)return n;if(r===void 0)return n=[...e.childNodes];let d=o[0];if(d.parentNode!==e)return n;const h=[d];for(;(d=d.nextSibling)!==r;)h.push(d);return n=h}if(o.length===0){if(n=Gn(e,n,r),i)return n}else c?n.length===0?ao(e,o,r):g0(e,n,o):(n&&Gn(e),ao(e,o));n=o}else if(t.nodeType){if(a&&t.parentNode)return n=i?[t]:t;if(Array.isArray(n)){if(i)return n=Gn(e,n,r,t);Gn(e,n,null,t)}else n==null||n===""||!e.firstChild?e.appendChild(t):e.replaceChild(t,e.firstChild);n=t}}return n}function xl(e,t,n,r){let s=!1;for(let a=0,l=t.length;a<l;a++){let i=t[a],o=n&&n[e.length],c;if(!(i==null||i===!0||i===!1))if((c=typeof i)=="object"&&i.nodeType)e.push(i);else if(Array.isArray(i))s=xl(e,i,o)||s;else if(c==="function")if(r){for(;typeof i=="function";)i=i();s=xl(e,Array.isArray(i)?i:[i],Array.isArray(o)?o:[o])||s}else e.push(i),s=!0;else{const d=String(i);o&&o.nodeType===3&&o.data===d?e.push(o):e.push(document.createTextNode(d))}}return s}function ao(e,t,n=null){for(let r=0,s=t.length;r<s;r++)e.insertBefore(t[r],n)}function Gn(e,t,n,r){if(n===void 0)return e.textContent="";const s=r||document.createTextNode("");if(t.length){let a=!1;for(let l=t.length-1;l>=0;l--){const i=t[l];if(s!==i){const o=i.parentNode===e;!a&&!l?o?e.replaceChild(s,i):e.insertBefore(s,n):o&&i.remove()}else a=!0}}else e.insertBefore(s,n);return[s]}const w0=!1,$0="http://www.w3.org/2000/svg";function k0(e,t=!1,n=void 0){return t?document.createElementNS($0,e):document.createElement(e,{is:n})}function Yl(e){const{useShadow:t}=e,n=document.createTextNode(""),r=()=>e.mount||document.body,s=Wr();let a,l=!!se.context;return Ue(()=>{l&&(Wr().user=l=!1),a||(a=ha(s,()=>ce(()=>e.children)));const i=r();if(i instanceof HTMLHeadElement){const[o,c]=T(!1),d=()=>c(!0);Ln(h=>f(i,()=>o()?h():a(),null)),Ce(d)}else{const o=k0(e.isSVG?"g":"div",e.isSVG),c=t&&o.attachShadow?o.attachShadow({mode:"open"}):o;Object.defineProperty(o,"_$host",{get(){return n.parentNode},configurable:!0}),f(c,a),i.appendChild(o),e.ref&&e.ref(o),Ce(()=>i.removeChild(o))}},void 0,{render:!l}),n}function Jc(){let e=new Set;function t(s){return e.add(s),()=>e.delete(s)}let n=!1;function r(s,a){if(n)return!(n=!1);const l={to:s,options:a,defaultPrevented:!1,preventDefault:()=>l.defaultPrevented=!0};for(const i of e)i.listener({...l,from:i.location,retry:o=>{o&&(n=!0),i.navigate(s,{...a,resolve:!1})}});return!l.defaultPrevented}return{subscribe:t,confirm:r}}let vl;function Ql(){(!window.history.state||window.history.state._depth==null)&&window.history.replaceState({...window.history.state,_depth:window.history.length-1},""),vl=window.history.state._depth}Ql();function _0(e){return{...e,_depth:window.history.state&&window.history.state._depth}}function S0(e,t){let n=!1;return()=>{const r=vl;Ql();const s=r==null?null:vl-r;if(n){n=!1;return}s&&t(s)?(n=!0,window.history.go(-s)):e()}}const E0=/^(?:[a-z0-9]+:)?\/\//i,C0=/^\/+|(\/)\/+$/g,Yc="http://sr";function Pn(e,t=!1){const n=e.replace(C0,"$1");return n?t||/^[?#]/.test(n)?n:"/"+n:""}function Ls(e,t,n){if(E0.test(t))return;const r=Pn(e),s=n&&Pn(n);let a="";return!s||t.startsWith("/")?a=r:s.toLowerCase().indexOf(r.toLowerCase())!==0?a=r+s:a=s,(a||"/")+Pn(t,!a)}function A0(e,t){if(e==null)throw new Error(t);return e}function R0(e,t){return Pn(e).replace(/\/*(\*.*)?$/g,"")+Pn(t)}function Qc(e){const t={};return e.searchParams.forEach((n,r)=>{r in t?Array.isArray(t[r])?t[r].push(n):t[r]=[t[r],n]:t[r]=n}),t}function T0(e,t,n){const[r,s]=e.split("/*",2),a=r.split("/").filter(Boolean),l=a.length;return i=>{const o=i.split("/").filter(Boolean),c=o.length-l;if(c<0||c>0&&s===void 0&&!t)return null;const d={path:l?"":"/",params:{}},h=g=>n===void 0?void 0:n[g];for(let g=0;g<l;g++){const p=a[g],x=p[0]===":",y=x?o[g]:o[g].toLowerCase(),b=x?p.slice(1):p.toLowerCase();if(x&&Wa(y,h(b)))d.params[b]=y;else if(x||!Wa(y,b))return null;d.path+=`/${y}`}if(s){const g=c?o.slice(-c).join("/"):"";if(Wa(g,h(s)))d.params[s]=g;else return null}return d}}function Wa(e,t){const n=r=>r===e;return t===void 0?!0:typeof t=="string"?n(t):typeof t=="function"?t(e):Array.isArray(t)?t.some(n):t instanceof RegExp?t.test(e):!1}function L0(e){const[t,n]=e.pattern.split("/*",2),r=t.split("/").filter(Boolean);return r.reduce((s,a)=>s+(a.startsWith(":")?2:3),r.length-(n===void 0?0:1))}function ed(e){const t=new Map,n=Wr();return new Proxy({},{get(r,s){return t.has(s)||ha(n,()=>t.set(s,ce(()=>e()[s]))),t.get(s)()},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}},ownKeys(){return Reflect.ownKeys(e())},has(r,s){return s in e()}})}function P0(e,t){const n=new URLSearchParams(e);Object.entries(t).forEach(([s,a])=>{a==null||a===""||a instanceof Array&&!a.length?n.delete(s):a instanceof Array?(n.delete(s),a.forEach(l=>{n.append(s,String(l))})):n.set(s,String(a))});const r=n.toString();return r?`?${r}`:""}function td(e){let t=/(\/?\:[^\/]+)\?/.exec(e);if(!t)return[e];let n=e.slice(0,t.index),r=e.slice(t.index+t[0].length);const s=[n,n+=t[1]];for(;t=/^(\/\:[^\/]+)\?/.exec(r);)s.push(n+=t[1]),r=r.slice(t[0].length);return td(r).reduce((a,l)=>[...a,...s.map(i=>i+l)],[])}const I0=100,nd=Bn(),ei=Bn(),Cr=()=>A0(mt(nd),"<A> and 'use' router primitives can be only used inside a Route."),D0=()=>mt(ei)||Cr().base,O0=e=>{const t=D0();return ce(()=>t.resolvePath(e()))},j0=e=>{const t=Cr();return ce(()=>{const n=e();return n!==void 0?t.renderPath(n):n})},At=()=>Cr().navigatorFactory(),bt=()=>Cr().location,Fn=()=>Cr().params,ti=()=>{const e=bt(),t=At(),n=(r,s)=>{const a=Me(()=>P0(e.search,r)+e.hash);t(a,{scroll:!1,resolve:!1,...s})};return[e.query,n]},U0=e=>{const t=Cr().beforeLeave.subscribe({listener:e,location:bt(),navigate:At()});Ce(t)};function N0(e,t=""){const{component:n,preload:r,load:s,children:a,info:l}=e,i=!a||Array.isArray(a)&&!a.length,o={key:e,component:n,preload:r||s,info:l};return rd(e.path).reduce((c,d)=>{for(const h of td(d)){const g=R0(t,h);let p=i?g:g.split("/*",1)[0];p=p.split("/").map(x=>x.startsWith(":")||x.startsWith("*")?x:encodeURIComponent(x)).join("/"),c.push({...o,originalPath:d,pattern:p,matcher:T0(p,!i,e.matchFilters)})}return c},[])}function M0(e,t=0){return{routes:e,score:L0(e[e.length-1])*1e4-t,matcher(n){const r=[];for(let s=e.length-1;s>=0;s--){const a=e[s],l=a.matcher(n);if(!l)return null;r.unshift({...l,route:a})}return r}}}function rd(e){return Array.isArray(e)?e:[e]}function sd(e,t="",n=[],r=[]){const s=rd(e);for(let a=0,l=s.length;a<l;a++){const i=s[a];if(i&&typeof i=="object"){i.hasOwnProperty("path")||(i.path="");const o=N0(i,t);for(const c of o){n.push(c);const d=Array.isArray(i.children)&&i.children.length===0;if(i.children&&!d)sd(i.children,c.pattern,n,r);else{const h=M0([...n],r.length);r.push(h)}n.pop()}}}return n.length?r:r.sort((a,l)=>l.score-a.score)}function Ga(e,t){for(let n=0,r=e.length;n<r;n++){const s=e[n].matcher(t);if(s)return s}return[]}function B0(e,t,n){const r=new URL(Yc),s=ce(d=>{const h=e();try{return new URL(h,r)}catch{return console.error(`Invalid path ${h}`),d}},r,{equals:(d,h)=>d.href===h.href}),a=ce(()=>s().pathname),l=ce(()=>s().search,!0),i=ce(()=>s().hash),o=()=>"",c=Jl(l,()=>Qc(s()));return{get pathname(){return a()},get search(){return l()},get hash(){return i()},get state(){return t()},get key(){return o()},query:n?n(c):ed(c)}}let kn;function F0(){return kn}function z0(e,t,n,r={}){const{signal:[s,a],utils:l={}}=e,i=l.parsePath||(F=>F),o=l.renderPath||(F=>F),c=l.beforeLeave||Jc(),d=Ls("",r.base||"");if(d===void 0)throw new Error(`${d} is not a valid base path`);d&&!s().value&&a({value:d,replace:!0,scroll:!1});const[h,g]=T(!1);let p;const x=(F,B)=>{B.value===y()&&B.state===$()||(p===void 0&&g(!0),kn=F,p=B,Hh(()=>{p===B&&(b(p.value),w(p.state),s0(),E[1](K=>K.filter(q=>q.pending)))}).finally(()=>{p===B&&ir(()=>{kn=void 0,F==="navigate"&&M(p),g(!1),p=void 0})}))},[y,b]=T(s().value),[$,w]=T(s().state),v=B0(y,$,l.queryWrapper),_=[],E=T([]),S=ce(()=>typeof r.transformUrl=="function"?Ga(t(),r.transformUrl(v.pathname)):Ga(t(),v.pathname)),C=()=>{const F=S(),B={};for(let K=0;K<F.length;K++)Object.assign(B,F[K].params);return B},A=l.paramsWrapper?l.paramsWrapper(C,t):ed(C),D={pattern:d,path:()=>d,outlet:()=>null,resolvePath(F){return Ls(d,F)}};return z(Jl(s,F=>x("native",F),{defer:!0})),{base:D,location:v,params:A,isRouting:h,renderPath:o,parsePath:i,navigatorFactory:I,matches:S,beforeLeave:c,preloadRoute:Y,singleFlight:r.singleFlight===void 0?!0:r.singleFlight,submissions:E};function N(F,B,K){Me(()=>{if(typeof B=="number"){B&&(l.go?l.go(B):console.warn("Router integration does not support relative routing"));return}const q=!B||B[0]==="?",{replace:U,resolve:L,scroll:V,state:P}={replace:!1,resolve:!q,scroll:!0,...K},R=L?F.resolvePath(B):Ls(q&&v.pathname||"",B);if(R===void 0)throw new Error(`Path '${B}' is not a routable path`);if(_.length>=I0)throw new Error("Too many redirects");const O=y();(R!==O||P!==$())&&(w0||c.confirm(R,K)&&(_.push({value:O,replace:U,scroll:V,state:$()}),x("navigate",{value:R,state:P})))})}function I(F){return F=F||mt(ei)||D,(B,K)=>N(F,B,K)}function M(F){const B=_[0];B&&(a({...F,replace:B.replace,scroll:B.scroll}),_.length=0)}function Y(F,B){const K=Ga(t(),F.pathname),q=kn;kn="preload";for(let U in K){const{route:L,params:V}=K[U];L.component&&L.component.preload&&L.component.preload();const{preload:P}=L;B&&P&&ha(n(),()=>P({params:V,location:{pathname:F.pathname,search:F.search,hash:F.hash,query:Qc(F),state:null,key:""},intent:"preload"}))}kn=q}}function V0(e,t,n,r){const{base:s,location:a,params:l}=e,{pattern:i,component:o,preload:c}=r().route,d=ce(()=>r().path);o&&o.preload&&o.preload();const h=c?c({params:l,location:a,intent:kn||"initial"}):void 0;return{parent:t,pattern:i,path:d,outlet:()=>o?u(o,{params:l,location:a,data:h,get children(){return n()}}):n(),resolvePath(p){return Ls(s.path(),p,d())}}}const K0=e=>t=>{const{base:n}=t,r=ga(()=>t.children),s=ce(()=>sd(r(),t.base||""));let a;const l=z0(e,s,()=>a,{base:n,singleFlight:t.singleFlight,transformUrl:t.transformUrl});return e.create&&e.create(l),u(nd.Provider,{value:l,get children(){return u(H0,{routerState:l,get root(){return t.root},get preload(){return t.rootPreload||t.rootLoad},get children(){return[X(()=>(a=Wr())&&null),u(q0,{routerState:l,get branches(){return s()}})]}})}})};function H0(e){const t=e.routerState.location,n=e.routerState.params,r=ce(()=>e.preload&&Me(()=>{e.preload({params:n,location:t,intent:F0()||"initial"})}));return u(k,{get when(){return e.root},keyed:!0,get fallback(){return e.children},children:s=>u(s,{params:n,location:t,get data(){return r()},get children(){return e.children}})})}function q0(e){const t=[];let n;const r=ce(Jl(e.routerState.matches,(s,a,l)=>{let i=a&&s.length===a.length;const o=[];for(let c=0,d=s.length;c<d;c++){const h=a&&a[c],g=s[c];l&&h&&g.route.key===h.route.key?o[c]=l[c]:(i=!1,t[c]&&t[c](),Ln(p=>{t[c]=p,o[c]=V0(e.routerState,o[c-1]||e.routerState.base,lo(()=>r()[c+1]),()=>{const x=e.routerState.matches();return x[c]??x[0]})}))}return t.splice(s.length).forEach(c=>c()),l&&i?l:(n=o[0],o)}));return lo(()=>r()&&n)()}const lo=e=>()=>u(k,{get when(){return e()},keyed:!0,children:t=>u(ei.Provider,{value:t,get children(){return t.outlet()}})}),xt=e=>{const t=ga(()=>e.children);return ml(e,{get children(){return t()}})};function W0([e,t],n,r){return[e,r?s=>t(r(s)):t]}function G0(e){let t=!1;const n=s=>typeof s=="string"?{value:s}:s,r=W0(T(n(e.get()),{equals:(s,a)=>s.value===a.value&&s.state===a.state}),void 0,s=>(!t&&e.set(s),se.registry&&!se.done&&(se.done=!0),s));return e.init&&Ce(e.init((s=e.get())=>{t=!0,r[1](n(s)),t=!1})),K0({signal:r,create:e.create,utils:e.utils})}function Z0(e,t,n){return e.addEventListener(t,n),()=>e.removeEventListener(t,n)}function X0(e,t){const n=e&&document.getElementById(e);n?n.scrollIntoView():t&&window.scrollTo(0,0)}const J0=new Map;function Y0(e=!0,t=!1,n="/_server",r){return s=>{const a=s.base.path(),l=s.navigatorFactory(s.base);let i,o;function c(y){return y.namespaceURI==="http://www.w3.org/2000/svg"}function d(y){if(y.defaultPrevented||y.button!==0||y.metaKey||y.altKey||y.ctrlKey||y.shiftKey)return;const b=y.composedPath().find(S=>S instanceof Node&&S.nodeName.toUpperCase()==="A");if(!b||t&&!b.hasAttribute("link"))return;const $=c(b),w=$?b.href.baseVal:b.href;if(($?b.target.baseVal:b.target)||!w&&!b.hasAttribute("state"))return;const _=(b.getAttribute("rel")||"").split(/\s+/);if(b.hasAttribute("download")||_&&_.includes("external"))return;const E=$?new URL(w,document.baseURI):new URL(w);if(!(E.origin!==window.location.origin||a&&E.pathname&&!E.pathname.toLowerCase().startsWith(a.toLowerCase())))return[b,E]}function h(y){const b=d(y);if(!b)return;const[$,w]=b,v=s.parsePath(w.pathname+w.search+w.hash),_=$.getAttribute("state");y.preventDefault(),l(v,{resolve:!1,replace:$.hasAttribute("replace"),scroll:!$.hasAttribute("noscroll"),state:_?JSON.parse(_):void 0})}function g(y){const b=d(y);if(!b)return;const[$,w]=b;r&&(w.pathname=r(w.pathname)),s.preloadRoute(w,$.getAttribute("preload")!=="false")}function p(y){clearTimeout(i);const b=d(y);if(!b)return o=null;const[$,w]=b;o!==$&&(r&&(w.pathname=r(w.pathname)),i=setTimeout(()=>{s.preloadRoute(w,$.getAttribute("preload")!=="false"),o=$},20))}function x(y){if(y.defaultPrevented)return;let b=y.submitter&&y.submitter.hasAttribute("formaction")?y.submitter.getAttribute("formaction"):y.target.getAttribute("action");if(!b)return;if(!b.startsWith("https://action/")){const w=new URL(b,Yc);if(b=s.parsePath(w.pathname+w.search),!b.startsWith(n))return}if(y.target.method.toUpperCase()!=="POST")throw new Error("Only POST forms are supported for Actions");const $=J0.get(b);if($){y.preventDefault();const w=new FormData(y.target,y.submitter);$.call({r:s,f:y.target},y.target.enctype==="multipart/form-data"?w:new URLSearchParams(w))}}ke(["click","submit"]),document.addEventListener("click",h),e&&(document.addEventListener("mousemove",p,{passive:!0}),document.addEventListener("focusin",g,{passive:!0}),document.addEventListener("touchstart",g,{passive:!0})),document.addEventListener("submit",x),Ce(()=>{document.removeEventListener("click",h),e&&(document.removeEventListener("mousemove",p),document.removeEventListener("focusin",g),document.removeEventListener("touchstart",g)),document.removeEventListener("submit",x)})}}function Q0(e){const t=()=>{const r=window.location.pathname.replace(/^\/+/,"/")+window.location.search,s=window.history.state&&window.history.state._depth&&Object.keys(window.history.state).length===1?void 0:window.history.state;return{value:r+window.location.hash,state:s}},n=Jc();return G0({get:t,set({value:r,replace:s,scroll:a,state:l}){s?window.history.replaceState(_0(l),"",r):window.history.pushState(l,"",r),X0(decodeURIComponent(window.location.hash.slice(1)),a),Ql()},init:r=>Z0(window,"popstate",S0(r,s=>{if(s)return!n.confirm(s);{const a=t();return!n.confirm(a.value,{state:a.state})}})),create:Y0(e.preload,e.explicitLinks,e.actionBase,e.transformUrl),utils:{go:r=>window.history.go(r),beforeLeave:n}})(e)}var eg=m("<a>");function Ie(e){e=ml({inactiveClass:"inactive",activeClass:"active"},e);const[,t]=e0(e,["href","state","class","activeClass","inactiveClass","end"]),n=O0(()=>e.href),r=j0(n),s=bt(),a=ce(()=>{const l=n();if(l===void 0)return[!1,!1];const i=Pn(l.split(/[?#]/,1)[0]).toLowerCase(),o=decodeURI(Pn(s.pathname).toLowerCase());return[e.end?i===o:o.startsWith(i+"/")||o===i,i===o]});return(()=>{var l=eg();return bl(l,ml(t,{get href(){return r()||e.href},get state(){return JSON.stringify(e.state)},get classList(){return{...e.class&&{[e.class]:!0},[e.inactiveClass]:!a()[0],[e.activeClass]:a()[0],...t.classList}},link:"",get"aria-current"(){return a()[1]?"page":void 0}}),!1,!1),l})()}const gr=Symbol("store-raw"),Nt=Symbol("store-node"),ut=Symbol("store-has"),ad=Symbol("store-self");function ld(e){let t=e[He];if(!t&&(Object.defineProperty(e,He,{value:t=new Proxy(e,ng)}),!Array.isArray(e))){const n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e);for(let s=0,a=n.length;s<a;s++){const l=n[s];r[l].get&&Object.defineProperty(e,l,{enumerable:r[l].enumerable,get:r[l].get.bind(t)})}}return t}function On(e){let t;return e!=null&&typeof e=="object"&&(e[He]||!(t=Object.getPrototypeOf(e))||t===Object.prototype||Array.isArray(e))}function mn(e,t=new Set){let n,r,s,a;if(n=e!=null&&e[gr])return n;if(!On(e)||t.has(e))return e;if(Array.isArray(e)){Object.isFrozen(e)?e=e.slice(0):t.add(e);for(let l=0,i=e.length;l<i;l++)s=e[l],(r=mn(s,t))!==s&&(e[l]=r)}else{Object.isFrozen(e)?e=Object.assign({},e):t.add(e);const l=Object.keys(e),i=Object.getOwnPropertyDescriptors(e);for(let o=0,c=l.length;o<c;o++)a=l[o],!i[a].get&&(s=e[a],(r=mn(s,t))!==s&&(e[a]=r))}return e}function pr(e,t){let n=e[t];return n||Object.defineProperty(e,t,{value:n=Object.create(null)}),n}function jn(e,t,n){if(e[t])return e[t];const[r,s]=T(n,{equals:!1,internal:!0});return r.$=s,e[t]=r}function tg(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||!n.configurable||t===He||t===Nt||(delete n.value,delete n.writable,n.get=()=>e[He][t]),n}function ni(e){qr()&&jn(pr(e,Nt),ad)()}function id(e){return ni(e),Reflect.ownKeys(e)}const ng={get(e,t,n){if(t===gr)return e;if(t===He)return n;if(t===Kr)return ni(e),n;const r=pr(e,Nt),s=r[t];let a=s?s():e[t];if(t===Nt||t===ut||t==="__proto__")return a;if(!s){const l=Object.getOwnPropertyDescriptor(e,t);qr()&&(typeof a!="function"||e.hasOwnProperty(t))&&!(l&&l.get)&&(a=jn(r,t,a)())}return On(a)?ld(a):a},has(e,t){return t===gr||t===He||t===Kr||t===Nt||t===ut||t==="__proto__"?!0:(qr()&&jn(pr(e,ut),t)(),t in e)},set(){return!0},deleteProperty(){return!0},ownKeys:id,getOwnPropertyDescriptor:tg};function bn(e,t,n,r=!1){if(!r&&e[t]===n)return;const s=e[t],a=e.length;n===void 0?(delete e[t],e[ut]&&e[ut][t]&&s!==void 0&&e[ut][t].$()):(e[t]=n,e[ut]&&e[ut][t]&&s===void 0&&e[ut][t].$());let l=pr(e,Nt),i;if((i=jn(l,t,s))&&i.$(()=>n),Array.isArray(e)&&e.length!==a){for(let o=e.length;o<a;o++)(i=l[o])&&i.$();(i=jn(l,"length",a))&&i.$(e.length)}(i=l[ad])&&i.$()}function od(e,t){const n=Object.keys(t);for(let r=0;r<n.length;r+=1){const s=n[r];bn(e,s,t[s])}}function rg(e,t){if(typeof t=="function"&&(t=t(e)),t=mn(t),Array.isArray(t)){if(e===t)return;let n=0,r=t.length;for(;n<r;n++){const s=t[n];e[n]!==s&&bn(e,n,s)}bn(e,"length",r)}else od(e,t)}function Ur(e,t,n=[]){let r,s=e;if(t.length>1){r=t.shift();const l=typeof r,i=Array.isArray(e);if(Array.isArray(r)){for(let o=0;o<r.length;o++)Ur(e,[r[o]].concat(t),n);return}else if(i&&l==="function"){for(let o=0;o<e.length;o++)r(e[o],o)&&Ur(e,[o].concat(t),n);return}else if(i&&l==="object"){const{from:o=0,to:c=e.length-1,by:d=1}=r;for(let h=o;h<=c;h+=d)Ur(e,[h].concat(t),n);return}else if(t.length>1){Ur(e[r],t,[r].concat(n));return}s=e[r],n=[r].concat(n)}let a=t[0];typeof a=="function"&&(a=a(s,n),a===s)||r===void 0&&a==null||(a=mn(a),r===void 0||On(s)&&On(a)&&!Array.isArray(a)?od(s,a):bn(e,r,a))}function zn(...[e,t]){const n=mn(e||{}),r=Array.isArray(n),s=ld(n);function a(...l){ir(()=>{r&&l.length===1?rg(n,l[0]):Ur(n,l)})}return[s,a]}function sg(e,t){const n=Reflect.getOwnPropertyDescriptor(e,t);return!n||n.get||n.set||!n.configurable||t===He||t===Nt||(delete n.value,delete n.writable,n.get=()=>e[He][t],n.set=r=>e[He][t]=r),n}const ag={get(e,t,n){if(t===gr)return e;if(t===He)return n;if(t===Kr)return ni(e),n;const r=pr(e,Nt),s=r[t];let a=s?s():e[t];if(t===Nt||t===ut||t==="__proto__")return a;if(!s){const l=Object.getOwnPropertyDescriptor(e,t),i=typeof a=="function";if(qr()&&(!i||e.hasOwnProperty(t))&&!(l&&l.get))a=jn(r,t,a)();else if(a!=null&&i&&a===Array.prototype[t])return(...o)=>ir(()=>Array.prototype[t].apply(n,o))}return On(a)?cd(a):a},has(e,t){return t===gr||t===He||t===Kr||t===Nt||t===ut||t==="__proto__"?!0:(qr()&&jn(pr(e,ut),t)(),t in e)},set(e,t,n){return ir(()=>bn(e,t,mn(n))),!0},deleteProperty(e,t){return ir(()=>bn(e,t,void 0,!0)),!0},ownKeys:id,getOwnPropertyDescriptor:sg};function cd(e){let t=e[He];if(!t){Object.defineProperty(e,He,{value:t=new Proxy(e,ag)});const n=Object.keys(e),r=Object.getOwnPropertyDescriptors(e),s=Object.getPrototypeOf(e),a=s!==null&&e!==null&&typeof e=="object"&&!Array.isArray(e)&&s!==Object.prototype;if(a){let l=s;for(;l!=null;){const i=Object.getOwnPropertyDescriptors(l);n.push(...Object.keys(i)),Object.assign(r,i),l=Object.getPrototypeOf(l)}}for(let l=0,i=n.length;l<i;l++){const o=n[l];if(!(a&&o==="constructor")){if(r[o].get){const c=r[o].get.bind(t);Object.defineProperty(e,o,{get:c,configurable:!0})}if(r[o].set){const c=r[o].set;Object.defineProperty(e,o,{set:h=>ir(()=>c.call(t,h)),configurable:!0})}}}}return t}function lg(e,t){const n=mn(e||{});return cd(n)}const qs=new WeakMap,dd={get(e,t){if(t===gr)return e;const n=e[t];let r;return On(n)?qs.get(n)||(qs.set(n,r=new Proxy(n,dd)),r):n},set(e,t,n){return bn(e,t,mn(n)),!0},deleteProperty(e,t){return bn(e,t,void 0,!0),!0}};function ig(e){return t=>{if(On(t)){let n;(n=qs.get(t))||qs.set(t,n=new Proxy(t,dd)),e(n)}return t}}const ud=Bn(),og=["title","meta"],io=[],oo=["name","http-equiv","content","charset","media"].concat(["property"]),co=(e,t)=>{const n=Object.fromEntries(Object.entries(e.props).filter(([r])=>t.includes(r)).sort());return(Object.hasOwn(n,"name")||Object.hasOwn(n,"property"))&&(n.name=n.name||n.property,delete n.property),e.tag+JSON.stringify(n)};function cg(){if(!se.context){const n=document.head.querySelectorAll("[data-sm]");Array.prototype.forEach.call(n,r=>r.parentNode.removeChild(r))}const e=new Map;function t(n){if(n.ref)return n.ref;let r=document.querySelector(`[data-sm="${n.id}"]`);return r?(r.tagName.toLowerCase()!==n.tag&&(r.parentNode&&r.parentNode.removeChild(r),r=document.createElement(n.tag)),r.removeAttribute("data-sm")):r=document.createElement(n.tag),r}return{addTag(n){if(og.indexOf(n.tag)!==-1){const a=n.tag==="title"?io:oo,l=co(n,a);e.has(l)||e.set(l,[]);let i=e.get(l),o=i.length;i=[...i,n],e.set(l,i);let c=t(n);n.ref=c,bl(c,n.props);let d=null;for(var r=o-1;r>=0;r--)if(i[r]!=null){d=i[r];break}return c.parentNode!=document.head&&document.head.appendChild(c),d&&d.ref&&d.ref.parentNode&&document.head.removeChild(d.ref),o}let s=t(n);return n.ref=s,bl(s,n.props),s.parentNode!=document.head&&document.head.appendChild(s),-1},removeTag(n,r){const s=n.tag==="title"?io:oo,a=co(n,s);if(n.ref){const l=e.get(a);if(l){if(n.ref.parentNode){n.ref.parentNode.removeChild(n.ref);for(let i=r-1;i>=0;i--)l[i]!=null&&document.head.appendChild(l[i].ref)}l[r]=null,e.set(a,l)}else n.ref.parentNode&&n.ref.parentNode.removeChild(n.ref)}}}}const dg=e=>{const t=cg();return u(ud.Provider,{value:t,get children(){return e.children}})},fd=(e,t,n)=>(ug({tag:e,props:t,setting:n,id:r0(),get name(){return t.name||t.property}}),null);function ug(e){const t=mt(ud);if(!t)throw new Error("<MetaProvider /> should be in the tree");z(()=>{const n=t.addTag(e);Ce(()=>t.removeTag(e,n))})}const Rt=e=>fd("title",e,{escape:!0,close:!0}),fg=e=>fd("meta",e),Ws=typeof navigator<"u"?navigator.locks:void 0,hg=e=>{if(e!=null){const t=JSON.parse(e);if(t!=null)return t}return{}},gg=({name:e})=>{const t=new AbortController,n=t.signal,r=(s,a,l=!1)=>{let i;const o=`${e}:${s}`,c=()=>i&&localStorage.setItem(o,JSON.stringify(i)),d=()=>{if(n.aborted)throw new Error("store closed");return i??=hg(localStorage.getItem(o))};{const h=g=>{g.key===o&&(i=void 0)};globalThis.addEventListener("storage",h,{signal:n})}{const h=async g=>{if(!g||n.aborted||(await new Promise(y=>setTimeout(y,1e4)),n.aborted))return;let p=Date.now(),x=!1;d();for(const y in i){const $=i[y].expiresAt;$!==null&&p>$&&(x=!0,delete i[y])}x&&c()};Ws?Ws.request(`${o}:cleanup`,{ifAvailable:!0},h):h(!0)}return{get(h){d();const g=i[h];if(!g)return;const p=g.expiresAt;if(p!==null&&Date.now()>p){delete i[h],c();return}return g.value},getWithLapsed(h){d();const g=i[h],p=Date.now();if(!g)return[void 0,1/0];const x=g.updatedAt;return x===void 0?[g.value,1/0]:[g.value,p-x]},set(h,g){d();const p={value:g,expiresAt:a(g),updatedAt:l?Date.now():void 0};i[h]=p,c()},delete(h){d(),i[h]!==void 0&&(delete i[h],c())},keys(){return d(),Object.keys(i)}}};return{dispose:()=>{t.abort()},sessions:r("sessions",({token:s})=>s.refresh?null:s.expires_at??null),states:r("states",s=>Date.now()+600*1e3),dpopNonces:r("dpopNonces",s=>Date.now()+1440*60*1e3,!0),inflightDpop:new Map}};let ri,si,yl,Bt,hd;const pg=e=>{({identityResolver:hd,fetchClientAssertion:yl}=e),{client_id:ri,redirect_uri:si}=e.metadata,Bt=gg({name:e.storageName??"atcute-oauth"})};class Dr extends Error{name="LoginError"}class mg extends Error{name="AuthorizationError"}class vt extends Error{name="ResolverError"}class Gs extends Error{sub;name="TokenRefreshError";constructor(t,n,r){super(n,r),this.sub=t}}class gd extends Error{response;data;name="OAuthResponseError";error;description;constructor(t,n){const r=uo(fo(n)?.error),s=uo(fo(n)?.error_description),a=r?`"${r}"`:"unknown",l=s?`: ${s}`:"",i=`OAuth ${a} error${l}`;super(i),this.response=t,this.data=n,this.error=r,this.description=s}get status(){return this.response.status}get headers(){return this.response.headers}}let bg=class extends Error{response;status;name="FetchResponseError";constructor(t,n,r){super(r),this.response=t,this.status=n}};const uo=e=>typeof e=="string"?e:void 0,fo=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0,xg="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let ai=(e=21)=>{let t="",n=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=xg[n[e]&63];return t};const vg=e=>e.toHex(),pd=new TextEncoder,ho=new TextDecoder,yg=crypto.subtle,li=e=>new Uint8Array(e),Un=li,md=(e,t)=>{let n=0,r=e.length,s;if(t===void 0)for(s=t=0;s<r;s++){const l=e[s];t+=l.length}const a=new Uint8Array(t);for(s=0;s<r;s++){const l=e[s];a.set(l,n),n+=l.length}return a},pa=e=>pd.encode(e),wg=(e,t,n,r)=>{let s;return n===void 0?s=e:s=e.subarray(n),pd.encodeInto(t,s).written},rt=String.fromCharCode,$g=(e,t,n)=>{if(n<4){if(n<2){if(n===0)return"";const E=e[t];return E&128?null:rt(E)}const w=e[t],v=e[t+1];if((w|v)&128)return null;if(n===2)return rt(w,v);const _=e[t+2];return _&128?null:rt(w,v,_)}const r=e[t],s=e[t+1],a=e[t+2],l=e[t+3];if((r|s|a|l)&128)return null;if(n<8){if(n===4)return rt(r,s,a,l);const w=e[t+4];if(w&128)return null;if(n===5)return rt(r,s,a,l,w);const v=e[t+5];if(v&128)return null;if(n===6)return rt(r,s,a,l,w,v);const _=e[t+6];return _&128?null:rt(r,s,a,l,w,v,_)}const i=e[t+4],o=e[t+5],c=e[t+6],d=e[t+7];if((i|o|c|d)&128)return null;if(n<12){if(n===8)return rt(r,s,a,l,i,o,c,d);const w=e[t+8];if(w&128)return null;if(n===9)return rt(r,s,a,l,i,o,c,d,w);const v=e[t+9];if(v&128)return null;if(n===10)return rt(r,s,a,l,i,o,c,d,w,v);const _=e[t+10];return _&128?null:rt(r,s,a,l,i,o,c,d,w,v,_)}const h=e[t+8],g=e[t+9],p=e[t+10],x=e[t+11];if((h|g|p|x)&128)return null;if(n===12)return rt(r,s,a,l,i,o,c,d,h,g,p,x);const y=e[t+12];if(y&128)return null;if(n===13)return rt(r,s,a,l,i,o,c,d,h,g,p,x,y);const b=e[t+13];if(b&128)return null;if(n===14)return rt(r,s,a,l,i,o,c,d,h,g,p,x,y,b);const $=e[t+14];return $&128?null:rt(r,s,a,l,i,o,c,d,h,g,p,x,y,b,$)},ii=(e,t=0,n=e.length)=>{if(n<=15){const r=$g(e,t,n);if(r!==null)return r}return t===0&&n===e.length?ho.decode(e):ho.decode(e.subarray(t,t+n))},xs=e=>{const t=e.length;let n=0,r=0;for(;n+3<t;){const s=e.charCodeAt(n),a=e.charCodeAt(n+1),l=e.charCodeAt(n+2),i=e.charCodeAt(n+3);if((s|a|l|i)>=128)break;n+=4,r+=4}for(;n<t;){const s=e.charCodeAt(n);s<128?(n+=1,r+=1):s<2048?(n+=1,r+=2):s<55296||s>56319?(n+=1,r+=3):(n+=2,r+=4)}return r},nr=(e,t,n)=>{const r=e.length;if(r*3<t)return!1;if(r>=t&&r*3<=n)return!0;let s=0,a=0;for(;s<r;){const l=e.charCodeAt(s);if(l<128?(s+=1,a+=1):l<2048?(s+=1,a+=2):l<55296||l>56319?(s+=1,a+=3):(s+=2,a+=4),a>n)return!1}return a>=t},ma=async e=>new Uint8Array(await yg.digest("SHA-256",e)),oi=(e,t,n)=>r=>{const s=(1<<t)-1;let a="",l=0,i=0;for(let o=0;o<r.length;++o)for(i=i<<8|r[o],l+=8;l>t;)l-=t,a+=e[s&i>>l];if(l!==0&&(a+=e[s&i<<t-l]),n)for(;(a.length*t&7)!==0;)a+="=";return a},bd=(e,t,n)=>{const r={};for(let s=0;s<e.length;++s)r[e[s]]=s;return s=>{let a=s.length;for(;n&&s[a-1]==="=";)--a;const l=Un(a*t/8|0);let i=0,o=0,c=0;for(let d=0;d<a;++d){const h=r[s[d]];if(h===void 0)throw new SyntaxError("invalid base string");o=o<<t|h,i+=t,i>=8&&(i-=8,l[c++]=255&o>>i)}if(i>=t||(255&o<<8-i)!==0)throw new SyntaxError("unexpected end of data");return l}},kg=e=>{if(e.length>=255)throw new RangeError("alphabet too long");const t=e.length,n=e.charAt(0),r=Math.log(256)/Math.log(t);return s=>{if(s.length===0)return"";let a=0,l=0,i=0;const o=s.length;for(;i!==o&&s[i]===0;)i++,a++;const c=o-i,d=c*r+1>>>0,h=li(d);{const x=c%3,y=o-x;for(;i<y;){let b=s[i]<<16|s[i+1]<<8|s[i+2],$=0;for(let w=d-1;(b!==0||$<l)&&w!==-1;w--,$++)b=b+16777216*h[w],h[w]=b%t|0,b=b/t|0;l=$,i+=3}}for(;i!==o;){let x=s[i],y=0;for(let b=d-1;(x!==0||y<l)&&b!==-1;b--,y++)x=x+256*h[b],h[b]=x%t|0,x=x/t|0;l=y,i++}let g=d-l;for(;g!==d&&h[g]===0;)g++;let p=n.repeat(a);for(;g<d;++g)p+=e.charAt(h[g]);return p}},_g=e=>{if(e.length>=255)throw new RangeError("alphabet too long");const t=new Uint8Array(128).fill(255);for(let l=0;l<e.length;l++){const i=e.charCodeAt(l);if(i>=128)throw new RangeError("non-ASCII character in alphabet");if(t[i]!==255)throw new RangeError(`${e[l]} is ambiguous`);t[i]=l}const n=e.length,r=n*n,s=e.charAt(0),a=Math.log(n)/Math.log(256);return l=>{if(l.length===0)return Un(0);let i=0,o=0,c=0;for(;l[i]===s;)o++,i++;const d=l.length-i,h=d*a+1>>>0,g=li(h);{const y=d&1,b=l.length-y;for(;i<b;){const $=t[l.charCodeAt(i)],w=t[l.charCodeAt(i+1)];if($===255||w===255)throw new Error("invalid string");let v=$*n+w,_=0;for(let E=h-1;(v!==0||_<c)&&E!==-1;E--,_++)v+=r*g[E],g[E]=v&255,v=(v-(v&255))/256;if(v!==0)throw new Error("non-zero carry");c=_,i+=2}}if(i<l.length){let y=t[l.charCodeAt(i)];if(y===255)throw new Error("invalid string");let b=0;for(let $=h-1;(y!==0||b<c)&&$!==-1;$--,b++)y+=n*g[$],g[$]=y&255,y=y>>>8;if(y!==0)throw new Error("non-zero carry");c=b}let p=h-c;for(;p!==h&&g[p]===0;)p++;if(p===o)return g;const x=Un(o+(h-p));return x.fill(0,0,o),x.set(g.subarray(p),o),x}},Sg="0123456789abcdef",Eg=oi(Sg,4,!1),Cg="fromHex"in Uint8Array,xd=Cg?vg:Eg,Ag=e=>Uint8Array.fromBase64(e,{alphabet:"base64",lastChunkHandling:"loose"}),Rg=e=>e.toBase64({alphabet:"base64",omitPadding:!0}),Tg=e=>Uint8Array.fromBase64(e,{alphabet:"base64url",lastChunkHandling:"loose"}),Lg=e=>e.toBase64({alphabet:"base64url",omitPadding:!0}),vd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",yd="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",Pg=bd(vd,6,!1),Ig=oi(vd,6,!1),Dg=bd(yd,6,!1),Og=oi(yd,6,!1),ba="fromBase64"in Uint8Array,jg=ba?Ag:Pg,Ug=ba?Rg:Ig,Ng=ba?Tg:Dg,Zr=ba?Lg:Og,Mg="abcdefghijklmnopqrstuvwxyz234567",Bg=(()=>{const e=new Uint8Array(32);for(let t=0;t<32;t++)e[t]=Mg.charCodeAt(t);return e})(),vs=String.fromCharCode,wd=e=>{const t=e.length,n=t/5|0,r=t-n*5,s=Bg;let a="",l=0;const i=n/2|0;for(let o=0;o<i;o++){const c=e[l],d=e[l+1],h=e[l+2],g=e[l+3],p=e[l+4],x=e[l+5],y=e[l+6],b=e[l+7],$=e[l+8],w=e[l+9];a+=vs(s[c>>>3],s[(c<<2|d>>>6)&31],s[d>>>1&31],s[(d<<4|h>>>4)&31],s[(h<<1|g>>>7)&31],s[g>>>2&31],s[(g<<3|p>>>5)&31],s[p&31],s[x>>>3],s[(x<<2|y>>>6)&31],s[y>>>1&31],s[(y<<4|b>>>4)&31],s[(b<<1|$>>>7)&31],s[$>>>2&31],s[($<<3|w>>>5)&31],s[w&31]),l+=10}if(n&1){const o=e[l],c=e[l+1],d=e[l+2],h=e[l+3],g=e[l+4];a+=vs(s[o>>>3],s[(o<<2|c>>>6)&31],s[c>>>1&31],s[(c<<4|d>>>4)&31],s[(d<<1|h>>>7)&31],s[h>>>2&31],s[(h<<3|g>>>5)&31],s[g&31]),l+=5}if(r>0){let o=0,c=0;for(let d=l;d<t;d++)o=o<<8|e[d],c+=8;for(;c>=5;)c-=5,a+=vs(s[o>>>c&31]);c>0&&(a+=vs(s[o<<5-c&31]))}return a},Fg="abcdefghijklmnopqrstuvwxyz234567",Zt=(()=>{const e=new Uint8Array(128).fill(255);for(let t=0;t<32;t++)e[Fg.charCodeAt(t)]=t;return e})(),zg=e=>{const t=e.length,n=Un(t*5/8|0);let r=0,s=0;const a=t-t%8;for(;s<a;s+=8){const l=Zt[e.charCodeAt(s)],i=Zt[e.charCodeAt(s+1)],o=Zt[e.charCodeAt(s+2)],c=Zt[e.charCodeAt(s+3)],d=Zt[e.charCodeAt(s+4)],h=Zt[e.charCodeAt(s+5)],g=Zt[e.charCodeAt(s+6)],p=Zt[e.charCodeAt(s+7)];if((l|i|o|c|d|h|g|p)&224)throw new SyntaxError("invalid base string");n[r]=l<<3|i>>>2,n[r+1]=(i<<6|o<<1|c>>>4)&255,n[r+2]=(c<<4|d>>>1)&255,n[r+3]=(d<<7|h<<2|g>>>3)&255,n[r+4]=(g<<5|p)&255,r+=5}if(s<t){let l=0,i=0;for(;s<t;++s){const o=Zt[e.charCodeAt(s)];if(o&224)throw new SyntaxError("invalid base string");i=i<<5|o,l+=5,l>=8&&(l-=8,n[r++]=255&i>>l)}if(l>=5||(255&i<<8-l)!==0)throw new SyntaxError("unexpected end of data")}return n},$d="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",kd=_g($d),Vg=kg($d),Kg={ES256:"SHA-256",ES384:"SHA-384",ES512:"SHA-512",PS256:"SHA-256",PS384:"SHA-384",PS512:"SHA-512",RS256:"SHA-256",RS384:"SHA-384",RS512:"SHA-512"},Hg={ES256:"P-256",ES384:"P-384",ES512:"P-521",PS256:null,PS384:null,PS512:null,RS256:null,RS384:null,RS512:null},dr=e=>Kg[e],_d=e=>Hg[e],qg=e=>e.startsWith("ES")?{name:"ECDSA",hash:{name:dr(e)}}:e.startsWith("PS")?{name:"RSA-PSS",hash:{name:dr(e)},saltLength:Zg(dr(e))}:{name:"RSASSA-PKCS1-v1_5"},Wg=(e,t)=>{if(e.startsWith("ES")){const n=t??_d(e);if(!n)throw new Error(`unable to determine curve for ${e}`);return{name:"ECDSA",namedCurve:n}}return e.startsWith("PS")?{name:"RSA-PSS",hash:{name:dr(e)}}:{name:"RSASSA-PKCS1-v1_5",hash:{name:dr(e)}}},Gg=e=>{const t=_d(e);if(t)return{name:"ECDSA",namedCurve:t};const n={name:dr(e)};return{name:e.startsWith("PS")?"RSA-PSS":"RSASSA-PKCS1-v1_5",hash:n,modulusLength:2048,publicExponent:new Uint8Array([1,0,1])}},Zg=e=>{switch(e){case"SHA-256":return 32;case"SHA-384":return 48;case"SHA-512":return 64}},Xg=["ES256","ES384","ES512","PS256","PS384","PS512","RS256","RS384","RS512"],Jg=e=>Xg.includes(e),Sd=(e,t,n)=>{if(e.kty==="EC"){const{crv:r,x:s,y:a}=e;return{kty:"EC",crv:r,x:s,y:a,kid:t,alg:n,use:"sig"}}if(e.kty==="RSA"){const{n:r,e:s}=e;return{kty:"RSA",n:r,e:s,kid:t,alg:n,use:"sig"}}throw new Error("unsupported key type")},Yg=async(e,t)=>{if(!("d"in e)||!e.d)throw new Error("expected a private key (missing 'd' parameter)");if(e.kty==="EC"&&!t.startsWith("ES"))throw new Error(`algorithm ${t} does not match ec key`);if(e.kty==="RSA"&&t.startsWith("ES"))throw new Error(`algorithm ${t} does not match rsa key`);const n=Wg(t,e.kty==="EC"?e.crv:void 0),r=await crypto.subtle.importKey("jwk",e,n,!0,["sign"]);if(!(r instanceof CryptoKey))throw new Error("expected asymmetric key, got symmetric");return r},Qg=async(e,t,n)=>{const r=await crypto.subtle.exportKey("jwk",e);return r.alg=t,r},wl=new WeakMap,ep=async e=>{const t=wl.get(e);if(t)return t;const{alg:n}=e,r=await Yg(e,n),s=Sd(e,e.kid,n),a={cryptoKey:r,publicJwk:s};return wl.set(e,a),a},tp=(e,t)=>{const n=Sd(e,e.kid,e.alg);wl.set(e,{cryptoKey:t,publicJwk:n})},np=async e=>{const{header:t,payload:n,key:r,alg:s}=e,a={...t,alg:s},l=go(a),i=go(n),o=`${l}.${i}`,c=await crypto.subtle.sign(qg(s),r,pa(o)),d=Zr(new Uint8Array(c));return`${o}.${d}`},go=e=>Zr(pa(JSON.stringify(e))),Ed=async e=>{const t=pa(e),n=await ma(t);return Zr(n)},Cd=e=>{const t=e.alg;let n;return async(r,s,a,l)=>{n||=ep(e);const{cryptoKey:i,publicJwk:o}=await n,c=Math.floor(Date.now()/1e3);return np({header:{typ:"dpop+jwt",jwk:o},payload:{htm:r,htu:s,iat:c,jti:ai(24),nonce:a,ath:l},key:i,alg:t})}},po=["ES256","ES384","ES512","PS256","PS384","PS512","RS256","RS384","RS512"],rp=e=>[...e].sort((t,n)=>{const r=po.indexOf(t),s=po.indexOf(n);return r===-1&&s===-1?0:r===-1?1:s===-1?-1:r-s}),sp=async e=>{const t=e?.filter(Jg)??[];if(e?.length&&t.length===0)throw new Error("no supported algorithms provided");const n=t.length?rp(t):["ES256"],r=[];for(const s of n)try{const a=await crypto.subtle.generateKey(Gg(s),!0,["sign","verify"]),l=await Qg(a.privateKey,s);return tp(l,a.privateKey),l}catch(a){r.push(a)}throw new AggregateError(r,`failed to generate DPoP key for any of: ${n.join(", ")}`)};function ln(e){return{ok:!1,code:"invalid_type",expected:e}}const Ad=ln([]),Rd=ln(["string"]),Td=ln(["number"]),ap=ln(["bigint"]),Ld=ln(["boolean"]),Pd=ln(["undefined"]),Id=ln(["null"]),lp=ln(["object"]),ip=ln(["array"]),ci={ok:!1,code:"missing_value"};function rr(e,t){return e?{ok:!1,code:"join",left:e,right:t}:t}function ur(e,t){return{ok:!1,code:"prepend",key:e,tree:t}}function op(e,t){var n;const r=e.code;switch(r){case"invalid_type":return{code:r,path:t,expected:e.expected};case"invalid_literal":return{code:r,path:t,expected:e.expected};case"missing_value":return{code:r,path:t};case"invalid_length":return{code:r,path:t,minLength:e.minLength,maxLength:e.maxLength};case"unrecognized_keys":return{code:r,path:t,keys:e.keys};case"invalid_union":return{code:r,path:t,tree:e.tree,issues:xa(e.tree)};case"custom_error":return typeof e.error=="object"&&e.error.path!==void 0&&t.push(...e.error.path),{code:r,path:t,message:typeof e.error=="string"?e.error:(n=e.error)===null||n===void 0?void 0:n.message,error:e.error}}}function xa(e,t=[],n=[]){for(;;)if(e.code==="join")xa(e.left,t.slice(),n),e=e.right;else if(e.code==="prepend")t.push(e.key),e=e.tree;else return n.push(op(e,t)),n}function Za(e,t){return e.length===0?"nothing":e.length===1?e[0]:`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`}function mo(e){return typeof e=="bigint"?`${e}n`:JSON.stringify(e)}function Dd(e){let t=0;for(;;)if(e.code==="join")t+=Dd(e.left),e=e.right;else if(e.code==="prepend")e=e.tree;else return t+1}function Od(e){let t="",n=0;for(;;)if(e.code==="join")n+=Dd(e.right),e=e.left;else if(e.code==="prepend")t+=`.${e.key}`,e=e.tree;else break;let r="validation failed";if(e.code==="invalid_type")r=`expected ${Za(e.expected,"or")}`;else if(e.code==="invalid_literal")r=`expected ${Za(e.expected.map(mo),"or")}`;else if(e.code==="missing_value")r="missing value";else if(e.code==="unrecognized_keys"){const a=e.keys;r=`unrecognized ${a.length===1?"key":"keys"} ${Za(a.map(mo),"and")}`}else if(e.code==="invalid_length"){const a=e.minLength,l=e.maxLength;r="expected an array with ",a>0?l===a?r+=`${a}`:l!==void 0?r+=`between ${a} and ${l}`:r+=`at least ${a}`:r+=`at most ${l??"∞"}`,r+=" item(s)"}else if(e.code==="custom_error"){const a=e.error;typeof a=="string"?r=a:a!==void 0&&(a.message!==void 0&&(r=a.message),a.path!==void 0&&(t+="."+a.path.join(".")))}let s=`${e.code} at .${t.slice(1)} (${r})`;return n===1?s+=" (+ 1 other issue)":n>1&&(s+=` (+ ${n} other issues)`),s}function kt(e,t,n,r){return Object.defineProperty(e,t,{value:n,enumerable:r,writable:!1}),n}class jd extends Error{constructor(t){super(Od(t)),Object.setPrototypeOf(this,new.target.prototype),this.name=new.target.name,this._issueTree=t}get issues(){return kt(this,"issues",xa(this._issueTree),!0)}}let Ud=class{constructor(t){this.ok=!1,this._issueTree=t}get issues(){return kt(this,"issues",xa(this._issueTree),!0)}get message(){return kt(this,"message",Od(this._issueTree),!0)}throw(){throw new jd(this._issueTree)}};function tn(e){return{ok:!0,value:e}}function un(e){return new Ud({ok:!1,code:"custom_error",error:e})}function Nd(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}const An=1,Xr=2,va=4,Md=0,cp=1,Bd=2,Fd=3,dp=4,zd=5,Vd=6,Kd=7,Hd=8,qd=9,Wd=10,Gd=11,Zd=12,Xd=13,Jd=14,up=15,Ft=(e,t)=>({tag:e,match:t});function at(e,t,n){switch(e.tag){case Md:return;case cp:return Ad;case Bd:return typeof t=="string"?void 0:Rd;case Fd:return typeof t=="number"?void 0:Td;case dp:return typeof t=="bigint"?void 0:ap;case zd:return typeof t=="boolean"?void 0:Ld;case Vd:return t===null?void 0:Id;case Kd:return t===void 0?void 0:Pd;case Hd:return e.match(t,n);case qd:return e.match(t,n);case Wd:return e.match(t,n);case Gd:return e.match(t,n);case Zd:return e.match(t,n);case Xd:return e.match(t,n);case Jd:return e.match(t,n);default:return e.match(t,n)}}const be=Symbol.for("@valita/internal");class Yd{default(t){const n=tn(t);return new Ot(this.optional(),r=>r===void 0?n:void 0)}assert(t,n){const r={ok:!1,code:"custom_error",error:n};return new Ot(this,(s,a)=>t(s,Xa(a))?void 0:r)}map(t){return new Ot(this,(n,r)=>({ok:!0,value:t(n,Xa(r))}))}chain(t){return typeof t=="function"?new Ot(this,(n,r)=>{const s=t(n,Xa(r));return s.ok?s:s._issueTree}):new Ot(this,(n,r)=>at(t[be],n,r))}}class vn extends Yd{optional(t){const n=new hp(this);return t?new Ot(n,r=>r===void 0?{ok:!0,value:t()}:void 0):n}nullable(t){const n=new fp([nu(),this]);return t?new Ot(n,r=>r===null?{ok:!0,value:t()}:void 0):n}_toTerminals(t){t(this)}try(t,n){const r=at(this[be],t,n===void 0?An:n.mode==="strip"?Xr:n.mode==="passthrough"?0:An);return r===void 0||r.ok?{ok:!0,value:r===void 0?t:r.value}:new Ud(r)}parse(t,n){const r=at(this[be],t,n===void 0?An:n.mode==="strip"?Xr:n.mode==="passthrough"?0:An);if(r===void 0||r.ok)return r===void 0?t:r.value;throw new jd(r)}}class fp extends vn{constructor(t){super(),this.name="union",this.options=t}get[be](){const t=this.options.map(n=>n[be]);return kt(this,be,Ft(Xd,(n,r)=>{let s=Ad;for(const a of t){const l=at(a,n,r);if(l===void 0||l.ok)return l;s=l}return s}),!1)}_toTerminals(t){for(const n of this.options)n._toTerminals(t)}}class hp extends Yd{constructor(t){super(),this.name="optional",this.type=t}optional(t){return t?new Ot(this,n=>n===void 0?{ok:!0,value:t()}:void 0):this}get[be](){const t=this.type[be];return kt(this,be,Ft(qd,(n,r)=>n===void 0||r&va?void 0:at(t,n,r)),!1)}_toTerminals(t){t(this),t(ui()),this.type._toTerminals(t)}}function Qd(e,t){if(typeof e!="number"){const n=t>>5;for(let r=e.length;r<=n;r++)e.push(0);return e[n]|=1<<t%32,e}else return t<32?e|1<<t:Qd([e,0],t)}function Or(e,t){return typeof e=="number"?t<32?e>>>t&1:0:e[t>>5]>>>t%32&1}class Jt extends vn{constructor(t,n,r){super(),this.name="object",this.shape=t,this._restType=n,this._checks=r}get[be](){const t=gp(this.shape,this._restType,this._checks);return kt(this,be,Ft(Wd,(n,r)=>Nd(n)?t(n,r):lp),!1)}check(t,n){var r;const s={ok:!1,code:"custom_error",error:n};return new Jt(this.shape,this._restType,[...(r=this._checks)!==null&&r!==void 0?r:[],{func:t,issue:s}])}rest(t){return new Jt(this.shape,t)}extend(t){return new Jt(Object.assign(Object.assign({},this.shape),t),this._restType)}pick(...t){const n={};for(const r of t)dt(n,r,this.shape[r]);return new Jt(n,void 0)}omit(...t){const n=Object.assign({},this.shape);for(const r of t)delete n[r];return new Jt(n,this._restType)}partial(){var t;const n={};for(const s of Object.keys(this.shape))dt(n,s,this.shape[s].optional());const r=(t=this._restType)===null||t===void 0?void 0:t.optional();return new Jt(n,r)}}function dt(e,t,n){t==="__proto__"?Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0}):e[t]=n}function gp(e,t,n){const r=Object.keys(e).map((i,o)=>{const c=e[i];let d=!1;return c._toTerminals(h=>{d||(d=h.name==="optional")}),{key:i,index:o,matcher:c[be],optional:d,missing:ur(i,ci)}}),s=Object.create(null);for(const i of r)s[i.key]=i;const a=t?.[be],l=r.length===0&&t?.name==="unknown"&&n===void 0;return(i,o)=>{if(l)return;let c,d,h,g=0,p=0;if(o&(An|Xr)||a!==void 0)for(const x in i){const y=i[x],b=s[x];if(b===void 0&&a===void 0){if(o&An)h===void 0?(h=[x],d=rr(d,{ok:!1,code:"unrecognized_keys",keys:h})):h.push(x);else if(o&Xr&&d===void 0&&c===void 0){c={};for(let w=0;w<r.length;w++)if(Or(g,w)){const v=r[w].key;dt(c,v,i[v])}}continue}const $=at(b===void 0?a:b.matcher,y,o);if($===void 0)c!==void 0&&d===void 0&&dt(c,x,y);else if(!$.ok)d=rr(d,ur(x,$));else if(d===void 0){if(c===void 0)if(c={},a===void 0){for(let w=0;w<r.length;w++)if(Or(g,w)){const v=r[w].key;dt(c,v,i[v])}}else for(const w in i)dt(c,w,i[w]);dt(c,x,$.value)}b!==void 0&&(p++,g=Qd(g,b.index))}if(p<r.length)for(let x=0;x<r.length;x++){if(Or(g,x))continue;const y=r[x],b=i[y.key];let $=0;if(b===void 0&&!(y.key in i)){if(!y.optional){d=rr(d,y.missing);continue}$=va}const w=at(y.matcher,b,o|$);if(w===void 0)c!==void 0&&d===void 0&&!$&&dt(c,y.key,b);else if(!w.ok)d=rr(d,ur(y.key,w));else if(d===void 0){if(c===void 0)if(c={},a===void 0){for(let v=0;v<r.length;v++)if(v<x||Or(g,v)){const _=r[v].key;dt(c,_,i[_])}}else{for(const v in i)dt(c,v,i[v]);for(let v=0;v<x;v++)if(!Or(g,v)){const _=r[v].key;dt(c,_,i[_])}}dt(c,y.key,w.value)}}if(d!==void 0)return d;if(n!==void 0){for(const{func:x,issue:y}of n)if(!x(c??i))return y}return c&&{ok:!0,value:c}}}class fr extends vn{constructor(t,n,r){super(),this.name="array",this._prefix=t,this._rest=n,this._suffix=r}get[be](){var t,n;const r=this._prefix.map(c=>c[be]),s=this._suffix.map(c=>c[be]),a=(n=(t=this._rest)===null||t===void 0?void 0:t[be])!==null&&n!==void 0?n:Ft(1,()=>ci),l=r.length+s.length,i=this._rest?1/0:l,o={ok:!1,code:"invalid_length",minLength:l,maxLength:i===1/0?void 0:i};return kt(this,be,Ft(Gd,(c,d)=>{if(!Array.isArray(c))return ip;const h=c.length;if(h<l||h>i)return o;const g=r.length,p=c.length-s.length;let x,y=c;for(let b=0;b<c.length;b++){const $=b<g?r[b]:b>=p?s[b-p]:a,w=at($,c[b],d);w!==void 0&&(w.ok?(y===c&&(y=c.slice()),y[b]=w.value):x=rr(x,ur(b,w)))}return x||(c===y?void 0:{ok:!0,value:y})}),!1)}concat(t){if(this._rest){if(t._rest)throw new TypeError("can not concatenate two variadic types");return new fr(this._prefix,this._rest,[...this._suffix,...t._prefix,...t._suffix])}else return t._rest?new fr([...this._prefix,...this._suffix,...t._prefix],t._rest,t._suffix):new fr([...this._prefix,...this._suffix,...t._prefix,...t._suffix],t._rest,t._suffix)}}function Zs(e){const t=typeof e;return t!=="object"?t:e===null?"null":Array.isArray(e)?"array":t}function jr(e){return[...new Set(e)]}function eu(e){var t,n,r;const s=new Map,a=new Map,l=new Map,i=[],o=[],c=[];for(const{root:h,terminal:g}of e)if(s.set(h,(t=s.get(h))!==null&&t!==void 0?t:s.size),g.name!=="never")if(g.name==="optional")o.push(h);else if(g.name==="unknown")i.push(h);else if(g.name==="literal"){const p=(n=a.get(g.value))!==null&&n!==void 0?n:[];p.push(h),a.set(g.value,p),c.push(Zs(g.value))}else{const p=(r=l.get(g.name))!==null&&r!==void 0?r:[];p.push(h),l.set(g.name,p),c.push(g.name)}const d=(h,g)=>{var p,x;return((p=s.get(h))!==null&&p!==void 0?p:0)-((x=s.get(g))!==null&&x!==void 0?x:0)};for(const[h,g]of a){const p=l.get(Zs(h));p?(p.push(...g),a.delete(h)):a.set(h,jr(g.concat(i)).sort(d))}for(const[h,g]of l)l.set(h,jr(g.concat(i)).sort(d));return{types:l,literals:a,unknowns:jr(i).sort(d),optionals:jr(o).sort(d),expectedTypes:jr(c)}}function pp(e,t){var n;const r=[];for(const{root:x,terminal:y}of e)y.shape[t]._toTerminals(b=>r.push({root:x,terminal:b}));const{types:s,literals:a,optionals:l,unknowns:i,expectedTypes:o}=eu(r);if(i.length>0||l.length>1)return;for(const x of a.values())if(x.length>1)return;for(const x of s.values())if(x.length>1)return;const c=ur(t,ci),d=ur(t,s.size===0?{ok:!1,code:"invalid_literal",expected:[...a.keys()]}:{ok:!1,code:"invalid_type",expected:o}),h=a.size>0?new Map:void 0;if(h)for(const[x,y]of a)h.set(x,y[0][be]);const g=s.size>0?{}:void 0;if(g)for(const[x,y]of s)g[x]=y[0][be];const p=(n=l[0])===null||n===void 0?void 0:n[be];return(x,y)=>{var b;const $=x[t];if($===void 0&&!(t in x))return p===void 0?c:at(p,x,y);const w=(b=g?.[Zs($)])!==null&&b!==void 0?b:h?.get($);return w?at(w,x,y):d}}function mp(e){var t;const n=[],r=new Map;for(const{root:s,terminal:a}of e){if(a.name==="unknown")return;if(a.name==="object"){for(const l in a.shape)r.set(l,((t=r.get(l))!==null&&t!==void 0?t:0)+1);n.push({root:s,terminal:a})}}if(!(n.length<2)){for(const[s,a]of r)if(a===n.length){const l=pp(n,s);if(l)return l}}}function bp(e){const{expectedTypes:t,literals:n,types:r,unknowns:s,optionals:a}=eu(e),l=r.size===0&&s.length===0?{ok:!1,code:"invalid_literal",expected:[...n.keys()]}:{ok:!1,code:"invalid_type",expected:t},i=n.size>0?new Map:void 0;if(i)for(const[h,g]of n)i.set(h,g.map(p=>p[be]));const o=r.size>0?{}:void 0;if(o)for(const[h,g]of r)o[h]=g.map(p=>p[be]);const c=a.map(h=>h[be]),d=s.map(h=>h[be]);return(h,g)=>{var p,x;const y=g&va?c:(x=(p=o?.[Zs(h)])!==null&&p!==void 0?p:i?.get(h))!==null&&x!==void 0?x:d;let b=0,$=l;for(let w=0;w<y.length;w++){const v=at(y[w],h,g);if(v===void 0||v.ok)return v;$=b>0?rr($,v):v,b++}return b>1?{ok:!1,code:"invalid_union",tree:$}:$}}class xp extends vn{constructor(t){super(),this.name="union",this.options=t}_toTerminals(t){for(const n of this.options)n._toTerminals(t)}get[be](){const t=[];for(const s of this.options)s._toTerminals(a=>{t.push({root:s,terminal:a})});const n=bp(t),r=mp(t);return kt(this,be,Ft(Zd,(s,a)=>r!==void 0&&Nd(s)?r(s,a):n(s,a)),!1)}}const vp=Object.freeze({mode:"strict"}),yp=Object.freeze({mode:"strip"}),wp=Object.freeze({mode:"passthrough"});function Xa(e){return e&An?vp:e&Xr?yp:wp}class Ot extends vn{constructor(t,n){super(),this.name="transform",this._transformed=t,this._transform=n}get[be](){const t=[];let n=this;for(;n instanceof Ot;)t.push(n._transform),n=n._transformed;t.reverse();const r=n[be],s=tn(void 0);return kt(this,be,Ft(Jd,(a,l)=>{let i=at(r,a,l);if(i!==void 0&&!i.ok)return i;let o;i!==void 0?o=i.value:l&va?(o=void 0,i=s):o=a;for(let c=0;c<t.length;c++){const d=t[c](o,l);if(d!==void 0){if(!d.ok)return d;o=d.value,i=d}}return i}),!1)}_toTerminals(t){this._transformed._toTerminals(t)}}class $p extends vn{constructor(t){super(),this.name="lazy",this._recursing=!1,this._definer=t}get type(){return kt(this,"type",this._definer(),!0)}get[be](){const t=Ft(up,(n,r)=>{const s=this.type[be];return t.tag=s.tag,t.match=s.match,kt(this,be,s,!1),at(s,n,r)});return t}_toTerminals(t){if(!this._recursing){this._recursing=!0;try{this.type._toTerminals(t)}finally{this._recursing=!1}}}}function Ar(e,t,n){const r=Ft(t,n);class s extends vn{constructor(){super(),this.name=e,this[be]=r}}const a=new s;return()=>a}const tu=Ar("unknown",Md,()=>{}),J=Ar("string",Bd,e=>typeof e=="string"?void 0:Rd),di=Ar("number",Fd,e=>typeof e=="number"?void 0:Td),yt=Ar("boolean",zd,e=>typeof e=="boolean"?void 0:Ld),nu=Ar("null",Vd,e=>e===null?void 0:Id),ui=Ar("undefined",Kd,e=>e===void 0?void 0:Pd);class kp extends vn{constructor(t){super(),this.name="literal";const n={ok:!1,code:"invalid_literal",expected:[t]};this[be]=Ft(Hd,r=>r===t?void 0:n),this.value=t}}const fe=e=>new kp(e),pe=e=>new Jt(e,void 0),rn=e=>new Jt({},e??tu()),_e=e=>new fr([],e??tu(),[]),fi=e=>new fr(e,void 0,[]),Le=(...e)=>new xp(e),ru=e=>new $p(e),_p=async(e=64)=>{const t=ai(e),n=await Ed(t);return{verifier:t,challenge:n,method:"S256"}},ya=e=>e.get("content-type")?.split(";")[0],Sp="parse"in URL,Ep=e=>{let t=null;if(Sp)t=URL.parse(e);else try{t=new URL(e)}catch{}return t!==null?t.protocol==="https:"||t.protocol==="http:":!1},su=async e=>{const t=await hd.resolve(e);return{identity:t,metadata:await lu(t.pds)}},Cp=async e=>{try{return{metadata:await lu(e)}}catch(t){if(t instanceof vt)try{return{metadata:await au(e)}}catch{}throw t}},Ap=async e=>{const t=new URL("/.well-known/oauth-protected-resource",e),n=await fetch(t.href,{redirect:"manual",headers:{accept:"application/json"}});if(n.status!==200||ya(n.headers)!=="application/json")throw new vt("unexpected response");const r=await n.json();if(r.resource!==t.origin)throw new vt("unexpected issuer");return r},au=async e=>{const t=new URL("/.well-known/oauth-authorization-server",e),n=await fetch(t.href,{redirect:"manual",headers:{accept:"application/json"}});if(n.status!==200||ya(n.headers)!=="application/json")throw new vt("unexpected response");const r=await n.json();if(r.issuer!==t.origin)throw new vt("unexpected issuer");if(!Ep(r.authorization_endpoint))throw new vt("authorization server provided incorrect authorization endpoint");if(!r.client_id_metadata_document_supported)throw new vt("authorization server does not support 'client_id_metadata_document'");if(!r.pushed_authorization_request_endpoint)throw new vt("authorization server does not support 'pushed_authorization request'");if(r.response_types_supported&&!r.response_types_supported.includes("code"))throw new vt("authorization server does not support 'code' response type");return r},lu=async e=>{const t=await Ap(e);if(t.authorization_servers?.length!==1)throw new vt("expected exactly one authorization server in the listing");const n=t.authorization_servers[0],r=await au(n);if(r.protected_resources&&!r.protected_resources.includes(t.resource))throw new vt("server is not in authorization server's jurisdiction");return r},iu=(e,t)=>{const n=Bt.dpopNonces,r=Bt.inflightDpop,s=Cd(e);return async(a,l)=>{const i=new Request(a,l),o=i.headers.get("authorization"),c=o?.startsWith("DPoP ")?await Ed(o.slice(5)):void 0,{method:d,url:h}=i,{origin:g,pathname:p}=new URL(h),x=g+p;let y=r.get(g);y&&(await y.promise,y=void 0);let b,$=!1;try{const[v,_]=n.getWithLapsed(g);b=v,$=_>180*1e3}catch{}$&&r.set(g,y=Promise.withResolvers());let w;try{const v=await s(d,x,b,c);i.headers.set("dpop",v);const _=await fetch(i);if(w=_.headers.get("dpop-nonce"),w===null||w===b)return _;try{n.set(g,w)}catch{}if(!await Rp(_,t)||a===i||l?.body instanceof ReadableStream)return _}finally{y&&(r.delete(g),y.resolve())}{const v=await s(d,x,w,c),_=new Request(a,l);_.headers.set("dpop",v);const E=await fetch(_),S=E.headers.get("dpop-nonce");if(S!==null&&S!==w)try{n.set(g,S)}catch{}return E}}},Rp=async(e,t)=>{if((t===void 0||t===!1)&&e.status===401){const n=e.headers.get("www-authenticate");if(n?.startsWith("DPoP"))return n.includes('error="use_dpop_nonce"')}if((t===void 0||t===!0)&&e.status===400&&ya(e.headers)==="application/json")try{const n=await e.clone().json();return typeof n=="object"&&n?.error==="use_dpop_nonce"}catch{return!1}return!1},Tp=(e,t)=>{const n={};for(let r=0,s=t.length;r<s;r++){const a=t[r];n[a]=e[a]}return n};class is{#e;#t;#n;constructor(t,n){this.#t=t,this.#n=n,this.#e=iu(n,!0)}async request(t,n){const r=this.#t[`${t}_endpoint`];if(!r)throw new Error(`no endpoint for ${t}`);if((t==="token"||t==="pushed_authorization_request")&&yl!==void 0){const l=Cd(this.#n),i=await yl({aud:this.#t.issuer,createDpopProof:async(o,c)=>await l("POST",o,c,void 0)});n={...n,...i}}const s=await this.#e(r,{method:"post",headers:{"content-type":"application/json"},body:JSON.stringify({...n,client_id:ri})});if(ya(s.headers)!=="application/json")throw new bg(s,2,"unexpected content-type");const a=await s.json();if(s.ok)return a;throw new gd(s,a)}async revoke(t){try{await this.request("revocation",{token:t})}catch{}}async exchangeCode(t,n){const r=await this.request("token",{grant_type:"authorization_code",redirect_uri:si,code:t,code_verifier:n});try{return await this.#r(r)}catch(s){throw await this.revoke(r.access_token),s}}async refresh({sub:t,token:n}){if(!n.refresh)throw new Gs(t,"no refresh token available");const r=await this.request("token",{grant_type:"refresh_token",refresh_token:n.refresh});try{if(t!==r.sub)throw new Gs(t,`sub mismatch in token response; got ${r.sub}`);return this.#s(r)}catch(s){throw await this.revoke(r.access_token),s}}#s(t){if(!t.sub)throw new TypeError("missing sub field in token response");if(!t.scope)throw new TypeError("missing scope field in token response");if(t.token_type!=="DPoP")throw new TypeError("token response returned a non-dpop token");return{scope:t.scope,refresh:t.refresh_token,access:t.access_token,type:t.token_type,expires_at:typeof t.expires_in=="number"?Date.now()+t.expires_in*1e3:void 0}}async#r(t){const n=t.sub;if(!n)throw new TypeError("missing sub field in token response");const r=this.#s(t),s=await su(n);if(s.metadata.issuer!==this.#t.issuer)throw new TypeError(`issuer mismatch; got ${s.metadata.issuer}`);return{token:r,info:{sub:n,aud:s.identity.pds,server:Tp(s.metadata,["issuer","authorization_endpoint","introspection_endpoint","pushed_authorization_request_endpoint","revocation_endpoint","token_endpoint"])}}}}const Lp={name:"ECDSA",namedCurve:"P-256"},Pp=e=>typeof e.key=="string"&&typeof e.jwt=="string",Ip=async e=>{const t=Ng(e.key),n=await crypto.subtle.importKey("pkcs8",t,Lp,!0,["sign"]),r=await crypto.subtle.exportKey("jwk",n);return r.alg="ES256",r},ys=new Map,Jr=async(e,t)=>{t?.signal?.throwIfAborted();let n=Np;t?.noCache?n=Op:t?.allowStale&&(n=Dp);let r;for(;r=ys.get(e);){try{const{isFresh:i,value:o}=await r;if(i||n(o))return o}catch{}t?.signal?.throwIfAborted()}const s=async()=>{const i=await Mp(e,Bt.sessions.get(e));if(i&&n(i))return{isFresh:!1,value:i};const o=await jp(e,i);return await ou(e,o),{isFresh:!0,value:o}};let a;if(Ws?a=Ws.request(`atcute-oauth:${e}`,s):a=s(),a=a.finally(()=>ys.delete(e)),ys.has(e))throw new Error("concurrent request for the same key");ys.set(e,a);const{value:l}=await a;return l},ou=async(e,t)=>{try{Bt.sessions.set(e,t)}catch(n){throw await Up(t),n}},cu=e=>{Bt.sessions.delete(e)},Dp=()=>!0,Op=()=>!1,jp=async(e,t)=>{if(t===void 0)throw new Gs(e,"session deleted by another tab");const{dpopKey:n,info:r,token:s}=t,a=new is(r.server,n);try{const l=await a.refresh({sub:r.sub,token:s});return{dpopKey:n,info:r,token:l}}catch(l){throw l instanceof gd&&l.status===400&&l.error==="invalid_grant"?new Gs(e,"session was revoked",{cause:l}):l}},Up=async({dpopKey:e,info:t,token:n})=>{await new is(t.server,e).revoke(n.refresh??n.access)},Np=({token:e})=>{const t=e.expires_at;return t==null||Date.now()+6e4<=t},Mp=async(e,t)=>{if(!t||!Pp(t.dpopKey))return t;const n=await Ip(t.dpopKey),r={...t,dpopKey:n};try{Bt.sessions.set(e,r)}catch{}return r},Bp=async e=>{const{target:t,scope:n,state:r=null,...s}=e;let a;switch(t.type){case"account":{a=await su(t.identifier);break}case"pds":a=await Cp(t.serviceUrl)}const{identity:l,metadata:i}=a,o=l?l.handle!=="handle.invalid"?l.handle:l.did:void 0,c=ai(24),d=await _p(),h=await sp(["ES256"]),g={display:s.display,ui_locales:s.locale,prompt:s.prompt,redirect_uri:si,code_challenge:d.challenge,code_challenge_method:d.method,state:c,login_hint:o,response_mode:"fragment",response_type:"code",scope:n};Bt.states.set(c,{dpopKey:h,metadata:i,verifier:d.verifier,state:r});const x=await new is(i,h).request("pushed_authorization_request",g),y=new URL(i.authorization_endpoint);return y.searchParams.set("client_id",ri),y.searchParams.set("request_uri",x.request_uri),y},Fp=async e=>{const t=e.get("iss"),n=e.get("state"),r=e.get("code"),s=e.get("error");if(!n||!(r||s))throw new Dr("missing parameters");const a=Bt.states.get(n);if(a)Bt.states.delete(n);else throw new Dr("unknown state provided");if(s)throw new mg(e.get("error_description")||s);if(!r)throw new Dr("missing code parameter");const l=a.dpopKey,i=a.metadata,o=a.state??null;if(t===null)throw new Dr("missing issuer parameter");if(t!==i.issuer)throw new Dr("issuer mismatch");const c=new is(i,l),{info:d,token:h}=await c.exchangeCode(r,a.verifier),g=d.sub,p={dpopKey:l,info:d,token:h};return await ou(g,p),{session:p,state:o}};class Xs{session;#e;#t;constructor(t){this.session=t,this.#e=iu(t.dpopKey,!1)}get sub(){return this.session.info.sub}getSession(t){const n=Jr(this.session.info.sub,t);return n.then(r=>{this.session=r}).finally(()=>{this.#t=void 0}),this.#t=n}async signOut(){const t=this.session.info.sub;try{const{dpopKey:n,info:r,token:s}=await Jr(t,{allowStale:!0});await new is(r.server,n).revoke(s.refresh??s.access)}finally{cu(t)}}async handle(t,n){await this.#t;const r=new Headers(n?.headers);let s=this.session,a=new URL(t,s.info.aud);r.set("authorization",`${s.token.type} ${s.token.access}`);let l=await this.#e(a.href,{...n,headers:r});if(!zp(l))return l;try{this.#t?s=await this.#t:s=await this.getSession()}catch{return l}return n?.body instanceof ReadableStream?l:(a=new URL(t,s.info.aud),r.set("authorization",`${s.token.type} ${s.token.access}`),await this.#e(a.href,{...n,headers:r}))}}const zp=e=>{if(e.status!==401)return!1;const t=e.headers.get("www-authenticate");return t!=null&&(t.startsWith("Bearer ")||t.startsWith("DPoP "))&&t.includes('error="invalid_token"')};var Vp=m('<div class="pointer-events-none fixed bottom-4 left-4 z-60 flex flex-col gap-2">'),Kp=m('<span class="iconify lucide--download">'),Hp=m('<span class="iconify lucide--check-circle text-green-600 dark:text-green-400">'),qp=m('<span class="iconify lucide--x-circle text-red-500 dark:text-red-400">'),Wp=m('<div class="h-2 w-full overflow-hidden rounded-full bg-neutral-200 dark:bg-neutral-700"><div class="h-full rounded-full bg-blue-500 transition-all dark:bg-blue-400">'),Gp=m('<div class="text-xs text-neutral-600 dark:text-neutral-400">%'),Zp=m('<button class="dark:hover:bg-dark-200 dark:active:bg-dark-100 dark:bg-dark-300 mt-1 rounded-md border border-neutral-300 bg-neutral-50 px-2 py-1.5 text-xs select-none hover:bg-neutral-100 active:bg-neutral-200 dark:border-neutral-700">Cancel'),Xp=m('<div class="flex flex-col gap-1">'),Jp=m('<div class="dark:bg-dark-300 dark:shadow-dark-700 pointer-events-auto flex min-w-64 flex-col gap-2 rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 p-3 shadow-md select-none dark:border-neutral-700"><div class="flex items-center gap-2 text-sm"><span>'),Yp=m('<div class="text-xs text-neutral-600 dark:text-neutral-400"> MB');const[du,hi]=zn([]),[$l,bo]=T(new Set),Nn=e=>{const t=`notification-${Date.now()}-${Math.random()}`;return hi(du.length,{...e,id:t}),t},ws=(e,t)=>{hi(n=>n.id===e,t)},Mt=e=>{bo(new Set([...$l(),e])),setTimeout(()=>{hi(t=>t.filter(n=>n.id!==e)),bo(t=>{const n=new Set(t);return n.delete(e),n})},250)},Qp=()=>(()=>{var e=Vp();return f(e,u(oe,{each:du,children:t=>(()=>{var n=Jp(),r=n.firstChild,s=r.firstChild;return n.$$click=()=>t.progress===void 0&&Mt(t.id),f(r,u(k,{get when(){return t.progress!==void 0},get children(){return Kp()}}),s),f(r,u(k,{get when(){return t.type==="success"},get children(){return Hp()}}),s),f(r,u(k,{get when(){return t.type==="error"},get children(){return qp()}}),s),f(s,()=>t.message),f(n,u(k,{get when(){return t.progress!==void 0},get children(){var a=Xp();return f(a,u(k,{get when(){return X(()=>t.total!==void 0)()&&t.total>0},get fallback(){return(()=>{var l=Yp(),i=l.firstChild;return f(l,()=>t.progress,i),l})()},get children(){return[(()=>{var l=Wp(),i=l.firstChild;return z(o=>Hs(i,"width",`${t.progress}%`)),l})(),(()=>{var l=Gp(),i=l.firstChild;return f(l,()=>t.progress,i),l})()]}}),null),f(a,u(k,{get when(){return t.onCancel},get children(){var l=Zp();return l.$$click=i=>{i.stopPropagation(),t.onCancel?.()},l}}),null),a}}),null),z(a=>ye(n,{"border-blue-500 dark:border-blue-400":t.type==="info","border-green-500 dark:border-green-400":t.type==="success","border-red-500 dark:border-red-400":t.type==="error","animate-[slideIn_0.25s_ease-in]":!$l().has(t.id),"animate-[slideOut_0.25s_ease-in]":$l().has(t.id)},a)),n})()})),e})();ke(["click"]);const mr=e=>{navigator.clipboard.writeText(e);const t=Nn({message:"Copied to clipboard",type:"success"});setTimeout(()=>Mt(t),3e3)};var gi=m("<span>"),uu=m('<button class="flex items-center gap-2 rounded-md p-1.5 whitespace-nowrap hover:bg-neutral-200/50 active:bg-neutral-200 dark:hover:bg-neutral-700 dark:active:bg-neutral-600"><span class=whitespace-nowrap>'),em=m('<div class="flex items-center gap-2"><span class=whitespace-nowrap>'),tm=m('<kbd class="rounded border border-neutral-300 bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] text-neutral-500 dark:border-neutral-600 dark:bg-neutral-700 dark:text-neutral-400">'),nm=m('<span class="iconify lucide--external-link">'),rm=m('<div class="my-1 h-[0.5px] bg-neutral-300 dark:bg-neutral-600">'),sm=m("<div style=position:fixed>"),am=m("<div class=relative><button><span>");const os=Bn(),wa=e=>{const[t,n]=T(!1),r={showMenu:t,setShowMenu:n};return u(os.Provider,{value:r,get children(){return e.children}})},lm=e=>{const t=mt(os);return(()=>{var n=uu(),r=n.firstChild;return n.$$click=()=>{mr(e.content),t?.setShowMenu(!1)},f(n,u(k,{get when(){return e.icon},get children(){var s=gi();return z(()=>he(s,"iconify shrink-0 text-neutral-500 dark:text-neutral-400 "+e.icon)),s}}),r),f(r,()=>e.label),n})()},ft=e=>{const t=mt(os);return u(Ie,{get href(){return e.href},onClick:()=>t?.setShowMenu(!1),class:"flex items-center gap-2 rounded-md p-1.5 hover:bg-neutral-200/50 active:bg-neutral-200 dark:hover:bg-neutral-700 dark:active:bg-neutral-600",get classList(){return{"justify-between":e.external||!!e.shortcut}},get target(){return e.newTab?"_blank":void 0},get children(){return[(()=>{var n=em(),r=n.firstChild;return f(n,u(k,{get when(){return e.icon},get children(){var s=gi();return z(()=>he(s,"iconify shrink-0 text-neutral-500 dark:text-neutral-400 "+e.icon)),s}}),r),f(r,()=>e.label),n})(),u(k,{get when(){return e.shortcut},get children(){var n=tm();return f(n,()=>e.shortcut),n}}),u(k,{get when(){return e.external},get children(){return nm()}})]}})},kl=e=>{const t=mt(os);return(()=>{var n=uu(),r=n.firstChild;return n.$$click=()=>{e.onClick(),t?.setShowMenu(!1)},f(n,u(k,{get when(){return e.icon},get children(){var s=gi();return z(()=>he(s,"iconify shrink-0 text-neutral-500 dark:text-neutral-400 "+e.icon)),s}}),r),f(r,()=>e.label),n})()},_l=()=>rm(),$a=e=>{const t=mt(os),[n,r]=T(),[s,a]=T(),[l,i]=T(),o=d=>{const h=d.target;!s()?.contains(h)&&!n()?.contains(h)&&t?.setShowMenu(!1)},c=()=>{const d=s()?.getBoundingClientRect();if(d){const g=window.matchMedia("(hover: none)").matches?window.visualViewport:null;i({bottom:d.bottom+(g?.offsetTop??0),right:d.right+(g?.offsetLeft??0)})}};return pt(()=>{window.addEventListener("click",o),window.addEventListener("scroll",c,!0),window.addEventListener("resize",c),window.visualViewport?.addEventListener("resize",c),window.visualViewport?.addEventListener("scroll",c)}),Ce(()=>{window.removeEventListener("click",o),window.removeEventListener("scroll",c,!0),window.removeEventListener("resize",c),window.visualViewport?.removeEventListener("resize",c),window.visualViewport?.removeEventListener("scroll",c)}),(()=>{var d=am(),h=d.firstChild,g=h.firstChild;return h.$$click=()=>{c(),t?.setShowMenu(!t?.showMenu())},Ne(a,h),f(d,u(k,{get when(){return t?.showMenu()},get children(){return u(Yl,{get children(){var p=sm();return Ne(r,p),f(p,()=>e.children),z(x=>{var y=`${(l()?.bottom??0)+4}px`,b=`${(l()?.right??0)-160}px`,$="dark:bg-dark-300 dark:shadow-dark-700 z-50 flex min-w-40 flex-col rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 p-2 text-sm shadow-md dark:border-neutral-700 "+e.menuClass;return y!==x.e&&Hs(p,"top",x.e=y),b!==x.t&&Hs(p,"left",x.t=b),$!==x.a&&he(p,x.a=$),x},{e:void 0,t:void 0,a:void 0}),p}})}}),null),z(p=>{var x="flex items-center hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600 "+e.buttonClass,y="iconify "+e.icon;return x!==p.e&&he(h,p.e=x),y!==p.t&&he(g,p.t=y),p},{e:void 0,t:void 0}),d})()};ke(["click"]);var im=m('<div data-modal class="fixed inset-0 z-50 flex h-full max-h-none w-full max-w-none justify-center bg-transparent text-neutral-900 dark:text-neutral-200"><div style=transition-duration:200ms>');const om=200,Qt=e=>{const[t,n]=T(e.open??!1),[r,s]=T(!1);return Ue(()=>{if(e.open)n(!0),s(!1);else if(t()){s(!0);const a=setTimeout(()=>{n(!1),s(!1),e.onClosed?.()},om);Ce(()=>clearTimeout(a))}}),u(k,{get when(){return t()},get children(){var a=im(),l=a.firstChild;return a.$$click=i=>{(e.closeOnClick??!0)&&i.target===i.currentTarget&&!e.nonBlocking&&e.onClose&&e.onClose()},Ne(i=>{const o=c=>{if(c.key==="Escape"){const d=document.querySelectorAll("[data-modal]");d[d.length-1]===i&&(c.preventDefault(),c.stopPropagation(),e.onClose&&e.onClose())}};Ue(()=>{e.nonBlocking?document.body.style.overflow="auto":document.body.style.overflow="hidden"}),document.addEventListener("keydown",o),Ce(()=>{document.body.style.overflow="auto",document.removeEventListener("keydown",o)})},a),f(l,()=>e.children),z(i=>{var o={"pointer-events-none":e.nonBlocking,"items-start pt-18":e.alignTop,"items-start pt-[20vh]":!e.alignTop},c=`transition-all starting:scale-95 starting:opacity-0 ${e.contentClass??""}`,d={"scale-95 opacity-0":r()};return i.e=ye(a,o,i.e),c!==i.t&&he(l,i.t=c),i.a=ye(l,d,i.a),i},{e:void 0,t:void 0,a:void 0}),a}})};ke(["click"]);const cm=/^did:([a-z]+):([a-zA-Z0-9._:%-]*[a-zA-Z0-9._-])$/,Vn=e=>typeof e=="string"&&e.length>=7&&e.length<=2048&&cm.test(e),Js=e=>e>=65&&e<=90||e>=97&&e<=122,en=e=>Js(e)||e>=48&&e<=57,dm=(e,t,n)=>{const r=n-t;if(r===0||r>63)return!1;const s=e.charCodeAt(t);if(!en(s))return!1;if(r>1){if(!en(e.charCodeAt(n-1)))return!1;for(let a=t+1;a<n-1;a++){const l=e.charCodeAt(a);if(!en(l)&&l!==45)return!1}}return!0},Kn=e=>{if(typeof e!="string")return!1;const t=e.length;if(t<3||t>253)return!1;let n=0,r=0,s=0;for(let a=0;a<=t;a++)if(a===t||e.charCodeAt(a)===46){if(!dm(e,n,a))return!1;s=n,n=a+1,r++}return r<2?!1:Js(e.charCodeAt(s))},pi=e=>Vn(e)||Kn(e),Ys=(e,t)=>{if(!e)throw new Error("Assertion failed")},zt=e=>{if(typeof e!="string")return!1;const t=e.length;if(t<5||t>317)return!1;let n=-1;for(let i=t-1;i>=0;i--)if(e.charCodeAt(i)===46){n=i;break}if(n===-1)return!1;let r=0,s=0;for(let i=0;i<=n;i++)if(i===n||e.charCodeAt(i)===46){const o=i-r;if(o===0||o>63)return!1;const c=e.charCodeAt(r);if(s===0){if(!Js(c))return!1}else if(!en(c))return!1;if(o>1){if(!en(e.charCodeAt(i-1)))return!1;for(let d=r+1;d<i-1;d++){const h=e.charCodeAt(d);if(!en(h)&&h!==45)return!1}}r=i+1,s++}if(s<2)return!1;const a=n+1,l=t-a;if(l===0||l>63||!Js(e.charCodeAt(a)))return!1;for(let i=a+1;i<t;i++)if(!en(e.charCodeAt(i)))return!1;return!0},ka=e=>{if(typeof e!="string")return!1;const t=e.length;if(t<1||t>512||t<=2&&e.charCodeAt(0)===46&&(t===1||e.charCodeAt(1)===46))return!1;for(let n=0;n<t;n++){const r=e.charCodeAt(n);if(!en(r)&&r!==95&&r!==126&&r!==46&&r!==58&&r!==45)return!1}return!0},um=8,fm=2884,hm=e=>en(e)||e===46||e===95||e===126||e===58||e===64||e===33||e===36||e===38||e===37||e===39||e===41||e===40||e===42||e===43||e===44||e===59||e===61||e===45||e===91||e===93||e===47||e===92,mi=e=>{if(typeof e!="string")return!1;const t=e.length;if(t<um||t>fm||e.charCodeAt(0)!==97||e.charCodeAt(1)!==116||e.charCodeAt(2)!==58||e.charCodeAt(3)!==47||e.charCodeAt(4)!==47)return!1;const n=e.indexOf("#",5),r=n===-1?t:n;if(n!==-1){const c=n+1;if(c>=t||e.charCodeAt(c)!==47)return!1;for(let d=c;d<t;d++)if(!hm(e.charCodeAt(d)))return!1}const s=e.indexOf("/",5);let a=r,l,i;if(s!==-1&&s<r){a=s;const c=s+1;if(c>=r)return!1;const d=e.indexOf("/",c);if(d!==-1&&d<r){if(d===c||d+1>=r)return!1;const h=e.indexOf("/",d+1);if(h!==-1&&h<r)return!1;l=e.substring(c,d),i=e.substring(d+1,r)}else l=e.substring(c,r)}if(a<=5)return!1;const o=e.substring(5,a);return pi(o)&&(l===void 0||zt(l))&&(i===void 0||ka(i))},gm=/^baf[ky]rei[a-z2-7]{52}$/,_a=e=>typeof e=="string"&&e.length===59&&gm.test(e),pm=/^((?!0{3})\d{4}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01]))T((?:[01]\d|2[0-3]):(?:[0-5]\d):(?:[0-5]\d))(\.\d+)?(Z|(?!-00:00)[+-](?:[01]\d|2[0-3]):(?:[0-5]\d))$/,fu=e=>typeof e=="string"&&e.length>=20&&e.length<=64&&pm.test(e),mm=/^((?<grandfathered>(en-GB-oed|i-ami|i-bnn|i-default|i-enochian|i-hak|i-klingon|i-lux|i-mingo|i-navajo|i-pwn|i-tao|i-tay|i-tsu|sgn-BE-FR|sgn-BE-NL|sgn-CH-DE)|(art-lojban|cel-gaulish|no-bok|no-nyn|zh-guoyu|zh-hakka|zh-min|zh-min-nan|zh-xiang))|((?<language>([A-Za-z]{2,3}(-(?<extlang>[A-Za-z]{3}(-[A-Za-z]{3}){0,2}))?)|[A-Za-z]{4}|[A-Za-z]{5,8})(-(?<script>[A-Za-z]{4}))?(-(?<region>[A-Za-z]{2}|[0-9]{3}))?(-(?<variant>[A-Za-z0-9]{5,8}|[0-9][A-Za-z0-9]{3}))*(-(?<extension>[0-9A-WY-Za-wy-z](-[A-Za-z0-9]{2,8})+))*(-(?<privateUseA>x(-[A-Za-z0-9]{1,8})+))?)|(?<privateUseB>x(-[A-Za-z0-9]{1,8})+))$/,hu=e=>typeof e=="string"&&e.length>=2&&mm.test(e),bm=/^[234567abcdefghij][234567abcdefghijklmnopqrstuvwxyz]{12}$/,gu=e=>typeof e=="string"&&e.length===13&&bm.test(e),xm=/^\w+:(?:\/\/)?[^\s/][^\s]*$/,pu=e=>typeof e!="string"||!nr(e,3,8192)?!1:xm.test(e),vm=/^#[^#]+$/,ym=/^z[a-km-zA-HJ-NP-Z1-9]+$/,sr=J().assert(e=>URL.canParse(e),"must be a url"),bi=J().assert(e=>vm.test(e)||URL.canParse(e),"must be a did relative uri"),wm=J().assert(e=>ym.test(e),"must be a base58 multibase"),Ps=J().assert(Vn,"must be a did"),xo=pe({id:bi,type:J(),controller:Ps,publicKeyMultibase:wm.optional(),publicKeyJwk:rn().optional()}).chain(e=>{switch(e.type){case"Multikey":{if(e.publicKeyMultibase===void 0)return un({message:"missing multikey",path:["publicKeyMultibase"]});break}case"EcdsaSecp256k1VerificationKey2019":case"EcdsaSecp256r1VerificationKey2019":{if(e.publicKeyMultibase===void 0)return un({message:"missing multibase key",path:["publicKeyMultibase"]});break}}return tn(e)}),$m=pe({id:bi,type:Le(J(),_e(J())),serviceEndpoint:Le(sr,rn(sr),_e(Le(sr,rn(sr))))}),km=pe({"@context":_e(sr),id:Ps,alsoKnownAs:_e(sr).chain(e=>{for(let t=0,n=e.length;t<n;t++){const r=e[t];for(let s=0;s<t;s++)if(r===e[s])return un({message:`duplicate "${r}" aka entry`,path:[t]})}return tn(e)}).optional(),verificationMethod:_e(xo).chain(e=>{for(let t=0,n=e.length;t<n;t++){const s=e[t].id;for(let a=0;a<t;a++)if(s===e[a].id)return un({message:`duplicate "${s}" verification method`,path:[t,"id"]})}return tn(e)}).optional(),service:_e($m).optional(),controller:Le(Ps,_e(Ps)).optional(),authentication:_e(Le(bi,xo)).optional()}).chain(e=>{const{id:t,service:n}=e;if(n?.length){const r=n.length,s=new Array(r);for(let a=0;a<r;a++){let i=n[a].id;i[0]==="#"&&(i=t+i),s[a]=i}for(let a=0;a<r;a++){const l=s[a];for(let i=0;i<a;i++)if(l===s[i])return un({message:`duplicate "${l}" service`,path:["service",a,"id"]})}}return tn(e)}),_m="parse"in URL,Sm=e=>{let t=null;if(_m)t=URL.parse(e);else try{t=new URL(e)}catch{}return t!==null&&(t.protocol==="https:"||t.protocol==="http:")&&t.pathname==="/"&&t.search===""&&t.hash===""},Em=(e,t)=>{const n=e.verificationMethod;if(!n)return;const r=`${e.id}${t}`;for(let s=0,a=n.length;s<a;s++){const{id:l,type:i,publicKeyMultibase:o}=n[s];if(l===r&&o!==void 0)return{type:i,publicKeyMultibase:o}}},Cm=e=>Em(e,"#atproto"),vo=e=>{const t=e.alsoKnownAs;if(!t)return null;const n="at://";for(let r=0,s=t.length;r<s;r++){const a=t[r];if(!a.startsWith(n))continue;const l=a.slice(n.length);return Kn(l)?l:void 0}return null},mu=(e,t)=>{const n=e.service;if(n)for(let r=0,s=n.length;r<s;r++){const{id:a,type:l,serviceEndpoint:i}=n[r];if(!(a!==t.id&&a!==e.id+t.id)){if(t.type!==void 0){if(Array.isArray(l)){if(!l.includes(t.type))continue}else if(l!==t.type)continue}if(!(typeof i!="string"||!Sm(i)))return i}}},cs=e=>mu(e,{id:"#atproto_pds",type:"AtprotoPersonalDataServer"}),Am=e=>mu(e,{id:"#atproto_labeler",type:"AtprotoLabeler"}),Rm=/^did:plc:([a-z2-7]{24})$/,bu=e=>e.length===32&&Rm.test(e),Tm=/^did:web:([a-zA-Z0-9\-]+(?:\.[a-zA-Z0-9\-]+)*(?:\.[a-zA-Z]{2,})|localhost(?:%3[aA]\d+)?)$/,Lm=e=>e.length>=12&&Tm.test(e),Rr=e=>bu(e)||Lm(e),Pm=e=>{const t=e.indexOf(":",4);return e.slice(4,t)},Im=/^did:key:z[a-km-zA-HJ-NP-Z1-9]+$/,Dm=e=>e.length>=10&&Im.test(e);class Sa extends Error{name="DidResolutionError"}class xi extends Sa{did;name="UnsupportedDidMethodError";constructor(t){super(`unsupported did method; did=${t}`),this.did=t}}class Om extends Sa{did;name="ImproperDidError";constructor(t){super(`improper did; did=${t}`),this.did=t}}class xu extends Sa{did;name="DocumentNotFoundError";constructor(t){super(`did document not found; did=${t}`),this.did=t}}class vu extends Sa{did;name="FailedDocumentResolutionError";constructor(t,n){super(`failed to resolve did document; did=${t}`,n),this.did=t}}class Ea extends Error{name="HandleResolutionError"}class Sl extends Ea{handle;name="DidNotFoundError";constructor(t){super(`handle returned no did; handle=${t}`),this.handle=t}}class El extends Ea{handle;name="FailedHandleResolutionError";constructor(t,n){super(`failed to resolve handle; handle=${t}`,n),this.handle=t}}class yu extends Ea{handle;did;name="InvalidResolvedHandleError";constructor(t,n){super(`handle returned invalid did; handle=${t}; did=${n}`),this.handle=t,this.did=n}}class wu extends Ea{name="AmbiguousHandleError";constructor(t){super(`handle returned multiple did values; handle=${t}`)}}class Ja extends Error{name="ActorResolutionError"}class jm{handleResolver;didDocumentResolver;constructor(t){this.handleResolver=t.handleResolver,this.didDocumentResolver=t.didDocumentResolver}async resolve(t,n){const r=Vn(t);let s;if(r)s=t;else try{s=await this.handleResolver.resolve(t,n)}catch(o){throw new Ja("failed to resolve handle",{cause:o})}let a;try{a=await this.didDocumentResolver.resolve(s,n)}catch(o){throw new Ja("failed to resolve did document",{cause:o})}const l=cs(a);if(!l)throw new Ja("missing pds endpoint");let i="handle.invalid";if(r){const o=vo(a);if(o)try{await this.handleResolver.resolve(o,n)===s&&(i=o)}catch{}}else vo(a)===t&&(i=t);return{did:s,handle:i,pds:new URL(l).href}}}class Um{#e;constructor({methods:t}){this.#e=new Map(Object.entries(t))}async resolve(t,n){const r=Pm(t),s=this.#e.get(r);if(s===void 0)throw new xi(t);return await s.resolve(t,n)}}function vi(...e){return e.reduce(Nm)}const Nm=(e,t)=>n=>e(n).then(t);class Ca extends Error{name="FetchResponseError"}class ds extends Ca{response;name="FailedResponseError";constructor(t){super(`got http ${t.status}`),this.response=t}get status(){return this.response.status}}class yo extends Ca{contentType;name="ImproperContentTypeError";constructor(t,n){super(n),this.contentType=t}}class Cl extends Ca{expectedSize;actualSize;name="ImproperContentLengthError";constructor(t,n,r){super(r),this.expectedSize=t,this.actualSize=n}}class Mm extends Ca{name="ImproperResponseError";constructor(t,n){super(t,n)}}class Bm extends TransformStream{constructor(t){let n=0;super({transform(r,s){if(n+=r.length,n>t){s.error(new Cl(t,n,"response content-length too large"));return}s.enqueue(r)}})}}const yi=async e=>{if(e.ok)return e;throw new ds(e)},Fm=e=>async t=>{const n=await _u(t,e);return{response:t,text:n}},$u=(e,t)=>async n=>{await zm(n,e);const r=await _u(n,t);try{const s=JSON.parse(r);return{response:n,json:s}}catch(s){throw new Mm("unexpected json data",{cause:s})}},ku=(e,t)=>async n=>{const r=e.parse(n.json,t);return{response:n.response,json:r}},zm=async(e,t)=>{const n=e.headers.get("content-type")?.split(";",1)[0].trim();if(n===void 0)throw e.body&&await e.body.cancel(),new yo(null,"missing response content-type");if(!t.test(n))throw e.body&&await e.body.cancel(),new yo(n,"unexpected response content-type")},_u=async(e,t)=>{const n=e.headers.get("content-length");if(n!==null){const a=Number(n);if(!Number.isSafeInteger(a)||a<=0)throw e.body?.cancel(),new Cl(t,null,"invalid response content-length");if(a>t)throw e.body?.cancel(),new Cl(t,a,"response content-length too large")}const r=e.body.pipeThrough(new Bm(t)).pipeThrough(new TextDecoderStream);let s="";for await(const a of Vm(r))s+=a;return s},Vm=Symbol.asyncIterator in ReadableStream.prototype?e=>e[Symbol.asyncIterator]():e=>{const t=e.getReader();return{[Symbol.asyncIterator](){return this},next(){return t.read()},async return(){return await t.cancel(),{done:!0,value:void 0}},async throw(n){return await t.cancel(n),{done:!0,value:void 0}}}},Qs=di().assert(e=>Number.isInteger(e)&&e>=0&&e<=2**32-1),Km=pe({name:J(),type:fe(16)}),Hm=pe({name:J(),type:fe(16),TTL:Qs,data:J().chain(e=>tn(e.replace(/^"|"$/g,"").replace(/\\"/g,'"')))}),qm=pe({name:J(),type:Qs,TTL:Qs,data:J()}),Wm=pe({Status:Qs,TC:yt(),RD:yt(),RA:yt(),AD:yt(),CD:yt(),Question:fi([Km]),Answer:_e(Hm).optional(()=>[]),Authority:_e(qm).optional(),Comment:Le(J(),_e(J())).optional()}),Su=vi(yi,$u(/^application\/(dns-)?json$/,16*1024),ku(Wm,{mode:"passthrough"})),Eu=vi(yi,$u(/^application\/(did\+ld\+)?json$/,20*1024),ku(km,{mode:"passthrough"}));class Gm{apiUrl;#e;constructor({apiUrl:t="https://plc.directory",fetch:n=fetch}={}){this.apiUrl=t,this.#e=n}async resolve(t,n){if(!t.startsWith("did:plc:"))throw new xi(t);let r;try{const s=new URL(`/${encodeURIComponent(t)}`,this.apiUrl),a=await(0,this.#e)(s,{signal:n?.signal,cache:n?.noCache?"no-cache":void 0,redirect:"manual",headers:{accept:"application/did+ld+json,application/json"}});if(a.status>=300&&a.status<400)throw new TypeError("unexpected redirect");r=(await Eu(a)).json}catch(s){throw s instanceof ds&&s.status===404?new xu(t):new vu(t,{cause:s})}return r}}class Zm{#e;constructor({fetch:t=fetch}={}){this.#e=t}async resolve(t,n){if(!t.startsWith("did:web:"))throw new xi(t);const[r,...s]=t.slice(8).split(":").map(decodeURIComponent),a=new URL(`https://${r}/.well-known/did.json`);if(s.length>0)throw new Om(t);let l;try{const i=await(0,this.#e)(a,{signal:n?.signal,cache:n?.noCache?"no-cache":void 0,redirect:"manual",headers:{accept:"application/did+ld+json,application/json"}});if(i.status>=300&&i.status<400)throw new TypeError("unexpected redirect");l=(await Eu(i)).json}catch(i){throw i instanceof ds&&i.status===404?new xu(t):new vu(t,{cause:i})}return l}}class Xm{#e;strategy;constructor({methods:t,strategy:n="race"}){this.#e=t,this.strategy=n}async resolve(t,n){const{http:r,dns:s}=this.#e,a=n?.signal,l=new AbortController;a&&a.addEventListener("abort",()=>l.abort(),{signal:l.signal});const i=s.resolve(t,{...n,signal:l.signal}),o=r.resolve(t,{...n,signal:l.signal});switch(this.strategy){case"race":return new Promise(c=>{i.then(d=>{l.abort(),c(d)},()=>c(o)),o.then(d=>{l.abort(),c(d)},()=>c(i))});case"dns-first":{o.catch($s);const c=await i.catch($s);return c?(l.abort(),c):o}case"http-first":{i.catch($s);const c=await o.catch($s);return c?(l.abort(),c):i}case"both":{const[c,d]=await Promise.allSettled([i,o]),h=c.status==="fulfilled"?c.value:void 0,g=d.status==="fulfilled"?d.value:void 0;if(h&&g&&h!==g)throw new wu(t);return h||g||i}}}}const $s=()=>{},Jm="_atproto",Ya="did=";class Cu{dohUrl;#e;constructor({dohUrl:t,fetch:n=fetch}){this.dohUrl=t,this.#e=n}async resolve(t,n){let r;try{const l=new URL(this.dohUrl);l.searchParams.set("name",`${Jm}.${t}`),l.searchParams.set("type","TXT");const i=await(0,this.#e)(l,{signal:n?.signal,cache:n?.noCache?"no-cache":void 0,headers:{accept:"application/dns-json"}});r=(await Su(i)).json}catch(l){throw new El(t,{cause:l})}const s=r.Status,a=r.Answer;if(s!==0)throw s===3?new Sl(t):new El(t,{cause:new TypeError(`dns returned ${s}`)});for(let l=0,i=a.length;l<i;l++){const c=a[l].data;if(!c.startsWith(Ya))continue;for(let h=l+1;h<i;h++)if(a[h].data.startsWith(Ya))throw new wu(t);const d=c.slice(Ya.length);if(!Rr(d))throw new yu(t,d);return d}throw new Sl(t)}}const Ym=vi(yi,Fm(2064));class Au{#e;constructor({fetch:t=fetch}={}){this.#e=t}async resolve(t,n){let r;try{const a=new URL("/.well-known/atproto-did",`https://${t}`),l=await(0,this.#e)(a,{signal:n?.signal,cache:n?.noCache?"no-cache":void 0,redirect:"manual"});if(l.status>=300&&l.status<400)throw new TypeError("unexpected redirect");r=(await Ym(l)).text}catch(a){throw a instanceof ds&&a.status===404?new Sl(t):new El(t,{cause:a})}const s=r.split(` 2 + `)[0].trim();if(!Rr(s))throw new yu(t,s);return s}}const Ru=new Intl.Segmenter,Tu=e=>{const t=e.length;let n=0;for(;n+3<t;){const r=e.charCodeAt(n),s=e.charCodeAt(n+1),a=e.charCodeAt(n+2),l=e.charCodeAt(n+3);if((r|s|a|l)>127||r===13||s===13||a===13||l===13)return!1;n+=4}for(;n<t;){const r=e.charCodeAt(n);if(r>127||r===13)return!1;n++}return!0},ks=e=>{if(Tu(e))return e.length;const t=Ru.segment(e)[Symbol.iterator]();let n=0;for(;!t.next().done;)n++;return n},Nr=(e,t,n)=>{const r=e.length;if(r<t)return!1;if(t===0&&r<=n)return!0;if(Tu(e))return r<=n;const s=Ru.segment(e)[Symbol.iterator]();let a=0;for(;!s.next().done;)if(a++,a>n)return!1;return a>=t},Lu=Symbol.for("@atcute/bytes-wrapper"),Qm=e=>typeof e=="object"&&e!==null&&Lu in e,eb=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}(?:==)?|[A-Za-z0-9+/]{3}=?)?$/,tb=e=>typeof e!="string"?!1:eb.test(e),nb=e=>{const t=e;return typeof t=="object"&&t!==null&&(Lu in t||tb(t.$bytes)&&Object.keys(t).length===1)},rb=Symbol.for("@atcute/cid-link-wrapper"),Pu=e=>{const t=e;return typeof t=="object"&&t!==null&&(rb in t||_a(t.$link))},sb=e=>{const t=e;return typeof t=="object"&&t!==null&&t.$type==="blob"&&typeof t.mimeType=="string"&&Number.isSafeInteger(t.size)&&Pu(t.ref)&&Object.keys(t).length===4},ab=e=>{const t=e;return typeof t=="object"&&t!==null&&typeof t.cid=="string"&&typeof t.mimeType=="string"&&Object.keys(t).length===2},Te=(e,t,n)=>(Object.defineProperty(e,t,{value:n}),n),Aa=e=>({get value(){const t=e();return Te(this,"value",t)}}),Iu=Array.isArray,Al=e=>typeof e=="object"&&e!==null&&!Iu(e),lb=Aa(()=>{if(typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{const e=Function;return new e(""),!0}catch{return!1}}),zr=(e,t)=>e?{ok:!1,code:"join",left:e,right:t}:t,hr=(e,t)=>({ok:!1,code:"prepend",key:e,tree:t}),br=e=>({ok:!0,value:e}),wi=0,Rn=1,ib=(e,t)=>{const{ok:n,msg:r,...s}=e;return{...s,path:t}},$i=(e,t=[],n=[])=>{for(;;)switch(e.code){case"join":{$i(e.left,t.slice(),n),e=e.right;continue}case"prepend":{t.push(e.key),e=e.tree;continue}default:return n.push(ib(e,t)),n}},Du=e=>{let t=0;for(;;)switch(e.code){case"join":{t+=Du(e.left),e=e.right;continue}case"prepend":{e=e.tree;continue}default:return t+1}},Ou=(e,t)=>{switch(e.length){case 0:return"nothing";case 1:return e[0];default:return`${e.slice(0,-1).join(", ")} ${t} ${e[e.length-1]}`}},ju=e=>JSON.stringify(e),Ra=(e,t,n,r)=>{let s=`expected ${e} `;return n>0?r===n?s+=`${n}`:r!==1/0?s+=`between ${n} and ${r}`:s+=`at least ${n}`:s+=`at most ${r}`,s+=` ${t}(s)`,s},Uu=e=>{let t="",n=0;for(;;){switch(e.code){case"join":{n+=Du(e.right),e=e.left;continue}case"prepend":{t+=`.${e.key}`,e=e.tree;continue}}break}const r=e.msg();let s=`${e.code} at ${t||"."} (${r})`;return n>0&&(s+=` (+${n} other issue(s))`),s};class Nu extends Error{name="ValidationError";#e;constructor(t){super(),this.#e=t}get message(){return Uu(this.#e)}get issues(){return $i(this.#e)}}class ob{ok=!1;#e;constructor(t){this.#e=t}get message(){return Uu(this.#e)}get issues(){return $i(this.#e)}throw(){throw new Nu(this.#e)}}const Mu=(e,t)=>{const n=e["~run"](t,Rn);return n===void 0||n.ok},cb=(e,t)=>{const n=e["~run"](t,wi);return n===void 0?br(t):n.ok?n:new ob(n)},db=(e,t)=>{const n=e["~run"](t,wi);if(n===void 0)return t;if(n.ok)return n.value;throw new Nu(n)},Bu=(e,t=[],n=[])=>{for(;;)switch(e.code){case"join":{Bu(e.left,t.slice(),n),e=e.right;continue}case"prepend":{t.push(e.key),e=e.tree;continue}default:return n.push({message:e.msg(),path:t.length>0?t:void 0}),n}},et=e=>({version:1,vendor:"@atcute/lexicons",validate(t){const n=e["~run"](t,wi);return n===void 0?{value:t}:n.ok?{value:n.value}:{issues:Bu(n)}}}),ve=(e,t)=>{const n=t.length;return{...e,constraints:t,"~run"(r,s){let a=e["~run"](r,s),l;if(a===void 0)l=r;else if(a.ok)l=a.value;else return a;for(let i=0;i<n;i++){const o=t[i]["~run"](l,s);if(o!==void 0)if(o.ok)l=o.value,(a===void 0||a.ok)&&(a=o);else{if(s&Rn)return o;a===void 0||a.ok?a=o:a=zr(a,o)}}return a}}},ne=e=>{const t={ok:!1,code:"invalid_literal",expected:[e],msg(){return`expected ${ju(e)}`}};return{kind:"schema",type:"literal",expected:e,"~run"(n,r){if(n!==e)return t},get"~standard"(){return Te(this,"~standard",et(this))}}},Fu=e=>{const t={ok:!1,code:"invalid_literal",expected:e,msg(){return`expected ${Ou(e.map(ju),"or")}`}};return{kind:"schema",type:"literal_enum",expected:e,"~run"(n,r){if(!e.includes(n))return t},get"~standard"(){return Te(this,"~standard",et(this))}}},ub={ok:!1,code:"invalid_type",expected:"boolean",msg(){return"expected boolean"}},fb={kind:"schema",type:"boolean","~run"(e,t){if(typeof e!="boolean")return ub},get"~standard"(){return Te(this,"~standard",et(this))}},ki=()=>fb,wo={ok:!1,code:"invalid_type",expected:"integer",msg(){return"expected integer"}},hb={kind:"schema",type:"integer","~run"(e,t){if(typeof e!="number"||e<0||!Number.isSafeInteger(e))return wo},get"~standard"(){return Te(this,"~standard",et(this))}},xn=()=>hb,ea=(e,t=1/0)=>{const n={ok:!1,code:"invalid_integer_range",min:e,max:t,msg(){let r="expected an integer ";return e>0?t===e?r+=`of exactly ${e}`:t!==1/0?r+=`between ${e} and ${t}`:r+=`of at least ${e}`:r+=`of at most ${t}`,r}};return{kind:"constraint",type:"integer_range",min:e,max:t,"~run"(r,s){if(r<e||r>t)return n}}},_i={ok:!1,code:"invalid_type",expected:"string",msg(){return"expected string"}},gb={kind:"schema",type:"string",format:null,"~run"(e,t){if(typeof e!="string")return _i},get"~standard"(){return Te(this,"~standard",et(this))}},ge=()=>gb,Tt=(e,t)=>{const n={ok:!1,code:"invalid_string_format",expected:e,msg(){return`expected a ${e} formatted string`}},r={kind:"schema",type:"string",format:e,"~run"(s,a){if(typeof s!="string")return _i;if(!t(s))return n},get"~standard"(){return Te(this,"~standard",et(this))}};return()=>r},pb=Tt("at-identifier",pi),_t=Tt("at-uri",mi),zu=Tt("cid",_a),Ze=Tt("datetime",fu),Hn=Tt("did",Vn),Vu=Tt("handle",Kn),Ta=Tt("language",hu),Si=Tt("nsid",zt),mb=Tt("record-key",ka),lt=Tt("tid",gu),La=Tt("uri",pu),qe=(e,t=1/0)=>{const n={ok:!1,code:"invalid_string_length",minLength:e,maxLength:t,msg(){return Ra("a string","character",e,t)}};return{kind:"constraint",type:"string_length",minLength:e,maxLength:t,"~run"(r,s){if(!nr(r,e,t))return n}}},Qe=(e,t=1/0)=>{const n={ok:!1,code:"invalid_string_graphemes",minGraphemes:e,maxGraphemes:t,msg(){return Ra("a string","grapheme",e,t)}};return{kind:"constraint",type:"string_graphemes",minGraphemes:e,maxGraphemes:t,"~run"(r,s){if(!Nr(r,e,t))return n}}},$o={ok:!1,code:"invalid_type",expected:"blob",msg(){return"expected blob"}},bb={kind:"schema",type:"blob","~run"(e,t){if(typeof e!="object"||e===null)return $o;if(!sb(e)){if(ab(e)){const n={$type:"blob",mimeType:e.mimeType,ref:{$link:e.cid},size:-1};return br(n)}return $o}},get"~standard"(){return Te(this,"~standard",et(this))}},sn=()=>bb,xb={ok:!1,code:"invalid_type",expected:"bytes",msg(){return"expected bytes"}},vb={kind:"schema",type:"bytes","~run"(e,t){if(!nb(e))return xb},get"~standard"(){return Te(this,"~standard",et(this))}},yb=()=>vb,wb=(e,t=1/0)=>{const n={ok:!1,code:"invalid_bytes_size",minSize:e,maxSize:t,msg(){return Ra("a byte array","byte",e,t)}};return{kind:"constraint",type:"bytes_size",minSize:e,maxSize:t,"~run"(r,s){let a;if(Qm(r))a=r.buf.length;else{const l=r.$bytes;let i=l.length;l.charCodeAt(i-1)===61&&i--,i>1&&l.charCodeAt(i-1)===61&&i--,a=i*3>>>2}if(a<e||a>t)return n}}},$b={ok:!1,code:"invalid_type",expected:"cid-link",msg(){return"expected cid-link"}},kb={kind:"schema",type:"cid_link","~run"(e,t){if(!Pu(e))return $b},get"~standard"(){return Te(this,"~standard",et(this))}},_b=()=>kb,Ku=e=>({kind:"schema",type:"nullable",wrapped:e,"~run"(t,n){if(t!==null)return e["~run"](t,n)},get"~standard"(){return Te(this,"~standard",et(this))}}),H=(e,t)=>({kind:"schema",type:"optional",wrapped:e,default:t,"~run"(n,r){if(n===void 0){if(t===void 0)return;const s=typeof t=="function"?t():t;return br(s)}return e["~run"](n,r)},get"~standard"(){return Te(this,"~standard",et(this))}}),Sb=e=>e.type==="optional",Eb={ok:!1,code:"invalid_type",expected:"array",msg(){return"expected array"}},Oe=e=>{const t=Aa(()=>typeof e=="function"?e():e);return{kind:"schema",type:"array",get item(){return Te(this,"item",t.value)},get"~run"(){const n=t.value;return Te(this,"~run",(s,a)=>{if(!Iu(s))return Eb;let l,i;for(let o=0,c=s.length;o<c;o++){const d=s[o],h=n["~run"](d,a);if(h!==void 0){if(h.ok)i===void 0&&(i=s.slice()),i[o]=h.value;else if(l=zr(l,hr(o,h)),a&Rn)return l}}if(l!==void 0)return l;if(i!==void 0)return br(i)})},get"~standard"(){return Te(this,"~standard",et(this))}}},St=(e,t=1/0)=>{const n={ok:!1,code:"invalid_array_length",minLength:e,maxLength:t,msg(){return Ra("an array","item",e,t)}};return{kind:"constraint",type:"array_length",minLength:e,maxLength:t,"~run"(r,s){const a=r.length;if(a<e||a>t)return n}}},Rl={ok:!1,code:"invalid_type",expected:"object",msg(){return"expected object"}},Hu={ok:!1,code:"missing_value",msg(){return"missing value"}},Cb=(e,t,n)=>{t==="__proto__"?Object.defineProperty(e,t,{value:n}):e[t]=n},de=e=>{const t=Aa(()=>{const n=[];for(const r in e){const s=e[r];n.push({key:r,schema:s,optional:Sb(s),missing:hr(r,Hu)})}return n});return{kind:"schema",type:"object",get shape(){const n=t.value,r={};for(const s of n)r[s.key]=s.schema;return Te(this,"shape",r)},get"~run"(){const n=t.value,r=n.length,s=()=>{const l=[["$ok",br],["$joinIssues",zr],["$prependPath",hr]];let i="let $iss,$out;";for(let c=0;c<r;c++){const d=n[c],h=d.key,g=JSON.stringify(h),p=`_${c}`;if(i+=`{const $val=$in[${g}];`,d.optional?i+="if($val!==undefined){":i+=`if($val!==undefined||${g} in $in){`,i+=`const $res=${p}$schema["~run"]($val,$flags);if($res!==undefined)if($res.ok)${h!=="__proto__"?`($out??={...$in})[${g}]=$res.value`:`Object.defineProperty($out??={...$in},${g},{value:$res.value})`};else if((($iss=$joinIssues($iss,$prependPath(${g},$res))),$flags&${Rn}))return $iss;}`,d.optional){const x=d.schema,y=x.wrapped,b=x.default;if(l.push([`${p}$schema`,y]),b!==void 0){const $=typeof b=="function"?`${p}$default()`:`${p}$default`;l.push([`${p}$default`,b]),i+=h!=="__proto__"?`else($out??={...$in})[${g}]=${$};`:`else Object.defineProperty($out??={...$in},${g},{value:${$}});`}}else l.push([`${p}$schema`,d.schema]),l.push([`${p}$missing`,d.missing]),i+=`else if((($iss=$joinIssues($iss,${p}$missing)),$flags&${Rn}))return $iss;`;i+="}"}return i+="if($iss!==undefined)return $iss;if($out!==undefined)return $ok($out);",new Function(`[${l.map(([c])=>c).join(",")}]`,`return function matcher($in,$flags){${i}}`)(l.map(([,c])=>c))};if(lb.value){const l=s();return Te(this,"~run",(o,c)=>Al(o)?l(o,c):Rl)}return Te(this,"~run",(l,i)=>{if(!Al(l))return Rl;let o,c;for(let d=0;d<r;d++){const h=n[d],g=h.key,p=l[g];if(!h.optional&&p===void 0&&!(g in l)){if(o=zr(o,h.missing),i&Rn)return o;continue}const x=h.schema["~run"](p,i);if(x!==void 0){if(x.ok)c===void 0&&(c={...l}),Cb(c,g,x.value);else if(o=zr(o,hr(g,x)),i&Rn)return o}}if(o!==void 0)return o;if(c!==void 0)return br(c)})},get"~standard"(){return Te(this,"~standard",et(this))}}},Xe=(e,t)=>{const n=Aa(()=>{let s=t.shape.$type;return Ys(s!==void 0),s.type==="optional"&&(s=s.wrapped),Ys(s.type==="literal"&&typeof s.expected=="string"),t});return{kind:"schema",type:"record",key:e,get object(){return Te(this,"object",n.value)},"~run"(r,s){return Te(this,"~run",n.value["~run"])(r,s)},get"~standard"(){return Te(this,"~standard",et(this))}}},Ab=hr("$type",Hu),Rb=hr("$type",_i),gt=(e,t=!1)=>({kind:"schema",type:"variant",members:e,closed:t,get"~run"(){const n=[],r=[];for(let l=0,i=e.length;l<i;l++){const o=e[l];let d=o.shape.$type;Ys(d!==void 0),d.type==="optional"&&(d=d.wrapped),Ys(d.type==="literal"&&typeof d.expected=="string"),n.push(d.expected),r.push(o)}const s={ok:!1,code:"invalid_variant",expected:n,msg(){return`expected ${Ou(n,"or")}`}};return Te(this,"~run",(l,i)=>{if(!Al(l))return Rl;const o=l.$type;if(o===void 0&&!("$type"in l))return Ab;if(typeof o!="string")return t?s:Rb;for(let c=0,d=n.length;c<d;c++)if(n[c]===o)return r[c]["~run"](l,i);if(t)return s})},get"~standard"(){return Te(this,"~standard",et(this))}}),Tb={ok:!1,code:"invalid_type",expected:"unknown",msg(){return"expected unknown"}},Lb={kind:"schema",type:"unknown","~run"(e,t){if(typeof e!="object"||e===null)return Tb},get"~standard"(){return Te(this,"~standard",et(this))}},Pb=()=>Lb,Ib=de({$type:H(ne("com.atproto.repo.strongRef")),cid:zu(),uri:_t()}),Vt=Ib,Db=ge(),Ob=de({$type:H(ne("com.atproto.label.defs#labelValueDefinition")),adultOnly:H(ki()),blurs:ge(),defaultSetting:H(ge(),"warn"),identifier:ve(ge(),[qe(0,100),Qe(0,100)]),get locales(){return Oe(Fb)},severity:ge()}),jb=de({$type:H(ne("com.atproto.label.defs#labelValueDefinitionStrings")),description:ve(ge(),[qe(0,1e5),Qe(0,1e4)]),lang:Ta(),name:ve(ge(),[qe(0,640),Qe(0,64)])}),Ub=de({$type:H(ne("com.atproto.label.defs#selfLabel")),val:ve(ge(),[qe(0,128)])}),Nb=de({$type:H(ne("com.atproto.label.defs#selfLabels")),get values(){return ve(Oe(zb),[St(0,10)])}}),Mb=Db,Bb=Ob,Fb=jb,zb=Ub,us=Nb,Vb=ge(),Kb=ge(),Hb=Vb,qb=Kb;class Pa extends Error{name="LexiconAuthorityResolutionError"}class ko extends Pa{nsid;name="AuthorityNotFoundError";constructor(t){super(`lexicon authority not found; nsid=${t}`),this.nsid=t}}class _o extends Pa{nsid;name="FailedAuthorityResolutionError";constructor(t,n){super(`failed to resolve lexicon authority; nsid=${t}`,n),this.nsid=t}}class Wb extends Pa{nsid;did;name="InvalidResolvedAuthorityError";constructor(t,n){super(`lexicon authority returned invalid did; nsid=${t}; did=${n}`),this.nsid=t,this.did=n}}class Gb extends Pa{nsid;name="AmbiguousAuthorityError";constructor(t){super(`lexicon authority returned multiple did values; nsid=${t}`),this.nsid=t}}class Ei extends Error{name="LexiconResolutionError"}class Tl extends Ei{nsid;name="FailedLexiconResolutionError";constructor(t,n){super(`failed to resolve lexicon; nsid=${t}`,n),this.nsid=t}}class So extends Ei{nsid;name="InvalidLexiconSchemaError";constructor(t,n){super(`invalid lexicon schema; nsid=${t}`,n),this.nsid=t}}class Zb extends Ei{nsid;name="InvalidLexiconProofError";constructor(t,n){super(`invalid lexicon record proof; nsid=${t}`,n),this.nsid=t}}const Xb=e=>e.split(".").slice(0,-1).reverse().join("."),Jb="_lexicon",Qa="did=";class Yb{dohUrl;#e;constructor({dohUrl:t,fetch:n=fetch}){this.dohUrl=t,this.#e=n}async resolve(t,n){const r=Xb(t);let s;try{const i=new URL(this.dohUrl);i.searchParams.set("name",`${Jb}.${r}`),i.searchParams.set("type","TXT");const o=await(0,this.#e)(i,{signal:n?.signal,cache:n?.noCache?"no-cache":void 0,headers:{accept:"application/dns-json"}});s=(await Su(o)).json}catch(i){throw new _o(t,{cause:i})}const a=s.Status,l=s.Answer;if(a!==0)throw a===3?new ko(t):new _o(t,{cause:new TypeError(`dns returned ${a}`)});for(let i=0,o=l.length;i<o;i++){const d=l[i].data;if(!d.startsWith(Qa))continue;for(let g=i+1;g<o;g++)if(l[g].data.startsWith(Qa))throw new Gb(t);const h=d.slice(Qa.length);if(!Rr(h))throw new Wb(t,h);return h}throw new ko(t)}}const qu={p:0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn,n:0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n,h:1n,a:0n,b:7n,Gx:0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n,Gy:0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n},{p:In,n:Ia,Gx:Qb,Gy:ex,b:Wu}=qu,Yr=32,Qr=64,Gu={publicKey:Yr+1,publicKeyUncompressed:Qr+1,signature:Qr},tx=(...e)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...e)},je=(e="")=>{const t=new Error(e);throw tx(t,je),t},nx=e=>typeof e=="bigint",rx=e=>typeof e=="string",sx=e=>e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array",Tr=(e,t,n="")=>{const r=sx(e),s=e?.length,a=t!==void 0;if(!r||a&&s!==t){const l=n&&`"${n}" `,i=a?` of length ${t}`:"",o=r?`length=${s}`:`type=${typeof e}`;je(l+"expected Uint8Array"+i+", got "+o)}return e},ta=e=>new Uint8Array(e),Zu=(e,t)=>e.toString(16).padStart(t,"0"),Xu=e=>Array.from(Tr(e)).map(t=>Zu(t,2)).join(""),Xt={_0:48,_9:57,A:65,F:70,a:97,f:102},Eo=e=>{if(e>=Xt._0&&e<=Xt._9)return e-Xt._0;if(e>=Xt.A&&e<=Xt.F)return e-(Xt.A-10);if(e>=Xt.a&&e<=Xt.f)return e-(Xt.a-10)},Ju=e=>{const t="hex invalid";if(!rx(e))return je(t);const n=e.length,r=n/2;if(n%2)return je(t);const s=ta(r);for(let a=0,l=0;a<r;a++,l+=2){const i=Eo(e.charCodeAt(l)),o=Eo(e.charCodeAt(l+1));if(i===void 0||o===void 0)return je(t);s[a]=i*16+o}return s},ax=()=>globalThis?.crypto,Co=()=>ax()?.subtle??je("crypto.subtle must be defined, consider polyfill"),na=(...e)=>{const t=ta(e.reduce((r,s)=>r+Tr(s).length,0));let n=0;return e.forEach(r=>{t.set(r,n),n+=r.length}),t},es=BigInt,Da=(e,t,n,r="bad number: out of range")=>nx(e)&&t<=e&&e<n?e:je(r),te=(e,t=In)=>{const n=e%t;return n>=0n?n:t+n},Is=e=>te(e,Ia),Yu=(e,t)=>{(e===0n||t<=0n)&&je("no inverse n="+e+" mod="+t);let n=te(e,t),r=t,s=0n,a=1n;for(;n!==0n;){const l=r/n,i=r%n,o=s-a*l;r=n,n=i,s=a,a=o}return r===1n?te(s,t):je("no inverse")},lx=e=>{const t=af[e];return typeof t!="function"&&je("hashes."+e+" not set"),t},el=e=>e instanceof st?e:je("Point expected"),Qu=e=>te(te(e*e)*e+Wu),Ao=e=>Da(e,0n,In),Ds=e=>Da(e,1n,In),Ll=e=>Da(e,1n,Ia),Pl=e=>(e&1n)===0n,ef=e=>Uint8Array.of(e),ix=e=>ef(Pl(e)?2:3),ox=e=>{const t=Qu(Ds(e));let n=1n;for(let r=t,s=(In+1n)/4n;s>0n;s>>=1n)s&1n&&(n=n*r%In),r=r*r%In;return te(n*n)===t?n:je("sqrt invalid")};class st{static BASE;static ZERO;X;Y;Z;constructor(t,n,r){this.X=Ao(t),this.Y=Ds(n),this.Z=Ao(r),Object.freeze(this)}static CURVE(){return qu}static fromAffine(t){const{x:n,y:r}=t;return n===0n&&r===0n?_n:new st(n,r,1n)}static fromBytes(t){Tr(t);const{publicKey:n,publicKeyUncompressed:r}=Gu;let s;const a=t.length,l=t[0],i=t.subarray(1),o=ra(i,0,Yr);if(a===n&&(l===2||l===3)){let c=ox(o);const d=Pl(c);Pl(es(l))!==d&&(c=te(-c)),s=new st(o,c,1n)}return a===r&&l===4&&(s=new st(o,ra(i,Yr,Qr),1n)),s?s.assertValidity():je("bad point: not on curve")}static fromHex(t){return st.fromBytes(Ju(t))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}equals(t){const{X:n,Y:r,Z:s}=this,{X:a,Y:l,Z:i}=el(t),o=te(n*i),c=te(a*s),d=te(r*i),h=te(l*s);return o===c&&d===h}is0(){return this.equals(_n)}negate(){return new st(this.X,te(-this.Y),this.Z)}double(){return this.add(this)}add(t){const{X:n,Y:r,Z:s}=this,{X:a,Y:l,Z:i}=el(t),o=0n,c=Wu;let d=0n,h=0n,g=0n;const p=te(c*3n);let x=te(n*a),y=te(r*l),b=te(s*i),$=te(n+r),w=te(a+l);$=te($*w),w=te(x+y),$=te($-w),w=te(n+s);let v=te(a+i);return w=te(w*v),v=te(x+b),w=te(w-v),v=te(r+s),d=te(l+i),v=te(v*d),d=te(y+b),v=te(v-d),g=te(o*w),d=te(p*b),g=te(d+g),d=te(y-g),g=te(y+g),h=te(d*g),y=te(x+x),y=te(y+x),b=te(o*b),w=te(p*w),y=te(y+b),b=te(x-b),b=te(o*b),w=te(w+b),x=te(y*w),h=te(h+x),x=te(v*w),d=te($*d),d=te(d-x),x=te($*y),g=te(v*g),g=te(g+x),new st(d,h,g)}subtract(t){return this.add(el(t).negate())}multiply(t,n=!0){if(!n&&t===0n)return _n;if(Ll(t),t===1n)return this;if(this.equals(xr))return wx(t).p;let r=_n,s=xr;for(let a=this;t>0n;a=a.double(),t>>=1n)t&1n?r=r.add(a):n&&(s=s.add(a));return r}multiplyUnsafe(t){return this.multiply(t,!1)}toAffine(){const{X:t,Y:n,Z:r}=this;if(this.equals(_n))return{x:0n,y:0n};if(r===1n)return{x:t,y:n};const s=Yu(r,In);return te(r*s)!==1n&&je("inverse invalid"),{x:te(t*s),y:te(n*s)}}assertValidity(){const{x:t,y:n}=this.toAffine();return Ds(t),Ds(n),te(n*n)===Qu(t)?this:je("bad point: not on curve")}toBytes(t=!0){const{x:n,y:r}=this.assertValidity().toAffine(),s=sa(n);return t?na(ix(r),s):na(ef(4),s,sa(r))}toHex(t){return Xu(this.toBytes(t))}}const xr=new st(Qb,ex,1n),_n=new st(0n,1n,0n);st.BASE=xr;st.ZERO=_n;const cx=(e,t,n)=>xr.multiply(t,!1).add(e.multiply(n,!1)).assertValidity(),tf=e=>es("0x"+(Xu(e)||"0")),ra=(e,t,n)=>tf(e.subarray(t,n)),dx=2n**256n,sa=e=>Ju(Zu(Da(e,0n,dx),Qr)),nf=e=>e>Ia>>1n,ux=e=>{[0,1,2,3].includes(e)||je("recovery id must be valid and present")},fx=e=>{e!=null&&!Ro.includes(e)&&je(`Signature format must be one of: ${Ro.join(", ")}`),e===sf&&je('Signature format "der" is not supported: switch to noble-curves')},rf=(e,t=vr)=>{fx(t);const n=Gu.signature,r=n+1;let s=`Signature format "${t}" expects Uint8Array with length `;t===vr&&e.length!==n&&je(s+n),t===aa&&e.length!==r&&je(s+r)};class ts{r;s;recovery;constructor(t,n,r){this.r=Ll(t),this.s=Ll(n),r!=null&&(this.recovery=r),Object.freeze(this)}static fromBytes(t,n=vr){rf(t,n);let r;n===aa&&(r=t[0],t=t.subarray(1));const s=ra(t,0,Yr),a=ra(t,Yr,Qr);return new ts(s,a,r)}addRecoveryBit(t){return new ts(this.r,this.s,t)}hasHighS(){return nf(this.s)}toBytes(t=vr){const{r:n,s:r,recovery:s}=this,a=na(sa(n),sa(r));return t===aa?(ux(s),na(Uint8Array.of(s),a)):a}}const hx=e=>{const t=e.length*8-256;t>1024&&je("msg invalid");const n=tf(e);return t>0?n>>es(t):n},gx=e=>Is(hx(Tr(e))),vr="compact",aa="recovered",sf="der",Ro=[vr,aa,sf],To={lowS:!0,prehash:!0,format:vr,extraEntropy:!1},Lo="SHA-256",af={hmacSha256Async:async(e,t)=>{const n=Co(),r="HMAC",s=await n.importKey("raw",e,{name:r,hash:{name:Lo}},!1,["sign"]);return ta(await n.sign(r,s,t))},hmacSha256:void 0,sha256Async:async e=>ta(await Co().digest(Lo,e)),sha256:void 0},px=(e,t,n)=>(Tr(e,void 0,"message"),t.prehash?n?af.sha256Async(e):lx("sha256")(e):e),mx=(e,t,n,r={})=>{const{lowS:s,format:a}=r;e instanceof ts&&je("Signature must be in Uint8Array, use .toBytes()"),rf(e,a),Tr(n,void 0,"publicKey");try{const{r:l,s:i}=ts.fromBytes(e,a),o=gx(t),c=st.fromBytes(n);if(s&&nf(i))return!1;const d=Yu(i,Ia),h=Is(o*d),g=Is(l*d),p=cx(c,h,g).toAffine();return Is(p.x)===l}catch{return!1}},bx=e=>{const t={};return Object.keys(To).forEach(n=>{t[n]=e[n]??To[n]}),t},xx=(e,t,n,r={})=>(r=bx(r),t=px(t,r,!1),mx(e,t,n,r)),la=8,vx=256,lf=Math.ceil(vx/la)+1,Il=2**(la-1),yx=()=>{const e=[];let t=xr,n=t;for(let r=0;r<lf;r++){n=t,e.push(n);for(let s=1;s<Il;s++)n=n.add(t),e.push(n);t=n.double()}return e};let Po;const Io=(e,t)=>{const n=t.negate();return e?n:t},wx=e=>{const t=Po||(Po=yx());let n=_n,r=xr;const s=2**la,a=s,l=es(s-1),i=es(la);for(let o=0;o<lf;o++){let c=Number(e&l);e>>=i,c>Il&&(c-=a,e+=1n);const d=o*Il,h=d,g=d+Math.abs(c)-1,p=o%2!==0,x=c<0;c===0?r=r.add(Io(p,t[h])):n=n.add(Io(x,t[g]))}return e!==0n&&je("invalid wnaf"),{p:n,f:r}},$x=e=>{let t,n=0n;for(let r=1;r<=(t=e.length)>>1;r++)n|=BigInt(e[t-r])<<BigInt(8*(r-1));return n},kx=(e,t)=>$x(e)<=t>>1n,_x=e=>e[0]===2||e[0]===3,Sx=e=>e[0]===4,Ex=e=>{nn(Sx(e),"not an uncompressed point");const t=e.length-1,n=t>>1,r=e.slice(0,n+1);return r[0]=2+(e[t]&1),r},ia=(e,t)=>`z${Vg(md([e,t]))}`,nn=(e,t)=>{if(!e)throw new TypeError(t)},Ci=(e,t)=>{if(!e)throw new SyntaxError(t)},of=(e,t)=>{throw new Error(t)},Do=Uint8Array.from([231,1]);Uint8Array.from([129,38]);const Cx=(e,t)=>{const n=st.fromBytes(e).toBytes(!1);return{kty:"EC",crv:"secp256k1",alg:"ES256K",x:Zr(n.subarray(1,33)),y:Zr(n.subarray(33,65)),key_ops:["verify","sign"]}};class Ai{type="secp256k1";jwtAlg="ES256K";_publicKey;constructor(t){this._publicKey=t}static async importRaw(t){return new Ai(t)}async verify(t,n,r){if(t.length!==64)return!1;const s=r?.allowMalleableSig??!1,a=await ma(n);return xx(t,a,this._publicKey,{lowS:!s,prehash:!1})}async exportPublicKey(t){const n=this._publicKey;if(t==="jwk")return Cx(n);switch(t){case"did":return`did:key:${ia(Do,n)}`;case"multikey":return ia(Do,n);case"raw":return n;case"rawHex":return xd(n)}of(t,`unknown "${t}" export format`)}}const Mr=0xffffffff00000001000000000000000000000000ffffffffffffffffffffffffn,Ax=0xffffffff00000001000000000000000000000000fffffffffffffffffffffffcn,Rx=0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604bn,Tx=0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551n,Lx=(Mr+1n)/4n,Px=e=>e.reduce((t,n,r)=>t+(BigInt(n)<<BigInt(8*(e.length-r-1))),0n),Oo=(e,t)=>Uint8Array.from(Array.from({length:t},(n,r)=>Number(BigInt.asUintN(8,e>>BigInt((t-r-1)*8))))),Ix=(e,t)=>(e=e*e%t,e=e*e%t,e=e*e%t,e=e*e%t,e),Dx=(e,t,n)=>{const r=[1n];for(let s=0;s<15;s++)r.push(r[s]*e%n);return Array.from(t.toString(16)).reduce((s,a)=>Ix(s,n)*r[parseInt(a,16)]%n,1n)},Ox=e=>{nn(_x(e),"not a compressed point"),nn(e.length===33,"invalid compressed point length");const t=Px(e.subarray(1)),n=(t**3n+Ax*t+Rx)%Mr;let r=Dx(n,Lx,Mr);nn(r*r%Mr===n,"invalid curve point"),(e[0]^Number(BigInt.asUintN(1,r)))&1&&(r=Mr-r);const s=new Uint8Array(65);return s[0]=4,s.set(Oo(t,32),1),s.set(Oo(r,32),33),s},jo=Uint8Array.from([128,36]);Uint8Array.from([134,38]);const Uo={name:"ECDSA",namedCurve:"P-256",hash:"SHA-256"},cf=Uint8Array.from([48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7]);Uint8Array.from([48,65,2,1,0,...cf,4,39,48,37,2,1,1,4,32]);Uint8Array.from([48,57,...cf,3,34,0]);class oa{type="p256";jwtAlg="ES256";_publicKey;constructor(t){this._publicKey=t}static async importRaw(t){let n;return n=await crypto.subtle.importKey("raw",Ox(t),Uo,!0,["verify"]),new oa(n)}static async importCryptoKey(t){return nn(t.algorithm.namedCurve==="P-256","not an ECDSA P-256 key"),nn(t.type==="public","not a public key"),nn(t.extractable,"key must be extractable"),new oa(t)}async verify(t,n,r){return t.length!==64||!r?.allowMalleableSig&&!kx(t,Tx)?!1:await crypto.subtle.verify(Uo,this._publicKey,t,n)}async exportPublicKey(t){if(t==="jwk")return await crypto.subtle.exportKey("jwk",this._publicKey);const n=await crypto.subtle.exportKey("raw",this._publicKey),r=Ex(new Uint8Array(n));switch(t){case"did":return`did:key:${ia(jo,r)}`;case"multikey":return ia(jo,r);case"raw":return r;case"rawHex":return xd(r)}of(t,`unknown "${t}" export format`)}}const Dl=e=>(Ci(e.length>=2&&e[0]==="z","not a multibase base58btc string"),kd(e.slice(1))),df=e=>(Ci(e.length>=9&&e.startsWith("did:key:"),"not a did:key"),Ri(e.slice(8))),Ri=e=>{const t=Dl(e);Ci(t.length>=3,"multikey too short");const n=t[0]<<8|t[1],r=t.subarray(2);switch(n){case 32804:return{type:"p256",jwtAlg:"ES256",publicKeyBytes:r};case 59137:return{type:"secp256k1",jwtAlg:"ES256K",publicKeyBytes:r}}nn(!1,`unsupported key type (0x${n.toString(16).padStart(4,"0")})`)},jx=e=>{const t=e.publicKeyMultibase;switch(e.type){case"Multikey":return Ri(t);case"EcdsaSecp256r1VerificationKey2019":return{type:"p256",jwtAlg:"ES256",publicKeyBytes:Dl(t)};case"EcdsaSecp256k1VerificationKey2019":return{type:"secp256k1",jwtAlg:"ES256K",publicKeyBytes:Dl(t)}}nn(!1,`unsupported controller type (${e.type})`)},Ux=/^[a-zA-Z][a-zA-Z0-9_]{0,62}?$/,uf=/^(?=.)(?:[a-zA-Z](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+\.[a-zA-Z][a-zA-Z0-9]{0,62}?)?(?:#[a-zA-Z][a-zA-Z0-9_]{0,62}?)?$/,Nx=/^[a-z]+\/(?:\*|[a-zA-Z][a-zA-Z0-9-+.]*)$/,Mx=/^literal:(?!\.{1,2}$)[a-zA-Z0-9_~.:-]{1,512}$/,_s=(e,t)=>{switch(t){case"datetime":return fu(e);case"uri":return pu(e);case"at-uri":return mi(e);case"did":return Vn(e);case"handle":return Kn(e);case"at-identifier":return pi(e);case"nsid":return zt(e);case"cid":return _a(e);case"language":return hu(e);case"tid":return gu(e);case"record-key":return ka(e)}},Bx=(e="any")=>e==="any"||e==="tid"||e==="nsid"?!0:e.startsWith("literal:")?Mx.test(e):!0,ff=e=>{const{const:t,default:n}=e,r=[];return n!==void 0&&t!==void 0&&n!==t&&r.push({message:"default value must match constant value",path:["default"]}),r},hf=e=>{const{minimum:t=0,maximum:n=1/0,const:r,default:s,enum:a}=e,l=[];if(r!==void 0&&a!==void 0)return[{message:"const and enum can't be used together",path:["const"]}];if(t>n&&l.push({message:"minimum value can't be greater than maximum value",path:["minimum"]}),s!==void 0&&(r!==void 0&&s!==r&&l.push({message:"default value must match constant value",path:["default"]}),a!==void 0&&!a.includes(s)&&l.push({message:"default value must be one of the enum values",path:["default"]}),s<t&&l.push({message:"default value can't be lower than minimum value",path:["default"]}),s>n&&l.push({message:"default value can't be greater than maximum value",path:["default"]})),r!==void 0&&(r<t&&l.push({message:"const value can't be lower than minimum value",path:["const"]}),r>n&&l.push({message:"const value can't be greater than maximum value",path:["const"]})),a!==void 0)for(let i=0,o=a.length;i<o;i++){const c=a[i];c<t&&l.push({message:"enum value can't be lower than minimum value",path:["enum",i]}),c>n&&l.push({message:"enum value can't be greater than maximum value",path:["enum",i]})}return l},gf=e=>{const{format:t,minLength:n=0,maxLength:r=1/0,minGraphemes:s=0,maxGraphemes:a=1/0,const:l,default:i,enum:o,knownValues:c}=e,d=[];if(l!==void 0&&o!==void 0)return[{message:"const and enum can't be used together",path:["const"]}];if(l!==void 0&&c!==void 0)return[{message:"const and knownValues can't be used together",path:["const"]}];if(o!==void 0&&c!==void 0)return[{message:"enum and knownValues can't be used together",path:["enum"]}];if(n>r&&d.push({message:"minimum string length can't be greater than maximum string length",path:["minLength"]}),s>a&&d.push({message:"minimum grapheme count can't be greater than maximum grapheme count",path:["minGraphemes"]}),i!==void 0){if(l!==void 0&&i!==l&&d.push({message:"default value must match constant value",path:["default"]}),o!==void 0&&!o.includes(i)&&d.push({message:"default value must be one of the enum values",path:["default"]}),!nr(i,n,r)){const h=xs(i);d.push({message:`default value length ${h}, must be ${n} <= len <= ${r}`,path:["default"]})}if(!Nr(i,s,a)){const h=ks(i);d.push({message:`default value grapheme length ${h}, must be ${s} <= len <= ${a}`,path:["default"]})}t!==void 0&&!_s(i,t)&&d.push({message:`default value does not match format '${t}'`,path:["default"]})}if(l!==void 0){if(!nr(l,n,r)){const h=xs(l);d.push({message:`const value length ${h}, must be ${n} <= len <= ${r}`,path:["const"]})}if(!Nr(l,s,a)){const h=ks(l);d.push({message:`const value grapheme length ${h}, must be ${s} <= len <= ${a}`,path:["const"]})}t!==void 0&&!_s(l,t)&&d.push({message:`const value does not match format '${t}'`,path:["const"]})}if(o!==void 0)for(let h=0,g=o.length;h<g;h++){const p=o[h];if(!nr(p,n,r)){const x=xs(p);d.push({message:`enum value length ${x}, must be ${n} <= len <= ${r}`,path:["enum",h]})}if(!Nr(p,s,a)){const x=ks(p);d.push({message:`enum value grapheme length ${x}, must be ${s} <= len <= ${a}`,path:["enum",h]})}t!==void 0&&!_s(p,t)&&d.push({message:`enum value does not match format '${t}'`,path:["enum",h]})}if(c!==void 0)for(let h=0,g=c.length;h<g;h++){const p=c[h];if(!nr(p,n,r)){const x=xs(p);d.push({message:`known value length ${x}, must be ${n} <= len <= ${r}`,path:["known",h]})}if(!Nr(p,s,a)){const x=ks(p);d.push({message:`known value grapheme length ${x}, must be ${s} <= len <= ${a}`,path:["known",h]})}t!==void 0&&!_s(p,t)&&d.push({message:`known value does not match format '${t}'`,path:["knownValues",h]})}return d},pf=e=>{const{minLength:t=0,maxLength:n=1/0}=e,r=[];return t>n&&r.push({message:"minimum byte length can't be greater than maximum byte length",path:["minLength"]}),r},mf=e=>{const{accept:t=[]}=e,n=[];if(t.includes("*/*"))t.length>1&&n.push({message:"no other MIME types can be specified when a wildcard is present",path:["accept"]});else for(let r=0,s=t.length;r<s;r++){const a=t[r];Nx.test(a)||n.push({message:"invalid MIME type",path:["accept",r]})}return n},bf=e=>{const{ref:t}=e,n=[];return uf.test(t)||n.push({message:"invalid ref identifier",path:["ref"]}),n},xf=e=>{const{refs:t,closed:n=!1}=e,r=[];n&&t.length===0&&r.push({message:"closed enum can't have zero ref members",path:["refs"]});for(let s=0,a=t.length;s<a;s++){const l=t[s];uf.test(l)||r.push({message:"invalid ref identifiier",path:["refs",s]})}return r},vf=(e,t=!1)=>{switch(e.type){case"boolean":return ff(e);case"integer":return hf(e);case"string":return gf(e);case"bytes":return pf(e);case"cid-link":return[];case"blob":return mf(e);case"ref":return bf(e);case"union":return xf(e);case"unknown":return[];case"array":return yf(e,t)}},yf=(e,t=!1)=>{const{items:n,minLength:r=0,maxLength:s=1/0}=e,a=[];if(r>s&&a.push({message:"minimum array length can't be greater than maximum array length",path:["minLength"]}),t)for(const{message:l,path:i}of vf(n))a.push({message:l,path:["items",...i]});return a},wf=(e,t=!1)=>{const{required:n=[],properties:r}=e,s=[];if(n.length>0)if(r===void 0)s.push({message:"required fields specified but no properties defined",path:["properties"]});else for(const a of n)r[a]===void 0&&s.push({message:"required field not defined",path:["properties",a]});for(const a in r){const l=r[a];if(Ux.test(a)||s.push({message:"invalid property key",path:["properties",a]}),t)for(const{message:i,path:o}of vf(l,t))s.push({message:i,path:["properties",a,...o]})}return s},Fx=(e,t=!1)=>{const{key:n="any",record:r}=e,s=[];if(Bx(n)||s.push({message:"invalid record key",path:["key"]}),t)for(const{message:a,path:l}of wf(r,t))s.push({message:a,path:["record",...l]});return s},Be=di().assert(e=>e>=0&&Number.isSafeInteger(e),"expected non-negative integer"),zx=J().assert(zt,"expected valid nsid"),$f=pe({type:fe("boolean"),description:J().optional(),default:yt().optional(),const:yt().optional()}),kf=pe({type:fe("integer"),description:J().optional(),default:Be.optional(),minimum:Be.optional(),maximum:Be.optional(),enum:_e(Be).optional(),const:Be.optional()}),Vx=Le(fe("datetime"),fe("uri"),fe("at-uri"),fe("did"),fe("handle"),fe("at-identifier"),fe("nsid"),fe("cid"),fe("language"),fe("tid"),fe("record-key")),_f=pe({type:fe("string"),format:Vx.optional(),description:J().optional(),default:J().optional(),minLength:Be.optional(),maxLength:Be.optional(),minGraphemes:Be.optional(),maxGraphemes:Be.optional(),enum:_e(J()).optional(),const:J().optional(),knownValues:_e(J()).optional()}),Kx=pe({type:fe("bytes"),description:J().optional(),minLength:Be.optional(),maxLength:Be.optional()}),Hx=pe({type:fe("cid-link"),description:J().optional()}),qx=pe({type:fe("blob"),description:J().optional(),accept:_e(J()).optional(),maxSize:Be.optional()}),Sf=Le($f,kf,_f),Ti=Le($f,kf,_f,Kx,Hx,qx),Ef=pe({type:fe("token"),description:J().optional()}),Li=pe({type:fe("ref"),description:J().optional(),ref:J()}),Oa=pe({type:fe("union"),description:J().optional(),refs:_e(J()),closed:yt().optional()}),Pi=pe({type:fe("unknown"),description:J().optional()}),Wx=Le(Li,Oa),Gx=Le(Ef,Li,Oa,Pi),Cf=ru(()=>Le(Ti,Li,Oa,Pi,Af));ru(()=>Le(Ti,Gx,Rf));const Af=pe({type:fe("array"),description:J().optional(),items:Cf,minLength:Be.optional(),maxLength:Be.optional()}),Zx=pe({type:fe("array"),description:J().optional(),items:Sf,minLength:Be.optional(),maxLength:Be.optional()}),Ii=pe({type:fe("object"),description:J().optional(),required:_e(J()).optional(),nullable:_e(J()).optional(),properties:rn(Cf).optional()}),Rf=Le(Af,Ii),Ol=pe({description:J().optional(),encoding:J(),schema:Le(Wx,Ii).optional()}),Xx=pe({description:J().optional(),schema:Oa.optional()}),Di=pe({name:J(),description:J().optional()}),No=rn(Le(ui(),J())),Oi=pe({type:fe("params"),description:J().optional(),required:_e(J()).optional(),properties:rn(Le(Sf,Zx)).optional()}),Jx=pe({type:fe("permission"),resource:J()}).rest(Le(_e(Le(J(),Be,yt())),J(),Be,yt(),ui())),Yx=pe({type:fe("record"),description:J().optional(),key:Le(fe("tid"),fe("nsid"),fe("any"),J().assert(e=>e.startsWith("literal:"),{message:"invalid literal key"})).optional(),record:Ii}),Qx=pe({type:fe("query"),description:J().optional(),parameters:Oi.optional(),output:Ol.optional(),errors:_e(Di).optional()}),ev=pe({type:fe("procedure"),description:J().optional(),parameters:Oi.optional(),input:Ol.optional(),output:Ol.optional(),errors:_e(Di).optional()}),tv=pe({type:fe("subscription"),description:J().optional(),parameters:Oi.optional(),message:Xx.optional(),errors:_e(Di).optional()}),nv=pe({type:fe("permission-set"),description:J().optional(),title:J().optional(),"title:lang":No.optional(),detail:J().optional(),"detail:lang":No.optional(),permissions:_e(Jx)}),rv=Le(Yx,Qx,ev,tv,nv),sv=Le(rv,Ti,Ef,Pi,Rf),Tf=pe({lexicon:fe(1),id:zx,revision:Be.optional(),description:J().optional(),defs:rn(sv)}),jt=(e,t)=>{const{nsid:n,defId:r}=e;return r==="main"?n:`${n}#${r}`},av=(e,t)=>{const n=e.indexOf("#");if(n===0){if(t===void 0)throw new SyntaxError(`relative ref requires context nsid: ${e}`);return{nsid:t,defId:e.slice(1)}}if(n===-1){if(!zt(e))throw new SyntaxError(`invalid nsid: ${e}`);return{nsid:e,defId:"main"}}const r=e.slice(0,n),s=e.slice(n+1);if(!zt(r))throw new SyntaxError(`invalid nsid in ref: ${r}`);return{nsid:r,defId:s}},Mn=1,yr=18,ja=85,Ua=113,lv=(e,t)=>{if(t.length!==32)throw new RangeError("invalid digest length");const n=Un(36);return n[0]=Mn,n[1]=e,n[2]=yr,n[3]=32,n.set(t,4),{version:Mn,codec:e,digest:{codec:yr,contents:n.subarray(4,36)},bytes:n}},iv=async(e,t)=>{const n=await ma(t);return lv(e,n)},ov=e=>{if(e.length<36)throw new RangeError("cid too short");const t=e[0],n=e[1],r=e[2],s=e[3];if(t!==Mn)throw new RangeError(`incorrect cid version (got v${t})`);if(n!==Ua&&n!==ja)throw new RangeError(`incorrect cid codec (got 0x${n.toString(16)})`);if(r!==yr)throw new RangeError(`incorrect cid digest codec (got 0x${r.toString(16)})`);if(s!==32)throw new RangeError(`incorrect cid digest size (got ${s})`);return[{version:Mn,codec:n,digest:{codec:r,contents:e.subarray(4,36)},bytes:e.subarray(0,36)},e.subarray(36)]},Lf=e=>{const[t,n]=ov(e);if(n.length!==0)throw new RangeError("cid bytes includes remainder");return t},Pf=e=>{if(e.length!==59||e[0]!=="b")throw new SyntaxError("not a valid cid string");const t=zg(e.slice(1));return Lf(t)},ns=e=>`b${wd(e.bytes)}`,cv=e=>{if(e.length!==37||e[0]!==0)throw new SyntaxError("invalid binary cid");return Lf(e.subarray(1))},dv=Symbol.for("@atcute/cid-link-wrapper");class qn{[dv]=!0;bytes;constructor(t){this.bytes=t}get $link(){const t=`b${wd(this.bytes)}`;return Object.defineProperty(this,"$link",{value:t,enumerable:!0}),t}toJSON(){return{$link:this.$link}}}const wr=e=>{const t=e;return t instanceof qn||t!==null&&typeof t=="object"&&typeof t.$link=="string"},If=e=>new qn(e.bytes),uv=Symbol.for("@atcute/bytes-wrapper");class Na{buf;[uv]=!0;constructor(t){this.buf=t}get $bytes(){return Ug(this.buf)}toJSON(){return{$bytes:this.$bytes}}}const ji=e=>{const t=e;return t instanceof Na||t!==null&&typeof t=="object"&&typeof t.$bytes=="string"},fv=e=>new Na(e),$r=e=>e instanceof Na?e.buf:jg(e.$bytes),jl=(e,t)=>{if(t<24)return t;let n;switch(t){case 24:{if(n=ca(e),n<24)throw new TypeError("non-canonical argument encoding");break}case 25:{if(n=gv(e),n<256)throw new TypeError("non-canonical argument encoding");break}case 26:{if(n=Ul(e),n<65536)throw new TypeError("non-canonical argument encoding");break}case 27:{if(n=pv(e),n<4294967296)throw new TypeError("non-canonical argument encoding");break}default:throw new Error(`invalid argument encoding; got ${t}`)}return n},hv=e=>{const n=(e.v??=new DataView(e.b.buffer,e.b.byteOffset,e.b.byteLength)).getFloat64(e.p);return e.p+=8,n},ca=e=>e.b[e.p++],gv=e=>{let t=e.p;const n=e.b,r=n[t++]<<8|n[t++];return e.p=t,r},Ul=e=>{let t=e.p;const n=e.b,r=(n[t++]<<24|n[t++]<<16|n[t++]<<8|n[t++])>>>0;return e.p=t,r},pv=e=>{const t=Ul(e),n=Ul(e);if(t>2097151)throw new RangeError("can't decode integers beyond safe integer range");return t*2**32+n},Df=(e,t)=>{const n=ii(e.b,e.p,t);return e.p+=t,n},mv=(e,t)=>{const n=e.b.subarray(e.p,e.p+=t);return fv(n)},bv=(e,t)=>{const n=cv(e.b.subarray(e.p,e.p+=t));return new qn(n.bytes)},Mo=e=>{const t=ca(e),n=t>>5;if(n!==3)throw new TypeError(`expected map to only have string keys; got type ${n}`);const r=t&31,s=r<24?r:jl(e,r);return Df(e,s)},Nl=e=>{const t=e.length,n={b:e,v:null,p:0};let r=null,s;e:for(;n.p<t;){const a=ca(n),l=a>>5,i=a&31,o=l===7?0:i<24?i:jl(n,i);switch(l){case 0:{s=o;break}case 1:{s=-1-o;break}case 2:{s=mv(n,o);break}case 3:{s=Df(n,o);break}case 4:{if(o>0){r={t:1,c:s=new Array(o),k:null,r:o,n:r};continue e}s=[];break}case 5:{if(s={},o>0){const c=Mo(n);r={t:0,c:s,k:c,r:o,n:r};continue e}break}case 6:{switch(o){case 42:{const c=ca(n),d=c>>5,h=c&31;if(d!==2)throw new TypeError(`expected cid-link to be type 2 (bytes); got type ${d}`);const g=jl(n,h);s=bv(n,g);break}default:throw new TypeError(`unsupported tag; got ${o}`)}break}case 7:{switch(i){case 20:case 21:{s=i===21;break}case 22:{s=null;break}case 27:{s=hv(n);break}default:throw new Error(`invalid simple value; got ${i}`)}break}default:throw new TypeError(`invalid type; got ${l}`)}for(;r!==null;){switch(r.t){case 0:{const c=r.c,d=r.k;d==="__proto__"&&Object.defineProperty(c,d,{enumerable:!0,configurable:!0,writable:!0}),c[d]=s;break}case 1:{const c=r.c,d=c.length-r.r;c[d]=s;break}}if(--r.r){if(!r.t){const c=r.k,d=Mo(n);if(r.k=d,(d.length-c.length||(d>c?1:d<c?-1:0))<=0)throw new TypeError("map keys are not in canonical order or contain duplicates")}continue e}s=r.c,r=r.n}break}return[s,e.subarray(n.p)]},Et=e=>{const[t,n]=Nl(e);if(n.length!==0)throw new Error("decoded value contains remainder");return t},kr=9,Of=1024,xv=Math.max,vv=Number.isInteger,yv=Number.isFinite,wv=Number.MAX_SAFE_INTEGER,$v=Number.MIN_SAFE_INTEGER,Ut=(e,t)=>{const n=e.b,r=e.p;n.byteLength<r+t&&(e.c.push(n.subarray(0,r)),e.l+=r,e.b=Un(xv(Of,t)),e.v=null,e.p=0)},tl=e=>e<24?1:e<256?2:e<65536?3:e<4294967296?5:9,kv=(e,t)=>{const n=e.b;(e.v??=new DataView(n.buffer,n.byteOffset,n.byteLength)).setFloat64(e.p,t),e.p+=8},Dt=(e,t)=>{e.b[e.p++]=t},_v=(e,t)=>{let n=e.p;const r=e.b;r[n++]=t>>>8,r[n++]=t&255,e.p=n},Sv=(e,t)=>{let n=e.p;const r=e.b;r[n++]=t>>>24,r[n++]=t>>>16&255,r[n++]=t>>>8&255,r[n++]=t&255,e.p=n},Ev=(e,t)=>{let n=e.p;const r=e.b,s=t/2**32|0,a=t>>>0;r[n++]=s>>>24,r[n++]=s>>>16&255,r[n++]=s>>>8&255,r[n++]=s&255,r[n++]=a>>>24,r[n++]=a>>>16&255,r[n++]=a>>>8&255,r[n++]=a&255,e.p=n},an=(e,t,n)=>{n<24?Dt(e,t<<5|n):n<256?(Dt(e,t<<5|24),Dt(e,n)):n<65536?(Dt(e,t<<5|25),_v(e,n)):n<4294967296?(Dt(e,t<<5|26),Sv(e,n)):(Dt(e,t<<5|27),Ev(e,n))},Cv=(e,t)=>{Ut(e,kr),t<0?an(e,1,-t-1):an(e,0,t)},Av=(e,t)=>{Ut(e,9),Dt(e,251),kv(e,t)},Rv=(e,t)=>{if(!yv(t))throw new RangeError("NaN and Infinity values not supported");if(t>wv||t<$v)throw new RangeError("can't encode numbers beyond safe integer range");vv(t)?Cv(e,t):Av(e,t)},Bo=(e,t)=>{const n=t.length;if(n===0){Ut(e,1),Dt(e,96);return}Ut(e,n*3+kr);e:{const i=e.p+tl(n),o=t.charCodeAt(0);if(o>127)break e;e.b[i]=o;let c=1;for(;c+3<n;c+=4){const d=t.charCodeAt(c),h=t.charCodeAt(c+1),g=t.charCodeAt(c+2),p=t.charCodeAt(c+3);if((d|h|g|p)&128)break e;e.b[i+c]=d,e.b[i+c+1]=h,e.b[i+c+2]=g,e.b[i+c+3]=p}for(;c<n;c++){const d=t.charCodeAt(c);if(d>127)break e;e.b[i+c]=d}an(e,3,n),e.p+=n;return}const r=tl(n*2),s=e.p+r,a=wg(e.b,t,s),l=tl(a);r!==l&&e.b.copyWithin(e.p+l,s,s+a),an(e,3,a),e.p+=a},Fo=(e,t)=>{const n=$r(t),r=n.byteLength;Ut(e,r+kr),an(e,2,r),e.b.set(n,e.p),e.p+=r},zo=(e,t)=>{const n=t instanceof qn?t.bytes:Pf(t.$link).bytes,r=n.byteLength+1;Ut(e,r+2*kr),an(e,6,42),an(e,2,r),e.b[e.p]=0,e.b.set(n,e.p+1),e.p+=r},Ml=(e,t)=>{switch(typeof t){case"boolean":return Ut(e,1),Dt(e,244+ +t);case"number":return Rv(e,t);case"string":return Bo(e,t);case"object":{if(t===null)return Ut(e,1),Dt(e,246);if(Array.isArray(t)){const n=t.length;Ut(e,kr),an(e,4,n);for(let r=0;r<n;r++)Ml(e,t[r]);return}if(t.constructor===Object){const n=Pv(t),r=n.length;if(r===1){const s=n[0];if(s==="$link"){if(typeof t.$link=="string"){zo(e,t);return}throw new TypeError("unexpected cid-link value")}if(s==="$bytes"){if(typeof t.$bytes=="string"){Fo(e,t);return}throw new TypeError("unexpected bytes value")}}Ut(e,kr),an(e,5,r);for(let s=0;s<r;s++){const a=n[s];Bo(e,a),Ml(e,t[a])}return}if("$link"in t){if(t instanceof qn||typeof t.$link=="string"){zo(e,t);return}throw new TypeError("unexpected cid-link value")}if("$bytes"in t){if(t instanceof Na||typeof t.$bytes=="string"){Fo(e,t);return}throw new TypeError("unexpected bytes value")}}}throw new TypeError(`unsupported type: ${t}`)},Tv=()=>({c:[],b:Un(Of),v:null,p:0,l:0}),Lv=e=>{const t=Tv();Ml(t,e);const n=t.b.subarray(0,t.p);return t.c.length?(t.c.push(n),md(t.c,t.l+t.p)):n},Pv=e=>{const t=Object.keys(e);let n=0;for(let r=0;r<t.length;r++){const s=t[r];if(e[s]===void 0)continue;const a=s.length;let l=n-1;for(;l>=0;l--){const i=t[l];if(a>i.length||a===i.length&&s>i)break;t[l+1]=i}t[l+1]=s,n++}return t.length=n,t};class Iv{collection;rkey;cid;carEntry;constructor(t,n,r,s){this.collection=t,this.rkey=n,this.cid=r,this.carEntry=s}get bytes(){return this.carEntry.bytes}get record(){return Et(this.bytes)}}const Ui=e=>{if(e===null||typeof e!="object")return!1;const t=e;return t.version===3&&typeof t.did=="string"&&wr(t.data)&&typeof t.rev=="string"&&(t.prev===null||wr(t.prev))&&ji(t.sig)},Zn=128,Xn=127,Dv=2**28,Ov=Math.min,jf=(e,t=0,n=e.length)=>{const r=Ov(t+n,e.length);let s=t;if(s>=r)throw new RangeError("could not decode varint");let a=e[s++],l=a&Xn;if(a<Zn)return{value:l,nextOffset:s};if(s>=r)throw new RangeError("could not decode varint");if(a=e[s++],l|=(a&Xn)<<7,a<Zn)return{value:l,nextOffset:s};if(s>=r)throw new RangeError("could not decode varint");if(a=e[s++],l|=(a&Xn)<<14,a<Zn)return{value:l,nextOffset:s};if(s>=r)throw new RangeError("could not decode varint");if(a=e[s++],l|=(a&Xn)<<21,a<Zn)return{value:l,nextOffset:s};if(s>=r)throw new RangeError("could not decode varint");if(a=e[s++],l+=(a&Xn)*Dv,a<Zn)return{value:l,nextOffset:s};let i=35;do{if(s>=r)throw new RangeError("could not decode varint");a=e[s++],l+=(a&Xn)*2**i,i+=7}while(a>=Zn);return{value:l,nextOffset:s}},Uf=e=>{if(e===null||typeof e!="object")return!1;const{version:t,roots:n}=e;return t===1&&Array.isArray(n)&&n.every(r=>r instanceof qn)},Nf=e=>{const{header:t,nextOffset:n}=jv(e,0);let r=n;return{header:t,roots:t.data.roots,iterate(){return{next(){if(r>=e.length)return{done:!0,value:void 0};const s=r,{value:a,nextOffset:l}=jf(e,r,8);r=l;const i=r,{cid:o,nextOffset:c}=Uv(e,r);r=c;const d=r,h=a-(d-i);if(h<0||d+h>e.length)throw new RangeError("unexpected end of data");const g=d+h,p=e.subarray(d,g);return r=g,{done:!1,value:{cid:o,bytes:p,entryStart:s,entryEnd:g,cidStart:i,cidEnd:d,bytesStart:d,bytesEnd:g}}},[Symbol.iterator](){return this}}},[Symbol.iterator](){return this.iterate()}}},jv=(e,t)=>{const n=t,{value:r,nextOffset:s}=jf(e,t,8);if(r===0)throw new RangeError("invalid car header; length=0");const a=s,l=a+r;if(l>e.length)throw new RangeError("unexpected end of data");const i=Et(e.subarray(a,l));if(!Uf(i))throw new TypeError("expected a car v1 archive");return{header:{data:i,headerStart:n,headerEnd:l,dataStart:a,dataEnd:l},nextOffset:l}},Uv=(e,t)=>{const n=t+36;if(n>e.length)throw new RangeError("unexpected end of data");const r=e.subarray(t,n),s=r[0],a=r[1],l=r[2],i=r[3];if(s!==Mn)throw new RangeError(`incorrect cid version (got v${s})`);if(a!==Ua&&a!==ja)throw new RangeError(`incorrect cid codec (got 0x${a.toString(16)})`);if(l!==yr)throw new RangeError(`incorrect cid digest type (got 0x${l.toString(16)})`);if(i!==32)throw new RangeError(`incorrect cid digest size (got ${i})`);return{cid:{version:s,codec:a,digest:{codec:l,contents:r.subarray(4,36)},bytes:r},nextOffset:n}},Nv=e=>{let t=new Uint8Array(0),n=0,r;const s=e.getReader(),a=async()=>{let o=0,c=0;const d=128,h=127;for(;;){if(t.length===0){const{value:p,done:x}=await s.read();if(x)throw new Error("unexpected eof while decoding varint");t=p}const g=t[0];if(t=t.subarray(1),o+=c<28?(g&h)<<c:(g&h)*2**c,c+=7,n++,(g&d)===0)return o}},l=async o=>{const c=new Uint8Array(o);let d=0;for(;d<o;){if(t.length===0){const{value:g,done:p}=await s.read();if(p)throw new Error("unexpected eof while reading data");t=g}const h=Math.min(o-d,t.length);c.set(t.subarray(0,h),d),d+=h,t=t.subarray(h)}return n+=o,c},i=async()=>{const o=await l(36),c=o[0],d=o[1],h=o[2],g=o[3];if(c!==Mn)throw new RangeError(`incorrect cid version (got v${c})`);if(d!==Ua&&d!==ja)throw new RangeError(`incorrect cid codec (got 0x${d.toString(16)})`);if(h!==yr)throw new RangeError(`incorrect cid digest type (got 0x${h.toString(16)})`);if(g!==32)throw new RangeError(`incorrect cid digest size (got ${g})`);return{version:c,codec:d,digest:{codec:h,contents:o.subarray(4,36)},bytes:o}};return{[Symbol.asyncDispose](){return this.dispose()},async dispose(){await s.cancel()},async header(){if(r!==void 0)return r;const o=n,c=await a();if(c===0)throw new RangeError("invalid car header; length=0");const d=n,h=await l(c),g=Et(h);if(!Uf(g))throw new TypeError("expected a car v1 archive");return r={data:g,headerStart:o,headerEnd:n,dataStart:d,dataEnd:n}},async roots(){return(await this.header()).data.roots},async*[Symbol.asyncIterator](){for(r===void 0&&await this.header();;){if(t.length===0){const{value:w,done:v}=await s.read();if(v)return;t=w}const o=n,c=await a(),d=n,h=await i(),g=n,p=c-(g-d),x=await l(p),y=g,b=n;yield{cid:h,bytes:x,entryStart:o,entryEnd:b,cidStart:d,cidEnd:y,bytesStart:g,bytesEnd:b}}}}},Mv=e=>{if(e===null||typeof e!="object")return!1;const t=e;return typeof t.p=="number"&&ji(t.k)&&wr(t.v)&&(t.t===null||wr(t.t))},Mf=e=>{if(e===null||typeof e!="object")return!1;const t=e;return(t.l===null||wr(t.l))&&Array.isArray(t.e)&&t.e.every(Mv)},Os=(e,t)=>{if(!e)throw new Error(t)},Bv=e=>{const t=e.indexOf("/");return Os(t!==-1,`invalid mst key; key=${e}`),{collection:e.slice(0,t),rkey:e.slice(t+1)}},Vo=(e,t)=>({value:e,next:t});class Fv{#e;#t;#n=0;get size(){return this.#n}clear(){this.#e=void 0,this.#t=void 0,this.#n=0}enqueue(t){const n=this.#t,r=Vo(t,void 0);return n!==void 0?n.next=r:this.#e=r,this.#t=r,this.#n++,this}enqueueFront(t){const n=this.#e,r=Vo(t,n);return n===void 0&&(this.#t=r),this.#e=r,this.#n++,this}dequeue(){const t=this.#e;if(!t)return;const n=t.next;return this.#e=n,n===void 0&&(this.#t=void 0),this.#n--,t.value}peek(){return this.#e?.value}drain(){const t=this;return{next(){const n=t.#e;if(!n)return{done:!0,value:void 0};const r=n.next;return t.#e=r,r===void 0&&(t.#t=void 0),t.#n--,{done:!1,value:n.value}},[Symbol.iterator](){return this}}}[Symbol.iterator](){let t=this.#e;return{next(){if(t===void 0)return{done:!0,value:void 0};const n=t.value;return t=t.next,{done:!1,value:n}}}}}const Bf=e=>{let t=[];return{get missingBlocks(){return t},async dispose(){},[Symbol.asyncDispose](){return this.dispose()},async*[Symbol.asyncIterator](){const n=Nv(e);try{const r=new Map,s=new Map,a=new Fv,l=(i,o)=>{const c=s.get(i);c!==void 0?(s.delete(i),a.enqueue({c:i,e:c,m:o})):r.set(i,o)};{const i=await n.roots();Os(i.length===1,`expected only 1 root in the car archive; got=${i.length}`);const o=i[0].$link;l(o,{t:0})}for await(const i of n){const o=ns(i.cid);{const d=r.get(o);d!==void 0?(r.delete(o),a.enqueue({c:o,e:i,m:d})):s.set(o,i)}let c;for(;c=a.dequeue();){const{c:d,e:h,m:g}=c;switch(g.t){case 0:{const p=Et(h.bytes);Os(Ui(p),`expected commit block; cid=${d}`),l(p.data.$link,{t:1});break}case 1:{const p=Et(h.bytes);Os(Mf(p),`expected mst node block; cid=${d}`);const x=p.e,y=p.l;let b="";y!==null&&l(y.$link,g);for(let $=0,w=x.length;$<w;$++){const v=x[$],_=v.t,E=ii($r(v.k)),S=b.slice(0,v.p)+E;b=S,l(v.v.$link,{t:2,k:S}),_!==null&&l(_.$link,{t:1})}break}case 2:{const{collection:p,rkey:x}=Bv(g.k);yield new Iv(p,x,If(h.cid),h);break}}}}t=Array.from(r,([i,o])=>{switch(o.t){case 0:return{cid:i,type:"commit"};case 1:return{cid:i,type:"mst-node"};case 2:return{cid:i,type:"record",key:o.k}}})}finally{await n.dispose()}}}},Ff=async({did:e,collection:t,rkey:n,publicKey:r,carBytes:s})=>{let a,l;{const c=Nf(s);if(c.header.data.roots.length!==1)throw new Error("car must have exactly one root");a=new Map;for(const d of c){const h=ns(d.cid),g=ns(await iv(d.cid.codec,d.bytes));if(h!==g)throw new Error("cid does not match bytes");a.set(h,d.bytes)}if(a.size===0)throw new Error("car must have at least one block");l=zv(a,c.header.data.roots[0].$link,Ui)}if(e!==void 0&&l.did!==e)throw new Error("did in commit does not match expected did");if(r){const{sig:c,...d}=l,h=Lv(d);if(!await r.verify($r(c),h))throw new Error("signature verification failed")}const i=`${t}/${n}`,{found:o}=await Bl(a,l.data.$link,i);if(!o)throw new Error("could not find record in car");return{cid:o.cid,record:o.record}},zv=(e,t,n)=>{const r=e.get(t);if(!r)throw new Error(`cid not found in blockmap; cid=${t}`);const s=Et(r);if(!n(s))throw new Error(`validation failed for cid=${t}`);return s},Bl=async(e,t,n,r=new Set)=>{if(t==null)return{found:!1};{if(r.has(t))throw new Error(`cycle detected; cid=${t}`);r.add(t)}let s;{const h=e.get(t);if(!h)return{found:!1};const g=Et(h);if(!Mf(g))throw new Error(`invalid mst node; cid=${t}`);s=g}const a=await Bl(e,s.l?.$link,n,r);let l="",i=a.found,o,c,d;for(const h of s.e){if(l=l.substring(0,h.p)+ii($r(h.k)),l===n){const b=e.get(h.v.$link);if(b){const $=Et(b);i={cid:h.v.$link,record:$}}}const g=await ma(pa(l));let p=0;e:for(const b of g)for(let $=7;$>=0;$--){if((b>>$&1)!==0)break e;p++}const x=Math.floor(p/2);if(o===void 0)o=x;else if(o!==x)throw new Error(`node has entries with different depths; cid=${t}`);if(d===void 0&&(c=l,d=l),d>l)throw new Error(`entries are out of order; cid=${t}`);const y=await Bl(e,h.t?.$link,n,r);if(y.min&&y.min<d)throw new Error(`entries are out of order; cid=${t}`);if(i=i||y.found,a.depth!==void 0&&a.depth>=x)throw new Error(`depths are out of order; cid=${t}`);if(y.depth!==void 0&&y.depth>=x)throw new Error(`depths are out of order; cid=${t}`);d=y.max??l}if(a.max&&c&&a.max>c)throw new Error(`entries are out of order; cid=${t}`);return{found:i,min:c,max:d,depth:o}},Ss="com.atproto.lexicon.schema";class Vv{didDocumentResolver;#e;constructor({didDocumentResolver:t,fetch:n=fetch}){this.didDocumentResolver=t,this.#e=n}async resolve(t,n,r){const s=await this.didDocumentResolver.resolve(t,{signal:r?.signal,noCache:r?.noCache}),a=cs(s);if(!a)throw new Tl(n,{cause:new TypeError(`no pds service in did document; did=${t}`)});let l;try{const d=new URL("/xrpc/com.atproto.sync.getRecord",a);d.searchParams.set("did",t),d.searchParams.set("collection",Ss),d.searchParams.set("rkey",n);const h=await(0,this.#e)(d,{signal:r?.signal,cache:r?.noCache?"no-cache":void 0,headers:{accept:"application/vnd.ipld.car"}});if(!h.ok)throw new ds(h);l=await h.bytes()}catch(d){throw new Tl(n,{cause:d})}let i;try{const d=Cm(s);if(!d)throw new Error("did document does not contain verification material");const h=jx(d);let g;switch(h.type){case"p256":{g=await oa.importRaw(h.publicKeyBytes);break}case"secp256k1":{g=await Ai.importRaw(h.publicKeyBytes);break}}i=await Ff({did:t,collection:Ss,rkey:n,publicKey:g,carBytes:l})}catch(d){throw new Zb(n,{cause:d})}const o=i.record;if(typeof o!="object"||o===null||o.$type!==Ss||o.id!==n)throw new So(n);let c;try{c=Tf.parse(o,{mode:"passthrough"})}catch(d){throw new So(n,{cause:d})}return{uri:`at://${t}/${Ss}/${n}`,cid:i.cid,rawSchema:i.record,schema:c}}}const Ko="234567abcdefghijklmnopqrstuvwxyz",Ho=(()=>{const e=new Int16Array(123);e.fill(-1);for(let t=0;t<Ko.length;t++){const n=Ko.charCodeAt(t);e[n]=t}return e})(),Kv=/^[234567abcdefghij][234567abcdefghijklmnopqrstuvwxyz]{12}$/,fn=e=>{if(e.length!==13)throw new Error("invalid TID");let t=0,n=0;for(let r=0;r<13;r++){const s=e.charCodeAt(r),a=s<Ho.length?Ho[s]:-1;if(a<0||r===0&&a>15)throw new Error("invalid TID");r<11?t=t*32+a:n=n*32+a}return{timestamp:t,clockid:n}},hn=e=>e.length===13&&Kv.test(e),Ct=e=>new Date(e-new Date().getTimezoneOffset()*60*1e3).toISOString().split(".")[0].replace("T"," ");var Hv=m('<span class="iconify i-tangled size-4">'),qv=m("<img src=https://web-cdn.bsky.app/static/apple-touch-icon.png class=size-4>"),Wv=m('<span class="iconify lucide--globe size-4 text-neutral-400 dark:text-neutral-500">'),Gv=m("<img class=size-4>"),Zv=m('<div class="flex h-5 w-4 shrink-0 items-center justify-center">');const _r=e=>{const[t,n]=T(!1),r=()=>e.authority.split(".").reverse().join("."),s=u(Zc,{get children(){return[u(or,{get when(){return r()==="tangled.sh"||r()==="tangled.org"},get children(){return Hv()}}),u(or,{get when(){return["bsky.app","bsky.chat"].includes(r())},get children(){return qv()}}),u(or,{when:!0,get children(){return[u(k,{get when(){return!t()},get children(){return Wv()}}),(()=>{var a=Gv();return a.addEventListener("error",()=>n(!1)),a.addEventListener("load",()=>n(!0)),z(l=>{var i=`https://${r()}/favicon.ico`,o=!t();return i!==l.e&&ae(a,"src",l.e=i),o!==l.t&&a.classList.toggle("hidden",l.t=o),l},{e:void 0,t:void 0}),a})()]}})]}});return e.wrapper?e.wrapper(s):(()=>{var a=Zv();return f(a,s),a})()};var Xv=m('<kbd class="ml-2 rounded border border-neutral-300 bg-neutral-100 px-1.5 py-0.5 font-mono text-[10px] dark:border-neutral-600 dark:bg-neutral-700">'),Jv=m('<span class="dark:shadow-dark-700 dark:bg-dark-300 pointer-events-none absolute left-[50%] z-20 hidden min-w-fit rounded border-[0.5px] border-neutral-300 bg-white p-1 text-center font-sans text-xs font-normal whitespace-nowrap text-neutral-900 shadow-md select-none group-hover/tooltip:inline first-letter:capitalize dark:border-neutral-600 dark:text-neutral-200"style="transform:translate(-50%, 28px)">'),Yv=m('<span class="group/tooltip relative inline-flex items-center">');const ot=e=>(()=>{var t=Yv();return f(t,()=>e.children,null),f(t,u(k,{when:Ke,get children(){var n=Jv();return f(n,()=>e.text,null),f(n,u(k,{get when(){return e.shortcut},get children(){var r=Xv();return f(r,()=>e.shortcut),r}}),null),n}}),null),t})();var Qv=m('<button type=button class="-mr-2 hidden items-center rounded px-2 py-1 text-neutral-500 transition-all duration-200 group-hover:flex hover:bg-neutral-200/70 hover:text-neutral-600 active:bg-neutral-300/70 sm:py-1.5 dark:text-neutral-400 dark:hover:bg-neutral-700/70 dark:hover:text-neutral-300 dark:active:bg-neutral-600/70"aria-label="Copy to clipboard"><span class="iconify lucide--copy">'),ey=m("<span>"),ty=m('<span class="py-0.5 font-medium text-red-500 dark:text-red-400">'),ny=m("<img class=size-4>"),ry=m('<div class="relative flex h-5 w-3.5 shrink-0 items-center justify-center sm:w-4"><span class="iconify lucide--book-user absolute text-neutral-500 transition-colors duration-200 group-hover:text-neutral-700 dark:text-neutral-400 dark:group-hover:text-neutral-200">'),qo=m('<span class="max-w-full shrink-0 truncate">'),sy=m("<span class=truncate>(<!>)"),ay=m('<div class="group relative flex items-center justify-between gap-1 rounded-md border-[0.5px] border-transparent bg-transparent px-2 transition-all duration-200 hover:border-neutral-300 hover:bg-neutral-50/40 dark:hover:border-neutral-600 dark:hover:bg-neutral-800/40"><div class="flex min-w-0 basis-full items-center gap-2">'),ly=m('<div class="relative flex h-5 w-3.5 shrink-0 items-center justify-center sm:w-4">'),iy=m('<div class="group flex items-center justify-between gap-2 rounded-md border-[0.5px] border-transparent bg-transparent px-2 transition-all duration-200 hover:border-neutral-300 hover:bg-neutral-50/40 dark:hover:border-neutral-600 dark:hover:bg-neutral-800/40"><div class="flex basis-full items-center gap-2">'),oy=m('<span class="iconify lucide--file-json text-neutral-500 transition-colors duration-200 group-hover:text-neutral-700 dark:text-neutral-400 dark:group-hover:text-neutral-200">'),Wo=m('<span class="truncate text-neutral-500 dark:text-neutral-400">(<!>)'),cy=m('<div class="group flex items-center justify-between gap-2 rounded-md border-[0.5px] border-transparent bg-transparent px-2 transition-all duration-200 hover:border-neutral-300 hover:bg-neutral-50/40 dark:hover:border-neutral-600 dark:hover:bg-neutral-800/40"><div class="flex basis-full items-center gap-2"><div class="flex min-w-0 gap-1 py-0.5 font-medium"><span>'),dy=m('<nav class="flex w-full flex-col text-sm wrap-anywhere sm:text-base"><div class="group relative flex items-center justify-between gap-1 rounded-md border-[0.5px] border-transparent bg-transparent px-2 transition-all duration-200 hover:border-neutral-300 hover:bg-neutral-50/40 dark:hover:border-neutral-600 dark:hover:bg-neutral-800/40"><div class="flex min-h-6 basis-full items-center gap-2 sm:min-h-7"></div></div><div class="flex flex-col">'),Go=m('<span class="py-0.5 font-medium">'),uy=m('<span class="flex min-w-0 gap-1 py-0.5 font-medium">'),Zo=m("<span class=truncate>"),fy=m('<span class="iconify lucide--folder-open text-neutral-500 transition-colors duration-200 group-hover:text-neutral-700 dark:text-neutral-400 dark:group-hover:text-neutral-200">');const[ze,js]=T(),Es=e=>u(k,{when:Ke,get children(){return u(ot,{get text(){return e.label},get children(){var t=Qv();return t.$$click=n=>{n.preventDefault(),n.stopPropagation(),mr(e.content)},t}})}}),hy=e=>{const[t,n]=T(e.params.repo),[r,s]=T(!1),[a,l]=T(!1),[i,o]=T(!1),[c,d]=T(!1),h=()=>t()&&!t().endsWith(".bsky.social");Ue(()=>{if(ze()!==void 0&&e.params.repo){const p=hs[e.params.repo]?.alsoKnownAs?.filter(x=>x.startsWith("at://"))[0]?.split("at://")[1]??e.params.repo;p!==t()&&n(p)}}),Ue(()=>{t(),l(!1),o(!1)});const g=ce(()=>{if(!e.params.rkey||!hn(e.params.rkey))return;const p=fn(e.params.rkey).timestamp/1e3;return p<=Date.now()?p:void 0});return(()=>{var p=dy(),x=p.firstChild,y=x.firstChild,b=x.nextSibling;return f(y,u(ot,{text:"PDS",get children(){var $=ey();return z(w=>ye($,{"iconify shrink-0 transition-colors duration-200":!0,"lucide--unplug text-red-500 dark:text-red-400":ze()==="Missing PDS"&&e.params.repo?.startsWith("did:"),"lucide--hard-drive text-neutral-500 group-hover:text-neutral-700 dark:text-neutral-400 dark:group-hover:text-neutral-200":ze()!=="Missing PDS"||!e.params.repo?.startsWith("did:")},w)),$}}),null),f(y,u(k,{get when(){return X(()=>!!ze())()&&(ze()!=="Missing PDS"||e.params.repo?.startsWith("did:"))},get children(){return u(k,{get when(){return ze()==="Missing PDS"},get fallback(){return u(k,{get when(){return e.params.repo},get fallback(){return(()=>{var $=Go();return f($,ze),$})()},get children(){return u(Ie,{end:!0,get href(){return ze()},inactiveClass:"text-blue-500 py-0.5 w-full font-medium hover:text-blue-600 transition-colors duration-150 dark:text-blue-400 dark:hover:text-blue-300",get children(){return ze()}})}})},get children(){var $=ty();return f($,ze),$}})}}),null),f(x,u(k,{get when(){return X(()=>!!ze())()&&ze()!=="Missing PDS"},get children(){return u(Es,{get content(){return ze()},label:"Copy PDS"})}}),null),f(b,u(k,{get when(){return e.params.repo},get children(){var $=ay(),w=$.firstChild;return $.addEventListener("mouseleave",()=>{Ke&&s(!1)}),$.addEventListener("mouseenter",()=>{Ke&&(s(!0),l(!0))}),f(w,u(ot,{text:"Repository",get children(){var v=ry(),_=v.firstChild;return f(v,u(k,{get when(){return X(()=>!!a())()&&h()},get children(){var E=ny();return E.addEventListener("error",()=>o(!1)),E.addEventListener("load",()=>o(!0)),z(S=>{var C=`https://${t()}/favicon.ico`,A=!r()||!i();return C!==S.e&&ae(E,"src",S.e=C),A!==S.t&&E.classList.toggle("hidden",S.t=A),S},{e:void 0,t:void 0}),E}}),null),z(()=>_.classList.toggle("hidden",!!(r()&&h()&&i()))),v}}),null),f(w,u(k,{get when(){return e.params.collection},get fallback(){return(()=>{var v=uy();return f(v,u(k,{get when(){return t()!==e.params.repo},get fallback(){return(()=>{var _=Zo();return f(_,()=>e.params.repo),_})()},get children(){return[(()=>{var _=qo();return f(_,t),_})(),(()=>{var _=Wo(),E=_.firstChild,S=E.nextSibling;return S.nextSibling,f(_,()=>e.params.repo,S),_})()]}})),v})()},get children(){return u(Ie,{end:!0,get href(){return`/at://${e.params.repo}`},inactiveClass:"flex grow min-w-0 gap-1 py-0.5 font-medium text-blue-500 hover:text-blue-600 transition-colors duration-150 dark:text-blue-400 dark:hover:text-blue-300",get children(){return u(k,{get when(){return t()!==e.params.repo},get fallback(){return(()=>{var v=Zo();return f(v,()=>e.params.repo),v})()},get children(){return[(()=>{var v=qo();return f(v,t),v})(),(()=>{var v=sy(),_=v.firstChild,E=_.nextSibling;return E.nextSibling,f(v,()=>e.params.repo,E),v})()]}})}})}}),null),f($,u(Es,{get content(){return e.params.repo},label:"Copy DID"}),null),$}}),null),f(b,u(k,{get when(){return e.params.collection},get children(){var $=iy(),w=$.firstChild;return $.addEventListener("mouseleave",()=>{Ke&&d(!1)}),$.addEventListener("mouseenter",()=>{Ke&&d(!0)}),f(w,u(ot,{text:"Collection",get children(){var v=ly();return f(v,u(k,{get when(){return c()},get fallback(){return fy()},get children(){return(()=>{const _=e.params.collection.split("."),E=`${_[0]}.${_[1]}`;return u(_r,{authority:E,wrapper:S=>S})})()}})),v}}),null),f(w,u(k,{get when(){return e.params.rkey},get fallback(){return(()=>{var v=Go();return f(v,()=>e.params.collection),v})()},get children(){return u(Ie,{end:!0,get href(){return`/at://${e.params.repo}/${e.params.collection}`},inactiveClass:"text-blue-500 dark:text-blue-400 grow py-0.5 font-medium hover:text-blue-600 transition-colors duration-150 dark:hover:text-blue-300",get children(){return e.params.collection}})}}),null),f($,u(Es,{get content(){return`at://${e.params.repo}/${e.params.collection}`},label:"Copy AT URI"}),null),$}}),null),f(b,u(k,{get when(){return e.params.rkey},get children(){var $=cy(),w=$.firstChild,v=w.firstChild,_=v.firstChild;return f(w,u(ot,{text:"Record",get children(){return oy()}}),v),f(_,()=>e.params.rkey),f(v,u(k,{get when(){return g()},get children(){var E=Wo(),S=E.firstChild,C=S.nextSibling;return C.nextSibling,f(E,()=>Ct(g()),C),E}}),null),f($,u(Es,{get content(){return`at://${e.params.repo}/${e.params.collection}/${e.params.rkey}`},label:"Copy AT URI"}),null),$}}),null),p})()};ke(["click"]);var gy=m("<input>");const Kt=e=>(()=>{var t=gy();$t(t,"input",e.onInput,!0);var n=e.ref;return typeof n=="function"?Ne(n,t):e.ref=t,z(r=>{var s=e.type??"text",a=e.id,l=e.name,i=e.spellcheck??!1,o=e.placeholder,c=e.disabled,d=e.required,h="dark:bg-dark-100 rounded-md bg-white px-2 py-1 outline-1 outline-neutral-200 select-none placeholder:text-sm focus:outline-neutral-400 dark:outline-neutral-600 dark:focus:outline-neutral-400 "+e.class;return s!==r.e&&ae(t,"type",r.e=s),a!==r.t&&ae(t,"id",r.t=a),l!==r.a&&ae(t,"name",r.a=l),i!==r.o&&ae(t,"spellcheck",r.o=i),o!==r.i&&ae(t,"placeholder",r.i=o),c!==r.n&&(t.disabled=r.n=c),d!==r.s&&(t.required=r.s=d),h!==r.h&&he(t,r.h=h),r},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0,n:void 0,s:void 0,h:void 0}),z(()=>t.value=e.value??""),t})();ke(["input"]);var py=m("<button>"),my=m('<div class="flex flex-col gap-1"><label class="font-medium select-none">Theme</label><div class="flex gap-2">');const by=()=>{if(localStorage.getItem("theme")!==null)return;const e=window.matchMedia("(prefers-color-scheme: dark)").matches;document.documentElement.classList.toggle("dark",e)},xy=()=>{const[e,t]=T(localStorage.getItem("theme")===null?"auto":localStorage.theme==="dark"?"dark":"light"),n=s=>{t(s),document.documentElement.classList.toggle("dark",s==="dark"||s==="auto"&&window.matchMedia("(prefers-color-scheme: dark)").matches),s==="auto"?localStorage.removeItem("theme"):localStorage.theme=s},r=s=>(()=>{var a=py();return a.$$click=()=>n(s.theme),f(a,()=>s.label),z(l=>ye(a,{"flex items-center min-w-21 justify-center rounded-xl border px-3 py-2":!0,"bg-neutral-200/60 border-neutral-300 dark:border-neutral-500 dark:bg-neutral-700":e()===s.theme,"border-neutral-200 dark:border-neutral-600 hover:bg-neutral-200/30 dark:hover:bg-neutral-800":e()!==s.theme},l)),a})();return(()=>{var s=my(),a=s.firstChild,l=a.nextSibling;return f(l,u(r,{theme:"auto",label:"Auto"}),null),f(l,u(r,{theme:"light",label:"Light"}),null),f(l,u(r,{theme:"dark",label:"Dark"}),null),s})()};ke(["click"]);var vy=m('<div class="flex w-full flex-col gap-2 px-2"><div class="text-lg font-semibold">Settings</div><div class="flex flex-col gap-3"><div class="flex flex-col gap-1"><label for=plcDirectory class="font-medium select-none">PLC Directory</label></div><div class="flex flex-col gap-1"><label class="font-medium select-none">Blob media preview</label><div class="flex gap-2"><button>Show</button><button>Hide</button></div></div><div class="flex flex-col gap-1"><label class="font-medium select-none">Version</label><div class="text-sm text-neutral-600 dark:text-neutral-400">');const[ar,Xo]=T(localStorage.hideMedia==="true"),[gn,Jo]=T(localStorage.plcDirectory||"https://plc.directory"),yy=()=>(()=>{var e=vy(),t=e.firstChild,n=t.nextSibling,r=n.firstChild;r.firstChild;var s=r.nextSibling,a=s.firstChild,l=a.nextSibling,i=l.firstChild,o=i.nextSibling,c=s.nextSibling,d=c.firstChild,h=d.nextSibling;return f(e,u(Rt,{children:"Settings - PDSls"}),t),f(r,u(Kt,{id:"plcDirectory",get value(){return gn()},onInput:g=>{const p=g.currentTarget.value;p.length?(localStorage.plcDirectory=p,Jo(p)):(localStorage.removeItem("plcDirectory"),Jo("https://plc.directory"))}}),null),f(n,u(xy,{}),s),i.$$click=()=>{localStorage.hideMedia="false",Xo(!1)},o.$$click=()=>{localStorage.hideMedia="true",Xo(!0)},f(h,()=>"v1.5.0.dev12+g1d13b66"),z(g=>{var p={"flex min-w-21 items-center justify-center gap-1 rounded-xl border px-3 py-2":!0,"border-neutral-300 bg-neutral-200/60 dark:border-neutral-500 dark:bg-neutral-700":!ar(),"border-neutral-200 hover:bg-neutral-200/30 dark:border-neutral-600 dark:hover:bg-neutral-800":ar()},x={"flex min-w-21 items-center justify-center gap-1 rounded-xl border px-3 py-2":!0,"border-neutral-300 bg-neutral-200/60 dark:border-neutral-500 dark:bg-neutral-700":ar(),"border-neutral-200 hover:bg-neutral-200/30 dark:border-neutral-600 dark:hover:bg-neutral-800":!ar()};return g.e=ye(i,p,g.e),g.t=ye(o,x,g.t),g},{e:void 0,t:void 0}),e})();ke(["click"]);const fs=ce(()=>new Um({methods:{plc:new Gm({apiUrl:gn()}),web:new Zm}})),Ni=new Xm({strategy:"dns-first",methods:{dns:new Cu({dohUrl:"https://dns.google/resolve?"}),http:new Au}}),wy=new Yb({dohUrl:"https://dns.google/resolve?"}),$y=ce(()=>new Vv({didDocumentResolver:fs()})),nl={},[Fl,ky]=zn({}),hs={},zf=async e=>{if(e in nl)return nl[e];if(!Rr(e))throw new Error("Not a valid DID identifier");let t;try{t=await fs().resolve(e),hs[e]=t}catch(s){throw console.error(s),new Error("Error during did document resolution")}const n=cs(t),r=Am(t);if(r&&ky(e,r),!n)throw new Error("No PDS found");return nl[e]=n},Ma=async e=>{if(!Kn(e))throw new Error("Not a valid handle");return await Ni.resolve(e)},Mi=async e=>{if(!Rr(e))throw new Error("Not a valid DID identifier");return await fs().resolve(e)},_y=async(e,t)=>{if(!Kn(e))return!1;let n;try{n=await Ni.resolve(e)}catch(r){return console.error(r),!1}return n===t},Ba=async e=>{try{js(void 0);const t=await zf(e);if(!t)throw new Error("No PDS found");return js(t.replace("https://","").replace("http://","")),t}catch(t){throw js("Missing PDS"),t}},Wn=async e=>await wy.resolve(e),Sy=async e=>{const t="https://dns.google/resolve?",r=`_lexicon.${e.split(".").reverse().join(".")}`,s=new URL(t);s.searchParams.set("name",r),s.searchParams.set("type","TXT");const a=await fetch(s.toString());if(!a.ok)throw new Error(`Failed to resolve lexicon authority for ${e}`);const l=await a.json();if(!l.Answer||l.Answer.length===0)throw new Error(`No lexicon authority found for ${e}`);const i=l.Answer[0].data.replace(/"/g,"");if(!i.startsWith("did="))throw new Error(`Invalid lexicon authority record for ${e}`);return i.replace("did=","")},Ey=async(e,t)=>await $y().resolve(e,t),Vf=async(e,t,n,r,s,a)=>{const l=new URL("https://constellation.microcosm.blue");if(l.pathname=e,l.searchParams.set("target",t),n){if(!r)throw new Error("collection and path must either both be set or neither");l.searchParams.set("collection",n),l.searchParams.set("path",r)}else if(r)throw new Error("collection and path must either both be set or neither");a&&l.searchParams.set("limit",`${a}`),s&&l.searchParams.set("cursor",`${s}`);const i=await fetch(l,{signal:AbortSignal.timeout(5e3)});if(!i.ok)throw new Error("failed to fetch from constellation");return await i.json()},Cy=e=>Vf("/links/all",e),Ay=(e,t,n,r,s)=>Vf("/links",e,t,n,r,100),Ry=async e=>{const t=new Cu({dohUrl:"https://dns.google/resolve?"}),n=new Au,r=async(l,i=5e3)=>{try{const o=new Promise((d,h)=>setTimeout(()=>h(new Error("Request timed out")),i));return{success:!0,did:await Promise.race([l.resolve(e),o])}}catch(o){return{success:!1,error:o.message??String(o)}}},[s,a]=await Promise.all([r(t),r(n)]);return{dns:s,http:a}},Ty={resolve:async e=>fs().resolve(e)};pg({metadata:{client_id:"https://pdsls.tngl.io/oauth-client-metadata.json",redirect_uri:"https://pdsls.tngl.io/"},identityResolver:new jm({handleResolver:Ni,didDocumentResolver:Ty})});const Kf=(e={})=>{const[t,n]=T(!1),[r,s]=T(""),[a,l]=T(!1);return{showScopeSelector:t,pendingAccount:r,initiate:h=>{h&&(s(h),l(!1),n(!0))},initiateWithRedirect:h=>{h&&(s(h),l(!0),n(!0))},complete:async(h,g)=>{try{const p=r();if(e.beforeRedirect&&!a())try{await e.beforeRedirect(p),n(!1);return}catch{}localStorage.setItem("pendingScopes",g),e.onRedirecting?.();const x=await Bp({scope:h,target:Kn(p)||Vn(p)?{type:"account",identifier:p}:{type:"pds",serviceUrl:p}});await new Promise(y=>setTimeout(y,250)),location.assign(x)}catch(p){console.error(p),e.onError?.(p),n(!1)}},cancel:()=>{n(!1),s(""),l(!1)}}},[xe,Hf]=T(),[wt,qf]=zn(),[Sn,Ly]=zn(),[Py,Vr]=T(!1),[Yo,Br]=T(!1),[Iy,Wf]=T(null),Bi=[{id:"create",scope:"repo:*?action=create",label:"Create records"},{id:"update",scope:"repo:*?action=update",label:"Update records"},{id:"delete",scope:"repo:*?action=delete",label:"Delete records"},{id:"blob",scope:"blob:*/*",label:"Upload blobs"}],Dy=["atproto"],Oy=e=>{const t=Bi.filter(n=>e.has(n.id)).map(n=>n.scope);return[...Dy,...t].join(" ")},jy=e=>["atproto",...Array.from(e)].join(","),Uy=e=>{if(!e)return new Set;const t=e.split(",").filter(Boolean);return new Set(t.filter(n=>n!=="atproto"))},Ny=(e,t)=>e?e.split(",").includes(t):!1,on=e=>{if(!xe())return!1;const t=wt[xe().sub]?.grantedScopes;return t?Ny(t,e):!0};var My=m('<div class="flex flex-col gap-y-3"><div class="flex items-center gap-2"><button class="flex items-center rounded-md p-1 hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600"><span class="iconify lucide--arrow-left"></span></button><div class=font-semibold>Select permissions</div></div><div class="flex flex-col px-1"></div><button class="dark:hover:bg-dark-200 dark:active:bg-dark-100 flex w-full items-center justify-center gap-2 rounded-lg border border-neutral-200 px-3 py-2 hover:bg-neutral-100 active:bg-neutral-200 dark:border-neutral-700">Continue'),By=m('<button class="group flex items-center gap-3 py-1.5"><div class="flex size-5 items-center justify-center rounded border-2"></div><span>'),Fy=m('<span class="iconify lucide--check text-sm text-white">');const Gf=e=>{const[t,n]=T(e.initialScopes||new Set(["create","update","delete","blob"])),r=()=>{const l=t();return!l.has("create")&&!l.has("update")},s=l=>{n(i=>{const o=new Set(i);return o.has(l)?(o.delete(l),(l==="create"||l==="update")&&!o.has("create")&&!o.has("update")&&o.delete("blob")):o.add(l),o})},a=()=>{const l=t(),i=Oy(l),o=jy(l);e.onConfirm(i,o)};return(()=>{var l=My(),i=l.firstChild,o=i.firstChild,c=i.nextSibling,d=c.nextSibling;return $t(o,"click",e.onCancel,!0),f(c,u(oe,{each:Bi,children:h=>{const g=()=>t().has(h.id),p=()=>h.id==="blob"&&r();return(()=>{var x=By(),y=x.firstChild,b=y.nextSibling;return x.$$click=()=>!p()&&s(h.id),f(y,(()=>{var $=X(()=>!!g());return()=>$()&&Fy()})()),f(b,()=>h.label),z($=>{var w=p(),v=!!p(),_={"bg-blue-500 border-transparent group-hover:bg-blue-600 group-active:bg-blue-400":g()&&!p(),"border-neutral-400 dark:border-neutral-500 group-hover:border-neutral-500 dark:group-hover:border-neutral-400 group-hover:bg-neutral-100 dark:group-hover:bg-neutral-800":!g()&&!p(),"border-neutral-300 dark:border-neutral-600":p()};return w!==$.e&&(x.disabled=$.e=w),v!==$.t&&x.classList.toggle("opacity-50",$.t=v),$.a=ye(y,_,$.a),$},{e:void 0,t:void 0,a:void 0}),x})()}})),d.$$click=a,l})()};ke(["click"]);var zy=m('<div class="flex items-center gap-2"><button class="flex items-center rounded-md p-1 hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600"><span class="iconify lucide--arrow-left"></span></button><div class=font-semibold>Add account'),Vy=m('<form class="flex flex-col gap-3"><label for=username class=hidden>Add account</label><input type=text placeholder=user.bsky.social id=username name=username autocomplete=username aria-label="Your AT Protocol handle"class="dark:bg-dark-100 rounded-lg bg-white px-2.5 py-2 outline-1 outline-neutral-200 select-none focus:outline-neutral-400 dark:outline-neutral-600 dark:focus:outline-neutral-400"><button class="dark:hover:bg-dark-200 dark:active:bg-dark-100 flex w-full items-center justify-center gap-2 rounded-lg border border-neutral-200 px-3 py-2 hover:bg-neutral-100 active:bg-neutral-200 dark:border-neutral-700">Continue'),Ky=m("<div class=text-sm>"),Hy=m('<div class="flex flex-col gap-y-3">');const qy=e=>{const[t,n]=T(""),[r,s]=T(""),a=Kf({onError:o=>n(`${o}`),onRedirecting:()=>{n("Contacting your data server..."),setTimeout(()=>n("Redirecting..."),0)}}),l=o=>{n(""),a.initiate(o)},i=()=>{a.cancel(),s(""),n(""),e.onCancel?.()};return(()=>{var o=Hy();return f(o,u(k,{get when(){return!a.showScopeSelector()},get children(){return[u(k,{get when(){return e.onCancel},get children(){var c=zy(),d=c.firstChild;return d.$$click=i,c}}),(()=>{var c=Vy(),d=c.firstChild,h=d.nextSibling,g=h.nextSibling;return c.addEventListener("submit",p=>p.preventDefault()),h.$$input=p=>s(p.currentTarget.value),Ne(p=>setTimeout(()=>p.focus()),h),ae(h,"spellcheck",!1),g.$$click=()=>l(r()),c})()]}}),null),f(o,u(k,{get when(){return a.showScopeSelector()},get children(){return u(Gf,{get onConfirm(){return a.complete},onCancel:i})}}),null),f(o,u(k,{get when(){return t()},get children(){var c=Ky();return f(c,t),c}}),null),o})()};ke(["click","input"]);const Wy=e=>typeof e=="object"?e.handle.bind(e):e,qt=({service:e,fetch:t=fetch})=>async(n,r)=>{const s=new URL(n,e);return await t(s.href,r)},Qo=/\bapplication\/json\b/;class We{handler;proxy;constructor({handler:t,proxy:n=null}){this.handler=Wy(t),this.proxy=n}clone({handler:t=this.handler,proxy:n=this.proxy}={}){return new We({handler:t,proxy:n})}get(t,n={}){return this.#e("get",t,n)}post(t,n={}){return this.#e("post",t,n)}async call(t,n={}){}async#e(t,n,{signal:r,as:s="json",headers:a,input:l,params:i}){const o=l&&(l instanceof Blob||ArrayBuffer.isView(l)||l instanceof ArrayBuffer||l instanceof ReadableStream),c=`/xrpc/${n}`+Gy(i),d=await this.handler(c,{method:t,signal:r,body:l&&!o?JSON.stringify(l):l,headers:Xy(a,{"content-type":l&&!o?"application/json":null,"atproto-proxy":Zy(this.proxy)}),duplex:l instanceof ReadableStream?"half":void 0});{const h=d.status,g=d.headers,p=g.get("content-type");if(h!==200){let x;if(p!=null&&Qo.test(p))try{const y=await d.json();Jy(y)&&(x=y)}catch{}else await d.body?.cancel();return{ok:!1,status:h,headers:g,data:x??{error:"UnknownXRPCError",message:`Request failed with status code ${h}`}}}{let x;switch(s){case"json":{if(p!=null&&Qo.test(p))x=await d.json();else throw await d.body?.cancel(),new TypeError(`Invalid response content-type (got ${p})`);break}case null:{x=null,await d.body?.cancel();break}case"blob":{x=await d.blob();break}case"bytes":{x=new Uint8Array(await d.arrayBuffer());break}case"stream":{x=d.body;break}}return{ok:!0,status:h,headers:g,data:x}}}}}const Gy=e=>{let t;for(const n in e){const r=e[n];if(r!==void 0)if(t??=new URLSearchParams,Array.isArray(r))for(let s=0,a=r.length;s<a;s++){const l=r[s];t.append(n,""+l)}else t.set(n,""+r)}return t?"?"+t.toString():""},Zy=e=>e!=null?`${e.did}${e.serviceId}`:null,Xy=(e,t)=>{let n;for(const r in t){const s=t[r];s!==null&&(n??=new Headers(e),n.has(r)||n.set(r,s))}return n??e},Jy=e=>{if(typeof e!="object"||e==null)return!1;const t=typeof e.error,n=typeof e.message;return t==="string"&&(n==="undefined"||n==="string")},Us=e=>{localStorage.setItem("sessions",JSON.stringify(e))},zl=()=>{const e=localStorage.getItem("sessions");return e?JSON.parse(e):null},Yy=async e=>{const n=await new We({handler:qt({service:"https://public.api.bsky.app"})}).get("app.bsky.actor.getProfile",{params:{actor:e}});if(n.ok)return n.data.avatar},Qy=async(e,t)=>{const r=(await Mi(e)).alsoKnownAs?.find(s=>s.startsWith("at://"));r&&qf(e,{signedIn:t[e].signedIn,handle:r.replace("at://",""),grantedScopes:t[e].grantedScopes})},Zf=async()=>{const t=await(async()=>{const n=new URLSearchParams(decodeURIComponent(location.hash.slice(1)));if(n.has("state")&&(n.has("code")||n.has("error"))){history.replaceState(null,"",location.pathname+location.search);const r=await Fp(n),s=r.session.info.sub;localStorage.setItem("lastSignedIn",s);const a=localStorage.getItem("pendingScopes")||"atproto";localStorage.removeItem("pendingScopes");const i=zl()||{};return i[s]={signedIn:!0,grantedScopes:a},Us(i),r.session}else{const r=localStorage.getItem("lastSignedIn");if(r){const a=zl()||{};try{const l=await Jr(r),o=await new We({handler:new Xs(l)}).get("com.atproto.server.getSession");if(a[r].signedIn=!0,Us(a),!o.ok)throw o.data.error;return l}catch(l){throw a[r].signedIn=!1,Us(a),l}}}})();t&&Hf(new Xs(t))},ec=async e=>{localStorage.setItem("lastSignedIn",e),await Zf()};var ew=m('<div class="mb-2 px-1 font-semibold"><span>Switch account'),tw=m('<div class="mb-3 max-h-80 overflow-y-auto md:max-h-100">'),nw=m('<button class="dark:hover:bg-dark-200 dark:active:bg-dark-100 flex w-full items-center justify-center gap-2 rounded-lg border border-neutral-200 px-3 py-2 hover:bg-neutral-100 active:bg-neutral-200 dark:border-neutral-700"><span class="iconify lucide--plus"></span><span>Add account'),rw=m("<button>"),sw=m('<img class="size-6 rounded-full">'),aw=m('<span class="iconify lucide--circle-check shrink-0 text-blue-500 dark:text-blue-400">'),lw=m('<span class="iconify lucide--circle-alert shrink-0 text-red-500 dark:text-red-400">'),iw=m('<div class="flex w-full items-center justify-between"><button class="flex grow items-center justify-between gap-1 truncate rounded-md p-1 hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600"><span class=truncate>'),ow=m('<span class="iconify lucide--user-round m-0.5 size-5">'),cw=m('<img class="size-5 rounded-full">'),dw=m('<span class="iconify lucide--circle-user-round text-lg">');const uw=e=>{const t=async n=>{const r=xe()?.sub;try{const s=await Jr(n,{allowStale:!0});await new Xs(s).signOut()}catch{cu(n)}qf(ig(s=>{delete s[n]})),Us(wt),r===n&&Hf(void 0)};return u(wa,{get children(){return u($a,{icon:"lucide--ellipsis",buttonClass:"rounded-md p-2",get children(){return[u(ft,{get href(){return`/at://${e.did}`},label:"Go to repo",icon:"lucide--user-round",get shortcut(){return xe()?.sub===e.did?"G":void 0}}),u(kl,{icon:"lucide--settings",label:"Edit permissions",onClick:()=>e.onEditPermissions(e.did)}),u(kl,{icon:"lucide--x",label:"Remove account",onClick:()=>t(e.did)})]}})}})},fw=()=>{const e=r=>r.replace("img/avatar/","img/avatar_thumbnail/"),t=Kf({beforeRedirect:r=>ec(r)});Ue(()=>{const r=Iy();r&&(t.initiateWithRedirect(r),Wf(null))});const n=async r=>{try{await ec(r)}catch{t.initiate(r)}};return pt(async()=>{try{await Zf()}catch{}const r=zl();if(r){const s=Object.keys(r);s.forEach(async a=>{await Qy(a,r)}),s.forEach(async a=>{const l=await Yy(a);l&&Ly(a,l)})}}),[u(Qt,{get open(){return Py()},onClose:()=>Vr(!1),onClosed:()=>{Br(!1),t.cancel()},alignTop:!0,contentClass:"dark:bg-dark-300 dark:shadow-dark-700 pointer-events-auto w-full max-w-sm rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 p-4 mx-3 shadow-md dark:border-neutral-700",get children(){return[u(k,{get when(){return X(()=>!t.showScopeSelector())()&&!Yo()},get children(){return[ew(),(()=>{var r=tw();return f(r,u(oe,{get each(){return Object.keys(wt)},children:s=>(()=>{var a=iw(),l=a.firstChild,i=l.firstChild;return f(a,u(Ie,{href:`/at://${s}`,onClick:()=>Vr(!1),class:"flex shrink-0 items-center rounded-md p-1 hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600",get children(){return u(k,{get when(){return Sn[s]},get fallback(){return ow()},get children(){var o=sw();return z(()=>ae(o,"src",e(Sn[s]))),o}})}}),l),l.$$click=()=>n(s),f(i,()=>wt[s]?.handle||s),f(l,u(k,{get when(){return X(()=>s===xe()?.sub)()&&wt[s].signedIn},get children(){return aw()}}),null),f(l,u(k,{get when(){return!wt[s].signedIn},get children(){return lw()}}),null),f(a,u(uw,{did:s,onEditPermissions:o=>t.initiateWithRedirect(o)}),null),a})()})),r})(),(()=>{var r=nw();return r.$$click=()=>Br(!0),r})()]}}),u(k,{get when(){return X(()=>!!Yo())()&&!t.showScopeSelector()},get children(){return u(qy,{onCancel:()=>Br(!1)})}}),u(k,{get when(){return t.showScopeSelector()},get children(){return u(Gf,{get initialScopes(){return Uy(wt[t.pendingAccount()]?.grantedScopes||"")},get onConfirm(){return t.complete},onCancel:()=>{t.cancel(),Br(!1)}})}})]}}),(()=>{var r=rw();return r.$$click=()=>Vr(!0),f(r,(()=>{var s=X(()=>!!(xe()&&Sn[xe().sub]));return()=>s()?(()=>{var a=cw();return z(()=>ae(a,"src",e(Sn[xe().sub]))),a})():dw()})()),z(()=>he(r,`flex items-center rounded-md ${xe()&&Sn[xe().sub]?"p-1.25":"p-1.5"} hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600`)),r})()]};ke(["click"]);const hw="modulepreload",gw=function(e){return"/"+e},tc={},pw=function(t,n,r){let s=Promise.resolve();if(n&&n.length>0){let o=function(c){return Promise.all(c.map(d=>Promise.resolve(d).then(h=>({status:"fulfilled",value:h}),h=>({status:"rejected",reason:h}))))};document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),i=l?.nonce||l?.getAttribute("nonce");s=o(n.map(c=>{if(c=gw(c),c in tc)return;tc[c]=!0;const d=c.endsWith(".css"),h=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${h}`))return;const g=document.createElement("link");if(g.rel=d?"stylesheet":hw,d||(g.as="script"),g.crossOrigin="",g.href=c,i&&g.setAttribute("nonce",i),document.head.appendChild(g),d)return new Promise((p,x)=>{g.addEventListener("load",p),g.addEventListener("error",()=>x(new Error(`Unable to preload CSS for ${c}`)))})}))}function a(l){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=l,window.dispatchEvent(i),!i.defaultPrevented)throw l}return s.then(l=>{for(const i of l||[])i.status==="rejected"&&a(i.reason);return t().catch(a)})};var mw=m("<button>");const Se=e=>(()=>{var t=mw();return $t(t,"touchstart",e.ontouchstart,!0),$t(t,"click",e.onClick,!0),f(t,()=>e.children),z(n=>{var r=e.type??"button",s=e.disabled??!1,a=e.class??"dark:bg-dark-300 dark:hover:bg-dark-200 dark:active:bg-dark-100 flex items-center gap-1 rounded-md border border-neutral-200 bg-neutral-50 px-2.5 py-1.5 text-xs text-neutral-700 transition-colors select-none hover:bg-neutral-100 active:bg-neutral-200 dark:border-neutral-700 dark:text-neutral-300",l=e.classList;return r!==n.e&&ae(t,"type",n.e=r),s!==n.t&&(t.disabled=n.t=s),a!==n.a&&he(t,n.a=a),n.o=ye(t,l,n.o),n},{e:void 0,t:void 0,a:void 0,o:void 0}),t})();ke(["click","touchstart"]);var bw=m('<h2 class="mb-2 font-semibold">Permission required'),xw=m('<p class="mb-4 text-sm text-neutral-600 dark:text-neutral-400">You need the "<!>" permission to perform this action.'),vw=m('<div class="flex justify-end gap-2">');const[nc,Ns]=T(null),Xf=e=>{Ns(e)},yw=()=>{const[e,t]=T(null);Ue(()=>{const s=nc();s!==null&&t(s)});const n=()=>Bi.find(a=>a.id===e())?.label.toLowerCase()||e(),r=()=>{Ns(null),xe()&&(Wf(xe().sub),Vr(!0))};return u(Qt,{get open(){return nc()!==null},onClose:()=>Ns(null),onClosed:()=>t(null),contentClass:"dark:bg-dark-300 dark:shadow-dark-700 pointer-events-auto w-[calc(100%-2rem)] max-w-md rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 p-4 shadow-md dark:border-neutral-700",get children(){return[bw(),(()=>{var s=xw(),a=s.firstChild,l=a.nextSibling;return l.nextSibling,f(s,n,l),s})(),(()=>{var s=vw();return f(s,u(Se,{onClick:()=>Ns(null),children:"Cancel"}),null),f(s,u(Se,{onClick:r,classList:{"bg-blue-500! text-white! hover:bg-blue-600! active:bg-blue-700! dark:bg-blue-600! dark:hover:bg-blue-500! dark:active:bg-blue-400! border-none!":!0},children:"Edit permissions"}),null),s})()]}})};var ww=m('<div class="flex flex-col gap-1.5"><label><input type=checkbox class="h-3.5 w-3.5 accent-blue-500">Recreate</label><p class="text-xs text-neutral-500 dark:text-neutral-400">Delete the existing record and create a new one with the same record key.'),$w=m(`<div class="flex flex-col gap-3 text-sm"><h2 class=font-semibold> record</h2><div class="flex flex-col gap-1.5"><div class="flex items-center justify-between gap-2"><span>Validate</span><div class="flex overflow-hidden rounded-md border border-neutral-200 text-xs dark:border-neutral-600"></div></div><p class="text-xs text-neutral-500 dark:text-neutral-400">Set to 'false' to skip lexicon schema validation by the PDS, 'true' to require it, or leave unset to validate only for known lexicons.</p></div><div class="flex justify-between gap-2">`),kw=m("<button type=button>");const _w=[{label:"Unset",value:void 0},{label:"True",value:!0},{label:"False",value:!1}],Sw="bg-neutral-200 font-medium dark:bg-neutral-600",Ew="hover:bg-neutral-100 dark:hover:bg-neutral-700",Cw=e=>{const[t,n]=T(void 0),[r,s]=T(!1);return(()=>{var a=$w(),l=a.firstChild,i=l.firstChild,o=l.nextSibling,c=o.firstChild,d=c.firstChild,h=d.nextSibling,g=o.nextSibling;return f(l,()=>e.isCreate?"Create":"Edit",i),f(h,u(oe,{each:_w,children:p=>(()=>{var x=kw();return x.$$click=()=>n(p.value),f(x,()=>p.label),z(()=>he(x,`border-r border-neutral-200 px-2.5 py-1.5 transition-colors last:border-r-0 dark:border-neutral-600 ${t()===p.value?Sw:Ew}`)),x})()})),f(a,u(k,{get when(){return!e.isCreate},get children(){var p=ww(),x=p.firstChild,y=x.firstChild;return y.nextSibling,y.addEventListener("change",b=>s(b.currentTarget.checked)),f(x,()=>on("create")?"":" (create permission needed)",null),z(b=>{var $=`flex items-center gap-2 text-sm ${on("create")?"":"opacity-40"}`,w=!on("create");return $!==b.e&&he(x,b.e=$),w!==b.t&&(y.disabled=b.t=w),b},{e:void 0,t:void 0}),z(()=>y.checked=r()),p}}),g),f(g,u(Se,{get onClick(){return e.onClose},children:"Cancel"}),null),f(g,u(Se,{onClick:()=>e.onConfirm(t(),r()),classList:{"bg-blue-500! text-white! border-none! hover:bg-blue-600! active:bg-blue-700! dark:bg-blue-600! dark:hover:bg-blue-500! dark:active:bg-blue-400!":!0},get children(){return e.isCreate?"Create":"Edit"}}),null),a})()};ke(["click"]);const Aw=e=>{const t=e.byteLength,n=new DataView(e.buffer,e.byteOffset,t),r=[];let s=0,a=!1;if(t>=2&&n.getUint16(0)===65496){let i=2;for(;i+4+5<=t;){const o=n.getUint16(i);if(o===65535){i++;continue}else if(o>=65504&&o<=65519||o===65534||o===65472||o===65474||o===65476||o===65499||o===65501||o===65498){const c=n.getUint16(i+2),d=i+2+c;o===65505&&n.getUint32(i+4)===1165519206&&n.getUint16(i+8)===0&&(r.push([s,i]),s=d),i=d;continue}break}}else if(t>=8&&n.getUint32(0)===2303741511&&n.getUint32(4)===218765834){let i=8;for(;i+4+4<=t;){const o=n.getUint32(i),c=n.getUint32(i+4),d=i+o+4+4+4;(c===1700284774||c===1950960965||c===1767135348||c===1950701684||c===2052348020||c===1683179847)&&(r.push([s,i]),s=d),i=d}}else if(t>=12&&n.getUint32(0)===1380533830&&n.getUint32(8)===1464156752){let i=12;for(a=!0;i+4+4<=t;){const o=n.getUint32(i,!0),c=n.getUint32(i+4,!0),d=i+c+4+4;(o===1179211845||o===542133592)&&(r.push([s,i]),s=d),i=d,c&1&&i++}}if(s===0)return null;const l=new Uint8Array(r.reduce((i,o)=>i+(o[1]-o[0]),t-s));if(l.set(e.subarray(s),r.reduce((i,o)=>(l.set(e.subarray(o[0],o[1]),i),i+(o[1]-o[0])),0)),a){const i=new DataView(l.buffer),o=l.byteLength-8;i.setUint32(4,o,!0)}return l},Jf=e=>{if(e===0)return"0 B";const t=1024,n=["B","KiB","MiB","GiB"],r=Math.floor(Math.log(e)/Math.log(t));return`${(e/Math.pow(t,r)).toFixed(r===0?0:1)} ${n[r]}`},cn={view:null},[Rw,Tw]=T();var Lw=m('<h2 class="mb-2 font-semibold">Upload blob'),Pw=m('<span class="text-red-500 dark:text-red-400">Error: '),Iw=m('<div class="flex items-center gap-1"><span class="iconify lucide--loader-circle animate-spin"></span><span>Uploading'),Dw=m('<div class="flex flex-col gap-2 text-sm"><div class="flex flex-col gap-1"><p class="flex gap-1"><span class=truncate></span><span class="shrink-0 text-neutral-600 dark:text-neutral-400">(<!>)</span></p></div><div class="flex items-center gap-x-2"><label for=mimetype class="shrink-0 select-none">MIME type</label></div><div class="flex items-center gap-1"><input id=exif-rm type=checkbox checked><label for=exif-rm class=select-none>Remove EXIF data</label></div><p class="text-xs text-neutral-600 dark:text-neutral-400">Metadata will be pasted after the cursor</p><div class="flex justify-between gap-2">');const Ow=e=>{const[t,n]=T(!1),[r,s]=T("");Ce(()=>e.blobInput.value="");const a=async()=>{let l;const i=document.getElementById("mimetype")?.value;if(document.getElementById("mimetype").value="",i?l=new Blob([e.file],{type:i}):l=e.file,document.getElementById("exif-rm").checked){const d=Aw(new Uint8Array(await l.arrayBuffer()));d!==null&&(l=new Blob([d],{type:l.type}))}const o=new We({handler:xe()});n(!0);const c=await o.post("com.atproto.repo.uploadBlob",{input:l});if(n(!1),!c.ok){s(c.data.error);return}cn.view.dispatch({changes:{from:cn.view.state.selection.main.head,insert:JSON.stringify(c.data.blob,null,2)}}),e.onClose()};return[Lw(),(()=>{var l=Dw(),i=l.firstChild,o=i.firstChild,c=o.firstChild,d=c.nextSibling,h=d.firstChild,g=h.nextSibling;g.nextSibling;var p=i.nextSibling;p.firstChild;var x=p.nextSibling,y=x.nextSibling,b=y.nextSibling;return f(c,()=>e.file.name),f(d,()=>Jf(e.file.size),g),f(p,u(Kt,{id:"mimetype",get placeholder(){return e.file.type}}),null),f(l,u(k,{get when(){return r()},get children(){var $=Pw();return $.firstChild,f($,r,null),$}}),b),f(b,u(Se,{get onClick(){return e.onClose},children:"Cancel"}),null),f(b,u(k,{get when(){return t()},get children(){return Iw()}}),null),f(b,u(k,{get when(){return!t()},get children(){return u(Se,{onClick:a,classList:{"bg-blue-500! text-white! border-none! hover:bg-blue-600! active:bg-blue-700! dark:bg-blue-600! dark:hover:bg-blue-500! dark:active:bg-blue-400!":!0},children:"Upload"})}}),null),l})()]};var jw=m('<h2 class="mb-2 font-semibold">Insert DID from handle'),Uw=m('<span class="text-red-500 dark:text-red-400">Error: '),Nw=m('<div class="flex items-center gap-1"><span class="iconify lucide--loader-circle animate-spin"></span><span>Resolving'),Mw=m('<form class="flex flex-col gap-2 text-sm"><div class="flex flex-col gap-1"><label for=handle-input class=select-none>Handle</label></div><p class="text-xs text-neutral-600 dark:text-neutral-400">DID will be pasted after the cursor</p><div class="flex justify-between gap-2">');const Bw=e=>{const[t,n]=T(!1),[r,s]=T("");let a;const l=async i=>{i.preventDefault();const c=new FormData(a).get("handle")?.toString().trim();if(!c){s("Please enter a handle");return}n(!0),s("");try{const d=await Ma(c);cn.view.dispatch({changes:{from:cn.view.state.selection.main.head,insert:`"${d}"`}}),e.onClose(),a.reset()}catch(d){s(d.message||"Failed to resolve handle")}finally{n(!1)}};return[jw(),(()=>{var i=Mw(),o=i.firstChild;o.firstChild;var c=o.nextSibling,d=c.nextSibling;i.addEventListener("submit",l);var h=a;return typeof h=="function"?Ne(h,i):a=i,f(o,u(Kt,{id:"handle-input",name:"handle",placeholder:"user.bsky.social"}),null),f(i,u(k,{get when(){return r()},get children(){var g=Uw();return g.firstChild,f(g,r,null),g}}),d),f(d,u(Se,{type:"button",onClick:()=>{e.onClose(),a.reset(),s("")},children:"Cancel"}),null),f(d,u(k,{get when(){return t()},get children(){return Nw()}}),null),f(d,u(k,{get when(){return!t()},get children(){return u(Se,{type:"submit",classList:{"bg-blue-500! text-white! border-none! hover:bg-blue-600! active:bg-blue-700! dark:bg-blue-600! dark:hover:bg-blue-500! dark:active:bg-blue-400!":!0},children:"Insert"})}}),null),i})()]};var Fw=m('<button type=button class="flex items-center gap-2 rounded-md p-2 text-left text-xs hover:bg-neutral-100 active:bg-neutral-200 dark:hover:bg-neutral-700 dark:active:bg-neutral-600"><span></span><span>');const rc=e=>(()=>{var t=Fw(),n=t.firstChild,r=n.nextSibling;return $t(t,"click",e.onClick,!0),f(r,()=>e.label),z(()=>he(n,`iconify ${e.icon}`)),t})();ke(["click"]);var zw=m('<div class="mb-2 flex w-full justify-between text-base"><div class="flex items-center gap-2"><span class="font-semibold select-none"> record</span></div><div class="flex items-center gap-1"><button type=button class="flex items-center rounded-lg p-1.5 hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600"><span class="iconify lucide--minus"></span></button><button type=button class="flex items-center rounded-lg p-1.5 hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600"><span></span></button><button id=close class="flex items-center rounded-lg p-1.5 hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600"><span class="iconify lucide--x">'),Vw=m('<div class="flex flex-wrap items-center gap-1 text-sm"><span>at://</span><select class="dark:bg-dark-100 max-w-40 truncate rounded-md border border-neutral-200 bg-white px-1 py-1 select-none focus:outline-1 focus:outline-neutral-400 dark:border-neutral-600 dark:focus:outline-neutral-400"name=repo id=repo></select><span>/</span><span>/'),Kw=m('<div class="text-xs text-red-500 dark:text-red-400"><div></div><div>'),Hw=m('<div class="text-sm text-red-500 dark:text-red-400">'),qw=m('<span class="iconify lucide--plus">'),Ww=m("<span>Add"),Gw=m('<div class="dark:bg-dark-300 dark:shadow-dark-700 absolute bottom-full left-0 z-10 mb-1 flex w-40 flex-col rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 p-1.5 shadow-md dark:border-neutral-700"><button type=button><span class="iconify lucide--upload shrink-0"></span><span>Upload blob'),Zw=m('<form class="flex min-h-0 flex-1 flex-col gap-y-2"><div class="min-h-0 flex-1"></div><div class="flex flex-col gap-2"><div class="flex justify-between gap-2"><div class=relative><input type=file id=blob class=sr-only></div><div class="flex items-center justify-end gap-2">'),Xw=m('<button class="dark:bg-dark-300 dark:hover:bg-dark-200 dark:active:bg-dark-100 fixed right-4 bottom-4 z-30 flex items-center gap-2 rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 px-3 py-2 shadow-md hover:bg-neutral-100 active:bg-neutral-200 dark:border-neutral-700"><span class="iconify lucide--square-pen text-lg"></span><span class="text-sm font-medium"> record'),Jw=m("<button><div>"),Yw=m("<option>"),Qw=m('<div class="flex h-full items-center justify-center"><span class="iconify lucide--loader-circle animate-spin text-xl">');const e$=t0(()=>pw(()=>import("./editor-DQE52n0t.js"),[]).then(e=>({default:e.Editor}))),Yf=e=>{const t=At(),n=Fn(),[r,s]=T(!1),[a,l]=T(""),[i,o]=T(!1),[c,d]=T(!1),[h,g]=T(!1),[p,x]=T(!1),y=()=>!e.scope||on(e.scope),[b,$]=T(!1),[w,v]=T(!1),[_,E]=T(""),[S,C]=T("");let A,D,N;Ue(()=>{if(c()){const K=q=>{N&&!N.contains(q.target)&&d(!1)};document.addEventListener("mousedown",K),Ce(()=>document.removeEventListener("mousedown",K))}}),pt(()=>{const K=q=>{if(q.target instanceof HTMLInputElement||q.target instanceof HTMLTextAreaElement||q.target.closest("[data-modal]"))return;const U=e.create?"n":"e";q.key===U&&(q.preventDefault(),r()&&w()?v(!1):!r()&&!document.querySelector("[data-modal]")&&s(!0))};window.addEventListener("keydown",K),Ce(()=>window.removeEventListener("keydown",K))});const I=()=>({$type:"app.bsky.feed.post",text:"This post was sent from PDSls",embed:{$type:"app.bsky.embed.external",external:{uri:"https://pds.ls",title:"PDSls",description:"Browse the public data on atproto"}},langs:["en"],createdAt:new Date().toISOString()});Ue(()=>{r()&&(E(""),C(""))});const M=async K=>{const q=new FormData(D),U=q.get("repo")?.toString();if(!U)return;const L=new We({handler:new Xs(await Jr(U))}),V=q.get("collection"),P=q.get("rkey");let R;try{R=JSON.parse(cn.view.state.doc.toString())}catch(j){l(j.message);return}const O=await L.post("com.atproto.repo.createRecord",{input:{repo:U,collection:V?V.toString():R.$type,rkey:P?.toString().length?P?.toString():void 0,record:R,validate:K}});if(!O.ok){l(`${O.data.error}: ${O.data.message}`);return}x(!1),s(!1);const Z=Nn({message:"Record created",type:"success"});setTimeout(()=>Mt(Z),3e3),t(`/${O.data.uri}`)},Y=async(K,q)=>{const U=cn.view.state.doc.toString();if(!U)return;const L=new We({handler:xe()});try{const V=JSON.parse(U);if(q){const R=await L.post("com.atproto.repo.applyWrites",{input:{repo:xe().sub,validate:K,writes:[{collection:n.collection,rkey:n.rkey,$type:"com.atproto.repo.applyWrites#delete"},{collection:n.collection,rkey:n.rkey,$type:"com.atproto.repo.applyWrites#create",value:V}]}});if(!R.ok){l(`${R.data.error}: ${R.data.message}`);return}}else{const R=await L.post("com.atproto.repo.applyWrites",{input:{repo:xe().sub,validate:K,writes:[{collection:n.collection,rkey:n.rkey,$type:"com.atproto.repo.applyWrites#update",value:V}]}});if(!R.ok){l(`${R.data.error}: ${R.data.message}`);return}}x(!1),s(!1);const P=Nn({message:"Record edited",type:"success"});setTimeout(()=>Mt(P),3e3),e.refetch()}catch(V){l(V.message)}},F=()=>{const K=new Date().toISOString();cn.view.dispatch({changes:{from:cn.view.state.selection.main.head,insert:`"${K}"`}}),d(!1)},B=()=>{d(!1),g(!0)};return[u(Qt,{get open(){return r()},onClose:()=>s(!1),closeOnClick:!1,get nonBlocking(){return w()},alignTop:!0,get contentClass(){return`dark:bg-dark-300 dark:shadow-dark-700 pointer-events-auto flex flex-col rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 p-4 shadow-md dark:border-neutral-700 ${b()?"w-[calc(100%-1rem)] max-w-7xl h-[85vh]":"w-[calc(100%-1rem)] max-w-3xl h-[65vh]"} ${w()?"hidden":""}`},get children(){return[(()=>{var K=zw(),q=K.firstChild,U=q.firstChild,L=U.firstChild,V=q.nextSibling,P=V.firstChild,R=P.nextSibling,O=R.firstChild,Z=R.nextSibling;return f(U,()=>e.create?"Creating":"Editing",L),P.$$click=()=>v(!0),R.$$click=()=>$(!b()),Z.$$click=()=>s(!1),z(()=>he(O,`iconify ${b()?"lucide--minimize-2":"lucide--maximize-2"}`)),K})(),(()=>{var K=Zw(),q=K.firstChild,U=q.nextSibling,L=U.firstChild,V=L.firstChild,P=V.firstChild,R=V.nextSibling,O=D;typeof O=="function"?Ne(O,K):D=K,f(K,u(k,{get when(){return e.create},get children(){return[(()=>{var G=Vw(),ie=G.firstChild,ee=ie.nextSibling,Q=ee.nextSibling,me=Q.nextSibling;return f(ee,u(oe,{get each(){return Object.keys(wt)},children:le=>(()=>{var re=Yw();return re.value=le,f(re,()=>wt[le].handle??le),z(()=>re.selected=le===xe()?.sub),re})()})),f(G,u(Kt,{id:"collection",name:"collection",placeholder:"Collection (default: $type)",get class(){return`w-40 placeholder:text-xs lg:w-52 ${_()?"border-red-500 focus:outline-red-500 dark:border-red-400 dark:focus:outline-red-400":""}`},onInput:le=>{const re=le.currentTarget.value;E(!re||zt(re)?"":"Invalid collection: use reverse domain format (e.g. app.bsky.feed.post)")}}),me),f(G,u(Kt,{id:"rkey",name:"rkey",placeholder:"Record key (default: TID)",get class(){return`w-40 placeholder:text-xs lg:w-52 ${S()?"border-red-500 focus:outline-red-500 dark:border-red-400 dark:focus:outline-red-400":""}`},onInput:le=>{const re=le.currentTarget.value;C(!re||ka(re)?"":"Invalid record key: 1-512 chars, use a-z A-Z 0-9 . _ ~ : -")}}),null),G})(),u(k,{get when(){return _()||S()},get children(){var G=Kw(),ie=G.firstChild,ee=ie.nextSibling;return f(ie,_),f(ee,S),G}})]}}),q),f(q,u(cr,{get fallback(){return Qw()},get children(){return u(e$,{get content(){return JSON.stringify(e.create?n.rkey?Rw():I():e.record,null,2)}})}})),f(U,u(k,{get when(){return a()},get children(){var G=Hw();return f(G,a),G}}),L);var Z=N;typeof Z=="function"?Ne(Z,V):N=V,f(V,u(Se,{onClick:()=>d(!c()),get children(){return[qw(),Ww()]}}),P),f(V,u(k,{get when(){return c()},get children(){var G=Gw(),ie=G.firstChild,ee=ie.firstChild,Q=ee.nextSibling;return Q.firstChild,f(G,u(rc,{icon:"lucide--id-card",label:"Insert DID",onClick:B}),ie),f(G,u(rc,{icon:"lucide--clock",label:"Insert timestamp",onClick:F}),ie),ie.$$click=()=>{on("blob")&&(d(!1),A.click())},f(Q,()=>on("blob")?"":" (permission needed)",null),z(()=>he(ie,on("blob")?"flex items-center gap-2 rounded-md p-2 text-left text-xs hover:bg-neutral-100 active:bg-neutral-200 dark:hover:bg-neutral-700 dark:active:bg-neutral-600":"flex items-center gap-2 rounded-md p-2 text-left text-xs opacity-40")),G}}),P),P.addEventListener("change",G=>{G.target.files!==null&&o(!0)});var j=A;return typeof j=="function"?Ne(j,P):A=P,f(L,u(Qt,{get open(){return i()},onClose:()=>o(!1),closeOnClick:!1,contentClass:"dark:bg-dark-300 dark:shadow-dark-700 pointer-events-auto w-[20rem] rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 p-4 shadow-md dark:border-neutral-700",get children(){return u(Ow,{get file(){return A.files[0]},blobInput:A,onClose:()=>o(!1)})}}),R),f(L,u(Qt,{get open(){return h()},onClose:()=>g(!1),closeOnClick:!1,contentClass:"dark:bg-dark-300 dark:shadow-dark-700 pointer-events-auto w-[20rem] rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 p-4 shadow-md dark:border-neutral-700",get children(){return u(Bw,{onClose:()=>g(!1)})}}),R),f(L,u(Qt,{get open(){return p()},onClose:()=>x(!1),closeOnClick:!1,contentClass:"dark:bg-dark-300 dark:shadow-dark-700 pointer-events-auto w-[24rem] rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 p-4 shadow-md dark:border-neutral-700",get children(){return u(Cw,{get isCreate(){return e.create},onConfirm:(G,ie)=>{e.create?M(G):Y(G,ie)},onClose:()=>x(!1)})}}),R),f(R,u(Se,{onClick:()=>x(!0),get children(){return e.create?"Create...":"Edit..."}})),K})()]}}),u(k,{get when(){return X(()=>!!w())()&&r()},get children(){var K=Xw(),q=K.firstChild,U=q.nextSibling,L=U.firstChild;return K.$$click=()=>v(!1),f(U,()=>e.create?"Creating":"Editing",L),K}}),u(ot,{get text(){return X(()=>!!y())()?e.create?"Create record":"Edit record":`${e.create?"Create record":"Edit record"} (permission required)`},get shortcut(){return X(()=>!!y())()?e.create?"N":"E":void 0},get children(){var K=Jw(),q=K.firstChild;return K.$$click=()=>{y()?(l(""),s(!0),v(!1)):e.scope&&Xf(e.scope)},z(U=>{var L=y()?`flex items-center p-1.5 hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600 ${e.create?"rounded-md":"rounded-sm"}`:`flex items-center p-1.5 opacity-40 ${e.create?"rounded-md":"rounded-sm"}`,V=e.create?"iconify lucide--square-pen text-lg":"iconify lucide--pencil";return L!==U.e&&he(K,U.e=L),V!==U.t&&he(q,U.t=V),U},{e:void 0,t:void 0}),K}})]};ke(["click"]);const sc={"localhost:19006":0,"blacksky.community":0,"bsky.app":0,"catsky.social":0,"deer.social":0,"deer-social-ayla.pages.dev":0,"deer.aylac.top":0,"main.bsky.dev":0,"witchsky.app":0,"tangled.org":1,"pinksea.art":2,"blento.app":3,"popfeed.social":4},t$={0:e=>{const t=e[0],n=e[1];if(t==="profile")if(e[2]){const r=e[2],s=e[3];if(r==="post")return`at://${n}/app.bsky.feed.post/${s}`;if(r==="lists")return`at://${n}/app.bsky.graph.list/${s}`;if(r==="feed")return`at://${n}/app.bsky.feed.generator/${s}`;if(r==="follows")return`at://${n}/app.bsky.graph.follow/${s}`}else return`at://${n}`;else if(t==="starter-pack")return`at://${n}/app.bsky.graph.starterpack/${e[2]}`;return`at://${n}`},1:e=>{if(e[0]==="strings")return`at://${e[1]}/sh.tangled.string/${e[2]}`;let t;if(e[e.length-1].includes("?")){const r=e[e.length-1].split("?");t=r[1],e[e.length-1]=r[0]}const n=e[0].replace("@","");if(e.length===1){if(t==="tab=repos")return`at://${n}/sh.tangled.repo`;if(t==="tab=starred")return`at://${n}/sh.tangled.feed.star`;if(t==="tab=strings")return`at://${n}/sh.tangled.string`}else if(e.length===2)return`at://${n}/sh.tangled.repo`;return`at://${n}`},2:e=>e.length===3?`at://${e[0]}/com.shinolabs.pinksea.oekaki/${e[2]}`:`at://${e[0]}`,3:e=>`at://${e[0]}/app.blento.card`,4:e=>e[0]==="profile"&&e[1]?`at://${e[1]}/social.popfeed.actor.profile/self`:(e[0]==="review"||e[0]==="list")&&e[1]==="at:"&&e[2]&&e[3]&&e[4]?`at://${e[2]}/${e[3]}/${e[4]}`:`at://${e[1]}`},Qf=(e,t,n)=>{const r=e(),[s,a]=T(r,{equals:n});return Ue(l=>{const i=e();if(l!==i){const o=setTimeout(()=>a(()=>i),t);Ce(()=>clearTimeout(o))}return i},r),s};var n$=m('<span class="iconify lucide--search">'),r$=m("<span>Search"),s$=m('<kbd class="font-sans text-neutral-400 dark:text-neutral-500">K'),a$=m('<div class="mt-2 mb-1 flex px-3"><span class="text-xs font-medium text-neutral-500 dark:text-neutral-400">Examples'),l$=m('<div class="mt-2 mb-1 flex items-center justify-between px-3"><span class="text-xs font-medium text-neutral-500 dark:text-neutral-400">Recent</span><button type=button class="text-xs not-hover:text-neutral-500 dark:not-hover:text-neutral-400">Clear all'),i$=m('<div class="flex w-full flex-col overflow-hidden rounded-b-md border-t border-neutral-200 dark:border-neutral-700">'),o$=m('<form class=w-full><label for=input class=hidden>Search or paste a link</label><div><label for=input class="iconify lucide--search text-neutral-500 dark:text-neutral-400"></label><input type=text autocapitalize=off autocomplete=off placeholder="Search or paste a link..."id=input class="grow py-2.5 select-none placeholder:text-sm focus:outline-none">'),c$=m('<span class=truncate><span class="text-neutral-500 dark:text-neutral-400">'),d$=m("<span>"),u$=m("<span class=truncate>"),f$=m('<div><button type=button class="flex items-center p-2.5 opacity-0 not-hover:text-neutral-500 group-hover:opacity-100 dark:not-hover:text-neutral-400"><span class="iconify lucide--x text-base">'),h$=m('<img class="size-8 rounded-full">'),g$=m('<span class="truncate text-sm font-medium">'),p$=m('<div class="flex min-w-0 flex-col"><span class="truncate text-xs text-neutral-600 dark:text-neutral-400">@');const Fa="recent-searches",m$=5,En=()=>{try{const e=localStorage.getItem(Fa);return e?JSON.parse(e):[]}catch{return[]}},rl=e=>{const n=En().filter(s=>s.path!==e.path),r=[e,...n].slice(0,m$);localStorage.setItem(Fa,JSON.stringify(r))},b$=e=>{const n=En().filter(r=>r.path!==e);localStorage.setItem(Fa,JSON.stringify(n))},[da,it]=T(!1),x$=[{path:"/at://did:plc:vwzwgnygau7ed7b7wt5ux7y2",label:"retr0.id",type:"handle",prefix:"@"},{path:"/at://did:plc:ia76kvnndjutgedggx2ibrem/app.bsky.actor.profile/self",label:"mary.my.id/app.bsky.actor.profile/self",type:"at-uri",prefix:"at://"},{path:"/npmx.social",label:"npmx.social",type:"pds",prefix:"pds:"},{path:"/at://did:plc:4v4y5r3lwsbtmsxhile2ljac/com.atproto.lexicon.schema/app.bsky.feed.post#schema",label:"app.bsky.feed.post",type:"lexicon",prefix:"lex:"},{path:"/at://did:plc:oisofpd7lj26yvgiivf3lxsi/app.bsky.feed.post/3mfflamxxvk2t",label:"bsky.app/profile/hailey.at/post/3mfflamxxvk2t",type:"at-uri",prefix:"https://"}],v$=[{prefix:"@",description:"example.com"},{prefix:"did:",description:"web:example.com"},{prefix:"at:",description:"//example.com/com.example.test/self"},{prefix:"lex:",description:"com.example.test"},{prefix:"pds:",description:"host.example.com"}],ac=e=>{const t=v$.find(n=>e.toLowerCase().startsWith(n.prefix));return t?{prefix:t.prefix,query:e.slice(t.prefix.length)}:{prefix:null,query:e}},y$=()=>{pt(()=>window.addEventListener("keydown",e)),Ce(()=>window.removeEventListener("keydown",e));const e=t=>{if(!document.querySelector("[data-modal]"))if((t.ctrlKey||t.metaKey)&&t.key=="k")if(t.preventDefault(),da()){const n=document.querySelector("#input");n&&document.activeElement!==n?n.focus():it(!1)}else it(!0);else t.key=="Escape"&&(t.preventDefault(),it(!1))};return u(Se,{onClick:()=>it(!da()),get children(){return[n$(),r$(),u(k,{when:Ke,get children(){var t=s$(),n=t.firstChild;return f(t,()=>/Mac/i.test(navigator.platform)?"⌘":"⌃",n),t}})]}})},w$=()=>{const e=At();let t;const n=new We({handler:qt({service:"https://public.api.bsky.app"})}),[r,s]=T(En());pt(()=>{const b=v=>{if(v.target===t||v.target instanceof HTMLInputElement||v.target instanceof HTMLTextAreaElement||document.querySelector("[data-modal]"))return;const _=v.clipboardData?.getData("text");_&&y(_)};window.addEventListener("paste",b),Ce(()=>window.removeEventListener("paste",b));const $=new URL(location.href),w=$.searchParams.get("q");w!==null&&($.searchParams.delete("q"),history.replaceState(null,"",$.toString()),y(w))}),Ue(()=>{da()&&setTimeout(()=>t?.focus())});const a=()=>{o(void 0),d(-1),g(void 0)},l=async b=>{if(!b)return[];const{prefix:$,query:w}=ac(b);if($==="@"){if(!w.length)return[];const v=await n.get("app.bsky.actor.searchActorsTypeahead",{params:{q:w,limit:5}});if(v.ok)return v.data.actors}return[]},[i,o]=T(),[c,d]=T(-1),[h,{mutate:g}]=Ht(Qf(i,200),l),p=()=>{const b=i()?.toLowerCase();return b?r().filter($=>$.label.toLowerCase().includes(b)):r()},x=(b,$,w)=>{rl({path:b,label:$,type:w}),s(En())},y=async b=>{if(b=b.trim().replace(/^@/,""),!b.length)return;if(b.includes("%"))try{b=decodeURIComponent(b)}catch{}it(!1);const{prefix:$,query:w}=ac(b);if($==="@"){const v=`/at://${w}`;x(v,w,"handle"),e(v)}else if($==="did:"){const v=`/at://did:${w}`;x(v,`did:${w}`,"did"),e(v)}else if($==="at:"){const v=`/${b}`;x(v,b,"at-uri"),e(v)}else if($==="lex:")if(w.split(".").length>=3){const v=w,E=`/at://${await Wn(v)}/com.atproto.lexicon.schema/${v}`;x(E,w,"lexicon"),e(E)}else{const _=`/at://${await Sy(w)}/com.atproto.lexicon.schema`;x(_,w,"lexicon"),e(_)}else if($==="pds:"){const v=`/${w}`;x(v,w,"pds"),e(v)}else if(b.startsWith("https://")||b.startsWith("http://")){const v=b.indexOf("/",8),_=b.slice(0,v).replace("https://","").replace("http://","");if(_ in sc){const E=sc[_],S=b.slice(v+1).split("/"),A=`/${t$[E](S)}`;x(A,b,"url"),e(A)}else{const E=`/${b.replace("https://","").replace("http://","").replace("/","")}`;x(E,b,"url"),e(E)}}else{const v=`/at://${b.replace("at://","")}`,_=b.split("/").length>1?"at-uri":"handle";x(v,b,_),e(v)}};return u(Qt,{get open(){return da()},onClose:()=>it(!1),onClosed:a,alignTop:!0,contentClass:"dark:bg-dark-200 dark:shadow-dark-700 pointer-events-auto mx-3 w-full max-w-lg rounded-lg border-[0.5px] min-w-0 border-neutral-300 bg-white shadow-md dark:border-neutral-700",get children(){var b=o$(),$=b.firstChild,w=$.nextSibling,v=w.firstChild,_=v.nextSibling;b.addEventListener("submit",S=>{S.preventDefault(),y(t.value)}),_.$$keydown=S=>{const C=h(),A=p(),D=A.length+(C?.length||0);if(D){if(S.key==="ArrowDown")S.preventDefault(),d(N=>N===-1?0:(N+1)%D);else if(S.key==="ArrowUp")S.preventDefault(),d(N=>N===-1?D-1:(N-1+D)%D);else if(S.key==="Enter"){const N=c();if(N>=0)if(S.preventDefault(),N<A.length){const I=A[N];rl(I),s(En()),it(!1),e(I.path)}else{const I=N-A.length;if(C&&C[I]){const M=C[I],Y=`/at://${M.did}`;x(Y,M.handle,"handle"),it(!1),e(Y)}}else if(C?.length&&A.length===0){S.preventDefault();const I=C[0],M=`/at://${I.did}`;x(M,I.handle,"handle"),it(!1),e(M)}}}},_.addEventListener("blur",()=>d(-1)),_.$$input=S=>{o(S.currentTarget.value),d(-1)};var E=t;return typeof E=="function"?Ne(E,_):t=_,ae(_,"spellcheck",!1),f(b,u(k,{get when(){return p().length>0||h()?.length||!i()&&r().length===0},get children(){var S=i$();return S.$$mousedown=C=>C.preventDefault(),f(S,u(k,{get when(){return X(()=>!i())()&&r().length===0},get children(){return[a$(),u(oe,{each:x$,children:C=>u(Ie,{get href(){return C.path},class:"dark:hover:bg-dark-100 flex items-center gap-2 px-3 py-2 text-sm hover:bg-neutral-100",onClick:()=>it(!1),get children(){var A=c$(),D=A.firstChild;return f(D,()=>C.prefix),f(A,()=>C.label,null),A}})})]}}),null),f(S,u(k,{get when(){return p().length>0},get children(){return[(()=>{var C=l$(),A=C.firstChild,D=A.nextSibling;return D.$$click=()=>{localStorage.removeItem(Fa),s([])},C})(),u(oe,{get each(){return p()},children:(C,A)=>{const D=C.type==="handle"?"lucide--at-sign":C.type==="did"?"lucide--user-round":C.type==="at-uri"?"lucide--link":C.type==="lexicon"?"lucide--book-open":C.type==="pds"?"lucide--hard-drive":"lucide--globe";return(()=>{var N=f$(),I=N.firstChild;return f(N,u(Ie,{get href(){return C.path},class:"flex min-w-0 flex-1 items-center gap-2 px-3 py-2 text-sm",onClick:()=>{rl(C),s(En()),it(!1)},get children(){return[(()=>{var M=d$();return he(M,`iconify ${D} shrink-0 text-neutral-500 dark:text-neutral-400`),M})(),(()=>{var M=u$();return f(M,()=>C.label),M})()]}}),I),I.$$click=()=>{b$(C.path),s(En())},z(()=>he(N,`group flex items-center ${A()===c()?"bg-neutral-200 dark:bg-neutral-700":"dark:hover:bg-dark-100 hover:bg-neutral-100"}`)),N})()}})]}}),null),f(S,u(oe,{get each(){return h()},children:(C,A)=>{const D=p().length+A(),N=`/at://${C.did}`;return u(Ie,{get class(){return`flex items-center gap-2 px-3 py-1.5 ${D===c()?"bg-neutral-200 dark:bg-neutral-700":"dark:hover:bg-dark-100 hover:bg-neutral-100 active:bg-neutral-200 dark:active:bg-neutral-700"}`},href:N,onClick:()=>{x(N,C.handle,"handle"),it(!1)},get children(){return[(()=>{var I=h$();return z(()=>ae(I,"src",C.avatar?.replace("img/avatar/","img/avatar_thumbnail/"))),I})(),(()=>{var I=p$(),M=I.firstChild;return M.firstChild,f(I,u(k,{get when(){return C.displayName},get children(){var Y=g$();return f(Y,()=>C.displayName),Y}}),M),f(M,()=>C.handle,null),I})()]}})}}),null),S}}),null),z(()=>he(w,`flex items-center gap-2 px-3 ${p().length>0||h()?.length?"rounded-t-lg":"rounded-lg"}`)),z(()=>_.value=i()??""),b}})};ke(["input","keydown","mousedown","click"]);var $$=m('<span class="iconify tabler--binary-tree-filled text-[#76c4e5]">'),k$=m("<span>PDSls"),_$=m('<img src=/ribbon.webp alt class="pointer-events-none absolute -top-3 -right-4 w-8 rotate-15">'),S$=m('<div class="dark:bg-dark-500 fixed right-0 bottom-0 left-0 z-10 flex items-center justify-center bg-neutral-100 px-3 py-1 text-xs"><span>PLC directory: <span class=font-medium>'),E$=m('<div id=main class="mx-auto mb-8 flex max-w-lg flex-col items-center p-3"><header><div class="relative flex items-center gap-0.5 rounded-lg bg-neutral-50/60 p-1 dark:bg-neutral-800/60"><div class=mr-1></div></div></header><div class="flex w-full flex-col items-center gap-3 text-pretty">'),C$=m('<div class="mt-3 wrap-anywhere">Error: '),A$=m('<span class="iconify lucide--loader-circle mt-3 animate-spin text-xl">');const Ke=window.matchMedia("(hover: hover) and (pointer: fine)").matches,lc={"did:plc:ia76kvnndjutgedggx2ibrem":"bunny.jpg","did:plc:oisofpd7lj26yvgiivf3lxsi":"puppy.jpg","did:plc:vwzwgnygau7ed7b7wt5ux7y2":"water.webp","did:plc:uu5axsmbm2or2dngy4gwchec":"city.webp","did:plc:ucaezectmpny7l42baeyooxi":"almaty.webp","did:plc:355lbopbpckczt672hss2ra4":"kit.jpg","did:plc:q6ywj35eew5f3cdajho7bmq7":"dreary.jpg"},R$=e=>{const t=bt(),n=At();return t.search.includes("hrt=true")?localStorage.setItem("hrt","true"):t.search.includes("hrt=false")&&localStorage.setItem("hrt","false"),t.search.includes("sailor=true")?localStorage.setItem("sailor","true"):t.search.includes("sailor=false")&&localStorage.setItem("sailor","false"),Ue(async()=>{if(e.params.repo&&!e.params.repo.startsWith("did:")){const r=await Ma(e.params.repo);n(t.pathname.replace(e.params.repo,r),{replace:!0})}}),pt(()=>{window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",by);const r=s=>{document.querySelector("[data-modal]")||s.target instanceof HTMLInputElement||s.target instanceof HTMLTextAreaElement||s.key==="g"&&xe()?.sub&&(s.preventDefault(),n(`/at://${xe().sub}`))};if(window.addEventListener("keydown",r),Ce(()=>window.removeEventListener("keydown",r)),localStorage.getItem("sailor")==="true"){const s=document.createElement("style");s.textContent=` 3 + html, * { 4 + cursor: url(/cursor.cur), pointer; 5 + } 6 + 7 + .star { 8 + position: fixed; 9 + pointer-events: none; 10 + z-index: 9999; 11 + font-size: 20px; 12 + animation: sparkle 0.8s ease-out forwards; 13 + } 14 + 15 + @keyframes sparkle { 16 + 0% { 17 + opacity: 1; 18 + transform: translate(0, 0) rotate(var(--ttheta1)) scale(1); 19 + } 20 + 100% { 21 + opacity: 0; 22 + transform: translate(var(--tx), var(--ty)) rotate(var(--ttheta2)) scale(0); 23 + } 24 + } 25 + `,document.head.appendChild(s);let a=0;const l=30;document.addEventListener("mousemove",i=>{const o=Date.now();if(o-a<l)return;a=o;const c=document.createElement("div");c.className="star",c.textContent="✨",c.style.left=i.clientX+"px",c.style.top=i.clientY+"px";const d=(Math.random()-.5)*50,h=(Math.random()-.5)*50,g=Math.random()*360,p=g+(Math.random()-.5)*540;c.style.setProperty("--tx",d+"px"),c.style.setProperty("--ty",h+"px"),c.style.setProperty("--ttheta1",g+"deg"),c.style.setProperty("--ttheta2",p+"deg"),document.body.appendChild(c),setTimeout(()=>c.remove(),800)})}}),u(dg,{get children(){return[u(Rt,{children:"PDSls"}),u(k,{get when(){return t.pathname!=="/"},get children(){return u(fg,{name:"robots",content:"noindex, nofollow"})}}),(()=>{var r=E$(),s=r.firstChild,a=s.firstChild,l=a.firstChild,i=s.nextSibling;return f(s,u(Ie,{href:"/",style:'font-feature-settings: "cv05"',class:"relative flex items-center gap-1 text-xl font-semibold",get children(){return[$$(),k$(),u(k,{get when(){return localStorage.getItem("hrt")==="true"},get children(){return _$()}})]}}),a),f(l,u(y$,{})),f(a,u(k,{get when(){return xe()},get children(){return u(Yf,{create:!0,scope:"create"})}}),null),f(a,u(fw,{}),null),f(a,u(wa,{get children(){return u($a,{icon:"lucide--menu text-lg",buttonClass:"rounded-md p-1.5",get children(){return[u(ft,{href:"/jetstream",label:"Jetstream",icon:"lucide--radio-tower"}),u(ft,{href:"/firehose",label:"Firehose",icon:"lucide--rss"}),u(ft,{href:"/spacedust",label:"Spacedust",icon:"lucide--sparkles"}),u(_l,{}),u(ft,{href:"/labels",label:"Labels",icon:"lucide--tag"}),u(ft,{href:"/car",label:"Archive tools",icon:"lucide--folder-archive"}),u(_l,{}),u(ft,{href:"/settings",label:"Settings",icon:"lucide--settings"})]}})}}),null),f(i,u(w$,{}),null),f(i,u(k,{get when(){return e.params.pds},get children(){return u(hy,{get params(){return e.params}})}}),null),f(i,u(k,{keyed:!0,get when(){return t.pathname},get children(){return u(dn,{fallback:o=>(()=>{var c=C$();return c.firstChild,f(c,()=>o.message,null),c})(),get children(){return u(cr,{get fallback(){return A$()},get children(){return e.children}})}})}}),null),f(r,u(Qp,{}),null),f(r,u(yw,{}),null),f(r,u(k,{get when(){return gn()!=="https://plc.directory"},get children(){var o=S$(),c=o.firstChild,d=c.firstChild,h=d.nextSibling;return f(h,gn),o}}),null),z(o=>{var c=`dark:shadow-dark-700 mb-3 flex h-13 w-full items-center justify-between rounded-xl border-[0.5px] border-neutral-300 bg-neutral-50 bg-size-[95%] bg-right bg-no-repeat p-2 pl-3 shadow-xs [--header-bg:#fafafa] [--trans-blue:#5BCEFA90] [--trans-pink:#F5A9B890] [--trans-white:#FFFFFF90] dark:border-neutral-700 dark:bg-neutral-800 dark:[--header-bg:#262626] dark:[--trans-blue:#5BCEFAa0] dark:[--trans-pink:#F5A9B8a0] dark:[--trans-white:#FFFFFFa0] ${localStorage.getItem("hrt")==="true"?"bg-[linear-gradient(to_left,transparent_10%,var(--header-bg)_85%),linear-gradient(to_bottom,var(--trans-blue)_0%,var(--trans-blue)_20%,var(--trans-pink)_20%,var(--trans-pink)_40%,var(--trans-white)_40%,var(--trans-white)_60%,var(--trans-pink)_60%,var(--trans-pink)_80%,var(--trans-blue)_80%,var(--trans-blue)_100%)]":""}`,d=e.params.repo&&e.params.repo in lc?`linear-gradient(to left, transparent 20%, var(--header-bg) 85%), url(/headers/${lc[e.params.repo]})`:void 0;return c!==o.e&&he(s,o.e=c),d!==o.t&&Hs(s,"background-image",o.t=d),o},{e:void 0,t:void 0}),r})()]}})};var T$=m("<div>"),L$=m("<span>");const za=e=>{const[t,n]=T(!1),[r,s]=T(0),[a,l]=T(null);let i,o,c=null,d=null;const h=b=>{c?.disconnect(),o=b,c=new ResizeObserver(()=>{o&&s(o.offsetHeight)}),c.observe(b)};Ce(()=>{c?.disconnect(),d!==null&&clearTimeout(d)});const g=b=>{const $=a();return $&&$.top+b+32>window.innerHeight},p=()=>{const b=a();if(!b)return{};const $=b.left+b.width/2,w=g(r()),v=4;return{left:`${$}px`,top:w?`${b.top-v}px`:`${b.bottom+v}px`,transform:w?"translate(-50%, -100%)":"translate(-50%, 0)"}},x=()=>{const b=e.hoverDelay??0;l(i.getBoundingClientRect()),b>0?d=window.setTimeout(()=>{e.onHover?.(),n(!0),d=null},b):(e.onHover?.(),n(!0))},y=()=>{d!==null&&(clearTimeout(d),d=null),n(!1)};return(()=>{var b=L$();b.addEventListener("mouseleave",y),b.addEventListener("mouseenter",x);var $=i;return typeof $=="function"?Ne($,b):i=b,f(b,()=>e.trigger??u(Ie,{get class(){return`text-blue-500 hover:underline active:underline dark:text-blue-400 ${e.labelClass||""}`},get href(){return e.href},get target(){return e.newTab?"_blank":void 0},get children(){return e.label}}),null),f(b,u(k,{get when(){return t()&&Ke},get children(){return u(Yl,{get children(){var w=T$();return Ne(h,w),f(w,()=>e.children),z(v=>{var _=p(),E=`dark:bg-dark-300 dark:shadow-dark-700 pointer-events-none fixed z-50 block overflow-hidden rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 p-2 shadow-md dark:border-neutral-700 ${e.previewClass??"max-h-80 w-max max-w-sm font-mono text-xs whitespace-pre-wrap sm:max-h-112 lg:max-w-lg"}`;return v.e=Xc(w,_,v.e),E!==v.t&&he(w,v.t=E),v},{e:void 0,t:void 0}),w}})}}),null),z(()=>he(b,`group/hover-card relative ${e.class||"inline"}`)),b})()};var P$=m('<div class="flex items-center gap-2 text-sm text-neutral-500 dark:text-neutral-400"><span class="iconify lucide--loader-circle animate-spin"></span>Loading...'),I$=m('<div class="text-sm text-red-500 dark:text-red-400">'),D$=m('<div class="flex items-center gap-2"><span class="iconify lucide--at-sign text-neutral-500 dark:text-neutral-400"></span><span>'),O$=m('<div class="flex items-center gap-2"><span class="iconify lucide--hard-drive text-neutral-500 dark:text-neutral-400"></span><span>'),j$=m('<div class="text-neutral-500 dark:text-neutral-400">No info available'),U$=m('<div class="flex flex-col gap-1">');const lr=new Map,N$=async e=>{if(!lr.has(e)){lr.set(e,{loading:!0});try{const t=await Mi(e),n=t.alsoKnownAs?.find(s=>s.startsWith("at://"))?.replace("at://",""),r=cs(t)?.replace("https://","").replace("http://","");lr.set(e,{handle:n,pds:r,loading:!1})}catch(t){lr.set(e,{loading:!1,error:t.message||"Failed to resolve"})}}},gs=e=>{const[t,n]=T(null);return u(za,{get href(){return`/at://${e.did}`},get label(){return e.did},get newTab(){return e.newTab},onHover:()=>{N$(e.did);const s=lr.get(e.did);if(n(s||{loading:!0}),!s||s.loading){const a=setInterval(()=>{const l=lr.get(e.did);l&&!l.loading&&(n(l),clearInterval(a))},100);setTimeout(()=>clearInterval(a),1e4)}},get hoverDelay(){return e.hoverDelay??300},get trigger(){return e.trigger},get class(){return e.class},get labelClass(){return e.labelClass},previewClass:"w-max max-w-xs font-sans text-sm",get children(){return[u(k,{get when(){return t()?.loading},get children(){return P$()}}),u(k,{get when(){return t()?.error},get children(){var s=I$();return f(s,()=>t()?.error),s}}),u(k,{get when(){return X(()=>!t()?.loading)()&&!t()?.error},get children(){var s=U$();return f(s,u(k,{get when(){return t()?.handle},get children(){var a=D$(),l=a.firstChild,i=l.nextSibling;return f(i,()=>t()?.handle),a}}),null),f(s,u(k,{get when(){return t()?.pds},get children(){var a=O$(),l=a.firstChild,i=l.nextSibling;return f(i,()=>t()?.pds),a}}),null),f(s,u(k,{get when(){return X(()=>!t()?.handle)()&&!t()?.pds},get children(){return j$()}}),null),s}})]}})};var M$=m('<div class="flex items-center gap-2 font-sans text-sm text-neutral-500 dark:text-neutral-400"><span class="iconify lucide--loader-circle animate-spin"></span>Loading...'),B$=m('<div class="font-sans text-sm text-red-500 dark:text-red-400">'),F$=m('<div class="font-mono text-xs wrap-break-word">');const Cn=new Map,eh=e=>{const t=e.match(/^at:\/\/([^/]+)\/([^/]+)\/(.+)$/);return t?{repo:t[1],collection:t[2],rkey:t[3]}:null},z$=async e=>{if(Cn.has(e))return;const t=eh(e);if(t){Cn.set(e,{value:null,loading:!0});try{const n=await zf(t.repo),s=await new We({handler:qt({service:n})}).get("com.atproto.repo.getRecord",{params:{repo:t.repo,collection:t.collection,rkey:t.rkey}});if(!s.ok){Cn.set(e,{value:null,loading:!1,error:s.data.error});return}Cn.set(e,{value:s.data.value,loading:!1})}catch(n){Cn.set(e,{value:null,loading:!1,error:n.message||"Failed to fetch"})}}},Fi=e=>{const[t,n]=T(null),r=()=>eh(e.uri);return u(za,{get href(){return`/${e.uri}`},get label(){return e.uri},get newTab(){return e.newTab},onHover:()=>{z$(e.uri);const a=Cn.get(e.uri);if(n(a||{value:null,loading:!0}),!a||a.loading){const l=setInterval(()=>{const i=Cn.get(e.uri);i&&!i.loading&&(n(i),clearInterval(l))},100);setTimeout(()=>clearInterval(l),1e4)}},get hoverDelay(){return e.hoverDelay??300},get trigger(){return e.trigger},get class(){return e.class},get labelClass(){return e.labelClass},get children(){return[u(k,{get when(){return t()?.loading},get children(){return M$()}}),u(k,{get when(){return t()?.error},get children(){var a=B$();return f(a,()=>t()?.error),a}}),u(k,{get when(){return X(()=>!!t()?.value)()&&!t()?.loading},get children(){var a=F$();return f(a,u(Lr,{get data(){return t()?.value},get repo(){return r()?.repo||""},truncate:!0,newTab:!0,hideBlobs:!0})),a}})]}})};var V$=m('<video class="max-h-80 max-w-[20rem]"controls playsinline><source type=video/mp4>');const K$=e=>{let t,n;return pt(async()=>{const r=await fetch(`https://${ze()}/xrpc/com.atproto.sync.getBlob?did=${e.did}&cid=${e.cid}`);if(!r.ok)throw new Error(r.statusText);const s=await r.blob();n=URL.createObjectURL(s),t&&(t.src=n)}),Ce(()=>{n&&URL.revokeObjectURL(n)}),(()=>{var r=V$(),s=t;return typeof s=="function"?Ne(s,r):t=r,r})()};var H$=m("<span>…"),q$=m('<span class="ml-1 text-neutral-500 dark:text-neutral-400">(+<!>)'),W$=m('<span><span class="text-neutral-500 dark:text-neutral-400">"</span><span class="text-neutral-500 dark:text-neutral-400">"'),G$=m('<button type=button class="cursor-pointer text-blue-500 hover:underline active:underline dark:text-blue-400">'),Z$=m('<a class="underline hover:text-blue-500 dark:hover:text-blue-400"target=_blank rel=noopener>'),X$=m('<span class="text-neutral-500 dark:text-neutral-400">(<!>)'),J$=m('<span class="flex gap-1">'),Y$=m('<a class="group/key rounded"><span class="absolute top-1/2 -left-3.5 flex -translate-y-1/2 items-center text-xs text-neutral-500 opacity-0 transition-opacity group-hover/key:opacity-100 dark:text-neutral-400"><span class="iconify lucide--link"></span></span><span class="text-neutral-500 dark:text-neutral-400">:'),Q$=m('<button type=button class="flex items-center gap-0.5 rounded bg-neutral-200 px-1 text-xs whitespace-nowrap text-neutral-500 hover:bg-neutral-300 hover:text-neutral-700 sm:py-0.5 dark:bg-neutral-700 dark:text-neutral-400 dark:hover:bg-neutral-600 dark:hover:text-neutral-200"><span class="iconify lucide--chevron-right">'),ek=m('<span class="group/fold absolute inset-y-0 left-0 z-10 flex w-4 -translate-x-1/2 items-center justify-center"><span class="h-full w-px bg-neutral-300 transition-colors group-hover/fold:bg-neutral-600 dark:bg-neutral-600 dark:group-hover/fold:bg-neutral-300">'),tk=m('<span><span class="relative flex size-fit shrink-0 items-center gap-x-1 wrap-anywhere"></span><span>'),nk=m('<span><span class="text-neutral-500 dark:text-neutral-400">:'),rk=m('<img class="h-auto max-h-48 max-w-64 cursor-zoom-in object-contain">'),sk=m('<div class="fixed inset-0 z-50 flex cursor-zoom-out items-center justify-center bg-black/80 transition-opacity duration-200 starting:opacity-0"><img class="max-h-screen max-w-screen object-contain transition-all duration-200 starting:scale-95 starting:opacity-0">'),ak=m('<button class="flex items-center gap-1 rounded-md bg-neutral-200 px-2 py-1.5 text-sm transition-colors hover:bg-neutral-300 active:bg-neutral-400 dark:bg-neutral-700 dark:hover:bg-neutral-600 dark:active:bg-neutral-500"><span class="iconify lucide--image"></span><span class=font-sans>Show media'),lk=m('<div><span class="group/media relative my-0.5 flex w-fit">'),ik=m('<div class="flex h-48 w-48 items-center justify-center rounded bg-neutral-200 dark:bg-neutral-800"><span class="iconify lucide--loader-circle animate-spin text-xl text-neutral-400 dark:text-neutral-500">'),ok=m("<span>Failed to load video"),ck=m('<span class="text-neutral-400 dark:text-neutral-500">{ }'),dk=m('<span class="text-neutral-400 dark:text-neutral-500">[ ]'),uk=m('<span class="text-amber-500 dark:text-amber-400">'),fk=m('<span class="text-neutral-400 dark:text-neutral-500">null');const zi=Bn(),Vi=()=>mt(zi),hk=URL.canParse??((e,t)=>{try{return new URL(e,t),!0}catch{return!1}}),gk=e=>{const t=Vi(),n=At(),r=Fn(),s=async c=>{try{const[d,h]=c.split("#"),g=await Wn(d),p=h?`#schema:${h}`:"#schema";t.newTab?window.open(`/at://${g}/com.atproto.lexicon.schema/${d}${p}`,"_blank"):n(`/at://${g}/com.atproto.lexicon.schema/${d}${p}`)}catch(d){console.error("Failed to resolve lexicon authority:",d);const h=Nn({message:"Could not resolve schema",type:"error"});setTimeout(()=>Mt(h),5e3)}},a=200,l=()=>t.truncate&&e.data.length>a,i=()=>l()?e.data.slice(0,a):e.data,o=()=>e.data.length-a;return(()=>{var c=W$(),d=c.firstChild,h=d.nextSibling;return f(c,u(oe,{get each(){return i().split(/(\s)/)},children:g=>X(()=>X(()=>!!mi(g))()?u(Fi,{uri:g,get newTab(){return t.newTab}}):X(()=>!!Vn(g))()?u(gs,{did:g,get newTab(){return t.newTab}}):X(()=>!!(zt(g.split("#")[0])&&e.isType))()?(()=>{var p=G$();return p.$$click=()=>s(g),f(p,g),p})():X(()=>!!(_a(g)&&e.isLink&&t.parentIsBlob&&r.repo))()?u(Ie,{class:"text-blue-500 hover:underline active:underline dark:text-blue-400",rel:"noopener",target:"_blank",get href(){return`https://${ze()}/xrpc/com.atproto.sync.getBlob?did=${r.repo}&cid=${g}`},children:g}):X(()=>!!(hk(g)&&["http:","https:","web+at:"].includes(new URL(g).protocol)&&g.split(` 26 + `).length===1))()?(()=>{var p=Z$();return ae(p,"href",g),f(p,g),p})():g)}),h),f(c,u(k,{get when(){return l()},get children(){return H$()}}),h),f(c,u(k,{get when(){return l()},get children(){var g=q$(),p=g.firstChild,x=p.nextSibling;return x.nextSibling,f(g,()=>o().toLocaleString(),x),g}}),null),c})()},pk=({data:e,isSize:t})=>(()=>{var n=J$();return f(n,e,null),f(n,u(k,{when:t,get children(){var r=X$(),s=r.firstChild,a=s.nextSibling;return a.nextSibling,f(r,()=>Jf(e),a),r}}),null),n})(),th=e=>{const t=Vi(),n=bt(),[r,s]=T(!0),a=e.parentIsBlob??t.parentIsBlob,l=()=>{const g=String(e.label);return g.startsWith("#")?g.slice(1):g},i=()=>t.path?`${t.path}.${l()}`:l(),o=()=>n.hash===`#record:${i()}`;Ue(()=>{o()&&requestAnimationFrame(()=>{document.getElementById(`key-${i()}`)?.scrollIntoView({behavior:"instant",block:"center"})})});const c=()=>e.value===Object(e.value),d=()=>Array.isArray(e.value)?e.value.length===0:Object.keys(e.value).length===0,h=()=>{if(Array.isArray(e.value)){const p=e.value.length;return`[ ${p} ${p===1?"item":"items"} ]`}const g=Object.keys(e.value).length;return`{ ${g} ${g===1?"key":"keys"} }`};return(()=>{var g=tk(),p=g.firstChild,x=p.nextSibling;return f(p,u(k,{get when(){return t.keyLinks},get fallback(){return(()=>{var y=nk(),b=y.firstChild;return f(y,()=>e.label,b),z($=>ye(y,{"text-indigo-500 dark:text-indigo-400":!e.isIndex,"text-violet-500 dark:text-violet-400":e.isIndex},$)),y})()},get children(){var y=Y$(),b=y.firstChild,$=b.nextSibling;return f(y,()=>e.label,$),z(w=>{var v=`#record:${i()}`,_=`key-${i()}`,E={"text-indigo-500 hover:text-indigo-700 active:text-indigo-800 dark:text-indigo-400 dark:hover:text-indigo-300 dark:active:text-indigo-200":!e.isIndex&&!o(),"text-violet-500 hover:text-violet-700 active:text-violet-800 dark:text-violet-400 dark:hover:text-violet-300 dark:active:text-violet-200":e.isIndex&&!o(),"bg-indigo-200 text-indigo-700 dark:bg-indigo-500/60 dark:text-indigo-200":o()&&!e.isIndex,"bg-violet-200 text-violet-700 dark:bg-violet-500/60 dark:text-violet-200":o()&&e.isIndex};return v!==w.e&&ae(y,"href",w.e=v),_!==w.t&&ae(y,"id",w.t=_),w.a=ye(y,E,w.a),w},{e:void 0,t:void 0,a:void 0}),y}}),null),f(p,u(k,{get when(){return X(()=>!r())()&&h()},get children(){var y=Q$();return y.firstChild,y.$$click=()=>s(!0),f(y,h,null),y}}),null),f(x,u(k,{get when(){return X(()=>!!c())()&&!d()},get children(){var y=ek();return y.$$click=()=>s(!r()),y}}),null),f(x,u(zi.Provider,{get value(){return{...t,parentIsBlob:a,path:i()}},get children(){return u(nh,{get data(){return e.value},get isType(){return e.isType},get isLink(){return e.isLink},get isSize(){return e.isSize}})}}),null),z(y=>{var b={"group/indent flex gap-x-1 w-full":!0,"flex-col":c()&&!d()},$={"max-w-[40%] sm:max-w-[50%]":e.maxWidth!==void 0&&r()},w={"self-center":!c()||d(),"relative pl-[2ch]":c()&&!d(),"invisible h-0 overflow-hidden":!r()};return y.e=ye(g,b,y.e),y.t=ye(p,$,y.t),y.a=ye(x,w,y.a),y},{e:void 0,t:void 0,a:void 0}),g})()},mk=e=>{const t=Vi(),n=Fn(),[r,s]=T(localStorage.hideMedia==="true"||n.rkey===void 0);Ue(()=>{ar()&&s(ar())});const a=e.data.$type==="blob",l=a||t.parentIsBlob,i=u(oe,{get each(){return Object.entries(e.data)},children:([h,g])=>u(th,{label:h,value:g,maxWidth:"set",isType:h==="$type",isLink:h==="$link",isSize:h==="size"&&a,parentIsBlob:l})}),o=e.data,c=()=>ze()&&!t.hideBlobs&&(o.mimeType.startsWith("image/")||o.mimeType==="video/mp4"),d=()=>{const[h,g]=T(!1),[p,x]=T(!1),y=()=>{x(!0),setTimeout(()=>{g(!1),x(!1)},200)};Ue(()=>{if(!h())return;const $=w=>{w.key==="Escape"&&y()};window.addEventListener("keydown",$),Ce(()=>window.removeEventListener("keydown",$))});const[b]=Ht(()=>o.mimeType.startsWith("image/")?o.ref.$link:null,async $=>{const w=`https://${ze()}/xrpc/com.atproto.sync.getBlob?did=${t.repo}&cid=${$}`;return await new Promise(v=>{const _=new Image;_.src=w,_.onload=()=>v(),_.onerror=()=>v()}),w});return(()=>{var $=lk(),w=$.firstChild;return f(w,u(k,{get when(){return!r()},get children(){return[u(k,{get when(){return o.mimeType.startsWith("image/")},get children(){return u(k,{get when(){return X(()=>!b.loading)()&&b()},get fallback(){return ik()},get children(){return[(()=>{var v=rk();return v.$$click=()=>g(!0),z(()=>ae(v,"src",b())),v})(),u(k,{get when(){return h()},get children(){return u(Yl,{get children(){var v=sk(),_=v.firstChild;return v.$$click=y,z(E=>{var S=!!p(),C={"scale-95 opacity-0":p()},A=b();return S!==E.e&&v.classList.toggle("opacity-0",E.e=S),E.t=ye(_,C,E.t),A!==E.a&&ae(_,"src",E.a=A),E},{e:void 0,t:void 0,a:void 0}),v}})}})]}})}}),u(k,{get when(){return o.mimeType==="video/mp4"},get children(){return u(dn,{fallback:()=>ok(),get children(){return u(K$,{get did(){return t.repo},get cid(){return o.ref.$link}})}})}})]}}),null),f(w,u(k,{get when(){return r()},get children(){var v=ak();return v.$$click=()=>s(!1),v}}),null),$})()};return Object.keys(e.data).length===0?ck():o.$type==="blob"?[u(k,{get when(){return c()},get children(){return u(d,{})}}),i]:i},bk=e=>e.data.length===0?dk():u(oe,{get each(){return e.data},children:(t,n)=>u(th,{get label(){return`#${n()}`},value:t,isIndex:!0})}),nh=e=>{const t=e.data;return typeof t=="string"?u(gk,{data:t,get isType(){return e.isType},get isLink(){return e.isLink}}):typeof t=="number"?u(pk,{data:t,get isSize(){return e.isSize}}):typeof t=="boolean"?(()=>{var n=uk();return f(n,()=>String(t)),n})():t===null?fk():Array.isArray(t)?u(bk,{data:t}):u(mk,{data:t})},Lr=e=>u(zi.Provider,{get value(){return{repo:e.repo,truncate:e.truncate,newTab:e.newTab,hideBlobs:e.hideBlobs,keyLinks:e.keyLinks}},get children(){return u(nh,{get data(){return e.data}})}});ke(["click"]);const xk=e=>e.name.endsWith(".car")||e.type==="application/vnd.ipld.car",rh=e=>t=>{const n=t.target,r=n.files?.[0];r&&e(r),n.value=""},sh=e=>t=>{t.preventDefault();const n=t.dataTransfer?.files?.[0];n&&xk(n)&&e(n)},ah=e=>{e.preventDefault()};var vk=m('<span class="iconify lucide--arrow-left">'),yk=m('<span class="iconify lucide--folder-archive text-3xl text-neutral-400">'),wk=m('<div class=text-center><p class="text-sm font-medium text-neutral-700 dark:text-neutral-300">Drag and drop a CAR file here</p><p class="text-xs text-neutral-500 dark:text-neutral-400">or'),$k=m('<label class="dark:bg-dark-300 dark:hover:bg-dark-200 dark:active:bg-dark-100 flex items-center gap-1 rounded-md border border-neutral-300 bg-neutral-50 px-2.5 py-1.5 text-sm text-neutral-700 transition-colors select-none hover:bg-neutral-100 active:bg-neutral-200 dark:border-neutral-700 dark:text-neutral-300"><input type=file class=hidden><span class="iconify lucide--upload text-sm"></span>Choose file'),kk=m('<div class="rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-800 dark:bg-red-900/20 dark:text-red-300">'),_k=m('<div class="flex w-full max-w-3xl flex-col gap-y-4 px-2"><div class="flex flex-col gap-y-1"><div class="flex items-center gap-2 text-lg"><h1 class=font-semibold></h1></div><p class="text-sm text-neutral-600 dark:text-neutral-400"></p></div><div class="dark:bg-dark-300 flex flex-col items-center justify-center gap-3 rounded-lg border-2 border-dashed border-neutral-300 bg-neutral-50 p-8 transition-colors hover:border-neutral-400 dark:border-neutral-600 dark:hover:border-neutral-500">'),Sk=m('<span class="text-xs text-neutral-500 dark:text-neutral-400"> records processed'),Ek=m('<div class="flex flex-col items-center gap-2"><span class="iconify lucide--loader-circle animate-spin text-3xl text-neutral-400"></span><span class="text-sm font-medium text-neutral-600 dark:text-neutral-400">Reading CAR file...');const lh=/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1,rs=e=>{if(e==null)return null;if(wr(e))return{$link:e.$link};if(e&&typeof e=="object"&&"version"in e&&"codec"in e&&"digest"in e&&"bytes"in e)try{return{$link:ns(e)}}catch{}if(ji(e))return{$bytes:e.$bytes};if(Array.isArray(e))return e.map(rs);if(typeof e=="object"){const t={};for(const[n,r]of Object.entries(e))t[n]=rs(r);return t}return e},ih=e=>(()=>{var t=_k(),n=t.firstChild,r=n.firstChild,s=r.firstChild,a=r.nextSibling,l=n.nextSibling;return f(r,u(Ie,{href:"/car",class:"flex size-7 items-center justify-center rounded text-neutral-500 transition-colors hover:bg-neutral-200 hover:text-neutral-700 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:hover:text-neutral-200",get children(){return vk()}}),s),f(s,()=>e.title),f(a,()=>e.subtitle),$t(l,"dragover",e.onDragOver),$t(l,"drop",e.onDrop),f(l,u(k,{get when(){return!e.loading},get fallback(){return(()=>{var i=Ek(),o=i.firstChild;return o.nextSibling,f(i,u(k,{get when(){return X(()=>!!e.progress)()&&e.progress>0},get children(){var c=Sk(),d=c.firstChild;return f(c,()=>e.progress?.toLocaleString(),d),c}}),null),i})()},get children(){return[yk(),wk(),(()=>{var i=$k(),o=i.firstChild;return $t(o,"change",e.onFileChange),ae(o,"accept",lh?void 0:".car,application/vnd.ipld.car"),i})()]}})),f(t,u(k,{get when(){return e.error},get children(){var i=kk();return f(i,()=>e.error),i}}),null),t})();var ic=m("<span class=shrink-0>"),Ck=m("<span class=truncate>(<!>)"),Ak=m('<button type=button class="flex min-h-6 min-w-0 basis-full items-center gap-2 px-2 sm:min-h-7"><span class="iconify lucide--book-user shrink-0 text-neutral-500 transition-colors duration-200 group-hover:text-neutral-700 dark:text-neutral-400 dark:group-hover:text-neutral-200"></span><span class="flex min-w-0 gap-1 py-0.5 font-medium text-blue-500 transition-colors duration-150 group-hover:text-blue-600 dark:text-blue-400 dark:group-hover:text-blue-300">'),Rk=m('<div class="flex w-full flex-col"><nav class="flex w-full flex-col text-sm wrap-anywhere sm:text-base"><div class="group relative flex items-center justify-between gap-1 rounded-md border-[0.5px] border-transparent bg-transparent transition-all duration-200 hover:border-neutral-300 hover:bg-neutral-50/40 dark:hover:border-neutral-600 dark:hover:bg-neutral-800/40"><button type=button title="Close and upload a different file"class="flex shrink-0 items-center rounded px-2 py-1 text-neutral-500 transition-all duration-200 hover:bg-neutral-200/70 hover:text-neutral-600 active:bg-neutral-300/70 sm:py-1.5 dark:text-neutral-400 dark:hover:bg-neutral-700/70 dark:hover:text-neutral-300 dark:active:bg-neutral-600/70"><span class="iconify lucide--x"></span></button></div></nav><div class="px-2 py-2">'),oc=m('<span class="truncate text-neutral-500 dark:text-neutral-400">(<!>)'),Tk=m('<div class="flex min-h-6 min-w-0 basis-full items-center gap-2 px-2 sm:min-h-7"><span class="iconify lucide--book-user shrink-0 text-neutral-500 transition-colors duration-200 group-hover:text-neutral-700 dark:text-neutral-400 dark:group-hover:text-neutral-200"></span><span class="flex min-w-0 gap-1 py-0.5 font-medium">'),cc=m("<span class=truncate>"),Lk=m('<button type=button class="group relative flex w-full items-center justify-between gap-1 rounded-md border-[0.5px] border-transparent bg-transparent px-2 transition-all duration-200 hover:border-neutral-300 hover:bg-neutral-50/40 dark:hover:border-neutral-600 dark:hover:bg-neutral-800/40"><div class="flex min-h-6 min-w-0 basis-full items-center gap-2 sm:min-h-7"><span class="iconify lucide--folder-open shrink-0 text-neutral-500 transition-colors duration-200 group-hover:text-neutral-700 dark:text-neutral-400 dark:group-hover:text-neutral-200"></span><span class="truncate py-0.5 font-medium text-blue-500 transition-colors duration-150 group-hover:text-blue-600 dark:text-blue-400 dark:group-hover:text-blue-300">'),Pk=m('<div class="group relative flex items-center justify-between gap-1 rounded-md border-[0.5px] border-transparent bg-transparent px-2 transition-all duration-200 hover:border-neutral-300 hover:bg-neutral-50/40 dark:hover:border-neutral-600 dark:hover:bg-neutral-800/40"><div class="flex min-h-6 min-w-0 basis-full items-center gap-2 sm:min-h-7"><span class="iconify lucide--folder-open shrink-0 text-neutral-500 transition-colors duration-200 group-hover:text-neutral-700 dark:text-neutral-400 dark:group-hover:text-neutral-200"></span><span class="truncate py-0.5 font-medium">'),Ik=m('<div class="group relative flex items-center justify-between gap-1 rounded-md border-[0.5px] border-transparent bg-transparent px-2 transition-all duration-200 hover:border-neutral-300 hover:bg-neutral-50/40 dark:hover:border-neutral-600 dark:hover:bg-neutral-800/40"><div class="flex min-h-6 min-w-0 basis-full items-center gap-2 sm:min-h-7"><span class="iconify lucide--file-json shrink-0 text-neutral-500 transition-colors duration-200 group-hover:text-neutral-700 dark:text-neutral-400 dark:group-hover:text-neutral-200"></span><div class="flex min-w-0 gap-1 py-0.5 font-medium"><span class=shrink-0>'),Dk=m('<div class="flex flex-col items-center justify-center py-8 text-center"><span class="iconify lucide--search-x mb-2 text-3xl text-neutral-400"></span><p class="text-sm text-neutral-600 dark:text-neutral-400">No collections match your filter'),Ok=m('<div class="flex flex-col gap-3"><div class="text-sm text-neutral-600 dark:text-neutral-400"> collection<span class="text-neutral-400 dark:text-neutral-600"> · </span> record</div><ul class="flex flex-col">'),jk=m('<span class="iconify lucide--chevron-right shrink-0 text-xs text-neutral-500">'),Uk=m('<span class="truncate font-medium text-blue-500 dark:text-blue-400">'),Nk=m('<span class="ml-auto text-xs text-neutral-500">'),Mk=m('<li><button class="flex w-full items-center gap-2 rounded p-2 text-left text-sm hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-800 dark:active:bg-neutral-700"><span class="truncate font-medium">'),Bk=m('<span class="text-sm text-neutral-600 dark:text-neutral-400">/'),Fk=m('<div class="flex flex-col items-center justify-center py-8 text-center"><span class="iconify lucide--search-x mb-2 text-3xl text-neutral-400"></span><p class="text-sm text-neutral-600 dark:text-neutral-400">No records match your filter'),zk=m('<div class="flex flex-col gap-3"><span class="text-sm text-neutral-600 dark:text-neutral-400"> record</span><div class="flex items-center gap-2"></div><div class="flex flex-col font-mono">'),Vk=m('<span class="text-neutral-400 dark:text-neutral-500"> (of <!>)'),Kk=m('<button class="flex w-full items-baseline gap-1 px-1 py-0.5"><span class="max-w-full shrink-0 truncate text-sm text-blue-500 dark:text-blue-400"></span><span class="truncate text-xs text-neutral-500 dark:text-neutral-400"dir=rtl>'),Hk=m('<span class="ml-auto shrink-0 text-xs">'),qk=m('<div class="max-w-full min-w-full font-mono text-xs wrap-anywhere whitespace-pre-wrap sm:w-max sm:max-w-screen sm:px-4 sm:text-sm md:max-w-3xl">'),Wk=m('<div class="flex flex-col items-center gap-3"><div class="flex w-full items-center gap-2 text-sm text-neutral-600 sm:text-base dark:text-neutral-400"><span class="iconify lucide--box shrink-0"></span><span class="text-xs break-all">'),Gk=m('<div class="rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-800 dark:bg-red-900/20 dark:text-red-300">Failed to decode record');const Zk=e=>{switch(e.type){case"repo":return"";case"collection":return`#${e.collection.name}`;case"record":return`#${e.collection.name}/${e.record.key}`}},Xk=(e,t)=>{if(!e||e==="#")return{type:"repo"};const n=e.startsWith("#")?e.slice(1):e,r=n.indexOf("/");if(r===-1){const i=t.entries.find(o=>o.name===n);return i?{type:"collection",collection:i}:{type:"repo"}}const s=n.slice(0,r),a=n.slice(r+1),l=t.entries.find(i=>i.name===s);if(l){const i=l.entries.find(o=>o.key===a);return i?{type:"record",collection:l,record:i}:{type:"collection",collection:l}}return{type:"repo"}},Jk=()=>{const e=bt(),t=At(),[n,r]=T(null),[s,a]=T(!1),[l,i]=T(0),[o,c]=T(),d=ce(()=>{const b=n();return b?Xk(e.hash,b):{type:"repo"}}),h=b=>{const $=Zk(b);t(`${e.pathname}${$}`)},g=async b=>{a(!0),i(0),c(void 0);try{const $=new Uint8Array(await b.arrayBuffer()),w=Nf($);let v="Repository";const _=w.roots[0]?.$link;if(_)for(const D of w)try{if(ns(D.cid)===_){const N=Et(D.bytes);Ui(N)&&(v=N.did);break}}catch{}const E=new Map,S={file:b,did:v,entries:[]},C=b.stream(),A=Bf(C);try{let D=0;for await(const N of A)try{let I=E.get(N.collection);I===void 0&&(E.set(N.collection,I=[]),S.entries.push({name:N.collection,entries:I}));const M=rs(N.record);I.push({key:N.rkey,cid:N.cid.$link,record:M}),++D%1e4===0&&(i(D),await new Promise(Y=>setTimeout(Y,0)))}catch{}}finally{await A.dispose()}if(v!=="Repository")try{const D=await Mi(v);hs[v]=D}catch(D){console.error("Failed to resolve DID document:",D)}r(S),e.hash&&t(e.pathname,{replace:!0})}catch($){console.error("Failed to parse CAR file:",$),c($ instanceof Error?$.message:"Failed to parse CAR file")}finally{a(!1)}},p=rh(g),x=sh(g),y=()=>{r(null),c(void 0),e.hash&&t(e.pathname,{replace:!0})};return[u(Rt,{children:"Explore archive - PDSls"}),u(k,{get when(){return n()},get fallback(){return u(ih,{title:"Explore archive",subtitle:"Upload a CAR file to explore its contents.",get loading(){return s()},get progress(){return l()},get error(){return o()},onFileChange:p,onDrop:x,onDragOver:ah})},children:b=>u(Yk,{get archive(){return b()},view:d,setView:h,onClose:y})})]},Yk=e=>{const t=hs[e.archive.did]?.alsoKnownAs?.filter(n=>n.startsWith("at://"))[0]?.split("at://")[1]??e.archive.did;return(()=>{var n=Rk(),r=n.firstChild,s=r.firstChild,a=s.firstChild,l=r.nextSibling;return f(s,u(k,{get when(){return e.view().type!=="repo"},get fallback(){return(()=>{var i=Tk(),o=i.firstChild,c=o.nextSibling;return f(c,u(k,{get when(){return t!==e.archive.did},get fallback(){return(()=>{var d=cc();return f(d,()=>e.archive.did),d})()},get children(){return[(()=>{var d=ic();return f(d,t),d})(),(()=>{var d=oc(),h=d.firstChild,g=h.nextSibling;return g.nextSibling,f(d,()=>e.archive.did,g),d})()]}})),i})()},get children(){var i=Ak(),o=i.firstChild,c=o.nextSibling;return i.$$click=()=>e.setView({type:"repo"}),f(c,u(k,{get when(){return t!==e.archive.did},get fallback(){return(()=>{var d=cc();return f(d,()=>e.archive.did),d})()},get children(){return[(()=>{var d=ic();return f(d,t),d})(),(()=>{var d=Ck(),h=d.firstChild,g=h.nextSibling;return g.nextSibling,f(d,()=>e.archive.did,g),d})()]}})),i}}),a),$t(a,"click",e.onClose,!0),f(r,u(k,{get when(){const i=e.view();return i.type==="collection"||i.type==="record"?i.collection:null},children:i=>u(k,{get when(){return e.view().type==="record"},get fallback(){return(()=>{var o=Pk(),c=o.firstChild,d=c.firstChild,h=d.nextSibling;return f(h,()=>i().name),o})()},get children(){var o=Lk(),c=o.firstChild,d=c.firstChild,h=d.nextSibling;return o.$$click=()=>e.setView({type:"collection",collection:i()}),f(h,()=>i().name),o}})}),null),f(r,u(k,{get when(){const i=e.view();return i.type==="record"?i.record:null},children:i=>{const o=ce(()=>{if(!i().key||!hn(i().key))return;const c=fn(i().key).timestamp/1e3;return c<=Date.now()?c:void 0});return(()=>{var c=Ik(),d=c.firstChild,h=d.firstChild,g=h.nextSibling,p=g.firstChild;return f(p,()=>i().key),f(g,u(k,{get when(){return o()},get children(){var x=oc(),y=x.firstChild,b=y.nextSibling;return b.nextSibling,f(x,()=>Ct(o()),b),x}}),null),c})()}}),null),f(l,u(Zc,{get children(){return[u(or,{get when(){return e.view().type==="repo"},get children(){return u(Qk,{get archive(){return e.archive},get onRoute(){return e.setView}})}}),u(or,{get when(){const i=e.view();return i.type==="collection"?i:null},keyed:!0,children:({collection:i})=>u(e_,{get archive(){return e.archive},collection:i,get onRoute(){return e.setView}})}),u(or,{get when(){const i=e.view();return i.type==="record"?i:null},keyed:!0,children:({collection:i,record:o})=>u(t_,{get archive(){return e.archive},collection:i,record:o})})]}})),n})()},Qk=e=>{const[t,n]=T(""),r=ce(()=>[...e.archive.entries].sort((l,i)=>l.name.localeCompare(i.name))),s=ce(()=>{const l=t().toLowerCase().trim();return l?r().filter(i=>i.name.toLowerCase().includes(l)):r()}),a=ce(()=>e.archive.entries.reduce((l,i)=>l+i.entries.length,0));return(()=>{var l=Ok(),i=l.firstChild,o=i.firstChild,c=o.nextSibling,d=c.nextSibling,h=i.nextSibling;return f(i,()=>e.archive.entries.length,o),f(i,()=>e.archive.entries.length!==1?"s":"",c),f(i,a,d),f(i,()=>a()!==1?"s":"",null),f(l,u(Kt,{placeholder:"Filter collections",get value(){return t()},onInput:g=>n(g.currentTarget.value),class:"text-sm"}),h),f(h,u(oe,{get each(){return s()},children:g=>{const p=g.entries.length===1,x=()=>g.name.split(".").slice(0,2).join(".");return(()=>{var y=Mk(),b=y.firstChild,$=b.firstChild;return b.$$click=()=>{p?e.onRoute({type:"record",collection:g,record:g.entries[0]}):e.onRoute({type:"collection",collection:g})},f(b,u(_r,{get authority(){return x()}}),$),f($,()=>g.name),f(b,u(k,{when:p,get children(){return[jk(),(()=>{var w=Uk();return f(w,()=>g.entries[0].key),w})()]}}),null),f(b,u(k,{when:!p,get children(){var w=Nk();return f(w,()=>g.entries.length),w}}),null),z(w=>ye($,{"text-neutral-700 dark:text-neutral-300":p,"text-blue-500 dark:text-blue-400":!p},w)),y})()}})),f(l,u(k,{get when(){return X(()=>s().length===0)()&&t()},get children(){return Dk()}}),null),l})()},sl=100,e_=e=>{const[t,n]=T(""),r=Qf(t,150),[s,a]=T(sl),l=ce(()=>[...e.collection.entries].sort((g,p)=>{const x=hn(g.key),y=hn(p.key);return x&&y?fn(p.key).timestamp-fn(g.key).timestamp:x?-1:y?1:p.key.localeCompare(g.key)})),i=ce(()=>l().map(g=>({entry:g,searchText:JSON.stringify(g.record).toLowerCase()}))),o=ce(()=>{const g=r().toLowerCase().trim();return g?i().filter(({searchText:p})=>p.includes(g)).map(({entry:p})=>p):l()});Ue(()=>{r(),Me(()=>a(sl))});const c=ce(()=>o().slice(0,s())),d=ce(()=>o().length>s()),h=()=>{a(g=>g+sl)};return(()=>{var g=zk(),p=g.firstChild,x=p.firstChild,y=p.nextSibling,b=y.nextSibling;return f(p,()=>o().length,x),f(p,()=>o().length!==1?"s":"",null),f(p,(()=>{var $=X(()=>!!(t()&&o().length!==e.collection.entries.length));return()=>$()&&(()=>{var w=Vk(),v=w.firstChild,_=v.nextSibling;return _.nextSibling,f(w,()=>e.collection.entries.length,_),w})()})(),null),f(y,u(Kt,{placeholder:"Filter records",get value(){return t()},onInput:$=>n($.currentTarget.value),class:"grow text-sm"}),null),f(y,u(k,{get when(){return d()},get children(){return[(()=>{var $=Bk(),w=$.firstChild;return f($,()=>c().length,w),f($,()=>o().length,null),$})(),u(Se,{onClick:h,children:"Load more"})]}}),null),f(b,u(oe,{get each(){return c()},children:$=>{const v=hn($.key)?fn($.key).timestamp/1e3:null;return u(za,{class:"flex w-full items-baseline gap-1 rounded hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600",get trigger(){return(()=>{var _=Kk(),E=_.firstChild,S=E.nextSibling;return _.$$click=()=>{e.onRoute({type:"record",collection:e.collection,record:$})},f(E,()=>$.key),f(S,()=>$.cid),f(_,u(k,{when:v,children:C=>(()=>{var A=Hk();return f(A,()=>Ct(C())),A})()}),null),_})()},get children(){return u(Lr,{get data(){return $.record},get repo(){return e.archive.did},truncate:!0,hideBlobs:!0})}})}})),f(g,u(k,{get when(){return X(()=>o().length===0)()&&t()},get children(){return Fk()}}),null),g})()},t_=e=>(()=>{var t=Wk(),n=t.firstChild,r=n.firstChild,s=r.nextSibling;return f(s,()=>e.record.cid),f(t,u(k,{get when(){return e.record.record!==null},get fallback(){return Gk()},get children(){var a=qk();return f(a,u(Lr,{get data(){return e.record.record},get repo(){return e.archive.did||""},newTab:!0,hideBlobs:!0})),a}}),null),t})();ke(["click"]);var n_=m('<span class="iconify lucide--folder-search mt-0.5 shrink-0 text-xl text-neutral-500 dark:text-neutral-400">'),r_=m('<div class="flex flex-col gap-1"><span class=font-medium>Explore archive</span><span class="text-sm text-neutral-600 dark:text-neutral-400">Browse records inside a repository archive'),s_=m('<span class="iconify lucide--file-archive mt-0.5 shrink-0 text-xl text-neutral-500 dark:text-neutral-400">'),a_=m('<div class="flex flex-col gap-1"><span class=font-medium>Unpack archive</span><span class="text-sm text-neutral-600 dark:text-neutral-400">Extract records from an archive into a ZIP file'),l_=m('<div class="flex w-full max-w-3xl flex-col gap-y-4 px-2"><div class="flex flex-col gap-y-1"><h1 class="text-lg font-semibold">Archive tools</h1><p class="text-sm text-neutral-600 dark:text-neutral-400">Tools for working with CAR (Content Addressable aRchive) files.</p></div><div class="flex flex-col gap-3">');const i_=()=>(()=>{var e=l_(),t=e.firstChild,n=t.nextSibling;return f(e,u(Rt,{children:"Archive tools - PDSls"}),t),f(n,u(Ie,{href:"explore",class:"dark:bg-dark-300 flex items-start gap-3 rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 p-4 text-left transition-colors hover:border-neutral-400 hover:bg-neutral-100 dark:border-neutral-600 dark:hover:border-neutral-500 dark:hover:bg-neutral-800",get children(){return[n_(),r_()]}}),null),f(n,u(Ie,{href:"unpack",class:"dark:bg-dark-300 flex items-start gap-3 rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 p-4 text-left transition-colors hover:border-neutral-400 hover:bg-neutral-100 dark:border-neutral-600 dark:hover:border-neutral-500 dark:hover:bg-neutral-800",get children(){return[s_(),a_()]}}),null),e})(),o_=e=>e.getSeconds(),c_=e=>e.getMinutes(),d_=e=>e.getHours(),u_=e=>e.getDate(),f_=e=>e.getMonth(),h_=e=>e.getFullYear(),dc=String.fromCharCode,Ms=new TextEncoder,al=new TextDecoder;async function uc(e,t){const n=new Uint8Array(t);let r=0;for await(const s of e){const a=s.length,l=Math.min(a,t-r);if(l===a?n.set(s,r):n.set(s.subarray(0,l),r),r+=l,r>=t)break}if(r<t)throw new Error(`unexpected end of stream: expected ${t} bytes, got ${r}`);return n}const fc=(e,t,n)=>{let r;r=e;const s=r.length;if(s>24)return al.decode(r);{let a="",l=0;for(;l+3<s;l+=4){const i=r[l],o=r[l+1],c=r[l+2],d=r[l+3];if((i|o|c|d)&128)return a+al.decode(r.subarray(l));a+=dc(i,o,c,d)}for(;l<s;l++){const i=r[l];if(i&128)return a+al.decode(r.subarray(l));a+=dc(i)}return a}},g_={},p_=/[<>:"|?*\x00-\x1f]/,m_=/(?:^|[/\\])\.\.(?:[/\\]|$)/,b_=/[^\x00-\x7f]/;function hc(e,t,n,r){const s=new Uint8Array(e.buffer,e.byteOffset+t,n);Ms.encodeInto(r,s)}function Ge(e,t,n){e.setUint32(t,n,!0)}function De(e,t,n){e.setUint16(t,n,!0)}const x_=(()=>{const e=new Int32Array(256);for(let t=0;t<256;++t){let n=t,r=9;for(;--r;)n=(n&1?3988292384:0)^n>>>1;e[t]=n}return e})();function Cs(e,t=4294967295){for(let n=0,r=e.length;n<r;n++)t=x_[(t^e[n])&255]^t>>>8;return t^-1}function v_(e){const t=new Date(e*1e3),n=o_(t)>>1&31|(c_(t)&63)<<5|(d_(t)&31)<<11,r=u_(t)&31|(f_(t)+1&15)<<5|(h_(t)-1980&127)<<9;return{time:n,date:r}}function y_(e){if(e.length===0)throw new Error("invalid filename: cannot be empty");if(e.length>65535)throw new Error("invalid filename: too long (max 65535 bytes)");if(m_.test(e))throw new Error("invalid filename: contains path traversal");if(e.startsWith("/"))throw new Error("invalid filename: is an absolute path");if(p_.test(e))throw new Error("invalid filename: contains invalid characters")}function w_(e){return b_.test(e)}async function*gc(e){const t=[];let n=0;for await(const{filename:r,data:s,compress:a="deflate",attrs:l=g_}of e){y_(r);const i=n,c=Ms.encode(r).length,d=l?.mtime??Math.floor(Date.now()/1e3),{time:h,date:g}=v_(d);let p=0,x=4294967295,y=8,b=0,$=0;a==="deflate"&&(p=8),w_(r)&&(y|=2048);{const w=new ArrayBuffer(30+c),v=new DataView(w);Ge(v,0,67324752),De(v,4,20),De(v,6,y),De(v,8,p),De(v,10,h),De(v,12,g),Ge(v,14,0),Ge(v,18,0),Ge(v,22,0),De(v,26,c),De(v,28,0),hc(v,30,c,r),n+=30+c,yield new Uint8Array(w)}if(a==="deflate"){let w;if(s instanceof ReadableStream)w=s.pipeThrough(new TransformStream({transform(v,_){b+=v.length,x=Cs(v,x),_.enqueue(v)}}));else{const v=typeof s=="string"?Ms.encode(s):s;b=v.length,x=Cs(v,x),w=new ReadableStream({start(_){_.enqueue(v),_.close()}})}yield*w.pipeThrough(new CompressionStream("deflate-raw")).pipeThrough(new TransformStream({transform(v,_){_.enqueue(v),$+=v.length}}))}else if(s instanceof ReadableStream)yield*s.pipeThrough(new TransformStream({transform(w,v){b+=w.length,x=Cs(w,x),v.enqueue(w)}})),$=b;else{const w=typeof s=="string"?Ms.encode(s):s;b=w.length,$=b,x=Cs(w,x),yield w}n+=$;{const w=new ArrayBuffer(16),v=new DataView(w);Ge(v,0,134695760),Ge(v,4,x),Ge(v,8,$),Ge(v,12,b),n+=16,yield new Uint8Array(w)}{const w=new ArrayBuffer(46+c),v=new DataView(w),E=((l?.mode??33188)&65535)<<16;Ge(v,0,33639248),De(v,4,788),De(v,6,20),De(v,8,y),De(v,10,p),De(v,12,h),De(v,14,g),Ge(v,16,x),Ge(v,20,$),Ge(v,24,b),De(v,28,c),De(v,30,0),De(v,32,0),De(v,34,0),De(v,36,0),Ge(v,38,E),Ge(v,42,i),hc(v,46,c,r),t.push(new Uint8Array(w))}}{const r=n,s=t.length;let a=0;for(let l=0;l<s;l++){const i=t[l],o=i.length;n+=o,a+=o,yield i}{const l=new ArrayBuffer(22),i=new DataView(l);Ge(i,0,101010256),De(i,4,0),De(i,6,0),De(i,8,s),De(i,10,s),Ge(i,12,a),Ge(i,16,r),De(i,20,0),yield new Uint8Array(l)}}}function $n(e,t){return function(){const n=e.call(this);return Object.defineProperty(this,t.name,{value:n,writable:!1,enumerable:!1}),n}}function $_(){function e(d,h){return function(p){n(h,"addInitializer"),r(p,"An initializer"),d.push(p)}}function t(d,h,g,p,x,y,b,$,w){var v;switch(x){case 1:v="accessor";break;case 2:v="method";break;case 3:v="getter";break;case 4:v="setter";break;default:v="field"}var _={kind:v,name:b?"#"+h:h,static:y,private:b,metadata:$},E={v:!1};_.addInitializer=e(p,E);var S,C;x===0?b?(S=g.get,C=g.set):(S=function(){return this[h]},C=function(A){this[h]=A}):x===2?S=function(){return g.value}:((x===1||x===3)&&(S=function(){return g.get.call(this)}),(x===1||x===4)&&(C=function(A){g.set.call(this,A)})),_.access=S&&C?{get:S,set:C}:S?{get:S}:{set:C};try{return d(w,_)}finally{E.v=!0}}function n(d,h){if(d.v)throw new Error("attempted to call "+h+" after decoration was finished")}function r(d,h){if(typeof d!="function")throw new TypeError(h+" must be a function")}function s(d,h){var g=typeof h;if(d===1){if(g!=="object"||h===null)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");h.get!==void 0&&r(h.get,"accessor.get"),h.set!==void 0&&r(h.set,"accessor.set"),h.init!==void 0&&r(h.init,"accessor.init")}else if(g!=="function"){var p;throw d===0?p="field":d===10?p="class":p="method",new TypeError(p+" decorators must return a function or void 0")}}function a(d,h,g,p,x,y,b,$,w){var v=g[0],_,E,S;b?x===0||x===1?_={get:g[3],set:g[4]}:x===3?_={get:g[3]}:x===4?_={set:g[3]}:_={value:g[3]}:x!==0&&(_=Object.getOwnPropertyDescriptor(h,p)),x===1?S={get:_.get,set:_.set}:x===2?S=_.value:x===3?S=_.get:x===4&&(S=_.set);var C,A,D;if(typeof v=="function")C=t(v,p,_,$,x,y,b,w,S),C!==void 0&&(s(x,C),x===0?E=C:x===1?(E=C.init,A=C.get||S.get,D=C.set||S.set,S={get:A,set:D}):S=C);else for(var N=v.length-1;N>=0;N--){var I=v[N];if(C=t(I,p,_,$,x,y,b,w,S),C!==void 0){s(x,C);var M;x===0?M=C:x===1?(M=C.init,A=C.get||S.get,D=C.set||S.set,S={get:A,set:D}):S=C,M!==void 0&&(E===void 0?E=M:typeof E=="function"?E=[E,M]:E.push(M))}}if(x===0||x===1){if(E===void 0)E=function(B,K){return K};else if(typeof E!="function"){var Y=E;E=function(B,K){for(var q=K,U=0;U<Y.length;U++)q=Y[U].call(B,q);return q}}else{var F=E;E=function(B,K){return F.call(B,K)}}d.push(E)}x!==0&&(x===1?(_.get=S.get,_.set=S.set):x===2?_.value=S:x===3?_.get=S:x===4&&(_.set=S),b?x===1?(d.push(function(B,K){return S.get.call(B,K)}),d.push(function(B,K){return S.set.call(B,K)})):x===2?d.push(S):d.push(function(B,K){return S.call(B,K)}):Object.defineProperty(h,p,_))}function l(d,h,g){for(var p=[],x,y,b=new Map,$=new Map,w=0;w<h.length;w++){var v=h[w];if(Array.isArray(v)){var _=v[1],E=v[2],S=v.length>3,C=_>=5,A,D;if(C?(A=d,_=_-5,y=y||[],D=y):(A=d.prototype,x=x||[],D=x),_!==0&&!S){var N=C?$:b,I=N.get(E)||0;if(I===!0||I===3&&_!==4||I===4&&_!==3)throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+E);!I&&_>2?N.set(E,_):N.set(E,!0)}a(p,A,v,E,_,C,S,D,g)}}return i(p,x),i(p,y),p}function i(d,h){h&&d.push(function(g){for(var p=0;p<h.length;p++)h[p].call(g);return g})}function o(d,h,g){if(h.length>0){for(var p=[],x=d,y=d.name,b=h.length-1;b>=0;b--){var $={v:!1};try{var w=h[b](x,{kind:"class",name:y,addInitializer:e(p,$),metadata:g})}finally{$.v=!0}w!==void 0&&(s(10,w),x=w)}return[c(x,g),function(){for(var v=0;v<p.length;v++)p[v].call(x)}]}}function c(d,h){return Object.defineProperty(d,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:h})}return function(h,g,p,x){if(x!==void 0)var y=x[Symbol.metadata||Symbol.for("Symbol.metadata")];var b=Object.create(y===void 0?null:y),$=l(h,g,b);return p.length||c(h,b),{e:$,get c(){return o(h,p,b)}}}}function oh(e,t,n,r){return(oh=$_())(e,t,n,r)}var pc;const As=30;function Jn(e,t){return e.getUint16(t,!0)}function ll(e,t){return e.getUint32(t,!0)}class v3{static{({e:[pc]}=oh(this,[[$n,3,"filename"],[$n,3,"size"],[$n,3,"compressedSize"],[$n,3,"compressionMethod"],[$n,3,"mtime"],[$n,3,"mode"],[$n,3,"body"]],[]))}#e;#t;#n;#s;constructor(t,n,r,s){pc(this),this.#e=t,this.#t=n,this.#n=r,this.#s=s}get#r(){const t=this.#t;return new DataView(t.buffer,t.byteOffset,t.byteLength)}get filename(){const t=Jn(this.#r,28),n=this.#n.subarray(0,t);return fc(n)}get size(){return ll(this.#r,24)}get compressedSize(){return ll(this.#r,20)}get compressionMethod(){return Jn(this.#r,10)}get mtime(){const t=this.#r,n=Jn(t,12),r=Jn(t,14),s=(n&31)*2,a=n>>>5&63,l=n>>>11&31,i=r&31,o=(r>>>5&15)-1,c=(r>>>9&127)+1980;return Date.UTC(c,o,i,l,a,s)}get mode(){return ll(this.#r,38)>>>16&65535}get body(){let t;return new ReadableStream({start:async n=>{try{let r;{const a=this.#s,l=await this.#e.read(a,As),i=await uc(l,As),o=new DataView(i.buffer,i.byteOffset,As),c=Jn(o,26),d=Jn(o,28);r=a+As+c+d}let s=await this.#e.read(r,this.compressedSize);this.compressionMethod===8&&(s=s.pipeThrough(new DecompressionStream("deflate-raw"))),t=s.getReader()}catch(r){n.error(r),await t?.cancel()}},async pull(n){const{done:r,value:s}=await t.read();r?n.close():n.enqueue(s)},async cancel(){await t?.cancel()}})}async bytes(){return await uc(this.body,this.size)}async arrayBuffer(){const t=await this.bytes();return t.byteOffset===0&&t.byteLength===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength)}async blob(){const t=await this.bytes();return new Blob([t])}async text(){const t=await this.bytes();return fc(t)}async json(){const t=await this.text();return JSON.parse(t)}}var k_=m('<ul class="flex flex-col font-mono text-xs empty:hidden"><div>'),__=m('<li class="flex gap-2 px-4 py-1 whitespace-pre-wrap"><span class="shrink-0 font-medium whitespace-pre-wrap text-neutral-400">-----</span><span class=wrap-break-word>'),S_=m("<li><span></span><span class=wrap-break-word>");const E_=()=>{const e=lg([]);let t=[],n=r=>{t.push(r)};return{internal:{get pending(){return e},attach(r){if(t!==void 0){for(let s=0,a=t.length;s<a;s++)r(t[s]);t=void 0}n=r}},log(r){n({type:"log",at:Date.now(),msg:r})},info(r){n({type:"info",at:Date.now(),msg:r})},warn(r){n({type:"warn",at:Date.now(),msg:r})},error(r){n({type:"error",at:Date.now(),msg:r})},progress(r,s=500){e.unshift({msg:r});let a=e[0];return{update:R_(l=>{a!==void 0&&(a.msg=l)},s),destroy(){if(a!==void 0){const l=e.indexOf(a);e.splice(l,1),a=void 0}},[Symbol.dispose](){this.destroy()}}}}},C_=new Intl.DateTimeFormat("en-US",{timeStyle:"short",hour12:!1}),A_=e=>(()=>{var t=k_(),n=t.firstChild;return f(t,u(oe,{get each(){return e.logger.internal.pending},children:r=>(()=>{var s=__(),a=s.firstChild,l=a.nextSibling;return f(l,()=>r.msg),s})()}),n),Ne(r=>{e.logger.internal.attach(({type:s,at:a,msg:l})=>{let i="flex gap-2 whitespace-pre-wrap px-4 py-1",o="shrink-0 whitespace-pre-wrap font-medium";s==="log"?o+=" text-neutral-500":s==="info"?(i+=" bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",o+=" text-blue-500"):s==="warn"?(i+=" bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-300",o+=" text-amber-500"):s==="error"&&(i+=" bg-red-100 text-red-800 dark:bg-red-900/30 dark:text-red-300",o+=" text-red-500");const c=(()=>{var d=S_(),h=d.firstChild,g=h.nextSibling;return he(d,i),he(h,o),f(h,()=>C_.format(a)),f(g,l),d})();c instanceof Node&&r.after(c)})},n),t})(),R_=(e,t)=>{let n=null,r=null,s=0;const a=()=>{e(...r),s=Date.now(),n=null};return(...l)=>{const o=Date.now()-s;r=l,o>=t?(n!==null&&clearTimeout(n),a()):n===null&&(n=setTimeout(a,t-o))}};var T_=m('<div class="w-full max-w-3xl px-2">');const L_="showSaveFilePicker"in window,mc=lh||/AppleWebKit/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent),P_=/[<>:"/\\|?*\x00-\x1F]/g,bc=e=>e.replace(P_,"~"),I_=()=>{const e=E_(),[t,n]=T(!1);let r;Ce(()=>{r?.abort()});const s=async o=>{r?.abort(),r=new AbortController;const c=r.signal;n(!0),e.log("Starting extraction");let d;const h=o.stream();d=Bf(h);try{let g=0;if(!L_){const b=[],$=async function*(){const E=e.progress("Unpacking records (0 entries)");try{for await(const S of d){if(c.aborted)return;try{const C=rs(S.record),A=`${S.collection}/${bc(S.rkey)}.json`,D=JSON.stringify(C,null,2);yield{filename:A,data:D,compress:mc?!1:"deflate"},g++,E.update(`Unpacking records (${g} entries)`)}catch{}}}finally{E[Symbol.dispose]?.()}};for await(const E of gc($())){if(c.aborted)return;b.push(E)}if(c.aborted)return;e.log(`${g} records extracted`),e.log("Creating download...");const w=new Blob(b,{type:"application/zip"}),v=URL.createObjectURL(w),_=document.createElement("a");_.href=v,_.download=`${o.name.replace(/\.car$/,"")}.zip`,document.body.appendChild(_),_.click(),document.body.removeChild(_),URL.revokeObjectURL(v),e.log("Finished! Download started."),n(!1);return}let p;const x=async function*(){const b=e.progress("Unpacking records (0 entries)");try{for await(const $ of d){if(c.aborted)return;if(p===void 0){const w=e.progress("Waiting for user...");try{const v=await window.showSaveFilePicker({suggestedName:`${o.name.replace(/\.car$/,"")}.zip`,id:"car-unpack",startIn:"downloads",types:[{description:"ZIP archive",accept:{"application/zip":[".zip"]}}]}).catch(_=>{_ instanceof DOMException&&_.name==="AbortError"?e.warn("File picker was cancelled"):e.warn("Something went wrong when opening the file picker")});if(!v){e.warn("No file handle obtained");return}if(p=await v.createWritable(),p===void 0){e.warn("Failed to create writable stream");return}}finally{w[Symbol.dispose]?.()}}try{const w=rs($.record),v=`${$.collection}/${bc($.rkey)}.json`,_=JSON.stringify(w,null,2);yield{filename:v,data:_,compress:mc?!1:"deflate"},g++,b.update(`Unpacking records (${g} entries)`)}catch{}}}finally{b[Symbol.dispose]?.()}};let y=0;for await(const b of gc(x())){if(c.aborted){await p?.abort();return}if(p===void 0){n(!1);return}y++,y%100===0?await p.write(b):p.write(b)}if(c.aborted)return;if(p===void 0){e.warn("CAR file has no records"),n(!1);return}e.log(`${g} records extracted`);{const b=e.progress("Flushing writes...");try{await p.close(),e.log("Finished! File saved successfully.")}catch($){throw e.error(`Failed to save file: ${$}`),$}finally{b[Symbol.dispose]?.()}}}catch(g){if(c.aborted)return;e.error(`Error: ${g} 27 + File might be malformed, or might not be a CAR archive`)}finally{await d?.dispose(),c.aborted||n(!1)}},a=rh(s),l=sh(s),i=o=>{t()||l(o)};return[u(Rt,{children:"Unpack archive - PDSls"}),u(ih,{title:"Unpack archive",subtitle:"Upload a CAR file to extract all records into a ZIP archive.",get loading(){return t()},onFileChange:a,onDrop:i,onDragOver:ah}),(()=>{var o=T_();return f(o,u(A_,{logger:e})),o})()]};var D_=m("<button>");const Vl=e=>{const t=()=>on(e.scope),n=()=>{t()?e.onClick():Xf(e.scope)},r=e.class||"flex items-center rounded-sm p-1.5 hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600",s=e.disabledClass||"flex items-center rounded-sm p-1.5 opacity-40",a=()=>t()?e.tooltip:`${e.tooltip??""} (permission required)`.trimStart(),l=(()=>{var i=D_();return i.$$click=n,f(i,()=>e.children),z(()=>he(i,t()?r:s)),i})();return e.tooltip?u(ot,{get text(){return a()},children:l}):l};ke(["click"]);const Ki=e=>{const t=n=>{n.key==="/"&&!["INPUT","TEXTAREA"].includes(n.target?.tagName)&&!document.querySelector("[data-modal]")&&(n.preventDefault(),e()?.focus())};document.addEventListener("keydown",t),Ce(()=>document.removeEventListener("keydown",t))},[O_,ch]=zn({}),j_=e=>O_[e],U_=(e,t)=>{ch(e,t)},Bs=e=>{ch(e,void 0)};var N_=m('<span class="max-w-full shrink-0 truncate text-sm text-blue-500 dark:text-blue-400">'),M_=m('<span class="ml-1 truncate text-xs text-neutral-500 dark:text-neutral-400"dir=rtl>'),B_=m('<span class="ml-1 shrink-0 text-xs">'),F_=m('<button class="flex items-center rounded-md p-1.5 hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600"><span class="iconify lucide--list-checks">'),z_=m('<span class="iconify lucide--recycle text-green-500 dark:text-green-400">'),V_=m('<button class="flex items-center rounded-md p-1.5 hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600"><span class="iconify lucide--trash-2 text-red-500 dark:text-red-400">'),il=m("<span>"),K_=m('<div class="flex items-center text-sm">'),H_=m('<div class="flex w-full flex-col items-center"><div class="mb-2 flex min-h-7 w-full items-center justify-between px-2 text-sm sm:text-base"><div class="flex gap-4"><span class="border-b-2 font-medium">Records</span></div></div><div class="flex max-w-full flex-col px-2 pb-20 font-mono">'),q_=m('<h2 class="mb-2 font-semibold"> <!> records?'),W_=m('<div class="flex justify-end gap-2">'),G_=m('<kbd class="rounded border border-neutral-200 bg-neutral-50 px-1.5 py-0.5 font-mono text-xs text-neutral-400 select-none dark:border-neutral-600 dark:bg-neutral-700">/'),Z_=m("<span>/"),X_=m('<div class="dark:bg-dark-500 fixed bottom-0 z-10 flex w-full flex-col items-center gap-2 border-t border-neutral-200 bg-neutral-100 px-3 pt-3 pb-6 dark:border-neutral-700"><div class="dark:bg-dark-200 flex w-full max-w-lg cursor-text items-center gap-2 rounded-lg border border-neutral-200 bg-white px-3 dark:border-neutral-700"><span class="iconify lucide--filter text-neutral-500 dark:text-neutral-400"></span><input type=text autocapitalize=off autocomplete=off class="grow py-2 select-none placeholder:text-sm focus:outline-none"placeholder="Filter records..."></div><div class="flex min-h-7.5 w-full max-w-lg items-center justify-between"><div><span> records</span></div><div class="flex w-20 items-center justify-end">'),J_=m('<span class="font-sans text-neutral-500 dark:text-neutral-400">'),Y_=m("<div>"),Q_=m('<span class="iconify lucide--loader-circle animate-spin text-base">');const xc=100,vc=e=>u(za,{class:"flex w-full min-w-0 items-baseline rounded px-1 py-0.5",get trigger(){return[(()=>{var t=N_();return f(t,()=>e.record.rkey),t})(),(()=>{var t=M_();return f(t,()=>e.record.cid),t})(),u(k,{get when(){return X(()=>!!e.record.timestamp)()&&e.record.timestamp<=Date.now()},get children(){var t=B_();return f(t,()=>Ct(e.record.timestamp)),t}})]},get children(){return u(Lr,{get data(){return e.record.record.value},get repo(){return e.record.record.uri.split("/")[2]},truncate:!0,hideBlobs:!0})}}),e1=()=>{const e=Fn(),[t,n]=ti(),[r,s]=T(),[a,l]=zn([]),[i,o]=T(),[c,d]=T(!1),[h,g]=T(),[p,x]=T(t.reverse==="true"),y=()=>{const U=Array.isArray(t.limit)?t.limit[0]:t.limit,L=parseInt(U||"");return!isNaN(L)&&L>0&&L<=100?L:xc},[b,$]=T(!1),[w,v]=T(!1),[_,E]=T(!1),S=e.repo;let C,A,D;const N=()=>`${e.pds}/${e.repo}/${e.collection}`;pt(()=>{const U=j_(N());U&&(l(U.records),s(U.cursor),x(U.reverse),n({reverse:U.reverse?"true":void 0,limit:U.limit!==xc?U.limit.toString():void 0}),E(!0),requestAnimationFrame(()=>{window.scrollTo(0,U.scrollY)})),Ki(()=>D)}),U0(U=>{const L=`/at://${S}/${e.collection}/`;typeof U.to=="string"&&U.to.startsWith(L)&&a.length>0?U_(N(),{records:[...a],cursor:r(),scrollY:window.scrollY,reverse:p(),limit:y()}):Bs(N())});const I=async()=>{if(_()&&a.length>0&&!r())return E(!1),a;_()&&E(!1);const U=r()!==void 0;C||(C=await Ba(S)),A||(A=new We({handler:qt({service:C})}));const L=await A.get("com.atproto.repo.listRecords",{params:{repo:S,collection:e.collection,limit:y(),cursor:r(),reverse:p()}});if(!L.ok)throw new Error(L.data.error);s(L.data.records.length<y()?void 0:L.data.cursor);const V=[];return L.data.records.forEach(P=>{const R=P.uri.split("/").pop();V.push({rkey:R,cid:P.cid,record:P,timestamp:hn(R)?fn(R).timestamp/1e3:void 0,toDelete:!1})}),l(U?a.concat(V):V),L.data.records},[M,{refetch:Y}]=Ht(I),F=ce(()=>a.filter(U=>i()?JSON.stringify(U.record.value).includes(i()):!0)),B=async()=>{const U=a.filter(R=>R.toDelete);let L=[];U.forEach(R=>{L.push({$type:"com.atproto.repo.applyWrites#delete",collection:e.collection,rkey:R.rkey}),b()&&L.push({$type:"com.atproto.repo.applyWrites#create",collection:e.collection,rkey:R.rkey,value:R.record.value})});const V=200;A=new We({handler:xe()});for(let R=0;R<L.length;R+=V)await A.post("com.atproto.repo.applyWrites",{input:{repo:xe().sub,writes:L.slice(R,R+V)}});const P=Nn({message:`${U.length} records ${b()?"recreated":"deleted"}`,type:"success"});setTimeout(()=>Mt(P),3e3),d(!1),l([]),s(void 0),v(!1),$(!1),Bs(N()),Y()},K=(U,L)=>{U.shiftKey&&h()!==void 0?l({from:h()<L?h():L+1,to:L>h()?L-1:h()},"toDelete",!0):g(L)},q=()=>l(a.map((U,L)=>JSON.stringify(U.record.value).includes(i()??"")?L:void 0).filter(U=>U!==void 0),"toDelete",!0);return[u(Rt,{get children(){return[X(()=>e.collection)," - PDSls"]}}),u(k,{get when(){return a.length||M()},get children(){return[(()=>{var U=H_(),L=U.firstChild,V=L.firstChild;V.firstChild;var P=L.nextSibling;return f(V,u(Ie,{get href(){return`/jetstream?collections=${e.collection}&dids=${e.repo}`},class:"border-b-2 border-transparent font-medium transition-colors not-hover:text-neutral-600 not-hover:dark:text-neutral-300/80",children:"Jetstream"}),null),f(L,u(k,{get when(){return X(()=>!!xe())()&&xe()?.sub===S},get children(){var R=K_();return f(R,u(k,{get when(){return c()},get children(){return[u(ot,{text:"Select all",get children(){var O=F_();return O.$$click=()=>q(),O}}),u(Vl,{scope:"create",tooltip:"Recreate",class:"flex items-center rounded-md p-1.5 hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600",disabledClass:"flex items-center rounded-md p-1.5 opacity-40",onClick:()=>{$(!0),v(!0)},get children(){return z_()}}),u(ot,{text:"Delete",get children(){var O=V_();return O.$$click=()=>{$(!1),v(!0)},O}})]}}),null),f(R,u(Vl,{scope:"delete",class:"flex items-center gap-1 rounded-md px-2 py-1 hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600",disabledClass:"flex items-center gap-1 rounded-md px-2 py-1 opacity-40",onClick:()=>{l({from:0,to:a.length-1},"toDelete",!1),g(void 0),d(!c())},get children(){return[(()=>{var O=il();return z(()=>he(O,`iconify ${c()?"lucide--x":"lucide--square-check-big"}`)),O})(),X(()=>c()?"Cancel":"Manage")]}}),null),R}}),null),f(P,u(k,{get when(){return F().length>0},get fallback(){return(()=>{var R=J_();return f(R,()=>i()?"No records match filter":"No records"),R})()},get children(){return u(oe,{get each(){return F()},children:(R,O)=>{const Z=()=>{const j=F(),G=j[O()-1]?.toDelete,ie=j[O()+1]?.toDelete;return`${G?"":"rounded-t"} ${ie?"":"rounded-b"}`};return[u(k,{get when(){return c()},get children(){var j=Y_();return j.$$click=G=>{K(G,O()),l(O(),"toDelete",!R.toDelete)},f(j,u(vc,{record:R})),z(()=>he(j,`select-none ${R.toDelete?`bg-blue-200 hover:bg-blue-300/80 active:bg-blue-300 dark:bg-blue-700/30 dark:hover:bg-blue-700/50 dark:active:bg-blue-700/70 ${Z()}`:"rounded hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600"}`)),j}}),u(k,{get when(){return!c()},get children(){return u(Ie,{get href(){return`/at://${S}/${e.collection}/${R.rkey}`},class:"rounded select-none hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600",get children(){return u(vc,{record:R})}})}})]}})}})),U})(),u(Qt,{get open(){return w()},onClose:()=>v(!1),contentClass:"dark:bg-dark-300 dark:shadow-dark-700 pointer-events-auto rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 p-4 shadow-md dark:border-neutral-700",get children(){return[(()=>{var U=q_(),L=U.firstChild,V=L.nextSibling;return V.nextSibling,f(U,()=>b()?"Recreate":"Delete",L),f(U,()=>a.filter(P=>P.toDelete).length,V),U})(),(()=>{var U=W_();return f(U,u(Se,{onClick:()=>v(!1),children:"Cancel"}),null),f(U,u(Se,{onClick:B,get classList(){return{"bg-blue-500! text-white! hover:bg-blue-600! active:bg-blue-700! dark:bg-blue-600! dark:hover:bg-blue-500! dark:active:bg-blue-400! border-none!":b(),"text-white! border-none! bg-red-500! hover:bg-red-600! active:bg-red-700!":!b()}},get children(){return b()?"Recreate":"Delete"}}),null),U})()]}}),u(k,{get when(){return a.length>1},get children(){var U=X_(),L=U.firstChild,V=L.firstChild,P=V.nextSibling,R=L.nextSibling,O=R.firstChild,Z=O.firstChild,j=Z.firstChild,G=O.nextSibling;L.$$click=ee=>{const Q=ee.currentTarget.querySelector("input");ee.target!==Q&&Q?.focus()},P.$$input=ee=>o(ee.currentTarget.value);var ie=D;return typeof ie=="function"?Ne(ie,P):D=P,ae(P,"spellcheck",!1),f(L,u(k,{get when(){return Ke&&!i()},get children(){return G_()}}),null),f(R,u(Se,{onClick:()=>{const ee=!p();x(ee),n({reverse:ee?"true":void 0}),s(void 0),E(!1),Bs(N()),Y()},get classList(){return{"text-blue-500! dark:text-blue-400! border-blue-500! dark:border-blue-400!":p()}},get children(){return[(()=>{var ee=il();return z(()=>he(ee,`iconify ${p()?"lucide--arrow-down-wide-narrow":"lucide--arrow-up-narrow-wide"}`)),ee})(),"Reverse"]}}),O),f(O,u(k,{get when(){return c()},get children(){return[(()=>{var ee=il();return f(ee,()=>a.filter(Q=>Q.toDelete).length),ee})(),Z_()]}}),Z),f(Z,(()=>{var ee=X(()=>!!i());return()=>ee()?F().length:a.length})(),j),f(G,u(k,{get when(){return r()},get children(){return u(Se,{onClick:()=>Y(),get disabled(){return M.loading},classList:{"w-20 h-7.5 justify-center":!0},get children(){return u(k,{get when(){return!M.loading},get fallback(){return Q_()},children:"Load more"})}})}})),U}})]}})]};ke(["click","input"]);var t1=m('<span class="flex min-w-0 items-center gap-1.5 text-xs sm:text-base"><span class="truncate font-medium">'),n1=m('<span class="text-xs text-neutral-500 sm:text-sm dark:text-neutral-400">'),r1=m("<span>"),s1=m("<button>"),a1=m("<a target=_blank>"),l1=m('<span class="iconify-color i-raycast-light block dark:hidden">'),i1=m('<span class="iconify-color i-raycast-dark hidden dark:block">'),o1=m('<span class="simple-icons--bluesky iconify text-[#0085ff]">'),c1=m('<span class="iconify i-tangled text-black dark:text-white">'),d1=m('<div class="flex w-full flex-col gap-6 px-2 wrap-break-word"><div class="flex flex-col gap-1"><h1 class="text-lg font-medium">Atmosphere Explorer</h1><div class="text-sm text-neutral-600 dark:text-neutral-300/80"><p>Browse the public data on the <a href=https://atproto.com target=_blank class="underline decoration-neutral-400 transition-colors hover:text-blue-500 hover:decoration-blue-500 dark:decoration-neutral-500 dark:hover:text-blue-400">AT Protocol</a></p></div></div><div class="flex flex-col gap-3 text-sm"><div class="grid grid-cols-2 gap-2 text-sm"></div><div class="grid grid-cols-3 gap-2"></div><div class="grid grid-cols-2 gap-2"></div></div><div class="flex justify-center gap-1.5 text-sm text-neutral-600 sm:gap-2 sm:text-base dark:text-neutral-300">•<!>•'),u1=m('<img class="size-4 shrink-0 rounded-full sm:size-5">');const ol="group flex flex-col gap-1 rounded-lg border border-neutral-200 bg-neutral-50 p-3 text-neutral-700 transition-colors dark:border-neutral-700 dark:bg-neutral-800/50 dark:text-neutral-300 hover:bg-neutral-50/50 dark:hover:bg-neutral-800",dh={blue:`${ol} hover:border-blue-500 dark:hover:border-blue-400`,orange:`${ol} hover:border-red-500 dark:hover:border-red-400`,violet:`${ol} hover:border-emerald-500 dark:hover:border-emerald-400`},f1={blue:"text-neutral-400 dark:text-neutral-500 group-hover:text-blue-500 dark:group-hover:text-blue-400",orange:"text-neutral-400 dark:text-neutral-500 group-hover:text-red-500 dark:group-hover:text-red-400",violet:"text-neutral-400 dark:text-neutral-500 group-hover:text-emerald-500 dark:group-hover:text-emerald-400"},uh=e=>[(()=>{var t=t1(),n=t.firstChild;return f(t,(()=>{var r=X(()=>typeof e.icon=="string");return()=>r()?(()=>{var s=r1();return z(()=>he(s,`${e.icon} iconify shrink-0 ${f1[e.accent]}`)),s})():e.icon})(),n),f(n,()=>e.title),t})(),(()=>{var t=n1();return f(t,()=>e.description),t})()],yc=e=>(()=>{var t=s1();return $t(t,"click",e.onClick,!0),f(t,u(uh,{get icon(){return e.icon},get title(){return e.title},get description(){return e.description},get accent(){return e.accent}})),z(()=>he(t,`${dh[e.accent]} text-left`)),t})(),Yn=e=>u(Ie,{get href(){return e.href},get class(){return dh[e.accent]},get children(){return u(uh,{get icon(){return e.icon},get title(){return e.title},get description(){return e.description},get accent(){return e.accent}})}}),h1=()=>{const e=t=>(()=>{var n=a1();return f(n,()=>t.children),z(r=>{var s=t.href,a=`relative flex items-center gap-1.5 after:absolute after:bottom-0 after:left-0 after:h-px after:w-0 after:bg-current ${t.color} after:transition-[width] after:duration-300 after:ease-out hover:after:w-full ${t.darkColor??""}`;return s!==r.e&&ae(n,"href",r.e=s),a!==r.t&&he(n,r.t=a),r},{e:void 0,t:void 0}),n})();return(()=>{var t=d1(),n=t.firstChild,r=n.nextSibling,s=r.firstChild,a=s.nextSibling,l=a.nextSibling,i=r.nextSibling,o=i.firstChild,c=o.nextSibling;return c.nextSibling,f(s,u(yc,{onClick:()=>it(!0),icon:"lucide--search",title:"Search",description:"Find any user or record",accent:"blue"}),null),f(s,u(k,{get when(){return X(()=>!!xe()?.sub)()&&wt[xe().sub]?.signedIn},get fallback(){return u(yc,{onClick:()=>{Vr(!0),Br(!0)},icon:"lucide--user-round",title:"Sign in",description:"Manage records",accent:"blue"})},get children(){return u(Yn,{get href(){return`/at://${xe().sub}`},get icon(){return X(()=>!!Sn[xe().sub])()?(()=>{var d=u1();return z(()=>ae(d,"src",Sn[xe().sub].replace("img/avatar/","img/avatar_thumbnail/"))),d})():"lucide--user-round"},get title(){return wt[xe().sub]?.handle??xe().sub},description:"View your repository",accent:"blue"})}}),null),f(a,u(Yn,{href:"/jetstream",icon:"lucide--radio-tower",title:"Jetstream",description:"Simplified stream",accent:"orange"}),null),f(a,u(Yn,{href:"/firehose",icon:"lucide--rss",title:"Firehose",description:"Raw event stream",accent:"orange"}),null),f(a,u(Yn,{href:"/spacedust",icon:"lucide--sparkles",title:"Spacedust",description:"Backlinks stream",accent:"orange"}),null),f(l,u(Yn,{href:"/labels",icon:"lucide--tag",title:"Labels",description:"Query labeler services",accent:"violet"}),null),f(l,u(Yn,{href:"/car",icon:"lucide--folder-archive",title:"Archive",description:"Unpack CAR files",accent:"violet"}),null),f(i,u(e,{href:"https://raycast.com/juliet_philippe/pdsls",color:"after:text-[#FF6363]",get children(){return[l1(),i1(),"Raycast"]}}),o),f(i,u(e,{href:"https://bsky.app/profile/did:plc:6q5daed5gutiyerimlrnojnz",color:"after:text-[#0085ff]",get children(){return[o1(),"Bluesky"]}}),c),f(i,u(e,{href:"https://tangled.org/did:plc:6q5daed5gutiyerimlrnojnz/pdsls/",color:"after:text-black",darkColor:"dark:after:text-white",get children(){return[c1(),"Source"]}}),null),t})()};ke(["click"]);var g1=m('<span class="text-xs font-medium text-red-500 dark:text-red-400">negated'),p1=m('<div class="truncate font-mono text-xs text-neutral-600 dark:text-neutral-400">'),m1=m('<div class="flex min-w-0 flex-col gap-2 rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 p-3 dark:border-neutral-700 dark:bg-neutral-800"><div class="flex flex-wrap items-baseline gap-2 text-sm"><span class="iconify lucide--tag shrink-0 self-center"></span><span class=font-medium></span><div class="flex flex-wrap gap-2 text-xs text-neutral-600 dark:text-neutral-400"><span>'),b1=m('<div class="flex items-center gap-x-1"><span class="iconify lucide--clock-fading shrink-0"></span><span>'),x1=m('<span class="iconify lucide--search">'),v1=m("<span>Search labels"),y1=m('<div class="rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-800 dark:border-red-800 dark:bg-red-900/20 dark:text-red-300">'),w1=m('<div class="flex flex-col items-center justify-center py-12 text-center"><span class="iconify lucide--loader-circle mb-3 animate-spin text-4xl text-neutral-400"></span><p class="text-sm text-neutral-600 dark:text-neutral-400">Loading labels...'),$1=m('<div class="grid gap-2">'),k1=m('<div class="flex flex-col items-center justify-center py-8 text-center"><span class="iconify lucide--search-x mb-2 text-3xl text-neutral-400"></span><p class="text-sm text-neutral-600 dark:text-neutral-400">No labels match your filter'),_1=m('<div class="flex flex-col items-center justify-center py-8 text-center"><span class="iconify lucide--tags mb-2 text-3xl text-neutral-400"></span><p class="text-sm text-neutral-600 dark:text-neutral-400">No labels found'),S1=m('<div class="w-full max-w-3xl py-2 pb-20">'),E1=m('<kbd class="rounded border border-neutral-200 bg-neutral-50 px-1.5 py-0.5 font-mono text-xs text-neutral-400 select-none dark:border-neutral-600 dark:bg-neutral-700">/'),C1=m("<span>"),A1=m("<span>/"),R1=m('<div class="dark:bg-dark-500 fixed bottom-0 z-10 flex w-full flex-col items-center gap-2 border-t border-neutral-200 bg-neutral-100 px-3 pt-3 pb-6 dark:border-neutral-700"><div class="dark:bg-dark-200 flex w-full max-w-lg cursor-text items-center gap-2 rounded-lg border border-neutral-200 bg-white px-3 dark:border-neutral-700"><span class="iconify lucide--filter text-neutral-500 dark:text-neutral-400"></span><input type=text autocapitalize=off autocomplete=off class="grow py-2 select-none placeholder:text-sm focus:outline-none"placeholder="Filter labels... (* for partial, -exclude)"></div><div class="flex min-h-7.5 w-full max-w-lg items-center justify-between"><div class=w-20></div><div><span> labels</span></div><div class="flex w-20 items-center justify-end">'),T1=m('<div class="flex w-full flex-col items-center"><div class="flex w-full flex-col gap-y-1 px-3 pb-3"><h1 class="text-lg font-semibold">Labels</h1><p class="text-sm text-neutral-600 dark:text-neutral-400">Query labels applied to accounts and records.</p></div><form class="flex w-full max-w-3xl flex-col gap-y-3 px-3 pb-2"><div class="flex flex-col gap-y-3"><label class="flex w-full flex-col gap-y-1"><span class="text-sm font-medium text-neutral-700 dark:text-neutral-300">Labeler handle or DID</span></label><label class="flex w-full flex-col gap-y-1"><span class="text-sm font-medium text-neutral-700 dark:text-neutral-300">URI patterns (comma-separated)</span><textarea id=uriPatterns name=uriPatterns rows=2 placeholder=at://did:web:example.com/app.bsky.feed.post/* class="dark:bg-dark-100 grow rounded-lg bg-white px-2 py-1.5 text-sm outline-1 outline-neutral-200 focus:outline-neutral-400 dark:outline-neutral-600 dark:focus:outline-neutral-400">'),L1=m('<span class="iconify lucide--loader-circle animate-spin text-base">');const wc=50,P1="did:plc:ar7c4by46qjdydhdevvrndac",I1=e=>{const t=e.label;return(()=>{var n=m1(),r=n.firstChild,s=r.firstChild,a=s.nextSibling,l=a.nextSibling,i=l.firstChild;return f(a,()=>t.val),f(r,u(k,{get when(){return t.neg},get children(){return g1()}}),l),f(i,()=>Ct(new Date(t.cts).getTime())),f(l,u(k,{get when(){return t.exp},children:o=>(()=>{var c=b1(),d=c.firstChild,h=d.nextSibling;return f(h,()=>Ct(new Date(o()).getTime())),c})()}),null),f(n,u(k,{get when(){return t.uri.startsWith("at://")},get fallback(){return u(gs,{get did(){return t.uri},labelClass:"block text-sm truncate"})},get children(){return u(Fi,{get uri(){return t.uri},labelClass:"block text-sm truncate"})}}),null),f(n,u(k,{get when(){return t.cid},get children(){var o=p1();return f(o,()=>t.cid),o}}),null),n})()},D1=()=>{const[e,t]=ti(),[n,r]=T(),[s,a]=T([]),[l,i]=T(""),[o,c]=T(!1),[d,h]=T(),[g,p]=T(e.did??"");let x,y,b;const $=ce(()=>{const S=l().trim();if(!S)return s();const C=S.split(/[\s,]+/).map(I=>I.trim()).filter(I=>I.length>0),A=I=>{if(I.includes("*")){const M=I.replace(/[.+?^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*"),Y=new RegExp(`^${M}$`);return F=>Y.test(F)}return M=>M===I},D=[],N=[];return C.forEach(I=>{I.startsWith("-")?D.push(A(I.slice(1).toLowerCase())):N.push(A(I.toLowerCase()))}),s().filter(I=>{const M=I.val.toLowerCase();return D.some(Y=>Y(M))?!1:N.length>0?N.some(Y=>Y(M)):!0})}),w=ce(()=>!!e.uriPatterns);pt(async()=>{if(Ki(()=>b),e.did&&e.uriPatterns){const S=new FormData;S.append("did",e.did.toString()),S.append("uriPatterns",e.uriPatterns.toString()),await v(S)}});const v=async(S,C)=>{let A=S.get("did")?.toString()?.trim()||P1;const D=S.get("uriPatterns")?.toString()?.trim();if(!D){h("Please provide both DID and URI patterns");return}C&&(a([]),r(void 0),h(void 0));try{if(c(!0),h(void 0),Rr(A)||(A=await Ma(A)),await Ba(A),!Fl[A])throw new Error("Repository is not a labeler");x=new We({handler:qt({service:Fl[A]})}),t({did:A,uriPatterns:D}),p(A);const N=await x.get("com.atproto.label.queryLabels",{params:{uriPatterns:D.split(",").map(M=>M.trim()),sources:[A],cursor:n(),limit:wc}});if(!N.ok)throw new Error(N.data.error||"Failed to fetch labels");const I=N.data.labels||[];r(I.length<wc?void 0:N.data.cursor),a(C?I:[...s(),...I])}catch(N){h(N instanceof Error?N.message:"An error occurred"),console.error("Failed to fetch labels:",N)}finally{c(!1)}},_=()=>{v(new FormData(y),!0)},E=()=>{v(new FormData(y))};return[u(Rt,{children:"Labels - PDSls"}),(()=>{var S=T1(),C=S.firstChild,A=C.nextSibling,D=A.firstChild,N=D.firstChild;N.firstChild;var I=N.nextSibling,M=I.firstChild,Y=M.nextSibling;A.addEventListener("submit",B=>{B.preventDefault(),_()});var F=y;return typeof F=="function"?Ne(F,A):y=A,f(N,u(Kt,{name:"did",get value(){return g()},onInput:B=>p(B.currentTarget.value),placeholder:"moderation.bsky.app (default)",class:"w-full"}),null),ae(Y,"spellcheck",!1),f(A,u(Se,{type:"submit",get disabled(){return o()},classList:{"w-fit":!0},get children(){return[x1(),v1()]}}),null),f(A,u(k,{get when(){return d()},get children(){var B=y1();return f(B,d),B}}),null),f(S,u(k,{get when(){return w()},get children(){return[(()=>{var B=S1();return f(B,u(k,{get when(){return X(()=>!!o())()&&s().length===0},get children(){return w1()}}),null),f(B,u(k,{get when(){return!o()||s().length>0},get children(){return[u(k,{get when(){return $().length>0},get children(){var K=$1();return f(K,u(oe,{get each(){return $()},children:q=>u(I1,{label:q})})),K}}),u(k,{get when(){return X(()=>s().length>0)()&&$().length===0},get children(){return k1()}}),u(k,{get when(){return X(()=>s().length===0)()&&!o()},get children(){return _1()}})]}}),null),B})(),u(k,{get when(){return s().length>1},get children(){var B=R1(),K=B.firstChild,q=K.firstChild,U=q.nextSibling,L=K.nextSibling,V=L.firstChild,P=V.nextSibling,R=P.firstChild,O=R.firstChild,Z=P.nextSibling;K.$$click=G=>{const ie=G.currentTarget.querySelector("input");G.target!==ie&&ie?.focus()},U.$$input=G=>i(G.currentTarget.value);var j=b;return typeof j=="function"?Ne(j,U):b=U,ae(U,"spellcheck",!1),f(K,u(k,{get when(){return Ke&&!l()},get children(){return E1()}}),null),f(P,u(k,{get when(){return l()},get children(){return[(()=>{var G=C1();return f(G,()=>$().length),G})(),A1()]}}),R),f(R,()=>s().length,O),f(Z,u(k,{get when(){return n()},get children(){return u(Se,{onClick:E,get disabled(){return o()},classList:{"w-20 h-7.5 justify-center":!0},get children(){return u(k,{get when(){return!o()},get fallback(){return L1()},children:"Load more"})}})}})),z(()=>U.value=l()),B}})]}}),null),z(()=>Y.value=e.uriPatterns??"*"),S})()]};ke(["click","input"]);var O1=m('<span class="flex shrink-0 items-center gap-1 text-red-500 dark:text-red-400"><span>'),j1=m('<span class="iconify lucide--arrow-right">'),U1=m("<span class=truncate>"),N1=m('<div class="flex gap-1 text-neutral-700 dark:text-neutral-300"><span></span><span>•</span><span>'),M1=m('<div class="mb-2 ml-7.5 flex flex-col gap-1 font-mono text-xs text-neutral-500 dark:text-neutral-400">'),B1=m('<div class="flex flex-col gap-1"><div class="dark:hover:bg-dark-200 flex min-w-0 flex-1 items-center rounded hover:bg-neutral-200/70"><button type=button class="flex min-w-0 flex-1 items-center gap-2 p-1.5"><span class="mt-0.5 flex shrink-0 items-center text-neutral-400 dark:text-neutral-500"></span><div class="flex min-w-0 flex-1 items-center gap-x-2 text-sm"><span class="min-w-0 truncate font-mono">'),F1=m('<span class="iconify lucide--chevron-down">'),z1=m('<span class="iconify lucide--chevron-right">'),V1=m('<div class="-mx-2 flex flex-col pb-12">'),K1=m('<div class="flex w-full flex-col px-2"><div class="mb-3 flex gap-4 text-sm sm:text-base"></div><div class="flex flex-col gap-3">'),H1=m('<span class="text-neutral-500 dark:text-neutral-400"> inactive'),q1=m('<div class="dark:bg-dark-500 fixed bottom-0 z-5 flex w-screen justify-center border-t border-neutral-200 bg-neutral-100 pt-3 pb-6 dark:border-neutral-700"><div class="flex items-center gap-3"><p> loaded'),W1=m('<div class="flex flex-col"><span class=font-semibold>Version</span><span class="text-sm text-neutral-700 dark:text-neutral-300">'),G1=m('<div class="flex flex-col"><span class=font-semibold>DID</span><span class="text-sm text-neutral-700 dark:text-neutral-300">'),Z1=m('<div class="flex items-center gap-1"><span class=font-semibold>Invite Code Required</span><span>'),X1=m('<div class="flex items-center gap-1"><span class=font-semibold>Captcha Verification Required</span><span class="iconify lucide--check text-green-500 dark:text-green-400">'),J1=m('<div class="flex flex-col"><span class=font-semibold>Available User Domains'),Y1=m('<div class="flex flex-col"><span class=font-semibold>Privacy Policy</span><a class="text-sm text-neutral-700 hover:underline dark:text-neutral-300"target=_blank rel=noopener>'),Q1=m('<div class="flex flex-col"><span class=font-semibold>Terms of Service</span><a class="text-sm text-neutral-700 hover:underline dark:text-neutral-300"target=_blank rel=noopener>'),eS=m('<div class="flex flex-col"><span class=font-semibold>Contact</span><a class="text-sm text-neutral-700 hover:underline dark:text-neutral-300">'),tS=m('<span class="text-sm wrap-anywhere text-neutral-700 dark:text-neutral-300">'),nS=m('<span class="iconify lucide--loader-circle animate-spin text-base">');const $c=1e3,rS=()=>{const e=Fn(),t=bt(),[n,r]=T(),[s,a]=T(),[l,i]=T();js(e.pds);const o=e.pds.startsWith("localhost")?`http://${e.pds}`:`https://${e.pds}`,c=new We({handler:qt({service:o})}),d=async()=>{const v=await c.get("_health",{});r(v.data.version)},h=async()=>{const v=await c.get("com.atproto.server.describeServer");v.ok?a(v.data):console.error(v.data.error)},g=async()=>{d(),h();const v=await c.get("com.atproto.sync.listRepos",{params:{limit:$c,cursor:l()}});if(!v.ok)throw new Error(v.data.error);return i(v.data.repos.length<$c?void 0:v.data.cursor),b(y()?.concat(v.data.repos)??v.data.repos),v.data},[p,{refetch:x}]=Ht(g),[y,b]=T(),$=v=>{const[_,E]=T(!1),[S,C]=T(!1);return(()=>{var A=B1(),D=A.firstChild,N=D.firstChild,I=N.firstChild,M=I.nextSibling,Y=M.firstChild;return D.addEventListener("mouseleave",()=>Ke&&C(!1)),D.addEventListener("mouseenter",()=>Ke&&C(!0)),N.$$click=()=>E(!_()),f(I,(()=>{var F=X(()=>!!_());return()=>F()?F1():z1()})()),Y.$$click=F=>F.stopPropagation(),f(Y,u(gs,{newTab:!0,get did(){return v.did}})),f(M,u(k,{get when(){return!v.active},get children(){var F=O1(),B=F.firstChild;return f(F,()=>v.status??"inactive",null),z(()=>he(B,`iconify ${v.status==="deactivated"?"lucide--user-round-x":v.status==="takendown"?"lucide--shield-ban":"lucide--unplug"}`)),F}}),null),f(D,u(k,{get when(){return _()||S()},get children(){return u(Ie,{get href(){return`/at://${v.did}`},class:"flex shrink-0 items-center p-2 transition-colors not-hover:text-neutral-500 not-hover:dark:text-neutral-400",get children(){return j1()}})}}),null),f(A,u(k,{get when(){return _()},get children(){var F=M1();return f(F,u(k,{get when(){return v.head},get children(){var B=U1();return f(B,()=>v.head),B}}),null),f(F,u(k,{get when(){return hn(v.rev)},get children(){var B=N1(),K=B.firstChild,q=K.nextSibling,U=q.nextSibling;return f(K,()=>v.rev),f(U,()=>Ct(fn(v.rev).timestamp/1e3)),B}}),null),F}}),null),A})()},w=v=>u(Ie,{get classList(){return{"border-b-2 font-medium transition-colors":!0,"border-transparent not-hover:dark:text-neutral-300/80 not-hover:text-neutral-600":!!t.hash&&t.hash!==`#${v.tab}`||!t.hash&&v.tab!=="repos"}},get href(){return X(()=>v.tab==="firehose")()?`/firehose?instance=wss://${e.pds}`:`/${e.pds}#${v.tab}`},get children(){return v.label}});return[u(Rt,{get children(){return[X(()=>e.pds)," - PDSls"]}}),u(k,{get when(){return y()||p()},get children(){return[(()=>{var v=K1(),_=v.firstChild,E=_.nextSibling;return f(_,u(w,{tab:"repos",label:"Repositories"}),null),f(_,u(w,{tab:"info",label:"Info"}),null),f(_,u(w,{tab:"firehose",label:"Firehose"}),null),f(v,u(k,{get when(){return!t.hash||t.hash==="#repos"},get children(){var S=V1();return f(S,u(oe,{get each(){return y()},children:C=>u($,C)})),S}}),E),f(E,u(k,{get when(){return t.hash==="#info"},get children(){return[u(k,{get when(){return n()},children:S=>(()=>{var C=W1(),A=C.firstChild,D=A.nextSibling;return f(D,S),C})()}),u(k,{get when(){return s()},children:S=>[(()=>{var C=G1(),A=C.firstChild,D=A.nextSibling;return f(D,()=>S().did),C})(),(()=>{var C=Z1(),A=C.firstChild,D=A.nextSibling;return z(N=>ye(D,{"iconify lucide--check text-green-500 dark:text-green-400":S().inviteCodeRequired===!0,"iconify lucide--x text-red-500 dark:text-red-400":!S().inviteCodeRequired},N)),C})(),u(k,{get when(){return S().phoneVerificationRequired},get children(){return X1()}}),u(k,{get when(){return S().availableUserDomains.length},get children(){var C=J1();return C.firstChild,f(C,u(oe,{get each(){return S().availableUserDomains},children:A=>(()=>{var D=tS();return f(D,A),D})()}),null),C}}),u(k,{get when(){return S().links?.privacyPolicy},get children(){var C=Y1(),A=C.firstChild,D=A.nextSibling;return f(D,()=>S().links?.privacyPolicy),z(()=>ae(D,"href",S().links?.privacyPolicy)),C}}),u(k,{get when(){return S().links?.termsOfService},get children(){var C=Q1(),A=C.firstChild,D=A.nextSibling;return f(D,()=>S().links?.termsOfService),z(()=>ae(D,"href",S().links?.termsOfService)),C}}),u(k,{get when(){return S().contact?.email},get children(){var C=eS(),A=C.firstChild,D=A.nextSibling;return f(D,()=>S().contact?.email),z(()=>ae(D,"href",`mailto:${S().contact?.email}`)),C}})]})]}})),v})(),u(k,{get when(){return!t.hash||t.hash==="#repos"},get children(){var v=q1(),_=v.firstChild,E=_.firstChild,S=E.firstChild;return f(E,()=>y()?.length,S),f(E,u(k,{get when(){return y()?.some(C=>!C.active)},get children(){return[" · ",(()=>{var C=H1(),A=C.firstChild;return f(C,()=>y()?.filter(D=>!D.active).length,A),C})()]}}),null),f(_,u(k,{get when(){return l()},get children(){return u(Se,{onClick:()=>x(),get disabled(){return p.loading},classList:{"w-20 h-7.5 justify-center":!0},get children(){return u(k,{get when(){return!p.loading},get fallback(){return nS()},children:"Load more"})}})}}),null),v}})]}})]};ke(["click"]);class sS{#e;constructor(t,n){const r={nsid:n,defId:"main",dotPath:""},s={docs:t,cache:new WeakMap},a=Hi(s,null,r);if(a.type!=="record")throw new Error(`${jt(r)} is not a record definition (got ${a.type})`);const l=de({key:Ku(lS(a.key)),object:fS(s,r,a).value});this.#e=l}is(t){return Mu(this.#e,t)}try(t){return cb(this.#e,t)}parse(t){return db(this.#e,t)}}const Tn=e=>({get value(){const t=e();return Object.defineProperty(this,"value",{value:t}),t}}),yn=e=>({value:e}),Va=e=>jt(e)+e.dotPath,fh=(e,t)=>{const n=av(t,e.nsid);return{nsid:n.nsid,defId:n.defId,dotPath:""}},Hi=(e,t,n)=>{const r=e.docs[n.nsid];if(r===void 0)throw t===null?new Error(`can't find document: ${n.nsid}`):new Error(`${jt(t)} tried to reference a nonexistent document: ${n.nsid}`);const s=r.defs[n.defId];if(s===void 0)throw t===null?new Error(`can't find definition: ${jt(n)}`):new Error(`${jt(t)} tried to reference a nonexistent definition: ${jt(n)}`);return s},qi=(e,t)=>({nsid:e.nsid,defId:e.defId,dotPath:`${e.dotPath}/${t}`}),aS=(e,t)=>Va(e)+(t.length>0?`/${t.join("/")}`:""),Wt=(e,t)=>{if(t.length===0)return;const n=t[0];throw new Error(`${aS(e,n.path)}: ${n.message}`)},lS=(e="any")=>e==="any"?ge():e==="tid"?lt():e==="nsid"?Si():e.startsWith("literal:")?ne(e.slice(8)):ge(),hh=(e,t,n)=>{let r=e.cache.get(n);if(r!=null)return r;Wt(t,ff(n));const{const:s,default:a}=n;let l=ki();return s!==void 0&&(l=ne(s)),a!==void 0&&(l=H(l,a)),r=yn(l),e.cache.set(n,r),r},gh=(e,t,n)=>{let r=e.cache.get(n);if(r!=null)return r;Wt(t,hf(n));const{const:s,default:a,enum:l,maximum:i=1/0,minimum:o=0}=n,c=[];(o>0||i<1/0)&&c.push(ea(o,i));let d=xn();return s!==void 0?d=ne(s):l!==void 0?d=Fu(l.toSorted()):c.length>0&&(d=ve(d,c)),a!==void 0&&(d=H(d,a)),r=yn(d),e.cache.set(n,r),r},iS=e=>{switch(e){case"at-identifier":return pb();case"at-uri":return _t();case"cid":return zu();case"datetime":return Ze();case"did":return Hn();case"handle":return Vu();case"language":return Ta();case"nsid":return Si();case"record-key":return mb();case"tid":return lt();case"uri":return La();default:return ge()}},ph=(e,t,n)=>{let r=e.cache.get(n);if(r!=null)return r;Wt(t,gf(n));const{const:s,default:a,enum:l,format:i,maxGraphemes:o=1/0,maxLength:c=1/0,minGraphemes:d=0,minLength:h=0}=n,g=[];(h>0||c<1/0)&&g.push(qe(h,c)),(d>0||o<1/0)&&g.push(Qe(d,o));let p=ge();return i!==void 0&&(p=iS(i)),s!==void 0?p=ne(s):l!==void 0?p=Fu(l.toSorted()):g.length>0&&(p=ve(p,g)),a!==void 0&&(p=H(p,a)),r=yn(p),e.cache.set(n,r),r},mh=(e,t,n)=>{let r=e.cache.get(n);if(r!=null)return r;Wt(t,pf(n));const{maxLength:s=1/0,minLength:a=0}=n,l=[];(a>0||s<1/0)&&l.push(wb(a,s));let i=yb();return l.length>0&&(i=ve(i,l)),r=yn(i),e.cache.set(n,r),r},bh=(e,t,n)=>{let r=e.cache.get(n);return r!=null||(r=yn(_b()),e.cache.set(n,r)),r},xh=(e,t,n)=>{let r=e.cache.get(n);return r!=null||(Wt(t,mf(n)),r=yn(sn()),e.cache.set(n,r)),r},oS=(e,t,n)=>{let r=e.cache.get(n);if(r!=null)return r;let s=ne(jt(t));return r=yn(s),e.cache.set(n,r),r},cS=(e,t,n)=>{Wt(t,bf(n));const r=fh(t,n.ref),s=Hi(e,t,r);let a;switch(s.type){case"boolean":{a=hh(e,r,s);break}case"integer":{a=gh(e,r,s);break}case"string":{a=ph(e,r,s);break}case"bytes":{a=mh(e,r,s);break}case"cid-link":{a=bh(e,r,s);break}case"blob":{a=xh(e,r,s);break}case"token":{a=oS(e,r,s);break}case"unknown":{a=vh(e,r,s);break}case"array":{a=wh(e,r,s);break}case"object":{a=Wi(e,r,s);break}default:throw new Error(`${Va(t)}/ref: unsupported type (${s.type})`)}return a},dS=(e,t,n)=>{Wt(t,xf(n));const r=n.refs.map((s,a)=>{const l=fh(t,s),i=Hi(e,t,l);if(i.type==="object")return Wi(e,l,i);throw new Error(`${Va(t)}/refs/${a}: unsupported ref target (${jt(l)} -> ${i.type})`)});return Tn(()=>{const s=r.map(l=>l.value);return gt(s)})},vh=(e,t,n)=>{let r=e.cache.get(n);return r!=null||(r=yn(Pb()),e.cache.set(n,r)),r},yh=(e,t,n)=>{let r,s=!1;switch(n.type){case"boolean":{r=hh(e,t,n);break}case"integer":{r=gh(e,t,n);break}case"string":{r=ph(e,t,n);break}case"bytes":{r=mh(e,t,n);break}case"cid-link":{r=bh(e,t,n);break}case"blob":{r=xh(e,t,n);break}case"ref":{s=!0,r=cS(e,t,n);break}case"union":{s=!0,r=dS(e,t,n);break}case"unknown":{r=vh(e,t,n);break}case"array":{r=wh(e,t,n);break}default:throw new Error(`${Va(t)}: unsupported type`)}return{cell:r,isRef:s}},wh=(e,t,n)=>{let r=e.cache.get(n);if(r===null)return Tn(()=>e.cache.get(n).value);if(r!==void 0)return r;e.cache.set(n,null),Wt(t,yf(n));const{items:s,maxLength:a=1/0,minLength:l=0}=n,i=yh(e,qi(t,"items"),s);return r=Tn(()=>{const o=[];(l>0||a<1/0)&&o.push(St(l,a));let c=Oe(i.isRef?()=>i.cell.value:i.cell.value);return o.length>0&&(c=ve(c,o)),c}),e.cache.set(n,r),r},uS=e=>e.type==="optional",Wi=(e,t,n,r="optional")=>{let s=e.cache.get(n);if(s===null)return Tn(()=>e.cache.get(n).value);if(s!==void 0)return s;e.cache.set(n,null),Wt(t,wf(n));const{nullable:a=[],properties:l={},required:i=[]}=n,o=[];for(const c in l){const d=l[c],h=yh(e,qi(t,`properties/${c}`),d);o.push([c,h])}return s=Tn(()=>{const c={};switch(r){case"optional":{c.$type=H(ne(jt(t)));break}case"required":{c.$type=ne(jt(t));break}}for(const[h,{cell:g,isRef:p}]of o){const x=!i.includes(h),y=a.includes(h);let b=g;if(x){const $=b;b=Tn(()=>{const w=$.value;return uS(w)?w:H(w)})}if(y){const $=b;b=Tn(()=>Ku($.value))}p?Object.defineProperty(c,h,{get:()=>b.value}):(h==="__proto__"&&Object.defineProperty(c,h,{enumerable:!0,configurable:!0,writable:!0}),c[h]=b.value)}return de(c)}),e.cache.set(n,s),s},fS=(e,t,n)=>(Wt(t,Fx(n)),Wi(e,qi(t,"record"),n.record,"required"));var hS=m('<p class="px-3 py-2 text-center text-neutral-500">Loading…'),gS=m('<a class="grid grid-cols-[auto_1fr_auto] items-center gap-x-1 px-2 py-1.5 font-mono text-xs select-none hover:bg-neutral-200/50 sm:gap-x-3 sm:px-3 dark:hover:bg-neutral-700/50"><span class="text-blue-500 dark:text-blue-400"></span><span class="text-neutral-500 tabular-nums dark:text-neutral-400">'),pS=m('<a class="block truncate text-neutral-700 hover:underline dark:text-neutral-300">'),mS=m("<div class=p-2>"),bS=m("<p class=text-neutral-500>No backlinks found."),xS=m('<div class="flex w-full flex-col gap-3 text-sm">'),vS=m("<p class=text-neutral-500>Loading…"),yS=m('<div class="border-t border-neutral-200 bg-neutral-50/50 dark:border-neutral-700 dark:bg-neutral-800/30">'),wS=m('<div class="overflow-hidden rounded-lg border border-neutral-200 dark:border-neutral-700"><button class="flex w-full items-center justify-between gap-3 px-3 py-2 text-left hover:bg-neutral-50 dark:hover:bg-neutral-800/50"><div class="flex min-w-0 flex-1 items-center gap-2"><div class="flex min-w-0 flex-1 flex-col"><span class="w-full truncate"></span><span class="w-full text-xs wrap-break-word text-neutral-500 dark:text-neutral-400"></span></div></div><div class="flex shrink-0 items-center gap-2 text-neutral-700 dark:text-neutral-300"><span class=text-xs> from <!> repo</span><span class="iconify lucide--chevron-down transition-transform">');const $S=e=>{const t=[];return Object.keys(e).toSorted().forEach(n=>{const r=e[n];Object.keys(r).toSorted().forEach(s=>{r[s].records>0&&t.push({collection:n,path:s,counts:r[s]})})}),t},$h=e=>{const[t,n]=T(),[r,s]=T(!1);return pt(async()=>{const a=await Ay(e.target,e.collection,e.path,e.cursor);n(a)}),u(k,{get when(){return t()},get fallback(){return hS()},get children(){return[u(oe,{get each(){return t().linking_records},children:({did:a,collection:l,rkey:i})=>{const o=hn(i)?Ct(fn(i).timestamp/1e3):null,c=`at://${a}/${l}/${i}`;return u(Fi,{uri:c,class:"block",get trigger(){return(()=>{var d=gS(),h=d.firstChild,g=h.nextSibling;return ae(d,"href",`/${c}`),f(h,i),f(d,u(gs,{did:a,class:"min-w-0",get trigger(){return(()=>{var p=pS();return p.$$click=x=>x.stopPropagation(),ae(p,"href",`/at://${a}`),f(p,a),p})()}}),g),f(g,o??""),d})()}})}}),u(k,{get when(){return t()?.cursor},get children(){return u(k,{get when(){return r()},get fallback(){return(()=>{var a=mS();return f(a,u(Se,{onClick:()=>s(!0),class:"dark:hover:bg-dark-200 dark:active:bg-dark-100 w-full rounded-md border-[0.5px] border-neutral-300 bg-neutral-50 px-2 py-1.5 text-sm select-none hover:bg-neutral-100 active:bg-neutral-200 dark:border-neutral-700 dark:bg-neutral-800",children:"Load more"})),a})()},get children(){return u($h,{get target(){return e.target},get collection(){return e.collection},get path(){return e.path},get cursor(){return t().cursor}})}})}})]}})},kh=e=>{const[t]=Ht(async()=>{const n=await Cy(e.target);return $S(n.links)});return(()=>{var n=xS();return f(n,u(k,{get when(){return t()},get fallback(){return vS()},get children(){return[u(k,{get when(){return t().length===0},get children(){return bS()}}),u(oe,{get each(){return t()},children:r=>u(kS,{get target(){return e.target},get collection(){return r.collection},get path(){return r.path},get counts(){return r.counts}})})]}})),n})()},kS=e=>{const[t,n]=T(!1),r=()=>e.collection.split(".").slice(0,2).join(".");return(()=>{var s=wS(),a=s.firstChild,l=a.firstChild,i=l.firstChild,o=i.firstChild,c=o.nextSibling,d=l.nextSibling,h=d.firstChild,g=h.firstChild,p=g.nextSibling;p.nextSibling;var x=h.nextSibling;return a.$$click=()=>n(!t()),f(l,u(_r,{get authority(){return r()}}),i),f(o,()=>e.collection),f(c,()=>e.path.slice(1)),f(h,()=>e.counts.records,g),f(h,()=>e.counts.distinct_dids,p),f(h,()=>e.counts.distinct_dids>1?"s":"",null),f(s,u(k,{get when(){return t()},get children(){var y=yS();return f(y,u($h,{get target(){return e.target},get collection(){return e.collection},get path(){return e.path}})),y}}),null),z(()=>x.classList.toggle("rotate-180",!!t())),s})()};ke(["click"]);var _S=m('<button type=button class="inline-block cursor-pointer truncate font-mono text-xs text-blue-500 hover:underline dark:text-blue-400">'),SS=m('<span class="font-mono text-xs text-neutral-600 dark:text-neutral-400">'),ES=m('<div class="flex flex-col items-start gap-1">'),CS=m('<span>minLength: <span class="text-neutral-600 dark:text-neutral-400">'),AS=m('<span>maxLength: <span class="text-neutral-600 dark:text-neutral-400">'),RS=m('<span>maxGraphemes: <span class="text-neutral-600 dark:text-neutral-400">'),TS=m('<span>minGraphemes: <span class="text-neutral-600 dark:text-neutral-400">'),LS=m('<span>min: <span class="text-neutral-600 dark:text-neutral-400">'),PS=m('<span>max: <span class="text-neutral-600 dark:text-neutral-400">'),IS=m('<span>maxSize: <span class="text-neutral-600 dark:text-neutral-400">'),DS=m('<span>accept: <span class="text-neutral-600 dark:text-neutral-400">[<!>]'),OS=m('<span>enum: <span class="text-neutral-600 dark:text-neutral-400">[<!>]'),jS=m('<span>const: <span class="text-neutral-600 dark:text-neutral-400">'),US=m('<span>default: <span class="text-neutral-600 dark:text-neutral-400">'),NS=m('<span>knownValues: <span class="text-neutral-600 dark:text-neutral-400">[<!>]'),MS=m('<span>closed: <span class="text-neutral-600 dark:text-neutral-400">true'),BS=m('<div class="flex flex-wrap gap-x-4 gap-y-1 text-xs">'),kc=m('<span class="font-mono text-xs text-neutral-600 dark:text-neutral-400">union'),FS=m('<span class="text-xs font-semibold text-red-500 dark:text-red-400">required'),zS=m('<div class="flex flex-wrap items-baseline gap-2"><span class=font-semibold>'),VS=m('<div class="flex flex-col gap-2"><div class="flex items-baseline gap-2 text-xs"><span class=font-medium>items:'),KS=m('<p class="text-sm wrap-break-word whitespace-pre-wrap text-neutral-700 dark:text-neutral-300">'),HS=m('<div class="flex flex-col gap-2 py-3">'),qS=m('<button type=button class="cursor-pointer font-mono text-xs text-blue-500 hover:underline dark:text-blue-400">'),WS=m('<div class="flex items-center gap-2"><span class="text-sm font-semibold">Schema:'),GS=m('<div class="flex flex-col gap-2"><div class="flex items-center gap-2"><span class="text-sm font-semibold">Schema (union):'),_h=m('<div class="divide-y divide-neutral-200 rounded-lg border border-neutral-200 bg-neutral-50/50 px-3 dark:divide-neutral-700 dark:border-neutral-700 dark:bg-neutral-800/30">'),ZS=m('<div class="flex flex-col gap-2"><h4 class="text-sm font-semibold text-neutral-600 uppercase dark:text-neutral-400"></h4><div class="flex flex-col gap-2 rounded-lg border border-neutral-200 bg-neutral-50/50 p-3 dark:border-neutral-700 dark:bg-neutral-800/30"><div class=text-sm><span class=font-semibold>Encoding: </span><span class=font-mono>'),XS=m('<div class="flex flex-col gap-1"><span class="text-xs font-semibold text-neutral-500 dark:text-neutral-400">Collections:</span><div class="flex flex-col items-start gap-1">'),JS=m('<div class="flex flex-col gap-1"><span class="text-xs font-semibold text-neutral-500 dark:text-neutral-400">Actions:</span><div class="flex flex-wrap gap-1">'),YS=m('<div class="flex flex-col gap-1"><span class="text-xs font-semibold text-neutral-500 dark:text-neutral-400">Lexicon Methods:</span><div class="flex flex-col items-start gap-1">'),QS=m('<div class="flex items-center gap-2 text-xs"><span class="font-semibold text-neutral-500 dark:text-neutral-400">Audience:</span><span class=font-mono>'),e2=m('<div class="flex items-center gap-1 text-xs"><span class="font-semibold text-neutral-500 dark:text-neutral-400">Inherit Audience:</span><span>true'),t2=m('<div class="flex flex-col gap-2 py-3"><div class="flex flex-wrap items-center gap-2"><span class=font-semibold>#</span><span>'),n2=m('<span class="dark:bg-dark-200 rounded bg-neutral-200/50 px-1.5 py-0.5 font-mono text-xs">'),Kl=m('<p class="text-sm whitespace-pre-wrap text-neutral-700 dark:text-neutral-300">'),r2=m('<div><span class="text-sm font-semibold">Record Key: </span><span class="font-mono text-sm">'),s2=m('<div class="flex flex-col gap-1"><span class="text-xs font-semibold text-neutral-500 uppercase dark:text-neutral-400">Title</span><span class="text-sm font-medium">'),a2=m('<div class="flex flex-col gap-1"><span class="text-xs font-semibold text-neutral-500 uppercase dark:text-neutral-400">Localized Titles</span><div class="flex flex-col gap-1">'),l2=m('<div class="flex flex-col gap-1"><span class="text-xs font-semibold text-neutral-500 uppercase dark:text-neutral-400">Detail</span><p class="text-sm whitespace-pre-wrap text-neutral-700 dark:text-neutral-300">'),i2=m('<div class="flex flex-col gap-1"><span class="text-xs font-semibold text-neutral-500 uppercase dark:text-neutral-400">Localized Details</span><div class="flex flex-col gap-1">'),o2=m('<div class="flex flex-col gap-2 rounded-lg border border-neutral-200 bg-neutral-50/50 p-3 dark:border-neutral-700 dark:bg-neutral-800/30">'),c2=m('<div class="flex flex-col gap-2"><h4 class="text-sm font-semibold text-neutral-600 uppercase dark:text-neutral-400">Permissions</h4><div class="divide-y divide-neutral-200 rounded-lg border border-neutral-200 bg-neutral-50/50 px-3 dark:divide-neutral-700 dark:border-neutral-700 dark:bg-neutral-800/30">'),d2=m('<div class="flex flex-col gap-2"><h4 class="text-sm font-semibold text-neutral-600 uppercase dark:text-neutral-400">Properties</h4><div class="divide-y divide-neutral-200 rounded-lg border border-neutral-200 bg-neutral-50/50 px-3 dark:divide-neutral-700 dark:border-neutral-700 dark:bg-neutral-800/30">'),u2=m('<div class="flex flex-col gap-2"><h4 class="text-sm font-semibold text-neutral-600 uppercase dark:text-neutral-400">Parameters</h4><div class="divide-y divide-neutral-200 rounded-lg border border-neutral-200 bg-neutral-50/50 px-3 dark:divide-neutral-700 dark:border-neutral-700 dark:bg-neutral-800/30">'),f2=m('<div class="flex flex-col gap-2"><h4 class="text-sm font-semibold text-neutral-600 uppercase dark:text-neutral-400">Errors</h4><div class="divide-y divide-neutral-200 rounded-lg border border-neutral-200 bg-neutral-50/50 px-3 dark:divide-neutral-700 dark:border-neutral-700 dark:bg-neutral-800/30">'),h2=m('<div class="flex scroll-mt-4 flex-col gap-3"><div class="group flex items-center gap-2"><a class="relative text-lg font-semibold hover:underline"><span class="iconify lucide--link absolute top-1/2 -left-6 -translate-y-1/2 text-base opacity-0 transition-opacity group-hover:opacity-100"></span></a><span>'),g2=m('<div class="flex items-center gap-2 text-sm"><span class="dark:bg-dark-200 rounded bg-neutral-200/50 px-1.5 py-0.5 font-mono text-xs"></span><span>'),p2=m('<div class="flex flex-col gap-1 text-sm"><span class="dark:bg-dark-200 w-fit rounded bg-neutral-200/50 px-1.5 py-0.5 font-mono text-xs"></span><p class="whitespace-pre-wrap text-neutral-700 dark:text-neutral-300">'),m2=m('<div class="flex flex-col gap-1 py-2"><div class=font-semibold>'),b2=m('<span class="iconify lucide--external-link text-sm">'),x2=m('<div class="w-full max-w-4xl px-2"><div class="flex flex-col gap-2 border-b border-neutral-300 pb-3 dark:border-neutral-700"><div class="flex items-center gap-0.5"><h2 class="text-lg font-semibold"></h2></div><div class="flex gap-4 text-sm text-neutral-600 dark:text-neutral-400"><span><span class=font-medium>Lexicon version: </span><span></span></span></div></div><div class="flex flex-col gap-6 pt-3">');const _c={repo:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",rpc:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",default:"bg-neutral-200 text-neutral-800 dark:bg-neutral-700 dark:text-neutral-300"},Sc={record:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-300",query:"bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-300",procedure:"bg-orange-100 text-orange-800 dark:bg-orange-900/30 dark:text-orange-300",subscription:"bg-pink-100 text-pink-800 dark:bg-pink-900/30 dark:text-pink-300",object:"bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-300",token:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-300","permission-set":"bg-cyan-100 text-cyan-800 dark:bg-cyan-900/30 dark:text-cyan-300",default:"bg-neutral-200 text-neutral-800 dark:bg-neutral-700 dark:text-neutral-300"},Hl=e=>e.minLength!==void 0||e.maxLength!==void 0||e.maxGraphemes!==void 0||e.minGraphemes!==void 0||e.minimum!==void 0||e.maximum!==void 0||e.maxSize!==void 0||e.accept||e.enum||e.const||e.default!==void 0||e.knownValues||e.closed,ua=e=>{const t=At(),n=e.refType?e.refType.replace(/^#/,""):e.format?`${e.type}:${e.format}`:e.type,r=()=>e.refType?.startsWith("#"),s=()=>e.refType&&!e.refType.startsWith("#"),a=async()=>{if(r()){const l=e.refType.slice(1);window.history.replaceState(null,"",`#schema:${l}`);const i=document.getElementById(`def-${l}`);i&&i.scrollIntoView({behavior:"instant",block:"start"})}else if(s())try{const[l,i]=e.refType.split("#"),o=await Wn(l),c=i?`#schema:${i}`:"#schema";t(`/at://${o}/com.atproto.lexicon.schema/${l}${c}`)}catch(l){console.error("Failed to resolve lexicon authority:",l)}};return u(k,{get when(){return e.refType},get fallback(){return(()=>{var l=SS();return f(l,n),l})()},get children(){var l=_S();return l.$$click=a,f(l,n),l}})},ql=e=>(()=>{var t=ES();return f(t,u(oe,{get each(){return e.refs},children:n=>u(ua,{type:"union",refType:n})})),t})(),Ec=e=>(()=>{var t=BS();return f(t,u(k,{get when(){return e.property.minLength!==void 0},get children(){var n=CS(),r=n.firstChild,s=r.nextSibling;return f(s,()=>e.property.minLength),n}}),null),f(t,u(k,{get when(){return e.property.maxLength!==void 0},get children(){var n=AS(),r=n.firstChild,s=r.nextSibling;return f(s,()=>e.property.maxLength),n}}),null),f(t,u(k,{get when(){return e.property.maxGraphemes!==void 0},get children(){var n=RS(),r=n.firstChild,s=r.nextSibling;return f(s,()=>e.property.maxGraphemes),n}}),null),f(t,u(k,{get when(){return e.property.minGraphemes!==void 0},get children(){var n=TS(),r=n.firstChild,s=r.nextSibling;return f(s,()=>e.property.minGraphemes),n}}),null),f(t,u(k,{get when(){return e.property.minimum!==void 0},get children(){var n=LS(),r=n.firstChild,s=r.nextSibling;return f(s,()=>e.property.minimum),n}}),null),f(t,u(k,{get when(){return e.property.maximum!==void 0},get children(){var n=PS(),r=n.firstChild,s=r.nextSibling;return f(s,()=>e.property.maximum),n}}),null),f(t,u(k,{get when(){return e.property.maxSize!==void 0},get children(){var n=IS(),r=n.firstChild,s=r.nextSibling;return f(s,()=>e.property.maxSize),n}}),null),f(t,u(k,{get when(){return e.property.accept},get children(){var n=DS(),r=n.firstChild,s=r.nextSibling,a=s.firstChild,l=a.nextSibling;return l.nextSibling,f(s,()=>e.property.accept.join(", "),l),n}}),null),f(t,u(k,{get when(){return e.property.enum},get children(){var n=OS(),r=n.firstChild,s=r.nextSibling,a=s.firstChild,l=a.nextSibling;return l.nextSibling,f(s,()=>e.property.enum.join(", "),l),n}}),null),f(t,u(k,{get when(){return e.property.const},get children(){var n=jS(),r=n.firstChild,s=r.nextSibling;return f(s,()=>e.property.const?.toString()),n}}),null),f(t,u(k,{get when(){return e.property.default!==void 0},get children(){var n=US(),r=n.firstChild,s=r.nextSibling;return f(s,()=>JSON.stringify(e.property.default)),n}}),null),f(t,u(k,{get when(){return e.property.knownValues},get children(){var n=NS(),r=n.firstChild,s=r.nextSibling,a=s.firstChild,l=a.nextSibling;return l.nextSibling,f(s,()=>e.property.knownValues.join(", "),l),n}}),null),f(t,u(k,{get when(){return e.property.closed},get children(){var n=MS(),r=n.firstChild;return r.nextSibling,n}}),null),t})(),Fs=e=>(()=>{var t=HS();return f(t,u(k,{get when(){return!e.hideNameType},get children(){var n=zS(),r=n.firstChild;return f(r,()=>e.name),f(n,u(k,{get when(){return!e.property.refs},get children(){return u(ua,{get type(){return e.property.type},get format(){return e.property.format},get refType(){return e.property.ref}})}}),null),f(n,u(k,{get when(){return e.property.refs},get children(){return kc()}}),null),f(n,u(k,{get when(){return e.required},get children(){return FS()}}),null),n}}),null),f(t,u(k,{get when(){return e.property.refs},get children(){return u(ql,{get refs(){return e.property.refs}})}}),null),f(t,u(k,{get when(){return Hl(e.property)},get children(){return u(Ec,{get property(){return e.property}})}}),null),f(t,u(k,{get when(){return e.property.items},get children(){var n=VS(),r=n.firstChild;return r.firstChild,f(r,u(k,{get when(){return!e.property.items.refs},get children(){return u(ua,{get type(){return e.property.items.type},get format(){return e.property.items.format},get refType(){return e.property.items.ref}})}}),null),f(r,u(k,{get when(){return e.property.items.refs},get children(){return kc()}}),null),f(n,u(k,{get when(){return e.property.items.refs},get children(){return u(ql,{get refs(){return e.property.items.refs}})}}),null),n}}),null),f(t,u(k,{get when(){return X(()=>!!e.property.items)()&&Hl(e.property.items)},get children(){return u(Ec,{get property(){return e.property.items}})}}),null),f(t,u(k,{get when(){return X(()=>!!e.property.description)()&&!e.hideNameType},get children(){var n=KS();return f(n,()=>e.property.description),n}}),null),t})(),Cc=e=>{const t=At(),n=async()=>{try{const r=await Wn(e.nsid);t(`/at://${r}/com.atproto.lexicon.schema/${e.nsid}#schema`)}catch(r){console.error("Failed to resolve lexicon authority:",r)}};return(()=>{var r=qS();return r.$$click=n,f(r,()=>e.nsid),r})()},v2=e=>_c[e]||_c.default,Ac=e=>(()=>{var t=ZS(),n=t.firstChild,r=n.nextSibling,s=r.firstChild,a=s.firstChild,l=a.nextSibling;return f(n,()=>e.title),f(l,()=>e.encoding),f(r,u(k,{get when(){return e.schema?.ref},get children(){var i=WS();return i.firstChild,f(i,u(ua,{type:"ref",get refType(){return e.schema.ref}}),null),i}}),null),f(r,u(k,{get when(){return e.schema?.refs},get children(){var i=GS();return i.firstChild,f(i,u(ql,{get refs(){return e.schema.refs}}),null),i}}),null),f(r,u(k,{get when(){return X(()=>!!e.schema?.properties)()&&Object.keys(e.schema.properties).length>0},get children(){var i=_h();return f(i,u(oe,{get each(){return Object.entries(e.schema.properties)},children:([o,c])=>u(Fs,{name:o,property:c,get required(){return(e.schema?.required||[]).includes(o)}})})),i}}),null),t})(),y2=e=>(()=>{var t=t2(),n=t.firstChild,r=n.firstChild;r.firstChild;var s=r.nextSibling;return f(r,()=>e.index+1,null),f(s,()=>e.permission.resource),f(t,u(k,{get when(){return X(()=>!!e.permission.collection)()&&e.permission.collection.length>0},get children(){var a=XS(),l=a.firstChild,i=l.nextSibling;return f(i,u(oe,{get each(){return e.permission.collection},children:o=>u(Cc,{nsid:o})})),a}}),null),f(t,u(k,{get when(){return X(()=>!!e.permission.action)()&&e.permission.action.length>0},get children(){var a=JS(),l=a.firstChild,i=l.nextSibling;return f(i,u(oe,{get each(){return e.permission.action},children:o=>(()=>{var c=n2();return f(c,o),c})()})),a}}),null),f(t,u(k,{get when(){return X(()=>!!e.permission.lxm)()&&e.permission.lxm.length>0},get children(){var a=YS(),l=a.firstChild,i=l.nextSibling;return f(i,u(oe,{get each(){return e.permission.lxm},children:o=>u(Cc,{nsid:o})})),a}}),null),f(t,u(k,{get when(){return e.permission.aud},get children(){var a=QS(),l=a.firstChild,i=l.nextSibling;return f(i,()=>e.permission.aud),a}}),null),f(t,u(k,{get when(){return e.permission.inheritAud},get children(){return e2()}}),null),z(()=>he(s,`rounded px-1.5 py-0.5 font-mono text-xs font-semibold ${v2(e.permission.resource)}`)),t})(),w2=e=>{const t=()=>Sc[e.def.type]||Sc.default,n=()=>e.def.refs||e.def.items||Hl(e.def);return(()=>{var r=h2(),s=r.firstChild,a=s.firstChild;a.firstChild;var l=a.nextSibling;return f(a,(()=>{var i=X(()=>e.name==="main");return()=>i()?"Main Definition":e.name})(),null),f(l,()=>e.def.type.replace("-"," ")),f(r,u(k,{get when(){return e.def.description},get children(){var i=Kl();return f(i,()=>e.def.description),i}}),null),f(r,u(k,{get when(){return e.def.key},get children(){var i=r2(),o=i.firstChild,c=o.nextSibling;return f(c,()=>e.def.key),i}}),null),f(r,u(k,{get when(){return X(()=>e.def.type==="permission-set")()&&(e.def.title||e.def.detail)},get children(){var i=o2();return f(i,u(k,{get when(){return e.def.title},get children(){var o=s2(),c=o.firstChild,d=c.nextSibling;return f(d,()=>e.def.title),o}}),null),f(i,u(k,{get when(){return e.def["title:lang"]},get children(){var o=a2(),c=o.firstChild,d=c.nextSibling;return f(d,u(oe,{get each(){return Object.entries(e.def["title:lang"])},children:([h,g])=>(()=>{var p=g2(),x=p.firstChild,y=x.nextSibling;return f(x,h),f(y,g),p})()})),o}}),null),f(i,u(k,{get when(){return e.def.detail},get children(){var o=l2(),c=o.firstChild,d=c.nextSibling;return f(d,()=>e.def.detail),o}}),null),f(i,u(k,{get when(){return e.def["detail:lang"]},get children(){var o=i2(),c=o.firstChild,d=c.nextSibling;return f(d,u(oe,{get each(){return Object.entries(e.def["detail:lang"])},children:([h,g])=>(()=>{var p=p2(),x=p.firstChild,y=x.nextSibling;return f(x,h),f(y,g),p})()})),o}}),null),i}}),null),f(r,u(k,{get when(){return X(()=>!!e.def.permissions)()&&e.def.permissions.filter(i=>i.resource==="repo"||i.resource==="rpc").length>0},get children(){var i=c2(),o=i.firstChild,c=o.nextSibling;return f(c,u(oe,{get each(){return e.def.permissions.filter(d=>d.resource==="repo"||d.resource==="rpc")},children:(d,h)=>u(y2,{permission:d,get index(){return h()}})})),i}}),null),f(r,u(k,{get when(){return Object.keys(e.def.properties||e.def.record?.properties||{}).length>0},get children(){var i=d2(),o=i.firstChild,c=o.nextSibling;return f(c,u(oe,{get each(){return Object.entries(e.def.properties||e.def.record?.properties||{})},children:([d,h])=>u(Fs,{name:d,property:h,get required(){return(e.def.required||e.def.record?.required||[]).includes(d)}})})),i}}),null),f(r,u(k,{get when(){return X(()=>!!e.def.parameters?.properties)()&&Object.keys(e.def.parameters.properties).length>0},get children(){var i=u2(),o=i.firstChild,c=o.nextSibling;return f(c,u(oe,{get each(){return Object.entries(e.def.parameters.properties)},children:([d,h])=>u(Fs,{name:d,property:h,get required(){return(e.def.parameters?.required||[]).includes(d)}})})),i}}),null),f(r,u(k,{get when(){return e.def.input},get children(){return u(Ac,{title:"Input",get encoding(){return e.def.input.encoding},get schema(){return e.def.input.schema}})}}),null),f(r,u(k,{get when(){return e.def.output},get children(){return u(Ac,{title:"Output",get encoding(){return e.def.output.encoding},get schema(){return e.def.output.schema}})}}),null),f(r,u(k,{get when(){return X(()=>!!e.def.errors)()&&e.def.errors.length>0},get children(){var i=f2(),o=i.firstChild,c=o.nextSibling;return f(c,u(oe,{get each(){return e.def.errors},children:d=>(()=>{var h=m2(),g=h.firstChild;return f(g,()=>d.name),f(h,u(k,{get when(){return d.description},get children(){var p=Kl();return f(p,()=>d.description),p}}),null),h})()})),i}}),null),f(r,u(k,{get when(){return X(()=>!(e.def.properties||e.def.parameters||e.def.input||e.def.output||e.def.errors||e.def.record))()&&n()},get children(){var i=_h();return f(i,u(Fs,{get name(){return e.name},get property(){return e.def},hideNameType:!0})),i}}),null),z(i=>{var o=`def-${e.name}`,c=`#schema:${e.name}`,d=`rounded px-2 py-0.5 text-xs font-semibold uppercase ${t()}`;return o!==i.e&&ae(r,"id",i.e=o),c!==i.t&&ae(a,"href",i.t=c),d!==i.a&&he(l,i.a=d),i},{e:void 0,t:void 0,a:void 0}),r})()},$2=e=>{const t=bt();return Ue(()=>{const n=t.hash;if(n.startsWith("#schema:")){const r=n.slice(8);requestAnimationFrame(()=>{const s=document.getElementById(`def-${r}`);s&&s.scrollIntoView({behavior:"instant",block:"start"})})}}),(()=>{var n=x2(),r=n.firstChild,s=r.firstChild,a=s.firstChild,l=s.nextSibling,i=l.firstChild,o=i.firstChild,c=o.nextSibling,d=r.nextSibling;return f(a,()=>e.schema.id),f(s,u(k,{get when(){return e.authority},get children(){return u(ot,{text:"View record",get children(){return u(Ie,{get href(){return`/at://${e.authority}/com.atproto.lexicon.schema/${e.schema.id}`},class:"flex items-center p-1.5 text-neutral-600 hover:text-neutral-900 dark:text-neutral-400 dark:hover:text-neutral-200",target:"_blank",get children(){return b2()}})}})}}),null),f(c,()=>e.schema.lexicon),f(r,u(k,{get when(){return e.schema.description},get children(){var h=Kl();return f(h,()=>e.schema.description),h}}),null),f(d,u(oe,{get each(){return Object.entries(e.schema.defs)},children:([h,g])=>u(w2,{name:h,def:g})})),n})()};ke(["click"]);const k2={"app.bsky.actor.profile":e=>({label:"Bluesky",link:`https://bsky.app/profile/${e.repo}`}),"app.bsky.feed.post":e=>({label:"Bluesky",link:`https://bsky.app/profile/${e.repo}/post/${e.rkey}`}),"app.bsky.graph.list":e=>({label:"Bluesky",link:`https://bsky.app/profile/${e.repo}/lists/${e.rkey}`}),"app.bsky.feed.generator":e=>({label:"Bluesky",link:`https://bsky.app/profile/${e.repo}/feed/${e.rkey}`}),"com.shinolabs.pinksea.oekaki":e=>({label:"PinkSea",link:`https://pinksea.art/${e.repo}/oekaki/${e.rkey}`}),"com.shinolabs.pinksea.profile":e=>({label:"PinkSea",link:`https://pinksea.art/${e.repo}`}),"sh.tangled.actor.profile":e=>({label:"Tangled",link:`https://tangled.org/${e.repo}`}),"sh.tangled.repo":(e,t)=>({label:"Tangled",link:`https://tangled.org/${e.repo}/${t.name}`}),"app.blento.card":e=>({label:"blento",link:`https://blento.app/${e.repo}`}),"social.popfeed.actor.profile":e=>({label:"Popfeed",link:`https://popfeed.social/profile/${e.repo}`}),"social.popfeed.feed.review":e=>({label:"Popfeed",link:`https://popfeed.social/review/at:/${e.repo}/${e.collection}/${e.rkey}`}),"social.popfeed.feed.list":e=>({label:"Popfeed",link:`https://popfeed.social/list/at:/${e.repo}/${e.collection}/${e.rkey}`})},_2=de({$type:H(ne("app.bsky.embed.external#external")),description:ge(),thumb:H(sn()),title:ge(),uri:La()}),S2=de({$type:H(ne("app.bsky.embed.external")),get external(){return E2}}),E2=_2,Gi=S2,C2=de({$type:H(ne("app.bsky.feed.postgate#disableRule"))}),A2=Xe(lt(),de({$type:ne("app.bsky.feed.postgate"),createdAt:Ze(),detachedEmbeddingUris:H(ve(Oe(_t()),[St(0,50)])),get embeddingRules(){return H(ve(Oe(gt([R2])),[St(0,5)]))},post:_t()})),R2=C2,T2=A2,L2=de({$type:H(ne("app.bsky.feed.threadgate#followerRule"))}),P2=de({$type:H(ne("app.bsky.feed.threadgate#followingRule"))}),I2=de({$type:H(ne("app.bsky.feed.threadgate#listRule")),list:_t()}),D2=Xe(lt(),de({$type:ne("app.bsky.feed.threadgate"),get allow(){return H(ve(Oe(gt([j2,U2,N2,B2])),[St(0,5)]))},createdAt:Ze(),hiddenReplies:H(ve(Oe(_t()),[St(0,300)])),post:_t()})),O2=de({$type:H(ne("app.bsky.feed.threadgate#mentionRule"))}),j2=L2,U2=P2,N2=I2,M2=D2,B2=O2,F2=de({$type:H(ne("app.bsky.embed.defs#aspectRatio")),height:ve(xn(),[ea(1)]),width:ve(xn(),[ea(1)])}),Sh=F2,z2=de({$type:H(ne("app.bsky.embed.images#image")),alt:ge(),get aspectRatio(){return H(Sh)},image:sn()}),V2=de({$type:H(ne("app.bsky.embed.images")),get images(){return ve(Oe(K2),[St(0,4)])}}),K2=z2,Eh=V2,H2=de({$type:H(ne("app.bsky.labeler.defs#labelerPolicies")),get labelValueDefinitions(){return H(Oe(Bb))},get labelValues(){return Oe(Mb)}}),q2=H2,W2=de({$type:H(ne("app.bsky.embed.video#caption")),file:sn(),lang:Ta()}),G2=de({$type:H(ne("app.bsky.embed.video")),alt:H(ve(ge(),[qe(0,1e4),Qe(0,1e3)])),get aspectRatio(){return H(Sh)},get captions(){return H(ve(Oe(Z2),[St(0,20)]))},presentation:H(ge()),video:sn()}),Z2=W2,Ch=G2,X2=de({$type:H(ne("app.bsky.embed.recordWithMedia")),get media(){return gt([Gi,Eh,Ch])},get record(){return Ah}}),J2=X2,Y2=de({$type:H(ne("app.bsky.embed.record")),get record(){return Vt}}),Ah=Y2,Q2=de({$type:H(ne("app.bsky.richtext.facet#byteSlice")),byteEnd:xn(),byteStart:xn()}),eE=de({$type:H(ne("app.bsky.richtext.facet#link")),uri:La()}),tE=de({$type:H(ne("app.bsky.richtext.facet")),get features(){return Oe(gt([aE,lE,iE]))},get index(){return sE}}),nE=de({$type:H(ne("app.bsky.richtext.facet#mention")),did:Hn()}),rE=de({$type:H(ne("app.bsky.richtext.facet#tag")),tag:ve(ge(),[qe(0,640),Qe(0,64)])}),sE=Q2,aE=eE,Ka=tE,lE=nE,iE=rE,oE=ge(),cE=oE,dE=Xe(ne("self"),de({$type:ne("app.bsky.actor.profile"),avatar:H(sn()),banner:H(sn()),createdAt:H(Ze()),description:H(ve(ge(),[qe(0,2560),Qe(0,256)])),displayName:H(ve(ge(),[qe(0,640),Qe(0,64)])),get joinedViaStarterPack(){return H(Vt)},get labels(){return H(gt([us]))},get pinnedPost(){return H(Vt)},pronouns:H(ve(ge(),[qe(0,200),Qe(0,20)])),website:H(La())})),uE=dE,fE=Xe(ne("self"),de({$type:ne("app.bsky.actor.status"),createdAt:Ze(),durationMinutes:H(ve(xn(),[ea(1)])),get embed(){return H(gt([Gi]))},status:ge()})),hE=fE,gE=Xe(ge(),de({$type:ne("app.bsky.feed.generator"),acceptsInteractions:H(ki()),avatar:H(sn()),contentMode:H(ge()),createdAt:Ze(),description:H(ve(ge(),[qe(0,3e3),Qe(0,300)])),get descriptionFacets(){return H(Oe(Ka))},did:Hn(),displayName:ve(ge(),[qe(0,240),Qe(0,24)]),get labels(){return H(gt([us]))}})),pE=gE,mE=Xe(lt(),de({$type:ne("app.bsky.feed.like"),createdAt:Ze(),get subject(){return Vt},get via(){return H(Vt)}})),bE=mE,xE=de({$type:H(ne("app.bsky.feed.post#entity")),get index(){return SE},type:ge(),value:ge()}),vE=Xe(lt(),de({$type:ne("app.bsky.feed.post"),createdAt:Ze(),get embed(){return H(gt([Gi,Eh,Ah,J2,Ch]))},get entities(){return H(Oe($E))},get facets(){return H(Oe(Ka))},get labels(){return H(gt([us]))},langs:H(ve(Oe(Ta()),[St(0,3)])),get reply(){return H(_E)},tags:H(ve(Oe(ve(ge(),[qe(0,640),Qe(0,64)])),[St(0,8)])),text:ve(ge(),[qe(0,3e3),Qe(0,300)])})),yE=de({$type:H(ne("app.bsky.feed.post#replyRef")),get parent(){return Vt},get root(){return Vt}}),wE=de({$type:H(ne("app.bsky.feed.post#textSlice")),end:xn(),start:xn()}),$E=xE,kE=vE,_E=yE,SE=wE,EE=Xe(lt(),de({$type:ne("app.bsky.feed.repost"),createdAt:Ze(),get subject(){return Vt},get via(){return H(Vt)}})),CE=EE,AE=Xe(lt(),de({$type:ne("app.bsky.graph.block"),createdAt:Ze(),subject:Hn()})),RE=AE,TE=Xe(lt(),de({$type:ne("app.bsky.graph.follow"),createdAt:Ze(),subject:Hn(),get via(){return H(Vt)}})),LE=TE,PE=Xe(lt(),de({$type:ne("app.bsky.graph.list"),avatar:H(sn()),createdAt:Ze(),description:H(ve(ge(),[qe(0,3e3),Qe(0,300)])),get descriptionFacets(){return H(Oe(Ka))},get labels(){return H(gt([us]))},name:ve(ge(),[qe(1,64)]),get purpose(){return cE}})),IE=PE,DE=Xe(lt(),de({$type:ne("app.bsky.graph.listblock"),createdAt:Ze(),subject:_t()})),OE=DE,jE=Xe(lt(),de({$type:ne("app.bsky.graph.listitem"),createdAt:Ze(),list:_t(),subject:Hn()})),UE=jE,NE=de({$type:H(ne("app.bsky.graph.starterpack#feedItem")),uri:_t()}),ME=Xe(lt(),de({$type:ne("app.bsky.graph.starterpack"),createdAt:Ze(),description:H(ve(ge(),[qe(0,3e3),Qe(0,300)])),get descriptionFacets(){return H(Oe(Ka))},get feeds(){return H(ve(Oe(BE),[St(0,3)]))},list:_t(),name:ve(ge(),[qe(1,500),Qe(0,50)])})),BE=NE,FE=ME,zE=Xe(lt(),de({$type:ne("app.bsky.graph.verification"),createdAt:Ze(),displayName:ge(),handle:Vu(),subject:Hn()})),VE=zE,KE=Xe(ne("self"),de({$type:ne("app.bsky.labeler.service"),createdAt:Ze(),get labels(){return H(gt([us]))},get policies(){return q2},get reasonTypes(){return H(Oe(Hb))},subjectCollections:H(Oe(Si())),get subjectTypes(){return H(Oe(qb))}})),HE=KE,qE=Xe(ne("self"),de({$type:ne("chat.bsky.actor.declaration"),allowIncoming:ge()})),WE=qE,cl={"app.bsky.actor.profile":uE,"app.bsky.actor.status":hE,"app.bsky.feed.generator":pE,"app.bsky.feed.like":bE,"app.bsky.feed.post":kE,"app.bsky.feed.postgate":T2,"app.bsky.feed.repost":CE,"app.bsky.feed.threadgate":M2,"app.bsky.graph.block":RE,"app.bsky.graph.follow":LE,"app.bsky.graph.list":IE,"app.bsky.graph.listblock":OE,"app.bsky.graph.listitem":UE,"app.bsky.graph.starterpack":FE,"app.bsky.graph.verification":VE,"app.bsky.labeler.service":HE,"chat.bsky.actor.declaration":WE};var GE=m('<div class="flex size-4 items-center justify-center">'),ZE=m('<span class="iconify lucide--x text-red-500 dark:text-red-400">'),XE=m('<div class="flex items-center gap-0.5">'),JE=m('<span class="iconify lucide--trash-2">'),YE=m('<h2 class="mb-2 font-semibold">Delete this record?'),QE=m('<div class="flex justify-end gap-2">'),eC=m('<div class="w-full max-w-screen min-w-full px-2 font-mono text-xs wrap-anywhere whitespace-pre-wrap sm:w-max sm:text-sm md:max-w-3xl">'),tC=m('<span class="w-full px-2 text-sm">Lexicon schema could not be resolved.'),nC=m('<span class="w-full px-2 text-sm">Resolving lexicon schema...'),rC=m('<div class="w-full px-2">'),Rc=m('<div class="text-xs wrap-break-word">'),sC=m('<div class="flex w-full flex-col gap-3 px-2"><div><p class=font-semibold>AT URI</p><button class="group flex w-full items-center gap-1 text-left text-sm text-neutral-600 hover:text-neutral-900 dark:text-neutral-300 dark:hover:text-neutral-200"><span class=truncate dir=rtl></span><span></span></button></div><div><div class="flex items-center gap-1"><p class=font-semibold>Record verification</p><span></span></div></div><div><div class="flex items-center gap-1"><p class=font-semibold>Schema validation</p><span>'),aC=m('<div class="flex w-full flex-col items-center"><div class="mb-3 flex w-full justify-between px-2 text-sm sm:text-base"><div class="flex items-center gap-3 sm:gap-4"></div><div class="flex sm:gap-0.5">'),lC=m('<div class="flex w-full flex-col items-center gap-1 px-2 py-4"><span class="font-semibold text-red-500 dark:text-red-400">Error loading record</span><div class="max-w-full text-sm wrap-break-word text-neutral-600 dark:text-neutral-400">'),iC=m('<div class="dark:bg-dark-200 absolute top-full left-0 z-10 flex flex-col overflow-hidden rounded-b bg-neutral-50 shadow-xs">'),oC=m('<div class=relative><a target=_blank class="flex p-1.5">'),cC=m('<a target=_blank class="flex p-1.5 hover:bg-neutral-200/50 active:bg-neutral-200 dark:hover:bg-neutral-700 dark:active:bg-neutral-600">'),dC=m("<img class=size-4>"),uC=m("<div>Error: "),fC=m("<div class=wrap-break-word>Error: "),hC=m('<div class="iconify lucide--loader-circle animate-spin self-center text-xl">'),gC=m('<div><p class=font-semibold>CID</p><button class="group flex w-full items-center gap-1 text-left text-sm text-neutral-600 hover:text-neutral-900 dark:text-neutral-300 dark:hover:text-neutral-200"><span class=truncate dir=rtl></span><span>');const Tc=e=>e.split(".").reverse().join("."),Lc=e=>(()=>{var t=GE();return f(t,e),t})(),pC=[{label:"Blacksky",hostname:"blacksky.app",transform:e=>e.replace("https://bsky.app","https://blacksky.community")},{label:"Witchsky",hostname:"witchsky.app",transform:e=>e.replace("https://bsky.app","https://witchsky.app")},{label:"Red Dwarf",hostname:"reddwarf.app",transform:e=>e.replace("https://bsky.app","https://reddwarf.app")},{label:"Anartia",hostname:"kelinci.net",icon:"https://kelinci.net/rabbit.svg",transform:e=>e.replace("https://bsky.app/profile","https://anartia.kelinci.net").replace("/post/","/").replace("/feed/","/feeds/")}],dl=new Map,Wl=new Map,ul=new Map,mC=e=>e.split(".").slice(0,-1).join("."),bC=async(e,t)=>{const n=`${e}:${t}`;let r=ul.get(n);if(r)return r;const s=(async()=>{let a=Wl.get(e);a||(a=fs().resolve(e),Wl.set(e,a));const l=await a,i=cs(l);if(!i)throw new Tl(t,{cause:new TypeError(`no pds service in did document; did=${e}`)});const c=await new We({handler:qt({service:i})}).get("com.atproto.repo.getRecord",{params:{repo:e,collection:"com.atproto.lexicon.schema",rkey:t}});if(!c.ok)throw new Error(`got http ${c.status}`);return c.data.value})();ul.set(n,s);try{return await s}catch(a){throw ul.delete(n),a}},xC=e=>{const t=new Set,n=r=>{if(!(!r||typeof r!="object")){if(r.type==="ref"&&r.ref){const s=r.ref;if(!s.startsWith("#")){const a=s.split("#")[0];zt(a)&&t.add(a)}}if(r.type==="union"&&Array.isArray(r.refs)){for(const s of r.refs)if(!s.startsWith("#")){const a=s.split("#")[0];zt(a)&&t.add(a)}}Array.isArray(r)?r.forEach(n):Object.values(r).forEach(n)}};return n(e),Array.from(t)},Rh=async(e,t=0,n=new Map,r=new Set,s=new Map)=>{if(t>=10)return console.warn(`Maximum recursion depth reached for ${e}`),{resolved:n,failed:r};if(n.has(e)||r.has(e))return{resolved:n,failed:r};if(s.has(e))return await s.get(e),{resolved:n,failed:r};const a=(async()=>{let l;const i=mC(e);try{let o=dl.get(i);o||(o=Wn(e),dl.set(i,o)),l=await o;const c=await bC(l,e);n.set(e,c);const d=xC(c);d.length>0&&await Promise.all(d.map(h=>Rh(h,t+1,n,r,s)))}catch(o){console.error(`Failed to resolve lexicon ${e}:`,o),r.add(e),dl.delete(i),l&&Wl.delete(l)}finally{s.delete(e)}})();return s.set(e,a),await a,{resolved:n,failed:r}},vC=()=>{const e=bt(),t=At(),n=Fn(),[r,s]=T(!1),[a,l]=T(!1),[i,o]=T(""),[c,d]=T(""),[h,g]=T(),[p,x]=T(),[y,b]=T(void 0),[$,w]=T(void 0),[v,_]=T(),[E,S]=T(),[C,A]=T(),D=n.repo;let N;const I=async()=>{b(void 0),w(void 0);const P=await Ba(D);N=new We({handler:qt({service:P})});const R=await N.get("com.atproto.repo.getRecord",{params:{repo:D,collection:n.collection,rkey:n.rkey}});if(!R.ok)throw b(!1),o(R.data.error),new Error(R.data.error);return Tw(R.data.value),g(L(R.data.uri,R.data.value)),q(n.collection),K(),F(R.data.value),R.data},[M,{refetch:Y}]=Ht(I),F=async P=>{try{n.collection==="com.atproto.lexicon.schema"?(S(!1),Tf.parse(P,{mode:"passthrough"}),w(!0)):n.collection&&n.collection in cl&&(Mu(cl[n.collection],P)?w(!0):w(!1))}catch(R){console.error("Schema validation error:",R),w(!1),d(R.message||String(R))}},B=async P=>{try{A(!0);const{resolved:R,failed:O}=await Rh(n.collection);if(O.size>0){console.error(`Failed to resolve ${O.size} documents:`,Array.from(O)),w(!1),d(`Unable to resolve lexicon documents: ${Array.from(O).join(", ")}`);return}const Z=Object.fromEntries(R);new sS(Z,n.collection).parse({key:n.rkey??null,object:P}),w(!0)}catch(R){console.error("Schema validation error:",R),w(!1),d(R.message||String(R))}A(!1)},K=async()=>{try{const{ok:P,data:R}=await N.get("com.atproto.sync.getRecord",{params:{did:D,collection:n.collection,rkey:n.rkey},as:"bytes"});if(!P)throw R.error;await Ff({did:D,collection:n.collection,rkey:n.rkey,carBytes:R}),b(!0)}catch(P){console.error("Record verification error:",P),o(P.message),b(!1)}},q=async P=>{try{const R=await Wn(P);if(x(R),n.collection!=="com.atproto.lexicon.schema"){const O=await Ey(R,P);_(O),S(!1)}}catch{S(!0)}},U=async()=>{N=new We({handler:xe()}),await N.post("com.atproto.repo.deleteRecord",{input:{repo:n.repo,collection:n.collection,rkey:n.rkey}});const P=Nn({message:"Record deleted",type:"success"});setTimeout(()=>Mt(P),3e3),Bs(`${n.pds}/${n.repo}/${n.collection}`),t(`/at://${n.repo}/${n.collection}`)},L=(P,R)=>{const O=P.split("/");if(O.length!=5||O[0]!=="at:"||O[1]!=="")return;const Z={repo:O[2],collection:O[3],rkey:O[4]},j=k2[Z.collection];if(j)return j(Z,R)},V=P=>{const R=()=>P.tab==="record"?!e.hash||e.hash.startsWith("#record"):!!(e.hash===`#${P.tab}`||P.tab==="schema"&&e.hash.startsWith("#schema:"));return(()=>{var O=XE();return f(O,u(Ie,{get classList(){return{"border-b-2 font-medium transition-colors":!0,"border-transparent not-hover:text-neutral-600 not-hover:dark:text-neutral-300/80":!R()}},get href(){return`/at://${D}/${n.collection}/${n.rkey}#${P.tab}`},get children(){return P.label}}),null),f(O,u(k,{get when(){return X(()=>!!P.error)()&&(y()===!1||$()===!1)},get children(){return ZE()}}),null),O})()};return[u(Rt,{get children(){return[X(()=>n.collection),"/",X(()=>n.rkey)," - PDSls"]}}),u(dn,{fallback:P=>(()=>{var R=lC(),O=R.firstChild,Z=O.nextSibling;return f(Z,()=>P.message),R})(),get children(){return u(k,{get when(){return M()},keyed:!0,get children(){var P=aC(),R=P.firstChild,O=R.firstChild,Z=O.nextSibling;return f(O,u(V,{tab:"record",label:"Record"}),null),f(O,u(V,{tab:"schema",label:"Schema"}),null),f(O,u(V,{tab:"backlinks",label:"Backlinks"}),null),f(O,u(V,{tab:"info",label:"Info",error:!0}),null),f(Z,u(k,{get when(){return X(()=>!!xe())()&&xe()?.sub===M()?.uri.split("/")[2]},get children(){return[u(Yf,{create:!1,get record(){return M()?.value},refetch:Y,scope:"update"}),u(Vl,{scope:"delete",tooltip:"Delete",onClick:()=>s(!0),get children(){return JE()}}),u(Qt,{get open(){return r()},onClose:()=>s(!1),contentClass:"dark:bg-dark-300 dark:shadow-dark-700 pointer-events-auto rounded-lg border-[0.5px] border-neutral-300 bg-neutral-50 p-4 shadow-md dark:border-neutral-700",get children(){return[YE(),(()=>{var j=QE();return f(j,u(Se,{onClick:()=>s(!1),children:"Cancel"}),null),f(j,u(Se,{onClick:U,classList:{"bg-red-500! border-none! text-white! hover:bg-red-400! active:bg-red-400!":!0},children:"Delete"}),null),j})()]}})]}}),null),f(Z,u(k,{get when(){return h()},children:j=>{const G=()=>j().link.startsWith("https://bsky.app")?pC.map(ie=>({...ie,link:ie.transform(j().link)})):[];return(()=>{var ie=oC(),ee=ie.firstChild;return ie.addEventListener("mouseleave",()=>l(!1)),ie.addEventListener("mouseenter",()=>l(!0)),f(ee,u(_r,{get authority(){return Tc(new URL(j().link).hostname)},wrapper:Lc})),f(ie,u(k,{get when(){return G().length>0},get children(){var Q=iC();return f(Q,u(oe,{get each(){return G()},children:me=>(()=>{var le=cC();return f(le,(()=>{var re=X(()=>!!me.icon);return()=>re()?(()=>{var Pe=dC();return z(()=>ae(Pe,"src",me.icon)),Pe})():u(_r,{get authority(){return Tc(me.hostname)},wrapper:Lc})})()),z(re=>{var Pe=me.link,Ae=`Open on ${me.label}`;return Pe!==re.e&&ae(le,"href",re.e=Pe),Ae!==re.t&&ae(le,"title",re.t=Ae),re},{e:void 0,t:void 0}),le})()})),z(()=>Q.classList.toggle("invisible",!a())),Q}}),null),z(Q=>{var me=j().link,le=`Open on ${j().label}`,re={"rounded-sm hover:bg-neutral-200 active:bg-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-600":!G().length,"bg-neutral-50 rounded-t dark:bg-dark-200 hover:bg-neutral-200/50 active:bg-neutral-200 dark:hover:bg-neutral-700 dark:active:bg-neutral-600":a()&&G().length>0};return me!==Q.e&&ae(ee,"href",Q.e=me),le!==Q.t&&ae(ee,"title",Q.t=le),Q.a=ye(ee,re,Q.a),Q},{e:void 0,t:void 0,a:void 0}),ie})()}}),null),f(Z,u(wa,{get children(){return u($a,{icon:"lucide--ellipsis",buttonClass:"rounded-sm p-1.5",get children(){return[u(lm,{get content(){return JSON.stringify(M()?.value,null,2)},label:"Copy record",icon:"lucide--copy"}),u(ft,{get href(){return`https://${ze()}/xrpc/com.atproto.repo.getRecord?repo=${n.repo}&collection=${n.collection}&rkey=${n.rkey}`},icon:"lucide--external-link",label:"Record on PDS",newTab:!0})]}})}}),null),f(P,u(k,{get when(){return!e.hash||e.hash.startsWith("#record")},get children(){var j=eC();return f(j,u(Lr,{get data(){return M()?.value},get repo(){return M().uri.split("/")[2]},keyLinks:!0})),j}}),null),f(P,u(k,{get when(){return e.hash==="#schema"||e.hash.startsWith("#schema:")},get children(){return[u(k,{get when(){return E()===!0},get children(){return tC()}}),u(k,{get when(){return E()===void 0},get children(){return nC()}}),u(k,{get when(){return v()||n.collection==="com.atproto.lexicon.schema"},get children(){return u(dn,{fallback:j=>(()=>{var G=uC();return G.firstChild,f(G,()=>j.message,null),G})(),get children(){return u($2,{get schema(){return v()?.rawSchema??M()?.value},get authority(){return p()}})}})}})]}}),null),f(P,u(k,{get when(){return e.hash==="#backlinks"},get children(){return u(dn,{fallback:j=>(()=>{var G=fC();return G.firstChild,f(G,()=>j.message,null),G})(),get children(){return u(cr,{get fallback(){return hC()},get children(){var j=rC();return f(j,u(kh,{get target(){return`at://${D}/${n.collection}/${n.rkey}`}})),j}})}})}}),null),f(P,u(k,{get when(){return e.hash==="#info"},get children(){var j=sC(),G=j.firstChild,ie=G.firstChild,ee=ie.nextSibling,Q=ee.firstChild,me=Q.nextSibling,le=G.nextSibling,re=le.firstChild,Pe=re.firstChild,Ae=Pe.nextSibling,tt=le.nextSibling,Lt=tt.firstChild,Je=Lt.firstChild,Ee=Je.nextSibling;return ee.$$click=()=>mr(M().uri),f(Q,()=>M()?.uri),f(j,u(k,{get when(){return M()?.cid},children:$e=>(()=>{var nt=gC(),Pt=nt.firstChild,It=Pt.nextSibling,Gt=It.firstChild,Fe=Gt.nextSibling;return It.$$click=()=>mr($e()),f(Gt,$e),z(wn=>ye(Fe,{"iconify lucide--copy shrink-0":!0,"opacity-0 group-hover:opacity-100":Ke},wn)),nt})()}),le),f(le,u(k,{get when(){return y()===!1},get children(){var $e=Rc();return f($e,i),$e}}),null),f(tt,u(k,{get when(){return $()===!1},get children(){var $e=Rc();return f($e,c),$e}}),null),f(tt,u(k,{get when(){return X(()=>!!(!C()&&$()===void 0&&n.collection))()&&!(n.collection in cl)},get children(){return u(Se,{onClick:()=>B(M().value),children:"Validate via resolution"})}}),null),z($e=>{var nt={"iconify lucide--copy shrink-0":!0,"opacity-0 group-hover:opacity-100":Ke},Pt={"iconify lucide--check text-green-500 dark:text-green-400":y()===!0,"iconify lucide--x text-red-500 dark:text-red-400":y()===!1,"iconify lucide--loader-circle animate-spin":y()===void 0},It={"iconify lucide--check text-green-500 dark:text-green-400":$()===!0,"iconify lucide--x text-red-500 dark:text-red-400":$()===!1,"iconify lucide--loader-circle animate-spin":$()===void 0&&C()};return $e.e=ye(me,nt,$e.e),$e.t=ye(Ae,Pt,$e.t),$e.a=ye(Ee,It,$e.a),$e},{e:void 0,t:void 0,a:void 0}),j}}),null),P}})}})]};ke(["click"]);const Th=e=>{try{return Ri(e).type}catch{try{const n=kd(e.startsWith("z")?e.slice(1):e);if(n.length>=2&&(n[0]<<8|n[1])===60673)return"ed25519"}catch{}return"unknown"}},yC=e=>{try{return df(e).type}catch{return e.startsWith("did:key:")?Th(e.slice(8)):"unknown"}};var wC=m('<div class="flex w-full flex-col gap-0.5 pb-20 font-mono text-xs sm:text-sm">'),$C=m('<div class="flex flex-col items-center gap-2"><div class="dark:bg-dark-500 fixed bottom-0 z-5 flex w-screen justify-center border-t border-neutral-200 bg-neutral-100 pt-3 pb-6 dark:border-neutral-700"><div class="flex min-w-50 items-center justify-around gap-3"><p> blob'),kC=m('<a target=_blank class="truncate rounded px-0.5 text-left text-blue-500 hover:bg-neutral-200 active:bg-neutral-300 dark:text-blue-400 dark:hover:bg-neutral-700 dark:active:bg-neutral-600"dir=rtl>'),_C=m('<span class="iconify lucide--loader-circle animate-spin text-base">');const Pc=1e3,SC=e=>{const[t,n]=T();let r;const s=async()=>{r||(r=new We({handler:qt({service:e.pds})}));const c=await r.get("com.atproto.sync.listBlobs",{params:{did:e.repo,limit:Pc,cursor:t()}});if(!c.ok)throw new Error(c.data.error);return c.data.cids?(n(c.data.cids.length<Pc?void 0:c.data.cursor),o(i()?.concat(c.data.cids)??c.data.cids),c.data.cids):[]},[a,{refetch:l}]=Ht(s),[i,o]=T();return(()=>{var c=$C(),d=c.firstChild,h=d.firstChild,g=h.firstChild,p=g.firstChild;return f(c,u(k,{get when(){return i()||a()},get children(){var x=wC();return f(x,u(oe,{get each(){return i()},children:y=>(()=>{var b=kC();return f(b,y),z(()=>ae(b,"href",`${e.pds}/xrpc/com.atproto.sync.getBlob?did=${e.repo}&cid=${y}`)),b})()})),x}}),d),f(g,()=>i()?.length,p),f(g,()=>i()?.length??!1?"s":"",null),f(h,u(k,{get when(){return t()},get children(){return u(Se,{onClick:()=>l(),get disabled(){return a.loading},classList:{"w-20 h-7.5 justify-center":!0},get children(){return u(k,{get when(){return!a.loading},get fallback(){return _C()},children:"Load more"})}})}}),null),c})()},EC=J().assert(bu,"must be a did:plc"),CC=J().assert(Dm,"must be a did:key"),Gl=J().chain(e=>{try{df(e)}catch(t){return t instanceof SyntaxError?un("did:key can't be parsed"):un("invalid did:key")}return tn(e)}),AC=J().chain(e=>{try{Pf(e)}catch{return un("invalid cid")}return tn(e)}),RC=pe({type:fe("create"),prev:nu(),signingKey:Gl,recoveryKey:Gl,handle:J(),service:J()}),Lh=RC.extend({sig:J()}),TC=pe({type:J(),endpoint:J()}),LC=pe({type:fe("plc_operation"),prev:J().nullable(),rotationKeys:_e(Gl),verificationMethods:rn(CC),alsoKnownAs:_e(J()),services:rn(TC)}),Zi=LC.extend({sig:J()}),PC=pe({type:fe("plc_tombstone"),prev:J()}),Ph=PC.extend({sig:J()}),Ih=Le(Zi,Lh),IC=Le(Zi,Lh,Ph),Dh=Le(Zi,Ph);fi([Ih]).concat(_e(Dh));const Zl=pe({did:EC,operation:IC,cid:AC,nullified:yt(),createdAt:J().assert(e=>!Number.isNaN(new Date(e).getTime()),"invalid timestamp")}),DC=fi([Zl.extend({operation:Ih})]).concat(_e(Zl.extend({operation:Dh})));Zl.extend({type:fe("sequenced_op"),seq:di()});const OC=e=>{const t=[];for(let n=0,r=e.length;n<r;n++){const s=e[n],a=s.operation;if(a.type==="create")t.push({type:"identity_created",orig:s,nullified:s.nullified,at:s.createdAt,rotationKeys:[a.recoveryKey,a.signingKey],verificationMethods:{atproto:a.signingKey},alsoKnownAs:[`at://${a.handle}`],services:{atproto_pds:{type:"AtprotoPersonalDataServer",endpoint:a.service}}});else if(a.type==="plc_operation"){const l=jC(e,h=>!h.nullified,n-1)?.operation;let i,o,c,d;if(l)if(l.type==="create")i=[l.recoveryKey,l.signingKey],o={atproto:l.signingKey},c=[`at://${l.handle}`],d={atproto_pds:{type:"AtprotoPersonalDataServer",endpoint:l.service}};else if(l.type==="plc_operation")i=l.rotationKeys,o=l.verificationMethods,c=l.alsoKnownAs,d=l.services;else continue;else{t.push({type:"identity_created",orig:s,nullified:s.nullified,at:s.createdAt,rotationKeys:a.rotationKeys,verificationMethods:a.verificationMethods,alsoKnownAs:a.alsoKnownAs,services:a.services});continue}{const h=Rs(a.rotationKeys,i),g=Rs(i,a.rotationKeys);for(const p of h)t.push({type:"rotation_key_added",orig:s,nullified:s.nullified,at:s.createdAt,rotation_key:p});for(const p of g)t.push({type:"rotation_key_removed",orig:s,nullified:s.nullified,at:s.createdAt,rotation_key:p})}{for(const h in a.verificationMethods)h in o?a.verificationMethods[h]!==o[h]&&t.push({type:"verification_method_changed",orig:s,nullified:s.nullified,at:s.createdAt,method_id:h,prev_method_key:o[h],next_method_key:a.verificationMethods[h]}):t.push({type:"verification_method_added",orig:s,nullified:s.nullified,at:s.createdAt,method_id:h,method_key:a.verificationMethods[h]});for(const h in o)h in a.verificationMethods||t.push({type:"verification_method_removed",orig:s,nullified:s.nullified,at:s.createdAt,method_id:h,method_key:o[h]})}if(a.alsoKnownAs.length===1&&c.length===1)a.alsoKnownAs[0]!==c[0]&&t.push({type:"handle_changed",orig:s,nullified:s.nullified,at:s.createdAt,prev_handle:c[0],next_handle:a.alsoKnownAs[0]});else{const h=Rs(a.alsoKnownAs,c),g=Rs(c,a.alsoKnownAs);for(const p of h)t.push({type:"handle_added",orig:s,nullified:s.nullified,at:s.createdAt,handle:p});for(const p of g)t.push({type:"handle_removed",orig:s,nullified:s.nullified,at:s.createdAt,handle:p})}{for(const h in a.services)h in d?Xl(a.services[h],d[h])||t.push({type:"service_changed",orig:s,nullified:s.nullified,at:s.createdAt,service_id:h,prev_service_type:d[h].type,next_service_type:a.services[h].type,prev_service_endpoint:d[h].endpoint,next_service_endpoint:a.services[h].endpoint}):t.push({type:"service_added",orig:s,nullified:s.nullified,at:s.createdAt,service_id:h,service_type:a.services[h].type,service_endpoint:a.services[h].endpoint});for(const h in d)h in a.services||t.push({type:"service_removed",orig:s,nullified:s.nullified,at:s.createdAt,service_id:h,service_type:d[h].type,service_endpoint:d[h].endpoint})}}else a.type==="plc_tombstone"&&t.push({type:"identity_tombstoned",orig:s,nullified:s.nullified,at:s.createdAt})}return t};function jC(e,t,n=e.length-1){for(let r=n,s;r>=0;r--)if(t(s=e[r]))return s}function Rs(e,t){const n=new Set(t);return e.filter(r=>!n.has(r))}const Xl=(e,t)=>{let n,r;if(e===t)return!0;if(e&&t&&(n=e.constructor)===t.constructor){if(n===Array){if((r=e.length)===t.length){for(;r--;)if(!Xl(e[r],t[r]))return!1}return r===-1}else if(!n||n===Object){r=0;for(n in e)if(r++,!(n in t)||!Xl(e[n],t[n]))return!1;return Object.keys(t).length===r}}return e!==e&&t!==t},UC=(e,t)=>{const n=new Map;for(let r=0,s=e.length;r<s;r++){const a=e[r],l=t(a,r),i=n.get(l);i!==void 0?i.push(a):n.set(l,[a])}return n};function NC(e){return new Worker("/assets/plc-validate-DpZfLxog.js",{name:e?.name})}var MC=m("<button>"),BC=m('<span class="shrink-0 rounded bg-neutral-200 px-1.5 py-0.5 text-xs font-medium text-neutral-700 dark:bg-neutral-700 dark:text-neutral-300">#'),FC=m('<span class="ml-auto rounded bg-neutral-200 px-2 py-0.5 text-xs font-medium dark:bg-neutral-700">Nullified'),Ic=m("<div>"),zC=m("<span class=shrink-0>+"),VC=m("<span class=shrink-0>−"),KC=m("<div><span class=truncate>"),HC=m('<div class="flex min-w-0 flex-col text-sm"><div class="flex items-start gap-2 text-red-700 dark:text-red-300"><span class=shrink-0>−</span><span class=truncate></span></div><div class="flex items-start gap-2 text-green-700 dark:text-green-300"><span class=shrink-0>+</span><span class=truncate>'),qC=m('<div><div></div><div class="flex min-w-0 items-center gap-1.5"><p>'),WC=m('<span class="iconify lucide--check text-green-600 dark:text-green-400">'),GC=m('<span class="iconify lucide--x text-red-500 dark:text-red-400">'),ZC=m('<span class="iconify lucide--loader-circle animate-spin">'),XC=m('<div class="flex w-full flex-col gap-3 wrap-anywhere"><div class="flex flex-col gap-2"><div class="flex items-center gap-1.5 text-sm font-medium text-neutral-700 dark:text-neutral-300"><div class="iconify lucide--filter"></div><p>Filter by type</p><div class="mr-1.5 ml-auto"></div></div><div class="flex flex-wrap gap-1"></div></div><div class="flex flex-col gap-3">'),JC=m('<div class="group flex scroll-mt-3 flex-col gap-1 rounded-lg transition-colors"><span class="relative text-sm font-semibold text-neutral-700 dark:text-neutral-300"><a class="relative hover:underline"><span class="absolute top-1/2 -left-4.5 flex -translate-y-1/2 items-center text-neutral-500 opacity-0 transition-opacity group-hover:opacity-100 dark:text-neutral-400"><span class="iconify lucide--link text-xs"></span></span></a></span><div class="flex flex-col gap-2 rounded-md border bg-neutral-50 p-3 text-sm dark:bg-neutral-800">');const YC=e=>{const t=bt(),[n,r]=T(),[s,a]=T(void 0),[l,i]=T(void 0),o=y=>!n()||y.type.startsWith(n()),c=y=>!n()||y.some(b=>b.type.startsWith(n())),d=async()=>{const b=await(await fetch(`${gn()}/${e.did}/log/audit`)).json(),$=DC.parse(b);i($);const w=OC($).reverse();return Array.from(UC(w,v=>v.orig))},[h]=Ht(d);let g;Ce(()=>g?.terminate()),Ue(()=>{const y=l();y&&(a(void 0),g?.terminate(),g=new NC,g.onmessage=b=>{a(b.data.valid),g?.terminate(),g=void 0},g.postMessage({did:e.did,logs:y}))}),Ue(()=>{const y=t.hash;if(y.startsWith("#logs:")){const b=y.slice(6);requestAnimationFrame(()=>{const $=document.getElementById(`log-${b}`);$&&$.scrollIntoView({behavior:"instant",block:"start"})})}});const p=y=>{const b=()=>n()===y.event,$=()=>r(b()?void 0:y.event);return(()=>{var w=MC();return w.$$click=$,f(w,()=>y.label),z(v=>ye(w,{"font-medium rounded-lg px-2 py-1.5 text-xs sm:text-sm transition-colors":!0,"bg-neutral-700 text-white dark:bg-neutral-300 dark:text-neutral-900":b(),"bg-neutral-200 text-neutral-700 hover:bg-neutral-300 dark:bg-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-600":!b()},v)),w})()},x=y=>{const b=y.diff,w=(()=>{switch(b.type){case"identity_created":return{icon:"lucide--bell",title:"Identity created"};case"identity_tombstoned":return{icon:"lucide--skull",title:"Identity tombstoned"};case"handle_added":return{icon:"lucide--at-sign",title:"Alias added",value:b.handle,isAddition:!0};case"handle_removed":return{icon:"lucide--at-sign",title:"Alias removed",value:b.handle,isRemoval:!0};case"handle_changed":return{icon:"lucide--at-sign",title:"Alias updated",oldValue:b.prev_handle,newValue:b.next_handle};case"rotation_key_added":return{icon:"lucide--key-round",title:"Rotation key added",value:b.rotation_key,isAddition:!0};case"rotation_key_removed":return{icon:"lucide--key-round",title:"Rotation key removed",value:b.rotation_key,isRemoval:!0};case"service_added":return{icon:"lucide--hard-drive",title:"Service added",badge:b.service_id,value:b.service_endpoint,isAddition:!0};case"service_removed":return{icon:"lucide--hard-drive",title:"Service removed",badge:b.service_id,value:b.service_endpoint,isRemoval:!0};case"service_changed":return{icon:"lucide--hard-drive",title:"Service updated",badge:b.service_id,oldValue:b.prev_service_endpoint,newValue:b.next_service_endpoint};case"verification_method_added":return{icon:"lucide--shield-check",title:"Verification method added",badge:b.method_id,value:b.method_key,isAddition:!0};case"verification_method_removed":return{icon:"lucide--shield-check",title:"Verification method removed",badge:b.method_id,value:b.method_key,isRemoval:!0};case"verification_method_changed":return{icon:"lucide--shield-check",title:"Verification method updated",badge:b.method_id,oldValue:b.prev_method_key,newValue:b.next_method_key};default:return{icon:"lucide--circle-help",title:"Unknown log entry"}}})(),{icon:v,title:_,value:E="",oldValue:S="",newValue:C="",badge:A="",isAddition:D=!1,isRemoval:N=!1}=w;return(()=>{var I=qC(),M=I.firstChild,Y=M.nextSibling,F=Y.firstChild;return he(M,`${v} iconify shrink-0 self-center`),f(F,_),f(Y,u(k,{when:A,get children(){var B=BC();return B.firstChild,f(B,A,null),B}}),null),f(Y,u(k,{get when(){return b.orig.nullified},get children(){return FC()}}),null),f(I,u(k,{when:E,get children(){return[Ic(),(()=>{var B=KC(),K=B.firstChild;return f(B,u(k,{when:D,get children(){return zC()}}),K),f(B,u(k,{when:N,get children(){return VC()}}),K),f(K,E),z(q=>ye(B,{"text-sm flex items-start gap-2 min-w-0":!0,"text-green-700 dark:text-green-300":D,"text-red-700 dark:text-red-300":N,"text-neutral-600 dark:text-neutral-400":!D&&!N},q)),B})()]}}),null),f(I,u(k,{when:S&&C,get children(){return[Ic(),(()=>{var B=HC(),K=B.firstChild,q=K.firstChild,U=q.nextSibling,L=K.nextSibling,V=L.firstChild,P=V.nextSibling;return f(U,S),f(P,C),B})()]}}),null),z(B=>{var K={"grid grid-cols-[auto_1fr] gap-y-0.5 gap-x-2":!0,"opacity-70":b.orig.nullified},q={"font-medium text-sm":!0,"line-through":b.orig.nullified};return B.e=ye(I,K,B.e),B.t=ye(F,q,B.t),B},{e:void 0,t:void 0}),I})()};return(()=>{var y=XC(),b=y.firstChild,$=b.firstChild,w=$.firstChild,v=w.nextSibling,_=v.nextSibling,E=$.nextSibling,S=b.nextSibling;return f(_,u(k,{get when(){return s()===!0},get children(){return u(ot,{text:"Valid log",get children(){return WC()}})}}),null),f(_,u(k,{get when(){return s()===!1},get children(){return u(ot,{text:"Validation failed",get children(){return GC()}})}}),null),f(_,u(k,{get when(){return s()===void 0},get children(){return u(ot,{text:"Validating...",get children(){return ZC()}})}}),null),f(E,u(p,{event:"handle",label:"Alias"}),null),f(E,u(p,{event:"service",label:"Service"}),null),f(E,u(p,{event:"verification_method",label:"Verification"}),null),f(E,u(p,{event:"rotation_key",label:"Rotation Key"}),null),f(S,u(oe,{get each(){return h()},children:([C,A])=>{const D=()=>t.hash===`#logs:${C.createdAt}`;return u(k,{get when(){return c(A)},get children(){var N=JC(),I=N.firstChild,M=I.firstChild;M.firstChild;var Y=I.nextSibling;return f(M,()=>Ct(new Date(C.createdAt).getTime()),null),f(Y,u(oe,{get each(){return A.filter(o)},children:F=>u(x,{diff:F})})),z(F=>{var B=`log-${C.createdAt}`,K=`#logs:${C.createdAt}`,q={"border-neutral-200 dark:border-neutral-700":!D(),"border-blue-500 dark:border-blue-400":D()};return B!==F.e&&ae(N,"id",F.e=B),K!==F.t&&ae(M,"href",F.t=K),F.a=ye(Y,q,F.a),F},{e:void 0,t:void 0,a:void 0}),N}})}})),y})()};ke(["click"]);var QC=m('<div class="flex items-center gap-1 rounded-md border border-red-500 px-1.5 py-0.5 text-xs font-medium text-red-500 sm:text-sm dark:border-red-400 dark:text-red-400"><span></span><span>'),e5=m('<div class="flex flex-col pb-20 text-sm wrap-anywhere">'),t5=m('<div class="flex w-full flex-col gap-3 wrap-break-word"><div class="flex justify-between px-2 text-sm sm:text-base"><div class="flex items-center gap-3 sm:gap-4"></div><div class="flex gap-1"></div></div><div class="flex w-full flex-col gap-1 px-2">'),n5=m('<kbd class="rounded border border-neutral-200 bg-neutral-50 px-1.5 py-0.5 font-mono text-xs text-neutral-400 select-none dark:border-neutral-600 dark:bg-neutral-700">/'),r5=m('<div class="dark:bg-dark-500 fixed bottom-0 z-10 flex w-full flex-col items-center gap-2 border-t border-neutral-200 bg-neutral-100 px-3 pt-3 pb-6 dark:border-neutral-700"><div class="dark:bg-dark-200 flex w-full max-w-lg cursor-text items-center gap-2 rounded-lg border border-neutral-200 bg-white px-3 dark:border-neutral-700"><span class="iconify lucide--filter text-neutral-500 dark:text-neutral-400"></span><input type=text autocapitalize=off autocomplete=off class="grow py-2 select-none placeholder:text-sm focus:outline-none"name=filter placeholder="Filter collections..."></div><div class="flex w-full max-w-lg justify-end gap-1"><button class="rounded px-2 py-1 text-xs text-neutral-500 hover:bg-neutral-200 hover:text-neutral-700 active:bg-neutral-300 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:hover:text-neutral-200 dark:active:bg-neutral-600">Expand all</button><button class="rounded px-2 py-1 text-xs text-neutral-500 hover:bg-neutral-200 hover:text-neutral-700 active:bg-neutral-300 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:hover:text-neutral-200 dark:active:bg-neutral-600">Collapse all'),fl=m("<div class=wrap-break-word>Error: "),hl=m('<div class="iconify lucide--loader-circle mt-2 animate-spin self-center text-xl">'),s5=m('<span class="mt-3 text-center text-base">No collections found.'),a5=m('<div class="flex min-w-0 flex-1 flex-col">'),l5=m('<button class="absolute top-1 right-1 rounded px-2 py-0.5 text-xs text-neutral-500 opacity-0 transition-opacity group-hover:opacity-100 hover:bg-neutral-300 hover:text-neutral-700 active:bg-neutral-400 dark:text-neutral-400 dark:hover:bg-neutral-600 dark:hover:text-neutral-200 dark:active:bg-neutral-500">'),i5=m('<div class="group relative flex scroll-mt-4 items-start gap-2 rounded-lg p-1 transition-colors">'),o5=m('<a class="relative flex h-5 w-4 shrink-0 items-center justify-center hover:opacity-70"><span class="absolute top-1/2 -left-5 flex -translate-y-1/2 items-center text-base opacity-0 transition-opacity group-hover:opacity-100"><span class="iconify lucide--link absolute -left-2 w-7">'),c5=m('<button class="flex flex-1 items-center text-left"><span class="text-neutral-700 dark:text-neutral-300"></span><span class="text-neutral-500 dark:text-neutral-400">.*</span><span class="ml-1.5 text-neutral-400 dark:text-neutral-500">(<!>)'),d5=m('<span class="text-neutral-800/70 dark:text-neutral-200/70">.'),u5=m("<span>"),f5=m("<div><p class=font-semibold>Aliases"),h5=m('<div><p class=font-semibold>Services</p><div class="flex flex-col gap-1">'),g5=m('<div><p class=font-semibold>Verification Methods</p><div class="flex flex-col gap-1">'),p5=m('<div><p class=font-semibold>Rotation Keys</p><div class="flex flex-col gap-1">'),m5=m('<div class="flex flex-col gap-3 wrap-anywhere"><div><div class=font-semibold>DID</div><button class="group flex w-full items-center gap-1 text-left text-sm text-neutral-700 hover:text-neutral-900 dark:text-neutral-300 dark:hover:text-neutral-200"><span class=truncate></span><span>'),b5=m('<div class="mb-2 rounded-lg border border-neutral-200 bg-neutral-50 p-3 dark:border-neutral-700 dark:bg-neutral-800/50">'),x5=m('<div class="flex flex-col gap-2"><button class="-ml-1 flex w-fit items-center gap-1 rounded px-1 py-0.5 text-left text-sm text-neutral-700 hover:bg-neutral-200 active:bg-neutral-200 dark:text-neutral-300 dark:hover:bg-neutral-700 dark:active:bg-neutral-700"><span></span><span>'),v5=m('<div class="text-sm text-neutral-700 dark:text-neutral-300">'),y5=m('<div class="flex items-center gap-2 py-2 text-sm"><span class="iconify lucide--loader-circle animate-spin"></span><span>Resolving handle...'),Dc=m("<div>"),Oc=m('<div class="text-red-500 dark:text-red-400">Expected: '),w5=m('<div class="grid grid-cols-[auto_1fr] items-center gap-x-1.5 text-sm"><span></span><span class=font-medium>DNS (TXT record)</span><span></span><div class="mb-2 text-sm wrap-anywhere text-neutral-500 dark:text-neutral-400"></div><span></span><span class=font-medium>HTTP (.well-known)</span><span></span><div class="text-sm wrap-anywhere text-neutral-500 dark:text-neutral-400">'),jc=m('<div class="text-red-500 dark:text-red-400">'),$5=m('<div class="grid grid-cols-[auto_1fr] items-center gap-x-1 text-sm text-neutral-700 dark:text-neutral-300"><span class="iconify lucide--hash"></span><div class="flex items-center gap-2"><span></span><div class="flex items-center gap-1 text-neutral-500 dark:text-neutral-400"><span class="iconify text-xs"></span><span></span></div></div><span></span><a class="w-fit underline hover:text-blue-500 dark:hover:text-blue-400"target=_blank rel=noopener>'),k5=m('<div class="grid grid-cols-[auto_1fr] items-center gap-x-1 text-sm text-neutral-700 dark:text-neutral-300"><span class="iconify lucide--hash"></span><div class="flex items-center gap-2"><span></span><div class="flex items-center gap-1 text-neutral-500 dark:text-neutral-400"><span class="iconify lucide--key-round text-xs"></span><span></span></div></div><span></span><div class="font-mono break-all">'),_5=m('<div class="grid grid-cols-[auto_1fr] items-center gap-x-1 text-sm text-neutral-700 dark:text-neutral-300"><span class="iconify lucide--key-round"></span><span></span><span></span><div class="font-mono break-all">');const S5=()=>{const e=Fn(),t=bt(),n=At(),[r,s]=T(),[a,l]=T(!1),[i,o]=T(),[c,d]=T(),[h,g]=T(),[p,x]=zn({}),[y,b]=T([]),[$,w]=T(null),[v,_]=T(null);let E,S,C;const A=e.repo;Ue(()=>{const L=t.hash;if(L.startsWith("#collections:")){const V=L.slice(13);requestAnimationFrame(()=>{const P=document.getElementById(`collection-${V}`);P&&P.scrollIntoView({behavior:"instant",block:"start"})})}}),pt(()=>{Ki(()=>C)});const D=L=>{const V=()=>t.hash?t.hash.startsWith(`#${L.tab}`):!!(!r()&&L.tab==="collections"||r()&&L.tab==="identity");return u(Ie,{get classList(){return{"border-b-2 font-medium transition-colors":!0,"border-transparent not-hover:text-neutral-600 not-hover:dark:text-neutral-300/80":!V()}},get href(){return`/at://${e.repo}#${L.tab}`},get children(){return L.label}})},N=async()=>{const V=await(await fetch(`${gn()}/${A}/log/last`)).json();b(V.rotationKeys??[])},I=async()=>{try{S=await Ba(A),o(hs[A])}catch{if(A.startsWith("did:web"))try{const V=await(await fetch(`https://${A.replace("did:web:","")}/.well-known/did.json`)).json();o(V)}catch{}else if(!A.startsWith("did:"))try{const L=await Ma(e.repo);n(t.pathname.replace(e.repo,L),{replace:!0});return}catch{try{const L=e.repo,V=await Wn(L);n(`/at://${V}/com.atproto.lexicon.schema/${L}`,{replace:!0});return}catch{n(`/${A}`,{replace:!0});return}}}if(A.startsWith("did:plc")&&N(),K(),!S)return s("Missing PDS"),{};E=new We({handler:qt({service:S})});try{const L=await E.get("com.atproto.repo.describeRepo",{params:{repo:A}});if(L.ok){const V={};L.data.collections.forEach(P=>{const R=P.split(".");if(R.length>2){const O=`${R[0]}.${R[1]}`;V[O]={nsids:(V[O]?.nsids??[]).concat(R.slice(2).join(".")),hidden:!1}}}),d(V)}else switch(console.error(L.data.error),L.data.error){case"RepoDeactivated":s("Deactivated");break;case"RepoTakendown":s("Taken down");break;default:s("Unreachable")}return L.data}catch{return{}}},[M]=Ht(I),Y=L=>{d(V=>({...V,[L]:{...V[L],hidden:!V[L].hidden}}))},F=()=>{d(L=>Object.fromEntries(Object.entries(L).map(([V,P])=>[V,{...P,hidden:!0}])))},B=()=>{d(L=>Object.fromEntries(Object.entries(L).map(([V,P])=>[V,{...P,hidden:!1}])))},K=async()=>{for(const L of i()?.alsoKnownAs??[])L.startsWith("at://")&&x(L,await _y(L.replace("at://",""),A))},q=async()=>{let L=null;const V=new AbortController;try{l(!0),L=Nn({message:"Downloading repository...",progress:0,total:0,type:"info",onCancel:()=>{V.abort(),L&&Mt(L)}});const P=await fetch(`${S}/xrpc/com.atproto.sync.getRepo?did=${A}`,{signal:V.signal});if(!P.ok)throw new Error(`HTTP error status: ${P.status}`);const R=P.headers.get("content-length"),O=R?parseInt(R,10):0;let Z=0;const j=P.body?.getReader(),G=[];if(j)for(;;){const{done:me,value:le}=await j.read();if(me)break;if(G.push(le),Z+=le.length,O>0){const re=Math.round(Z/O*100);ws(L,{progress:re,total:O})}else{const re=Math.round(Z/1048576*10)/10;ws(L,{progress:re,total:0})}}const ie=new Blob(G),ee=window.URL.createObjectURL(ie),Q=document.createElement("a");Q.href=ee,Q.download=`${A}-${new Date().toISOString()}.car`,document.body.appendChild(Q),Q.click(),window.URL.revokeObjectURL(ee),document.body.removeChild(Q),ws(L,{message:"Repository downloaded successfully",type:"success",progress:void 0,onCancel:void 0}),setTimeout(()=>{L&&Mt(L)},3e3)}catch(P){P instanceof Error&&P.name==="AbortError"||(console.error("Download failed:",P),L&&(ws(L,{message:"Download failed",type:"error",progress:void 0,onCancel:void 0}),setTimeout(()=>{L&&Mt(L)},5e3)))}l(!1)},U=()=>`${i()?.alsoKnownAs?.find(P=>P.startsWith("at://"))?.replace("at://","")||e.repo} - PDSls`;return[u(Rt,{get children(){return U()}}),u(k,{get when(){return M()},get children(){var L=t5(),V=L.firstChild,P=V.firstChild,R=P.nextSibling,O=V.nextSibling;return f(P,u(k,{get when(){return!r()},get children(){return u(D,{tab:"collections",label:"Collections"})}}),null),f(P,u(D,{tab:"identity",label:"Identity"}),null),f(P,u(k,{get when(){return A.startsWith("did:plc")},get children(){return u(D,{tab:"logs",label:"Logs"})}}),null),f(P,u(k,{get when(){return!r()},get children(){return u(D,{tab:"blobs",label:"Blobs"})}}),null),f(P,u(D,{tab:"backlinks",label:"Backlinks"}),null),f(R,u(k,{get when(){return X(()=>!!r())()&&r()!=="Missing PDS"},get children(){var Z=QC(),j=Z.firstChild,G=j.nextSibling;return f(G,r),z(()=>he(j,`iconify ${r()==="Deactivated"?"lucide--user-round-x":r()==="Taken down"?"lucide--shield-ban":"lucide--unplug"}`)),Z}}),null),f(R,u(wa,{get children(){return u($a,{icon:"lucide--ellipsis",buttonClass:"rounded-sm p-1.5",get children(){return[u(ft,{get href(){return`/jetstream?dids=${e.repo}`},label:"Jetstream",icon:"lucide--radio-tower"}),u(k,{get when(){return X(()=>!!e.repo)()&&e.repo in Fl},get children(){return u(ft,{get href(){return`/labels?did=${e.repo}&uriPatterns=*`},label:"Labels",icon:"lucide--tag"})}}),u(k,{get when(){return r()?.length===0||r()===void 0},get children(){return u(kl,{label:"Download repo",get icon(){return a()?"lucide--loader-circle animate-spin":"lucide--download"},onClick:()=>q()})}}),u(_l,{}),u(ft,{get href(){return X(()=>!!A.startsWith("did:plc"))()?`${gn()}/${A}`:`https://${A.split("did:web:")[1]}/.well-known/did.json`},newTab:!0,label:"DID document",icon:"lucide--external-link"}),u(k,{get when(){return A.startsWith("did:plc")},get children(){return u(ft,{get href(){return`${gn()}/${A}/log/audit`},newTab:!0,label:"Audit log",icon:"lucide--external-link"})}})]}})}}),null),f(O,u(k,{get when(){return t.hash.startsWith("#logs")},get children(){return u(dn,{fallback:Z=>(()=>{var j=fl();return j.firstChild,f(j,()=>Z.message,null),j})(),get children(){return u(cr,{get fallback(){return hl()},get children(){return u(YC,{did:A})}})}})}}),null),f(O,u(k,{get when(){return t.hash==="#backlinks"},get children(){return u(dn,{fallback:Z=>(()=>{var j=fl();return j.firstChild,f(j,()=>Z.message,null),j})(),get children(){return u(cr,{get fallback(){return hl()},get children(){return u(kh,{target:A})}})}})}}),null),f(O,u(k,{get when(){return t.hash==="#blobs"},get children(){return u(dn,{fallback:Z=>(()=>{var j=fl();return j.firstChild,f(j,()=>Z.message,null),j})(),get children(){return u(cr,{get fallback(){return hl()},get children(){return u(SC,{pds:S,repo:A})}})}})}}),null),f(O,u(k,{get when(){return X(()=>!!c())()&&(!t.hash||t.hash.startsWith("#collections"))},get children(){var Z=e5();return f(Z,u(k,{get when(){return Object.keys(c()??{}).length!=0},get fallback(){return s5()},get children(){return u(oe,{get each(){return Object.keys(c()??{}).filter(j=>h()?j.includes(h())||c()?.[j].nsids.some(G=>`${j}.${G}`.includes(h())):!0)},children:j=>{const G=()=>t.hash===`#collections:${j}`,ie=()=>c()?.[j].hidden??!1;return(()=>{var ee=i5();return ae(ee,"id",`collection-${j}`),f(ee,u(_r,{authority:j,wrapper:Q=>(()=>{var me=o5();return me.firstChild,ae(me,"href",`#collections:${j}`),f(me,Q,null),me})()}),null),f(ee,u(k,{get when(){return!ie()},get fallback(){return(()=>{var Q=c5(),me=Q.firstChild,le=me.nextSibling,re=le.nextSibling,Pe=re.firstChild,Ae=Pe.nextSibling;return Ae.nextSibling,Q.$$click=()=>Y(j),f(me,j),f(re,()=>c()?.[j].nsids.length,Ae),Q})()},get children(){var Q=a5();return f(Q,u(oe,{get each(){return c()?.[j].nsids.filter(me=>h()?`${j}.${me}`.includes(h()):!0)},children:(me,le)=>u(Ie,{href:`/at://${A}/${j}.${me}`,class:"truncate hover:underline active:underline",get classList(){return{"pr-16":Ke&&le()===0}},get children(){return[(()=>{var re=d5(),Pe=re.firstChild;return f(re,j,Pe),re})(),(()=>{var re=u5();return f(re,me),re})()]}})})),Q}}),null),f(ee,u(k,{when:Ke,get children(){var Q=l5();return Q.$$click=()=>Y(j),f(Q,()=>ie()?"expand":"collapse"),Q}}),null),z(Q=>ye(ee,{"dark:hover:bg-dark-300 hover:bg-neutral-200":!G(),"bg-blue-100 dark:bg-blue-500/25":G()},Q)),ee})()}})}})),Z}}),null),f(O,u(k,{get when(){return t.hash==="#identity"||r()&&!t.hash},get children(){return u(k,{get when(){return i()},children:Z=>(()=>{var j=m5(),G=j.firstChild,ie=G.firstChild,ee=ie.nextSibling,Q=ee.firstChild,me=Q.nextSibling;return ee.$$click=()=>mr(Z().id),f(Q,()=>Z().id),f(j,u(k,{get when(){return Z().alsoKnownAs},get children(){var le=f5();return le.firstChild,f(le,u(oe,{get each(){return Z().alsoKnownAs},children:re=>u(k,{get when(){return re.startsWith("at://")},get fallback(){return(()=>{var Pe=v5();return f(Pe,re),Pe})()},get children(){var Pe=x5(),Ae=Pe.firstChild,tt=Ae.firstChild,Lt=tt.nextSibling;return Ae.$$click=async()=>{if($()===re)w(null);else{_(null),w(re);const Je=re.replace("at://",""),Ee=await Ry(Je);$()===re&&_(Ee)}},f(tt,re),f(Pe,u(k,{get when(){return $()===re},get children(){var Je=b5();return f(Je,u(k,{get when(){return v()},get fallback(){return y5()},children:Ee=>{const $e=Z().id,nt=()=>Ee().dns.success&&Ee().dns.did===$e,Pt=()=>Ee().http.success&&Ee().http.did===$e,It=()=>Ee().dns.success&&Ee().dns.did!==$e,Gt=()=>Ee().http.success&&Ee().http.did!==$e;return(()=>{var Fe=w5(),wn=Fe.firstChild,ps=wn.nextSibling,ms=ps.nextSibling,Pr=ms.nextSibling,Ir=Pr.nextSibling,jh=Ir.nextSibling,Uh=jh.nextSibling,Nh=Uh.nextSibling;return f(Pr,u(k,{get when(){return Ee().dns.success},get fallback(){return(()=>{var Re=jc();return f(Re,()=>Ee().dns.error),Re})()},get children(){return[(()=>{var Re=Dc();return f(Re,()=>Ee().dns.did),Re})(),u(k,{get when(){return It()},get children(){var Re=Oc();return Re.firstChild,f(Re,$e,null),Re}})]}})),f(Nh,u(k,{get when(){return Ee().http.success},get fallback(){return(()=>{var Re=jc();return f(Re,()=>Ee().http.error),Re})()},get children(){return[(()=>{var Re=Dc();return f(Re,()=>Ee().http.did),Re})(),u(k,{get when(){return Gt()},get children(){var Re=Oc();return Re.firstChild,f(Re,$e,null),Re}})]}})),z(Re=>{var Mh={"iconify lucide--check text-green-600 dark:text-green-400":nt(),"iconify lucide--x text-red-500 dark:text-red-400":!nt()},Bh={"iconify lucide--check text-green-600 dark:text-green-400":Pt(),"iconify lucide--x text-red-500 dark:text-red-400":!Pt()};return Re.e=ye(wn,Mh,Re.e),Re.t=ye(Ir,Bh,Re.t),Re},{e:void 0,t:void 0}),Fe})()}})),Je}}),null),z(Je=>ye(Lt,{"iconify text-base shrink-0 lucide--check text-green-600 dark:text-green-400":p[re]===!0,"iconify lucide--x text-red-500 dark:text-red-400":p[re]===!1,"iconify lucide--loader-circle animate-spin":p[re]===void 0},Je)),Pe}})}),null),le}}),null),f(j,u(k,{get when(){return Z().service},get children(){var le=h5(),re=le.firstChild,Pe=re.nextSibling;return f(Pe,u(oe,{get each(){return Z().service},children:Ae=>(()=>{var tt=$5(),Lt=tt.firstChild,Je=Lt.nextSibling,Ee=Je.firstChild,$e=Ee.nextSibling,nt=$e.firstChild,Pt=nt.nextSibling,It=Je.nextSibling,Gt=It.nextSibling;return f(Ee,()=>Ae.id.split("#")[1]),f(Pt,()=>Ae.type),f(Gt,()=>Ae.serviceEndpoint.toString()),z(Fe=>{var wn=Ae.type==="AtprotoPersonalDataServer",ps=Ae.type==="AtprotoLabeler",ms=Ae.type==="BskyFeedGenerator",Pr=!["AtprotoPersonalDataServer","AtprotoLabeler","BskyFeedGenerator"].includes(Ae.type.toString()),Ir=Ae.serviceEndpoint.toString();return wn!==Fe.e&&nt.classList.toggle("lucide--hard-drive",Fe.e=wn),ps!==Fe.t&&nt.classList.toggle("lucide--tag",Fe.t=ps),ms!==Fe.a&&nt.classList.toggle("lucide--rss",Fe.a=ms),Pr!==Fe.o&&nt.classList.toggle("lucide--wrench",Fe.o=Pr),Ir!==Fe.i&&ae(Gt,"href",Fe.i=Ir),Fe},{e:void 0,t:void 0,a:void 0,o:void 0,i:void 0}),tt})()})),le}}),null),f(j,u(k,{get when(){return Z().verificationMethod},get children(){var le=g5(),re=le.firstChild,Pe=re.nextSibling;return f(Pe,u(oe,{get each(){return Z().verificationMethod},children:Ae=>u(k,{get when(){return Ae.publicKeyMultibase},children:tt=>(()=>{var Lt=k5(),Je=Lt.firstChild,Ee=Je.nextSibling,$e=Ee.firstChild,nt=$e.nextSibling,Pt=nt.firstChild,It=Pt.nextSibling,Gt=Ee.nextSibling,Fe=Gt.nextSibling;return f($e,()=>Ae.id.split("#")[1]),f(It,()=>Th(tt())),f(Fe,tt),Lt})()})})),le}}),null),f(j,u(k,{get when(){return y().length>0},get children(){var le=p5(),re=le.firstChild,Pe=re.nextSibling;return f(Pe,u(oe,{get each(){return y()},children:Ae=>(()=>{var tt=_5(),Lt=tt.firstChild,Je=Lt.nextSibling,Ee=Je.nextSibling,$e=Ee.nextSibling;return f(Je,()=>yC(Ae)),f($e,()=>Ae.replace("did:key:","")),tt})()})),le}}),null),z(le=>ye(me,{"iconify lucide--copy shrink-0":!0,"opacity-0 group-hover:opacity-100":Ke},le)),j})()})}}),null),L}}),u(k,{get when(){return X(()=>!!c())()&&(!t.hash||t.hash.startsWith("#collections"))},get children(){var L=r5(),V=L.firstChild,P=V.firstChild,R=P.nextSibling,O=V.nextSibling,Z=O.firstChild,j=Z.nextSibling;V.$$click=ie=>{const ee=ie.currentTarget.querySelector("input");ie.target!==ee&&ee?.focus()},R.$$input=ie=>g(ie.currentTarget.value.toLowerCase());var G=C;return typeof G=="function"?Ne(G,R):C=R,ae(R,"spellcheck",!1),f(V,u(k,{get when(){return Ke&&!h()},get children(){return n5()}}),null),Z.$$click=B,j.$$click=F,z(()=>R.value=h()??""),L}})]};ke(["click","input"]);const E5=e=>{if(e===null||typeof e!="object")return!1;const{version:t,roots:n}=e;return t===1&&Array.isArray(n)&&n.every(r=>r instanceof qn)},Qn=128,er=127,C5=2**28,A5=(e,t=0)=>{const n=e.length;let r=t;if(r>=n)throw new RangeError("could not decode varint");let s=e[r++],a=s&er;if(s<Qn)return[a,1];if(r>=n)throw new RangeError("could not decode varint");if(s=e[r++],a|=(s&er)<<7,s<Qn)return[a,2];if(r>=n)throw new RangeError("could not decode varint");if(s=e[r++],a|=(s&er)<<14,s<Qn)return[a,3];if(r>=n)throw new RangeError("could not decode varint");if(s=e[r++],a|=(s&er)<<21,s<Qn)return[a,4];if(r>=n)throw new RangeError("could not decode varint");if(s=e[r++],a+=(s&er)*C5,s<Qn)return[a,5];let l=35;do{if(r>=n)throw new RangeError("could not decode varint");s=e[r++],a+=(s&er)*2**l,l+=7}while(s>=Qn);return[a,r-t]},R5=e=>{const t=T5(e),n=L5(t);return{header:n,roots:n.data.roots,*iterate(){for(;t.upto(44).length>0;){const r=t.pos,s=Oh(t,8),a=t.pos,l=P5(t),i=t.pos,o=s-(i-a),c=t.exactly(o,!0),d=i,h=t.pos;yield{cid:l,bytes:c,entryStart:r,entryEnd:h,cidStart:a,cidEnd:d,bytesStart:i,bytesEnd:h}}},[Symbol.iterator](){return this.iterate()}}},T5=e=>{let t=0;return{get pos(){return t},seek(n){if(n>e.length-t)throw new RangeError("unexpected end of data");t+=n},upto(n){return e.subarray(t,t+n)},exactly(n,r){if(n>e.length-t)throw new RangeError("unexpected end of data");const s=e.subarray(t,t+n);return r&&(t+=n),s}}},Oh=(e,t)=>{const n=e.upto(t);if(n.length===0)throw new RangeError("unexpected end of data");const[r,s]=A5(n);return e.seek(s),r},L5=e=>{const t=e.pos,n=Oh(e,8);if(n===0)throw new RangeError("invalid car header; length=0");const r=e.pos,s=e.exactly(n,!0),a=Et(s);if(!E5(a))throw new TypeError("expected a car v1 archive");const l=e.pos;return{data:a,headerStart:t,headerEnd:l,dataStart:r,dataEnd:l}},P5=e=>{const t=e.exactly(4,!1),n=t[0],r=t[1],s=t[2],a=t[3];if(n!==Mn)throw new RangeError(`incorrect cid version (got v${n})`);if(r!==Ua&&r!==ja)throw new RangeError(`incorrect cid codec (got 0x${r.toString(16)})`);if(s!==yr)throw new RangeError(`incorrect cid digest type (got 0x${s.toString(16)})`);if(a!==32&&a!==0)throw new RangeError(`incorrect cid digest size (got ${a})`);const l=e.exactly(4+a,!0),i=l.subarray(4,4+a);return{version:n,codec:r,digest:{codec:s,contents:i},bytes:l,_str:void 0}};let I5=()=>({emit(e,...t){for(let n=this.events[e]||[],r=0,s=n.length;r<s;r++)n[r](...t)},events:{},on(e,t){return(this.events[e]||=[]).push(t),()=>{this.events[e]=this.events[e]?.filter(n=>t!==n)}}});class D5{relay;ws;cursor="";emitter=I5();autoReconnect;reconnectTimeout;constructor(t={}){this.relay=t.relay??"wss://bsky.network",this.cursor=t.cursor??"",this.autoReconnect=t.autoReconnect??!0;const n=this.cursor?`?cursor=${this.cursor}`:"";if(typeof globalThis.WebSocket>"u"&&!t.ws)throw new Error(`No WebSocket implementation was found in your environment. You must provide an implementation as the \`ws\` option. 28 + 29 + For example, in a Node.js environment, \`npm install ws\` and then: 30 + import { Firehose } from "@skyware/firehose"; 31 + import WebSocket from "ws"; 32 + 33 + const firehose = new Firehose({ 34 + ws: WebSocket, 35 + });`);const r=t.ws??globalThis.WebSocket;this.ws=new r(`${this.relay}/xrpc/com.atproto.sync.subscribeRepos${n}`)}start(){this.ws.addEventListener("open",()=>{this.emitter.emit("open")}),this.ws.addEventListener("message",async({data:t})=>{try{const n=await this.parseMessage(t);switch("seq"in n&&n.seq&&!isNaN(n.seq)&&(this.cursor=`${n.seq}`),n.$type){case"com.atproto.sync.subscribeRepos#identity":this.emitter.emit("identity",n);break;case"com.atproto.sync.subscribeRepos#account":this.emitter.emit("account",n);break;case"com.atproto.sync.subscribeRepos#info":this.emitter.emit("info",n);break;case"com.atproto.sync.subscribeRepos#sync":this.emitter.emit("sync",n);break;case"com.atproto.sync.subscribeRepos#commit":this.emitter.emit("commit",n);break;default:this.emitter.emit("unknown",n);break}}catch(n){this.emitter.emit("error",{cursor:this.cursor,error:n})}finally{this.autoReconnect&&this.preventReconnect()}}),this.ws.addEventListener("close",()=>{this.emitter.emit("close",this.cursor)}),this.ws.addEventListener("error",t=>{this.emitter.emit("websocketError",{cursor:this.cursor,error:t})})}close(){this.ws?.close()}on(t,n){return this.emitter.on(t,n)}async parseMessage(t){const n=new Uint8Array(await new Blob(Array.isArray(t)?t:[t]).arrayBuffer()),[r,s]=Nl(n),[a,l]=Nl(s);if(l.length>0)throw new Error("Excess bytes in message");const{t:i,op:o}=O5(r);if(o===-1)throw new Error(`Error: ${a.message} 36 + Error code: ${a.error}`);if(i==="#commit"){const{seq:c,repo:d,commit:h,rev:g,since:p,blocks:x,ops:y,prevData:b,time:$}=a;if(!x?.$bytes?.length)return{$type:"com.atproto.sync.subscribeRepos#commit",seq:c,repo:d,commit:h.$link,rev:g,since:p,blocks:new Uint8Array,ops:[],...b?{prevData:b.$link}:{},time:$};const w=$r(x),v=j5(w),_=[];for(const E of y){const S=E.action;if(S==="create"){if(!E.cid)continue;const C=v.get(E.cid.$link);if(!C)continue;_.push({action:S,path:E.path,cid:E.cid.$link,record:C})}else if(S==="update"){if(!E.cid)continue;const C=v.get(E.cid.$link);if(!C)continue;_.push({action:S,path:E.path,cid:E.cid.$link,...E.prev?{prev:E.prev.$link}:{},record:C})}else if(S==="delete")_.push({action:S,path:E.path,...E.prev?{prev:E.prev.$link}:{}});else throw new Error(`Unknown action: ${S}`)}return{$type:"com.atproto.sync.subscribeRepos#commit",seq:c,repo:d,commit:h.$link,rev:g,since:p,blocks:w,ops:_,...b?{prevData:b.$link}:{},time:$}}else if(i==="#sync"){const{seq:c,did:d,blocks:h,rev:g,time:p}=a,x=h?.$bytes?.length?$r(h):new Uint8Array;return{$type:"com.atproto.sync.subscribeRepos#sync",seq:c,did:d,blocks:x,rev:g,time:p}}return{$type:`com.atproto.sync.subscribeRepos${i}`,...a}}preventReconnect(){this.reconnectTimeout&&clearTimeout(this.reconnectTimeout),this.reconnectTimeout=setTimeout(()=>{this.reconnect()},5e3)}reconnect(){this.ws?.close(),this.start(),this.emitter.emit("reconnect")}}function O5(e){if(!e||typeof e!="object"||!e.t||typeof e.t!="string"||!e.op||typeof e.op!="number")throw new Error("Invalid header received");return{t:e.t,op:e.op}}function j5(e){const t=new Map;for(const{cid:n,bytes:r}of R5(e))t.set(If(n).$link,Et(r));return t}const U5={1e3:"Normal Closure",1001:"Going Away",1002:"Protocol Error",1003:"Unsupported Data",1005:"No Status Received",1006:"Abnormal Closure",1007:"Invalid frame payload data",1008:"Policy Violation",1009:"Message too big",1010:"Missing Extension",1011:"Internal Error",1012:"Service Restart",1013:"Try Again Later",1014:"Bad Gateway",1015:"TLS Handshake"},N5=U5,ss={jetstream:{label:"Jetstream",description:"A simplified event stream with support for collection and DID filtering.",icon:"lucide--radio-tower",defaultInstance:"wss://jetstream1.us-east.bsky.network/subscribe",useFirehoseLib:!1,showEventTypes:!0,collectionsLabel:"Top Collections",fields:[{name:"collections",label:"Collections",type:"textarea",placeholder:"Comma-separated list of collections",searchParam:"collections"},{name:"dids",label:"DIDs",type:"textarea",placeholder:"Comma-separated list of DIDs",searchParam:"dids"},{name:"cursor",label:"Cursor",type:"text",placeholder:"Leave empty for live-tail",searchParam:"cursor"},{name:"allEvents",label:"Show account and identity events",type:"checkbox",searchParam:"allEvents"}],buildUrl:(e,t)=>{let n=e+"?";t.get("collections")?.toString().split(",")?.forEach(l=>{l.trim().length&&(n+=`wantedCollections=${l.trim()}&`)}),t.get("dids")?.toString().split(",")?.forEach(l=>{l.trim().length&&(n+=`wantedDids=${l.trim()}&`)});const a=t.get("cursor")?.toString();return a?.length&&(n+=`cursor=${a}&`),n.replace(/[&?]$/,"")},parseRecord:e=>{const t=e.commit?.collection||e.kind,n=e.commit?.rkey,r=e.commit?.operation,s=e.time_us?Ct(e.time_us/1e3):void 0;return{type:e.kind,did:e.did,collection:t,rkey:n,action:r,time:s}}},firehose:{label:"Firehose",description:"The raw event stream from a relay or PDS.",icon:"lucide--rss",defaultInstance:"wss://bsky.network",useFirehoseLib:!0,showEventTypes:!0,collectionsLabel:"Top Collections",fields:[{name:"cursor",label:"Cursor",type:"text",placeholder:"Leave empty for live-tail",searchParam:"cursor"}],buildUrl:(e,t)=>{let n=e;return n=n.replace("/xrpc/com.atproto.sync.subscribeRepos",""),n.startsWith("wss://")||n.startsWith("ws://")||(n="wss://"+n),n},parseRecord:e=>{const t=e.$type?.split("#").pop()||e.$type,n=e.repo??e.did,r=e.op?.path?.split("/")||[],s=r[0],a=r[1],l=e.time?Ct(Date.parse(e.time)):void 0;return{type:t,did:n,collection:s,rkey:a,action:e.op?.action,time:l}}},spacedust:{label:"Spacedust",description:"A stream of links showing interactions across the network.",icon:"lucide--link",defaultInstance:"wss://spacedust.microcosm.blue/subscribe",useFirehoseLib:!1,showEventTypes:!1,collectionsLabel:"Top Sources",fields:[{name:"sources",label:"Sources",type:"textarea",placeholder:"e.g. app.bsky.graph.follow:subject",searchParam:"sources"},{name:"subjectDids",label:"Subject DIDs",type:"textarea",placeholder:"Comma-separated list of DIDs",searchParam:"subjectDids"},{name:"subjects",label:"Subjects",type:"textarea",placeholder:"Comma-separated list of AT URIs",searchParam:"subjects"},{name:"instant",label:"Instant mode (bypass 21s delay buffer)",type:"checkbox",searchParam:"instant"}],buildUrl:(e,t)=>{let n=e+"?";return t.get("sources")?.toString().split(",")?.forEach(i=>{i.trim().length&&(n+=`wantedSources=${i.trim()}&`)}),t.get("subjectDids")?.toString().split(",")?.forEach(i=>{i.trim().length&&(n+=`wantedSubjectDids=${i.trim()}&`)}),t.get("subjects")?.toString().split(",")?.forEach(i=>{i.trim().length&&(n+=`wantedSubjects=${encodeURIComponent(i.trim())}&`)}),t.get("instant")?.toString()==="on"&&(n+="instant=true&"),n.replace(/[&?]$/,"")},parseRecord:e=>{const t=e.link?.source,r=e.link?.source_record?.replace("at://","").split("/")||[],s=r[0],a=r[1],l=r[2];return{type:e.kind,did:s,collection:t||a,rkey:l,action:e.link?.operation,time:void 0}}}},M5=Object.keys(ss),B5=e=>e==="/firehose"?"firehose":e==="/spacedust"?"spacedust":"jetstream";var F5=m('<div class=mt-2><div class="mb-1 text-xs text-neutral-500 dark:text-neutral-400">Event Types</div><div class="grid grid-cols-[1fr_5rem_3rem] gap-x-1 gap-y-0.5 font-mono text-xs sm:gap-x-4">'),z5=m('<div class=mt-2><div class="mb-1 text-xs text-neutral-500 dark:text-neutral-400"></div><div class="grid grid-cols-[1fr_5rem_3rem] gap-x-1 gap-y-0.5 font-mono text-xs sm:gap-x-4">'),V5=m('<div class="w-full text-sm"><div class="mb-1 font-semibold">Statistics</div><div class="flex flex-wrap justify-between gap-x-4 gap-y-2"><div><div class="text-xs text-neutral-500 dark:text-neutral-400">Uptime</div><div class=font-mono></div></div><div><div class="text-xs text-neutral-500 dark:text-neutral-400">Total Events</div><div class=font-mono></div></div><div><div class="text-xs text-neutral-500 dark:text-neutral-400">Events/sec</div><div class=font-mono></div></div><div><div class="text-xs text-neutral-500 dark:text-neutral-400">Avg/sec</div><div class=font-mono>'),K5=m('<span class="text-neutral-700 dark:text-neutral-300">'),Uc=m('<span class="text-right text-neutral-600 tabular-nums dark:text-neutral-400">'),Nc=m('<span class="text-right text-neutral-400 tabular-nums dark:text-neutral-500">%'),H5=m('<span class="min-w-0 truncate text-neutral-700 dark:text-neutral-300">');const q5=e=>{const t=Math.floor(e/1e3),n=Math.floor(t/60),r=Math.floor(n/60);return r>0?`${r}h ${n%60}m ${t%60}s`:n>0?`${n}m ${t%60}s`:`${t}s`},W5=e=>{const t=()=>ss[e.streamType],n=()=>e.stats.connectedAt?e.currentTime-e.stats.connectedAt:0,r=()=>t().showEventTypes?e.streamType==="jetstream"?e.showAllEvents===!0:!0:!1,s=()=>Object.entries(e.stats.collections).sort(([,l],[,i])=>i-l).slice(0,5),a=()=>Object.entries(e.stats.eventTypes).sort(([,l],[,i])=>i-l).slice(0,5);return u(k,{get when(){return e.stats.connectedAt!==void 0},get children(){var l=V5(),i=l.firstChild,o=i.nextSibling,c=o.firstChild,d=c.firstChild,h=d.nextSibling,g=c.nextSibling,p=g.firstChild,x=p.nextSibling,y=g.nextSibling,b=y.firstChild,$=b.nextSibling,w=y.nextSibling,v=w.firstChild,_=v.nextSibling;return f(h,()=>q5(n())),f(x,()=>e.stats.totalEvents.toLocaleString()),f($,()=>e.stats.eventsPerSecond.toFixed(1)),f(_,(()=>{var E=X(()=>n()>0);return()=>E()?(e.stats.totalEvents/n()*1e3).toFixed(1):"0.0"})()),f(l,u(k,{get when(){return X(()=>a().length>0)()&&r()},get children(){var E=F5(),S=E.firstChild,C=S.nextSibling;return f(C,u(oe,{get each(){return a()},children:([A,D])=>{const N=(D/e.stats.totalEvents*100).toFixed(1);return[(()=>{var I=K5();return f(I,A),I})(),(()=>{var I=Uc();return f(I,()=>D.toLocaleString()),I})(),(()=>{var I=Nc(),M=I.firstChild;return f(I,N,M),I})()]}})),E}}),null),f(l,u(k,{get when(){return s().length>0},get children(){var E=z5(),S=E.firstChild,C=S.nextSibling;return f(S,()=>t().collectionsLabel),f(C,u(oe,{get each(){return s()},children:([A,D])=>{const N=(D/e.stats.totalEvents*100).toFixed(1);return[(()=>{var I=H5();return f(I,A),I})(),(()=>{var I=Uc();return f(I,()=>D.toLocaleString()),I})(),(()=>{var I=Nc(),M=I.firstChild;return f(I,N,M),I})()]}})),E}}),null),l}})};var G5=m('<span class="min-w-0 truncate text-neutral-600 dark:text-neutral-300">'),Z5=m('<span class="truncate text-neutral-400 dark:text-neutral-500">'),X5=m("<span class=w-fit>"),J5=m("<span>"),Y5=m('<button type=button class="flex size-6 shrink-0 items-center justify-center rounded text-neutral-500 transition-colors hover:bg-neutral-200 hover:text-neutral-600 active:bg-neutral-300 sm:size-7 dark:text-neutral-400 dark:hover:bg-neutral-700 dark:hover:text-neutral-300 dark:active:bg-neutral-600"><span class="iconify lucide--copy">'),Q5=m('<div class=ml-6.5><div class="w-full text-xs wrap-anywhere whitespace-pre-wrap md:w-2xl">'),e3=m('<div class="flex flex-col gap-2"><div class="flex items-start gap-1"><button type=button class="dark:hover:bg-dark-200 flex min-w-0 flex-1 items-start gap-2 rounded p-1 text-left hover:bg-neutral-200/70"><span class="mt-0.5 shrink-0 text-neutral-400 dark:text-neutral-500"></span><div class="flex min-w-0 flex-1 flex-col gap-0.5"><div class="flex items-center gap-x-1.5 sm:gap-x-2"><span></span></div><div class="flex flex-col gap-x-2 gap-y-0.5 text-xs text-neutral-500 sm:flex-row sm:items-center dark:text-neutral-400">'),t3=m('<span class="iconify lucide--chevron-down">'),n3=m('<span class="iconify lucide--chevron-right">'),r3=m('<form class="flex w-full flex-col gap-2 p-2 text-sm"><label class="flex items-center justify-end gap-x-1"><span class="min-w-21 select-none">Instance</span></label><div class="flex justify-end gap-2">'),s3=m('<div class="flex w-full flex-col gap-2 p-2"><div class="flex flex-col gap-1 text-sm wrap-anywhere"><div class=font-semibold>Parameters</div></div><div class="flex justify-end gap-2">'),a3=m('<div class="text-red-500 dark:text-red-400">'),l3=m('<div class="flex min-h-280 w-full flex-col gap-2 font-mono text-xs [overflow-anchor:auto] sm:text-sm"><div class="h-px [overflow-anchor:auto]">'),i3=m('<div class="flex w-full flex-col items-center gap-2"><div class="flex gap-4 font-medium"></div><div class="w-full px-2 text-center"><p class="text-sm text-neutral-600 dark:text-neutral-400">'),o3=m("<input type=checkbox>"),c3=m('<textarea class="dark:bg-dark-100 grow rounded-lg bg-white px-2 py-1 outline-1 outline-neutral-200 focus:outline-neutral-400 dark:outline-neutral-600 dark:focus:outline-neutral-400">'),d3=m('<label class="flex items-center justify-end gap-x-1"><span class="min-w-21 select-none">'),u3=m('<div class=text-sm><div class="text-xs text-neutral-500 dark:text-neutral-400"></div><div class="text-neutral-700 dark:text-neutral-300">'),f3=m("<div class=[overflow-anchor:none]>");const h3={create:"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-300",update:"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-300",delete:"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-300",identity:"bg-purple-100 text-purple-700 dark:bg-purple-900/30 dark:text-purple-300",account:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-300",sync:"bg-pink-100 text-pink-700 dark:bg-pink-900/30 dark:text-pink-300"},g3=e=>{const[t,n]=T(!1),r=()=>ss[e.streamType],s=()=>r().parseRecord(e.record),a=()=>{const i=s();return i.type==="commit"||i.type==="link"?i.action:i.type},l=i=>{i.stopPropagation(),mr(JSON.stringify(e.record,null,2))};return(()=>{var i=e3(),o=i.firstChild,c=o.firstChild,d=c.firstChild,h=d.nextSibling,g=h.firstChild,p=g.firstChild,x=g.nextSibling;return c.$$click=()=>n(!t()),f(d,(()=>{var y=X(()=>!!t());return()=>y()?t3():n3()})()),f(p,a),f(g,u(k,{get when(){return X(()=>!!s().collection)()&&s().collection!==s().type},get children(){var y=G5();return f(y,()=>s().collection),y}}),null),f(g,u(k,{get when(){return s().rkey},get children(){var y=Z5();return f(y,()=>s().rkey),y}}),null),f(x,u(k,{get when(){return s().did},get children(){var y=X5();return y.$$click=b=>b.stopPropagation(),f(y,u(gs,{newTab:!0,get did(){return s().did}})),y}}),null),f(x,u(k,{get when(){return s().time},get children(){var y=J5();return f(y,()=>s().time),y}}),null),f(o,u(k,{get when(){return t()},get children(){var y=Y5();return y.$$click=l,y}}),null),f(i,u(k,{get when(){return t()},get children(){var y=Q5(),b=y.firstChild;return f(b,u(Lr,{newTab:!0,get data(){return e.record},get repo(){return s().did??""},hideBlobs:!0})),y}}),null),z(()=>he(p,`shrink-0 rounded px-1.5 py-0.5 text-xs font-medium ${h3[a()]||"bg-neutral-200 text-neutral-700 dark:bg-neutral-700 dark:text-neutral-300"}`)),i})()},p3=()=>{const[e,t]=ti(),n=B5(bt().pathname),r=()=>ss[n],[s,a]=T([]),[l,i]=T(!1),[o,c]=T(!1),[d,h]=T(""),[g,p]=T([]),[x,y]=T({totalEvents:0,eventsPerSecond:0,eventTypes:{},collections:{}}),[b,$]=T(Date.now());let w,v,_,E=[],S=null,C=null,A=null,D=0,N=0,I={},M={};const Y=q=>{D++,N++;const U=q.kind||q.$type||"unknown",L=U.includes("#")?U.split("#").pop():U;if(I[L]=(I[L]||0)+1,L!=="account"&&L!=="identity"&&L!=="sync"){const V=q.commit?.collection||q.op?.path?.split("/")[0]||q.link?.source||"unknown";M[V]=(M[V]||0)+1}o()||(E.push(q),S===null&&(S=requestAnimationFrame(()=>{a(s().concat(E).slice(-20)),E=[],S=null})))},F=()=>{r().useFirehoseLib?v?.close():w?.close(),S!==null&&(cancelAnimationFrame(S),S=null),C!==null&&(clearInterval(C),C=null),A!==null&&(clearInterval(A),A=null),E=[],N=0,I={},M={},i(!1),c(!1),y(q=>({...q,eventsPerSecond:0}))},B=q=>{const U=q.code.toString();U==="1000"||U==="1005"||(h(`Connection closed: ${N5[U]??"Unknown reason"}`),F())},K=async q=>{if(h(""),l()){F();return}a([]);const U=q.get("instance")?.toString()??r().defaultInstance,L=r().buildUrl(U,q),V={instance:U};r().fields.forEach(R=>{V[R.searchParam]=q.get(R.name)?.toString()}),t(V),p([{name:"Instance",value:U},...r().fields.filter(R=>R.type!=="checkbox").map(R=>({name:R.label,value:q.get(R.name)?.toString()})),...r().fields.filter(R=>R.type==="checkbox"&&q.get(R.name)==="on").map(R=>({name:R.label,value:"on"}))]),i(!0);const P=Date.now();if($(P),N=0,I={},M={},y({connectedAt:P,totalEvents:0,eventsPerSecond:0,eventTypes:{},collections:{}}),A=window.setInterval(()=>{y(R=>({...R,totalEvents:N,eventTypes:{...I},collections:{...M}}))},50),C=window.setInterval(()=>{y(R=>({...R,eventsPerSecond:D})),D=0,$(Date.now())},1e3),!r().useFirehoseLib)w=new WebSocket(L),w.addEventListener("message",R=>{const O=JSON.parse(R.data);(!(O.kind==="account"||O.kind==="identity")||n!=="jetstream"||e.allEvents==="on")&&Y(O)}),w.addEventListener("close",B),w.addEventListener("error",()=>{w.removeEventListener("close",B),h("Connection error"),F()});else{const R=q.get("cursor")?.toString();v=new D5({relay:L,cursor:R,autoReconnect:!1}),v.ws.addEventListener("close",B),v.on("error",O=>{v.ws.removeEventListener("close",B),console.error(O);const Z=O instanceof Error?O.message:"Unknown error";h(`Connection error: ${Z}`),F()}),v.on("commit",O=>{for(const Z of O.ops)Y({$type:O.$type,repo:O.repo,seq:O.seq,time:O.time,rev:O.rev,since:O.since,op:Z})}),v.on("identity",O=>Y(O)),v.on("account",O=>Y(O)),v.on("sync",O=>{Y({$type:O.$type,did:O.did,rev:O.rev,seq:O.seq,time:O.time})}),v.start()}};return pt(()=>{if(e.instance){const q=new FormData;q.append("instance",e.instance.toString()),r().fields.forEach(U=>{const L=e[U.searchParam];L&&q.append(U.name,L.toString())}),K(q)}}),Ce(()=>{w?.close(),v?.close(),S!==null&&cancelAnimationFrame(S),C!==null&&clearInterval(C),A!==null&&clearInterval(A)}),[u(Rt,{get children(){return[X(()=>r().label)," - PDSls"]}}),(()=>{var q=i3(),U=q.firstChild,L=U.nextSibling,V=L.firstChild;return f(U,u(oe,{each:M5,children:P=>u(Ie,{class:"flex items-center gap-1 border-b-2 transition-colors",inactiveClass:"border-transparent not-hover:text-neutral-600 not-hover:dark:text-neutral-400",href:`/${P}`,get children(){return ss[P].label}})})),f(V,()=>r().description),f(q,u(k,{get when(){return!l()},get children(){var P=r3(),R=P.firstChild;R.firstChild;var O=R.nextSibling,Z=_;return typeof Z=="function"?Ne(Z,P):_=P,f(R,u(Kt,{name:"instance",get value(){return e.instance??r().defaultInstance},class:"grow"}),null),f(P,u(oe,{get each(){return r().fields},children:j=>(()=>{var G=d3(),ie=G.firstChild;return f(G,u(k,{get when(){return j.type==="checkbox"},get children(){var ee=o3();return z(Q=>{var me=j.name,le=j.name;return me!==Q.e&&ae(ee,"name",Q.e=me),le!==Q.t&&ae(ee,"id",Q.t=le),Q},{e:void 0,t:void 0}),z(()=>ee.checked=e[j.searchParam]==="on"),ee}}),ie),f(ie,()=>j.label),f(G,u(k,{get when(){return j.type==="textarea"},get children(){var ee=c3();return ae(ee,"spellcheck",!1),z(Q=>{var me=j.name,le=j.placeholder;return me!==Q.e&&ae(ee,"name",Q.e=me),le!==Q.t&&ae(ee,"placeholder",Q.t=le),Q},{e:void 0,t:void 0}),z(()=>ee.value=e[j.searchParam]??""),ee}}),null),f(G,u(k,{get when(){return j.type==="text"},get children(){return u(Kt,{get name(){return j.name},get placeholder(){return j.placeholder},get value(){return e[j.searchParam]??""},class:"grow"})}}),null),G})()}),O),f(O,u(Se,{onClick:()=>K(new FormData(_)),children:"Connect"})),P}}),null),f(q,u(k,{get when(){return l()},get children(){var P=s3(),R=P.firstChild;R.firstChild;var O=R.nextSibling;return f(R,u(oe,{get each(){return g()},children:Z=>u(k,{get when(){return Z.value},get children(){var j=u3(),G=j.firstChild,ie=G.nextSibling;return f(G,()=>Z.name),f(ie,()=>Z.value),j}})}),null),f(P,u(W5,{get stats(){return x()},get currentTime(){return b()},streamType:n,get showAllEvents(){return e.allEvents==="on"}}),O),f(O,u(Se,{ontouchstart:Z=>{Z.preventDefault(),requestAnimationFrame(()=>c(!o()))},onClick:()=>c(!o()),get children(){return o()?"Resume":"Pause"}}),null),f(O,u(Se,{ontouchstart:Z=>{Z.preventDefault(),requestAnimationFrame(()=>F())},onClick:F,children:"Disconnect"}),null),P}}),null),f(q,u(k,{get when(){return d().length},get children(){var P=a3();return f(P,d),P}}),null),f(q,u(k,{get when(){return l()||s().length>0},get children(){var P=l3(),R=P.firstChild;return f(P,u(oe,{get each(){return s().toReversed()},children:O=>(()=>{var Z=f3();return f(Z,u(g3,{record:O,streamType:n})),Z})()}),R),P}}),null),q})()]};ke(["click"]);p0(()=>u(Q0,{root:R$,get children(){return[u(xt,{path:"/",component:h1}),u(xt,{path:["/jetstream","/firehose","/spacedust"],component:p3}),u(xt,{path:"/labels",component:D1}),u(xt,{path:"/car",component:i_}),u(xt,{path:"/car/explore",component:Jk}),u(xt,{path:"/car/unpack",component:I_}),u(xt,{path:"/settings",component:yy}),u(xt,{path:"/:pds",component:rS}),u(xt,{path:"/:pds/:repo",component:S5}),u(xt,{path:"/:pds/:repo/:collection",component:e1}),u(xt,{path:"/:pds/:repo/:collection/:rkey",component:vC})]}}),document.getElementById("root"));export{Ce as a,cn as e,pt as o,m as t,Ne as u};
+1
assets/index-DQYJUy_Y.css
··· 1 + @layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-font-weight:initial;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-duration:initial;--tw-ease:initial;--tw-content:""}}}@layer theme{:root,:host{--font-sans:"Figtree", sans-serif;--font-mono:"Roboto Mono", monospace;--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-200:oklch(88.5% .062 18.334);--color-red-300:oklch(80.8% .114 19.571);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-red-900:oklch(39.6% .141 25.723);--color-orange-100:oklch(95.4% .038 75.164);--color-orange-300:oklch(83.7% .128 66.29);--color-orange-700:oklch(55.3% .195 38.402);--color-orange-800:oklch(47% .157 37.304);--color-orange-900:oklch(40.8% .123 38.172);--color-amber-100:oklch(96.2% .059 95.617);--color-amber-300:oklch(87.9% .169 91.605);--color-amber-400:oklch(82.8% .189 84.429);--color-amber-500:oklch(76.9% .188 70.08);--color-amber-800:oklch(47.3% .137 46.201);--color-amber-900:oklch(41.4% .112 45.904);--color-yellow-100:oklch(97.3% .071 103.193);--color-yellow-300:oklch(90.5% .182 98.111);--color-yellow-800:oklch(47.6% .114 61.907);--color-yellow-900:oklch(42.1% .095 57.708);--color-green-100:oklch(96.2% .044 156.743);--color-green-300:oklch(87.1% .15 154.449);--color-green-400:oklch(79.2% .209 151.711);--color-green-500:oklch(72.3% .219 149.579);--color-green-600:oklch(62.7% .194 149.214);--color-green-700:oklch(52.7% .154 150.069);--color-green-800:oklch(44.8% .119 151.328);--color-green-900:oklch(39.3% .095 152.535);--color-emerald-400:oklch(76.5% .177 163.223);--color-emerald-500:oklch(69.6% .17 162.48);--color-cyan-100:oklch(95.6% .045 203.388);--color-cyan-300:oklch(86.5% .127 207.078);--color-cyan-800:oklch(45% .085 224.283);--color-cyan-900:oklch(39.8% .07 227.392);--color-blue-100:oklch(93.2% .032 255.585);--color-blue-200:oklch(88.2% .059 254.128);--color-blue-300:oklch(80.9% .105 251.813);--color-blue-400:oklch(70.7% .165 254.624);--color-blue-500:oklch(62.3% .214 259.815);--color-blue-600:oklch(54.6% .245 262.881);--color-blue-700:oklch(48.8% .243 264.376);--color-blue-800:oklch(42.4% .199 265.638);--color-blue-900:oklch(37.9% .146 265.522);--color-indigo-200:oklch(87% .065 274.039);--color-indigo-300:oklch(78.5% .115 274.713);--color-indigo-400:oklch(67.3% .182 276.935);--color-indigo-500:oklch(58.5% .233 277.117);--color-indigo-700:oklch(45.7% .24 277.023);--color-indigo-800:oklch(39.8% .195 277.366);--color-violet-200:oklch(89.4% .057 293.283);--color-violet-300:oklch(81.1% .111 293.571);--color-violet-400:oklch(70.2% .183 293.541);--color-violet-500:oklch(60.6% .25 292.717);--color-violet-700:oklch(49.1% .27 292.581);--color-violet-800:oklch(43.2% .232 292.759);--color-purple-100:oklch(94.6% .033 307.174);--color-purple-300:oklch(82.7% .119 306.383);--color-purple-700:oklch(49.6% .265 301.924);--color-purple-800:oklch(43.8% .218 303.724);--color-purple-900:oklch(38.1% .176 304.987);--color-pink-100:oklch(94.8% .028 342.258);--color-pink-300:oklch(82.3% .12 346.018);--color-pink-700:oklch(52.5% .223 3.958);--color-pink-800:oklch(45.9% .187 3.815);--color-pink-900:oklch(40.8% .153 2.432);--color-neutral-50:oklch(98.5% 0 0);--color-neutral-100:oklch(97% 0 0);--color-neutral-200:oklch(92.2% 0 0);--color-neutral-300:oklch(87% 0 0);--color-neutral-400:oklch(70.8% 0 0);--color-neutral-500:oklch(55.6% 0 0);--color-neutral-600:oklch(43.9% 0 0);--color-neutral-700:oklch(37.1% 0 0);--color-neutral-800:oklch(26.9% 0 0);--color-neutral-900:oklch(20.5% 0 0);--color-black:#000;--color-white:#fff;--spacing:.25rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height: 1.5 ;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-3xl:1.875rem;--text-3xl--line-height: 1.2 ;--text-4xl:2.25rem;--text-4xl--line-height:calc(2.5 / 2.25);--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--ease-out:cubic-bezier(0, 0, .2, 1);--animate-spin:spin 1s linear infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-sans);--default-mono-font-family:var(--font-mono);--color-dark-100:oklch(35.62% 0 0);--color-dark-200:oklch(31.71% 0 0);--color-dark-300:oklch(29.72% 0 0);--color-dark-500:oklch(23.93% 0 0);--color-dark-700:oklch(22.21% 0 0)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}:-moz-focusring{outline:auto}progress{vertical-align:baseline}summary{display:list-item}ol,ul,menu{list-style:none}img,svg,video,canvas,audio,iframe,embed,object{vertical-align:middle;display:block}img,video{max-width:100%;height:auto}button,input,select,optgroup,textarea{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}::file-selector-button{font:inherit;font-feature-settings:inherit;font-variation-settings:inherit;letter-spacing:inherit;color:inherit;opacity:1;background-color:#0000;border-radius:0}:where(select:is([multiple],[size])) optgroup{font-weight:bolder}:where(select:is([multiple],[size])) optgroup option{padding-inline-start:20px}::file-selector-button{margin-inline-end:4px}::placeholder{opacity:1}@supports (not ((-webkit-appearance:-apple-pay-button))) or (contain-intrinsic-size:1px){::placeholder{color:currentColor}@supports (color:color-mix(in lab,red,red)){::placeholder{color:color-mix(in oklab,currentcolor 50%,transparent)}}}textarea{resize:vertical}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-date-and-time-value{min-height:1lh;text-align:inherit}::-webkit-datetime-edit{display:inline-flex}::-webkit-datetime-edit-fields-wrapper{padding:0}::-webkit-datetime-edit{padding-block:0}::-webkit-datetime-edit-year-field{padding-block:0}::-webkit-datetime-edit-month-field{padding-block:0}::-webkit-datetime-edit-day-field{padding-block:0}::-webkit-datetime-edit-hour-field{padding-block:0}::-webkit-datetime-edit-minute-field{padding-block:0}::-webkit-datetime-edit-second-field{padding-block:0}::-webkit-datetime-edit-millisecond-field{padding-block:0}::-webkit-datetime-edit-meridiem-field{padding-block:0}::-webkit-calendar-picker-indicator{line-height:1}:-moz-ui-invalid{box-shadow:none}button,input:where([type=button],[type=reset],[type=submit]){appearance:button}::file-selector-button{appearance:button}::-webkit-inner-spin-button{height:auto}::-webkit-outer-spin-button{height:auto}[hidden]:where(:not([hidden=until-found])){display:none!important}}@layer components;@layer utilities{.pointer-events-auto{pointer-events:auto}.pointer-events-none{pointer-events:none}.collapse{visibility:collapse}.invisible{visibility:hidden}.sr-only{clip-path:inset(50%);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.absolute{position:absolute}.fixed{position:fixed}.relative{position:relative}.inset-0{inset:calc(var(--spacing) * 0)}.inset-y-0{inset-block:calc(var(--spacing) * 0)}.start{inset-inline-start:var(--spacing)}.end{inset-inline-end:var(--spacing)}.-top-3{top:calc(var(--spacing) * -3)}.top-1{top:calc(var(--spacing) * 1)}.top-1\/2{top:50%}.top-full{top:100%}.-right-4{right:calc(var(--spacing) * -4)}.right-0{right:calc(var(--spacing) * 0)}.right-1{right:calc(var(--spacing) * 1)}.right-4{right:calc(var(--spacing) * 4)}.bottom-0{bottom:calc(var(--spacing) * 0)}.bottom-4{bottom:calc(var(--spacing) * 4)}.bottom-full{bottom:100%}.-left-2{left:calc(var(--spacing) * -2)}.-left-3\.5{left:calc(var(--spacing) * -3.5)}.-left-4\.5{left:calc(var(--spacing) * -4.5)}.-left-5{left:calc(var(--spacing) * -5)}.-left-6{left:calc(var(--spacing) * -6)}.left-0{left:calc(var(--spacing) * 0)}.left-4{left:calc(var(--spacing) * 4)}.left-\[50\%\]{left:50%}.z-5{z-index:5}.z-10{z-index:10}.z-20{z-index:20}.z-30{z-index:30}.z-50{z-index:50}.z-60{z-index:60}.container{width:100%}@media(min-width:40rem){.container{max-width:40rem}}@media(min-width:48rem){.container{max-width:48rem}}@media(min-width:64rem){.container{max-width:64rem}}@media(min-width:80rem){.container{max-width:80rem}}@media(min-width:96rem){.container{max-width:96rem}}.m-0\.5{margin:calc(var(--spacing) * .5)}.-mx-2{margin-inline:calc(var(--spacing) * -2)}.mx-3{margin-inline:calc(var(--spacing) * 3)}.mx-auto{margin-inline:auto}.my-0\.5{margin-block:calc(var(--spacing) * .5)}.my-1{margin-block:calc(var(--spacing) * 1)}.mt-0\.5{margin-top:calc(var(--spacing) * .5)}.mt-1{margin-top:calc(var(--spacing) * 1)}.mt-2{margin-top:calc(var(--spacing) * 2)}.mt-3{margin-top:calc(var(--spacing) * 3)}.-mr-2{margin-right:calc(var(--spacing) * -2)}.mr-1{margin-right:calc(var(--spacing) * 1)}.mr-1\.5{margin-right:calc(var(--spacing) * 1.5)}.mb-1{margin-bottom:calc(var(--spacing) * 1)}.mb-2{margin-bottom:calc(var(--spacing) * 2)}.mb-3{margin-bottom:calc(var(--spacing) * 3)}.mb-4{margin-bottom:calc(var(--spacing) * 4)}.mb-8{margin-bottom:calc(var(--spacing) * 8)}.-ml-1{margin-left:calc(var(--spacing) * -1)}.ml-1{margin-left:calc(var(--spacing) * 1)}.ml-1\.5{margin-left:calc(var(--spacing) * 1.5)}.ml-2{margin-left:calc(var(--spacing) * 2)}.ml-6\.5{margin-left:calc(var(--spacing) * 6.5)}.ml-7\.5{margin-left:calc(var(--spacing) * 7.5)}.ml-auto{margin-left:auto}.iconify{width:1em;height:1em;-webkit-mask-image:var(--svg);mask-image:var(--svg);background-color:currentColor;display:inline-block;-webkit-mask-size:100% 100%;mask-size:100% 100%;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat}.iconify-color{background-image:var(--svg);background-repeat:no-repeat;background-size:100% 100%;width:1em;height:1em;display:inline-block}.block{display:block}.flex{display:flex}.grid{display:grid}.hidden{display:none}.inline{display:inline}.inline-block{display:inline-block}.inline-flex{display:inline-flex}.size-4{width:calc(var(--spacing) * 4);height:calc(var(--spacing) * 4)}.size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.size-6{width:calc(var(--spacing) * 6);height:calc(var(--spacing) * 6)}.size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.size-8{width:calc(var(--spacing) * 8);height:calc(var(--spacing) * 8)}.size-fit{width:fit-content;height:fit-content}.h-0{height:calc(var(--spacing) * 0)}.h-2{height:calc(var(--spacing) * 2)}.h-3\.5{height:calc(var(--spacing) * 3.5)}.h-5{height:calc(var(--spacing) * 5)}.h-7\.5{height:calc(var(--spacing) * 7.5)}.h-13{height:calc(var(--spacing) * 13)}.h-48{height:calc(var(--spacing) * 48)}.h-\[0\.5px\]{height:.5px}.h-\[65vh\]{height:65vh}.h-\[85vh\]{height:85vh}.h-auto{height:auto}.h-full{height:100%}.h-px{height:1px}.max-h-48{max-height:calc(var(--spacing) * 48)}.max-h-80{max-height:calc(var(--spacing) * 80)}.max-h-none{max-height:none}.max-h-screen{max-height:100vh}.min-h-0{min-height:calc(var(--spacing) * 0)}.min-h-6{min-height:calc(var(--spacing) * 6)}.min-h-7{min-height:calc(var(--spacing) * 7)}.min-h-7\.5{min-height:calc(var(--spacing) * 7.5)}.min-h-280{min-height:calc(var(--spacing) * 280)}.min-h-screen{min-height:100vh}.w-3\.5{width:calc(var(--spacing) * 3.5)}.w-4{width:calc(var(--spacing) * 4)}.w-7{width:calc(var(--spacing) * 7)}.w-8{width:calc(var(--spacing) * 8)}.w-20{width:calc(var(--spacing) * 20)}.w-40{width:calc(var(--spacing) * 40)}.w-48{width:calc(var(--spacing) * 48)}.w-\[20rem\]{width:20rem}.w-\[24rem\]{width:24rem}.w-\[calc\(100\%-1rem\)\]{width:calc(100% - 1rem)}.w-\[calc\(100\%-2rem\)\]{width:calc(100% - 2rem)}.w-fit{width:fit-content}.w-full{width:100%}.w-max{width:max-content}.w-px{width:1px}.w-screen{width:100vw}.max-w-3xl{max-width:var(--container-3xl)}.max-w-4xl{max-width:var(--container-4xl)}.max-w-7xl{max-width:var(--container-7xl)}.max-w-40{max-width:calc(var(--spacing) * 40)}.max-w-64{max-width:calc(var(--spacing) * 64)}.max-w-\[20rem\]{max-width:20rem}.max-w-\[40\%\]{max-width:40%}.max-w-full{max-width:100%}.max-w-lg{max-width:var(--container-lg)}.max-w-md{max-width:var(--container-md)}.max-w-none{max-width:none}.max-w-screen{max-width:100vw}.max-w-sm{max-width:var(--container-sm)}.max-w-xs{max-width:var(--container-xs)}.min-w-0{min-width:calc(var(--spacing) * 0)}.min-w-21{min-width:calc(var(--spacing) * 21)}.min-w-40{min-width:calc(var(--spacing) * 40)}.min-w-50{min-width:calc(var(--spacing) * 50)}.min-w-64{min-width:calc(var(--spacing) * 64)}.min-w-fit{min-width:fit-content}.min-w-full{min-width:100%}.flex-1{flex:1}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.basis-full{flex-basis:100%}.-translate-x-1\/2{--tw-translate-x: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.-translate-y-1\/2{--tw-translate-y: -50% ;translate:var(--tw-translate-x) var(--tw-translate-y)}.scale-95{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}.rotate-15{rotate:15deg}.rotate-180{rotate:180deg}.transform{transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-\[slideIn_0\.25s_ease-in\]{animation:.25s ease-in slideIn}.animate-\[slideOut_0\.25s_ease-in\]{animation:.25s ease-in slideOut}.animate-spin{animation:var(--animate-spin)}.cursor-auto{cursor:auto}.cursor-pointer{cursor:pointer}.cursor-text{cursor:text}.cursor-zoom-in{cursor:zoom-in}.cursor-zoom-out{cursor:zoom-out}.resize{resize:both}.scroll-mt-3{scroll-margin-top:calc(var(--spacing) * 3)}.scroll-mt-4{scroll-margin-top:calc(var(--spacing) * 4)}.grid-cols-2{grid-template-columns:repeat(2,minmax(0,1fr))}.grid-cols-3{grid-template-columns:repeat(3,minmax(0,1fr))}.grid-cols-\[1fr_5rem_3rem\]{grid-template-columns:1fr 5rem 3rem}.grid-cols-\[auto_1fr\]{grid-template-columns:auto 1fr}.grid-cols-\[auto_1fr_auto\]{grid-template-columns:auto 1fr auto}.flex-col{flex-direction:column}.flex-wrap{flex-wrap:wrap}.items-baseline{align-items:baseline}.items-center{align-items:center}.items-start{align-items:flex-start}.justify-around{justify-content:space-around}.justify-between{justify-content:space-between}.justify-center{justify-content:center}.justify-end{justify-content:flex-end}.gap-0\.5{gap:calc(var(--spacing) * .5)}.gap-1{gap:calc(var(--spacing) * 1)}.gap-1\.5{gap:calc(var(--spacing) * 1.5)}.gap-2{gap:calc(var(--spacing) * 2)}.gap-3{gap:calc(var(--spacing) * 3)}.gap-4{gap:calc(var(--spacing) * 4)}.gap-6{gap:calc(var(--spacing) * 6)}.gap-x-1{column-gap:calc(var(--spacing) * 1)}.gap-x-1\.5{column-gap:calc(var(--spacing) * 1.5)}.gap-x-2{column-gap:calc(var(--spacing) * 2)}.gap-x-4{column-gap:calc(var(--spacing) * 4)}.gap-y-0\.5{row-gap:calc(var(--spacing) * .5)}.gap-y-1{row-gap:calc(var(--spacing) * 1)}.gap-y-2{row-gap:calc(var(--spacing) * 2)}.gap-y-3{row-gap:calc(var(--spacing) * 3)}.gap-y-4{row-gap:calc(var(--spacing) * 4)}:where(.divide-y>:not(:last-child)){--tw-divide-y-reverse:0;border-bottom-style:var(--tw-border-style);border-top-style:var(--tw-border-style);border-top-width:calc(1px * var(--tw-divide-y-reverse));border-bottom-width:calc(1px * calc(1 - var(--tw-divide-y-reverse)))}:where(.divide-neutral-200>:not(:last-child)){border-color:var(--color-neutral-200)}.self-center{align-self:center}.truncate{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.rounded{border-radius:.25rem}.rounded-full{border-radius:3.40282e38px}.rounded-lg{border-radius:var(--radius-lg)}.rounded-md{border-radius:var(--radius-md)}.rounded-sm{border-radius:var(--radius-sm)}.rounded-xl{border-radius:var(--radius-xl)}.rounded-t{border-top-left-radius:.25rem;border-top-right-radius:.25rem}.rounded-t-lg{border-top-left-radius:var(--radius-lg);border-top-right-radius:var(--radius-lg)}.rounded-b{border-bottom-right-radius:.25rem;border-bottom-left-radius:.25rem}.rounded-b-md{border-bottom-right-radius:var(--radius-md);border-bottom-left-radius:var(--radius-md)}.border{border-style:var(--tw-border-style);border-width:1px}.border-2{border-style:var(--tw-border-style);border-width:2px}.border-\[0\.5px\]{border-style:var(--tw-border-style);border-width:.5px}.border-t{border-top-style:var(--tw-border-style);border-top-width:1px}.border-r{border-right-style:var(--tw-border-style);border-right-width:1px}.border-b{border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-b-2{border-bottom-style:var(--tw-border-style);border-bottom-width:2px}.border-dashed{--tw-border-style:dashed;border-style:dashed}.border-none\!{--tw-border-style:none!important;border-style:none!important}.border-blue-500{border-color:var(--color-blue-500)}.border-blue-500\!{border-color:var(--color-blue-500)!important}.border-green-500{border-color:var(--color-green-500)}.border-neutral-200{border-color:var(--color-neutral-200)}.border-neutral-300{border-color:var(--color-neutral-300)}.border-neutral-400{border-color:var(--color-neutral-400)}.border-red-200{border-color:var(--color-red-200)}.border-red-500{border-color:var(--color-red-500)}.border-transparent{border-color:#0000}.bg-amber-100{background-color:var(--color-amber-100)}.bg-black\/80{background-color:#000c}@supports (color:color-mix(in lab,red,red)){.bg-black\/80{background-color:color-mix(in oklab,var(--color-black) 80%,transparent)}}.bg-blue-100{background-color:var(--color-blue-100)}.bg-blue-200{background-color:var(--color-blue-200)}.bg-blue-500{background-color:var(--color-blue-500)}.bg-blue-500\!{background-color:var(--color-blue-500)!important}.bg-cyan-100{background-color:var(--color-cyan-100)}.bg-green-100{background-color:var(--color-green-100)}.bg-indigo-200{background-color:var(--color-indigo-200)}.bg-neutral-50{background-color:var(--color-neutral-50)}.bg-neutral-50\/50{background-color:#fafafa80}@supports (color:color-mix(in lab,red,red)){.bg-neutral-50\/50{background-color:color-mix(in oklab,var(--color-neutral-50) 50%,transparent)}}.bg-neutral-50\/60{background-color:#fafafa99}@supports (color:color-mix(in lab,red,red)){.bg-neutral-50\/60{background-color:color-mix(in oklab,var(--color-neutral-50) 60%,transparent)}}.bg-neutral-100{background-color:var(--color-neutral-100)}.bg-neutral-200{background-color:var(--color-neutral-200)}.bg-neutral-200\/50{background-color:#e5e5e580}@supports (color:color-mix(in lab,red,red)){.bg-neutral-200\/50{background-color:color-mix(in oklab,var(--color-neutral-200) 50%,transparent)}}.bg-neutral-200\/60{background-color:#e5e5e599}@supports (color:color-mix(in lab,red,red)){.bg-neutral-200\/60{background-color:color-mix(in oklab,var(--color-neutral-200) 60%,transparent)}}.bg-neutral-300{background-color:var(--color-neutral-300)}.bg-neutral-700{background-color:var(--color-neutral-700)}.bg-orange-100{background-color:var(--color-orange-100)}.bg-pink-100{background-color:var(--color-pink-100)}.bg-purple-100{background-color:var(--color-purple-100)}.bg-red-50{background-color:var(--color-red-50)}.bg-red-100{background-color:var(--color-red-100)}.bg-red-500\!{background-color:var(--color-red-500)!important}.bg-transparent{background-color:#0000}.bg-violet-200{background-color:var(--color-violet-200)}.bg-white{background-color:var(--color-white)}.bg-yellow-100{background-color:var(--color-yellow-100)}.bg-\[linear-gradient\(to_left\,transparent_10\%\,var\(--header-bg\)_85\%\)\,linear-gradient\(to_bottom\,var\(--trans-blue\)_0\%\,var\(--trans-blue\)_20\%\,var\(--trans-pink\)_20\%\,var\(--trans-pink\)_40\%\,var\(--trans-white\)_40\%\,var\(--trans-white\)_60\%\,var\(--trans-pink\)_60\%\,var\(--trans-pink\)_80\%\,var\(--trans-blue\)_80\%\,var\(--trans-blue\)_100\%\)\]{background-image:linear-gradient(to left,transparent 10%,var(--header-bg) 85%),linear-gradient(to bottom,var(--trans-blue) 0%,var(--trans-blue) 20%,var(--trans-pink) 20%,var(--trans-pink) 40%,var(--trans-white) 40%,var(--trans-white) 60%,var(--trans-pink) 60%,var(--trans-pink) 80%,var(--trans-blue) 80%,var(--trans-blue) 100%)}.bg-size-\[95\%\]{background-size:95%}.bg-right{background-position:100%}.bg-no-repeat{background-repeat:no-repeat}.object-contain{object-fit:contain}.p-1{padding:calc(var(--spacing) * 1)}.p-1\.5{padding:calc(var(--spacing) * 1.5)}.p-1\.25{padding:calc(var(--spacing) * 1.25)}.p-2{padding:calc(var(--spacing) * 2)}.p-2\.5{padding:calc(var(--spacing) * 2.5)}.p-3{padding:calc(var(--spacing) * 3)}.p-4{padding:calc(var(--spacing) * 4)}.p-8{padding:calc(var(--spacing) * 8)}.px-0\.5{padding-inline:calc(var(--spacing) * .5)}.px-1{padding-inline:calc(var(--spacing) * 1)}.px-1\.5{padding-inline:calc(var(--spacing) * 1.5)}.px-2{padding-inline:calc(var(--spacing) * 2)}.px-2\.5{padding-inline:calc(var(--spacing) * 2.5)}.px-3{padding-inline:calc(var(--spacing) * 3)}.px-4{padding-inline:calc(var(--spacing) * 4)}.py-0\.5{padding-block:calc(var(--spacing) * .5)}.py-1{padding-block:calc(var(--spacing) * 1)}.py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.py-2{padding-block:calc(var(--spacing) * 2)}.py-2\.5{padding-block:calc(var(--spacing) * 2.5)}.py-3{padding-block:calc(var(--spacing) * 3)}.py-4{padding-block:calc(var(--spacing) * 4)}.py-8{padding-block:calc(var(--spacing) * 8)}.py-12{padding-block:calc(var(--spacing) * 12)}.pt-3{padding-top:calc(var(--spacing) * 3)}.pt-18{padding-top:calc(var(--spacing) * 18)}.pt-\[20vh\]{padding-top:20vh}.pr-16{padding-right:calc(var(--spacing) * 16)}.pb-2{padding-bottom:calc(var(--spacing) * 2)}.pb-3{padding-bottom:calc(var(--spacing) * 3)}.pb-6{padding-bottom:calc(var(--spacing) * 6)}.pb-12{padding-bottom:calc(var(--spacing) * 12)}.pb-20{padding-bottom:calc(var(--spacing) * 20)}.pl-3{padding-left:calc(var(--spacing) * 3)}.pl-\[2ch\]{padding-left:2ch}.text-center{text-align:center}.text-left{text-align:left}.text-right{text-align:right}.font-mono{font-family:var(--font-mono)}.font-sans{font-family:var(--font-sans)}.text-3xl{font-size:var(--text-3xl);line-height:var(--tw-leading,var(--text-3xl--line-height))}.text-4xl{font-size:var(--text-4xl);line-height:var(--tw-leading,var(--text-4xl--line-height))}.text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.text-lg{font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.text-xl{font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-xs{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.text-\[10px\]{font-size:10px}.font-medium{--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-normal{--tw-font-weight:var(--font-weight-normal);font-weight:var(--font-weight-normal)}.font-semibold{--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.text-pretty{text-wrap:pretty}.wrap-anywhere{overflow-wrap:anywhere}.wrap-break-word{overflow-wrap:break-word}.break-all{word-break:break-all}.whitespace-nowrap{white-space:nowrap}.whitespace-pre-wrap{white-space:pre-wrap}.text-\[\#76c4e5\]{color:#76c4e5}.text-\[\#0085ff\]{color:#0085ff}.text-amber-500{color:var(--color-amber-500)}.text-amber-800{color:var(--color-amber-800)}.text-black{color:var(--color-black)}.text-blue-500{color:var(--color-blue-500)}.text-blue-500\!{color:var(--color-blue-500)!important}.text-blue-700{color:var(--color-blue-700)}.text-blue-800{color:var(--color-blue-800)}.text-cyan-800{color:var(--color-cyan-800)}.text-green-500{color:var(--color-green-500)}.text-green-600{color:var(--color-green-600)}.text-green-700{color:var(--color-green-700)}.text-green-800{color:var(--color-green-800)}.text-indigo-500{color:var(--color-indigo-500)}.text-indigo-700{color:var(--color-indigo-700)}.text-neutral-400{color:var(--color-neutral-400)}.text-neutral-500{color:var(--color-neutral-500)}.text-neutral-600{color:var(--color-neutral-600)}.text-neutral-700{color:var(--color-neutral-700)}.text-neutral-800{color:var(--color-neutral-800)}.text-neutral-800\/70{color:#262626b3}@supports (color:color-mix(in lab,red,red)){.text-neutral-800\/70{color:color-mix(in oklab,var(--color-neutral-800) 70%,transparent)}}.text-neutral-900{color:var(--color-neutral-900)}.text-orange-700{color:var(--color-orange-700)}.text-orange-800{color:var(--color-orange-800)}.text-pink-700{color:var(--color-pink-700)}.text-pink-800{color:var(--color-pink-800)}.text-purple-700{color:var(--color-purple-700)}.text-purple-800{color:var(--color-purple-800)}.text-red-500{color:var(--color-red-500)}.text-red-700{color:var(--color-red-700)}.text-red-800{color:var(--color-red-800)}.text-violet-500{color:var(--color-violet-500)}.text-violet-700{color:var(--color-violet-700)}.text-white{color:var(--color-white)}.text-white\!{color:var(--color-white)!important}.text-yellow-800{color:var(--color-yellow-800)}.uppercase{text-transform:uppercase}.tabular-nums{--tw-numeric-spacing:tabular-nums;font-variant-numeric:var(--tw-ordinal,) var(--tw-slashed-zero,) var(--tw-numeric-figure,) var(--tw-numeric-spacing,) var(--tw-numeric-fraction,)}.line-through{text-decoration-line:line-through}.underline{text-decoration-line:underline}.decoration-neutral-400{-webkit-text-decoration-color:var(--color-neutral-400);text-decoration-color:var(--color-neutral-400)}.accent-blue-500{accent-color:var(--color-blue-500)}.opacity-0{opacity:0}.opacity-40{opacity:.4}.opacity-50{opacity:.5}.opacity-70{opacity:.7}.shadow-md{--tw-shadow:0 4px 6px -1px var(--tw-shadow-color,#0000001a), 0 2px 4px -2px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.shadow-xs{--tw-shadow:0 1px 2px 0 var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow),var(--tw-inset-ring-shadow),var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow)}.outline-1{outline-style:var(--tw-outline-style);outline-width:1px}.outline-neutral-200{outline-color:var(--color-neutral-200)}.filter{filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.transition-all{transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors{transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity{transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform{transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-150{--tw-duration:.15s;transition-duration:.15s}.duration-200{--tw-duration:.2s;transition-duration:.2s}.ease-out{--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.select-none{-webkit-user-select:none;user-select:none}.\[--header-bg\:\#fafafa\]{--header-bg:#fafafa}.\[--trans-blue\:\#5BCEFA90\]{--trans-blue:#5bcefa90}.\[--trans-pink\:\#F5A9B890\]{--trans-pink:#f5a9b890}.\[--trans-white\:\#FFFFFF90\]{--trans-white:#ffffff90}.\[overflow-anchor\:auto\]{overflow-anchor:auto}.\[overflow-anchor\:none\]{overflow-anchor:none}.lucide--arrow-down-wide-narrow{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m3 16l4 4l4-4m-4 4V4m4 0h10M11 8h7m-7 4h4'/%3E%3C/svg%3E")}.lucide--arrow-left{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m12 19l-7-7l7-7m7 7H5'/%3E%3C/svg%3E")}.lucide--arrow-right{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 12h14m-7-7l7 7l-7 7'/%3E%3C/svg%3E")}.lucide--arrow-up-narrow-wide{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m3 8l4-4l4 4M7 4v16m4-8h4m-4 4h7m-7 4h10'/%3E%3C/svg%3E")}.lucide--at-sign{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8'/%3E%3C/g%3E%3C/svg%3E")}.lucide--bell{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M10.268 21a2 2 0 0 0 3.464 0m-10.47-5.674A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326'/%3E%3C/svg%3E")}.lucide--book-open{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 7v14m-9-3a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4a4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3a3 3 0 0 0-3-3z'/%3E%3C/svg%3E")}.lucide--book-user{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M15 13a3 3 0 1 0-6 0'/%3E%3Cpath d='M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20'/%3E%3Ccircle cx='12' cy='8' r='2'/%3E%3C/g%3E%3C/svg%3E")}.lucide--box{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z'/%3E%3Cpath d='m3.3 7l8.7 5l8.7-5M12 22V12'/%3E%3C/g%3E%3C/svg%3E")}.lucide--check{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M20 6L9 17l-5-5'/%3E%3C/svg%3E")}.lucide--check-circle{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M21.801 10A10 10 0 1 1 17 3.335'/%3E%3Cpath d='m9 11l3 3L22 4'/%3E%3C/g%3E%3C/svg%3E")}.lucide--chevron-down{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 9l6 6l6-6'/%3E%3C/svg%3E")}.lucide--chevron-right{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m9 18l6-6l-6-6'/%3E%3C/svg%3E")}.lucide--circle-alert{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 8v4m0 4h.01'/%3E%3C/g%3E%3C/svg%3E")}.lucide--circle-check{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m9 12l2 2l4-4'/%3E%3C/g%3E%3C/svg%3E")}.lucide--circle-help{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3m.08 4h.01'/%3E%3C/g%3E%3C/svg%3E")}.lucide--circle-user-round{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M18 20a6 6 0 0 0-12 0'/%3E%3Ccircle cx='12' cy='10' r='4'/%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3C/g%3E%3C/svg%3E")}.lucide--clock{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 6v6l4 2'/%3E%3C/g%3E%3C/svg%3E")}.lucide--clock-fading{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 2a10 10 0 0 1 7.38 16.75M12 6v6l4 2M2.5 8.875a10 10 0 0 0-.5 3M2.83 16a10 10 0 0 0 2.43 3.4M4.636 5.235a10 10 0 0 1 .891-.857M8.644 21.42a10 10 0 0 0 7.631-.38'/%3E%3C/svg%3E")}.lucide--copy{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Crect width='14' height='14' x='8' y='8' rx='2' ry='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/g%3E%3C/svg%3E")}.lucide--download{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M12 15V3m9 12v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpath d='m7 10l5 5l5-5'/%3E%3C/g%3E%3C/svg%3E")}.lucide--ellipsis{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='1'/%3E%3Ccircle cx='19' cy='12' r='1'/%3E%3Ccircle cx='5' cy='12' r='1'/%3E%3C/g%3E%3C/svg%3E")}.lucide--external-link{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M15 3h6v6m-11 5L21 3m-3 10v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3C/svg%3E")}.lucide--file-archive{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5'/%3E%3Cpath d='M14 2v5a1 1 0 0 0 1 1h5M8 12v-1m0 7v-2m0-9V6'/%3E%3Ccircle cx='8' cy='20' r='2'/%3E%3C/g%3E%3C/svg%3E")}.lucide--file-json{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z'/%3E%3Cpath d='M14 2v4a2 2 0 0 0 2 2h4m-10 4a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1a1 1 0 0 1 1 1v1a1 1 0 0 0 1 1m4 0a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1a1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1'/%3E%3C/g%3E%3C/svg%3E")}.lucide--filter{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M22 3H2l8 9.46V19l4 2v-8.54z'/%3E%3C/svg%3E")}.lucide--folder-archive{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Ccircle cx='15' cy='19' r='2'/%3E%3Cpath d='M20.9 19.8A2 2 0 0 0 22 18V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h5.1m5.9-9v-1m0 7v-2'/%3E%3C/g%3E%3C/svg%3E")}.lucide--folder-open{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m6 14l1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2'/%3E%3C/svg%3E")}.lucide--folder-search{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1M21 21l-1.9-1.9'/%3E%3Ccircle cx='17' cy='17' r='3'/%3E%3C/g%3E%3C/svg%3E")}.lucide--globe{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 2a14.5 14.5 0 0 0 0 20a14.5 14.5 0 0 0 0-20M2 12h20'/%3E%3C/g%3E%3C/svg%3E")}.lucide--hard-drive{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M10 16h.01m-7.798-4.423a2 2 0 0 0-.212.896V18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5.527a2 2 0 0 0-.212-.896L18.55 5.11A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11zm19.734.436H2.054M6 16h.01'/%3E%3C/svg%3E")}.lucide--hash{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 9h16M4 15h16M10 3L8 21m8-18l-2 18'/%3E%3C/svg%3E")}.lucide--id-card{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M16 10h2m-2 4h2M6.17 15a3 3 0 0 1 5.66 0'/%3E%3Ccircle cx='9' cy='11' r='2'/%3E%3Crect width='20' height='14' x='2' y='5' rx='2'/%3E%3C/g%3E%3C/svg%3E")}.lucide--image{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Crect width='18' height='18' x='3' y='3' rx='2' ry='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='m21 15l-3.086-3.086a2 2 0 0 0-2.828 0L6 21'/%3E%3C/g%3E%3C/svg%3E")}.lucide--key-round{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z'/%3E%3Ccircle cx='16.5' cy='7.5' r='.5' fill='black'/%3E%3C/g%3E%3C/svg%3E")}.lucide--link{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71'/%3E%3C/g%3E%3C/svg%3E")}.lucide--list-checks{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M13 5h8m-8 7h8m-8 7h8M3 17l2 2l4-4M3 7l2 2l4-4'/%3E%3C/svg%3E")}.lucide--loader-circle{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 12a9 9 0 1 1-6.219-8.56'/%3E%3C/svg%3E")}.lucide--maximize-2{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M15 3h6v6m0-6l-7 7M3 21l7-7m-1 7H3v-6'/%3E%3C/svg%3E")}.lucide--menu{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 5h16M4 12h16M4 19h16'/%3E%3C/svg%3E")}.lucide--minimize-2{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m14 10l7-7m-1 7h-6V4M3 21l7-7m-6 0h6v6'/%3E%3C/svg%3E")}.lucide--minus{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 12h14'/%3E%3C/svg%3E")}.lucide--pencil{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497zM15 5l4 4'/%3E%3C/svg%3E")}.lucide--plus{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M5 12h14m-7-7v14'/%3E%3C/svg%3E")}.lucide--radio-tower{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M4.9 16.1C1 12.2 1 5.8 4.9 1.9m2.9 2.8a6.14 6.14 0 0 0-.8 7.5'/%3E%3Ccircle cx='12' cy='9' r='2'/%3E%3Cpath d='M16.2 4.8c2 2 2.26 5.11.8 7.47M19.1 1.9a9.96 9.96 0 0 1 0 14.1m-9.6 2h5M8 22l4-11l4 11'/%3E%3C/g%3E%3C/svg%3E")}.lucide--recycle{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M7 19H4.815a1.83 1.83 0 0 1-1.57-.881a1.79 1.79 0 0 1-.004-1.784L7.196 9.5M11 19h8.203a1.83 1.83 0 0 0 1.556-.89a1.78 1.78 0 0 0 0-1.775l-1.226-2.12'/%3E%3Cpath d='m14 16l-3 3l3 3m-5.707-8.404L7.196 9.5L3.1 10.598m6.244-4.787l1.093-1.892A1.83 1.83 0 0 1 11.985 3a1.78 1.78 0 0 1 1.546.888l3.943 6.843'/%3E%3Cpath d='m13.378 9.633l4.096 1.098l1.097-4.096'/%3E%3C/g%3E%3C/svg%3E")}.lucide--rss{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M4 11a9 9 0 0 1 9 9M4 4a16 16 0 0 1 16 16'/%3E%3Ccircle cx='5' cy='19' r='1'/%3E%3C/g%3E%3C/svg%3E")}.lucide--search{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='m21 21l-4.34-4.34'/%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3C/g%3E%3C/svg%3E")}.lucide--search-x{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='m13.5 8.5l-5 5m0-5l5 5'/%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21l-4.3-4.3'/%3E%3C/g%3E%3C/svg%3E")}.lucide--settings{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M9.671 4.136a2.34 2.34 0 0 1 4.659 0a2.34 2.34 0 0 0 3.319 1.915a2.34 2.34 0 0 1 2.33 4.033a2.34 2.34 0 0 0 0 3.831a2.34 2.34 0 0 1-2.33 4.033a2.34 2.34 0 0 0-3.319 1.915a2.34 2.34 0 0 1-4.659 0a2.34 2.34 0 0 0-3.32-1.915a2.34 2.34 0 0 1-2.33-4.033a2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/g%3E%3C/svg%3E")}.lucide--shield-ban{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1zM4.243 5.21l14.39 12.472'/%3E%3C/svg%3E")}.lucide--shield-check{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z'/%3E%3Cpath d='m9 12l2 2l4-4'/%3E%3C/g%3E%3C/svg%3E")}.lucide--skull{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='m12.5 17l-.5-1l-.5 1z'/%3E%3Cpath d='M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25a8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z'/%3E%3Ccircle cx='15' cy='12' r='1'/%3E%3Ccircle cx='9' cy='12' r='1'/%3E%3C/g%3E%3C/svg%3E")}.lucide--sparkles{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594zM20 2v4m2-2h-4'/%3E%3Ccircle cx='4' cy='20' r='2'/%3E%3C/g%3E%3C/svg%3E")}.lucide--square-check-big{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344'/%3E%3Cpath d='m9 11l3 3L22 4'/%3E%3C/g%3E%3C/svg%3E")}.lucide--square-pen{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7'/%3E%3Cpath d='M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z'/%3E%3C/g%3E%3C/svg%3E")}.lucide--tag{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z'/%3E%3Ccircle cx='7.5' cy='7.5' r='.5' fill='black'/%3E%3C/g%3E%3C/svg%3E")}.lucide--tags{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M13.172 2a2 2 0 0 1 1.414.586l6.71 6.71a2.4 2.4 0 0 1 0 3.408l-4.592 4.592a2.4 2.4 0 0 1-3.408 0l-6.71-6.71A2 2 0 0 1 6 9.172V3a1 1 0 0 1 1-1zM2 7v6.172a2 2 0 0 0 .586 1.414l6.71 6.71a2.4 2.4 0 0 0 3.191.193'/%3E%3Ccircle cx='10.5' cy='6.5' r='.5' fill='black'/%3E%3C/g%3E%3C/svg%3E")}.lucide--trash-2{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M10 11v6m4-6v6m5-11v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'/%3E%3C/svg%3E")}.lucide--unplug{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m19 5l3-3M2 22l3-3m1.3 1.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6l-2.3 2.3a2.4 2.4 0 0 0 0 3.4Zm1.2-6.8L10 11m.5 5.5L13 14m-1-8l6 6l2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z'/%3E%3C/svg%3E")}.lucide--upload{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M12 3v12m5-7l-5-5l-5 5m14 7v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3C/svg%3E")}.lucide--user-round{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Ccircle cx='12' cy='8' r='5'/%3E%3Cpath d='M20 21a8 8 0 0 0-16 0'/%3E%3C/g%3E%3C/svg%3E")}.lucide--user-round-x{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M2 21a8 8 0 0 1 11.873-7'/%3E%3Ccircle cx='10' cy='8' r='5'/%3E%3Cpath d='m17 17l5 5m0-5l-5 5'/%3E%3C/g%3E%3C/svg%3E")}.lucide--wrench{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z'/%3E%3C/svg%3E")}.lucide--x{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cpath fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M18 6L6 18M6 6l12 12'/%3E%3C/svg%3E")}.lucide--x-circle{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' width='24' height='24'%3E%3Cg fill='none' stroke='black' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='m15 9l-6 6m0-6l6 6'/%3E%3C/g%3E%3C/svg%3E")}.not-hover\:text-neutral-500:not(:hover){color:var(--color-neutral-500)}@media not all and (hover:hover){.not-hover\:text-neutral-500{color:var(--color-neutral-500)}}.not-hover\:text-neutral-600:not(:hover){color:var(--color-neutral-600)}@media not all and (hover:hover){.not-hover\:text-neutral-600{color:var(--color-neutral-600)}}@media(hover:hover){.group-hover\:flex:is(:where(.group):hover *){display:flex}.group-hover\:border-neutral-500:is(:where(.group):hover *){border-color:var(--color-neutral-500)}.group-hover\:bg-blue-600:is(:where(.group):hover *){background-color:var(--color-blue-600)}.group-hover\:bg-neutral-100:is(:where(.group):hover *){background-color:var(--color-neutral-100)}.group-hover\:text-blue-500:is(:where(.group):hover *){color:var(--color-blue-500)}.group-hover\:text-blue-600:is(:where(.group):hover *){color:var(--color-blue-600)}.group-hover\:text-emerald-500:is(:where(.group):hover *){color:var(--color-emerald-500)}.group-hover\:text-neutral-700:is(:where(.group):hover *){color:var(--color-neutral-700)}.group-hover\:text-red-500:is(:where(.group):hover *){color:var(--color-red-500)}.group-hover\:opacity-100:is(:where(.group):hover *){opacity:1}.group-hover\/fold\:bg-neutral-600:is(:where(.group\/fold):hover *){background-color:var(--color-neutral-600)}.group-hover\/key\:opacity-100:is(:where(.group\/key):hover *){opacity:1}.group-hover\/tooltip\:inline:is(:where(.group\/tooltip):hover *){display:inline}}.group-active\:bg-blue-400:is(:where(.group):active *){background-color:var(--color-blue-400)}.first-letter\:capitalize:first-letter{text-transform:capitalize}.placeholder\:text-sm::placeholder{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}.placeholder\:text-xs::placeholder{font-size:var(--text-xs);line-height:var(--tw-leading,var(--text-xs--line-height))}.after\:absolute:after{content:var(--tw-content);position:absolute}.after\:bottom-0:after{content:var(--tw-content);bottom:calc(var(--spacing) * 0)}.after\:left-0:after{content:var(--tw-content);left:calc(var(--spacing) * 0)}.after\:h-px:after{content:var(--tw-content);height:1px}.after\:w-0:after{content:var(--tw-content);width:calc(var(--spacing) * 0)}.after\:bg-current:after{content:var(--tw-content);background-color:currentColor}.after\:text-\[\#0085ff\]:after{content:var(--tw-content);color:#0085ff}.after\:text-\[\#FF6363\]:after{content:var(--tw-content);color:#ff6363}.after\:text-black:after{content:var(--tw-content);color:var(--color-black)}.after\:transition-\[width\]:after{content:var(--tw-content);transition-property:width;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.after\:duration-300:after{content:var(--tw-content);--tw-duration:.3s;transition-duration:.3s}.after\:ease-out:after{content:var(--tw-content);--tw-ease:var(--ease-out);transition-timing-function:var(--ease-out)}.last\:border-r-0:last-child{border-right-style:var(--tw-border-style);border-right-width:0}.empty\:hidden:empty{display:none}@media(hover:hover){.hover\:border-blue-500:hover{border-color:var(--color-blue-500)}.hover\:border-emerald-500:hover{border-color:var(--color-emerald-500)}.hover\:border-neutral-300:hover{border-color:var(--color-neutral-300)}.hover\:border-neutral-400:hover{border-color:var(--color-neutral-400)}.hover\:border-red-500:hover{border-color:var(--color-red-500)}.hover\:bg-blue-300\/80:hover{background-color:#90c5ffcc}@supports (color:color-mix(in lab,red,red)){.hover\:bg-blue-300\/80:hover{background-color:color-mix(in oklab,var(--color-blue-300) 80%,transparent)}}.hover\:bg-blue-600\!:hover{background-color:var(--color-blue-600)!important}.hover\:bg-neutral-50:hover{background-color:var(--color-neutral-50)}.hover\:bg-neutral-50\/40:hover{background-color:#fafafa66}@supports (color:color-mix(in lab,red,red)){.hover\:bg-neutral-50\/40:hover{background-color:color-mix(in oklab,var(--color-neutral-50) 40%,transparent)}}.hover\:bg-neutral-50\/50:hover{background-color:#fafafa80}@supports (color:color-mix(in lab,red,red)){.hover\:bg-neutral-50\/50:hover{background-color:color-mix(in oklab,var(--color-neutral-50) 50%,transparent)}}.hover\:bg-neutral-100:hover{background-color:var(--color-neutral-100)}.hover\:bg-neutral-200:hover{background-color:var(--color-neutral-200)}.hover\:bg-neutral-200\/30:hover{background-color:#e5e5e54d}@supports (color:color-mix(in lab,red,red)){.hover\:bg-neutral-200\/30:hover{background-color:color-mix(in oklab,var(--color-neutral-200) 30%,transparent)}}.hover\:bg-neutral-200\/50:hover{background-color:#e5e5e580}@supports (color:color-mix(in lab,red,red)){.hover\:bg-neutral-200\/50:hover{background-color:color-mix(in oklab,var(--color-neutral-200) 50%,transparent)}}.hover\:bg-neutral-200\/70:hover{background-color:#e5e5e5b3}@supports (color:color-mix(in lab,red,red)){.hover\:bg-neutral-200\/70:hover{background-color:color-mix(in oklab,var(--color-neutral-200) 70%,transparent)}}.hover\:bg-neutral-300:hover{background-color:var(--color-neutral-300)}.hover\:bg-red-400\!:hover{background-color:var(--color-red-400)!important}.hover\:bg-red-600\!:hover{background-color:var(--color-red-600)!important}.hover\:text-blue-500:hover{color:var(--color-blue-500)}.hover\:text-blue-600:hover{color:var(--color-blue-600)}.hover\:text-indigo-700:hover{color:var(--color-indigo-700)}.hover\:text-neutral-600:hover{color:var(--color-neutral-600)}.hover\:text-neutral-700:hover{color:var(--color-neutral-700)}.hover\:text-neutral-900:hover{color:var(--color-neutral-900)}.hover\:text-violet-700:hover{color:var(--color-violet-700)}.hover\:underline:hover{text-decoration-line:underline}.hover\:decoration-blue-500:hover{-webkit-text-decoration-color:var(--color-blue-500);text-decoration-color:var(--color-blue-500)}.hover\:opacity-70:hover{opacity:.7}.hover\:after\:w-full:hover:after{content:var(--tw-content);width:100%}}.focus\:outline-1:focus{outline-style:var(--tw-outline-style);outline-width:1px}.focus\:outline-neutral-400:focus{outline-color:var(--color-neutral-400)}.focus\:outline-red-500:focus{outline-color:var(--color-red-500)}.focus\:outline-none:focus{--tw-outline-style:none;outline-style:none}.active\:bg-blue-300:active{background-color:var(--color-blue-300)}.active\:bg-blue-700\!:active{background-color:var(--color-blue-700)!important}.active\:bg-neutral-200:active{background-color:var(--color-neutral-200)}.active\:bg-neutral-300:active{background-color:var(--color-neutral-300)}.active\:bg-neutral-300\/70:active{background-color:#d4d4d4b3}@supports (color:color-mix(in lab,red,red)){.active\:bg-neutral-300\/70:active{background-color:color-mix(in oklab,var(--color-neutral-300) 70%,transparent)}}.active\:bg-neutral-400:active{background-color:var(--color-neutral-400)}.active\:bg-red-400\!:active{background-color:var(--color-red-400)!important}.active\:bg-red-700\!:active{background-color:var(--color-red-700)!important}.active\:text-indigo-800:active{color:var(--color-indigo-800)}.active\:text-violet-800:active{color:var(--color-violet-800)}.active\:underline:active{text-decoration-line:underline}@media(min-width:40rem){.sm\:size-5{width:calc(var(--spacing) * 5);height:calc(var(--spacing) * 5)}.sm\:size-7{width:calc(var(--spacing) * 7);height:calc(var(--spacing) * 7)}.sm\:max-h-112{max-height:calc(var(--spacing) * 112)}.sm\:min-h-7{min-height:calc(var(--spacing) * 7)}.sm\:w-4{width:calc(var(--spacing) * 4)}.sm\:w-max{width:max-content}.sm\:max-w-\[50\%\]{max-width:50%}.sm\:max-w-screen{max-width:100vw}.sm\:flex-row{flex-direction:row}.sm\:items-center{align-items:center}.sm\:gap-0\.5{gap:calc(var(--spacing) * .5)}.sm\:gap-2{gap:calc(var(--spacing) * 2)}.sm\:gap-4{gap:calc(var(--spacing) * 4)}.sm\:gap-x-2{column-gap:calc(var(--spacing) * 2)}.sm\:gap-x-3{column-gap:calc(var(--spacing) * 3)}.sm\:gap-x-4{column-gap:calc(var(--spacing) * 4)}.sm\:px-3{padding-inline:calc(var(--spacing) * 3)}.sm\:px-4{padding-inline:calc(var(--spacing) * 4)}.sm\:py-0\.5{padding-block:calc(var(--spacing) * .5)}.sm\:py-1\.5{padding-block:calc(var(--spacing) * 1.5)}.sm\:text-base{font-size:var(--text-base);line-height:var(--tw-leading,var(--text-base--line-height))}.sm\:text-sm{font-size:var(--text-sm);line-height:var(--tw-leading,var(--text-sm--line-height))}}@media(min-width:48rem){.md\:max-h-100{max-height:calc(var(--spacing) * 100)}.md\:w-2xl{width:var(--container-2xl)}.md\:max-w-3xl{max-width:var(--container-3xl)}}@media(min-width:64rem){.lg\:w-52{width:calc(var(--spacing) * 52)}.lg\:max-w-lg{max-width:var(--container-lg)}}.dark\:block:where(.dark,.dark *){display:block}.dark\:hidden:where(.dark,.dark *){display:none}:where(.dark\:divide-neutral-700:where(.dark,.dark *)>:not(:last-child)){border-color:var(--color-neutral-700)}.dark\:border-blue-400:where(.dark,.dark *){border-color:var(--color-blue-400)}.dark\:border-blue-400\!:where(.dark,.dark *){border-color:var(--color-blue-400)!important}.dark\:border-green-400:where(.dark,.dark *){border-color:var(--color-green-400)}.dark\:border-neutral-500:where(.dark,.dark *){border-color:var(--color-neutral-500)}.dark\:border-neutral-600:where(.dark,.dark *){border-color:var(--color-neutral-600)}.dark\:border-neutral-700:where(.dark,.dark *){border-color:var(--color-neutral-700)}.dark\:border-red-400:where(.dark,.dark *){border-color:var(--color-red-400)}.dark\:border-red-800:where(.dark,.dark *){border-color:var(--color-red-800)}.dark\:bg-amber-900\/30:where(.dark,.dark *){background-color:#7b33064d}@supports (color:color-mix(in lab,red,red)){.dark\:bg-amber-900\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-amber-900) 30%,transparent)}}.dark\:bg-blue-400:where(.dark,.dark *){background-color:var(--color-blue-400)}.dark\:bg-blue-500\/25:where(.dark,.dark *){background-color:#3080ff40}@supports (color:color-mix(in lab,red,red)){.dark\:bg-blue-500\/25:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-500) 25%,transparent)}}.dark\:bg-blue-600\!:where(.dark,.dark *){background-color:var(--color-blue-600)!important}.dark\:bg-blue-700\/30:where(.dark,.dark *){background-color:#1447e64d}@supports (color:color-mix(in lab,red,red)){.dark\:bg-blue-700\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-700) 30%,transparent)}}.dark\:bg-blue-900\/30:where(.dark,.dark *){background-color:#1c398e4d}@supports (color:color-mix(in lab,red,red)){.dark\:bg-blue-900\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-blue-900) 30%,transparent)}}.dark\:bg-cyan-900\/30:where(.dark,.dark *){background-color:#104e644d}@supports (color:color-mix(in lab,red,red)){.dark\:bg-cyan-900\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-cyan-900) 30%,transparent)}}.dark\:bg-dark-100:where(.dark,.dark *){background-color:var(--color-dark-100)}.dark\:bg-dark-200:where(.dark,.dark *){background-color:var(--color-dark-200)}.dark\:bg-dark-300:where(.dark,.dark *){background-color:var(--color-dark-300)}.dark\:bg-dark-500:where(.dark,.dark *){background-color:var(--color-dark-500)}.dark\:bg-green-900\/30:where(.dark,.dark *){background-color:#0d542b4d}@supports (color:color-mix(in lab,red,red)){.dark\:bg-green-900\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-green-900) 30%,transparent)}}.dark\:bg-indigo-500\/60:where(.dark,.dark *){background-color:#625fff99}@supports (color:color-mix(in lab,red,red)){.dark\:bg-indigo-500\/60:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-indigo-500) 60%,transparent)}}.dark\:bg-neutral-300:where(.dark,.dark *){background-color:var(--color-neutral-300)}.dark\:bg-neutral-600:where(.dark,.dark *){background-color:var(--color-neutral-600)}.dark\:bg-neutral-700:where(.dark,.dark *){background-color:var(--color-neutral-700)}.dark\:bg-neutral-800:where(.dark,.dark *){background-color:var(--color-neutral-800)}.dark\:bg-neutral-800\/30:where(.dark,.dark *){background-color:#2626264d}@supports (color:color-mix(in lab,red,red)){.dark\:bg-neutral-800\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-neutral-800) 30%,transparent)}}.dark\:bg-neutral-800\/50:where(.dark,.dark *){background-color:#26262680}@supports (color:color-mix(in lab,red,red)){.dark\:bg-neutral-800\/50:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-neutral-800) 50%,transparent)}}.dark\:bg-neutral-800\/60:where(.dark,.dark *){background-color:#26262699}@supports (color:color-mix(in lab,red,red)){.dark\:bg-neutral-800\/60:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-neutral-800) 60%,transparent)}}.dark\:bg-orange-900\/30:where(.dark,.dark *){background-color:#7e2a0c4d}@supports (color:color-mix(in lab,red,red)){.dark\:bg-orange-900\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-orange-900) 30%,transparent)}}.dark\:bg-pink-900\/30:where(.dark,.dark *){background-color:#8610434d}@supports (color:color-mix(in lab,red,red)){.dark\:bg-pink-900\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-pink-900) 30%,transparent)}}.dark\:bg-purple-900\/30:where(.dark,.dark *){background-color:#59168b4d}@supports (color:color-mix(in lab,red,red)){.dark\:bg-purple-900\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-purple-900) 30%,transparent)}}.dark\:bg-red-900\/20:where(.dark,.dark *){background-color:#82181a33}@supports (color:color-mix(in lab,red,red)){.dark\:bg-red-900\/20:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-red-900) 20%,transparent)}}.dark\:bg-red-900\/30:where(.dark,.dark *){background-color:#82181a4d}@supports (color:color-mix(in lab,red,red)){.dark\:bg-red-900\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-red-900) 30%,transparent)}}.dark\:bg-violet-500\/60:where(.dark,.dark *){background-color:#8d54ff99}@supports (color:color-mix(in lab,red,red)){.dark\:bg-violet-500\/60:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-violet-500) 60%,transparent)}}.dark\:bg-yellow-900\/30:where(.dark,.dark *){background-color:#733e0a4d}@supports (color:color-mix(in lab,red,red)){.dark\:bg-yellow-900\/30:where(.dark,.dark *){background-color:color-mix(in oklab,var(--color-yellow-900) 30%,transparent)}}.dark\:text-amber-300:where(.dark,.dark *){color:var(--color-amber-300)}.dark\:text-amber-400:where(.dark,.dark *){color:var(--color-amber-400)}.dark\:text-blue-300:where(.dark,.dark *){color:var(--color-blue-300)}.dark\:text-blue-400:where(.dark,.dark *){color:var(--color-blue-400)}.dark\:text-blue-400\!:where(.dark,.dark *){color:var(--color-blue-400)!important}.dark\:text-cyan-300:where(.dark,.dark *){color:var(--color-cyan-300)}.dark\:text-green-300:where(.dark,.dark *){color:var(--color-green-300)}.dark\:text-green-400:where(.dark,.dark *){color:var(--color-green-400)}.dark\:text-indigo-200:where(.dark,.dark *){color:var(--color-indigo-200)}.dark\:text-indigo-400:where(.dark,.dark *){color:var(--color-indigo-400)}.dark\:text-neutral-200:where(.dark,.dark *){color:var(--color-neutral-200)}.dark\:text-neutral-200\/70:where(.dark,.dark *){color:#e5e5e5b3}@supports (color:color-mix(in lab,red,red)){.dark\:text-neutral-200\/70:where(.dark,.dark *){color:color-mix(in oklab,var(--color-neutral-200) 70%,transparent)}}.dark\:text-neutral-300:where(.dark,.dark *){color:var(--color-neutral-300)}.dark\:text-neutral-300\/80:where(.dark,.dark *){color:#d4d4d4cc}@supports (color:color-mix(in lab,red,red)){.dark\:text-neutral-300\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-neutral-300) 80%,transparent)}}.dark\:text-neutral-400:where(.dark,.dark *){color:var(--color-neutral-400)}.dark\:text-neutral-500:where(.dark,.dark *){color:var(--color-neutral-500)}.dark\:text-neutral-600:where(.dark,.dark *){color:var(--color-neutral-600)}.dark\:text-neutral-900:where(.dark,.dark *){color:var(--color-neutral-900)}.dark\:text-orange-300:where(.dark,.dark *){color:var(--color-orange-300)}.dark\:text-pink-300:where(.dark,.dark *){color:var(--color-pink-300)}.dark\:text-purple-300:where(.dark,.dark *){color:var(--color-purple-300)}.dark\:text-red-300:where(.dark,.dark *){color:var(--color-red-300)}.dark\:text-red-400:where(.dark,.dark *){color:var(--color-red-400)}.dark\:text-violet-200:where(.dark,.dark *){color:var(--color-violet-200)}.dark\:text-violet-400:where(.dark,.dark *){color:var(--color-violet-400)}.dark\:text-white:where(.dark,.dark *){color:var(--color-white)}.dark\:text-yellow-300:where(.dark,.dark *){color:var(--color-yellow-300)}.dark\:decoration-neutral-500:where(.dark,.dark *){-webkit-text-decoration-color:var(--color-neutral-500);text-decoration-color:var(--color-neutral-500)}.dark\:shadow-dark-700:where(.dark,.dark *){--tw-shadow-color:oklch(22.21% 0 0)}@supports (color:color-mix(in lab,red,red)){.dark\:shadow-dark-700:where(.dark,.dark *){--tw-shadow-color:color-mix(in oklab, var(--color-dark-700) var(--tw-shadow-alpha), transparent)}}.dark\:outline-neutral-600:where(.dark,.dark *){outline-color:var(--color-neutral-600)}.dark\:\[--header-bg\:\#262626\]:where(.dark,.dark *){--header-bg:#262626}.dark\:\[--trans-blue\:\#5BCEFAa0\]:where(.dark,.dark *){--trans-blue:#5bcefaa0}.dark\:\[--trans-pink\:\#F5A9B8a0\]:where(.dark,.dark *){--trans-pink:#f5a9b8a0}.dark\:\[--trans-white\:\#FFFFFFa0\]:where(.dark,.dark *){--trans-white:#ffffffa0}.dark\:not-hover\:text-neutral-400:where(.dark,.dark *):not(:hover){color:var(--color-neutral-400)}@media not all and (hover:hover){.dark\:not-hover\:text-neutral-400:where(.dark,.dark *){color:var(--color-neutral-400)}}.not-hover\:dark\:text-neutral-300\/80:not(:hover):where(.dark,.dark *){color:#d4d4d4cc}@supports (color:color-mix(in lab,red,red)){.not-hover\:dark\:text-neutral-300\/80:not(:hover):where(.dark,.dark *){color:color-mix(in oklab,var(--color-neutral-300) 80%,transparent)}}@media not all and (hover:hover){.not-hover\:dark\:text-neutral-300\/80:where(.dark,.dark *){color:#d4d4d4cc}@supports (color:color-mix(in lab,red,red)){.not-hover\:dark\:text-neutral-300\/80:where(.dark,.dark *){color:color-mix(in oklab,var(--color-neutral-300) 80%,transparent)}}}.not-hover\:dark\:text-neutral-400:not(:hover):where(.dark,.dark *){color:var(--color-neutral-400)}@media not all and (hover:hover){.not-hover\:dark\:text-neutral-400:where(.dark,.dark *){color:var(--color-neutral-400)}}@media(hover:hover){.dark\:group-hover\:border-neutral-400:where(.dark,.dark *):is(:where(.group):hover *){border-color:var(--color-neutral-400)}.dark\:group-hover\:bg-neutral-800:where(.dark,.dark *):is(:where(.group):hover *){background-color:var(--color-neutral-800)}.dark\:group-hover\:text-blue-300:where(.dark,.dark *):is(:where(.group):hover *){color:var(--color-blue-300)}.dark\:group-hover\:text-blue-400:where(.dark,.dark *):is(:where(.group):hover *){color:var(--color-blue-400)}.dark\:group-hover\:text-emerald-400:where(.dark,.dark *):is(:where(.group):hover *){color:var(--color-emerald-400)}.dark\:group-hover\:text-neutral-200:where(.dark,.dark *):is(:where(.group):hover *){color:var(--color-neutral-200)}.dark\:group-hover\:text-red-400:where(.dark,.dark *):is(:where(.group):hover *){color:var(--color-red-400)}.dark\:group-hover\/fold\:bg-neutral-300:where(.dark,.dark *):is(:where(.group\/fold):hover *){background-color:var(--color-neutral-300)}}.dark\:after\:text-white:where(.dark,.dark *):after{content:var(--tw-content);color:var(--color-white)}@media(hover:hover){.dark\:hover\:border-blue-400:where(.dark,.dark *):hover{border-color:var(--color-blue-400)}.dark\:hover\:border-emerald-400:where(.dark,.dark *):hover{border-color:var(--color-emerald-400)}.dark\:hover\:border-neutral-500:where(.dark,.dark *):hover{border-color:var(--color-neutral-500)}.dark\:hover\:border-neutral-600:where(.dark,.dark *):hover{border-color:var(--color-neutral-600)}.dark\:hover\:border-red-400:where(.dark,.dark *):hover{border-color:var(--color-red-400)}.dark\:hover\:bg-blue-500\!:where(.dark,.dark *):hover{background-color:var(--color-blue-500)!important}.dark\:hover\:bg-blue-700\/50:where(.dark,.dark *):hover{background-color:#1447e680}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-blue-700\/50:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-blue-700) 50%,transparent)}}.dark\:hover\:bg-dark-100:where(.dark,.dark *):hover{background-color:var(--color-dark-100)}.dark\:hover\:bg-dark-200:where(.dark,.dark *):hover{background-color:var(--color-dark-200)}.dark\:hover\:bg-dark-300:where(.dark,.dark *):hover{background-color:var(--color-dark-300)}.dark\:hover\:bg-neutral-600:where(.dark,.dark *):hover{background-color:var(--color-neutral-600)}.dark\:hover\:bg-neutral-700:where(.dark,.dark *):hover{background-color:var(--color-neutral-700)}.dark\:hover\:bg-neutral-700\/50:where(.dark,.dark *):hover{background-color:#40404080}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-neutral-700\/50:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-neutral-700) 50%,transparent)}}.dark\:hover\:bg-neutral-700\/70:where(.dark,.dark *):hover{background-color:#404040b3}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-neutral-700\/70:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-neutral-700) 70%,transparent)}}.dark\:hover\:bg-neutral-800:where(.dark,.dark *):hover{background-color:var(--color-neutral-800)}.dark\:hover\:bg-neutral-800\/40:where(.dark,.dark *):hover{background-color:#26262666}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-neutral-800\/40:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-neutral-800) 40%,transparent)}}.dark\:hover\:bg-neutral-800\/50:where(.dark,.dark *):hover{background-color:#26262680}@supports (color:color-mix(in lab,red,red)){.dark\:hover\:bg-neutral-800\/50:where(.dark,.dark *):hover{background-color:color-mix(in oklab,var(--color-neutral-800) 50%,transparent)}}.dark\:hover\:text-blue-300:where(.dark,.dark *):hover{color:var(--color-blue-300)}.dark\:hover\:text-blue-400:where(.dark,.dark *):hover{color:var(--color-blue-400)}.dark\:hover\:text-indigo-300:where(.dark,.dark *):hover{color:var(--color-indigo-300)}.dark\:hover\:text-neutral-200:where(.dark,.dark *):hover{color:var(--color-neutral-200)}.dark\:hover\:text-neutral-300:where(.dark,.dark *):hover{color:var(--color-neutral-300)}.dark\:hover\:text-violet-300:where(.dark,.dark *):hover{color:var(--color-violet-300)}}.dark\:focus\:outline-neutral-400:where(.dark,.dark *):focus{outline-color:var(--color-neutral-400)}.dark\:focus\:outline-red-400:where(.dark,.dark *):focus{outline-color:var(--color-red-400)}.dark\:active\:bg-blue-400\!:where(.dark,.dark *):active{background-color:var(--color-blue-400)!important}.dark\:active\:bg-blue-700\/70:where(.dark,.dark *):active{background-color:#1447e6b3}@supports (color:color-mix(in lab,red,red)){.dark\:active\:bg-blue-700\/70:where(.dark,.dark *):active{background-color:color-mix(in oklab,var(--color-blue-700) 70%,transparent)}}.dark\:active\:bg-dark-100:where(.dark,.dark *):active{background-color:var(--color-dark-100)}.dark\:active\:bg-neutral-500:where(.dark,.dark *):active{background-color:var(--color-neutral-500)}.dark\:active\:bg-neutral-600:where(.dark,.dark *):active{background-color:var(--color-neutral-600)}.dark\:active\:bg-neutral-600\/70:where(.dark,.dark *):active{background-color:#525252b3}@supports (color:color-mix(in lab,red,red)){.dark\:active\:bg-neutral-600\/70:where(.dark,.dark *):active{background-color:color-mix(in oklab,var(--color-neutral-600) 70%,transparent)}}.dark\:active\:bg-neutral-700:where(.dark,.dark *):active{background-color:var(--color-neutral-700)}.dark\:active\:text-indigo-200:where(.dark,.dark *):active{color:var(--color-indigo-200)}.dark\:active\:text-violet-200:where(.dark,.dark *):active{color:var(--color-violet-200)}@starting-style{.starting\:scale-95{--tw-scale-x:95%;--tw-scale-y:95%;--tw-scale-z:95%;scale:var(--tw-scale-x) var(--tw-scale-y)}}@starting-style{.starting\:opacity-0{opacity:0}}}@font-face{font-family:Figtree;src:url(/fonts/Figtree.woff2)format("woff2");font-display:swap}html{scrollbar-gutter:stable both-edges}.tabler--binary-tree-filled{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M14 1a3 3 0 0 1 2.348 4.868l2 3.203Q18.665 9 19 9a3 3 0 1 1-2.347 1.132l-2-3.203a3 3 0 0 1-1.304 0l-2.001 3.203c.408.513.652 1.162.652 1.868s-.244 1.356-.653 1.868l2.002 3.203Q13.664 17 14 17a3 3 0 1 1-2.347 1.132L9.65 14.929a3 3 0 0 1-1.302 0l-2.002 3.203a3 3 0 1 1-1.696-1.06l2.002-3.204A3 3 0 0 1 9.65 9.07l2.002-3.202A3 3 0 0 1 14 1'/%3E%3C/svg%3E")}.i-tangled{--svg:url(data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22400%22%20height%3D%22400%22%20viewBox%3D%220%200%2025%2025%22%20fill%3D%22none%22%3E%3Cpath%20fill%3D%22currentColor%22%20style%3D%22stroke-width%3A.111183%22%20d%3D%22m16.349%2024.1-.065-.038-.202-.01-.202-.011-.276-.026-.275-.026v-.053l-.205-.04-.205-.04-.167-.081-.168-.08-.001-.042-.002-.041-.266-.144-.266-.144-.277-.203-.276-.203-.262-.252-.262-.252-.22-.285-.222-.285-.17-.284-.17-.285-.014-.014-.013-.015-.142.162-.142.161-.223.214-.223.215-.186.146-.186.146-.253.163-.252.163-.25.116-.248.115.005.032.005.033-.171.046-.172.046-.338.1-.338.102-.178.045-.178.045-.391.026-.392.026-.355-.035-.356-.035-.038-.03-.037-.03-.077.02-.077.02-.05-.051-.05-.05-.21-.047-.208-.046-.297-.103-.298-.104-.325-.163-.326-.163-.327-.228-.327-.228-.304-.288-.305-.289-.224-.29-.225-.289-.127-.213-.127-.214-.106-.213-.107-.214-.125-.338-.126-.337-.083-.392-.084-.391v-.694l.001-.694.064-.319.065-.319.108-.339.11-.34.157-.319.157-.319.07-.113.07-.114-.098-.068-.099-.067-.178-.102-.178-.101-.267-.196-.267-.195-.262-.252-.262-.252-.189-.235-.188-.235-.16-.247-.16-.246-.129-.266-.129-.266-.12-.338-.12-.338-.083-.391-.083-.391.002-.694.002-.694.1-.426.099-.426.132-.342.133-.341.167-.307.167-.306.218-.296.219-.295.252-.263.252-.262.231-.185.232-.185.231-.151.231-.151.321-.156.321-.155.177-.065.177-.065.178-.338.178-.337.213-.303.212-.302.314-.325.314-.326.257-.195.256-.196.304-.179.305-.179.316-.13.316-.132.21-.067.21-.067.397-.079.397-.08.587.004.587.003.444.092.445.093.303.11.302.11.33.165.33.165.24-.232.239-.231.16-.126.16-.126.16-.102.16-.102.142-.083.143-.082.23-.109.232-.109.267-.099.267-.098.32-.074.32-.073.356-.042.356-.042.427.024.427.024.355.07.356.072.285.093.284.092.286.131.285.131.238.145.238.145.26.195.259.196.29.297.291.296.152.195.152.194.135.215.136.215.154.32.155.32.094.268.094.268.07.331.07.332.01.008.011.009.445.217.445.217.31.216.309.216.31.293.31.294.187.234.187.235.167.258.166.257.153.326.153.326.09.267.09.267.082.391.083.392v.658l-.001.658-.064.316-.063.315-.09.29-.091.289-.123.281-.123.281-.146.253-.147.252-.19.259-.19.258-.256.269-.255.268-.287.223-.286.223-.32.188-.32.188-.044.035-.044.035.057.13.056.13.087.213.088.214.19.73.19.729.064.302.065.302-.001.676-.002.676-.08.374-.08.373-.09.267-.09.267-.19.392-.191.39-.223.321-.223.32-.304.316-.304.315-.284.22-.285.221-.22.133-.22.132-.243.107-.242.106-.089.048-.089.047-.249.072-.249.073-.322.057-.322.058-.283-.003-.283-.003-.07-.003-.072-.003-.178-.004-.178-.003-.124.025-.125.026zm-4.47-5.35.215-.018.206-.068.207-.068.244-.117.245-.118.274-.207.275-.207.229-.257.23-.257.218-.285.22-.285.188-.284.189-.285.214-.373.215-.374.134-.312.134-.312.028-.018.029-.017.197.262.197.262.164.15.164.152.202.092.201.093.303.014.302.014.214-.08.213-.08.2-.205.201-.204.093-.28.092-.278.058-.303.058-.302-.019-.427-.018-.427-.077-.426-.076-.426-.086-.321-.086-.321-.141-.402-.141-.403-.167-.309-.166-.31-.118-.16-.117-.16-.124-.12-.125-.119.019-.183.019-.182-.061-.25-.062-.248-.134-.285-.133-.285-.183-.202-.183-.201-.173-.128-.174-.127-.204.123-.204.123-.267.06-.267.06-.206-.022-.206-.022-.235-.088-.235-.089-.118-.09-.119-.09h-.079l-.055.116-.055.117-.159.181-.159.182-.17.108-.17.108-.221.074-.221.074h-.56l-.196-.067-.195-.067-.114-.059-.113-.058-.24-.222-.24-.22-.095-.085-.096-.085-.219.198-.219.198-.165.079-.165.078-.178.048-.178.048h-.439l-.224-.07-.225-.07-.102.097-.101.097-.121.164-.121.164-.17.063-.17.063-.115.086-.115.086-.11.114-.109.114-.355.529-.355.528-.216.45-.216.45-.222.462-.222.463-.145.338-.146.338-.056.22-.055.22-.016.207-.016.207.034.243.034.243.097.196.096.197.144.125.143.125.188.088.187.087.275.002.275.002.232-.098.23-.097.108-.076.106-.076.368-.294.368-.294.027.017.027.016.023.467.024.467.088.513.089.513.089.365.089.364.131.302.132.303.105.16.105.16.11.119.111.119.285.205.284.206.145.073.144.073.215.056.215.055.245.031.246.03.204-.012.205-.012zm.686-3.498-.113-.06-.106-.135-.106-.134-.044-.184-.044-.183.024-.554.024-.554.035-.427.036-.427.072-.374.072-.373.054-.211.054-.212.068-.132.067-.132.133-.11.132-.108.188-.042.187-.042.17.064.17.065.115.124.114.124.042.185.041.185-.111.46-.111.46-.034.266-.034.266-.04.818-.04.818-.037.152-.038.151-.111.111-.111.11-.115.05-.114.049-.188-.002-.188-.001zm-2.809-.358-.146-.069-.088-.12-.088-.119-.039-.106-.038-.107-.023-.135-.022-.135-.032-.47-.032-.47.036-.444.037-.445.048-.215.05-.216.075-.203.076-.203.094-.112.094-.11.143-.066.144-.066h.285l.142.066.142.066.093.103.093.102.04.12.041.122v.305l-.033.088-.034.088-.057.275-.056.276v.86l.043.393.043.393-.092.2-.092.201-.149.099-.148.098-.202.012-.201.012z%22%2F%3E%3C%2Fsvg%3E)}.simple-icons--bluesky{--svg:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M5.202 2.857C7.954 4.922 10.913 9.11 12 11.358c1.087-2.247 4.046-6.436 6.798-8.501C20.783 1.366 24 .213 24 3.883c0 .732-.42 6.156-.667 7.037c-.856 3.061-3.978 3.842-6.755 3.37c4.854.826 6.089 3.562 3.422 6.299c-5.065 5.196-7.28-1.304-7.847-2.97c-.104-.305-.152-.448-.153-.327c0-.121-.05.022-.153.327c-.568 1.666-2.782 8.166-7.847 2.97c-2.667-2.737-1.432-5.473 3.422-6.3c-2.777.473-5.899-.308-6.755-3.369C.42 10.04 0 4.615 0 3.883c0-3.67 3.217-2.517 5.202-1.026'/%3E%3C/svg%3E")}.i-raycast-light{--svg:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22228%22%20height%3D%22228%22%20viewBox%3D%220%200%20228%20228%22%20fill%3D%22none%22%3E%3Cg%20clip-path%3D%22url(%23a)%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22m227.987%20113.987-11.89%2011.903-45.11-45.11V56.987zM114.039%200l-11.89%2011.89%2045.097%2045.097h23.793zM88.521%2025.518%2076.618%2037.42l19.58%2019.566h23.792zm82.518%2082.53v23.794l19.501%2019.566%2011.903-11.89zm-6.859%2044.19%206.807-6.808h-88.47V56.987l-6.807%206.82L62.94%2051.1%2051.05%2062.99l12.758%2012.772-6.82%206.756v13.627L37.421%2076.566%2025.518%2088.47l31.469%2031.47v27.229L11.89%20102.097%200%20113.987l114.039%20114%2011.903-11.89-45.11-45.11h27.229l31.47%2031.482%2011.903-11.903-19.579-19.579h13.627l6.808-6.807%2012.771%2012.759%2011.891-11.891z%22%20fill%3D%22%23ff6363%22%2F%3E%3C%2Fg%3E%3Cdefs%3E%3CclipPath%20id%3D%22a%22%3E%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M0%200h228v228H0z%22%2F%3E%3C%2FclipPath%3E%3C%2Fdefs%3E%3C%2Fsvg%3E")}.i-raycast-dark{--svg:url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22228%22%20height%3D%22228%22%20viewBox%3D%220%200%20228%20228%22%20fill%3D%22none%22%3E%3Cg%20clip-path%3D%22url(%23a)%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M57%20147.207V171L-.052%20113.948l11.955-11.864zM80.793%20171H57l57.052%2057.052%2011.903-11.903zm135.317-45.11L228%20114%20114%200l-11.89%2011.89L147.155%2057h-27.229L88.482%2025.583%2076.58%2037.473l19.58%2019.579H82.53v88.469H171v-13.614l19.579%2019.579%2011.89-11.903L171%20108.048V80.819zM62.952%2051.049l-11.89%2011.903L63.82%2075.71l11.89-11.903zM164.193%20152.29l-11.852%2011.89%2012.759%2012.759%2011.903-11.891zM37.421%2076.58%2025.53%2088.47%2057%20119.951V96.145zM131.842%20171h-23.794l31.483%2031.469%2011.89-11.89z%22%20fill%3D%22%23ff6363%22%2F%3E%3C%2Fg%3E%3Cdefs%3E%3CclipPath%20id%3D%22a%22%3E%3Cpath%20fill%3D%22%23fff%22%20d%3D%22M0%200h228v228H0z%22%2F%3E%3C%2FclipPath%3E%3C%2Fdefs%3E%3C%2Fsvg%3E")}@keyframes slideIn{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}@keyframes slideOut{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(20px)}}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}@property --tw-scale-x{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-y{syntax:"*";inherits:false;initial-value:1}@property --tw-scale-z{syntax:"*";inherits:false;initial-value:1}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-divide-y-reverse{syntax:"*";inherits:false;initial-value:0}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-ordinal{syntax:"*";inherits:false}@property --tw-slashed-zero{syntax:"*";inherits:false}@property --tw-numeric-figure{syntax:"*";inherits:false}@property --tw-numeric-spacing{syntax:"*";inherits:false}@property --tw-numeric-fraction{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-content{syntax:"*";inherits:false;initial-value:""}@keyframes spin{to{transform:rotate(360deg)}}
+1
assets/plc-validate-DpZfLxog.js
··· 1 + (function(){"use strict";const pe=t=>t.toHex(),we=new TextEncoder;new TextDecoder;const xe=crypto.subtle,it=t=>new Uint8Array(t),U=it,St=(t,e)=>{let n=0,r=t.length,o;if(e===void 0)for(o=e=0;o<r;o++){const s=t[o];e+=s.length}const i=new Uint8Array(e);for(o=0;o<r;o++){const s=t[o];i.set(s,n),n+=s.length}return i},ge=(t,e,n,r)=>{let o;return n===void 0?o=t:o=t.subarray(n),we.encodeInto(e,o).written},ct=async t=>new Uint8Array(await xe.digest("SHA-256",t)),ft=(t,e,n)=>r=>{const o=(1<<e)-1;let i="",s=0,c=0;for(let a=0;a<r.length;++a)for(c=c<<8|r[a],s+=8;s>e;)s-=e,i+=t[o&c>>s];if(s!==0&&(i+=t[o&c<<e-s]),n)for(;(i.length*e&7)!==0;)i+="=";return i},Bt=(t,e,n)=>{const r={};for(let o=0;o<t.length;++o)r[t[o]]=o;return o=>{let i=o.length;for(;n&&o[i-1]==="=";)--i;const s=U(i*e/8|0);let c=0,a=0,l=0;for(let f=0;f<i;++f){const d=r[o[f]];if(d===void 0)throw new SyntaxError("invalid base string");a=a<<e|d,c+=e,c>=8&&(c-=8,s[l++]=255&a>>c)}if(c>=e||(255&a<<8-c)!==0)throw new SyntaxError("unexpected end of data");return s}},be=t=>{if(t.length>=255)throw new RangeError("alphabet too long");const e=t.length,n=t.charAt(0),r=Math.log(256)/Math.log(e);return o=>{if(o.length===0)return"";let i=0,s=0,c=0;const a=o.length;for(;c!==a&&o[c]===0;)c++,i++;const l=a-c,f=l*r+1>>>0,d=it(f);{const y=l%3,p=a-y;for(;c<p;){let x=o[c]<<16|o[c+1]<<8|o[c+2],A=0;for(let g=f-1;(x!==0||A<s)&&g!==-1;g--,A++)x=x+16777216*d[g],d[g]=x%e|0,x=x/e|0;s=A,c+=3}}for(;c!==a;){let y=o[c],p=0;for(let x=f-1;(y!==0||p<s)&&x!==-1;x--,p++)y=y+256*d[x],d[x]=y%e|0,y=y/e|0;s=p,c++}let h=f-s;for(;h!==f&&d[h]===0;)h++;let w=n.repeat(i);for(;h<f;++h)w+=t.charAt(d[h]);return w}},Ae=t=>{if(t.length>=255)throw new RangeError("alphabet too long");const e=new Uint8Array(128).fill(255);for(let s=0;s<t.length;s++){const c=t.charCodeAt(s);if(c>=128)throw new RangeError("non-ASCII character in alphabet");if(e[c]!==255)throw new RangeError(`${t[s]} is ambiguous`);e[c]=s}const n=t.length,r=n*n,o=t.charAt(0),i=Math.log(n)/Math.log(256);return s=>{if(s.length===0)return U(0);let c=0,a=0,l=0;for(;s[c]===o;)a++,c++;const f=s.length-c,d=f*i+1>>>0,h=it(d);{const p=f&1,x=s.length-p;for(;c<x;){const A=e[s.charCodeAt(c)],g=e[s.charCodeAt(c+1)];if(A===255||g===255)throw new Error("invalid string");let m=A*n+g,Et=0;for(let st=d-1;(m!==0||Et<l)&&st!==-1;st--,Et++)m+=r*h[st],h[st]=m&255,m=(m-(m&255))/256;if(m!==0)throw new Error("non-zero carry");l=Et,c+=2}}if(c<s.length){let p=e[s.charCodeAt(c)];if(p===255)throw new Error("invalid string");let x=0;for(let A=d-1;(p!==0||x<l)&&A!==-1;A--,x++)p+=n*h[A],h[A]=p&255,p=p>>>8;if(p!==0)throw new Error("non-zero carry");l=x}let w=d-l;for(;w!==d&&h[w]===0;)w++;if(w===a)return h;const y=U(a+(d-w));return y.fill(0,0,a),y.set(h.subarray(w),a),y}},me=ft("0123456789abcdef",4,!1),_t="fromHex"in Uint8Array?pe:me,Ee=t=>Uint8Array.fromBase64(t,{alphabet:"base64",lastChunkHandling:"loose"}),Se=t=>t.toBase64({alphabet:"base64",omitPadding:!0}),Be=t=>Uint8Array.fromBase64(t,{alphabet:"base64url",lastChunkHandling:"loose"}),_e=t=>t.toBase64({alphabet:"base64url",omitPadding:!0}),kt="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",It="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",ke=Bt(kt,6,!1),Ie=ft(kt,6,!1),Ce=Bt(It,6,!1),Ue=ft(It,6,!1),z="fromBase64"in Uint8Array,$e=z?Ee:ke,Re=z?Se:Ie,ve=z?Be:Ce,Ct=z?_e:Ue,Te="abcdefghijklmnopqrstuvwxyz234567",Ne=(()=>{const t=new Uint8Array(32);for(let e=0;e<32;e++)t[e]=Te.charCodeAt(e);return t})(),G=String.fromCharCode,at=t=>{const e=t.length,n=e/5|0,r=e-n*5,o=Ne;let i="",s=0;const c=n/2|0;for(let a=0;a<c;a++){const l=t[s],f=t[s+1],d=t[s+2],h=t[s+3],w=t[s+4],y=t[s+5],p=t[s+6],x=t[s+7],A=t[s+8],g=t[s+9];i+=G(o[l>>>3],o[(l<<2|f>>>6)&31],o[f>>>1&31],o[(f<<4|d>>>4)&31],o[(d<<1|h>>>7)&31],o[h>>>2&31],o[(h<<3|w>>>5)&31],o[w&31],o[y>>>3],o[(y<<2|p>>>6)&31],o[p>>>1&31],o[(p<<4|x>>>4)&31],o[(x<<1|A>>>7)&31],o[A>>>2&31],o[(A<<3|g>>>5)&31],o[g&31]),s+=10}if(n&1){const a=t[s],l=t[s+1],f=t[s+2],d=t[s+3],h=t[s+4];i+=G(o[a>>>3],o[(a<<2|l>>>6)&31],o[l>>>1&31],o[(l<<4|f>>>4)&31],o[(f<<1|d>>>7)&31],o[d>>>2&31],o[(d<<3|h>>>5)&31],o[h&31]),s+=5}if(r>0){let a=0,l=0;for(let f=s;f<e;f++)a=a<<8|t[f],l+=8;for(;l>=5;)l-=5,i+=G(o[a>>>l&31]);l>0&&(i+=G(o[a<<5-l&31]))}return i},Oe="abcdefghijklmnopqrstuvwxyz234567",_=(()=>{const t=new Uint8Array(128).fill(255);for(let e=0;e<32;e++)t[Oe.charCodeAt(e)]=e;return t})(),Ke=t=>{const e=t.length,n=U(e*5/8|0);let r=0,o=0;const i=e-e%8;for(;o<i;o+=8){const s=_[t.charCodeAt(o)],c=_[t.charCodeAt(o+1)],a=_[t.charCodeAt(o+2)],l=_[t.charCodeAt(o+3)],f=_[t.charCodeAt(o+4)],d=_[t.charCodeAt(o+5)],h=_[t.charCodeAt(o+6)],w=_[t.charCodeAt(o+7)];if((s|c|a|l|f|d|h|w)&224)throw new SyntaxError("invalid base string");n[r]=s<<3|c>>>2,n[r+1]=(c<<6|a<<1|l>>>4)&255,n[r+2]=(l<<4|f>>>1)&255,n[r+3]=(f<<7|d<<2|h>>>3)&255,n[r+4]=(h<<5|w)&255,r+=5}if(o<e){let s=0,c=0;for(;o<e;++o){const a=_[t.charCodeAt(o)];if(a&224)throw new SyntaxError("invalid base string");c=c<<5|a,s+=5,s>=8&&(s-=8,n[r++]=255&c>>s)}if(s>=5||(255&c<<8-s)!==0)throw new SyntaxError("unexpected end of data")}return n},Ut="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",He=Ae(Ut),Pe=be(Ut),X=1,lt=18,Le=85,ut=113,De=(t,e)=>{if(e.length!==32)throw new RangeError("invalid digest length");const n=U(36);return n[0]=X,n[1]=t,n[2]=lt,n[3]=32,n.set(e,4),{version:X,codec:t,digest:{codec:lt,contents:n.subarray(4,36)},bytes:n}},$t=async(t,e)=>{const n=await ct(e);return De(t,n)},Me=t=>{if(t.length<36)throw new RangeError("cid too short");const e=t[0],n=t[1],r=t[2],o=t[3];if(e!==X)throw new RangeError(`incorrect cid version (got v${e})`);if(n!==ut&&n!==Le)throw new RangeError(`incorrect cid codec (got 0x${n.toString(16)})`);if(r!==lt)throw new RangeError(`incorrect cid digest codec (got 0x${r.toString(16)})`);if(o!==32)throw new RangeError(`incorrect cid digest size (got ${o})`);return[{version:X,codec:n,digest:{codec:r,contents:t.subarray(4,36)},bytes:t.subarray(0,36)},t.subarray(36)]},Fe=t=>{const[e,n]=Me(t);if(n.length!==0)throw new RangeError("cid bytes includes remainder");return e},ze=t=>{if(t.length!==59||t[0]!=="b")throw new SyntaxError("not a valid cid string");const e=Ke(t.slice(1));return Fe(e)},Rt=t=>`b${at(t.bytes)}`,Ge=Symbol.for("@atcute/cid-link-wrapper");class vt{[Ge]=!0;bytes;constructor(e){this.bytes=e}get $link(){const e=`b${at(this.bytes)}`;return Object.defineProperty(this,"$link",{value:e,enumerable:!0}),e}toJSON(){return{$link:this.$link}}}const Tt={p:0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2fn,n:0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n,h:1n,a:0n,b:7n,Gx:0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798n,Gy:0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8n},{p:$,n:Y,Gx:Xe,Gy:Ye,b:Nt}=Tt,H=32,P=64,Ot={publicKey:H+1,publicKeyUncompressed:P+1,signature:P},Ze=(...t)=>{"captureStackTrace"in Error&&typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(...t)},b=(t="")=>{const e=new Error(t);throw Ze(e,b),e},je=t=>typeof t=="bigint",Ve=t=>typeof t=="string",We=t=>t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array",v=(t,e,n="")=>{const r=We(t),o=t?.length,i=e!==void 0;if(!r||i&&o!==e){const s=n&&`"${n}" `,c=i?` of length ${e}`:"",a=r?`length=${o}`:`type=${typeof t}`;b(s+"expected Uint8Array"+c+", got "+a)}return t},Z=t=>new Uint8Array(t),Kt=(t,e)=>t.toString(16).padStart(e,"0"),Ht=t=>Array.from(v(t)).map(e=>Kt(e,2)).join(""),k={_0:48,_9:57,A:65,F:70,a:97,f:102},Pt=t=>{if(t>=k._0&&t<=k._9)return t-k._0;if(t>=k.A&&t<=k.F)return t-(k.A-10);if(t>=k.a&&t<=k.f)return t-(k.a-10)},Lt=t=>{const e="hex invalid";if(!Ve(t))return b(e);const n=t.length,r=n/2;if(n%2)return b(e);const o=Z(r);for(let i=0,s=0;i<r;i++,s+=2){const c=Pt(t.charCodeAt(s)),a=Pt(t.charCodeAt(s+1));if(c===void 0||a===void 0)return b(e);o[i]=c*16+a}return o},qe=()=>globalThis?.crypto,Dt=()=>qe()?.subtle??b("crypto.subtle must be defined, consider polyfill"),j=(...t)=>{const e=Z(t.reduce((r,o)=>r+v(o).length,0));let n=0;return t.forEach(r=>{e.set(r,n),n+=r.length}),e},L=BigInt,V=(t,e,n,r="bad number: out of range")=>je(t)&&e<=t&&t<n?t:b(r),u=(t,e=$)=>{const n=t%e;return n>=0n?n:e+n},W=t=>u(t,Y),Mt=(t,e)=>{(t===0n||e<=0n)&&b("no inverse n="+t+" mod="+e);let n=u(t,e),r=e,o=0n,i=1n;for(;n!==0n;){const s=r/n,c=r%n,a=o-i*s;r=n,n=c,o=i,i=a}return r===1n?u(o,e):b("no inverse")},Je=t=>{const e=Jt[t];return typeof e!="function"&&b("hashes."+t+" not set"),e},dt=t=>t instanceof E?t:b("Point expected"),Ft=t=>u(u(t*t)*t+Nt),zt=t=>V(t,0n,$),q=t=>V(t,1n,$),ht=t=>V(t,1n,Y),yt=t=>(t&1n)===0n,Gt=t=>Uint8Array.of(t),Qe=t=>Gt(yt(t)?2:3),tn=t=>{const e=Ft(q(t));let n=1n;for(let r=e,o=($+1n)/4n;o>0n;o>>=1n)o&1n&&(n=n*r%$),r=r*r%$;return u(n*n)===e?n:b("sqrt invalid")};class E{static BASE;static ZERO;X;Y;Z;constructor(e,n,r){this.X=zt(e),this.Y=q(n),this.Z=zt(r),Object.freeze(this)}static CURVE(){return Tt}static fromAffine(e){const{x:n,y:r}=e;return n===0n&&r===0n?R:new E(n,r,1n)}static fromBytes(e){v(e);const{publicKey:n,publicKeyUncompressed:r}=Ot;let o;const i=e.length,s=e[0],c=e.subarray(1),a=J(c,0,H);if(i===n&&(s===2||s===3)){let l=tn(a);const f=yt(l);yt(L(s))!==f&&(l=u(-l)),o=new E(a,l,1n)}return i===r&&s===4&&(o=new E(a,J(c,H,P),1n)),o?o.assertValidity():b("bad point: not on curve")}static fromHex(e){return E.fromBytes(Lt(e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}equals(e){const{X:n,Y:r,Z:o}=this,{X:i,Y:s,Z:c}=dt(e),a=u(n*c),l=u(i*o),f=u(r*c),d=u(s*o);return a===l&&f===d}is0(){return this.equals(R)}negate(){return new E(this.X,u(-this.Y),this.Z)}double(){return this.add(this)}add(e){const{X:n,Y:r,Z:o}=this,{X:i,Y:s,Z:c}=dt(e),a=0n,l=Nt;let f=0n,d=0n,h=0n;const w=u(l*3n);let y=u(n*i),p=u(r*s),x=u(o*c),A=u(n+r),g=u(i+s);A=u(A*g),g=u(y+p),A=u(A-g),g=u(n+o);let m=u(i+c);return g=u(g*m),m=u(y+x),g=u(g-m),m=u(r+o),f=u(s+c),m=u(m*f),f=u(p+x),m=u(m-f),h=u(a*g),f=u(w*x),h=u(f+h),f=u(p-h),h=u(p+h),d=u(f*h),p=u(y+y),p=u(p+y),x=u(a*x),g=u(w*g),p=u(p+x),x=u(y-x),x=u(a*x),g=u(g+x),y=u(p*g),d=u(d+y),y=u(m*g),f=u(A*f),f=u(f-y),y=u(A*p),h=u(m*h),h=u(h+y),new E(f,d,h)}subtract(e){return this.add(dt(e).negate())}multiply(e,n=!0){if(!n&&e===0n)return R;if(ht(e),e===1n)return this;if(this.equals(T))return hn(e).p;let r=R,o=T;for(let i=this;e>0n;i=i.double(),e>>=1n)e&1n?r=r.add(i):n&&(o=o.add(i));return r}multiplyUnsafe(e){return this.multiply(e,!1)}toAffine(){const{X:e,Y:n,Z:r}=this;if(this.equals(R))return{x:0n,y:0n};if(r===1n)return{x:e,y:n};const o=Mt(r,$);return u(r*o)!==1n&&b("inverse invalid"),{x:u(e*o),y:u(n*o)}}assertValidity(){const{x:e,y:n}=this.toAffine();return q(e),q(n),u(n*n)===Ft(e)?this:b("bad point: not on curve")}toBytes(e=!0){const{x:n,y:r}=this.assertValidity().toAffine(),o=Q(n);return e?j(Qe(r),o):j(Gt(4),o,Q(r))}toHex(e){return Ht(this.toBytes(e))}}const T=new E(Xe,Ye,1n),R=new E(0n,1n,0n);E.BASE=T,E.ZERO=R;const en=(t,e,n)=>T.multiply(e,!1).add(t.multiply(n,!1)).assertValidity(),Xt=t=>L("0x"+(Ht(t)||"0")),J=(t,e,n)=>Xt(t.subarray(e,n)),nn=2n**256n,Q=t=>Lt(Kt(V(t,0n,nn),P)),Yt=t=>t>Y>>1n,rn=t=>{[0,1,2,3].includes(t)||b("recovery id must be valid and present")},on=t=>{t!=null&&!Vt.includes(t)&&b(`Signature format must be one of: ${Vt.join(", ")}`),t===jt&&b('Signature format "der" is not supported: switch to noble-curves')},Zt=(t,e=N)=>{on(e);const n=Ot.signature,r=n+1;let o=`Signature format "${e}" expects Uint8Array with length `;e===N&&t.length!==n&&b(o+n),e===tt&&t.length!==r&&b(o+r)};class D{r;s;recovery;constructor(e,n,r){this.r=ht(e),this.s=ht(n),r!=null&&(this.recovery=r),Object.freeze(this)}static fromBytes(e,n=N){Zt(e,n);let r;n===tt&&(r=e[0],e=e.subarray(1));const o=J(e,0,H),i=J(e,H,P);return new D(o,i,r)}addRecoveryBit(e){return new D(this.r,this.s,e)}hasHighS(){return Yt(this.s)}toBytes(e=N){const{r:n,s:r,recovery:o}=this,i=j(Q(n),Q(r));return e===tt?(rn(o),j(Uint8Array.of(o),i)):i}}const sn=t=>{const e=t.length*8-256;e>1024&&b("msg invalid");const n=Xt(t);return e>0?n>>L(e):n},cn=t=>W(sn(v(t))),N="compact",tt="recovered",jt="der",Vt=[N,tt,jt],Wt={lowS:!0,prehash:!0,format:N,extraEntropy:!1},qt="SHA-256",Jt={hmacSha256Async:async(t,e)=>{const n=Dt(),r="HMAC",o=await n.importKey("raw",t,{name:r,hash:{name:qt}},!1,["sign"]);return Z(await n.sign(r,o,e))},hmacSha256:void 0,sha256Async:async t=>Z(await Dt().digest(qt,t)),sha256:void 0},fn=(t,e,n)=>(v(t,void 0,"message"),e.prehash?n?Jt.sha256Async(t):Je("sha256")(t):t),an=(t,e,n,r={})=>{const{lowS:o,format:i}=r;t instanceof D&&b("Signature must be in Uint8Array, use .toBytes()"),Zt(t,i),v(n,void 0,"publicKey");try{const{r:s,s:c}=D.fromBytes(t,i),a=cn(e),l=E.fromBytes(n);if(o&&Yt(c))return!1;const f=Mt(c,Y),d=W(a*f),h=W(s*f),w=en(l,d,h).toAffine();return W(w.x)===s}catch{return!1}},ln=t=>{const e={};return Object.keys(Wt).forEach(n=>{e[n]=t[n]??Wt[n]}),e},un=(t,e,n,r={})=>(r=ln(r),e=fn(e,r,!1),an(t,e,n,r)),et=8,Qt=Math.ceil(256/et)+1,pt=2**(et-1),dn=()=>{const t=[];let e=T,n=e;for(let r=0;r<Qt;r++){n=e,t.push(n);for(let o=1;o<pt;o++)n=n.add(e),t.push(n);e=n.double()}return t};let te;const ee=(t,e)=>{const n=e.negate();return t?n:e},hn=t=>{const e=te||(te=dn());let n=R,r=T;const o=2**et,i=o,s=L(o-1),c=L(et);for(let a=0;a<Qt;a++){let l=Number(t&s);t>>=c,l>pt&&(l-=i,t+=1n);const f=a*pt,d=f,h=f+Math.abs(l)-1,w=a%2!==0,y=l<0;l===0?r=r.add(ee(w,e[d])):n=n.add(ee(y,e[h]))}return t!==0n&&b("invalid wnaf"),{p:n,f:r}},yn=t=>{let e,n=0n;for(let r=1;r<=(e=t.length)>>1;r++)n|=BigInt(t[e-r])<<BigInt(8*(r-1));return n},pn=(t,e)=>yn(t)<=e>>1n,wn=t=>t[0]===2||t[0]===3,xn=t=>t[0]===4,gn=t=>{C(xn(t),"not an uncompressed point");const e=t.length-1,n=e>>1,r=t.slice(0,n+1);return r[0]=2+(t[e]&1),r},nt=(t,e)=>`z${Pe(St([t,e]))}`,C=(t,e)=>{if(!t)throw new TypeError(e)},wt=(t,e)=>{if(!t)throw new SyntaxError(e)},ne=(t,e)=>{throw new Error(e)},re=Uint8Array.from([231,1]);Uint8Array.from([129,38]);const bn=(t,e)=>{const n=E.fromBytes(t).toBytes(!1);return{kty:"EC",crv:"secp256k1",alg:"ES256K",x:Ct(n.subarray(1,33)),y:Ct(n.subarray(33,65)),key_ops:["verify","sign"]}};class xt{type="secp256k1";jwtAlg="ES256K";_publicKey;constructor(e){this._publicKey=e}static async importRaw(e){return new xt(e)}async verify(e,n,r){if(e.length!==64)return!1;const o=r?.allowMalleableSig??!1,i=await ct(n);return un(e,i,this._publicKey,{lowS:!o,prehash:!1})}async exportPublicKey(e){const n=this._publicKey;if(e==="jwk")return bn(n);switch(e){case"did":return`did:key:${nt(re,n)}`;case"multikey":return nt(re,n);case"raw":return n;case"rawHex":return _t(n)}ne(e,`unknown "${e}" export format`)}}const M=0xffffffff00000001000000000000000000000000ffffffffffffffffffffffffn,An=0xffffffff00000001000000000000000000000000fffffffffffffffffffffffcn,mn=0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604bn,En=0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551n,Sn=(M+1n)/4n,Bn=t=>t.reduce((e,n,r)=>e+(BigInt(n)<<BigInt(8*(t.length-r-1))),0n),oe=(t,e)=>Uint8Array.from(Array.from({length:e},(n,r)=>Number(BigInt.asUintN(8,t>>BigInt((e-r-1)*8))))),_n=(t,e)=>(t=t*t%e,t=t*t%e,t=t*t%e,t=t*t%e,t),kn=(t,e,n)=>{const r=[1n];for(let o=0;o<15;o++)r.push(r[o]*t%n);return Array.from(e.toString(16)).reduce((o,i)=>_n(o,n)*r[parseInt(i,16)]%n,1n)},In=t=>{C(wn(t),"not a compressed point"),C(t.length===33,"invalid compressed point length");const e=Bn(t.subarray(1)),n=(e**3n+An*e+mn)%M;let r=kn(n,Sn,M);C(r*r%M===n,"invalid curve point"),(t[0]^Number(BigInt.asUintN(1,r)))&1&&(r=M-r);const o=new Uint8Array(65);return o[0]=4,o.set(oe(e,32),1),o.set(oe(r,32),33),o},se=Uint8Array.from([128,36]);Uint8Array.from([134,38]);const ie={name:"ECDSA",namedCurve:"P-256",hash:"SHA-256"},ce=Uint8Array.from([48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7]);Uint8Array.from([48,65,2,1,0,...ce,4,39,48,37,2,1,1,4,32]),Uint8Array.from([48,57,...ce,3,34,0]);class rt{type="p256";jwtAlg="ES256";_publicKey;constructor(e){this._publicKey=e}static async importRaw(e){let n;return n=await crypto.subtle.importKey("raw",In(e),ie,!0,["verify"]),new rt(n)}static async importCryptoKey(e){return C(e.algorithm.namedCurve==="P-256","not an ECDSA P-256 key"),C(e.type==="public","not a public key"),C(e.extractable,"key must be extractable"),new rt(e)}async verify(e,n,r){return e.length!==64||!r?.allowMalleableSig&&!pn(e,En)?!1:await crypto.subtle.verify(ie,this._publicKey,e,n)}async exportPublicKey(e){if(e==="jwk")return await crypto.subtle.exportKey("jwk",this._publicKey);const n=await crypto.subtle.exportKey("raw",this._publicKey),r=gn(new Uint8Array(n));switch(e){case"did":return`did:key:${nt(se,r)}`;case"multikey":return nt(se,r);case"raw":return r;case"rawHex":return _t(r)}ne(e,`unknown "${e}" export format`)}}const Cn=t=>(wt(t.length>=2&&t[0]==="z","not a multibase base58btc string"),He(t.slice(1))),Un=t=>(wt(t.length>=9&&t.startsWith("did:key:"),"not a did:key"),$n(t.slice(8))),$n=t=>{const e=Cn(t);wt(e.length>=3,"multikey too short");const n=e[0]<<8|e[1],r=e.subarray(2);switch(n){case 32804:return{type:"p256",jwtAlg:"ES256",publicKeyBytes:r};case 59137:return{type:"secp256k1",jwtAlg:"ES256K",publicKeyBytes:r}}C(!1,`unsupported key type (0x${n.toString(16).padStart(4,"0")})`)},Rn=async(t,e,n,r)=>{switch(t.type){case"p256":return await(await rt.importRaw(t.publicKeyBytes)).verify(e,n,r);case"secp256k1":return await(await xt.importRaw(t.publicKeyBytes)).verify(e,n,r)}},vn=async(t,e,n,r)=>{const o=Un(t);return await Rn(o,e,n,r)},Tn=72*(60*(60*1e3)),Nn=Symbol.for("@atcute/bytes-wrapper");class fe{buf;[Nn]=!0;constructor(e){this.buf=e}get $bytes(){return Re(this.buf)}toJSON(){return{$bytes:this.$bytes}}}const On=t=>t instanceof fe?t.buf:$e(t.$bytes),O=9,ae=1024,Kn=Math.max,Hn=Number.isInteger,Pn=Number.isFinite,Ln=Number.MAX_SAFE_INTEGER,Dn=Number.MIN_SAFE_INTEGER,S=(t,e)=>{const n=t.b,r=t.p;n.byteLength<r+e&&(t.c.push(n.subarray(0,r)),t.l+=r,t.b=U(Kn(ae,e)),t.v=null,t.p=0)},gt=t=>t<24?1:t<256?2:t<65536?3:t<4294967296?5:9,Mn=(t,e)=>{const n=t.b;(t.v??=new DataView(n.buffer,n.byteOffset,n.byteLength)).setFloat64(t.p,e),t.p+=8},B=(t,e)=>{t.b[t.p++]=e},Fn=(t,e)=>{let n=t.p;const r=t.b;r[n++]=e>>>8,r[n++]=e&255,t.p=n},zn=(t,e)=>{let n=t.p;const r=t.b;r[n++]=e>>>24,r[n++]=e>>>16&255,r[n++]=e>>>8&255,r[n++]=e&255,t.p=n},Gn=(t,e)=>{let n=t.p;const r=t.b,o=e/2**32|0,i=e>>>0;r[n++]=o>>>24,r[n++]=o>>>16&255,r[n++]=o>>>8&255,r[n++]=o&255,r[n++]=i>>>24,r[n++]=i>>>16&255,r[n++]=i>>>8&255,r[n++]=i&255,t.p=n},I=(t,e,n)=>{n<24?B(t,e<<5|n):n<256?(B(t,e<<5|24),B(t,n)):n<65536?(B(t,e<<5|25),Fn(t,n)):n<4294967296?(B(t,e<<5|26),zn(t,n)):(B(t,e<<5|27),Gn(t,n))},Xn=(t,e)=>{S(t,O),e<0?I(t,1,-e-1):I(t,0,e)},Yn=(t,e)=>{S(t,9),B(t,251),Mn(t,e)},Zn=(t,e)=>{if(!Pn(e))throw new RangeError("NaN and Infinity values not supported");if(e>Ln||e<Dn)throw new RangeError("can't encode numbers beyond safe integer range");Hn(e)?Xn(t,e):Yn(t,e)},le=(t,e)=>{const n=e.length;if(n===0){S(t,1),B(t,96);return}S(t,n*3+O);t:{const c=t.p+gt(n),a=e.charCodeAt(0);if(a>127)break t;t.b[c]=a;let l=1;for(;l+3<n;l+=4){const f=e.charCodeAt(l),d=e.charCodeAt(l+1),h=e.charCodeAt(l+2),w=e.charCodeAt(l+3);if((f|d|h|w)&128)break t;t.b[c+l]=f,t.b[c+l+1]=d,t.b[c+l+2]=h,t.b[c+l+3]=w}for(;l<n;l++){const f=e.charCodeAt(l);if(f>127)break t;t.b[c+l]=f}I(t,3,n),t.p+=n;return}const r=gt(n*2),o=t.p+r,i=ge(t.b,e,o),s=gt(i);r!==s&&t.b.copyWithin(t.p+s,o,o+i),I(t,3,i),t.p+=i},ue=(t,e)=>{const n=On(e),r=n.byteLength;S(t,r+O),I(t,2,r),t.b.set(n,t.p),t.p+=r},de=(t,e)=>{const n=e instanceof vt?e.bytes:ze(e.$link).bytes,r=n.byteLength+1;S(t,r+2*O),I(t,6,42),I(t,2,r),t.b[t.p]=0,t.b.set(n,t.p+1),t.p+=r},bt=(t,e)=>{switch(typeof e){case"boolean":return S(t,1),B(t,244+ +e);case"number":return Zn(t,e);case"string":return le(t,e);case"object":{if(e===null)return S(t,1),B(t,246);if(Array.isArray(e)){const n=e.length;S(t,O),I(t,4,n);for(let r=0;r<n;r++)bt(t,e[r]);return}if(e.constructor===Object){const n=Vn(e),r=n.length;if(r===1){const o=n[0];if(o==="$link"){if(typeof e.$link=="string"){de(t,e);return}throw new TypeError("unexpected cid-link value")}if(o==="$bytes"){if(typeof e.$bytes=="string"){ue(t,e);return}throw new TypeError("unexpected bytes value")}}S(t,O),I(t,5,r);for(let o=0;o<r;o++){const i=n[o];le(t,i),bt(t,e[i])}return}if("$link"in e){if(e instanceof vt||typeof e.$link=="string"){de(t,e);return}throw new TypeError("unexpected cid-link value")}if("$bytes"in e){if(e instanceof fe||typeof e.$bytes=="string"){ue(t,e);return}throw new TypeError("unexpected bytes value")}}}throw new TypeError(`unsupported type: ${e}`)},jn=()=>({c:[],b:U(ae),v:null,p:0,l:0}),ot=t=>{const e=jn();bt(e,t);const n=e.b.subarray(0,e.p);return e.c.length?(e.c.push(n),St(e.c,e.l+e.p)):n},Vn=t=>{const e=Object.keys(t);let n=0;for(let r=0;r<e.length;r++){const o=e[r];if(t[o]===void 0)continue;const i=o.length;let s=n-1;for(;s>=0;s--){const c=e[s];if(i>c.length||i===c.length&&o>c)break;e[s+1]=c}e[s+1]=o,n++}return e.length=n,e};class F extends Error{name="PlcError"}class K extends F{operation;reason;name="ImproperOperationError";constructor(e,n){super(`improper operation; cid=${e.cid}; reason=${n}`),this.operation=e,this.reason=n}}class At extends F{operation;name="InvalidSignatureError";constructor(e){super(`invalid signature; cid=${e.cid}`),this.operation=e}}class he extends F{operation;expected;name="InvalidHashError";constructor(e,n){super(`invalid hash; expected=${n}; got=${e.cid}`),this.operation=e,this.expected=n}}class Wn extends F{operation;did;name="GenesisHashError";constructor(e,n){super(`mismatching genesis hash; did=${n}; cid=${e.cid}`),this.operation=e,this.did=n}}class qn extends F{operation;lapsed;name="LateDisputeError";constructor(e,n){super(`dispute occured outside of permitted window; cid=${e.cid}; lapsed=${n}`),this.operation=e,this.lapsed=n}}const Jn=t=>t.startsWith("http://")||t.startsWith("https://")?t:`https://${t}`,Qn=t=>t.startsWith("at://")?t:`at://${t.replace("http://","").replace("https://","")}`,tr=async t=>{const e=ot(t),n=await ct(e);return`did:plc:${at(n.subarray(0,15))}`},ye=t=>t.type==="create"?{type:"plc_operation",prev:t.prev,sig:t.sig,rotationKeys:[t.recoveryKey,t.signingKey],verificationMethods:{atproto:t.signingKey},alsoKnownAs:[Qn(t.handle)],services:{atproto_pds:{type:"AtprotoPersonalDataServer",endpoint:Jn(t.service)}}}:t,mt=async(t,e)=>{const{sig:n,...r}=e,o=ve(n),i=ot(r);for(const s of t)if(await vn(s,o,i))return s;return null},er=async(t,e,n)=>{if(e.length===0){if(n.operation.type==="plc_tombstone")throw new K(n,"expected genesis op to not be tombstone");if(n.operation.prev!==null)throw new K(n,"expected null prev on genesis op");{if(await tr(n.operation)!==t)throw new Wn(n,t);const w=ot(n.operation),y=Rt(await $t(ut,w));if(y!==n.cid)throw new he(n,y)}let f,d;{const{rotationKeys:h}=ye(n.operation),w=await mt(h,n.operation);if(!w)throw new At(n);f=h,d=w}return{prev:null,nullified:[],ops:[{...n,allowedSigners:f,signedBy:d}]}}const r=n.operation.prev;if(!r)throw new K(n,"expected prev op");const o=e.findIndex(f=>f.cid===r);if(o===-1)throw new K(n,"prev op not in history");{const f=ot(n.operation),d=Rt(await $t(ut,f));if(d!==n.cid)throw new he(n,d)}const i=e.slice(0,o+1),s=e.slice(o+1),c=i.at(-1);if(!c)throw new K(n,"missing last op");if(c.operation.type==="plc_tombstone")throw new K(n,"did is tombstoned");const a=ye(c.operation),l=s[0];if(!l){const f=a.rotationKeys,d=await mt(f,n.operation);if(!d)throw new At(n);return{prev:r,nullified:[],ops:[...e,{...n,allowedSigners:f,signedBy:d}]}}{const f=new Date(n.createdAt).getTime()-new Date(l.createdAt).getTime();if(f>Tn)throw new qn(n,f)}{let f,d;{const h=l.signedBy,w=a.rotationKeys.indexOf(h),y=a.rotationKeys.slice(0,w),p=await mt(y,n.operation);if(!p)throw new At(n);f=y,d=p}return{prev:r,nullified:s,ops:[...i,{...n,allowedSigners:f,signedBy:d}]}}},nr=async(t,e)=>{let n=[],r=[];for(const o of e){const i=await er(t,r,o);r=i.ops,i.nullified.length>0&&(n=n.concat(i.nullified))}return{canonical:r,nullified:n}};self.onmessage=async t=>{const{did:e,logs:n}=t.data;try{await nr(e,n),self.postMessage({valid:!0})}catch{self.postMessage({valid:!1})}}})();
cursor.cur

This is a binary file and will not be displayed.

favicon.ico

This is a binary file and will not be displayed.

fonts/.DS_Store

This is a binary file and will not be displayed.

fonts/Figtree.woff2

This is a binary file and will not be displayed.

headers/.DS_Store

This is a binary file and will not be displayed.

headers/almaty.webp

This is a binary file and will not be displayed.

headers/bunny.jpg

This is a binary file and will not be displayed.

headers/city.webp

This is a binary file and will not be displayed.

headers/dreary.jpg

This is a binary file and will not be displayed.

headers/kit.jpg

This is a binary file and will not be displayed.

headers/puppy.jpg

This is a binary file and will not be displayed.

headers/water.webp

This is a binary file and will not be displayed.

+39
index.html
··· 1 + <!doctype html> 2 + <html lang="en"> 3 + <head> 4 + <meta charset="utf-8" /> 5 + <meta name="viewport" content="width=device-width, initial-scale=1" /> 6 + <link rel="icon" href="/favicon.ico" /> 7 + <meta name="theme-color" content="#76c4e5" /> 8 + <meta property="og:title" content="PDSls" /> 9 + <meta property="og:type" content="website" /> 10 + <meta property="og:url" content="https://pds.ls" /> 11 + <meta property="og:description" content="Browse the public data on atproto" /> 12 + <meta property="description" content="Browse the public data on atproto" /> 13 + <link rel="manifest" href="/manifest.json" /> 14 + <link 15 + rel="search" 16 + type="application/opensearchdescription+xml" 17 + href="/opensearch.xml" 18 + title="PDSls" 19 + /> 20 + <link rel="preconnect" href="https://fonts.bunny.net" /> 21 + <link href="https://fonts.bunny.net/css?family=roboto-mono:400" rel="stylesheet" /> 22 + <script> 23 + document.documentElement.classList.toggle( 24 + "dark", 25 + localStorage.theme === "dark" || 26 + (!("theme" in localStorage) && window.matchMedia("(prefers-color-scheme: dark)").matches), 27 + ); 28 + </script> 29 + <script type="module" crossorigin src="/assets/index-B_dCXHrJ.js"></script> 30 + <link rel="stylesheet" crossorigin href="/assets/index-DQYJUy_Y.css"> 31 + </head> 32 + 33 + <body 34 + id="root" 35 + class="dark:bg-dark-500 min-h-screen bg-neutral-100 text-neutral-900 dark:text-neutral-200" 36 + > 37 + <noscript>You need to enable JavaScript to run this app.</noscript> 38 + </body> 39 + </html>
+22
manifest.json
··· 1 + { 2 + "name": "PDSls", 3 + "description": "", 4 + "id": "dev.pdsls", 5 + "start_url": "/", 6 + "display": "standalone", 7 + "background_color": "#1f1f1f", 8 + "theme_color": "#1f1f1f", 9 + "icons": [ 10 + { 11 + "src": "/favicon.ico", 12 + "type": "image/png", 13 + "sizes": "512x512" 14 + }, 15 + { 16 + "src": "/pwa-maskable.png", 17 + "type": "image/png", 18 + "sizes": "512x512", 19 + "purpose": "maskable" 20 + } 21 + ] 22 + }
+20
oauth-client-metadata.json
··· 1 + { 2 + "client_id": "https://pdsls.tngl.io/oauth-client-metadata.json", 3 + "client_name": "PDSls", 4 + "client_uri": "https://pdsls.tngl.io", 5 + "logo_uri": "https://pdsls.tngl.io/favicon.ico", 6 + "redirect_uris": [ 7 + "https://pdsls.tngl.io/" 8 + ], 9 + "scope": "atproto repo:*?action=create repo:*?action=update repo:*?action=delete blob:*/*", 10 + "grant_types": [ 11 + "authorization_code", 12 + "refresh_token" 13 + ], 14 + "response_types": [ 15 + "code" 16 + ], 17 + "token_endpoint_auth_method": "none", 18 + "application_type": "web", 19 + "dpop_bound_access_tokens": true 20 + }
+9
opensearch.xml
··· 1 + <?xml version="1.0" encoding="UTF-8"?> 2 + <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/"> 3 + <ShortName>PDSls</ShortName> 4 + <Description>Search the Atmosphere</Description> 5 + <InputEncoding>UTF-8</InputEncoding> 6 + <Image width="16" height="16" type="image/x-icon">https://pdsls.tngl.io/favicon.ico</Image> 7 + <Url type="text/html" method="get" template="https://pdsls.tngl.io/?q={searchTerms}"/> 8 + <moz:SearchForm>https://pdsls.tngl.io</moz:SearchForm> 9 + </OpenSearchDescription>
pwa-maskable.png

This is a binary file and will not be displayed.

ribbon.webp

This is a binary file and will not be displayed.