@adelie/server 0.6.1 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/install.ps1 CHANGED
@@ -47,7 +47,7 @@ $Asset = "penguin-win32-x64.zip"
47
47
  $PayloadName = "payload.zip"
48
48
  # The release workflow replaces this token with the immutable tag before publishing both the
49
49
  # standalone installer and the copy sealed inside the Windows bundle.
50
- $EmbeddedReleaseVersion = "v0.6.1"
50
+ $EmbeddedReleaseVersion = "v0.6.2"
51
51
 
52
52
  function Fail([string]$Message) {
53
53
  # `throw` rather than `exit`: a caller that runs this installer as an in-memory script block
package/dist/install.sh CHANGED
@@ -44,7 +44,7 @@ DOWNLOAD_FALLBACK_BASE_URL="${PENGUIN_DOWNLOAD_FALLBACK_BASE_URL:-}"
44
44
  PAYLOAD_NAME="payload.tar.gz"
45
45
  # The release workflow replaces this token with the immutable tag before publishing both the
46
46
  # standalone installer and the copies sealed inside the Linux, macOS and universal bundles.
47
- EMBEDDED_RELEASE_VERSION="v0.6.1"
47
+ EMBEDDED_RELEASE_VERSION="v0.6.2"
48
48
 
49
49
  fail() {
50
50
  echo "error: $1" >&2
@@ -1,7 +1,7 @@
1
1
  import { SpawnConfiner, ThinkingLevelName, OmniMessage, ToolCallPayload, ProjectConfig, ModelRef, PluginTables, ListEndpointModelsOptions, ModelRequestContext, ProxyEnvPolicy, ControlEnvContext, AgentAssembly, ApproveFn, SwitchFailurePolicy, StopReason, CompactAvailability, SessionTitleResult, BackgroundCommandInfo, ToolDetachResult, BackgroundSubagentInfo, SubagentMessageOptions, SubagentMessageOutcome } from '@adelie/core';
2
2
  import { SandboxProviderSource, SandboxSettings, SandboxDimension, SandboxLimit } from '@adelie/core/plugin';
3
- import { Slot, Opaque } from '@adelie/core/kernel';
4
- import { ApprovalMode, ModelRefDto, ChatDefaultsDto, CommandPolicyDto, ModelVisionDetectRequest, ModelVisionDetectResponse, ModelTestRequest, ModelTestResponse, ModelProtocolDetectRequest, ModelProtocolDetectResponse, EndpointModelListRequest, EndpointModelListResponse, ModelsResponse, ModelsUpdateRequest, ServerEvent, MessagingChannel, UnavailableSandboxBackend, SessionSandboxPreset, SessionSandbox, SessionInfo, SessionCategory, SessionCategoryCounts, ModelScopeAuthFlowStatusResponse, SessionStatus, SessionBackgroundTasks, PendingSteeringInfo, PendingFollowUpInfo, AgentConfigDto, AgentConfigUpdateRequest, AgentKernelUpdateResponse, VaultResponse, VaultUpdateRequest, PluginUpdateRef, MessagingRuntimeStatus, PluginConfiguration, ContributionsResponse, RendererRef } from '../api/types.js';
3
+ import { Slot, Opaque, ClassCtx } from '@adelie/core/kernel';
4
+ import { ApprovalMode, ModelRefDto, ChatDefaultsDto, CommandPolicyDto, ModelVisionDetectRequest, ModelVisionDetectResponse, ModelTestRequest, ModelTestResponse, ModelProtocolDetectRequest, ModelProtocolDetectResponse, EndpointModelListRequest, EndpointModelListResponse, ModelsResponse, ModelsUpdateRequest, ServerEvent, MessagingChannel, UnavailableSandboxBackend, SessionSandboxPreset, SessionSandbox, SessionInfo, SessionCategory, SessionCategoryCounts, ModelScopeAuthFlowStatusResponse, SessionStatus, SessionBackgroundTasks, PendingSteeringInfo, PendingFollowUpInfo, AgentConfigDto, AgentConfigUpdateRequest, AgentKernelUpdateResponse, VaultResponse, VaultUpdateRequest, AgentDeletionInfo, PluginUpdateRef, MessagingRuntimeStatus, PluginConfiguration, ContributionsResponse, RendererRef } from '../api/types.js';
5
5
  export { PluginConfigField } from '../api/types.js';
6
6
  import { ThinkingLevelName as ThinkingLevelName$1 } from '@adelie/core/interfaces';
7
7
  import { SessionSource } from '@adelie/core/omnimessage';
@@ -2001,7 +2001,17 @@ declare abstract class AgentLifecycle {
2001
2001
  abstract listAgents(projectId: string): Promise<AgentListItem[]>;
2002
2002
  /** Every id `createAgent` refuses as taken, as names only, including a folder that does not list. */
2003
2003
  abstract takenAgentIds(projectId: string): Promise<string[]>;
2004
- abstract deleteAgent(projectId: string, agentId: string): Promise<void>;
2004
+ /**
2005
+ * Moves the Agent's folder out of the agents directory in one rename and drops its index row,
2006
+ * so it is gone from every list and route at once; its files are then removed in the
2007
+ * background, as the returned deletion reports. Refuses a built-in Agent, and a folder another
2008
+ * program holds open (409 `agent_folder_busy`, nothing deleted).
2009
+ */
2010
+ abstract deleteAgent(projectId: string, agentId: string): Promise<AgentDeletionInfo>;
2011
+ /** Where one deletion stands; null once it is unknown here (finished long ago, or never was). */
2012
+ abstract agentDeletion(projectId: string, deletionId: string): AgentDeletionInfo | null;
2013
+ /** Removes whatever deleted Agents left behind when the server last stopped mid-removal. */
2014
+ abstract resumeDeletions(): Promise<void>;
2005
2015
  abstract createAgent(projectId: string, agentId: string, name?: string, description?: string, skillNames?: readonly string[], directory?: {
2006
2016
  path: string;
2007
2017
  names: readonly string[];
@@ -2045,7 +2055,19 @@ declare class AgentService implements AgentLifecycle {
2045
2055
  private readonly agents;
2046
2056
  private readonly agentConfig;
2047
2057
  private readonly snapshots;
2048
- /** Union of DB index ∪ directory scan; unmanaged directory Agents are backfilled into the DB. */
2058
+ /** Deletions this process knows, by `${projectId}/${deletionId}`. */
2059
+ private readonly deletions;
2060
+ /** The removals in flight, by the same key. */
2061
+ private readonly running;
2062
+ /** Shared by every removal, so two deletions at once still hold only PURGE_SLOTS calls. */
2063
+ private readonly limiter;
2064
+ /** Ends this generation's removals when it is disposed; the next one resumes them from disk. */
2065
+ private readonly stopping;
2066
+ setup(ctx: ClassCtx): void;
2067
+ /**
2068
+ * Union of DB index ∪ directory scan; unmanaged directory Agents are backfilled into the DB.
2069
+ * Only what `AgentConfig.exists` accepts is listed — the rule every route checks.
2070
+ */
2049
2071
  listAgents(projectId: string): Promise<AgentListItem[]>;
2050
2072
  /**
2051
2073
  * Every id `createAgent` refuses as taken, as names only: the index rows and every entry under
@@ -2112,14 +2134,32 @@ declare class AgentService implements AgentLifecycle {
2112
2134
  /** Last config modification time: the later of system_config.yaml and AGENTS.md mtime; omitted if neither is readable. */
2113
2135
  private configUpdatedAt;
2114
2136
  /**
2115
- * Delete an Agent: the sole built-in Agent
2116
- * default_agent (shared with the CLI, the default conversation Agent) cannot be
2117
- * deleted; callers must first drain any active run via manager.abortAgent.
2118
- * The directory is deleted recursively (including Trace), and the DB's
2119
- * agents/sessions index rows are removed along with it; usage records are kept
2120
- * (historical stats are unaffected).
2137
+ * Delete an Agent: the built-in Agents cannot be deleted; callers must first drain any active
2138
+ * run (the session manager's `beginAgentDeletion`) and let go of what holds the folder open.
2139
+ *
2140
+ * The folder (Agent State, Traces, scratchpads, temporary Workspaces) is moved to
2141
+ * `agents/.deleting/<id>-<time>` in one rename and the index row dropped: from then on no list
2142
+ * shows the Agent and no route accepts it, and a new Agent may take its id. The move is the
2143
+ * whole of what the caller waits for — the contents are removed in the background, reported by
2144
+ * the deletion returned (and by `agentDeletion` as it goes). A folder that cannot be moved is
2145
+ * refused with nothing deleted (409 `agent_folder_busy`). Usage records are kept (historical
2146
+ * stats are unaffected); the caller drops the Agent's other index rows.
2147
+ */
2148
+ deleteAgent(projectId: string, agentId: string): Promise<AgentDeletionInfo>;
2149
+ agentDeletion(projectId: string, deletionId: string): AgentDeletionInfo | null;
2150
+ /**
2151
+ * Every folder left under a Project's `agents/.deleting/` — a deletion the last process did
2152
+ * not finish, or one that met an entry it could not remove — is removed again, one after
2153
+ * another. Folders a deletion of this process is already removing are left to it.
2154
+ */
2155
+ resumeDeletions(): Promise<void>;
2156
+ /**
2157
+ * Renames the Agent's folder into `.deleting/`. Null when there was no folder to move; a
2158
+ * folder a program keeps holding is refused with nothing moved.
2121
2159
  */
2122
- deleteAgent(projectId: string, agentId: string): Promise<void>;
2160
+ private moveAside;
2161
+ /** Starts removing `.deleting/<deletionId>` in the background; answers its first reading. */
2162
+ private startPurge;
2123
2163
  /**
2124
2164
  * Create an Agent: the id is chosen by the creator (a semantic id, checked for
2125
2165
  * duplicates against both the DB and the directory within the Project — a 409
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adelie/server",
3
- "version": "0.6.1",
3
+ "version": "0.6.2",
4
4
  "type": "module",
5
5
  "description": "Adelie web server: multi-user authentication and authorization, Session execution with SSE streaming, and usage accounting, built on @adelie/core.",
6
6
  "license": "Apache-2.0",
@@ -77,8 +77,8 @@
77
77
  "unified": "^11.0.5",
78
78
  "ws": "^8.18.3",
79
79
  "yaml": "^2.5.0",
80
- "@adelie/amsp": "0.6.1",
81
- "@adelie/core": "0.6.1"
80
+ "@adelie/amsp": "0.6.2",
81
+ "@adelie/core": "0.6.2"
82
82
  },
83
83
  "devDependencies": {
84
84
  "@types/mdast": "^4.0.4",
@@ -88,7 +88,7 @@
88
88
  "tsup": "^8.3.0",
89
89
  "tsx": "^4.20.0",
90
90
  "vitest": "^3.2.6",
91
- "@adelie/hmr": "0.6.1"
91
+ "@adelie/hmr": "0.6.2"
92
92
  },
93
93
  "files": [
94
94
  "dist",
@@ -1 +1 @@
1
- import{g as nr}from"./index-C6x3SFUc.js";function or(v,F){for(var y=0;y<F.length;y++){const c=F[y];if(typeof c!="string"&&!Array.isArray(c)){for(const f in c)if(f!=="default"&&!(f in v)){const x=Object.getOwnPropertyDescriptor(c,f);x&&Object.defineProperty(v,f,x.get?x:{enumerable:!0,get:()=>c[f]})}}}return Object.freeze(Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}))}var R={exports:{}},Q;function ir(){return Q||(Q=1,(function(v,F){(function(y,c){v.exports=c()})(self,(()=>(()=>{var y={575:function(i,l,s){typeof self<"u"||typeof window<"u"||s.g!==void 0&&s.g,i.exports=(function(){var g,u="3.7.7",t=u,n=typeof Buffer=="function",C=typeof TextDecoder=="function"?new TextDecoder:void 0,B=typeof TextEncoder=="function"?new TextEncoder:void 0,p=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),h=(g={},p.forEach((function(r,e){return g[r]=e})),g),U=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,o=String.fromCharCode.bind(String),D=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(r){return new Uint8Array(Array.prototype.slice.call(r,0))},z=function(r){return r.replace(/=/g,"").replace(/[+\/]/g,(function(e){return e=="+"?"-":"_"}))},Z=function(r){return r.replace(/[^A-Za-z0-9\+\/]/g,"")},$=function(r){for(var e,a,b,m,d="",E=r.length%3,T=0;T<r.length;){if((a=r.charCodeAt(T++))>255||(b=r.charCodeAt(T++))>255||(m=r.charCodeAt(T++))>255)throw new TypeError("invalid character found");d+=p[(e=a<<16|b<<8|m)>>18&63]+p[e>>12&63]+p[e>>6&63]+p[63&e]}return E?d.slice(0,E-3)+"===".substring(E):d},P=typeof btoa=="function"?function(r){return btoa(r)}:n?function(r){return Buffer.from(r,"binary").toString("base64")}:$,O=n?function(r){return Buffer.from(r).toString("base64")}:function(r){for(var e=[],a=0,b=r.length;a<b;a+=4096)e.push(o.apply(null,r.subarray(a,a+4096)));return P(e.join(""))},w=function(r,e){return e===void 0&&(e=!1),e?z(O(r)):O(r)},X=function(r){if(r.length<2)return(e=r.charCodeAt(0))<128?r:e<2048?o(192|e>>>6)+o(128|63&e):o(224|e>>>12&15)+o(128|e>>>6&63)+o(128|63&e);var e=65536+1024*(r.charCodeAt(0)-55296)+(r.charCodeAt(1)-56320);return o(240|e>>>18&7)+o(128|e>>>12&63)+o(128|e>>>6&63)+o(128|63&e)},Y=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,I=function(r){return r.replace(Y,X)},L=n?function(r){return Buffer.from(r,"utf8").toString("base64")}:B?function(r){return O(B.encode(r))}:function(r){return P(I(r))},A=function(r,e){return e===void 0&&(e=!1),e?z(L(r)):L(r)},V=function(r){return A(r,!0)},rr=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,er=function(r){switch(r.length){case 4:var e=((7&r.charCodeAt(0))<<18|(63&r.charCodeAt(1))<<12|(63&r.charCodeAt(2))<<6|63&r.charCodeAt(3))-65536;return o(55296+(e>>>10))+o(56320+(1023&e));case 3:return o((15&r.charCodeAt(0))<<12|(63&r.charCodeAt(1))<<6|63&r.charCodeAt(2));default:return o((31&r.charCodeAt(0))<<6|63&r.charCodeAt(1))}},k=function(r){return r.replace(rr,er)},q=function(r){if(r=r.replace(/\s+/g,""),!U.test(r))throw new TypeError("malformed base64.");r+="==".slice(2-(3&r.length));for(var e,a,b,m="",d=0;d<r.length;)e=h[r.charAt(d++)]<<18|h[r.charAt(d++)]<<12|(a=h[r.charAt(d++)])<<6|(b=h[r.charAt(d++)]),m+=a===64?o(e>>16&255):b===64?o(e>>16&255,e>>8&255):o(e>>16&255,e>>8&255,255&e);return m},j=typeof atob=="function"?function(r){return atob(Z(r))}:n?function(r){return Buffer.from(r,"base64").toString("binary")}:q,M=n?function(r){return D(Buffer.from(r,"base64"))}:function(r){return D(j(r).split("").map((function(e){return e.charCodeAt(0)})))},N=function(r){return M(H(r))},tr=n?function(r){return Buffer.from(r,"base64").toString("utf8")}:C?function(r){return C.decode(M(r))}:function(r){return k(j(r))},H=function(r){return Z(r.replace(/[-_]/g,(function(e){return e=="-"?"+":"/"})))},S=function(r){return tr(H(r))},G=function(r){return{value:r,enumerable:!1,writable:!0,configurable:!0}},J=function(){var r=function(e,a){return Object.defineProperty(String.prototype,e,G(a))};r("fromBase64",(function(){return S(this)})),r("toBase64",(function(e){return A(this,e)})),r("toBase64URI",(function(){return A(this,!0)})),r("toBase64URL",(function(){return A(this,!0)})),r("toUint8Array",(function(){return N(this)}))},K=function(){var r=function(e,a){return Object.defineProperty(Uint8Array.prototype,e,G(a))};r("toBase64",(function(e){return w(this,e)})),r("toBase64URI",(function(){return w(this,!0)})),r("toBase64URL",(function(){return w(this,!0)}))},_={version:u,VERSION:t,atob:j,atobPolyfill:q,btoa:P,btoaPolyfill:$,fromBase64:S,toBase64:A,encode:A,encodeURI:V,encodeURL:V,utob:I,btou:k,decode:S,isValid:function(r){if(typeof r!="string")return!1;var e=r.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},fromUint8Array:w,toUint8Array:N,extendString:J,extendUint8Array:K,extendBuiltins:function(){J(),K()},Base64:{}};return Object.keys(_).forEach((function(r){return _.Base64[r]=_[r]})),_})()}},c={};function f(i){var l=c[i];if(l!==void 0)return l.exports;var s=c[i]={exports:{}};return y[i].call(s.exports,s,s.exports,f),s.exports}f.g=(function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}})();var x={};return(()=>{var i=x;Object.defineProperty(i,"__esModule",{value:!0}),i.Base64=i.BrowserClipboardProvider=i.ClipboardAddon=void 0;const l=f(575);i.ClipboardAddon=class{constructor(u=new g,t=new s){this._base64=u,this._provider=t}activate(u){this._terminal=u,this._disposable=u.parser.registerOscHandler(52,(t=>this._setOrReportClipboard(t)))}dispose(){return this._disposable?.dispose()}_readText(u,t){const n=this._base64.encodeText(t);this._terminal?.input(`\x1B]52;${u};${n}\x07`,!1)}_setOrReportClipboard(u){const t=u.split(";");if(t.length<2)return!0;const n=t[0],C=t[1];if(C==="?"){const h=this._provider.readText(n);return h instanceof Promise?h.then((U=>(this._readText(n,U),!0))):(this._readText(n,h),!0)}let B="";try{B=this._base64.decodeText(C)}catch{}const p=this._provider.writeText(n,B);return!(p instanceof Promise)||p.then((()=>!0))}};class s{async readText(t){return t!=="c"?Promise.resolve(""):navigator.clipboard.readText()}async writeText(t,n){return t!=="c"?Promise.resolve():navigator.clipboard.writeText(n)}}i.BrowserClipboardProvider=s;class g{encodeText(t){return l.Base64.encode(t)}decodeText(t){const n=l.Base64.decode(t);return l.Base64.isValid(t)&&l.Base64.encode(n)===t?n:""}}i.Base64=g})(),x})()))})(R)),R.exports}var W=ir();const ar=nr(W),cr=or({__proto__:null,default:ar},[W]);export{cr as a};
1
+ import{g as nr}from"./index-DL9bbuUA.js";function or(v,F){for(var y=0;y<F.length;y++){const c=F[y];if(typeof c!="string"&&!Array.isArray(c)){for(const f in c)if(f!=="default"&&!(f in v)){const x=Object.getOwnPropertyDescriptor(c,f);x&&Object.defineProperty(v,f,x.get?x:{enumerable:!0,get:()=>c[f]})}}}return Object.freeze(Object.defineProperty(v,Symbol.toStringTag,{value:"Module"}))}var R={exports:{}},Q;function ir(){return Q||(Q=1,(function(v,F){(function(y,c){v.exports=c()})(self,(()=>(()=>{var y={575:function(i,l,s){typeof self<"u"||typeof window<"u"||s.g!==void 0&&s.g,i.exports=(function(){var g,u="3.7.7",t=u,n=typeof Buffer=="function",C=typeof TextDecoder=="function"?new TextDecoder:void 0,B=typeof TextEncoder=="function"?new TextEncoder:void 0,p=Array.prototype.slice.call("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="),h=(g={},p.forEach((function(r,e){return g[r]=e})),g),U=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,o=String.fromCharCode.bind(String),D=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(r){return new Uint8Array(Array.prototype.slice.call(r,0))},z=function(r){return r.replace(/=/g,"").replace(/[+\/]/g,(function(e){return e=="+"?"-":"_"}))},Z=function(r){return r.replace(/[^A-Za-z0-9\+\/]/g,"")},$=function(r){for(var e,a,b,m,d="",E=r.length%3,T=0;T<r.length;){if((a=r.charCodeAt(T++))>255||(b=r.charCodeAt(T++))>255||(m=r.charCodeAt(T++))>255)throw new TypeError("invalid character found");d+=p[(e=a<<16|b<<8|m)>>18&63]+p[e>>12&63]+p[e>>6&63]+p[63&e]}return E?d.slice(0,E-3)+"===".substring(E):d},P=typeof btoa=="function"?function(r){return btoa(r)}:n?function(r){return Buffer.from(r,"binary").toString("base64")}:$,O=n?function(r){return Buffer.from(r).toString("base64")}:function(r){for(var e=[],a=0,b=r.length;a<b;a+=4096)e.push(o.apply(null,r.subarray(a,a+4096)));return P(e.join(""))},w=function(r,e){return e===void 0&&(e=!1),e?z(O(r)):O(r)},X=function(r){if(r.length<2)return(e=r.charCodeAt(0))<128?r:e<2048?o(192|e>>>6)+o(128|63&e):o(224|e>>>12&15)+o(128|e>>>6&63)+o(128|63&e);var e=65536+1024*(r.charCodeAt(0)-55296)+(r.charCodeAt(1)-56320);return o(240|e>>>18&7)+o(128|e>>>12&63)+o(128|e>>>6&63)+o(128|63&e)},Y=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,I=function(r){return r.replace(Y,X)},L=n?function(r){return Buffer.from(r,"utf8").toString("base64")}:B?function(r){return O(B.encode(r))}:function(r){return P(I(r))},A=function(r,e){return e===void 0&&(e=!1),e?z(L(r)):L(r)},V=function(r){return A(r,!0)},rr=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,er=function(r){switch(r.length){case 4:var e=((7&r.charCodeAt(0))<<18|(63&r.charCodeAt(1))<<12|(63&r.charCodeAt(2))<<6|63&r.charCodeAt(3))-65536;return o(55296+(e>>>10))+o(56320+(1023&e));case 3:return o((15&r.charCodeAt(0))<<12|(63&r.charCodeAt(1))<<6|63&r.charCodeAt(2));default:return o((31&r.charCodeAt(0))<<6|63&r.charCodeAt(1))}},k=function(r){return r.replace(rr,er)},q=function(r){if(r=r.replace(/\s+/g,""),!U.test(r))throw new TypeError("malformed base64.");r+="==".slice(2-(3&r.length));for(var e,a,b,m="",d=0;d<r.length;)e=h[r.charAt(d++)]<<18|h[r.charAt(d++)]<<12|(a=h[r.charAt(d++)])<<6|(b=h[r.charAt(d++)]),m+=a===64?o(e>>16&255):b===64?o(e>>16&255,e>>8&255):o(e>>16&255,e>>8&255,255&e);return m},j=typeof atob=="function"?function(r){return atob(Z(r))}:n?function(r){return Buffer.from(r,"base64").toString("binary")}:q,M=n?function(r){return D(Buffer.from(r,"base64"))}:function(r){return D(j(r).split("").map((function(e){return e.charCodeAt(0)})))},N=function(r){return M(H(r))},tr=n?function(r){return Buffer.from(r,"base64").toString("utf8")}:C?function(r){return C.decode(M(r))}:function(r){return k(j(r))},H=function(r){return Z(r.replace(/[-_]/g,(function(e){return e=="-"?"+":"/"})))},S=function(r){return tr(H(r))},G=function(r){return{value:r,enumerable:!1,writable:!0,configurable:!0}},J=function(){var r=function(e,a){return Object.defineProperty(String.prototype,e,G(a))};r("fromBase64",(function(){return S(this)})),r("toBase64",(function(e){return A(this,e)})),r("toBase64URI",(function(){return A(this,!0)})),r("toBase64URL",(function(){return A(this,!0)})),r("toUint8Array",(function(){return N(this)}))},K=function(){var r=function(e,a){return Object.defineProperty(Uint8Array.prototype,e,G(a))};r("toBase64",(function(e){return w(this,e)})),r("toBase64URI",(function(){return w(this,!0)})),r("toBase64URL",(function(){return w(this,!0)}))},_={version:u,VERSION:t,atob:j,atobPolyfill:q,btoa:P,btoaPolyfill:$,fromBase64:S,toBase64:A,encode:A,encodeURI:V,encodeURL:V,utob:I,btou:k,decode:S,isValid:function(r){if(typeof r!="string")return!1;var e=r.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(e)||!/[^\s0-9a-zA-Z\-_]/.test(e)},fromUint8Array:w,toUint8Array:N,extendString:J,extendUint8Array:K,extendBuiltins:function(){J(),K()},Base64:{}};return Object.keys(_).forEach((function(r){return _.Base64[r]=_[r]})),_})()}},c={};function f(i){var l=c[i];if(l!==void 0)return l.exports;var s=c[i]={exports:{}};return y[i].call(s.exports,s,s.exports,f),s.exports}f.g=(function(){if(typeof globalThis=="object")return globalThis;try{return this||new Function("return this")()}catch{if(typeof window=="object")return window}})();var x={};return(()=>{var i=x;Object.defineProperty(i,"__esModule",{value:!0}),i.Base64=i.BrowserClipboardProvider=i.ClipboardAddon=void 0;const l=f(575);i.ClipboardAddon=class{constructor(u=new g,t=new s){this._base64=u,this._provider=t}activate(u){this._terminal=u,this._disposable=u.parser.registerOscHandler(52,(t=>this._setOrReportClipboard(t)))}dispose(){return this._disposable?.dispose()}_readText(u,t){const n=this._base64.encodeText(t);this._terminal?.input(`\x1B]52;${u};${n}\x07`,!1)}_setOrReportClipboard(u){const t=u.split(";");if(t.length<2)return!0;const n=t[0],C=t[1];if(C==="?"){const h=this._provider.readText(n);return h instanceof Promise?h.then((U=>(this._readText(n,U),!0))):(this._readText(n,h),!0)}let B="";try{B=this._base64.decodeText(C)}catch{}const p=this._provider.writeText(n,B);return!(p instanceof Promise)||p.then((()=>!0))}};class s{async readText(t){return t!=="c"?Promise.resolve(""):navigator.clipboard.readText()}async writeText(t,n){return t!=="c"?Promise.resolve():navigator.clipboard.writeText(n)}}i.BrowserClipboardProvider=s;class g{encodeText(t){return l.Base64.encode(t)}decodeText(t){const n=l.Base64.decode(t);return l.Base64.isValid(t)&&l.Base64.encode(n)===t?n:""}}i.Base64=g})(),x})()))})(R)),R.exports}var W=ir();const ar=nr(W),cr=or({__proto__:null,default:ar},[W]);export{cr as a};
@@ -1 +1 @@
1
- import{g}from"./index-C6x3SFUc.js";function _(i,s){for(var o=0;o<s.length;o++){const t=s[o];if(typeof t!="string"&&!Array.isArray(t)){for(const e in t)if(e!=="default"&&!(e in i)){const r=Object.getOwnPropertyDescriptor(t,e);r&&Object.defineProperty(i,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}var a={exports:{}},d;function y(){return d||(d=1,(function(i,s){(function(o,t){i.exports=t()})(self,(()=>(()=>{var o={};return(()=>{var t=o;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const r=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(r._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,r=e._renderService.dimensions;if(r.css.cell.width===0||r.css.cell.height===0)return;const c=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,l=window.getComputedStyle(this._terminal.element.parentElement),m=parseInt(l.getPropertyValue("height")),u=Math.max(0,parseInt(l.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),h=m-(parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))),f=u-(parseInt(n.getPropertyValue("padding-right"))+parseInt(n.getPropertyValue("padding-left")))-c;return{cols:Math.max(2,Math.floor(f/r.css.cell.width)),rows:Math.max(1,Math.floor(h/r.css.cell.height))}}}})(),o})()))})(a)),a.exports}var p=y();const w=g(p),x=_({__proto__:null,default:w},[p]);export{x as a};
1
+ import{g}from"./index-DL9bbuUA.js";function _(i,s){for(var o=0;o<s.length;o++){const t=s[o];if(typeof t!="string"&&!Array.isArray(t)){for(const e in t)if(e!=="default"&&!(e in i)){const r=Object.getOwnPropertyDescriptor(t,e);r&&Object.defineProperty(i,e,r.get?r:{enumerable:!0,get:()=>t[e]})}}}return Object.freeze(Object.defineProperty(i,Symbol.toStringTag,{value:"Module"}))}var a={exports:{}},d;function y(){return d||(d=1,(function(i,s){(function(o,t){i.exports=t()})(self,(()=>(()=>{var o={};return(()=>{var t=o;Object.defineProperty(t,"__esModule",{value:!0}),t.FitAddon=void 0,t.FitAddon=class{activate(e){this._terminal=e}dispose(){}fit(){const e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;const r=this._terminal._core;this._terminal.rows===e.rows&&this._terminal.cols===e.cols||(r._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;const e=this._terminal._core,r=e._renderService.dimensions;if(r.css.cell.width===0||r.css.cell.height===0)return;const c=this._terminal.options.scrollback===0?0:e.viewport.scrollBarWidth,l=window.getComputedStyle(this._terminal.element.parentElement),m=parseInt(l.getPropertyValue("height")),u=Math.max(0,parseInt(l.getPropertyValue("width"))),n=window.getComputedStyle(this._terminal.element),h=m-(parseInt(n.getPropertyValue("padding-top"))+parseInt(n.getPropertyValue("padding-bottom"))),f=u-(parseInt(n.getPropertyValue("padding-right"))+parseInt(n.getPropertyValue("padding-left")))-c;return{cols:Math.max(2,Math.floor(f/r.css.cell.width)),rows:Math.max(1,Math.floor(h/r.css.cell.height))}}}})(),o})()))})(a)),a.exports}var p=y();const w=g(p),x=_({__proto__:null,default:w},[p]);export{x as a};
@@ -1 +1 @@
1
- import{g as O}from"./index-C6x3SFUc.js";function j(b,k){for(var _=0;_<k.length;_++){const l=k[_];if(typeof l!="string"&&!Array.isArray(l)){for(const u in l)if(u!=="default"&&!(u in b)){const L=Object.getOwnPropertyDescriptor(l,u);L&&Object.defineProperty(b,u,L.get?L:{enumerable:!0,get:()=>l[u]})}}}return Object.freeze(Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}))}var w={exports:{}},C;function A(){return C||(C=1,(function(b,k){(function(_,l){b.exports=l()})(self,(()=>(()=>{var _={6:(p,d)=>{function h(s){try{const e=new URL(s),t=e.password&&e.username?`${e.protocol}//${e.username}:${e.password}@${e.host}`:e.username?`${e.protocol}//${e.username}@${e.host}`:`${e.protocol}//${e.host}`;return s.toLocaleLowerCase().startsWith(t.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(d,"__esModule",{value:!0}),d.LinkComputer=d.WebLinkProvider=void 0,d.WebLinkProvider=class{constructor(s,e,t,r={}){this._terminal=s,this._regex=e,this._handler=t,this._options=r}provideLinks(s,e){const t=f.computeLink(s,this._regex,this._terminal,this._handler);e(this._addCallbacks(t))}_addCallbacks(s){return s.map((e=>(e.leave=this._options.leave,e.hover=(t,r)=>{if(this._options.hover){const{range:c}=e;this._options.hover(t,r,c)}},e)))}};class f{static computeLink(e,t,r,c){const g=new RegExp(t.source,(t.flags||"")+"g"),[n,o]=f._getWindowedLineStrings(e-1,r),i=n.join("");let a;const x=[];for(;a=g.exec(i);){const v=a[0];if(!h(v))continue;const[m,W]=f._mapStrIdx(r,o,0,a.index),[y,P]=f._mapStrIdx(r,m,W,v.length);if(m===-1||W===-1||y===-1||P===-1)continue;const $={start:{x:W+1,y:m+1},end:{x:P,y:y+1}};x.push({range:$,text:v,activate:c})}return x}static _getWindowedLineStrings(e,t){let r,c=e,g=e,n=0,o="";const i=[];if(r=t.buffer.active.getLine(e)){const a=r.translateToString(!0);if(r.isWrapped&&a[0]!==" "){for(n=0;(r=t.buffer.active.getLine(--c))&&n<2048&&(o=r.translateToString(!0),n+=o.length,i.push(o),r.isWrapped&&o.indexOf(" ")===-1););i.reverse()}for(i.push(a),n=0;(r=t.buffer.active.getLine(++g))&&r.isWrapped&&n<2048&&(o=r.translateToString(!0),n+=o.length,i.push(o),o.indexOf(" ")===-1););}return[i,c]}static _mapStrIdx(e,t,r,c){const g=e.buffer.active,n=g.getNullCell();let o=r;for(;c;){const i=g.getLine(t);if(!i)return[-1,-1];for(let a=o;a<i.length;++a){i.getCell(a,n);const x=n.getChars();if(n.getWidth()&&(c-=x.length||1,a===i.length-1&&x==="")){const v=g.getLine(t+1);v&&v.isWrapped&&(v.getCell(0,n),n.getWidth()===2&&(c+=1))}if(c<0)return[t,a]}t++,o=0}return[t,o]}}d.LinkComputer=f}},l={};function u(p){var d=l[p];if(d!==void 0)return d.exports;var h=l[p]={exports:{}};return _[p](h,h.exports,u),h.exports}var L={};return(()=>{var p=L;Object.defineProperty(p,"__esModule",{value:!0}),p.WebLinksAddon=void 0;const d=u(6),h=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function f(s,e){const t=window.open();if(t){try{t.opener=null}catch{}t.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}p.WebLinksAddon=class{constructor(s=f,e={}){this._handler=s,this._options=e}activate(s){this._terminal=s;const e=this._options,t=e.urlRegex||h;this._linkProvider=this._terminal.registerLinkProvider(new d.WebLinkProvider(this._terminal,t,this._handler,e))}dispose(){this._linkProvider?.dispose()}}})(),L})()))})(w)),w.exports}var S=A();const T=O(S),E=j({__proto__:null,default:T},[S]);export{E as a};
1
+ import{g as O}from"./index-DL9bbuUA.js";function j(b,k){for(var _=0;_<k.length;_++){const l=k[_];if(typeof l!="string"&&!Array.isArray(l)){for(const u in l)if(u!=="default"&&!(u in b)){const L=Object.getOwnPropertyDescriptor(l,u);L&&Object.defineProperty(b,u,L.get?L:{enumerable:!0,get:()=>l[u]})}}}return Object.freeze(Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}))}var w={exports:{}},C;function A(){return C||(C=1,(function(b,k){(function(_,l){b.exports=l()})(self,(()=>(()=>{var _={6:(p,d)=>{function h(s){try{const e=new URL(s),t=e.password&&e.username?`${e.protocol}//${e.username}:${e.password}@${e.host}`:e.username?`${e.protocol}//${e.username}@${e.host}`:`${e.protocol}//${e.host}`;return s.toLocaleLowerCase().startsWith(t.toLocaleLowerCase())}catch{return!1}}Object.defineProperty(d,"__esModule",{value:!0}),d.LinkComputer=d.WebLinkProvider=void 0,d.WebLinkProvider=class{constructor(s,e,t,r={}){this._terminal=s,this._regex=e,this._handler=t,this._options=r}provideLinks(s,e){const t=f.computeLink(s,this._regex,this._terminal,this._handler);e(this._addCallbacks(t))}_addCallbacks(s){return s.map((e=>(e.leave=this._options.leave,e.hover=(t,r)=>{if(this._options.hover){const{range:c}=e;this._options.hover(t,r,c)}},e)))}};class f{static computeLink(e,t,r,c){const g=new RegExp(t.source,(t.flags||"")+"g"),[n,o]=f._getWindowedLineStrings(e-1,r),i=n.join("");let a;const x=[];for(;a=g.exec(i);){const v=a[0];if(!h(v))continue;const[m,W]=f._mapStrIdx(r,o,0,a.index),[y,P]=f._mapStrIdx(r,m,W,v.length);if(m===-1||W===-1||y===-1||P===-1)continue;const $={start:{x:W+1,y:m+1},end:{x:P,y:y+1}};x.push({range:$,text:v,activate:c})}return x}static _getWindowedLineStrings(e,t){let r,c=e,g=e,n=0,o="";const i=[];if(r=t.buffer.active.getLine(e)){const a=r.translateToString(!0);if(r.isWrapped&&a[0]!==" "){for(n=0;(r=t.buffer.active.getLine(--c))&&n<2048&&(o=r.translateToString(!0),n+=o.length,i.push(o),r.isWrapped&&o.indexOf(" ")===-1););i.reverse()}for(i.push(a),n=0;(r=t.buffer.active.getLine(++g))&&r.isWrapped&&n<2048&&(o=r.translateToString(!0),n+=o.length,i.push(o),o.indexOf(" ")===-1););}return[i,c]}static _mapStrIdx(e,t,r,c){const g=e.buffer.active,n=g.getNullCell();let o=r;for(;c;){const i=g.getLine(t);if(!i)return[-1,-1];for(let a=o;a<i.length;++a){i.getCell(a,n);const x=n.getChars();if(n.getWidth()&&(c-=x.length||1,a===i.length-1&&x==="")){const v=g.getLine(t+1);v&&v.isWrapped&&(v.getCell(0,n),n.getWidth()===2&&(c+=1))}if(c<0)return[t,a]}t++,o=0}return[t,o]}}d.LinkComputer=f}},l={};function u(p){var d=l[p];if(d!==void 0)return d.exports;var h=l[p]={exports:{}};return _[p](h,h.exports,u),h.exports}var L={};return(()=>{var p=L;Object.defineProperty(p,"__esModule",{value:!0}),p.WebLinksAddon=void 0;const d=u(6),h=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function f(s,e){const t=window.open();if(t){try{t.opener=null}catch{}t.location.href=e}else console.warn("Opening link blocked as opener could not be cleared")}p.WebLinksAddon=class{constructor(s=f,e={}){this._handler=s,this._options=e}activate(s){this._terminal=s;const e=this._options,t=e.urlRegex||h;this._linkProvider=this._terminal.registerLinkProvider(new d.WebLinkProvider(this._terminal,t,this._handler,e))}dispose(){this._linkProvider?.dispose()}}})(),L})()))})(w)),w.exports}var S=A();const T=O(S),E=j({__proto__:null,default:T},[S]);export{E as a};
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighter-core-DCah6UVE.js","assets/index-C6x3SFUc.js","assets/index-Cbl9S1Sc.css"])))=>i.map(i=>d[i]);
2
- import{_ as u}from"./index-C6x3SFUc.js";let o,h=0;const n=new Map;function w(e){for(const[t,r]of n)r(e(t));n.clear()}function f(){if(o!==void 0)return o;try{const e=new Worker(new URL("/assets/highlighter.worker-CPvC3l9a.js",import.meta.url),{type:"module"});e.onmessage=t=>{const r=n.get(t.data.id);r&&(n.delete(t.data.id),r(t.data))},e.onerror=()=>{o=null,w(t=>({id:t,error:"worker failed"}))},o=e}catch{o=null}return o}async function m(e,t,r={}){const s=f();if(s===null){const{highlight:i}=await u(async()=>{const{highlight:d}=await import("./highlighter-core-DCah6UVE.js");return{highlight:d}},__vite__mapDeps([0,1,2]));return i(e,t,r)}const a=h+=1,c={id:a,code:e,language:t,options:r},l=await new Promise(i=>{n.set(a,i),s.postMessage(c)});if(l.error===void 0)return l.html}export{m as highlightToHtml};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/highlighter-core-CcnmtXzl.js","assets/index-DL9bbuUA.js","assets/index-BjoQYX7Z.css"])))=>i.map(i=>d[i]);
2
+ import{_ as u}from"./index-DL9bbuUA.js";let o,h=0;const n=new Map;function w(e){for(const[t,r]of n)r(e(t));n.clear()}function f(){if(o!==void 0)return o;try{const e=new Worker(new URL("/assets/highlighter.worker-CPvC3l9a.js",import.meta.url),{type:"module"});e.onmessage=t=>{const r=n.get(t.data.id);r&&(n.delete(t.data.id),r(t.data))},e.onerror=()=>{o=null,w(t=>({id:t,error:"worker failed"}))},o=e}catch{o=null}return o}async function m(e,t,r={}){const s=f();if(s===null){const{highlight:i}=await u(async()=>{const{highlight:d}=await import("./highlighter-core-CcnmtXzl.js");return{highlight:d}},__vite__mapDeps([0,1,2]));return i(e,t,r)}const a=h+=1,c={id:a,code:e,language:t,options:r},l=await new Promise(i=>{n.set(a,i),s.postMessage(c)});if(l.error===void 0)return l.html}export{m as highlightToHtml};
@@ -1,4 +1,4 @@
1
- import{w as vt,s as Nn,f as $r,a as Lr,b as Pr,c as Dt,h as Tr,r as Gr,i as Mr,L as Or,_ as jt}from"./index-C6x3SFUc.js";const Ut={}.hasOwnProperty;function Br(e,t){const n=t||{};function r(s,...o){let i=r.invalid;const a=r.handlers;if(s&&Ut.call(s,e)){const c=String(s[e]);i=Ut.call(a,c)?a[c]:r.unknown}if(i)return i.call(this,s,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var k=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Fr(e){return Nt(e)}function Nt(e){return Array.isArray(e)?Dr(e):e instanceof RegExp?e:typeof e=="object"?jr(e):e}function Dr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Nt(e[n]);return t}function jr(e){let t={};for(let n in e)t[n]=Nt(e[n]);return t}function Rn(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function $n(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?$n(e.substring(0,e.length-1)):e.substr(~t+1)}var Je=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,we=class{static hasCaptures(e){return e===null?!1:(Je.lastIndex=0,Je.test(e))}static replaceCaptures(e,t,n){return e.replace(Je,(r,s,o,i)=>{let a=n[parseInt(s||o,10)];if(a){let c=t.substring(a.start,a.end);for(;c[0]===".";)c=c.substring(1);switch(i){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function Ln(e,t){return e<t?-1:e>t?1:0}function Pn(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let s=0;s<n;s++){let o=Ln(e[s],t[s]);if(o!==0)return o}return 0}return n-r}function Wt(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Tn(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Gn=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},Ne=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(zr(e),t)}static createFromParsedTheme(e,t){return qr(e,t)}_cachedMatchRoot=new Gn(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(s=>Ur(e.parent,s.parentScopes));return r?new Mn(r.fontStyle,r.foreground,r.background):null}},Ye=class Ae{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Ae(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new Ae(n,t[r]);return n}push(t){return new Ae(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push(r.scopeName),r=r.parent;return r===t?n.reverse():void 0}};function Ur(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],s=!1;if(r===">"){if(n===t.length-1)return!1;r=t[++n],s=!0}for(;e&&!Wr(e.scopeName,r);){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Wr(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var Mn=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function zr(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let s=0,o=t.length;s<o;s++){let i=t[s];if(!i.settings)continue;let a;if(typeof i.scope=="string"){let h=i.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),a=h.split(",")}else Array.isArray(i.scope)?a=i.scope:a=[""];let c=-1;if(typeof i.settings.fontStyle=="string"){c=0;let h=i.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 i.settings.foreground=="string"&&Wt(i.settings.foreground)&&(l=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&Wt(i.settings.background)&&(u=i.settings.background);for(let h=0,f=a.length;h<f;h++){let p=a[h].trim().split(" "),y=p[p.length-1],b=null;p.length>1&&(b=p.slice(0,p.length-1),b.reverse()),n[r++]=new Hr(y,b,s,c,l,u)}}return n}var Hr=class{constructor(e,t,n,r,s,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=s,this.background=o}},R=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(R||{});function qr(e,t){e.sort((c,l)=>{let u=Ln(c.scope,l.scope);return u!==0||(u=Pn(c.parentScopes,l.parentScopes),u!==0)?u:c.index-l.index});let n=0,r="#000000",s="#ffffff";for(;e.length>=1&&e[0].scope==="";){let c=e.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(r=c.foreground),c.background!==null&&(s=c.background)}let o=new Vr(t),i=new Mn(n,o.getId(r),o.getId(s)),a=new Qr(new ft(0,null,-1,0,0),[]);for(let c=0,l=e.length;c<l;c++){let u=e[c];a.insert(0,u.scope,u.parentScopes,u.fontStyle,o.getId(u.foreground),o.getId(u.background))}return new Ne(o,i,a)}var Vr=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Xr=Object.freeze([]),ft=class On{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(t,n,r,s,o){this.scopeDepth=t,this.parentScopes=n||Xr,this.fontStyle=r,this.foreground=s,this.background=o}clone(){return new On(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let r=0,s=t.length;r<s;r++)n[r]=t[r].clone();return n}acceptOverwrite(t,n,r,s){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},Qr=class dt{constructor(t,n=[],r={}){this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,s=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=t.parentScopes.length||s>=n.parentScopes.length);){const o=n.parentScopes[s].length-t.parentScopes[r].length;if(o!==0)return o;r++,s++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),s,o;if(r===-1?(s=t,o=""):(s=t.substring(0,r),o=t.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(o)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(dt._cmpBySpecificity),n}insert(t,n,r,s,o,i){if(n===""){this._doInsertHere(t,r,s,o,i);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 dt(this._mainRule.clone(),ft.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,s,o,i)}_doInsertHere(t,n,r,s,o){if(n===null){this._mainRule.acceptOverwrite(t,r,s,o);return}for(let i=0,a=this._rulesWithParentScopes.length;i<a;i++){let c=this._rulesWithParentScopes[i];if(Pn(c.parentScopes,n)===0){c.acceptOverwrite(t,r,s,o);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),o===0&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new ft(t,n,r,s,o))}},J=class L{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=L.getLanguageId(t),r=L.getTokenType(t),s=L.getFontStyle(t),o=L.getForeground(t),i=L.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:o,background:i})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,s,o,i,a){let c=L.getLanguageId(t),l=L.getTokenType(t),u=L.containsBalancedBrackets(t)?1:0,h=L.getFontStyle(t),f=L.getForeground(t),d=L.getBackground(t);return n!==0&&(c=n),r!==8&&(l=r),s!==null&&(u=s?1:0),o!==-1&&(h=o),i!==0&&(f=i),a!==0&&(d=a),(c<<0|l<<8|u<<10|h<<11|f<<15|d<<24)>>>0}};function Re(e,t){const n=[],r=Kr(e);let 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=i();if(n.push({matcher:l,priority:c}),s!==",")break;s=r.next()}return n;function o(){if(s==="-"){s=r.next();const c=o();return l=>!!c&&!c(l)}if(s==="("){s=r.next();const c=a();return s===")"&&(s=r.next()),c}if(zt(s)){const c=[];do c.push(s),s=r.next();while(zt(s));return l=>t(c,l)}return null}function i(){const c=[];let l=o();for(;l;)c.push(l),l=o();return u=>c.every(h=>h(u))}function a(){const c=[];let l=i();for(;l&&(c.push(l),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");l=i()}return u=>c.some(h=>h(u))}}function zt(e){return!!e&&!!e.match(/[\w\.:]+/)}function Kr(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function Bn(e){typeof e.dispose=="function"&&e.dispose()}var de=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Zr=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Jr=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Yr=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new de(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new Jr;for(const n of e)es(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof de){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 es(e,t,n,r){const s=n.lookup(e.scopeName);if(!s){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const o=n.lookup(t);e instanceof de?Ie({baseGrammar:o,selfGrammar:s},r):pt(e.ruleName,{baseGrammar:o,selfGrammar:s,repository:s.repository},r);const i=n.injections(e.scopeName);if(i)for(const a of i)r.add(new de(a))}function pt(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];$e([r],t,n)}}function Ie(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&$e(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&$e(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function $e(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?Rn({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&$e(r.patterns,{...t,repository:s},n);const o=r.include;if(!o)continue;const i=Fn(o);switch(i.kind){case 0:Ie({...t,selfGrammar:t.baseGrammar},n);break;case 1:Ie(t,n);break;case 2:pt(i.ruleName,{...t,repository:s},n);break;case 3:case 4:const a=i.scopeName===t.selfGrammar.scopeName?t.selfGrammar:i.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(a){const c={baseGrammar:t.baseGrammar,selfGrammar:a,repository:s};i.kind===4?pt(i.ruleName,c,n):Ie(c,n)}else i.kind===4?n.add(new Zr(i.scopeName,i.ruleName)):n.add(new de(i.scopeName));break}}}var ts=class{kind=0},ns=class{kind=1},rs=class{constructor(e){this.ruleName=e}kind=2},ss=class{constructor(e){this.scopeName=e}kind=3},os=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Fn(e){if(e==="$base")return new ts;if(e==="$self")return new ns;const t=e.indexOf("#");if(t===-1)return new ss(e);if(t===0)return new rs(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new os(n,r)}}var is=/\\(\d+)/,Ht=/\\(\d+)/g,as=-1,Dn=-2;var be=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=we.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=we.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${$n(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:we.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:we.replaceCaptures(this._contentName,e,t)}},cs=class extends be{retokenizeCapturedWithRuleId;constructor(e,t,n,r,s){super(e,t,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,r){throw new Error("Not supported!")}},ls=class extends be{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,s){super(e,t,n,null),this._match=new pe(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(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ge,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},qt=class extends be{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,s){super(e,t,n,r),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ge,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},gt=class extends be{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,s,o,i,a,c,l){super(e,t,n,r),this._begin=new pe(s,this.id),this.beginCaptures=o,this._end=new pe(i||"￿",-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(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ge;for(const n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Le=class extends be{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,s,o,i,a,c){super(e,t,n,r),this._begin=new pe(s,this.id),this.beginCaptures=o,this.whileCaptures=a,this._while=new pe(i,Dn),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(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ge;for(const t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new ge,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},jn=class N{static createCaptureRule(t,n,r,s,o){return t.registerRule(i=>new cs(n,i,r,s,o))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(s=>{if(t.id=s,t.match)return new ls(t.$vscodeTextmateLocation,t.id,t.name,t.match,N._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=Rn({},r,t.repository));let o=t.patterns;return typeof o>"u"&&t.include&&(o=[{include:t.include}]),new qt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,N._compilePatterns(o,n,r))}return t.while?new Le(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,N._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,N._compileCaptures(t.whileCaptures||t.captures,n,r),N._compilePatterns(t.patterns,n,r)):new gt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,N._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,N._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,N._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let s=[];if(t){let o=0;for(const i in t){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);a>o&&(o=a)}for(let i=0;i<=o;i++)s[i]=null;for(const i in t){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);let c=0;t[i].patterns&&(c=N.getCompiledRuleId(t[i],n,r)),s[a]=N.createCaptureRule(n,t[i].$vscodeTextmateLocation,t[i].name,t[i].contentName,c)}}return s}static _compilePatterns(t,n,r){let s=[];if(t)for(let o=0,i=t.length;o<i;o++){const a=t[o];let c=-1;if(a.include){const l=Fn(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:const h=l.scopeName,f=l.kind===4?l.ruleName:null,d=n.getExternalGrammar(h,r);if(d)if(f){let p=d.repository[f];p&&(c=N.getCompiledRuleId(p,n,d.repository))}else c=N.getCompiledRuleId(d.repository.$self,n,d.repository);break}}else c=N.getCompiledRuleId(a,n,r);if(c!==-1){const l=n.getRule(c);let u=!1;if((l instanceof qt||l instanceof gt||l instanceof Le)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;s.push(c)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},pe=class Un{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(t,n){if(t&&typeof t=="string"){const r=t.length;let s=0,o=[],i=!1;for(let a=0;a<r;a++)if(t.charAt(a)==="\\"&&a+1<r){const l=t.charAt(a+1);l==="z"?(o.push(t.substring(s,a)),o.push("$(?!\\n)(?<!\\n)"),s=a+2):(l==="A"||l==="G")&&(i=!0),a++}this.hasAnchor=i,s===0?this.source=t:(o.push(t.substring(s,r)),this.source=o.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=is.test(this.source):this.hasBackReferences=!1}clone(){return new Un(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,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=>t.substring(s.start,s.end));return Ht.lastIndex=0,this.source.replace(Ht,(s,o)=>Tn(r[parseInt(o,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],s=[],o,i,a,c;for(o=0,i=this.source.length;o<i;o++)a=this.source.charAt(o),t[o]=a,n[o]=a,r[o]=a,s[o]=a,a==="\\"&&o+1<i&&(c=this.source.charAt(o+1),c==="A"?(t[o+1]="￿",n[o+1]="￿",r[o+1]="A",s[o+1]="A"):c==="G"?(t[o+1]="￿",n[o+1]="G",r[o+1]="￿",s[o+1]="G"):(t[o+1]=c,n[o+1]=c,r[o+1]=c,s[o+1]=c),o++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},ge=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new Vt(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(s=>s.resolveAnchors(t,n));return new Vt(e,r,this._items.map(s=>s.ruleId))}},Vt=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
1
+ import{w as vt,s as Nn,f as $r,a as Lr,b as Pr,c as Dt,h as Tr,r as Gr,i as Mr,L as Or,_ as jt}from"./index-DL9bbuUA.js";const Ut={}.hasOwnProperty;function Br(e,t){const n=t||{};function r(s,...o){let i=r.invalid;const a=r.handlers;if(s&&Ut.call(s,e)){const c=String(s[e]);i=Ut.call(a,c)?a[c]:r.unknown}if(i)return i.call(this,s,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var k=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Fr(e){return Nt(e)}function Nt(e){return Array.isArray(e)?Dr(e):e instanceof RegExp?e:typeof e=="object"?jr(e):e}function Dr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Nt(e[n]);return t}function jr(e){let t={};for(let n in e)t[n]=Nt(e[n]);return t}function Rn(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function $n(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?$n(e.substring(0,e.length-1)):e.substr(~t+1)}var Je=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,we=class{static hasCaptures(e){return e===null?!1:(Je.lastIndex=0,Je.test(e))}static replaceCaptures(e,t,n){return e.replace(Je,(r,s,o,i)=>{let a=n[parseInt(s||o,10)];if(a){let c=t.substring(a.start,a.end);for(;c[0]===".";)c=c.substring(1);switch(i){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function Ln(e,t){return e<t?-1:e>t?1:0}function Pn(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let s=0;s<n;s++){let o=Ln(e[s],t[s]);if(o!==0)return o}return 0}return n-r}function Wt(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Tn(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Gn=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},Ne=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(zr(e),t)}static createFromParsedTheme(e,t){return qr(e,t)}_cachedMatchRoot=new Gn(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(s=>Ur(e.parent,s.parentScopes));return r?new Mn(r.fontStyle,r.foreground,r.background):null}},Ye=class Ae{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new Ae(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new Ae(n,t[r]);return n}push(t){return new Ae(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push(r.scopeName),r=r.parent;return r===t?n.reverse():void 0}};function Ur(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],s=!1;if(r===">"){if(n===t.length-1)return!1;r=t[++n],s=!0}for(;e&&!Wr(e.scopeName,r);){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Wr(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var Mn=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function zr(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let s=0,o=t.length;s<o;s++){let i=t[s];if(!i.settings)continue;let a;if(typeof i.scope=="string"){let h=i.scope;h=h.replace(/^[,]+/,""),h=h.replace(/[,]+$/,""),a=h.split(",")}else Array.isArray(i.scope)?a=i.scope:a=[""];let c=-1;if(typeof i.settings.fontStyle=="string"){c=0;let h=i.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 i.settings.foreground=="string"&&Wt(i.settings.foreground)&&(l=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&Wt(i.settings.background)&&(u=i.settings.background);for(let h=0,f=a.length;h<f;h++){let p=a[h].trim().split(" "),y=p[p.length-1],b=null;p.length>1&&(b=p.slice(0,p.length-1),b.reverse()),n[r++]=new Hr(y,b,s,c,l,u)}}return n}var Hr=class{constructor(e,t,n,r,s,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=s,this.background=o}},R=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(R||{});function qr(e,t){e.sort((c,l)=>{let u=Ln(c.scope,l.scope);return u!==0||(u=Pn(c.parentScopes,l.parentScopes),u!==0)?u:c.index-l.index});let n=0,r="#000000",s="#ffffff";for(;e.length>=1&&e[0].scope==="";){let c=e.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(r=c.foreground),c.background!==null&&(s=c.background)}let o=new Vr(t),i=new Mn(n,o.getId(r),o.getId(s)),a=new Qr(new ft(0,null,-1,0,0),[]);for(let c=0,l=e.length;c<l;c++){let u=e[c];a.insert(0,u.scope,u.parentScopes,u.fontStyle,o.getId(u.foreground),o.getId(u.background))}return new Ne(o,i,a)}var Vr=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Xr=Object.freeze([]),ft=class On{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(t,n,r,s,o){this.scopeDepth=t,this.parentScopes=n||Xr,this.fontStyle=r,this.foreground=s,this.background=o}clone(){return new On(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let r=0,s=t.length;r<s;r++)n[r]=t[r].clone();return n}acceptOverwrite(t,n,r,s){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},Qr=class dt{constructor(t,n=[],r={}){this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,s=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=t.parentScopes.length||s>=n.parentScopes.length);){const o=n.parentScopes[s].length-t.parentScopes[r].length;if(o!==0)return o;r++,s++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),s,o;if(r===-1?(s=t,o=""):(s=t.substring(0,r),o=t.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(o)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(dt._cmpBySpecificity),n}insert(t,n,r,s,o,i){if(n===""){this._doInsertHere(t,r,s,o,i);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 dt(this._mainRule.clone(),ft.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,s,o,i)}_doInsertHere(t,n,r,s,o){if(n===null){this._mainRule.acceptOverwrite(t,r,s,o);return}for(let i=0,a=this._rulesWithParentScopes.length;i<a;i++){let c=this._rulesWithParentScopes[i];if(Pn(c.parentScopes,n)===0){c.acceptOverwrite(t,r,s,o);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),o===0&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new ft(t,n,r,s,o))}},J=class L{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=L.getLanguageId(t),r=L.getTokenType(t),s=L.getFontStyle(t),o=L.getForeground(t),i=L.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:o,background:i})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,s,o,i,a){let c=L.getLanguageId(t),l=L.getTokenType(t),u=L.containsBalancedBrackets(t)?1:0,h=L.getFontStyle(t),f=L.getForeground(t),d=L.getBackground(t);return n!==0&&(c=n),r!==8&&(l=r),s!==null&&(u=s?1:0),o!==-1&&(h=o),i!==0&&(f=i),a!==0&&(d=a),(c<<0|l<<8|u<<10|h<<11|f<<15|d<<24)>>>0}};function Re(e,t){const n=[],r=Kr(e);let 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=i();if(n.push({matcher:l,priority:c}),s!==",")break;s=r.next()}return n;function o(){if(s==="-"){s=r.next();const c=o();return l=>!!c&&!c(l)}if(s==="("){s=r.next();const c=a();return s===")"&&(s=r.next()),c}if(zt(s)){const c=[];do c.push(s),s=r.next();while(zt(s));return l=>t(c,l)}return null}function i(){const c=[];let l=o();for(;l;)c.push(l),l=o();return u=>c.every(h=>h(u))}function a(){const c=[];let l=i();for(;l&&(c.push(l),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");l=i()}return u=>c.some(h=>h(u))}}function zt(e){return!!e&&!!e.match(/[\w\.:]+/)}function Kr(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function Bn(e){typeof e.dispose=="function"&&e.dispose()}var de=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},Zr=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},Jr=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},Yr=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new de(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new Jr;for(const n of e)es(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof de){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 es(e,t,n,r){const s=n.lookup(e.scopeName);if(!s){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const o=n.lookup(t);e instanceof de?Ie({baseGrammar:o,selfGrammar:s},r):pt(e.ruleName,{baseGrammar:o,selfGrammar:s,repository:s.repository},r);const i=n.injections(e.scopeName);if(i)for(const a of i)r.add(new de(a))}function pt(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];$e([r],t,n)}}function Ie(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&$e(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&$e(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function $e(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?Rn({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&$e(r.patterns,{...t,repository:s},n);const o=r.include;if(!o)continue;const i=Fn(o);switch(i.kind){case 0:Ie({...t,selfGrammar:t.baseGrammar},n);break;case 1:Ie(t,n);break;case 2:pt(i.ruleName,{...t,repository:s},n);break;case 3:case 4:const a=i.scopeName===t.selfGrammar.scopeName?t.selfGrammar:i.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(a){const c={baseGrammar:t.baseGrammar,selfGrammar:a,repository:s};i.kind===4?pt(i.ruleName,c,n):Ie(c,n)}else i.kind===4?n.add(new Zr(i.scopeName,i.ruleName)):n.add(new de(i.scopeName));break}}}var ts=class{kind=0},ns=class{kind=1},rs=class{constructor(e){this.ruleName=e}kind=2},ss=class{constructor(e){this.scopeName=e}kind=3},os=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Fn(e){if(e==="$base")return new ts;if(e==="$self")return new ns;const t=e.indexOf("#");if(t===-1)return new ss(e);if(t===0)return new rs(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new os(n,r)}}var is=/\\(\d+)/,Ht=/\\(\d+)/g,as=-1,Dn=-2;var be=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=we.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=we.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${$n(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:we.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:we.replaceCaptures(this._contentName,e,t)}},cs=class extends be{retokenizeCapturedWithRuleId;constructor(e,t,n,r,s){super(e,t,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,r){throw new Error("Not supported!")}},ls=class extends be{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,s){super(e,t,n,null),this._match=new pe(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(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ge,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},qt=class extends be{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,s){super(e,t,n,r),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ge,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},gt=class extends be{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,s,o,i,a,c,l){super(e,t,n,r),this._begin=new pe(s,this.id),this.beginCaptures=o,this._end=new pe(i||"￿",-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(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ge;for(const n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Le=class extends be{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,s,o,i,a,c){super(e,t,n,r),this._begin=new pe(s,this.id),this.beginCaptures=o,this.whileCaptures=a,this._while=new pe(i,Dn),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(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ge;for(const t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new ge,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||"￿"),this._cachedCompiledWhilePatterns}},jn=class N{static createCaptureRule(t,n,r,s,o){return t.registerRule(i=>new cs(n,i,r,s,o))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(s=>{if(t.id=s,t.match)return new ls(t.$vscodeTextmateLocation,t.id,t.name,t.match,N._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=Rn({},r,t.repository));let o=t.patterns;return typeof o>"u"&&t.include&&(o=[{include:t.include}]),new qt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,N._compilePatterns(o,n,r))}return t.while?new Le(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,N._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,N._compileCaptures(t.whileCaptures||t.captures,n,r),N._compilePatterns(t.patterns,n,r)):new gt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,N._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,N._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,N._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let s=[];if(t){let o=0;for(const i in t){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);a>o&&(o=a)}for(let i=0;i<=o;i++)s[i]=null;for(const i in t){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);let c=0;t[i].patterns&&(c=N.getCompiledRuleId(t[i],n,r)),s[a]=N.createCaptureRule(n,t[i].$vscodeTextmateLocation,t[i].name,t[i].contentName,c)}}return s}static _compilePatterns(t,n,r){let s=[];if(t)for(let o=0,i=t.length;o<i;o++){const a=t[o];let c=-1;if(a.include){const l=Fn(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:const h=l.scopeName,f=l.kind===4?l.ruleName:null,d=n.getExternalGrammar(h,r);if(d)if(f){let p=d.repository[f];p&&(c=N.getCompiledRuleId(p,n,d.repository))}else c=N.getCompiledRuleId(d.repository.$self,n,d.repository);break}}else c=N.getCompiledRuleId(a,n,r);if(c!==-1){const l=n.getRule(c);let u=!1;if((l instanceof qt||l instanceof gt||l instanceof Le)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;s.push(c)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},pe=class Un{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(t,n){if(t&&typeof t=="string"){const r=t.length;let s=0,o=[],i=!1;for(let a=0;a<r;a++)if(t.charAt(a)==="\\"&&a+1<r){const l=t.charAt(a+1);l==="z"?(o.push(t.substring(s,a)),o.push("$(?!\\n)(?<!\\n)"),s=a+2):(l==="A"||l==="G")&&(i=!0),a++}this.hasAnchor=i,s===0?this.source=t:(o.push(t.substring(s,r)),this.source=o.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=is.test(this.source):this.hasBackReferences=!1}clone(){return new Un(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,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=>t.substring(s.start,s.end));return Ht.lastIndex=0,this.source.replace(Ht,(s,o)=>Tn(r[parseInt(o,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],s=[],o,i,a,c;for(o=0,i=this.source.length;o<i;o++)a=this.source.charAt(o),t[o]=a,n[o]=a,r[o]=a,s[o]=a,a==="\\"&&o+1<i&&(c=this.source.charAt(o+1),c==="A"?(t[o+1]="￿",n[o+1]="￿",r[o+1]="A",s[o+1]="A"):c==="G"?(t[o+1]="￿",n[o+1]="G",r[o+1]="￿",s[o+1]="G"):(t[o+1]=c,n[o+1]=c,r[o+1]=c,s[o+1]=c),o++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},ge=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new Vt(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(s=>s.resolveAnchors(t,n));return new Vt(e,r,this._items.map(s=>s.ruleId))}},Vt=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
2
2
  `)}findNextMatchSync(e,t,n){const r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},et=class{constructor(e,t){this.languageId=e,this.tokenType=t}},us=class mt{_defaultAttributes;_embeddedLanguagesMatcher;constructor(t,n){this._defaultAttributes=new et(t,8),this._embeddedLanguagesMatcher=new hs(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?mt._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new et(0,0);_getBasicScopeAttributes=new Gn(t=>{const n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new et(n,r)});_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(mt.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/},hs=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,r])=>Tn(n));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},Xt=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Wn(e,t,n,r,s,o,i,a){const c=t.content.length;let l=!1,u=-1;if(i){const d=fs(e,t,n,r,s,o);s=d.stack,r=d.linePos,n=d.isFirstLine,u=d.anchorPosition}const h=Date.now();for(;!l;){if(a!==0&&Date.now()-h>a)return new Xt(s,!0);f()}return new Xt(s,!1);function f(){const d=ds(e,t,n,r,s,u);if(!d){o.produce(s,c),l=!0;return}const p=d.captureIndices,y=d.matchedRuleId,b=p&&p.length>0?p[0].end>r:!1;if(y===as){const g=s.getRule(e);o.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),ue(e,t,n,s,o,g.endCaptures,p),o.produce(s,p[0].end);const m=s;if(s=s.parent,u=m.getAnchorPos(),!b&&m.getEnterPos()===r){s=m,o.produce(s,c),l=!0;return}}else{const g=e.getRule(y);o.produce(s,p[0].start);const m=s,_=g.getName(t.content,p),C=s.contentNameScopesList.pushAttributed(_,e);if(s=s.push(y,r,u,p[0].end===c,null,C,C),g instanceof gt){const S=g;ue(e,t,n,s,o,S.beginCaptures,p),o.produce(s,p[0].end),u=p[0].end;const v=S.getContentName(t.content,p),$=C.pushAttributed(v,e);if(s=s.withContentNameScopesList($),S.endHasBackReferences&&(s=s.withEndRule(S.getEndWithResolvedBackReferences(t.content,p))),!b&&m.hasSameRuleAs(s)){s=s.pop(),o.produce(s,c),l=!0;return}}else if(g instanceof Le){const S=g;ue(e,t,n,s,o,S.beginCaptures,p),o.produce(s,p[0].end),u=p[0].end;const v=S.getContentName(t.content,p),$=C.pushAttributed(v,e);if(s=s.withContentNameScopesList($),S.whileHasBackReferences&&(s=s.withEndRule(S.getWhileWithResolvedBackReferences(t.content,p))),!b&&m.hasSameRuleAs(s)){s=s.pop(),o.produce(s,c),l=!0;return}}else if(ue(e,t,n,s,o,g.captures,p),o.produce(s,p[0].end),s=s.pop(),!b){s=s.safePop(),o.produce(s,c),l=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function fs(e,t,n,r,s,o){let i=s.beginRuleCapturedEOL?0:-1;const a=[];for(let c=s;c;c=c.pop()){const l=c.getRule(e);l instanceof Le&&a.push({rule:l,stack:c})}for(let c=a.pop();c;c=a.pop()){const{ruleScanner:l,findOptions:u}=ms(c.rule,e,c.stack.endRule,n,r===i),h=l.findNextMatchSync(t,r,u);if(h){if(h.ruleId!==Dn){s=c.stack.pop();break}h.captureIndices&&h.captureIndices.length&&(o.produce(c.stack,h.captureIndices[0].start),ue(e,t,n,c.stack,o,c.rule.whileCaptures,h.captureIndices),o.produce(c.stack,h.captureIndices[0].end),i=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:i,isFirstLine:n}}function ds(e,t,n,r,s,o){const i=ps(e,t,n,r,s,o),a=e.getInjections();if(a.length===0)return i;const c=gs(a,e,t,n,r,s,o);if(!c)return i;if(!i)return c;const l=i.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:i}function ps(e,t,n,r,s,o){const i=s.getRule(e),{ruleScanner:a,findOptions:c}=zn(i,e,s.endRule,n,r===o),l=a.findNextMatchSync(t,r,c);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}function gs(e,t,n,r,s,o,i){let a=Number.MAX_VALUE,c=null,l,u=0;const h=o.contentNameScopesList.getScopeNames();for(let f=0,d=e.length;f<d;f++){const p=e[f];if(!p.matcher(h))continue;const y=t.getRule(p.ruleId),{ruleScanner:b,findOptions:g}=zn(y,t,null,r,s===i),m=b.findNextMatchSync(n,s,g);if(!m)continue;const _=m.captureIndices[0].start;if(!(_>=a)&&(a=_,c=m.captureIndices,l=m.ruleId,u=p.priority,a===s))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function zn(e,t,n,r,s){return{ruleScanner:e.compileAG(t,n,r,s),findOptions:0}}function ms(e,t,n,r,s){return{ruleScanner:e.compileWhileAG(t,n,r,s),findOptions:0}}function ue(e,t,n,r,s,o,i){if(o.length===0)return;const a=t.content,c=Math.min(o.length,i.length),l=[],u=i[0].end;for(let h=0;h<c;h++){const f=o[h];if(f===null)continue;const d=i[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){const y=f.getName(a,i),b=r.contentNameScopesList.pushAttributed(y,e),g=f.getContentName(a,i),m=b.pushAttributed(g,e),_=r.push(f.retokenizeCapturedWithRuleId,d.start,-1,!1,null,b,m),C=e.createOnigString(a.substring(0,d.end));Wn(e,C,n&&d.start===0,d.start,_,s,!1,0),Bn(C);continue}const p=f.getName(a,i);if(p!==null){const b=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(p,e);l.push(new ys(b,d.end))}}for(;l.length>0;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var ys=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function bs(e,t,n,r,s,o,i,a){return new ws(e,t,n,r,s,o,i,a)}function Qt(e,t,n,r,s){const o=Re(t,Pe),i=jn.getCompiledRuleId(n,r,s.repository);for(const a of o)e.push({debugSelector:t,matcher:a.matcher,ruleId:i,grammar:s,priority:a.priority})}function Pe(e,t){if(t.length<e.length)return!1;let n=0;return e.every(r=>{for(let s=n;s<t.length;s++)if(_s(t[s],r))return n=s+1,!0;return!1})}function _s(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]==="."}var ws=class{constructor(e,t,n,r,s,o,i,a){if(this._rootScopeName=e,this.balancedBracketSelectors=o,this._onigLib=a,this._basicScopeAttributesProvider=new us(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=Kt(t,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const c of Object.keys(s)){const l=Re(c,Pe);for(const 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(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){const s=r.injections;if(s)for(let i in s)Qt(t,i,s[i],this,r);const o=this._grammarRepository.injections(n);o&&o.forEach(i=>{const a=this.getExternalGrammar(i);if(a){const c=a.injectionSelector;c&&Qt(t,c,a,this,a)}})}return t.sort((s,o)=>s.priority-o.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Kt(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){const r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=jn.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!t||t===yt.NULL){s=!0;const l=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),h=J.set(0,l.languageId,l.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),f=this.getRule(this._rootId).getName(null,null);let d;f?d=he.createRootAndLookUpScopeName(f,h,this):d=he.createRoot("unknown",h),t=new yt(null,this._rootId,-1,-1,!1,null,d,d)}else s=!1,t.reset();e=e+`
3
3
  `;const o=this.createOnigString(e),i=o.content.length,a=new Ss(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Wn(this,o,s,0,t,a,!0,r);return Bn(o),{lineLength:i,lineTokens:a,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Kt(e,t){return e=Fr(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var he=class F{constructor(t,n,r){this.parent=t,this.scopePath=n,this.tokenAttributes=r}static fromExtension(t,n){let r=t,s=t?.scopePath??null;for(const o of n)s=Ye.push(s,o.scopeNames),r=new F(r,s,o.encodedTokenAttributes);return r}static createRoot(t,n){return new F(null,new Ye(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const s=r.getMetadataForScope(t),o=new Ye(null,t),i=r.themeProvider.themeMatch(o),a=F.mergeAttributes(n,s,i);return new F(null,o,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return F.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,r){let s=-1,o=0,i=0;return r!==null&&(s=r.fontStyle,o=r.foregroundId,i=r.backgroundId),J.set(t,n.languageId,n.tokenType,null,s,o,i)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return F._pushAttributed(this,t,n);const r=t.split(/ /g);let s=this;for(const o of r)s=F._pushAttributed(s,o,n);return s}static _pushAttributed(t,n,r){const s=r.getMetadataForScope(n),o=t.scopePath.push(n),i=r.themeProvider.themeMatch(o),a=F.mergeAttributes(t.tokenAttributes,s,i);return new F(t,o,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===t?n.reverse():void 0}},yt=class X{constructor(t,n,r,s,o,i,a,c){this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=o,this.endRule=i,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 X(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:X._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?he.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){X._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,s,o,i,a){return new X(this,t,n,r,s,o,i,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new X(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.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(t,n){const r=he.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new X(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,he.fromExtension(r,n.contentNameScopesList))}},Cs=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):Re(n,Pe).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>Re(n,Pe).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},Ss=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let r=e?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=e?.getScopeNames()??[];for(const i of this._tokenTypeOverrides)i.matcher(o)&&(r=J.set(r,0,i.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(o))}if(s&&(r=J.set(r,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=t;return}const n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,s=this._binaryTokens.length;r<s;r++)n[r]=this._binaryTokens[r];return n}},ks=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,s){if(!this._grammars.has(e)){let o=this._rawGrammars.get(e);if(!o)return null;this._grammars.set(e,bs(e,o,t,n,r,s,this,this._onigLib))}return this._grammars.get(e)}},xs=class{_options;_syncRegistry;_ensureGrammarCache;constructor(t){this._options=t,this._syncRegistry=new ks(Ne.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(Ne.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,r){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(t,n,r){return this._loadGrammar(t,n,r.embeddedLanguages,r.tokenTypes,new Cs(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,r,s,o){const i=new Yr(this._syncRegistry,t);for(;i.Q.length>0;)i.Q.map(a=>this._loadSingleGrammar(a.scopeName)),i.processQueue();return this._grammarForScopeName(t,n,r,s,o)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(t,n=[],r=0,s=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,r,s)}_grammarForScopeName(t,n=0,r=null,s=null,o=null){return this._syncRegistry.grammarForScopeName(t,n,r,s,o)}},bt=yt.NULL;function Te(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},r=typeof e=="string"?e:e.name;for(const[s,o]of Object.entries(t?.colorReplacements||{}))typeof o=="string"?n[s]=o:s===r&&Object.assign(n,o);return n}function q(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Es(e){return Array.isArray(e)?e:[e]}async function Hn(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function De(e){return!e||["plaintext","txt","text","plain"].includes(e)}function As(e){return e==="ansi"||De(e)}function je(e){return e==="none"}function Is(e){return je(e)}const vs=/(\r?\n)/g;function Ue(e,t=!1){if(e.length===0)return[["",0]];const n=e.split(vs);let r=0;const s=[];for(let o=0;o<n.length;o+=2){const i=t?n[o]+(n[o+1]||""):n[o];s.push([i,r]),r+=n[o].length,r+=n[o+1]?.length||0}return s}const Zt={light:"#333333",dark:"#bbbbbb"},Jt={light:"#fffffe",dark:"#1e1e1e"},Yt="__shiki_resolved";function Rt(e){if(e?.[Yt])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){const a=t.settings?t.settings.find(c=>!c.name&&!c.scope):void 0;a?.settings?.foreground&&(r=a.settings.foreground),a?.settings?.background&&(n=a.settings.background),!r&&t?.colors?.["editor.foreground"]&&(r=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),r||(r=t.type==="light"?Zt.light:Zt.dark),n||(n=t.type==="light"?Jt.light:Jt.dark),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let s=0;const o=new Map;function i(a){if(o.has(a))return o.get(a);s+=1;const c=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${c}`]?i(a):(o.set(a,c),c)}t.settings=t.settings.map(a=>{const c=a.settings?.foreground&&!a.settings.foreground.startsWith("#"),l=a.settings?.background&&!a.settings.background.startsWith("#");if(!c&&!l)return a;const u={...a,settings:{...a.settings}};if(c){const h=i(a.settings.foreground);t.colorReplacements[h]=a.settings.foreground,u.settings.foreground=h}if(l){const h=i(a.settings.background);t.colorReplacements[h]=a.settings.background,u.settings.background=h}return u});for(const a of Object.keys(t.colors||{}))if((a==="editor.foreground"||a==="editor.background"||a.startsWith("terminal.ansi"))&&!t.colors[a]?.startsWith("#")){const c=i(t.colors[a]);t.colorReplacements[c]=t.colors[a],t.colors[a]=c}return Object.defineProperty(t,Yt,{enumerable:!1,writable:!1,value:!0}),t}async function qn(e){return[...new Set((await Promise.all(e.filter(t=>!As(t)).map(async t=>await Hn(t).then(n=>Array.isArray(n)?n:[n])))).flat())]}async function Vn(e){return(await Promise.all(e.map(async t=>Is(t)?null:Rt(await Hn(t))))).filter(t=>!!t)}function Xn(e,t){if(!t)return e;if(t[e]){const n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new k(`Circular alias \`${[...n].join(" -> ")} -> ${e}\``);n.add(e)}}return e}var Ns=class extends xs{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(s=>this.loadTheme(s)),this.loadLanguages(this._langs)}getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const t=Rt(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=Ne.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=Xn(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const t=new Set([...this._langMap.values()].filter(s=>s.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const n={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(s=>{this._alias[s]=e.name}),this._loadedLanguagesCache=null,t.size)for(const s of t)this._resolvedGrammars.delete(s.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(s.scopeName),this._syncRegistry?._grammars?.delete(s.scopeName),this.loadLanguage(this._langMap.get(s.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const r of e)this.resolveEmbeddedLanguages(r);const t=[...this._langGraph.entries()],n=t.filter(([r,s])=>!s);if(n.length){const r=t.filter(([s,o])=>o?(o.embeddedLanguages||o.embeddedLangs)?.some(i=>n.map(([a])=>a).includes(i)):!1).filter(s=>!n.includes(s));throw new k(`Missing languages ${n.map(([s])=>`\`${s}\``).join(", ")}, required by ${r.map(([s])=>`\`${s}\``).join(", ")}`)}for(const[r,s]of t)this._resolver.addLanguage(s);for(const[r,s]of t)this.loadLanguage(s)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);const t=e.embeddedLanguages??e.embeddedLangs;if(t)for(const n of t)this._langGraph.set(n,this._langMap.get(n))}},Rs=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:n=>e.createScanner(n),createOnigString:n=>e.createString(n)},t.forEach(n=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){const t=e.split(".");let n=[];for(let r=1;r<=t.length;r++){const s=t.slice(0,r).join(".");n=[...n,...this._injections.get(s)||[]]}return n}};let le=0;function $s(e){le+=1,e.warnings!==!1&&le>=10&&le%10===0&&console.warn(`[Shiki] ${le} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new k("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Rt),s=new Ns(new Rs(e.engine,n),r,n,e.langAlias);let o;function i(m){return Xn(m,e.langAlias)}function a(m){b();const _=s.getGrammar(typeof m=="string"?m:m.name);if(!_)throw new k(`Language \`${m}\` not found, you may need to load it first`);return _}function c(m){if(m==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};b();const _=s.getTheme(m);if(!_)throw new k(`Theme \`${m}\` not found, you may need to load it first`);return _}function l(m){b();const _=c(m);return o!==m&&(s.setTheme(_),o=m),{theme:_,colorMap:s.getColorMap()}}function u(){return b(),s.getLoadedThemes()}function h(){return b(),s.getLoadedLanguages()}function f(...m){b(),s.loadLanguages(m.flat(1))}async function d(...m){return f(await qn(m))}function p(...m){b();for(const _ of m.flat(1))s.loadTheme(_)}async function y(...m){return b(),p(await Vn(m))}function b(){if(t)throw new k("Shiki instance has been disposed")}function g(){t||(t=!0,s.dispose(),le-=1)}return{setTheme:l,getTheme:c,getLanguage:a,getLoadedThemes:u,getLoadedLanguages:h,resolveLangAlias:i,loadLanguage:d,loadLanguageSync:f,loadTheme:y,loadThemeSync:p,dispose:g,[Symbol.dispose]:g}}async function Ls(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,r]=await Promise.all([Vn(e.themes||[]),qn(e.langs||[]),e.engine]);return $s({...e,themes:t,langs:n,engine:r})}const Qn=new WeakMap;function We(e,t){Qn.set(e,t)}function me(e){return Qn.get(e)}var ze=class Kn{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new Kn(Object.fromEntries(Es(n).map(r=>[r,bt])),t)}constructor(...t){if(t.length===2){const[n,r]=t;this.lang=r,this._stacks=n}else{const[n,r,s]=t;this.lang=r,this._stacks={[s]:n}}}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return Ps(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Ps(e){const t=[],n=new Set;function r(s){if(n.has(s))return;n.add(s);const o=s?.nameScopesList?.scopeName;o&&t.push(o),s.parent&&r(s.parent)}return r(e),t}function Ts(e,t){if(!(e instanceof ze))throw new k("Invalid grammar state");return e.getInternalStack(t)}const Gs=/,/,Ms=/ /;function Zn(e,t,n={}){const{theme:r=e.getLoadedThemes()[0]}=n;if(De(e.resolveLangAlias(n.lang||"text"))||je(r))return Ue(t).map(a=>[{content:a[0],offset:a[1]}]);const{theme:s,colorMap:o}=e.setTheme(r),i=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==i.name)throw new k(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${i.name}"`);if(!n.grammarState.themes.includes(s.name))throw new k(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${s.name}"`)}return Bs(t,i,s,o,n)}function Os(...e){if(e.length===2)return me(e[1]);const[t,n,r={}]=e,{lang:s="text",theme:o=t.getLoadedThemes()[0]}=r;if(De(s)||je(o))throw new k("Plain language does not have grammar state");if(s==="ansi")throw new k("ANSI language does not have grammar state");const{theme:i,colorMap:a}=t.setTheme(o),c=t.getLanguage(s);return new ze($t(n,c,i,a,r).stateStack,c.name,i.name)}function Bs(e,t,n,r,s){const o=$t(e,t,n,r,s),i=new ze(o.stateStack,t.name,n.name);return We(o.tokens,i),o.tokens}function $t(e,t,n,r,s){const o=Te(n,s),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:a=500,includeExplanation:c=!1}=s,l=Ue(e);let u=s.grammarState?Ts(s.grammarState,n.name)??bt:s.grammarContextCode!=null?$t(s.grammarContextCode,t,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:bt,h=[];const f=[];for(let d=0,p=l.length;d<p;d++){const[y,b]=l[d];if(y===""){h=[],f.push([]);continue}if(i>0&&y.length>=i){h=[],f.push([{content:y,offset:b,color:"",fontStyle:0}]);continue}let g,m,_;c&&c!=="tokenType"&&(g=t.tokenizeLine(y,u,a),m=g.tokens,_=0);const C=t.tokenizeLine2(y,u,a),S=C.tokens.length/2;for(let v=0;v<S;v++){const $=C.tokens[2*v],O=v+1<S?C.tokens[2*v+2]:y.length;if($===O)continue;const ee=C.tokens[2*v+1],Qe=q(r[J.getForeground(ee)],o),Ke=J.getFontStyle(ee),B={content:y.substring($,O),offset:b+$,color:Qe,fontStyle:Ke};if(c==="tokenType")B.type=J.getTokenType(ee);else if(c){const Bt=[];if(c!=="scopeName")for(const D of n.settings){let te;switch(typeof D.scope){case"string":te=D.scope.split(Gs).map(Ze=>Ze.trim());break;case"object":te=D.scope;break;default:continue}Bt.push({settings:D,selectors:te.map(Ze=>Ze.split(Ms))})}B.explanation=[];let Ft=0;for(;$+Ft<O;){const D=m[_],te=y.substring(D.startIndex,D.endIndex);Ft+=te.length,B.explanation.push({content:te,scopes:c==="scopeName"?Fs(D.scopes):Ds(Bt,D.scopes)}),_+=1}}h.push(B)}f.push(h),h=[],u=C.ruleStack}return{tokens:f,stateStack:u}}function Fs(e){return e.map(t=>({scopeName:t}))}function Ds(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const o=t[r];n[r]={scopeName:o,themeMatches:Us(e,o,t.slice(0,r))}}return n}function en(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function js(e,t,n){if(!en(e.at(-1),t))return!1;let r=e.length-2,s=n.length-1;for(;r>=0&&s>=0;)en(e[r],n[s])&&(r-=1),s-=1;return r===-1}function Us(e,t,n){const r=[];for(const{selectors:s,settings:o}of e)for(const i of s)if(js(i,t,n)){r.push(o);break}return r}function Jn(e,t,n,r=Zn){const s=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),o=s.map(l=>{const u=r(e,t,{...n,theme:l.theme});return{tokens:u,state:me(u),theme:typeof l.theme=="string"?l.theme:l.theme.name}}),i=Ws(...o.map(l=>l.tokens)),a=i[0].map((l,u)=>l.map((h,f)=>{const d={content:h.content,variants:{},offset:h.offset};return"includeExplanation"in n&&n.includeExplanation&&(d.explanation=h.explanation),i.forEach((p,y)=>{const{content:b,explanation:g,offset:m,..._}=p[u][f];d.variants[s[y].color]=_}),d})),c=o[0].state?new ze(Object.fromEntries(o.map(l=>[l.theme,l.state?.getInternalStack(l.theme)])),o[0].state.lang):void 0;return c&&We(a,c),a}function Ws(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){const s=e.map(c=>c[r]),o=t.map(()=>[]);t.forEach((c,l)=>c.push(o[l]));const i=s.map(()=>0),a=s.map(c=>c[0]);for(;a.every(c=>c);){const c=Math.min(...a.map(l=>l.content.length));for(let l=0;l<n;l++){const u=a[l];u.content.length===c?(o[l].push(u),i[l]+=1,a[l]=s[l][i[l]]):(o[l].push({...u,content:u.content.slice(0,c)}),a[l]={...u,content:u.content.slice(c),offset:u.offset+c})}}}return t}const zs=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],Hs=/["&'<>`]/g,qs=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Vs=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Xs=/[|\\{}()[\]^$+*?.]/g,tn=new WeakMap;function Qs(e,t){if(e=e.replace(t.subset?Ks(t.subset):Hs,r),t.subset||t.escapeOnly)return e;return e.replace(qs,n).replace(Vs,r);function n(s,o,i){return t.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,i.charCodeAt(o+2),t)}function r(s,o,i){return t.format(s.charCodeAt(0),i.charCodeAt(o+1),t)}}function Ks(e){let t=tn.get(e);return t||(t=Zs(e),tn.set(e,t)),t}function Zs(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(Xs,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const Js=/[\dA-Fa-f]/;function Ys(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!Js.test(String.fromCharCode(t))?r:r+";"}const eo=/\d/;function to(e,t,n){const r="&#"+String(e);return n&&t&&!eo.test(String.fromCharCode(t))?r:r+";"}const no=["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"],tt={nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"­",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",fnof:"ƒ",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",bull:"•",hellip:"…",prime:"′",Prime:"″",oline:"‾",frasl:"⁄",weierp:"℘",image:"ℑ",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪",int:"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦",quot:'"',amp:"&",lt:"<",gt:">",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",circ:"ˆ",tilde:"˜",ensp:" ",emsp:" ",thinsp:" ",zwnj:"‌",zwj:"‍",lrm:"‎",rlm:"‏",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",permil:"‰",lsaquo:"‹",rsaquo:"›",euro:"€"},ro=["cent","copy","divide","gt","lt","not","para","times"],Yn={}.hasOwnProperty,_t={};let Ce;for(Ce in tt)Yn.call(tt,Ce)&&(_t[tt[Ce]]=Ce);const so=/[^\dA-Za-z]/;function oo(e,t,n,r){const s=String.fromCharCode(e);if(Yn.call(_t,s)){const o=_t[s],i="&"+o;return n&&no.includes(o)&&!ro.includes(o)&&(!r||t&&t!==61&&so.test(String.fromCharCode(t)))?i:i+";"}return""}function io(e,t,n){let r=Ys(e,t,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=oo(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const o=to(e,t,n.omitOptionalSemicolons);o.length<r.length&&(r=o)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function ie(e,t){return Qs(e,Object.assign({format:io},t))}const ao=/^>|^->|<!--|-->|--!>|<!-$/g,co=[">"],lo=["<",">"];function uo(e,t,n,r){return r.settings.bogusComments?"<?"+ie(e.value,Object.assign({},r.settings.characterReferences,{subset:co}))+">":"<!--"+e.value.replace(ao,s)+"-->";function s(o){return ie(o,Object.assign({},r.settings.characterReferences,{subset:lo}))}}function ho(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const A=tr(1),er=tr(-1),fo=[];function tr(e){return t;function t(n,r,s){const o=n?n.children:fo;let i=(r||0)+e,a=o[i];if(!s)for(;a&&vt(a);)i+=e,a=o[i];return a}}const po={}.hasOwnProperty;function nr(e){return t;function t(n,r,s){return po.call(e,n.tagName)&&e[n.tagName](n,r,s)}}const Lt=nr({body:mo,caption:nt,colgroup:nt,dd:wo,dt:_o,head:nt,html:go,li:bo,optgroup:Co,option:So,p:yo,rp:nn,rt:nn,tbody:xo,td:rn,tfoot:Eo,th:rn,thead:ko,tr:Ao});function nt(e,t,n){const r=A(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&vt(r.value.charAt(0)))}function go(e,t,n){const r=A(n,t);return!r||r.type!=="comment"}function mo(e,t,n){const r=A(n,t);return!r||r.type!=="comment"}function yo(e,t,n){const r=A(n,t);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 bo(e,t,n){const r=A(n,t);return!r||r.type==="element"&&r.tagName==="li"}function _o(e,t,n){const r=A(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function wo(e,t,n){const r=A(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function nn(e,t,n){const r=A(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Co(e,t,n){const r=A(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function So(e,t,n){const r=A(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function ko(e,t,n){const r=A(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function xo(e,t,n){const r=A(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Eo(e,t,n){return!A(n,t)}function Ao(e,t,n){const r=A(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function rn(e,t,n){const r=A(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const Io=nr({body:Ro,colgroup:$o,head:No,html:vo,tbody:Lo});function vo(e){const t=A(e,-1);return!t||t.type!=="comment"}function No(e){const t=new Set;for(const r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||n.type==="element"}function Ro(e){const t=A(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&vt(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function $o(e,t,n){const r=er(n,t),s=A(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&Lt(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function Lo(e,t,n){const r=er(n,t),s=A(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&Lt(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const Se={name:[[`
4
4
  \f\r &/=>`.split(""),`