oniguruma-to-es
Advanced tools
Comparing version 0.7.0 to 0.8.0
@@ -1,4 +0,4 @@ | ||
var OnigurumaToES=(()=>{var ge=Object.defineProperty;var vt=Object.getOwnPropertyDescriptor;var Ft=Object.getOwnPropertyNames;var It=Object.prototype.hasOwnProperty;var Gt=(e,t)=>{for(var r in t)ge(e,r,{get:t[r],enumerable:!0})},Pt=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Ft(t))!It.call(e,n)&&n!==r&&ge(e,n,{get:()=>t[n],enumerable:!(s=vt(t,n))||s.enumerable});return e};var Nt=e=>Pt(ge({},"__esModule",{value:!0}),e);var Xr={};Gt(Xr,{EmulatedRegExp:()=>ee,toDetails:()=>St,toOnigurumaAst:()=>Qr,toRegExp:()=>qr});var E=String.fromCodePoint,f=String.raw,Me=(()=>{try{new RegExp("(?<n>)|(?<n>)")}catch{return!1}return!0})(),Re=(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),Te=(()=>{try{new RegExp("","v")}catch{return!1}return!0})();function D(e,{enable:t,disable:r}){return{dotAll:!r?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!r?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function L(e,t,r){return e.has(t)||e.set(t,r),e.get(t)}function W(e,t){return he[e]>=he[t]}function _(e,t){if(!e)throw new Error(t??"Value expected");return e}var he={ES2025:2025,ES2024:2024,ES2018:2018},Mt={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function re(e){if(e?.target!==void 0&&!Mt[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,allowUnhandledGAnchors:!1,asciiWordBoundaries:!1,...e?.rules}};return t.target==="auto"&&(t.target=Me&&Re?"ES2025":Te?"ES2024":"ES2018"),t}var Rt=new Set([E(304),E(305)]);function Ce(e){if(Rt.has(e))return[e];let t=new Set,r=e.toLowerCase(),s=r.toUpperCase(),n=Dt.get(r),o=Ut.get(r),a=Ot.get(r);return[...s].length===1&&t.add(s),a&&t.add(a),n&&t.add(n),t.add(r),o&&t.add(o),[...t]}var me=new Set(["C","Other","Cc","Control","cntrl","Cf","Format","Cn","Unassigned","Co","Private_Use","Cs","Surrogate","L","Letter","LC","Cased_Letter","Ll","Lowercase_Letter","Lm","Modifier_Letter","Lo","Other_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter","M","Mark","Combining_Mark","Mc","Spacing_Mark","Me","Enclosing_Mark","Mn","Nonspacing_Mark","N","Number","Nd","Decimal_Number","digit","Nl","Letter_Number","No","Other_Number","P","Punctuation","punct","Pc","Connector_Punctuation","Pd","Dash_Punctuation","Pe","Close_Punctuation","Pf","Final_Punctuation","Pi","Initial_Punctuation","Po","Other_Punctuation","Ps","Open_Punctuation","S","Symbol","Sc","Currency_Symbol","Sk","Modifier_Symbol","Sm","Math_Symbol","So","Other_Symbol","Z","Separator","Zl","Line_Separator","Zp","Paragraph_Separator","Zs","Space_Separator","ASCII","ASCII_Hex_Digit","AHex","Alphabetic","Alpha","Any","Assigned","Bidi_Control","Bidi_C","Bidi_Mirrored","Bidi_M","Case_Ignorable","CI","Cased","Changes_When_Casefolded","CWCF","Changes_When_Casemapped","CWCM","Changes_When_Lowercased","CWL","Changes_When_NFKC_Casefolded","CWKCF","Changes_When_Titlecased","CWT","Changes_When_Uppercased","CWU","Dash","Default_Ignorable_Code_Point","DI","Deprecated","Dep","Diacritic","Dia","Emoji","Emoji_Component","EComp","Emoji_Modifier","EMod","Emoji_Modifier_Base","EBase","Emoji_Presentation","EPres","Extended_Pictographic","ExtPict","Extender","Ext","Grapheme_Base","Gr_Base","Grapheme_Extend","Gr_Ext","Hex_Digit","Hex","IDS_Binary_Operator","IDSB","IDS_Trinary_Operator","IDST","ID_Continue","IDC","ID_Start","IDS","Ideographic","Ideo","Join_Control","Join_C","Logical_Order_Exception","LOE","Lowercase","Lower","Math","Noncharacter_Code_Point","NChar","Pattern_Syntax","Pat_Syn","Pattern_White_Space","Pat_WS","Quotation_Mark","QMark","Radical","Regional_Indicator","RI","Sentence_Terminal","STerm","Soft_Dotted","SD","Terminal_Punctuation","Term","Unified_Ideograph","UIdeo","Uppercase","Upper","Variation_Selector","VS","White_Space","space","XID_Continue","XIDC","XID_Start","XIDS"]),we=new Map;for(let e of me)we.set(K(e),e);var Tt=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"]),ke=new Map;for(let e of Tt)ke.set(K(e),e);var Ue=new Set("Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo Extended_Pictographic Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi EBase EComp EMod EPres ExtPict Cpmn Cypro_Minoan Old_Uyghur Ougr Tangsa Tnsa Toto Vith Vithkuqi Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz".split(" ")),Ut=new Map([["s",E(383)],[E(383),"s"]]),Ot=new Map([[E(223),E(7838)],[E(107),E(8490)],[E(229),E(8491)],[E(969),E(8486)]]),Dt=new Map([N(453),N(456),N(459),N(498),...de(8072,8079),...de(8088,8095),...de(8104,8111),N(8124),N(8140),N(8188)]),ne=new Map([["alnum",f`[\p{Alpha}\p{Nd}]`],["alpha",f`\p{Alpha}`],["ascii",f`\p{ASCII}`],["blank",f`[\p{Zs}\t]`],["cntrl",f`\p{cntrl}`],["digit",f`\p{Nd}`],["graph",f`[\P{space}&&\P{cntrl}&&\P{Cn}&&\P{Cs}]`],["lower",f`\p{Lower}`],["print",f`[[\P{space}&&\P{cntrl}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",f`[\p{P}\p{S}]`],["space",f`\p{space}`],["upper",f`\p{Upper}`],["word",f`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",f`\p{AHex}`]]),Oe=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 N(e){let t=E(e);return[t.toLowerCase(),t]}function de(e,t){return Lt(e,t).map(r=>N(r))}var ye=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);var g={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"},b={any:"any",digit:"digit",dot:"dot",hex:"hex",non_newline:"non_newline",posix:"posix",property:"property",space:"space",word:"word"},H={flags:"flags",keep:"keep"},x={atomic:"atomic",capturing:"capturing",group:"group",lookahead:"lookahead",lookbehind:"lookbehind"},De=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]),Be=f`\[\^?`,Ve=`c.? | C(?:-.?)?|${f`[pP]\{(?:\^?[\x20\w]+\})?`}|${f`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${f`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${f`o\{[^\}]*\}?`}|${f`\d{1,3}`}`,je=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,se=new RegExp(f` | ||
var OnigurumaToES=(()=>{var he=Object.defineProperty;var It=Object.getOwnPropertyDescriptor;var Mt=Object.getOwnPropertyNames;var Pt=Object.prototype.hasOwnProperty;var Nt=(e,t)=>{for(var r in t)he(e,r,{get:t[r],enumerable:!0})},Rt=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Mt(t))!Pt.call(e,n)&&n!==r&&he(e,n,{get:()=>t[n],enumerable:!(s=It(t,n))||s.enumerable});return e};var Ut=e=>Rt(he({},"__esModule",{value:!0}),e);var Yr={};Nt(Yr,{EmulatedRegExp:()=>ee,toDetails:()=>vt,toOnigurumaAst:()=>Zr,toRegExp:()=>Jr});var y=String.fromCodePoint,h=String.raw,Ue=(()=>{try{new RegExp("(?<n>)|(?<n>)")}catch{return!1}return!0})(),Oe=(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),Te=(()=>{try{new RegExp("","v")}catch{return!1}return!0})();function D(e,{enable:t,disable:r}){return{dotAll:!r?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!r?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function L(e,t,r){return e.has(t)||e.set(t,r),e.get(t)}function W(e,t){return de[e]>=de[t]}function v(e,t){if(!e)throw new Error(t??"Value expected");return e}var de={ES2025:2025,ES2024:2024,ES2018:2018},Ot={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function re(e){if(e?.target!==void 0&&!Ot[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,allowUnhandledGAnchors:!1,asciiWordBoundaries:!1,captureGroup:!1,...e?.rules}};return t.target==="auto"&&(t.target=Ue&&Oe?"ES2025":Te?"ES2024":"ES2018"),t}var Tt=new Set([y(304),y(305)]);function me(e){if(Tt.has(e))return[e];let t=new Set,r=e.toLowerCase(),s=r.toUpperCase(),n=Vt.get(r),a=Lt.get(r),o=Bt.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","Cf","Format","Cn","Unassigned","Co","Private_Use","Cs","Surrogate","L","Letter","LC","Cased_Letter","Ll","Lowercase_Letter","Lm","Modifier_Letter","Lo","Other_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter","M","Mark","Combining_Mark","Mc","Spacing_Mark","Me","Enclosing_Mark","Mn","Nonspacing_Mark","N","Number","Nd","Decimal_Number","digit","Nl","Letter_Number","No","Other_Number","P","Punctuation","punct","Pc","Connector_Punctuation","Pd","Dash_Punctuation","Pe","Close_Punctuation","Pf","Final_Punctuation","Pi","Initial_Punctuation","Po","Other_Punctuation","Ps","Open_Punctuation","S","Symbol","Sc","Currency_Symbol","Sk","Modifier_Symbol","Sm","Math_Symbol","So","Other_Symbol","Z","Separator","Zl","Line_Separator","Zp","Paragraph_Separator","Zs","Space_Separator","ASCII","ASCII_Hex_Digit","AHex","Alphabetic","Alpha","Any","Assigned","Bidi_Control","Bidi_C","Bidi_Mirrored","Bidi_M","Case_Ignorable","CI","Cased","Changes_When_Casefolded","CWCF","Changes_When_Casemapped","CWCM","Changes_When_Lowercased","CWL","Changes_When_NFKC_Casefolded","CWKCF","Changes_When_Titlecased","CWT","Changes_When_Uppercased","CWU","Dash","Default_Ignorable_Code_Point","DI","Deprecated","Dep","Diacritic","Dia","Emoji","Emoji_Component","EComp","Emoji_Modifier","EMod","Emoji_Modifier_Base","EBase","Emoji_Presentation","EPres","Extended_Pictographic","ExtPict","Extender","Ext","Grapheme_Base","Gr_Base","Grapheme_Extend","Gr_Ext","Hex_Digit","Hex","IDS_Binary_Operator","IDSB","IDS_Trinary_Operator","IDST","ID_Continue","IDC","ID_Start","IDS","Ideographic","Ideo","Join_Control","Join_C","Logical_Order_Exception","LOE","Lowercase","Lower","Math","Noncharacter_Code_Point","NChar","Pattern_Syntax","Pat_Syn","Pattern_White_Space","Pat_WS","Quotation_Mark","QMark","Radical","Regional_Indicator","RI","Sentence_Terminal","STerm","Soft_Dotted","SD","Terminal_Punctuation","Term","Unified_Ideograph","UIdeo","Uppercase","Upper","Variation_Selector","VS","White_Space","space","XID_Continue","XIDC","XID_Start","XIDS"]),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 De=new Set("Dogr Dogra Gong Gunjala_Gondi Hanifi_Rohingya Maka Makasar Medefaidrin Medf Old_Sogdian Rohg Sogd Sogdian Sogo Extended_Pictographic Elym Elymaic Hmnp Nand Nandinagari Nyiakeng_Puachue_Hmong Wancho Wcho Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi EBase EComp EMod EPres ExtPict Cpmn Cypro_Minoan Old_Uyghur Ougr Tangsa Tnsa Toto Vith Vithkuqi Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz".split(" ")),Lt=new Map([["s",y(383)],[y(383),"s"]]),Bt=new Map([[y(223),y(7838)],[y(107),y(8490)],[y(229),y(8491)],[y(969),y(8486)]]),Vt=new Map([R(453),R(456),R(459),R(498),...Ce(8072,8079),...Ce(8088,8095),...Ce(8104,8111),R(8124),R(8140),R(8188)]),ne=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 jt(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 R(e){let t=y(e);return[t.toLowerCase(),t]}function Ce(e,t){return jt(e,t).map(r=>R(r))}var Ee=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"},A={any:"any",digit:"digit",dot:"dot",hex:"hex",non_newline:"non_newline",posix:"posix",property:"property",space:"space",word:"word"},H={flags:"flags",keep:"keep"},x={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}`}`,Ke=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,se=new RegExp(h` | ||
\\ (?: | ||
${Ve} | ||
${We} | ||
| [gk]<[^>]*>? | ||
@@ -16,16 +16,16 @@ | [gk]'[^']*'? | ||
)?)? | ||
| ${je.source} | ||
| ${Be} | ||
| ${Ke.source} | ||
| ${je} | ||
| . | ||
`.replace(/\s+/g,""),"gsu"),Ee=new RegExp(f` | ||
`.replace(/\s+/g,""),"gsu"),be=new RegExp(h` | ||
\\ (?: | ||
${Ve} | ||
${We} | ||
| . | ||
) | ||
| \[:[^:]*:\] | ||
| ${Be} | ||
| ${je} | ||
| && | ||
| . | ||
`.replace(/\s+/g,""),"gsu");function z(e,t=""){if(typeof e!="string")throw new Error("String expected as pattern");if(!/^[imxDSW]*$/.test(t))throw new Error(`Flags "${t}" includes unsupported value`);let r=[t.includes("x")],s={getCurrentModX:()=>r.at(-1),numOpenGroups:0,popModX(){r.pop()},pushModX(u){r.push(u)},replaceCurrentModX(u){r[r.length-1]=u}},n=[],o;for(se.lastIndex=0;o=se.exec(e);){let u=Bt(s,e,o[0],se.lastIndex);u.tokens?n.push(...u.tokens):u.token&&n.push(u.token),u.lastIndex!==void 0&&(se.lastIndex=u.lastIndex)}let a=[],i=0;n.forEach(u=>{u.type===g.GroupOpen&&(u.kind===x.capturing?(i++,u.number=i):u.raw==="("&&a.push(u))}),i||a.forEach((u,p)=>{u.kind=x.capturing,u.number=p+1});let c=i||a.length;return n=n.map(u=>u.type===g.EscapedNumber?Xt(u,c):u).flat(),{tokens:n,flags:{ignoreCase:t.includes("i"),dotAll:t.includes("m"),extended:t.includes("x"),digitIsAscii:t.includes("D"),spaceIsAscii:t.includes("S"),wordIsAscii:t.includes("W")}}}function Bt(e,t,r,s){let[n,o,a]=r;if(n==="["){let i=Vt(t,r,s);return{tokens:i.tokens,lastIndex:i.lastIndex}}if(n==="\\"){if("AbBGzZ".includes(o))return{token:m(g.Assertion,r,{kind:r})};if(/^\\g[<']/.test(r)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(r))throw new Error(`Invalid group name "${r}"`);return{token:m(g.Subroutine,r)}}if(/^\\k[<']/.test(r)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(r))throw new Error(`Invalid group name "${r}"`);return{token:m(g.Backreference,r)}}if(o==="K")return{token:m(g.Directive,r,{kind:H.keep})};if(o==="N")return{token:m(g.CharacterSet,r,{kind:b.non_newline})};if(o==="O")return{token:m(g.CharacterSet,r,{kind:b.any})};if("RX".includes(o))return{token:m(g.VariableLengthCharacterSet,r,{kind:r})};if("yY".includes(o))throw new Error(`Unsupported grapheme boundary "${r}"`);let i=We(r,{inCharClass:!1});return Array.isArray(i)?{tokens:i}:{token:i}}if(n==="("){if(a==="#"){if(t[s]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:s+1}}if("-imx".includes(a))return{token:Kt(r,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,r==="("||r==="(?:")return{token:m(g.GroupOpen,r,{kind:x.group})};if(r==="(?>")return{token:m(g.GroupOpen,r,{kind:x.atomic})};if(r==="(?="||r==="(?!"||r==="(?<="||r==="(?<!")return{token:m(g.GroupOpen,r,{kind:a==="<"?x.lookbehind:x.lookahead,negate:r.endsWith("!")})};if(a==="<"||a==="'")return{token:m(g.GroupOpen,r,{kind:x.capturing,name:r.slice(3,-1)})};throw a==="("?new Error(`Unsupported conditional "${r}"`):a==="~"?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:m(g.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:m(g.CharacterSet,r,{kind:b.dot})}:r==="^"||r==="$"?{token:m(g.Assertion,r,{kind:r})}:r==="|"?{token:m(g.Alternator,r)}:je.test(r)?{token:Ht(r)}:(Ke(r),{token:m(g.Character,r,{value:r.codePointAt(0)})})}function Vt(e,t,r){let s=[m(g.CharacterClassOpen,t,{negate:t[1]==="^"})],n=1,o;for(Ee.lastIndex=r;o=Ee.exec(e);){let a=o[0];if(a[0]==="["&&a[1]!==":")n++,s.push(m(g.CharacterClassOpen,a,{negate:a[1]==="^"}));else if(a==="]"){if(s.at(-1).type===g.CharacterClassOpen)s.push(m(g.Character,a,{value:93}));else if(n--,s.push(m(g.CharacterClassClose,a)),!n)break}else{let i=jt(a);Array.isArray(i)?s.push(...i):s.push(i)}}return{tokens:s,lastIndex:Ee.lastIndex||e.length}}function jt(e){if(e[0]==="\\")return We(e,{inCharClass:!0});if(e[0]==="["){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!ne.get(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return m(g.CharacterSet,e,{kind:b.posix,negate:!!t.groups.negate,value:t.groups.name})}return e==="-"?m(g.CharacterClassHyphen,e):e==="&&"?m(g.CharacterClassIntersector,e):(Ke(e),m(g.Character,e,{value:e.codePointAt(0)}))}function We(e,{inCharClass:t}){let r=e[1];if(r==="c"||r==="C")return Wt(e);if("dDhHsSwW".includes(r))return zt(e);if(e.startsWith(f`\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 Qt(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)),o=new TextEncoder;return[...n].map(i=>{let c=[...o.encode(i)].map(u=>`\\x${u.toString(16)}`).join("");return m(g.Character,c,{value:i.codePointAt(0)})})}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(r==="u"||r==="x")return m(g.Character,e,{value:qt(e)});if(De.has(r))return m(g.Character,e,{value:De.get(r)});if(/\d/.test(r))return m(g.EscapedNumber,e,{inCharClass:t});if(e==="\\")throw new Error(f`Incomplete escape "\"`);if(r==="M")throw new Error(`Unsupported meta "${e}"`);if([...e].length===2)return m(g.Character,e,{value:e.codePointAt(1)});throw new Error(`Unexpected escape "${e}"`)}function m(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 m(g.Character,e,{value:t.toUpperCase().codePointAt(0)-64})}function Kt(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"),o=Le(r),a=Le(s),i={};if(o&&(i.enable=o),a&&(i.disable=a),e.endsWith(")"))return t.replaceCurrentModX(n),m(g.Directive,e,{kind:H.flags,flags:i});if(e.endsWith(":")){t.pushModX(n),t.numOpenGroups++;let c=m(g.GroupOpen,e,{kind:x.group});return(o||a)&&(c.flags=i),c}throw new Error(`Unexpected flag modifier "${e}"`)}function Ht(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 m(g.Quantifier,e,t)}function zt(e){let t=e[1].toLowerCase();return m(g.CharacterSet,e,{kind:{d:b.digit,h:b.hex,s:b.space,w:b.word}[t],negate:e[1]!==t})}function Qt(e){let{p:t,neg:r,value:s}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[ \w]+)/.exec(e).groups,n=t==="P"&&!r||t==="p"&&!!r;return m(g.CharacterSet,e,{kind:b.property,negate:n,value:s})}function Le(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 Xt(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[m(g.Backreference,r)];let o=[],a=n.match(/^[0-7]+|\d/g);for(let i=0;i<a.length;i++){let c=a[i],u;if(i===0&&c!=="8"&&c!=="9"){if(u=parseInt(c,8),u>127)throw new Error(f`Octal encoded byte above 177 unsupported "${r}"`)}else u=c.codePointAt(0);o.push(m(g.Character,(i===0?"\\":"")+c,{value:u}))}return o}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 F({type:e,kind:t}){return e===l.Assertion&&(t===w.lookahead||t===w.lookbehind)}function ae({type:e,min:t}){return e===l.Assertion||e===l.Directive||e===l.Quantifier&&!t}function I(e,t,r){let s=e.node;for(;s.parent;)s=s.parent;function n(a,i){for(let c=0;c<a.length;c++){let u=o(a[c],i,c,a);c=Math.max(-1,c+u)}}function o(a,i=null,c=null,u=null){let p=0,h=!1,C={node:a,parent:i,key:c,container:u,ast:s,remove(){_(u,"Container expected").splice(Math.max(0,c+p),1),p-=1},removeAllNextSiblings(){return _(u,"Container expected").splice(c+1)},removeAllPrevSiblings(){let S=c+p;return p-=S,_(u,"Container expected").splice(0,Math.max(0,S))},replaceWith(S){Jt(S,i),u?u[Math.max(0,c+p)]=S:i[c]=S},skip(){h=!0}},d=Zt(a).find(S=>!!r[S]),k=d&&r[d],R=typeof k=="function"?k:k?.enter,T=k?.exit;if(R?.(C,t),!h)switch(a.type){case l.Regex:o(a.pattern,a,"pattern"),o(a.flags,a,"flags");break;case l.Alternative:case l.CharacterClass:n(a.elements,a);break;case l.Assertion:F(a)&&n(a.alternatives,a);break;case l.Backreference:case l.Character:case l.CharacterSet:case l.Directive:case l.Flags:case l.Recursion:case l.Subroutine:case l.VariableLengthCharacterSet:break;case l.CapturingGroup:case l.Group:case l.Pattern:n(a.alternatives,a);break;case l.CharacterClassIntersection:n(a.classes,a);break;case l.CharacterClassRange:o(a.min,a,"min"),o(a.max,a,"max");break;case l.Quantifier:o(a.element,a,"element");break;default:throw new Error(`Unexpected node type "${a.type}"`)}return T?.(C,t),p}o(e.node,e.parent,e.key,e.container)}var He={AnyGroup:"AnyGroup",AnyNode:"AnyNode"};function Zt(e){let{type:t}=e,r=[He.AnyNode];return(t===l.CapturingGroup||t===l.Group||F(e))&&r.push(He.AnyGroup),r.push(t),r}function Jt(e,t){"parent"in t&&(e.parent=t)}var l={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"},w={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"},y=b,X=H,q={grapheme:"grapheme",newline:"newline"};function Z({tokens:e,flags:t},r){let s={skipBackrefValidation:!1,skipPropertyNameValidation:!1,verbose:!1,...r},n={capturingGroups:[],current:0,hasNumberedRef:!1,namedGroupsByName:new Map,parent:null,skipBackrefValidation:s.skipBackrefValidation,skipPropertyNameValidation:s.skipPropertyNameValidation,subroutines:[],token:null,tokens:e,verbose:s.verbose,walk:o};function o(C,d){let k=e[n.current];switch(n.parent=C,n.token=k,n.current++,k.type){case g.Alternator:return M();case g.Assertion:return qe(k);case g.Backreference:return Yt(n);case g.Character:return Xe(k.value);case g.CharacterClassHyphen:return er(n,d);case g.CharacterClassOpen:return tr(n,d);case g.CharacterSet:return rr(n);case g.Directive:return ur(k);case g.GroupOpen:return nr(n,d);case g.Quantifier:return sr(n);case g.Subroutine:return ar(n);case g.VariableLengthCharacterSet:return dr(k.kind);default:throw new Error(`Unexpected token type "${k.type}"`)}}let a=gr(pr(),lr(t)),i=a.pattern.alternatives[0];for(;n.current<e.length;){let C=o(i,{});C.type===l.Alternative?(a.pattern.alternatives.push(C),i=C):i.elements.push(C)}let{capturingGroups:c,hasNumberedRef:u,namedGroupsByName:p,subroutines:h}=n;if(u&&p.size)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(let{ref:C}of h)if(typeof C=="number"){if(C>c.length)throw new Error("Subroutine uses a group number that's not defined")}else if(p.has(C)){if(p.get(C).length>1)throw new Error(f`Subroutine uses a duplicate group name "\g<${C}>"`)}else throw new Error(f`Subroutine uses a group name that's not defined "\g<${C}>"`);return I({node:a},null,{AnyNode({node:C,parent:d}){C.parent=d}}),a}function Yt(e){let{raw:t}=e.token,r=/^\\k[<']/.test(t),s=r?t.slice(3,-1):t.slice(1),n=(o,a=!1)=>{let i=e.capturingGroups.length,c=!1;if(o>i)if(e.skipBackrefValidation)c=!0;else throw new Error(`Not enough capturing groups defined to the left "${t}"`);return e.hasNumberedRef=!0,oe(a?i+1-o:o,{orphan:c})};if(r){let o=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(s);if(o)return n(+o.groups.num,!!o.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 oe(s)}return n(+s)}function er(e,t){let{parent:r,tokens:s,walk:n}=e,o=r.elements.at(-1),a=s[e.current];if(o&&o.type!==l.CharacterClass&&o.type!==l.CharacterClassRange&&a&&a.type!==g.CharacterClassOpen&&a.type!==g.CharacterClassClose&&a.type!==g.CharacterClassIntersector){let i=n(r,t);if(o.type===l.Character&&i.type===l.Character)return r.elements.pop(),cr(o,i);throw new Error("Invalid character class range")}return Xe(45)}function tr(e,t){let{token:r,tokens:s,verbose:n,walk:o}=e,a=s[e.current],i=be({negate:r.negate}),c=i.elements[0],u=ze(a);for(;u.type!==g.CharacterClassClose;){if(u.type===g.CharacterClassIntersector)c.classes.push(be({negate:!1,baseOnly:!0})),e.current++;else{let p=c.classes.at(-1);p.elements.push(o(p,t))}u=ze(s[e.current],a)}if(n||kr(c),c.classes.length===1){let p=c.classes[0];p.negate=i.negate!==p.negate,i=p}return e.current++,i}function rr({token:e,skipPropertyNameValidation:t}){let{kind:r,negate:s,value:n}=e;if(r===b.property){let o=K(n);if(Oe.has(o))r=b.posix,n=o;else return B(n,{negate:s,skipPropertyNameValidation:t})}return r===b.posix?{type:l.CharacterSet,kind:y.posix,negate:s,value:n}:ie(r,{negate:s})}function nr(e,t){let{token:r,tokens:s,capturingGroups:n,namedGroupsByName:o,verbose:a,walk:i}=e,c=or(r);c.type===l.CapturingGroup&&(n.push(c),c.name&&L(o,c.name,[]).push(c));let u=Qe(s[e.current]);for(;u.type!==g.GroupClose;){if(u.type===g.Alternator)c.alternatives.push(M()),e.current++;else{let p=c.alternatives.at(-1);p.elements.push(i(p,t))}u=Qe(s[e.current])}return a||(c=mr(c)),e.current++,c}function sr({token:e,parent:t}){let{min:r,max:s,greedy:n,possessive:o}=e,a=t.elements.at(-1);if(!a||a.type===l.Assertion||a.type===l.Directive)throw new Error("Quantifier requires a repeatable token");let i=fr(a,r,s,n,o);return t.elements.pop(),i}function ar(e){let{token:t,capturingGroups:r,subroutines:s}=e,n=t.raw.slice(3,-1),o=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(n);if(o){let i=+o.groups.num,c=r.length;if(e.hasNumberedRef=!0,n={"":i,"+":c+i,"-":c+1-i}[o.groups.sign],n<1)throw new Error("Invalid subroutine number")}else n==="0"&&(n=0);let a=hr(n);return s.push(a),a}function M(){return{type:l.Alternative,elements:[]}}function qe({type:e,kind:t,negate:r}){if(e===g.GroupOpen)return ce({behind:t===x.lookbehind,negate:r});let s=_({"^":w.line_start,$:w.line_end,"\\A":w.string_start,"\\b":w.word_boundary,"\\B":w.word_boundary,"\\G":w.search_start,"\\z":w.string_end,"\\Z":w.string_end_newline}[t],`Unexpected assertion kind "${t}"`),n={type:l.Assertion,kind:s};return s===w.word_boundary&&(n.negate=t===f`\B`),n}function oe(e,t){let r=!!t?.orphan;return{type:l.Backreference,...r&&{orphan:r},ref:e}}function or(e){let{kind:t,number:r,name:s,flags:n}=e;switch(t){case x.atomic:return G({atomic:!0});case x.capturing:return xe(r,s);case x.group:return G({flags:n});case x.lookahead:case x.lookbehind:return qe(e);default:throw new Error(`Unexpected group kind "${t}"`)}}function xe(e,t){let r=t!==void 0;if(r&&!wr(t))throw new Error(`Group name "${t}" invalid in Oniguruma`);return{type:l.CapturingGroup,number:e,...r&&{name:t},alternatives:[M()]}}function Xe(e){return{type:l.Character,value:e}}function be(e){let t={baseOnly:!1,negate:!1,...e};return{type:l.CharacterClass,negate:t.negate,elements:t.baseOnly?[]:[ir()]}}function ir(){return{type:l.CharacterClassIntersection,classes:[be({negate:!1,baseOnly:!0})]}}function cr(e,t){if(t.value<e.value)throw new Error("Character class range out of order");return{type:l.CharacterClassRange,min:e,max:t}}function ie(e,{negate:t}){let r={type:l.CharacterSet,kind:_(y[e],`Unexpected character set kind "${e}"`)};return(e===b.digit||e===b.hex||e===b.space||e===b.word)&&(r.negate=t),r}function ur({kind:e,flags:t}){let r={type:l.Directive,kind:_(X[e],`Unexpected directive kind "${e}"`)};return e===H.flags&&(r.flags=t),r}function lr({ignoreCase:e,dotAll:t,extended:r,digitIsAscii:s,spaceIsAscii:n,wordIsAscii:o}){return{type:l.Flags,ignoreCase:e,dotAll:t,extended:r,digitIsAscii:s,spaceIsAscii:n,wordIsAscii:o}}function G(e){let t=e?.atomic,r=e?.flags;return{type:l.Group,...t&&{atomic:t},...r&&{flags:r},alternatives:[M()]}}function ce(e){let t={behind:!1,negate:!1,...e};return{type:l.Assertion,kind:t.behind?w.lookbehind:w.lookahead,negate:t.negate,alternatives:[M()]}}function pr(){return{type:l.Pattern,alternatives:[M()]}}function fr(e,t,r,s,n){if(r<t)throw new Error("Quantifier range out of order");return{type:l.Quantifier,min:t,max:r,greedy:s,possessive:n,element:e}}function gr(e,t){return{type:l.Regex,pattern:e,flags:t}}function hr(e){return{type:l.Subroutine,ref:e}}function B(e,t){let r={negate:!1,skipPropertyNameValidation:!1,...t};return{type:l.CharacterSet,kind:y.property,value:r.skipPropertyNameValidation?e:Cr(e),negate:r.negate}}function dr(e){return{type:l.VariableLengthCharacterSet,kind:_({"\\R":q.newline,"\\X":q.grapheme}[e],`Unexpected varcharset kind "${e}"`)}}function Cr(e){let t=K(e);if(ke.has(t))throw new Error(f`Unicode property "\p{${e}}" unsupported in Oniguruma`);let r=we.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===l.Group&&Q(e,r=>r.type===l.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===l.CharacterClass&&(e.classes[t]=s,s.negate=r.negate!==s.negate)}}function ze(e,t){return _(e,`${t?.value===93?"Empty":"Unclosed"} character class`)}function Qe(e){return _(e,"Unclosed group")}var A=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function U(e,t,r,s){let n=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),o=[!1],a=0,i="";for(let c of e.matchAll(n)){let{0:u,groups:{$skip:p}}=c;if(!p&&(!s||s===A.DEFAULT==!a)){r instanceof Function?i+=r(c,{context:a?A.CHAR_CLASS:A.DEFAULT,negated:o[o.length-1]}):i+=r;continue}u[0]==="["?(a++,o.push(u[1]==="^")):u==="]"&&a&&(a--,o.pop()),i+=u}return i}function Ze(e,t,r,s){U(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 o=0,a;for(;a=n.exec(e);){let{0:i,groups:{$skip:c}}=a;if(!c&&(!s||s===A.DEFAULT==!o))return a;i==="["?o++:i==="]"&&o&&o--,n.lastIndex==a.index&&n.lastIndex++}return null}function J(e,t,r){return!!yr(e,t,0,r)}function Je(e,t){let r=/\\?./gsu;r.lastIndex=t;let s=e.length,n=0,o=1,a;for(;a=r.exec(e);){let[i]=a;if(i==="[")n++;else if(n)i==="]"&&n--;else if(i==="(")o++;else if(i===")"&&(o--,!o)){s=a.index;break}}return e.slice(t,s)}var ue="$E$",Y=class e extends RegExp{_captureMap;constructor(t,r,s){if(t instanceof RegExp&&s)throw new Error("Cannot provide options when copying regexp");let n;s?.useEmulationGroups&&({expression:t,captureMap:n}=Er(t)),super(t,r),n?this._captureMap=n:t instanceof e&&(this._captureMap=t._captureMap)}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 o=1;o<s.length;o++)this._captureMap[o]&&(r.push(s[o]),this.hasIndices&&r.indices.push(n[o]));return r}};function Er(e){let t=ue.replace(/\$/g,"\\$"),r=[!0];return e=U(e,String.raw`\((?:(?!\?)|\?<(?![=!])[^>]+>)(?<mark>${t})?`,({0:s,groups:{mark:n}})=>n?(r.push(!1),s.slice(0,-ue.length)):(r.push(!0),s),A.DEFAULT),{captureMap:r,expression:e}}var Ye=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function et(e,t,r,s){return e.slice(0,t)+s+e.slice(t+r.length)}var tt=new RegExp(String.raw`(?<noncapturingStart>${Ye})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function Se(e,t){if(!/\(\?>/.test(e))return e;let r="(?>",s=`(?:(?=(${t?.useEmulationGroups?ue:""}`,n=[0],o=0,a=0,i=NaN,c;do{c=!1;let u=0,p=0,h=!1,C;for(tt.lastIndex=Number.isNaN(i)?0:i+s.length;C=tt.exec(e);){let{0:d,index:k,groups:{capturingStart:R,noncapturingStart:T}}=C;if(d==="[")u++;else if(u)d==="]"&&u--;else if(d===r&&!h)i=k,h=!0;else if(h&&T)p++;else if(R)h?p++:(o++,n.push(o+a));else if(d===")"&&h){if(!p){a++,e=`${e.slice(0,i)}${s}${e.slice(i+r.length,k)}))<$$${a+o}>)${e.slice(k+1)}`,c=!0;break}p--}}}while(c);return e=U(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:u,groups:{backrefNum:p,wrappedBackrefNum:h}})=>{if(p){let C=+p;if(C>n.length-1)throw new Error(`Backref "${u}" greater than number of captures`);return`\\${n[C]}`}return`\\${h}`},A.DEFAULT),e}var rt=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Ae=new RegExp(String.raw` | ||
`.replace(/\s+/g,""),"gsu");function z(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(se.lastIndex=0;i=se.exec(e);){let f=Wt(a,e,i[0],se.lastIndex);f.tokens?o.push(...f.tokens):f.token&&o.push(f.token),f.lastIndex!==void 0&&(se.lastIndex=f.lastIndex)}let c=[],p=0;o.forEach(f=>{f.type===d.GroupOpen&&(f.kind===x.capturing?f.number=++p:f.raw==="("&&c.push(f))}),p||c.forEach((f,w)=>{f.kind=x.capturing,f.number=w+1});let l=p||c.length;return o=o.map(f=>f.type===d.EscapedNumber?Yt(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 Wt(e,t,r,s){let[n,a,o]=r;if(n==="["){let i=Kt(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:H.keep})};if(a==="N")return{token:C(d.CharacterSet,r,{kind:A.non_newline})};if(a==="O")return{token:C(d.CharacterSet,r,{kind:A.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:Qt(r,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,r==="("&&!e.captureGroup||r==="(?:")return{token:C(d.GroupOpen,r,{kind:x.group})};if(r==="(?>")return{token:C(d.GroupOpen,r,{kind:x.atomic})};if(r==="(?="||r==="(?!"||r==="(?<="||r==="(?<!")return{token:C(d.GroupOpen,r,{kind:o==="<"?x.lookbehind:x.lookahead,negate:r.endsWith("!")})};if(o==="<"||o==="'"||r==="("&&e.captureGroup){let i=C(d.GroupOpen,r,{kind:x.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:A.dot})}:r==="^"||r==="$"?{token:C(d.Assertion,r,{kind:r})}:r==="|"?{token:C(d.Alternator,r)}:Ke.test(r)?{token:qt(r)}:(ze(r),{token:C(d.Character,r,{value:r.codePointAt(0)})})}function Kt(e,t,r){let s=[C(d.CharacterClassOpen,t,{negate:t[1]==="^"})],n=1,a;for(be.lastIndex=r;a=be.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:be.lastIndex||e.length}}function Ht(e){if(e[0]==="\\")return He(e,{inCharClass:!0});if(e[0]==="["){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!ne.get(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return C(d.CharacterSet,e,{kind:A.posix,negate:!!t.groups.negate,value:t.groups.name})}return e==="-"?C(d.CharacterClassHyphen,e):e==="&&"?C(d.CharacterClassIntersector,e):(ze(e),C(d.Character,e,{value:e.codePointAt(0)}))}function He(e,{inCharClass:t}){let r=e[1];if(r==="c"||r==="C")return zt(e);if("dDhHsSwW".includes(r))return Xt(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:Jt(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 zt(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:H.flags,flags:i});if(e.endsWith(":")){t.pushModX(n),t.numOpenGroups++;let c=C(d.GroupOpen,e,{kind:x.group});return(a||o)&&(c.flags=i),c}throw new Error(`Unexpected flag modifier "${e}"`)}function qt(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 Xt(e){let t=e[1].toLowerCase();return C(d.CharacterSet,e,{kind:{d:A.digit,h:A.hex,s:A.space,w:A.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:A.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 Jt(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 Yt(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 ze(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 I({type:e,kind:t}){return e===u.Assertion&&(t===m.lookahead||t===m.lookbehind)}function ae({type:e,min:t}){return e===u.Assertion||e===u.Directive||e===u.Quantifier&&!t}function M(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(){v(p,"Container expected").splice(Math.max(0,c+l),1),l-=1},removeAllNextSiblings(){return v(p,"Container expected").splice(c+1)},removeAllPrevSiblings(){let _=c+l;return l-=_,v(p,"Container expected").splice(0,Math.max(0,_))},replaceWith(_){tr(_,i),p?p[Math.max(0,c+l)]=_:i[c]=_},skip(){f=!0}},g=er(o).find(_=>!!r[_]),E=g&&r[g],b=typeof E=="function"?E:E?.enter,$=E?.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:I(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 $?.(w,t),l}a(e.node,e.parent,e.key,e.container)}var Qe={AnyGroup:"AnyGroup",AnyNode:"AnyNode"};function er(e){let{type:t}=e,r=[Qe.AnyNode];return(t===u.CapturingGroup||t===u.Group||I(e))&&r.push(Qe.AnyGroup),r.push(t),r}function tr(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=A,X=H,q={grapheme:"grapheme",newline:"newline"};function Z({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,E){let b=e[a.current];switch(a.parent=g,a.token=b,a.current++,b.type){case d.Alternator:return U();case d.Assertion:return Ze(b);case d.Backreference:return rr(a);case d.Character:return Je(b.value);case d.CharacterClassHyphen:return nr(a,E);case d.CharacterClassOpen:return sr(a,E);case d.CharacterSet:return ar(a);case d.Directive:return fr(b);case d.GroupOpen:return or(a,E);case d.Quantifier:return ir(a);case d.Subroutine:return cr(a);case d.VariableLengthCharacterSet:return wr(b.kind);default:throw new Error(`Unexpected token type "${b.type}"`)}}let i=Cr(hr(),gr(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 M({node:i},null,{AnyNode({node:g,parent:E}){g.parent=E}}),i}function rr(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,oe(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 oe(s)}return n(+s)}function nr(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(),pr(a,i);throw new Error("Invalid character class range")}return Je(45)}function sr(e,t){let{token:r,tokens:s,verbose:n,walk:a}=e,o=s[e.current],i=Ae({negate:r.negate}),c=i.elements[0],p=qe(o);for(;p.type!==d.CharacterClassClose;){if(p.type===d.CharacterClassIntersector)c.classes.push(Ae({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 ar({token:e,skipPropertyNameValidation:t}){let{kind:r,negate:s,value:n}=e;if(r===A.property){let a=K(n);if(Le.has(a))r=A.posix,n=a;else return B(n,{negate:s,skipPropertyNameValidation:t})}return r===A.posix?{type:u.CharacterSet,kind:k.posix,negate:s,value:n}:ie(r,{negate:s})}function or(e,t){let{token:r,tokens:s,capturingGroups:n,namedGroupsByName:a,verbose:o,walk:i}=e,c=ur(r);c.type===u.CapturingGroup&&(n.push(c),c.name&&L(a,c.name,[]).push(c));let p=Xe(s[e.current]);for(;p.type!==d.GroupClose;){if(p.type===d.Alternator)c.alternatives.push(U()),e.current++;else{let l=c.alternatives.at(-1);l.elements.push(i(l,t))}p=Xe(s[e.current])}return o||(c=yr(c)),e.current++,c}function ir({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=dr(o,r,s,n,a);return t.elements.pop(),i}function cr(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=mr(n);return s.push(o),o}function U(){return{type:u.Alternative,elements:[]}}function Ze({type:e,kind:t,negate:r}){if(e===d.GroupOpen)return ce({behind:t===x.lookbehind,negate:r});let s=v({"^":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 oe(e,t){let r=!!t?.orphan;return{type:u.Backreference,...r&&{orphan:r},ref:e}}function ur(e){let{kind:t,number:r,name:s,flags:n}=e;switch(t){case x.atomic:return P({atomic:!0});case x.capturing:return xe(r,s);case x.group:return P({flags:n});case x.lookahead:case x.lookbehind:return Ze(e);default:throw new Error(`Unexpected group kind "${t}"`)}}function xe(e,t){let r=t!==void 0;if(r&&!Er(t))throw new Error(`Group name "${t}" invalid in Oniguruma`);return{type:u.CapturingGroup,number:e,...r&&{name:t},alternatives:[U()]}}function Je(e){return{type:u.Character,value:e}}function Ae(e){let t={baseOnly:!1,negate:!1,...e};return{type:u.CharacterClass,negate:t.negate,elements:t.baseOnly?[]:[lr()]}}function lr(){return{type:u.CharacterClassIntersection,classes:[Ae({negate:!1,baseOnly:!0})]}}function pr(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 ie(e,{negate:t}){let r={type:u.CharacterSet,kind:v(k[e],`Unexpected character set kind "${e}"`)};return(e===A.digit||e===A.hex||e===A.space||e===A.word)&&(r.negate=t),r}function fr({kind:e,flags:t}){let r={type:u.Directive,kind:v(X[e],`Unexpected directive kind "${e}"`)};return e===H.flags&&(r.flags=t),r}function gr({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:[U()]}}function ce(e){let t={behind:!1,negate:!1,...e};return{type:u.Assertion,kind:t.behind?m.lookbehind:m.lookahead,negate:t.negate,alternatives:[U()]}}function hr(){return{type:u.Pattern,alternatives:[U()]}}function dr(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 Cr(e,t){return{type:u.Regex,pattern:e,flags:t}}function mr(e){return{type:u.Subroutine,ref:e}}function B(e,t){let r={negate:!1,skipPropertyNameValidation:!1,...t};return{type:u.CharacterSet,kind:k.property,value:r.skipPropertyNameValidation?e:kr(e),negate:r.negate}}function wr(e){return{type:u.VariableLengthCharacterSet,kind:v({"\\R":q.newline,"\\X":q.grapheme}[e],`Unexpected varcharset kind "${e}"`)}}function kr(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 yr(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 Er(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 v(e,`${t?.value===93?"Empty":"Unclosed"} character class`)}function Xe(e){return v(e,"Unclosed group")}var S=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function O(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){O(e,t,r,s)}function Ar(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 J(e,t,r){return!!Ar(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 ue="$E$",Y=class e extends RegExp{_captureMap;constructor(t,r,s){if(t instanceof RegExp&&s)throw new Error("Cannot provide options when copying regexp");let n;s?.useEmulationGroups&&({expression:t,captureMap:n}=xr(t)),super(t,r),n?this._captureMap=n:t instanceof e&&(this._captureMap=t._captureMap)}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++)this._captureMap[a]&&(r.push(s[a]),this.hasIndices&&r.indices.push(n[a]));return r}};function xr(e){let t=ue.replace(/\$/g,"\\$"),r=[!0];return e=O(e,String.raw`\((?:(?!\?)|\?<(?![=!])[^>]+>)(?<mark>${t})?`,({0:s,groups:{mark:n}})=>n?(r.push(!1),s.slice(0,-ue.length)):(r.push(!0),s),S.DEFAULT),{captureMap:r,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?ue:""}`,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:E,groups:{capturingStart:b,noncapturingStart:$}}=w;if(g==="[")p++;else if(p)g==="]"&&p--;else if(g===r&&!f)i=E,f=!0;else if(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,E)}))<$$${o+a}>)${e.slice(E+1)}`,c=!0;break}l--}}}while(c);return e=O(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` | ||
\\(?: \d+ | ||
@@ -43,7 +43,7 @@ | c[A-Za-z] | ||
))? | ||
| (?<qBase>${rt})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?) | ||
| (?<qBase>${st})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?) | ||
| \\?. | ||
`.replace(/\s+/g,""),"gsu");function _e(e){if(!new RegExp(`${rt}\\+`).test(e))return e;let t=[],r=null,s=null,n="",o=0,a;for(Ae.lastIndex=0;a=Ae.exec(e);){let{0:i,index:c,groups:{qBase:u,qMod:p,invalidQ:h}}=a;if(i==="[")o||(s=c),o++;else if(i==="]")o?o--:s=null;else if(!o)if(p==="+"&&n&&!n.startsWith("(")){if(h)throw new Error(`Invalid quantifier "${i}"`);let C=-1;if(/^\{\d+\}$/.test(u))e=et(e,c+u.length,p,"");else{if(n===")"||n==="]"){let d=n===")"?r:s;if(d===null)throw new Error(`Invalid unmatched "${n}"`);e=`${e.slice(0,d)}(?>${e.slice(d,c)}${u})${e.slice(c+i.length)}`}else e=`${e.slice(0,c-n.length)}(?>${n}${u})${e.slice(c+i.length)}`;C+=4}Ae.lastIndex+=C}else i[0]==="("?t.push(c):i===")"&&(r=t.length?t.pop():null);n=i}return e}function nt(e){let t=e.pattern.alternatives,r=t[0].elements[0];if(t.length>1||!r)return null;let s=Q(e.pattern,a=>a.type===l.CapturingGroup||a.type===l.Group)&&r.alternatives.length===1,n=s?r.alternatives[0]:t[0],o=s?n.elements[0]:r;if(!o)return null;if((o.type===l.CapturingGroup||o.type===l.Group)&&o.alternatives.length===2&&o.alternatives[0].elements.length===1&&o.alternatives[1].elements.length===1){let a=o.alternatives[0].elements[0],i=o.alternatives[1].elements[0];if(a.kind===w.line_start&&i.kind===w.search_start||a.kind===w.search_start&&i.kind===w.line_start)return a.kind===w.line_start?o.alternatives.pop():o.alternatives.shift(),"line_or_search_start"}if(le(o,{negate:!0}))return o.parent.elements.shift(),"not_search_start";for(let a=0;a<n.elements.length;a++){let i=n.elements[a];if(!ae(i))break;if(le(i,{negate:!0}))return n.elements.splice(a,1),"not_search_start"}return null}var ee=class e extends Y{#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,o=this.#e;if(o==="line_or_search_start"&&s&&this.lastIndex){this.lastIndex=0;let a=r.call(this,t.slice(n));return a&&(a.input=t,a.index+=n,this.lastIndex+=n),a}if(o==="not_search_start"){let a=r.call(this,t);if(a?.index===n){let i=s?this:new RegExp(this.source,`g${this.flags}`);i.lastIndex=a.index+1,a=r.call(i,t)}return a}return r.call(this,t)}};function le(e,t){return F(e)&&e.negate===t.negate&&Q(e,r=>r.kind===w.search_start)}var $e=String.raw,st=$e`(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})`,at=$e`\u{E0061}-\u{E007A}`,ot=()=>new RegExp($e`[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[${at}]{2}[\u{E0030}-\u{E0039}${at}]{1,3}\u{E007F}|${st}(?:\u200D${st})*`,"gu");function ct(e,t){let r={accuracy:"default",allowUnhandledGAnchors:!1,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t},s=r.avoidSubclass?null:nt(e),n={accuracy:r.accuracy,allowUnhandledGAnchors:r.allowUnhandledGAnchors,asciiWordBoundaries:r.asciiWordBoundaries,flagDirectivesByAlt:new Map,minTargetEs2024:W(r.bestEffortTarget,"ES2024"),subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};I({node:e},n,ut);let o={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:o,prevFlags:null,globalFlags:o,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:n.subroutineRefMap};I({node:e},a,lt);let i={groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer};return I({node:e},i,br),s&&(e._strategy=s),e}var ut={Alternative:{enter({node:e,parent:t,key:r},{flagDirectivesByAlt:s}){let n=e.elements.filter(o=>o.kind===X.flags);for(let o=r+1;o<t.alternatives.length;o++){let a=t.alternatives[o];L(s,a,[]).push(...n)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let r=gt(t.get(e));if(r){let s=te(G({flags:r}),e.elements);s.parent=e,e.elements=[s]}}}},Assertion({node:e,ast:t,remove:r,replaceWith:s},{allowUnhandledGAnchors:n,asciiWordBoundaries:o,supportedGNodes:a,wordIsAscii:i}){let{kind:c,negate:u}=e;if(c===w.line_end)s($(f`(?=\z|\n)`));else if(c===w.line_start)s($(f`(?<=\A|\n)`));else if(c===w.search_start){if(!a.has(e)&&!n)throw new Error(f`Uses "\G" in a way that's unsupported`);t.flags.sticky=!0,r()}else if(c===w.string_end_newline)s($(f`(?=\n?\z)`));else if(c===w.word_boundary&&!i&&!o){let p=`(?:(?<=${P})(?!${P})|(?<!${P})(?=${P}))`,h=`(?:(?<=${P})(?=${P})|(?<!${P})(?!${P}))`;s($(u?h:p))}},CapturingGroup({node:e},{subroutineRefMap:t}){let{name:r,number:s}=e;if(r&&!$r(r))throw new Error(`Group name "${r}" invalid in JS`);t.set(r??s,e)},CharacterSet({node:e,replaceWith:t},{accuracy:r,minTargetEs2024:s,digitIsAscii:n,spaceIsAscii:o,wordIsAscii:a}){let{kind:i,negate:c,value:u}=e;if(n&&(i===y.digit||u==="digit")){t(ie(y.digit,{negate:c}));return}if(o&&(i===y.space||u==="space")){t(ve($(xr),c));return}if(a&&(i===y.word||u==="word")){t(ie(y.word,{negate:c}));return}if(i===y.any)t(B("Any"));else if(i===y.digit)t(B("Nd",{negate:c}));else if(i===y.hex)t(B("AHex",{negate:c}));else if(i===y.non_newline)t($(f`[^\n]`));else if(i===y.space)t(B("space",{negate:c}));else if(i===y.word)t(ve($(P),c));else if(i===y.property)me.has(u)||(e.key="sc");else if(i===y.posix)if(!s&&(u==="graph"||u==="print")){if(r==="strict")throw new Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let p={graph:"!-~",print:" -~"}[u];c&&(p=`\0-${E(p.codePointAt(0)-1)}${E(p.codePointAt(2)+1)}-\u{10FFFF}`),t($(`[${p}]`))}else t(ve($(ne.get(u)),c))},Directive(e,t){let{node:r,parent:s,ast:n,remove:o,replaceWith:a,removeAllPrevSiblings:i,removeAllNextSiblings:c}=e,{kind:u,flags:p}=r;if(u===X.flags)if(!p.enable&&!p.disable)o();else{let h=te(G({flags:p}),c());a(h),mt(h,e,t,ut)}else if(u===X.keep){if(s.parent!==n.pattern||n.pattern.alternatives.length>1)throw new Error(f`Uses "\K" in a way that's unsupported`);a(te(ce({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},{allowUnhandledGAnchors:t,supportedGNodes:r}){let s=[],n=!1,o=!1;for(let a of e.alternatives){let i=dt(a.elements);i?(n=!0,Array.isArray(i)?s.push(...i):s.push(i)):o=!0}if(n&&o&&!t)throw new Error(f`Uses "\G" in a way that's unsupported`);s.forEach(a=>r.add(a))},Quantifier({node:e}){if(e.element.type===l.Quantifier){let t=te(G(),[e.element]);t.parent=e,e.element=t}},VariableLengthCharacterSet({node:e,replaceWith:t},{accuracy:r,minTargetEs2024:s}){let{kind:n}=e;if(n===q.newline)t($(`(?>\r | ||
`.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}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(!ae(i))break;if(le(i,{negate:!0}))return n.elements.splice(o,1),"not_search_start"}return null}var ee=class e extends Y{#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&&(o.input=t,o.index+=n,this.lastIndex+=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 le(e,t){return I(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",allowUnhandledGAnchors:!1,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t},s=r.avoidSubclass?null:at(e),n={accuracy:r.accuracy,allowUnhandledGAnchors:r.allowUnhandledGAnchors,asciiWordBoundaries:r.asciiWordBoundaries,flagDirectivesByAlt:new Map,minTargetEs2024:W(r.bestEffortTarget,"ES2024"),subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};M({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};M({node:e},o,ft);let i={groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer};return M({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===X.flags);for(let a=r+1;a<t.alternatives.length;a++){let o=t.alternatives[a];L(s,o,[]).push(...n)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let r=dt(t.get(e));if(r){let s=te(P({flags:r}),e.elements);s.parent=e,e.elements=[s]}}}},Assertion({node:e,ast:t,remove:r,replaceWith:s},{allowUnhandledGAnchors:n,asciiWordBoundaries:a,supportedGNodes:o,wordIsAscii:i}){let{kind:c,negate:p}=e;if(c===m.line_end)s(F(h`(?=\z|\n)`));else if(c===m.line_start)s(F(h`(?<=\A|\n(?!\z))`));else if(c===m.search_start){if(o.has(e))t.flags.sticky=!0;else if(!n)throw new Error(h`Uses "\G" in a way that's unsupported`);r()}else if(c===m.string_end_newline)s(F(h`(?=\n?\z)`));else if(c===m.word_boundary&&!i&&!a){let l=`(?:(?<=${N})(?!${N})|(?<!${N})(?=${N}))`,f=`(?:(?<=${N})(?=${N})|(?<!${N})(?!${N}))`;s(F(p?f:l))}},CapturingGroup({node:e},{subroutineRefMap:t}){let{name:r,number:s}=e;if(r&&!Gr(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(ie(k.digit,{negate:c}));return}if(a&&(i===k.space||p==="space")){t(Fe(F(_r),c));return}if(o&&(i===k.word||p==="word")){t(ie(k.word,{negate:c}));return}if(i===k.any)t(B("Any"));else if(i===k.digit)t(B("Nd",{negate:c}));else if(i===k.hex)t(B("AHex",{negate:c}));else if(i===k.non_newline)t(F(h`[^\n]`));else if(i===k.space)t(B("space",{negate:c}));else if(i===k.word)t(Fe(F(N),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-${y(l.codePointAt(0)-1)}${y(l.codePointAt(2)+1)}-\u{10FFFF}`),t(F(`[${l}]`))}else t(Fe(F(ne.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===X.flags)if(!l.enable&&!l.disable)a();else{let f=te(P({flags:l}),c());o(f),kt(f,e,t,pt)}else if(p===X.keep){if(s.parent!==n.pattern||n.pattern.alternatives.length>1)throw new Error(h`Uses "\K" in a way that's unsupported`);o(te(ce({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},{allowUnhandledGAnchors: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=te(P(),[e.element]);t.parent=e,e.element=t}},VariableLengthCharacterSet({node:e,replaceWith:t},{accuracy:r,minTargetEs2024:s}){let{kind:n}=e;if(n===q.newline)t(F(`(?>\r | ||
?|[ | ||
\v\f\x85\u2028\u2029])`));else if(n===q.grapheme){if(r==="strict")throw new Error(f`Use of "\X" requires non-strict accuracy`);let o=s?f`\p{RGI_Emoji}`:ot().source.replace(/\\u\{/g,"\\x{");t($(f`(?>\r\n|${o}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}))}else throw new Error(`Unexpected varcharset kind "${n}"`)}},lt={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:r}){let{orphan:s,ref:n}=e;s||r.set(e,[...t.get(n).map(({node:o})=>o)])},Recursion({node:e,parent:t},{reffedNodesByReferencer:r}){let{ref:s}=e,n=t;for(;(n=n.parent)&&!(n.type===l.CapturingGroup&&(n.name===s||n.number===s)););r.set(e,n)},CapturingGroup:{enter({node:e,replaceWith:t,skip:r},{groupOriginByCopy:s,groupsByName:n,multiplexCapturesToLeftByRef:o,openRefs:a,reffedNodesByReferencer:i}){let c=s.get(e),u=e.name??e.number;if(c&&a.has(u)){let h=it(u);i.set(h,a.get(u)),t(h),r();return}a.set(u,e);let p=L(o,u,[]);for(let h=0;h<p.length;h++){let C=p[h];if(c===C.node||c&&c===C.origin||e===C.origin){p.splice(h,1);break}}if(p.push({node:e,origin:c}),e.name){let h=L(n,e.name,new Map);for(let C of h.values())!C.hasDuplicateNameToRemove&&pt(C.node,e,{ancestorsParticipate:!0})&&(C.hasDuplicateNameToRemove=!0);n.get(e.name).set(e,{node:e})}},exit({node:e},{openRefs:t}){t.delete(e.name??e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=D(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine(e,t){let{node:r,replaceWith:s}=e,{ref:n}=r,o=t.subroutineRefMap.get(n),a=n===0,i=a?it(n):ft(o,t.groupOriginByCopy,null),c=i;if(!a){let u=gt(Sr(o,h=>h.type===l.Group&&!!h.flags)),p=u?D(t.globalFlags,u):t.globalFlags;Ar(p,t.currentFlags)||(c=te(G({flags:_r(p)}),[i]))}s(c),a||mt(c,e,t,lt)}},br={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(o=>pt(o,e,{ancestorsParticipate:!1}));if(!n.length)t(ce({negate:!0}));else if(n.length>1){let o=n.map(a=>pe(M(),[oe(a.number)]));t(pe(G(),o))}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=xe();e.pattern.alternatives.at(-1).elements.push(n)}}}},xr="[ -\r ]",P=f`[\p{L}\p{M}\p{N}\p{Pc}]`;function pe(e,t){return t.forEach(r=>r.parent=e),e[Fe(e)]=t,e}function Ar(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function pt(e,t,{ancestorsParticipate:r}){let s=t;do{if(s.type===l.Pattern)return!1;if(s.type===l.Alternative)continue;if(s===e)return r;let n=ht(s.parent);for(let o of n){if(o===s)break;if(o===e||Ct(o,e))return!0}}while(s=s.parent);throw new Error("Unexpected path")}function ft(e,t,r,s){let n=Array.isArray(e)?[]:{};for(let[o,a]of Object.entries(e))o==="parent"?n.parent=Array.isArray(r)?s:r:a&&typeof a=="object"?n[o]=ft(a,t,n,r):(o==="type"&&a===l.CapturingGroup&&t.set(n,t.get(e)??e),n[o]=a);return n}function it(e){return{type:l.Recursion,ref:e}}function Sr(e,t){let r=[];for(;e=e.parent;)(!t||t(e))&&r.push(e);return r}function Fe(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 _r({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===l.Quantifier)return[e.element];let t=Fe(e);return t&&e[t]}function dt(e){let t=e.find(r=>r.kind===w.search_start||le(r,{negate:!1})||!ae(r));if(!t)return null;if(t.kind===w.search_start)return t;if(F(t))return t.alternatives[0].elements[0];if(t.type===l.Group||t.type===l.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 $r(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function $(e,t){let r=!!t?.skipPropertyNameValidation,n=Z(z(e),{skipPropertyNameValidation:r}).pattern.alternatives;return n.length>1||n[0].elements.length>1?pe(G(),n):n[0].elements[0]}function te(e,t){let r=Fe(e);return e[r][0].parent=e,t&&pe(e[r][0],t),e}function ve(e,t){return e.negate=t,e}function mt(e,{parent:t,key:r,container:s},n,o){I({node:e,parent:t,key:r,container:s},n,o)}function kt(e,t){let r=re(t),s=W(r.target,"ES2024"),n=W(r.target,"ES2025"),o=r.maxRecursionDepth;if(o!==null&&(!Number.isInteger(o)||o<2||o>100))throw new Error("Invalid maxRecursionDepth; use 2-100 or null");let a=null,i=null;if(!n){let d=[e.flags.ignoreCase];I({node:e},{getCurrentModI:()=>d.at(-1),popModI(){d.pop()},pushModI(k){d.push(k)},setHasCasedChar(){d.at(-1)?a=!0:i=!0}},vr)}let c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||a)&&!i)},u=null,p={accuracy:r.accuracy,appliedGlobalFlags:c,captureFlagIMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},groupNames:new Set,inCharClass:!1,lastNode:u,maxRecursionDepth:o,useAppliedIgnoreCase:!!(!n&&a&&i),useDuplicateNames:n,useFlagMods:n,useFlagV:s,usePostEs2018Properties:s,verbose:r.verbose};function h(d){switch(p.lastNode=u,u=d,d.type){case l.Regex:return{pattern:h(d.pattern),flags:h(d.flags),options:{...d.options}};case l.Alternative:return d.elements.map(h).join("");case l.Assertion:return Nr(d,p,h);case l.Backreference:return Mr(d,p);case l.CapturingGroup:return Rr(d,p,h);case l.Character:return Tr(d,p);case l.CharacterClass:return Ur(d,p,h);case l.CharacterClassIntersection:if(!p.useFlagV)throw new Error("Use of class intersection requires min target ES2024");return d.classes.map(h).join("&&");case l.CharacterClassRange:return Or(d,p);case l.CharacterSet:return Dr(d,p);case l.Flags:return Lr(d,p);case l.Group:return Br(d,p,h);case l.Pattern:return d.alternatives.map(h).join("|");case l.Quantifier:return h(d.element)+Kr(d);case l.Recursion:return Vr(d,p);default:throw new Error(`Unexpected node type "${d.type}"`)}}let C=h(e);return s||(delete C.options.force.v,C.options.disable.v=!0,C.options.unicodeSetsPlugin=null),C}var vr={AnyGroup:{enter({node:e},t){let r=t.getCurrentModI();t.pushModI(e.flags?D({ignoreCase:r},e.flags).ignoreCase:r)},exit(e,t){t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){Ie(E(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},r){t(),yt(e,{firstOnly:!0}).length&&r.setHasCasedChar()},CharacterSet({node:e},t){e.kind===y.property&&ye.has(e.value)&&t.setHasCasedChar()}},Fr=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),Ir=new Set(["-","\\","]","^","["]),Gr=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),wt=new Map([[9,f`\t`],[10,f`\n`],[11,f`\v`],[12,f`\f`],[13,f`\r`],[8232,f`\u2028`],[8233,f`\u2029`],[65279,f`\uFEFF`]]),Pr=/^\p{Cased}$/u;function Ie(e){return Pr.test(e)}function Nr(e,t,r){let{kind:s,negate:n,alternatives:o}=e;if(F(e))return`(?${`${s===w.lookahead?"":"<"}${n?"!":"="}`}${o.map(r).join("|")})`;if(s===w.string_end)return"$";if(s===w.string_start)return"^";if(s===w.word_boundary)return n?f`\B`:f`\b`;throw new Error(`Unexpected assertion kind "${s}"`)}function Mr({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.captureFlagIMap.get(e))throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e}function Rr({name:e,number:t,alternatives:r},s,n){return e&&(s.groupNames.has(e)?s.useDuplicateNames||(e=null):s.groupNames.add(e)),s.captureFlagIMap.set(t,s.currentFlags.ignoreCase),`(${e?`?<${e}>`:""}${r.map(n).join("|")})`}function Tr({value:e},t){let r=E(e),s=V(e,{isAfterBackref:t.lastNode.type===l.Backreference,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(s!==r)return s;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Ie(r)){let n=Ce(r);return t.inCharClass?n.join(""):n.length>1?`[${n.join("")}]`:n[0]}return r}function Ur({negate:e,parent:t,elements:r},s,n){let o=()=>`[${e?"^":""}${r.map(n).join("")}]`;if(!s.inCharClass){s.inCharClass=!0;let i=o();return s.inCharClass=!1,i}let a=r[0].type;if(!e&&(!s.useFlagV||!s.verbose)&&t.type===l.CharacterClass&&a!==l.CharacterClassIntersection||!s.verbose&&t.type===l.CharacterClassIntersection&&r.length===1&&a!==l.CharacterClass&&a!==l.CharacterClassRange)return r.map(n).join("");if(!s.useFlagV&&t.type===l.CharacterClass)throw new Error("Use of nested character class requires min target ES2024");return o()}function Or(e,t){let r=e.min.value,s=e.max.value,n={isAfterBackref:!1,inCharClass:!0,useFlagV:t.useFlagV},o=V(r,n),a=V(s,n),i="";if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){let c=yt(e);jr(c).forEach(p=>{i+=Array.isArray(p)?`${V(p[0],n)}-${V(p[1],n)}`:V(p,n)})}return`${o}-${a}${i}`}function Dr({kind:e,negate:t,value:r,key:s},n){if(e===y.dot)return n.currentFlags.dotAll?n.appliedGlobalFlags.dotAll||n.useFlagMods?".":"[^]":f`[^\n]`;if(e===y.digit)return t?f`\D`:f`\d`;if(e===y.property){if(!n.usePostEs2018Properties&&Ue.has(r))throw new Error(`Unicode property "${r}" unavailable in target ES2018`);if(n.useAppliedIgnoreCase&&n.currentFlags.ignoreCase&&ye.has(r))throw new Error(`Unicode property "${r}" can't be case-insensitive when other chars have specific case`);return`${t?f`\P`:f`\p`}{${s?`${s}=`:""}${r}}`}if(e===y.word)return t?f`\W`:f`\w`;throw new Error(`Unexpected character set kind "${e}"`)}function Lr(e,t){return(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")}function Br({atomic:e,flags:t,parent:r,alternatives:s},n,o){let a=n.currentFlags;t&&(n.currentFlags=D(a,t));let i=s.map(o).join("|"),c=!n.verbose&&s.length===1&&r.type!==l.Quantifier&&!e&&(!n.useFlagMods||!t)?i:`(?${Wr(e,t,n.useFlagMods)}${i})`;return n.currentFlags=a,c}function Vr({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})`:f`\g<${e}&R=${r}>`}function yt(e,t){let r=!!t?.firstOnly,s=e.min.value,n=e.max.value,o=[];if(s<65&&(n===65535||n>=131071)||s===65536&&n>=131071)return o;for(let a=s;a<=n;a++){let i=E(a);if(!Ie(i))continue;let c=Ce(i).filter(u=>{let p=u.codePointAt(0);return p<s||p>n});if(c.length&&(o.push(...c),r))break}return o}function V(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&&Hr(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;let n=r?s?Gr:Ir:Fr,o=E(e);return(n.has(o)?"\\":"")+o}function jr(e){let t=e.map(n=>n.codePointAt(0)).sort((n,o)=>n-o),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 Wr(e,t,r){if(e)return">";let s="";if(t&&r){let{enable:n,disable:o}=t;s=(n?.ignoreCase?"i":"")+(n?.dotAll?"s":"")+(o?"-":"")+(o?.ignoreCase?"i":"")+(o?.dotAll?"s":"")}return`${s}:`}function Kr({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 Hr(e){return e>47&&e<58}var v=String.raw,zr=v`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,Pe=v`\(\?R=(?<rDepth>[^\)]+)\)|${zr}`,fe=v`\(\?<(?![=!])(?<captureName>[^>]+)>`,O=new RegExp(v`${fe}|${Pe}|\(\?|\\?.`,"gsu"),Ge="Cannot use multiple overlapping recursions";function At(e){if(!new RegExp(Pe,"su").test(e))return e;if(J(e,v`\(\?\(DEFINE\)`,A.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");let t=J(e,v`\\[1-9]`,A.DEFAULT),r=new Map,s=[],n=!1,o=0,a=0,i;for(O.lastIndex=0;i=O.exec(e);){let{0:c,groups:{captureName:u,rDepth:p,gRNameOrNum:h,gRDepth:C}}=i;if(c==="[")o++;else if(o)c==="]"&&o--;else if(p){if(Et(p),n)throw new Error(Ge);if(t)throw new Error("Numbered backrefs cannot be used with global recursion");let d=e.slice(0,i.index),k=e.slice(O.lastIndex);if(J(k,Pe,A.DEFAULT))throw new Error(Ge);return bt(d,k,+p,!1)}else if(h){Et(C);let d=!1;for(let j of s)if(j.name===h||j.num===+h){if(d=!0,j.hasRecursedWithin)throw new Error(Ge);break}if(!d)throw new Error(v`Recursive \g cannot be used outside the referenced group "\g<${h}&R=${C}>"`);let k=r.get(h),R=Je(e,k);if(t&&J(R,v`${fe}|\((?!\?)`,A.DEFAULT))throw new Error("Numbered backrefs cannot be used with recursion of capturing groups");let T=e.slice(k,i.index),S=R.slice(T.length+c.length),Ne=bt(T,S,+C,!0),_t=e.slice(0,k),$t=e.slice(k+R.length);e=`${_t}${Ne}${$t}`,O.lastIndex+=Ne.length-c.length-T.length-S.length,s.forEach(j=>j.hasRecursedWithin=!0),n=!0}else if(u)a++,r.set(String(a),O.lastIndex),r.set(u,O.lastIndex),s.push({num:a,name:u});else if(c.startsWith("(")){let d=c==="(";d&&(a++,r.set(String(a),O.lastIndex)),s.push(d?{num:a}:{})}else c===")"&&s.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 bt(e,t,r,s){let n=new Set;s&&Ze(e+t,fe,({groups:{captureName:a}})=>{n.add(a)},A.DEFAULT);let o=r-1;return`${e}${xt(`(?:${e}`,o,s?n:null)}(?:)${xt(`${t})`,o,s?n:null,"backward")}${t}`}function xt(e,t,r,s="forward"){let o=i=>s==="backward"?t-i+2-1:i+2,a="";for(let i=0;i<t;i++){let c=o(i);a+=U(e,v`${fe}|\\k<(?<backref>[^>]+)>`,({0:u,groups:{captureName:p,backref:h}})=>{if(h&&r&&!r.has(h))return u;let C=`_$${c}`;return p?`(?<${p}${C}>`:v`\k<${h}${C}>`},A.DEFAULT)}return a}function St(e,t){let r=re(t),s=z(e,r.flags),n=Z(s,{skipBackrefValidation:r.rules.allowOrphanBackrefs,verbose:r.verbose}),o=ct(n,{accuracy:r.accuracy,allowUnhandledGAnchors:r.rules.allowUnhandledGAnchors,asciiWordBoundaries:r.rules.asciiWordBoundaries,avoidSubclass:r.avoidSubclass,bestEffortTarget:r.target}),a=kt(o,r);e=_e(At(a.pattern));let i=Se(e,{useEmulationGroups:!r.avoidSubclass}),c=i!==e&&!r.avoidSubclass;e=i;let u={pattern:e,flags:`${r.hasIndices?"d":""}${r.global?"g":""}${a.flags}${a.options.disable.v?"u":"v"}`};return(c||o._strategy)&&(u.subclass={useEmulationGroups:c,strategy:o._strategy??null}),u}function Qr(e,t){return Z(z(e,t?.flags))}function qr(e,t){let r=St(e,t);return r.subclass?new ee(r.pattern,r.flags,r.subclass):new RegExp(r.pattern,r.flags)}return Nt(Xr);})(); | ||
\v\f\x85\u2028\u2029])`));else if(n===q.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(F(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)])},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)},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&&L(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=L(n,e.name,new Map);for(let f of l.values())!f.hasDuplicateNameToRemove&>(f.node,e,{ancestorsParticipate:!0})&&(f.hasDuplicateNameToRemove=!0);n.get(e.name).set(e,{node:e})}},exit({node:e},{openRefs:t}){t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=D(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},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?D(t.globalFlags,p):t.globalFlags;$r(l,t.currentFlags)||(c=te(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(ce({negate:!0}));else if(n.length>1){let a=n.map(o=>pe(U(),[oe(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=xe();e.pattern.alternatives.at(-1).elements.push(n)}}}},_r="[ -\r ]",N=h`[\p{L}\p{M}\p{N}\p{Pc}]`;function pe(e,t){return t.forEach(r=>r.parent=e),e[Ge(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 Ge(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=Ge(e);return t&&e[t]}function mt(e){let t=e.find(r=>r.kind===m.search_start||le(r,{negate:!1})||!ae(r));if(!t)return null;if(t.kind===m.search_start)return t;if(I(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 Gr(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function F(e,t){let s=Z(z(e),t).pattern.alternatives;return s.length>1||s[0].elements.length>1?pe(P(),s):s[0].elements[0]}function te(e,t){let r=Ge(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){M({node:e,parent:t,key:r,container:s},n,a)}function Et(e,t){let r=re(t),s=W(r.target,"ES2024"),n=W(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];M({node:e},{getCurrentModI:()=>g.at(-1),popModI(){g.pop()},pushModI(E){g.push(E)},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,captureFlagIMap: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,usePostEs2018Properties: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 Tr(g,l,f);case u.Character:return Dr(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)+Qr(g);case u.Recursion:return Kr(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?D({ignoreCase:r},e.flags).ignoreCase:r)},exit(e,t){t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){Ie(y(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},r){t(),bt(e,{firstOnly:!0}).length&&r.setHasCasedChar()},CharacterSet({node:e},t){e.kind===k.property&&Ee.has(e.value)&&t.setHasCasedChar()}},Mr=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),Pr=new Set(["-","\\","]","^","["]),Nr=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 Ie(e){return Rr.test(e)}function Ur(e,t,r){let{kind:s,negate:n,alternatives:a}=e;if(I(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.captureFlagIMap.get(e))throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e}function Tr({name:e,number:t,alternatives:r},s,n){return e&&(s.groupNames.has(e)?s.useDuplicateNames||(e=null):s.groupNames.add(e)),s.captureFlagIMap.set(t,s.currentFlags.ignoreCase),`(${e?`?<${e}>`:""}${r.map(n).join("|")})`}function Dr({value:e},t){let r=y(e),s=V(e,{isAfterBackref:t.lastNode.type===u.Backreference,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(s!==r)return s;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&Ie(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=V(r,n),o=V(s,n),i="";if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){let c=bt(e);Hr(c).forEach(l=>{i+=Array.isArray(l)?`${V(l[0],n)}-${V(l[1],n)}`:V(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.usePostEs2018Properties&&De.has(r))throw new Error(`Unicode property "${r}" unavailable in target ES2018`);if(n.useAppliedIgnoreCase&&n.currentFlags.ignoreCase&&Ee.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=D(o,t));let i=s.map(a).join("|"),c=!n.verbose&&s.length===1&&r.type!==u.Quantifier&&!e&&(!n.useFlagMods||!t)?i:`(?${zr(e,t,n.useFlagMods)}${i})`;return n.currentFlags=o,c}function Kr({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 bt(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=y(o);if(!Ie(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 V(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?Nr:Pr:Mr,a=y(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 zr(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 qr(e){return e>47&&e<58}var G=String.raw,Xr=G`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,Pe=G`\(\?R=(?<rDepth>[^\)]+)\)|${Xr}`,fe=G`\(\?<(?![=!])(?<captureName>[^>]+)>`,T=new RegExp(G`${fe}|${Pe}|\(\?|\\?.`,"gsu"),Me="Cannot use multiple overlapping recursions",At="$E$";function $t(e,t){if(!new RegExp(Pe,"su").test(e))return e;if(J(e,G`\(\?\(DEFINE\)`,S.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");let r=!!t?.useEmulationGroups,s=J(e,G`\\[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:E}}=p;if(l==="[")i++;else if(i)l==="]"&&i--;else if(w){if(xt(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),$=e.slice(T.lastIndex);if(J($,Pe,S.DEFAULT))throw new Error(Me);return St(b,$,+w,!1,r)}else if(g){xt(E);let b=!1;for(let j of a)if(j.name===g||j.num===+g){if(b=!0,j.hasRecursedWithin)throw new Error(Me);break}if(!b)throw new Error(G`Recursive \g cannot be used outside the referenced group "\g<${g}&R=${E}>"`);let $=n.get(g),_=et(e,$);if(s&&J(_,G`${fe}|\((?!\?)`,S.DEFAULT))throw new Error("Numbered backrefs cannot be used with recursion of capturing groups");let ge=e.slice($,p.index),Ne=_.slice(ge.length+l.length),Re=St(ge,Ne,+E,!0,r),Ft=e.slice(0,$),Gt=e.slice($+_.length);e=`${Ft}${Re}${Gt}`,T.lastIndex+=Re.length-l.length-ge.length-Ne.length,a.forEach(j=>j.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)),a.push(b?{num:c}:{})}else l===")"&&a.pop()}return e}function xt(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 St(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}${_t(`(?:${e}`,o,s?a:null,"forward",n)}(?:)${_t(`${t})`,o,s?a:null,"backward",n)}${t}`}function _t(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+=O(e,G`${fe}|\\k<(?<backref>[^>]+)>${n?G`|\((?!\?)`:""}`,({0:l,groups:{captureName:f,backref:w}})=>{if(w&&r&&!r.has(w))return l;if(l==="(")return`(${At}`;let g=`_$${p}`;return f?`(?<${f}${g}>${n?At:""}`:G`\k<${w}${g}>`},S.DEFAULT)}return i}function vt(e,t){let r=re(t),s=z(e,r.flags,{captureGroup:r.rules.captureGroup}),n=Z(s,{skipBackrefValidation:r.rules.allowOrphanBackrefs,verbose:r.verbose}),a=lt(n,{accuracy:r.accuracy,allowUnhandledGAnchors:r.rules.allowUnhandledGAnchors,asciiWordBoundaries:r.rules.asciiWordBoundaries,avoidSubclass:r.avoidSubclass,bestEffortTarget:r.target}),o=Et(a,r),i={useEmulationGroups:!r.avoidSubclass},c={pattern:_e($e($t(o.pattern,i)),i),flags:`${r.hasIndices?"d":""}${r.global?"g":""}${o.flags}${o.options.disable.v?"u":"v"}`},l=c.pattern.includes("$E$")&&!r.avoidSubclass;return(l||a._strategy)&&(c.subclass={useEmulationGroups:l,strategy:a._strategy??null}),c}function Zr(e,t){let r=t?.flags??"",s=t?.rules?.captureGroup??!1;return Z(z(e,r,{captureGroup:s}))}function Jr(e,t){let r=vt(e,t);return r.subclass?new ee(r.pattern,r.flags,r.subclass):new RegExp(r.pattern,r.flags)}return Ut(Yr);})(); | ||
//# sourceMappingURL=index.min.js.map |
{ | ||
"name": "oniguruma-to-es", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "Convert Oniguruma patterns to native JavaScript RegExp", | ||
@@ -16,2 +16,14 @@ "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 --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": [ | ||
@@ -36,21 +48,10 @@ "dist", | ||
"regex": "^5.0.2", | ||
"regex-recursion": "^4.3.0" | ||
"regex-recursion": "^5.0.0" | ||
}, | ||
"devDependencies": { | ||
"esbuild": "^0.24.0", | ||
"jasmine": "^5.4.0", | ||
"jasmine": "^5.5.0", | ||
"typescript": "^5.7.2", | ||
"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 --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" | ||
} | ||
} | ||
} |
@@ -84,2 +84,3 @@ # Oniguruma-To-ES | ||
asciiWordBoundaries?: boolean; | ||
captureGroup?: boolean; | ||
}; | ||
@@ -121,2 +122,5 @@ target?: 'auto' | 'ES2025' | 'ES2024' | 'ES2018'; | ||
flags?: string; | ||
rules?: { | ||
captureGroup?: boolean; | ||
}; | ||
} | ||
@@ -213,5 +217,6 @@ ): OnigurumaAst; | ||
- `allowOrphanBackrefs`: Useful with TextMate grammars that merge backreferences across patterns. | ||
- `allowUnhandledGAnchors`: Applies flag `y` for unsupported uses of `\G`, rather than erroring. | ||
- Oniguruma-To-ES uses a variety of strategies to accurately emulate many common uses of `\G`. When using this option, if a `\G` is found that doesn't have a known emulation strategy, the `\G` is simply removed and JavaScript's `y` (`sticky`) flag is added. This might lead to some false positives and negatives, but is useful for non-critical matching (like syntax highlighting) when having some mismatches is better than not working. | ||
- `asciiWordBoundaries`: Use ASCII-based `\b` and `\B`, which increases performance. | ||
- `allowUnhandledGAnchors`: Removes unsupported uses of `\G`, rather than erroring. | ||
- Oniguruma-To-ES uses a variety of strategies to accurately emulate many common uses of `\G`. When using this option, if a `\G` is found that doesn't have a known emulation strategy, the `\G` is simply removed. This might lead to some false positive matches, but is useful for non-critical matching (like syntax highlighting) when having some mismatches is better than not working. | ||
- `asciiWordBoundaries`: Use ASCII-based `\b` and `\B`, which increases search performance of generated regexes. | ||
- `captureGroup`: Oniguruma option `ONIG_OPTION_CAPTURE_GROUP`. Unnamed captures and numbered calls allowed when using named capture. | ||
@@ -560,3 +565,3 @@ ### `target` | ||
✔ Error for unescaped <code>[</code> that doesn't form nested class<br> | ||
✔ Allows leading unescaped <code>]</code><br> | ||
✔ Leading unescaped <code>]</code> OK<br> | ||
✔ Fewer chars require escaping than JS<br> | ||
@@ -623,2 +628,3 @@ </td> | ||
✔ Only <code>\n</code> as newline<br> | ||
✔ <code>^</code> doesn't match after string-terminating <code>\n</code><br> | ||
</td> | ||
@@ -918,2 +924,12 @@ </tr> | ||
</tr> | ||
<tr valign="top"> | ||
<th align="left" rowspan="1">Compile-time options</th> | ||
<td colspan="2"><code>ONIG_OPTION_CAPTURE_GROUP</code></td> | ||
<td align="middle">✅</td> | ||
<td align="middle">✅</td> | ||
<td> | ||
✔ Unnamed captures and numbered calls allowed when using named capture<br> | ||
</td> | ||
</tr> | ||
</table> | ||
@@ -936,11 +952,17 @@ | ||
- Grapheme boundaries: `\y`, `\Y`. | ||
- Flags `P` (POSIX is ASCII) and `y{g}`/`y{w}` (grapheme boundary modes). | ||
- Whole-pattern modifiers: Don't capture `(?C)`, ignore-case is ASCII `(?I)`, find longest `(?L)`. | ||
- Absence functions: `(?~…)`, etc. | ||
- Conditionals: `(?(…)…)`, etc. | ||
- Rarely-used character specifiers: Non-A-Za-z with `\cx`, `\C-x`; meta `\M-x`, `\M-\C-x`; bracketed octals `\o{…}`; octal UTF-8 encoded bytes (≥ `\200`). | ||
- Code point sequences: `\x{H H …}`, `\o{O O …}`. | ||
- Callout functions: `(?{…})`, etc. | ||
- Supportable: | ||
- Grapheme boundaries: `\y`, `\Y`. | ||
- Flags `P` (POSIX is ASCII) and `y{g}`/`y{w}` (grapheme boundary modes). | ||
- Rarely-used character specifiers: Non-A-Za-z with `\cx`, `\C-x`; meta `\M-x`, `\M-\C-x`; bracketed octals `\o{…}`; octal UTF-8 encoded bytes (≥ `\200`). | ||
- Code point sequences: `\x{H H …}`, `\o{O O …}`. | ||
- Whole-pattern modifiers: Don't capture `(?C)`, ignore-case is ASCII `(?I)`. | ||
- Supportable for some uses: | ||
- Absence functions: `(?~…)`, etc. | ||
- Conditionals: `(?(…)…)`, etc. | ||
- Whole-pattern modifiers: Find longest `(?L)`. | ||
- Not supportable: | ||
- Callout functions: `(?{…})`, etc. | ||
Despite the current omissions, Oniguruma-To-ES handles more than 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. | ||
## ㊗️ Unicode / mixed case-sensitivity | ||
@@ -947,0 +969,0 @@ |
@@ -12,2 +12,3 @@ export type OnigurumaToEsOptions = { | ||
asciiWordBoundaries?: boolean; | ||
captureGroup?: boolean; | ||
}; | ||
@@ -30,2 +31,3 @@ target?: "auto" | "ES2025" | "ES2024" | "ES2018"; | ||
asciiWordBoundaries?: boolean; | ||
captureGroup?: boolean; | ||
}; | ||
@@ -56,2 +58,5 @@ target?: keyof Target; | ||
flags?: string; | ||
rules?: { | ||
captureGroup?: boolean; | ||
}; | ||
}} [options] | ||
@@ -62,2 +67,5 @@ @returns {import('./parse.js').OnigurumaAst} | ||
flags?: string; | ||
rules?: { | ||
captureGroup?: boolean; | ||
}; | ||
}): import("./parse.js").OnigurumaAst; | ||
@@ -64,0 +72,0 @@ /** |
@@ -177,3 +177,3 @@ export type OnigurumaAst = { | ||
*/ | ||
export function parse({ tokens, flags }: import("./tokenize.js").TokenizerResult, options?: { | ||
export function parse({ tokens, flags, rules }: import("./tokenize.js").TokenizerResult, options?: { | ||
skipBackrefValidation?: boolean; | ||
@@ -180,0 +180,0 @@ skipPropertyNameValidation?: boolean; |
@@ -13,2 +13,5 @@ export type Token = { | ||
}; | ||
rules: { | ||
captureGroup: boolean; | ||
}; | ||
}; | ||
@@ -28,10 +31,16 @@ /** | ||
}; | ||
rules: { | ||
captureGroup: boolean; | ||
}; | ||
}} TokenizerResult | ||
*/ | ||
/** | ||
@param {string} pattern | ||
@param {string} [flags] Oniguruma flags. Flag `m` is equivalent to JS flag `s`. | ||
@param {string} pattern Oniguruma pattern. | ||
@param {string} [flags] Oniguruma flags. | ||
@param {{captureGroup?: boolean;}} [rules] Oniguruma compile-time options. | ||
@returns {TokenizerResult} | ||
*/ | ||
export function tokenize(pattern: string, flags?: string): TokenizerResult; | ||
export function tokenize(pattern: string, flags?: string, rules?: { | ||
captureGroup?: boolean; | ||
}): TokenizerResult; | ||
export namespace TokenCharacterSetKinds { | ||
@@ -38,0 +47,0 @@ let any: string; |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
685142
4172
992
+ Addedregex-recursion@5.1.1(transitive)
- Removedregex-recursion@4.3.0(transitive)
Updatedregex-recursion@^5.0.0