@telperion/elements 6.1.0 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.build-manifest.json +22 -1
- package/README.md +40 -5
- package/_chunks/code-cdn-element-ClAO2lep.d.cts +200 -0
- package/_chunks/code-cdn-element-ClAO2lep.d.ts +200 -0
- package/code/bundled-language-loader.cjs +18 -0
- package/code/bundled-language-loader.cjs.map +1 -0
- package/code/bundled-language-loader.js +16 -0
- package/code/bundled-language-loader.js.map +1 -0
- package/code/cdn-language-loader.cjs +41 -0
- package/code/cdn-language-loader.cjs.map +1 -0
- package/code/cdn-language-loader.js +36 -0
- package/code/cdn-language-loader.js.map +1 -0
- package/code/cdn.cjs +21 -0
- package/code/cdn.cjs.map +1 -0
- package/code/cdn.d.cts +3 -0
- package/code/cdn.d.ts +3 -0
- package/code/cdn.js +16 -0
- package/code/cdn.js.map +1 -0
- package/code/code-element-base.cjs +241 -0
- package/code/code-element-base.cjs.map +1 -0
- package/code/code-element-base.js +239 -0
- package/code/code-element-base.js.map +1 -0
- package/code/code-element.cjs +16 -0
- package/code/code-element.cjs.map +1 -0
- package/code/code-element.js +14 -0
- package/code/code-element.js.map +1 -0
- package/code/copy.cjs +41 -0
- package/code/copy.cjs.map +1 -0
- package/code/copy.js +39 -0
- package/code/copy.js.map +1 -0
- package/code/css-variables-theme.cjs +24 -0
- package/code/css-variables-theme.cjs.map +1 -0
- package/code/css-variables-theme.js +21 -0
- package/code/css-variables-theme.js.map +1 -0
- package/code/highlighter.cjs +84 -0
- package/code/highlighter.cjs.map +1 -0
- package/code/highlighter.js +80 -0
- package/code/highlighter.js.map +1 -0
- package/code/index.cjs +19 -0
- package/code/index.cjs.map +1 -0
- package/code/index.d.cts +13 -0
- package/code/index.d.ts +13 -0
- package/code/index.js +6 -0
- package/code/index.js.map +1 -0
- package/code/language-loader.cjs +22 -0
- package/code/language-loader.cjs.map +1 -0
- package/code/language-loader.js +19 -0
- package/code/language-loader.js.map +1 -0
- package/code/line-ranges.cjs +28 -0
- package/code/line-ranges.cjs.map +1 -0
- package/code/line-ranges.js +25 -0
- package/code/line-ranges.js.map +1 -0
- package/code/source.cjs +52 -0
- package/code/source.cjs.map +1 -0
- package/code/source.js +48 -0
- package/code/source.js.map +1 -0
- package/code/styles.cjs +183 -0
- package/code/styles.cjs.map +1 -0
- package/code/styles.js +181 -0
- package/code/styles.js.map +1 -0
- package/code/templates.cjs +66 -0
- package/code/templates.cjs.map +1 -0
- package/code/templates.js +63 -0
- package/code/templates.js.map +1 -0
- package/custom-elements.json +3993 -2377
- package/fesm/elements.mjs +501 -216
- package/fesm/elements.mjs.map +1 -1
- package/iife/code/cdn.js +263 -0
- package/iife/code/cdn.js.map +1 -0
- package/iife/elements.js +36 -36
- package/iife/elements.js.map +1 -1
- package/iife/router/index.js +23 -23
- package/iife/router/index.js.map +1 -1
- package/index.cjs +23 -18
- package/index.cjs.map +1 -1
- package/index.d.cts +1 -1
- package/index.d.ts +1 -1
- package/index.js +8 -6
- package/index.js.map +1 -1
- package/package.json +39 -2
- package/router/history-managed.cjs +1 -1
- package/router/history-managed.cjs.map +1 -1
- package/router/history-managed.js +1 -1
- package/router/history-managed.js.map +1 -1
- package/router/index.cjs +23 -18
- package/router/index.cjs.map +1 -1
- package/router/index.d.cts +273 -168
- package/router/index.d.ts +273 -168
- package/router/index.js +8 -6
- package/router/index.js.map +1 -1
- package/router/route-element.cjs +244 -0
- package/router/route-element.cjs.map +1 -0
- package/router/route-element.js +239 -0
- package/router/route-element.js.map +1 -0
- package/router/route-events.cjs +14 -0
- package/router/route-events.cjs.map +1 -0
- package/router/route-events.js +10 -0
- package/router/route-events.js.map +1 -0
- package/router/route-source.cjs +134 -0
- package/router/route-source.cjs.map +1 -0
- package/router/route-source.js +129 -0
- package/router/route-source.js.map +1 -0
- package/router/route-templates.cjs +18 -0
- package/router/route-templates.cjs.map +1 -0
- package/router/route-templates.js +16 -0
- package/router/route-templates.js.map +1 -0
- package/router/{tha-router-config.cjs → router-config-element.cjs} +51 -51
- package/router/router-config-element.cjs.map +1 -0
- package/router/{tha-router-config.js → router-config-element.js} +52 -52
- package/router/router-config-element.js.map +1 -0
- package/router/{tha-router.cjs → router-element.cjs} +47 -33
- package/router/router-element.cjs.map +1 -0
- package/router/{tha-router.js → router-element.js} +47 -33
- package/router/router-element.js.map +1 -0
- package/router/{tha-router-link.cjs → router-link-element.cjs} +15 -15
- package/router/router-link-element.cjs.map +1 -0
- package/router/{tha-router-link.js → router-link-element.js} +16 -16
- package/router/router-link-element.js.map +1 -0
- package/router/{tha-router-outlet.cjs → router-outlet-element.cjs} +44 -31
- package/router/router-outlet-element.cjs.map +1 -0
- package/router/{tha-router-outlet.js → router-outlet-element.js} +43 -30
- package/router/router-outlet-element.js.map +1 -0
- package/router/{tha-router-param.cjs → router-param-element.cjs} +62 -62
- package/router/router-param-element.cjs.map +1 -0
- package/router/{tha-router-param.js → router-param-element.js} +62 -62
- package/router/router-param-element.js.map +1 -0
- package/router/tha-route.cjs +0 -128
- package/router/tha-route.cjs.map +0 -1
- package/router/tha-route.js +0 -125
- package/router/tha-route.js.map +0 -1
- package/router/tha-router-config.cjs.map +0 -1
- package/router/tha-router-config.js.map +0 -1
- package/router/tha-router-link.cjs.map +0 -1
- package/router/tha-router-link.js.map +0 -1
- package/router/tha-router-outlet.cjs.map +0 -1
- package/router/tha-router-outlet.js.map +0 -1
- package/router/tha-router-param.cjs.map +0 -1
- package/router/tha-router-param.js.map +0 -1
- package/router/tha-router.cjs.map +0 -1
- package/router/tha-router.js.map +0 -1
package/iife/code/cdn.js
ADDED
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
this.TelperionElements=this.TelperionElements||{},function(e){"use strict";const t="4.6.0",n=`https://cdn.jsdelivr.net/npm/@shikijs/langs@${t}/dist/`,r=/^[a-z0-9][a-z0-9-]*$/;let o=n;function s(e){return`${o}${e}.mjs`}function i(e,t,n,r){var o,s=arguments.length,i=s<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)i=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(s<3?o(i):s>3?o(t,n,i):o(t,n))||i);return s>3&&i&&Object.defineProperty(t,n,i),i}function a(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}"function"==typeof SuppressedError&&SuppressedError;
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright 2019 Google LLC
|
|
5
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
const l=globalThis,c=l.ShadowRoot&&(void 0===l.ShadyCSS||l.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,u=Symbol(),h=new WeakMap;let p=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==u)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(c&&void 0===e){const n=void 0!==t&&1===t.length;n&&(e=h.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&h.set(t,e))}return e}toString(){return this.cssText}};const d=(e,...t)=>{const n=1===e.length?e[0]:t.reduce((t,n,r)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+e[r+1],e[0]);return new p(n,e,u)},g=c?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const n of e.cssRules)t+=n.cssText;return(e=>new p("string"==typeof e?e:e+"",void 0,u))(t)})(e):e,{is:f,defineProperty:m,getOwnPropertyDescriptor:y,getOwnPropertyNames:b,getOwnPropertySymbols:_,getPrototypeOf:w}=Object,k=globalThis,v=k.trustedTypes,C=v?v.emptyScript:"",S=k.reactiveElementPolyfillSupport,x=(e,t)=>e,A={toAttribute(e,t){switch(t){case Boolean:e=e?C:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let n=e;switch(t){case Boolean:n=null!==e;break;case Number:n=null===e?null:Number(e);break;case Object:case Array:try{n=JSON.parse(e)}catch(e){n=null}}return n}},$=(e,t)=>!f(e,t),E={attribute:!0,type:String,converter:A,reflect:!1,useDefault:!1,hasChanged:$};
|
|
8
|
+
/**
|
|
9
|
+
* @license
|
|
10
|
+
* Copyright 2017 Google LLC
|
|
11
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
12
|
+
*/Symbol.metadata??=Symbol("metadata"),k.litPropertyMetadata??=new WeakMap;let N=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=E){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const n=Symbol(),r=this.getPropertyDescriptor(e,n,t);void 0!==r&&m(this.prototype,e,r)}}static getPropertyDescriptor(e,t,n){const{get:r,set:o}=y(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:r,set(t){const s=r?.call(this);o?.call(this,t),this.requestUpdate(e,s,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??E}static _$Ei(){if(this.hasOwnProperty(x("elementProperties")))return;const e=w(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(x("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(x("properties"))){const e=this.properties,t=[...b(e),..._(e)];for(const n of t)this.createProperty(n,e[n])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,n]of t)this.elementProperties.set(e,n)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const n=this._$Eu(e,t);void 0!==n&&this._$Eh.set(n,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const n=new Set(e.flat(1/0).reverse());for(const e of n)t.unshift(g(e))}else void 0!==e&&t.push(g(e));return t}static _$Eu(e,t){const n=t.attribute;return!1===n?void 0:"string"==typeof n?n:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const n of t.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,t)=>{if(c)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const n of t){const t=document.createElement("style"),r=l.litNonce;void 0!==r&&t.setAttribute("nonce",r),t.textContent=n.cssText,e.appendChild(t)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$ET(e,t){const n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(void 0!==r&&!0===n.reflect){const o=(void 0!==n.converter?.toAttribute?n.converter:A).toAttribute(t,n.type);this._$Em=e,null==o?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,t){const n=this.constructor,r=n._$Eh.get(e);if(void 0!==r&&this._$Em!==r){const e=n.getPropertyOptions(r),o="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:A;this._$Em=r;const s=o.fromAttribute(t,e.type);this[r]=s??this._$Ej?.get(r)??s,this._$Em=null}}requestUpdate(e,t,n){if(void 0!==e){const r=this.constructor,o=this[e];if(n??=r.getPropertyOptions(e),!((n.hasChanged??$)(o,t)||n.useDefault&&n.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,n))))return;this.C(e,t,n)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:n,reflect:r,wrapped:o},s){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??t??this[e]),!0!==o||void 0!==s)||(this._$AL.has(e)||(this.hasUpdated||n||(t=void 0),this._$AL.set(e,t)),!0===r&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,n]of e){const{wrapped:e}=n,r=this[t];!0!==e||this._$AL.has(t)||void 0===r||this.C(t,void 0,n,r)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};N.elementStyles=[],N.shadowRootOptions={mode:"open"},N[x("elementProperties")]=new Map,N[x("finalized")]=new Map,S?.({ReactiveElement:N}),(k.reactiveElementVersions??=[]).push("2.1.1");
|
|
13
|
+
/**
|
|
14
|
+
* @license
|
|
15
|
+
* Copyright 2017 Google LLC
|
|
16
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
17
|
+
*/
|
|
18
|
+
const I=globalThis,P=I.trustedTypes,R=P?P.createPolicy("lit-html",{createHTML:e=>e}):void 0,L="$lit$",M=`lit$${Math.random().toFixed(9).slice(2)}$`,T="?"+M,O=`<${T}>`,B=document,D=()=>B.createComment(""),G=e=>null===e||"object"!=typeof e&&"function"!=typeof e,U=Array.isArray,F="[ \t\n\f\r]",j=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,W=/-->/g,z=/>/g,H=RegExp(`>|${F}(?:([^\\s"'>=/]+)(${F}*=${F}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),q=/'/g,V=/"/g,X=/^(?:script|style|textarea|title)$/i,K=e=>(t,...n)=>({_$litType$:e,strings:t,values:n}),Z=K(1),Q=K(2),Y=Symbol.for("lit-noChange"),J=Symbol.for("lit-nothing"),ee=new WeakMap,te=B.createTreeWalker(B,129);function ne(e,t){if(!U(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==R?R.createHTML(t):t}class re{constructor({strings:e,_$litType$:t},n){let r;this.parts=[];let o=0,s=0;const i=e.length-1,a=this.parts,[l,c]=((e,t)=>{const n=e.length-1,r=[];let o,s=2===t?"<svg>":3===t?"<math>":"",i=j;for(let t=0;t<n;t++){const n=e[t];let a,l,c=-1,u=0;for(;u<n.length&&(i.lastIndex=u,l=i.exec(n),null!==l);)u=i.lastIndex,i===j?"!--"===l[1]?i=W:void 0!==l[1]?i=z:void 0!==l[2]?(X.test(l[2])&&(o=RegExp("</"+l[2],"g")),i=H):void 0!==l[3]&&(i=H):i===H?">"===l[0]?(i=o??j,c=-1):void 0===l[1]?c=-2:(c=i.lastIndex-l[2].length,a=l[1],i=void 0===l[3]?H:'"'===l[3]?V:q):i===V||i===q?i=H:i===W||i===z?i=j:(i=H,o=void 0);const h=i===H&&e[t+1].startsWith("/>")?" ":"";s+=i===j?n+O:c>=0?(r.push(a),n.slice(0,c)+L+n.slice(c)+M+h):n+M+(-2===c?t:h)}return[ne(e,s+(e[n]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),r]})(e,t);if(this.el=re.createElement(l,n),te.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(r=te.nextNode())&&a.length<i;){if(1===r.nodeType){if(r.hasAttributes())for(const e of r.getAttributeNames())if(e.endsWith(L)){const t=c[s++],n=r.getAttribute(e).split(M),i=/([.?@])?(.*)/.exec(t);a.push({type:1,index:o,name:i[2],strings:n,ctor:"."===i[1]?le:"?"===i[1]?ce:"@"===i[1]?ue:ae}),r.removeAttribute(e)}else e.startsWith(M)&&(a.push({type:6,index:o}),r.removeAttribute(e));if(X.test(r.tagName)){const e=r.textContent.split(M),t=e.length-1;if(t>0){r.textContent=P?P.emptyScript:"";for(let n=0;n<t;n++)r.append(e[n],D()),te.nextNode(),a.push({type:2,index:++o});r.append(e[t],D())}}}else if(8===r.nodeType)if(r.data===T)a.push({type:2,index:o});else{let e=-1;for(;-1!==(e=r.data.indexOf(M,e+1));)a.push({type:7,index:o}),e+=M.length-1}o++}}static createElement(e,t){const n=B.createElement("template");return n.innerHTML=e,n}}function oe(e,t,n=e,r){if(t===Y)return t;let o=void 0!==r?n._$Co?.[r]:n._$Cl;const s=G(t)?void 0:t._$litDirective$;return o?.constructor!==s&&(o?._$AO?.(!1),void 0===s?o=void 0:(o=new s(e),o._$AT(e,n,r)),void 0!==r?(n._$Co??=[])[r]=o:n._$Cl=o),void 0!==o&&(t=oe(e,o._$AS(e,t.values),o,r)),t}let se=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:n}=this._$AD,r=(e?.creationScope??B).importNode(t,!0);te.currentNode=r;let o=te.nextNode(),s=0,i=0,a=n[0];for(;void 0!==a;){if(s===a.index){let t;2===a.type?t=new ie(o,o.nextSibling,this,e):1===a.type?t=new a.ctor(o,a.name,a.strings,this,e):6===a.type&&(t=new he(o,this,e)),this._$AV.push(t),a=n[++i]}s!==a?.index&&(o=te.nextNode(),s++)}return te.currentNode=B,r}p(e){let t=0;for(const n of this._$AV)void 0!==n&&(void 0!==n.strings?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},ie=class e{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,n,r){this.type=2,this._$AH=J,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=oe(this,e,t),G(e)?e===J||null==e||""===e?(this._$AH!==J&&this._$AR(),this._$AH=J):e!==this._$AH&&e!==Y&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>U(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==J&&G(this._$AH)?this._$AA.nextSibling.data=e:this.T(B.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:n}=e,r="number"==typeof n?this._$AC(e):(void 0===n.el&&(n.el=re.createElement(ne(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(t);else{const e=new se(r,this),n=e.u(this.options);e.p(t),this.T(n),this._$AH=e}}_$AC(e){let t=ee.get(e.strings);return void 0===t&&ee.set(e.strings,t=new re(e)),t}k(t){U(this._$AH)||(this._$AH=[],this._$AR());const n=this._$AH;let r,o=0;for(const s of t)o===n.length?n.push(r=new e(this.O(D()),this.O(D()),this,this.options)):r=n[o],r._$AI(s),o++;o<n.length&&(this._$AR(r&&r._$AB.nextSibling,o),n.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}},ae=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,n,r,o){this.type=1,this._$AH=J,this._$AN=void 0,this.element=e,this.name=t,this._$AM=r,this.options=o,n.length>2||""!==n[0]||""!==n[1]?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=J}_$AI(e,t=this,n,r){const o=this.strings;let s=!1;if(void 0===o)e=oe(this,e,t,0),s=!G(e)||e!==this._$AH&&e!==Y,s&&(this._$AH=e);else{const r=e;let i,a;for(e=o[0],i=0;i<o.length-1;i++)a=oe(this,r[n+i],t,i),a===Y&&(a=this._$AH[i]),s||=!G(a)||a!==this._$AH[i],a===J?e=J:e!==J&&(e+=(a??"")+o[i+1]),this._$AH[i]=a}s&&!r&&this.j(e)}j(e){e===J?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},le=class extends ae{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===J?void 0:e}},ce=class extends ae{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==J)}},ue=class extends ae{constructor(e,t,n,r,o){super(e,t,n,r,o),this.type=5}_$AI(e,t=this){if((e=oe(this,e,t,0)??J)===Y)return;const n=this._$AH,r=e===J&&n!==J||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==J&&(n===J||r);r&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},he=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){oe(this,e)}};const pe=I.litHtmlPolyfillSupport;pe?.(re,ie),(I.litHtmlVersions??=[]).push("3.3.1");const de=globalThis;
|
|
19
|
+
/**
|
|
20
|
+
* @license
|
|
21
|
+
* Copyright 2017 Google LLC
|
|
22
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
+
*/let ge=class extends N{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,n)=>{const r=n?.renderBefore??t;let o=r._$litPart$;if(void 0===o){const e=n?.renderBefore??null;r._$litPart$=o=new ie(t.insertBefore(D(),e),e,void 0,n??{})}return o._$AI(e),o})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return Y}};ge._$litElement$=!0,ge.finalized=!0,de.litElementHydrateSupport?.({LitElement:ge});const fe=de.litElementPolyfillSupport;fe?.({LitElement:ge}),(de.litElementVersions??=[]).push("4.2.1");
|
|
24
|
+
/**
|
|
25
|
+
* @license
|
|
26
|
+
* Copyright 2017 Google LLC
|
|
27
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
28
|
+
*/
|
|
29
|
+
const me={attribute:!0,type:String,converter:A,reflect:!1,hasChanged:$},ye=(e=me,t,n)=>{const{kind:r,metadata:o}=n;let s=globalThis.litPropertyMetadata.get(o);if(void 0===s&&globalThis.litPropertyMetadata.set(o,s=new Map),"setter"===r&&((e=Object.create(e)).wrapped=!0),s.set(n.name,e),"accessor"===r){const{name:r}=n;return{set(n){const o=t.get.call(this);t.set.call(this,n),this.requestUpdate(r,o,e)},init(t){return void 0!==t&&this.C(r,void 0,e,t),t}}}if("setter"===r){const{name:r}=n;return function(n){const o=this[r];t.call(this,n),this.requestUpdate(r,o,e)}}throw Error("Unsupported decorator location: "+r)};function be(e){return(t,n)=>"object"==typeof n?ye(e,t,n):((e,t,n)=>{const r=t.hasOwnProperty(n);return t.constructor.createProperty(n,e),r?Object.getOwnPropertyDescriptor(t,n):void 0})(e,t,n)}
|
|
30
|
+
/**
|
|
31
|
+
* @license
|
|
32
|
+
* Copyright 2017 Google LLC
|
|
33
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
34
|
+
*/function _e(e){return be({...e,state:!0,attribute:!1})}async function we(e){try{if(navigator.clipboard?.writeText)return await navigator.clipboard.writeText(e),!0}catch{}return function(e){const t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.append(t);try{return t.select(),document.execCommand?.("copy")??!1}catch{return!1}finally{t.remove()}}(e)}var ke=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function ve(e){return Array.isArray(e)?function(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=ve(e[n]);return t}(e):e instanceof RegExp?e:"object"==typeof e?function(e){let t={};for(let n in e)t[n]=ve(e[n]);return t}(e):e}function Ce(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function Se(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return 0===t?e:~t===e.length-1?Se(e.substring(0,e.length-1)):e.substr(1+~t)}var xe=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Ae=class{static hasCaptures(e){return null!==e&&(xe.lastIndex=0,xe.test(e))}static replaceCaptures(e,t,n){return e.replace(xe,(e,r,o,s)=>{let i=n[parseInt(r||o,10)];if(!i)return e;{let e=t.substring(i.start,i.end);for(;"."===e[0];)e=e.substring(1);switch(s){case"downcase":return e.toLowerCase();case"upcase":return e.toUpperCase();default:return e}}})}};function $e(e,t){return e<t?-1:e>t?1:0}function Ee(e,t){if(null===e&&null===t)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=$e(e[r],t[r]);if(0!==n)return n}return 0}return n-r}function Ne(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 Ie(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Pe=class{constructor(e){this.fn=e}fn;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}},Re=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}_colorMap;_defaults;_root;static createFromRawTheme(e,t){return this.createFromParsedTheme(function(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,o=t.length;e<o;e++){let o,s=t[e];if(!s.settings)continue;if("string"==typeof s.scope){let e=s.scope;e=e.replace(/^[,]+/,""),e=e.replace(/[,]+$/,""),o=e.split(",")}else o=Array.isArray(s.scope)?s.scope:[""];let i=-1;if("string"==typeof s.settings.fontStyle){i=0;let e=s.settings.fontStyle.split(" ");for(let t=0,n=e.length;t<n;t++){switch(e[t]){case"italic":i|=1;break;case"bold":i|=2;break;case"underline":i|=4;break;case"strikethrough":i|=8}}}let a=null;"string"==typeof s.settings.foreground&&Ne(s.settings.foreground)&&(a=s.settings.foreground);let l=null;"string"==typeof s.settings.background&&Ne(s.settings.background)&&(l=s.settings.background);for(let t=0,s=o.length;t<s;t++){let s=o[t].trim().split(" "),c=s[s.length-1],u=null;s.length>1&&(u=s.slice(0,s.length-1),u.reverse()),n[r++]=new Oe(c,u,e,i,a,l)}}return n}(e),t)}static createFromParsedTheme(e,t){return function(e,t){e.sort((e,t)=>{let n=$e(e.scope,t.scope);return 0!==n?n:(n=Ee(e.parentScopes,t.parentScopes),0!==n?n:e.index-t.index)});let n=0,r="#000000",o="#ffffff";for(;e.length>=1&&""===e[0].scope;){let t=e.shift();-1!==t.fontStyle&&(n=t.fontStyle),null!==t.foreground&&(r=t.foreground),null!==t.background&&(o=t.background)}let s=new De(t),i=new Te(n,s.getId(r),s.getId(o)),a=new Fe(new Ue(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];a.insert(0,n.scope,n.parentScopes,n.fontStyle,s.getId(n.foreground),s.getId(n.background))}return new Re(s,i,a)}(e,t)}_cachedMatchRoot=new Pe(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(null===e)return this._defaults;const t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>function(e,t){if(0===t.length)return!0;for(let n=0;n<t.length;n++){let r=t[n],o=!1;if(">"===r){if(n===t.length-1)return!1;r=t[++n],o=!0}for(;e&&!Me(e.scopeName,r);){if(o)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}(e.parent,t.parentScopes));return n?new Te(n.fontStyle,n.foreground,n.background):null}},Le=class e{constructor(e,t){this.parent=e,this.scopeName=t}parent;scopeName;static push(t,n){for(const r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this;const t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(" ")}extends(e){return this===e||null!==this.parent&&this.parent.extends(e)}getExtensionIfDefined(e){const t=[];let n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function Me(e,t){return t===e||e.startsWith(t)&&"."===e[t.length]}var Te=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}fontStyle;foregroundId;backgroundId};var Oe=class{constructor(e,t,n,r,o,s){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=o,this.background=s}scope;parentScopes;index;fontStyle;foreground;background},Be=(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))(Be||{});var De=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(null===e)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)}},Ge=Object.freeze([]),Ue=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,o){this.scopeDepth=e,this.parentScopes=t||Ge,this.fontStyle=n,this.foreground=r,this.background=o}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,-1!==t&&(this.fontStyle=t),0!==n&&(this.foreground=n),0!==r&&(this.background=r)}},Fe=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_mainRule;_children;_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;">"===e.parentScopes[n]&&n++,">"===t.parentScopes[r]&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){const o=t.parentScopes[r].length-e.parentScopes[n].length;if(0!==o)return o;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(""!==t){let e,n,r=t.indexOf(".");if(-1===r?(e=t,n=""):(e=t.substring(0,r),n=t.substring(r+1)),this._children.hasOwnProperty(e))return this._children[e].match(n)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,o,s,i){if(""===n)return void this._doInsertHere(t,r,o,s,i);let a,l,c,u=n.indexOf(".");-1===u?(a=n,l=""):(a=n.substring(0,u),l=n.substring(u+1)),this._children.hasOwnProperty(a)?c=this._children[a]:(c=new e(this._mainRule.clone(),Ue.cloneArr(this._rulesWithParentScopes)),this._children[a]=c),c.insert(t+1,l,r,o,s,i)}_doInsertHere(e,t,n,r,o){if(null!==t){for(let s=0,i=this._rulesWithParentScopes.length;s<i;s++){let i=this._rulesWithParentScopes[s];if(0===Ee(i.parentScopes,t))return void i.acceptOverwrite(e,n,r,o)}-1===n&&(n=this._mainRule.fontStyle),0===r&&(r=this._mainRule.foreground),0===o&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new Ue(e,t,n,r,o))}else this._mainRule.acceptOverwrite(e,n,r,o)}},je=class e{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(t){const n=e.getLanguageId(t),r=e.getTokenType(t),o=e.getFontStyle(t),s=e.getForeground(t),i=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:o,foreground:s,background:i})}static getLanguageId(e){return(255&e)>>>0}static getTokenType(e){return(768&e)>>>8}static containsBalancedBrackets(e){return!!(1024&e)}static getFontStyle(e){return(30720&e)>>>11}static getForeground(e){return(16744448&e)>>>15}static getBackground(e){return(4278190080&e)>>>24}static set(t,n,r,o,s,i,a){let l=e.getLanguageId(t),c=e.getTokenType(t),u=e.containsBalancedBrackets(t)?1:0,h=e.getFontStyle(t),p=e.getForeground(t),d=e.getBackground(t);return 0!==n&&(l=n),8!==r&&(c=r),null!==o&&(u=o?1:0),-1!==s&&(h=s),0!==i&&(p=i),0!==a&&(d=a),(l|c<<8|u<<10|h<<11|p<<15|d<<24)>>>0}};function We(e){return e}function ze(e,t){const n=[],r=function(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}}}(e);let o=r.next();for(;null!==o;){let e=0;if(2===o.length&&":"===o.charAt(1)){switch(o.charAt(0)){case"R":e=1;break;case"L":e=-1;break;default:console.log(`Unknown priority ${o} in scope selector`)}o=r.next()}let t=i();if(n.push({matcher:t,priority:e}),","!==o)break;o=r.next()}return n;function s(){if("-"===o){o=r.next();const e=s();return t=>!!e&&!e(t)}if("("===o){o=r.next();const e=function(){const e=[];let t=i();for(;t&&(e.push(t),"|"===o||","===o);){do{o=r.next()}while("|"===o||","===o);t=i()}return t=>e.some(e=>e(t))}();return")"===o&&(o=r.next()),e}if(He(o)){const e=[];do{e.push(o),o=r.next()}while(He(o));return n=>t(e,n)}return null}function i(){const e=[];let t=s();for(;t;)e.push(t),t=s();return t=>e.every(e=>e(t))}}function He(e){return!!e&&!!e.match(/[\w\.:]+/)}function qe(e){"function"==typeof e.dispose&&e.dispose()}var Ve=class{constructor(e){this.scopeName=e}scopeName;toKey(){return this.scopeName}},Xe=class{constructor(e,t){this.scopeName=e,this.ruleName=t}scopeName;ruleName;toKey(){return`${this.scopeName}#${this.ruleName}`}},Ke=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))}},Ze=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ve(this.initialScopeName)]}repo;initialScopeName;seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new Ke;for(const n of e)Qe(n,this.initialScopeName,this.repo,t);for(const e of t.references)if(e instanceof Ve){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName))continue;if(this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function Qe(e,t,n,r){const o=n.lookup(e.scopeName);if(!o){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const s=n.lookup(t);e instanceof Ve?Je({baseGrammar:s,selfGrammar:o},r):Ye(e.ruleName,{baseGrammar:s,selfGrammar:o,repository:o.repository},r);const i=n.injections(e.scopeName);if(i)for(const e of i)r.add(new Ve(e))}function Ye(e,t,n){if(t.repository&&t.repository[e]){et([t.repository[e]],t,n)}}function Je(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&et(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&et(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function et(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const e=r.repository?Ce({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&et(r.patterns,{...t,repository:e},n);const o=r.include;if(!o)continue;const s=it(o);switch(s.kind){case 0:Je({...t,selfGrammar:t.baseGrammar},n);break;case 1:Je(t,n);break;case 2:Ye(s.ruleName,{...t,repository:e},n);break;case 3:case 4:const r=s.scopeName===t.selfGrammar.scopeName?t.selfGrammar:s.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){const o={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};4===s.kind?Ye(s.ruleName,o,n):Je(o,n)}else 4===s.kind?n.add(new Xe(s.scopeName,s.ruleName)):n.add(new Ve(s.scopeName))}}}var tt=class{kind=0},nt=class{kind=1},rt=class{constructor(e){this.ruleName=e}ruleName;kind=2},ot=class{constructor(e){this.scopeName=e}scopeName;kind=3},st=class{constructor(e,t){this.scopeName=e,this.ruleName=t}scopeName;ruleName;kind=4};function it(e){if("$base"===e)return new tt;if("$self"===e)return new nt;const t=e.indexOf("#");if(-1===t)return new ot(e);if(0===t)return new rt(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new st(n,r)}}var at=/\\(\d+)/,lt=/\\(\d+)/g;var ct=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=Ae.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Ae.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${Se(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return this._nameIsCapturing&&null!==this._name&&null!==e&&null!==t?Ae.replaceCaptures(this._name,e,t):this._name}getContentName(e,t){return this._contentNameIsCapturing&&null!==this._contentName?Ae.replaceCaptures(this._contentName,e,t):this._contentName}},ut=class extends ct{retokenizeCapturedWithRuleId;constructor(e,t,n,r,o){super(e,t,n,r),this.retokenizeCapturedWithRuleId=o}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!")}},ht=class extends ct{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,o){super(e,t,n,null),this._match=new mt(r,this.id),this.captures=o,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 yt,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},pt=class extends ct{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,o){super(e,t,n,r),this.patterns=o.patterns,this.hasMissingPatterns=o.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 yt,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},dt=class extends ct{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,o,s,i,a,l,c){super(e,t,n,r),this._begin=new mt(o,this.id),this.beginCaptures=s,this._end=new mt(i||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=a,this.applyEndPatternLast=l||!1,this.patterns=c.patterns,this.hasMissingPatterns=c.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 yt;for(const t of this.patterns){e.getRule(t).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}},gt=class extends ct{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,o,s,i,a,l){super(e,t,n,r),this._begin=new mt(o,this.id),this.beginCaptures=s,this.whileCaptures=a,this._while=new mt(i,-2),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new yt;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 yt,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||""),this._cachedCompiledWhilePatterns}},ft=class e{static createCaptureRule(e,t,n,r,o){return e.registerRule(e=>new ut(t,e,n,r,o))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(o=>{if(t.id=o,t.match)return new ht(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(void 0===t.begin){t.repository&&(r=Ce({},r,t.repository));let o=t.patterns;return void 0===o&&t.include&&(o=[{include:t.include}]),new pt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(o,n,r))}return t.while?new gt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new dt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let o=[];if(t){let s=0;for(const e in t){if("$vscodeTextmateLocation"===e)continue;const t=parseInt(e,10);t>s&&(s=t)}for(let e=0;e<=s;e++)o[e]=null;for(const s in t){if("$vscodeTextmateLocation"===s)continue;const i=parseInt(s,10);let a=0;t[s].patterns&&(a=e.getCompiledRuleId(t[s],n,r)),o[i]=e.createCaptureRule(n,t[s].$vscodeTextmateLocation,t[s].name,t[s].contentName,a)}}return o}static _compilePatterns(t,n,r){let o=[];if(t)for(let s=0,i=t.length;s<i;s++){const i=t[s];let a=-1;if(i.include){const t=it(i.include);switch(t.kind){case 0:case 1:a=e.getCompiledRuleId(r[i.include],n,r);break;case 2:let o=r[t.ruleName];o&&(a=e.getCompiledRuleId(o,n,r));break;case 3:case 4:const s=t.scopeName,l=4===t.kind?t.ruleName:null,c=n.getExternalGrammar(s,r);if(c)if(l){let t=c.repository[l];t&&(a=e.getCompiledRuleId(t,n,c.repository))}else a=e.getCompiledRuleId(c.repository.$self,n,c.repository)}}else a=e.getCompiledRuleId(i,n,r);if(-1!==a){const e=n.getRule(a);let t=!1;if((e instanceof pt||e instanceof dt||e instanceof gt)&&e.hasMissingPatterns&&0===e.patterns.length&&(t=!0),t)continue;o.push(a)}}return{patterns:o,hasMissingPatterns:(t?t.length:0)!==o.length}}},mt=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&"string"==typeof e){const t=e.length;let n=0,r=[],o=!1;for(let s=0;s<t;s++){if("\\"===e.charAt(s)&&s+1<t){const t=e.charAt(s+1);"z"===t?(r.push(e.substring(n,s)),r.push("$(?!\\n)(?<!\\n)"),n=s+2):"A"!==t&&"G"!==t||(o=!0),s++}}this.hasAnchor=o,0===n?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,"string"==typeof this.source?this.hasBackReferences=at.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if("string"!=typeof this.source)throw new Error("This method should only be called if the source is a string");let n=t.map(t=>e.substring(t.start,t.end));return lt.lastIndex=0,this.source.replace(lt,(e,t)=>Ie(n[parseInt(t,10)]||""))}_buildAnchorCache(){if("string"!=typeof this.source)throw new Error("This method should only be called if the source is a string");let e,t,n,r,o=[],s=[],i=[],a=[];for(e=0,t=this.source.length;e<t;e++)n=this.source.charAt(e),o[e]=n,s[e]=n,i[e]=n,a[e]=n,"\\"===n&&e+1<t&&(r=this.source.charAt(e+1),"A"===r?(o[e+1]="",s[e+1]="",i[e+1]="A",a[e+1]="A"):"G"===r?(o[e+1]="",s[e+1]="G",i[e+1]="",a[e+1]="G"):(o[e+1]=r,s[e+1]=r,i[e+1]=r,a[e+1]=r),e++);return{A0_G0:o.join(""),A0_G1:s.join(""),A1_G0:i.join(""),A1_G1:a.join("")}}resolveAnchors(e,t){return this.hasAnchor&&this._anchorCache&&"string"==typeof this.source?e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0:this.source}},yt=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(e=>e.source);this._cached=new bt(e,t,this._items.map(e=>e.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(e=>e.resolveAnchors(t,n));return new bt(e,r,this._items.map(e=>e.ruleId))}},bt=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}regExps;rules;scanner;dispose(){"function"==typeof this.scanner.dispose&&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("\n")}findNextMatchSync(e,t,n){const r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},_t=class{constructor(e,t){this.languageId=e,this.tokenType=t}languageId;tokenType},wt=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new _t(e,8),this._embeddedLanguagesMatcher=new kt(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return null===t?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new _t(0,0);_getBasicScopeAttributes=new Pe(e=>{const t=this._scopeToLanguage(e),n=this._toStandardTokenType(e);return new _t(t,n)});_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){const n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},kt=class{values;scopesRegExp;constructor(e){if(0===e.length)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([e,t])=>Ie(e));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);return t?this.values.get(t[1]):void 0}};"undefined"!=typeof process&&process.env.VSCODE_TEXTMATE_DEBUG;var vt=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}stack;stoppedEarly};function Ct(e,t,n,r,o,s,i,a){const l=t.content.length;let c=!1,u=-1;if(i){const i=function(e,t,n,r,o,s){let i=o.beginRuleCapturedEOL?0:-1;const a=[];for(let t=o;t;t=t.pop()){const n=t.getRule(e);n instanceof gt&&a.push({rule:n,stack:t})}for(let l=a.pop();l;l=a.pop()){const{ruleScanner:a,findOptions:c}=xt(l.rule,e,l.stack.endRule,n,r===i),u=a.findNextMatchSync(t,r,c);if(!u){o=l.stack.pop();break}if(-2!==u.ruleId){o=l.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(s.produce(l.stack,u.captureIndices[0].start),At(e,t,n,l.stack,s,l.rule.whileCaptures,u.captureIndices),s.produce(l.stack,u.captureIndices[0].end),i=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}return{stack:o,linePos:r,anchorPosition:i,isFirstLine:n}}(e,t,n,r,o,s);o=i.stack,r=i.linePos,n=i.isFirstLine,u=i.anchorPosition}const h=Date.now();for(;!c;){if(0!==a){if(Date.now()-h>a)return new vt(o,!0)}p()}return new vt(o,!1);function p(){const i=function(e,t,n,r,o,s){const i=function(e,t,n,r,o,s){const i=o.getRule(e),{ruleScanner:a,findOptions:l}=St(i,e,o.endRule,n,r===s),c=a.findNextMatchSync(t,r,l);if(c)return{captureIndices:c.captureIndices,matchedRuleId:c.ruleId};return null}(e,t,n,r,o,s),a=e.getInjections();if(0===a.length)return i;const l=function(e,t,n,r,o,s,i){let a,l=Number.MAX_VALUE,c=null,u=0;const h=s.contentNameScopesList.getScopeNames();for(let s=0,p=e.length;s<p;s++){const p=e[s];if(!p.matcher(h))continue;const d=t.getRule(p.ruleId),{ruleScanner:g,findOptions:f}=St(d,t,null,r,o===i),m=g.findNextMatchSync(n,o,f);if(!m)continue;const y=m.captureIndices[0].start;if(!(y>=l)&&(l=y,c=m.captureIndices,a=m.ruleId,u=p.priority,l===o))break}if(c)return{priorityMatch:-1===u,captureIndices:c,matchedRuleId:a};return null}(a,e,t,n,r,o,s);if(!l)return i;if(!i)return l;const c=i.captureIndices[0].start,u=l.captureIndices[0].start;if(u<c||l.priorityMatch&&u===c)return l;return i}(e,t,n,r,o,u);if(!i)return s.produce(o,l),void(c=!0);const a=i.captureIndices,h=i.matchedRuleId,p=!!(a&&a.length>0)&&a[0].end>r;if(-1===h){const i=o.getRule(e);s.produce(o,a[0].start),o=o.withContentNameScopesList(o.nameScopesList),At(e,t,n,o,s,i.endCaptures,a),s.produce(o,a[0].end);const h=o;if(o=o.parent,u=h.getAnchorPos(),!p&&h.getEnterPos()===r)return o=h,s.produce(o,l),void(c=!0)}else{const i=e.getRule(h);s.produce(o,a[0].start);const d=o,g=i.getName(t.content,a),f=o.contentNameScopesList.pushAttributed(g,e);if(o=o.push(h,r,u,a[0].end===l,null,f,f),i instanceof dt){const r=i;At(e,t,n,o,s,r.beginCaptures,a),s.produce(o,a[0].end),u=a[0].end;const h=r.getContentName(t.content,a),g=f.pushAttributed(h,e);if(o=o.withContentNameScopesList(g),r.endHasBackReferences&&(o=o.withEndRule(r.getEndWithResolvedBackReferences(t.content,a))),!p&&d.hasSameRuleAs(o))return o=o.pop(),s.produce(o,l),void(c=!0)}else if(i instanceof gt){const r=i;At(e,t,n,o,s,r.beginCaptures,a),s.produce(o,a[0].end),u=a[0].end;const h=r.getContentName(t.content,a),g=f.pushAttributed(h,e);if(o=o.withContentNameScopesList(g),r.whileHasBackReferences&&(o=o.withEndRule(r.getWhileWithResolvedBackReferences(t.content,a))),!p&&d.hasSameRuleAs(o))return o=o.pop(),s.produce(o,l),void(c=!0)}else{if(At(e,t,n,o,s,i.captures,a),s.produce(o,a[0].end),o=o.pop(),!p)return o=o.safePop(),s.produce(o,l),void(c=!0)}}a[0].end>r&&(r=a[0].end,n=!1)}}function St(e,t,n,r,o){return{ruleScanner:e.compileAG(t,n,r,o),findOptions:0}}function xt(e,t,n,r,o){return{ruleScanner:e.compileWhileAG(t,n,r,o),findOptions:0}}function At(e,t,n,r,o,s,i){if(0===s.length)return;const a=t.content,l=Math.min(s.length,i.length),c=[],u=i[0].end;for(let t=0;t<l;t++){const l=s[t];if(null===l)continue;const h=i[t];if(0===h.length)continue;if(h.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=h.start;)o.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?o.produceFromScopes(c[c.length-1].scopes,h.start):o.produce(r,h.start),l.retokenizeCapturedWithRuleId){const t=l.getName(a,i),s=r.contentNameScopesList.pushAttributed(t,e),c=l.getContentName(a,i),u=s.pushAttributed(c,e),p=r.push(l.retokenizeCapturedWithRuleId,h.start,-1,!1,null,s,u),d=e.createOnigString(a.substring(0,h.end));Ct(e,d,n&&0===h.start,h.start,p,o,!1,0),qe(d);continue}const p=l.getName(a,i);if(null!==p){const t=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(p,e);c.push(new $t(t,h.end))}}for(;c.length>0;)o.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var $t=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function Et(e,t,n,r,o){const s=ze(t,Nt),i=ft.getCompiledRuleId(n,r,o.repository);for(const n of s)e.push({debugSelector:t,matcher:n.matcher,ruleId:i,grammar:o,priority:n.priority})}function Nt(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(It(t[r],e))return n=r+1,!0;return!1})}function It(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 Pt=class{constructor(e,t,n,r,o,s,i,a){if(this._rootScopeName=e,this.balancedBracketSelectors=s,this._onigLib=a,this._basicScopeAttributesProvider=new wt(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=Rt(t,null),this._injections=null,this._tokenTypeMatchers=[],o)for(const e of Object.keys(o)){const t=ze(e,Nt);for(const n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:o[e]})}}_rootScopeName;balancedBracketSelectors;_onigLib;_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=e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),t=[],n=this._rootScopeName,r=e(n);if(r){const e=r.injections;if(e)for(let n in e)Et(t,n,e[n],this,r);const o=this._grammarRepository.injections(n);o&&o.forEach(e=>{const n=this.getExternalGrammar(e);if(n){const e=n.injectionSelector;e&&Et(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return null===this._injections&&(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]=Rt(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){let o;if(-1===this._rootId&&(this._rootId=ft.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections()),t&&t!==Mt.NULL)o=!1,t.reset();else{o=!0;const e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=je.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),s=this.getRule(this._rootId).getName(null,null);let i;i=s?Lt.createRootAndLookUpScopeName(s,r,this):Lt.createRoot("unknown",r),t=new Mt(null,this._rootId,-1,-1,!1,null,i,i)}e+="\n";const s=this.createOnigString(e),i=s.content.length,a=new Ot(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),l=Ct(this,s,o,0,t,a,!0,r);return qe(s),{lineLength:i,lineTokens:a,ruleStack:l.stack,stoppedEarly:l.stoppedEarly}}};function Rt(e,t){return(e=ve(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 Lt=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}parent;scopePath;tokenAttributes;static fromExtension(t,n){let r=t,o=t?.scopePath??null;for(const t of n)o=Le.push(o,t.scopeNames),r=new e(r,o,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Le(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const o=r.getMetadataForScope(t),s=new Le(null,t),i=r.themeProvider.themeMatch(s),a=e.mergeAttributes(n,o,i);return new e(null,s,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return e.equals(this,t)}static equals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}}static mergeAttributes(e,t,n){let r=-1,o=0,s=0;return null!==n&&(r=n.fontStyle,o=n.foregroundId,s=n.backgroundId),je.set(e,t.languageId,t.tokenType,null,r,o,s)}pushAttributed(t,n){if(null===t)return this;if(-1===t.indexOf(" "))return e._pushAttributed(this,t,n);const r=t.split(/ /g);let o=this;for(const t of r)o=e._pushAttributed(o,t,n);return o}static _pushAttributed(t,n,r){const o=r.getMetadataForScope(n),s=t.scopePath.push(n),i=r.themeProvider.themeMatch(s),a=e.mergeAttributes(t.tokenAttributes,o,i);return new e(t,s,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){const t=[];let n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},Mt=class e{constructor(e,t,n,r,o,s,i,a){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=o,this.endRule=s,this.nameScopesList=i,this.contentNameScopesList=a,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}parent;ruleId;beginRuleCapturedEOL;endRule;nameScopesList;contentNameScopesList;_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return null!==t&&e._equals(this,t)}static _equals(e,t){return e===t||!!this._structuralEquals(e,t)&&Lt.equals(e.contentNameScopesList,t.contentNameScopesList)}static _structuralEquals(e,t){for(;;){if(e===t)return!0;if(!e&&!t)return!0;if(!e||!t)return!1;if(e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,o,s,i,a){return new e(this,t,n,r,o,s,i,a)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.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=Lt.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Lt.fromExtension(r,n.contentNameScopesList))}},Tt=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>"*"===e?(this.allowAny=!0,[]):ze(e,Nt).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>ze(e,Nt).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&0===this.unbalancedBracketScopes.length}get matchesNever(){return 0===this.balancedBracketScopes.length&&!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}},Ot=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}balancedBracketSelectors;_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const t=e?.getScopeNames()??[];for(const e of this._tokenTypeOverrides)e.matcher(t)&&(n=je.set(n,0,We(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}return r&&(n=je.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n?void(this._lastTokenEndIndex=t):(this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),void(this._lastTokenEndIndex=t))}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(),0===this._tokens.length&&(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()),0===this._binaryTokens.length&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},Bt=class{constructor(e,t){this._onigLib=t,this._theme=e}_onigLib;_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,o){if(!this._grammars.has(e)){let s=this._rawGrammars.get(e);if(!s)return null;this._grammars.set(e,function(e,t,n,r,o,s,i,a){return new Pt(e,t,n,r,o,s,i,a)}(e,s,t,n,r,o,this,this._onigLib))}return this._grammars.get(e)}},Dt=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new Bt(Re.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(Re.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new Tt(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,o){const s=new Ze(this._syncRegistry,e);for(;s.Q.length>0;)s.Q.map(e=>this._loadSingleGrammar(e.scopeName)),s.processQueue();return this._grammarForScopeName(e,t,n,r,o)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const t=this._options.loadGrammar(e);if(t){const n="function"==typeof this._options.getInjections?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,o=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,o)}},Gt=Mt.NULL;function Ut(e,t){const n="string"==typeof e?{}:{...e.colorReplacements},r="string"==typeof e?e:e.name;for(const[e,o]of Object.entries(t?.colorReplacements||{}))"string"==typeof o?n[e]=o:e===r&&Object.assign(n,o);return n}function Ft(e,t){return e&&t?.[e?.toLowerCase()]||e}async function jt(e){return Promise.resolve("function"==typeof e?e():e).then(e=>e.default||e)}function Wt(e){return!e||["plaintext","txt","text","plain"].includes(e)}function zt(e){return"none"===e}const Ht=/(\r?\n)/g;function qt(e,t=!1){if(0===e.length)return[["",0]];const n=e.split(Ht);let r=0;const o=[];for(let e=0;e<n.length;e+=2){const s=t?n[e]+(n[e+1]||""):n[e];o.push([s,r]),r+=n[e].length,r+=n[e+1]?.length||0}return o}const Vt="#333333",Xt="#bbbbbb",Kt="#fffffe",Zt="#1e1e1e",Qt="__shiki_resolved";function Yt(e){if(e?.[Qt])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 e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.["editor.foreground"]&&(r=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),r||(r="light"===t.type?Vt:Xt),n||(n="light"===t.type?Kt:Zt),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 o=0;const s=new Map;function i(e){if(s.has(e))return s.get(e);o+=1;const n=`#${o.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?i(e):(s.set(e,n),n)}t.settings=t.settings.map(e=>{const n=e.settings?.foreground&&!e.settings.foreground.startsWith("#"),r=e.settings?.background&&!e.settings.background.startsWith("#");if(!n&&!r)return e;const o={...e,settings:{...e.settings}};if(n){const n=i(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,o.settings.foreground=n}if(r){const n=i(e.settings.background);t.colorReplacements[n]=e.settings.background,o.settings.background=n}return o});for(const e of Object.keys(t.colors||{}))if(("editor.foreground"===e||"editor.background"===e||e.startsWith("terminal.ansi"))&&!t.colors[e]?.startsWith("#")){const n=i(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,Qt,{enumerable:!1,writable:!1,value:!0}),t}async function Jt(e){return[...new Set((await Promise.all(e.filter(e=>{return!("ansi"===(t=e)||Wt(t));var t}).map(async e=>await jt(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function en(e){return(await Promise.all(e.map(async e=>function(e){return zt(e)}(e)?null:Yt(await jt(e))))).filter(e=>!!e)}function tn(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 ke(`Circular alias \`${[...n].join(" -> ")} -> ${e}\``);n.add(e)}}return e}var nn=class extends Dt{_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(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return"string"==typeof e?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const t=Yt(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=Re.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=tn(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const t=new Set([...this._langMap.values()].filter(t=>t.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);r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null;for(const e of t)this.reloadLanguage(e);if(e.injectTo){const t=[...this._langMap.values()].filter(t=>t!==e&&this._resolvedGrammars.has(t.name)&&e.injectTo.some(e=>t.scopeName===e||t.scopeName.startsWith(`${e}.`))&&!this.hasCurrentInjections(t.scopeName));for(const e of t)this.reloadLanguage(e)}}hasCurrentInjections(e){const t=this._syncRegistry?._injectionGrammars?.get(e)||[],n=this._resolver.getInjections(e)||[];return t.length===n.length&&t.every((e,t)=>e===n[t])}reloadLanguage(e){this._syncRegistry?._grammars?.get(e.scopeName)?.dispose(),this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._grammars?.delete(e.scopeName),this._syncRegistry?._injectionGrammars?.set(e.scopeName,this._resolver.getInjections(e.scopeName)||[]),this.loadLanguage(this._langMap.get(e.name)||e)}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const t of e)this.resolveEmbeddedLanguages(t);const t=[...this._langGraph.entries()],n=t.filter(([e,t])=>!t);if(n.length){const e=t.filter(([e,t])=>!!t&&(t.embeddedLanguages||t.embeddedLangs)?.some(e=>n.map(([e])=>e).includes(e))).filter(e=>!n.includes(e));throw new ke(`Missing languages ${n.map(([e])=>`\`${e}\``).join(", ")}, required by ${e.map(([e])=>`\`${e}\``).join(", ")}`)}for(const[e,n]of t)this._resolver.addLanguage(n);for(const[e,n]of t)this.loadLanguage(n)}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 e of t)this._langGraph.set(e,this._langMap.get(e))}},rn=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}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).includes(e.scopeName)||this._injections.get(t).push(e.scopeName)})}getInjections(e){const t=e.split(".");let n=[];for(let e=1;e<=t.length;e++){const r=t.slice(0,e).join(".");n=[...n,...this._injections.get(r)||[]]}return n}};let on=0;async function sn(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,r]=await Promise.all([en(e.themes||[]),Jt(e.langs||[]),e.engine]);return function(e){on+=1,!1!==e.warnings&&on>=10&&on%10==0&&console.warn(`[Shiki] ${on} 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 ke("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(Yt),o=new nn(new rn(e.engine,n),r,n,e.langAlias);let s;function i(e){if("none"===e)return{bg:"",fg:"",name:"none",settings:[],type:"dark"};c();const t=o.getTheme(e);if(!t)throw new ke(`Theme \`${e}\` not found, you may need to load it first`);return t}function a(...e){c(),o.loadLanguages(e.flat(1))}function l(...e){c();for(const t of e.flat(1))o.loadTheme(t)}function c(){if(t)throw new ke("Shiki instance has been disposed")}function u(){t||(t=!0,o.dispose(),on-=1)}return{setTheme:function(e){c();const t=i(e);return s!==e&&(o.setTheme(t),s=e),{theme:t,colorMap:o.getColorMap()}},getTheme:i,getLanguage:function(e){c();const t=o.getGrammar("string"==typeof e?e:e.name);if(!t)throw new ke(`Language \`${e}\` not found, you may need to load it first`);return t},getLoadedThemes:function(){return c(),o.getLoadedThemes()},getLoadedLanguages:function(){return c(),o.getLoadedLanguages()},resolveLangAlias:function(t){return tn(t,e.langAlias)},loadLanguage:async function(...e){return a(await Jt(e))},loadLanguageSync:a,loadTheme:async function(...e){return c(),l(await en(e))},loadThemeSync:l,dispose:u,[Symbol.dispose]:u}}({...e,themes:t,langs:n,engine:r})}const an=new WeakMap;function ln(e,t){an.set(e,t)}function cn(e){return an.get(e)}var un=class e{_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 e(Object.fromEntries(function(e){return Array.isArray(e)?e:[e]}(n).map(e=>[e,Gt])),t)}constructor(...e){if(2===e.length){const[t,n]=e;this.lang=n,this._stacks=t}else{const[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return function(e){const t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);const o=e?.nameScopesList?.scopeName;o&&t.push(o),e.parent&&r(e.parent)}return r(e),t}(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};const hn=/,/,pn=/ /;function dn(e,t,n={}){const{theme:r=e.getLoadedThemes()[0]}=n;if(Wt(e.resolveLangAlias(n.lang||"text"))||zt(r))return qt(t).map(e=>[{content:e[0],offset:e[1]}]);const{theme:o,colorMap:s}=e.setTheme(r),i=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==i.name)throw new ke(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${i.name}"`);if(!n.grammarState.themes.includes(o.name))throw new ke(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${o.name}"`)}return function(e,t,n,r,o){const s=gn(e,t,n,r,o),i=new un(s.stateStack,t.name,n.name);return ln(s.tokens,i),s.tokens}(t,i,o,s,n)}function gn(e,t,n,r,o){const s=Ut(n,o),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:a=500,includeExplanation:l=!1}=o,c=qt(e);let u=o.grammarState?function(e,t){if(!(e instanceof un))throw new ke("Invalid grammar state");return e.getInternalStack(t)}(o.grammarState,n.name)??Gt:null!=o.grammarContextCode?gn(o.grammarContextCode,t,n,r,{...o,grammarState:void 0,grammarContextCode:void 0}).stateStack:Gt,h=[];const p=[];for(let e=0,o=c.length;e<o;e++){const[o,d]=c[e];if(""===o){h=[],p.push([]);continue}if(i>0&&o.length>=i){h=[],p.push([{content:o,offset:d,color:"",fontStyle:0}]);continue}let g,f,m;l&&"tokenType"!==l&&(g=t.tokenizeLine(o,u,a),f=g.tokens,m=0);const y=t.tokenizeLine2(o,u,a),b=y.tokens.length/2;for(let e=0;e<b;e++){const t=y.tokens[2*e],i=e+1<b?y.tokens[2*e+2]:o.length;if(t===i)continue;const a=y.tokens[2*e+1],c=Ft(r[je.getForeground(a)],s),u=je.getFontStyle(a),p={content:o.substring(t,i),offset:d+t,color:c,fontStyle:u};if("tokenType"===l)p.type=je.getTokenType(a);else if(l){const e=[];if("scopeName"!==l)for(const t of n.settings){let n;switch(typeof t.scope){case"string":n=t.scope.split(hn).map(e=>e.trim());break;case"object":n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(pn))})}p.explanation=[];let r=0;for(;t+r<i;){const t=f[m],n=o.substring(t.startIndex,t.endIndex);r+=n.length,p.explanation.push({content:n,scopes:"scopeName"===l?fn(t.scopes):mn(e,t.scopes)}),m+=1}}h.push(p)}p.push(h),h=[],u=y.ruleStack}return{tokens:p,stateStack:u}}function fn(e){return e.map(e=>({scopeName:e}))}function mn(e,t){const n=[];for(let r=0,o=t.length;r<o;r++){const o=t[r];n[r]={scopeName:o,themeMatches:_n(e,o,t.slice(0,r))}}return n}function yn(e,t){return e===t||t.substring(0,e.length)===e&&"."===t[e.length]}function bn(e,t,n){if(!yn(e.at(-1),t))return!1;let r=e.length-2,o=n.length-1;for(;r>=0&&o>=0;)yn(e[r],n[o])&&(r-=1),o-=1;return-1===r}function _n(e,t,n){const r=[];for(const{selectors:o,settings:s}of e)for(const e of o)if(bn(e,t,n)){r.push(s);break}return r}function wn(e,t,n,r=dn){const o=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),s=o.map(o=>{const s=r(e,t,{...n,theme:o.theme});return{tokens:s,state:cn(s),theme:"string"==typeof o.theme?o.theme:o.theme.name}}),i=function(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){const o=e.map(e=>e[r]),s=t.map(()=>[]);t.forEach((e,t)=>e.push(s[t]));const i=o.map(()=>0),a=o.map(e=>e[0]);for(;a.every(e=>e);){const e=Math.min(...a.map(e=>e.content.length));for(let t=0;t<n;t++){const n=a[t];n.content.length===e?(s[t].push(n),i[t]+=1,a[t]=o[t][i[t]]):(s[t].push({...n,content:n.content.slice(0,e)}),a[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}(...s.map(e=>e.tokens)),a=i[0].map((e,t)=>e.map((e,r)=>{const s={content:e.content,variants:{},offset:e.offset};return"includeExplanation"in n&&n.includeExplanation&&(s.explanation=e.explanation),i.forEach((e,n)=>{const{content:i,explanation:a,offset:l,...c}=e[t][r];s.variants[o[n].color]=c}),s})),l=s[0].state?new un(Object.fromEntries(s.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),s[0].state.lang):void 0;return l&&ln(a,l),a}const kn=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class vn{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}}function Cn(e,t){const n={},r={};for(const t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new vn(n,r,t)}function Sn(e){return e.toLowerCase()}vn.prototype.normal={},vn.prototype.property={},vn.prototype.space=void 0;class xn{constructor(e,t){this.attribute=t,this.property=e}}xn.prototype.attribute="",xn.prototype.booleanish=!1,xn.prototype.boolean=!1,xn.prototype.commaOrSpaceSeparated=!1,xn.prototype.commaSeparated=!1,xn.prototype.defined=!1,xn.prototype.mustUseProperty=!1,xn.prototype.number=!1,xn.prototype.overloadedBoolean=!1,xn.prototype.property="",xn.prototype.spaceSeparated=!1,xn.prototype.space=void 0;let An=0;const $n=Mn(),En=Mn(),Nn=Mn(),In=Mn(),Pn=Mn(),Rn=Mn(),Ln=Mn();function Mn(){return 2**++An}var Tn=Object.freeze({__proto__:null,boolean:$n,booleanish:En,commaOrSpaceSeparated:Ln,commaSeparated:Rn,number:In,overloadedBoolean:Nn,spaceSeparated:Pn});const On=Object.keys(Tn);class Bn extends xn{constructor(e,t,n,r){let o=-1;if(super(e,t),Dn(this,"space",r),"number"==typeof n)for(;++o<On.length;){const e=On[o];Dn(this,On[o],(n&Tn[e])===Tn[e])}}}function Dn(e,t,n){n&&(e[t]=n)}function Gn(e){const t={},n={};for(const[r,o]of Object.entries(e.properties)){const s=new Bn(r,e.transform(e.attributes||{},r),o,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(s.mustUseProperty=!0),t[r]=s,n[Sn(r)]=r,n[Sn(s.attribute)]=r}return new vn(t,n,e.space)}Bn.prototype.defined=!0;const Un=Gn({properties:{ariaActiveDescendant:null,ariaAtomic:En,ariaAutoComplete:null,ariaBusy:En,ariaChecked:En,ariaColCount:In,ariaColIndex:In,ariaColSpan:In,ariaControls:Pn,ariaCurrent:null,ariaDescribedBy:Pn,ariaDetails:null,ariaDisabled:En,ariaDropEffect:Pn,ariaErrorMessage:null,ariaExpanded:En,ariaFlowTo:Pn,ariaGrabbed:En,ariaHasPopup:null,ariaHidden:En,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Pn,ariaLevel:In,ariaLive:null,ariaModal:En,ariaMultiLine:En,ariaMultiSelectable:En,ariaOrientation:null,ariaOwns:Pn,ariaPlaceholder:null,ariaPosInSet:In,ariaPressed:En,ariaReadOnly:En,ariaRelevant:null,ariaRequired:En,ariaRoleDescription:Pn,ariaRowCount:In,ariaRowIndex:In,ariaRowSpan:In,ariaSelected:En,ariaSetSize:In,ariaSort:null,ariaValueMax:In,ariaValueMin:In,ariaValueNow:In,ariaValueText:null,role:null},transform:(e,t)=>"role"===t?t:"aria-"+t.slice(4).toLowerCase()});function Fn(e,t){return t in e?e[t]:t}function jn(e,t){return Fn(e,t.toLowerCase())}const Wn=Gn({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Rn,acceptCharset:Pn,accessKey:Pn,action:null,allow:null,allowFullScreen:$n,allowPaymentRequest:$n,allowUserMedia:$n,alt:null,as:null,async:$n,autoCapitalize:null,autoComplete:Pn,autoFocus:$n,autoPlay:$n,blocking:Pn,capture:null,charSet:null,checked:$n,cite:null,className:Pn,cols:In,colSpan:null,content:null,contentEditable:En,controls:$n,controlsList:Pn,coords:In|Rn,crossOrigin:null,data:null,dateTime:null,decoding:null,default:$n,defer:$n,dir:null,dirName:null,disabled:$n,download:Nn,draggable:En,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:$n,formTarget:null,headers:Pn,height:In,hidden:Nn,high:In,href:null,hrefLang:null,htmlFor:Pn,httpEquiv:Pn,id:null,imageSizes:null,imageSrcSet:null,inert:$n,inputMode:null,integrity:null,is:null,isMap:$n,itemId:null,itemProp:Pn,itemRef:Pn,itemScope:$n,itemType:Pn,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:$n,low:In,manifest:null,max:null,maxLength:In,media:null,method:null,min:null,minLength:In,multiple:$n,muted:$n,name:null,nonce:null,noModule:$n,noValidate:$n,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:$n,optimum:In,pattern:null,ping:Pn,placeholder:null,playsInline:$n,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:$n,referrerPolicy:null,rel:Pn,required:$n,reversed:$n,rows:In,rowSpan:In,sandbox:Pn,scope:null,scoped:$n,seamless:$n,selected:$n,shadowRootClonable:$n,shadowRootDelegatesFocus:$n,shadowRootMode:null,shape:null,size:In,sizes:null,slot:null,span:In,spellCheck:En,src:null,srcDoc:null,srcLang:null,srcSet:null,start:In,step:null,style:null,tabIndex:In,target:null,title:null,translate:null,type:null,typeMustMatch:$n,useMap:null,value:En,width:In,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Pn,axis:null,background:null,bgColor:null,border:In,borderColor:null,bottomMargin:In,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:$n,declare:$n,event:null,face:null,frame:null,frameBorder:null,hSpace:In,leftMargin:In,link:null,longDesc:null,lowSrc:null,marginHeight:In,marginWidth:In,noResize:$n,noHref:$n,noShade:$n,noWrap:$n,object:null,profile:null,prompt:null,rev:null,rightMargin:In,rules:null,scheme:null,scrolling:En,standby:null,summary:null,text:null,topMargin:In,valueType:null,version:null,vAlign:null,vLink:null,vSpace:In,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:$n,disableRemotePlayback:$n,prefix:null,property:null,results:In,security:null,unselectable:null},space:"html",transform:jn}),zn=Gn({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Ln,accentHeight:In,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:In,amplitude:In,arabicForm:null,ascent:In,attributeName:null,attributeType:null,azimuth:In,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:In,by:null,calcMode:null,capHeight:In,className:Pn,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:In,diffuseConstant:In,direction:null,display:null,dur:null,divisor:In,dominantBaseline:null,download:$n,dx:null,dy:null,edgeMode:null,editable:null,elevation:In,enableBackground:null,end:null,event:null,exponent:In,externalResourcesRequired:null,fill:null,fillOpacity:In,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Rn,g2:Rn,glyphName:Rn,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:In,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:In,horizOriginX:In,horizOriginY:In,id:null,ideographic:In,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:In,k:In,k1:In,k2:In,k3:In,k4:In,kernelMatrix:Ln,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:In,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:In,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:In,overlineThickness:In,paintOrder:null,panose1:null,path:null,pathLength:In,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Pn,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:In,pointsAtY:In,pointsAtZ:In,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Ln,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Ln,rev:Ln,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Ln,requiredFeatures:Ln,requiredFonts:Ln,requiredFormats:Ln,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:In,specularExponent:In,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:In,strikethroughThickness:In,string:null,stroke:null,strokeDashArray:Ln,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:In,strokeOpacity:In,strokeWidth:null,style:null,surfaceScale:In,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Ln,tabIndex:In,tableValues:null,target:null,targetX:In,targetY:In,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Ln,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:In,underlineThickness:In,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:In,values:null,vAlphabetic:In,vMathematical:In,vectorEffect:null,vHanging:In,vIdeographic:In,version:null,vertAdvY:In,vertOriginX:In,vertOriginY:In,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:In,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:Fn}),Hn=Gn({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform:(e,t)=>"xlink:"+t.slice(5).toLowerCase()}),qn=Gn({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:jn}),Vn=Gn({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform:(e,t)=>"xml:"+t.slice(3).toLowerCase()}),Xn=/[A-Z]/g,Kn=/-[a-z]/g,Zn=/^data[-\w.:]+$/i;function Qn(e){return"-"+e.toLowerCase()}function Yn(e){return e.charAt(1).toUpperCase()}const Jn=Cn([Un,Wn,Hn,qn,Vn],"html"),er=Cn([Un,zn,Hn,qn,Vn],"svg"),tr={}.hasOwnProperty;const nr=/["&'<>`]/g,rr=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,or=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,sr=/[|\\{}()[\]^$+*?.]/g,ir=new WeakMap;function ar(e,t){return e=e.replace(t.subset?function(e){let t=ir.get(e);t||(t=function(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(sr,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}(e),ir.set(e,t));return t}(t.subset):nr,n),t.subset||t.escapeOnly?e:e.replace(rr,function(e,n,r){return t.format(1024*(e.charCodeAt(0)-55296)+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}).replace(or,n);function n(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}const lr=/[\dA-Fa-f]/;const cr=/\d/;const ur=["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"],hr={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:"€"},pr=["cent","copy","divide","gt","lt","not","para","times"],dr={}.hasOwnProperty,gr={};let fr;for(fr in hr)dr.call(hr,fr)&&(gr[hr[fr]]=fr);const mr=/[^\dA-Za-z]/;function yr(e,t,n){let r,o=function(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!lr.test(String.fromCharCode(t))?r:r+";"}(e,t,n.omitOptionalSemicolons);if((n.useNamedReferences||n.useShortestReferences)&&(r=function(e,t,n,r){const o=String.fromCharCode(e);if(dr.call(gr,o)){const e=gr[o],s="&"+e;return n&&ur.includes(e)&&!pr.includes(e)&&(!r||t&&61!==t&&mr.test(String.fromCharCode(t)))?s:s+";"}return""}(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!r)&&n.useShortestReferences){const r=function(e,t,n){const r="&#"+String(e);return n&&t&&!cr.test(String.fromCharCode(t))?r:r+";"}(e,t,n.omitOptionalSemicolons);r.length<o.length&&(o=r)}return r&&(!n.useShortestReferences||r.length<o.length)?r:o}function br(e,t){return ar(e,Object.assign({format:yr},t))}const _r=/^>|^->|<!--|-->|--!>|<!-$/g,wr=[">"],kr=["<",">"];function vr(e,t){const n=String(e);if("string"!=typeof t)throw new TypeError("Expected character");let r=0,o=n.indexOf(t);for(;-1!==o;)r++,o=n.indexOf(t,o+t.length);return r}function Cr(e,t){const n=t||{};return(""===e[e.length-1]?[...e,""]:e).join((n.padRight?" ":"")+","+(!1===n.padLeft?"":" ")).trim()}function Sr(e){return e.join(" ").trim()}const xr=/[ \t\n\f\r]/g;function Ar(e){return"object"==typeof e?"text"===e.type&&$r(e.value):$r(e)}function $r(e){return""===e.replace(xr,"")}const Er=Pr(1),Nr=Pr(-1),Ir=[];function Pr(e){return function(t,n,r){const o=t?t.children:Ir;let s=(n||0)+e,i=o[s];if(!r)for(;i&&Ar(i);)s+=e,i=o[s];return i}}const Rr={}.hasOwnProperty;function Lr(e){return function(t,n,r){return Rr.call(e,t.tagName)&&e[t.tagName](t,n,r)}}const Mr=Lr({body:function(e,t,n){const r=Er(n,t);return!r||"comment"!==r.type},caption:Tr,colgroup:Tr,dd:function(e,t,n){const r=Er(n,t);return!r||"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName)},dt:function(e,t,n){const r=Er(n,t);return Boolean(r&&"element"===r.type&&("dt"===r.tagName||"dd"===r.tagName))},head:Tr,html:function(e,t,n){const r=Er(n,t);return!r||"comment"!==r.type},li:function(e,t,n){const r=Er(n,t);return!r||"element"===r.type&&"li"===r.tagName},optgroup:function(e,t,n){const r=Er(n,t);return!r||"element"===r.type&&"optgroup"===r.tagName},option:function(e,t,n){const r=Er(n,t);return!r||"element"===r.type&&("option"===r.tagName||"optgroup"===r.tagName)},p:function(e,t,n){const r=Er(n,t);return r?"element"===r.type&&("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"===r.tagName):!n||!("element"===n.type&&("a"===n.tagName||"audio"===n.tagName||"del"===n.tagName||"ins"===n.tagName||"map"===n.tagName||"noscript"===n.tagName||"video"===n.tagName||n.tagName.includes("-")))},rp:Or,rt:Or,tbody:function(e,t,n){const r=Er(n,t);return!r||"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName)},td:Br,tfoot:function(e,t,n){return!Er(n,t)},th:Br,thead:function(e,t,n){const r=Er(n,t);return Boolean(r&&"element"===r.type&&("tbody"===r.tagName||"tfoot"===r.tagName))},tr:function(e,t,n){const r=Er(n,t);return!r||"element"===r.type&&"tr"===r.tagName}});function Tr(e,t,n){const r=Er(n,t,!0);return!r||"comment"!==r.type&&!("text"===r.type&&Ar(r.value.charAt(0)))}function Or(e,t,n){const r=Er(n,t);return!r||"element"===r.type&&("rp"===r.tagName||"rt"===r.tagName)}function Br(e,t,n){const r=Er(n,t);return!r||"element"===r.type&&("td"===r.tagName||"th"===r.tagName)}const Dr=Lr({body:function(e){const t=Er(e,-1,!0);return!(t&&("comment"===t.type||"text"===t.type&&Ar(t.value.charAt(0))||"element"===t.type&&("meta"===t.tagName||"link"===t.tagName||"script"===t.tagName||"style"===t.tagName||"template"===t.tagName)))},colgroup:function(e,t,n){const r=Nr(n,t);if(n&&r&&"element"===r.type&&"colgroup"===r.tagName&&Mr(r,n.children.indexOf(r),n))return!1;const o=Er(e,-1,!0);return Boolean(o&&"element"===o.type&&"col"===o.tagName)},head:function(e){const t=new Set;for(const n of e.children)if("element"===n.type&&("base"===n.tagName||"title"===n.tagName)){if(t.has(n.tagName))return!1;t.add(n.tagName)}const n=e.children[0];return!n||"element"===n.type},html:function(e){const t=Er(e,-1);return!t||"comment"!==t.type},tbody:function(e,t,n){const r=Nr(n,t);if(n&&r&&"element"===r.type&&("thead"===r.tagName||"tbody"===r.tagName)&&Mr(r,n.children.indexOf(r),n))return!1;const o=Er(e,-1);return Boolean(o&&"element"===o.type&&"tr"===o.tagName)}});const Gr={name:[["\t\n\f\r &/=>".split(""),"\t\n\f\r \"&'/=>`".split("")],["\0\t\n\f\r \"&'/<=>".split(""),"\0\t\n\f\r \"&'/<=>`".split("")]],unquoted:[["\t\n\f\r &>".split(""),"\0\t\n\f\r \"&'<=>`".split("")],["\0\t\n\f\r \"&'<=>`".split(""),"\0\t\n\f\r \"&'<=>`".split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]},Ur=new Set(["desc","foreignObject","title"]);function Fr(e,t,n){const r=function(e,t){const n=Sn(t);let r=t,o=xn;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&"data"===n.slice(0,4)&&Zn.test(t)){if("-"===t.charAt(4)){const e=t.slice(5).replace(Kn,Yn);r="data"+e.charAt(0).toUpperCase()+e.slice(1)}else{const e=t.slice(4);if(!Kn.test(e)){let n=e.replace(Xn,Qn);"-"!==n.charAt(0)&&(n="-"+n),t="data"+n}}o=Bn}return new o(r,t)}(e.schema,t),o=e.settings.allowParseErrors&&"html"===e.schema.space?0:1,s=e.settings.allowDangerousCharacters?0:1;if(!r.overloadedBoolean||n!==r.attribute&&""!==n?!r.boolean&&!r.overloadedBoolean||"string"==typeof n&&n!==r.attribute&&""!==n||(n=Boolean(n)):n=!0,null==n||!1===n||"number"==typeof n&&Number.isNaN(n))return"";const i=br(r.attribute,Object.assign({},e.settings.characterReferences,{subset:Gr.name[o][s]}));if(!0===n)return i;if(n=Array.isArray(n)?(r.commaSeparated?Cr:Sr)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)return i;let a;if(e.settings.preferUnquoted&&(a=br(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Gr.unquoted[o][s]}))),a!==n){let{quote:t}=e;e.settings.quoteSmart&&vr(n,t)>vr(n,e.alternative)&&(t=e.alternative),a=t+br(n,Object.assign({},e.settings.characterReferences,{subset:("'"===t?Gr.single:Gr.double)[o][s],attribute:!0}))+t}return i+(a?"="+a:a)}const jr=["<","&"];function Wr(e,t,n,r){return!n||"element"!==n.type||"script"!==n.tagName&&"style"!==n.tagName?br(e.value,Object.assign({},r.settings.characterReferences,{subset:jr})):e.value}const zr=function(e,t){const n=t||{};function r(t,...n){let o=r.invalid;const s=r.handlers;if(t&&tr.call(t,e)){const n=String(t[e]);o=tr.call(s,n)?s[n]:r.unknown}if(o)return o.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}("type",{invalid:function(e){throw new Error("Expected node, not `"+e+"`")},unknown:function(e){throw new Error("Cannot compile unknown node `"+e.type+"`")},handlers:{comment:function(e,t,n,r){return r.settings.bogusComments?"<?"+br(e.value,Object.assign({},r.settings.characterReferences,{subset:wr}))+">":"\x3c!--"+e.value.replace(_r,function(e){return br(e,Object.assign({},r.settings.characterReferences,{subset:kr}))})+"--\x3e"},doctype:function(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"},element:function(e,t,n,r){const{schema:o}=r,s="svg"!==o.space&&r.settings.omitOptionalTags;let i="svg"===o.space?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase());const a=[];"html"===o.space&&"svg"===e.tagName&&(r.schema=er);const l=function(e,t){const n=[];let r,o=-1;if(t)for(r in t)if(null!==t[r]&&void 0!==t[r]){const o=Fr(e,r,t[r]);o&&n.push(o)}for(;++o<n.length;){const t=e.settings.tightAttributes?n[o].charAt(n[o].length-1):void 0;o!==n.length-1&&'"'!==t&&"'"!==t&&(n[o]+=" ")}return n.join("")}(r,e.properties);"svg"===r.schema.space&&Ur.has(e.tagName)&&(r.schema=Jn);const c=r.all("html"===o.space&&"template"===e.tagName?e.content:e);if(r.schema=o,c&&(i=!1),l||!s||!Dr(e,t,n)){if(a.push("<",e.tagName,l?" "+l:""),i&&("svg"===o.space||r.settings.closeSelfClosing)){const e=l.charAt(l.length-1);(!r.settings.tightSelfClosing||"/"===e||e&&'"'!==e&&"'"!==e)&&a.push(" "),a.push("/")}a.push(">")}return a.push(c),i||s&&Mr(e,t,n)||a.push("</"+e.tagName+">"),a.join("")},raw:function(e,t,n,r){return r.settings.allowDangerousHtml?e.value:Wr(e,0,n,r)},root:function(e,t,n,r){return r.all(e)},text:Wr}});const Hr={},qr={},Vr=[];function Xr(e,t,n){return zr(e,t,n,this)}function Kr(e){const t=[],n=e&&e.children||Vr;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}const Zr=/\s+/g;function Qr(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],"string"==typeof e.properties.class&&(e.properties.class=e.properties.class.split(Zr)),Array.isArray(e.properties.class)||(e.properties.class=[]);const n=Array.isArray(t)?t:t.split(Zr);for(const t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}const Yr=["color","background-color"];function Jr(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&Be.Italic&&(t["font-style"]="italic"),e.fontStyle&Be.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&Be.Underline&&n.push("underline"),e.fontStyle&Be.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function eo(e){return"string"==typeof e?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(";")}function to(){const e=new WeakMap;function t(t){if(!e.has(t.meta)){const n=function(e){const t=qt(e,!0),n=t.map(([e])=>e),r=t.map(([,e])=>e);return{lines:n,indexToPos:function(t){if(t===e.length)return{line:n.length-1,character:n.at(-1).length};let o=0,s=n.length-1;for(;o<s;){const e=o+s+1>>>1;r[e]<=t?o=e:s=e-1}return{line:o,character:t-r[o]}},posToIndex:function(e,t){return r[e]+t}}}(t.source);function r(e){if("number"==typeof e){if(e<0||e>t.source.length)throw new ke(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...n.indexToPos(e),offset:e}}{const t=n.lines[e.line];if(void 0===t)throw new ke(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${n.lines.length}`);let r=e.character;if(r<0&&(r=t.length+r),r<0||r>t.length)throw new ke(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:r,offset:n.posToIndex(e.line,r)}}}const o=(t.options.decorations||[]).map(e=>({...e,start:r(e.start),end:r(e.end)}));!function(e){if(function(e){const t=[],n=new Map,r=new Map;for(let o=0;o<e.length;o++){const{start:s,end:i}=e[o];if(s.offset>i.offset)return!1;s.offset!==i.offset&&(t.push(e[o]),n.has(s.offset)||n.set(s.offset,o),r.set(i.offset,o))}for(let t=0;t<e.length;t++){const{start:o,end:s}=e[t];if(o.offset===s.offset&&((n.get(o.offset)??t)<t||(r.get(o.offset)??t)>t))return!1}t.sort((e,t)=>e.start.offset-t.start.offset||t.end.offset-e.end.offset);const o=[];for(const{start:e,end:n}of t){for(;o.length&&o.at(-1)<=e.offset;)o.pop();if(o.length&&n.offset>o.at(-1))return!1;o.push(n.offset)}return!0}(e))return;for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new ke(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){const t=e[r],o=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,s=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,i=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,a=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(o||s||i||a){if(o&&s)continue;if(i&&a)continue;if(i&&n.start.offset===n.end.offset)continue;if(s&&t.start.offset===t.end.offset)continue;throw new ke(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}(o),e.set(t.meta,{decorations:o,converter:n,source:t.source})}return e.get(t.meta)}return{name:"shiki:decorations",tokens(e){if(this.options.decorations?.length)return function(e,t){const n=[...t instanceof Set?t:new Set(t)].sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{const t=e.offset+e.content.length,r=function(e,t){let n=0,r=e.length;for(;n<r;){const o=n+(r-n>>1);e[o]<=t?n=o+1:r=o}return n}(n,e.offset);let o=r;for(;o<n.length&&n[o]<t;)o++;if(r===o)return e;const s=n.slice(r,o);for(let t=0;t<s.length;t++)s[t]-=e.offset;return function(e,t){let n=0;const r=[];for(const o of t)o>n&&r.push({...e,content:e.content.slice(n,o),offset:e.offset+n}),n=o;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}(e,s)})):e}(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;const n=t(this),r=[...e.children].filter(e=>"element"===e.type&&"span"===e.tagName);if(r.length!==n.converter.lines.length)throw new ke(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function o(e,t,n,o){const s=r[e];let a="",l=-1,c=-1;if(0===t&&(l=0),0===n&&(c=0),n===Number.POSITIVE_INFINITY&&(c=s.children.length),-1===l||-1===c)for(let e=0;e<s.children.length;e++)a+=no(s.children[e]),-1===l&&a.length===t&&(l=e+1),-1===c&&a.length===n&&(c=e+1);if(-1===l)throw new ke(`Failed to find start index for decoration ${JSON.stringify(o.start)}`);if(-1===c)throw new ke(`Failed to find end index for decoration ${JSON.stringify(o.end)}`);const u=s.children.slice(l,c);if(o.alwaysWrap||u.length!==s.children.length)if(o.alwaysWrap||1!==u.length||"element"!==u[0].type){const e={type:"element",tagName:"span",properties:{},children:u};i(e,o,"wrapper"),s.children.splice(l,u.length,e)}else i(u[0],o,"token");else i(s,o,"line")}function s(e,t){r[e]=i(r[e],t,"line")}function i(e,t,n){const r=t.properties||{},o=t.transform||(e=>e);return e.tagName=t.tagName||"span",e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&Qr(e,t.properties.class),e=o(e,n)||e}const a=[],l=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(const e of l){const{start:t,end:n}=e;if(t.line===n.line)o(t.line,t.character,n.character,e);else if(t.line<n.line){o(t.line,t.character,Number.POSITIVE_INFINITY,e);for(let r=t.line+1;r<n.line;r++)a.push(()=>s(r,e));o(n.line,0,n.character,e)}}for(let e=a.length-1;e>=0;e--)a[e]()}}}function no(e){return"text"===e.type?e.value:"element"===e.type?e.children.map(no).join(""):""}const ro=[to()];function oo(e){const t=function(e){const t=[],n=[],r=[];for(const o of e)switch(o.enforce){case"pre":t.push(o);break;case"post":n.push(o);break;default:r.push(o)}return{pre:t,post:n,normal:r}}(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...ro]}var so=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],io={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function ao(e,t){const n=e.indexOf("",t);if(-1!==n&&"["===e[n+1]){const t=e.indexOf("m",n);if(-1!==t)return{sequence:e.substring(n+2,t).split(";"),startPosition:n,position:t+1}}return{position:e.length}}function lo(e){const t=e.shift();if("2"===t){const t=e.splice(0,3).map(e=>Number.parseInt(e));if(3!==t.length||t.some(e=>Number.isNaN(e)))return;return{type:"rgb",rgb:t}}if("5"===t){const t=e.shift();if(t)return{type:"table",index:Number(t)}}}function co(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(0===r)t.push({type:"resetAll"});else if(r<=9)io[r]&&t.push({type:"setDecoration",value:io[r]});else if(r<=29){const e=io[r-20];e&&(t.push({type:"resetDecoration",value:e}),"dim"===e&&t.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:so[r-30]}});else if(38===r){const n=lo(e);n&&t.push({type:"setForegroundColor",value:n})}else if(39===r)t.push({type:"resetForegroundColor"});else if(r<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:so[r-40]}});else if(48===r){const n=lo(e);n&&t.push({type:"setBackgroundColor",value:n})}else 49===r?t.push({type:"resetBackgroundColor"}):53===r?t.push({type:"setDecoration",value:"overline"}):55===r?t.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?t.push({type:"setForegroundColor",value:{type:"named",name:so[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:so[r-100+8]}})}return t}var uo={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function ho(e=uo){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,"0")).join("")}`}let r;function o(e){return function(){if(r)return r;r=[];for(let e=0;e<so.length;e++)r.push(t(so[e]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let o=0;o<6;o++)for(let s=0;s<6;s++)r.push(n([e[t],e[o],e[s]]));let o=8;for(let e=0;e<24;e++,o+=10)r.push(n([o,o,o]));return r}()[e]}return{value:function(e){switch(e.type){case"named":return t(e.name);case"rgb":return n(e.rgb);case"table":return o(e.index)}}}}const po=/#([0-9a-f]{3,8})/i,go=/var\((--[\w-]+-ansi-[\w-]+)\)/,fo={black:"#000000",red:"#cd3131",green:"#0DBC79",yellow:"#E5E510",blue:"#2472C8",magenta:"#BC3FBC",cyan:"#11A8CD",white:"#E5E5E5",brightBlack:"#666666",brightRed:"#F14C4C",brightGreen:"#23D18B",brightYellow:"#F5F543",brightBlue:"#3B8EEA",brightMagenta:"#D670D6",brightCyan:"#29B8DB",brightWhite:"#FFFFFF"};function mo(e,t,n){const r=Ut(e,n),o=qt(t),s=ho(Object.fromEntries(so.map(t=>{const n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||fo[t]]}))),i=function(){let e=null,t=null,n=new Set;return{parse(r){const o=[];let s=0;do{const i=ao(r,s),a=i.sequence?r.substring(s,i.startPosition):r.substring(s);if(a.length>0&&o.push({value:a,foreground:e,background:t,decorations:new Set(n)}),i.sequence){const r=co(i.sequence);for(const o of r)"resetAll"===o.type?(e=null,t=null,n.clear()):"resetForegroundColor"===o.type?e=null:"resetBackgroundColor"===o.type?t=null:"resetDecoration"===o.type&&n.delete(o.value);for(const o of r)"setForegroundColor"===o.type?e=o.value:"setBackgroundColor"===o.type?t=o.value:"setDecoration"===o.type&&n.add(o.value)}s=i.position}while(s<r.length);return o}}}();return o.map(t=>i.parse(t[0]).map(n=>{let o,i;n.decorations.has("reverse")?(o=n.background?s.value(n.background):e.bg,i=n.foreground?s.value(n.foreground):e.fg):(o=n.foreground?s.value(n.foreground):e.fg,i=n.background?s.value(n.background):void 0),o=Ft(o,r),i=Ft(i,r),n.decorations.has("dim")&&(o=function(e){const t=e.match(po);if(t){const e=t[1];if(8===e.length){const t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${e.slice(0,6)}${t}`}if(6===e.length)return`#${e}80`;if(4===e.length){const t=e[0],n=e[1],r=e[2],o=e[3];return`#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${o}${o}`,16)/2).toString(16).padStart(2,"0")}`}if(3===e.length){const t=e[0],n=e[1],r=e[2];return`#${t}${t}${n}${n}${r}${r}80`}}const n=e.match(go);return n?`var(${n[1]}-dim)`:e}(o));let a=Be.None;return n.decorations.has("bold")&&(a|=Be.Bold),n.decorations.has("italic")&&(a|=Be.Italic),n.decorations.has("underline")&&(a|=Be.Underline),n.decorations.has("strikethrough")&&(a|=Be.Strikethrough),{content:n.value,offset:t[1],color:o,bgColor:i,fontStyle:a}}))}function yo(e,t,n={}){const r=e.resolveLangAlias(n.lang||"text"),{theme:o=e.getLoadedThemes()[0]}=n;if(!Wt(r)&&!zt(o)&&"ansi"===r){const{theme:r}=e.setTheme(o);return mo(r,t,n)}return dn(e,t,n)}function bo(e,t,n){let r,o,s,i,a,l;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:u="--shiki-",colorsRendering:h="css-vars"}=n,p=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===c?-1:t.color===c?1:0);if(0===p.length)throw new ke("`themes` option must not be empty");const d=wn(e,t,n,yo);if(l=cn(d),c&&"light-dark()"!==c&&!p.some(e=>e.color===c))throw new ke(`\`themes\` option must contain the defaultColor key \`${c}\``);const g=p.map(t=>e.getTheme(t.theme)),f=p.map(e=>e.color);s=d.map(e=>e.map(e=>function(e,t,n,r,o="css-vars"){const s={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(t=>Jr(e.variants[t])),a=new Set(i.flatMap(e=>Object.keys(e))),l={},c=(e,r)=>{const o="color"===r?"":"background-color"===r?"-bg":`-${r}`;return n+t[e]+("color"===r?"":o)};return i.forEach((e,n)=>{for(const s of a){const a=e[s]||"inherit";if(0===n&&r&&Yr.includes(s))if("light-dark()"===r&&i.length>1){const e=t.findIndex(e=>"light"===e),r=t.findIndex(e=>"dark"===e);if(-1===e||-1===r)throw new ke('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');const u=i[e][s]||"inherit",h=i[r][s]||"inherit";l[s]=`light-dark(${u}, ${h})`,"css-vars"===o&&(l[c(n,s)]=a)}else l[s]=a;else"css-vars"===o&&(l[c(n,s)]=a)}}),s.htmlStyle=l,s}(e,f,u,c,h))),l&&ln(s,l);const m=p.map(e=>Ut(e.theme,n));o=_o(p,g,m,u,c,"fg",h),r=_o(p,g,m,u,c,"bg",h),i=`shiki-themes ${g.map(e=>e.name).join(" ")}`,a=c?void 0:[o,r].join(";")}else{if(!("theme"in n))throw new ke("Invalid options, either `theme` or `themes` must be provided");{const a=Ut(n.theme,n);s=yo(e,t,n);const c=e.getTheme(n.theme);r=Ft(c.bg,a),o=Ft(c.fg,a),i=c.name,l=cn(s)}}return{tokens:s,fg:o,bg:r,themeName:i,rootStyle:a,grammarState:l}}function _o(e,t,n,r,o,s,i){return e.map((a,l)=>{const c=Ft(t[l][s],n[l])||"inherit",u=`${r+a.color}${"bg"===s?"-bg":""}:${c}`;if(0===l&&o){if("light-dark()"===o&&e.length>1){const r=e.findIndex(e=>"light"===e.color),o=e.findIndex(e=>"dark"===e.color);if(-1===r||-1===o)throw new ke('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${Ft(t[r][s],n[r])||"inherit"}, ${Ft(t[o][s],n[o])||"inherit"});${u}`}return c}return"css-vars"===i?u:null}).filter(e=>!!e).join(";")}const wo=/^\s+$/,ko=/^(\s*)(.*?)(\s*)$/;function vo(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>vo(e,t,n),codeToTokens:(t,n)=>bo(e,t,n)}){let o=t;for(const e of oo(n))o=e.preprocess?.call(r,o,n)||o;let{tokens:s,fg:i,bg:a,themeName:l,rootStyle:c,grammarState:u}=bo(e,o,n);const{mergeWhitespaces:h=!0,mergeSameStyleTokens:p=!1}=n;!0===h?s=function(e){return e.map(e=>{const t=[];let n,r="";return e.forEach((o,s)=>{const i=!(o.fontStyle&&(o.fontStyle&Be.Underline||o.fontStyle&Be.Strikethrough));i&&wo.test(o.content)&&e[s+1]?(void 0===n&&(n=o.offset),r+=o.content):r?(i?t.push({...o,offset:n,content:r+o.content}):t.push({content:r,offset:n},o),n=void 0,r=""):t.push(o)}),t})}(s):"never"===h&&(s=function(e){return e.map(e=>e.flatMap(e=>{if(wo.test(e.content))return e;const t=e.content.match(ko);if(!t)return e;const[,n,r,o]=t;if(!n&&!o)return e;const s=[{...e,offset:e.offset+n.length,content:r}];return n&&s.unshift({content:n,offset:e.offset}),o&&s.push({content:o,offset:e.offset+n.length+r.length}),s}))}(s)),p&&(s=function(e){return e.map(e=>{const t=[];for(const n of e){if(0===t.length){t.push({...n});continue}const e=t.at(-1),r=eo(e.htmlStyle||Jr(e)),o=eo(n.htmlStyle||Jr(n)),s=e.fontStyle&&(e.fontStyle&Be.Underline||e.fontStyle&Be.Strikethrough),i=n.fontStyle&&(n.fontStyle&Be.Underline||n.fontStyle&Be.Strikethrough);s||i||r!==o?t.push({...n}):e.content+=n.content}return t})}(s));const d={...r,get source(){return o}};for(const e of oo(n))s=e.tokens?.call(d,s)||s;return function(e,t,n,r=cn(e)){const o=oo(t),s=[],i={type:"root",children:[]},{structure:a="classic",tabindex:l="0"}=t,c={class:`shiki ${t.themeName||""}`};!1!==t.rootStyle&&(null!=t.rootStyle?c.style=t.rootStyle:c.style=`background-color:${t.bg};color:${t.fg}`);!1!==l&&null!=l&&(c.tabindex=l.toString());for(const[e,n]of Object.entries(t.meta||{}))e.startsWith("_")||(c[e]=n);let u={type:"element",tagName:"pre",properties:c,children:[],data:t.data},h={type:"element",tagName:"code",properties:{},children:s};const p=[],d={...n,structure:a,addClassToHast:Qr,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return i},get pre(){return u},get code(){return h},get lines(){return p}};if(e.forEach((e,t)=>{t&&("inline"===a?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):"classic"===a&&s.push({type:"text",value:"\n"}));let n={type:"element",tagName:"span",properties:{class:"line"},children:[]},r=0;for(const s of e){let e={type:"element",tagName:"span",properties:{...s.htmlAttrs},children:[{type:"text",value:s.content}]};const l=eo(s.htmlStyle||Jr(s));l&&(e.properties.style=l);for(const i of o)e=i?.span?.call(d,e,t+1,r,n,s)||e;"inline"===a?i.children.push(e):"classic"===a&&n.children.push(e),r+=s.content.length}if("classic"===a){for(const e of o)n=e?.line?.call(d,n,t+1)||n;p.push(n),s.push(n)}else"inline"===a&&p.push(n)}),"classic"===a){for(const e of o)h=e?.code?.call(d,h)||h;u.children.push(h);for(const e of o)u=e?.pre?.call(d,u)||u;i.children.push(u)}else if("inline"===a){const e=[];let t={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const n of i.children)"element"===n.type&&"br"===n.tagName?(e.push(t),t={type:"element",tagName:"span",properties:{class:"line"},children:[]}):"element"!==n.type&&"text"!==n.type||t.children.push(n);e.push(t);let n={type:"element",tagName:"code",properties:{},children:e};for(const e of o)n=e?.code?.call(d,n)||n;i.children=[];for(let e=0;e<n.children.length;e++){e>0&&i.children.push({type:"element",tagName:"br",properties:{},children:[]});const t=n.children[e];"element"===t.type&&i.children.push(...t.children)}}let g=i;for(const e of o)g=e?.root?.call(d,g)||g;r&&ln(g,r);return g}(s,{...n,fg:i,bg:a,themeName:l,rootStyle:!1!==n.rootStyle&&(n.rootStyle??c)},d,u)}const Co=function(e,t){const n=t||Hr,r=n.quote||'"';if('"'!==r&&"'"!==r)throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");const o='"'===r?"'":'"';return{one:Xr,all:Kr,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||kn,characterReferences:n.characterReferences||qr,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:"svg"===n.space?er:Jn,quote:r,alternative:o}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)};async function So(e){const t=await sn(e);return{getLastGrammarState:(...e)=>function(...e){if(2===e.length)return cn(e[1]);const[t,n,r={}]=e,{lang:o="text",theme:s=t.getLoadedThemes()[0]}=r;if(Wt(o)||zt(s))throw new ke("Plain language does not have grammar state");if("ansi"===o)throw new ke("ANSI language does not have grammar state");const{theme:i,colorMap:a}=t.setTheme(s),l=t.getLanguage(o);return new un(gn(n,l,i,a,r).stateStack,l.name,i.name)}(t,...e),codeToTokensBase:(e,n)=>yo(t,e,n),codeToTokensWithThemes:(e,n)=>wn(t,e,n),codeToTokens:(e,n)=>bo(t,e,n),codeToHast:(e,n)=>vo(t,e,n),codeToHtml:(e,n)=>function(e,t,n){const r={meta:{},options:n,codeToHast:(t,n)=>vo(e,t,n),codeToTokens:(t,n)=>bo(e,t,n)};let o=Co(vo(e,t,n,r));for(const e of oo(n))o=e.postprocess?.call(r,o,n)||o;return o}(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}const xo=4294967295;function Ao(e,t){return{index:e,captureIndices:t.map(e=>null==e?{start:xo,end:xo,length:0}:{start:e[0],end:e[1],length:e[1]-e[0]})}}var $o=class{patterns;options;regexps;lastSearches;constructor(e,t={}){this.patterns=e,this.options=t;const{forgiving:n=!1,cache:r,regexConstructor:o}=t;if(!o)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if("string"!=typeof e)return e;const t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{const t=o(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}}),this.lastSearches=this.regexps.map(e=>e&&function(e){return!e.sticky&&!e.rawOptions?.strategy}(e)?{strId:0,searchedFrom:0,matchIndex:-1,indices:null}:null)}findNextMatchSync(e,t,n){const r="string"==typeof e?e:e.content,o="string"==typeof e?0:e.id||0;let s=-1,i=0,a=null;for(let e=0;e<this.regexps.length;e++){const n=this.regexps[e];if(n)try{const l=o?this.lastSearches[e]:null;let c,u;if(l&&l.strId===o&&l.searchedFrom<=t&&(-1===l.matchIndex||l.matchIndex>=t))c=l.matchIndex,u=l.indices;else{n.lastIndex=t;const e=n.exec(r);c=e?e.index:-1,u=e?e.indices:null,l&&(l.strId=o,l.searchedFrom=t,l.matchIndex=c,l.indices=u)}if(-1===c)continue;if(c===t)return Ao(e,u);(-1===s||c<i)&&(s=e,i=c,a=u)}catch(e){if(this.options.forgiving)continue;throw e}}return-1===s?null:Ao(s,a)}};let Eo=0;function No(e){return{content:e,id:++Eo}}function Io(e){if(1!==[...e].length)throw new Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}const Po=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),Ro=String.raw;function Lo(e,t){if(null==e)throw new Error(t??"Value expected");return e}const Mo=Ro`\[\^?`,To=`c.? | C(?:-.?)?|${Ro`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${Ro`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${Ro`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${Ro`o\{[^\}]*\}?`}|${Ro`\d{1,3}`}`,Oo=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Bo=new RegExp(Ro`
|
|
35
|
+
\\ (?:
|
|
36
|
+
${To}
|
|
37
|
+
| [gk]<[^>]*>?
|
|
38
|
+
| [gk]'[^']*'?
|
|
39
|
+
| .
|
|
40
|
+
)
|
|
41
|
+
| \( (?:
|
|
42
|
+
\? (?:
|
|
43
|
+
[:=!>({]
|
|
44
|
+
| <[=!]
|
|
45
|
+
| <[^>]*>
|
|
46
|
+
| '[^']*'
|
|
47
|
+
| ~\|?
|
|
48
|
+
| #(?:[^)\\]|\\.?)*
|
|
49
|
+
| [^:)]*[:)]
|
|
50
|
+
)?
|
|
51
|
+
| \*[^\)]*\)?
|
|
52
|
+
)?
|
|
53
|
+
| (?:${Oo.source})+
|
|
54
|
+
| ${Mo}
|
|
55
|
+
| .
|
|
56
|
+
`.replace(/\s+/g,""),"gsu"),Do=new RegExp(Ro`
|
|
57
|
+
\\ (?:
|
|
58
|
+
${To}
|
|
59
|
+
| .
|
|
60
|
+
)
|
|
61
|
+
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
62
|
+
| ${Mo}
|
|
63
|
+
| &&
|
|
64
|
+
| .
|
|
65
|
+
`.replace(/\s+/g,""),"gsu");function Go(e,t={}){const n={flags:"",...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if("string"!=typeof e)throw new Error("String expected as pattern");const r=function(e){const t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){const r=e[n];if(!"imxDPSWy".includes(r))throw new Error(`Invalid flag "${r}"`);if("y"!==r)t[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[r]]=!0;else{if(!/^y{[gw]}/.test(e.slice(n)))throw new Error('Invalid or unspecified flag "y" mode');t.textSegmentMode="g"===e[n+2]?"grapheme":"word",n+=3}}return t}(n.flags),o=[r.extended],s={captureGroup:n.rules.captureGroup,getCurrentModX:()=>o.at(-1),numOpenGroups:0,popModX(){o.pop()},pushModX(e){o.push(e)},replaceCurrentModX(e){o[o.length-1]=e},singleline:n.rules.singleline};let i,a=[];for(Bo.lastIndex=0;i=Bo.exec(e);){const t=Uo(s,e,i[0],Bo.lastIndex);t.tokens?a.push(...t.tokens):t.token&&a.push(t.token),void 0!==t.lastIndex&&(Bo.lastIndex=t.lastIndex)}const l=[];let c=0;a.filter(e=>"GroupOpen"===e.type).forEach(e=>{"capturing"===e.kind?e.number=++c:"("===e.raw&&l.push(e)}),c||l.forEach((e,t)=>{e.kind="capturing",e.number=t+1});const u=c||l.length;return{tokens:a.map(e=>"EscapedNumber"===e.type?function(e,t){const{raw:n,inCharClass:r}=e,o=n.slice(1);if(!r&&("0"!==o&&1===o.length||"0"!==o[0]&&+o<=t))return[Ho(n)];const s=[],i=o.match(/^[0-7]+|\d/g);for(let e=0;e<i.length;e++){const t=i[e];let r;if(0===e&&"8"!==t&&"9"!==t){if(r=parseInt(t,8),r>127)throw new Error(Ro`Octal encoded byte above 177 unsupported "${n}"`)}else r=Io(t);s.push(qo(r,(0===e?"\\":"")+t))}return s}(e,u):e).flat(),flags:r}}function Uo(e,t,n,r){const[o,s]=n;if("["===n||"[^"===n){const e=function(e,t,n){const r=[Xo("^"===t[1],t)];let o,s=1;for(Do.lastIndex=n;o=Do.exec(e);){const e=o[0];if("["===e[0]&&":"!==e[1])s++,r.push(Xo("^"===e[1],e));else if("]"===e){if("CharacterClassOpen"===r.at(-1).type)r.push(qo(93,e));else if(s--,r.push(Vo(e)),!s)break}else{const t=Fo(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:Do.lastIndex||e.length}}(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if("\\"===o){if("AbBGyYzZ".includes(s))return{token:zo(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:Jo(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:Ho(n)}}if("K"===s)return{token:Zo("keep",n)};if("N"===s||"R"===s)return{token:Ko("newline",n,{negate:"N"===s})};if("O"===s)return{token:Ko("any",n)};if("X"===s)return{token:Ko("text_segment",n)};const e=jo(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if("("===o){if("*"===s)return{token:rs(n)};if("(?{"===n)throw new Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(")"!==t[r])throw new Error('Unclosed comment group "(?#"');return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:ns(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,"("===n&&!e.captureGroup||"(?:"===n)return{token:Yo("group",n)};if("(?>"===n)return{token:Yo("atomic",n)};if("(?="===n||"(?!"===n||"(?<="===n||"(?<!"===n)return{token:Yo("<"===n[2]?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if("("===n&&e.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:Yo("capturing",n,{..."("!==n&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if("(?~|"===n)throw new Error(`Unsupported absence function kind "${n}"`);return{token:Yo("absence_repeater",n)}}throw"(?("===n?new Error(`Unsupported conditional "${n}"`):new Error(`Invalid or unsupported group option "${n}"`)}if(")"===n){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:Qo(n)}}if(e.getCurrentModX()){if("#"===n){const e=t.indexOf("\n",r);return{lastIndex:-1===e?t.length:e}}if(/^\s$/.test(n)){const e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}if("."===n)return{token:Ko("dot",n)};if("^"===n||"$"===n){return{token:zo(e.singleline?{"^":Ro`\A`,$:Ro`\Z`}[n]:n,n)}}return"|"===n?{token:Wo(n)}:Oo.test(n)?{tokens:is(n)}:{token:qo(Io(n),n)}}function Fo(e){if("\\"===e[0])return jo(e,{inCharClass:!0});if("["===e[0]){const t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!Po.has(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return Ko("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return"-"===e?function(e){return{type:"CharacterClassHyphen",raw:e}}(e):"&&"===e?function(e){return{type:"CharacterClassIntersector",raw:e}}(e):qo(Io(e),e)}function jo(e,{inCharClass:t}){const n=e[1];if("c"===n||"C"===n)return function(e){const t="c"===e[1]?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw new Error(`Unsupported control character "${e}"`);return qo(Io(t.toUpperCase())-64,e)}(e);if("dDhHsSwW".includes(n))return function(e){const t=e[1].toLowerCase();return Ko({d:"digit",h:"hex",s:"space",w:"word"}[t],e,{negate:e[1]!==t})}(e);if(e.startsWith(Ro`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(3===e.length)throw new Error(`Incomplete or invalid Unicode property "${e}"`);return function(e){const{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return Ko("property",e,{value:r,negate:"P"===t&&!n||"p"===t&&!!n})}(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{const t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{const t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join("");return qo(Io(e),t)})}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if("u"===n||"x"===n)return qo(function(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw new Error(`Incomplete or invalid escape "${e}"`);const t="{"===e[2]?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}(e),e);if(ts.has(n))return qo(ts.get(n),e);if(/\d/.test(n))return function(e,t){return{type:"EscapedNumber",inCharClass:e,raw:t}}(t,e);if("\\"===e)throw new Error(Ro`Incomplete escape "\"`);if("M"===n)throw new Error(`Unsupported meta "${e}"`);if(2===[...e].length)return qo(e.codePointAt(1),e);throw new Error(`Unexpected escape "${e}"`)}function Wo(e){return{type:"Alternator",raw:e}}function zo(e,t){return{type:"Assertion",kind:e,raw:t}}function Ho(e){return{type:"Backreference",raw:e}}function qo(e,t){return{type:"Character",value:e,raw:t}}function Vo(e){return{type:"CharacterClassClose",raw:e}}function Xo(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function Ko(e,t,n={}){return{type:"CharacterSet",kind:e,...n,raw:t}}function Zo(e,t,n={}){return"keep"===e?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:Lo(n.flags),raw:t}}function Qo(e){return{type:"GroupClose",raw:e}}function Yo(e,t,n={}){return{type:"GroupOpen",kind:e,...n,raw:t}}function Jo(e){return{type:"Subroutine",raw:e}}const es=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),ts=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function ns(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??="";const o=(t.getCurrentModX()||n.includes("x"))&&!r.includes("x"),s=ss(n),i=ss(r),a={};if(s&&(a.enable=s),i&&(a.disable=i),e.endsWith(")"))return t.replaceCurrentModX(o),Zo("flags",e,{flags:a});if(e.endsWith(":"))return t.pushModX(o),t.numOpenGroups++,Yo("group",e,{...(s||i)&&{flags:a}});throw new Error(`Unexpected flag modifier "${e}"`)}function rs(e){const t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw new Error(`Incomplete or invalid named callout "${e}"`);const{name:n,tag:r,args:o}=t.groups;if(!n)throw new Error(`Invalid named callout "${e}"`);if(""===r)throw new Error(`Named callout tag with empty value not allowed "${e}"`);const s=o?o.split(",").filter(e=>""!==e).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[i,a,l]=s,c=es.has(n)?n.toLowerCase():"custom";switch(c){case"fail":case"mismatch":case"skip":if(s.length>0)throw new Error(`Named callout arguments not allowed "${s}"`);break;case"error":if(s.length>1)throw new Error(`Named callout allows only one argument "${s}"`);if("string"==typeof i)throw new Error(`Named callout argument must be a number "${i}"`);break;case"max":if(!s.length||s.length>2)throw new Error(`Named callout must have one or two arguments "${s}"`);if("string"==typeof i&&!/^[A-Za-z_]\w*$/.test(i))throw new Error(`Named callout argument one must be a tag or number "${i}"`);if(2===s.length&&("number"==typeof a||!/^[<>X]$/.test(a)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${a}"`);break;case"count":case"total_count":if(s.length>1)throw new Error(`Named callout allows only one argument "${s}"`);if(1===s.length&&("number"==typeof i||!/^[<>X]$/.test(i)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${i}"`);break;case"cmp":if(3!==s.length)throw new Error(`Named callout must have three arguments "${s}"`);if("string"==typeof i&&!/^[A-Za-z_]\w*$/.test(i))throw new Error(`Named callout argument one must be a tag or number "${i}"`);if("number"==typeof a||!/^(?:[<>!=]=|[<>])$/.test(a))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${a}"`);if("string"==typeof l&&!/^[A-Za-z_]\w*$/.test(l))throw new Error(`Named callout argument three must be a tag or number "${l}"`);break;case"custom":throw new Error(`Undefined callout name "${n}"`);default:throw new Error(`Unexpected named callout kind "${c}"`)}return function(e,t,n,r){return{type:"NamedCallout",kind:e,tag:t,arguments:n,raw:r}}(c,r??null,o?.split(",")??null,e)}function os(e){let t,n,r=null;if("{"===e[0]){const{minStr:o,maxStr:s}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,i=1e5;if(+o>i||s&&+s>i)throw new Error("Quantifier value unsupported in Oniguruma");if(t=+o,n=void 0===s?+o:""===s?1/0:+s,t>n&&(r="possessive",[t,n]=[n,t]),e.endsWith("?")){if("possessive"===r)throw new Error('Unsupported possessive interval quantifier chain with "?"');r="lazy"}else r||(r="greedy")}else t="+"===e[0]?1:0,n="?"===e[0]?1:1/0,r="+"===e[1]?"possessive":"?"===e[1]?"lazy":"greedy";return function(e,t,n,r){return{type:"Quantifier",kind:e,min:t,max:n,raw:r}}(r,t,n,e)}function ss(e){const t={};return e.includes("i")&&(t.ignoreCase=!0),e.includes("m")&&(t.dotAll=!0),e.includes("x")&&(t.extended=!0),Object.keys(t).length?t:null}function is(e){const t=[],n=new RegExp(Oo,"gy");let r;for(;r=n.exec(e);){const e=r[0];if("{"===e[0]){const r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(r){const{min:o,max:s}=r.groups;if(+o>+s&&e.endsWith("?")){n.lastIndex--,t.push(os(e.slice(0,-1)));continue}}}t.push(os(e))}return t}function as(e,t){if(!Array.isArray(e.body))throw new Error("Expected node with body array");if(1!==e.body.length)return!1;const n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}const ls=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function cs(e,t={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=Go(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),o=(e,t)=>{const n=r.tokens[s.nextIndex];switch(s.parent=e,s.nextIndex++,n.type){case"Alternator":return ds();case"Assertion":return us(n);case"Backreference":return function({raw:e},t){const n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),o=(n,r=!1)=>{const o=t.capturingGroups.length;let s=!1;if(n>o){if(!t.skipBackrefValidation)throw new Error(`Not enough capturing groups defined to the left "${e}"`);s=!0}return t.hasNumberedRef=!0,fs(r?o+1-n:n,{orphan:s})};if(n){const n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(n)return o(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(r))throw new Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw new Error(`Group name not defined to the left "${e}"`);return fs(r)}return o(+r)}(n,s);case"Character":return ys(n.value,{useLastValid:!!t.isCheckingRangeEnd});case"CharacterClassHyphen":return function(e,t,n){const{tokens:r,walk:o}=t,s=t.parent,i=s.body.at(-1),a=r[t.nextIndex];if(!n.isCheckingRangeEnd&&i&&"CharacterClass"!==i.type&&"CharacterClassRange"!==i.type&&a&&"CharacterClassOpen"!==a.type&&"CharacterClassClose"!==a.type&&"CharacterClassIntersector"!==a.type){const e=o(s,{...n,isCheckingRangeEnd:!0});if("Character"===i.type&&"Character"===e.type)return s.body.pop(),function(e,t){if(t.value<e.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:t}}(i,e);throw new Error("Invalid character class range")}return ys(Io("-"))}(0,s,t);case"CharacterClassOpen":return function({negate:e},t,n){const{tokens:r,walk:o}=t,s=[bs()],i=r[t.nextIndex];let a=Ps(i);for(;"CharacterClassClose"!==a.type;){if("CharacterClassIntersector"===a.type)s.push(bs()),t.nextIndex++;else{const e=s.at(-1);e.body.push(o(e,n))}a=Ps(r[t.nextIndex],i)}const l=bs({negate:e});return 1===s.length?l.body=s[0].body:(l.kind="intersection",l.body=s.map(e=>1===e.body.length?e.body[0]:e)),t.nextIndex++,l}(n,s,t);case"CharacterSet":return hs(n,s);case"Directive":return ws(n.kind,{flags:n.flags});case"GroupOpen":return function(e,t,n){const{tokens:r,capturingGroups:o,namedGroupsByName:s,skipLookbehindValidation:i,walk:a}=t,l=function({flags:e,kind:t,name:n,negate:r,number:o}){switch(t){case"absence_repeater":return function(e,t){return{type:"AbsenceFunction",kind:e,body:As(t?.body)}}("repeater");case"atomic":return ks({atomic:!0});case"capturing":return ms(o,{name:n});case"group":return ks({flags:e});case"lookahead":case"lookbehind":return vs({behind:"lookbehind"===t,negate:r});default:throw new Error(`Unexpected group kind "${t}"`)}}(e),c="AbsenceFunction"===l.type,u=Ns(l),h=u&&l.negate;if("CapturingGroup"===l.type&&(o.push(l),l.name&&function(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}(s,l.name,[]).push(l)),c&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let p=Rs(r[t.nextIndex]);for(;"GroupClose"!==p.type;){if("Alternator"===p.type)l.body.push(ds()),t.nextIndex++;else{const e=l.body.at(-1),t=a(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||c,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||h});if(e.body.push(t),(u||n.isInLookbehind)&&!i){const e="Lookbehind includes a pattern not allowed by Oniguruma";if(h||n.isInNegLookbehind){if(Es(t)||"CapturingGroup"===t.type)throw new Error(e)}else if(Es(t)||Ns(t)&&t.negate)throw new Error(e)}}p=Rs(r[t.nextIndex])}return t.nextIndex++,l}(n,s,t);case"NamedCallout":return function(e,t,n){return{type:"NamedCallout",kind:e,tag:t,arguments:n}}(n.kind,n.tag,n.arguments);case"Quantifier":return ps(n,s);case"Subroutine":return function({raw:e},t){const{capturingGroups:n,subroutines:r}=t;let o=e.slice(3,-1);const s=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(o);if(s){const e=+s.groups.num,r=n.length;if(t.hasNumberedRef=!0,o={"":e,"+":r+e,"-":r+1-e}[s.groups.sign],o<1)throw new Error("Invalid subroutine number")}else"0"===o&&(o=0);const i=Ss(o);return r.push(i),i}(n,s);default:throw new Error(`Unexpected token type "${n.type}"`)}},s={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:o},i=function(e,t){return{type:"Regex",body:As(t?.body),flags:e}}(function(e){return{type:"Flags",...e}}(r.flags));let a=i.body[0];for(;s.nextIndex<r.tokens.length;){const e=o(a,{});"Alternative"===e.type?(i.body.push(e),a=e):a.body.push(e)}const{capturingGroups:l,hasNumberedRef:c,namedGroupsByName:u,subroutines:h}=s;if(c&&u.size&&!n.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:e}of h)if("number"==typeof e){if(e>l.length)throw new Error("Subroutine uses a group number that's not defined");e&&(l[e-1].isSubroutined=!0)}else{if(!u.has(e))throw new Error(Ro`Subroutine uses a group name that's not defined "\g<${e}>"`);if(u.get(e).length>1)throw new Error(Ro`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}return i}function us({kind:e}){return gs(Lo({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[e],`Unexpected assertion kind "${e}"`),{negate:e===Ro`\B`||e===Ro`\Y`})}function hs({kind:e,negate:t,value:n},r){const{normalizeUnknownPropertyNames:o,skipPropertyNameValidation:s,unicodePropertyMap:i}=r;if("property"===e){const r=Is(n);if(!Po.has(r)||i?.has(r))return xs(n,{negate:t,normalizeUnknownPropertyNames:o,skipPropertyNameValidation:s,unicodePropertyMap:i});e="posix",n=r}return"posix"===e?function(e,t){const n=!!t?.negate;if(!Po.has(e))throw new Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:n}}(n,{negate:t}):_s(e,{negate:t})}function ps({kind:e,min:t,max:n},r){const o=r.parent,s=o.body.at(-1);if(!s||!function(e){return ls.has(e.type)}(s))throw new Error("Quantifier requires a repeatable token");const i=Cs(e,t,n,s);return o.body.pop(),i}function ds(e){return{type:"Alternative",body:$s(e?.body)}}function gs(e,t){const n={type:"Assertion",kind:e};return("word_boundary"===e||"text_segment_boundary"===e)&&(n.negate=!!t?.negate),n}function fs(e,t){const n=!!t?.orphan;return{type:"Backreference",ref:e,...n&&{orphan:n}}}function ms(e,t){const n={name:void 0,isSubroutined:!1,...t};if(void 0!==n.name&&!function(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}(n.name))throw new Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:As(t?.body)}}function ys(e,t){const n={useLastValid:!1,...t};if(e>1114111){const t=e.toString(16);if(!n.useLastValid)throw e>1310719?new Error(`Invalid code point out of range "\\x{${t}}"`):new Error(`Invalid code point out of range in JS "\\x{${t}}"`);e=1114111}return{type:"Character",value:e}}function bs(e){const t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:$s(e?.body)}}function _s(e,t){const n=!!t?.negate,r={type:"CharacterSet",kind:e};return("digit"===e||"hex"===e||"newline"===e||"space"===e||"word"===e)&&(r.negate=n),("text_segment"===e||"newline"===e&&!n)&&(r.variableLength=!0),r}function ws(e,t={}){if("keep"===e)return{type:"Directive",kind:e};if("flags"===e)return{type:"Directive",kind:e,flags:Lo(t.flags)};throw new Error(`Unexpected directive kind "${e}"`)}function ks(e){const t=e?.atomic,n=e?.flags;if(t&&n)throw new Error("Atomic group cannot have flags");return{type:"Group",...t&&{atomic:t},...n&&{flags:n},body:As(e?.body)}}function vs(e){const t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:As(e?.body)}}function Cs(e,t,n,r){if(t>n)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:n,body:r}}function Ss(e){return{type:"Subroutine",ref:e}}function xs(e,t){const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t};let r=n.unicodePropertyMap?.get(Is(e));if(!r)if(n.normalizeUnknownPropertyNames)r=function(e){return e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw new Error(Ro`Invalid Unicode property "\p{${e}}"`);return{type:"CharacterSet",kind:"property",value:r??e,negate:n.negate}}function As(e){if(void 0===e)e=[ds()];else if(!Array.isArray(e)||!e.length||!e.every(e=>"Alternative"===e.type))throw new Error("Invalid body; expected array of one or more Alternative nodes");return e}function $s(e){if(void 0===e)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw new Error("Invalid body; expected array of nodes");return e}function Es(e){return"LookaroundAssertion"===e.type&&"lookahead"===e.kind}function Ns(e){return"LookaroundAssertion"===e.type&&"lookbehind"===e.kind}function Is(e){return e.replace(/[- _]+/g,"").toLowerCase()}function Ps(e,t){const n=t;return Lo(e,"Unclosed character class"+("Character"===n?.type&&93===n.value&&"]"===n.raw?' (started with "]")':""))}function Rs(e){return Lo(e,"Unclosed group")}function Ls(e,t,n=null){function r(e,t){for(let n=0;n<e.length;n++){const r=o(e[n],t,n,e);n=Math.max(-1,n+r)}}function o(s,i=null,a=null,l=null){let c=0,u=!1;const h={node:s,parent:i,key:a,container:l,root:e,remove(){Ms(l).splice(Math.max(0,Ts(a)+c),1),c--,u=!0},removeAllNextSiblings:()=>Ms(l).splice(Ts(a)+1),removeAllPrevSiblings(){const e=Ts(a)+c;return c-=e,Ms(l).splice(0,Math.max(0,e))},replaceWith(e,t={}){const n=!!t.traverse;l?l[Math.max(0,Ts(a)+c)]=e:Lo(i,"Can't replace root node")[a]=e,n&&o(e,i,a,l),u=!0},replaceWithMultiple(e,t={}){const n=!!t.traverse;if(Ms(l).splice(Math.max(0,Ts(a)+c),1,...e),c+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=o(e[n],i,Ts(a)+n+t,l)}u=!0},skip(){u=!0}},{type:p}=s,d=t["*"],g=t[p],f="function"==typeof d?d:d?.enter,m="function"==typeof g?g:g?.enter;if(f?.(h,n),m?.(h,n),!u)switch(p){case"AbsenceFunction":case"Alternative":case"CapturingGroup":case"CharacterClass":case"Group":case"LookaroundAssertion":r(s.body,s);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":o(s.min,s,"min"),o(s.max,s,"max");break;case"Quantifier":o(s.body,s,"body");break;case"Regex":r(s.body,s),o(s.flags,s,"flags");break;default:throw new Error(`Unexpected node type "${p}"`)}return g?.exit?.(h,n),d?.exit?.(h,n),c}return o(e),e}function Ms(e){if(!Array.isArray(e))throw new Error("Container expected");return e}function Ts(e){if("number"!=typeof e)throw new Error("Numeric key expected");return e}const Os=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function Bs(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Ds(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}const Gs=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function Us(e,t,n,r){const o=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),s=[!1];let i=0,a="";for(const t of e.matchAll(o)){const{0:e,groups:{$skip:o}}=t;o||r&&r===Gs.DEFAULT!=!i?("["===e[0]?(i++,s.push("^"===e[1])):"]"===e&&i&&(i--,s.pop()),a+=e):a+=n instanceof Function?n(t,{context:i?Gs.CHAR_CLASS:Gs.DEFAULT,negated:s[s.length-1]}):n}return a}function Fs(e,t,n,r){Us(e,t,n,r)}function js(e,t,n){return!!function(e,t,n=0,r){if(!new RegExp(t,"su").test(e))return null;const o=new RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");o.lastIndex=n;let s,i=0;for(;s=o.exec(e);){const{0:e,groups:{$skip:t}}=s;if(!(t||r&&r===Gs.DEFAULT!=!i))return s;"["===e?i++:"]"===e&&i&&i--,o.lastIndex==s.index&&o.lastIndex++}return null}(e,t,0,n)}function Ws(e,t){const n=/\\?./gsu;n.lastIndex=t;let r,o=e.length,s=0,i=1;for(;r=n.exec(e);){const[e]=r;if("["===e)s++;else if(s)"]"===e&&s--;else if("("===e)i++;else if(")"===e&&(i--,!i)){o=r.index;break}}return e.slice(t,o)}const zs=new RegExp(String.raw`(?<noncapturingStart>${Os})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");const Hs=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,qs=new RegExp(String.raw`
|
|
66
|
+
\\(?: \d+
|
|
67
|
+
| c[A-Za-z]
|
|
68
|
+
| [gk]<[^>]+>
|
|
69
|
+
| [pPu]\{[^\}]+\}
|
|
70
|
+
| u[A-Fa-f\d]{4}
|
|
71
|
+
| x[A-Fa-f\d]{2}
|
|
72
|
+
)
|
|
73
|
+
| \((?: \? (?: [:=!>]
|
|
74
|
+
| <(?:[=!]|[^>]+>)
|
|
75
|
+
| [A-Za-z\-]+:
|
|
76
|
+
| \(DEFINE\)
|
|
77
|
+
))?
|
|
78
|
+
| (?<qBase>${Hs})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
79
|
+
| \\?.
|
|
80
|
+
`.replace(/\s+/g,""),"gsu");const Vs=String.raw,Xs=Vs`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,Ks=Vs`\(\?R=(?<rDepth>[^\)]+)\)|${Xs}`,Zs=Vs`\(\?<(?![=!])(?<captureName>[^>]+)>`,Qs=Vs`${Zs}|(?<unnamed>\()(?!\?)`,Ys=new RegExp(Vs`${Zs}|${Ks}|\(\?|\\?.`,"gsu"),Js="Cannot use multiple overlapping recursions";function ei(e){const t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e))throw new Error(t);if((e=+e)<2||e>100)throw new Error(t)}function ti(e,t,n,r,o,s,i){const a=new Set;r&&Fs(e+t,Zs,({groups:{captureName:e}})=>{a.add(e)},Gs.DEFAULT);const l=[n,r?a:null,o,s,i];return`${e}${ni(`(?:${e}`,"forward",...l)}(?:)${ni(`${t})`,"backward",...l)}${t}`}function ni(e,t,n,r,o,s,i){const a=e=>"forward"===t?e+2:n-e+2-1;let l="";for(let t=0;t<n;t++){const n=a(t);l+=Us(e,Vs`${Qs}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:a,backref:l}})=>{if(l&&r&&!r.has(l))return e;const c=`_$${n}`;if(a||t){const n=i+s.length+1;return s.push(n),ri(o,n),a?e:`(?<${t}${c}>`}return Vs`\k<${l}${c}>`},Gs.DEFAULT)}return l}function ri(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function oi(e,t,n,r,o,s){if(e.size&&r){let i=0;Fs(t,Qs,()=>i++,Gs.DEFAULT);const a=s-i+o,l=new Map;return e.forEach((e,t)=>{const o=(r-i*n)/n,s=i*n,c=t>a+i?t+r:t,u=[];for(const t of e)if(t<=a)u.push(t);else if(t>a+i+o)u.push(t+r);else if(t<=a+i)for(let e=0;e<=n;e++)u.push(t+i*e);else for(let e=0;e<=n;e++)u.push(t+s+o*e);l.set(c,u)}),l}return e}var si=String.fromCodePoint,ii=String.raw,ai={},li=globalThis.RegExp;function ci(e,{enable:t,disable:n}){return{dotAll:!(n?.dotAll||!t?.dotAll&&!e.dotAll),ignoreCase:!(n?.ignoreCase||!t?.ignoreCase&&!e.ignoreCase)}}function ui(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function hi(e,t){return pi[e]>=pi[t]}ai.flagGroups=(()=>{try{new li("(?i:)")}catch{return!1}return!0})(),ai.unicodeSets=(()=>{try{new li("[[]]","v")}catch{return!1}return!0})(),ai.bugFlagVLiteralHyphenIsRange=!!ai.unicodeSets&&(()=>{try{new li(ii`[\d\-a]`,"v")}catch{return!0}return!1})(),ai.bugNestedClassIgnoresNegation=ai.unicodeSets&&new li("[[^a]]","v").test("a");var pi={ES2025:2025,ES2024:2024,ES2018:2018},di={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function gi(e={}){if("[object Object]"!=={}.toString.call(e))throw new Error("Unexpected options");if(void 0!==e.target&&!di[e.target])throw new Error(`Unexpected target "${e.target}"`);const t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return"auto"===t.target&&(t.target=ai.flagGroups?"ES2025":ai.unicodeSets?"ES2024":"ES2018"),t}var fi=new Set([si(304),si(305)]),mi=ii`[\p{L}\p{M}\p{N}\p{Pc}]`;function yi(e){if(fi.has(e))return[e];const t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),o=ki.get(n),s=_i.get(n),i=wi.get(n);return 1===[...r].length&&t.add(r),i&&t.add(i),o&&t.add(o),t.add(n),s&&t.add(s),[...t]}var bi=new Map("C Other\nCc Control cntrl\nCf Format\nCn Unassigned\nCo Private_Use\nCs Surrogate\nL Letter\nLC Cased_Letter\nLl Lowercase_Letter\nLm Modifier_Letter\nLo Other_Letter\nLt Titlecase_Letter\nLu Uppercase_Letter\nM Mark Combining_Mark\nMc Spacing_Mark\nMe Enclosing_Mark\nMn Nonspacing_Mark\nN Number\nNd Decimal_Number digit\nNl Letter_Number\nNo Other_Number\nP Punctuation punct\nPc Connector_Punctuation\nPd Dash_Punctuation\nPe Close_Punctuation\nPf Final_Punctuation\nPi Initial_Punctuation\nPo Other_Punctuation\nPs Open_Punctuation\nS Symbol\nSc Currency_Symbol\nSk Modifier_Symbol\nSm Math_Symbol\nSo Other_Symbol\nZ Separator\nZl Line_Separator\nZp Paragraph_Separator\nZs Space_Separator\nASCII\nASCII_Hex_Digit AHex\nAlphabetic Alpha\nAny\nAssigned\nBidi_Control Bidi_C\nBidi_Mirrored Bidi_M\nCase_Ignorable CI\nCased\nChanges_When_Casefolded CWCF\nChanges_When_Casemapped CWCM\nChanges_When_Lowercased CWL\nChanges_When_NFKC_Casefolded CWKCF\nChanges_When_Titlecased CWT\nChanges_When_Uppercased CWU\nDash\nDefault_Ignorable_Code_Point DI\nDeprecated Dep\nDiacritic Dia\nEmoji\nEmoji_Component EComp\nEmoji_Modifier EMod\nEmoji_Modifier_Base EBase\nEmoji_Presentation EPres\nExtended_Pictographic ExtPict\nExtender Ext\nGrapheme_Base Gr_Base\nGrapheme_Extend Gr_Ext\nHex_Digit Hex\nIDS_Binary_Operator IDSB\nIDS_Trinary_Operator IDST\nID_Continue IDC\nID_Start IDS\nIdeographic Ideo\nJoin_Control Join_C\nLogical_Order_Exception LOE\nLowercase Lower\nMath\nNoncharacter_Code_Point NChar\nPattern_Syntax Pat_Syn\nPattern_White_Space Pat_WS\nQuotation_Mark QMark\nRadical\nRegional_Indicator RI\nSentence_Terminal STerm\nSoft_Dotted SD\nTerminal_Punctuation Term\nUnified_Ideograph UIdeo\nUppercase Upper\nVariation_Selector VS\nWhite_Space space\nXID_Continue XIDC\nXID_Start XIDS".split(/\s/).map(e=>[Is(e),e])),_i=new Map([["s",si(383)],[si(383),"s"]]),wi=new Map([[si(223),si(7838)],[si(107),si(8490)],[si(229),si(8491)],[si(969),si(8486)]]),ki=new Map([Ci(453),Ci(456),Ci(459),Ci(498),...Si(8072,8079),...Si(8088,8095),...Si(8104,8111),Ci(8124),Ci(8140),Ci(8188)]),vi=new Map([["alnum",ii`[\p{Alpha}\p{Nd}]`],["alpha",ii`\p{Alpha}`],["ascii",ii`\p{ASCII}`],["blank",ii`[\p{Zs}\t]`],["cntrl",ii`\p{Cc}`],["digit",ii`\p{Nd}`],["graph",ii`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",ii`\p{Lower}`],["print",ii`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",ii`[\p{P}\p{S}]`],["space",ii`\p{space}`],["upper",ii`\p{Upper}`],["word",ii`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",ii`\p{AHex}`]]);function Ci(e){const t=si(e);return[t.toLowerCase(),t]}function Si(e,t){return function(e,t){const n=[];for(let r=e;r<=t;r++)n.push(r);return n}(e,t).map(e=>Ci(e))}var xi=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);var Ai={AbsenceFunction({node:e,parent:t,replaceWith:n}){const{body:r,kind:o}=e;if("repeater"!==o)throw new Error('Unsupported absence function "(?~|"');{const e=ks();e.body[0].body.push(vs({negate:!0,body:r}),xs("Any"));const o=ks();o.body[0].body.push(Cs("greedy",0,1/0,e)),n(ji(o,t),{traverse:!0})}},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){const o=e.body.filter(e=>"flags"===e.kind);for(let e=n+1;e<t.body.length;e++){ui(r,t.body[e],[]).push(...o)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){const n=Li(t.get(e));if(n){const t=ks({flags:n});t.body[0].body=e.body,e.body=[ji(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:o,remove:s,replaceWith:i},a){const{kind:l,negate:c}=e,{asciiWordBoundaries:u,avoidSubclass:h,supportedGNodes:p,wordIsAscii:d}=a;if("text_segment_boundary"===l)throw new Error(`Unsupported text segment boundary "\\${c?"Y":"y"}"`);if("line_end"===l)i(ji(vs({body:[ds({body:[gs("string_end")]}),ds({body:[ys(10)]})]}),t));else if("line_start"===l)i(ji(Gi(ii`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if("search_start"===l)if(p.has(e))o.flags.sticky=!0,s();else{const e=r[n-1];if(e&&function(e){const t=["Character","CharacterClass","CharacterSet"];return t.includes(e.type)||"Quantifier"===e.type&&e.min&&t.includes(e.body.type)}(e))i(ji(vs({negate:!0}),t));else{if(h)throw new Error(ii`Uses "\G" in a way that requires a subclass`);i(Fi(gs("string_start"),t)),a.strategy="clip_search"}}else if("string_end"===l||"string_start"===l);else if("string_end_newline"===l)i(ji(Gi(ii`(?=\n?\z)`),t));else{if("word_boundary"!==l)throw new Error(`Unexpected assertion kind "${l}"`);if(!d&&!u){i(ji(Gi(c?`(?:(?<=${mi})(?=${mi})|(?<!${mi})(?!${mi}))`:`(?:(?<=${mi})(?!${mi})|(?<!${mi})(?=${mi}))`),t))}}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;"string"!=typeof n||Di(n)||(n=Ri(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!Di(r)&&(r=Ri(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){if("intersection"===t.kind){n(ji(bs({body:[e]}),t),{traverse:!0})}},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:o,digitIsAscii:s,spaceIsAscii:i,wordIsAscii:a}){const{kind:l,negate:c,value:u}=e;if(!s||"digit"!==l&&"digit"!==u)if(!i||"space"!==l&&"space"!==u)if(!a||"word"!==l&&"word"!==u)if("any"===l)n(Fi(xs("Any"),t));else if("digit"===l)n(Fi(xs("Nd",{negate:c}),t));else if("dot"===l);else if("text_segment"===l){if("strict"===r)throw new Error(ii`Use of "\X" requires non-strict accuracy`);const e="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",s=ii`\p{RI}{2}|${e}(?:\u200D${e})*`;n(ji(Gi(ii`(?>\r\n|${o?ii`\p{RGI_Emoji}`:s}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if("hex"===l)n(Fi(xs("AHex",{negate:c}),t));else if("newline"===l)n(ji(Gi(c?"[^\n]":"(?>\r\n?|[\n\v\f
\u2028\u2029])"),t));else if("posix"===l)if(o||"graph"!==u&&"print"!==u)n(ji(Ui(Gi(vi.get(u)),c),t));else{if("strict"===r)throw new Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:"!-~",print:" -~"}[u];c&&(e=`\0-${si(e.codePointAt(0)-1)}${si(e.codePointAt(2)+1)}-`),n(ji(Gi(`[${e}]`),t))}else if("property"===l)bi.has(Is(u))||(e.key="sc");else if("space"===l)n(Fi(xs("space",{negate:c}),t));else{if("word"!==l)throw new Error(`Unexpected character set kind "${l}"`);n(ji(Ui(Gi(mi),c),t))}else n(Fi(_s("word",{negate:c}),t));else n(ji(Ui(Gi("[\t-\r ]"),c),t));else n(Fi(_s("digit",{negate:c}),t))},Directive({node:e,parent:t,root:n,remove:r,replaceWith:o,removeAllPrevSiblings:s,removeAllNextSiblings:i}){const{kind:a,flags:l}=e;if("flags"===a)if(l.enable||l.disable){const e=ks({flags:l});e.body[0].body=i(),o(ji(e,t),{traverse:!0})}else r();else{if("keep"!==a)throw new Error(`Unexpected directive kind "${a}"`);{const e=n.body[0],r=1===n.body.length&&as(e,{type:"Group"})&&1===e.body[0].body.length?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw new Error(ii`Uses "\K" in a way that's unsupported`);const i=vs({behind:!0});i.body[0].body=s(),o(ji(i,t))}}},Flags({node:e,parent:t}){if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if("word"===e.textSegmentMode)throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;const{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){const{kind:n}=e;"lookbehind"===n&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){const{kind:r}=e;if("fail"!==r)throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`);n(ji(vs({negate:!0}),t))},Quantifier({node:e}){if("Quantifier"===e.body.type){const t=ks();t.body[0].body.push(e.body),e.body=ji(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){const n=[];let r=!1,o=!1;for(const t of e.body)if(1===t.body.length&&"search_start"===t.body[0].kind)t.body.pop();else{const e=Oi(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):o=!0}r&&!o&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if("strict"===t&&n&&r)throw new Error(ii`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;"string"!=typeof n||Di(n)||(n=Ri(n,t),e.ref=n)}},$i={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){const{orphan:r,ref:o}=e;r||n.set(e,[...t.get(o).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:o,groupsByName:s,multiplexCapturesToLeftByRef:i,openRefs:a,reffedNodesByReferencer:l}){const c=o.get(e);if(c&&a.has(e.number)){const r=Fi(Pi(e.number),t);return l.set(r,a.get(e.number)),void n(r)}a.set(e.number,e),i.set(e.number,[]),e.name&&ui(i,e.name,[]);const u=i.get(e.name??e.number);for(let t=0;t<u.length;t++){const n=u[t];if(c===n.node||c&&c===n.origin||e===n.origin){u.splice(t,1);break}}if(i.get(e.number).push({node:e,origin:c}),e.name&&i.get(e.name).push({node:e,origin:c}),e.name){const t=ui(s,e.name,new Map);let n=!1;if(c)n=!0;else for(const e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}s.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=ci(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){const{isRecursive:o,ref:s}=e;if(o){let n=t;for(;(n=n.parent)&&("CapturingGroup"!==n.type||n.name!==s&&n.number!==s););return void r.reffedNodesByReferencer.set(e,n)}const i=r.subroutineRefMap.get(s),a=0===s,l=a?Pi(0):Ii(i,r.groupOriginByCopy,null);let c=l;if(!a){const e=Li(function(e,t){const n=[];for(;e=e.parent;)t&&!t(e)||n.push(e);return n}(i,e=>"Group"===e.type&&!!e.flags)),t=e?ci(r.globalFlags,e):r.globalFlags;(function(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase})(t,r.currentFlags)||(c=ks({flags:Mi(t)}),c.body[0].body.push(l))}n(ji(c,t),{traverse:!a})}},Ei={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan)return void(r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref));const o=r.reffedNodesByReferencer.get(e).filter(t=>function(e,t){let n=t;do{if("Regex"===n.type)return!1;if("Alternative"===n.type)continue;if(n===e)return!1;const t=Ti(n.parent);for(const r of t){if(r===n)break;if(r===e||Bi(r,e))return!0}}while(n=n.parent);throw new Error("Unexpected path")}(t,e));if(o.length)if(o.length>1){n(ji(ks({atomic:!0,body:o.reverse().map(e=>ds({body:[fs(e.number)]}))}),t))}else e.ref=o[0].number;else n(ji(vs({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){const n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){const t=ms();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&0!==e.ref&&(e.ref=t.reffedNodesByReferencer.get(e).number)}};function Ni(e){Ls(e,{"*"({node:e,parent:t}){e.parent=t}})}function Ii(e,t,n,r){const o=Array.isArray(e)?[]:{};for(const[s,i]of Object.entries(e))"parent"===s?o.parent=Array.isArray(n)?r:n:i&&"object"==typeof i?o[s]=Ii(i,t,o,n):("type"===s&&"CapturingGroup"===i&&t.set(o,t.get(e)??e),o[s]=i);return o}function Pi(e){const t=Ss(e);return t.isRecursive=!0,t}function Ri(e,t){if(t.has(e))return t.get(e);const n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,"_")}`;return t.set(e,n),n}function Li(e){const t=["dotAll","ignoreCase"],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function Mi({dotAll:e,ignoreCase:t}){const n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),e&&t||(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function Ti(e){if(!e)throw new Error("Node expected");const{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function Oi(e){const t=e.find(e=>"search_start"===e.kind||function(e,t){const n={negate:null,...t};return"LookaroundAssertion"===e.type&&(null===n.negate||e.negate===n.negate)&&1===e.body.length&&as(e.body[0],{type:"Assertion",kind:"search_start"})}(e,{negate:!1})||!function({type:e}){return"Assertion"===e||"Directive"===e||"LookaroundAssertion"===e}(e));if(!t)return null;if("search_start"===t.kind)return t;if("LookaroundAssertion"===t.type)return t.body[0].body[0];if("CapturingGroup"===t.type||"Group"===t.type){const e=[];for(const n of t.body){const t=Oi(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function Bi(e,t){const n=Ti(e)??[];for(const e of n)if(e===t||Bi(e,t))return!0;return!1}function Di(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function Gi(e,t){const n=cs(e,{...t,unicodePropertyMap:bi}).body;return n.length>1||n[0].body.length>1?ks({body:n}):n[0].body[0]}function Ui(e,t){return e.negate=t,e}function Fi(e,t){return e.parent=t,e}function ji(e,t){return Ni(e),e.parent=t,e}function Wi(e,t){const n=gi(t),r=hi(n.target,"ES2024"),o=hi(n.target,"ES2025"),s=n.rules.recursionLimit;if(!Number.isInteger(s)||s<2||s>20)throw new Error("Invalid recursionLimit; use 2-20");let i=null,a=null;if(!o){const t=[e.flags.ignoreCase];Ls(e,zi,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?i=!0:a=!0}})}const l={dotAll:e.flags.dotAll,ignoreCase:!(!e.flags.ignoreCase&&!i||a)};let c=e;const u={accuracy:n.accuracy,appliedGlobalFlags:l,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:c,originMap:e._originMap,recursionLimit:s,useAppliedIgnoreCase:!(o||!i||!a),useFlagMods:o,useFlagV:r,verbose:n.verbose};function h(e){u.lastNode=c,c=e;return function(e,t){if(null==e)throw new Error(t??"Value expected");return e}(Hi[e.type],`Unexpected node type "${e.type}"`)(e,u,h)}const p={pattern:e.body.map(h).join("|"),flags:h(e.flags),options:{...e.options}};return r||(delete p.options.force.v,p.options.disable.v=!0,p.options.unicodeSetsPlugin=null),p._captureTransfers=new Map,p._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&p._hiddenCaptures.push(t),e.transferTo&&ui(p._captureTransfers,e.transferTo,[]).push(t)}),p}var zi={"*":{enter({node:e},t){if(ea(e)){const n=t.getCurrentModI();t.pushModI(e.flags?ci({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){ea(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){Qi(si(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),Yi(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){"property"===e.kind&&xi.has(e.value)&&t.setHasCasedChar()}},Hi={Alternative:({body:e},t,n)=>e.map(n).join(""),Assertion({kind:e,negate:t}){if("string_end"===e)return"$";if("string_start"===e)return"^";if("word_boundary"===e)return t?ii`\B`:ii`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if("number"!=typeof e)throw new Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&"strict"===t.accuracy&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,n){const{body:r,name:o,number:s}=e,i={ignoreCase:t.currentFlags.ignoreCase},a=t.originMap.get(e);return a&&(i.hidden=!0,s>a.number&&(i.transferTo=a.number)),t.captureMap.set(s,i),`(${o?`?<${o}>`:""}${r.map(n).join("|")})`},Character({value:e},t){const n=si(e),r=Ji(e,{escDigit:"Backreference"===t.lastNode.type,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Qi(n)){const e=yi(n);return t.inCharClass?e.join(""):e.length>1?`[${e.join("")}]`:e[0]}return n},CharacterClass(e,t,n){const{kind:r,negate:o,parent:s}=e;let{body:i}=e;if("intersection"===r&&!t.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");ai.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&i.some(ta)&&(i=[ys(45),...i.filter(e=>!ta(e))]);const a=()=>`[${o?"^":""}${i.map(n).join("intersection"===r?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||ai.bugNestedClassIgnoresNegation)&&!o){const t=i.filter(e=>"CharacterClass"===e.type&&"union"===e.kind&&e.negate);if(t.length){const r=ks(),o=r.body[0];return r.parent=s,o.parent=r,i=i.filter(e=>!t.includes(e)),e.body=i,i.length?(e.parent=o,o.body.push(e)):r.body.pop(),t.forEach(e=>{const t=ds({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;const r=a();return t.inCharClass=!1,r}const l=i[0];if("union"===r&&!o&&l&&((!t.useFlagV||!t.verbose)&&"union"===s.kind&&(!ai.bugFlagVLiteralHyphenIsRange||!t.useFlagV)||!t.verbose&&"intersection"===s.kind&&1===i.length&&"CharacterClassRange"!==l.type))return i.map(n).join("");if(!t.useFlagV&&"CharacterClass"===s.type)throw new Error("Uses nested character class in a way that requires min target ES2024");return a()},CharacterClassRange(e,t){const n=e.min.value,r=e.max.value,o={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},s=Ji(n,o),i=Ji(r,o),a=new Set;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){const t=function(e){const t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[];let r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:null===r?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}(Yi(e));t.forEach(e=>{a.add(Array.isArray(e)?`${Ji(e[0],o)}-${Ji(e[1],o)}`:Ji(e,o))})}return`${s}-${i}${[...a].join("")}`},CharacterSet({kind:e,negate:t,value:n,key:r},o){if("dot"===e)return o.currentFlags.dotAll?o.appliedGlobalFlags.dotAll||o.useFlagMods?".":"[^]":ii`[^\n]`;if("digit"===e)return t?ii`\D`:ii`\d`;if("property"===e){if(o.useAppliedIgnoreCase&&o.currentFlags.ignoreCase&&xi.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?ii`\P`:ii`\p`}{${r?`${r}=`:""}${n}}`}if("word"===e)return t?ii`\W`:ii`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags:(e,t)=>(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":""),Group({atomic:e,body:t,flags:n,parent:r},o,s){const i=o.currentFlags;n&&(o.currentFlags=ci(i,n));const a=t.map(s).join("|"),l=o.verbose||1!==t.length||"Quantifier"===r.type||e||o.useFlagMods&&n?`(?${function(e,t,n){if(e)return">";let r="";if(t&&n){const{enable:e,disable:n}=t;r=(e?.ignoreCase?"i":"")+(e?.dotAll?"s":"")+(n?"-":"")+(n?.ignoreCase?"i":"")+(n?.dotAll?"s":"")}return`${r}:`}(e,n,o.useFlagMods)}${a})`:a;return o.currentFlags=i,l},LookaroundAssertion:({body:e,kind:t,negate:n},r,o)=>`(?${`${"lookahead"===t?"":"<"}${n?"!":"="}`}${e.map(o).join("|")})`,Quantifier:(e,t,n)=>n(e.body)+function({kind:e,max:t,min:n}){let r;r=n||1!==t?n||t!==1/0?1===n&&t===1/0?"+":n===t?`{${n}}`:`{${n},${t===1/0?"":t}}`:"*":"?";return r+{greedy:"",lazy:"?",possessive:"+"}[e]}(e),Subroutine({isRecursive:e,ref:t},n){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");const r=n.recursionLimit;return 0===t?`(?R=${r})`:ii`\g<${t}&R=${r}>`}},qi=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),Vi=new Set(["-","\\","]","^","["]),Xi=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),Ki=new Map([[9,ii`\t`],[10,ii`\n`],[11,ii`\v`],[12,ii`\f`],[13,ii`\r`],[8232,ii`\u2028`],[8233,ii`\u2029`],[65279,ii`\uFEFF`]]),Zi=/^\p{Cased}$/u;function Qi(e){return Zi.test(e)}function Yi(e,t){const n=!!t?.firstOnly,r=e.min.value,o=e.max.value,s=[];if(r<65&&(65535===o||o>=131071)||65536===r&&o>=131071)return s;for(let e=r;e<=o;e++){const t=si(e);if(!Qi(t))continue;const i=yi(t).filter(e=>{const t=e.codePointAt(0);return t<r||t>o});if(i.length&&(s.push(...i),n))break}return s}function Ji(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(Ki.has(e))return Ki.get(e);if(e<32||e>126&&e<160||e>262143||t&&((o=e)>47&&o<58))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;var o;const s=n?r?Xi:Vi:qi,i=si(e);return(s.has(i)?"\\":"")+i}function ea({type:e}){return"CapturingGroup"===e||"Group"===e||"LookaroundAssertion"===e}function ta({type:e,value:t}){return"Character"===e&&45===t}var na=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#o=null;rawOptions={};get source(){return this.#n||"(?:)"}constructor(t,n,r){const o=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw new Error("Cannot provide options when copying a regexp");const o=t;super(o,n),this.#n=o.source,o instanceof e&&(this.#e=o.#e,this.#r=o.#r,this.#o=o.#o,this.rawOptions=o.rawOptions)}else{const e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(o?"":t,n),this.#n=t,this.#e=function(e,t){const n=new Map;for(const t of e)n.set(t,{hidden:!0});for(const[e,r]of t)for(const t of r)ui(n,t,{}).transferTo=e;return n}(e.hiddenCaptures,e.transfers),this.#o=e.strategy,this.rawOptions=r??{}}o||(this.#t=this)}exec(t){if(!this.#t){const{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}const n=this.global||this.sticky,r=this.lastIndex;if("clip_search"===this.#o&&n&&r){this.lastIndex=0;const e=this.#s(t.slice(r));return e&&(!function(e,t,n,r){if(e.index+=t,e.input=n,r){const n=e.indices;for(let e=0;e<n.length;e++){const r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}const r=n.groups;r&&Object.keys(r).forEach(e=>{const n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#s(t)}#s(e){this.#t.lastIndex=this.lastIndex;const t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;const n=[...t];let r;t.length=1,this.hasIndices&&(r=[...t.indices],t.indices.length=1);const o=[0];for(let e=1;e<n.length;e++){const{hidden:s,transferTo:i}=this.#e.get(e)??{};if(s?o.push(null):(o.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),i&&void 0!==n[e]){const s=o[i];if(!s)throw new Error(`Invalid capture transfer to "${s}"`);if(t[s]=n[e],this.hasIndices&&(t.indices[s]=r[e]),t.groups){this.#r||(this.#r=ra(this.source));const o=this.#r.get(i);o&&(t.groups[o]=n[e],this.hasIndices&&(t.indices.groups[o]=r[e]))}}}return t}};function ra(e){const t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let r,o=0,s=0;for(;r=t.exec(e);){const{0:e,groups:{capture:t,name:i}}=r;"["===e?o++:o?"]"===e&&o--:t&&(s++,i&&n.set(s,i))}return n}function oa(e,t){const n=function(e,t){const n=gi(t),r=cs(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:bi}),o=function(e,t){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t};Ni(e);const r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:hi(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};Ls(e,Ai,r);const o={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},s={currentFlags:o,prevFlags:null,globalFlags:o,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return Ls(e,$i,s),Ls(e,Ei,{groupsByName:s.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:s.reffedNodesByReferencer}),e._originMap=s.groupOriginByCopy,e._strategy=r.strategy,e}(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),s=Wi(o,n),i=function(e,t){const{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:"plugin",...t};let o=t?.captureTransfers??new Map;if(!new RegExp(Ks,"su").test(e))return{pattern:e,captureTransfers:o,hiddenCaptures:n};if("plugin"===r&&js(e,Vs`\(\?\(DEFINE\)`,Gs.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const s=[],i=js(e,Vs`\\[1-9]`,Gs.DEFAULT),a=new Map,l=[];let c,u=!1,h=0,p=0;for(Ys.lastIndex=0;c=Ys.exec(e);){const{0:t,groups:{captureName:d,rDepth:g,gRNameOrNum:f,gRDepth:m}}=c;if("["===t)h++;else if(h)"]"===t&&h--;else{if(g){if(ei(g),u)throw new Error(Js);if(i)throw new Error(("external"===r?"Backrefs":"Numbered backrefs")+" cannot be used with global recursion");const t=e.slice(0,c.index),a=e.slice(Ys.lastIndex);if(js(a,Ks,Gs.DEFAULT))throw new Error(Js);const l=+g-1;e=ti(t,a,l,!1,n,s,p),o=oi(o,t,l,s.length,0,p);break}if(f){ei(m);let h=!1;for(const e of l)if(e.name===f||e.num===+f){if(h=!0,e.hasRecursedWithin)throw new Error(Js);break}if(!h)throw new Error(Vs`Recursive \g cannot be used outside the referenced group "${"external"===r?f:Vs`\g<${f}&R=${m}>`}"`);const d=a.get(f),g=Ws(e,d);if(i&&js(g,Vs`${Zs}|\((?!\?)`,Gs.DEFAULT))throw new Error(("external"===r?"Backrefs":"Numbered backrefs")+" cannot be used with recursion of capturing groups");const y=e.slice(d,c.index),b=g.slice(y.length+t.length),_=s.length,w=+m-1,k=ti(y,b,w,!0,n,s,p);o=oi(o,y,w,s.length-_,_,p);const v=e.slice(0,d),C=e.slice(d+g.length);e=`${v}${k}${C}`,Ys.lastIndex+=k.length-t.length-y.length-b.length,l.forEach(e=>e.hasRecursedWithin=!0),u=!0}else if(d)p++,a.set(String(p),Ys.lastIndex),a.set(d,Ys.lastIndex),l.push({num:p,name:d});else if("("===t[0]){const e="("===t;e&&(p++,a.set(String(p),Ys.lastIndex)),l.push(e?{num:p}:{})}else")"===t&&l.pop()}}return n.push(...s),{pattern:e,captureTransfers:o,hiddenCaptures:n}}(s.pattern,{captureTransfers:s._captureTransfers,hiddenCaptures:s._hiddenCaptures,mode:"external"}),a=function(e,t){const n=t?.hiddenCaptures??[];let r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};const o="(?:(?=(",s=[0],i=[];let a,l=0,c=0,u=NaN;do{a=!1;let t,h=0,p=0,d=!1;for(zs.lastIndex=Number.isNaN(u)?0:u+7;t=zs.exec(e);){const{0:g,index:f,groups:{capturingStart:m,noncapturingStart:y}}=t;if("["===g)h++;else if(h)"]"===g&&h--;else if("(?>"!==g||d){if(d&&y)p++;else if(m)d?p++:(l++,s.push(l+c));else if(")"===g&&d){if(!p){c++;const t=l+c;if(e=`${e.slice(0,u)}${o}${e.slice(u+3,f)}))<$$${t}>)${e.slice(f+1)}`,a=!0,i.push(t),Bs(n,t),r.size){const e=new Map;r.forEach((n,r)=>{e.set(r>=t?r+1:r,n.map(e=>e>=t?e+1:e))}),r=e}break}p--}}else u=f,d=!0}}while(a);return n.push(...i),e=Us(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){const n=+t;if(n>s.length-1)throw new Error(`Backref "${e}" greater than number of captures`);return`\\${s[n]}`}return`\\${n}`},Gs.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}(function(e){if(!new RegExp(`${Hs}\\+`).test(e))return{pattern:e};const t=[];let n,r=null,o=null,s="",i=0;for(qs.lastIndex=0;n=qs.exec(e);){const{0:a,index:l,groups:{qBase:c,qMod:u,invalidQ:h}}=n;if("["===a)i||(o=l),i++;else if("]"===a)i?i--:o=null;else if(!i)if("+"===u&&s&&!s.startsWith("(")){if(h)throw new Error(`Invalid quantifier "${a}"`);let t=-1;if(/^\{\d+\}$/.test(c))e=Ds(e,l+c.length,u,"");else{if(")"===s||"]"===s){const t=")"===s?r:o;if(null===t)throw new Error(`Invalid unmatched "${s}"`);e=`${e.slice(0,t)}(?>${e.slice(t,l)}${c})${e.slice(l+a.length)}`}else e=`${e.slice(0,l-s.length)}(?>${s}${c})${e.slice(l+a.length)}`;t+=4}qs.lastIndex+=t}else"("===a[0]?t.push(l):")"===a&&(r=t.length?t.pop():null);s=a}return{pattern:e}}(i.pattern).pattern,{captureTransfers:i.captureTransfers,hiddenCaptures:i.hiddenCaptures}),l={pattern:a.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${s.flags}${s.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const e=a.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(a.captureTransfers),r=o._strategy,s=l.pattern.length>=n.lazyCompileLength;(e.length||t.length||r||s)&&(l.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...r&&{strategy:r},...s&&{lazyCompile:s}})}return l}(e,t);return n.options?new na(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function sa(e={}){const t={target:"auto",cache:new Map,...e};return t.regexConstructor||=e=>function(e,t){return oa(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}(e,{target:t.target}),{createScanner:e=>new $o(e,t),createString:No}}const ia="tp-code",aa=function(e={}){const{name:t="css-variables",variablePrefix:n="--shiki-",fontStyle:r=!0}=e,o=t=>e.variableDefaults?.[t]?`var(${n}${t}, ${e.variableDefaults[t]})`:`var(${n}${t})`,s={name:t,type:"dark",colors:{"editor.foreground":o("foreground"),"editor.background":o("background"),"terminal.ansiBlack":o("ansi-black"),"terminal.ansiRed":o("ansi-red"),"terminal.ansiGreen":o("ansi-green"),"terminal.ansiYellow":o("ansi-yellow"),"terminal.ansiBlue":o("ansi-blue"),"terminal.ansiMagenta":o("ansi-magenta"),"terminal.ansiCyan":o("ansi-cyan"),"terminal.ansiWhite":o("ansi-white"),"terminal.ansiBrightBlack":o("ansi-bright-black"),"terminal.ansiBrightRed":o("ansi-bright-red"),"terminal.ansiBrightGreen":o("ansi-bright-green"),"terminal.ansiBrightYellow":o("ansi-bright-yellow"),"terminal.ansiBrightBlue":o("ansi-bright-blue"),"terminal.ansiBrightMagenta":o("ansi-bright-magenta"),"terminal.ansiBrightCyan":o("ansi-bright-cyan"),"terminal.ansiBrightWhite":o("ansi-bright-white")},tokenColors:[{scope:["keyword.operator.accessor","meta.group.braces.round.function.arguments","meta.template.expression","markup.fenced_code meta.embedded.block"],settings:{foreground:o("foreground")}},{scope:"emphasis",settings:{fontStyle:"italic"}},{scope:["strong","markup.heading.markdown","markup.bold.markdown"],settings:{fontStyle:"bold"}},{scope:["markup.italic.markdown"],settings:{fontStyle:"italic"}},{scope:"meta.link.inline.markdown",settings:{fontStyle:"underline",foreground:o("token-link")}},{scope:["string","markup.fenced_code","markup.inline"],settings:{foreground:o("token-string")}},{scope:["comment","string.quoted.docstring.multi"],settings:{foreground:o("token-comment")}},{scope:["constant.numeric","constant.language","constant.other.placeholder","constant.character.format.placeholder","variable.language.this","variable.other.object","variable.other.class","variable.other.constant","meta.property-name","meta.property-value","support"],settings:{foreground:o("token-constant")}},{scope:["keyword","storage.modifier","storage.type","storage.control.clojure","entity.name.function.clojure","entity.name.tag.yaml","support.function.node","support.type.property-name.json","punctuation.separator.key-value","punctuation.definition.template-expression"],settings:{foreground:o("token-keyword")}},{scope:"variable.parameter.function",settings:{foreground:o("token-parameter")}},{scope:["support.function","entity.name.type","entity.other.inherited-class","meta.function-call","meta.instance.constructor","entity.other.attribute-name","entity.name.function","constant.keyword.clojure"],settings:{foreground:o("token-function")}},{scope:["entity.name.tag","string.quoted","string.regexp","string.interpolated","string.template","string.unquoted.plain.out.yaml","keyword.other.template"],settings:{foreground:o("token-string-expression")}},{scope:["punctuation.definition.arguments","punctuation.definition.dict","punctuation.separator","meta.function-call.arguments"],settings:{foreground:o("token-punctuation")}},{scope:["markup.underline.link","punctuation.definition.metadata.markdown"],settings:{foreground:o("token-link")}},{scope:["beginning.punctuation.definition.list.markdown"],settings:{foreground:o("token-string")}},{scope:["punctuation.definition.string.begin.markdown","punctuation.definition.string.end.markdown","string.other.link.title.markdown","string.other.link.description.markdown"],settings:{foreground:o("token-keyword")}},{scope:["markup.inserted","meta.diff.header.to-file","punctuation.definition.inserted"],settings:{foreground:o("token-inserted")}},{scope:["markup.deleted","meta.diff.header.from-file","punctuation.definition.deleted"],settings:{foreground:o("token-deleted")}},{scope:["markup.changed","punctuation.definition.changed"],settings:{foreground:o("token-changed")}}]};return r||(s.tokenColors=s.tokenColors?.map(e=>(e.settings?.fontStyle&&delete e.settings.fontStyle,e))),s}({name:ia,variablePrefix:"--_tp-code-",fontStyle:!0});let la=async()=>{};function ca(e){la=e}const ua=new Set(["","text","txt","plain","plaintext"]);let ha;const pa=new Map,da=new Set;function ga(){return ha??=So({themes:[aa],langs:[],engine:sa({forgiving:!0})})}function fa(e){const t=function(e){return(e??"").trim().toLowerCase()}(e);if(ua.has(t))return Promise.resolve(void 0);let n=pa.get(t);return n||(n=async function(e){try{const t=await la(e);if(t?.length){const e=await ga();return await e.loadLanguage(...t),t[t.length-1].name}}catch{}return void function(e){if(da.has(e))return;da.add(e),console.warn(`[tp-code] Unknown or unavailable language "${e}"; rendering as plain text.`)}(e)}(t),pa.set(t,n)),n}function ma(e,t){const n=e.replace(/\r\n?/g,"\n");return"block"===t?function(e){const t=e.split("\n");for(;t.length&&ya(t[0]);)t.shift();for(;t.length&&ya(t[t.length-1]);)t.pop();const n=t.filter(e=>!ya(e)).reduce((e,t)=>Math.min(e,t.match(/^[ \t]*/)[0].length),1/0);return Number.isFinite(n)&&0!==n?t.map(e=>e.slice(Math.min(n,e.length))).join("\n"):t.join("\n")}(n):n.trim()}function ya(e){return""===e.trim()}const ba=[d`
|
|
81
|
+
:host {
|
|
82
|
+
--_tp-code-foreground: var(--tp-code-foreground, var(--tp-color-contrast, hsl(0 0% 12%)));
|
|
83
|
+
--_tp-code-background: var(--tp-code-background, color-mix(in oklab, var(--_tp-code-foreground) 6%, transparent));
|
|
84
|
+
--_tp-code-accent-strength: var(--tp-code-accent-strength, 80%);
|
|
85
|
+
|
|
86
|
+
--_tp-code-primary: var(--tp-color-primary, hsl(220 90% 56%));
|
|
87
|
+
--_tp-code-secondary: var(--tp-color-secondary, hsl(340 82% 52%));
|
|
88
|
+
--_tp-code-success: var(--tp-color-success, hsl(140 70% 40%));
|
|
89
|
+
--_tp-code-danger: var(--tp-color-danger, hsl(0 70% 50%));
|
|
90
|
+
--_tp-code-warning: var(--tp-color-warning, hsl(45 100% 50%));
|
|
91
|
+
|
|
92
|
+
--_tp-code-token-keyword: var(--tp-code-token-keyword, color-mix(in oklab, var(--_tp-code-secondary) var(--_tp-code-accent-strength), var(--_tp-code-foreground)));
|
|
93
|
+
--_tp-code-token-function: var(--tp-code-token-function, color-mix(in oklab, var(--_tp-code-primary) var(--_tp-code-accent-strength), var(--_tp-code-foreground)));
|
|
94
|
+
--_tp-code-token-constant: var(--tp-code-token-constant, color-mix(in oklab, color-mix(in oklab, var(--_tp-code-primary), var(--_tp-code-secondary)) var(--_tp-code-accent-strength), var(--_tp-code-foreground)));
|
|
95
|
+
--_tp-code-token-string: var(--tp-code-token-string, color-mix(in oklab, var(--_tp-code-success) var(--_tp-code-accent-strength), var(--_tp-code-foreground)));
|
|
96
|
+
--_tp-code-token-string-expression: var(--tp-code-token-string-expression, color-mix(in oklab, var(--_tp-code-success) 60%, var(--_tp-code-foreground)));
|
|
97
|
+
--_tp-code-token-parameter: var(--tp-code-token-parameter, color-mix(in oklab, var(--_tp-code-warning) 55%, var(--_tp-code-foreground)));
|
|
98
|
+
--_tp-code-token-comment: var(--tp-code-token-comment, color-mix(in oklab, var(--_tp-code-foreground) 55%, transparent));
|
|
99
|
+
--_tp-code-token-punctuation: var(--tp-code-token-punctuation, color-mix(in oklab, var(--_tp-code-foreground) 75%, transparent));
|
|
100
|
+
--_tp-code-token-link: var(--tp-code-token-link, var(--_tp-code-token-function));
|
|
101
|
+
--_tp-code-token-inserted: var(--tp-code-token-inserted, var(--_tp-code-token-string));
|
|
102
|
+
--_tp-code-token-deleted: var(--tp-code-token-deleted, color-mix(in oklab, var(--_tp-code-danger) var(--_tp-code-accent-strength), var(--_tp-code-foreground)));
|
|
103
|
+
--_tp-code-token-changed: var(--tp-code-token-changed, var(--_tp-code-token-parameter));
|
|
104
|
+
|
|
105
|
+
--_tp-code-ansi-black: var(--tp-code-ansi-black, hsl(0 0% 20%));
|
|
106
|
+
--_tp-code-ansi-red: var(--tp-code-ansi-red, var(--_tp-code-danger));
|
|
107
|
+
--_tp-code-ansi-green: var(--tp-code-ansi-green, var(--_tp-code-success));
|
|
108
|
+
--_tp-code-ansi-yellow: var(--tp-code-ansi-yellow, var(--_tp-code-warning));
|
|
109
|
+
--_tp-code-ansi-blue: var(--tp-code-ansi-blue, var(--_tp-code-primary));
|
|
110
|
+
--_tp-code-ansi-magenta: var(--tp-code-ansi-magenta, var(--_tp-code-secondary));
|
|
111
|
+
--_tp-code-ansi-cyan: var(--tp-code-ansi-cyan, hsl(185 70% 40%));
|
|
112
|
+
--_tp-code-ansi-white: var(--tp-code-ansi-white, hsl(0 0% 85%));
|
|
113
|
+
--_tp-code-ansi-bright-black: var(--tp-code-ansi-bright-black, hsl(0 0% 45%));
|
|
114
|
+
--_tp-code-ansi-bright-red: var(--tp-code-ansi-bright-red, color-mix(in oklab, var(--_tp-code-ansi-red) 70%, white));
|
|
115
|
+
--_tp-code-ansi-bright-green: var(--tp-code-ansi-bright-green, color-mix(in oklab, var(--_tp-code-ansi-green) 70%, white));
|
|
116
|
+
--_tp-code-ansi-bright-yellow: var(--tp-code-ansi-bright-yellow, color-mix(in oklab, var(--_tp-code-ansi-yellow) 70%, white));
|
|
117
|
+
--_tp-code-ansi-bright-blue: var(--tp-code-ansi-bright-blue, color-mix(in oklab, var(--_tp-code-ansi-blue) 70%, white));
|
|
118
|
+
--_tp-code-ansi-bright-magenta: var(--tp-code-ansi-bright-magenta, color-mix(in oklab, var(--_tp-code-ansi-magenta) 70%, white));
|
|
119
|
+
--_tp-code-ansi-bright-cyan: var(--tp-code-ansi-bright-cyan, color-mix(in oklab, var(--_tp-code-ansi-cyan) 70%, white));
|
|
120
|
+
--_tp-code-ansi-bright-white: var(--tp-code-ansi-bright-white, white);
|
|
121
|
+
|
|
122
|
+
--_tp-code-line-number-color: var(--tp-code-line-number-color, color-mix(in oklab, var(--_tp-code-foreground) 40%, transparent));
|
|
123
|
+
--_tp-code-line-highlight-background: var(--tp-code-line-highlight-background, color-mix(in oklab, var(--_tp-code-primary) 14%, transparent));
|
|
124
|
+
--_tp-code-line-highlight-border-color: var(--tp-code-line-highlight-border-color, var(--_tp-code-primary));
|
|
125
|
+
}
|
|
126
|
+
`,d`
|
|
127
|
+
:host {
|
|
128
|
+
display: inline;
|
|
129
|
+
color: var(--_tp-code-foreground);
|
|
130
|
+
font-family: var(--tp-code-font-family, ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace);
|
|
131
|
+
font-size: var(--tp-code-font-size, 0.875em);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
:host([variant="block"]) {
|
|
135
|
+
display: block;
|
|
136
|
+
position: relative;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
:host([hidden]) {
|
|
140
|
+
display: none;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
code {
|
|
144
|
+
font: inherit;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.inline {
|
|
148
|
+
padding: var(--tp-code-inline-padding, 0.1em 0.35em);
|
|
149
|
+
border-radius: var(--tp-code-radius, 0.3em);
|
|
150
|
+
background: var(--_tp-code-background);
|
|
151
|
+
white-space: pre-wrap;
|
|
152
|
+
overflow-wrap: anywhere;
|
|
153
|
+
-webkit-box-decoration-break: clone;
|
|
154
|
+
box-decoration-break: clone;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.block {
|
|
158
|
+
margin: 0;
|
|
159
|
+
padding-block: var(--tp-code-padding-block, 1em);
|
|
160
|
+
border-radius: var(--tp-code-radius, 0.5em);
|
|
161
|
+
background: var(--_tp-code-background);
|
|
162
|
+
overflow: auto;
|
|
163
|
+
/* The font shorthand comes first: it would otherwise reset line-height. */
|
|
164
|
+
font: inherit;
|
|
165
|
+
line-height: var(--tp-code-line-height, 1.6);
|
|
166
|
+
tab-size: var(--tp-code-tab-size, 2);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/* Grid + max-content: every line is as wide as the longest one, so line
|
|
170
|
+
highlights span the full scroll width. */
|
|
171
|
+
.block code {
|
|
172
|
+
display: grid;
|
|
173
|
+
min-width: max-content;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.line {
|
|
177
|
+
display: block;
|
|
178
|
+
min-block-size: 1lh;
|
|
179
|
+
padding-inline: var(--tp-code-padding-inline, 1em);
|
|
180
|
+
white-space: pre;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/* Line numbers come from a CSS counter on ::before, so they never end up in
|
|
184
|
+
selected/copied text. */
|
|
185
|
+
.numbered .line {
|
|
186
|
+
counter-increment: tp-code-line;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.numbered .line::before {
|
|
190
|
+
content: counter(tp-code-line);
|
|
191
|
+
display: inline-block;
|
|
192
|
+
min-inline-size: var(--_tp-code-gutter, 2ch);
|
|
193
|
+
margin-inline-end: var(--tp-code-line-number-gap, 1.5em);
|
|
194
|
+
color: var(--_tp-code-line-number-color);
|
|
195
|
+
text-align: end;
|
|
196
|
+
user-select: none;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.line[data-highlighted] {
|
|
200
|
+
background: var(--_tp-code-line-highlight-background);
|
|
201
|
+
box-shadow: inset 3px 0 0 var(--_tp-code-line-highlight-border-color);
|
|
202
|
+
}
|
|
203
|
+
`,d`
|
|
204
|
+
.copy {
|
|
205
|
+
position: absolute;
|
|
206
|
+
inset-block-start: 0.5em;
|
|
207
|
+
inset-inline-end: 0.5em;
|
|
208
|
+
display: inline-flex;
|
|
209
|
+
align-items: center;
|
|
210
|
+
justify-content: center;
|
|
211
|
+
inline-size: 2.25em;
|
|
212
|
+
block-size: 2.25em;
|
|
213
|
+
padding: 0;
|
|
214
|
+
border: 1px solid color-mix(in oklab, var(--_tp-code-foreground) 18%, transparent);
|
|
215
|
+
border-radius: 0.4em;
|
|
216
|
+
background: var(--tp-code-copy-background, Canvas);
|
|
217
|
+
color: var(--tp-code-copy-color, var(--_tp-code-foreground));
|
|
218
|
+
font: inherit;
|
|
219
|
+
cursor: pointer;
|
|
220
|
+
opacity: 0;
|
|
221
|
+
transition: opacity 120ms ease;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
:host(:hover) .copy,
|
|
225
|
+
.copy:focus-visible,
|
|
226
|
+
.copy[data-copied] {
|
|
227
|
+
opacity: 1;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
@media (hover: none) {
|
|
231
|
+
.copy {
|
|
232
|
+
opacity: 1;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.copy[data-copied] {
|
|
237
|
+
color: var(--tp-code-copy-success-color, var(--_tp-code-success));
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.copy svg {
|
|
241
|
+
inline-size: 1.15em;
|
|
242
|
+
block-size: 1.15em;
|
|
243
|
+
}
|
|
244
|
+
`];function _a(e){return"string"==typeof e?e:e.map(e=>Z`<span style=${function(e){const t=e.color?[`color:${e.color}`]:[],n=e.fontStyle??0;if(n>0){1&n&&t.push("font-style:italic"),2&n&&t.push("font-weight:bold");const e=[4&n?"underline":"",8&n?"line-through":""].filter(Boolean);e.length&&t.push(`text-decoration:${e.join(" ")}`)}return t.join(";")}(e)}>${e.content}</span>`)}function wa(e){const{lines:t,lineNumbers:n,lineStart:r,highlightedLines:o}=e,s=r+t.length-1,i=Math.max(String(r).length,String(s).length),a=`counter-reset:tp-code-line ${r-1};--_tp-code-gutter:${i}ch`,l=t.map((e,t)=>{const n=function(e,t){return e.some(([e,n])=>t>=e&&t<=n)}(o,r+t);return Z`<span part=${n?"line highlighted-line":"line"} class="line" ?data-highlighted=${n}>${_a(e)}</span>`});return Z`<pre part="pre" class=${n?"block numbered":"block"}><code part="code" style=${a}>${l}</code></pre>${e.copyable?(c=e.copied,u=e.onCopy,Z`
|
|
245
|
+
<button
|
|
246
|
+
part="copy-button"
|
|
247
|
+
class="copy"
|
|
248
|
+
type="button"
|
|
249
|
+
aria-label=${c?"Copied":"Copy code"}
|
|
250
|
+
title=${c?"Copied":"Copy code"}
|
|
251
|
+
?data-copied=${c}
|
|
252
|
+
@click=${u}
|
|
253
|
+
>
|
|
254
|
+
<svg viewBox="0 0 24 24" aria-hidden="true">${c?va:ka}</svg>
|
|
255
|
+
</button>
|
|
256
|
+
`):J}`;var c,u}const ka=Q`<path d="M9 9h10v10H9z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/><path d="M5 15V5h10" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" stroke-linecap="round"/>`,va=Q`<path d="M5 12.5l4.5 4.5L19 7.5" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" stroke-linecap="round"/>`;class Ca extends ge{constructor(){super(...arguments),this.variant="inline",this.language="",this.lineNumbers=!1,this.lineStart=1,this.highlightLines="",this.copyable=!1,this.rawSource="",this.copied=!1,this.#i="",this.#a=[],this.#l=0,this.#c=Promise.resolve()}static{this.styles=ba}#i;#a;#u;#l;#c;#h;get source(){return this.#i}get highlightComplete(){return this.#c}connectedCallback(){super.connectedCallback(),this.#u??=new MutationObserver(()=>this.#p()),this.#u.observe(this,{childList:!0,characterData:!0,subtree:!0}),this.#p()}disconnectedCallback(){super.disconnectedCallback(),this.#u?.disconnect(),clearTimeout(this.#h),this.copied=!1}willUpdate(e){if(e.has("code")&&this.#p(),e.has("highlightLines")&&(this.#a=function(e){if(!e)return[];const t=[];for(const n of e.split(",")){const e=n.trim().match(/^(\d+)(?:\s*-\s*(\d+))?$/);if(!e)continue;const r=Number(e[1]),o=void 0===e[2]?r:Number(e[2]);t.push([Math.min(r,o),Math.max(r,o)])}return t}(this.highlightLines)),e.has("rawSource")||e.has("variant")){const e=ma(this.rawSource,this.variant);if(e!==this.#i)return this.#i=e,void this.#d()}e.has("language")&&this.#d()}render(){const e=this.tokens??this.#i.split("\n");return"block"!==this.variant?function(e){return Z`<code part="code" class="inline">${
|
|
257
|
+
/**
|
|
258
|
+
* @license
|
|
259
|
+
* Copyright 2021 Google LLC
|
|
260
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
261
|
+
*/
|
|
262
|
+
function*(e,t){if(void 0!==e){let n=-1;for(const r of e)n>-1&&(yield t),n++,yield r}}(e.map(_a),"\n")}</code>`}(e):wa({lines:e,lineNumbers:this.lineNumbers,lineStart:Number.isFinite(this.lineStart)?Math.trunc(this.lineStart):1,highlightedLines:this.#a,copyable:this.copyable,copied:this.copied,onCopy:()=>{this.copy()}})}async copy(){const e=this.#i,t=await we(e);return clearTimeout(this.#h),this.copied=t,t&&(this.#h=setTimeout(()=>this.copied=!1,2e3)),this.dispatchEvent(new CustomEvent("tp-code-copy",{bubbles:!0,composed:!0,detail:{code:e,success:t}})),t}#p(){this.rawSource=this.code??function(e){const t=e.querySelector(":scope > template");return t?t.innerHTML:e.textContent??""}(this)}#d(){const e=++this.#l,t=this.#i,n=this.language;this.tokens=void 0,this.#c=async function(e,t){const n=await fa(t);if(!n)return;return(await ga()).codeToTokens(e,{lang:n,theme:ia}).tokens}(t,n).then(async t=>{e===this.#l&&(this.tokens=t,await this.updateComplete,this.dispatchEvent(new CustomEvent("tp-code-highlight",{bubbles:!0,composed:!0,detail:{language:n,highlighted:!!t}})))})}}i([be({reflect:!0}),a("design:type",String)],Ca.prototype,"variant",void 0),i([be({reflect:!0}),a("design:type",Object)],Ca.prototype,"language",void 0),i([be({type:Boolean,reflect:!0,attribute:"line-numbers"}),a("design:type",Object)],Ca.prototype,"lineNumbers",void 0),i([be({type:Number,attribute:"line-start"}),a("design:type",Object)],Ca.prototype,"lineStart",void 0),i([be({attribute:"highlight-lines"}),a("design:type",Object)],Ca.prototype,"highlightLines",void 0),i([be({type:Boolean,reflect:!0}),a("design:type",Object)],Ca.prototype,"copyable",void 0),i([be({attribute:!1}),a("design:type",String)],Ca.prototype,"code",void 0),i([_e(),a("design:type",Object)],Ca.prototype,"rawSource",void 0),i([_e(),a("design:type",Array)],Ca.prototype,"tokens",void 0),i([_e(),a("design:type",Object)],Ca.prototype,"copied",void 0),ca(async e=>{if(!r.test(e))return;return(await import(s(e))).default}),customElements.get("tp-code")||customElements.define("tp-code",Ca),e.CodeElement=Ca,e.SHIKI_LANGS_VERSION=t,e.languageCdnUrl=s,e.setLanguageCdnBaseUrl=function(e=n){o=e.endsWith("/")?e:`${e}/`},e.setLanguageLoader=ca}(this.TelperionElements.Code=this.TelperionElements.Code||{});
|
|
263
|
+
//# sourceMappingURL=cdn.js.map
|