@jyork0828/pi-pilot 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1850 -207
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/public/assets/ArtifactsPanel-DUiRwx7S.js +1 -0
- package/public/assets/ResourcesPanel-Cn_gw159.js +19 -0
- package/public/assets/SessionTree-CBIw_kzf.js +16 -0
- package/public/assets/SettingsPage-cULKjgtu.js +51 -0
- package/public/assets/index-CX2ohSDO.js +238 -0
- package/public/assets/index-CyoTMDCN.css +1 -0
- package/public/assets/markdown-CY-Rm0E5.js +45 -0
- package/public/assets/shiki-BZ0sbaMe.js +152 -0
- package/public/index.html +12 -3
- package/public/assets/index-CsC5-YPT.js +0 -506
- package/public/assets/index-R8FKUxOS.css +0 -1
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
var Ur=Object.defineProperty;var Wr=Object.getPrototypeOf;var zr=Reflect.get;var Zt=t=>{throw TypeError(t)};var qr=(t,e,n)=>e in t?Ur(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var g=(t,e,n)=>qr(t,typeof e!="symbol"?e+"":e,n),ut=(t,e,n)=>e.has(t)||Zt("Cannot "+n);var T=(t,e,n)=>(ut(t,e,"read from private field"),n?n.call(t):e.get(t)),oe=(t,e,n)=>e.has(t)?Zt("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),j=(t,e,n,r)=>(ut(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),ht=(t,e,n)=>(ut(t,e,"access private method"),n);var Jt=(t,e,n)=>zr(Wr(t),n,e);import{w as Dt,d as Dn,f as Hr,s as Vr,b as Xr,c as Yt,z as Qr,h as Kr}from"./markdown-CY-Rm0E5.js";const Zr="modulepreload",Jr=function(t){return"/"+t},en={},Cc=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const i=document.querySelector("meta[property=csp-nonce]"),a=(i==null?void 0:i.nonce)||(i==null?void 0:i.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=Jr(c),c in en)return;en[c]=!0;const l=c.endsWith(".css"),h=l?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${h}`))return;const u=document.createElement("link");if(u.rel=l?"stylesheet":Zr,l||(u.as="script"),u.crossOrigin="",u.href=c,a&&u.setAttribute("nonce",a),document.head.appendChild(u),l)return new Promise((f,d)=>{u.addEventListener("load",f),u.addEventListener("error",()=>d(new Error(`Unable to preload CSS for ${c}`)))})}))}function o(i){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=i,window.dispatchEvent(a),!a.defaultPrevented)throw i}return s.then(i=>{for(const a of i||[])a.status==="rejected"&&o(a.reason);return e().catch(o)})};var A=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function Yr(t){return jt(t)}function jt(t){return Array.isArray(t)?es(t):t instanceof RegExp?t:typeof t=="object"?ts(t):t}function es(t){let e=[];for(let n=0,r=t.length;n<r;n++)e[n]=jt(t[n]);return e}function ts(t){let e={};for(let n in t)e[n]=jt(t[n]);return e}function jn(t,...e){return e.forEach(n=>{for(let r in n)t[r]=n[r]}),t}function Un(t){const e=~t.lastIndexOf("/")||~t.lastIndexOf("\\");return e===0?t:~e===t.length-1?Un(t.substring(0,t.length-1)):t.substr(~e+1)}var ft=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Te=class{static hasCaptures(t){return t===null?!1:(ft.lastIndex=0,ft.test(t))}static replaceCaptures(t,e,n){return t.replace(ft,(r,s,o,i)=>{let a=n[parseInt(s||o,10)];if(a){let c=e.substring(a.start,a.end);for(;c[0]===".";)c=c.substring(1);switch(i){case"downcase":return c.toLowerCase();case"upcase":return c.toUpperCase();default:return c}}else return r})}};function Wn(t,e){return t<e?-1:t>e?1:0}function zn(t,e){if(t===null&&e===null)return 0;if(!t)return-1;if(!e)return 1;let n=t.length,r=e.length;if(n===r){for(let s=0;s<n;s++){let o=Wn(t[s],e[s]);if(o!==0)return o}return 0}return n-r}function tn(t){return!!(/^#[0-9a-f]{6}$/i.test(t)||/^#[0-9a-f]{8}$/i.test(t)||/^#[0-9a-f]{3}$/i.test(t)||/^#[0-9a-f]{4}$/i.test(t))}function qn(t){return t.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Hn=class{constructor(t){g(this,"cache",new Map);this.fn=t}get(t){if(this.cache.has(t))return this.cache.get(t);const e=this.fn(t);return this.cache.set(t,e),e}},We=class{constructor(t,e,n){g(this,"_cachedMatchRoot",new Hn(t=>this._root.match(t)));this._colorMap=t,this._defaults=e,this._root=n}static createFromRawTheme(t,e){return this.createFromParsedTheme(ss(t),e)}static createFromParsedTheme(t,e){return is(t,e)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(t){if(t===null)return this._defaults;const e=t.scopeName,r=this._cachedMatchRoot.get(e).find(s=>ns(t.parent,s.parentScopes));return r?new Vn(r.fontStyle,r.foreground,r.background):null}},dt=class De{constructor(e,n){this.parent=e,this.scopeName=n}static push(e,n){for(const r of n)e=new De(e,r);return e}static from(...e){let n=null;for(let r=0;r<e.length;r++)n=new De(n,e[r]);return n}push(e){return new De(this,e)}getSegments(){let e=this;const n=[];for(;e;)n.push(e.scopeName),e=e.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){const n=[];let r=this;for(;r&&r!==e;)n.push(r.scopeName),r=r.parent;return r===e?n.reverse():void 0}};function ns(t,e){if(e.length===0)return!0;for(let n=0;n<e.length;n++){let r=e[n],s=!1;if(r===">"){if(n===e.length-1)return!1;r=e[++n],s=!0}for(;t&&!rs(t.scopeName,r);){if(s)return!1;t=t.parent}if(!t)return!1;t=t.parent}return!0}function rs(t,e){return e===t||t.startsWith(e)&&t[e.length]==="."}var Vn=class{constructor(t,e,n){this.fontStyle=t,this.foregroundId=e,this.backgroundId=n}};function ss(t){if(!t)return[];if(!t.settings||!Array.isArray(t.settings))return[];let e=t.settings,n=[],r=0;for(let s=0,o=e.length;s<o;s++){let i=e[s];if(!i.settings)continue;let a;if(typeof i.scope=="string"){let u=i.scope;u=u.replace(/^[,]+/,""),u=u.replace(/[,]+$/,""),a=u.split(",")}else Array.isArray(i.scope)?a=i.scope:a=[""];let c=-1;if(typeof i.settings.fontStyle=="string"){c=0;let u=i.settings.fontStyle.split(" ");for(let f=0,d=u.length;f<d;f++)switch(u[f]){case"italic":c=c|1;break;case"bold":c=c|2;break;case"underline":c=c|4;break;case"strikethrough":c=c|8;break}}let l=null;typeof i.settings.foreground=="string"&&tn(i.settings.foreground)&&(l=i.settings.foreground);let h=null;typeof i.settings.background=="string"&&tn(i.settings.background)&&(h=i.settings.background);for(let u=0,f=a.length;u<f;u++){let p=a[u].trim().split(" "),_=p[p.length-1],m=null;p.length>1&&(m=p.slice(0,p.length-1),m.reverse()),n[r++]=new os(_,m,s,c,l,h)}}return n}var os=class{constructor(t,e,n,r,s,o){this.scope=t,this.parentScopes=e,this.index=n,this.fontStyle=r,this.foreground=s,this.background=o}},P=(t=>(t[t.NotSet=-1]="NotSet",t[t.None=0]="None",t[t.Italic=1]="Italic",t[t.Bold=2]="Bold",t[t.Underline=4]="Underline",t[t.Strikethrough=8]="Strikethrough",t))(P||{});function is(t,e){t.sort((c,l)=>{let h=Wn(c.scope,l.scope);return h!==0||(h=zn(c.parentScopes,l.parentScopes),h!==0)?h:c.index-l.index});let n=0,r="#000000",s="#ffffff";for(;t.length>=1&&t[0].scope==="";){let c=t.shift();c.fontStyle!==-1&&(n=c.fontStyle),c.foreground!==null&&(r=c.foreground),c.background!==null&&(s=c.background)}let o=new as(e),i=new Vn(n,o.getId(r),o.getId(s)),a=new ls(new Et(0,null,-1,0,0),[]);for(let c=0,l=t.length;c<l;c++){let h=t[c];a.insert(0,h.scope,h.parentScopes,h.fontStyle,o.getId(h.foreground),o.getId(h.background))}return new We(o,i,a)}var as=class{constructor(t){g(this,"_isFrozen");g(this,"_lastColorId");g(this,"_id2color");g(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(t)){this._isFrozen=!0;for(let e=0,n=t.length;e<n;e++)this._color2id[t[e]]=e,this._id2color[e]=t[e]}else this._isFrozen=!1}getId(t){if(t===null)return 0;t=t.toUpperCase();let e=this._color2id[t];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${t}`);return e=++this._lastColorId,this._color2id[t]=e,this._id2color[e]=t,e}getColorMap(){return this._id2color.slice(0)}},cs=Object.freeze([]),Et=class Xn{constructor(e,n,r,s,o){g(this,"scopeDepth");g(this,"parentScopes");g(this,"fontStyle");g(this,"foreground");g(this,"background");this.scopeDepth=e,this.parentScopes=n||cs,this.fontStyle=r,this.foreground=s,this.background=o}clone(){return new Xn(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let n=[];for(let r=0,s=e.length;r<s;r++)n[r]=e[r].clone();return n}acceptOverwrite(e,n,r,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},ls=class At{constructor(e,n=[],r={}){g(this,"_rulesWithParentScopes");this._mainRule=e,this._children=r,this._rulesWithParentScopes=n}static _cmpBySpecificity(e,n){if(e.scopeDepth!==n.scopeDepth)return n.scopeDepth-e.scopeDepth;let r=0,s=0;for(;e.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=e.parentScopes.length||s>=n.parentScopes.length);){const o=n.parentScopes[s].length-e.parentScopes[r].length;if(o!==0)return o;r++,s++}return n.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let r=e.indexOf("."),s,o;if(r===-1?(s=e,o=""):(s=e.substring(0,r),o=e.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(o)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(At._cmpBySpecificity),n}insert(e,n,r,s,o,i){if(n===""){this._doInsertHere(e,r,s,o,i);return}let a=n.indexOf("."),c,l;a===-1?(c=n,l=""):(c=n.substring(0,a),l=n.substring(a+1));let h;this._children.hasOwnProperty(c)?h=this._children[c]:(h=new At(this._mainRule.clone(),Et.cloneArr(this._rulesWithParentScopes)),this._children[c]=h),h.insert(e+1,l,r,s,o,i)}_doInsertHere(e,n,r,s,o){if(n===null){this._mainRule.acceptOverwrite(e,r,s,o);return}for(let i=0,a=this._rulesWithParentScopes.length;i<a;i++){let c=this._rulesWithParentScopes[i];if(zn(c.parentScopes,n)===0){c.acceptOverwrite(e,r,s,o);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),o===0&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new Et(e,n,r,s,o))}},we=class O{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const n=O.getLanguageId(e),r=O.getTokenType(e),s=O.getFontStyle(e),o=O.getForeground(e),i=O.getBackground(e);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:o,background:i})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!==0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(e,n,r,s,o,i,a){let c=O.getLanguageId(e),l=O.getTokenType(e),h=O.containsBalancedBrackets(e)?1:0,u=O.getFontStyle(e),f=O.getForeground(e),d=O.getBackground(e);return n!==0&&(c=n),r!==8&&(l=r),s!==null&&(h=s?1:0),o!==-1&&(u=o),i!==0&&(f=i),a!==0&&(d=a),(c<<0|l<<8|h<<10|u<<11|f<<15|d<<24)>>>0}};function ze(t,e){const n=[],r=us(t);let s=r.next();for(;s!==null;){let c=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":c=1;break;case"L":c=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let l=i();if(n.push({matcher:l,priority:c}),s!==",")break;s=r.next()}return n;function o(){if(s==="-"){s=r.next();const c=o();return l=>!!c&&!c(l)}if(s==="("){s=r.next();const c=a();return s===")"&&(s=r.next()),c}if(nn(s)){const c=[];do c.push(s),s=r.next();while(nn(s));return l=>e(c,l)}return null}function i(){const c=[];let l=o();for(;l;)c.push(l),l=o();return h=>c.every(u=>u(h))}function a(){const c=[];let l=i();for(;l&&(c.push(l),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");l=i()}return h=>c.some(u=>u(h))}}function nn(t){return!!t&&!!t.match(/[\w\.:]+/)}function us(t){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=e.exec(t);return{next:()=>{if(!n)return null;const r=n[0];return n=e.exec(t),r}}}function Qn(t){typeof t.dispose=="function"&&t.dispose()}var Ae=class{constructor(t){this.scopeName=t}toKey(){return this.scopeName}},hs=class{constructor(t,e){this.scopeName=t,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},fs=class{constructor(){g(this,"_references",[]);g(this,"_seenReferenceKeys",new Set);g(this,"visitedRule",new Set)}get references(){return this._references}add(t){const e=t.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(t))}},ds=class{constructor(t,e){g(this,"seenFullScopeRequests",new Set);g(this,"seenPartialScopeRequests",new Set);g(this,"Q");this.repo=t,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Ae(this.initialScopeName)]}processQueue(){const t=this.Q;this.Q=[];const e=new fs;for(const n of t)ps(n,this.initialScopeName,this.repo,e);for(const n of e.references)if(n instanceof Ae){if(this.seenFullScopeRequests.has(n.scopeName))continue;this.seenFullScopeRequests.add(n.scopeName),this.Q.push(n)}else{if(this.seenFullScopeRequests.has(n.scopeName)||this.seenPartialScopeRequests.has(n.toKey()))continue;this.seenPartialScopeRequests.add(n.toKey()),this.Q.push(n)}}};function ps(t,e,n,r){const s=n.lookup(t.scopeName);if(!s){if(t.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const o=n.lookup(e);t instanceof Ae?je({baseGrammar:o,selfGrammar:s},r):vt(t.ruleName,{baseGrammar:o,selfGrammar:s,repository:s.repository},r);const i=n.injections(t.scopeName);if(i)for(const a of i)r.add(new Ae(a))}function vt(t,e,n){if(e.repository&&e.repository[t]){const r=e.repository[t];qe([r],e,n)}}function je(t,e){t.selfGrammar.patterns&&Array.isArray(t.selfGrammar.patterns)&&qe(t.selfGrammar.patterns,{...t,repository:t.selfGrammar.repository},e),t.selfGrammar.injections&&qe(Object.values(t.selfGrammar.injections),{...t,repository:t.selfGrammar.repository},e)}function qe(t,e,n){for(const r of t){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?jn({},e.repository,r.repository):e.repository;Array.isArray(r.patterns)&&qe(r.patterns,{...e,repository:s},n);const o=r.include;if(!o)continue;const i=Kn(o);switch(i.kind){case 0:je({...e,selfGrammar:e.baseGrammar},n);break;case 1:je(e,n);break;case 2:vt(i.ruleName,{...e,repository:s},n);break;case 3:case 4:const a=i.scopeName===e.selfGrammar.scopeName?e.selfGrammar:i.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(a){const c={baseGrammar:e.baseGrammar,selfGrammar:a,repository:s};i.kind===4?vt(i.ruleName,c,n):je(c,n)}else i.kind===4?n.add(new hs(i.scopeName,i.ruleName)):n.add(new Ae(i.scopeName));break}}}var gs=class{constructor(){g(this,"kind",0)}},ms=class{constructor(){g(this,"kind",1)}},ys=class{constructor(t){g(this,"kind",2);this.ruleName=t}},_s=class{constructor(t){g(this,"kind",3);this.scopeName=t}},ws=class{constructor(t,e){g(this,"kind",4);this.scopeName=t,this.ruleName=e}};function Kn(t){if(t==="$base")return new gs;if(t==="$self")return new ms;const e=t.indexOf("#");if(e===-1)return new _s(t);if(e===0)return new ys(t.substring(1));{const n=t.substring(0,e),r=t.substring(e+1);return new ws(n,r)}}var bs=/\\(\d+)/,rn=/\\(\d+)/g,Cs=-1,Zn=-2;var Pe=class{constructor(t,e,n,r){g(this,"$location");g(this,"id");g(this,"_nameIsCapturing");g(this,"_name");g(this,"_contentNameIsCapturing");g(this,"_contentName");this.$location=t,this.id=e,this._name=n||null,this._nameIsCapturing=Te.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Te.hasCaptures(this._contentName)}get debugName(){const t=this.$location?`${Un(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${t}`}getName(t,e){return!this._nameIsCapturing||this._name===null||t===null||e===null?this._name:Te.replaceCaptures(this._name,t,e)}getContentName(t,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Te.replaceCaptures(this._contentName,t,e)}},Ss=class extends Pe{constructor(e,n,r,s,o){super(e,n,r,s);g(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=o}dispose(){}collectPatterns(e,n){throw new Error("Not supported!")}compile(e,n){throw new Error("Not supported!")}compileAG(e,n,r,s){throw new Error("Not supported!")}},ks=class extends Pe{constructor(e,n,r,s,o){super(e,n,r,null);g(this,"_match");g(this,"captures");g(this,"_cachedCompiledPatterns");this._match=new ve(s,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,n){n.push(this._match)}compile(e,n){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,n,r,s){return this._getCachedCompiledPatterns(e).compileAG(e,r,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ie,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},sn=class extends Pe{constructor(e,n,r,s,o){super(e,n,r,s);g(this,"hasMissingPatterns");g(this,"patterns");g(this,"_cachedCompiledPatterns");this.patterns=o.patterns,this.hasMissingPatterns=o.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,n){for(const r of this.patterns)e.getRule(r).collectPatterns(e,n)}compile(e,n){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,n,r,s){return this._getCachedCompiledPatterns(e).compileAG(e,r,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ie,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},It=class extends Pe{constructor(e,n,r,s,o,i,a,c,l,h){super(e,n,r,s);g(this,"_begin");g(this,"beginCaptures");g(this,"_end");g(this,"endHasBackReferences");g(this,"endCaptures");g(this,"applyEndPatternLast");g(this,"hasMissingPatterns");g(this,"patterns");g(this,"_cachedCompiledPatterns");this._begin=new ve(o,this.id),this.beginCaptures=i,this._end=new ve(a||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=c,this.applyEndPatternLast=l||!1,this.patterns=h.patterns,this.hasMissingPatterns=h.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,n){return this._end.resolveBackReferences(e,n)}collectPatterns(e,n){n.push(this._begin)}compile(e,n){return this._getCachedCompiledPatterns(e,n).compile(e)}compileAG(e,n,r,s){return this._getCachedCompiledPatterns(e,n).compileAG(e,r,s)}_getCachedCompiledPatterns(e,n){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ie;for(const r of this.patterns)e.getRule(r).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,n):this._cachedCompiledPatterns.setSource(0,n)),this._cachedCompiledPatterns}},He=class extends Pe{constructor(e,n,r,s,o,i,a,c,l){super(e,n,r,s);g(this,"_begin");g(this,"beginCaptures");g(this,"whileCaptures");g(this,"_while");g(this,"whileHasBackReferences");g(this,"hasMissingPatterns");g(this,"patterns");g(this,"_cachedCompiledPatterns");g(this,"_cachedCompiledWhilePatterns");this._begin=new ve(o,this.id),this.beginCaptures=i,this.whileCaptures=c,this._while=new ve(a,Zn),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,n){return this._while.resolveBackReferences(e,n)}collectPatterns(e,n){n.push(this._begin)}compile(e,n){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,n,r,s){return this._getCachedCompiledPatterns(e).compileAG(e,r,s)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ie;for(const n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,n){return this._getCachedCompiledWhilePatterns(e,n).compile(e)}compileWhileAG(e,n,r,s){return this._getCachedCompiledWhilePatterns(e,n).compileAG(e,r,s)}_getCachedCompiledWhilePatterns(e,n){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Ie,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,n||""),this._cachedCompiledWhilePatterns}},Jn=class ${static createCaptureRule(e,n,r,s,o){return e.registerRule(i=>new Ss(n,i,r,s,o))}static getCompiledRuleId(e,n,r){return e.id||n.registerRule(s=>{if(e.id=s,e.match)return new ks(e.$vscodeTextmateLocation,e.id,e.name,e.match,$._compileCaptures(e.captures,n,r));if(typeof e.begin>"u"){e.repository&&(r=jn({},r,e.repository));let o=e.patterns;return typeof o>"u"&&e.include&&(o=[{include:e.include}]),new sn(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,$._compilePatterns(o,n,r))}return e.while?new He(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,$._compileCaptures(e.beginCaptures||e.captures,n,r),e.while,$._compileCaptures(e.whileCaptures||e.captures,n,r),$._compilePatterns(e.patterns,n,r)):new It(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,$._compileCaptures(e.beginCaptures||e.captures,n,r),e.end,$._compileCaptures(e.endCaptures||e.captures,n,r),e.applyEndPatternLast,$._compilePatterns(e.patterns,n,r))}),e.id}static _compileCaptures(e,n,r){let s=[];if(e){let o=0;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);a>o&&(o=a)}for(let i=0;i<=o;i++)s[i]=null;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const a=parseInt(i,10);let c=0;e[i].patterns&&(c=$.getCompiledRuleId(e[i],n,r)),s[a]=$.createCaptureRule(n,e[i].$vscodeTextmateLocation,e[i].name,e[i].contentName,c)}}return s}static _compilePatterns(e,n,r){let s=[];if(e)for(let o=0,i=e.length;o<i;o++){const a=e[o];let c=-1;if(a.include){const l=Kn(a.include);switch(l.kind){case 0:case 1:c=$.getCompiledRuleId(r[a.include],n,r);break;case 2:let h=r[l.ruleName];h&&(c=$.getCompiledRuleId(h,n,r));break;case 3:case 4:const u=l.scopeName,f=l.kind===4?l.ruleName:null,d=n.getExternalGrammar(u,r);if(d)if(f){let p=d.repository[f];p&&(c=$.getCompiledRuleId(p,n,d.repository))}else c=$.getCompiledRuleId(d.repository.$self,n,d.repository);break}}else c=$.getCompiledRuleId(a,n,r);if(c!==-1){const l=n.getRule(c);let h=!1;if((l instanceof sn||l instanceof It||l instanceof He)&&l.hasMissingPatterns&&l.patterns.length===0&&(h=!0),h)continue;s.push(c)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},ve=class Yn{constructor(e,n){g(this,"source");g(this,"ruleId");g(this,"hasAnchor");g(this,"hasBackReferences");g(this,"_anchorCache");if(e&&typeof e=="string"){const r=e.length;let s=0,o=[],i=!1;for(let a=0;a<r;a++)if(e.charAt(a)==="\\"&&a+1<r){const l=e.charAt(a+1);l==="z"?(o.push(e.substring(s,a)),o.push("$(?!\\n)(?<!\\n)"),s=a+2):(l==="A"||l==="G")&&(i=!0),a++}this.hasAnchor=i,s===0?this.source=e:(o.push(e.substring(s,r)),this.source=o.join(""))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=bs.test(this.source):this.hasBackReferences=!1}clone(){return new Yn(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(s=>e.substring(s.start,s.end));return rn.lastIndex=0,this.source.replace(rn,(s,o)=>qn(r[parseInt(o,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],n=[],r=[],s=[],o,i,a,c;for(o=0,i=this.source.length;o<i;o++)a=this.source.charAt(o),e[o]=a,n[o]=a,r[o]=a,s[o]=a,a==="\\"&&o+1<i&&(c=this.source.charAt(o+1),c==="A"?(e[o+1]="",n[o+1]="",r[o+1]="A",s[o+1]="A"):c==="G"?(e[o+1]="",n[o+1]="G",r[o+1]="",s[o+1]="G"):(e[o+1]=c,n[o+1]=c,r[o+1]=c,s[o+1]=c),o++);return{A0_G0:e.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(e,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:e?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Ie=class{constructor(){g(this,"_items");g(this,"_hasAnchors");g(this,"_cached");g(this,"_anchorCache");this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(t){this._items.push(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}unshift(t){this._items.unshift(t),this._hasAnchors=this._hasAnchors||t.hasAnchor}length(){return this._items.length}setSource(t,e){this._items[t].source!==e&&(this._disposeCaches(),this._items[t].setSource(e))}compile(t){if(!this._cached){let e=this._items.map(n=>n.source);this._cached=new on(t,e,this._items.map(n=>n.ruleId))}return this._cached}compileAG(t,e,n){return this._hasAnchors?e?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(t,e,n)),this._anchorCache.A0_G0):this.compile(t)}_resolveAnchors(t,e,n){let r=this._items.map(s=>s.resolveAnchors(e,n));return new on(t,r,this._items.map(s=>s.ruleId))}},on=class{constructor(t,e,n){g(this,"scanner");this.regExps=e,this.rules=n,this.scanner=t.createOnigScanner(e)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const t=[];for(let e=0,n=this.rules.length;e<n;e++)t.push(" - "+this.rules[e]+": "+this.regExps[e]);return t.join(`
|
|
2
|
+
`)}findNextMatchSync(t,e,n){const r=this.scanner.findNextMatchSync(t,e,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},pt=class{constructor(t,e){this.languageId=t,this.tokenType=e}},K,xs=(K=class{constructor(e,n){g(this,"_defaultAttributes");g(this,"_embeddedLanguagesMatcher");g(this,"_getBasicScopeAttributes",new Hn(e=>{const n=this._scopeToLanguage(e),r=this._toStandardTokenType(e);return new pt(n,r)}));this._defaultAttributes=new pt(e,8),this._embeddedLanguagesMatcher=new Es(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?K._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const n=e.match(K.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!")}},g(K,"_NULL_SCOPE_METADATA",new pt(0,0)),g(K,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),K),Es=class{constructor(t){g(this,"values");g(this,"scopesRegExp");if(t.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(t);const e=t.map(([n,r])=>qn(n));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(t){if(!this.scopesRegExp)return;const e=t.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},an=class{constructor(t,e){this.stack=t,this.stoppedEarly=e}};function er(t,e,n,r,s,o,i,a){const c=e.content.length;let l=!1,h=-1;if(i){const d=As(t,e,n,r,s,o);s=d.stack,r=d.linePos,n=d.isFirstLine,h=d.anchorPosition}const u=Date.now();for(;!l;){if(a!==0&&Date.now()-u>a)return new an(s,!0);f()}return new an(s,!1);function f(){const d=vs(t,e,n,r,s,h);if(!d){o.produce(s,c),l=!0;return}const p=d.captureIndices,_=d.matchedRuleId,m=p&&p.length>0?p[0].end>r:!1;if(_===Cs){const b=s.getRule(t);o.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),ke(t,e,n,s,o,b.endCaptures,p),o.produce(s,p[0].end);const y=s;if(s=s.parent,h=y.getAnchorPos(),!m&&y.getEnterPos()===r){s=y,o.produce(s,c),l=!0;return}}else{const b=t.getRule(_);o.produce(s,p[0].start);const y=s,w=b.getName(e.content,p),C=s.contentNameScopesList.pushAttributed(w,t);if(s=s.push(_,r,h,p[0].end===c,null,C,C),b instanceof It){const S=b;ke(t,e,n,s,o,S.beginCaptures,p),o.produce(s,p[0].end),h=p[0].end;const x=S.getContentName(e.content,p),E=C.pushAttributed(x,t);if(s=s.withContentNameScopesList(E),S.endHasBackReferences&&(s=s.withEndRule(S.getEndWithResolvedBackReferences(e.content,p))),!m&&y.hasSameRuleAs(s)){s=s.pop(),o.produce(s,c),l=!0;return}}else if(b instanceof He){const S=b;ke(t,e,n,s,o,S.beginCaptures,p),o.produce(s,p[0].end),h=p[0].end;const x=S.getContentName(e.content,p),E=C.pushAttributed(x,t);if(s=s.withContentNameScopesList(E),S.whileHasBackReferences&&(s=s.withEndRule(S.getWhileWithResolvedBackReferences(e.content,p))),!m&&y.hasSameRuleAs(s)){s=s.pop(),o.produce(s,c),l=!0;return}}else if(ke(t,e,n,s,o,b.captures,p),o.produce(s,p[0].end),s=s.pop(),!m){s=s.safePop(),o.produce(s,c),l=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function As(t,e,n,r,s,o){let i=s.beginRuleCapturedEOL?0:-1;const a=[];for(let c=s;c;c=c.pop()){const l=c.getRule(t);l instanceof He&&a.push({rule:l,stack:c})}for(let c=a.pop();c;c=a.pop()){const{ruleScanner:l,findOptions:h}=Rs(c.rule,t,c.stack.endRule,n,r===i),u=l.findNextMatchSync(e,r,h);if(u){if(u.ruleId!==Zn){s=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(o.produce(c.stack,u.captureIndices[0].start),ke(t,e,n,c.stack,o,c.rule.whileCaptures,u.captureIndices),o.produce(c.stack,u.captureIndices[0].end),i=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{s=c.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:i,isFirstLine:n}}function vs(t,e,n,r,s,o){const i=Is(t,e,n,r,s,o),a=t.getInjections();if(a.length===0)return i;const c=Ns(a,t,e,n,r,s,o);if(!c)return i;if(!i)return c;const l=i.captureIndices[0].start,h=c.captureIndices[0].start;return h<l||c.priorityMatch&&h===l?c:i}function Is(t,e,n,r,s,o){const i=s.getRule(t),{ruleScanner:a,findOptions:c}=tr(i,t,s.endRule,n,r===o),l=a.findNextMatchSync(e,r,c);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}function Ns(t,e,n,r,s,o,i){let a=Number.MAX_VALUE,c=null,l,h=0;const u=o.contentNameScopesList.getScopeNames();for(let f=0,d=t.length;f<d;f++){const p=t[f];if(!p.matcher(u))continue;const _=e.getRule(p.ruleId),{ruleScanner:m,findOptions:b}=tr(_,e,null,r,s===i),y=m.findNextMatchSync(n,s,b);if(!y)continue;const w=y.captureIndices[0].start;if(!(w>=a)&&(a=w,c=y.captureIndices,l=y.ruleId,h=p.priority,a===s))break}return c?{priorityMatch:h===-1,captureIndices:c,matchedRuleId:l}:null}function tr(t,e,n,r,s){return{ruleScanner:t.compileAG(e,n,r,s),findOptions:0}}function Rs(t,e,n,r,s){return{ruleScanner:t.compileWhileAG(e,n,r,s),findOptions:0}}function ke(t,e,n,r,s,o,i){if(o.length===0)return;const a=e.content,c=Math.min(o.length,i.length),l=[],h=i[0].end;for(let u=0;u<c;u++){const f=o[u];if(f===null)continue;const d=i[u];if(d.length===0)continue;if(d.start>h)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?s.produceFromScopes(l[l.length-1].scopes,d.start):s.produce(r,d.start),f.retokenizeCapturedWithRuleId){const _=f.getName(a,i),m=r.contentNameScopesList.pushAttributed(_,t),b=f.getContentName(a,i),y=m.pushAttributed(b,t),w=r.push(f.retokenizeCapturedWithRuleId,d.start,-1,!1,null,m,y),C=t.createOnigString(a.substring(0,d.end));er(t,C,n&&d.start===0,d.start,w,s,!1,0),Qn(C);continue}const p=f.getName(a,i);if(p!==null){const m=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(p,t);l.push(new $s(m,d.end))}}for(;l.length>0;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var $s=class{constructor(t,e){g(this,"scopes");g(this,"endPos");this.scopes=t,this.endPos=e}};function Ps(t,e,n,r,s,o,i,a){return new Ts(t,e,n,r,s,o,i,a)}function cn(t,e,n,r,s){const o=ze(e,Ve),i=Jn.getCompiledRuleId(n,r,s.repository);for(const a of o)t.push({debugSelector:e,matcher:a.matcher,ruleId:i,grammar:s,priority:a.priority})}function Ve(t,e){if(e.length<t.length)return!1;let n=0;return t.every(r=>{for(let s=n;s<e.length;s++)if(Ls(e[s],r))return n=s+1,!0;return!1})}function Ls(t,e){if(!t)return!1;if(t===e)return!0;const n=e.length;return t.length>n&&t.substr(0,n)===e&&t[n]==="."}var Ts=class{constructor(t,e,n,r,s,o,i,a){g(this,"_rootId");g(this,"_lastRuleId");g(this,"_ruleId2desc");g(this,"_includedGrammars");g(this,"_grammarRepository");g(this,"_grammar");g(this,"_injections");g(this,"_basicScopeAttributesProvider");g(this,"_tokenTypeMatchers");if(this._rootScopeName=t,this.balancedBracketSelectors=o,this._onigLib=a,this._basicScopeAttributesProvider=new xs(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=ln(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const c of Object.keys(s)){const l=ze(c,Ve);for(const h of l)this._tokenTypeMatchers.push({matcher:h.matcher,type:s[c]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const t of this._ruleId2desc)t&&t.dispose()}createOnigScanner(t){return this._onigLib.createOnigScanner(t)}createOnigString(t){return this._onigLib.createOnigString(t)}getMetadataForScope(t){return this._basicScopeAttributesProvider.getBasicScopeAttributes(t)}_collectInjections(){const t={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},e=[],n=this._rootScopeName,r=t.lookup(n);if(r){const s=r.injections;if(s)for(let i in s)cn(e,i,s[i],this,r);const o=this._grammarRepository.injections(n);o&&o.forEach(i=>{const a=this.getExternalGrammar(i);if(a){const c=a.injectionSelector;c&&cn(e,c,a,this,a)}})}return e.sort((s,o)=>s.priority-o.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(t){const e=++this._lastRuleId,n=t(e);return this._ruleId2desc[e]=n,n}getRule(t){return this._ruleId2desc[t]}getExternalGrammar(t,e){if(this._includedGrammars[t])return this._includedGrammars[t];if(this._grammarRepository){const n=this._grammarRepository.lookup(t);if(n)return this._includedGrammars[t]=ln(n,e&&e.$base),this._includedGrammars[t]}}tokenizeLine(t,e,n=0){const r=this._tokenize(t,e,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(t,e,n=0){const r=this._tokenize(t,e,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(t,e,n,r){this._rootId===-1&&(this._rootId=Jn.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!e||e===Nt.NULL){s=!0;const l=this._basicScopeAttributesProvider.getDefaultAttributes(),h=this.themeProvider.getDefaults(),u=we.set(0,l.languageId,l.tokenType,null,h.fontStyle,h.foregroundId,h.backgroundId),f=this.getRule(this._rootId).getName(null,null);let d;f?d=xe.createRootAndLookUpScopeName(f,u,this):d=xe.createRoot("unknown",u),e=new Nt(null,this._rootId,-1,-1,!1,null,d,d)}else s=!1,e.reset();t=t+`
|
|
3
|
+
`;const o=this.createOnigString(t),i=o.content.length,a=new Ms(n,t,this._tokenTypeMatchers,this.balancedBracketSelectors),c=er(this,o,s,0,e,a,!0,r);return Qn(o),{lineLength:i,lineTokens:a,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function ln(t,e){return t=Yr(t),t.repository=t.repository||{},t.repository.$self={$vscodeTextmateLocation:t.$vscodeTextmateLocation,patterns:t.patterns,name:t.scopeName},t.repository.$base=e||t.repository.$self,t}var xe=class q{constructor(e,n,r){this.parent=e,this.scopePath=n,this.tokenAttributes=r}static fromExtension(e,n){let r=e,s=(e==null?void 0:e.scopePath)??null;for(const o of n)s=dt.push(s,o.scopeNames),r=new q(r,s,o.encodedTokenAttributes);return r}static createRoot(e,n){return new q(null,new dt(null,e),n)}static createRootAndLookUpScopeName(e,n,r){const s=r.getMetadataForScope(e),o=new dt(null,e),i=r.themeProvider.themeMatch(o),a=q.mergeAttributes(n,s,i);return new q(null,o,a)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return q.equals(this,e)}static equals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.scopeName!==n.scopeName||e.tokenAttributes!==n.tokenAttributes)return!1;e=e.parent,n=n.parent}while(!0)}static mergeAttributes(e,n,r){let s=-1,o=0,i=0;return r!==null&&(s=r.fontStyle,o=r.foregroundId,i=r.backgroundId),we.set(e,n.languageId,n.tokenType,null,s,o,i)}pushAttributed(e,n){if(e===null)return this;if(e.indexOf(" ")===-1)return q._pushAttributed(this,e,n);const r=e.split(/ /g);let s=this;for(const o of r)s=q._pushAttributed(s,o,n);return s}static _pushAttributed(e,n,r){const s=r.getMetadataForScope(n),o=e.scopePath.push(n),i=r.themeProvider.themeMatch(o),a=q.mergeAttributes(e.tokenAttributes,s,i);return new q(e,o,a)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){var s;const n=[];let r=this;for(;r&&r!==e;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(((s=r.parent)==null?void 0:s.scopePath)??null)}),r=r.parent;return r===e?n.reverse():void 0}},B,Nt=(B=class{constructor(e,n,r,s,o,i,a,c){g(this,"_stackElementBrand");g(this,"_enterPos");g(this,"_anchorPos");g(this,"depth");this.parent=e,this.ruleId=n,this.beginRuleCapturedEOL=o,this.endRule=i,this.nameScopesList=a,this.contentNameScopesList=c,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}equals(e){return e===null?!1:B._equals(this,e)}static _equals(e,n){return e===n?!0:this._structuralEquals(e,n)?xe.equals(e.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(e,n){do{if(e===n||!e&&!n)return!0;if(!e||!n||e.depth!==n.depth||e.ruleId!==n.ruleId||e.endRule!==n.endRule)return!1;e=e.parent,n=n.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){B._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,n,r,s,o,i,a){return new B(this,e,n,r,s,o,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,n){var r,s;return this.parent&&(n=this.parent._writeString(e,n)),e[n++]=`(${this.ruleId}, ${(r=this.nameScopesList)==null?void 0:r.toString()}, ${(s=this.contentNameScopesList)==null?void 0:s.toString()})`,n}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(e){return this.endRule===e?this:new B(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let n=this;for(;n&&n._enterPos===e._enterPos;){if(n.ruleId===e.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){var e,n,r;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((n=this.nameScopesList)==null?void 0:n.getExtensionIfDefined(((e=this.parent)==null?void 0:e.nameScopesList)??null))??[],contentNameScopesList:((r=this.contentNameScopesList)==null?void 0:r.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(e,n){const r=xe.fromExtension((e==null?void 0:e.nameScopesList)??null,n.nameScopesList);return new B(e,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,xe.fromExtension(r,n.contentNameScopesList))}},g(B,"NULL",new B(null,0,0,0,!1,null,null,null)),B),Gs=class{constructor(t,e){g(this,"balancedBracketScopes");g(this,"unbalancedBracketScopes");g(this,"allowAny",!1);this.balancedBracketScopes=t.flatMap(n=>n==="*"?(this.allowAny=!0,[]):ze(n,Ve).map(r=>r.matcher)),this.unbalancedBracketScopes=e.flatMap(n=>ze(n,Ve).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(t){for(const e of this.unbalancedBracketScopes)if(e(t))return!1;for(const e of this.balancedBracketScopes)if(e(t))return!0;return this.allowAny}},Ms=class{constructor(t,e,n,r){g(this,"_emitBinaryTokens");g(this,"_lineText");g(this,"_tokens");g(this,"_binaryTokens");g(this,"_lastTokenEndIndex");g(this,"_tokenTypeOverrides");this.balancedBracketSelectors=r,this._emitBinaryTokens=t,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(t,e){this.produceFromScopes(t.contentNameScopesList,e)}produceFromScopes(t,e){var r;if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let s=(t==null?void 0:t.tokenAttributes)??0,o=!1;if((r=this.balancedBracketSelectors)!=null&&r.matchesAlways&&(o=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const i=(t==null?void 0:t.getScopeNames())??[];for(const a of this._tokenTypeOverrides)a.matcher(i)&&(s=we.set(s,0,a.type,null,-1,0,0));this.balancedBracketSelectors&&(o=this.balancedBracketSelectors.match(i))}if(o&&(s=we.set(s,0,8,o,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===s){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(s),this._lastTokenEndIndex=e;return}const n=(t==null?void 0:t.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:n}),this._lastTokenEndIndex=e}getResult(t,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(t,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(t,e),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,s=this._binaryTokens.length;r<s;r++)n[r]=this._binaryTokens[r];return n}},Os=class{constructor(t,e){g(this,"_grammars",new Map);g(this,"_rawGrammars",new Map);g(this,"_injectionGrammars",new Map);g(this,"_theme");this._onigLib=e,this._theme=t}dispose(){for(const t of this._grammars.values())t.dispose()}setTheme(t){this._theme=t}getColorMap(){return this._theme.getColorMap()}addGrammar(t,e){this._rawGrammars.set(t.scopeName,t),e&&this._injectionGrammars.set(t.scopeName,e)}lookup(t){return this._rawGrammars.get(t)}injections(t){return this._injectionGrammars.get(t)}getDefaults(){return this._theme.getDefaults()}themeMatch(t){return this._theme.match(t)}grammarForScopeName(t,e,n,r,s){if(!this._grammars.has(t)){let o=this._rawGrammars.get(t);if(!o)return null;this._grammars.set(t,Ps(t,o,e,n,r,s,this,this._onigLib))}return this._grammars.get(t)}},Bs=class{constructor(e){g(this,"_options");g(this,"_syncRegistry");g(this,"_ensureGrammarCache");this._options=e,this._syncRegistry=new Os(We.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,n){this._syncRegistry.setTheme(We.createFromRawTheme(e,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,n,r){return this.loadGrammarWithConfiguration(e,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(e,n,r){return this._loadGrammar(e,n,r.embeddedLanguages,r.tokenTypes,new Gs(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,n,r,s,o){const i=new ds(this._syncRegistry,e);for(;i.Q.length>0;)i.Q.map(a=>this._loadSingleGrammar(a.scopeName)),i.processQueue();return this._grammarForScopeName(e,n,r,s,o)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const n=this._options.loadGrammar(e);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(e,n=[],r=0,s=null){return this._syncRegistry.addGrammar(e,n),this._grammarForScopeName(e.scopeName,r,s)}_grammarForScopeName(e,n=0,r=null,s=null,o=null){return this._syncRegistry.grammarForScopeName(e,n,r,s,o)}},Rt=Nt.NULL;function Xe(t,e){const n=typeof t=="string"?{}:{...t.colorReplacements},r=typeof t=="string"?t:t.name;for(const[s,o]of Object.entries((e==null?void 0:e.colorReplacements)||{}))typeof o=="string"?n[s]=o:s===r&&Object.assign(n,o);return n}function re(t,e){return t&&((e==null?void 0:e[t==null?void 0:t.toLowerCase()])||t)}function Fs(t){return Array.isArray(t)?t:[t]}async function nr(t){return Promise.resolve(typeof t=="function"?t():t).then(e=>e.default||e)}function et(t){return!t||["plaintext","txt","text","plain"].includes(t)}function Ds(t){return t==="ansi"||et(t)}function tt(t){return t==="none"}function js(t){return tt(t)}const Us=/(\r?\n)/g;function nt(t,e=!1){var o;if(t.length===0)return[["",0]];const n=t.split(Us);let r=0;const s=[];for(let i=0;i<n.length;i+=2){const a=e?n[i]+(n[i+1]||""):n[i];s.push([a,r]),r+=n[i].length,r+=((o=n[i+1])==null?void 0:o.length)||0}return s}const un={light:"#333333",dark:"#bbbbbb"},hn={light:"#fffffe",dark:"#1e1e1e"},fn="__shiki_resolved";function Ut(t){var a,c,l,h,u;if(t!=null&&t[fn])return t;const e={...t};e.tokenColors&&!e.settings&&(e.settings=e.tokenColors,delete e.tokenColors),e.type||(e.type="dark"),e.colorReplacements={...e.colorReplacements},e.settings||(e.settings=[]);let{bg:n,fg:r}=e;if(!n||!r){const f=e.settings?e.settings.find(d=>!d.name&&!d.scope):void 0;(a=f==null?void 0:f.settings)!=null&&a.foreground&&(r=f.settings.foreground),(c=f==null?void 0:f.settings)!=null&&c.background&&(n=f.settings.background),!r&&((l=e==null?void 0:e.colors)!=null&&l["editor.foreground"])&&(r=e.colors["editor.foreground"]),!n&&((h=e==null?void 0:e.colors)!=null&&h["editor.background"])&&(n=e.colors["editor.background"]),r||(r=e.type==="light"?un.light:un.dark),n||(n=e.type==="light"?hn.light:hn.dark),e.fg=r,e.bg=n}e.settings[0]&&e.settings[0].settings&&!e.settings[0].scope||e.settings.unshift({settings:{foreground:e.fg,background:e.bg}});let s=0;const o=new Map;function i(f){var p;if(o.has(f))return o.get(f);s+=1;const d=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return(p=e.colorReplacements)!=null&&p[`#${d}`]?i(f):(o.set(f,d),d)}e.settings=e.settings.map(f=>{var m,b;const d=((m=f.settings)==null?void 0:m.foreground)&&!f.settings.foreground.startsWith("#"),p=((b=f.settings)==null?void 0:b.background)&&!f.settings.background.startsWith("#");if(!d&&!p)return f;const _={...f,settings:{...f.settings}};if(d){const y=i(f.settings.foreground);e.colorReplacements[y]=f.settings.foreground,_.settings.foreground=y}if(p){const y=i(f.settings.background);e.colorReplacements[y]=f.settings.background,_.settings.background=y}return _});for(const f of Object.keys(e.colors||{}))if((f==="editor.foreground"||f==="editor.background"||f.startsWith("terminal.ansi"))&&!((u=e.colors[f])!=null&&u.startsWith("#"))){const d=i(e.colors[f]);e.colorReplacements[d]=e.colors[f],e.colors[f]=d}return Object.defineProperty(e,fn,{enumerable:!1,writable:!1,value:!0}),e}async function rr(t){return[...new Set((await Promise.all(t.filter(e=>!Ds(e)).map(async e=>await nr(e).then(n=>Array.isArray(n)?n:[n])))).flat())]}async function sr(t){return(await Promise.all(t.map(async e=>js(e)?null:Ut(await nr(e))))).filter(e=>!!e)}function or(t,e){if(!e)return t;if(e[t]){const n=new Set([t]);for(;e[t];){if(t=e[t],n.has(t))throw new A(`Circular alias \`${[...n].join(" -> ")} -> ${t}\``);n.add(t)}}return t}var Ws=class extends Bs{constructor(e,n,r,s={}){super(e);g(this,"_resolver");g(this,"_themes");g(this,"_langs");g(this,"_alias");g(this,"_resolvedThemes",new Map);g(this,"_resolvedGrammars",new Map);g(this,"_langMap",new Map);g(this,"_langGraph",new Map);g(this,"_textmateThemeCache",new WeakMap);g(this,"_loadedThemesCache",null);g(this,"_loadedLanguagesCache",null);this._resolver=e,this._themes=n,this._langs=r,this._alias=s,this._themes.map(o=>this.loadTheme(o)),this.loadLanguages(this._langs)}getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const n=Ut(e);return n.name&&(this._resolvedThemes.set(n.name,n),this._loadedThemesCache=null),n}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let n=this._textmateThemeCache.get(e);n||(n=We.createFromRawTheme(e),this._textmateThemeCache.set(e,n)),this._syncRegistry.setTheme(n)}getGrammar(e){return e=or(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){var o,i,a,c;if(this.getGrammar(e.name))return;const n=new Set([...this._langMap.values()].filter(l=>{var h;return(h=l.embeddedLangsLazy)==null?void 0:h.includes(e.name)}));this._resolver.addLanguage(e);const r={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const s=this.loadGrammarWithConfiguration(e.scopeName,1,r);if(s.name=e.name,this._resolvedGrammars.set(e.name,s),e.aliases&&e.aliases.forEach(l=>{this._alias[l]=e.name}),this._loadedLanguagesCache=null,n.size)for(const l of n)this._resolvedGrammars.delete(l.name),this._loadedLanguagesCache=null,(i=(o=this._syncRegistry)==null?void 0:o._injectionGrammars)==null||i.delete(l.scopeName),(c=(a=this._syncRegistry)==null?void 0:a._grammars)==null||c.delete(l.scopeName),this.loadLanguage(this._langMap.get(l.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const s of e)this.resolveEmbeddedLanguages(s);const n=[...this._langGraph.entries()],r=n.filter(([s,o])=>!o);if(r.length){const s=n.filter(([o,i])=>{var a;return i?(a=i.embeddedLanguages||i.embeddedLangs)==null?void 0:a.some(c=>r.map(([l])=>l).includes(c)):!1}).filter(o=>!r.includes(o));throw new A(`Missing languages ${r.map(([o])=>`\`${o}\``).join(", ")}, required by ${s.map(([o])=>`\`${o}\``).join(", ")}`)}for(const[s,o]of n)this._resolver.addLanguage(o);for(const[s,o]of n)this.loadLanguage(o)}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 n=e.embeddedLanguages??e.embeddedLangs;if(n)for(const r of n)this._langGraph.set(r,this._langMap.get(r))}},zs=class{constructor(t,e){g(this,"_langs",new Map);g(this,"_scopeToLang",new Map);g(this,"_injections",new Map);g(this,"_onigLib");this._onigLib={createOnigScanner:n=>t.createScanner(n),createOnigString:n=>t.createString(n)},e.forEach(n=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(t){return this._langs.get(t)}loadGrammar(t){return this._scopeToLang.get(t)}addLanguage(t){this._langs.set(t.name,t),t.aliases&&t.aliases.forEach(e=>{this._langs.set(e,t)}),this._scopeToLang.set(t.scopeName,t),t.injectTo&&t.injectTo.forEach(e=>{this._injections.get(e)||this._injections.set(e,[]),this._injections.get(e).push(t.scopeName)})}getInjections(t){const e=t.split(".");let n=[];for(let r=1;r<=e.length;r++){const s=e.slice(0,r).join(".");n=[...n,...this._injections.get(s)||[]]}return n}};let Se=0;function qs(t){Se+=1,t.warnings!==!1&&Se>=10&&Se%10===0&&console.warn(`[Shiki] ${Se} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let e=!1;if(!t.engine)throw new A("`engine` option is required for synchronous mode");const n=(t.langs||[]).flat(1),r=(t.themes||[]).flat(1).map(Ut),s=new Ws(new zs(t.engine,n),r,n,t.langAlias);let o;function i(y){return or(y,t.langAlias)}function a(y){m();const w=s.getGrammar(typeof y=="string"?y:y.name);if(!w)throw new A(`Language \`${y}\` not found, you may need to load it first`);return w}function c(y){if(y==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};m();const w=s.getTheme(y);if(!w)throw new A(`Theme \`${y}\` not found, you may need to load it first`);return w}function l(y){m();const w=c(y);return o!==y&&(s.setTheme(w),o=y),{theme:w,colorMap:s.getColorMap()}}function h(){return m(),s.getLoadedThemes()}function u(){return m(),s.getLoadedLanguages()}function f(...y){m(),s.loadLanguages(y.flat(1))}async function d(...y){return f(await rr(y))}function p(...y){m();for(const w of y.flat(1))s.loadTheme(w)}async function _(...y){return m(),p(await sr(y))}function m(){if(e)throw new A("Shiki instance has been disposed")}function b(){e||(e=!0,s.dispose(),Se-=1)}return{setTheme:l,getTheme:c,getLanguage:a,getLoadedThemes:h,getLoadedLanguages:u,resolveLangAlias:i,loadLanguage:d,loadLanguageSync:f,loadTheme:_,loadThemeSync:p,dispose:b,[Symbol.dispose]:b}}async function Hs(t){t.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[e,n,r]=await Promise.all([sr(t.themes||[]),rr(t.langs||[]),t.engine]);return qs({...t,themes:e,langs:n,engine:r})}const ir=new WeakMap;function rt(t,e){ir.set(t,e)}function Ne(t){return ir.get(t)}var st=class ar{constructor(...e){g(this,"_stacks",{});g(this,"lang");if(e.length===2){const[n,r]=e;this.lang=r,this._stacks=n}else{const[n,r,s]=e;this.lang=r,this._stacks={[s]:n}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,n){return new ar(Object.fromEntries(Fs(n).map(r=>[r,Rt])),e)}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return Vs(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Vs(t){const e=[],n=new Set;function r(s){var i;if(n.has(s))return;n.add(s);const o=(i=s==null?void 0:s.nameScopesList)==null?void 0:i.scopeName;o&&e.push(o),s.parent&&r(s.parent)}return r(t),e}function Xs(t,e){if(!(t instanceof st))throw new A("Invalid grammar state");return t.getInternalStack(e)}const Qs=/,/,Ks=/ /;function cr(t,e,n={}){const{theme:r=t.getLoadedThemes()[0]}=n;if(et(t.resolveLangAlias(n.lang||"text"))||tt(r))return nt(e).map(a=>[{content:a[0],offset:a[1]}]);const{theme:s,colorMap:o}=t.setTheme(r),i=t.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==i.name)throw new A(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${i.name}"`);if(!n.grammarState.themes.includes(s.name))throw new A(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${s.name}"`)}return Js(e,i,s,o,n)}function Zs(...t){if(t.length===2)return Ne(t[1]);const[e,n,r={}]=t,{lang:s="text",theme:o=e.getLoadedThemes()[0]}=r;if(et(s)||tt(o))throw new A("Plain language does not have grammar state");if(s==="ansi")throw new A("ANSI language does not have grammar state");const{theme:i,colorMap:a}=e.setTheme(o),c=e.getLanguage(s);return new st(Wt(n,c,i,a,r).stateStack,c.name,i.name)}function Js(t,e,n,r,s){const o=Wt(t,e,n,r,s),i=new st(o.stateStack,e.name,n.name);return rt(o.tokens,i),o.tokens}function Wt(t,e,n,r,s){const o=Xe(n,s),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:a=500}=s,c=nt(t);let l=s.grammarState?Xs(s.grammarState,n.name)??Rt:s.grammarContextCode!=null?Wt(s.grammarContextCode,e,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:Rt,h=[];const u=[];for(let f=0,d=c.length;f<d;f++){const[p,_]=c[f];if(p===""){h=[],u.push([]);continue}if(i>0&&p.length>=i){h=[],u.push([{content:p,offset:_,color:"",fontStyle:0}]);continue}let m,b,y;s.includeExplanation&&(m=e.tokenizeLine(p,l,a),b=m.tokens,y=0);const w=e.tokenizeLine2(p,l,a),C=w.tokens.length/2;for(let S=0;S<C;S++){const x=w.tokens[2*S],E=S+1<C?w.tokens[2*S+2]:p.length;if(x===E)continue;const G=w.tokens[2*S+1],L=re(r[we.getForeground(G)],o),z=we.getFontStyle(G),J={content:p.substring(x,E),offset:_+x,color:L,fontStyle:z};if(s.includeExplanation){const M=[];if(s.includeExplanation!=="scopeName")for(const H of n.settings){let de;switch(typeof H.scope){case"string":de=H.scope.split(Qs).map(lt=>lt.trim());break;case"object":de=H.scope;break;default:continue}M.push({settings:H,selectors:de.map(lt=>lt.split(Ks))})}J.explanation=[];let Kt=0;for(;x+Kt<E;){const H=b[y],de=p.substring(H.startIndex,H.endIndex);Kt+=de.length,J.explanation.push({content:de,scopes:s.includeExplanation==="scopeName"?Ys(H.scopes):eo(M,H.scopes)}),y+=1}}h.push(J)}u.push(h),h=[],l=w.ruleStack}return{tokens:u,stateStack:l}}function Ys(t){return t.map(e=>({scopeName:e}))}function eo(t,e){const n=[];for(let r=0,s=e.length;r<s;r++){const o=e[r];n[r]={scopeName:o,themeMatches:no(t,o,e.slice(0,r))}}return n}function dn(t,e){return t===e||e.substring(0,t.length)===t&&e[t.length]==="."}function to(t,e,n){if(!dn(t.at(-1),e))return!1;let r=t.length-2,s=n.length-1;for(;r>=0&&s>=0;)dn(t[r],n[s])&&(r-=1),s-=1;return r===-1}function no(t,e,n){const r=[];for(const{selectors:s,settings:o}of t)for(const i of s)if(to(i,e,n)){r.push(o);break}return r}function lr(t,e,n,r=cr){const s=Object.entries(n.themes).filter(l=>l[1]).map(l=>({color:l[0],theme:l[1]})),o=s.map(l=>{const h=r(t,e,{...n,theme:l.theme});return{tokens:h,state:Ne(h),theme:typeof l.theme=="string"?l.theme:l.theme.name}}),i=ro(...o.map(l=>l.tokens)),a=i[0].map((l,h)=>l.map((u,f)=>{const d={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in n&&n.includeExplanation&&(d.explanation=u.explanation),i.forEach((p,_)=>{const{content:m,explanation:b,offset:y,...w}=p[h][f];d.variants[s[_].color]=w}),d})),c=o[0].state?new st(Object.fromEntries(o.map(l=>{var h;return[l.theme,(h=l.state)==null?void 0:h.getInternalStack(l.theme)]})),o[0].state.lang):void 0;return c&&rt(a,c),a}function ro(...t){const e=t.map(()=>[]),n=t.length;for(let r=0;r<t[0].length;r++){const s=t.map(c=>c[r]),o=e.map(()=>[]);e.forEach((c,l)=>c.push(o[l]));const i=s.map(()=>0),a=s.map(c=>c[0]);for(;a.every(c=>c);){const c=Math.min(...a.map(l=>l.content.length));for(let l=0;l<n;l++){const h=a[l];h.content.length===c?(o[l].push(h),i[l]+=1,a[l]=s[l][i[l]]):(o[l].push({...h,content:h.content.slice(0,c)}),a[l]={...h,content:h.content.slice(c),offset:h.offset+c})}}}return e}const so=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"],oo=/["&'<>`]/g,io=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ao=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,co=/[|\\{}()[\]^$+*?.]/g,pn=new WeakMap;function lo(t,e){if(t=t.replace(e.subset?uo(e.subset):oo,r),e.subset||e.escapeOnly)return t;return t.replace(io,n).replace(ao,r);function n(s,o,i){return e.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,i.charCodeAt(o+2),e)}function r(s,o,i){return e.format(s.charCodeAt(0),i.charCodeAt(o+1),e)}}function uo(t){let e=pn.get(t);return e||(e=ho(t),pn.set(t,e)),e}function ho(t){const e=[];let n=-1;for(;++n<t.length;)e.push(t[n].replace(co,"\\$&"));return new RegExp("(?:"+e.join("|")+")","g")}const fo=/[\dA-Fa-f]/;function po(t,e,n){const r="&#x"+t.toString(16).toUpperCase();return n&&e&&!fo.test(String.fromCharCode(e))?r:r+";"}const go=/\d/;function mo(t,e,n){const r="&#"+String(t);return n&&e&&!go.test(String.fromCharCode(e))?r:r+";"}const yo=["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"],gt={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:"€"},_o=["cent","copy","divide","gt","lt","not","para","times"],ur={}.hasOwnProperty,$t={};let Ge;for(Ge in gt)ur.call(gt,Ge)&&($t[gt[Ge]]=Ge);const wo=/[^\dA-Za-z]/;function bo(t,e,n,r){const s=String.fromCharCode(t);if(ur.call($t,s)){const o=$t[s],i="&"+o;return n&&yo.includes(o)&&!_o.includes(o)&&(!r||e&&e!==61&&wo.test(String.fromCharCode(e)))?i:i+";"}return""}function Co(t,e,n){let r=po(t,e,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=bo(t,e,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const o=mo(t,e,n.omitOptionalSemicolons);o.length<r.length&&(r=o)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function _e(t,e){return lo(t,Object.assign({format:Co},e))}const So=/^>|^->|<!--|-->|--!>|<!-$/g,ko=[">"],xo=["<",">"];function Eo(t,e,n,r){return r.settings.bogusComments?"<?"+_e(t.value,Object.assign({},r.settings.characterReferences,{subset:ko}))+">":"<!--"+t.value.replace(So,s)+"-->";function s(o){return _e(o,Object.assign({},r.settings.characterReferences,{subset:xo}))}}function Ao(t,e,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}const N=fr(1),hr=fr(-1),vo=[];function fr(t){return e;function e(n,r,s){const o=n?n.children:vo;let i=(r||0)+t,a=o[i];if(!s)for(;a&&Dt(a);)i+=t,a=o[i];return a}}const Io={}.hasOwnProperty;function dr(t){return e;function e(n,r,s){return Io.call(t,n.tagName)&&t[n.tagName](n,r,s)}}const zt=dr({body:Ro,caption:mt,colgroup:mt,dd:To,dt:Lo,head:mt,html:No,li:Po,optgroup:Go,option:Mo,p:$o,rp:gn,rt:gn,tbody:Bo,td:mn,tfoot:Fo,th:mn,thead:Oo,tr:Do});function mt(t,e,n){const r=N(n,e,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&Dt(r.value.charAt(0)))}function No(t,e,n){const r=N(n,e);return!r||r.type!=="comment"}function Ro(t,e,n){const r=N(n,e);return!r||r.type!=="comment"}function $o(t,e,n){const r=N(n,e);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function Po(t,e,n){const r=N(n,e);return!r||r.type==="element"&&r.tagName==="li"}function Lo(t,e,n){const r=N(n,e);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function To(t,e,n){const r=N(n,e);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function gn(t,e,n){const r=N(n,e);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Go(t,e,n){const r=N(n,e);return!r||r.type==="element"&&r.tagName==="optgroup"}function Mo(t,e,n){const r=N(n,e);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Oo(t,e,n){const r=N(n,e);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Bo(t,e,n){const r=N(n,e);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Fo(t,e,n){return!N(n,e)}function Do(t,e,n){const r=N(n,e);return!r||r.type==="element"&&r.tagName==="tr"}function mn(t,e,n){const r=N(n,e);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const jo=dr({body:zo,colgroup:qo,head:Wo,html:Uo,tbody:Ho});function Uo(t){const e=N(t,-1);return!e||e.type!=="comment"}function Wo(t){const e=new Set;for(const r of t.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(e.has(r.tagName))return!1;e.add(r.tagName)}const n=t.children[0];return!n||n.type==="element"}function zo(t){const e=N(t,-1,!0);return!e||e.type!=="comment"&&!(e.type==="text"&&Dt(e.value.charAt(0)))&&!(e.type==="element"&&(e.tagName==="meta"||e.tagName==="link"||e.tagName==="script"||e.tagName==="style"||e.tagName==="template"))}function qo(t,e,n){const r=hr(n,e),s=N(t,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&zt(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function Ho(t,e,n){const r=hr(n,e),s=N(t,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&zt(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const Me={name:[[`
|
|
4
|
+
\f\r &/=>`.split(""),`
|
|
5
|
+
\f\r "&'/=>\``.split("")],[`\0
|
|
6
|
+
\f\r "&'/<=>`.split(""),`\0
|
|
7
|
+
\f\r "&'/<=>\``.split("")]],unquoted:[[`
|
|
8
|
+
\f\r &>`.split(""),`\0
|
|
9
|
+
\f\r "&'<=>\``.split("")],[`\0
|
|
10
|
+
\f\r "&'<=>\``.split(""),`\0
|
|
11
|
+
\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function Vo(t,e,n,r){const s=r.schema,o=s.space==="svg"?!1:r.settings.omitOptionalTags;let i=s.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(t.tagName.toLowerCase());const a=[];let c;s.space==="html"&&t.tagName==="svg"&&(r.schema=Dn);const l=Xo(r,t.properties),h=r.all(s.space==="html"&&t.tagName==="template"?t.content:t);return r.schema=s,h&&(i=!1),(l||!o||!jo(t,e,n))&&(a.push("<",t.tagName,l?" "+l:""),i&&(s.space==="svg"||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c==="/"||c&&c!=='"'&&c!=="'")&&a.push(" "),a.push("/")),a.push(">")),a.push(h),!i&&(!o||!zt(t,e,n))&&a.push("</"+t.tagName+">"),a.join("")}function Xo(t,e){const n=[];let r=-1,s;if(e){for(s in e)if(e[s]!==null&&e[s]!==void 0){const o=Qo(t,s,e[s]);o&&n.push(o)}}for(;++r<n.length;){const o=t.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&o!=='"'&&o!=="'"&&(n[r]+=" ")}return n.join("")}function Qo(t,e,n){const r=Hr(t.schema,e),s=t.settings.allowParseErrors&&t.schema.space==="html"?0:1,o=t.settings.allowDangerousCharacters?0:1;let i=t.quote,a;if(r.overloadedBoolean&&(n===r.attribute||n==="")?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!="string"||n===r.attribute||n==="")&&(n=!!n),n==null||n===!1||typeof n=="number"&&Number.isNaN(n))return"";const c=_e(r.attribute,Object.assign({},t.settings.characterReferences,{subset:Me.name[s][o]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Vr:Xr)(n,{padLeft:!t.settings.tightCommaSeparatedLists}):String(n),t.settings.collapseEmptyAttributes&&!n)?c:(t.settings.preferUnquoted&&(a=_e(n,Object.assign({},t.settings.characterReferences,{attribute:!0,subset:Me.unquoted[s][o]}))),a!==n&&(t.settings.quoteSmart&&Yt(n,i)>Yt(n,t.alternative)&&(i=t.alternative),a=i+_e(n,Object.assign({},t.settings.characterReferences,{subset:(i==="'"?Me.single:Me.double)[s][o],attribute:!0}))+i),c+(a&&"="+a))}const Ko=["<","&"];function pr(t,e,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?t.value:_e(t.value,Object.assign({},r.settings.characterReferences,{subset:Ko}))}function Zo(t,e,n,r){return r.settings.allowDangerousHtml?t.value:pr(t,e,n,r)}function Jo(t,e,n,r){return r.all(t)}const Yo=Qr("type",{invalid:ei,unknown:ti,handlers:{comment:Eo,doctype:Ao,element:Vo,raw:Zo,root:Jo,text:pr}});function ei(t){throw new Error("Expected node, not `"+t+"`")}function ti(t){const e=t;throw new Error("Cannot compile unknown node `"+e.type+"`")}const ni={},ri={},si=[];function oi(t,e){const n=e||ni,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:ii,all:ai,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||so,characterReferences:n.characterReferences||ri,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?Dn:Kr,quote:r,alternative:s}.one(Array.isArray(t)?{type:"root",children:t}:t,void 0,void 0)}function ii(t,e,n){return Yo(t,e,n,this)}function ai(t){const e=[],n=t&&t.children||si;let r=-1;for(;++r<n.length;)e[r]=this.one(n[r],r,t);return e.join("")}const yn=/\s+/g;function gr(t,e){var r;if(!e)return t;t.properties||(t.properties={}),(r=t.properties).class||(r.class=[]),typeof t.properties.class=="string"&&(t.properties.class=t.properties.class.split(yn)),Array.isArray(t.properties.class)||(t.properties.class=[]);const n=Array.isArray(e)?e:e.split(yn);for(const s of n)s&&!t.properties.class.includes(s)&&t.properties.class.push(s);return t}function ci(t){const e=nt(t,!0).map(([s])=>s);function n(s){if(s===t.length)return{line:e.length-1,character:e.at(-1).length};let o=s,i=0;for(const a of e){if(o<a.length)break;o-=a.length,i++}return{line:i,character:o}}function r(s,o){let i=0;for(let a=0;a<s;a++)i+=e[a].length;return i+=o,i}return{lines:e,indexToPos:n,posToIndex:r}}const li=["color","background-color"];function ui(t,e){let n=0;const r=[];for(const s of e)s>n&&r.push({...t,content:t.content.slice(n,s),offset:t.offset+n}),n=s;return n<t.content.length&&r.push({...t,content:t.content.slice(n),offset:t.offset+n}),r}function hi(t,e){const n=[...e instanceof Set?e:new Set(e)].sort((r,s)=>r-s);return n.length?t.map(r=>r.flatMap(s=>{const o=n.filter(i=>s.offset<i&&i<s.offset+s.content.length).map(i=>i-s.offset).sort((i,a)=>i-a);return o.length?ui(s,o):s})):t}function fi(t,e,n,r,s="css-vars"){const o={content:t.content,explanation:t.explanation,offset:t.offset},i=e.map(h=>Qe(t.variants[h])),a=new Set(i.flatMap(h=>Object.keys(h))),c={},l=(h,u)=>{const f=u==="color"?"":u==="background-color"?"-bg":`-${u}`;return n+e[h]+(u==="color"?"":f)};return i.forEach((h,u)=>{for(const f of a){const d=h[f]||"inherit";if(u===0&&r&&li.includes(f))if(r==="light-dark()"&&i.length>1){const p=e.findIndex(m=>m==="light"),_=e.findIndex(m=>m==="dark");if(p===-1||_===-1)throw new A('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');c[f]=`light-dark(${i[p][f]||"inherit"}, ${i[_][f]||"inherit"})`,s==="css-vars"&&(c[l(u,f)]=d)}else c[f]=d;else s==="css-vars"&&(c[l(u,f)]=d)}}),o.htmlStyle=c,o}function Qe(t){const e={};if(t.color&&(e.color=t.color),t.bgColor&&(e["background-color"]=t.bgColor),t.fontStyle){t.fontStyle&P.Italic&&(e["font-style"]="italic"),t.fontStyle&P.Bold&&(e["font-weight"]="bold");const n=[];t.fontStyle&P.Underline&&n.push("underline"),t.fontStyle&P.Strikethrough&&n.push("line-through"),n.length&&(e["text-decoration"]=n.join(" "))}return e}function Pt(t){return typeof t=="string"?t:Object.entries(t).map(([e,n])=>`${e}:${n}`).join(";")}function di(){const t=new WeakMap;function e(n){if(!t.has(n.meta)){let s=function(i){if(typeof i=="number"){if(i<0||i>n.source.length)throw new A(`Invalid decoration offset: ${i}. Code length: ${n.source.length}`);return{...r.indexToPos(i),offset:i}}else{const a=r.lines[i.line];if(a===void 0)throw new A(`Invalid decoration position ${JSON.stringify(i)}. Lines length: ${r.lines.length}`);let c=i.character;if(c<0&&(c=a.length+c),c<0||c>a.length)throw new A(`Invalid decoration position ${JSON.stringify(i)}. Line ${i.line} length: ${a.length}`);return{...i,character:c,offset:r.posToIndex(i.line,c)}}};const r=ci(n.source),o=(n.options.decorations||[]).map(i=>({...i,start:s(i.start),end:s(i.end)}));pi(o),t.set(n.meta,{decorations:o,converter:r,source:n.source})}return t.get(n.meta)}return{name:"shiki:decorations",tokens(n){var r;if((r=this.options.decorations)!=null&&r.length)return hi(n,e(this).decorations.flatMap(s=>[s.start.offset,s.end.offset]))},code(n){var h;if(!((h=this.options.decorations)!=null&&h.length))return;const r=e(this),s=[...n.children].filter(u=>u.type==="element"&&u.tagName==="span");if(s.length!==r.converter.lines.length)throw new A(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${r.converter.lines.length}). Failed to apply decorations.`);function o(u,f,d,p){const _=s[u];let m="",b=-1,y=-1;if(f===0&&(b=0),d===0&&(y=0),d===Number.POSITIVE_INFINITY&&(y=_.children.length),b===-1||y===-1)for(let C=0;C<_.children.length;C++)m+=mr(_.children[C]),b===-1&&m.length===f&&(b=C+1),y===-1&&m.length===d&&(y=C+1);if(b===-1)throw new A(`Failed to find start index for decoration ${JSON.stringify(p.start)}`);if(y===-1)throw new A(`Failed to find end index for decoration ${JSON.stringify(p.end)}`);const w=_.children.slice(b,y);if(!p.alwaysWrap&&w.length===_.children.length)a(_,p,"line");else if(!p.alwaysWrap&&w.length===1&&w[0].type==="element")a(w[0],p,"token");else{const C={type:"element",tagName:"span",properties:{},children:w};a(C,p,"wrapper"),_.children.splice(b,w.length,C)}}function i(u,f){s[u]=a(s[u],f,"line")}function a(u,f,d){var m;const p=f.properties||{},_=f.transform||(b=>b);return u.tagName=f.tagName||"span",u.properties={...u.properties,...p,class:u.properties.class},(m=f.properties)!=null&&m.class&&gr(u,f.properties.class),u=_(u,d)||u,u}const c=[],l=r.decorations.sort((u,f)=>f.start.offset-u.start.offset||u.end.offset-f.end.offset);for(const u of l){const{start:f,end:d}=u;if(f.line===d.line)o(f.line,f.character,d.character,u);else if(f.line<d.line){o(f.line,f.character,Number.POSITIVE_INFINITY,u);for(let p=f.line+1;p<d.line;p++)c.unshift(()=>i(p,u));o(d.line,0,d.character,u)}}c.forEach(u=>u())}}}function pi(t){for(let e=0;e<t.length;e++){const n=t[e];if(n.start.offset>n.end.offset)throw new A(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=e+1;r<t.length;r++){const s=t[r],o=n.start.offset<=s.start.offset&&s.start.offset<n.end.offset,i=n.start.offset<s.end.offset&&s.end.offset<=n.end.offset,a=s.start.offset<=n.start.offset&&n.start.offset<s.end.offset,c=s.start.offset<n.end.offset&&n.end.offset<=s.end.offset;if(o||i||a||c){if(o&&i||a&&c||a&&n.start.offset===n.end.offset||i&&s.start.offset===s.end.offset)continue;throw new A(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function mr(t){return t.type==="text"?t.value:t.type==="element"?t.children.map(mr).join(""):""}const gi=[di()];function Ke(t){const e=mi(t.transformers||[]);return[...e.pre,...e.normal,...e.post,...gi]}function mi(t){const e=[],n=[],r=[];for(const s of t)switch(s.enforce){case"pre":e.push(s);break;case"post":n.push(s);break;default:r.push(s)}return{pre:e,post:n,normal:r}}var ce=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],yt={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function yi(t,e){const n=t.indexOf("\x1B",e);if(n!==-1&&t[n+1]==="["){const r=t.indexOf("m",n);if(r!==-1)return{sequence:t.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:t.length}}function _n(t){const e=t.shift();if(e==="2"){const n=t.splice(0,3).map(r=>Number.parseInt(r));return n.length!==3||n.some(r=>Number.isNaN(r))?void 0:{type:"rgb",rgb:n}}else if(e==="5"){const n=t.shift();if(n)return{type:"table",index:Number(n)}}}function _i(t){const e=[];for(;t.length>0;){const n=t.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)e.push({type:"resetAll"});else if(r<=9)yt[r]&&e.push({type:"setDecoration",value:yt[r]});else if(r<=29){const s=yt[r-20];s&&(e.push({type:"resetDecoration",value:s}),s==="dim"&&e.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)e.push({type:"setForegroundColor",value:{type:"named",name:ce[r-30]}});else if(r===38){const s=_n(t);s&&e.push({type:"setForegroundColor",value:s})}else if(r===39)e.push({type:"resetForegroundColor"});else if(r<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:ce[r-40]}});else if(r===48){const s=_n(t);s&&e.push({type:"setBackgroundColor",value:s})}else r===49?e.push({type:"resetBackgroundColor"}):r===53?e.push({type:"setDecoration",value:"overline"}):r===55?e.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?e.push({type:"setForegroundColor",value:{type:"named",name:ce[r-90+8]}}):r>=100&&r<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:ce[r-100+8]}})}return e}function wi(){let t=null,e=null,n=new Set;return{parse(r){const s=[];let o=0;do{const i=yi(r,o),a=i.sequence?r.substring(o,i.startPosition):r.substring(o);if(a.length>0&&s.push({value:a,foreground:t,background:e,decorations:new Set(n)}),i.sequence){const c=_i(i.sequence);for(const l of c)l.type==="resetAll"?(t=null,e=null,n.clear()):l.type==="resetForegroundColor"?t=null:l.type==="resetBackgroundColor"?e=null:l.type==="resetDecoration"&&n.delete(l.value);for(const l of c)l.type==="setForegroundColor"?t=l.value:l.type==="setBackgroundColor"?e=l.value:l.type==="setDecoration"&&n.add(l.value)}o=i.position}while(o<r.length);return s}}}var bi={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 Ci(t=bi){function e(a){return t[a]}function n(a){return`#${a.map(c=>Math.max(0,Math.min(c,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let l=0;l<ce.length;l++)r.push(e(ce[l]));let a=[0,95,135,175,215,255];for(let l=0;l<6;l++)for(let h=0;h<6;h++)for(let u=0;u<6;u++)r.push(n([a[l],a[h],a[u]]));let c=8;for(let l=0;l<24;l++,c+=10)r.push(n([c,c,c]));return r}function o(a){return s()[a]}function i(a){switch(a.type){case"named":return e(a.name);case"rgb":return n(a.rgb);case"table":return o(a.index)}}return{value:i}}const Si=/#([0-9a-f]{3,8})/i,ki=/var\((--[\w-]+-ansi-[\w-]+)\)/,xi={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 Ei(t,e,n){const r=Xe(t,n),s=nt(e),o=Ci(Object.fromEntries(ce.map(a=>{var l;const c=`terminal.ansi${a[0].toUpperCase()}${a.substring(1)}`;return[a,((l=t.colors)==null?void 0:l[c])||xi[a]]}))),i=wi();return s.map(a=>i.parse(a[0]).map(c=>{let l,h;c.decorations.has("reverse")?(l=c.background?o.value(c.background):t.bg,h=c.foreground?o.value(c.foreground):t.fg):(l=c.foreground?o.value(c.foreground):t.fg,h=c.background?o.value(c.background):void 0),l=re(l,r),h=re(h,r),c.decorations.has("dim")&&(l=Ai(l));let u=P.None;return c.decorations.has("bold")&&(u|=P.Bold),c.decorations.has("italic")&&(u|=P.Italic),c.decorations.has("underline")&&(u|=P.Underline),c.decorations.has("strikethrough")&&(u|=P.Strikethrough),{content:c.value,offset:a[1],color:l,bgColor:h,fontStyle:u}}))}function Ai(t){const e=t.match(Si);if(e){const r=e[1];if(r.length===8){const s=Math.round(Number.parseInt(r.slice(6,8),16)/2).toString(16).padStart(2,"0");return`#${r.slice(0,6)}${s}`}else{if(r.length===6)return`#${r}80`;if(r.length===4){const s=r[0],o=r[1],i=r[2],a=r[3];return`#${s}${s}${o}${o}${i}${i}${Math.round(Number.parseInt(`${a}${a}`,16)/2).toString(16).padStart(2,"0")}`}else if(r.length===3){const s=r[0],o=r[1],i=r[2];return`#${s}${s}${o}${o}${i}${i}80`}}}const n=t.match(ki);return n?`var(${n[1]}-dim)`:t}function Lt(t,e,n={}){const r=t.resolveLangAlias(n.lang||"text"),{theme:s=t.getLoadedThemes()[0]}=n;if(!et(r)&&!tt(s)&&r==="ansi"){const{theme:o}=t.setTheme(s);return Ei(o,e,n)}return cr(t,e,n)}function Ze(t,e,n){let r,s,o,i,a,c;if("themes"in n){const{defaultColor:l="light",cssVariablePrefix:h="--shiki-",colorsRendering:u="css-vars"}=n,f=Object.entries(n.themes).filter(b=>b[1]).map(b=>({color:b[0],theme:b[1]})).sort((b,y)=>b.color===l?-1:y.color===l?1:0);if(f.length===0)throw new A("`themes` option must not be empty");const d=lr(t,e,n,Lt);if(c=Ne(d),l&&l!=="light-dark()"&&!f.some(b=>b.color===l))throw new A(`\`themes\` option must contain the defaultColor key \`${l}\``);const p=f.map(b=>t.getTheme(b.theme)),_=f.map(b=>b.color);o=d.map(b=>b.map(y=>fi(y,_,h,l,u))),c&&rt(o,c);const m=f.map(b=>Xe(b.theme,n));s=wn(f,p,m,h,l,"fg",u),r=wn(f,p,m,h,l,"bg",u),i=`shiki-themes ${p.map(b=>b.name).join(" ")}`,a=l?void 0:[s,r].join(";")}else if("theme"in n){const l=Xe(n.theme,n);o=Lt(t,e,n);const h=t.getTheme(n.theme);r=re(h.bg,l),s=re(h.fg,l),i=h.name,c=Ne(o)}else throw new A("Invalid options, either `theme` or `themes` must be provided");return{tokens:o,fg:s,bg:r,themeName:i,rootStyle:a,grammarState:c}}function wn(t,e,n,r,s,o,i){return t.map((a,c)=>{const l=re(e[c][o],n[c])||"inherit",h=`${r+a.color}${o==="bg"?"-bg":""}:${l}`;if(c===0&&s){if(s==="light-dark()"&&t.length>1){const u=t.findIndex(d=>d.color==="light"),f=t.findIndex(d=>d.color==="dark");if(u===-1||f===-1)throw new A('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${re(e[u][o],n[u])||"inherit"}, ${re(e[f][o],n[f])||"inherit"});${h}`}return l}return i==="css-vars"?h:null}).filter(a=>!!a).join(";")}const yr=/^\s+$/,vi=/^(\s*)(.*?)(\s*)$/;function Je(t,e,n,r={meta:{},options:n,codeToHast:(s,o)=>Je(t,s,o),codeToTokens:(s,o)=>Ze(t,s,o)}){var p,_;let s=e;for(const m of Ke(n))s=((p=m.preprocess)==null?void 0:p.call(r,s,n))||s;let{tokens:o,fg:i,bg:a,themeName:c,rootStyle:l,grammarState:h}=Ze(t,s,n);const{mergeWhitespaces:u=!0,mergeSameStyleTokens:f=!1}=n;u===!0?o=Ni(o):u==="never"&&(o=Ri(o)),f&&(o=$i(o));const d={...r,get source(){return s}};for(const m of Ke(n))o=((_=m.tokens)==null?void 0:_.call(d,o))||o;return Ii(o,{...n,fg:i,bg:a,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},d,h)}function Ii(t,e,n,r=Ne(t)){var _,m,b,y;const s=Ke(e),o=[],i={type:"root",children:[]},{structure:a="classic",tabindex:c="0"}=e,l={class:`shiki ${e.themeName||""}`};e.rootStyle!==!1&&(e.rootStyle!=null?l.style=e.rootStyle:l.style=`background-color:${e.bg};color:${e.fg}`),c!==!1&&c!=null&&(l.tabindex=c.toString());for(const[w,C]of Object.entries(e.meta||{}))w.startsWith("_")||(l[w]=C);let h={type:"element",tagName:"pre",properties:l,children:[],data:e.data},u={type:"element",tagName:"code",properties:{},children:o};const f=[],d={...n,structure:a,addClassToHast:gr,get source(){return n.source},get tokens(){return t},get options(){return e},get root(){return i},get pre(){return h},get code(){return u},get lines(){return f}};if(t.forEach((w,C)=>{var E,G;C&&(a==="inline"?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):a==="classic"&&o.push({type:"text",value:`
|
|
12
|
+
`}));let S={type:"element",tagName:"span",properties:{class:"line"},children:[]},x=0;for(const L of w){let z={type:"element",tagName:"span",properties:{...L.htmlAttrs},children:[{type:"text",value:L.content}]};const J=Pt(L.htmlStyle||Qe(L));J&&(z.properties.style=J);for(const M of s)z=((E=M==null?void 0:M.span)==null?void 0:E.call(d,z,C+1,x,S,L))||z;a==="inline"?i.children.push(z):a==="classic"&&S.children.push(z),x+=L.content.length}if(a==="classic"){for(const L of s)S=((G=L==null?void 0:L.line)==null?void 0:G.call(d,S,C+1))||S;f.push(S),o.push(S)}else a==="inline"&&f.push(S)}),a==="classic"){for(const w of s)u=((_=w==null?void 0:w.code)==null?void 0:_.call(d,u))||u;h.children.push(u);for(const w of s)h=((m=w==null?void 0:w.pre)==null?void 0:m.call(d,h))||h;i.children.push(h)}else if(a==="inline"){const w=[];let C={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const x of i.children)x.type==="element"&&x.tagName==="br"?(w.push(C),C={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(x.type==="element"||x.type==="text")&&C.children.push(x);w.push(C);let S={type:"element",tagName:"code",properties:{},children:w};for(const x of s)S=((b=x==null?void 0:x.code)==null?void 0:b.call(d,S))||S;i.children=[];for(let x=0;x<S.children.length;x++){x>0&&i.children.push({type:"element",tagName:"br",properties:{},children:[]});const E=S.children[x];E.type==="element"&&i.children.push(...E.children)}}let p=i;for(const w of s)p=((y=w==null?void 0:w.root)==null?void 0:y.call(d,p))||p;return r&&rt(p,r),p}function Ni(t){return t.map(e=>{const n=[];let r="",s;return e.forEach((o,i)=>{const a=!(o.fontStyle&&(o.fontStyle&P.Underline||o.fontStyle&P.Strikethrough));a&&yr.test(o.content)&&e[i+1]?(s===void 0&&(s=o.offset),r+=o.content):r?(a?n.push({...o,offset:s,content:r+o.content}):n.push({content:r,offset:s},o),s=void 0,r=""):n.push(o)}),n})}function Ri(t){return t.map(e=>e.flatMap(n=>{if(yr.test(n.content))return n;const r=n.content.match(vi);if(!r)return n;const[,s,o,i]=r;if(!s&&!i)return n;const a=[{...n,offset:n.offset+s.length,content:o}];return s&&a.unshift({content:s,offset:n.offset}),i&&a.push({content:i,offset:n.offset+s.length+o.length}),a}))}function $i(t){return t.map(e=>{const n=[];for(const r of e){if(n.length===0){n.push({...r});continue}const s=n.at(-1),o=Pt(s.htmlStyle||Qe(s)),i=Pt(r.htmlStyle||Qe(r)),a=s.fontStyle&&(s.fontStyle&P.Underline||s.fontStyle&P.Strikethrough),c=r.fontStyle&&(r.fontStyle&P.Underline||r.fontStyle&P.Strikethrough);!a&&!c&&o===i?s.content+=r.content:n.push({...r})}return n})}const Pi=oi;function Li(t,e,n){var o;const r={meta:{},options:n,codeToHast:(i,a)=>Je(t,i,a),codeToTokens:(i,a)=>Ze(t,i,a)};let s=Pi(Je(t,e,n,r));for(const i of Ke(n))s=((o=i.postprocess)==null?void 0:o.call(r,s,n))||s;return s}async function kc(t){const e=await Hs(t);return{getLastGrammarState:(...n)=>Zs(e,...n),codeToTokensBase:(n,r)=>Lt(e,n,r),codeToTokensWithThemes:(n,r)=>lr(e,n,r),codeToTokens:(n,r)=>Ze(e,n,r),codeToHast:(n,r)=>Je(e,n,r),codeToHtml:(n,r)=>Li(e,n,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...e,getInternalContext:()=>e}}const bn=4294967295;var Ti=class{constructor(t,e={}){g(this,"patterns");g(this,"options");g(this,"regexps");this.patterns=t,this.options=e;const{forgiving:n=!1,cache:r,regexConstructor:s}=e;if(!s)throw new Error("Option `regexConstructor` is not provided");this.regexps=t.map(o=>{if(typeof o!="string")return o;const i=r==null?void 0:r.get(o);if(i){if(i instanceof RegExp)return i;if(n)return null;throw i}try{const a=s(o);return r==null||r.set(o,a),a}catch(a){if(r==null||r.set(o,a),n)return null;throw a}})}findNextMatchSync(t,e,n){const r=typeof t=="string"?t:t.content,s=[];function o(i,a,c=0){return{index:i,captureIndices:a.indices.map(l=>l==null?{start:bn,end:bn,length:0}:{start:l[0]+c,end:l[1]+c,length:l[1]-l[0]})}}for(let i=0;i<this.regexps.length;i++){const a=this.regexps[i];if(a)try{a.lastIndex=e;const c=a.exec(r);if(!c)continue;if(c.index===e)return o(i,c,0);s.push([i,c,0])}catch(c){if(this.options.forgiving)continue;throw c}}if(s.length){const i=Math.min(...s.map(a=>a[1].index));for(const[a,c,l]of s)if(c.index===i)return o(a,c,l)}return null}};function be(t){if([...t].length!==1)throw new Error(`Expected "${t}" to be a single code point`);return t.codePointAt(0)}function Gi(t,e,n){return t.has(e)||t.set(e,n),t.get(e)}const qt=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),R=String.raw;function Ce(t,e){if(t==null)throw new Error(e??"Value expected");return t}const _r=R`\[\^?`,wr=`c.? | C(?:-.?)?|${R`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${R`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${R`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${R`o\{[^\}]*\}?`}|${R`\d{1,3}`}`,Ht=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Oe=new RegExp(R`
|
|
13
|
+
\\ (?:
|
|
14
|
+
${wr}
|
|
15
|
+
| [gk]<[^>]*>?
|
|
16
|
+
| [gk]'[^']*'?
|
|
17
|
+
| .
|
|
18
|
+
)
|
|
19
|
+
| \( (?:
|
|
20
|
+
\? (?:
|
|
21
|
+
[:=!>({]
|
|
22
|
+
| <[=!]
|
|
23
|
+
| <[^>]*>
|
|
24
|
+
| '[^']*'
|
|
25
|
+
| ~\|?
|
|
26
|
+
| #(?:[^)\\]|\\.?)*
|
|
27
|
+
| [^:)]*[:)]
|
|
28
|
+
)?
|
|
29
|
+
| \*[^\)]*\)?
|
|
30
|
+
)?
|
|
31
|
+
| (?:${Ht.source})+
|
|
32
|
+
| ${_r}
|
|
33
|
+
| .
|
|
34
|
+
`.replace(/\s+/g,""),"gsu"),_t=new RegExp(R`
|
|
35
|
+
\\ (?:
|
|
36
|
+
${wr}
|
|
37
|
+
| .
|
|
38
|
+
)
|
|
39
|
+
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
40
|
+
| ${_r}
|
|
41
|
+
| &&
|
|
42
|
+
| .
|
|
43
|
+
`.replace(/\s+/g,""),"gsu");function Mi(t,e={}){const n={flags:"",...e,rules:{captureGroup:!1,singleline:!1,...e.rules}};if(typeof t!="string")throw new Error("String expected as pattern");const r=ta(n.flags),s=[r.extended],o={captureGroup:n.rules.captureGroup,getCurrentModX(){return s.at(-1)},numOpenGroups:0,popModX(){s.pop()},pushModX(u){s.push(u)},replaceCurrentModX(u){s[s.length-1]=u},singleline:n.rules.singleline};let i=[],a;for(Oe.lastIndex=0;a=Oe.exec(t);){const u=Oi(o,t,a[0],Oe.lastIndex);u.tokens?i.push(...u.tokens):u.token&&i.push(u.token),u.lastIndex!==void 0&&(Oe.lastIndex=u.lastIndex)}const c=[];let l=0;i.filter(u=>u.type==="GroupOpen").forEach(u=>{u.kind==="capturing"?u.number=++l:u.raw==="("&&c.push(u)}),l||c.forEach((u,f)=>{u.kind="capturing",u.number=f+1});const h=l||c.length;return{tokens:i.map(u=>u.type==="EscapedNumber"?ra(u,h):u).flat(),flags:r}}function Oi(t,e,n,r){const[s,o]=n;if(n==="["||n==="[^"){const i=Bi(e,n,r);return{tokens:i.tokens,lastIndex:i.lastIndex}}if(s==="\\"){if("AbBGyYzZ".includes(o))return{token:Cn(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:Xi(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:Cr(n)}}if(o==="K")return{token:Sr("keep",n)};if(o==="N"||o==="R")return{token:le("newline",n,{negate:o==="N"})};if(o==="O")return{token:le("any",n)};if(o==="X")return{token:le("text_segment",n)};const i=br(n,{inCharClass:!1});return Array.isArray(i)?{tokens:i}:{token:i}}if(s==="("){if(o==="*")return{token:Ji(n)};if(n==="(?{")throw new Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(e[r]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:Zi(n,t)};if(t.pushModX(t.getCurrentModX()),t.numOpenGroups++,n==="("&&!t.captureGroup||n==="(?:")return{token:me("group",n)};if(n==="(?>")return{token:me("atomic",n)};if(n==="(?="||n==="(?!"||n==="(?<="||n==="(?<!")return{token:me(n[2]==="<"?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if(n==="("&&t.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:me("capturing",n,{...n!=="("&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if(n==="(?~|")throw new Error(`Unsupported absence function kind "${n}"`);return{token:me("absence_repeater",n)}}throw n==="(?("?new Error(`Unsupported conditional "${n}"`):new Error(`Invalid or unsupported group option "${n}"`)}if(n===")"){if(t.popModX(),t.numOpenGroups--,t.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:qi(n)}}if(t.getCurrentModX()){if(n==="#"){const i=e.indexOf(`
|
|
44
|
+
`,r);return{lastIndex:i===-1?e.length:i}}if(/^\s$/.test(n)){const i=/\s+/y;return i.lastIndex=r,{lastIndex:i.exec(e)?i.lastIndex:r}}}if(n===".")return{token:le("dot",n)};if(n==="^"||n==="$"){const i=t.singleline?{"^":R`\A`,$:R`\Z`}[n]:n;return{token:Cn(i,n)}}return n==="|"?{token:Di(n)}:Ht.test(n)?{tokens:sa(n)}:{token:Z(be(n),n)}}function Bi(t,e,n){const r=[Sn(e[1]==="^",e)];let s=1,o;for(_t.lastIndex=n;o=_t.exec(t);){const i=o[0];if(i[0]==="["&&i[1]!==":")s++,r.push(Sn(i[1]==="^",i));else if(i==="]"){if(r.at(-1).type==="CharacterClassOpen")r.push(Z(93,i));else if(s--,r.push(ji(i)),!s)break}else{const a=Fi(i);Array.isArray(a)?r.push(...a):r.push(a)}}return{tokens:r,lastIndex:_t.lastIndex||t.length}}function Fi(t){if(t[0]==="\\")return br(t,{inCharClass:!0});if(t[0]==="["){const e=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(t);if(!e||!qt.has(e.groups.name))throw new Error(`Invalid POSIX class "${t}"`);return le("posix",t,{value:e.groups.name,negate:!!e.groups.negate})}return t==="-"?Ui(t):t==="&&"?Wi(t):Z(be(t),t)}function br(t,{inCharClass:e}){const n=t[1];if(n==="c"||n==="C")return Ki(t);if("dDhHsSwW".includes(n))return Yi(t);if(t.startsWith(R`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${t}"`);if(/^\\[pP]\{/.test(t)){if(t.length===3)throw new Error(`Incomplete or invalid Unicode property "${t}"`);return ea(t)}if(new RegExp("^\\\\x[89A-Fa-f]\\p{AHex}","u").test(t))try{const r=t.split(/\\x/).slice(1).map(i=>parseInt(i,16)),s=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(r)),o=new TextEncoder;return[...s].map(i=>{const a=[...o.encode(i)].map(c=>`\\x${c.toString(16)}`).join("");return Z(be(i),a)})}catch{throw new Error(`Multibyte code "${t}" incomplete or invalid in Oniguruma`)}if(n==="u"||n==="x")return Z(na(t),t);if(kn.has(n))return Z(kn.get(n),t);if(/\d/.test(n))return zi(e,t);if(t==="\\")throw new Error(R`Incomplete escape "\"`);if(n==="M")throw new Error(`Unsupported meta "${t}"`);if([...t].length===2)return Z(t.codePointAt(1),t);throw new Error(`Unexpected escape "${t}"`)}function Di(t){return{type:"Alternator",raw:t}}function Cn(t,e){return{type:"Assertion",kind:t,raw:e}}function Cr(t){return{type:"Backreference",raw:t}}function Z(t,e){return{type:"Character",value:t,raw:e}}function ji(t){return{type:"CharacterClassClose",raw:t}}function Ui(t){return{type:"CharacterClassHyphen",raw:t}}function Wi(t){return{type:"CharacterClassIntersector",raw:t}}function Sn(t,e){return{type:"CharacterClassOpen",negate:t,raw:e}}function le(t,e,n={}){return{type:"CharacterSet",kind:t,...n,raw:e}}function Sr(t,e,n={}){return t==="keep"?{type:"Directive",kind:t,raw:e}:{type:"Directive",kind:t,flags:Ce(n.flags),raw:e}}function zi(t,e){return{type:"EscapedNumber",inCharClass:t,raw:e}}function qi(t){return{type:"GroupClose",raw:t}}function me(t,e,n={}){return{type:"GroupOpen",kind:t,...n,raw:e}}function Hi(t,e,n,r){return{type:"NamedCallout",kind:t,tag:e,arguments:n,raw:r}}function Vi(t,e,n,r){return{type:"Quantifier",kind:t,min:e,max:n,raw:r}}function Xi(t){return{type:"Subroutine",raw:t}}const Qi=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),kn=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function Ki(t){const e=t[1]==="c"?t[2]:t[3];if(!e||!/[A-Za-z]/.test(e))throw new Error(`Unsupported control character "${t}"`);return Z(be(e.toUpperCase())-64,t)}function Zi(t,e){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(t).groups;r??(r="");const s=(e.getCurrentModX()||n.includes("x"))&&!r.includes("x"),o=En(n),i=En(r),a={};if(o&&(a.enable=o),i&&(a.disable=i),t.endsWith(")"))return e.replaceCurrentModX(s),Sr("flags",t,{flags:a});if(t.endsWith(":"))return e.pushModX(s),e.numOpenGroups++,me("group",t,{...(o||i)&&{flags:a}});throw new Error(`Unexpected flag modifier "${t}"`)}function Ji(t){const e=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(t);if(!e)throw new Error(`Incomplete or invalid named callout "${t}"`);const{name:n,tag:r,args:s}=e.groups;if(!n)throw new Error(`Invalid named callout "${t}"`);if(r==="")throw new Error(`Named callout tag with empty value not allowed "${t}"`);const o=s?s.split(",").filter(h=>h!=="").map(h=>/^[+-]?\d+$/.test(h)?+h:h):[],[i,a,c]=o,l=Qi.has(n)?n.toLowerCase():"custom";switch(l){case"fail":case"mismatch":case"skip":if(o.length>0)throw new Error(`Named callout arguments not allowed "${o}"`);break;case"error":if(o.length>1)throw new Error(`Named callout allows only one argument "${o}"`);if(typeof i=="string")throw new Error(`Named callout argument must be a number "${i}"`);break;case"max":if(!o.length||o.length>2)throw new Error(`Named callout must have one or two arguments "${o}"`);if(typeof i=="string"&&!/^[A-Za-z_]\w*$/.test(i))throw new Error(`Named callout argument one must be a tag or number "${i}"`);if(o.length===2&&(typeof a=="number"||!/^[<>X]$/.test(a)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${a}"`);break;case"count":case"total_count":if(o.length>1)throw new Error(`Named callout allows only one argument "${o}"`);if(o.length===1&&(typeof i=="number"||!/^[<>X]$/.test(i)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${i}"`);break;case"cmp":if(o.length!==3)throw new Error(`Named callout must have three arguments "${o}"`);if(typeof i=="string"&&!/^[A-Za-z_]\w*$/.test(i))throw new Error(`Named callout argument one must be a tag or number "${i}"`);if(typeof a=="number"||!/^(?:[<>!=]=|[<>])$/.test(a))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${a}"`);if(typeof c=="string"&&!/^[A-Za-z_]\w*$/.test(c))throw new Error(`Named callout argument three must be a tag or number "${c}"`);break;case"custom":throw new Error(`Undefined callout name "${n}"`);default:throw new Error(`Unexpected named callout kind "${l}"`)}return Hi(l,r??null,(s==null?void 0:s.split(","))??null,t)}function xn(t){let e=null,n,r;if(t[0]==="{"){const{minStr:s,maxStr:o}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(t).groups,i=1e5;if(+s>i||o&&+o>i)throw new Error("Quantifier value unsupported in Oniguruma");if(n=+s,r=o===void 0?+s:o===""?1/0:+o,n>r&&(e="possessive",[n,r]=[r,n]),t.endsWith("?")){if(e==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');e="lazy"}else e||(e="greedy")}else n=t[0]==="+"?1:0,r=t[0]==="?"?1:1/0,e=t[1]==="+"?"possessive":t[1]==="?"?"lazy":"greedy";return Vi(e,n,r,t)}function Yi(t){const e=t[1].toLowerCase();return le({d:"digit",h:"hex",s:"space",w:"word"}[e],t,{negate:t[1]!==e})}function ea(t){const{p:e,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(t).groups;return le("property",t,{value:r,negate:e==="P"&&!n||e==="p"&&!!n})}function En(t){const e={};return t.includes("i")&&(e.ignoreCase=!0),t.includes("m")&&(e.dotAll=!0),t.includes("x")&&(e.extended=!0),Object.keys(e).length?e:null}function ta(t){const e={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<t.length;n++){const r=t[n];if(!"imxDPSWy".includes(r))throw new Error(`Invalid flag "${r}"`);if(r==="y"){if(!/^y{[gw]}/.test(t.slice(n)))throw new Error('Invalid or unspecified flag "y" mode');e.textSegmentMode=t[n+2]==="g"?"grapheme":"word",n+=3;continue}e[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[r]]=!0}return e}function na(t){if(new RegExp("^(?:\\\\u(?!\\p{AHex}{4})|\\\\x(?!\\p{AHex}{1,2}|\\{\\p{AHex}{1,8}\\}))","u").test(t))throw new Error(`Incomplete or invalid escape "${t}"`);const e=t[2]==="{"?new RegExp("^\\\\x\\{\\s*(?<hex>\\p{AHex}+)","u").exec(t).groups.hex:t.slice(2);return parseInt(e,16)}function ra(t,e){const{raw:n,inCharClass:r}=t,s=n.slice(1);if(!r&&(s!=="0"&&s.length===1||s[0]!=="0"&&+s<=e))return[Cr(n)];const o=[],i=s.match(/^[0-7]+|\d/g);for(let a=0;a<i.length;a++){const c=i[a];let l;if(a===0&&c!=="8"&&c!=="9"){if(l=parseInt(c,8),l>127)throw new Error(R`Octal encoded byte above 177 unsupported "${n}"`)}else l=be(c);o.push(Z(l,(a===0?"\\":"")+c))}return o}function sa(t){const e=[],n=new RegExp(Ht,"gy");let r;for(;r=n.exec(t);){const s=r[0];if(s[0]==="{"){const o=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(s);if(o){const{min:i,max:a}=o.groups;if(+i>+a&&s.endsWith("?")){n.lastIndex--,e.push(xn(s.slice(0,-1)));continue}}}e.push(xn(s))}return e}function kr(t,e){if(!Array.isArray(t.body))throw new Error("Expected node with body array");if(t.body.length!==1)return!1;const n=t.body[0];return!e||Object.keys(e).every(r=>e[r]===n[r])}function oa(t){return ia.has(t.type)}const ia=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function xr(t,e={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...e,rules:{captureGroup:!1,singleline:!1,...e.rules}},r=Mi(t,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),s=(f,d)=>{const p=r.tokens[o.nextIndex];switch(o.parent=f,o.nextIndex++,p.type){case"Alternator":return fe();case"Assertion":return aa(p);case"Backreference":return ca(p,o);case"Character":return ot(p.value,{useLastValid:!!d.isCheckingRangeEnd});case"CharacterClassHyphen":return la(p,o,d);case"CharacterClassOpen":return ua(p,o,d);case"CharacterSet":return ha(p,o);case"Directive":return ya(p.kind,{flags:p.flags});case"GroupOpen":return fa(p,o,d);case"NamedCallout":return wa(p.kind,p.tag,p.arguments);case"Quantifier":return da(p,o);case"Subroutine":return pa(p,o);default:throw new Error(`Unexpected token type "${p.type}"`)}},o={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:s},i=Ca(_a(r.flags));let a=i.body[0];for(;o.nextIndex<r.tokens.length;){const f=s(a,{});f.type==="Alternative"?(i.body.push(f),a=f):a.body.push(f)}const{capturingGroups:c,hasNumberedRef:l,namedGroupsByName:h,subroutines:u}=o;if(l&&h.size&&!n.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:f}of u)if(typeof f=="number"){if(f>c.length)throw new Error("Subroutine uses a group number that's not defined");f&&(c[f-1].isSubroutined=!0)}else if(h.has(f)){if(h.get(f).length>1)throw new Error(R`Subroutine uses a duplicate group name "\g<${f}>"`);h.get(f)[0].isSubroutined=!0}else throw new Error(R`Subroutine uses a group name that's not defined "\g<${f}>"`);return i}function aa({kind:t}){return Tt(Ce({"^":"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"}[t],`Unexpected assertion kind "${t}"`),{negate:t===R`\B`||t===R`\Y`})}function ca({raw:t},e){const n=/^\\k[<']/.test(t),r=n?t.slice(3,-1):t.slice(1),s=(o,i=!1)=>{const a=e.capturingGroups.length;let c=!1;if(o>a)if(e.skipBackrefValidation)c=!0;else throw new Error(`Not enough capturing groups defined to the left "${t}"`);return e.hasNumberedRef=!0,Gt(i?a+1-o:o,{orphan:c})};if(n){const o=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(o)return s(+o.groups.num,!!o.groups.sign);if(/[-+]/.test(r))throw new Error(`Invalid backref name "${t}"`);if(!e.namedGroupsByName.has(r))throw new Error(`Group name not defined to the left "${t}"`);return Gt(r)}return s(+r)}function la(t,e,n){const{tokens:r,walk:s}=e,o=e.parent,i=o.body.at(-1),a=r[e.nextIndex];if(!n.isCheckingRangeEnd&&i&&i.type!=="CharacterClass"&&i.type!=="CharacterClassRange"&&a&&a.type!=="CharacterClassOpen"&&a.type!=="CharacterClassClose"&&a.type!=="CharacterClassIntersector"){const c=s(o,{...n,isCheckingRangeEnd:!0});if(i.type==="Character"&&c.type==="Character")return o.body.pop(),ma(i,c);throw new Error("Invalid character class range")}return ot(be("-"))}function ua({negate:t},e,n){const{tokens:r,walk:s}=e,o=[Ue()],i=r[e.nextIndex];let a=In(i);for(;a.type!=="CharacterClassClose";){if(a.type==="CharacterClassIntersector")o.push(Ue()),e.nextIndex++;else{const l=o.at(-1);l.body.push(s(l,n))}a=In(r[e.nextIndex],i)}const c=Ue({negate:t});return o.length===1?c.body=o[0].body:(c.kind="intersection",c.body=o.map(l=>l.body.length===1?l.body[0]:l)),e.nextIndex++,c}function ha({kind:t,negate:e,value:n},r){const{normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i}=r;if(t==="property"){const a=it(n);if(qt.has(a)&&!(i!=null&&i.has(a)))t="posix",n=a;else return ye(n,{negate:e,normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i})}return t==="posix"?ba(n,{negate:e}):Mt(t,{negate:e})}function fa(t,e,n){const{tokens:r,capturingGroups:s,namedGroupsByName:o,skipLookbehindValidation:i,walk:a}=e,c=Sa(t),l=c.type==="AbsenceFunction",h=vn(c),u=h&&c.negate;if(c.type==="CapturingGroup"&&(s.push(c),c.name&&Gi(o,c.name,[]).push(c)),l&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let f=Nn(r[e.nextIndex]);for(;f.type!=="GroupClose";){if(f.type==="Alternator")c.body.push(fe()),e.nextIndex++;else{const d=c.body.at(-1),p=a(d,{...n,isInAbsenceFunction:n.isInAbsenceFunction||l,isInLookbehind:n.isInLookbehind||h,isInNegLookbehind:n.isInNegLookbehind||u});if(d.body.push(p),(h||n.isInLookbehind)&&!i){const _="Lookbehind includes a pattern not allowed by Oniguruma";if(u||n.isInNegLookbehind){if(An(p)||p.type==="CapturingGroup")throw new Error(_)}else if(An(p)||vn(p)&&p.negate)throw new Error(_)}}f=Nn(r[e.nextIndex])}return e.nextIndex++,c}function da({kind:t,min:e,max:n},r){const s=r.parent,o=s.body.at(-1);if(!o||!oa(o))throw new Error("Quantifier requires a repeatable token");const i=Ar(t,e,n,o);return s.body.pop(),i}function pa({raw:t},e){const{capturingGroups:n,subroutines:r}=e;let s=t.slice(3,-1);const o=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s);if(o){const a=+o.groups.num,c=n.length;if(e.hasNumberedRef=!0,s={"":a,"+":c+a,"-":c+1-a}[o.groups.sign],s<1)throw new Error("Invalid subroutine number")}else s==="0"&&(s=0);const i=vr(s);return r.push(i),i}function ga(t,e){return{type:"AbsenceFunction",kind:t,body:Le(e==null?void 0:e.body)}}function fe(t){return{type:"Alternative",body:Ir(t==null?void 0:t.body)}}function Tt(t,e){const n={type:"Assertion",kind:t};return(t==="word_boundary"||t==="text_segment_boundary")&&(n.negate=!!(e!=null&&e.negate)),n}function Gt(t,e){const n=!!(e!=null&&e.orphan);return{type:"Backreference",ref:t,...n&&{orphan:n}}}function Er(t,e){const n={name:void 0,isSubroutined:!1,...e};if(n.name!==void 0&&!ka(n.name))throw new Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:t,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:Le(e==null?void 0:e.body)}}function ot(t,e){const n={useLastValid:!1,...e};if(t>1114111){const r=t.toString(16);if(n.useLastValid)t=1114111;else throw t>1310719?new Error(`Invalid code point out of range "\\x{${r}}"`):new Error(`Invalid code point out of range in JS "\\x{${r}}"`)}return{type:"Character",value:t}}function Ue(t){const e={kind:"union",negate:!1,...t};return{type:"CharacterClass",kind:e.kind,negate:e.negate,body:Ir(t==null?void 0:t.body)}}function ma(t,e){if(e.value<t.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:t,max:e}}function Mt(t,e){const n=!!(e!=null&&e.negate),r={type:"CharacterSet",kind:t};return(t==="digit"||t==="hex"||t==="newline"||t==="space"||t==="word")&&(r.negate=n),(t==="text_segment"||t==="newline"&&!n)&&(r.variableLength=!0),r}function ya(t,e={}){if(t==="keep")return{type:"Directive",kind:t};if(t==="flags")return{type:"Directive",kind:t,flags:Ce(e.flags)};throw new Error(`Unexpected directive kind "${t}"`)}function _a(t){return{type:"Flags",...t}}function U(t){const e=t==null?void 0:t.atomic,n=t==null?void 0:t.flags;if(e&&n)throw new Error("Atomic group cannot have flags");return{type:"Group",...e&&{atomic:e},...n&&{flags:n},body:Le(t==null?void 0:t.body)}}function ae(t){const e={behind:!1,negate:!1,...t};return{type:"LookaroundAssertion",kind:e.behind?"lookbehind":"lookahead",negate:e.negate,body:Le(t==null?void 0:t.body)}}function wa(t,e,n){return{type:"NamedCallout",kind:t,tag:e,arguments:n}}function ba(t,e){const n=!!(e!=null&&e.negate);if(!qt.has(t))throw new Error(`Invalid POSIX class "${t}"`);return{type:"CharacterSet",kind:"posix",value:t,negate:n}}function Ar(t,e,n,r){if(e>n)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:t,min:e,max:n,body:r}}function Ca(t,e){return{type:"Regex",body:Le(e==null?void 0:e.body),flags:t}}function vr(t){return{type:"Subroutine",ref:t}}function ye(t,e){var s;const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...e};let r=(s=n.unicodePropertyMap)==null?void 0:s.get(it(t));if(!r){if(n.normalizeUnknownPropertyNames)r=xa(t);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw new Error(R`Invalid Unicode property "\p{${t}}"`)}return{type:"CharacterSet",kind:"property",value:r??t,negate:n.negate}}function Sa({flags:t,kind:e,name:n,negate:r,number:s}){switch(e){case"absence_repeater":return ga("repeater");case"atomic":return U({atomic:!0});case"capturing":return Er(s,{name:n});case"group":return U({flags:t});case"lookahead":case"lookbehind":return ae({behind:e==="lookbehind",negate:r});default:throw new Error(`Unexpected group kind "${e}"`)}}function Le(t){if(t===void 0)t=[fe()];else if(!Array.isArray(t)||!t.length||!t.every(e=>e.type==="Alternative"))throw new Error("Invalid body; expected array of one or more Alternative nodes");return t}function Ir(t){if(t===void 0)t=[];else if(!Array.isArray(t)||!t.every(e=>!!e.type))throw new Error("Invalid body; expected array of nodes");return t}function An(t){return t.type==="LookaroundAssertion"&&t.kind==="lookahead"}function vn(t){return t.type==="LookaroundAssertion"&&t.kind==="lookbehind"}function ka(t){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(t)}function xa(t){return t.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function it(t){return t.replace(/[- _]+/g,"").toLowerCase()}function In(t,e){const n=e;return Ce(t,`Unclosed character class${(n==null?void 0:n.type)==="Character"&&n.value===93&&n.raw==="]"?' (started with "]")':""}`)}function Nn(t){return Ce(t,"Unclosed group")}function Ee(t,e,n=null){function r(o,i){for(let a=0;a<o.length;a++){const c=s(o[a],i,a,o);a=Math.max(-1,a+c)}}function s(o,i=null,a=null,c=null){var b,y;let l=0,h=!1;const u={node:o,parent:i,key:a,container:c,root:t,remove(){Be(c).splice(Math.max(0,pe(a)+l),1),l--,h=!0},removeAllNextSiblings(){return Be(c).splice(pe(a)+1)},removeAllPrevSiblings(){const w=pe(a)+l;return l-=w,Be(c).splice(0,Math.max(0,w))},replaceWith(w,C={}){const S=!!C.traverse;c?c[Math.max(0,pe(a)+l)]=w:Ce(i,"Can't replace root node")[a]=w,S&&s(w,i,a,c),h=!0},replaceWithMultiple(w,C={}){const S=!!C.traverse;if(Be(c).splice(Math.max(0,pe(a)+l),1,...w),l+=w.length-1,S){let x=0;for(let E=0;E<w.length;E++)x+=s(w[E],i,pe(a)+E+x,c)}h=!0},skip(){h=!0}},{type:f}=o,d=e["*"],p=e[f],_=typeof d=="function"?d:d==null?void 0:d.enter,m=typeof p=="function"?p:p==null?void 0:p.enter;if(_==null||_(u,n),m==null||m(u,n),!h)switch(f){case"AbsenceFunction":case"Alternative":case"CapturingGroup":case"CharacterClass":case"Group":case"LookaroundAssertion":r(o.body,o);break;case"Assertion":case"Backreference":case"Character":case"CharacterSet":case"Directive":case"Flags":case"NamedCallout":case"Subroutine":break;case"CharacterClassRange":s(o.min,o,"min"),s(o.max,o,"max");break;case"Quantifier":s(o.body,o,"body");break;case"Regex":r(o.body,o),s(o.flags,o,"flags");break;default:throw new Error(`Unexpected node type "${f}"`)}return(b=p==null?void 0:p.exit)==null||b.call(p,u,n),(y=d==null?void 0:d.exit)==null||y.call(d,u,n),l}return s(t),t}function Be(t){if(!Array.isArray(t))throw new Error("Container expected");return t}function pe(t){if(typeof t!="number")throw new Error("Numeric key expected");return t}const Ea=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function Aa(t,e){for(let n=0;n<t.length;n++)t[n]>=e&&t[n]++}function va(t,e,n,r){return t.slice(0,e)+r+t.slice(e+n.length)}const D=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function Vt(t,e,n,r){const s=new RegExp(String.raw`${e}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1];let i=0,a="";for(const c of t.matchAll(s)){const{0:l,groups:{$skip:h}}=c;if(!h&&(!r||r===D.DEFAULT==!i)){n instanceof Function?a+=n(c,{context:i?D.CHAR_CLASS:D.DEFAULT,negated:o[o.length-1]}):a+=n;continue}l[0]==="["?(i++,o.push(l[1]==="^")):l==="]"&&i&&(i--,o.pop()),a+=l}return a}function Nr(t,e,n,r){Vt(t,e,n,r)}function Ia(t,e,n=0,r){if(!new RegExp(e,"su").test(t))return null;const s=new RegExp(`${e}|(?<$skip>\\\\?.)`,"gsu");s.lastIndex=n;let o=0,i;for(;i=s.exec(t);){const{0:a,groups:{$skip:c}}=i;if(!c&&(!r||r===D.DEFAULT==!o))return i;a==="["?o++:a==="]"&&o&&o--,s.lastIndex==i.index&&s.lastIndex++}return null}function Fe(t,e,n){return!!Ia(t,e,0,n)}function Na(t,e){const n=/\\?./gsu;n.lastIndex=e;let r=t.length,s=0,o=1,i;for(;i=n.exec(t);){const[a]=i;if(a==="[")s++;else if(s)a==="]"&&s--;else if(a==="(")o++;else if(a===")"&&(o--,!o)){r=i.index;break}}return t.slice(e,r)}const Rn=new RegExp(String.raw`(?<noncapturingStart>${Ea})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function Ra(t,e){const n=(e==null?void 0:e.hiddenCaptures)??[];let r=(e==null?void 0:e.captureTransfers)??new Map;if(!/\(\?>/.test(t))return{pattern:t,captureTransfers:r,hiddenCaptures:n};const s="(?>",o="(?:(?=(",i=[0],a=[];let c=0,l=0,h=NaN,u;do{u=!1;let f=0,d=0,p=!1,_;for(Rn.lastIndex=Number.isNaN(h)?0:h+o.length;_=Rn.exec(t);){const{0:m,index:b,groups:{capturingStart:y,noncapturingStart:w}}=_;if(m==="[")f++;else if(f)m==="]"&&f--;else if(m===s&&!p)h=b,p=!0;else if(p&&w)d++;else if(y)p?d++:(c++,i.push(c+l));else if(m===")"&&p){if(!d){l++;const C=c+l;if(t=`${t.slice(0,h)}${o}${t.slice(h+s.length,b)}))<$$${C}>)${t.slice(b+1)}`,u=!0,a.push(C),Aa(n,C),r.size){const S=new Map;r.forEach((x,E)=>{S.set(E>=C?E+1:E,x.map(G=>G>=C?G+1:G))}),r=S}break}d--}}}while(u);return n.push(...a),t=Vt(t,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:f,groups:{backrefNum:d,wrappedBackrefNum:p}})=>{if(d){const _=+d;if(_>i.length-1)throw new Error(`Backref "${f}" greater than number of captures`);return`\\${i[_]}`}return`\\${p}`},D.DEFAULT),{pattern:t,captureTransfers:r,hiddenCaptures:n}}const Rr=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,wt=new RegExp(String.raw`
|
|
45
|
+
\\(?: \d+
|
|
46
|
+
| c[A-Za-z]
|
|
47
|
+
| [gk]<[^>]+>
|
|
48
|
+
| [pPu]\{[^\}]+\}
|
|
49
|
+
| u[A-Fa-f\d]{4}
|
|
50
|
+
| x[A-Fa-f\d]{2}
|
|
51
|
+
)
|
|
52
|
+
| \((?: \? (?: [:=!>]
|
|
53
|
+
| <(?:[=!]|[^>]+>)
|
|
54
|
+
| [A-Za-z\-]+:
|
|
55
|
+
| \(DEFINE\)
|
|
56
|
+
))?
|
|
57
|
+
| (?<qBase>${Rr})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
58
|
+
| \\?.
|
|
59
|
+
`.replace(/\s+/g,""),"gsu");function $a(t){if(!new RegExp(`${Rr}\\+`).test(t))return{pattern:t};const e=[];let n=null,r=null,s="",o=0,i;for(wt.lastIndex=0;i=wt.exec(t);){const{0:a,index:c,groups:{qBase:l,qMod:h,invalidQ:u}}=i;if(a==="[")o||(r=c),o++;else if(a==="]")o?o--:r=null;else if(!o)if(h==="+"&&s&&!s.startsWith("(")){if(u)throw new Error(`Invalid quantifier "${a}"`);let f=-1;if(/^\{\d+\}$/.test(l))t=va(t,c+l.length,h,"");else{if(s===")"||s==="]"){const d=s===")"?n:r;if(d===null)throw new Error(`Invalid unmatched "${s}"`);t=`${t.slice(0,d)}(?>${t.slice(d,c)}${l})${t.slice(c+a.length)}`}else t=`${t.slice(0,c-s.length)}(?>${s}${l})${t.slice(c+a.length)}`;f+=4}wt.lastIndex+=f}else a[0]==="("?e.push(c):a===")"&&(n=e.length?e.pop():null);s=a}return{pattern:t}}const F=String.raw,Pa=F`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,Ot=F`\(\?R=(?<rDepth>[^\)]+)\)|${Pa}`,at=F`\(\?<(?![=!])(?<captureName>[^>]+)>`,$r=F`${at}|(?<unnamed>\()(?!\?)`,ie=new RegExp(F`${at}|${Ot}|\(\?|\\?.`,"gsu"),bt="Cannot use multiple overlapping recursions";function La(t,e){const{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:"plugin",...e};let s=(e==null?void 0:e.captureTransfers)??new Map;if(!new RegExp(Ot,"su").test(t))return{pattern:t,captureTransfers:s,hiddenCaptures:n};if(r==="plugin"&&Fe(t,F`\(\?\(DEFINE\)`,D.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const o=[],i=Fe(t,F`\\[1-9]`,D.DEFAULT),a=new Map,c=[];let l=!1,h=0,u=0,f;for(ie.lastIndex=0;f=ie.exec(t);){const{0:d,groups:{captureName:p,rDepth:_,gRNameOrNum:m,gRDepth:b}}=f;if(d==="[")h++;else if(h)d==="]"&&h--;else if(_){if($n(_),l)throw new Error(bt);if(i)throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);const y=t.slice(0,f.index),w=t.slice(ie.lastIndex);if(Fe(w,Ot,D.DEFAULT))throw new Error(bt);const C=+_-1;t=Pn(y,w,C,!1,n,o,u),s=Tn(s,y,C,o.length,0,u);break}else if(m){$n(b);let y=!1;for(const M of c)if(M.name===m||M.num===+m){if(y=!0,M.hasRecursedWithin)throw new Error(bt);break}if(!y)throw new Error(F`Recursive \g cannot be used outside the referenced group "${r==="external"?m:F`\g<${m}&R=${b}>`}"`);const w=a.get(m),C=Na(t,w);if(i&&Fe(C,F`${at}|\((?!\?)`,D.DEFAULT))throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);const S=t.slice(w,f.index),x=C.slice(S.length+d.length),E=o.length,G=+b-1,L=Pn(S,x,G,!0,n,o,u);s=Tn(s,S,G,o.length-E,E,u);const z=t.slice(0,w),J=t.slice(w+C.length);t=`${z}${L}${J}`,ie.lastIndex+=L.length-d.length-S.length-x.length,c.forEach(M=>M.hasRecursedWithin=!0),l=!0}else if(p)u++,a.set(String(u),ie.lastIndex),a.set(p,ie.lastIndex),c.push({num:u,name:p});else if(d[0]==="("){const y=d==="(";y&&(u++,a.set(String(u),ie.lastIndex)),c.push(y?{num:u}:{})}else d===")"&&c.pop()}return n.push(...o),{pattern:t,captureTransfers:s,hiddenCaptures:n}}function $n(t){const e=`Max depth must be integer between 2 and 100; used ${t}`;if(!/^[1-9]\d*$/.test(t))throw new Error(e);if(t=+t,t<2||t>100)throw new Error(e)}function Pn(t,e,n,r,s,o,i){const a=new Set;r&&Nr(t+e,at,({groups:{captureName:l}})=>{a.add(l)},D.DEFAULT);const c=[n,r?a:null,s,o,i];return`${t}${Ln(`(?:${t}`,"forward",...c)}(?:)${Ln(`${e})`,"backward",...c)}${e}`}function Ln(t,e,n,r,s,o,i){const c=h=>e==="forward"?h+2:n-h+2-1;let l="";for(let h=0;h<n;h++){const u=c(h);l+=Vt(t,F`${$r}|\\k<(?<backref>[^>]+)>`,({0:f,groups:{captureName:d,unnamed:p,backref:_}})=>{if(_&&r&&!r.has(_))return f;const m=`_$${u}`;if(p||d){const b=i+o.length+1;return o.push(b),Ta(s,b),p?f:`(?<${d}${m}>`}return F`\k<${_}${m}>`},D.DEFAULT)}return l}function Ta(t,e){for(let n=0;n<t.length;n++)t[n]>=e&&t[n]++}function Tn(t,e,n,r,s,o){if(t.size&&r){let i=0;Nr(e,$r,()=>i++,D.DEFAULT);const a=o-i+s,c=new Map;return t.forEach((l,h)=>{const u=(r-i*n)/n,f=i*n,d=h>a+i?h+r:h,p=[];for(const _ of l)if(_<=a)p.push(_);else if(_>a+i+u)p.push(_+r);else if(_<=a+i)for(let m=0;m<=n;m++)p.push(_+i*m);else for(let m=0;m<=n;m++)p.push(_+f+u*m);c.set(d,p)}),c}return t}var I=String.fromCodePoint,k=String.raw,W={},ct=globalThis.RegExp;W.flagGroups=(()=>{try{new ct("(?i:)")}catch{return!1}return!0})();W.unicodeSets=(()=>{try{new ct("[[]]","v")}catch{return!1}return!0})();W.bugFlagVLiteralHyphenIsRange=W.unicodeSets?(()=>{try{new ct(k`[\d\-a]`,"v")}catch{return!0}return!1})():!1;W.bugNestedClassIgnoresNegation=W.unicodeSets&&new ct("[[^a]]","v").test("a");function Ye(t,{enable:e,disable:n}){return{dotAll:!(n!=null&&n.dotAll)&&!!(e!=null&&e.dotAll||t.dotAll),ignoreCase:!(n!=null&&n.ignoreCase)&&!!(e!=null&&e.ignoreCase||t.ignoreCase)}}function Re(t,e,n){return t.has(e)||t.set(e,n),t.get(e)}function Bt(t,e){return Gn[t]>=Gn[e]}function Ga(t,e){if(t==null)throw new Error(e??"Value expected");return t}var Gn={ES2025:2025,ES2024:2024,ES2018:2018},Ma={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function Pr(t={}){if({}.toString.call(t)!=="[object Object]")throw new Error("Unexpected options");if(t.target!==void 0&&!Ma[t.target])throw new Error(`Unexpected target "${t.target}"`);const e={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...t,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...t.rules}};return e.target==="auto"&&(e.target=W.flagGroups?"ES2025":W.unicodeSets?"ES2024":"ES2018"),e}var Oa="[ -\r ]",Ba=new Set([I(304),I(305)]),V=k`[\p{L}\p{M}\p{N}\p{Pc}]`;function Lr(t){if(Ba.has(t))return[t];const e=new Set,n=t.toLowerCase(),r=n.toUpperCase(),s=ja.get(n),o=Fa.get(n),i=Da.get(n);return[...r].length===1&&e.add(r),i&&e.add(i),s&&e.add(s),e.add(n),o&&e.add(o),[...e]}var Xt=new Map(`C Other
|
|
60
|
+
Cc Control cntrl
|
|
61
|
+
Cf Format
|
|
62
|
+
Cn Unassigned
|
|
63
|
+
Co Private_Use
|
|
64
|
+
Cs Surrogate
|
|
65
|
+
L Letter
|
|
66
|
+
LC Cased_Letter
|
|
67
|
+
Ll Lowercase_Letter
|
|
68
|
+
Lm Modifier_Letter
|
|
69
|
+
Lo Other_Letter
|
|
70
|
+
Lt Titlecase_Letter
|
|
71
|
+
Lu Uppercase_Letter
|
|
72
|
+
M Mark Combining_Mark
|
|
73
|
+
Mc Spacing_Mark
|
|
74
|
+
Me Enclosing_Mark
|
|
75
|
+
Mn Nonspacing_Mark
|
|
76
|
+
N Number
|
|
77
|
+
Nd Decimal_Number digit
|
|
78
|
+
Nl Letter_Number
|
|
79
|
+
No Other_Number
|
|
80
|
+
P Punctuation punct
|
|
81
|
+
Pc Connector_Punctuation
|
|
82
|
+
Pd Dash_Punctuation
|
|
83
|
+
Pe Close_Punctuation
|
|
84
|
+
Pf Final_Punctuation
|
|
85
|
+
Pi Initial_Punctuation
|
|
86
|
+
Po Other_Punctuation
|
|
87
|
+
Ps Open_Punctuation
|
|
88
|
+
S Symbol
|
|
89
|
+
Sc Currency_Symbol
|
|
90
|
+
Sk Modifier_Symbol
|
|
91
|
+
Sm Math_Symbol
|
|
92
|
+
So Other_Symbol
|
|
93
|
+
Z Separator
|
|
94
|
+
Zl Line_Separator
|
|
95
|
+
Zp Paragraph_Separator
|
|
96
|
+
Zs Space_Separator
|
|
97
|
+
ASCII
|
|
98
|
+
ASCII_Hex_Digit AHex
|
|
99
|
+
Alphabetic Alpha
|
|
100
|
+
Any
|
|
101
|
+
Assigned
|
|
102
|
+
Bidi_Control Bidi_C
|
|
103
|
+
Bidi_Mirrored Bidi_M
|
|
104
|
+
Case_Ignorable CI
|
|
105
|
+
Cased
|
|
106
|
+
Changes_When_Casefolded CWCF
|
|
107
|
+
Changes_When_Casemapped CWCM
|
|
108
|
+
Changes_When_Lowercased CWL
|
|
109
|
+
Changes_When_NFKC_Casefolded CWKCF
|
|
110
|
+
Changes_When_Titlecased CWT
|
|
111
|
+
Changes_When_Uppercased CWU
|
|
112
|
+
Dash
|
|
113
|
+
Default_Ignorable_Code_Point DI
|
|
114
|
+
Deprecated Dep
|
|
115
|
+
Diacritic Dia
|
|
116
|
+
Emoji
|
|
117
|
+
Emoji_Component EComp
|
|
118
|
+
Emoji_Modifier EMod
|
|
119
|
+
Emoji_Modifier_Base EBase
|
|
120
|
+
Emoji_Presentation EPres
|
|
121
|
+
Extended_Pictographic ExtPict
|
|
122
|
+
Extender Ext
|
|
123
|
+
Grapheme_Base Gr_Base
|
|
124
|
+
Grapheme_Extend Gr_Ext
|
|
125
|
+
Hex_Digit Hex
|
|
126
|
+
IDS_Binary_Operator IDSB
|
|
127
|
+
IDS_Trinary_Operator IDST
|
|
128
|
+
ID_Continue IDC
|
|
129
|
+
ID_Start IDS
|
|
130
|
+
Ideographic Ideo
|
|
131
|
+
Join_Control Join_C
|
|
132
|
+
Logical_Order_Exception LOE
|
|
133
|
+
Lowercase Lower
|
|
134
|
+
Math
|
|
135
|
+
Noncharacter_Code_Point NChar
|
|
136
|
+
Pattern_Syntax Pat_Syn
|
|
137
|
+
Pattern_White_Space Pat_WS
|
|
138
|
+
Quotation_Mark QMark
|
|
139
|
+
Radical
|
|
140
|
+
Regional_Indicator RI
|
|
141
|
+
Sentence_Terminal STerm
|
|
142
|
+
Soft_Dotted SD
|
|
143
|
+
Terminal_Punctuation Term
|
|
144
|
+
Unified_Ideograph UIdeo
|
|
145
|
+
Uppercase Upper
|
|
146
|
+
Variation_Selector VS
|
|
147
|
+
White_Space space
|
|
148
|
+
XID_Continue XIDC
|
|
149
|
+
XID_Start XIDS`.split(/\s/).map(t=>[it(t),t])),Fa=new Map([["s",I(383)],[I(383),"s"]]),Da=new Map([[I(223),I(7838)],[I(107),I(8490)],[I(229),I(8491)],[I(969),I(8486)]]),ja=new Map([Y(453),Y(456),Y(459),Y(498),...Ct(8072,8079),...Ct(8088,8095),...Ct(8104,8111),Y(8124),Y(8140),Y(8188)]),Ua=new Map([["alnum",k`[\p{Alpha}\p{Nd}]`],["alpha",k`\p{Alpha}`],["ascii",k`\p{ASCII}`],["blank",k`[\p{Zs}\t]`],["cntrl",k`\p{Cc}`],["digit",k`\p{Nd}`],["graph",k`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",k`\p{Lower}`],["print",k`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",k`[\p{P}\p{S}]`],["space",k`\p{space}`],["upper",k`\p{Upper}`],["word",k`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",k`\p{AHex}`]]);function Wa(t,e){const n=[];for(let r=t;r<=e;r++)n.push(r);return n}function Y(t){const e=I(t);return[e.toLowerCase(),e]}function Ct(t,e){return Wa(t,e).map(n=>Y(n))}var Tr=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function za(t,e){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...e};Gr(t);const r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:Bt(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:t.flags.digitIsAscii,spaceIsAscii:t.flags.spaceIsAscii,wordIsAscii:t.flags.wordIsAscii};Ee(t,qa,r);const s={dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},o={currentFlags:s,prevFlags:null,globalFlags:s,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};Ee(t,Ha,o);const i={groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer};return Ee(t,Va,i),t._originMap=o.groupOriginByCopy,t._strategy=r.strategy,t}var qa={AbsenceFunction({node:t,parent:e,replaceWith:n}){const{body:r,kind:s}=t;if(s==="repeater"){const o=U();o.body[0].body.push(ae({negate:!0,body:r}),ye("Any"));const i=U();i.body[0].body.push(Ar("greedy",0,1/0,o)),n(v(i,e),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:t,parent:e,key:n},{flagDirectivesByAlt:r}){const s=t.body.filter(o=>o.kind==="flags");for(let o=n+1;o<e.body.length;o++){const i=e.body[o];Re(r,i,[]).push(...s)}},exit({node:t},{flagDirectivesByAlt:e}){var n;if((n=e.get(t))!=null&&n.length){const r=Or(e.get(t));if(r){const s=U({flags:r});s.body[0].body=t.body,t.body=[v(s,t)]}}}},Assertion({node:t,parent:e,key:n,container:r,root:s,remove:o,replaceWith:i},a){const{kind:c,negate:l}=t,{asciiWordBoundaries:h,avoidSubclass:u,supportedGNodes:f,wordIsAscii:d}=a;if(c==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${l?"Y":"y"}"`);if(c==="line_end")i(v(ae({body:[fe({body:[Tt("string_end")]}),fe({body:[ot(10)]})]}),e));else if(c==="line_start")i(v(X(k`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),e));else if(c==="search_start")if(f.has(t))s.flags.sticky=!0,o();else{const p=r[n-1];if(p&&Ya(p))i(v(ae({negate:!0}),e));else{if(u)throw new Error(k`Uses "\G" in a way that requires a subclass`);i(ee(Tt("string_start"),e)),a.strategy="clip_search"}}else if(!(c==="string_end"||c==="string_start"))if(c==="string_end_newline")i(v(X(k`(?=\n?\z)`),e));else if(c==="word_boundary"){if(!d&&!h){const p=`(?:(?<=${V})(?!${V})|(?<!${V})(?=${V}))`,_=`(?:(?<=${V})(?=${V})|(?<!${V})(?!${V}))`;i(v(X(l?_:p),e))}}else throw new Error(`Unexpected assertion kind "${c}"`)},Backreference({node:t},{jsGroupNameMap:e}){let{ref:n}=t;typeof n=="string"&&!kt(n)&&(n=St(n,e),t.ref=n)},CapturingGroup({node:t},{jsGroupNameMap:e,subroutineRefMap:n}){let{name:r}=t;r&&!kt(r)&&(r=St(r,e),t.name=r),n.set(t.number,t),r&&n.set(r,t)},CharacterClassRange({node:t,parent:e,replaceWith:n}){if(e.kind==="intersection"){const r=Ue({body:[t]});n(v(r,e),{traverse:!0})}},CharacterSet({node:t,parent:e,replaceWith:n},{accuracy:r,minTargetEs2024:s,digitIsAscii:o,spaceIsAscii:i,wordIsAscii:a}){const{kind:c,negate:l,value:h}=t;if(o&&(c==="digit"||h==="digit")){n(ee(Mt("digit",{negate:l}),e));return}if(i&&(c==="space"||h==="space")){n(v(xt(X(Oa),l),e));return}if(a&&(c==="word"||h==="word")){n(ee(Mt("word",{negate:l}),e));return}if(c==="any")n(ee(ye("Any"),e));else if(c==="digit")n(ee(ye("Nd",{negate:l}),e));else if(c!=="dot")if(c==="text_segment"){if(r==="strict")throw new Error(k`Use of "\X" requires non-strict accuracy`);const u="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",f=k`\p{RI}{2}|${u}(?:\u200D${u})*`;n(v(X(k`(?>\r\n|${s?k`\p{RGI_Emoji}`:f}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),e))}else if(c==="hex")n(ee(ye("AHex",{negate:l}),e));else if(c==="newline")n(v(X(l?`[^
|
|
150
|
+
]`:`(?>\r
|
|
151
|
+
?|[
|
|
152
|
+
\v\f
\u2028\u2029])`),e));else if(c==="posix")if(!s&&(h==="graph"||h==="print")){if(r==="strict")throw new Error(`POSIX class "${h}" requires min target ES2024 or non-strict accuracy`);let u={graph:"!-~",print:" -~"}[h];l&&(u=`\0-${I(u.codePointAt(0)-1)}${I(u.codePointAt(2)+1)}-`),n(v(X(`[${u}]`),e))}else n(v(xt(X(Ua.get(h)),l),e));else if(c==="property")Xt.has(it(h))||(t.key="sc");else if(c==="space")n(ee(ye("space",{negate:l}),e));else if(c==="word")n(v(xt(X(V),l),e));else throw new Error(`Unexpected character set kind "${c}"`)},Directive({node:t,parent:e,root:n,remove:r,replaceWith:s,removeAllPrevSiblings:o,removeAllNextSiblings:i}){const{kind:a,flags:c}=t;if(a==="flags")if(!c.enable&&!c.disable)r();else{const l=U({flags:c});l.body[0].body=i(),s(v(l,e),{traverse:!0})}else if(a==="keep"){const l=n.body[0],u=n.body.length===1&&kr(l,{type:"Group"})&&l.body[0].body.length===1?l.body[0]:n;if(e.parent!==u||u.body.length>1)throw new Error(k`Uses "\K" in a way that's unsupported`);const f=ae({behind:!0});f.body[0].body=o(),s(v(f,e))}else throw new Error(`Unexpected directive kind "${a}"`)},Flags({node:t,parent:e}){if(t.posixIsAscii)throw new Error('Unsupported flag "P"');if(t.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(n=>delete t[n]),Object.assign(t,{global:!1,hasIndices:!1,multiline:!1,sticky:t.sticky??!1}),e.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:t}){if(!t.flags)return;const{enable:e,disable:n}=t.flags;e!=null&&e.extended&&delete e.extended,n!=null&&n.extended&&delete n.extended,e!=null&&e.dotAll&&(n!=null&&n.dotAll)&&delete e.dotAll,e!=null&&e.ignoreCase&&(n!=null&&n.ignoreCase)&&delete e.ignoreCase,e&&!Object.keys(e).length&&delete t.flags.enable,n&&!Object.keys(n).length&&delete t.flags.disable,!t.flags.enable&&!t.flags.disable&&delete t.flags},LookaroundAssertion({node:t},e){const{kind:n}=t;n==="lookbehind"&&(e.passedLookbehind=!0)},NamedCallout({node:t,parent:e,replaceWith:n}){const{kind:r}=t;if(r==="fail")n(v(ae({negate:!0}),e));else throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:t}){if(t.body.type==="Quantifier"){const e=U();e.body[0].body.push(t.body),t.body=v(e,t)}},Regex:{enter({node:t},{supportedGNodes:e}){const n=[];let r=!1,s=!1;for(const o of t.body)if(o.body.length===1&&o.body[0].kind==="search_start")o.body.pop();else{const i=Fr(o.body);i?(r=!0,Array.isArray(i)?n.push(...i):n.push(i)):s=!0}r&&!s&&n.forEach(o=>e.add(o))},exit(t,{accuracy:e,passedLookbehind:n,strategy:r}){if(e==="strict"&&n&&r)throw new Error(k`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:t},{jsGroupNameMap:e}){let{ref:n}=t;typeof n=="string"&&!kt(n)&&(n=St(n,e),t.ref=n)}},Ha={Backreference({node:t},{multiplexCapturesToLeftByRef:e,reffedNodesByReferencer:n}){const{orphan:r,ref:s}=t;r||n.set(t,[...e.get(s).map(({node:o})=>o)])},CapturingGroup:{enter({node:t,parent:e,replaceWith:n,skip:r},{groupOriginByCopy:s,groupsByName:o,multiplexCapturesToLeftByRef:i,openRefs:a,reffedNodesByReferencer:c}){const l=s.get(t);if(l&&a.has(t.number)){const u=ee(Mn(t.number),e);c.set(u,a.get(t.number)),n(u);return}a.set(t.number,t),i.set(t.number,[]),t.name&&Re(i,t.name,[]);const h=i.get(t.name??t.number);for(let u=0;u<h.length;u++){const f=h[u];if(l===f.node||l&&l===f.origin||t===f.origin){h.splice(u,1);break}}if(i.get(t.number).push({node:t,origin:l}),t.name&&i.get(t.name).push({node:t,origin:l}),t.name){const u=Re(o,t.name,new Map);let f=!1;if(l)f=!0;else for(const d of u.values())if(!d.hasDuplicateNameToRemove){f=!0;break}o.get(t.name).set(t,{node:t,hasDuplicateNameToRemove:f})}},exit({node:t},{openRefs:e}){e.get(t.number)===t&&e.delete(t.number)}},Group:{enter({node:t},e){e.prevFlags=e.currentFlags,t.flags&&(e.currentFlags=Ye(e.currentFlags,t.flags))},exit(t,e){e.currentFlags=e.prevFlags}},Subroutine({node:t,parent:e,replaceWith:n},r){const{isRecursive:s,ref:o}=t;if(s){let h=e;for(;(h=h.parent)&&!(h.type==="CapturingGroup"&&(h.name===o||h.number===o)););r.reffedNodesByReferencer.set(t,h);return}const i=r.subroutineRefMap.get(o),a=o===0,c=a?Mn(0):Mr(i,r.groupOriginByCopy,null);let l=c;if(!a){const h=Or(Ka(i,f=>f.type==="Group"&&!!f.flags)),u=h?Ye(r.globalFlags,h):r.globalFlags;Xa(u,r.currentFlags)||(l=U({flags:Za(u)}),l.body[0].body.push(c))}n(v(l,e),{traverse:!a})}},Va={Backreference({node:t,parent:e,replaceWith:n},r){if(t.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,t.ref);return}const o=r.reffedNodesByReferencer.get(t).filter(i=>Qa(i,t));if(!o.length)n(v(ae({negate:!0}),e));else if(o.length>1){const i=U({atomic:!0,body:o.reverse().map(a=>fe({body:[Gt(a.number)]}))});n(v(i,e))}else t.ref=o[0].number},CapturingGroup({node:t},e){t.number=++e.numCapturesToLeft,t.name&&e.groupsByName.get(t.name).get(t).hasDuplicateNameToRemove&&delete t.name},Regex:{exit({node:t},e){const n=Math.max(e.highestOrphanBackref-e.numCapturesToLeft,0);for(let r=0;r<n;r++){const s=Er();t.body.at(-1).body.push(s)}}},Subroutine({node:t},e){!t.isRecursive||t.ref===0||(t.ref=e.reffedNodesByReferencer.get(t).number)}};function Gr(t){Ee(t,{"*"({node:e,parent:n}){e.parent=n}})}function Xa(t,e){return t.dotAll===e.dotAll&&t.ignoreCase===e.ignoreCase}function Qa(t,e){let n=e;do{if(n.type==="Regex")return!1;if(n.type==="Alternative")continue;if(n===t)return!1;const r=Br(n.parent);for(const s of r){if(s===n)break;if(s===t||Dr(s,t))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function Mr(t,e,n,r){const s=Array.isArray(t)?[]:{};for(const[o,i]of Object.entries(t))o==="parent"?s.parent=Array.isArray(n)?r:n:i&&typeof i=="object"?s[o]=Mr(i,e,s,n):(o==="type"&&i==="CapturingGroup"&&e.set(s,e.get(t)??t),s[o]=i);return s}function Mn(t){const e=vr(t);return e.isRecursive=!0,e}function Ka(t,e){const n=[];for(;t=t.parent;)(!e||e(t))&&n.push(t);return n}function St(t,e){if(e.has(t))return e.get(t);const n=`$${e.size}_${t.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return e.set(t,n),n}function Or(t){const e=["dotAll","ignoreCase"],n={enable:{},disable:{}};return t.forEach(({flags:r})=>{e.forEach(s=>{var o,i;(o=r.enable)!=null&&o[s]&&(delete n.disable[s],n.enable[s]=!0),(i=r.disable)!=null&&i[s]&&(n.disable[s]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function Za({dotAll:t,ignoreCase:e}){const n={};return(t||e)&&(n.enable={},t&&(n.enable.dotAll=!0),e&&(n.enable.ignoreCase=!0)),(!t||!e)&&(n.disable={},!t&&(n.disable.dotAll=!0),!e&&(n.disable.ignoreCase=!0)),n}function Br(t){if(!t)throw new Error("Node expected");const{body:e}=t;return Array.isArray(e)?e:e?[e]:null}function Fr(t){const e=t.find(n=>n.kind==="search_start"||ec(n,{negate:!1})||!Ja(n));if(!e)return null;if(e.kind==="search_start")return e;if(e.type==="LookaroundAssertion")return e.body[0].body[0];if(e.type==="CapturingGroup"||e.type==="Group"){const n=[];for(const r of e.body){const s=Fr(r.body);if(!s)return null;Array.isArray(s)?n.push(...s):n.push(s)}return n}return null}function Dr(t,e){const n=Br(t)??[];for(const r of n)if(r===e||Dr(r,e))return!0;return!1}function Ja({type:t}){return t==="Assertion"||t==="Directive"||t==="LookaroundAssertion"}function Ya(t){const e=["Character","CharacterClass","CharacterSet"];return e.includes(t.type)||t.type==="Quantifier"&&t.min&&e.includes(t.body.type)}function ec(t,e){const n={negate:null,...e};return t.type==="LookaroundAssertion"&&(n.negate===null||t.negate===n.negate)&&t.body.length===1&&kr(t.body[0],{type:"Assertion",kind:"search_start"})}function kt(t){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(t)}function X(t,e){const r=xr(t,{...e,unicodePropertyMap:Xt}).body;return r.length>1||r[0].body.length>1?U({body:r}):r[0].body[0]}function xt(t,e){return t.negate=e,t}function ee(t,e){return t.parent=e,t}function v(t,e){return Gr(t),t.parent=e,t}function tc(t,e){const n=Pr(e),r=Bt(n.target,"ES2024"),s=Bt(n.target,"ES2025"),o=n.rules.recursionLimit;if(!Number.isInteger(o)||o<2||o>20)throw new Error("Invalid recursionLimit; use 2-20");let i=null,a=null;if(!s){const d=[t.flags.ignoreCase];Ee(t,nc,{getCurrentModI:()=>d.at(-1),popModI(){d.pop()},pushModI(p){d.push(p)},setHasCasedChar(){d.at(-1)?i=!0:a=!0}})}const c={dotAll:t.flags.dotAll,ignoreCase:!!((t.flags.ignoreCase||i)&&!a)};let l=t;const h={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:t.flags.dotAll,ignoreCase:t.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:t._originMap,recursionLimit:o,useAppliedIgnoreCase:!!(!s&&i&&a),useFlagMods:s,useFlagV:r,verbose:n.verbose};function u(d){return h.lastNode=l,l=d,Ga(rc[d.type],`Unexpected node type "${d.type}"`)(d,h,u)}const f={pattern:t.body.map(u).join("|"),flags:u(t.flags),options:{...t.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],h.captureMap.forEach((d,p)=>{d.hidden&&f._hiddenCaptures.push(p),d.transferTo&&Re(f._captureTransfers,d.transferTo,[]).push(p)}),f}var nc={"*":{enter({node:t},e){if(Bn(t)){const n=e.getCurrentModI();e.pushModI(t.flags?Ye({ignoreCase:n},t.flags).ignoreCase:n)}},exit({node:t},e){Bn(t)&&e.popModI()}},Backreference(t,e){e.setHasCasedChar()},Character({node:t},e){Qt(I(t.value))&&e.setHasCasedChar()},CharacterClassRange({node:t,skip:e},n){e(),jr(t,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:t},e){t.kind==="property"&&Tr.has(t.value)&&e.setHasCasedChar()}},rc={Alternative({body:t},e,n){return t.map(n).join("")},Assertion({kind:t,negate:e}){if(t==="string_end")return"$";if(t==="string_start")return"^";if(t==="word_boundary")return e?k`\B`:k`\b`;throw new Error(`Unexpected assertion kind "${t}"`)},Backreference({ref:t},e){if(typeof t!="number")throw new Error("Unexpected named backref in transformed AST");if(!e.useFlagMods&&e.accuracy==="strict"&&e.currentFlags.ignoreCase&&!e.captureMap.get(t).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+t},CapturingGroup(t,e,n){const{body:r,name:s,number:o}=t,i={ignoreCase:e.currentFlags.ignoreCase},a=e.originMap.get(t);return a&&(i.hidden=!0,o>a.number&&(i.transferTo=a.number)),e.captureMap.set(o,i),`(${s?`?<${s}>`:""}${r.map(n).join("|")})`},Character({value:t},e){const n=I(t),r=ge(t,{escDigit:e.lastNode.type==="Backreference",inCharClass:e.inCharClass,useFlagV:e.useFlagV});if(r!==n)return r;if(e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase&&Qt(n)){const s=Lr(n);return e.inCharClass?s.join(""):s.length>1?`[${s.join("")}]`:s[0]}return n},CharacterClass(t,e,n){const{kind:r,negate:s,parent:o}=t;let{body:i}=t;if(r==="intersection"&&!e.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");W.bugFlagVLiteralHyphenIsRange&&e.useFlagV&&i.some(Fn)&&(i=[ot(45),...i.filter(l=>!Fn(l))]);const a=()=>`[${s?"^":""}${i.map(n).join(r==="intersection"?"&&":"")}]`;if(!e.inCharClass){if((!e.useFlagV||W.bugNestedClassIgnoresNegation)&&!s){const h=i.filter(u=>u.type==="CharacterClass"&&u.kind==="union"&&u.negate);if(h.length){const u=U(),f=u.body[0];return u.parent=o,f.parent=u,i=i.filter(d=>!h.includes(d)),t.body=i,i.length?(t.parent=f,f.body.push(t)):u.body.pop(),h.forEach(d=>{const p=fe({body:[d]});d.parent=p,p.parent=u,u.body.push(p)}),n(u)}}e.inCharClass=!0;const l=a();return e.inCharClass=!1,l}const c=i[0];if(r==="union"&&!s&&c&&((!e.useFlagV||!e.verbose)&&o.kind==="union"&&!(W.bugFlagVLiteralHyphenIsRange&&e.useFlagV)||!e.verbose&&o.kind==="intersection"&&i.length===1&&c.type!=="CharacterClassRange"))return i.map(n).join("");if(!e.useFlagV&&o.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return a()},CharacterClassRange(t,e){const n=t.min.value,r=t.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:e.useFlagV},o=ge(n,s),i=ge(r,s),a=new Set;if(e.useAppliedIgnoreCase&&e.currentFlags.ignoreCase){const c=jr(t);cc(c).forEach(h=>{a.add(Array.isArray(h)?`${ge(h[0],s)}-${ge(h[1],s)}`:ge(h,s))})}return`${o}-${i}${[...a].join("")}`},CharacterSet({kind:t,negate:e,value:n,key:r},s){if(t==="dot")return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":k`[^\n]`;if(t==="digit")return e?k`\D`:k`\d`;if(t==="property"){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&Tr.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${e?k`\P`:k`\p`}{${r?`${r}=`:""}${n}}`}if(t==="word")return e?k`\W`:k`\w`;throw new Error(`Unexpected character set kind "${t}"`)},Flags(t,e){return(e.appliedGlobalFlags.ignoreCase?"i":"")+(t.dotAll?"s":"")+(t.sticky?"y":"")},Group({atomic:t,body:e,flags:n,parent:r},s,o){const i=s.currentFlags;n&&(s.currentFlags=Ye(i,n));const a=e.map(o).join("|"),c=!s.verbose&&e.length===1&&r.type!=="Quantifier"&&!t&&(!s.useFlagMods||!n)?a:`(?${lc(t,n,s.useFlagMods)}${a})`;return s.currentFlags=i,c},LookaroundAssertion({body:t,kind:e,negate:n},r,s){return`(?${`${e==="lookahead"?"":"<"}${n?"!":"="}`}${t.map(s).join("|")})`},Quantifier(t,e,n){return n(t.body)+uc(t)},Subroutine({isRecursive:t,ref:e},n){if(!t)throw new Error("Unexpected non-recursive subroutine in transformed AST");const r=n.recursionLimit;return e===0?`(?R=${r})`:k`\g<${e}&R=${r}>`}},sc=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),oc=new Set(["-","\\","]","^","["]),ic=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),On=new Map([[9,k`\t`],[10,k`\n`],[11,k`\v`],[12,k`\f`],[13,k`\r`],[8232,k`\u2028`],[8233,k`\u2029`],[65279,k`\uFEFF`]]),ac=new RegExp("^\\p{Cased}$","u");function Qt(t){return ac.test(t)}function jr(t,e){const n=!!(e!=null&&e.firstOnly),r=t.min.value,s=t.max.value,o=[];if(r<65&&(s===65535||s>=131071)||r===65536&&s>=131071)return o;for(let i=r;i<=s;i++){const a=I(i);if(!Qt(a))continue;const c=Lr(a).filter(l=>{const h=l.codePointAt(0);return h<r||h>s});if(c.length&&(o.push(...c),n))break}return o}function ge(t,{escDigit:e,inCharClass:n,useFlagV:r}){if(On.has(t))return On.get(t);if(t<32||t>126&&t<160||t>262143||e&&hc(t))return t>255?`\\u{${t.toString(16).toUpperCase()}}`:`\\x${t.toString(16).toUpperCase().padStart(2,"0")}`;const s=n?r?ic:oc:sc,o=I(t);return(s.has(o)?"\\":"")+o}function cc(t){const e=t.map(s=>s.codePointAt(0)).sort((s,o)=>s-o),n=[];let r=null;for(let s=0;s<e.length;s++)e[s+1]===e[s]+1?r??(r=e[s]):r===null?n.push(e[s]):(n.push([r,e[s]]),r=null);return n}function lc(t,e,n){if(t)return">";let r="";if(e&&n){const{enable:s,disable:o}=e;r=(s!=null&&s.ignoreCase?"i":"")+(s!=null&&s.dotAll?"s":"")+(o?"-":"")+(o!=null&&o.ignoreCase?"i":"")+(o!=null&&o.dotAll?"s":"")}return`${r}:`}function uc({kind:t,max:e,min:n}){let r;return!n&&e===1?r="?":!n&&e===1/0?r="*":n===1&&e===1/0?r="+":n===e?r=`{${n}}`:r=`{${n},${e===1/0?"":e}}`,r+{greedy:"",lazy:"?",possessive:"+"}[t]}function Bn({type:t}){return t==="CapturingGroup"||t==="Group"||t==="LookaroundAssertion"}function hc(t){return t>47&&t<58}function Fn({type:t,value:e}){return t==="Character"&&e===45}var te,Q,ue,ne,he,$e,Ft,se,fc=(se=class extends RegExp{constructor(n,r,s){var e=(...al)=>(super(...al),oe(this,$e),oe(this,te,new Map),oe(this,Q,null),oe(this,ue),oe(this,ne,null),oe(this,he,null),g(this,"rawOptions",{}),this);const o=!!(s!=null&&s.lazyCompile);if(n instanceof RegExp){if(s)throw new Error("Cannot provide options when copying a regexp");const i=n;e(i,r),j(this,ue,i.source),i instanceof se&&(j(this,te,T(i,te)),j(this,ne,T(i,ne)),j(this,he,T(i,he)),this.rawOptions=i.rawOptions)}else{const i={hiddenCaptures:[],strategy:null,transfers:[],...s};e(o?"":n,r),j(this,ue,n),j(this,te,pc(i.hiddenCaptures,i.transfers)),j(this,he,i.strategy),this.rawOptions=s??{}}o||j(this,Q,this)}get source(){return T(this,ue)||"(?:)"}exec(n){if(!T(this,Q)){const{lazyCompile:o,...i}=this.rawOptions;j(this,Q,new se(T(this,ue),this.flags,i))}const r=this.global||this.sticky,s=this.lastIndex;if(T(this,he)==="clip_search"&&r&&s){this.lastIndex=0;const o=ht(this,$e,Ft).call(this,n.slice(s));return o&&(dc(o,s,n,this.hasIndices),this.lastIndex+=s),o}return ht(this,$e,Ft).call(this,n)}},te=new WeakMap,Q=new WeakMap,ue=new WeakMap,ne=new WeakMap,he=new WeakMap,$e=new WeakSet,Ft=function(n){T(this,Q).lastIndex=this.lastIndex;const r=Jt(se.prototype,this,"exec").call(T(this,Q),n);if(this.lastIndex=T(this,Q).lastIndex,!r||!T(this,te).size)return r;const s=[...r];r.length=1;let o;this.hasIndices&&(o=[...r.indices],r.indices.length=1);const i=[0];for(let a=1;a<s.length;a++){const{hidden:c,transferTo:l}=T(this,te).get(a)??{};if(c?i.push(null):(i.push(r.length),r.push(s[a]),this.hasIndices&&r.indices.push(o[a])),l&&s[a]!==void 0){const h=i[l];if(!h)throw new Error(`Invalid capture transfer to "${h}"`);if(r[h]=s[a],this.hasIndices&&(r.indices[h]=o[a]),r.groups){T(this,ne)||j(this,ne,gc(this.source));const u=T(this,ne).get(l);u&&(r.groups[u]=s[a],this.hasIndices&&(r.indices.groups[u]=o[a]))}}}return r},se);function dc(t,e,n,r){if(t.index+=e,t.input=n,r){const s=t.indices;for(let i=0;i<s.length;i++){const a=s[i];a&&(s[i]=[a[0]+e,a[1]+e])}const o=s.groups;o&&Object.keys(o).forEach(i=>{const a=o[i];a&&(o[i]=[a[0]+e,a[1]+e])})}}function pc(t,e){const n=new Map;for(const r of t)n.set(r,{hidden:!0});for(const[r,s]of e)for(const o of s)Re(n,o,{}).transferTo=r;return n}function gc(t){const e=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let r=0,s=0,o;for(;o=e.exec(t);){const{0:i,groups:{capture:a,name:c}}=o;i==="["?r++:r?i==="]"&&r--:a&&(s++,c&&n.set(s,c))}return n}function mc(t,e){const n=yc(t,e);return n.options?new fc(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function yc(t,e){const n=Pr(e),r=xr(t,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:Xt}),s=za(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),o=tc(s,n),i=La(o.pattern,{captureTransfers:o._captureTransfers,hiddenCaptures:o._hiddenCaptures,mode:"external"}),a=$a(i.pattern),c=Ra(a.pattern,{captureTransfers:i.captureTransfers,hiddenCaptures:i.hiddenCaptures}),l={pattern:c.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${o.flags}${o.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{const h=c.hiddenCaptures.sort((p,_)=>p-_),u=Array.from(c.captureTransfers),f=s._strategy,d=l.pattern.length>=n.lazyCompileLength;(h.length||u.length||f||d)&&(l.options={...h.length&&{hiddenCaptures:h},...u.length&&{transfers:u},...f&&{strategy:f},...d&&{lazyCompile:d}})}return l}function _c(t,e){return mc(t,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...e})}function xc(t={}){const e={target:"auto",cache:new Map,...t};return e.regexConstructor||(e.regexConstructor=n=>_c(n,{target:e.target})),{createScanner(n){return new Ti(n,e)},createString(n){return{content:n}}}}export{Cc as _,xc as a,kc as c};
|
package/public/index.html
CHANGED
|
@@ -12,17 +12,26 @@
|
|
|
12
12
|
var t=localStorage.getItem('pi-pilot-theme');
|
|
13
13
|
var d=t==='dark'||(t!=='light'&&matchMedia('(prefers-color-scheme:dark)').matches);
|
|
14
14
|
if(d){document.documentElement.classList.add('dark');
|
|
15
|
-
document.querySelector('meta[name="theme-color"]').content='#
|
|
15
|
+
document.querySelector('meta[name="theme-color"]').content='#0C0E12';}
|
|
16
16
|
}catch(e){}})();
|
|
17
17
|
</script>
|
|
18
|
+
<!-- Fonts: loaded non-blockingly so first paint never waits on the network.
|
|
19
|
+
`media="print"` + `onload` swap is the cross-browser async-CSS pattern —
|
|
20
|
+
the stylesheet downloads in the background, then flips to `all` once
|
|
21
|
+
ready. A system-font stack in index.css covers the gap before the web
|
|
22
|
+
font arrives, so there's no blank-text flash, only a brief swap. -->
|
|
18
23
|
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
19
24
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
20
25
|
<link
|
|
21
26
|
rel="stylesheet"
|
|
22
27
|
href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Instrument+Serif:ital@0;1&family=JetBrains+Mono:wght@400;500;600&display=swap"
|
|
28
|
+
media="print"
|
|
29
|
+
onload="this.media='all'"
|
|
23
30
|
/>
|
|
24
|
-
<script type="module" crossorigin src="/assets/index-
|
|
25
|
-
<link rel="
|
|
31
|
+
<script type="module" crossorigin src="/assets/index-CX2ohSDO.js"></script>
|
|
32
|
+
<link rel="modulepreload" crossorigin href="/assets/markdown-CY-Rm0E5.js">
|
|
33
|
+
<link rel="modulepreload" crossorigin href="/assets/shiki-BZ0sbaMe.js">
|
|
34
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CyoTMDCN.css">
|
|
26
35
|
</head>
|
|
27
36
|
<body>
|
|
28
37
|
<div id="root"></div>
|