[a-z]+):\]/.exec(e);if(!t||!ak.has(t.groups.name))throw new Error(`Invalid POSIX class "${e}"`);return xk("posix",e,{value:t.groups.name,negate:!!t.groups.negate})}return"-"===e?function(e){return{type:"CharacterClassHyphen",raw:e}}(e):"&&"===e?function(e){return{type:"CharacterClassIntersector",raw:e}}(e):fk(nk(e),e)}function dk(e,{inCharClass:t}){let n=e[1];if("c"===n||"C"===n)return function(e){let t="c"===e[1]?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw new Error(`Unsupported control character "${e}"`);return fk(nk(t.toUpperCase())-64,e)}(e);if("dDhHsSwW".includes(n))return function(e){let t=e[1].toLowerCase();return xk({d:"digit",h:"hex",s:"space",w:"word"}[t],e,{negate:e[1]!==t})}(e);if(e.startsWith(ik`\o{`))throw new Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(3===e.length)throw new Error(`Incomplete or invalid Unicode property "${e}"`);return function(e){let{p:t,neg:n,value:a}=/^\\(?[pP])\{(?\^?)(?[^}]+)/.exec(e).groups;return xk("property",e,{value:a,negate:"P"===t&&!n||"p"===t&&!!n})}(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),a=new TextEncoder;return[...n].map(e=>{let t=[...a.encode(e)].map(e=>`\\x${e.toString(16)}`).join("");return fk(nk(e),t)})}catch{throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if("u"===n||"x"===n)return fk(function(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*(?\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}(e),e);if(jk.has(n))return fk(jk.get(n),e);if(/\d/.test(n))return function(e,t){return{type:"EscapedNumber",inCharClass:e,raw:t}}(t,e);if("\\"===e)throw new Error(ik`Incomplete escape "\"`);if("M"===n)throw new Error(`Unsupported meta "${e}"`);if(2===[...e].length)return fk(e.codePointAt(1),e);throw new Error(`Unexpected escape "${e}"`)}function hk(e){return{type:"Alternator",raw:e}}function gk(e,t){return{type:"Assertion",kind:e,raw:t}}function bk(e){return{type:"Backreference",raw:e}}function fk(e,t){return{type:"Character",value:e,raw:t}}function _k(e){return{type:"CharacterClassClose",raw:e}}function yk(e,t){return{type:"CharacterClassOpen",negate:e,raw:t}}function xk(e,t,n={}){return{type:"CharacterSet",kind:e,...n,raw:t}}function kk(e,t,n={}){return"keep"===e?{type:"Directive",kind:e,raw:t}:{type:"Directive",kind:e,flags:rk(n.flags),raw:t}}function wk(e){return{type:"GroupClose",raw:e}}function vk(e,t,n={}){return{type:"GroupOpen",kind:e,...n,raw:t}}function $k(e){return{type:"Subroutine",raw:e}}var Ck=new Set(["COUNT","CMP","ERROR","FAIL","MAX","MISMATCH","SKIP","TOTAL_COUNT"]),jk=new Map([["a",7],["b",8],["e",27],["f",12],["n",10],["r",13],["t",9],["v",11]]);function Ak(e,t){let{on:n,off:a}=/^\(\?(?[imx]*)(?:-(?[-imx]*))?/.exec(e).groups;a??="";let i=(t.getCurrentModX()||n.includes("x"))&&!a.includes("x"),r=Fk(n),s=Fk(a),o={};if(r&&(o.enable=r),s&&(o.disable=s),e.endsWith(")"))return t.replaceCurrentModX(i),kk("flags",e,{flags:o});if(e.endsWith(":"))return t.pushModX(i),t.numOpenGroups++,vk("group",e,{...(r||s)&&{flags:o}});throw new Error(`Unexpected flag modifier "${e}"`)}function Ek(e){let t=/\(\*(?[A-Za-z_]\w*)?(?:\[(?(?:[A-Za-z_]\w*)?)\])?(?:\{(?[^}]*)\})?\)/.exec(e);if(!t)throw new Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:a,args:i}=t.groups;if(!n)throw new Error(`Invalid named callout "${e}"`);if(""===a)throw new Error(`Named callout tag with empty value not allowed "${e}"`);let r=i?i.split(",").filter(e=>""!==e).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[s,o,c]=r,l=Ck.has(n)?n.toLowerCase():"custom";switch(l){case"fail":case"mismatch":case"skip":if(r.length>0)throw new Error(`Named callout arguments not allowed "${r}"`);break;case"error":if(r.length>1)throw new Error(`Named callout allows only one argument "${r}"`);if("string"==typeof s)throw new Error(`Named callout argument must be a number "${s}"`);break;case"max":if(!r.length||r.length>2)throw new Error(`Named callout must have one or two arguments "${r}"`);if("string"==typeof s&&!/^[A-Za-z_]\w*$/.test(s))throw new Error(`Named callout argument one must be a tag or number "${s}"`);if(2===r.length&&("number"==typeof o||!/^[<>X]$/.test(o)))throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${o}"`);break;case"count":case"total_count":if(r.length>1)throw new Error(`Named callout allows only one argument "${r}"`);if(1===r.length&&("number"==typeof s||!/^[<>X]$/.test(s)))throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${s}"`);break;case"cmp":if(3!==r.length)throw new Error(`Named callout must have three arguments "${r}"`);if("string"==typeof s&&!/^[A-Za-z_]\w*$/.test(s))throw new Error(`Named callout argument one must be a tag or number "${s}"`);if("number"==typeof o||!/^(?:[<>!=]=|[<>])$/.test(o))throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${o}"`);if("string"==typeof c&&!/^[A-Za-z_]\w*$/.test(c))throw new Error(`Named callout argument three must be a tag or number "${c}"`);break;case"custom":throw new Error(`Undefined callout name "${n}"`);default:throw new Error(`Unexpected named callout kind "${l}"`)}return function(e,t,n,a){return{type:"NamedCallout",kind:e,tag:t,arguments:n,raw:a}}(l,a??null,i?.split(",")??null,e)}function Sk(e){let t,n,a=null;if("{"===e[0]){let{minStr:i,maxStr:r}=/^\{(?\d*)(?:,(?\d*))?/.exec(e).groups,s=1e5;if(+i>s||r&&+r>s)throw new Error("Quantifier value unsupported in Oniguruma");if(t=+i,n=void 0===r?+i:""===r?1/0:+r,t>n&&(a="possessive",[t,n]=[n,t]),e.endsWith("?")){if("possessive"===a)throw new Error('Unsupported possessive interval quantifier chain with "?"');a="lazy"}else a||(a="greedy")}else t="+"===e[0]?1:0,n="?"===e[0]?1:1/0,a="+"===e[1]?"possessive":"?"===e[1]?"lazy":"greedy";return function(e,t,n,a){return{type:"Quantifier",kind:e,min:t,max:n,raw:a}}(a,t,n,e)}function Fk(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 Tk(e){let t,n=[],a=new RegExp(ck,"gy");for(;t=a.exec(e);){let e=t[0];if("{"===e[0]){let t=/^\{(?\d+),(?\d+)\}\??$/.exec(e);if(t){let{min:i,max:r}=t.groups;if(+i>+r&&e.endsWith("?")){a.lastIndex--,n.push(Sk(e.slice(0,-1)));continue}}}n.push(Sk(e))}return n}function zk(e,t){if(!Array.isArray(e.body))throw new Error("Expected node with body array");if(1!==e.body.length)return!1;let n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}var Nk=new Set(["AbsenceFunction","Backreference","CapturingGroup","Character","CharacterClass","CharacterSet","Group","Quantifier","Subroutine"]);function qk(e,t={}){let n={flags:"",normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},a=function(e,t={}){let n={flags:"",...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if("string"!=typeof e)throw new Error("String expected as pattern");let a,i=function(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;nr.at(-1),numOpenGroups:0,popModX(){r.pop()},pushModX(e){r.push(e)},replaceCurrentModX(e){r[r.length-1]=e},singleline:n.rules.singleline},o=[];for(lk.lastIndex=0;a=lk.exec(e);){let t=uk(s,e,a[0],lk.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),void 0!==t.lastIndex&&(lk.lastIndex=t.lastIndex)}let c=[],l=0;o.filter(e=>"GroupOpen"===e.type).forEach(e=>{"capturing"===e.kind?e.number=++l:"("===e.raw&&c.push(e)}),l||c.forEach((e,t)=>{e.kind="capturing",e.number=t+1});let p=l||c.length;return{tokens:o.map(e=>"EscapedNumber"===e.type?function(e,t){let{raw:n,inCharClass:a}=e,i=n.slice(1);if(!a&&("0"!==i&&1===i.length||"0"!==i[0]&&+i<=t))return[bk(n)];let r=[],s=i.match(/^[0-7]+|\d/g);for(let e=0;e127)throw new Error(ik`Octal encoded byte above 177 unsupported "${n}"`)}else t=nk(a);r.push(fk(t,(0===e?"\\":"")+a))}return r}(e,p):e).flat(),flags:i}}(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),i=(e,t)=>{let n=a.tokens[r.nextIndex];switch(r.parent=e,r.nextIndex++,n.type){case"Alternator":return Pk();case"Assertion":return function({kind:e}){return Lk(rk({"^":"line_start",$:"line_end","\\A":"string_start","\\b":"word_boundary","\\B":"word_boundary","\\G":"search_start","\\y":"text_segment_boundary","\\Y":"text_segment_boundary","\\z":"string_end","\\Z":"string_end_newline"}[e],`Unexpected assertion kind "${e}"`),{negate:e===ik`\B`||e===ik`\Y`})}(n);case"Backreference":return function({raw:e},t){let n=/^\\k[<']/.test(e),a=n?e.slice(3,-1):e.slice(1),i=(n,a=!1)=>{let i=t.capturingGroups.length,r=!1;if(n>i){if(!t.skipBackrefValidation)throw new Error(`Not enough capturing groups defined to the left "${e}"`);r=!0}return t.hasNumberedRef=!0,Rk(a?i+1-n:n,{orphan:r})};if(n){let n=/^(?-?)0*(?[1-9]\d*)$/.exec(a);if(n)return i(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(a))throw new Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(a))throw new Error(`Group name not defined to the left "${e}"`);return Rk(a)}return i(+a)}(n,r);case"Character":return Zk(n.value,{useLastValid:!!t.isCheckingRangeEnd});case"CharacterClassHyphen":return function(e,t,n){let{tokens:a,walk:i}=t,r=t.parent,s=r.body.at(-1),o=a[t.nextIndex];if(!n.isCheckingRangeEnd&&s&&"CharacterClass"!==s.type&&"CharacterClassRange"!==s.type&&o&&"CharacterClassOpen"!==o.type&&"CharacterClassClose"!==o.type&&"CharacterClassIntersector"!==o.type){let e=i(r,{...n,isCheckingRangeEnd:!0});if("Character"===s.type&&"Character"===e.type)return r.body.pop(),function(e,t){if(t.value1===e.body.length?e.body[0]:e)),t.nextIndex++,c}(n,r,t);case"CharacterSet":return function({kind:e,negate:t,value:n},a){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:r,unicodePropertyMap:s}=a;if("property"===e){let a=Kk(n);if(!ak.has(a)||s?.has(a))return Gk(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:r,unicodePropertyMap:s});e="posix",n=a}return"posix"===e?function(e,t){let n=!!t?.negate;if(!ak.has(e))throw new Error(`Invalid POSIX class "${e}"`);return{type:"CharacterSet",kind:"posix",value:e,negate:n}}(n,{negate:t}):Ok(e,{negate:t})}(n,r);case"Directive":return function(e,t={}){if("keep"===e)return{type:"Directive",kind:e};if("flags"===e)return{type:"Directive",kind:e,flags:rk(t.flags)};throw new Error(`Unexpected directive kind "${e}"`)}(n.kind,{flags:n.flags});case"GroupOpen":return function(e,t,n){let{tokens:a,capturingGroups:i,namedGroupsByName:r,skipLookbehindValidation:s,walk:o}=t,c=function({flags:e,kind:t,name:n,negate:a,number:i}){switch(t){case"absence_repeater":return{type:"AbsenceFunction",kind:"repeater",body:Vk(void 0)};case"atomic":return Uk({atomic:!0});case"capturing":return Ik(i,{name:n});case"group":return Uk({flags:e});case"lookahead":case"lookbehind":return Wk({behind:"lookbehind"===t,negate:a});default:throw new Error(`Unexpected group kind "${t}"`)}}(e),l="AbsenceFunction"===c.type,p=Yk(c),u=p&&c.negate;if("CapturingGroup"===c.type&&(i.push(c),c.name&&function(e,t){return e.has(t)||e.set(t,[]),e.get(t)}(r,c.name).push(c)),l&&n.isInAbsenceFunction)throw new Error("Nested absence function not supported by Oniguruma");let m=Jk(a[t.nextIndex]);for(;"GroupClose"!==m.type;){if("Alternator"===m.type)c.body.push(Pk()),t.nextIndex++;else{let e=c.body.at(-1),t=o(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||l,isInLookbehind:n.isInLookbehind||p,isInNegLookbehind:n.isInNegLookbehind||u});if(e.body.push(t),(p||n.isInLookbehind)&&!s){let e="Lookbehind includes a pattern not allowed by Oniguruma";if(u||n.isInNegLookbehind){if(Xk(t)||"CapturingGroup"===t.type)throw new Error(e)}else if(Xk(t)||Yk(t)&&t.negate)throw new Error(e)}}m=Jk(a[t.nextIndex])}return t.nextIndex++,c}(n,r,t);case"NamedCallout":return function(e,t,n){return{type:"NamedCallout",kind:e,tag:t,arguments:n}}(n.kind,n.tag,n.arguments);case"Quantifier":return function({kind:e,min:t,max:n},a){let i=a.parent,r=i.body.at(-1);if(!r||!function(e){return Nk.has(e.type)}(r))throw new Error("Quantifier requires a repeatable token");let s=Dk(e,t,n,r);return i.body.pop(),s}(n,r);case"Subroutine":return function({raw:e},t){let{capturingGroups:n,subroutines:a}=t,i=e.slice(3,-1),r=/^(?[-+]?)0*(?[1-9]\d*)$/.exec(i);if(r){let e=+r.groups.num,a=n.length;if(t.hasNumberedRef=!0,i={"":e,"+":a+e,"-":a+1-e}[r.groups.sign],i<1)throw new Error("Invalid subroutine number")}else"0"===i&&(i=0);let s=Bk(i);return a.push(s),s}(n,r);default:throw new Error(`Unexpected token type "${n.type}"`)}},r={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:a.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:i},s=function(e){return{type:"Regex",body:Vk(void 0),flags:e}}(function(e){return{type:"Flags",...e}}(a.flags)),o=s.body[0];for(;r.nextIndexc.length)throw new Error("Subroutine uses a group number that's not defined");e&&(c[e-1].isSubroutined=!0)}else{if(!p.has(e))throw new Error(ik`Subroutine uses a group name that's not defined "\g<${e}>"`);if(p.get(e).length>1)throw new Error(ik`Subroutine uses a duplicate group name "\g<${e}>"`);p.get(e)[0].isSubroutined=!0}return s}function Pk(e){return{type:"Alternative",body:Hk(e?.body)}}function Lk(e,t){let n={type:"Assertion",kind:e};return("word_boundary"===e||"text_segment_boundary"===e)&&(n.negate=!!t?.negate),n}function Rk(e,t){let n=!!t?.orphan;return{type:"Backreference",ref:e,...n&&{orphan:n}}}function Ik(e,t){let n={name:void 0,isSubroutined:!1,...t};if(void 0!==n.name&&!function(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}(n.name))throw new Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:"CapturingGroup",number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:Vk(t?.body)}}function Zk(e,t){let n={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(!n.useLastValid)throw e>1310719?new Error(`Invalid code point out of range "\\x{${t}}"`):new Error(`Invalid code point out of range in JS "\\x{${t}}"`);e=1114111}return{type:"Character",value:e}}function Mk(e){let t={kind:"union",negate:!1,...e};return{type:"CharacterClass",kind:t.kind,negate:t.negate,body:Hk(e?.body)}}function Ok(e,t){let n=!!t?.negate,a={type:"CharacterSet",kind:e};return("digit"===e||"hex"===e||"newline"===e||"space"===e||"word"===e)&&(a.negate=n),("text_segment"===e||"newline"===e&&!n)&&(a.variableLength=!0),a}function Uk(e){let t=e?.atomic,n=e?.flags;if(t&&n)throw new Error("Atomic group cannot have flags");return{type:"Group",...t&&{atomic:t},...n&&{flags:n},body:Vk(e?.body)}}function Wk(e){let t={behind:!1,negate:!1,...e};return{type:"LookaroundAssertion",kind:t.behind?"lookbehind":"lookahead",negate:t.negate,body:Vk(e?.body)}}function Dk(e,t,n,a){if(t>n)throw new Error("Invalid reversed quantifier range");return{type:"Quantifier",kind:e,min:t,max:n,body:a}}function Bk(e){return{type:"Subroutine",ref:e}}function Gk(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},a=n.unicodePropertyMap?.get(Kk(e));if(!a)if(n.normalizeUnknownPropertyNames)a=function(e){return e.trim().replace(/[- _]+/g,"_").replace(/[A-Z][a-z]+(?=[A-Z])/g,"$&_").replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw new Error(ik`Invalid Unicode property "\p{${e}}"`);return{type:"CharacterSet",kind:"property",value:a??e,negate:n.negate}}function Vk(e){if(void 0===e)e=[Pk()];else if(!Array.isArray(e)||!e.length||!e.every(e=>"Alternative"===e.type))throw new Error("Invalid body; expected array of one or more Alternative nodes");return e}function Hk(e){if(void 0===e)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw new Error("Invalid body; expected array of nodes");return e}function Xk(e){return"LookaroundAssertion"===e.type&&"lookahead"===e.kind}function Yk(e){return"LookaroundAssertion"===e.type&&"lookbehind"===e.kind}function Kk(e){return e.replace(/[- _]+/g,"").toLowerCase()}function Qk(e,t){return rk(e,("Character"===t?.type&&93===t.value?"Empty":"Unclosed")+" character class")}function Jk(e){return rk(e,"Unclosed group")}function ew(e,t,n=null){function a(e,t){for(let n=0;ntw(c).splice(nw(o)+1),removeAllPrevSiblings(){let e=nw(o)+l;return l-=e,tw(c).splice(0,Math.max(0,e))},replaceWith(e,t={}){let n=!!t.traverse;c?c[Math.max(0,nw(o)+l)]=e:rk(s,"Can't replace root node")[o]=e,n&&i(e,s,o,c),p=!0},replaceWithMultiple(e,t={}){let n=!!t.traverse;if(tw(c).splice(Math.max(0,nw(o)+l),1,...e),l+=e.length-1,n){let t=0;for(let n=0;nA-Za-z\-]|<[=!]|\(DEFINE\))`;function iw(e,t){for(let n=0;n=t&&e[n]++}function rw(e,t,n,a){return e.slice(0,t)+a+e.slice(t+n.length)}var sw=Object.freeze({DEFAULT:"DEFAULT",CHAR_CLASS:"CHAR_CLASS"});function ow(e,t,n,a){let i=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,"gsu"),r=[!1],s=0,o="";for(let t of e.matchAll(i)){let{0:e,groups:{$skip:i}}=t;i||a&&a===sw.DEFAULT!=!s?("["===e[0]?(s++,r.push("^"===e[1])):"]"===e&&s&&(s--,r.pop()),o+=e):o+=n instanceof Function?n(t,{context:s?sw.CHAR_CLASS:sw.DEFAULT,negated:r[r.length-1]}):n}return o}function cw(e,t,n,a){ow(e,t,n,a)}function lw(e,t,n){return!!function(e,t,n=0,a){if(!new RegExp(t,"su").test(e))return null;let i=new RegExp(`${t}|(?<$skip>\\\\?.)`,"gsu");i.lastIndex=n;let r,s=0;for(;r=i.exec(e);){let{0:e,groups:{$skip:t}}=r;if(!(t||a&&a===sw.DEFAULT!=!s))return r;"["===e?s++:"]"===e&&s&&s--,i.lastIndex==r.index&&i.lastIndex++}return null}(e,t,0,n)}function pw(e,t){let n=/\\?./gsu;n.lastIndex=t;let a,i=e.length,r=0,s=1;for(;a=n.exec(e);){let[e]=a;if("["===e)r++;else if(r)"]"===e&&r--;else if("("===e)s++;else if(")"===e&&(s--,!s)){i=a.index;break}}return e.slice(t,i)}var uw=new RegExp(String.raw`(?${aw})|(?\((?:\?<[^>]+>)?)|\\?.`,"gsu"),mw=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,dw=new RegExp(String.raw`
\\(?: \d+
| c[A-Za-z]
| [gk]<[^>]+>
| [pPu]\{[^\}]+\}
| u[A-Fa-f\d]{4}
| x[A-Fa-f\d]{2}
)
| \((?: \? (?: [:=!>]
| <(?:[=!]|[^>]+>)
| [A-Za-z\-]+:
| \(DEFINE\)
))?
| (?${mw})(?[?+]?)(?[?*+\{]?)
| \\?.
`.replace(/\s+/g,""),"gsu"),hw=String.raw,gw=hw`\\g<(?[^>&]+)&R=(?[^>]+)>`,bw=hw`\(\?R=(?[^\)]+)\)|${gw}`,fw=hw`\(\?<(?![=!])(?[^>]+)>`,_w=hw`${fw}|(?\()(?!\?)`,yw=new RegExp(hw`${fw}|${bw}|\(\?|\\?.`,"gsu"),xw="Cannot use multiple overlapping recursions";function kw(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)<2||e>100)throw new Error(t)}function ww(e,t,n,a,i,r,s){let o=new Set;a&&cw(e+t,fw,({groups:{captureName:e}})=>{o.add(e)},sw.DEFAULT);let c=[n,a?o:null,i,r,s];return`${e}${vw(`(?:${e}`,"forward",...c)}(?:)${vw(`${t})`,"backward",...c)}${t}`}function vw(e,t,n,a,i,r,s){let o=e=>"forward"===t?e+2:n-e+2-1,c="";for(let t=0;t[^>]+)>`,({0:e,groups:{captureName:t,unnamed:o,backref:c}})=>{if(c&&a&&!a.has(c))return e;let l=`_$${n}`;if(o||t){let n=s+r.length+1;return r.push(n),$w(i,n),o?e:`(?<${t}${l}>`}return hw`\k<${c}${l}>`},sw.DEFAULT)}return c}function $w(e,t){for(let n=0;n=t&&e[n]++}function Cw(e,t,n,a,i,r){if(e.size&&a){let s=0;cw(t,_w,()=>s++,sw.DEFAULT);let o=r-s+i,c=new Map;return e.forEach((e,t)=>{let i=(a-s*n)/n,r=s*n,l=t>o+s?t+a:t,p=[];for(let t of e)if(t<=o)p.push(t);else if(t>o+s+i)p.push(t+a);else if(t<=o+s)for(let e=0;e<=n;e++)p.push(t+s*e);else for(let e=0;e<=n;e++)p.push(t+r+i*e);c.set(l,p)}),c}return e}var jw=String.fromCodePoint,Aw=String.raw,Ew={flagGroups:(()=>{try{new RegExp("(?i:)")}catch{return!1}return!0})(),unicodeSets:(()=>{try{new RegExp("[[]]","v")}catch{return!1}return!0})()};function Sw(e,{enable:t,disable:n}){return{dotAll:!(n?.dotAll||!t?.dotAll&&!e.dotAll),ignoreCase:!(n?.ignoreCase||!t?.ignoreCase&&!e.ignoreCase)}}function Fw(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function Tw(e,t){return zw[e]>=zw[t]}Ew.bugFlagVLiteralHyphenIsRange=!!Ew.unicodeSets&&(()=>{try{new RegExp(Aw`[\d\-a]`,"v")}catch{return!0}return!1})(),Ew.bugNestedClassIgnoresNegation=Ew.unicodeSets&&new RegExp("[[^a]]","v").test("a");var zw={ES2025:2025,ES2024:2024,ES2018:2018},Nw={auto:"auto",ES2025:"ES2025",ES2024:"ES2024",ES2018:"ES2018"};function qw(e={}){if("[object Object]"!=={}.toString.call(e))throw new Error("Unexpected options");if(void 0!==e.target&&!Nw[e.target])throw new Error(`Unexpected target "${e.target}"`);let t={accuracy:"default",avoidSubclass:!1,flags:"",global:!1,hasIndices:!1,lazyCompileLength:1/0,target:"auto",verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return"auto"===t.target&&(t.target=Ew.flagGroups?"ES2025":Ew.unicodeSets?"ES2024":"ES2018"),t}var Pw=new Set([jw(304),jw(305)]),Lw=Aw`[\p{L}\p{M}\p{N}\p{Pc}]`;function Rw(e){if(Pw.has(e))return[e];let t=new Set,n=e.toLowerCase(),a=n.toUpperCase(),i=Ow.get(n),r=Zw.get(n),s=Mw.get(n);return 1===[...a].length&&t.add(a),s&&t.add(s),i&&t.add(i),t.add(n),r&&t.add(r),[...t]}var Iw=new Map("C Other\nCc Control cntrl\nCf Format\nCn Unassigned\nCo Private_Use\nCs Surrogate\nL Letter\nLC Cased_Letter\nLl Lowercase_Letter\nLm Modifier_Letter\nLo Other_Letter\nLt Titlecase_Letter\nLu Uppercase_Letter\nM Mark Combining_Mark\nMc Spacing_Mark\nMe Enclosing_Mark\nMn Nonspacing_Mark\nN Number\nNd Decimal_Number digit\nNl Letter_Number\nNo Other_Number\nP Punctuation punct\nPc Connector_Punctuation\nPd Dash_Punctuation\nPe Close_Punctuation\nPf Final_Punctuation\nPi Initial_Punctuation\nPo Other_Punctuation\nPs Open_Punctuation\nS Symbol\nSc Currency_Symbol\nSk Modifier_Symbol\nSm Math_Symbol\nSo Other_Symbol\nZ Separator\nZl Line_Separator\nZp Paragraph_Separator\nZs Space_Separator\nASCII\nASCII_Hex_Digit AHex\nAlphabetic Alpha\nAny\nAssigned\nBidi_Control Bidi_C\nBidi_Mirrored Bidi_M\nCase_Ignorable CI\nCased\nChanges_When_Casefolded CWCF\nChanges_When_Casemapped CWCM\nChanges_When_Lowercased CWL\nChanges_When_NFKC_Casefolded CWKCF\nChanges_When_Titlecased CWT\nChanges_When_Uppercased CWU\nDash\nDefault_Ignorable_Code_Point DI\nDeprecated Dep\nDiacritic Dia\nEmoji\nEmoji_Component EComp\nEmoji_Modifier EMod\nEmoji_Modifier_Base EBase\nEmoji_Presentation EPres\nExtended_Pictographic ExtPict\nExtender Ext\nGrapheme_Base Gr_Base\nGrapheme_Extend Gr_Ext\nHex_Digit Hex\nIDS_Binary_Operator IDSB\nIDS_Trinary_Operator IDST\nID_Continue IDC\nID_Start IDS\nIdeographic Ideo\nJoin_Control Join_C\nLogical_Order_Exception LOE\nLowercase Lower\nMath\nNoncharacter_Code_Point NChar\nPattern_Syntax Pat_Syn\nPattern_White_Space Pat_WS\nQuotation_Mark QMark\nRadical\nRegional_Indicator RI\nSentence_Terminal STerm\nSoft_Dotted SD\nTerminal_Punctuation Term\nUnified_Ideograph UIdeo\nUppercase Upper\nVariation_Selector VS\nWhite_Space space\nXID_Continue XIDC\nXID_Start XIDS".split(/\s/).map(e=>[Kk(e),e])),Zw=new Map([["s",jw(383)],[jw(383),"s"]]),Mw=new Map([[jw(223),jw(7838)],[jw(107),jw(8490)],[jw(229),jw(8491)],[jw(969),jw(8486)]]),Ow=new Map([Ww(453),Ww(456),Ww(459),Ww(498),...Dw(8072,8079),...Dw(8088,8095),...Dw(8104,8111),Ww(8124),Ww(8140),Ww(8188)]),Uw=new Map([["alnum",Aw`[\p{Alpha}\p{Nd}]`],["alpha",Aw`\p{Alpha}`],["ascii",Aw`\p{ASCII}`],["blank",Aw`[\p{Zs}\t]`],["cntrl",Aw`\p{Cc}`],["digit",Aw`\p{Nd}`],["graph",Aw`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],["lower",Aw`\p{Lower}`],["print",Aw`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],["punct",Aw`[\p{P}\p{S}]`],["space",Aw`\p{space}`],["upper",Aw`\p{Upper}`],["word",Aw`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],["xdigit",Aw`\p{AHex}`]]);function Ww(e){let t=jw(e);return[t.toLowerCase(),t]}function Dw(e,t){return function(e,t){let n=[];for(let a=e;a<=t;a++)n.push(a);return n}(e,t).map(e=>Ww(e))}var Bw=new Set(["Lower","Lowercase","Upper","Uppercase","Ll","Lowercase_Letter","Lt","Titlecase_Letter","Lu","Uppercase_Letter"]),Gw={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:a,kind:i}=e;if("repeater"!==i)throw new Error('Unsupported absence function "(?~|"');{let e=Uk();e.body[0].body.push(Wk({negate:!0,body:a}),Gk("Any"));let i=Uk();i.body[0].body.push(Dk("greedy",0,1/0,e)),n(cv(i,t),{traverse:!0})}},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:a}){let i=e.body.filter(e=>"flags"===e.kind);for(let e=n+1;e\r\n|${i?Aw`\p{RGI_Emoji}`:r}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if("hex"===c)n(ov(Gk("AHex",{negate:l}),t));else if("newline"===c)n(cv(rv(l?"[^\n]":"(?>\r\n?|[\n\v\f
\u2028\u2029])"),t));else if("posix"===c)if(i||"graph"!==p&&"print"!==p)n(cv(sv(rv(Uw.get(p)),l),t));else{if("strict"===a)throw new Error(`POSIX class "${p}" requires min target ES2024 or non-strict accuracy`);let e={graph:"!-~",print:" -~"}[p];l&&(e=`\0-${jw(e.codePointAt(0)-1)}${jw(e.codePointAt(2)+1)}-`),n(cv(rv(`[${e}]`),t))}else if("property"===c)Iw.has(Kk(p))||(e.key="sc");else if("space"===c)n(ov(Gk("space",{negate:l}),t));else{if("word"!==c)throw new Error(`Unexpected character set kind "${c}"`);n(cv(sv(rv(Lw),l),t))}}else n(ov(Ok("word",{negate:l}),t));else n(cv(sv(rv("[\t-\r ]"),l),t));else n(ov(Ok("digit",{negate:l}),t))},Directive({node:e,parent:t,root:n,remove:a,replaceWith:i,removeAllPrevSiblings:r,removeAllNextSiblings:s}){let{kind:o,flags:c}=e;if("flags"===o)if(c.enable||c.disable){let e=Uk({flags:c});e.body[0].body=s(),i(cv(e,t),{traverse:!0})}else a();else{if("keep"!==o)throw new Error(`Unexpected directive kind "${o}"`);{let e=n.body[0],a=1===n.body.length&&zk(e,{type:"Group"})&&1===e.body[0].body.length?e.body[0]:n;if(t.parent!==a||a.body.length>1)throw new Error(Aw`Uses "\K" in a way that's unsupported`);let s=Wk({behind:!0});s.body[0].body=r(),i(cv(s,t))}}},Flags({node:e,parent:t}){if(e.posixIsAscii)throw new Error('Unsupported flag "P"');if("word"===e.textSegmentMode)throw new Error('Unsupported flag "y{w}"');["digitIsAscii","extended","posixIsAscii","spaceIsAscii","wordIsAscii","textSegmentMode"].forEach(t=>delete e[t]),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},LookaroundAssertion({node:e},t){let{kind:n}=e;"lookbehind"===n&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:a}=e;if("fail"!==a)throw new Error(`Unsupported named callout "(*${a.toUpperCase()}"`);n(cv(Wk({negate:!0}),t))},Quantifier({node:e}){if("Quantifier"===e.body.type){let t=Uk();t.body[0].body.push(e.body),e.body=cv(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],a=!1,i=!1;for(let t of e.body)if(1===t.body.length&&"search_start"===t.body[0].kind)t.body.pop();else{let e=nv(t.body);e?(a=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}a&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:a}){if("strict"===t&&n&&a)throw new Error(Aw`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;"string"==typeof n&&!iv(n)&&(n=Qw(n,t),e.ref=n)}},Vw={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:a,ref:i}=e;a||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:a},{groupOriginByCopy:i,groupsByName:r,multiplexCapturesToLeftByRef:s,openRefs:o,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&o.has(e.number)){let a=ov(Kw(e.number),t);return c.set(a,o.get(e.number)),void n(a)}o.set(e.number,e),s.set(e.number,[]),e.name&&Fw(s,e.name,[]);let p=s.get(e.name??e.number);for(let t=0;t"Group"===e.type&&!!e.flags)),t=e?Sw(a.globalFlags,e):a.globalFlags;(function(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase})(t,a.currentFlags)||(l=Uk({flags:ev(t)}),l.body[0].body.push(c))}n(cv(l,t),{traverse:!o})}},Hw={Backreference({node:e,parent:t,replaceWith:n},a){if(e.orphan)return void(a.highestOrphanBackref=Math.max(a.highestOrphanBackref,e.ref));let i=a.reffedNodesByReferencer.get(e).filter(t=>function(e,t){let n=t;do{if("Regex"===n.type)return!1;if("Alternative"===n.type)continue;if(n===e)return!1;let t=tv(n.parent);for(let a of t){if(a===n)break;if(a===e||av(a,e))return!0}}while(n=n.parent);throw new Error("Unexpected path")}(t,e));if(i.length)if(i.length>1){n(cv(Uk({atomic:!0,body:i.reverse().map(e=>Pk({body:[Rk(e.number)]}))}),t))}else e.ref=i[0].number;else n(cv(Wk({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function ev({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 tv(e){if(!e)throw new Error("Node expected");let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function nv(e){let t=e.find(e=>"search_start"===e.kind||function(e){let t={negate:null,negate:!1};return"LookaroundAssertion"===e.type&&(null===t.negate||e.negate===t.negate)&&1===e.body.length&&zk(e.body[0],{type:"Assertion",kind:"search_start"})}(e)||!function({type:e}){return"Assertion"===e||"Directive"===e||"LookaroundAssertion"===e}(e));if(!t)return null;if("search_start"===t.kind)return t;if("LookaroundAssertion"===t.type)return t.body[0].body[0];if("CapturingGroup"===t.type||"Group"===t.type){let e=[];for(let n of t.body){let t=nv(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function av(e,t){let n=tv(e)??[];for(let e of n)if(e===t||av(e,t))return!0;return!1}function iv(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function rv(e,t){let n=qk(e,{...t,unicodePropertyMap:Iw}).body;return n.length>1||n[0].body.length>1?Uk({body:n}):n[0].body[0]}function sv(e,t){return e.negate=t,e}function ov(e,t){return e.parent=t,e}function cv(e,t){return Xw(e),e.parent=t,e}var lv={"*":{enter({node:e},t){if(yv(e)){let n=t.getCurrentModI();t.pushModI(e.flags?Sw({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){yv(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){bv(jw(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),fv(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){"property"===e.kind&&Bw.has(e.value)&&t.setHasCasedChar()}},pv={Alternative:({body:e},t,n)=>e.map(n).join(""),Assertion({kind:e,negate:t}){if("string_end"===e)return"$";if("string_start"===e)return"^";if("word_boundary"===e)return t?Aw`\B`:Aw`\b`;throw new Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if("number"!=typeof e)throw new Error("Unexpected named backref in transformed AST");if(!t.useFlagMods&&"strict"===t.accuracy&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");return"\\"+e},CapturingGroup(e,t,n){let{body:a,name:i,number:r}=e,s={ignoreCase:t.currentFlags.ignoreCase},o=t.originMap.get(e);return o&&(s.hidden=!0,r>o.number&&(s.transferTo=o.number)),t.captureMap.set(r,s),`(${i?`?<${i}>`:""}${a.map(n).join("|")})`},Character({value:e},t){let n=jw(e),a=_v(e,{escDigit:"Backreference"===t.lastNode.type,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(a!==n)return a;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&bv(n)){let e=Rw(n);return t.inCharClass?e.join(""):e.length>1?`[${e.join("")}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:a,negate:i,parent:r}=e,{body:s}=e;if("intersection"===a&&!t.useFlagV)throw new Error("Use of character class intersection requires min target ES2024");Ew.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&s.some(xv)&&(s=[Zk(45),...s.filter(e=>!xv(e))]);let o=()=>`[${i?"^":""}${s.map(n).join("intersection"===a?"&&":"")}]`;if(!t.inCharClass){if((!t.useFlagV||Ew.bugNestedClassIgnoresNegation)&&!i){let t=s.filter(e=>"CharacterClass"===e.type&&"union"===e.kind&&e.negate);if(t.length){let a=Uk(),i=a.body[0];return a.parent=r,i.parent=a,s=s.filter(e=>!t.includes(e)),e.body=s,s.length?(e.parent=i,i.body.push(e)):a.body.pop(),t.forEach(e=>{let t=Pk({body:[e]});e.parent=t,t.parent=a,a.body.push(t)}),n(a)}}t.inCharClass=!0;let a=o();return t.inCharClass=!1,a}let c=s[0];if("union"===a&&!i&&c&&((!t.useFlagV||!t.verbose)&&"union"===r.kind&&(!Ew.bugFlagVLiteralHyphenIsRange||!t.useFlagV)||!t.verbose&&"intersection"===r.kind&&1===s.length&&"CharacterClassRange"!==c.type))return s.map(n).join("");if(!t.useFlagV&&"CharacterClass"===r.type)throw new Error("Uses nested character class in a way that requires min target ES2024");return o()},CharacterClassRange(e,t){let n=e.min.value,a=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},r=_v(n,i),s=_v(a,i),o=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&function(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],a=null;for(let e=0;e{o.add(Array.isArray(e)?`${_v(e[0],i)}-${_v(e[1],i)}`:_v(e,i))}),`${r}-${s}${[...o].join("")}`},CharacterSet({kind:e,negate:t,value:n,key:a},i){if("dot"===e)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?".":"[^]":Aw`[^\n]`;if("digit"===e)return t?Aw`\D`:Aw`\d`;if("property"===e){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&Bw.has(n))throw new Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?Aw`\P`:Aw`\p`}{${a?`${a}=`:""}${n}}`}if("word"===e)return t?Aw`\W`:Aw`\w`;throw new Error(`Unexpected character set kind "${e}"`)},Flags:(e,t)=>(t.appliedGlobalFlags.ignoreCase?"i":"")+(e.dotAll?"s":"")+(e.sticky?"y":""),Group({atomic:e,body:t,flags:n,parent:a},i,r){let s=i.currentFlags;n&&(i.currentFlags=Sw(s,n));let o=t.map(r).join("|"),c=i.verbose||1!==t.length||"Quantifier"===a.type||e||i.useFlagMods&&n?`(?${function(e,t,n){if(e)return">";let a="";if(t&&n){let{enable:e,disable:n}=t;a=(e?.ignoreCase?"i":"")+(e?.dotAll?"s":"")+(n?"-":"")+(n?.ignoreCase?"i":"")+(n?.dotAll?"s":"")}return`${a}:`}(e,n,i.useFlagMods)}${o})`:o;return i.currentFlags=s,c},LookaroundAssertion:({body:e,kind:t,negate:n},a,i)=>`(?${"lookahead"===t?"":"<"}${n?"!":"="}${e.map(i).join("|")})`,Quantifier:(e,t,n)=>n(e.body)+function({kind:e,max:t,min:n}){let a;return a=n||1!==t?n||t!==1/0?1===n&&t===1/0?"+":n===t?`{${n}}`:`{${n},${t===1/0?"":t}}`:"*":"?",a+{greedy:"",lazy:"?",possessive:"+"}[e]}(e),Subroutine({isRecursive:e,ref:t},n){if(!e)throw new Error("Unexpected non-recursive subroutine in transformed AST");let a=n.recursionLimit;return 0===t?`(?R=${a})`:Aw`\g<${t}&R=${a}>`}},uv=new Set(["$","(",")","*","+",".","?","[","\\","]","^","{","|","}"]),mv=new Set(["-","\\","]","^","["]),dv=new Set(["(",")","-","/","[","\\","]","^","{","|","}","!","#","$","%","&","*","+",",",".",":",";","<","=",">","?","@","`","~"]),hv=new Map([[9,Aw`\t`],[10,Aw`\n`],[11,Aw`\v`],[12,Aw`\f`],[13,Aw`\r`],[8232,Aw`\u2028`],[8233,Aw`\u2029`],[65279,Aw`\uFEFF`]]),gv=/^\p{Cased}$/u;function bv(e){return gv.test(e)}function fv(e,t){let n=!!t?.firstOnly,a=e.min.value,i=e.max.value,r=[];if(a<65&&(65535===i||i>=131071)||65536===a&&i>=131071)return r;for(let e=a;e<=i;e++){let t=jw(e);if(!bv(t))continue;let s=Rw(t).filter(e=>{let t=e.codePointAt(0);return ti});if(s.length&&(r.push(...s),n))break}return r}function _v(e,{escDigit:t,inCharClass:n,useFlagV:a}){if(hv.has(e))return hv.get(e);if(e<32||e>126&&e<160||e>262143||t&&function(e){return e>47&&e<58}(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,"0")}`;let i=n?a?dv:mv:uv,r=jw(e);return(i.has(r)?"\\":"")+r}function yv({type:e}){return"CapturingGroup"===e||"Group"===e||"LookaroundAssertion"===e}function xv({type:e,value:t}){return"Character"===e&&45===t}var kv=class e extends RegExp{#e=new Map;#t=null;#n;#a=null;#i=null;rawOptions={};get source(){return this.#n||"(?:)"}constructor(t,n,a){let i=!!a?.lazyCompile;if(t instanceof RegExp){if(a)throw new Error("Cannot provide options when copying a regexp");let i=t;super(i,n),this.#n=i.source,i instanceof e&&(this.#e=i.#e,this.#a=i.#a,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...a};super(i?"":t,n),this.#n=t,this.#e=function(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,a]of t)for(let t of a)Fw(n,t,{}).transferTo=e;return n}(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=a??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,a=this.lastIndex;if("clip_search"===this.#i&&n&&a){this.lastIndex=0;let e=this.#r(t.slice(a));return e&&(function(e,t,n,a){if(e.index+=t,e.input=n,a){let n=e.indices;for(let e=0;e{let n=a[e];n&&(a[e]=[n[0]+t,n[1]+t])})}}(e,a,t,this.hasIndices),this.lastIndex+=a),e}return this.#r(t)}#r(e){this.#t.lastIndex=this.lastIndex;let t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;let n,a=[...t];t.length=1,this.hasIndices&&(n=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;e\((?:\?<(?![=!])(?[^>]+)>|(?!\?)))|\\?./gsu,a=new Map,i=0,r=0;for(;t=n.exec(e);){let{0:e,groups:{capture:n,name:s}}=t;"["===e?i++:i?"]"===e&&i--:n&&(r++,s&&a.set(r,s))}return a}function vv(e,t){let n=function(e,t){let n=qw(t),a=function(e,t){let n={accuracy:"default",asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:"ES2025",...t};Xw(e);let a={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:Tw(n.bestEffortTarget,"ES2024"),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};ew(e,Gw,a);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},r={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:a.subroutineRefMap};return ew(e,Vw,r),ew(e,Hw,{groupsByName:r.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:r.reffedNodesByReferencer}),e._originMap=r.groupOriginByCopy,e._strategy=a.strategy,e}(qk(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:Iw}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=function(e,t){let n=qw(t),a=Tw(n.target,"ES2024"),i=Tw(n.target,"ES2025"),r=n.rules.recursionLimit;if(!Number.isInteger(r)||r<2||r>20)throw new Error("Invalid recursionLimit; use 2-20");let s=null,o=null;if(!i){let t=[e.flags.ignoreCase];ew(e,lv,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?s=!0:o=!0}})}let c={dotAll:e.flags.dotAll,ignoreCase:!(!e.flags.ignoreCase&&!s||o)},l=e,p={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:r,useAppliedIgnoreCase:!(i||!s||!o),useFlagMods:i,useFlagV:a,verbose:n.verbose};function u(e){return p.lastNode=l,l=e,function(e,t){if(null==e)throw new Error(t??"Value expected");return e}(pv[e.type],`Unexpected node type "${e.type}"`)(e,p,u)}let m={pattern:e.body.map(u).join("|"),flags:u(e.flags),options:{...e.options}};return a||(delete m.options.force.v,m.options.disable.v=!0,m.options.unicodeSetsPlugin=null),m._captureTransfers=new Map,m._hiddenCaptures=[],p.captureMap.forEach((e,t)=>{e.hidden&&m._hiddenCaptures.push(t),e.transferTo&&Fw(m._captureTransfers,e.transferTo,[]).push(t)}),m}(a,n),r=function(e,t){let{hiddenCaptures:n,mode:a}={hiddenCaptures:[],mode:"plugin",...t},i=t?.captureTransfers??new Map;if(!new RegExp(bw,"su").test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if("plugin"===a&&lw(e,hw`\(\?\(DEFINE\)`,sw.DEFAULT))throw new Error("DEFINE groups cannot be used with recursion");let r,s=[],o=lw(e,hw`\\[1-9]`,sw.DEFAULT),c=new Map,l=[],p=!1,u=0,m=0;for(yw.lastIndex=0;r=yw.exec(e);){let{0:t,groups:{captureName:d,rDepth:h,gRNameOrNum:g,gRDepth:b}}=r;if("["===t)u++;else if(u)"]"===t&&u--;else{if(h){if(kw(h),p)throw new Error(xw);if(o)throw new Error(("external"===a?"Backrefs":"Numbered backrefs")+" cannot be used with global recursion");let t=e.slice(0,r.index),c=e.slice(yw.lastIndex);if(lw(c,bw,sw.DEFAULT))throw new Error(xw);let l=+h-1;e=ww(t,c,l,!1,n,s,m),i=Cw(i,t,l,s.length,0,m);break}if(g){kw(b);let u=!1;for(let e of l)if(e.name===g||e.num===+g){if(u=!0,e.hasRecursedWithin)throw new Error(xw);break}if(!u)throw new Error(hw`Recursive \g cannot be used outside the referenced group "${"external"===a?g:hw`\g<${g}&R=${b}>`}"`);let d=c.get(g),h=pw(e,d);if(o&&lw(h,hw`${fw}|\((?!\?)`,sw.DEFAULT))throw new Error(("external"===a?"Backrefs":"Numbered backrefs")+" cannot be used with recursion of capturing groups");let f=e.slice(d,r.index),_=h.slice(f.length+t.length),y=s.length,x=+b-1,k=ww(f,_,x,!0,n,s,m);i=Cw(i,f,x,s.length-y,y,m);let w=e.slice(0,d),v=e.slice(d+h.length);e=`${w}${k}${v}`,yw.lastIndex+=k.length-t.length-f.length-_.length,l.forEach(e=>e.hasRecursedWithin=!0),p=!0}else if(d)m++,c.set(String(m),yw.lastIndex),c.set(d,yw.lastIndex),l.push({num:m,name:d});else if("("===t[0]){let e="("===t;e&&(m++,c.set(String(m),yw.lastIndex)),l.push(e?{num:m}:{})}else")"===t&&l.pop()}}return n.push(...s),{pattern:e,captureTransfers:i,hiddenCaptures:n}}(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:"external"}),s=function(e){if(!new RegExp(`${mw}\\+`).test(e))return{pattern:e};let t,n=[],a=null,i=null,r="",s=0;for(dw.lastIndex=0;t=dw.exec(e);){let{0:o,index:c,groups:{qBase:l,qMod:p,invalidQ:u}}=t;if("["===o)s||(i=c),s++;else if("]"===o)s?s--:i=null;else if(!s)if("+"===p&&r&&!r.startsWith("(")){if(u)throw new Error(`Invalid quantifier "${o}"`);let t=-1;if(/^\{\d+\}$/.test(l))e=rw(e,c+l.length,p,"");else{if(")"===r||"]"===r){let t=")"===r?a:i;if(null===t)throw new Error(`Invalid unmatched "${r}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${l})${e.slice(c+o.length)}`}else e=`${e.slice(0,c-r.length)}(?>${r}${l})${e.slice(c+o.length)}`;t+=4}dw.lastIndex+=t}else"("===o[0]?n.push(c):")"===o&&(a=n.length?n.pop():null);r=o}return{pattern:e}}(r.pattern),o=function(e,t){let n=t?.hiddenCaptures??[],a=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:a,hiddenCaptures:n};let i,r=[0],s=[],o=0,c=0,l=NaN;do{i=!1;let t,p=0,u=0,m=!1;for(uw.lastIndex=Number.isNaN(l)?0:l+7;t=uw.exec(e);){let{0:d,index:h,groups:{capturingStart:g,noncapturingStart:b}}=t;if("["===d)p++;else if(p)"]"===d&&p--;else if("(?>"!==d||m){if(m&&b)u++;else if(g)m?u++:(o++,r.push(o+c));else if(")"===d&&m){if(!u){c++;let t=o+c;if(e=`${e.slice(0,l)}(?:(?=(${e.slice(l+3,h)}))<$$${t}>)${e.slice(h+1)}`,i=!0,s.push(t),iw(n,t),a.size){let e=new Map;a.forEach((n,a)=>{e.set(a>=t?a+1:a,n.map(e=>e>=t?e+1:e))}),a=e}break}u--}}else l=h,m=!0}}while(i);return n.push(...s),{pattern:e=ow(e,String.raw`\\(?[1-9]\d*)|<\$\$(?\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){let n=+t;if(n>r.length-1)throw new Error(`Backref "${e}" greater than number of captures`);return`\\${r[n]}`}return`\\${n}`},sw.DEFAULT),captureTransfers:a,hiddenCaptures:n}}(s.pattern,{captureTransfers:r.captureTransfers,hiddenCaptures:r.hiddenCaptures}),c={pattern:o.pattern,flags:`${n.hasIndices?"d":""}${n.global?"g":""}${i.flags}${i.options.disable.v?"u":"v"}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw new Error("Lazy compilation requires subclass")}else{let e=o.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(o.captureTransfers),i=a._strategy,r=c.pattern.length>=n.lazyCompileLength;(e.length||t.length||i||r)&&(c.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...i&&{strategy:i},...r&&{lazyCompile:r}})}return c}(e,t);return n.options?new kv(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}var $v,Cv=class{constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:n=!1,cache:a,regexConstructor:i}=t;if(!i)throw new Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if("string"!=typeof e)return e;let t=a?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return a?.set(e,t),t}catch(t){if(a?.set(e,t),n)return null;throw t}})}regexps;findNextMatchSync(e,t,n){let a="string"==typeof e?e:e.content,i=[];function r(e,t,n=0){return{index:e,captureIndices:t.indices.map(e=>null==e?{start:4294967295,end:4294967295,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let e=0;ee[1].index));for(let[t,n,a]of i)if(n.index===e)return r(t,n,a)}return null}};function jv(e={}){let t=Object.assign({target:"auto",cache:new Map},e);return t.regexConstructor||=e=>function(e,t){return vv(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}(e,{target:t.target}),{createScanner:e=>new Cv(e,t),createString:e=>({content:e})}}function Av({tokens:e,selectedLine:t}){let n=1===e.tokens.length;return(0,_.jsx)("code",{children:e.tokens.map((e,a)=>(0,_.jsx)("span",{className:`line ${n?"inline":"block"} ${t===a+1?`${hf} bg-primary-200/25`:""}`,children:0===e.length?(0,_.jsx)("br",{}):e.map((e,t)=>(0,_.jsx)("span",{className:"token",style:Jx(e),children:e.content},t))},a))})}function Ev({code:e,selectedLine:t}){let n=e.split("\n"),a=1===n.length;return(0,_.jsx)("code",{children:n.map((e,n)=>(0,_.jsx)("span",{className:`line ${a?"inline":"block"} ${t===n+1?`${hf} bg-primary-200/25`:""}`,children:0===e.length?(0,_.jsx)("br",{}):e.split(" ").map((e,t)=>(0,_.jsx)("span",{className:"token",children:`${0===t?"":" "}${e}`},t))},n))})}function Sv({code:e,language:t,selectedLine:n}){let a=(void 0===$v&&($v=Qx({...tk,engine:jv()})),$v);if(!a.getLoadedLanguages().includes(t))return(0,_.jsx)(Ev,{code:e,selectedLine:n});let i=a.codeToTokens(e,{lang:t,theme:ek});return(0,_.jsx)(Av,{tokens:i,selectedLine:n})}function Fv({code:e,language:t,lines:n,copyButton:a=!0,selectedLine:i,className:r,inline:s,size:o}){let c=s??(void 0===n&&1===e.split("\n").length),l=t?(0,_.jsx)(Sv,{code:e,language:t,selectedLine:i}):(0,_.jsx)(Ev,{code:e,selectedLine:i});return c?(0,_.jsx)(bf,{className:r,size:o,children:l}):(0,_.jsx)(gf,{code:e,lines:n,copyButton:a,className:r,size:o,children:l})}function Tv(e){return Array.isArray?Array.isArray(e):"[object Array]"===Rv(e)}function zv(e){return"string"==typeof e}function Nv(e){return"number"==typeof e}function qv(e){return"object"==typeof e}function Pv(e){return null!=e}function Lv(e){return!e.trim().length}function Rv(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}var Iv=Object.prototype.hasOwnProperty,Zv=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=Mv(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function Mv(e){let t=null,n=null,a=null,i=1,r=null;if(zv(e)||Tv(e))a=e,t=Ov(e),n=Uv(e);else{if(!Iv.call(e,"name"))throw new Error("Missing name property in key");let s=e.name;if(a=s,Iv.call(e,"weight")&&(i=e.weight,i<=0))throw new Error((e=>`Property 'weight' in key '${e}' must be a positive integer`)(s));t=Ov(s),n=Uv(s),r=e.getFn}return{path:t,id:n,weight:i,src:a,getFn:r}}function Ov(e){return Tv(e)?e:e.split(".")}function Uv(e){return Tv(e)?e.join("."):e}var Wv={useExtendedSearch:!1,getFn:function(e,t){let n=[],a=!1,i=(e,t,r)=>{if(Pv(e))if(t[r]){let s=e[t[r]];if(!Pv(s))return;if(r===t.length-1&&(zv(s)||Nv(s)||function(e){return!0===e||!1===e||function(e){return qv(e)&&null!==e}(e)&&"[object Boolean]"==Rv(e)}(s)))n.push(function(e){return null==e?"":function(e){if("string"==typeof e)return e;let t=e+"";return"0"==t&&1/e==-1/0?"-0":t}(e)}(s));else if(Tv(s)){a=!0;for(let e=0,n=s.length;ee.score===t.score?e.idx{this._keysMap[e.id]=t})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,zv(this.docs[0])?this.docs.forEach((e,t)=>{this._addString(e,t)}):this.docs.forEach((e,t)=>{this._addObject(e,t)}),this.norm.clear())}add(e){let t=this.size();zv(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,n=this.size();t{let i=t.getFn?t.getFn(e):this.getFn(e,t.path);if(Pv(i))if(Tv(i)){let e=[],t=[{nestedArrIndex:-1,value:i}];for(;t.length;){let{nestedArrIndex:n,value:a}=t.pop();if(Pv(a))if(zv(a)&&!Lv(a)){let t={v:a,i:n,n:this.norm.get(a)};e.push(t)}else Tv(a)&&a.forEach((e,n)=>{t.push({nestedArrIndex:n,value:e})})}n.$[a]=e}else if(zv(i)&&!Lv(i)){let e={v:i,n:this.norm.get(i)};n.$[a]=e}}),this.records.push(n)}toJSON(){return{keys:this.keys,records:this.records}}};function Vv(e,t,{getFn:n=Dv.getFn,fieldNormWeight:a=Dv.fieldNormWeight}={}){let i=new Gv({getFn:n,fieldNormWeight:a});return i.setKeys(e.map(Mv)),i.setSources(t),i.create(),i}function Hv(e,{errors:t=0,currentLocation:n=0,expectedLocation:a=0,distance:i=Dv.distance,ignoreLocation:r=Dv.ignoreLocation}={}){let s=t/e.length;if(r)return s;let o=Math.abs(a-n);return i?s+o/i:o?1:s}var Xv=32;function Yv(e){let t={};for(let n=0,a=e.length;ne.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):e=>e,Qv=class{constructor(e,{location:t=Dv.location,threshold:n=Dv.threshold,distance:a=Dv.distance,includeMatches:i=Dv.includeMatches,findAllMatches:r=Dv.findAllMatches,minMatchCharLength:s=Dv.minMatchCharLength,isCaseSensitive:o=Dv.isCaseSensitive,ignoreDiacritics:c=Dv.ignoreDiacritics,ignoreLocation:l=Dv.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:a,includeMatches:i,findAllMatches:r,minMatchCharLength:s,isCaseSensitive:o,ignoreDiacritics:c,ignoreLocation:l},e=o?e:e.toLowerCase(),e=c?Kv(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let p=(e,t)=>{this.chunks.push({pattern:e,alphabet:Yv(e),startIndex:t})},u=this.pattern.length;if(u>Xv){let e=0,t=u%Xv,n=u-t;for(;e{let{isMatch:h,score:g,indices:b}=function(e,t,n,{location:a=Dv.location,distance:i=Dv.distance,threshold:r=Dv.threshold,findAllMatches:s=Dv.findAllMatches,minMatchCharLength:o=Dv.minMatchCharLength,includeMatches:c=Dv.includeMatches,ignoreLocation:l=Dv.ignoreLocation}={}){if(t.length>Xv)throw new Error("Pattern length exceeds max of 32.");let p,u=t.length,m=e.length,d=Math.max(0,Math.min(a,m)),h=r,g=d,b=o>1||c,f=b?Array(m):[];for(;(p=e.indexOf(t,g))>-1;){let e=Hv(t,{currentLocation:p,expectedLocation:d,distance:i,ignoreLocation:l});if(h=Math.min(e,h),g=p+u,b){let e=0;for(;e=c;r-=1){let s=r-1,o=n[e.charAt(s)];if(b&&(f[s]=+!!o),w[r]=(w[r+1]<<1|1)&o,a&&(w[r]|=(_[r+1]|_[r])<<1|1|_[r+1]),w[r]&k&&(y=Hv(t,{errors:a,currentLocation:s,expectedLocation:d,distance:i,ignoreLocation:l}),y<=h)){if(h=y,g=s,g<=d)break;c=Math.max(1,2*d-g)}}if(Hv(t,{errors:a+1,currentLocation:d,expectedLocation:d,distance:i,ignoreLocation:l})>h)break;_=w}let w={isMatch:g>=0,score:Math.max(.001,y)};if(b){let e=function(e=[],t=Dv.minMatchCharLength){let n=[],a=-1,i=-1,r=0;for(let s=e.length;r=t&&n.push([a,i]),a=-1)}return e[r-1]&&r-a>=t&&n.push([a,r-1]),n}(f,o);e.length?c&&(w.indices=e):w.isMatch=!1}return w}(e,t,n,{location:i+d,distance:r,threshold:s,findAllMatches:o,minMatchCharLength:c,includeMatches:a,ignoreLocation:l});h&&(m=!0),u+=g,h&&b&&(p=[...p,...b])});let d={isMatch:m,score:m?u/this.chunks.length:1};return m&&a&&(d.indices=p),d}},Jv=class{constructor(e){this.pattern=e}static isMultiMatch(e){return e$(e,this.multiRegex)}static isSingleMatch(e){return e$(e,this.singleRegex)}search(){}};function e$(e,t){let n=e.match(t);return n?n[1]:null}var t$=class extends Jv{constructor(e,{location:t=Dv.location,threshold:n=Dv.threshold,distance:a=Dv.distance,includeMatches:i=Dv.includeMatches,findAllMatches:r=Dv.findAllMatches,minMatchCharLength:s=Dv.minMatchCharLength,isCaseSensitive:o=Dv.isCaseSensitive,ignoreDiacritics:c=Dv.ignoreDiacritics,ignoreLocation:l=Dv.ignoreLocation}={}){super(e),this._bitapSearch=new Qv(e,{location:t,threshold:n,distance:a,includeMatches:i,findAllMatches:r,minMatchCharLength:s,isCaseSensitive:o,ignoreDiacritics:c,ignoreLocation:l})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}},n$=class extends Jv{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,n=0,a=[],i=this.pattern.length;for(;(t=e.indexOf(this.pattern,n))>-1;)n=t+i,a.push([t,n-1]);let r=!!a.length;return{isMatch:r,score:r?0:1,indices:a}}},a$=[class extends Jv{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){let t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},n$,class extends Jv{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){let t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},class extends Jv{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){let t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends Jv{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){let t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends Jv{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){let t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},class extends Jv{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){let t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},t$],i$=a$.length,r$=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,s$=new Set([t$.type,n$.type]),o$=[];function c$(e,t){for(let n=0,a=o$.length;n!(!e[l$]&&!e.$or),m$=e=>({[l$]:Object.keys(e).map(t=>({[t]:e[t]}))});function d$(e,t,{auto:n=!0}={}){let a=e=>{let i=Object.keys(e),r=(e=>!!e[p$])(e);if(!r&&i.length>1&&!u$(e))return a(m$(e));if((e=>!Tv(e)&&qv(e)&&!u$(e))(e)){let a=r?e[p$]:i[0],s=r?e.$val:e[a];if(!zv(s))throw new Error((e=>`Invalid value for key ${e}`)(a));let o={keyId:Uv(a),pattern:s};return n&&(o.searcher=c$(s,t)),o}let s={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];Tv(n)&&n.forEach(e=>{s.children.push(a(e))})}),s};return u$(e)||(e=m$(e)),a(e)}function h$(e,t){let n=e.matches;t.matches=[],Pv(n)&&n.forEach(e=>{if(!Pv(e.indices)||!e.indices.length)return;let{indices:n,value:a}=e,i={indices:n,value:a};e.key&&(i.key=e.key.src),e.idx>-1&&(i.refIndex=e.idx),t.matches.push(i)})}function g$(e,t){t.score=e.score}var b$=class{constructor(e,t={},n){this.options={...Dv,...t},this.options.useExtendedSearch,this._keyStore=new Zv(this.options.keys),this.setCollection(e,n)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof Gv))throw new Error("Incorrect 'index' type");this._myIndex=t||Vv(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){Pv(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){let t=[];for(let n=0,a=this._docs.length;n{let n=1;e.matches.forEach(({key:e,norm:a,score:i})=>{let r=e?e.weight:null;n*=Math.pow(0===i&&r?Number.EPSILON:i,(r||1)*(t?1:a))}),e.score=n})}(o,{ignoreFieldNorm:s}),i&&o.sort(r),Nv(t)&&t>-1&&(o=o.slice(0,t)),function(e,t,{includeMatches:n=Dv.includeMatches,includeScore:a=Dv.includeScore}={}){let i=[];return n&&i.push(h$),a&&i.push(g$),e.map(e=>{let{idx:n}=e,a={item:t[n],refIndex:n};return i.length&&i.forEach(t=>{t(e,a)}),a})}(o,this._docs,{includeMatches:n,includeScore:a})}_searchStringList(e){let t=c$(e,this.options),{records:n}=this._myIndex,a=[];return n.forEach(({v:e,i:n,n:i})=>{if(!Pv(e))return;let{isMatch:r,score:s,indices:o}=t.searchIn(e);r&&a.push({item:e,idx:n,matches:[{score:s,value:e,norm:i,indices:o}]})}),a}_searchLogical(e){let t=d$(e,this.options),n=(e,t,a)=>{if(!e.children){let{keyId:n,searcher:i}=e,r=this._findMatches({key:this._keyStore.get(n),value:this._myIndex.getValueForItemAtKeyId(t,n),searcher:i});return r&&r.length?[{idx:a,item:t,matches:r}]:[]}let i=[];for(let r=0,s=e.children.length;r{if(Pv(e)){let s=n(t,e,a);s.length&&(i[a]||(i[a]={idx:a,item:e,matches:[]},r.push(i[a])),s.forEach(({matches:e})=>{i[a].matches.push(...e)}))}}),r}_searchObjectList(e){let t=c$(e,this.options),{keys:n,records:a}=this._myIndex,i=[];return a.forEach(({$:e,i:a})=>{if(!Pv(e))return;let r=[];n.forEach((n,a)=>{r.push(...this._findMatches({key:n,value:e[a],searcher:t}))}),r.length&&i.push({idx:a,item:e,matches:r})}),i}_findMatches({key:e,value:t,searcher:n}){if(!Pv(t))return[];let a=[];if(Tv(t))t.forEach(({v:t,i,n:r})=>{if(!Pv(t))return;let{isMatch:s,score:o,indices:c}=n.searchIn(t);s&&a.push({score:o,key:e,value:t,idx:i,norm:r,indices:c})});else{let{v:i,n:r}=t,{isMatch:s,score:o,indices:c}=n.searchIn(i);s&&a.push({score:o,key:e,value:i,norm:r,indices:c})}return a}};b$.version="7.1.0",b$.createIndex=Vv,b$.parseIndex=function(e,{getFn:t=Dv.getFn,fieldNormWeight:n=Dv.fieldNormWeight}={}){let{keys:a,records:i}=e,r=new Gv({getFn:t,fieldNormWeight:n});return r.setKeys(a),r.setIndexRecords(i),r},b$.config=Dv,b$.parseQuery=d$,function(...e){o$.push(...e)}(class{constructor(e,{isCaseSensitive:t=Dv.isCaseSensitive,ignoreDiacritics:n=Dv.ignoreDiacritics,includeMatches:a=Dv.includeMatches,minMatchCharLength:i=Dv.minMatchCharLength,ignoreLocation:r=Dv.ignoreLocation,findAllMatches:s=Dv.findAllMatches,location:o=Dv.location,threshold:c=Dv.threshold,distance:l=Dv.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:n,includeMatches:a,minMatchCharLength:i,findAllMatches:s,ignoreLocation:r,location:o,threshold:c,distance:l},e=t?e:e.toLowerCase(),e=n?Kv(e):e,this.pattern=e,this.query=function(e,t={}){return e.split("|").map(e=>{let n=e.trim().split(r$).filter(e=>e&&!!e.trim()),a=[];for(let e=0,i=n.length;es(e=>"open"===e?"closed":"open"),[]),p=(0,l.useCallback)(()=>s("full"),[]),u=(0,l.useCallback)(()=>s("closed"),[]),m=(0,l.useCallback)(e=>{e&&n?.current&&e.scrollTo({top:n.current.offsetTop-e.clientHeight/2,left:0,behavior:"smooth"})},[n]),d=o?{duration:0}:{type:"tween",duration:.25,ease:"easeOut"},h=o?{duration:0}:{type:"tween",duration:.2,ease:"easeOut"},g=o?{duration:0}:{type:"spring",stiffness:320,damping:32},b={title:e,controls:t,onMinimize:c,onMaximize:p,onClose:u};return(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(Xl,{children:"full"===r&&(0,_.jsx)(uf.div,{className:"bg-primary-950/30 fixed inset-0 z-40 backdrop-blur-sm",initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},transition:h,"aria-hidden":!0,onClick:c},"backdrop")}),(0,_.jsx)(Xl,{children:"full"===r&&(0,_.jsxs)(uf.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},exit:{opacity:0,scale:.96},transition:g,"aria-modal":!0,role:"dialog",className:`${_$} ${Oc} fixed inset-x-4 inset-y-[5vh] z-50 flex flex-col sm:inset-x-6 md:inset-x-8 ${a||""}`,children:[(0,_.jsx)(y$,{...b}),(0,_.jsx)("div",{ref:m,className:"bg-primary-900 min-h-0 flex-1 overflow-auto",children:i})]},"full-card")}),"full"!==r&&(0,_.jsxs)("div",{className:`${_$} ${Oc} relative w-full ${a||""}`,children:[(0,_.jsx)(y$,{...b}),(0,_.jsx)(uf.div,{initial:{height:"closed"===r?0:"auto"},animate:{height:"closed"===r?0:"auto"},transition:d,className:"bg-primary-900 w-full overflow-hidden",children:(0,_.jsx)("div",{ref:m,className:"max-h-[80vh] w-full overflow-auto",children:i})})]})]})}class k${constructor(){this.error="||@ error.error @||",this.description="||@ error.description @||",this.traceback=JSON.parse("||@ error.traceback|safe_json @||")}}const w$=function(e){return(new DOMParser).parseFromString(e,"text/html").body.textContent||""};function v$(e){let t=e.frame,n=e.isActive;const a=t.filename.length>35&&t.filename.split("/").length>2?t.filename.split("/",1).concat(["...",t.filename.split("/").slice(-1)[0]]):t.filename.split("/");return(0,_.jsx)("div",{className:"border-primary-300 shadow-primary-300 -mt-px border shadow-md transition duration-200 ".concat(n?"bg-primary-200":"bg-primary-100 hover:bg-flama-300 hover:shadow-flama-300 hover:shadow-lg"),children:(0,_.jsxs)("div",{className:"flex h-12 w-full cursor-pointer items-center justify-start transition duration-200 ".concat(n?"border-primary-300 border-l-4":"hover:border-flama-500 border-primary-100 pl-1 hover:border-l-4 hover:pl-0"),children:[(0,_.jsx)("div",{className:"flex h-8 w-8 items-center justify-center pl-1 ".concat(t.vendor?"text-flama-400":"text-primary-500"),children:(0,_.jsx)(To,{className:"h-2 w-2"})}),(0,_.jsxs)("div",{className:"text-primary-600 overflow-hidden font-mono text-xs ".concat(n?"border-current font-semibold":"hover:text-primary-800"),children:[(0,_.jsxs)("div",{children:[a.map((e,n)=>(0,_.jsxs)(l.Fragment,{children:[n>0&&(0,_.jsx)("span",{children:"/"}),(0,_.jsx)("span",{className:0===n&&t.vendor?"text-flama-500":"",children:e})]},"filename-".concat(n))),(0,_.jsx)("span",{children:":"}),(0,_.jsx)("span",{children:t.line})]}),(0,_.jsx)("div",{className:"truncate",children:(0,_.jsx)("span",{className:"italic",children:t.function})})]})]})})}function $$(e){let t=e.traceback,n=e.selected,a=e.setSelected;const i=(0,l.useRef)(null),r=(0,l.useRef)(null);return(0,l.useEffect)(()=>{i.current&&r.current&&r.current.scrollTo({top:i.current.offsetTop-r.current.clientHeight/2,left:0,behavior:"smooth"})},[i,r]),(0,_.jsx)("ul",{ref:r,className:"mt-px h-full w-full overflow-y-scroll py-6 pr-3 pl-2",children:t.map((e,t)=>(0,_.jsx)("li",{ref:n===t?i:void 0,onClick:()=>a(t),children:(0,_.jsx)(v$,{frame:e,isActive:n===t})},"traceback-frame-".concat(t)))})}function C$(){const e=(new k$).traceback,t=r((0,l.useState)(e.length-1),2),n=t[0],a=t[1],i=(0,l.useMemo)(()=>w$(e[n].code),[n,e]);return(0,_.jsxs)("div",{className:"flex flex-col gap-8 lg:flex-row",children:[(0,_.jsx)("div",{className:"h-[672px] max-h-[calc(85vh)] w-full flex-none overflow-hidden lg:w-xs",children:(0,_.jsx)($$,{traceback:e,selected:n,setSelected:a})}),(0,_.jsx)("div",{className:"h-[672px] max-h-[calc(85vh)] flex-auto overflow-hidden",children:(0,_.jsx)(x$,{title:e[n].filename,children:(0,_.jsx)(Fv,{code:i,language:"python",lines:{type:"number"},selectedLine:e[n].line})})})]})}n(39828),n(29462),n(8415),n(39490),n(18208),n(86100),n(40106),n(26572),n(35534),n(25833),n(85459),n(16137),n(67148),n(4514);class j${constructor(){this.path="||@ request.path @||",this.method="||@ request.method @||",this.clientHost="||@ request.client.host @||",this.clientPort=parseInt("||@ request.client.port @||"),this.pathParams=new Map(Object.entries(JSON.parse("||@ request.params.path|safe_json @||"))),this.queryParams=new Map(Object.entries(JSON.parse("||@ request.params.query|safe_json @||"))),this.headers=new Map(Object.entries(JSON.parse("||@ request.headers|safe_json @||"))),this.cookies=new Map(Object.entries(JSON.parse("||@ request.cookies|safe_json @||")))}}function A$(e){let t=e.children;return(0,_.jsx)("table",{className:"border-primary-300 w-full table-fixed border-collapse overflow-hidden border",children:(0,_.jsx)("tbody",{className:"text-left text-wrap",children:t})})}const E$=["header","children"];function S$(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function F$(e){for(var t=1;t{let n=r(e,2),a=n[0],i=n[1];return(0,_.jsxs)("li",{children:[(0,_.jsx)("span",{className:"font-semibold",children:"".concat(a,":")}),(0,_.jsx)("span",{className:"ml-1",children:(0,_.jsx)(z$,{value:i})})]},t)})})}function q$(){const e=new j$,t=e.path,n=e.method,a=e.pathParams,i=e.queryParams,r=e.headers,s=e.cookies,o=e.clientHost,c=e.clientPort;return(0,_.jsxs)(A$,{children:[(0,_.jsx)(T$,{header:"Path",children:(0,_.jsx)(z$,{value:t})}),(0,_.jsx)(T$,{header:"Method",children:(0,_.jsx)(z$,{value:n})}),(0,_.jsx)(T$,{header:"Query parameters",children:(0,_.jsx)(N$,{map:i})}),(0,_.jsx)(T$,{header:"Path parameters",children:(0,_.jsx)(N$,{map:a})}),(0,_.jsx)(T$,{header:"Headers",children:(0,_.jsx)(N$,{map:r})}),(0,_.jsx)(T$,{header:"Cookies",children:(0,_.jsx)(N$,{map:s})}),o&&(0,_.jsx)(T$,{header:"Client host",children:(0,_.jsx)(z$,{value:o})}),c&&(0,_.jsx)(T$,{header:"Client port",children:(0,_.jsx)(z$,{value:String(c)})})]})}class P${constructor(){this.pythonVersion="||@ environment.python_version|safe @||",this.python="||@ environment.python|safe @||",this.platform="||@ environment.platform|safe @||",this.path=JSON.parse("||@ environment.path|safe_json @||")}}function L$(e){let t=e.array;return(0,_.jsx)("ul",{children:t.map((e,t)=>(0,_.jsx)("li",{children:(0,_.jsx)(z$,{value:e})},t))})}function R$(){const e=new P$,t=e.pythonVersion,n=e.python,a=e.platform,i=e.path;return(0,_.jsxs)(A$,{children:[(0,_.jsx)(T$,{header:"Python version",children:(0,_.jsx)(z$,{value:t})}),(0,_.jsx)(T$,{header:"Python",children:(0,_.jsx)(z$,{value:n})}),(0,_.jsx)(T$,{header:"Platform",children:(0,_.jsx)(z$,{value:a})}),(0,_.jsx)(T$,{header:"Path",children:(0,_.jsx)(L$,{array:i})})]})}function I$(){const e=new k$,t=new j$;return(0,_.jsxs)("div",{children:[(0,_.jsx)(bo,{}),(0,_.jsxs)("div",{className:"mt-[calc(3.5rem+1px)] h-[calc(100vh-6.5rem-2px)] overflow-auto",children:[(0,_.jsx)("header",{children:(0,_.jsx)(So,{id:"error",border:!1,children:(0,_.jsx)(Fo,{error:e.error,path:t.path,method:t.method,description:e.description})})}),(0,_.jsxs)("main",{children:[(0,_.jsx)(So,{id:"traceback",title:"Traceback",children:(0,_.jsx)(C$,{})}),(0,_.jsx)(So,{id:"request",title:"Request",children:(0,_.jsx)(q$,{})}),(0,_.jsx)(So,{id:"environment",title:"Environment",children:(0,_.jsx)(R$,{})})]})]}),(0,_.jsx)(Co,{})]})}a.createRoot(document.getElementById("app")).render((0,_.jsx)(I$,{}))})();