@usine/server 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +37 -21
- package/dist/backend.d.ts +24 -5
- package/dist/backend.d.ts.map +1 -1
- package/dist/backend.js +37 -16
- package/dist/backend.js.map +1 -1
- package/dist/backup.d.ts +6 -3
- package/dist/backup.d.ts.map +1 -1
- package/dist/backup.js +25 -5
- package/dist/backup.js.map +1 -1
- package/dist/cli.d.ts +20 -7
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +65 -15
- package/dist/cli.js.map +1 -1
- package/dist/export-run.d.ts +1 -1
- package/dist/export-run.d.ts.map +1 -1
- package/dist/export-run.js +3 -3
- package/dist/export-run.js.map +1 -1
- package/dist/failure-message.d.ts +13 -0
- package/dist/failure-message.d.ts.map +1 -0
- package/dist/failure-message.js +58 -0
- package/dist/failure-message.js.map +1 -0
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +64 -23
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/instance-lock.d.ts +23 -0
- package/dist/instance-lock.d.ts.map +1 -0
- package/dist/instance-lock.js +58 -0
- package/dist/instance-lock.js.map +1 -0
- package/dist/main.js +4 -10
- package/dist/main.js.map +1 -1
- package/dist/reload-signal.d.ts +8 -0
- package/dist/reload-signal.d.ts.map +1 -0
- package/dist/reload-signal.js +21 -0
- package/dist/reload-signal.js.map +1 -0
- package/dist/shutdown.d.ts +5 -2
- package/dist/shutdown.d.ts.map +1 -1
- package/dist/shutdown.js +11 -5
- package/dist/shutdown.js.map +1 -1
- package/dist/up.d.ts +1 -1
- package/dist/up.d.ts.map +1 -1
- package/dist/up.js +29 -16
- package/dist/up.js.map +1 -1
- package/dist/web/assets/DialogTitle-DrHlwOSg.js +1 -0
- package/dist/web/assets/_agent-cBqm12lE.js +1 -0
- package/dist/web/assets/_loop-kf1h3qkS.js +1 -0
- package/dist/web/assets/_name-CKWcxUh0.js +2 -0
- package/dist/web/assets/_name-DCEDRHnF.js +1 -0
- package/dist/web/assets/_name-sJkGyn7O.js +1 -0
- package/dist/web/assets/_number-DbgcVg1N.js +1 -0
- package/dist/web/assets/_run-DqslP0y6.js +8 -0
- package/dist/web/assets/_worker-CH4UoJT_.js +1 -0
- package/dist/web/assets/action-DYT048Jm.js +1 -0
- package/dist/web/assets/agents-DIZolb0U.js +1 -0
- package/dist/web/assets/agents-DMhSMb9O.js +1 -0
- package/dist/web/assets/button-C4yvcSko.js +2 -0
- package/dist/web/assets/copy-BM1l6IGB.js +1 -0
- package/dist/web/assets/core-BUmsKffF.js +12 -0
- package/dist/web/assets/engine-javascript-D-6se_EF.js +141 -0
- package/dist/web/assets/error-alert-BrI00JbQ.js +1 -0
- package/dist/web/assets/file-error-C--_cWuj.js +1 -0
- package/dist/web/assets/index-BljdfRBm.js +10 -0
- package/dist/web/assets/index-YKcAk3No.css +2 -0
- package/dist/web/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
- package/dist/web/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
- package/dist/web/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
- package/dist/web/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
- package/dist/web/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
- package/dist/web/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
- package/dist/web/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
- package/dist/web/assets/item-rBBCTV8x.js +1 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/web/assets/label-badge-ohqvZnY7.js +1 -0
- package/dist/web/assets/loops-CXM3f90o.js +1 -0
- package/dist/web/assets/loops-DWLXyUPN.js +1 -0
- package/dist/web/assets/markdown-D07-JkYB.js +29 -0
- package/dist/web/assets/moves-RiWgdCxQ.js +5 -0
- package/dist/web/assets/operator-copy-DsM7LJx6.js +301 -0
- package/dist/web/assets/outcome-YiIf6xbJ.js +5 -0
- package/dist/web/assets/project-not-found-CQVclgb0.js +1 -0
- package/dist/web/assets/query-DWN8IHdt.js +1 -0
- package/dist/web/assets/repositories-CoTEmYmS.js +1 -0
- package/dist/web/assets/repositories-Cq7zGzNb.js +1 -0
- package/dist/web/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/web/assets/route-CE9U74a9.js +1 -0
- package/dist/web/assets/route-DNH2EwHP.js +1 -0
- package/dist/web/assets/routes-XAUJJqfj.js +1 -0
- package/dist/web/assets/run-again-DxjFCuNu.js +1 -0
- package/dist/web/assets/run-drawer-CyjxH5mf.js +1 -0
- package/dist/web/assets/section-BBnBOk-U.js +1 -0
- package/dist/web/assets/section-Cm-j3zHs.js +1 -0
- package/dist/web/assets/section-DkBCDv4D.js +1 -0
- package/dist/web/assets/settings-iZf872O5.js +1 -0
- package/dist/web/assets/status-badge-CNlyvwWL.js +1 -0
- package/dist/web/assets/table-B6NH8hTW.js +1 -0
- package/dist/web/assets/tasks-DhLW-1gg.js +1 -0
- package/dist/web/assets/usage-DPUTTLGs.js +1 -0
- package/dist/web/assets/use-now-CcFZyFvf.js +1 -0
- package/dist/web/assets/useNavigate-lXd3v3E0.js +1 -0
- package/dist/web/assets/usePositioner-WErrA3Ah.js +1 -0
- package/dist/web/assets/useScrollLock-BOb01sL8.js +1 -0
- package/dist/web/assets/useTriggerFocusGuards-B0FItfLc.js +1 -0
- package/dist/web/assets/utils-BEQKLGgi.js +1 -0
- package/dist/web/assets/with-selector-NsM_5qXG.js +1 -0
- package/dist/web/assets/workers-BgocBXT9.js +1 -0
- package/dist/web/assets/workers-Dw2uHY0Y.js +1 -0
- package/dist/web/index.html +13 -10
- package/package.json +13 -9
- package/dist/web/assets/_name-DdyMEUN6.js +0 -6
- package/dist/web/assets/_name-eoobiMh0.js +0 -1
- package/dist/web/assets/_name-pUxlKZt5.js +0 -1
- package/dist/web/assets/badge-t7m0Vk1K.js +0 -146
- package/dist/web/assets/button-BoOukj77.js +0 -1
- package/dist/web/assets/core-CLXRiB63.js +0 -12
- package/dist/web/assets/empty-DbVYU7bi.js +0 -1
- package/dist/web/assets/engine-javascript-h-x4hGa4.js +0 -141
- package/dist/web/assets/geist-cyrillic-ext-wght-normal-DjL33-gN.woff2 +0 -0
- package/dist/web/assets/geist-cyrillic-wght-normal-BEAKL7Jp.woff2 +0 -0
- package/dist/web/assets/geist-latin-ext-wght-normal-DC-KSUi6.woff2 +0 -0
- package/dist/web/assets/geist-latin-wght-normal-BgDaEnEv.woff2 +0 -0
- package/dist/web/assets/geist-mono-cyrillic-ext-wght-normal-X_5orZeX.woff2 +0 -0
- package/dist/web/assets/geist-mono-cyrillic-wght-normal-DiZS0aHC.woff2 +0 -0
- package/dist/web/assets/geist-mono-latin-ext-wght-normal-Bwz-egvJ.woff2 +0 -0
- package/dist/web/assets/geist-mono-latin-wght-normal-XN7g48iV.woff2 +0 -0
- package/dist/web/assets/geist-mono-symbols2-wght-normal-CO5SzqOn.woff2 +0 -0
- package/dist/web/assets/geist-mono-vietnamese-wght-normal-DadHysG0.woff2 +0 -0
- package/dist/web/assets/geist-vietnamese-wght-normal-6IgcOCM7.woff2 +0 -0
- package/dist/web/assets/index-CVBBoW6r.css +0 -2
- package/dist/web/assets/index-CsW8KcJW.js +0 -10
- package/dist/web/assets/loops-DghpuoiG.js +0 -1
- package/dist/web/assets/operator-copy-DIsVXn17.js +0 -1
- package/dist/web/assets/overview-DmCIVPwN.js +0 -1
- package/dist/web/assets/rolldown-runtime-hePW80VL.js +0 -1
- package/dist/web/assets/routes-BDyP7vCr.js +0 -1
- package/dist/web/assets/run-drawer-B-xhTXe4.js +0 -157
- package/dist/web/assets/status-badge-yblcElE0.js +0 -1
- package/dist/web/assets/table-B8cLYNvq.js +0 -1
- package/dist/web/assets/useCompositeItem-HmBmWxUW.js +0 -1
- package/dist/web/assets/with-selector-N6m4X0X_.js +0 -1
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
var e=4294967295;function t(e){return!e.sticky&&!e.rawOptions?.strategy}function n(t,n){return{index:t,captureIndices:n.map(t=>t==null?{start:e,end:e,length:0}:{start:t[0],end:t[1],length:t[1]-t[0]})}}var r=class{patterns;options;regexps;lastSearches;constructor(e,n={}){this.patterns=e,this.options=n;let{forgiving:r=!1,cache:i,regexConstructor:a}=n;if(!a)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if(typeof e!=`string`)return e;let t=i?.get(e);if(t){if(t instanceof RegExp)return t;if(r)return null;throw t}try{let t=a(e);return i?.set(e,t),t}catch(t){if(i?.set(e,t),r)return null;throw t}}),this.lastSearches=this.regexps.map(e=>e&&t(e)?{strId:0,searchedFrom:0,matchIndex:-1,indices:null}:null)}findNextMatchSync(e,t,r){let i=typeof e==`string`?e:e.content,a=typeof e==`string`?0:e.id||0,o=-1,s=0,c=null;for(let e=0;e<this.regexps.length;e++){let r=this.regexps[e];if(r)try{let l=a?this.lastSearches[e]:null,u,d;if(l&&l.strId===a&&l.searchedFrom<=t&&(l.matchIndex===-1||l.matchIndex>=t))u=l.matchIndex,d=l.indices;else{r.lastIndex=t;let e=r.exec(i);u=e?e.index:-1,d=e?e.indices:null,l&&(l.strId=a,l.searchedFrom=t,l.matchIndex=u,l.indices=d)}if(u===-1)continue;if(u===t)return n(e,d);(o===-1||u<s)&&(o=e,s=u,c=d)}catch(e){if(this.options.forgiving)continue;throw e}}return o===-1?null:n(o,c)}},i=0;function a(e){return{content:e,id:++i}}function o(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function s(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var c=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),l=String.raw;function u(e,t){if(e==null)throw Error(t??`Value expected`);return e}var d=l`\[\^?`,f=`c.? | C(?:-.?)?|${l`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${l`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${l`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${l`o\{[^\}]*\}?`}|${l`\d{1,3}`}`,p=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,m=new RegExp(l`
|
|
2
|
+
\\ (?:
|
|
3
|
+
${f}
|
|
4
|
+
| [gk]<[^>]*>?
|
|
5
|
+
| [gk]'[^']*'?
|
|
6
|
+
| .
|
|
7
|
+
)
|
|
8
|
+
| \( (?:
|
|
9
|
+
\? (?:
|
|
10
|
+
[:=!>({]
|
|
11
|
+
| <[=!]
|
|
12
|
+
| <[^>]*>
|
|
13
|
+
| '[^']*'
|
|
14
|
+
| ~\|?
|
|
15
|
+
| #(?:[^)\\]|\\.?)*
|
|
16
|
+
| [^:)]*[:)]
|
|
17
|
+
)?
|
|
18
|
+
| \*[^\)]*\)?
|
|
19
|
+
)?
|
|
20
|
+
| (?:${p.source})+
|
|
21
|
+
| ${d}
|
|
22
|
+
| .
|
|
23
|
+
`.replace(/\s+/g,``),`gsu`),h=new RegExp(l`
|
|
24
|
+
\\ (?:
|
|
25
|
+
${f}
|
|
26
|
+
| .
|
|
27
|
+
)
|
|
28
|
+
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
29
|
+
| ${d}
|
|
30
|
+
| &&
|
|
31
|
+
| .
|
|
32
|
+
`.replace(/\s+/g,``),`gsu`);function g(e,t={}){let n={flags:``,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!=`string`)throw Error(`String expected as pattern`);let r=Ce(n.flags),i=[r.extended],a={captureGroup:n.rules.captureGroup,getCurrentModX(){return i.at(-1)},numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:n.rules.singleline},o=[],s;for(m.lastIndex=0;s=m.exec(e);){let t=_(a,e,s[0],m.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(m.lastIndex=t.lastIndex)}let c=[],l=0;o.filter(e=>e.type===`GroupOpen`).forEach(e=>{e.kind===`capturing`?e.number=++l:e.raw===`(`&&c.push(e)}),l||c.forEach((e,t)=>{e.kind=`capturing`,e.number=t+1});let u=l||c.length;return{tokens:o.map(e=>e.type===`EscapedNumber`?Te(e,u):e).flat(),flags:r}}function _(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=v(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:ne(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:pe(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:re(n)}}if(a===`K`)return{token:ce(`keep`,n)};if(a===`N`||a===`R`)return{token:x(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:x(`any`,n)};if(a===`X`)return{token:x(`text_segment`,n)};let e=y(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:ve(n)};if(n===`(?{`)throw Error(`Unsupported callout "${n}"`);if(n.startsWith(`(?#`)){if(t[r]!==`)`)throw Error(`Unclosed comment group "(?#"`);return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:_e(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:S(`group`,n)};if(n===`(?>`)return{token:S(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:S(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:S(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:S(`absence_repeater`,n)}}throw Error(n===`(?(`?`Unsupported conditional "${n}"`:`Invalid or unsupported group option "${n}"`)}if(n===`)`){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error(`Unmatched ")"`);return{token:ue(n)}}if(e.getCurrentModX()){if(n===`#`){let e=t.indexOf(`
|
|
33
|
+
`,r);return{lastIndex:e===-1?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}return n===`.`?{token:x(`dot`,n)}:n===`^`||n===`$`?{token:ne(e.singleline?{"^":l`\A`,$:l`\Z`}[n]:n,n)}:n===`|`?{token:te(n)}:p.test(n)?{tokens:Ee(n)}:{token:b(o(n),n)}}function v(e,t,n){let r=[se(t[1]===`^`,t)],i=1,a;for(h.lastIndex=n;a=h.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(se(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(b(93,e));else if(i--,r.push(ie(e)),!i)break}else{let t=ee(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:h.lastIndex||e.length}}function ee(e){if(e[0]===`\\`)return y(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!c.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return x(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?ae(e):e===`&&`?oe(e):b(o(e),e)}function y(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return ge(e);if(`dDhHsSwW`.includes(n))return be(e);if(e.startsWith(l`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw Error(`Incomplete or invalid Unicode property "${e}"`);return xe(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)),r=new TextEncoder;return[...n].map(e=>{let t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join(``);return b(o(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return b(we(e),e);if(he.has(n))return b(he.get(n),e);if(/\d/.test(n))return le(t,e);if(e===`\\`)throw Error(l`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return b(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function te(e){return{type:`Alternator`,raw:e}}function ne(e,t){return{type:`Assertion`,kind:e,raw:t}}function re(e){return{type:`Backreference`,raw:e}}function b(e,t){return{type:`Character`,value:e,raw:t}}function ie(e){return{type:`CharacterClassClose`,raw:e}}function ae(e){return{type:`CharacterClassHyphen`,raw:e}}function oe(e){return{type:`CharacterClassIntersector`,raw:e}}function se(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function x(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function ce(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:u(n.flags),raw:t}}function le(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function ue(e){return{type:`GroupClose`,raw:e}}function S(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function de(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function fe(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function pe(e){return{type:`Subroutine`,raw:e}}var me=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),he=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function ge(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return b(o(t.toUpperCase())-64,e)}function _e(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=Se(n),o=Se(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),ce(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,S(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function ve(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:r,args:i}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(r===``)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(`,`).filter(e=>e!==``).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,s,c]=a,l=me.has(n)?n.toLowerCase():`custom`;switch(l){case`fail`:case`mismatch`:case`skip`:if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case`error`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(typeof o==`string`)throw Error(`Named callout argument must be a number "${o}"`);break;case`max`:if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(a.length===2&&(typeof s==`number`||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${s}"`);break;case`count`:case`total_count`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(a.length===1&&(typeof o==`number`||!/^[<>X]$/.test(o)))throw Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case`cmp`:if(a.length!==3)throw Error(`Named callout must have three arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(typeof s==`number`||!/^(?:[<>!=]=|[<>])$/.test(s))throw Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${s}"`);if(typeof c==`string`&&!/^[A-Za-z_]\w*$/.test(c))throw Error(`Named callout argument three must be a tag or number "${c}"`);break;case`custom`:throw Error(`Undefined callout name "${n}"`);default:throw Error(`Unexpected named callout kind "${l}"`)}return de(l,r??null,i?.split(`,`)??null,e)}function ye(e){let t=null,n,r;if(e[0]===`{`){let{minStr:i,maxStr:a}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+i>o||a&&+a>o)throw Error(`Quantifier value unsupported in Oniguruma`);if(n=+i,r=a===void 0?+i:a===``?1/0:+a,n>r&&(t=`possessive`,[n,r]=[r,n]),e.endsWith(`?`)){if(t===`possessive`)throw Error(`Unsupported possessive interval quantifier chain with "?"`);t=`lazy`}else t||=`greedy`}else n=+(e[0]===`+`),r=e[0]===`?`?1:1/0,t=e[1]===`+`?`possessive`:e[1]===`?`?`lazy`:`greedy`;return fe(t,n,r,e)}function be(e){let t=e[1].toLowerCase();return x({d:`digit`,h:`hex`,s:`space`,w:`word`}[t],e,{negate:e[1]!==t})}function xe(e){let{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return x(`property`,e,{value:r,negate:t===`P`&&!n||t===`p`&&!!n})}function Se(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 Ce(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){let r=e[n];if(!`imxDPSWy`.includes(r))throw Error(`Invalid flag "${r}"`);if(r===`y`){if(!/^y{[gw]}/.test(e.slice(n)))throw Error(`Invalid or unspecified flag "y" mode`);t.textSegmentMode=e[n+2]===`g`?`grapheme`:`word`,n+=3}else t[{i:`ignoreCase`,m:`dotAll`,x:`extended`,D:`digitIsAscii`,P:`posixIsAscii`,S:`spaceIsAscii`,W:`wordIsAscii`}[r]]=!0}return t}function we(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw Error(`Incomplete or invalid escape "${e}"`);let t=e[2]===`{`?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function Te(e,t){let{raw:n,inCharClass:r}=e,i=n.slice(1);if(!r&&(i!==`0`&&i.length===1||i[0]!==`0`&&+i<=t))return[re(n)];let a=[],s=i.match(/^[0-7]+|\d/g);for(let e=0;e<s.length;e++){let t=s[e],r;if(e===0&&t!==`8`&&t!==`9`){if(r=parseInt(t,8),r>127)throw Error(l`Octal encoded byte above 177 unsupported "${n}"`)}else r=o(t);a.push(b(r,(e===0?`\\`:``)+t))}return a}function Ee(e){let t=[],n=new RegExp(p,`gy`),r;for(;r=n.exec(e);){let e=r[0];if(e[0]===`{`){let r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(r){let{min:i,max:a}=r.groups;if(+i>+a&&e.endsWith(`?`)){n.lastIndex--,t.push(ye(e.slice(0,-1)));continue}}}t.push(ye(e))}return t}function De(e,t){if(!Array.isArray(e.body))throw Error(`Expected node with body array`);if(e.body.length!==1)return!1;let n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}function Oe(e){return ke.has(e.type)}var ke=new Set([`AbsenceFunction`,`Backreference`,`CapturingGroup`,`Character`,`CharacterClass`,`CharacterSet`,`Group`,`Quantifier`,`Subroutine`]);function Ae(e,t={}){let n={flags:``,normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=g(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),i=(e,t)=>{let n=r.tokens[a.nextIndex];switch(a.parent=e,a.nextIndex++,n.type){case`Alternator`:return C();case`Assertion`:return je(n);case`Backreference`:return Me(n,a);case`Character`:return w(n.value,{useLastValid:!!t.isCheckingRangeEnd});case`CharacterClassHyphen`:return Ne(n,a,t);case`CharacterClassOpen`:return Pe(n,a,t);case`CharacterSet`:return Fe(n,a);case`Directive`:return We(n.kind,{flags:n.flags});case`GroupOpen`:return Ie(n,a,t);case`NamedCallout`:return Ke(n.kind,n.tag,n.arguments);case`Quantifier`:return Le(n,a);case`Subroutine`:return Re(n,a);default:throw Error(`Unexpected token type "${n.type}"`)}},a={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:i},o=Ye(Ge(r.flags)),s=o.body[0];for(;a.nextIndex<r.tokens.length;){let e=i(s,{});e.type===`Alternative`?(o.body.push(e),s=e):s.body.push(e)}let{capturingGroups:c,hasNumberedRef:u,namedGroupsByName:d,subroutines:f}=a;if(u&&d.size&&!n.rules.captureGroup)throw Error(`Numbered backref/subroutine not allowed when using named capture`);for(let{ref:e}of f)if(typeof e==`number`){if(e>c.length)throw Error(`Subroutine uses a group number that's not defined`);e&&(c[e-1].isSubroutined=!0)}else if(d.has(e)){if(d.get(e).length>1)throw Error(l`Subroutine uses a duplicate group name "\g<${e}>"`);d.get(e)[0].isSubroutined=!0}else throw Error(l`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function je({kind:e}){return Be(u({"^":`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===l`\B`||e===l`\Y`})}function Me({raw:e},t){let n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),i=(n,r=!1)=>{let i=t.capturingGroups.length,a=!1;if(n>i){if(t.skipBackrefValidation)a=!0;else throw Error(`Not enough capturing groups defined to the left "${e}"`)}return t.hasNumberedRef=!0,Ve(r?i+1-n:n,{orphan:a})};if(n){let n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(n)return i(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(r))throw Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw Error(`Group name not defined to the left "${e}"`);return Ve(r)}return i(+r)}function Ne(e,t,n){let{tokens:r,walk:i}=t,a=t.parent,s=a.body.at(-1),c=r[t.nextIndex];if(!n.isCheckingRangeEnd&&s&&s.type!==`CharacterClass`&&s.type!==`CharacterClassRange`&&c&&c.type!==`CharacterClassOpen`&&c.type!==`CharacterClassClose`&&c.type!==`CharacterClassIntersector`){let e=i(a,{...n,isCheckingRangeEnd:!0});if(s.type===`Character`&&e.type===`Character`)return a.body.pop(),Ue(s,e);throw Error(`Invalid character class range`)}return w(o(`-`))}function Pe({negate:e},t,n){let{tokens:r,walk:i}=t,a=[T()],o=r[t.nextIndex],s=rt(o);for(;s.type!==`CharacterClassClose`;){if(s.type===`CharacterClassIntersector`)a.push(T()),t.nextIndex++;else{let e=a.at(-1);e.body.push(i(e,n))}s=rt(r[t.nextIndex],o)}let c=T({negate:e});return a.length===1?c.body=a[0].body:(c.kind=`intersection`,c.body=a.map(e=>e.body.length===1?e.body[0]:e)),t.nextIndex++,c}function Fe({kind:e,negate:t,value:n},r){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o}=r;if(e===`property`){let r=j(n);if(c.has(r)&&!o?.has(r))e=`posix`,n=r;else return k(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o})}return e===`posix`?qe(n,{negate:t}):E(e,{negate:t})}function Ie(e,t,n){let{tokens:r,capturingGroups:i,namedGroupsByName:a,skipLookbehindValidation:o,walk:c}=t,l=Ze(e),u=l.type===`AbsenceFunction`,d=et(l),f=d&&l.negate;if(l.type===`CapturingGroup`&&(i.push(l),l.name&&s(a,l.name,[]).push(l)),u&&n.isInAbsenceFunction)throw Error(`Nested absence function not supported by Oniguruma`);let p=it(r[t.nextIndex]);for(;p.type!==`GroupClose`;){if(p.type===`Alternator`)l.body.push(C()),t.nextIndex++;else{let e=l.body.at(-1),t=c(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||u,isInLookbehind:n.isInLookbehind||d,isInNegLookbehind:n.isInNegLookbehind||f});if(e.body.push(t),(d||n.isInLookbehind)&&!o){let e=`Lookbehind includes a pattern not allowed by Oniguruma`;if(f||n.isInNegLookbehind){if($e(t)||t.type===`CapturingGroup`)throw Error(e)}else if($e(t)||et(t)&&t.negate)throw Error(e)}}p=it(r[t.nextIndex])}return t.nextIndex++,l}function Le({kind:e,min:t,max:n},r){let i=r.parent,a=i.body.at(-1);if(!a||!Oe(a))throw Error(`Quantifier requires a repeatable token`);let o=Je(e,t,n,a);return i.body.pop(),o}function Re({raw:e},t){let{capturingGroups:n,subroutines:r}=t,i=e.slice(3,-1),a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(i);if(a){let e=+a.groups.num,r=n.length;if(t.hasNumberedRef=!0,i={"":e,"+":r+e,"-":r+1-e}[a.groups.sign],i<1)throw Error(`Invalid subroutine number`)}else i===`0`&&(i=0);let o=Xe(i);return r.push(o),o}function ze(e,t){if(e!==`repeater`)throw Error(`Unexpected absence function kind "${e}"`);return{type:`AbsenceFunction`,kind:e,body:A(t?.body)}}function C(e){return{type:`Alternative`,body:Qe(e?.body)}}function Be(e,t){let n={type:`Assertion`,kind:e};return(e===`word_boundary`||e===`text_segment_boundary`)&&(n.negate=!!t?.negate),n}function Ve(e,t){let n=!!t?.orphan;return{type:`Backreference`,ref:e,...n&&{orphan:n}}}function He(e,t){let n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!tt(n.name))throw Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:`CapturingGroup`,number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:A(t?.body)}}function w(e,t){let n={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(n.useLastValid)e=1114111;else throw Error(e>1310719?`Invalid code point out of range "\\x{${t}}"`:`Invalid code point out of range in JS "\\x{${t}}"`)}return{type:`Character`,value:e}}function T(e){let t={kind:`union`,negate:!1,...e};return{type:`CharacterClass`,kind:t.kind,negate:t.negate,body:Qe(e?.body)}}function Ue(e,t){if(t.value<e.value)throw Error(`Character class range out of order`);return{type:`CharacterClassRange`,min:e,max:t}}function E(e,t){let n=!!t?.negate,r={type:`CharacterSet`,kind:e};return(e===`digit`||e===`hex`||e===`newline`||e===`space`||e===`word`)&&(r.negate=n),(e===`text_segment`||e===`newline`&&!n)&&(r.variableLength=!0),r}function We(e,t={}){if(e===`keep`)return{type:`Directive`,kind:e};if(e===`flags`)return{type:`Directive`,kind:e,flags:u(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}function Ge(e){return{type:`Flags`,...e}}function D(e){let t=e?.atomic,n=e?.flags;if(t&&n)throw Error(`Atomic group cannot have flags`);return{type:`Group`,...t&&{atomic:t},...n&&{flags:n},body:A(e?.body)}}function O(e){let t={behind:!1,negate:!1,...e};return{type:`LookaroundAssertion`,kind:t.behind?`lookbehind`:`lookahead`,negate:t.negate,body:A(e?.body)}}function Ke(e,t,n){return{type:`NamedCallout`,kind:e,tag:t,arguments:n}}function qe(e,t){let n=!!t?.negate;if(!c.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:`CharacterSet`,kind:`posix`,value:e,negate:n}}function Je(e,t,n,r){if(t>n)throw Error(`Invalid reversed quantifier range`);return{type:`Quantifier`,kind:e,min:t,max:n,body:r}}function Ye(e,t){return{type:`Regex`,body:A(t?.body),flags:e}}function Xe(e){return{type:`Subroutine`,ref:e}}function k(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},r=n.unicodePropertyMap?.get(j(e));if(!r){if(n.normalizeUnknownPropertyNames)r=nt(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(l`Invalid Unicode property "\p{${e}}"`)}return{type:`CharacterSet`,kind:`property`,value:r??e,negate:n.negate}}function Ze({flags:e,kind:t,name:n,negate:r,number:i}){switch(t){case`absence_repeater`:return ze(`repeater`);case`atomic`:return D({atomic:!0});case`capturing`:return He(i,{name:n});case`group`:return D({flags:e});case`lookahead`:case`lookbehind`:return O({behind:t===`lookbehind`,negate:r});default:throw Error(`Unexpected group kind "${t}"`)}}function A(e){if(e===void 0)e=[C()];else if(!Array.isArray(e)||!e.length||!e.every(e=>e.type===`Alternative`))throw Error(`Invalid body; expected array of one or more Alternative nodes`);return e}function Qe(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw Error(`Invalid body; expected array of nodes`);return e}function $e(e){return e.type===`LookaroundAssertion`&&e.kind===`lookahead`}function et(e){return e.type===`LookaroundAssertion`&&e.kind===`lookbehind`}function tt(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function nt(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())}function j(e){return e.replace(/[- _]+/g,``).toLowerCase()}function rt(e,t){let n=t;return u(e,`Unclosed character class${n?.type===`Character`&&n.value===93&&n.raw===`]`?` (started with "]")`:``}`)}function it(e){return u(e,`Unclosed group`)}function M(e,t,n=null){function r(e,t){for(let n=0;n<e.length;n++){let r=i(e[n],t,n,e);n=Math.max(-1,n+r)}}function i(a,o=null,s=null,c=null){let l=0,d=!1,f={node:a,parent:o,key:s,container:c,root:e,remove(){N(c).splice(Math.max(0,P(s)+l),1),l--,d=!0},removeAllNextSiblings(){return N(c).splice(P(s)+1)},removeAllPrevSiblings(){let e=P(s)+l;return l-=e,N(c).splice(0,Math.max(0,e))},replaceWith(e,t={}){let n=!!t.traverse;c?c[Math.max(0,P(s)+l)]=e:u(o,`Can't replace root node`)[s]=e,n&&i(e,o,s,c),d=!0},replaceWithMultiple(e,t={}){let n=!!t.traverse;if(N(c).splice(Math.max(0,P(s)+l),1,...e),l+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=i(e[n],o,P(s)+n+t,c)}d=!0},skip(){d=!0}},{type:p}=a,m=t[`*`],h=t[p],g=typeof m==`function`?m:m?.enter,_=typeof h==`function`?h:h?.enter;if(g?.(f,n),_?.(f,n),!d)switch(p){case`AbsenceFunction`:case`Alternative`:case`CapturingGroup`:case`CharacterClass`:case`Group`:case`LookaroundAssertion`:r(a.body,a);break;case`Assertion`:case`Backreference`:case`Character`:case`CharacterSet`:case`Directive`:case`Flags`:case`NamedCallout`:case`Subroutine`:break;case`CharacterClassRange`:i(a.min,a,`min`),i(a.max,a,`max`);break;case`Quantifier`:i(a.body,a,`body`);break;case`Regex`:r(a.body,a),i(a.flags,a,`flags`);break;default:throw Error(`Unexpected node type "${p}"`)}return h?.exit?.(f,n),m?.exit?.(f,n),l}return i(e),e}function N(e){if(!Array.isArray(e))throw Error(`Container expected`);return e}function P(e){if(typeof e!=`number`)throw Error(`Numeric key expected`);return e}var at=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function ot(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function st(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var F=Object.freeze({DEFAULT:`DEFAULT`,CHAR_CLASS:`CHAR_CLASS`});function ct(e,t,n,r){let i=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,`gsu`),a=[!1],o=0,s=``;for(let t of e.matchAll(i)){let{0:e,groups:{$skip:i}}=t;!i&&(!r||r===F.DEFAULT==!o)?n instanceof Function?s+=n(t,{context:o?F.CHAR_CLASS:F.DEFAULT,negated:a[a.length-1]}):s+=n:(e[0]===`[`?(o++,a.push(e[1]===`^`)):e===`]`&&o&&(o--,a.pop()),s+=e)}return s}function lt(e,t,n,r){ct(e,t,n,r)}function ut(e,t,n=0,r){if(!new RegExp(t,`su`).test(e))return null;let i=RegExp(`${t}|(?<$skip>\\\\?.)`,`gsu`);i.lastIndex=n;let a=0,o;for(;o=i.exec(e);){let{0:e,groups:{$skip:t}}=o;if(!t&&(!r||r===F.DEFAULT==!a))return o;e===`[`?a++:e===`]`&&a&&a--,i.lastIndex==o.index&&i.lastIndex++}return null}function I(e,t,n){return!!ut(e,t,0,n)}function dt(e,t){let n=/\\?./gsu;n.lastIndex=t;let r=e.length,i=0,a=1,o;for(;o=n.exec(e);){let[e]=o;if(e===`[`)i++;else if(i)e===`]`&&i--;else if(e===`(`)a++;else if(e===`)`&&(a--,!a)){r=o.index;break}}return e.slice(t,r)}var ft=new RegExp(String.raw`(?<noncapturingStart>${at})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,`gsu`);function pt(e,t){let n=t?.hiddenCaptures??[],r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};let i=[0],a=[],o=0,s=0,c=NaN,l;do{l=!1;let t=0,u=0,d=!1,f;for(ft.lastIndex=Number.isNaN(c)?0:c+7;f=ft.exec(e);){let{0:p,index:m,groups:{capturingStart:h,noncapturingStart:g}}=f;if(p===`[`)t++;else if(t)p===`]`&&t--;else if(p===`(?>`&&!d)c=m,d=!0;else if(d&&g)u++;else if(h)d?u++:(o++,i.push(o+s));else if(p===`)`&&d){if(!u){s++;let t=o+s;if(e=`${e.slice(0,c)}(?:(?=(${e.slice(c+3,m)}))<$$${t}>)${e.slice(m+1)}`,l=!0,a.push(t),ot(n,t),r.size){let e=new Map;r.forEach((n,r)=>{e.set(r>=t?r+1:r,n.map(e=>e>=t?e+1:e))}),r=e}break}u--}}}while(l);return n.push(...a),e=ct(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){let n=+t;if(n>i.length-1)throw Error(`Backref "${e}" greater than number of captures`);return`\\${i[n]}`}return`\\${n}`},F.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}var mt=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,ht=new RegExp(String.raw`
|
|
34
|
+
\\(?: \d+
|
|
35
|
+
| c[A-Za-z]
|
|
36
|
+
| [gk]<[^>]+>
|
|
37
|
+
| [pPu]\{[^\}]+\}
|
|
38
|
+
| u[A-Fa-f\d]{4}
|
|
39
|
+
| x[A-Fa-f\d]{2}
|
|
40
|
+
)
|
|
41
|
+
| \((?: \? (?: [:=!>]
|
|
42
|
+
| <(?:[=!]|[^>]+>)
|
|
43
|
+
| [A-Za-z\-]+:
|
|
44
|
+
| \(DEFINE\)
|
|
45
|
+
))?
|
|
46
|
+
| (?<qBase>${mt})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
47
|
+
| \\?.
|
|
48
|
+
`.replace(/\s+/g,``),`gsu`);function gt(e){if(!RegExp(`${mt}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for(ht.lastIndex=0;o=ht.exec(e);){let{0:s,index:c,groups:{qBase:l,qMod:u,invalidQ:d}}=o;if(s===`[`)a||(r=c),a++;else if(s===`]`)a?a--:r=null;else if(!a){if(u===`+`&&i&&!i.startsWith(`(`)){if(d)throw Error(`Invalid quantifier "${s}"`);let t=-1;if(/^\{\d+\}$/.test(l))e=st(e,c+l.length,u,``);else{if(i===`)`||i===`]`){let t=i===`)`?n:r;if(t===null)throw Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${l})${e.slice(c+s.length)}`}else e=`${e.slice(0,c-i.length)}(?>${i}${l})${e.slice(c+s.length)}`;t+=4}ht.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null)}i=s}return{pattern:e}}var L=String.raw,R=L`\(\?R=(?<rDepth>[^\)]+)\)|${L`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,z=L`\(\?<(?![=!])(?<captureName>[^>]+)>`,_t=L`${z}|(?<unnamed>\()(?!\?)`,B=new RegExp(L`${z}|${R}|\(\?|\\?.`,`gsu`),V=`Cannot use multiple overlapping recursions`;function vt(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(R,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&I(e,L`\(\?\(DEFINE\)`,F.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=I(e,L`\\[1-9]`,F.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(B.lastIndex=0;f=B.exec(e);){let{0:t,groups:{captureName:p,rDepth:m,gRNameOrNum:h,gRDepth:g}}=f;if(t===`[`)u++;else if(u)t===`]`&&u--;else{if(m){if(yt(m),l)throw Error(V);if(o)throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with global recursion`);let t=e.slice(0,f.index),s=e.slice(B.lastIndex);if(I(s,R,F.DEFAULT))throw Error(V);let c=m-1;e=bt(t,s,c,!1,n,a,d),i=Ct(i,t,c,a.length,0,d);break}if(h){yt(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(V);break}if(!u)throw Error(L`Recursive \g cannot be used outside the referenced group "${r===`external`?h:L`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=dt(e,p);if(o&&I(m,L`${z}|\((?!\?)`,F.DEFAULT))throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with recursion of capturing groups`);let _=e.slice(p,f.index),v=m.slice(_.length+t.length),ee=a.length,y=g-1,te=bt(_,v,y,!0,n,a,d);i=Ct(i,_,y,a.length-ee,ee,d),e=`${e.slice(0,p)}${te}${e.slice(p+m.length)}`,B.lastIndex+=te.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),B.lastIndex),s.set(p,B.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),B.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function yt(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e=+e,e<2||e>100))throw Error(t)}function bt(e,t,n,r,i,a,o){let s=new Set;r&<(e+t,z,({groups:{captureName:e}})=>{s.add(e)},F.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${xt(`(?:${e}`,`forward`,...c)}(?:)${xt(`${t})`,`backward`,...c)}${t}`}function xt(e,t,n,r,i,a,o){let s=e=>t===`forward`?e+2:n-e+2-1,c=``;for(let t=0;t<n;t++){let n=s(t);c+=ct(e,L`${_t}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:s,backref:c}})=>{if(c&&r&&!r.has(c))return e;let l=`_$${n}`;if(s||t){let n=o+a.length+1;return a.push(n),St(i,n),s?e:`(?<${t}${l}>`}return L`\k<${c}${l}>`},F.DEFAULT)}return c}function St(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Ct(e,t,n,r,i,a){if(e.size&&r){let o=0;lt(t,_t,()=>o++,F.DEFAULT);let s=a-o+i,c=new Map;return e.forEach((e,t)=>{let i=(r-o*n)/n,a=o*n,l=t>s+o?t+r:t,u=[];for(let t of e)if(t<=s)u.push(t);else if(t>s+o+i)u.push(t+r);else if(t<=s+o)for(let e=0;e<=n;e++)u.push(t+o*e);else for(let e=0;e<=n;e++)u.push(t+a+i*e);c.set(l,u)}),c}return e}var H=String.fromCodePoint,U=String.raw,W={},G=globalThis.RegExp;W.flagGroups=(()=>{try{new G(`(?i:)`)}catch{return!1}return!0})(),W.unicodeSets=(()=>{try{new G(`[[]]`,`v`)}catch{return!1}return!0})(),W.bugFlagVLiteralHyphenIsRange=W.unicodeSets?(()=>{try{new G(U`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,W.bugNestedClassIgnoresNegation=W.unicodeSets&&new G(`[[^a]]`,`v`).test(`a`);function K(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function q(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function wt(e,t){return Et[e]>=Et[t]}function Tt(e,t){if(e==null)throw Error(t??`Value expected`);return e}var Et={ES2025:2025,ES2024:2024,ES2018:2018},Dt={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function Ot(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!Dt[e.target])throw 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 t.target===`auto`&&(t.target=W.flagGroups?`ES2025`:W.unicodeSets?`ES2024`:`ES2018`),t}var kt=`[ -\r ]`,At=new Set([H(304),H(305)]),J=U`[\p{L}\p{M}\p{N}\p{Pc}]`;function jt(e){if(At.has(e))return[e];let t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),i=Ft.get(n),a=Nt.get(n),o=Pt.get(n);return[...r].length===1&&t.add(r),o&&t.add(o),i&&t.add(i),t.add(n),a&&t.add(a),[...t]}var Mt=new Map(`C Other
|
|
49
|
+
Cc Control cntrl
|
|
50
|
+
Cf Format
|
|
51
|
+
Cn Unassigned
|
|
52
|
+
Co Private_Use
|
|
53
|
+
Cs Surrogate
|
|
54
|
+
L Letter
|
|
55
|
+
LC Cased_Letter
|
|
56
|
+
Ll Lowercase_Letter
|
|
57
|
+
Lm Modifier_Letter
|
|
58
|
+
Lo Other_Letter
|
|
59
|
+
Lt Titlecase_Letter
|
|
60
|
+
Lu Uppercase_Letter
|
|
61
|
+
M Mark Combining_Mark
|
|
62
|
+
Mc Spacing_Mark
|
|
63
|
+
Me Enclosing_Mark
|
|
64
|
+
Mn Nonspacing_Mark
|
|
65
|
+
N Number
|
|
66
|
+
Nd Decimal_Number digit
|
|
67
|
+
Nl Letter_Number
|
|
68
|
+
No Other_Number
|
|
69
|
+
P Punctuation punct
|
|
70
|
+
Pc Connector_Punctuation
|
|
71
|
+
Pd Dash_Punctuation
|
|
72
|
+
Pe Close_Punctuation
|
|
73
|
+
Pf Final_Punctuation
|
|
74
|
+
Pi Initial_Punctuation
|
|
75
|
+
Po Other_Punctuation
|
|
76
|
+
Ps Open_Punctuation
|
|
77
|
+
S Symbol
|
|
78
|
+
Sc Currency_Symbol
|
|
79
|
+
Sk Modifier_Symbol
|
|
80
|
+
Sm Math_Symbol
|
|
81
|
+
So Other_Symbol
|
|
82
|
+
Z Separator
|
|
83
|
+
Zl Line_Separator
|
|
84
|
+
Zp Paragraph_Separator
|
|
85
|
+
Zs Space_Separator
|
|
86
|
+
ASCII
|
|
87
|
+
ASCII_Hex_Digit AHex
|
|
88
|
+
Alphabetic Alpha
|
|
89
|
+
Any
|
|
90
|
+
Assigned
|
|
91
|
+
Bidi_Control Bidi_C
|
|
92
|
+
Bidi_Mirrored Bidi_M
|
|
93
|
+
Case_Ignorable CI
|
|
94
|
+
Cased
|
|
95
|
+
Changes_When_Casefolded CWCF
|
|
96
|
+
Changes_When_Casemapped CWCM
|
|
97
|
+
Changes_When_Lowercased CWL
|
|
98
|
+
Changes_When_NFKC_Casefolded CWKCF
|
|
99
|
+
Changes_When_Titlecased CWT
|
|
100
|
+
Changes_When_Uppercased CWU
|
|
101
|
+
Dash
|
|
102
|
+
Default_Ignorable_Code_Point DI
|
|
103
|
+
Deprecated Dep
|
|
104
|
+
Diacritic Dia
|
|
105
|
+
Emoji
|
|
106
|
+
Emoji_Component EComp
|
|
107
|
+
Emoji_Modifier EMod
|
|
108
|
+
Emoji_Modifier_Base EBase
|
|
109
|
+
Emoji_Presentation EPres
|
|
110
|
+
Extended_Pictographic ExtPict
|
|
111
|
+
Extender Ext
|
|
112
|
+
Grapheme_Base Gr_Base
|
|
113
|
+
Grapheme_Extend Gr_Ext
|
|
114
|
+
Hex_Digit Hex
|
|
115
|
+
IDS_Binary_Operator IDSB
|
|
116
|
+
IDS_Trinary_Operator IDST
|
|
117
|
+
ID_Continue IDC
|
|
118
|
+
ID_Start IDS
|
|
119
|
+
Ideographic Ideo
|
|
120
|
+
Join_Control Join_C
|
|
121
|
+
Logical_Order_Exception LOE
|
|
122
|
+
Lowercase Lower
|
|
123
|
+
Math
|
|
124
|
+
Noncharacter_Code_Point NChar
|
|
125
|
+
Pattern_Syntax Pat_Syn
|
|
126
|
+
Pattern_White_Space Pat_WS
|
|
127
|
+
Quotation_Mark QMark
|
|
128
|
+
Radical
|
|
129
|
+
Regional_Indicator RI
|
|
130
|
+
Sentence_Terminal STerm
|
|
131
|
+
Soft_Dotted SD
|
|
132
|
+
Terminal_Punctuation Term
|
|
133
|
+
Unified_Ideograph UIdeo
|
|
134
|
+
Uppercase Upper
|
|
135
|
+
Variation_Selector VS
|
|
136
|
+
White_Space space
|
|
137
|
+
XID_Continue XIDC
|
|
138
|
+
XID_Start XIDS`.split(/\s/).map(e=>[j(e),e])),Nt=new Map([[`s`,H(383)],[H(383),`s`]]),Pt=new Map([[H(223),H(7838)],[H(107),H(8490)],[H(229),H(8491)],[H(969),H(8486)]]),Ft=new Map([Y(453),Y(456),Y(459),Y(498),...Rt(8072,8079),...Rt(8088,8095),...Rt(8104,8111),Y(8124),Y(8140),Y(8188)]),It=new Map([[`alnum`,U`[\p{Alpha}\p{Nd}]`],[`alpha`,U`\p{Alpha}`],[`ascii`,U`\p{ASCII}`],[`blank`,U`[\p{Zs}\t]`],[`cntrl`,U`\p{Cc}`],[`digit`,U`\p{Nd}`],[`graph`,U`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,U`\p{Lower}`],[`print`,U`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,U`[\p{P}\p{S}]`],[`space`,U`\p{space}`],[`upper`,U`\p{Upper}`],[`word`,U`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,U`\p{AHex}`]]);function Lt(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function Y(e){let t=H(e);return[t.toLowerCase(),t]}function Rt(e,t){return Lt(e,t).map(e=>Y(e))}var zt=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function Bt(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};Wt(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:wt(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};M(e,Vt,r);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return M(e,Ht,a),M(e,Ut,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var Vt={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=D();e.body[0].body.push(O({negate:!0,body:r}),k(`Any`));let i=D();i.body[0].body.push(Je(`greedy`,0,1/0,e)),n(Q(i,t),{traverse:!0})}else throw Error(`Unsupported absence function "(?~|"`)},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>e.kind===`flags`);for(let e=n+1;e<t.body.length;e++){let n=t.body[e];q(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=Zt(t.get(e));if(n){let t=D({flags:n});t.body[0].body=e.body,e.body=[Q(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:a,replaceWith:o},s){let{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=s;if(c===`text_segment_boundary`)throw Error(`Unsupported text segment boundary "\\${l?`Y`:`y`}"`);if(c===`line_end`)o(Q(O({body:[C({body:[Be(`string_end`)]}),C({body:[w(10)]})]}),t));else if(c===`line_start`)o(Q(X(U`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c===`search_start`){if(f.has(e))i.flags.sticky=!0,a();else{let e=r[n-1];if(e&&rn(e))o(Q(O({negate:!0}),t));else if(d)throw Error(U`Uses "\G" in a way that requires a subclass`);else o(Z(Be(`string_start`),t)),s.strategy=`clip_search`}}else if(c!==`string_end`&&c!==`string_start`){if(c===`string_end_newline`)o(Q(X(U`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${J})(?!${J})|(?<!${J})(?=${J}))`,n=`(?:(?<=${J})(?=${J})|(?<!${J})(?!${J}))`;o(Q(X(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!on(n)&&(n=Xt(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!on(r)&&(r=Xt(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){t.kind===`intersection`&&n(Q(T({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:c,negate:l,value:u}=e;if(a&&(c===`digit`||u===`digit`))n(Z(E(`digit`,{negate:l}),t));else if(o&&(c===`space`||u===`space`))n(Q(sn(X(kt),l),t));else if(s&&(c===`word`||u===`word`))n(Z(E(`word`,{negate:l}),t));else if(c===`any`)n(Z(k(`Any`),t));else if(c===`digit`)n(Z(k(`Nd`,{negate:l}),t));else if(c!==`dot`){if(c===`text_segment`){if(r===`strict`)throw Error(U`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=U`\p{RI}{2}|${e}(?:\u200D${e})*`;n(Q(X(U`(?>\r\n|${i?U`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(Z(k(`AHex`,{negate:l}),t));else if(c===`newline`)n(Q(X(l?`[^
|
|
139
|
+
]`:`(?>\r
|
|
140
|
+
?|[
|
|
141
|
+
\v\f
\u2028\u2029])`),t));else if(c===`posix`){if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${H(e.codePointAt(0)-1)}${H(e.codePointAt(2)+1)}-\u{10FFFF}`),n(Q(X(`[${e}]`),t))}else n(Q(sn(X(It.get(u)),l),t))}else if(c===`property`)Mt.has(j(u))||(e.key=`sc`);else if(c===`space`)n(Z(k(`space`,{negate:l}),t));else if(c===`word`)n(Q(sn(X(J),l),t));else throw Error(`Unexpected character set kind "${c}"`)}},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`){if(!c.enable&&!c.disable)r();else{let e=D({flags:c});e.body[0].body=o(),i(Q(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&De(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(U`Uses "\K" in a way that's unsupported`);let o=O({behind:!0});o.body[0].body=a(),i(Q(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw 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;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(Q(O({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=D();t.body[0].body.push(e.body),e.body=Q(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=en(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(U`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!on(n)&&(n=Xt(n,t),e.ref=n)}},Ht={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=Z(Jt(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&q(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=q(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=K(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&(n.type!==`CapturingGroup`||n.name!==a&&n.number!==a););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?Jt(0):qt(o,r.groupOriginByCopy,null),l=c;if(!s){let e=Zt(Yt(o,e=>e.type===`Group`&&!!e.flags)),t=e?K(r.globalFlags,e):r.globalFlags;Gt(t,r.currentFlags)||(l=D({flags:Qt(t)}),l.body[0].body.push(c))}n(Q(l,t),{traverse:!s})}},Ut={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>Kt(t,e));i.length?i.length>1?n(Q(D({atomic:!0,body:i.reverse().map(e=>C({body:[Ve(e.number)]}))}),t)):e.ref=i[0].number:n(Q(O({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<n;t++){let t=He();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){e.isRecursive&&e.ref!==0&&(e.ref=t.reffedNodesByReferencer.get(e).number)}};function Wt(e){M(e,{"*"({node:e,parent:t}){e.parent=t}})}function Gt(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function Kt(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=$t(n.parent);for(let r of t){if(r===n)break;if(r===e||tn(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function qt(e,t,n,r){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a===`parent`?i.parent=Array.isArray(n)?r:n:o&&typeof o==`object`?i[a]=qt(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function Jt(e){let t=Xe(e);return t.isRecursive=!0,t}function Yt(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function Xt(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,`_`)}`;return t.set(e,n),n}function Zt(e){let t=[`dotAll`,`ignoreCase`],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{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 Qt({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 $t(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function en(e){let t=e.find(e=>e.kind===`search_start`||an(e,{negate:!1})||!nn(e));if(!t)return null;if(t.kind===`search_start`)return t;if(t.type===`LookaroundAssertion`)return t.body[0].body[0];if(t.type===`CapturingGroup`||t.type===`Group`){let e=[];for(let n of t.body){let t=en(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function tn(e,t){let n=$t(e)??[];for(let e of n)if(e===t||tn(e,t))return!0;return!1}function nn({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function rn(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function an(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&De(e.body[0],{type:`Assertion`,kind:`search_start`})}function on(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function X(e,t){let n=Ae(e,{...t,unicodePropertyMap:Mt}).body;return n.length>1||n[0].body.length>1?D({body:n}):n[0].body[0]}function sn(e,t){return e.negate=t,e}function Z(e,t){return e.parent=t,e}function Q(e,t){return Wt(e),e.parent=t,e}function cn(e,t){let n=Ot(t),r=wt(n.target,`ES2024`),i=wt(n.target,`ES2025`),a=n.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error(`Invalid recursionLimit; use 2-20`);let o=null,s=null;if(!i){let t=[e.flags.ignoreCase];M(e,ln,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:s=!0}})}let c={dotAll:e.flags.dotAll,ignoreCase:!(!e.flags.ignoreCase&&!o||s)},l=e,u={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:a,useAppliedIgnoreCase:!!(!i&&o&&s),useFlagMods:i,useFlagV:r,verbose:n.verbose};function d(e){return u.lastNode=l,l=e,Tt(un[e.type],`Unexpected node type "${e.type}"`)(e,u,d)}let f={pattern:e.body.map(d).join(`|`),flags:d(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&f._hiddenCaptures.push(t),e.transferTo&&q(f._captureTransfers,e.transferTo,[]).push(t)}),f}var ln={"*":{enter({node:e},t){if(xn(e)){let n=t.getCurrentModI();t.pushModI(e.flags?K({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){xn(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){gn(H(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),_n(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&zt.has(e.value)&&t.setHasCasedChar()}},un={Alternative({body:e},t,n){return e.map(n).join(``)},Assertion({kind:e,negate:t}){if(e===`string_end`)return`$`;if(e===`string_start`)return`^`;if(e===`word_boundary`)return t?U`\B`:U`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!=`number`)throw Error(`Unexpected named backref in transformed AST`);if(!t.useFlagMods&&t.accuracy===`strict`&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw 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:r,name:i,number:a}=e,o={ignoreCase:t.currentFlags.ignoreCase},s=t.originMap.get(e);return s&&(o.hidden=!0,a>s.number&&(o.transferTo=s.number)),t.captureMap.set(a,o),`(${i?`?<${i}>`:``}${r.map(n).join(`|`)})`},Character({value:e},t){let n=H(e),r=$(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&gn(n)){let e=jt(n);return t.inCharClass?e.join(``):e.length>1?`[${e.join(``)}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:i,parent:a}=e,{body:o}=e;if(r===`intersection`&&!t.useFlagV)throw Error(`Use of character class intersection requires min target ES2024`);W.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(Cn)&&(o=[w(45),...o.filter(e=>!Cn(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||W.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=D(),i=r.body[0];return r.parent=a,i.parent=r,o=o.filter(e=>!t.includes(e)),e.body=o,o.length?(e.parent=i,i.body.push(e)):r.body.pop(),t.forEach(e=>{let t=C({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;let r=s();return t.inCharClass=!1,r}let c=o[0];if(r===`union`&&!i&&c&&((!t.useFlagV||!t.verbose)&&a.kind===`union`&&!(W.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&a.kind===`intersection`&&o.length===1&&c.type!==`CharacterClassRange`))return o.map(n).join(``);if(!t.useFlagV&&a.type===`CharacterClass`)throw Error(`Uses nested character class in a way that requires min target ES2024`);return s()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=$(n,i),o=$(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&vn(_n(e)).forEach(e=>{s.add(Array.isArray(e)?`${$(e[0],i)}-${$(e[1],i)}`:$(e,i))}),`${a}-${o}${[...s].join(``)}`},CharacterSet({kind:e,negate:t,value:n,key:r},i){if(e===`dot`)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?`.`:`[^]`:U`[^\n]`;if(e===`digit`)return t?U`\D`:U`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&zt.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?U`\P`:U`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?U`\W`:U`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?`i`:``)+(e.dotAll?`s`:``)+(e.sticky?`y`:``)},Group({atomic:e,body:t,flags:n,parent:r},i,a){let o=i.currentFlags;n&&(i.currentFlags=K(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${yn(e,n,i.useFlagMods)}${s})`;return i.currentFlags=o,c},LookaroundAssertion({body:e,kind:t,negate:n},r,i){return`(?${`${t===`lookahead`?``:`<`}${n?`!`:`=`}`}${e.map(i).join(`|`)})`},Quantifier(e,t,n){return n(e.body)+bn(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error(`Unexpected non-recursive subroutine in transformed AST`);let r=n.recursionLimit;return t===0?`(?R=${r})`:U`\g<${t}&R=${r}>`}},dn=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),fn=new Set([`-`,`\\`,`]`,`^`,`[`]),pn=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),mn=new Map([[9,U`\t`],[10,U`\n`],[11,U`\v`],[12,U`\f`],[13,U`\r`],[8232,U`\u2028`],[8233,U`\u2029`],[65279,U`\uFEFF`]]),hn=/^\p{Cased}$/u;function gn(e){return hn.test(e)}function _n(e,t){let n=!!t?.firstOnly,r=e.min.value,i=e.max.value,a=[];if(r<65&&(i===65535||i>=131071)||r===65536&&i>=131071)return a;for(let e=r;e<=i;e++){let t=H(e);if(!gn(t))continue;let o=jt(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(o.length&&(a.push(...o),n))break}return a}function $(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(mn.has(e))return mn.get(e);if(e<32||e>126&&e<160||e>262143||t&&Sn(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?pn:fn:dn,a=H(e);return(i.has(a)?`\\`:``)+a}function vn(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:r===null?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}function yn(e,t,n){if(e)return`>`;let r=``;if(t&&n){let{enable:e,disable:n}=t;r=(e?.ignoreCase?`i`:``)+(e?.dotAll?`s`:``)+(n?`-`:``)+(n?.ignoreCase?`i`:``)+(n?.dotAll?`s`:``)}return`${r}:`}function bn({kind:e,max:t,min:n}){let r;return r=!n&&t===1?`?`:!n&&t===1/0?`*`:n===1&&t===1/0?`+`:n===t?`{${n}}`:`{${n},${t===1/0?``:t}}`,r+{greedy:``,lazy:`?`,possessive:`+`}[e]}function xn({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function Sn(e){return e>47&&e<58}function Cn({type:e,value:t}){return e===`Character`&&t===45}var wn=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||`(?:)`}constructor(t,n,r){let i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw 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.#r=i.#r,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?``:t,n),this.#n=t,this.#e=En(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}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,r=this.lastIndex;if(this.#i===`clip_search`&&n&&r){this.lastIndex=0;let e=this.#a(t.slice(r));return e&&(Tn(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#a(t)}#a(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=[...t];t.length=1;let r;this.hasIndices&&(r=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:o}=this.#e.get(e)??{};if(a?i.push(null):(i.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&n[e]!==void 0){let a=i[o];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(t[a]=n[e],this.hasIndices&&(t.indices[a]=r[e]),t.groups){this.#r||=Dn(this.source);let i=this.#r.get(o);i&&(t.groups[i]=n[e],this.hasIndices&&(t.indices.groups[i]=r[e]))}}}return t}};function Tn(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e<n.length;e++){let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}let r=n.groups;r&&Object.keys(r).forEach(e=>{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function En(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)q(n,t,{}).transferTo=e;return n}function Dn(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,r=0,i=0,a;for(;a=t.exec(e);){let{0:e,groups:{capture:t,name:o}}=a;e===`[`?r++:r?e===`]`&&r--:t&&(i++,o&&n.set(i,o))}return n}function On(e,t){let n=kn(e,t);return n.options?new wn(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function kn(e,t){let n=Ot(t),r=Bt(Ae(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:Mt}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=cn(r,n),a=vt(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=pt(gt(a.pattern).pattern,{captureTransfers:a.captureTransfers,hiddenCaptures:a.hiddenCaptures}),s={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 Error(`Lazy compilation requires subclass`)}else{let e=o.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(o.captureTransfers),i=r._strategy,a=s.pattern.length>=n.lazyCompileLength;(e.length||t.length||i||a)&&(s.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...i&&{strategy:i},...a&&{lazyCompile:a}})}return s}function An(e,t){return On(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function jn(e={}){let t={target:`auto`,cache:new Map,...e};return t.regexConstructor||=e=>An(e,{target:t.target}),{createScanner(e){return new r(e,t)},createString:a}}function Mn(){let e={cache:new Map,regexConstructor:()=>{throw Error(`JavaScriptRawEngine: only support precompiled grammar`)}};return{createScanner(t){return new r(t,e)},createString:a}}export{r as JavaScriptScanner,Mn as createJavaScriptRawEngine,jn as createJavaScriptRegexEngine,An as defaultJavaScriptRegexConstructor};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{A as t,V as n,k as r,lt as i,ut as a}from"./button-C4yvcSko.js";import{An as o,Dn as s,En as c,Sn as l,_n as u,dn as d,hn as f,pn as p,un as m}from"./operator-copy-DsM7LJx6.js";var h=class extends m{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||g(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??(this.state.status===`pending`?this.execute(this.state.variables):Promise.resolve())}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey},r=this.#r=d({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)}),i=this.state.status===`pending`,a=!r.canStart();try{if(i)t();else{this.#i({type:`pending`,variables:e,isPaused:a}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:a})}let o=await r.start();return await this.#n.config.onSuccess?.(o,e,this.state.context,this,n),await this.options.onSuccess?.(o,e,this.state.context,n),await this.#n.config.onSettled?.(o,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(o,null,e,this.state.context,n),this.#i({type:`success`,data:o}),o}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#r===r&&(this.#r=void 0),this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),p.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function g(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var _=class extends f{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),c(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&u(t.mutationKey)!==u(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onSubscribe(){this.listeners.size===1&&this.#n&&(this.#n.addObserver(this),this.#i())}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??g();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){p.batch(()=>{let t=this.#r;if(t&&this.hasListeners()){let n=this.#t.variables,r=this.#t.context,i={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{t.onSuccess?.(e.data,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(e.data,null,n,r,i)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{t.onError?.(e.error,n,r,i)}catch(e){Promise.reject(e)}try{t.onSettled?.(void 0,e.error,n,r,i)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}},v=e(a(),1);function y(e,t){let n=o(t),[r]=v.useState(()=>new _(n,e));v.useEffect(()=>{r.setOptions(e)},[r,e]);let i=v.useSyncExternalStore(v.useCallback(e=>r.subscribe(p.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=v.useCallback((...e)=>{r.mutate(e[0],e[1]).catch(l)},[r]);if(i.error&&s(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}var b=i(),x=t(`group/alert relative grid w-full gap-0.5 rounded-lg border px-3 py-2.5 text-left text-sm has-data-[slot=alert-action]:relative has-data-[slot=alert-action]:pr-18 has-[>svg]:grid-cols-[auto_1fr] has-[>svg]:gap-x-1.5 *:[svg]:row-span-2 *:[svg]:translate-y-0.5 *:[svg:not([class*='size-'])]:size-3.5`,{variants:{variant:{default:`bg-card text-card-foreground`,destructive:`border-destructive/25 bg-destructive/8 text-destructive *:data-[slot=alert-description]:text-destructive/90 *:[svg]:text-current`}},defaultVariants:{variant:`default`}});function S({className:e,variant:t,...n}){return(0,b.jsx)(`div`,{"data-slot":`alert`,role:`alert`,className:r(x({variant:t}),e),...n})}function C({className:e,...t}){return(0,b.jsx)(`div`,{"data-slot":`alert-title`,className:r(`font-medium group-has-[>svg]/alert:col-start-2 [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground`,e),...t})}function w({className:e,...t}){return(0,b.jsx)(`div`,{"data-slot":`alert-description`,className:r(`text-sm text-balance text-muted-foreground md:text-pretty [&_a]:underline [&_a]:underline-offset-3 [&_a]:hover:text-foreground [&_p:not(:last-child)]:mb-4`,e),...t})}function T({className:e,...t}){return(0,b.jsx)(`div`,{"data-slot":`alert-action`,className:r(`absolute top-1.5 right-2`,e),...t})}var E=({title:e,message:t,className:i})=>(0,b.jsxs)(S,{variant:`destructive`,className:r(`wrap-anywhere`,i),children:[(0,b.jsx)(n,{weight:`fill`}),e!==void 0&&(0,b.jsx)(C,{children:e}),(0,b.jsx)(w,{children:t})]});export{C as a,w as i,S as n,y as o,T as r,h as s,E as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{lt as e}from"./button-C4yvcSko.js";import{Qt as t}from"./operator-copy-DsM7LJx6.js";var n=e(),r={read:`Could not read the file`,yaml:`Frontmatter is not valid YAML`,frontmatter:`Frontmatter block missing or not closed`,schema:`Invalid file name or field value`,expression:`Invalid expression`,reference:`Unknown agent, repository, or tag`},i=({error:e,consequence:i})=>{let a=t(e.expression);return(0,n.jsxs)(`div`,{className:`flex max-w-[72ch] flex-col gap-3`,children:[(0,n.jsxs)(`div`,{className:`flex flex-col gap-1 rounded-lg border border-destructive/25 bg-destructive/8 px-3 pt-2 pb-2.5 wrap-anywhere`,children:[(0,n.jsx)(`p`,{className:`font-medium text-destructive`,children:r[e.stage]}),(0,n.jsx)(`p`,{children:e.message}),a!==void 0&&(0,n.jsx)(`code`,{className:`mt-1 font-mono text-xs whitespace-pre-wrap text-muted-foreground`,children:a})]}),(0,n.jsxs)(`p`,{className:`text-muted-foreground`,children:[i,` Fix `,(0,n.jsx)(`code`,{className:`font-mono text-xs`,children:e.file}),`, then reload the configuration.`]})]})};export{i as t};
|