diffs-pane 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -5
- package/dist/cli/index.js +61 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/daemon/edits.js +179 -0
- package/dist/daemon/edits.js.map +1 -0
- package/dist/daemon/security.js +2 -2
- package/dist/daemon/security.js.map +1 -1
- package/dist/daemon/server.js +50 -2
- package/dist/daemon/server.js.map +1 -1
- package/dist/daemon/session.js +24 -1
- package/dist/daemon/session.js.map +1 -1
- package/dist/shared/patch.js +94 -3
- package/dist/shared/patch.js.map +1 -1
- package/dist/shared/themes.js +62 -0
- package/dist/shared/themes.js.map +1 -0
- package/dist/ui/assets/index-C3xEfNP_.js +518 -0
- package/dist/ui/assets/index-DUH6QCUZ.css +1 -0
- package/dist/ui/assets/index-Dtx8mcCv.js +2832 -0
- package/dist/ui/assets/worker-O63gxiV6.js +156 -0
- package/dist/ui/index.html +2 -2
- package/dist/vcs/git.js +65 -1
- package/dist/vcs/git.js.map +1 -1
- package/dist/vcs/jj.js +13 -1
- package/dist/vcs/jj.js.map +1 -1
- package/dist/vcs/types.js +3 -1
- package/dist/vcs/types.js.map +1 -1
- package/package.json +12 -12
- package/skills/diffs-pane/SKILL.md +2 -0
- package/dist/ui/assets/index-BQk-ERmu.css +0 -1
- package/dist/ui/assets/index-CzSq0MRa.js +0 -2904
- package/dist/ui/assets/worker-DLF4drjM.js +0 -155
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
var P=class extends Error{constructor(t){super(t),this.name="ShikiError"}};function Ys(e){return Cn(e)}function Cn(e){return Array.isArray(e)?Js(e):e instanceof RegExp?e:typeof e=="object"?eo(e):e}function Js(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Cn(e[n]);return t}function eo(e){let t={};for(let n in e)t[n]=Cn(e[n]);return t}function Or(e,...t){return t.forEach(n=>{for(let r in n)e[r]=n[r]}),e}function Br(e){const t=~e.lastIndexOf("/")||~e.lastIndexOf("\\");return t===0?e:~t===e.length-1?Br(e.substring(0,e.length-1)):e.substr(~t+1)}var Lt=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,He=class{static hasCaptures(e){return e===null?!1:(Lt.lastIndex=0,Lt.test(e))}static replaceCaptures(e,t,n){return e.replace(Lt,(r,s,o,i)=>{let l=n[parseInt(s||o,10)];if(l){let a=t.substring(l.start,l.end);for(;a[0]===".";)a=a.substring(1);switch(i){case"downcase":return a.toLowerCase();case"upcase":return a.toUpperCase();default:return a}}else return r})}};function Dr(e,t){return e<t?-1:e>t?1:0}function Gr(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let s=0;s<n;s++){let o=Dr(e[s],t[s]);if(o!==0)return o}return 0}return n-r}function $n(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Fr(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var Ur=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);const t=this.fn(e);return this.cache.set(e,t),t}},ot=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(ro(e),t)}static createFromParsedTheme(e,t){return oo(e,t)}_cachedMatchRoot=new Ur(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;const t=e.scopeName,r=this._cachedMatchRoot.get(t).find(s=>to(e.parent,s.parentScopes));return r?new jr(r.fontStyle,r.foreground,r.background):null}},Nt=class tt{constructor(t,n){this.parent=t,this.scopeName=n}static push(t,n){for(const r of n)t=new tt(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new tt(n,t[r]);return n}push(t){return new tt(this,t)}getSegments(){let t=this;const n=[];for(;t;)n.push(t.scopeName),t=t.parent;return n.reverse(),n}toString(){return this.getSegments().join(" ")}extends(t){return this===t?!0:this.parent===null?!1:this.parent.extends(t)}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push(r.scopeName),r=r.parent;return r===t?n.reverse():void 0}};function to(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],s=!1;if(r===">"){if(n===t.length-1)return!1;r=t[++n],s=!0}for(;e&&!no(e.scopeName,r);){if(s)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function no(e,t){return t===e||e.startsWith(t)&&e[t.length]==="."}var jr=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function ro(e){if(!e)return[];if(!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let s=0,o=t.length;s<o;s++){let i=t[s];if(!i.settings)continue;let l;if(typeof i.scope=="string"){let f=i.scope;f=f.replace(/^[,]+/,""),f=f.replace(/[,]+$/,""),l=f.split(",")}else Array.isArray(i.scope)?l=i.scope:l=[""];let a=-1;if(typeof i.settings.fontStyle=="string"){a=0;let f=i.settings.fontStyle.split(" ");for(let h=0,d=f.length;h<d;h++)switch(f[h]){case"italic":a=a|1;break;case"bold":a=a|2;break;case"underline":a=a|4;break;case"strikethrough":a=a|8;break}}let c=null;typeof i.settings.foreground=="string"&&$n(i.settings.foreground)&&(c=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&$n(i.settings.background)&&(u=i.settings.background);for(let f=0,h=l.length;f<h;f++){let p=l[f].trim().split(" "),b=p[p.length-1],w=null;p.length>1&&(w=p.slice(0,p.length-1),w.reverse()),n[r++]=new so(b,w,s,a,c,u)}}return n}var so=class{constructor(e,t,n,r,s,o){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=s,this.background=o}},z=(e=>(e[e.NotSet=-1]="NotSet",e[e.None=0]="None",e[e.Italic=1]="Italic",e[e.Bold=2]="Bold",e[e.Underline=4]="Underline",e[e.Strikethrough=8]="Strikethrough",e))(z||{});function oo(e,t){e.sort((a,c)=>{let u=Dr(a.scope,c.scope);return u!==0||(u=Gr(a.parentScopes,c.parentScopes),u!==0)?u:a.index-c.index});let n=0,r="#000000",s="#ffffff";for(;e.length>=1&&e[0].scope==="";){let a=e.shift();a.fontStyle!==-1&&(n=a.fontStyle),a.foreground!==null&&(r=a.foreground),a.background!==null&&(s=a.background)}let o=new io(t),i=new jr(n,o.getId(r),o.getId(s)),l=new lo(new Qt(0,null,-1,0,0),[]);for(let a=0,c=e.length;a<c;a++){let u=e[a];l.insert(0,u.scope,u.parentScopes,u.fontStyle,o.getId(u.foreground),o.getId(u.background))}return new ot(o,i,l)}var io=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw new Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},ao=Object.freeze([]),Qt=class Wr{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(t,n,r,s,o){this.scopeDepth=t,this.parentScopes=n||ao,this.fontStyle=r,this.foreground=s,this.background=o}clone(){return new Wr(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(t){let n=[];for(let r=0,s=t.length;r<s;r++)n[r]=t[r].clone();return n}acceptOverwrite(t,n,r,s){this.scopeDepth>t?console.log("how did this happen?"):this.scopeDepth=t,n!==-1&&(this.fontStyle=n),r!==0&&(this.foreground=r),s!==0&&(this.background=s)}},lo=class Yt{constructor(t,n=[],r={}){this._mainRule=t,this._children=r,this._rulesWithParentScopes=n}_rulesWithParentScopes;static _cmpBySpecificity(t,n){if(t.scopeDepth!==n.scopeDepth)return n.scopeDepth-t.scopeDepth;let r=0,s=0;for(;t.parentScopes[r]===">"&&r++,n.parentScopes[s]===">"&&s++,!(r>=t.parentScopes.length||s>=n.parentScopes.length);){const o=n.parentScopes[s].length-t.parentScopes[r].length;if(o!==0)return o;r++,s++}return n.parentScopes.length-t.parentScopes.length}match(t){if(t!==""){let r=t.indexOf("."),s,o;if(r===-1?(s=t,o=""):(s=t.substring(0,r),o=t.substring(r+1)),this._children.hasOwnProperty(s))return this._children[s].match(o)}const n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(Yt._cmpBySpecificity),n}insert(t,n,r,s,o,i){if(n===""){this._doInsertHere(t,r,s,o,i);return}let l=n.indexOf("."),a,c;l===-1?(a=n,c=""):(a=n.substring(0,l),c=n.substring(l+1));let u;this._children.hasOwnProperty(a)?u=this._children[a]:(u=new Yt(this._mainRule.clone(),Qt.cloneArr(this._rulesWithParentScopes)),this._children[a]=u),u.insert(t+1,c,r,s,o,i)}_doInsertHere(t,n,r,s,o){if(n===null){this._mainRule.acceptOverwrite(t,r,s,o);return}for(let i=0,l=this._rulesWithParentScopes.length;i<l;i++){let a=this._rulesWithParentScopes[i];if(Gr(a.parentScopes,n)===0){a.acceptOverwrite(t,r,s,o);return}}r===-1&&(r=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),o===0&&(o=this._mainRule.background),this._rulesWithParentScopes.push(new Qt(t,n,r,s,o))}},ye=class Q{static toBinaryStr(t){return t.toString(2).padStart(32,"0")}static print(t){const n=Q.getLanguageId(t),r=Q.getTokenType(t),s=Q.getFontStyle(t),o=Q.getForeground(t),i=Q.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:s,foreground:o,background:i})}static getLanguageId(t){return(t&255)>>>0}static getTokenType(t){return(t&768)>>>8}static containsBalancedBrackets(t){return(t&1024)!==0}static getFontStyle(t){return(t&30720)>>>11}static getForeground(t){return(t&16744448)>>>15}static getBackground(t){return(t&4278190080)>>>24}static set(t,n,r,s,o,i,l){let a=Q.getLanguageId(t),c=Q.getTokenType(t),u=Q.containsBalancedBrackets(t)?1:0,f=Q.getFontStyle(t),h=Q.getForeground(t),d=Q.getBackground(t);return n!==0&&(a=n),r!==8&&(c=r),s!==null&&(u=s?1:0),o!==-1&&(f=o),i!==0&&(h=i),l!==0&&(d=l),(a<<0|c<<8|u<<10|f<<11|h<<15|d<<24)>>>0}};function it(e,t){const n=[],r=co(e);let s=r.next();for(;s!==null;){let a=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":a=1;break;case"L":a=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=r.next()}let c=i();if(n.push({matcher:c,priority:a}),s!==",")break;s=r.next()}return n;function o(){if(s==="-"){s=r.next();const a=o();return c=>!!a&&!a(c)}if(s==="("){s=r.next();const a=l();return s===")"&&(s=r.next()),a}if(Mn(s)){const a=[];do a.push(s),s=r.next();while(Mn(s));return c=>t(a,c)}return null}function i(){const a=[];let c=o();for(;c;)a.push(c),c=o();return u=>a.every(f=>f(u))}function l(){const a=[];let c=i();for(;c&&(a.push(c),s==="|"||s===",");){do s=r.next();while(s==="|"||s===",");c=i()}return u=>a.some(f=>f(u))}}function Mn(e){return!!e&&!!e.match(/[\w\.:]+/)}function co(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;const r=n[0];return n=t.exec(e),r}}}function zr(e){typeof e.dispose=="function"&&e.dispose()}var Be=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},uo=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},fo=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){const t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},ho=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new Be(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){const e=this.Q;this.Q=[];const t=new fo;for(const n of e)po(n,this.initialScopeName,this.repo,t);for(const n of t.references)if(n instanceof Be){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 po(e,t,n,r){const s=n.lookup(e.scopeName);if(!s){if(e.scopeName===t)throw new Error(`No grammar provided for <${t}>`);return}const o=n.lookup(t);e instanceof Be?nt({baseGrammar:o,selfGrammar:s},r):Jt(e.ruleName,{baseGrammar:o,selfGrammar:s,repository:s.repository},r);const i=n.injections(e.scopeName);if(i)for(const l of i)r.add(new Be(l))}function Jt(e,t,n){if(t.repository&&t.repository[e]){const r=t.repository[e];at([r],t,n)}}function nt(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&at(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&at(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function at(e,t,n){for(const r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);const s=r.repository?Or({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&at(r.patterns,{...t,repository:s},n);const o=r.include;if(!o)continue;const i=Hr(o);switch(i.kind){case 0:nt({...t,selfGrammar:t.baseGrammar},n);break;case 1:nt(t,n);break;case 2:Jt(i.ruleName,{...t,repository:s},n);break;case 3:case 4:const l=i.scopeName===t.selfGrammar.scopeName?t.selfGrammar:i.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(l){const a={baseGrammar:t.baseGrammar,selfGrammar:l,repository:s};i.kind===4?Jt(i.ruleName,a,n):nt(a,n)}else i.kind===4?n.add(new uo(i.scopeName,i.ruleName)):n.add(new Be(i.scopeName));break}}}var go=class{kind=0},mo=class{kind=1},yo=class{constructor(e){this.ruleName=e}kind=2},bo=class{constructor(e){this.scopeName=e}kind=3},wo=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function Hr(e){if(e==="$base")return new go;if(e==="$self")return new mo;const t=e.indexOf("#");if(t===-1)return new bo(e);if(t===0)return new yo(e.substring(1));{const n=e.substring(0,t),r=e.substring(t+1);return new wo(n,r)}}var Co=/\\(\d+)/,On=/\\(\d+)/g,_o=-1,qr=-2;var je=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=He.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=He.hasCaptures(this._contentName)}get debugName(){const e=this.$location?`${Br(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:He.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:He.replaceCaptures(this._contentName,e,t)}},So=class extends je{retokenizeCapturedWithRuleId;constructor(e,t,n,r,s){super(e,t,n,r),this.retokenizeCapturedWithRuleId=s}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,n,r){throw new Error("Not supported!")}},ko=class extends je{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,s){super(e,t,n,null),this._match=new De(r,this.id),this.captures=s,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ge,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Bn=class extends je{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,s){super(e,t,n,r),this.patterns=s.patterns,this.hasMissingPatterns=s.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Ge,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},en=class extends je{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,s,o,i,l,a,c){super(e,t,n,r),this._begin=new De(s,this.id),this.beginCaptures=o,this._end=new De(i||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=l,this.applyEndPatternLast=a||!1,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ge;for(const n of this.patterns)e.getRule(n).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},lt=class extends je{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,s,o,i,l,a){super(e,t,n,r),this._begin=new De(s,this.id),this.beginCaptures=o,this.whileCaptures=l,this._while=new De(i,qr),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=a.patterns,this.hasMissingPatterns=a.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Ge;for(const t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Ge,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||""),this._cachedCompiledWhilePatterns}},Vr=class W{static createCaptureRule(t,n,r,s,o){return t.registerRule(i=>new So(n,i,r,s,o))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(s=>{if(t.id=s,t.match)return new ko(t.$vscodeTextmateLocation,t.id,t.name,t.match,W._compileCaptures(t.captures,n,r));if(typeof t.begin>"u"){t.repository&&(r=Or({},r,t.repository));let o=t.patterns;return typeof o>"u"&&t.include&&(o=[{include:t.include}]),new Bn(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,W._compilePatterns(o,n,r))}return t.while?new lt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,W._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,W._compileCaptures(t.whileCaptures||t.captures,n,r),W._compilePatterns(t.patterns,n,r)):new en(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,W._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,W._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,W._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let s=[];if(t){let o=0;for(const i in t){if(i==="$vscodeTextmateLocation")continue;const l=parseInt(i,10);l>o&&(o=l)}for(let i=0;i<=o;i++)s[i]=null;for(const i in t){if(i==="$vscodeTextmateLocation")continue;const l=parseInt(i,10);let a=0;t[i].patterns&&(a=W.getCompiledRuleId(t[i],n,r)),s[l]=W.createCaptureRule(n,t[i].$vscodeTextmateLocation,t[i].name,t[i].contentName,a)}}return s}static _compilePatterns(t,n,r){let s=[];if(t)for(let o=0,i=t.length;o<i;o++){const l=t[o];let a=-1;if(l.include){const c=Hr(l.include);switch(c.kind){case 0:case 1:a=W.getCompiledRuleId(r[l.include],n,r);break;case 2:let u=r[c.ruleName];u&&(a=W.getCompiledRuleId(u,n,r));break;case 3:case 4:const f=c.scopeName,h=c.kind===4?c.ruleName:null,d=n.getExternalGrammar(f,r);if(d)if(h){let p=d.repository[h];p&&(a=W.getCompiledRuleId(p,n,d.repository))}else a=W.getCompiledRuleId(d.repository.$self,n,d.repository);break}}else a=W.getCompiledRuleId(l,n,r);if(a!==-1){const c=n.getRule(a);let u=!1;if((c instanceof Bn||c instanceof en||c instanceof lt)&&c.hasMissingPatterns&&c.patterns.length===0&&(u=!0),u)continue;s.push(a)}}return{patterns:s,hasMissingPatterns:(t?t.length:0)!==s.length}}},De=class Xr{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(t,n){if(t&&typeof t=="string"){const r=t.length;let s=0,o=[],i=!1;for(let l=0;l<r;l++)if(t.charAt(l)==="\\"&&l+1<r){const c=t.charAt(l+1);c==="z"?(o.push(t.substring(s,l)),o.push("$(?!\\n)(?<!\\n)"),s=l+2):(c==="A"||c==="G")&&(i=!0),l++}this.hasAnchor=i,s===0?this.source=t:(o.push(t.substring(s,r)),this.source=o.join(""))}else this.hasAnchor=!1,this.source=t;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=n,typeof this.source=="string"?this.hasBackReferences=Co.test(this.source):this.hasBackReferences=!1}clone(){return new Xr(this.source,this.ruleId)}setSource(t){this.source!==t&&(this.source=t,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(t,n){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let r=n.map(s=>t.substring(s.start,s.end));return On.lastIndex=0,this.source.replace(On,(s,o)=>Fr(r[parseInt(o,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let t=[],n=[],r=[],s=[],o,i,l,a;for(o=0,i=this.source.length;o<i;o++)l=this.source.charAt(o),t[o]=l,n[o]=l,r[o]=l,s[o]=l,l==="\\"&&o+1<i&&(a=this.source.charAt(o+1),a==="A"?(t[o+1]="",n[o+1]="",r[o+1]="A",s[o+1]="A"):a==="G"?(t[o+1]="",n[o+1]="G",r[o+1]="",s[o+1]="G"):(t[o+1]=a,n[o+1]=a,r[o+1]=a,s[o+1]=a),o++);return{A0_G0:t.join(""),A0_G1:n.join(""),A1_G0:r.join(""),A1_G1:s.join("")}}resolveAnchors(t,n){return!this.hasAnchor||!this._anchorCache||typeof this.source!="string"?this.source:t?n?this._anchorCache.A1_G1:this._anchorCache.A1_G0:n?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},Ge=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&(this._cached.dispose(),this._cached=null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(n=>n.source);this._cached=new Dn(e,t,this._items.map(n=>n.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){let r=this._items.map(s=>s.resolveAnchors(t,n));return new Dn(e,r,this._items.map(s=>s.ruleId))}},Dn=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(" - "+this.rules[t]+": "+this.regExps[t]);return e.join(`
|
|
2
|
+
`)}findNextMatchSync(e,t,n){const r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Tt=class{constructor(e,t){this.languageId=e,this.tokenType=t}},vo=class tn{_defaultAttributes;_embeddedLanguagesMatcher;constructor(t,n){this._defaultAttributes=new Tt(t,8),this._embeddedLanguagesMatcher=new xo(Object.entries(n||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?tn._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new Tt(0,0);_getBasicScopeAttributes=new Ur(t=>{const n=this._scopeToLanguage(t),r=this._toStandardTokenType(t);return new Tt(n,r)});_scopeToLanguage(t){return this._embeddedLanguagesMatcher.match(t)||0}_toStandardTokenType(t){const n=t.match(tn.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},xo=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);const t=e.map(([n,r])=>Fr(n));t.sort(),t.reverse(),this.scopesRegExp=new RegExp(`^((${t.join(")|(")}))($|\\.)`,"")}}match(e){if(!this.scopesRegExp)return;const t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}},Gn=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Kr(e,t,n,r,s,o,i,l){const a=t.content.length;let c=!1,u=-1;if(i){const d=Eo(e,t,n,r,s,o);s=d.stack,r=d.linePos,n=d.isFirstLine,u=d.anchorPosition}const f=Date.now();for(;!c;){if(l!==0&&Date.now()-f>l)return new Gn(s,!0);h()}return new Gn(s,!1);function h(){const d=Io(e,t,n,r,s,u);if(!d){o.produce(s,a),c=!0;return}const p=d.captureIndices,b=d.matchedRuleId,w=p&&p.length>0?p[0].end>r:!1;if(b===_o){const g=s.getRule(e);o.produce(s,p[0].start),s=s.withContentNameScopesList(s.nameScopesList),$e(e,t,n,s,o,g.endCaptures,p),o.produce(s,p[0].end);const m=s;if(s=s.parent,u=m.getAnchorPos(),!w&&m.getEnterPos()===r){s=m,o.produce(s,a),c=!0;return}}else{const g=e.getRule(b);o.produce(s,p[0].start);const m=s,y=g.getName(t.content,p),_=s.contentNameScopesList.pushAttributed(y,e);if(s=s.push(b,r,u,p[0].end===a,null,_,_),g instanceof en){const S=g;$e(e,t,n,s,o,S.beginCaptures,p),o.produce(s,p[0].end),u=p[0].end;const k=S.getContentName(t.content,p),v=_.pushAttributed(k,e);if(s=s.withContentNameScopesList(v),S.endHasBackReferences&&(s=s.withEndRule(S.getEndWithResolvedBackReferences(t.content,p))),!w&&m.hasSameRuleAs(s)){s=s.pop(),o.produce(s,a),c=!0;return}}else if(g instanceof lt){const S=g;$e(e,t,n,s,o,S.beginCaptures,p),o.produce(s,p[0].end),u=p[0].end;const k=S.getContentName(t.content,p),v=_.pushAttributed(k,e);if(s=s.withContentNameScopesList(v),S.whileHasBackReferences&&(s=s.withEndRule(S.getWhileWithResolvedBackReferences(t.content,p))),!w&&m.hasSameRuleAs(s)){s=s.pop(),o.produce(s,a),c=!0;return}}else if($e(e,t,n,s,o,g.captures,p),o.produce(s,p[0].end),s=s.pop(),!w){s=s.safePop(),o.produce(s,a),c=!0;return}}p[0].end>r&&(r=p[0].end,n=!1)}}function Eo(e,t,n,r,s,o){let i=s.beginRuleCapturedEOL?0:-1;const l=[];for(let a=s;a;a=a.pop()){const c=a.getRule(e);c instanceof lt&&l.push({rule:c,stack:a})}for(let a=l.pop();a;a=l.pop()){const{ruleScanner:c,findOptions:u}=Lo(a.rule,e,a.stack.endRule,n,r===i),f=c.findNextMatchSync(t,r,u);if(f){if(f.ruleId!==qr){s=a.stack.pop();break}f.captureIndices&&f.captureIndices.length&&(o.produce(a.stack,f.captureIndices[0].start),$e(e,t,n,a.stack,o,a.rule.whileCaptures,f.captureIndices),o.produce(a.stack,f.captureIndices[0].end),i=f.captureIndices[0].end,f.captureIndices[0].end>r&&(r=f.captureIndices[0].end,n=!1))}else{s=a.stack.pop();break}}return{stack:s,linePos:r,anchorPosition:i,isFirstLine:n}}function Io(e,t,n,r,s,o){const i=Ao(e,t,n,r,s,o),l=e.getInjections();if(l.length===0)return i;const a=Ro(l,e,t,n,r,s,o);if(!a)return i;if(!i)return a;const c=i.captureIndices[0].start,u=a.captureIndices[0].start;return u<c||a.priorityMatch&&u===c?a:i}function Ao(e,t,n,r,s,o){const i=s.getRule(e),{ruleScanner:l,findOptions:a}=Zr(i,e,s.endRule,n,r===o),c=l.findNextMatchSync(t,r,a);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Ro(e,t,n,r,s,o,i){let l=Number.MAX_VALUE,a=null,c,u=0;const f=o.contentNameScopesList.getScopeNames();for(let h=0,d=e.length;h<d;h++){const p=e[h];if(!p.matcher(f))continue;const b=t.getRule(p.ruleId),{ruleScanner:w,findOptions:g}=Zr(b,t,null,r,s===i),m=w.findNextMatchSync(n,s,g);if(!m)continue;const y=m.captureIndices[0].start;if(!(y>=l)&&(l=y,a=m.captureIndices,c=m.ruleId,u=p.priority,l===s))break}return a?{priorityMatch:u===-1,captureIndices:a,matchedRuleId:c}:null}function Zr(e,t,n,r,s){return{ruleScanner:e.compileAG(t,n,r,s),findOptions:0}}function Lo(e,t,n,r,s){return{ruleScanner:e.compileWhileAG(t,n,r,s),findOptions:0}}function $e(e,t,n,r,s,o,i){if(o.length===0)return;const l=t.content,a=Math.min(o.length,i.length),c=[],u=i[0].end;for(let f=0;f<a;f++){const h=o[f];if(h===null)continue;const d=i[f];if(d.length===0)continue;if(d.start>u)break;for(;c.length>0&&c[c.length-1].endPos<=d.start;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop();if(c.length>0?s.produceFromScopes(c[c.length-1].scopes,d.start):s.produce(r,d.start),h.retokenizeCapturedWithRuleId){const b=h.getName(l,i),w=r.contentNameScopesList.pushAttributed(b,e),g=h.getContentName(l,i),m=w.pushAttributed(g,e),y=r.push(h.retokenizeCapturedWithRuleId,d.start,-1,!1,null,w,m),_=e.createOnigString(l.substring(0,d.end));Kr(e,_,n&&d.start===0,d.start,y,s,!1,0),zr(_);continue}const p=h.getName(l,i);if(p!==null){const w=(c.length>0?c[c.length-1].scopes:r.contentNameScopesList).pushAttributed(p,e);c.push(new No(w,d.end))}}for(;c.length>0;)s.produceFromScopes(c[c.length-1].scopes,c[c.length-1].endPos),c.pop()}var No=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function To(e,t,n,r,s,o,i,l){return new $o(e,t,n,r,s,o,i,l)}function Fn(e,t,n,r,s){const o=it(t,ct),i=Vr.getCompiledRuleId(n,r,s.repository);for(const l of o)e.push({debugSelector:t,matcher:l.matcher,ruleId:i,grammar:s,priority:l.priority})}function ct(e,t){if(t.length<e.length)return!1;let n=0;return e.every(r=>{for(let s=n;s<t.length;s++)if(Po(t[s],r))return n=s+1,!0;return!1})}function Po(e,t){if(!e)return!1;if(e===t)return!0;const n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]==="."}var $o=class{constructor(e,t,n,r,s,o,i,l){if(this._rootScopeName=e,this.balancedBracketSelectors=o,this._onigLib=l,this._basicScopeAttributesProvider=new vo(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=Un(t,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const a of Object.keys(s)){const c=it(a,ct);for(const u of c)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[a]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(const e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){const e={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){const s=r.injections;if(s)for(let i in s)Fn(t,i,s[i],this,r);const o=this._grammarRepository.injections(n);o&&o.forEach(i=>{const l=this.getExternalGrammar(i);if(l){const a=l.injectionSelector;a&&Fn(t,a,l,this,l)}})}return t.sort((s,o)=>s.priority-o.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){const t=++this._lastRuleId,n=e(t);return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[e]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){const n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Un(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){const r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){const r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=Vr.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!t||t===nn.NULL){s=!0;const c=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),f=ye.set(0,c.languageId,c.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),h=this.getRule(this._rootId).getName(null,null);let d;h?d=Me.createRootAndLookUpScopeName(h,f,this):d=Me.createRoot("unknown",f),t=new nn(null,this._rootId,-1,-1,!1,null,d,d)}else s=!1,t.reset();e=e+`
|
|
3
|
+
`;const o=this.createOnigString(e),i=o.content.length,l=new Oo(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),a=Kr(this,o,s,0,t,l,!0,r);return zr(o),{lineLength:i,lineTokens:l,ruleStack:a.stack,stoppedEarly:a.stoppedEarly}}};function Un(e,t){return e=Ys(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var Me=class re{constructor(t,n,r){this.parent=t,this.scopePath=n,this.tokenAttributes=r}static fromExtension(t,n){let r=t,s=t?.scopePath??null;for(const o of n)s=Nt.push(s,o.scopeNames),r=new re(r,s,o.encodedTokenAttributes);return r}static createRoot(t,n){return new re(null,new Nt(null,t),n)}static createRootAndLookUpScopeName(t,n,r){const s=r.getMetadataForScope(t),o=new Nt(null,t),i=r.themeProvider.themeMatch(o),l=re.mergeAttributes(n,s,i);return new re(null,o,l)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(t){return re.equals(this,t)}static equals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.scopeName!==n.scopeName||t.tokenAttributes!==n.tokenAttributes)return!1;t=t.parent,n=n.parent}while(!0)}static mergeAttributes(t,n,r){let s=-1,o=0,i=0;return r!==null&&(s=r.fontStyle,o=r.foregroundId,i=r.backgroundId),ye.set(t,n.languageId,n.tokenType,null,s,o,i)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(" ")===-1)return re._pushAttributed(this,t,n);const r=t.split(/ /g);let s=this;for(const o of r)s=re._pushAttributed(s,o,n);return s}static _pushAttributed(t,n,r){const s=r.getMetadataForScope(n),o=t.scopePath.push(n),i=r.themeProvider.themeMatch(o),l=re.mergeAttributes(t.tokenAttributes,s,i);return new re(t,o,l)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(t){const n=[];let r=this;for(;r&&r!==t;)n.push({encodedTokenAttributes:r.tokenAttributes,scopeNames:r.scopePath.getExtensionIfDefined(r.parent?.scopePath??null)}),r=r.parent;return r===t?n.reverse():void 0}},nn=class de{constructor(t,n,r,s,o,i,l,a){this.parent=t,this.ruleId=n,this.beginRuleCapturedEOL=o,this.endRule=i,this.nameScopesList=l,this.contentNameScopesList=a,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=r,this._anchorPos=s}_stackElementBrand=void 0;static NULL=new de(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:de._equals(this,t)}static _equals(t,n){return t===n?!0:this._structuralEquals(t,n)?Me.equals(t.contentNameScopesList,n.contentNameScopesList):!1}static _structuralEquals(t,n){do{if(t===n||!t&&!n)return!0;if(!t||!n||t.depth!==n.depth||t.ruleId!==n.ruleId||t.endRule!==n.endRule)return!1;t=t.parent,n=n.parent}while(!0)}clone(){return this}static _reset(t){for(;t;)t._enterPos=-1,t._anchorPos=-1,t=t.parent}reset(){de._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,s,o,i,l){return new de(this,t,n,r,s,o,i,l)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(t){return t.getRule(this.ruleId)}toString(){const t=[];return this._writeString(t,0),"["+t.join(",")+"]"}_writeString(t,n){return this.parent&&(n=this.parent._writeString(t,n)),t[n++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,n}withContentNameScopesList(t){return this.contentNameScopesList===t?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,t)}withEndRule(t){return this.endRule===t?this:new de(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(t){let n=this;for(;n&&n._enterPos===t._enterPos;){if(n.ruleId===t.ruleId)return!0;n=n.parent}return!1}toStateStackFrame(){return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){const r=Me.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new de(t,n.ruleId,n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,Me.fromExtension(r,n.contentNameScopesList))}},Mo=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(n=>n==="*"?(this.allowAny=!0,[]):it(n,ct).map(r=>r.matcher)),this.unbalancedBracketScopes=t.flatMap(n=>it(n,ct).map(r=>r.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(const t of this.unbalancedBracketScopes)if(t(e))return!1;for(const t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},Oo=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let r=e?.tokenAttributes??0,s=!1;if(this.balancedBracketSelectors?.matchesAlways&&(s=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const o=e?.getScopeNames()??[];for(const i of this._tokenTypeOverrides)i.matcher(o)&&(r=ye.set(r,0,i.type,null,-1,0,0));this.balancedBracketSelectors&&(s=this.balancedBracketSelectors.match(o))}if(s&&(r=ye.set(r,0,8,s,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===r){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(r),this._lastTokenEndIndex=t;return}const n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);const n=new Uint32Array(this._binaryTokens.length);for(let r=0,s=this._binaryTokens.length;r<s;r++)n[r]=this._binaryTokens[r];return n}},Bo=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(const e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,s){if(!this._grammars.has(e)){let o=this._rawGrammars.get(e);if(!o)return null;this._grammars.set(e,To(e,o,t,n,r,s,this,this._onigLib))}return this._grammars.get(e)}},Do=class{_options;_syncRegistry;_ensureGrammarCache;constructor(t){this._options=t,this._syncRegistry=new Bo(ot.createFromRawTheme(t.theme,t.colorMap),t.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(t,n){this._syncRegistry.setTheme(ot.createFromRawTheme(t,n))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(t,n,r){return this.loadGrammarWithConfiguration(t,n,{embeddedLanguages:r})}loadGrammarWithConfiguration(t,n,r){return this._loadGrammar(t,n,r.embeddedLanguages,r.tokenTypes,new Mo(r.balancedBracketSelectors||[],r.unbalancedBracketSelectors||[]))}loadGrammar(t){return this._loadGrammar(t,0,null,null,null)}_loadGrammar(t,n,r,s,o){const i=new ho(this._syncRegistry,t);for(;i.Q.length>0;)i.Q.map(l=>this._loadSingleGrammar(l.scopeName)),i.processQueue();return this._grammarForScopeName(t,n,r,s,o)}_loadSingleGrammar(t){this._ensureGrammarCache.has(t)||(this._doLoadSingleGrammar(t),this._ensureGrammarCache.set(t,!0))}_doLoadSingleGrammar(t){const n=this._options.loadGrammar(t);if(n){const r=typeof this._options.getInjections=="function"?this._options.getInjections(t):void 0;this._syncRegistry.addGrammar(n,r)}}addGrammar(t,n=[],r=0,s=null){return this._syncRegistry.addGrammar(t,n),this._grammarForScopeName(t.scopeName,r,s)}_grammarForScopeName(t,n=0,r=null,s=null,o=null){return this._syncRegistry.grammarForScopeName(t,n,r,s,o)}},rn=nn.NULL;function ut(e,t){const n=typeof e=="string"?{}:{...e.colorReplacements},r=typeof e=="string"?e:e.name;for(const[s,o]of Object.entries(t?.colorReplacements||{}))typeof o=="string"?n[s]=o:s===r&&Object.assign(n,o);return n}function fe(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function Go(e){return Array.isArray(e)?e:[e]}async function Qr(e){return Promise.resolve(typeof e=="function"?e():e).then(t=>t.default||t)}function yt(e){return!e||["plaintext","txt","text","plain"].includes(e)}function Fo(e){return e==="ansi"||yt(e)}function bt(e){return e==="none"}function Uo(e){return bt(e)}const jo=/(\r?\n)/g;function wt(e,t=!1){if(e.length===0)return[["",0]];const n=e.split(jo);let r=0;const s=[];for(let o=0;o<n.length;o+=2){const i=t?n[o]+(n[o+1]||""):n[o];s.push([i,r]),r+=n[o].length,r+=n[o+1]?.length||0}return s}const jn={light:"#333333",dark:"#bbbbbb"},Wn={light:"#fffffe",dark:"#1e1e1e"},zn="__shiki_resolved";function _n(e){if(e?.[zn])return e;const t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||="dark",t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){const l=t.settings?t.settings.find(a=>!a.name&&!a.scope):void 0;l?.settings?.foreground&&(r=l.settings.foreground),l?.settings?.background&&(n=l.settings.background),!r&&t?.colors?.["editor.foreground"]&&(r=t.colors["editor.foreground"]),!n&&t?.colors?.["editor.background"]&&(n=t.colors["editor.background"]),r||(r=t.type==="light"?jn.light:jn.dark),n||(n=t.type==="light"?Wn.light:Wn.dark),t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let s=0;const o=new Map;function i(l){if(o.has(l))return o.get(l);s+=1;const a=`#${s.toString(16).padStart(8,"0").toLowerCase()}`;return t.colorReplacements?.[`#${a}`]?i(l):(o.set(l,a),a)}t.settings=t.settings.map(l=>{const a=l.settings?.foreground&&!l.settings.foreground.startsWith("#"),c=l.settings?.background&&!l.settings.background.startsWith("#");if(!a&&!c)return l;const u={...l,settings:{...l.settings}};if(a){const f=i(l.settings.foreground);t.colorReplacements[f]=l.settings.foreground,u.settings.foreground=f}if(c){const f=i(l.settings.background);t.colorReplacements[f]=l.settings.background,u.settings.background=f}return u});for(const l of Object.keys(t.colors||{}))if((l==="editor.foreground"||l==="editor.background"||l.startsWith("terminal.ansi"))&&!t.colors[l]?.startsWith("#")){const a=i(t.colors[l]);t.colorReplacements[a]=t.colors[l],t.colors[l]=a}return Object.defineProperty(t,zn,{enumerable:!1,writable:!1,value:!0}),t}async function Yr(e){return[...new Set((await Promise.all(e.filter(t=>!Fo(t)).map(async t=>await Qr(t).then(n=>Array.isArray(n)?n:[n])))).flat())]}async function Jr(e){return(await Promise.all(e.map(async t=>Uo(t)?null:_n(await Qr(t))))).filter(t=>!!t)}function es(e,t){if(!t)return e;if(t[e]){const n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new P(`Circular alias \`${[...n].join(" -> ")} -> ${e}\``);n.add(e)}}return e}var Wo=class extends Do{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(s=>this.loadTheme(s)),this.loadLanguages(this._langs)}getTheme(e){return typeof e=="string"?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){const t=_n(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||(this._loadedThemesCache=[...this._resolvedThemes.keys()]),this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=ot.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=es(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;const t=new Set([...this._langMap.values()].filter(s=>s.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);const n={balancedBracketSelectors:e.balancedBracketSelectors||["*"],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);const r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(s=>{this._alias[s]=e.name}),this._loadedLanguagesCache=null,t.size)for(const s of t)this._resolvedGrammars.delete(s.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(s.scopeName),this._syncRegistry?._grammars?.delete(s.scopeName),this.loadLanguage(this._langMap.get(s.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(const r of e)this.resolveEmbeddedLanguages(r);const t=[...this._langGraph.entries()],n=t.filter(([r,s])=>!s);if(n.length){const r=t.filter(([s,o])=>o?(o.embeddedLanguages||o.embeddedLangs)?.some(i=>n.map(([l])=>l).includes(i)):!1).filter(s=>!n.includes(s));throw new P(`Missing languages ${n.map(([s])=>`\`${s}\``).join(", ")}, required by ${r.map(([s])=>`\`${s}\``).join(", ")}`)}for(const[r,s]of t)this._resolver.addLanguage(s);for(const[r,s]of t)this.loadLanguage(s)}getLoadedLanguages(){return this._loadedLanguagesCache||(this._loadedLanguagesCache=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])]),this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);const t=e.embeddedLanguages??e.embeddedLangs;if(t)for(const n of t)this._langGraph.set(n,this._langMap.get(n))}},zo=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:n=>e.createScanner(n),createOnigString:n=>e.createString(n)},t.forEach(n=>this.addLanguage(n))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){const t=e.split(".");let n=[];for(let r=1;r<=t.length;r++){const s=t.slice(0,r).join(".");n=[...n,...this._injections.get(s)||[]]}return n}};let Te=0;function Ho(e){Te+=1,e.warnings!==!1&&Te>=10&&Te%10===0&&console.warn(`[Shiki] ${Te} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new P("`engine` option is required for synchronous mode");const n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(_n),s=new Wo(new zo(e.engine,n),r,n,e.langAlias);let o;function i(m){return es(m,e.langAlias)}function l(m){w();const y=s.getGrammar(typeof m=="string"?m:m.name);if(!y)throw new P(`Language \`${m}\` not found, you may need to load it first`);return y}function a(m){if(m==="none")return{bg:"",fg:"",name:"none",settings:[],type:"dark"};w();const y=s.getTheme(m);if(!y)throw new P(`Theme \`${m}\` not found, you may need to load it first`);return y}function c(m){w();const y=a(m);return o!==m&&(s.setTheme(y),o=m),{theme:y,colorMap:s.getColorMap()}}function u(){return w(),s.getLoadedThemes()}function f(){return w(),s.getLoadedLanguages()}function h(...m){w(),s.loadLanguages(m.flat(1))}async function d(...m){return h(await Yr(m))}function p(...m){w();for(const y of m.flat(1))s.loadTheme(y)}async function b(...m){return w(),p(await Jr(m))}function w(){if(t)throw new P("Shiki instance has been disposed")}function g(){t||(t=!0,s.dispose(),Te-=1)}return{setTheme:c,getTheme:a,getLanguage:l,getLoadedThemes:u,getLoadedLanguages:f,resolveLangAlias:i,loadLanguage:d,loadLanguageSync:h,loadTheme:b,loadThemeSync:p,dispose:g,[Symbol.dispose]:g}}async function qo(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");const[t,n,r]=await Promise.all([Jr(e.themes||[]),Yr(e.langs||[]),e.engine]);return Ho({...e,themes:t,langs:n,engine:r})}const ts=new WeakMap;function Ct(e,t){ts.set(e,t)}function Fe(e){return ts.get(e)}var _t=class ns{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new ns(Object.fromEntries(Go(n).map(r=>[r,rn])),t)}constructor(...t){if(t.length===2){const[n,r]=t;this.lang=r,this._stacks=n}else{const[n,r,s]=t;this.lang=r,this._stacks={[s]:n}}}getInternalStack(t=this.theme){return this._stacks[t]}getScopes(t=this.theme){return Vo(this._stacks[t])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function Vo(e){const t=[],n=new Set;function r(s){if(n.has(s))return;n.add(s);const o=s?.nameScopesList?.scopeName;o&&t.push(o),s.parent&&r(s.parent)}return r(e),t}function Xo(e,t){if(!(e instanceof _t))throw new P("Invalid grammar state");return e.getInternalStack(t)}const Ko=/,/,Zo=/ /;function rs(e,t,n={}){const{theme:r=e.getLoadedThemes()[0]}=n;if(yt(e.resolveLangAlias(n.lang||"text"))||bt(r))return wt(t).map(l=>[{content:l[0],offset:l[1]}]);const{theme:s,colorMap:o}=e.setTheme(r),i=e.getLanguage(n.lang||"text");if(n.grammarState){if(n.grammarState.lang!==i.name)throw new P(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${i.name}"`);if(!n.grammarState.themes.includes(s.name))throw new P(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${s.name}"`)}return Yo(t,i,s,o,n)}function Qo(...e){if(e.length===2)return Fe(e[1]);const[t,n,r={}]=e,{lang:s="text",theme:o=t.getLoadedThemes()[0]}=r;if(yt(s)||bt(o))throw new P("Plain language does not have grammar state");if(s==="ansi")throw new P("ANSI language does not have grammar state");const{theme:i,colorMap:l}=t.setTheme(o),a=t.getLanguage(s);return new _t(Sn(n,a,i,l,r).stateStack,a.name,i.name)}function Yo(e,t,n,r,s){const o=Sn(e,t,n,r,s),i=new _t(o.stateStack,t.name,n.name);return Ct(o.tokens,i),o.tokens}function Sn(e,t,n,r,s){const o=ut(n,s),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:l=500,includeExplanation:a=!1}=s,c=wt(e);let u=s.grammarState?Xo(s.grammarState,n.name)??rn:s.grammarContextCode!=null?Sn(s.grammarContextCode,t,n,r,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:rn,f=[];const h=[];for(let d=0,p=c.length;d<p;d++){const[b,w]=c[d];if(b===""){f=[],h.push([]);continue}if(i>0&&b.length>=i){f=[],h.push([{content:b,offset:w,color:"",fontStyle:0}]);continue}let g,m,y;a&&a!=="tokenType"&&(g=t.tokenizeLine(b,u,l),m=g.tokens,y=0);const _=t.tokenizeLine2(b,u,l),S=_.tokens.length/2;for(let k=0;k<S;k++){const v=_.tokens[2*k],A=k+1<S?_.tokens[2*k+2]:b.length;if(v===A)continue;const R=_.tokens[2*k+1],H=fe(r[ye.getForeground(R)],o),Le=ye.getFontStyle(R),E={content:b.substring(v,A),offset:w+v,color:H,fontStyle:Le};if(a==="tokenType")E.type=ye.getTokenType(R);else if(a){const q=[];if(a!=="scopeName")for(const T of n.settings){let L;switch(typeof T.scope){case"string":L=T.scope.split(Ko).map(V=>V.trim());break;case"object":L=T.scope;break;default:continue}q.push({settings:T,selectors:L.map(V=>V.split(Zo))})}E.explanation=[];let $=0;for(;v+$<A;){const T=m[y],L=b.substring(T.startIndex,T.endIndex);$+=L.length,E.explanation.push({content:L,scopes:a==="scopeName"?Jo(T.scopes):ei(q,T.scopes)}),y+=1}}f.push(E)}h.push(f),f=[],u=_.ruleStack}return{tokens:h,stateStack:u}}function Jo(e){return e.map(t=>({scopeName:t}))}function ei(e,t){const n=[];for(let r=0,s=t.length;r<s;r++){const o=t[r];n[r]={scopeName:o,themeMatches:ni(e,o,t.slice(0,r))}}return n}function Hn(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]==="."}function ti(e,t,n){if(!Hn(e.at(-1),t))return!1;let r=e.length-2,s=n.length-1;for(;r>=0&&s>=0;)Hn(e[r],n[s])&&(r-=1),s-=1;return r===-1}function ni(e,t,n){const r=[];for(const{selectors:s,settings:o}of e)for(const i of s)if(ti(i,t,n)){r.push(o);break}return r}function ss(e,t,n,r=rs){const s=Object.entries(n.themes).filter(c=>c[1]).map(c=>({color:c[0],theme:c[1]})),o=s.map(c=>{const u=r(e,t,{...n,theme:c.theme});return{tokens:u,state:Fe(u),theme:typeof c.theme=="string"?c.theme:c.theme.name}}),i=ri(...o.map(c=>c.tokens)),l=i[0].map((c,u)=>c.map((f,h)=>{const d={content:f.content,variants:{},offset:f.offset};return"includeExplanation"in n&&n.includeExplanation&&(d.explanation=f.explanation),i.forEach((p,b)=>{const{content:w,explanation:g,offset:m,...y}=p[u][h];d.variants[s[b].color]=y}),d})),a=o[0].state?new _t(Object.fromEntries(o.map(c=>[c.theme,c.state?.getInternalStack(c.theme)])),o[0].state.lang):void 0;return a&&Ct(l,a),l}function ri(...e){const t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){const s=e.map(a=>a[r]),o=t.map(()=>[]);t.forEach((a,c)=>a.push(o[c]));const i=s.map(()=>0),l=s.map(a=>a[0]);for(;l.every(a=>a);){const a=Math.min(...l.map(c=>c.content.length));for(let c=0;c<n;c++){const u=l[c];u.content.length===a?(o[c].push(u),i[c]+=1,l[c]=s[c][i[c]]):(o[c].push({...u,content:u.content.slice(0,a)}),l[c]={...u,content:u.content.slice(a),offset:u.offset+a})}}}return t}const si=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];class We{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}}We.prototype.normal={};We.prototype.property={};We.prototype.space=void 0;function os(e,t){const n={},r={};for(const s of e)Object.assign(n,s.property),Object.assign(r,s.normal);return new We(n,r,t)}function sn(e){return e.toLowerCase()}class X{constructor(t,n){this.attribute=n,this.property=t}}X.prototype.attribute="";X.prototype.booleanish=!1;X.prototype.boolean=!1;X.prototype.commaOrSpaceSeparated=!1;X.prototype.commaSeparated=!1;X.prototype.defined=!1;X.prototype.mustUseProperty=!1;X.prototype.number=!1;X.prototype.overloadedBoolean=!1;X.prototype.property="";X.prototype.spaceSeparated=!1;X.prototype.space=void 0;let oi=0;const x=_e(),O=_e(),on=_e(),C=_e(),N=_e(),be=_e(),K=_e();function _e(){return 2**++oi}var an=Object.freeze({__proto__:null,boolean:x,booleanish:O,commaOrSpaceSeparated:K,commaSeparated:be,number:C,overloadedBoolean:on,spaceSeparated:N});const Pt=Object.keys(an);class kn extends X{constructor(t,n,r,s){let o=-1;if(super(t,n),qn(this,"space",s),typeof r=="number")for(;++o<Pt.length;){const i=Pt[o];qn(this,Pt[o],(r&an[i])===an[i])}}}kn.prototype.defined=!0;function qn(e,t,n){n&&(e[t]=n)}function Ie(e){const t={},n={};for(const[r,s]of Object.entries(e.properties)){const o=new kn(r,e.transform(e.attributes||{},r),s,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(o.mustUseProperty=!0),t[r]=o,n[sn(r)]=r,n[sn(o.attribute)]=r}return new We(t,n,e.space)}const is=Ie({properties:{ariaActiveDescendant:null,ariaAtomic:O,ariaAutoComplete:null,ariaBusy:O,ariaChecked:O,ariaColCount:C,ariaColIndex:C,ariaColSpan:C,ariaControls:N,ariaCurrent:null,ariaDescribedBy:N,ariaDetails:null,ariaDisabled:O,ariaDropEffect:N,ariaErrorMessage:null,ariaExpanded:O,ariaFlowTo:N,ariaGrabbed:O,ariaHasPopup:null,ariaHidden:O,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:N,ariaLevel:C,ariaLive:null,ariaModal:O,ariaMultiLine:O,ariaMultiSelectable:O,ariaOrientation:null,ariaOwns:N,ariaPlaceholder:null,ariaPosInSet:C,ariaPressed:O,ariaReadOnly:O,ariaRelevant:null,ariaRequired:O,ariaRoleDescription:N,ariaRowCount:C,ariaRowIndex:C,ariaRowSpan:C,ariaSelected:O,ariaSetSize:C,ariaSort:null,ariaValueMax:C,ariaValueMin:C,ariaValueNow:C,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function as(e,t){return t in e?e[t]:t}function ls(e,t){return as(e,t.toLowerCase())}const ii=Ie({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:be,acceptCharset:N,accessKey:N,action:null,allow:null,allowFullScreen:x,allowPaymentRequest:x,allowUserMedia:x,alpha:x,alt:null,as:null,async:x,autoCapitalize:null,autoComplete:N,autoFocus:x,autoPlay:x,blocking:N,capture:null,charSet:null,checked:x,cite:null,className:N,closedBy:null,colorSpace:null,cols:C,colSpan:C,command:null,commandFor:null,content:null,contentEditable:O,controls:x,controlsList:N,coords:C|be,crossOrigin:null,data:null,dateTime:null,decoding:null,default:x,defer:x,dir:null,dirName:null,disabled:x,download:on,draggable:O,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:x,formTarget:null,headers:N,height:C,hidden:on,high:C,href:null,hrefLang:null,htmlFor:N,httpEquiv:N,id:null,imageSizes:null,imageSrcSet:null,inert:x,inputMode:null,integrity:null,is:null,isMap:x,itemId:null,itemProp:N,itemRef:N,itemScope:x,itemType:N,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:x,low:C,manifest:null,max:null,maxLength:C,media:null,method:null,min:null,minLength:C,multiple:x,muted:x,name:null,nonce:null,noModule:x,noValidate:x,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:x,optimum:C,pattern:null,ping:N,placeholder:null,playsInline:x,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:x,referrerPolicy:null,rel:N,required:x,reversed:x,rows:C,rowSpan:C,sandbox:N,scope:null,scoped:x,seamless:x,selected:x,shadowRootClonable:x,shadowRootCustomElementRegistry:x,shadowRootDelegatesFocus:x,shadowRootMode:null,shadowRootSerializable:x,shape:null,size:C,sizes:null,slot:null,span:C,spellCheck:O,src:null,srcDoc:null,srcLang:null,srcSet:null,start:C,step:null,style:null,tabIndex:C,target:null,title:null,translate:null,type:null,typeMustMatch:x,useMap:null,value:O,width:C,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:N,axis:null,background:null,bgColor:null,border:C,borderColor:null,bottomMargin:C,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:x,declare:x,event:null,face:null,frame:null,frameBorder:null,hSpace:C,leftMargin:C,link:null,longDesc:null,lowSrc:null,marginHeight:C,marginWidth:C,noResize:x,noHref:x,noShade:x,noWrap:x,object:null,profile:null,prompt:null,rev:null,rightMargin:C,rules:null,scheme:null,scrolling:O,standby:null,summary:null,text:null,topMargin:C,valueType:null,version:null,vAlign:null,vLink:null,vSpace:C,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:x,disablePictureInPicture:x,disableRemotePlayback:x,exportParts:be,part:N,prefix:null,property:null,results:C,security:null,unselectable:null},space:"html",transform:ls}),ai=Ie({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",dominantBaseline:"dominant-baseline",enableBackground:"enable-background",fillOpacity:"fill-opacity",fillRule:"fill-rule",floodColor:"flood-color",floodOpacity:"flood-opacity",fontFamily:"font-family",fontSize:"font-size",fontSizeAdjust:"font-size-adjust",fontStretch:"font-stretch",fontStyle:"font-style",fontVariant:"font-variant",fontWeight:"font-weight",glyphName:"glyph-name",glyphOrientationHorizontal:"glyph-orientation-horizontal",glyphOrientationVertical:"glyph-orientation-vertical",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",maskType:"mask-type",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",renderingIntent:"rendering-intent",shapeRendering:"shape-rendering",stopColor:"stop-color",stopOpacity:"stop-opacity",strikethroughPosition:"strikethrough-position",strikethroughThickness:"strikethrough-thickness",strokeDashArray:"stroke-dasharray",strokeDashOffset:"stroke-dashoffset",strokeLineCap:"stroke-linecap",strokeLineJoin:"stroke-linejoin",strokeMiterLimit:"stroke-miterlimit",strokeOpacity:"stroke-opacity",strokeWidth:"stroke-width",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",underlinePosition:"underline-position",underlineThickness:"underline-thickness",unicodeBidi:"unicode-bidi",unicodeRange:"unicode-range",unitsPerEm:"units-per-em",vAlphabetic:"v-alphabetic",vHanging:"v-hanging",vIdeographic:"v-ideographic",vMathematical:"v-mathematical",vectorEffect:"vector-effect",vertAdvY:"vert-adv-y",vertOriginX:"vert-origin-x",vertOriginY:"vert-origin-y",wordSpacing:"word-spacing",writingMode:"writing-mode",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:K,accentHeight:C,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:C,amplitude:C,arabicForm:null,ascent:C,attributeName:null,attributeType:null,azimuth:C,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:C,by:null,calcMode:null,capHeight:C,className:N,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:C,diffuseConstant:C,direction:null,display:null,dur:null,divisor:C,dominantBaseline:null,download:x,dx:null,dy:null,edgeMode:null,editable:null,elevation:C,enableBackground:null,end:null,event:null,exponent:C,externalResourcesRequired:null,fill:null,fillOpacity:C,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:be,g2:be,glyphName:be,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:C,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:C,horizOriginX:C,horizOriginY:C,id:null,ideographic:C,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:C,k:C,k1:C,k2:C,k3:C,k4:C,kernelMatrix:K,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:C,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:C,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:C,overlineThickness:C,paintOrder:null,panose1:null,path:null,pathLength:C,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:N,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:C,pointsAtY:C,pointsAtZ:C,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:K,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:K,rev:K,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:K,requiredFeatures:K,requiredFonts:K,requiredFormats:K,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:C,specularExponent:C,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:C,strikethroughThickness:C,string:null,stroke:null,strokeDashArray:K,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:C,strokeOpacity:C,strokeWidth:null,style:null,surfaceScale:C,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:K,tabIndex:C,tableValues:null,target:null,targetX:C,targetY:C,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:K,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:C,underlineThickness:C,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:C,values:null,vAlphabetic:C,vMathematical:C,vectorEffect:null,vHanging:C,vIdeographic:C,version:null,vertAdvY:C,vertOriginX:C,vertOriginY:C,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:C,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:as}),cs=Ie({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}}),us=Ie({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:ls}),fs=Ie({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}}),li=/[A-Z]/g,Vn=/-[a-z]/g,ci=/^data[-\w.:]+$/i;function ui(e,t){const n=sn(t);let r=t,s=X;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&ci.test(t)){if(t.charAt(4)==="-"){const o=t.slice(5).replace(Vn,hi);r="data"+o.charAt(0).toUpperCase()+o.slice(1)}else{const o=t.slice(4);if(!Vn.test(o)){let i=o.replace(li,fi);i.charAt(0)!=="-"&&(i="-"+i),t="data"+i}}s=kn}return new s(r,t)}function fi(e){return"-"+e.toLowerCase()}function hi(e){return e.charAt(1).toUpperCase()}const di=os([is,ii,cs,us,fs],"html"),hs=os([is,ai,cs,us,fs],"svg"),Xn={}.hasOwnProperty;function pi(e,t){const n=t||{};function r(s,...o){let i=r.invalid;const l=r.handlers;if(s&&Xn.call(s,e)){const a=String(s[e]);i=Xn.call(l,a)?l[a]:r.unknown}if(i)return i.call(this,s,...o)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}const gi=/["&'<>`]/g,mi=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,yi=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,bi=/[|\\{}()[\]^$+*?.]/g,Kn=new WeakMap;function wi(e,t){if(e=e.replace(t.subset?Ci(t.subset):gi,r),t.subset||t.escapeOnly)return e;return e.replace(mi,n).replace(yi,r);function n(s,o,i){return t.format((s.charCodeAt(0)-55296)*1024+s.charCodeAt(1)-56320+65536,i.charCodeAt(o+2),t)}function r(s,o,i){return t.format(s.charCodeAt(0),i.charCodeAt(o+1),t)}}function Ci(e){let t=Kn.get(e);return t||(t=_i(e),Kn.set(e,t)),t}function _i(e){const t=[];let n=-1;for(;++n<e.length;)t.push(e[n].replace(bi,"\\$&"));return new RegExp("(?:"+t.join("|")+")","g")}const Si=/[\dA-Fa-f]/;function ki(e,t,n){const r="&#x"+e.toString(16).toUpperCase();return n&&t&&!Si.test(String.fromCharCode(t))?r:r+";"}const vi=/\d/;function xi(e,t,n){const r="&#"+String(e);return n&&t&&!vi.test(String.fromCharCode(t))?r:r+";"}const Ei=["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"],$t={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:"€"},Ii=["cent","copy","divide","gt","lt","not","para","times"],ds={}.hasOwnProperty,ln={};let qe;for(qe in $t)ds.call($t,qe)&&(ln[$t[qe]]=qe);const Ai=/[^\dA-Za-z]/;function Ri(e,t,n,r){const s=String.fromCharCode(e);if(ds.call(ln,s)){const o=ln[s],i="&"+o;return n&&Ei.includes(o)&&!Ii.includes(o)&&(!r||t&&t!==61&&Ai.test(String.fromCharCode(t)))?i:i+";"}return""}function Li(e,t,n){let r=ki(e,t,n.omitOptionalSemicolons),s;if((n.useNamedReferences||n.useShortestReferences)&&(s=Ri(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!s)&&n.useShortestReferences){const o=xi(e,t,n.omitOptionalSemicolons);o.length<r.length&&(r=o)}return s&&(!n.useShortestReferences||s.length<r.length)?s:r}function Ee(e,t){return wi(e,Object.assign({format:Li},t))}const Ni=/^>|^->|<!--|-->|--!>|<!-$/g,Ti=[">"],Pi=["<",">"];function $i(e,t,n,r){return r.settings.bogusComments?"<?"+Ee(e.value,Object.assign({},r.settings.characterReferences,{subset:Ti}))+">":"<!--"+e.value.replace(Ni,s)+"-->";function s(o){return Ee(o,Object.assign({},r.settings.characterReferences,{subset:Pi}))}}function Mi(e,t,n,r){return"<!"+(r.settings.upperDoctype?"DOCTYPE":"doctype")+(r.settings.tightDoctype?"":" ")+"html>"}function Zn(e,t){const n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,s=n.indexOf(t);for(;s!==-1;)r++,s=n.indexOf(t,s+t.length);return r}function Oi(e,t){const n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function Bi(e){return e.join(" ").trim()}const Di=/[ \t\n\f\r]/g;function vn(e){return typeof e=="object"?e.type==="text"?Qn(e.value):!1:Qn(e)}function Qn(e){return e.replace(Di,"")===""}const F=gs(1),ps=gs(-1),Gi=[];function gs(e){return t;function t(n,r,s){const o=n?n.children:Gi;let i=(r||0)+e,l=o[i];if(!s)for(;l&&vn(l);)i+=e,l=o[i];return l}}const Fi={}.hasOwnProperty;function ms(e){return t;function t(n,r,s){return Fi.call(e,n.tagName)&&e[n.tagName](n,r,s)}}const xn=ms({body:ji,caption:Mt,colgroup:Mt,dd:qi,dt:Hi,head:Mt,html:Ui,li:zi,optgroup:Vi,option:Xi,p:Wi,rp:Yn,rt:Yn,tbody:Zi,td:Jn,tfoot:Qi,th:Jn,thead:Ki,tr:Yi});function Mt(e,t,n){const r=F(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&vn(r.value.charAt(0)))}function Ui(e,t,n){const r=F(n,t);return!r||r.type!=="comment"}function ji(e,t,n){const r=F(n,t);return!r||r.type!=="comment"}function Wi(e,t,n){const r=F(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function zi(e,t,n){const r=F(n,t);return!r||r.type==="element"&&r.tagName==="li"}function Hi(e,t,n){const r=F(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function qi(e,t,n){const r=F(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function Yn(e,t,n){const r=F(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function Vi(e,t,n){const r=F(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function Xi(e,t,n){const r=F(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function Ki(e,t,n){const r=F(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function Zi(e,t,n){const r=F(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Qi(e,t,n){return!F(n,t)}function Yi(e,t,n){const r=F(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function Jn(e,t,n){const r=F(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}const Ji=ms({body:na,colgroup:ra,head:ta,html:ea,tbody:sa});function ea(e){const t=F(e,-1);return!t||t.type!=="comment"}function ta(e){const t=new Set;for(const r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}const n=e.children[0];return!n||n.type==="element"}function na(e){const t=F(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&vn(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function ra(e,t,n){const r=ps(n,t),s=F(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&xn(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="col")}function sa(e,t,n){const r=ps(n,t),s=F(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&xn(r,n.children.indexOf(r),n)?!1:!!(s&&s.type==="element"&&s.tagName==="tr")}const Ve={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 oa(e,t,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(e.tagName.toLowerCase());const l=[];let a;s.space==="html"&&e.tagName==="svg"&&(r.schema=hs);const c=ia(r,e.properties),u=r.all(s.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=s,u&&(i=!1),(c||!o||!Ji(e,t,n))&&(l.push("<",e.tagName,c?" "+c:""),i&&(s.space==="svg"||r.settings.closeSelfClosing)&&(a=c.charAt(c.length-1),(!r.settings.tightSelfClosing||a==="/"||a&&a!=='"'&&a!=="'")&&l.push(" "),l.push("/")),l.push(">")),l.push(u),!i&&(!o||!xn(e,t,n))&&l.push("</"+e.tagName+">"),l.join("")}function ia(e,t){const n=[];let r=-1,s;if(t){for(s in t)if(t[s]!==null&&t[s]!==void 0){const o=aa(e,s,t[s]);o&&n.push(o)}}for(;++r<n.length;){const o=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&o!=='"'&&o!=="'"&&(n[r]+=" ")}return n.join("")}function aa(e,t,n){const r=ui(e.schema,t),s=e.settings.allowParseErrors&&e.schema.space==="html"?0:1,o=e.settings.allowDangerousCharacters?0:1;let i=e.quote,l;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 a=Ee(r.attribute,Object.assign({},e.settings.characterReferences,{subset:Ve.name[s][o]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?Oi:Bi)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?a:(e.settings.preferUnquoted&&(l=Ee(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:Ve.unquoted[s][o]}))),l!==n&&(e.settings.quoteSmart&&Zn(n,i)>Zn(n,e.alternative)&&(i=e.alternative),l=i+Ee(n,Object.assign({},e.settings.characterReferences,{subset:(i==="'"?Ve.single:Ve.double)[s][o],attribute:!0}))+i),a+(l&&"="+l))}const la=["<","&"];function ys(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:Ee(e.value,Object.assign({},r.settings.characterReferences,{subset:la}))}function ca(e,t,n,r){return r.settings.allowDangerousHtml?e.value:ys(e,t,n,r)}function ua(e,t,n,r){return r.all(e)}const fa=pi("type",{invalid:ha,unknown:da,handlers:{comment:$i,doctype:Mi,element:oa,raw:ca,root:ua,text:ys}});function ha(e){throw new Error("Expected node, not `"+e+"`")}function da(e){const t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}const pa={},ga={},ma=[];function ya(e,t){const n=t||pa,r=n.quote||'"',s=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:ba,all:wa,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||si,characterReferences:n.characterReferences||ga,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?hs:di,quote:r,alternative:s}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function ba(e,t,n){return fa(e,t,n,this)}function wa(e){const t=[],n=e&&e.children||ma;let r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join("")}const er=/\s+/g;function bs(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class=="string"&&(e.properties.class=e.properties.class.split(er)),Array.isArray(e.properties.class)||(e.properties.class=[]);const n=Array.isArray(t)?t:t.split(er);for(const r of n)r&&!e.properties.class.includes(r)&&e.properties.class.push(r);return e}function Ca(e){const t=wt(e,!0).map(([s])=>s);function n(s){if(s===e.length)return{line:t.length-1,character:t.at(-1).length};let o=s,i=0;for(const l of t){if(o<l.length)break;o-=l.length,i++}return{line:i,character:o}}function r(s,o){let i=0;for(let l=0;l<s;l++)i+=t[l].length;return i+=o,i}return{lines:t,indexToPos:n,posToIndex:r}}const _a=["color","background-color"];function Sa(e,t){let n=0;const r=[];for(const s of t)s>n&&r.push({...e,content:e.content.slice(n,s),offset:e.offset+n}),n=s;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function ka(e,t){const n=[...t instanceof Set?t:new Set(t)].sort((r,s)=>r-s);return n.length?e.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,l)=>i-l);return o.length?Sa(s,o):s})):e}function va(e,t,n,r,s="css-vars"){const o={content:e.content,explanation:e.explanation,offset:e.offset},i=t.map(u=>ft(e.variants[u])),l=new Set(i.flatMap(u=>Object.keys(u))),a={},c=(u,f)=>{const h=f==="color"?"":f==="background-color"?"-bg":`-${f}`;return n+t[u]+(f==="color"?"":h)};return i.forEach((u,f)=>{for(const h of l){const d=u[h]||"inherit";if(f===0&&r&&_a.includes(h))if(r==="light-dark()"&&i.length>1){const p=t.findIndex(w=>w==="light"),b=t.findIndex(w=>w==="dark");if(p===-1||b===-1)throw new P('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');a[h]=`light-dark(${i[p][h]||"inherit"}, ${i[b][h]||"inherit"})`,s==="css-vars"&&(a[c(f,h)]=d)}else a[h]=d;else s==="css-vars"&&(a[c(f,h)]=d)}}),o.htmlStyle=a,o}function ft(e){const t={};if(e.color&&(t.color=e.color),e.bgColor&&(t["background-color"]=e.bgColor),e.fontStyle){e.fontStyle&z.Italic&&(t["font-style"]="italic"),e.fontStyle&z.Bold&&(t["font-weight"]="bold");const n=[];e.fontStyle&z.Underline&&n.push("underline"),e.fontStyle&z.Strikethrough&&n.push("line-through"),n.length&&(t["text-decoration"]=n.join(" "))}return t}function cn(e){return typeof e=="string"?e:Object.entries(e).map(([t,n])=>`${t}:${n}`).join(";")}function xa(){const e=new WeakMap;function t(n){if(!e.has(n.meta)){let o=function(l){if(typeof l=="number"){if(l<0||l>n.source.length)throw new P(`Invalid decoration offset: ${l}. Code length: ${n.source.length}`);return{...s.indexToPos(l),offset:l}}else{const a=s.lines[l.line];if(a===void 0)throw new P(`Invalid decoration position ${JSON.stringify(l)}. Lines length: ${s.lines.length}`);let c=l.character;if(c<0&&(c=a.length+c),c<0||c>a.length)throw new P(`Invalid decoration position ${JSON.stringify(l)}. Line ${l.line} length: ${a.length}`);return{...l,character:c,offset:s.posToIndex(l.line,c)}}};var r=o;const s=Ca(n.source),i=(n.options.decorations||[]).map(l=>({...l,start:o(l.start),end:o(l.end)}));Ea(i),e.set(n.meta,{decorations:i,converter:s,source:n.source})}return e.get(n.meta)}return{name:"shiki:decorations",tokens(n){if(this.options.decorations?.length)return ka(n,t(this).decorations.flatMap(r=>[r.start.offset,r.end.offset]))},code(n){if(!this.options.decorations?.length)return;const r=t(this),s=[...n.children].filter(u=>u.type==="element"&&u.tagName==="span");if(s.length!==r.converter.lines.length)throw new P(`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,h,d){const p=s[u];let b="",w=-1,g=-1;if(f===0&&(w=0),h===0&&(g=0),h===Number.POSITIVE_INFINITY&&(g=p.children.length),w===-1||g===-1)for(let y=0;y<p.children.length;y++)b+=ws(p.children[y]),w===-1&&b.length===f&&(w=y+1),g===-1&&b.length===h&&(g=y+1);if(w===-1)throw new P(`Failed to find start index for decoration ${JSON.stringify(d.start)}`);if(g===-1)throw new P(`Failed to find end index for decoration ${JSON.stringify(d.end)}`);const m=p.children.slice(w,g);if(!d.alwaysWrap&&m.length===p.children.length)l(p,d,"line");else if(!d.alwaysWrap&&m.length===1&&m[0].type==="element")l(m[0],d,"token");else{const y={type:"element",tagName:"span",properties:{},children:m};l(y,d,"wrapper"),p.children.splice(w,m.length,y)}}function i(u,f){s[u]=l(s[u],f,"line")}function l(u,f,h){const d=f.properties||{},p=f.transform||(b=>b);return u.tagName=f.tagName||"span",u.properties={...u.properties,...d,class:u.properties.class},f.properties?.class&&bs(u,f.properties.class),u=p(u,h)||u,u}const a=[],c=r.decorations.sort((u,f)=>f.start.offset-u.start.offset||u.end.offset-f.end.offset);for(const u of c){const{start:f,end:h}=u;if(f.line===h.line)o(f.line,f.character,h.character,u);else if(f.line<h.line){o(f.line,f.character,Number.POSITIVE_INFINITY,u);for(let d=f.line+1;d<h.line;d++)a.unshift(()=>i(d,u));o(h.line,0,h.character,u)}}a.forEach(u=>u())}}}function Ea(e){for(let t=0;t<e.length;t++){const n=e[t];if(n.start.offset>n.end.offset)throw new P(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){const s=e[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,l=s.start.offset<=n.start.offset&&n.start.offset<s.end.offset,a=s.start.offset<n.end.offset&&n.end.offset<=s.end.offset;if(o||i||l||a){if(o&&i||l&&a||l&&n.start.offset===n.end.offset||i&&s.start.offset===s.end.offset)continue;throw new P(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function ws(e){return e.type==="text"?e.value:e.type==="element"?e.children.map(ws).join(""):""}const Ia=[xa()];function ht(e){const t=Aa(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...Ia]}function Aa(e){const t=[],n=[],r=[];for(const s of e)switch(s.enforce){case"pre":t.push(s);break;case"post":n.push(s);break;default:r.push(s)}return{pre:t,post:n,normal:r}}var ge=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],Ot={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",8:"hidden",9:"strikethrough"};function Ra(e,t){const n=e.indexOf("\x1B",t);if(n!==-1&&e[n+1]==="["){const r=e.indexOf("m",n);if(r!==-1)return{sequence:e.substring(n+2,r).split(";"),startPosition:n,position:r+1}}return{position:e.length}}function tr(e){const t=e.shift();if(t==="2"){const n=e.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(t==="5"){const n=e.shift();if(n)return{type:"table",index:Number(n)}}}function La(e){const t=[];for(;e.length>0;){const n=e.shift();if(!n)continue;const r=Number.parseInt(n);if(!Number.isNaN(r))if(r===0)t.push({type:"resetAll"});else if(r<=9)Ot[r]&&t.push({type:"setDecoration",value:Ot[r]});else if(r<=29){const s=Ot[r-20];s&&(t.push({type:"resetDecoration",value:s}),s==="dim"&&t.push({type:"resetDecoration",value:"bold"}))}else if(r<=37)t.push({type:"setForegroundColor",value:{type:"named",name:ge[r-30]}});else if(r===38){const s=tr(e);s&&t.push({type:"setForegroundColor",value:s})}else if(r===39)t.push({type:"resetForegroundColor"});else if(r<=47)t.push({type:"setBackgroundColor",value:{type:"named",name:ge[r-40]}});else if(r===48){const s=tr(e);s&&t.push({type:"setBackgroundColor",value:s})}else r===49?t.push({type:"resetBackgroundColor"}):r===53?t.push({type:"setDecoration",value:"overline"}):r===55?t.push({type:"resetDecoration",value:"overline"}):r>=90&&r<=97?t.push({type:"setForegroundColor",value:{type:"named",name:ge[r-90+8]}}):r>=100&&r<=107&&t.push({type:"setBackgroundColor",value:{type:"named",name:ge[r-100+8]}})}return t}function Na(){let e=null,t=null,n=new Set;return{parse(r){const s=[];let o=0;do{const i=Ra(r,o),l=i.sequence?r.substring(o,i.startPosition):r.substring(o);if(l.length>0&&s.push({value:l,foreground:e,background:t,decorations:new Set(n)}),i.sequence){const a=La(i.sequence);for(const c of a)c.type==="resetAll"?(e=null,t=null,n.clear()):c.type==="resetForegroundColor"?e=null:c.type==="resetBackgroundColor"?t=null:c.type==="resetDecoration"&&n.delete(c.value);for(const c of a)c.type==="setForegroundColor"?e=c.value:c.type==="setBackgroundColor"?t=c.value:c.type==="setDecoration"&&n.add(c.value)}o=i.position}while(o<r.length);return s}}}var Ta={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 Pa(e=Ta){function t(l){return e[l]}function n(l){return`#${l.map(a=>Math.max(0,Math.min(a,255)).toString(16).padStart(2,"0")).join("")}`}let r;function s(){if(r)return r;r=[];for(let c=0;c<ge.length;c++)r.push(t(ge[c]));let l=[0,95,135,175,215,255];for(let c=0;c<6;c++)for(let u=0;u<6;u++)for(let f=0;f<6;f++)r.push(n([l[c],l[u],l[f]]));let a=8;for(let c=0;c<24;c++,a+=10)r.push(n([a,a,a]));return r}function o(l){return s()[l]}function i(l){switch(l.type){case"named":return t(l.name);case"rgb":return n(l.rgb);case"table":return o(l.index)}}return{value:i}}const $a=/#([0-9a-f]{3,8})/i,Ma=/var\((--[\w-]+-ansi-[\w-]+)\)/,Oa={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 Ba(e,t,n){const r=ut(e,n),s=wt(t),o=Pa(Object.fromEntries(ge.map(l=>{const a=`terminal.ansi${l[0].toUpperCase()}${l.substring(1)}`;return[l,e.colors?.[a]||Oa[l]]}))),i=Na();return s.map(l=>i.parse(l[0]).map(a=>{let c,u;a.decorations.has("reverse")?(c=a.background?o.value(a.background):e.bg,u=a.foreground?o.value(a.foreground):e.fg):(c=a.foreground?o.value(a.foreground):e.fg,u=a.background?o.value(a.background):void 0),c=fe(c,r),u=fe(u,r),a.decorations.has("dim")&&(c=Da(c));let f=z.None;return a.decorations.has("bold")&&(f|=z.Bold),a.decorations.has("italic")&&(f|=z.Italic),a.decorations.has("underline")&&(f|=z.Underline),a.decorations.has("strikethrough")&&(f|=z.Strikethrough),{content:a.value,offset:l[1],color:c,bgColor:u,fontStyle:f}}))}function Da(e){const t=e.match($a);if(t){const r=t[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],l=r[3];return`#${s}${s}${o}${o}${i}${i}${Math.round(Number.parseInt(`${l}${l}`,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=e.match(Ma);return n?`var(${n[1]}-dim)`:e}function un(e,t,n={}){const r=e.resolveLangAlias(n.lang||"text"),{theme:s=e.getLoadedThemes()[0]}=n;if(!yt(r)&&!bt(s)&&r==="ansi"){const{theme:o}=e.setTheme(s);return Ba(o,t,n)}return rs(e,t,n)}function dt(e,t,n){let r,s,o,i,l,a;if("themes"in n){const{defaultColor:c="light",cssVariablePrefix:u="--shiki-",colorsRendering:f="css-vars"}=n,h=Object.entries(n.themes).filter(g=>g[1]).map(g=>({color:g[0],theme:g[1]})).sort((g,m)=>g.color===c?-1:m.color===c?1:0);if(h.length===0)throw new P("`themes` option must not be empty");const d=ss(e,t,n,un);if(a=Fe(d),c&&c!=="light-dark()"&&!h.some(g=>g.color===c))throw new P(`\`themes\` option must contain the defaultColor key \`${c}\``);const p=h.map(g=>e.getTheme(g.theme)),b=h.map(g=>g.color);o=d.map(g=>g.map(m=>va(m,b,u,c,f))),a&&Ct(o,a);const w=h.map(g=>ut(g.theme,n));s=nr(h,p,w,u,c,"fg",f),r=nr(h,p,w,u,c,"bg",f),i=`shiki-themes ${p.map(g=>g.name).join(" ")}`,l=c?void 0:[s,r].join(";")}else if("theme"in n){const c=ut(n.theme,n);o=un(e,t,n);const u=e.getTheme(n.theme);r=fe(u.bg,c),s=fe(u.fg,c),i=u.name,a=Fe(o)}else throw new P("Invalid options, either `theme` or `themes` must be provided");return{tokens:o,fg:s,bg:r,themeName:i,rootStyle:l,grammarState:a}}function nr(e,t,n,r,s,o,i){return e.map((l,a)=>{const c=fe(t[a][o],n[a])||"inherit",u=`${r+l.color}${o==="bg"?"-bg":""}:${c}`;if(a===0&&s){if(s==="light-dark()"&&e.length>1){const f=e.findIndex(d=>d.color==="light"),h=e.findIndex(d=>d.color==="dark");if(f===-1||h===-1)throw new P('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${fe(t[f][o],n[f])||"inherit"}, ${fe(t[h][o],n[h])||"inherit"});${u}`}return c}return i==="css-vars"?u:null}).filter(l=>!!l).join(";")}const Cs=/^\s+$/,Ga=/^(\s*)(.*?)(\s*)$/;function pt(e,t,n,r={meta:{},options:n,codeToHast:(s,o)=>pt(e,s,o),codeToTokens:(s,o)=>dt(e,s,o)}){let s=t;for(const p of ht(n))s=p.preprocess?.call(r,s,n)||s;let{tokens:o,fg:i,bg:l,themeName:a,rootStyle:c,grammarState:u}=dt(e,s,n);const{mergeWhitespaces:f=!0,mergeSameStyleTokens:h=!1}=n;f===!0?o=Ua(o):f==="never"&&(o=ja(o)),h&&(o=Wa(o));const d={...r,get source(){return s}};for(const p of ht(n))o=p.tokens?.call(d,o)||o;return Fa(o,{...n,fg:i,bg:l,themeName:a,rootStyle:n.rootStyle===!1?!1:n.rootStyle??c},d,u)}function Fa(e,t,n,r=Fe(e)){const s=ht(t),o=[],i={type:"root",children:[]},{structure:l="classic",tabindex:a="0"}=t,c={class:`shiki ${t.themeName||""}`};t.rootStyle!==!1&&(t.rootStyle!=null?c.style=t.rootStyle:c.style=`background-color:${t.bg};color:${t.fg}`),a!==!1&&a!=null&&(c.tabindex=a.toString());for(const[b,w]of Object.entries(t.meta||{}))b.startsWith("_")||(c[b]=w);let u={type:"element",tagName:"pre",properties:c,children:[],data:t.data},f={type:"element",tagName:"code",properties:{},children:o};const h=[],d={...n,structure:l,addClassToHast:bs,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return i},get pre(){return u},get code(){return f},get lines(){return h}};if(e.forEach((b,w)=>{w&&(l==="inline"?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):l==="classic"&&o.push({type:"text",value:`
|
|
12
|
+
`}));let g={type:"element",tagName:"span",properties:{class:"line"},children:[]},m=0;for(const y of b){let _={type:"element",tagName:"span",properties:{...y.htmlAttrs},children:[{type:"text",value:y.content}]};const S=cn(y.htmlStyle||ft(y));S&&(_.properties.style=S);for(const k of s)_=k?.span?.call(d,_,w+1,m,g,y)||_;l==="inline"?i.children.push(_):l==="classic"&&g.children.push(_),m+=y.content.length}if(l==="classic"){for(const y of s)g=y?.line?.call(d,g,w+1)||g;h.push(g),o.push(g)}else l==="inline"&&h.push(g)}),l==="classic"){for(const b of s)f=b?.code?.call(d,f)||f;u.children.push(f);for(const b of s)u=b?.pre?.call(d,u)||u;i.children.push(u)}else if(l==="inline"){const b=[];let w={type:"element",tagName:"span",properties:{class:"line"},children:[]};for(const m of i.children)m.type==="element"&&m.tagName==="br"?(b.push(w),w={type:"element",tagName:"span",properties:{class:"line"},children:[]}):(m.type==="element"||m.type==="text")&&w.children.push(m);b.push(w);let g={type:"element",tagName:"code",properties:{},children:b};for(const m of s)g=m?.code?.call(d,g)||g;i.children=[];for(let m=0;m<g.children.length;m++){m>0&&i.children.push({type:"element",tagName:"br",properties:{},children:[]});const y=g.children[m];y.type==="element"&&i.children.push(...y.children)}}let p=i;for(const b of s)p=b?.root?.call(d,p)||p;return r&&Ct(p,r),p}function Ua(e){return e.map(t=>{const n=[];let r="",s;return t.forEach((o,i)=>{const l=!(o.fontStyle&&(o.fontStyle&z.Underline||o.fontStyle&z.Strikethrough));l&&Cs.test(o.content)&&t[i+1]?(s===void 0&&(s=o.offset),r+=o.content):r?(l?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 ja(e){return e.map(t=>t.flatMap(n=>{if(Cs.test(n.content))return n;const r=n.content.match(Ga);if(!r)return n;const[,s,o,i]=r;if(!s&&!i)return n;const l=[{...n,offset:n.offset+s.length,content:o}];return s&&l.unshift({content:s,offset:n.offset}),i&&l.push({content:i,offset:n.offset+s.length+o.length}),l}))}function Wa(e){return e.map(t=>{const n=[];for(const r of t){if(n.length===0){n.push({...r});continue}const s=n.at(-1),o=cn(s.htmlStyle||ft(s)),i=cn(r.htmlStyle||ft(r)),l=s.fontStyle&&(s.fontStyle&z.Underline||s.fontStyle&z.Strikethrough),a=r.fontStyle&&(r.fontStyle&z.Underline||r.fontStyle&z.Strikethrough);!l&&!a&&o===i?s.content+=r.content:n.push({...r})}return n})}const za=ya;function Ha(e,t,n){const r={meta:{},options:n,codeToHast:(o,i)=>pt(e,o,i),codeToTokens:(o,i)=>dt(e,o,i)};let s=za(pt(e,t,n,r));for(const o of ht(n))s=o.postprocess?.call(r,s,n)||s;return s}async function qa(e){const t=await qo(e);return{getLastGrammarState:(...n)=>Qo(t,...n),codeToTokensBase:(n,r)=>un(t,n,r),codeToTokensWithThemes:(n,r)=>ss(t,n,r),codeToTokens:(n,r)=>dt(t,n,r),codeToHast:(n,r)=>pt(t,n,r),codeToHtml:(n,r)=>Ha(t,n,r),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}const rr=4294967295;var Va=class{patterns;options;regexps;constructor(e,t={}){this.patterns=e,this.options=t;const{forgiving:n=!1,cache:r,regexConstructor:s}=t;if(!s)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(o=>{if(typeof o!="string")return o;const i=r?.get(o);if(i){if(i instanceof RegExp)return i;if(n)return null;throw i}try{const l=s(o);return r?.set(o,l),l}catch(l){if(r?.set(o,l),n)return null;throw l}})}findNextMatchSync(e,t,n){const r=typeof e=="string"?e:e.content,s=[];function o(i,l,a=0){return{index:i,captureIndices:l.indices.map(c=>c==null?{start:rr,end:rr,length:0}:{start:c[0]+a,end:c[1]+a,length:c[1]-c[0]})}}for(let i=0;i<this.regexps.length;i++){const l=this.regexps[i];if(l)try{l.lastIndex=t;const a=l.exec(r);if(!a)continue;if(a.index===t)return o(i,a,0);s.push([i,a,0])}catch(a){if(this.options.forgiving)continue;throw a}}if(s.length){const i=Math.min(...s.map(l=>l[1].index));for(const[l,a,c]of s)if(a.index===i)return o(l,a,c)}return null}};function Ae(e){if([...e].length!==1)throw new Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function Xa(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}const En=new Set(["alnum","alpha","ascii","blank","cntrl","digit","graph","lower","print","punct","space","upper","word","xdigit"]),j=String.raw;function Re(e,t){if(e==null)throw new Error(t??"Value expected");return e}const _s=j`\[\^?`,Ss=`c.? | C(?:-.?)?|${j`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${j`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${j`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${j`o\{[^\}]*\}?`}|${j`\d{1,3}`}`,In=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Xe=new RegExp(j`
|
|
13
|
+
\\ (?:
|
|
14
|
+
${Ss}
|
|
15
|
+
| [gk]<[^>]*>?
|
|
16
|
+
| [gk]'[^']*'?
|
|
17
|
+
| .
|
|
18
|
+
)
|
|
19
|
+
| \( (?:
|
|
20
|
+
\? (?:
|
|
21
|
+
[:=!>({]
|
|
22
|
+
| <[=!]
|
|
23
|
+
| <[^>]*>
|
|
24
|
+
| '[^']*'
|
|
25
|
+
| ~\|?
|
|
26
|
+
| #(?:[^)\\]|\\.?)*
|
|
27
|
+
| [^:)]*[:)]
|
|
28
|
+
)?
|
|
29
|
+
| \*[^\)]*\)?
|
|
30
|
+
)?
|
|
31
|
+
| (?:${In.source})+
|
|
32
|
+
| ${_s}
|
|
33
|
+
| .
|
|
34
|
+
`.replace(/\s+/g,""),"gsu"),Bt=new RegExp(j`
|
|
35
|
+
\\ (?:
|
|
36
|
+
${Ss}
|
|
37
|
+
| .
|
|
38
|
+
)
|
|
39
|
+
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
40
|
+
| ${_s}
|
|
41
|
+
| &&
|
|
42
|
+
| .
|
|
43
|
+
`.replace(/\s+/g,""),"gsu");function Ka(e,t={}){const n={flags:"",...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!="string")throw new Error("String expected as pattern");const r=pl(n.flags),s=[r.extended],o={captureGroup:n.rules.captureGroup,getCurrentModX(){return s.at(-1)},numOpenGroups:0,popModX(){s.pop()},pushModX(f){s.push(f)},replaceCurrentModX(f){s[s.length-1]=f},singleline:n.rules.singleline};let i=[],l;for(Xe.lastIndex=0;l=Xe.exec(e);){const f=Za(o,e,l[0],Xe.lastIndex);f.tokens?i.push(...f.tokens):f.token&&i.push(f.token),f.lastIndex!==void 0&&(Xe.lastIndex=f.lastIndex)}const a=[];let c=0;i.filter(f=>f.type==="GroupOpen").forEach(f=>{f.kind==="capturing"?f.number=++c:f.raw==="("&&a.push(f)}),c||a.forEach((f,h)=>{f.kind="capturing",f.number=h+1});const u=c||a.length;return{tokens:i.map(f=>f.type==="EscapedNumber"?ml(f,u):f).flat(),flags:r}}function Za(e,t,n,r){const[s,o]=n;if(n==="["||n==="[^"){const i=Qa(t,n,r);return{tokens:i.tokens,lastIndex:i.lastIndex}}if(s==="\\"){if("AbBGyYzZ".includes(o))return{token:sr(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:al(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:vs(n)}}if(o==="K")return{token:xs("keep",n)};if(o==="N"||o==="R")return{token:me("newline",n,{negate:o==="N"})};if(o==="O")return{token:me("any",n)};if(o==="X")return{token:me("text_segment",n)};const i=ks(n,{inCharClass:!1});return Array.isArray(i)?{tokens:i}:{token:i}}if(s==="("){if(o==="*")return{token:fl(n)};if(n==="(?{")throw new Error(`Unsupported callout "${n}"`);if(n.startsWith("(?#")){if(t[r]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:ul(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n==="("&&!e.captureGroup||n==="(?:")return{token:ve("group",n)};if(n==="(?>")return{token:ve("atomic",n)};if(n==="(?="||n==="(?!"||n==="(?<="||n==="(?<!")return{token:ve(n[2]==="<"?"lookbehind":"lookahead",n,{negate:n.endsWith("!")})};if(n==="("&&e.captureGroup||n.startsWith("(?<")&&n.endsWith(">")||n.startsWith("(?'")&&n.endsWith("'"))return{token:ve("capturing",n,{...n!=="("&&{name:n.slice(3,-1)}})};if(n.startsWith("(?~")){if(n==="(?~|")throw new Error(`Unsupported absence function kind "${n}"`);return{token:ve("absence_repeater",n)}}throw n==="(?("?new Error(`Unsupported conditional "${n}"`):new Error(`Invalid or unsupported group option "${n}"`)}if(n===")"){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:sl(n)}}if(e.getCurrentModX()){if(n==="#"){const i=t.indexOf(`
|
|
44
|
+
`,r);return{lastIndex:i===-1?t.length:i}}if(/^\s$/.test(n)){const i=/\s+/y;return i.lastIndex=r,{lastIndex:i.exec(t)?i.lastIndex:r}}}if(n===".")return{token:me("dot",n)};if(n==="^"||n==="$"){const i=e.singleline?{"^":j`\A`,$:j`\Z`}[n]:n;return{token:sr(i,n)}}return n==="|"?{token:Ja(n)}:In.test(n)?{tokens:yl(n)}:{token:ae(Ae(n),n)}}function Qa(e,t,n){const r=[or(t[1]==="^",t)];let s=1,o;for(Bt.lastIndex=n;o=Bt.exec(e);){const i=o[0];if(i[0]==="["&&i[1]!==":")s++,r.push(or(i[1]==="^",i));else if(i==="]"){if(r.at(-1).type==="CharacterClassOpen")r.push(ae(93,i));else if(s--,r.push(el(i)),!s)break}else{const l=Ya(i);Array.isArray(l)?r.push(...l):r.push(l)}}return{tokens:r,lastIndex:Bt.lastIndex||e.length}}function Ya(e){if(e[0]==="\\")return ks(e,{inCharClass:!0});if(e[0]==="["){const t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!En.has(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return me("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return e==="-"?tl(e):e==="&&"?nl(e):ae(Ae(e),e)}function ks(e,{inCharClass:t}){const n=e[1];if(n==="c"||n==="C")return cl(e);if("dDhHsSwW".includes(n))return hl(e);if(e.startsWith(j`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw new Error(`Incomplete or invalid Unicode property "${e}"`);return dl(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{const r=e.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 l=[...o.encode(i)].map(a=>`\\x${a.toString(16)}`).join("");return ae(Ae(i),l)})}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n==="u"||n==="x")return ae(gl(e),e);if(ir.has(n))return ae(ir.get(n),e);if(/\d/.test(n))return rl(t,e);if(e==="\\")throw new Error(j`Incomplete escape "\"`);if(n==="M")throw new Error(`Unsupported meta "${e}"`);if([...e].length===2)return ae(e.codePointAt(1),e);throw new Error(`Unexpected escape "${e}"`)}function Ja(e){return{type:"Alternator",raw:e}}function sr(e,t){return{type:"Assertion",kind:e,raw:t}}function vs(e){return{type:"Backreference",raw:e}}function ae(e,t){return{type:"Character",value:e,raw:t}}function el(e){return{type:"CharacterClassClose",raw:e}}function tl(e){return{type:"CharacterClassHyphen",raw:e}}function nl(e){return{type:"CharacterClassIntersector",raw:e}}function or(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function me(e,t,n={}){return{type:"CharacterSet",kind:e,...n,raw:t}}function xs(e,t,n={}){return e==="keep"?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:Re(n.flags),raw:t}}function rl(e,t){return{type:"EscapedNumber",inCharClass:e,raw:t}}function sl(e){return{type:"GroupClose",raw:e}}function ve(e,t,n={}){return{type:"GroupOpen",kind:e,...n,raw:t}}function ol(e,t,n,r){return{type:"NamedCallout",kind:e,tag:t,arguments:n,raw:r}}function il(e,t,n,r){return{type:"Quantifier",kind:e,min:t,max:n,raw:r}}function al(e){return{type:"Subroutine",raw:e}}const ll=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),ir=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function cl(e){const t=e[1]==="c"?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw new Error(`Unsupported control character "${e}"`);return ae(Ae(t.toUpperCase())-64,e)}function ul(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??="";const s=(t.getCurrentModX()||n.includes("x"))&&!r.includes("x"),o=lr(n),i=lr(r),l={};if(o&&(l.enable=o),i&&(l.disable=i),e.endsWith(")"))return t.replaceCurrentModX(s),xs("flags",e,{flags:l});if(e.endsWith(":"))return t.pushModX(s),t.numOpenGroups++,ve("group",e,{...(o||i)&&{flags:l}});throw new Error(`Unexpected flag modifier "${e}"`)}function fl(e){const t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw new Error(`Incomplete or invalid named callout "${e}"`);const{name:n,tag:r,args:s}=t.groups;if(!n)throw new Error(`Invalid named callout "${e}"`);if(r==="")throw new Error(`Named callout tag with empty value not allowed "${e}"`);const o=s?s.split(",").filter(u=>u!=="").map(u=>/^[+-]?\d+$/.test(u)?+u:u):[],[i,l,a]=o,c=ll.has(n)?n.toLowerCase():"custom";switch(c){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 l=="number"||!/^[<>X]$/.test(l)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${l}"`);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 l=="number"||!/^(?:[<>!=]=|[<>])$/.test(l))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${l}"`);if(typeof a=="string"&&!/^[A-Za-z_]\w*$/.test(a))throw new Error(`Named callout argument three must be a tag or number "${a}"`);break;case"custom":throw new Error(`Undefined callout name "${n}"`);default:throw new Error(`Unexpected named callout kind "${c}"`)}return ol(c,r??null,s?.split(",")??null,e)}function ar(e){let t=null,n,r;if(e[0]==="{"){const{minStr:s,maxStr:o}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).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&&(t="possessive",[n,r]=[r,n]),e.endsWith("?")){if(t==="possessive")throw new Error('Unsupported possessive interval quantifier chain with "?"');t="lazy"}else t||(t="greedy")}else n=e[0]==="+"?1:0,r=e[0]==="?"?1:1/0,t=e[1]==="+"?"possessive":e[1]==="?"?"lazy":"greedy";return il(t,n,r,e)}function hl(e){const t=e[1].toLowerCase();return me({d:"digit",h:"hex",s:"space",w:"word"}[t],e,{negate:e[1]!==t})}function dl(e){const{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return me("property",e,{value:r,negate:t==="P"&&!n||t==="p"&&!!n})}function lr(e){const t={};return e.includes("i")&&(t.ignoreCase=!0),e.includes("m")&&(t.dotAll=!0),e.includes("x")&&(t.extended=!0),Object.keys(t).length?t:null}function pl(e){const t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){const r=e[n];if(!"imxDPSWy".includes(r))throw new Error(`Invalid flag "${r}"`);if(r==="y"){if(!/^y{[gw]}/.test(e.slice(n)))throw new Error('Invalid or unspecified flag "y" mode');t.textSegmentMode=e[n+2]==="g"?"grapheme":"word",n+=3;continue}t[{i:"ignoreCase",m:"dotAll",x:"extended",D:"digitIsAscii",P:"posixIsAscii",S:"spaceIsAscii",W:"wordIsAscii"}[r]]=!0}return t}function gl(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw new Error(`Incomplete or invalid escape "${e}"`);const t=e[2]==="{"?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function ml(e,t){const{raw:n,inCharClass:r}=e,s=n.slice(1);if(!r&&(s!=="0"&&s.length===1||s[0]!=="0"&&+s<=t))return[vs(n)];const o=[],i=s.match(/^[0-7]+|\d/g);for(let l=0;l<i.length;l++){const a=i[l];let c;if(l===0&&a!=="8"&&a!=="9"){if(c=parseInt(a,8),c>127)throw new Error(j`Octal encoded byte above 177 unsupported "${n}"`)}else c=Ae(a);o.push(ae(c,(l===0?"\\":"")+a))}return o}function yl(e){const t=[],n=new RegExp(In,"gy");let r;for(;r=n.exec(e);){const s=r[0];if(s[0]==="{"){const o=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(s);if(o){const{min:i,max:l}=o.groups;if(+i>+l&&s.endsWith("?")){n.lastIndex--,t.push(ar(s.slice(0,-1)));continue}}}t.push(ar(s))}return t}function Es(e,t){if(!Array.isArray(e.body))throw new Error("Expected node with body array");if(e.body.length!==1)return!1;const n=e.body[0];return!t||Object.keys(t).every(r=>t[r]===n[r])}function bl(e){return wl.has(e.type)}const wl=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function Is(e,t={}){const n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=Ka(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),s=(h,d)=>{const p=r.tokens[o.nextIndex];switch(o.parent=h,o.nextIndex++,p.type){case"Alternator":return Ce();case"Assertion":return Cl(p);case"Backreference":return _l(p,o);case"Character":return St(p.value,{useLastValid:!!d.isCheckingRangeEnd});case"CharacterClassHyphen":return Sl(p,o,d);case"CharacterClassOpen":return kl(p,o,d);case"CharacterSet":return vl(p,o);case"Directive":return Ll(p.kind,{flags:p.flags});case"GroupOpen":return xl(p,o,d);case"NamedCallout":return Tl(p.kind,p.tag,p.arguments);case"Quantifier":return El(p,o);case"Subroutine":return Il(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=$l(Nl(r.flags));let l=i.body[0];for(;o.nextIndex<r.tokens.length;){const h=s(l,{});h.type==="Alternative"?(i.body.push(h),l=h):l.body.push(h)}const{capturingGroups:a,hasNumberedRef:c,namedGroupsByName:u,subroutines:f}=o;if(c&&u.size&&!n.rules.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(const{ref:h}of f)if(typeof h=="number"){if(h>a.length)throw new Error("Subroutine uses a group number that's not defined");h&&(a[h-1].isSubroutined=!0)}else if(u.has(h)){if(u.get(h).length>1)throw new Error(j`Subroutine uses a duplicate group name "\g<${h}>"`);u.get(h)[0].isSubroutined=!0}else throw new Error(j`Subroutine uses a group name that's not defined "\g<${h}>"`);return i}function Cl({kind:e}){return fn(Re({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[e],`Unexpected assertion kind "${e}"`),{negate:e===j`\B`||e===j`\Y`})}function _l({raw:e},t){const n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),s=(o,i=!1)=>{const l=t.capturingGroups.length;let a=!1;if(o>l)if(t.skipBackrefValidation)a=!0;else throw new Error(`Not enough capturing groups defined to the left "${e}"`);return t.hasNumberedRef=!0,hn(i?l+1-o:o,{orphan:a})};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 "${e}"`);if(!t.namedGroupsByName.has(r))throw new Error(`Group name not defined to the left "${e}"`);return hn(r)}return s(+r)}function Sl(e,t,n){const{tokens:r,walk:s}=t,o=t.parent,i=o.body.at(-1),l=r[t.nextIndex];if(!n.isCheckingRangeEnd&&i&&i.type!=="CharacterClass"&&i.type!=="CharacterClassRange"&&l&&l.type!=="CharacterClassOpen"&&l.type!=="CharacterClassClose"&&l.type!=="CharacterClassIntersector"){const a=s(o,{...n,isCheckingRangeEnd:!0});if(i.type==="Character"&&a.type==="Character")return o.body.pop(),Rl(i,a);throw new Error("Invalid character class range")}return St(Ae("-"))}function kl({negate:e},t,n){const{tokens:r,walk:s}=t,o=[rt()],i=r[t.nextIndex];let l=fr(i);for(;l.type!=="CharacterClassClose";){if(l.type==="CharacterClassIntersector")o.push(rt()),t.nextIndex++;else{const c=o.at(-1);c.body.push(s(c,n))}l=fr(r[t.nextIndex],i)}const a=rt({negate:e});return o.length===1?a.body=o[0].body:(a.kind="intersection",a.body=o.map(c=>c.body.length===1?c.body[0]:c)),t.nextIndex++,a}function vl({kind:e,negate:t,value:n},r){const{normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i}=r;if(e==="property"){const l=kt(n);if(En.has(l)&&!i?.has(l))e="posix",n=l;else return xe(n,{negate:t,normalizeUnknownPropertyNames:s,skipPropertyNameValidation:o,unicodePropertyMap:i})}return e==="posix"?Pl(n,{negate:t}):dn(e,{negate:t})}function xl(e,t,n){const{tokens:r,capturingGroups:s,namedGroupsByName:o,skipLookbehindValidation:i,walk:l}=t,a=Ml(e),c=a.type==="AbsenceFunction",u=ur(a),f=u&&a.negate;if(a.type==="CapturingGroup"&&(s.push(a),a.name&&Xa(o,a.name,[]).push(a)),c&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let h=hr(r[t.nextIndex]);for(;h.type!=="GroupClose";){if(h.type==="Alternator")a.body.push(Ce()),t.nextIndex++;else{const d=a.body.at(-1),p=l(d,{...n,isInAbsenceFunction:n.isInAbsenceFunction||c,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||f});if(d.body.push(p),(u||n.isInLookbehind)&&!i){const b="Lookbehind includes a pattern not allowed by Oniguruma";if(f||n.isInNegLookbehind){if(cr(p)||p.type==="CapturingGroup")throw new Error(b)}else if(cr(p)||ur(p)&&p.negate)throw new Error(b)}}h=hr(r[t.nextIndex])}return t.nextIndex++,a}function El({kind:e,min:t,max:n},r){const s=r.parent,o=s.body.at(-1);if(!o||!bl(o))throw new Error("Quantifier requires a repeatable token");const i=Rs(e,t,n,o);return s.body.pop(),i}function Il({raw:e},t){const{capturingGroups:n,subroutines:r}=t;let s=e.slice(3,-1);const o=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s);if(o){const l=+o.groups.num,a=n.length;if(t.hasNumberedRef=!0,s={"":l,"+":a+l,"-":a+1-l}[o.groups.sign],s<1)throw new Error("Invalid subroutine number")}else s==="0"&&(s=0);const i=Ls(s);return r.push(i),i}function Al(e,t){return{type:"AbsenceFunction",kind:e,body:ze(t?.body)}}function Ce(e){return{type:"Alternative",body:Ns(e?.body)}}function fn(e,t){const n={type:"Assertion",kind:e};return(e==="word_boundary"||e==="text_segment_boundary")&&(n.negate=!!t?.negate),n}function hn(e,t){const n=!!t?.orphan;return{type:"Backreference",ref:e,...n&&{orphan:n}}}function As(e,t){const n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!Ol(n.name))throw new Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:ze(t?.body)}}function St(e,t){const n={useLastValid:!1,...t};if(e>1114111){const r=e.toString(16);if(n.useLastValid)e=1114111;else throw e>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:e}}function rt(e){const t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:Ns(e?.body)}}function Rl(e,t){if(t.value<e.value)throw new Error("Character class range out of order");return{type:"CharacterClassRange",min:e,max:t}}function dn(e,t){const n=!!t?.negate,r={type:"CharacterSet",kind:e};return(e==="digit"||e==="hex"||e==="newline"||e==="space"||e==="word")&&(r.negate=n),(e==="text_segment"||e==="newline"&&!n)&&(r.variableLength=!0),r}function Ll(e,t={}){if(e==="keep")return{type:"Directive",kind:e};if(e==="flags")return{type:"Directive",kind:e,flags:Re(t.flags)};throw new Error(`Unexpected directive kind "${e}"`)}function Nl(e){return{type:"Flags",...e}}function ee(e){const t=e?.atomic,n=e?.flags;if(t&&n)throw new Error("Atomic group cannot have flags");return{type:"Group",...t&&{atomic:t},...n&&{flags:n},body:ze(e?.body)}}function pe(e){const t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:ze(e?.body)}}function Tl(e,t,n){return{type:"NamedCallout",kind:e,tag:t,arguments:n}}function Pl(e,t){const n=!!t?.negate;if(!En.has(e))throw new Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:n}}function Rs(e,t,n,r){if(t>n)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:n,body:r}}function $l(e,t){return{type:"Regex",body:ze(t?.body),flags:e}}function Ls(e){return{type:"Subroutine",ref:e}}function xe(e,t){const n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t};let r=n.unicodePropertyMap?.get(kt(e));if(!r){if(n.normalizeUnknownPropertyNames)r=Bl(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw new Error(j`Invalid Unicode property "\p{${e}}"`)}return{type:"CharacterSet",kind:"property",value:r??e,negate:n.negate}}function Ml({flags:e,kind:t,name:n,negate:r,number:s}){switch(t){case"absence_repeater":return Al("repeater");case"atomic":return ee({atomic:!0});case"capturing":return As(s,{name:n});case"group":return ee({flags:e});case"lookahead":case"lookbehind":return pe({behind:t==="lookbehind",negate:r});default:throw new Error(`Unexpected group kind "${t}"`)}}function ze(e){if(e===void 0)e=[Ce()];else if(!Array.isArray(e)||!e.length||!e.every(t=>t.type==="Alternative"))throw new Error("Invalid body; expected array of one or more Alternative nodes");return e}function Ns(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(t=>!!t.type))throw new Error("Invalid body; expected array of nodes");return e}function cr(e){return e.type==="LookaroundAssertion"&&e.kind==="lookahead"}function ur(e){return e.type==="LookaroundAssertion"&&e.kind==="lookbehind"}function Ol(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function Bl(e){return e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,t=>t[0].toUpperCase()+t.slice(1).toLowerCase())}function kt(e){return e.replace(/[- _]+/g,"").toLowerCase()}function fr(e,t){const n=t;return Re(e,`Unclosed character class${n?.type==="Character"&&n.value===93&&n.raw==="]"?' (started with "]")':""}`)}function hr(e){return Re(e,"Unclosed group")}function Oe(e,t,n=null){function r(o,i){for(let l=0;l<o.length;l++){const a=s(o[l],i,l,o);l=Math.max(-1,l+a)}}function s(o,i=null,l=null,a=null){let c=0,u=!1;const f={node:o,parent:i,key:l,container:a,root:e,remove(){Ke(a).splice(Math.max(0,Se(l)+c),1),c--,u=!0},removeAllNextSiblings(){return Ke(a).splice(Se(l)+1)},removeAllPrevSiblings(){const g=Se(l)+c;return c-=g,Ke(a).splice(0,Math.max(0,g))},replaceWith(g,m={}){const y=!!m.traverse;a?a[Math.max(0,Se(l)+c)]=g:Re(i,"Can't replace root node")[l]=g,y&&s(g,i,l,a),u=!0},replaceWithMultiple(g,m={}){const y=!!m.traverse;if(Ke(a).splice(Math.max(0,Se(l)+c),1,...g),c+=g.length-1,y){let _=0;for(let S=0;S<g.length;S++)_+=s(g[S],i,Se(l)+S+_,a)}u=!0},skip(){u=!0}},{type:h}=o,d=t["*"],p=t[h],b=typeof d=="function"?d:d?.enter,w=typeof p=="function"?p:p?.enter;if(b?.(f,n),w?.(f,n),!u)switch(h){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 "${h}"`)}return p?.exit?.(f,n),d?.exit?.(f,n),c}return s(e),e}function Ke(e){if(!Array.isArray(e))throw new Error("Container expected");return e}function Se(e){if(typeof e!="number")throw new Error("Numeric key expected");return e}const Dl=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function Gl(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Fl(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}const J=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function An(e,t,n,r){const s=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1];let i=0,l="";for(const a of e.matchAll(s)){const{0:c,groups:{$skip:u}}=a;if(!u&&(!r||r===J.DEFAULT==!i)){n instanceof Function?l+=n(a,{context:i?J.CHAR_CLASS:J.DEFAULT,negated:o[o.length-1]}):l+=n;continue}c[0]==="["?(i++,o.push(c[1]==="^")):c==="]"&&i&&(i--,o.pop()),l+=c}return l}function Ts(e,t,n,r){An(e,t,n,r)}function Ul(e,t,n=0,r){if(!new RegExp(t,"su").test(e))return null;const s=new RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");s.lastIndex=n;let o=0,i;for(;i=s.exec(e);){const{0:l,groups:{$skip:a}}=i;if(!a&&(!r||r===J.DEFAULT==!o))return i;l==="["?o++:l==="]"&&o&&o--,s.lastIndex==i.index&&s.lastIndex++}return null}function Ze(e,t,n){return!!Ul(e,t,0,n)}function jl(e,t){const n=/\\?./gsu;n.lastIndex=t;let r=e.length,s=0,o=1,i;for(;i=n.exec(e);){const[l]=i;if(l==="[")s++;else if(s)l==="]"&&s--;else if(l==="(")o++;else if(l===")"&&(o--,!o)){r=i.index;break}}return e.slice(t,r)}const dr=new RegExp(String.raw`(?<noncapturingStart>${Dl})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function Wl(e,t){const n=t?.hiddenCaptures??[];let r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};const s="(?>",o="(?:(?=(",i=[0],l=[];let a=0,c=0,u=NaN,f;do{f=!1;let h=0,d=0,p=!1,b;for(dr.lastIndex=Number.isNaN(u)?0:u+o.length;b=dr.exec(e);){const{0:w,index:g,groups:{capturingStart:m,noncapturingStart:y}}=b;if(w==="[")h++;else if(h)w==="]"&&h--;else if(w===s&&!p)u=g,p=!0;else if(p&&y)d++;else if(m)p?d++:(a++,i.push(a+c));else if(w===")"&&p){if(!d){c++;const _=a+c;if(e=`${e.slice(0,u)}${o}${e.slice(u+s.length,g)}))<$$${_}>)${e.slice(g+1)}`,f=!0,l.push(_),Gl(n,_),r.size){const S=new Map;r.forEach((k,v)=>{S.set(v>=_?v+1:v,k.map(A=>A>=_?A+1:A))}),r=S}break}d--}}}while(f);return n.push(...l),e=An(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:h,groups:{backrefNum:d,wrappedBackrefNum:p}})=>{if(d){const b=+d;if(b>i.length-1)throw new Error(`Backref "${h}" greater than number of captures`);return`\\${i[b]}`}return`\\${p}`},J.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}const Ps=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Dt=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>${Ps})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
58
|
+
| \\?.
|
|
59
|
+
`.replace(/\s+/g,""),"gsu");function zl(e){if(!new RegExp(`${Ps}\\+`).test(e))return{pattern:e};const t=[];let n=null,r=null,s="",o=0,i;for(Dt.lastIndex=0;i=Dt.exec(e);){const{0:l,index:a,groups:{qBase:c,qMod:u,invalidQ:f}}=i;if(l==="[")o||(r=a),o++;else if(l==="]")o?o--:r=null;else if(!o)if(u==="+"&&s&&!s.startsWith("(")){if(f)throw new Error(`Invalid quantifier "${l}"`);let h=-1;if(/^\{\d+\}$/.test(c))e=Fl(e,a+c.length,u,"");else{if(s===")"||s==="]"){const d=s===")"?n:r;if(d===null)throw new Error(`Invalid unmatched "${s}"`);e=`${e.slice(0,d)}(?>${e.slice(d,a)}${c})${e.slice(a+l.length)}`}else e=`${e.slice(0,a-s.length)}(?>${s}${c})${e.slice(a+l.length)}`;h+=4}Dt.lastIndex+=h}else l[0]==="("?t.push(a):l===")"&&(n=t.length?t.pop():null);s=l}return{pattern:e}}const Y=String.raw,Hl=Y`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,pn=Y`\(\?R=(?<rDepth>[^\)]+)\)|${Hl}`,vt=Y`\(\?<(?![=!])(?<captureName>[^>]+)>`,$s=Y`${vt}|(?<unnamed>\()(?!\?)`,he=new RegExp(Y`${vt}|${pn}|\(\?|\\?.`,"gsu"),Gt="Cannot use multiple overlapping recursions";function ql(e,t){const{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:"plugin",...t};let s=t?.captureTransfers??new Map;if(!new RegExp(pn,"su").test(e))return{pattern:e,captureTransfers:s,hiddenCaptures:n};if(r==="plugin"&&Ze(e,Y`\(\?\(DEFINE\)`,J.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");const o=[],i=Ze(e,Y`\\[1-9]`,J.DEFAULT),l=new Map,a=[];let c=!1,u=0,f=0,h;for(he.lastIndex=0;h=he.exec(e);){const{0:d,groups:{captureName:p,rDepth:b,gRNameOrNum:w,gRDepth:g}}=h;if(d==="[")u++;else if(u)d==="]"&&u--;else if(b){if(pr(b),c)throw new Error(Gt);if(i)throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with global recursion`);const m=e.slice(0,h.index),y=e.slice(he.lastIndex);if(Ze(y,pn,J.DEFAULT))throw new Error(Gt);const _=+b-1;e=gr(m,y,_,!1,n,o,f),s=yr(s,m,_,o.length,0,f);break}else if(w){pr(g);let m=!1;for(const E of a)if(E.name===w||E.num===+w){if(m=!0,E.hasRecursedWithin)throw new Error(Gt);break}if(!m)throw new Error(Y`Recursive \g cannot be used outside the referenced group "${r==="external"?w:Y`\g<${w}&R=${g}>`}"`);const y=l.get(w),_=jl(e,y);if(i&&Ze(_,Y`${vt}|\((?!\?)`,J.DEFAULT))throw new Error(`${r==="external"?"Backrefs":"Numbered backrefs"} cannot be used with recursion of capturing groups`);const S=e.slice(y,h.index),k=_.slice(S.length+d.length),v=o.length,A=+g-1,R=gr(S,k,A,!0,n,o,f);s=yr(s,S,A,o.length-v,v,f);const H=e.slice(0,y),Le=e.slice(y+_.length);e=`${H}${R}${Le}`,he.lastIndex+=R.length-d.length-S.length-k.length,a.forEach(E=>E.hasRecursedWithin=!0),c=!0}else if(p)f++,l.set(String(f),he.lastIndex),l.set(p,he.lastIndex),a.push({num:f,name:p});else if(d[0]==="("){const m=d==="(";m&&(f++,l.set(String(f),he.lastIndex)),a.push(m?{num:f}:{})}else d===")"&&a.pop()}return n.push(...o),{pattern:e,captureTransfers:s,hiddenCaptures:n}}function pr(e){const t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e))throw new Error(t);if(e=+e,e<2||e>100)throw new Error(t)}function gr(e,t,n,r,s,o,i){const l=new Set;r&&Ts(e+t,vt,({groups:{captureName:c}})=>{l.add(c)},J.DEFAULT);const a=[n,r?l:null,s,o,i];return`${e}${mr(`(?:${e}`,"forward",...a)}(?:)${mr(`${t})`,"backward",...a)}${t}`}function mr(e,t,n,r,s,o,i){const a=u=>t==="forward"?u+2:n-u+2-1;let c="";for(let u=0;u<n;u++){const f=a(u);c+=An(e,Y`${$s}|\\k<(?<backref>[^>]+)>`,({0:h,groups:{captureName:d,unnamed:p,backref:b}})=>{if(b&&r&&!r.has(b))return h;const w=`_$${f}`;if(p||d){const g=i+o.length+1;return o.push(g),Vl(s,g),p?h:`(?<${d}${w}>`}return Y`\k<${b}${w}>`},J.DEFAULT)}return c}function Vl(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function yr(e,t,n,r,s,o){if(e.size&&r){let i=0;Ts(t,$s,()=>i++,J.DEFAULT);const l=o-i+s,a=new Map;return e.forEach((c,u)=>{const f=(r-i*n)/n,h=i*n,d=u>l+i?u+r:u,p=[];for(const b of c)if(b<=l)p.push(b);else if(b>l+i+f)p.push(b+r);else if(b<=l+i)for(let w=0;w<=n;w++)p.push(b+i*w);else for(let w=0;w<=n;w++)p.push(b+h+f*w);a.set(d,p)}),a}return e}var D=String.fromCodePoint,I=String.raw,te={},xt=globalThis.RegExp;te.flagGroups=(()=>{try{new xt("(?i:)")}catch{return!1}return!0})();te.unicodeSets=(()=>{try{new xt("[[]]","v")}catch{return!1}return!0})();te.bugFlagVLiteralHyphenIsRange=te.unicodeSets?(()=>{try{new xt(I`[\d\-a]`,"v")}catch{return!0}return!1})():!1;te.bugNestedClassIgnoresNegation=te.unicodeSets&&new xt("[[^a]]","v").test("a");function gt(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function Ue(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function gn(e,t){return br[e]>=br[t]}function Xl(e,t){if(e==null)throw new Error(t??"Value expected");return e}var br={ES2025:2025,ES2024:2024,ES2018:2018},Kl={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function Ms(e={}){if({}.toString.call(e)!=="[object Object]")throw new Error("Unexpected options");if(e.target!==void 0&&!Kl[e.target])throw new Error(`Unexpected target "${e.target}"`);const t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target==="auto"&&(t.target=te.flagGroups?"ES2025":te.unicodeSets?"ES2024":"ES2018"),t}var Zl="[ -\r ]",Ql=new Set([D(304),D(305)]),oe=I`[\p{L}\p{M}\p{N}\p{Pc}]`;function Os(e){if(Ql.has(e))return[e];const t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),s=ec.get(n),o=Yl.get(n),i=Jl.get(n);return[...r].length===1&&t.add(r),i&&t.add(i),s&&t.add(s),t.add(n),o&&t.add(o),[...t]}var Rn=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(e=>[kt(e),e])),Yl=new Map([["s",D(383)],[D(383),"s"]]),Jl=new Map([[D(223),D(7838)],[D(107),D(8490)],[D(229),D(8491)],[D(969),D(8486)]]),ec=new Map([le(453),le(456),le(459),le(498),...Ft(8072,8079),...Ft(8088,8095),...Ft(8104,8111),le(8124),le(8140),le(8188)]),tc=new Map([["alnum",I`[\p{Alpha}\p{Nd}]`],["alpha",I`\p{Alpha}`],["ascii",I`\p{ASCII}`],["blank",I`[\p{Zs}\t]`],["cntrl",I`\p{Cc}`],["digit",I`\p{Nd}`],["graph",I`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",I`\p{Lower}`],["print",I`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",I`[\p{P}\p{S}]`],["space",I`\p{space}`],["upper",I`\p{Upper}`],["word",I`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",I`\p{AHex}`]]);function nc(e,t){const n=[];for(let r=e;r<=t;r++)n.push(r);return n}function le(e){const t=D(e);return[t.toLowerCase(),t]}function Ft(e,t){return nc(e,t).map(n=>le(n))}var Bs=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);function rc(e,t){const n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t};Ds(e);const r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:gn(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};Oe(e,sc,r);const s={dotAll:e.flags.dotAll,ignoreCase:e.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};Oe(e,oc,o);const i={groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer};return Oe(e,ic,i),e._originMap=o.groupOriginByCopy,e._strategy=r.strategy,e}var sc={AbsenceFunction({node:e,parent:t,replaceWith:n}){const{body:r,kind:s}=e;if(s==="repeater"){const o=ee();o.body[0].body.push(pe({negate:!0,body:r}),xe("Any"));const i=ee();i.body[0].body.push(Rs("greedy",0,1/0,o)),n(M(i,t),{traverse:!0})}else throw new Error('Unsupported absence function "(?~|"')},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){const s=e.body.filter(o=>o.kind==="flags");for(let o=n+1;o<t.body.length;o++){const i=t.body[o];Ue(r,i,[]).push(...s)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){const n=Fs(t.get(e));if(n){const r=ee({flags:n});r.body[0].body=e.body,e.body=[M(r,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:s,remove:o,replaceWith:i},l){const{kind:a,negate:c}=e,{asciiWordBoundaries:u,avoidSubclass:f,supportedGNodes:h,wordIsAscii:d}=l;if(a==="text_segment_boundary")throw new Error(`Unsupported text segment boundary "\\${c?"Y":"y"}"`);if(a==="line_end")i(M(pe({body:[Ce({body:[fn("string_end")]}),Ce({body:[St(10)]})]}),t));else if(a==="line_start")i(M(ie(I`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(a==="search_start")if(h.has(e))s.flags.sticky=!0,o();else{const p=r[n-1];if(p&&hc(p))i(M(pe({negate:!0}),t));else{if(f)throw new Error(I`Uses "\G" in a way that requires a subclass`);i(ce(fn("string_start"),t)),l.strategy="clip_search"}}else if(!(a==="string_end"||a==="string_start"))if(a==="string_end_newline")i(M(ie(I`(?=\n?\z)`),t));else if(a==="word_boundary"){if(!d&&!u){const p=`(?:(?<=${oe})(?!${oe})|(?<!${oe})(?=${oe}))`,b=`(?:(?<=${oe})(?=${oe})|(?<!${oe})(?!${oe}))`;i(M(ie(c?b:p),t))}}else throw new Error(`Unexpected assertion kind "${a}"`)},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!jt(n)&&(n=Ut(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!jt(r)&&(r=Ut(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){if(t.kind==="intersection"){const r=rt({body:[e]});n(M(r,t),{traverse:!0})}},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:s,digitIsAscii:o,spaceIsAscii:i,wordIsAscii:l}){const{kind:a,negate:c,value:u}=e;if(o&&(a==="digit"||u==="digit")){n(ce(dn("digit",{negate:c}),t));return}if(i&&(a==="space"||u==="space")){n(M(Wt(ie(Zl),c),t));return}if(l&&(a==="word"||u==="word")){n(ce(dn("word",{negate:c}),t));return}if(a==="any")n(ce(xe("Any"),t));else if(a==="digit")n(ce(xe("Nd",{negate:c}),t));else if(a!=="dot")if(a==="text_segment"){if(r==="strict")throw new Error(I`Use of "\X" requires non-strict accuracy`);const f="\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?",h=I`\p{RI}{2}|${f}(?:\u200D${f})*`;n(M(ie(I`(?>\r\n|${s?I`\p{RGI_Emoji}`:h}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(a==="hex")n(ce(xe("AHex",{negate:c}),t));else if(a==="newline")n(M(ie(c?`[^
|
|
150
|
+
]`:`(?>\r
|
|
151
|
+
?|[
|
|
152
|
+
\v\f
\u2028\u2029])`),t));else if(a==="posix")if(!s&&(u==="graph"||u==="print")){if(r==="strict")throw new Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let f={graph:"!-~",print:" -~"}[u];c&&(f=`\0-${D(f.codePointAt(0)-1)}${D(f.codePointAt(2)+1)}-`),n(M(ie(`[${f}]`),t))}else n(M(Wt(ie(tc.get(u)),c),t));else if(a==="property")Rn.has(kt(u))||(e.key="sc");else if(a==="space")n(ce(xe("space",{negate:c}),t));else if(a==="word")n(M(Wt(ie(oe),c),t));else throw new Error(`Unexpected character set kind "${a}"`)},Directive({node:e,parent:t,root:n,remove:r,replaceWith:s,removeAllPrevSiblings:o,removeAllNextSiblings:i}){const{kind:l,flags:a}=e;if(l==="flags")if(!a.enable&&!a.disable)r();else{const c=ee({flags:a});c.body[0].body=i(),s(M(c,t),{traverse:!0})}else if(l==="keep"){const c=n.body[0],f=n.body.length===1&&Es(c,{type:"Group"})&&c.body[0].body.length===1?c.body[0]:n;if(t.parent!==f||f.body.length>1)throw new Error(I`Uses "\K" in a way that's unsupported`);const h=pe({behind:!0});h.body[0].body=o(),s(M(h,t))}else throw new Error(`Unexpected directive kind "${l}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if(e.textSegmentMode==="word")throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(n=>delete e[n]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;const{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){const{kind:n}=e;n==="lookbehind"&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){const{kind:r}=e;if(r==="fail")n(M(pe({negate:!0}),t));else throw new Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type==="Quantifier"){const t=ee();t.body[0].body.push(e.body),e.body=M(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){const n=[];let r=!1,s=!1;for(const o of e.body)if(o.body.length===1&&o.body[0].kind==="search_start")o.body.pop();else{const i=js(o.body);i?(r=!0,Array.isArray(i)?n.push(...i):n.push(i)):s=!0}r&&!s&&n.forEach(o=>t.add(o))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t==="strict"&&n&&r)throw new Error(I`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n=="string"&&!jt(n)&&(n=Ut(n,t),e.ref=n)}},oc={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){const{orphan:r,ref:s}=e;r||n.set(e,[...t.get(s).map(({node:o})=>o)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:s,groupsByName:o,multiplexCapturesToLeftByRef:i,openRefs:l,reffedNodesByReferencer:a}){const c=s.get(e);if(c&&l.has(e.number)){const f=ce(wr(e.number),t);a.set(f,l.get(e.number)),n(f);return}l.set(e.number,e),i.set(e.number,[]),e.name&&Ue(i,e.name,[]);const u=i.get(e.name??e.number);for(let f=0;f<u.length;f++){const h=u[f];if(c===h.node||c&&c===h.origin||e===h.origin){u.splice(f,1);break}}if(i.get(e.number).push({node:e,origin:c}),e.name&&i.get(e.name).push({node:e,origin:c}),e.name){const f=Ue(o,e.name,new Map);let h=!1;if(c)h=!0;else for(const d of f.values())if(!d.hasDuplicateNameToRemove){h=!0;break}o.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:h})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=gt(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){const{isRecursive:s,ref:o}=e;if(s){let u=t;for(;(u=u.parent)&&!(u.type==="CapturingGroup"&&(u.name===o||u.number===o)););r.reffedNodesByReferencer.set(e,u);return}const i=r.subroutineRefMap.get(o),l=o===0,a=l?wr(0):Gs(i,r.groupOriginByCopy,null);let c=a;if(!l){const u=Fs(cc(i,h=>h.type==="Group"&&!!h.flags)),f=u?gt(r.globalFlags,u):r.globalFlags;ac(f,r.currentFlags)||(c=ee({flags:uc(f)}),c.body[0].body.push(a))}n(M(c,t),{traverse:!l})}},ic={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}const o=r.reffedNodesByReferencer.get(e).filter(i=>lc(i,e));if(!o.length)n(M(pe({negate:!0}),t));else if(o.length>1){const i=ee({atomic:!0,body:o.reverse().map(l=>Ce({body:[hn(l.number)]}))});n(M(i,t))}else e.ref=o[0].number},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){const n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let r=0;r<n;r++){const s=As();e.body.at(-1).body.push(s)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function Ds(e){Oe(e,{"*"({node:t,parent:n}){t.parent=n}})}function ac(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function lc(e,t){let n=t;do{if(n.type==="Regex")return!1;if(n.type==="Alternative")continue;if(n===e)return!1;const r=Us(n.parent);for(const s of r){if(s===n)break;if(s===e||Ws(s,e))return!0}}while(n=n.parent);throw new Error("Unexpected path")}function Gs(e,t,n,r){const s=Array.isArray(e)?[]:{};for(const[o,i]of Object.entries(e))o==="parent"?s.parent=Array.isArray(n)?r:n:i&&typeof i=="object"?s[o]=Gs(i,t,s,n):(o==="type"&&i==="CapturingGroup"&&t.set(s,t.get(e)??e),s[o]=i);return s}function wr(e){const t=Ls(e);return t.isRecursive=!0,t}function cc(e,t){const n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function Ut(e,t){if(t.has(e))return t.get(e);const n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/ug,"_")}`;return t.set(e,n),n}function Fs(e){const t=["dotAll","ignoreCase"],n={enable:{},disable:{}};return e.forEach(({flags:r})=>{t.forEach(s=>{r.enable?.[s]&&(delete n.disable[s],n.enable[s]=!0),r.disable?.[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 uc({dotAll:e,ignoreCase:t}){const n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function Us(e){if(!e)throw new Error("Node expected");const{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function js(e){const t=e.find(n=>n.kind==="search_start"||dc(n,{negate:!1})||!fc(n));if(!t)return null;if(t.kind==="search_start")return t;if(t.type==="LookaroundAssertion")return t.body[0].body[0];if(t.type==="CapturingGroup"||t.type==="Group"){const n=[];for(const r of t.body){const s=js(r.body);if(!s)return null;Array.isArray(s)?n.push(...s):n.push(s)}return n}return null}function Ws(e,t){const n=Us(e)??[];for(const r of n)if(r===t||Ws(r,t))return!0;return!1}function fc({type:e}){return e==="Assertion"||e==="Directive"||e==="LookaroundAssertion"}function hc(e){const t=["Character","CharacterClass","CharacterSet"];return t.includes(e.type)||e.type==="Quantifier"&&e.min&&t.includes(e.body.type)}function dc(e,t){const n={negate:null,...t};return e.type==="LookaroundAssertion"&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&Es(e.body[0],{type:"Assertion",kind:"search_start"})}function jt(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function ie(e,t){const r=Is(e,{...t,unicodePropertyMap:Rn}).body;return r.length>1||r[0].body.length>1?ee({body:r}):r[0].body[0]}function Wt(e,t){return e.negate=t,e}function ce(e,t){return e.parent=t,e}function M(e,t){return Ds(e),e.parent=t,e}function pc(e,t){const n=Ms(t),r=gn(n.target,"ES2024"),s=gn(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,l=null;if(!s){const d=[e.flags.ignoreCase];Oe(e,gc,{getCurrentModI:()=>d.at(-1),popModI(){d.pop()},pushModI(p){d.push(p)},setHasCasedChar(){d.at(-1)?i=!0:l=!0}})}const a={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||i)&&!l)};let c=e;const u={accuracy:n.accuracy,appliedGlobalFlags:a,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:c,originMap:e._originMap,recursionLimit:o,useAppliedIgnoreCase:!!(!s&&i&&l),useFlagMods:s,useFlagV:r,verbose:n.verbose};function f(d){return u.lastNode=c,c=d,Xl(mc[d.type],`Unexpected node type "${d.type}"`)(d,u,f)}const h={pattern:e.body.map(f).join("|"),flags:f(e.flags),options:{...e.options}};return r||(delete h.options.force.v,h.options.disable.v=!0,h.options.unicodeSetsPlugin=null),h._captureTransfers=new Map,h._hiddenCaptures=[],u.captureMap.forEach((d,p)=>{d.hidden&&h._hiddenCaptures.push(p),d.transferTo&&Ue(h._captureTransfers,d.transferTo,[]).push(p)}),h}var gc={"*":{enter({node:e},t){if(_r(e)){const n=t.getCurrentModI();t.pushModI(e.flags?gt({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){_r(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){Ln(D(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),zs(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind==="property"&&Bs.has(e.value)&&t.setHasCasedChar()}},mc={Alternative({body:e},t,n){return e.map(n).join("")},Assertion({kind:e,negate:t}){if(e==="string_end")return"$";if(e==="string_start")return"^";if(e==="word_boundary")return t?I`\B`:I`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!="number")throw new Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&t.accuracy==="strict"&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,n){const{body:r,name:s,number:o}=e,i={ignoreCase:t.currentFlags.ignoreCase},l=t.originMap.get(e);return l&&(i.hidden=!0,o>l.number&&(i.transferTo=l.number)),t.captureMap.set(o,i),`(${s?`?<${s}>`:""}${r.map(n).join("|")})`},Character({value:e},t){const n=D(e),r=ke(e,{escDigit:t.lastNode.type==="Backreference",inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Ln(n)){const s=Os(n);return t.inCharClass?s.join(""):s.length>1?`[${s.join("")}]`:s[0]}return n},CharacterClass(e,t,n){const{kind:r,negate:s,parent:o}=e;let{body:i}=e;if(r==="intersection"&&!t.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");te.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&i.some(Sr)&&(i=[St(45),...i.filter(c=>!Sr(c))]);const l=()=>`[${s?"^":""}${i.map(n).join(r==="intersection"?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||te.bugNestedClassIgnoresNegation)&&!s){const u=i.filter(f=>f.type==="CharacterClass"&&f.kind==="union"&&f.negate);if(u.length){const f=ee(),h=f.body[0];return f.parent=o,h.parent=f,i=i.filter(d=>!u.includes(d)),e.body=i,i.length?(e.parent=h,h.body.push(e)):f.body.pop(),u.forEach(d=>{const p=Ce({body:[d]});d.parent=p,p.parent=f,f.body.push(p)}),n(f)}}t.inCharClass=!0;const c=l();return t.inCharClass=!1,c}const a=i[0];if(r==="union"&&!s&&a&&((!t.useFlagV||!t.verbose)&&o.kind==="union"&&!(te.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&o.kind==="intersection"&&i.length===1&&a.type!=="CharacterClassRange"))return i.map(n).join("");if(!t.useFlagV&&o.type==="CharacterClass")throw new Error("Uses nested character class in a way that requires min target ES2024");return l()},CharacterClassRange(e,t){const n=e.min.value,r=e.max.value,s={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},o=ke(n,s),i=ke(r,s),l=new Set;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){const a=zs(e);_c(a).forEach(u=>{l.add(Array.isArray(u)?`${ke(u[0],s)}-${ke(u[1],s)}`:ke(u,s))})}return`${o}-${i}${[...l].join("")}`},CharacterSet({kind:e,negate:t,value:n,key:r},s){if(e==="dot")return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":I`[^\n]`;if(e==="digit")return t?I`\D`:I`\d`;if(e==="property"){if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&Bs.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?I`\P`:I`\p`}{${r?`${r}=`:""}${n}}`}if(e==="word")return t?I`\W`:I`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")},Group({atomic:e,body:t,flags:n,parent:r},s,o){const i=s.currentFlags;n&&(s.currentFlags=gt(i,n));const l=t.map(o).join("|"),a=!s.verbose&&t.length===1&&r.type!=="Quantifier"&&!e&&(!s.useFlagMods||!n)?l:`(?${Sc(e,n,s.useFlagMods)}${l})`;return s.currentFlags=i,a},LookaroundAssertion({body:e,kind:t,negate:n},r,s){return`(?${`${t==="lookahead"?"":"<"}${n?"!":"="}`}${e.map(s).join("|")})`},Quantifier(e,t,n){return n(e.body)+kc(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");const r=n.recursionLimit;return t===0?`(?R=${r})`:I`\g<${t}&R=${r}>`}},yc=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),bc=new Set(["-","\\","]","^","["]),wc=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),Cr=new Map([[9,I`\t`],[10,I`\n`],[11,I`\v`],[12,I`\f`],[13,I`\r`],[8232,I`\u2028`],[8233,I`\u2029`],[65279,I`\uFEFF`]]),Cc=/^\p{Cased}$/u;function Ln(e){return Cc.test(e)}function zs(e,t){const n=!!t?.firstOnly,r=e.min.value,s=e.max.value,o=[];if(r<65&&(s===65535||s>=131071)||r===65536&&s>=131071)return o;for(let i=r;i<=s;i++){const l=D(i);if(!Ln(l))continue;const a=Os(l).filter(c=>{const u=c.codePointAt(0);return u<r||u>s});if(a.length&&(o.push(...a),n))break}return o}function ke(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(Cr.has(e))return Cr.get(e);if(e<32||e>126&&e<160||e>262143||t&&vc(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;const s=n?r?wc:bc:yc,o=D(e);return(s.has(o)?"\\":"")+o}function _c(e){const t=e.map(s=>s.codePointAt(0)).sort((s,o)=>s-o),n=[];let r=null;for(let s=0;s<t.length;s++)t[s+1]===t[s]+1?r??=t[s]:r===null?n.push(t[s]):(n.push([r,t[s]]),r=null);return n}function Sc(e,t,n){if(e)return">";let r="";if(t&&n){const{enable:s,disable:o}=t;r=(s?.ignoreCase?"i":"")+(s?.dotAll?"s":"")+(o?"-":"")+(o?.ignoreCase?"i":"")+(o?.dotAll?"s":"")}return`${r}:`}function kc({kind:e,max:t,min:n}){let r;return!n&&t===1?r="?":!n&&t===1/0?r="*":n===1&&t===1/0?r="+":n===t?r=`{${n}}`:r=`{${n},${t===1/0?"":t}}`,r+{greedy:"",lazy:"?",possessive:"+"}[e]}function _r({type:e}){return e==="CapturingGroup"||e==="Group"||e==="LookaroundAssertion"}function vc(e){return e>47&&e<58}function Sr({type:e,value:t}){return e==="Character"&&t===45}var xc=class mn extends RegExp{#t=new Map;#e=null;#r;#n=null;#s=null;rawOptions={};get source(){return this.#r||"(?:)"}constructor(t,n,r){const s=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw new Error("Cannot provide options when copying a regexp");const o=t;super(o,n),this.#r=o.source,o instanceof mn&&(this.#t=o.#t,this.#n=o.#n,this.#s=o.#s,this.rawOptions=o.rawOptions)}else{const o={hiddenCaptures:[],strategy:null,transfers:[],...r};super(s?"":t,n),this.#r=t,this.#t=Ic(o.hiddenCaptures,o.transfers),this.#s=o.strategy,this.rawOptions=r??{}}s||(this.#e=this)}exec(t){if(!this.#e){const{lazyCompile:s,...o}=this.rawOptions;this.#e=new mn(this.#r,this.flags,o)}const n=this.global||this.sticky,r=this.lastIndex;if(this.#s==="clip_search"&&n&&r){this.lastIndex=0;const s=this.#o(t.slice(r));return s&&(Ec(s,r,t,this.hasIndices),this.lastIndex+=r),s}return this.#o(t)}#o(t){this.#e.lastIndex=this.lastIndex;const n=super.exec.call(this.#e,t);if(this.lastIndex=this.#e.lastIndex,!n||!this.#t.size)return n;const r=[...n];n.length=1;let s;this.hasIndices&&(s=[...n.indices],n.indices.length=1);const o=[0];for(let i=1;i<r.length;i++){const{hidden:l,transferTo:a}=this.#t.get(i)??{};if(l?o.push(null):(o.push(n.length),n.push(r[i]),this.hasIndices&&n.indices.push(s[i])),a&&r[i]!==void 0){const c=o[a];if(!c)throw new Error(`Invalid capture transfer to "${c}"`);if(n[c]=r[i],this.hasIndices&&(n.indices[c]=s[i]),n.groups){this.#n||(this.#n=Ac(this.source));const u=this.#n.get(a);u&&(n.groups[u]=r[i],this.hasIndices&&(n.indices.groups[u]=s[i]))}}}return n}};function Ec(e,t,n,r){if(e.index+=t,e.input=n,r){const s=e.indices;for(let i=0;i<s.length;i++){const l=s[i];l&&(s[i]=[l[0]+t,l[1]+t])}const o=s.groups;o&&Object.keys(o).forEach(i=>{const l=o[i];l&&(o[i]=[l[0]+t,l[1]+t])})}}function Ic(e,t){const n=new Map;for(const r of e)n.set(r,{hidden:!0});for(const[r,s]of t)for(const o of s)Ue(n,o,{}).transferTo=r;return n}function Ac(e){const t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map;let r=0,s=0,o;for(;o=t.exec(e);){const{0:i,groups:{capture:l,name:a}}=o;i==="["?r++:r?i==="]"&&r--:l&&(s++,a&&n.set(s,a))}return n}function Rc(e,t){const n=Lc(e,t);return n.options?new xc(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function Lc(e,t){const n=Ms(t),r=Is(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:Rn}),s=rc(r,{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),o=pc(s,n),i=ql(o.pattern,{captureTransfers:o._captureTransfers,hiddenCaptures:o._hiddenCaptures,mode:"external"}),l=zl(i.pattern),a=Wl(l.pattern,{captureTransfers:i.captureTransfers,hiddenCaptures:i.hiddenCaptures}),c={pattern:a.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 u=a.hiddenCaptures.sort((p,b)=>p-b),f=Array.from(a.captureTransfers),h=s._strategy,d=c.pattern.length>=n.lazyCompileLength;(u.length||f.length||h||d)&&(c.options={...u.length&&{hiddenCaptures:u},...f.length&&{transfers:f},...h&&{strategy:h},...d&&{lazyCompile:d}})}return c}function Nc(e,t){return Rc(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function Tc(e={}){const t={target:"auto",cache:new Map,...e};return t.regexConstructor||=n=>Nc(n,{target:t.target}),{createScanner(n){return new Va(n,t)},createString(n){return{content:n}}}}var Nn=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Pc(){return 2147483648}function $c(){return typeof performance<"u"?performance.now():Date.now()}const Mc=(e,t)=>e+(t-e%t)%t;async function Oc(e){let t,n;const r={};function s(d){n=d,r.HEAPU8=new Uint8Array(d),r.HEAPU32=new Uint32Array(d)}function o(d,p,b){r.HEAPU8.copyWithin(d,p,p+b)}function i(d){try{return t.grow(d-n.byteLength+65535>>>16),s(t.buffer),1}catch{}}function l(d){const p=r.HEAPU8.length;d=d>>>0;const b=Pc();if(d>b)return!1;for(let w=1;w<=4;w*=2){let g=p*(1+.2/w);g=Math.min(g,d+100663296);const m=Math.min(b,Mc(Math.max(d,g),65536));if(i(m))return!0}return!1}const a=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function c(d,p,b=1024){const w=p+b;let g=p;for(;d[g]&&!(g>=w);)++g;if(g-p>16&&d.buffer&&a)return a.decode(d.subarray(p,g));let m="";for(;p<g;){let y=d[p++];if(!(y&128)){m+=String.fromCharCode(y);continue}const _=d[p++]&63;if((y&224)===192){m+=String.fromCharCode((y&31)<<6|_);continue}const S=d[p++]&63;if((y&240)===224?y=(y&15)<<12|_<<6|S:y=(y&7)<<18|_<<12|S<<6|d[p++]&63,y<65536)m+=String.fromCharCode(y);else{const k=y-65536;m+=String.fromCharCode(55296|k>>10,56320|k&1023)}}return m}function u(d,p){return d?c(r.HEAPU8,d,p):""}const f={emscripten_get_now:$c,emscripten_memcpy_big:o,emscripten_resize_heap:l,fd_write:()=>0};async function h(){const p=await e({env:f,wasi_snapshot_preview1:f});t=p.memory,s(t.buffer),Object.assign(r,p),r.UTF8ToString=u}return await h(),r}var Bc=Object.defineProperty,Dc=(e,t,n)=>t in e?Bc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,G=(e,t,n)=>Dc(e,typeof t!="symbol"?t+"":t,n);let U=null;function Gc(e){throw new Nn(e.UTF8ToString(e.getLastOnigError()))}class Et{constructor(t){G(this,"utf16Length"),G(this,"utf8Length"),G(this,"utf16Value"),G(this,"utf8Value"),G(this,"utf16OffsetToUtf8"),G(this,"utf8OffsetToUtf16");const n=t.length,r=Et._utf8ByteLength(t),s=r!==n,o=s?new Uint32Array(n+1):null;s&&(o[n]=r);const i=s?new Uint32Array(r+1):null;s&&(i[r]=n);const l=new Uint8Array(r);let a=0;for(let c=0;c<n;c++){const u=t.charCodeAt(c);let f=u,h=!1;if(u>=55296&&u<=56319&&c+1<n){const d=t.charCodeAt(c+1);d>=56320&&d<=57343&&(f=(u-55296<<10)+65536|d-56320,h=!0)}s&&(o[c]=a,h&&(o[c+1]=a),f<=127?i[a+0]=c:f<=2047?(i[a+0]=c,i[a+1]=c):f<=65535?(i[a+0]=c,i[a+1]=c,i[a+2]=c):(i[a+0]=c,i[a+1]=c,i[a+2]=c,i[a+3]=c)),f<=127?l[a++]=f:f<=2047?(l[a++]=192|(f&1984)>>>6,l[a++]=128|(f&63)>>>0):f<=65535?(l[a++]=224|(f&61440)>>>12,l[a++]=128|(f&4032)>>>6,l[a++]=128|(f&63)>>>0):(l[a++]=240|(f&1835008)>>>18,l[a++]=128|(f&258048)>>>12,l[a++]=128|(f&4032)>>>6,l[a++]=128|(f&63)>>>0),h&&c++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=l,this.utf16OffsetToUtf8=o,this.utf8OffsetToUtf16=i}static _utf8ByteLength(t){let n=0;for(let r=0,s=t.length;r<s;r++){const o=t.charCodeAt(r);let i=o,l=!1;if(o>=55296&&o<=56319&&r+1<s){const a=t.charCodeAt(r+1);a>=56320&&a<=57343&&(i=(o-55296<<10)+65536|a-56320,l=!0)}i<=127?n+=1:i<=2047?n+=2:i<=65535?n+=3:n+=4,l&&r++}return n}createString(t){const n=t.omalloc(this.utf8Length);return t.HEAPU8.set(this.utf8Value,n),n}}const It=class se{constructor(t){if(G(this,"id",++se.LAST_ID),G(this,"_onigBinding"),G(this,"content"),G(this,"utf16Length"),G(this,"utf8Length"),G(this,"utf16OffsetToUtf8"),G(this,"utf8OffsetToUtf16"),G(this,"ptr"),!U)throw new Nn("Must invoke loadWasm first.");this._onigBinding=U,this.content=t;const n=new Et(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!se._sharedPtrInUse?(se._sharedPtr||(se._sharedPtr=U.omalloc(1e4)),se._sharedPtrInUse=!0,U.HEAPU8.set(n.utf8Value,se._sharedPtr),this.ptr=se._sharedPtr):this.ptr=n.createString(U)}convertUtf8OffsetToUtf16(t){return this.utf8OffsetToUtf16?t<0?0:t>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[t]:t}convertUtf16OffsetToUtf8(t){return this.utf16OffsetToUtf8?t<0?0:t>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[t]:t}dispose(){this.ptr===se._sharedPtr?se._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};G(It,"LAST_ID",0);G(It,"_sharedPtr",0);G(It,"_sharedPtrInUse",!1);let Hs=It;class Fc{constructor(t){if(G(this,"_onigBinding"),G(this,"_ptr"),!U)throw new Nn("Must invoke loadWasm first.");const n=[],r=[];for(let l=0,a=t.length;l<a;l++){const c=new Et(t[l]);n[l]=c.createString(U),r[l]=c.utf8Length}const s=U.omalloc(4*t.length);U.HEAPU32.set(n,s/4);const o=U.omalloc(4*t.length);U.HEAPU32.set(r,o/4);const i=U.createOnigScanner(s,o,t.length);for(let l=0,a=t.length;l<a;l++)U.ofree(n[l]);U.ofree(o),U.ofree(s),i===0&&Gc(U),this._onigBinding=U,this._ptr=i}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(t,n,r){let s=0;if(typeof r=="number"&&(s=r),typeof t=="string"){t=new Hs(t);const o=this._findNextMatchSync(t,n,!1,s);return t.dispose(),o}return this._findNextMatchSync(t,n,!1,s)}_findNextMatchSync(t,n,r,s){const o=this._onigBinding,i=o.findNextOnigScannerMatch(this._ptr,t.id,t.ptr,t.utf8Length,t.convertUtf16OffsetToUtf8(n),s);if(i===0)return null;const l=o.HEAPU32;let a=i/4;const c=l[a++],u=l[a++],f=[];for(let h=0;h<u;h++){const d=t.convertUtf8OffsetToUtf16(l[a++]),p=t.convertUtf8OffsetToUtf16(l[a++]);f[h]={start:d,end:p,length:p-d}}return{index:c,captureIndices:f}}}function Uc(e){return typeof e.instantiator=="function"}function jc(e){return typeof e.default=="function"}function Wc(e){return typeof e.data<"u"}function zc(e){return typeof Response<"u"&&e instanceof Response}function Hc(e){return typeof ArrayBuffer<"u"&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<"u"&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<"u"&&e instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&e instanceof Uint32Array}let Qe;function qc(e){if(Qe)return Qe;async function t(){U=await Oc(async n=>{let r=e;return r=await r,typeof r=="function"&&(r=await r(n)),typeof r=="function"&&(r=await r(n)),Uc(r)?r=await r.instantiator(n):jc(r)?r=await r.default(n):(Wc(r)&&(r=r.data),zc(r)?typeof WebAssembly.instantiateStreaming=="function"?r=await Vc(r)(n):r=await Xc(r)(n):Hc(r)?r=await zt(r)(n):r instanceof WebAssembly.Module?r=await zt(r)(n):"default"in r&&r.default instanceof WebAssembly.Module&&(r=await zt(r.default)(n))),"instance"in r&&(r=r.instance),"exports"in r&&(r=r.exports),r})}return Qe=t(),Qe}function zt(e){return t=>WebAssembly.instantiate(e,t)}function Vc(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Xc(e){return async t=>{const n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}async function Kc(e){return e&&await qc(e),{createScanner(t){return new Fc(t.map(n=>typeof n=="string"?n:n.source))},createString(t){return new Hs(t)}}}function Zc(e){return e!==null&&typeof e=="object"&&"default"in e?e.default:e}var Qc=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name="DuplicateThemeError"}},Yc=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name="UnregisteredThemeError"}},Jc=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name="UnresolvedThemeError"}};function eu(){const e=new Map,t=new Map,n=new Map;let r=0;function s(g,m){if(e.has(g))throw new Qc(g);e.set(g,m)}function o(g,m){return e.has(g)?!1:(e.set(g,m),!0)}function i(g){return e.has(g)}function l(g){const m=t.get(g);if(m!==void 0)return Promise.resolve(m);const y=n.get(g);if(y!==void 0)return y;const _=e.get(g);if(_===void 0)return Promise.reject(new Yc(g));const S=r,k=_().then(v=>{const A=Zc(v);return S===r&&t.set(g,A),n.get(g)===k&&n.delete(g),A}).catch(v=>{throw n.get(g)===k&&n.delete(g),v});return n.set(g,k),k}function a(g){return Promise.all(g.map(m=>l(m)))}function c(g,m){t.set(g,m)}function u(g){for(const[m,y]of g)c(m,y)}function f(g){return t.get(g)}function h(g){const m=[];for(const y of g){const _=t.get(y);if(_===void 0)throw new Jc(y);m.push(_)}return m}function d(g){return t.has(g)}function p(g){for(const m of g)if(!t.has(m))return!1;return!0}function b(g){const m=t.get(g);return m!==void 0?m:l(g)}function w(){r++,t.clear(),n.clear()}return{clearResolvedThemes:w,getResolvedOrResolveTheme:b,getResolvedTheme:f,getResolvedThemes:h,hasRegisteredTheme:i,hasResolvedTheme:d,hasResolvedThemes:p,registerTheme:s,registerThemeIfAbsent:o,resolveTheme:l,resolveThemes:a,seedResolvedTheme:c,seedResolvedThemes:u}}class qs{diff(t,n,r={}){let s;typeof r=="function"?(s=r,r={}):"callback"in r&&(s=r.callback);const o=this.castInput(t,r),i=this.castInput(n,r),l=this.removeEmpty(this.tokenize(o,r)),a=this.removeEmpty(this.tokenize(i,r));return this.diffWithOptionsObj(l,a,r,s)}diffWithOptionsObj(t,n,r,s){var o;const i=m=>{if(m=this.postProcess(m,r),s){setTimeout(function(){s(m)},0);return}else return m},l=n.length,a=t.length;let c=1,u=l+a;r.maxEditLength!=null&&(u=Math.min(u,r.maxEditLength));const f=(o=r.timeout)!==null&&o!==void 0?o:1/0,h=Date.now()+f,d=[{oldPos:-1,lastComponent:void 0}];let p=this.extractCommon(d[0],n,t,0,r);if(d[0].oldPos+1>=a&&p+1>=l)return i(this.buildValues(d[0].lastComponent,n,t));let b=-1/0,w=1/0;const g=()=>{for(let m=Math.max(b,-c);m<=Math.min(w,c);m+=2){let y;const _=d[m-1],S=d[m+1];_&&(d[m-1]=void 0);let k=!1;if(S){const A=S.oldPos-m;k=S&&0<=A&&A<l}const v=_&&_.oldPos+1<a;if(!k&&!v){d[m]=void 0;continue}if(!v||k&&_.oldPos<S.oldPos?y=this.addToPath(S,!0,!1,0,r):y=this.addToPath(_,!1,!0,1,r),p=this.extractCommon(y,n,t,m,r),y.oldPos+1>=a&&p+1>=l)return i(this.buildValues(y.lastComponent,n,t))||!0;d[m]=y,y.oldPos+1>=a&&(w=Math.min(w,m-1)),p+1>=l&&(b=Math.max(b,m+1))}c++};if(s)(function m(){setTimeout(function(){if(c>u||Date.now()>h)return s(void 0);g()||m()},0)})();else for(;c<=u&&Date.now()<=h;){const m=g();if(m)return m}}addToPath(t,n,r,s,o){const i=t.lastComponent;return i&&!o.oneChangePerToken&&i.added===n&&i.removed===r?{oldPos:t.oldPos+s,lastComponent:{count:i.count+1,added:n,removed:r,previousComponent:i.previousComponent}}:{oldPos:t.oldPos+s,lastComponent:{count:1,added:n,removed:r,previousComponent:i}}}extractCommon(t,n,r,s,o){const i=n.length,l=r.length;let a=t.oldPos,c=a-s,u=0;for(;c+1<i&&a+1<l&&this.equals(r[a+1],n[c+1],o);)c++,a++,u++,o.oneChangePerToken&&(t.lastComponent={count:1,previousComponent:t.lastComponent,added:!1,removed:!1});return u&&!o.oneChangePerToken&&(t.lastComponent={count:u,previousComponent:t.lastComponent,added:!1,removed:!1}),t.oldPos=a,c}equals(t,n,r){return r.comparator?r.comparator(t,n):t===n||!!r.ignoreCase&&t.toLowerCase()===n.toLowerCase()}removeEmpty(t){const n=[];for(let r=0;r<t.length;r++)t[r]&&n.push(t[r]);return n}castInput(t,n){return t}tokenize(t,n){return Array.from(t)}join(t){return t.join("")}postProcess(t,n){return t}get useLongestToken(){return!1}buildValues(t,n,r){const s=[];let o;for(;t;)s.push(t),o=t.previousComponent,delete t.previousComponent,t=o;s.reverse();const i=s.length;let l=0,a=0,c=0;for(;l<i;l++){const u=s[l];if(u.removed)u.value=this.join(r.slice(c,c+u.count)),c+=u.count;else{if(!u.added&&this.useLongestToken){let f=n.slice(a,a+u.count);f=f.map(function(h,d){const p=r[c+d];return p.length>h.length?p:h}),u.value=this.join(f)}else u.value=this.join(n.slice(a,a+u.count));a+=u.count,u.added||(c+=u.count)}}return s}}class tu extends qs{}const nu=new tu;function ru(e,t,n){return nu.diff(e,t,n)}const kr="a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}";class su extends qs{tokenize(t){const n=new RegExp(`(\\r?\\n)|[${kr}]+|[^\\S\\n\\r]+|[^${kr}]`,"ug");return t.match(n)||[]}}const ou=new su;function iu(e,t,n){return ou.diff(e,t,n)}function au(e={}){const{classPrefix:t="__shiki_",classSuffix:n="",classReplacer:r=l=>l}=e,s=new Map;function o(l){return Object.entries(l).map(([a,c])=>`${a}:${c}`).join(";")}function i(l){let a=t+lu(typeof l=="string"?l:o(l))+n;return a=r(a),s.has(a)||s.set(a,typeof l=="string"?l:{...l}),a}return{name:"@shikijs/transformers:style-to-class",pre(l){if(!l.properties.style)return;const a=i(l.properties.style);delete l.properties.style,this.addClassToHast(l,a)},tokens(l){for(const a of l)for(const c of a){if(!c.htmlStyle)continue;const u=i(c.htmlStyle);c.htmlStyle={},c.htmlAttrs||={},c.htmlAttrs.class?c.htmlAttrs.class+=` ${u}`:c.htmlAttrs.class=u}},getClassRegistry(){return s},getCSS(){let l="";for(const[a,c]of s.entries())l+=`.${a}{${typeof c=="string"?c:o(c)}}`;return l},clearRegistry(){s.clear()}}}function lu(e,t=0){let n=3735928559^t,r=1103547991^t;for(let s=0,o;s<e.length;s++)o=e.charCodeAt(s),n=Math.imul(n^o,2654435761),r=Math.imul(r^o,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}const cu=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,uu=/^0(?:\.0+)?%?$/;function fu(e){const t=e.indexOf("(");if(t<=0||!e.endsWith(")"))return;const n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;const r=e.slice(t+1,-1).trim();if(r.length===0)return;const s=r.lastIndexOf("/");if(s!==-1)return r.slice(s+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){const o=r.split(",");if(o.length===4)return o[3]?.trim()}}function hu(e){const t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;const n=t[1];let r,s=1;return n.length===3?r=n.split("").map(o=>o+o).join(""):n.length===6?r=n:(r=n.slice(0,6),s=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),s]}function Ht(e){if(e==null)return null;const t=hu(e);if(t==null)return null;const n=t[0]/255,r=t[1]/255,s=t[2]/255,o=i=>i<=.03928?i/12.92:((i+.055)/1.055)**2.4;return .2126*o(n)+.7152*o(r)+.0722*o(s)}function vr(e){if(e==null)return!1;const t=e.trim().toLowerCase();if(t==="transparent"||cu.test(t))return!0;const n=fu(t);return n!=null&&uu.test(n)}function du(e,t,n){if(t==null||n==null)return!1;const r=Ht(e),s=Ht(t),o=Ht(n);return r==null||s==null||o==null?!1:Math.abs(r-o)<Math.abs(r-s)}const xr=new WeakMap;function qt(e){const t=xr.get(e);if(t!=null)return t;const n=e.colors??{},r={...n},s=n["editor.background"]??e.bg,o=n["editor.foreground"]??e.fg,i=n["sideBar.background"]??s,l=n["sideBar.foreground"]??o;ne(r,"editor.background",s),ne(r,"editor.foreground",o),ne(r,"sideBar.background",i),ne(r,"sideBar.foreground",l),ne(r,"input.background",n["input.background"]??i),ne(r,"sideBarSectionHeader.foreground",n["sideBarSectionHeader.foreground"]??l),ne(r,"list.activeSelectionForeground",n["list.activeSelectionForeground"]??l),ne(r,"gitDecoration.addedResourceForeground",Vt(n["gitDecoration.addedResourceForeground"],n["terminal.ansiGreen"],n["editorGutter.addedBackground"])),ne(r,"gitDecoration.modifiedResourceForeground",Vt(n["gitDecoration.modifiedResourceForeground"],n["terminal.ansiBlue"],n["editorGutter.modifiedBackground"])),ne(r,"gitDecoration.deletedResourceForeground",Vt(n["gitDecoration.deletedResourceForeground"],n["terminal.ansiRed"],n["editorGutter.deletedBackground"]));const a=(vr(n["list.focusOutline"])?void 0:n["list.focusOutline"])??(vr(n.focusBorder)?void 0:n.focusBorder);a!=null?r["list.focusOutline"]=a:delete r["list.focusOutline"];const c=n["list.hoverBackground"];c!=null&&(pu(c,i)||du(c,i,l))&&delete r["list.hoverBackground"];const u=Object.freeze({...e,colors:Object.freeze(r)});return xr.set(e,u),u}function ne(e,t,n){n!=null&&n!==""&&(e[t]=n)}function Vt(...e){for(const t of e)if(t!=null&&t!=="")return t}function pu(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}(()=>{try{return!1}catch{return!1}})();const At={dark:"pierre-dark",light:"pierre-light"},Er=new Map,Ir=new Set;function Tn(e,t){e=Array.isArray(e)?e:[e];for(const n of e){if(Ir.has(n.name))continue;let r=Er.get(n.name);r==null&&(r=n,Er.set(n.name,r)),Ir.add(r.name),t.loadLanguageSync(r.data)}}const Ar=new Set,Xt=eu();function Vs(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let r;if(typeof n=="string"){if(r=Xt.getResolvedTheme(n),r==null)throw new Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else r=n,n=n.name,Xt.getResolvedTheme(n)==null&&Xt.seedResolvedTheme(n,r);Ar.has(n)||(Ar.add(n),t.loadThemeSync(r))}}const ue=new Map;let Rr=0;const Pe={"1c":"1c",abap:"abap",as:"actionscript-3",ada:"ada",adb:"ada",ads:"ada",adoc:"asciidoc",asciidoc:"asciidoc","component.html":"angular-html","component.ts":"angular-ts",conf:"nginx",htaccess:"apache",cls:"tex",trigger:"apex",apl:"apl",applescript:"applescript",scpt:"applescript",ara:"ara",asm:"asm",s:"riscv",astro:"astro",awk:"awk",bal:"ballerina",sh:"zsh",bash:"zsh",bat:"cmd",cmd:"cmd",be:"berry",beancount:"beancount",bib:"bibtex",bicep:"bicep","blade.php":"blade",bsl:"bsl",c:"c",h:"objective-cpp",cs:"csharp",cpp:"cpp",hpp:"cpp",cc:"cpp",cxx:"cpp",hh:"cpp",cdc:"cdc",cairo:"cairo",clar:"clarity",clj:"clojure",cljs:"clojure",cljc:"clojure",soy:"soy",cmake:"cmake","CMakeLists.txt":"cmake",cob:"cobol",cbl:"cobol",cobol:"cobol",CODEOWNERS:"codeowners",ql:"ql",coffee:"coffeescript",lisp:"lisp",cl:"lisp",lsp:"lisp",log:"log",v:"verilog",cql:"cql",cr:"crystal",css:"css",csv:"csv",cue:"cue",cypher:"cypher",cyp:"cypher",d:"d",dart:"dart",dax:"dax",desktop:"desktop",diff:"diff",patch:"diff",Dockerfile:"dockerfile",dockerfile:"dockerfile",env:"dotenv",dm:"dream-maker",edge:"edge",el:"emacs-lisp",ex:"elixir",exs:"elixir",elm:"elm",erb:"erb",erl:"erlang",hrl:"erlang",f:"fortran-fixed-form",for:"fortran-fixed-form",fs:"fsharp",fsi:"fsharp",fsx:"fsharp",f03:"f03",f08:"f08",f18:"f18",f77:"f77",f90:"fortran-free-form",f95:"fortran-free-form",fnl:"fennel",fish:"fish",ftl:"ftl",tres:"gdresource",res:"gdresource",gd:"gdscript",gdshader:"gdshader",gs:"genie",feature:"gherkin",COMMIT_EDITMSG:"git-commit","git-rebase-todo":"git-rebase",gjs:"glimmer-js",gleam:"gleam",gts:"glimmer-ts",glsl:"glsl",vert:"glsl",frag:"glsl",shader:"shaderlab",gp:"gnuplot",plt:"gnuplot",gnuplot:"gnuplot",go:"go",graphql:"graphql",gql:"graphql",groovy:"groovy",gvy:"groovy",hack:"hack",haml:"haml",hbs:"handlebars",handlebars:"handlebars",hs:"haskell",lhs:"haskell",hx:"haxe",hcl:"hcl",hjson:"hjson",hlsl:"hlsl",fx:"hlsl",html:"html",htm:"html",http:"http",rest:"http",hxml:"hxml",hy:"hy",imba:"imba",ini:"ini",cfg:"ini",jade:"pug",pug:"pug",java:"java",js:"javascript",mjs:"javascript",cjs:"javascript",jinja:"jinja",jinja2:"jinja",j2:"jinja",jison:"jison",jl:"julia",json:"json",json5:"json5",jsonc:"jsonc",jsonl:"jsonl",jsonnet:"jsonnet",libsonnet:"jsonnet",jssm:"jssm",jsx:"jsx",kt:"kotlin",kts:"kts",kql:"kusto",tex:"tex",ltx:"tex",lean:"lean4",less:"less",liquid:"liquid",lit:"lit",ll:"llvm",logo:"logo",lua:"lua",luau:"luau",Makefile:"makefile",mk:"makefile",makefile:"makefile",md:"markdown",markdown:"markdown",marko:"marko",m:"wolfram",mat:"matlab",mdc:"mdc",mdx:"mdx",wiki:"wikitext",mediawiki:"wikitext",mmd:"mermaid",mermaid:"mermaid",mips:"mipsasm",mojo:"mojo","🔥":"mojo",move:"move",nar:"narrat",nf:"nextflow",nim:"nim",nims:"nim",nimble:"nim",nix:"nix",nu:"nushell",mm:"objective-cpp",ml:"ocaml",mli:"ocaml",mll:"ocaml",mly:"ocaml",pas:"pascal",p:"pascal",pl:"prolog",pm:"perl",t:"perl",raku:"raku",p6:"raku",pl6:"raku",php:"php",phtml:"php",pls:"plsql",sql:"sql",po:"po",polar:"polar",pcss:"postcss",pot:"pot",potx:"potx",pq:"powerquery",pqm:"powerquery",ps1:"powershell",psm1:"powershell",psd1:"powershell",prisma:"prisma",pro:"prolog",P:"prolog",properties:"properties",proto:"protobuf",pp:"puppet",purs:"purescript",py:"python",pyw:"python",pyi:"python",qml:"qml",qmldir:"qmldir",qss:"qss",r:"r",R:"r",rkt:"racket",rktl:"racket",razor:"razor",cshtml:"razor",rb:"ruby",rbw:"ruby",reg:"reg",regex:"regexp",rel:"rel",rs:"rust",rst:"rst",rake:"ruby",gemspec:"ruby",jbuilder:"ruby",builder:"ruby",rabl:"ruby",arb:"ruby",ru:"ruby",podspec:"ruby",Gemfile:"ruby",Rakefile:"ruby",Guardfile:"ruby",Capfile:"ruby",Berksfile:"ruby",Brewfile:"ruby",Vagrantfile:"ruby",Thorfile:"ruby",Appraisals:"ruby",Dangerfile:"ruby",sas:"sas",sass:"sass",scala:"scala",sc:"scala",scm:"scheme",ss:"scheme",sld:"scheme",scss:"scss",sdbl:"sdbl",shadergraph:"shader",st:"smalltalk",sol:"solidity",sparql:"sparql",rq:"sparql",spl:"splunk",config:"ssh-config",do:"stata",ado:"stata",dta:"stata",styl:"stylus",stylus:"stylus",svelte:"svelte",swift:"swift",sv:"system-verilog",svh:"system-verilog",service:"systemd",socket:"systemd",device:"systemd",timer:"systemd",talon:"talonscript",tasl:"tasl",tcl:"tcl",templ:"templ",tf:"tf",tfvars:"tfvars",toml:"toml",ts:"typescript",mts:"typescript",cts:"typescript",tsp:"typespec",tsv:"tsv",tsx:"tsx",ttl:"turtle",twig:"twig",typ:"typst",vv:"v",vala:"vala",vapi:"vala",vb:"vb",vbs:"vb",bas:"vb",vh:"verilog",vhd:"vhdl",vhdl:"vhdl",vim:"vimscript",vue:"vue","vine.ts":"vue-vine",vy:"vyper",wasm:"wasm",wat:"wasm",wy:"文言",wgsl:"wgsl",wit:"wit",wl:"wolfram",nb:"wolfram",xml:"xml",xsl:"xsl",xslt:"xsl",yaml:"yaml",yml:"yml",zs:"zenscript",zig:"zig",zsh:"zsh",sty:"tex"};function yn(e){if(ue.has(e))return ue.get(e)??"text";if(Pe[e]!=null)return Pe[e];const t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(ue.has(t[1]))return ue.get(t[1])??"text";if(Pe[t[1]]!=null)return Pe[t[1]]??"text"}const n=e.match(/\.([^.]+)$/)?.[1]??"";return ue.has(n)?ue.get(n)??"text":Pe[n]??"text"}function gu(e,t){if(e<=Rr)return!1;ue.clear();for(const n in t){const r=t[n];r!=null&&ue.set(n,r)}return Rr=e,!0}function mt(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}function mu(e){return{type:"text",value:e}}function yu({tagName:e,children:t=[],properties:n={}}){return{type:"element",tagName:e,properties:n,children:t}}function bu(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t;"children"in t?t=t.children[0]:t=null}}function wu(e,t,n){const r=typeof n.lineInfo=="function"?n.lineInfo(t):n.lineInfo[t-1];if(r==null){const s=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(s,{node:e,line:t,state:n}),new Error(s)}return e.tagName="div",e.properties["data-line"]=r.lineNumber,e.properties["data-alt-line"]=r.altLineNumber,e.properties["data-line-type"]=r.type,e.properties["data-line-index"]=r.lineIndex,e.children.length===0&&e.children.push(mu(`
|
|
153
|
+
`)),e}const Ye=Symbol("no-token"),Kt=Symbol("multiple-tokens");function Xs(e){const t=Cu(e);if(t!=null)return t;let n=Ye;const r=[];let s=[],o;const i=()=>{if(s.length===0||o==null){s=[],o=void 0;return}if(s.length===1){const a=s[0];if(a?.type==="element"){_u(a,o);for(const c of a.children)st(c)}else st(a);r.push(a),s=[],o=void 0;return}for(const a of s)st(a);r.push(yu({tagName:"span",properties:{"data-char":o},children:s})),s=[],o=void 0},l=a=>{if(a!==Ye){if(a===Kt){n=Kt;return}if(n===Ye){n=a;return}n!==a&&(n=Kt)}};for(const a of e.children){const c=a.type==="element"?Xs(a):Ye;if(l(c),typeof c!="number"){i(),r.push(a);continue}o!=null&&o!==c&&i(),o??=c,s.push(a)}return i(),e.children=r,n}function Cu(e){const t=e.properties["data-char"];if(typeof t=="number")return t}function st(e){if(e.type==="element"){e.properties["data-char"]=void 0;for(const t of e.children)st(t)}}function _u(e,t){e.properties["data-char"]=t}function Ks(e=!1,t=!1){const n={lineInfo:[]},r=[{line(s){return delete s.properties.class,s},pre(s){const o=bu(s),i=[];if(o!=null){let l=1;for(const a of o.children)a.type==="element"&&(e&&Xs(a),i.push(wu(a,l,n)),l++);o.children=i}return s},...e?{tokens(s){for(const o of s){let i=0;for(const l of o){const a=l;a.__lineChar??=i,i+=l.content.length}}},preprocess(s,o){o.mergeWhitespaces="never"},span(s,o,i,l,a){if(a?.offset!=null&&a.content!=null){const c=a.__lineChar;return c!=null&&(s.properties["data-char"]=c),s}return s}}:null}];return t&&r.push(Su,Lr),e&&r.push({line:s=>(s.type==="element"&&s.children.length===0&&s.children.push({type:"element",tagName:"br",properties:{},children:[]}),s)}),{state:n,transformers:r,toClass:Lr}}const Lr=au({classPrefix:"hl-"}),Su={name:"token-style-normalizer",tokens(e){for(const t of e)for(const n of t){if(n.htmlStyle!=null)continue;const r={};n.color!=null&&(r.color=n.color),n.bgColor!=null&&(r["background-color"]=n.bgColor),n.fontStyle!=null&&n.fontStyle!==0&&((n.fontStyle&1)!==0&&(r["font-style"]="italic"),(n.fontStyle&2)!==0&&(r["font-weight"]="bold"),(n.fontStyle&4)!==0&&(r["text-decoration"]="underline")),Object.keys(r).length>0&&(n.htmlStyle=r)}}};function Z(e){return`--${e==="token"?"diffs-token":"diffs"}-`}function Zs({theme:e=At,highlighter:t,prefix:n}){let r="";if(typeof e=="string"){const s=t.getTheme(e),o=qt(s);r+=`color:${o.fg};`,r+=`background-color:${o.bg};`,r+=`${Z("global")}fg:${o.fg};`,r+=`${Z("global")}bg:${o.bg};`,r+=Zt(s,n)}else{let s=t.getTheme(e.dark),o=qt(s);r+=`${Z("global")}dark:${o.fg};`,r+=`${Z("global")}dark-bg:${o.bg};`,r+=Zt(s,"dark"),s=t.getTheme(e.light),o=qt(s),r+=`${Z("global")}light:${o.fg};`,r+=`${Z("global")}light-bg:${o.bg};`,r+=Zt(s,"light")}return r}function Zt(e,t){t=t!=null?`${t}-`:"";let n="";const r=e.colors?.["gitDecoration.addedResourceForeground"]??e.colors?.["terminal.ansiGreen"];r!=null&&(n+=`${Z("global")}${t}addition-color:${r};`);const s=e.colors?.["gitDecoration.deletedResourceForeground"]??e.colors?.["terminal.ansiRed"];s!=null&&(n+=`${Z("global")}${t}deletion-color:${s};`);const o=e.colors?.["gitDecoration.modifiedResourceForeground"]??e.colors?.["terminal.ansiBlue"];return o!=null&&(n+=`${Z("global")}${t}modified-color:${o};`),n}function bn(e){let t=e.children[0];for(;t!=null;){if(t.type==="element"&&t.tagName==="code")return t.children;"children"in t?t=t.children[0]:t=null}throw console.error(e),new Error("getLineNodes: Unable to find children")}function wn(e,t){return e-(t===0?0:1)}function Nr(e,t){return wn(e,t)+t}function ku({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:s}){const o=Math.max(t,0);if(o===0||e)return{fromStart:0,fromEnd:0,rangeSize:o,collapsedLines:o,renderAll:!1};if(n===!0||o<=s)return{fromStart:o,fromEnd:0,rangeSize:o,collapsedLines:0,renderAll:!0};const i=n?.get(r),l=Math.min(Math.max(i?.fromStart??0,0),o),a=Math.min(Math.max(i?.fromEnd??0,0),o),c=l+a,u=c>=o;return{fromStart:u?o:l,fromEnd:u?0:a,rangeSize:o,collapsedLines:Math.max(o-c,0),renderAll:u}}function vu({fileDiff:e,errorPrefix:t}){const n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;const r=e.additionLines.length-Nr(n.additionStart,n.additionCount),s=e.deletionLines.length-Nr(n.deletionStart,n.deletionCount);if(r<=0&&s<=0)return 0;if(r!==s)throw new Error(`${t}: trailing context mismatch (additions=${r}, deletions=${s}) for ${e.name}`);return Math.min(r,s)}function xu({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:s}){if(t!==e.hunks.length-1)return;const o=vu({fileDiff:e,errorPrefix:s});if(o<=0)return;if(n===!0||o<=r)return{fromStart:o,fromEnd:0,rangeSize:o,collapsedLines:0,renderAll:!0};const i=n?.get(e.hunks.length),l=Math.min(Math.max(i?.fromStart??0,0),o);return{fromStart:l,fromEnd:0,rangeSize:o,collapsedLines:o-l,renderAll:l>=o}}function Eu({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:s,collapsedContextThreshold:o=1,callback:i}){const l=Iu({diff:e,diffStyle:t,startingLine:n,expandedHunks:s,collapsedContextThreshold:o}),a={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:l.splitCount,unifiedCount:l.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!a.isWindowedHighlight)return!1;const c=a.unifiedCount>=n+r,u=a.splitCount>=n+r;return c&&u},shouldSkip(c,u){if(!a.isWindowedHighlight)return!1;const f=c>0&&a.unifiedCount+c<=n,h=u>0&&a.splitCount+u<=n;return f&&h},incrementCounts(c,u){a.unifiedCount+=c,a.splitCount+=u},isInWindow(c,u){if(!a.isWindowedHighlight)return!0;const f=a.isInUnifiedWindow(c),h=a.isInSplitWindow(u);return f||h},isInUnifiedWindow(c){return!a.isWindowedHighlight||a.unifiedCount>=n-c&&a.unifiedCount<n+r},isInSplitWindow(c){return!a.isWindowedHighlight||a.splitCount>=n-c&&a.splitCount<n+r},emit(c,u=!1){return u||a.incrementCounts(1,1),i(c)??!1}};e:for(let c=l.hunkIndex;c<e.hunks.length;c++){let u=function(E,q){return m==null||m.collapsedLines<=0||m.fromStart+m.fromEnd>0?0:q===h.splitLineStart+h.splitLineCount-1?m.collapsedLines:0},f=function(){return _?0:(_=!0,g.collapsedLines)};const h=e.hunks[c];if(h==null)throw new Error("iterateOverDiff: invalid hunk index");if(a.shouldBreak())break;const d=wn(h.deletionStart,h.deletionCount),p=wn(h.additionStart,h.additionCount),b=!e.isPartial&&h.deletionCount===0?d:h.deletionLineIndex,w=!e.isPartial&&h.additionCount===0?p:h.additionLineIndex,g=ku({isPartial:e.isPartial,rangeSize:h.collapsedBefore,expandedHunks:s,hunkIndex:c,collapsedContextThreshold:o}),m=c===a.finalHunkIndex?xu({fileDiff:e,hunkIndex:c,expandedHunks:s,collapsedContextThreshold:o,errorPrefix:"iterateOverDiff"}):void 0,y=g.fromStart+g.fromEnd;let _=g.collapsedLines===0;if(a.shouldSkip(y,y))a.incrementCounts(y,y),f();else{let E=h.unifiedLineStart-g.rangeSize,q=h.splitLineStart-g.rangeSize,$=b-g.rangeSize,T=w-g.rangeSize,L=d+1-g.rangeSize,V=p+1-g.rangeSize;if(Je(a,g.fromStart,t,B=>a.emit({hunkIndex:c,hunk:h,collapsedBefore:0,collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:L+B,lineIndex:$+B,noEOFCR:!1,unifiedLineIndex:E+B,splitLineIndex:q+B},additionLine:{unifiedLineIndex:E+B,splitLineIndex:q+B,lineIndex:T+B,lineNumber:V+B,noEOFCR:!1}}))||(E=h.unifiedLineStart-g.fromEnd,q=h.splitLineStart-g.fromEnd,$=b-g.fromEnd,T=w-g.fromEnd,L=d+1-g.fromEnd,V=p+1-g.fromEnd,Je(a,g.fromEnd,t,B=>a.emit({hunkIndex:c,hunk:h,collapsedBefore:f(),collapsedAfter:0,type:"context-expanded",deletionLine:{lineNumber:L+B,lineIndex:$+B,noEOFCR:!1,unifiedLineIndex:E+B,splitLineIndex:q+B},additionLine:{unifiedLineIndex:E+B,splitLineIndex:q+B,lineIndex:T+B,lineNumber:V+B,noEOFCR:!1}}),()=>{f()})))break e}let S=h.unifiedLineStart,k=h.splitLineStart,v=b,A=w,R=d+1,H=p+1;const Le=h.hunkContent.at(-1);for(const E of h.hunkContent){if(a.shouldBreak())break e;const q=E===Le;if(E.type==="context"){if(a.shouldSkip(E.lines,E.lines))a.incrementCounts(E.lines,E.lines),f();else if(Je(a,E.lines,t,$=>{const T=q&&$===E.lines-1,L=S+$,V=k+$;return a.emit({hunkIndex:c,hunk:h,collapsedBefore:f(),collapsedAfter:u(L,V),type:"context",deletionLine:{lineNumber:R+$,lineIndex:v+$,noEOFCR:T&&h.noEOFCRDeletions,unifiedLineIndex:L,splitLineIndex:V},additionLine:{unifiedLineIndex:L,splitLineIndex:V,lineIndex:A+$,lineNumber:H+$,noEOFCR:T&&h.noEOFCRAdditions}})},()=>{f()}))break e;S+=E.lines,k+=E.lines,v+=E.lines,A+=E.lines,R+=E.lines,H+=E.lines}else{const $=Math.max(E.deletions,E.additions),T=E.deletions+E.additions;if(!a.shouldSkip(T,$)){const L=Ru(a,E);(L[0]?.[0]??0)>0&&f();for(const[V,B]of L)for(let Ne=V;Ne<B;Ne++){const Qs=u(S+Ne,k+Ne);if(a.emit(Lu({hunkIndex:c,hunk:h,collapsedBefore:f(),collapsedAfter:Qs,diffStyle:t,index:Ne,unifiedLineIndex:S,splitLineIndex:k,additionLineIndex:A,deletionLineIndex:v,additionLineNumber:H,deletionLineNumber:R,content:E,isLastContent:q,unifiedCount:T,splitCount:$}),!0))break e}}f(),a.incrementCounts(T,$),S+=T,k+=$,v+=E.deletions,A+=E.additions,R+=E.deletions,H+=E.additions}}if(m!=null){const{collapsedLines:E,fromStart:q,fromEnd:$}=m,T=q+$;if(Je(a,T,t,L=>{const V=L===T-1;return a.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:V?E:0,type:"context-expanded",deletionLine:{lineNumber:R+L,lineIndex:v+L,noEOFCR:!1,unifiedLineIndex:S+L,splitLineIndex:k+L},additionLine:{unifiedLineIndex:S+L,splitLineIndex:k+L,lineIndex:A+L,lineNumber:H+L,noEOFCR:!1}})},void 0,()=>a.shouldBreak()))break e}}}function Iu({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:s}){return{hunkIndex:0,splitCount:0,unifiedCount:0}}function Au(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];const r=[];function s(l){const a=Math.max(0,e.viewportStart-l),c=Math.min(t,e.viewportEnd-l);c>a&&r.push([a,c])}if(s(e.unifiedCount),s(e.splitCount),r.length===0)return[0,0];let o=r[0][0],i=r[0][1];for(let l=1;l<r.length;l++){const a=r[l];o=Math.min(o,a[0]),i=Math.max(i,a[1])}return[o,i]}function Je(e,t,n,r,s,o){const[i,l]=Au(e,t);i>0&&(e.incrementCounts(i,i),s?.());let a=i;for(;a<t;){if(o?.()===!0)return!0;if(a>=l){e.incrementCounts(t-a,t-a);break}if(e.isInWindow(0,0)){if(r(a)===!0)return!0}else e.incrementCounts(1,1);a++}return!1}function Ru(e,t,n){if(!e.isWindowedHighlight)return[[0,Math.max(t.deletions,t.additions)]];const r=[];function s(a,c){if(a+c<=e.viewportStart||a>=e.viewportEnd)return;const u=Math.max(0,e.viewportStart-a),f=Math.min(c,e.viewportEnd-a);return f>u?[u,f]:void 0}function o(a,c){return a}function i(a,c){if(a==null)return;const[u,f]=o(a);f>u&&r.push([u,f])}if(i(s(e.unifiedCount,t.deletions)),i(s(e.unifiedCount+t.deletions,t.additions)),i(s(e.splitCount,t.deletions)),i(s(e.splitCount,t.additions)),r.length===0)return r;r.sort((a,c)=>a[0]-c[0]);const l=[r[0]];for(const[a,c]of r.slice(1)){const u=l[l.length-1];a<=u[1]?u[1]=Math.max(u[1],c):l.push([a,c])}return l}function Lu({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:s,index:o,unifiedLineIndex:i,splitLineIndex:l,additionLineIndex:a,deletionLineIndex:c,additionLineNumber:u,deletionLineNumber:f,content:h,isLastContent:d,unifiedCount:p,splitCount:b}){const w=o<h.deletions?i+o:void 0,g=s==="unified"?o>=h.deletions?i+o:void 0:o<h.additions?i+h.deletions+o:void 0,m=s==="unified"?l+(o<h.deletions?o:o-h.deletions):l+o,y=o<h.deletions?c+o:void 0,_=o<h.deletions?f+o:void 0,S=s==="unified"?o>=h.deletions?a+(o-h.deletions):void 0:o<h.additions?a+o:void 0,k=s==="unified"?o>=h.deletions?u+(o-h.deletions):void 0:o<h.additions?u+o:void 0,v=s==="unified"?d&&o===h.deletions-1&&t.noEOFCRDeletions:d&&o===b-1&&t.noEOFCRDeletions,A=s==="unified"?d&&o===p-1&&t.noEOFCRAdditions:d&&o===b-1&&t.noEOFCRAdditions,R=y!=null&&_!=null&&w!=null?{lineNumber:_,lineIndex:y,noEOFCR:v,unifiedLineIndex:w,splitLineIndex:m}:void 0,H=S!=null&&k!=null&&g!=null?{unifiedLineIndex:g,splitLineIndex:m,lineIndex:S,lineNumber:k,noEOFCR:A}:void 0;if(R==null&&H!=null)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:H};if(R!=null&&H==null)return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:R,additionLine:void 0};if(R==null||H==null)throw new Error("iterateOverDiff: missing change line data");return{type:"change",hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:R,additionLine:H}}function Tr({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":""},alwaysWrap:!0}}function et({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:s=!1}){const o=t[t.length-1];if(o==null||s||!n){t.push([r?0:1,e.value]);return}const i=o[0]===0;if(r===i||r&&e.value.length===1&&!i){o[1]+=e.value;return}t.push([r?0:1,e.value])}const Nu={forcePlainText:!1};function Tu(e,t,n,{forcePlainText:r,startingLine:s,totalLines:o,expandedHunks:i,collapsedContextThreshold:l=1}=Nu){r?(s??=0,o??=1/0):(s=0,o=1/0);const a=s>0||o<1/0,c=typeof n.theme=="string"?t.getTheme(n.theme).type:void 0,u=Zs({theme:n.theme,highlighter:t}),f=r&&!a&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?"none":n.lineDiffType,h={deletionLines:[],additionLines:[]},{maxLineDiffLength:d}=n,p=!r&&!e.isPartial,b=r?i:void 0,w=new Map;function g(y){const _=p?0:y,S=w.get(_)??$u();return w.set(_,S),S}function m(y,_,S,k){if(a){let v=S.at(-1);(v==null||v.targetIndex+v.count!==_)&&(v={targetIndex:_,originalOffset:k.length,count:0},S.push(v)),v.count++}k.push(y)}Eu({diff:e,diffStyle:"both",startingLine:s,totalLines:o,expandedHunks:a?b:!0,collapsedContextThreshold:l,callback:({hunkIndex:y,additionLine:_,deletionLine:S,type:k})=>{const v=g(y),A=_!=null?_.splitLineIndex:S.splitLineIndex;k==="change"&&_!=null&&S!=null&&Pu({additionLine:e.additionLines[_.lineIndex],deletionLine:e.deletionLines[S.lineIndex],deletionLineIndex:v.deletionContent.length,additionLineIndex:v.additionContent.length,deletionDecorations:v.deletionDecorations,additionDecorations:v.additionDecorations,lineDiffType:f,maxLineDiffLength:d}),S!=null&&(m(e.deletionLines[S.lineIndex],S.lineIndex,v.deletionSegments,v.deletionContent),v.deletionInfo.push({type:k==="change"?"change-deletion":k,lineNumber:S.lineNumber,altLineNumber:k==="change"?void 0:_.lineNumber??void 0,lineIndex:`${S.unifiedLineIndex},${A}`})),_!=null&&(m(e.additionLines[_.lineIndex],_.lineIndex,v.additionSegments,v.additionContent),v.additionInfo.push({type:k==="change"?"change-addition":k,lineNumber:_.lineNumber,altLineNumber:k==="change"?void 0:S.lineNumber??void 0,lineIndex:`${_.unifiedLineIndex},${A}`}))}});for(const y of w.values()){if(y.deletionContent.length===0&&y.additionContent.length===0)continue;const _={name:e.prevName??e.name,contents:y.deletionContent.value},S={name:e.name,contents:y.additionContent.value},{deletionLines:k,additionLines:v}=Mu({deletionFile:_,deletionInfo:y.deletionInfo,deletionDecorations:y.deletionDecorations,additionFile:S,additionInfo:y.additionInfo,additionDecorations:y.additionDecorations,highlighter:t,options:n,languageOverride:r?"text":e.lang});if(p){h.deletionLines=k,h.additionLines=v;continue}if(y.deletionSegments.length>0)for(const A of y.deletionSegments)for(let R=0;R<A.count;R++)h.deletionLines[A.targetIndex+R]=k[A.originalOffset+R];else h.deletionLines.push(...k);if(y.additionSegments.length>0)for(const A of y.additionSegments)for(let R=0;R<A.count;R++)h.additionLines[A.targetIndex+R]=v[A.originalOffset+R];else h.additionLines.push(...v)}return{code:h,themeStyles:u,baseThemeType:c}}function Pu({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:s,additionDecorations:o,lineDiffType:i,maxLineDiffLength:l}){if(e==null||t==null||i==="none"||(e=mt(e),t=mt(t),e.length>l||t.length>l))return;const a=i==="char"?ru(e,t):iu(e,t),c=[],u=[],f=i==="word-alt",h=a.at(-1);for(const p of a){const b=p===h;!p.added&&!p.removed?(et({item:p,arr:c,enableJoin:f,isNeutral:!0,isLastItem:b}),et({item:p,arr:u,enableJoin:f,isNeutral:!0,isLastItem:b})):p.removed?et({item:p,arr:c,enableJoin:f,isLastItem:b}):et({item:p,arr:u,enableJoin:f,isLastItem:b})}let d=0;for(const p of c)p[0]===1&&s.push(Tr({line:n,spanStart:d,spanLength:p[1].length})),d+=p[1].length;d=0;for(const p of u)p[0]===1&&o.push(Tr({line:r,spanStart:d,spanLength:p[1].length})),d+=p[1].length}function $u(){return{deletionContent:{push(e){this.value+=e,this.length++},value:"",length:0},additionContent:{push(e){this.value+=e,this.length++},value:"",length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function Mu({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:s,deletionDecorations:o,additionDecorations:i,languageOverride:l,options:{theme:a=At,...c}}){const u=l??yn(e.name),f=l??yn(t.name),{state:h,transformers:d}=Ks(c.useTokenTransformer),p=typeof a=="string"?{...c,lang:"text",theme:a,transformers:d,decorations:void 0,defaultColor:!1,cssVariablePrefix:Z("token"),tokenizeTimeLimit:0}:{...c,lang:"text",themes:a,transformers:d,decorations:void 0,defaultColor:!1,cssVariablePrefix:Z("token"),tokenizeTimeLimit:0};return{deletionLines:e.contents===""?[]:(p.lang=u,h.lineInfo=n,p.decorations=o,bn(s.codeToHast(mt(e.contents),p))),additionLines:t.contents===""?[]:(p.lang=f,p.decorations=i,h.lineInfo=r,bn(s.codeToHast(mt(t.contents),p)))}}const Pr=10,$r=13,Ou=4,Bu=40;function Du(e){const t=[0];let n=e.indexOf("\r"),r=e.indexOf(`
|
|
154
|
+
`),s=0,o=0;for(;n!==-1||r!==-1;){let i;if(n!==-1&&(r===-1||n<r)?r===n+1?(i=r+1,n=e.indexOf("\r",i),r=e.indexOf(`
|
|
155
|
+
`,i)):(i=n+1,n=e.indexOf("\r",i)):(i=r+1,r=e.indexOf(`
|
|
156
|
+
`,i)),t.push(i),++o===Ou){if(i-s<=Bu){for(let l=i;l<e.length;l++){const a=e.charCodeAt(l);(a===Pr||a===$r)&&(a===$r&&l+1<e.length&&e.charCodeAt(l+1)===Pr&&l++,t.push(l+1))}return t}s=i,o=0}}return t}function Gu(e){const t=Du(e);return Array.from({length:t.length},(n,r)=>{const s=t[r],o=t[r+1]??e.length;return e.slice(s,o)})}const Fu={forcePlainText:!1};function Uu(e,t,{theme:n=At,tokenizeMaxLineLength:r,useTokenTransformer:s},{forcePlainText:o,startingLine:i,totalLines:l,lines:a}=Fu){o?(i??=0,l??=1/0):(i=0,l=1/0);const c=i>0||l<1/0,{state:u,transformers:f}=Ks(s),h=o?"text":e.lang??yn(e.name),d=typeof n=="string"?t.getTheme(n).type:void 0,p=Zs({theme:n,highlighter:t});u.lineInfo=m=>({type:"context",lineIndex:m-1+i,lineNumber:m+i});const b=typeof n=="string"?{lang:h,theme:n,transformers:f,defaultColor:!1,cssVariablePrefix:Z("token"),tokenizeMaxLineLength:r,tokenizeTimeLimit:0}:{lang:h,themes:n,transformers:f,defaultColor:!1,cssVariablePrefix:Z("token"),tokenizeMaxLineLength:r,tokenizeTimeLimit:0},w=bn(t.codeToHast(c?ju(a??Gu(e.contents),i,l):e.contents,b)),g=c?new Array(i):w;return c&&g.push(...w),{code:g,themeStyles:p,baseThemeType:d}}function ju(e,t,n){if(e.length===0)return"";const r=Math.min(t+n,e.length);return e.slice(t,r).join("")}let Mr,we={theme:At,useTokenTransformer:!1,tokenizeMaxLineLength:1e3,lineDiffType:"word-alt",maxLineDiffLength:1e3};self.addEventListener("error",e=>{console.error("[Shiki Worker] Unhandled error:",e.error)});self.addEventListener("message",e=>{Wu(e.data)});async function Wu(e){try{switch(e.type){case"initialize":await zu(e);break;case"set-render-options":await Hu(e);break;case"file":await qu(e);break;case"diff":await Vu(e);break;default:throw new Error(`Unknown request type: ${e.type}`)}}catch(t){console.error("Worker error:",t),Zu(e.id,t)}}async function zu({id:e,renderOptions:t,preferredHighlighter:n,resolvedThemes:r,resolvedLanguages:s,customExtensionsVersion:o,customExtensionMap:i}){let l=Rt(n);"then"in l&&(l=await l),Pn({customExtensionsVersion:o,customExtensionMap:i}),Vs(r,l),s!=null&&Tn(s,l),we=t,postMessage({type:"success",id:e,requestType:"initialize",sentAt:Date.now()})}async function Hu({id:e,renderOptions:t,resolvedThemes:n}){let r=Rt();"then"in r&&(r=await r),Vs(n,r),we=t,postMessage({type:"success",id:e,requestType:"set-render-options",sentAt:Date.now()})}async function qu({id:e,file:t,resolvedLanguages:n,customExtensionsVersion:r,customExtensionMap:s}){let o=Rt();"then"in o&&(o=await o),Pn({customExtensionsVersion:r,customExtensionMap:s}),n!=null&&Tn(n,o);const i={theme:we.theme,useTokenTransformer:we.useTokenTransformer,tokenizeMaxLineLength:we.tokenizeMaxLineLength};Xu(e,Uu(t,o,i),i)}async function Vu({id:e,diff:t,resolvedLanguages:n,customExtensionsVersion:r,customExtensionMap:s}){let o=Rt();"then"in o&&(o=await o),Pn({customExtensionsVersion:r,customExtensionMap:s}),n!=null&&Tn(n,o),Ku(e,Tu(t,o,we),we)}function Rt(e="shiki-js"){return Mr??=qa({themes:[],langs:[],engine:e==="shiki-wasm"?Kc(import("./wasm-CG6Dc4jp.js")):Tc()}),Mr}function Pn({customExtensionsVersion:e,customExtensionMap:t}){if(!(e==null&&t==null)){if(e==null||t==null)throw new Error("Worker request must include both customExtensionsVersion and customExtensionMap");gu(e,t)}}function Xu(e,t,n){postMessage({type:"success",requestType:"file",id:e,result:t,options:n,sentAt:Date.now()})}function Ku(e,t,n){postMessage({type:"success",requestType:"diff",id:e,result:t,options:n,sentAt:Date.now()})}function Zu(e,t){const n={type:"error",id:e,error:t instanceof Error?t.message:String(t),stack:t instanceof Error?t.stack:void 0};postMessage(n)}
|