Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

oniguruma-to-es

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

oniguruma-to-es - npm Package Compare versions

Comparing version 0.9.0 to 0.10.0

types/utils-ast.d.ts

24

dist/index.min.js

@@ -1,2 +0,2 @@

var OnigurumaToES=(()=>{var he=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var Gt=Object.getOwnPropertyNames;var Mt=Object.prototype.hasOwnProperty;var Nt=(e,t)=>{for(var r in t)he(e,r,{get:t[r],enumerable:!0})},Pt=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Gt(t))!Mt.call(e,n)&&n!==r&&he(e,n,{get:()=>t[n],enumerable:!(s=It(t,n))||s.enumerable});return e};var Rt=e=>Pt(he({},"__esModule",{value:!0}),e);var en={};Nt(en,{EmulatedRegExp:()=>te,toDetails:()=>_t,toOnigurumaAst:()=>Jr,toRegExp:()=>Yr});var x=String.fromCodePoint,h=String.raw,Oe=(()=>{try{new RegExp("(?<n>)|(?<n>)")}catch{return!1}return!0})(),De=(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),Te=(()=>{try{new RegExp("","v")}catch{return!1}return!0})();function L(e,{enable:t,disable:r}){return{dotAll:!r?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!r?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function B(e,t,r){return e.has(t)||e.set(t,r),e.get(t)}function H(e,t){return de[e]>=de[t]}function I(e,t){if(!e)throw new Error(t??"Value expected");return e}var de={ES2025:2025,ES2024:2024,ES2018:2018},Ut={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function ne(e){if(e?.target!==void 0&&!Ut[e.target])throw new Error(`Unexpected target "${e.target}"`);let t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,maxRecursionDepth:5,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,ignoreUnsupportedGAnchors:!1,...e?.rules}};return t.target==="auto"&&(t.target=Oe&&De?"ES2025":Te?"ES2024":"ES2018"),t}var Ot=new Set([x(304),x(305)]);function me(e){if(Ot.has(e))return[e];let t=new Set,r=e.toLowerCase(),s=r.toUpperCase(),n=Bt.get(r),a=Tt.get(r),o=Lt.get(r);return[...s].length===1&&t.add(s),o&&t.add(o),n&&t.add(n),t.add(r),a&&t.add(a),[...t]}var we=new Set(`C Other
var OnigurumaToES=(()=>{var he=Object.defineProperty;var vt=Object.getOwnPropertyDescriptor;var Ft=Object.getOwnPropertyNames;var It=Object.prototype.hasOwnProperty;var Gt=(e,t)=>{for(var r in t)he(e,r,{get:t[r],enumerable:!0})},Mt=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ft(t))!It.call(e,n)&&n!==r&&he(e,n,{get:()=>t[n],enumerable:!(s=vt(t,n))||s.enumerable});return e};var Nt=e=>Mt(he({},"__esModule",{value:!0}),e);var Yr={};Gt(Yr,{EmulatedRegExp:()=>te,toDetails:()=>St,toOnigurumaAst:()=>Zr,toRegExp:()=>Jr});var x=String.fromCodePoint,h=String.raw,Oe=(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),Te=(()=>{try{new RegExp("","v")}catch{return!1}return!0})();function L(e,{enable:t,disable:r}){return{dotAll:!r?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!r?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function B(e,t,r){return e.has(t)||e.set(t,r),e.get(t)}function H(e,t){return de[e]>=de[t]}function I(e,t){if(!e)throw new Error(t??"Value expected");return e}var de={ES2025:2025,ES2024:2024,ES2018:2018},Pt={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function ne(e){if(e?.target!==void 0&&!Pt[e.target])throw new Error(`Unexpected target "${e.target}"`);let t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,maxRecursionDepth:5,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,ignoreUnsupportedGAnchors:!1,...e?.rules}};return t.target==="auto"&&(t.target=Oe?"ES2025":Te?"ES2024":"ES2018"),t}var Rt=new Set([x(304),x(305)]);function me(e){if(Rt.has(e))return[e];let t=new Set,r=e.toLowerCase(),s=r.toUpperCase(),n=Dt.get(r),a=Ot.get(r),o=Tt.get(r);return[...s].length===1&&t.add(s),o&&t.add(o),n&&t.add(n),t.add(r),a&&t.add(a),[...t]}var we=new Set(`C Other
Cc Control cntrl

@@ -91,5 +91,5 @@ Cf Format

XID_Continue XIDC
XID_Start XIDS`.split(/\s/)),ke=new Map;for(let e of we)ke.set(K(e),e);var Dt=new Set(["Basic_Emoji","Emoji_Keycap_Sequence","RGI_Emoji","RGI_Emoji_Flag_Sequence","RGI_Emoji_Modifier_Sequence","RGI_Emoji_Tag_Sequence","RGI_Emoji_ZWJ_Sequence"]),ye=new Map;for(let e of Dt)ye.set(K(e),e);var Tt=new Map([["s",x(383)],[x(383),"s"]]),Lt=new Map([[x(223),x(7838)],[x(107),x(8490)],[x(229),x(8491)],[x(969),x(8486)]]),Bt=new Map([U(453),U(456),U(459),U(498),...Ce(8072,8079),...Ce(8088,8095),...Ce(8104,8111),U(8124),U(8140),U(8188)]),se=new Map([["alnum",h`[\p{Alpha}\p{Nd}]`],["alpha",h`\p{Alpha}`],["ascii",h`\p{ASCII}`],["blank",h`[\p{Zs}\t]`],["cntrl",h`\p{cntrl}`],["digit",h`\p{Nd}`],["graph",h`[\P{space}&&\P{cntrl}&&\P{Cn}&&\P{Cs}]`],["lower",h`\p{Lower}`],["print",h`[[\P{space}&&\P{cntrl}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",h`[\p{P}\p{S}]`],["space",h`\p{space}`],["upper",h`\p{Upper}`],["word",h`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",h`\p{AHex}`]]),Le=new Set(["alnum","blank","graph","print","word","xdigit"]);function Vt(e,t){let r=[];for(let s=e;s<=t;s++)r.push(s);return r}function K(e){return e.replace(/[- _]+/g,"").toLowerCase()}function U(e){let t=x(e);return[t.toLowerCase(),t]}function Ce(e,t){return Vt(e,t).map(r=>U(r))}var be=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);var d={Alternator:"Alternator",Assertion:"Assertion",Backreference:"Backreference",Character:"Character",CharacterClassClose:"CharacterClassClose",CharacterClassHyphen:"CharacterClassHyphen",CharacterClassIntersector:"CharacterClassIntersector",CharacterClassOpen:"CharacterClassOpen",CharacterSet:"CharacterSet",Directive:"Directive",GroupClose:"GroupClose",GroupOpen:"GroupOpen",Subroutine:"Subroutine",Quantifier:"Quantifier",VariableLengthCharacterSet:"VariableLengthCharacterSet",EscapedNumber:"EscapedNumber"},E={any:"any",digit:"digit",dot:"dot",hex:"hex",non_newline:"non_newline",posix:"posix",property:"property",space:"space",word:"word"},Q={flags:"flags",keep:"keep"},A={atomic:"atomic",capturing:"capturing",group:"group",lookahead:"lookahead",lookbehind:"lookbehind"},Be=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]),je=h`\[\^?`,We=`c.? | C(?:-.?)?|${h`[pP]\{(?:\^?[\x20\w]+\})?`}|${h`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${h`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${h`o\{[^\}]*\}?`}|${h`\d{1,3}`}`,He=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,ae=new RegExp(h`
XID_Start XIDS`.split(/\s/)),ke=new Map;for(let e of we)ke.set(K(e),e);var Ut=new Set(["Basic_Emoji","Emoji_Keycap_Sequence","RGI_Emoji","RGI_Emoji_Flag_Sequence","RGI_Emoji_Modifier_Sequence","RGI_Emoji_Tag_Sequence","RGI_Emoji_ZWJ_Sequence"]),ye=new Map;for(let e of Ut)ye.set(K(e),e);var Ot=new Map([["s",x(383)],[x(383),"s"]]),Tt=new Map([[x(223),x(7838)],[x(107),x(8490)],[x(229),x(8491)],[x(969),x(8486)]]),Dt=new Map([U(453),U(456),U(459),U(498),...Ce(8072,8079),...Ce(8088,8095),...Ce(8104,8111),U(8124),U(8140),U(8188)]),se=new Map([["alnum",h`[\p{Alpha}\p{Nd}]`],["alpha",h`\p{Alpha}`],["ascii",h`\p{ASCII}`],["blank",h`[\p{Zs}\t]`],["cntrl",h`\p{cntrl}`],["digit",h`\p{Nd}`],["graph",h`[\P{space}&&\P{cntrl}&&\P{Cn}&&\P{Cs}]`],["lower",h`\p{Lower}`],["print",h`[[\P{space}&&\P{cntrl}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",h`[\p{P}\p{S}]`],["space",h`\p{space}`],["upper",h`\p{Upper}`],["word",h`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",h`\p{AHex}`]]),De=new Set(["alnum","blank","graph","print","word","xdigit"]);function Lt(e,t){let r=[];for(let s=e;s<=t;s++)r.push(s);return r}function K(e){return e.replace(/[- _]+/g,"").toLowerCase()}function U(e){let t=x(e);return[t.toLowerCase(),t]}function Ce(e,t){return Lt(e,t).map(r=>U(r))}var be=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);var d={Alternator:"Alternator",Assertion:"Assertion",Backreference:"Backreference",Character:"Character",CharacterClassClose:"CharacterClassClose",CharacterClassHyphen:"CharacterClassHyphen",CharacterClassIntersector:"CharacterClassIntersector",CharacterClassOpen:"CharacterClassOpen",CharacterSet:"CharacterSet",Directive:"Directive",GroupClose:"GroupClose",GroupOpen:"GroupOpen",Subroutine:"Subroutine",Quantifier:"Quantifier",VariableLengthCharacterSet:"VariableLengthCharacterSet",EscapedNumber:"EscapedNumber"},E={any:"any",digit:"digit",dot:"dot",hex:"hex",non_newline:"non_newline",posix:"posix",property:"property",space:"space",word:"word"},Q={flags:"flags",keep:"keep"},A={atomic:"atomic",capturing:"capturing",group:"group",lookahead:"lookahead",lookbehind:"lookbehind"},Le=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]),Ve=h`\[\^?`,je=`c.? | C(?:-.?)?|${h`[pP]\{(?:\^?[\x20\w]+\})?`}|${h`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${h`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${h`o\{[^\}]*\}?`}|${h`\d{1,3}`}`,We=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,ae=new RegExp(h`
\\ (?:
${We}
${je}
| [gk]<[^>]*>?

@@ -107,16 +107,16 @@ | [gk]'[^']*'?

)?)?
| ${He.source}
| ${je}
| ${We.source}
| ${Ve}
| .
`.replace(/\s+/g,""),"gsu"),xe=new RegExp(h`
\\ (?:
${We}
${je}
| .
)
| \[:[^:]*:\]
| ${je}
| ${Ve}
| &&
| .
`.replace(/\s+/g,""),"gsu");function X(e,t="",r){if(r={captureGroup:!1,...r},typeof e!="string")throw new Error("String expected as pattern");if(!/^[imxDSW]*$/.test(t))throw new Error(`Flags "${t}" includes unsupported value`);let s=t.includes("x"),n=[s],a={captureGroup:r.captureGroup,getCurrentModX:()=>n.at(-1),numOpenGroups:0,popModX(){n.pop()},pushModX(f){n.push(f)},replaceCurrentModX(f){n[n.length-1]=f}},o=[],i;for(ae.lastIndex=0;i=ae.exec(e);){let f=jt(a,e,i[0],ae.lastIndex);f.tokens?o.push(...f.tokens):f.token&&o.push(f.token),f.lastIndex!==void 0&&(ae.lastIndex=f.lastIndex)}let c=[],p=0;o.forEach(f=>{f.type===d.GroupOpen&&(f.kind===A.capturing?f.number=++p:f.raw==="("&&c.push(f))}),p||c.forEach((f,w)=>{f.kind=A.capturing,f.number=w+1});let l=p||c.length;return o=o.map(f=>f.type===d.EscapedNumber?Jt(f,l):f).flat(),{tokens:o,flags:{ignoreCase:t.includes("i"),dotAll:t.includes("m"),extended:s,digitIsAscii:t.includes("D"),spaceIsAscii:t.includes("S"),wordIsAscii:t.includes("W")},rules:r}}function jt(e,t,r,s){let[n,a,o]=r;if(n==="["){let i=Wt(t,r,s);return{tokens:i.tokens,lastIndex:i.lastIndex}}if(n==="\\"){if("AbBGzZ".includes(a))return{token:C(d.Assertion,r,{kind:r})};if(/^\\g[<']/.test(r)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(r))throw new Error(`Invalid group name "${r}"`);return{token:C(d.Subroutine,r)}}if(/^\\k[<']/.test(r)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(r))throw new Error(`Invalid group name "${r}"`);return{token:C(d.Backreference,r)}}if(a==="K")return{token:C(d.Directive,r,{kind:Q.keep})};if(a==="N")return{token:C(d.CharacterSet,r,{kind:E.non_newline})};if(a==="O")return{token:C(d.CharacterSet,r,{kind:E.any})};if("RX".includes(a))return{token:C(d.VariableLengthCharacterSet,r,{kind:r})};if("yY".includes(a))throw new Error(`Unsupported grapheme boundary "${r}"`);let i=Ke(r,{inCharClass:!1});return Array.isArray(i)?{tokens:i}:{token:i}}if(n==="("){if(o==="#"){if(t[s]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:s+1}}if("-imx".includes(o))return{token:Qt(r,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,r==="("&&!e.captureGroup||r==="(?:")return{token:C(d.GroupOpen,r,{kind:A.group})};if(r==="(?>")return{token:C(d.GroupOpen,r,{kind:A.atomic})};if(r==="(?="||r==="(?!"||r==="(?<="||r==="(?<!")return{token:C(d.GroupOpen,r,{kind:o==="<"?A.lookbehind:A.lookahead,negate:r.endsWith("!")})};if(o==="<"||o==="'"||r==="("&&e.captureGroup){let i=C(d.GroupOpen,r,{kind:A.capturing});return r!=="("&&(i.name=r.slice(3,-1)),{token:i}}throw o==="("?new Error(`Unsupported conditional "${r}"`):o==="~"?new Error(`Unsupported absence operator "${r}"`):r==="(?"?new Error("Invalid group"):new Error(`Unexpected group "${r}"`)}if(r===")"){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:C(d.GroupClose,r)}}if(r==="#"&&e.getCurrentModX()){let i=t.indexOf(`
`,s);return{lastIndex:i===-1?t.length:i}}if(/^\s$/.test(r)&&e.getCurrentModX()){let i=/\s+/y;return i.lastIndex=s,{lastIndex:i.exec(t)?i.lastIndex:s}}return r==="."?{token:C(d.CharacterSet,r,{kind:E.dot})}:r==="^"||r==="$"?{token:C(d.Assertion,r,{kind:r})}:r==="|"?{token:C(d.Alternator,r)}:He.test(r)?{token:Xt(r)}:(Qe(r),{token:C(d.Character,r,{value:r.codePointAt(0)})})}function Wt(e,t,r){let s=[C(d.CharacterClassOpen,t,{negate:t[1]==="^"})],n=1,a;for(xe.lastIndex=r;a=xe.exec(e);){let o=a[0];if(o[0]==="["&&o[1]!==":")n++,s.push(C(d.CharacterClassOpen,o,{negate:o[1]==="^"}));else if(o==="]"){if(s.at(-1).type===d.CharacterClassOpen)s.push(C(d.Character,o,{value:93}));else if(n--,s.push(C(d.CharacterClassClose,o)),!n)break}else{let i=Ht(o);Array.isArray(i)?s.push(...i):s.push(i)}}return{tokens:s,lastIndex:xe.lastIndex||e.length}}function Ht(e){if(e[0]==="\\")return Ke(e,{inCharClass:!0});if(e[0]==="["){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!se.get(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return C(d.CharacterSet,e,{kind:E.posix,negate:!!t.groups.negate,value:t.groups.name})}return e==="-"?C(d.CharacterClassHyphen,e):e==="&&"?C(d.CharacterClassIntersector,e):(Qe(e),C(d.Character,e,{value:e.codePointAt(0)}))}function Ke(e,{inCharClass:t}){let r=e[1];if(r==="c"||r==="C")return Kt(e);if("dDhHsSwW".includes(r))return qt(e);if(e.startsWith(h`\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");return zt(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let s=e.split(/\\x/).slice(1).map(i=>parseInt(i,16)),n=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(s)),a=new TextEncoder;return[...n].map(i=>{let c=[...a.encode(i)].map(p=>`\\x${p.toString(16)}`).join("");return C(d.Character,c,{value:i.codePointAt(0)})})}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(r==="u"||r==="x")return C(d.Character,e,{value:Zt(e)});if(Be.has(r))return C(d.Character,e,{value:Be.get(r)});if(/\d/.test(r))return C(d.EscapedNumber,e,{inCharClass:t});if(e==="\\")throw new Error(h`Incomplete escape "\"`);if(r==="M")throw new Error(`Unsupported meta "${e}"`);if([...e].length===2)return C(d.Character,e,{value:e.codePointAt(1)});throw new Error(`Unexpected escape "${e}"`)}function C(e,t,r){return{type:e,raw:t,...r}}function Kt(e){let t=e[1]==="c"?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw new Error(`Unsupported control character "${e}"`);return C(d.Character,e,{value:t.toUpperCase().codePointAt(0)-64})}function Qt(e,t){let{on:r,off:s}=/^\(\?(?<on>[imx]*)(?:-(?<off>[imx\-]*))?/.exec(e).groups;s??="";let n=(t.getCurrentModX()||r.includes("x"))&&!s.includes("x"),a=Ve(r),o=Ve(s),i={};if(a&&(i.enable=a),o&&(i.disable=o),e.endsWith(")"))return t.replaceCurrentModX(n),C(d.Directive,e,{kind:Q.flags,flags:i});if(e.endsWith(":")){t.pushModX(n),t.numOpenGroups++;let c=C(d.GroupOpen,e,{kind:A.group});return(a||o)&&(c.flags=i),c}throw new Error(`Unexpected flag modifier "${e}"`)}function Xt(e){let t={};if(e[0]==="{"){let{min:r,max:s}=/^\{(?<min>\d*)(?:,(?<max>\d*))?/.exec(e).groups,n=1e5;if(+r>n||+s>n)throw new Error("Quantifier value unsupported in Oniguruma");t.min=+r,t.max=s===void 0?+r:s===""?1/0:+s,t.greedy=!e.endsWith("?"),t.possessive=!1}else t.min=e[0]==="+"?1:0,t.max=e[0]==="?"?1:1/0,t.greedy=e[1]!=="?",t.possessive=e[1]==="+";return C(d.Quantifier,e,t)}function qt(e){let t=e[1].toLowerCase();return C(d.CharacterSet,e,{kind:{d:E.digit,h:E.hex,s:E.space,w:E.word}[t],negate:e[1]!==t})}function zt(e){let{p:t,neg:r,value:s}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[ \w]+)/.exec(e).groups,n=t==="P"&&!r||t==="p"&&!!r;return C(d.CharacterSet,e,{kind:E.property,negate:n,value:s})}function Ve(e){let 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 Zt(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}"`);let t=e[2]==="{"?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2),r=parseInt(t,16);if(r>1310719)throw new Error(`Invalid out of range "${e}"`);if(r>1114111)throw new Error(`Invalid out of range in JS "${e}"`);return r}function Jt(e,t){let{raw:r,inCharClass:s}=e,n=r.slice(1);if(!s&&(n!=="0"&&n.length===1||n[0]!=="0"&&+n<=t))return[C(d.Backreference,r)];let a=[],o=n.match(/^[0-7]+|\d/g);for(let i=0;i<o.length;i++){let c=o[i],p;if(i===0&&c!=="8"&&c!=="9"){if(p=parseInt(c,8),p>127)throw new Error(h`Octal encoded byte above 177 unsupported "${r}"`)}else p=c.codePointAt(0);a.push(C(d.Character,(i===0?"\\":"")+c,{value:p}))}return a}function Qe(e){if([...e].length!==1)throw new Error(`Expected "${e}" to be a single code point`)}function q({alternatives:e},t){return e.length===1&&e[0].elements.length===1&&(!t||t(e[0].elements[0]))}function M({type:e,kind:t}){return e===u.Assertion&&(t===m.lookahead||t===m.lookbehind)}function oe({type:e,min:t}){return e===u.Assertion||e===u.Directive||e===u.Quantifier&&!t}function N(e,t,r){let s=e.node;for(;s.parent;)s=s.parent;function n(o,i){for(let c=0;c<o.length;c++){let p=a(o[c],i,c,o);c=Math.max(-1,c+p)}}function a(o,i=null,c=null,p=null){let l=0,f=!1,w={node:o,parent:i,key:c,container:p,ast:s,remove(){I(p,"Container expected").splice(Math.max(0,c+l),1),l-=1},removeAllNextSiblings(){return I(p,"Container expected").splice(c+1)},removeAllPrevSiblings(){let _=c+l;return l-=_,I(p,"Container expected").splice(0,Math.max(0,_))},replaceWith(_){er(_,i),p?p[Math.max(0,c+l)]=_:i[c]=_},skip(){f=!0}},g=Yt(o).find(_=>!!r[_]),y=g&&r[g],b=typeof y=="function"?y:y?.enter,F=y?.exit;if(b?.(w,t),!f)switch(o.type){case u.Regex:a(o.pattern,o,"pattern"),a(o.flags,o,"flags");break;case u.Alternative:case u.CharacterClass:n(o.elements,o);break;case u.Assertion:M(o)&&n(o.alternatives,o);break;case u.Backreference:case u.Character:case u.CharacterSet:case u.Directive:case u.Flags:case u.Recursion:case u.Subroutine:case u.VariableLengthCharacterSet:break;case u.CapturingGroup:case u.Group:case u.Pattern:n(o.alternatives,o);break;case u.CharacterClassIntersection:n(o.classes,o);break;case u.CharacterClassRange:a(o.min,o,"min"),a(o.max,o,"max");break;case u.Quantifier:a(o.element,o,"element");break;default:throw new Error(`Unexpected node type "${o.type}"`)}return F?.(w,t),l}a(e.node,e.parent,e.key,e.container)}var Xe={AnyGroup:"AnyGroup",AnyNode:"AnyNode"};function Yt(e){let{type:t}=e,r=[Xe.AnyNode];return(t===u.CapturingGroup||t===u.Group||M(e))&&r.push(Xe.AnyGroup),r.push(t),r}function er(e,t){"parent"in t&&(e.parent=t)}var u={Alternative:"Alternative",Assertion:"Assertion",Backreference:"Backreference",CapturingGroup:"CapturingGroup",Character:"Character",CharacterClass:"CharacterClass",CharacterClassIntersection:"CharacterClassIntersection",CharacterClassRange:"CharacterClassRange",CharacterSet:"CharacterSet",Directive:"Directive",Flags:"Flags",Group:"Group",Pattern:"Pattern",Quantifier:"Quantifier",Regex:"Regex",Subroutine:"Subroutine",VariableLengthCharacterSet:"VariableLengthCharacterSet",Recursion:"Recursion"},m={line_end:"line_end",line_start:"line_start",lookahead:"lookahead",lookbehind:"lookbehind",search_start:"search_start",string_end:"string_end",string_end_newline:"string_end_newline",string_start:"string_start",word_boundary:"word_boundary"},k=E,Z=Q,z={grapheme:"grapheme",newline:"newline"};function J({tokens:e,flags:t,rules:r},s){let n={skipBackrefValidation:!1,skipPropertyNameValidation:!1,verbose:!1,...s},a={capturingGroups:[],current:0,hasNumberedRef:!1,namedGroupsByName:new Map,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],token:null,tokens:e,verbose:n.verbose,walk:o};function o(g,y){let b=e[a.current];switch(a.parent=g,a.token=b,a.current++,b.type){case d.Alternator:return O();case d.Assertion:return Ze(b);case d.Backreference:return tr(a);case d.Character:return Je(b.value);case d.CharacterClassHyphen:return rr(a,y);case d.CharacterClassOpen:return nr(a,y);case d.CharacterSet:return sr(a);case d.Directive:return pr(b);case d.GroupOpen:return ar(a,y);case d.Quantifier:return or(a);case d.Subroutine:return ir(a);case d.VariableLengthCharacterSet:return mr(b.kind);default:throw new Error(`Unexpected token type "${b.type}"`)}}let i=dr(gr(),fr(t)),c=i.pattern.alternatives[0];for(;a.current<e.length;){let g=o(c,{});g.type===u.Alternative?(i.pattern.alternatives.push(g),c=g):c.elements.push(g)}let{capturingGroups:p,hasNumberedRef:l,namedGroupsByName:f,subroutines:w}=a;if(l&&f.size&&!r.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(let{ref:g}of w)if(typeof g=="number"){if(g>p.length)throw new Error("Subroutine uses a group number that's not defined")}else if(f.has(g)){if(f.get(g).length>1)throw new Error(h`Subroutine uses a duplicate group name "\g<${g}>"`)}else throw new Error(h`Subroutine uses a group name that's not defined "\g<${g}>"`);return N({node:i},null,{AnyNode({node:g,parent:y}){g.parent=y}}),i}function tr(e){let{raw:t}=e.token,r=/^\\k[<']/.test(t),s=r?t.slice(3,-1):t.slice(1),n=(a,o=!1)=>{let i=e.capturingGroups.length,c=!1;if(a>i)if(e.skipBackrefValidation)c=!0;else throw new Error(`Not enough capturing groups defined to the left "${t}"`);return e.hasNumberedRef=!0,ie(o?i+1-a:a,{orphan:c})};if(r){let a=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(s);if(a)return n(+a.groups.num,!!a.groups.sign);if(/[-+]/.test(s))throw new Error(`Invalid backref name "${t}"`);if(!e.namedGroupsByName.has(s))throw new Error(`Group name not defined to the left "${t}"`);return ie(s)}return n(+s)}function rr(e,t){let{parent:r,tokens:s,walk:n}=e,a=r.elements.at(-1),o=s[e.current];if(a&&a.type!==u.CharacterClass&&a.type!==u.CharacterClassRange&&o&&o.type!==d.CharacterClassOpen&&o.type!==d.CharacterClassClose&&o.type!==d.CharacterClassIntersector){let i=n(r,t);if(a.type===u.Character&&i.type===u.Character)return r.elements.pop(),lr(a,i);throw new Error("Invalid character class range")}return Je(45)}function nr(e,t){let{token:r,tokens:s,verbose:n,walk:a}=e,o=s[e.current],i=Ee({negate:r.negate}),c=i.elements[0],p=qe(o);for(;p.type!==d.CharacterClassClose;){if(p.type===d.CharacterClassIntersector)c.classes.push(Ee({negate:!1,baseOnly:!0})),e.current++;else{let l=c.classes.at(-1);l.elements.push(a(l,t))}p=qe(s[e.current],o)}if(n||br(c),c.classes.length===1){let l=c.classes[0];l.negate=i.negate!==l.negate,i=l}return e.current++,i}function sr({token:e,skipPropertyNameValidation:t}){let{kind:r,negate:s,value:n}=e;if(r===E.property){let a=K(n);if(Le.has(a))r=E.posix,n=a;else return V(n,{negate:s,skipPropertyNameValidation:t})}return r===E.posix?{type:u.CharacterSet,kind:k.posix,negate:s,value:n}:ce(r,{negate:s})}function ar(e,t){let{token:r,tokens:s,capturingGroups:n,namedGroupsByName:a,verbose:o,walk:i}=e,c=cr(r);c.type===u.CapturingGroup&&(n.push(c),c.name&&B(a,c.name,[]).push(c));let p=ze(s[e.current]);for(;p.type!==d.GroupClose;){if(p.type===d.Alternator)c.alternatives.push(O()),e.current++;else{let l=c.alternatives.at(-1);l.elements.push(i(l,t))}p=ze(s[e.current])}return o||(c=kr(c)),e.current++,c}function or({token:e,parent:t}){let{min:r,max:s,greedy:n,possessive:a}=e,o=t.elements.at(-1);if(!o||o.type===u.Assertion||o.type===u.Directive)throw new Error("Quantifier requires a repeatable token");let i=hr(o,r,s,n,a);return t.elements.pop(),i}function ir(e){let{token:t,capturingGroups:r,subroutines:s}=e,n=t.raw.slice(3,-1),a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(n);if(a){let i=+a.groups.num,c=r.length;if(e.hasNumberedRef=!0,n={"":i,"+":c+i,"-":c+1-i}[a.groups.sign],n<1)throw new Error("Invalid subroutine number")}else n==="0"&&(n=0);let o=Cr(n);return s.push(o),o}function O(){return{type:u.Alternative,elements:[]}}function Ze({type:e,kind:t,negate:r}){if(e===d.GroupOpen)return ue({behind:t===A.lookbehind,negate:r});let s=I({"^":m.line_start,$:m.line_end,"\\A":m.string_start,"\\b":m.word_boundary,"\\B":m.word_boundary,"\\G":m.search_start,"\\z":m.string_end,"\\Z":m.string_end_newline}[t],`Unexpected assertion kind "${t}"`),n={type:u.Assertion,kind:s};return s===m.word_boundary&&(n.negate=t===h`\B`),n}function ie(e,t){let r=!!t?.orphan;return{type:u.Backreference,...r&&{orphan:r},ref:e}}function cr(e){let{kind:t,number:r,name:s,flags:n}=e;switch(t){case A.atomic:return P({atomic:!0});case A.capturing:return Ae(r,s);case A.group:return P({flags:n});case A.lookahead:case A.lookbehind:return Ze(e);default:throw new Error(`Unexpected group kind "${t}"`)}}function Ae(e,t){let r=t!==void 0;if(r&&!yr(t))throw new Error(`Group name "${t}" invalid in Oniguruma`);return{type:u.CapturingGroup,number:e,...r&&{name:t},alternatives:[O()]}}function Je(e){return{type:u.Character,value:e}}function Ee(e){let t={baseOnly:!1,negate:!1,...e};return{type:u.CharacterClass,negate:t.negate,elements:t.baseOnly?[]:[ur()]}}function ur(){return{type:u.CharacterClassIntersection,classes:[Ee({negate:!1,baseOnly:!0})]}}function lr(e,t){if(t.value<e.value)throw new Error("Character class range out of order");return{type:u.CharacterClassRange,min:e,max:t}}function ce(e,{negate:t}){let r={type:u.CharacterSet,kind:I(k[e],`Unexpected character set kind "${e}"`)};return(e===E.digit||e===E.hex||e===E.space||e===E.word)&&(r.negate=t),r}function pr({kind:e,flags:t}){let r={type:u.Directive,kind:I(Z[e],`Unexpected directive kind "${e}"`)};return e===Q.flags&&(r.flags=t),r}function fr({ignoreCase:e,dotAll:t,extended:r,digitIsAscii:s,spaceIsAscii:n,wordIsAscii:a}){return{type:u.Flags,ignoreCase:e,dotAll:t,extended:r,digitIsAscii:s,spaceIsAscii:n,wordIsAscii:a}}function P(e){let t=e?.atomic,r=e?.flags;return{type:u.Group,...t&&{atomic:t},...r&&{flags:r},alternatives:[O()]}}function ue(e){let t={behind:!1,negate:!1,...e};return{type:u.Assertion,kind:t.behind?m.lookbehind:m.lookahead,negate:t.negate,alternatives:[O()]}}function gr(){return{type:u.Pattern,alternatives:[O()]}}function hr(e,t,r,s,n){if(r<t)throw new Error("Quantifier range out of order");return{type:u.Quantifier,min:t,max:r,greedy:s,possessive:n,element:e}}function dr(e,t){return{type:u.Regex,pattern:e,flags:t}}function Cr(e){return{type:u.Subroutine,ref:e}}function V(e,t){let r={negate:!1,skipPropertyNameValidation:!1,...t};return{type:u.CharacterSet,kind:k.property,value:r.skipPropertyNameValidation?e:wr(e),negate:r.negate}}function mr(e){return{type:u.VariableLengthCharacterSet,kind:I({"\\R":z.newline,"\\X":z.grapheme}[e],`Unexpected varcharset kind "${e}"`)}}function wr(e){let t=K(e);if(ye.has(t))throw new Error(h`Unicode property "\p{${e}}" unsupported in Oniguruma`);let r=ke.get(t);return r||e.trim().replace(/\s+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,s=>s[0].toUpperCase()+s.slice(1).toLowerCase())}function kr(e){let t=e.alternatives[0].elements[0];return e.type===u.Group&&q(e,r=>r.type===u.Group)&&!(e.atomic&&t.flags)&&!(e.flags&&(t.atomic||t.flags))?(e.atomic?t.atomic=!0:e.flags&&(t.flags=e.flags),t):e}function yr(e){return!/^(?:[-\d]|$)/.test(e)}function br(e){for(let t=0;t<e.classes.length;t++){let r=e.classes[t],s=r.elements[0];r.elements.length===1&&s.type===u.CharacterClass&&(e.classes[t]=s,s.negate=r.negate!==s.negate)}}function qe(e,t){return I(e,`${t?.value===93?"Empty":"Unclosed"} character class`)}function ze(e){return I(e,"Unclosed group")}var S=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function T(e,t,r,s){let n=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),a=[!1],o=0,i="";for(let c of e.matchAll(n)){let{0:p,groups:{$skip:l}}=c;if(!l&&(!s||s===S.DEFAULT==!o)){r instanceof Function?i+=r(c,{context:o?S.CHAR_CLASS:S.DEFAULT,negated:a[a.length-1]}):i+=r;continue}p[0]==="["?(o++,a.push(p[1]==="^")):p==="]"&&o&&(o--,a.pop()),i+=p}return i}function Ye(e,t,r,s){T(e,t,r,s)}function xr(e,t,r=0,s){if(!new RegExp(t,"su").test(e))return null;let n=new RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");n.lastIndex=r;let a=0,o;for(;o=n.exec(e);){let{0:i,groups:{$skip:c}}=o;if(!c&&(!s||s===S.DEFAULT==!a))return o;i==="["?a++:i==="]"&&a&&a--,n.lastIndex==o.index&&n.lastIndex++}return null}function Y(e,t,r){return!!xr(e,t,0,r)}function et(e,t){let r=/\\?./gsu;r.lastIndex=t;let s=e.length,n=0,a=1,o;for(;o=r.exec(e);){let[i]=o;if(i==="[")n++;else if(n)i==="]"&&n--;else if(i==="(")a++;else if(i===")"&&(a--,!a)){s=o.index;break}}return e.slice(t,s)}var v="$E$",ee=class e extends RegExp{_captureMap;_namesByIndex;constructor(t,r,s){if(t instanceof RegExp&&s)throw new Error("Cannot provide options when copying a regexp");let n=!!s?.useEmulationGroups,a=n?Er(t):null;super(a?.expression||t,r);let o=n?a:t instanceof e?t:null;o&&(this._captureMap=o._captureMap,this._namesByIndex=o._namesByIndex)}exec(t){let r=RegExp.prototype.exec.call(this,t);if(!r||!this._captureMap)return r;let s=[...r];r.length=1;let n;this.hasIndices&&(n=[...r.indices],r.indices.length=1);for(let a=1;a<s.length;a++)if(this._captureMap[a].exclude){let o=this._captureMap[a].transfer;if(o&&r.length>o){r[o]=s[a];let i=this._namesByIndex[o];i&&(r.groups[i]=s[a],this.hasIndices&&(r.indices.groups[i]=n[a])),this.hasIndices&&(r.indices[o]=n[a])}}else r.push(s[a]),this.hasIndices&&r.indices.push(n[a]);return r}};function Er(e){let t=v.replace(/\$/g,"\\$"),r=[{exclude:!1}],s={0:""},n=0;return e=T(e,String.raw`\((?:(?!\?)|\?<(?![=!])(?<name>[^>]+)>)(?<mark>(?:\$(?<transfer>[1-9]\d*))?${t})?`,({0:a,groups:{name:o,mark:i,transfer:c}})=>i?(r.push({exclude:!0,transfer:c&&+c}),a.slice(0,-i.length)):(n++,o&&(s[n]=o),r.push({exclude:!1}),a),S.DEFAULT),{_captureMap:r,_namesByIndex:s,expression:e}}var tt=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function rt(e,t,r,s){return e.slice(0,t)+s+e.slice(t+r.length)}var nt=new RegExp(String.raw`(?<noncapturingStart>${tt})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function $e(e,t){if(!/\(\?>/.test(e))return e;let r="(?>",s=`(?:(?=(${t?.useEmulationGroups?v:""}`,n=[0],a=0,o=0,i=NaN,c;do{c=!1;let p=0,l=0,f=!1,w;for(nt.lastIndex=Number.isNaN(i)?0:i+s.length;w=nt.exec(e);){let{0:g,index:y,groups:{capturingStart:b,noncapturingStart:F}}=w;if(g==="[")p++;else if(p)g==="]"&&p--;else if(g===r&&!f)i=y,f=!0;else if(f&&F)l++;else if(b)f?l++:(a++,n.push(a+o));else if(g===")"&&f){if(!l){o++,e=`${e.slice(0,i)}${s}${e.slice(i+r.length,y)}))<$$${o+a}>)${e.slice(y+1)}`,c=!0;break}l--}}}while(c);return e=T(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:p,groups:{backrefNum:l,wrappedBackrefNum:f}})=>{if(l){let w=+l;if(w>n.length-1)throw new Error(`Backref "${p}" greater than number of captures`);return`\\${n[w]}`}return`\\${f}`},S.DEFAULT),e}var st=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Se=new RegExp(String.raw`
`.replace(/\s+/g,""),"gsu");function X(e,t="",r){if(r={captureGroup:!1,...r},typeof e!="string")throw new Error("String expected as pattern");if(!/^[imxDSW]*$/.test(t))throw new Error(`Flags "${t}" includes unsupported value`);let s=t.includes("x"),n=[s],a={captureGroup:r.captureGroup,getCurrentModX:()=>n.at(-1),numOpenGroups:0,popModX(){n.pop()},pushModX(f){n.push(f)},replaceCurrentModX(f){n[n.length-1]=f}},o=[],i;for(ae.lastIndex=0;i=ae.exec(e);){let f=Bt(a,e,i[0],ae.lastIndex);f.tokens?o.push(...f.tokens):f.token&&o.push(f.token),f.lastIndex!==void 0&&(ae.lastIndex=f.lastIndex)}let c=[],p=0;o.forEach(f=>{f.type===d.GroupOpen&&(f.kind===A.capturing?f.number=++p:f.raw==="("&&c.push(f))}),p||c.forEach((f,w)=>{f.kind=A.capturing,f.number=w+1});let l=p||c.length;return o=o.map(f=>f.type===d.EscapedNumber?zt(f,l):f).flat(),{tokens:o,flags:{ignoreCase:t.includes("i"),dotAll:t.includes("m"),extended:s,digitIsAscii:t.includes("D"),spaceIsAscii:t.includes("S"),wordIsAscii:t.includes("W")},rules:r}}function Bt(e,t,r,s){let[n,a,o]=r;if(n==="["){let i=Vt(t,r,s);return{tokens:i.tokens,lastIndex:i.lastIndex}}if(n==="\\"){if("AbBGzZ".includes(a))return{token:C(d.Assertion,r,{kind:r})};if(/^\\g[<']/.test(r)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(r))throw new Error(`Invalid group name "${r}"`);return{token:C(d.Subroutine,r)}}if(/^\\k[<']/.test(r)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(r))throw new Error(`Invalid group name "${r}"`);return{token:C(d.Backreference,r)}}if(a==="K")return{token:C(d.Directive,r,{kind:Q.keep})};if(a==="N")return{token:C(d.CharacterSet,r,{kind:E.non_newline})};if(a==="O")return{token:C(d.CharacterSet,r,{kind:E.any})};if("RX".includes(a))return{token:C(d.VariableLengthCharacterSet,r,{kind:r})};if("yY".includes(a))throw new Error(`Unsupported grapheme boundary "${r}"`);let i=He(r,{inCharClass:!1});return Array.isArray(i)?{tokens:i}:{token:i}}if(n==="("){if(o==="#"){if(t[s]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:s+1}}if("-imx".includes(o))return{token:Ht(r,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,r==="("&&!e.captureGroup||r==="(?:")return{token:C(d.GroupOpen,r,{kind:A.group})};if(r==="(?>")return{token:C(d.GroupOpen,r,{kind:A.atomic})};if(r==="(?="||r==="(?!"||r==="(?<="||r==="(?<!")return{token:C(d.GroupOpen,r,{kind:o==="<"?A.lookbehind:A.lookahead,negate:r.endsWith("!")})};if(o==="<"||o==="'"||r==="("&&e.captureGroup){let i=C(d.GroupOpen,r,{kind:A.capturing});return r!=="("&&(i.name=r.slice(3,-1)),{token:i}}throw o==="("?new Error(`Unsupported conditional "${r}"`):o==="~"?new Error(`Unsupported absence operator "${r}"`):r==="(?"?new Error("Invalid group"):new Error(`Unexpected group "${r}"`)}if(r===")"){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:C(d.GroupClose,r)}}if(r==="#"&&e.getCurrentModX()){let i=t.indexOf(`
`,s);return{lastIndex:i===-1?t.length:i}}if(/^\s$/.test(r)&&e.getCurrentModX()){let i=/\s+/y;return i.lastIndex=s,{lastIndex:i.exec(t)?i.lastIndex:s}}return r==="."?{token:C(d.CharacterSet,r,{kind:E.dot})}:r==="^"||r==="$"?{token:C(d.Assertion,r,{kind:r})}:r==="|"?{token:C(d.Alternator,r)}:We.test(r)?{token:Kt(r)}:(Ke(r),{token:C(d.Character,r,{value:r.codePointAt(0)})})}function Vt(e,t,r){let s=[C(d.CharacterClassOpen,t,{negate:t[1]==="^"})],n=1,a;for(xe.lastIndex=r;a=xe.exec(e);){let o=a[0];if(o[0]==="["&&o[1]!==":")n++,s.push(C(d.CharacterClassOpen,o,{negate:o[1]==="^"}));else if(o==="]"){if(s.at(-1).type===d.CharacterClassOpen)s.push(C(d.Character,o,{value:93}));else if(n--,s.push(C(d.CharacterClassClose,o)),!n)break}else{let i=jt(o);Array.isArray(i)?s.push(...i):s.push(i)}}return{tokens:s,lastIndex:xe.lastIndex||e.length}}function jt(e){if(e[0]==="\\")return He(e,{inCharClass:!0});if(e[0]==="["){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!se.get(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return C(d.CharacterSet,e,{kind:E.posix,negate:!!t.groups.negate,value:t.groups.name})}return e==="-"?C(d.CharacterClassHyphen,e):e==="&&"?C(d.CharacterClassIntersector,e):(Ke(e),C(d.Character,e,{value:e.codePointAt(0)}))}function He(e,{inCharClass:t}){let r=e[1];if(r==="c"||r==="C")return Wt(e);if("dDhHsSwW".includes(r))return Qt(e);if(e.startsWith(h`\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");return Xt(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let s=e.split(/\\x/).slice(1).map(i=>parseInt(i,16)),n=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(s)),a=new TextEncoder;return[...n].map(i=>{let c=[...a.encode(i)].map(p=>`\\x${p.toString(16)}`).join("");return C(d.Character,c,{value:i.codePointAt(0)})})}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(r==="u"||r==="x")return C(d.Character,e,{value:qt(e)});if(Le.has(r))return C(d.Character,e,{value:Le.get(r)});if(/\d/.test(r))return C(d.EscapedNumber,e,{inCharClass:t});if(e==="\\")throw new Error(h`Incomplete escape "\"`);if(r==="M")throw new Error(`Unsupported meta "${e}"`);if([...e].length===2)return C(d.Character,e,{value:e.codePointAt(1)});throw new Error(`Unexpected escape "${e}"`)}function C(e,t,r){return{type:e,raw:t,...r}}function Wt(e){let t=e[1]==="c"?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw new Error(`Unsupported control character "${e}"`);return C(d.Character,e,{value:t.toUpperCase().codePointAt(0)-64})}function Ht(e,t){let{on:r,off:s}=/^\(\?(?<on>[imx]*)(?:-(?<off>[imx\-]*))?/.exec(e).groups;s??="";let n=(t.getCurrentModX()||r.includes("x"))&&!s.includes("x"),a=Be(r),o=Be(s),i={};if(a&&(i.enable=a),o&&(i.disable=o),e.endsWith(")"))return t.replaceCurrentModX(n),C(d.Directive,e,{kind:Q.flags,flags:i});if(e.endsWith(":")){t.pushModX(n),t.numOpenGroups++;let c=C(d.GroupOpen,e,{kind:A.group});return(a||o)&&(c.flags=i),c}throw new Error(`Unexpected flag modifier "${e}"`)}function Kt(e){let t={};if(e[0]==="{"){let{min:r,max:s}=/^\{(?<min>\d*)(?:,(?<max>\d*))?/.exec(e).groups,n=1e5;if(+r>n||+s>n)throw new Error("Quantifier value unsupported in Oniguruma");t.min=+r,t.max=s===void 0?+r:s===""?1/0:+s,t.greedy=!e.endsWith("?"),t.possessive=!1}else t.min=e[0]==="+"?1:0,t.max=e[0]==="?"?1:1/0,t.greedy=e[1]!=="?",t.possessive=e[1]==="+";return C(d.Quantifier,e,t)}function Qt(e){let t=e[1].toLowerCase();return C(d.CharacterSet,e,{kind:{d:E.digit,h:E.hex,s:E.space,w:E.word}[t],negate:e[1]!==t})}function Xt(e){let{p:t,neg:r,value:s}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[ \w]+)/.exec(e).groups,n=t==="P"&&!r||t==="p"&&!!r;return C(d.CharacterSet,e,{kind:E.property,negate:n,value:s})}function Be(e){let 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 qt(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}"`);let t=e[2]==="{"?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2),r=parseInt(t,16);if(r>1310719)throw new Error(`Invalid out of range "${e}"`);if(r>1114111)throw new Error(`Invalid out of range in JS "${e}"`);return r}function zt(e,t){let{raw:r,inCharClass:s}=e,n=r.slice(1);if(!s&&(n!=="0"&&n.length===1||n[0]!=="0"&&+n<=t))return[C(d.Backreference,r)];let a=[],o=n.match(/^[0-7]+|\d/g);for(let i=0;i<o.length;i++){let c=o[i],p;if(i===0&&c!=="8"&&c!=="9"){if(p=parseInt(c,8),p>127)throw new Error(h`Octal encoded byte above 177 unsupported "${r}"`)}else p=c.codePointAt(0);a.push(C(d.Character,(i===0?"\\":"")+c,{value:p}))}return a}function Ke(e){if([...e].length!==1)throw new Error(`Expected "${e}" to be a single code point`)}function q({alternatives:e},t){return e.length===1&&e[0].elements.length===1&&(!t||t(e[0].elements[0]))}function M({type:e,kind:t}){return e===u.Assertion&&(t===m.lookahead||t===m.lookbehind)}function oe({type:e,min:t}){return e===u.Assertion||e===u.Directive||e===u.Quantifier&&!t}function N(e,t,r){let s=e.node;for(;s.parent;)s=s.parent;function n(o,i){for(let c=0;c<o.length;c++){let p=a(o[c],i,c,o);c=Math.max(-1,c+p)}}function a(o,i=null,c=null,p=null){let l=0,f=!1,w={node:o,parent:i,key:c,container:p,ast:s,remove(){I(p,"Container expected").splice(Math.max(0,c+l),1),l-=1},removeAllNextSiblings(){return I(p,"Container expected").splice(c+1)},removeAllPrevSiblings(){let _=c+l;return l-=_,I(p,"Container expected").splice(0,Math.max(0,_))},replaceWith(_){Jt(_,i),p?p[Math.max(0,c+l)]=_:i[c]=_},skip(){f=!0}},g=Zt(o).find(_=>!!r[_]),y=g&&r[g],b=typeof y=="function"?y:y?.enter,F=y?.exit;if(b?.(w,t),!f)switch(o.type){case u.Regex:a(o.pattern,o,"pattern"),a(o.flags,o,"flags");break;case u.Alternative:case u.CharacterClass:n(o.elements,o);break;case u.Assertion:M(o)&&n(o.alternatives,o);break;case u.Backreference:case u.Character:case u.CharacterSet:case u.Directive:case u.Flags:case u.Recursion:case u.Subroutine:case u.VariableLengthCharacterSet:break;case u.CapturingGroup:case u.Group:case u.Pattern:n(o.alternatives,o);break;case u.CharacterClassIntersection:n(o.classes,o);break;case u.CharacterClassRange:a(o.min,o,"min"),a(o.max,o,"max");break;case u.Quantifier:a(o.element,o,"element");break;default:throw new Error(`Unexpected node type "${o.type}"`)}return F?.(w,t),l}a(e.node,e.parent,e.key,e.container)}var Qe={AnyGroup:"AnyGroup",AnyNode:"AnyNode"};function Zt(e){let{type:t}=e,r=[Qe.AnyNode];return(t===u.CapturingGroup||t===u.Group||M(e))&&r.push(Qe.AnyGroup),r.push(t),r}function Jt(e,t){"parent"in t&&(e.parent=t)}var u={Alternative:"Alternative",Assertion:"Assertion",Backreference:"Backreference",CapturingGroup:"CapturingGroup",Character:"Character",CharacterClass:"CharacterClass",CharacterClassIntersection:"CharacterClassIntersection",CharacterClassRange:"CharacterClassRange",CharacterSet:"CharacterSet",Directive:"Directive",Flags:"Flags",Group:"Group",Pattern:"Pattern",Quantifier:"Quantifier",Regex:"Regex",Subroutine:"Subroutine",VariableLengthCharacterSet:"VariableLengthCharacterSet",Recursion:"Recursion"},m={line_end:"line_end",line_start:"line_start",lookahead:"lookahead",lookbehind:"lookbehind",search_start:"search_start",string_end:"string_end",string_end_newline:"string_end_newline",string_start:"string_start",word_boundary:"word_boundary"},k=E,Z=Q,z={grapheme:"grapheme",newline:"newline"};function J({tokens:e,flags:t,rules:r},s){let n={skipBackrefValidation:!1,skipPropertyNameValidation:!1,verbose:!1,...s},a={capturingGroups:[],current:0,hasNumberedRef:!1,namedGroupsByName:new Map,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],token:null,tokens:e,verbose:n.verbose,walk:o};function o(g,y){let b=e[a.current];switch(a.parent=g,a.token=b,a.current++,b.type){case d.Alternator:return O();case d.Assertion:return ze(b);case d.Backreference:return Yt(a);case d.Character:return Ze(b.value);case d.CharacterClassHyphen:return er(a,y);case d.CharacterClassOpen:return tr(a,y);case d.CharacterSet:return rr(a);case d.Directive:return ur(b);case d.GroupOpen:return nr(a,y);case d.Quantifier:return sr(a);case d.Subroutine:return ar(a);case d.VariableLengthCharacterSet:return dr(b.kind);default:throw new Error(`Unexpected token type "${b.type}"`)}}let i=gr(pr(),lr(t)),c=i.pattern.alternatives[0];for(;a.current<e.length;){let g=o(c,{});g.type===u.Alternative?(i.pattern.alternatives.push(g),c=g):c.elements.push(g)}let{capturingGroups:p,hasNumberedRef:l,namedGroupsByName:f,subroutines:w}=a;if(l&&f.size&&!r.captureGroup)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(let{ref:g}of w)if(typeof g=="number"){if(g>p.length)throw new Error("Subroutine uses a group number that's not defined")}else if(f.has(g)){if(f.get(g).length>1)throw new Error(h`Subroutine uses a duplicate group name "\g<${g}>"`)}else throw new Error(h`Subroutine uses a group name that's not defined "\g<${g}>"`);return N({node:i},null,{AnyNode({node:g,parent:y}){g.parent=y}}),i}function Yt(e){let{raw:t}=e.token,r=/^\\k[<']/.test(t),s=r?t.slice(3,-1):t.slice(1),n=(a,o=!1)=>{let i=e.capturingGroups.length,c=!1;if(a>i)if(e.skipBackrefValidation)c=!0;else throw new Error(`Not enough capturing groups defined to the left "${t}"`);return e.hasNumberedRef=!0,ie(o?i+1-a:a,{orphan:c})};if(r){let a=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(s);if(a)return n(+a.groups.num,!!a.groups.sign);if(/[-+]/.test(s))throw new Error(`Invalid backref name "${t}"`);if(!e.namedGroupsByName.has(s))throw new Error(`Group name not defined to the left "${t}"`);return ie(s)}return n(+s)}function er(e,t){let{parent:r,tokens:s,walk:n}=e,a=r.elements.at(-1),o=s[e.current];if(a&&a.type!==u.CharacterClass&&a.type!==u.CharacterClassRange&&o&&o.type!==d.CharacterClassOpen&&o.type!==d.CharacterClassClose&&o.type!==d.CharacterClassIntersector){let i=n(r,t);if(a.type===u.Character&&i.type===u.Character)return r.elements.pop(),cr(a,i);throw new Error("Invalid character class range")}return Ze(45)}function tr(e,t){let{token:r,tokens:s,verbose:n,walk:a}=e,o=s[e.current],i=Ee({negate:r.negate}),c=i.elements[0],p=Xe(o);for(;p.type!==d.CharacterClassClose;){if(p.type===d.CharacterClassIntersector)c.classes.push(Ee({negate:!1,baseOnly:!0})),e.current++;else{let l=c.classes.at(-1);l.elements.push(a(l,t))}p=Xe(s[e.current],o)}if(n||kr(c),c.classes.length===1){let l=c.classes[0];l.negate=i.negate!==l.negate,i=l}return e.current++,i}function rr({token:e,skipPropertyNameValidation:t}){let{kind:r,negate:s,value:n}=e;if(r===E.property){let a=K(n);if(De.has(a))r=E.posix,n=a;else return V(n,{negate:s,skipPropertyNameValidation:t})}return r===E.posix?{type:u.CharacterSet,kind:k.posix,negate:s,value:n}:ce(r,{negate:s})}function nr(e,t){let{token:r,tokens:s,capturingGroups:n,namedGroupsByName:a,verbose:o,walk:i}=e,c=or(r);c.type===u.CapturingGroup&&(n.push(c),c.name&&B(a,c.name,[]).push(c));let p=qe(s[e.current]);for(;p.type!==d.GroupClose;){if(p.type===d.Alternator)c.alternatives.push(O()),e.current++;else{let l=c.alternatives.at(-1);l.elements.push(i(l,t))}p=qe(s[e.current])}return o||(c=mr(c)),e.current++,c}function sr({token:e,parent:t}){let{min:r,max:s,greedy:n,possessive:a}=e,o=t.elements.at(-1);if(!o||o.type===u.Assertion||o.type===u.Directive)throw new Error("Quantifier requires a repeatable token");let i=fr(o,r,s,n,a);return t.elements.pop(),i}function ar(e){let{token:t,capturingGroups:r,subroutines:s}=e,n=t.raw.slice(3,-1),a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(n);if(a){let i=+a.groups.num,c=r.length;if(e.hasNumberedRef=!0,n={"":i,"+":c+i,"-":c+1-i}[a.groups.sign],n<1)throw new Error("Invalid subroutine number")}else n==="0"&&(n=0);let o=hr(n);return s.push(o),o}function O(){return{type:u.Alternative,elements:[]}}function ze({type:e,kind:t,negate:r}){if(e===d.GroupOpen)return ue({behind:t===A.lookbehind,negate:r});let s=I({"^":m.line_start,$:m.line_end,"\\A":m.string_start,"\\b":m.word_boundary,"\\B":m.word_boundary,"\\G":m.search_start,"\\z":m.string_end,"\\Z":m.string_end_newline}[t],`Unexpected assertion kind "${t}"`),n={type:u.Assertion,kind:s};return s===m.word_boundary&&(n.negate=t===h`\B`),n}function ie(e,t){let r=!!t?.orphan;return{type:u.Backreference,...r&&{orphan:r},ref:e}}function or(e){let{kind:t,number:r,name:s,flags:n}=e;switch(t){case A.atomic:return P({atomic:!0});case A.capturing:return Ae(r,s);case A.group:return P({flags:n});case A.lookahead:case A.lookbehind:return ze(e);default:throw new Error(`Unexpected group kind "${t}"`)}}function Ae(e,t){let r=t!==void 0;if(r&&!wr(t))throw new Error(`Group name "${t}" invalid in Oniguruma`);return{type:u.CapturingGroup,number:e,...r&&{name:t},alternatives:[O()]}}function Ze(e){return{type:u.Character,value:e}}function Ee(e){let t={baseOnly:!1,negate:!1,...e};return{type:u.CharacterClass,negate:t.negate,elements:t.baseOnly?[]:[ir()]}}function ir(){return{type:u.CharacterClassIntersection,classes:[Ee({negate:!1,baseOnly:!0})]}}function cr(e,t){if(t.value<e.value)throw new Error("Character class range out of order");return{type:u.CharacterClassRange,min:e,max:t}}function ce(e,{negate:t}){let r={type:u.CharacterSet,kind:I(k[e],`Unexpected character set kind "${e}"`)};return(e===E.digit||e===E.hex||e===E.space||e===E.word)&&(r.negate=t),r}function ur({kind:e,flags:t}){let r={type:u.Directive,kind:I(Z[e],`Unexpected directive kind "${e}"`)};return e===Q.flags&&(r.flags=t),r}function lr({ignoreCase:e,dotAll:t,extended:r,digitIsAscii:s,spaceIsAscii:n,wordIsAscii:a}){return{type:u.Flags,ignoreCase:e,dotAll:t,extended:r,digitIsAscii:s,spaceIsAscii:n,wordIsAscii:a}}function P(e){let t=e?.atomic,r=e?.flags;return{type:u.Group,...t&&{atomic:t},...r&&{flags:r},alternatives:[O()]}}function ue(e){let t={behind:!1,negate:!1,...e};return{type:u.Assertion,kind:t.behind?m.lookbehind:m.lookahead,negate:t.negate,alternatives:[O()]}}function pr(){return{type:u.Pattern,alternatives:[O()]}}function fr(e,t,r,s,n){if(r<t)throw new Error("Quantifier range out of order");return{type:u.Quantifier,min:t,max:r,greedy:s,possessive:n,element:e}}function gr(e,t){return{type:u.Regex,pattern:e,flags:t}}function hr(e){return{type:u.Subroutine,ref:e}}function V(e,t){let r={negate:!1,skipPropertyNameValidation:!1,...t};return{type:u.CharacterSet,kind:k.property,value:r.skipPropertyNameValidation?e:Cr(e),negate:r.negate}}function dr(e){return{type:u.VariableLengthCharacterSet,kind:I({"\\R":z.newline,"\\X":z.grapheme}[e],`Unexpected varcharset kind "${e}"`)}}function Cr(e){let t=K(e);if(ye.has(t))throw new Error(h`Unicode property "\p{${e}}" unsupported in Oniguruma`);let r=ke.get(t);return r||e.trim().replace(/\s+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,s=>s[0].toUpperCase()+s.slice(1).toLowerCase())}function mr(e){let t=e.alternatives[0].elements[0];return e.type===u.Group&&q(e,r=>r.type===u.Group)&&!(e.atomic&&t.flags)&&!(e.flags&&(t.atomic||t.flags))?(e.atomic?t.atomic=!0:e.flags&&(t.flags=e.flags),t):e}function wr(e){return!/^(?:[-\d]|$)/.test(e)}function kr(e){for(let t=0;t<e.classes.length;t++){let r=e.classes[t],s=r.elements[0];r.elements.length===1&&s.type===u.CharacterClass&&(e.classes[t]=s,s.negate=r.negate!==s.negate)}}function Xe(e,t){return I(e,`${t?.value===93?"Empty":"Unclosed"} character class`)}function qe(e){return I(e,"Unclosed group")}var S=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function D(e,t,r,s){let n=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),a=[!1],o=0,i="";for(let c of e.matchAll(n)){let{0:p,groups:{$skip:l}}=c;if(!l&&(!s||s===S.DEFAULT==!o)){r instanceof Function?i+=r(c,{context:o?S.CHAR_CLASS:S.DEFAULT,negated:a[a.length-1]}):i+=r;continue}p[0]==="["?(o++,a.push(p[1]==="^")):p==="]"&&o&&(o--,a.pop()),i+=p}return i}function Je(e,t,r,s){D(e,t,r,s)}function yr(e,t,r=0,s){if(!new RegExp(t,"su").test(e))return null;let n=new RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");n.lastIndex=r;let a=0,o;for(;o=n.exec(e);){let{0:i,groups:{$skip:c}}=o;if(!c&&(!s||s===S.DEFAULT==!a))return o;i==="["?a++:i==="]"&&a&&a--,n.lastIndex==o.index&&n.lastIndex++}return null}function Y(e,t,r){return!!yr(e,t,0,r)}function Ye(e,t){let r=/\\?./gsu;r.lastIndex=t;let s=e.length,n=0,a=1,o;for(;o=r.exec(e);){let[i]=o;if(i==="[")n++;else if(n)i==="]"&&n--;else if(i==="(")a++;else if(i===")"&&(a--,!a)){s=o.index;break}}return e.slice(t,s)}var v="$E$",ee=class e extends RegExp{_captureMap;_namesByIndex;constructor(t,r,s){if(t instanceof RegExp&&s)throw new Error("Cannot provide options when copying a regexp");let n=!!s?.useEmulationGroups,a=n?br(t):null;super(a?.expression||t,r);let o=n?a:t instanceof e?t:null;o&&(this._captureMap=o._captureMap,this._namesByIndex=o._namesByIndex)}exec(t){let r=RegExp.prototype.exec.call(this,t);if(!r||!this._captureMap)return r;let s=[...r];r.length=1;let n;this.hasIndices&&(n=[...r.indices],r.indices.length=1);for(let a=1;a<s.length;a++)if(this._captureMap[a].exclude){let o=this._captureMap[a].transfer;if(o&&r.length>o){r[o]=s[a];let i=this._namesByIndex[o];i&&(r.groups[i]=s[a],this.hasIndices&&(r.indices.groups[i]=n[a])),this.hasIndices&&(r.indices[o]=n[a])}}else r.push(s[a]),this.hasIndices&&r.indices.push(n[a]);return r}};function br(e){let t=v.replace(/\$/g,"\\$"),r=[{exclude:!1}],s={0:""},n=0;return e=D(e,String.raw`\((?:(?!\?)|\?<(?![=!])(?<name>[^>]+)>)(?<mark>(?:\$(?<transfer>[1-9]\d*))?${t})?`,({0:a,groups:{name:o,mark:i,transfer:c}})=>i?(r.push({exclude:!0,transfer:c&&+c}),a.slice(0,-i.length)):(n++,o&&(s[n]=o),r.push({exclude:!1}),a),S.DEFAULT),{_captureMap:r,_namesByIndex:s,expression:e}}var et=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function tt(e,t,r,s){return e.slice(0,t)+s+e.slice(t+r.length)}var rt=new RegExp(String.raw`(?<noncapturingStart>${et})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function $e(e,t){if(!/\(\?>/.test(e))return e;let r="(?>",s=`(?:(?=(${t?.useEmulationGroups?v:""}`,n=[0],a=0,o=0,i=NaN,c;do{c=!1;let p=0,l=0,f=!1,w;for(rt.lastIndex=Number.isNaN(i)?0:i+s.length;w=rt.exec(e);){let{0:g,index:y,groups:{capturingStart:b,noncapturingStart:F}}=w;if(g==="[")p++;else if(p)g==="]"&&p--;else if(g===r&&!f)i=y,f=!0;else if(f&&F)l++;else if(b)f?l++:(a++,n.push(a+o));else if(g===")"&&f){if(!l){o++,e=`${e.slice(0,i)}${s}${e.slice(i+r.length,y)}))<$$${o+a}>)${e.slice(y+1)}`,c=!0;break}l--}}}while(c);return e=D(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:p,groups:{backrefNum:l,wrappedBackrefNum:f}})=>{if(l){let w=+l;if(w>n.length-1)throw new Error(`Backref "${p}" greater than number of captures`);return`\\${n[w]}`}return`\\${f}`},S.DEFAULT),e}var nt=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Se=new RegExp(String.raw`
\\(?: \d+

@@ -134,7 +134,7 @@ | c[A-Za-z]

))?
| (?<qBase>${st})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
| (?<qBase>${nt})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
| \\?.
`.replace(/\s+/g,""),"gsu");function _e(e){if(!new RegExp(`${st}\\+`).test(e))return e;let t=[],r=null,s=null,n="",a=0,o;for(Se.lastIndex=0;o=Se.exec(e);){let{0:i,index:c,groups:{qBase:p,qMod:l,invalidQ:f}}=o;if(i==="[")a||(s=c),a++;else if(i==="]")a?a--:s=null;else if(!a)if(l==="+"&&n&&!n.startsWith("(")){if(f)throw new Error(`Invalid quantifier "${i}"`);let w=-1;if(/^\{\d+\}$/.test(p))e=rt(e,c+p.length,l,"");else{if(n===")"||n==="]"){let g=n===")"?r:s;if(g===null)throw new Error(`Invalid unmatched "${n}"`);e=`${e.slice(0,g)}(?>${e.slice(g,c)}${p})${e.slice(c+i.length)}`}else e=`${e.slice(0,c-n.length)}(?>${n}${p})${e.slice(c+i.length)}`;w+=4}Se.lastIndex+=w}else i[0]==="("?t.push(c):i===")"&&(r=t.length?t.pop():null);n=i}return e}var te=class e extends ee{#e;constructor(t,r,s){let n={useEmulationGroups:!1,strategy:null,...s};super(t,r,{useEmulationGroups:n.useEmulationGroups}),n.strategy?this.#e=n.strategy:t instanceof e&&(this.#e=t.#e)}exec(t){let r=super.exec,s=this.global||this.sticky,n=this.lastIndex,a=this.#e;if(a==="line_or_search_start"&&s&&this.lastIndex){this.lastIndex=0;let o=r.call(this,t.slice(n));return o&&Ar(t,this,o,n),o}if(a==="not_search_start"){let o=r.call(this,t);if(o?.index===n){let i=s?this:new RegExp(this.source,`g${this.flags}`);i.lastIndex=o.index+1,o=r.call(i,t)}return o}return r.call(this,t)}};function Ar(e,t,r,s){if(r.input=e,r.index+=s,t.lastIndex+=s,t.hasIndices){let n=r.indices;for(let o=0;o<n.length;o++){let i=n[o];n[o]=[i[0]+s,i[1]+s]}let a=n.groups;a&&Object.keys(a).forEach(o=>{let i=a[o];a[o]=[i[0]+s,i[1]+s]})}}function at(e){let t=e.pattern.alternatives,r=t[0].elements[0];if(t.length>1||!r)return null;let s=q(e.pattern,o=>o.type===u.CapturingGroup||o.type===u.Group)&&r.alternatives.length===1,n=s?r.alternatives[0]:t[0],a=s?n.elements[0]:r;if(!a)return null;if((a.type===u.CapturingGroup||a.type===u.Group)&&a.alternatives.length===2&&a.alternatives[0].elements.length===1&&a.alternatives[1].elements.length===1){let o=a.alternatives[0].elements[0],i=a.alternatives[1].elements[0];if(o.kind===m.line_start&&i.kind===m.search_start||o.kind===m.search_start&&i.kind===m.line_start)return o.kind===m.line_start?a.alternatives.pop():a.alternatives.shift(),"line_or_search_start"}if(le(a,{negate:!0}))return a.parent.elements.shift(),"not_search_start";for(let o=0;o<n.elements.length;o++){let i=n.elements[o];if(!oe(i))break;if(le(i,{negate:!0}))return n.elements.splice(o,1),"not_search_start"}return null}function le(e,t){return M(e)&&e.negate===t.negate&&q(e,r=>r.kind===m.search_start)}var ve=String.raw,ot=ve`(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})`,it=ve`\u{E0061}-\u{E007A}`,ct=()=>new RegExp(ve`[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[${it}]{2}[\u{E0030}-\u{E0039}${it}]{1,3}\u{E007F}|${ot}(?:\u200D${ot})*`,"gu");function lt(e,t){let r={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",ignoreUnsupportedGAnchors:!1,...t},s=r.avoidSubclass?null:at(e),n={accuracy:r.accuracy,asciiWordBoundaries:r.asciiWordBoundaries,flagDirectivesByAlt:new Map,ignoreUnsupportedGAnchors:r.ignoreUnsupportedGAnchors,minTargetEs2024:H(r.bestEffortTarget,"ES2024"),subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};N({node:e},n,pt);let a={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},o={currentFlags:a,prevFlags:null,globalFlags:a,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:n.subroutineRefMap};N({node:e},o,ft);let i={groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer};return N({node:e},i,Sr),s&&(e._strategy=s),e}var pt={Alternative:{enter({node:e,parent:t,key:r},{flagDirectivesByAlt:s}){let n=e.elements.filter(a=>a.kind===Z.flags);for(let a=r+1;a<t.alternatives.length;a++){let o=t.alternatives[a];B(s,o,[]).push(...n)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let r=dt(t.get(e));if(r){let s=re(P({flags:r}),e.elements);s.parent=e,e.elements=[s]}}}},Assertion({node:e,ast:t,remove:r,replaceWith:s},{asciiWordBoundaries:n,ignoreUnsupportedGAnchors:a,supportedGNodes:o,wordIsAscii:i}){let{kind:c,negate:p}=e;if(c===m.line_end)s(G(h`(?=\z|\n)`));else if(c===m.line_start)s(G(h`(?<=\A|\n(?!\z))`));else if(c===m.search_start){if(o.has(e))t.flags.sticky=!0;else if(!a)throw new Error(h`Uses "\G" in a way that's unsupported`);r()}else if(c===m.string_end_newline)s(G(h`(?=\n?\z)`));else if(c===m.word_boundary&&!i&&!n){let l=`(?:(?<=${R})(?!${R})|(?<!${R})(?=${R}))`,f=`(?:(?<=${R})(?=${R})|(?<!${R})(?!${R}))`;s(G(p?f:l))}},CapturingGroup({node:e},{subroutineRefMap:t}){let{name:r,number:s}=e;if(r&&!Ir(r))throw new Error(`Group name "${r}" invalid in JS`);t.set(s,e),r&&t.set(r,e)},CharacterSet({node:e,replaceWith:t},{accuracy:r,minTargetEs2024:s,digitIsAscii:n,spaceIsAscii:a,wordIsAscii:o}){let{kind:i,negate:c,value:p}=e;if(n&&(i===k.digit||p==="digit")){t(ce(k.digit,{negate:c}));return}if(a&&(i===k.space||p==="space")){t(Fe(G($r),c));return}if(o&&(i===k.word||p==="word")){t(ce(k.word,{negate:c}));return}if(i===k.any)t(V("Any"));else if(i===k.digit)t(V("Nd",{negate:c}));else if(i===k.hex)t(V("AHex",{negate:c}));else if(i===k.non_newline)t(G(h`[^\n]`));else if(i===k.space)t(V("space",{negate:c}));else if(i===k.word)t(Fe(G(R),c));else if(i===k.property)we.has(p)||(e.key="sc");else if(i===k.posix)if(!s&&(p==="graph"||p==="print")){if(r==="strict")throw new Error(`POSIX class "${p}" requires min target ES2024 or non-strict accuracy`);let l={graph:"!-~",print:" -~"}[p];c&&(l=`\0-${x(l.codePointAt(0)-1)}${x(l.codePointAt(2)+1)}-\u{10FFFF}`),t(G(`[${l}]`))}else t(Fe(G(se.get(p)),c))},Directive(e,t){let{node:r,parent:s,ast:n,remove:a,replaceWith:o,removeAllPrevSiblings:i,removeAllNextSiblings:c}=e,{kind:p,flags:l}=r;if(p===Z.flags)if(!l.enable&&!l.disable)a();else{let f=re(P({flags:l}),c());o(f),kt(f,e,t,pt)}else if(p===Z.keep){if(s.parent!==n.pattern||n.pattern.alternatives.length>1)throw new Error(h`Uses "\K" in a way that's unsupported`);o(re(ue({behind:!0}),i()))}},Flags({node:e,parent:t}){["digitIsAscii","extended","spaceIsAscii","wordIsAscii"].forEach(r=>delete e[r]),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;let{enable:t,disable:r}=e.flags;t?.extended&&delete t.extended,r?.extended&&delete r.extended,t?.dotAll&&r?.dotAll&&delete t.dotAll,t?.ignoreCase&&r?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,r&&!Object.keys(r).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},Pattern({node:e},{ignoreUnsupportedGAnchors:t,supportedGNodes:r}){let s=[],n=!1,a=!1;for(let o of e.alternatives){let i=mt(o.elements);i?(n=!0,Array.isArray(i)?s.push(...i):s.push(i)):a=!0}if(n){if(!a)s.forEach(o=>r.add(o));else if(!t)throw new Error(h`Uses "\G" in a way that's unsupported`)}},Quantifier({node:e}){if(e.element.type===u.Quantifier){let t=re(P(),[e.element]);t.parent=e,e.element=t}},VariableLengthCharacterSet({node:e,replaceWith:t},{accuracy:r,minTargetEs2024:s}){let{kind:n}=e;if(n===z.newline)t(G(`(?>\r
`.replace(/\s+/g,""),"gsu");function _e(e){if(!new RegExp(`${nt}\\+`).test(e))return e;let t=[],r=null,s=null,n="",a=0,o;for(Se.lastIndex=0;o=Se.exec(e);){let{0:i,index:c,groups:{qBase:p,qMod:l,invalidQ:f}}=o;if(i==="[")a||(s=c),a++;else if(i==="]")a?a--:s=null;else if(!a)if(l==="+"&&n&&!n.startsWith("(")){if(f)throw new Error(`Invalid quantifier "${i}"`);let w=-1;if(/^\{\d+\}$/.test(p))e=tt(e,c+p.length,l,"");else{if(n===")"||n==="]"){let g=n===")"?r:s;if(g===null)throw new Error(`Invalid unmatched "${n}"`);e=`${e.slice(0,g)}(?>${e.slice(g,c)}${p})${e.slice(c+i.length)}`}else e=`${e.slice(0,c-n.length)}(?>${n}${p})${e.slice(c+i.length)}`;w+=4}Se.lastIndex+=w}else i[0]==="("?t.push(c):i===")"&&(r=t.length?t.pop():null);n=i}return e}var te=class e extends ee{#e;rawArgs;constructor(t,r,s){if(t instanceof RegExp){if(s)throw new Error("Cannot provide options when copying a regexp");super(t,r),t instanceof e?(this.#e=t.#e,this.rawArgs=t.rawArgs):(this.#e=null,this.rawArgs={pattern:t.source,flags:t.flags,options:{}}),r!==void 0&&(this.rawArgs.flags=r)}else{let n={strategy:null,useEmulationGroups:!1,...s};super(t,r,{useEmulationGroups:n.useEmulationGroups}),this.#e=n.strategy,this.rawArgs={pattern:t,flags:r??"",options:{...n.strategy?{strategy:n.strategy}:null,...n.useEmulationGroups?{useEmulationGroups:!0}:null}}}}exec(t){let r=super.exec,s=this.global||this.sticky,n=this.lastIndex,a=this.#e;if(a==="line_or_search_start"&&s&&this.lastIndex){this.lastIndex=0;let o=r.call(this,t.slice(n));return o&&xr(t,this,o,n),o}if(a==="not_search_start"){let o=r.call(this,t);if(o?.index===n){let i=s?this:new RegExp(this.source,`g${this.flags}`);i.lastIndex=o.index+1,o=r.call(i,t)}return o}return r.call(this,t)}};function xr(e,t,r,s){if(r.input=e,r.index+=s,t.lastIndex+=s,t.hasIndices){let n=r.indices;for(let o=0;o<n.length;o++){let i=n[o];n[o]=[i[0]+s,i[1]+s]}let a=n.groups;a&&Object.keys(a).forEach(o=>{let i=a[o];a[o]=[i[0]+s,i[1]+s]})}}function st(e){let t=e.pattern.alternatives,r=t[0].elements[0];if(t.length>1||!r)return null;let s=q(e.pattern,o=>o.type===u.CapturingGroup||o.type===u.Group)&&r.alternatives.length===1,n=s?r.alternatives[0]:t[0],a=s?n.elements[0]:r;if(!a)return null;if((a.type===u.CapturingGroup||a.type===u.Group)&&a.alternatives.length===2&&a.alternatives[0].elements.length===1&&a.alternatives[1].elements.length===1){let o=a.alternatives[0].elements[0],i=a.alternatives[1].elements[0];if(o.kind===m.line_start&&i.kind===m.search_start||o.kind===m.search_start&&i.kind===m.line_start)return o.kind===m.line_start?a.alternatives.pop():a.alternatives.shift(),"line_or_search_start"}if(le(a,{negate:!0}))return a.parent.elements.shift(),"not_search_start";for(let o=0;o<n.elements.length;o++){let i=n.elements[o];if(!oe(i))break;if(le(i,{negate:!0}))return n.elements.splice(o,1),"not_search_start"}return null}function le(e,t){return M(e)&&e.negate===t.negate&&q(e,r=>r.kind===m.search_start)}var ve=String.raw,at=ve`(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})`,ot=ve`\u{E0061}-\u{E007A}`,it=()=>new RegExp(ve`[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[${ot}]{2}[\u{E0030}-\u{E0039}${ot}]{1,3}\u{E007F}|${at}(?:\u200D${at})*`,"gu");function ut(e,t){let r={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",ignoreUnsupportedGAnchors:!1,...t},s=r.avoidSubclass?null:st(e),n={accuracy:r.accuracy,asciiWordBoundaries:r.asciiWordBoundaries,flagDirectivesByAlt:new Map,ignoreUnsupportedGAnchors:r.ignoreUnsupportedGAnchors,minTargetEs2024:H(r.bestEffortTarget,"ES2024"),subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};N({node:e},n,lt);let a={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},o={currentFlags:a,prevFlags:null,globalFlags:a,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:n.subroutineRefMap};N({node:e},o,pt);let i={groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer};return N({node:e},i,Er),s&&(e._strategy=s),e}var lt={Alternative:{enter({node:e,parent:t,key:r},{flagDirectivesByAlt:s}){let n=e.elements.filter(a=>a.kind===Z.flags);for(let a=r+1;a<t.alternatives.length;a++){let o=t.alternatives[a];B(s,o,[]).push(...n)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let r=gt(t.get(e));if(r){let s=re(P({flags:r}),e.elements);s.parent=e,e.elements=[s]}}}},Assertion({node:e,ast:t,remove:r,replaceWith:s},{asciiWordBoundaries:n,ignoreUnsupportedGAnchors:a,supportedGNodes:o,wordIsAscii:i}){let{kind:c,negate:p}=e;if(c===m.line_end)s(G(h`(?=\z|\n)`));else if(c===m.line_start)s(G(h`(?<=\A|\n(?!\z))`));else if(c===m.search_start){if(o.has(e))t.flags.sticky=!0;else if(!a)throw new Error(h`Uses "\G" in a way that's unsupported`);r()}else if(c===m.string_end_newline)s(G(h`(?=\n?\z)`));else if(c===m.word_boundary&&!i&&!n){let l=`(?:(?<=${R})(?!${R})|(?<!${R})(?=${R}))`,f=`(?:(?<=${R})(?=${R})|(?<!${R})(?!${R}))`;s(G(p?f:l))}},CapturingGroup({node:e},{subroutineRefMap:t}){let{name:r,number:s}=e;if(r&&!Fr(r))throw new Error(`Group name "${r}" invalid in JS`);t.set(s,e),r&&t.set(r,e)},CharacterSet({node:e,replaceWith:t},{accuracy:r,minTargetEs2024:s,digitIsAscii:n,spaceIsAscii:a,wordIsAscii:o}){let{kind:i,negate:c,value:p}=e;if(n&&(i===k.digit||p==="digit")){t(ce(k.digit,{negate:c}));return}if(a&&(i===k.space||p==="space")){t(Fe(G(Ar),c));return}if(o&&(i===k.word||p==="word")){t(ce(k.word,{negate:c}));return}if(i===k.any)t(V("Any"));else if(i===k.digit)t(V("Nd",{negate:c}));else if(i===k.hex)t(V("AHex",{negate:c}));else if(i===k.non_newline)t(G(h`[^\n]`));else if(i===k.space)t(V("space",{negate:c}));else if(i===k.word)t(Fe(G(R),c));else if(i===k.property)we.has(p)||(e.key="sc");else if(i===k.posix)if(!s&&(p==="graph"||p==="print")){if(r==="strict")throw new Error(`POSIX class "${p}" requires min target ES2024 or non-strict accuracy`);let l={graph:"!-~",print:" -~"}[p];c&&(l=`\0-${x(l.codePointAt(0)-1)}${x(l.codePointAt(2)+1)}-\u{10FFFF}`),t(G(`[${l}]`))}else t(Fe(G(se.get(p)),c))},Directive(e,t){let{node:r,parent:s,ast:n,remove:a,replaceWith:o,removeAllPrevSiblings:i,removeAllNextSiblings:c}=e,{kind:p,flags:l}=r;if(p===Z.flags)if(!l.enable&&!l.disable)a();else{let f=re(P({flags:l}),c());o(f),mt(f,e,t,lt)}else if(p===Z.keep){if(s.parent!==n.pattern||n.pattern.alternatives.length>1)throw new Error(h`Uses "\K" in a way that's unsupported`);o(re(ue({behind:!0}),i()))}},Flags({node:e,parent:t}){["digitIsAscii","extended","spaceIsAscii","wordIsAscii"].forEach(r=>delete e[r]),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;let{enable:t,disable:r}=e.flags;t?.extended&&delete t.extended,r?.extended&&delete r.extended,t?.dotAll&&r?.dotAll&&delete t.dotAll,t?.ignoreCase&&r?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,r&&!Object.keys(r).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},Pattern({node:e},{ignoreUnsupportedGAnchors:t,supportedGNodes:r}){let s=[],n=!1,a=!1;for(let o of e.alternatives)if(o.elements.length===1&&o.elements[0].kind===m.search_start)o.elements.pop();else{let i=dt(o.elements);i?(n=!0,Array.isArray(i)?s.push(...i):s.push(i)):a=!0}if(n){if(!a)s.forEach(o=>r.add(o));else if(!t)throw new Error(h`Uses "\G" in a way that's unsupported`)}},Quantifier({node:e}){if(e.element.type===u.Quantifier){let t=re(P(),[e.element]);t.parent=e,e.element=t}},VariableLengthCharacterSet({node:e,replaceWith:t},{accuracy:r,minTargetEs2024:s}){let{kind:n}=e;if(n===z.newline)t(G(`(?>\r
?|[
\v\f\x85\u2028\u2029])`));else if(n===z.grapheme){if(r==="strict")throw new Error(h`Use of "\X" requires non-strict accuracy`);let a=s?h`\p{RGI_Emoji}`:ct().source.replace(/\\u\{/g,"\\x{");t(G(h`(?>\r\n|${a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}))}else throw new Error(`Unexpected varcharset kind "${n}"`)}},ft={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:r}){let{orphan:s,ref:n}=e;s||r.set(e,[...t.get(n).map(({node:a})=>a)])},CapturingGroup:{enter({node:e,replaceWith:t,skip:r},{groupOriginByCopy:s,groupsByName:n,multiplexCapturesToLeftByRef:a,openRefs:o,reffedNodesByReferencer:i}){let c=s.get(e);if(c&&o.has(e.number)){let l=ut(e.number);i.set(l,o.get(e.number)),t(l),r();return}o.set(e.number,e),a.set(e.number,[]),e.name&&B(a,e.name,[]);let p=a.get(e.name??e.number);for(let l=0;l<p.length;l++){let f=p[l];if(c===f.node||c&&c===f.origin||e===f.origin){p.splice(l,1);break}}if(a.get(e.number).push({node:e,origin:c}),e.name&&a.get(e.name).push({node:e,origin:c}),e.name){let l=B(n,e.name,new Map),f=!1;if(c)f=!0;else for(let w of l.values())if(!w.hasDuplicateNameToRemove&&gt(w.node,e,{ancestorsParticipate:!0})){f=!0;break}n.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:f})}c&&(e._originNumber=c.number)},exit({node:e},{openRefs:t}){t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=L(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Recursion({node:e,parent:t},{reffedNodesByReferencer:r}){let{ref:s}=e,n=t;for(;(n=n.parent)&&!(n.type===u.CapturingGroup&&(n.name===s||n.number===s)););r.set(e,n)},Subroutine(e,t){let{node:r,replaceWith:s}=e,{ref:n}=r,a=t.subroutineRefMap.get(n),o=n===0,i=o?ut(0):ht(a,t.groupOriginByCopy,null),c=i;if(!o){let p=dt(vr(a,f=>f.type===u.Group&&!!f.flags)),l=p?L(t.globalFlags,p):t.globalFlags;_r(l,t.currentFlags)||(c=re(P({flags:Fr(l)}),[i]))}s(c),o||kt(c,e,t,ft)}},Sr={Backreference({node:e,replaceWith:t},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let n=r.reffedNodesByReferencer.get(e).filter(a=>gt(a,e,{ancestorsParticipate:!1}));if(!n.length)t(ue({negate:!0}));else if(n.length>1){let a=n.map(o=>pe(O(),[ie(o.number)]));t(pe(P(),a))}else e.ref=n[0].number},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Recursion({node:e},t){e.ref!==0&&(e.ref=t.reffedNodesByReferencer.get(e).number)},Regex:{exit({node:e},t){let r=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let s=0;s<r;s++){let n=Ae();e.pattern.alternatives.at(-1).elements.push(n)}}}},$r="[ -\r ]",R=h`[\p{L}\p{M}\p{N}\p{Pc}]`;function pe(e,t){return t.forEach(r=>r.parent=e),e[Ie(e)]=t,e}function _r(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function gt(e,t,{ancestorsParticipate:r}){let s=t;do{if(s.type===u.Pattern)return!1;if(s.type===u.Alternative)continue;if(s===e)return r;let n=Ct(s.parent);for(let a of n){if(a===s)break;if(a===e||wt(a,e))return!0}}while(s=s.parent);throw new Error("Unexpected path")}function ht(e,t,r,s){let n=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a==="parent"?n.parent=Array.isArray(r)?s:r:o&&typeof o=="object"?n[a]=ht(o,t,n,r):(a==="type"&&o===u.CapturingGroup&&t.set(n,t.get(e)??e),n[a]=o);return n}function ut(e){return{type:u.Recursion,ref:e}}function vr(e,t){let r=[];for(;e=e.parent;)(!t||t(e))&&r.push(e);return r}function Ie(e){for(let t of["alternatives","classes","elements"])if(e[t])return t;return null}function dt(e){let t=["dotAll","ignoreCase"],r={enable:{},disable:{}};return e.forEach(({flags:s})=>{t.forEach(n=>{s.enable?.[n]&&(delete r.disable[n],r.enable[n]=!0),s.disable?.[n]&&(r.disable[n]=!0)})}),Object.keys(r.enable).length||delete r.enable,Object.keys(r.disable).length||delete r.disable,r.enable||r.disable?r:null}function Fr({dotAll:e,ignoreCase:t}){let r={};return(e||t)&&(r.enable={},e&&(r.enable.dotAll=!0),t&&(r.enable.ignoreCase=!0)),(!e||!t)&&(r.disable={},!e&&(r.disable.dotAll=!0),!t&&(r.disable.ignoreCase=!0)),r}function Ct(e){if(!e)throw new Error("Node expected");if(e.type===u.Quantifier)return[e.element];let t=Ie(e);return t&&e[t]}function mt(e){let t=e.find(r=>r.kind===m.search_start||le(r,{negate:!1})||!oe(r));if(!t)return null;if(t.kind===m.search_start)return t;if(M(t))return t.alternatives[0].elements[0];if(t.type===u.Group||t.type===u.CapturingGroup){let r=[];for(let s of t.alternatives){let n=mt(s.elements);if(!n)return null;Array.isArray(n)?r.push(...n):r.push(n)}return r}return null}function wt(e,t){let r=Ct(e)??[];for(let s of r)if(s===t||wt(s,t))return!0;return!1}function Ir(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function G(e,t){let s=J(X(e),t).pattern.alternatives;return s.length>1||s[0].elements.length>1?pe(P(),s):s[0].elements[0]}function re(e,t){let r=Ie(e);return e[r][0].parent=e,t&&pe(e[r][0],t),e}function Fe(e,t){return e.negate=t,e}function kt(e,{parent:t,key:r,container:s},n,a){N({node:e,parent:t,key:r,container:s},n,a)}function bt(e,t){let r=ne(t),s=H(r.target,"ES2024"),n=H(r.target,"ES2025"),a=r.maxRecursionDepth;if(a!==null&&(!Number.isInteger(a)||a<2||a>100))throw new Error("Invalid maxRecursionDepth; use 2-100 or null");let o=null,i=null;if(!n){let g=[e.flags.ignoreCase];N({node:e},{getCurrentModI:()=>g.at(-1),popModI(){g.pop()},pushModI(y){g.push(y)},setHasCasedChar(){g.at(-1)?o=!0:i=!0}},Gr)}let c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||o)&&!i)},p=null,l={accuracy:r.accuracy,appliedGlobalFlags:c,avoidSubclass:r.avoidSubclass,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},groupNames:new Set,inCharClass:!1,lastNode:p,maxRecursionDepth:a,useAppliedIgnoreCase:!!(!n&&o&&i),useDuplicateNames:n,useFlagMods:n,useFlagV:s,verbose:r.verbose};function f(g){switch(l.lastNode=p,p=g,g.type){case u.Regex:return{pattern:f(g.pattern),flags:f(g.flags),options:{...g.options}};case u.Alternative:return g.elements.map(f).join("");case u.Assertion:return Ur(g,l,f);case u.Backreference:return Or(g,l);case u.CapturingGroup:return Dr(g,l,f);case u.Character:return Tr(g,l);case u.CharacterClass:return Lr(g,l,f);case u.CharacterClassIntersection:if(!l.useFlagV)throw new Error("Use of class intersection requires min target ES2024");return g.classes.map(f).join("&&");case u.CharacterClassRange:return Br(g,l);case u.CharacterSet:return Vr(g,l);case u.Flags:return jr(g,l);case u.Group:return Wr(g,l,f);case u.Pattern:return g.alternatives.map(f).join("|");case u.Quantifier:return f(g.element)+Xr(g);case u.Recursion:return Hr(g,l);default:throw new Error(`Unexpected node type "${g.type}"`)}}let w=f(e);return s||(delete w.options.force.v,w.options.disable.v=!0,w.options.unicodeSetsPlugin=null),w}var Gr={AnyGroup:{enter({node:e},t){let r=t.getCurrentModI();t.pushModI(e.flags?L({ignoreCase:r},e.flags).ignoreCase:r)},exit(e,t){t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){Ge(x(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},r){t(),xt(e,{firstOnly:!0}).length&&r.setHasCasedChar()},CharacterSet({node:e},t){e.kind===k.property&&be.has(e.value)&&t.setHasCasedChar()}},Mr=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),Nr=new Set(["-","\\","]","^","["]),Pr=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),yt=new Map([[9,h`\t`],[10,h`\n`],[11,h`\v`],[12,h`\f`],[13,h`\r`],[8232,h`\u2028`],[8233,h`\u2029`],[65279,h`\uFEFF`]]),Rr=/^\p{Cased}$/u;function Ge(e){return Rr.test(e)}function Ur(e,t,r){let{kind:s,negate:n,alternatives:a}=e;if(M(e))return`(?${`${s===m.lookahead?"":"<"}${n?"!":"="}`}${a.map(r).join("|")})`;if(s===m.string_end)return"$";if(s===m.string_start)return"^";if(s===m.word_boundary)return n?h`\B`:h`\b`;throw new Error(`Unexpected assertion kind "${s}"`)}function Or({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}function Dr({name:e,number:t,alternatives:r,_originNumber:s},n,a){return e&&(n.groupNames.has(e)?n.useDuplicateNames||(e=null):n.groupNames.add(e)),n.captureMap.set(t,{ignoreCase:n.currentFlags.ignoreCase}),`(${e?`?<${e}>`:""}${!n.avoidSubclass&&s?`${s<t?`$${s}`:""}${v}`:""}${r.map(a).join("|")})`}function Tr({value:e},t){let r=x(e),s=j(e,{isAfterBackref:t.lastNode.type===u.Backreference,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(s!==r)return s;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Ge(r)){let n=me(r);return t.inCharClass?n.join(""):n.length>1?`[${n.join("")}]`:n[0]}return r}function Lr({negate:e,parent:t,elements:r},s,n){let a=()=>`[${e?"^":""}${r.map(n).join("")}]`;if(!s.inCharClass){s.inCharClass=!0;let i=a();return s.inCharClass=!1,i}let o=r[0].type;if(!e&&(!s.useFlagV||!s.verbose)&&t.type===u.CharacterClass&&o!==u.CharacterClassIntersection||!s.verbose&&t.type===u.CharacterClassIntersection&&r.length===1&&o!==u.CharacterClass&&o!==u.CharacterClassRange)return r.map(n).join("");if(!s.useFlagV&&t.type===u.CharacterClass)throw new Error("Use of nested character class requires min target ES2024");return a()}function Br(e,t){let r=e.min.value,s=e.max.value,n={isAfterBackref:!1,inCharClass:!0,useFlagV:t.useFlagV},a=j(r,n),o=j(s,n),i="";if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){let c=xt(e);Kr(c).forEach(l=>{i+=Array.isArray(l)?`${j(l[0],n)}-${j(l[1],n)}`:j(l,n)})}return`${a}-${o}${i}`}function Vr({kind:e,negate:t,value:r,key:s},n){if(e===k.dot)return n.currentFlags.dotAll?n.appliedGlobalFlags.dotAll||n.useFlagMods?".":"[^]":h`[^\n]`;if(e===k.digit)return t?h`\D`:h`\d`;if(e===k.property){if(n.useAppliedIgnoreCase&&n.currentFlags.ignoreCase&&be.has(r))throw new Error(`Unicode property "${r}" can't be case-insensitive when other chars have specific case`);return`${t?h`\P`:h`\p`}{${s?`${s}=`:""}${r}}`}if(e===k.word)return t?h`\W`:h`\w`;throw new Error(`Unexpected character set kind "${e}"`)}function jr(e,t){return(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")}function Wr({atomic:e,flags:t,parent:r,alternatives:s},n,a){let o=n.currentFlags;t&&(n.currentFlags=L(o,t));let i=s.map(a).join("|"),c=!n.verbose&&s.length===1&&r.type!==u.Quantifier&&!e&&(!n.useFlagMods||!t)?i:`(?${Qr(e,t,n.useFlagMods)}${i})`;return n.currentFlags=o,c}function Hr({ref:e},t){let r=t.maxRecursionDepth;if(!r)throw new Error("Use of recursion disabled");if(t.accuracy==="strict")throw new Error("Use of recursion requires non-strict accuracy due to depth limit");return e===0?`(?R=${r})`:h`\g<${e}&R=${r}>`}function xt(e,t){let r=!!t?.firstOnly,s=e.min.value,n=e.max.value,a=[];if(s<65&&(n===65535||n>=131071)||s===65536&&n>=131071)return a;for(let o=s;o<=n;o++){let i=x(o);if(!Ge(i))continue;let c=me(i).filter(p=>{let l=p.codePointAt(0);return l<s||l>n});if(c.length&&(a.push(...c),r))break}return a}function j(e,{isAfterBackref:t,inCharClass:r,useFlagV:s}){if(yt.has(e))return yt.get(e);if(e<32||e>126&&e<160||e>262143||t&&qr(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;let n=r?s?Pr:Nr:Mr,a=x(e);return(n.has(a)?"\\":"")+a}function Kr(e){let t=e.map(n=>n.codePointAt(0)).sort((n,a)=>n-a),r=[],s=null;for(let n=0;n<t.length;n++)t[n+1]===t[n]+1?s??=t[n]:s===null?r.push(t[n]):(r.push([s,t[n]]),s=null);return r}function Qr(e,t,r){if(e)return">";let s="";if(t&&r){let{enable:n,disable:a}=t;s=(n?.ignoreCase?"i":"")+(n?.dotAll?"s":"")+(a?"-":"")+(a?.ignoreCase?"i":"")+(a?.dotAll?"s":"")}return`${s}:`}function Xr({min:e,max:t,greedy:r,possessive:s}){let n;return!e&&t===1?n="?":!e&&t===1/0?n="*":e===1&&t===1/0?n="+":e===t?n=`{${e}}`:n=`{${e},${t===1/0?"":t}}`,n+(s?"+":r?"":"?")}function qr(e){return e>47&&e<58}var $=String.raw,zr=$`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,Ne=$`\(\?R=(?<rDepth>[^\)]+)\)|${zr}`,fe=$`\(\?<(?![=!])(?<captureName>[^>]+)>`,D=new RegExp($`${fe}|${Ne}|\(\?|\\?.`,"gsu"),Me="Cannot use multiple overlapping recursions",Pe=new RegExp($`(?:\$[1-9]\d*)?${v.replace(/\$/g,$`\$`)}`,"y");function $t(e,t){if(!new RegExp(Ne,"su").test(e))return e;if(Y(e,$`\(\?\(DEFINE\)`,S.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");let r=!!t?.useEmulationGroups,s=Y(e,$`\\[1-9]`,S.DEFAULT),n=new Map,a=[],o=!1,i=0,c=0,p;for(D.lastIndex=0;p=D.exec(e);){let{0:l,groups:{captureName:f,rDepth:w,gRNameOrNum:g,gRDepth:y}}=p;if(l==="[")i++;else if(i)l==="]"&&i--;else if(w){if(Et(w),o)throw new Error(Me);if(s)throw new Error("Numbered backrefs cannot be used with global recursion");let b=e.slice(0,p.index),F=e.slice(D.lastIndex);if(Y(F,Ne,S.DEFAULT))throw new Error(Me);return At(b,F,+w,!1,r)}else if(g){Et(y);let b=!1;for(let W of a)if(W.name===g||W.num===+g){if(b=!0,W.hasRecursedWithin)throw new Error(Me);break}if(!b)throw new Error($`Recursive \g cannot be used outside the referenced group "\g<${g}&R=${y}>"`);let F=n.get(g),_=et(e,F);if(s&&Y(_,$`${fe}|\((?!\?)`,S.DEFAULT))throw new Error("Numbered backrefs cannot be used with recursion of capturing groups");let ge=e.slice(F,p.index),Re=_.slice(ge.length+l.length),Ue=At(ge,Re,+y,!0,r),vt=e.slice(0,F),Ft=e.slice(F+_.length);e=`${vt}${Ue}${Ft}`,D.lastIndex+=Ue.length-l.length-ge.length-Re.length,a.forEach(W=>W.hasRecursedWithin=!0),o=!0}else if(f)c++,n.set(String(c),D.lastIndex),n.set(f,D.lastIndex),a.push({num:c,name:f});else if(l.startsWith("(")){let b=l==="(";b&&(c++,n.set(String(c),D.lastIndex+(r?Zr(e,D.lastIndex):0))),a.push(b?{num:c}:{})}else l===")"&&a.pop()}return e}function Et(e){let 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 At(e,t,r,s,n){let a=new Set;s&&Ye(e+t,fe,({groups:{captureName:i}})=>{a.add(i)},S.DEFAULT);let o=r-1;return`${e}${St(`(?:${e}`,o,s?a:null,"forward",n)}(?:)${St(`${t})`,o,s?a:null,"backward",n)}${t}`}function St(e,t,r,s,n){let o=c=>s==="backward"?t-c+2-1:c+2,i="";for(let c=0;c<t;c++){let p=o(c);i+=T(e,$`${fe}|\\k<(?<backref>[^>]+)>${n?$`|(?<unnamed>\()(?!\?)(?:${Pe.source})?`:""}`,({0:l,index:f,groups:{captureName:w,backref:g,unnamed:y}})=>{if(g&&r&&!r.has(g))return l;if(y)return`(${v}`;let b=`_$${p}`;return w?`(?<${w}${b}>${n?v:""}`:$`\k<${g}${b}>`},S.DEFAULT)}return i}function Zr(e,t){Pe.lastIndex=t;let r=Pe.exec(e);return r?r[0].length:0}function _t(e,t){let r=ne(t),s=r.avoidSubclass,n=X(e,r.flags,{captureGroup:r.rules.captureGroup}),a=J(n,{skipBackrefValidation:r.rules.allowOrphanBackrefs,verbose:r.verbose}),o=lt(a,{accuracy:r.accuracy,asciiWordBoundaries:r.rules.asciiWordBoundaries,avoidSubclass:s,bestEffortTarget:r.target,ignoreUnsupportedGAnchors:r.rules.ignoreUnsupportedGAnchors}),i=bt(o,r),c={useEmulationGroups:!s},p={pattern:$e(_e($t(i.pattern,c)),c),flags:`${r.hasIndices?"d":""}${r.global?"g":""}${i.flags}${i.options.disable.v?"u":"v"}`},l=!s&&p.pattern.includes(v);return(l||o._strategy)&&(p.subclass={useEmulationGroups:l,strategy:o._strategy??null}),p}function Jr(e,t){let r=t?.flags??"",s=t?.rules?.captureGroup??!1;return J(X(e,r,{captureGroup:s}))}function Yr(e,t){let r=_t(e,t);return r.subclass?new te(r.pattern,r.flags,r.subclass):new RegExp(r.pattern,r.flags)}return Rt(en);})();
\v\f\x85\u2028\u2029])`));else if(n===z.grapheme){if(r==="strict")throw new Error(h`Use of "\X" requires non-strict accuracy`);let a=s?h`\p{RGI_Emoji}`:it().source.replace(/\\u\{/g,"\\x{");t(G(h`(?>\r\n|${a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}))}else throw new Error(`Unexpected varcharset kind "${n}"`)}},pt={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:r}){let{orphan:s,ref:n}=e;s||r.set(e,[...t.get(n).map(({node:a})=>a)])},CapturingGroup:{enter({node:e,replaceWith:t,skip:r},{groupOriginByCopy:s,groupsByName:n,multiplexCapturesToLeftByRef:a,openRefs:o,reffedNodesByReferencer:i}){let c=s.get(e);if(c&&o.has(e.number)){let l=ct(e.number);i.set(l,o.get(e.number)),t(l),r();return}o.set(e.number,e),a.set(e.number,[]),e.name&&B(a,e.name,[]);let p=a.get(e.name??e.number);for(let l=0;l<p.length;l++){let f=p[l];if(c===f.node||c&&c===f.origin||e===f.origin){p.splice(l,1);break}}if(a.get(e.number).push({node:e,origin:c}),e.name&&a.get(e.name).push({node:e,origin:c}),e.name){let l=B(n,e.name,new Map),f=!1;if(c)f=!0;else for(let w of l.values())if(!w.hasDuplicateNameToRemove){f=!0;break}n.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:f})}c&&(e._originNumber=c.number)},exit({node:e},{openRefs:t}){t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=L(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Recursion({node:e,parent:t},{reffedNodesByReferencer:r}){let{ref:s}=e,n=t;for(;(n=n.parent)&&!(n.type===u.CapturingGroup&&(n.name===s||n.number===s)););r.set(e,n)},Subroutine(e,t){let{node:r,replaceWith:s}=e,{ref:n}=r,a=t.subroutineRefMap.get(n),o=n===0,i=o?ct(0):ft(a,t.groupOriginByCopy,null),c=i;if(!o){let p=gt(_r(a,f=>f.type===u.Group&&!!f.flags)),l=p?L(t.globalFlags,p):t.globalFlags;Sr(l,t.currentFlags)||(c=re(P({flags:vr(l)}),[i]))}s(c),o||mt(c,e,t,pt)}},Er={Backreference({node:e,replaceWith:t},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let n=r.reffedNodesByReferencer.get(e).filter(a=>$r(a,e));if(!n.length)t(ue({negate:!0}));else if(n.length>1){let a=n.map(o=>pe(O(),[ie(o.number)]));t(pe(P(),a))}else e.ref=n[0].number},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Recursion({node:e},t){e.ref!==0&&(e.ref=t.reffedNodesByReferencer.get(e).number)},Regex:{exit({node:e},t){let r=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let s=0;s<r;s++){let n=Ae();e.pattern.alternatives.at(-1).elements.push(n)}}}},Ar="[ -\r ]",R=h`[\p{L}\p{M}\p{N}\p{Pc}]`;function pe(e,t){return t.forEach(r=>r.parent=e),e[Ie(e)]=t,e}function Sr(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function $r(e,t){let r=t;do{if(r.type===u.Pattern)return!1;if(r.type===u.Alternative)continue;if(r===e)return!1;let s=ht(r.parent);for(let n of s){if(n===r)break;if(n===e||Ct(n,e))return!0}}while(r=r.parent);throw new Error("Unexpected path")}function ft(e,t,r,s){let n=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a==="parent"?n.parent=Array.isArray(r)?s:r:o&&typeof o=="object"?n[a]=ft(o,t,n,r):(a==="type"&&o===u.CapturingGroup&&t.set(n,t.get(e)??e),n[a]=o);return n}function ct(e){return{type:u.Recursion,ref:e}}function _r(e,t){let r=[];for(;e=e.parent;)(!t||t(e))&&r.push(e);return r}function Ie(e){for(let t of["alternatives","classes","elements"])if(e[t])return t;return null}function gt(e){let t=["dotAll","ignoreCase"],r={enable:{},disable:{}};return e.forEach(({flags:s})=>{t.forEach(n=>{s.enable?.[n]&&(delete r.disable[n],r.enable[n]=!0),s.disable?.[n]&&(r.disable[n]=!0)})}),Object.keys(r.enable).length||delete r.enable,Object.keys(r.disable).length||delete r.disable,r.enable||r.disable?r:null}function vr({dotAll:e,ignoreCase:t}){let r={};return(e||t)&&(r.enable={},e&&(r.enable.dotAll=!0),t&&(r.enable.ignoreCase=!0)),(!e||!t)&&(r.disable={},!e&&(r.disable.dotAll=!0),!t&&(r.disable.ignoreCase=!0)),r}function ht(e){if(!e)throw new Error("Node expected");if(e.type===u.Quantifier)return[e.element];let t=Ie(e);return t&&e[t]}function dt(e){let t=e.find(r=>r.kind===m.search_start||le(r,{negate:!1})||!oe(r));if(!t)return null;if(t.kind===m.search_start)return t;if(M(t))return t.alternatives[0].elements[0];if(t.type===u.Group||t.type===u.CapturingGroup){let r=[];for(let s of t.alternatives){let n=dt(s.elements);if(!n)return null;Array.isArray(n)?r.push(...n):r.push(n)}return r}return null}function Ct(e,t){let r=ht(e)??[];for(let s of r)if(s===t||Ct(s,t))return!0;return!1}function Fr(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function G(e,t){let s=J(X(e),t).pattern.alternatives;return s.length>1||s[0].elements.length>1?pe(P(),s):s[0].elements[0]}function re(e,t){let r=Ie(e);return e[r][0].parent=e,t&&pe(e[r][0],t),e}function Fe(e,t){return e.negate=t,e}function mt(e,{parent:t,key:r,container:s},n,a){N({node:e,parent:t,key:r,container:s},n,a)}function kt(e,t){let r=ne(t),s=H(r.target,"ES2024"),n=H(r.target,"ES2025"),a=r.maxRecursionDepth;if(a!==null&&(!Number.isInteger(a)||a<2||a>100))throw new Error("Invalid maxRecursionDepth; use 2-100 or null");let o=null,i=null;if(!n){let g=[e.flags.ignoreCase];N({node:e},{getCurrentModI:()=>g.at(-1),popModI(){g.pop()},pushModI(y){g.push(y)},setHasCasedChar(){g.at(-1)?o=!0:i=!0}},Ir)}let c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||o)&&!i)},p=null,l={accuracy:r.accuracy,appliedGlobalFlags:c,avoidSubclass:r.avoidSubclass,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:p,maxRecursionDepth:a,useAppliedIgnoreCase:!!(!n&&o&&i),useFlagMods:n,useFlagV:s,verbose:r.verbose};function f(g){switch(l.lastNode=p,p=g,g.type){case u.Regex:return{pattern:f(g.pattern),flags:f(g.flags),options:{...g.options}};case u.Alternative:return g.elements.map(f).join("");case u.Assertion:return Rr(g,l,f);case u.Backreference:return Ur(g,l);case u.CapturingGroup:return Or(g,l,f);case u.Character:return Tr(g,l);case u.CharacterClass:return Dr(g,l,f);case u.CharacterClassIntersection:if(!l.useFlagV)throw new Error("Use of class intersection requires min target ES2024");return g.classes.map(f).join("&&");case u.CharacterClassRange:return Lr(g,l);case u.CharacterSet:return Br(g,l);case u.Flags:return Vr(g,l);case u.Group:return jr(g,l,f);case u.Pattern:return g.alternatives.map(f).join("|");case u.Quantifier:return f(g.element)+Qr(g);case u.Recursion:return Wr(g,l);default:throw new Error(`Unexpected node type "${g.type}"`)}}let w=f(e);return s||(delete w.options.force.v,w.options.disable.v=!0,w.options.unicodeSetsPlugin=null),w}var Ir={AnyGroup:{enter({node:e},t){let r=t.getCurrentModI();t.pushModI(e.flags?L({ignoreCase:r},e.flags).ignoreCase:r)},exit(e,t){t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){Ge(x(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},r){t(),yt(e,{firstOnly:!0}).length&&r.setHasCasedChar()},CharacterSet({node:e},t){e.kind===k.property&&be.has(e.value)&&t.setHasCasedChar()}},Gr=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),Mr=new Set(["-","\\","]","^","["]),Nr=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),wt=new Map([[9,h`\t`],[10,h`\n`],[11,h`\v`],[12,h`\f`],[13,h`\r`],[8232,h`\u2028`],[8233,h`\u2029`],[65279,h`\uFEFF`]]),Pr=/^\p{Cased}$/u;function Ge(e){return Pr.test(e)}function Rr(e,t,r){let{kind:s,negate:n,alternatives:a}=e;if(M(e))return`(?${`${s===m.lookahead?"":"<"}${n?"!":"="}`}${a.map(r).join("|")})`;if(s===m.string_end)return"$";if(s===m.string_start)return"^";if(s===m.word_boundary)return n?h`\B`:h`\b`;throw new Error(`Unexpected assertion kind "${s}"`)}function Ur({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}function Or({name:e,number:t,alternatives:r,_originNumber:s},n,a){return n.captureMap.set(t,{ignoreCase:n.currentFlags.ignoreCase}),`(${e?`?<${e}>`:""}${!n.avoidSubclass&&s?`${s<t?`$${s}`:""}${v}`:""}${r.map(a).join("|")})`}function Tr({value:e},t){let r=x(e),s=j(e,{isAfterBackref:t.lastNode.type===u.Backreference,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(s!==r)return s;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Ge(r)){let n=me(r);return t.inCharClass?n.join(""):n.length>1?`[${n.join("")}]`:n[0]}return r}function Dr({negate:e,parent:t,elements:r},s,n){let a=()=>`[${e?"^":""}${r.map(n).join("")}]`;if(!s.inCharClass){s.inCharClass=!0;let i=a();return s.inCharClass=!1,i}let o=r[0].type;if(!e&&(!s.useFlagV||!s.verbose)&&t.type===u.CharacterClass&&o!==u.CharacterClassIntersection||!s.verbose&&t.type===u.CharacterClassIntersection&&r.length===1&&o!==u.CharacterClass&&o!==u.CharacterClassRange)return r.map(n).join("");if(!s.useFlagV&&t.type===u.CharacterClass)throw new Error("Use of nested character class requires min target ES2024");return a()}function Lr(e,t){let r=e.min.value,s=e.max.value,n={isAfterBackref:!1,inCharClass:!0,useFlagV:t.useFlagV},a=j(r,n),o=j(s,n),i=new Set;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){let c=yt(e);Hr(c).forEach(l=>{i.add(Array.isArray(l)?`${j(l[0],n)}-${j(l[1],n)}`:j(l,n))})}return`${a}-${o}${[...i].join("")}`}function Br({kind:e,negate:t,value:r,key:s},n){if(e===k.dot)return n.currentFlags.dotAll?n.appliedGlobalFlags.dotAll||n.useFlagMods?".":"[^]":h`[^\n]`;if(e===k.digit)return t?h`\D`:h`\d`;if(e===k.property){if(n.useAppliedIgnoreCase&&n.currentFlags.ignoreCase&&be.has(r))throw new Error(`Unicode property "${r}" can't be case-insensitive when other chars have specific case`);return`${t?h`\P`:h`\p`}{${s?`${s}=`:""}${r}}`}if(e===k.word)return t?h`\W`:h`\w`;throw new Error(`Unexpected character set kind "${e}"`)}function Vr(e,t){return(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")}function jr({atomic:e,flags:t,parent:r,alternatives:s},n,a){let o=n.currentFlags;t&&(n.currentFlags=L(o,t));let i=s.map(a).join("|"),c=!n.verbose&&s.length===1&&r.type!==u.Quantifier&&!e&&(!n.useFlagMods||!t)?i:`(?${Kr(e,t,n.useFlagMods)}${i})`;return n.currentFlags=o,c}function Wr({ref:e},t){let r=t.maxRecursionDepth;if(!r)throw new Error("Use of recursion disabled");if(t.accuracy==="strict")throw new Error("Use of recursion requires non-strict accuracy due to depth limit");return e===0?`(?R=${r})`:h`\g<${e}&R=${r}>`}function yt(e,t){let r=!!t?.firstOnly,s=e.min.value,n=e.max.value,a=[];if(s<65&&(n===65535||n>=131071)||s===65536&&n>=131071)return a;for(let o=s;o<=n;o++){let i=x(o);if(!Ge(i))continue;let c=me(i).filter(p=>{let l=p.codePointAt(0);return l<s||l>n});if(c.length&&(a.push(...c),r))break}return a}function j(e,{isAfterBackref:t,inCharClass:r,useFlagV:s}){if(wt.has(e))return wt.get(e);if(e<32||e>126&&e<160||e>262143||t&&Xr(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;let n=r?s?Nr:Mr:Gr,a=x(e);return(n.has(a)?"\\":"")+a}function Hr(e){let t=e.map(n=>n.codePointAt(0)).sort((n,a)=>n-a),r=[],s=null;for(let n=0;n<t.length;n++)t[n+1]===t[n]+1?s??=t[n]:s===null?r.push(t[n]):(r.push([s,t[n]]),s=null);return r}function Kr(e,t,r){if(e)return">";let s="";if(t&&r){let{enable:n,disable:a}=t;s=(n?.ignoreCase?"i":"")+(n?.dotAll?"s":"")+(a?"-":"")+(a?.ignoreCase?"i":"")+(a?.dotAll?"s":"")}return`${s}:`}function Qr({min:e,max:t,greedy:r,possessive:s}){let n;return!e&&t===1?n="?":!e&&t===1/0?n="*":e===1&&t===1/0?n="+":e===t?n=`{${e}}`:n=`{${e},${t===1/0?"":t}}`,n+(s?"+":r?"":"?")}function Xr(e){return e>47&&e<58}var $=String.raw,qr=$`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,Ne=$`\(\?R=(?<rDepth>[^\)]+)\)|${qr}`,fe=$`\(\?<(?![=!])(?<captureName>[^>]+)>`,T=new RegExp($`${fe}|${Ne}|\(\?|\\?.`,"gsu"),Me="Cannot use multiple overlapping recursions",Pe=new RegExp($`(?:\$[1-9]\d*)?${v.replace(/\$/g,$`\$`)}`,"y");function At(e,t){if(!new RegExp(Ne,"su").test(e))return e;if(Y(e,$`\(\?\(DEFINE\)`,S.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");let r=!!t?.useEmulationGroups,s=Y(e,$`\\[1-9]`,S.DEFAULT),n=new Map,a=[],o=!1,i=0,c=0,p;for(T.lastIndex=0;p=T.exec(e);){let{0:l,groups:{captureName:f,rDepth:w,gRNameOrNum:g,gRDepth:y}}=p;if(l==="[")i++;else if(i)l==="]"&&i--;else if(w){if(bt(w),o)throw new Error(Me);if(s)throw new Error("Numbered backrefs cannot be used with global recursion");let b=e.slice(0,p.index),F=e.slice(T.lastIndex);if(Y(F,Ne,S.DEFAULT))throw new Error(Me);return xt(b,F,+w,!1,r)}else if(g){bt(y);let b=!1;for(let W of a)if(W.name===g||W.num===+g){if(b=!0,W.hasRecursedWithin)throw new Error(Me);break}if(!b)throw new Error($`Recursive \g cannot be used outside the referenced group "\g<${g}&R=${y}>"`);let F=n.get(g),_=Ye(e,F);if(s&&Y(_,$`${fe}|\((?!\?)`,S.DEFAULT))throw new Error("Numbered backrefs cannot be used with recursion of capturing groups");let ge=e.slice(F,p.index),Re=_.slice(ge.length+l.length),Ue=xt(ge,Re,+y,!0,r),$t=e.slice(0,F),_t=e.slice(F+_.length);e=`${$t}${Ue}${_t}`,T.lastIndex+=Ue.length-l.length-ge.length-Re.length,a.forEach(W=>W.hasRecursedWithin=!0),o=!0}else if(f)c++,n.set(String(c),T.lastIndex),n.set(f,T.lastIndex),a.push({num:c,name:f});else if(l.startsWith("(")){let b=l==="(";b&&(c++,n.set(String(c),T.lastIndex+(r?zr(e,T.lastIndex):0))),a.push(b?{num:c}:{})}else l===")"&&a.pop()}return e}function bt(e){let 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 xt(e,t,r,s,n){let a=new Set;s&&Je(e+t,fe,({groups:{captureName:i}})=>{a.add(i)},S.DEFAULT);let o=r-1;return`${e}${Et(`(?:${e}`,o,s?a:null,"forward",n)}(?:)${Et(`${t})`,o,s?a:null,"backward",n)}${t}`}function Et(e,t,r,s,n){let o=c=>s==="backward"?t-c+2-1:c+2,i="";for(let c=0;c<t;c++){let p=o(c);i+=D(e,$`${fe}|\\k<(?<backref>[^>]+)>${n?$`|(?<unnamed>\()(?!\?)(?:${Pe.source})?`:""}`,({0:l,index:f,groups:{captureName:w,backref:g,unnamed:y}})=>{if(g&&r&&!r.has(g))return l;if(y)return`(${v}`;let b=`_$${p}`;return w?`(?<${w}${b}>${n?v:""}`:$`\k<${g}${b}>`},S.DEFAULT)}return i}function zr(e,t){Pe.lastIndex=t;let r=Pe.exec(e);return r?r[0].length:0}function St(e,t){let r=ne(t),s=r.avoidSubclass,n=X(e,r.flags,{captureGroup:r.rules.captureGroup}),a=J(n,{skipBackrefValidation:r.rules.allowOrphanBackrefs,verbose:r.verbose}),o=ut(a,{accuracy:r.accuracy,asciiWordBoundaries:r.rules.asciiWordBoundaries,avoidSubclass:s,bestEffortTarget:r.target,ignoreUnsupportedGAnchors:r.rules.ignoreUnsupportedGAnchors}),i=kt(o,r),c={useEmulationGroups:!s},p={pattern:$e(_e(At(i.pattern,c)),c),flags:`${r.hasIndices?"d":""}${r.global?"g":""}${i.flags}${i.options.disable.v?"u":"v"}`},l=!s&&p.pattern.includes(v),f=o._strategy;return(l||f)&&(p.options={...f?{strategy:f}:null,...l?{useEmulationGroups:l}:null}),p}function Zr(e,t){let r=t?.flags??"",s=t?.rules?.captureGroup??!1;return J(X(e,r,{captureGroup:s}))}function Jr(e,t){let r=St(e,t);return r.options?new te(r.pattern,r.flags,r.options):new RegExp(r.pattern,r.flags)}return Nt(Yr);})();
//# sourceMappingURL=index.min.js.map
{
"name": "oniguruma-to-es",
"version": "0.9.0",
"version": "0.10.0",
"description": "Convert Oniguruma patterns to native JavaScript RegExp",

@@ -16,14 +16,2 @@ "author": "Steven Levithan",

"types": "./types/index.d.ts",
"scripts": {
"bundle:global": "esbuild src/index.js --global-name=OnigurumaToES --bundle --minify --sourcemap --outfile=dist/index.min.js",
"bundle:esm": "esbuild src/index.js --format=esm --bundle --sourcemap --external:emoji-regex-xs --external:regex --external:regex-recursion --outfile=dist/index.mjs",
"types": "tsc src/index.js --rootDir src --declaration --allowJs --emitDeclarationOnly --outDir types",
"prebuild": "rm -rf dist/* types/*",
"build": "pnpm run bundle:global && pnpm run bundle:esm && pnpm run types",
"pretest": "pnpm run build",
"test": "jasmine",
"onig:compare": "node scripts/onig-compare.js",
"onig:match": "node scripts/onig-match.js",
"prepare": "pnpm test"
},
"files": [

@@ -54,3 +42,14 @@ "dist",

"vscode-oniguruma": "^2.0.1"
},
"scripts": {
"bundle:global": "esbuild src/index.js --global-name=OnigurumaToES --bundle --minify --sourcemap --outfile=dist/index.min.js",
"bundle:esm": "esbuild src/index.js --format=esm --bundle --sourcemap --external:emoji-regex-xs --external:regex --external:regex-recursion --outfile=dist/index.mjs",
"types": "tsc src/index.js --rootDir src --declaration --allowJs --emitDeclarationOnly --outDir types",
"prebuild": "rm -rf dist/* types/*",
"build": "pnpm run bundle:global && pnpm run bundle:esm && pnpm run types",
"pretest": "pnpm run build",
"test": "jasmine",
"onig:compare": "node scripts/onig-compare.js",
"onig:match": "node scripts/onig-match.js"
}
}
}

@@ -11,3 +11,3 @@ # Oniguruma-To-ES (鬼車➟ES)

- Run regexes written for Oniguruma from JavaScript, such as those used in TextMate grammars (used by VS Code, [Shiki](https://shiki.style/) syntax highlighter, etc.).
- Share regexes across your Ruby and JavaScript code.
- Share regexes across your Ruby and JavaScript code.<sup>✳︎</sup>

@@ -22,2 +22,4 @@ Compared to running the Oniguruma C library via WASM bindings using [vscode-oniguruma](https://github.com/microsoft/vscode-oniguruma), this library is **less than 4% of the size** and its regexes often run much faster since they run as native JavaScript.

<sup>✳︎: Ruby 2.0+ uses [Onigmo](https://github.com/k-takata/Onigmo), a fork of Oniguruma with similar syntax and behavior.</sup>
## 📜 Contents

@@ -108,9 +110,9 @@

flags: string;
subclass?: EmulatedRegExpOptions;
options?: EmulatedRegExpOptions;
};
```
Note that the returned `flags` might also be different than those provided, as a result of the emulation process. The returned `pattern`, `flags`, and `subclass` properties can be provided as arguments to the `EmulatedRegExp` constructor to produce the same result as `toRegExp`.
Note that the returned `flags` might also be different than those provided, as a result of the emulation process. The returned `pattern`, `flags`, and `options` properties can be provided as arguments to the `EmulatedRegExp` constructor to produce the same result as `toRegExp`.
If the only keys returned are `pattern` and `flags`, they can optionally be provided to JavaScript's `RegExp` constructor instead. Setting option `avoidSubclass` to `true` ensures that this is always the case, by throwing an error for any patterns that rely on `EmulatedRegExp`'s additional handling.
If the only keys returned are `pattern` and `flags`, they can optionally be provided to JavaScript's `RegExp` constructor instead. Setting option `avoidSubclass` to `true` ensures that this is always the case (resulting in an error for any patterns that require `EmulatedRegExp`'s additional handling).

@@ -139,10 +141,14 @@ ### `toOnigurumaAst`

class EmulatedRegExp extends RegExp {
constructor(
pattern: string | EmulatedRegExp,
flags?: string,
options?: EmulatedRegExpOptions
);
};
constructor(pattern: string, flags?: string, options?: EmulatedRegExpOptions);
constructor(pattern: EmulatedRegExp, flags?: string);
rawArgs: {
pattern: string;
flags: string;
options: EmulatedRegExpOptions;
};
}
```
The `rawArgs` property of `EmulatedRegExp` instances can be used to serialize the object as a string.
## 🔩 Options

@@ -181,4 +187,5 @@

- An error is thrown for certain patterns that are not emulatable without a subclass.
- When the regex can still be emulated accurately, *subpattern* match details (accessed via properties of match results when using the regex) might differ from Oniguruma.
- An error is thrown for patterns that are not emulatable without a subclass.
- Some patterns can still be emulated accurately without a subclass, but in this case *subpattern* match details might differ from Oniguruma.
- This is only relevant if you access the subpattern details of match results in your code (backreference array indices, `groups`, and `indices`).

@@ -245,4 +252,4 @@ ### `flags`

- Generated regexes require Node.js 20 or any 2023-era browser ([compat table](https://caniuse.com/mdn-javascript_builtins_regexp_unicodesets)).
- `ES2025`: Uses JS flag `v` and allows use of flag groups and duplicate group names.
- Benefits: Faster transpilation, simpler generated source, and duplicate group names are preserved across separate alternation paths.
- `ES2025`: Uses JS flag `v` and allows use of flag groups.
- Benefits: Faster transpilation, simpler generated source.
- Generated regexes might use features that require Node.js 23 or a 2024-era browser (except Safari, which lacks support for flag groups).

@@ -700,3 +707,3 @@ </details>

✔ Explicit bounds have upper limit of 100,000 (unlimited in JS)<br>
✔ Error with assertions (same as JS with flag <code>u</code>, <code>v</code>)<br>
✔ Error with assertions (same as JS with flag <code>u</code>, <code>v</code>) and directives<br>
</td>

@@ -943,7 +950,7 @@ </tr>

The table above doesn't include all aspects that Oniguruma-To-ES emulates (including error handling, most aspects that work the same as in JavaScript, and many aspects of non-JavaScript features that work the same in the other regex flavors that support them). Where applicable, Oniguruma-To-ES follows the latest version of Oniguruma (currently 6.9.9).
The table above doesn't include all aspects that Oniguruma-To-ES emulates (including error handling, subpattern details on match results, most aspects that work the same as in JavaScript, and many aspects of non-JavaScript features that work the same in the other regex flavors that support them). Where applicable, Oniguruma-To-ES follows the latest version of Oniguruma (currently 6.9.9).
### Footnotes
1. Unicode blocks (which in Oniguruma are used with an `In…` prefix) are easily emulatable but their character data would significantly increase library weight. They're also a flawed and arguably unuseful feature, given the ability to use Unicode scripts and other properties.
1. Unicode blocks (which in Oniguruma are specified with an `In…` prefix) are easily emulatable but their character data would significantly increase library weight. They're also rarely used, fundamentally flawed, and arguably unuseful given the availability of Unicode scripts and other properties.
2. With target `ES2018`, the specific POSIX classes `[:graph:]` and `[:print:]` use ASCII-based versions rather than the Unicode versions available for target `ES2024` and later, and they result in an error if using strict `accuracy`.

@@ -957,3 +964,3 @@ 3. Target `ES2018` doesn't support nested *negated* character classes.

The following don't yet have any support, and throw errors. They're all infrequently-used features, with most being *extremely* rare. Note that Oniguruma-To-ES can handle ~99.9% of real-world Oniguruma regexes, based on patterns used in a large [collection](https://github.com/shikijs/textmate-grammars-themes/tree/main/packages/tm-grammars/grammars) of TextMate grammars.
The following don't yet have any support, and throw errors. They're all uncommonly-used features, with most being *extremely* rare. Note that Oniguruma-To-ES can handle 99.9+% of real-world Oniguruma regexes, based on a sample of tens of thousands of regexes used in TextMate grammars.

@@ -965,3 +972,3 @@ - Supportable:

- Code point sequences: `\x{H H …}`, `\o{O O …}`.
- Whole-pattern modifier: Don't capture `(?C)`.
- Whole-pattern modifier: Don't capture group `(?C)`.
- Supportable for some uses:

@@ -983,13 +990,13 @@ - Absence functions: `(?~…)`, etc.

- With targets before `ES2025`, a handful of Unicode properties that target a specific character case (ex: `\p{Lower}`) can't be used case-insensitively in patterns that contain other characters with a specific case that are used case-sensitively.
- In other words, almost every usage is fine, including `A\p{Lower}`, `(?i:A\p{Lower})`, `(?i:A)\p{Lower}`, `(?i:A(?-i:\p{Lower}))`, and `\w(?i:\p{Lower})`, but not `A(?i:\p{Lower})`.
- In other words, almost every usage is fine, including `A\p{Lower}`, `(?i)A\p{Lower}`, `(?i:A)\p{Lower}`, `(?i)A(?-i)\p{Lower}`, and `\w(?i)\p{Lower}`, but not `A(?i)\p{Lower}`.
- Using these properties case-insensitively is basically never done intentionally, so you're unlikely to encounter this error unless it's catching a mistake.
- Oniguruma-To-ES uses the version of Unicode supported natively by your JavaScript environment. Using Unicode properties via `\p{…}` that require a later version of Unicode than the environment supports results in a runtime error. This is an extreme edge case since modern JavaScript environments support recent versions of Unicode, often ahead of Oniguruma itself.
- Oniguruma-To-ES uses the version of Unicode supported natively by your JavaScript environment. Using Unicode properties via `\p{…}` that require a later version of Unicode than the environment supports results in a runtime error. This is an extreme edge case since modern JavaScript environments support recent versions of Unicode, often ahead of Oniguruma.
## 👀 Similar projects
[JsRegex](https://github.com/jaynetics/js_regex) transpiles [Onigmo](https://github.com/k-takata/Onigmo) regexes to JavaScript (Onigmo is a fork of Oniguruma with similar syntax and behavior). It's written in Ruby and relies on the [Regexp::Parser](https://github.com/ammar/regexp_parser) Ruby gem, which means regexes must be pre-transpiled on the server to use them in JavaScript. Note that JsRegex doesn't always translate edge case behavior differences.
[JsRegex](https://github.com/jaynetics/js_regex) transpiles Onigmo regexes to JavaScript (Onigmo is a fork of Oniguruma with similar syntax and behavior). It's written in Ruby and relies on the [Regexp::Parser](https://github.com/ammar/regexp_parser) Ruby gem, which means regexes must be pre-transpiled on the server to use them in JavaScript. Note that JsRegex doesn't always translate edge case behavior differences.
## 🏷️ About
Oniguruma-To-ES was created by [Steven Levithan](https://github.com/slevithan).
Oniguruma-To-ES was created by [Steven Levithan](https://github.com/slevithan) and [contributors](https://github.com/slevithan/oniguruma-to-es/graphs/contributors).

@@ -996,0 +1003,0 @@ If you want to support this project, I'd love your help by contributing improvements, sharing it with others, or [sponsoring](https://github.com/sponsors/slevithan) ongoing development.

@@ -43,3 +43,3 @@ export type OnigurumaToEsOptions = {

flags: string;
subclass?: import('./subclass.js').EmulatedRegExpOptions;
options?: import('./subclass.js').EmulatedRegExpOptions;
}}

@@ -50,3 +50,3 @@ */

flags: string;
subclass?: import("./subclass.js").EmulatedRegExpOptions;
options?: import("./subclass.js").EmulatedRegExpOptions;
};

@@ -53,0 +53,0 @@ /**

export type EmulatedRegExpOptions = {
strategy?: string | null;
useEmulationGroups?: boolean;
strategy?: string;
};

@@ -8,4 +8,4 @@ export function applySubclassStrategies(ast: any): "line_or_search_start" | "not_search_start";

@typedef {{
strategy?: string | null;
useEmulationGroups?: boolean;
strategy?: string;
}} EmulatedRegExpOptions

@@ -20,9 +20,29 @@ */

/**
@param {string | EmulatedRegExp} pattern
@param {string} [flags]
@param {EmulatedRegExpOptions} [options]
@overload
@param {string} pattern
@param {string} [flags]
@param {EmulatedRegExpOptions} [options]
*/
constructor(pattern: string, flags?: string, options?: EmulatedRegExpOptions);
/**
@overload
@param {EmulatedRegExp} pattern
@param {string} [flags]
*/
constructor(pattern: EmulatedRegExp, flags?: string);
/**
Can be used to serialize the arguments used to create the instance.
@type {{
pattern: string;
flags: string;
options: EmulatedRegExpOptions;
}}
*/
constructor(pattern: string | EmulatedRegExp, flags?: string, options?: EmulatedRegExpOptions);
rawArgs: {
pattern: string;
flags: string;
options: EmulatedRegExpOptions;
};
#private;
}
export function isLoneGLookaround(node: any, options: any): any;
export const cp: any;
export const envSupportsDuplicateNames: boolean;
export const envSupportsFlagGroups: boolean;

@@ -4,0 +3,0 @@ export const envSupportsFlagV: boolean;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc