dsh-msg9-kit 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -1
- package/README.zh-CN.md +4 -1
- package/lib/client.js +26 -24
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -18,25 +18,25 @@ window.__ModuleLoader__.load({
|
|
|
18
18
|
`),c=u.replace(this.rules.other.blockquoteSetextReplace,`
|
|
19
19
|
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");n=n?`${n}
|
|
20
20
|
${u}`:u,s=s?`${s}
|
|
21
|
-
${c}`:c;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,r,!0),this.lexer.state.top=p,a.length===0)break;let f=r.at(-1);if(f?.type==="code")break;if(f?.type==="blockquote"){let
|
|
22
|
-
`)
|
|
23
|
-
`+
|
|
24
|
-
${
|
|
21
|
+
${c}`:c;let p=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,r,!0),this.lexer.state.top=p,a.length===0)break;let f=r.at(-1);if(f?.type==="code")break;if(f?.type==="blockquote"){let g=f,h=a.join(`
|
|
22
|
+
`),w=g.raw+`
|
|
23
|
+
`+h.replace(this.rules.other.blockquoteSetextReplace2,""),j=this.blockquote(w);r[r.length-1]=j,n=`${n}
|
|
24
|
+
${h}`,s=s.substring(0,s.length-g.text.length)+j.text;break}else if(f?.type==="list"){let g=f,h=g.raw+`
|
|
25
25
|
`+a.join(`
|
|
26
|
-
`)
|
|
26
|
+
`),w=this.list(h);r[r.length-1]=w,n=n.substring(0,n.length-f.raw.length)+w.raw,s=s.substring(0,s.length-g.raw.length)+w.raw,a=h.substring(r.at(-1).raw.length).split(`
|
|
27
27
|
`);continue}}return{type:"blockquote",raw:n,tokens:r,text:s}}}list(e){let t=this.rules.block.list.exec(e);if(t){let a=t[1].trim(),n=a.length>1,s={type:"list",raw:"",ordered:n,start:n?+a.slice(0,-1):"",loose:!1,items:[]};a=n?`\\d{1,9}\\${a.slice(-1)}`:`\\${a}`,this.options.pedantic&&(a=n?a:"[*+-]");let r=this.rules.other.listItemRegex(a),o=!1;for(;e;){let l=!1,u="",c="";if(!(t=r.exec(e))||this.rules.block.hr.test(e))break;u=t[0],e=e.substring(u.length);let p=tm(t[2].split(`
|
|
28
28
|
`,1)[0],t[1].length),f=e.split(`
|
|
29
|
-
`,1)[0],
|
|
30
|
-
`,e=e.substring(f.length+1),l=!0),!l){let
|
|
31
|
-
`,1)[0],O;if(f=T,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),O=f):O=f.replace(this.rules.other.tabCharGlobal," "),L.test(f)||k.test(f)
|
|
32
|
-
`+O.slice(
|
|
33
|
-
`+f}
|
|
34
|
-
`,e=e.substring(T.length+1),p=O.slice(
|
|
29
|
+
`,1)[0],g=!p.trim(),h=0;if(this.options.pedantic?(h=2,c=p.trimStart()):g?h=t[1].length+1:(h=p.search(this.rules.other.nonSpaceChar),h=h>4?1:h,c=p.slice(h),h+=t[1].length),g&&this.rules.other.blankLine.test(f)&&(u+=f+`
|
|
30
|
+
`,e=e.substring(f.length+1),l=!0),!l){let w=this.rules.other.nextBulletRegex(h),j=this.rules.other.hrRegex(h),L=this.rules.other.fencesBeginRegex(h),k=this.rules.other.headingBeginRegex(h),$=this.rules.other.htmlBeginRegex(h),R=this.rules.other.blockquoteBeginRegex(h);for(;e;){let T=e.split(`
|
|
31
|
+
`,1)[0],O;if(f=T,this.options.pedantic?(f=f.replace(this.rules.other.listReplaceNesting," "),O=f):O=f.replace(this.rules.other.tabCharGlobal," "),L.test(f)||k.test(f)||$.test(f)||R.test(f)||w.test(f)||j.test(f))break;if(O.search(this.rules.other.nonSpaceChar)>=h||!f.trim())c+=`
|
|
32
|
+
`+O.slice(h);else{if(g||p.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||L.test(p)||k.test(p)||j.test(p))break;c+=`
|
|
33
|
+
`+f}g=!f.trim(),u+=T+`
|
|
34
|
+
`,e=e.substring(T.length+1),p=O.slice(h)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(o=!0)),s.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(c),loose:!1,text:c,tokens:[]}),s.raw+=u}let i=s.items.at(-1);if(i)i.raw=i.raw.trimEnd(),i.text=i.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let l of s.items)if(this.lexer.state.top=!1,l.tokens=this.lexer.blockTokens(l.text,[]),!s.loose){let u=l.tokens.filter(p=>p.type==="space"),c=u.length>0&&u.some(p=>this.rules.other.anyLine.test(p.raw));s.loose=c}for(let l of s.items){let u=l.tokens[0];if(l.task&&(u?.type==="text"||u?.type==="paragraph")){l.text=l.text.replace(this.rules.other.listReplaceTask,""),u.raw=u.raw.replace(this.rules.other.listReplaceTask,""),u.text=u.text.replace(this.rules.other.listReplaceTask,"");for(let p=this.lexer.inlineQueue.length-1;p>=0;p--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[p].src)){this.lexer.inlineQueue[p].src=this.lexer.inlineQueue[p].src.replace(this.rules.other.listReplaceTask,"");break}let c=this.rules.other.listTaskCheckbox.exec(l.raw);if(c){let p={type:"checkbox",raw:c[0]+" ",checked:c[0]!=="[ ]"};l.checked=p.checked,s.loose?l.tokens[0]&&["paragraph","text"].includes(l.tokens[0].type)&&"tokens"in l.tokens[0]&&l.tokens[0].tokens?(l.tokens[0].raw=p.raw+l.tokens[0].raw,l.tokens[0].text=p.raw+l.tokens[0].text,l.tokens[0].tokens.unshift(p)):l.tokens.unshift({type:"paragraph",raw:p.raw,text:p.raw,tokens:[p]}):l.tokens.unshift(p)}}else l.task&&(l.task=!1)}if(s.loose)for(let l of s.items){l.loose=!0;for(let u of l.tokens)u.type==="text"&&(u.type="paragraph")}return s}}html(e){let t=this.rules.block.html.exec(e);if(t){let a=Jo(t[0]);return{type:"html",block:!0,raw:a,pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:a}}}def(e){let t=this.rules.block.def.exec(e);if(t){let a=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:a,raw:kt(t[0],`
|
|
35
35
|
`),href:n,title:s}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let a=Ko(t[1]),n=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
36
36
|
`):[],r={type:"table",raw:kt(t[0],`
|
|
37
37
|
`),header:[],align:[],rows:[]};if(a.length===n.length){for(let o of n)this.rules.other.tableAlignRight.test(o)?r.align.push("right"):this.rules.other.tableAlignCenter.test(o)?r.align.push("center"):this.rules.other.tableAlignLeft.test(o)?r.align.push("left"):r.align.push(null);for(let o=0;o<a.length;o++)r.header.push({text:a[o],tokens:this.lexer.inline(a[o]),header:!0,align:r.align[o]});for(let o of s)r.rows.push(Ko(o,r.header.length).map((i,l)=>({text:i,tokens:this.lexer.inline(i),header:!1,align:r.align[l]})));return r}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let a=t[1].trim();return{type:"heading",raw:kt(t[0],`
|
|
38
38
|
`),depth:t[2].charAt(0)==="="?1:2,text:a,tokens:this.lexer.inline(a)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let a=t[1].charAt(t[1].length-1)===`
|
|
39
|
-
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:a,tokens:this.lexer.inline(a)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let a=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(a)){if(!this.rules.other.endAngleBracket.test(a))return;let r=kt(a.slice(0,-1),"\\");if((a.length-r.length)%2===0)return}else{let r=em(t[2],"()");if(r===-2)return;if(r>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+r;t[2]=t[2].substring(0,r),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let n=t[2],s="";if(this.options.pedantic){let r=this.rules.other.pedanticHrefTitle.exec(n);r&&(n=r[1],s=r[3])}else s=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(a)?n=n.slice(1):n=n.slice(1,-1)),Qo(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let a;if((a=this.rules.inline.reflink.exec(e))||(a=this.rules.inline.nolink.exec(e))){let n=(a[2]||a[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=t[n.toLowerCase()];if(!s){let r=a[0].charAt(0);return{type:"text",raw:r,text:r}}return Qo(a,s,a[0],this.lexer,this.rules)}}emStrong(e,t,a=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!(!n||!n[1]&&!n[2]&&!n[3]&&!n[4]||n[4]&&a.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[3])||!a||this.rules.inline.punctuation.exec(a))){let s=[...n[0]].length-1,r,o,i=s,l=0,u=n[0][0],c=a===u,p=u==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,t=t.slice(-1*e.length+s);(n=p.exec(t))!==null;){if(r=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!r)continue;if(o=[...r].length,n[3]||n[4]){i+=o;continue}else if(n[5]||n[6]){if(s%3&&!((s+o)%3)){l+=o;continue}if(c)break}if(i-=o,i>0)continue;o=Math.min(o,o+i+l);let f=[...n[0]][0].length,
|
|
39
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:a,tokens:this.lexer.inline(a)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let a=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(a)){if(!this.rules.other.endAngleBracket.test(a))return;let r=kt(a.slice(0,-1),"\\");if((a.length-r.length)%2===0)return}else{let r=em(t[2],"()");if(r===-2)return;if(r>-1){let o=(t[0].indexOf("!")===0?5:4)+t[1].length+r;t[2]=t[2].substring(0,r),t[0]=t[0].substring(0,o).trim(),t[3]=""}}let n=t[2],s="";if(this.options.pedantic){let r=this.rules.other.pedanticHrefTitle.exec(n);r&&(n=r[1],s=r[3])}else s=t[3]?t[3].slice(1,-1):"";return n=n.trim(),this.rules.other.startAngleBracket.test(n)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(a)?n=n.slice(1):n=n.slice(1,-1)),Qo(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let a;if((a=this.rules.inline.reflink.exec(e))||(a=this.rules.inline.nolink.exec(e))){let n=(a[2]||a[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=t[n.toLowerCase()];if(!s){let r=a[0].charAt(0);return{type:"text",raw:r,text:r}}return Qo(a,s,a[0],this.lexer,this.rules)}}emStrong(e,t,a=""){let n=this.rules.inline.emStrongLDelim.exec(e);if(!(!n||!n[1]&&!n[2]&&!n[3]&&!n[4]||n[4]&&a.match(this.rules.other.unicodeAlphaNumeric))&&(!(n[1]||n[3])||!a||this.rules.inline.punctuation.exec(a))){let s=[...n[0]].length-1,r,o,i=s,l=0,u=n[0][0],c=a===u,p=u==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(p.lastIndex=0,t=t.slice(-1*e.length+s);(n=p.exec(t))!==null;){if(r=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!r)continue;if(o=[...r].length,n[3]||n[4]){i+=o;continue}else if(n[5]||n[6]){if(s%3&&!((s+o)%3)){l+=o;continue}if(c)break}if(i-=o,i>0)continue;o=Math.min(o,o+i+l);let f=[...n[0]][0].length,g=e.slice(0,s+n.index+f+o);if(Math.min(s,o)%2){let w=g.slice(1,-1);return{type:"em",raw:g,text:w,tokens:this.lexer.inlineTokens(w)}}let h=g.slice(2,-2);return{type:"strong",raw:g,text:h,tokens:this.lexer.inlineTokens(h)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let a=t[2].replace(this.rules.other.newLineCharGlobal," "),n=this.rules.other.nonSpaceChar.test(a),s=this.rules.other.startingSpaceChar.test(a)&&this.rules.other.endingSpaceChar.test(a);return n&&s&&(a=a.substring(1,a.length-1)),{type:"codespan",raw:t[0],text:a}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e,t,a=""){let n=this.rules.inline.delLDelim.exec(e);if(n&&(!n[1]||!a||this.rules.inline.punctuation.exec(a))){let s=[...n[0]].length-1,r,o,i=s,l=this.rules.inline.delRDelim;for(l.lastIndex=0,t=t.slice(-1*e.length+s);(n=l.exec(t))!==null;){if(r=n[1]||n[2]||n[3]||n[4]||n[5]||n[6],!r||(o=[...r].length,o!==s))continue;if(n[3]||n[4]){i+=o;continue}if(i-=o,i>0)continue;o=Math.min(o,o+i);let u=[...n[0]][0].length,c=e.slice(0,s+n.index+u+o),p=c.slice(s,-s);return{type:"del",raw:c,text:p,tokens:this.lexer.inlineTokens(p)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let a,n;return t[2]==="@"?(a=t[1],n="mailto:"+a):(a=t[1],n=a),{type:"link",raw:t[0],text:a,href:n,autolink:!0,tokens:[{type:"text",raw:a,text:a}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let a,n;if(t[2]==="@")a=t[0],n="mailto:"+a;else{let s;do s=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(s!==t[0]);a=t[0],t[1]==="www."?n="http://"+t[0]:n=t[0]}return{type:"link",raw:t[0],text:a,href:n,autolink:!0,tokens:[{type:"text",raw:a,text:a}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let a=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:a}}}},Ve=class Us{tokens;options;state;inlineQueue;tokenizer;constructor(t){this.tokens=[],this.tokens.links=Object.create(null),this.options=t||qt,this.options.tokenizer=this.options.tokenizer||new Rn,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let a={other:$e,block:Pn.normal,inline:Ba.normal};this.options.pedantic?(a.block=Pn.pedantic,a.inline=Ba.pedantic):this.options.gfm&&(a.block=Pn.gfm,this.options.breaks?a.inline=Ba.breaks:a.inline=Ba.gfm),this.tokenizer.rules=a}static get rules(){return{block:Pn,inline:Ba}}static lex(t,a){return new Us(a).lex(t)}static lexInline(t,a){return new Us(a).inlineTokens(t)}lex(t){t=t.replace($e.carriageReturn,`
|
|
40
40
|
`),this.blockTokens(t,this.tokens);for(let a=0;a<this.inlineQueue.length;a++){let n=this.inlineQueue[a];this.inlineTokens(n.src,n.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,a=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace($e.tabCharGlobal," ").replace($e.spaceLine,""));let s=1/0;for(;t;){if(t.length<s)s=t.length;else{this.infiniteLoopError(t.charCodeAt(0));break}let r;if(this.options.extensions?.block?.some(i=>(r=i.call({lexer:this},t,a))?(t=t.substring(r.raw.length),a.push(r),!0):!1))continue;if(r=this.tokenizer.space(t)){t=t.substring(r.raw.length);let i=a.at(-1);r.raw.length===1&&i!==void 0?i.raw+=`
|
|
41
41
|
`:a.push(r);continue}if(r=this.tokenizer.code(t)){t=t.substring(r.raw.length);let i=a.at(-1);i?.type==="paragraph"||i?.type==="text"?(i.raw+=(i.raw.endsWith(`
|
|
42
42
|
`)?"":`
|
|
@@ -71,10 +71,10 @@ ${e}</tr>
|
|
|
71
71
|
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Be(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:a,tokens:n,autolink:s}){let r=s?Be(a,!0):this.parser.parseInline(n),o=Zo(e);if(o===null)return r;e=Be(o,s);let i='<a href="'+e+'"';return t&&(i+=' title="'+Be(t)+'"'),i+=">"+r+"</a>",i}image({href:e,title:t,text:a,tokens:n}){n&&(a=this.parser.parseInline(n,this.parser.textRenderer));let s=Zo(e);if(s===null)return Be(a);e=s;let r=`<img src="${Be(e)}" alt="${Be(a)}"`;return t&&(r+=` title="${Be(t)}"`),r+=">",r}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Be(e.text)}},Ys=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}checkbox({raw:e}){return e}},Xe=class Hs{options;renderer;textRenderer;constructor(t){this.options=t||qt,this.options.renderer=this.options.renderer||new En,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Ys}static parse(t,a){return new Hs(a).parse(t)}static parseInline(t,a){return new Hs(a).parseInline(t)}parse(t){this.renderer.parser=this;let a="";for(let n=0;n<t.length;n++){let s=t[n];if(this.options.extensions?.renderers?.[s.type]){let o=s,i=this.options.extensions.renderers[o.type].call({parser:this},o);if(i!==!1||!["space","hr","heading","code","table","blockquote","list","checkbox","html","def","paragraph","text"].includes(o.type)){a+=i||"";continue}}let r=s;switch(r.type){case"space":{a+=this.renderer.space(r);break}case"hr":{a+=this.renderer.hr(r);break}case"heading":{a+=this.renderer.heading(r);break}case"code":{a+=this.renderer.code(r);break}case"table":{a+=this.renderer.table(r);break}case"blockquote":{a+=this.renderer.blockquote(r);break}case"list":{a+=this.renderer.list(r);break}case"checkbox":{a+=this.renderer.checkbox(r);break}case"html":{a+=this.renderer.html(r);break}case"def":{a+=this.renderer.def(r);break}case"paragraph":{a+=this.renderer.paragraph(r);break}case"text":{a+=this.renderer.text(r);break}default:{let o='Token with "'+r.type+'" type was not found.';if(this.options.silent)return console.error(o),"";throw new Error(o)}}}return a}parseInline(t,a=this.renderer){this.renderer.parser=this;let n="";for(let s=0;s<t.length;s++){let r=t[s];if(this.options.extensions?.renderers?.[r.type]){let i=this.options.extensions.renderers[r.type].call({parser:this},r);if(i!==!1||!["escape","html","link","image","checkbox","strong","em","codespan","br","del","text"].includes(r.type)){n+=i||"";continue}}let o=r;switch(o.type){case"escape":{n+=a.text(o);break}case"html":{n+=a.html(o);break}case"link":{n+=a.link(o);break}case"image":{n+=a.image(o);break}case"checkbox":{n+=a.checkbox(o);break}case"strong":{n+=a.strong(o);break}case"em":{n+=a.em(o);break}case"codespan":{n+=a.codespan(o);break}case"br":{n+=a.br(o);break}case"del":{n+=a.del(o);break}case"text":{n+=a.text(o);break}default:{let i='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(i),"";throw new Error(i)}}}return n}},qa=class{options;block;constructor(e){this.options=e||qt}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens","emStrongMask"]);static passThroughHooksRespectAsync=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?Ve.lex:Ve.lexInline}provideParser(e=this.block){return e?Xe.parse:Xe.parseInline}},nm=class{defaults=Ws();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Xe;Renderer=En;TextRenderer=Ys;Lexer=Ve;Tokenizer=Rn;Hooks=qa;constructor(...e){this.use(...e)}walkTokens(e,t){let a=[];for(let n of e)switch(a=a.concat(t.call(this,n)),n.type){case"table":{let s=n;for(let r of s.header)a=a.concat(this.walkTokens(r.tokens,t));for(let r of s.rows)for(let o of r)a=a.concat(this.walkTokens(o.tokens,t));break}case"list":{let s=n;a=a.concat(this.walkTokens(s.items,t));break}default:{let s=n;this.defaults.extensions?.childTokens?.[s.type]?this.defaults.extensions.childTokens[s.type].forEach(r=>{let o=s[r].flat(1/0);a=a.concat(this.walkTokens(o,t))}):s.tokens&&(a=a.concat(this.walkTokens(s.tokens,t)))}}return a}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(a=>{let n={...a};if(n.async=this.defaults.async||n.async||!1,a.extensions&&(a.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){let r=t.renderers[s.name];r?t.renderers[s.name]=function(...o){let i=s.renderer.apply(this,o);return i===!1&&(i=r.apply(this,o)),i}:t.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let r=t[s.level];r?r.unshift(s.tokenizer):t[s.level]=[s.tokenizer],s.start&&(s.level==="block"?t.startBlock?t.startBlock.push(s.start):t.startBlock=[s.start]:s.level==="inline"&&(t.startInline?t.startInline.push(s.start):t.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(t.childTokens[s.name]=s.childTokens)}),n.extensions=t),a.renderer){let s=this.defaults.renderer||new En(this.defaults);for(let r in a.renderer){if(!(r in s))throw new Error(`renderer '${r}' does not exist`);if(["options","parser"].includes(r))continue;let o=r,i=a.renderer[o],l=s[o];s[o]=(...u)=>{let c=i.apply(s,u);return c===!1&&(c=l.apply(s,u)),c||""}}n.renderer=s}if(a.tokenizer){let s=this.defaults.tokenizer||new Rn(this.defaults);for(let r in a.tokenizer){if(!(r in s))throw new Error(`tokenizer '${r}' does not exist`);if(["options","rules","lexer"].includes(r))continue;let o=r,i=a.tokenizer[o],l=s[o];s[o]=(...u)=>{let c=i.apply(s,u);return c===!1&&(c=l.apply(s,u)),c}}n.tokenizer=s}if(a.hooks){let s=this.defaults.hooks||new qa;for(let r in a.hooks){if(!(r in s))throw new Error(`hook '${r}' does not exist`);if(["options","block"].includes(r))continue;let o=r,i=a.hooks[o],l=s[o];qa.passThroughHooks.has(r)?s[o]=u=>{if(this.defaults.async&&qa.passThroughHooksRespectAsync.has(r))return(async()=>{let p=await i.call(s,u);return l.call(s,p)})();let c=i.call(s,u);return l.call(s,c)}:s[o]=(...u)=>{if(this.defaults.async)return(async()=>{let p=await i.apply(s,u);return p===!1&&(p=await l.apply(s,u)),p})();let c=i.apply(s,u);return c===!1&&(c=l.apply(s,u)),c}}n.hooks=s}if(a.walkTokens){let s=this.defaults.walkTokens,r=a.walkTokens;n.walkTokens=function(o){let i=[];return i.push(r.call(this,o)),s&&(i=i.concat(s.call(this,o))),i}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return Ve.lex(e,t??this.defaults)}parser(e,t){return Xe.parse(e,t??this.defaults)}parseMarkdown(e){return(t,a)=>{let n={...a},s={...this.defaults,...n},r=this.onError(!!s.silent,!!s.async);if(this.defaults.async===!0&&n.async===!1)return r(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return r(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return r(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(s.hooks&&(s.hooks.options=s,s.hooks.block=e),s.async)return(async()=>{let o=s.hooks?await s.hooks.preprocess(t):t,i=await(s.hooks?await s.hooks.provideLexer(e):e?Ve.lex:Ve.lexInline)(o,s),l=s.hooks?await s.hooks.processAllTokens(i):i;s.walkTokens&&await Promise.all(this.walkTokens(l,s.walkTokens));let u=await(s.hooks?await s.hooks.provideParser(e):e?Xe.parse:Xe.parseInline)(l,s);return s.hooks?await s.hooks.postprocess(u):u})().catch(r);try{s.hooks&&(t=s.hooks.preprocess(t));let o=(s.hooks?s.hooks.provideLexer(e):e?Ve.lex:Ve.lexInline)(t,s);s.hooks&&(o=s.hooks.processAllTokens(o)),s.walkTokens&&this.walkTokens(o,s.walkTokens);let i=(s.hooks?s.hooks.provideParser(e):e?Xe.parse:Xe.parseInline)(o,s);return s.hooks&&(i=s.hooks.postprocess(i)),i}catch(o){return r(o)}}}onError(e,t){return a=>{if(a.message+=`
|
|
72
72
|
Please report this to https://github.com/markedjs/marked.`,e){let n="<p>An error occurred:</p><pre>"+Be(a.message+"",!0)+"</pre>";return t?Promise.resolve(n):n}if(t)return Promise.reject(a);throw a}}},Bt=new nm;function W(e,t){return Bt.parse(e,t)}W.options=W.setOptions=function(e){return Bt.setOptions(e),W.defaults=Bt.defaults,Yo(W.defaults),W};W.getDefaults=Ws;W.defaults=qt;function sm(...e){return Bt.use(...e),W.defaults=Bt.defaults,Yo(W.defaults),W}W.use=sm;W.walkTokens=function(e,t){return Bt.walkTokens(e,t)};W.parseInline=Bt.parseInline;W.Parser=Xe;W.parser=Xe.parse;W.Renderer=En;W.TextRenderer=Ys;W.Lexer=Ve;W.lexer=Ve.lex;W.Tokenizer=Rn;W.Hooks=qa;W.parse=W;var Cy=W.options,Ly=W.setOptions,jy=W.walkTokens,vy=W.parseInline;var Sy=Xe.parse,Iy=Ve.lex;function mi(e){if(typeof e=="function"&&(e={highlight:e}),!e||typeof e.highlight!="function")throw new Error("Must provide highlight function");return typeof e.langPrefix!="string"&&(e.langPrefix="language-"),typeof e.emptyLangClass!="string"&&(e.emptyLangClass=""),{async:!!e.async,walkTokens(t){if(t.type!=="code")return;let a=ui(t.lang);if(e.async)return Promise.resolve(e.highlight(t.text,a,t.lang||"")).then(ci(t));let n=e.highlight(t.text,a,t.lang||"");if(n instanceof Promise)throw new Error("markedHighlight is not set to async but the highlight function is async. Set the async option to true on markedHighlight to await the async highlight function.");ci(t)(n)},useNewRenderer:!0,renderer:{code(t,a,n){typeof t=="object"&&(n=t.escaped,a=t.lang,t=t.text);let s=ui(a),r=s?e.langPrefix+pi(s):e.emptyLangClass,o=r?` class="${r}"`:"";return t=t.replace(/\n$/,""),`<pre><code${o}>${n?t:pi(t,!0)}
|
|
73
73
|
</code></pre>`}}}}function ui(e){return(e||"").match(/\S*/)[0]}function ci(e){return t=>{typeof t=="string"&&t!==e.text&&(e.escaped=!0,e.text=t)}}var fi=/[&<>"']/,rm=new RegExp(fi.source,"g"),gi=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,om=new RegExp(gi.source,"g"),im={"&":"&","<":"<",">":">",'"':""","'":"'"},di=e=>im[e];function pi(e,t){if(t){if(fi.test(e))return e.replace(rm,di)}else if(gi.test(e))return e.replace(om,di);return e}function hi(e,t){(t==null||t>e.length)&&(t=e.length);for(var a=0,n=Array(t);a<t;a++)n[a]=e[a];return n}function lm(e){if(Array.isArray(e))return e}function um(e,t){var a=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(a!=null){var n,s,r,o,i=[],l=!0,u=!1;try{if(r=(a=a.call(e)).next,t!==0)for(;!(l=(n=r.call(a)).done)&&(i.push(n.value),i.length!==t);l=!0);}catch(c){u=!0,s=c}finally{try{if(!l&&a.return!=null&&(o=a.return(),Object(o)!==o))return}finally{if(u)throw s}}return i}}function cm(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
74
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dm(e,t){return lm(e)||um(e,t)||pm(e,t)||cm()}function pm(e,t){if(e){if(typeof e=="string")return hi(e,t);var a={}.toString.call(e).slice(8,-1);return a==="Object"&&e.constructor&&(a=e.constructor.name),a==="Map"||a==="Set"?Array.from(e):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?hi(e,t):void 0}}var Pi=Object.entries,bi=Object.setPrototypeOf,mm=Object.isFrozen,fm=Object.getPrototypeOf,gm=Object.getOwnPropertyDescriptor,me=Object.freeze,be=Object.seal,ua=Object.create,Ti=typeof Reflect<"u"&&Reflect,or=Ti.apply,ir=Ti.construct;me||(me=function(t){return t});be||(be=function(t){return t});or||(or=function(t,a){for(var n=arguments.length,s=new Array(n>2?n-2:0),r=2;r<n;r++)s[r-2]=arguments[r];return t.apply(a,s)});ir||(ir=function(t){for(var a=arguments.length,n=new Array(a>1?a-1:0),s=1;s<a;s++)n[s-1]=arguments[s];return new t(...n)});var Nt=de(Array.prototype.forEach),hm=de(Array.prototype.lastIndexOf),yi=de(Array.prototype.pop),Oa=de(Array.prototype.push),bm=de(Array.prototype.splice),ca=Array.isArray,za=de(String.prototype.toLowerCase),er=de(String.prototype.toString),xi=de(String.prototype.match),Fa=de(String.prototype.replace),_i=de(String.prototype.indexOf),ym=de(String.prototype.trim),xm=de(Number.prototype.toString),_m=de(Boolean.prototype.toString),ki=typeof BigInt>"u"?null:de(BigInt.prototype.toString),wi=typeof Symbol>"u"?null:de(Symbol.prototype.toString),Re=de(Object.prototype.hasOwnProperty),Ga=de(Object.prototype.toString),Ce=de(RegExp.prototype.test),Dt=km(TypeError);function de(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var a=arguments.length,n=new Array(a>1?a-1:0),s=1;s<a;s++)n[s-1]=arguments[s];return or(e,t,n)}}function km(e){return function(){for(var t=arguments.length,a=new Array(t),n=0;n<t;n++)a[n]=arguments[n];return ir(e,a)}}function H(e,t){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:za;if(bi&&bi(e,null),!ca(t))return e;let n=t.length;for(;n--;){let s=t[n];if(typeof s=="string"){let r=a(s);r!==s&&(mm(t)||(t[n]=r),s=r)}e[s]=!0}return e}function wm(e){for(let t=0;t<e.length;t++)Re(e,t)||(e[t]=null);return e}function De(e){let t=ua(null);for(let n of Pi(e)){var a=dm(n,2);let s=a[0],r=a[1];Re(e,s)&&(ca(r)?t[s]=wm(r):r&&typeof r=="object"&&r.constructor===Object?t[s]=De(r):t[s]=r)}return t}function $m(e){switch(typeof e){case"string":return e;case"number":return xm(e);case"boolean":return _m(e);case"bigint":return ki?ki(e):"0";case"symbol":return wi?wi(e):"Symbol()";case"undefined":return Ga(e);case"function":case"object":{if(e===null)return Ga(e);let t=e,a=Fe(t,"toString");if(typeof a=="function"){let n=a(t);return typeof n=="string"?n:Ga(n)}return Ga(e)}default:return Ga(e)}}function Fe(e,t){for(;e!==null;){let n=gm(e,t);if(n){if(n.get)return de(n.get);if(typeof n.value=="function")return de(n.value)}e=fm(e)}function a(){return null}return a}function Cm(e){try{return Ce(e,""),!0}catch{return!1}}var $i=me(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),tr=me(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ar=me(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Lm=me(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),nr=me(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),jm=me(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ci=me(["#text"]),Li=me(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),sr=me(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ji=me(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Bn=me(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),vm=be(/{{[\w\W]*|^[\w\W]*}}/g),Sm=be(/<%[\w\W]*|^[\w\W]*%>/g),Im=be(/\${[\w\W]*/g),Am=be(/^data-[\-\w.\u00B7-\uFFFF]+$/),Pm=be(/^aria-[\-\w]+$/),vi=be(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Tm=be(/^(?:\w+script|data):/i),Rm=be(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Em=be(/^html$/i),Mm=be(/^[a-z][.\w]*(-[.\w]+)+$/i),Si=be(/<[/\w!]/g),Ii=be(/<[/\w]/g),Bm=be(/<\/no(script|embed|frames)/i),qm=be(/\/>/i),qe={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Ri=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],Dm=me(H({},Ri)),Nm=(function(){let e={};return Nt(Ri,t=>{e[t]=be(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),me(e)})(),Om=function(){return typeof window>"u"?null:window},Fm=function(t,a){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null,s="data-tt-policy-suffix";a&&a.hasAttribute(s)&&(n=a.getAttribute(s));let r="dompurify"+(n?"#"+n:"");try{return t.createPolicy(r,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},Ai=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},wt=function(t,a,n,s){return Re(t,a)&&ca(t[a])?H(s.base?De(s.base):{},t[a],s.transform):n},rr=function(t,a,n){let s=Re(t,a)?t[a]:void 0;return s&&typeof s=="object"?De(s):n()};function Ei(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Om(),t=I=>Ei(I);if(t.version="3.4.15",t.removed=[],!e||!e.document||e.document.nodeType!==qe.document||!e.Element)return t.isSupported=!1,t;let a=e.document,n=a,s=n.currentScript;e.DocumentFragment;let r=e.HTMLTemplateElement,o=e.Node,i=e.Element,l=e.NodeFilter,u=e.NamedNodeMap;u===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let c=e.DOMParser,p=e.trustedTypes,f=i.prototype,h=Fe(f,"cloneNode"),g=Fe(f,"remove"),$=Fe(f,"removeAttributeNode"),j=Fe(f,"nextSibling"),L=Fe(f,"childNodes"),k=Fe(f,"parentNode"),w=Fe(f,"shadowRoot"),R=Fe(f,"attributes"),T=o&&o.prototype?Fe(o.prototype,"nodeType"):null,O=o&&o.prototype?Fe(o.prototype,"nodeName"):null,Q=o&&o.prototype?Fe(o.prototype,"ownerDocument"):null,Y=function(m){return T?T(m):m.nodeType},Oe=function(m){return O?O(m):m.nodeName};if(typeof r=="function"){let I=a.createElement("template");I.content&&I.content.ownerDocument&&(a=I.content.ownerDocument)}let ee,xe="",oe,Ae=!1,We=0,we=function(){if(We>0)throw Dt('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},_e=function(m){we(),We++;try{return ee.createHTML(m)}finally{We--}},bt=function(m){we(),We++;try{return ee.createScriptURL(m)}finally{We--}},At=function(){return Ae||(oe=Fm(p,s),Ae=!0),oe},Pt=a,ea=Pt.implementation,Ta=Pt.createNodeIterator,_=Pt.createDocumentFragment,S=Pt.getElementsByTagName,P=n.importNode,E=Ai();t.isSupported=typeof Pi=="function"&&typeof k=="function"&&ea&&ea.createHTMLDocument!==void 0;let ce=vm,je=Sm,se=Im,Je=Am,Qe=Pm,yn=Tm,ho=Rm,Nd=Mm,bo=vi,te=null,vs=H({},[...$i,...tr,...ar,...nr,...Ci]),ae=null,Ss=H({},[...Li,...sr,...ji,...Bn]),Ye=Object.seal(ua(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ra=null,yo=null,yt=Object.seal(ua(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),xo=!0,Is=!0,_o=!1,ko=!0,xt=!1,Tt=!0,Rt=!1,As=!1,xn=null,_n=null,Ps=!1,ta=!1,kn=!1,wn=!1,wo=!0,$o=!1,Co="user-content-",Ts=!0,Rs=!1,aa={},na=null,Lo=H({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]),jo=null,vo=H({},["audio","video","img","source","image","track"]),So=null,Io=H({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),$n="http://www.w3.org/1998/Math/MathML",Cn="http://www.w3.org/2000/svg",et="http://www.w3.org/1999/xhtml",sa=et,Es=!1,Ms=null,Od=H({},[$n,Cn,et],er),Ao=me(["mi","mo","mn","ms","mtext"]),Bs=H({},Ao),Po=me(["annotation-xml"]),qs=H({},Po),Fd=H({},["title","style","font","a","script"]),Ea=null,Gd=["application/xhtml+xml","text/html"],zd="text/html",ie=null,ra=null,Ud=a.createElement("form"),To=function(m){return m instanceof RegExp||m instanceof Function},Ds=function(){let m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ra&&ra===m)return;(!m||typeof m!="object")&&(m={}),m=De(m),Ea=Gd.indexOf(m.PARSER_MEDIA_TYPE)===-1?zd:m.PARSER_MEDIA_TYPE,ie=Ea==="application/xhtml+xml"?er:za,te=wt(m,"ALLOWED_TAGS",vs,{transform:ie}),ae=wt(m,"ALLOWED_ATTR",Ss,{transform:ie}),Ms=wt(m,"ALLOWED_NAMESPACES",Od,{transform:er}),So=wt(m,"ADD_URI_SAFE_ATTR",Io,{transform:ie,base:Io}),jo=wt(m,"ADD_DATA_URI_TAGS",vo,{transform:ie,base:vo}),na=wt(m,"FORBID_CONTENTS",Lo,{transform:ie}),Ra=wt(m,"FORBID_TAGS",De({}),{transform:ie}),yo=wt(m,"FORBID_ATTR",De({}),{transform:ie}),aa=Re(m,"USE_PROFILES")?m.USE_PROFILES&&typeof m.USE_PROFILES=="object"?De(m.USE_PROFILES):m.USE_PROFILES:!1,xo=m.ALLOW_ARIA_ATTR!==!1,Is=m.ALLOW_DATA_ATTR!==!1,_o=m.ALLOW_UNKNOWN_PROTOCOLS||!1,ko=m.ALLOW_SELF_CLOSE_IN_ATTR!==!1,xt=m.SAFE_FOR_TEMPLATES||!1,Tt=m.SAFE_FOR_XML!==!1,Rt=m.WHOLE_DOCUMENT||!1,ta=m.RETURN_DOM||!1,kn=m.RETURN_DOM_FRAGMENT||!1,wn=m.RETURN_TRUSTED_TYPE||!1,Ps=m.FORCE_BODY||!1,wo=m.SANITIZE_DOM!==!1,$o=m.SANITIZE_NAMED_PROPS||!1,Ts=m.KEEP_CONTENT!==!1,Rs=m.IN_PLACE||!1,bo=Cm(m.ALLOWED_URI_REGEXP)?m.ALLOWED_URI_REGEXP:vi,sa=typeof m.NAMESPACE=="string"?m.NAMESPACE:et,Bs=rr(m,"MATHML_TEXT_INTEGRATION_POINTS",()=>H({},Ao)),qs=rr(m,"HTML_INTEGRATION_POINTS",()=>H({},Po));let y=rr(m,"CUSTOM_ELEMENT_HANDLING",()=>ua(null));if(Ye=ua(null),Re(y,"tagNameCheck")&&To(y.tagNameCheck)&&(Ye.tagNameCheck=y.tagNameCheck),Re(y,"attributeNameCheck")&&To(y.attributeNameCheck)&&(Ye.attributeNameCheck=y.attributeNameCheck),Re(y,"allowCustomizedBuiltInElements")&&typeof y.allowCustomizedBuiltInElements=="boolean"&&(Ye.allowCustomizedBuiltInElements=y.allowCustomizedBuiltInElements),be(Ye),xt&&(Is=!1),kn&&(ta=!0),aa&&(te=H({},Ci),ae=ua(null),aa.html===!0&&(H(te,$i),H(ae,Li)),aa.svg===!0&&(H(te,tr),H(ae,sr),H(ae,Bn)),aa.svgFilters===!0&&(H(te,ar),H(ae,sr),H(ae,Bn)),aa.mathMl===!0&&(H(te,nr),H(ae,ji),H(ae,Bn))),yt.tagCheck=null,yt.attributeCheck=null,Re(m,"ADD_TAGS")&&(typeof m.ADD_TAGS=="function"?yt.tagCheck=m.ADD_TAGS:ca(m.ADD_TAGS)&&(te===vs&&(te=De(te)),H(te,m.ADD_TAGS,ie))),Re(m,"ADD_ATTR")&&(typeof m.ADD_ATTR=="function"?yt.attributeCheck=m.ADD_ATTR:ca(m.ADD_ATTR)&&(ae===Ss&&(ae=De(ae)),H(ae,m.ADD_ATTR,ie))),Re(m,"ADD_FORBID_CONTENTS")&&ca(m.ADD_FORBID_CONTENTS)&&(na===Lo&&(na=De(na)),H(na,m.ADD_FORBID_CONTENTS,ie)),Ts&&(te["#text"]=!0),Rt&&H(te,["html","head","body"]),te.table&&(H(te,["tbody"]),delete Ra.tbody),m.TRUSTED_TYPES_POLICY){if(typeof m.TRUSTED_TYPES_POLICY.createHTML!="function")throw Dt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof m.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Dt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let C=ee;ee=m.TRUSTED_TYPES_POLICY;try{xe=_e("")}catch(A){throw ee=C,A}}else m.TRUSTED_TYPES_POLICY===null?(ee=void 0,xe=""):(ee===void 0&&(ee=At()),ee&&typeof xe=="string"&&(xe=_e("")));me&&me(m),ra=m},Ro=H({},[...tr,...ar,...Lm]),Eo=H({},[...nr,...jm]),Hd=function(m,y,C){return y.namespaceURI===et?m==="svg":y.namespaceURI===$n?m==="svg"&&(C==="annotation-xml"||Bs[C]):!!Ro[m]},Wd=function(m,y,C){return y.namespaceURI===et?m==="math":y.namespaceURI===Cn?m==="math"&&qs[C]:!!Eo[m]},Vd=function(m,y,C){return y.namespaceURI===Cn&&!qs[C]||y.namespaceURI===$n&&!Bs[C]?!1:!Eo[m]&&(Fd[m]||!Ro[m])},Xd=function(m){let y=k(m);(!y||!y.tagName)&&(y={namespaceURI:sa,tagName:"template"});let C=za(m.tagName),A=za(y.tagName);return Ms[m.namespaceURI]?m.namespaceURI===Cn?Hd(C,y,A):m.namespaceURI===$n?Wd(C,y,A):m.namespaceURI===et?Vd(C,y,A):!!(Ea==="application/xhtml+xml"&&Ms[m.namespaceURI]):!1},_t=function(m){Oa(t.removed,{element:m});try{k(m).removeChild(m)}catch{if(g(m),!k(m))throw Dt("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Mo=function(m,y,C){try{$(m,y)}catch{try{m.removeAttribute(C)}catch{}}},Ln=function(m){jn(m);let y=L(m);if(y){let A=[];Nt(y,M=>{Oa(A,M)}),Nt(A,M=>{try{g(M)}catch{}})}let C=R(m);if(C)for(let A=C.length-1;A>=0;--A){let M=C[A],D=M&&M.name;typeof D=="string"&&Mo(m,M,D)}},Et=function(m,y,C){if(!C)try{C=y.getAttributeNode(m)}catch{C=null}Oa(t.removed,{attribute:C||null,from:y});try{C?$(y,C):y.removeAttribute(m)}catch{try{y.removeAttribute(m)}catch{}}if(m==="is")if(ta||kn)try{_t(y)}catch{}else try{y.setAttribute(m,"")}catch{}},Zd=function(m){let y=R(m);if(y)for(let C=y.length-1;C>=0;--C){let A=y[C],M=A&&A.name;typeof M!="string"||ae[ie(M)]||Mo(m,A,M)}},jn=function(m){let y=[m];for(;y.length>0;){let C=y.pop();Y(C)===qe.element&&Zd(C);let M=L(C);if(M)for(let D=M.length-1;D>=0;--D)y.push(M[D])}},Bo=function(m,y){return Tt?m==="patchsrc"?!0:m==="for"&&y!=="label"&&y!=="output":!1},Kd=function(m){if(!Tt)return;let y=[m];for(;y.length>0;){let C=y.pop(),A=Y(C);if(A===qe.processingInstruction||A===qe.comment&&Ce(Ii,C.data)){try{g(C)}catch{}continue}if(A===qe.element){let D=C,K=ie(Oe(C));try{D.hasAttribute&&D.hasAttribute("patchsrc")&&D.removeAttribute("patchsrc"),D.hasAttribute&&D.hasAttribute("for")&&Bo("for",K)&&D.removeAttribute("for")}catch{}}let M=L(C);if(M)for(let D=M.length-1;D>=0;--D)y.push(M[D])}},qo=function(m){let y=null,C=null;if(Ps)m="<remove></remove>"+m;else{let D=xi(m,/^[\r\n\t ]+/);C=D&&D[0]}Ea==="application/xhtml+xml"&&sa===et&&(m='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+m+"</body></html>");let A=ee?_e(m):m;if(sa===et)try{y=new c().parseFromString(A,Ea)}catch{}if(!y||!y.documentElement){y=ea.createDocument(sa,"template",null);try{y.documentElement.innerHTML=Es?xe:A}catch{}}let M=y.body||y.documentElement;return m&&C&&M.insertBefore(a.createTextNode(C),M.childNodes[0]||null),sa===et?S.call(y,Rt?"html":"body")[0]:Rt?y.documentElement:M},Do=function(m){let y=Q?Q(m):m.ownerDocument;return Ta.call(y||m,m,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},vn=function(m){return m=Fa(m,ce," "),m=Fa(m,je," "),m=Fa(m,se," "),m},Ns=function(m){var y;m.normalize();let C=Q?Q(m):m.ownerDocument,A=Ta.call(C||m,m,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null),M=A.nextNode();for(;M;)M.data=vn(M.data),M=A.nextNode();let D=(y=m.querySelectorAll)===null||y===void 0?void 0:y.call(m,"template");D&&Nt(D,K=>{oa(K.content)&&Ns(K.content)})},Sn=function(m){let y=O?O(m):null;return typeof y!="string"||ie(y)!=="form"?!1:typeof m.nodeName!="string"||typeof m.textContent!="string"||typeof m.removeChild!="function"||m.attributes!==R(m)||typeof m.removeAttribute!="function"||typeof m.removeAttributeNode!="function"||typeof m.getAttributeNode!="function"||typeof m.setAttribute!="function"||typeof m.namespaceURI!="string"||typeof m.insertBefore!="function"||typeof m.hasChildNodes!="function"||m.nodeType!==T(m)||m.childNodes!==L(m)},oa=function(m){if(!T||typeof m!="object"||m===null)return!1;try{return T(m)===qe.documentFragment}catch{return!1}},Ma=function(m){if(!T||typeof m!="object"||m===null)return!1;try{return typeof T(m)=="number"}catch{return!1}};function tt(I,m,y){I.length!==0&&Nt(I,C=>{C.call(t,m,y,ra)})}let Jd=function(m,y){return!!(Tt&&m.hasChildNodes()&&!Ma(m.firstElementChild)&&Ce(Si,m.textContent)&&Ce(Si,m.innerHTML)||Tt&&m.namespaceURI===et&&Dm[y]&&(Ma(m.firstElementChild)||typeof m.textContent=="string"&&Ce(Nm[y],m.textContent))||m.nodeType===qe.processingInstruction||Tt&&m.nodeType===qe.comment&&Ce(Ii,m.data))},In=function(m,y){if(m instanceof RegExp)return Ce(m,y);if(m instanceof Function){for(var C=arguments.length,A=new Array(C>2?C-2:0),M=2;M<C;M++)A[M-2]=arguments[M];return!!m(y,...A)}return!1},Qd=function(m,y,C){if(!Ra[y]&&zo(y)&&In(Ye.tagNameCheck,y))return!1;if(Ts&&!na[y]){let A=k(m),M=L(m);if(M&&A){let D=M.length;for(let K=D-1;K>=0;--K){let ne=m===C?h(M[K],!0):M[K];A.insertBefore(ne,j(m))}}}return _t(m),!0},No=function(m,y,C,A){return m.length===0?y:y===C||y===A?De(y):y},Oo=function(m,y){return m===y||k(m)!==null?!1:(Rs&&jn(m),!0)},Fo=function(m,y){if(tt(E.beforeSanitizeElements,m,null),Oo(m,y))return!0;if(Sn(m))return _t(m),!0;let C=ie(Oe(m));if(te=No(E.uponSanitizeElement,te,vs,xn),tt(E.uponSanitizeElement,m,{tagName:C,allowedTags:te}),Oo(m,y))return!0;if(Jd(m,C))return _t(m),!0;if(Ra[C]||!(yt.tagCheck instanceof Function&&yt.tagCheck(C))&&!te[C]){let M=Qd(m,C,y);return M===!1&&tt(E.afterSanitizeElements,m,null),M}if(Y(m)===qe.element&&!Xd(m)||(C==="noscript"||C==="noembed"||C==="noframes")&&Ce(Bm,m.innerHTML))return _t(m),!0;if(xt&&m.nodeType===qe.text){let M=vn(m.textContent);m.textContent!==M&&(Oa(t.removed,{element:m.cloneNode()}),m.textContent=M)}return tt(E.afterSanitizeElements,m,null),!1},Go=function(m,y,C){if(yo[y]||Bo(y,m)||wo&&(y==="id"||y==="name")&&(C in a||C in Ud))return!1;let A=ae[y]||yt.attributeCheck instanceof Function&&yt.attributeCheck(y,m);return Is&&Ce(Je,y)||xo&&Ce(Qe,y)?!0:A?So[y]||Ce(bo,Fa(C,ho,""))||(y==="src"||y==="xlink:href"||y==="href")&&m!=="script"&&_i(C,"data:")===0&&jo[m]||_o&&!Ce(yn,Fa(C,ho,""))?!0:!C:zo(m)&&In(Ye.tagNameCheck,m)&&In(Ye.attributeNameCheck,y,m)||y==="is"&&Ye.allowCustomizedBuiltInElements&&In(Ye.tagNameCheck,C)},Yd=H({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),zo=function(m){return!Yd[za(m)]&&Ce(Nd,m)},ep=function(m,y,C,A){if(ee&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!C)switch(p.getAttributeType(m,y)){case"TrustedHTML":return _e(A);case"TrustedScriptURL":return bt(A)}return A},tp=function(m,y,C,A){try{return C?m.setAttributeNS(C,y,A):m.setAttribute(y,A),Sn(m)?(_t(m),!1):!0}catch{return Et(y,m),!1}},Uo=function(m){tt(E.beforeSanitizeAttributes,m,null);let y=m.attributes;if(!y||Sn(m))return;ae=No(E.uponSanitizeAttribute,ae,Ss,_n);let C={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ae,forceKeepAttr:void 0},A=y.length,M=ie(m.nodeName);for(;A--;){let D=y[A],K=D.name,ne=D.namespaceURI,Pe=D.value,Te=ie(K),Fs=Pe,ve=K==="value"?Fs:ym(Fs),Ho=!1;if(C.attrName=Te,C.attrValue=ve,C.keepAttr=!0,C.forceKeepAttr=void 0,tt(E.uponSanitizeAttribute,m,C),ve=C.attrValue,$o&&(Te==="id"||Te==="name")&&_i(ve,Co)!==0&&(Et(K,m,D),ve=Co+ve,Ho=!0),Tt&&Ce(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ve)){Et(K,m,D);continue}if(Te==="attributename"&&xi(ve,"href")){Et(K,m,D);continue}if(!C.forceKeepAttr){if(!C.keepAttr){Et(K,m,D);continue}if(!ko&&Ce(qm,ve)){Et(K,m,D);continue}if(xt&&(ve=vn(ve)),!Go(M,Te,ve)){Et(K,m,D);continue}ve=ep(M,Te,ne,ve),ve!==Fs&&tp(m,K,ne,ve)&&Ho&&yi(t.removed)}}tt(E.afterSanitizeAttributes,m,null)},An=function(m){let y=null,C=Do(m);for(tt(E.beforeSanitizeShadowDOM,m,null);y=C.nextNode();)if(tt(E.uponSanitizeShadowNode,y,null),Fo(y,m),Uo(y),oa(y.content)&&An(y.content),Y(y)===qe.element){let A=w(y);oa(A)&&(Os(A),An(A))}tt(E.afterSanitizeShadowDOM,m,null)},Os=function(m){let y=[{node:m,shadow:null}];for(;y.length>0;){let C=y.pop();if(C.shadow){An(C.shadow);continue}let A=C.node,D=Y(A)===qe.element,K=L(A);if(K)for(let ne=K.length-1;ne>=0;--ne)y.push({node:K[ne],shadow:null});if(D){let ne=O?O(A):null;if(typeof ne=="string"&&ie(ne)==="template"){let Pe=A.content;oa(Pe)&&y.push({node:Pe,shadow:null})}}if(D){let ne=w(A);oa(ne)&&y.push({node:null,shadow:ne},{node:ne,shadow:null})}}};return t.sanitize=function(I){let m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y=null,C=null,A=null,M=null;if(Es=!I,Es&&(I="<!-->"),typeof I!="string"&&!Ma(I)&&(I=$m(I),typeof I!="string"))throw Dt("dirty is not a string, aborting");if(!t.isSupported)return I;As?(te=xn,ae=_n):Ds(m),(E.uponSanitizeElement.length>0||E.uponSanitizeAttribute.length>0)&&(te=De(te)),E.uponSanitizeAttribute.length>0&&(ae=De(ae)),t.removed=[];let D=Rs&&typeof I!="string"&&Ma(I);if(D){Kd(I);let Pe=Oe(I);if(typeof Pe=="string"){let Te=ie(Pe);if(!te[Te]||Ra[Te])throw Ln(I),Dt("root node is forbidden and cannot be sanitized in-place")}if(Sn(I))throw Ln(I),Dt("root node is clobbered and cannot be sanitized in-place");try{Os(I)}catch(Te){throw Ln(I),Te}}else if(Ma(I))y=qo("<!---->"),C=y.ownerDocument.importNode(I,!0),C.nodeType===qe.element&&C.nodeName==="BODY"||C.nodeName==="HTML"?y=C:y.appendChild(C),Os(y);else{if(!ta&&!xt&&!Rt&&I.indexOf("<")===-1)return ee&&wn?_e(I):I;if(y=qo(I),!y)return ta?null:wn?xe:""}y&&Ps&&_t(y.firstChild);let K=D?I:y;try{let Pe=Do(K);for(;A=Pe.nextNode();)Fo(A,K),Uo(A),oa(A.content)&&An(A.content)}catch(Pe){throw D&&(Ln(I),Nt(t.removed,Te=>{Te.element&&jn(Te.element)})),Pe}if(D)return Nt(t.removed,Pe=>{Pe.element&&jn(Pe.element)}),xt&&Ns(I),I;if(ta){if(xt&&Ns(y),kn)for(M=_.call(y.ownerDocument);y.firstChild;)M.appendChild(y.firstChild);else M=y;return(ae.shadowroot||ae.shadowrootmode)&&(M=P.call(n,M,!0)),M}let ne=Rt?y.outerHTML:y.innerHTML;return Rt&&te["!doctype"]&&y.ownerDocument&&y.ownerDocument.doctype&&y.ownerDocument.doctype.name&&Ce(Em,y.ownerDocument.doctype.name)&&(ne="<!DOCTYPE "+y.ownerDocument.doctype.name+`>
|
|
75
|
-
`+ne),xt&&(ne=vn(ne)),ee&&wn?_e(ne):ne},t.setConfig=function(){let I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ds(I),As=!0,xn=te,_n=ae},t.clearConfig=function(){ra=null,As=!1,xn=null,_n=null,ee=oe,xe=""},t.isValidAttribute=function(I,m,y){ra||Ds({});let C=ie(I),A=ie(m);return Go(C,A,y)},t.addHook=function(I,m){typeof m=="function"&&Re(E,I)&&Oa(E[I],m)},t.removeHook=function(I,m){if(Re(E,I)){if(m!==void 0){let y=hm(E[I],m);return y===-1?void 0:bm(E[I],y,1)[0]}return yi(E[I])}},t.removeHooks=function(I){Re(E,I)&&(E[I]=[])},t.removeAllHooks=function(){E=Ai()},t}var Ua=Ei();var qn=require("react");var Mi=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function Bi(e,t,a=[]){if(t==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:Mi(e),size:24,node:t,...a.length>0?{aliases:a}:{}}}var qi=e=>{let t="",a=!1;for(let n of e){if(n==="-"||n==="_"||n<=" "){a=t.length>0;continue}t.length===0?t+=n.toLowerCase():t+=a?n.toUpperCase():n,a=!1}return t};var Di=e=>{let t=qi(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Wa=require("react");var Ha=(...e)=>e.filter((t,a,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===a).join(" ").trim();var $t={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function lr(e){return e!=null}function Ni(e,t={}){let a=t.attributeNames??{},n=f=>a[f]??f,s=e.size??e.width??$t.width,r=e.size??e.height??$t.height,o=e.aliases?.filter(f=>typeof f=="string"&&f.trim()!=="").map(f=>`lucide-${f}`)??[],i=[...e.name?[`lucide-${e.name}`]:[],...o],l=t.className?.split(" ").filter(Boolean)??[],u=t.includeDefaultClasses===!1?Ha(...l):Ha("lucide",...i,...l),c=t.absoluteStrokeWidth?Number(t.strokeWidth??$t["stroke-width"])*Number(e.size??e.width??$t.width)/Number(t.size??t.width??$t.width):t.strokeWidth??$t["stroke-width"];return["svg",{...Object.entries($t).reduce((f,[h,g])=>(f[n(h)]=g,f),{}),..."color"in t&&t.color&&{[n("stroke")]:t.color},..."size"in t&&lr(t.size)&&{[n("width")]:t.size,[n("height")]:t.size},..."width"in t&&lr(t.width)&&{[n("width")]:t.width},..."height"in t&&lr(t.height)&&{[n("height")]:t.height},[n("stroke-width")]:c,...u&&{[n("class")]:u},[n("viewBox")]:`0 0 ${s} ${r}`,...t.hasA11yProp===!1?{[n("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},e.node.map(f=>{let[h,g,$]=f,j=t.nonScalingStroke?{[n("vector-effect")]:"non-scaling-stroke",...g}:g;return $?[h,j,$]:[h,j]})]}function Oi(e,t={}){return Ni(e,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var Fi=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var da=require("react");var Gm=(0,da.createContext)({});var Gi=()=>(0,da.useContext)(Gm);var zi=(0,Wa.forwardRef)(({color:e,size:t,width:a,height:n,strokeWidth:s,absoluteStrokeWidth:r,nonScalingStroke:o,className:i="",children:l,iconNode:u=[],icon:c={node:u,aliases:[],size:24},...p},f)=>{let{size:h=24,strokeWidth:g=2,absoluteStrokeWidth:$=!1,nonScalingStroke:j=!1,color:L="currentColor",className:k=""}=Gi()??{},w=!!l||Fi(p),[R,T,O=[]]=Oi(c,{color:e??L,width:a??t??h,height:n??t??h,strokeWidth:s??g,absoluteStrokeWidth:r??$,nonScalingStroke:o??j,className:Ha(k,i),hasA11yProp:w,attributes:p});return(0,Wa.createElement)(R,{ref:f,...T},[...O.map(([Q,Y])=>(0,Wa.createElement)(Q,Y)),...Array.isArray(l)?l:[l]])});function U(e,t=[],a=[]){let n=typeof e=="string"?Bi(e,t,a):e,s=(0,qn.forwardRef)(({className:r,...o},i)=>(0,qn.createElement)(zi,{ref:i,icon:n,className:r,...o}));return n.name&&(s.displayName=Di(n.name)),s}var Ui={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};Ui.node;var pa=U(Ui);var Hi={name:"bell-off",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]};Hi.node;var ma=U(Hi);var Wi={name:"bell",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 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",key:"11g9vi"}]]};Wi.node;var fa=U(Wi);var Vi={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};Vi.node;var rt=U(Vi);var Xi={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};Xi.node;var Ot=U(Xi);var Zi={name:"globe",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]};Zi.node;var ga=U(Zi);var Ki={name:"inbox",size:24,node:[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]};Ki.node;var ha=U(Ki);var Ji={name:"mail",size:24,node:[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]};Ji.node;var ba=U(Ji);var Qi={name:"messages-square",size:24,node:[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]]};Qi.node;var ya=U(Qi);var Yi={name:"pen-line",size:24,node:[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{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-.497z",key:"1a8usu"}]],aliases:["edit-3"]};Yi.node;var ot=U(Yi);var el={name:"refresh-cw",size:24,node:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]};el.node;var xa=U(el);var tl={name:"reply",size:24,node:[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]};tl.node;var _a=U(tl);var al={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};al.node;var Ft=U(al);var nl={name:"send",size:24,node:[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]};nl.node;var Ge=U(nl);var sl={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};sl.node;var it=U(sl);var rl={name:"user-plus",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]};rl.node;var Gt=U(rl);var ol={name:"users",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};ol.node;var ka=U(ol);var il={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};il.node;var zt=U(il);var Z=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function zm(e){return yr(e)}function yr(e){return Array.isArray(e)?Um(e):e instanceof RegExp?e:typeof e=="object"?Hm(e):e}function Um(e){let t=[];for(let a=0,n=e.length;a<n;a++)t[a]=yr(e[a]);return t}function Hm(e){let t={};for(let a in e)t[a]=yr(e[a]);return t}function hl(e,...t){return t.forEach(a=>{for(let n in a)e[n]=a[n]}),e}function bl(e){let t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?bl(e.substring(0,e.length-1)):e.substr(~t+1)}var ur=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Dn=class{static hasCaptures(e){return e===null?!1:(ur.lastIndex=0,ur.test(e))}static replaceCaptures(e,t,a){return e.replace(ur,(n,s,r,o)=>{let i=a[parseInt(s||r,10)];if(i){let l=t.substring(i.start,i.end);for(;l[0]===".";)l=l.substring(1);switch(o){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return n})}};function yl(e,t){return e<t?-1:e>t?1:0}function xl(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let a=e.length,n=t.length;if(a===n){for(let s=0;s<a;s++){let r=yl(e[s],t[s]);if(r!==0)return r}return 0}return a-n}function ll(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function _l(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var kl=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},Za=class{constructor(e,t,a){this._colorMap=e,this._defaults=t,this._root=a}static createFromRawTheme(e,t){return this.createFromParsedTheme(Xm(e),t)}static createFromParsedTheme(e,t){return Km(e,t)}_cachedMatchRoot=new kl(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(s=>Wm(e.parent,s.parentScopes));return n?new wl(n.fontStyle,n.foreground,n.background):null}},cr=class Nn{constructor(t,a){this.parent=t,this.scopeName=a}static push(t,a){for(let n of a)t=new Nn(t,n);return t}static from(...t){let a=null;for(let n=0;n<t.length;n++)a=new Nn(a,t[n]);return a}push(t){return new Nn(this,t)}getSegments(){let t=this,a=[];for(;t;)a.push(t.scopeName),t=t.parent;return a.reverse(),a}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){let a=[],n=this;for(;n&&n!==t;)a.push(n.scopeName),n=n.parent;return n===t?a.reverse():void 0}};function Wm(e,t){if(t.length===0)return!0;for(let a=0;a<t.length;a++){let n=t[a],s=!1;if(n===">"){if(a===t.length-1)return!1;n=t[++a],s=!0}for(;e&&!Vm(e.scopeName,n);){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Vm(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var wl=class{constructor(e,t,a){this.fontStyle=e,this.foregroundId=t,this.backgroundId=a}};function Xm(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,a=[],n=0;for(let s=0,r=t.length;s<r;s++){let o=t[s];if(!o.settings)continue;let i;if(typeof o.scope=="string"){let p=o.scope;p=p.replace(/^[,]+/,""),p=p.replace(/[,]+$/,""),i=p.split(",")}else Array.isArray(o.scope)?i=o.scope:i=[""];let l=-1;if(typeof o.settings.fontStyle=="string"){l=0;let p=o.settings.fontStyle.split(" ");for(let f=0,h=p.length;f<h;f++)switch(p[f]){case"italic":l=l|1;break;case"bold":l=l|2;break;case"underline":l=l|4;break;case"strikethrough":l=l|8;break}}let u=null;typeof o.settings.foreground=="string"&&ll(o.settings.foreground)&&(u=o.settings.foreground);let c=null;typeof o.settings.background=="string"&&ll(o.settings.background)&&(c=o.settings.background);for(let p=0,f=i.length;p<f;p++){let g=i[p].trim().split(" "),$=g[g.length-1],j=null;g.length>1&&(j=g.slice(0,g.length-1),j.reverse()),a[n++]=new Zm($,j,s,l,u,c)}}return a}var Zm=class{constructor(e,t,a,n,s,r){this.scope=e,this.parentScopes=t,this.index=a,this.fontStyle=n,this.foreground=s,this.background=r}},ke=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(ke||{});function Km(e,t){e.sort((l,u)=>{let c=yl(l.scope,u.scope);return c!==0||(c=xl(l.parentScopes,u.parentScopes),c!==0)?c:l.index-u.index});let a=0,n="#000000",s="#ffffff";for(;e.length>=1&&e[0].scope==="";){let l=e.shift();l.fontStyle!==-1&&(a=l.fontStyle),l.foreground!==null&&(n=l.foreground),l.background!==null&&(s=l.background)}let r=new Jm(t),o=new wl(a,r.getId(n),r.getId(s)),i=new Ym(new pr(0,null,-1,0,0),[]);for(let l=0,u=e.length;l<u;l++){let c=e[l];i.insert(0,c.scope,c.parentScopes,c.fontStyle,r.getId(c.foreground),r.getId(c.background))}return new Za(r,o,i)}var Jm=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,a=e.length;t<a;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Qm=Object.freeze([]),pr=class $l{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(t,a,n,s,r){this.scopeDepth=t,this.parentScopes=a||Qm,this.fontStyle=n,this.foreground=s,this.background=r}clone(){return new $l(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let a=[];for(let n=0,s=t.length;n<s;n++)a[n]=t[n].clone();return a}acceptOverwrite(t,a,n,s){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,a!==-1&&(this.fontStyle=a),n!==0&&(this.foreground=n),s!==0&&(this.background=s)}},Ym=class mr{constructor(t,a=[],n={}){this._mainRule=t,this._children=n,this._rulesWithParentScopes=a}_rulesWithParentScopes;static _cmpBySpecificity(t,a){if(t.scopeDepth!==a.scopeDepth)return a.scopeDepth-t.scopeDepth;let n=0,s=0;for(;t.parentScopes[n]===">"&&n++,a.parentScopes[s]===">"&&s++,!(n>=t.parentScopes.length||s>=a.parentScopes.length);){let r=a.parentScopes[s].length-t.parentScopes[n].length;if(r!==0)return r;n++,s++}return a.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let n=t.indexOf("."),s,r;if(n===-1?(s=t,r=""):(s=t.substring(0,n),r=t.substring(n+1)),this._children.hasOwnProperty(s))return this._children[s].match(r)}let a=this._rulesWithParentScopes.concat(this._mainRule);return a.sort(mr._cmpBySpecificity),a}insert(t,a,n,s,r,o){if(a===""){this._doInsertHere(t,n,s,r,o);return}let i=a.indexOf("."),l,u;i===-1?(l=a,u=""):(l=a.substring(0,i),u=a.substring(i+1));let c;this._children.hasOwnProperty(l)?c=this._children[l]:(c=new mr(this._mainRule.clone(),pr.cloneArr(this._rulesWithParentScopes)),this._children[l]=c),c.insert(t+1,u,n,s,r,o)}_doInsertHere(t,a,n,s,r){if(a===null){this._mainRule.acceptOverwrite(t,n,s,r);return}for(let o=0,i=this._rulesWithParentScopes.length;o<i;o++){let l=this._rulesWithParentScopes[o];if(xl(l.parentScopes,a)===0){l.acceptOverwrite(t,n,s,r);return}}n===-1&&(n=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),r===0&&(r=this._mainRule.background),this._rulesWithParentScopes.push(new pr(t,a,n,s,r))}},Ct=class ze{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){let a=ze.getLanguageId(t),n=ze.getTokenType(t),s=ze.getFontStyle(t),r=ze.getForeground(t),o=ze.getBackground(t);console.log({languageId:a,tokenType:n,fontStyle:s,foreground:r,background:o})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,a,n,s,r,o,i){let l=ze.getLanguageId(t),u=ze.getTokenType(t),c=ze.containsBalancedBrackets(t)?1:0,p=ze.getFontStyle(t),f=ze.getForeground(t),h=ze.getBackground(t);return a!==0&&(l=a),n!==8&&(u=n),s!==null&&(c=s?1:0),r!==-1&&(p=r),o!==0&&(f=o),i!==0&&(h=i),(l<<0|u<<8|c<<10|p<<11|f<<15|h<<24)>>>0}};function Fn(e,t){let a=[],n=ef(e),s=n.next();for(;s!==null;){let l=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=n.next()}let u=o();if(a.push({matcher:u,priority:l}),s!==",")break;s=n.next()}return a;function r(){if(s==="-"){s=n.next();let l=r();return u=>!!l&&!l(u)}if(s==="("){s=n.next();let l=i();return s===")"&&(s=n.next()),l}if(ul(s)){let l=[];do l.push(s),s=n.next();while(ul(s));return u=>t(l,u)}return null}function o(){let l=[],u=r();for(;u;)l.push(u),u=r();return c=>l.every(p=>p(c))}function i(){let l=[],u=o();for(;u&&(l.push(u),s==="|"||s===",");){do s=n.next();while(s==="|"||s===",");u=o()}return c=>l.some(p=>p(c))}}function ul(e){return!!e&&!!e.match(/[\w\.:]+/)}function ef(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,a=t.exec(e);return{next:()=>{if(!a)return null;let n=a[0];return a=t.exec(e),n}}}function Cl(e){typeof e.dispose=="function"&&e.dispose()}var Ka=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},tf=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},af=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},nf=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ka(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new af;for(let a of e)sf(a,this.initialScopeName,this.repo,t);for(let a of t.references)if(a instanceof Ka){if(this.seenFullScopeRequests.has(a.scopeName))continue;this.seenFullScopeRequests.add(a.scopeName),this.Q.push(a)}else{if(this.seenFullScopeRequests.has(a.scopeName)||this.seenPartialScopeRequests.has(a.toKey()))continue;this.seenPartialScopeRequests.add(a.toKey()),this.Q.push(a)}}};function sf(e,t,a,n){let s=a.lookup(e.scopeName);if(!s){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}let r=a.lookup(t);e instanceof Ka?On({baseGrammar:r,selfGrammar:s},n):fr(e.ruleName,{baseGrammar:r,selfGrammar:s,repository:s.repository},n);let o=a.injections(e.scopeName);if(o)for(let i of o)n.add(new Ka(i))}function fr(e,t,a){if(t.repository&&t.repository[e]){let n=t.repository[e];Gn([n],t,a)}}function On(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Gn(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Gn(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Gn(e,t,a){for(let n of e){if(a.visitedRule.has(n))continue;a.visitedRule.add(n);let s=n.repository?hl({},t.repository,n.repository):t.repository;Array.isArray(n.patterns)&&Gn(n.patterns,{...t,repository:s},a);let r=n.include;if(!r)continue;let o=Ll(r);switch(o.kind){case 0:On({...t,selfGrammar:t.baseGrammar},a);break;case 1:On(t,a);break;case 2:fr(o.ruleName,{...t,repository:s},a);break;case 3:case 4:let i=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(i){let l={baseGrammar:t.baseGrammar,selfGrammar:i,repository:s};o.kind===4?fr(o.ruleName,l,a):On(l,a)}else o.kind===4?a.add(new tf(o.scopeName,o.ruleName)):a.add(new Ka(o.scopeName));break}}}var rf=class{kind=0},of=class{kind=1},lf=class{constructor(e){this.ruleName=e}kind=2},uf=class{constructor(e){this.scopeName=e}kind=3},cf=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Ll(e){if(e==="$base")return new rf;if(e==="$self")return new of;let t=e.indexOf("#");if(t===-1)return new uf(e);if(t===0)return new lf(e.substring(1));{let a=e.substring(0,t),n=e.substring(t+1);return new cf(a,n)}}var df=/\\(\d+)/,cl=/\\(\d+)/g,m_=Symbol("RuleId"),pf=-1,jl=-2;var Ya=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,a,n){this.$location=e,this.id=t,this._name=a||null,this._nameIsCapturing=Dn.hasCaptures(this._name),this._contentName=n||null,this._contentNameIsCapturing=Dn.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${bl(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:Dn.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Dn.replaceCaptures(this._contentName,e,t)}},mf=class extends Ya{retokenizeCapturedWithRuleId;constructor(e,t,a,n,s){super(e,t,a,n),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,a,n){throw new Error("Not supported!")}},ff=class extends Ya{_match;captures;_cachedCompiledPatterns;constructor(e,t,a,n,s){super(e,t,a,null),this._match=new Ja(n,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,a,n){return this._getCachedCompiledPatterns(e).compileAG(e,a,n)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Qa,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},dl=class extends Ya{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,a,n,s){super(e,t,a,n),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(let a of this.patterns)e.getRule(a).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,a,n){return this._getCachedCompiledPatterns(e).compileAG(e,a,n)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Qa,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},gr=class extends Ya{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,a,n,s,r,o,i,l,u){super(e,t,a,n),this._begin=new Ja(s,this.id),this.beginCaptures=r,this._end=new Ja(o||"\uFFFF",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=i,this.applyEndPatternLast=l||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,a,n){return this._getCachedCompiledPatterns(e,t).compileAG(e,a,n)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Qa;for(let a of this.patterns)e.getRule(a).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},zn=class extends Ya{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,a,n,s,r,o,i,l){super(e,t,a,n),this._begin=new Ja(s,this.id),this.beginCaptures=r,this.whileCaptures=i,this._while=new Ja(o,jl),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,a,n){return this._getCachedCompiledPatterns(e).compileAG(e,a,n)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Qa;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,a,n){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,a,n)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Qa,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"\uFFFF"),this._cachedCompiledWhilePatterns}},vl=class Le{static createCaptureRule(t,a,n,s,r){return t.registerRule(o=>new mf(a,o,n,s,r))}static getCompiledRuleId(t,a,n){return t.id||a.registerRule(s=>{if(t.id=s,t.match)return new ff(t.$vscodeTextmateLocation,t.id,t.name,t.match,Le._compileCaptures(t.captures,a,n));if(typeof t.begin>"u"){t.repository&&(n=hl({},n,t.repository));let r=t.patterns;return typeof r>"u"&&t.include&&(r=[{include:t.include}]),new dl(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,Le._compilePatterns(r,a,n))}return t.while?new zn(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Le._compileCaptures(t.beginCaptures||t.captures,a,n),t.while,Le._compileCaptures(t.whileCaptures||t.captures,a,n),Le._compilePatterns(t.patterns,a,n)):new gr(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Le._compileCaptures(t.beginCaptures||t.captures,a,n),t.end,Le._compileCaptures(t.endCaptures||t.captures,a,n),t.applyEndPatternLast,Le._compilePatterns(t.patterns,a,n))}),t.id}static _compileCaptures(t,a,n){let s=[];if(t){let r=0;for(let o in t){if(o==="$vscodeTextmateLocation")continue;let i=parseInt(o,10);i>r&&(r=i)}for(let o=0;o<=r;o++)s[o]=null;for(let o in t){if(o==="$vscodeTextmateLocation")continue;let i=parseInt(o,10),l=0;t[o].patterns&&(l=Le.getCompiledRuleId(t[o],a,n)),s[i]=Le.createCaptureRule(a,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,l)}}return s}static _compilePatterns(t,a,n){let s=[];if(t)for(let r=0,o=t.length;r<o;r++){let i=t[r],l=-1;if(i.include){let u=Ll(i.include);switch(u.kind){case 0:case 1:l=Le.getCompiledRuleId(n[i.include],a,n);break;case 2:let c=n[u.ruleName];c&&(l=Le.getCompiledRuleId(c,a,n));break;case 3:case 4:let p=u.scopeName,f=u.kind===4?u.ruleName:null,h=a.getExternalGrammar(p,n);if(h)if(f){let g=h.repository[f];g&&(l=Le.getCompiledRuleId(g,a,h.repository))}else l=Le.getCompiledRuleId(h.repository.$self,a,h.repository);break}}else l=Le.getCompiledRuleId(i,a,n);if(l!==-1){let u=a.getRule(l),c=!1;if((u instanceof dl||u instanceof gr||u instanceof zn)&&u.hasMissingPatterns&&u.patterns.length===0&&(c=!0),c)continue;s.push(l)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},Ja=class Sl{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(t,a){if(t&&typeof t=="string"){let n=t.length,s=0,r=[],o=!1;for(let i=0;i<n;i++)if(t.charAt(i)==="\\"&&i+1<n){let u=t.charAt(i+1);u==="z"?(r.push(t.substring(s,i)),r.push("$(?!\\n)(?<!\\n)"),s=i+2):(u==="A"||u==="G")&&(o=!0),i++}this.hasAnchor=o,s===0?this.source=t:(r.push(t.substring(s,n)),this.source=r.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=a,typeof this.source=="string"?this.hasBackReferences=df.test(this.source):this.hasBackReferences=!1}clone(){return new Sl(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,a){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let n=a.map(s=>t.substring(s.start,s.end));return cl.lastIndex=0,this.source.replace(cl,(s,r)=>_l(n[parseInt(r,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],a=[],n=[],s=[],r,o,i,l;for(r=0,o=this.source.length;r<o;r++)i=this.source.charAt(r),t[r]=i,a[r]=i,n[r]=i,s[r]=i,i==="\\"&&r+1<o&&(l=this.source.charAt(r+1),l==="A"?(t[r+1]="\uFFFF",a[r+1]="\uFFFF",n[r+1]="A",s[r+1]="A"):l==="G"?(t[r+1]="\uFFFF",a[r+1]="G",n[r+1]="\uFFFF",s[r+1]="G"):(t[r+1]=l,a[r+1]=l,n[r+1]=l,s[r+1]=l),r++);return{A0_G0:t.join(""),A0_G1:a.join(""),A1_G0:n.join(""),A1_G1:s.join("")}}resolveAnchors(t,a){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?a?this._anchorCache.A1_G1:this._anchorCache.A1_G0:a?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Qa=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(a=>a.source);this._cached=new pl(e,t,this._items.map(a=>a.ruleId))}return this._cached}compileAG(e,t,a){return this._hasAnchors?t?a?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,a)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,a)),this._anchorCache.A1_G0):a?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,a)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,a)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,a){let n=this._items.map(s=>s.resolveAnchors(t,a));return new pl(e,n,this._items.map(s=>s.ruleId))}},pl=class{constructor(e,t,a){this.regExps=t,this.rules=a,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){let e=[];for(let t=0,a=this.rules.length;t<a;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
|
|
76
|
-
`)}findNextMatchSync(e,t,a){let n=this.scanner.findNextMatchSync(e,t,a);return n?{ruleId:this.rules[n.index],captureIndices:n.captureIndices}:null}},dr=class{constructor(e,t){this.languageId=e,this.tokenType=t}},gf=class hr{_defaultAttributes;_embeddedLanguagesMatcher;constructor(t,a){this._defaultAttributes=new dr(t,8),this._embeddedLanguagesMatcher=new hf(Object.entries(a||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?hr._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new dr(0,0);_getBasicScopeAttributes=new kl(t=>{let a=this._scopeToLanguage(t),n=this._toStandardTokenType(t);return new dr(a,n)});_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){let a=t.match(hr.STANDARD_TOKEN_TYPE_REGEXP);if(!a)return 8;switch(a[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},hf=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([a,n])=>_l(a));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},f_={InDebugMode:typeof process<"u"&&!!process.env.VSCODE_TEXTMATE_DEBUG},Il=!1,ml=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Al(e,t,a,n,s,r,o,i){let l=t.content.length,u=!1,c=-1;if(o){let
|
|
77
|
-
`;let r=this.createOnigString(e),o=r.content.length,i=new vf(a,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=Al(this,r,s,0,t,i,!0,n);return Cl(r),{lineLength:o,lineTokens:i,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function gl(e,t){return e=zm(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Xa=class at{constructor(t,a,n){this.parent=t,this.scopePath=a,this.tokenAttributes=n}static fromExtension(t,a){let n=t,s=t?.scopePath??null;for(let r of a)s=cr.push(s,r.scopeNames),n=new at(n,s,r.encodedTokenAttributes);return n}static createRoot(t,a){return new at(null,new cr(null,t),a)}static createRootAndLookUpScopeName(t,a,n){let s=n.getMetadataForScope(t),r=new cr(null,t),o=n.themeProvider.themeMatch(r),i=at.mergeAttributes(a,s,o);return new at(null,r,i)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return at.equals(this,t)}static equals(t,a){do{if(t===a||!t&&!a)return!0;if(!t||!a||t.scopeName!==a.scopeName||t.tokenAttributes!==a.tokenAttributes)return!1;t=t.parent,a=a.parent}while(!0)}static mergeAttributes(t,a,n){let s=-1,r=0,o=0;return n!==null&&(s=n.fontStyle,r=n.foregroundId,o=n.backgroundId),Ct.set(t,a.languageId,a.tokenType,null,s,r,o)}pushAttributed(t,a){if(t===null)return this;if(t.indexOf(" ")===-1)return at._pushAttributed(this,t,a);let n=t.split(/ /g),s=this;for(let r of n)s=at._pushAttributed(s,r,a);return s}static _pushAttributed(t,a,n){let s=n.getMetadataForScope(a),r=t.scopePath.push(a),o=n.themeProvider.themeMatch(r),i=at.mergeAttributes(t.tokenAttributes,s,o);return new at(t,r,i)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){let a=[],n=this;for(;n&&n!==t;)a.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===t?a.reverse():void 0}},br=class Ut{constructor(t,a,n,s,r,o,i,l){this.parent=t,this.ruleId=a,this.beginRuleCapturedEOL=r,this.endRule=o,this.nameScopesList=i,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new Ut(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:Ut._equals(this,t)}static _equals(t,a){return t===a?!0:this._structuralEquals(t,a)?Xa.equals(t.contentNameScopesList,a.contentNameScopesList):!1}static _structuralEquals(t,a){do{if(t===a||!t&&!a)return!0;if(!t||!a||t.depth!==a.depth||t.ruleId!==a.ruleId||t.endRule!==a.endRule)return!1;t=t.parent,a=a.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){Ut._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,a,n,s,r,o,i){return new Ut(this,t,a,n,s,r,o,i)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){let t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,a){return this.parent&&(a=this.parent._writeString(t,a)),t[a++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,a}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new Ut(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let a=this;for(;a&&a._enterPos===t._enterPos;){if(a.ruleId===t.ruleId)return!0;a=a.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,a){let n=Xa.fromExtension(t?.nameScopesList??null,a.nameScopesList);return new Ut(t,a.ruleId,a.enterPos??-1,a.anchorPos??-1,a.beginRuleCapturedEOL,a.endRule,n,Xa.fromExtension(n,a.contentNameScopesList))}},jf=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(a=>a==="*"?(this.allowAny=!0,[]):Fn(a,Un).map(n=>n.matcher)),this.unbalancedBracketScopes=t.flatMap(a=>Fn(a,Un).map(n=>n.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},vf=class{constructor(e,t,a,n){this.balancedBracketSelectors=n,this._emitBinaryTokens=e,this._tokenTypeOverrides=a,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let r=e?.getScopeNames()??[];for(let o of this._tokenTypeOverrides)o.matcher(r)&&(n=Ct.set(n,0,o.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(r))}if(s&&(n=Ct.set(n,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let a=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:a}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let a=new Uint32Array(this._binaryTokens.length);for(let n=0,s=this._binaryTokens.length;n<s;n++)a[n]=this._binaryTokens[n];return a}},Sf=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,a,n,s){if(!this._grammars.has(e)){let r=this._rawGrammars.get(e);if(!r)return null;this._grammars.set(e,$f(e,r,t,a,n,s,this,this._onigLib))}return this._grammars.get(e)}},Rl=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Sf(Za.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(Za.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,a){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:a})}loadGrammarWithConfiguration(e,t,a){return this._loadGrammar(e,t,a.embeddedLanguages,a.tokenTypes,new jf(a.balancedBracketSelectors||[],a.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,a,n,s){let r=new nf(this._syncRegistry,e);for(;r.Q.length>0;)r.Q.map(o=>this._loadSingleGrammar(o.scopeName)),r.processQueue();return this._grammarForScopeName(e,t,a,n,s)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let a=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,a)}}addGrammar(e,t=[],a=0,n=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,a,n)}_grammarForScopeName(e,t=0,a=null,n=null,s=null){return this._syncRegistry.grammarForScopeName(e,t,a,n,s)}},Hn=br.NULL;function tn(e,t){let a=typeof e=="string"?{}:{...e.colorReplacements},n=typeof e=="string"?e:e.name;for(let[s,r]of Object.entries(t?.colorReplacements||{}))typeof r=="string"?a[s]=r:s===n&&Object.assign(a,r);return a}function lt(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Dl(e){return Array.isArray(e)?e:[e]}async function xr(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function an(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Nl(e){return e==="ansi"||an(e)}function nn(e){return e==="none"}function Ol(e){return nn(e)}var If=/(\r?\n)/g;function wa(e,t=!1){if(e.length===0)return[["",0]];let a=e.split(If),n=0,s=[];for(let r=0;r<a.length;r+=2){let o=t?a[r]+(a[r+1]||""):a[r];s.push([o,n]),n+=a[r].length,n+=a[r+1]?.length||0}return s}var El={light:"#333333",dark:"#bbbbbb"},Ml={light:"#fffffe",dark:"#1e1e1e"},Bl="__shiki_resolved";function Wn(e){if(e?.[Bl])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:a,fg:n}=t;if(!a||!n){let i=t.settings?t.settings.find(l=>!l.name&&!l.scope):void 0;i?.settings?.foreground&&(n=i.settings.foreground),i?.settings?.background&&(a=i.settings.background),!n&&t?.colors?.["editor.foreground"]&&(n=t.colors["editor.foreground"]),!a&&t?.colors?.["editor.background"]&&(a=t.colors["editor.background"]),n||(n=t.type==="light"?El.light:El.dark),a||(a=t.type==="light"?Ml.light:Ml.dark),t.fg=n,t.bg=a}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let s=0,r=new Map;function o(i){if(r.has(i))return r.get(i);s+=1;let l=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${l}`]?o(i):(r.set(i,l),l)}t.settings=t.settings.map(i=>{let l=i.settings?.foreground&&!i.settings.foreground.startsWith("#"),u=i.settings?.background&&!i.settings.background.startsWith("#");if(!l&&!u)return i;let c={...i,settings:{...i.settings}};if(l){let p=o(i.settings.foreground);t.colorReplacements[p]=i.settings.foreground,c.settings.foreground=p}if(u){let p=o(i.settings.background);t.colorReplacements[p]=i.settings.background,c.settings.background=p}return c});for(let i of Object.keys(t.colors||{}))if((i==="editor.foreground"||i==="editor.background"||i.startsWith("terminal.ansi"))&&!t.colors[i]?.startsWith("#")){let l=o(t.colors[i]);t.colorReplacements[l]=t.colors[i],t.colors[i]=l}return Object.defineProperty(t,Bl,{enumerable:!1,writable:!1,value:!0}),t}async function Fl(e){return[...new Set((await Promise.all(e.filter(t=>!Nl(t)).map(async t=>await xr(t).then(a=>Array.isArray(a)?a:[a])))).flat())]}async function Gl(e){return(await Promise.all(e.map(async t=>Ol(t)?null:Wn(await xr(t))))).filter(t=>!!t)}function zl(e,t){if(!t)return e;if(t[e]){let a=new Set([e]);for(;t[e];){if(e=t[e],a.has(e))throw new Z(`Circular alias \`${[...a].join(" -> ")} -> ${e}\``);a.add(e)}}return e}var Af=class extends Rl{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,a,n={}){super(e),this._resolver=e,this._themes=t,this._langs=a,this._alias=n,this._themes.map(s=>this.loadTheme(s)),this.loadLanguages(this._langs)}getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=Wn(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=Za.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=zl(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(s=>s.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let a={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let n=this.loadGrammarWithConfiguration(e.scopeName,1,a);if(n.name=e.name,this._resolvedGrammars.set(e.name,n),e.aliases&&e.aliases.forEach(s=>{this._alias[s]=e.name}),this._loadedLanguagesCache=null,t.size)for(let s of t)this._resolvedGrammars.delete(s.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(s.scopeName),this._syncRegistry?._grammars?.delete(s.scopeName),this.loadLanguage(this._langMap.get(s.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let n of e)this.resolveEmbeddedLanguages(n);let t=[...this._langGraph.entries()],a=t.filter(([n,s])=>!s);if(a.length){let n=t.filter(([s,r])=>r?(r.embeddedLanguages||r.embeddedLangs)?.some(o=>a.map(([i])=>i).includes(o)):!1).filter(s=>!a.includes(s));throw new Z(`Missing languages ${a.map(([s])=>`\`${s}\``).join(", ")}, required by ${n.map(([s])=>`\`${s}\``).join(", ")}`)}for(let[n,s]of t)this._resolver.addLanguage(s);for(let[n,s]of t)this.loadLanguage(s)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let a of t)this._langGraph.set(a,this._langMap.get(a))}},Pf=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:a=>e.createScanner(a),createOnigString:a=>e.createString(a)},t.forEach(a=>this.addLanguage(a))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split("."),a=[];for(let n=1;n<=t.length;n++){let s=t.slice(0,n).join(".");a=[...a,...this._injections.get(s)||[]]}return a}},en=0;function _r(e){en+=1,e.warnings!==!1&&en>=10&&en%10===0&&console.warn(`[Shiki] ${en} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new Z("`engine` option is required for synchronous mode");let a=(e.langs||[]).flat(1),n=(e.themes||[]).flat(1).map(Wn),s=new Af(new Pf(e.engine,a),n,a,e.langAlias),r;function o(k){return zl(k,e.langAlias)}function i(k){j();let w=s.getGrammar(typeof k=="string"?k:k.name);if(!w)throw new Z(`Language \`${k}\` not found, you may need to load it first`);return w}function l(k){if(k==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};j();let w=s.getTheme(k);if(!w)throw new Z(`Theme \`${k}\` not found, you may need to load it first`);return w}function u(k){j();let w=l(k);return r!==k&&(s.setTheme(w),r=k),{theme:w,colorMap:s.getColorMap()}}function c(){return j(),s.getLoadedThemes()}function p(){return j(),s.getLoadedLanguages()}function f(...k){j(),s.loadLanguages(k.flat(1))}async function h(...k){return f(await Fl(k))}function g(...k){j();for(let w of k.flat(1))s.loadTheme(w)}async function $(...k){return j(),g(await Gl(k))}function j(){if(t)throw new Z("Shiki instance has been disposed")}function L(){t||(t=!0,s.dispose(),en-=1)}return{setTheme:u,getTheme:l,getLanguage:i,getLoadedThemes:c,getLoadedLanguages:p,resolveLangAlias:o,loadLanguage:h,loadLanguageSync:f,loadTheme:$,loadThemeSync:g,dispose:L,[Symbol.dispose]:L}}async function kr(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,a,n]=await Promise.all([Gl(e.themes||[]),Fl(e.langs||[]),e.engine]);return _r({...e,themes:t,langs:a,engine:n})}var Ul=new WeakMap;function sn(e,t){Ul.set(e,t)}function $a(e){return Ul.get(e)}var Vn=class Hl{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,a){return new Hl(Object.fromEntries(Dl(a).map(n=>[n,Hn])),t)}constructor(...t){if(t.length===2){let[a,n]=t;this.lang=n,this._stacks=a}else{let[a,n,s]=t;this.lang=n,this._stacks={[s]:a}}}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return Tf(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Tf(e){let t=[],a=new Set;function n(s){if(a.has(s))return;a.add(s);let r=s?.nameScopesList?.scopeName;r&&t.push(r),s.parent&&n(s.parent)}return n(e),t}function Rf(e,t){if(!(e instanceof Vn))throw new Z("Invalid grammar state");return e.getInternalStack(t)}var Ef=/,/,Mf=/ /;function wr(e,t,a={}){let{theme:n=e.getLoadedThemes()[0]}=a;if(an(e.resolveLangAlias(a.lang||"text"))||nn(n))return wa(t).map(i=>[{content:i[0],offset:i[1]}]);let{theme:s,colorMap:r}=e.setTheme(n),o=e.getLanguage(a.lang||"text");if(a.grammarState){if(a.grammarState.lang!==o.name)throw new Z(`Grammar state language "${a.grammarState.lang}" does not match highlight language "${o.name}"`);if(!a.grammarState.themes.includes(s.name))throw new Z(`Grammar state themes "${a.grammarState.themes}" do not contain highlight theme "${s.name}"`)}return Vl(t,o,s,r,a)}function Wl(...e){if(e.length===2)return $a(e[1]);let[t,a,n={}]=e,{lang:s="text",theme:r=t.getLoadedThemes()[0]}=n;if(an(s)||nn(r))throw new Z("Plain language does not have grammar state");if(s==="ansi")throw new Z("ANSI language does not have grammar state");let{theme:o,colorMap:i}=t.setTheme(r),l=t.getLanguage(s);return new Vn($r(a,l,o,i,n).stateStack,l.name,o.name)}function Vl(e,t,a,n,s){let r=$r(e,t,a,n,s),o=new Vn(r.stateStack,t.name,a.name);return sn(r.tokens,o),r.tokens}function $r(e,t,a,n,s){let r=tn(a,s),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:i=500,includeExplanation:l=!1}=s,u=wa(e),c=s.grammarState?Rf(s.grammarState,a.name)??Hn:s.grammarContextCode!=null?$r(s.grammarContextCode,t,a,n,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:Hn,p=[],f=[];for(let h=0,g=u.length;h<g;h++){let[$,j]=u[h];if($===""){p=[],f.push([]);continue}if(o>0&&$.length>=o){p=[],f.push([{content:$,offset:j,color:"",fontStyle:0}]);continue}let L,k,w;l&&l!=="tokenType"&&(L=t.tokenizeLine($,c,i),k=L.tokens,w=0);let R=t.tokenizeLine2($,c,i),T=R.tokens.length/2;for(let O=0;O<T;O++){let Q=R.tokens[2*O],Y=O+1<T?R.tokens[2*O+2]:$.length;if(Q===Y)continue;let Oe=R.tokens[2*O+1],ee=lt(n[Ct.getForeground(Oe)],r),xe=Ct.getFontStyle(Oe),oe={content:$.substring(Q,Y),offset:j+Q,color:ee,fontStyle:xe};if(l==="tokenType")oe.type=Ct.getTokenType(Oe);else if(l){let Ae=[];if(l!=="scopeName")for(let we of a.settings){let _e;switch(typeof we.scope){case"string":_e=we.scope.split(Ef).map(bt=>bt.trim());break;case"object":_e=we.scope;break;default:continue}Ae.push({settings:we,selectors:_e.map(bt=>bt.split(Mf))})}oe.explanation=[];let We=0;for(;Q+We<Y;){let we=k[w],_e=$.substring(we.startIndex,we.endIndex);We+=_e.length,oe.explanation.push({content:_e,scopes:l==="scopeName"?Bf(we.scopes):qf(Ae,we.scopes)}),w+=1}}p.push(oe)}f.push(p),p=[],c=R.ruleStack}return{tokens:f,stateStack:c}}function Bf(e){return e.map(t=>({scopeName:t}))}function qf(e,t){let a=[];for(let n=0,s=t.length;n<s;n++){let r=t[n];a[n]={scopeName:r,themeMatches:Nf(e,r,t.slice(0,n))}}return a}function ql(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function Df(e,t,a){if(!ql(e.at(-1),t))return!1;let n=e.length-2,s=a.length-1;for(;n>=0&&s>=0;)ql(e[n],a[s])&&(n-=1),s-=1;return n===-1}function Nf(e,t,a){let n=[];for(let{selectors:s,settings:r}of e)for(let o of s)if(Df(o,t,a)){n.push(r);break}return n}function Xn(e,t,a,n=wr){let s=Object.entries(a.themes).filter(u=>u[1]).map(u=>({color:u[0],theme:u[1]})),r=s.map(u=>{let c=n(e,t,{...a,theme:u.theme});return{tokens:c,state:$a(c),theme:typeof u.theme=="string"?u.theme:u.theme.name}}),o=Of(...r.map(u=>u.tokens)),i=o[0].map((u,c)=>u.map((p,f)=>{let h={content:p.content,variants:{},offset:p.offset};return"includeExplanation"in a&&a.includeExplanation&&(h.explanation=p.explanation),o.forEach((g,$)=>{let{content:j,explanation:L,offset:k,...w}=g[c][f];h.variants[s[$].color]=w}),h})),l=r[0].state?new Vn(Object.fromEntries(r.map(u=>[u.theme,u.state?.getInternalStack(u.theme)])),r[0].state.lang):void 0;return l&&sn(i,l),i}function Of(...e){let t=e.map(()=>[]),a=e.length;for(let n=0;n<e[0].length;n++){let s=e.map(l=>l[n]),r=t.map(()=>[]);t.forEach((l,u)=>l.push(r[u]));let o=s.map(()=>0),i=s.map(l=>l[0]);for(;i.every(l=>l);){let l=Math.min(...i.map(u=>u.content.length));for(let u=0;u<a;u++){let c=i[u];c.content.length===l?(r[u].push(c),o[u]+=1,i[u]=s[u][o[u]]):(r[u].push({...c,content:c.content.slice(0,l)}),i[u]={...c,content:c.content.slice(l),offset:c.offset+l})}}}return t}var Xl=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var ut=class{constructor(t,a,n){this.normal=a,this.property=t,n&&(this.space=n)}};ut.prototype.normal={};ut.prototype.property={};ut.prototype.space=void 0;function Cr(e,t){let a={},n={};for(let s of e)Object.assign(a,s.property),Object.assign(n,s.normal);return new ut(a,n,t)}function rn(e){return e.toLowerCase()}var ye=class{constructor(t,a){this.attribute=a,this.property=t}};ye.prototype.attribute="";ye.prototype.booleanish=!1;ye.prototype.boolean=!1;ye.prototype.commaOrSpaceSeparated=!1;ye.prototype.commaSeparated=!1;ye.prototype.defined=!1;ye.prototype.mustUseProperty=!1;ye.prototype.number=!1;ye.prototype.overloadedBoolean=!1;ye.prototype.property="";ye.prototype.spaceSeparated=!1;ye.prototype.space=void 0;var on={};Se(on,{boolean:()=>N,booleanish:()=>re,commaOrSpaceSeparated:()=>Ee,commaSeparated:()=>ct,number:()=>v,overloadedBoolean:()=>Zn,spaceSeparated:()=>V});var Ff=0,N=Ht(),re=Ht(),Zn=Ht(),v=Ht(),V=Ht(),ct=Ht(),Ee=Ht();function Ht(){return 2**++Ff}var Lr=Object.keys(on),Wt=class extends ye{constructor(t,a,n,s){let r=-1;if(super(t,a),Zl(this,"space",s),typeof n=="number")for(;++r<Lr.length;){let o=Lr[r];Zl(this,Lr[r],(n&on[o])===on[o])}}};Wt.prototype.defined=!0;function Zl(e,t,a){a&&(e[t]=a)}function Ue(e){let t={},a={};for(let[n,s]of Object.entries(e.properties)){let r=new Wt(n,e.transform(e.attributes||{},n),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(r.mustUseProperty=!0),t[n]=r,a[rn(n)]=n,a[rn(r.attribute)]=n}return new ut(t,a,e.space)}var jr=Ue({properties:{ariaActiveDescendant:null,ariaAtomic:re,ariaAutoComplete:null,ariaBusy:re,ariaChecked:re,ariaColCount:v,ariaColIndex:v,ariaColSpan:v,ariaControls:V,ariaCurrent:null,ariaDescribedBy:V,ariaDetails:null,ariaDisabled:re,ariaDropEffect:V,ariaErrorMessage:null,ariaExpanded:re,ariaFlowTo:V,ariaGrabbed:re,ariaHasPopup:null,ariaHidden:re,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:V,ariaLevel:v,ariaLive:null,ariaModal:re,ariaMultiLine:re,ariaMultiSelectable:re,ariaOrientation:null,ariaOwns:V,ariaPlaceholder:null,ariaPosInSet:v,ariaPressed:re,ariaReadOnly:re,ariaRelevant:null,ariaRequired:re,ariaRoleDescription:V,ariaRowCount:v,ariaRowIndex:v,ariaRowSpan:v,ariaSelected:re,ariaSetSize:v,ariaSort:null,ariaValueMax:v,ariaValueMin:v,ariaValueNow:v,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Kn(e,t){return t in e?e[t]:t}function Jn(e,t){return Kn(e,t.toLowerCase())}var Kl=Ue({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ct,acceptCharset:V,accessKey:V,action:null,allow:null,allowFullScreen:N,allowPaymentRequest:N,allowUserMedia:N,alpha:N,alt:null,as:null,async:N,autoCapitalize:null,autoComplete:V,autoFocus:N,autoPlay:N,blocking:V,capture:null,charSet:null,checked:N,cite:null,className:V,closedBy:null,colorSpace:null,cols:v,colSpan:v,command:null,commandFor:null,content:null,contentEditable:re,controls:N,controlsList:V,coords:v|ct,crossOrigin:null,data:null,dateTime:null,decoding:null,default:N,defer:N,dir:null,dirName:null,disabled:N,download:Zn,draggable:re,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:N,formTarget:null,headers:V,height:v,hidden:Zn,high:v,href:null,hrefLang:null,htmlFor:V,httpEquiv:V,id:null,imageSizes:null,imageSrcSet:null,inert:N,inputMode:null,integrity:null,is:null,isMap:N,itemId:null,itemProp:V,itemRef:V,itemScope:N,itemType:V,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:N,low:v,manifest:null,max:null,maxLength:v,media:null,method:null,min:null,minLength:v,multiple:N,muted:N,name:null,nonce:null,noModule:N,noValidate:N,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:N,optimum:v,pattern:null,ping:V,placeholder:null,playsInline:N,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:N,referrerPolicy:null,rel:V,required:N,reversed:N,rows:v,rowSpan:v,sandbox:V,scope:null,scoped:N,seamless:N,selected:N,shadowRootClonable:N,shadowRootCustomElementRegistry:N,shadowRootDelegatesFocus:N,shadowRootMode:null,shadowRootSerializable:N,shape:null,size:v,sizes:null,slot:null,span:v,spellCheck:re,src:null,srcDoc:null,srcLang:null,srcSet:null,start:v,step:null,style:null,tabIndex:v,target:null,title:null,translate:null,type:null,typeMustMatch:N,useMap:null,value:re,width:v,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:V,axis:null,background:null,bgColor:null,border:v,borderColor:null,bottomMargin:v,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:N,declare:N,event:null,face:null,frame:null,frameBorder:null,hSpace:v,leftMargin:v,link:null,longDesc:null,lowSrc:null,marginHeight:v,marginWidth:v,noResize:N,noHref:N,noShade:N,noWrap:N,object:null,profile:null,prompt:null,rev:null,rightMargin:v,rules:null,scheme:null,scrolling:re,standby:null,summary:null,text:null,topMargin:v,valueType:null,version:null,vAlign:null,vLink:null,vSpace:v,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:N,disablePictureInPicture:N,disableRemotePlayback:N,exportParts:ct,part:V,prefix:null,property:null,results:v,security:null,unselectable:null},space:"html",transform:Jn});var Jl=Ue({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ee,accentHeight:v,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:v,amplitude:v,arabicForm:null,ascent:v,attributeName:null,attributeType:null,azimuth:v,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:v,by:null,calcMode:null,capHeight:v,className:V,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:v,diffuseConstant:v,direction:null,display:null,dur:null,divisor:v,dominantBaseline:null,download:N,dx:null,dy:null,edgeMode:null,editable:null,elevation:v,enableBackground:null,end:null,event:null,exponent:v,externalResourcesRequired:null,fill:null,fillOpacity:v,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ct,g2:ct,glyphName:ct,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:v,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:v,horizOriginX:v,horizOriginY:v,id:null,ideographic:v,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:v,k:v,k1:v,k2:v,k3:v,k4:v,kernelMatrix:Ee,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:v,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:v,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:v,overlineThickness:v,paintOrder:null,panose1:null,path:null,pathLength:v,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:V,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:v,pointsAtY:v,pointsAtZ:v,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ee,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ee,rev:Ee,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ee,requiredFeatures:Ee,requiredFonts:Ee,requiredFormats:Ee,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:v,specularExponent:v,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:v,strikethroughThickness:v,string:null,stroke:null,strokeDashArray:Ee,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:v,strokeOpacity:v,strokeWidth:null,style:null,surfaceScale:v,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ee,tabIndex:v,tableValues:null,target:null,targetX:v,targetY:v,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ee,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:v,underlineThickness:v,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:v,values:null,vAlphabetic:v,vMathematical:v,vectorEffect:null,vHanging:v,vIdeographic:v,version:null,vertAdvY:v,vertOriginX:v,vertOriginY:v,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:v,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Kn});var vr=Ue({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}});var Sr=Ue({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Jn});var Ir=Ue({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}});var Gf=/[A-Z]/g,Ql=/-[a-z]/g,zf=/^data[-\w.:]+$/i;function Ar(e,t){let a=rn(t),n=t,s=ye;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&zf.test(t)){if(t.charAt(4)==="-"){let r=t.slice(5).replace(Ql,Hf);n="data"+r.charAt(0).toUpperCase()+r.slice(1)}else{let r=t.slice(4);if(!Ql.test(r)){let o=r.replace(Gf,Uf);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=Wt}return new s(n,t)}function Uf(e){return"-"+e.toLowerCase()}function Hf(e){return e.charAt(1).toUpperCase()}var Yl=Cr([jr,Kl,vr,Sr,Ir],"html"),Qn=Cr([jr,Jl,vr,Sr,Ir],"svg");var eu={}.hasOwnProperty;function tu(e,t){let a=t||{};function n(s,...r){let o=n.invalid,i=n.handlers;if(s&&eu.call(s,e)){let l=String(s[e]);o=eu.call(i,l)?i[l]:n.unknown}if(o)return o.call(this,s,...r)}return n.handlers=a.handlers||{},n.invalid=a.invalid,n.unknown=a.unknown,n}var Wf=/["&'<>`]/g,Vf=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Xf=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Zf=/[|\\{}()[\]^$+*?.]/g,au=new WeakMap;function nu(e,t){if(e=e.replace(t.subset?Kf(t.subset):Wf,n),t.subset||t.escapeOnly)return e;return e.replace(Vf,a).replace(Xf,n);function a(s,r,o){return t.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,o.charCodeAt(r+2),t)}function n(s,r,o){return t.format(s.charCodeAt(0),o.charCodeAt(r+1),t)}}function Kf(e){let t=au.get(e);return t||(t=Jf(e),au.set(e,t)),t}function Jf(e){let t=[],a=-1;for(;++a<e.length;)t.push(e[a].replace(Zf,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}var Qf=/[\dA-Fa-f]/;function su(e,t,a){let n="&#x"+e.toString(16).toUpperCase();return a&&t&&!Qf.test(String.fromCharCode(t))?n:n+";"}var Yf=/\d/;function ru(e,t,a){let n="&#"+String(e);return a&&t&&!Yf.test(String.fromCharCode(t))?n:n+";"}var ou=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var Yn={nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",fnof:"\u0192",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",bull:"\u2022",hellip:"\u2026",prime:"\u2032",Prime:"\u2033",oline:"\u203E",frasl:"\u2044",weierp:"\u2118",image:"\u2111",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666",quot:'"',amp:"&",lt:"<",gt:">",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};var iu=["cent","copy","divide","gt","lt","not","para","times"];var lu={}.hasOwnProperty,Pr={},es;for(es in Yn)lu.call(Yn,es)&&(Pr[Yn[es]]=es);var eg=/[^\dA-Za-z]/;function uu(e,t,a,n){let s=String.fromCharCode(e);if(lu.call(Pr,s)){let r=Pr[s],o="&"+r;return a&&ou.includes(r)&&!iu.includes(r)&&(!n||t&&t!==61&&eg.test(String.fromCharCode(t)))?o:o+";"}return""}function cu(e,t,a){let n=su(e,t,a.omitOptionalSemicolons),s;if((a.useNamedReferences||a.useShortestReferences)&&(s=uu(e,t,a.omitOptionalSemicolons,a.attribute)),(a.useShortestReferences||!s)&&a.useShortestReferences){let r=ru(e,t,a.omitOptionalSemicolons);r.length<n.length&&(n=r)}return s&&(!a.useShortestReferences||s.length<n.length)?s:n}function dt(e,t){return nu(e,Object.assign({format:cu},t))}var tg=/^>|^->|<!--|-->|--!>|<!-$/g,ag=[">"],ng=["<",">"];function du(e,t,a,n){return n.settings.bogusComments?"<?"+dt(e.value,Object.assign({},n.settings.characterReferences,{subset:ag}))+">":"<!--"+e.value.replace(tg,s)+"-->";function s(r){return dt(r,Object.assign({},n.settings.characterReferences,{subset:ng}))}}function pu(e,t,a,n){return"<!"+(n.settings.upperDoctype?"DOCTYPE":"doctype")+(n.settings.tightDoctype?"":" ")+"html>"}function Tr(e,t){let a=String(e);if(typeof t!="string")throw new TypeError("Expected character");let n=0,s=a.indexOf(t);for(;s!==-1;)n++,s=a.indexOf(t,s+t.length);return n}function mu(e,t){let a=t||{};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}function fu(e){return e.join(" ").trim()}var sg=/[ \t\n\f\r]/g;function Vt(e){return typeof e=="object"?e.type==="text"?gu(e.value):!1:gu(e)}function gu(e){return e.replace(sg,"")===""}var le=hu(1),Rr=hu(-1),rg=[];function hu(e){return t;function t(a,n,s){let r=a?a.children:rg,o=(n||0)+e,i=r[o];if(!s)for(;i&&Vt(i);)o+=e,i=r[o];return i}}var og={}.hasOwnProperty;function ts(e){return t;function t(a,n,s){return og.call(e,a.tagName)&&e[a.tagName](a,n,s)}}var ln=ts({body:lg,caption:Er,colgroup:Er,dd:pg,dt:dg,head:Er,html:ig,li:cg,optgroup:mg,option:fg,p:ug,rp:bu,rt:bu,tbody:hg,td:yu,tfoot:bg,th:yu,thead:gg,tr:yg});function Er(e,t,a){let n=le(a,t,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&Vt(n.value.charAt(0)))}function ig(e,t,a){let n=le(a,t);return!n||n.type!=="comment"}function lg(e,t,a){let n=le(a,t);return!n||n.type!=="comment"}function ug(e,t,a){let n=le(a,t);return n?n.type==="element"&&(n.tagName==="address"||n.tagName==="article"||n.tagName==="aside"||n.tagName==="blockquote"||n.tagName==="details"||n.tagName==="div"||n.tagName==="dl"||n.tagName==="fieldset"||n.tagName==="figcaption"||n.tagName==="figure"||n.tagName==="footer"||n.tagName==="form"||n.tagName==="h1"||n.tagName==="h2"||n.tagName==="h3"||n.tagName==="h4"||n.tagName==="h5"||n.tagName==="h6"||n.tagName==="header"||n.tagName==="hgroup"||n.tagName==="hr"||n.tagName==="main"||n.tagName==="menu"||n.tagName==="nav"||n.tagName==="ol"||n.tagName==="p"||n.tagName==="pre"||n.tagName==="section"||n.tagName==="table"||n.tagName==="ul"):!a||!(a.type==="element"&&(a.tagName==="a"||a.tagName==="audio"||a.tagName==="del"||a.tagName==="ins"||a.tagName==="map"||a.tagName==="noscript"||a.tagName==="video"))}function cg(e,t,a){let n=le(a,t);return!n||n.type==="element"&&n.tagName==="li"}function dg(e,t,a){let n=le(a,t);return!!(n&&n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd"))}function pg(e,t,a){let n=le(a,t);return!n||n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd")}function bu(e,t,a){let n=le(a,t);return!n||n.type==="element"&&(n.tagName==="rp"||n.tagName==="rt")}function mg(e,t,a){let n=le(a,t);return!n||n.type==="element"&&n.tagName==="optgroup"}function fg(e,t,a){let n=le(a,t);return!n||n.type==="element"&&(n.tagName==="option"||n.tagName==="optgroup")}function gg(e,t,a){let n=le(a,t);return!!(n&&n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot"))}function hg(e,t,a){let n=le(a,t);return!n||n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot")}function bg(e,t,a){return!le(a,t)}function yg(e,t,a){let n=le(a,t);return!n||n.type==="element"&&n.tagName==="tr"}function yu(e,t,a){let n=le(a,t);return!n||n.type==="element"&&(n.tagName==="td"||n.tagName==="th")}var xu=ts({body:kg,colgroup:wg,head:_g,html:xg,tbody:$g});function xg(e){let t=le(e,-1);return!t||t.type!=="comment"}function _g(e){let t=new Set;for(let n of e.children)if(n.type==="element"&&(n.tagName==="base"||n.tagName==="title")){if(t.has(n.tagName))return!1;t.add(n.tagName)}let a=e.children[0];return!a||a.type==="element"}function kg(e){let t=le(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Vt(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function wg(e,t,a){let n=Rr(a,t),s=le(e,-1,!0);return a&&n&&n.type==="element"&&n.tagName==="colgroup"&&ln(n,a.children.indexOf(n),a)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function $g(e,t,a){let n=Rr(a,t),s=le(e,-1);return a&&n&&n.type==="element"&&(n.tagName==="thead"||n.tagName==="tbody")&&ln(n,a.children.indexOf(n),a)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}var as={name:[[`
|
|
74
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dm(e,t){return lm(e)||um(e,t)||pm(e,t)||cm()}function pm(e,t){if(e){if(typeof e=="string")return hi(e,t);var a={}.toString.call(e).slice(8,-1);return a==="Object"&&e.constructor&&(a=e.constructor.name),a==="Map"||a==="Set"?Array.from(e):a==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(a)?hi(e,t):void 0}}var Pi=Object.entries,bi=Object.setPrototypeOf,mm=Object.isFrozen,fm=Object.getPrototypeOf,gm=Object.getOwnPropertyDescriptor,me=Object.freeze,be=Object.seal,ua=Object.create,Ti=typeof Reflect<"u"&&Reflect,or=Ti.apply,ir=Ti.construct;me||(me=function(t){return t});be||(be=function(t){return t});or||(or=function(t,a){for(var n=arguments.length,s=new Array(n>2?n-2:0),r=2;r<n;r++)s[r-2]=arguments[r];return t.apply(a,s)});ir||(ir=function(t){for(var a=arguments.length,n=new Array(a>1?a-1:0),s=1;s<a;s++)n[s-1]=arguments[s];return new t(...n)});var Nt=de(Array.prototype.forEach),hm=de(Array.prototype.lastIndexOf),yi=de(Array.prototype.pop),Oa=de(Array.prototype.push),bm=de(Array.prototype.splice),ca=Array.isArray,za=de(String.prototype.toLowerCase),er=de(String.prototype.toString),xi=de(String.prototype.match),Fa=de(String.prototype.replace),_i=de(String.prototype.indexOf),ym=de(String.prototype.trim),xm=de(Number.prototype.toString),_m=de(Boolean.prototype.toString),ki=typeof BigInt>"u"?null:de(BigInt.prototype.toString),wi=typeof Symbol>"u"?null:de(Symbol.prototype.toString),Re=de(Object.prototype.hasOwnProperty),Ga=de(Object.prototype.toString),Ce=de(RegExp.prototype.test),Dt=km(TypeError);function de(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var a=arguments.length,n=new Array(a>1?a-1:0),s=1;s<a;s++)n[s-1]=arguments[s];return or(e,t,n)}}function km(e){return function(){for(var t=arguments.length,a=new Array(t),n=0;n<t;n++)a[n]=arguments[n];return ir(e,a)}}function H(e,t){let a=arguments.length>2&&arguments[2]!==void 0?arguments[2]:za;if(bi&&bi(e,null),!ca(t))return e;let n=t.length;for(;n--;){let s=t[n];if(typeof s=="string"){let r=a(s);r!==s&&(mm(t)||(t[n]=r),s=r)}e[s]=!0}return e}function wm(e){for(let t=0;t<e.length;t++)Re(e,t)||(e[t]=null);return e}function De(e){let t=ua(null);for(let n of Pi(e)){var a=dm(n,2);let s=a[0],r=a[1];Re(e,s)&&(ca(r)?t[s]=wm(r):r&&typeof r=="object"&&r.constructor===Object?t[s]=De(r):t[s]=r)}return t}function $m(e){switch(typeof e){case"string":return e;case"number":return xm(e);case"boolean":return _m(e);case"bigint":return ki?ki(e):"0";case"symbol":return wi?wi(e):"Symbol()";case"undefined":return Ga(e);case"function":case"object":{if(e===null)return Ga(e);let t=e,a=Fe(t,"toString");if(typeof a=="function"){let n=a(t);return typeof n=="string"?n:Ga(n)}return Ga(e)}default:return Ga(e)}}function Fe(e,t){for(;e!==null;){let n=gm(e,t);if(n){if(n.get)return de(n.get);if(typeof n.value=="function")return de(n.value)}e=fm(e)}function a(){return null}return a}function Cm(e){try{return Ce(e,""),!0}catch{return!1}}var $i=me(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),tr=me(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ar=me(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Lm=me(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),nr=me(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),jm=me(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Ci=me(["#text"]),Li=me(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),sr=me(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","pointer-events","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","vector-effect","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ji=me(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Bn=me(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),vm=be(/{{[\w\W]*|^[\w\W]*}}/g),Sm=be(/<%[\w\W]*|^[\w\W]*%>/g),Im=be(/\${[\w\W]*/g),Am=be(/^data-[\-\w.\u00B7-\uFFFF]+$/),Pm=be(/^aria-[\-\w]+$/),vi=be(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Tm=be(/^(?:\w+script|data):/i),Rm=be(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Em=be(/^html$/i),Mm=be(/^[a-z][.\w]*(-[.\w]+)+$/i),Si=be(/<[/\w!]/g),Ii=be(/<[/\w]/g),Bm=be(/<\/no(script|embed|frames)/i),qm=be(/\/>/i),qe={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Ri=["style","script","xmp","iframe","noembed","noframes","plaintext","noscript"],Dm=me(H({},Ri)),Nm=(function(){let e={};return Nt(Ri,t=>{e[t]=be(new RegExp("</"+t+"(?=[\\t\\n\\f\\r />])","i"))}),me(e)})(),Om=function(){return typeof window>"u"?null:window},Fm=function(t,a){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let n=null,s="data-tt-policy-suffix";a&&a.hasAttribute(s)&&(n=a.getAttribute(s));let r="dompurify"+(n?"#"+n:"");try{return t.createPolicy(r,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+r+" could not be created."),null}},Ai=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},wt=function(t,a,n,s){return Re(t,a)&&ca(t[a])?H(s.base?De(s.base):{},t[a],s.transform):n},rr=function(t,a,n){let s=Re(t,a)?t[a]:void 0;return s&&typeof s=="object"?De(s):n()};function Ei(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Om(),t=I=>Ei(I);if(t.version="3.4.15",t.removed=[],!e||!e.document||e.document.nodeType!==qe.document||!e.Element)return t.isSupported=!1,t;let a=e.document,n=a,s=n.currentScript;e.DocumentFragment;let r=e.HTMLTemplateElement,o=e.Node,i=e.Element,l=e.NodeFilter,u=e.NamedNodeMap;u===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let c=e.DOMParser,p=e.trustedTypes,f=i.prototype,g=Fe(f,"cloneNode"),h=Fe(f,"remove"),w=Fe(f,"removeAttributeNode"),j=Fe(f,"nextSibling"),L=Fe(f,"childNodes"),k=Fe(f,"parentNode"),$=Fe(f,"shadowRoot"),R=Fe(f,"attributes"),T=o&&o.prototype?Fe(o.prototype,"nodeType"):null,O=o&&o.prototype?Fe(o.prototype,"nodeName"):null,Q=o&&o.prototype?Fe(o.prototype,"ownerDocument"):null,Y=function(m){return T?T(m):m.nodeType},Oe=function(m){return O?O(m):m.nodeName};if(typeof r=="function"){let I=a.createElement("template");I.content&&I.content.ownerDocument&&(a=I.content.ownerDocument)}let ee,xe="",oe,Ae=!1,We=0,we=function(){if(We>0)throw Dt('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},_e=function(m){we(),We++;try{return ee.createHTML(m)}finally{We--}},bt=function(m){we(),We++;try{return ee.createScriptURL(m)}finally{We--}},At=function(){return Ae||(oe=Fm(p,s),Ae=!0),oe},Pt=a,ea=Pt.implementation,Ta=Pt.createNodeIterator,_=Pt.createDocumentFragment,S=Pt.getElementsByTagName,P=n.importNode,E=Ai();t.isSupported=typeof Pi=="function"&&typeof k=="function"&&ea&&ea.createHTMLDocument!==void 0;let ce=vm,je=Sm,se=Im,Je=Am,Qe=Pm,yn=Tm,ho=Rm,Nd=Mm,bo=vi,te=null,vs=H({},[...$i,...tr,...ar,...nr,...Ci]),ae=null,Ss=H({},[...Li,...sr,...ji,...Bn]),Ye=Object.seal(ua(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Ra=null,yo=null,yt=Object.seal(ua(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),xo=!0,Is=!0,_o=!1,ko=!0,xt=!1,Tt=!0,Rt=!1,As=!1,xn=null,_n=null,Ps=!1,ta=!1,kn=!1,wn=!1,wo=!0,$o=!1,Co="user-content-",Ts=!0,Rs=!1,aa={},na=null,Lo=H({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]),jo=null,vo=H({},["audio","video","img","source","image","track"]),So=null,Io=H({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),$n="http://www.w3.org/1998/Math/MathML",Cn="http://www.w3.org/2000/svg",et="http://www.w3.org/1999/xhtml",sa=et,Es=!1,Ms=null,Od=H({},[$n,Cn,et],er),Ao=me(["mi","mo","mn","ms","mtext"]),Bs=H({},Ao),Po=me(["annotation-xml"]),qs=H({},Po),Fd=H({},["title","style","font","a","script"]),Ea=null,Gd=["application/xhtml+xml","text/html"],zd="text/html",ie=null,ra=null,Ud=a.createElement("form"),To=function(m){return m instanceof RegExp||m instanceof Function},Ds=function(){let m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ra&&ra===m)return;(!m||typeof m!="object")&&(m={}),m=De(m),Ea=Gd.indexOf(m.PARSER_MEDIA_TYPE)===-1?zd:m.PARSER_MEDIA_TYPE,ie=Ea==="application/xhtml+xml"?er:za,te=wt(m,"ALLOWED_TAGS",vs,{transform:ie}),ae=wt(m,"ALLOWED_ATTR",Ss,{transform:ie}),Ms=wt(m,"ALLOWED_NAMESPACES",Od,{transform:er}),So=wt(m,"ADD_URI_SAFE_ATTR",Io,{transform:ie,base:Io}),jo=wt(m,"ADD_DATA_URI_TAGS",vo,{transform:ie,base:vo}),na=wt(m,"FORBID_CONTENTS",Lo,{transform:ie}),Ra=wt(m,"FORBID_TAGS",De({}),{transform:ie}),yo=wt(m,"FORBID_ATTR",De({}),{transform:ie}),aa=Re(m,"USE_PROFILES")?m.USE_PROFILES&&typeof m.USE_PROFILES=="object"?De(m.USE_PROFILES):m.USE_PROFILES:!1,xo=m.ALLOW_ARIA_ATTR!==!1,Is=m.ALLOW_DATA_ATTR!==!1,_o=m.ALLOW_UNKNOWN_PROTOCOLS||!1,ko=m.ALLOW_SELF_CLOSE_IN_ATTR!==!1,xt=m.SAFE_FOR_TEMPLATES||!1,Tt=m.SAFE_FOR_XML!==!1,Rt=m.WHOLE_DOCUMENT||!1,ta=m.RETURN_DOM||!1,kn=m.RETURN_DOM_FRAGMENT||!1,wn=m.RETURN_TRUSTED_TYPE||!1,Ps=m.FORCE_BODY||!1,wo=m.SANITIZE_DOM!==!1,$o=m.SANITIZE_NAMED_PROPS||!1,Ts=m.KEEP_CONTENT!==!1,Rs=m.IN_PLACE||!1,bo=Cm(m.ALLOWED_URI_REGEXP)?m.ALLOWED_URI_REGEXP:vi,sa=typeof m.NAMESPACE=="string"?m.NAMESPACE:et,Bs=rr(m,"MATHML_TEXT_INTEGRATION_POINTS",()=>H({},Ao)),qs=rr(m,"HTML_INTEGRATION_POINTS",()=>H({},Po));let y=rr(m,"CUSTOM_ELEMENT_HANDLING",()=>ua(null));if(Ye=ua(null),Re(y,"tagNameCheck")&&To(y.tagNameCheck)&&(Ye.tagNameCheck=y.tagNameCheck),Re(y,"attributeNameCheck")&&To(y.attributeNameCheck)&&(Ye.attributeNameCheck=y.attributeNameCheck),Re(y,"allowCustomizedBuiltInElements")&&typeof y.allowCustomizedBuiltInElements=="boolean"&&(Ye.allowCustomizedBuiltInElements=y.allowCustomizedBuiltInElements),be(Ye),xt&&(Is=!1),kn&&(ta=!0),aa&&(te=H({},Ci),ae=ua(null),aa.html===!0&&(H(te,$i),H(ae,Li)),aa.svg===!0&&(H(te,tr),H(ae,sr),H(ae,Bn)),aa.svgFilters===!0&&(H(te,ar),H(ae,sr),H(ae,Bn)),aa.mathMl===!0&&(H(te,nr),H(ae,ji),H(ae,Bn))),yt.tagCheck=null,yt.attributeCheck=null,Re(m,"ADD_TAGS")&&(typeof m.ADD_TAGS=="function"?yt.tagCheck=m.ADD_TAGS:ca(m.ADD_TAGS)&&(te===vs&&(te=De(te)),H(te,m.ADD_TAGS,ie))),Re(m,"ADD_ATTR")&&(typeof m.ADD_ATTR=="function"?yt.attributeCheck=m.ADD_ATTR:ca(m.ADD_ATTR)&&(ae===Ss&&(ae=De(ae)),H(ae,m.ADD_ATTR,ie))),Re(m,"ADD_FORBID_CONTENTS")&&ca(m.ADD_FORBID_CONTENTS)&&(na===Lo&&(na=De(na)),H(na,m.ADD_FORBID_CONTENTS,ie)),Ts&&(te["#text"]=!0),Rt&&H(te,["html","head","body"]),te.table&&(H(te,["tbody"]),delete Ra.tbody),m.TRUSTED_TYPES_POLICY){if(typeof m.TRUSTED_TYPES_POLICY.createHTML!="function")throw Dt('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof m.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw Dt('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');let C=ee;ee=m.TRUSTED_TYPES_POLICY;try{xe=_e("")}catch(A){throw ee=C,A}}else m.TRUSTED_TYPES_POLICY===null?(ee=void 0,xe=""):(ee===void 0&&(ee=At()),ee&&typeof xe=="string"&&(xe=_e("")));me&&me(m),ra=m},Ro=H({},[...tr,...ar,...Lm]),Eo=H({},[...nr,...jm]),Hd=function(m,y,C){return y.namespaceURI===et?m==="svg":y.namespaceURI===$n?m==="svg"&&(C==="annotation-xml"||Bs[C]):!!Ro[m]},Wd=function(m,y,C){return y.namespaceURI===et?m==="math":y.namespaceURI===Cn?m==="math"&&qs[C]:!!Eo[m]},Vd=function(m,y,C){return y.namespaceURI===Cn&&!qs[C]||y.namespaceURI===$n&&!Bs[C]?!1:!Eo[m]&&(Fd[m]||!Ro[m])},Xd=function(m){let y=k(m);(!y||!y.tagName)&&(y={namespaceURI:sa,tagName:"template"});let C=za(m.tagName),A=za(y.tagName);return Ms[m.namespaceURI]?m.namespaceURI===Cn?Hd(C,y,A):m.namespaceURI===$n?Wd(C,y,A):m.namespaceURI===et?Vd(C,y,A):!!(Ea==="application/xhtml+xml"&&Ms[m.namespaceURI]):!1},_t=function(m){Oa(t.removed,{element:m});try{k(m).removeChild(m)}catch{if(h(m),!k(m))throw Dt("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Mo=function(m,y,C){try{w(m,y)}catch{try{m.removeAttribute(C)}catch{}}},Ln=function(m){jn(m);let y=L(m);if(y){let A=[];Nt(y,M=>{Oa(A,M)}),Nt(A,M=>{try{h(M)}catch{}})}let C=R(m);if(C)for(let A=C.length-1;A>=0;--A){let M=C[A],D=M&&M.name;typeof D=="string"&&Mo(m,M,D)}},Et=function(m,y,C){if(!C)try{C=y.getAttributeNode(m)}catch{C=null}Oa(t.removed,{attribute:C||null,from:y});try{C?w(y,C):y.removeAttribute(m)}catch{try{y.removeAttribute(m)}catch{}}if(m==="is")if(ta||kn)try{_t(y)}catch{}else try{y.setAttribute(m,"")}catch{}},Zd=function(m){let y=R(m);if(y)for(let C=y.length-1;C>=0;--C){let A=y[C],M=A&&A.name;typeof M!="string"||ae[ie(M)]||Mo(m,A,M)}},jn=function(m){let y=[m];for(;y.length>0;){let C=y.pop();Y(C)===qe.element&&Zd(C);let M=L(C);if(M)for(let D=M.length-1;D>=0;--D)y.push(M[D])}},Bo=function(m,y){return Tt?m==="patchsrc"?!0:m==="for"&&y!=="label"&&y!=="output":!1},Kd=function(m){if(!Tt)return;let y=[m];for(;y.length>0;){let C=y.pop(),A=Y(C);if(A===qe.processingInstruction||A===qe.comment&&Ce(Ii,C.data)){try{h(C)}catch{}continue}if(A===qe.element){let D=C,K=ie(Oe(C));try{D.hasAttribute&&D.hasAttribute("patchsrc")&&D.removeAttribute("patchsrc"),D.hasAttribute&&D.hasAttribute("for")&&Bo("for",K)&&D.removeAttribute("for")}catch{}}let M=L(C);if(M)for(let D=M.length-1;D>=0;--D)y.push(M[D])}},qo=function(m){let y=null,C=null;if(Ps)m="<remove></remove>"+m;else{let D=xi(m,/^[\r\n\t ]+/);C=D&&D[0]}Ea==="application/xhtml+xml"&&sa===et&&(m='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+m+"</body></html>");let A=ee?_e(m):m;if(sa===et)try{y=new c().parseFromString(A,Ea)}catch{}if(!y||!y.documentElement){y=ea.createDocument(sa,"template",null);try{y.documentElement.innerHTML=Es?xe:A}catch{}}let M=y.body||y.documentElement;return m&&C&&M.insertBefore(a.createTextNode(C),M.childNodes[0]||null),sa===et?S.call(y,Rt?"html":"body")[0]:Rt?y.documentElement:M},Do=function(m){let y=Q?Q(m):m.ownerDocument;return Ta.call(y||m,m,l.SHOW_ELEMENT|l.SHOW_COMMENT|l.SHOW_TEXT|l.SHOW_PROCESSING_INSTRUCTION|l.SHOW_CDATA_SECTION,null)},vn=function(m){return m=Fa(m,ce," "),m=Fa(m,je," "),m=Fa(m,se," "),m},Ns=function(m){var y;m.normalize();let C=Q?Q(m):m.ownerDocument,A=Ta.call(C||m,m,l.SHOW_TEXT|l.SHOW_COMMENT|l.SHOW_CDATA_SECTION|l.SHOW_PROCESSING_INSTRUCTION,null),M=A.nextNode();for(;M;)M.data=vn(M.data),M=A.nextNode();let D=(y=m.querySelectorAll)===null||y===void 0?void 0:y.call(m,"template");D&&Nt(D,K=>{oa(K.content)&&Ns(K.content)})},Sn=function(m){let y=O?O(m):null;return typeof y!="string"||ie(y)!=="form"?!1:typeof m.nodeName!="string"||typeof m.textContent!="string"||typeof m.removeChild!="function"||m.attributes!==R(m)||typeof m.removeAttribute!="function"||typeof m.removeAttributeNode!="function"||typeof m.getAttributeNode!="function"||typeof m.setAttribute!="function"||typeof m.namespaceURI!="string"||typeof m.insertBefore!="function"||typeof m.hasChildNodes!="function"||m.nodeType!==T(m)||m.childNodes!==L(m)},oa=function(m){if(!T||typeof m!="object"||m===null)return!1;try{return T(m)===qe.documentFragment}catch{return!1}},Ma=function(m){if(!T||typeof m!="object"||m===null)return!1;try{return typeof T(m)=="number"}catch{return!1}};function tt(I,m,y){I.length!==0&&Nt(I,C=>{C.call(t,m,y,ra)})}let Jd=function(m,y){return!!(Tt&&m.hasChildNodes()&&!Ma(m.firstElementChild)&&Ce(Si,m.textContent)&&Ce(Si,m.innerHTML)||Tt&&m.namespaceURI===et&&Dm[y]&&(Ma(m.firstElementChild)||typeof m.textContent=="string"&&Ce(Nm[y],m.textContent))||m.nodeType===qe.processingInstruction||Tt&&m.nodeType===qe.comment&&Ce(Ii,m.data))},In=function(m,y){if(m instanceof RegExp)return Ce(m,y);if(m instanceof Function){for(var C=arguments.length,A=new Array(C>2?C-2:0),M=2;M<C;M++)A[M-2]=arguments[M];return!!m(y,...A)}return!1},Qd=function(m,y,C){if(!Ra[y]&&zo(y)&&In(Ye.tagNameCheck,y))return!1;if(Ts&&!na[y]){let A=k(m),M=L(m);if(M&&A){let D=M.length;for(let K=D-1;K>=0;--K){let ne=m===C?g(M[K],!0):M[K];A.insertBefore(ne,j(m))}}}return _t(m),!0},No=function(m,y,C,A){return m.length===0?y:y===C||y===A?De(y):y},Oo=function(m,y){return m===y||k(m)!==null?!1:(Rs&&jn(m),!0)},Fo=function(m,y){if(tt(E.beforeSanitizeElements,m,null),Oo(m,y))return!0;if(Sn(m))return _t(m),!0;let C=ie(Oe(m));if(te=No(E.uponSanitizeElement,te,vs,xn),tt(E.uponSanitizeElement,m,{tagName:C,allowedTags:te}),Oo(m,y))return!0;if(Jd(m,C))return _t(m),!0;if(Ra[C]||!(yt.tagCheck instanceof Function&&yt.tagCheck(C))&&!te[C]){let M=Qd(m,C,y);return M===!1&&tt(E.afterSanitizeElements,m,null),M}if(Y(m)===qe.element&&!Xd(m)||(C==="noscript"||C==="noembed"||C==="noframes")&&Ce(Bm,m.innerHTML))return _t(m),!0;if(xt&&m.nodeType===qe.text){let M=vn(m.textContent);m.textContent!==M&&(Oa(t.removed,{element:m.cloneNode()}),m.textContent=M)}return tt(E.afterSanitizeElements,m,null),!1},Go=function(m,y,C){if(yo[y]||Bo(y,m)||wo&&(y==="id"||y==="name")&&(C in a||C in Ud))return!1;let A=ae[y]||yt.attributeCheck instanceof Function&&yt.attributeCheck(y,m);return Is&&Ce(Je,y)||xo&&Ce(Qe,y)?!0:A?So[y]||Ce(bo,Fa(C,ho,""))||(y==="src"||y==="xlink:href"||y==="href")&&m!=="script"&&_i(C,"data:")===0&&jo[m]||_o&&!Ce(yn,Fa(C,ho,""))?!0:!C:zo(m)&&In(Ye.tagNameCheck,m)&&In(Ye.attributeNameCheck,y,m)||y==="is"&&Ye.allowCustomizedBuiltInElements&&In(Ye.tagNameCheck,C)},Yd=H({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),zo=function(m){return!Yd[za(m)]&&Ce(Nd,m)},ep=function(m,y,C,A){if(ee&&typeof p=="object"&&typeof p.getAttributeType=="function"&&!C)switch(p.getAttributeType(m,y)){case"TrustedHTML":return _e(A);case"TrustedScriptURL":return bt(A)}return A},tp=function(m,y,C,A){try{return C?m.setAttributeNS(C,y,A):m.setAttribute(y,A),Sn(m)?(_t(m),!1):!0}catch{return Et(y,m),!1}},Uo=function(m){tt(E.beforeSanitizeAttributes,m,null);let y=m.attributes;if(!y||Sn(m))return;ae=No(E.uponSanitizeAttribute,ae,Ss,_n);let C={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ae,forceKeepAttr:void 0},A=y.length,M=ie(m.nodeName);for(;A--;){let D=y[A],K=D.name,ne=D.namespaceURI,Pe=D.value,Te=ie(K),Fs=Pe,ve=K==="value"?Fs:ym(Fs),Ho=!1;if(C.attrName=Te,C.attrValue=ve,C.keepAttr=!0,C.forceKeepAttr=void 0,tt(E.uponSanitizeAttribute,m,C),ve=C.attrValue,$o&&(Te==="id"||Te==="name")&&_i(ve,Co)!==0&&(Et(K,m,D),ve=Co+ve,Ho=!0),Tt&&Ce(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,ve)){Et(K,m,D);continue}if(Te==="attributename"&&xi(ve,"href")){Et(K,m,D);continue}if(!C.forceKeepAttr){if(!C.keepAttr){Et(K,m,D);continue}if(!ko&&Ce(qm,ve)){Et(K,m,D);continue}if(xt&&(ve=vn(ve)),!Go(M,Te,ve)){Et(K,m,D);continue}ve=ep(M,Te,ne,ve),ve!==Fs&&tp(m,K,ne,ve)&&Ho&&yi(t.removed)}}tt(E.afterSanitizeAttributes,m,null)},An=function(m){let y=null,C=Do(m);for(tt(E.beforeSanitizeShadowDOM,m,null);y=C.nextNode();)if(tt(E.uponSanitizeShadowNode,y,null),Fo(y,m),Uo(y),oa(y.content)&&An(y.content),Y(y)===qe.element){let A=$(y);oa(A)&&(Os(A),An(A))}tt(E.afterSanitizeShadowDOM,m,null)},Os=function(m){let y=[{node:m,shadow:null}];for(;y.length>0;){let C=y.pop();if(C.shadow){An(C.shadow);continue}let A=C.node,D=Y(A)===qe.element,K=L(A);if(K)for(let ne=K.length-1;ne>=0;--ne)y.push({node:K[ne],shadow:null});if(D){let ne=O?O(A):null;if(typeof ne=="string"&&ie(ne)==="template"){let Pe=A.content;oa(Pe)&&y.push({node:Pe,shadow:null})}}if(D){let ne=$(A);oa(ne)&&y.push({node:null,shadow:ne},{node:ne,shadow:null})}}};return t.sanitize=function(I){let m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},y=null,C=null,A=null,M=null;if(Es=!I,Es&&(I="<!-->"),typeof I!="string"&&!Ma(I)&&(I=$m(I),typeof I!="string"))throw Dt("dirty is not a string, aborting");if(!t.isSupported)return I;As?(te=xn,ae=_n):Ds(m),(E.uponSanitizeElement.length>0||E.uponSanitizeAttribute.length>0)&&(te=De(te)),E.uponSanitizeAttribute.length>0&&(ae=De(ae)),t.removed=[];let D=Rs&&typeof I!="string"&&Ma(I);if(D){Kd(I);let Pe=Oe(I);if(typeof Pe=="string"){let Te=ie(Pe);if(!te[Te]||Ra[Te])throw Ln(I),Dt("root node is forbidden and cannot be sanitized in-place")}if(Sn(I))throw Ln(I),Dt("root node is clobbered and cannot be sanitized in-place");try{Os(I)}catch(Te){throw Ln(I),Te}}else if(Ma(I))y=qo("<!---->"),C=y.ownerDocument.importNode(I,!0),C.nodeType===qe.element&&C.nodeName==="BODY"||C.nodeName==="HTML"?y=C:y.appendChild(C),Os(y);else{if(!ta&&!xt&&!Rt&&I.indexOf("<")===-1)return ee&&wn?_e(I):I;if(y=qo(I),!y)return ta?null:wn?xe:""}y&&Ps&&_t(y.firstChild);let K=D?I:y;try{let Pe=Do(K);for(;A=Pe.nextNode();)Fo(A,K),Uo(A),oa(A.content)&&An(A.content)}catch(Pe){throw D&&(Ln(I),Nt(t.removed,Te=>{Te.element&&jn(Te.element)})),Pe}if(D)return Nt(t.removed,Pe=>{Pe.element&&jn(Pe.element)}),xt&&Ns(I),I;if(ta){if(xt&&Ns(y),kn)for(M=_.call(y.ownerDocument);y.firstChild;)M.appendChild(y.firstChild);else M=y;return(ae.shadowroot||ae.shadowrootmode)&&(M=P.call(n,M,!0)),M}let ne=Rt?y.outerHTML:y.innerHTML;return Rt&&te["!doctype"]&&y.ownerDocument&&y.ownerDocument.doctype&&y.ownerDocument.doctype.name&&Ce(Em,y.ownerDocument.doctype.name)&&(ne="<!DOCTYPE "+y.ownerDocument.doctype.name+`>
|
|
75
|
+
`+ne),xt&&(ne=vn(ne)),ee&&wn?_e(ne):ne},t.setConfig=function(){let I=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ds(I),As=!0,xn=te,_n=ae},t.clearConfig=function(){ra=null,As=!1,xn=null,_n=null,ee=oe,xe=""},t.isValidAttribute=function(I,m,y){ra||Ds({});let C=ie(I),A=ie(m);return Go(C,A,y)},t.addHook=function(I,m){typeof m=="function"&&Re(E,I)&&Oa(E[I],m)},t.removeHook=function(I,m){if(Re(E,I)){if(m!==void 0){let y=hm(E[I],m);return y===-1?void 0:bm(E[I],y,1)[0]}return yi(E[I])}},t.removeHooks=function(I){Re(E,I)&&(E[I]=[])},t.removeAllHooks=function(){E=Ai()},t}var Ua=Ei();var qn=require("react");var Mi=e=>e?.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();function Bi(e,t,a=[]){if(t==null)throw new Error("[lucide]: iconNode is required when icon name is used");return{name:Mi(e),size:24,node:t,...a.length>0?{aliases:a}:{}}}var qi=e=>{let t="",a=!1;for(let n of e){if(n==="-"||n==="_"||n<=" "){a=t.length>0;continue}t.length===0?t+=n.toLowerCase():t+=a?n.toUpperCase():n,a=!1}return t};var Di=e=>{let t=qi(e);return t.charAt(0).toUpperCase()+t.slice(1)};var Wa=require("react");var Ha=(...e)=>e.filter((t,a,n)=>!!t&&t.trim()!==""&&n.indexOf(t)===a).join(" ").trim();var $t={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};function lr(e){return e!=null}function Ni(e,t={}){let a=t.attributeNames??{},n=f=>a[f]??f,s=e.size??e.width??$t.width,r=e.size??e.height??$t.height,o=e.aliases?.filter(f=>typeof f=="string"&&f.trim()!=="").map(f=>`lucide-${f}`)??[],i=[...e.name?[`lucide-${e.name}`]:[],...o],l=t.className?.split(" ").filter(Boolean)??[],u=t.includeDefaultClasses===!1?Ha(...l):Ha("lucide",...i,...l),c=t.absoluteStrokeWidth?Number(t.strokeWidth??$t["stroke-width"])*Number(e.size??e.width??$t.width)/Number(t.size??t.width??$t.width):t.strokeWidth??$t["stroke-width"];return["svg",{...Object.entries($t).reduce((f,[g,h])=>(f[n(g)]=h,f),{}),..."color"in t&&t.color&&{[n("stroke")]:t.color},..."size"in t&&lr(t.size)&&{[n("width")]:t.size,[n("height")]:t.size},..."width"in t&&lr(t.width)&&{[n("width")]:t.width},..."height"in t&&lr(t.height)&&{[n("height")]:t.height},[n("stroke-width")]:c,...u&&{[n("class")]:u},[n("viewBox")]:`0 0 ${s} ${r}`,...t.hasA11yProp===!1?{[n("aria-hidden")]:"true"}:{},..."attributes"in t&&t.attributes},e.node.map(f=>{let[g,h,w]=f,j=t.nonScalingStroke?{[n("vector-effect")]:"non-scaling-stroke",...h}:h;return w?[g,j,w]:[g,j]})]}function Oi(e,t={}){return Ni(e,{...t,attributeNames:{...t.attributeNames,class:"className","stroke-width":"strokeWidth","stroke-linecap":"strokeLinecap","stroke-linejoin":"strokeLinejoin","vector-effect":"vectorEffect"}})}var Fi=e=>{for(let t in e)if(t.startsWith("aria-")||t==="role"||t==="title")return!0;return!1};var da=require("react");var Gm=(0,da.createContext)({});var Gi=()=>(0,da.useContext)(Gm);var zi=(0,Wa.forwardRef)(({color:e,size:t,width:a,height:n,strokeWidth:s,absoluteStrokeWidth:r,nonScalingStroke:o,className:i="",children:l,iconNode:u=[],icon:c={node:u,aliases:[],size:24},...p},f)=>{let{size:g=24,strokeWidth:h=2,absoluteStrokeWidth:w=!1,nonScalingStroke:j=!1,color:L="currentColor",className:k=""}=Gi()??{},$=!!l||Fi(p),[R,T,O=[]]=Oi(c,{color:e??L,width:a??t??g,height:n??t??g,strokeWidth:s??h,absoluteStrokeWidth:r??w,nonScalingStroke:o??j,className:Ha(k,i),hasA11yProp:$,attributes:p});return(0,Wa.createElement)(R,{ref:f,...T},[...O.map(([Q,Y])=>(0,Wa.createElement)(Q,Y)),...Array.isArray(l)?l:[l]])});function U(e,t=[],a=[]){let n=typeof e=="string"?Bi(e,t,a):e,s=(0,qn.forwardRef)(({className:r,...o},i)=>(0,qn.createElement)(zi,{ref:i,icon:n,className:r,...o}));return n.name&&(s.displayName=Di(n.name)),s}var Ui={name:"arrow-right",size:24,node:[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]};Ui.node;var pa=U(Ui);var Hi={name:"bell-off",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742",key:"178tsu"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05",key:"1hqiys"}]]};Hi.node;var ma=U(Hi);var Wi={name:"bell",size:24,node:[["path",{d:"M10.268 21a2 2 0 0 0 3.464 0",key:"vwvbt9"}],["path",{d:"M3.262 15.326A1 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",key:"11g9vi"}]]};Wi.node;var fa=U(Wi);var Vi={name:"check",size:24,node:[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]};Vi.node;var rt=U(Vi);var Xi={name:"copy",size:24,node:[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]};Xi.node;var Ot=U(Xi);var Zi={name:"globe",size:24,node:[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]};Zi.node;var ga=U(Zi);var Ki={name:"inbox",size:24,node:[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]};Ki.node;var ha=U(Ki);var Ji={name:"mail",size:24,node:[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7",key:"132q7q"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}]]};Ji.node;var ba=U(Ji);var Qi={name:"messages-square",size:24,node:[["path",{d:"M16 10a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 14.286V4a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2z",key:"1n2ejm"}],["path",{d:"M20 9a2 2 0 0 1 2 2v10.286a.71.71 0 0 1-1.212.502l-2.202-2.202A2 2 0 0 0 17.172 19H10a2 2 0 0 1-2-2v-1",key:"1qfcsi"}]]};Qi.node;var ya=U(Qi);var Yi={name:"pen-line",size:24,node:[["path",{d:"M13 21h8",key:"1jsn5i"}],["path",{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-.497z",key:"1a8usu"}]],aliases:["edit-3"]};Yi.node;var ot=U(Yi);var el={name:"refresh-cw",size:24,node:[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]};el.node;var xa=U(el);var tl={name:"reply",size:24,node:[["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}],["path",{d:"m9 17-5-5 5-5",key:"nvlc11"}]]};tl.node;var _a=U(tl);var al={name:"search",size:24,node:[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]};al.node;var Ft=U(al);var nl={name:"send",size:24,node:[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]};nl.node;var Ge=U(nl);var sl={name:"trash",size:24,node:[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],aliases:["trash-2"]};sl.node;var it=U(sl);var rl={name:"user-plus",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]};rl.node;var Gt=U(rl);var ol={name:"users",size:24,node:[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]]};ol.node;var ka=U(ol);var il={name:"x",size:24,node:[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]};il.node;var zt=U(il);var Z=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function zm(e){return yr(e)}function yr(e){return Array.isArray(e)?Um(e):e instanceof RegExp?e:typeof e=="object"?Hm(e):e}function Um(e){let t=[];for(let a=0,n=e.length;a<n;a++)t[a]=yr(e[a]);return t}function Hm(e){let t={};for(let a in e)t[a]=yr(e[a]);return t}function hl(e,...t){return t.forEach(a=>{for(let n in a)e[n]=a[n]}),e}function bl(e){let t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?bl(e.substring(0,e.length-1)):e.substr(~t+1)}var ur=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Dn=class{static hasCaptures(e){return e===null?!1:(ur.lastIndex=0,ur.test(e))}static replaceCaptures(e,t,a){return e.replace(ur,(n,s,r,o)=>{let i=a[parseInt(s||r,10)];if(i){let l=t.substring(i.start,i.end);for(;l[0]===".";)l=l.substring(1);switch(o){case"downcase":return l.toLowerCase();case"upcase":return l.toUpperCase();default:return l}}else return n})}};function yl(e,t){return e<t?-1:e>t?1:0}function xl(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let a=e.length,n=t.length;if(a===n){for(let s=0;s<a;s++){let r=yl(e[s],t[s]);if(r!==0)return r}return 0}return a-n}function ll(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function _l(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var kl=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},Za=class{constructor(e,t,a){this._colorMap=e,this._defaults=t,this._root=a}static createFromRawTheme(e,t){return this.createFromParsedTheme(Xm(e),t)}static createFromParsedTheme(e,t){return Km(e,t)}_cachedMatchRoot=new kl(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(s=>Wm(e.parent,s.parentScopes));return n?new wl(n.fontStyle,n.foreground,n.background):null}},cr=class Nn{constructor(t,a){this.parent=t,this.scopeName=a}static push(t,a){for(let n of a)t=new Nn(t,n);return t}static from(...t){let a=null;for(let n=0;n<t.length;n++)a=new Nn(a,t[n]);return a}push(t){return new Nn(this,t)}getSegments(){let t=this,a=[];for(;t;)a.push(t.scopeName),t=t.parent;return a.reverse(),a}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){let a=[],n=this;for(;n&&n!==t;)a.push(n.scopeName),n=n.parent;return n===t?a.reverse():void 0}};function Wm(e,t){if(t.length===0)return!0;for(let a=0;a<t.length;a++){let n=t[a],s=!1;if(n===">"){if(a===t.length-1)return!1;n=t[++a],s=!0}for(;e&&!Vm(e.scopeName,n);){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Vm(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var wl=class{constructor(e,t,a){this.fontStyle=e,this.foregroundId=t,this.backgroundId=a}};function Xm(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,a=[],n=0;for(let s=0,r=t.length;s<r;s++){let o=t[s];if(!o.settings)continue;let i;if(typeof o.scope=="string"){let p=o.scope;p=p.replace(/^[,]+/,""),p=p.replace(/[,]+$/,""),i=p.split(",")}else Array.isArray(o.scope)?i=o.scope:i=[""];let l=-1;if(typeof o.settings.fontStyle=="string"){l=0;let p=o.settings.fontStyle.split(" ");for(let f=0,g=p.length;f<g;f++)switch(p[f]){case"italic":l=l|1;break;case"bold":l=l|2;break;case"underline":l=l|4;break;case"strikethrough":l=l|8;break}}let u=null;typeof o.settings.foreground=="string"&&ll(o.settings.foreground)&&(u=o.settings.foreground);let c=null;typeof o.settings.background=="string"&&ll(o.settings.background)&&(c=o.settings.background);for(let p=0,f=i.length;p<f;p++){let h=i[p].trim().split(" "),w=h[h.length-1],j=null;h.length>1&&(j=h.slice(0,h.length-1),j.reverse()),a[n++]=new Zm(w,j,s,l,u,c)}}return a}var Zm=class{constructor(e,t,a,n,s,r){this.scope=e,this.parentScopes=t,this.index=a,this.fontStyle=n,this.foreground=s,this.background=r}},ke=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(ke||{});function Km(e,t){e.sort((l,u)=>{let c=yl(l.scope,u.scope);return c!==0||(c=xl(l.parentScopes,u.parentScopes),c!==0)?c:l.index-u.index});let a=0,n="#000000",s="#ffffff";for(;e.length>=1&&e[0].scope==="";){let l=e.shift();l.fontStyle!==-1&&(a=l.fontStyle),l.foreground!==null&&(n=l.foreground),l.background!==null&&(s=l.background)}let r=new Jm(t),o=new wl(a,r.getId(n),r.getId(s)),i=new Ym(new pr(0,null,-1,0,0),[]);for(let l=0,u=e.length;l<u;l++){let c=e[l];i.insert(0,c.scope,c.parentScopes,c.fontStyle,r.getId(c.foreground),r.getId(c.background))}return new Za(r,o,i)}var Jm=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,a=e.length;t<a;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Qm=Object.freeze([]),pr=class $l{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(t,a,n,s,r){this.scopeDepth=t,this.parentScopes=a||Qm,this.fontStyle=n,this.foreground=s,this.background=r}clone(){return new $l(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let a=[];for(let n=0,s=t.length;n<s;n++)a[n]=t[n].clone();return a}acceptOverwrite(t,a,n,s){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,a!==-1&&(this.fontStyle=a),n!==0&&(this.foreground=n),s!==0&&(this.background=s)}},Ym=class mr{constructor(t,a=[],n={}){this._mainRule=t,this._children=n,this._rulesWithParentScopes=a}_rulesWithParentScopes;static _cmpBySpecificity(t,a){if(t.scopeDepth!==a.scopeDepth)return a.scopeDepth-t.scopeDepth;let n=0,s=0;for(;t.parentScopes[n]===">"&&n++,a.parentScopes[s]===">"&&s++,!(n>=t.parentScopes.length||s>=a.parentScopes.length);){let r=a.parentScopes[s].length-t.parentScopes[n].length;if(r!==0)return r;n++,s++}return a.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let n=t.indexOf("."),s,r;if(n===-1?(s=t,r=""):(s=t.substring(0,n),r=t.substring(n+1)),this._children.hasOwnProperty(s))return this._children[s].match(r)}let a=this._rulesWithParentScopes.concat(this._mainRule);return a.sort(mr._cmpBySpecificity),a}insert(t,a,n,s,r,o){if(a===""){this._doInsertHere(t,n,s,r,o);return}let i=a.indexOf("."),l,u;i===-1?(l=a,u=""):(l=a.substring(0,i),u=a.substring(i+1));let c;this._children.hasOwnProperty(l)?c=this._children[l]:(c=new mr(this._mainRule.clone(),pr.cloneArr(this._rulesWithParentScopes)),this._children[l]=c),c.insert(t+1,u,n,s,r,o)}_doInsertHere(t,a,n,s,r){if(a===null){this._mainRule.acceptOverwrite(t,n,s,r);return}for(let o=0,i=this._rulesWithParentScopes.length;o<i;o++){let l=this._rulesWithParentScopes[o];if(xl(l.parentScopes,a)===0){l.acceptOverwrite(t,n,s,r);return}}n===-1&&(n=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),r===0&&(r=this._mainRule.background),this._rulesWithParentScopes.push(new pr(t,a,n,s,r))}},Ct=class ze{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){let a=ze.getLanguageId(t),n=ze.getTokenType(t),s=ze.getFontStyle(t),r=ze.getForeground(t),o=ze.getBackground(t);console.log({languageId:a,tokenType:n,fontStyle:s,foreground:r,background:o})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,a,n,s,r,o,i){let l=ze.getLanguageId(t),u=ze.getTokenType(t),c=ze.containsBalancedBrackets(t)?1:0,p=ze.getFontStyle(t),f=ze.getForeground(t),g=ze.getBackground(t);return a!==0&&(l=a),n!==8&&(u=n),s!==null&&(c=s?1:0),r!==-1&&(p=r),o!==0&&(f=o),i!==0&&(g=i),(l<<0|u<<8|c<<10|p<<11|f<<15|g<<24)>>>0}};function Fn(e,t){let a=[],n=ef(e),s=n.next();for(;s!==null;){let l=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":l=1;break;case"L":l=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=n.next()}let u=o();if(a.push({matcher:u,priority:l}),s!==",")break;s=n.next()}return a;function r(){if(s==="-"){s=n.next();let l=r();return u=>!!l&&!l(u)}if(s==="("){s=n.next();let l=i();return s===")"&&(s=n.next()),l}if(ul(s)){let l=[];do l.push(s),s=n.next();while(ul(s));return u=>t(l,u)}return null}function o(){let l=[],u=r();for(;u;)l.push(u),u=r();return c=>l.every(p=>p(c))}function i(){let l=[],u=o();for(;u&&(l.push(u),s==="|"||s===",");){do s=n.next();while(s==="|"||s===",");u=o()}return c=>l.some(p=>p(c))}}function ul(e){return!!e&&!!e.match(/[\w\.:]+/)}function ef(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,a=t.exec(e);return{next:()=>{if(!a)return null;let n=a[0];return a=t.exec(e),n}}}function Cl(e){typeof e.dispose=="function"&&e.dispose()}var Ka=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},tf=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},af=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},nf=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ka(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new af;for(let a of e)sf(a,this.initialScopeName,this.repo,t);for(let a of t.references)if(a instanceof Ka){if(this.seenFullScopeRequests.has(a.scopeName))continue;this.seenFullScopeRequests.add(a.scopeName),this.Q.push(a)}else{if(this.seenFullScopeRequests.has(a.scopeName)||this.seenPartialScopeRequests.has(a.toKey()))continue;this.seenPartialScopeRequests.add(a.toKey()),this.Q.push(a)}}};function sf(e,t,a,n){let s=a.lookup(e.scopeName);if(!s){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}let r=a.lookup(t);e instanceof Ka?On({baseGrammar:r,selfGrammar:s},n):fr(e.ruleName,{baseGrammar:r,selfGrammar:s,repository:s.repository},n);let o=a.injections(e.scopeName);if(o)for(let i of o)n.add(new Ka(i))}function fr(e,t,a){if(t.repository&&t.repository[e]){let n=t.repository[e];Gn([n],t,a)}}function On(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&Gn(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&Gn(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Gn(e,t,a){for(let n of e){if(a.visitedRule.has(n))continue;a.visitedRule.add(n);let s=n.repository?hl({},t.repository,n.repository):t.repository;Array.isArray(n.patterns)&&Gn(n.patterns,{...t,repository:s},a);let r=n.include;if(!r)continue;let o=Ll(r);switch(o.kind){case 0:On({...t,selfGrammar:t.baseGrammar},a);break;case 1:On(t,a);break;case 2:fr(o.ruleName,{...t,repository:s},a);break;case 3:case 4:let i=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(i){let l={baseGrammar:t.baseGrammar,selfGrammar:i,repository:s};o.kind===4?fr(o.ruleName,l,a):On(l,a)}else o.kind===4?a.add(new tf(o.scopeName,o.ruleName)):a.add(new Ka(o.scopeName));break}}}var rf=class{kind=0},of=class{kind=1},lf=class{constructor(e){this.ruleName=e}kind=2},uf=class{constructor(e){this.scopeName=e}kind=3},cf=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Ll(e){if(e==="$base")return new rf;if(e==="$self")return new of;let t=e.indexOf("#");if(t===-1)return new uf(e);if(t===0)return new lf(e.substring(1));{let a=e.substring(0,t),n=e.substring(t+1);return new cf(a,n)}}var df=/\\(\d+)/,cl=/\\(\d+)/g,m_=Symbol("RuleId"),pf=-1,jl=-2;var Ya=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,a,n){this.$location=e,this.id=t,this._name=a||null,this._nameIsCapturing=Dn.hasCaptures(this._name),this._contentName=n||null,this._contentNameIsCapturing=Dn.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${bl(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:Dn.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Dn.replaceCaptures(this._contentName,e,t)}},mf=class extends Ya{retokenizeCapturedWithRuleId;constructor(e,t,a,n,s){super(e,t,a,n),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,a,n){throw new Error("Not supported!")}},ff=class extends Ya{_match;captures;_cachedCompiledPatterns;constructor(e,t,a,n,s){super(e,t,a,null),this._match=new Ja(n,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,a,n){return this._getCachedCompiledPatterns(e).compileAG(e,a,n)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Qa,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},dl=class extends Ya{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,a,n,s){super(e,t,a,n),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(let a of this.patterns)e.getRule(a).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,a,n){return this._getCachedCompiledPatterns(e).compileAG(e,a,n)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Qa,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},gr=class extends Ya{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,a,n,s,r,o,i,l,u){super(e,t,a,n),this._begin=new Ja(s,this.id),this.beginCaptures=r,this._end=new Ja(o||"\uFFFF",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=i,this.applyEndPatternLast=l||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,a,n){return this._getCachedCompiledPatterns(e,t).compileAG(e,a,n)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Qa;for(let a of this.patterns)e.getRule(a).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},zn=class extends Ya{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,a,n,s,r,o,i,l){super(e,t,a,n),this._begin=new Ja(s,this.id),this.beginCaptures=r,this.whileCaptures=i,this._while=new Ja(o,jl),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,a,n){return this._getCachedCompiledPatterns(e).compileAG(e,a,n)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Qa;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,a,n){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,a,n)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Qa,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"\uFFFF"),this._cachedCompiledWhilePatterns}},vl=class Le{static createCaptureRule(t,a,n,s,r){return t.registerRule(o=>new mf(a,o,n,s,r))}static getCompiledRuleId(t,a,n){return t.id||a.registerRule(s=>{if(t.id=s,t.match)return new ff(t.$vscodeTextmateLocation,t.id,t.name,t.match,Le._compileCaptures(t.captures,a,n));if(typeof t.begin>"u"){t.repository&&(n=hl({},n,t.repository));let r=t.patterns;return typeof r>"u"&&t.include&&(r=[{include:t.include}]),new dl(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,Le._compilePatterns(r,a,n))}return t.while?new zn(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Le._compileCaptures(t.beginCaptures||t.captures,a,n),t.while,Le._compileCaptures(t.whileCaptures||t.captures,a,n),Le._compilePatterns(t.patterns,a,n)):new gr(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,Le._compileCaptures(t.beginCaptures||t.captures,a,n),t.end,Le._compileCaptures(t.endCaptures||t.captures,a,n),t.applyEndPatternLast,Le._compilePatterns(t.patterns,a,n))}),t.id}static _compileCaptures(t,a,n){let s=[];if(t){let r=0;for(let o in t){if(o==="$vscodeTextmateLocation")continue;let i=parseInt(o,10);i>r&&(r=i)}for(let o=0;o<=r;o++)s[o]=null;for(let o in t){if(o==="$vscodeTextmateLocation")continue;let i=parseInt(o,10),l=0;t[o].patterns&&(l=Le.getCompiledRuleId(t[o],a,n)),s[i]=Le.createCaptureRule(a,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,l)}}return s}static _compilePatterns(t,a,n){let s=[];if(t)for(let r=0,o=t.length;r<o;r++){let i=t[r],l=-1;if(i.include){let u=Ll(i.include);switch(u.kind){case 0:case 1:l=Le.getCompiledRuleId(n[i.include],a,n);break;case 2:let c=n[u.ruleName];c&&(l=Le.getCompiledRuleId(c,a,n));break;case 3:case 4:let p=u.scopeName,f=u.kind===4?u.ruleName:null,g=a.getExternalGrammar(p,n);if(g)if(f){let h=g.repository[f];h&&(l=Le.getCompiledRuleId(h,a,g.repository))}else l=Le.getCompiledRuleId(g.repository.$self,a,g.repository);break}}else l=Le.getCompiledRuleId(i,a,n);if(l!==-1){let u=a.getRule(l),c=!1;if((u instanceof dl||u instanceof gr||u instanceof zn)&&u.hasMissingPatterns&&u.patterns.length===0&&(c=!0),c)continue;s.push(l)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},Ja=class Sl{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(t,a){if(t&&typeof t=="string"){let n=t.length,s=0,r=[],o=!1;for(let i=0;i<n;i++)if(t.charAt(i)==="\\"&&i+1<n){let u=t.charAt(i+1);u==="z"?(r.push(t.substring(s,i)),r.push("$(?!\\n)(?<!\\n)"),s=i+2):(u==="A"||u==="G")&&(o=!0),i++}this.hasAnchor=o,s===0?this.source=t:(r.push(t.substring(s,n)),this.source=r.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=a,typeof this.source=="string"?this.hasBackReferences=df.test(this.source):this.hasBackReferences=!1}clone(){return new Sl(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,a){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let n=a.map(s=>t.substring(s.start,s.end));return cl.lastIndex=0,this.source.replace(cl,(s,r)=>_l(n[parseInt(r,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],a=[],n=[],s=[],r,o,i,l;for(r=0,o=this.source.length;r<o;r++)i=this.source.charAt(r),t[r]=i,a[r]=i,n[r]=i,s[r]=i,i==="\\"&&r+1<o&&(l=this.source.charAt(r+1),l==="A"?(t[r+1]="\uFFFF",a[r+1]="\uFFFF",n[r+1]="A",s[r+1]="A"):l==="G"?(t[r+1]="\uFFFF",a[r+1]="G",n[r+1]="\uFFFF",s[r+1]="G"):(t[r+1]=l,a[r+1]=l,n[r+1]=l,s[r+1]=l),r++);return{A0_G0:t.join(""),A0_G1:a.join(""),A1_G0:n.join(""),A1_G1:s.join("")}}resolveAnchors(t,a){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?a?this._anchorCache.A1_G1:this._anchorCache.A1_G0:a?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Qa=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(a=>a.source);this._cached=new pl(e,t,this._items.map(a=>a.ruleId))}return this._cached}compileAG(e,t,a){return this._hasAnchors?t?a?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,a)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,a)),this._anchorCache.A1_G0):a?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,a)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,a)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,a){let n=this._items.map(s=>s.resolveAnchors(t,a));return new pl(e,n,this._items.map(s=>s.ruleId))}},pl=class{constructor(e,t,a){this.regExps=t,this.rules=a,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){let e=[];for(let t=0,a=this.rules.length;t<a;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
|
|
76
|
+
`)}findNextMatchSync(e,t,a){let n=this.scanner.findNextMatchSync(e,t,a);return n?{ruleId:this.rules[n.index],captureIndices:n.captureIndices}:null}},dr=class{constructor(e,t){this.languageId=e,this.tokenType=t}},gf=class hr{_defaultAttributes;_embeddedLanguagesMatcher;constructor(t,a){this._defaultAttributes=new dr(t,8),this._embeddedLanguagesMatcher=new hf(Object.entries(a||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?hr._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new dr(0,0);_getBasicScopeAttributes=new kl(t=>{let a=this._scopeToLanguage(t),n=this._toStandardTokenType(t);return new dr(a,n)});_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){let a=t.match(hr.STANDARD_TOKEN_TYPE_REGEXP);if(!a)return 8;switch(a[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},hf=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([a,n])=>_l(a));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},f_={InDebugMode:typeof process<"u"&&!!process.env.VSCODE_TEXTMATE_DEBUG},Il=!1,ml=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Al(e,t,a,n,s,r,o,i){let l=t.content.length,u=!1,c=-1;if(o){let g=bf(e,t,a,n,s,r);s=g.stack,n=g.linePos,a=g.isFirstLine,c=g.anchorPosition}let p=Date.now();for(;!u;){if(i!==0&&Date.now()-p>i)return new ml(s,!0);f()}return new ml(s,!1);function f(){let g=yf(e,t,a,n,s,c);if(!g){r.produce(s,l),u=!0;return}let h=g.captureIndices,w=g.matchedRuleId,j=h&&h.length>0?h[0].end>n:!1;if(w===pf){let L=s.getRule(e);r.produce(s,h[0].start),s=s.withContentNameScopesList(s.nameScopesList),Va(e,t,a,s,r,L.endCaptures,h),r.produce(s,h[0].end);let k=s;if(s=s.parent,c=k.getAnchorPos(),!j&&k.getEnterPos()===n){s=k,r.produce(s,l),u=!0;return}}else{let L=e.getRule(w);r.produce(s,h[0].start);let k=s,$=L.getName(t.content,h),R=s.contentNameScopesList.pushAttributed($,e);if(s=s.push(w,n,c,h[0].end===l,null,R,R),L instanceof gr){let T=L;Va(e,t,a,s,r,T.beginCaptures,h),r.produce(s,h[0].end),c=h[0].end;let O=T.getContentName(t.content,h),Q=R.pushAttributed(O,e);if(s=s.withContentNameScopesList(Q),T.endHasBackReferences&&(s=s.withEndRule(T.getEndWithResolvedBackReferences(t.content,h))),!j&&k.hasSameRuleAs(s)){s=s.pop(),r.produce(s,l),u=!0;return}}else if(L instanceof zn){let T=L;Va(e,t,a,s,r,T.beginCaptures,h),r.produce(s,h[0].end),c=h[0].end;let O=T.getContentName(t.content,h),Q=R.pushAttributed(O,e);if(s=s.withContentNameScopesList(Q),T.whileHasBackReferences&&(s=s.withEndRule(T.getWhileWithResolvedBackReferences(t.content,h))),!j&&k.hasSameRuleAs(s)){s=s.pop(),r.produce(s,l),u=!0;return}}else if(Va(e,t,a,s,r,L.captures,h),r.produce(s,h[0].end),s=s.pop(),!j){s=s.safePop(),r.produce(s,l),u=!0;return}}h[0].end>n&&(n=h[0].end,a=!1)}}function bf(e,t,a,n,s,r){let o=s.beginRuleCapturedEOL?0:-1,i=[];for(let l=s;l;l=l.pop()){let u=l.getRule(e);u instanceof zn&&i.push({rule:u,stack:l})}for(let l=i.pop();l;l=i.pop()){let{ruleScanner:u,findOptions:c}=kf(l.rule,e,l.stack.endRule,a,n===o),p=u.findNextMatchSync(t,n,c);if(p){if(p.ruleId!==jl){s=l.stack.pop();break}p.captureIndices&&p.captureIndices.length&&(r.produce(l.stack,p.captureIndices[0].start),Va(e,t,a,l.stack,r,l.rule.whileCaptures,p.captureIndices),r.produce(l.stack,p.captureIndices[0].end),o=p.captureIndices[0].end,p.captureIndices[0].end>n&&(n=p.captureIndices[0].end,a=!1))}else{s=l.stack.pop();break}}return{stack:s,linePos:n,anchorPosition:o,isFirstLine:a}}function yf(e,t,a,n,s,r){let o=xf(e,t,a,n,s,r),i=e.getInjections();if(i.length===0)return o;let l=_f(i,e,t,a,n,s,r);if(!l)return o;if(!o)return l;let u=o.captureIndices[0].start,c=l.captureIndices[0].start;return c<u||l.priorityMatch&&c===u?l:o}function xf(e,t,a,n,s,r){let o=s.getRule(e),{ruleScanner:i,findOptions:l}=Pl(o,e,s.endRule,a,n===r),u=i.findNextMatchSync(t,n,l);return u?{captureIndices:u.captureIndices,matchedRuleId:u.ruleId}:null}function _f(e,t,a,n,s,r,o){let i=Number.MAX_VALUE,l=null,u,c=0,p=r.contentNameScopesList.getScopeNames();for(let f=0,g=e.length;f<g;f++){let h=e[f];if(!h.matcher(p))continue;let w=t.getRule(h.ruleId),{ruleScanner:j,findOptions:L}=Pl(w,t,null,n,s===o),k=j.findNextMatchSync(a,s,L);if(!k)continue;let $=k.captureIndices[0].start;if(!($>=i)&&(i=$,l=k.captureIndices,u=k.ruleId,c=h.priority,i===s))break}return l?{priorityMatch:c===-1,captureIndices:l,matchedRuleId:u}:null}function Pl(e,t,a,n,s){if(Il){let o=e.compile(t,a),i=Tl(n,s);return{ruleScanner:o,findOptions:i}}return{ruleScanner:e.compileAG(t,a,n,s),findOptions:0}}function kf(e,t,a,n,s){if(Il){let o=e.compileWhile(t,a),i=Tl(n,s);return{ruleScanner:o,findOptions:i}}return{ruleScanner:e.compileWhileAG(t,a,n,s),findOptions:0}}function Tl(e,t){let a=0;return e||(a|=1),t||(a|=4),a}function Va(e,t,a,n,s,r,o){if(r.length===0)return;let i=t.content,l=Math.min(r.length,o.length),u=[],c=o[0].end;for(let p=0;p<l;p++){let f=r[p];if(f===null)continue;let g=o[p];if(g.length===0)continue;if(g.start>c)break;for(;u.length>0&&u[u.length-1].endPos<=g.start;)s.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop();if(u.length>0?s.produceFromScopes(u[u.length-1].scopes,g.start):s.produce(n,g.start),f.retokenizeCapturedWithRuleId){let w=f.getName(i,o),j=n.contentNameScopesList.pushAttributed(w,e),L=f.getContentName(i,o),k=j.pushAttributed(L,e),$=n.push(f.retokenizeCapturedWithRuleId,g.start,-1,!1,null,j,k),R=e.createOnigString(i.substring(0,g.end));Al(e,R,a&&g.start===0,g.start,$,s,!1,0),Cl(R);continue}let h=f.getName(i,o);if(h!==null){let j=(u.length>0?u[u.length-1].scopes:n.contentNameScopesList).pushAttributed(h,e);u.push(new wf(j,g.end))}}for(;u.length>0;)s.produceFromScopes(u[u.length-1].scopes,u[u.length-1].endPos),u.pop()}var wf=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function $f(e,t,a,n,s,r,o,i){return new Lf(e,t,a,n,s,r,o,i)}function fl(e,t,a,n,s){let r=Fn(t,Un),o=vl.getCompiledRuleId(a,n,s.repository);for(let i of r)e.push({debugSelector:t,matcher:i.matcher,ruleId:o,grammar:s,priority:i.priority})}function Un(e,t){if(t.length<e.length)return!1;let a=0;return e.every(n=>{for(let s=a;s<t.length;s++)if(Cf(t[s],n))return a=s+1,!0;return!1})}function Cf(e,t){if(!e)return!1;if(e===t)return!0;let a=t.length;return e.length>a&&e.substr(0,a)===t&&e[a]==="."}var Lf=class{constructor(e,t,a,n,s,r,o,i){if(this._rootScopeName=e,this.balancedBracketSelectors=r,this._onigLib=i,this._basicScopeAttributesProvider=new gf(a,n),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=gl(t,null),this._injections=null,this._tokenTypeMatchers=[],s)for(let l of Object.keys(s)){let u=Fn(l,Un);for(let c of u)this._tokenTypeMatchers.push({matcher:c.matcher,type:s[l]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},t=[],a=this._rootScopeName,n=e.lookup(a);if(n){let s=n.injections;if(s)for(let o in s)fl(t,o,s[o],this,n);let r=this._grammarRepository.injections(a);r&&r.forEach(o=>{let i=this.getExternalGrammar(o);if(i){let l=i.injectionSelector;l&&fl(t,l,i,this,i)}})}return t.sort((s,r)=>s.priority-r.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,a=e(t);return this._ruleId2desc[t]=a,a}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let a=this._grammarRepository.lookup(e);if(a)return this._includedGrammars[e]=gl(a,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,a=0){let n=this._tokenize(e,t,!1,a);return{tokens:n.lineTokens.getResult(n.ruleStack,n.lineLength),ruleStack:n.ruleStack,stoppedEarly:n.stoppedEarly}}tokenizeLine2(e,t,a=0){let n=this._tokenize(e,t,!0,a);return{tokens:n.lineTokens.getBinaryResult(n.ruleStack,n.lineLength),ruleStack:n.ruleStack,stoppedEarly:n.stoppedEarly}}_tokenize(e,t,a,n){this._rootId===-1&&(this._rootId=vl.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!t||t===br.NULL){s=!0;let u=this._basicScopeAttributesProvider.getDefaultAttributes(),c=this.themeProvider.getDefaults(),p=Ct.set(0,u.languageId,u.tokenType,null,c.fontStyle,c.foregroundId,c.backgroundId),f=this.getRule(this._rootId).getName(null,null),g;f?g=Xa.createRootAndLookUpScopeName(f,p,this):g=Xa.createRoot("unknown",p),t=new br(null,this._rootId,-1,-1,!1,null,g,g)}else s=!1,t.reset();e=e+`
|
|
77
|
+
`;let r=this.createOnigString(e),o=r.content.length,i=new vf(a,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=Al(this,r,s,0,t,i,!0,n);return Cl(r),{lineLength:o,lineTokens:i,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function gl(e,t){return e=zm(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Xa=class at{constructor(t,a,n){this.parent=t,this.scopePath=a,this.tokenAttributes=n}static fromExtension(t,a){let n=t,s=t?.scopePath??null;for(let r of a)s=cr.push(s,r.scopeNames),n=new at(n,s,r.encodedTokenAttributes);return n}static createRoot(t,a){return new at(null,new cr(null,t),a)}static createRootAndLookUpScopeName(t,a,n){let s=n.getMetadataForScope(t),r=new cr(null,t),o=n.themeProvider.themeMatch(r),i=at.mergeAttributes(a,s,o);return new at(null,r,i)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return at.equals(this,t)}static equals(t,a){do{if(t===a||!t&&!a)return!0;if(!t||!a||t.scopeName!==a.scopeName||t.tokenAttributes!==a.tokenAttributes)return!1;t=t.parent,a=a.parent}while(!0)}static mergeAttributes(t,a,n){let s=-1,r=0,o=0;return n!==null&&(s=n.fontStyle,r=n.foregroundId,o=n.backgroundId),Ct.set(t,a.languageId,a.tokenType,null,s,r,o)}pushAttributed(t,a){if(t===null)return this;if(t.indexOf(" ")===-1)return at._pushAttributed(this,t,a);let n=t.split(/ /g),s=this;for(let r of n)s=at._pushAttributed(s,r,a);return s}static _pushAttributed(t,a,n){let s=n.getMetadataForScope(a),r=t.scopePath.push(a),o=n.themeProvider.themeMatch(r),i=at.mergeAttributes(t.tokenAttributes,s,o);return new at(t,r,i)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){let a=[],n=this;for(;n&&n!==t;)a.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===t?a.reverse():void 0}},br=class Ut{constructor(t,a,n,s,r,o,i,l){this.parent=t,this.ruleId=a,this.beginRuleCapturedEOL=r,this.endRule=o,this.nameScopesList=i,this.contentNameScopesList=l,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new Ut(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:Ut._equals(this,t)}static _equals(t,a){return t===a?!0:this._structuralEquals(t,a)?Xa.equals(t.contentNameScopesList,a.contentNameScopesList):!1}static _structuralEquals(t,a){do{if(t===a||!t&&!a)return!0;if(!t||!a||t.depth!==a.depth||t.ruleId!==a.ruleId||t.endRule!==a.endRule)return!1;t=t.parent,a=a.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){Ut._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,a,n,s,r,o,i){return new Ut(this,t,a,n,s,r,o,i)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){let t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,a){return this.parent&&(a=this.parent._writeString(t,a)),t[a++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,a}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new Ut(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let a=this;for(;a&&a._enterPos===t._enterPos;){if(a.ruleId===t.ruleId)return!0;a=a.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,a){let n=Xa.fromExtension(t?.nameScopesList??null,a.nameScopesList);return new Ut(t,a.ruleId,a.enterPos??-1,a.anchorPos??-1,a.beginRuleCapturedEOL,a.endRule,n,Xa.fromExtension(n,a.contentNameScopesList))}},jf=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(a=>a==="*"?(this.allowAny=!0,[]):Fn(a,Un).map(n=>n.matcher)),this.unbalancedBracketScopes=t.flatMap(a=>Fn(a,Un).map(n=>n.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},vf=class{constructor(e,t,a,n){this.balancedBracketSelectors=n,this._emitBinaryTokens=e,this._tokenTypeOverrides=a,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let r=e?.getScopeNames()??[];for(let o of this._tokenTypeOverrides)o.matcher(r)&&(n=Ct.set(n,0,o.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(r))}if(s&&(n=Ct.set(n,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let a=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:a}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let a=new Uint32Array(this._binaryTokens.length);for(let n=0,s=this._binaryTokens.length;n<s;n++)a[n]=this._binaryTokens[n];return a}},Sf=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,a,n,s){if(!this._grammars.has(e)){let r=this._rawGrammars.get(e);if(!r)return null;this._grammars.set(e,$f(e,r,t,a,n,s,this,this._onigLib))}return this._grammars.get(e)}},Rl=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Sf(Za.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(Za.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,a){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:a})}loadGrammarWithConfiguration(e,t,a){return this._loadGrammar(e,t,a.embeddedLanguages,a.tokenTypes,new jf(a.balancedBracketSelectors||[],a.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,a,n,s){let r=new nf(this._syncRegistry,e);for(;r.Q.length>0;)r.Q.map(o=>this._loadSingleGrammar(o.scopeName)),r.processQueue();return this._grammarForScopeName(e,t,a,n,s)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let a=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,a)}}addGrammar(e,t=[],a=0,n=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,a,n)}_grammarForScopeName(e,t=0,a=null,n=null,s=null){return this._syncRegistry.grammarForScopeName(e,t,a,n,s)}},Hn=br.NULL;function tn(e,t){let a=typeof e=="string"?{}:{...e.colorReplacements},n=typeof e=="string"?e:e.name;for(let[s,r]of Object.entries(t?.colorReplacements||{}))typeof r=="string"?a[s]=r:s===n&&Object.assign(a,r);return a}function lt(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Dl(e){return Array.isArray(e)?e:[e]}async function xr(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function an(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Nl(e){return e==="ansi"||an(e)}function nn(e){return e==="none"}function Ol(e){return nn(e)}var If=/(\r?\n)/g;function wa(e,t=!1){if(e.length===0)return[["",0]];let a=e.split(If),n=0,s=[];for(let r=0;r<a.length;r+=2){let o=t?a[r]+(a[r+1]||""):a[r];s.push([o,n]),n+=a[r].length,n+=a[r+1]?.length||0}return s}var El={light:"#333333",dark:"#bbbbbb"},Ml={light:"#fffffe",dark:"#1e1e1e"},Bl="__shiki_resolved";function Wn(e){if(e?.[Bl])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:a,fg:n}=t;if(!a||!n){let i=t.settings?t.settings.find(l=>!l.name&&!l.scope):void 0;i?.settings?.foreground&&(n=i.settings.foreground),i?.settings?.background&&(a=i.settings.background),!n&&t?.colors?.["editor.foreground"]&&(n=t.colors["editor.foreground"]),!a&&t?.colors?.["editor.background"]&&(a=t.colors["editor.background"]),n||(n=t.type==="light"?El.light:El.dark),a||(a=t.type==="light"?Ml.light:Ml.dark),t.fg=n,t.bg=a}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let s=0,r=new Map;function o(i){if(r.has(i))return r.get(i);s+=1;let l=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${l}`]?o(i):(r.set(i,l),l)}t.settings=t.settings.map(i=>{let l=i.settings?.foreground&&!i.settings.foreground.startsWith("#"),u=i.settings?.background&&!i.settings.background.startsWith("#");if(!l&&!u)return i;let c={...i,settings:{...i.settings}};if(l){let p=o(i.settings.foreground);t.colorReplacements[p]=i.settings.foreground,c.settings.foreground=p}if(u){let p=o(i.settings.background);t.colorReplacements[p]=i.settings.background,c.settings.background=p}return c});for(let i of Object.keys(t.colors||{}))if((i==="editor.foreground"||i==="editor.background"||i.startsWith("terminal.ansi"))&&!t.colors[i]?.startsWith("#")){let l=o(t.colors[i]);t.colorReplacements[l]=t.colors[i],t.colors[i]=l}return Object.defineProperty(t,Bl,{enumerable:!1,writable:!1,value:!0}),t}async function Fl(e){return[...new Set((await Promise.all(e.filter(t=>!Nl(t)).map(async t=>await xr(t).then(a=>Array.isArray(a)?a:[a])))).flat())]}async function Gl(e){return(await Promise.all(e.map(async t=>Ol(t)?null:Wn(await xr(t))))).filter(t=>!!t)}function zl(e,t){if(!t)return e;if(t[e]){let a=new Set([e]);for(;t[e];){if(e=t[e],a.has(e))throw new Z(`Circular alias \`${[...a].join(" -> ")} -> ${e}\``);a.add(e)}}return e}var Af=class extends Rl{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,a,n={}){super(e),this._resolver=e,this._themes=t,this._langs=a,this._alias=n,this._themes.map(s=>this.loadTheme(s)),this.loadLanguages(this._langs)}getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=Wn(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=Za.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=zl(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(s=>s.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let a={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let n=this.loadGrammarWithConfiguration(e.scopeName,1,a);if(n.name=e.name,this._resolvedGrammars.set(e.name,n),e.aliases&&e.aliases.forEach(s=>{this._alias[s]=e.name}),this._loadedLanguagesCache=null,t.size)for(let s of t)this._resolvedGrammars.delete(s.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(s.scopeName),this._syncRegistry?._grammars?.delete(s.scopeName),this.loadLanguage(this._langMap.get(s.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let n of e)this.resolveEmbeddedLanguages(n);let t=[...this._langGraph.entries()],a=t.filter(([n,s])=>!s);if(a.length){let n=t.filter(([s,r])=>r?(r.embeddedLanguages||r.embeddedLangs)?.some(o=>a.map(([i])=>i).includes(o)):!1).filter(s=>!a.includes(s));throw new Z(`Missing languages ${a.map(([s])=>`\`${s}\``).join(", ")}, required by ${n.map(([s])=>`\`${s}\``).join(", ")}`)}for(let[n,s]of t)this._resolver.addLanguage(s);for(let[n,s]of t)this.loadLanguage(s)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let a of t)this._langGraph.set(a,this._langMap.get(a))}},Pf=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:a=>e.createScanner(a),createOnigString:a=>e.createString(a)},t.forEach(a=>this.addLanguage(a))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split("."),a=[];for(let n=1;n<=t.length;n++){let s=t.slice(0,n).join(".");a=[...a,...this._injections.get(s)||[]]}return a}},en=0;function _r(e){en+=1,e.warnings!==!1&&en>=10&&en%10===0&&console.warn(`[Shiki] ${en} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new Z("`engine` option is required for synchronous mode");let a=(e.langs||[]).flat(1),n=(e.themes||[]).flat(1).map(Wn),s=new Af(new Pf(e.engine,a),n,a,e.langAlias),r;function o(k){return zl(k,e.langAlias)}function i(k){j();let $=s.getGrammar(typeof k=="string"?k:k.name);if(!$)throw new Z(`Language \`${k}\` not found, you may need to load it first`);return $}function l(k){if(k==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};j();let $=s.getTheme(k);if(!$)throw new Z(`Theme \`${k}\` not found, you may need to load it first`);return $}function u(k){j();let $=l(k);return r!==k&&(s.setTheme($),r=k),{theme:$,colorMap:s.getColorMap()}}function c(){return j(),s.getLoadedThemes()}function p(){return j(),s.getLoadedLanguages()}function f(...k){j(),s.loadLanguages(k.flat(1))}async function g(...k){return f(await Fl(k))}function h(...k){j();for(let $ of k.flat(1))s.loadTheme($)}async function w(...k){return j(),h(await Gl(k))}function j(){if(t)throw new Z("Shiki instance has been disposed")}function L(){t||(t=!0,s.dispose(),en-=1)}return{setTheme:u,getTheme:l,getLanguage:i,getLoadedThemes:c,getLoadedLanguages:p,resolveLangAlias:o,loadLanguage:g,loadLanguageSync:f,loadTheme:w,loadThemeSync:h,dispose:L,[Symbol.dispose]:L}}async function kr(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,a,n]=await Promise.all([Gl(e.themes||[]),Fl(e.langs||[]),e.engine]);return _r({...e,themes:t,langs:a,engine:n})}var Ul=new WeakMap;function sn(e,t){Ul.set(e,t)}function $a(e){return Ul.get(e)}var Vn=class Hl{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,a){return new Hl(Object.fromEntries(Dl(a).map(n=>[n,Hn])),t)}constructor(...t){if(t.length===2){let[a,n]=t;this.lang=n,this._stacks=a}else{let[a,n,s]=t;this.lang=n,this._stacks={[s]:a}}}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return Tf(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Tf(e){let t=[],a=new Set;function n(s){if(a.has(s))return;a.add(s);let r=s?.nameScopesList?.scopeName;r&&t.push(r),s.parent&&n(s.parent)}return n(e),t}function Rf(e,t){if(!(e instanceof Vn))throw new Z("Invalid grammar state");return e.getInternalStack(t)}var Ef=/,/,Mf=/ /;function wr(e,t,a={}){let{theme:n=e.getLoadedThemes()[0]}=a;if(an(e.resolveLangAlias(a.lang||"text"))||nn(n))return wa(t).map(i=>[{content:i[0],offset:i[1]}]);let{theme:s,colorMap:r}=e.setTheme(n),o=e.getLanguage(a.lang||"text");if(a.grammarState){if(a.grammarState.lang!==o.name)throw new Z(`Grammar state language "${a.grammarState.lang}" does not match highlight language "${o.name}"`);if(!a.grammarState.themes.includes(s.name))throw new Z(`Grammar state themes "${a.grammarState.themes}" do not contain highlight theme "${s.name}"`)}return Vl(t,o,s,r,a)}function Wl(...e){if(e.length===2)return $a(e[1]);let[t,a,n={}]=e,{lang:s="text",theme:r=t.getLoadedThemes()[0]}=n;if(an(s)||nn(r))throw new Z("Plain language does not have grammar state");if(s==="ansi")throw new Z("ANSI language does not have grammar state");let{theme:o,colorMap:i}=t.setTheme(r),l=t.getLanguage(s);return new Vn($r(a,l,o,i,n).stateStack,l.name,o.name)}function Vl(e,t,a,n,s){let r=$r(e,t,a,n,s),o=new Vn(r.stateStack,t.name,a.name);return sn(r.tokens,o),r.tokens}function $r(e,t,a,n,s){let r=tn(a,s),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:i=500,includeExplanation:l=!1}=s,u=wa(e),c=s.grammarState?Rf(s.grammarState,a.name)??Hn:s.grammarContextCode!=null?$r(s.grammarContextCode,t,a,n,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:Hn,p=[],f=[];for(let g=0,h=u.length;g<h;g++){let[w,j]=u[g];if(w===""){p=[],f.push([]);continue}if(o>0&&w.length>=o){p=[],f.push([{content:w,offset:j,color:"",fontStyle:0}]);continue}let L,k,$;l&&l!=="tokenType"&&(L=t.tokenizeLine(w,c,i),k=L.tokens,$=0);let R=t.tokenizeLine2(w,c,i),T=R.tokens.length/2;for(let O=0;O<T;O++){let Q=R.tokens[2*O],Y=O+1<T?R.tokens[2*O+2]:w.length;if(Q===Y)continue;let Oe=R.tokens[2*O+1],ee=lt(n[Ct.getForeground(Oe)],r),xe=Ct.getFontStyle(Oe),oe={content:w.substring(Q,Y),offset:j+Q,color:ee,fontStyle:xe};if(l==="tokenType")oe.type=Ct.getTokenType(Oe);else if(l){let Ae=[];if(l!=="scopeName")for(let we of a.settings){let _e;switch(typeof we.scope){case"string":_e=we.scope.split(Ef).map(bt=>bt.trim());break;case"object":_e=we.scope;break;default:continue}Ae.push({settings:we,selectors:_e.map(bt=>bt.split(Mf))})}oe.explanation=[];let We=0;for(;Q+We<Y;){let we=k[$],_e=w.substring(we.startIndex,we.endIndex);We+=_e.length,oe.explanation.push({content:_e,scopes:l==="scopeName"?Bf(we.scopes):qf(Ae,we.scopes)}),$+=1}}p.push(oe)}f.push(p),p=[],c=R.ruleStack}return{tokens:f,stateStack:c}}function Bf(e){return e.map(t=>({scopeName:t}))}function qf(e,t){let a=[];for(let n=0,s=t.length;n<s;n++){let r=t[n];a[n]={scopeName:r,themeMatches:Nf(e,r,t.slice(0,n))}}return a}function ql(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function Df(e,t,a){if(!ql(e.at(-1),t))return!1;let n=e.length-2,s=a.length-1;for(;n>=0&&s>=0;)ql(e[n],a[s])&&(n-=1),s-=1;return n===-1}function Nf(e,t,a){let n=[];for(let{selectors:s,settings:r}of e)for(let o of s)if(Df(o,t,a)){n.push(r);break}return n}function Xn(e,t,a,n=wr){let s=Object.entries(a.themes).filter(u=>u[1]).map(u=>({color:u[0],theme:u[1]})),r=s.map(u=>{let c=n(e,t,{...a,theme:u.theme});return{tokens:c,state:$a(c),theme:typeof u.theme=="string"?u.theme:u.theme.name}}),o=Of(...r.map(u=>u.tokens)),i=o[0].map((u,c)=>u.map((p,f)=>{let g={content:p.content,variants:{},offset:p.offset};return"includeExplanation"in a&&a.includeExplanation&&(g.explanation=p.explanation),o.forEach((h,w)=>{let{content:j,explanation:L,offset:k,...$}=h[c][f];g.variants[s[w].color]=$}),g})),l=r[0].state?new Vn(Object.fromEntries(r.map(u=>[u.theme,u.state?.getInternalStack(u.theme)])),r[0].state.lang):void 0;return l&&sn(i,l),i}function Of(...e){let t=e.map(()=>[]),a=e.length;for(let n=0;n<e[0].length;n++){let s=e.map(l=>l[n]),r=t.map(()=>[]);t.forEach((l,u)=>l.push(r[u]));let o=s.map(()=>0),i=s.map(l=>l[0]);for(;i.every(l=>l);){let l=Math.min(...i.map(u=>u.content.length));for(let u=0;u<a;u++){let c=i[u];c.content.length===l?(r[u].push(c),o[u]+=1,i[u]=s[u][o[u]]):(r[u].push({...c,content:c.content.slice(0,l)}),i[u]={...c,content:c.content.slice(l),offset:c.offset+l})}}}return t}var Xl=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var ut=class{constructor(t,a,n){this.normal=a,this.property=t,n&&(this.space=n)}};ut.prototype.normal={};ut.prototype.property={};ut.prototype.space=void 0;function Cr(e,t){let a={},n={};for(let s of e)Object.assign(a,s.property),Object.assign(n,s.normal);return new ut(a,n,t)}function rn(e){return e.toLowerCase()}var ye=class{constructor(t,a){this.attribute=a,this.property=t}};ye.prototype.attribute="";ye.prototype.booleanish=!1;ye.prototype.boolean=!1;ye.prototype.commaOrSpaceSeparated=!1;ye.prototype.commaSeparated=!1;ye.prototype.defined=!1;ye.prototype.mustUseProperty=!1;ye.prototype.number=!1;ye.prototype.overloadedBoolean=!1;ye.prototype.property="";ye.prototype.spaceSeparated=!1;ye.prototype.space=void 0;var on={};Se(on,{boolean:()=>N,booleanish:()=>re,commaOrSpaceSeparated:()=>Ee,commaSeparated:()=>ct,number:()=>v,overloadedBoolean:()=>Zn,spaceSeparated:()=>V});var Ff=0,N=Ht(),re=Ht(),Zn=Ht(),v=Ht(),V=Ht(),ct=Ht(),Ee=Ht();function Ht(){return 2**++Ff}var Lr=Object.keys(on),Wt=class extends ye{constructor(t,a,n,s){let r=-1;if(super(t,a),Zl(this,"space",s),typeof n=="number")for(;++r<Lr.length;){let o=Lr[r];Zl(this,Lr[r],(n&on[o])===on[o])}}};Wt.prototype.defined=!0;function Zl(e,t,a){a&&(e[t]=a)}function Ue(e){let t={},a={};for(let[n,s]of Object.entries(e.properties)){let r=new Wt(n,e.transform(e.attributes||{},n),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(n)&&(r.mustUseProperty=!0),t[n]=r,a[rn(n)]=n,a[rn(r.attribute)]=n}return new ut(t,a,e.space)}var jr=Ue({properties:{ariaActiveDescendant:null,ariaAtomic:re,ariaAutoComplete:null,ariaBusy:re,ariaChecked:re,ariaColCount:v,ariaColIndex:v,ariaColSpan:v,ariaControls:V,ariaCurrent:null,ariaDescribedBy:V,ariaDetails:null,ariaDisabled:re,ariaDropEffect:V,ariaErrorMessage:null,ariaExpanded:re,ariaFlowTo:V,ariaGrabbed:re,ariaHasPopup:null,ariaHidden:re,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:V,ariaLevel:v,ariaLive:null,ariaModal:re,ariaMultiLine:re,ariaMultiSelectable:re,ariaOrientation:null,ariaOwns:V,ariaPlaceholder:null,ariaPosInSet:v,ariaPressed:re,ariaReadOnly:re,ariaRelevant:null,ariaRequired:re,ariaRoleDescription:V,ariaRowCount:v,ariaRowIndex:v,ariaRowSpan:v,ariaSelected:re,ariaSetSize:v,ariaSort:null,ariaValueMax:v,ariaValueMin:v,ariaValueNow:v,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Kn(e,t){return t in e?e[t]:t}function Jn(e,t){return Kn(e,t.toLowerCase())}var Kl=Ue({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:ct,acceptCharset:V,accessKey:V,action:null,allow:null,allowFullScreen:N,allowPaymentRequest:N,allowUserMedia:N,alpha:N,alt:null,as:null,async:N,autoCapitalize:null,autoComplete:V,autoFocus:N,autoPlay:N,blocking:V,capture:null,charSet:null,checked:N,cite:null,className:V,closedBy:null,colorSpace:null,cols:v,colSpan:v,command:null,commandFor:null,content:null,contentEditable:re,controls:N,controlsList:V,coords:v|ct,crossOrigin:null,data:null,dateTime:null,decoding:null,default:N,defer:N,dir:null,dirName:null,disabled:N,download:Zn,draggable:re,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:N,formTarget:null,headers:V,height:v,hidden:Zn,high:v,href:null,hrefLang:null,htmlFor:V,httpEquiv:V,id:null,imageSizes:null,imageSrcSet:null,inert:N,inputMode:null,integrity:null,is:null,isMap:N,itemId:null,itemProp:V,itemRef:V,itemScope:N,itemType:V,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:N,low:v,manifest:null,max:null,maxLength:v,media:null,method:null,min:null,minLength:v,multiple:N,muted:N,name:null,nonce:null,noModule:N,noValidate:N,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:N,optimum:v,pattern:null,ping:V,placeholder:null,playsInline:N,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:N,referrerPolicy:null,rel:V,required:N,reversed:N,rows:v,rowSpan:v,sandbox:V,scope:null,scoped:N,seamless:N,selected:N,shadowRootClonable:N,shadowRootCustomElementRegistry:N,shadowRootDelegatesFocus:N,shadowRootMode:null,shadowRootSerializable:N,shape:null,size:v,sizes:null,slot:null,span:v,spellCheck:re,src:null,srcDoc:null,srcLang:null,srcSet:null,start:v,step:null,style:null,tabIndex:v,target:null,title:null,translate:null,type:null,typeMustMatch:N,useMap:null,value:re,width:v,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:V,axis:null,background:null,bgColor:null,border:v,borderColor:null,bottomMargin:v,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:N,declare:N,event:null,face:null,frame:null,frameBorder:null,hSpace:v,leftMargin:v,link:null,longDesc:null,lowSrc:null,marginHeight:v,marginWidth:v,noResize:N,noHref:N,noShade:N,noWrap:N,object:null,profile:null,prompt:null,rev:null,rightMargin:v,rules:null,scheme:null,scrolling:re,standby:null,summary:null,text:null,topMargin:v,valueType:null,version:null,vAlign:null,vLink:null,vSpace:v,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:N,disablePictureInPicture:N,disableRemotePlayback:N,exportParts:ct,part:V,prefix:null,property:null,results:v,security:null,unselectable:null},space:"html",transform:Jn});var Jl=Ue({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ee,accentHeight:v,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:v,amplitude:v,arabicForm:null,ascent:v,attributeName:null,attributeType:null,azimuth:v,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:v,by:null,calcMode:null,capHeight:v,className:V,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:v,diffuseConstant:v,direction:null,display:null,dur:null,divisor:v,dominantBaseline:null,download:N,dx:null,dy:null,edgeMode:null,editable:null,elevation:v,enableBackground:null,end:null,event:null,exponent:v,externalResourcesRequired:null,fill:null,fillOpacity:v,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:ct,g2:ct,glyphName:ct,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:v,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:v,horizOriginX:v,horizOriginY:v,id:null,ideographic:v,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:v,k:v,k1:v,k2:v,k3:v,k4:v,kernelMatrix:Ee,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:v,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:v,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:v,overlineThickness:v,paintOrder:null,panose1:null,path:null,pathLength:v,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:V,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:v,pointsAtY:v,pointsAtZ:v,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ee,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ee,rev:Ee,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ee,requiredFeatures:Ee,requiredFonts:Ee,requiredFormats:Ee,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:v,specularExponent:v,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:v,strikethroughThickness:v,string:null,stroke:null,strokeDashArray:Ee,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:v,strokeOpacity:v,strokeWidth:null,style:null,surfaceScale:v,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ee,tabIndex:v,tableValues:null,target:null,targetX:v,targetY:v,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ee,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:v,underlineThickness:v,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:v,values:null,vAlphabetic:v,vMathematical:v,vectorEffect:null,vHanging:v,vIdeographic:v,version:null,vertAdvY:v,vertOriginX:v,vertOriginY:v,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:v,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Kn});var vr=Ue({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}});var Sr=Ue({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:Jn});var Ir=Ue({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}});var Gf=/[A-Z]/g,Ql=/-[a-z]/g,zf=/^data[-\w.:]+$/i;function Ar(e,t){let a=rn(t),n=t,s=ye;if(a in e.normal)return e.property[e.normal[a]];if(a.length>4&&a.slice(0,4)==="data"&&zf.test(t)){if(t.charAt(4)==="-"){let r=t.slice(5).replace(Ql,Hf);n="data"+r.charAt(0).toUpperCase()+r.slice(1)}else{let r=t.slice(4);if(!Ql.test(r)){let o=r.replace(Gf,Uf);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}s=Wt}return new s(n,t)}function Uf(e){return"-"+e.toLowerCase()}function Hf(e){return e.charAt(1).toUpperCase()}var Yl=Cr([jr,Kl,vr,Sr,Ir],"html"),Qn=Cr([jr,Jl,vr,Sr,Ir],"svg");var eu={}.hasOwnProperty;function tu(e,t){let a=t||{};function n(s,...r){let o=n.invalid,i=n.handlers;if(s&&eu.call(s,e)){let l=String(s[e]);o=eu.call(i,l)?i[l]:n.unknown}if(o)return o.call(this,s,...r)}return n.handlers=a.handlers||{},n.invalid=a.invalid,n.unknown=a.unknown,n}var Wf=/["&'<>`]/g,Vf=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Xf=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Zf=/[|\\{}()[\]^$+*?.]/g,au=new WeakMap;function nu(e,t){if(e=e.replace(t.subset?Kf(t.subset):Wf,n),t.subset||t.escapeOnly)return e;return e.replace(Vf,a).replace(Xf,n);function a(s,r,o){return t.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,o.charCodeAt(r+2),t)}function n(s,r,o){return t.format(s.charCodeAt(0),o.charCodeAt(r+1),t)}}function Kf(e){let t=au.get(e);return t||(t=Jf(e),au.set(e,t)),t}function Jf(e){let t=[],a=-1;for(;++a<e.length;)t.push(e[a].replace(Zf,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}var Qf=/[\dA-Fa-f]/;function su(e,t,a){let n="&#x"+e.toString(16).toUpperCase();return a&&t&&!Qf.test(String.fromCharCode(t))?n:n+";"}var Yf=/\d/;function ru(e,t,a){let n="&#"+String(e);return a&&t&&!Yf.test(String.fromCharCode(t))?n:n+";"}var ou=["AElig","AMP","Aacute","Acirc","Agrave","Aring","Atilde","Auml","COPY","Ccedil","ETH","Eacute","Ecirc","Egrave","Euml","GT","Iacute","Icirc","Igrave","Iuml","LT","Ntilde","Oacute","Ocirc","Ograve","Oslash","Otilde","Ouml","QUOT","REG","THORN","Uacute","Ucirc","Ugrave","Uuml","Yacute","aacute","acirc","acute","aelig","agrave","amp","aring","atilde","auml","brvbar","ccedil","cedil","cent","copy","curren","deg","divide","eacute","ecirc","egrave","eth","euml","frac12","frac14","frac34","gt","iacute","icirc","iexcl","igrave","iquest","iuml","laquo","lt","macr","micro","middot","nbsp","not","ntilde","oacute","ocirc","ograve","ordf","ordm","oslash","otilde","ouml","para","plusmn","pound","quot","raquo","reg","sect","shy","sup1","sup2","sup3","szlig","thorn","times","uacute","ucirc","ugrave","uml","uuml","yacute","yen","yuml"];var Yn={nbsp:"\xA0",iexcl:"\xA1",cent:"\xA2",pound:"\xA3",curren:"\xA4",yen:"\xA5",brvbar:"\xA6",sect:"\xA7",uml:"\xA8",copy:"\xA9",ordf:"\xAA",laquo:"\xAB",not:"\xAC",shy:"\xAD",reg:"\xAE",macr:"\xAF",deg:"\xB0",plusmn:"\xB1",sup2:"\xB2",sup3:"\xB3",acute:"\xB4",micro:"\xB5",para:"\xB6",middot:"\xB7",cedil:"\xB8",sup1:"\xB9",ordm:"\xBA",raquo:"\xBB",frac14:"\xBC",frac12:"\xBD",frac34:"\xBE",iquest:"\xBF",Agrave:"\xC0",Aacute:"\xC1",Acirc:"\xC2",Atilde:"\xC3",Auml:"\xC4",Aring:"\xC5",AElig:"\xC6",Ccedil:"\xC7",Egrave:"\xC8",Eacute:"\xC9",Ecirc:"\xCA",Euml:"\xCB",Igrave:"\xCC",Iacute:"\xCD",Icirc:"\xCE",Iuml:"\xCF",ETH:"\xD0",Ntilde:"\xD1",Ograve:"\xD2",Oacute:"\xD3",Ocirc:"\xD4",Otilde:"\xD5",Ouml:"\xD6",times:"\xD7",Oslash:"\xD8",Ugrave:"\xD9",Uacute:"\xDA",Ucirc:"\xDB",Uuml:"\xDC",Yacute:"\xDD",THORN:"\xDE",szlig:"\xDF",agrave:"\xE0",aacute:"\xE1",acirc:"\xE2",atilde:"\xE3",auml:"\xE4",aring:"\xE5",aelig:"\xE6",ccedil:"\xE7",egrave:"\xE8",eacute:"\xE9",ecirc:"\xEA",euml:"\xEB",igrave:"\xEC",iacute:"\xED",icirc:"\xEE",iuml:"\xEF",eth:"\xF0",ntilde:"\xF1",ograve:"\xF2",oacute:"\xF3",ocirc:"\xF4",otilde:"\xF5",ouml:"\xF6",divide:"\xF7",oslash:"\xF8",ugrave:"\xF9",uacute:"\xFA",ucirc:"\xFB",uuml:"\xFC",yacute:"\xFD",thorn:"\xFE",yuml:"\xFF",fnof:"\u0192",Alpha:"\u0391",Beta:"\u0392",Gamma:"\u0393",Delta:"\u0394",Epsilon:"\u0395",Zeta:"\u0396",Eta:"\u0397",Theta:"\u0398",Iota:"\u0399",Kappa:"\u039A",Lambda:"\u039B",Mu:"\u039C",Nu:"\u039D",Xi:"\u039E",Omicron:"\u039F",Pi:"\u03A0",Rho:"\u03A1",Sigma:"\u03A3",Tau:"\u03A4",Upsilon:"\u03A5",Phi:"\u03A6",Chi:"\u03A7",Psi:"\u03A8",Omega:"\u03A9",alpha:"\u03B1",beta:"\u03B2",gamma:"\u03B3",delta:"\u03B4",epsilon:"\u03B5",zeta:"\u03B6",eta:"\u03B7",theta:"\u03B8",iota:"\u03B9",kappa:"\u03BA",lambda:"\u03BB",mu:"\u03BC",nu:"\u03BD",xi:"\u03BE",omicron:"\u03BF",pi:"\u03C0",rho:"\u03C1",sigmaf:"\u03C2",sigma:"\u03C3",tau:"\u03C4",upsilon:"\u03C5",phi:"\u03C6",chi:"\u03C7",psi:"\u03C8",omega:"\u03C9",thetasym:"\u03D1",upsih:"\u03D2",piv:"\u03D6",bull:"\u2022",hellip:"\u2026",prime:"\u2032",Prime:"\u2033",oline:"\u203E",frasl:"\u2044",weierp:"\u2118",image:"\u2111",real:"\u211C",trade:"\u2122",alefsym:"\u2135",larr:"\u2190",uarr:"\u2191",rarr:"\u2192",darr:"\u2193",harr:"\u2194",crarr:"\u21B5",lArr:"\u21D0",uArr:"\u21D1",rArr:"\u21D2",dArr:"\u21D3",hArr:"\u21D4",forall:"\u2200",part:"\u2202",exist:"\u2203",empty:"\u2205",nabla:"\u2207",isin:"\u2208",notin:"\u2209",ni:"\u220B",prod:"\u220F",sum:"\u2211",minus:"\u2212",lowast:"\u2217",radic:"\u221A",prop:"\u221D",infin:"\u221E",ang:"\u2220",and:"\u2227",or:"\u2228",cap:"\u2229",cup:"\u222A",int:"\u222B",there4:"\u2234",sim:"\u223C",cong:"\u2245",asymp:"\u2248",ne:"\u2260",equiv:"\u2261",le:"\u2264",ge:"\u2265",sub:"\u2282",sup:"\u2283",nsub:"\u2284",sube:"\u2286",supe:"\u2287",oplus:"\u2295",otimes:"\u2297",perp:"\u22A5",sdot:"\u22C5",lceil:"\u2308",rceil:"\u2309",lfloor:"\u230A",rfloor:"\u230B",lang:"\u2329",rang:"\u232A",loz:"\u25CA",spades:"\u2660",clubs:"\u2663",hearts:"\u2665",diams:"\u2666",quot:'"',amp:"&",lt:"<",gt:">",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};var iu=["cent","copy","divide","gt","lt","not","para","times"];var lu={}.hasOwnProperty,Pr={},es;for(es in Yn)lu.call(Yn,es)&&(Pr[Yn[es]]=es);var eg=/[^\dA-Za-z]/;function uu(e,t,a,n){let s=String.fromCharCode(e);if(lu.call(Pr,s)){let r=Pr[s],o="&"+r;return a&&ou.includes(r)&&!iu.includes(r)&&(!n||t&&t!==61&&eg.test(String.fromCharCode(t)))?o:o+";"}return""}function cu(e,t,a){let n=su(e,t,a.omitOptionalSemicolons),s;if((a.useNamedReferences||a.useShortestReferences)&&(s=uu(e,t,a.omitOptionalSemicolons,a.attribute)),(a.useShortestReferences||!s)&&a.useShortestReferences){let r=ru(e,t,a.omitOptionalSemicolons);r.length<n.length&&(n=r)}return s&&(!a.useShortestReferences||s.length<n.length)?s:n}function dt(e,t){return nu(e,Object.assign({format:cu},t))}var tg=/^>|^->|<!--|-->|--!>|<!-$/g,ag=[">"],ng=["<",">"];function du(e,t,a,n){return n.settings.bogusComments?"<?"+dt(e.value,Object.assign({},n.settings.characterReferences,{subset:ag}))+">":"<!--"+e.value.replace(tg,s)+"-->";function s(r){return dt(r,Object.assign({},n.settings.characterReferences,{subset:ng}))}}function pu(e,t,a,n){return"<!"+(n.settings.upperDoctype?"DOCTYPE":"doctype")+(n.settings.tightDoctype?"":" ")+"html>"}function Tr(e,t){let a=String(e);if(typeof t!="string")throw new TypeError("Expected character");let n=0,s=a.indexOf(t);for(;s!==-1;)n++,s=a.indexOf(t,s+t.length);return n}function mu(e,t){let a=t||{};return(e[e.length-1]===""?[...e,""]:e).join((a.padRight?" ":"")+","+(a.padLeft===!1?"":" ")).trim()}function fu(e){return e.join(" ").trim()}var sg=/[ \t\n\f\r]/g;function Vt(e){return typeof e=="object"?e.type==="text"?gu(e.value):!1:gu(e)}function gu(e){return e.replace(sg,"")===""}var le=hu(1),Rr=hu(-1),rg=[];function hu(e){return t;function t(a,n,s){let r=a?a.children:rg,o=(n||0)+e,i=r[o];if(!s)for(;i&&Vt(i);)o+=e,i=r[o];return i}}var og={}.hasOwnProperty;function ts(e){return t;function t(a,n,s){return og.call(e,a.tagName)&&e[a.tagName](a,n,s)}}var ln=ts({body:lg,caption:Er,colgroup:Er,dd:pg,dt:dg,head:Er,html:ig,li:cg,optgroup:mg,option:fg,p:ug,rp:bu,rt:bu,tbody:hg,td:yu,tfoot:bg,th:yu,thead:gg,tr:yg});function Er(e,t,a){let n=le(a,t,!0);return!n||n.type!=="comment"&&!(n.type==="text"&&Vt(n.value.charAt(0)))}function ig(e,t,a){let n=le(a,t);return!n||n.type!=="comment"}function lg(e,t,a){let n=le(a,t);return!n||n.type!=="comment"}function ug(e,t,a){let n=le(a,t);return n?n.type==="element"&&(n.tagName==="address"||n.tagName==="article"||n.tagName==="aside"||n.tagName==="blockquote"||n.tagName==="details"||n.tagName==="div"||n.tagName==="dl"||n.tagName==="fieldset"||n.tagName==="figcaption"||n.tagName==="figure"||n.tagName==="footer"||n.tagName==="form"||n.tagName==="h1"||n.tagName==="h2"||n.tagName==="h3"||n.tagName==="h4"||n.tagName==="h5"||n.tagName==="h6"||n.tagName==="header"||n.tagName==="hgroup"||n.tagName==="hr"||n.tagName==="main"||n.tagName==="menu"||n.tagName==="nav"||n.tagName==="ol"||n.tagName==="p"||n.tagName==="pre"||n.tagName==="section"||n.tagName==="table"||n.tagName==="ul"):!a||!(a.type==="element"&&(a.tagName==="a"||a.tagName==="audio"||a.tagName==="del"||a.tagName==="ins"||a.tagName==="map"||a.tagName==="noscript"||a.tagName==="video"))}function cg(e,t,a){let n=le(a,t);return!n||n.type==="element"&&n.tagName==="li"}function dg(e,t,a){let n=le(a,t);return!!(n&&n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd"))}function pg(e,t,a){let n=le(a,t);return!n||n.type==="element"&&(n.tagName==="dt"||n.tagName==="dd")}function bu(e,t,a){let n=le(a,t);return!n||n.type==="element"&&(n.tagName==="rp"||n.tagName==="rt")}function mg(e,t,a){let n=le(a,t);return!n||n.type==="element"&&n.tagName==="optgroup"}function fg(e,t,a){let n=le(a,t);return!n||n.type==="element"&&(n.tagName==="option"||n.tagName==="optgroup")}function gg(e,t,a){let n=le(a,t);return!!(n&&n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot"))}function hg(e,t,a){let n=le(a,t);return!n||n.type==="element"&&(n.tagName==="tbody"||n.tagName==="tfoot")}function bg(e,t,a){return!le(a,t)}function yg(e,t,a){let n=le(a,t);return!n||n.type==="element"&&n.tagName==="tr"}function yu(e,t,a){let n=le(a,t);return!n||n.type==="element"&&(n.tagName==="td"||n.tagName==="th")}var xu=ts({body:kg,colgroup:wg,head:_g,html:xg,tbody:$g});function xg(e){let t=le(e,-1);return!t||t.type!=="comment"}function _g(e){let t=new Set;for(let n of e.children)if(n.type==="element"&&(n.tagName==="base"||n.tagName==="title")){if(t.has(n.tagName))return!1;t.add(n.tagName)}let a=e.children[0];return!a||a.type==="element"}function kg(e){let t=le(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Vt(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function wg(e,t,a){let n=Rr(a,t),s=le(e,-1,!0);return a&&n&&n.type==="element"&&n.tagName==="colgroup"&&ln(n,a.children.indexOf(n),a)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function $g(e,t,a){let n=Rr(a,t),s=le(e,-1);return a&&n&&n.type==="element"&&(n.tagName==="thead"||n.tagName==="tbody")&&ln(n,a.children.indexOf(n),a)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}var as={name:[[`
|
|
78
78
|
\f\r &/=>`.split(""),`
|
|
79
79
|
\f\r "&'/=>\``.split("")],[`\0
|
|
80
80
|
\f\r "&'/<=>`.split(""),`\0
|
|
@@ -82,8 +82,8 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
82
82
|
\f\r &>`.split(""),`\0
|
|
83
83
|
\f\r "&'<=>\``.split("")],[`\0
|
|
84
84
|
\f\r "&'<=>\``.split(""),`\0
|
|
85
|
-
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function _u(e,t,a,n){let s=n.schema,r=s.space==="svg"?!1:n.settings.omitOptionalTags,o=s.space==="svg"?n.settings.closeEmptyElements:n.settings.voids.includes(e.tagName.toLowerCase()),i=[],l;s.space==="html"&&e.tagName==="svg"&&(n.schema=Qn);let u=Cg(n,e.properties),c=n.all(s.space==="html"&&e.tagName==="template"?e.content:e);return n.schema=s,c&&(o=!1),(u||!r||!xu(e,t,a))&&(i.push("<",e.tagName,u?" "+u:""),o&&(s.space==="svg"||n.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!n.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&i.push(" "),i.push("/")),i.push(">")),i.push(c),!o&&(!r||!ln(e,t,a))&&i.push("</"+e.tagName+">"),i.join("")}function Cg(e,t){let a=[],n=-1,s;if(t){for(s in t)if(t[s]!==null&&t[s]!==void 0){let r=Lg(e,s,t[s]);r&&a.push(r)}}for(;++n<a.length;){let r=e.settings.tightAttributes?a[n].charAt(a[n].length-1):void 0;n!==a.length-1&&r!=='"'&&r!=="'"&&(a[n]+=" ")}return a.join("")}function Lg(e,t,a){let n=Ar(e.schema,t),s=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,r=e.settings.allowDangerousCharacters?0:1,o=e.quote,i;if(n.overloadedBoolean&&(a===n.attribute||a==="")?a=!0:(n.boolean||n.overloadedBoolean)&&(typeof a!="string"||a===n.attribute||a==="")&&(a=!!a),a==null||a===!1||typeof a=="number"&&Number.isNaN(a))return"";let l=dt(n.attribute,Object.assign({},e.settings.characterReferences,{subset:as.name[s][r]}));return a===!0||(a=Array.isArray(a)?(n.commaSeparated?mu:fu)(a,{padLeft:!e.settings.tightCommaSeparatedLists}):String(a),e.settings.collapseEmptyAttributes&&!a)?l:(e.settings.preferUnquoted&&(i=dt(a,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:as.unquoted[s][r]}))),i!==a&&(e.settings.quoteSmart&&Tr(a,o)>Tr(a,e.alternative)&&(o=e.alternative),i=o+dt(a,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?as.single:as.double)[s][r],attribute:!0}))+o),l+(i&&"="+i))}var jg=["<","&"];function ns(e,t,a,n){return a&&a.type==="element"&&(a.tagName==="script"||a.tagName==="style")?e.value:dt(e.value,Object.assign({},n.settings.characterReferences,{subset:jg}))}function ku(e,t,a,n){return n.settings.allowDangerousHtml?e.value:ns(e,t,a,n)}function wu(e,t,a,n){return n.all(e)}var $u=tu("type",{invalid:vg,unknown:Sg,handlers:{comment:du,doctype:pu,element:_u,raw:ku,root:wu,text:ns}});function vg(e){throw new Error("Expected node, not `"+e+"`")}function Sg(e){let t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}var Ig={},Ag={},Pg=[];function Mr(e,t){let a=t||Ig,n=a.quote||'"',s=n==='"'?"'":'"';if(n!=='"'&&n!=="'")throw new Error("Invalid quote `"+n+"`, expected `'` or `\"`");return{one:Tg,all:Rg,settings:{omitOptionalTags:a.omitOptionalTags||!1,allowParseErrors:a.allowParseErrors||!1,allowDangerousCharacters:a.allowDangerousCharacters||!1,quoteSmart:a.quoteSmart||!1,preferUnquoted:a.preferUnquoted||!1,tightAttributes:a.tightAttributes||!1,upperDoctype:a.upperDoctype||!1,tightDoctype:a.tightDoctype||!1,bogusComments:a.bogusComments||!1,tightCommaSeparatedLists:a.tightCommaSeparatedLists||!1,tightSelfClosing:a.tightSelfClosing||!1,collapseEmptyAttributes:a.collapseEmptyAttributes||!1,allowDangerousHtml:a.allowDangerousHtml||!1,voids:a.voids||Xl,characterReferences:a.characterReferences||Ag,closeSelfClosing:a.closeSelfClosing||!1,closeEmptyElements:a.closeEmptyElements||!1},schema:a.space==="svg"?Qn:Yl,quote:n,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function Tg(e,t,a){return $u(e,t,a,this)}function Rg(e){let t=[],a=e&&e.children||Pg,n=-1;for(;++n<a.length;)t[n]=this.one(a[n],n,e);return t.join("")}var Cu=/\s+/g;function vu(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(Cu)),Array.isArray(e.properties.class)||(e.properties.class=[]);let a=Array.isArray(t)?t:t.split(Cu);for(let n of a)n&&!e.properties.class.includes(n)&&e.properties.class.push(n);return e}function Eg(e){let t=wa(e,!0).map(([s])=>s);function a(s){if(s===e.length)return{line:t.length-1,character:t.at(-1).length};let r=s,o=0;for(let i of t){if(r<i.length)break;r-=i.length,o++}return{line:o,character:r}}function n(s,r){let o=0;for(let i=0;i<s;i++)o+=t[i].length;return o+=r,o}return{lines:t,indexToPos:a,posToIndex:n}}var Mg=["color","background-color"];function Bg(e,t){let a=0,n=[];for(let s of t)s>a&&n.push({...e,content:e.content.slice(a,s),offset:e.offset+a}),a=s;return a<e.content.length&&n.push({...e,content:e.content.slice(a),offset:e.offset+a}),n}function qg(e,t){let a=0,n=e.length;for(;a<n;){let s=a+(n-a>>1);e[s]<=t?a=s+1:n=s}return a}function Dg(e,t){let a=[...t instanceof Set?t:new Set(t)].sort((n,s)=>n-s);return a.length?e.map(n=>n.flatMap(s=>{let r=s.offset+s.content.length,o=qg(a,s.offset),i=o;for(;i<a.length&&a[i]<r;)i++;if(o===i)return s;let l=a.slice(o,i);for(let u=0;u<l.length;u++)l[u]-=s.offset;return Bg(s,l)})):e}function Ng(e,t,a,n,s="css-vars"){let r={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(c=>ss(e.variants[c])),i=new Set(o.flatMap(c=>Object.keys(c))),l={},u=(c,p)=>{let f=p==="color"?"":p==="background-color"?"-bg":`-${p}`;return a+t[c]+(p==="color"?"":f)};return o.forEach((c,p)=>{for(let f of i){let h=c[f]||"inherit";if(p===0&&n&&Mg.includes(f))if(n==="light-dark()"&&o.length>1){let g=t.findIndex(k=>k==="light"),$=t.findIndex(k=>k==="dark");if(g===-1||$===-1)throw new Z('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let j=o[g][f]||"inherit",L=o[$][f]||"inherit";l[f]=`light-dark(${j}, ${L})`,s==="css-vars"&&(l[u(p,f)]=h)}else l[f]=h;else s==="css-vars"&&(l[u(p,f)]=h)}}),r.htmlStyle=l,r}function ss(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&ke.Italic&&(t["font-style"]="italic"),e.fontStyle&ke.Bold&&(t["font-weight"]="bold");let a=[];e.fontStyle&ke.Underline&&a.push("underline"),e.fontStyle&ke.Strikethrough&&a.push("line-through"),a.length&&(t["text-decoration"]=a.join(" "))}return t}function qr(e){return typeof e=="string"?e:Object.entries(e).map(([t,a])=>`${t}:${a}`).join(";")}function Og(){let e=new WeakMap;function t(a){if(!e.has(a.meta)){let s=function(o){if(typeof o=="number"){if(o<0||o>a.source.length)throw new Z(`Invalid decoration offset: ${o}. Code length: ${a.source.length}`);return{...n.indexToPos(o),offset:o}}else{let i=n.lines[o.line];if(i===void 0)throw new Z(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${n.lines.length}`);let l=o.character;if(l<0&&(l=i.length+l),l<0||l>i.length)throw new Z(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${i.length}`);return{...o,character:l,offset:n.posToIndex(o.line,l)}}},n=Eg(a.source),r=(a.options.decorations||[]).map(o=>({...o,start:s(o.start),end:s(o.end)}));Fg(r),e.set(a.meta,{decorations:r,converter:n,source:a.source})}return e.get(a.meta)}return{name:"shiki:decorations",tokens(a){if(this.options.decorations?.length)return Dg(a,t(this).decorations.flatMap(n=>[n.start.offset,n.end.offset]))},code(a){if(!this.options.decorations?.length)return;let n=t(this),s=[...a.children].filter(c=>c.type==="element"&&c.tagName==="span");if(s.length!==n.converter.lines.length)throw new Z(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function r(c,p,f,h){let g=s[c],$="",j=-1,L=-1;if(p===0&&(j=0),f===0&&(L=0),f===Number.POSITIVE_INFINITY&&(L=g.children.length),j===-1||L===-1)for(let w=0;w<g.children.length;w++)$+=Su(g.children[w]),j===-1&&$.length===p&&(j=w+1),L===-1&&$.length===f&&(L=w+1);if(j===-1)throw new Z(`Failed to find start index for decoration ${JSON.stringify(h.start)}`);if(L===-1)throw new Z(`Failed to find end index for decoration ${JSON.stringify(h.end)}`);let k=g.children.slice(j,L);if(!h.alwaysWrap&&k.length===g.children.length)i(g,h,"line");else if(!h.alwaysWrap&&k.length===1&&k[0].type==="element")i(k[0],h,"token");else{let w={type:"element",tagName:"span",properties:{},children:k};i(w,h,"wrapper"),g.children.splice(j,k.length,w)}}function o(c,p){s[c]=i(s[c],p,"line")}function i(c,p,f){let h=p.properties||{},g=p.transform||($=>$);return c.tagName=p.tagName||"span",c.properties={...c.properties,...h,class:c.properties.class},p.properties?.class&&vu(c,p.properties.class),c=g(c,f)||c,c}let l=[],u=n.decorations.sort((c,p)=>p.start.offset-c.start.offset||c.end.offset-p.end.offset);for(let c of u){let{start:p,end:f}=c;if(p.line===f.line)r(p.line,p.character,f.character,c);else if(p.line<f.line){r(p.line,p.character,Number.POSITIVE_INFINITY,c);for(let h=p.line+1;h<f.line;h++)l.unshift(()=>o(h,c));r(f.line,0,f.character,c)}}l.forEach(c=>c())}}}function Fg(e){for(let t=0;t<e.length;t++){let a=e[t];if(a.start.offset>a.end.offset)throw new Z(`Invalid decoration range: ${JSON.stringify(a.start)} - ${JSON.stringify(a.end)}`);for(let n=t+1;n<e.length;n++){let s=e[n],r=a.start.offset<=s.start.offset&&s.start.offset<a.end.offset,o=a.start.offset<s.end.offset&&s.end.offset<=a.end.offset,i=s.start.offset<=a.start.offset&&a.start.offset<s.end.offset,l=s.start.offset<a.end.offset&&a.end.offset<=s.end.offset;if(r||o||i||l){if(r&&o||i&&l||i&&a.start.offset===a.end.offset||o&&s.start.offset===s.end.offset)continue;throw new Z(`Decorations ${JSON.stringify(a.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function Su(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(Su).join(""):""}var Gg=[Og()];function rs(e){let t=zg(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...Gg]}function zg(e){let t=[],a=[],n=[];for(let s of e)switch(s.enforce){case"pre":t.push(s);break;case"post":a.push(s);break;default:n.push(s)}return{pre:t,post:a,normal:n}}var Xt=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Br={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function Ug(e,t){let a=e.indexOf("\x1B",t);if(a!==-1&&e[a+1]==="["){let n=e.indexOf("m",a);if(n!==-1)return{sequence:e.substring(a+2,n).split(";"),startPosition:a,position:n+1}}return{position:e.length}}function Lu(e){let t=e.shift();if(t==="2"){let a=e.splice(0,3).map(n=>Number.parseInt(n));return a.length!==3||a.some(n=>Number.isNaN(n))?void 0:{type:"rgb",rgb:a}}else if(t==="5"){let a=e.shift();if(a)return{type:"table",index:Number(a)}}}function Hg(e){let t=[];for(;e.length>0;){let a=e.shift();if(!a)continue;let n=Number.parseInt(a);if(!Number.isNaN(n))if(n===0)t.push({type:"resetAll"});else if(n<=9)Br[n]&&t.push({type:"setDecoration",value:Br[n]});else if(n<=29){let s=Br[n-20];s&&(t.push({type:"resetDecoration",value:s}),s==="dim"&&t.push({type:"resetDecoration",value:"bold"}))}else if(n<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Xt[n-30]}});else if(n===38){let s=Lu(e);s&&t.push({type:"setForegroundColor",value:s})}else if(n===39)t.push({type:"resetForegroundColor"});else if(n<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:Xt[n-40]}});else if(n===48){let s=Lu(e);s&&t.push({type:"setBackgroundColor",value:s})}else n===49?t.push({type:"resetBackgroundColor"}):n===53?t.push({type:"setDecoration",value:"overline"}):n===55?t.push({type:"resetDecoration",value:"overline"}):n>=90&&n<=97?t.push({type:"setForegroundColor",value:{type:"named",name:Xt[n-90+8]}}):n>=100&&n<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Xt[n-100+8]}})}return t}function Wg(){let e=null,t=null,a=new Set;return{parse(n){let s=[],r=0;do{let o=Ug(n,r),i=o.sequence?n.substring(r,o.startPosition):n.substring(r);if(i.length>0&&s.push({value:i,foreground:e,background:t,decorations:new Set(a)}),o.sequence){let l=Hg(o.sequence);for(let u of l)u.type==="resetAll"?(e=null,t=null,a.clear()):u.type==="resetForegroundColor"?e=null:u.type==="resetBackgroundColor"?t=null:u.type==="resetDecoration"&&a.delete(u.value);for(let u of l)u.type==="setForegroundColor"?e=u.value:u.type==="setBackgroundColor"?t=u.value:u.type==="setDecoration"&&a.add(u.value)}r=o.position}while(r<n.length);return s}}}var Vg={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function Xg(e=Vg){function t(i){return e[i]}function a(i){return`#${i.map(l=>Math.max(0,Math.min(l,255)).toString(16).padStart(2,"0")).join("")}`}let n;function s(){if(n)return n;n=[];for(let u=0;u<Xt.length;u++)n.push(t(Xt[u]));let i=[0,95,135,175,215,255];for(let u=0;u<6;u++)for(let c=0;c<6;c++)for(let p=0;p<6;p++)n.push(a([i[u],i[c],i[p]]));let l=8;for(let u=0;u<24;u++,l+=10)n.push(a([l,l,l]));return n}function r(i){return s()[i]}function o(i){switch(i.type){case"named":return t(i.name);case"rgb":return a(i.rgb);case"table":return r(i.index)}}return{value:o}}var Zg=/#([0-9a-f]{3,8})/i,Kg=/var\((--[\w-]+-ansi-[\w-]+)\)/,Jg={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function Qg(e,t,a){let n=tn(e,a),s=wa(t),r=Xg(Object.fromEntries(Xt.map(i=>{let l=`terminal.ansi${i[0].toUpperCase()}${i.substring(1)}`;return[i,e.colors?.[l]||Jg[i]]}))),o=Wg();return s.map(i=>o.parse(i[0]).map(l=>{let u,c;l.decorations.has("reverse")?(u=l.background?r.value(l.background):e.bg,c=l.foreground?r.value(l.foreground):e.fg):(u=l.foreground?r.value(l.foreground):e.fg,c=l.background?r.value(l.background):void 0),u=lt(u,n),c=lt(c,n),l.decorations.has("dim")&&(u=Yg(u));let p=ke.None;return l.decorations.has("bold")&&(p|=ke.Bold),l.decorations.has("italic")&&(p|=ke.Italic),l.decorations.has("underline")&&(p|=ke.Underline),l.decorations.has("strikethrough")&&(p|=ke.Strikethrough),{content:l.value,offset:i[1],color:u,bgColor:c,fontStyle:p}}))}function Yg(e){let t=e.match(Zg);if(t){let n=t[1];if(n.length===8){let s=Math.round(Number.parseInt(n.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${n.slice(0,6)}${s}`}else{if(n.length===6)return`#${n}80`;if(n.length===4){let s=n[0],r=n[1],o=n[2],i=n[3];return`#${s}${s}${r}${r}${o}${o}${Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,"0")}`}else if(n.length===3){let s=n[0],r=n[1],o=n[2];return`#${s}${s}${r}${r}${o}${o}80`}}}let a=e.match(Kg);return a?`var(${a[1]}-dim)`:e}function Dr(e,t,a={}){let n=e.resolveLangAlias(a.lang||"text"),{theme:s=e.getLoadedThemes()[0]}=a;if(!an(n)&&!nn(s)&&n==="ansi"){let{theme:r}=e.setTheme(s);return Qg(r,t,a)}return wr(e,t,a)}function os(e,t,a){let n,s,r,o,i,l;if("themes"in a){let{defaultColor:u="light",cssVariablePrefix:c="--shiki-",colorsRendering:p="css-vars"}=a,f=Object.entries(a.themes).filter(L=>L[1]).map(L=>({color:L[0],theme:L[1]})).sort((L,k)=>L.color===u?-1:k.color===u?1:0);if(f.length===0)throw new Z("`themes` option must not be empty");let h=Xn(e,t,a,Dr);if(l=$a(h),u&&u!=="light-dark()"&&!f.some(L=>L.color===u))throw new Z(`\`themes\` option must contain the defaultColor key \`${u}\``);let g=f.map(L=>e.getTheme(L.theme)),$=f.map(L=>L.color);r=h.map(L=>L.map(k=>Ng(k,$,c,u,p))),l&&sn(r,l);let j=f.map(L=>tn(L.theme,a));s=ju(f,g,j,c,u,"fg",p),n=ju(f,g,j,c,u,"bg",p),o=`shiki-themes ${g.map(L=>L.name).join(" ")}`,i=u?void 0:[s,n].join(";")}else if("theme"in a){let u=tn(a.theme,a);r=Dr(e,t,a);let c=e.getTheme(a.theme);n=lt(c.bg,u),s=lt(c.fg,u),o=c.name,l=$a(r)}else throw new Z("Invalid options, either `theme` or `themes` must be provided");return{tokens:r,fg:s,bg:n,themeName:o,rootStyle:i,grammarState:l}}function ju(e,t,a,n,s,r,o){return e.map((i,l)=>{let u=lt(t[l][r],a[l])||"inherit",c=`${n+i.color}${r==="bg"?"-bg":""}:${u}`;if(l===0&&s){if(s==="light-dark()"&&e.length>1){let p=e.findIndex(h=>h.color==="light"),f=e.findIndex(h=>h.color==="dark");if(p===-1||f===-1)throw new Z('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${lt(t[p][r],a[p])||"inherit"}, ${lt(t[f][r],a[f])||"inherit"});${c}`}return u}return o==="css-vars"?c:null}).filter(i=>!!i).join(";")}var Iu=/^\s+$/,eh=/^(\s*)(.*?)(\s*)$/;function is(e,t,a,n={meta:{},options:a,codeToHast:(s,r)=>is(e,s,r),codeToTokens:(s,r)=>os(e,s,r)}){let s=t;for(let g of rs(a))s=g.preprocess?.call(n,s,a)||s;let{tokens:r,fg:o,bg:i,themeName:l,rootStyle:u,grammarState:c}=os(e,s,a),{mergeWhitespaces:p=!0,mergeSameStyleTokens:f=!1}=a;p===!0?r=ah(r):p==="never"&&(r=nh(r)),f&&(r=sh(r));let h={...n,get source(){return s}};for(let g of rs(a))r=g.tokens?.call(h,r)||r;return th(r,{...a,fg:o,bg:i,themeName:l,rootStyle:a.rootStyle===!1?!1:a.rootStyle??u},h,c)}function th(e,t,a,n=$a(e)){let s=rs(t),r=[],o={type:"root",children:[]},{structure:i="classic",tabindex:l="0"}=t,u={class:`shiki ${t.themeName||""}`};t.rootStyle!==!1&&(t.rootStyle!=null?u.style=t.rootStyle:u.style=`background-color:${t.bg};color:${t.fg}`),l!==!1&&l!=null&&(u.tabindex=l.toString());for(let[$,j]of Object.entries(t.meta||{}))$.startsWith("_")||(u[$]=j);let c={type:"element",tagName:"pre",properties:u,children:[],data:t.data},p={type:"element",tagName:"code",properties:{},children:r},f=[],h={...a,structure:i,addClassToHast:vu,get source(){return a.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return c},get code(){return p},get lines(){return f}};if(e.forEach(($,j)=>{j&&(i==="inline"?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):i==="classic"&&r.push({type:"text",value:`
|
|
86
|
-
`}));let L={type:"element",tagName:"span",properties:{class:"line"},children:[]},k=0;for(let
|
|
85
|
+
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function _u(e,t,a,n){let s=n.schema,r=s.space==="svg"?!1:n.settings.omitOptionalTags,o=s.space==="svg"?n.settings.closeEmptyElements:n.settings.voids.includes(e.tagName.toLowerCase()),i=[],l;s.space==="html"&&e.tagName==="svg"&&(n.schema=Qn);let u=Cg(n,e.properties),c=n.all(s.space==="html"&&e.tagName==="template"?e.content:e);return n.schema=s,c&&(o=!1),(u||!r||!xu(e,t,a))&&(i.push("<",e.tagName,u?" "+u:""),o&&(s.space==="svg"||n.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!n.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&i.push(" "),i.push("/")),i.push(">")),i.push(c),!o&&(!r||!ln(e,t,a))&&i.push("</"+e.tagName+">"),i.join("")}function Cg(e,t){let a=[],n=-1,s;if(t){for(s in t)if(t[s]!==null&&t[s]!==void 0){let r=Lg(e,s,t[s]);r&&a.push(r)}}for(;++n<a.length;){let r=e.settings.tightAttributes?a[n].charAt(a[n].length-1):void 0;n!==a.length-1&&r!=='"'&&r!=="'"&&(a[n]+=" ")}return a.join("")}function Lg(e,t,a){let n=Ar(e.schema,t),s=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,r=e.settings.allowDangerousCharacters?0:1,o=e.quote,i;if(n.overloadedBoolean&&(a===n.attribute||a==="")?a=!0:(n.boolean||n.overloadedBoolean)&&(typeof a!="string"||a===n.attribute||a==="")&&(a=!!a),a==null||a===!1||typeof a=="number"&&Number.isNaN(a))return"";let l=dt(n.attribute,Object.assign({},e.settings.characterReferences,{subset:as.name[s][r]}));return a===!0||(a=Array.isArray(a)?(n.commaSeparated?mu:fu)(a,{padLeft:!e.settings.tightCommaSeparatedLists}):String(a),e.settings.collapseEmptyAttributes&&!a)?l:(e.settings.preferUnquoted&&(i=dt(a,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:as.unquoted[s][r]}))),i!==a&&(e.settings.quoteSmart&&Tr(a,o)>Tr(a,e.alternative)&&(o=e.alternative),i=o+dt(a,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?as.single:as.double)[s][r],attribute:!0}))+o),l+(i&&"="+i))}var jg=["<","&"];function ns(e,t,a,n){return a&&a.type==="element"&&(a.tagName==="script"||a.tagName==="style")?e.value:dt(e.value,Object.assign({},n.settings.characterReferences,{subset:jg}))}function ku(e,t,a,n){return n.settings.allowDangerousHtml?e.value:ns(e,t,a,n)}function wu(e,t,a,n){return n.all(e)}var $u=tu("type",{invalid:vg,unknown:Sg,handlers:{comment:du,doctype:pu,element:_u,raw:ku,root:wu,text:ns}});function vg(e){throw new Error("Expected node, not `"+e+"`")}function Sg(e){let t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}var Ig={},Ag={},Pg=[];function Mr(e,t){let a=t||Ig,n=a.quote||'"',s=n==='"'?"'":'"';if(n!=='"'&&n!=="'")throw new Error("Invalid quote `"+n+"`, expected `'` or `\"`");return{one:Tg,all:Rg,settings:{omitOptionalTags:a.omitOptionalTags||!1,allowParseErrors:a.allowParseErrors||!1,allowDangerousCharacters:a.allowDangerousCharacters||!1,quoteSmart:a.quoteSmart||!1,preferUnquoted:a.preferUnquoted||!1,tightAttributes:a.tightAttributes||!1,upperDoctype:a.upperDoctype||!1,tightDoctype:a.tightDoctype||!1,bogusComments:a.bogusComments||!1,tightCommaSeparatedLists:a.tightCommaSeparatedLists||!1,tightSelfClosing:a.tightSelfClosing||!1,collapseEmptyAttributes:a.collapseEmptyAttributes||!1,allowDangerousHtml:a.allowDangerousHtml||!1,voids:a.voids||Xl,characterReferences:a.characterReferences||Ag,closeSelfClosing:a.closeSelfClosing||!1,closeEmptyElements:a.closeEmptyElements||!1},schema:a.space==="svg"?Qn:Yl,quote:n,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function Tg(e,t,a){return $u(e,t,a,this)}function Rg(e){let t=[],a=e&&e.children||Pg,n=-1;for(;++n<a.length;)t[n]=this.one(a[n],n,e);return t.join("")}var Cu=/\s+/g;function vu(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(Cu)),Array.isArray(e.properties.class)||(e.properties.class=[]);let a=Array.isArray(t)?t:t.split(Cu);for(let n of a)n&&!e.properties.class.includes(n)&&e.properties.class.push(n);return e}function Eg(e){let t=wa(e,!0).map(([s])=>s);function a(s){if(s===e.length)return{line:t.length-1,character:t.at(-1).length};let r=s,o=0;for(let i of t){if(r<i.length)break;r-=i.length,o++}return{line:o,character:r}}function n(s,r){let o=0;for(let i=0;i<s;i++)o+=t[i].length;return o+=r,o}return{lines:t,indexToPos:a,posToIndex:n}}var Mg=["color","background-color"];function Bg(e,t){let a=0,n=[];for(let s of t)s>a&&n.push({...e,content:e.content.slice(a,s),offset:e.offset+a}),a=s;return a<e.content.length&&n.push({...e,content:e.content.slice(a),offset:e.offset+a}),n}function qg(e,t){let a=0,n=e.length;for(;a<n;){let s=a+(n-a>>1);e[s]<=t?a=s+1:n=s}return a}function Dg(e,t){let a=[...t instanceof Set?t:new Set(t)].sort((n,s)=>n-s);return a.length?e.map(n=>n.flatMap(s=>{let r=s.offset+s.content.length,o=qg(a,s.offset),i=o;for(;i<a.length&&a[i]<r;)i++;if(o===i)return s;let l=a.slice(o,i);for(let u=0;u<l.length;u++)l[u]-=s.offset;return Bg(s,l)})):e}function Ng(e,t,a,n,s="css-vars"){let r={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(c=>ss(e.variants[c])),i=new Set(o.flatMap(c=>Object.keys(c))),l={},u=(c,p)=>{let f=p==="color"?"":p==="background-color"?"-bg":`-${p}`;return a+t[c]+(p==="color"?"":f)};return o.forEach((c,p)=>{for(let f of i){let g=c[f]||"inherit";if(p===0&&n&&Mg.includes(f))if(n==="light-dark()"&&o.length>1){let h=t.findIndex(k=>k==="light"),w=t.findIndex(k=>k==="dark");if(h===-1||w===-1)throw new Z('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let j=o[h][f]||"inherit",L=o[w][f]||"inherit";l[f]=`light-dark(${j}, ${L})`,s==="css-vars"&&(l[u(p,f)]=g)}else l[f]=g;else s==="css-vars"&&(l[u(p,f)]=g)}}),r.htmlStyle=l,r}function ss(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&ke.Italic&&(t["font-style"]="italic"),e.fontStyle&ke.Bold&&(t["font-weight"]="bold");let a=[];e.fontStyle&ke.Underline&&a.push("underline"),e.fontStyle&ke.Strikethrough&&a.push("line-through"),a.length&&(t["text-decoration"]=a.join(" "))}return t}function qr(e){return typeof e=="string"?e:Object.entries(e).map(([t,a])=>`${t}:${a}`).join(";")}function Og(){let e=new WeakMap;function t(a){if(!e.has(a.meta)){let s=function(o){if(typeof o=="number"){if(o<0||o>a.source.length)throw new Z(`Invalid decoration offset: ${o}. Code length: ${a.source.length}`);return{...n.indexToPos(o),offset:o}}else{let i=n.lines[o.line];if(i===void 0)throw new Z(`Invalid decoration position ${JSON.stringify(o)}. Lines length: ${n.lines.length}`);let l=o.character;if(l<0&&(l=i.length+l),l<0||l>i.length)throw new Z(`Invalid decoration position ${JSON.stringify(o)}. Line ${o.line} length: ${i.length}`);return{...o,character:l,offset:n.posToIndex(o.line,l)}}},n=Eg(a.source),r=(a.options.decorations||[]).map(o=>({...o,start:s(o.start),end:s(o.end)}));Fg(r),e.set(a.meta,{decorations:r,converter:n,source:a.source})}return e.get(a.meta)}return{name:"shiki:decorations",tokens(a){if(this.options.decorations?.length)return Dg(a,t(this).decorations.flatMap(n=>[n.start.offset,n.end.offset]))},code(a){if(!this.options.decorations?.length)return;let n=t(this),s=[...a.children].filter(c=>c.type==="element"&&c.tagName==="span");if(s.length!==n.converter.lines.length)throw new Z(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function r(c,p,f,g){let h=s[c],w="",j=-1,L=-1;if(p===0&&(j=0),f===0&&(L=0),f===Number.POSITIVE_INFINITY&&(L=h.children.length),j===-1||L===-1)for(let $=0;$<h.children.length;$++)w+=Su(h.children[$]),j===-1&&w.length===p&&(j=$+1),L===-1&&w.length===f&&(L=$+1);if(j===-1)throw new Z(`Failed to find start index for decoration ${JSON.stringify(g.start)}`);if(L===-1)throw new Z(`Failed to find end index for decoration ${JSON.stringify(g.end)}`);let k=h.children.slice(j,L);if(!g.alwaysWrap&&k.length===h.children.length)i(h,g,"line");else if(!g.alwaysWrap&&k.length===1&&k[0].type==="element")i(k[0],g,"token");else{let $={type:"element",tagName:"span",properties:{},children:k};i($,g,"wrapper"),h.children.splice(j,k.length,$)}}function o(c,p){s[c]=i(s[c],p,"line")}function i(c,p,f){let g=p.properties||{},h=p.transform||(w=>w);return c.tagName=p.tagName||"span",c.properties={...c.properties,...g,class:c.properties.class},p.properties?.class&&vu(c,p.properties.class),c=h(c,f)||c,c}let l=[],u=n.decorations.sort((c,p)=>p.start.offset-c.start.offset||c.end.offset-p.end.offset);for(let c of u){let{start:p,end:f}=c;if(p.line===f.line)r(p.line,p.character,f.character,c);else if(p.line<f.line){r(p.line,p.character,Number.POSITIVE_INFINITY,c);for(let g=p.line+1;g<f.line;g++)l.unshift(()=>o(g,c));r(f.line,0,f.character,c)}}l.forEach(c=>c())}}}function Fg(e){for(let t=0;t<e.length;t++){let a=e[t];if(a.start.offset>a.end.offset)throw new Z(`Invalid decoration range: ${JSON.stringify(a.start)} - ${JSON.stringify(a.end)}`);for(let n=t+1;n<e.length;n++){let s=e[n],r=a.start.offset<=s.start.offset&&s.start.offset<a.end.offset,o=a.start.offset<s.end.offset&&s.end.offset<=a.end.offset,i=s.start.offset<=a.start.offset&&a.start.offset<s.end.offset,l=s.start.offset<a.end.offset&&a.end.offset<=s.end.offset;if(r||o||i||l){if(r&&o||i&&l||i&&a.start.offset===a.end.offset||o&&s.start.offset===s.end.offset)continue;throw new Z(`Decorations ${JSON.stringify(a.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function Su(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(Su).join(""):""}var Gg=[Og()];function rs(e){let t=zg(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...Gg]}function zg(e){let t=[],a=[],n=[];for(let s of e)switch(s.enforce){case"pre":t.push(s);break;case"post":a.push(s);break;default:n.push(s)}return{pre:t,post:a,normal:n}}var Xt=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Br={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function Ug(e,t){let a=e.indexOf("\x1B",t);if(a!==-1&&e[a+1]==="["){let n=e.indexOf("m",a);if(n!==-1)return{sequence:e.substring(a+2,n).split(";"),startPosition:a,position:n+1}}return{position:e.length}}function Lu(e){let t=e.shift();if(t==="2"){let a=e.splice(0,3).map(n=>Number.parseInt(n));return a.length!==3||a.some(n=>Number.isNaN(n))?void 0:{type:"rgb",rgb:a}}else if(t==="5"){let a=e.shift();if(a)return{type:"table",index:Number(a)}}}function Hg(e){let t=[];for(;e.length>0;){let a=e.shift();if(!a)continue;let n=Number.parseInt(a);if(!Number.isNaN(n))if(n===0)t.push({type:"resetAll"});else if(n<=9)Br[n]&&t.push({type:"setDecoration",value:Br[n]});else if(n<=29){let s=Br[n-20];s&&(t.push({type:"resetDecoration",value:s}),s==="dim"&&t.push({type:"resetDecoration",value:"bold"}))}else if(n<=37)t.push({type:"setForegroundColor",value:{type:"named",name:Xt[n-30]}});else if(n===38){let s=Lu(e);s&&t.push({type:"setForegroundColor",value:s})}else if(n===39)t.push({type:"resetForegroundColor"});else if(n<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:Xt[n-40]}});else if(n===48){let s=Lu(e);s&&t.push({type:"setBackgroundColor",value:s})}else n===49?t.push({type:"resetBackgroundColor"}):n===53?t.push({type:"setDecoration",value:"overline"}):n===55?t.push({type:"resetDecoration",value:"overline"}):n>=90&&n<=97?t.push({type:"setForegroundColor",value:{type:"named",name:Xt[n-90+8]}}):n>=100&&n<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:Xt[n-100+8]}})}return t}function Wg(){let e=null,t=null,a=new Set;return{parse(n){let s=[],r=0;do{let o=Ug(n,r),i=o.sequence?n.substring(r,o.startPosition):n.substring(r);if(i.length>0&&s.push({value:i,foreground:e,background:t,decorations:new Set(a)}),o.sequence){let l=Hg(o.sequence);for(let u of l)u.type==="resetAll"?(e=null,t=null,a.clear()):u.type==="resetForegroundColor"?e=null:u.type==="resetBackgroundColor"?t=null:u.type==="resetDecoration"&&a.delete(u.value);for(let u of l)u.type==="setForegroundColor"?e=u.value:u.type==="setBackgroundColor"?t=u.value:u.type==="setDecoration"&&a.add(u.value)}r=o.position}while(r<n.length);return s}}}var Vg={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function Xg(e=Vg){function t(i){return e[i]}function a(i){return`#${i.map(l=>Math.max(0,Math.min(l,255)).toString(16).padStart(2,"0")).join("")}`}let n;function s(){if(n)return n;n=[];for(let u=0;u<Xt.length;u++)n.push(t(Xt[u]));let i=[0,95,135,175,215,255];for(let u=0;u<6;u++)for(let c=0;c<6;c++)for(let p=0;p<6;p++)n.push(a([i[u],i[c],i[p]]));let l=8;for(let u=0;u<24;u++,l+=10)n.push(a([l,l,l]));return n}function r(i){return s()[i]}function o(i){switch(i.type){case"named":return t(i.name);case"rgb":return a(i.rgb);case"table":return r(i.index)}}return{value:o}}var Zg=/#([0-9a-f]{3,8})/i,Kg=/var\((--[\w-]+-ansi-[\w-]+)\)/,Jg={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function Qg(e,t,a){let n=tn(e,a),s=wa(t),r=Xg(Object.fromEntries(Xt.map(i=>{let l=`terminal.ansi${i[0].toUpperCase()}${i.substring(1)}`;return[i,e.colors?.[l]||Jg[i]]}))),o=Wg();return s.map(i=>o.parse(i[0]).map(l=>{let u,c;l.decorations.has("reverse")?(u=l.background?r.value(l.background):e.bg,c=l.foreground?r.value(l.foreground):e.fg):(u=l.foreground?r.value(l.foreground):e.fg,c=l.background?r.value(l.background):void 0),u=lt(u,n),c=lt(c,n),l.decorations.has("dim")&&(u=Yg(u));let p=ke.None;return l.decorations.has("bold")&&(p|=ke.Bold),l.decorations.has("italic")&&(p|=ke.Italic),l.decorations.has("underline")&&(p|=ke.Underline),l.decorations.has("strikethrough")&&(p|=ke.Strikethrough),{content:l.value,offset:i[1],color:u,bgColor:c,fontStyle:p}}))}function Yg(e){let t=e.match(Zg);if(t){let n=t[1];if(n.length===8){let s=Math.round(Number.parseInt(n.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${n.slice(0,6)}${s}`}else{if(n.length===6)return`#${n}80`;if(n.length===4){let s=n[0],r=n[1],o=n[2],i=n[3];return`#${s}${s}${r}${r}${o}${o}${Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,"0")}`}else if(n.length===3){let s=n[0],r=n[1],o=n[2];return`#${s}${s}${r}${r}${o}${o}80`}}}let a=e.match(Kg);return a?`var(${a[1]}-dim)`:e}function Dr(e,t,a={}){let n=e.resolveLangAlias(a.lang||"text"),{theme:s=e.getLoadedThemes()[0]}=a;if(!an(n)&&!nn(s)&&n==="ansi"){let{theme:r}=e.setTheme(s);return Qg(r,t,a)}return wr(e,t,a)}function os(e,t,a){let n,s,r,o,i,l;if("themes"in a){let{defaultColor:u="light",cssVariablePrefix:c="--shiki-",colorsRendering:p="css-vars"}=a,f=Object.entries(a.themes).filter(L=>L[1]).map(L=>({color:L[0],theme:L[1]})).sort((L,k)=>L.color===u?-1:k.color===u?1:0);if(f.length===0)throw new Z("`themes` option must not be empty");let g=Xn(e,t,a,Dr);if(l=$a(g),u&&u!=="light-dark()"&&!f.some(L=>L.color===u))throw new Z(`\`themes\` option must contain the defaultColor key \`${u}\``);let h=f.map(L=>e.getTheme(L.theme)),w=f.map(L=>L.color);r=g.map(L=>L.map(k=>Ng(k,w,c,u,p))),l&&sn(r,l);let j=f.map(L=>tn(L.theme,a));s=ju(f,h,j,c,u,"fg",p),n=ju(f,h,j,c,u,"bg",p),o=`shiki-themes ${h.map(L=>L.name).join(" ")}`,i=u?void 0:[s,n].join(";")}else if("theme"in a){let u=tn(a.theme,a);r=Dr(e,t,a);let c=e.getTheme(a.theme);n=lt(c.bg,u),s=lt(c.fg,u),o=c.name,l=$a(r)}else throw new Z("Invalid options, either `theme` or `themes` must be provided");return{tokens:r,fg:s,bg:n,themeName:o,rootStyle:i,grammarState:l}}function ju(e,t,a,n,s,r,o){return e.map((i,l)=>{let u=lt(t[l][r],a[l])||"inherit",c=`${n+i.color}${r==="bg"?"-bg":""}:${u}`;if(l===0&&s){if(s==="light-dark()"&&e.length>1){let p=e.findIndex(g=>g.color==="light"),f=e.findIndex(g=>g.color==="dark");if(p===-1||f===-1)throw new Z('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${lt(t[p][r],a[p])||"inherit"}, ${lt(t[f][r],a[f])||"inherit"});${c}`}return u}return o==="css-vars"?c:null}).filter(i=>!!i).join(";")}var Iu=/^\s+$/,eh=/^(\s*)(.*?)(\s*)$/;function is(e,t,a,n={meta:{},options:a,codeToHast:(s,r)=>is(e,s,r),codeToTokens:(s,r)=>os(e,s,r)}){let s=t;for(let h of rs(a))s=h.preprocess?.call(n,s,a)||s;let{tokens:r,fg:o,bg:i,themeName:l,rootStyle:u,grammarState:c}=os(e,s,a),{mergeWhitespaces:p=!0,mergeSameStyleTokens:f=!1}=a;p===!0?r=ah(r):p==="never"&&(r=nh(r)),f&&(r=sh(r));let g={...n,get source(){return s}};for(let h of rs(a))r=h.tokens?.call(g,r)||r;return th(r,{...a,fg:o,bg:i,themeName:l,rootStyle:a.rootStyle===!1?!1:a.rootStyle??u},g,c)}function th(e,t,a,n=$a(e)){let s=rs(t),r=[],o={type:"root",children:[]},{structure:i="classic",tabindex:l="0"}=t,u={class:`shiki ${t.themeName||""}`};t.rootStyle!==!1&&(t.rootStyle!=null?u.style=t.rootStyle:u.style=`background-color:${t.bg};color:${t.fg}`),l!==!1&&l!=null&&(u.tabindex=l.toString());for(let[w,j]of Object.entries(t.meta||{}))w.startsWith("_")||(u[w]=j);let c={type:"element",tagName:"pre",properties:u,children:[],data:t.data},p={type:"element",tagName:"code",properties:{},children:r},f=[],g={...a,structure:i,addClassToHast:vu,get source(){return a.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return c},get code(){return p},get lines(){return f}};if(e.forEach((w,j)=>{j&&(i==="inline"?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):i==="classic"&&r.push({type:"text",value:`
|
|
86
|
+
`}));let L={type:"element",tagName:"span",properties:{class:"line"},children:[]},k=0;for(let $ of w){let R={type:"element",tagName:"span",properties:{...$.htmlAttrs},children:[{type:"text",value:$.content}]},T=qr($.htmlStyle||ss($));T&&(R.properties.style=T);for(let O of s)R=O?.span?.call(g,R,j+1,k,L,$)||R;i==="inline"?o.children.push(R):i==="classic"&&L.children.push(R),k+=$.content.length}if(i==="classic"){for(let $ of s)L=$?.line?.call(g,L,j+1)||L;f.push(L),r.push(L)}else i==="inline"&&f.push(L)}),i==="classic"){for(let w of s)p=w?.code?.call(g,p)||p;c.children.push(p);for(let w of s)c=w?.pre?.call(g,c)||c;o.children.push(c)}else if(i==="inline"){let w=[],j={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(let k of o.children)k.type==="element"&&k.tagName==="br"?(w.push(j),j={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(k.type==="element"||k.type==="text")&&j.children.push(k);w.push(j);let L={type:"element",tagName:"code",properties:{},children:w};for(let k of s)L=k?.code?.call(g,L)||L;o.children=[];for(let k=0;k<L.children.length;k++){k>0&&o.children.push({type:"element",tagName:"br",properties:{},children:[]});let $=L.children[k];$.type==="element"&&o.children.push(...$.children)}}let h=o;for(let w of s)h=w?.root?.call(g,h)||h;return n&&sn(h,n),h}function ah(e){return e.map(t=>{let a=[],n="",s;return t.forEach((r,o)=>{let i=!(r.fontStyle&&(r.fontStyle&ke.Underline||r.fontStyle&ke.Strikethrough));i&&Iu.test(r.content)&&t[o+1]?(s===void 0&&(s=r.offset),n+=r.content):n?(i?a.push({...r,offset:s,content:n+r.content}):a.push({content:n,offset:s},r),s=void 0,n=""):a.push(r)}),a})}function nh(e){return e.map(t=>t.flatMap(a=>{if(Iu.test(a.content))return a;let n=a.content.match(eh);if(!n)return a;let[,s,r,o]=n;if(!s&&!o)return a;let i=[{...a,offset:a.offset+s.length,content:r}];return s&&i.unshift({content:s,offset:a.offset}),o&&i.push({content:o,offset:a.offset+s.length+r.length}),i}))}function sh(e){return e.map(t=>{let a=[];for(let n of t){if(a.length===0){a.push({...n});continue}let s=a.at(-1),r=qr(s.htmlStyle||ss(s)),o=qr(n.htmlStyle||ss(n)),i=s.fontStyle&&(s.fontStyle&ke.Underline||s.fontStyle&ke.Strikethrough),l=n.fontStyle&&(n.fontStyle&ke.Underline||n.fontStyle&ke.Strikethrough);!i&&!l&&r===o?s.content+=n.content:a.push({...n})}return a})}var rh=Mr;function oh(e,t,a){let n={meta:{},options:a,codeToHast:(r,o)=>is(e,r,o),codeToTokens:(r,o)=>os(e,r,o)},s=rh(is(e,t,a,n));for(let r of rs(a))s=r.postprocess?.call(n,s,a)||s;return s}async function Au(e){let t=await kr(e);return{getLastGrammarState:(...a)=>Wl(t,...a),codeToTokensBase:(a,n)=>Dr(t,a,n),codeToTokensWithThemes:(a,n)=>Xn(t,a,n),codeToTokens:(a,n)=>os(t,a,n),codeToHast:(a,n)=>is(t,a,n),codeToHtml:(a,n)=>oh(t,a,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function Pu(e={}){let{name:t="css-variables",variablePrefix:a="--shiki-",fontStyle:n=!0}=e,s=o=>e.variableDefaults?.[o]?`var(${a}${o}, ${e.variableDefaults[o]})`:`var(${a}${o})`,r={name:t,type:"dark",colors:{"editor.foreground":s("foreground"),"editor.background":s("background"),"terminal.ansiBlack":s("ansi-black"),"terminal.ansiRed":s("ansi-red"),"terminal.ansiGreen":s("ansi-green"),"terminal.ansiYellow":s("ansi-yellow"),"terminal.ansiBlue":s("ansi-blue"),"terminal.ansiMagenta":s("ansi-magenta"),"terminal.ansiCyan":s("ansi-cyan"),"terminal.ansiWhite":s("ansi-white"),"terminal.ansiBrightBlack":s("ansi-bright-black"),"terminal.ansiBrightRed":s("ansi-bright-red"),"terminal.ansiBrightGreen":s("ansi-bright-green"),"terminal.ansiBrightYellow":s("ansi-bright-yellow"),"terminal.ansiBrightBlue":s("ansi-bright-blue"),"terminal.ansiBrightMagenta":s("ansi-bright-magenta"),"terminal.ansiBrightCyan":s("ansi-bright-cyan"),"terminal.ansiBrightWhite":s("ansi-bright-white")},tokenColors:[{scope:["keyword.operator.accessor","meta.group.braces.round.function.arguments","meta.template.expression","markup.fenced_code meta.embedded.block"],settings:{foreground:s("foreground")}},{scope:"emphasis",settings:{fontStyle:"italic"}},{scope:["strong","markup.heading.markdown","markup.bold.markdown"],settings:{fontStyle:"bold"}},{scope:["markup.italic.markdown"],settings:{fontStyle:"italic"}},{scope:"meta.link.inline.markdown",settings:{fontStyle:"underline",foreground:s("token-link")}},{scope:["string","markup.fenced_code","markup.inline"],settings:{foreground:s("token-string")}},{scope:["comment","string.quoted.docstring.multi"],settings:{foreground:s("token-comment")}},{scope:["constant.numeric","constant.language","constant.other.placeholder","constant.character.format.placeholder","variable.language.this","variable.other.object","variable.other.class","variable.other.constant","meta.property-name","meta.property-value","support"],settings:{foreground:s("token-constant")}},{scope:["keyword","storage.modifier","storage.type","storage.control.clojure","entity.name.function.clojure","entity.name.tag.yaml","support.function.node","support.type.property-name.json","punctuation.separator.key-value","punctuation.definition.template-expression"],settings:{foreground:s("token-keyword")}},{scope:"variable.parameter.function",settings:{foreground:s("token-parameter")}},{scope:["support.function","entity.name.type","entity.other.inherited-class","meta.function-call","meta.instance.constructor","entity.other.attribute-name","entity.name.function","constant.keyword.clojure"],settings:{foreground:s("token-function")}},{scope:["entity.name.tag","string.quoted","string.regexp","string.interpolated","string.template","string.unquoted.plain.out.yaml","keyword.other.template"],settings:{foreground:s("token-string-expression")}},{scope:["punctuation.definition.arguments","punctuation.definition.dict","punctuation.separator","meta.function-call.arguments"],settings:{foreground:s("token-punctuation")}},{scope:["markup.underline.link","punctuation.definition.metadata.markdown"],settings:{foreground:s("token-link")}},{scope:["beginning.punctuation.definition.list.markdown"],settings:{foreground:s("token-string")}},{scope:["punctuation.definition.string.begin.markdown","punctuation.definition.string.end.markdown","string.other.link.title.markdown","string.other.link.description.markdown"],settings:{foreground:s("token-keyword")}},{scope:["markup.inserted","meta.diff.header.to-file","punctuation.definition.inserted"],settings:{foreground:s("token-inserted")}},{scope:["markup.deleted","meta.diff.header.from-file","punctuation.definition.deleted"],settings:{foreground:s("token-deleted")}},{scope:["markup.changed","punctuation.definition.changed"],settings:{foreground:s("token-changed")}}]};return n||(r.tokenColors=r.tokenColors?.map(o=>(o.settings?.fontStyle&&delete o.settings.fontStyle,o))),r}var Tu=class{patterns;options;regexps;constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:a=!1,cache:n,regexConstructor:s}=t;if(!s)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(r=>{if(typeof r!="string")return r;let o=n?.get(r);if(o){if(o instanceof RegExp)return o;if(a)return null;throw o}try{let i=s(r);return n?.set(r,i),i}catch(i){if(n?.set(r,i),a)return null;throw i}})}findNextMatchSync(e,t,a){let n=typeof e=="string"?e:e.content,s=[];function r(o,i,l=0){return{index:o,captureIndices:i.indices.map(u=>u==null?{start:4294967295,end:4294967295,length:0}:{start:u[0]+l,end:u[1]+l,length:u[1]-u[0]})}}for(let o=0;o<this.regexps.length;o++){let i=this.regexps[o];if(i)try{i.lastIndex=t;let l=i.exec(n);if(!l)continue;if(l.index===t)return r(o,l,0);s.push([o,l,0])}catch(l){if(this.options.forgiving)continue;throw l}}if(s.length){let o=Math.min(...s.map(i=>i[1].index));for(let[i,l,u]of s)if(l.index===o)return r(i,l,u)}return null}};function Lt(e){if([...e].length!==1)throw new Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function Ru(e,t,a){return e.has(t)||e.set(t,a),e.get(t)}var un=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),pe=String.raw;function pt(e,t){if(e==null)throw new Error(t??"Value expected");return e}var Nu=pe`\[\^?`,Ou=`c.? | C(?:-.?)?|${pe`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${pe`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${pe`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${pe`o\{[^\}]*\}?`}|${pe`\d{1,3}`}`,Or=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,ls=new RegExp(pe`
|
|
87
87
|
\\ (?:
|
|
88
88
|
${Ou}
|
|
89
89
|
| [gk]<[^>]*>?
|
|
@@ -115,7 +115,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
115
115
|
| &&
|
|
116
116
|
| .
|
|
117
117
|
`.replace(/\s+/g,""),"gsu");function Fu(e,t={}){let a={flags:"",...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!="string")throw new Error("String expected as pattern");let n=Lh(a.flags),s=[n.extended],r={captureGroup:a.rules.captureGroup,getCurrentModX(){return s.at(-1)},numOpenGroups:0,popModX(){s.pop()},pushModX(p){s.push(p)},replaceCurrentModX(p){s[s.length-1]=p},singleline:a.rules.singleline},o=[],i;for(ls.lastIndex=0;i=ls.exec(e);){let p=ih(r,e,i[0],ls.lastIndex);p.tokens?o.push(...p.tokens):p.token&&o.push(p.token),p.lastIndex!==void 0&&(ls.lastIndex=p.lastIndex)}let l=[],u=0;o.filter(p=>p.type==="GroupOpen").forEach(p=>{p.kind==="capturing"?p.number=++u:p.raw==="("&&l.push(p)}),u||l.forEach((p,f)=>{p.kind="capturing",p.number=f+1});let c=u||l.length;return{tokens:o.map(p=>p.type==="EscapedNumber"?vh(p,c):p).flat(),flags:n}}function ih(e,t,a,n){let[s,r]=a;if(a==="["||a==="[^"){let o=lh(t,a,n);return{tokens:o.tokens,lastIndex:o.lastIndex}}if(s==="\\"){if("AbBGyYzZ".includes(r))return{token:Eu(a,a)};if(/^\\g[<']/.test(a)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(a))throw new Error(`Invalid group name "${a}"`);return{token:yh(a)}}if(/^\\k[<']/.test(a)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(a))throw new Error(`Invalid group name "${a}"`);return{token:zu(a)}}if(r==="K")return{token:Uu("keep",a)};if(r==="N"||r==="R")return{token:Zt("newline",a,{negate:r==="N"})};if(r==="O")return{token:Zt("any",a)};if(r==="X")return{token:Zt("text_segment",a)};let o=Gu(a,{inCharClass:!1});return Array.isArray(o)?{tokens:o}:{token:o}}if(s==="("){if(r==="*")return{token:wh(a)};if(a==="(?{")throw new Error(`Unsupported callout "${a}"`);if(a.startsWith("(?#")){if(t[n]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:n+1}}if(/^\(\?[-imx]+[:)]$/.test(a))return{token:kh(a,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,a==="("&&!e.captureGroup||a==="(?:")return{token:Ca("group",a)};if(a==="(?>")return{token:Ca("atomic",a)};if(a==="(?="||a==="(?!"||a==="(?<="||a==="(?<!")return{token:Ca(a[2]==="<"?"lookbehind":"lookahead",a,{negate:a.endsWith("!")})};if(a==="("&&e.captureGroup||a.startsWith("(?<")&&a.endsWith(">")||a.startsWith("(?'")&&a.endsWith("'"))return{token:Ca("capturing",a,{...a!=="("&&{name:a.slice(3,-1)}})};if(a.startsWith("(?~")){if(a==="(?~|")throw new Error(`Unsupported absence function kind "${a}"`);return{token:Ca("absence_repeater",a)}}throw a==="(?("?new Error(`Unsupported conditional "${a}"`):new Error(`Invalid or unsupported group option "${a}"`)}if(a===")"){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:gh(a)}}if(e.getCurrentModX()){if(a==="#"){let o=t.indexOf(`
|
|
118
|
-
`,n);return{lastIndex:o===-1?t.length:o}}if(/^\s$/.test(a)){let o=/\s+/y;return o.lastIndex=n,{lastIndex:o.exec(t)?o.lastIndex:n}}}if(a===".")return{token:Zt("dot",a)};if(a==="^"||a==="$"){let o=e.singleline?{"^":pe`\A`,$:pe`\Z`}[a]:a;return{token:Eu(o,a)}}return a==="|"?{token:ch(a)}:Or.test(a)?{tokens:Sh(a)}:{token:mt(Lt(a),a)}}function lh(e,t,a){let n=[Mu(t[1]==="^",t)],s=1,r;for(Nr.lastIndex=a;r=Nr.exec(e);){let o=r[0];if(o[0]==="["&&o[1]!==":")s++,n.push(Mu(o[1]==="^",o));else if(o==="]"){if(n.at(-1).type==="CharacterClassOpen")n.push(mt(93,o));else if(s--,n.push(dh(o)),!s)break}else{let i=uh(o);Array.isArray(i)?n.push(...i):n.push(i)}}return{tokens:n,lastIndex:Nr.lastIndex||e.length}}function uh(e){if(e[0]==="\\")return Gu(e,{inCharClass:!0});if(e[0]==="["){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!un.has(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return Zt("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return e==="-"?ph(e):e==="&&"?mh(e):mt(Lt(e),e)}function Gu(e,{inCharClass:t}){let a=e[1];if(a==="c"||a==="C")return _h(e);if("dDhHsSwW".includes(a))return $h(e);if(e.startsWith(pe`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw new Error(`Incomplete or invalid Unicode property "${e}"`);return Ch(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let n=e.split(/\\x/).slice(1).map(o=>parseInt(o,16)),s=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(n)),r=new TextEncoder;return[...s].map(o=>{let i=[...r.encode(o)].map(l=>`\\x${l.toString(16)}`).join("");return mt(Lt(o),i)})}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(a==="u"||a==="x")return mt(jh(e),e);if(Bu.has(a))return mt(Bu.get(a),e);if(/\d/.test(a))return fh(t,e);if(e==="\\")throw new Error(pe`Incomplete escape "\"`);if(a==="M")throw new Error(`Unsupported meta "${e}"`);if([...e].length===2)return mt(e.codePointAt(1),e);throw new Error(`Unexpected escape "${e}"`)}function ch(e){return{type:"Alternator",raw:e}}function Eu(e,t){return{type:"Assertion",kind:e,raw:t}}function zu(e){return{type:"Backreference",raw:e}}function mt(e,t){return{type:"Character",value:e,raw:t}}function dh(e){return{type:"CharacterClassClose",raw:e}}function ph(e){return{type:"CharacterClassHyphen",raw:e}}function mh(e){return{type:"CharacterClassIntersector",raw:e}}function Mu(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function Zt(e,t,a={}){return{type:"CharacterSet",kind:e,...a,raw:t}}function Uu(e,t,a={}){return e==="keep"?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:pt(a.flags),raw:t}}function fh(e,t){return{type:"EscapedNumber",inCharClass:e,raw:t}}function gh(e){return{type:"GroupClose",raw:e}}function Ca(e,t,a={}){return{type:"GroupOpen",kind:e,...a,raw:t}}function hh(e,t,a,n){return{type:"NamedCallout",kind:e,tag:t,arguments:a,raw:n}}function bh(e,t,a,n){return{type:"Quantifier",kind:e,min:t,max:a,raw:n}}function yh(e){return{type:"Subroutine",raw:e}}var xh=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),Bu=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function _h(e){let t=e[1]==="c"?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw new Error(`Unsupported control character "${e}"`);return mt(Lt(t.toUpperCase())-64,e)}function kh(e,t){let{on:a,off:n}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;n??="";let s=(t.getCurrentModX()||a.includes("x"))&&!n.includes("x"),r=Du(a),o=Du(n),i={};if(r&&(i.enable=r),o&&(i.disable=o),e.endsWith(")"))return t.replaceCurrentModX(s),Uu("flags",e,{flags:i});if(e.endsWith(":"))return t.pushModX(s),t.numOpenGroups++,Ca("group",e,{...(r||o)&&{flags:i}});throw new Error(`Unexpected flag modifier "${e}"`)}function wh(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw new Error(`Incomplete or invalid named callout "${e}"`);let{name:a,tag:n,args:s}=t.groups;if(!a)throw new Error(`Invalid named callout "${e}"`);if(n==="")throw new Error(`Named callout tag with empty value not allowed "${e}"`);let r=s?s.split(",").filter(c=>c!=="").map(c=>/^[+-]?\d+$/.test(c)?+c:c):[],[o,i,l]=r,u=xh.has(a)?a.toLowerCase():"custom";switch(u){case"fail":case"mismatch":case"skip":if(r.length>0)throw new Error(`Named callout arguments not allowed "${r}"`);break;case"error":if(r.length>1)throw new Error(`Named callout allows only one argument "${r}"`);if(typeof o=="string")throw new Error(`Named callout argument must be a number "${o}"`);break;case"max":if(!r.length||r.length>2)throw new Error(`Named callout must have one or two arguments "${r}"`);if(typeof o=="string"&&!/^[A-Za-z_]\w*$/.test(o))throw new Error(`Named callout argument one must be a tag or number "${o}"`);if(r.length===2&&(typeof i=="number"||!/^[<>X]$/.test(i)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${i}"`);break;case"count":case"total_count":if(r.length>1)throw new Error(`Named callout allows only one argument "${r}"`);if(r.length===1&&(typeof o=="number"||!/^[<>X]$/.test(o)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case"cmp":if(r.length!==3)throw new Error(`Named callout must have three arguments "${r}"`);if(typeof o=="string"&&!/^[A-Za-z_]\w*$/.test(o))throw new Error(`Named callout argument one must be a tag or number "${o}"`);if(typeof i=="number"||!/^(?:[<>!=]=|[<>])$/.test(i))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${i}"`);if(typeof l=="string"&&!/^[A-Za-z_]\w*$/.test(l))throw new Error(`Named callout argument three must be a tag or number "${l}"`);break;case"custom":throw new Error(`Undefined callout name "${a}"`);default:throw new Error(`Unexpected named callout kind "${u}"`)}return hh(u,n??null,s?.split(",")??null,e)}function qu(e){let t=null,a,n;if(e[0]==="{"){let{minStr:s,maxStr:r}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+s>o||r&&+r>o)throw new Error("Quantifier value unsupported in Oniguruma");if(a=+s,n=r===void 0?+s:r===""?1/0:+r,a>n&&(t="possessive",[a,n]=[n,a]),e.endsWith("?")){if(t==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');t="lazy"}else t||(t="greedy")}else a=e[0]==="+"?1:0,n=e[0]==="?"?1:1/0,t=e[1]==="+"?"possessive":e[1]==="?"?"lazy":"greedy";return bh(t,a,n,e)}function $h(e){let t=e[1].toLowerCase();return Zt({d:"digit",h:"hex",s:"space",w:"word"}[t],e,{negate:e[1]!==t})}function Ch(e){let{p:t,neg:a,value:n}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return Zt("property",e,{value:n,negate:t==="P"&&!a||t==="p"&&!!a})}function Du(e){let t={};return e.includes("i")&&(t.ignoreCase=!0),e.includes("m")&&(t.dotAll=!0),e.includes("x")&&(t.extended=!0),Object.keys(t).length?t:null}function Lh(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let a=0;a<e.length;a++){let n=e[a];if(!"imxDPSWy".includes(n))throw new Error(`Invalid flag "${n}"`);if(n==="y"){if(!/^y{[gw]}/.test(e.slice(a)))throw new Error('Invalid or unspecified flag "y" mode');t.textSegmentMode=e[a+2]==="g"?"grapheme":"word",a+=3;continue}t[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[n]]=!0}return t}function jh(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw new Error(`Incomplete or invalid escape "${e}"`);let t=e[2]==="{"?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function vh(e,t){let{raw:a,inCharClass:n}=e,s=a.slice(1);if(!n&&(s!=="0"&&s.length===1||s[0]!=="0"&&+s<=t))return[zu(a)];let r=[],o=s.match(/^[0-7]+|\d/g);for(let i=0;i<o.length;i++){let l=o[i],u;if(i===0&&l!=="8"&&l!=="9"){if(u=parseInt(l,8),u>127)throw new Error(pe`Octal encoded byte above 177 unsupported "${a}"`)}else u=Lt(l);r.push(mt(u,(i===0?"\\":"")+l))}return r}function Sh(e){let t=[],a=new RegExp(Or,"gy"),n;for(;n=a.exec(e);){let s=n[0];if(s[0]==="{"){let r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(s);if(r){let{min:o,max:i}=r.groups;if(+o>+i&&s.endsWith("?")){a.lastIndex--,t.push(qu(s.slice(0,-1)));continue}}}t.push(qu(s))}return t}function us(e,t){if(!Array.isArray(e.body))throw new Error("Expected node with body array");if(e.body.length!==1)return!1;let a=e.body[0];return!t||Object.keys(t).every(n=>t[n]===a[n])}function Hu(e){return Ih.has(e.type)}var Ih=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function ds(e,t={}){let a={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},n=Fu(e,{flags:a.flags,rules:{captureGroup:a.rules.captureGroup,singleline:a.rules.singleline}}),s=(f,h)=>{let g=n.tokens[r.nextIndex];switch(r.parent=f,r.nextIndex++,g.type){case"Alternator":return ft();case"Assertion":return Ah(g);case"Backreference":return Ph(g,r);case"Character":return La(g.value,{useLastValid:!!h.isCheckingRangeEnd});case"CharacterClassHyphen":return Th(g,r,h);case"CharacterClassOpen":return Rh(g,r,h);case"CharacterSet":return Eh(g,r);case"Directive":return Oh(g.kind,{flags:g.flags});case"GroupOpen":return Mh(g,r,h);case"NamedCallout":return Gh(g.kind,g.tag,g.arguments);case"Quantifier":return Bh(g,r);case"Subroutine":return qh(g,r);default:throw new Error(`Unexpected token type "${g.type}"`)}},r={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:a.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:a.skipBackrefValidation,skipLookbehindValidation:a.skipLookbehindValidation,skipPropertyNameValidation:a.skipPropertyNameValidation,subroutines:[],tokens:n.tokens,unicodePropertyMap:a.unicodePropertyMap,walk:s},o=Uh(Fh(n.flags)),i=o.body[0];for(;r.nextIndex<n.tokens.length;){let f=s(i,{});f.type==="Alternative"?(o.body.push(f),i=f):i.body.push(f)}let{capturingGroups:l,hasNumberedRef:u,namedGroupsByName:c,subroutines:p}=r;if(u&&c.size&&!a.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(let{ref:f}of p)if(typeof f=="number"){if(f>l.length)throw new Error("Subroutine uses a group number that's not defined");f&&(l[f-1].isSubroutined=!0)}else if(c.has(f)){if(c.get(f).length>1)throw new Error(pe`Subroutine uses a duplicate group name "\g<${f}>"`);c.get(f)[0].isSubroutined=!0}else throw new Error(pe`Subroutine uses a group name that's not defined "\g<${f}>"`);return o}function Ah({kind:e}){return ps(pt({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[e],`Unexpected assertion kind "${e}"`),{negate:e===pe`\B`||e===pe`\Y`})}function Ph({raw:e},t){let a=/^\\k[<']/.test(e),n=a?e.slice(3,-1):e.slice(1),s=(r,o=!1)=>{let i=t.capturingGroups.length,l=!1;if(r>i)if(t.skipBackrefValidation)l=!0;else throw new Error(`Not enough capturing groups defined to the left "${e}"`);return t.hasNumberedRef=!0,cs(o?i+1-r:r,{orphan:l})};if(a){let r=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(n);if(r)return s(+r.groups.num,!!r.groups.sign);if(/[-+]/.test(n))throw new Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(n))throw new Error(`Group name not defined to the left "${e}"`);return cs(n)}return s(+n)}function Th(e,t,a){let{tokens:n,walk:s}=t,r=t.parent,o=r.body.at(-1),i=n[t.nextIndex];if(!a.isCheckingRangeEnd&&o&&o.type!=="CharacterClass"&&o.type!=="CharacterClassRange"&&i&&i.type!=="CharacterClassOpen"&&i.type!=="CharacterClassClose"&&i.type!=="CharacterClassIntersector"){let l=s(r,{...a,isCheckingRangeEnd:!0});if(o.type==="Character"&&l.type==="Character")return r.body.pop(),Nh(o,l);throw new Error("Invalid character class range")}return La(Lt("-"))}function Rh({negate:e},t,a){let{tokens:n,walk:s}=t,r=[cn()],o=n[t.nextIndex],i=Xu(o);for(;i.type!=="CharacterClassClose";){if(i.type==="CharacterClassIntersector")r.push(cn()),t.nextIndex++;else{let u=r.at(-1);u.body.push(s(u,a))}i=Xu(n[t.nextIndex],o)}let l=cn({negate:e});return r.length===1?l.body=r[0].body:(l.kind="intersection",l.body=r.map(u=>u.body.length===1?u.body[0]:u)),t.nextIndex++,l}function Eh({kind:e,negate:t,value:a},n){let{normalizeUnknownPropertyNames:s,skipPropertyNameValidation:r,unicodePropertyMap:o}=n;if(e==="property"){let i=ja(a);if(un.has(i)&&!o?.has(i))e="posix",a=i;else return Kt(a,{negate:t,normalizeUnknownPropertyNames:s,skipPropertyNameValidation:r,unicodePropertyMap:o})}return e==="posix"?zh(a,{negate:t}):ms(e,{negate:t})}function Mh(e,t,a){let{tokens:n,capturingGroups:s,namedGroupsByName:r,skipLookbehindValidation:o,walk:i}=t,l=Hh(e),u=l.type==="AbsenceFunction",c=Vu(l),p=c&&l.negate;if(l.type==="CapturingGroup"&&(s.push(l),l.name&&Ru(r,l.name,[]).push(l)),u&&a.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let f=Zu(n[t.nextIndex]);for(;f.type!=="GroupClose";){if(f.type==="Alternator")l.body.push(ft()),t.nextIndex++;else{let h=l.body.at(-1),g=i(h,{...a,isInAbsenceFunction:a.isInAbsenceFunction||u,isInLookbehind:a.isInLookbehind||c,isInNegLookbehind:a.isInNegLookbehind||p});if(h.body.push(g),(c||a.isInLookbehind)&&!o){let $="Lookbehind includes a pattern not allowed by Oniguruma";if(p||a.isInNegLookbehind){if(Wu(g)||g.type==="CapturingGroup")throw new Error($)}else if(Wu(g)||Vu(g)&&g.negate)throw new Error($)}}f=Zu(n[t.nextIndex])}return t.nextIndex++,l}function Bh({kind:e,min:t,max:a},n){let s=n.parent,r=s.body.at(-1);if(!r||!Hu(r))throw new Error("Quantifier requires a repeatable token");let o=Gr(e,t,a,r);return s.body.pop(),o}function qh({raw:e},t){let{capturingGroups:a,subroutines:n}=t,s=e.slice(3,-1),r=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s);if(r){let i=+r.groups.num,l=a.length;if(t.hasNumberedRef=!0,s={"":i,"+":l+i,"-":l+1-i}[r.groups.sign],s<1)throw new Error("Invalid subroutine number")}else s==="0"&&(s=0);let o=zr(s);return n.push(o),o}function Dh(e,t){if(e!=="repeater")throw new Error(`Unexpected absence function kind "${e}"`);return{type:"AbsenceFunction",kind:e,body:dn(t?.body)}}function ft(e){return{type:"Alternative",body:Ku(e?.body)}}function ps(e,t){let a={type:"Assertion",kind:e};return(e==="word_boundary"||e==="text_segment_boundary")&&(a.negate=!!t?.negate),a}function cs(e,t){let a=!!t?.orphan;return{type:"Backreference",ref:e,...a&&{orphan:a}}}function Fr(e,t){let a={name:void 0,isSubroutined:!1,...t};if(a.name!==void 0&&!Wh(a.name))throw new Error(`Group name "${a.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:e,...a.name&&{name:a.name},...a.isSubroutined&&{isSubroutined:a.isSubroutined},body:dn(t?.body)}}function La(e,t){let a={useLastValid:!1,...t};if(e>1114111){let n=e.toString(16);if(a.useLastValid)e=1114111;else throw e>1310719?new Error(`Invalid code point out of range "\\x{${n}}"`):new Error(`Invalid code point out of range in JS "\\x{${n}}"`)}return{type:"Character",value:e}}function cn(e){let t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:Ku(e?.body)}}function Nh(e,t){if(t.value<e.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:t}}function ms(e,t){let a=!!t?.negate,n={type:"CharacterSet",kind:e};return(e==="digit"||e==="hex"||e==="newline"||e==="space"||e==="word")&&(n.negate=a),(e==="text_segment"||e==="newline"&&!a)&&(n.variableLength=!0),n}function Oh(e,t={}){if(e==="keep")return{type:"Directive",kind:e};if(e==="flags")return{type:"Directive",kind:e,flags:pt(t.flags)};throw new Error(`Unexpected directive kind "${e}"`)}function Fh(e){return{type:"Flags",...e}}function Ne(e){let t=e?.atomic,a=e?.flags;if(t&&a)throw new Error("Atomic group cannot have flags");return{type:"Group",...t&&{atomic:t},...a&&{flags:a},body:dn(e?.body)}}function jt(e){let t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:dn(e?.body)}}function Gh(e,t,a){return{type:"NamedCallout",kind:e,tag:t,arguments:a}}function zh(e,t){let a=!!t?.negate;if(!un.has(e))throw new Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:a}}function Gr(e,t,a,n){if(t>a)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:a,body:n}}function Uh(e,t){return{type:"Regex",body:dn(t?.body),flags:e}}function zr(e){return{type:"Subroutine",ref:e}}function Kt(e,t){let a={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},n=a.unicodePropertyMap?.get(ja(e));if(!n){if(a.normalizeUnknownPropertyNames)n=Vh(e);else if(a.unicodePropertyMap&&!a.skipPropertyNameValidation)throw new Error(pe`Invalid Unicode property "\p{${e}}"`)}return{type:"CharacterSet",kind:"property",value:n??e,negate:a.negate}}function Hh({flags:e,kind:t,name:a,negate:n,number:s}){switch(t){case"absence_repeater":return Dh("repeater");case"atomic":return Ne({atomic:!0});case"capturing":return Fr(s,{name:a});case"group":return Ne({flags:e});case"lookahead":case"lookbehind":return jt({behind:t==="lookbehind",negate:n});default:throw new Error(`Unexpected group kind "${t}"`)}}function dn(e){if(e===void 0)e=[ft()];else if(!Array.isArray(e)||!e.length||!e.every(t=>t.type==="Alternative"))throw new Error("Invalid body; expected array of one or more Alternative nodes");return e}function Ku(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(t=>!!t.type))throw new Error("Invalid body; expected array of nodes");return e}function Wu(e){return e.type==="LookaroundAssertion"&&e.kind==="lookahead"}function Vu(e){return e.type==="LookaroundAssertion"&&e.kind==="lookbehind"}function Wh(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function Vh(e){return e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,t=>t[0].toUpperCase()+t.slice(1).toLowerCase())}function ja(e){return e.replace(/[- _]+/g,"").toLowerCase()}function Xu(e,t){let a=t;return pt(e,`Unclosed character class${a?.type==="Character"&&a.value===93&&a.raw==="]"?' (started with "]")':""}`)}function Zu(e){return pt(e,"Unclosed group")}function Jt(e,t,a=null){function n(r,o){for(let i=0;i<r.length;i++){let l=s(r[i],o,i,r);i=Math.max(-1,i+l)}}function s(r,o=null,i=null,l=null){let u=0,c=!1,p={node:r,parent:o,key:i,container:l,root:e,remove(){fs(l).splice(Math.max(0,va(i)+u),1),u--,c=!0},removeAllNextSiblings(){return fs(l).splice(va(i)+1)},removeAllPrevSiblings(){let L=va(i)+u;return u-=L,fs(l).splice(0,Math.max(0,L))},replaceWith(L,k={}){let w=!!k.traverse;l?l[Math.max(0,va(i)+u)]=L:pt(o,"Can't replace root node")[i]=L,w&&s(L,o,i,l),c=!0},replaceWithMultiple(L,k={}){let w=!!k.traverse;if(fs(l).splice(Math.max(0,va(i)+u),1,...L),u+=L.length-1,w){let R=0;for(let T=0;T<L.length;T++)R+=s(L[T],o,va(i)+T+R,l)}c=!0},skip(){c=!0}},{type:f}=r,h=t["*"],g=t[f],$=typeof h=="function"?h:h?.enter,j=typeof g=="function"?g:g?.enter;if($?.(p,a),j?.(p,a),!c)switch(f){case"AbsenceFunction":case"Alternative":case"CapturingGroup":case"CharacterClass":case"Group":case"LookaroundAssertion":n(r.body,r);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":s(r.min,r,"min"),s(r.max,r,"max");break;case"Quantifier":s(r.body,r,"body");break;case"Regex":n(r.body,r),s(r.flags,r,"flags");break;default:throw new Error(`Unexpected node type "${f}"`)}return g?.exit?.(p,a),h?.exit?.(p,a),u}return s(e),e}function fs(e){if(!Array.isArray(e))throw new Error("Container expected");return e}function va(e){if(typeof e!="number")throw new Error("Numeric key expected");return e}var Ju=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function Qu(e,t){for(let a=0;a<e.length;a++)e[a]>=t&&e[a]++}function Yu(e,t,a,n){return e.slice(0,t)+n+e.slice(t+a.length)}var Me=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function pn(e,t,a,n){let s=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),r=[!1],o=0,i="";for(let l of e.matchAll(s)){let{0:u,groups:{$skip:c}}=l;if(!c&&(!n||n===Me.DEFAULT==!o)){a instanceof Function?i+=a(l,{context:o?Me.CHAR_CLASS:Me.DEFAULT,negated:r[r.length-1]}):i+=a;continue}u[0]==="["?(o++,r.push(u[1]==="^")):u==="]"&&o&&(o--,r.pop()),i+=u}return i}function Ur(e,t,a,n){pn(e,t,a,n)}function Xh(e,t,a=0,n){if(!new RegExp(t,"su").test(e))return null;let s=new RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");s.lastIndex=a;let r=0,o;for(;o=s.exec(e);){let{0:i,groups:{$skip:l}}=o;if(!l&&(!n||n===Me.DEFAULT==!r))return o;i==="["?r++:i==="]"&&r&&r--,s.lastIndex==o.index&&s.lastIndex++}return null}function mn(e,t,a){return!!Xh(e,t,0,a)}function ec(e,t){let a=/\\?./gsu;a.lastIndex=t;let n=e.length,s=0,r=1,o;for(;o=a.exec(e);){let[i]=o;if(i==="[")s++;else if(s)i==="]"&&s--;else if(i==="(")r++;else if(i===")"&&(r--,!r)){n=o.index;break}}return e.slice(t,n)}var tc=new RegExp(String.raw`(?<noncapturingStart>${Ju})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function Wr(e,t){let a=t?.hiddenCaptures??[],n=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:n,hiddenCaptures:a};let s="(?>",r="(?:(?=(",o=[0],i=[],l=0,u=0,c=NaN,p;do{p=!1;let f=0,h=0,g=!1,$;for(tc.lastIndex=Number.isNaN(c)?0:c+r.length;$=tc.exec(e);){let{0:j,index:L,groups:{capturingStart:k,noncapturingStart:w}}=$;if(j==="[")f++;else if(f)j==="]"&&f--;else if(j===s&&!g)c=L,g=!0;else if(g&&w)h++;else if(k)g?h++:(l++,o.push(l+u));else if(j===")"&&g){if(!h){u++;let R=l+u;if(e=`${e.slice(0,c)}${r}${e.slice(c+s.length,L)}))<$$${R}>)${e.slice(L+1)}`,p=!0,i.push(R),Qu(a,R),n.size){let T=new Map;n.forEach((O,Q)=>{T.set(Q>=R?Q+1:Q,O.map(Y=>Y>=R?Y+1:Y))}),n=T}break}h--}}}while(p);return a.push(...i),e=pn(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:f,groups:{backrefNum:h,wrappedBackrefNum:g}})=>{if(h){let $=+h;if($>o.length-1)throw new Error(`Backref "${f}" greater than number of captures`);return`\\${o[$]}`}return`\\${g}`},Me.DEFAULT),{pattern:e,captureTransfers:n,hiddenCaptures:a}}var ac=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Hr=new RegExp(String.raw`
|
|
118
|
+
`,n);return{lastIndex:o===-1?t.length:o}}if(/^\s$/.test(a)){let o=/\s+/y;return o.lastIndex=n,{lastIndex:o.exec(t)?o.lastIndex:n}}}if(a===".")return{token:Zt("dot",a)};if(a==="^"||a==="$"){let o=e.singleline?{"^":pe`\A`,$:pe`\Z`}[a]:a;return{token:Eu(o,a)}}return a==="|"?{token:ch(a)}:Or.test(a)?{tokens:Sh(a)}:{token:mt(Lt(a),a)}}function lh(e,t,a){let n=[Mu(t[1]==="^",t)],s=1,r;for(Nr.lastIndex=a;r=Nr.exec(e);){let o=r[0];if(o[0]==="["&&o[1]!==":")s++,n.push(Mu(o[1]==="^",o));else if(o==="]"){if(n.at(-1).type==="CharacterClassOpen")n.push(mt(93,o));else if(s--,n.push(dh(o)),!s)break}else{let i=uh(o);Array.isArray(i)?n.push(...i):n.push(i)}}return{tokens:n,lastIndex:Nr.lastIndex||e.length}}function uh(e){if(e[0]==="\\")return Gu(e,{inCharClass:!0});if(e[0]==="["){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!un.has(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return Zt("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return e==="-"?ph(e):e==="&&"?mh(e):mt(Lt(e),e)}function Gu(e,{inCharClass:t}){let a=e[1];if(a==="c"||a==="C")return _h(e);if("dDhHsSwW".includes(a))return $h(e);if(e.startsWith(pe`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw new Error(`Incomplete or invalid Unicode property "${e}"`);return Ch(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let n=e.split(/\\x/).slice(1).map(o=>parseInt(o,16)),s=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(n)),r=new TextEncoder;return[...s].map(o=>{let i=[...r.encode(o)].map(l=>`\\x${l.toString(16)}`).join("");return mt(Lt(o),i)})}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(a==="u"||a==="x")return mt(jh(e),e);if(Bu.has(a))return mt(Bu.get(a),e);if(/\d/.test(a))return fh(t,e);if(e==="\\")throw new Error(pe`Incomplete escape "\"`);if(a==="M")throw new Error(`Unsupported meta "${e}"`);if([...e].length===2)return mt(e.codePointAt(1),e);throw new Error(`Unexpected escape "${e}"`)}function ch(e){return{type:"Alternator",raw:e}}function Eu(e,t){return{type:"Assertion",kind:e,raw:t}}function zu(e){return{type:"Backreference",raw:e}}function mt(e,t){return{type:"Character",value:e,raw:t}}function dh(e){return{type:"CharacterClassClose",raw:e}}function ph(e){return{type:"CharacterClassHyphen",raw:e}}function mh(e){return{type:"CharacterClassIntersector",raw:e}}function Mu(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function Zt(e,t,a={}){return{type:"CharacterSet",kind:e,...a,raw:t}}function Uu(e,t,a={}){return e==="keep"?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:pt(a.flags),raw:t}}function fh(e,t){return{type:"EscapedNumber",inCharClass:e,raw:t}}function gh(e){return{type:"GroupClose",raw:e}}function Ca(e,t,a={}){return{type:"GroupOpen",kind:e,...a,raw:t}}function hh(e,t,a,n){return{type:"NamedCallout",kind:e,tag:t,arguments:a,raw:n}}function bh(e,t,a,n){return{type:"Quantifier",kind:e,min:t,max:a,raw:n}}function yh(e){return{type:"Subroutine",raw:e}}var xh=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),Bu=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function _h(e){let t=e[1]==="c"?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw new Error(`Unsupported control character "${e}"`);return mt(Lt(t.toUpperCase())-64,e)}function kh(e,t){let{on:a,off:n}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;n??="";let s=(t.getCurrentModX()||a.includes("x"))&&!n.includes("x"),r=Du(a),o=Du(n),i={};if(r&&(i.enable=r),o&&(i.disable=o),e.endsWith(")"))return t.replaceCurrentModX(s),Uu("flags",e,{flags:i});if(e.endsWith(":"))return t.pushModX(s),t.numOpenGroups++,Ca("group",e,{...(r||o)&&{flags:i}});throw new Error(`Unexpected flag modifier "${e}"`)}function wh(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw new Error(`Incomplete or invalid named callout "${e}"`);let{name:a,tag:n,args:s}=t.groups;if(!a)throw new Error(`Invalid named callout "${e}"`);if(n==="")throw new Error(`Named callout tag with empty value not allowed "${e}"`);let r=s?s.split(",").filter(c=>c!=="").map(c=>/^[+-]?\d+$/.test(c)?+c:c):[],[o,i,l]=r,u=xh.has(a)?a.toLowerCase():"custom";switch(u){case"fail":case"mismatch":case"skip":if(r.length>0)throw new Error(`Named callout arguments not allowed "${r}"`);break;case"error":if(r.length>1)throw new Error(`Named callout allows only one argument "${r}"`);if(typeof o=="string")throw new Error(`Named callout argument must be a number "${o}"`);break;case"max":if(!r.length||r.length>2)throw new Error(`Named callout must have one or two arguments "${r}"`);if(typeof o=="string"&&!/^[A-Za-z_]\w*$/.test(o))throw new Error(`Named callout argument one must be a tag or number "${o}"`);if(r.length===2&&(typeof i=="number"||!/^[<>X]$/.test(i)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${i}"`);break;case"count":case"total_count":if(r.length>1)throw new Error(`Named callout allows only one argument "${r}"`);if(r.length===1&&(typeof o=="number"||!/^[<>X]$/.test(o)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case"cmp":if(r.length!==3)throw new Error(`Named callout must have three arguments "${r}"`);if(typeof o=="string"&&!/^[A-Za-z_]\w*$/.test(o))throw new Error(`Named callout argument one must be a tag or number "${o}"`);if(typeof i=="number"||!/^(?:[<>!=]=|[<>])$/.test(i))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${i}"`);if(typeof l=="string"&&!/^[A-Za-z_]\w*$/.test(l))throw new Error(`Named callout argument three must be a tag or number "${l}"`);break;case"custom":throw new Error(`Undefined callout name "${a}"`);default:throw new Error(`Unexpected named callout kind "${u}"`)}return hh(u,n??null,s?.split(",")??null,e)}function qu(e){let t=null,a,n;if(e[0]==="{"){let{minStr:s,maxStr:r}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+s>o||r&&+r>o)throw new Error("Quantifier value unsupported in Oniguruma");if(a=+s,n=r===void 0?+s:r===""?1/0:+r,a>n&&(t="possessive",[a,n]=[n,a]),e.endsWith("?")){if(t==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');t="lazy"}else t||(t="greedy")}else a=e[0]==="+"?1:0,n=e[0]==="?"?1:1/0,t=e[1]==="+"?"possessive":e[1]==="?"?"lazy":"greedy";return bh(t,a,n,e)}function $h(e){let t=e[1].toLowerCase();return Zt({d:"digit",h:"hex",s:"space",w:"word"}[t],e,{negate:e[1]!==t})}function Ch(e){let{p:t,neg:a,value:n}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return Zt("property",e,{value:n,negate:t==="P"&&!a||t==="p"&&!!a})}function Du(e){let t={};return e.includes("i")&&(t.ignoreCase=!0),e.includes("m")&&(t.dotAll=!0),e.includes("x")&&(t.extended=!0),Object.keys(t).length?t:null}function Lh(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let a=0;a<e.length;a++){let n=e[a];if(!"imxDPSWy".includes(n))throw new Error(`Invalid flag "${n}"`);if(n==="y"){if(!/^y{[gw]}/.test(e.slice(a)))throw new Error('Invalid or unspecified flag "y" mode');t.textSegmentMode=e[a+2]==="g"?"grapheme":"word",a+=3;continue}t[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[n]]=!0}return t}function jh(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw new Error(`Incomplete or invalid escape "${e}"`);let t=e[2]==="{"?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function vh(e,t){let{raw:a,inCharClass:n}=e,s=a.slice(1);if(!n&&(s!=="0"&&s.length===1||s[0]!=="0"&&+s<=t))return[zu(a)];let r=[],o=s.match(/^[0-7]+|\d/g);for(let i=0;i<o.length;i++){let l=o[i],u;if(i===0&&l!=="8"&&l!=="9"){if(u=parseInt(l,8),u>127)throw new Error(pe`Octal encoded byte above 177 unsupported "${a}"`)}else u=Lt(l);r.push(mt(u,(i===0?"\\":"")+l))}return r}function Sh(e){let t=[],a=new RegExp(Or,"gy"),n;for(;n=a.exec(e);){let s=n[0];if(s[0]==="{"){let r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(s);if(r){let{min:o,max:i}=r.groups;if(+o>+i&&s.endsWith("?")){a.lastIndex--,t.push(qu(s.slice(0,-1)));continue}}}t.push(qu(s))}return t}function us(e,t){if(!Array.isArray(e.body))throw new Error("Expected node with body array");if(e.body.length!==1)return!1;let a=e.body[0];return!t||Object.keys(t).every(n=>t[n]===a[n])}function Hu(e){return Ih.has(e.type)}var Ih=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function ds(e,t={}){let a={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},n=Fu(e,{flags:a.flags,rules:{captureGroup:a.rules.captureGroup,singleline:a.rules.singleline}}),s=(f,g)=>{let h=n.tokens[r.nextIndex];switch(r.parent=f,r.nextIndex++,h.type){case"Alternator":return ft();case"Assertion":return Ah(h);case"Backreference":return Ph(h,r);case"Character":return La(h.value,{useLastValid:!!g.isCheckingRangeEnd});case"CharacterClassHyphen":return Th(h,r,g);case"CharacterClassOpen":return Rh(h,r,g);case"CharacterSet":return Eh(h,r);case"Directive":return Oh(h.kind,{flags:h.flags});case"GroupOpen":return Mh(h,r,g);case"NamedCallout":return Gh(h.kind,h.tag,h.arguments);case"Quantifier":return Bh(h,r);case"Subroutine":return qh(h,r);default:throw new Error(`Unexpected token type "${h.type}"`)}},r={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:a.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:a.skipBackrefValidation,skipLookbehindValidation:a.skipLookbehindValidation,skipPropertyNameValidation:a.skipPropertyNameValidation,subroutines:[],tokens:n.tokens,unicodePropertyMap:a.unicodePropertyMap,walk:s},o=Uh(Fh(n.flags)),i=o.body[0];for(;r.nextIndex<n.tokens.length;){let f=s(i,{});f.type==="Alternative"?(o.body.push(f),i=f):i.body.push(f)}let{capturingGroups:l,hasNumberedRef:u,namedGroupsByName:c,subroutines:p}=r;if(u&&c.size&&!a.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(let{ref:f}of p)if(typeof f=="number"){if(f>l.length)throw new Error("Subroutine uses a group number that's not defined");f&&(l[f-1].isSubroutined=!0)}else if(c.has(f)){if(c.get(f).length>1)throw new Error(pe`Subroutine uses a duplicate group name "\g<${f}>"`);c.get(f)[0].isSubroutined=!0}else throw new Error(pe`Subroutine uses a group name that's not defined "\g<${f}>"`);return o}function Ah({kind:e}){return ps(pt({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[e],`Unexpected assertion kind "${e}"`),{negate:e===pe`\B`||e===pe`\Y`})}function Ph({raw:e},t){let a=/^\\k[<']/.test(e),n=a?e.slice(3,-1):e.slice(1),s=(r,o=!1)=>{let i=t.capturingGroups.length,l=!1;if(r>i)if(t.skipBackrefValidation)l=!0;else throw new Error(`Not enough capturing groups defined to the left "${e}"`);return t.hasNumberedRef=!0,cs(o?i+1-r:r,{orphan:l})};if(a){let r=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(n);if(r)return s(+r.groups.num,!!r.groups.sign);if(/[-+]/.test(n))throw new Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(n))throw new Error(`Group name not defined to the left "${e}"`);return cs(n)}return s(+n)}function Th(e,t,a){let{tokens:n,walk:s}=t,r=t.parent,o=r.body.at(-1),i=n[t.nextIndex];if(!a.isCheckingRangeEnd&&o&&o.type!=="CharacterClass"&&o.type!=="CharacterClassRange"&&i&&i.type!=="CharacterClassOpen"&&i.type!=="CharacterClassClose"&&i.type!=="CharacterClassIntersector"){let l=s(r,{...a,isCheckingRangeEnd:!0});if(o.type==="Character"&&l.type==="Character")return r.body.pop(),Nh(o,l);throw new Error("Invalid character class range")}return La(Lt("-"))}function Rh({negate:e},t,a){let{tokens:n,walk:s}=t,r=[cn()],o=n[t.nextIndex],i=Xu(o);for(;i.type!=="CharacterClassClose";){if(i.type==="CharacterClassIntersector")r.push(cn()),t.nextIndex++;else{let u=r.at(-1);u.body.push(s(u,a))}i=Xu(n[t.nextIndex],o)}let l=cn({negate:e});return r.length===1?l.body=r[0].body:(l.kind="intersection",l.body=r.map(u=>u.body.length===1?u.body[0]:u)),t.nextIndex++,l}function Eh({kind:e,negate:t,value:a},n){let{normalizeUnknownPropertyNames:s,skipPropertyNameValidation:r,unicodePropertyMap:o}=n;if(e==="property"){let i=ja(a);if(un.has(i)&&!o?.has(i))e="posix",a=i;else return Kt(a,{negate:t,normalizeUnknownPropertyNames:s,skipPropertyNameValidation:r,unicodePropertyMap:o})}return e==="posix"?zh(a,{negate:t}):ms(e,{negate:t})}function Mh(e,t,a){let{tokens:n,capturingGroups:s,namedGroupsByName:r,skipLookbehindValidation:o,walk:i}=t,l=Hh(e),u=l.type==="AbsenceFunction",c=Vu(l),p=c&&l.negate;if(l.type==="CapturingGroup"&&(s.push(l),l.name&&Ru(r,l.name,[]).push(l)),u&&a.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let f=Zu(n[t.nextIndex]);for(;f.type!=="GroupClose";){if(f.type==="Alternator")l.body.push(ft()),t.nextIndex++;else{let g=l.body.at(-1),h=i(g,{...a,isInAbsenceFunction:a.isInAbsenceFunction||u,isInLookbehind:a.isInLookbehind||c,isInNegLookbehind:a.isInNegLookbehind||p});if(g.body.push(h),(c||a.isInLookbehind)&&!o){let w="Lookbehind includes a pattern not allowed by Oniguruma";if(p||a.isInNegLookbehind){if(Wu(h)||h.type==="CapturingGroup")throw new Error(w)}else if(Wu(h)||Vu(h)&&h.negate)throw new Error(w)}}f=Zu(n[t.nextIndex])}return t.nextIndex++,l}function Bh({kind:e,min:t,max:a},n){let s=n.parent,r=s.body.at(-1);if(!r||!Hu(r))throw new Error("Quantifier requires a repeatable token");let o=Gr(e,t,a,r);return s.body.pop(),o}function qh({raw:e},t){let{capturingGroups:a,subroutines:n}=t,s=e.slice(3,-1),r=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s);if(r){let i=+r.groups.num,l=a.length;if(t.hasNumberedRef=!0,s={"":i,"+":l+i,"-":l+1-i}[r.groups.sign],s<1)throw new Error("Invalid subroutine number")}else s==="0"&&(s=0);let o=zr(s);return n.push(o),o}function Dh(e,t){if(e!=="repeater")throw new Error(`Unexpected absence function kind "${e}"`);return{type:"AbsenceFunction",kind:e,body:dn(t?.body)}}function ft(e){return{type:"Alternative",body:Ku(e?.body)}}function ps(e,t){let a={type:"Assertion",kind:e};return(e==="word_boundary"||e==="text_segment_boundary")&&(a.negate=!!t?.negate),a}function cs(e,t){let a=!!t?.orphan;return{type:"Backreference",ref:e,...a&&{orphan:a}}}function Fr(e,t){let a={name:void 0,isSubroutined:!1,...t};if(a.name!==void 0&&!Wh(a.name))throw new Error(`Group name "${a.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:e,...a.name&&{name:a.name},...a.isSubroutined&&{isSubroutined:a.isSubroutined},body:dn(t?.body)}}function La(e,t){let a={useLastValid:!1,...t};if(e>1114111){let n=e.toString(16);if(a.useLastValid)e=1114111;else throw e>1310719?new Error(`Invalid code point out of range "\\x{${n}}"`):new Error(`Invalid code point out of range in JS "\\x{${n}}"`)}return{type:"Character",value:e}}function cn(e){let t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:Ku(e?.body)}}function Nh(e,t){if(t.value<e.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:t}}function ms(e,t){let a=!!t?.negate,n={type:"CharacterSet",kind:e};return(e==="digit"||e==="hex"||e==="newline"||e==="space"||e==="word")&&(n.negate=a),(e==="text_segment"||e==="newline"&&!a)&&(n.variableLength=!0),n}function Oh(e,t={}){if(e==="keep")return{type:"Directive",kind:e};if(e==="flags")return{type:"Directive",kind:e,flags:pt(t.flags)};throw new Error(`Unexpected directive kind "${e}"`)}function Fh(e){return{type:"Flags",...e}}function Ne(e){let t=e?.atomic,a=e?.flags;if(t&&a)throw new Error("Atomic group cannot have flags");return{type:"Group",...t&&{atomic:t},...a&&{flags:a},body:dn(e?.body)}}function jt(e){let t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:dn(e?.body)}}function Gh(e,t,a){return{type:"NamedCallout",kind:e,tag:t,arguments:a}}function zh(e,t){let a=!!t?.negate;if(!un.has(e))throw new Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:a}}function Gr(e,t,a,n){if(t>a)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:a,body:n}}function Uh(e,t){return{type:"Regex",body:dn(t?.body),flags:e}}function zr(e){return{type:"Subroutine",ref:e}}function Kt(e,t){let a={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},n=a.unicodePropertyMap?.get(ja(e));if(!n){if(a.normalizeUnknownPropertyNames)n=Vh(e);else if(a.unicodePropertyMap&&!a.skipPropertyNameValidation)throw new Error(pe`Invalid Unicode property "\p{${e}}"`)}return{type:"CharacterSet",kind:"property",value:n??e,negate:a.negate}}function Hh({flags:e,kind:t,name:a,negate:n,number:s}){switch(t){case"absence_repeater":return Dh("repeater");case"atomic":return Ne({atomic:!0});case"capturing":return Fr(s,{name:a});case"group":return Ne({flags:e});case"lookahead":case"lookbehind":return jt({behind:t==="lookbehind",negate:n});default:throw new Error(`Unexpected group kind "${t}"`)}}function dn(e){if(e===void 0)e=[ft()];else if(!Array.isArray(e)||!e.length||!e.every(t=>t.type==="Alternative"))throw new Error("Invalid body; expected array of one or more Alternative nodes");return e}function Ku(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(t=>!!t.type))throw new Error("Invalid body; expected array of nodes");return e}function Wu(e){return e.type==="LookaroundAssertion"&&e.kind==="lookahead"}function Vu(e){return e.type==="LookaroundAssertion"&&e.kind==="lookbehind"}function Wh(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function Vh(e){return e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,t=>t[0].toUpperCase()+t.slice(1).toLowerCase())}function ja(e){return e.replace(/[- _]+/g,"").toLowerCase()}function Xu(e,t){let a=t;return pt(e,`Unclosed character class${a?.type==="Character"&&a.value===93&&a.raw==="]"?' (started with "]")':""}`)}function Zu(e){return pt(e,"Unclosed group")}function Jt(e,t,a=null){function n(r,o){for(let i=0;i<r.length;i++){let l=s(r[i],o,i,r);i=Math.max(-1,i+l)}}function s(r,o=null,i=null,l=null){let u=0,c=!1,p={node:r,parent:o,key:i,container:l,root:e,remove(){fs(l).splice(Math.max(0,va(i)+u),1),u--,c=!0},removeAllNextSiblings(){return fs(l).splice(va(i)+1)},removeAllPrevSiblings(){let L=va(i)+u;return u-=L,fs(l).splice(0,Math.max(0,L))},replaceWith(L,k={}){let $=!!k.traverse;l?l[Math.max(0,va(i)+u)]=L:pt(o,"Can't replace root node")[i]=L,$&&s(L,o,i,l),c=!0},replaceWithMultiple(L,k={}){let $=!!k.traverse;if(fs(l).splice(Math.max(0,va(i)+u),1,...L),u+=L.length-1,$){let R=0;for(let T=0;T<L.length;T++)R+=s(L[T],o,va(i)+T+R,l)}c=!0},skip(){c=!0}},{type:f}=r,g=t["*"],h=t[f],w=typeof g=="function"?g:g?.enter,j=typeof h=="function"?h:h?.enter;if(w?.(p,a),j?.(p,a),!c)switch(f){case"AbsenceFunction":case"Alternative":case"CapturingGroup":case"CharacterClass":case"Group":case"LookaroundAssertion":n(r.body,r);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":s(r.min,r,"min"),s(r.max,r,"max");break;case"Quantifier":s(r.body,r,"body");break;case"Regex":n(r.body,r),s(r.flags,r,"flags");break;default:throw new Error(`Unexpected node type "${f}"`)}return h?.exit?.(p,a),g?.exit?.(p,a),u}return s(e),e}function fs(e){if(!Array.isArray(e))throw new Error("Container expected");return e}function va(e){if(typeof e!="number")throw new Error("Numeric key expected");return e}var Ju=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function Qu(e,t){for(let a=0;a<e.length;a++)e[a]>=t&&e[a]++}function Yu(e,t,a,n){return e.slice(0,t)+n+e.slice(t+a.length)}var Me=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function pn(e,t,a,n){let s=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),r=[!1],o=0,i="";for(let l of e.matchAll(s)){let{0:u,groups:{$skip:c}}=l;if(!c&&(!n||n===Me.DEFAULT==!o)){a instanceof Function?i+=a(l,{context:o?Me.CHAR_CLASS:Me.DEFAULT,negated:r[r.length-1]}):i+=a;continue}u[0]==="["?(o++,r.push(u[1]==="^")):u==="]"&&o&&(o--,r.pop()),i+=u}return i}function Ur(e,t,a,n){pn(e,t,a,n)}function Xh(e,t,a=0,n){if(!new RegExp(t,"su").test(e))return null;let s=new RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");s.lastIndex=a;let r=0,o;for(;o=s.exec(e);){let{0:i,groups:{$skip:l}}=o;if(!l&&(!n||n===Me.DEFAULT==!r))return o;i==="["?r++:i==="]"&&r&&r--,s.lastIndex==o.index&&s.lastIndex++}return null}function mn(e,t,a){return!!Xh(e,t,0,a)}function ec(e,t){let a=/\\?./gsu;a.lastIndex=t;let n=e.length,s=0,r=1,o;for(;o=a.exec(e);){let[i]=o;if(i==="[")s++;else if(s)i==="]"&&s--;else if(i==="(")r++;else if(i===")"&&(r--,!r)){n=o.index;break}}return e.slice(t,n)}var tc=new RegExp(String.raw`(?<noncapturingStart>${Ju})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function Wr(e,t){let a=t?.hiddenCaptures??[],n=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:n,hiddenCaptures:a};let s="(?>",r="(?:(?=(",o=[0],i=[],l=0,u=0,c=NaN,p;do{p=!1;let f=0,g=0,h=!1,w;for(tc.lastIndex=Number.isNaN(c)?0:c+r.length;w=tc.exec(e);){let{0:j,index:L,groups:{capturingStart:k,noncapturingStart:$}}=w;if(j==="[")f++;else if(f)j==="]"&&f--;else if(j===s&&!h)c=L,h=!0;else if(h&&$)g++;else if(k)h?g++:(l++,o.push(l+u));else if(j===")"&&h){if(!g){u++;let R=l+u;if(e=`${e.slice(0,c)}${r}${e.slice(c+s.length,L)}))<$$${R}>)${e.slice(L+1)}`,p=!0,i.push(R),Qu(a,R),n.size){let T=new Map;n.forEach((O,Q)=>{T.set(Q>=R?Q+1:Q,O.map(Y=>Y>=R?Y+1:Y))}),n=T}break}g--}}}while(p);return a.push(...i),e=pn(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:f,groups:{backrefNum:g,wrappedBackrefNum:h}})=>{if(g){let w=+g;if(w>o.length-1)throw new Error(`Backref "${f}" greater than number of captures`);return`\\${o[w]}`}return`\\${h}`},Me.DEFAULT),{pattern:e,captureTransfers:n,hiddenCaptures:a}}var ac=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Hr=new RegExp(String.raw`
|
|
119
119
|
\\(?: \d+
|
|
120
120
|
| c[A-Za-z]
|
|
121
121
|
| [gk]<[^>]+>
|
|
@@ -130,7 +130,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
130
130
|
))?
|
|
131
131
|
| (?<qBase>${ac})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
132
132
|
| \\?.
|
|
133
|
-
`.replace(/\s+/g,""),"gsu");function Vr(e){if(!new RegExp(`${ac}\\+`).test(e))return{pattern:e};let t=[],a=null,n=null,s="",r=0,o;for(Hr.lastIndex=0;o=Hr.exec(e);){let{0:i,index:l,groups:{qBase:u,qMod:c,invalidQ:p}}=o;if(i==="[")r||(n=l),r++;else if(i==="]")r?r--:n=null;else if(!r)if(c==="+"&&s&&!s.startsWith("(")){if(p)throw new Error(`Invalid quantifier "${i}"`);let f=-1;if(/^\{\d+\}$/.test(u))e=Yu(e,l+u.length,c,"");else{if(s===")"||s==="]"){let
|
|
133
|
+
`.replace(/\s+/g,""),"gsu");function Vr(e){if(!new RegExp(`${ac}\\+`).test(e))return{pattern:e};let t=[],a=null,n=null,s="",r=0,o;for(Hr.lastIndex=0;o=Hr.exec(e);){let{0:i,index:l,groups:{qBase:u,qMod:c,invalidQ:p}}=o;if(i==="[")r||(n=l),r++;else if(i==="]")r?r--:n=null;else if(!r)if(c==="+"&&s&&!s.startsWith("(")){if(p)throw new Error(`Invalid quantifier "${i}"`);let f=-1;if(/^\{\d+\}$/.test(u))e=Yu(e,l+u.length,c,"");else{if(s===")"||s==="]"){let g=s===")"?a:n;if(g===null)throw new Error(`Invalid unmatched "${s}"`);e=`${e.slice(0,g)}(?>${e.slice(g,l)}${u})${e.slice(l+i.length)}`}else e=`${e.slice(0,l-s.length)}(?>${s}${u})${e.slice(l+i.length)}`;f+=4}Hr.lastIndex+=f}else i[0]==="("?t.push(l):i===")"&&(a=t.length?t.pop():null);s=i}return{pattern:e}}var He=String.raw,Zh=He`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,Zr=He`\(\?R=(?<rDepth>[^\)]+)\)|${Zh}`,gs=He`\(\?<(?![=!])(?<captureName>[^>]+)>`,ic=He`${gs}|(?<unnamed>\()(?!\?)`,Qt=new RegExp(He`${gs}|${Zr}|\(\?|\\?.`,"gsu"),Xr="Cannot use multiple overlapping recursions";function lc(e,t){let{hiddenCaptures:a,mode:n}={hiddenCaptures:[],mode:"plugin",...t},s=t?.captureTransfers??new Map;if(!new RegExp(Zr,"su").test(e))return{pattern:e,captureTransfers:s,hiddenCaptures:a};if(n==="plugin"&&mn(e,He`\(\?\(DEFINE\)`,Me.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");let r=[],o=mn(e,He`\\[1-9]`,Me.DEFAULT),i=new Map,l=[],u=!1,c=0,p=0,f;for(Qt.lastIndex=0;f=Qt.exec(e);){let{0:g,groups:{captureName:h,rDepth:w,gRNameOrNum:j,gRDepth:L}}=f;if(g==="[")c++;else if(c)g==="]"&&c--;else if(w){if(nc(w),u)throw new Error(Xr);if(o)throw new Error(`${n==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);let k=e.slice(0,f.index),$=e.slice(Qt.lastIndex);if(mn($,Zr,Me.DEFAULT))throw new Error(Xr);let R=+w-1;e=sc(k,$,R,!1,a,r,p),s=oc(s,k,R,r.length,0,p);break}else if(j){nc(L);let k=!1;for(let oe of l)if(oe.name===j||oe.num===+j){if(k=!0,oe.hasRecursedWithin)throw new Error(Xr);break}if(!k)throw new Error(He`Recursive \g cannot be used outside the referenced group "${n==="external"?j:He`\g<${j}&R=${L}>`}"`);let $=i.get(j),R=ec(e,$);if(o&&mn(R,He`${gs}|\((?!\?)`,Me.DEFAULT))throw new Error(`${n==="external"?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);let T=e.slice($,f.index),O=R.slice(T.length+g.length),Q=r.length,Y=+L-1,Oe=sc(T,O,Y,!0,a,r,p);s=oc(s,T,Y,r.length-Q,Q,p);let ee=e.slice(0,$),xe=e.slice($+R.length);e=`${ee}${Oe}${xe}`,Qt.lastIndex+=Oe.length-g.length-T.length-O.length,l.forEach(oe=>oe.hasRecursedWithin=!0),u=!0}else if(h)p++,i.set(String(p),Qt.lastIndex),i.set(h,Qt.lastIndex),l.push({num:p,name:h});else if(g[0]==="("){let k=g==="(";k&&(p++,i.set(String(p),Qt.lastIndex)),l.push(k?{num:p}:{})}else g===")"&&l.pop()}return a.push(...r),{pattern:e,captureTransfers:s,hiddenCaptures:a}}function nc(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e))throw new Error(t);if(e=+e,e<2||e>100)throw new Error(t)}function sc(e,t,a,n,s,r,o){let i=new Set;n&&Ur(e+t,gs,({groups:{captureName:u}})=>{i.add(u)},Me.DEFAULT);let l=[a,n?i:null,s,r,o];return`${e}${rc(`(?:${e}`,"forward",...l)}(?:)${rc(`${t})`,"backward",...l)}${t}`}function rc(e,t,a,n,s,r,o){let l=c=>t==="forward"?c+2:a-c+2-1,u="";for(let c=0;c<a;c++){let p=l(c);u+=pn(e,He`${ic}|\\k<(?<backref>[^>]+)>`,({0:f,groups:{captureName:g,unnamed:h,backref:w}})=>{if(w&&n&&!n.has(w))return f;let j=`_$${p}`;if(h||g){let L=o+r.length+1;return r.push(L),Kh(s,L),h?f:`(?<${g}${j}>`}return He`\k<${w}${j}>`},Me.DEFAULT)}return u}function Kh(e,t){for(let a=0;a<e.length;a++)e[a]>=t&&e[a]++}function oc(e,t,a,n,s,r){if(e.size&&n){let o=0;Ur(t,ic,()=>o++,Me.DEFAULT);let i=r-o+s,l=new Map;return e.forEach((u,c)=>{let p=(n-o*a)/a,f=o*a,g=c>i+o?c+n:c,h=[];for(let w of u)if(w<=i)h.push(w);else if(w>i+o+p)h.push(w+n);else if(w<=i+o)for(let j=0;j<=a;j++)h.push(w+o*j);else for(let j=0;j<=a;j++)h.push(w+f+p*j);l.set(g,h)}),l}return e}var fe=String.fromCodePoint,F=String.raw,Ze={},bs=globalThis.RegExp;Ze.flagGroups=(()=>{try{new bs("(?i:)")}catch{return!1}return!0})();Ze.unicodeSets=(()=>{try{new bs("[[]]","v")}catch{return!1}return!0})();Ze.bugFlagVLiteralHyphenIsRange=Ze.unicodeSets?(()=>{try{new bs(F`[\d\-a]`,"v")}catch{return!0}return!1})():!1;Ze.bugNestedClassIgnoresNegation=Ze.unicodeSets&&new bs("[[^a]]","v").test("a");function hs(e,{enable:t,disable:a}){return{dotAll:!a?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!a?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function fn(e,t,a){return e.has(t)||e.set(t,a),e.get(t)}function eo(e,t){return uc[e]>=uc[t]}function Jh(e,t){if(e==null)throw new Error(t??"Value expected");return e}var uc={ES2025:2025,ES2024:2024,ES2018:2018},Qh={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function fc(e={}){if({}.toString.call(e)!=="[object Object]")throw new Error("Unexpected options");if(e.target!==void 0&&!Qh[e.target])throw new Error(`Unexpected target "${e.target}"`);let t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target==="auto"&&(t.target=Ze.flagGroups?"ES2025":Ze.unicodeSets?"ES2024":"ES2018"),t}var Yh="[ -\r ]",eb=new Set([fe(304),fe(305)]),gt=F`[\p{L}\p{M}\p{N}\p{Pc}]`;function gc(e){if(eb.has(e))return[e];let t=new Set,a=e.toLowerCase(),n=a.toUpperCase(),s=nb.get(a),r=tb.get(a),o=ab.get(a);return[...n].length===1&&t.add(n),o&&t.add(o),s&&t.add(s),t.add(a),r&&t.add(r),[...t]}var ao=new Map(`C Other
|
|
134
134
|
Cc Control cntrl
|
|
135
135
|
Cf Format
|
|
136
136
|
Cn Unassigned
|
|
@@ -220,11 +220,11 @@ Uppercase Upper
|
|
|
220
220
|
Variation_Selector VS
|
|
221
221
|
White_Space space
|
|
222
222
|
XID_Continue XIDC
|
|
223
|
-
XID_Start XIDS`.split(/\s/).map(e=>[ja(e),e])),tb=new Map([["s",fe(383)],[fe(383),"s"]]),ab=new Map([[fe(223),fe(7838)],[fe(107),fe(8490)],[fe(229),fe(8491)],[fe(969),fe(8486)]]),nb=new Map([vt(453),vt(456),vt(459),vt(498),...Kr(8072,8079),...Kr(8088,8095),...Kr(8104,8111),vt(8124),vt(8140),vt(8188)]),sb=new Map([["alnum",F`[\p{Alpha}\p{Nd}]`],["alpha",F`\p{Alpha}`],["ascii",F`\p{ASCII}`],["blank",F`[\p{Zs}\t]`],["cntrl",F`\p{Cc}`],["digit",F`\p{Nd}`],["graph",F`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",F`\p{Lower}`],["print",F`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",F`[\p{P}\p{S}]`],["space",F`\p{space}`],["upper",F`\p{Upper}`],["word",F`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",F`\p{AHex}`]]);function rb(e,t){let a=[];for(let n=e;n<=t;n++)a.push(n);return a}function vt(e){let t=fe(e);return[t.toLowerCase(),t]}function Kr(e,t){return rb(e,t).map(a=>vt(a))}var hc=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function ob(e,t){let a={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t};bc(e);let n={accuracy:a.accuracy,asciiWordBoundaries:a.asciiWordBoundaries,avoidSubclass:a.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:eo(a.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};Jt(e,ib,n);let s={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},r={currentFlags:s,prevFlags:null,globalFlags:s,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:n.subroutineRefMap};Jt(e,lb,r);let o={groupsByName:r.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:r.reffedNodesByReferencer};return Jt(e,ub,o),e._originMap=r.groupOriginByCopy,e._strategy=n.strategy,e}var ib={AbsenceFunction({node:e,parent:t,replaceWith:a}){let{body:n,kind:s}=e;if(s==="repeater"){let r=Ne();r.body[0].body.push(jt({negate:!0,body:n}),Kt("Any"));let o=Ne();o.body[0].body.push(Gr("greedy",0,1/0,r)),a(ue(o,t),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:e,parent:t,key:a},{flagDirectivesByAlt:n}){let s=e.body.filter(r=>r.kind==="flags");for(let r=a+1;r<t.body.length;r++){let o=t.body[r];fn(n,o,[]).push(...s)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let a=xc(t.get(e));if(a){let n=Ne({flags:a});n.body[0].body=e.body,e.body=[ue(n,e)]}}}},Assertion({node:e,parent:t,key:a,container:n,root:s,remove:r,replaceWith:o},i){let{kind:l,negate:u}=e,{asciiWordBoundaries:c,avoidSubclass:p,supportedGNodes:f,wordIsAscii:
|
|
223
|
+
XID_Start XIDS`.split(/\s/).map(e=>[ja(e),e])),tb=new Map([["s",fe(383)],[fe(383),"s"]]),ab=new Map([[fe(223),fe(7838)],[fe(107),fe(8490)],[fe(229),fe(8491)],[fe(969),fe(8486)]]),nb=new Map([vt(453),vt(456),vt(459),vt(498),...Kr(8072,8079),...Kr(8088,8095),...Kr(8104,8111),vt(8124),vt(8140),vt(8188)]),sb=new Map([["alnum",F`[\p{Alpha}\p{Nd}]`],["alpha",F`\p{Alpha}`],["ascii",F`\p{ASCII}`],["blank",F`[\p{Zs}\t]`],["cntrl",F`\p{Cc}`],["digit",F`\p{Nd}`],["graph",F`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",F`\p{Lower}`],["print",F`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",F`[\p{P}\p{S}]`],["space",F`\p{space}`],["upper",F`\p{Upper}`],["word",F`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",F`\p{AHex}`]]);function rb(e,t){let a=[];for(let n=e;n<=t;n++)a.push(n);return a}function vt(e){let t=fe(e);return[t.toLowerCase(),t]}function Kr(e,t){return rb(e,t).map(a=>vt(a))}var hc=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function ob(e,t){let a={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t};bc(e);let n={accuracy:a.accuracy,asciiWordBoundaries:a.asciiWordBoundaries,avoidSubclass:a.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:eo(a.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};Jt(e,ib,n);let s={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},r={currentFlags:s,prevFlags:null,globalFlags:s,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:n.subroutineRefMap};Jt(e,lb,r);let o={groupsByName:r.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:r.reffedNodesByReferencer};return Jt(e,ub,o),e._originMap=r.groupOriginByCopy,e._strategy=n.strategy,e}var ib={AbsenceFunction({node:e,parent:t,replaceWith:a}){let{body:n,kind:s}=e;if(s==="repeater"){let r=Ne();r.body[0].body.push(jt({negate:!0,body:n}),Kt("Any"));let o=Ne();o.body[0].body.push(Gr("greedy",0,1/0,r)),a(ue(o,t),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:e,parent:t,key:a},{flagDirectivesByAlt:n}){let s=e.body.filter(r=>r.kind==="flags");for(let r=a+1;r<t.body.length;r++){let o=t.body[r];fn(n,o,[]).push(...s)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let a=xc(t.get(e));if(a){let n=Ne({flags:a});n.body[0].body=e.body,e.body=[ue(n,e)]}}}},Assertion({node:e,parent:t,key:a,container:n,root:s,remove:r,replaceWith:o},i){let{kind:l,negate:u}=e,{asciiWordBoundaries:c,avoidSubclass:p,supportedGNodes:f,wordIsAscii:g}=i;if(l==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${u?"Y":"y"}"`);if(l==="line_end")o(ue(jt({body:[ft({body:[ps("string_end")]}),ft({body:[La(10)]})]}),t));else if(l==="line_start")o(ue(ht(F`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(l==="search_start")if(f.has(e))s.flags.sticky=!0,r();else{let h=n[a-1];if(h&&gb(h))o(ue(jt({negate:!0}),t));else{if(p)throw new Error(F`Uses "\G" in a way that requires a subclass`);o(St(ps("string_start"),t)),i.strategy="clip_search"}}else if(!(l==="string_end"||l==="string_start"))if(l==="string_end_newline")o(ue(ht(F`(?=\n?\z)`),t));else if(l==="word_boundary"){if(!g&&!c){let h=`(?:(?<=${gt})(?!${gt})|(?<!${gt})(?=${gt}))`,w=`(?:(?<=${gt})(?=${gt})|(?<!${gt})(?!${gt}))`;o(ue(ht(u?w:h),t))}}else throw new Error(`Unexpected assertion kind "${l}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:a}=e;typeof a=="string"&&!Qr(a)&&(a=Jr(a,t),e.ref=a)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:a}){let{name:n}=e;n&&!Qr(n)&&(n=Jr(n,t),e.name=n),a.set(e.number,e),n&&a.set(n,e)},CharacterClassRange({node:e,parent:t,replaceWith:a}){if(t.kind==="intersection"){let n=cn({body:[e]});a(ue(n,t),{traverse:!0})}},CharacterSet({node:e,parent:t,replaceWith:a},{accuracy:n,minTargetEs2024:s,digitIsAscii:r,spaceIsAscii:o,wordIsAscii:i}){let{kind:l,negate:u,value:c}=e;if(r&&(l==="digit"||c==="digit")){a(St(ms("digit",{negate:u}),t));return}if(o&&(l==="space"||c==="space")){a(ue(Yr(ht(Yh),u),t));return}if(i&&(l==="word"||c==="word")){a(St(ms("word",{negate:u}),t));return}if(l==="any")a(St(Kt("Any"),t));else if(l==="digit")a(St(Kt("Nd",{negate:u}),t));else if(l!=="dot")if(l==="text_segment"){if(n==="strict")throw new Error(F`Use of "\X" requires non-strict accuracy`);let p="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",f=F`\p{RI}{2}|${p}(?:\u200D${p})*`;a(ue(ht(F`(?>\r\n|${s?F`\p{RGI_Emoji}`:f}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(l==="hex")a(St(Kt("AHex",{negate:u}),t));else if(l==="newline")a(ue(ht(u?`[^
|
|
224
224
|
]`:`(?>\r
|
|
225
225
|
?|[
|
|
226
|
-
\v\f\x85\u2028\u2029])`),t));else if(l==="posix")if(!s&&(c==="graph"||c==="print")){if(n==="strict")throw new Error(`POSIX class "${c}" requires min target ES2024 or non-strict accuracy`);let p={graph:"!-~",print:" -~"}[c];u&&(p=`\0-${fe(p.codePointAt(0)-1)}${fe(p.codePointAt(2)+1)}-\u{10FFFF}`),a(ue(ht(`[${p}]`),t))}else a(ue(Yr(ht(sb.get(c)),u),t));else if(l==="property")ao.has(ja(c))||(e.key="sc");else if(l==="space")a(St(Kt("space",{negate:u}),t));else if(l==="word")a(ue(Yr(ht(gt),u),t));else throw new Error(`Unexpected character set kind "${l}"`)},Directive({node:e,parent:t,root:a,remove:n,replaceWith:s,removeAllPrevSiblings:r,removeAllNextSiblings:o}){let{kind:i,flags:l}=e;if(i==="flags")if(!l.enable&&!l.disable)n();else{let u=Ne({flags:l});u.body[0].body=o(),s(ue(u,t),{traverse:!0})}else if(i==="keep"){let u=a.body[0],p=a.body.length===1&&us(u,{type:"Group"})&&u.body[0].body.length===1?u.body[0]:a;if(t.parent!==p||p.body.length>1)throw new Error(F`Uses "\K" in a way that's unsupported`);let f=jt({behind:!0});f.body[0].body=r(),s(ue(f,t))}else throw new Error(`Unexpected directive kind "${i}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if(e.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(a=>delete e[a]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:a}=e.flags;t?.extended&&delete t.extended,a?.extended&&delete a.extended,t?.dotAll&&a?.dotAll&&delete t.dotAll,t?.ignoreCase&&a?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,a&&!Object.keys(a).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:a}=e;a==="lookbehind"&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:a}){let{kind:n}=e;if(n==="fail")a(ue(jt({negate:!0}),t));else throw new Error(`Unsupported named callout "(*${n.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type==="Quantifier"){let t=Ne();t.body[0].body.push(e.body),e.body=ue(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let a=[],n=!1,s=!1;for(let r of e.body)if(r.body.length===1&&r.body[0].kind==="search_start")r.body.pop();else{let o=kc(r.body);o?(n=!0,Array.isArray(o)?a.push(...o):a.push(o)):s=!0}n&&!s&&a.forEach(r=>t.add(r))},exit(e,{accuracy:t,passedLookbehind:a,strategy:n}){if(t==="strict"&&a&&n)throw new Error(F`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:a}=e;typeof a=="string"&&!Qr(a)&&(a=Jr(a,t),e.ref=a)}},lb={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:a}){let{orphan:n,ref:s}=e;n||a.set(e,[...t.get(s).map(({node:r})=>r)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:a,skip:n},{groupOriginByCopy:s,groupsByName:r,multiplexCapturesToLeftByRef:o,openRefs:i,reffedNodesByReferencer:l}){let u=s.get(e);if(u&&i.has(e.number)){let p=St(cc(e.number),t);l.set(p,i.get(e.number)),a(p);return}i.set(e.number,e),o.set(e.number,[]),e.name&&fn(o,e.name,[]);let c=o.get(e.name??e.number);for(let p=0;p<c.length;p++){let f=c[p];if(u===f.node||u&&u===f.origin||e===f.origin){c.splice(p,1);break}}if(o.get(e.number).push({node:e,origin:u}),e.name&&o.get(e.name).push({node:e,origin:u}),e.name){let p=fn(r,e.name,new Map),f=!1;if(u)f=!0;else for(let h of p.values())if(!h.hasDuplicateNameToRemove){f=!0;break}r.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:f})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=hs(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:a},n){let{isRecursive:s,ref:r}=e;if(s){let c=t;for(;(c=c.parent)&&!(c.type==="CapturingGroup"&&(c.name===r||c.number===r)););n.reffedNodesByReferencer.set(e,c);return}let o=n.subroutineRefMap.get(r),i=r===0,l=i?cc(0):yc(o,n.groupOriginByCopy,null),u=l;if(!i){let c=xc(pb(o,f=>f.type==="Group"&&!!f.flags)),p=c?hs(n.globalFlags,c):n.globalFlags;cb(p,n.currentFlags)||(u=Ne({flags:mb(p)}),u.body[0].body.push(l))}a(ue(u,t),{traverse:!i})}},ub={Backreference({node:e,parent:t,replaceWith:a},n){if(e.orphan){n.highestOrphanBackref=Math.max(n.highestOrphanBackref,e.ref);return}let r=n.reffedNodesByReferencer.get(e).filter(o=>db(o,e));if(!r.length)a(ue(jt({negate:!0}),t));else if(r.length>1){let o=Ne({atomic:!0,body:r.reverse().map(i=>ft({body:[cs(i.number)]}))});a(ue(o,t))}else e.ref=r[0].number},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let a=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let n=0;n<a;n++){let s=Fr();e.body.at(-1).body.push(s)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function bc(e){Jt(e,{"*"({node:t,parent:a}){t.parent=a}})}function cb(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function db(e,t){let a=t;do{if(a.type==="Regex")return!1;if(a.type==="Alternative")continue;if(a===e)return!1;let n=_c(a.parent);for(let s of n){if(s===a)break;if(s===e||wc(s,e))return!0}}while(a=a.parent);throw new Error("Unexpected path")}function yc(e,t,a,n){let s=Array.isArray(e)?[]:{};for(let[r,o]of Object.entries(e))r==="parent"?s.parent=Array.isArray(a)?n:a:o&&typeof o=="object"?s[r]=yc(o,t,s,a):(r==="type"&&o==="CapturingGroup"&&t.set(s,t.get(e)??e),s[r]=o);return s}function cc(e){let t=zr(e);return t.isRecursive=!0,t}function pb(e,t){let a=[];for(;e=e.parent;)(!t||t(e))&&a.push(e);return a}function Jr(e,t){if(t.has(e))return t.get(e);let a=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return t.set(e,a),a}function xc(e){let t=["dotAll","ignoreCase"],a={enable:{},disable:{}};return e.forEach(({flags:n})=>{t.forEach(s=>{n.enable?.[s]&&(delete a.disable[s],a.enable[s]=!0),n.disable?.[s]&&(a.disable[s]=!0)})}),Object.keys(a.enable).length||delete a.enable,Object.keys(a.disable).length||delete a.disable,a.enable||a.disable?a:null}function mb({dotAll:e,ignoreCase:t}){let a={};return(e||t)&&(a.enable={},e&&(a.enable.dotAll=!0),t&&(a.enable.ignoreCase=!0)),(!e||!t)&&(a.disable={},!e&&(a.disable.dotAll=!0),!t&&(a.disable.ignoreCase=!0)),a}function _c(e){if(!e)throw new Error("Node expected");let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function kc(e){let t=e.find(a=>a.kind==="search_start"||hb(a,{negate:!1})||!fb(a));if(!t)return null;if(t.kind==="search_start")return t;if(t.type==="LookaroundAssertion")return t.body[0].body[0];if(t.type==="CapturingGroup"||t.type==="Group"){let a=[];for(let n of t.body){let s=kc(n.body);if(!s)return null;Array.isArray(s)?a.push(...s):a.push(s)}return a}return null}function wc(e,t){let a=_c(e)??[];for(let n of a)if(n===t||wc(n,t))return!0;return!1}function fb({type:e}){return e==="Assertion"||e==="Directive"||e==="LookaroundAssertion"}function gb(e){let t=["Character","CharacterClass","CharacterSet"];return t.includes(e.type)||e.type==="Quantifier"&&e.min&&t.includes(e.body.type)}function hb(e,t){let a={negate:null,...t};return e.type==="LookaroundAssertion"&&(a.negate===null||e.negate===a.negate)&&e.body.length===1&&us(e.body[0],{type:"Assertion",kind:"search_start"})}function Qr(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function ht(e,t){let n=ds(e,{...t,unicodePropertyMap:ao}).body;return n.length>1||n[0].body.length>1?Ne({body:n}):n[0].body[0]}function Yr(e,t){return e.negate=t,e}function St(e,t){return e.parent=t,e}function ue(e,t){return bc(e),e.parent=t,e}function bb(e,t){let a=fc(t),n=eo(a.target,"ES2024"),s=eo(a.target,"ES2025"),r=a.rules.recursionLimit;if(!Number.isInteger(r)||r<2||r>20)throw new Error("Invalid recursionLimit; use 2-20");let o=null,i=null;if(!s){let h=[e.flags.ignoreCase];Jt(e,yb,{getCurrentModI:()=>h.at(-1),popModI(){h.pop()},pushModI(g){h.push(g)},setHasCasedChar(){h.at(-1)?o=!0:i=!0}})}let l={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||o)&&!i)},u=e,c={accuracy:a.accuracy,appliedGlobalFlags:l,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:u,originMap:e._originMap,recursionLimit:r,useAppliedIgnoreCase:!!(!s&&o&&i),useFlagMods:s,useFlagV:n,verbose:a.verbose};function p(h){return c.lastNode=u,u=h,Jh(xb[h.type],`Unexpected node type "${h.type}"`)(h,c,p)}let f={pattern:e.body.map(p).join("|"),flags:p(e.flags),options:{...e.options}};return n||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],c.captureMap.forEach((h,g)=>{h.hidden&&f._hiddenCaptures.push(g),h.transferTo&&fn(f._captureTransfers,h.transferTo,[]).push(g)}),f}var yb={"*":{enter({node:e},t){if(pc(e)){let a=t.getCurrentModI();t.pushModI(e.flags?hs({ignoreCase:a},e.flags).ignoreCase:a)}},exit({node:e},t){pc(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){no(fe(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},a){t(),$c(e,{firstOnly:!0}).length&&a.setHasCasedChar()},CharacterSet({node:e},t){e.kind==="property"&&hc.has(e.value)&&t.setHasCasedChar()}},xb={Alternative({body:e},t,a){return e.map(a).join("")},Assertion({kind:e,negate:t}){if(e==="string_end")return"$";if(e==="string_start")return"^";if(e==="word_boundary")return t?F`\B`:F`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!="number")throw new Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&t.accuracy==="strict"&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,a){let{body:n,name:s,number:r}=e,o={ignoreCase:t.currentFlags.ignoreCase},i=t.originMap.get(e);return i&&(o.hidden=!0,r>i.number&&(o.transferTo=i.number)),t.captureMap.set(r,o),`(${s?`?<${s}>`:""}${n.map(a).join("|")})`},Character({value:e},t){let a=fe(e),n=Sa(e,{escDigit:t.lastNode.type==="Backreference",inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(n!==a)return n;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&no(a)){let s=gc(a);return t.inCharClass?s.join(""):s.length>1?`[${s.join("")}]`:s[0]}return a},CharacterClass(e,t,a){let{kind:n,negate:s,parent:r}=e,{body:o}=e;if(n==="intersection"&&!t.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");Ze.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(mc)&&(o=[La(45),...o.filter(u=>!mc(u))]);let i=()=>`[${s?"^":""}${o.map(a).join(n==="intersection"?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||Ze.bugNestedClassIgnoresNegation)&&!s){let c=o.filter(p=>p.type==="CharacterClass"&&p.kind==="union"&&p.negate);if(c.length){let p=Ne(),f=p.body[0];return p.parent=r,f.parent=p,o=o.filter(h=>!c.includes(h)),e.body=o,o.length?(e.parent=f,f.body.push(e)):p.body.pop(),c.forEach(h=>{let g=ft({body:[h]});h.parent=g,g.parent=p,p.body.push(g)}),a(p)}}t.inCharClass=!0;let u=i();return t.inCharClass=!1,u}let l=o[0];if(n==="union"&&!s&&l&&((!t.useFlagV||!t.verbose)&&r.kind==="union"&&!(Ze.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&r.kind==="intersection"&&o.length===1&&l.type!=="CharacterClassRange"))return o.map(a).join("");if(!t.useFlagV&&r.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return i()},CharacterClassRange(e,t){let a=e.min.value,n=e.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},r=Sa(a,s),o=Sa(n,s),i=new Set;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){let l=$c(e);Cb(l).forEach(c=>{i.add(Array.isArray(c)?`${Sa(c[0],s)}-${Sa(c[1],s)}`:Sa(c,s))})}return`${r}-${o}${[...i].join("")}`},CharacterSet({kind:e,negate:t,value:a,key:n},s){if(e==="dot")return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":F`[^\n]`;if(e==="digit")return t?F`\D`:F`\d`;if(e==="property"){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&hc.has(a))throw new Error(`Unicode property "${a}" can't be case-insensitive when other chars have specific case`);return`${t?F`\P`:F`\p`}{${n?`${n}=`:""}${a}}`}if(e==="word")return t?F`\W`:F`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")},Group({atomic:e,body:t,flags:a,parent:n},s,r){let o=s.currentFlags;a&&(s.currentFlags=hs(o,a));let i=t.map(r).join("|"),l=!s.verbose&&t.length===1&&n.type!=="Quantifier"&&!e&&(!s.useFlagMods||!a)?i:`(?${Lb(e,a,s.useFlagMods)}${i})`;return s.currentFlags=o,l},LookaroundAssertion({body:e,kind:t,negate:a},n,s){return`(?${`${t==="lookahead"?"":"<"}${a?"!":"="}`}${e.map(s).join("|")})`},Quantifier(e,t,a){return a(e.body)+jb(e)},Subroutine({isRecursive:e,ref:t},a){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");let n=a.recursionLimit;return t===0?`(?R=${n})`:F`\g<${t}&R=${n}>`}},_b=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),kb=new Set(["-","\\","]","^","["]),wb=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),dc=new Map([[9,F`\t`],[10,F`\n`],[11,F`\v`],[12,F`\f`],[13,F`\r`],[8232,F`\u2028`],[8233,F`\u2029`],[65279,F`\uFEFF`]]),$b=/^\p{Cased}$/u;function no(e){return $b.test(e)}function $c(e,t){let a=!!t?.firstOnly,n=e.min.value,s=e.max.value,r=[];if(n<65&&(s===65535||s>=131071)||n===65536&&s>=131071)return r;for(let o=n;o<=s;o++){let i=fe(o);if(!no(i))continue;let l=gc(i).filter(u=>{let c=u.codePointAt(0);return c<n||c>s});if(l.length&&(r.push(...l),a))break}return r}function Sa(e,{escDigit:t,inCharClass:a,useFlagV:n}){if(dc.has(e))return dc.get(e);if(e<32||e>126&&e<160||e>262143||t&&vb(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;let s=a?n?wb:kb:_b,r=fe(e);return(s.has(r)?"\\":"")+r}function Cb(e){let t=e.map(s=>s.codePointAt(0)).sort((s,r)=>s-r),a=[],n=null;for(let s=0;s<t.length;s++)t[s+1]===t[s]+1?n??=t[s]:n===null?a.push(t[s]):(a.push([n,t[s]]),n=null);return a}function Lb(e,t,a){if(e)return">";let n="";if(t&&a){let{enable:s,disable:r}=t;n=(s?.ignoreCase?"i":"")+(s?.dotAll?"s":"")+(r?"-":"")+(r?.ignoreCase?"i":"")+(r?.dotAll?"s":"")}return`${n}:`}function jb({kind:e,max:t,min:a}){let n;return!a&&t===1?n="?":!a&&t===1/0?n="*":a===1&&t===1/0?n="+":a===t?n=`{${a}}`:n=`{${a},${t===1/0?"":t}}`,n+{greedy:"",lazy:"?",possessive:"+"}[e]}function pc({type:e}){return e==="CapturingGroup"||e==="Group"||e==="LookaroundAssertion"}function vb(e){return e>47&&e<58}function mc({type:e,value:t}){return e==="Character"&&t===45}var Sb=class to extends RegExp{#t=new Map;#e=null;#n;#a=null;#s=null;rawOptions={};get source(){return this.#n||"(?:)"}constructor(t,a,n){let s=!!n?.lazyCompile;if(t instanceof RegExp){if(n)throw new Error("Cannot provide options when copying a regexp");let r=t;super(r,a),this.#n=r.source,r instanceof to&&(this.#t=r.#t,this.#a=r.#a,this.#s=r.#s,this.rawOptions=r.rawOptions)}else{let r={hiddenCaptures:[],strategy:null,transfers:[],...n};super(s?"":t,a),this.#n=t,this.#t=Ab(r.hiddenCaptures,r.transfers),this.#s=r.strategy,this.rawOptions=n??{}}s||(this.#e=this)}exec(t){if(!this.#e){let{lazyCompile:s,...r}=this.rawOptions;this.#e=new to(this.#n,this.flags,r)}let a=this.global||this.sticky,n=this.lastIndex;if(this.#s==="clip_search"&&a&&n){this.lastIndex=0;let s=this.#r(t.slice(n));return s&&(Ib(s,n,t,this.hasIndices),this.lastIndex+=n),s}return this.#r(t)}#r(t){this.#e.lastIndex=this.lastIndex;let a=super.exec.call(this.#e,t);if(this.lastIndex=this.#e.lastIndex,!a||!this.#t.size)return a;let n=[...a];a.length=1;let s;this.hasIndices&&(s=[...a.indices],a.indices.length=1);let r=[0];for(let o=1;o<n.length;o++){let{hidden:i,transferTo:l}=this.#t.get(o)??{};if(i?r.push(null):(r.push(a.length),a.push(n[o]),this.hasIndices&&a.indices.push(s[o])),l&&n[o]!==void 0){let u=r[l];if(!u)throw new Error(`Invalid capture transfer to "${u}"`);if(a[u]=n[o],this.hasIndices&&(a.indices[u]=s[o]),a.groups){this.#a||(this.#a=Pb(this.source));let c=this.#a.get(l);c&&(a.groups[c]=n[o],this.hasIndices&&(a.indices.groups[c]=s[o]))}}}return a}};function Ib(e,t,a,n){if(e.index+=t,e.input=a,n){let s=e.indices;for(let o=0;o<s.length;o++){let i=s[o];i&&(s[o]=[i[0]+t,i[1]+t])}let r=s.groups;r&&Object.keys(r).forEach(o=>{let i=r[o];i&&(r[o]=[i[0]+t,i[1]+t])})}}function Ab(e,t){let a=new Map;for(let n of e)a.set(n,{hidden:!0});for(let[n,s]of t)for(let r of s)fn(a,r,{}).transferTo=n;return a}function Pb(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,a=new Map,n=0,s=0,r;for(;r=t.exec(e);){let{0:o,groups:{capture:i,name:l}}=r;o==="["?n++:n?o==="]"&&n--:i&&(s++,l&&a.set(s,l))}return a}function Cc(e,t){let a=Tb(e,t);return a.options?new Sb(a.pattern,a.flags,a.options):new RegExp(a.pattern,a.flags)}function Tb(e,t){let a=fc(t),n=ds(e,{flags:a.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:a.rules.captureGroup,singleline:a.rules.singleline},skipBackrefValidation:a.rules.allowOrphanBackrefs,unicodePropertyMap:ao}),s=ob(n,{accuracy:a.accuracy,asciiWordBoundaries:a.rules.asciiWordBoundaries,avoidSubclass:a.avoidSubclass,bestEffortTarget:a.target}),r=bb(s,a),o=lc(r.pattern,{captureTransfers:r._captureTransfers,hiddenCaptures:r._hiddenCaptures,mode:"external"}),i=Vr(o.pattern),l=Wr(i.pattern,{captureTransfers:o.captureTransfers,hiddenCaptures:o.hiddenCaptures}),u={pattern:l.pattern,flags:`${a.hasIndices?"d":""}${a.global?"g":""}${r.flags}${r.options.disable.v?"u":"v"}`};if(a.avoidSubclass){if(a.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{let c=l.hiddenCaptures.sort((g,$)=>g-$),p=Array.from(l.captureTransfers),f=s._strategy,h=u.pattern.length>=a.lazyCompileLength;(c.length||p.length||f||h)&&(u.options={...c.length&&{hiddenCaptures:c},...p.length&&{transfers:p},...f&&{strategy:f},...h&&{lazyCompile:h}})}return u}function Lc(e,t){return Cc(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function so(e={}){let t={target:"auto",cache:new Map,...e};return t.regexConstructor||=a=>Lc(a,{target:t.target}),{createScanner(a){return new Tu(a,t)},createString(a){return{content:a}}}}var Wb=Au({themes:[Pu()],langs:[Promise.resolve().then(()=>(Ic(),Sc)),Promise.resolve().then(()=>(Rc(),Tc)),Promise.resolve().then(()=>(qc(),Bc)),Promise.resolve().then(()=>(Fc(),Oc)),Promise.resolve().then(()=>(Hc(),Uc)),Promise.resolve().then(()=>(Zc(),Xc)),Promise.resolve().then(()=>(Yc(),Qc)),Promise.resolve().then(()=>(nd(),ad)),Promise.resolve().then(()=>(id(),od)),Promise.resolve().then(()=>(dd(),cd)),Promise.resolve().then(()=>(gd(),fd)),Promise.resolve().then(()=>(xd(),yd)),Promise.resolve().then(()=>($d(),wd))],engine:so()}),ys,xs=Wb.then(e=>{ys=e},()=>{});function Cd(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var Vb=2,Xb=1;function Ld(e,t){if(ys){let a=t&&ys.getLanguage(t)?t:"text";try{let{tokens:n}=ys.codeToTokens(e,{lang:a,theme:"css-variables"});return n.map(s=>s.map(r=>{let o=[];r.color&&o.push(`color:${r.color}`),r.fontStyle&&r.fontStyle&Vb&&o.push("font-weight:600"),r.fontStyle&&r.fontStyle&Xb&&o.push("font-style:italic");let i=Cd(r.content);return o.length>0?`<span style="${o.join(";")}">${i}</span>`:i}).join("")).join(`
|
|
227
|
-
`)}catch{}}return Cd(e)}function jd(e,t,a,n){let s=e==="zh"?t:a;return n?s.replace(/\{(\w+)\}/g,(r,o)=>n[o]!==void 0?String(n[o]):r):s}function vd(e){return(e??"").toLowerCase().startsWith("zh")?"zh":"en"}var _s;function Zb(){if(_s)return _s;let e="";try{e=typeof navigator<"u"&&(navigator.language||navigator.languages?.[0])||"",!e&&typeof document<"u"&&(e=document.documentElement?.lang??"")}catch{e=""}return _s=vd(e),_s}function x(e,t,a){return jd(Zb(),e,t,a)}var ks=class extends Error{constructor(a,n,s){super(s);this.code=a;this.status=n;this.name="BridgeApiError"}};function ws(e={}){let t=(e.base??"/dsh-msg9").replace(/\/+$/,""),a=e.fetch??((...r)=>fetch(...r));async function n(r,o={}){let i=AbortSignal.timeout(2e4),l=o.signal&&typeof AbortSignal.any=="function"?AbortSignal.any([o.signal,i]):i,u={method:o.method??"GET",headers:{...o.body===void 0?{}:{"Content-Type":"application/json"},...o.headers??{}},...o.body===void 0?{}:{body:JSON.stringify(o.body)},signal:l},c;try{c=await a(`${t}${r}`,u)}catch(h){throw h instanceof DOMException&&h.name==="TimeoutError"?new ks("timeout",0,x("\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u91CD\u8BD5\u3002","Request timed out, please retry.")):h}let p=await c.text(),f;try{f=p?JSON.parse(p):void 0}catch{f=void 0}if(!c.ok||f?.ok===!1){let h=f?.error?.code??`http-${c.status}`,g=f?.error?.message??(p||c.statusText);throw new ks(h,c.status,g)}return f?.data??void 0}let s=r=>{let o=new URLSearchParams;for(let[l,u]of Object.entries(r))u!==void 0&&u!==""&&o.set(l,String(u));let i=o.toString();return i?`?${i}`:""};return{overview:(r,o)=>n(`/overview${s({cwd:r})}`,{signal:o}),messages:(r,o,i)=>n(`/messages${s({key:r,folder:o.folder,limit:o.limit,offset:o.offset})}`,{signal:i}),outbox:(r,o,i)=>n(`/outbox${s({key:r,limit:o.limit,offset:o.offset})}`,{signal:i}),contacts:(r,o)=>n(`/contacts${s({key:r})}`,{signal:o}),groups:(r,o)=>n(`/groups${s({key:r})}`,{signal:o}),groupDetail:(r,o,i)=>n(`/groups${s({key:r,address:o})}`,{signal:i}),groupMessages:(r,o,i,l)=>n(`/groups/messages${s({key:r,address:o,limit:i.limit,offset:i.offset})}`,{signal:l}),addContact:(r,o)=>n("/contacts",{method:"POST",body:r,signal:o}),removeContact:(r,o,i)=>n(`/contacts${s({key:r,address:o})}`,{method:"DELETE",signal:i}),send:(r,o)=>n("/send",{method:"POST",body:r,signal:o}),markRead:(r,o,i)=>n("/read",{method:"POST",body:{key:r,message_id:o},signal:i}),markDone:(r,o,i)=>n("/done",{method:"POST",body:{key:r,message_id:o},signal:i}),peers:r=>n("/peers",{signal:r}),notifyStatus:r=>n("/notify",{signal:r}),setNotifyPaused:(r,o)=>n("/notify",{method:"POST",body:{paused:r},signal:o}),accountAgents:r=>n("/account/agents",{signal:r}),directory:(r,o)=>n(`/directory${s({limit:r.limit,offset:r.offset,q:r.q,capability:r.capability})}`,{signal:o}),unread:r=>n("/unread",{signal:r}),provision:(r,o)=>n("/provision",{method:"POST",body:r,signal:o}),migrate:(r,o)=>n("/migrate",{method:"POST",body:r,signal:o}),setup:(r,o)=>n("/setup",{method:"POST",body:r,signal:o}),resolve:(r,o)=>n("/resolve",{method:"POST",body:{address:r},signal:o})}}function Ie(e){return e instanceof Error?e.message:String(e)}var Kb={status:"loading",error:null,notice:null,cwd:null,owner:null,setup:{busy:!1,error:null,dismissed:!1},apiUrl:"",stateFile:"",workspaces:[],currentKey:null,tab:"inbox",folder:"all",messages:[],messagesTotal:0,unreadCount:0,unreadByKey:{},unreadTotal:0,totalByKey:{},outbox:[],outboxTotal:0,contacts:[],contactsTotal:0,peers:[],accountAgents:[],accountOrg:null,groups:[],selectedGroup:null,groupDetail:null,groupArchive:[],groupArchiveTotal:0,directory:[],directoryTotal:0,directoryQuery:"",directoryCapability:null,selectedAgent:null,selectedId:null,selectedContact:null,composeOpen:!1,compose:{to:"",subject:"",text:""},notifyPaused:!1,busy:{overview:!1,messages:!1,outbox:!1,contacts:!1,directory:!1,archive:!1,send:!1,action:!1},loadedAt:null};function Jb(e){let t=new Set;return e.filter(a=>t.has(a.message_id)?!1:(t.add(a.message_id),!0))}function oo(e={}){let t=e.bridge??ws(e),a=e.pollMs??2e4,n=Kb,s=new Set,r=null,o,i,l=0,u=0,c=0,p=0,f=0,h=0,g,$,j=0,L,k=()=>n,w=_=>{n={...n,..._};for(let S of[...s])S()},R=_=>w({busy:{...n.busy,..._}});function T(_,S){w({notice:{kind:_,text:S}})}function O(_){if(_.currentKey)return _.workspaces.find(S=>S.key===_.currentKey)}function Q(_){let S=_.current?.key??null;return S!==r&&(r=S,S)?S:n.currentKey&&_.workspaces.some(E=>E.key===n.currentKey)?n.currentKey:_.workspaces.find(E=>E.provisioned)?.key??S??_.workspaces[0]?.key??null}async function Y(){let _=n.cwd??"";if(i&&o===_)return i;o=_;let S=++l,P=Oe(S);i=P;try{await P}finally{i===P&&(i=void 0)}}async function Oe(_){try{R({overview:!0});let S=await t.overview(n.cwd??void 0);if(_!==l)return;let P=Q(S);w({status:"ready",error:null,owner:S.owner,apiUrl:S.api_url,stateFile:S.state_file,workspaces:S.workspaces,currentKey:P,loadedAt:Date.now()}),P&&(ee(),xe(),oe(),Ae())}catch(S){if(_!==l)return;w({status:n.workspaces.length===0?"error":"ready",error:Ie(S)})}finally{_===l&&R({overview:!1})}}async function ee(){let _=O(k());if(!_?.provisioned)return;let S=++u;try{R({messages:!0});let P=n.folder==="pending",E,ce=!1;try{E=await t.messages(_.key,{folder:P?"unprocessed":n.folder,limit:50,offset:0})}catch(se){if(!P)throw se;E=await t.messages(_.key,{folder:"all",limit:50,offset:0}),ce=!0}if(S!==u)return;let je=E.messages??[];w({messages:ce?je.filter(se=>!se.processed_by):je,messagesTotal:E.total??je.length,unreadCount:E.unread_count??0,loadedAt:Date.now()})}catch(P){S===u&&T("error",Ie(P))}finally{S===u&&R({messages:!1})}}async function xe(){let _=O(k());if(!_?.provisioned)return;let S=++c;try{R({outbox:!0});let P=await t.outbox(_.key,{limit:50,offset:0});if(S!==c)return;w({outbox:P.messages??[],outboxTotal:P.total??(P.messages??[]).length})}catch(P){S===c&&T("error",Ie(P))}finally{S===c&&R({outbox:!1})}}async function oe(){let _=O(k());if(!_?.provisioned)return;let S=++p;try{R({contacts:!0});let P=await t.contacts(_.key);if(S!==p)return;w({contacts:P.contacts??[],contactsTotal:P.total??(P.contacts??[]).length})}catch(P){S===p&&T("error",Ie(P))}finally{S===p&&R({contacts:!1})}}async function Ae(){if(g)return g;let _=(async()=>{try{let S=await t.unread();w({unreadByKey:S.byKey??{},unreadTotal:S.total??0,totalByKey:S.totalByKey??{}})}catch{}})();g=_;try{await _}finally{g===_&&(g=void 0)}}async function We(){try{let _=await t.peers();w({peers:_.peers??[]})}catch{}}async function we(){if(n.owner)try{let _=await t.accountAgents();w({accountAgents:_.agents??[],accountOrg:_.org_id||_.org_label?{id:_.org_id??null,label:_.org_label??null}:null})}catch{}}async function _e(){let _=O(k());if(!_?.provisioned)return;let S=++f;try{let P=await t.groups(_.key);if(S!==f)return;w({groups:P.groups??[]})}catch{}}async function bt(_=!1){let S=O(k()),P=n.selectedGroup;if(!S?.provisioned||!P||_&&n.busy.archive)return;let E=++f,ce=_?n.groupArchive:[];try{R({archive:!0});let je=await t.groupMessages(S.key,P,{limit:50,offset:ce.length});if(E!==f)return;let se=je.messages??[];w({groupArchive:Jb(_?[...ce,...se]:se),groupArchiveTotal:je.total??se.length})}catch{}finally{E===f&&R({archive:!1})}}async function At(_=!1){let S=++h,P=_?n.directory:[];try{R({directory:!0});let E=await t.directory({limit:100,offset:P.length,...n.directoryQuery.trim()?{q:n.directoryQuery.trim()}:{},...n.directoryCapability?{capability:n.directoryCapability}:{}});if(S!==h)return;let ce=E.agents??[];w({directory:_?[...P,...ce]:ce,directoryTotal:E.total??ce.length})}catch(E){S===h&&T("error",Ie(E))}finally{S===h&&R({directory:!1})}}async function Pt(_){let S=O(k());if(!S)return;let P=n.messages,E=n.unreadCount,ce=S.key,je=n.folder;w({messages:P.map(se=>se.message_id===_?{...se,read_at:new Date().toISOString()}:se),unreadCount:Math.max(0,n.unreadCount-1)});try{await t.markRead(S.key,_),Ae()}catch(se){let Je=k();Je.currentKey===ce&&Je.folder===je&&w({messages:P,unreadCount:E}),T("error",Ie(se))}}async function ea(){await Y(),We(),we()}function Ta(){L===void 0&&(L=setInterval(()=>{typeof document<"u"&&document.visibilityState==="hidden"||Ae()},a))}return{getState:k,subscribe(_){return s.add(_),()=>{s.delete(_)}},start(){j+=1;let _,S=0,P=`${(e.base??"/dsh-msg9").replace(/\/+$/,"")}/events`;return typeof EventSource<"u"?(_=new EventSource(P),_.onmessage=()=>{S=0,Ae()},_.onerror=()=>{S+=1,S>=3&&(_?.close(),_=void 0,Ta())}):Ta(),Ae(),()=>{j-=1,_?.close(),j<=0&&L!==void 0&&(clearInterval(L),L=void 0,j=0)}},setCwd(_){let S=_??null;S!==n.cwd&&(r=null,w({cwd:S}),S&&Y())},setTab(_){w({tab:_}),_==="inbox"&&ee(),_==="outbox"&&xe(),_==="contacts"&&(oe(),we()),_==="groups"&&_e(),_==="square"&&At()},setFolder(_){w({folder:_}),ee()},selectWorkspace(_){_!==n.currentKey&&(w({currentKey:_,selectedId:null,selectedContact:null,selectedGroup:null,composeOpen:!1,messages:[],outbox:[],contacts:[],messagesTotal:0,unreadCount:0,outboxTotal:0,contactsTotal:0}),ee(),xe(),oe(),_e())},selectMessage(_){if(w({selectedId:_,composeOpen:!1}),!_)return;let S=n.messages.find(P=>P.message_id===_);S&&!S.read_at&&Pt(_)},selectContact(_){w({selectedContact:_,composeOpen:!1})},selectAgent(_){w({selectedAgent:_,composeOpen:!1})},selectGroup(_){w({selectedGroup:_,groupDetail:null,groupArchive:[],groupArchiveTotal:0,composeOpen:!1});let S=O(k());!_||!S||(t.groupDetail(S.key,_).then(P=>{k().selectedGroup===_&&w({groupDetail:P.group})}).catch(()=>{}),bt())},setDirectoryQuery(_){_!==n.directoryQuery&&(w({directoryQuery:_}),At())},setDirectoryCapability(_){_!==n.directoryCapability&&(w({directoryCapability:_}),At())},async loadMoreDirectory(){n.busy.directory||n.directory.length>=n.directoryTotal||await At(!0)},setCompose(_){$=void 0,w({compose:{...n.compose,..._}})},openCompose(_){$=void 0,w({composeOpen:!0,compose:_?{...n.compose,..._}:{...n.compose,replyTo:void 0,correlationId:void 0}})},closeCompose(){w({composeOpen:!1})},composeTo(_){$=void 0,w({composeOpen:!0,compose:{...n.compose,to:_,replyTo:void 0,correlationId:void 0}})},replyTo(_){$=void 0,w({composeOpen:!0,compose:{...n.compose,to:_.list_address??_.from_address,replyTo:_.message_id,..._.correlation_id?{correlationId:_.correlation_id}:{correlationId:void 0}}})},clearNotice(){w({notice:null})},refreshOverview:Y,refreshInbox:ee,refreshOutbox:xe,refreshContacts:oe,refreshUnread:Ae,refreshPeers:We,refreshAccountAgents:we,refreshGroups:_e,refreshGroupArchive:bt,async refreshNotifyStatus(){try{let _=await t.notifyStatus();w({notifyPaused:_.paused})}catch{}},async toggleNotify(){try{let _=await t.setNotifyPaused(!n.notifyPaused);w({notifyPaused:_.paused}),T("ok",_.paused?x("\u5DF2\u9759\u97F3\uFF1A\u65B0\u90AE\u4EF6\u4E0D\u518D\u6253\u65AD\u4F1A\u8BDD","Paused: mail no longer interrupts sessions"):x("\u5DF2\u6062\u590D\u65B0\u90AE\u4EF6\u63D0\u9192","New-mail wake-ups resumed"))}catch(_){T("error",Ie(_))}},refreshDirectory:At,refreshAll:ea,async send(){let _=O(k()),{to:S,subject:P,text:E,replyTo:ce,correlationId:je}=n.compose;if(!_)return T("error",x("\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A workspace\u3002","Select a workspace first."));if(!_.provisioned)return T("error",x("\u8BE5 workspace \u8FD8\u6CA1\u6709\u6536\u4EF6\u7BB1\u3002","This workspace has no inbox yet."));if(!S.trim())return T("error",x("\u8BF7\u586B\u5199\u6536\u4EF6\u4EBA\u5730\u5740\u3002","Enter a recipient address."));if(!E.trim())return T("error",x("\u8BF7\u586B\u5199\u6D88\u606F\u6B63\u6587\u3002","Enter a message body."));try{R({send:!0}),$??=`dsh-ui-${Date.now()}-${Math.random().toString(36).slice(2,10)}`;let se=await t.send({key:_.key,to:S.trim(),text:E,...P.trim()?{subject:P.trim()}:{},...ce?{reply_to:ce}:{},...je?{correlation_id:je}:{},idempotency_key:$});$=void 0,ce&&w({messages:n.messages.map(Je=>Je.message_id===ce?{...Je,processed_by:"human"}:Je)}),w({compose:{to:"",subject:"",text:""},composeOpen:!1}),T("ok",x("\u5DF2\u53D1\u9001\u5230 {to}\uFF08{id}\uFF09","Sent to {to} ({id})",{to:S,id:se.message_id})),xe(),Ae()}catch(se){T("error",Ie(se))}finally{R({send:!1})}},async markDone(_){let S=O(k());if(!S)return;let P=n.messages,E=n.unreadCount,ce=S.key,je=n.folder,se=P.find(Qe=>Qe.message_id===_),Je=new Date().toISOString();w({messages:P.map(Qe=>Qe.message_id===_?{...Qe,read_at:Qe.read_at??Je,processed_by:"human"}:Qe),unreadCount:se&&!se.read_at?Math.max(0,n.unreadCount-1):n.unreadCount});try{await t.markDone(S.key,_),Ae()}catch(Qe){let yn=k();yn.currentKey===ce&&yn.folder===je&&w({messages:P,unreadCount:E}),T("error",Ie(Qe))}},async markRead(_){await Pt(_)},async addContact(_){let S=O(k());if(!S)return!1;try{return R({action:!0}),await t.addContact({key:S.key,..._}),T("ok",x("\u5DF2\u6DFB\u52A0\u8054\u7CFB\u4EBA {contact}","Contact added: {contact}",{contact:_.contact})),await oe(),!0}catch(P){return T("error",Ie(P)),!1}finally{R({action:!1})}},async removeContact(_){let S=O(k());if(S)try{R({action:!0}),await t.removeContact(S.key,_),T("ok",x("\u5DF2\u5220\u9664\u8054\u7CFB\u4EBA {contact}","Contact removed: {contact}",{contact:_})),await oe()}catch(P){T("error",Ie(P))}finally{R({action:!1})}},async provision(){let _=O(k());if(!_&&!n.cwd)return T("error",x("\u8FD8\u4E0D\u77E5\u9053\u5F53\u524D workspace \u7684\u76EE\u5F55\u3002","The current workspace directory is unknown."));try{R({action:!0});let S=await t.provision({..._?{key:_.key,title:_.title}:{},...n.cwd?{cwd:n.cwd}:{}});T("ok",S.provisioned?x("\u5DF2\u5F00\u901A\u6536\u4EF6\u7BB1 {address}","Inbox opened: {address}",{address:S.address}):x("\u6536\u4EF6\u7BB1\u5DF2\u5B58\u5728\uFF1A{address}","Inbox already open: {address}",{address:S.address})),await Y()}catch(S){T("error",Ie(S))}finally{R({action:!1})}},async migrate(_,S){try{R({action:!0});let P=await t.migrate({key:_,...S?.trim()?{old_owner_key:S.trim()}:{}}),E=[x("\u5DF2\u8FC1\u79FB\u5230 {address}","Migrated to {address}",{address:P.new_address}),P.forwarding?x("\u65E7\u5730\u5740\u5DF2\u8BBE\u7F6E\u8F6C\u53D1","old address forwards here"):null,P.moved_mail!==null&&P.moved_mail!==void 0?x("\u642C\u5165 {n} \u5C01\u5386\u53F2\u90AE\u4EF6","{n} old message(s) moved",{n:P.moved_mail}):null,P.old_disabled?x("\u65E7\u6536\u4EF6\u7BB1\u5DF2\u505C\u7528","old inbox suspended"):null].filter(Boolean).join("\uFF0C");return P.note?T("ok",`${E}\u3002${P.note}`):T("ok",E),await Y(),P}catch(P){return T("error",Ie(P)),null}finally{R({action:!1})}},async bindOwner(_,S){let P=_.trim();if(P){w({setup:{...n.setup,busy:!0,error:null}});try{let E=await t.setup(S?{owner_key:P,api_url:S}:{owner_key:P});w({owner:E.owner,apiUrl:E.api_url,setup:{busy:!1,error:null,dismissed:!1}}),T("ok",E.owner.slug?x("\u5DF2\u7ED1\u5B9A\u79DF\u6237 {name}\uFF08{domain}\uFF09","Tenant connected: {name} ({domain})",{name:E.owner.name??E.owner.id??"owner",domain:`${E.owner.slug}.${E.owner.mail_domain??"msg9.io"}`}):x("\u5DF2\u7ED1\u5B9A\u79DF\u6237 {name}","Tenant connected: {name}",{name:E.owner.name??E.owner.id??"owner"})),await ea()}catch(E){w({setup:{busy:!1,error:Ie(E),dismissed:!1}})}}},dismissSetup(){w({setup:{...n.setup,dismissed:!0,error:null}})}}}var Sd;function $s(e){return Sd??=oo(e),Sd}function Yt(e){if(e.currentKey)return e.workspaces.find(t=>t.key===e.currentKey)}var Ke="var(--dsw-alias-label-primary, #1f2328)",G="var(--dsw-alias-label-secondary, #6b7280)",io="var(--dsw-alias-bg-layer-2, #ffffff)",Id="var(--dsw-alias-bg-layer-1, #f5f7fa)",he="var(--dsw-alias-border-l1, rgba(28,35,51,0.12))",Ia="var(--dsw-alias-border-l2, rgba(28,35,51,0.20))",ge="var(--dsw-alias-brand-primary, #2d66f7)",gn="var(--dsw-alias-interactive-bg-hover, rgba(28,35,51,0.06))",hn="var(--dsw-specific-sidebar-nav-item-active, rgba(45,102,247,0.12))",Qb=`url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="6" viewBox="0 0 10 6" fill="none"><path d="M1 1l4 4 4-4" stroke="%23787887" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>')`,It=`
|
|
226
|
+
\v\f\x85\u2028\u2029])`),t));else if(l==="posix")if(!s&&(c==="graph"||c==="print")){if(n==="strict")throw new Error(`POSIX class "${c}" requires min target ES2024 or non-strict accuracy`);let p={graph:"!-~",print:" -~"}[c];u&&(p=`\0-${fe(p.codePointAt(0)-1)}${fe(p.codePointAt(2)+1)}-\u{10FFFF}`),a(ue(ht(`[${p}]`),t))}else a(ue(Yr(ht(sb.get(c)),u),t));else if(l==="property")ao.has(ja(c))||(e.key="sc");else if(l==="space")a(St(Kt("space",{negate:u}),t));else if(l==="word")a(ue(Yr(ht(gt),u),t));else throw new Error(`Unexpected character set kind "${l}"`)},Directive({node:e,parent:t,root:a,remove:n,replaceWith:s,removeAllPrevSiblings:r,removeAllNextSiblings:o}){let{kind:i,flags:l}=e;if(i==="flags")if(!l.enable&&!l.disable)n();else{let u=Ne({flags:l});u.body[0].body=o(),s(ue(u,t),{traverse:!0})}else if(i==="keep"){let u=a.body[0],p=a.body.length===1&&us(u,{type:"Group"})&&u.body[0].body.length===1?u.body[0]:a;if(t.parent!==p||p.body.length>1)throw new Error(F`Uses "\K" in a way that's unsupported`);let f=jt({behind:!0});f.body[0].body=r(),s(ue(f,t))}else throw new Error(`Unexpected directive kind "${i}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if(e.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(a=>delete e[a]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:a}=e.flags;t?.extended&&delete t.extended,a?.extended&&delete a.extended,t?.dotAll&&a?.dotAll&&delete t.dotAll,t?.ignoreCase&&a?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,a&&!Object.keys(a).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:a}=e;a==="lookbehind"&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:a}){let{kind:n}=e;if(n==="fail")a(ue(jt({negate:!0}),t));else throw new Error(`Unsupported named callout "(*${n.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type==="Quantifier"){let t=Ne();t.body[0].body.push(e.body),e.body=ue(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let a=[],n=!1,s=!1;for(let r of e.body)if(r.body.length===1&&r.body[0].kind==="search_start")r.body.pop();else{let o=kc(r.body);o?(n=!0,Array.isArray(o)?a.push(...o):a.push(o)):s=!0}n&&!s&&a.forEach(r=>t.add(r))},exit(e,{accuracy:t,passedLookbehind:a,strategy:n}){if(t==="strict"&&a&&n)throw new Error(F`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:a}=e;typeof a=="string"&&!Qr(a)&&(a=Jr(a,t),e.ref=a)}},lb={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:a}){let{orphan:n,ref:s}=e;n||a.set(e,[...t.get(s).map(({node:r})=>r)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:a,skip:n},{groupOriginByCopy:s,groupsByName:r,multiplexCapturesToLeftByRef:o,openRefs:i,reffedNodesByReferencer:l}){let u=s.get(e);if(u&&i.has(e.number)){let p=St(cc(e.number),t);l.set(p,i.get(e.number)),a(p);return}i.set(e.number,e),o.set(e.number,[]),e.name&&fn(o,e.name,[]);let c=o.get(e.name??e.number);for(let p=0;p<c.length;p++){let f=c[p];if(u===f.node||u&&u===f.origin||e===f.origin){c.splice(p,1);break}}if(o.get(e.number).push({node:e,origin:u}),e.name&&o.get(e.name).push({node:e,origin:u}),e.name){let p=fn(r,e.name,new Map),f=!1;if(u)f=!0;else for(let g of p.values())if(!g.hasDuplicateNameToRemove){f=!0;break}r.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:f})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=hs(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:a},n){let{isRecursive:s,ref:r}=e;if(s){let c=t;for(;(c=c.parent)&&!(c.type==="CapturingGroup"&&(c.name===r||c.number===r)););n.reffedNodesByReferencer.set(e,c);return}let o=n.subroutineRefMap.get(r),i=r===0,l=i?cc(0):yc(o,n.groupOriginByCopy,null),u=l;if(!i){let c=xc(pb(o,f=>f.type==="Group"&&!!f.flags)),p=c?hs(n.globalFlags,c):n.globalFlags;cb(p,n.currentFlags)||(u=Ne({flags:mb(p)}),u.body[0].body.push(l))}a(ue(u,t),{traverse:!i})}},ub={Backreference({node:e,parent:t,replaceWith:a},n){if(e.orphan){n.highestOrphanBackref=Math.max(n.highestOrphanBackref,e.ref);return}let r=n.reffedNodesByReferencer.get(e).filter(o=>db(o,e));if(!r.length)a(ue(jt({negate:!0}),t));else if(r.length>1){let o=Ne({atomic:!0,body:r.reverse().map(i=>ft({body:[cs(i.number)]}))});a(ue(o,t))}else e.ref=r[0].number},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let a=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let n=0;n<a;n++){let s=Fr();e.body.at(-1).body.push(s)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function bc(e){Jt(e,{"*"({node:t,parent:a}){t.parent=a}})}function cb(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function db(e,t){let a=t;do{if(a.type==="Regex")return!1;if(a.type==="Alternative")continue;if(a===e)return!1;let n=_c(a.parent);for(let s of n){if(s===a)break;if(s===e||wc(s,e))return!0}}while(a=a.parent);throw new Error("Unexpected path")}function yc(e,t,a,n){let s=Array.isArray(e)?[]:{};for(let[r,o]of Object.entries(e))r==="parent"?s.parent=Array.isArray(a)?n:a:o&&typeof o=="object"?s[r]=yc(o,t,s,a):(r==="type"&&o==="CapturingGroup"&&t.set(s,t.get(e)??e),s[r]=o);return s}function cc(e){let t=zr(e);return t.isRecursive=!0,t}function pb(e,t){let a=[];for(;e=e.parent;)(!t||t(e))&&a.push(e);return a}function Jr(e,t){if(t.has(e))return t.get(e);let a=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return t.set(e,a),a}function xc(e){let t=["dotAll","ignoreCase"],a={enable:{},disable:{}};return e.forEach(({flags:n})=>{t.forEach(s=>{n.enable?.[s]&&(delete a.disable[s],a.enable[s]=!0),n.disable?.[s]&&(a.disable[s]=!0)})}),Object.keys(a.enable).length||delete a.enable,Object.keys(a.disable).length||delete a.disable,a.enable||a.disable?a:null}function mb({dotAll:e,ignoreCase:t}){let a={};return(e||t)&&(a.enable={},e&&(a.enable.dotAll=!0),t&&(a.enable.ignoreCase=!0)),(!e||!t)&&(a.disable={},!e&&(a.disable.dotAll=!0),!t&&(a.disable.ignoreCase=!0)),a}function _c(e){if(!e)throw new Error("Node expected");let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function kc(e){let t=e.find(a=>a.kind==="search_start"||hb(a,{negate:!1})||!fb(a));if(!t)return null;if(t.kind==="search_start")return t;if(t.type==="LookaroundAssertion")return t.body[0].body[0];if(t.type==="CapturingGroup"||t.type==="Group"){let a=[];for(let n of t.body){let s=kc(n.body);if(!s)return null;Array.isArray(s)?a.push(...s):a.push(s)}return a}return null}function wc(e,t){let a=_c(e)??[];for(let n of a)if(n===t||wc(n,t))return!0;return!1}function fb({type:e}){return e==="Assertion"||e==="Directive"||e==="LookaroundAssertion"}function gb(e){let t=["Character","CharacterClass","CharacterSet"];return t.includes(e.type)||e.type==="Quantifier"&&e.min&&t.includes(e.body.type)}function hb(e,t){let a={negate:null,...t};return e.type==="LookaroundAssertion"&&(a.negate===null||e.negate===a.negate)&&e.body.length===1&&us(e.body[0],{type:"Assertion",kind:"search_start"})}function Qr(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function ht(e,t){let n=ds(e,{...t,unicodePropertyMap:ao}).body;return n.length>1||n[0].body.length>1?Ne({body:n}):n[0].body[0]}function Yr(e,t){return e.negate=t,e}function St(e,t){return e.parent=t,e}function ue(e,t){return bc(e),e.parent=t,e}function bb(e,t){let a=fc(t),n=eo(a.target,"ES2024"),s=eo(a.target,"ES2025"),r=a.rules.recursionLimit;if(!Number.isInteger(r)||r<2||r>20)throw new Error("Invalid recursionLimit; use 2-20");let o=null,i=null;if(!s){let g=[e.flags.ignoreCase];Jt(e,yb,{getCurrentModI:()=>g.at(-1),popModI(){g.pop()},pushModI(h){g.push(h)},setHasCasedChar(){g.at(-1)?o=!0:i=!0}})}let l={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||o)&&!i)},u=e,c={accuracy:a.accuracy,appliedGlobalFlags:l,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:u,originMap:e._originMap,recursionLimit:r,useAppliedIgnoreCase:!!(!s&&o&&i),useFlagMods:s,useFlagV:n,verbose:a.verbose};function p(g){return c.lastNode=u,u=g,Jh(xb[g.type],`Unexpected node type "${g.type}"`)(g,c,p)}let f={pattern:e.body.map(p).join("|"),flags:p(e.flags),options:{...e.options}};return n||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],c.captureMap.forEach((g,h)=>{g.hidden&&f._hiddenCaptures.push(h),g.transferTo&&fn(f._captureTransfers,g.transferTo,[]).push(h)}),f}var yb={"*":{enter({node:e},t){if(pc(e)){let a=t.getCurrentModI();t.pushModI(e.flags?hs({ignoreCase:a},e.flags).ignoreCase:a)}},exit({node:e},t){pc(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){no(fe(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},a){t(),$c(e,{firstOnly:!0}).length&&a.setHasCasedChar()},CharacterSet({node:e},t){e.kind==="property"&&hc.has(e.value)&&t.setHasCasedChar()}},xb={Alternative({body:e},t,a){return e.map(a).join("")},Assertion({kind:e,negate:t}){if(e==="string_end")return"$";if(e==="string_start")return"^";if(e==="word_boundary")return t?F`\B`:F`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!="number")throw new Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&t.accuracy==="strict"&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,a){let{body:n,name:s,number:r}=e,o={ignoreCase:t.currentFlags.ignoreCase},i=t.originMap.get(e);return i&&(o.hidden=!0,r>i.number&&(o.transferTo=i.number)),t.captureMap.set(r,o),`(${s?`?<${s}>`:""}${n.map(a).join("|")})`},Character({value:e},t){let a=fe(e),n=Sa(e,{escDigit:t.lastNode.type==="Backreference",inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(n!==a)return n;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&no(a)){let s=gc(a);return t.inCharClass?s.join(""):s.length>1?`[${s.join("")}]`:s[0]}return a},CharacterClass(e,t,a){let{kind:n,negate:s,parent:r}=e,{body:o}=e;if(n==="intersection"&&!t.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");Ze.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(mc)&&(o=[La(45),...o.filter(u=>!mc(u))]);let i=()=>`[${s?"^":""}${o.map(a).join(n==="intersection"?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||Ze.bugNestedClassIgnoresNegation)&&!s){let c=o.filter(p=>p.type==="CharacterClass"&&p.kind==="union"&&p.negate);if(c.length){let p=Ne(),f=p.body[0];return p.parent=r,f.parent=p,o=o.filter(g=>!c.includes(g)),e.body=o,o.length?(e.parent=f,f.body.push(e)):p.body.pop(),c.forEach(g=>{let h=ft({body:[g]});g.parent=h,h.parent=p,p.body.push(h)}),a(p)}}t.inCharClass=!0;let u=i();return t.inCharClass=!1,u}let l=o[0];if(n==="union"&&!s&&l&&((!t.useFlagV||!t.verbose)&&r.kind==="union"&&!(Ze.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&r.kind==="intersection"&&o.length===1&&l.type!=="CharacterClassRange"))return o.map(a).join("");if(!t.useFlagV&&r.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return i()},CharacterClassRange(e,t){let a=e.min.value,n=e.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},r=Sa(a,s),o=Sa(n,s),i=new Set;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){let l=$c(e);Cb(l).forEach(c=>{i.add(Array.isArray(c)?`${Sa(c[0],s)}-${Sa(c[1],s)}`:Sa(c,s))})}return`${r}-${o}${[...i].join("")}`},CharacterSet({kind:e,negate:t,value:a,key:n},s){if(e==="dot")return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":F`[^\n]`;if(e==="digit")return t?F`\D`:F`\d`;if(e==="property"){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&hc.has(a))throw new Error(`Unicode property "${a}" can't be case-insensitive when other chars have specific case`);return`${t?F`\P`:F`\p`}{${n?`${n}=`:""}${a}}`}if(e==="word")return t?F`\W`:F`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")},Group({atomic:e,body:t,flags:a,parent:n},s,r){let o=s.currentFlags;a&&(s.currentFlags=hs(o,a));let i=t.map(r).join("|"),l=!s.verbose&&t.length===1&&n.type!=="Quantifier"&&!e&&(!s.useFlagMods||!a)?i:`(?${Lb(e,a,s.useFlagMods)}${i})`;return s.currentFlags=o,l},LookaroundAssertion({body:e,kind:t,negate:a},n,s){return`(?${`${t==="lookahead"?"":"<"}${a?"!":"="}`}${e.map(s).join("|")})`},Quantifier(e,t,a){return a(e.body)+jb(e)},Subroutine({isRecursive:e,ref:t},a){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");let n=a.recursionLimit;return t===0?`(?R=${n})`:F`\g<${t}&R=${n}>`}},_b=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),kb=new Set(["-","\\","]","^","["]),wb=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),dc=new Map([[9,F`\t`],[10,F`\n`],[11,F`\v`],[12,F`\f`],[13,F`\r`],[8232,F`\u2028`],[8233,F`\u2029`],[65279,F`\uFEFF`]]),$b=/^\p{Cased}$/u;function no(e){return $b.test(e)}function $c(e,t){let a=!!t?.firstOnly,n=e.min.value,s=e.max.value,r=[];if(n<65&&(s===65535||s>=131071)||n===65536&&s>=131071)return r;for(let o=n;o<=s;o++){let i=fe(o);if(!no(i))continue;let l=gc(i).filter(u=>{let c=u.codePointAt(0);return c<n||c>s});if(l.length&&(r.push(...l),a))break}return r}function Sa(e,{escDigit:t,inCharClass:a,useFlagV:n}){if(dc.has(e))return dc.get(e);if(e<32||e>126&&e<160||e>262143||t&&vb(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;let s=a?n?wb:kb:_b,r=fe(e);return(s.has(r)?"\\":"")+r}function Cb(e){let t=e.map(s=>s.codePointAt(0)).sort((s,r)=>s-r),a=[],n=null;for(let s=0;s<t.length;s++)t[s+1]===t[s]+1?n??=t[s]:n===null?a.push(t[s]):(a.push([n,t[s]]),n=null);return a}function Lb(e,t,a){if(e)return">";let n="";if(t&&a){let{enable:s,disable:r}=t;n=(s?.ignoreCase?"i":"")+(s?.dotAll?"s":"")+(r?"-":"")+(r?.ignoreCase?"i":"")+(r?.dotAll?"s":"")}return`${n}:`}function jb({kind:e,max:t,min:a}){let n;return!a&&t===1?n="?":!a&&t===1/0?n="*":a===1&&t===1/0?n="+":a===t?n=`{${a}}`:n=`{${a},${t===1/0?"":t}}`,n+{greedy:"",lazy:"?",possessive:"+"}[e]}function pc({type:e}){return e==="CapturingGroup"||e==="Group"||e==="LookaroundAssertion"}function vb(e){return e>47&&e<58}function mc({type:e,value:t}){return e==="Character"&&t===45}var Sb=class to extends RegExp{#t=new Map;#e=null;#n;#a=null;#s=null;rawOptions={};get source(){return this.#n||"(?:)"}constructor(t,a,n){let s=!!n?.lazyCompile;if(t instanceof RegExp){if(n)throw new Error("Cannot provide options when copying a regexp");let r=t;super(r,a),this.#n=r.source,r instanceof to&&(this.#t=r.#t,this.#a=r.#a,this.#s=r.#s,this.rawOptions=r.rawOptions)}else{let r={hiddenCaptures:[],strategy:null,transfers:[],...n};super(s?"":t,a),this.#n=t,this.#t=Ab(r.hiddenCaptures,r.transfers),this.#s=r.strategy,this.rawOptions=n??{}}s||(this.#e=this)}exec(t){if(!this.#e){let{lazyCompile:s,...r}=this.rawOptions;this.#e=new to(this.#n,this.flags,r)}let a=this.global||this.sticky,n=this.lastIndex;if(this.#s==="clip_search"&&a&&n){this.lastIndex=0;let s=this.#r(t.slice(n));return s&&(Ib(s,n,t,this.hasIndices),this.lastIndex+=n),s}return this.#r(t)}#r(t){this.#e.lastIndex=this.lastIndex;let a=super.exec.call(this.#e,t);if(this.lastIndex=this.#e.lastIndex,!a||!this.#t.size)return a;let n=[...a];a.length=1;let s;this.hasIndices&&(s=[...a.indices],a.indices.length=1);let r=[0];for(let o=1;o<n.length;o++){let{hidden:i,transferTo:l}=this.#t.get(o)??{};if(i?r.push(null):(r.push(a.length),a.push(n[o]),this.hasIndices&&a.indices.push(s[o])),l&&n[o]!==void 0){let u=r[l];if(!u)throw new Error(`Invalid capture transfer to "${u}"`);if(a[u]=n[o],this.hasIndices&&(a.indices[u]=s[o]),a.groups){this.#a||(this.#a=Pb(this.source));let c=this.#a.get(l);c&&(a.groups[c]=n[o],this.hasIndices&&(a.indices.groups[c]=s[o]))}}}return a}};function Ib(e,t,a,n){if(e.index+=t,e.input=a,n){let s=e.indices;for(let o=0;o<s.length;o++){let i=s[o];i&&(s[o]=[i[0]+t,i[1]+t])}let r=s.groups;r&&Object.keys(r).forEach(o=>{let i=r[o];i&&(r[o]=[i[0]+t,i[1]+t])})}}function Ab(e,t){let a=new Map;for(let n of e)a.set(n,{hidden:!0});for(let[n,s]of t)for(let r of s)fn(a,r,{}).transferTo=n;return a}function Pb(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,a=new Map,n=0,s=0,r;for(;r=t.exec(e);){let{0:o,groups:{capture:i,name:l}}=r;o==="["?n++:n?o==="]"&&n--:i&&(s++,l&&a.set(s,l))}return a}function Cc(e,t){let a=Tb(e,t);return a.options?new Sb(a.pattern,a.flags,a.options):new RegExp(a.pattern,a.flags)}function Tb(e,t){let a=fc(t),n=ds(e,{flags:a.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:a.rules.captureGroup,singleline:a.rules.singleline},skipBackrefValidation:a.rules.allowOrphanBackrefs,unicodePropertyMap:ao}),s=ob(n,{accuracy:a.accuracy,asciiWordBoundaries:a.rules.asciiWordBoundaries,avoidSubclass:a.avoidSubclass,bestEffortTarget:a.target}),r=bb(s,a),o=lc(r.pattern,{captureTransfers:r._captureTransfers,hiddenCaptures:r._hiddenCaptures,mode:"external"}),i=Vr(o.pattern),l=Wr(i.pattern,{captureTransfers:o.captureTransfers,hiddenCaptures:o.hiddenCaptures}),u={pattern:l.pattern,flags:`${a.hasIndices?"d":""}${a.global?"g":""}${r.flags}${r.options.disable.v?"u":"v"}`};if(a.avoidSubclass){if(a.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{let c=l.hiddenCaptures.sort((h,w)=>h-w),p=Array.from(l.captureTransfers),f=s._strategy,g=u.pattern.length>=a.lazyCompileLength;(c.length||p.length||f||g)&&(u.options={...c.length&&{hiddenCaptures:c},...p.length&&{transfers:p},...f&&{strategy:f},...g&&{lazyCompile:g}})}return u}function Lc(e,t){return Cc(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function so(e={}){let t={target:"auto",cache:new Map,...e};return t.regexConstructor||=a=>Lc(a,{target:t.target}),{createScanner(a){return new Tu(a,t)},createString(a){return{content:a}}}}var Wb=Au({themes:[Pu()],langs:[Promise.resolve().then(()=>(Ic(),Sc)),Promise.resolve().then(()=>(Rc(),Tc)),Promise.resolve().then(()=>(qc(),Bc)),Promise.resolve().then(()=>(Fc(),Oc)),Promise.resolve().then(()=>(Hc(),Uc)),Promise.resolve().then(()=>(Zc(),Xc)),Promise.resolve().then(()=>(Yc(),Qc)),Promise.resolve().then(()=>(nd(),ad)),Promise.resolve().then(()=>(id(),od)),Promise.resolve().then(()=>(dd(),cd)),Promise.resolve().then(()=>(gd(),fd)),Promise.resolve().then(()=>(xd(),yd)),Promise.resolve().then(()=>($d(),wd))],engine:so()}),ys,xs=Wb.then(e=>{ys=e},()=>{});function Cd(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}var Vb=2,Xb=1;function Ld(e,t){if(ys){let a=t&&ys.getLanguage(t)?t:"text";try{let{tokens:n}=ys.codeToTokens(e,{lang:a,theme:"css-variables"});return n.map(s=>s.map(r=>{let o=[];r.color&&o.push(`color:${r.color}`),r.fontStyle&&r.fontStyle&Vb&&o.push("font-weight:600"),r.fontStyle&&r.fontStyle&Xb&&o.push("font-style:italic");let i=Cd(r.content);return o.length>0?`<span style="${o.join(";")}">${i}</span>`:i}).join("")).join(`
|
|
227
|
+
`)}catch{}}return Cd(e)}function jd(e,t,a,n){let s=e==="zh"?t:a;return n?s.replace(/\{(\w+)\}/g,(r,o)=>n[o]!==void 0?String(n[o]):r):s}function vd(e){return(e??"").toLowerCase().startsWith("zh")?"zh":"en"}var _s;function Zb(){if(_s)return _s;let e="";try{e=typeof navigator<"u"&&(navigator.language||navigator.languages?.[0])||"",!e&&typeof document<"u"&&(e=document.documentElement?.lang??"")}catch{e=""}return _s=vd(e),_s}function x(e,t,a){return jd(Zb(),e,t,a)}var ks=class extends Error{constructor(a,n,s){super(s);this.code=a;this.status=n;this.name="BridgeApiError"}};function ws(e={}){let t=(e.base??"/dsh-msg9").replace(/\/+$/,""),a=e.fetch??((...r)=>fetch(...r));async function n(r,o={}){let i=AbortSignal.timeout(2e4),l=o.signal&&typeof AbortSignal.any=="function"?AbortSignal.any([o.signal,i]):i,u={method:o.method??"GET",headers:{...o.body===void 0?{}:{"Content-Type":"application/json"},...o.headers??{}},...o.body===void 0?{}:{body:JSON.stringify(o.body)},signal:l},c;try{c=await a(`${t}${r}`,u)}catch(g){throw g instanceof DOMException&&g.name==="TimeoutError"?new ks("timeout",0,x("\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u91CD\u8BD5\u3002","Request timed out, please retry.")):g}let p=await c.text(),f;try{f=p?JSON.parse(p):void 0}catch{f=void 0}if(!c.ok||f?.ok===!1){let g=f?.error?.code??`http-${c.status}`,h=f?.error?.message??(p||c.statusText);throw new ks(g,c.status,h)}return f?.data??void 0}let s=r=>{let o=new URLSearchParams;for(let[l,u]of Object.entries(r))u!==void 0&&u!==""&&o.set(l,String(u));let i=o.toString();return i?`?${i}`:""};return{overview:(r,o)=>n(`/overview${s({cwd:r})}`,{signal:o}),messages:(r,o,i)=>n(`/messages${s({key:r,folder:o.folder,limit:o.limit,offset:o.offset})}`,{signal:i}),outbox:(r,o,i)=>n(`/outbox${s({key:r,limit:o.limit,offset:o.offset})}`,{signal:i}),contacts:(r,o)=>n(`/contacts${s({key:r})}`,{signal:o}),groups:(r,o)=>n(`/groups${s({key:r})}`,{signal:o}),groupDetail:(r,o,i)=>n(`/groups${s({key:r,address:o})}`,{signal:i}),groupMessages:(r,o,i,l)=>n(`/groups/messages${s({key:r,address:o,limit:i.limit,offset:i.offset})}`,{signal:l}),addContact:(r,o)=>n("/contacts",{method:"POST",body:r,signal:o}),removeContact:(r,o,i)=>n(`/contacts${s({key:r,address:o})}`,{method:"DELETE",signal:i}),send:(r,o)=>n("/send",{method:"POST",body:r,signal:o}),markRead:(r,o,i)=>n("/read",{method:"POST",body:{key:r,message_id:o},signal:i}),markDone:(r,o,i)=>n("/done",{method:"POST",body:{key:r,message_id:o},signal:i}),peers:r=>n("/peers",{signal:r}),notifyStatus:r=>n("/notify",{signal:r}),setNotifyPaused:(r,o)=>n("/notify",{method:"POST",body:{paused:r},signal:o}),accountAgents:r=>n("/account/agents",{signal:r}),directory:(r,o)=>n(`/directory${s({limit:r.limit,offset:r.offset,q:r.q,capability:r.capability})}`,{signal:o}),unread:r=>n("/unread",{signal:r}),provision:(r,o)=>n("/provision",{method:"POST",body:r,signal:o}),migrate:(r,o)=>n("/migrate",{method:"POST",body:r,signal:o}),setup:(r,o)=>n("/setup",{method:"POST",body:r,signal:o}),resolve:(r,o)=>n("/resolve",{method:"POST",body:{address:r},signal:o})}}function Ie(e){return e instanceof Error?e.message:String(e)}var Kb={status:"loading",error:null,notice:null,cwd:null,owner:null,setup:{busy:!1,error:null,dismissed:!1},apiUrl:"",stateFile:"",workspaces:[],currentKey:null,tab:"inbox",folder:"all",messages:[],messagesTotal:0,unreadCount:0,unreadByKey:{},unreadTotal:0,totalByKey:{},outbox:[],outboxTotal:0,contacts:[],contactsTotal:0,peers:[],accountAgents:[],accountOrg:null,groups:[],selectedGroup:null,groupDetail:null,groupArchive:[],groupArchiveTotal:0,directory:[],directoryTotal:0,directoryQuery:"",directoryCapability:null,selectedAgent:null,selectedId:null,selectedContact:null,composeOpen:!1,compose:{to:"",subject:"",text:""},notifyPaused:!1,busy:{overview:!1,messages:!1,outbox:!1,contacts:!1,directory:!1,archive:!1,send:!1,action:!1},loadedAt:null};function Jb(e){let t=new Set;return e.filter(a=>t.has(a.message_id)?!1:(t.add(a.message_id),!0))}function oo(e={}){let t=e.bridge??ws(e),a=e.pollMs??2e4,n=Kb,s=new Set,r=null,o,i,l=0,u=0,c=0,p=0,f=0,g=0,h,w,j=0,L,k=()=>n,$=_=>{n={...n,..._};for(let S of[...s])S()},R=_=>$({busy:{...n.busy,..._}});function T(_,S){$({notice:{kind:_,text:S}})}function O(_){if(_.currentKey)return _.workspaces.find(S=>S.key===_.currentKey)}function Q(_){let S=_.current?.key??null;return S!==r&&(r=S,S)?S:n.currentKey&&_.workspaces.some(E=>E.key===n.currentKey)?n.currentKey:_.workspaces.find(E=>E.provisioned)?.key??S??_.workspaces[0]?.key??null}async function Y(){let _=n.cwd??"";if(i&&o===_)return i;o=_;let S=++l,P=Oe(S);i=P;try{await P}finally{i===P&&(i=void 0)}}async function Oe(_){try{R({overview:!0});let S=await t.overview(n.cwd??void 0);if(_!==l)return;let P=Q(S);$({status:"ready",error:null,owner:S.owner,apiUrl:S.api_url,stateFile:S.state_file,workspaces:S.workspaces,currentKey:P,loadedAt:Date.now()}),P&&(ee(),xe(),oe(),Ae())}catch(S){if(_!==l)return;$({status:n.workspaces.length===0?"error":"ready",error:Ie(S)})}finally{_===l&&R({overview:!1})}}async function ee(){let _=O(k());if(!_?.provisioned)return;let S=++u;try{R({messages:!0});let P=n.folder==="pending",E,ce=!1;try{E=await t.messages(_.key,{folder:P?"unprocessed":n.folder,limit:50,offset:0})}catch(se){if(!P)throw se;E=await t.messages(_.key,{folder:"all",limit:50,offset:0}),ce=!0}if(S!==u)return;let je=E.messages??[];$({messages:ce?je.filter(se=>!se.processed_by):je,messagesTotal:E.total??je.length,unreadCount:E.unread_count??0,loadedAt:Date.now()})}catch(P){S===u&&T("error",Ie(P))}finally{S===u&&R({messages:!1})}}async function xe(){let _=O(k());if(!_?.provisioned)return;let S=++c;try{R({outbox:!0});let P=await t.outbox(_.key,{limit:50,offset:0});if(S!==c)return;$({outbox:P.messages??[],outboxTotal:P.total??(P.messages??[]).length})}catch(P){S===c&&T("error",Ie(P))}finally{S===c&&R({outbox:!1})}}async function oe(){let _=O(k());if(!_?.provisioned)return;let S=++p;try{R({contacts:!0});let P=await t.contacts(_.key);if(S!==p)return;$({contacts:P.contacts??[],contactsTotal:P.total??(P.contacts??[]).length})}catch(P){S===p&&T("error",Ie(P))}finally{S===p&&R({contacts:!1})}}async function Ae(){if(h)return h;let _=(async()=>{try{let S=await t.unread();$({unreadByKey:S.byKey??{},unreadTotal:S.total??0,totalByKey:S.totalByKey??{}})}catch{}})();h=_;try{await _}finally{h===_&&(h=void 0)}}async function We(){try{let _=await t.peers();$({peers:_.peers??[]})}catch{}}async function we(){if(n.owner)try{let _=await t.accountAgents();$({accountAgents:_.agents??[],accountOrg:_.org_id||_.org_label?{id:_.org_id??null,label:_.org_label??null}:null})}catch{}}async function _e(){let _=O(k());if(!_?.provisioned)return;let S=++f;try{let P=await t.groups(_.key);if(S!==f)return;$({groups:P.groups??[]})}catch{}}async function bt(_=!1){let S=O(k()),P=n.selectedGroup;if(!S?.provisioned||!P||_&&n.busy.archive)return;let E=++f,ce=_?n.groupArchive:[];try{R({archive:!0});let je=await t.groupMessages(S.key,P,{limit:50,offset:ce.length});if(E!==f)return;let se=je.messages??[];$({groupArchive:Jb(_?[...ce,...se]:se),groupArchiveTotal:je.total??se.length})}catch{}finally{E===f&&R({archive:!1})}}async function At(_=!1){let S=++g,P=_?n.directory:[];try{R({directory:!0});let E=await t.directory({limit:100,offset:P.length,...n.directoryQuery.trim()?{q:n.directoryQuery.trim()}:{},...n.directoryCapability?{capability:n.directoryCapability}:{}});if(S!==g)return;let ce=E.agents??[];$({directory:_?[...P,...ce]:ce,directoryTotal:E.total??ce.length})}catch(E){S===g&&T("error",Ie(E))}finally{S===g&&R({directory:!1})}}async function Pt(_){let S=O(k());if(!S)return;let P=n.messages,E=n.unreadCount,ce=S.key,je=n.folder;$({messages:P.map(se=>se.message_id===_?{...se,read_at:new Date().toISOString()}:se),unreadCount:Math.max(0,n.unreadCount-1)});try{await t.markRead(S.key,_),Ae()}catch(se){let Je=k();Je.currentKey===ce&&Je.folder===je&&$({messages:P,unreadCount:E}),T("error",Ie(se))}}async function ea(){await Y(),We(),we()}function Ta(){L===void 0&&(L=setInterval(()=>{typeof document<"u"&&document.visibilityState==="hidden"||Ae()},a))}return{getState:k,subscribe(_){return s.add(_),()=>{s.delete(_)}},start(){j+=1;let _,S=0,P=`${(e.base??"/dsh-msg9").replace(/\/+$/,"")}/events`;return typeof EventSource<"u"?(_=new EventSource(P),_.onmessage=()=>{S=0,Ae()},_.onerror=()=>{S+=1,S>=3&&(_?.close(),_=void 0,Ta())}):Ta(),Ae(),()=>{j-=1,_?.close(),j<=0&&L!==void 0&&(clearInterval(L),L=void 0,j=0)}},setCwd(_){let S=_??null;S!==n.cwd&&(r=null,$({cwd:S}),S&&Y())},setTab(_){$({tab:_}),_==="inbox"&&ee(),_==="outbox"&&xe(),_==="contacts"&&(oe(),we()),_==="groups"&&_e(),_==="square"&&At()},setFolder(_){$({folder:_}),ee()},selectWorkspace(_){_!==n.currentKey&&($({currentKey:_,selectedId:null,selectedContact:null,selectedGroup:null,composeOpen:!1,messages:[],outbox:[],contacts:[],messagesTotal:0,unreadCount:0,outboxTotal:0,contactsTotal:0}),ee(),xe(),oe(),_e())},selectMessage(_){if($({selectedId:_,composeOpen:!1}),!_)return;let S=n.messages.find(P=>P.message_id===_);S&&!S.read_at&&Pt(_)},selectContact(_){$({selectedContact:_,composeOpen:!1})},selectAgent(_){$({selectedAgent:_,composeOpen:!1})},selectGroup(_){$({selectedGroup:_,groupDetail:null,groupArchive:[],groupArchiveTotal:0,composeOpen:!1});let S=O(k());!_||!S||(t.groupDetail(S.key,_).then(P=>{k().selectedGroup===_&&$({groupDetail:P.group})}).catch(()=>{}),bt())},setDirectoryQuery(_){_!==n.directoryQuery&&($({directoryQuery:_}),At())},setDirectoryCapability(_){_!==n.directoryCapability&&($({directoryCapability:_}),At())},async loadMoreDirectory(){n.busy.directory||n.directory.length>=n.directoryTotal||await At(!0)},setCompose(_){w=void 0,$({compose:{...n.compose,..._}})},openCompose(_){w=void 0,$({composeOpen:!0,compose:_?{...n.compose,..._}:{...n.compose,replyTo:void 0,correlationId:void 0}})},closeCompose(){$({composeOpen:!1})},composeTo(_){w=void 0,$({composeOpen:!0,compose:{...n.compose,to:_,replyTo:void 0,correlationId:void 0}})},replyTo(_){w=void 0,$({composeOpen:!0,compose:{...n.compose,to:_.list_address??_.from_address,replyTo:_.message_id,..._.correlation_id?{correlationId:_.correlation_id}:{correlationId:void 0}}})},clearNotice(){$({notice:null})},refreshOverview:Y,refreshInbox:ee,refreshOutbox:xe,refreshContacts:oe,refreshUnread:Ae,refreshPeers:We,refreshAccountAgents:we,refreshGroups:_e,refreshGroupArchive:bt,async refreshNotifyStatus(){try{let _=await t.notifyStatus();$({notifyPaused:_.paused})}catch{}},async toggleNotify(){try{let _=await t.setNotifyPaused(!n.notifyPaused);$({notifyPaused:_.paused}),T("ok",_.paused?x("\u5DF2\u9759\u97F3\uFF1A\u65B0\u90AE\u4EF6\u4E0D\u518D\u6253\u65AD\u4F1A\u8BDD","Paused: mail no longer interrupts sessions"):x("\u5DF2\u6062\u590D\u65B0\u90AE\u4EF6\u63D0\u9192","New-mail wake-ups resumed"))}catch(_){T("error",Ie(_))}},refreshDirectory:At,refreshAll:ea,async send(){let _=O(k()),{to:S,subject:P,text:E,replyTo:ce,correlationId:je}=n.compose;if(!_)return T("error",x("\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A workspace\u3002","Select a workspace first."));if(!_.provisioned)return T("error",x("\u8BE5 workspace \u8FD8\u6CA1\u6709\u6536\u4EF6\u7BB1\u3002","This workspace has no inbox yet."));if(!S.trim())return T("error",x("\u8BF7\u586B\u5199\u6536\u4EF6\u4EBA\u5730\u5740\u3002","Enter a recipient address."));if(!E.trim())return T("error",x("\u8BF7\u586B\u5199\u6D88\u606F\u6B63\u6587\u3002","Enter a message body."));try{R({send:!0}),w??=`dsh-ui-${Date.now()}-${Math.random().toString(36).slice(2,10)}`;let se=await t.send({key:_.key,to:S.trim(),text:E,...P.trim()?{subject:P.trim()}:{},...ce?{reply_to:ce}:{},...je?{correlation_id:je}:{},idempotency_key:w});w=void 0,ce&&$({messages:n.messages.map(Je=>Je.message_id===ce?{...Je,processed_by:"human"}:Je)}),$({compose:{to:"",subject:"",text:""},composeOpen:!1}),T("ok",x("\u5DF2\u53D1\u9001\u5230 {to}\uFF08{id}\uFF09","Sent to {to} ({id})",{to:S,id:se.message_id})),xe(),Ae()}catch(se){T("error",Ie(se))}finally{R({send:!1})}},async markDone(_){let S=O(k());if(!S)return;let P=n.messages,E=n.unreadCount,ce=S.key,je=n.folder,se=P.find(Qe=>Qe.message_id===_),Je=new Date().toISOString();$({messages:P.map(Qe=>Qe.message_id===_?{...Qe,read_at:Qe.read_at??Je,processed_by:"human"}:Qe),unreadCount:se&&!se.read_at?Math.max(0,n.unreadCount-1):n.unreadCount});try{await t.markDone(S.key,_),Ae()}catch(Qe){let yn=k();yn.currentKey===ce&&yn.folder===je&&$({messages:P,unreadCount:E}),T("error",Ie(Qe))}},async markRead(_){await Pt(_)},async addContact(_){let S=O(k());if(!S)return!1;try{return R({action:!0}),await t.addContact({key:S.key,..._}),T("ok",x("\u5DF2\u6DFB\u52A0\u8054\u7CFB\u4EBA {contact}","Contact added: {contact}",{contact:_.contact})),await oe(),!0}catch(P){return T("error",Ie(P)),!1}finally{R({action:!1})}},async removeContact(_){let S=O(k());if(S)try{R({action:!0}),await t.removeContact(S.key,_),T("ok",x("\u5DF2\u5220\u9664\u8054\u7CFB\u4EBA {contact}","Contact removed: {contact}",{contact:_})),await oe()}catch(P){T("error",Ie(P))}finally{R({action:!1})}},async provision(){let _=O(k());if(!_&&!n.cwd)return T("error",x("\u8FD8\u4E0D\u77E5\u9053\u5F53\u524D workspace \u7684\u76EE\u5F55\u3002","The current workspace directory is unknown."));try{R({action:!0});let S=await t.provision({..._?{key:_.key,title:_.title}:{},...n.cwd?{cwd:n.cwd}:{}});T("ok",S.provisioned?x("\u5DF2\u5F00\u901A\u6536\u4EF6\u7BB1 {address}","Inbox opened: {address}",{address:S.address}):x("\u6536\u4EF6\u7BB1\u5DF2\u5B58\u5728\uFF1A{address}","Inbox already open: {address}",{address:S.address})),await Y()}catch(S){T("error",Ie(S))}finally{R({action:!1})}},async migrate(_,S){try{R({action:!0});let P=await t.migrate({key:_,...S?.trim()?{old_owner_key:S.trim()}:{}}),E=[x("\u5DF2\u8FC1\u79FB\u5230 {address}","Migrated to {address}",{address:P.new_address}),P.forwarding?x("\u65E7\u5730\u5740\u5DF2\u8BBE\u7F6E\u8F6C\u53D1","old address forwards here"):null,P.moved_mail!==null&&P.moved_mail!==void 0?x("\u642C\u5165 {n} \u5C01\u5386\u53F2\u90AE\u4EF6","{n} old message(s) moved",{n:P.moved_mail}):null,P.old_disabled?x("\u65E7\u6536\u4EF6\u7BB1\u5DF2\u505C\u7528","old inbox suspended"):null].filter(Boolean).join("\uFF0C");return P.note?T("ok",`${E}\u3002${P.note}`):T("ok",E),await Y(),P}catch(P){return T("error",Ie(P)),null}finally{R({action:!1})}},async bindOwner(_,S){let P=_.trim();if(P){$({setup:{...n.setup,busy:!0,error:null}});try{let E=await t.setup(S?{owner_key:P,api_url:S}:{owner_key:P});$({owner:E.owner,apiUrl:E.api_url,setup:{busy:!1,error:null,dismissed:!1}}),T("ok",E.owner.slug?x("\u5DF2\u7ED1\u5B9A\u79DF\u6237 {name}\uFF08{domain}\uFF09","Tenant connected: {name} ({domain})",{name:E.owner.name??E.owner.id??"owner",domain:`${E.owner.slug}.${E.owner.mail_domain??"msg9.io"}`}):x("\u5DF2\u7ED1\u5B9A\u79DF\u6237 {name}","Tenant connected: {name}",{name:E.owner.name??E.owner.id??"owner"})),await ea()}catch(E){$({setup:{busy:!1,error:Ie(E),dismissed:!1}})}}},dismissSetup(){$({setup:{...n.setup,dismissed:!0,error:null}})}}}var Sd;function $s(e){return Sd??=oo(e),Sd}function Yt(e){if(e.currentKey)return e.workspaces.find(t=>t.key===e.currentKey)}var Ke="var(--dsw-alias-label-primary, #1f2328)",G="var(--dsw-alias-label-secondary, #6b7280)",io="var(--dsw-alias-bg-layer-2, #ffffff)",Id="var(--dsw-alias-bg-layer-1, #f5f7fa)",he="var(--dsw-alias-border-l1, rgba(28,35,51,0.12))",Ia="var(--dsw-alias-border-l2, rgba(28,35,51,0.20))",ge="var(--dsw-alias-brand-primary, #2d66f7)",gn="var(--dsw-alias-interactive-bg-hover, rgba(28,35,51,0.06))",hn="var(--dsw-specific-sidebar-nav-item-active, rgba(45,102,247,0.12))",Qb=`url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="6" viewBox="0 0 10 6" fill="none"><path d="M1 1l4 4 4-4" stroke="%23787887" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>')`,It=`
|
|
228
228
|
.m9-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid ${Ia}; border-radius: 8px; background: transparent; color: inherit; padding: 5px 10px; font-size: 12px; font-family: inherit; line-height: 1.4; cursor: pointer; }
|
|
229
229
|
.m9-btn:hover { background: ${gn}; }
|
|
230
230
|
.m9-btn:disabled { opacity: 0.55; cursor: default; }
|
|
@@ -287,7 +287,9 @@ XID_Start XIDS`.split(/\s/).map(e=>[ja(e),e])),tb=new Map([["s",fe(383)],[fe(383
|
|
|
287
287
|
.m9-nav { width: 148px !important; }
|
|
288
288
|
.m9-listcol { width: 250px !important; }
|
|
289
289
|
}
|
|
290
|
-
`;function lo(e){let t=e?.body;return typeof t=="string"?t:t&&typeof t=="object"&&typeof t.text=="string"?t.text:""}function uo(e,t){let a=e.replace(/\s+/g," ").trim();return a.length>t?`${a.slice(0,t)}\u2026`:a}function co(e,t=90){let a=lo(e);return a?uo(a,t):e.subject?uo(e.subject,t):x("\uFF08\u7A7A\u6D88\u606F\uFF09","(empty message)")}function po(e){return lo(e)||x("\uFF08\u7A7A\u6D88\u606F\uFF09","(empty message)")}function mo(e){return!e.read_at}function Aa(e){if(!e)return"";let t=new Date(e);if(Number.isNaN(t.getTime()))return e;try{return t.toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return t.toISOString()}}function Cs(e){return e.alias?.trim()||e.contact}function nt(e){return!Number.isFinite(e)||e<=0?"":e>99?"99+":String(Math.trunc(e))}function Ad(e,t){let a=t.trim().toLowerCase();return a?e.filter(n=>`${n.alias??""} ${n.contact} ${n.notes??""}`.toLowerCase().includes(a)):e}function fo(e){return e.display_name?.trim()||e.address}var Pd=["all","unread","read","pending"];function Td(e){return e==="unread"?x("\u672A\u8BFB","Unread"):e==="read"?x("\u5DF2\u8BFB","Read"):e==="pending"?x("\u5F85\u5904\u7406","Pending"):x("\u5168\u90E8","All")}function Rd(e){return e.processed_by?e.processed_by==="human"?x("\u4EBA\u5DF2\u5904\u7406","Handled by you"):x("Agent \u5DF2\u5904\u7406","Handled by agent"):""}var d=require("react/jsx-runtime");function Yb(e){let t=e.useSessions,a=(0,J.useCallback)(s=>{let r=s?.current;if(r)return s?.byId?.[r]?.cwd},[]),n=typeof t=="function"?t(a):void 0;return typeof n=="string"?n:void 0}function Ls(e){let{store:t}=e,a=(0,J.useSyncExternalStore)(t.subscribe,t.getState,t.getState),n=Yb(e);(0,J.useEffect)(()=>{t.setCwd(n??null)},[t,n]);let[,s]=(0,J.useState)(0);(0,J.useEffect)(()=>{let i=!0;return xs.then(()=>{i&&s(l=>l+1)}),()=>{i=!1}},[]),(0,J.useEffect)(()=>{t.refreshAll(),t.refreshNotifyStatus()},[t]);let r=Yt(a);return a.status==="loading"?(0,d.jsxs)("div",{style:b.root,children:[(0,d.jsx)("style",{children:It}),(0,d.jsx)("div",{style:b.empty,children:(0,d.jsx)("p",{style:b.emptyText,children:x("\u6B63\u5728\u52A0\u8F7D msg9 \u72B6\u6001\u2026","Loading msg9 state\u2026")})})]}):!a.owner&&!a.setup.dismissed?(0,d.jsxs)("div",{style:b.root,children:[(0,d.jsx)("style",{children:It}),(0,d.jsx)(bn,{state:a,store:t})]}):a.status==="error"&&a.error?(0,d.jsxs)("div",{style:b.root,children:[(0,d.jsx)("style",{children:It}),(0,d.jsxs)("div",{style:b.errorBlock,children:[(0,d.jsx)("div",{children:x("\u65E0\u6CD5\u8BFB\u53D6 msg9 \u72B6\u6001\uFF1A{error}","Cannot read msg9 state: {error}",{error:a.error})}),a.cwd&&!r?.provisioned&&(0,d.jsx)("button",{type:"button",className:"m9-btn m9-btn-primary",onClick:()=>void t.provision(),children:x("\u4E3A\u5F53\u524D workspace \u5F00\u901A\u6536\u4EF6\u7BB1","Open an inbox for this workspace")})]})]}):!r||!r.provisioned?(0,d.jsxs)("div",{style:b.root,children:[(0,d.jsx)("style",{children:It}),(0,d.jsx)(Ed,{state:a,store:t}),r?(0,d.jsx)(Md,{text:x("\u300C{title}\u300D\u8FD8\u6CA1\u6709 msg9 \u6536\u4EF6\u7BB1\u3002\u5F00\u901A\u540E\u4F1A\u5F97\u5230\u4E00\u4E2A\u5730\u5740\uFF08\u4F8B\u5982 {address}\uFF09\uFF0C\u5176\u4ED6 workspace \u548C Agent \u5C31\u80FD\u7ED9\u5B83\u53D1\u6D88\u606F\u3002",'"{title}" has no msg9 inbox yet. Opening one assigns an address (for example {address}) that other workspaces and agents can message.',{title:r.title,address:r.planned_address??"dsh-\u2026@msg9.io"}),actionLabel:x("\u5F00\u901A\u6536\u4EF6\u7BB1","Open inbox"),onAction:()=>void t.provision()}):(0,d.jsx)(Md,{text:x("\u8FD8\u6CA1\u6709\u53EF\u7528\u7684 workspace \u6536\u4EF6\u7BB1\u3002\u56DE\u5230\u5BF9\u8BDD\u91CC\u8BA9 Agent \u8FD0\u884C\u4E00\u6B21 msg9_inbox\uFF0C\u6216\u5728\u8FD9\u91CC\u5F00\u901A\u5F53\u524D workspace \u7684\u6536\u4EF6\u7BB1\u3002","No workspace inbox yet. Ask the agent to run msg9_inbox in a session, or open this workspace's inbox here."),actionLabel:a.cwd?x("\u5F00\u901A\u6536\u4EF6\u7BB1","Open inbox"):void 0,onAction:()=>void t.provision()})]}):(0,d.jsxs)("div",{style:b.root,children:[(0,d.jsx)("style",{children:It}),(0,d.jsx)(Ed,{state:a,store:t}),(0,d.jsxs)("div",{style:b.columns,children:[(0,d.jsx)(ey,{state:a,store:t}),(0,d.jsx)(ty,{state:a,store:t}),(0,d.jsx)(ay,{state:a,store:t})]})]})}function ey({state:e,store:t}){let a=Yt(e),n=[{id:"inbox",label:x("\u6536\u4EF6\u7BB1","Inbox"),badge:nt(e.unreadCount),icon:(0,d.jsx)(ha,{size:15})},{id:"outbox",label:x("\u53D1\u4EF6\u7BB1","Outbox"),badge:nt(e.outboxTotal),icon:(0,d.jsx)(Ge,{size:15})},{id:"contacts",label:x("\u8054\u7CFB\u4EBA","Contacts"),badge:nt(e.contactsTotal),icon:(0,d.jsx)(ka,{size:15})},{id:"groups",label:x("\u7FA4\u7EC4","Groups"),badge:nt(e.groups.length),icon:(0,d.jsx)(ya,{size:15})},{id:"square",label:x("\u5E7F\u573A","Square"),badge:nt(e.directoryTotal),icon:(0,d.jsx)(ga,{size:15})}];return(0,d.jsxs)("nav",{style:b.nav,className:"m9-nav",children:[(0,d.jsx)("select",{className:"m9-select",value:e.currentKey??"",onChange:s=>t.selectWorkspace(s.target.value),title:x("\u5207\u6362 workspace \u6536\u4EF6\u7BB1","Switch workspace inbox"),children:e.workspaces.map(s=>(0,d.jsxs)("option",{value:s.key,children:[s.title,s.provisioned?"":x("\uFF08\u672A\u5F00\u901A\uFF09"," (no inbox)")]},s.key))}),(0,d.jsx)("div",{style:b.navAddress,title:a?.address??"",children:a?.address}),(0,d.jsxs)("div",{style:b.composeRow,children:[(0,d.jsxs)("button",{type:"button",className:"m9-btn m9-btn-primary",style:b.composeButton,onClick:()=>t.openCompose(),children:[(0,d.jsx)(ot,{size:13}),x("\u5199\u6D88\u606F","Compose")]}),(0,d.jsx)("button",{type:"button",className:"m9-iconbtn",style:b.bellButton,onClick:()=>void t.toggleNotify(),title:e.notifyPaused?x("\u65B0\u90AE\u4EF6\u63D0\u9192\u5DF2\u9759\u97F3\uFF08\u4F1A\u8BDD\u4E0D\u88AB\u6253\u65AD\uFF09\uFF0C\u70B9\u51FB\u6062\u590D","Wake-ups paused (sessions never interrupted) \u2014 click to resume"):x("\u65B0\u90AE\u4EF6\u63D0\u9192\u5F00\u542F\u4E2D\uFF0C\u70B9\u51FB\u9759\u97F3","Wake-ups on \u2014 click to pause"),children:e.notifyPaused?(0,d.jsx)(ma,{size:14,style:b.bellMuted}):(0,d.jsx)(fa,{size:14})})]}),(0,d.jsx)("div",{style:b.navItems,children:n.map(s=>(0,d.jsxs)("button",{type:"button",className:s.id===e.tab&&!e.composeOpen?"m9-nav-item active":"m9-nav-item",onClick:()=>t.setTab(s.id),children:[s.icon,(0,d.jsx)("span",{children:s.label}),s.badge?(0,d.jsx)("span",{style:b.navBadge,children:s.badge}):null]},s.id))}),(0,d.jsxs)("div",{style:b.navFooter,children:[(0,d.jsx)("button",{type:"button",className:"m9-iconbtn",onClick:()=>void t.refreshAll(),title:x("\u5237\u65B0","Refresh"),children:(0,d.jsx)(xa,{size:13,className:e.busy.overview?"m9-spin":void 0})}),(0,d.jsx)("span",{style:b.navTenant,children:e.owner?.slug?e.owner.address_domain??`${e.owner.slug}.${e.owner.mail_domain??"msg9.io"}`:e.owner?.name??x("\u516C\u5F00\u6CE8\u518C","public registration")})]})]})}function ty({state:e,store:t}){if(e.tab==="contacts")return(0,d.jsx)(oy,{state:e,store:t});if(e.tab==="groups")return(0,d.jsx)(uy,{state:e,store:t});if(e.tab==="square")return(0,d.jsx)(gy,{state:e,store:t});let a=e.tab==="outbox",n=a?e.outbox:e.messages,s=a?e.outboxTotal:e.messagesTotal;return(0,d.jsxs)("section",{style:b.listCol,className:"m9-listcol",children:[e.tab==="inbox"&&(0,d.jsx)("div",{style:b.folderRow,children:Pd.map(r=>(0,d.jsx)("button",{type:"button",className:r===e.folder?"m9-chip active":"m9-chip",onClick:()=>t.setFolder(r),children:Td(r)},r))}),(0,d.jsx)(ny,{messages:n,selectedId:e.selectedId,empty:a?x("\u8FD8\u6CA1\u6709\u5DF2\u53D1\u9001\u7684\u6D88\u606F\u3002","Nothing sent yet."):x("\u6536\u4EF6\u7BB1\u662F\u7A7A\u7684\u3002","The inbox is empty."),loading:a?e.busy.outbox:e.busy.messages,store:t,outgoing:a}),s>n.length&&(0,d.jsx)("div",{style:b.listHint,children:x("\u4EC5\u663E\u793A\u524D {shown} \u5C01\uFF0C\u5171 {total} \u5C01","Showing the first {shown} of {total} messages",{shown:n.length,total:s})})]})}function ay({state:e,store:t}){if(e.composeOpen)return(0,d.jsx)(ry,{state:e,store:t});if(e.tab==="contacts")return(0,d.jsx)(ly,{state:e,store:t});if(e.tab==="groups")return(0,d.jsx)(cy,{state:e,store:t});if(e.tab==="square")return(0,d.jsx)(hy,{state:e,store:t});let n=(e.tab==="outbox"?e.outbox:e.messages).find(s=>s.message_id===e.selectedId);return(0,d.jsx)("section",{style:b.detailCol,children:(0,d.jsx)(sy,{message:n,store:t})})}function bn({state:e,store:t}){let[a,n]=(0,J.useState)(""),[s,r]=(0,J.useState)(e.apiUrl||""),o=e.setup.busy;return(0,d.jsxs)("form",{style:b.setup,onSubmit:i=>{i.preventDefault(),!(!a.trim()||o)&&t.bindOwner(a,s.trim()||void 0)},children:[(0,d.jsx)("div",{style:b.setupTitle,children:x("\u8FDE\u63A5 msg9\uFF1A\u7ED9\u6BCF\u4E2A workspace \u4E00\u4E2A Agent \u4FE1\u7BB1","Connect msg9: an inbox for every workspace agent")}),(0,d.jsx)("div",{style:b.setupHint,children:x("msg9 \u662F\u7ED9 Agent \u7528\u7684\u6D88\u606F\u670D\u52A1\uFF1A\u6BCF\u4E2A dsh workspace \u5F97\u5230\u4E00\u4E2A\u90AE\u7BB1\u5730\u5740\uFF0Cworkspace \u4E4B\u95F4\u3001\u4EE5\u53CA\u548C\u5176\u4ED6 Agent\uFF08Kimi Code\u3001Claude Code\u2026\uFF09\u7528\u90AE\u4EF6\u534F\u4F5C\u3002\u4E24\u6761\u8DEF\uFF0C\u4EE5\u540E\u968F\u65F6\u5207\u6362\uFF1A","msg9 is messaging for agents: every dsh workspace gets an address, so workspaces \u2014 and other agents (Kimi Code, Claude Code\u2026) \u2014 collaborate by mail. Two ways in, switchable any time:")}),(0,d.jsxs)("div",{style:b.setupPath,children:[(0,d.jsx)("div",{style:b.setupPathTitle,children:x("\u65B9\u5F0F A \xB7 \u7ED1\u5B9A\u79DF\u6237\uFF08\u63A8\u8350\uFF09","Path A \xB7 Bind a tenant (recommended)")}),(0,d.jsxs)("ol",{style:b.setupSteps,children:[(0,d.jsx)("li",{children:x("\u6253\u5F00 msg9.io\uFF0C\u6CE8\u518C / \u767B\u5F55\u8D26\u53F7","Open msg9.io and sign up / log in")}),(0,d.jsx)("li",{children:x("\u8FDB\u5165 Account \u9875\uFF0C\u521B\u5EFA\u4E00\u4E2A\u79DF\u6237\uFF08tenant\uFF09","Go to the Account page and create a tenant")}),(0,d.jsx)("li",{children:x("\u590D\u5236\u79DF\u6237 key\uFF08msg9_tk_\u2026\uFF0C\u53EA\u663E\u793A\u4E00\u6B21\uFF09\u7C98\u8D34\u5230\u4E0B\u9762","Copy the tenant key (msg9_tk_\u2026, shown once) and paste it below")})]}),(0,d.jsx)("div",{style:b.setupHintDim,children:x("\u597D\u5904\uFF1A\u6BCF\u4E2A workspace \u5F97\u5230 {example} \u8FD9\u6837\u7684\u77ED\u5730\u5740\u3001\u79DF\u6237\u72EC\u7ACB\u914D\u989D\u3001\u53EF\u505C\u7528 / \u8F6E\u6362 / \u8FC1\u79FB\u4FE1\u7BB1\u3002","You get short addresses like {example}, a dedicated quota, and lifecycle control (suspend / rotate / migrate).",{example:"looploop@you.msg9.io"})})]}),(0,d.jsxs)("label",{style:b.setupLabel,children:[x("\u79DF\u6237 key","Tenant key"),(0,d.jsx)("input",{className:"m9-input",type:"password",value:a,autoComplete:"off",spellCheck:!1,placeholder:"msg9_tk_\u2026",onChange:i=>n(i.target.value)})]}),(0,d.jsxs)("label",{style:b.setupLabel,children:[x("API \u5730\u5740\uFF08\u53EF\u9009\uFF0C\u81EA\u5EFA msg9 \u65F6\u586B\uFF09","API base (optional \u2014 only for self-hosted msg9)"),(0,d.jsx)("input",{className:"m9-input",value:s,autoComplete:"off",spellCheck:!1,placeholder:"https://api.msg9.io",onChange:i=>r(i.target.value)})]}),e.setup.error&&(0,d.jsx)("div",{style:b.setupError,children:e.setup.error}),(0,d.jsxs)("div",{style:b.setupActions,children:[(0,d.jsx)("button",{type:"submit",className:"m9-btn m9-btn-primary",disabled:o||!a.trim(),children:o?x("\u6821\u9A8C\u4E2D\u2026","Checking\u2026"):x("\u7ED1\u5B9A\u79DF\u6237","Connect tenant")}),(0,d.jsx)("button",{type:"button",className:"m9-btn",onClick:()=>t.dismissSetup(),children:x("\u6682\u4E0D\u7ED1\u5B9A","Skip for now")})]}),(0,d.jsxs)("div",{style:b.setupPath,children:[(0,d.jsx)("div",{style:b.setupPathTitle,children:x("\u65B9\u5F0F B \xB7 \u6CA1\u6709\u8D26\u53F7\uFF1F\u70B9\u300C\u6682\u4E0D\u7ED1\u5B9A\u300D\u5148\u7528\u8D77\u6765",'Path B \xB7 No account? Hit "Skip for now" and start')}),(0,d.jsx)("div",{style:b.setupHintDim,children:x("\u6BCF\u4E2A workspace \u9996\u6B21\u4F7F\u7528\u65F6\u81EA\u52A8\u516C\u5F00\u6CE8\u518C\u4E00\u4E2A @msg9.io \u5730\u5740\uFF0C\u7ACB\u523B\u5C31\u80FD\u6536\u53D1\u2014\u2014\u4E0D\u9700\u8981\u4EFB\u4F55 key\u3002\u4EE3\u4EF7\uFF1A\u5730\u5740\u8F83\u957F\uFF08\u5F62\u5982 dsh-xxx-1a2b@msg9.io\uFF09\u3001\u4E0E\u4ED6\u4EBA\u5171\u4EAB\u9650\u6D41\u3001\u6CA1\u6709\u79DF\u6237\u7EA7\u7684\u914D\u989D\u4E0E\u751F\u547D\u5468\u671F\u7BA1\u7406\u3002\u4EE5\u540E\u968F\u65F6\u53EF\u56DE\u5230\u8FD9\u91CC\u7ED1\u5B9A\uFF08\u8BBE\u7F6E \u2192 \u6D88\u606F\u4FE1\u7BB1\uFF0C\u6216\u672C\u9875\uFF09\u3002","Each workspace self-registers a @msg9.io address on first use and can mail right away \u2014 no key needed. Trade-offs: longer addresses (like dsh-xxx-1a2b@msg9.io), shared rate limits, and no tenant-level quota or lifecycle control. Bind later any time (Settings \u2192 Messages, or right here).")})]})]})}function Ed({state:e,store:t}){if(!e.notice)return null;let a=e.notice.kind==="ok";return(0,d.jsxs)("div",{style:a?b.noticeOk:b.noticeError,children:[(0,d.jsx)("span",{children:e.notice.text}),(0,d.jsx)("button",{type:"button",className:"m9-iconbtn",onClick:()=>t.clearNotice(),title:x("\u5173\u95ED","Dismiss"),children:(0,d.jsx)(zt,{size:12})})]})}function Md({text:e,actionLabel:t,onAction:a}){return(0,d.jsxs)("div",{style:b.empty,children:[(0,d.jsx)("p",{style:b.emptyText,children:e}),t&&a&&(0,d.jsx)("button",{type:"button",className:"m9-btn m9-btn-primary",onClick:a,children:t})]})}function ny({messages:e,selectedId:t,empty:a,loading:n,store:s,outgoing:r}){return e.length===0?(0,d.jsx)("div",{style:b.listEmpty,children:n?x("\u52A0\u8F7D\u4E2D\u2026","Loading\u2026"):a}):(0,d.jsx)("ul",{style:b.list,children:e.map(o=>{let i=o.message_id===t,l=!r&&mo(o);return(0,d.jsx)("li",{children:(0,d.jsxs)("button",{type:"button",className:i?"m9-row active":"m9-row",onClick:()=>s.selectMessage(o.message_id),children:[(0,d.jsxs)("div",{style:b.rowTop,children:[o.processed_by?(0,d.jsx)(rt,{size:11,style:b.rowProcessed}):(0,d.jsx)("span",{style:l?b.rowUnreadDot:b.rowDot}),(0,d.jsx)("span",{style:l?b.rowPeerUnread:b.rowPeer,children:r?o.to_address:o.from_address}),o.list_address&&(0,d.jsx)("span",{style:b.groupTag,children:x("\u7EC4","group")}),(0,d.jsx)("span",{style:b.rowTime,children:Aa(o.created_at)})]}),o.subject?(0,d.jsx)("div",{style:l?b.rowSubjectUnread:b.rowSubject,children:o.subject}):null,(0,d.jsx)("div",{style:b.rowPreview,children:co(o)})]})},o.message_id)})})}W.use(mi({langPrefix:"language-",highlight:(e,t)=>Ld(e,t)}));function go(e){e.tagName==="A"&&(e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer"))}Ua.isSupported&&Ua.addHook("afterSanitizeAttributes",go);function Bd(e){let t=W.parse(e,{gfm:!0,breaks:!0});return Ua.isSupported?Ua.sanitize(t):t}function sy({message:e,store:t}){return e?(0,d.jsxs)("article",{style:b.detail,children:[(0,d.jsxs)("header",{style:b.detailHeader,children:[(0,d.jsx)("div",{style:b.detailSubject,children:e.subject||x("\uFF08\u65E0\u4E3B\u9898\uFF09","(no subject)")}),(0,d.jsxs)("div",{style:b.detailMeta,children:[(0,d.jsxs)("span",{style:b.detailAddresses,children:[e.from_address,(0,d.jsx)(pa,{size:11,style:b.metaArrow}),e.to_address??"\u2014"]}),e.list_address&&(0,d.jsxs)("span",{style:b.groupTag,title:x("\u7EC4\u90AE\u4EF6\uFF1A\u56DE\u590D\u5C06\u53D1\u5230\u7EC4","Group mail: replies go to the group"),children:[x("\u7EC4","group")," \xB7 ",e.list_address]}),(0,d.jsx)("span",{style:b.metaTime,children:Aa(e.created_at)}),e.verified===!0&&(0,d.jsx)("span",{style:b.sigOk,title:e.key_id?`key ${e.key_id}`:void 0,children:x("\u7B7E\u540D\u5DF2\u9A8C\u8BC1","Signature verified")}),e.verified===!1&&(0,d.jsx)("span",{style:b.sigBad,title:e.key_id?`key ${e.key_id}`:void 0,children:x("\u7B7E\u540D\u65E0\u6548","Invalid signature")}),e.verified===void 0&&(0,d.jsx)("span",{style:b.sigNone,children:x("\u672A\u7B7E\u540D","Unsigned")})]}),(e.processed_by||e.read_by)&&(0,d.jsx)("div",{style:b.detailMeta,children:e.processed_by?(0,d.jsxs)("span",{style:b.processedTag,children:[(0,d.jsx)(rt,{size:11}),Rd(e),e.processed_at?` \xB7 ${Aa(e.processed_at)}`:""]}):e.read_by?(0,d.jsx)("span",{style:b.metaTime,children:e.read_by==="human"?x("\u4EBA\u5DF2\u8BFB","Read by you"):x("Agent \u5DF2\u8BFB","Read by agent")}):null}),(0,d.jsxs)("div",{style:b.detailActions,children:[mo(e)&&(0,d.jsxs)("button",{type:"button",className:"m9-btn",onClick:()=>void t.markRead(e.message_id),children:[(0,d.jsx)(rt,{size:12}),x("\u6807\u8BB0\u5DF2\u8BFB","Mark read")]}),!e.processed_by&&(0,d.jsxs)("button",{type:"button",className:"m9-btn",onClick:()=>void t.markDone(e.message_id),children:[(0,d.jsx)(rt,{size:12}),x("\u6807\u4E3A\u5DF2\u5904\u7406","Mark handled")]}),(0,d.jsxs)("button",{type:"button",className:"m9-btn",onClick:()=>t.replyTo(e),children:[(0,d.jsx)(_a,{size:12}),e.list_address?x("\u56DE\u590D\u7EC4","Reply to group"):x("\u56DE\u590D","Reply")]}),(0,d.jsxs)("button",{type:"button",className:"m9-btn",onClick:()=>void navigator.clipboard?.writeText(e.message_id),title:e.message_id,children:[(0,d.jsx)(Ot,{size:12}),x("\u590D\u5236 ID","Copy id")]})]})]}),(0,d.jsx)("div",{className:"m9-md",dangerouslySetInnerHTML:{__html:Bd(po(e))}}),(0,d.jsx)("div",{style:b.detailId,children:e.message_id})]}):(0,d.jsx)("div",{style:b.detailEmpty,children:x("\u9009\u62E9\u4E00\u6761\u6D88\u606F\u67E5\u770B\u5185\u5BB9\u3002","Select a message to read it.")})}function ry({state:e,store:t}){let a=(0,J.useMemo)(()=>{let n=[];for(let s of e.contacts)n.push({address:s.contact,label:Cs(s)});for(let s of e.peers)n.some(r=>r.address===s.address)||n.push({address:s.address,label:s.title??x("\u540C\u79DF\u6237\u6536\u4EF6\u7BB1","sibling inbox")});return n},[e.contacts,e.peers]);return(0,d.jsxs)("section",{style:b.detailCol,children:[(0,d.jsxs)("div",{style:b.composerHead,children:[(0,d.jsx)("span",{style:b.detailSubject,children:e.compose.replyTo?x("\u56DE\u590D {id}","Reply to {id}",{id:e.compose.replyTo}):x("\u5199\u6D88\u606F","Compose")}),(0,d.jsx)("button",{type:"button",className:"m9-iconbtn",onClick:()=>t.closeCompose(),title:x("\u5173\u95ED","Close"),children:(0,d.jsx)(zt,{size:14})})]}),(0,d.jsxs)("label",{style:b.field,children:[(0,d.jsx)("span",{style:b.fieldLabel,children:x("\u6536\u4EF6\u4EBA","To")}),(0,d.jsx)("input",{className:"m9-input",list:"msg9-recipients",value:e.compose.to,placeholder:"peer@msg9.io",onChange:n=>t.setCompose({to:n.target.value})}),(0,d.jsx)("datalist",{id:"msg9-recipients",children:a.map(n=>(0,d.jsx)("option",{value:n.address,children:n.label},n.address))})]}),(0,d.jsxs)("label",{style:b.field,children:[(0,d.jsx)("span",{style:b.fieldLabel,children:x("\u4E3B\u9898","Subject")}),(0,d.jsx)("input",{className:"m9-input",value:e.compose.subject,onChange:n=>t.setCompose({subject:n.target.value})})]}),(0,d.jsxs)("label",{style:b.field,children:[(0,d.jsx)("span",{style:b.fieldLabel,children:x("\u6B63\u6587","Message")}),(0,d.jsx)("textarea",{className:"m9-textarea",rows:8,value:e.compose.text,onChange:n=>t.setCompose({text:n.target.value})})]}),(0,d.jsxs)("div",{style:b.composerActions,children:[(0,d.jsxs)("button",{type:"button",className:"m9-btn m9-btn-primary",disabled:e.busy.send,onClick:()=>void t.send(),children:[(0,d.jsx)(Ge,{size:12}),e.busy.send?x("\u53D1\u9001\u4E2D\u2026","Sending\u2026"):x("\u53D1\u9001","Send")]}),(0,d.jsx)("span",{style:b.composerHint,children:x("\u4EE5 {address} \u7684\u8EAB\u4EFD\u53D1\u9001","Sent as {address}",{address:Yt(e)?.address??"\u2014"})})]})]})}function oy({state:e,store:t}){let[a,n]=(0,J.useState)(""),s=(0,J.useMemo)(()=>Ad(e.contacts,a),[e.contacts,a]),r=(0,J.useMemo)(()=>{let o=new Map;for(let i of e.accountAgents){let l=o.get(i.owner_id)??{owner_id:i.owner_id,owner_name:i.owner_name,address_domain:i.address_domain,agents:[]};l.agents.push(i),o.set(i.owner_id,l)}return[...o.values()]},[e.accountAgents]);return(0,d.jsxs)("section",{style:b.listCol,className:"m9-listcol",children:[(0,d.jsxs)("div",{style:b.searchWrap,children:[(0,d.jsx)(Ft,{size:13,style:b.searchIcon}),(0,d.jsx)("input",{className:"m9-input",style:b.searchInput,placeholder:x("\u641C\u7D22\u8054\u7CFB\u4EBA","Search contacts"),value:a,onChange:o=>n(o.target.value)})]}),s.length===0?(0,d.jsx)("div",{style:b.listEmpty,children:e.busy.contacts?x("\u52A0\u8F7D\u4E2D\u2026","Loading\u2026"):x("\u6CA1\u6709\u8054\u7CFB\u4EBA\u3002","No contacts.")}):(0,d.jsx)("ul",{style:b.list,children:s.map(o=>(0,d.jsx)("li",{children:(0,d.jsxs)("button",{type:"button",className:o.contact===e.selectedContact?"m9-row active":"m9-row",onClick:()=>t.selectContact(o.contact),children:[(0,d.jsx)("div",{style:b.contactName,children:Cs(o)}),(0,d.jsx)("div",{style:b.rowPreview,children:o.contact})]})},o.id??o.contact))}),e.peers.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:b.listHeader,children:x("\u540C\u79DF\u6237\u6536\u4EF6\u7BB1","Sibling inboxes")}),(0,d.jsx)("ul",{style:b.list,children:e.peers.map(o=>(0,d.jsx)(fy,{peer:o,store:t},o.address))})]}),r.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:b.listHeader,children:e.accountOrg?.label?x("\u6211\u7684\u79DF\u6237\u7F51\u7EDC \xB7 {org}","My tenant network \xB7 {org}",{org:e.accountOrg.label}):x("\u6211\u7684\u79DF\u6237\u7F51\u7EDC","My tenant network")}),r.map(o=>(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{style:b.networkOwner,children:[o.owner_name," \xB7 ",o.address_domain]}),(0,d.jsx)("ul",{style:b.list,children:o.agents.map(i=>(0,d.jsx)(iy,{agent:i,state:e,store:t},i.address))})]},o.owner_id))]})]})}function iy({agent:e,state:t,store:a}){let n=t.contacts.some(s=>s.contact===e.address);return(0,d.jsxs)("li",{style:b.contactRow,title:e.description??e.address,children:[(0,d.jsxs)("div",{style:b.contactText,children:[(0,d.jsxs)("div",{style:b.contactName,children:[e.display_name??e.address,e.status!=="active"&&(0,d.jsx)("span",{style:b.statusTag,children:e.status})]}),(0,d.jsx)("div",{style:b.contactAddress,children:e.address}),e.capabilities?.length?(0,d.jsx)("div",{style:b.capsRow,children:e.capabilities.map(s=>(0,d.jsx)("span",{style:b.capChip,children:s},s))}):null]}),(0,d.jsxs)("div",{style:b.rowActions,children:[!n&&(0,d.jsx)("button",{type:"button",className:"m9-iconbtn",disabled:t.busy.action,onClick:()=>void a.addContact({contact:e.address,...e.display_name?.trim()?{alias:e.display_name.trim()}:{}}),title:x("\u52A0\u8054\u7CFB\u4EBA","Add contact"),children:(0,d.jsx)(Gt,{size:13})}),(0,d.jsx)("button",{type:"button",className:"m9-iconbtn",onClick:()=>a.composeTo(e.address),title:x("\u53D1\u6D88\u606F","Message"),children:(0,d.jsx)(Ge,{size:13})})]})]})}function ly({state:e,store:t}){let a=e.contacts.find(n=>n.contact===e.selectedContact);return(0,d.jsx)("section",{style:b.detailCol,children:a?(0,d.jsx)(py,{contact:a,store:t}):(0,d.jsx)(my,{state:e,store:t})})}function uy({state:e,store:t}){let a=Yt(e)?.address??null,n=e.groups.filter(o=>o.created_by&&o.created_by===a),s=e.groups.filter(o=>!(o.created_by&&o.created_by===a));if(e.groups.length===0)return(0,d.jsx)("section",{style:b.listCol,className:"m9-listcol",children:(0,d.jsx)("div",{style:b.listEmpty,children:x("\u8FD8\u6CA1\u6709\u52A0\u5165\u4EFB\u4F55\u7EC4\u3002\u7EC4\u662F\u591A\u4E2A Agent \u56F4\u7ED5\u8BDD\u9898\u8BA8\u8BBA\u7684\u5730\u65B9\uFF08msg9 v1.19\uFF09\u3002","No groups yet. Groups are where agents discuss a topic together (msg9 v1.19).")})});let r=o=>(0,d.jsx)("li",{children:(0,d.jsxs)("button",{type:"button",className:o.address===e.selectedGroup?"m9-row active":"m9-row",onClick:()=>t.selectGroup(o.address),children:[(0,d.jsxs)("div",{style:b.rowTop,children:[(0,d.jsx)("span",{style:b.agentName,children:o.display_name??o.address}),(0,d.jsx)("span",{style:b.knownTag,children:x("{n} \u4EBA","{n}",{n:o.member_count??0})})]}),(0,d.jsx)("div",{style:b.rowPreview,children:o.address})]})},o.address);return(0,d.jsxs)("section",{style:b.listCol,className:"m9-listcol",children:[n.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:b.listHeader,children:x("\u6211\u521B\u5EFA\u7684","Created by me")}),(0,d.jsx)("ul",{style:b.list,children:n.map(r)})]}),s.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:b.listHeader,children:x("\u6211\u52A0\u5165\u7684","Joined")}),(0,d.jsx)("ul",{style:b.list,children:s.map(r)})]})]})}function cy({state:e,store:t}){let a=e.groupDetail??e.groups.find(s=>s.address===e.selectedGroup);if(!e.selectedGroup||!a)return(0,d.jsx)("section",{style:b.detailCol,children:(0,d.jsx)("div",{style:b.detailEmpty,children:x("\u9009\u62E9\u4E00\u4E2A\u7EC4\u67E5\u770B\u8BE6\u60C5\u548C\u7EC4\u5185\u6D88\u606F\u3002","Select a group to see its details and messages.")})});let n=a.member_count??a.members?.length??0;return(0,d.jsxs)("section",{style:b.detailCol,children:[(0,d.jsx)("article",{style:b.detail,children:(0,d.jsxs)("header",{style:b.detailHeader,children:[(0,d.jsx)("div",{style:b.detailSubject,children:a.display_name??a.address}),(0,d.jsxs)("div",{style:b.detailMeta,children:[(0,d.jsx)("span",{style:b.detailAddresses,children:a.address}),(0,d.jsx)("span",{style:b.groupTag,children:a.open?x("\u5F00\u653E\u7EC4","open"):x("\u5C01\u95ED\u7EC4","closed")}),(0,d.jsx)("span",{style:b.metaTime,children:x("{n} \u540D\u6210\u5458","{n} members",{n})})]}),a.created_by?(0,d.jsx)("div",{style:b.detailMeta,children:(0,d.jsx)("span",{style:b.metaTime,children:x("\u7EC4\u4E3B\uFF1A{by}","Created by {by}",{by:a.created_by})})}):null,a.description?(0,d.jsx)("div",{style:b.agentDescription,children:a.description}):null,a.members?.length?(0,d.jsx)("div",{style:b.agentLinks,children:a.members.map(s=>(0,d.jsx)("span",{style:b.agentLink,children:s},s))}):null,(0,d.jsx)("div",{style:b.detailActions,children:(0,d.jsxs)("button",{type:"button",className:"m9-btn m9-btn-primary",onClick:()=>t.composeTo(a.address),children:[(0,d.jsx)(Ge,{size:12}),x("\u53D1\u4FE1\u5230\u7EC4","Message the group")]})})]})}),(0,d.jsx)(dy,{state:e,store:t})]})}function dy({state:e,store:t}){let[a,n]=(0,J.useState)(null),[s,r]=(0,J.useState)(!0),o=e.groupArchive.length<e.groupArchiveTotal,i=(0,J.useMemo)(()=>{let l=[...e.groupArchive];l.sort((p,f)=>{let h=Date.parse(p.created_at??"")||0,g=Date.parse(f.created_at??"")||0;return s?h-g:g-h});let u=[],c=new Map;for(let p of l){let f=p.correlation_id??p.message_id,h=c.get(f);if(h)h.copies+=1;else{let g={message:p,copies:1};c.set(f,g),u.push(g)}}return u},[e.groupArchive,s]);return(0,d.jsxs)("div",{style:b.groupArchive,children:[(0,d.jsxs)("div",{style:b.archiveHead,children:[(0,d.jsx)("span",{style:b.listHeader,children:x("\u7EC4\u5185\u6D88\u606F\uFF08{shown}/{total}\uFF09","Messages ({shown}/{total})",{shown:e.groupArchive.length,total:e.groupArchiveTotal})}),(0,d.jsxs)("span",{style:b.capsRow,children:[(0,d.jsx)("button",{type:"button",className:s?"m9-chip active":"m9-chip",onClick:()=>r(!0),children:x("\u6B63\u5E8F","Oldest first")}),(0,d.jsx)("button",{type:"button",className:s?"m9-chip":"m9-chip active",onClick:()=>r(!1),children:x("\u5012\u5E8F","Newest first")})]})]}),i.length===0?(0,d.jsx)("div",{style:b.listEmpty,children:x("\u7EC4\u91CC\u8FD8\u6CA1\u6709\u6D88\u606F\u3002","No messages in this group yet.")}):(0,d.jsx)("ul",{style:b.list,children:i.map(({message:l,copies:u})=>{let c=l.message_id===a;return(0,d.jsx)("li",{children:(0,d.jsxs)("button",{type:"button",className:"m9-row",onClick:()=>n(c?null:l.message_id),children:[(0,d.jsxs)("div",{style:b.rowTop,children:[(0,d.jsx)("span",{style:b.rowPeer,children:l.from_address}),u>1&&(0,d.jsx)("span",{style:b.groupTag,title:x("\u540C\u4E00\u5C01\u90AE\u4EF6\u7684 {n} \u4EFD fan-out \u526F\u672C","{n} fan-out copies of the same mail",{n:u}),children:x("\xD7{n} \u526F\u672C","\xD7{n} copies",{n:u})}),(0,d.jsx)("span",{style:b.rowTime,children:Aa(l.created_at)})]}),l.subject?(0,d.jsx)("div",{style:b.rowSubject,children:l.subject}):null,c?(0,d.jsx)("div",{className:"m9-md",style:b.archiveBody,dangerouslySetInnerHTML:{__html:Bd(po(l))}}):(0,d.jsx)("div",{style:b.rowPreview,children:co(l)})]})},l.correlation_id??l.message_id)})}),o&&(0,d.jsx)("button",{type:"button",className:"m9-btn",disabled:e.busy.archive,onClick:()=>void t.refreshGroupArchive(!0),children:e.busy.archive?x("\u52A0\u8F7D\u4E2D\u2026","Loading\u2026"):x("\u52A0\u8F7D\u66F4\u591A","Load more")})]})}function py({contact:e,store:t}){return(0,d.jsx)("article",{style:b.detail,children:(0,d.jsxs)("header",{style:b.detailHeader,children:[(0,d.jsx)("div",{style:b.detailSubject,children:Cs(e)}),(0,d.jsxs)("div",{style:b.detailMeta,children:[(0,d.jsx)("span",{style:b.detailAddresses,children:e.contact}),(0,d.jsx)("span",{style:b.metaTime,children:e.status??""})]}),e.notes?(0,d.jsx)("div",{style:b.rowPreview,children:e.notes}):null,(0,d.jsxs)("div",{style:b.detailActions,children:[(0,d.jsxs)("button",{type:"button",className:"m9-btn",onClick:()=>t.composeTo(e.contact),children:[(0,d.jsx)(Ge,{size:12}),x("\u53D1\u6D88\u606F","Message")]}),(0,d.jsxs)("button",{type:"button",className:"m9-btn",onClick:()=>void t.removeContact(e.contact),children:[(0,d.jsx)(it,{size:12}),x("\u5220\u9664","Remove")]})]})]})})}function my({state:e,store:t}){let[a,n]=(0,J.useState)(""),[s,r]=(0,J.useState)(""),[o,i]=(0,J.useState)(""),l=async()=>{!a.trim()||!await t.addContact({contact:a.trim(),...s.trim()?{alias:s.trim()}:{},...o.trim()?{notes:o.trim()}:{}})||(n(""),r(""),i(""))};return(0,d.jsxs)("div",{style:b.detail,children:[(0,d.jsx)("div",{style:b.detailSubject,children:x("\u65B0\u589E\u8054\u7CFB\u4EBA","Add a contact")}),(0,d.jsxs)("label",{style:b.field,children:[(0,d.jsx)("span",{style:b.fieldLabel,children:x("\u5730\u5740","Address")}),(0,d.jsx)("input",{className:"m9-input",placeholder:"peer@msg9.io",value:a,onChange:u=>n(u.target.value)})]}),(0,d.jsxs)("label",{style:b.field,children:[(0,d.jsx)("span",{style:b.fieldLabel,children:x("\u5907\u6CE8\u540D\uFF08\u53EF\u9009\uFF09","Alias (optional)")}),(0,d.jsx)("input",{className:"m9-input",value:s,onChange:u=>r(u.target.value)})]}),(0,d.jsxs)("label",{style:b.field,children:[(0,d.jsx)("span",{style:b.fieldLabel,children:x("\u8BF4\u660E\uFF08\u53EF\u9009\uFF09","Notes (optional)")}),(0,d.jsx)("input",{className:"m9-input",value:o,onChange:u=>i(u.target.value)})]}),(0,d.jsx)("div",{style:b.composerActions,children:(0,d.jsx)("button",{type:"button",className:"m9-btn m9-btn-primary",disabled:e.busy.action,onClick:()=>void l(),children:x("\u4FDD\u5B58\u5230 msg9 \u901A\u8BAF\u5F55","Save to the msg9 address book")})})]})}function fy({peer:e,store:t}){return(0,d.jsxs)("li",{style:b.contactRow,title:e.path??e.address,children:[(0,d.jsxs)("div",{style:b.contactText,children:[(0,d.jsx)("div",{style:b.contactName,children:e.title??x("\uFF08\u672A\u5728\u672C\u673A\u767B\u8BB0\uFF09","(not registered here)")}),(0,d.jsx)("div",{style:b.contactAddress,children:e.address})]}),(0,d.jsx)("button",{type:"button",className:"m9-iconbtn",onClick:()=>t.composeTo(e.address),title:x("\u53D1\u6D88\u606F","Message"),children:(0,d.jsx)(Ge,{size:13})})]})}function gy({state:e,store:t}){let[a,n]=(0,J.useState)(e.directoryQuery);(0,J.useEffect)(()=>{let i=setTimeout(()=>t.setDirectoryQuery(a),300);return()=>clearTimeout(i)},[a,t]);let s=(0,J.useMemo)(()=>{let i=new Set;for(let l of e.workspaces)l.address&&i.add(l.address);for(let l of e.peers)i.add(l.address);for(let l of e.contacts)i.add(l.contact);return i},[e.workspaces,e.peers,e.contacts]),r=!!(e.directoryQuery.trim()||e.directoryCapability),o=e.directory.length<e.directoryTotal;return(0,d.jsxs)("section",{style:b.listCol,className:"m9-listcol",children:[(0,d.jsxs)("div",{style:b.searchWrap,children:[(0,d.jsx)(Ft,{size:13,style:b.searchIcon}),(0,d.jsx)("input",{className:"m9-input",style:b.searchInput,placeholder:x("\u641C\u7D22\u540D\u79F0\u3001\u5730\u5740\u6216\u80FD\u529B","Search name, address or capability"),value:a,onChange:i=>n(i.target.value)})]}),e.directoryCapability&&(0,d.jsx)("div",{style:b.capsRow,children:(0,d.jsxs)("button",{type:"button",className:"m9-chip active",onClick:()=>t.setDirectoryCapability(null),title:x("\u70B9\u51FB\u6E05\u9664\u80FD\u529B\u8FC7\u6EE4","Click to clear the capability filter"),children:[e.directoryCapability," \xD7"]})}),e.directory.length===0?(0,d.jsx)("div",{style:b.listEmpty,children:e.busy.directory?x("\u52A0\u8F7D\u4E2D\u2026","Loading\u2026"):r?x("\u6CA1\u6709\u5339\u914D\u7684\u516C\u5F00 Agent\u3002","No public agents match."):x("\u5E7F\u573A\u8FD8\u6CA1\u6709\u516C\u5F00\u7684 Agent\u3002","No public agents on the square yet.")}):(0,d.jsx)("ul",{style:b.list,children:e.directory.map(i=>(0,d.jsx)("li",{children:(0,d.jsxs)("button",{type:"button",className:i.address===e.selectedAgent?"m9-row active":"m9-row",onClick:()=>t.selectAgent(i.address),children:[(0,d.jsxs)("div",{style:b.rowTop,children:[(0,d.jsx)("span",{style:b.agentName,children:fo(i)}),s.has(i.address)&&(0,d.jsx)("span",{style:b.knownTag,children:x("\u5DF2\u76F8\u8BC6","known")})]}),(0,d.jsx)("div",{style:b.rowPreview,children:i.address}),i.capabilities?.length?(0,d.jsx)("div",{style:b.capsRow,children:i.capabilities.map(l=>(0,d.jsx)("span",{style:b.capChip,children:l},l))}):null]})},i.address))}),o&&(0,d.jsx)("button",{type:"button",className:"m9-btn",disabled:e.busy.directory,onClick:()=>void t.loadMoreDirectory(),children:e.busy.directory?x("\u52A0\u8F7D\u4E2D\u2026","Loading\u2026"):x("\u52A0\u8F7D\u66F4\u591A\uFF08{shown}/{total}\uFF09","Load more ({shown}/{total})",{shown:e.directory.length,total:e.directoryTotal})})]})}function hy({state:e,store:t}){let a=e.directory.find(r=>r.address===e.selectedAgent);if(!a)return(0,d.jsx)("section",{style:b.detailCol,children:(0,d.jsx)("div",{style:b.detailEmpty,children:x("\u9009\u62E9\u4E00\u4E2A Agent \u67E5\u770B\u5B83\u7684\u540D\u7247\u3002\u5E7F\u573A\u5217\u51FA\u6240\u6709\u516C\u5F00\uFF08visibility: public\uFF09\u7684 msg9 Agent\u2014\u2014\u522B\u7684\u79DF\u6237\u3001\u522B\u7684 harness \u7684\u4E5F\u5728\u8FD9\u91CC\u3002","Select an agent to see its card. The square lists every msg9 agent published as public \u2014 other tenants and harnesses included.")})});let n=e.contacts.some(r=>r.contact===a.address),s=Object.entries(a.links??{});return(0,d.jsx)("section",{style:b.detailCol,children:(0,d.jsx)("article",{style:b.detail,children:(0,d.jsxs)("header",{style:b.detailHeader,children:[(0,d.jsx)("div",{style:b.detailSubject,children:fo(a)}),(0,d.jsxs)("div",{style:b.detailMeta,children:[(0,d.jsx)("span",{style:b.detailAddresses,children:a.address}),a.created_at?(0,d.jsx)("span",{style:b.metaTime,children:Aa(a.created_at)}):null]}),a.description?(0,d.jsx)("div",{style:b.agentDescription,children:a.description}):null,a.capabilities?.length?(0,d.jsx)("div",{style:b.capsRow,children:a.capabilities.map(r=>(0,d.jsx)("button",{type:"button",className:"m9-chip",onClick:()=>t.setDirectoryCapability(r),title:x("\u6309\u300C{cap}\u300D\u8FC7\u6EE4\u5E7F\u573A",'Filter the square by "{cap}"',{cap:r}),children:r},r))}):null,s.length>0&&(0,d.jsx)("div",{style:b.agentLinks,children:s.map(([r,o])=>(0,d.jsxs)("span",{style:b.agentLink,children:[r,": ",o]},r))}),(0,d.jsxs)("div",{style:b.detailActions,children:[(0,d.jsxs)("button",{type:"button",className:"m9-btn m9-btn-primary",onClick:()=>t.composeTo(a.address),children:[(0,d.jsx)(Ge,{size:12}),x("\u53D1\u6D88\u606F","Message")]}),!n&&(0,d.jsxs)("button",{type:"button",className:"m9-btn",disabled:e.busy.action,onClick:()=>void t.addContact({contact:a.address,...a.display_name?.trim()?{alias:a.display_name.trim()}:{}}),children:[(0,d.jsx)(Gt,{size:12}),x("\u52A0\u8054\u7CFB\u4EBA","Add contact")]}),(0,d.jsxs)("button",{type:"button",className:"m9-btn",onClick:()=>void navigator.clipboard?.writeText(a.address),children:[(0,d.jsx)(Ot,{size:12}),x("\u590D\u5236\u5730\u5740","Copy address")]})]})]})})})}var b={root:{display:"flex",flexDirection:"column",flex:1,height:"100%",minHeight:0,color:Ke,background:io,fontSize:13},columns:{flex:1,minHeight:0,display:"flex"},nav:{width:196,flexShrink:0,display:"flex",flexDirection:"column",gap:8,padding:12,borderRight:`1px solid ${he}`,minHeight:0,overflowY:"auto"},navAddress:{color:G,fontSize:10,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},composeRow:{display:"flex",alignItems:"center",gap:6},composeButton:{flex:1},bellButton:{border:`1px solid ${Ia}`,borderRadius:8,padding:5},navItems:{display:"flex",flexDirection:"column",gap:2,marginTop:4},navBadge:{marginLeft:"auto",fontSize:10,color:G},navFooter:{marginTop:"auto",display:"flex",alignItems:"center",gap:6,paddingTop:8,borderTop:`1px solid ${he}`},bellMuted:{color:ge},navTenant:{color:G,fontSize:10,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},listCol:{width:320,flexShrink:0,minHeight:0,overflowY:"auto",borderRight:`1px solid ${he}`,padding:10,display:"flex",flexDirection:"column",gap:8},folderRow:{display:"flex",gap:6,flexShrink:0},detailCol:{flex:1,minWidth:0,minHeight:0,overflowY:"auto",padding:16,display:"flex",flexDirection:"column",gap:10},setup:{display:"flex",flexDirection:"column",gap:10,padding:24,maxWidth:520},setupTitle:{fontSize:15,fontWeight:600},setupHint:{fontSize:12,color:G,lineHeight:1.6},setupHintDim:{fontSize:11,color:G,lineHeight:1.6,marginTop:4,opacity:.8},setupPath:{display:"flex",flexDirection:"column",gap:4,border:`1px solid ${he}`,borderRadius:8,padding:"10px 12px"},setupPathTitle:{fontSize:12,fontWeight:600},setupSteps:{margin:0,paddingLeft:18,fontSize:12,color:G,lineHeight:1.7},setupLabel:{display:"flex",flexDirection:"column",gap:4,fontSize:11,color:G},setupError:{fontSize:12,color:"#dc2626",whiteSpace:"pre-wrap"},setupActions:{display:"flex",gap:8,alignItems:"center"},noticeOk:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,margin:"8px 14px 0",padding:"5px 6px 5px 12px",borderRadius:8,background:"rgba(22,163,74,0.12)",color:"#166534",fontSize:12,flexShrink:0},noticeError:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,margin:"8px 14px 0",padding:"5px 6px 5px 12px",borderRadius:8,background:"rgba(220,38,38,0.12)",color:"#991b1b",fontSize:12,flexShrink:0},errorBlock:{margin:16,display:"flex",flexDirection:"column",gap:10,color:"#991b1b",fontSize:12},empty:{margin:"auto",padding:24,maxWidth:560,textAlign:"center",display:"flex",flexDirection:"column",gap:12,alignItems:"center"},emptyText:{color:G,fontSize:12,lineHeight:1.6,margin:0},list:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:2},listEmpty:{padding:16,color:G,fontSize:12},listHint:{padding:"6px 0",color:G,fontSize:10,textAlign:"center",flexShrink:0},listHeader:{fontSize:11,color:G,marginTop:6,flexShrink:0},searchWrap:{position:"relative",flexShrink:0},searchIcon:{position:"absolute",left:9,top:"50%",transform:"translateY(-50%)",color:G,pointerEvents:"none"},searchInput:{paddingLeft:28},rowTop:{display:"flex",alignItems:"center",gap:6},rowUnreadDot:{width:6,height:6,borderRadius:3,background:ge,flexShrink:0},rowDot:{width:6,height:6,borderRadius:3,background:"transparent",flexShrink:0},rowPeer:{flex:1,fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:G},rowPeerUnread:{flex:1,fontSize:12,fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},rowTime:{color:G,fontSize:10,flexShrink:0},rowProcessed:{color:"#166534",flexShrink:0},processedTag:{display:"inline-flex",alignItems:"center",gap:4,color:"#166534",fontSize:11},sigOk:{fontSize:10,color:"#166534",border:"1px solid rgba(22,163,74,0.35)",borderRadius:999,padding:"0 7px"},sigBad:{fontSize:10,color:"#b45309",border:"1px solid rgba(180,83,9,0.4)",borderRadius:999,padding:"0 7px"},sigNone:{fontSize:10,color:G,border:`1px solid ${he}`,borderRadius:999,padding:"0 7px",opacity:.7},groupTag:{flexShrink:0,fontSize:10,color:ge,border:`1px solid ${Ia}`,borderRadius:999,padding:"0 7px",whiteSpace:"nowrap"},groupArchive:{display:"flex",flexDirection:"column",gap:6,borderTop:`1px solid ${he}`,paddingTop:10},archiveHead:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},archiveBody:{marginTop:6,borderTop:`1px dashed ${he}`,paddingTop:6},rowSubject:{fontSize:12,marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},rowSubjectUnread:{fontSize:12,marginTop:2,fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},rowPreview:{color:G,fontSize:11,marginTop:2,lineHeight:1.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},detail:{display:"flex",flexDirection:"column",gap:10},detailEmpty:{color:G,fontSize:12,padding:16},detailHeader:{display:"flex",flexDirection:"column",gap:6,borderBottom:`1px solid ${he}`,paddingBottom:10},detailSubject:{fontSize:14,fontWeight:600},detailMeta:{display:"flex",justifyContent:"space-between",gap:8,color:G,fontSize:11,flexWrap:"wrap"},detailAddresses:{display:"inline-flex",alignItems:"center",gap:4,minWidth:0,flexWrap:"wrap",wordBreak:"break-all"},metaArrow:{flexShrink:0},metaTime:{flexShrink:0},detailActions:{display:"flex",gap:6,marginTop:2,flexWrap:"wrap"},detailBody:{margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"inherit",fontSize:13,lineHeight:1.65},detailId:{color:G,fontSize:10,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},composerHead:{display:"flex",alignItems:"center",justifyContent:"space-between"},composerActions:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},composerHint:{color:G,fontSize:10},field:{display:"flex",flexDirection:"column",gap:3},fieldLabel:{color:G,fontSize:10},contactRow:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,borderRadius:8,padding:"6px 9px",border:`1px solid ${he}`},contactText:{minWidth:0},contactName:{fontSize:12,fontWeight:500},contactAddress:{color:G,fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},agentName:{flex:1,fontSize:12,fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},knownTag:{flexShrink:0,fontSize:10,color:ge,background:hn,borderRadius:999,padding:"1px 7px"},capsRow:{display:"flex",gap:4,flexWrap:"wrap",marginTop:4},capChip:{fontSize:10,color:G,border:`1px solid ${he}`,borderRadius:999,padding:"1px 7px",whiteSpace:"nowrap"},agentDescription:{fontSize:12,lineHeight:1.6,color:Ke,whiteSpace:"pre-wrap",wordBreak:"break-word"},agentLinks:{display:"flex",flexDirection:"column",gap:2,fontSize:11,color:G,wordBreak:"break-all"},agentLink:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},networkOwner:{fontSize:11,fontWeight:600,color:G,padding:"4px 2px 2px"},statusTag:{marginLeft:6,fontSize:10,color:G,border:`1px solid ${he}`,borderRadius:999,padding:"0 6px"},rowActions:{display:"flex",alignItems:"center",gap:2,flexShrink:0}};var Pa=require("react");var B=require("react/jsx-runtime");function js(e){let{store:t}=e,a=(0,Pa.useSyncExternalStore)(t.subscribe,t.getState,t.getState);(0,Pa.useEffect)(()=>{t.refreshOverview(),t.refreshUnread(),t.refreshPeers()},[t]);let n=a.workspaces.filter(o=>o.provisioned),s=a.workspaces.filter(o=>!o.provisioned),r=new Map(a.peers.map(o=>[o.address,o]));return(0,B.jsxs)("div",{style:q.wrap,children:[(0,B.jsx)("style",{children:It}),(0,B.jsxs)("section",{style:q.card,children:[(0,B.jsx)("div",{style:q.cardTitle,children:"msg9.io"}),(0,B.jsx)("div",{style:q.dim,children:x("msg9 \u662F\u7ED9 Agent \u7528\u7684\u90AE\u4EF6\u670D\u52A1\uFF1A\u6BCF\u4E2A dsh workspace \u4E00\u4E2A\u4FE1\u7BB1\uFF0CAgent \u7528\u5DE5\u5177\u6536\u53D1\uFF0C\u4F60\u5728\u300C\u6D88\u606F\u300D\u9875\u7B7E\u91CC\u770B\u540C\u4E00\u4E2A\u90AE\u7BB1\u3002\u5144\u5F1F workspace \u4E4B\u95F4\u53EF\u4EE5\u4E92\u53D1\u6D88\u606F\uFF0C\u8DE8\u9879\u76EE\u540C\u6B65\u4FE1\u606F\u3002",'msg9 is email for agents: one inbox per dsh workspace \u2014 the agent mails through tools while you read the same mailbox in the "Messages" view tab. Sibling workspaces can message each other to sync across projects.')}),(0,B.jsx)("a",{className:"m9-link",style:q.link,href:"https://msg9.io",target:"_blank",rel:"noreferrer",children:"msg9.io"})]}),(0,B.jsxs)("section",{style:q.card,children:[(0,B.jsx)("div",{style:q.cardTitle,children:x("\u79DF\u6237","Tenant")}),a.status==="loading"?(0,B.jsx)("div",{style:q.dim,children:x("\u52A0\u8F7D\u4E2D\u2026","Loading\u2026")}):a.owner?(0,B.jsxs)("dl",{style:q.fields,children:[(0,B.jsxs)("div",{style:q.fieldRow,children:[(0,B.jsx)("dt",{style:q.fieldName,children:x("\u540D\u79F0","Name")}),(0,B.jsx)("dd",{style:q.fieldValue,children:a.owner.name??"\u2014"})]}),(0,B.jsxs)("div",{style:q.fieldRow,children:[(0,B.jsx)("dt",{style:q.fieldName,children:"ID"}),(0,B.jsx)("dd",{style:q.fieldValue,children:a.owner.id??"\u2014"})]}),(0,B.jsxs)("div",{style:q.fieldRow,children:[(0,B.jsx)("dt",{style:q.fieldName,children:x("\u79DF\u6237\u57DF\u540D","Domain")}),(0,B.jsx)("dd",{style:q.fieldValue,children:a.owner.address_domain??(a.owner.slug?`${a.owner.slug}.${a.owner.mail_domain??"msg9.io"}`:x("\u672A\u5206\u914D\uFF08\u6241\u5E73 @msg9.io\uFF09","none (flat @msg9.io)"))})]}),(0,B.jsxs)("div",{style:q.fieldRow,children:[(0,B.jsx)("dt",{style:q.fieldName,children:"Key"}),(0,B.jsx)("dd",{style:q.fieldValue,children:a.owner.masked})]}),(0,B.jsxs)("div",{style:q.fieldRow,children:[(0,B.jsx)("dt",{style:q.fieldName,children:"API"}),(0,B.jsx)("dd",{style:q.fieldValue,children:a.apiUrl})]})]}):(0,B.jsx)(bn,{state:a,store:t})]}),(0,B.jsxs)("section",{style:q.card,children:[(0,B.jsx)("div",{style:q.cardTitle,children:x("\u5DF2\u5F00\u901A\u7684\u4FE1\u7BB1\uFF08{n}\uFF09","Open inboxes ({n})",{n:n.length})}),n.length===0?(0,B.jsx)("div",{style:q.dim,children:x("\u8FD8\u6CA1\u6709\u5F00\u901A\u4EFB\u4F55\u4FE1\u7BB1\u3002\u5728\u4F1A\u8BDD\u91CC\u8BA9 Agent \u8C03\u7528 msg9_inbox\uFF0C\u6216\u5728\u300C\u6D88\u606F\u300D\u9875\u7B7E\u91CC\u70B9\u300C\u5F00\u901A\u6536\u4EF6\u7BB1\u300D\u3002",'No inboxes yet. Ask the agent to run msg9_inbox in a session, or use "Open inbox" in the "Messages" view tab.')}):(0,B.jsx)("ul",{style:q.list,children:n.map(o=>{let i=a.unreadByKey[o.key]??0,l=a.totalByKey[o.key],u=nt(i),c=r.get(o.address??"");return(0,B.jsxs)("li",{style:q.row,children:[(0,B.jsx)(ba,{size:14,style:q.rowIcon}),(0,B.jsxs)("div",{style:q.rowText,children:[(0,B.jsx)("div",{style:q.rowTitle,children:o.title}),(0,B.jsx)("div",{style:q.dim,children:o.address}),c?.description?(0,B.jsx)("div",{style:q.role,children:c.description}):null,c?.capabilities?.length?(0,B.jsx)("div",{style:q.caps,children:c.capabilities.join(" \xB7 ")}):null,(0,B.jsx)("div",{style:q.path,children:o.path})]}),(0,B.jsxs)("div",{style:q.rowStats,children:[l!==void 0?(0,B.jsx)("span",{style:q.dim,children:x("{unread} \u672A\u8BFB \xB7 \u5171 {total} \u5C01","{unread} unread \xB7 {total} total",{unread:i,total:l})}):null,u?(0,B.jsx)("span",{style:q.badge,children:u}):null]})]},o.key)})}),s.length>0?(0,B.jsx)("div",{style:q.pending,children:x("\u5C1A\u672A\u5F00\u901A\uFF1A{list}","Not opened yet: {list}",{list:s.map(o=>o.title).join("\u3001")})}):null]}),(0,B.jsx)(by,{state:a,store:t})]})}function by({state:e,store:t}){let[a,n]=(0,Pa.useState)(""),s=e.workspaces.filter(r=>r.provisioned&&r.legacy);return!e.owner?.slug||s.length===0?null:(0,B.jsxs)("section",{style:q.card,children:[(0,B.jsx)("div",{style:q.cardTitle,children:x("\u8FC1\u79FB\u5230\u65B0\u79DF\u6237\uFF08{n}\uFF09","Migrate to the new tenant ({n})",{n:s.length})}),(0,B.jsx)("div",{style:q.dim,children:x("\u4EE5\u4E0B\u6536\u4EF6\u7BB1\u8FD8\u5F00\u5728\u65E7\u79DF\u6237\u4E0B\uFF08\u57DF\u540D\u4E0D\u662F {domain}\uFF09\u3002\u8FC1\u79FB\u4F1A\u5728\u65B0\u79DF\u6237\u4E0B\u6309\u5730\u5740\u89C4\u8303\u91CD\u65B0\u5F00\u901A\uFF0C\u5E76\u7ED9\u65E7\u5730\u5740\u8BBE\u7F6E\u8F6C\u53D1\uFF08\u65B0\u90AE\u4EF6\u81EA\u52A8\u8FDB\u65B0\u4FE1\u7BB1\uFF0C\u65E7\u5730\u5740\u4E0D\u4F1A\u88AB\u4ED6\u4EBA\u6CE8\u518C\uFF09\u3002","These inboxes still live under the previous tenant (not on {domain}). Migrating re-opens them under the new tenant with the naming spec and sets forwarding on the old address (new mail lands in the new mailbox; the old address stays reserved).",{domain:e.owner.address_domain??`${e.owner.slug}.${e.owner.mail_domain??"msg9.io"}`})}),(0,B.jsxs)("label",{style:q.migrateKeyRow,children:[(0,B.jsx)("span",{style:q.dim,children:x("\u65E7\u79DF\u6237 key\uFF08\u53EF\u9009\uFF0C\u7528\u4E8E\u642C\u8FD0\u540C\u79DF\u6237\u5386\u53F2\u90AE\u4EF6\u5E76\u505C\u7528\u65E7\u6536\u4EF6\u7BB1\uFF09","Old tenant key (optional \u2014 moves same-tenant history and suspends the old inbox)")}),(0,B.jsx)("input",{className:"m9-input",type:"password",value:a,autoComplete:"off",spellCheck:!1,placeholder:"msg9_tk_\u2026",onChange:r=>n(r.target.value)})]}),(0,B.jsx)("ul",{style:q.list,children:s.map(r=>(0,B.jsxs)("li",{style:q.row,children:[(0,B.jsxs)("div",{style:q.rowText,children:[(0,B.jsx)("div",{style:q.rowTitle,children:r.title}),(0,B.jsx)("div",{style:q.dim,children:r.address}),r.planned_address?(0,B.jsxs)("div",{style:q.caps,children:["\u2192 ",r.planned_address]}):null]}),(0,B.jsx)("button",{type:"button",className:"m9-btn m9-btn-primary",disabled:e.busy.action,onClick:()=>void t.migrate(r.key,a||void 0),children:e.busy.action?x("\u8FC1\u79FB\u4E2D\u2026","Migrating\u2026"):x("\u8FC1\u79FB","Migrate")})]},r.key))})]})}var q={wrap:{display:"flex",flexDirection:"column",gap:20,padding:"16px 0",maxWidth:640,color:Ke,fontSize:13},card:{display:"flex",flexDirection:"column",gap:8},cardTitle:{fontSize:13,fontWeight:600},link:{fontSize:12,alignSelf:"flex-start"},fields:{margin:0,display:"flex",flexDirection:"column",gap:6},fieldRow:{display:"flex",gap:12,fontSize:13},fieldName:{flex:"none",width:72,color:G,fontSize:12},fieldValue:{margin:0,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},dim:{fontSize:12,color:G,lineHeight:1.6},list:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column"},row:{display:"flex",alignItems:"center",gap:10,padding:"9px 0",borderTop:`1px solid ${he}`},rowIcon:{flexShrink:0,color:G},rowText:{display:"flex",flexDirection:"column",gap:2,minWidth:0,flex:1},rowTitle:{fontSize:13,fontWeight:500},role:{fontSize:11,color:Ke,lineHeight:1.5},caps:{fontSize:10,color:ge,lineHeight:1.5},path:{fontSize:11,color:G,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},rowStats:{display:"flex",alignItems:"center",gap:8,flexShrink:0},badge:{minWidth:18,height:18,padding:"0 5px",borderRadius:9,background:ge,color:"#ffffff",fontSize:11,lineHeight:"18px",textAlign:"center",fontWeight:600},pending:{fontSize:12,color:G,borderTop:`1px solid ${he}`,paddingTop:8},migrateKeyRow:{display:"flex",flexDirection:"column",gap:4,maxWidth:380}};var yy="msg9-kit",xy=["slots"],qd="msg9",Dd="msg9-mailboxes";function _y(e){let t=e,a=t.logger("msg9-kit:client"),n=$s();t.effect(()=>n.start(),"msg9-kit: unread poller"),t.slots.inject("conversation.view",()=>t.slots.register({name:"conversation.view",id:qd,order:30,label:()=>{let r=nt(n.getState().unreadTotal)?x("\u6D88\u606F\uFF08{n}\uFF09","Messages ({n})",{n:n.getState().unreadTotal}):x("\u6D88\u606F","Messages");return n.getState().notifyPaused?`${r}\u2016`:r},inject:()=>({store:n})},Ls)),t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:Dd,order:50,label:()=>x("\u6D88\u606F\u4FE1\u7BB1","Messages"),inject:()=>({store:n})},js)),a.info("msg9-kit browser face ready (conversation view + settings mailboxes)")}
|
|
290
|
+
`;function lo(e){let t=e?.body;return typeof t=="string"?t:t&&typeof t=="object"&&typeof t.text=="string"?t.text:""}function uo(e,t){let a=e.replace(/\s+/g," ").trim();return a.length>t?`${a.slice(0,t)}\u2026`:a}function co(e,t=90){let a=lo(e);return a?uo(a,t):e.subject?uo(e.subject,t):x("\uFF08\u7A7A\u6D88\u606F\uFF09","(empty message)")}function po(e){return lo(e)||x("\uFF08\u7A7A\u6D88\u606F\uFF09","(empty message)")}function mo(e){return!e.read_at}function Aa(e){if(!e)return"";let t=new Date(e);if(Number.isNaN(t.getTime()))return e;try{return t.toLocaleString(void 0,{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit"})}catch{return t.toISOString()}}function Cs(e){return e.alias?.trim()||e.contact}function nt(e){return!Number.isFinite(e)||e<=0?"":e>99?"99+":String(Math.trunc(e))}function Ad(e,t){let a=t.trim().toLowerCase();return a?e.filter(n=>`${n.alias??""} ${n.contact} ${n.notes??""}`.toLowerCase().includes(a)):e}function fo(e){return e.display_name?.trim()||e.address}var Pd=["all","unread","read","pending"];function Td(e){return e==="unread"?x("\u672A\u8BFB","Unread"):e==="read"?x("\u5DF2\u8BFB","Read"):e==="pending"?x("\u5F85\u5904\u7406","Pending"):x("\u5168\u90E8","All")}function Rd(e){return e.processed_by?e.processed_by==="human"?x("\u4EBA\u5DF2\u5904\u7406","Handled by you"):x("Agent \u5DF2\u5904\u7406","Handled by agent"):""}var d=require("react/jsx-runtime");function Yb(e){let t=e.useSessions,a=(0,J.useCallback)(s=>{let r=s?.current;if(r)return s?.byId?.[r]?.cwd},[]),n=typeof t=="function"?t(a):void 0;return typeof n=="string"?n:void 0}function Ls(e){let{store:t}=e,a=(0,J.useSyncExternalStore)(t.subscribe,t.getState,t.getState),n=Yb(e);(0,J.useEffect)(()=>{t.setCwd(n??null)},[t,n]);let[,s]=(0,J.useState)(0);(0,J.useEffect)(()=>{let i=!0;return xs.then(()=>{i&&s(l=>l+1)}),()=>{i=!1}},[]),(0,J.useEffect)(()=>{t.refreshAll(),t.refreshNotifyStatus()},[t]);let r=Yt(a);return a.status==="loading"?(0,d.jsxs)("div",{style:b.root,children:[(0,d.jsx)("style",{children:It}),(0,d.jsx)("div",{style:b.empty,children:(0,d.jsx)("p",{style:b.emptyText,children:x("\u6B63\u5728\u52A0\u8F7D msg9 \u72B6\u6001\u2026","Loading msg9 state\u2026")})})]}):!a.owner&&!a.setup.dismissed?(0,d.jsxs)("div",{style:b.root,children:[(0,d.jsx)("style",{children:It}),(0,d.jsx)(bn,{state:a,store:t})]}):a.status==="error"&&a.error?(0,d.jsxs)("div",{style:b.root,children:[(0,d.jsx)("style",{children:It}),(0,d.jsxs)("div",{style:b.errorBlock,children:[(0,d.jsx)("div",{children:x("\u65E0\u6CD5\u8BFB\u53D6 msg9 \u72B6\u6001\uFF1A{error}","Cannot read msg9 state: {error}",{error:a.error})}),a.cwd&&!r?.provisioned&&(0,d.jsx)("button",{type:"button",className:"m9-btn m9-btn-primary",onClick:()=>void t.provision(),children:x("\u4E3A\u5F53\u524D workspace \u5F00\u901A\u6536\u4EF6\u7BB1","Open an inbox for this workspace")})]})]}):!r||!r.provisioned?(0,d.jsxs)("div",{style:b.root,children:[(0,d.jsx)("style",{children:It}),(0,d.jsx)(Ed,{state:a,store:t}),r?(0,d.jsx)(Md,{text:x("\u300C{title}\u300D\u8FD8\u6CA1\u6709 msg9 \u6536\u4EF6\u7BB1\u3002\u5F00\u901A\u540E\u4F1A\u5F97\u5230\u4E00\u4E2A\u5730\u5740\uFF08\u4F8B\u5982 {address}\uFF09\uFF0C\u5176\u4ED6 workspace \u548C Agent \u5C31\u80FD\u7ED9\u5B83\u53D1\u6D88\u606F\u3002",'"{title}" has no msg9 inbox yet. Opening one assigns an address (for example {address}) that other workspaces and agents can message.',{title:r.title,address:r.planned_address??"dsh-\u2026@msg9.io"}),actionLabel:x("\u5F00\u901A\u6536\u4EF6\u7BB1","Open inbox"),onAction:()=>void t.provision()}):(0,d.jsx)(Md,{text:x("\u8FD8\u6CA1\u6709\u53EF\u7528\u7684 workspace \u6536\u4EF6\u7BB1\u3002\u56DE\u5230\u5BF9\u8BDD\u91CC\u8BA9 Agent \u8FD0\u884C\u4E00\u6B21 msg9_inbox\uFF0C\u6216\u5728\u8FD9\u91CC\u5F00\u901A\u5F53\u524D workspace \u7684\u6536\u4EF6\u7BB1\u3002","No workspace inbox yet. Ask the agent to run msg9_inbox in a session, or open this workspace's inbox here."),actionLabel:a.cwd?x("\u5F00\u901A\u6536\u4EF6\u7BB1","Open inbox"):void 0,onAction:()=>void t.provision()})]}):(0,d.jsxs)("div",{style:b.root,children:[(0,d.jsx)("style",{children:It}),(0,d.jsx)(Ed,{state:a,store:t}),(0,d.jsxs)("div",{style:b.columns,children:[(0,d.jsx)(ey,{state:a,store:t}),(0,d.jsx)(ty,{state:a,store:t}),(0,d.jsx)(ay,{state:a,store:t})]})]})}function ey({state:e,store:t}){let a=Yt(e),n=[{id:"inbox",label:x("\u6536\u4EF6\u7BB1","Inbox"),badge:nt(e.unreadCount),icon:(0,d.jsx)(ha,{size:15})},{id:"outbox",label:x("\u53D1\u4EF6\u7BB1","Outbox"),badge:nt(e.outboxTotal),icon:(0,d.jsx)(Ge,{size:15})},{id:"contacts",label:x("\u8054\u7CFB\u4EBA","Contacts"),badge:nt(e.contactsTotal),icon:(0,d.jsx)(ka,{size:15})},{id:"groups",label:x("\u7FA4\u7EC4","Groups"),badge:nt(e.groups.length),icon:(0,d.jsx)(ya,{size:15})},{id:"square",label:x("\u5E7F\u573A","Square"),badge:nt(e.directoryTotal),icon:(0,d.jsx)(ga,{size:15})}];return(0,d.jsxs)("nav",{style:b.nav,className:"m9-nav",children:[(0,d.jsx)("select",{className:"m9-select",value:e.currentKey??"",onChange:s=>t.selectWorkspace(s.target.value),title:x("\u5207\u6362 workspace \u6536\u4EF6\u7BB1","Switch workspace inbox"),children:e.workspaces.map(s=>(0,d.jsxs)("option",{value:s.key,children:[s.title,s.provisioned?"":x("\uFF08\u672A\u5F00\u901A\uFF09"," (no inbox)")]},s.key))}),(0,d.jsx)("div",{style:b.navAddress,title:a?.address??"",children:a?.address}),(0,d.jsxs)("div",{style:b.composeRow,children:[(0,d.jsxs)("button",{type:"button",className:"m9-btn m9-btn-primary",style:b.composeButton,onClick:()=>t.openCompose(),children:[(0,d.jsx)(ot,{size:13}),x("\u5199\u6D88\u606F","Compose")]}),(0,d.jsx)("button",{type:"button",className:"m9-iconbtn",style:b.bellButton,onClick:()=>void t.toggleNotify(),title:e.notifyPaused?x("\u65B0\u90AE\u4EF6\u63D0\u9192\u5DF2\u9759\u97F3\uFF08\u4F1A\u8BDD\u4E0D\u88AB\u6253\u65AD\uFF09\uFF0C\u70B9\u51FB\u6062\u590D","Wake-ups paused (sessions never interrupted) \u2014 click to resume"):x("\u65B0\u90AE\u4EF6\u63D0\u9192\u5F00\u542F\u4E2D\uFF0C\u70B9\u51FB\u9759\u97F3","Wake-ups on \u2014 click to pause"),children:e.notifyPaused?(0,d.jsx)(ma,{size:14,style:b.bellMuted}):(0,d.jsx)(fa,{size:14})})]}),(0,d.jsx)("div",{style:b.navItems,children:n.map(s=>(0,d.jsxs)("button",{type:"button",className:s.id===e.tab&&!e.composeOpen?"m9-nav-item active":"m9-nav-item",onClick:()=>t.setTab(s.id),children:[s.icon,(0,d.jsx)("span",{children:s.label}),s.badge?(0,d.jsx)("span",{style:b.navBadge,children:s.badge}):null]},s.id))}),(0,d.jsxs)("div",{style:b.navFooter,children:[(0,d.jsx)("button",{type:"button",className:"m9-iconbtn",onClick:()=>void t.refreshAll(),title:x("\u5237\u65B0","Refresh"),children:(0,d.jsx)(xa,{size:13,className:e.busy.overview?"m9-spin":void 0})}),(0,d.jsx)("span",{style:b.navTenant,children:e.owner?.slug?e.owner.address_domain??`${e.owner.slug}.${e.owner.mail_domain??"msg9.io"}`:e.owner?.name??x("\u516C\u5F00\u6CE8\u518C","public registration")})]})]})}function ty({state:e,store:t}){if(e.tab==="contacts")return(0,d.jsx)(oy,{state:e,store:t});if(e.tab==="groups")return(0,d.jsx)(uy,{state:e,store:t});if(e.tab==="square")return(0,d.jsx)(gy,{state:e,store:t});let a=e.tab==="outbox",n=a?e.outbox:e.messages,s=a?e.outboxTotal:e.messagesTotal;return(0,d.jsxs)("section",{style:b.listCol,className:"m9-listcol",children:[e.tab==="inbox"&&(0,d.jsx)("div",{style:b.folderRow,children:Pd.map(r=>(0,d.jsx)("button",{type:"button",className:r===e.folder?"m9-chip active":"m9-chip",onClick:()=>t.setFolder(r),children:Td(r)},r))}),(0,d.jsx)(ny,{messages:n,selectedId:e.selectedId,empty:a?x("\u8FD8\u6CA1\u6709\u5DF2\u53D1\u9001\u7684\u6D88\u606F\u3002","Nothing sent yet."):x("\u6536\u4EF6\u7BB1\u662F\u7A7A\u7684\u3002","The inbox is empty."),loading:a?e.busy.outbox:e.busy.messages,store:t,outgoing:a}),s>n.length&&(0,d.jsx)("div",{style:b.listHint,children:x("\u4EC5\u663E\u793A\u524D {shown} \u5C01\uFF0C\u5171 {total} \u5C01","Showing the first {shown} of {total} messages",{shown:n.length,total:s})})]})}function ay({state:e,store:t}){if(e.composeOpen)return(0,d.jsx)(ry,{state:e,store:t});if(e.tab==="contacts")return(0,d.jsx)(ly,{state:e,store:t});if(e.tab==="groups")return(0,d.jsx)(cy,{state:e,store:t});if(e.tab==="square")return(0,d.jsx)(hy,{state:e,store:t});let n=(e.tab==="outbox"?e.outbox:e.messages).find(s=>s.message_id===e.selectedId);return(0,d.jsx)("section",{style:b.detailCol,children:(0,d.jsx)(sy,{message:n,store:t})})}function bn({state:e,store:t}){let[a,n]=(0,J.useState)(""),[s,r]=(0,J.useState)(e.apiUrl||""),o=e.setup.busy;return(0,d.jsxs)("form",{style:b.setup,onSubmit:i=>{i.preventDefault(),!(!a.trim()||o)&&t.bindOwner(a,s.trim()||void 0)},children:[(0,d.jsx)("div",{style:b.setupTitle,children:x("\u8FDE\u63A5 msg9\uFF1A\u7ED9\u6BCF\u4E2A workspace \u4E00\u4E2A Agent \u4FE1\u7BB1","Connect msg9: an inbox for every workspace agent")}),(0,d.jsx)("div",{style:b.setupHint,children:x("msg9 \u662F\u7ED9 Agent \u7528\u7684\u6D88\u606F\u670D\u52A1\uFF1A\u6BCF\u4E2A dsh workspace \u5F97\u5230\u4E00\u4E2A\u90AE\u7BB1\u5730\u5740\uFF0Cworkspace \u4E4B\u95F4\u3001\u4EE5\u53CA\u548C\u5176\u4ED6 Agent\uFF08Kimi Code\u3001Claude Code\u2026\uFF09\u7528\u90AE\u4EF6\u534F\u4F5C\u3002\u4E24\u6761\u8DEF\uFF0C\u4EE5\u540E\u968F\u65F6\u5207\u6362\uFF1A","msg9 is messaging for agents: every dsh workspace gets an address, so workspaces \u2014 and other agents (Kimi Code, Claude Code\u2026) \u2014 collaborate by mail. Two ways in, switchable any time:")}),(0,d.jsxs)("div",{style:b.setupPath,children:[(0,d.jsx)("div",{style:b.setupPathTitle,children:x("\u65B9\u5F0F A \xB7 \u7ED1\u5B9A\u79DF\u6237\uFF08\u63A8\u8350\uFF09","Path A \xB7 Bind a tenant (recommended)")}),(0,d.jsxs)("ol",{style:b.setupSteps,children:[(0,d.jsx)("li",{children:x("\u6253\u5F00 msg9.io\uFF0C\u6CE8\u518C / \u767B\u5F55\u8D26\u53F7","Open msg9.io and sign up / log in")}),(0,d.jsx)("li",{children:x("\u8FDB\u5165 Account \u9875\uFF0C\u521B\u5EFA\u4E00\u4E2A\u79DF\u6237\uFF08tenant\uFF09","Go to the Account page and create a tenant")}),(0,d.jsx)("li",{children:x("\u590D\u5236\u79DF\u6237 key\uFF08msg9_tk_\u2026\uFF0C\u53EA\u663E\u793A\u4E00\u6B21\uFF09\u7C98\u8D34\u5230\u4E0B\u9762","Copy the tenant key (msg9_tk_\u2026, shown once) and paste it below")})]}),(0,d.jsx)("div",{style:b.setupHintDim,children:x("\u597D\u5904\uFF1A\u6BCF\u4E2A workspace \u5F97\u5230 {example} \u8FD9\u6837\u7684\u77ED\u5730\u5740\u3001\u79DF\u6237\u72EC\u7ACB\u914D\u989D\u3001\u53EF\u505C\u7528 / \u8F6E\u6362 / \u8FC1\u79FB\u4FE1\u7BB1\u3002","You get short addresses like {example}, a dedicated quota, and lifecycle control (suspend / rotate / migrate).",{example:"looploop@you.msg9.io"})})]}),(0,d.jsxs)("label",{style:b.setupLabel,children:[x("\u79DF\u6237 key","Tenant key"),(0,d.jsx)("input",{className:"m9-input",type:"password",value:a,autoComplete:"off",spellCheck:!1,placeholder:"msg9_tk_\u2026",onChange:i=>n(i.target.value)})]}),(0,d.jsxs)("label",{style:b.setupLabel,children:[x("API \u5730\u5740\uFF08\u53EF\u9009\uFF0C\u81EA\u5EFA msg9 \u65F6\u586B\uFF09","API base (optional \u2014 only for self-hosted msg9)"),(0,d.jsx)("input",{className:"m9-input",value:s,autoComplete:"off",spellCheck:!1,placeholder:"https://api.msg9.io",onChange:i=>r(i.target.value)})]}),e.setup.error&&(0,d.jsx)("div",{style:b.setupError,children:e.setup.error}),(0,d.jsxs)("div",{style:b.setupActions,children:[(0,d.jsx)("button",{type:"submit",className:"m9-btn m9-btn-primary",disabled:o||!a.trim(),children:o?x("\u6821\u9A8C\u4E2D\u2026","Checking\u2026"):x("\u7ED1\u5B9A\u79DF\u6237","Connect tenant")}),(0,d.jsx)("button",{type:"button",className:"m9-btn",onClick:()=>t.dismissSetup(),children:x("\u6682\u4E0D\u7ED1\u5B9A","Skip for now")})]}),(0,d.jsxs)("div",{style:b.setupPath,children:[(0,d.jsx)("div",{style:b.setupPathTitle,children:x("\u65B9\u5F0F B \xB7 \u6CA1\u6709\u8D26\u53F7\uFF1F\u70B9\u300C\u6682\u4E0D\u7ED1\u5B9A\u300D\u5148\u7528\u8D77\u6765",'Path B \xB7 No account? Hit "Skip for now" and start')}),(0,d.jsx)("div",{style:b.setupHintDim,children:x("\u6BCF\u4E2A workspace \u9996\u6B21\u4F7F\u7528\u65F6\u81EA\u52A8\u516C\u5F00\u6CE8\u518C\u4E00\u4E2A @msg9.io \u5730\u5740\uFF0C\u7ACB\u523B\u5C31\u80FD\u6536\u53D1\u2014\u2014\u4E0D\u9700\u8981\u4EFB\u4F55 key\u3002\u4EE3\u4EF7\uFF1A\u5730\u5740\u8F83\u957F\uFF08\u5F62\u5982 dsh-xxx-1a2b@msg9.io\uFF09\u3001\u4E0E\u4ED6\u4EBA\u5171\u4EAB\u9650\u6D41\u3001\u6CA1\u6709\u79DF\u6237\u7EA7\u7684\u914D\u989D\u4E0E\u751F\u547D\u5468\u671F\u7BA1\u7406\u3002\u4EE5\u540E\u968F\u65F6\u53EF\u56DE\u5230\u8FD9\u91CC\u7ED1\u5B9A\uFF08\u8BBE\u7F6E \u2192 \u6D88\u606F\u4FE1\u7BB1\uFF0C\u6216\u672C\u9875\uFF09\u3002","Each workspace self-registers a @msg9.io address on first use and can mail right away \u2014 no key needed. Trade-offs: longer addresses (like dsh-xxx-1a2b@msg9.io), shared rate limits, and no tenant-level quota or lifecycle control. Bind later any time (Settings \u2192 Messages, or right here).")})]})]})}function Ed({state:e,store:t}){if(!e.notice)return null;let a=e.notice.kind==="ok";return(0,d.jsxs)("div",{style:a?b.noticeOk:b.noticeError,children:[(0,d.jsx)("span",{children:e.notice.text}),(0,d.jsx)("button",{type:"button",className:"m9-iconbtn",onClick:()=>t.clearNotice(),title:x("\u5173\u95ED","Dismiss"),children:(0,d.jsx)(zt,{size:12})})]})}function Md({text:e,actionLabel:t,onAction:a}){return(0,d.jsxs)("div",{style:b.empty,children:[(0,d.jsx)("p",{style:b.emptyText,children:e}),t&&a&&(0,d.jsx)("button",{type:"button",className:"m9-btn m9-btn-primary",onClick:a,children:t})]})}function ny({messages:e,selectedId:t,empty:a,loading:n,store:s,outgoing:r}){return e.length===0?(0,d.jsx)("div",{style:b.listEmpty,children:n?x("\u52A0\u8F7D\u4E2D\u2026","Loading\u2026"):a}):(0,d.jsx)("ul",{style:b.list,children:e.map(o=>{let i=o.message_id===t,l=!r&&mo(o);return(0,d.jsx)("li",{children:(0,d.jsxs)("button",{type:"button",className:i?"m9-row active":"m9-row",onClick:()=>s.selectMessage(o.message_id),children:[(0,d.jsxs)("div",{style:b.rowTop,children:[o.processed_by?(0,d.jsx)(rt,{size:11,style:b.rowProcessed}):(0,d.jsx)("span",{style:l?b.rowUnreadDot:b.rowDot}),(0,d.jsx)("span",{style:l?b.rowPeerUnread:b.rowPeer,children:r?o.to_address:o.from_address}),o.list_address&&(0,d.jsx)("span",{style:b.groupTag,children:x("\u7EC4","group")}),(0,d.jsx)("span",{style:b.rowTime,children:Aa(o.created_at)})]}),o.subject?(0,d.jsx)("div",{style:l?b.rowSubjectUnread:b.rowSubject,children:o.subject}):null,(0,d.jsx)("div",{style:b.rowPreview,children:co(o)})]})},o.message_id)})})}W.use(mi({langPrefix:"language-",highlight:(e,t)=>Ld(e,t)}));function go(e){e.tagName==="A"&&(e.setAttribute("target","_blank"),e.setAttribute("rel","noopener noreferrer"))}Ua.isSupported&&Ua.addHook("afterSanitizeAttributes",go);function Bd(e){let t=W.parse(e,{gfm:!0,breaks:!0});return Ua.isSupported?Ua.sanitize(t):t}function sy({message:e,store:t}){return e?(0,d.jsxs)("article",{style:b.detail,children:[(0,d.jsxs)("header",{style:b.detailHeader,children:[(0,d.jsx)("div",{style:b.detailSubject,children:e.subject||x("\uFF08\u65E0\u4E3B\u9898\uFF09","(no subject)")}),(0,d.jsxs)("div",{style:b.detailMeta,children:[(0,d.jsxs)("span",{style:b.detailAddresses,children:[e.from_address,(0,d.jsx)(pa,{size:11,style:b.metaArrow}),e.to_address??"\u2014"]}),e.list_address&&(0,d.jsxs)("span",{style:b.groupTag,title:x("\u7EC4\u90AE\u4EF6\uFF1A\u56DE\u590D\u5C06\u53D1\u5230\u7EC4","Group mail: replies go to the group"),children:[x("\u7EC4","group")," \xB7 ",e.list_address]}),(0,d.jsx)("span",{style:b.metaTime,children:Aa(e.created_at)}),e.verified===!0&&(0,d.jsx)("span",{style:b.sigOk,title:e.key_id?`key ${e.key_id}`:void 0,children:x("\u7B7E\u540D\u5DF2\u9A8C\u8BC1","Signature verified")}),e.verified===!1&&(0,d.jsx)("span",{style:b.sigBad,title:e.key_id?`key ${e.key_id}`:void 0,children:x("\u7B7E\u540D\u65E0\u6548","Invalid signature")}),e.verified===void 0&&(0,d.jsx)("span",{style:b.sigNone,children:x("\u672A\u7B7E\u540D","Unsigned")})]}),(e.processed_by||e.read_by)&&(0,d.jsx)("div",{style:b.detailMeta,children:e.processed_by?(0,d.jsxs)("span",{style:b.processedTag,children:[(0,d.jsx)(rt,{size:11}),Rd(e),e.processed_at?` \xB7 ${Aa(e.processed_at)}`:""]}):e.read_by?(0,d.jsx)("span",{style:b.metaTime,children:e.read_by==="human"?x("\u4EBA\u5DF2\u8BFB","Read by you"):x("Agent \u5DF2\u8BFB","Read by agent")}):null}),(0,d.jsxs)("div",{style:b.detailActions,children:[mo(e)&&(0,d.jsxs)("button",{type:"button",className:"m9-btn",onClick:()=>void t.markRead(e.message_id),children:[(0,d.jsx)(rt,{size:12}),x("\u6807\u8BB0\u5DF2\u8BFB","Mark read")]}),!e.processed_by&&(0,d.jsxs)("button",{type:"button",className:"m9-btn",onClick:()=>void t.markDone(e.message_id),children:[(0,d.jsx)(rt,{size:12}),x("\u6807\u4E3A\u5DF2\u5904\u7406","Mark handled")]}),(0,d.jsxs)("button",{type:"button",className:"m9-btn",onClick:()=>t.replyTo(e),children:[(0,d.jsx)(_a,{size:12}),e.list_address?x("\u56DE\u590D\u7EC4","Reply to group"):x("\u56DE\u590D","Reply")]}),(0,d.jsxs)("button",{type:"button",className:"m9-btn",onClick:()=>void navigator.clipboard?.writeText(e.message_id),title:e.message_id,children:[(0,d.jsx)(Ot,{size:12}),x("\u590D\u5236 ID","Copy id")]})]})]}),(0,d.jsx)("div",{className:"m9-md",dangerouslySetInnerHTML:{__html:Bd(po(e))}}),(0,d.jsx)("div",{style:b.detailId,children:e.message_id})]}):(0,d.jsx)("div",{style:b.detailEmpty,children:x("\u9009\u62E9\u4E00\u6761\u6D88\u606F\u67E5\u770B\u5185\u5BB9\u3002","Select a message to read it.")})}function ry({state:e,store:t}){let a=(0,J.useMemo)(()=>{let n=[];for(let s of e.contacts)n.push({address:s.contact,label:Cs(s)});for(let s of e.peers)n.some(r=>r.address===s.address)||n.push({address:s.address,label:s.title??x("\u540C\u79DF\u6237\u6536\u4EF6\u7BB1","sibling inbox")});return n},[e.contacts,e.peers]);return(0,d.jsxs)("section",{style:b.detailCol,children:[(0,d.jsxs)("div",{style:b.composerHead,children:[(0,d.jsx)("span",{style:b.detailSubject,children:e.compose.replyTo?x("\u56DE\u590D {id}","Reply to {id}",{id:e.compose.replyTo}):x("\u5199\u6D88\u606F","Compose")}),(0,d.jsx)("button",{type:"button",className:"m9-iconbtn",onClick:()=>t.closeCompose(),title:x("\u5173\u95ED","Close"),children:(0,d.jsx)(zt,{size:14})})]}),(0,d.jsxs)("label",{style:b.field,children:[(0,d.jsx)("span",{style:b.fieldLabel,children:x("\u6536\u4EF6\u4EBA","To")}),(0,d.jsx)("input",{className:"m9-input",list:"msg9-recipients",value:e.compose.to,placeholder:"peer@msg9.io",onChange:n=>t.setCompose({to:n.target.value})}),(0,d.jsx)("datalist",{id:"msg9-recipients",children:a.map(n=>(0,d.jsx)("option",{value:n.address,children:n.label},n.address))})]}),(0,d.jsxs)("label",{style:b.field,children:[(0,d.jsx)("span",{style:b.fieldLabel,children:x("\u4E3B\u9898","Subject")}),(0,d.jsx)("input",{className:"m9-input",value:e.compose.subject,onChange:n=>t.setCompose({subject:n.target.value})})]}),(0,d.jsxs)("label",{style:b.field,children:[(0,d.jsx)("span",{style:b.fieldLabel,children:x("\u6B63\u6587","Message")}),(0,d.jsx)("textarea",{className:"m9-textarea",rows:8,value:e.compose.text,onChange:n=>t.setCompose({text:n.target.value})})]}),(0,d.jsxs)("div",{style:b.composerActions,children:[(0,d.jsxs)("button",{type:"button",className:"m9-btn m9-btn-primary",disabled:e.busy.send,onClick:()=>void t.send(),children:[(0,d.jsx)(Ge,{size:12}),e.busy.send?x("\u53D1\u9001\u4E2D\u2026","Sending\u2026"):x("\u53D1\u9001","Send")]}),(0,d.jsx)("span",{style:b.composerHint,children:x("\u4EE5 {address} \u7684\u8EAB\u4EFD\u53D1\u9001","Sent as {address}",{address:Yt(e)?.address??"\u2014"})})]})]})}function oy({state:e,store:t}){let[a,n]=(0,J.useState)(""),s=(0,J.useMemo)(()=>Ad(e.contacts,a),[e.contacts,a]),r=(0,J.useMemo)(()=>{let o=new Map;for(let i of e.accountAgents){let l=o.get(i.owner_id)??{owner_id:i.owner_id,owner_name:i.owner_name,address_domain:i.address_domain,agents:[]};l.agents.push(i),o.set(i.owner_id,l)}return[...o.values()]},[e.accountAgents]);return(0,d.jsxs)("section",{style:b.listCol,className:"m9-listcol",children:[(0,d.jsxs)("div",{style:b.searchWrap,children:[(0,d.jsx)(Ft,{size:13,style:b.searchIcon}),(0,d.jsx)("input",{className:"m9-input",style:b.searchInput,placeholder:x("\u641C\u7D22\u8054\u7CFB\u4EBA","Search contacts"),value:a,onChange:o=>n(o.target.value)})]}),s.length===0?(0,d.jsx)("div",{style:b.listEmpty,children:e.busy.contacts?x("\u52A0\u8F7D\u4E2D\u2026","Loading\u2026"):x("\u6CA1\u6709\u8054\u7CFB\u4EBA\u3002","No contacts.")}):(0,d.jsx)("ul",{style:b.list,children:s.map(o=>(0,d.jsx)("li",{children:(0,d.jsxs)("button",{type:"button",className:o.contact===e.selectedContact?"m9-row active":"m9-row",onClick:()=>t.selectContact(o.contact),children:[(0,d.jsx)("div",{style:b.contactName,children:Cs(o)}),(0,d.jsx)("div",{style:b.rowPreview,children:o.contact})]})},o.id??o.contact))}),e.peers.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:b.listHeader,children:x("\u540C\u79DF\u6237\u6536\u4EF6\u7BB1","Sibling inboxes")}),(0,d.jsx)("ul",{style:b.list,children:e.peers.map(o=>(0,d.jsx)(fy,{peer:o,store:t},o.address))})]}),r.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:b.listHeader,children:e.accountOrg?.label?x("\u6211\u7684\u79DF\u6237\u7F51\u7EDC \xB7 {org}","My tenant network \xB7 {org}",{org:e.accountOrg.label}):x("\u6211\u7684\u79DF\u6237\u7F51\u7EDC","My tenant network")}),r.map(o=>(0,d.jsxs)("div",{children:[(0,d.jsxs)("div",{style:b.networkOwner,children:[o.owner_name," \xB7 ",o.address_domain]}),(0,d.jsx)("ul",{style:b.list,children:o.agents.map(i=>(0,d.jsx)(iy,{agent:i,state:e,store:t},i.address))})]},o.owner_id))]})]})}function iy({agent:e,state:t,store:a}){let n=t.contacts.some(s=>s.contact===e.address);return(0,d.jsxs)("li",{style:b.contactRow,title:e.description??e.address,children:[(0,d.jsxs)("div",{style:b.contactText,children:[(0,d.jsxs)("div",{style:b.contactName,children:[e.display_name??e.address,e.status!=="active"&&(0,d.jsx)("span",{style:b.statusTag,children:e.status})]}),(0,d.jsx)("div",{style:b.contactAddress,children:e.address}),e.capabilities?.length?(0,d.jsx)("div",{style:b.capsRow,children:e.capabilities.map(s=>(0,d.jsx)("span",{style:b.capChip,children:s},s))}):null]}),(0,d.jsxs)("div",{style:b.rowActions,children:[!n&&(0,d.jsx)("button",{type:"button",className:"m9-iconbtn",disabled:t.busy.action,onClick:()=>void a.addContact({contact:e.address,...e.display_name?.trim()?{alias:e.display_name.trim()}:{}}),title:x("\u52A0\u8054\u7CFB\u4EBA","Add contact"),children:(0,d.jsx)(Gt,{size:13})}),(0,d.jsx)("button",{type:"button",className:"m9-iconbtn",onClick:()=>a.composeTo(e.address),title:x("\u53D1\u6D88\u606F","Message"),children:(0,d.jsx)(Ge,{size:13})})]})]})}function ly({state:e,store:t}){let a=e.contacts.find(n=>n.contact===e.selectedContact);return(0,d.jsx)("section",{style:b.detailCol,children:a?(0,d.jsx)(py,{contact:a,store:t}):(0,d.jsx)(my,{state:e,store:t})})}function uy({state:e,store:t}){let a=Yt(e)?.address??null,n=e.groups.filter(o=>o.created_by&&o.created_by===a),s=e.groups.filter(o=>!(o.created_by&&o.created_by===a));if(e.groups.length===0)return(0,d.jsx)("section",{style:b.listCol,className:"m9-listcol",children:(0,d.jsx)("div",{style:b.listEmpty,children:x("\u8FD8\u6CA1\u6709\u52A0\u5165\u4EFB\u4F55\u7EC4\u3002\u7EC4\u662F\u591A\u4E2A Agent \u56F4\u7ED5\u8BDD\u9898\u8BA8\u8BBA\u7684\u5730\u65B9\uFF08msg9 v1.19\uFF09\u3002","No groups yet. Groups are where agents discuss a topic together (msg9 v1.19).")})});let r=o=>(0,d.jsx)("li",{children:(0,d.jsxs)("button",{type:"button",className:o.address===e.selectedGroup?"m9-row active":"m9-row",onClick:()=>t.selectGroup(o.address),children:[(0,d.jsxs)("div",{style:b.rowTop,children:[(0,d.jsx)("span",{style:b.agentName,children:o.display_name??o.address}),(0,d.jsx)("span",{style:b.knownTag,children:x("{n} \u4EBA","{n}",{n:o.member_count??0})})]}),(0,d.jsx)("div",{style:b.rowPreview,children:o.address})]})},o.address);return(0,d.jsxs)("section",{style:b.listCol,className:"m9-listcol",children:[n.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:b.listHeader,children:x("\u6211\u521B\u5EFA\u7684","Created by me")}),(0,d.jsx)("ul",{style:b.list,children:n.map(r)})]}),s.length>0&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{style:b.listHeader,children:x("\u6211\u52A0\u5165\u7684","Joined")}),(0,d.jsx)("ul",{style:b.list,children:s.map(r)})]})]})}function cy({state:e,store:t}){let a=e.groupDetail??e.groups.find(s=>s.address===e.selectedGroup);if(!e.selectedGroup||!a)return(0,d.jsx)("section",{style:b.detailCol,children:(0,d.jsx)("div",{style:b.detailEmpty,children:x("\u9009\u62E9\u4E00\u4E2A\u7EC4\u67E5\u770B\u8BE6\u60C5\u548C\u7EC4\u5185\u6D88\u606F\u3002","Select a group to see its details and messages.")})});let n=a.member_count??a.members?.length??0;return(0,d.jsxs)("section",{style:b.detailCol,children:[(0,d.jsx)("article",{style:b.detail,children:(0,d.jsxs)("header",{style:b.detailHeader,children:[(0,d.jsx)("div",{style:b.detailSubject,children:a.display_name??a.address}),(0,d.jsxs)("div",{style:b.detailMeta,children:[(0,d.jsx)("span",{style:b.detailAddresses,children:a.address}),(0,d.jsx)("span",{style:b.groupTag,children:a.open?x("\u5F00\u653E\u7EC4","open"):x("\u5C01\u95ED\u7EC4","closed")}),(0,d.jsx)("span",{style:b.metaTime,children:x("{n} \u540D\u6210\u5458","{n} members",{n})})]}),a.created_by?(0,d.jsx)("div",{style:b.detailMeta,children:(0,d.jsx)("span",{style:b.metaTime,children:x("\u7EC4\u4E3B\uFF1A{by}","Created by {by}",{by:a.created_by})})}):null,a.description?(0,d.jsx)("div",{style:b.agentDescription,children:a.description}):null,a.members?.length?(0,d.jsx)("div",{style:b.agentLinks,children:a.members.map(s=>(0,d.jsx)("span",{style:b.agentLink,children:s},s))}):null,(0,d.jsx)("div",{style:b.detailActions,children:(0,d.jsxs)("button",{type:"button",className:"m9-btn m9-btn-primary",onClick:()=>t.composeTo(a.address),children:[(0,d.jsx)(Ge,{size:12}),x("\u53D1\u4FE1\u5230\u7EC4","Message the group")]})})]})}),(0,d.jsx)(dy,{state:e,store:t})]})}function dy({state:e,store:t}){let[a,n]=(0,J.useState)(null),[s,r]=(0,J.useState)(!0),o=e.groupArchive.length<e.groupArchiveTotal,i=(0,J.useMemo)(()=>{let l=[...e.groupArchive];l.sort((f,g)=>{let h=Date.parse(f.created_at??"")||0,w=Date.parse(g.created_at??"")||0;return s?h-w:w-h});let u=f=>{let g=typeof f.body?.text=="string"?f.body.text:"";return!g&&!f.subject?f.message_id:`${f.from_address}
|
|
291
|
+
${f.subject??""}
|
|
292
|
+
${g}`},c=[],p=new Map;for(let f of l){let g=u(f),h=p.get(g);if(h)h.copies+=1;else{let w={message:f,copies:1};p.set(g,w),c.push(w)}}return c},[e.groupArchive,s]);return(0,d.jsxs)("div",{style:b.groupArchive,children:[(0,d.jsxs)("div",{style:b.archiveHead,children:[(0,d.jsx)("span",{style:b.listHeader,children:x("\u7EC4\u5185\u6D88\u606F\uFF08{shown}/{total}\uFF09","Messages ({shown}/{total})",{shown:e.groupArchive.length,total:e.groupArchiveTotal})}),(0,d.jsxs)("span",{style:b.capsRow,children:[(0,d.jsx)("button",{type:"button",className:s?"m9-chip active":"m9-chip",onClick:()=>r(!0),children:x("\u6B63\u5E8F","Oldest first")}),(0,d.jsx)("button",{type:"button",className:s?"m9-chip":"m9-chip active",onClick:()=>r(!1),children:x("\u5012\u5E8F","Newest first")})]})]}),i.length===0?(0,d.jsx)("div",{style:b.listEmpty,children:x("\u7EC4\u91CC\u8FD8\u6CA1\u6709\u6D88\u606F\u3002","No messages in this group yet.")}):(0,d.jsx)("ul",{style:b.list,children:i.map(({message:l,copies:u})=>{let c=l.message_id===a;return(0,d.jsx)("li",{children:(0,d.jsxs)("button",{type:"button",className:"m9-row",onClick:()=>n(c?null:l.message_id),children:[(0,d.jsxs)("div",{style:b.rowTop,children:[(0,d.jsx)("span",{style:b.rowPeer,children:l.from_address}),u>1&&(0,d.jsx)("span",{style:b.groupTag,title:x("\u540C\u4E00\u5C01\u90AE\u4EF6\u7684 {n} \u4EFD fan-out \u526F\u672C","{n} fan-out copies of the same mail",{n:u}),children:x("\xD7{n} \u526F\u672C","\xD7{n} copies",{n:u})}),(0,d.jsx)("span",{style:b.rowTime,children:Aa(l.created_at)})]}),l.subject?(0,d.jsx)("div",{style:b.rowSubject,children:l.subject}):null,c?(0,d.jsx)("div",{className:"m9-md",style:b.archiveBody,dangerouslySetInnerHTML:{__html:Bd(po(l))}}):(0,d.jsx)("div",{style:b.rowPreview,children:co(l)})]})},l.message_id)})}),o&&(0,d.jsx)("button",{type:"button",className:"m9-btn",disabled:e.busy.archive,onClick:()=>void t.refreshGroupArchive(!0),children:e.busy.archive?x("\u52A0\u8F7D\u4E2D\u2026","Loading\u2026"):x("\u52A0\u8F7D\u66F4\u591A","Load more")})]})}function py({contact:e,store:t}){return(0,d.jsx)("article",{style:b.detail,children:(0,d.jsxs)("header",{style:b.detailHeader,children:[(0,d.jsx)("div",{style:b.detailSubject,children:Cs(e)}),(0,d.jsxs)("div",{style:b.detailMeta,children:[(0,d.jsx)("span",{style:b.detailAddresses,children:e.contact}),(0,d.jsx)("span",{style:b.metaTime,children:e.status??""})]}),e.notes?(0,d.jsx)("div",{style:b.rowPreview,children:e.notes}):null,(0,d.jsxs)("div",{style:b.detailActions,children:[(0,d.jsxs)("button",{type:"button",className:"m9-btn",onClick:()=>t.composeTo(e.contact),children:[(0,d.jsx)(Ge,{size:12}),x("\u53D1\u6D88\u606F","Message")]}),(0,d.jsxs)("button",{type:"button",className:"m9-btn",onClick:()=>void t.removeContact(e.contact),children:[(0,d.jsx)(it,{size:12}),x("\u5220\u9664","Remove")]})]})]})})}function my({state:e,store:t}){let[a,n]=(0,J.useState)(""),[s,r]=(0,J.useState)(""),[o,i]=(0,J.useState)(""),l=async()=>{!a.trim()||!await t.addContact({contact:a.trim(),...s.trim()?{alias:s.trim()}:{},...o.trim()?{notes:o.trim()}:{}})||(n(""),r(""),i(""))};return(0,d.jsxs)("div",{style:b.detail,children:[(0,d.jsx)("div",{style:b.detailSubject,children:x("\u65B0\u589E\u8054\u7CFB\u4EBA","Add a contact")}),(0,d.jsxs)("label",{style:b.field,children:[(0,d.jsx)("span",{style:b.fieldLabel,children:x("\u5730\u5740","Address")}),(0,d.jsx)("input",{className:"m9-input",placeholder:"peer@msg9.io",value:a,onChange:u=>n(u.target.value)})]}),(0,d.jsxs)("label",{style:b.field,children:[(0,d.jsx)("span",{style:b.fieldLabel,children:x("\u5907\u6CE8\u540D\uFF08\u53EF\u9009\uFF09","Alias (optional)")}),(0,d.jsx)("input",{className:"m9-input",value:s,onChange:u=>r(u.target.value)})]}),(0,d.jsxs)("label",{style:b.field,children:[(0,d.jsx)("span",{style:b.fieldLabel,children:x("\u8BF4\u660E\uFF08\u53EF\u9009\uFF09","Notes (optional)")}),(0,d.jsx)("input",{className:"m9-input",value:o,onChange:u=>i(u.target.value)})]}),(0,d.jsx)("div",{style:b.composerActions,children:(0,d.jsx)("button",{type:"button",className:"m9-btn m9-btn-primary",disabled:e.busy.action,onClick:()=>void l(),children:x("\u4FDD\u5B58\u5230 msg9 \u901A\u8BAF\u5F55","Save to the msg9 address book")})})]})}function fy({peer:e,store:t}){return(0,d.jsxs)("li",{style:b.contactRow,title:e.path??e.address,children:[(0,d.jsxs)("div",{style:b.contactText,children:[(0,d.jsx)("div",{style:b.contactName,children:e.title??x("\uFF08\u672A\u5728\u672C\u673A\u767B\u8BB0\uFF09","(not registered here)")}),(0,d.jsx)("div",{style:b.contactAddress,children:e.address})]}),(0,d.jsx)("button",{type:"button",className:"m9-iconbtn",onClick:()=>t.composeTo(e.address),title:x("\u53D1\u6D88\u606F","Message"),children:(0,d.jsx)(Ge,{size:13})})]})}function gy({state:e,store:t}){let[a,n]=(0,J.useState)(e.directoryQuery);(0,J.useEffect)(()=>{let i=setTimeout(()=>t.setDirectoryQuery(a),300);return()=>clearTimeout(i)},[a,t]);let s=(0,J.useMemo)(()=>{let i=new Set;for(let l of e.workspaces)l.address&&i.add(l.address);for(let l of e.peers)i.add(l.address);for(let l of e.contacts)i.add(l.contact);return i},[e.workspaces,e.peers,e.contacts]),r=!!(e.directoryQuery.trim()||e.directoryCapability),o=e.directory.length<e.directoryTotal;return(0,d.jsxs)("section",{style:b.listCol,className:"m9-listcol",children:[(0,d.jsxs)("div",{style:b.searchWrap,children:[(0,d.jsx)(Ft,{size:13,style:b.searchIcon}),(0,d.jsx)("input",{className:"m9-input",style:b.searchInput,placeholder:x("\u641C\u7D22\u540D\u79F0\u3001\u5730\u5740\u6216\u80FD\u529B","Search name, address or capability"),value:a,onChange:i=>n(i.target.value)})]}),e.directoryCapability&&(0,d.jsx)("div",{style:b.capsRow,children:(0,d.jsxs)("button",{type:"button",className:"m9-chip active",onClick:()=>t.setDirectoryCapability(null),title:x("\u70B9\u51FB\u6E05\u9664\u80FD\u529B\u8FC7\u6EE4","Click to clear the capability filter"),children:[e.directoryCapability," \xD7"]})}),e.directory.length===0?(0,d.jsx)("div",{style:b.listEmpty,children:e.busy.directory?x("\u52A0\u8F7D\u4E2D\u2026","Loading\u2026"):r?x("\u6CA1\u6709\u5339\u914D\u7684\u516C\u5F00 Agent\u3002","No public agents match."):x("\u5E7F\u573A\u8FD8\u6CA1\u6709\u516C\u5F00\u7684 Agent\u3002","No public agents on the square yet.")}):(0,d.jsx)("ul",{style:b.list,children:e.directory.map(i=>(0,d.jsx)("li",{children:(0,d.jsxs)("button",{type:"button",className:i.address===e.selectedAgent?"m9-row active":"m9-row",onClick:()=>t.selectAgent(i.address),children:[(0,d.jsxs)("div",{style:b.rowTop,children:[(0,d.jsx)("span",{style:b.agentName,children:fo(i)}),s.has(i.address)&&(0,d.jsx)("span",{style:b.knownTag,children:x("\u5DF2\u76F8\u8BC6","known")})]}),(0,d.jsx)("div",{style:b.rowPreview,children:i.address}),i.capabilities?.length?(0,d.jsx)("div",{style:b.capsRow,children:i.capabilities.map(l=>(0,d.jsx)("span",{style:b.capChip,children:l},l))}):null]})},i.address))}),o&&(0,d.jsx)("button",{type:"button",className:"m9-btn",disabled:e.busy.directory,onClick:()=>void t.loadMoreDirectory(),children:e.busy.directory?x("\u52A0\u8F7D\u4E2D\u2026","Loading\u2026"):x("\u52A0\u8F7D\u66F4\u591A\uFF08{shown}/{total}\uFF09","Load more ({shown}/{total})",{shown:e.directory.length,total:e.directoryTotal})})]})}function hy({state:e,store:t}){let a=e.directory.find(r=>r.address===e.selectedAgent);if(!a)return(0,d.jsx)("section",{style:b.detailCol,children:(0,d.jsx)("div",{style:b.detailEmpty,children:x("\u9009\u62E9\u4E00\u4E2A Agent \u67E5\u770B\u5B83\u7684\u540D\u7247\u3002\u5E7F\u573A\u5217\u51FA\u6240\u6709\u516C\u5F00\uFF08visibility: public\uFF09\u7684 msg9 Agent\u2014\u2014\u522B\u7684\u79DF\u6237\u3001\u522B\u7684 harness \u7684\u4E5F\u5728\u8FD9\u91CC\u3002","Select an agent to see its card. The square lists every msg9 agent published as public \u2014 other tenants and harnesses included.")})});let n=e.contacts.some(r=>r.contact===a.address),s=Object.entries(a.links??{});return(0,d.jsx)("section",{style:b.detailCol,children:(0,d.jsx)("article",{style:b.detail,children:(0,d.jsxs)("header",{style:b.detailHeader,children:[(0,d.jsx)("div",{style:b.detailSubject,children:fo(a)}),(0,d.jsxs)("div",{style:b.detailMeta,children:[(0,d.jsx)("span",{style:b.detailAddresses,children:a.address}),a.created_at?(0,d.jsx)("span",{style:b.metaTime,children:Aa(a.created_at)}):null]}),a.description?(0,d.jsx)("div",{style:b.agentDescription,children:a.description}):null,a.capabilities?.length?(0,d.jsx)("div",{style:b.capsRow,children:a.capabilities.map(r=>(0,d.jsx)("button",{type:"button",className:"m9-chip",onClick:()=>t.setDirectoryCapability(r),title:x("\u6309\u300C{cap}\u300D\u8FC7\u6EE4\u5E7F\u573A",'Filter the square by "{cap}"',{cap:r}),children:r},r))}):null,s.length>0&&(0,d.jsx)("div",{style:b.agentLinks,children:s.map(([r,o])=>(0,d.jsxs)("span",{style:b.agentLink,children:[r,": ",o]},r))}),(0,d.jsxs)("div",{style:b.detailActions,children:[(0,d.jsxs)("button",{type:"button",className:"m9-btn m9-btn-primary",onClick:()=>t.composeTo(a.address),children:[(0,d.jsx)(Ge,{size:12}),x("\u53D1\u6D88\u606F","Message")]}),!n&&(0,d.jsxs)("button",{type:"button",className:"m9-btn",disabled:e.busy.action,onClick:()=>void t.addContact({contact:a.address,...a.display_name?.trim()?{alias:a.display_name.trim()}:{}}),children:[(0,d.jsx)(Gt,{size:12}),x("\u52A0\u8054\u7CFB\u4EBA","Add contact")]}),(0,d.jsxs)("button",{type:"button",className:"m9-btn",onClick:()=>void navigator.clipboard?.writeText(a.address),children:[(0,d.jsx)(Ot,{size:12}),x("\u590D\u5236\u5730\u5740","Copy address")]})]})]})})})}var b={root:{display:"flex",flexDirection:"column",flex:1,height:"100%",minHeight:0,color:Ke,background:io,fontSize:13},columns:{flex:1,minHeight:0,display:"flex"},nav:{width:196,flexShrink:0,display:"flex",flexDirection:"column",gap:8,padding:12,borderRight:`1px solid ${he}`,minHeight:0,overflowY:"auto"},navAddress:{color:G,fontSize:10,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},composeRow:{display:"flex",alignItems:"center",gap:6},composeButton:{flex:1},bellButton:{border:`1px solid ${Ia}`,borderRadius:8,padding:5},navItems:{display:"flex",flexDirection:"column",gap:2,marginTop:4},navBadge:{marginLeft:"auto",fontSize:10,color:G},navFooter:{marginTop:"auto",display:"flex",alignItems:"center",gap:6,paddingTop:8,borderTop:`1px solid ${he}`},bellMuted:{color:ge},navTenant:{color:G,fontSize:10,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},listCol:{width:320,flexShrink:0,minHeight:0,overflowY:"auto",borderRight:`1px solid ${he}`,padding:10,display:"flex",flexDirection:"column",gap:8},folderRow:{display:"flex",gap:6,flexShrink:0},detailCol:{flex:1,minWidth:0,minHeight:0,overflowY:"auto",padding:16,display:"flex",flexDirection:"column",gap:10},setup:{display:"flex",flexDirection:"column",gap:10,padding:24,maxWidth:520},setupTitle:{fontSize:15,fontWeight:600},setupHint:{fontSize:12,color:G,lineHeight:1.6},setupHintDim:{fontSize:11,color:G,lineHeight:1.6,marginTop:4,opacity:.8},setupPath:{display:"flex",flexDirection:"column",gap:4,border:`1px solid ${he}`,borderRadius:8,padding:"10px 12px"},setupPathTitle:{fontSize:12,fontWeight:600},setupSteps:{margin:0,paddingLeft:18,fontSize:12,color:G,lineHeight:1.7},setupLabel:{display:"flex",flexDirection:"column",gap:4,fontSize:11,color:G},setupError:{fontSize:12,color:"#dc2626",whiteSpace:"pre-wrap"},setupActions:{display:"flex",gap:8,alignItems:"center"},noticeOk:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,margin:"8px 14px 0",padding:"5px 6px 5px 12px",borderRadius:8,background:"rgba(22,163,74,0.12)",color:"#166534",fontSize:12,flexShrink:0},noticeError:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,margin:"8px 14px 0",padding:"5px 6px 5px 12px",borderRadius:8,background:"rgba(220,38,38,0.12)",color:"#991b1b",fontSize:12,flexShrink:0},errorBlock:{margin:16,display:"flex",flexDirection:"column",gap:10,color:"#991b1b",fontSize:12},empty:{margin:"auto",padding:24,maxWidth:560,textAlign:"center",display:"flex",flexDirection:"column",gap:12,alignItems:"center"},emptyText:{color:G,fontSize:12,lineHeight:1.6,margin:0},list:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column",gap:2},listEmpty:{padding:16,color:G,fontSize:12},listHint:{padding:"6px 0",color:G,fontSize:10,textAlign:"center",flexShrink:0},listHeader:{fontSize:11,color:G,marginTop:6,flexShrink:0},searchWrap:{position:"relative",flexShrink:0},searchIcon:{position:"absolute",left:9,top:"50%",transform:"translateY(-50%)",color:G,pointerEvents:"none"},searchInput:{paddingLeft:28},rowTop:{display:"flex",alignItems:"center",gap:6},rowUnreadDot:{width:6,height:6,borderRadius:3,background:ge,flexShrink:0},rowDot:{width:6,height:6,borderRadius:3,background:"transparent",flexShrink:0},rowPeer:{flex:1,fontSize:12,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",color:G},rowPeerUnread:{flex:1,fontSize:12,fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},rowTime:{color:G,fontSize:10,flexShrink:0},rowProcessed:{color:"#166534",flexShrink:0},processedTag:{display:"inline-flex",alignItems:"center",gap:4,color:"#166534",fontSize:11},sigOk:{fontSize:10,color:"#166534",border:"1px solid rgba(22,163,74,0.35)",borderRadius:999,padding:"0 7px"},sigBad:{fontSize:10,color:"#b45309",border:"1px solid rgba(180,83,9,0.4)",borderRadius:999,padding:"0 7px"},sigNone:{fontSize:10,color:G,border:`1px solid ${he}`,borderRadius:999,padding:"0 7px",opacity:.7},groupTag:{flexShrink:0,fontSize:10,color:ge,border:`1px solid ${Ia}`,borderRadius:999,padding:"0 7px",whiteSpace:"nowrap"},groupArchive:{display:"flex",flexDirection:"column",gap:6,borderTop:`1px solid ${he}`,paddingTop:10},archiveHead:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8},archiveBody:{marginTop:6,borderTop:`1px dashed ${he}`,paddingTop:6},rowSubject:{fontSize:12,marginTop:2,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},rowSubjectUnread:{fontSize:12,marginTop:2,fontWeight:600,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},rowPreview:{color:G,fontSize:11,marginTop:2,lineHeight:1.5,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},detail:{display:"flex",flexDirection:"column",gap:10},detailEmpty:{color:G,fontSize:12,padding:16},detailHeader:{display:"flex",flexDirection:"column",gap:6,borderBottom:`1px solid ${he}`,paddingBottom:10},detailSubject:{fontSize:14,fontWeight:600},detailMeta:{display:"flex",justifyContent:"space-between",gap:8,color:G,fontSize:11,flexWrap:"wrap"},detailAddresses:{display:"inline-flex",alignItems:"center",gap:4,minWidth:0,flexWrap:"wrap",wordBreak:"break-all"},metaArrow:{flexShrink:0},metaTime:{flexShrink:0},detailActions:{display:"flex",gap:6,marginTop:2,flexWrap:"wrap"},detailBody:{margin:0,whiteSpace:"pre-wrap",wordBreak:"break-word",fontFamily:"inherit",fontSize:13,lineHeight:1.65},detailId:{color:G,fontSize:10,fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},composerHead:{display:"flex",alignItems:"center",justifyContent:"space-between"},composerActions:{display:"flex",alignItems:"center",gap:8,flexWrap:"wrap"},composerHint:{color:G,fontSize:10},field:{display:"flex",flexDirection:"column",gap:3},fieldLabel:{color:G,fontSize:10},contactRow:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,borderRadius:8,padding:"6px 9px",border:`1px solid ${he}`},contactText:{minWidth:0},contactName:{fontSize:12,fontWeight:500},contactAddress:{color:G,fontSize:11,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},agentName:{flex:1,fontSize:12,fontWeight:500,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},knownTag:{flexShrink:0,fontSize:10,color:ge,background:hn,borderRadius:999,padding:"1px 7px"},capsRow:{display:"flex",gap:4,flexWrap:"wrap",marginTop:4},capChip:{fontSize:10,color:G,border:`1px solid ${he}`,borderRadius:999,padding:"1px 7px",whiteSpace:"nowrap"},agentDescription:{fontSize:12,lineHeight:1.6,color:Ke,whiteSpace:"pre-wrap",wordBreak:"break-word"},agentLinks:{display:"flex",flexDirection:"column",gap:2,fontSize:11,color:G,wordBreak:"break-all"},agentLink:{fontFamily:"ui-monospace, SFMono-Regular, Menlo, monospace"},networkOwner:{fontSize:11,fontWeight:600,color:G,padding:"4px 2px 2px"},statusTag:{marginLeft:6,fontSize:10,color:G,border:`1px solid ${he}`,borderRadius:999,padding:"0 6px"},rowActions:{display:"flex",alignItems:"center",gap:2,flexShrink:0}};var Pa=require("react");var B=require("react/jsx-runtime");function js(e){let{store:t}=e,a=(0,Pa.useSyncExternalStore)(t.subscribe,t.getState,t.getState);(0,Pa.useEffect)(()=>{t.refreshOverview(),t.refreshUnread(),t.refreshPeers()},[t]);let n=a.workspaces.filter(o=>o.provisioned),s=a.workspaces.filter(o=>!o.provisioned),r=new Map(a.peers.map(o=>[o.address,o]));return(0,B.jsxs)("div",{style:q.wrap,children:[(0,B.jsx)("style",{children:It}),(0,B.jsxs)("section",{style:q.card,children:[(0,B.jsx)("div",{style:q.cardTitle,children:"msg9.io"}),(0,B.jsx)("div",{style:q.dim,children:x("msg9 \u662F\u7ED9 Agent \u7528\u7684\u90AE\u4EF6\u670D\u52A1\uFF1A\u6BCF\u4E2A dsh workspace \u4E00\u4E2A\u4FE1\u7BB1\uFF0CAgent \u7528\u5DE5\u5177\u6536\u53D1\uFF0C\u4F60\u5728\u300C\u6D88\u606F\u300D\u9875\u7B7E\u91CC\u770B\u540C\u4E00\u4E2A\u90AE\u7BB1\u3002\u5144\u5F1F workspace \u4E4B\u95F4\u53EF\u4EE5\u4E92\u53D1\u6D88\u606F\uFF0C\u8DE8\u9879\u76EE\u540C\u6B65\u4FE1\u606F\u3002",'msg9 is email for agents: one inbox per dsh workspace \u2014 the agent mails through tools while you read the same mailbox in the "Messages" view tab. Sibling workspaces can message each other to sync across projects.')}),(0,B.jsx)("a",{className:"m9-link",style:q.link,href:"https://msg9.io",target:"_blank",rel:"noreferrer",children:"msg9.io"})]}),(0,B.jsxs)("section",{style:q.card,children:[(0,B.jsx)("div",{style:q.cardTitle,children:x("\u79DF\u6237","Tenant")}),a.status==="loading"?(0,B.jsx)("div",{style:q.dim,children:x("\u52A0\u8F7D\u4E2D\u2026","Loading\u2026")}):a.owner?(0,B.jsxs)("dl",{style:q.fields,children:[(0,B.jsxs)("div",{style:q.fieldRow,children:[(0,B.jsx)("dt",{style:q.fieldName,children:x("\u540D\u79F0","Name")}),(0,B.jsx)("dd",{style:q.fieldValue,children:a.owner.name??"\u2014"})]}),(0,B.jsxs)("div",{style:q.fieldRow,children:[(0,B.jsx)("dt",{style:q.fieldName,children:"ID"}),(0,B.jsx)("dd",{style:q.fieldValue,children:a.owner.id??"\u2014"})]}),(0,B.jsxs)("div",{style:q.fieldRow,children:[(0,B.jsx)("dt",{style:q.fieldName,children:x("\u79DF\u6237\u57DF\u540D","Domain")}),(0,B.jsx)("dd",{style:q.fieldValue,children:a.owner.address_domain??(a.owner.slug?`${a.owner.slug}.${a.owner.mail_domain??"msg9.io"}`:x("\u672A\u5206\u914D\uFF08\u6241\u5E73 @msg9.io\uFF09","none (flat @msg9.io)"))})]}),(0,B.jsxs)("div",{style:q.fieldRow,children:[(0,B.jsx)("dt",{style:q.fieldName,children:"Key"}),(0,B.jsx)("dd",{style:q.fieldValue,children:a.owner.masked})]}),(0,B.jsxs)("div",{style:q.fieldRow,children:[(0,B.jsx)("dt",{style:q.fieldName,children:"API"}),(0,B.jsx)("dd",{style:q.fieldValue,children:a.apiUrl})]})]}):(0,B.jsx)(bn,{state:a,store:t})]}),(0,B.jsxs)("section",{style:q.card,children:[(0,B.jsx)("div",{style:q.cardTitle,children:x("\u5DF2\u5F00\u901A\u7684\u4FE1\u7BB1\uFF08{n}\uFF09","Open inboxes ({n})",{n:n.length})}),n.length===0?(0,B.jsx)("div",{style:q.dim,children:x("\u8FD8\u6CA1\u6709\u5F00\u901A\u4EFB\u4F55\u4FE1\u7BB1\u3002\u5728\u4F1A\u8BDD\u91CC\u8BA9 Agent \u8C03\u7528 msg9_inbox\uFF0C\u6216\u5728\u300C\u6D88\u606F\u300D\u9875\u7B7E\u91CC\u70B9\u300C\u5F00\u901A\u6536\u4EF6\u7BB1\u300D\u3002",'No inboxes yet. Ask the agent to run msg9_inbox in a session, or use "Open inbox" in the "Messages" view tab.')}):(0,B.jsx)("ul",{style:q.list,children:n.map(o=>{let i=a.unreadByKey[o.key]??0,l=a.totalByKey[o.key],u=nt(i),c=r.get(o.address??"");return(0,B.jsxs)("li",{style:q.row,children:[(0,B.jsx)(ba,{size:14,style:q.rowIcon}),(0,B.jsxs)("div",{style:q.rowText,children:[(0,B.jsx)("div",{style:q.rowTitle,children:o.title}),(0,B.jsx)("div",{style:q.dim,children:o.address}),c?.description?(0,B.jsx)("div",{style:q.role,children:c.description}):null,c?.capabilities?.length?(0,B.jsx)("div",{style:q.caps,children:c.capabilities.join(" \xB7 ")}):null,(0,B.jsx)("div",{style:q.path,children:o.path})]}),(0,B.jsxs)("div",{style:q.rowStats,children:[l!==void 0?(0,B.jsx)("span",{style:q.dim,children:x("{unread} \u672A\u8BFB \xB7 \u5171 {total} \u5C01","{unread} unread \xB7 {total} total",{unread:i,total:l})}):null,u?(0,B.jsx)("span",{style:q.badge,children:u}):null]})]},o.key)})}),s.length>0?(0,B.jsx)("div",{style:q.pending,children:x("\u5C1A\u672A\u5F00\u901A\uFF1A{list}","Not opened yet: {list}",{list:s.map(o=>o.title).join("\u3001")})}):null]}),(0,B.jsx)(by,{state:a,store:t})]})}function by({state:e,store:t}){let[a,n]=(0,Pa.useState)(""),s=e.workspaces.filter(r=>r.provisioned&&r.legacy);return!e.owner?.slug||s.length===0?null:(0,B.jsxs)("section",{style:q.card,children:[(0,B.jsx)("div",{style:q.cardTitle,children:x("\u8FC1\u79FB\u5230\u65B0\u79DF\u6237\uFF08{n}\uFF09","Migrate to the new tenant ({n})",{n:s.length})}),(0,B.jsx)("div",{style:q.dim,children:x("\u4EE5\u4E0B\u6536\u4EF6\u7BB1\u8FD8\u5F00\u5728\u65E7\u79DF\u6237\u4E0B\uFF08\u57DF\u540D\u4E0D\u662F {domain}\uFF09\u3002\u8FC1\u79FB\u4F1A\u5728\u65B0\u79DF\u6237\u4E0B\u6309\u5730\u5740\u89C4\u8303\u91CD\u65B0\u5F00\u901A\uFF0C\u5E76\u7ED9\u65E7\u5730\u5740\u8BBE\u7F6E\u8F6C\u53D1\uFF08\u65B0\u90AE\u4EF6\u81EA\u52A8\u8FDB\u65B0\u4FE1\u7BB1\uFF0C\u65E7\u5730\u5740\u4E0D\u4F1A\u88AB\u4ED6\u4EBA\u6CE8\u518C\uFF09\u3002","These inboxes still live under the previous tenant (not on {domain}). Migrating re-opens them under the new tenant with the naming spec and sets forwarding on the old address (new mail lands in the new mailbox; the old address stays reserved).",{domain:e.owner.address_domain??`${e.owner.slug}.${e.owner.mail_domain??"msg9.io"}`})}),(0,B.jsxs)("label",{style:q.migrateKeyRow,children:[(0,B.jsx)("span",{style:q.dim,children:x("\u65E7\u79DF\u6237 key\uFF08\u53EF\u9009\uFF0C\u7528\u4E8E\u642C\u8FD0\u540C\u79DF\u6237\u5386\u53F2\u90AE\u4EF6\u5E76\u505C\u7528\u65E7\u6536\u4EF6\u7BB1\uFF09","Old tenant key (optional \u2014 moves same-tenant history and suspends the old inbox)")}),(0,B.jsx)("input",{className:"m9-input",type:"password",value:a,autoComplete:"off",spellCheck:!1,placeholder:"msg9_tk_\u2026",onChange:r=>n(r.target.value)})]}),(0,B.jsx)("ul",{style:q.list,children:s.map(r=>(0,B.jsxs)("li",{style:q.row,children:[(0,B.jsxs)("div",{style:q.rowText,children:[(0,B.jsx)("div",{style:q.rowTitle,children:r.title}),(0,B.jsx)("div",{style:q.dim,children:r.address}),r.planned_address?(0,B.jsxs)("div",{style:q.caps,children:["\u2192 ",r.planned_address]}):null]}),(0,B.jsx)("button",{type:"button",className:"m9-btn m9-btn-primary",disabled:e.busy.action,onClick:()=>void t.migrate(r.key,a||void 0),children:e.busy.action?x("\u8FC1\u79FB\u4E2D\u2026","Migrating\u2026"):x("\u8FC1\u79FB","Migrate")})]},r.key))})]})}var q={wrap:{display:"flex",flexDirection:"column",gap:20,padding:"16px 0",maxWidth:640,color:Ke,fontSize:13},card:{display:"flex",flexDirection:"column",gap:8},cardTitle:{fontSize:13,fontWeight:600},link:{fontSize:12,alignSelf:"flex-start"},fields:{margin:0,display:"flex",flexDirection:"column",gap:6},fieldRow:{display:"flex",gap:12,fontSize:13},fieldName:{flex:"none",width:72,color:G,fontSize:12},fieldValue:{margin:0,minWidth:0,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},dim:{fontSize:12,color:G,lineHeight:1.6},list:{listStyle:"none",margin:0,padding:0,display:"flex",flexDirection:"column"},row:{display:"flex",alignItems:"center",gap:10,padding:"9px 0",borderTop:`1px solid ${he}`},rowIcon:{flexShrink:0,color:G},rowText:{display:"flex",flexDirection:"column",gap:2,minWidth:0,flex:1},rowTitle:{fontSize:13,fontWeight:500},role:{fontSize:11,color:Ke,lineHeight:1.5},caps:{fontSize:10,color:ge,lineHeight:1.5},path:{fontSize:11,color:G,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},rowStats:{display:"flex",alignItems:"center",gap:8,flexShrink:0},badge:{minWidth:18,height:18,padding:"0 5px",borderRadius:9,background:ge,color:"#ffffff",fontSize:11,lineHeight:"18px",textAlign:"center",fontWeight:600},pending:{fontSize:12,color:G,borderTop:`1px solid ${he}`,paddingTop:8},migrateKeyRow:{display:"flex",flexDirection:"column",gap:4,maxWidth:380}};var yy="msg9-kit",xy=["slots"],qd="msg9",Dd="msg9-mailboxes";function _y(e){let t=e,a=t.logger("msg9-kit:client"),n=$s();t.effect(()=>n.start(),"msg9-kit: unread poller"),t.slots.inject("conversation.view",()=>t.slots.register({name:"conversation.view",id:qd,order:30,label:()=>{let r=nt(n.getState().unreadTotal)?x("\u6D88\u606F\uFF08{n}\uFF09","Messages ({n})",{n:n.getState().unreadTotal}):x("\u6D88\u606F","Messages");return n.getState().notifyPaused?`${r}\u2016`:r},inject:()=>({store:n})},Ls)),t.slots.inject("settings.section",()=>t.slots.register({name:"settings.section",id:Dd,order:50,label:()=>x("\u6D88\u606F\u4FE1\u7BB1","Messages"),inject:()=>({store:n})},js)),a.info("msg9-kit browser face ready (conversation view + settings mailboxes)")}
|
|
291
293
|
/*! Bundled license information:
|
|
292
294
|
|
|
293
295
|
dompurify/dist/purify.es.mjs:
|