@sentry/junior-dashboard 0.279.0 → 0.281.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/app.js +105 -43
- package/dist/client-manifest.json +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +105 -43
- package/dist/public/chunks/AdminPage-M5RBVZFN.js +1 -0
- package/dist/public/chunks/AutomationPage-WALCREDT.js +3 -0
- package/dist/public/chunks/AutomationRunsPage-CV47E4UX.js +1 -0
- package/dist/public/chunks/AutomationsPage-57L3AQVJ.js +1 -0
- package/dist/public/chunks/CodePage-XJUYMFJH.js +1 -0
- package/dist/public/chunks/ConnectionsPage-3QQAGYWF.js +1 -0
- package/dist/public/chunks/DrawerContent-RYYS57ZH.js +1 -0
- package/dist/public/chunks/LocationDetailPage-4IL5HQML.js +1 -0
- package/dist/public/chunks/LocationsPage-D2DUQAHJ.js +1 -0
- package/dist/public/chunks/McpSettingsPage-3RT7JPEK.js +1 -0
- package/dist/public/chunks/PeoplePage-6F5GPQ7C.js +1 -0
- package/dist/public/chunks/PersonProfilePage-SPAYQPTD.js +1 -0
- package/dist/public/chunks/PersonalTokensPage-SHAUJ74M.js +1 -0
- package/dist/public/chunks/PluginUserPage-64FIWD7M.js +1 -0
- package/dist/public/chunks/RepositoryPage-L7IHOXSN.js +1 -0
- package/dist/public/chunks/SettingsPage-U7WG4FHE.js +1 -0
- package/dist/public/chunks/SystemPage-ZBC43OJH.js +1 -0
- package/dist/public/chunks/WorkspaceFormPage-3NVIIZ4P.js +2 -0
- package/dist/public/chunks/WorkspacesPage-G73HPBDD.js +1 -0
- package/dist/public/chunks/chunk-2BCS5AQL.js +1 -0
- package/dist/public/chunks/chunk-2J3LGF5Q.js +1 -0
- package/dist/public/chunks/chunk-2NNKHSZE.js +1 -0
- package/dist/public/chunks/chunk-3Y3ICT6K.js +1 -0
- package/dist/public/chunks/chunk-4AKUZW6R.js +1 -0
- package/dist/public/chunks/chunk-4TQSTCIN.js +13 -0
- package/dist/public/chunks/chunk-4UGZNVJM.js +1 -0
- package/dist/public/chunks/chunk-564V7YHG.js +1 -0
- package/dist/public/chunks/chunk-5ISD3QSC.js +1 -0
- package/dist/public/chunks/chunk-5LNGNJ3P.js +1 -0
- package/dist/public/chunks/chunk-5ZA674OU.js +1 -0
- package/dist/public/chunks/chunk-64GPEGGE.js +1 -0
- package/dist/public/chunks/chunk-6FHY65EQ.js +1 -0
- package/dist/public/chunks/chunk-6FSJ3W2W.js +1 -0
- package/dist/public/chunks/chunk-6PHJZPWD.js +19 -0
- package/dist/public/chunks/chunk-B5ZN3SWQ.js +14 -0
- package/dist/public/chunks/chunk-BKOACADP.js +1 -0
- package/dist/public/chunks/chunk-CQY6BYUB.js +1 -0
- package/dist/public/chunks/chunk-CR2ICLSH.js +1 -0
- package/dist/public/chunks/chunk-DEEO4D4N.js +1 -0
- package/dist/public/chunks/chunk-DZB4LPI6.js +1 -0
- package/dist/public/chunks/chunk-FE522UEA.js +1 -0
- package/dist/public/chunks/chunk-FSGVY7HB.js +1 -0
- package/dist/public/chunks/chunk-FVX42XAD.js +1 -0
- package/dist/public/chunks/chunk-G5NWYJTV.js +1 -0
- package/dist/public/chunks/chunk-GMZIELFU.js +1 -0
- package/dist/public/chunks/chunk-GOTQ4D6W.js +1 -0
- package/dist/public/chunks/chunk-GYRM5ZIV.js +1 -0
- package/dist/public/chunks/chunk-GZBMHYYU.js +1 -0
- package/dist/public/chunks/chunk-H2ZU34CP.js +1 -0
- package/dist/public/chunks/chunk-H76B43OQ.js +1 -0
- package/dist/public/chunks/chunk-HCLRG2EC.js +1 -0
- package/dist/public/chunks/chunk-II4NXLSQ.js +2 -0
- package/dist/public/chunks/chunk-ILH47V7O.js +1 -0
- package/dist/public/chunks/chunk-IZWTFLCC.js +1 -0
- package/dist/public/chunks/chunk-J37MXUED.js +1 -0
- package/dist/public/chunks/chunk-JAZABOBA.js +0 -0
- package/dist/public/chunks/chunk-JPL2NRWK.js +1 -0
- package/dist/public/chunks/chunk-JVJ5UWIK.js +1 -0
- package/dist/public/chunks/chunk-K4TYMAA3.js +63 -0
- package/dist/public/chunks/chunk-KDUTK357.js +1 -0
- package/dist/public/chunks/chunk-L2H3ZWZN.js +1 -0
- package/dist/public/chunks/chunk-LBELRO5P.js +1 -0
- package/dist/public/chunks/chunk-LKW7MULF.js +1 -0
- package/dist/public/chunks/chunk-LZYAHJVQ.js +1 -0
- package/dist/public/chunks/chunk-MEHLQZDG.js +3 -0
- package/dist/public/chunks/chunk-MKKFXRYO.js +1 -0
- package/dist/public/chunks/chunk-MTBUV2GJ.js +1 -0
- package/dist/public/chunks/chunk-NGQRNS3C.js +1 -0
- package/dist/public/chunks/chunk-ONDKE72P.js +1 -0
- package/dist/public/chunks/chunk-PG7M7L24.js +1 -0
- package/dist/public/chunks/chunk-PQPAPPEI.js +1 -0
- package/dist/public/chunks/chunk-PXHLJIOT.js +1 -0
- package/dist/public/chunks/chunk-QOX5RMLM.js +1 -0
- package/dist/public/chunks/chunk-QPBLZSNX.js +1 -0
- package/dist/public/chunks/chunk-QQUFROWT.js +1 -0
- package/dist/public/chunks/chunk-RB5FBDEY.js +1 -0
- package/dist/public/chunks/chunk-RGXXD4DM.js +41 -0
- package/dist/public/chunks/chunk-RHMZNAJX.js +1 -0
- package/dist/public/chunks/chunk-SIOW7OOW.js +1 -0
- package/dist/public/chunks/chunk-SUX4QBVF.js +1 -0
- package/dist/public/chunks/chunk-T4M53QQT.js +1 -0
- package/dist/public/chunks/chunk-TC7TU4GK.js +1 -0
- package/dist/public/chunks/chunk-TFJOEF3Q.js +1 -0
- package/dist/public/chunks/chunk-UJD3MBMB.js +1 -0
- package/dist/public/chunks/chunk-UK2V4UBT.js +1 -0
- package/dist/public/chunks/chunk-UT6HZPGL.js +1 -0
- package/dist/public/chunks/chunk-UZ44J2LH.js +1 -0
- package/dist/public/chunks/chunk-VC6IS564.js +1 -0
- package/dist/public/chunks/chunk-WLIOZO3W.js +1 -0
- package/dist/public/chunks/chunk-WRXMQB7X.js +25 -0
- package/dist/public/chunks/chunk-XDUSY26N.js +55 -0
- package/dist/public/chunks/chunk-XNR4RZEC.js +1 -0
- package/dist/public/chunks/chunk-YPMUHXYT.js +147 -0
- package/dist/public/chunks/chunk-ZIJ6SJDN.js +1 -0
- package/dist/public/chunks/code-highlighter-Q7WC7AEF.js +12 -0
- package/dist/public/client-4OAAOHF4.js +68 -0
- package/dist/tailwind.css +1 -1
- package/package.json +5 -4
- package/src/api/schema.ts +1 -1
- package/src/assets.ts +4 -1
- package/src/client/App.tsx +100 -23
- package/src/client/TracedRoutes.tsx +8 -4
- package/src/client/code-highlighter.ts +26 -0
- package/src/client/code.tsx +2 -22
- package/src/client/components/BottomSheet.tsx +1 -1
- package/src/client/components/DetailsPanel.tsx +2 -1
- package/src/client/components/Drawer.tsx +12 -71
- package/src/client/components/DrawerContent.tsx +76 -0
- package/src/client/components/ProfileMenu.tsx +12 -3
- package/src/client/components/UserInputForm.tsx +28 -5
- package/src/client/conversations/ConversationBrief.tsx +129 -65
- package/src/client/conversations/ConversationCatchUp.tsx +107 -0
- package/src/client/conversations/ConversationContextTags.tsx +110 -0
- package/src/client/conversations/ConversationDetails.tsx +13 -14
- package/src/client/conversations/ConversationEventLog.tsx +135 -70
- package/src/client/conversations/ConversationHeader.tsx +74 -65
- package/src/client/conversations/ConversationHeaderActions.tsx +36 -38
- package/src/client/conversations/ConversationHomeList.tsx +41 -3
- package/src/client/conversations/ConversationLinkedWork.tsx +30 -10
- package/src/client/conversations/ConversationMeta.tsx +21 -27
- package/src/client/conversations/ConversationOverflowMenu.tsx +15 -4
- package/src/client/conversations/ConversationPage.tsx +219 -157
- package/src/client/conversations/ConversationTranscript.tsx +234 -186
- package/src/client/conversations/ConversationUsageBreakdown.tsx +142 -64
- package/src/client/conversations/DetailsList.tsx +7 -1
- package/src/client/conversations/PendingMailboxStack.tsx +88 -44
- package/src/client/conversations/ShareConversationButton.tsx +5 -50
- package/src/client/conversations/SlackMark.tsx +16 -4
- package/src/client/conversations/TranscriptActivityGroup.tsx +7 -14
- package/src/client/conversations/TranscriptEventView.tsx +7 -3
- package/src/client/conversations/TranscriptReasoningView.tsx +4 -2
- package/src/client/conversations/TranscriptRows.tsx +61 -16
- package/src/client/conversations/TranscriptView.tsx +25 -13
- package/src/client/conversations/conversationArchive.ts +22 -0
- package/src/client/conversations/conversationCatchUpState.ts +96 -0
- package/src/client/conversations/conversationMemory.ts +8 -1
- package/src/client/conversations/queries.ts +85 -46
- package/src/client/conversations/{transcriptUnreadHistory.ts → transcriptAroundHistory.ts} +48 -42
- package/src/client/conversations/transcriptBottomPinning.ts +40 -8
- package/src/client/conversations/transcriptListRows.ts +215 -0
- package/src/client/conversations/transcriptReadPosition.ts +24 -2
- package/src/client/conversations/turnContext.ts +1 -1
- package/src/client/conversations/virtualRows.ts +168 -0
- package/src/client/http.ts +6 -5
- package/src/client/pages/admin/AdminPage.tsx +1 -1
- package/src/client/pages/admin/ServiceAccountsSection.tsx +1 -1
- package/src/client/pages/memory/memoryDashboard.ts +1 -1
- package/src/client/pages/memory/memoryRecord.ts +1 -1
- package/src/client/pages/settings/ConnectionsPage.tsx +1 -1
- package/src/client/pages/user/PluginUserPage.tsx +0 -6
- package/src/client/pages/user/pluginUserPageRoutes.ts +5 -0
- package/src/client/primaryNav.ts +1 -1
- package/src/client/review-desk/reviewItemFormat.ts +1 -1
- package/src/client/sentry.ts +53 -3
- package/src/conversation-cache.ts +8 -10
- package/src/mock-reporting/fixtures.ts +43 -8
- package/src/mock-reporting/routes.ts +40 -3
- package/src/public-assets.ts +28 -20
- package/src/shell.ts +12 -2
- package/dist/public/client-ZCZXZBTL.js +0 -460
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{b as Je,c as Qe,d as Z,e as Ce,f as Xe,g as Ze,h as $,i as et}from"./chunk-T4M53QQT.js";import"./chunk-7SZRL6FY.js";var S=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function bn(t){return Le(t)}function Le(t){return Array.isArray(t)?Sn(t):t instanceof RegExp?t:typeof t=="object"?wn(t):t}function Sn(t){let e=[];for(let n=0,r=t.length;n<r;n++)e[n]=Le(t[n]);return e}function wn(t){let e={};for(let n in t)e[n]=Le(t[n]);return e}function lt(t,...e){return e.forEach(n=>{for(let r in n)t[r]=n[r]}),t}function ut(t){let e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?ut(t.substring(0,t.length-1)):t.substr(~e+1)}var ke=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,ee=class{static hasCaptures(t){return t===null?!1:(ke.lastIndex=0,ke.test(t))}static replaceCaptures(t,e,n){return t.replace(ke,(r,s,i,o)=>{let a=n[parseInt(s||i,10)];if(a){let c=e.substring(a.start,a.end);for(;c[0]===".";)c=c.substring(1);switch(o){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function ht(t,e){return t<e?-1:t>e?1:0}function ft(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,r=e.length;if(n===r){for(let s=0;s<n;s++){let i=ht(t[s],e[s]);if(i!==0)return i}return 0}return n-r}function tt(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function dt(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var mt=class{constructor(t){this.fn=t}cache=new Map;get(t){if(this.cache.has(t))return this.cache.get(t);let e=this.fn(t);return this.cache.set(t,e),e}},W=class{constructor(t,e,n){this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(Rn(t),e)}static createFromParsedTheme(t,e){return Tn(t,e)}_cachedMatchRoot=new mt(t=>this._root.match(t));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;let e=t.scopeName,r=this._cachedMatchRoot.get(e).find(s=>Cn(t.parent,s.parentScopes));return r?new gt(r.fontStyle,r.foreground,r.background):null}},Re=class te{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(let r of n)e=new te(e,r);return e}static from(...e){let n=null;for(let r=0;r<e.length;r++)n=new te(n,e[r]);return n}push(e){return new te(this,e)}getSegments(){let e=this,n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){let n=[],r=this;for(;r&&r!==e;)n.push(r.scopeName),r=r.parent;return r===e?n.reverse():void 0}};function Cn(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let r=e[n],s=!1;if(r===">"){if(n===e.length-1)return!1;r=e[++n],s=!0}for(;t&&!kn(t.scopeName,r);){if(s)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function kn(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var gt=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function Rn(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],r=0;for(let s=0,i=e.length;s<i;s++){let o=e[s];if(!o.settings)continue;let a;if(typeof o.scope=="string"){let h=o.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),a=h.split(",")}else Array.isArray(o.scope)?a=o.scope:a=[""];let c=-1;if(typeof o.settings.fontStyle=="string"){c=0;let h=o.settings.fontStyle.split(" ");for(let f=0,d=h.length;f<d;f++)switch(h[f]){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 l=null;typeof o.settings.foreground=="string"&&tt(o.settings.foreground)&&(l=o.settings.foreground);let u=null;typeof o.settings.background=="string"&&tt(o.settings.background)&&(u=o.settings.background);for(let h=0,f=a.length;h<f;h++){let m=a[h].trim().split(" "),b=m[m.length-1],_=null;m.length>1&&(_=m.slice(0,m.length-1),_.reverse()),n[r++]=new Nn(b,_,s,c,l,u)}}return n}var Nn=class{constructor(t,e,n,r,s,i){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=r,this.foreground=s,this.background=i}},R=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(R||{});function Tn(t,e){t.sort((c,l)=>{let u=ht(c.scope,l.scope);return u!==0||(u=ft(c.parentScopes,l.parentScopes),u!==0)?u:c.index-l.index});let n=0,r="#000000",s="#ffffff";for(;t.length>=1&&t[0].scope==="";){let c=t.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(r=c.foreground),c.background!==null&&(s=c.background)}let i=new vn(e),o=new gt(n,i.getId(r),i.getId(s)),a=new En(new Te(0,null,-1,0,0),[]);for(let c=0,l=t.length;c<l;c++){let u=t[c];a.insert(0,u.scope,u.parentScopes,u.fontStyle,i.getId(u.foreground),i.getId(u.background))}return new W(i,o,a)}var vn=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(t){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},An=Object.freeze([]),Te=class pt{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,n,r,s,i){this.scopeDepth=e,this.parentScopes=n||An,this.fontStyle=r,this.foreground=s,this.background=i}clone(){return new pt(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let r=0,s=e.length;r<s;r++)n[r]=e[r].clone();return n}acceptOverwrite(e,n,r,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},En=class ve{constructor(e,n=[],r={}){this._mainRule=e,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let r=0,s=0;for(;e.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=e.parentScopes.length||s>=n.parentScopes.length);){let i=n.parentScopes[s].length-e.parentScopes[r].length;if(i!==0)return i;r++,s++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),s,i;if(r===-1?(s=e,i=""):(s=e.substring(0,r),i=e.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(i)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(ve._cmpBySpecificity),n}insert(e,n,r,s,i,o){if(n===""){this._doInsertHere(e,r,s,i,o);return}let a=n.indexOf("."),c,l;a===-1?(c=n,l=""):(c=n.substring(0,a),l=n.substring(a+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new ve(this._mainRule.clone(),Te.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(e+1,l,r,s,i,o)}_doInsertHere(e,n,r,s,i){if(n===null){this._mainRule.acceptOverwrite(e,r,s,i);return}for(let o=0,a=this._rulesWithParentScopes.length;o<a;o++){let c=this._rulesWithParentScopes[o];if(ft(c.parentScopes,n)===0){c.acceptOverwrite(e,r,s,i);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new Te(e,n,r,s,i))}},G=class T{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){let n=T.getLanguageId(e),r=T.getTokenType(e),s=T.getFontStyle(e),i=T.getForeground(e),o=T.getBackground(e);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:i,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,r,s,i,o,a){let c=T.getLanguageId(e),l=T.getTokenType(e),u=T.containsBalancedBrackets(e)?1:0,h=T.getFontStyle(e),f=T.getForeground(e),d=T.getBackground(e);return n!==0&&(c=n),r!==8&&(l=r),s!==null&&(u=s?1:0),i!==-1&&(h=i),o!==0&&(f=o),a!==0&&(d=a),(c<<0|l<<8|u<<10|h<<11|f<<15|d<<24)>>>0}};function re(t,e){let n=[],r=xn(t),s=r.next();for(;s!==null;){let c=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let l=o();if(n.push({matcher:l,priority:c}),s!==",")break;s=r.next()}return n;function i(){if(s==="-"){s=r.next();let c=i();return l=>!!c&&!c(l)}if(s==="("){s=r.next();let c=a();return s===")"&&(s=r.next()),c}if(nt(s)){let c=[];do c.push(s),s=r.next();while(nt(s));return l=>e(c,l)}return null}function o(){let c=[],l=i();for(;l;)c.push(l),l=i();return u=>c.every(h=>h(u))}function a(){let c=[],l=o();for(;l&&(c.push(l),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");l=o()}return u=>c.some(h=>h(u))}}function nt(t){return!!t&&!!t.match(/[\w\.:]+/)}function xn(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;let r=n[0];return n=e.exec(t),r}}}function _t(t){typeof t.dispose=="function"&&t.dispose()}var H=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},In=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},Ln=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(t){let e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},Pn=class{constructor(t,e){this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new H(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let t=this.Q;this.Q=[];let e=new Ln;for(let n of t)Gn(n,this.initialScopeName,this.repo,e);for(let n of e.references)if(n instanceof H){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function Gn(t,e,n,r){let s=n.lookup(t.scopeName);if(!s){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}let i=n.lookup(e);t instanceof H?ne({baseGrammar:i,selfGrammar:s},r):Ae(t.ruleName,{baseGrammar:i,selfGrammar:s,repository:s.repository},r);let o=n.injections(t.scopeName);if(o)for(let a of o)r.add(new H(a))}function Ae(t,e,n){if(e.repository&&e.repository[t]){let r=e.repository[t];se([r],e,n)}}function ne(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&se(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&se(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function se(t,e,n){for(let r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let s=r.repository?lt({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&se(r.patterns,{...e,repository:s},n);let i=r.include;if(!i)continue;let o=yt(i);switch(o.kind){case 0:ne({...e,selfGrammar:e.baseGrammar},n);break;case 1:ne(e,n);break;case 2:Ae(o.ruleName,{...e,repository:s},n);break;case 3:case 4:let a=o.scopeName===e.selfGrammar.scopeName?e.selfGrammar:o.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(a){let c={baseGrammar:e.baseGrammar,selfGrammar:a,repository:s};o.kind===4?Ae(o.ruleName,c,n):ne(c,n)}else o.kind===4?n.add(new In(o.scopeName,o.ruleName)):n.add(new H(o.scopeName));break}}}var Bn=class{kind=0},On=class{kind=1},$n=class{constructor(t){this.ruleName=t}kind=2},Mn=class{constructor(t){this.scopeName=t}kind=3},jn=class{constructor(t,e){this.scopeName=t,this.ruleName=e}kind=4};function yt(t){if(t==="$base")return new Bn;if(t==="$self")return new On;let e=t.indexOf("#");if(e===-1)return new Mn(t);if(e===0)return new $n(t.substring(1));{let n=t.substring(0,e),r=t.substring(e+1);return new jn(n,r)}}var Fn=/\\(\d+)/,rt=/\\(\d+)/g;var Dn=-1,bt=-2;var U=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(t,e,n,r){this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=ee.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=ee.hasCaptures(this._contentName)}get debugName(){let t=this.$location?`${ut(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:ee.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:ee.replaceCaptures(this._contentName,t,e)}},Wn=class extends U{retokenizeCapturedWithRuleId;constructor(t,e,n,r,s){super(t,e,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(t,e){throw new Error("Not supported!")}compile(t,e){throw new Error("Not supported!")}compileAG(t,e,n,r){throw new Error("Not supported!")}},Hn=class extends U{_match;captures;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,null),this._match=new q(r,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(t,e){e.push(this._match)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new z,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},st=class extends U{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s){super(t,e,n,r),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(t,e){for(let n of this.patterns)t.getRule(n).collectPatterns(t,e)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new z,this.collectPatterns(t,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Ee=class extends U{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(t,e,n,r,s,i,o,a,c,l){super(t,e,n,r),this._begin=new q(s,this.id),this.beginCaptures=i,this._end=new q(o||"\uFFFF",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(t,e){return this._end.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t,e).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t,e).compileAG(t,n,r)}_getCachedCompiledPatterns(t,e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new z;for(let n of this.patterns)t.getRule(n).collectPatterns(t,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,e):this._cachedCompiledPatterns.setSource(0,e)),this._cachedCompiledPatterns}},ie=class extends U{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(t,e,n,r,s,i,o,a,c){super(t,e,n,r),this._begin=new q(s,this.id),this.beginCaptures=i,this.whileCaptures=a,this._while=new q(o,bt),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(t,e){return this._while.resolveBackReferences(t,e)}collectPatterns(t,e){e.push(this._begin)}compile(t,e){return this._getCachedCompiledPatterns(t).compile(t)}compileAG(t,e,n,r){return this._getCachedCompiledPatterns(t).compileAG(t,n,r)}_getCachedCompiledPatterns(t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new z;for(let e of this.patterns)t.getRule(e).collectPatterns(t,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(t,e){return this._getCachedCompiledWhilePatterns(t,e).compile(t)}compileWhileAG(t,e,n,r){return this._getCachedCompiledWhilePatterns(t,e).compileAG(t,n,r)}_getCachedCompiledWhilePatterns(t,e){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new z,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,e||"\uFFFF"),this._cachedCompiledWhilePatterns}},St=class N{static createCaptureRule(e,n,r,s,i){return e.registerRule(o=>new Wn(n,o,r,s,i))}static getCompiledRuleId(e,n,r){return e.id||n.registerRule(s=>{if(e.id=s,e.match)return new Hn(e.$vscodeTextmateLocation,e.id,e.name,e.match,N._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){e.repository&&(r=lt({},r,e.repository));let i=e.patterns;return typeof i>"u"&&e.include&&(i=[{include:e.include}]),new st(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,N._compilePatterns(i,n,r))}return e.while?new ie(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,N._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,N._compileCaptures(e.whileCaptures||e.captures,n,r),N._compilePatterns(e.patterns,n,r)):new Ee(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,N._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,N._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,N._compilePatterns(e.patterns,n,r))}),e.id}static _compileCaptures(e,n,r){let s=[];if(e){let i=0;for(let o in e){if(o==="$vscodeTextmateLocation")continue;let a=parseInt(o,10);a>i&&(i=a)}for(let o=0;o<=i;o++)s[o]=null;for(let o in e){if(o==="$vscodeTextmateLocation")continue;let a=parseInt(o,10),c=0;e[o].patterns&&(c=N.getCompiledRuleId(e[o],n,r)),s[a]=N.createCaptureRule(n,e[o].$vscodeTextmateLocation,e[o].name,e[o].contentName,c)}}return s}static _compilePatterns(e,n,r){let s=[];if(e)for(let i=0,o=e.length;i<o;i++){let a=e[i],c=-1;if(a.include){let l=yt(a.include);switch(l.kind){case 0:case 1:c=N.getCompiledRuleId(r[a.include],n,r);break;case 2:let u=r[l.ruleName];u&&(c=N.getCompiledRuleId(u,n,r));break;case 3:case 4:let h=l.scopeName,f=l.kind===4?l.ruleName:null,d=n.getExternalGrammar(h,r);if(d)if(f){let m=d.repository[f];m&&(c=N.getCompiledRuleId(m,n,d.repository))}else c=N.getCompiledRuleId(d.repository.$self,n,d.repository);break}}else c=N.getCompiledRuleId(a,n,r);if(c!==-1){let l=n.getRule(c),u=!1;if((l instanceof st||l instanceof Ee||l instanceof ie)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;s.push(c)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},q=class wt{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,n){if(e&&typeof e=="string"){let r=e.length,s=0,i=[],o=!1;for(let a=0;a<r;a++)if(e.charAt(a)==="\\"&&a+1<r){let l=e.charAt(a+1);l==="z"?(i.push(e.substring(s,a)),i.push("$(?!\\n)(?<!\\n)"),s=a+2):(l==="A"||l==="G")&&(o=!0),a++}this.hasAnchor=o,s===0?this.source=e:(i.push(e.substring(s,r)),this.source=i.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=Fn.test(this.source):this.hasBackReferences=!1}clone(){return new wt(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(s=>e.substring(s.start,s.end));return rt.lastIndex=0,this.source.replace(rt,(s,i)=>dt(r[parseInt(i,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],r=[],s=[],i,o,a,c;for(i=0,o=this.source.length;i<o;i++)a=this.source.charAt(i),e[i]=a,n[i]=a,r[i]=a,s[i]=a,a==="\\"&&i+1<o&&(c=this.source.charAt(i+1),c==="A"?(e[i+1]="\uFFFF",n[i+1]="\uFFFF",r[i+1]="A",s[i+1]="A"):c==="G"?(e[i+1]="\uFFFF",n[i+1]="G",r[i+1]="\uFFFF",s[i+1]="G"):(e[i+1]=c,n[i+1]=c,r[i+1]=c,s[i+1]=c),i++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},z=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new it(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let r=this._items.map(s=>s.resolveAnchors(e,n));return new it(t,r,this._items.map(s=>s.ruleId))}},it=class{constructor(t,e,n){this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){let t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
|
|
2
|
+
`)}findNextMatchSync(t,e,n){let r=this.scanner.findNextMatchSync(t,e,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Ne=class{constructor(t,e){this.languageId=t,this.tokenType=e}},qn=class xe{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,n){this._defaultAttributes=new Ne(e,8),this._embeddedLanguagesMatcher=new zn(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?xe._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}static _NULL_SCOPE_METADATA=new Ne(0,0);_getBasicScopeAttributes=new mt(e=>{let n=this._scopeToLanguage(e),r=this._toStandardTokenType(e);return new Ne(n,r)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){let n=e.match(xe.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 new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},zn=class{values;scopesRegExp;constructor(t){if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);let e=t.map(([n,r])=>dt(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;let e=t.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},$s={InDebugMode:typeof process<"u"&&!!process.env.VSCODE_TEXTMATE_DEBUG},Ct=!1,ot=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function kt(t,e,n,r,s,i,o,a){let c=e.content.length,l=!1,u=-1;if(o){let d=Un(t,e,n,r,s,i);s=d.stack,r=d.linePos,n=d.isFirstLine,u=d.anchorPosition}let h=Date.now();for(;!l;){if(a!==0&&Date.now()-h>a)return new ot(s,!0);f()}return new ot(s,!1);function f(){let d=Kn(t,e,n,r,s,u);if(!d){i.produce(s,c),l=!0;return}let m=d.captureIndices,b=d.matchedRuleId,_=m&&m.length>0?m[0].end>r:!1;if(b===Dn){let p=s.getRule(t);i.produce(s,m[0].start),s=s.withContentNameScopesList(s.nameScopesList),F(t,e,n,s,i,p.endCaptures,m),i.produce(s,m[0].end);let g=s;if(s=s.parent,u=g.getAnchorPos(),!_&&g.getEnterPos()===r){s=g,i.produce(s,c),l=!0;return}}else{let p=t.getRule(b);i.produce(s,m[0].start);let g=s,y=p.getName(e.content,m),k=s.contentNameScopesList.pushAttributed(y,t);if(s=s.push(b,r,u,m[0].end===c,null,k,k),p instanceof Ee){let C=p;F(t,e,n,s,i,C.beginCaptures,m),i.produce(s,m[0].end),u=m[0].end;let v=C.getContentName(e.content,m),L=k.pushAttributed(v,t);if(s=s.withContentNameScopesList(L),C.endHasBackReferences&&(s=s.withEndRule(C.getEndWithResolvedBackReferences(e.content,m))),!_&&g.hasSameRuleAs(s)){s=s.pop(),i.produce(s,c),l=!0;return}}else if(p instanceof ie){let C=p;F(t,e,n,s,i,C.beginCaptures,m),i.produce(s,m[0].end),u=m[0].end;let v=C.getContentName(e.content,m),L=k.pushAttributed(v,t);if(s=s.withContentNameScopesList(L),C.whileHasBackReferences&&(s=s.withEndRule(C.getWhileWithResolvedBackReferences(e.content,m))),!_&&g.hasSameRuleAs(s)){s=s.pop(),i.produce(s,c),l=!0;return}}else if(F(t,e,n,s,i,p.captures,m),i.produce(s,m[0].end),s=s.pop(),!_){s=s.safePop(),i.produce(s,c),l=!0;return}}m[0].end>r&&(r=m[0].end,n=!1)}}function Un(t,e,n,r,s,i){let o=s.beginRuleCapturedEOL?0:-1,a=[];for(let c=s;c;c=c.pop()){let l=c.getRule(t);l instanceof ie&&a.push({rule:l,stack:c})}for(let c=a.pop();c;c=a.pop()){let{ruleScanner:l,findOptions:u}=Jn(c.rule,t,c.stack.endRule,n,r===o),h=l.findNextMatchSync(e,r,u);if(h){if(h.ruleId!==bt){s=c.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(i.produce(c.stack,h.captureIndices[0].start),F(t,e,n,c.stack,i,c.rule.whileCaptures,h.captureIndices),i.produce(c.stack,h.captureIndices[0].end),o=h.captureIndices[0].end,h.captureIndices[0].end>r&&(r=h.captureIndices[0].end,n=!1))}else{s=c.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:o,isFirstLine:n}}function Kn(t,e,n,r,s,i){let o=Yn(t,e,n,r,s,i),a=t.getInjections();if(a.length===0)return o;let c=Vn(a,t,e,n,r,s,i);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function Yn(t,e,n,r,s,i){let o=s.getRule(t),{ruleScanner:a,findOptions:c}=Rt(o,t,s.endRule,n,r===i),l=a.findNextMatchSync(e,r,c);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}function Vn(t,e,n,r,s,i,o){let a=Number.MAX_VALUE,c=null,l,u=0,h=i.contentNameScopesList.getScopeNames();for(let f=0,d=t.length;f<d;f++){let m=t[f];if(!m.matcher(h))continue;let b=e.getRule(m.ruleId),{ruleScanner:_,findOptions:p}=Rt(b,e,null,r,s===o),g=_.findNextMatchSync(n,s,p);if(!g)continue;let y=g.captureIndices[0].start;if(!(y>=a)&&(a=y,c=g.captureIndices,l=g.ruleId,u=m.priority,a===s))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function Rt(t,e,n,r,s){if(Ct){let o=t.compile(e,n),a=Nt(r,s);return{ruleScanner:o,findOptions:a}}return{ruleScanner:t.compileAG(e,n,r,s),findOptions:0}}function Jn(t,e,n,r,s){if(Ct){let o=t.compileWhile(e,n),a=Nt(r,s);return{ruleScanner:o,findOptions:a}}return{ruleScanner:t.compileWhileAG(e,n,r,s),findOptions:0}}function Nt(t,e){let n=0;return t||(n|=1),e||(n|=4),n}function F(t,e,n,r,s,i,o){if(i.length===0)return;let a=e.content,c=Math.min(i.length,o.length),l=[],u=o[0].end;for(let h=0;h<c;h++){let f=i[h];if(f===null)continue;let d=o[h];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?s.produceFromScopes(l[l.length-1].scopes,d.start):s.produce(r,d.start),f.retokenizeCapturedWithRuleId){let b=f.getName(a,o),_=r.contentNameScopesList.pushAttributed(b,t),p=f.getContentName(a,o),g=_.pushAttributed(p,t),y=r.push(f.retokenizeCapturedWithRuleId,d.start,-1,!1,null,_,g),k=t.createOnigString(a.substring(0,d.end));kt(t,k,n&&d.start===0,d.start,y,s,!1,0),_t(k);continue}let m=f.getName(a,o);if(m!==null){let _=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(m,t);l.push(new Qn(_,d.end))}}for(;l.length>0;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var Qn=class{scopes;endPos;constructor(t,e){this.scopes=t,this.endPos=e}};function Xn(t,e,n,r,s,i,o,a){return new er(t,e,n,r,s,i,o,a)}function at(t,e,n,r,s){let i=re(e,oe),o=St.getCompiledRuleId(n,r,s.repository);for(let a of i)t.push({debugSelector:e,matcher:a.matcher,ruleId:o,grammar:s,priority:a.priority})}function oe(t,e){if(e.length<t.length)return!1;let n=0;return t.every(r=>{for(let s=n;s<e.length;s++)if(Zn(e[s],r))return n=s+1,!0;return!1})}function Zn(t,e){if(!t)return!1;if(t===e)return!0;let n=e.length;return t.length>n&&t.substr(0,n)===e&&t[n]==="."}var er=class{constructor(t,e,n,r,s,i,o,a){if(this._rootScopeName=t,this.balancedBracketSelectors=i,this._onigLib=a,this._basicScopeAttributesProvider=new qn(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=ct(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(let c of Object.keys(s)){let l=re(c,oe);for(let u of l)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[c]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let t of this._ruleId2desc)t&&t.dispose()}createOnigScanner(t){return this._onigLib.createOnigScanner(t)}createOnigString(t){return this._onigLib.createOnigString(t)}getMetadataForScope(t){return this._basicScopeAttributesProvider.getBasicScopeAttributes(t)}_collectInjections(){let t={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},e=[],n=this._rootScopeName,r=t.lookup(n);if(r){let s=r.injections;if(s)for(let o in s)at(e,o,s[o],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(o=>{let a=this.getExternalGrammar(o);if(a){let c=a.injectionSelector;c&&at(e,c,a,this,a)}})}return e.sort((s,i)=>s.priority-i.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(t){let e=++this._lastRuleId,n=t(e);return this._ruleId2desc[e]=n,n}getRule(t){return this._ruleId2desc[t]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];if(this._grammarRepository){let n=this._grammarRepository.lookup(t);if(n)return this._includedGrammars[t]=ct(n,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,n=0){let r=this._tokenize(t,e,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(t,e,n=0){let r=this._tokenize(t,e,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(t,e,n,r){this._rootId===-1&&(this._rootId=St.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!e||e===Ie.NULL){s=!0;let l=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),h=G.set(0,l.languageId,l.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),f=this.getRule(this._rootId).getName(null,null),d;f?d=D.createRootAndLookUpScopeName(f,h,this):d=D.createRoot("unknown",h),e=new Ie(null,this._rootId,-1,-1,!1,null,d,d)}else s=!1,e.reset();t=t+`
|
|
3
|
+
`;let i=this.createOnigString(t),o=i.content.length,a=new nr(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),c=kt(this,i,s,0,e,a,!0,r);return _t(i),{lineLength:o,lineTokens:a,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function ct(t,e){return t=bn(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var D=class A{constructor(e,n,r){this.parent=e,this.scopePath=n,this.tokenAttributes=r}static fromExtension(e,n){let r=e,s=e?.scopePath??null;for(let i of n)s=Re.push(s,i.scopeNames),r=new A(r,s,i.encodedTokenAttributes);return r}static createRoot(e,n){return new A(null,new Re(null,e),n)}static createRootAndLookUpScopeName(e,n,r){let s=r.getMetadataForScope(e),i=new Re(null,e),o=r.themeProvider.themeMatch(i),a=A.mergeAttributes(n,s,o);return new A(null,i,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return A.equals(this,e)}static equals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,r){let s=-1,i=0,o=0;return r!==null&&(s=r.fontStyle,i=r.foregroundId,o=r.backgroundId),G.set(e,n.languageId,n.tokenType,null,s,i,o)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return A._pushAttributed(this,e,n);let r=e.split(/ /g),s=this;for(let i of r)s=A._pushAttributed(s,i,n);return s}static _pushAttributed(e,n,r){let s=r.getMetadataForScope(n),i=e.scopePath.push(n),o=r.themeProvider.themeMatch(i),a=A.mergeAttributes(e.tokenAttributes,s,o);return new A(e,i,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let n=[],r=this;for(;r&&r!==e;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===e?n.reverse():void 0}},Ie=class P{constructor(e,n,r,s,i,o,a,c){this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=i,this.endRule=o,this.nameScopesList=a,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new P(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(e){return e===null?!1:P._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?D.equals(e.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){P._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,r,s,i,o,a){return new P(this,e,n,r,s,i,o,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,n){return this.parent&&(n=this.parent._writeString(e,n)),e[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new P(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;for(;n&&n._enterPos===e._enterPos;){if(n.ruleId===e.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(e,n){let r=D.fromExtension(e?.nameScopesList??null,n.nameScopesList);return new P(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,D.fromExtension(r,n.contentNameScopesList))}},tr=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(t,e){this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):re(n,oe).map(r=>r.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>re(n,oe).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(let e of this.unbalancedBracketScopes)if(e(t))return!1;for(let e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},nr=class{constructor(t,e,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let r=t?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let i=t?.getScopeNames()??[];for(let o of this._tokenTypeOverrides)o.matcher(i)&&(r=G.set(r,0,o.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(i))}if(s&&(r=G.set(r,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=e;return}let n=t?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),this._lastTokenEndIndex=e}getResult(t,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(t,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let r=0,s=this._binaryTokens.length;r<s;r++)n[r]=this._binaryTokens[r];return n}},rr=class{constructor(t,e){this._onigLib=e,this._theme=t}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,e){this._rawGrammars.set(t.scopeName,t),e&&this._injectionGrammars.set(t.scopeName,e)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,e,n,r,s){if(!this._grammars.has(t)){let i=this._rawGrammars.get(t);if(!i)return null;this._grammars.set(t,Xn(t,i,e,n,r,s,this,this._onigLib))}return this._grammars.get(t)}},Tt=class{_options;_syncRegistry;_ensureGrammarCache;constructor(t){this._options=t,this._syncRegistry=new rr(W.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,e){this._syncRegistry.setTheme(W.createFromRawTheme(t,e))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,e,n){return this.loadGrammarWithConfiguration(t,e,{embeddedLanguages:n})}loadGrammarWithConfiguration(t,e,n){return this._loadGrammar(t,e,n.embeddedLanguages,n.tokenTypes,new tr(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,e,n,r,s){let i=new Pn(this._syncRegistry,t);for(;i.Q.length>0;)i.Q.map(o=>this._loadSingleGrammar(o.scopeName)),i.processQueue();return this._grammarForScopeName(t,e,n,r,s)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){let e=this._options.loadGrammar(t);if(e){let n=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(e,n)}}addGrammar(t,e=[],n=0,r=null){return this._syncRegistry.addGrammar(t,e),this._grammarForScopeName(t.scopeName,n,r)}_grammarForScopeName(t,e=0,n=null,r=null,s=null){return this._syncRegistry.grammarForScopeName(t,e,n,r,s)}},ae=Ie.NULL;function Y(t,e){let n=typeof t=="string"?{}:{...t.colorReplacements},r=typeof t=="string"?t:t.name;for(let[s,i]of Object.entries(e?.colorReplacements||{}))typeof i=="string"?n[s]=i:s===r&&Object.assign(n,i);return n}function x(t,e){return t&&(e?.[t?.toLowerCase()]||t)}function It(t){return Array.isArray(t)?t:[t]}async function Pe(t){return Promise.resolve(typeof t=="function"?t():t).then(e=>e.default||e)}function V(t){return!t||["plaintext","txt","text","plain"].includes(t)}function Ge(t){return t==="ansi"||V(t)}function J(t){return t==="none"}function Be(t){return J(t)}var sr=/(\r?\n)/g;function M(t,e=!1){if(t.length===0)return[["",0]];let n=t.split(sr),r=0,s=[];for(let i=0;i<n.length;i+=2){let o=e?n[i]+(n[i+1]||""):n[i];s.push([o,r]),r+=n[i].length,r+=n[i+1]?.length||0}return s}var vt={light:"#333333",dark:"#bbbbbb"},At={light:"#fffffe",dark:"#1e1e1e"},Et="__shiki_resolved";function ce(t){if(t?.[Et])return t;let e={...t};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||="dark",e.colorReplacements={...e.colorReplacements},e.settings||=[];let{bg:n,fg:r}=e;if(!n||!r){let a=e.settings?e.settings.find(c=>!c.name&&!c.scope):void 0;a?.settings?.foreground&&(r=a.settings.foreground),a?.settings?.background&&(n=a.settings.background),!r&&e?.colors?.["editor.foreground"]&&(r=e.colors["editor.foreground"]),!n&&e?.colors?.["editor.background"]&&(n=e.colors["editor.background"]),r||(r=e.type==="light"?vt.light:vt.dark),n||(n=e.type==="light"?At.light:At.dark),e.fg=r,e.bg=n}e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope||e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let s=0,i=new Map;function o(a){if(i.has(a))return i.get(a);s+=1;let c=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return e.colorReplacements?.[`#${c}`]?o(a):(i.set(a,c),c)}e.settings=e.settings.map(a=>{let c=a.settings?.foreground&&!a.settings.foreground.startsWith("#"),l=a.settings?.background&&!a.settings.background.startsWith("#");if(!c&&!l)return a;let u={...a,settings:{...a.settings}};if(c){let h=o(a.settings.foreground);e.colorReplacements[h]=a.settings.foreground,u.settings.foreground=h}if(l){let h=o(a.settings.background);e.colorReplacements[h]=a.settings.background,u.settings.background=h}return u});for(let a of Object.keys(e.colors||{}))if((a==="editor.foreground"||a==="editor.background"||a.startsWith("terminal.ansi"))&&!e.colors[a]?.startsWith("#")){let c=o(e.colors[a]);e.colorReplacements[c]=e.colors[a],e.colors[a]=c}return Object.defineProperty(e,Et,{enumerable:!1,writable:!1,value:!0}),e}async function Lt(t){return[...new Set((await Promise.all(t.filter(e=>!Ge(e)).map(async e=>await Pe(e).then(n=>Array.isArray(n)?n:[n])))).flat())]}async function Pt(t){return(await Promise.all(t.map(async e=>Be(e)?null:ce(await Pe(e))))).filter(e=>!!e)}function Gt(t,e){if(!e)return t;if(e[t]){let n=new Set([t]);for(;e[t];){if(t=e[t],n.has(t))throw new S(`Circular alias \`${[...n].join(" -> ")} -> ${t}\``);n.add(t)}}return t}var ir=class extends Tt{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(t,e,n,r={}){super(t),this._resolver=t,this._themes=e,this._langs=n,this._alias=r,this._themes.map(s=>this.loadTheme(s)),this.loadLanguages(this._langs)}getTheme(t){return typeof t=="string"?this._resolvedThemes.get(t):this.loadTheme(t)}loadTheme(t){let e=ce(t);return e.name&&(this._resolvedThemes.set(e.name,e),this._loadedThemesCache=null),e}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(t){let e=this._textmateThemeCache.get(t);e||(e=W.createFromRawTheme(t),this._textmateThemeCache.set(t,e)),this._syncRegistry.setTheme(e)}getGrammar(t){return t=Gt(t,this._alias),this._resolvedGrammars.get(t)}loadLanguage(t){if(this.getGrammar(t.name))return;let e=new Set([...this._langMap.values()].filter(s=>s.embeddedLangsLazy?.includes(t.name)));this._resolver.addLanguage(t);let n={balancedBracketSelectors:t.balancedBracketSelectors||["*"],unbalancedBracketSelectors:t.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(t.scopeName,t);let r=this.loadGrammarWithConfiguration(t.scopeName,1,n);if(r.name=t.name,this._resolvedGrammars.set(t.name,r),t.aliases&&t.aliases.forEach(s=>{this._alias[s]=t.name}),this._loadedLanguagesCache=null,e.size)for(let s of e)this._resolvedGrammars.delete(s.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(s.scopeName),this._syncRegistry?._grammars?.delete(s.scopeName),this.loadLanguage(this._langMap.get(s.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(t){for(let r of t)this.resolveEmbeddedLanguages(r);let e=[...this._langGraph.entries()],n=e.filter(([r,s])=>!s);if(n.length){let r=e.filter(([s,i])=>i?(i.embeddedLanguages||i.embeddedLangs)?.some(o=>n.map(([a])=>a).includes(o)):!1).filter(s=>!n.includes(s));throw new S(`Missing languages ${n.map(([s])=>`\`${s}\``).join(", ")}, required by ${r.map(([s])=>`\`${s}\``).join(", ")}`)}for(let[r,s]of e)this._resolver.addLanguage(s);for(let[r,s]of e)this.loadLanguage(s)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(t){this._langMap.set(t.name,t),this._langGraph.set(t.name,t);let e=t.embeddedLanguages??t.embeddedLangs;if(e)for(let n of e)this._langGraph.set(n,this._langMap.get(n))}},or=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(t,e){this._onigLib={createOnigScanner:n=>t.createScanner(n),createOnigString:n=>t.createString(n)},e.forEach(n=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){this._langs.set(t.name,t),t.aliases&&t.aliases.forEach(e=>{this._langs.set(e,t)}),this._scopeToLang.set(t.scopeName,t),t.injectTo&&t.injectTo.forEach(e=>{this._injections.get(e)||this._injections.set(e,[]),this._injections.get(e).push(t.scopeName)})}getInjections(t){let e=t.split("."),n=[];for(let r=1;r<=e.length;r++){let s=e.slice(0,r).join(".");n=[...n,...this._injections.get(s)||[]]}return n}},K=0;function Oe(t){K+=1,t.warnings!==!1&&K>=10&&K%10===0&&console.warn(`[Shiki] ${K} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let e=!1;if(!t.engine)throw new S("`engine` option is required for synchronous mode");let n=(t.langs||[]).flat(1),r=(t.themes||[]).flat(1).map(ce),s=new ir(new or(t.engine,n),r,n,t.langAlias),i;function o(g){return Gt(g,t.langAlias)}function a(g){_();let y=s.getGrammar(typeof g=="string"?g:g.name);if(!y)throw new S(`Language \`${g}\` not found, you may need to load it first`);return y}function c(g){if(g==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};_();let y=s.getTheme(g);if(!y)throw new S(`Theme \`${g}\` not found, you may need to load it first`);return y}function l(g){_();let y=c(g);return i!==g&&(s.setTheme(y),i=g),{theme:y,colorMap:s.getColorMap()}}function u(){return _(),s.getLoadedThemes()}function h(){return _(),s.getLoadedLanguages()}function f(...g){_(),s.loadLanguages(g.flat(1))}async function d(...g){return f(await Lt(g))}function m(...g){_();for(let y of g.flat(1))s.loadTheme(y)}async function b(...g){return _(),m(await Pt(g))}function _(){if(e)throw new S("Shiki instance has been disposed")}function p(){e||(e=!0,s.dispose(),K-=1)}return{setTheme:l,getTheme:c,getLanguage:a,getLoadedThemes:u,getLoadedLanguages:h,resolveLangAlias:o,loadLanguage:d,loadLanguageSync:f,loadTheme:b,loadThemeSync:m,dispose:p,[Symbol.dispose]:p}}async function $e(t){t.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[e,n,r]=await Promise.all([Pt(t.themes||[]),Lt(t.langs||[]),t.engine]);return Oe({...t,themes:e,langs:n,engine:r})}var Bt=new WeakMap;function Q(t,e){Bt.set(t,e)}function j(t){return Bt.get(t)}var le=class Ot{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,n){return new Ot(Object.fromEntries(It(n).map(r=>[r,ae])),e)}constructor(...e){if(e.length===2){let[n,r]=e;this.lang=r,this._stacks=n}else{let[n,r,s]=e;this.lang=r,this._stacks={[s]:n}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return ar(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function ar(t){let e=[],n=new Set;function r(s){if(n.has(s))return;n.add(s);let i=s?.nameScopesList?.scopeName;i&&e.push(i),s.parent&&r(s.parent)}return r(t),e}function cr(t,e){if(!(t instanceof le))throw new S("Invalid grammar state");return t.getInternalStack(e)}var lr=/,/,ur=/ /;function Me(t,e,n={}){let{theme:r=t.getLoadedThemes()[0]}=n;if(V(t.resolveLangAlias(n.lang||"text"))||J(r))return M(e).map(a=>[{content:a[0],offset:a[1]}]);let{theme:s,colorMap:i}=t.setTheme(r),o=t.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==o.name)throw new S(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(s.name))throw new S(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${s.name}"`)}return Mt(e,o,s,i,n)}function $t(...t){if(t.length===2)return j(t[1]);let[e,n,r={}]=t,{lang:s="text",theme:i=e.getLoadedThemes()[0]}=r;if(V(s)||J(i))throw new S("Plain language does not have grammar state");if(s==="ansi")throw new S("ANSI language does not have grammar state");let{theme:o,colorMap:a}=e.setTheme(i),c=e.getLanguage(s);return new le(je(n,c,o,a,r).stateStack,c.name,o.name)}function Mt(t,e,n,r,s){let i=je(t,e,n,r,s),o=new le(i.stateStack,e.name,n.name);return Q(i.tokens,o),i.tokens}function je(t,e,n,r,s){let i=Y(n,s),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:a=500}=s,c=M(t),l=s.grammarState?cr(s.grammarState,n.name)??ae:s.grammarContextCode!=null?je(s.grammarContextCode,e,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:ae,u=[],h=[];for(let f=0,d=c.length;f<d;f++){let[m,b]=c[f];if(m===""){u=[],h.push([]);continue}if(o>0&&m.length>=o){u=[],h.push([{content:m,offset:b,color:"",fontStyle:0}]);continue}let _,p,g;s.includeExplanation&&(_=e.tokenizeLine(m,l,a),p=_.tokens,g=0);let y=e.tokenizeLine2(m,l,a),k=y.tokens.length/2;for(let C=0;C<k;C++){let v=y.tokens[2*C],L=C+1<k?y.tokens[2*C+2]:m.length;if(v===L)continue;let Ke=y.tokens[2*C+1],_n=x(r[G.getForeground(Ke)],i),yn=G.getFontStyle(Ke),Se={content:m.substring(v,L),offset:b+v,color:_n,fontStyle:yn};if(s.includeExplanation){let Ye=[];if(s.includeExplanation!=="scopeName")for(let E of n.settings){let O;switch(typeof E.scope){case"string":O=E.scope.split(lr).map(we=>we.trim());break;case"object":O=E.scope;break;default:continue}Ye.push({settings:E,selectors:O.map(we=>we.split(ur))})}Se.explanation=[];let Ve=0;for(;v+Ve<L;){let E=p[g],O=m.substring(E.startIndex,E.endIndex);Ve+=O.length,Se.explanation.push({content:O,scopes:s.includeExplanation==="scopeName"?hr(E.scopes):fr(Ye,E.scopes)}),g+=1}}u.push(Se)}h.push(u),u=[],l=y.ruleStack}return{tokens:h,stateStack:l}}function hr(t){return t.map(e=>({scopeName:e}))}function fr(t,e){let n=[];for(let r=0,s=e.length;r<s;r++){let i=e[r];n[r]={scopeName:i,themeMatches:mr(t,i,e.slice(0,r))}}return n}function xt(t,e){return t===e||e.substring(0,t.length)===t&&e[t.length]==="."}function dr(t,e,n){if(!xt(t.at(-1),e))return!1;let r=t.length-2,s=n.length-1;for(;r>=0&&s>=0;)xt(t[r],n[s])&&(r-=1),s-=1;return r===-1}function mr(t,e,n){let r=[];for(let{selectors:s,settings:i}of t)for(let o of s)if(dr(o,e,n)){r.push(i);break}return r}function ue(t,e,n,r=Me){let s=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),i=s.map(l=>{let u=r(t,e,{...n,theme:l.theme});return{tokens:u,state:j(u),theme:typeof l.theme=="string"?l.theme:l.theme.name}}),o=gr(...i.map(l=>l.tokens)),a=o[0].map((l,u)=>l.map((h,f)=>{let d={content:h.content,variants:{},offset:h.offset};return"includeExplanation"in n&&n.includeExplanation&&(d.explanation=h.explanation),o.forEach((m,b)=>{let{content:_,explanation:p,offset:g,...y}=m[u][f];d.variants[s[b].color]=y}),d})),c=i[0].state?new le(Object.fromEntries(i.map(l=>[l.theme,l.state?.getInternalStack(l.theme)])),i[0].state.lang):void 0;return c&&Q(a,c),a}function gr(...t){let e=t.map(()=>[]),n=t.length;for(let r=0;r<t[0].length;r++){let s=t.map(c=>c[r]),i=e.map(()=>[]);e.forEach((c,l)=>c.push(i[l]));let o=s.map(()=>0),a=s.map(c=>c[0]);for(;a.every(c=>c);){let c=Math.min(...a.map(l=>l.content.length));for(let l=0;l<n;l++){let u=a[l];u.content.length===c?(i[l].push(u),o[l]+=1,a[l]=s[l][o[l]]):(i[l].push({...u,content:u.content.slice(0,c)}),a[l]={...u,content:u.content.slice(c),offset:u.offset+c})}}}return e}var jt=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var Ft={}.hasOwnProperty;function Dt(t,e){let n=e||{};function r(s,...i){let o=r.invalid,a=r.handlers;if(s&&Ft.call(s,t)){let c=String(s[t]);o=Ft.call(a,c)?a[c]:r.unknown}if(o)return o.call(this,s,...i)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var pr=/["&'<>`]/g,_r=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,yr=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,br=/[|\\{}()[\]^$+*?.]/g,Wt=new WeakMap;function Ht(t,e){if(t=t.replace(e.subset?Sr(e.subset):pr,r),e.subset||e.escapeOnly)return t;return t.replace(_r,n).replace(yr,r);function n(s,i,o){return e.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,o.charCodeAt(i+2),e)}function r(s,i,o){return e.format(s.charCodeAt(0),o.charCodeAt(i+1),e)}}function Sr(t){let e=Wt.get(t);return e||(e=wr(t),Wt.set(t,e)),e}function wr(t){let e=[],n=-1;for(;++n<t.length;)e.push(t[n].replace(br,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}var Cr=/[\dA-Fa-f]/;function qt(t,e,n){let r="&#x"+t.toString(16).toUpperCase();return n&&e&&!Cr.test(String.fromCharCode(e))?r:r+";"}var kr=/\d/;function zt(t,e,n){let r="&#"+String(t);return n&&e&&!kr.test(String.fromCharCode(e))?r:r+";"}var Ut=["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 he={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 Kt=["cent","copy","divide","gt","lt","not","para","times"];var Yt={}.hasOwnProperty,Fe={},fe;for(fe in he)Yt.call(he,fe)&&(Fe[he[fe]]=fe);var Rr=/[^\dA-Za-z]/;function Vt(t,e,n,r){let s=String.fromCharCode(t);if(Yt.call(Fe,s)){let i=Fe[s],o="&"+i;return n&&Ut.includes(i)&&!Kt.includes(i)&&(!r||e&&e!==61&&Rr.test(String.fromCharCode(e)))?o:o+";"}return""}function Jt(t,e,n){let r=qt(t,e,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=Vt(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){let i=zt(t,e,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function I(t,e){return Ht(t,Object.assign({format:Jt},e))}var Nr=/^>|^->|<!--|-->|--!>|<!-$/g,Tr=[">"],vr=["<",">"];function Qt(t,e,n,r){return r.settings.bogusComments?"<?"+I(t.value,Object.assign({},r.settings.characterReferences,{subset:Tr}))+">":"<!--"+t.value.replace(Nr,s)+"-->";function s(i){return I(i,Object.assign({},r.settings.characterReferences,{subset:vr}))}}function Xt(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}var w=Zt(1),De=Zt(-1),Ar=[];function Zt(t){return e;function e(n,r,s){let i=n?n.children:Ar,o=(r||0)+t,a=i[o];if(!s)for(;a&&$(a);)o+=t,a=i[o];return a}}var Er={}.hasOwnProperty;function de(t){return e;function e(n,r,s){return Er.call(t,n.tagName)&&t[n.tagName](n,r,s)}}var X=de({body:Ir,caption:We,colgroup:We,dd:Br,dt:Gr,head:We,html:xr,li:Pr,optgroup:Or,option:$r,p:Lr,rp:en,rt:en,tbody:jr,td:tn,tfoot:Fr,th:tn,thead:Mr,tr:Dr});function We(t,e,n){let r=w(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&$(r.value.charAt(0)))}function xr(t,e,n){let r=w(n,e);return!r||r.type!=="comment"}function Ir(t,e,n){let r=w(n,e);return!r||r.type!=="comment"}function Lr(t,e,n){let r=w(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.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 Pr(t,e,n){let r=w(n,e);return!r||r.type==="element"&&r.tagName==="li"}function Gr(t,e,n){let r=w(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function Br(t,e,n){let r=w(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function en(t,e,n){let r=w(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Or(t,e,n){let r=w(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function $r(t,e,n){let r=w(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Mr(t,e,n){let r=w(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function jr(t,e,n){let r=w(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Fr(t,e,n){return!w(n,e)}function Dr(t,e,n){let r=w(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function tn(t,e,n){let r=w(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}var nn=de({body:qr,colgroup:zr,head:Hr,html:Wr,tbody:Ur});function Wr(t){let e=w(t,-1);return!e||e.type!=="comment"}function Hr(t){let e=new Set;for(let r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}let n=t.children[0];return!n||n.type==="element"}function qr(t){let e=w(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&$(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function zr(t,e,n){let r=De(n,e),s=w(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&X(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function Ur(t,e,n){let r=De(n,e),s=w(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&X(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}var me={name:[[`
|
|
4
|
+
\f\r &/=>`.split(""),`
|
|
5
|
+
\f\r "&'/=>\``.split("")],[`\0
|
|
6
|
+
\f\r "&'/<=>`.split(""),`\0
|
|
7
|
+
\f\r "&'/<=>\``.split("")]],unquoted:[[`
|
|
8
|
+
\f\r &>`.split(""),`\0
|
|
9
|
+
\f\r "&'<=>\``.split("")],[`\0
|
|
10
|
+
\f\r "&'<=>\``.split(""),`\0
|
|
11
|
+
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function rn(t,e,n,r){let s=r.schema,i=s.space==="svg"?!1:r.settings.omitOptionalTags,o=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase()),a=[],c;s.space==="html"&&t.tagName==="svg"&&(r.schema=Z);let l=Kr(r,t.properties),u=r.all(s.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=s,u&&(o=!1),(l||!i||!nn(t,e,n))&&(a.push("<",t.tagName,l?" "+l:""),o&&(s.space==="svg"||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c==="/"||c&&c!=='"'&&c!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(u),!o&&(!i||!X(t,e,n))&&a.push("</"+t.tagName+">"),a.join("")}function Kr(t,e){let n=[],r=-1,s;if(e){for(s in e)if(e[s]!==null&&e[s]!==void 0){let i=Yr(t,s,e[s]);i&&n.push(i)}}for(;++r<n.length;){let i=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&i!=='"'&&i!=="'"&&(n[r]+=" ")}return n.join("")}function Yr(t,e,n){let r=Je(t.schema,e),s=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,i=t.settings.allowDangerousCharacters?0:1,o=t.quote,a;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";let c=I(r.attribute,Object.assign({},t.settings.characterReferences,{subset:me.name[s][i]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Xe:Ze)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?c:(t.settings.preferUnquoted&&(a=I(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:me.unquoted[s][i]}))),a!==n&&(t.settings.quoteSmart&&Ce(n,o)>Ce(n,t.alternative)&&(o=t.alternative),a=o+I(n,Object.assign({},t.settings.characterReferences,{subset:(o==="'"?me.single:me.double)[s][i],attribute:!0}))+o),c+(a&&"="+a))}var Vr=["<","&"];function ge(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:I(t.value,Object.assign({},r.settings.characterReferences,{subset:Vr}))}function sn(t,e,n,r){return r.settings.allowDangerousHtml?t.value:ge(t,e,n,r)}function on(t,e,n,r){return r.all(t)}var an=Dt("type",{invalid:Jr,unknown:Qr,handlers:{comment:Qt,doctype:Xt,element:rn,raw:sn,root:on,text:ge}});function Jr(t){throw new Error("Expected node, not `"+t+"`")}function Qr(t){let e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}var Xr={},Zr={},es=[];function He(t,e){let n=e||Xr,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:ts,all:ns,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||jt,characterReferences:n.characterReferences||Zr,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Z:Qe,quote:r,alternative:s}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function ts(t,e,n){return an(t,e,n,this)}function ns(t){let e=[],n=t&&t.children||es,r=-1;for(;++r<n.length;)e[r]=this.one(n[r],r,t);return e.join("")}var cn=/\s+/g;function hn(t,e){if(!e)return t;t.properties||={},t.properties.class||=[],typeof t.properties.class=="string"&&(t.properties.class=t.properties.class.split(cn)),Array.isArray(t.properties.class)||(t.properties.class=[]);let n=Array.isArray(e)?e:e.split(cn);for(let r of n)r&&!t.properties.class.includes(r)&&t.properties.class.push(r);return t}var rs=/:?lang=["']([^"']+)["']/g,ss=/(?:```|~~~)([\w-]+)/g,is=/\\begin\{([\w-]+)\}/g,os=/<script\s+(?:type|lang)=["']([^"']+)["']/gi;function as(t){let e=M(t,!0).map(([s])=>s);function n(s){if(s===t.length)return{line:e.length-1,character:e.at(-1).length};let i=s,o=0;for(let a of e){if(i<a.length)break;i-=a.length,o++}return{line:o,character:i}}function r(s,i){let o=0;for(let a=0;a<s;a++)o+=e[a].length;return o+=i,o}return{lines:e,indexToPos:n,posToIndex:r}}function fn(t,e,n){let r=new Set;for(let i of t.matchAll(rs)){let o=i[1].toLowerCase().trim();o&&r.add(o)}for(let i of t.matchAll(ss)){let o=i[1].toLowerCase().trim();o&&r.add(o)}for(let i of t.matchAll(is)){let o=i[1].toLowerCase().trim();o&&r.add(o)}for(let i of t.matchAll(os)){let o=i[1].toLowerCase().trim(),a=o.includes("/")?o.split("/").pop():o;a&&r.add(a)}if(!n)return[...r];let s=n.getBundledLanguages();return[...r].filter(i=>i&&s[i])}var cs=["color","background-color"];function ls(t,e){let n=0,r=[];for(let s of e)s>n&&r.push({...t,content:t.content.slice(n,s),offset:t.offset+n}),n=s;return n<t.content.length&&r.push({...t,content:t.content.slice(n),offset:t.offset+n}),r}function us(t,e){let n=[...e instanceof Set?e:new Set(e)].sort((r,s)=>r-s);return n.length?t.map(r=>r.flatMap(s=>{let i=n.filter(o=>s.offset<o&&o<s.offset+s.content.length).map(o=>o-s.offset).sort((o,a)=>o-a);return i.length?ls(s,i):s})):t}function hs(t,e,n,r,s="css-vars"){let i={content:t.content,explanation:t.explanation,offset:t.offset},o=e.map(u=>pe(t.variants[u])),a=new Set(o.flatMap(u=>Object.keys(u))),c={},l=(u,h)=>{let f=h==="color"?"":h==="background-color"?"-bg":`-${h}`;return n+e[u]+(h==="color"?"":f)};return o.forEach((u,h)=>{for(let f of a){let d=u[f]||"inherit";if(h===0&&r&&cs.includes(f))if(r==="light-dark()"&&o.length>1){let m=e.findIndex(_=>_==="light"),b=e.findIndex(_=>_==="dark");if(m===-1||b===-1)throw new S('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');c[f]=`light-dark(${o[m][f]||"inherit"}, ${o[b][f]||"inherit"})`,s==="css-vars"&&(c[l(h,f)]=d)}else c[f]=d;else s==="css-vars"&&(c[l(h,f)]=d)}}),i.htmlStyle=c,i}function pe(t){let e={};if(t.color&&(e.color=t.color),t.bgColor&&(e["background-color"]=t.bgColor),t.fontStyle){t.fontStyle&R.Italic&&(e["font-style"]="italic"),t.fontStyle&R.Bold&&(e["font-weight"]="bold");let n=[];t.fontStyle&R.Underline&&n.push("underline"),t.fontStyle&R.Strikethrough&&n.push("line-through"),n.length&&(e["text-decoration"]=n.join(" "))}return e}function ze(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}function fs(){let t=new WeakMap;function e(n){if(!t.has(n.meta)){let i=function(a){if(typeof a=="number"){if(a<0||a>n.source.length)throw new S(`Invalid decoration offset: ${a}. Code length: ${n.source.length}`);return{...s.indexToPos(a),offset:a}}else{let c=s.lines[a.line];if(c===void 0)throw new S(`Invalid decoration position ${JSON.stringify(a)}. Lines length: ${s.lines.length}`);let l=a.character;if(l<0&&(l=c.length+l),l<0||l>c.length)throw new S(`Invalid decoration position ${JSON.stringify(a)}. Line ${a.line} length: ${c.length}`);return{...a,character:l,offset:s.posToIndex(a.line,l)}}};var r=i;let s=as(n.source),o=(n.options.decorations||[]).map(a=>({...a,start:i(a.start),end:i(a.end)}));ds(o),t.set(n.meta,{decorations:o,converter:s,source:n.source})}return t.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(this.options.decorations?.length)return us(n,e(this).decorations.flatMap(r=>[r.start.offset,r.end.offset]))},code(n){if(!this.options.decorations?.length)return;let r=e(this),s=[...n.children].filter(u=>u.type==="element"&&u.tagName==="span");if(s.length!==r.converter.lines.length)throw new S(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function i(u,h,f,d){let m=s[u],b="",_=-1,p=-1;if(h===0&&(_=0),f===0&&(p=0),f===Number.POSITIVE_INFINITY&&(p=m.children.length),_===-1||p===-1)for(let y=0;y<m.children.length;y++)b+=dn(m.children[y]),_===-1&&b.length===h&&(_=y+1),p===-1&&b.length===f&&(p=y+1);if(_===-1)throw new S(`Failed to find start index for decoration ${JSON.stringify(d.start)}`);if(p===-1)throw new S(`Failed to find end index for decoration ${JSON.stringify(d.end)}`);let g=m.children.slice(_,p);if(!d.alwaysWrap&&g.length===m.children.length)a(m,d,"line");else if(!d.alwaysWrap&&g.length===1&&g[0].type==="element")a(g[0],d,"token");else{let y={type:"element",tagName:"span",properties:{},children:g};a(y,d,"wrapper"),m.children.splice(_,g.length,y)}}function o(u,h){s[u]=a(s[u],h,"line")}function a(u,h,f){let d=h.properties||{},m=h.transform||(b=>b);return u.tagName=h.tagName||"span",u.properties={...u.properties,...d,class:u.properties.class},h.properties?.class&&hn(u,h.properties.class),u=m(u,f)||u,u}let c=[],l=r.decorations.sort((u,h)=>h.start.offset-u.start.offset||u.end.offset-h.end.offset);for(let u of l){let{start:h,end:f}=u;if(h.line===f.line)i(h.line,h.character,f.character,u);else if(h.line<f.line){i(h.line,h.character,Number.POSITIVE_INFINITY,u);for(let d=h.line+1;d<f.line;d++)c.unshift(()=>o(d,u));i(f.line,0,f.character,u)}}c.forEach(u=>u())}}}function ds(t){for(let e=0;e<t.length;e++){let n=t[e];if(n.start.offset>n.end.offset)throw new S(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=e+1;r<t.length;r++){let s=t[r],i=n.start.offset<=s.start.offset&&s.start.offset<n.end.offset,o=n.start.offset<s.end.offset&&s.end.offset<=n.end.offset,a=s.start.offset<=n.start.offset&&n.start.offset<s.end.offset,c=s.start.offset<n.end.offset&&n.end.offset<=s.end.offset;if(i||o||a||c){if(i&&o||a&&c||a&&n.start.offset===n.end.offset||o&&s.start.offset===s.end.offset)continue;throw new S(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function dn(t){return t.type==="text"?t.value:t.type==="element"?t.children.map(dn).join(""):""}var ms=[fs()];function _e(t){let e=gs(t.transformers||[]);return[...e.pre,...e.normal,...e.post,...ms]}function gs(t){let e=[],n=[],r=[];for(let s of t)switch(s.enforce){case"pre":e.push(s);break;case"post":n.push(s);break;default:r.push(s)}return{pre:e,post:n,normal:r}}var B=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],qe={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function ps(t,e){let n=t.indexOf("\x1B",e);if(n!==-1&&t[n+1]==="["){let r=t.indexOf("m",n);if(r!==-1)return{sequence:t.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:t.length}}function ln(t){let e=t.shift();if(e==="2"){let n=t.splice(0,3).map(r=>Number.parseInt(r));return n.length!==3||n.some(r=>Number.isNaN(r))?void 0:{type:"rgb",rgb:n}}else if(e==="5"){let n=t.shift();if(n)return{type:"table",index:Number(n)}}}function _s(t){let e=[];for(;t.length>0;){let n=t.shift();if(!n)continue;let r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)e.push({type:"resetAll"});else if(r<=9)qe[r]&&e.push({type:"setDecoration",value:qe[r]});else if(r<=29){let s=qe[r-20];s&&(e.push({type:"resetDecoration",value:s}),s==="dim"&&e.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)e.push({type:"setForegroundColor",value:{type:"named",name:B[r-30]}});else if(r===38){let s=ln(t);s&&e.push({type:"setForegroundColor",value:s})}else if(r===39)e.push({type:"resetForegroundColor"});else if(r<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:B[r-40]}});else if(r===48){let s=ln(t);s&&e.push({type:"setBackgroundColor",value:s})}else r===49?e.push({type:"resetBackgroundColor"}):r===53?e.push({type:"setDecoration",value:"overline"}):r===55?e.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?e.push({type:"setForegroundColor",value:{type:"named",name:B[r-90+8]}}):r>=100&&r<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:B[r-100+8]}})}return e}function ys(){let t=null,e=null,n=new Set;return{parse(r){let s=[],i=0;do{let o=ps(r,i),a=o.sequence?r.substring(i,o.startPosition):r.substring(i);if(a.length>0&&s.push({value:a,foreground:t,background:e,decorations:new Set(n)}),o.sequence){let c=_s(o.sequence);for(let l of c)l.type==="resetAll"?(t=null,e=null,n.clear()):l.type==="resetForegroundColor"?t=null:l.type==="resetBackgroundColor"?e=null:l.type==="resetDecoration"&&n.delete(l.value);for(let l of c)l.type==="setForegroundColor"?t=l.value:l.type==="setBackgroundColor"?e=l.value:l.type==="setDecoration"&&n.add(l.value)}i=o.position}while(i<r.length);return s}}}var bs={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function Ss(t=bs){function e(a){return t[a]}function n(a){return`#${a.map(c=>Math.max(0,Math.min(c,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let l=0;l<B.length;l++)r.push(e(B[l]));let a=[0,95,135,175,215,255];for(let l=0;l<6;l++)for(let u=0;u<6;u++)for(let h=0;h<6;h++)r.push(n([a[l],a[u],a[h]]));let c=8;for(let l=0;l<24;l++,c+=10)r.push(n([c,c,c]));return r}function i(a){return s()[a]}function o(a){switch(a.type){case"named":return e(a.name);case"rgb":return n(a.rgb);case"table":return i(a.index)}}return{value:o}}var ws=/#([0-9a-f]{3,8})/i,Cs=/var\((--[\w-]+-ansi-[\w-]+)\)/,ks={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function Rs(t,e,n){let r=Y(t,n),s=M(e),i=Ss(Object.fromEntries(B.map(a=>{let c=`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`;return[a,t.colors?.[c]||ks[a]]}))),o=ys();return s.map(a=>o.parse(a[0]).map(c=>{let l,u;c.decorations.has("reverse")?(l=c.background?i.value(c.background):t.bg,u=c.foreground?i.value(c.foreground):t.fg):(l=c.foreground?i.value(c.foreground):t.fg,u=c.background?i.value(c.background):void 0),l=x(l,r),u=x(u,r),c.decorations.has("dim")&&(l=Ns(l));let h=R.None;return c.decorations.has("bold")&&(h|=R.Bold),c.decorations.has("italic")&&(h|=R.Italic),c.decorations.has("underline")&&(h|=R.Underline),c.decorations.has("strikethrough")&&(h|=R.Strikethrough),{content:c.value,offset:a[1],color:l,bgColor:u,fontStyle:h}}))}function Ns(t){let e=t.match(ws);if(e){let r=e[1];if(r.length===8){let s=Math.round(Number.parseInt(r.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${r.slice(0,6)}${s}`}else{if(r.length===6)return`#${r}80`;if(r.length===4){let s=r[0],i=r[1],o=r[2],a=r[3];return`#${s}${s}${i}${i}${o}${o}${Math.round(Number.parseInt(`${a}${a}`,16)/2).toString(16).padStart(2,"0")}`}else if(r.length===3){let s=r[0],i=r[1],o=r[2];return`#${s}${s}${i}${i}${o}${o}80`}}}let n=t.match(Cs);return n?`var(${n[1]}-dim)`:t}function Ue(t,e,n={}){let r=t.resolveLangAlias(n.lang||"text"),{theme:s=t.getLoadedThemes()[0]}=n;if(!V(r)&&!J(s)&&r==="ansi"){let{theme:i}=t.setTheme(s);return Rs(i,e,n)}return Me(t,e,n)}function ye(t,e,n){let r,s,i,o,a,c;if("themes"in n){let{defaultColor:l="light",cssVariablePrefix:u="--shiki-",colorsRendering:h="css-vars"}=n,f=Object.entries(n.themes).filter(p=>p[1]).map(p=>({color:p[0],theme:p[1]})).sort((p,g)=>p.color===l?-1:g.color===l?1:0);if(f.length===0)throw new S("`themes` option must not be empty");let d=ue(t,e,n,Ue);if(c=j(d),l&&l!=="light-dark()"&&!f.some(p=>p.color===l))throw new S(`\`themes\` option must contain the defaultColor key \`${l}\``);let m=f.map(p=>t.getTheme(p.theme)),b=f.map(p=>p.color);i=d.map(p=>p.map(g=>hs(g,b,u,l,h))),c&&Q(i,c);let _=f.map(p=>Y(p.theme,n));s=un(f,m,_,u,l,"fg",h),r=un(f,m,_,u,l,"bg",h),o=`shiki-themes ${m.map(p=>p.name).join(" ")}`,a=l?void 0:[s,r].join(";")}else if("theme"in n){let l=Y(n.theme,n);i=Ue(t,e,n);let u=t.getTheme(n.theme);r=x(u.bg,l),s=x(u.fg,l),o=u.name,c=j(i)}else throw new S("Invalid options, either `theme` or `themes` must be provided");return{tokens:i,fg:s,bg:r,themeName:o,rootStyle:a,grammarState:c}}function un(t,e,n,r,s,i,o){return t.map((a,c)=>{let l=x(e[c][i],n[c])||"inherit",u=`${r+a.color}${i==="bg"?"-bg":""}:${l}`;if(c===0&&s){if(s==="light-dark()"&&t.length>1){let h=t.findIndex(d=>d.color==="light"),f=t.findIndex(d=>d.color==="dark");if(h===-1||f===-1)throw new S('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${x(e[h][i],n[h])||"inherit"}, ${x(e[f][i],n[f])||"inherit"});${u}`}return l}return o==="css-vars"?u:null}).filter(a=>!!a).join(";")}var mn=/^\s+$/,Ts=/^(\s*)(.*?)(\s*)$/;function be(t,e,n,r={meta:{},options:n,codeToHast:(s,i)=>be(t,s,i),codeToTokens:(s,i)=>ye(t,s,i)}){let s=e;for(let m of _e(n))s=m.preprocess?.call(r,s,n)||s;let{tokens:i,fg:o,bg:a,themeName:c,rootStyle:l,grammarState:u}=ye(t,s,n),{mergeWhitespaces:h=!0,mergeSameStyleTokens:f=!1}=n;h===!0?i=As(i):h==="never"&&(i=Es(i)),f&&(i=xs(i));let d={...r,get source(){return s}};for(let m of _e(n))i=m.tokens?.call(d,i)||i;return vs(i,{...n,fg:o,bg:a,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},d,u)}function vs(t,e,n,r=j(t)){let s=_e(e),i=[],o={type:"root",children:[]},{structure:a="classic",tabindex:c="0"}=e,l={class:`shiki ${e.themeName||""}`};e.rootStyle!==!1&&(e.rootStyle!=null?l.style=e.rootStyle:l.style=`background-color:${e.bg};color:${e.fg}`),c!==!1&&c!=null&&(l.tabindex=c.toString());for(let[b,_]of Object.entries(e.meta||{}))b.startsWith("_")||(l[b]=_);let u={type:"element",tagName:"pre",properties:l,children:[],data:e.data},h={type:"element",tagName:"code",properties:{},children:i},f=[],d={...n,structure:a,addClassToHast:hn,get source(){return n.source},get tokens(){return t},get options(){return e},get root(){return o},get pre(){return u},get code(){return h},get lines(){return f}};if(t.forEach((b,_)=>{_&&(a==="inline"?o.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&i.push({type:"text",value:`
|
|
12
|
+
`}));let p={type:"element",tagName:"span",properties:{class:"line"},children:[]},g=0;for(let y of b){let k={type:"element",tagName:"span",properties:{...y.htmlAttrs},children:[{type:"text",value:y.content}]},C=ze(y.htmlStyle||pe(y));C&&(k.properties.style=C);for(let v of s)k=v?.span?.call(d,k,_+1,g,p,y)||k;a==="inline"?o.children.push(k):a==="classic"&&p.children.push(k),g+=y.content.length}if(a==="classic"){for(let y of s)p=y?.line?.call(d,p,_+1)||p;f.push(p),i.push(p)}else a==="inline"&&f.push(p)}),a==="classic"){for(let b of s)h=b?.code?.call(d,h)||h;u.children.push(h);for(let b of s)u=b?.pre?.call(d,u)||u;o.children.push(u)}else if(a==="inline"){let b=[],_={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(let g of o.children)g.type==="element"&&g.tagName==="br"?(b.push(_),_={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(g.type==="element"||g.type==="text")&&_.children.push(g);b.push(_);let p={type:"element",tagName:"code",properties:{},children:b};for(let g of s)p=g?.code?.call(d,p)||p;o.children=[];for(let g=0;g<p.children.length;g++){g>0&&o.children.push({type:"element",tagName:"br",properties:{},children:[]});let y=p.children[g];y.type==="element"&&o.children.push(...y.children)}}let m=o;for(let b of s)m=b?.root?.call(d,m)||m;return r&&Q(m,r),m}function As(t){return t.map(e=>{let n=[],r="",s;return e.forEach((i,o)=>{let a=!(i.fontStyle&&(i.fontStyle&R.Underline||i.fontStyle&R.Strikethrough));a&&mn.test(i.content)&&e[o+1]?(s===void 0&&(s=i.offset),r+=i.content):r?(a?n.push({...i,offset:s,content:r+i.content}):n.push({content:r,offset:s},i),s=void 0,r=""):n.push(i)}),n})}function Es(t){return t.map(e=>e.flatMap(n=>{if(mn.test(n.content))return n;let r=n.content.match(Ts);if(!r)return n;let[,s,i,o]=r;if(!s&&!o)return n;let a=[{...n,offset:n.offset+s.length,content:i}];return s&&a.unshift({content:s,offset:n.offset}),o&&a.push({content:o,offset:n.offset+s.length+i.length}),a}))}function xs(t){return t.map(e=>{let n=[];for(let r of e){if(n.length===0){n.push({...r});continue}let s=n.at(-1),i=ze(s.htmlStyle||pe(s)),o=ze(r.htmlStyle||pe(r)),a=s.fontStyle&&(s.fontStyle&R.Underline||s.fontStyle&R.Strikethrough),c=r.fontStyle&&(r.fontStyle&R.Underline||r.fontStyle&R.Strikethrough);!a&&!c&&i===o?s.content+=r.content:n.push({...r})}return n})}var Is=He;function Ls(t,e,n){let r={meta:{},options:n,codeToHast:(i,o)=>be(t,i,o),codeToTokens:(i,o)=>ye(t,i,o)},s=Is(be(t,e,n,r));for(let i of _e(n))s=i.postprocess?.call(r,s,n)||s;return s}async function Ps(t){let e=await $e(t);return{getLastGrammarState:(...n)=>$t(e,...n),codeToTokensBase:(n,r)=>Ue(e,n,r),codeToTokensWithThemes:(n,r)=>ue(e,n,r),codeToTokens:(n,r)=>ye(e,n,r),codeToHast:(n,r)=>be(e,n,r),codeToHtml:(n,r)=>Ls(e,n,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...e,getInternalContext:()=>e}}function gn(t){let e=t.langs,n=t.themes,r=t.engine;async function s(i){function o(h){if(typeof h=="string"){if(h=i.langAlias?.[h]||h,Ge(h))return[];let f=e[h];if(!f)throw new S(`Language \`${h}\` is not included in this bundle. You may want to load it from external source.`);return f}return h}function a(h){if(Be(h))return"none";if(typeof h=="string"){let f=n[h];if(!f)throw new S(`Theme \`${h}\` is not included in this bundle. You may want to load it from external source.`);return f}return h}let c=(i.themes??[]).map(h=>a(h)),l=(i.langs??[]).map(h=>o(h)),u=await Ps({engine:i.engine??r(),...i,themes:c,langs:l});return{...u,loadLanguage(...h){return u.loadLanguage(...h.map(o))},loadTheme(...h){return u.loadTheme(...h.map(a))},getBundledLanguages(){return e},getBundledThemes(){return n}}}return s}function Gs(t){let e;async function n(r={}){if(e){let s=await e;return await Promise.all([s.loadTheme(...r.themes||[]),s.loadLanguage(...r.langs||[])]),s}else{e=t({...r,themes:[],langs:[]});let s=await e;return await Promise.all([s.loadTheme(...r.themes||[]),s.loadLanguage(...r.langs||[])]),s}}return n}function pn(t,e){let n=Gs(t);async function r(s,i){let o=await n({langs:[i.lang],themes:"theme"in i?[i.theme]:Object.values(i.themes)}),a=await e?.guessEmbeddedLanguages?.(s,i.lang,o);return a&&await o.loadLanguage(...a),o}return{getSingletonHighlighter(s){return n(s)},async codeToHtml(s,i){return(await r(s,i)).codeToHtml(s,i)},async codeToHast(s,i){return(await r(s,i)).codeToHast(s,i)},async codeToTokens(s,i){return(await r(s,i)).codeToTokens(s,i)},async codeToTokensBase(s,i){return(await r(s,i)).codeToTokensBase(s,i)},async codeToTokensWithThemes(s,i){return(await r(s,i)).codeToTokensWithThemes(s,i)},async getLastGrammarState(s,i){return(await n({langs:[i.lang],themes:[i.theme]})).getLastGrammarState(s,i)}}}var{codeToHtml:Do}=pn(gn({langs:et,themes:{"github-dark":()=>import("./github-dark-KUCXZGOA.js"),"github-light":()=>import("./github-light-QHW3AEMR.js")},engine:async()=>{let{createOnigurumaEngine:t}=await import("./engine-oniguruma-VVBNLVJR.js");return t(import("./wasm-FYXHOCUX.js"))}}),{guessEmbeddedLanguages:fn});export{Do as codeToHtml};
|