Comparing version 4.1.2 to 4.1.3
@@ -1,2 +0,2 @@ | ||
var Regex=(()=>{var H=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var Se=Object.getOwnPropertyNames;var $e=Object.prototype.hasOwnProperty;var Le=(e,t)=>{for(var n in t)H(e,n,{get:t[n],enumerable:!0})},Ie=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Se(t))!$e.call(e,o)&&o!==n&&H(e,o,{get:()=>t[o],enumerable:!(r=Te(t,o))||r.enumerable});return e};var Ce=e=>Ie(H({},"__esModule",{value:!0}),e);var qe={};Le(qe,{pattern:()=>Q,regex:()=>ve});var d=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function N(e,t,n,r){let o=new RegExp(`${t}|(?<skip>\\\\?.)`,"gsu"),u=0,s="";for(let i of e.matchAll(o)){let{0:l,groups:{skip:c}}=i;if(!c&&(!r||r===d.DEFAULT==!u)){n instanceof Function?s+=n(i):s+=n;continue}l==="["?u++:l==="]"&&u&&u--,s+=l}return s}function G(e,t,n,r){N(e,t,n,r)}function V(e,t,n=0,r){if(!new RegExp(t,"su").test(e))return null;let o=new RegExp(`${t}|(?<skip>\\\\?.)`,"gsu");o.lastIndex=n;let u=0,s;for(;s=o.exec(e);){let{0:i,groups:{skip:l}}=s;if(!l&&(!r||r===d.DEFAULT==!u))return s;i==="["?u++:i==="]"&&u&&u--,o.lastIndex==s.index&&o.lastIndex++}return null}function _(e,t,n){return!!V(e,t,0,n)}function W(e,t){let n=/\\?./gsu;n.lastIndex=t;let r=e.length,o=0,u=1,s;for(;s=n.exec(e);){let[i]=s;if(i==="[")o++;else if(o)i==="]"&&o--;else if(i==="(")u++;else if(i===")"&&(u--,!u)){r=s.index;break}}return e.slice(t,r)}var L=class{#e;constructor(t){this.#e=t}toString(){return String(this.#e)}};function Q(e,...t){if(Array.isArray(e?.raw))return new L(e.raw.flatMap((n,r)=>r<e.raw.length-1?[n,t[r]]:n).join(""));if(!t.length)return new L(e??"");throw new Error(`Unexpected arguments: ${JSON.stringify([e,...t])}`)}var f={DEFAULT:"R_DEFAULT",CHAR_CLASS:"R_CHAR_CLASS",GROUP_NAME:"R_GROUP_NAME",ENCLOSED_TOKEN:"R_ENCLOSED_TOKEN",INTERVAL_QUANTIFIER:"R_INTERVAL_QUANTIFIER",INVALID_INCOMPLETE_TOKEN:"R_INVALID_INCOMPLETE_TOKEN"},m={DEFAULT:"CC_DEFAULT",RANGE:"CC_RANGE",ENCLOSED_TOKEN:"CC_ENCLOSED_TOKEN",Q_TOKEN:"CC_Q_TOKEN",INVALID_INCOMPLETE_TOKEN:"CC_INVALID_INCOMPLETE_TOKEN"},M=(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),oe=(()=>{try{new RegExp("","v")}catch{return!1}return!0})(),R="&!#$%*+,.:;<=>?@^`~",I="$E$",j=String.raw`\(\?<(?![=!])(?<captureName>[^>]+)>`,b=String.raw`\((?!\?)(?!(?<=\(\?\()DEFINE\))|${j}`,U=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function B(e,t){return t===d.CHAR_CLASS?e.replace(new RegExp(String.raw`[()\[\]{}|\\/\-${R}]`,"g"),"\\$&"):e.replace(/[()\[\]{}|\\^$*+?.]/g,"\\$&")}function q(e){return e.replace(new RegExp(`^([${R}])(?!\\1)`),(t,n,r)=>`\\${t}${r+1===e.length?"":t}`)}function se(e){return e.replace(/^\^/,"\\^^")}function K(e,t){return N(e,String.raw`\\0(?!\d)`,"\\u{0}",t)}function ne(e,t,n){let r=0;for(let[o]of e.matchAll(new RegExp(`[${B(t+n,d.CHAR_CLASS)}]`,"g")))if(r+=o===t?1:-1,r<0)return n;return r>0?t:""}function ie(e,t,n){let r=e.replace(/\\./gsu,"");if(r.endsWith("\\"))return"\\";if(t===f.DEFAULT)return ne(r,"(",")");if(t===f.CHAR_CLASS&&!(n===m.ENCLOSED_TOKEN||n===m.Q_TOKEN))return ne(r,"[","]");if(t===f.ENCLOSED_TOKEN||t===f.INTERVAL_QUANTIFIER||n===m.ENCLOSED_TOKEN||n===m.Q_TOKEN){if(r.includes("}"))return"}"}else if(t===f.GROUP_NAME&&r.includes(">"))return">";return""}var re=new RegExp(String.raw` | ||
var Regex=(()=>{var H=Object.defineProperty;var Se=Object.getOwnPropertyDescriptor;var Te=Object.getOwnPropertyNames;var $e=Object.prototype.hasOwnProperty;var Ie=(e,t)=>{for(var n in t)H(e,n,{get:t[n],enumerable:!0})},Ce=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Te(t))!$e.call(e,o)&&o!==n&&H(e,o,{get:()=>t[o],enumerable:!(r=Se(t,o))||r.enumerable});return e};var Le=e=>Ce(H({},"__esModule",{value:!0}),e);var qe={};Ie(qe,{pattern:()=>Q,regex:()=>ve});var g=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function A(e,t,n,r){let o=new RegExp(`${t}|(?<skip>\\\\?.)`,"gsu"),u=0,s="";for(let i of e.matchAll(o)){let{0:l,groups:{skip:c}}=i;if(!c&&(!r||r===g.DEFAULT==!u)){n instanceof Function?s+=n(i):s+=n;continue}l==="["?u++:l==="]"&&u&&u--,s+=l}return s}function x(e,t,n,r){A(e,t,n,r)}function v(e,t,n=0,r){if(!new RegExp(t,"su").test(e))return null;let o=new RegExp(`${t}|(?<skip>\\\\?.)`,"gsu");o.lastIndex=n;let u=0,s;for(;s=o.exec(e);){let{0:i,groups:{skip:l}}=s;if(!l&&(!r||r===g.DEFAULT==!u))return s;i==="["?u++:i==="]"&&u&&u--,o.lastIndex==s.index&&o.lastIndex++}return null}function V(e,t,n){return!!v(e,t,0,n)}function W(e,t){let n=/\\?./gsu;n.lastIndex=t;let r=e.length,o=0,u=1,s;for(;s=n.exec(e);){let[i]=s;if(i==="[")o++;else if(o)i==="]"&&o--;else if(i==="(")u++;else if(i===")"&&(u--,!u)){r=s.index;break}}return e.slice(t,r)}var I=class{#e;constructor(t){this.#e=t}toString(){return String(this.#e)}};function Q(e,...t){if(Array.isArray(e?.raw))return new I(e.raw.flatMap((n,r)=>r<e.raw.length-1?[n,t[r]]:n).join(""));if(!t.length)return new I(e??"");throw new Error(`Unexpected arguments: ${JSON.stringify([e,...t])}`)}var f={DEFAULT:"R_DEFAULT",CHAR_CLASS:"R_CHAR_CLASS",GROUP_NAME:"R_GROUP_NAME",ENCLOSED_TOKEN:"R_ENCLOSED_TOKEN",INTERVAL_QUANTIFIER:"R_INTERVAL_QUANTIFIER",INVALID_INCOMPLETE_TOKEN:"R_INVALID_INCOMPLETE_TOKEN"},d={DEFAULT:"CC_DEFAULT",RANGE:"CC_RANGE",ENCLOSED_TOKEN:"CC_ENCLOSED_TOKEN",Q_TOKEN:"CC_Q_TOKEN",INVALID_INCOMPLETE_TOKEN:"CC_INVALID_INCOMPLETE_TOKEN"},G=(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),se=(()=>{try{new RegExp("","v")}catch{return!1}return!0})(),R="&!#$%*+,.:;<=>?@^`~",C="$E$",j=String.raw`\(\?<(?![=!])(?<captureName>[^>]+)>`,D=String.raw`\((?!\?)(?!(?<=\(\?\()DEFINE\))|${j}`,b=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function B(e,t){return t===g.CHAR_CLASS?e.replace(new RegExp(String.raw`[()\[\]{}|\\/\-${R}]`,"g"),"\\$&"):e.replace(/[()\[\]{}|\\^$*+?.]/g,"\\$&")}function q(e){return e.replace(new RegExp(`^([${R}])(?!\\1)`),(t,n,r)=>`\\${t}${r+1===e.length?"":t}`)}function ie(e){return e.replace(/^\^/,"\\^^")}function M(e,t){return A(e,String.raw`\\0(?!\d)`,"\\u{0}",t)}function re(e,t,n){let r=0;for(let[o]of e.matchAll(new RegExp(`[${B(t+n,g.CHAR_CLASS)}]`,"g")))if(r+=o===t?1:-1,r<0)return n;return r>0?t:""}function ue(e,t,n){let r=e.replace(/\\./gsu,"");if(r.endsWith("\\"))return"\\";if(t===f.DEFAULT)return re(r,"(",")");if(t===f.CHAR_CLASS&&!(n===d.ENCLOSED_TOKEN||n===d.Q_TOKEN))return re(r,"[","]");if(t===f.ENCLOSED_TOKEN||t===f.INTERVAL_QUANTIFIER||n===d.ENCLOSED_TOKEN||n===d.Q_TOKEN){if(r.includes("}"))return"}"}else if(t===f.GROUP_NAME&&r.includes(">"))return">";return""}var oe=new RegExp(String.raw` | ||
(?<groupN>\(\?<(?![=!])|\\[gk]<) | ||
@@ -14,3 +14,3 @@ | (?<enclosedT>\\[pPu]\{) | ||
| \\?. | ||
`.replace(/\s+/g,""),"gsu");function F(e,{regexContext:t=f.DEFAULT,charClassContext:n=m.DEFAULT,charClassDepth:r=0,lastPos:o=0}={}){re.lastIndex=o;let u;for(;u=re.exec(e);){let{0:s,groups:{groupN:i,enclosedT:l,qT:c,intervalQ:p,incompleteT:a}}=u;s==="["?(r++,t=f.CHAR_CLASS,n=m.DEFAULT):s==="]"&&t===f.CHAR_CLASS?(r&&r--,r||(t=f.DEFAULT),n=m.DEFAULT):t===f.CHAR_CLASS?a?n=m.INVALID_INCOMPLETE_TOKEN:s==="-"?n=m.RANGE:l?n=m.ENCLOSED_TOKEN:c?n=m.Q_TOKEN:(s==="}"&&(n===m.ENCLOSED_TOKEN||n===m.Q_TOKEN)||n===m.INVALID_INCOMPLETE_TOKEN||n===m.RANGE)&&(n=m.DEFAULT):a?t=f.INVALID_INCOMPLETE_TOKEN:i?t=f.GROUP_NAME:l?t=f.ENCLOSED_TOKEN:p?t=f.INTERVAL_QUANTIFIER:(s===">"&&t===f.GROUP_NAME||s==="}"&&(t===f.ENCLOSED_TOKEN||t===f.INTERVAL_QUANTIFIER)||t===f.INVALID_INCOMPLETE_TOKEN)&&(t=f.DEFAULT)}return{regexContext:t,charClassContext:n,charClassDepth:r,lastPos:e.length}}function k(e){let t=0;return G(e,b,()=>t++,d.DEFAULT),t}function ue(e,t){return N(e,String.raw`\\(?<num>[1-9]\d*)`,({groups:{num:n}})=>`\\${+n+t}`,d.DEFAULT)}var _e=["Basic_Emoji","Emoji_Keycap_Sequence","RGI_Emoji_Modifier_Sequence","RGI_Emoji_Flag_Sequence","RGI_Emoji_Tag_Sequence","RGI_Emoji_ZWJ_Sequence","RGI_Emoji"].join("|"),De=new RegExp(String.raw` | ||
`.replace(/\s+/g,""),"gsu");function U(e,{regexContext:t=f.DEFAULT,charClassContext:n=d.DEFAULT,charClassDepth:r=0,lastPos:o=0}={}){oe.lastIndex=o;let u;for(;u=oe.exec(e);){let{0:s,groups:{groupN:i,enclosedT:l,qT:c,intervalQ:p,incompleteT:a}}=u;s==="["?(r++,t=f.CHAR_CLASS,n=d.DEFAULT):s==="]"&&t===f.CHAR_CLASS?(r&&r--,r||(t=f.DEFAULT),n=d.DEFAULT):t===f.CHAR_CLASS?a?n=d.INVALID_INCOMPLETE_TOKEN:s==="-"?n=d.RANGE:l?n=d.ENCLOSED_TOKEN:c?n=d.Q_TOKEN:(s==="}"&&(n===d.ENCLOSED_TOKEN||n===d.Q_TOKEN)||n===d.INVALID_INCOMPLETE_TOKEN||n===d.RANGE)&&(n=d.DEFAULT):a?t=f.INVALID_INCOMPLETE_TOKEN:i?t=f.GROUP_NAME:l?t=f.ENCLOSED_TOKEN:p?t=f.INTERVAL_QUANTIFIER:(s===">"&&t===f.GROUP_NAME||s==="}"&&(t===f.ENCLOSED_TOKEN||t===f.INTERVAL_QUANTIFIER)||t===f.INVALID_INCOMPLETE_TOKEN)&&(t=f.DEFAULT)}return{regexContext:t,charClassContext:n,charClassDepth:r,lastPos:e.length}}function F(e){let t=0;return x(e,D,()=>t++,g.DEFAULT),t}function ae(e,t){return A(e,String.raw`\\(?<num>[1-9]\d*)`,({groups:{num:n}})=>`\\${+n+t}`,g.DEFAULT)}var _e=["Basic_Emoji","Emoji_Keycap_Sequence","RGI_Emoji_Modifier_Sequence","RGI_Emoji_Flag_Sequence","RGI_Emoji_Tag_Sequence","RGI_Emoji_ZWJ_Sequence","RGI_Emoji"].join("|"),Oe=new RegExp(String.raw` | ||
\\(?: c[A-Za-z] | ||
@@ -27,8 +27,8 @@ | p\{(?<pStrProp>${_e})\} | ||
| . | ||
`.replace(/\s+/g,""),"gsu");function z(e){let t=!1,n;for(let{0:r,groups:o}of e.matchAll(De)){if(o.pStrProp||o.qStrProp||r==="["&&t)return!0;if(["-","--","&&"].includes(r))t=!1;else if(r!=="["&&r!=="]"){if(t||n==="]")return!0;t=!0}n=r}return!1}function Z(e,t,n){let r={raw:[]},o=[],u;return e.raw.forEach((s,i)=>{let l=n(s,{...u,lastPos:0});if(r.raw.push(l.transformed),u=l.runningContext,i<e.raw.length-1){let c=t[i];if(c instanceof L){let p=n(c,{...u,lastPos:0});o.push(Q(p.transformed)),u=p.runningContext}else o.push(c)}}),{template:r,substitutions:o}}var Oe=new RegExp(String.raw` | ||
${U} | ||
`.replace(/\s+/g,""),"gsu");function z(e){let t=!1,n;for(let{0:r,groups:o}of e.matchAll(Oe)){if(o.pStrProp||o.qStrProp||r==="["&&t)return!0;if(["-","--","&&"].includes(r))t=!1;else if(r!=="["&&r!=="]"){if(t||n==="]")return!0;t=!0}n=r}return!1}function Z(e,t,n){let r={raw:[]},o=[],u;return e.raw.forEach((s,i)=>{let l=n(s,{...u,lastPos:0});if(r.raw.push(l.transformed),u=l.runningContext,i<e.raw.length-1){let c=t[i];if(c instanceof I){let p=n(c,{...u,lastPos:0});o.push(Q(p.transformed)),u=p.runningContext}else o.push(c)}}),{template:r,substitutions:o}}var Re=new RegExp(String.raw` | ||
${b} | ||
| \(\?< | ||
| (?<backrefNum>\\[1-9]\d*) | ||
| \\?. | ||
`.replace(/\s+/g,""),"gsu");function ae(e,t){e=String(e);let n="",r="";for(let{0:o,groups:{backrefNum:u}}of e.matchAll(Oe)){n+=o,t=F(n,t);let{regexContext:s}=t;if(s===f.DEFAULT)if(o==="(")r+="(?:";else{if(u)throw new Error(`Invalid decimal escape "${o}" with implicit flag n; replace with named backreference`);r+=o}else r+=o}return{transformed:r,runningContext:t}}var le=/^\s$/,Re=/^\\[\s#]$/,ce=/^[ \t]$/,be=/^\\[ \t]$/,Ue=new RegExp(String.raw` | ||
`.replace(/\s+/g,""),"gsu");function le(e,t){e=String(e);let n="",r="";for(let{0:o,groups:{backrefNum:u}}of e.matchAll(Re)){n+=o,t=U(n,t);let{regexContext:s}=t;if(s===f.DEFAULT)if(o==="(")r+="(?:";else{if(u)throw new Error(`Invalid decimal escape "${o}" with implicit flag n; replace with named backreference`);r+=o}else r+=o}return{transformed:r,runningContext:t}}var ce=/^\s$/,De=/^\\[\s#]$/,J=/^[ \t]$/,be=/^\\[ \t]$/,Ue=new RegExp(String.raw` | ||
\\(?: [gk]< | ||
@@ -42,3 +42,3 @@ | [pPu]\{ | ||
| \[\^ | ||
| ${U} | ||
| ${b} | ||
| \(\?< | ||
@@ -48,4 +48,4 @@ | (?<dp>[${R}])\k<dp> | ||
| \\?. | ||
`.replace(/\s+/g,""),"gsu");function fe(e,t){e=String(e);let n=!1,r=!1,o=!1,u="",s="",i="",l="",c=!1,p=(a,{prefix:g=!0,postfix:E=!1}={})=>(a=(c&&g?"(?:)":"")+a+(E?"(?:)":""),c=!1,a);for(let[a]of e.matchAll(Ue)){if(o){a===` | ||
`&&(o=!1,c=!0);continue}if(n){if(le.test(a))continue;n=!1,c=!0}else if(r){if(ce.test(a))continue;r=!1}u+=a,t=F(u,t);let{regexContext:g,charClassContext:E}=t;if(a==="-"&&g===f.CHAR_CLASS&&l===m.RANGE)throw new Error("Invalid unescaped hyphen as the end value for a range");if(g===f.DEFAULT&&/^(?:[?*+]|\?\?)$/.test(a)||g===f.INTERVAL_QUANTIFIER&&a==="{")s+=p(a,{prefix:!1,postfix:i==="("&&a==="?"});else if(g===f.DEFAULT)le.test(a)?n=!0:a.startsWith("#")?o=!0:Re.test(a)?s+=p(a[1],{prefix:!1}):s+=p(a);else if(g===f.CHAR_CLASS&&a!=="["&&a!=="[^")if(ce.test(a)&&(E===m.DEFAULT||E===m.RANGE||E===m.Q_TOKEN))r=!0;else{if(E===m.INVALID_INCOMPLETE_TOKEN)throw new Error(`Invalid incomplete token in character class: "${a}"`);be.test(a)&&(E===m.DEFAULT||E===m.Q_TOKEN)?s+=p(a[1],{prefix:!1}):E===m.DEFAULT?s+=p(q(K(a))):s+=p(a)}else s+=p(a);n||r||o||(i=a,l=E)}return{transformed:s,runningContext:t}}function pe(e){let t=String.raw`\(\?:\)`;e=N(e,`(?:${t}){2,}`,"(?:)",d.DEFAULT);let n=I.replace(/\$/g,"\\$");return e=N(e,String.raw`(?:${t}(?=[)|.[$\\]|\((?!DEFINE)|$)|(?<=[()|.\]^>]|\\[bBdDfnrsStvwW]|\(\?(?:[:=!]|<[=!])|^)${t}(?![?*+{]))(?!${n})`,"",d.DEFAULT),e}var Ee=new RegExp(String.raw`(?<noncapturingStart>${U})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function de(e,t){if(!_(e,"\\(\\?>",d.DEFAULT))return e;let n="(?>",r=`(?:(?=(${t.useEmulationGroups?I:""}`,o=[0],u=0,s=0,i=NaN,l;do{l=!1;let c=0,p=0,a=!1,g;for(Ee.lastIndex=Number.isNaN(i)?0:i+r.length;g=Ee.exec(e);){let{0:E,index:A,groups:{capturingStart:h,noncapturingStart:S}}=g;if(E==="[")c++;else if(c)E==="]"&&c--;else if(E===n&&!a)i=A,a=!0;else if(a&&S)p++;else if(h)a?p++:(u++,o.push(u+s));else if(E===")"&&a){if(!p){s++,e=`${e.slice(0,i)}${r}${e.slice(i+n.length,A)}))<$$${s+u}>)${e.slice(A+1)}`,l=!0;break}p--}}}while(l);return e=N(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:c,groups:{backrefNum:p,wrappedBackrefNum:a}})=>{if(p){let g=+p;if(g>o.length-1)throw new Error(`Backref "${c}" greater than number of captures`);return`\\${o[g]}`}return`\\${a}`},d.DEFAULT),e}var ge=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Fe=new RegExp(String.raw` | ||
`.replace(/\s+/g,""),"gsu");function fe(e,t){e=String(e);let n=!1,r=!1,o=!1,u="",s="",i="",l="",c=!1,p=(a,{prefix:m=!0,postfix:E=!1}={})=>(a=(c&&m?"(?:)":"")+a+(E?"(?:)":""),c=!1,a);for(let{0:a,index:m}of e.matchAll(Ue)){if(o){a===` | ||
`&&(o=!1,c=!0);continue}if(n){if(ce.test(a))continue;n=!1,c=!0}else if(r){if(J.test(a))continue;r=!1}u+=a,t=U(u,t);let{regexContext:E,charClassContext:h}=t;if(a==="-"&&E===f.CHAR_CLASS&&l===d.RANGE)throw new Error("Invalid unescaped hyphen as the end value for a range");if(E===f.DEFAULT&&/^(?:[?*+]|\?\?)$/.test(a)||E===f.INTERVAL_QUANTIFIER&&a==="{")s+=p(a,{prefix:!1,postfix:i==="("&&a==="?"});else if(E===f.DEFAULT)ce.test(a)?n=!0:a.startsWith("#")?o=!0:De.test(a)?s+=p(a[1],{prefix:!1}):s+=p(a);else if(E===f.CHAR_CLASS&&a!=="["&&a!=="[^")if(J.test(a)&&(h===d.DEFAULT||h===d.RANGE||h===d.Q_TOKEN))r=!0;else{if(h===d.INVALID_INCOMPLETE_TOKEN)throw new Error(`Invalid incomplete token in character class: "${a}"`);if(be.test(a)&&(h===d.DEFAULT||h===d.Q_TOKEN))s+=p(a[1],{prefix:!1});else if(h===d.DEFAULT){let N=e[m+1]??"",w=M(a);(J.test(N)||a==="^")&&(w=q(w)),s+=p(w)}else s+=p(a)}else s+=p(a);n||r||o||(i=a,l=h)}return{transformed:s,runningContext:t}}function pe(e){let t=String.raw`\(\?:\)`;e=A(e,`(?:${t}){2,}`,"(?:)",g.DEFAULT);let n=C.replace(/\$/g,"\\$");return e=A(e,String.raw`(?:${t}(?=[)|.[$\\]|\((?!DEFINE)|$)|(?<=[()|.\]^>]|\\[bBdDfnrsStvwW]|\(\?(?:[:=!]|<[=!])|^)${t}(?![?*+{]))(?!${n})`,"",g.DEFAULT),e}var Ee=new RegExp(String.raw`(?<noncapturingStart>${b})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,"gsu");function de(e,t){if(!/\(\?>/.test(e))return e;let n="(?>",r=`(?:(?=(${t.useEmulationGroups?C:""}`,o=[0],u=0,s=0,i=NaN,l;do{l=!1;let c=0,p=0,a=!1,m;for(Ee.lastIndex=Number.isNaN(i)?0:i+r.length;m=Ee.exec(e);){let{0:E,index:h,groups:{capturingStart:N,noncapturingStart:w}}=m;if(E==="[")c++;else if(c)E==="]"&&c--;else if(E===n&&!a)i=h,a=!0;else if(a&&w)p++;else if(N)a?p++:(u++,o.push(u+s));else if(E===")"&&a){if(!p){s++,e=`${e.slice(0,i)}${r}${e.slice(i+n.length,h)}))<$$${s+u}>)${e.slice(h+1)}`,l=!0;break}p--}}}while(l);return e=A(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:c,groups:{backrefNum:p,wrappedBackrefNum:a}})=>{if(p){let m=+p;if(m>o.length-1)throw new Error(`Backref "${c}" greater than number of captures`);return`\\${o[m]}`}return`\\${a}`},g.DEFAULT),e}var ge=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Fe=new RegExp(String.raw` | ||
\\(?: \d+ | ||
@@ -65,9 +65,9 @@ | c[A-Za-z] | ||
| \\?. | ||
`.replace(/\s+/g,""),"gsu");function me(e){if(!_(e,`${ge}+`,d.DEFAULT))return e;let t=[],n=null,r=null,o="",u=0,s="";for(let{0:i,index:l,groups:{q:c,qMod:p,invalidQ:a}}of e.matchAll(Fe)){if(i==="[")u||(r=l),u++;else if(i==="]")u?u--:r=null;else if(p==="+"&&o&&!o.startsWith("(")){if(a)throw new Error(`Invalid quantifier "${i}"`);if(/^\{\d+\}$/.test(c))s+=c;else if(o===")"||o==="]"){let g=o===")"?n:r;if(g===null)throw new Error(`Invalid unmatched "${o}"`);let E=e.slice(g,l);s=`${e.slice(0,g)}(?>${E}${c})`}else s=`${e.slice(0,s.length-o.length)}(?>${o}${c})`;continue}else i[0]==="("?t.push(l):i===")"&&(n=t.length?t.pop():null);o=i,s+=i}return s}function Ne(e,t){let n=Ae(e,{includeContents:!0}),r=Pe(e,n,t.useEmulationGroups);return xe(r,n)}var ke=String.raw`\\g<(?<subroutineName>[^>&]+)>`,y=new RegExp(String.raw` | ||
`.replace(/\s+/g,""),"gsu");function me(e){if(!new RegExp(`${ge}\\+`).test(e))return e;let t=[],n=null,r=null,o="",u=0,s="";for(let{0:i,index:l,groups:{q:c,qMod:p,invalidQ:a}}of e.matchAll(Fe)){if(i==="[")u||(r=l),u++;else if(i==="]")u?u--:r=null;else if(p==="+"&&o&&!o.startsWith("(")){if(a)throw new Error(`Invalid quantifier "${i}"`);if(/^\{\d+\}$/.test(c))s+=c;else if(o===")"||o==="]"){let m=o===")"?n:r;if(m===null)throw new Error(`Invalid unmatched "${o}"`);let E=e.slice(m,l);s=`${e.slice(0,m)}(?>${E}${c})`}else s=`${e.slice(0,s.length-o.length)}(?>${o}${c})`;continue}else i[0]==="("?t.push(l):i===")"&&(n=t.length?t.pop():null);o=i,s+=i}return s}function Ne(e,t){let n=Ae(e,{includeContents:!0}),r=Pe(e,n,t.useEmulationGroups);return xe(r,n)}var ke=String.raw`\\g<(?<subroutineName>[^>&]+)>`,K=new RegExp(String.raw` | ||
${ke} | ||
| (?<capturingStart>${b}) | ||
| (?<capturingStart>${D}) | ||
| \\(?<backrefNum>[1-9]\d*) | ||
| \\k<(?<backrefName>[^>]+)> | ||
| \\?. | ||
`.replace(/\s+/g,""),"gsu");function Pe(e,t,n){if(!_(e,"\\\\g<",d.DEFAULT))return e;let r=_(e,"\\\\(?:[1-9]|k<[^>]+>)",d.DEFAULT),o=r?`(${n?I:""}`:"(?:",u=new Map,s=[],i=[0],l=0,c=0,p=0,a=0,g=0,E=e,A;for(y.lastIndex=0;A=y.exec(E);){let{0:h,index:S,groups:{subroutineName:$,capturingStart:P,backrefNum:T,backrefName:v}}=A;if(h==="[")g++;else if(g)h==="]"&&g--;else if($){if(!t.has($))throw new Error(`Invalid named capture referenced by subroutine ${h}`);if(u.has($))throw new Error(`Subroutine ${h} followed a recursive reference`);let w=t.get($).contents,D=`${o}${w})`;r&&(p=0,c++),u.set($,{unclosedGroupCount:Ge(D)}),s.push($),E=Y(E,S,h,D),y.lastIndex-=h.length-o.length}else if(P)u.size?(r&&(p++,c++),h!=="("&&(E=Y(E,S,h,o),y.lastIndex-=h.length-o.length)):r&&(i.push(X(i)+1+c-a),a=c,l++);else if((T||v)&&u.size){let w=T?+T:t.get(v)?.groupNum,D=!1;for(let C of s){let O=t.get(C);if(w>=O.groupNum&&w<=O.groupNum+O.numCaptures){D=!0;break}}if(D){let C=t.get(X(s)),O=l+c-p,x=`\\k<$$b${w}s${O}r${C.groupNum}c${C.numCaptures}>`;E=Y(E,S,h,x),y.lastIndex+=x.length-h.length}}else if(h===")"&&u.size){let w=u.get(X(s));w.unclosedGroupCount--,w.unclosedGroupCount||u.delete(s.pop())}}return r&&(E=N(E,String.raw`\\(?:(?<bNum>[1-9]\d*)|k<\$\$b(?<bNumSub>\d+)s(?<subNum>\d+)r(?<refNum>\d+)c(?<refCaps>\d+)>)`,({0:h,groups:{bNum:S,bNumSub:$,subNum:P,refNum:T,refCaps:v}})=>{if(S){let x=+S;if(x>i.length-1)throw new Error(`Backref "${h}" greater than number of captures`);return`\\${i[x]}`}let w=+$,D=+P,C=+T,O=+v;return w<C||w>C+O?`\\${i[w]}`:`\\${D-C+w}`},d.DEFAULT)),E}var J=new RegExp(String.raw`${j}|\(\?:\)|(?<invalid>\\?.)`,"gsu");function xe(e,t){let n=V(e,String.raw`\(\?\(DEFINE\)`,0,d.DEFAULT);if(!n)return e;let r=he(e,n);if(r.afterPos<e.length)throw new Error("DEFINE group allowed only at the end of a regex");if(r.afterPos>e.length)throw new Error("DEFINE group is unclosed");let o;for(J.lastIndex=0;o=J.exec(r.contents);){let{captureName:u,invalid:s}=o.groups;if(u){let i=he(r.contents,o),l;if(!t.get(u).isUnique)l=u;else{let c=Ae(i.contents);for(let p of c.keys())if(!t.get(p).isUnique){l=p;break}}if(l)throw new Error(`Duplicate group name "${l}" within DEFINE`);J.lastIndex=i.afterPos}else if(s)throw new Error("DEFINE group includes unsupported syntax at top level")}return e.slice(0,n.index)}function Ge(e){let t=0;return G(e,"\\(",()=>t++,d.DEFAULT),t}function Me(e,t){let n=0,r=0,o;for(;o=V(e,b,r,d.DEFAULT);){let{0:u,index:s,groups:{captureName:i}}=o;if(n++,i===t)break;r=s+u.length}return n}function he(e,t){let n=t.index+t[0].length,r=W(e,n),o=n+r.length+1;return{contents:r,afterPos:o}}function Ae(e,{includeContents:t}={}){let n=new Map;return G(e,j,({0:r,index:o,groups:{captureName:u}})=>{if(n.has(u))n.get(u).isUnique=!1;else{let s={isUnique:!0};if(t){let i=W(e,o+r.length);Object.assign(s,{contents:i,groupNum:Me(e,u),numCaptures:k(i)})}n.set(u,s)}},d.DEFAULT),n}function X(e){return e[e.length-1]}function Y(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var Ke="&!#%,:;<=>@`~",ye=new RegExp(String.raw` | ||
`.replace(/\s+/g,""),"gsu");function Pe(e,t,n){if(!/\\g</.test(e))return e;let r=V(e,"\\\\(?:[1-9]|k<[^>]+>)",g.DEFAULT),o=r?`(${n?C:""}`:"(?:",u=new Map,s=[],i=[0],l=0,c=0,p=0,a=0,m=0,E=e,h;for(K.lastIndex=0;h=K.exec(E);){let{0:N,index:w,groups:{subroutineName:$,capturingStart:k,backrefNum:T,backrefName:y}}=h;if(N==="[")m++;else if(m)N==="]"&&m--;else if($){if(!t.has($))throw new Error(`Invalid named capture referenced by subroutine ${N}`);if(u.has($))throw new Error(`Subroutine ${N} followed a recursive reference`);let S=t.get($).contents,_=`${o}${S})`;r&&(p=0,c++),u.set($,{unclosedGroupCount:Ge(_)}),s.push($),E=ee(E,w,N,_),K.lastIndex-=N.length-o.length}else if(k)u.size?(r&&(p++,c++),N!=="("&&(E=ee(E,w,N,o),K.lastIndex-=N.length-o.length)):r&&(i.push(Y(i)+1+c-a),a=c,l++);else if((T||y)&&u.size){let S=T?+T:t.get(y)?.groupNum,_=!1;for(let L of s){let O=t.get(L);if(S>=O.groupNum&&S<=O.groupNum+O.numCaptures){_=!0;break}}if(_){let L=t.get(Y(s)),O=l+c-p,P=`\\k<$$b${S}s${O}r${L.groupNum}c${L.numCaptures}>`;E=ee(E,w,N,P),K.lastIndex+=P.length-N.length}}else if(N===")"&&u.size){let S=u.get(Y(s));S.unclosedGroupCount--,S.unclosedGroupCount||u.delete(s.pop())}}return r&&(E=A(E,String.raw`\\(?:(?<bNum>[1-9]\d*)|k<\$\$b(?<bNumSub>\d+)s(?<subNum>\d+)r(?<refNum>\d+)c(?<refCaps>\d+)>)`,({0:N,groups:{bNum:w,bNumSub:$,subNum:k,refNum:T,refCaps:y}})=>{if(w){let P=+w;if(P>i.length-1)throw new Error(`Backref "${N}" greater than number of captures`);return`\\${i[P]}`}let S=+$,_=+k,L=+T,O=+y;return S<L||S>L+O?`\\${i[S]}`:`\\${_-L+S}`},g.DEFAULT)),E}var X=new RegExp(String.raw`${j}|\(\?:\)|(?<invalid>\\?.)`,"gsu");function xe(e,t){let n=v(e,String.raw`\(\?\(DEFINE\)`,0,g.DEFAULT);if(!n)return e;let r=he(e,n);if(r.afterPos<e.length)throw new Error("DEFINE group allowed only at the end of a regex");if(r.afterPos>e.length)throw new Error("DEFINE group is unclosed");let o;for(X.lastIndex=0;o=X.exec(r.contents);){let{captureName:u,invalid:s}=o.groups;if(u){let i=he(r.contents,o),l;if(!t.get(u).isUnique)l=u;else{let c=Ae(i.contents);for(let p of c.keys())if(!t.get(p).isUnique){l=p;break}}if(l)throw new Error(`Duplicate group name "${l}" within DEFINE`);X.lastIndex=i.afterPos}else if(s)throw new Error("DEFINE group includes unsupported syntax at top level")}return e.slice(0,n.index)}function Ge(e){let t=0;return x(e,"\\(",()=>t++,g.DEFAULT),t}function Me(e,t){let n=0,r=0,o;for(;o=v(e,D,r,g.DEFAULT);){let{0:u,index:s,groups:{captureName:i}}=o;if(n++,i===t)break;r=s+u.length}return n}function he(e,t){let n=t.index+t[0].length,r=W(e,n),o=n+r.length+1;return{contents:r,afterPos:o}}function Ae(e,{includeContents:t}={}){let n=new Map;return x(e,j,({0:r,index:o,groups:{captureName:u}})=>{if(n.has(u))n.get(u).isUnique=!1;else{let s={isUnique:!0};if(t){let i=W(e,o+r.length);Object.assign(s,{contents:i,groupNum:Me(e,u),numCaptures:F(i)})}n.set(u,s)}},g.DEFAULT),n}function Y(e){return e[e.length-1]}function ee(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var Ke="&!#%,:;<=>@`~",ye=new RegExp(String.raw` | ||
\[\^?-? | ||
@@ -80,3 +80,3 @@ | --?\] | ||
| \\?. | ||
`.replace(/\s+/g,""),"gsu");function we(e){let t='Invalid unescaped "-" in character class',n=!1,r="";for(let{0:o,groups:{dp:u,vOnlyEscape:s}}of e.matchAll(ye)){if(o[0]==="["){if(n)throw new Error("Invalid nested character class when flag v not supported; possibly from interpolation");if(o.endsWith("-"))throw new Error(t);n=!0}else if(o.endsWith("]")){if(o[0]==="-")throw new Error(t);n=!1}else if(n){if(o==="&&"||o==="--")throw new Error(`Invalid set operator "${o}" when flag v not supported`);if(u)throw new Error(`Invalid double punctuator "${o}", reserved by flag v`);if("(){}/|".includes(o))throw new Error(`Invalid unescaped "${o}" in character class`);if(s){r+=s;continue}}r+=o}return r}var ve=(e,...t)=>{if(Array.isArray(e?.raw))return ee({},e,...t);if((typeof e=="string"||e===void 0)&&!t.length)return ee.bind(null,{flags:e});if({}.toString.call(e)==="[object Object]"&&!t.length)return ee.bind(null,e);throw new Error(`Unexpected arguments: ${JSON.stringify([e,...t])}`)},ee=(e,t,...n)=>{let{flags:r="",subclass:o=!1,plugins:u=[],unicodeSetsPlugin:s=we,disable:i={},force:l={}}=e;if(/[vu]/.test(r))throw new Error("Flags v/u cannot be explicitly added");let c=l.v||(i.v?!1:oe),p=(c?"v":"u")+r;i.x||({template:t,substitutions:n}=Z(t,n,fe)),i.n||({template:t,substitutions:n}=Z(t,n,ae));let a=0,g="",E;if(t.raw.forEach((A,h)=>{let S=!!(t.raw[h]||t.raw[h+1]);a+=k(A),g+=K(A,d.CHAR_CLASS),E=F(g,E);let{regexContext:$,charClassContext:P}=E;if(h<t.raw.length-1){let T=n[h];g+=Ve(T,r,$,P,S,a),T instanceof RegExp?a+=k(T.source):T instanceof L&&(a+=k(String(T)))}}),[...u,...i.subroutines?[]:[Ne],...i.atomic?[]:[me,de],...i.x?[]:[pe],...c||!s?[]:[s]].forEach(A=>g=A(g,{flags:p,useEmulationGroups:o})),o){let A=je(g);return new te(A.expression,p,{captureMap:A.captureMap})}return new RegExp(g,p)},te=class e extends RegExp{#e;constructor(t,n,r){super(t,n),r?this.#e=r.captureMap:t instanceof e&&(this.#e=t.#e)}exec(t){let n=RegExp.prototype.exec.call(this,t);if(!n||!this.#e)return n;let r=[...n];n.length=1;for(let o=1;o<r.length;o++)this.#e[o]&&n.push(r[o]);return n}};function Ve(e,t,n,r,o,u){if(e instanceof RegExp&&n!==f.DEFAULT)throw new Error("Cannot interpolate a RegExp at this position because the syntax context does not match");if(n===f.INVALID_INCOMPLETE_TOKEN||r===m.INVALID_INCOMPLETE_TOKEN)throw new Error("Interpolation preceded by invalid incomplete token");let s=e instanceof L,i="";if(!(e instanceof RegExp)){e=String(e),s||(i=B(e,n===f.CHAR_CLASS?d.CHAR_CLASS:d.DEFAULT));let l=ie(i||e,n,r);if(l)throw new Error(`Unescaped stray "${l}" in the interpolated value would have side effects outside it`)}if(n===f.ENCLOSED_TOKEN||n===f.INTERVAL_QUANTIFIER||n===f.GROUP_NAME||r===m.ENCLOSED_TOKEN||r===m.Q_TOKEN)return s?String(e):i;if(n===f.CHAR_CLASS){if(s){if(_(String(e),"^-|^&&|-$|&&$"))throw new Error("Cannot use range or set operator at boundary of interpolated pattern; move the operation into the pattern or the operator outside of it");let l=se(q(e));return z(e)?`[${l}]`:K(l)}return z(i)?`[${i}]`:i}if(e instanceof RegExp){let l=Qe(e,t),c=ue(l.value,u);return l.usedModifier?c:`(?:${c})`}return s?`(?:${e})`:o?`(?:${i})`:i}function Qe(e,t){let n={i:null,m:null,s:null},r="\\n\\r\\u2028\\u2029",o=e.source;if(e.ignoreCase!==t.includes("i"))if(M)n.i=e.ignoreCase;else throw new Error("Pattern modifiers not supported, so the value of flag i on the interpolated RegExp must match the outer regex");if(e.dotAll!==t.includes("s")&&(M?n.s=e.dotAll:o=N(o,"\\.",e.dotAll?"[^]":`[^${r}]`,d.DEFAULT)),e.multiline!==t.includes("m")&&(M?n.m=e.multiline:(o=N(o,"\\^",e.multiline?`(?<=^|[${r}])`:"(?<![^])",d.DEFAULT),o=N(o,"\\$",e.multiline?`(?=$|[${r}])`:"(?![^])",d.DEFAULT))),M){let u=Object.keys(n),s=u.filter(l=>n[l]===!0).join(""),i=u.filter(l=>n[l]===!1).join("");if(i&&(s+=`-${i}`),s)return{value:`(?${s}:${o})`,usedModifier:!0}}return{value:o}}function je(e){let t=I.replace(/\$/g,"\\$"),n=[!0];return e=N(e,`(?:${b})(?<mark>${t})?`,({0:r,groups:{mark:o}})=>o?(n.push(!1),r.slice(0,-I.length)):(n.push(!0),r),d.DEFAULT),{captureMap:n,expression:e}}return Ce(qe);})(); | ||
`.replace(/\s+/g,""),"gsu");function we(e){let t='Invalid unescaped "-" in character class',n=!1,r="";for(let{0:o,groups:{dp:u,vOnlyEscape:s}}of e.matchAll(ye)){if(o[0]==="["){if(n)throw new Error("Invalid nested character class when flag v not supported; possibly from interpolation");if(o.endsWith("-"))throw new Error(t);n=!0}else if(o.endsWith("]")){if(o[0]==="-")throw new Error(t);n=!1}else if(n){if(o==="&&"||o==="--")throw new Error(`Invalid set operator "${o}" when flag v not supported`);if(u)throw new Error(`Invalid double punctuator "${o}", reserved by flag v`);if("(){}/|".includes(o))throw new Error(`Invalid unescaped "${o}" in character class`);if(s){r+=s;continue}}r+=o}return r}var ve=(e,...t)=>{if(Array.isArray(e?.raw))return te({},e,...t);if((typeof e=="string"||e===void 0)&&!t.length)return te.bind(null,{flags:e});if({}.toString.call(e)==="[object Object]"&&!t.length)return te.bind(null,e);throw new Error(`Unexpected arguments: ${JSON.stringify([e,...t])}`)},te=(e,t,...n)=>{let{flags:r="",subclass:o=!1,plugins:u=[],unicodeSetsPlugin:s=we,disable:i={},force:l={}}=e;if(/[vu]/.test(r))throw new Error("Flags v/u cannot be explicitly added");let c=l.v||(i.v?!1:se),p=(c?"v":"u")+r;i.x||({template:t,substitutions:n}=Z(t,n,fe)),i.n||({template:t,substitutions:n}=Z(t,n,le));let a=0,m="",E;if(t.raw.forEach((h,N)=>{let w=!!(t.raw[N]||t.raw[N+1]);a+=F(h),m+=M(h,g.CHAR_CLASS),E=U(m,E);let{regexContext:$,charClassContext:k}=E;if(N<t.raw.length-1){let T=n[N];m+=Ve(T,r,$,k,w,a),T instanceof RegExp?a+=F(T.source):T instanceof I&&(a+=F(String(T)))}}),[...u,...i.subroutines?[]:[Ne],...i.atomic?[]:[me,de],...i.x?[]:[pe],...c||!s?[]:[s]].forEach(h=>m=h(m,{flags:p,useEmulationGroups:o})),o){let h=je(m);return new ne(h.expression,p,{captureMap:h.captureMap})}return new RegExp(m,p)},ne=class e extends RegExp{#e;constructor(t,n,r){super(t,n),r?this.#e=r.captureMap:t instanceof e&&(this.#e=t.#e)}exec(t){let n=RegExp.prototype.exec.call(this,t);if(!n||!this.#e)return n;let r=[...n];n.length=1;for(let o=1;o<r.length;o++)this.#e[o]&&n.push(r[o]);return n}};function Ve(e,t,n,r,o,u){if(e instanceof RegExp&&n!==f.DEFAULT)throw new Error("Cannot interpolate a RegExp at this position because the syntax context does not match");if(n===f.INVALID_INCOMPLETE_TOKEN||r===d.INVALID_INCOMPLETE_TOKEN)throw new Error("Interpolation preceded by invalid incomplete token");let s=e instanceof I,i="";if(!(e instanceof RegExp)){e=String(e),s||(i=B(e,n===f.CHAR_CLASS?g.CHAR_CLASS:g.DEFAULT));let l=ue(i||e,n,r);if(l)throw new Error(`Unescaped stray "${l}" in the interpolated value would have side effects outside it`)}if(n===f.ENCLOSED_TOKEN||n===f.INTERVAL_QUANTIFIER||n===f.GROUP_NAME||r===d.ENCLOSED_TOKEN||r===d.Q_TOKEN)return s?String(e):i;if(n===f.CHAR_CLASS){if(s){if(V(String(e),"^-|^&&|-$|&&$"))throw new Error("Cannot use range or set operator at boundary of interpolated pattern; move the operation into the pattern or the operator outside of it");let l=ie(q(e));return z(e)?`[${l}]`:M(l)}return z(i)?`[${i}]`:i}if(e instanceof RegExp){let l=Qe(e,t),c=ae(l.value,u);return l.usedModifier?c:`(?:${c})`}return s?`(?:${e})`:o?`(?:${i})`:i}function Qe(e,t){let n={i:null,m:null,s:null},r="\\n\\r\\u2028\\u2029",o=e.source;if(e.ignoreCase!==t.includes("i"))if(G)n.i=e.ignoreCase;else throw new Error("Pattern modifiers not supported, so the value of flag i on the interpolated RegExp must match the outer regex");if(e.dotAll!==t.includes("s")&&(G?n.s=e.dotAll:o=A(o,"\\.",e.dotAll?"[^]":`[^${r}]`,g.DEFAULT)),e.multiline!==t.includes("m")&&(G?n.m=e.multiline:(o=A(o,"\\^",e.multiline?`(?<=^|[${r}])`:"(?<![^])",g.DEFAULT),o=A(o,"\\$",e.multiline?`(?=$|[${r}])`:"(?![^])",g.DEFAULT))),G){let u=Object.keys(n),s=u.filter(l=>n[l]===!0).join(""),i=u.filter(l=>n[l]===!1).join("");if(i&&(s+=`-${i}`),s)return{value:`(?${s}:${o})`,usedModifier:!0}}return{value:o}}function je(e){let t=C.replace(/\$/g,"\\$"),n=[!0];return e=A(e,`(?:${D})(?<mark>${t})?`,({0:r,groups:{mark:o}})=>o?(n.push(!1),r.slice(0,-C.length)):(n.push(!0),r),g.DEFAULT),{captureMap:n,expression:e}}return Le(qe);})(); | ||
//# sourceMappingURL=regex.min.js.map |
{ | ||
"name": "regex", | ||
"version": "4.1.2", | ||
"version": "4.1.3", | ||
"description": "Regex template tag with extended syntax, context-aware interpolation, and always-on best practices", | ||
@@ -16,2 +16,3 @@ "author": "Steven Levithan", | ||
"browser": "./dist/regex.min.js", | ||
"types": "./types/regex.d.ts", | ||
"scripts": { | ||
@@ -21,3 +22,3 @@ "bundle:global": "esbuild src/regex.js --global-name=Regex --bundle --minify --sourcemap --outfile=dist/regex.min.js", | ||
"bundle:cjs": "esbuild src/regex.js --format=cjs --bundle --sourcemap --outfile=dist/regex.cjs", | ||
"types": "tsc src/regex.js --rootDir src --declaration --allowJs --emitDeclarationOnly --outdir types", | ||
"types": "tsc src/regex.js --rootDir src --declaration --allowJs --emitDeclarationOnly --outDir types", | ||
"prebuild": "rm -rf dist/* types/*", | ||
@@ -24,0 +25,0 @@ "build": "npm run bundle:global && npm run bundle:esm && npm run bundle:cjs && npm run types", |
@@ -121,3 +121,3 @@ <div align="center"> | ||
<script type="module"> | ||
import {regex, pattern} from 'https://cdn.jsdelivr.net/npm/regex@4.1.2/+esm'; | ||
import {regex, pattern} from 'https://cdn.jsdelivr.net/npm/regex@4.1.3/+esm'; | ||
// β¦ | ||
@@ -131,3 +131,3 @@ </script> | ||
```html | ||
<script src="https://cdn.jsdelivr.net/npm/regex@4.1.2/dist/regex.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/regex@4.1.3/dist/regex.min.js"></script> | ||
<script> | ||
@@ -446,3 +446,3 @@ const {regex, pattern} = Regex; | ||
Emulated flag <kbd>n</kbd> gives you *named capture only* mode, which prevents the grouping metacharacters `(β¦)` from capturing. It's always implicitly on, though it doesn't extend into interpolated `RegExp` instances (to avoid changing their meaning). | ||
Emulated flag <kbd>n</kbd> gives you *named capture only* mode, which turns unnamed groups `(β¦)` into noncapturing groups. It's always implicitly on, though it doesn't extend into interpolated `RegExp` instances (to avoid changing their meaning). | ||
@@ -513,3 +513,3 @@ Requiring the syntactically clumsy `(?:β¦)` where you could just use `(β¦)` hurts readability and encourages adding unneeded captures (which hurt efficiency and refactoring). Flag <kbd>n</kbd> fixes this, making your regexes more readable. | ||
// Instead of | ||
new RegExp(`[\\w--[${RegExp.escape(str)}]]`, 'v') | ||
new RegExp(`[\\w--[${RegExp.escape(str)}]]`, 'v') // Set subtraction | ||
// You can say | ||
@@ -626,3 +626,3 @@ regex`[\w--${str}]` | ||
> Implementation note: `pattern` returns an object with a custom `toString` that simply returns `String(value)`. | ||
> Implementation note: `pattern` returns an object with a custom `toString` that simply returns `String(value)`. However, patterns are not intended as an intermediate regex type. You can think of `pattern` as a directive to the `regex` tag: treat this string as a partial pattern rather than a string to be matched literally. | ||
@@ -704,3 +704,3 @@ ### Interpolation principles | ||
plugins: [], | ||
unicodeSetsPlugin: <function> | ||
unicodeSetsPlugin: <function>, | ||
disable: { | ||
@@ -724,3 +724,3 @@ x: false, | ||
**`subclass`** β When `true`, the resulting regex is constructed using a `RegExp` subclass that avoids edge case issues with numbered backreferences. Without subclassing, submatches referenced *by number* from outside of the regex (e.g. in replacement strings) might reference the wrong values, because `regex`'s emulation of extended syntax (including atomic groups and subroutines) can add anonymous captures to generated regex source that might affect group numbering. | ||
**`subclass`** β When `true`, the resulting regex is constructed using a `RegExp` subclass that avoids edge case issues with numbered backreferences. Without subclassing, submatches referenced *by number* from outside of the regex (e.g. in replacement strings) might reference the wrong values, because `regex`'s emulation of extended syntax (including atomic groups and subroutines) can add unnamed captures to generated regex source that might affect group numbering. | ||
@@ -749,3 +749,3 @@ Context: `regex`'s implicit flag <kbd>n</kbd> (*named capture only* mode) means that all captures have names, so normally there's no need to reference submatches by number. In fact, flag <kbd>n</kbd> *prevents* you from doing so within the regex. And even in edge cases (such as when interpolating `RegExp` instances with numbered backreferences, or when flag <kbd>n</kbd> is explicitly disabled), any numbered backreferences within the regex are automatically adjusted to work correctly. However, issues can arise if you reference submatches by number (instead of their group names) from outside of the regex. Setting `subclass: true` resolves this, since the subclass knows about added "emulation groups" and automatically adjusts match results in all contexts. | ||
- **`x`** β Disables implicit, emulated [flag <kbd>x</kbd>](#flag-x). | ||
- **`n`** β Disables implicit, emulated [flag <kbd>n</kbd>](#flag-n). Note that, although it's safe to use anonymous captures and numbered backreferences within a regex when flag <kbd>n</kbd> is disabled, referencing submatches by number from *outside* a regex (e.g. in replacement strings) can result in incorrect values because extended syntax (atomic groups and subroutines) might add "emulation groups" to generated regex source. It's therefore recommended to enable option `subclass` when disabling `n`. | ||
- **`n`** β Disables implicit, emulated [flag <kbd>n</kbd>](#flag-n). Note that, although it's safe to use unnamed captures and numbered backreferences within a regex when flag <kbd>n</kbd> is disabled, referencing submatches by number from *outside* a regex (e.g. in replacement strings) can result in incorrect values because extended syntax (atomic groups and subroutines) might add "emulation groups" to generated regex source. It's therefore recommended to enable the `subclass` option when disabling `n`. | ||
- **`v`** β Disables implicit [flag <kbd>v</kbd>](#flag-v) even when it's supported natively, resulting in flag <kbd>u</kbd> being added instead (in combination with the `unicodeSetsPlugin`). | ||
@@ -772,3 +772,3 @@ - **`atomic`** β Disables [atomic groups](#atomic-groups) and [possessive quantifiers](#possessive-quantifiers), resulting in a syntax error if they're used. | ||
- To ensure atomization, `regex` uses nested character classes (which require flag <kbd>v</kbd>) when interpolating more than one token at a time *inside character classes*. A descriptive error is thrown when this isn't supported, which you can avoid by not interpolating multi-token patterns or strings into character classes. | ||
- To ensure atomization, `regex` uses nested character classes (which require flag <kbd>v</kbd>) when interpolating more than one token at a time *inside character classes*. A descriptive error is thrown when this isn't supported, which you can avoid by not interpolating multi-token patterns or strings into character classes. There's also an easy workaround: Put the whole character class in a `pattern` and interpolate a string into the pattern. | ||
- Using an interpolated `RegExp` instance with a different value for flag <kbd>i</kbd> than its outer regex relies on [pattern modifiers](https://github.com/tc39/proposal-regexp-modifiers), a bleeding-edge feature available in Chrome/Edge 125 and Opera 111. A descriptive error is thrown in environments without support, which you can avoid by aligning the use of flag <kbd>i</kbd> on inner and outer regexes. Local-only application of other flags doesn't rely on this feature. | ||
@@ -775,0 +775,0 @@ |
@@ -33,3 +33,3 @@ export type InterpolatedValue = string | RegExp | Pattern | number; | ||
subclass: true; | ||
}): RegexTag<WrappedRegex>; | ||
}): RegexTag<WrappedRegExp>; | ||
}; | ||
@@ -67,3 +67,3 @@ export type RegexFromTemplate<T> = { | ||
(options: RegexTagOptions & {subclass?: false}): RegexTag<T>; | ||
(options: RegexTagOptions & {subclass: true}): RegexTag<WrappedRegex>; | ||
(options: RegexTagOptions & {subclass: true}): RegexTag<WrappedRegExp>; | ||
}} | ||
@@ -84,9 +84,9 @@ */ | ||
import { Pattern } from './pattern.js'; | ||
declare class WrappedRegex extends RegExp { | ||
declare class WrappedRegExp extends RegExp { | ||
/** | ||
@param {string | WrappedRegex} expression | ||
@param {string | WrappedRegExp} expression | ||
@param {string} [flags] | ||
@param {{captureMap: Array<boolean>;}} [data] | ||
*/ | ||
constructor(expression: string | WrappedRegex, flags?: string, data?: { | ||
constructor(expression: string | WrappedRegExp, flags?: string, data?: { | ||
captureMap: Array<boolean>; | ||
@@ -93,0 +93,0 @@ }); |
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
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
427161
2686