@typescape-ai/cli 1.5.0 → 1.6.0
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/dist/cli.js +11 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -287,7 +287,7 @@ ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.pus
|
|
|
287
287
|
`)+1;while(t!==0)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
288
288
|
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let n="end"in t.value?t.value.end:void 0;if((Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment")n?.push(this.sourceToken);else e.items.push({start:[this.sourceToken]})}else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let a=e.items[e.items.length-2]?.value?.end;if(Array.isArray(a)){Array.prototype.push.apply(a,t.start),a.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,a=n&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",r=[];if(a&&t.sep&&!t.value){let i=[];for(let o=0;o<t.sep.length;++o){let s=t.sep[o];switch(s.type){case"newline":i.push(o);break;case"space":break;case"comment":if(s.indent>e.indent)i.length=0;break;default:i.length=0}}if(i.length>=2)r=t.sep.splice(i[1])}switch(this.type){case"anchor":case"tag":if(a||t.value)r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0;else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"explicit-key-ind":if(!t.sep&&!t.explicitKey)t.start.push(this.sourceToken),t.explicitKey=!0;else if(a||t.value)r.push(this.sourceToken),e.items.push({start:r,explicitKey:!0});else this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]});this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(!t.sep)if(wo(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let i=sc(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]})}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(wo(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(DZ(t.key)&&!wo(t.sep,"newline")){let i=sc(t.start),o=t.key,s=t.sep;s.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:o,sep:s}]})}else if(r.length>0)t.sep=t.sep.concat(r,this.sourceToken);else t.sep.push(this.sourceToken);else if(!t.sep)Object.assign(t,{key:null,sep:[this.sourceToken]});else if(t.value||a)e.items.push({start:r,key:null,sep:[this.sourceToken]});else if(wo(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]});else t.sep.push(this.sourceToken);this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let i=this.flowScalar(this.type);if(a||t.value)e.items.push({start:r,key:i,sep:[]}),this.onKeyLine=!0;else if(t.sep)this.stack.push(i);else Object.assign(t,{key:i,sep:[]}),this.onKeyLine=!0;return}default:{let i=this.startBlockValue(e);if(i){if(n&&i.type!=="block-seq")e.items.push({start:r});this.stack.push(i);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let n="end"in t.value?t.value.end:void 0;if((Array.isArray(n)?n[n.length-1]:void 0)?.type==="comment")n?.push(this.sourceToken);else e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let a=e.items[e.items.length-2]?.value?.end;if(Array.isArray(a)){Array.prototype.push.apply(a,t.start),a.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;if(t.value||wo(t.start,"seq-item-ind"))e.items.push({start:[this.sourceToken]});else t.start.push(this.sourceToken);return}if(this.indent>e.indent){let n=this.startBlockValue(e);if(n){this.stack.push(n);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let n;do yield*this.pop(),n=this.peek(1);while(n&&n.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":if(!t||t.sep)e.items.push({start:[this.sourceToken]});else t.start.push(this.sourceToken);return;case"map-value-ind":if(!t||t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":if(!t||t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let a=this.flowScalar(this.type);if(!t||t.value)e.items.push({start:[],key:a,sep:[]});else if(t.sep)this.stack.push(a);else Object.assign(t,{key:a,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);if(n)this.stack.push(n);else yield*this.pop(),yield*this.step()}else{let n=this.peek(2);if(n.type==="block-map"&&(this.type==="map-value-ind"&&n.indent===e.indent||this.type==="newline"&&!n.items[n.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&n.type!=="flow-collection"){let a=Eb(n),r=sc(a);IZ(e);let i=e.end.splice(1,e.end.length);i.push(this.sourceToken);let o={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:i}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=o}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(`
|
|
289
289
|
`)+1;while(t!==0)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
290
|
-
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=Eb(e),n=sc(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=Eb(e),n=sc(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){if(this.type!=="comment")return!1;if(this.indent<=t)return!1;return e.every((n)=>n.type==="newline"||n.type==="space")}*documentEnd(e){if(this.type!=="doc-mode"){if(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}Vqe.Parser=FZ});var qZ=S((sNe)=>{var $Z=ex(),eNe=Vl(),rd=Xl(),tNe=lQ(),nNe=ze(),aNe=lx(),SZ=dx();function LZ(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new aNe.LineCounter||null,prettyErrors:t}}function rNe(e,t={}){let{lineCounter:n,prettyErrors:a}=LZ(t),r=new SZ.Parser(n?.addNewLine),i=new $Z.Composer(t),o=Array.from(i.compose(r.parse(e)));if(a&&n)for(let s of o)s.errors.forEach(rd.prettifyError(e,n)),s.warnings.forEach(rd.prettifyError(e,n));if(o.length>0)return o;return Object.assign([],{empty:!0},i.streamInfo())}function jZ(e,t={}){let{lineCounter:n,prettyErrors:a}=LZ(t),r=new SZ.Parser(n?.addNewLine),i=new $Z.Composer(t),o=null;for(let s of i.compose(r.parse(e),!0,e.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new rd.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(a&&n)o.errors.forEach(rd.prettifyError(e,n)),o.warnings.forEach(rd.prettifyError(e,n));return o}function iNe(e,t,n){let a=void 0;if(typeof t==="function")a=t;else if(n===void 0&&t&&typeof t==="object")n=t;let r=jZ(e,n);if(!r)return null;if(r.warnings.forEach((i)=>tNe.warn(r.options.logLevel,i)),r.errors.length>0)if(r.options.logLevel!=="silent")throw r.errors[0];else r.errors=[];return r.toJS(Object.assign({reviver:a},n))}function oNe(e,t,n){let a=null;if(typeof t==="function"||Array.isArray(t))a=t;else if(n===void 0&&t)n=t;if(typeof n==="string")n=n.length;if(typeof n==="number"){let r=Math.round(n);n=r<1?void 0:r>8?{indent:8}:{indent:r}}if(e===void 0){let{keepUndefined:r}=n??t??{};if(!r)return}if(nNe.isDocument(e)&&!a)return e.toString(n);return new eNe.Document(e,a,n).toString(n)}sNe.parse=iNe;sNe.parseAllDocuments=rNe;sNe.parseDocument=jZ;sNe.stringify=oNe});var cY=S((dut,NMe)=>{NMe.exports={name:"@typescape-ai/cli",version:"1.
|
|
290
|
+
`,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=Eb(e),n=sc(t);return n.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=Eb(e),n=sc(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:n,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){if(this.type!=="comment")return!1;if(this.indent<=t)return!1;return e.every((n)=>n.type==="newline"||n.type==="space")}*documentEnd(e){if(this.type!=="doc-mode"){if(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;case"space":case"comment":default:if(e.end)e.end.push(this.sourceToken);else e.end=[this.sourceToken];if(this.type==="newline")yield*this.pop()}}}Vqe.Parser=FZ});var qZ=S((sNe)=>{var $Z=ex(),eNe=Vl(),rd=Xl(),tNe=lQ(),nNe=ze(),aNe=lx(),SZ=dx();function LZ(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new aNe.LineCounter||null,prettyErrors:t}}function rNe(e,t={}){let{lineCounter:n,prettyErrors:a}=LZ(t),r=new SZ.Parser(n?.addNewLine),i=new $Z.Composer(t),o=Array.from(i.compose(r.parse(e)));if(a&&n)for(let s of o)s.errors.forEach(rd.prettifyError(e,n)),s.warnings.forEach(rd.prettifyError(e,n));if(o.length>0)return o;return Object.assign([],{empty:!0},i.streamInfo())}function jZ(e,t={}){let{lineCounter:n,prettyErrors:a}=LZ(t),r=new SZ.Parser(n?.addNewLine),i=new $Z.Composer(t),o=null;for(let s of i.compose(r.parse(e),!0,e.length))if(!o)o=s;else if(o.options.logLevel!=="silent"){o.errors.push(new rd.YAMLParseError(s.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}if(a&&n)o.errors.forEach(rd.prettifyError(e,n)),o.warnings.forEach(rd.prettifyError(e,n));return o}function iNe(e,t,n){let a=void 0;if(typeof t==="function")a=t;else if(n===void 0&&t&&typeof t==="object")n=t;let r=jZ(e,n);if(!r)return null;if(r.warnings.forEach((i)=>tNe.warn(r.options.logLevel,i)),r.errors.length>0)if(r.options.logLevel!=="silent")throw r.errors[0];else r.errors=[];return r.toJS(Object.assign({reviver:a},n))}function oNe(e,t,n){let a=null;if(typeof t==="function"||Array.isArray(t))a=t;else if(n===void 0&&t)n=t;if(typeof n==="string")n=n.length;if(typeof n==="number"){let r=Math.round(n);n=r<1?void 0:r>8?{indent:8}:{indent:r}}if(e===void 0){let{keepUndefined:r}=n??t??{};if(!r)return}if(nNe.isDocument(e)&&!a)return e.toString(n);return new eNe.Document(e,a,n).toString(n)}sNe.parse=iNe;sNe.parseAllDocuments=rNe;sNe.parseDocument=jZ;sNe.stringify=oNe});var cY=S((dut,NMe)=>{NMe.exports={name:"@typescape-ai/cli",version:"1.6.0",description:"Typescape CLI - Create review sessions, export feedback, and integrate with AI workflows",type:"module",bin:{typescape:"./dist/cli.js"},files:["dist","README.md"],exports:{".":"./dist/cli.js"},publishConfig:{access:"public"},scripts:{build:"bun build src/index.ts --outfile=dist/cli.js --target=bun --bundle --minify",dev:"bun run --watch src/index.ts",test:"bun test",typecheck:"tsc -p tsconfig.typecheck.json --noEmit",lint:"eslint src",prepublishOnly:"bun run build"},dependencies:{},devDependencies:{"@types/bun":"1.1.14","@typescape/integrity":"workspace:*","@typescape/schemas":"workspace:*",ajv:"8.17.1","ajv-formats":"3.0.1",yaml:"2.8.2",zod:"4.3.0"},engines:{bun:">=1.0.0"},keywords:["typescape","cli","review","documentation","ai","feedback","bun"],repository:{type:"git",url:"https://github.com/voidserf/typescape-docs.git",directory:"apps/cli"},license:"MIT"}});var K=0,ba=1,T=2,Pt=3,za=4,Ib=5;function kx(e){if(e>=500)return 4;if(e===401||e===403)return 3;if(e>=400&&e<500)return 2;return 0}function $t(e,t){if(t==="json")console.log(JSON.stringify(e,null,2));else if(typeof e==="string")console.log(e);else if(typeof e==="object"&&e!==null)for(let[n,a]of Object.entries(e))console.log(`${n}: ${a}`);else console.log(String(e))}function U(e,t){console.error(JSON.stringify({error:e},null,2)),process.exit(t)}function Bx(e){console.error(e)}import{existsSync as Oae,readFileSync as Zae}from"fs";import{resolve as UD}from"path";var Tne=If(),One=Sc(),Zne=pf(),Pf=Lc(),Yne=hc(),Qr=Ge(),Kne=Br(),Wne=kt(),Jne=_r(),Vne=Er(),URe=Ud(),Xne=Mf(),eae=Gf(),tae=Rf(),Od=ID(),DD=bc();var nae=Tne.Composer,aae=One.Document,rae=Zne.Schema,iae=Pf.YAMLError,oae=Pf.YAMLParseError,sae=Pf.YAMLWarning,cae=Yne.Alias,Aae=Qr.isAlias,lae=Qr.isCollection,dae=Qr.isDocument,uae=Qr.isMap,pae=Qr.isNode,mae=Qr.isPair,gae=Qr.isScalar,bae=Qr.isSeq,fae=Kne.Pair,hae=Wne.Scalar,yae=Jne.YAMLMap,wae=Vne.YAMLSeq;var kae=Xne.Lexer,Bae=eae.LineCounter,Cae=tae.Parser,Ci=Od.parse,_ae=Od.parseAllDocuments,Eae=Od.parseDocument,vae=Od.stringify,Qae=DD.visit,xae=DD.visitAsync;import{existsSync as Kd,readFileSync as Hf,writeFileSync as qD,mkdirSync as Nae,unlinkSync as Mae}from"fs";import{join as ND}from"path";import{createInterface as Gae}from"readline";import{homedir as MD,hostname as Rae}from"os";import{existsSync as zf,mkdirSync as Iae,writeFileSync as FD}from"fs";import{join as $D,basename as Dae,resolve as Fae}from"path";import{createInterface as $ae}from"readline";async function xr(e){if(!e||typeof e==="number")return"";return new Response(e).text()}async function Zd(){return Bun.stdin.text()}var Yd="https://prod.typescape.ai";function Sae(e){let t={yes:!1,force:!1,format:"text"},n=0;while(n<e.length){let a=e[n];if(a==="--yes"||a==="-y")t.yes=!0,n++;else if(a==="--force"||a==="-f")t.force=!0,n++;else if(a==="--base-url")t.baseUrl=e[n+1],n+=2;else if(a.startsWith("--base-url="))t.baseUrl=a.slice(11),n++;else if(a==="--format"){let r=e[n+1];if(r==="json"||r==="text")t.format=r;n+=2}else if(a.startsWith("--format=")){let r=a.slice(9);if(r==="json"||r==="text")t.format=r;n++}else n++}return t}async function Lae(){try{let e=Bun.spawn(["git","remote","get-url","origin"],{stdout:"pipe",stderr:"pipe"}),t=await xr(e.stdout);if(await e.exited===0&&t.trim()){let r=t.trim().match(/\/([^/]+?)(?:\.git)?$/);if(r)return r[1]}}catch{}return Dae(process.cwd())}async function jae(e,t,n){if(n.yes)return t;if(!process.stdin.isTTY)return t;let a=$ae({input:process.stdin,output:process.stdout});return new Promise((r)=>{a.question(`${e} [${t}]: `,(i)=>{a.close(),r(i.trim()||t)})})}function qae(e,t){return`version: 1
|
|
291
291
|
|
|
292
292
|
deployment:
|
|
293
293
|
profile: "standard"
|
|
@@ -314,12 +314,14 @@ parsing:
|
|
|
314
314
|
`),console.log(`This will create a .typescape/ directory in your repo.
|
|
315
315
|
`);o=await jae("Repository ID",r,t)}try{if(!zf(n))Iae(n,{recursive:!0})}catch(c){let A=c instanceof Error?c.message:String(c);U({code:"directory_create_failed",message:`Failed to create .typescape/: ${A}`},T)}try{let c=qae(o,i);FD(a,c,"utf-8")}catch(c){let A=c instanceof Error?c.message:String(c);U({code:"file_write_failed",message:`Failed to write config file: ${A}`},T)}let s=$D(n,".gitkeep");if(!zf(s))try{FD(s,"","utf-8")}catch{}if(t.format==="json")$t({status:"created",path:a,repo_id:o,base_url:i},t.format);else console.log(`
|
|
316
316
|
Created ${a}`),console.log(`
|
|
317
|
-
Next steps:`),console.log("1. Log in: typescape auth login"),console.log("2. Commit the .typescape/ directory"),console.log("3. Create your first review session:"),console.log(" $ typescape session create --file README.md
|
|
317
|
+
Next steps:`),console.log("1. Log in: typescape auth login"),console.log("2. Commit the .typescape/ directory"),console.log("3. Create your first review session:"),console.log(" $ typescape session create --file README.md --reviewer user@example.com --title 'My Review'"),console.log(`
|
|
318
|
+
Non-interactive setup (for CI/agents):`),console.log(` $ typescape init --yes --base-url ${i}`),console.log(" $ TYPESCAPE_API_KEY=ts_... typescape session create --file README.md --format json"),console.log(`
|
|
319
|
+
See typescape session create --help for all flags including --reviewer, --approver, --reviewers-from.`);process.exit(K)}function Jn(){return ND(MD(),".config","typescape","credentials.json")}function Wd(e){let t=Jn();if(!Kd(t))return null;try{let n=Hf(t,"utf-8");return JSON.parse(n)[e]||null}catch{return null}}function Pae(e,t){let n=Jn(),a=ND(MD(),".config","typescape");if(!Kd(a))Nae(a,{recursive:!0});let r={};if(Kd(n))try{r=JSON.parse(Hf(n,"utf-8"))}catch{}r[e]=t,qD(n,JSON.stringify(r,null,2)+`
|
|
318
320
|
`,{encoding:"utf-8",mode:384})}function zae(e){let t=Jn();if(!Kd(t))return!1;let n;try{n=JSON.parse(Hf(t,"utf-8"))}catch{return!1}if(!(e in n))return!1;if(delete n[e],Object.keys(n).length===0)Mae(t);else qD(t,JSON.stringify(n,null,2)+`
|
|
319
321
|
`,{encoding:"utf-8",mode:384});return!0}function LD(e){let t=Gae({input:process.stdin,output:process.stderr});return new Promise((n)=>{t.question(e,(a)=>{t.close(),n(a.trim())})})}function Uae(e){let t={baseUrl:Yd,format:"text"},n=0;while(n<e.length){let a=e[n];if(a==="--email")t.email=e[n+1],n+=2;else if(a.startsWith("--email="))t.email=a.slice(8),n++;else if(a==="--otp")t.otp=e[n+1],n+=2;else if(a.startsWith("--otp="))t.otp=a.slice(6),n++;else if(a==="--base-url")t.baseUrl=e[n+1],n+=2;else if(a.startsWith("--base-url="))t.baseUrl=a.slice(11),n++;else if(a==="--key-name")t.keyName=e[n+1],n+=2;else if(a.startsWith("--key-name="))t.keyName=a.slice(11),n++;else if(a==="--format"){let r=e[n+1];if(r==="json"||r==="text")t.format=r;n+=2}else if(a.startsWith("--format=")){let r=a.slice(9);if(r==="json"||r==="text")t.format=r;n++}else n++}return t}function GD(e){let t={baseUrl:Yd,format:"text"},n=0;while(n<e.length){let a=e[n];if(a==="--base-url")t.baseUrl=e[n+1],n+=2;else if(a.startsWith("--base-url="))t.baseUrl=a.slice(11),n++;else if(a==="--format"){let r=e[n+1];if(r==="json"||r==="text")t.format=r;n+=2}else if(a.startsWith("--format=")){let r=a.slice(9);if(r==="json"||r==="text")t.format=r;n++}else n++}return t}async function Uf(e,t,n={}){let a;try{a=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json",...n},body:JSON.stringify(t),redirect:"manual"})}catch(s){let c=s instanceof Error?s.message:String(s);U({code:"network_error",message:`Network error: ${c}`},Pt)}let r=a.headers.get("Set-Cookie"),i=a.headers.get("Content-Type")||"",o;if(i.includes("application/json"))try{o=await a.json()}catch{o={}}else o={};return{status:a.status,body:o,setCookie:r}}function jD(e){if(!e)return null;let t=e.match(/(?:__Host-typescape_console|typescape_console)=([^;]+)/);return t?t[1]:null}function Hae(e,t){return`${t.startsWith("https://")?"__Host-typescape_console":"typescape_console"}=${e}`}async function RD(e){let t=Uae(e),n=t.baseUrl.replace(/\/$/,""),a=t.otp||process.env.TYPESCAPE_OTP,r=t.email;if(!r){if(!process.stdin.isTTY)U({code:"missing_email",message:"Email is required. Use --email <email> in non-interactive mode."},T);if(r=await LD("Email: "),!r)U({code:"missing_email",message:"Email is required."},T)}let i=Wd(n);if(i&&i.email===r&&!a){if(t.format==="json")$t({status:"already_authenticated",email:i.email,base_url:n,credentials_path:Jn(),created_at:i.created_at},t.format);else console.log(`Already authenticated as ${i.email}`),console.log(`Credentials stored at ${Jn()}`),console.log(`
|
|
320
322
|
To re-authenticate, run: typescape auth logout && typescape auth login`);process.exit(K)}if(t.format==="text")console.error(`Sending OTP to ${r}...`);let o=await Uf(`${n}/v1/auth/console/login`,{email:r});if(o.status!==200){let u=o.body;U({code:u?.error?.code||"login_failed",message:u?.error?.message||`Login request failed with status ${o.status}`},o.status>=500?4:T)}let s=o.body,c;if(s.status==="authenticated"){if(c=jD(o.setCookie),!c)U({code:"auth_failed",message:"Server returned authenticated status but no session cookie"},Pt)}else{let u=a;if(!u){if(!process.stdin.isTTY){if(t.format==="json")$t({status:"otp_sent",email:r,message:`OTP sent to ${r}. Re-run with --otp <code> to complete authentication.`,expires_in:300},t.format);else console.log(`OTP sent to ${r}`),console.log("Re-run with --otp <code> to complete authentication.");process.exit(K)}u=await LD("Enter the 6-digit code sent to your email: ")}if(!/^\d{6}$/.test(u))U({code:"invalid_otp",message:"OTP code must be exactly 6 digits."},T);let p=await Uf(`${n}/v1/auth/console/verify`,{email:r,code:u});if(p.status!==200){let g=p.body;U({code:g?.error?.code||"verify_failed",message:g?.error?.message||`OTP verification failed with status ${p.status}`},p.status>=500?4:T)}if(c=jD(p.setCookie),!c)U({code:"auth_failed",message:"Verification succeeded but no session cookie was returned"},Pt)}let A=t.keyName||`CLI (${Rae()})`;if(t.format==="text")console.error("Creating API key...");let l=await Uf(`${n}/v1/api-tokens`,{name:A,scope:{scope_level:"tenant",allowed_operations:["create_session","get_session","export","get_status","run_checks","create_links","manage_webhooks","admin"]}},{Cookie:Hae(c,n),"X-Typescape-Request":"1"});if(l.status!==201&&l.status!==200){let u=l.body;U({code:u?.error?.code||"token_create_failed",message:u?.error?.message||`Failed to create API key (status ${l.status})`},l.status>=500?4:Pt)}let d=l.body;if(!d.raw_token)U({code:"token_create_failed",message:"Server did not return a raw token."},Pt);if(Pae(n,{api_key:d.raw_token,email:r,created_at:new Date().toISOString()}),t.format==="json")$t({status:"authenticated",email:r,base_url:n,token_id:d.token_id,credentials_path:Jn()},t.format);else console.log(`
|
|
321
323
|
Authenticated as ${r}`),console.log(`API key saved to ${Jn()}`),console.log(`
|
|
322
|
-
You can now use Typescape CLI commands without setting TYPESCAPE_API_KEY.`);process.exit(K)}function Tae(e){return GD(e)}async function PD(e){let t=Tae(e),n=t.baseUrl.replace(/\/$/,""),a=Wd(n);if(!a){if(t.format==="json")$t({authenticated:!1,base_url:n,credentials_path:Jn()},t.format);else console.log(`Not authenticated for ${n}`),console.log("Run 'typescape auth login' to authenticate.");process.exit(K)}if(t.format==="json")$t({authenticated:!0,email:a.email,base_url:n,key_prefix:a.api_key.slice(0,8)+"...",created_at:a.created_at,credentials_path:Jn()},t.format);else console.log(`Authenticated as ${a.email}`),console.log(`Server: ${n}`),console.log(`Key: ${a.api_key.slice(0,8)}...`),console.log(`Created: ${a.created_at}`),console.log(`Stored at: ${Jn()}`);process.exit(K)}async function zD(e){let t=GD(e),n=t.baseUrl.replace(/\/$/,""),a=zae(n);if(t.format==="json")$t({status:a?"logged_out":"not_logged_in",base_url:n},t.format);else if(a)console.log(`Logged out from ${n}`),console.log(`Credentials removed from ${Jn()}`);else console.log(`No stored credentials for ${n}`);process.exit(K)}var Tf=".typescape/config.yaml",Yae="TYPESCAPE_API_KEY",HD="TYPESCAPE_BASE_URL",Rc=1;function Kae(e){if(e)return UD(e);return UD(Tf)}function Vn(e){let t=Kae(e);if(!Oae(t))U({code:"config_not_found",message:`Configuration file not found: ${t}. Create a .typescape/config.yaml file or use --config to specify a path.`},T);let n;try{let A=Zae(t,"utf-8");n=Ci(A)}catch(A){let l=A instanceof Error?A.message:String(A);U({code:"config_parse_error",message:`Failed to parse config file: ${l}`},T)}if(n.version!==void 0&&n.version!==Rc)U({code:"unsupported_config_version",message:`Unsupported config version: ${n.version}. Only version ${Rc} is supported.`},T);let a=process.env[HD],r=n.server?.base_url,i=a||r;if(!i)U({code:"missing_base_url",message:`Missing server.base_url in config file. Set server.base_url in ${t} or set the ${HD} environment variable.`},T);let o=i.trim().replace(/\/+$/,"");if(!/^https?:\/\//i.test(o))o=`https://${o}`;let s=n.server?.api_key_env||Yae,c=process.env[s];if(!c){let A=Wd(o);if(A)c=A.api_key}if(!c)U({code:"missing_api_key",message:`Environment variable ${s} is not set. Run 'typescape auth login' or set the env var to your API key.`},Pt);return{baseUrl:o,apiKey:c,repoId:n.repo?.id,configPath:t}}function Wae(e){if(e===void 0)return null;try{let t=JSON.stringify(e);if(!t)return null;if(t.length<=400)return t;return`${t.slice(0,397)}...`}catch{return null}}function Xn(e){let t=e.baseUrl.replace(/\/$/,""),n="/v1";async function a(r,i,o={}){let s=`${t}/v1${i}`;if(o.query&&Object.keys(o.query).length>0){let g=new URLSearchParams(o.query);s+=`?${g.toString()}`}let c={Authorization:`Bearer ${e.apiKey}`,Accept:"application/json",...o.headers};if(o.body!==void 0)c["Content-Type"]="application/json";let A;try{A=await fetch(s,{method:r,headers:c,body:o.body!==void 0?JSON.stringify(o.body):void 0})}catch(g){let b=g instanceof Error?g.message:String(g);U({code:"network_error",message:`Network error: ${b}`},Pt)}let l,d=null;if((A.headers.get("Content-Type")||"").includes("application/json"))try{l=await A.json()}catch{l={}}else{try{d=(await A.text()).trim()||null}catch{d=null}l={}}let p=l?.request_id||A.headers.get("X-Request-Id")||"unknown";if(!A.ok){let g=l,b=g.error?.code||(d?"unexpected_response":"api_error"),y=g.error?.message||`API request failed with status ${A.status}`;if(!g.error?.message&&d){let D=d.length<=300?d:`${d.slice(0,297)}...`;y=`${y}: ${D}`}let w=[];if(g.error?.fix_hint)w.push(`fix_hint: ${g.error.fix_hint}`);let E=Wae(g.error?.details);if(E)w.push(`details: ${E}`);if(w.length>0)y=`${y} (${w.join("; ")})`;let C=kx(A.status);U({code:b,message:`${y} (request_id: ${p})`},C)}return{status:A.status,body:l,requestId:p}}return{async get(r,i){return a("GET",r,i)},async post(r,i){return a("POST",r,i)},async put(r,i){return a("PUT",r,i)},async patch(r,i){return a("PATCH",r,i)},async delete(r,i){return a("DELETE",r,i)},request:a}}var{spawn:Jae}=globalThis.Bun;import{existsSync as Zf,readFileSync as YD}from"fs";import{resolve as Yf,basename as Of}from"path";class Sn extends Error{code;constructor(e,t){super(t);this.code=e;this.name="ReviewersFromConfigError"}}function Vae(e){let t={file:"",reviewers:[],approvers:[],stdin:!1,format:"json"},n=0;while(n<e.length){let a=e[n];if(a==="--file")t.file=e[n+1]||"",n+=2;else if(a.startsWith("--file="))t.file=a.slice(7),n++;else if(a==="--repo")t.repo=e[n+1],n+=2;else if(a.startsWith("--repo="))t.repo=a.slice(7),n++;else if(a==="--sha")t.sha=e[n+1],n+=2;else if(a.startsWith("--sha="))t.sha=a.slice(6),n++;else if(a==="--title")t.title=e[n+1],n+=2;else if(a.startsWith("--title="))t.title=a.slice(8),n++;else if(a==="--reviewer")t.reviewers.push(e[n+1]||""),n+=2;else if(a.startsWith("--reviewer="))t.reviewers.push(a.slice(11)),n++;else if(a==="--reviewers"){let r=e[n+1]||"";t.reviewers.push(...Jd(r)),n+=2}else if(a.startsWith("--reviewers=")){let r=a.slice(12);t.reviewers.push(...Jd(r)),n++}else if(a==="--participants"){let r=e[n+1]||"";t.reviewers.push(...Jd(r)),n+=2}else if(a.startsWith("--participants=")){let r=a.slice(15);t.reviewers.push(...Jd(r)),n++}else if(a==="--approver")t.approvers.push(e[n+1]||""),n+=2;else if(a.startsWith("--approver="))t.approvers.push(a.slice(11)),n++;else if(a==="--reviewers-from")t.reviewersFrom=e[n+1],n+=2;else if(a.startsWith("--reviewers-from="))t.reviewersFrom=a.slice(17),n++;else if(a==="--idempotency-key")t.idempotencyKey=e[n+1],n+=2;else if(a.startsWith("--idempotency-key="))t.idempotencyKey=a.slice(18),n++;else if(a==="--content-body")t.contentBody=e[n+1]||"",n+=2;else if(a.startsWith("--content-body="))t.contentBody=a.slice(15),n++;else if(a==="--stdin")t.stdin=!0,n++;else if(a==="--supersedes-session"||a==="--supersedes")t.supersedesSessionId=e[n+1]||"",n+=2;else if(a.startsWith("--supersedes-session=")||a.startsWith("--supersedes="))t.supersedesSessionId=a.slice(a.indexOf("=")+1),n++;else if(a==="--identity-restriction")t.identityRestriction=e[n+1],n+=2;else if(a.startsWith("--identity-restriction="))t.identityRestriction=a.slice(23),n++;else if(a==="--allowed-email-domains"){let r=e[n+1]||"";t.allowedEmailDomains=r.split(",").map((i)=>i.trim()).filter((i)=>i.length>0),n+=2}else if(a.startsWith("--allowed-email-domains=")){let r=a.slice(24);t.allowedEmailDomains=r.split(",").map((i)=>i.trim()).filter((i)=>i.length>0),n++}else if(a==="--format")t.format=e[n+1]||"json",n+=2;else if(a.startsWith("--format="))t.format=a.slice(9),n++;else n++}return t}function Jd(e){return e.split(",").map((t)=>t.trim()).filter((t)=>t.length>0)}function TD(e){if(!Array.isArray(e))throw new Sn("reviewers_file_invalid","reviewers.yaml fields must be string arrays.");return e.map((n)=>{if(typeof n!=="string")throw new Sn("reviewers_file_invalid","reviewers.yaml fields must only contain email strings.");return n.trim()}).filter((n)=>n.length>0)}function OD(e){if(e===void 0)return{};if(!e||typeof e!=="object"||Array.isArray(e))throw new Sn("reviewers_file_invalid","reviewers.yaml role sections must be objects.");let t=e;for(let n of Object.keys(t))if(n!=="reviewers"&&n!=="approvers")throw new Sn("reviewers_file_invalid",`Unknown key in reviewers.yaml role section: ${n}`);return{reviewers:t.reviewers===void 0?void 0:TD(t.reviewers),approvers:t.approvers===void 0?void 0:TD(t.approvers)}}function Xae(e){let t;try{t=Ci(e)}catch(r){let i=r instanceof Error?r.message:String(r);throw new Sn("reviewers_file_parse_error",`Failed to parse reviewers file: ${i}`)}if(!t||typeof t!=="object"||Array.isArray(t))throw new Sn("reviewers_file_invalid","reviewers.yaml must be a YAML object.");let n=t;for(let r of Object.keys(n))if(r!=="default"&&r!=="overrides")throw new Sn("reviewers_file_invalid",`Unknown key in reviewers.yaml: ${r}`);let a={default:OD(n.default)};if(n.overrides!==void 0){if(!n.overrides||typeof n.overrides!=="object"||Array.isArray(n.overrides))throw new Sn("reviewers_file_invalid","reviewers.yaml overrides must be an object keyed by glob pattern.");let r=n.overrides,i={};for(let[o,s]of Object.entries(r))i[o]=OD(s);a.overrides=i}return a}function ere(e){return e==="."||e==="+"||e==="^"||e==="$"||e==="{"||e==="}"||e==="("||e===")"||e==="|"||e==="["||e==="]"||e==="\\"}function tre(e,t){let n="",a=0;while(a<t.length){let r=t[a];if(r==="*")if(t[a+1]==="*"){if(n+=".*",a+=2,t[a]==="/")a++}else n+="[^/]*",a++;else if(r==="?")n+="[^/]",a++;else if(ere(r))n+=`\\${r}`,a++;else n+=r,a++}return new RegExp(`^${n}$`).test(e)}function nre(e,t){if(e.length!==t.length)return t.length-e.length;return e.localeCompare(t)}function are(e,t){let n=e.default?.reviewers??[],a=e.default?.approvers??[],i=Object.keys(e.overrides??{}).filter((s)=>tre(t,s)).sort(nre)[0];if(!i)return{reviewers:[...n],approvers:[...a]};let o=e.overrides?.[i]??{};return{reviewers:o.reviewers===void 0?[...n]:[...o.reviewers],approvers:o.approvers===void 0?[...a]:[...o.approvers],matchedOverride:i}}function rre(e,t){let n=Yf(e);if(!Zf(n))throw new Sn("reviewers_file_not_found",`reviewers file not found: ${n}`);let a=YD(n,"utf-8"),r=Xae(a);return are(r,t)}async function ire(){try{let e=Jae({cmd:["git","rev-parse","HEAD"],stdout:"pipe",stderr:"pipe"}),t=await xr(e.stdout);if(await e.exited!==0)U({code:"git_resolve_failed",message:"Could not resolve HEAD. Use --sha to provide a commit SHA explicitly."},T);let a=t.trim();if(!/^[a-f0-9]{40}$/i.test(a))U({code:"git_resolve_failed",message:`Invalid SHA format: ${a}. Use --sha to provide a commit SHA explicitly.`},T);return a.toLowerCase()}catch(e){U({code:"git_resolve_failed",message:"Could not resolve HEAD. Use --sha to provide a commit SHA explicitly."},T)}}function KD(e){let t=[...e.reviewers],n=[...e.approvers];if(e.reviewersFrom){let r=rre(e.reviewersFrom,e.file);if(t.length===0)t=r.reviewers;if(n.length===0)n=r.approvers}let a=[];for(let r of t)if(r.trim())a.push({email:r.trim(),role:"reviewer",scopes:["read","comment"]});for(let r of n)if(r.trim())a.push({email:r.trim(),role:"approver",scopes:["read","comment","approve"]});return a}function ore(e,t){if(e.contentBody!==void 0||e.stdin)return"upload";if(e.repo||e.sha)return"git";if(t.repoId)return"git";if(e.file&&Zf(Yf(e.file)))return"upload";return"git"}var ZD=1048576;async function sre(e){if(e.contentBody!==void 0)return e.contentBody;if(e.stdin)return Zd();let t=Yf(e.file);if(!Zf(t))U({code:"file_not_found",message:`File not found: ${t}`},T);return YD(t,"utf-8")}function cre(e){let t=Of(e,".md"),a=Of(t,".markdown").replace(/[-_]/g," ");return a.charAt(0).toUpperCase()+a.slice(1)}async function WD(e,t,n){let a=Vae(e);if(!a.file&&a.contentBody===void 0&&!a.stdin)U({code:"missing_required_flag",message:"Missing required flag: --file, --content-body, or --stdin"},T);if(a.identityRestriction&&!["open","participants_only","domain"].includes(a.identityRestriction))U({code:"invalid_identity_restriction",message:`Invalid --identity-restriction value: ${a.identityRestriction}. Must be one of: open, participants_only, domain.`},T);if(a.identityRestriction==="domain"&&(!a.allowedEmailDomains||a.allowedEmailDomains.length===0))U({code:"missing_allowed_domains",message:'--allowed-email-domains is required when --identity-restriction is "domain".'},T);if(ore(a,t)==="upload")return lre(a,n);return Are(a,t,n)}async function Are(e,t,n){if(!e.file)U({code:"missing_required_flag",message:"Missing required flag: --file"},T);let a=e.repo;if(!a||a===".")a=t.repoId;if(!a)U({code:"repo_id_missing",message:"Could not determine repo_id. Set repo.id in .typescape/config.yaml or use --repo."},T);let r=e.sha;if(!r)r=await ire();else{if(!/^[a-f0-9]{40}$/i.test(r))U({code:"invalid_sha_format",message:`Invalid SHA format: ${r}. Must be a 40-character hex string.`},T);r=r.toLowerCase()}let i=[];try{i=KD(e)}catch(A){if(A instanceof Sn)U({code:A.code,message:A.message},T);throw A}if(i.length>0&&!e.title)U({code:"missing_title",message:"The --title flag is required when participants are specified. Provide a human-readable title for the review session."},T);if(i.length===0&&e.reviewersFrom)console.error(`Warning: no participants resolved from --reviewers-from (${e.reviewersFrom}) for file ${e.file}; proceeding with no explicit participants.`);let o={repo_id:a,git_sha:r,file_path:e.file};if(e.title)o.title=e.title;if(o.participants=i,e.idempotencyKey)o.idempotency_key=e.idempotencyKey;if(e.supersedesSessionId)o.supersedes_session_id=e.supersedesSessionId;if(e.identityRestriction)o.identity_restriction=e.identityRestriction;if(e.allowedEmailDomains&&e.allowedEmailDomains.length>0)o.allowed_email_domains=e.allowedEmailDomains;let s={};if(e.idempotencyKey)s["Idempotency-Key"]=e.idempotencyKey;let c=await n.post("/sessions",{body:o,headers:s});JD(c.body,e,i),process.exit(K)}async function lre(e,t){let n=await sre(e);if(!n||n.length===0)U({code:"empty_content",message:"Content body is empty. Provide non-empty Markdown content."},T);let a=new TextEncoder().encode(n).length;if(a>ZD)U({code:"content_too_large",message:`Content is ${a} bytes, exceeding the 1 MB limit (${ZD} bytes).`},T);let r=e.file;if(r&&!e.contentBody&&!e.stdin)r=Of(r);if(!r)r="document.md";let i=e.title||cre(r),o=[];try{o=KD(e)}catch(l){if(l instanceof Sn)U({code:l.code,message:l.message},T);throw l}let s={content_body:n,file_path:r,title:i};if(o.length>0)s.participants=o;if(e.idempotencyKey)s.idempotency_key=e.idempotencyKey;if(e.supersedesSessionId)s.supersedes_session_id=e.supersedesSessionId;if(e.identityRestriction)s.identity_restriction=e.identityRestriction;if(e.allowedEmailDomains&&e.allowedEmailDomains.length>0)s.allowed_email_domains=e.allowedEmailDomains;let c={};if(e.idempotencyKey)c["Idempotency-Key"]=e.idempotencyKey;let A=await t.post("/sessions",{body:s,headers:c});JD(A.body,e,o),process.exit(K)}function JD(e,t,n){if(t.format==="json")$t({...e,resolved_participants:n},"json");else{let a=e.session?.id||"unknown",r=e.invitations?.[0]?.review_url||"";if(console.log(`Session created: ${a}`),r)console.log(`Review URL: ${r}`)}}import{writeFileSync as dre}from"fs";function ure(e){let t={session:"",schema:"v1",format:"json"},n=0;while(n<e.length){let a=e[n];if(a==="--session")t.session=e[n+1]||"",n+=2;else if(a.startsWith("--session="))t.session=a.slice(10),n++;else if(a==="--out")t.out=e[n+1],n+=2;else if(a.startsWith("--out="))t.out=a.slice(6),n++;else if(a==="--schema")t.schema=e[n+1]||"v1",n+=2;else if(a.startsWith("--schema="))t.schema=a.slice(9),n++;else if(a==="--view")t.view=e[n+1]||"",n+=2;else if(a.startsWith("--view="))t.view=a.slice(7),n++;else if(a==="--format")t.format=e[n+1]||"json",n+=2;else if(a.startsWith("--format="))t.format=a.slice(9),n++;else n++}return t}async function VD(e,t,n){let a=ure(e);if(!a.session)U({code:"missing_required_flag",message:"Missing required flag: --session"},T);if(a.schema!=="v1")U({code:"unsupported_schema_version",message:`Unsupported schema version: ${a.schema}. Only v1 is supported.`},T);let r={schema:a.schema};if(a.view)r.view=a.view;let i=await n.get(`/sessions/${encodeURIComponent(a.session)}/export`,{query:r}),o=JSON.stringify(i.body,null,2);if(a.out)dre(a.out,o,"utf-8"),console.error(`Export written to ${a.out}`);else if(a.format==="json")console.log(o);else{let s=i.body.session,c=i.body.threads?.length??0,A=i.body.approvals?.length??0;console.log(`Session ID: ${s?.id??"unknown"}`),console.log(`File Path: ${s?.file_path??"unknown"}`),console.log(`Source Type: ${s?.source_type??"unknown"}`),console.log(`Git SHA: ${s?.git_sha??"N/A"}`),console.log(`Schema Version: ${i.body.schema_version}`),console.log(`Threads: ${c}`),console.log(`Approvals: ${A}`),console.log(`Request ID: ${i.body.request_id}`)}process.exit(K)}function pre(e){let t={session:"",simulate:!1,format:"text"},n=0;while(n<e.length){let a=e[n];if(a==="--session")t.session=e[n+1]||"",n+=2;else if(a.startsWith("--session="))t.session=a.slice(10),n++;else if(a==="--wait"){let r=parseInt(e[n+1]||"",10);if(Number.isNaN(r)||r<0)U({code:"invalid_wait_value",message:`Invalid --wait value: ${e[n+1]}. Must be a non-negative integer (seconds).`},T);t.wait=r,n+=2}else if(a.startsWith("--wait=")){let r=a.slice(7),i=parseInt(r,10);if(Number.isNaN(i)||i<0)U({code:"invalid_wait_value",message:`Invalid --wait value: ${r}. Must be a non-negative integer (seconds).`},T);t.wait=i,n++}else if(a==="--simulate")t.simulate=!0,n++;else if(a==="--format")t.format=e[n+1]||"text",n+=2;else if(a.startsWith("--format="))t.format=a.slice(9),n++;else n++}return t}function mre(e){let t=[];if(e.details)for(let[n,a]of Object.entries(e.details))t.push(`${n}=${a}`);if(e.thread_ids&&e.thread_ids.length>0)t.push(`threads=[${e.thread_ids.join(",")}]`);if(e.approval_ids&&e.approval_ids.length>0)t.push(`approval_ids=[${e.approval_ids.join(",")}]`);return t.join(" ")}async function XD(e,t,n){let a=pre(e);if(!a.session)U({code:"missing_required_flag",message:"Missing required flag: --session"},T);let r={};if(a.simulate)r.simulate="true";if(a.wait!==void 0)r.wait=String(a.wait);let i=await n.get(`/sessions/${encodeURIComponent(a.session)}/status`,{query:r}),{verdict:o,reasons:s}=i.body;if(a.format==="json")console.log(JSON.stringify(i.body,null,2));else if(console.log(`Session: ${a.session}`),console.log(`Verdict: ${o}`),s.length>0){console.log("Reasons:");for(let c of s){let A=mre(c);console.log(` ${c.code}${A?" "+A:""}`)}}if(o==="pass")process.exit(K);else process.exit(ba)}import{existsSync as gre,readFileSync as bre}from"fs";import{resolve as fre,basename as hre}from"path";function yre(e){let t={session:"",newSha:"",stdin:!1,reviewers:[],approvers:[],format:"text"},n=0;while(n<e.length){let a=e[n];if(a==="--session")t.session=e[n+1]||"",n+=2;else if(a.startsWith("--session="))t.session=a.slice(10),n++;else if(a==="--new-sha")t.newSha=e[n+1]||"",n+=2;else if(a.startsWith("--new-sha="))t.newSha=a.slice(10),n++;else if(a==="--title")t.title=e[n+1],n+=2;else if(a.startsWith("--title="))t.title=a.slice(8),n++;else if(a==="--reviewer")t.reviewers.push(e[n+1]||""),n+=2;else if(a.startsWith("--reviewer="))t.reviewers.push(a.slice(11)),n++;else if(a==="--reviewers"){let r=e[n+1]||"";t.reviewers.push(...r.split(",").map((i)=>i.trim()).filter((i)=>i.length>0)),n+=2}else if(a.startsWith("--reviewers=")){let r=a.slice(12);t.reviewers.push(...r.split(",").map((i)=>i.trim()).filter((i)=>i.length>0)),n++}else if(a==="--file")t.file=e[n+1]||"",n+=2;else if(a.startsWith("--file="))t.file=a.slice(7),n++;else if(a==="--stdin")t.stdin=!0,n++;else if(a==="--approver")t.approvers.push(e[n+1]||""),n+=2;else if(a.startsWith("--approver="))t.approvers.push(a.slice(11)),n++;else if(a==="--format")t.format=e[n+1]||"text",n+=2;else if(a.startsWith("--format="))t.format=a.slice(9),n++;else if(a?.startsWith("--"))if(console.error(`Warning: unknown flag '${a}' ignored`),n+1<e.length&&!e[n+1]?.startsWith("--"))n+=2;else n++;else n++}return t}var e1=1048576;function t1(e){let t=[];for(let n of e.reviewers)if(n.trim())t.push({email:n.trim(),role:"reviewer",roles:["reviewer"]});for(let n of e.approvers)if(n.trim())t.push({email:n.trim(),role:"approver",roles:["approver"]});return t}function n1(e,t,n){if(n==="json")console.log(JSON.stringify(e,null,2));else{let{session:a,carry_forward:r,invitations:i}=e;console.log(`New session: ${a.id}`),console.log(`Supersedes: ${t}`);let o=r?.carried_count??0,s=r?.orphaned_count??0;if(console.log(`Carry-forward: ${o} threads carried, ${s} orphaned`),i&&i.length>0){console.log(`Invitations: ${i.length} reviewer(s)`);for(let c of i)console.log(` ${c.email} \u2192 ${c.review_url}`)}}}async function a1(e,t,n){let a=yre(e);if(!a.session){U({code:"missing_required_flag",message:"Missing required flag: --session"},T);return}let r=!!a.newSha,i=!!a.file,o=a.stdin,s=i||o;if(r&&s){U({code:"conflicting_flags",message:"--new-sha and --file/--stdin are mutually exclusive. Use --new-sha for git sessions or --file/--stdin for upload sessions."},T);return}if(i&&o){U({code:"conflicting_flags",message:"--file and --stdin are mutually exclusive."},T);return}if(!r&&!s){U({code:"missing_required_flag",message:"One of --new-sha, --file, or --stdin is required to specify the updated content."},T);return}if(s)await kre(a,n);else await wre(a,n)}async function wre(e,t){if(!/^[a-f0-9]{40}$/i.test(e.newSha)){U({code:"invalid_sha_format",message:`Invalid SHA format: ${e.newSha}. Must be a 40-character hex string.`},T);return}let n={git_sha:e.newSha.toLowerCase()};if(e.title)n.title=e.title;let a=t1(e);if(a.length>0)n.participants=a;let r=await t.post(`/sessions/${encodeURIComponent(e.session)}/supersede`,{body:n});n1(r.body,e.session,e.format),process.exit(K)}async function kre(e,t){let n,a;if(e.stdin)n=await Zd(),a="document.md";else{let c=fre(e.file);if(!gre(c)){U({code:"file_not_found",message:`File not found: ${c}`},T);return}n=bre(c,"utf-8"),a=hre(e.file)}if(!n||n.length===0){U({code:"empty_content",message:"Content body is empty. Provide non-empty Markdown content."},T);return}let r=new TextEncoder().encode(n).length;if(r>e1){U({code:"content_too_large",message:`Content is ${r} bytes, exceeding the 1 MB limit (${e1} bytes).`},T);return}let i={content_body:n,file_path:a,supersedes_session_id:e.session};if(e.title)i.title=e.title;let o=t1(e);if(o.length>0)i.participants=o;let s=await t.post("/sessions",{body:i});n1(s.body,e.session,e.format),process.exit(K)}function Bre(e){let t={session:"",format:"text"},n=0;while(n<e.length){let a=e[n];if(a==="--session")t.session=e[n+1]||"",n+=2;else if(a.startsWith("--session="))t.session=a.slice(10),n++;else if(a==="--reason")t.reason=e[n+1]||"",n+=2;else if(a.startsWith("--reason="))t.reason=a.slice(9),n++;else if(a==="--format")t.format=e[n+1]||"text",n+=2;else if(a.startsWith("--format="))t.format=a.slice(9),n++;else n++}return t}async function r1(e,t,n){let a=Bre(e);if(!a.session)U({code:"missing_required_flag",message:"Missing required flag: --session"},T);let r={};if(a.reason)r.reason=a.reason;let i=await n.post(`/sessions/${encodeURIComponent(a.session)}/close`,{body:r});if(a.format==="json")console.log(JSON.stringify(i.body,null,2));else{let o=i.body;if(o.transitioned)console.log(`Session closed: ${o.session_id}`),console.log(`State: ${o.state}`);else console.log(`Session already closed: ${o.session_id}`),console.log(`State: ${o.state}`)}process.exit(K)}function Cre(e){if(!e||typeof e!=="object")return!1;return e.features?.checks===!0}async function _re(e){let n=`${e.baseUrl.replace(/\/$/,"")}/v1/me/capabilities`,a;try{a=await fetch(n,{method:"GET",headers:{Authorization:`Bearer ${e.apiKey}`,Accept:"application/json"}})}catch(o){let s=o instanceof Error?o.message:String(o);U({code:"capabilities_fetch_failed",message:`Failed to load capabilities: ${s}`},Pt)}let r={};if((a.headers.get("Content-Type")||"").includes("application/json"))try{r=await a.json()}catch{r={}}if(!a.ok){let o={};if(r&&typeof r==="object")o=r;let s=o.error?.code||"capabilities_fetch_failed",c=o.error?.message||`Failed to load capabilities (status ${a.status})`,A=o.request_id?` (request_id: ${o.request_id})`:"";U({code:s,message:`${c}${A}`},Pt)}if(Cre(r))return;U({code:"feature_disabled",message:"Feature checks is not enabled for this deployment"},T)}function Ere(e){let t={session:"",wait:!0,timeout:300,format:"text"},n=0;while(n<e.length){let a=e[n];if(a==="--session")t.session=e[n+1]||"",n+=2;else if(a.startsWith("--session="))t.session=a.slice(10),n++;else if(a==="--wait")t.wait=!0,n++;else if(a==="--no-wait")t.wait=!1,n++;else if(a==="--timeout"){let r=parseInt(e[n+1]||"",10);if(Number.isNaN(r)||r<=0)U({code:"invalid_timeout_value",message:`Invalid --timeout value: ${e[n+1]}. Must be a positive integer (seconds).`},T);t.timeout=r,n+=2}else if(a.startsWith("--timeout=")){let r=a.slice(10),i=parseInt(r,10);if(Number.isNaN(i)||i<=0)U({code:"invalid_timeout_value",message:`Invalid --timeout value: ${r}. Must be a positive integer (seconds).`},T);t.timeout=i,n++}else if(a==="--format")t.format=e[n+1]||"text",n+=2;else if(a.startsWith("--format="))t.format=a.slice(9),n++;else n++}return t}function vre(e){return new Promise((t)=>setTimeout(t,e))}async function Qre(e,t,n,a){let r=Date.now()+a*1000,i=2000;while(Date.now()<r){let o=await e.get(`/sessions/${encodeURIComponent(t)}/checks/${encodeURIComponent(n)}`);if(o.body.status==="completed"||o.body.status==="failed")return o.body;await vre(2000)}U({code:"check_run_timeout",message:`Check run did not complete within ${a}s. Run ID: ${n}`},za)}async function i1(e,t,n){let a=Ere(e);if(!a.session)U({code:"missing_required_flag",message:"Missing required flag: --session"},T);await _re(t);let r=await n.post(`/sessions/${encodeURIComponent(a.session)}/run-checks`),{check_run_id:i}=r.body;if(!a.wait){if(a.format==="json")console.log(JSON.stringify(r.body,null,2));else console.log(`Check run enqueued: ${i}`);process.exit(K)}if(a.format==="text")console.log(`Check run: ${i} (running)`);let o=Date.now(),s=await Qre(n,a.session,i,a.timeout);if(s.status==="failed"){if(a.format==="json")console.log(JSON.stringify(s,null,2));else if(console.log(`
|
|
324
|
+
You can now use Typescape CLI commands without setting TYPESCAPE_API_KEY.`);process.exit(K)}function Tae(e){return GD(e)}async function PD(e){let t=Tae(e),n=t.baseUrl.replace(/\/$/,""),a=Wd(n);if(!a){if(t.format==="json")$t({authenticated:!1,base_url:n,credentials_path:Jn()},t.format);else console.log(`Not authenticated for ${n}`),console.log("Run 'typescape auth login' to authenticate.");process.exit(K)}if(t.format==="json")$t({authenticated:!0,email:a.email,base_url:n,key_prefix:a.api_key.slice(0,8)+"...",created_at:a.created_at,credentials_path:Jn()},t.format);else console.log(`Authenticated as ${a.email}`),console.log(`Server: ${n}`),console.log(`Key: ${a.api_key.slice(0,8)}...`),console.log(`Created: ${a.created_at}`),console.log(`Stored at: ${Jn()}`);process.exit(K)}async function zD(e){let t=GD(e),n=t.baseUrl.replace(/\/$/,""),a=zae(n);if(t.format==="json")$t({status:a?"logged_out":"not_logged_in",base_url:n},t.format);else if(a)console.log(`Logged out from ${n}`),console.log(`Credentials removed from ${Jn()}`);else console.log(`No stored credentials for ${n}`);process.exit(K)}var Tf=".typescape/config.yaml",Yae="TYPESCAPE_API_KEY",HD="TYPESCAPE_BASE_URL",Rc=1;function Kae(e){if(e)return UD(e);return UD(Tf)}function Vn(e){let t=Kae(e);if(!Oae(t))U({code:"config_not_found",message:`Configuration file not found: ${t}. Create a .typescape/config.yaml file or use --config to specify a path.`},T);let n;try{let A=Zae(t,"utf-8");n=Ci(A)}catch(A){let l=A instanceof Error?A.message:String(A);U({code:"config_parse_error",message:`Failed to parse config file: ${l}`},T)}if(n.version!==void 0&&n.version!==Rc)U({code:"unsupported_config_version",message:`Unsupported config version: ${n.version}. Only version ${Rc} is supported.`},T);let a=process.env[HD],r=n.server?.base_url,i=a||r;if(!i)U({code:"missing_base_url",message:`Missing server.base_url in config file. Set server.base_url in ${t} or set the ${HD} environment variable.`},T);let o=i.trim().replace(/\/+$/,"");if(!/^https?:\/\//i.test(o))o=`https://${o}`;let s=n.server?.api_key_env||Yae,c=process.env[s];if(!c){let A=Wd(o);if(A)c=A.api_key}if(!c)U({code:"missing_api_key",message:`Environment variable ${s} is not set. Run 'typescape auth login' or set the env var to your API key.`},Pt);return{baseUrl:o,apiKey:c,repoId:n.repo?.id,configPath:t}}function Wae(e){if(e===void 0)return null;try{let t=JSON.stringify(e);if(!t)return null;if(t.length<=400)return t;return`${t.slice(0,397)}...`}catch{return null}}function Xn(e){let t=e.baseUrl.replace(/\/$/,""),n="/v1";async function a(r,i,o={}){let s=`${t}/v1${i}`;if(o.query&&Object.keys(o.query).length>0){let g=new URLSearchParams(o.query);s+=`?${g.toString()}`}let c={Authorization:`Bearer ${e.apiKey}`,Accept:"application/json",...o.headers};if(o.body!==void 0)c["Content-Type"]="application/json";let A;try{A=await fetch(s,{method:r,headers:c,body:o.body!==void 0?JSON.stringify(o.body):void 0})}catch(g){let b=g instanceof Error?g.message:String(g);U({code:"network_error",message:`Network error: ${b}`},Pt)}let l,d=null;if((A.headers.get("Content-Type")||"").includes("application/json"))try{l=await A.json()}catch{l={}}else{try{d=(await A.text()).trim()||null}catch{d=null}l={}}let p=l?.request_id||A.headers.get("X-Request-Id")||"unknown";if(!A.ok){let g=l,b=g.error?.code||(d?"unexpected_response":"api_error"),y=g.error?.message||`API request failed with status ${A.status}`;if(!g.error?.message&&d){let D=d.length<=300?d:`${d.slice(0,297)}...`;y=`${y}: ${D}`}let w=[];if(g.error?.fix_hint)w.push(`fix_hint: ${g.error.fix_hint}`);let E=Wae(g.error?.details);if(E)w.push(`details: ${E}`);if(w.length>0)y=`${y} (${w.join("; ")})`;let C=kx(A.status);U({code:b,message:`${y} (request_id: ${p})`},C)}return{status:A.status,body:l,requestId:p}}return{async get(r,i){return a("GET",r,i)},async post(r,i){return a("POST",r,i)},async put(r,i){return a("PUT",r,i)},async patch(r,i){return a("PATCH",r,i)},async delete(r,i){return a("DELETE",r,i)},request:a}}var{spawn:Jae}=globalThis.Bun;import{existsSync as Zf,readFileSync as YD}from"fs";import{resolve as Yf,basename as Of}from"path";class Sn extends Error{code;constructor(e,t){super(t);this.code=e;this.name="ReviewersFromConfigError"}}function Vae(e){let t={file:"",reviewers:[],approvers:[],stdin:!1,format:"json"},n=0;while(n<e.length){let a=e[n];if(a==="--file")t.file=e[n+1]||"",n+=2;else if(a.startsWith("--file="))t.file=a.slice(7),n++;else if(a==="--repo")t.repo=e[n+1],n+=2;else if(a.startsWith("--repo="))t.repo=a.slice(7),n++;else if(a==="--sha")t.sha=e[n+1],n+=2;else if(a.startsWith("--sha="))t.sha=a.slice(6),n++;else if(a==="--title")t.title=e[n+1],n+=2;else if(a.startsWith("--title="))t.title=a.slice(8),n++;else if(a==="--reviewer")t.reviewers.push(e[n+1]||""),n+=2;else if(a.startsWith("--reviewer="))t.reviewers.push(a.slice(11)),n++;else if(a==="--reviewers"){let r=e[n+1]||"";t.reviewers.push(...Jd(r)),n+=2}else if(a.startsWith("--reviewers=")){let r=a.slice(12);t.reviewers.push(...Jd(r)),n++}else if(a==="--participants"){let r=e[n+1]||"";t.reviewers.push(...Jd(r)),n+=2}else if(a.startsWith("--participants=")){let r=a.slice(15);t.reviewers.push(...Jd(r)),n++}else if(a==="--approver")t.approvers.push(e[n+1]||""),n+=2;else if(a.startsWith("--approver="))t.approvers.push(a.slice(11)),n++;else if(a==="--reviewers-from")t.reviewersFrom=e[n+1],n+=2;else if(a.startsWith("--reviewers-from="))t.reviewersFrom=a.slice(17),n++;else if(a==="--idempotency-key")t.idempotencyKey=e[n+1],n+=2;else if(a.startsWith("--idempotency-key="))t.idempotencyKey=a.slice(18),n++;else if(a==="--content-body")t.contentBody=e[n+1]||"",n+=2;else if(a.startsWith("--content-body="))t.contentBody=a.slice(15),n++;else if(a==="--stdin")t.stdin=!0,n++;else if(a==="--supersedes-session"||a==="--supersedes")t.supersedesSessionId=e[n+1]||"",n+=2;else if(a.startsWith("--supersedes-session=")||a.startsWith("--supersedes="))t.supersedesSessionId=a.slice(a.indexOf("=")+1),n++;else if(a==="--identity-restriction")t.identityRestriction=e[n+1],n+=2;else if(a.startsWith("--identity-restriction="))t.identityRestriction=a.slice(23),n++;else if(a==="--allowed-email-domains"){let r=e[n+1]||"";t.allowedEmailDomains=r.split(",").map((i)=>i.trim()).filter((i)=>i.length>0),n+=2}else if(a.startsWith("--allowed-email-domains=")){let r=a.slice(24);t.allowedEmailDomains=r.split(",").map((i)=>i.trim()).filter((i)=>i.length>0),n++}else if(a==="--format")t.format=e[n+1]||"json",n+=2;else if(a.startsWith("--format="))t.format=a.slice(9),n++;else n++}return t}function Jd(e){return e.split(",").map((t)=>t.trim()).filter((t)=>t.length>0)}function TD(e){if(!Array.isArray(e))throw new Sn("reviewers_file_invalid","reviewers.yaml fields must be string arrays.");return e.map((n)=>{if(typeof n!=="string")throw new Sn("reviewers_file_invalid","reviewers.yaml fields must only contain email strings.");return n.trim()}).filter((n)=>n.length>0)}function OD(e){if(e===void 0)return{};if(!e||typeof e!=="object"||Array.isArray(e))throw new Sn("reviewers_file_invalid","reviewers.yaml role sections must be objects.");let t=e;for(let n of Object.keys(t))if(n!=="reviewers"&&n!=="approvers")throw new Sn("reviewers_file_invalid",`Unknown key in reviewers.yaml role section: ${n}`);return{reviewers:t.reviewers===void 0?void 0:TD(t.reviewers),approvers:t.approvers===void 0?void 0:TD(t.approvers)}}function Xae(e){let t;try{t=Ci(e)}catch(r){let i=r instanceof Error?r.message:String(r);throw new Sn("reviewers_file_parse_error",`Failed to parse reviewers file: ${i}`)}if(!t||typeof t!=="object"||Array.isArray(t))throw new Sn("reviewers_file_invalid","reviewers.yaml must be a YAML object.");let n=t;for(let r of Object.keys(n))if(r!=="default"&&r!=="overrides")throw new Sn("reviewers_file_invalid",`Unknown key in reviewers.yaml: ${r}`);let a={default:OD(n.default)};if(n.overrides!==void 0){if(!n.overrides||typeof n.overrides!=="object"||Array.isArray(n.overrides))throw new Sn("reviewers_file_invalid","reviewers.yaml overrides must be an object keyed by glob pattern.");let r=n.overrides,i={};for(let[o,s]of Object.entries(r))i[o]=OD(s);a.overrides=i}return a}function ere(e){return e==="."||e==="+"||e==="^"||e==="$"||e==="{"||e==="}"||e==="("||e===")"||e==="|"||e==="["||e==="]"||e==="\\"}function tre(e,t){let n="",a=0;while(a<t.length){let r=t[a];if(r==="*")if(t[a+1]==="*"){if(n+=".*",a+=2,t[a]==="/")a++}else n+="[^/]*",a++;else if(r==="?")n+="[^/]",a++;else if(ere(r))n+=`\\${r}`,a++;else n+=r,a++}return new RegExp(`^${n}$`).test(e)}function nre(e,t){if(e.length!==t.length)return t.length-e.length;return e.localeCompare(t)}function are(e,t){let n=e.default?.reviewers??[],a=e.default?.approvers??[],i=Object.keys(e.overrides??{}).filter((s)=>tre(t,s)).sort(nre)[0];if(!i)return{reviewers:[...n],approvers:[...a]};let o=e.overrides?.[i]??{};return{reviewers:o.reviewers===void 0?[...n]:[...o.reviewers],approvers:o.approvers===void 0?[...a]:[...o.approvers],matchedOverride:i}}function rre(e,t){let n=Yf(e);if(!Zf(n))throw new Sn("reviewers_file_not_found",`reviewers file not found: ${n}`);let a=YD(n,"utf-8"),r=Xae(a);return are(r,t)}async function ire(){try{let e=Jae({cmd:["git","rev-parse","HEAD"],stdout:"pipe",stderr:"pipe"}),t=await xr(e.stdout);if(await e.exited!==0)U({code:"git_resolve_failed",message:"Could not resolve HEAD. Use --sha to provide a commit SHA explicitly."},T);let a=t.trim();if(!/^[a-f0-9]{40}$/i.test(a))U({code:"git_resolve_failed",message:`Invalid SHA format: ${a}. Use --sha to provide a commit SHA explicitly.`},T);return a.toLowerCase()}catch(e){U({code:"git_resolve_failed",message:"Could not resolve HEAD. Use --sha to provide a commit SHA explicitly."},T)}}function KD(e){let t=[...e.reviewers],n=[...e.approvers];if(e.reviewersFrom){let r=rre(e.reviewersFrom,e.file);if(t.length===0)t=r.reviewers;if(n.length===0)n=r.approvers}let a=[];for(let r of t)if(r.trim())a.push({email:r.trim(),role:"reviewer",scopes:["read","comment"]});for(let r of n)if(r.trim())a.push({email:r.trim(),role:"approver",scopes:["read","comment","approve"]});return a}function ore(e,t){if(e.contentBody!==void 0||e.stdin)return"upload";if(e.repo||e.sha)return"git";if(t.repoId)return"git";if(e.file&&Zf(Yf(e.file)))return"upload";return"git"}var ZD=1048576;async function sre(e){if(e.contentBody!==void 0)return e.contentBody;if(e.stdin)return Zd();let t=Yf(e.file);if(!Zf(t))U({code:"file_not_found",message:`File not found: ${t}`},T);return YD(t,"utf-8")}function cre(e){let t=Of(e,".md"),a=Of(t,".markdown").replace(/[-_]/g," ");return a.charAt(0).toUpperCase()+a.slice(1)}async function WD(e,t,n){let a=Vae(e);if(!a.file&&a.contentBody===void 0&&!a.stdin)U({code:"missing_required_flag",message:"Missing required flag: --file, --content-body, or --stdin"},T);if(a.identityRestriction&&!["open","participants_only","domain"].includes(a.identityRestriction))U({code:"invalid_identity_restriction",message:`Invalid --identity-restriction value: ${a.identityRestriction}. Must be one of: open, participants_only, domain.`},T);if(a.identityRestriction==="domain"&&(!a.allowedEmailDomains||a.allowedEmailDomains.length===0))U({code:"missing_allowed_domains",message:'--allowed-email-domains is required when --identity-restriction is "domain".'},T);if(ore(a,t)==="upload")return lre(a,n,t.baseUrl);return Are(a,t,n)}async function Are(e,t,n){if(!e.file)U({code:"missing_required_flag",message:"Missing required flag: --file"},T);let a=e.repo;if(!a||a===".")a=t.repoId;if(!a)U({code:"repo_id_missing",message:"Could not determine repo_id. Set repo.id in .typescape/config.yaml or use --repo."},T);let r=e.sha;if(!r)r=await ire();else{if(!/^[a-f0-9]{40}$/i.test(r))U({code:"invalid_sha_format",message:`Invalid SHA format: ${r}. Must be a 40-character hex string.`},T);r=r.toLowerCase()}let i=[];try{i=KD(e)}catch(A){if(A instanceof Sn)U({code:A.code,message:A.message},T);throw A}if(i.length>0&&!e.title)U({code:"missing_title",message:"The --title flag is required when participants are specified. Provide a human-readable title for the review session."},T);if(i.length===0&&e.reviewersFrom)console.error(`Warning: no participants resolved from --reviewers-from (${e.reviewersFrom}) for file ${e.file}; proceeding with no explicit participants.`);let o={repo_id:a,git_sha:r,file_path:e.file};if(e.title)o.title=e.title;if(o.participants=i,e.idempotencyKey)o.idempotency_key=e.idempotencyKey;if(e.supersedesSessionId)o.supersedes_session_id=e.supersedesSessionId;if(e.identityRestriction)o.identity_restriction=e.identityRestriction;if(e.allowedEmailDomains&&e.allowedEmailDomains.length>0)o.allowed_email_domains=e.allowedEmailDomains;let s={};if(e.idempotencyKey)s["Idempotency-Key"]=e.idempotencyKey;let c=await n.post("/sessions",{body:o,headers:s});JD(c.body,e,i,t.baseUrl),process.exit(K)}async function lre(e,t,n){let a=await sre(e);if(!a||a.length===0)U({code:"empty_content",message:"Content body is empty. Provide non-empty Markdown content."},T);let r=new TextEncoder().encode(a).length;if(r>ZD)U({code:"content_too_large",message:`Content is ${r} bytes, exceeding the 1 MB limit (${ZD} bytes).`},T);let i=e.file;if(i&&!e.contentBody&&!e.stdin)i=Of(i);if(!i)i="document.md";let o=e.title||cre(i),s=[];try{s=KD(e)}catch(d){if(d instanceof Sn)U({code:d.code,message:d.message},T);throw d}let c={content_body:a,file_path:i,title:o};if(s.length>0)c.participants=s;if(e.idempotencyKey)c.idempotency_key=e.idempotencyKey;if(e.supersedesSessionId)c.supersedes_session_id=e.supersedesSessionId;if(e.identityRestriction)c.identity_restriction=e.identityRestriction;if(e.allowedEmailDomains&&e.allowedEmailDomains.length>0)c.allowed_email_domains=e.allowedEmailDomains;let A={};if(e.idempotencyKey)A["Idempotency-Key"]=e.idempotencyKey;let l=await t.post("/sessions",{body:c,headers:A});JD(l.body,e,s,n),process.exit(K)}function JD(e,t,n,a){let r=e.session?.id||"unknown",i=a?`${a.replace(/\/+$/,"")}/sessions/${r}`:null;if(t.format==="json")$t({...e,...i?{session_url:i}:{},resolved_participants:n},"json");else{if(console.log(`Session created: ${r}`),i)console.log(`Session URL: ${i}`);for(let o of e.invitations??[])console.log(` Invited ${o.email}: ${o.review_url}`);if((!e.invitations||e.invitations.length===0)&&n.length===0)console.log(" No participants added. Share the session URL or use --reviewer to invite reviewers.")}}import{writeFileSync as dre}from"fs";function ure(e){let t={session:"",schema:"v1",format:"json"},n=0;while(n<e.length){let a=e[n];if(a==="--session")t.session=e[n+1]||"",n+=2;else if(a.startsWith("--session="))t.session=a.slice(10),n++;else if(a==="--out")t.out=e[n+1],n+=2;else if(a.startsWith("--out="))t.out=a.slice(6),n++;else if(a==="--schema")t.schema=e[n+1]||"v1",n+=2;else if(a.startsWith("--schema="))t.schema=a.slice(9),n++;else if(a==="--view")t.view=e[n+1]||"",n+=2;else if(a.startsWith("--view="))t.view=a.slice(7),n++;else if(a==="--format")t.format=e[n+1]||"json",n+=2;else if(a.startsWith("--format="))t.format=a.slice(9),n++;else n++}return t}async function VD(e,t,n){let a=ure(e);if(!a.session)U({code:"missing_required_flag",message:"Missing required flag: --session"},T);if(a.schema!=="v1")U({code:"unsupported_schema_version",message:`Unsupported schema version: ${a.schema}. Only v1 is supported.`},T);let r={schema:a.schema};if(a.view)r.view=a.view;let i=await n.get(`/sessions/${encodeURIComponent(a.session)}/export`,{query:r}),o=JSON.stringify(i.body,null,2);if(a.out)dre(a.out,o,"utf-8"),console.error(`Export written to ${a.out}`);else if(a.format==="json")console.log(o);else{let s=i.body.session,c=i.body.threads?.length??0,A=i.body.approvals?.length??0;console.log(`Session ID: ${s?.id??"unknown"}`),console.log(`File Path: ${s?.file_path??"unknown"}`),console.log(`Source Type: ${s?.source_type??"unknown"}`),console.log(`Git SHA: ${s?.git_sha??"N/A"}`),console.log(`Schema Version: ${i.body.schema_version}`),console.log(`Threads: ${c}`),console.log(`Approvals: ${A}`),console.log(`Request ID: ${i.body.request_id}`)}process.exit(K)}function pre(e){let t={session:"",simulate:!1,format:"text"},n=0;while(n<e.length){let a=e[n];if(a==="--session")t.session=e[n+1]||"",n+=2;else if(a.startsWith("--session="))t.session=a.slice(10),n++;else if(a==="--wait"){let r=parseInt(e[n+1]||"",10);if(Number.isNaN(r)||r<0)U({code:"invalid_wait_value",message:`Invalid --wait value: ${e[n+1]}. Must be a non-negative integer (seconds).`},T);t.wait=r,n+=2}else if(a.startsWith("--wait=")){let r=a.slice(7),i=parseInt(r,10);if(Number.isNaN(i)||i<0)U({code:"invalid_wait_value",message:`Invalid --wait value: ${r}. Must be a non-negative integer (seconds).`},T);t.wait=i,n++}else if(a==="--simulate")t.simulate=!0,n++;else if(a==="--format")t.format=e[n+1]||"text",n+=2;else if(a.startsWith("--format="))t.format=a.slice(9),n++;else n++}return t}function mre(e){let t=[];if(e.details)for(let[n,a]of Object.entries(e.details))t.push(`${n}=${a}`);if(e.thread_ids&&e.thread_ids.length>0)t.push(`threads=[${e.thread_ids.join(",")}]`);if(e.approval_ids&&e.approval_ids.length>0)t.push(`approval_ids=[${e.approval_ids.join(",")}]`);return t.join(" ")}async function XD(e,t,n){let a=pre(e);if(!a.session)U({code:"missing_required_flag",message:"Missing required flag: --session"},T);let r={};if(a.simulate)r.simulate="true";if(a.wait!==void 0)r.wait=String(a.wait);let i=await n.get(`/sessions/${encodeURIComponent(a.session)}/status`,{query:r}),{verdict:o,reasons:s}=i.body;if(a.format==="json")console.log(JSON.stringify(i.body,null,2));else if(console.log(`Session: ${a.session}`),console.log(`Verdict: ${o}`),s.length>0){console.log("Reasons:");for(let c of s){let A=mre(c);console.log(` ${c.code}${A?" "+A:""}`)}}if(o==="pass")process.exit(K);else process.exit(ba)}import{existsSync as gre,readFileSync as bre}from"fs";import{resolve as fre,basename as hre}from"path";function yre(e){let t={session:"",newSha:"",stdin:!1,reviewers:[],approvers:[],format:"text"},n=0;while(n<e.length){let a=e[n];if(a==="--session")t.session=e[n+1]||"",n+=2;else if(a.startsWith("--session="))t.session=a.slice(10),n++;else if(a==="--new-sha")t.newSha=e[n+1]||"",n+=2;else if(a.startsWith("--new-sha="))t.newSha=a.slice(10),n++;else if(a==="--title")t.title=e[n+1],n+=2;else if(a.startsWith("--title="))t.title=a.slice(8),n++;else if(a==="--message"||a==="--changes-summary")t.changesSummary=e[n+1]||"",n+=2;else if(a.startsWith("--message="))t.changesSummary=a.slice(10),n++;else if(a.startsWith("--changes-summary="))t.changesSummary=a.slice(18),n++;else if(a==="--reviewer")t.reviewers.push(e[n+1]||""),n+=2;else if(a.startsWith("--reviewer="))t.reviewers.push(a.slice(11)),n++;else if(a==="--reviewers"){let r=e[n+1]||"";t.reviewers.push(...r.split(",").map((i)=>i.trim()).filter((i)=>i.length>0)),n+=2}else if(a.startsWith("--reviewers=")){let r=a.slice(12);t.reviewers.push(...r.split(",").map((i)=>i.trim()).filter((i)=>i.length>0)),n++}else if(a==="--file")t.file=e[n+1]||"",n+=2;else if(a.startsWith("--file="))t.file=a.slice(7),n++;else if(a==="--stdin")t.stdin=!0,n++;else if(a==="--approver")t.approvers.push(e[n+1]||""),n+=2;else if(a.startsWith("--approver="))t.approvers.push(a.slice(11)),n++;else if(a==="--format")t.format=e[n+1]||"text",n+=2;else if(a.startsWith("--format="))t.format=a.slice(9),n++;else if(a?.startsWith("--"))if(console.error(`Warning: unknown flag '${a}' ignored`),n+1<e.length&&!e[n+1]?.startsWith("--"))n+=2;else n++;else n++}return t}var e1=1048576;function t1(e){let t=[];for(let n of e.reviewers)if(n.trim())t.push({email:n.trim(),role:"reviewer",roles:["reviewer"]});for(let n of e.approvers)if(n.trim())t.push({email:n.trim(),role:"approver",roles:["approver"]});return t}function n1(e,t,n){if(n==="json")console.log(JSON.stringify(e,null,2));else{let{session:a,carry_forward:r,invitations:i}=e;console.log(`New session: ${a.id}`),console.log(`Supersedes: ${t}`);let o=r?.carried_count??0,s=r?.orphaned_count??0;if(console.log(`Carry-forward: ${o} threads carried, ${s} orphaned`),i&&i.length>0){console.log(`Invitations: ${i.length} reviewer(s)`);for(let c of i)console.log(` ${c.email} \u2192 ${c.review_url}`)}}}async function a1(e,t,n){let a=yre(e);if(!a.session){U({code:"missing_required_flag",message:"Missing required flag: --session"},T);return}let r=!!a.newSha,i=!!a.file,o=a.stdin,s=i||o;if(r&&s){U({code:"conflicting_flags",message:"--new-sha and --file/--stdin are mutually exclusive. Use --new-sha for git sessions or --file/--stdin for upload sessions."},T);return}if(i&&o){U({code:"conflicting_flags",message:"--file and --stdin are mutually exclusive."},T);return}if(!r&&!s){U({code:"missing_required_flag",message:"One of --new-sha, --file, or --stdin is required to specify the updated content."},T);return}if(s)await kre(a,n);else await wre(a,n)}async function wre(e,t){if(!/^[a-f0-9]{40}$/i.test(e.newSha)){U({code:"invalid_sha_format",message:`Invalid SHA format: ${e.newSha}. Must be a 40-character hex string.`},T);return}let n={git_sha:e.newSha.toLowerCase()};if(e.title)n.title=e.title;if(e.changesSummary)n.changes_summary=e.changesSummary;let a=t1(e);if(a.length>0)n.participants=a;let r=await t.post(`/sessions/${encodeURIComponent(e.session)}/supersede`,{body:n});n1(r.body,e.session,e.format),process.exit(K)}async function kre(e,t){let n,a;if(e.stdin)n=await Zd(),a="document.md";else{let c=fre(e.file);if(!gre(c)){U({code:"file_not_found",message:`File not found: ${c}`},T);return}n=bre(c,"utf-8"),a=hre(e.file)}if(!n||n.length===0){U({code:"empty_content",message:"Content body is empty. Provide non-empty Markdown content."},T);return}let r=new TextEncoder().encode(n).length;if(r>e1){U({code:"content_too_large",message:`Content is ${r} bytes, exceeding the 1 MB limit (${e1} bytes).`},T);return}let i={content_body:n,file_path:a,supersedes_session_id:e.session};if(e.title)i.title=e.title;if(e.changesSummary)i.changes_summary=e.changesSummary;let o=t1(e);if(o.length>0)i.participants=o;let s=await t.post("/sessions",{body:i});n1(s.body,e.session,e.format),process.exit(K)}function Bre(e){let t={session:"",format:"text"},n=0;while(n<e.length){let a=e[n];if(a==="--session")t.session=e[n+1]||"",n+=2;else if(a.startsWith("--session="))t.session=a.slice(10),n++;else if(a==="--reason")t.reason=e[n+1]||"",n+=2;else if(a.startsWith("--reason="))t.reason=a.slice(9),n++;else if(a==="--format")t.format=e[n+1]||"text",n+=2;else if(a.startsWith("--format="))t.format=a.slice(9),n++;else n++}return t}async function r1(e,t,n){let a=Bre(e);if(!a.session)U({code:"missing_required_flag",message:"Missing required flag: --session"},T);let r={};if(a.reason)r.reason=a.reason;let i=await n.post(`/sessions/${encodeURIComponent(a.session)}/close`,{body:r});if(a.format==="json")console.log(JSON.stringify(i.body,null,2));else{let o=i.body;if(o.transitioned)console.log(`Session closed: ${o.session_id}`),console.log(`State: ${o.state}`);else console.log(`Session already closed: ${o.session_id}`),console.log(`State: ${o.state}`)}process.exit(K)}function Cre(e){if(!e||typeof e!=="object")return!1;return e.features?.checks===!0}async function _re(e){let n=`${e.baseUrl.replace(/\/$/,"")}/v1/me/capabilities`,a;try{a=await fetch(n,{method:"GET",headers:{Authorization:`Bearer ${e.apiKey}`,Accept:"application/json"}})}catch(o){let s=o instanceof Error?o.message:String(o);U({code:"capabilities_fetch_failed",message:`Failed to load capabilities: ${s}`},Pt)}let r={};if((a.headers.get("Content-Type")||"").includes("application/json"))try{r=await a.json()}catch{r={}}if(!a.ok){let o={};if(r&&typeof r==="object")o=r;let s=o.error?.code||"capabilities_fetch_failed",c=o.error?.message||`Failed to load capabilities (status ${a.status})`,A=o.request_id?` (request_id: ${o.request_id})`:"";U({code:s,message:`${c}${A}`},Pt)}if(Cre(r))return;U({code:"feature_disabled",message:"Feature checks is not enabled for this deployment"},T)}function Ere(e){let t={session:"",wait:!0,timeout:300,format:"text"},n=0;while(n<e.length){let a=e[n];if(a==="--session")t.session=e[n+1]||"",n+=2;else if(a.startsWith("--session="))t.session=a.slice(10),n++;else if(a==="--wait")t.wait=!0,n++;else if(a==="--no-wait")t.wait=!1,n++;else if(a==="--timeout"){let r=parseInt(e[n+1]||"",10);if(Number.isNaN(r)||r<=0)U({code:"invalid_timeout_value",message:`Invalid --timeout value: ${e[n+1]}. Must be a positive integer (seconds).`},T);t.timeout=r,n+=2}else if(a.startsWith("--timeout=")){let r=a.slice(10),i=parseInt(r,10);if(Number.isNaN(i)||i<=0)U({code:"invalid_timeout_value",message:`Invalid --timeout value: ${r}. Must be a positive integer (seconds).`},T);t.timeout=i,n++}else if(a==="--format")t.format=e[n+1]||"text",n+=2;else if(a.startsWith("--format="))t.format=a.slice(9),n++;else n++}return t}function vre(e){return new Promise((t)=>setTimeout(t,e))}async function Qre(e,t,n,a){let r=Date.now()+a*1000,i=2000;while(Date.now()<r){let o=await e.get(`/sessions/${encodeURIComponent(t)}/checks/${encodeURIComponent(n)}`);if(o.body.status==="completed"||o.body.status==="failed")return o.body;await vre(2000)}U({code:"check_run_timeout",message:`Check run did not complete within ${a}s. Run ID: ${n}`},za)}async function i1(e,t,n){let a=Ere(e);if(!a.session)U({code:"missing_required_flag",message:"Missing required flag: --session"},T);await _re(t);let r=await n.post(`/sessions/${encodeURIComponent(a.session)}/run-checks`),{check_run_id:i}=r.body;if(!a.wait){if(a.format==="json")console.log(JSON.stringify(r.body,null,2));else console.log(`Check run enqueued: ${i}`);process.exit(K)}if(a.format==="text")console.log(`Check run: ${i} (running)`);let o=Date.now(),s=await Qre(n,a.session,i,a.timeout);if(s.status==="failed"){if(a.format==="json")console.log(JSON.stringify(s,null,2));else if(console.log(`
|
|
323
325
|
Check run failed.`),s.error_json)console.log(`Error: ${JSON.stringify(s.error_json,null,2)}`);process.exit(za)}if(a.format==="json")console.log(JSON.stringify(s,null,2));else{let A=((Date.now()-o)/1000).toFixed(1);if(console.log(`Runner: checks@${s.runner_version} | Config: ${s.config_hash.slice(0,12)}`),console.log(`
|
|
324
326
|
Completed in ${A}s`),s.truncated)Bx("Warning: Results truncated \u2014 findings exceeded maximum per run.");let l=s.findings||[];if(l.length>0){console.log("");for(let p of l){let g=p.finding_gate==="gates"?"blocking":p.finding_gate==="informational"?"suggestion":p.finding_gate,b=p.block_id?`Block ${p.block_id}`:"Session-level",y=p.title||p.rule_id;if(console.log(` [${g}] ${y} (rule: ${p.rule_id})`),p.body_md)console.log(` ${b} -> ${JSON.stringify(p.body_md)}`);else console.log(` ${b}`)}}let d=l.filter((p)=>p.finding_gate==="gates").length,u=l.length-d;console.log(`
|
|
325
327
|
Result: ${l.length} findings (${d} blocking, ${u} other)`)}if((s.findings||[]).some((A)=>A.finding_gate==="gates"))process.exit(ba);else process.exit(K)}import{createHash as xre}from"crypto";import{readFileSync as Ire,writeFileSync as Dre}from"fs";var{spawn:Fre}=globalThis.Bun;function $re(e){let t={session:"",threads:[],mode:"accepted_suggestions_only",format:"text"},n=0;while(n<e.length){let a=e[n];if(a==="--session")t.session=e[n+1]||"",n+=2;else if(a.startsWith("--session="))t.session=a.slice(10),n++;else if(a==="--threads"){let r=e[n+1]||"";t.threads=r.split(",").map((i)=>i.trim()).filter(Boolean),n+=2}else if(a.startsWith("--threads=")){let r=a.slice(10);t.threads=r.split(",").map((i)=>i.trim()).filter(Boolean),n++}else if(a==="--mode")t.mode=e[n+1]||"accepted_suggestions_only",n+=2;else if(a.startsWith("--mode="))t.mode=a.slice(7),n++;else if(a==="--format")t.format=e[n+1]||"text",n+=2;else if(a.startsWith("--format="))t.format=a.slice(9),n++;else if(a==="--out")t.out=e[n+1],n+=2;else if(a.startsWith("--out="))t.out=a.slice(6),n++;else n++}return t}async function o1(e,t,n){let a=$re(e);if(!a.session)U({code:"missing_required_flag",message:"Missing required flag: --session"},T);let r={mode:a.mode};if(a.threads.length>0)r.thread_ids=a.threads;let o=(await n.post(`/sessions/${encodeURIComponent(a.session)}/proposed-changes`,{body:r})).body;if(a.out)Dre(a.out,o.patch,"utf-8"),console.error(`Patch written to ${a.out}`);if(a.format==="json")console.log(JSON.stringify(o,null,2));else{let s=o.target.git_sha?`${o.target.repo_id??"?"} @ ${o.target.git_sha}`:o.target.source_type;console.log(`Proposed Change: ${o.proposed_change_id}`),console.log(`Target: ${s} / ${o.target.file_path}`),console.log(`Expected SHA256: ${o.expected_source_content_sha256}`),console.log(`Patch SHA256: ${o.patch_sha256}`),console.log(`State: ${o.state}`),console.log("---"),console.log(o.patch)}process.exit(K)}function Sre(e){let t={session:"",change:"",checkOnly:!1,format:"text"},n=0;while(n<e.length){let a=e[n];if(a==="--session")t.session=e[n+1]||"",n+=2;else if(a.startsWith("--session="))t.session=a.slice(10),n++;else if(a==="--change")t.change=e[n+1]||"",n+=2;else if(a.startsWith("--change="))t.change=a.slice(9),n++;else if(a==="--check-only")t.checkOnly=!0,n++;else if(a==="--format")t.format=e[n+1]||"text",n+=2;else if(a.startsWith("--format="))t.format=a.slice(9),n++;else n++}return t}async function s1(e,t,n){let a=Sre(e);if(!a.session)U({code:"missing_required_flag",message:"Missing required flag: --session"},T);if(!a.change)U({code:"missing_required_flag",message:"Missing required flag: --change"},T);let i=(await n.get(`/sessions/${encodeURIComponent(a.session)}/proposed-changes/${encodeURIComponent(a.change)}`)).body,o=i.target.file_path,s;try{s=Buffer.from(Ire(o))}catch{U({code:"file_not_found",message:`Local file not found: ${o}`},T)}let c=`sha256:${xre("sha256").update(new Uint8Array(s)).digest("hex")}`;if(c!==i.expected_source_content_sha256)U({code:"content_hash_mismatch",message:`Local file hash mismatch. Expected: ${i.expected_source_content_sha256}. Got: ${c}. The file has changed since session creation.`},T);let A=a.checkOnly?["git","apply","--check","-"]:["git","apply","-"],l=Fre({cmd:A,stdin:"pipe",stdout:"pipe",stderr:"pipe"});l.stdin.write(i.patch),l.stdin.end();let d=await xr(l.stderr);if(await l.exited!==0)U({code:"git_apply_failed",message:`git apply failed: ${d.trim()||"patch could not be applied"}`},za);if(a.format==="json")console.log(JSON.stringify({proposed_change_id:i.proposed_change_id,file_path:o,check_only:a.checkOnly,applied:!a.checkOnly},null,2));else if(a.checkOnly)console.log(`Patch check passed for ${o}`);else console.log(`Patch applied to ${o}`);process.exit(K)}function Lre(e){let t={session:"",change:"",commit:"",format:"text"},n=0;while(n<e.length){let a=e[n];if(a==="--session")t.session=e[n+1]||"",n+=2;else if(a.startsWith("--session="))t.session=a.slice(10),n++;else if(a==="--change")t.change=e[n+1]||"",n+=2;else if(a.startsWith("--change="))t.change=a.slice(9),n++;else if(a==="--commit")t.commit=e[n+1]||"",n+=2;else if(a.startsWith("--commit="))t.commit=a.slice(9),n++;else if(a==="--pr")t.pr=e[n+1],n+=2;else if(a.startsWith("--pr="))t.pr=a.slice(5),n++;else if(a==="--format")t.format=e[n+1]||"text",n+=2;else if(a.startsWith("--format="))t.format=a.slice(9),n++;else n++}return t}async function c1(e,t,n){let a=Lre(e);if(!a.session)U({code:"missing_required_flag",message:"Missing required flag: --session"},T);if(!a.change)U({code:"missing_required_flag",message:"Missing required flag: --change"},T);if(!a.commit)U({code:"missing_required_flag",message:"Missing required flag: --commit"},T);let i={patch_sha256:(await n.get(`/sessions/${encodeURIComponent(a.session)}/proposed-changes/${encodeURIComponent(a.change)}`)).body.patch_sha256,result_commit_sha:a.commit};if(a.pr)i.result_pr_url=a.pr;let o=await n.post(`/sessions/${encodeURIComponent(a.session)}/proposed-changes/${encodeURIComponent(a.change)}/applied`,{body:i});if(a.format==="json")console.log(JSON.stringify(o.body,null,2));else if(console.log(`Evidence recorded for ${a.change}`),console.log(` Commit: ${a.commit}`),a.pr)console.log(` PR: ${a.pr}`);process.exit(K)}import{readFileSync as fG,writeFileSync as bBe}from"fs";import{createHash as jre}from"crypto";var Kf=new Uint8Array([239,187,191]);function qre(e){return e.length>=3&&e[0]===Kf[0]&&e[1]===Kf[1]&&e[2]===Kf[2]}function Wf(e){let t=e.length,n=!1,a=e;if(qre(a))a=a.slice(3),n=!0;let r=new TextDecoder("utf-8",{fatal:!0}),i;try{i=r.decode(a)}catch{throw Error("Invalid UTF-8 encoding")}let o=i;i=i.replace(/\r\n/g,`
|
|
@@ -328,7 +330,7 @@ Result: ${l.length} findings (${d} blocking, ${u} other)`)}if((s.findings||[]).s
|
|
|
328
330
|
`,cr:"\r",space:" ",exclamationMark:"!",quotationMark:'"',numberSign:"#",dollarSign:"$",percentSign:"%",ampersand:"&",apostrophe:"'",leftParenthesis:"(",rightParenthesis:")",asterisk:"*",plusSign:"+",comma:",",dash:"-",dot:".",slash:"/",digit0:"0",digit1:"1",digit2:"2",digit3:"3",digit4:"4",digit5:"5",digit6:"6",digit7:"7",digit8:"8",digit9:"9",colon:":",semicolon:";",lessThan:"<",equalsTo:"=",greaterThan:">",questionMark:"?",atSign:"@",uppercaseA:"A",uppercaseB:"B",uppercaseC:"C",uppercaseD:"D",uppercaseE:"E",uppercaseF:"F",uppercaseG:"G",uppercaseH:"H",uppercaseI:"I",uppercaseJ:"J",uppercaseK:"K",uppercaseL:"L",uppercaseM:"M",uppercaseN:"N",uppercaseO:"O",uppercaseP:"P",uppercaseQ:"Q",uppercaseR:"R",uppercaseS:"S",uppercaseT:"T",uppercaseU:"U",uppercaseV:"V",uppercaseW:"W",uppercaseX:"X",uppercaseY:"Y",uppercaseZ:"Z",leftSquareBracket:"[",backslash:"\\",rightSquareBracket:"]",caret:"^",underscore:"_",graveAccent:"`",lowercaseA:"a",lowercaseB:"b",lowercaseC:"c",lowercaseD:"d",lowercaseE:"e",lowercaseF:"f",lowercaseG:"g",lowercaseH:"h",lowercaseI:"i",lowercaseJ:"j",lowercaseK:"k",lowercaseL:"l",lowercaseM:"m",lowercaseN:"n",lowercaseO:"o",lowercaseP:"p",lowercaseQ:"q",lowercaseR:"r",lowercaseS:"s",lowercaseT:"t",lowercaseU:"u",lowercaseV:"v",lowercaseW:"w",lowercaseX:"x",lowercaseY:"y",lowercaseZ:"z",leftCurlyBrace:"{",verticalBar:"|",rightCurlyBrace:"}",tilde:"~",replacementCharacter:"\uFFFD"};function gt(e,t,n,a){let r=e.length,i=0,o;if(t<0)t=-t>r?0:r+t;else t=t>r?r:t;if(n=n>0?n:0,a.length<J.v8MaxSafeChunkSize)o=Array.from(a),o.unshift(t,n),e.splice(...o);else{if(n)e.splice(t,n);while(i<a.length)o=a.slice(i,i+J.v8MaxSafeChunkSize),o.unshift(t,0),e.splice(...o),i+=J.v8MaxSafeChunkSize,t+=J.v8MaxSafeChunkSize}}function Ot(e,t){if(e.length>0)return gt(e,e.length,0,t),e;return t}var u1={}.hasOwnProperty;function Vd(e){let t={},n=-1;while(++n<e.length)Pre(t,e[n]);return t}function Pre(e,t){let n;for(n in t){let r=(u1.call(e,n)?e[n]:void 0)||(e[n]={}),i=t[n],o;if(i)for(o in i){if(!u1.call(r,o))r[o]=[];let s=i[o];zre(r[o],Array.isArray(s)?s:s?[s]:[])}}}function zre(e,t){let n=-1,a=[];while(++n<t.length)(t[n].add==="after"?e:a).push(t[n]);gt(e,0,0,a)}function Xd(e,t){let n=Number.parseInt(e,t);if(n<f.ht||n===f.vt||n>f.cr&&n<f.space||n>f.tilde&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111)return _n.replacementCharacter;return String.fromCodePoint(n)}function zt(e){return e.replace(/[\t\n\r ]+/g,_n.space).replace(/^ | $/g,"").toLowerCase().toUpperCase()}var vt=Ir(/[A-Za-z]/),Qt=Ir(/[\dA-Za-z]/),p1=Ir(/[#-'*+\--9=?A-Z^-~]/);function Ei(e){return e!==null&&(e<f.space||e===f.del)}var Pc=Ir(/\d/),m1=Ir(/[\dA-Fa-f]/),g1=Ir(/[!-/:-@[-`{-~]/);function ne(e){return e!==null&&e<f.horizontalTab}function je(e){return e!==null&&(e<f.nul||e===f.space)}function fe(e){return e===f.horizontalTab||e===f.virtualSpace||e===f.space}var vi=Ir(/\p{P}|\p{S}/u),ya=Ir(/\s/);function Ir(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function we(e,t,n,a){let r=a?a-1:Number.POSITIVE_INFINITY,i=0;return o;function o(c){if(fe(c))return e.enter(n),s(c);return t(c)}function s(c){if(fe(c)&&i++<r)return e.consume(c),s;return e.exit(n),t(c)}}var b1={tokenize:Ure};function Ure(e){let t=e.attempt(this.parser.constructs.contentInitial,a,r),n;return t;function a(s){if(L(s===f.eof||ne(s),"expected eol or eof"),s===f.eof){e.consume(s);return}return e.enter(k.lineEnding),e.consume(s),e.exit(k.lineEnding),we(e,t,k.linePrefix)}function r(s){return L(s!==f.eof&&!ne(s),"expected anything other than a line ending or EOF"),e.enter(k.paragraph),i(s)}function i(s){let c=e.enter(k.chunkText,{contentType:J.contentTypeText,previous:n});if(n)n.next=c;return n=c,o(s)}function o(s){if(s===f.eof){e.exit(k.chunkText),e.exit(k.paragraph),e.consume(s);return}if(ne(s))return e.consume(s),e.exit(k.chunkText),i;return e.consume(s),o}}var h1={tokenize:Hre},f1={tokenize:Tre};function Hre(e){let t=this,n=[],a=0,r,i,o;return s;function s(C){if(a<n.length){let D=n[a];return t.containerState=D[1],L(D[0].continuation,"expected `continuation` to be defined on container construct"),e.attempt(D[0].continuation,c,A)(C)}return A(C)}function c(C){if(L(t.containerState,"expected `containerState` to be defined after continuation"),a++,t.containerState._closeFlow){if(t.containerState._closeFlow=void 0,r)E();let D=t.events.length,F=D,I;while(F--)if(t.events[F][0]==="exit"&&t.events[F][1].type===k.chunkFlow){I=t.events[F][1].end;break}L(I,"could not find previous flow chunk"),w(a);let P=D;while(P<t.events.length)t.events[P][1].end={...I},P++;return gt(t.events,F+1,0,t.events.slice(D)),t.events.length=P,A(C)}return s(C)}function A(C){if(a===n.length){if(!r)return u(C);if(r.currentConstruct&&r.currentConstruct.concrete)return g(C);t.interrupt=Boolean(r.currentConstruct&&!r._gfmTableDynamicInterruptHack)}return t.containerState={},e.check(f1,l,d)(C)}function l(C){if(r)E();return w(a),u(C)}function d(C){return t.parser.lazy[t.now().line]=a!==n.length,o=t.now().offset,g(C)}function u(C){return t.containerState={},e.attempt(f1,p,g)(C)}function p(C){return L(t.currentConstruct,"expected `currentConstruct` to be defined on tokenizer"),L(t.containerState,"expected `containerState` to be defined on tokenizer"),a++,n.push([t.currentConstruct,t.containerState]),u(C)}function g(C){if(C===f.eof){if(r)E();w(0),e.consume(C);return}return r=r||t.parser.flow(t.now()),e.enter(k.chunkFlow,{_tokenizer:r,contentType:J.contentTypeFlow,previous:i}),b(C)}function b(C){if(C===f.eof){y(e.exit(k.chunkFlow),!0),w(0),e.consume(C);return}if(ne(C))return e.consume(C),y(e.exit(k.chunkFlow)),a=0,t.interrupt=void 0,s;return e.consume(C),b}function y(C,D){L(r,"expected `childFlow` to be defined when continuing");let F=t.sliceStream(C);if(D)F.push(null);if(C.previous=i,i)i.next=C;if(i=C,r.defineSkip(C.start),r.write(F),t.parser.lazy[C.start.line]){let I=r.events.length;while(I--)if(r.events[I][1].start.offset<o&&(!r.events[I][1].end||r.events[I][1].end.offset>o))return;let P=t.events.length,G=P,W,z;while(G--)if(t.events[G][0]==="exit"&&t.events[G][1].type===k.chunkFlow){if(W){z=t.events[G][1].end;break}W=!0}L(z,"could not find previous flow chunk"),w(a),I=P;while(I<t.events.length)t.events[I][1].end={...z},I++;gt(t.events,G+1,0,t.events.slice(P)),t.events.length=I}}function w(C){let D=n.length;while(D-- >C){let F=n[D];t.containerState=F[1],L(F[0].exit,"expected `exit` to be defined on container construct"),F[0].exit.call(t,e)}n.length=C}function E(){L(t.containerState,"expected `containerState` to be defined when closing flow"),L(r,"expected `childFlow` to be defined when closing it"),r.write([f.eof]),i=void 0,r=void 0,t.containerState._closeFlow=void 0}}function Tre(e,t,n){return L(this.parser.constructs.disable.null,"expected `disable.null` to be populated"),we(e,e.attempt(this.parser.constructs.document,t,n),k.linePrefix,this.parser.constructs.disable.null.includes("codeIndented")?void 0:J.tabSize)}function No(e){if(e===f.eof||je(e)||ya(e))return J.characterGroupWhitespace;if(vi(e))return J.characterGroupPunctuation}function Dr(e,t,n){let a=[],r=-1;while(++r<e.length){let i=e[r].resolveAll;if(i&&!a.includes(i))t=i(t,n),a.push(i)}return t}var zc={name:"attention",resolveAll:Ore,tokenize:Zre};function Ore(e,t){let n=-1,a,r,i,o,s,c,A,l;while(++n<e.length)if(e[n][0]==="enter"&&e[n][1].type==="attentionSequence"&&e[n][1]._close){a=n;while(a--)if(e[a][0]==="exit"&&e[a][1].type==="attentionSequence"&&e[a][1]._open&&t.sliceSerialize(e[a][1]).charCodeAt(0)===t.sliceSerialize(e[n][1]).charCodeAt(0)){if((e[a][1]._close||e[n][1]._open)&&(e[n][1].end.offset-e[n][1].start.offset)%3&&!((e[a][1].end.offset-e[a][1].start.offset+e[n][1].end.offset-e[n][1].start.offset)%3))continue;c=e[a][1].end.offset-e[a][1].start.offset>1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let d={...e[a][1].end},u={...e[n][1].start};if(y1(d,-c),y1(u,c),o={type:c>1?k.strongSequence:k.emphasisSequence,start:d,end:{...e[a][1].end}},s={type:c>1?k.strongSequence:k.emphasisSequence,start:{...e[n][1].start},end:u},i={type:c>1?k.strongText:k.emphasisText,start:{...e[a][1].end},end:{...e[n][1].start}},r={type:c>1?k.strong:k.emphasis,start:{...o.start},end:{...s.end}},e[a][1].end={...o.start},e[n][1].start={...s.end},A=[],e[a][1].end.offset-e[a][1].start.offset)A=Ot(A,[["enter",e[a][1],t],["exit",e[a][1],t]]);if(A=Ot(A,[["enter",r,t],["enter",o,t],["exit",o,t],["enter",i,t]]),L(t.parser.constructs.insideSpan.null,"expected `insideSpan` to be populated"),A=Ot(A,Dr(t.parser.constructs.insideSpan.null,e.slice(a+1,n),t)),A=Ot(A,[["exit",i,t],["enter",s,t],["exit",s,t],["exit",r,t]]),e[n][1].end.offset-e[n][1].start.offset)l=2,A=Ot(A,[["enter",e[n][1],t],["exit",e[n][1],t]]);else l=0;gt(e,a-1,n-a+3,A),n=a+A.length-l-2;break}}n=-1;while(++n<e.length)if(e[n][1].type==="attentionSequence")e[n][1].type="data";return e}function Zre(e,t){let n=this.parser.constructs.attentionMarkers.null,a=this.previous,r=No(a),i;return o;function o(c){return L(c===f.asterisk||c===f.underscore,"expected asterisk or underscore"),i=c,e.enter("attentionSequence"),s(c)}function s(c){if(c===i)return e.consume(c),s;let A=e.exit("attentionSequence"),l=No(c);L(n,"expected `attentionMarkers` to be populated");let d=!l||l===J.characterGroupPunctuation&&r||n.includes(c),u=!r||r===J.characterGroupPunctuation&&l||n.includes(a);return A._open=Boolean(i===f.asterisk?d:d&&(r||!u)),A._close=Boolean(i===f.asterisk?u:u&&(l||!d)),t(c)}}function y1(e,t){e.column+=t,e.offset+=t,e._bufferIndex+=t}var Xf={name:"autolink",tokenize:Yre};function Yre(e,t,n){let a=0;return r;function r(p){return L(p===f.lessThan,"expected `<`"),e.enter(k.autolink),e.enter(k.autolinkMarker),e.consume(p),e.exit(k.autolinkMarker),e.enter(k.autolinkProtocol),i}function i(p){if(vt(p))return e.consume(p),o;if(p===f.atSign)return n(p);return A(p)}function o(p){if(p===f.plusSign||p===f.dash||p===f.dot||Qt(p))return a=1,s(p);return A(p)}function s(p){if(p===f.colon)return e.consume(p),a=0,c;if((p===f.plusSign||p===f.dash||p===f.dot||Qt(p))&&a++<J.autolinkSchemeSizeMax)return e.consume(p),s;return a=0,A(p)}function c(p){if(p===f.greaterThan)return e.exit(k.autolinkProtocol),e.enter(k.autolinkMarker),e.consume(p),e.exit(k.autolinkMarker),e.exit(k.autolink),t;if(p===f.eof||p===f.space||p===f.lessThan||Ei(p))return n(p);return e.consume(p),c}function A(p){if(p===f.atSign)return e.consume(p),l;if(p1(p))return e.consume(p),A;return n(p)}function l(p){return Qt(p)?d(p):n(p)}function d(p){if(p===f.dot)return e.consume(p),a=0,l;if(p===f.greaterThan)return e.exit(k.autolinkProtocol).type=k.autolinkEmail,e.enter(k.autolinkMarker),e.consume(p),e.exit(k.autolinkMarker),e.exit(k.autolink),t;return u(p)}function u(p){if((p===f.dash||Qt(p))&&a++<J.autolinkDomainSizeMax){let g=p===f.dash?u:d;return e.consume(p),g}return n(p)}}var wa={partial:!0,tokenize:Kre};function Kre(e,t,n){return a;function a(i){return fe(i)?we(e,r,k.linePrefix)(i):r(i)}function r(i){return i===f.eof||ne(i)?t(i):n(i)}}var eu={continuation:{tokenize:Jre},exit:Vre,name:"blockQuote",tokenize:Wre};function Wre(e,t,n){let a=this;return r;function r(o){if(o===f.greaterThan){let s=a.containerState;if(L(s,"expected `containerState` to be defined in container"),!s.open)e.enter(k.blockQuote,{_container:!0}),s.open=!0;return e.enter(k.blockQuotePrefix),e.enter(k.blockQuoteMarker),e.consume(o),e.exit(k.blockQuoteMarker),i}return n(o)}function i(o){if(fe(o))return e.enter(k.blockQuotePrefixWhitespace),e.consume(o),e.exit(k.blockQuotePrefixWhitespace),e.exit(k.blockQuotePrefix),t;return e.exit(k.blockQuotePrefix),t(o)}}function Jre(e,t,n){let a=this;return r;function r(o){if(fe(o))return L(a.parser.constructs.disable.null,"expected `disable.null` to be populated"),we(e,i,k.linePrefix,a.parser.constructs.disable.null.includes("codeIndented")?void 0:J.tabSize)(o);return i(o)}function i(o){return e.attempt(eu,t,n)(o)}}function Vre(e){e.exit(k.blockQuote)}var tu={name:"characterEscape",tokenize:Xre};function Xre(e,t,n){return a;function a(i){return L(i===f.backslash,"expected `\\`"),e.enter(k.characterEscape),e.enter(k.escapeMarker),e.consume(i),e.exit(k.escapeMarker),r}function r(i){if(g1(i))return e.enter(k.characterEscapeValue),e.consume(i),e.exit(k.characterEscapeValue),e.exit(k.characterEscape),t;return n(i)}}var nu={name:"characterReference",tokenize:eie};function eie(e,t,n){let a=this,r=0,i,o;return s;function s(d){return L(d===f.ampersand,"expected `&`"),e.enter(k.characterReference),e.enter(k.characterReferenceMarker),e.consume(d),e.exit(k.characterReferenceMarker),c}function c(d){if(d===f.numberSign)return e.enter(k.characterReferenceMarkerNumeric),e.consume(d),e.exit(k.characterReferenceMarkerNumeric),A;return e.enter(k.characterReferenceValue),i=J.characterReferenceNamedSizeMax,o=Qt,l(d)}function A(d){if(d===f.uppercaseX||d===f.lowercaseX)return e.enter(k.characterReferenceMarkerHexadecimal),e.consume(d),e.exit(k.characterReferenceMarkerHexadecimal),e.enter(k.characterReferenceValue),i=J.characterReferenceHexadecimalSizeMax,o=m1,l;return e.enter(k.characterReferenceValue),i=J.characterReferenceDecimalSizeMax,o=Pc,l(d)}function l(d){if(d===f.semicolon&&r){let u=e.exit(k.characterReferenceValue);if(o===Qt&&!qo(a.sliceSerialize(u)))return n(d);return e.enter(k.characterReferenceMarker),e.consume(d),e.exit(k.characterReferenceMarker),e.exit(k.characterReference),t}if(o(d)&&r++<i)return e.consume(d),l;return n(d)}}var w1={partial:!0,tokenize:nie},au={concrete:!0,name:"codeFenced",tokenize:tie};function tie(e,t,n){let a=this,r={partial:!0,tokenize:F},i=0,o=0,s;return c;function c(I){return A(I)}function A(I){L(I===f.graveAccent||I===f.tilde,"expected `` ` `` or `~`");let P=a.events[a.events.length-1];return i=P&&P[1].type===k.linePrefix?P[2].sliceSerialize(P[1],!0).length:0,s=I,e.enter(k.codeFenced),e.enter(k.codeFencedFence),e.enter(k.codeFencedFenceSequence),l(I)}function l(I){if(I===s)return o++,e.consume(I),l;if(o<J.codeFencedSequenceSizeMin)return n(I);return e.exit(k.codeFencedFenceSequence),fe(I)?we(e,d,k.whitespace)(I):d(I)}function d(I){if(I===f.eof||ne(I))return e.exit(k.codeFencedFence),a.interrupt?t(I):e.check(w1,b,D)(I);return e.enter(k.codeFencedFenceInfo),e.enter(k.chunkString,{contentType:J.contentTypeString}),u(I)}function u(I){if(I===f.eof||ne(I))return e.exit(k.chunkString),e.exit(k.codeFencedFenceInfo),d(I);if(fe(I))return e.exit(k.chunkString),e.exit(k.codeFencedFenceInfo),we(e,p,k.whitespace)(I);if(I===f.graveAccent&&I===s)return n(I);return e.consume(I),u}function p(I){if(I===f.eof||ne(I))return d(I);return e.enter(k.codeFencedFenceMeta),e.enter(k.chunkString,{contentType:J.contentTypeString}),g(I)}function g(I){if(I===f.eof||ne(I))return e.exit(k.chunkString),e.exit(k.codeFencedFenceMeta),d(I);if(I===f.graveAccent&&I===s)return n(I);return e.consume(I),g}function b(I){return L(ne(I),"expected eol"),e.attempt(r,D,y)(I)}function y(I){return L(ne(I),"expected eol"),e.enter(k.lineEnding),e.consume(I),e.exit(k.lineEnding),w}function w(I){return i>0&&fe(I)?we(e,E,k.linePrefix,i+1)(I):E(I)}function E(I){if(I===f.eof||ne(I))return e.check(w1,b,D)(I);return e.enter(k.codeFlowValue),C(I)}function C(I){if(I===f.eof||ne(I))return e.exit(k.codeFlowValue),E(I);return e.consume(I),C}function D(I){return e.exit(k.codeFenced),t(I)}function F(I,P,G){let W=0;return z;function z(be){return L(ne(be),"expected eol"),I.enter(k.lineEnding),I.consume(be),I.exit(k.lineEnding),ye}function ye(be){return L(a.parser.constructs.disable.null,"expected `disable.null` to be populated"),I.enter(k.codeFencedFence),fe(be)?we(I,ee,k.linePrefix,a.parser.constructs.disable.null.includes("codeIndented")?void 0:J.tabSize)(be):ee(be)}function ee(be){if(be===s)return I.enter(k.codeFencedFenceSequence),ce(be);return G(be)}function ce(be){if(be===s)return W++,I.consume(be),ce;if(W>=o)return I.exit(k.codeFencedFenceSequence),fe(be)?we(I,de,k.whitespace)(be):de(be);return G(be)}function de(be){if(be===f.eof||ne(be))return I.exit(k.codeFencedFence),P(be);return G(be)}}}function nie(e,t,n){let a=this;return r;function r(o){if(o===f.eof)return n(o);return L(ne(o),"expected eol"),e.enter(k.lineEnding),e.consume(o),e.exit(k.lineEnding),i}function i(o){return a.parser.lazy[a.now().line]?n(o):t(o)}}var Uc={name:"codeIndented",tokenize:rie},aie={partial:!0,tokenize:iie};function rie(e,t,n){let a=this;return r;function r(A){return L(fe(A)),e.enter(k.codeIndented),we(e,i,k.linePrefix,J.tabSize+1)(A)}function i(A){let l=a.events[a.events.length-1];return l&&l[1].type===k.linePrefix&&l[2].sliceSerialize(l[1],!0).length>=J.tabSize?o(A):n(A)}function o(A){if(A===f.eof)return c(A);if(ne(A))return e.attempt(aie,o,c)(A);return e.enter(k.codeFlowValue),s(A)}function s(A){if(A===f.eof||ne(A))return e.exit(k.codeFlowValue),o(A);return e.consume(A),s}function c(A){return e.exit(k.codeIndented),t(A)}}function iie(e,t,n){let a=this;return r;function r(o){if(a.parser.lazy[a.now().line])return n(o);if(ne(o))return e.enter(k.lineEnding),e.consume(o),e.exit(k.lineEnding),r;return we(e,i,k.linePrefix,J.tabSize+1)(o)}function i(o){let s=a.events[a.events.length-1];return s&&s[1].type===k.linePrefix&&s[2].sliceSerialize(s[1],!0).length>=J.tabSize?t(o):ne(o)?r(o):n(o)}}var eh={name:"codeText",previous:k1,resolve:oie,tokenize:sie};function oie(e){let t=e.length-4,n=3,a,r;if((e[n][1].type===k.lineEnding||e[n][1].type==="space")&&(e[t][1].type===k.lineEnding||e[t][1].type==="space")){a=n;while(++a<t)if(e[a][1].type===k.codeTextData){e[n][1].type=k.codeTextPadding,e[t][1].type=k.codeTextPadding,n+=2,t-=2;break}}a=n-1,t++;while(++a<=t)if(r===void 0){if(a!==t&&e[a][1].type!==k.lineEnding)r=a}else if(a===t||e[a][1].type===k.lineEnding){if(e[r][1].type=k.codeTextData,a!==r+2)e[r][1].end=e[a-1][1].end,e.splice(r+2,a-r-2),t-=a-r-2,a=r+2;r=void 0}return e}function k1(e){return e!==f.graveAccent||this.events[this.events.length-1][1].type===k.characterEscape}function sie(e,t,n){let a=this,r=0,i,o;return s;function s(u){return L(u===f.graveAccent,"expected `` ` ``"),L(k1.call(a,a.previous),"expected correct previous"),e.enter(k.codeText),e.enter(k.codeTextSequence),c(u)}function c(u){if(u===f.graveAccent)return e.consume(u),r++,c;return e.exit(k.codeTextSequence),A(u)}function A(u){if(u===f.eof)return n(u);if(u===f.space)return e.enter("space"),e.consume(u),e.exit("space"),A;if(u===f.graveAccent)return o=e.enter(k.codeTextSequence),i=0,d(u);if(ne(u))return e.enter(k.lineEnding),e.consume(u),e.exit(k.lineEnding),A;return e.enter(k.codeTextData),l(u)}function l(u){if(u===f.eof||u===f.space||u===f.graveAccent||ne(u))return e.exit(k.codeTextData),A(u);return e.consume(u),l}function d(u){if(u===f.graveAccent)return e.consume(u),i++,d;if(i===r)return e.exit(k.codeTextSequence),e.exit(k.codeText),t(u);return o.type=k.codeTextData,l(u)}}class th{constructor(e){this.left=e?[...e]:[],this.right=[]}get(e){if(e<0||e>=this.left.length+this.right.length)throw RangeError("Cannot access index `"+e+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");if(e<this.left.length)return this.left[e];return this.right[this.right.length-e+this.left.length-1]}get length(){return this.left.length+this.right.length}shift(){return this.setCursor(0),this.right.pop()}slice(e,t){let n=t===null||t===void 0?Number.POSITIVE_INFINITY:t;if(n<this.left.length)return this.left.slice(e,n);if(e>this.left.length)return this.right.slice(this.right.length-n+this.left.length,this.right.length-e+this.left.length).reverse();return this.left.slice(e).concat(this.right.slice(this.right.length-n+this.left.length).reverse())}splice(e,t,n){let a=t||0;this.setCursor(Math.trunc(e));let r=this.right.splice(this.right.length-a,Number.POSITIVE_INFINITY);if(n)Hc(this.left,n);return r.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(e){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(e)}pushMany(e){this.setCursor(Number.POSITIVE_INFINITY),Hc(this.left,e)}unshift(e){this.setCursor(0),this.right.push(e)}unshiftMany(e){this.setCursor(0),Hc(this.right,e.reverse())}setCursor(e){if(e===this.left.length||e>this.left.length&&this.right.length===0||e<0&&this.left.length===0)return;if(e<this.left.length){let t=this.left.splice(e,Number.POSITIVE_INFINITY);Hc(this.right,t.reverse())}else{let t=this.right.splice(this.left.length+this.right.length-e,Number.POSITIVE_INFINITY);Hc(this.left,t.reverse())}}}function Hc(e,t){let n=0;if(t.length<J.v8MaxSafeChunkSize)e.push(...t);else while(n<t.length)e.push(...t.slice(n,n+J.v8MaxSafeChunkSize)),n+=J.v8MaxSafeChunkSize}function ru(e){let t={},n=-1,a,r,i,o,s,c,A,l=new th(e);while(++n<l.length){while(n in t)n=t[n];if(a=l.get(n),n&&a[1].type===k.chunkFlow&&l.get(n-1)[1].type===k.listItemPrefix){if(L(a[1]._tokenizer,"expected `_tokenizer` on subtokens"),c=a[1]._tokenizer.events,i=0,i<c.length&&c[i][1].type===k.lineEndingBlank)i+=2;if(i<c.length&&c[i][1].type===k.content)while(++i<c.length){if(c[i][1].type===k.content)break;if(c[i][1].type===k.chunkText)c[i][1]._isInFirstContentOfListItem=!0,i++}}if(a[0]==="enter"){if(a[1].contentType)Object.assign(t,cie(l,n)),n=t[n],A=!0}else if(a[1]._container){i=n,r=void 0;while(i--)if(o=l.get(i),o[1].type===k.lineEnding||o[1].type===k.lineEndingBlank){if(o[0]==="enter"){if(r)l.get(r)[1].type=k.lineEndingBlank;o[1].type=k.lineEnding,r=i}}else if(o[1].type===k.linePrefix||o[1].type===k.listItemIndent);else break;if(r)a[1].end={...l.get(r)[1].start},s=l.slice(r,n),s.unshift(a),l.splice(r,n-r+1,s)}}return gt(e,0,Number.POSITIVE_INFINITY,l.slice(0)),!A}function cie(e,t){let n=e.get(t)[1],a=e.get(t)[2],r=t-1,i=[];L(n.contentType,"expected `contentType` on subtokens");let o=n._tokenizer;if(!o){if(o=a.parser[n.contentType](n.start),n._contentTypeTextTrailing)o._contentTypeTextTrailing=!0}let s=o.events,c=[],A={},l,d,u=-1,p=n,g=0,b=0,y=[b];while(p){while(e.get(++r)[1]!==p);if(L(!d||p.previous===d,"expected previous to match"),L(!d||d.next===p,"expected next to match"),i.push(r),!p._tokenizer){if(l=a.sliceStream(p),!p.next)l.push(f.eof);if(d)o.defineSkip(p.start);if(p._isInFirstContentOfListItem)o._gfmTasklistFirstContentOfListItem=!0;if(o.write(l),p._isInFirstContentOfListItem)o._gfmTasklistFirstContentOfListItem=void 0}d=p,p=p.next}p=n;while(++u<s.length)if(s[u][0]==="exit"&&s[u-1][0]==="enter"&&s[u][1].type===s[u-1][1].type&&s[u][1].start.line!==s[u][1].end.line)L(p,"expected a current token"),b=u+1,y.push(b),p._tokenizer=void 0,p.previous=void 0,p=p.next;if(o.events=[],p)p._tokenizer=void 0,p.previous=void 0,L(!p.next,"expected no next token");else y.pop();u=y.length;while(u--){let w=s.slice(y[u],y[u+1]),E=i.pop();L(E!==void 0,"expected a start position when splicing"),c.push([E,E+w.length-1]),e.splice(E,2,w)}c.reverse(),u=-1;while(++u<c.length)A[g+c[u][0]]=g+c[u][1],g+=c[u][1]-c[u][0]-1;return A}var nh={resolve:lie,tokenize:die},Aie={partial:!0,tokenize:uie};function lie(e){return ru(e),e}function die(e,t){let n;return a;function a(s){return L(s!==f.eof&&!ne(s),"expected no eof or eol"),e.enter(k.content),n=e.enter(k.chunkContent,{contentType:J.contentTypeContent}),r(s)}function r(s){if(s===f.eof)return i(s);if(ne(s))return e.check(Aie,o,i)(s);return e.consume(s),r}function i(s){return e.exit(k.chunkContent),e.exit(k.content),t(s)}function o(s){return L(ne(s),"expected eol"),e.consume(s),e.exit(k.chunkContent),L(n,"expected previous token"),n.next=e.enter(k.chunkContent,{contentType:J.contentTypeContent,previous:n}),n=n.next,r}}function uie(e,t,n){let a=this;return r;function r(o){return L(ne(o),"expected a line ending"),e.exit(k.chunkContent),e.enter(k.lineEnding),e.consume(o),e.exit(k.lineEnding),we(e,i,k.linePrefix)}function i(o){if(o===f.eof||ne(o))return n(o);L(a.parser.constructs.disable.null,"expected `disable.null` to be populated");let s=a.events[a.events.length-1];if(!a.parser.constructs.disable.null.includes("codeIndented")&&s&&s[1].type===k.linePrefix&&s[2].sliceSerialize(s[1],!0).length>=J.tabSize)return t(o);return e.interrupt(a.parser.constructs.flow,n,t)(o)}}function iu(e,t,n,a,r,i,o,s,c){let A=c||Number.POSITIVE_INFINITY,l=0;return d;function d(w){if(w===f.lessThan)return e.enter(a),e.enter(r),e.enter(i),e.consume(w),e.exit(i),u;if(w===f.eof||w===f.space||w===f.rightParenthesis||Ei(w))return n(w);return e.enter(a),e.enter(o),e.enter(s),e.enter(k.chunkString,{contentType:J.contentTypeString}),b(w)}function u(w){if(w===f.greaterThan)return e.enter(i),e.consume(w),e.exit(i),e.exit(r),e.exit(a),t;return e.enter(s),e.enter(k.chunkString,{contentType:J.contentTypeString}),p(w)}function p(w){if(w===f.greaterThan)return e.exit(k.chunkString),e.exit(s),u(w);if(w===f.eof||w===f.lessThan||ne(w))return n(w);return e.consume(w),w===f.backslash?g:p}function g(w){if(w===f.lessThan||w===f.greaterThan||w===f.backslash)return e.consume(w),p;return p(w)}function b(w){if(!l&&(w===f.eof||w===f.rightParenthesis||je(w)))return e.exit(k.chunkString),e.exit(s),e.exit(o),e.exit(a),t(w);if(l<A&&w===f.leftParenthesis)return e.consume(w),l++,b;if(w===f.rightParenthesis)return e.consume(w),l--,b;if(w===f.eof||w===f.space||w===f.leftParenthesis||Ei(w))return n(w);return e.consume(w),w===f.backslash?y:b}function y(w){if(w===f.leftParenthesis||w===f.rightParenthesis||w===f.backslash)return e.consume(w),b;return b(w)}}function ou(e,t,n,a,r,i){let o=this,s=0,c;return A;function A(p){return L(p===f.leftSquareBracket,"expected `[`"),e.enter(a),e.enter(r),e.consume(p),e.exit(r),e.enter(i),l}function l(p){if(s>J.linkReferenceSizeMax||p===f.eof||p===f.leftSquareBracket||p===f.rightSquareBracket&&!c||p===f.caret&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs)return n(p);if(p===f.rightSquareBracket)return e.exit(i),e.enter(r),e.consume(p),e.exit(r),e.exit(a),t;if(ne(p))return e.enter(k.lineEnding),e.consume(p),e.exit(k.lineEnding),l;return e.enter(k.chunkString,{contentType:J.contentTypeString}),d(p)}function d(p){if(p===f.eof||p===f.leftSquareBracket||p===f.rightSquareBracket||ne(p)||s++>J.linkReferenceSizeMax)return e.exit(k.chunkString),l(p);if(e.consume(p),!c)c=!fe(p);return p===f.backslash?u:d}function u(p){if(p===f.leftSquareBracket||p===f.backslash||p===f.rightSquareBracket)return e.consume(p),s++,d;return d(p)}}function su(e,t,n,a,r,i){let o;return s;function s(u){if(u===f.quotationMark||u===f.apostrophe||u===f.leftParenthesis)return e.enter(a),e.enter(r),e.consume(u),e.exit(r),o=u===f.leftParenthesis?f.rightParenthesis:u,c;return n(u)}function c(u){if(u===o)return e.enter(r),e.consume(u),e.exit(r),e.exit(a),t;return e.enter(i),A(u)}function A(u){if(u===o)return e.exit(i),c(o);if(u===f.eof)return n(u);if(ne(u))return e.enter(k.lineEnding),e.consume(u),e.exit(k.lineEnding),we(e,A,k.linePrefix);return e.enter(k.chunkString,{contentType:J.contentTypeString}),l(u)}function l(u){if(u===o||u===f.eof||ne(u))return e.exit(k.chunkString),A(u);return e.consume(u),u===f.backslash?d:l}function d(u){if(u===o||u===f.backslash)return e.consume(u),l;return l(u)}}function Qi(e,t){let n;return a;function a(r){if(ne(r))return e.enter(k.lineEnding),e.consume(r),e.exit(k.lineEnding),n=!0,a;if(fe(r))return we(e,a,n?k.linePrefix:k.lineSuffix)(r);return t(r)}}var ah={name:"definition",tokenize:mie},pie={partial:!0,tokenize:gie};function mie(e,t,n){let a=this,r;return i;function i(p){return e.enter(k.definition),o(p)}function o(p){return L(p===f.leftSquareBracket,"expected `[`"),ou.call(a,e,s,n,k.definitionLabel,k.definitionLabelMarker,k.definitionLabelString)(p)}function s(p){if(r=zt(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)),p===f.colon)return e.enter(k.definitionMarker),e.consume(p),e.exit(k.definitionMarker),c;return n(p)}function c(p){return je(p)?Qi(e,A)(p):A(p)}function A(p){return iu(e,l,n,k.definitionDestination,k.definitionDestinationLiteral,k.definitionDestinationLiteralMarker,k.definitionDestinationRaw,k.definitionDestinationString)(p)}function l(p){return e.attempt(pie,d,d)(p)}function d(p){return fe(p)?we(e,u,k.whitespace)(p):u(p)}function u(p){if(p===f.eof||ne(p))return e.exit(k.definition),a.parser.defined.push(r),t(p);return n(p)}}function gie(e,t,n){return a;function a(s){return je(s)?Qi(e,r)(s):n(s)}function r(s){return su(e,i,n,k.definitionTitle,k.definitionTitleMarker,k.definitionTitleString)(s)}function i(s){return fe(s)?we(e,o,k.whitespace)(s):o(s)}function o(s){return s===f.eof||ne(s)?t(s):n(s)}}var rh={name:"hardBreakEscape",tokenize:bie};function bie(e,t,n){return a;function a(i){return L(i===f.backslash,"expected `\\`"),e.enter(k.hardBreakEscape),e.consume(i),r}function r(i){if(ne(i))return e.exit(k.hardBreakEscape),t(i);return n(i)}}var ih={name:"headingAtx",resolve:fie,tokenize:hie};function fie(e,t){let n=e.length-2,a=3,r,i;if(e[a][1].type===k.whitespace)a+=2;if(n-2>a&&e[n][1].type===k.whitespace)n-=2;if(e[n][1].type===k.atxHeadingSequence&&(a===n-1||n-4>a&&e[n-2][1].type===k.whitespace))n-=a+1===n?2:4;if(n>a)r={type:k.atxHeadingText,start:e[a][1].start,end:e[n][1].end},i={type:k.chunkText,start:e[a][1].start,end:e[n][1].end,contentType:J.contentTypeText},gt(e,a,n-a+1,[["enter",r,t],["enter",i,t],["exit",i,t],["exit",r,t]]);return e}function hie(e,t,n){let a=0;return r;function r(l){return e.enter(k.atxHeading),i(l)}function i(l){return L(l===f.numberSign,"expected `#`"),e.enter(k.atxHeadingSequence),o(l)}function o(l){if(l===f.numberSign&&a++<J.atxHeadingOpeningFenceSizeMax)return e.consume(l),o;if(l===f.eof||je(l))return e.exit(k.atxHeadingSequence),s(l);return n(l)}function s(l){if(l===f.numberSign)return e.enter(k.atxHeadingSequence),c(l);if(l===f.eof||ne(l))return e.exit(k.atxHeading),t(l);if(fe(l))return we(e,s,k.whitespace)(l);return e.enter(k.atxHeadingText),A(l)}function c(l){if(l===f.numberSign)return e.consume(l),c;return e.exit(k.atxHeadingSequence),s(l)}function A(l){if(l===f.eof||l===f.numberSign||je(l))return e.exit(k.atxHeadingText),s(l);return e.consume(l),A}}var B1=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],oh=["pre","script","style","textarea"];var sh={concrete:!0,name:"htmlFlow",resolveTo:kie,tokenize:Bie},yie={partial:!0,tokenize:_ie},wie={partial:!0,tokenize:Cie};function kie(e){let t=e.length;while(t--)if(e[t][0]==="enter"&&e[t][1].type===k.htmlFlow)break;if(t>1&&e[t-2][1].type===k.linePrefix)e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2);return e}function Bie(e,t,n){let a=this,r,i,o,s,c;return A;function A(N){return l(N)}function l(N){return L(N===f.lessThan,"expected `<`"),e.enter(k.htmlFlow),e.enter(k.htmlFlowData),e.consume(N),d}function d(N){if(N===f.exclamationMark)return e.consume(N),u;if(N===f.slash)return e.consume(N),i=!0,b;if(N===f.questionMark)return e.consume(N),r=J.htmlInstruction,a.interrupt?t:q;if(vt(N))return L(N!==null),e.consume(N),o=String.fromCharCode(N),y;return n(N)}function u(N){if(N===f.dash)return e.consume(N),r=J.htmlComment,p;if(N===f.leftSquareBracket)return e.consume(N),r=J.htmlCdata,s=0,g;if(vt(N))return e.consume(N),r=J.htmlDeclaration,a.interrupt?t:q;return n(N)}function p(N){if(N===f.dash)return e.consume(N),a.interrupt?t:q;return n(N)}function g(N){let qt=J.cdataOpeningString;if(N===qt.charCodeAt(s++)){if(e.consume(N),s===qt.length)return a.interrupt?t:ee;return g}return n(N)}function b(N){if(vt(N))return L(N!==null),e.consume(N),o=String.fromCharCode(N),y;return n(N)}function y(N){if(N===f.eof||N===f.slash||N===f.greaterThan||je(N)){let qt=N===f.slash,an=o.toLowerCase();if(!qt&&!i&&oh.includes(an))return r=J.htmlRaw,a.interrupt?t(N):ee(N);if(B1.includes(o.toLowerCase())){if(r=J.htmlBasic,qt)return e.consume(N),w;return a.interrupt?t(N):ee(N)}return r=J.htmlComplete,a.interrupt&&!a.parser.lazy[a.now().line]?n(N):i?E(N):C(N)}if(N===f.dash||Qt(N))return e.consume(N),o+=String.fromCharCode(N),y;return n(N)}function w(N){if(N===f.greaterThan)return e.consume(N),a.interrupt?t:ee;return n(N)}function E(N){if(fe(N))return e.consume(N),E;return z(N)}function C(N){if(N===f.slash)return e.consume(N),z;if(N===f.colon||N===f.underscore||vt(N))return e.consume(N),D;if(fe(N))return e.consume(N),C;return z(N)}function D(N){if(N===f.dash||N===f.dot||N===f.colon||N===f.underscore||Qt(N))return e.consume(N),D;return F(N)}function F(N){if(N===f.equalsTo)return e.consume(N),I;if(fe(N))return e.consume(N),F;return C(N)}function I(N){if(N===f.eof||N===f.lessThan||N===f.equalsTo||N===f.greaterThan||N===f.graveAccent)return n(N);if(N===f.quotationMark||N===f.apostrophe)return e.consume(N),c=N,P;if(fe(N))return e.consume(N),I;return G(N)}function P(N){if(N===c)return e.consume(N),c=null,W;if(N===f.eof||ne(N))return n(N);return e.consume(N),P}function G(N){if(N===f.eof||N===f.quotationMark||N===f.apostrophe||N===f.slash||N===f.lessThan||N===f.equalsTo||N===f.greaterThan||N===f.graveAccent||je(N))return F(N);return e.consume(N),G}function W(N){if(N===f.slash||N===f.greaterThan||fe(N))return C(N);return n(N)}function z(N){if(N===f.greaterThan)return e.consume(N),ye;return n(N)}function ye(N){if(N===f.eof||ne(N))return ee(N);if(fe(N))return e.consume(N),ye;return n(N)}function ee(N){if(N===f.dash&&r===J.htmlComment)return e.consume(N),Ne;if(N===f.lessThan&&r===J.htmlRaw)return e.consume(N),et;if(N===f.greaterThan&&r===J.htmlDeclaration)return e.consume(N),mt;if(N===f.questionMark&&r===J.htmlInstruction)return e.consume(N),q;if(N===f.rightSquareBracket&&r===J.htmlCdata)return e.consume(N),nn;if(ne(N)&&(r===J.htmlBasic||r===J.htmlComplete))return e.exit(k.htmlFlowData),e.check(yie,dt,ce)(N);if(N===f.eof||ne(N))return e.exit(k.htmlFlowData),ce(N);return e.consume(N),ee}function ce(N){return e.check(wie,de,dt)(N)}function de(N){return L(ne(N)),e.enter(k.lineEnding),e.consume(N),e.exit(k.lineEnding),be}function be(N){if(N===f.eof||ne(N))return ce(N);return e.enter(k.htmlFlowData),ee(N)}function Ne(N){if(N===f.dash)return e.consume(N),q;return ee(N)}function et(N){if(N===f.slash)return e.consume(N),o="",_t;return ee(N)}function _t(N){if(N===f.greaterThan){let qt=o.toLowerCase();if(oh.includes(qt))return e.consume(N),mt;return ee(N)}if(vt(N)&&o.length<J.htmlRawSizeMax)return L(N!==null),e.consume(N),o+=String.fromCharCode(N),_t;return ee(N)}function nn(N){if(N===f.rightSquareBracket)return e.consume(N),q;return ee(N)}function q(N){if(N===f.greaterThan)return e.consume(N),mt;if(N===f.dash&&r===J.htmlComment)return e.consume(N),q;return ee(N)}function mt(N){if(N===f.eof||ne(N))return e.exit(k.htmlFlowData),dt(N);return e.consume(N),mt}function dt(N){return e.exit(k.htmlFlow),t(N)}}function Cie(e,t,n){let a=this;return r;function r(o){if(ne(o))return e.enter(k.lineEnding),e.consume(o),e.exit(k.lineEnding),i;return n(o)}function i(o){return a.parser.lazy[a.now().line]?n(o):t(o)}}function _ie(e,t,n){return a;function a(r){return L(ne(r),"expected a line ending"),e.enter(k.lineEnding),e.consume(r),e.exit(k.lineEnding),e.attempt(wa,t,n)}}var ch={name:"htmlText",tokenize:Eie};function Eie(e,t,n){let a=this,r,i,o;return s;function s(q){return L(q===f.lessThan,"expected `<`"),e.enter(k.htmlText),e.enter(k.htmlTextData),e.consume(q),c}function c(q){if(q===f.exclamationMark)return e.consume(q),A;if(q===f.slash)return e.consume(q),F;if(q===f.questionMark)return e.consume(q),C;if(vt(q))return e.consume(q),G;return n(q)}function A(q){if(q===f.dash)return e.consume(q),l;if(q===f.leftSquareBracket)return e.consume(q),i=0,g;if(vt(q))return e.consume(q),E;return n(q)}function l(q){if(q===f.dash)return e.consume(q),p;return n(q)}function d(q){if(q===f.eof)return n(q);if(q===f.dash)return e.consume(q),u;if(ne(q))return o=d,et(q);return e.consume(q),d}function u(q){if(q===f.dash)return e.consume(q),p;return d(q)}function p(q){return q===f.greaterThan?Ne(q):q===f.dash?u(q):d(q)}function g(q){let mt=J.cdataOpeningString;if(q===mt.charCodeAt(i++))return e.consume(q),i===mt.length?b:g;return n(q)}function b(q){if(q===f.eof)return n(q);if(q===f.rightSquareBracket)return e.consume(q),y;if(ne(q))return o=b,et(q);return e.consume(q),b}function y(q){if(q===f.rightSquareBracket)return e.consume(q),w;return b(q)}function w(q){if(q===f.greaterThan)return Ne(q);if(q===f.rightSquareBracket)return e.consume(q),w;return b(q)}function E(q){if(q===f.eof||q===f.greaterThan)return Ne(q);if(ne(q))return o=E,et(q);return e.consume(q),E}function C(q){if(q===f.eof)return n(q);if(q===f.questionMark)return e.consume(q),D;if(ne(q))return o=C,et(q);return e.consume(q),C}function D(q){return q===f.greaterThan?Ne(q):C(q)}function F(q){if(vt(q))return e.consume(q),I;return n(q)}function I(q){if(q===f.dash||Qt(q))return e.consume(q),I;return P(q)}function P(q){if(ne(q))return o=P,et(q);if(fe(q))return e.consume(q),P;return Ne(q)}function G(q){if(q===f.dash||Qt(q))return e.consume(q),G;if(q===f.slash||q===f.greaterThan||je(q))return W(q);return n(q)}function W(q){if(q===f.slash)return e.consume(q),Ne;if(q===f.colon||q===f.underscore||vt(q))return e.consume(q),z;if(ne(q))return o=W,et(q);if(fe(q))return e.consume(q),W;return Ne(q)}function z(q){if(q===f.dash||q===f.dot||q===f.colon||q===f.underscore||Qt(q))return e.consume(q),z;return ye(q)}function ye(q){if(q===f.equalsTo)return e.consume(q),ee;if(ne(q))return o=ye,et(q);if(fe(q))return e.consume(q),ye;return W(q)}function ee(q){if(q===f.eof||q===f.lessThan||q===f.equalsTo||q===f.greaterThan||q===f.graveAccent)return n(q);if(q===f.quotationMark||q===f.apostrophe)return e.consume(q),r=q,ce;if(ne(q))return o=ee,et(q);if(fe(q))return e.consume(q),ee;return e.consume(q),de}function ce(q){if(q===r)return e.consume(q),r=void 0,be;if(q===f.eof)return n(q);if(ne(q))return o=ce,et(q);return e.consume(q),ce}function de(q){if(q===f.eof||q===f.quotationMark||q===f.apostrophe||q===f.lessThan||q===f.equalsTo||q===f.graveAccent)return n(q);if(q===f.slash||q===f.greaterThan||je(q))return W(q);return e.consume(q),de}function be(q){if(q===f.slash||q===f.greaterThan||je(q))return W(q);return n(q)}function Ne(q){if(q===f.greaterThan)return e.consume(q),e.exit(k.htmlTextData),e.exit(k.htmlText),t;return n(q)}function et(q){return L(o,"expected return state"),L(ne(q),"expected eol"),e.exit(k.htmlTextData),e.enter(k.lineEnding),e.consume(q),e.exit(k.lineEnding),_t}function _t(q){return L(a.parser.constructs.disable.null,"expected `disable.null` to be populated"),fe(q)?we(e,nn,k.linePrefix,a.parser.constructs.disable.null.includes("codeIndented")?void 0:J.tabSize)(q):nn(q)}function nn(q){return e.enter(k.htmlTextData),o(q)}}var xi={name:"labelEnd",resolveAll:Iie,resolveTo:Die,tokenize:Fie},vie={tokenize:$ie},Qie={tokenize:Sie},xie={tokenize:Lie};function Iie(e){let t=-1,n=[];while(++t<e.length){let a=e[t][1];if(n.push(e[t]),a.type===k.labelImage||a.type===k.labelLink||a.type===k.labelEnd){let r=a.type===k.labelImage?4:2;a.type=k.data,t+=r}}if(e.length!==n.length)gt(e,0,e.length,n);return e}function Die(e,t){let n=e.length,a=0,r,i,o,s;while(n--)if(r=e[n][1],i){if(r.type===k.link||r.type===k.labelLink&&r._inactive)break;if(e[n][0]==="enter"&&r.type===k.labelLink)r._inactive=!0}else if(o){if(e[n][0]==="enter"&&(r.type===k.labelImage||r.type===k.labelLink)&&!r._balanced){if(i=n,r.type!==k.labelLink){a=2;break}}}else if(r.type===k.labelEnd)o=n;L(i!==void 0,"`open` is supposed to be found"),L(o!==void 0,"`close` is supposed to be found");let c={type:e[i][1].type===k.labelLink?k.link:k.image,start:{...e[i][1].start},end:{...e[e.length-1][1].end}},A={type:k.label,start:{...e[i][1].start},end:{...e[o][1].end}},l={type:k.labelText,start:{...e[i+a+2][1].end},end:{...e[o-2][1].start}};return s=[["enter",c,t],["enter",A,t]],s=Ot(s,e.slice(i+1,i+a+3)),s=Ot(s,[["enter",l,t]]),L(t.parser.constructs.insideSpan.null,"expected `insideSpan.null` to be populated"),s=Ot(s,Dr(t.parser.constructs.insideSpan.null,e.slice(i+a+4,o-3),t)),s=Ot(s,[["exit",l,t],e[o-2],e[o-1],["exit",A,t]]),s=Ot(s,e.slice(o+1)),s=Ot(s,[["exit",c,t]]),gt(e,i,e.length,s),e}function Fie(e,t,n){let a=this,r=a.events.length,i,o;while(r--)if((a.events[r][1].type===k.labelImage||a.events[r][1].type===k.labelLink)&&!a.events[r][1]._balanced){i=a.events[r][1];break}return s;function s(u){if(L(u===f.rightSquareBracket,"expected `]`"),!i)return n(u);if(i._inactive)return d(u);return o=a.parser.defined.includes(zt(a.sliceSerialize({start:i.end,end:a.now()}))),e.enter(k.labelEnd),e.enter(k.labelMarker),e.consume(u),e.exit(k.labelMarker),e.exit(k.labelEnd),c}function c(u){if(u===f.leftParenthesis)return e.attempt(vie,l,o?l:d)(u);if(u===f.leftSquareBracket)return e.attempt(Qie,l,o?A:d)(u);return o?l(u):d(u)}function A(u){return e.attempt(xie,l,d)(u)}function l(u){return t(u)}function d(u){return i._balanced=!0,n(u)}}function $ie(e,t,n){return a;function a(d){return L(d===f.leftParenthesis,"expected left paren"),e.enter(k.resource),e.enter(k.resourceMarker),e.consume(d),e.exit(k.resourceMarker),r}function r(d){return je(d)?Qi(e,i)(d):i(d)}function i(d){if(d===f.rightParenthesis)return l(d);return iu(e,o,s,k.resourceDestination,k.resourceDestinationLiteral,k.resourceDestinationLiteralMarker,k.resourceDestinationRaw,k.resourceDestinationString,J.linkResourceDestinationBalanceMax)(d)}function o(d){return je(d)?Qi(e,c)(d):l(d)}function s(d){return n(d)}function c(d){if(d===f.quotationMark||d===f.apostrophe||d===f.leftParenthesis)return su(e,A,n,k.resourceTitle,k.resourceTitleMarker,k.resourceTitleString)(d);return l(d)}function A(d){return je(d)?Qi(e,l)(d):l(d)}function l(d){if(d===f.rightParenthesis)return e.enter(k.resourceMarker),e.consume(d),e.exit(k.resourceMarker),e.exit(k.resource),t;return n(d)}}function Sie(e,t,n){let a=this;return r;function r(s){return L(s===f.leftSquareBracket,"expected left bracket"),ou.call(a,e,i,o,k.reference,k.referenceMarker,k.referenceString)(s)}function i(s){return a.parser.defined.includes(zt(a.sliceSerialize(a.events[a.events.length-1][1]).slice(1,-1)))?t(s):n(s)}function o(s){return n(s)}}function Lie(e,t,n){return a;function a(i){return L(i===f.leftSquareBracket,"expected left bracket"),e.enter(k.reference),e.enter(k.referenceMarker),e.consume(i),e.exit(k.referenceMarker),r}function r(i){if(i===f.rightSquareBracket)return e.enter(k.referenceMarker),e.consume(i),e.exit(k.referenceMarker),e.exit(k.reference),t;return n(i)}}var Ah={name:"labelStartImage",resolveAll:xi.resolveAll,tokenize:jie};function jie(e,t,n){let a=this;return r;function r(s){return L(s===f.exclamationMark,"expected `!`"),e.enter(k.labelImage),e.enter(k.labelImageMarker),e.consume(s),e.exit(k.labelImageMarker),i}function i(s){if(s===f.leftSquareBracket)return e.enter(k.labelMarker),e.consume(s),e.exit(k.labelMarker),e.exit(k.labelImage),o;return n(s)}function o(s){return s===f.caret&&"_hiddenFootnoteSupport"in a.parser.constructs?n(s):t(s)}}var lh={name:"labelStartLink",resolveAll:xi.resolveAll,tokenize:qie};function qie(e,t,n){let a=this;return r;function r(o){return L(o===f.leftSquareBracket,"expected `[`"),e.enter(k.labelLink),e.enter(k.labelMarker),e.consume(o),e.exit(k.labelMarker),e.exit(k.labelLink),i}function i(o){return o===f.caret&&"_hiddenFootnoteSupport"in a.parser.constructs?n(o):t(o)}}var Tc={name:"lineEnding",tokenize:Nie};function Nie(e,t){return n;function n(a){return L(ne(a),"expected eol"),e.enter(k.lineEnding),e.consume(a),e.exit(k.lineEnding),we(e,t,k.linePrefix)}}var Ii={name:"thematicBreak",tokenize:Mie};function Mie(e,t,n){let a=0,r;return i;function i(A){return e.enter(k.thematicBreak),o(A)}function o(A){return L(A===f.asterisk||A===f.dash||A===f.underscore,"expected `*`, `-`, or `_`"),r=A,s(A)}function s(A){if(A===r)return e.enter(k.thematicBreakSequence),c(A);if(a>=J.thematicBreakMarkerCountMin&&(A===f.eof||ne(A)))return e.exit(k.thematicBreak),t(A);return n(A)}function c(A){if(A===r)return e.consume(A),a++,c;return e.exit(k.thematicBreakSequence),fe(A)?we(e,s,k.whitespace)(A):s(A)}}var Ut={continuation:{tokenize:zie},exit:Hie,name:"list",tokenize:Pie},Gie={partial:!0,tokenize:Tie},Rie={partial:!0,tokenize:Uie};function Pie(e,t,n){let a=this,r=a.events[a.events.length-1],i=r&&r[1].type===k.linePrefix?r[2].sliceSerialize(r[1],!0).length:0,o=0;return s;function s(p){L(a.containerState,"expected state");let g=a.containerState.type||(p===f.asterisk||p===f.plusSign||p===f.dash?k.listUnordered:k.listOrdered);if(g===k.listUnordered?!a.containerState.marker||p===a.containerState.marker:Pc(p)){if(!a.containerState.type)a.containerState.type=g,e.enter(g,{_container:!0});if(g===k.listUnordered)return e.enter(k.listItemPrefix),p===f.asterisk||p===f.dash?e.check(Ii,n,A)(p):A(p);if(!a.interrupt||p===f.digit1)return e.enter(k.listItemPrefix),e.enter(k.listItemValue),c(p)}return n(p)}function c(p){if(L(a.containerState,"expected state"),Pc(p)&&++o<J.listItemValueSizeMax)return e.consume(p),c;if((!a.interrupt||o<2)&&(a.containerState.marker?p===a.containerState.marker:p===f.rightParenthesis||p===f.dot))return e.exit(k.listItemValue),A(p);return n(p)}function A(p){return L(a.containerState,"expected state"),L(p!==f.eof,"eof (`null`) is not a marker"),e.enter(k.listItemMarker),e.consume(p),e.exit(k.listItemMarker),a.containerState.marker=a.containerState.marker||p,e.check(wa,a.interrupt?n:l,e.attempt(Gie,u,d))}function l(p){return L(a.containerState,"expected state"),a.containerState.initialBlankLine=!0,i++,u(p)}function d(p){if(fe(p))return e.enter(k.listItemPrefixWhitespace),e.consume(p),e.exit(k.listItemPrefixWhitespace),u;return n(p)}function u(p){return L(a.containerState,"expected state"),a.containerState.size=i+a.sliceSerialize(e.exit(k.listItemPrefix),!0).length,t(p)}}function zie(e,t,n){let a=this;return L(a.containerState,"expected state"),a.containerState._closeFlow=void 0,e.check(wa,r,i);function r(s){return L(a.containerState,"expected state"),L(typeof a.containerState.size==="number","expected size"),a.containerState.furtherBlankLines=a.containerState.furtherBlankLines||a.containerState.initialBlankLine,we(e,t,k.listItemIndent,a.containerState.size+1)(s)}function i(s){if(L(a.containerState,"expected state"),a.containerState.furtherBlankLines||!fe(s))return a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,o(s);return a.containerState.furtherBlankLines=void 0,a.containerState.initialBlankLine=void 0,e.attempt(Rie,t,o)(s)}function o(s){return L(a.containerState,"expected state"),a.containerState._closeFlow=!0,a.interrupt=void 0,L(a.parser.constructs.disable.null,"expected `disable.null` to be populated"),we(e,e.attempt(Ut,t,n),k.linePrefix,a.parser.constructs.disable.null.includes("codeIndented")?void 0:J.tabSize)(s)}}function Uie(e,t,n){let a=this;return L(a.containerState,"expected state"),L(typeof a.containerState.size==="number","expected size"),we(e,r,k.listItemIndent,a.containerState.size+1);function r(i){L(a.containerState,"expected state");let o=a.events[a.events.length-1];return o&&o[1].type===k.listItemIndent&&o[2].sliceSerialize(o[1],!0).length===a.containerState.size?t(i):n(i)}}function Hie(e){L(this.containerState,"expected state"),L(typeof this.containerState.type==="string","expected type"),e.exit(this.containerState.type)}function Tie(e,t,n){let a=this;return L(a.parser.constructs.disable.null,"expected `disable.null` to be populated"),we(e,r,k.listItemPrefixWhitespace,a.parser.constructs.disable.null.includes("codeIndented")?void 0:J.tabSize+1);function r(i){let o=a.events[a.events.length-1];return!fe(i)&&o&&o[1].type===k.listItemPrefixWhitespace?t(i):n(i)}}var cu={name:"setextUnderline",resolveTo:Oie,tokenize:Zie};function Oie(e,t){let n=e.length,a,r,i;while(n--)if(e[n][0]==="enter"){if(e[n][1].type===k.content){a=n;break}if(e[n][1].type===k.paragraph)r=n}else{if(e[n][1].type===k.content)e.splice(n,1);if(!i&&e[n][1].type===k.definition)i=n}L(r!==void 0,"expected a `text` index to be found"),L(a!==void 0,"expected a `text` index to be found"),L(e[a][2]===t,"enter context should be same"),L(e[e.length-1][2]===t,"enter context should be same");let o={type:k.setextHeading,start:{...e[a][1].start},end:{...e[e.length-1][1].end}};if(e[r][1].type=k.setextHeadingText,i)e.splice(r,0,["enter",o,t]),e.splice(i+1,0,["exit",e[a][1],t]),e[a][1].end={...e[i][1].end};else e[a][1]=o;return e.push(["exit",o,t]),e}function Zie(e,t,n){let a=this,r;return i;function i(A){let l=a.events.length,d;L(A===f.dash||A===f.equalsTo,"expected `=` or `-`");while(l--)if(a.events[l][1].type!==k.lineEnding&&a.events[l][1].type!==k.linePrefix&&a.events[l][1].type!==k.content){d=a.events[l][1].type===k.paragraph;break}if(!a.parser.lazy[a.now().line]&&(a.interrupt||d))return e.enter(k.setextHeadingLine),r=A,o(A);return n(A)}function o(A){return e.enter(k.setextHeadingLineSequence),s(A)}function s(A){if(A===r)return e.consume(A),s;return e.exit(k.setextHeadingLineSequence),fe(A)?we(e,c,k.lineSuffix)(A):c(A)}function c(A){if(A===f.eof||ne(A))return e.exit(k.setextHeadingLine),t(A);return n(A)}}var C1={tokenize:Yie};function Yie(e){let t=this,n=e.attempt(wa,a,e.attempt(this.parser.constructs.flowInitial,r,we(e,e.attempt(this.parser.constructs.flow,r,e.attempt(nh,r)),k.linePrefix)));return n;function a(i){if(L(i===f.eof||ne(i),"expected eol or eof"),i===f.eof){e.consume(i);return}return e.enter(k.lineEndingBlank),e.consume(i),e.exit(k.lineEndingBlank),t.currentConstruct=void 0,n}function r(i){if(L(i===f.eof||ne(i),"expected eol or eof"),i===f.eof){e.consume(i);return}return e.enter(k.lineEnding),e.consume(i),e.exit(k.lineEnding),t.currentConstruct=void 0,n}}var _1={resolveAll:x1()},E1=Q1("string"),v1=Q1("text");function Q1(e){return{resolveAll:x1(e==="text"?Kie:void 0),tokenize:t};function t(n){let a=this,r=this.parser.constructs[e],i=n.attempt(r,o,s);return o;function o(l){return A(l)?i(l):s(l)}function s(l){if(l===f.eof){n.consume(l);return}return n.enter(k.data),n.consume(l),c}function c(l){if(A(l))return n.exit(k.data),i(l);return n.consume(l),c}function A(l){if(l===f.eof)return!0;let d=r[l],u=-1;if(d){L(Array.isArray(d),"expected `disable.null` to be populated");while(++u<d.length){let p=d[u];if(!p.previous||p.previous.call(a,a.previous))return!0}}return!1}}}function x1(e){return t;function t(n,a){let r=-1,i;while(++r<=n.length)if(i===void 0){if(n[r]&&n[r][1].type===k.data)i=r,r++}else if(!n[r]||n[r][1].type!==k.data){if(r!==i+2)n[i][1].end=n[r-1][1].end,n.splice(i+2,r-i-2),r=i+2;i=void 0}return e?e(n,a):n}}function Kie(e,t){let n=0;while(++n<=e.length)if((n===e.length||e[n][1].type===k.lineEnding)&&e[n-1][1].type===k.data){let a=e[n-1][1],r=t.sliceStream(a),i=r.length,o=-1,s=0,c;while(i--){let A=r[i];if(typeof A==="string"){o=A.length;while(A.charCodeAt(o-1)===f.space)s++,o--;if(o)break;o=-1}else if(A===f.horizontalTab)c=!0,s++;else if(A===f.virtualSpace);else{i++;break}}if(s){let A={type:n===e.length||c||s<J.hardBreakPrefixSizeMin?k.lineSuffix:k.hardBreakTrailing,start:{_bufferIndex:i?o:a.start._bufferIndex+o,_index:a.start._index+i,line:a.end.line,column:a.end.column-s,offset:a.end.offset-s},end:{...a.end}};if(a.end={...A.start},a.start.offset===a.end.offset)Object.assign(a,A);else e.splice(n,0,["enter",A,t],["exit",A,t]),n+=2}n++}return e}var dh={};Q(dh,{text:()=>toe,string:()=>eoe,insideSpan:()=>noe,flowInitial:()=>Vie,flow:()=>Xie,document:()=>Wie,disable:()=>roe,contentInitial:()=>Jie,attentionMarkers:()=>aoe});var Wie={[f.asterisk]:Ut,[f.plusSign]:Ut,[f.dash]:Ut,[f.digit0]:Ut,[f.digit1]:Ut,[f.digit2]:Ut,[f.digit3]:Ut,[f.digit4]:Ut,[f.digit5]:Ut,[f.digit6]:Ut,[f.digit7]:Ut,[f.digit8]:Ut,[f.digit9]:Ut,[f.greaterThan]:eu},Jie={[f.leftSquareBracket]:ah},Vie={[f.horizontalTab]:Uc,[f.virtualSpace]:Uc,[f.space]:Uc},Xie={[f.numberSign]:ih,[f.asterisk]:Ii,[f.dash]:[cu,Ii],[f.lessThan]:sh,[f.equalsTo]:cu,[f.underscore]:Ii,[f.graveAccent]:au,[f.tilde]:au},eoe={[f.ampersand]:nu,[f.backslash]:tu},toe={[f.carriageReturn]:Tc,[f.lineFeed]:Tc,[f.carriageReturnLineFeed]:Tc,[f.exclamationMark]:Ah,[f.ampersand]:nu,[f.asterisk]:zc,[f.lessThan]:[Xf,ch],[f.leftSquareBracket]:lh,[f.backslash]:[rh,tu],[f.rightSquareBracket]:xi,[f.underscore]:zc,[f.graveAccent]:eh},noe={null:[zc,_1]},aoe={null:[f.asterisk,f.underscore]},roe={null:[]};var H1=gc(U1(),1);var $i=H1.default("micromark");function T1(e,t,n){let a={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},r={},i=[],o=[],s=[],c=!0,A={attempt:W(P),check:W(G),consume:D,enter:F,exit:I,interrupt:W(G,{interrupt:!0})},l={code:f.eof,containerState:{},defineSkip:w,events:[],now:y,parser:e,previous:f.eof,sliceSerialize:g,sliceStream:b,write:p},d=t.tokenize.call(l,A),u;if(t.resolveAll)i.push(t);return l;function p(ce){if(o=Ot(o,ce),E(),o[o.length-1]!==f.eof)return[];return z(t,0),l.events=Dr(i,l.events,l),l.events}function g(ce,de){return zoe(b(ce),de)}function b(ce){return Poe(o,ce)}function y(){let{_bufferIndex:ce,_index:de,line:be,column:Ne,offset:et}=a;return{_bufferIndex:ce,_index:de,line:be,column:Ne,offset:et}}function w(ce){r[ce.line]=ce.column,ee(),$i("position: define skip: `%j`",a)}function E(){let ce;while(a._index<o.length){let de=o[a._index];if(typeof de==="string"){if(ce=a._index,a._bufferIndex<0)a._bufferIndex=0;while(a._index===ce&&a._bufferIndex<de.length)C(de.charCodeAt(a._bufferIndex))}else C(de)}}function C(ce){L(c===!0,"expected character to be consumed"),c=void 0,$i("main: passing `%s` to %s",ce,d&&d.name),u=ce,L(typeof d==="function","expected state"),d=d(ce)}function D(ce){if(L(ce===u,"expected given code to equal expected code"),$i("consume: `%s`",ce),L(c===void 0,"expected code to not have been consumed: this might be because `return x(code)` instead of `return x` was used"),L(ce===null?l.events.length===0||l.events[l.events.length-1][0]==="exit":l.events[l.events.length-1][0]==="enter","expected last token to be open"),ne(ce))a.line++,a.column=1,a.offset+=ce===f.carriageReturnLineFeed?2:1,ee(),$i("position: after eol: `%j`",a);else if(ce!==f.virtualSpace)a.column++,a.offset++;if(a._bufferIndex<0)a._index++;else if(a._bufferIndex++,a._bufferIndex===o[a._index].length)a._bufferIndex=-1,a._index++;l.previous=ce,c=!0}function F(ce,de){let be=de||{};return be.type=ce,be.start=y(),L(typeof ce==="string","expected string type"),L(ce.length>0,"expected non-empty string"),$i("enter: `%s`",ce),l.events.push(["enter",be,l]),s.push(be),be}function I(ce){L(typeof ce==="string","expected string type"),L(ce.length>0,"expected non-empty string");let de=s.pop();return L(de,"cannot close w/o open tokens"),de.end=y(),L(ce===de.type,"expected exit token to match current token"),L(!(de.start._index===de.end._index&&de.start._bufferIndex===de.end._bufferIndex),"expected non-empty token (`"+ce+"`)"),$i("exit: `%s`",de.type),l.events.push(["exit",de,l]),de}function P(ce,de){z(ce,de.from)}function G(ce,de){de.restore()}function W(ce,de){return be;function be(Ne,et,_t){let nn,q,mt,dt;return Array.isArray(Ne)?qt(Ne):("tokenize"in Ne)?qt([Ne]):N(Ne);function N(tt){return ga;function ga(rn){let Ga=rn!==null&&tt[rn],hr=rn!==null&&tt.null,Ac=[...Array.isArray(Ga)?Ga:Ga?[Ga]:[],...Array.isArray(hr)?hr:hr?[hr]:[]];return qt(Ac)(rn)}}function qt(tt){if(nn=tt,q=0,tt.length===0)return L(_t,"expected `bogusState` to be given"),_t;return an(tt[q])}function an(tt){return ga;function ga(rn){if(dt=ye(),mt=tt,!tt.partial)l.currentConstruct=tt;if(L(l.parser.constructs.disable.null,"expected `disable.null` to be populated"),tt.name&&l.parser.constructs.disable.null.includes(tt.name))return Yn(rn);return tt.tokenize.call(de?Object.assign(Object.create(l),de):l,A,ko,Yn)(rn)}}function ko(tt){return L(tt===u,"expected code"),c=!0,ce(mt,dt),et}function Yn(tt){if(L(tt===u,"expected code"),c=!0,dt.restore(),++q<nn.length)return an(nn[q]);return _t}}}function z(ce,de){if(ce.resolveAll&&!i.includes(ce))i.push(ce);if(ce.resolve)gt(l.events,de,l.events.length-de,ce.resolve(l.events.slice(de),l));if(ce.resolveTo)l.events=ce.resolveTo(l.events,l);L(ce.partial||l.events.length===0||l.events[l.events.length-1][0]==="exit","expected last token to end")}function ye(){let ce=y(),de=l.previous,be=l.currentConstruct,Ne=l.events.length,et=Array.from(s);return{from:Ne,restore:_t};function _t(){a=ce,l.previous=de,l.currentConstruct=be,l.events.length=Ne,s=et,ee(),$i("position: restore: `%j`",a)}}function ee(){if(a.line in r&&a.column<2)a.column=r[a.line],a.offset+=r[a.line]-1}}function Poe(e,t){let n=t.start._index,a=t.start._bufferIndex,r=t.end._index,i=t.end._bufferIndex,o;if(n===r)L(i>-1,"expected non-negative end buffer index"),L(a>-1,"expected non-negative start buffer index"),o=[e[n].slice(a,i)];else{if(o=e.slice(n,r),a>-1){let s=o[0];if(typeof s==="string")o[0]=s.slice(a);else L(a===0,"expected `startBufferIndex` to be `0`"),o.shift()}if(i>0)o.push(e[r].slice(0,i))}return o}function zoe(e,t){let n=-1,a=[],r;while(++n<e.length){let i=e[n],o;if(typeof i==="string")o=i;else switch(i){case f.carriageReturn:{o=_n.cr;break}case f.lineFeed:{o=_n.lf;break}case f.carriageReturnLineFeed:{o=_n.cr+_n.lf;break}case f.horizontalTab:{o=t?_n.space:_n.ht;break}case f.virtualSpace:{if(!t&&r)continue;o=_n.space;break}default:L(typeof i==="number","expected number"),o=String.fromCharCode(i)}r=i===f.horizontalTab,a.push(o)}return a.join("")}function bh(e){let a={constructs:Vd([dh,...(e||{}).extensions||[]]),content:r(b1),defined:[],document:r(h1),flow:r(C1),lazy:{},string:r(E1),text:r(v1)};return a;function r(i){return o;function o(s){return T1(a,i,s)}}}function fh(e){while(!ru(e));return e}var O1=/[\0\t\n\r]/g;function hh(){let e=1,t="",n=!0,a;return r;function r(i,o,s){let c=[],A,l,d,u,p;if(i=t+(typeof i==="string"?i.toString():new TextDecoder(o||void 0).decode(i)),d=0,t="",n){if(i.charCodeAt(0)===f.byteOrderMarker)d++;n=void 0}while(d<i.length){if(O1.lastIndex=d,A=O1.exec(i),u=A&&A.index!==void 0?A.index:i.length,p=i.charCodeAt(u),!A){t=i.slice(d);break}if(p===f.lf&&d===u&&a)c.push(f.carriageReturnLineFeed),a=void 0;else{if(a)c.push(f.carriageReturn),a=void 0;if(d<u)c.push(i.slice(d,u)),e+=u-d;switch(p){case f.nul:{c.push(f.replacementCharacter),e++;break}case f.ht:{l=Math.ceil(e/J.tabSize)*J.tabSize,c.push(f.horizontalTab);while(e++<l)c.push(f.virtualSpace);break}case f.lf:{c.push(f.lineFeed),e=1;break}default:a=!0,e=1}}d=u+1}if(s){if(a)c.push(f.carriageReturn);if(t)c.push(t);c.push(f.eof)}return c}}var Uoe=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function Z1(e){return e.replace(Uoe,Hoe)}function Hoe(e,t,n){if(t)return t;if(n.charCodeAt(0)===f.numberSign){let r=n.charCodeAt(1),i=r===f.lowercaseX||r===f.uppercaseX;return Xd(n.slice(i?2:1),i?J.numericBaseHexadecimal:J.numericBaseDecimal)}return qo(n)||e}function Po(e){if(!e||typeof e!=="object")return"";if("position"in e||"type"in e)return Y1(e.position);if("start"in e||"end"in e)return Y1(e);if("line"in e||"column"in e)return yh(e);return""}function yh(e){return K1(e&&e.line)+":"+K1(e&&e.column)}function Y1(e){return yh(e&&e.start)+"-"+yh(e&&e.end)}function K1(e){return e&&typeof e==="number"?e:1}var J1={}.hasOwnProperty;function wh(e,t,n){if(typeof t!=="string")n=t,t=void 0;return Toe(n)(fh(bh(n).document().write(hh()(e,t,!0))))}function Toe(e){let t={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:i(mi),autolinkProtocol:W,autolinkEmail:W,atxHeading:i(dc),blockQuote:i(rn),characterEscape:W,characterReference:W,codeFenced:i(Ga),codeFencedFenceInfo:o,codeFencedFenceMeta:o,codeIndented:i(Ga,o),codeText:i(hr,o),codeTextData:W,data:W,codeFlowValue:W,definition:i(Ac),definitionDestinationString:o,definitionLabelString:o,definitionTitleString:o,emphasis:i(lc),hardBreakEscape:i(uc),hardBreakTrailing:i(uc),htmlFlow:i(Bo,o),htmlFlowData:W,htmlText:i(Bo,o),htmlTextData:W,image:i(Co),label:o,link:i(mi),listItem:i(EY),listItemValue:u,listOrdered:i(wx,d),listUnordered:i(wx),paragraph:i(vY),reference:N,referenceString:o,resourceDestinationString:o,resourceTitleString:o,setextHeading:i(dc),strong:i(QY),thematicBreak:i(IY)},exit:{atxHeading:c(),atxHeadingSequence:F,autolink:c(),autolinkEmail:ga,autolinkProtocol:tt,blockQuote:c(),characterEscapeValue:z,characterReferenceMarkerHexadecimal:an,characterReferenceMarkerNumeric:an,characterReferenceValue:ko,characterReference:Yn,codeFenced:c(y),codeFencedFence:b,codeFencedFenceInfo:p,codeFencedFenceMeta:g,codeFlowValue:z,codeIndented:c(w),codeText:c(be),codeTextData:z,data:z,definition:c(),definitionDestinationString:D,definitionLabelString:E,definitionTitleString:C,emphasis:c(),hardBreakEscape:c(ee),hardBreakTrailing:c(ee),htmlFlow:c(ce),htmlFlowData:z,htmlText:c(de),htmlTextData:z,image:c(et),label:nn,labelText:_t,lineEnding:ye,link:c(Ne),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:qt,resourceDestinationString:q,resourceTitleString:mt,resource:dt,setextHeading:c(G),setextHeadingLineSequence:P,setextHeadingText:I,strong:c(),thematicBreak:c()}};V1(t,(e||{}).mdastExtensions||[]);let n={};return a;function a(Z){let Y={type:"root",children:[]},ge={stack:[Y],tokenStack:[],config:t,enter:s,exit:A,buffer:o,resume:l,data:n},Le=[],Te=-1;while(++Te<Z.length)if(Z[Te][1].type===k.listOrdered||Z[Te][1].type===k.listUnordered)if(Z[Te][0]==="enter")Le.push(Te);else{let on=Le.pop();L(typeof on==="number","expected list ot be open"),Te=r(Z,on,Te)}Te=-1;while(++Te<Z.length){let on=t[Z[Te][0]];if(J1.call(on,Z[Te][1].type))on[Z[Te][1].type].call(Object.assign({sliceSerialize:Z[Te][2].sliceSerialize},ge),Z[Te][1])}if(ge.tokenStack.length>0){let on=ge.tokenStack[ge.tokenStack.length-1];(on[1]||W1).call(ge,void 0,on[0])}Y.position={start:$r(Z.length>0?Z[0][1].start:{line:1,column:1,offset:0}),end:$r(Z.length>0?Z[Z.length-2][1].end:{line:1,column:1,offset:0})},Te=-1;while(++Te<t.transforms.length)Y=t.transforms[Te](Y)||Y;return Y}function r(Z,Y,ge){let Le=Y-1,Te=-1,on=!1,gi,Ra,pc,mc;while(++Le<=ge){let Cn=Z[Le];switch(Cn[1].type){case k.listUnordered:case k.listOrdered:case k.blockQuote:{if(Cn[0]==="enter")Te++;else Te--;mc=void 0;break}case k.lineEndingBlank:{if(Cn[0]==="enter"){if(gi&&!mc&&!Te&&!pc)pc=Le;mc=void 0}break}case k.linePrefix:case k.listItemValue:case k.listItemMarker:case k.listItemPrefix:case k.listItemPrefixWhitespace:break;default:mc=void 0}if(!Te&&Cn[0]==="enter"&&Cn[1].type===k.listItemPrefix||Te===-1&&Cn[0]==="exit"&&(Cn[1].type===k.listUnordered||Cn[1].type===k.listOrdered)){if(gi){let _o=Le;Ra=void 0;while(_o--){let Pa=Z[_o];if(Pa[1].type===k.lineEnding||Pa[1].type===k.lineEndingBlank){if(Pa[0]==="exit")continue;if(Ra)Z[Ra][1].type=k.lineEndingBlank,on=!0;Pa[1].type=k.lineEnding,Ra=_o}else if(Pa[1].type===k.linePrefix||Pa[1].type===k.blockQuotePrefix||Pa[1].type===k.blockQuotePrefixWhitespace||Pa[1].type===k.blockQuoteMarker||Pa[1].type===k.listItemIndent);else break}if(pc&&(!Ra||pc<Ra))gi._spread=!0;gi.end=Object.assign({},Ra?Z[Ra][1].start:Cn[1].end),Z.splice(Ra||Le,0,["exit",gi,Cn[2]]),Le++,ge++}if(Cn[1].type===k.listItemPrefix){let _o={type:"listItem",_spread:!1,start:Object.assign({},Cn[1].start),end:void 0};gi=_o,Z.splice(Le,0,["enter",_o,Cn[2]]),Le++,ge++,pc=void 0,mc=!0}}}return Z[Y][1]._spread=on,ge}function i(Z,Y){return ge;function ge(Le){if(s.call(this,Z(Le),Le),Y)Y.call(this,Le)}}function o(){this.stack.push({type:"fragment",children:[]})}function s(Z,Y,ge){let Le=this.stack[this.stack.length-1];L(Le,"expected `parent`"),L("children"in Le,"expected `parent`"),Le.children.push(Z),this.stack.push(Z),this.tokenStack.push([Y,ge||void 0]),Z.position={start:$r(Y.start),end:void 0}}function c(Z){return Y;function Y(ge){if(Z)Z.call(this,ge);A.call(this,ge)}}function A(Z,Y){let ge=this.stack.pop();L(ge,"expected `node`");let Le=this.tokenStack.pop();if(!Le)throw Error("Cannot close `"+Z.type+"` ("+Po({start:Z.start,end:Z.end})+"): it\u2019s not open");else if(Le[0].type!==Z.type)if(Y)Y.call(this,Z,Le[0]);else(Le[1]||W1).call(this,Z,Le[0]);L(ge.type!=="fragment","unexpected fragment `exit`ed"),L(ge.position,"expected `position` to be defined"),ge.position.end=$r(Z.end)}function l(){return Jf(this.stack.pop())}function d(){this.data.expectingFirstListItemValue=!0}function u(Z){if(this.data.expectingFirstListItemValue){let Y=this.stack[this.stack.length-2];L(Y,"expected nodes on stack"),L(Y.type==="list","expected list on stack"),Y.start=Number.parseInt(this.sliceSerialize(Z),J.numericBaseDecimal),this.data.expectingFirstListItemValue=void 0}}function p(){let Z=this.resume(),Y=this.stack[this.stack.length-1];L(Y,"expected node on stack"),L(Y.type==="code","expected code on stack"),Y.lang=Z}function g(){let Z=this.resume(),Y=this.stack[this.stack.length-1];L(Y,"expected node on stack"),L(Y.type==="code","expected code on stack"),Y.meta=Z}function b(){if(this.data.flowCodeInside)return;this.buffer(),this.data.flowCodeInside=!0}function y(){let Z=this.resume(),Y=this.stack[this.stack.length-1];L(Y,"expected node on stack"),L(Y.type==="code","expected code on stack"),Y.value=Z.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,""),this.data.flowCodeInside=void 0}function w(){let Z=this.resume(),Y=this.stack[this.stack.length-1];L(Y,"expected node on stack"),L(Y.type==="code","expected code on stack"),Y.value=Z.replace(/(\r?\n|\r)$/g,"")}function E(Z){let Y=this.resume(),ge=this.stack[this.stack.length-1];L(ge,"expected node on stack"),L(ge.type==="definition","expected definition on stack"),ge.label=Y,ge.identifier=zt(this.sliceSerialize(Z)).toLowerCase()}function C(){let Z=this.resume(),Y=this.stack[this.stack.length-1];L(Y,"expected node on stack"),L(Y.type==="definition","expected definition on stack"),Y.title=Z}function D(){let Z=this.resume(),Y=this.stack[this.stack.length-1];L(Y,"expected node on stack"),L(Y.type==="definition","expected definition on stack"),Y.url=Z}function F(Z){let Y=this.stack[this.stack.length-1];if(L(Y,"expected node on stack"),L(Y.type==="heading","expected heading on stack"),!Y.depth){let ge=this.sliceSerialize(Z).length;L(ge===1||ge===2||ge===3||ge===4||ge===5||ge===6,"expected `depth` between `1` and `6`"),Y.depth=ge}}function I(){this.data.setextHeadingSlurpLineEnding=!0}function P(Z){let Y=this.stack[this.stack.length-1];L(Y,"expected node on stack"),L(Y.type==="heading","expected heading on stack"),Y.depth=this.sliceSerialize(Z).codePointAt(0)===f.equalsTo?1:2}function G(){this.data.setextHeadingSlurpLineEnding=void 0}function W(Z){let Y=this.stack[this.stack.length-1];L(Y,"expected node on stack"),L("children"in Y,"expected parent on stack");let ge=Y.children,Le=ge[ge.length-1];if(!Le||Le.type!=="text")Le=xY(),Le.position={start:$r(Z.start),end:void 0},ge.push(Le);this.stack.push(Le)}function z(Z){let Y=this.stack.pop();L(Y,"expected a `node` to be on the stack"),L("value"in Y,"expected a `literal` to be on the stack"),L(Y.position,"expected `node` to have an open position"),Y.value+=this.sliceSerialize(Z),Y.position.end=$r(Z.end)}function ye(Z){let Y=this.stack[this.stack.length-1];if(L(Y,"expected `node`"),this.data.atHardBreak){L("children"in Y,"expected `parent`");let ge=Y.children[Y.children.length-1];L(ge.position,"expected tail to have a starting position"),ge.position.end=$r(Z.end),this.data.atHardBreak=void 0;return}if(!this.data.setextHeadingSlurpLineEnding&&t.canContainEols.includes(Y.type))W.call(this,Z),z.call(this,Z)}function ee(){this.data.atHardBreak=!0}function ce(){let Z=this.resume(),Y=this.stack[this.stack.length-1];L(Y,"expected node on stack"),L(Y.type==="html","expected html on stack"),Y.value=Z}function de(){let Z=this.resume(),Y=this.stack[this.stack.length-1];L(Y,"expected node on stack"),L(Y.type==="html","expected html on stack"),Y.value=Z}function be(){let Z=this.resume(),Y=this.stack[this.stack.length-1];L(Y,"expected node on stack"),L(Y.type==="inlineCode","expected inline code on stack"),Y.value=Z}function Ne(){let Z=this.stack[this.stack.length-1];if(L(Z,"expected node on stack"),L(Z.type==="link","expected link on stack"),this.data.inReference){let Y=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=Y,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function et(){let Z=this.stack[this.stack.length-1];if(L(Z,"expected node on stack"),L(Z.type==="image","expected image on stack"),this.data.inReference){let Y=this.data.referenceType||"shortcut";Z.type+="Reference",Z.referenceType=Y,delete Z.url,delete Z.title}else delete Z.identifier,delete Z.label;this.data.referenceType=void 0}function _t(Z){let Y=this.sliceSerialize(Z),ge=this.stack[this.stack.length-2];L(ge,"expected ancestor on stack"),L(ge.type==="image"||ge.type==="link","expected image or link on stack"),ge.label=Z1(Y),ge.identifier=zt(Y).toLowerCase()}function nn(){let Z=this.stack[this.stack.length-1];L(Z,"expected node on stack"),L(Z.type==="fragment","expected fragment on stack");let Y=this.resume(),ge=this.stack[this.stack.length-1];if(L(ge,"expected node on stack"),L(ge.type==="image"||ge.type==="link","expected image or link on stack"),this.data.inReference=!0,ge.type==="link"){let Le=Z.children;ge.children=Le}else ge.alt=Y}function q(){let Z=this.resume(),Y=this.stack[this.stack.length-1];L(Y,"expected node on stack"),L(Y.type==="image"||Y.type==="link","expected image or link on stack"),Y.url=Z}function mt(){let Z=this.resume(),Y=this.stack[this.stack.length-1];L(Y,"expected node on stack"),L(Y.type==="image"||Y.type==="link","expected image or link on stack"),Y.title=Z}function dt(){this.data.inReference=void 0}function N(){this.data.referenceType="collapsed"}function qt(Z){let Y=this.resume(),ge=this.stack[this.stack.length-1];L(ge,"expected node on stack"),L(ge.type==="image"||ge.type==="link","expected image reference or link reference on stack"),ge.label=Y,ge.identifier=zt(this.sliceSerialize(Z)).toLowerCase(),this.data.referenceType="full"}function an(Z){L(Z.type==="characterReferenceMarkerNumeric"||Z.type==="characterReferenceMarkerHexadecimal"),this.data.characterReferenceType=Z.type}function ko(Z){let Y=this.sliceSerialize(Z),ge=this.data.characterReferenceType,Le;if(ge)Le=Xd(Y,ge===k.characterReferenceMarkerNumeric?J.numericBaseDecimal:J.numericBaseHexadecimal),this.data.characterReferenceType=void 0;else{let on=qo(Y);L(on!==!1,"expected reference to decode"),Le=on}let Te=this.stack[this.stack.length-1];L(Te,"expected `node`"),L("value"in Te,"expected `node.value`"),Te.value+=Le}function Yn(Z){let Y=this.stack.pop();L(Y,"expected `node`"),L(Y.position,"expected `node.position`"),Y.position.end=$r(Z.end)}function tt(Z){z.call(this,Z);let Y=this.stack[this.stack.length-1];L(Y,"expected node on stack"),L(Y.type==="link","expected link on stack"),Y.url=this.sliceSerialize(Z)}function ga(Z){z.call(this,Z);let Y=this.stack[this.stack.length-1];L(Y,"expected node on stack"),L(Y.type==="link","expected link on stack"),Y.url="mailto:"+this.sliceSerialize(Z)}function rn(){return{type:"blockquote",children:[]}}function Ga(){return{type:"code",lang:null,meta:null,value:""}}function hr(){return{type:"inlineCode",value:""}}function Ac(){return{type:"definition",identifier:"",label:null,title:null,url:""}}function lc(){return{type:"emphasis",children:[]}}function dc(){return{type:"heading",depth:0,children:[]}}function uc(){return{type:"break"}}function Bo(){return{type:"html",value:""}}function Co(){return{type:"image",title:null,url:"",alt:null}}function mi(){return{type:"link",title:null,url:"",children:[]}}function wx(Z){return{type:"list",ordered:Z.type==="listOrdered",start:null,spread:Z._spread,children:[]}}function EY(Z){return{type:"listItem",spread:Z._spread,checked:null,children:[]}}function vY(){return{type:"paragraph",children:[]}}function QY(){return{type:"strong",children:[]}}function xY(){return{type:"text",value:""}}function IY(){return{type:"thematicBreak"}}}function $r(e){return{line:e.line,column:e.column,offset:e.offset}}function V1(e,t){let n=-1;while(++n<t.length){let a=t[n];if(Array.isArray(a))V1(e,a);else Ooe(e,a)}}function Ooe(e,t){let n;for(n in t)if(J1.call(t,n))switch(n){case"canContainEols":{let a=t[n];if(a)e[n].push(...a);break}case"transforms":{let a=t[n];if(a)e[n].push(...a);break}case"enter":case"exit":{let a=t[n];if(a)Object.assign(e[n],a);break}}}function W1(e,t){if(e)throw Error("Cannot close `"+e.type+"` ("+Po({start:e.start,end:e.end})+"): a different token (`"+t.type+"`, "+Po({start:t.start,end:t.end})+") is open");else throw Error("Cannot close document, a token (`"+t.type+"`, "+Po({start:t.start,end:t.end})+") is still open")}var Zoe={tokenize:Voe,partial:!0},X1={tokenize:Xoe,partial:!0},eF={tokenize:ese,partial:!0},tF={tokenize:tse,partial:!0},Yoe={tokenize:nse,partial:!0},nF={name:"wwwAutolink",tokenize:Woe,previous:rF},aF={name:"protocolAutolink",tokenize:Joe,previous:iF},Ta={name:"emailAutolink",tokenize:Koe,previous:oF},ka={};function Bh(){return{text:ka}}var Si=f.digit0;while(Si<f.leftCurlyBrace)if(ka[Si]=Ta,Si++,Si===f.colon)Si=f.uppercaseA;else if(Si===f.leftSquareBracket)Si=f.lowercaseA;ka[f.plusSign]=Ta;ka[f.dash]=Ta;ka[f.dot]=Ta;ka[f.underscore]=Ta;ka[f.uppercaseH]=[Ta,aF];ka[f.lowercaseH]=[Ta,aF];ka[f.uppercaseW]=[Ta,nF];ka[f.lowercaseW]=[Ta,nF];function Koe(e,t,n){let a=this,r,i;return o;function o(d){if(!kh(d)||!oF.call(a,a.previous)||Ch(a.events))return n(d);return e.enter("literalAutolink"),e.enter("literalAutolinkEmail"),s(d)}function s(d){if(kh(d))return e.consume(d),s;if(d===f.atSign)return e.consume(d),c;return n(d)}function c(d){if(d===f.dot)return e.check(Yoe,l,A)(d);if(d===f.dash||d===f.underscore||Qt(d))return i=!0,e.consume(d),c;return l(d)}function A(d){return e.consume(d),r=!0,c}function l(d){if(i&&r&&vt(a.previous))return e.exit("literalAutolinkEmail"),e.exit("literalAutolink"),t(d);return n(d)}}function Woe(e,t,n){let a=this;return r;function r(o){if(o!==f.uppercaseW&&o!==f.lowercaseW||!rF.call(a,a.previous)||Ch(a.events))return n(o);return e.enter("literalAutolink"),e.enter("literalAutolinkWww"),e.check(Zoe,e.attempt(X1,e.attempt(eF,i),n),n)(o)}function i(o){return e.exit("literalAutolinkWww"),e.exit("literalAutolink"),t(o)}}function Joe(e,t,n){let a=this,r="",i=!1;return o;function o(d){if((d===f.uppercaseH||d===f.lowercaseH)&&iF.call(a,a.previous)&&!Ch(a.events))return e.enter("literalAutolink"),e.enter("literalAutolinkHttp"),r+=String.fromCodePoint(d),e.consume(d),s;return n(d)}function s(d){if(vt(d)&&r.length<5)return r+=String.fromCodePoint(d),e.consume(d),s;if(d===f.colon){let u=r.toLowerCase();if(u==="http"||u==="https")return e.consume(d),c}return n(d)}function c(d){if(d===f.slash){if(e.consume(d),i)return A;return i=!0,c}return n(d)}function A(d){return d===f.eof||Ei(d)||je(d)||ya(d)||vi(d)?n(d):e.attempt(X1,e.attempt(eF,l),n)(d)}function l(d){return e.exit("literalAutolinkHttp"),e.exit("literalAutolink"),t(d)}}function Voe(e,t,n){let a=0;return r;function r(o){if((o===f.uppercaseW||o===f.lowercaseW)&&a<3)return a++,e.consume(o),r;if(o===f.dot&&a===3)return e.consume(o),i;return n(o)}function i(o){return o===f.eof?n(o):t(o)}}function Xoe(e,t,n){let a,r,i;return o;function o(A){if(A===f.dot||A===f.underscore)return e.check(tF,c,s)(A);if(A===f.eof||je(A)||ya(A)||A!==f.dash&&vi(A))return c(A);return i=!0,e.consume(A),o}function s(A){if(A===f.underscore)a=!0;else r=a,a=void 0;return e.consume(A),o}function c(A){if(r||a||!i)return n(A);return t(A)}}function ese(e,t){let n=0,a=0;return r;function r(o){if(o===f.leftParenthesis)return n++,e.consume(o),r;if(o===f.rightParenthesis&&a<n)return i(o);if(o===f.exclamationMark||o===f.quotationMark||o===f.ampersand||o===f.apostrophe||o===f.rightParenthesis||o===f.asterisk||o===f.comma||o===f.dot||o===f.colon||o===f.semicolon||o===f.lessThan||o===f.questionMark||o===f.rightSquareBracket||o===f.underscore||o===f.tilde)return e.check(tF,t,i)(o);if(o===f.eof||je(o)||ya(o))return t(o);return e.consume(o),r}function i(o){if(o===f.rightParenthesis)a++;return e.consume(o),r}}function tse(e,t,n){return a;function a(s){if(s===f.exclamationMark||s===f.quotationMark||s===f.apostrophe||s===f.rightParenthesis||s===f.asterisk||s===f.comma||s===f.dot||s===f.colon||s===f.semicolon||s===f.questionMark||s===f.underscore||s===f.tilde)return e.consume(s),a;if(s===f.ampersand)return e.consume(s),i;if(s===f.rightSquareBracket)return e.consume(s),r;if(s===f.lessThan||s===f.eof||je(s)||ya(s))return t(s);return n(s)}function r(s){if(s===f.eof||s===f.leftParenthesis||s===f.leftSquareBracket||je(s)||ya(s))return t(s);return a(s)}function i(s){return vt(s)?o(s):n(s)}function o(s){if(s===f.semicolon)return e.consume(s),a;if(vt(s))return e.consume(s),o;return n(s)}}function nse(e,t,n){return a;function a(i){return e.consume(i),r}function r(i){return Qt(i)?n(i):t(i)}}function rF(e){return e===f.eof||e===f.leftParenthesis||e===f.asterisk||e===f.underscore||e===f.leftSquareBracket||e===f.rightSquareBracket||e===f.tilde||je(e)}function iF(e){return!vt(e)}function oF(e){return!(e===f.slash||kh(e))}function kh(e){return e===f.plusSign||e===f.dash||e===f.dot||e===f.underscore||Qt(e)}function Ch(e){let t=e.length,n=!1;while(t--){let a=e[t][1];if((a.type==="labelLink"||a.type==="labelImage")&&!a._balanced){n=!0;break}if(a._gfmAutolinkLiteralWalkedInto){n=!1;break}}if(e.length>0&&!n)e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0;return n}var ase={tokenize:lse,partial:!0};function _h(){return{document:{[f.leftSquareBracket]:{name:"gfmFootnoteDefinition",tokenize:sse,continuation:{tokenize:cse},exit:Ase}},text:{[f.leftSquareBracket]:{name:"gfmFootnoteCall",tokenize:ose},[f.rightSquareBracket]:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:rse,resolveTo:ise}}}}function rse(e,t,n){let a=this,r=a.events.length,i=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]),o;while(r--){let c=a.events[r][1];if(c.type===k.labelImage){o=c;break}if(c.type==="gfmFootnoteCall"||c.type===k.labelLink||c.type===k.label||c.type===k.image||c.type===k.link)break}return s;function s(c){if(L(c===f.rightSquareBracket,"expected `]`"),!o||!o._balanced)return n(c);let A=zt(a.sliceSerialize({start:o.end,end:a.now()}));if(A.codePointAt(0)!==f.caret||!i.includes(A.slice(1)))return n(c);return e.enter("gfmFootnoteCallLabelMarker"),e.consume(c),e.exit("gfmFootnoteCallLabelMarker"),t(c)}}function ise(e,t){let n=e.length,a;while(n--)if(e[n][1].type===k.labelImage&&e[n][0]==="enter"){a=e[n][1];break}L(a,"expected `labelStart` to resolve"),e[n+1][1].type=k.data,e[n+3][1].type="gfmFootnoteCallLabelMarker";let r={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},i={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};i.end.column++,i.end.offset++,i.end._bufferIndex++;let o={type:"gfmFootnoteCallString",start:Object.assign({},i.end),end:Object.assign({},e[e.length-1][1].start)},s={type:k.chunkString,contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},c=[e[n+1],e[n+2],["enter",r,t],e[n+3],e[n+4],["enter",i,t],["exit",i,t],["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",r,t]];return e.splice(n,e.length-n+1,...c),e}function ose(e,t,n){let a=this,r=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]),i=0,o;return s;function s(d){return L(d===f.leftSquareBracket,"expected `[`"),e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),c}function c(d){if(d!==f.caret)return n(d);return e.enter("gfmFootnoteCallMarker"),e.consume(d),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",A}function A(d){if(i>J.linkReferenceSizeMax||d===f.rightSquareBracket&&!o||d===f.eof||d===f.leftSquareBracket||je(d))return n(d);if(d===f.rightSquareBracket){e.exit("chunkString");let u=e.exit("gfmFootnoteCallString");if(!r.includes(zt(a.sliceSerialize(u))))return n(d);return e.enter("gfmFootnoteCallLabelMarker"),e.consume(d),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t}if(!je(d))o=!0;return i++,e.consume(d),d===f.backslash?l:A}function l(d){if(d===f.leftSquareBracket||d===f.backslash||d===f.rightSquareBracket)return e.consume(d),i++,A;return A(d)}}function sse(e,t,n){let a=this,r=a.parser.gfmFootnotes||(a.parser.gfmFootnotes=[]),i,o=0,s;return c;function c(g){return L(g===f.leftSquareBracket,"expected `[`"),e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),A}function A(g){if(g===f.caret)return e.enter("gfmFootnoteDefinitionMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",l;return n(g)}function l(g){if(o>J.linkReferenceSizeMax||g===f.rightSquareBracket&&!s||g===f.eof||g===f.leftSquareBracket||je(g))return n(g);if(g===f.rightSquareBracket){e.exit("chunkString");let b=e.exit("gfmFootnoteDefinitionLabelString");return i=zt(a.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(g),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),u}if(!je(g))s=!0;return o++,e.consume(g),g===f.backslash?d:l}function d(g){if(g===f.leftSquareBracket||g===f.backslash||g===f.rightSquareBracket)return e.consume(g),o++,l;return l(g)}function u(g){if(g===f.colon){if(e.enter("definitionMarker"),e.consume(g),e.exit("definitionMarker"),!r.includes(i))r.push(i);return we(e,p,"gfmFootnoteDefinitionWhitespace")}return n(g)}function p(g){return t(g)}}function cse(e,t,n){return e.check(wa,t,e.attempt(ase,t,n))}function Ase(e){e.exit("gfmFootnoteDefinition")}function lse(e,t,n){let a=this;return we(e,r,"gfmFootnoteDefinitionIndent",J.tabSize+1);function r(i){let o=a.events[a.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===J.tabSize?t(i):n(i)}}function Eh(e){let n=(e||{}).singleTilde,a={name:"strikethrough",tokenize:i,resolveAll:r};if(n===null||n===void 0)n=!0;return{text:{[f.tilde]:a},insideSpan:{null:[a]},attentionMarkers:{null:[f.tilde]}};function r(o,s){let c=-1;while(++c<o.length)if(o[c][0]==="enter"&&o[c][1].type==="strikethroughSequenceTemporary"&&o[c][1]._close){let A=c;while(A--)if(o[A][0]==="exit"&&o[A][1].type==="strikethroughSequenceTemporary"&&o[A][1]._open&&o[c][1].end.offset-o[c][1].start.offset===o[A][1].end.offset-o[A][1].start.offset){o[c][1].type="strikethroughSequence",o[A][1].type="strikethroughSequence";let l={type:"strikethrough",start:Object.assign({},o[A][1].start),end:Object.assign({},o[c][1].end)},d={type:"strikethroughText",start:Object.assign({},o[A][1].end),end:Object.assign({},o[c][1].start)},u=[["enter",l,s],["enter",o[A][1],s],["exit",o[A][1],s],["enter",d,s]],p=s.parser.constructs.insideSpan.null;if(p)gt(u,u.length,0,Dr(p,o.slice(A+1,c),s));gt(u,u.length,0,[["exit",d,s],["enter",o[c][1],s],["exit",o[c][1],s],["exit",l,s]]),gt(o,A-1,c-A+3,u),c=A+u.length-2;break}}c=-1;while(++c<o.length)if(o[c][1].type==="strikethroughSequenceTemporary")o[c][1].type=k.data;return o}function i(o,s,c){let A=this.previous,l=this.events,d=0;return u;function u(g){if(L(g===f.tilde,"expected `~`"),A===f.tilde&&l[l.length-1][1].type!==k.characterEscape)return c(g);return o.enter("strikethroughSequenceTemporary"),p(g)}function p(g){let b=No(A);if(g===f.tilde){if(d>1)return c(g);return o.consume(g),d++,p}if(d<2&&!n)return c(g);let y=o.exit("strikethroughSequenceTemporary"),w=No(g);return y._open=!w||w===J.attentionSideAfter&&Boolean(b),y._close=!b||b===J.attentionSideAfter&&Boolean(w),s(g)}}}class vh{constructor(){this.map=[]}add(e,t,n){dse(this,e,t,n)}consume(e){if(this.map.sort(function(r,i){return r[0]-i[0]}),this.map.length===0)return;let t=this.map.length,n=[];while(t>0)t-=1,n.push(e.slice(this.map[t][0]+this.map[t][1]),this.map[t][2]),e.length=this.map[t][0];n.push(e.slice()),e.length=0;let a=n.pop();while(a){for(let r of a)e.push(r);a=n.pop()}this.map.length=0}}function dse(e,t,n,a){let r=0;if(n===0&&a.length===0)return;while(r<e.map.length){if(e.map[r][0]===t){e.map[r][1]+=n,e.map[r][2].push(...a);return}r+=1}e.map.push([t,n,a])}function sF(e,t){L(e[t][1].type==="table","expected table");let n=!1,a=[];while(t<e.length){let r=e[t];if(n){if(r[0]==="enter"){if(r[1].type==="tableContent")a.push(e[t+1][1].type==="tableDelimiterMarker"?"left":"none")}else if(r[1].type==="tableContent"){if(e[t-1][1].type==="tableDelimiterMarker"){let i=a.length-1;a[i]=a[i]==="left"?"center":"right"}}else if(r[1].type==="tableDelimiterRow")break}else if(r[0]==="enter"&&r[1].type==="tableDelimiterRow")n=!0;t+=1}return a}function Qh(){return{flow:{null:{name:"table",tokenize:use,resolveAll:pse}}}}function use(e,t,n){let a=this,r=0,i=0,o;return s;function s(z){let ye=a.events.length-1;while(ye>-1){let de=a.events[ye][1].type;if(de===k.lineEnding||de===k.linePrefix)ye--;else break}let ee=ye>-1?a.events[ye][1].type:null,ce=ee==="tableHead"||ee==="tableRow"?I:c;if(ce===I&&a.parser.lazy[a.now().line])return n(z);return ce(z)}function c(z){return e.enter("tableHead"),e.enter("tableRow"),A(z)}function A(z){if(z===f.verticalBar)return l(z);return o=!0,i+=1,l(z)}function l(z){if(z===f.eof)return n(z);if(ne(z)){if(i>1)return i=0,a.interrupt=!0,e.exit("tableRow"),e.enter(k.lineEnding),e.consume(z),e.exit(k.lineEnding),p;return n(z)}if(fe(z))return we(e,l,k.whitespace)(z);if(i+=1,o)o=!1,r+=1;if(z===f.verticalBar)return e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),o=!0,l;return e.enter(k.data),d(z)}function d(z){if(z===f.eof||z===f.verticalBar||je(z))return e.exit(k.data),l(z);return e.consume(z),z===f.backslash?u:d}function u(z){if(z===f.backslash||z===f.verticalBar)return e.consume(z),d;return d(z)}function p(z){if(a.interrupt=!1,a.parser.lazy[a.now().line])return n(z);if(e.enter("tableDelimiterRow"),o=!1,fe(z))return L(a.parser.constructs.disable.null,"expected `disabled.null`"),we(e,g,k.linePrefix,a.parser.constructs.disable.null.includes("codeIndented")?void 0:J.tabSize)(z);return g(z)}function g(z){if(z===f.dash||z===f.colon)return y(z);if(z===f.verticalBar)return o=!0,e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),b;return F(z)}function b(z){if(fe(z))return we(e,y,k.whitespace)(z);return y(z)}function y(z){if(z===f.colon)return i+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),w;if(z===f.dash)return i+=1,w(z);if(z===f.eof||ne(z))return D(z);return F(z)}function w(z){if(z===f.dash)return e.enter("tableDelimiterFiller"),E(z);return F(z)}function E(z){if(z===f.dash)return e.consume(z),E;if(z===f.colon)return o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(z),e.exit("tableDelimiterMarker"),C;return e.exit("tableDelimiterFiller"),C(z)}function C(z){if(fe(z))return we(e,D,k.whitespace)(z);return D(z)}function D(z){if(z===f.verticalBar)return g(z);if(z===f.eof||ne(z)){if(!o||r!==i)return F(z);return e.exit("tableDelimiterRow"),e.exit("tableHead"),t(z)}return F(z)}function F(z){return n(z)}function I(z){return e.enter("tableRow"),P(z)}function P(z){if(z===f.verticalBar)return e.enter("tableCellDivider"),e.consume(z),e.exit("tableCellDivider"),P;if(z===f.eof||ne(z))return e.exit("tableRow"),t(z);if(fe(z))return we(e,P,k.whitespace)(z);return e.enter(k.data),G(z)}function G(z){if(z===f.eof||z===f.verticalBar||je(z))return e.exit(k.data),P(z);return e.consume(z),z===f.backslash?W:G}function W(z){if(z===f.backslash||z===f.verticalBar)return e.consume(z),G;return G(z)}}function pse(e,t){let n=-1,a=!0,r=0,i=[0,0,0,0],o=[0,0,0,0],s=!1,c=0,A,l,d,u=new vh;while(++n<e.length){let p=e[n],g=p[1];if(p[0]==="enter"){if(g.type==="tableHead"){if(s=!1,c!==0)L(A,"there should be a table opening"),cF(u,t,c,A,l),l=void 0,c=0;A={type:"table",start:Object.assign({},g.start),end:Object.assign({},g.end)},u.add(n,0,[["enter",A,t]])}else if(g.type==="tableRow"||g.type==="tableDelimiterRow"){if(a=!0,d=void 0,i=[0,0,0,0],o=[0,n+1,0,0],s)s=!1,l={type:"tableBody",start:Object.assign({},g.start),end:Object.assign({},g.end)},u.add(n,0,[["enter",l,t]]);r=g.type==="tableDelimiterRow"?2:l?3:1}else if(r&&(g.type===k.data||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller")){if(a=!1,o[2]===0){if(i[1]!==0)o[0]=o[1],d=pu(u,t,i,r,void 0,d),i=[0,0,0,0];o[2]=n}}else if(g.type==="tableCellDivider")if(a)a=!1;else{if(i[1]!==0)o[0]=o[1],d=pu(u,t,i,r,void 0,d);i=o,o=[i[1],n,0,0]}}else if(g.type==="tableHead")s=!0,c=n;else if(g.type==="tableRow"||g.type==="tableDelimiterRow"){if(c=n,i[1]!==0)o[0]=o[1],d=pu(u,t,i,r,n,d);else if(o[1]!==0)d=pu(u,t,o,r,n,d);r=0}else if(r&&(g.type===k.data||g.type==="tableDelimiterMarker"||g.type==="tableDelimiterFiller"))o[3]=n}if(c!==0)L(A,"expected table opening"),cF(u,t,c,A,l);u.consume(t.events),n=-1;while(++n<t.events.length){let p=t.events[n];if(p[0]==="enter"&&p[1].type==="table")p[1]._align=sF(t.events,n)}return e}function pu(e,t,n,a,r,i){let o=a===1?"tableHeader":a===2?"tableDelimiter":"tableData",s="tableContent";if(n[0]!==0)L(i,"expected previous cell enter"),i.end=Object.assign({},zo(t.events,n[0])),e.add(n[0],0,[["exit",i,t]]);let c=zo(t.events,n[1]);if(i={type:o,start:Object.assign({},c),end:Object.assign({},c)},e.add(n[1],0,[["enter",i,t]]),n[2]!==0){let A=zo(t.events,n[2]),l=zo(t.events,n[3]),d={type:"tableContent",start:Object.assign({},A),end:Object.assign({},l)};if(e.add(n[2],0,[["enter",d,t]]),L(n[3]!==0),a!==2){let u=t.events[n[2]],p=t.events[n[3]];if(u[1].end=Object.assign({},p[1].end),u[1].type=k.chunkText,u[1].contentType=J.contentTypeText,n[3]>n[2]+1){let g=n[2]+1,b=n[3]-n[2]-1;e.add(g,b,[])}}e.add(n[3]+1,0,[["exit",d,t]])}if(r!==void 0)i.end=Object.assign({},zo(t.events,r)),e.add(r,0,[["exit",i,t]]),i=void 0;return i}function cF(e,t,n,a,r){let i=[],o=zo(t.events,n);if(r)r.end=Object.assign({},o),i.push(["exit",r,t]);a.end=Object.assign({},o),i.push(["exit",a,t]),e.add(n+1,0,i)}function zo(e,t){let n=e[t],a=n[0]==="enter"?"start":"end";return n[1][a]}var mse={name:"tasklistCheck",tokenize:gse};function xh(){return{text:{[f.leftSquareBracket]:mse}}}function gse(e,t,n){let a=this;return r;function r(c){if(L(c===f.leftSquareBracket,"expected `[`"),a.previous!==f.eof||!a._gfmTasklistFirstContentOfListItem)return n(c);return e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),i}function i(c){if(je(c))return e.enter("taskListCheckValueUnchecked"),e.consume(c),e.exit("taskListCheckValueUnchecked"),o;if(c===f.uppercaseX||c===f.lowercaseX)return e.enter("taskListCheckValueChecked"),e.consume(c),e.exit("taskListCheckValueChecked"),o;return n(c)}function o(c){if(c===f.rightSquareBracket)return e.enter("taskListCheckMarker"),e.consume(c),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s;return n(c)}function s(c){if(ne(c))return t(c);if(fe(c))return e.check({tokenize:bse},t,n)(c);return n(c)}}function bse(e,t,n){return we(e,a,k.whitespace);function a(r){return r===f.eof?n(r):t(r)}}function AF(e){return Vd([Bh(),_h(),Eh(e),Qh(),xh()])}function Uo(e,t){let n=String(e);if(typeof t!=="string")throw TypeError("Expected character");let a=0,r=n.indexOf(t);while(r!==-1)a++,r=n.indexOf(t,r+t.length);return a}function mu(e){if(typeof e!=="string")throw TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}var Ho=function(e){if(e===null||e===void 0)return wse;if(typeof e==="function")return gu(e);if(typeof e==="object")return Array.isArray(e)?fse(e):hse(e);if(typeof e==="string")return yse(e);throw Error("Expected function, string, or object as test")};function fse(e){let t=[],n=-1;while(++n<e.length)t[n]=Ho(e[n]);return gu(a);function a(...r){let i=-1;while(++i<t.length)if(t[i].apply(this,r))return!0;return!1}}function hse(e){let t=e;return gu(n);function n(a){let r=a,i;for(i in e)if(r[i]!==t[i])return!1;return!0}}function yse(e){return gu(t);function t(n){return n&&n.type===e}}function gu(e){return t;function t(n,a,r){return Boolean(kse(n)&&e.call(this,n,typeof a==="number"?a:void 0,r||void 0))}}function wse(){return!0}function kse(e){return e!==null&&typeof e==="object"&&"type"in e}function lF(e){return"\x1B[33m"+e+"\x1B[39m"}var dF=[],uF=!0,Ih=!1,pF="skip";function Dh(e,t,n,a){let r;if(typeof t==="function"&&typeof n!=="function")a=n,n=t;else r=t;let i=Ho(r),o=a?-1:1;s(e,void 0,[])();function s(c,A,l){let d=c&&typeof c==="object"?c:{};if(typeof d.type==="string"){let p=typeof d.tagName==="string"?d.tagName:typeof d.name==="string"?d.name:void 0;Object.defineProperty(u,"name",{value:"node ("+lF(c.type+(p?"<"+p+">":""))+")"})}return u;function u(){let p=dF,g,b,y;if(!t||i(c,A,l[l.length-1]||void 0)){if(p=Bse(n(c,l)),p[0]===Ih)return p}if("children"in c&&c.children){let w=c;if(w.children&&p[0]!==pF){b=(a?w.children.length:-1)+o,y=l.concat(w);while(b>-1&&b<w.children.length){let E=w.children[b];if(g=s(E,b,y)(),g[0]===Ih)return g;b=typeof g[1]==="number"?g[1]:b+o}}}return p}}}function Bse(e){if(Array.isArray(e))return e;if(typeof e==="number")return[uF,e];return e===null||e===void 0?dF:[e]}function Fh(e,t,n){let r=Ho((n||{}).ignore||[]),i=Cse(t),o=-1;while(++o<i.length)Dh(e,"text",s);function s(A,l){let d=-1,u;while(++d<l.length){let p=l[d],g=u?u.children:void 0;if(r(p,g?g.indexOf(p):void 0,u))return;u=p}if(u)return c(A,l)}function c(A,l){let d=l[l.length-1],u=i[o][0],p=i[o][1],g=0,y=d.children.indexOf(A),w=!1,E=[];u.lastIndex=0;let C=u.exec(A.value);while(C){let D=C.index,F={index:C.index,input:C.input,stack:[...l,A]},I=p(...C,F);if(typeof I==="string")I=I.length>0?{type:"text",value:I}:void 0;if(I===!1)u.lastIndex=D+1;else{if(g!==D)E.push({type:"text",value:A.value.slice(g,D)});if(Array.isArray(I))E.push(...I);else if(I)E.push(I);g=D+C[0].length,w=!0}if(!u.global)break;C=u.exec(A.value)}if(w){if(g<A.value.length)E.push({type:"text",value:A.value.slice(g)});d.children.splice(y,1,...E)}else E=[A];return y+E.length}}function Cse(e){let t=[];if(!Array.isArray(e))throw TypeError("Expected find and replace tuple or list of tuples");let n=!e[0]||Array.isArray(e[0])?e:[e],a=-1;while(++a<n.length){let r=n[a];t.push([_se(r[0]),Ese(r[1])])}return t}function _se(e){return typeof e==="string"?new RegExp(mu(e),"g"):e}function Ese(e){return typeof e==="function"?e:function(){return e}}function Sh(){return{transforms:[Fse],enter:{literalAutolink:vse,literalAutolinkEmail:$h,literalAutolinkHttp:$h,literalAutolinkWww:$h},exit:{literalAutolink:Dse,literalAutolinkEmail:Ise,literalAutolinkHttp:Qse,literalAutolinkWww:xse}}}function vse(e){this.enter({type:"link",title:null,url:"",children:[]},e)}function $h(e){this.config.enter.autolinkProtocol.call(this,e)}function Qse(e){this.config.exit.autolinkProtocol.call(this,e)}function xse(e){this.config.exit.data.call(this,e);let t=this.stack[this.stack.length-1];L(t.type==="link"),t.url="http://"+this.sliceSerialize(e)}function Ise(e){this.config.exit.autolinkEmail.call(this,e)}function Dse(e){this.exit(e)}function Fse(e){Fh(e,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,$se],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,Sse]],{ignore:["link","linkReference"]})}function $se(e,t,n,a,r){let i="";if(!mF(r))return!1;if(/^w/i.test(t))n=t+n,t="",i="http://";if(!Lse(n))return!1;let o=jse(n+a);if(!o[0])return!1;let s={type:"link",title:null,url:i+t+o[0],children:[{type:"text",value:t+o[0]}]};if(o[1])return[s,{type:"text",value:o[1]}];return s}function Sse(e,t,n,a){if(!mF(a,!0)||/[-\d_]$/.test(n))return!1;return{type:"link",title:null,url:"mailto:"+t+"@"+n,children:[{type:"text",value:t+"@"+n}]}}function Lse(e){let t=e.split(".");if(t.length<2||t[t.length-1]&&(/_/.test(t[t.length-1])||!/[a-zA-Z\d]/.test(t[t.length-1]))||t[t.length-2]&&(/_/.test(t[t.length-2])||!/[a-zA-Z\d]/.test(t[t.length-2])))return!1;return!0}function jse(e){let t=/[!"&'),.:;<>?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],a=n.indexOf(")"),r=Uo(e,"("),i=Uo(e,")");while(a!==-1&&r>i)e+=n.slice(0,a+1),n=n.slice(a+1),a=n.indexOf(")"),i++;return[e,n]}function mF(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||ya(n)||vi(n))&&(!t||n!==47)}Ose.peek=Tse;function Nse(){this.buffer()}function Mse(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Gse(){this.buffer()}function Rse(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function Pse(e){let t=this.resume(),n=this.stack[this.stack.length-1];L(n.type==="footnoteReference"),n.identifier=zt(this.sliceSerialize(e)).toLowerCase(),n.label=t}function zse(e){this.exit(e)}function Use(e){let t=this.resume(),n=this.stack[this.stack.length-1];L(n.type==="footnoteDefinition"),n.identifier=zt(this.sliceSerialize(e)).toLowerCase(),n.label=t}function Hse(e){this.exit(e)}function Tse(){return"["}function Ose(e,t,n,a){let r=n.createTracker(a),i=r.move("[^"),o=n.enter("footnoteReference"),s=n.enter("reference");return i+=r.move(n.safe(n.associationId(e),{after:"]",before:i})),s(),o(),i+=r.move("]"),i}function Lh(){return{enter:{gfmFootnoteCallString:Nse,gfmFootnoteCall:Mse,gfmFootnoteDefinitionLabelString:Gse,gfmFootnoteDefinition:Rse},exit:{gfmFootnoteCallString:Pse,gfmFootnoteCall:zse,gfmFootnoteDefinitionLabelString:Use,gfmFootnoteDefinition:Hse}}}Wse.peek=Jse;function jh(){return{canContainEols:["delete"],enter:{strikethrough:Yse},exit:{strikethrough:Kse}}}function Yse(e){this.enter({type:"delete",children:[]},e)}function Kse(e){this.exit(e)}function Wse(e,t,n,a){let r=n.createTracker(a),i=n.enter("strikethrough"),o=r.move("~~");return o+=n.containerPhrasing(e,{...r.current(),before:o,after:"~"}),o+=r.move("~~"),i(),o}function Jse(){return"~"}var gF={}.hasOwnProperty;function bF(e,t){let n=t||{};function a(r,...i){let{invalid:o,handlers:s}=a;if(r&&gF.call(r,e)){let c=String(r[e]);o=gF.call(s,c)?s[c]:a.unknown}if(o)return o.call(this,r,...i)}return a.handlers=n.handlers||{},a.invalid=n.invalid,a.unknown=n.unknown,a}function Nh(){return{enter:{table:Xse,tableData:fF,tableHeader:fF,tableRow:tce},exit:{codeText:nce,table:ece,tableData:qh,tableHeader:qh,tableRow:qh}}}function Xse(e){let t=e._align;L(t,"expected `_align` on table"),this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function ece(e){this.exit(e),this.data.inTable=void 0}function tce(e){this.enter({type:"tableRow",children:[]},e)}function qh(e){this.exit(e)}function fF(e){this.enter({type:"tableCell",children:[]},e)}function nce(e){let t=this.resume();if(this.data.inTable)t=t.replace(/\\([\\|])/g,ace);let n=this.stack[this.stack.length-1];L(n.type==="inlineCode"),n.value=t,this.exit(e)}function ace(e,t){return t==="|"?t:e}function Mh(){return{exit:{taskListCheckValueChecked:hF,taskListCheckValueUnchecked:hF,paragraph:ice}}}function hF(e){let t=this.stack[this.stack.length-2];L(t.type==="listItem"),t.checked=e.type==="taskListCheckValueChecked"}function ice(e){let t=this.stack[this.stack.length-2];if(t&&t.type==="listItem"&&typeof t.checked==="boolean"){let n=this.stack[this.stack.length-1];L(n.type==="paragraph");let a=n.children[0];if(a&&a.type==="text"){let r=t.children,i=-1,o;while(++i<r.length){let s=r[i];if(s.type==="paragraph"){o=s;break}}if(o===n){if(a.value=a.value.slice(1),a.value.length===0)n.children.shift();else if(n.position&&a.position&&typeof a.position.start.offset==="number")a.position.start.column++,a.position.start.offset++,n.position.start=Object.assign({},a.position.start)}}}this.exit(e)}function Gh(){return[Sh(),Lh(),jh(),Nh(),Mh()]}var wF=gc(yF(),1),Zc=Object.assign(Li(Error),{eval:Li(EvalError),range:Li(RangeError),reference:Li(ReferenceError),syntax:Li(SyntaxError),type:Li(TypeError),uri:Li(URIError)});function Li(e){return t.displayName=e.displayName||e.name,t;function t(n,...a){let r=n?wF.default(n,...a):n;return new e(r)}}var bu={}.hasOwnProperty,kF={yaml:"-",toml:"+"};function Yc(e){let t=[],n=-1,a=Array.isArray(e)?e:e?[e]:["yaml"];while(++n<a.length)t[n]=sce(a[n]);return t}function sce(e){let t=e;if(typeof t==="string"){if(!bu.call(kF,t))throw Zc("Missing matter definition for `%s`",t);t={type:t,marker:kF[t]}}else if(typeof t!=="object")throw Zc("Expected matter to be an object, not `%j`",t);if(!bu.call(t,"type"))throw Zc("Missing `type` in matter `%j`",t);if(!bu.call(t,"fence")&&!bu.call(t,"marker"))throw Zc("Missing `marker` or `fence` in matter `%j`",t);return t}function zh(e){let t=Yc(e),n={},a=-1;while(++a<t.length){let r=t[a],i=Ph(r,"open").charCodeAt(0),o=cce(r),s=n[i];if(Array.isArray(s))s.push(o);else n[i]=[o]}return{flow:n}}function cce(e){let{anywhere:t,type:n}=e,a=n+"Fence",r=a+"Sequence",i=n+"Value",o={tokenize:l,partial:!0},s,c=0;return{tokenize:A,concrete:!0};function A(d,u,p){let g=this;return b;function b(P){let G=g.now();if(G.column===1&&(G.line===1||t)){if(s=Ph(e,"open"),c=0,P===s.charCodeAt(c))return d.enter(n),d.enter(a),d.enter(r),y(P)}return p(P)}function y(P){if(c===s.length){if(d.exit(r),fe(P))return d.enter(k.whitespace),w(P);return E(P)}if(P===s.charCodeAt(c++))return d.consume(P),y;return p(P)}function w(P){if(fe(P))return d.consume(P),w;return d.exit(k.whitespace),E(P)}function E(P){if(ne(P))return d.exit(a),d.enter(k.lineEnding),d.consume(P),d.exit(k.lineEnding),s=Ph(e,"close"),c=0,d.attempt(o,I,C);return p(P)}function C(P){if(P===f.eof||ne(P))return F(P);return d.enter(i),D(P)}function D(P){if(P===f.eof||ne(P))return d.exit(i),F(P);return d.consume(P),D}function F(P){if(P===f.eof)return p(P);return d.enter(k.lineEnding),d.consume(P),d.exit(k.lineEnding),d.attempt(o,I,C)}function I(P){return d.exit(n),u(P)}}function l(d,u,p){let g=0;return b;function b(C){if(C===s.charCodeAt(g))return d.enter(a),d.enter(r),y(C);return p(C)}function y(C){if(g===s.length){if(d.exit(r),fe(C))return d.enter(k.whitespace),w(C);return E(C)}if(C===s.charCodeAt(g++))return d.consume(C),y;return p(C)}function w(C){if(fe(C))return d.consume(C),w;return d.exit(k.whitespace),E(C)}function E(C){if(C===f.eof||ne(C))return d.exit(a),u(C);return p(C)}}}function Ph(e,t){return e.marker?BF(e.marker,t).repeat(3):BF(e.fence,t)}function BF(e,t){return typeof e==="string"?e:e[t]}function Uh(e){let t=Yc(e),n={},a={},r=-1;while(++r<t.length){let i=t[r];n[i.type]=Ace(i),a[i.type]=lce,a[i.type+"Value"]=dce}return{enter:n,exit:a}}function Ace(e){return t;function t(n){this.enter({type:e.type,value:""},n),this.buffer()}}function lce(e){let t=this.resume(),n=this.stack[this.stack.length-1];L("value"in n),this.exit(e),n.value=t.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,"")}function dce(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}import{createHash as uce}from"crypto";var CF=/<!--ts:block:([a-zA-Z0-9][a-zA-Z0-9_-]{0,126})-->/g;function pce(e){if(e.type!=="html")return!1;if(!("value"in e))return!1;let t=e.value.trim();return/^<!--ts:block:[a-zA-Z0-9][a-zA-Z0-9_-]{0,126}-->$/.test(t)}function mce(e){let t=[],n;CF.lastIndex=0;let a=e.split(`
|
|
329
331
|
`),r=0,i=[];for(let o of a)i.push(r),r+=o.length+1;while((n=CF.exec(e))!==null){let o=n.index+n[0].length,s=1;for(let c=0;c<i.length;c++)if(i[c]<=n.index)s=c+1;else break;t.push({key:n[1],endOffset:o,line:s})}return t}function gce(e){return e.split(`
|
|
330
332
|
`).map((t)=>t.trimEnd()).join(`
|
|
331
|
-
`)}function _F(e){let t=gce(e),n=uce("sha256");return n.update(t,"utf-8"),n.digest("hex")}function bce(e){if(e.type!=="paragraph")return!1;if(!("children"in e))return!1;let t=e;if(t.children.length===0)return!0;if(t.children.length===1&&t.children[0].type==="text"&&"value"in t.children[0]&&t.children[0].value.trim()==="")return!0;return!1}function ji(e,t){let n=mce(e),a=wh(e,{extensions:[AF(),zh(["yaml"])],mdastExtensions:[Gh(),Uh(["yaml"])]}),r=[],i=null,o=0,s=new Map;function c(l){while(o<n.length&&n[o].endOffset<=l)o++;if(o>0&&n[o-1].endOffset<=l){let d=n[o-1];if(!s.has(d.key))s.set(d.key,[]);return s.get(d.key).push({source:"marker",line:d.line}),{key:d.key,source:"marker"}}return{key:null,source:null}}for(let l of a.children){if(l.type==="yaml"){i="value"in l?l.value:null;continue}if(l.type==="definition")continue;if(bce(l))continue;if(pce(l))continue;let d=l.position;if(!d)continue;let u=d.start.line,p=d.end.line,g=d.start.offset??0,b=d.end.offset??e.length;if(l.type==="list"&&"children"in l){let C=l;for(let D of C.children){if(D.type!=="listItem")continue;let F=D.position;if(!F)continue;let I=F.start.offset??0,P=F.end.offset??e.length,G=e.slice(I,P),{key:W,source:z}=c(I);r.push({blockIndex:r.length,blockType:"listItem",blockKey:W,blockKeySource:z,startLine:F.start.line,endLine:F.end.line,startOffset:I,endOffset:P,blockFingerprint:_F(G)})}continue}let y=e.slice(g,b),{key:w,source:E}=c(g);r.push({blockIndex:r.length,blockType:l.type,blockKey:w,blockKeySource:E,startLine:u,endLine:p,startOffset:g,endOffset:b,blockFingerprint:_F(y)})}let A=[];for(let[l,d]of s)if(d.length>1)A.push({key:l,sources:d});return{blocks:r,frontmatter:i,markers:n,duplicateKeys:A}}var EF=["div","p","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","pre","code","table","thead","tbody","tfoot","tr","th","td","hr","br","details","summary","dl","dt","dd","a","span","strong","b","em","i","del","s","strike","ins","sup","sub","mark","kbd","abbr","img","input"],vF=["math","mrow","mi","mo","mn","ms","mtext","mspace","msup","msub","msubsup","mover","munder","munderover","mfrac","msqrt","mroot","mtable","mtr","mtd","mth","menclose","mfenced","mmultiscripts","mprescripts","none","semantics","annotation","annotation-xml"],LZe=["svg","iframe","embed","object","script","style","link","meta","base","form","button","select","textarea","frame","frameset",...vF],fce={"*":["id","class","data-block-id","data-block-index","data-block-type"],a:["href","title","rel","target","referrerpolicy"],img:["src","alt","title","width","height","loading"],th:["align","valign","scope","colspan","rowspan"],td:["align","valign","colspan","rowspan"],code:["class"],pre:["class"],input:["type","checked","disabled","tabindex","aria-hidden"],abbr:["title"]},QF={tagNames:[...EF],attributes:fce,protocols:{href:["https","http","mailto"],src:["https"]},strip:["script","style"],clobberPrefix:"ts-",clobber:["name","id"]};var xF=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var hce=/["&'<>`]/g,yce=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,wce=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,kce=/[|\\{}()[\]^$+*?.]/g,IF=new WeakMap;function DF(e,t){if(e=e.replace(t.subset?Bce(t.subset):hce,a),t.subset||t.escapeOnly)return e;return e.replace(yce,n).replace(wce,a);function n(r,i,o){return t.format((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),t)}function a(r,i,o){return t.format(r.charCodeAt(0),o.charCodeAt(i+1),t)}}function Bce(e){let t=IF.get(e);if(!t)t=Cce(e),IF.set(e,t);return t}function Cce(e){let t=[],n=-1;while(++n<e.length)t.push(e[n].replace(kce,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}var _ce=/[\dA-Fa-f]/;function FF(e,t,n){let a="&#x"+e.toString(16).toUpperCase();return n&&t&&!_ce.test(String.fromCharCode(t))?a:a+";"}var Ece=/\d/;function $F(e,t,n){let a="&#"+String(e);return n&&t&&!Ece.test(String.fromCharCode(t))?a:a+";"}var SF=["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 fu={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 LF=["cent","copy","divide","gt","lt","not","para","times"];var jF={}.hasOwnProperty,Hh={},hu;for(hu in fu)if(jF.call(fu,hu))Hh[fu[hu]]=hu;var vce=/[^\dA-Za-z]/;function qF(e,t,n,a){let r=String.fromCharCode(e);if(jF.call(Hh,r)){let i=Hh[r],o="&"+i;if(n&&SF.includes(i)&&!LF.includes(i)&&(!a||t&&t!==61&&vce.test(String.fromCharCode(t))))return o;return o+";"}return""}function NF(e,t,n){let a=FF(e,t,n.omitOptionalSemicolons),r;if(n.useNamedReferences||n.useShortestReferences)r=qF(e,t,n.omitOptionalSemicolons,n.attribute);if((n.useShortestReferences||!r)&&n.useShortestReferences){let i=$F(e,t,n.omitOptionalSemicolons);if(i.length<a.length)a=i}return r&&(!n.useShortestReferences||r.length<a.length)?r:a}function Oa(e,t){return DF(e,Object.assign({format:NF},t))}function MF(e,t){let n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function GF(e){return e.join(" ").trim()}var Qce=/[ \t\n\f\r]/g;function qi(e){return typeof e==="object"?e.type==="text"?RF(e.value):!1:RF(e)}function RF(e){return e.replace(Qce,"")===""}class ut extends Error{constructor(e){super(e);this.name="ShikiError"}}function xce(e){return Vh(e)}function Vh(e){if(Array.isArray(e))return Ice(e);if(e instanceof RegExp)return e;if(typeof e==="object")return Dce(e);return e}function Ice(e){let t=[];for(let n=0,a=e.length;n<a;n++)t[n]=Vh(e[n]);return t}function Dce(e){let t={};for(let n in e)t[n]=Vh(e[n]);return t}function KF(e,...t){return t.forEach((n)=>{for(let a in n)e[a]=n[a]}),e}function WF(e){let t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");if(t===0)return e;else if(~t===e.length-1)return WF(e.substring(0,e.length-1));else return e.substr(~t+1)}var Th=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,yu=class{static hasCaptures(e){if(e===null)return!1;return Th.lastIndex=0,Th.test(e)}static replaceCaptures(e,t,n){return e.replace(Th,(a,r,i,o)=>{let s=n[parseInt(r||i,10)];if(s){let c=t.substring(s.start,s.end);while(c[0]===".")c=c.substring(1);switch(o){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return a})}};function JF(e,t){if(e<t)return-1;if(e>t)return 1;return 0}function VF(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,a=t.length;if(n===a){for(let r=0;r<n;r++){let i=JF(e[r],t[r]);if(i!==0)return i}return 0}return n-a}function PF(e){if(/^#[0-9a-f]{6}$/i.test(e))return!0;if(/^#[0-9a-f]{8}$/i.test(e))return!0;if(/^#[0-9a-f]{3}$/i.test(e))return!0;if(/^#[0-9a-f]{4}$/i.test(e))return!0;return!1}function XF(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var e2=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}},Jc=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Sce(e),t)}static createFromParsedTheme(e,t){return jce(e,t)}_cachedMatchRoot=new e2((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,a=this._cachedMatchRoot.get(t).find((r)=>Fce(e.parent,r.parentScopes));if(!a)return null;return new t2(a.fontStyle,a.foreground,a.background)}},Oh=class e{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(let a of n)t=new e(t,a);return t}static from(...t){let n=null;for(let a=0;a<t.length;a++)n=new e(n,t[a]);return n}push(t){return new e(this,t)}getSegments(){let t=this,n=[];while(t)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){if(this===t)return!0;if(this.parent===null)return!1;return this.parent.extends(t)}getExtensionIfDefined(t){let n=[],a=this;while(a&&a!==t)n.push(a.scopeName),a=a.parent;return a===t?n.reverse():void 0}};function Fce(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let a=t[n],r=!1;if(a===">"){if(n===t.length-1)return!1;a=t[++n],r=!0}while(e){if($ce(e.scopeName,a))break;if(r)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function $ce(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var t2=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Sce(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],a=0;for(let r=0,i=t.length;r<i;r++){let o=t[r];if(!o.settings)continue;let s;if(typeof o.scope==="string"){let d=o.scope;d=d.replace(/^[,]+/,""),d=d.replace(/[,]+$/,""),s=d.split(",")}else if(Array.isArray(o.scope))s=o.scope;else s=[""];let c=-1;if(typeof o.settings.fontStyle==="string"){c=0;let d=o.settings.fontStyle.split(" ");for(let u=0,p=d.length;u<p;u++)switch(d[u]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let A=null;if(typeof o.settings.foreground==="string"&&PF(o.settings.foreground))A=o.settings.foreground;let l=null;if(typeof o.settings.background==="string"&&PF(o.settings.background))l=o.settings.background;for(let d=0,u=s.length;d<u;d++){let g=s[d].trim().split(" "),b=g[g.length-1],y=null;if(g.length>1)y=g.slice(0,g.length-1),y.reverse();n[a++]=new Lce(b,y,r,c,A,l)}}return n}var Lce=class{constructor(e,t,n,a,r,i){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=a,this.foreground=r,this.background=i}},xt=((e)=>{return 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})(xt||{});function jce(e,t){e.sort((c,A)=>{let l=JF(c.scope,A.scope);if(l!==0)return l;if(l=VF(c.parentScopes,A.parentScopes),l!==0)return l;return c.index-A.index});let n=0,a="#000000",r="#ffffff";while(e.length>=1&&e[0].scope===""){let c=e.shift();if(c.fontStyle!==-1)n=c.fontStyle;if(c.foreground!==null)a=c.foreground;if(c.background!==null)r=c.background}let i=new qce(t),o=new t2(n,i.getId(a),i.getId(r)),s=new Mce(new Yh(0,null,-1,0,0),[]);for(let c=0,A=e.length;c<A;c++){let l=e[c];s.insert(0,l.scope,l.parentScopes,l.fontStyle,i.getId(l.foreground),i.getId(l.background))}return new Jc(i,o,s)}var qce=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,n=e.length;t<n;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 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)}},Nce=Object.freeze([]),Yh=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(t,n,a,r,i){this.scopeDepth=t,this.parentScopes=n||Nce,this.fontStyle=a,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let a=0,r=t.length;a<r;a++)n[a]=t[a].clone();return n}acceptOverwrite(t,n,a,r){if(this.scopeDepth>t)console.log("how did this happen?");else this.scopeDepth=t;if(n!==-1)this.fontStyle=n;if(a!==0)this.foreground=a;if(r!==0)this.background=r}},Mce=class e{constructor(t,n=[],a={}){this._mainRule=t,this._children=a,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let a=0,r=0;while(!0){if(t.parentScopes[a]===">")a++;if(n.parentScopes[r]===">")r++;if(a>=t.parentScopes.length||r>=n.parentScopes.length)break;let i=n.parentScopes[r].length-t.parentScopes[a].length;if(i!==0)return i;a++,r++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let a=t.indexOf("."),r,i;if(a===-1)r=t,i="";else r=t.substring(0,a),i=t.substring(a+1);if(this._children.hasOwnProperty(r))return this._children[r].match(i)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,a,r,i,o){if(n===""){this._doInsertHere(t,a,r,i,o);return}let s=n.indexOf("."),c,A;if(s===-1)c=n,A="";else c=n.substring(0,s),A=n.substring(s+1);let l;if(this._children.hasOwnProperty(c))l=this._children[c];else l=new e(this._mainRule.clone(),Yh.cloneArr(this._rulesWithParentScopes)),this._children[c]=l;l.insert(t+1,A,a,r,i,o)}_doInsertHere(t,n,a,r,i){if(n===null){this._mainRule.acceptOverwrite(t,a,r,i);return}for(let o=0,s=this._rulesWithParentScopes.length;o<s;o++){let c=this._rulesWithParentScopes[o];if(VF(c.parentScopes,n)===0){c.acceptOverwrite(t,a,r,i);return}}if(a===-1)a=this._mainRule.fontStyle;if(r===0)r=this._mainRule.foreground;if(i===0)i=this._mainRule.background;this._rulesWithParentScopes.push(new Yh(t,n,a,r,i))}},Ni=class e{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){let n=e.getLanguageId(t),a=e.getTokenType(t),r=e.getFontStyle(t),i=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:a,fontStyle:r,foreground:i,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,n,a,r,i,o,s){let c=e.getLanguageId(t),A=e.getTokenType(t),l=e.containsBalancedBrackets(t)?1:0,d=e.getFontStyle(t),u=e.getForeground(t),p=e.getBackground(t);if(n!==0)c=n;if(a!==8)A=Rce(a);if(r!==null)l=r?1:0;if(i!==-1)d=i;if(o!==0)u=o;if(s!==0)p=s;return(c<<0|A<<8|l<<10|d<<11|u<<15|p<<24)>>>0}};function Gce(e){return e}function Rce(e){return e}function ku(e,t){let n=[],a=Pce(e),r=a.next();while(r!==null){let c=0;if(r.length===2&&r.charAt(1)===":"){switch(r.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=a.next()}let A=o();if(n.push({matcher:A,priority:c}),r!==",")break;r=a.next()}return n;function i(){if(r==="-"){r=a.next();let c=i();return(A)=>!!c&&!c(A)}if(r==="("){r=a.next();let c=s();if(r===")")r=a.next();return c}if(zF(r)){let c=[];do c.push(r),r=a.next();while(zF(r));return(A)=>t(c,A)}return null}function o(){let c=[],A=i();while(A)c.push(A),A=i();return(l)=>c.every((d)=>d(l))}function s(){let c=[],A=o();while(A){if(c.push(A),r==="|"||r===",")do r=a.next();while(r==="|"||r===",");else break;A=o()}return(l)=>c.some((d)=>d(l))}}function zF(e){return!!e&&!!e.match(/[\w\.:]+/)}function Pce(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let a=n[0];return n=t.exec(e),a}}}function n2(e){if(typeof e.dispose==="function")e.dispose()}var Vc=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},zce=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Uce=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();if(this._seenReferenceKeys.has(t))return;this._seenReferenceKeys.add(t),this._references.push(e)}},Hce=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Vc(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new Uce;for(let n of e)Tce(n,this.initialScopeName,this.repo,t);for(let n of t.references)if(n instanceof Vc){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName))continue;if(this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function Tce(e,t,n,a){let r=n.lookup(e.scopeName);if(!r){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let i=n.lookup(t);if(e instanceof Vc)wu({baseGrammar:i,selfGrammar:r},a);else Kh(e.ruleName,{baseGrammar:i,selfGrammar:r,repository:r.repository},a);let o=n.injections(e.scopeName);if(o)for(let s of o)a.add(new Vc(s))}function Kh(e,t,n){if(t.repository&&t.repository[e]){let a=t.repository[e];Bu([a],t,n)}}function wu(e,t){if(e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns))Bu(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t);if(e.selfGrammar.injections)Bu(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Bu(e,t,n){for(let a of e){if(n.visitedRule.has(a))continue;n.visitedRule.add(a);let r=a.repository?KF({},t.repository,a.repository):t.repository;if(Array.isArray(a.patterns))Bu(a.patterns,{...t,repository:r},n);let i=a.include;if(!i)continue;let o=a2(i);switch(o.kind){case 0:wu({...t,selfGrammar:t.baseGrammar},n);break;case 1:wu(t,n);break;case 2:Kh(o.ruleName,{...t,repository:r},n);break;case 3:case 4:let s=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(s){let c={baseGrammar:t.baseGrammar,selfGrammar:s,repository:r};if(o.kind===4)Kh(o.ruleName,c,n);else wu(c,n)}else if(o.kind===4)n.add(new zce(o.scopeName,o.ruleName));else n.add(new Vc(o.scopeName));break}}}var Oce=class{kind=0},Zce=class{kind=1},Yce=class{constructor(e){this.ruleName=e}kind=2},Kce=class{constructor(e){this.scopeName=e}kind=3},Wce=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function a2(e){if(e==="$base")return new Oce;else if(e==="$self")return new Zce;let t=e.indexOf("#");if(t===-1)return new Kce(e);else if(t===0)return new Yce(e.substring(1));else{let n=e.substring(0,t),a=e.substring(t+1);return new Wce(n,a)}}var Jce=/\\(\d+)/,UF=/\\(\d+)/g,oYe=Symbol("RuleId"),Vce=-1,r2=-2;function i2(e){return e}function o2(e){return e}var tA=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,a){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=yu.hasCaptures(this._name),this._contentName=a||null,this._contentNameIsCapturing=yu.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${WF(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){if(!this._nameIsCapturing||this._name===null||e===null||t===null)return this._name;return yu.replaceCaptures(this._name,e,t)}getContentName(e,t){if(!this._contentNameIsCapturing||this._contentName===null)return this._contentName;return yu.replaceCaptures(this._contentName,e,t)}},Xce=class extends tA{retokenizeCapturedWithRuleId;constructor(e,t,n,a,r){super(e,t,n,a);this.retokenizeCapturedWithRuleId=r}dispose(){}collectPatterns(e,t){throw Error("Not supported!")}compile(e,t){throw Error("Not supported!")}compileAG(e,t,n,a){throw Error("Not supported!")}},eAe=class extends tA{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,a,r){super(e,t,n,null);this._match=new Xc(a,this.id),this.captures=r,this._cachedCompiledPatterns=null}dispose(){if(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,n,a){return this._getCachedCompiledPatterns(e).compileAG(e,n,a)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns)this._cachedCompiledPatterns=new eA,this.collectPatterns(e,this._cachedCompiledPatterns);return this._cachedCompiledPatterns}},HF=class extends tA{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,a,r){super(e,t,n,a);this.patterns=r.patterns,this.hasMissingPatterns=r.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,a){return this._getCachedCompiledPatterns(e).compileAG(e,n,a)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns)this._cachedCompiledPatterns=new eA,this.collectPatterns(e,this._cachedCompiledPatterns);return this._cachedCompiledPatterns}},Wh=class extends tA{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,a,r,i,o,s,c,A){super(e,t,n,a);this._begin=new Xc(r,this.id),this.beginCaptures=i,this._end=new Xc(o?o:"\uFFFF",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=A.patterns,this.hasMissingPatterns=A.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){if(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,n,a){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,a)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new eA;for(let n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns);if(this.applyEndPatternLast)this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end);else this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}if(this._end.hasBackReferences)if(this.applyEndPatternLast)this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t);else this._cachedCompiledPatterns.setSource(0,t);return this._cachedCompiledPatterns}},Cu=class extends tA{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,a,r,i,o,s,c){super(e,t,n,a);this._begin=new Xc(r,this.id),this.beginCaptures=i,this.whileCaptures=s,this._while=new Xc(o,r2),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null;if(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,n,a){return this._getCachedCompiledPatterns(e).compileAG(e,n,a)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new eA;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,n,a){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,a)}_getCachedCompiledWhilePatterns(e,t){if(!this._cachedCompiledWhilePatterns)this._cachedCompiledWhilePatterns=new eA,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while);if(this._while.hasBackReferences)this._cachedCompiledWhilePatterns.setSource(0,t?t:"\uFFFF");return this._cachedCompiledWhilePatterns}},s2=class e{static createCaptureRule(t,n,a,r,i){return t.registerRule((o)=>{return new Xce(n,o,a,r,i)})}static getCompiledRuleId(t,n,a){if(!t.id)n.registerRule((r)=>{if(t.id=r,t.match)return new eAe(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,a));if(typeof t.begin>"u"){if(t.repository)a=KF({},a,t.repository);let i=t.patterns;if(typeof i>"u"&&t.include)i=[{include:t.include}];return new HF(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,a))}if(t.while)return new Cu(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,a),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,a),e._compilePatterns(t.patterns,n,a));return new Wh(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,a),t.end,e._compileCaptures(t.endCaptures||t.captures,n,a),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,a))});return t.id}static _compileCaptures(t,n,a){let r=[];if(t){let i=0;for(let o in t){if(o==="$vscodeTextmateLocation")continue;let s=parseInt(o,10);if(s>i)i=s}for(let o=0;o<=i;o++)r[o]=null;for(let o in t){if(o==="$vscodeTextmateLocation")continue;let s=parseInt(o,10),c=0;if(t[o].patterns)c=e.getCompiledRuleId(t[o],n,a);r[s]=e.createCaptureRule(n,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,c)}}return r}static _compilePatterns(t,n,a){let r=[];if(t)for(let i=0,o=t.length;i<o;i++){let s=t[i],c=-1;if(s.include){let A=a2(s.include);switch(A.kind){case 0:case 1:c=e.getCompiledRuleId(a[s.include],n,a);break;case 2:let l=a[A.ruleName];if(l)c=e.getCompiledRuleId(l,n,a);break;case 3:case 4:let d=A.scopeName,u=A.kind===4?A.ruleName:null,p=n.getExternalGrammar(d,a);if(p)if(u){let g=p.repository[u];if(g)c=e.getCompiledRuleId(g,n,p.repository)}else c=e.getCompiledRuleId(p.repository.$self,n,p.repository);break}}else c=e.getCompiledRuleId(s,n,a);if(c!==-1){let A=n.getRule(c),l=!1;if(A instanceof HF||A instanceof Wh||A instanceof Cu){if(A.hasMissingPatterns&&A.patterns.length===0)l=!0}if(l)continue;r.push(c)}}return{patterns:r,hasMissingPatterns:(t?t.length:0)!==r.length}}},Xc=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(t,n){if(t&&typeof t==="string"){let a=t.length,r=0,i=[],o=!1;for(let s=0;s<a;s++)if(t.charAt(s)==="\\"){if(s+1<a){let A=t.charAt(s+1);if(A==="z")i.push(t.substring(r,s)),i.push("$(?!\\n)(?<!\\n)"),r=s+2;else if(A==="A"||A==="G")o=!0;s++}}if(this.hasAnchor=o,r===0)this.source=t;else i.push(t.substring(r,a)),this.source=i.join("")}else this.hasAnchor=!1,this.source=t;if(this.hasAnchor)this._anchorCache=this._buildAnchorCache();else this._anchorCache=null;if(this.ruleId=n,typeof this.source==="string")this.hasBackReferences=Jce.test(this.source);else this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(t){if(this.source===t)return;if(this.source=t,this.hasAnchor)this._anchorCache=this._buildAnchorCache()}resolveBackReferences(t,n){if(typeof this.source!=="string")throw Error("This method should only be called if the source is a string");let a=n.map((r)=>{return t.substring(r.start,r.end)});return UF.lastIndex=0,this.source.replace(UF,(r,i)=>{return XF(a[parseInt(i,10)]||"")})}_buildAnchorCache(){if(typeof this.source!=="string")throw Error("This method should only be called if the source is a string");let t=[],n=[],a=[],r=[],i,o,s,c;for(i=0,o=this.source.length;i<o;i++)if(s=this.source.charAt(i),t[i]=s,n[i]=s,a[i]=s,r[i]=s,s==="\\"){if(i+1<o){if(c=this.source.charAt(i+1),c==="A")t[i+1]="\uFFFF",n[i+1]="\uFFFF",a[i+1]="A",r[i+1]="A";else if(c==="G")t[i+1]="\uFFFF",n[i+1]="G",a[i+1]="\uFFFF",r[i+1]="G";else t[i+1]=c,n[i+1]=c,a[i+1]=c,r[i+1]=c;i++}}return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:a.join(""),A1_G1:r.join("")}}resolveAnchors(t,n){if(!this.hasAnchor||!this._anchorCache||typeof this.source!=="string")return this.source;if(t)if(n)return this._anchorCache.A1_G1;else return this._anchorCache.A1_G0;else if(n)return this._anchorCache.A0_G1;else return this._anchorCache.A0_G0}},eA=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(){if(this._cached)this._cached.dispose(),this._cached=null;if(this._anchorCache.A0_G0)this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null;if(this._anchorCache.A0_G1)this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null;if(this._anchorCache.A1_G0)this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null;if(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){if(this._items[e].source!==t)this._disposeCaches(),this._items[e].setSource(t)}compile(e){if(!this._cached){let t=this._items.map((n)=>n.source);this._cached=new TF(e,t,this._items.map((n)=>n.ruleId))}return this._cached}compileAG(e,t,n){if(!this._hasAnchors)return this.compile(e);else if(t)if(n){if(!this._anchorCache.A1_G1)this._anchorCache.A1_G1=this._resolveAnchors(e,t,n);return this._anchorCache.A1_G1}else{if(!this._anchorCache.A1_G0)this._anchorCache.A1_G0=this._resolveAnchors(e,t,n);return this._anchorCache.A1_G0}else if(n){if(!this._anchorCache.A0_G1)this._anchorCache.A0_G1=this._resolveAnchors(e,t,n);return this._anchorCache.A0_G1}else{if(!this._anchorCache.A0_G0)this._anchorCache.A0_G0=this._resolveAnchors(e,t,n);return this._anchorCache.A0_G0}}_resolveAnchors(e,t,n){let a=this._items.map((r)=>r.resolveAnchors(t,n));return new TF(e,a,this._items.map((r)=>r.ruleId))}},TF=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){if(typeof this.scanner.dispose==="function")this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
|
|
333
|
+
`)}function _F(e){let t=gce(e),n=uce("sha256");return n.update(t,"utf-8"),n.digest("hex")}function bce(e){if(e.type!=="paragraph")return!1;if(!("children"in e))return!1;let t=e;if(t.children.length===0)return!0;if(t.children.length===1&&t.children[0].type==="text"&&"value"in t.children[0]&&t.children[0].value.trim()==="")return!0;return!1}function ji(e,t){let n=mce(e),a=wh(e,{extensions:[AF(),zh(["yaml"])],mdastExtensions:[Gh(),Uh(["yaml"])]}),r=[],i=null,o=0,s=new Map;function c(l){while(o<n.length&&n[o].endOffset<=l)o++;if(o>0&&n[o-1].endOffset<=l){let d=n[o-1];if(!s.has(d.key))s.set(d.key,[]);return s.get(d.key).push({source:"marker",line:d.line}),{key:d.key,source:"marker"}}return{key:null,source:null}}for(let l of a.children){if(l.type==="yaml"){i="value"in l?l.value:null;continue}if(l.type==="definition")continue;if(bce(l))continue;if(pce(l))continue;let d=l.position;if(!d)continue;let u=d.start.line,p=d.end.line,g=d.start.offset??0,b=d.end.offset??e.length;if(l.type==="list"&&"children"in l){let C=l;for(let D of C.children){if(D.type!=="listItem")continue;let F=D.position;if(!F)continue;let I=F.start.offset??0,P=F.end.offset??e.length,G=e.slice(I,P),{key:W,source:z}=c(I);r.push({blockIndex:r.length,blockType:"listItem",blockKey:W,blockKeySource:z,startLine:F.start.line,endLine:F.end.line,startOffset:I,endOffset:P,blockFingerprint:_F(G)})}continue}let y=e.slice(g,b),{key:w,source:E}=c(g);r.push({blockIndex:r.length,blockType:l.type,blockKey:w,blockKeySource:E,startLine:u,endLine:p,startOffset:g,endOffset:b,blockFingerprint:_F(y)})}let A=[];for(let[l,d]of s)if(d.length>1)A.push({key:l,sources:d});return{blocks:r,frontmatter:i,markers:n,duplicateKeys:A}}var EF=["div","p","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","pre","code","table","thead","tbody","tfoot","tr","th","td","hr","br","details","summary","dl","dt","dd","a","span","strong","b","em","i","del","s","strike","ins","sup","sub","mark","kbd","abbr","img","input"],vF=["math","mrow","mi","mo","mn","ms","mtext","mspace","msup","msub","msubsup","mover","munder","munderover","mfrac","msqrt","mroot","mtable","mtr","mtd","mth","menclose","mfenced","mmultiscripts","mprescripts","none","semantics","annotation","annotation-xml"],LZe=["svg","iframe","embed","object","script","style","link","meta","base","form","button","select","textarea","frame","frameset",...vF],fce={"*":["id","class","data-block-id","data-block-index","data-block-type"],a:["href","title","rel","target","referrerpolicy"],img:["src","alt","title","width","height","loading"],ol:["start"],th:["align","valign","scope","colspan","rowspan"],td:["align","valign","colspan","rowspan"],code:["class"],pre:["class"],input:["type","checked","disabled","tabindex","aria-hidden"],abbr:["title"]},QF={tagNames:[...EF],attributes:fce,protocols:{href:["https","http","mailto"],src:["https"]},strip:["script","style"],clobberPrefix:"ts-",clobber:["name","id"]};var xF=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var hce=/["&'<>`]/g,yce=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,wce=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,kce=/[|\\{}()[\]^$+*?.]/g,IF=new WeakMap;function DF(e,t){if(e=e.replace(t.subset?Bce(t.subset):hce,a),t.subset||t.escapeOnly)return e;return e.replace(yce,n).replace(wce,a);function n(r,i,o){return t.format((r.charCodeAt(0)-55296)*1024+r.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),t)}function a(r,i,o){return t.format(r.charCodeAt(0),o.charCodeAt(i+1),t)}}function Bce(e){let t=IF.get(e);if(!t)t=Cce(e),IF.set(e,t);return t}function Cce(e){let t=[],n=-1;while(++n<e.length)t.push(e[n].replace(kce,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}var _ce=/[\dA-Fa-f]/;function FF(e,t,n){let a="&#x"+e.toString(16).toUpperCase();return n&&t&&!_ce.test(String.fromCharCode(t))?a:a+";"}var Ece=/\d/;function $F(e,t,n){let a="&#"+String(e);return n&&t&&!Ece.test(String.fromCharCode(t))?a:a+";"}var SF=["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 fu={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 LF=["cent","copy","divide","gt","lt","not","para","times"];var jF={}.hasOwnProperty,Hh={},hu;for(hu in fu)if(jF.call(fu,hu))Hh[fu[hu]]=hu;var vce=/[^\dA-Za-z]/;function qF(e,t,n,a){let r=String.fromCharCode(e);if(jF.call(Hh,r)){let i=Hh[r],o="&"+i;if(n&&SF.includes(i)&&!LF.includes(i)&&(!a||t&&t!==61&&vce.test(String.fromCharCode(t))))return o;return o+";"}return""}function NF(e,t,n){let a=FF(e,t,n.omitOptionalSemicolons),r;if(n.useNamedReferences||n.useShortestReferences)r=qF(e,t,n.omitOptionalSemicolons,n.attribute);if((n.useShortestReferences||!r)&&n.useShortestReferences){let i=$F(e,t,n.omitOptionalSemicolons);if(i.length<a.length)a=i}return r&&(!n.useShortestReferences||r.length<a.length)?r:a}function Oa(e,t){return DF(e,Object.assign({format:NF},t))}function MF(e,t){let n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function GF(e){return e.join(" ").trim()}var Qce=/[ \t\n\f\r]/g;function qi(e){return typeof e==="object"?e.type==="text"?RF(e.value):!1:RF(e)}function RF(e){return e.replace(Qce,"")===""}class ut extends Error{constructor(e){super(e);this.name="ShikiError"}}function xce(e){return Vh(e)}function Vh(e){if(Array.isArray(e))return Ice(e);if(e instanceof RegExp)return e;if(typeof e==="object")return Dce(e);return e}function Ice(e){let t=[];for(let n=0,a=e.length;n<a;n++)t[n]=Vh(e[n]);return t}function Dce(e){let t={};for(let n in e)t[n]=Vh(e[n]);return t}function KF(e,...t){return t.forEach((n)=>{for(let a in n)e[a]=n[a]}),e}function WF(e){let t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");if(t===0)return e;else if(~t===e.length-1)return WF(e.substring(0,e.length-1));else return e.substr(~t+1)}var Th=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,yu=class{static hasCaptures(e){if(e===null)return!1;return Th.lastIndex=0,Th.test(e)}static replaceCaptures(e,t,n){return e.replace(Th,(a,r,i,o)=>{let s=n[parseInt(r||i,10)];if(s){let c=t.substring(s.start,s.end);while(c[0]===".")c=c.substring(1);switch(o){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return a})}};function JF(e,t){if(e<t)return-1;if(e>t)return 1;return 0}function VF(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,a=t.length;if(n===a){for(let r=0;r<n;r++){let i=JF(e[r],t[r]);if(i!==0)return i}return 0}return n-a}function PF(e){if(/^#[0-9a-f]{6}$/i.test(e))return!0;if(/^#[0-9a-f]{8}$/i.test(e))return!0;if(/^#[0-9a-f]{3}$/i.test(e))return!0;if(/^#[0-9a-f]{4}$/i.test(e))return!0;return!1}function XF(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var e2=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}},Jc=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(Sce(e),t)}static createFromParsedTheme(e,t){return jce(e,t)}_cachedMatchRoot=new e2((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,a=this._cachedMatchRoot.get(t).find((r)=>Fce(e.parent,r.parentScopes));if(!a)return null;return new t2(a.fontStyle,a.foreground,a.background)}},Oh=class e{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(let a of n)t=new e(t,a);return t}static from(...t){let n=null;for(let a=0;a<t.length;a++)n=new e(n,t[a]);return n}push(t){return new e(this,t)}getSegments(){let t=this,n=[];while(t)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){if(this===t)return!0;if(this.parent===null)return!1;return this.parent.extends(t)}getExtensionIfDefined(t){let n=[],a=this;while(a&&a!==t)n.push(a.scopeName),a=a.parent;return a===t?n.reverse():void 0}};function Fce(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let a=t[n],r=!1;if(a===">"){if(n===t.length-1)return!1;a=t[++n],r=!0}while(e){if($ce(e.scopeName,a))break;if(r)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function $ce(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var t2=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function Sce(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],a=0;for(let r=0,i=t.length;r<i;r++){let o=t[r];if(!o.settings)continue;let s;if(typeof o.scope==="string"){let d=o.scope;d=d.replace(/^[,]+/,""),d=d.replace(/[,]+$/,""),s=d.split(",")}else if(Array.isArray(o.scope))s=o.scope;else s=[""];let c=-1;if(typeof o.settings.fontStyle==="string"){c=0;let d=o.settings.fontStyle.split(" ");for(let u=0,p=d.length;u<p;u++)switch(d[u]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let A=null;if(typeof o.settings.foreground==="string"&&PF(o.settings.foreground))A=o.settings.foreground;let l=null;if(typeof o.settings.background==="string"&&PF(o.settings.background))l=o.settings.background;for(let d=0,u=s.length;d<u;d++){let g=s[d].trim().split(" "),b=g[g.length-1],y=null;if(g.length>1)y=g.slice(0,g.length-1),y.reverse();n[a++]=new Lce(b,y,r,c,A,l)}}return n}var Lce=class{constructor(e,t,n,a,r,i){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=a,this.foreground=r,this.background=i}},xt=((e)=>{return 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})(xt||{});function jce(e,t){e.sort((c,A)=>{let l=JF(c.scope,A.scope);if(l!==0)return l;if(l=VF(c.parentScopes,A.parentScopes),l!==0)return l;return c.index-A.index});let n=0,a="#000000",r="#ffffff";while(e.length>=1&&e[0].scope===""){let c=e.shift();if(c.fontStyle!==-1)n=c.fontStyle;if(c.foreground!==null)a=c.foreground;if(c.background!==null)r=c.background}let i=new qce(t),o=new t2(n,i.getId(a),i.getId(r)),s=new Mce(new Yh(0,null,-1,0,0),[]);for(let c=0,A=e.length;c<A;c++){let l=e[c];s.insert(0,l.scope,l.parentScopes,l.fontStyle,i.getId(l.foreground),i.getId(l.background))}return new Jc(i,o,s)}var qce=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,n=e.length;t<n;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 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)}},Nce=Object.freeze([]),Yh=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(t,n,a,r,i){this.scopeDepth=t,this.parentScopes=n||Nce,this.fontStyle=a,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let a=0,r=t.length;a<r;a++)n[a]=t[a].clone();return n}acceptOverwrite(t,n,a,r){if(this.scopeDepth>t)console.log("how did this happen?");else this.scopeDepth=t;if(n!==-1)this.fontStyle=n;if(a!==0)this.foreground=a;if(r!==0)this.background=r}},Mce=class e{constructor(t,n=[],a={}){this._mainRule=t,this._children=a,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let a=0,r=0;while(!0){if(t.parentScopes[a]===">")a++;if(n.parentScopes[r]===">")r++;if(a>=t.parentScopes.length||r>=n.parentScopes.length)break;let i=n.parentScopes[r].length-t.parentScopes[a].length;if(i!==0)return i;a++,r++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let a=t.indexOf("."),r,i;if(a===-1)r=t,i="";else r=t.substring(0,a),i=t.substring(a+1);if(this._children.hasOwnProperty(r))return this._children[r].match(i)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,a,r,i,o){if(n===""){this._doInsertHere(t,a,r,i,o);return}let s=n.indexOf("."),c,A;if(s===-1)c=n,A="";else c=n.substring(0,s),A=n.substring(s+1);let l;if(this._children.hasOwnProperty(c))l=this._children[c];else l=new e(this._mainRule.clone(),Yh.cloneArr(this._rulesWithParentScopes)),this._children[c]=l;l.insert(t+1,A,a,r,i,o)}_doInsertHere(t,n,a,r,i){if(n===null){this._mainRule.acceptOverwrite(t,a,r,i);return}for(let o=0,s=this._rulesWithParentScopes.length;o<s;o++){let c=this._rulesWithParentScopes[o];if(VF(c.parentScopes,n)===0){c.acceptOverwrite(t,a,r,i);return}}if(a===-1)a=this._mainRule.fontStyle;if(r===0)r=this._mainRule.foreground;if(i===0)i=this._mainRule.background;this._rulesWithParentScopes.push(new Yh(t,n,a,r,i))}},Ni=class e{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){let n=e.getLanguageId(t),a=e.getTokenType(t),r=e.getFontStyle(t),i=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:a,fontStyle:r,foreground:i,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,n,a,r,i,o,s){let c=e.getLanguageId(t),A=e.getTokenType(t),l=e.containsBalancedBrackets(t)?1:0,d=e.getFontStyle(t),u=e.getForeground(t),p=e.getBackground(t);if(n!==0)c=n;if(a!==8)A=Rce(a);if(r!==null)l=r?1:0;if(i!==-1)d=i;if(o!==0)u=o;if(s!==0)p=s;return(c<<0|A<<8|l<<10|d<<11|u<<15|p<<24)>>>0}};function Gce(e){return e}function Rce(e){return e}function ku(e,t){let n=[],a=Pce(e),r=a.next();while(r!==null){let c=0;if(r.length===2&&r.charAt(1)===":"){switch(r.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${r} in scope selector`)}r=a.next()}let A=o();if(n.push({matcher:A,priority:c}),r!==",")break;r=a.next()}return n;function i(){if(r==="-"){r=a.next();let c=i();return(A)=>!!c&&!c(A)}if(r==="("){r=a.next();let c=s();if(r===")")r=a.next();return c}if(zF(r)){let c=[];do c.push(r),r=a.next();while(zF(r));return(A)=>t(c,A)}return null}function o(){let c=[],A=i();while(A)c.push(A),A=i();return(l)=>c.every((d)=>d(l))}function s(){let c=[],A=o();while(A){if(c.push(A),r==="|"||r===",")do r=a.next();while(r==="|"||r===",");else break;A=o()}return(l)=>c.some((d)=>d(l))}}function zF(e){return!!e&&!!e.match(/[\w\.:]+/)}function Pce(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let a=n[0];return n=t.exec(e),a}}}function n2(e){if(typeof e.dispose==="function")e.dispose()}var Vc=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},zce=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Uce=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();if(this._seenReferenceKeys.has(t))return;this._seenReferenceKeys.add(t),this._references.push(e)}},Hce=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Vc(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new Uce;for(let n of e)Tce(n,this.initialScopeName,this.repo,t);for(let n of t.references)if(n instanceof Vc){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName))continue;if(this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function Tce(e,t,n,a){let r=n.lookup(e.scopeName);if(!r){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let i=n.lookup(t);if(e instanceof Vc)wu({baseGrammar:i,selfGrammar:r},a);else Kh(e.ruleName,{baseGrammar:i,selfGrammar:r,repository:r.repository},a);let o=n.injections(e.scopeName);if(o)for(let s of o)a.add(new Vc(s))}function Kh(e,t,n){if(t.repository&&t.repository[e]){let a=t.repository[e];Bu([a],t,n)}}function wu(e,t){if(e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns))Bu(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t);if(e.selfGrammar.injections)Bu(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function Bu(e,t,n){for(let a of e){if(n.visitedRule.has(a))continue;n.visitedRule.add(a);let r=a.repository?KF({},t.repository,a.repository):t.repository;if(Array.isArray(a.patterns))Bu(a.patterns,{...t,repository:r},n);let i=a.include;if(!i)continue;let o=a2(i);switch(o.kind){case 0:wu({...t,selfGrammar:t.baseGrammar},n);break;case 1:wu(t,n);break;case 2:Kh(o.ruleName,{...t,repository:r},n);break;case 3:case 4:let s=o.scopeName===t.selfGrammar.scopeName?t.selfGrammar:o.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(s){let c={baseGrammar:t.baseGrammar,selfGrammar:s,repository:r};if(o.kind===4)Kh(o.ruleName,c,n);else wu(c,n)}else if(o.kind===4)n.add(new zce(o.scopeName,o.ruleName));else n.add(new Vc(o.scopeName));break}}}var Oce=class{kind=0},Zce=class{kind=1},Yce=class{constructor(e){this.ruleName=e}kind=2},Kce=class{constructor(e){this.scopeName=e}kind=3},Wce=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function a2(e){if(e==="$base")return new Oce;else if(e==="$self")return new Zce;let t=e.indexOf("#");if(t===-1)return new Kce(e);else if(t===0)return new Yce(e.substring(1));else{let n=e.substring(0,t),a=e.substring(t+1);return new Wce(n,a)}}var Jce=/\\(\d+)/,UF=/\\(\d+)/g,oYe=Symbol("RuleId"),Vce=-1,r2=-2;function i2(e){return e}function o2(e){return e}var tA=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,a){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=yu.hasCaptures(this._name),this._contentName=a||null,this._contentNameIsCapturing=yu.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${WF(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){if(!this._nameIsCapturing||this._name===null||e===null||t===null)return this._name;return yu.replaceCaptures(this._name,e,t)}getContentName(e,t){if(!this._contentNameIsCapturing||this._contentName===null)return this._contentName;return yu.replaceCaptures(this._contentName,e,t)}},Xce=class extends tA{retokenizeCapturedWithRuleId;constructor(e,t,n,a,r){super(e,t,n,a);this.retokenizeCapturedWithRuleId=r}dispose(){}collectPatterns(e,t){throw Error("Not supported!")}compile(e,t){throw Error("Not supported!")}compileAG(e,t,n,a){throw Error("Not supported!")}},eAe=class extends tA{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,a,r){super(e,t,n,null);this._match=new Xc(a,this.id),this.captures=r,this._cachedCompiledPatterns=null}dispose(){if(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,n,a){return this._getCachedCompiledPatterns(e).compileAG(e,n,a)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns)this._cachedCompiledPatterns=new eA,this.collectPatterns(e,this._cachedCompiledPatterns);return this._cachedCompiledPatterns}},HF=class extends tA{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,a,r){super(e,t,n,a);this.patterns=r.patterns,this.hasMissingPatterns=r.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,a){return this._getCachedCompiledPatterns(e).compileAG(e,n,a)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns)this._cachedCompiledPatterns=new eA,this.collectPatterns(e,this._cachedCompiledPatterns);return this._cachedCompiledPatterns}},Wh=class extends tA{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,a,r,i,o,s,c,A){super(e,t,n,a);this._begin=new Xc(r,this.id),this.beginCaptures=i,this._end=new Xc(o?o:"\uFFFF",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=A.patterns,this.hasMissingPatterns=A.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){if(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,n,a){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,a)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new eA;for(let n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns);if(this.applyEndPatternLast)this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end);else this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}if(this._end.hasBackReferences)if(this.applyEndPatternLast)this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t);else this._cachedCompiledPatterns.setSource(0,t);return this._cachedCompiledPatterns}},Cu=class extends tA{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,a,r,i,o,s,c){super(e,t,n,a);this._begin=new Xc(r,this.id),this.beginCaptures=i,this.whileCaptures=s,this._while=new Xc(o,r2),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){if(this._cachedCompiledPatterns)this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null;if(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,n,a){return this._getCachedCompiledPatterns(e).compileAG(e,n,a)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new eA;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,n,a){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,a)}_getCachedCompiledWhilePatterns(e,t){if(!this._cachedCompiledWhilePatterns)this._cachedCompiledWhilePatterns=new eA,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while);if(this._while.hasBackReferences)this._cachedCompiledWhilePatterns.setSource(0,t?t:"\uFFFF");return this._cachedCompiledWhilePatterns}},s2=class e{static createCaptureRule(t,n,a,r,i){return t.registerRule((o)=>{return new Xce(n,o,a,r,i)})}static getCompiledRuleId(t,n,a){if(!t.id)n.registerRule((r)=>{if(t.id=r,t.match)return new eAe(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,a));if(typeof t.begin>"u"){if(t.repository)a=KF({},a,t.repository);let i=t.patterns;if(typeof i>"u"&&t.include)i=[{include:t.include}];return new HF(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,a))}if(t.while)return new Cu(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,a),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,a),e._compilePatterns(t.patterns,n,a));return new Wh(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,a),t.end,e._compileCaptures(t.endCaptures||t.captures,n,a),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,a))});return t.id}static _compileCaptures(t,n,a){let r=[];if(t){let i=0;for(let o in t){if(o==="$vscodeTextmateLocation")continue;let s=parseInt(o,10);if(s>i)i=s}for(let o=0;o<=i;o++)r[o]=null;for(let o in t){if(o==="$vscodeTextmateLocation")continue;let s=parseInt(o,10),c=0;if(t[o].patterns)c=e.getCompiledRuleId(t[o],n,a);r[s]=e.createCaptureRule(n,t[o].$vscodeTextmateLocation,t[o].name,t[o].contentName,c)}}return r}static _compilePatterns(t,n,a){let r=[];if(t)for(let i=0,o=t.length;i<o;i++){let s=t[i],c=-1;if(s.include){let A=a2(s.include);switch(A.kind){case 0:case 1:c=e.getCompiledRuleId(a[s.include],n,a);break;case 2:let l=a[A.ruleName];if(l)c=e.getCompiledRuleId(l,n,a);break;case 3:case 4:let d=A.scopeName,u=A.kind===4?A.ruleName:null,p=n.getExternalGrammar(d,a);if(p)if(u){let g=p.repository[u];if(g)c=e.getCompiledRuleId(g,n,p.repository)}else c=e.getCompiledRuleId(p.repository.$self,n,p.repository);break}}else c=e.getCompiledRuleId(s,n,a);if(c!==-1){let A=n.getRule(c),l=!1;if(A instanceof HF||A instanceof Wh||A instanceof Cu){if(A.hasMissingPatterns&&A.patterns.length===0)l=!0}if(l)continue;r.push(c)}}return{patterns:r,hasMissingPatterns:(t?t.length:0)!==r.length}}},Xc=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(t,n){if(t&&typeof t==="string"){let a=t.length,r=0,i=[],o=!1;for(let s=0;s<a;s++)if(t.charAt(s)==="\\"){if(s+1<a){let A=t.charAt(s+1);if(A==="z")i.push(t.substring(r,s)),i.push("$(?!\\n)(?<!\\n)"),r=s+2;else if(A==="A"||A==="G")o=!0;s++}}if(this.hasAnchor=o,r===0)this.source=t;else i.push(t.substring(r,a)),this.source=i.join("")}else this.hasAnchor=!1,this.source=t;if(this.hasAnchor)this._anchorCache=this._buildAnchorCache();else this._anchorCache=null;if(this.ruleId=n,typeof this.source==="string")this.hasBackReferences=Jce.test(this.source);else this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(t){if(this.source===t)return;if(this.source=t,this.hasAnchor)this._anchorCache=this._buildAnchorCache()}resolveBackReferences(t,n){if(typeof this.source!=="string")throw Error("This method should only be called if the source is a string");let a=n.map((r)=>{return t.substring(r.start,r.end)});return UF.lastIndex=0,this.source.replace(UF,(r,i)=>{return XF(a[parseInt(i,10)]||"")})}_buildAnchorCache(){if(typeof this.source!=="string")throw Error("This method should only be called if the source is a string");let t=[],n=[],a=[],r=[],i,o,s,c;for(i=0,o=this.source.length;i<o;i++)if(s=this.source.charAt(i),t[i]=s,n[i]=s,a[i]=s,r[i]=s,s==="\\"){if(i+1<o){if(c=this.source.charAt(i+1),c==="A")t[i+1]="\uFFFF",n[i+1]="\uFFFF",a[i+1]="A",r[i+1]="A";else if(c==="G")t[i+1]="\uFFFF",n[i+1]="G",a[i+1]="\uFFFF",r[i+1]="G";else t[i+1]=c,n[i+1]=c,a[i+1]=c,r[i+1]=c;i++}}return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:a.join(""),A1_G1:r.join("")}}resolveAnchors(t,n){if(!this.hasAnchor||!this._anchorCache||typeof this.source!=="string")return this.source;if(t)if(n)return this._anchorCache.A1_G1;else return this._anchorCache.A1_G0;else if(n)return this._anchorCache.A0_G1;else return this._anchorCache.A0_G0}},eA=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(){if(this._cached)this._cached.dispose(),this._cached=null;if(this._anchorCache.A0_G0)this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null;if(this._anchorCache.A0_G1)this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null;if(this._anchorCache.A1_G0)this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null;if(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){if(this._items[e].source!==t)this._disposeCaches(),this._items[e].setSource(t)}compile(e){if(!this._cached){let t=this._items.map((n)=>n.source);this._cached=new TF(e,t,this._items.map((n)=>n.ruleId))}return this._cached}compileAG(e,t,n){if(!this._hasAnchors)return this.compile(e);else if(t)if(n){if(!this._anchorCache.A1_G1)this._anchorCache.A1_G1=this._resolveAnchors(e,t,n);return this._anchorCache.A1_G1}else{if(!this._anchorCache.A1_G0)this._anchorCache.A1_G0=this._resolveAnchors(e,t,n);return this._anchorCache.A1_G0}else if(n){if(!this._anchorCache.A0_G1)this._anchorCache.A0_G1=this._resolveAnchors(e,t,n);return this._anchorCache.A0_G1}else{if(!this._anchorCache.A0_G0)this._anchorCache.A0_G0=this._resolveAnchors(e,t,n);return this._anchorCache.A0_G0}}_resolveAnchors(e,t,n){let a=this._items.map((r)=>r.resolveAnchors(t,n));return new TF(e,a,this._items.map((r)=>r.ruleId))}},TF=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){if(typeof this.scanner.dispose==="function")this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
|
|
332
334
|
`)}findNextMatchSync(e,t,n){let a=this.scanner.findNextMatchSync(e,t,n);if(!a)return null;return{ruleId:this.rules[a.index],captureIndices:a.captureIndices}}},Zh=class{constructor(e,t){this.languageId=e,this.tokenType=t}},tAe=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(t,n){this._defaultAttributes=new Zh(t,8),this._embeddedLanguagesMatcher=new nAe(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){if(t===null)return e._NULL_SCOPE_METADATA;return this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new Zh(0,0);_getBasicScopeAttributes=new e2((t)=>{let n=this._scopeToLanguage(t),a=this._toStandardTokenType(t);return new Zh(n,a)});_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},nAe=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(([n,a])=>XF(n));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;return this.values.get(t[1])}},sYe={InDebugMode:typeof process<"u"&&!!process.env.VSCODE_TEXTMATE_DEBUG},c2=!1,OF=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function A2(e,t,n,a,r,i,o,s){let c=t.content.length,A=!1,l=-1;if(o){let p=aAe(e,t,n,a,r,i);r=p.stack,a=p.linePos,n=p.isFirstLine,l=p.anchorPosition}let d=Date.now();while(!A){if(s!==0){if(Date.now()-d>s)return new OF(r,!0)}u()}return new OF(r,!1);function u(){let p=rAe(e,t,n,a,r,l);if(!p){i.produce(r,c),A=!0;return}let{captureIndices:g,matchedRuleId:b}=p,y=g&&g.length>0?g[0].end>a:!1;if(b===Vce){let w=r.getRule(e);i.produce(r,g[0].start),r=r.withContentNameScopesList(r.nameScopesList),Kc(e,t,n,r,i,w.endCaptures,g),i.produce(r,g[0].end);let E=r;if(r=r.parent,l=E.getAnchorPos(),!y&&E.getEnterPos()===a){r=E,i.produce(r,c),A=!0;return}}else{let w=e.getRule(b);i.produce(r,g[0].start);let E=r,C=w.getName(t.content,g),D=r.contentNameScopesList.pushAttributed(C,e);if(r=r.push(b,a,l,g[0].end===c,null,D,D),w instanceof Wh){let F=w;Kc(e,t,n,r,i,F.beginCaptures,g),i.produce(r,g[0].end),l=g[0].end;let I=F.getContentName(t.content,g),P=D.pushAttributed(I,e);if(r=r.withContentNameScopesList(P),F.endHasBackReferences)r=r.withEndRule(F.getEndWithResolvedBackReferences(t.content,g));if(!y&&E.hasSameRuleAs(r)){r=r.pop(),i.produce(r,c),A=!0;return}}else if(w instanceof Cu){let F=w;Kc(e,t,n,r,i,F.beginCaptures,g),i.produce(r,g[0].end),l=g[0].end;let I=F.getContentName(t.content,g),P=D.pushAttributed(I,e);if(r=r.withContentNameScopesList(P),F.whileHasBackReferences)r=r.withEndRule(F.getWhileWithResolvedBackReferences(t.content,g));if(!y&&E.hasSameRuleAs(r)){r=r.pop(),i.produce(r,c),A=!0;return}}else if(Kc(e,t,n,r,i,w.captures,g),i.produce(r,g[0].end),r=r.pop(),!y){r=r.safePop(),i.produce(r,c),A=!0;return}}if(g[0].end>a)a=g[0].end,n=!1}}function aAe(e,t,n,a,r,i){let o=r.beginRuleCapturedEOL?0:-1,s=[];for(let c=r;c;c=c.pop()){let A=c.getRule(e);if(A instanceof Cu)s.push({rule:A,stack:c})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:A,findOptions:l}=sAe(c.rule,e,c.stack.endRule,n,a===o),d=A.findNextMatchSync(t,a,l);if(d){if(d.ruleId!==r2){r=c.stack.pop();break}if(d.captureIndices&&d.captureIndices.length){if(i.produce(c.stack,d.captureIndices[0].start),Kc(e,t,n,c.stack,i,c.rule.whileCaptures,d.captureIndices),i.produce(c.stack,d.captureIndices[0].end),o=d.captureIndices[0].end,d.captureIndices[0].end>a)a=d.captureIndices[0].end,n=!1}}else{r=c.stack.pop();break}}return{stack:r,linePos:a,anchorPosition:o,isFirstLine:n}}function rAe(e,t,n,a,r,i){let o=iAe(e,t,n,a,r,i),s=e.getInjections();if(s.length===0)return o;let c=oAe(s,e,t,n,a,r,i);if(!c)return o;if(!o)return c;let A=o.captureIndices[0].start,l=c.captureIndices[0].start;if(l<A||c.priorityMatch&&l===A)return c;return o}function iAe(e,t,n,a,r,i){let o=r.getRule(e),{ruleScanner:s,findOptions:c}=l2(o,e,r.endRule,n,a===i),A=s.findNextMatchSync(t,a,c);if(A)return{captureIndices:A.captureIndices,matchedRuleId:A.ruleId};return null}function oAe(e,t,n,a,r,i,o){let s=Number.MAX_VALUE,c=null,A,l=0,d=i.contentNameScopesList.getScopeNames();for(let u=0,p=e.length;u<p;u++){let g=e[u];if(!g.matcher(d))continue;let b=t.getRule(g.ruleId),{ruleScanner:y,findOptions:w}=l2(b,t,null,a,r===o),E=y.findNextMatchSync(n,r,w);if(!E)continue;let C=E.captureIndices[0].start;if(C>=s)continue;if(s=C,c=E.captureIndices,A=E.ruleId,l=g.priority,s===r)break}if(c)return{priorityMatch:l===-1,captureIndices:c,matchedRuleId:A};return null}function l2(e,t,n,a,r){if(c2){let o=e.compile(t,n),s=d2(a,r);return{ruleScanner:o,findOptions:s}}return{ruleScanner:e.compileAG(t,n,a,r),findOptions:0}}function sAe(e,t,n,a,r){if(c2){let o=e.compileWhile(t,n),s=d2(a,r);return{ruleScanner:o,findOptions:s}}return{ruleScanner:e.compileWhileAG(t,n,a,r),findOptions:0}}function d2(e,t){let n=0;if(!e)n|=1;if(!t)n|=4;return n}function Kc(e,t,n,a,r,i,o){if(i.length===0)return;let s=t.content,c=Math.min(i.length,o.length),A=[],l=o[0].end;for(let d=0;d<c;d++){let u=i[d];if(u===null)continue;let p=o[d];if(p.length===0)continue;if(p.start>l)break;while(A.length>0&&A[A.length-1].endPos<=p.start)r.produceFromScopes(A[A.length-1].scopes,A[A.length-1].endPos),A.pop();if(A.length>0)r.produceFromScopes(A[A.length-1].scopes,p.start);else r.produce(a,p.start);if(u.retokenizeCapturedWithRuleId){let b=u.getName(s,o),y=a.contentNameScopesList.pushAttributed(b,e),w=u.getContentName(s,o),E=y.pushAttributed(w,e),C=a.push(u.retokenizeCapturedWithRuleId,p.start,-1,!1,null,y,E),D=e.createOnigString(s.substring(0,p.end));A2(e,D,n&&p.start===0,p.start,C,r,!1,0),n2(D);continue}let g=u.getName(s,o);if(g!==null){let y=(A.length>0?A[A.length-1].scopes:a.contentNameScopesList).pushAttributed(g,e);A.push(new cAe(y,p.end))}}while(A.length>0)r.produceFromScopes(A[A.length-1].scopes,A[A.length-1].endPos),A.pop()}var cAe=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function AAe(e,t,n,a,r,i,o,s){return new dAe(e,t,n,a,r,i,o,s)}function ZF(e,t,n,a,r){let i=ku(t,_u),o=s2.getCompiledRuleId(n,a,r.repository);for(let s of i)e.push({debugSelector:t,matcher:s.matcher,ruleId:o,grammar:r,priority:s.priority})}function _u(e,t){if(t.length<e.length)return!1;let n=0;return e.every((a)=>{for(let r=n;r<t.length;r++)if(lAe(t[r],a))return n=r+1,!0;return!1})}function lAe(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]==="."}var dAe=class{constructor(e,t,n,a,r,i,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=i,this._onigLib=s,this._basicScopeAttributesProvider=new tAe(n,a),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=YF(t,null),this._injections=null,this._tokenTypeMatchers=[],r)for(let c of Object.keys(r)){let A=ku(c,_u);for(let l of A)this._tokenTypeMatchers.push({matcher:l.matcher,type:r[c]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)if(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:(r)=>{if(r===this._rootScopeName)return this._grammar;return this.getExternalGrammar(r)},injections:(r)=>{return this._grammarRepository.injections(r)}},t=[],n=this._rootScopeName,a=e.lookup(n);if(a){let r=a.injections;if(r)for(let o in r)ZF(t,o,r[o],this,a);let i=this._grammarRepository.injections(n);if(i)i.forEach((o)=>{let s=this.getExternalGrammar(o);if(s){let c=s.injectionSelector;if(c)ZF(t,c,s,this,s)}})}return t.sort((r,i)=>r.priority-i.priority),t}getInjections(){if(this._injections===null)this._injections=this._collectInjections();return this._injections}registerRule(e){let t=++this._lastRuleId,n=e(i2(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[o2(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];else if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=YF(n,t&&t.$base),this._includedGrammars[e]}return}tokenizeLine(e,t,n=0){let a=this._tokenize(e,t,!1,n);return{tokens:a.lineTokens.getResult(a.ruleStack,a.lineLength),ruleStack:a.ruleStack,stoppedEarly:a.stoppedEarly}}tokenizeLine2(e,t,n=0){let a=this._tokenize(e,t,!0,n);return{tokens:a.lineTokens.getBinaryResult(a.ruleStack,a.lineLength),ruleStack:a.ruleStack,stoppedEarly:a.stoppedEarly}}_tokenize(e,t,n,a){if(this._rootId===-1)this._rootId=s2.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections();let r;if(!t||t===Jh.NULL){r=!0;let A=this._basicScopeAttributesProvider.getDefaultAttributes(),l=this.themeProvider.getDefaults(),d=Ni.set(0,A.languageId,A.tokenType,null,l.fontStyle,l.foregroundId,l.backgroundId),u=this.getRule(this._rootId).getName(null,null),p;if(u)p=Wc.createRootAndLookUpScopeName(u,d,this);else p=Wc.createRoot("unknown",d);t=new Jh(null,this._rootId,-1,-1,!1,null,p,p)}else r=!1,t.reset();e=e+`
|
|
333
335
|
`;let i=this.createOnigString(e),o=i.content.length,s=new pAe(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=A2(this,i,r,0,t,s,!0,a);return n2(i),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function YF(e,t){return e=xce(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 Wc=class e{constructor(t,n,a){this.parent=t,this.scopePath=n,this.tokenAttributes=a}static fromExtension(t,n){let a=t,r=t?.scopePath??null;for(let i of n)r=Oh.push(r,i.scopeNames),a=new e(a,r,i.encodedTokenAttributes);return a}static createRoot(t,n){return new e(null,new Oh(null,t),n)}static createRootAndLookUpScopeName(t,n,a){let r=a.getMetadataForScope(t),i=new Oh(null,t),o=a.themeProvider.themeMatch(i),s=e.mergeAttributes(n,r,o);return new e(null,i,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return e.equals(this,t)}static equals(t,n){do{if(t===n)return!0;if(!t&&!n)return!0;if(!t||!n)return!1;if(t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,a){let r=-1,i=0,o=0;if(a!==null)r=a.fontStyle,i=a.foregroundId,o=a.backgroundId;return Ni.set(t,n.languageId,n.tokenType,null,r,i,o)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return e._pushAttributed(this,t,n);let a=t.split(/ /g),r=this;for(let i of a)r=e._pushAttributed(r,i,n);return r}static _pushAttributed(t,n,a){let r=a.getMetadataForScope(n),i=t.scopePath.push(n),o=a.themeProvider.themeMatch(i),s=e.mergeAttributes(t.tokenAttributes,r,o);return new e(t,i,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){let n=[],a=this;while(a&&a!==t)n.push({encodedTokenAttributes:a.tokenAttributes,scopeNames:a.scopePath.getExtensionIfDefined(a.parent?.scopePath??null)}),a=a.parent;return a===t?n.reverse():void 0}},Jh=class e{constructor(t,n,a,r,i,o,s,c){this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=s,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=a,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){if(t===null)return!1;return e._equals(this,t)}static _equals(t,n){if(t===n)return!0;if(!this._structuralEquals(t,n))return!1;return Wc.equals(t.contentNameScopesList,n.contentNameScopesList)}static _structuralEquals(t,n){do{if(t===n)return!0;if(!t&&!n)return!0;if(!t||!n)return!1;if(t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){while(t)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){if(this.parent)return this.parent;return this}push(t,n,a,r,i,o,s){return new e(this,t,n,a,r,i,o,s)}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,n){if(this.parent)n=this.parent._writeString(t,n);return t[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(t){if(this.contentNameScopesList===t)return this;return this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){if(this.endRule===t)return this;return new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;while(n&&n._enterPos===t._enterPos){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:o2(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,n){let a=Wc.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,i2(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,a,Wc.fromExtension(a,n.contentNameScopesList))}},uAe=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap((n)=>{if(n==="*")return this.allowAny=!0,[];return ku(n,_u).map((a)=>a.matcher)}),this.unbalancedBracketScopes=t.flatMap((n)=>ku(n,_u).map((a)=>a.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}},pAe=class{constructor(e,t,n,a){this.balancedBracketSelectors=a,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,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 a=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways)r=!0;if(this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let i=e?.getScopeNames()??[];for(let o of this._tokenTypeOverrides)if(o.matcher(i))a=Ni.set(a,0,Gce(o.type),null,-1,0,0);if(this.balancedBracketSelectors)r=this.balancedBracketSelectors.match(i)}if(r)a=Ni.set(a,0,8,r,-1,0,0);if(this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===a){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(a),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){if(this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1)this._tokens.pop();if(this._tokens.length===0)this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0;return this._tokens}getBinaryResult(e,t){if(this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1)this._binaryTokens.pop(),this._binaryTokens.pop();if(this._binaryTokens.length===0)this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0;let n=new Uint32Array(this._binaryTokens.length);for(let a=0,r=this._binaryTokens.length;a<r;a++)n[a]=this._binaryTokens[a];return n}},mAe=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){if(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,n,a,r){if(!this._grammars.has(e)){let i=this._rawGrammars.get(e);if(!i)return null;this._grammars.set(e,AAe(e,i,t,n,a,r,this,this._onigLib))}return this._grammars.get(e)}},u2=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new mAe(Jc.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(Jc.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new uAe(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,a,r){let i=new Hce(this._syncRegistry,e);while(i.Q.length>0)i.Q.map((o)=>this._loadSingleGrammar(o.scopeName)),i.processQueue();return this._grammarForScopeName(e,t,n,a,r)}_loadSingleGrammar(e){if(!this._ensureGrammarCache.has(e))this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0)}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,a=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,a)}_grammarForScopeName(e,t=0,n=null,a=null,r=null){return this._syncRegistry.grammarForScopeName(e,t,n,a,r)}},Eu=Jh.NULL;class Sr{constructor(e,t,n){if(this.normal=t,this.property=e,n)this.space=n}}Sr.prototype.normal={};Sr.prototype.property={};Sr.prototype.space=void 0;function Xh(e,t){let n={},a={};for(let r of e)Object.assign(n,r.property),Object.assign(a,r.normal);return new Sr(n,a,t)}function nA(e){return e.toLowerCase()}class Nt{constructor(e,t){this.attribute=t,this.property=e}}Nt.prototype.attribute="";Nt.prototype.booleanish=!1;Nt.prototype.boolean=!1;Nt.prototype.commaOrSpaceSeparated=!1;Nt.prototype.commaSeparated=!1;Nt.prototype.defined=!1;Nt.prototype.mustUseProperty=!1;Nt.prototype.number=!1;Nt.prototype.overloadedBoolean=!1;Nt.prototype.property="";Nt.prototype.spaceSeparated=!1;Nt.prototype.space=void 0;var aA={};Q(aA,{spaceSeparated:()=>Oe,overloadedBoolean:()=>vu,number:()=>re,commaSeparated:()=>Lr,commaOrSpaceSeparated:()=>cn,booleanish:()=>pt,boolean:()=>Ie});var gAe=0,Ie=Mi(),pt=Mi(),vu=Mi(),re=Mi(),Oe=Mi(),Lr=Mi(),cn=Mi();function Mi(){return 2**++gAe}var ey=Object.keys(aA);class To extends Nt{constructor(e,t,n,a){let r=-1;super(e,t);if(p2(this,"space",a),typeof n==="number")while(++r<ey.length){let i=ey[r];p2(this,ey[r],(n&aA[i])===aA[i])}}}To.prototype.defined=!0;function p2(e,t,n){if(n)e[t]=n}function jn(e){let t={},n={};for(let[a,r]of Object.entries(e.properties)){let i=new To(a,e.transform(e.attributes||{},a),r,e.space);if(e.mustUseProperty&&e.mustUseProperty.includes(a))i.mustUseProperty=!0;t[a]=i,n[nA(a)]=a,n[nA(i.attribute)]=a}return new Sr(t,n,e.space)}var ty=jn({properties:{ariaActiveDescendant:null,ariaAtomic:pt,ariaAutoComplete:null,ariaBusy:pt,ariaChecked:pt,ariaColCount:re,ariaColIndex:re,ariaColSpan:re,ariaControls:Oe,ariaCurrent:null,ariaDescribedBy:Oe,ariaDetails:null,ariaDisabled:pt,ariaDropEffect:Oe,ariaErrorMessage:null,ariaExpanded:pt,ariaFlowTo:Oe,ariaGrabbed:pt,ariaHasPopup:null,ariaHidden:pt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Oe,ariaLevel:re,ariaLive:null,ariaModal:pt,ariaMultiLine:pt,ariaMultiSelectable:pt,ariaOrientation:null,ariaOwns:Oe,ariaPlaceholder:null,ariaPosInSet:re,ariaPressed:pt,ariaReadOnly:pt,ariaRelevant:null,ariaRequired:pt,ariaRoleDescription:Oe,ariaRowCount:re,ariaRowIndex:re,ariaRowSpan:re,ariaSelected:pt,ariaSetSize:re,ariaSort:null,ariaValueMax:re,ariaValueMin:re,ariaValueNow:re,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function Qu(e,t){return t in e?e[t]:t}function xu(e,t){return Qu(e,t.toLowerCase())}var m2=jn({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Lr,acceptCharset:Oe,accessKey:Oe,action:null,allow:null,allowFullScreen:Ie,allowPaymentRequest:Ie,allowUserMedia:Ie,alt:null,as:null,async:Ie,autoCapitalize:null,autoComplete:Oe,autoFocus:Ie,autoPlay:Ie,blocking:Oe,capture:null,charSet:null,checked:Ie,cite:null,className:Oe,cols:re,colSpan:null,content:null,contentEditable:pt,controls:Ie,controlsList:Oe,coords:re|Lr,crossOrigin:null,data:null,dateTime:null,decoding:null,default:Ie,defer:Ie,dir:null,dirName:null,disabled:Ie,download:vu,draggable:pt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:Ie,formTarget:null,headers:Oe,height:re,hidden:vu,high:re,href:null,hrefLang:null,htmlFor:Oe,httpEquiv:Oe,id:null,imageSizes:null,imageSrcSet:null,inert:Ie,inputMode:null,integrity:null,is:null,isMap:Ie,itemId:null,itemProp:Oe,itemRef:Oe,itemScope:Ie,itemType:Oe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:Ie,low:re,manifest:null,max:null,maxLength:re,media:null,method:null,min:null,minLength:re,multiple:Ie,muted:Ie,name:null,nonce:null,noModule:Ie,noValidate:Ie,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:Ie,optimum:re,pattern:null,ping:Oe,placeholder:null,playsInline:Ie,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:Ie,referrerPolicy:null,rel:Oe,required:Ie,reversed:Ie,rows:re,rowSpan:re,sandbox:Oe,scope:null,scoped:Ie,seamless:Ie,selected:Ie,shadowRootClonable:Ie,shadowRootDelegatesFocus:Ie,shadowRootMode:null,shape:null,size:re,sizes:null,slot:null,span:re,spellCheck:pt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:re,step:null,style:null,tabIndex:re,target:null,title:null,translate:null,type:null,typeMustMatch:Ie,useMap:null,value:pt,width:re,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Oe,axis:null,background:null,bgColor:null,border:re,borderColor:null,bottomMargin:re,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:Ie,declare:Ie,event:null,face:null,frame:null,frameBorder:null,hSpace:re,leftMargin:re,link:null,longDesc:null,lowSrc:null,marginHeight:re,marginWidth:re,noResize:Ie,noHref:Ie,noShade:Ie,noWrap:Ie,object:null,profile:null,prompt:null,rev:null,rightMargin:re,rules:null,scheme:null,scrolling:pt,standby:null,summary:null,text:null,topMargin:re,valueType:null,version:null,vAlign:null,vLink:null,vSpace:re,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:Ie,disableRemotePlayback:Ie,prefix:null,property:null,results:re,security:null,unselectable:null},space:"html",transform:xu});var g2=jn({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",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:cn,accentHeight:re,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:re,amplitude:re,arabicForm:null,ascent:re,attributeName:null,attributeType:null,azimuth:re,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:re,by:null,calcMode:null,capHeight:re,className:Oe,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:re,diffuseConstant:re,direction:null,display:null,dur:null,divisor:re,dominantBaseline:null,download:Ie,dx:null,dy:null,edgeMode:null,editable:null,elevation:re,enableBackground:null,end:null,event:null,exponent:re,externalResourcesRequired:null,fill:null,fillOpacity:re,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:Lr,g2:Lr,glyphName:Lr,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:re,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:re,horizOriginX:re,horizOriginY:re,id:null,ideographic:re,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:re,k:re,k1:re,k2:re,k3:re,k4:re,kernelMatrix:cn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:re,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:re,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:re,overlineThickness:re,paintOrder:null,panose1:null,path:null,pathLength:re,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Oe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:re,pointsAtY:re,pointsAtZ:re,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:cn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:cn,rev:cn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:cn,requiredFeatures:cn,requiredFonts:cn,requiredFormats:cn,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:re,specularExponent:re,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:re,strikethroughThickness:re,string:null,stroke:null,strokeDashArray:cn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:re,strokeOpacity:re,strokeWidth:null,style:null,surfaceScale:re,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:cn,tabIndex:re,tableValues:null,target:null,targetX:re,targetY:re,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:cn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:re,underlineThickness:re,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:re,values:null,vAlphabetic:re,vMathematical:re,vectorEffect:null,vHanging:re,vIdeographic:re,version:null,vertAdvY:re,vertOriginX:re,vertOriginY:re,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:re,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Qu});var ny=jn({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 ay=jn({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:xu});var ry=jn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}});var bAe=/[A-Z]/g,b2=/-[a-z]/g,fAe=/^data[-\w.:]+$/i;function iy(e,t){let n=nA(t),a=t,r=Nt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&fAe.test(t)){if(t.charAt(4)==="-"){let i=t.slice(5).replace(b2,yAe);a="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{let i=t.slice(4);if(!b2.test(i)){let o=i.replace(bAe,hAe);if(o.charAt(0)!=="-")o="-"+o;t="data"+o}}r=To}return new r(a,t)}function hAe(e){return"-"+e.toLowerCase()}function yAe(e){return e.charAt(1).toUpperCase()}var f2=Xh([ty,m2,ny,ay,ry],"html"),Iu=Xh([ty,g2,ny,ay,ry],"svg");var wAe=/^>|^->|<!--|-->|--!>|<!-$/g,kAe=[">"],BAe=["<",">"];function h2(e,t,n,a){return a.settings.bogusComments?"<?"+Oa(e.value,Object.assign({},a.settings.characterReferences,{subset:kAe}))+">":"<!--"+e.value.replace(wAe,r)+"-->";function r(i){return Oa(i,Object.assign({},a.settings.characterReferences,{subset:BAe}))}}function y2(e,t,n,a){return"<!"+(a.settings.upperDoctype?"DOCTYPE":"doctype")+(a.settings.tightDoctype?"":" ")+"html>"}var bt=w2(1),oy=w2(-1),CAe=[];function w2(e){return t;function t(n,a,r){let i=n?n.children:CAe,o=(a||0)+e,s=i[o];if(!r)while(s&&qi(s))o+=e,s=i[o];return s}}var _Ae={}.hasOwnProperty;function Du(e){return t;function t(n,a,r){return _Ae.call(e,n.tagName)&&e[n.tagName](n,a,r)}}var rA=Du({body:vAe,caption:sy,colgroup:sy,dd:DAe,dt:IAe,head:sy,html:EAe,li:xAe,optgroup:FAe,option:$Ae,p:QAe,rp:k2,rt:k2,tbody:LAe,td:B2,tfoot:jAe,th:B2,thead:SAe,tr:qAe});function sy(e,t,n){let a=bt(n,t,!0);return!a||a.type!=="comment"&&!(a.type==="text"&&qi(a.value.charAt(0)))}function EAe(e,t,n){let a=bt(n,t);return!a||a.type!=="comment"}function vAe(e,t,n){let a=bt(n,t);return!a||a.type!=="comment"}function QAe(e,t,n){let a=bt(n,t);return a?a.type==="element"&&(a.tagName==="address"||a.tagName==="article"||a.tagName==="aside"||a.tagName==="blockquote"||a.tagName==="details"||a.tagName==="div"||a.tagName==="dl"||a.tagName==="fieldset"||a.tagName==="figcaption"||a.tagName==="figure"||a.tagName==="footer"||a.tagName==="form"||a.tagName==="h1"||a.tagName==="h2"||a.tagName==="h3"||a.tagName==="h4"||a.tagName==="h5"||a.tagName==="h6"||a.tagName==="header"||a.tagName==="hgroup"||a.tagName==="hr"||a.tagName==="main"||a.tagName==="menu"||a.tagName==="nav"||a.tagName==="ol"||a.tagName==="p"||a.tagName==="pre"||a.tagName==="section"||a.tagName==="table"||a.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function xAe(e,t,n){let a=bt(n,t);return!a||a.type==="element"&&a.tagName==="li"}function IAe(e,t,n){let a=bt(n,t);return Boolean(a&&a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd"))}function DAe(e,t,n){let a=bt(n,t);return!a||a.type==="element"&&(a.tagName==="dt"||a.tagName==="dd")}function k2(e,t,n){let a=bt(n,t);return!a||a.type==="element"&&(a.tagName==="rp"||a.tagName==="rt")}function FAe(e,t,n){let a=bt(n,t);return!a||a.type==="element"&&a.tagName==="optgroup"}function $Ae(e,t,n){let a=bt(n,t);return!a||a.type==="element"&&(a.tagName==="option"||a.tagName==="optgroup")}function SAe(e,t,n){let a=bt(n,t);return Boolean(a&&a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot"))}function LAe(e,t,n){let a=bt(n,t);return!a||a.type==="element"&&(a.tagName==="tbody"||a.tagName==="tfoot")}function jAe(e,t,n){return!bt(n,t)}function qAe(e,t,n){let a=bt(n,t);return!a||a.type==="element"&&a.tagName==="tr"}function B2(e,t,n){let a=bt(n,t);return!a||a.type==="element"&&(a.tagName==="td"||a.tagName==="th")}var C2=Du({body:GAe,colgroup:RAe,head:MAe,html:NAe,tbody:PAe});function NAe(e){let t=bt(e,-1);return!t||t.type!=="comment"}function MAe(e){let t=new Set;for(let a of e.children)if(a.type==="element"&&(a.tagName==="base"||a.tagName==="title")){if(t.has(a.tagName))return!1;t.add(a.tagName)}let n=e.children[0];return!n||n.type==="element"}function GAe(e){let t=bt(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&qi(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function RAe(e,t,n){let a=oy(n,t),r=bt(e,-1,!0);if(n&&a&&a.type==="element"&&a.tagName==="colgroup"&&rA(a,n.children.indexOf(a),n))return!1;return Boolean(r&&r.type==="element"&&r.tagName==="col")}function PAe(e,t,n){let a=oy(n,t),r=bt(e,-1);if(n&&a&&a.type==="element"&&(a.tagName==="thead"||a.tagName==="tbody")&&rA(a,n.children.indexOf(a),n))return!1;return Boolean(r&&r.type==="element"&&r.tagName==="tr")}var Fu={name:[[`
|
|
334
336
|
\f\r &/=>`.split(""),`
|
|
@@ -866,6 +868,8 @@ Options:
|
|
|
866
868
|
--file <path> Local file with updated content (upload mode)
|
|
867
869
|
--stdin Read updated content from stdin (upload mode)
|
|
868
870
|
--title <title> Title for the new session (default: predecessor's title)
|
|
871
|
+
--message <text> Changes summary shown in round-transition emails and
|
|
872
|
+
the superseded banner (alias: --changes-summary)
|
|
869
873
|
--reviewer <email> Add a new reviewer (repeatable)
|
|
870
874
|
--reviewers <list> Comma-separated new reviewer emails
|
|
871
875
|
--approver <email> Add a new approver (repeatable)
|
|
@@ -881,6 +885,9 @@ Examples:
|
|
|
881
885
|
# Upload supersede with local file
|
|
882
886
|
typescape session supersede --session sess_abc123 --file ./draft-v2.md --title "v2"
|
|
883
887
|
|
|
888
|
+
# Include a changes summary for reviewers
|
|
889
|
+
typescape session supersede --session sess_abc123 --file ./v2.md --message "Rewrote auth section"
|
|
890
|
+
|
|
884
891
|
# Pipe updated content
|
|
885
892
|
agent revise draft.md | typescape session supersede --session sess_abc123 --stdin
|
|
886
893
|
`)}function RMe(){console.log(`Typescape CLI - checks run
|