oniguruma-to-es
Advanced tools
Comparing version 0.3.0 to 0.4.0
@@ -1,4 +0,4 @@ | ||
var OnigurumaToES=(()=>{var ie=Object.defineProperty;var kt=Object.getOwnPropertyDescriptor;var yt=Object.getOwnPropertyNames;var bt=Object.prototype.hasOwnProperty;var xt=(e,t)=>{for(var n in t)ie(e,n,{get:t[n],enumerable:!0})},Ft=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of yt(t))!bt.call(e,s)&&s!==n&&ie(e,s,{get:()=>t[s],enumerable:!(a=kt(t,s))||a.enumerable});return e};var It=e=>Ft(ie({},"__esModule",{value:!0}),e);var Vr={};xt(Vr,{EmulatedRegExp:()=>oe,toDetails:()=>_t,toOnigurumaAst:()=>Mr,toRegExp:()=>Br});var Y={ES2018:2018,ES2024:2024,ES2025:2025};function ee(e){if(e?.target!==void 0&&!Y[e.target])throw new Error(`Unexpected target "${e.target}"`);return{accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,maxRecursionDepth:5,target:"ES2024",tmGrammar:!1,verbose:!1,...e}}var A=String.fromCodePoint,g=String.raw;function M(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function B(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function L(e,t){return e.alternatives.length===1&&e.alternatives[0].elements.length===1&&(!t||t(e.alternatives[0].elements[0]))}function H(e,t){return Y[e]>=Y[t]}function F(e,t){if(!e)throw new Error(t??"Value expected");return e}var $t=new Set([A(304),A(305)]);function ue(e){if($t.has(e))return[e];let t=new Set,n=e.toLowerCase(),a=n.toUpperCase(),s=Pt.get(n),i=vt.get(n);return[...a].length===1&&t.add(a),t.add(n),s&&t.add(s),i&&t.add(i),[...t]}var le=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"]),pe=new Map;for(let e of le)pe.set(Q(e),e);var Nt=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"]),fe=new Map;for(let e of Nt)fe.set(Q(e),e);var xe=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(" ")),vt=new Map([[A(223),A(7838)],[A(107),A(8490)],[A(229),A(8491)],[A(969),A(8486)]]),Pt=new Map([G(453),G(456),G(459),G(498),...ce(8072,8079),...ce(8088,8095),...ce(8104,8111),G(8124),G(8140),G(8188)]),te=new Map([["alnum",g`[\p{Alpha}\p{Nd}]`],["alpha",g`\p{Alpha}`],["ascii",g`\p{ASCII}`],["blank",g`[\p{Zs}\t]`],["cntrl",g`\p{cntrl}`],["digit",g`\p{Nd}`],["graph",g`[\P{space}&&\P{cntrl}&&\P{Cn}&&\P{Cs}]`],["lower",g`\p{Lower}`],["print",g`[[\P{space}&&\P{cntrl}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",g`[\p{P}\p{S}]`],["space",g`\p{space}`],["upper",g`\p{Upper}`],["word",g`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",g`\p{AHex}`]]),Fe=new Set(["alnum","blank","graph","print","word","xdigit"]);function Gt(e,t){let n=[];for(let a=e;a<=t;a++)n.push(a);return n}function Q(e){return e.replace(/[- _]+/g,"").toLowerCase()}function G(e){let t=A(e);return[t.toLowerCase(),t]}function ce(e,t){return Gt(e,t).map(n=>G(n))}var ge=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]);var h={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"},S={any:"any",digit:"digit",dot:"dot",hex:"hex",non_newline:"non_newline",posix:"posix",property:"property",space:"space",word:"word"},W={flags:"flags",keep:"keep"},k={atomic:"atomic",capturing:"capturing",group:"group",lookahead:"lookahead",lookbehind:"lookbehind"},Ie=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]),ve=g`\[\^?\]?`,Pe=`c.? | C(?:-.?)?|${g`[pP]\{(?:\^?[\x20\w]+\})?`}|${g`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${g`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${g`o\{[^\}]*\}?`}|${g`\d{1,3}`}`,Ge=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,re=new RegExp(g` | ||
var OnigurumaToES=(()=>{var ce=Object.defineProperty;var Ft=Object.getOwnPropertyDescriptor;var Nt=Object.getOwnPropertyNames;var $t=Object.prototype.hasOwnProperty;var It=(e,t)=>{for(var r in t)ce(e,r,{get:t[r],enumerable:!0})},vt=(e,t,r,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of Nt(t))!$t.call(e,n)&&n!==r&&ce(e,n,{get:()=>t[n],enumerable:!(s=Ft(t,n))||s.enumerable});return e};var Pt=e=>vt(ce({},"__esModule",{value:!0}),e);var zr={};It(zr,{EmulatedRegExp:()=>ie,toDetails:()=>yt,toOnigurumaAst:()=>Wr,toRegExp:()=>qr});var w=String.fromCodePoint,f=String.raw,ve=(()=>{try{new RegExp("(?<n>)|(?<n>)")}catch{return!1}return!0})(),Pe=(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),Ge=(()=>{try{new RegExp("","v")}catch{return!1}return!0})();function O(e,{enable:t,disable:r}){return{dotAll:!r?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!r?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function M(e,t,r){return e.has(t)||e.set(t,r),e.get(t)}function B(e,t){return e.alternatives.length===1&&e.alternatives[0].elements.length===1&&(!t||t(e.alternatives[0].elements[0]))}function V(e,t){return ue[e]>=ue[t]}function x(e,t){if(!e)throw new Error(t??"Value expected");return e}var ue={ES2018:2018,ES2024:2024,ES2025:2025},Gt={auto:"auto",ES2018:"ES2018",ES2024:"ES2024",ES2025:"ES2025"};function Z(e){if(e?.target!==void 0&&!Gt[e.target])throw new Error(`Unexpected target "${e.target}"`);let t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,maxRecursionDepth:5,target:"auto",tmGrammar:!1,verbose:!1,...e};return t.target==="auto"&&(t.target=ve&&Pe?"ES2025":Ge?"ES2024":"ES2018"),t}var Lt=new Set([w(304),w(305)]);function pe(e){if(Lt.has(e))return[e];let t=new Set,r=e.toLowerCase(),s=r.toUpperCase(),n=Mt.get(r),o=Tt.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 fe=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"]),ge=new Map;for(let e of fe)ge.set(j(e),e);var Rt=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"]),he=new Map;for(let e of Rt)he.set(j(e),e);var Le=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(" ")),Tt=new Map([["s",w(383)],[w(383),"s"]]),Ot=new Map([[w(223),w(7838)],[w(107),w(8490)],[w(229),w(8491)],[w(969),w(8486)]]),Mt=new Map([v(453),v(456),v(459),v(498),...le(8072,8079),...le(8088,8095),...le(8104,8111),v(8124),v(8140),v(8188)]),J=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}`]]),Re=new Set(["alnum","blank","graph","print","word","xdigit"]);function Ut(e,t){let r=[];for(let s=e;s<=t;s++)r.push(s);return r}function j(e){return e.replace(/[- _]+/g,"").toLowerCase()}function v(e){let t=w(e);return[t.toLowerCase(),t]}function le(e,t){return Ut(e,t).map(r=>v(r))}var de=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"},A={any:"any",digit:"digit",dot:"dot",hex:"hex",non_newline:"non_newline",posix:"posix",property:"property",space:"space",word:"word"},K={flags:"flags",keep:"keep"},_={atomic:"atomic",capturing:"capturing",group:"group",lookahead:"lookahead",lookbehind:"lookbehind"},Te=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]),Ue=f`\[\^?\]?`,De=`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}`}`,Be=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,Y=new RegExp(f` | ||
\\ (?: | ||
${Pe} | ||
${De} | ||
| [gk]<[^>]*>? | ||
@@ -16,21 +16,21 @@ | [gk]'[^']*'? | ||
)?)? | ||
| ${Ge.source} | ||
| ${ve} | ||
| ${Be.source} | ||
| ${Ue} | ||
| . | ||
`.replace(/\s+/g,""),"gsu"),he=new RegExp(g` | ||
`.replace(/\s+/g,""),"gsu"),Ce=new RegExp(f` | ||
\\ (?: | ||
${Pe} | ||
${De} | ||
| . | ||
) | ||
| \[:[^:]*:\] | ||
| ${ve} | ||
| ${Ue} | ||
| && | ||
| . | ||
`.replace(/\s+/g,""),"gsu");function q(e,t=""){if(typeof e!="string")throw new Error("String expected as pattern");if(!/^[imx]*$/.test(t))throw new Error(`Flags "${t}" unsupported in Oniguruma`);let n=[t.includes("x")],a={getCurrentModX:()=>n.at(-1),numOpenGroups:0,popModX(){n.pop()},pushModX(l){n.push(l)},replaceCurrentModX(l){n[n.length-1]=l}},s=[],i;for(re.lastIndex=0;i=re.exec(e);){let l=Rt(a,e,i[0],re.lastIndex);l.tokens?s.push(...l.tokens):l.token&&s.push(l.token),l.lastIndex!==void 0&&(re.lastIndex=l.lastIndex)}let o=[],c=0;s.forEach(l=>{l.type===h.GroupOpen&&(l.kind===k.capturing?(c++,l.number=c):l.raw==="("&&o.push(l))}),c||o.forEach((l,f)=>{l.kind=k.capturing,l.number=f+1});let u=c||o.length;return s=s.map(l=>l.type===h.EscapedNumber?jt(l,u):l).flat(),{tokens:s,flags:{ignoreCase:t.includes("i"),dotAll:t.includes("m"),extended:t.includes("x")}}}function Rt(e,t,n,a){let[s,i,o]=n;if(s==="["){let c=Tt(t,n,a);return{tokens:c.tokens,lastIndex:c.lastIndex}}if(s==="\\"){if("AbBGzZ".includes(i))return{token:E(h.Assertion,n,{kind:n})};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:E(h.Subroutine,n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw new Error(`Invalid group name "${n}"`);return{token:E(h.Backreference,n)}}if(i==="K")return{token:E(h.Directive,n,{kind:W.keep})};if(i==="N")return{token:E(h.CharacterSet,n,{kind:S.non_newline})};if(i==="O")return{token:E(h.CharacterSet,n,{kind:S.any})};if("RX".includes(i))return{token:E(h.VariableLengthCharacterSet,n,{kind:n})};if("yY".includes(i))throw new Error(`Unsupported grapheme boundary "${n}"`);let c=Re(n,{inCharClass:!1});return Array.isArray(c)?{tokens:c}:{token:c}}if(s==="("){if(o==="#"){if(t[a]!==")")throw new Error('Unclosed comment group "(?#"');return{lastIndex:a+1}}if("-imx".includes(o))return{token:Ut(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n==="("||n==="(?:")return{token:E(h.GroupOpen,n,{kind:k.group})};if(n==="(?>")return{token:E(h.GroupOpen,n,{kind:k.atomic})};if(n==="(?="||n==="(?!"||n==="(?<="||n==="(?<!")return{token:E(h.GroupOpen,n,{kind:o==="<"?k.lookbehind:k.lookahead,negate:n.endsWith("!")})};if(o==="<"||o==="'")return{token:E(h.GroupOpen,n,{kind:k.capturing,name:n.slice(3,-1)})};throw o==="("?new Error(`Unsupported conditional "${n}"`):o==="~"?new Error(`Unsupported absence operator "${n}"`):n==="(?"?new Error("Invalid group"):new Error(`Unexpected group "${n}"`)}if(n===")"){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw new Error('Unmatched ")"');return{token:E(h.GroupClose,n)}}if(n==="#"&&e.getCurrentModX()){let c=t.indexOf(` | ||
`,a);return{lastIndex:c===-1?t.length:c}}if(/^\s$/.test(n)&&e.getCurrentModX()){let c=/\s+/y;return c.lastIndex=a,{lastIndex:c.exec(t)?c.lastIndex:a}}return n==="."?{token:E(h.CharacterSet,n,{kind:S.dot})}:n==="^"||n==="$"?{token:E(h.Assertion,n,{kind:n})}:n==="|"?{token:E(h.Alternator,n)}:Ge.test(n)?{token:Dt(n)}:(Te(n),{token:E(h.Character,n,{value:n.codePointAt(0)})})}function Tt(e,t,n){Ne(t);let a=[E(h.CharacterClassOpen,t,{negate:t[1]==="^"})],s=1,i;for(he.lastIndex=n;i=he.exec(e);){let o=i[0];if(o[0]==="["&&o[1]!==":")Ne(o),s++,a.push(E(h.CharacterClassOpen,o,{negate:o[1]==="^"}));else if(o==="]"){if(s--,a.push(E(h.CharacterClassClose,o)),!s)break}else{let c=Lt(o);Array.isArray(c)?a.push(...c):a.push(c)}}return{tokens:a,lastIndex:he.lastIndex||e.length}}function Lt(e){if(e[0]==="\\")return Re(e,{inCharClass:!0});if(e[0]==="["){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!te.get(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return E(h.CharacterSet,e,{kind:S.posix,negate:!!t.groups.negate,value:t.groups.name})}return e==="-"?E(h.CharacterClassHyphen,e):e==="&&"?E(h.CharacterClassIntersector,e):(Te(e),E(h.Character,e,{value:e.codePointAt(0)}))}function Re(e,{inCharClass:t}){let n=e[1];if(n==="c"||n==="C")return Ot(e);if("dDhHsSwW".includes(n))return Mt(e);if(e.startsWith(g`\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 Bt(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let a=e.split(/\\x/).slice(1).map(c=>parseInt(c,16)),s=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(a)),i=new TextEncoder;return[...s].map(c=>{let u=[...i.encode(c)].map(l=>`\\x${l.toString(16)}`).join("");return E(h.Character,u,{value:c.codePointAt(0)})})}catch{throw new Error(`Too short or invalid multibyte code "${e}"`)}if(n==="u"||n==="x")return E(h.Character,e,{value:Vt(e)});if(Ie.has(n))return E(h.Character,e,{value:Ie.get(n)});if(/\d/.test(n))return E(h.EscapedNumber,e,{inCharClass:t});if(e==="\\")throw new Error(g`Incomplete escape "\"`);if(n==="M")throw new Error(`Unsupported meta "${e}"`);if([...e].length===2)return E(h.Character,e,{value:e.codePointAt(1)});throw new Error(`Unexpected escape "${e}"`)}function E(e,t,n){return{type:e,raw:t,...n}}function Ot(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 E(h.Character,e,{value:t.toUpperCase().codePointAt(0)-64})}function Ut(e,t){let{on:n,off:a}=/^\(\?(?<on>[imx]*)(?:-(?<off>[imx\-]*))?/.exec(e).groups;a??="";let s=(t.getCurrentModX()||n.includes("x"))&&!a.includes("x"),i=$e(n),o=$e(a),c={};if(i&&(c.enable=i),o&&(c.disable=o),e.endsWith(")"))return t.replaceCurrentModX(s),E(h.Directive,e,{kind:W.flags,flags:c});if(e.endsWith(":")){t.pushModX(s),t.numOpenGroups++;let u=E(h.GroupOpen,e,{kind:k.group});return(i||o)&&(u.flags=c),u}throw new Error(`Unexpected flag modifier "${e}"`)}function Dt(e){let t={};if(e[0]==="{"){let{min:n,max:a}=/^\{(?<min>\d*)(?:,(?<max>\d*))?/.exec(e).groups,s=1e5;if(+n>s||+a>s)throw new Error("Quantifier value unsupported in Oniguruma");t.min=+n,t.max=a===void 0?+n:a===""?1/0:+a,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 E(h.Quantifier,e,t)}function Mt(e){let t=e[1].toLowerCase();return E(h.CharacterSet,e,{kind:{d:S.digit,h:S.hex,s:S.space,w:S.word}[t],negate:e[1]!==t})}function Bt(e){let{p:t,neg:n,value:a}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[ \w]+)/.exec(e).groups,s=t==="P"&&!n||t==="p"&&!!n;return E(h.CharacterSet,e,{kind:S.property,negate:s,value:a})}function $e(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 Vt(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),n=parseInt(t,16);if(n>1310719)throw new Error(`Invalid out of range "${e}"`);if(n>1114111)throw new Error(`Invalid out of range in JS "${e}"`);return n}function jt(e,t){let{raw:n,inCharClass:a}=e,s=n.slice(1);if(!a&&(s!=="0"&&s.length===1||s[0]!=="0"&&+s<=t))return[E(h.Backreference,n)];let i=[],o=s.match(/^[0-7]+|\d/g);for(let c=0;c<o.length;c++){let u=o[c],l;if(c===0&&u!=="8"&&u!=="9"){if(l=parseInt(u,8),l>127)throw new Error(g`Octal encoded byte above 177 unsupported "${n}"`)}else l=u.codePointAt(0);i.push(E(h.Character,(c===0?"\\":"")+u,{value:l}))}return i}function Ne(e){if(e.endsWith("]"))throw new Error(`Empty character class "${e}" unsupported in Oniguruma`)}function Te(e){if([...e].length!==1)throw new Error(`Expected "${e}" to be a single code point`)}function P(e,t,n){let a=e.node;for(;a.parent;)a=a.parent;function s(o,c){for(let u=0;u<o.length;u++){let l=i(o[u],c,u,o);u=Math.max(-1,u+l)}}function i(o,c=null,u=null,l=null){let f=0,d=!1,C={node:o,parent:c,key:u,container:l,ast:a,remove(){F(l,"Container expected").splice(Math.max(0,u+f),1),f-=1},removeAllNextSiblings(){return F(l,"Container expected").splice(u+1)},removeAllPrevSiblings(){let x=u+f;return f-=x,F(l,"Container expected").splice(0,Math.max(0,x))},replaceWith(x){Kt(x,c),l?l[Math.max(0,u+f)]=x:c[u]=x},skip(){d=!0}},m=Le(o).find(x=>!!n[x]),_=m&&n[m],T=typeof _=="function"?_:_?.enter,D=_?.exit;if(T?.(C,t),!d)switch(o.type){case p.Regex:i(o.pattern,o,"pattern"),i(o.flags,o,"flags");break;case p.Alternative:case p.CharacterClass:s(o.elements,o);break;case p.Assertion:I(o)&&s(o.alternatives,o);break;case p.Backreference:case p.Character:case p.CharacterSet:case p.Directive:case p.Flags:case p.Recursion:case p.Subroutine:case p.VariableLengthCharacterSet:break;case p.CapturingGroup:case p.Group:case p.Pattern:s(o.alternatives,o);break;case p.CharacterClassIntersection:s(o.classes,o);break;case p.CharacterClassRange:i(o.min,o,"min"),i(o.max,o,"max");break;case p.Quantifier:i(o.element,o,"element");break;default:throw new Error(`Unexpected node type "${o.type}"`)}return D?.(C,t),f}i(e.node,e.parent,e.key,e.container)}function Kt(e,t){"parent"in t&&(e.parent=t)}var p={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"},Oe={AnyGroup:"AnyGroup",AnyNode:"AnyNode"};function Le(e){let{type:t}=e,n=[Oe.AnyNode];return(I(e)||t===p.CapturingGroup||t===p.Group)&&n.push(Oe.AnyGroup),n.push(t),n}var 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=S,X=W,z={grapheme:"grapheme",newline:"newline"};function Z({tokens:e,flags:t},n){let a={skipBackrefValidation:!1,skipPropertyNameValidation:!1,verbose:!1,...n},s={capturingGroups:[],current:0,hasNumberedRef:!1,namedGroupsByName:new Map,parent:null,skipBackrefValidation:a.skipBackrefValidation,skipPropertyNameValidation:a.skipPropertyNameValidation,subroutines:[],token:null,tokens:e,verbose:a.verbose,walk:i};function i(C,m){let _=e[s.current];switch(s.parent=C,s.token=_,s.current++,_.type){case h.Alternator:return N();case h.Assertion:return Me(_);case h.Backreference:return Ht(s);case h.Character:return Be(_.value);case h.CharacterClassHyphen:return Qt(s,m);case h.CharacterClassOpen:return Wt(s,m);case h.CharacterSet:return qt(s);case h.Directive:return tr(_);case h.GroupOpen:return zt(s,m);case h.Quantifier:return Xt(s);case h.Subroutine:return Zt(s);case h.VariableLengthCharacterSet:return ir(_.kind);default:throw new Error(`Unexpected token type "${_.type}"`)}}let o=ar(nr(),rr(t)),c=o.pattern.alternatives[0];for(;s.current<e.length;){let C=i(c,{});C.type===p.Alternative?(o.pattern.alternatives.push(C),c=C):c.elements.push(C)}let{capturingGroups:u,hasNumberedRef:l,namedGroupsByName:f,subroutines:d}=s;if(l&&f.size)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(let{ref:C}of d)if(typeof C=="number"){if(C>u.length)throw new Error("Subroutine uses a group number that's not defined")}else if(f.has(C)){if(f.get(C).length>1)throw new Error(g`Subroutine uses a duplicate group name "\g<${C}>"`)}else throw new Error(g`Subroutine uses a group name that's not defined "\g<${C}>"`);return P({node:o},null,{AnyNode({node:C,parent:m}){C.parent=m}}),o}function Ht(e){let{raw:t}=e.token,n=/^\\k[<']/.test(t),a=n?t.slice(3,-1):t.slice(1),s=(i,o=!1)=>{let c=e.capturingGroups.length,u=!1;if(i>c)if(e.skipBackrefValidation)u=!0;else throw new Error(`Not enough capturing groups defined to the left "${t}"`);return e.hasNumberedRef=!0,ne(o?c+1-i:i,{orphan:u})};if(n){let i=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(a);if(i)return s(+i.groups.num,!!i.groups.sign);if(/[-+]/.test(a))throw new Error(`Invalid backref name "${t}"`);if(!e.namedGroupsByName.has(a))throw new Error(`Group name not defined to the left "${t}"`);return ne(a)}return s(+a)}function Qt(e,t){let{parent:n,tokens:a,walk:s}=e,i=n.elements.at(-1),o=a[e.current];if(i&&i.type!==p.CharacterClass&&i.type!==p.CharacterClassRange&&o&&o.type!==h.CharacterClassOpen&&o.type!==h.CharacterClassClose&&o.type!==h.CharacterClassIntersector){let c=s(n,t);if(i.type===p.Character&&c.type===p.Character)return n.elements.pop(),er(i,c);throw new Error("Invalid character class range")}return Be(45)}function Wt(e,t){let{token:n,tokens:a,verbose:s,walk:i}=e,o=de({negate:n.negate}),c=o.elements[0],u=Ue(a[e.current]);for(;u.type!==h.CharacterClassClose;){if(u.type===h.CharacterClassIntersector)c.classes.push(de({negate:!1,baseOnly:!0})),e.current++;else{let l=c.classes.at(-1);l.elements.push(i(l,t))}u=Ue(a[e.current])}if(s||pr(c),c.classes.length===1){let l=c.classes[0];l.negate=o.negate!==l.negate,o=l}return e.current++,o}function qt({token:e,skipPropertyNameValidation:t}){let{kind:n,negate:a,value:s}=e;if(n===S.property){let o=Q(s);if(Fe.has(o))n=S.posix,s=o;else return O(s,{negate:a,skipPropertyNameValidation:t})}let i={type:p.CharacterSet,kind:F(y[n],`Unexpected character set kind "${n}"`)};return(n===S.digit||n===S.hex||n===S.posix||n===S.space||n===S.word)&&(i.negate=a,n===S.posix&&(i.value=s)),i}function zt(e,t){let{token:n,tokens:a,capturingGroups:s,namedGroupsByName:i,verbose:o,walk:c}=e,u=Jt(n);u.type===p.CapturingGroup&&(s.push(u),u.name&&B(i,u.name,[]).push(u));let l=De(a[e.current]);for(;l.type!==h.GroupClose;){if(l.type===h.Alternator)u.alternatives.push(N()),e.current++;else{let f=u.alternatives.at(-1);f.elements.push(c(f,t))}l=De(a[e.current])}return o||(u=ur(u)),e.current++,u}function Xt({token:e,parent:t}){let{min:n,max:a,greedy:s,possessive:i}=e,o=t.elements.at(-1);if(!o||o.type===p.Assertion||o.type===p.Directive)throw new Error("Quantifier requires a repeatable token");let c=sr(o,n,a,s,i);return t.elements.pop(),c}function Zt(e){let{token:t,capturingGroups:n,subroutines:a}=e,s=t.raw.slice(3,-1),i=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s);if(i){let c=+i.groups.num,u=n.length;if(e.hasNumberedRef=!0,s={"":c,"+":u+c,"-":u+1-c}[i.groups.sign],s<1)throw new Error("Invalid subroutine number")}else s==="0"&&(s=0);let o=or(s);return a.push(o),o}function N(){return{type:p.Alternative,elements:[]}}function Me({type:e,kind:t,negate:n}){if(e===h.GroupOpen)return se({behind:t===k.lookbehind,negate:n});let a=F({"^":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}"`),s={type:p.Assertion,kind:a};return a===w.word_boundary&&(s.negate=t===g`\B`),s}function ne(e,{orphan:t}={}){return{type:p.Backreference,...t&&{orphan:t},ref:e}}function Jt(e){let{kind:t,number:n,name:a,flags:s}=e;switch(t){case k.atomic:return $({atomic:!0});case k.capturing:return Ce(n,a);case k.group:return $({flags:s});case k.lookahead:case k.lookbehind:return Me(e);default:throw new Error(`Unexpected group kind "${t}"`)}}function Ce(e,t){let n=t!==void 0;if(n&&!lr(t))throw new Error(`Group name "${t}" invalid in Oniguruma`);return{type:p.CapturingGroup,number:e,...n&&{name:t},alternatives:[N()]}}function Be(e){return{type:p.Character,value:e}}function de(e){let t={baseOnly:!1,negate:!1,...e};return{type:p.CharacterClass,negate:t.negate,elements:t.baseOnly?[]:[Yt()]}}function Yt(){return{type:p.CharacterClassIntersection,classes:[de({negate:!1,baseOnly:!0})]}}function er(e,t){if(t.value<e.value)throw new Error("Character class range out of order");return{type:p.CharacterClassRange,min:e,max:t}}function tr({kind:e,flags:t}){let n={type:p.Directive,kind:F(X[e],`Unexpected directive kind "${e}"`)};return e===W.flags&&(n.flags=t),n}function rr({ignoreCase:e,dotAll:t,extended:n}){return{type:p.Flags,ignoreCase:e,dotAll:t,extended:n}}function $({atomic:e,flags:t}={}){return{type:p.Group,...e&&{atomic:e},...t&&{flags:t},alternatives:[N()]}}function se({behind:e=!1,negate:t=!1}={}){return{type:p.Assertion,kind:e?w.lookbehind:w.lookahead,negate:t,alternatives:[N()]}}function nr(){return{type:p.Pattern,alternatives:[N()]}}function sr(e,t,n,a,s){if(n<t)throw new Error("Quantifier range out of order");return{type:p.Quantifier,min:t,max:n,greedy:a,possessive:s,element:e}}function ar(e,t){return{type:p.Regex,pattern:e,flags:t}}function or(e){return{type:p.Subroutine,ref:e}}function O(e,t){let n={negate:!1,skipPropertyNameValidation:!1,...t};return{type:p.CharacterSet,kind:y.property,value:n.skipPropertyNameValidation?e:cr(e),negate:n.negate}}function ir(e){return{type:p.VariableLengthCharacterSet,kind:F({"\\R":z.newline,"\\X":z.grapheme}[e],`Unexpected varcharset kind "${e}"`)}}function cr(e){let t=Q(e);if(fe.has(t))throw new Error(g`Unicode property "\p{${e}}" unsupported in Oniguruma`);let n=pe.get(t);return n||e.trim().replace(/\s+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,a=>a[0].toUpperCase()+a.slice(1).toLowerCase())}function ur(e){let t=e.alternatives[0].elements[0];return e.type===p.Group&&L(e,n=>n.type===p.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 I({type:e,kind:t}){return e===p.Assertion&&(t===w.lookahead||t===w.lookbehind)}function lr(e){return!/^(?:[-\d]|$)/.test(e)}function pr(e){for(let t=0;t<e.classes.length;t++){let n=e.classes[t],a=n.elements[0];n.elements.length===1&&a.type===p.CharacterClass&&(e.classes[t]=a,a.negate=n.negate!==a.negate)}}function Ue(e){return F(e,"Unclosed character class")}function De(e){return F(e,"Unclosed group")}function je(e,t){let n=e.pattern.alternatives,a=n[0].elements[0];if(n.length>1||!a)return null;let s=L(e.pattern,u=>u.type===p.CapturingGroup||u.type===p.Group)&&a.alternatives.length===1,i=s?a.alternatives[0]:n[0],o=s?i.elements[0]:a;if(!o)return null;if((o.type===p.CapturingGroup||o.type===p.Group)&&o.alternatives.length===2&&o.alternatives[0].elements.length===1&&o.alternatives[1].elements.length===1){let u=o.alternatives[0].elements[0],l=o.alternatives[1].elements[0];if(u.kind===w.line_start&&l.kind===w.search_start||u.kind===w.search_start&&l.kind===w.line_start)return u.kind===w.line_start?o.alternatives.pop():o.alternatives.shift(),{name:"line_or_search_start"}}if(Ve(o))return o.parent.elements.shift(),{name:"not_search_start"};let c=i.elements.findIndex(u=>Ve(u));if(c>-1&&i.elements.every(u=>u.type===p.Assertion))return i.elements.splice(c,1),{name:"not_search_start"};if(o.kind===w.lookbehind&&!o.negate&&o.alternatives.length>1){let u=[],l=!1;if(o.alternatives.forEach(f=>{f.elements.length===1&&f.elements[0].kind===w.search_start?l=!0:u.push(f)}),l&&u.length){let f=!0;if(u.some(d=>d.elements.some(C=>C.type===p.CapturingGroup||C.type===p.Group||C.type===p.Subroutine||I(C))))if(t==="loose")f=!1;else throw new Error(r`Uses "\G" in a way that's unsupported`);if(f){let d=R($(),[R(N(),[O("<<",{skipPropertyNameValidation:!0})]),...u,R(N(),[O(">>",{skipPropertyNameValidation:!0})])]);return d.parent=o.parent,o.parent.elements[0]=d,{name:"after_search_start_or_subpattern"}}}}return null}function Ve(e){return I(e)&&e.negate&&L(e,t=>t.kind===w.search_start)}var me=String.raw,Ke=me`(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})`,He=me`\u{E0061}-\u{E007A}`,Qe=()=>new RegExp(me`[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[${He}]{2}[\u{E0030}-\u{E0039}${He}]{1,3}\u{E007F}|${Ke}(?:\u200D${Ke})*`,"gu");function qe(e,t){let n={accuracy:"default",avoidSubclass:!1,bestEffortTarget:"ES2025",...t},a=n.avoidSubclass?null:je(e,n.accuracy),s={accuracy:n.accuracy,flagDirectivesByAlt:new Map,minTargetEs2024:H(n.bestEffortTarget,"ES2024"),subroutineRefMap:new Map,supportedGNodes:new Set};P({node:e},s,ze);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},o={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:s.subroutineRefMap};P({node:e},o,Xe);let c={groupsByName:o.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:o.reffedNodesByReferencer};return P({node:e},c,fr),a&&(e._strategy=a),e}var ze={Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:a}){let s=e.elements.filter(i=>i.kind===X.flags);for(let i=n+1;i<t.alternatives.length;i++){let o=t.alternatives[i];B(a,o,[]).push(...s)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=Ye(t.get(e));if(n){let a=J($({flags:n}),e.elements);a.parent=e,e.elements=[a]}}}},Assertion({node:e,ast:t,remove:n,replaceWith:a},{accuracy:s,supportedGNodes:i}){let{kind:o,negate:c}=e;if(o===w.line_end)a(v(g`(?=\z|\n)`));else if(o===w.line_start)a(v(g`(?<=\A|\n)`));else if(o===w.search_start){if(!i.has(e)&&s!=="loose")throw new Error(g`Uses "\G" in a way that's unsupported`);t.flags.sticky=!0,n()}else if(o===w.string_end_newline)a(v(g`(?=\n?\z)`));else if(o===w.word_boundary){let u=g`[\p{L}\p{N}\p{Pc}]`,l=`(?:(?<=${u})(?!${u})|(?<!${u})(?=${u}))`,f=`(?:(?<=${u})(?=${u})|(?<!${u})(?!${u}))`;a(v(c?f:l))}},CapturingGroup({node:e},{subroutineRefMap:t}){let{name:n,number:a}=e;if(n&&!Cr(n))throw new Error(`Group name "${n}" invalid in JS`);t.set(n??a,e)},CharacterSet({node:e,replaceWith:t},{accuracy:n,minTargetEs2024:a}){let{kind:s,negate:i,value:o}=e;if(s===y.any)t(O("Any"));else if(s===y.hex)t(O("AHex",{negate:i}));else if(s===y.non_newline)t(v(g`[^\n]`));else if(s===y.posix)if(!a&&(o==="graph"||o==="print")){if(n==="strict")throw new Error(`POSIX class "${o}" requires min target ES2024 or non-strict accuracy`);let c={graph:"!-~",print:" -~"}[o];i&&(c=`\0-${A(c.codePointAt(0)-1)}${A(c.codePointAt(2)+1)}-\u{10FFFF}`),t(v(`[${c}]`))}else{let c=v(te.get(o));c.negate=i,t(c)}else if(s===y.property)le.has(o)||(e.key="sc");else if(s===y.space){let c=v(`[ | ||
\v\f\r]`);c.negate=i,t(c)}},Directive(e,t){let{node:n,parent:a,ast:s,remove:i,replaceWith:o,removeAllPrevSiblings:c,removeAllNextSiblings:u}=e,{kind:l,flags:f}=n;if(l===X.flags)if(!f.enable&&!f.disable)i();else{let d=J($({flags:f}),u());o(d),nt(d,e,t,ze)}else if(l===X.keep){if(a.parent!==s.pattern||s.pattern.alternatives.length>1)throw new Error(g`Uses "\K" in a way that's unsupported`);o(J(se({behind:!0}),c()))}},Flags({node:e,parent:t}){delete e.extended,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:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},Pattern({node:e},{accuracy:t,supportedGNodes:n}){let a=[],s=!1,i=!1;for(let o of e.alternatives){let c=tt(o.elements);c?(s=!0,Array.isArray(c)?a.push(...c):a.push(c)):i=!0}if(s&&i&&t!=="loose")throw new Error(g`Uses "\G" in a way that's unsupported`);a.forEach(o=>n.add(o))},Quantifier({node:e}){if(e.element.type===p.Quantifier){let t=J($(),[e.element]);t.parent=e,e.element=t}},VariableLengthCharacterSet({node:e,replaceWith:t},{accuracy:n,minTargetEs2024:a}){let{kind:s}=e;if(s===z.newline)t(v(`(?>\r | ||
`.replace(/\s+/g,""),"gsu");function H(e,t=""){if(typeof e!="string")throw new Error("String expected as pattern");if(!/^[imx]*$/.test(t))throw new Error(`Flags "${t}" unsupported in Oniguruma`);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(Y.lastIndex=0;o=Y.exec(e);){let u=Dt(s,e,o[0],Y.lastIndex);u.tokens?n.push(...u.tokens):u.token&&n.push(u.token),u.lastIndex!==void 0&&(Y.lastIndex=u.lastIndex)}let a=[],i=0;n.forEach(u=>{u.type===g.GroupOpen&&(u.kind===_.capturing?(i++,u.number=i):u.raw==="("&&a.push(u))}),i||a.forEach((u,p)=>{u.kind=_.capturing,u.number=p+1});let c=i||a.length;return n=n.map(u=>u.type===g.EscapedNumber?zt(u,c):u).flat(),{tokens:n,flags:{ignoreCase:t.includes("i"),dotAll:t.includes("m"),extended:t.includes("x")}}}function Dt(e,t,r,s){let[n,o,a]=r;if(n==="["){let i=Bt(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:K.keep})};if(o==="N")return{token:m(g.CharacterSet,r,{kind:A.non_newline})};if(o==="O")return{token:m(g.CharacterSet,r,{kind:A.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=Ve(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:_.group})};if(r==="(?>")return{token:m(g.GroupOpen,r,{kind:_.atomic})};if(r==="(?="||r==="(?!"||r==="(?<="||r==="(?<!")return{token:m(g.GroupOpen,r,{kind:a==="<"?_.lookbehind:_.lookahead,negate:r.endsWith("!")})};if(a==="<"||a==="'")return{token:m(g.GroupOpen,r,{kind:_.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:A.dot})}:r==="^"||r==="$"?{token:m(g.Assertion,r,{kind:r})}:r==="|"?{token:m(g.Alternator,r)}:Be.test(r)?{token:Ht(r)}:(je(r),{token:m(g.Character,r,{value:r.codePointAt(0)})})}function Bt(e,t,r){Me(t);let s=[m(g.CharacterClassOpen,t,{negate:t[1]==="^"})],n=1,o;for(Ce.lastIndex=r;o=Ce.exec(e);){let a=o[0];if(a[0]==="["&&a[1]!==":")Me(a),n++,s.push(m(g.CharacterClassOpen,a,{negate:a[1]==="^"}));else if(a==="]"){if(n--,s.push(m(g.CharacterClassClose,a)),!n)break}else{let i=Vt(a);Array.isArray(i)?s.push(...i):s.push(i)}}return{tokens:s,lastIndex:Ce.lastIndex||e.length}}function Vt(e){if(e[0]==="\\")return Ve(e,{inCharClass:!0});if(e[0]==="["){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!J.get(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return m(g.CharacterSet,e,{kind:A.posix,negate:!!t.groups.negate,value:t.groups.name})}return e==="-"?m(g.CharacterClassHyphen,e):e==="&&"?m(g.CharacterClassIntersector,e):(je(e),m(g.Character,e,{value:e.codePointAt(0)}))}function Ve(e,{inCharClass:t}){let r=e[1];if(r==="c"||r==="C")return jt(e);if("dDhHsSwW".includes(r))return Qt(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 Wt(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(`Too short or invalid multibyte code "${e}"`)}if(r==="u"||r==="x")return m(g.Character,e,{value:qt(e)});if(Te.has(r))return m(g.Character,e,{value:Te.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 jt(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=Oe(r),a=Oe(s),i={};if(o&&(i.enable=o),a&&(i.disable=a),e.endsWith(")"))return t.replaceCurrentModX(n),m(g.Directive,e,{kind:K.flags,flags:i});if(e.endsWith(":")){t.pushModX(n),t.numOpenGroups++;let c=m(g.GroupOpen,e,{kind:_.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 Qt(e){let t=e[1].toLowerCase();return m(g.CharacterSet,e,{kind:{d:A.digit,h:A.hex,s:A.space,w:A.word}[t],negate:e[1]!==t})}function Wt(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:A.property,negate:n,value:s})}function Oe(e){let t={};return e.includes("i")&&(t.ignoreCase=!0),e.includes("m")&&(t.dotAll=!0),e.includes("x")&&(t.extended=!0),Object.keys(t).length?t:null}function qt(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw new Error(`Incomplete or invalid escape "${e}"`);let t=e[2]==="{"?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2),r=parseInt(t,16);if(r>1310719)throw new Error(`Invalid out of range "${e}"`);if(r>1114111)throw new Error(`Invalid out of range in JS "${e}"`);return r}function zt(e,t){let{raw:r,inCharClass:s}=e,n=r.slice(1);if(!s&&(n!=="0"&&n.length===1||n[0]!=="0"&&+n<=t))return[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 Me(e){if(e.endsWith("]"))throw new Error(`Empty character class "${e}" unsupported in Oniguruma`)}function je(e){if([...e].length!==1)throw new Error(`Expected "${e}" to be a single code point`)}function N(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,C=!1,d={node:a,parent:i,key:c,container:u,ast:s,remove(){x(u,"Container expected").splice(Math.max(0,c+p),1),p-=1},removeAllNextSiblings(){return x(u,"Container expected").splice(c+1)},removeAllPrevSiblings(){let b=c+p;return p-=b,x(u,"Container expected").splice(0,Math.max(0,b))},replaceWith(b){Xt(b,i),u?u[Math.max(0,c+p)]=b:i[c]=b},skip(){C=!0}},h=Ke(a).find(b=>!!r[b]),S=h&&r[h],L=typeof S=="function"?S:S?.enter,T=S?.exit;if(L?.(d,t),!C)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:$(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?.(d,t),p}o(e.node,e.parent,e.key,e.container)}function Xt(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"},He={AnyGroup:"AnyGroup",AnyNode:"AnyNode"};function Ke(e){let{type:t}=e,r=[He.AnyNode];return($(e)||t===l.CapturingGroup||t===l.Group)&&r.push(He.AnyGroup),r.push(t),r}var E={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,W=K,Q={grapheme:"grapheme",newline:"newline"};function q({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(d,h){let S=e[n.current];switch(n.parent=d,n.token=S,n.current++,S.type){case g.Alternator:return P();case g.Assertion:return qe(S);case g.Backreference:return Zt(n);case g.Character:return ze(S.value);case g.CharacterClassHyphen:return Jt(n,h);case g.CharacterClassOpen:return Yt(n,h);case g.CharacterSet:return er(n);case g.Directive:return ir(S);case g.GroupOpen:return tr(n,h);case g.Quantifier:return rr(n);case g.Subroutine:return nr(n);case g.VariableLengthCharacterSet:return gr(S.kind);default:throw new Error(`Unexpected token type "${S.type}"`)}}let a=pr(ur(),cr(t)),i=a.pattern.alternatives[0];for(;n.current<e.length;){let d=o(i,{});d.type===l.Alternative?(a.pattern.alternatives.push(d),i=d):i.elements.push(d)}let{capturingGroups:c,hasNumberedRef:u,namedGroupsByName:p,subroutines:C}=n;if(u&&p.size)throw new Error("Numbered backref/subroutine not allowed when using named capture");for(let{ref:d}of C)if(typeof d=="number"){if(d>c.length)throw new Error("Subroutine uses a group number that's not defined")}else if(p.has(d)){if(p.get(d).length>1)throw new Error(f`Subroutine uses a duplicate group name "\g<${d}>"`)}else throw new Error(f`Subroutine uses a group name that's not defined "\g<${d}>"`);return N({node:a},null,{AnyNode({node:d,parent:h}){d.parent=h}}),a}function Zt(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,ee(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 ee(s)}return n(+s)}function Jt(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(),or(o,i);throw new Error("Invalid character class range")}return ze(45)}function Yt(e,t){let{token:r,tokens:s,verbose:n,walk:o}=e,a=me({negate:r.negate}),i=a.elements[0],c=Qe(s[e.current]);for(;c.type!==g.CharacterClassClose;){if(c.type===g.CharacterClassIntersector)i.classes.push(me({negate:!1,baseOnly:!0})),e.current++;else{let u=i.classes.at(-1);u.elements.push(o(u,t))}c=Qe(s[e.current])}if(n||mr(i),i.classes.length===1){let u=i.classes[0];u.negate=a.negate!==u.negate,a=u}return e.current++,a}function er({token:e,skipPropertyNameValidation:t}){let{kind:r,negate:s,value:n}=e;if(r===A.property){let a=j(n);if(Re.has(a))r=A.posix,n=a;else return re(n,{negate:s,skipPropertyNameValidation:t})}let o={type:l.CharacterSet,kind:x(k[r],`Unexpected character set kind "${r}"`)};return(r===A.digit||r===A.hex||r===A.posix||r===A.space||r===A.word)&&(o.negate=s,r===A.posix&&(o.value=n)),o}function tr(e,t){let{token:r,tokens:s,capturingGroups:n,namedGroupsByName:o,verbose:a,walk:i}=e,c=sr(r);c.type===l.CapturingGroup&&(n.push(c),c.name&&M(o,c.name,[]).push(c));let u=We(s[e.current]);for(;u.type!==g.GroupClose;){if(u.type===g.Alternator)c.alternatives.push(P()),e.current++;else{let p=c.alternatives.at(-1);p.elements.push(i(p,t))}u=We(s[e.current])}return a||(c=dr(c)),e.current++,c}function rr({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=lr(a,r,s,n,o);return t.elements.pop(),i}function nr(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=fr(n);return s.push(a),a}function P(){return{type:l.Alternative,elements:[]}}function qe({type:e,kind:t,negate:r}){if(e===g.GroupOpen)return te({behind:t===_.lookbehind,negate:r});let s=x({"^":E.line_start,$:E.line_end,"\\A":E.string_start,"\\b":E.word_boundary,"\\B":E.word_boundary,"\\G":E.search_start,"\\z":E.string_end,"\\Z":E.string_end_newline}[t],`Unexpected assertion kind "${t}"`),n={type:l.Assertion,kind:s};return s===E.word_boundary&&(n.negate=t===f`\B`),n}function ee(e,t){let r=!!t?.orphan;return{type:l.Backreference,...r&&{orphan:r},ref:e}}function sr(e){let{kind:t,number:r,name:s,flags:n}=e;switch(t){case _.atomic:return I({atomic:!0});case _.capturing:return Ee(r,s);case _.group:return I({flags:n});case _.lookahead:case _.lookbehind:return qe(e);default:throw new Error(`Unexpected group kind "${t}"`)}}function Ee(e,t){let r=t!==void 0;if(r&&!Cr(t))throw new Error(`Group name "${t}" invalid in Oniguruma`);return{type:l.CapturingGroup,number:e,...r&&{name:t},alternatives:[P()]}}function ze(e){return{type:l.Character,value:e}}function me(e){let t={baseOnly:!1,negate:!1,...e};return{type:l.CharacterClass,negate:t.negate,elements:t.baseOnly?[]:[ar()]}}function ar(){return{type:l.CharacterClassIntersection,classes:[me({negate:!1,baseOnly:!0})]}}function or(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 ir({kind:e,flags:t}){let r={type:l.Directive,kind:x(W[e],`Unexpected directive kind "${e}"`)};return e===K.flags&&(r.flags=t),r}function cr({ignoreCase:e,dotAll:t,extended:r}){return{type:l.Flags,ignoreCase:e,dotAll:t,extended:r}}function I(e){let t=e?.atomic,r=e?.flags;return{type:l.Group,...t&&{atomic:t},...r&&{flags:r},alternatives:[P()]}}function te(e){let t={behind:!1,negate:!1,...e};return{type:l.Assertion,kind:t.behind?E.lookbehind:E.lookahead,negate:t.negate,alternatives:[P()]}}function ur(){return{type:l.Pattern,alternatives:[P()]}}function lr(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 pr(e,t){return{type:l.Regex,pattern:e,flags:t}}function fr(e){return{type:l.Subroutine,ref:e}}function re(e,t){let r={negate:!1,skipPropertyNameValidation:!1,...t};return{type:l.CharacterSet,kind:k.property,value:r.skipPropertyNameValidation?e:hr(e),negate:r.negate}}function gr(e){return{type:l.VariableLengthCharacterSet,kind:x({"\\R":Q.newline,"\\X":Q.grapheme}[e],`Unexpected varcharset kind "${e}"`)}}function hr(e){let t=j(e);if(he.has(t))throw new Error(f`Unicode property "\p{${e}}" unsupported in Oniguruma`);let r=ge.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 dr(e){let t=e.alternatives[0].elements[0];return e.type===l.Group&&B(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 $({type:e,kind:t}){return e===l.Assertion&&(t===E.lookahead||t===E.lookbehind)}function Cr(e){return!/^(?:[-\d]|$)/.test(e)}function mr(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 Qe(e){return x(e,"Unclosed character class")}function We(e){return x(e,"Unclosed group")}function Xe(e){let t=e.pattern.alternatives,r=t[0].elements[0];if(t.length>1||!r)return null;let s=B(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===E.line_start&&i.kind===E.search_start||a.kind===E.search_start&&i.kind===E.line_start)return a.kind===E.line_start?o.alternatives.pop():o.alternatives.shift(),"line_or_search_start"}if(ne(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(!we(i))break;if(ne(i,{negate:!0}))return n.elements.splice(a,1),"not_search_start"}return null}function ne(e,t){return $(e)&&e.negate===t.negate&&B(e,r=>r.kind===E.search_start)}function we(e){return e.type===l.Assertion||e.type===l.Directive||e.type===l.Quantifier&&!e.min}var Se=String.raw,Ze=Se`(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})`,Je=Se`\u{E0061}-\u{E007A}`,Ye=()=>new RegExp(Se`[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[${Je}]{2}[\u{E0030}-\u{E0039}${Je}]{1,3}\u{E007F}|${Ze}(?:\u200D${Ze})*`,"gu");function tt(e,t){let r={accuracy:"default",avoidSubclass:!1,bestEffortTarget:"ES2025",...t},s=r.avoidSubclass?null:Xe(e),n={accuracy:r.accuracy,flagDirectivesByAlt:new Map,minTargetEs2024:V(r.bestEffortTarget,"ES2024"),subroutineRefMap:new Map,supportedGNodes:new Set};N({node:e},n,rt);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};N({node:e},a,nt);let i={groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer};return N({node:e},i,Er),s&&(e._strategy=s),e}var rt={Alternative:{enter({node:e,parent:t,key:r},{flagDirectivesByAlt:s}){let n=e.elements.filter(o=>o.kind===W.flags);for(let o=r+1;o<t.alternatives.length;o++){let a=t.alternatives[o];M(s,a,[]).push(...n)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let r=ot(t.get(e));if(r){let s=z(I({flags:r}),e.elements);s.parent=e,e.elements=[s]}}}},Assertion({node:e,ast:t,remove:r,replaceWith:s},{accuracy:n,supportedGNodes:o}){let{kind:a,negate:i}=e;if(a===E.line_end)s(F(f`(?=\z|\n)`));else if(a===E.line_start)s(F(f`(?<=\A|\n)`));else if(a===E.search_start){if(!o.has(e)&&n!=="loose")throw new Error(f`Uses "\G" in a way that's unsupported`);t.flags.sticky=!0,r()}else if(a===E.string_end_newline)s(F(f`(?=\n?\z)`));else if(a===E.word_boundary){let c=f`[\p{L}\p{N}\p{Pc}]`,u=`(?:(?<=${c})(?!${c})|(?<!${c})(?=${c}))`,p=`(?:(?<=${c})(?=${c})|(?<!${c})(?!${c}))`;s(F(i?p:u))}},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}){let{kind:n,negate:o,value:a}=e;if(n===k.any)t(re("Any"));else if(n===k.hex)t(re("AHex",{negate:o}));else if(n===k.non_newline)t(F(f`[^\n]`));else if(n===k.posix)if(!s&&(a==="graph"||a==="print")){if(r==="strict")throw new Error(`POSIX class "${a}" requires min target ES2024 or non-strict accuracy`);let i={graph:"!-~",print:" -~"}[a];o&&(i=`\0-${w(i.codePointAt(0)-1)}${w(i.codePointAt(2)+1)}-\u{10FFFF}`),t(F(`[${i}]`))}else{let i=F(J.get(a));i.negate=o,t(i)}else if(n===k.property)fe.has(a)||(e.key="sc");else if(n===k.space){let i=F(`[ | ||
\v\f\r]`);i.negate=o,t(i)}},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===W.flags)if(!p.enable&&!p.disable)o();else{let C=z(I({flags:p}),c());a(C),lt(C,e,t,rt)}else if(u===W.keep){if(s.parent!==n.pattern||n.pattern.alternatives.length>1)throw new Error(f`Uses "\K" in a way that's unsupported`);a(z(te({behind:!0}),i()))}},Flags({node:e,parent:t}){delete e.extended,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},{accuracy:t,supportedGNodes:r}){let s=[],n=!1,o=!1;for(let a of e.alternatives){let i=ct(a.elements);i?(n=!0,Array.isArray(i)?s.push(...i):s.push(i)):o=!0}if(n&&o&&t!=="loose")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=z(I(),[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(s===z.grapheme){if(n==="strict")throw new Error(g`Use of "\X" requires non-strict accuracy`);let i=a?g`\p{RGI_Emoji}`:Qe().source.replace(/\\u\{/g,g`\x{`);t(v(g`(?>\r\n|${i}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}))}else throw new Error(`Unexpected varcharset kind "${s}"`)}},Xe={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:a,ref:s}=e;a||n.set(e,[...t.get(s).map(({node:i})=>i)])},Recursion({node:e},{reffedNodesByReferencer:t}){let{ref:n}=e,a=e.parent;for(;(a=a.parent)&&!(a.type===p.CapturingGroup&&(a.name===n||a.number===n)););t.set(e,a)},CapturingGroup:{enter({node:e,replaceWith:t,skip:n},{groupOriginByCopy:a,groupsByName:s,multiplexCapturesToLeftByRef:i,openRefs:o,reffedNodesByReferencer:c}){let u=a.get(e),l=e.name??e.number;if(u&&o.has(l)){let d=We(l);c.set(d,o.get(l)),t(d),n();return}o.set(l,e);let f=B(i,l,[]);for(let d=0;d<f.length;d++){let C=f[d];if(u===C.node||u&&u===C.origin||e===C.origin){f.splice(d,1);break}}if(f.push({node:e,origin:u}),e.name){let d=B(s,e.name,new Map);for(let C of d.values())!C.hasDuplicateNameToRemove&&Ze(C.node,e,{ancestorsParticipate:!0})&&(C.hasDuplicateNameToRemove=!0);s.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=M(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine(e,t){let{node:n,replaceWith:a}=e,{ref:s}=n,i=t.subroutineRefMap.get(s),o=s===0,c=o?We(s):Je(i,t.groupOriginByCopy,null),u=c;if(!o){let l=Ye(hr(i,d=>d.type===p.Group&&!!d.flags)),f=l?M(t.globalFlags,l):t.globalFlags;gr(f,t.currentFlags)||(u=J($({flags:dr(f)}),[c]))}a(u),o||nt(u,e,t,Xe)}},fr={Backreference({node:e,replaceWith:t},n){if(e.orphan){n.highestOrphanBackref=Math.max(n.highestOrphanBackref,e.ref);return}let s=n.reffedNodesByReferencer.get(e).filter(i=>Ze(i,e,{ancestorsParticipate:!1}));if(!s.length)t(se({negate:!0}));else if(s.length>1){let i=s.map(o=>R(N(),[ne(o.number)]));t(R($(),i))}else e.ref=s[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 n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let a=0;a<n;a++){let s=Ce();e.pattern.alternatives.at(-1).elements.push(s)}}}};function R(e,t){return t.forEach(n=>n.parent=e),e[Ee(e)]=t,e}function gr(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function Ze(e,t,{ancestorsParticipate:n}){let a=t;do{if(a.type===p.Pattern)return!1;if(a.type===p.Alternative)continue;if(a===e)return n;let s=et(a.parent);for(let i of s){if(i===a)break;if(i===e||rt(i,e))return!0}}while(a=a.parent);throw new Error("Unexpected path")}function Je(e,t,n,a){let s=Array.isArray(e)?[]:{};for(let[i,o]of Object.entries(e))i==="parent"?s.parent=Array.isArray(n)?a:n:o&&typeof o=="object"?s[i]=Je(o,t,s,n):(i==="type"&&o===p.CapturingGroup&&t.set(s,t.get(e)??e),s[i]=o);return s}function We(e){return{type:p.Recursion,ref:e}}function hr(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function Ee(e){for(let t of["alternatives","classes","elements"])if(e[t])return t;return null}function Ye(e){let t=["dotAll","ignoreCase"],n={enable:{},disable:{}};return e.forEach(({flags:a})=>{t.forEach(s=>{a.enable?.[s]&&(delete n.disable[s],n.enable[s]=!0),a.disable?.[s]&&(n.disable[s]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function dr({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function et(e){if(!e)throw new Error("Node expected");if(e.type===p.Quantifier)return[e.element];let t=Ee(e);return t&&e[t]}function tt(e){function t(s){return s.kind===w.search_start||I(s)&&!s.negate&&L(s,i=>i.kind===w.search_start)}function n(s){return s.type===p.Assertion||s.type===p.Directive||s.type===p.Quantifier&&!s.min}let a=e.find(s=>t(s)||!n(s));if(!a)return null;if(a.kind===w.search_start)return a;if(I(a))return a.alternatives[0].elements[0];if(a.type===p.Group||a.type===p.CapturingGroup){let s=[];for(let i of a.alternatives){let o=tt(i.elements);if(!o)return null;Array.isArray(o)?s.push(...o):s.push(o)}return s}return null}function rt(e,t){let n=et(e)??[];for(let a of n)if(a===t||rt(a,t))return!0;return!1}function Cr(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function v(e,{skipPropertyNameValidation:t}={}){let a=Z(q(e),{skipPropertyNameValidation:t}).pattern.alternatives;return a.length>1||a[0].elements.length>1?R($(),a):a[0].elements[0]}function J(e,t){let n=Ee(e);return e[n][0].parent=e,t&&R(e[n][0],t),e}function nt(e,{parent:t,key:n,container:a},s,i){P({node:e,parent:t,key:n,container:a},s,i)}function at(e,t){let n=ee(t),a=H(n.target,"ES2024"),s=H(n.target,"ES2025"),i=n.maxRecursionDepth;if(i!==null&&(!Number.isInteger(i)||i<2||i>100))throw new Error("Invalid maxRecursionDepth; use 2-100 or null");let o=null,c=null;if(!s){let m=[e.flags.ignoreCase];P({node:e},{getCurrentModI:()=>m.at(-1),popModI(){m.pop()},pushModI(_){m.push(_)},setHasCasedChar(){m.at(-1)?o=!0:c=!0}},mr)}let u={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||o)&&!c)},l=null,f={accuracy:n.accuracy,appliedGlobalFlags:u,captureFlagIMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},groupNames:new Set,inCharClass:!1,lastNode:l,maxRecursionDepth:i,useAppliedIgnoreCase:!!(!s&&o&&c),useDuplicateNames:s,useFlagMods:s,useFlagV:a,usePostEs2018Properties:a,verbose:n.verbose};function d(m){switch(f.lastNode=l,l=m,m.type){case p.Regex:return{pattern:d(m.pattern),flags:d(m.flags),options:{...m.options}};case p.Alternative:return m.elements.map(d).join("");case p.Assertion:return Sr(m,f,d);case p.Backreference:return kr(m,f);case p.CapturingGroup:return yr(m,f,d);case p.Character:return br(m,f);case p.CharacterClass:return xr(m,f,d);case p.CharacterClassIntersection:if(!f.useFlagV)throw new Error("Use of class intersection requires min target ES2024");return m.classes.map(d).join("&&");case p.CharacterClassRange:return Fr(m,f);case p.CharacterSet:return Ir(m,f);case p.Flags:return $r(m,f);case p.Group:return Nr(m,f,d);case p.Pattern:return m.alternatives.map(d).join("|");case p.Quantifier:return d(m.element)+Rr(m);case p.Recursion:return vr(m,f);default:throw new Error(`Unexpected node type "${m.type}"`)}}let C=d(e);return a||(delete C.options.force.v,C.options.disable.v=!0,C.options.unicodeSetsPlugin=null),C}var mr={AnyGroup:{enter({node:e},t){let n=t.getCurrentModI();t.pushModI(e.flags?M({ignoreCase:n},e.flags).ignoreCase:n)},exit(e,t){t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){we(A(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),ot(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===y.property&&ge.has(e.value)&&t.setHasCasedChar()}},Er=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),wr=new Set(["-","\\","]","^"]),_r=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),st=new Map([[9,g`\t`],[10,g`\n`],[11,g`\v`],[12,g`\f`],[13,g`\r`],[8232,g`\u2028`],[8233,g`\u2029`],[65279,g`\uFEFF`]]),Ar=/^\p{Cased}$/u;function we(e){return Ar.test(e)}function Sr(e,t,n){let{kind:a,negate:s,alternatives:i}=e;if(I(e))return`(?${`${a===w.lookahead?"":"<"}${s?"!":"="}`}${i.map(n).join("|")})`;if(a===w.string_end)return"$";if(a===w.string_start)return"^";throw new Error(`Unexpected assertion kind "${a}"`)}function kr({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 yr({name:e,number:t,alternatives:n},a,s){return e&&(a.groupNames.has(e)?a.useDuplicateNames||(e=null):a.groupNames.add(e)),a.captureFlagIMap.set(t,a.currentFlags.ignoreCase),`(${e?`?<${e}>`:""}${n.map(s).join("|")})`}function br({value:e},t){let n=A(e),a=V(e,{isAfterBackref:t.lastNode.type===p.Backreference,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(a!==n)return a;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&we(n)){let s=ue(n);return t.inCharClass?s.join(""):s.length>1?`[${s.join("")}]`:s[0]}return n}function xr({negate:e,parent:t,elements:n},a,s){if(!e&&(!a.useFlagV||!a.verbose)&&t.type===p.CharacterClass&&n[0].type!==p.CharacterClassIntersection||!a.verbose&&t.type===p.CharacterClassIntersection&&n.length===1&&n[0].type!==p.CharacterClassRange)return n.map(s).join("");if(!a.useFlagV&&t.type===p.CharacterClass)throw new Error("Use of nested character class requires min target ES2024");a.inCharClass=!0;let i=`[${e?"^":""}${n.map(s).join("")}]`;return a.inCharClass=!1,i}function Fr(e,t){let n=e.min.value,a=e.max.value,s={isAfterBackref:!1,inCharClass:!0,useFlagV:t.useFlagV},i=V(n,s),o=V(a,s),c="";if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){let u=ot(e);Pr(u).forEach(f=>{c+=Array.isArray(f)?`${V(f[0],s)}-${V(f[1],s)}`:V(f,s)})}return`${i}-${o}${c}`}function Ir({kind:e,negate:t,value:n,key:a},s){if(e===y.dot)return s.currentFlags.dotAll?s.appliedGlobalFlags.dotAll||s.useFlagMods?".":"[^]":g`[^\n]`;if(e===y.digit)return t?g`\D`:g`\d`;if(e===y.property){if(!s.usePostEs2018Properties&&xe.has(n))throw new Error(`Unicode property "${n}" unavailable in target ES2018`);if(s.useAppliedIgnoreCase&&s.currentFlags.ignoreCase&&ge.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?g`\P`:g`\p`}{${a?`${a}=`:""}${n}}`}if(e===y.word)return t?g`\W`:g`\w`;throw new Error(`Unexpected character set kind "${e}"`)}function $r(e,t){return(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")}function Nr({atomic:e,flags:t,parent:n,alternatives:a},s,i){let o=s.currentFlags;t&&(s.currentFlags=M(o,t));let c=a.map(i).join("|"),u=!s.verbose&&a.length===1&&n.type!==p.Quantifier&&!e&&(!s.useFlagMods||!t)?c:`(?${Gr(e,t,s.useFlagMods)}${c})`;return s.currentFlags=o,u}function vr({ref:e},t){let n=t.maxRecursionDepth;if(!n)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=${n})`:g`\g<${e}&R=${n}>`}function ot(e,{firstOnly:t}={}){let n=e.min.value,a=e.max.value,s=[];if(n<65&&(a===65535||a>=131071)||n===65536&&a>=131071)return s;for(let i=n;i<=a;i++){let o=A(i);if(!we(o))continue;let c=ue(o).filter(u=>{let l=u.codePointAt(0);return l<n||l>a});if(c.length&&(s.push(...c),t))break}return s}function V(e,{isAfterBackref:t,inCharClass:n,useFlagV:a}){if(st.has(e))return st.get(e);if(e<32||e>126&&e<160||e>262143||t&&Tr(e))return e>255?g`\u{${e.toString(16).toUpperCase()}}`:g`\x${e.toString(16).toUpperCase().padStart(2,"0")}`;let s=n?a?_r:wr:Er,i=A(e);return(s.has(i)?"\\":"")+i}function Pr(e){let t=e.map(s=>s.codePointAt(0)).sort((s,i)=>s-i),n=[],a=null;for(let s=0;s<t.length;s++)t[s+1]===t[s]+1?a??=t[s]:a===null?n.push(t[s]):(n.push([a,t[s]]),a=null);return n}function Gr(e,t,n){if(e)return">";let a="";if(t&&n){let{enable:s,disable:i}=t;a=(s?.ignoreCase?"i":"")+(s?.dotAll?"s":"")+(i?"-":"")+(i?.ignoreCase?"i":"")+(i?.dotAll?"s":"")}return`${a}:`}function Rr({min:e,max:t,greedy:n,possessive:a}){let s;return!e&&t===1?s="?":!e&&t===1/0?s="*":e===1&&t===1/0?s="+":e===t?s=`{${e}}`:s=`{${e},${t===1/0?"":t}}`,s+(a?"+":n?"":"?")}function Tr(e){return e>47&&e<58}var b=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function j(e,t,n,a){let s=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),i=[!1],o=0,c="";for(let u of e.matchAll(s)){let{0:l,groups:{$skip:f}}=u;if(!f&&(!a||a===b.DEFAULT==!o)){n instanceof Function?c+=n(u,{context:o?b.CHAR_CLASS:b.DEFAULT,negated:i[i.length-1]}):c+=n;continue}l[0]==="["?(o++,i.push(l[1]==="^")):l==="]"&&o&&(o--,i.pop()),c+=l}return c}function _e(e,t,n,a){j(e,t,n,a)}function Lr(e,t,n=0,a){if(!new RegExp(t,"su").test(e))return null;let s=new RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");s.lastIndex=n;let i=0,o;for(;o=s.exec(e);){let{0:c,groups:{$skip:u}}=o;if(!u&&(!a||a===b.DEFAULT==!i))return o;c==="["?i++:c==="]"&&i&&i--,s.lastIndex==o.index&&s.lastIndex++}return null}function ae(e,t,n){return!!Lr(e,t,0,n)}function it(e,t){let n=/\\?./gsu;n.lastIndex=t;let a=e.length,s=0,i=1,o;for(;o=n.exec(e);){let[c]=o;if(c==="[")s++;else if(s)c==="]"&&s--;else if(c==="(")i++;else if(c===")"&&(i--,!i)){a=o.index;break}}return e.slice(t,a)}var ct={DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS",ENCLOSED_P:"ENCLOSED_P",ENCLOSED_U:"ENCLOSED_U",GROUP_NAME:"GROUP_NAME",INTERVAL_QUANTIFIER:"INTERVAL_QUANTIFIER",INVALID_INCOMPLETE_TOKEN:"INVALID_INCOMPLETE_TOKEN"},Ae={DEFAULT:"DEFAULT",ENCLOSED_P:"ENCLOSED_P",ENCLOSED_Q:"ENCLOSED_Q",ENCLOSED_U:"ENCLOSED_U",INVALID_INCOMPLETE_TOKEN:"INVALID_INCOMPLETE_TOKEN",RANGE:"RANGE"},Ln=new Set([ct.ENCLOSED_P,ct.ENCLOSED_U]),On=new Set([Ae.ENCLOSED_P,Ae.ENCLOSED_Q,Ae.ENCLOSED_U]),Un=(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),Dn=(()=>{try{new RegExp("","v")}catch{return!1}return!0})(),ut="$E$";var Or=String.raw`\(\?<(?![=!])(?<captureName>[^>]+)>`,Mn=String.raw`\((?!\?)(?!(?<=\(\?\()DEFINE\))|${Or}`,lt=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;var Ur=["Basic_Emoji","Emoji_Keycap_Sequence","RGI_Emoji_Modifier_Sequence","RGI_Emoji_Flag_Sequence","RGI_Emoji_Tag_Sequence","RGI_Emoji_ZWJ_Sequence","RGI_Emoji"].join("|"),Bn=new RegExp(String.raw` | ||
\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}`:Ye().source.replace(/\\u\{/g,f`\x{`);t(F(f`(?>\r\n|${o}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}))}else throw new Error(`Unexpected varcharset kind "${n}"`)}},nt={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},{reffedNodesByReferencer:t}){let{ref:r}=e,s=e.parent;for(;(s=s.parent)&&!(s.type===l.CapturingGroup&&(s.name===r||s.number===r)););t.set(e,s)},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 C=et(u);i.set(C,a.get(u)),t(C),r();return}a.set(u,e);let p=M(o,u,[]);for(let C=0;C<p.length;C++){let d=p[C];if(c===d.node||c&&c===d.origin||e===d.origin){p.splice(C,1);break}}if(p.push({node:e,origin:c}),e.name){let C=M(n,e.name,new Map);for(let d of C.values())!d.hasDuplicateNameToRemove&&st(d.node,e,{ancestorsParticipate:!0})&&(d.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=O(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?et(n):at(o,t.groupOriginByCopy,null),c=i;if(!a){let u=ot(Sr(o,C=>C.type===l.Group&&!!C.flags)),p=u?O(t.globalFlags,u):t.globalFlags;wr(p,t.currentFlags)||(c=z(I({flags:Ar(p)}),[i]))}s(c),a||lt(c,e,t,nt)}},Er={Backreference({node:e,replaceWith:t},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let n=r.reffedNodesByReferencer.get(e).filter(o=>st(o,e,{ancestorsParticipate:!1}));if(!n.length)t(te({negate:!0}));else if(n.length>1){let o=n.map(a=>se(P(),[ee(a.number)]));t(se(I(),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=Ee();e.pattern.alternatives.at(-1).elements.push(n)}}}};function se(e,t){return t.forEach(r=>r.parent=e),e[Ae(e)]=t,e}function wr(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function st(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=it(s.parent);for(let o of n){if(o===s)break;if(o===e||ut(o,e))return!0}}while(s=s.parent);throw new Error("Unexpected path")}function at(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]=at(a,t,n,r):(o==="type"&&a===l.CapturingGroup&&t.set(n,t.get(e)??e),n[o]=a);return n}function et(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 Ae(e){for(let t of["alternatives","classes","elements"])if(e[t])return t;return null}function ot(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 Ar({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 it(e){if(!e)throw new Error("Node expected");if(e.type===l.Quantifier)return[e.element];let t=Ae(e);return t&&e[t]}function ct(e){let t=e.find(r=>r.kind===E.search_start||ne(r,{negate:!1})||!we(r));if(!t)return null;if(t.kind===E.search_start)return t;if($(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=ct(s.elements);if(!n)return null;Array.isArray(n)?r.push(...n):r.push(n)}return r}return null}function ut(e,t){let r=it(e)??[];for(let s of r)if(s===t||ut(s,t))return!0;return!1}function _r(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function F(e,t){let r=!!t?.skipPropertyNameValidation,n=q(H(e),{skipPropertyNameValidation:r}).pattern.alternatives;return n.length>1||n[0].elements.length>1?se(I(),n):n[0].elements[0]}function z(e,t){let r=Ae(e);return e[r][0].parent=e,t&&se(e[r][0],t),e}function lt(e,{parent:t,key:r,container:s},n,o){N({node:e,parent:t,key:r,container:s},n,o)}function ft(e,t){let r=Z(t),s=V(r.target,"ES2024"),n=V(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 h=[e.flags.ignoreCase];N({node:e},{getCurrentModI:()=>h.at(-1),popModI(){h.pop()},pushModI(S){h.push(S)},setHasCasedChar(){h.at(-1)?a=!0:i=!0}},kr)}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 C(h){switch(p.lastNode=u,u=h,h.type){case l.Regex:return{pattern:C(h.pattern),flags:C(h.flags),options:{...h.options}};case l.Alternative:return h.elements.map(C).join("");case l.Assertion:return Nr(h,p,C);case l.Backreference:return $r(h,p);case l.CapturingGroup:return Ir(h,p,C);case l.Character:return vr(h,p);case l.CharacterClass:return Pr(h,p,C);case l.CharacterClassIntersection:if(!p.useFlagV)throw new Error("Use of class intersection requires min target ES2024");return h.classes.map(C).join("&&");case l.CharacterClassRange:return Gr(h,p);case l.CharacterSet:return Lr(h,p);case l.Flags:return Rr(h,p);case l.Group:return Tr(h,p,C);case l.Pattern:return h.alternatives.map(C).join("|");case l.Quantifier:return C(h.element)+Dr(h);case l.Recursion:return Or(h,p);default:throw new Error(`Unexpected node type "${h.type}"`)}}let d=C(e);return s||(delete d.options.force.v,d.options.disable.v=!0,d.options.unicodeSetsPlugin=null),d}var kr={AnyGroup:{enter({node:e},t){let r=t.getCurrentModI();t.pushModI(e.flags?O({ignoreCase:r},e.flags).ignoreCase:r)},exit(e,t){t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){_e(w(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},r){t(),gt(e,{firstOnly:!0}).length&&r.setHasCasedChar()},CharacterSet({node:e},t){e.kind===k.property&&de.has(e.value)&&t.setHasCasedChar()}},yr=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),br=new Set(["-","\\","]","^"]),xr=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),pt=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`]]),Fr=/^\p{Cased}$/u;function _e(e){return Fr.test(e)}function Nr(e,t,r){let{kind:s,negate:n,alternatives:o}=e;if($(e))return`(?${`${s===E.lookahead?"":"<"}${n?"!":"="}`}${o.map(r).join("|")})`;if(s===E.string_end)return"$";if(s===E.string_start)return"^";throw new Error(`Unexpected assertion kind "${s}"`)}function $r({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 Ir({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 vr({value:e},t){let r=w(e),s=U(e,{isAfterBackref:t.lastNode.type===l.Backreference,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(s!==r)return s;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&_e(r)){let n=pe(r);return t.inCharClass?n.join(""):n.length>1?`[${n.join("")}]`:n[0]}return r}function Pr({negate:e,parent:t,elements:r},s,n){if(!e&&(!s.useFlagV||!s.verbose)&&t.type===l.CharacterClass&&r[0].type!==l.CharacterClassIntersection||!s.verbose&&t.type===l.CharacterClassIntersection&&r.length===1&&r[0].type!==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");s.inCharClass=!0;let o=`[${e?"^":""}${r.map(n).join("")}]`;return s.inCharClass=!1,o}function Gr(e,t){let r=e.min.value,s=e.max.value,n={isAfterBackref:!1,inCharClass:!0,useFlagV:t.useFlagV},o=U(r,n),a=U(s,n),i="";if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase){let c=gt(e);Mr(c).forEach(p=>{i+=Array.isArray(p)?`${U(p[0],n)}-${U(p[1],n)}`:U(p,n)})}return`${o}-${a}${i}`}function Lr({kind:e,negate:t,value:r,key:s},n){if(e===k.dot)return n.currentFlags.dotAll?n.appliedGlobalFlags.dotAll||n.useFlagMods?".":"[^]":f`[^\n]`;if(e===k.digit)return t?f`\D`:f`\d`;if(e===k.property){if(!n.usePostEs2018Properties&&Le.has(r))throw new Error(`Unicode property "${r}" unavailable in target ES2018`);if(n.useAppliedIgnoreCase&&n.currentFlags.ignoreCase&&de.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===k.word)return t?f`\W`:f`\w`;throw new Error(`Unexpected character set kind "${e}"`)}function Rr(e,t){return(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":"")}function Tr({atomic:e,flags:t,parent:r,alternatives:s},n,o){let a=n.currentFlags;t&&(n.currentFlags=O(a,t));let i=s.map(o).join("|"),c=!n.verbose&&s.length===1&&r.type!==l.Quantifier&&!e&&(!n.useFlagMods||!t)?i:`(?${Ur(e,t,n.useFlagMods)}${i})`;return n.currentFlags=a,c}function Or({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 gt(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=w(a);if(!_e(i))continue;let c=pe(i).filter(u=>{let p=u.codePointAt(0);return p<s||p>n});if(c.length&&(o.push(...c),r))break}return o}function U(e,{isAfterBackref:t,inCharClass:r,useFlagV:s}){if(pt.has(e))return pt.get(e);if(e<32||e>126&&e<160||e>262143||t&&Br(e))return e>255?f`\u{${e.toString(16).toUpperCase()}}`:f`\x${e.toString(16).toUpperCase().padStart(2,"0")}`;let n=r?s?xr:br:yr,o=w(e);return(n.has(o)?"\\":"")+o}function Mr(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 Ur(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 Dr({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 Br(e){return e>47&&e<58}var y=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function G(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===y.DEFAULT==!a)){r instanceof Function?i+=r(c,{context:a?y.CHAR_CLASS:y.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 ke(e,t,r,s){G(e,t,r,s)}function Vr(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===y.DEFAULT==!o))return a;i==="["?o++:i==="]"&&o&&o--,n.lastIndex==a.index&&n.lastIndex++}return null}function ae(e,t,r){return!!Vr(e,t,0,r)}function ht(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 oe="$E$",X=class e extends RegExp{_captureMap;constructor(t,r,s){let n;s?.useEmulationGroups&&({expression:t,captureMap:n}=jr(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 jr(e){let t=oe.replace(/\$/g,"\\$"),r=[!0];return e=G(e,String.raw`\((?:(?!\?)|\?<(?![=!])[^>]+>)(?<mark>${t})?`,({0:s,groups:{mark:n}})=>n?(r.push(!1),s.slice(0,-oe.length)):(r.push(!0),s),y.DEFAULT),{captureMap:r,expression:e}}var dt={DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS",ENCLOSED_P:"ENCLOSED_P",ENCLOSED_U:"ENCLOSED_U",GROUP_NAME:"GROUP_NAME",INTERVAL_QUANTIFIER:"INTERVAL_QUANTIFIER",INVALID_INCOMPLETE_TOKEN:"INVALID_INCOMPLETE_TOKEN"},ye={DEFAULT:"DEFAULT",ENCLOSED_P:"ENCLOSED_P",ENCLOSED_Q:"ENCLOSED_Q",ENCLOSED_U:"ENCLOSED_U",INVALID_INCOMPLETE_TOKEN:"INVALID_INCOMPLETE_TOKEN",RANGE:"RANGE"},Qn=new Set([dt.ENCLOSED_P,dt.ENCLOSED_U]),Wn=new Set([ye.ENCLOSED_P,ye.ENCLOSED_Q,ye.ENCLOSED_U]),qn=(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),zn=(()=>{try{new RegExp("","v")}catch{return!1}return!0})();var Kr=String.raw`\(\?<(?![=!])(?<captureName>[^>]+)>`,Xn=String.raw`\((?!\?)(?!(?<=\(\?\()DEFINE\))|${Kr}`,Ct=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;var Hr=["Basic_Emoji","Emoji_Keycap_Sequence","RGI_Emoji_Modifier_Sequence","RGI_Emoji_Flag_Sequence","RGI_Emoji_Tag_Sequence","RGI_Emoji_ZWJ_Sequence","RGI_Emoji"].join("|"),Zn=new RegExp(String.raw` | ||
\\(?: c[A-Za-z] | ||
| p\{(?<pStrProp>${Ur})\} | ||
| p\{(?<pStrProp>${Hr})\} | ||
| [pP]\{[^\}]+\} | ||
@@ -45,3 +45,3 @@ | (?<qStrProp>q) | ||
| . | ||
`.replace(/\s+/g,""),"gsu");var Vn=new RegExp(String.raw` | ||
`.replace(/\s+/g,""),"gsu");var Jn=new RegExp(String.raw` | ||
(?<groupN>\(\?<(?![=!])|\\[gk]<) | ||
@@ -59,3 +59,3 @@ | (?<enclosedPU>\\[pPu]\{) | ||
| \\?. | ||
`.replace(/\s+/g,""),"gsu");function pt(e,t,n,a){return e.slice(0,t)+a+e.slice(t+n.length)}var ft=new RegExp(String.raw`(?<noncapturingStart>${lt})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function gt(e,t){if(!/\(\?>/.test(e))return e;let n="(?>",a=`(?:(?=(${t?.useEmulationGroups?ut:""}`,s=[0],i=0,o=0,c=NaN,u;do{u=!1;let l=0,f=0,d=!1,C;for(ft.lastIndex=Number.isNaN(c)?0:c+a.length;C=ft.exec(e);){let{0:m,index:_,groups:{capturingStart:T,noncapturingStart:D}}=C;if(m==="[")l++;else if(l)m==="]"&&l--;else if(m===n&&!d)c=_,d=!0;else if(d&&D)f++;else if(T)d?f++:(i++,s.push(i+o));else if(m===")"&&d){if(!f){o++,e=`${e.slice(0,c)}${a}${e.slice(c+n.length,_)}))<$$${o+i}>)${e.slice(_+1)}`,u=!0;break}f--}}}while(u);return e=j(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:l,groups:{backrefNum:f,wrappedBackrefNum:d}})=>{if(f){let C=+f;if(C>s.length-1)throw new Error(`Backref "${l}" greater than number of captures`);return`\\${s[C]}`}return`\\${d}`},b.DEFAULT),e}var ht=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Se=new RegExp(String.raw` | ||
`.replace(/\s+/g,""),"gsu");function mt(e,t,r,s){return e.slice(0,t)+s+e.slice(t+r.length)}var Et=new RegExp(String.raw`(?<noncapturingStart>${Ct})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function xe(e,t){if(!/\(\?>/.test(e))return e;let r="(?>",s=`(?:(?=(${t?.useEmulationGroups?oe:""}`,n=[0],o=0,a=0,i=NaN,c;do{c=!1;let u=0,p=0,C=!1,d;for(Et.lastIndex=Number.isNaN(i)?0:i+s.length;d=Et.exec(e);){let{0:h,index:S,groups:{capturingStart:L,noncapturingStart:T}}=d;if(h==="[")u++;else if(u)h==="]"&&u--;else if(h===r&&!C)i=S,C=!0;else if(C&&T)p++;else if(L)C?p++:(o++,n.push(o+a));else if(h===")"&&C){if(!p){a++,e=`${e.slice(0,i)}${s}${e.slice(i+r.length,S)}))<$$${a+o}>)${e.slice(S+1)}`,c=!0;break}p--}}}while(c);return e=G(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:u,groups:{backrefNum:p,wrappedBackrefNum:C}})=>{if(p){let d=+p;if(d>n.length-1)throw new Error(`Backref "${u}" greater than number of captures`);return`\\${n[d]}`}return`\\${C}`},y.DEFAULT),e}var wt=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,be=new RegExp(String.raw` | ||
\\(?: \d+ | ||
@@ -73,5 +73,5 @@ | c[A-Za-z] | ||
))? | ||
| (?<qBase>${ht})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?) | ||
| (?<qBase>${wt})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?) | ||
| \\?. | ||
`.replace(/\s+/g,""),"gsu");function dt(e){if(!new RegExp(`${ht}\\+`).test(e))return e;let t=[],n=null,a=null,s="",i=0,o;for(Se.lastIndex=0;o=Se.exec(e);){let{0:c,index:u,groups:{qBase:l,qMod:f,invalidQ:d}}=o;if(c==="[")i||(a=u),i++;else if(c==="]")i?i--:a=null;else if(!i)if(f==="+"&&s&&!s.startsWith("(")){if(d)throw new Error(`Invalid quantifier "${c}"`);let C=-1;if(/^\{\d+\}$/.test(l))e=pt(e,u+l.length,f,"");else{if(s===")"||s==="]"){let m=s===")"?n:a;if(m===null)throw new Error(`Invalid unmatched "${s}"`);e=`${e.slice(0,m)}(?>${e.slice(m,u)}${l})${e.slice(u+c.length)}`}else e=`${e.slice(0,u-s.length)}(?>${s}${l})${e.slice(u+c.length)}`;C+=4}Se.lastIndex+=C}else c[0]==="("?t.push(u):c===")"&&(n=t.length?t.pop():null);s=c}return e}var Dr=String.raw`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,ye=String.raw`\(\?R=(?<rDepth>[^\)]+)\)|${Dr}`,be=String.raw`\(\?<(?![=!])(?<captureName>[^>]+)>`,U=new RegExp(String.raw`${be}|${ye}|\(\?|\\?.`,"gsu"),ke="Cannot use multiple overlapping recursions";function wt(e){if(!new RegExp(ye,"su").test(e))return e;if(ae(e,String.raw`\\[1-9]`,b.DEFAULT))throw new Error("Numbered backrefs cannot be used with recursion");if(ae(e,String.raw`\(\?\(DEFINE\)`,b.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");let t=new Map,n=[],a=!1,s=0,i=0,o;for(U.lastIndex=0;o=U.exec(e);){let{0:c,groups:{captureName:u,rDepth:l,gRNameOrNum:f,gRDepth:d}}=o;if(c==="[")s++;else if(s)c==="]"&&s--;else if(l){if(Ct(l),a)throw new Error(ke);let C=e.slice(0,o.index),m=e.slice(U.lastIndex);if(ae(m,ye,b.DEFAULT))throw new Error(ke);return mt(C,m,+l,!1)}else if(f){Ct(d);let C=!1;for(let K of n)if(K.name===f||K.num===+f){if(C=!0,K.hasRecursedWithin)throw new Error(ke);break}if(!C)throw new Error(`Recursive \\g cannot be used outside the referenced group "\\g<${f}&R=${d}>"`);let m=t.get(f),_=it(e,m),T=e.slice(m,o.index),D=_.slice(T.length+c.length),x=mt(T,D,+d,!0),At=e.slice(0,m),St=e.slice(m+_.length);e=`${At}${x}${St}`,U.lastIndex+=x.length-c.length-T.length-D.length,n.forEach(K=>K.hasRecursedWithin=!0),a=!0}else if(u)i++,t.set(String(i),U.lastIndex),t.set(u,U.lastIndex),n.push({num:i,name:u});else if(c.startsWith("(")){let C=c==="(";C&&(i++,t.set(String(i),U.lastIndex)),n.push(C?{num:i}:{})}else c===")"&&n.pop()}return e}function Ct(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 mt(e,t,n,a){let s=new Set;a&&_e(e+t,be,({groups:{captureName:o}})=>{s.add(o)},b.DEFAULT);let i=n-1;return`${e}${Et(`(?:${e}`,i,a?s:null)}(?:)${Et(`${t})`,i,a?s:null,"backward")}${t}`}function Et(e,t,n,a="forward"){let i=c=>a==="backward"?t-c+2-1:c+2,o="";for(let c=0;c<t;c++){let u=i(c);o+=j(e,String.raw`${be}|\\k<(?<backref>[^>]+)>`,({0:l,groups:{captureName:f,backref:d}})=>{if(d&&n&&!n.has(d))return l;let C=`_$${u}`;return f?`(?<${f}${C}>`:`\\k<${d}${C}>`},b.DEFAULT)}return o}function _t(e,t){let n=ee(t),a=q(e,n.flags),s=Z(a,{skipBackrefValidation:n.tmGrammar,verbose:n.verbose}),i=qe(s,{accuracy:n.accuracy,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),o=at(i,n),c=gt(dt(wt(o.pattern))),u;i._strategy&&(c=c.replace(/\(\?:\\p{sc=<<}\|(.*?)\|\\p{sc=>>}\)/s,(f,d)=>(u=d,"")));let l={pattern:c,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${o.flags}${o.options.disable.v?"u":"v"}`};return i._strategy&&(l.strategy={...i._strategy},u&&(l.strategy.subpattern=u)),l}function Mr(e,t){return Z(q(e,t?.flags))}function Br(e,t){let n=_t(e,t);return n.strategy?new oe(n.pattern,n.flags,n.strategy):new RegExp(n.pattern,n.flags)}var oe=class e extends RegExp{#e;constructor(t,n,a){super(t,n),a?this.#e=a:t instanceof e&&(this.#e=t.#e)}exec(t){let n=this.global||this.sticky,a=this.lastIndex,s=RegExp.prototype.exec;if(this.#e.name==="line_or_search_start"&&n&&this.lastIndex){this.lastIndex=0;let i=s.call(this,t.slice(a));return i&&(i.input=t,i.index+=a,this.lastIndex+=a),i}if(this.#e.name==="not_search_start"){let i=s.call(this,t);if(i?.index===a){let o=n?this:new RegExp(this.source,`g${this.flags}`);o.lastIndex=i.index+1,i=s.call(o,t)}return i}if(this.#e.name==="after_search_start_or_subpattern"){let i=s.call(this,t);if(!i||i.index===a)return i;let o=new RegExp(`(?<=${this.#e.subpattern})${this.source}`,this.flags);return o.lastIndex=a,i=s.call(o,t),this.lastIndex=o.lastIndex,i}return s.call(this,t)}};return It(Vr);})(); | ||
`.replace(/\s+/g,""),"gsu");function Fe(e){if(!new RegExp(`${wt}\\+`).test(e))return e;let t=[],r=null,s=null,n="",o=0,a;for(be.lastIndex=0;a=be.exec(e);){let{0:i,index:c,groups:{qBase:u,qMod:p,invalidQ:C}}=a;if(i==="[")o||(s=c),o++;else if(i==="]")o?o--:s=null;else if(!o)if(p==="+"&&n&&!n.startsWith("(")){if(C)throw new Error(`Invalid quantifier "${i}"`);let d=-1;if(/^\{\d+\}$/.test(u))e=mt(e,c+u.length,p,"");else{if(n===")"||n==="]"){let h=n===")"?r:s;if(h===null)throw new Error(`Invalid unmatched "${n}"`);e=`${e.slice(0,h)}(?>${e.slice(h,c)}${u})${e.slice(c+i.length)}`}else e=`${e.slice(0,c-n.length)}(?>${n}${u})${e.slice(c+i.length)}`;d+=4}be.lastIndex+=d}else i[0]==="("?t.push(c):i===")"&&(r=t.length?t.pop():null);n=i}return e}var Qr=String.raw`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`,$e=String.raw`\(\?R=(?<rDepth>[^\)]+)\)|${Qr}`,Ie=String.raw`\(\?<(?![=!])(?<captureName>[^>]+)>`,R=new RegExp(String.raw`${Ie}|${$e}|\(\?|\\?.`,"gsu"),Ne="Cannot use multiple overlapping recursions";function kt(e){if(!new RegExp($e,"su").test(e))return e;if(ae(e,String.raw`\\[1-9]`,y.DEFAULT))throw new Error("Numbered backrefs cannot be used with recursion");if(ae(e,String.raw`\(\?\(DEFINE\)`,y.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");let t=new Map,r=[],s=!1,n=0,o=0,a;for(R.lastIndex=0;a=R.exec(e);){let{0:i,groups:{captureName:c,rDepth:u,gRNameOrNum:p,gRDepth:C}}=a;if(i==="[")n++;else if(n)i==="]"&&n--;else if(u){if(St(u),s)throw new Error(Ne);let d=e.slice(0,a.index),h=e.slice(R.lastIndex);if(ae(h,$e,y.DEFAULT))throw new Error(Ne);return At(d,h,+u,!1)}else if(p){St(C);let d=!1;for(let D of r)if(D.name===p||D.num===+p){if(d=!0,D.hasRecursedWithin)throw new Error(Ne);break}if(!d)throw new Error(`Recursive \\g cannot be used outside the referenced group "\\g<${p}&R=${C}>"`);let h=t.get(p),S=ht(e,h),L=e.slice(h,a.index),T=S.slice(L.length+i.length),b=At(L,T,+C,!0),bt=e.slice(0,h),xt=e.slice(h+S.length);e=`${bt}${b}${xt}`,R.lastIndex+=b.length-i.length-L.length-T.length,r.forEach(D=>D.hasRecursedWithin=!0),s=!0}else if(c)o++,t.set(String(o),R.lastIndex),t.set(c,R.lastIndex),r.push({num:o,name:c});else if(i.startsWith("(")){let d=i==="(";d&&(o++,t.set(String(o),R.lastIndex)),r.push(d?{num:o}:{})}else i===")"&&r.pop()}return e}function St(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e))throw new Error(t);if(e=+e,e<2||e>100)throw new Error(t)}function At(e,t,r,s){let n=new Set;s&&ke(e+t,Ie,({groups:{captureName:a}})=>{n.add(a)},y.DEFAULT);let o=r-1;return`${e}${_t(`(?:${e}`,o,s?n:null)}(?:)${_t(`${t})`,o,s?n:null,"backward")}${t}`}function _t(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+=G(e,String.raw`${Ie}|\\k<(?<backref>[^>]+)>`,({0:u,groups:{captureName:p,backref:C}})=>{if(C&&r&&!r.has(C))return u;let d=`_$${c}`;return p?`(?<${p}${d}>`:`\\k<${C}${d}>`},y.DEFAULT)}return a}function yt(e,t){let r=Z(t),s=H(e,r.flags),n=q(s,{skipBackrefValidation:r.tmGrammar,verbose:r.verbose}),o=tt(n,{accuracy:r.accuracy,avoidSubclass:r.avoidSubclass,bestEffortTarget:r.target}),a=ft(o,r);e=Fe(kt(a.pattern));let i=xe(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 Wr(e,t){return q(H(e,t?.flags))}function qr(e,t){let r=yt(e,t);return r.subclass?new ie(r.pattern,r.flags,r.subclass):new RegExp(r.pattern,r.flags)}var ie=class e extends X{#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)}};return Pt(zr);})(); | ||
//# sourceMappingURL=index.min.js.map |
{ | ||
"name": "oniguruma-to-es", | ||
"version": "0.3.0", | ||
"version": "0.4.0", | ||
"description": "Convert Oniguruma patterns to native JavaScript RegExp", | ||
@@ -46,3 +46,3 @@ "author": "Steven Levithan", | ||
"emoji-regex-xs": "^1.0.0", | ||
"regex": "^4.4.0", | ||
"regex": "^5.0.0", | ||
"regex-recursion": "^4.2.1" | ||
@@ -49,0 +49,0 @@ }, |
# Oniguruma-To-ES | ||
[![npm version][npm-version-src]][npm-version-href] | ||
[![npm downloads][npm-downloads-src]][npm-downloads-href] | ||
[![bundle][bundle-src]][bundle-href] | ||
@@ -34,2 +35,3 @@ | ||
import {toRegExp} from 'oniguruma-to-es'; | ||
const str = '…'; | ||
@@ -41,13 +43,2 @@ const pattern = '…'; | ||
<!-- | ||
In browsers: | ||
```html | ||
<script type="module"> | ||
import {toRegExp} from 'https://esm.run/oniguruma-to-es'; | ||
toRegExp(String.raw`…`); | ||
</script> | ||
``` | ||
--> | ||
<details> | ||
@@ -76,10 +67,10 @@ <summary>Using a global name (no import)</summary> | ||
pattern: string, | ||
options?: Options | ||
options?: OnigurumaToEsOptions | ||
): RegExp | EmulatedRegExp; | ||
``` | ||
#### Type `Options` | ||
#### Type `OnigurumaToEsOptions` | ||
```ts | ||
type Options = { | ||
type OnigurumaToEsOptions = { | ||
accuracy?: 'strict' | 'default' | 'loose'; | ||
@@ -91,3 +82,3 @@ avoidSubclass?: boolean; | ||
maxRecursionDepth?: number | null; | ||
target?: 'ES2018' | 'ES2024' | 'ES2025'; | ||
target?: 'auto' | 'ES2025' | 'ES2024' | 'ES2018'; | ||
tmGrammar?: boolean; | ||
@@ -107,14 +98,11 @@ verbose?: boolean; | ||
pattern: string, | ||
options?: Options | ||
options?: OnigurumaToEsOptions | ||
): { | ||
pattern: string; | ||
flags: string; | ||
strategy?: { | ||
name: string; | ||
subpattern?: string; | ||
}; | ||
subclass?: EmulatedRegExpOptions; | ||
}; | ||
``` | ||
Note that the returned `flags` might also be different than those provided, as a result of the emulation process. The returned `pattern`, `flags`, and `strategy` can be provided as arguments to the `EmulatedRegExp` constructor to produce the same result as `toRegExp`. | ||
Note that the returned `flags` might also be different than those provided, as a result of the emulation process. The returned `pattern`, `flags`, and `subclass` properties can be provided as arguments to the `EmulatedRegExp` constructor to produce the same result as `toRegExp`. | ||
@@ -145,6 +133,3 @@ If the only keys returned are `pattern` and `flags`, they can optionally be provided to JavaScript's `RegExp` constructor instead. Setting option `avoidSubclass` to `true` ensures that this is always the case, by throwing an error for any patterns that rely on `EmulatedRegExp`'s additional handling. | ||
flags?: string, | ||
strategy?: { | ||
name: string; | ||
subpattern?: string; | ||
} | ||
options?: EmulatedRegExpOptions | ||
); | ||
@@ -164,3 +149,3 @@ }; | ||
- **Strict:** Throw if the pattern can't be emulated with identical behavior (even in rare edge cases) for the given target. | ||
- **Strict:** Throw if the pattern can't be emulated with identical behavior (even in rare edge cases) for the given `target`. | ||
- **Default:** The best choice in most cases. Permits a few close approximations of Oniguruma in order to support additional features. | ||
@@ -202,3 +187,3 @@ - **Loose:** Useful for non-critical matching like syntax highlighting where having some mismatches is better than not working. | ||
Disables advanced emulation strategies that rely on returning a `RegExp` subclass, resulting in certain patterns not being emulatable. | ||
Disables advanced emulation that relies on returning a `RegExp` subclass, resulting in certain patterns not being emulatable. | ||
@@ -242,5 +227,5 @@ ### `flags` | ||
One of `'ES2018'`, `'ES2024'` *(default)*, or `'ES2025'`. | ||
One of `'auto'` *(default)*, `'ES2025'`, `'ES2024'`, or `'ES2018'`. | ||
Sets the JavaScript language version for the generated pattern and flags. Later targets allow faster processing, simpler generated source, and support for additional features. | ||
JavaScript version support needed for generated regexes. `auto` sets the value based on your environment. Later targets allow faster processing, simpler generated source, and support for additional features. | ||
@@ -993,3 +978,5 @@ <details> | ||
[npm-version-href]: https://npmjs.com/package/oniguruma-to-es | ||
[npm-downloads-src]: https://img.shields.io/npm/dm/oniguruma-to-es?color=78C372 | ||
[npm-downloads-href]: https://npmjs.com/package/oniguruma-to-es | ||
[bundle-src]: https://img.shields.io/bundlejs/size/oniguruma-to-es?color=78C372&label=minzip | ||
[bundle-href]: https://bundlejs.com/?q=oniguruma-to-es&treeshake=[*] |
/** | ||
Generates a Regex+ compatible `pattern`, `flags`, and `options` from a Regex+ AST. | ||
@param {import('./transform.js').RegexAst} ast | ||
@param {import('.').Options} [options] | ||
@param {import('.').OnigurumaToEsOptions} [options] | ||
@returns {{ | ||
@@ -11,3 +11,3 @@ pattern: string; | ||
*/ | ||
export function generate(ast: import("./transform.js").RegexAst, options?: import(".").Options): { | ||
export function generate(ast: import("./transform.js").RegexAst, options?: import(".").OnigurumaToEsOptions): { | ||
pattern: string; | ||
@@ -14,0 +14,0 @@ flags: string; |
@@ -1,2 +0,2 @@ | ||
export type Options = { | ||
export type OnigurumaToEsOptions = { | ||
accuracy?: "default" | "strict" | "loose"; | ||
@@ -8,18 +8,21 @@ avoidSubclass?: boolean; | ||
maxRecursionDepth?: number | null; | ||
target?: "ES2018" | "ES2024" | "ES2025"; | ||
target?: "auto" | "ES2018" | "ES2024" | "ES2025"; | ||
tmGrammar?: boolean; | ||
verbose?: boolean; | ||
}; | ||
export type EmulatedRegExpOptions = { | ||
useEmulationGroups?: boolean; | ||
strategy?: string; | ||
}; | ||
/** | ||
Works the same as JavaScript's native `RegExp` constructor in all contexts, but can be given results from `toDetails` to produce the same result as `toRegExp`. | ||
Works the same as JavaScript's native `RegExp` constructor in all contexts, but can be given | ||
results from `toDetails` to produce the same result as `toRegExp`. | ||
@class | ||
@augments RegExp | ||
@param {string | EmulatedRegExp} pattern | ||
@param {string} [flags] | ||
@param {{ | ||
name: string; | ||
subpattern?: string; | ||
}} [strategy] | ||
@param {EmulatedRegExpOptions} [options] | ||
*/ | ||
export class EmulatedRegExp extends RegExp { | ||
constructor(pattern: any, flags: any, strategy: any); | ||
constructor(pattern: any, flags: any, options: any); | ||
#private; | ||
@@ -38,3 +41,7 @@ } | ||
verbose?: boolean; | ||
}} Options | ||
}} OnigurumaToEsOptions | ||
@typedef {{ | ||
useEmulationGroups?: boolean; | ||
strategy?: string; | ||
}} EmulatedRegExpOptions | ||
*/ | ||
@@ -44,19 +51,13 @@ /** | ||
@param {string} pattern Oniguruma regex pattern. | ||
@param {Options} [options] | ||
@param {OnigurumaToEsOptions} [options] | ||
@returns {{ | ||
pattern: string; | ||
flags: string; | ||
strategy?: { | ||
name: string; | ||
subpattern?: string; | ||
}; | ||
subclass?: EmulatedRegExpOptions; | ||
}} | ||
*/ | ||
export function toDetails(pattern: string, options?: Options): { | ||
export function toDetails(pattern: string, options?: OnigurumaToEsOptions): { | ||
pattern: string; | ||
flags: string; | ||
strategy?: { | ||
name: string; | ||
subpattern?: string; | ||
}; | ||
subclass?: EmulatedRegExpOptions; | ||
}; | ||
@@ -77,5 +78,5 @@ /** | ||
@param {string} pattern Oniguruma regex pattern. | ||
@param {Options} [options] | ||
@param {OnigurumaToEsOptions} [options] | ||
@returns {RegExp | EmulatedRegExp} | ||
*/ | ||
export function toRegExp(pattern: string, options?: Options): RegExp | EmulatedRegExp; | ||
export function toRegExp(pattern: string, options?: OnigurumaToEsOptions): RegExp | EmulatedRegExp; |
@@ -14,7 +14,8 @@ export namespace Accuracy { | ||
Returns a complete set of options, with default values set for options that weren't provided. | ||
@param {import('.').Options} [options] | ||
@returns {Required<import('.').Options>} | ||
@param {import('.').OnigurumaToEsOptions} [options] | ||
@returns {Required<import('.').OnigurumaToEsOptions>} | ||
*/ | ||
export function getOptions(options?: import(".").Options): Required<import(".").Options>; | ||
export function getOptions(options?: import(".").OnigurumaToEsOptions): Required<import(".").OnigurumaToEsOptions>; | ||
export namespace Target { | ||
export let auto: "auto"; | ||
let ES2018_1: "ES2018"; | ||
@@ -21,0 +22,0 @@ export { ES2018_1 as ES2018 }; |
@@ -61,5 +61,5 @@ export type OnigurumaAst = { | ||
}; | ||
export function createBackreference(ref: any, { orphan }?: {}): { | ||
export function createBackreference(ref: any, options: any): { | ||
ref: any; | ||
orphan: any; | ||
orphan: true; | ||
type: string; | ||
@@ -97,3 +97,3 @@ }; | ||
}; | ||
export function createGroup({ atomic, flags }?: {}): { | ||
export function createGroup(options: any): { | ||
alternatives: { | ||
@@ -107,9 +107,6 @@ type: string; | ||
}; | ||
export function createLookaround({ behind, negate }?: { | ||
behind?: boolean; | ||
negate?: boolean; | ||
}): { | ||
export function createLookaround(options: any): { | ||
type: string; | ||
kind: string; | ||
negate: boolean; | ||
negate: any; | ||
alternatives: { | ||
@@ -116,0 +113,0 @@ type: string; |
@@ -1,3 +0,3 @@ | ||
export function applySubclassStrategies(ast: any, accuracy: any): { | ||
name: string; | ||
}; | ||
export function applySubclassStrategies(ast: any): "line_or_search_start" | "not_search_start"; | ||
export function isLoneGLookaround(node: any, options: any): any; | ||
export function isZeroLengthNode(node: any): boolean; |
@@ -7,5 +7,3 @@ export type RegexAst = { | ||
options: any; | ||
_strategy?: { | ||
name: string; | ||
}; | ||
_strategy?: string; | ||
}; | ||
@@ -20,5 +18,3 @@ export function adoptAndSwapKids(parent: any, kids: any): any; | ||
options: Object; | ||
_strategy?: { | ||
name: string; | ||
}; | ||
_strategy?: string; | ||
}} RegexAst | ||
@@ -46,3 +42,3 @@ */ | ||
avoidSubclass?: boolean; | ||
bestEffortTarget?: "ES2018" | "ES2024" | "ES2025"; | ||
bestEffortTarget?: "auto" | "ES2018" | "ES2024" | "ES2025"; | ||
}): RegexAst; |
export const cp: any; | ||
export const envSupportsDuplicateNames: boolean; | ||
export const envSupportsFlagGroups: boolean; | ||
export const envSupportsFlagV: boolean; | ||
export function getNewCurrentFlags(current: any, { enable, disable }: { | ||
@@ -16,4 +19,4 @@ enable: any; | ||
*/ | ||
export function isMinTarget(target: "ES2018" | "ES2024" | "ES2025", min: "ES2018" | "ES2024" | "ES2025"): boolean; | ||
export function isMinTarget(target: "auto" | "ES2018" | "ES2024" | "ES2025", min: "auto" | "ES2018" | "ES2024" | "ES2025"): boolean; | ||
export const r: any; | ||
export function throwIfNot(value: any, msg: any): any; |
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
689321
4106
973
+ Addedregex@5.0.2(transitive)
+ Addedregex-recursion@4.3.0(transitive)
- Removedregex@4.4.0(transitive)
- Removedregex-recursion@4.2.1(transitive)
Updatedregex@^5.0.0