@cloudflare/kumo 2.7.0 → 2.9.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/CHANGELOG.md +107 -0
- package/README.md +3 -39
- package/ai/USAGE.md +89 -80
- package/ai/component-registry.json +1319 -194
- package/ai/component-registry.md +1799 -198
- package/ai/schemas.ts +139 -8
- package/bin/kumo.js +1 -1
- package/dist/.build-complete +1 -1
- package/dist/ai/schemas.d.ts +2040 -1791
- package/dist/ai/schemas.js +5550 -3868
- package/dist/blocks-source/delete-resource/delete-resource.tsx +5 -5
- package/dist/blocks-source/resource-list/resource-list.test.tsx +1 -1
- package/dist/blocks-source/resource-list/resource-list.tsx +1 -4
- package/dist/button-Bbi7gFL7.d.ts +227 -0
- package/dist/catalog.d.ts +377 -0
- package/dist/catalog.js +347 -215
- package/dist/chunks/AlertDialogTrigger-fn9yjykev9h5l12q.js +24 -0
- package/dist/chunks/AutocompleteItem-clgm7u7zzgjy1hvb.js +82 -0
- package/dist/chunks/Button-oczevl8g75m85ew9.js +27 -0
- package/dist/chunks/CSPContext-guqghj8kxoukvlky.js +17 -0
- package/dist/chunks/CSPProvider-ogozggb4nr6evned.js +24 -0
- package/dist/chunks/CheckboxGroup-h9w1c6bo2nlcc4uj.js +177 -0
- package/dist/chunks/CheckboxGroupContext-f9wox07n2u5moq4h.js +12 -0
- package/dist/chunks/CheckboxIndicator-gz18hapnzraxyz9a.js +49 -0
- package/dist/chunks/CheckboxRoot-g6fb44xqgc0qxusf.js +361 -0
- package/dist/chunks/CollapsiblePanel-mnjlf99v79k3yabx.js +177 -0
- package/dist/chunks/ComboboxChipRemove-opf1zyu9yyp98dqd.js +302 -0
- package/dist/chunks/ComboboxClear-fi4op1n12c99ktca.js +302 -0
- package/dist/chunks/ComboboxEmpty-dr78bn7zilhqbkgc.js +1882 -0
- package/dist/chunks/ComboboxPopup-bugeajuqjattk1n7.js +205 -0
- package/dist/chunks/CompositeItem-l7zee38lq5m224d5.js +23 -0
- package/dist/chunks/CompositeList-bek8pmx9o8cu36ig.js +129 -0
- package/dist/chunks/CompositeListContext-oetjj2x8li8678as.js +18 -0
- package/dist/chunks/CompositeRoot-jm9n0rrea12rfny1.js +225 -0
- package/dist/chunks/CompositeRootContext-ofhzmevv7hadjhyy.js +12 -0
- package/dist/chunks/DialogHandle-o964gplvp59qqv23.js +139 -0
- package/dist/chunks/DialogPopup-cz73mkiyi9c33mhn.js +174 -0
- package/dist/chunks/DialogRoot-kfhbouiouenljp3q.js +15 -0
- package/dist/chunks/DialogTrigger-gzxvssie7e5e1iba.js +139 -0
- package/dist/chunks/DirectionContext-jc1g0w645603sd6p.js +13 -0
- package/dist/chunks/DirectionProvider-gdktkteyrlpnokak.js +21 -0
- package/dist/chunks/FieldControl-oz007qbkl6ejp7di.js +104 -0
- package/dist/chunks/FieldDescription-go88jdymmj9o0ugi.js +121 -0
- package/dist/chunks/FieldItemContext-j85dc0ihramj5ezs.js +10 -0
- package/dist/chunks/FieldLabel-junk2aczkvogpv5d.js +558 -0
- package/dist/chunks/FieldsetLegend-ch85hugankjah152.js +68 -0
- package/dist/chunks/FieldsetRootContext-b633e9uzilttuyfi.js +12 -0
- package/dist/chunks/FloatingPortalLite-ld4o97z16w23x6za.js +25 -0
- package/dist/chunks/FloatingTree-jdm71b3m43e34hk7.js +115 -0
- package/dist/chunks/Form-f1ibju5npd1qqowg.js +102 -0
- package/dist/chunks/FormContext-xz0b4h7ue30fkkn1.js +17 -0
- package/dist/chunks/Input-opaph7rt3w2vx3c0.js +20 -0
- package/dist/chunks/LabelableContext-hetas2e4y0kywfas.js +131 -0
- package/dist/chunks/MenuBackdrop-m0tfcr6sg50f9sn5.js +78 -0
- package/dist/chunks/MenuSubmenuTrigger-n281iqpstcnacsk6.js +1532 -0
- package/dist/chunks/MenuTrigger-dwh2ewyxp5j3ml02.js +266 -0
- package/dist/chunks/Menubar-m8euwx8biy1qpo44.js +117 -0
- package/dist/chunks/MenubarContext-ei2r6vu6lmsspozo.js +12 -0
- package/dist/chunks/MeterLabel-efe4koezlgg05cv8.js +151 -0
- package/dist/chunks/PopoverClose-inm8xliypc51murq.js +666 -0
- package/dist/chunks/RadioGroup-h25jrjmet0gxrvex.js +165 -0
- package/dist/chunks/RadioGroupContext-ft0nndmzqynjz8a2.js +10 -0
- package/dist/chunks/RadioIndicator-lvpixnzpkxpq7rp1.js +296 -0
- package/dist/chunks/ScrollAreaThumb-jydo7azxxwjn1cqf.js +944 -0
- package/dist/chunks/SelectGroupLabel-mug19qcz2k67qule.js +1600 -0
- package/dist/chunks/Separator-b8wf5rea6m1cei8k.js +24 -0
- package/dist/chunks/SwitchRoot-gumgk7356eqv7dve.js +237 -0
- package/dist/chunks/TabsList-obzldrvfzo50uqr4.js +617 -0
- package/dist/chunks/Toggle-hlf7recxsq6mxvax.js +89 -0
- package/dist/chunks/ToggleGroup-l8tfcwe33tlqqm8a.js +106 -0
- package/dist/chunks/ToggleGroupContext-cdk2zo6ciddpockn.js +12 -0
- package/dist/chunks/ToolbarGroupContext-nriz3632ymugfj6h.js +12 -0
- package/dist/chunks/ToolbarInput-oy7o682hhn2jdjen.js +152 -0
- package/dist/chunks/ToolbarRootContext-lvi96r1vvs93rhde.js +12 -0
- package/dist/chunks/TooltipPopup-ehusafczcky9jvae.js +868 -0
- package/dist/chunks/TooltipProvider-iq6hgymrn3b68h50.js +64 -0
- package/dist/chunks/addEventListener-lhqvk2ahlzjsanyg.js +13 -0
- package/dist/chunks/areArraysEqual-nlbeaqlzf4274zr3.js +7 -0
- package/dist/chunks/autocomplete-m8n1c775n0iilomf.js +152 -0
- package/dist/chunks/badge-e16yhhe9xibra5k7.js +148 -0
- package/dist/chunks/banner-cu2mip76zfx0gf27.js +258 -0
- package/dist/chunks/bash-jpzh6zbf5237424t.js +3 -0
- package/dist/chunks/breadcrumbs-hxibrxjtvudy0ir9.js +164 -0
- package/dist/chunks/button-eikucjpgqbsn5m5m.js +260 -0
- package/dist/chunks/chart-bxxlck50zlsbj3kl.js +3083 -0
- package/dist/chunks/checkbox-fovnhs7f1sekaxrh.js +158 -0
- package/dist/chunks/clamp-kvu4wtr1dw6b3pnd.js +7 -0
- package/dist/chunks/clipboard-text-fuyj4apm2xry4hkk.js +198 -0
- package/dist/chunks/cloudflare-logo-g0aimzpllornl0rc.js +186 -0
- package/dist/chunks/code-eu8kzwqnlhoyin24.js +96 -0
- package/dist/chunks/collapsible-lj0glxe1hezap65x.js +178 -0
- package/dist/chunks/combobox-m2nvbt0b1stb2syc.js +301 -0
- package/dist/chunks/command-palette-jjrbvylvvbj0qusg.js +507 -0
- package/dist/chunks/composite-o65hjzwwzb4kvl4w.js +102 -0
- package/dist/chunks/constants-j09lrtg73n4vlx5x.js +5 -0
- package/dist/chunks/core-kjfqbvgicl9i3abf.js +7163 -0
- package/dist/chunks/createBaseUIEventDetails-ddivuhl74gni72qn.js +86 -0
- package/dist/chunks/createToastManager-kjd838m8jog8pddj.js +1233 -0
- package/dist/chunks/css-d3t41yfupsmz7l1a.js +4 -0
- package/dist/chunks/date-picker-njfirc1m165k6yax.js +6786 -0
- package/dist/chunks/date-range-picker-g6sje1ua7n7jerkq.js +335 -0
- package/dist/chunks/dialog-b4r3dv8uvgl2pqem.js +170 -0
- package/dist/chunks/diff-g2re0kj6fh27rgg5.js +4 -0
- package/dist/chunks/dropdown-k0y5j6iuad7tvqgx.js +279 -0
- package/dist/chunks/empty-hmu7x39lnp0z2qm6.js +89 -0
- package/dist/chunks/engine-io35xsj9fgfxtihg.js +10 -0
- package/dist/chunks/engine-javascript-d795u677f1802oaf.js +3103 -0
- package/dist/chunks/engine-oniguruma-xjlw46ay321yj1av.js +388 -0
- package/dist/chunks/error-mm98alb8acdy93vq.js +15 -0
- package/dist/chunks/field-dxe9ne8fqy5whws2.js +70 -0
- package/dist/chunks/flow-fbsv3yek3w7v5a6p.js +10270 -0
- package/dist/chunks/formatNumber-hjijm58g645q6a0n.js +26 -0
- package/dist/chunks/getCssDimensions-mi941fe1jvztqm6b.js +21 -0
- package/dist/chunks/getEmptyRootContext-2utawetz04dqkzyn.js +18 -0
- package/dist/chunks/getPseudoElementBounds-jg72lmrlwgbqhmjh.js +28 -0
- package/dist/chunks/github-light-kb466scjoy42qxpu.js +5 -0
- package/dist/chunks/graphql-gtqr4wytdf0qjybo.js +16 -0
- package/dist/chunks/grid-d43q1qme6ffbbcl1.js +118 -0
- package/dist/chunks/hcl-ohpfnrffs96hzyj5.js +4 -0
- package/dist/chunks/html-ijyj3f9k0foag15c.js +12 -0
- package/dist/chunks/index.parts-9xtishx4m3j6sbg9.js +1429 -0
- package/dist/chunks/index.parts-bsarfaby0ttw67bb.js +206 -0
- package/dist/chunks/index.parts-buqjmx1pfsd225r7.js +30 -0
- package/dist/chunks/index.parts-bzlq2foymrigspiz.js +81 -0
- package/dist/chunks/index.parts-c4kz48uuogge3k9g.js +1462 -0
- package/dist/chunks/index.parts-cou5w8shwfwuk6wo.js +128 -0
- package/dist/chunks/index.parts-etb66t5m85rhhipe.js +11 -0
- package/dist/chunks/index.parts-f3xvfc67ai7txeru.js +127 -0
- package/dist/chunks/index.parts-g0wrrbkxyh0oo730.js +171 -0
- package/dist/chunks/index.parts-g27bw668q8dtcjz8.js +1229 -0
- package/dist/chunks/index.parts-gcwd6ds0od2n1i0p.js +10 -0
- package/dist/chunks/index.parts-ghwrm31fyo614381.js +23 -0
- package/dist/chunks/index.parts-giu46tgp0ypgfq6a.js +88 -0
- package/dist/chunks/index.parts-hi0bbzsnswj74v28.js +11 -0
- package/dist/chunks/index.parts-ixizrcasario34jo.js +213 -0
- package/dist/chunks/index.parts-j775zfdbhcd9ypeb.js +41 -0
- package/dist/chunks/index.parts-jmkwypigix07dit1.js +119 -0
- package/dist/chunks/index.parts-kdoulw17e9zk96yw.js +156 -0
- package/dist/chunks/index.parts-kh9waplhfwlszcyp.js +245 -0
- package/dist/chunks/index.parts-kwqb2nzc7u2zzxqs.js +2464 -0
- package/dist/chunks/index.parts-kwx43zlomuu96clc.js +46 -0
- package/dist/chunks/index.parts-lojnx790s6z0mi1f.js +388 -0
- package/dist/chunks/index.parts-n6t1aj932fytioz8.js +692 -0
- package/dist/chunks/index.parts-ngc39crwuz80oiij.js +13 -0
- package/dist/chunks/index.parts-nq06i1gji6fjnmln.js +192 -0
- package/dist/chunks/index.parts-omt7bu8mbte48ulb.js +73 -0
- package/dist/chunks/index.parts-pb65142mbin4hpc7.js +564 -0
- package/dist/chunks/index2.parts-k2au6nzued1wgy6t.js +95 -0
- package/dist/chunks/index2.parts-noiw2eweufmplfsp.js +10 -0
- package/dist/chunks/inertValue-f9pgp32jxnm88df3.js +9 -0
- package/dist/chunks/input-dwl9oy1f1ufah0bx.js +145 -0
- package/dist/chunks/input-group-otq3m9lach1jyxl0.js +452 -0
- package/dist/chunks/input-o3mtvvtqf69j5k10.js +85 -0
- package/dist/chunks/isElementDisabled-ffsy1y4adxocmexb.js +7 -0
- package/dist/chunks/javascript-b6fq9bl50fdj6813.js +4 -0
- package/dist/chunks/json-h2g0z143t3cs13d7.js +4 -0
- package/dist/chunks/jsonc-jxlzvingck161eej.js +4 -0
- package/dist/chunks/jsx-jp7a33937sef92sn.js +4 -0
- package/dist/chunks/label-opyibemromjwmd0s.js +72 -0
- package/dist/chunks/layer-card-nah241sxhj6i7i03.js +72 -0
- package/dist/chunks/link-1b3jda6cdzl4lkeo.js +112 -0
- package/dist/chunks/link-provider-l9ohtet4pj559eg0.js +60 -0
- package/dist/chunks/loader-j2v6fab8iucuxz1z.js +91 -0
- package/dist/chunks/markdown-eybeqjr58vfygtz1.js +4 -0
- package/dist/chunks/menubar-m0h31eymts6exeke.js +103 -0
- package/dist/chunks/mergeCleanups-pexn3wul6a4zn873.js +15 -0
- package/dist/chunks/meter-iauic8ww87xxqf74.js +35 -0
- package/dist/chunks/pagination-k0yll9ynbi8flc3b.js +290 -0
- package/dist/chunks/popover-l0xg7b854w7txyoz.js +152 -0
- package/dist/chunks/popupStateMapping-jpzw7eyzl8ghiv8s.js +868 -0
- package/dist/chunks/popupStoreUtils-fpjh6veok5pa2hd1.js +367 -0
- package/dist/chunks/portal-provider-langu3fqwfr9tlhm.js +59 -0
- package/dist/chunks/python-nrpnmxq4r6yp6fcd.js +4 -0
- package/dist/chunks/radio-igpo6t2t2tpe08d5.js +173 -0
- package/dist/chunks/resolve-variant-l6x5ksfrjtu4m66l.js +35 -0
- package/dist/chunks/resolveAriaLabelledBy-h9qwvo10ftlj6t9k.js +10 -0
- package/dist/chunks/resolveValueLabel-i36fqhi09ki67hx5.js +89 -0
- package/dist/chunks/rolldown-runtime-hi7ti5xiuxsegr96.js +18 -0
- package/dist/chunks/safePolygon-flrfpyc6fpidq4fb.js +659 -0
- package/dist/chunks/safeReact-bavzz23j5tex60z2.js +18 -0
- package/dist/chunks/select-ln6ibqbbs0n4tiig.js +262 -0
- package/dist/chunks/sensitive-input-karaei12un7z7nep.js +256 -0
- package/dist/chunks/serializeValue-ci3kihruew64i36f.js +13 -0
- package/dist/chunks/shellscript-i4m7lo8wi0f5bl8b.js +4 -0
- package/dist/chunks/sidebar-kvjzu0ya0b2z6eec.js +1297 -0
- package/dist/chunks/skeleton-line-f6sju1dxawm8h9tg.js +40 -0
- package/dist/chunks/sql-do9h6435gka97c4c.js +4 -0
- package/dist/chunks/store-i9l3lkcl6auhkpfl.js +88 -0
- package/dist/chunks/stringifyLocale-cl8et9xf6zon4qbs.js +9 -0
- package/dist/chunks/styles-dbhgpd8fm76fdfo3.js +35 -0
- package/dist/chunks/surface-jwwh5xl06kv9tp7b.js +30 -0
- package/dist/chunks/switch-cusffup6w3tan5ot.js +202 -0
- package/dist/chunks/table-ds3nzcffm3pu9o0l.js +238 -0
- package/dist/chunks/table-of-contents-l66abisn473qzd07.js +231 -0
- package/dist/chunks/tabs-dz3fsnkrznrggilz.js +255 -0
- package/dist/chunks/text-e1ko7r96hsoz2tor.js +109 -0
- package/dist/chunks/toast-itl6qo5oy1vy6d36.js +324 -0
- package/dist/chunks/toml-oyqrgosuct25x413.js +4 -0
- package/dist/chunks/toolbar-gwd1orc8yl7lzaou.js +127 -0
- package/dist/chunks/tooltip-maelyxs1y7a78vje.js +90 -0
- package/dist/chunks/tsx-pem8x69upvmibv6l.js +4 -0
- package/dist/chunks/typescript-pe5y016phdwbgws7.js +4 -0
- package/dist/chunks/useAnchoredPopupScrollLock-bx8vvwcdp25ix0kj.js +31 -0
- package/dist/chunks/useAnimationFrame-ssgc72hyq6sg3yit.js +86 -0
- package/dist/chunks/useAriaLabelledBy-bvw56m1d7czf0w3f.js +38 -0
- package/dist/chunks/useBaseUiId-gqkl5ep5pn6hd0rw.js +13 -0
- package/dist/chunks/useButton-cpo6u2idqcnou6vy.js +149 -0
- package/dist/chunks/useClick-fvwb39qgead2jyft.js +86 -0
- package/dist/chunks/useCollapsiblePanel-bw63vwvq9a3sj73q.js +379 -0
- package/dist/chunks/useCompositeItem-esr3n4pmlssiuxuy.js +31 -0
- package/dist/chunks/useCompositeListItem-0exfww37ospqz69b.js +75 -0
- package/dist/chunks/useControlled-nlx0kk1ksgk0auvi.js +52 -0
- package/dist/chunks/useDismiss-l2gbj4cain4zqtne.js +353 -0
- package/dist/chunks/useFilteredItems-ckor5h4rcmztfgt1.js +183 -0
- package/dist/chunks/useFloatingRootContext-jo582qzez5k9gbgk.js +51 -0
- package/dist/chunks/useFocus-e8drzpkl9flxq1o1.js +122 -0
- package/dist/chunks/useForcedRerendering-el1fbg3ib5yo0v7k.js +14 -0
- package/dist/chunks/useId-l9soitgw3e4jk5ie.js +32 -0
- package/dist/chunks/useIsHydrating-b6whcsimonagru6u.js +22 -0
- package/dist/chunks/useLabel-nh9hf8h7o6oquqn5.js +47 -0
- package/dist/chunks/useLabelableId-b1kwq9st3rjrtakn.js +60 -0
- package/dist/chunks/useListNavigation-iyo9r9vug2g1clmc.js +447 -0
- package/dist/chunks/useOnMount-j4wobeq47l3u9olo.js +12 -0
- package/dist/chunks/useOpenChangeComplete-dpkex2e23s1evpol.js +117 -0
- package/dist/chunks/usePopupViewport-at3zpph46apa78a3.js +343 -0
- package/dist/chunks/usePositioner-h1n5q86am1sjo5hn.js +602 -0
- package/dist/chunks/usePreviousValue-le0grv8f43vmunn1.js +21 -0
- package/dist/chunks/useRegisterFieldControl-m1rxsuvtpau2341n.js +34 -0
- package/dist/chunks/useRegisteredLabelId-dh83mybmzy75waje.js +16 -0
- package/dist/chunks/useRender-gtnbrp1ityffi4xf.js +13 -0
- package/dist/chunks/useRenderDialogRoot-ecyv072j7yj8q0w3.js +262 -0
- package/dist/chunks/useRenderElement-m8kc7jyuczp71mq8.js +433 -0
- package/dist/chunks/useScrollLock-lj0spjth12xjeap0.js +854 -0
- package/dist/chunks/useStableCallback-ninxmksdjvwl6ejj.js +38 -0
- package/dist/chunks/useSwipeDismiss-bpbyw2ihsw3fw6y9.js +818 -0
- package/dist/chunks/useTimeout-oqptmu2xmyv5ccic.js +43 -0
- package/dist/chunks/useTransitionStatus-ig4waxl2kervpyw4.js +66 -0
- package/dist/chunks/useTriggerFocusGuards-j8nano0pqu9dscrz.js +49 -0
- package/dist/chunks/useTypeahead-onenwjyhgw955ygx.js +114 -0
- package/dist/chunks/useValueAsRef-lrn42zari17368c9.js +27 -0
- package/dist/chunks/useValueChanged-kthmz4wk7ywnjwtx.js +18 -0
- package/dist/chunks/utils-0i7gujfv3f3e9dqh.js +19 -0
- package/dist/chunks/valueToPercent-henpkkj3juy3ukeu.js +7 -0
- package/dist/chunks/vendor-floating-ui-dsysdmve7iazaaes.js +1558 -0
- package/dist/chunks/vendor-styling-da1xibnxfkjmtglr.js +3631 -0
- package/dist/chunks/vendor-utils-luqsvbyuig727bnr.js +512 -0
- package/dist/chunks/vesper-ho3j3gt6ilwfuc1g.js +5 -0
- package/dist/chunks/visuallyHidden-n14xllazfozg55ox.js +24 -0
- package/dist/chunks/wasm-nfbosyhilcq70atf.js +8 -0
- package/dist/chunks/yaml-kzk5ddyekbyha04v.js +4 -0
- package/dist/cn-DCSItmT-.d.ts +5 -0
- package/dist/code/server.d.ts +97 -0
- package/dist/code/server.js +146 -84
- package/dist/code.d.ts +82 -0
- package/dist/code.js +348 -248
- package/dist/components/autocomplete.d.ts +2 -0
- package/dist/components/autocomplete.js +2 -8
- package/dist/components/badge.d.ts +2 -0
- package/dist/components/badge.js +2 -6
- package/dist/components/banner.d.ts +2 -0
- package/dist/components/banner.js +2 -6
- package/dist/components/breadcrumbs.d.ts +2 -0
- package/dist/components/breadcrumbs.js +2 -8
- package/dist/components/button.d.ts +3 -0
- package/dist/components/button.js +2 -8
- package/dist/components/chart.d.ts +2 -0
- package/dist/components/chart.js +2 -11
- package/dist/components/checkbox.d.ts +2 -0
- package/dist/components/checkbox.js +2 -7
- package/dist/components/clipboard-text.d.ts +2 -0
- package/dist/components/clipboard-text.js +2 -5
- package/dist/components/cloudflare-logo.d.ts +2 -0
- package/dist/components/cloudflare-logo.js +2 -9
- package/dist/components/code.d.ts +2 -0
- package/dist/components/code.js +2 -6
- package/dist/components/collapsible.d.ts +2 -0
- package/dist/components/collapsible.js +2 -5
- package/dist/components/combobox.d.ts +2 -0
- package/dist/components/combobox.js +2 -5
- package/dist/components/command-palette.d.ts +2 -0
- package/dist/components/command-palette.js +2 -7
- package/dist/components/date-picker.d.ts +2 -0
- package/dist/components/date-picker.js +2 -5
- package/dist/components/date-range-picker.d.ts +2 -0
- package/dist/components/date-range-picker.js +2 -5
- package/dist/components/dialog.d.ts +2 -0
- package/dist/components/dialog.js +2 -10
- package/dist/components/dropdown.d.ts +2 -0
- package/dist/components/dropdown.js +2 -5
- package/dist/components/empty.d.ts +2 -0
- package/dist/components/empty.js +2 -8
- package/dist/components/field.d.ts +2 -0
- package/dist/components/field.js +2 -9
- package/dist/components/flow.d.ts +2 -0
- package/dist/components/flow.js +2 -5839
- package/dist/components/grid.d.ts +2 -0
- package/dist/components/grid.js +2 -10
- package/dist/components/input-group.d.ts +2 -0
- package/dist/components/input-group.js +2 -7
- package/dist/components/input.d.ts +4 -0
- package/dist/components/input.js +4 -13
- package/dist/components/label.d.ts +2 -0
- package/dist/components/label.js +2 -9
- package/dist/components/layer-card.d.ts +2 -0
- package/dist/components/layer-card.js +2 -5
- package/dist/components/link.d.ts +68 -0
- package/dist/components/link.js +2 -8
- package/dist/components/loader.d.ts +2 -0
- package/dist/components/loader.js +3 -7
- package/dist/components/menubar.d.ts +2 -0
- package/dist/components/menubar.js +2 -6
- package/dist/components/meter.d.ts +2 -0
- package/dist/components/meter.js +2 -5
- package/dist/components/pagination.d.ts +2 -0
- package/dist/components/pagination.js +2 -5
- package/dist/components/popover.d.ts +2 -0
- package/dist/components/popover.js +2 -13
- package/dist/components/radio.d.ts +2 -0
- package/dist/components/radio.js +2 -9
- package/dist/components/select.d.ts +2 -0
- package/dist/components/select.js +2 -5
- package/dist/components/sensitive-input.d.ts +2 -0
- package/dist/components/sensitive-input.js +2 -7
- package/dist/components/sidebar.d.ts +2 -0
- package/dist/components/sidebar.js +2 -33
- package/dist/components/surface.d.ts +2 -0
- package/dist/components/surface.js +2 -5
- package/dist/components/switch.d.ts +2 -0
- package/dist/components/switch.js +2 -7
- package/dist/components/table-of-contents.d.ts +2 -0
- package/dist/components/table-of-contents.js +2 -7
- package/dist/components/table.d.ts +2 -0
- package/dist/components/table.js +2 -7
- package/dist/components/tabs.d.ts +2 -0
- package/dist/components/tabs.js +2 -5
- package/dist/components/text.d.ts +2 -0
- package/dist/components/text.js +2 -5
- package/dist/components/toast.d.ts +2 -0
- package/dist/components/toast.js +3 -10
- package/dist/components/toolbar.d.ts +2 -0
- package/dist/components/toolbar.js +2 -7
- package/dist/components/tooltip.d.ts +2 -0
- package/dist/components/tooltip.js +2 -6
- package/dist/field-DIjlHM8W.d.ts +91 -0
- package/dist/index-AMEc1MEg2.d.ts +180 -0
- package/dist/index-B-hCpI5K.d.ts +1 -0
- package/dist/index-B6LJIy7_2.d.ts +52 -0
- package/dist/index-B9niVl3r.d.ts +140 -0
- package/dist/index-BAQwS4mL.d.ts +70 -0
- package/dist/index-BD-gTiEv.d.ts +71 -0
- package/dist/index-BVgXnR1V.d.ts +137 -0
- package/dist/index-Bgl_czT12.d.ts +140 -0
- package/dist/index-BkyMHk632.d.ts +110 -0
- package/dist/index-BlEUcijd.d.ts +795 -0
- package/dist/index-BoPqM1Ia2.d.ts +179 -0
- package/dist/index-BzE0aNpx.d.ts +143 -0
- package/dist/index-C3iraF8M2.d.ts +100 -0
- package/dist/index-CGbkysYW2.d.ts +161 -0
- package/dist/index-CLsBWiaS.d.ts +79 -0
- package/dist/index-CSWbPhke.d.ts +126 -0
- package/dist/index-CYoiniZ4.d.ts +135 -0
- package/dist/index-CeBzVJP8.d.ts +426 -0
- package/dist/index-ClS-eFxE.d.ts +104 -0
- package/dist/index-Cp0aQngm.d.ts +182 -0
- package/dist/index-CzIWigmH.d.ts +62 -0
- package/dist/index-CzTgKPh-.d.ts +105 -0
- package/dist/index-D-y1ktn-.d.ts +68 -0
- package/dist/index-D2Gvly0i2.d.ts +96 -0
- package/dist/index-DBlw3E9m.d.ts +166 -0
- package/dist/index-DCA5tjHa.d.ts +68 -0
- package/dist/index-DIV3riUd2.d.ts +148 -0
- package/dist/index-DJIRVD5B.d.ts +85 -0
- package/dist/index-DUCaDjfd.d.ts +240 -0
- package/dist/index-Di3sC6UF.d.ts +91 -0
- package/dist/index-DnbdiagK.d.ts +171 -0
- package/dist/index-DpzpArsi2.d.ts +614 -0
- package/dist/index-Dsn2VLZv.d.ts +238 -0
- package/dist/index-FZvrMcIo2.d.ts +158 -0
- package/dist/index-J1qdw9mL.d.ts +188 -0
- package/dist/index-Vj9ZzRh0.d.ts +66 -0
- package/dist/index-bAud6rG22.d.ts +278 -0
- package/dist/index-lOWfpkxK.d.ts +118 -0
- package/dist/index-yK3Hayg_.d.ts +40 -0
- package/dist/index.d.ts +102 -0
- package/dist/index.js +195 -348
- package/dist/input-BeWEb-jD.d.ts +122 -0
- package/dist/input-group-DpGSsAZy.d.ts +100 -0
- package/dist/layer-card-BNIn9pqy.d.ts +56 -0
- package/dist/link-provider-tz-NJp9x.d.ts +67 -0
- package/dist/portal-provider-4AHCxYE6.d.ts +51 -0
- package/dist/primitives/accordion.d.ts +1 -0
- package/dist/primitives/accordion.js +2 -5
- package/dist/primitives/alert-dialog.d.ts +1 -0
- package/dist/primitives/alert-dialog.js +2 -5
- package/dist/primitives/autocomplete.d.ts +1 -0
- package/dist/primitives/autocomplete.js +2 -5
- package/dist/primitives/avatar.d.ts +1 -0
- package/dist/primitives/avatar.js +2 -5
- package/dist/primitives/button.d.ts +1 -0
- package/dist/primitives/button.js +2 -5
- package/dist/primitives/checkbox-group.d.ts +1 -0
- package/dist/primitives/checkbox-group.js +2 -5
- package/dist/primitives/checkbox.d.ts +1 -0
- package/dist/primitives/checkbox.js +2 -5
- package/dist/primitives/collapsible.d.ts +1 -0
- package/dist/primitives/collapsible.js +2 -5
- package/dist/primitives/combobox.d.ts +1 -0
- package/dist/primitives/combobox.js +2 -5
- package/dist/primitives/context-menu.d.ts +1 -0
- package/dist/primitives/context-menu.js +2 -5
- package/dist/primitives/csp-provider.d.ts +1 -0
- package/dist/primitives/csp-provider.js +2 -5
- package/dist/primitives/dialog.d.ts +1 -0
- package/dist/primitives/dialog.js +2 -5
- package/dist/primitives/direction-provider.d.ts +1 -0
- package/dist/primitives/direction-provider.js +3 -6
- package/dist/primitives/drawer.d.ts +1 -0
- package/dist/primitives/drawer.js +2 -5
- package/dist/primitives/field.d.ts +1 -0
- package/dist/primitives/field.js +2 -5
- package/dist/primitives/fieldset.d.ts +1 -0
- package/dist/primitives/fieldset.js +2 -5
- package/dist/primitives/form.d.ts +1 -0
- package/dist/primitives/form.js +2 -5
- package/dist/primitives/input.d.ts +1 -0
- package/dist/primitives/input.js +2 -5
- package/dist/primitives/menu.d.ts +1 -0
- package/dist/primitives/menu.js +2 -5
- package/dist/primitives/menubar.d.ts +1 -0
- package/dist/primitives/menubar.js +2 -5
- package/dist/primitives/meter.d.ts +1 -0
- package/dist/primitives/meter.js +2 -5
- package/dist/primitives/navigation-menu.d.ts +1 -0
- package/dist/primitives/navigation-menu.js +2 -5
- package/dist/primitives/number-field.d.ts +1 -0
- package/dist/primitives/number-field.js +2 -5
- package/dist/primitives/otp-field.d.ts +3 -0
- package/dist/primitives/otp-field.js +2 -6
- package/dist/primitives/popover.d.ts +1 -0
- package/dist/primitives/popover.js +2 -5
- package/dist/primitives/preview-card.d.ts +1 -0
- package/dist/primitives/preview-card.js +2 -5
- package/dist/primitives/progress.d.ts +1 -0
- package/dist/primitives/progress.js +2 -5
- package/dist/primitives/radio-group.d.ts +1 -0
- package/dist/primitives/radio-group.js +2 -5
- package/dist/primitives/radio.d.ts +1 -0
- package/dist/primitives/radio.js +2 -5
- package/dist/primitives/scroll-area.d.ts +1 -0
- package/dist/primitives/scroll-area.js +2 -5
- package/dist/primitives/select.d.ts +1 -0
- package/dist/primitives/select.js +2 -5
- package/dist/primitives/separator.d.ts +1 -0
- package/dist/primitives/separator.js +2 -5
- package/dist/primitives/slider.d.ts +1 -0
- package/dist/primitives/slider.js +2 -5
- package/dist/primitives/switch.d.ts +1 -0
- package/dist/primitives/switch.js +2 -5
- package/dist/primitives/tabs.d.ts +1 -0
- package/dist/primitives/tabs.js +2 -5
- package/dist/primitives/toast.d.ts +1 -0
- package/dist/primitives/toast.js +2 -5
- package/dist/primitives/toggle-group.d.ts +1 -0
- package/dist/primitives/toggle-group.js +2 -5
- package/dist/primitives/toggle.d.ts +1 -0
- package/dist/primitives/toggle.js +2 -5
- package/dist/primitives/toolbar.d.ts +1 -0
- package/dist/primitives/toolbar.js +2 -5
- package/dist/primitives/tooltip.d.ts +1 -0
- package/dist/primitives/tooltip.js +2 -5
- package/dist/primitives.d.ts +42 -0
- package/dist/primitives.js +42 -46
- package/dist/registry.d.ts +2 -0
- package/dist/registry.js +0 -1
- package/dist/scripts/theme-generator/config.d.ts +7 -5
- package/dist/scripts/theme-generator/config.js +475 -627
- package/dist/scripts/theme-generator/types.d.ts +51 -49
- package/dist/scripts/theme-generator/types.js +0 -1
- package/dist/styles/kumo-binding.css +35 -8
- package/dist/styles/kumo-standalone.css +1 -1
- package/dist/styles/kumo.css +3 -5
- package/dist/styles/theme-fedramp.css +7 -15
- package/dist/styles/theme-kumo.css +101 -56
- package/dist/tooltip-BuCo6Ki4.d.ts +105 -0
- package/dist/types-C402rKiz.d.ts +132 -0
- package/dist/types-CdzJnnIl.d.ts +193 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.js +5 -12
- package/package.json +231 -232
- package/scripts/component-registry/discovery.ts +87 -0
- package/scripts/component-registry/index.test.ts +90 -2
- package/scripts/component-registry/index.ts +27 -2
- package/scripts/component-registry/metadata.ts +3 -4
- package/scripts/component-registry/props-filter.ts +3 -1
- package/scripts/component-registry/sub-components.ts +34 -21
- package/scripts/component-registry/variant-parser.ts +1 -0
- package/scripts/generate-primitives.ts +1 -1
- package/scripts/theme-generator/config.ts +21 -22
- package/scripts/theme-generator/generate-css.test.ts +1 -1
- package/dist/ai/schemas.d.ts.map +0 -1
- package/dist/ai/schemas.js.map +0 -1
- package/dist/catalog.js.map +0 -1
- package/dist/chunks/Maps-fkiyllhs5w0qzw1y.js +0 -2155
- package/dist/chunks/Maps-fkiyllhs5w0qzw1y.js.map +0 -1
- package/dist/chunks/autocomplete-a4gvspveibfuod24.js +0 -193
- package/dist/chunks/autocomplete-a4gvspveibfuod24.js.map +0 -1
- package/dist/chunks/badge-dfc1r37osagi3rs4.js +0 -163
- package/dist/chunks/badge-dfc1r37osagi3rs4.js.map +0 -1
- package/dist/chunks/banner-j52y8l13puk7dybi.js +0 -120
- package/dist/chunks/banner-j52y8l13puk7dybi.js.map +0 -1
- package/dist/chunks/bash-g5z23u7me5rx7bzt.js +0 -15
- package/dist/chunks/bash-g5z23u7me5rx7bzt.js.map +0 -1
- package/dist/chunks/breadcrumbs-js59m7m57bdsveew.js +0 -169
- package/dist/chunks/breadcrumbs-js59m7m57bdsveew.js.map +0 -1
- package/dist/chunks/button-ebfdg9mkhojue36n.js +0 -237
- package/dist/chunks/button-ebfdg9mkhojue36n.js.map +0 -1
- package/dist/chunks/checkbox-k355pnfisqt0h4eg.js +0 -216
- package/dist/chunks/checkbox-k355pnfisqt0h4eg.js.map +0 -1
- package/dist/chunks/clipboard-text-isb05zkg2aox0tp6.js +0 -191
- package/dist/chunks/clipboard-text-isb05zkg2aox0tp6.js.map +0 -1
- package/dist/chunks/cloudflare-logo-fiuocxdxqrxawjfv.js +0 -175
- package/dist/chunks/cloudflare-logo-fiuocxdxqrxawjfv.js.map +0 -1
- package/dist/chunks/cn-bo7ya7641lkickbt.js +0 -22
- package/dist/chunks/cn-bo7ya7641lkickbt.js.map +0 -1
- package/dist/chunks/code-pbkfdfat0yilg6dx.js +0 -61
- package/dist/chunks/code-pbkfdfat0yilg6dx.js.map +0 -1
- package/dist/chunks/collapsible-f9hgtc1u6xvqrgt8.js +0 -76
- package/dist/chunks/collapsible-f9hgtc1u6xvqrgt8.js.map +0 -1
- package/dist/chunks/combobox-hc9wi9nwsyyli8ur.js +0 -408
- package/dist/chunks/combobox-hc9wi9nwsyyli8ur.js.map +0 -1
- package/dist/chunks/command-palette-c03zze4ayuytwxjg.js +0 -403
- package/dist/chunks/command-palette-c03zze4ayuytwxjg.js.map +0 -1
- package/dist/chunks/core-dyku7qctyc40nnhh.js +0 -5464
- package/dist/chunks/core-dyku7qctyc40nnhh.js.map +0 -1
- package/dist/chunks/css-d1mi3wy1sl3fzekh.js +0 -8
- package/dist/chunks/css-d1mi3wy1sl3fzekh.js.map +0 -1
- package/dist/chunks/date-picker-bffp889exjixmgz3.js +0 -2921
- package/dist/chunks/date-picker-bffp889exjixmgz3.js.map +0 -1
- package/dist/chunks/date-range-picker-oks2r14lbbukd545.js +0 -408
- package/dist/chunks/date-range-picker-oks2r14lbbukd545.js.map +0 -1
- package/dist/chunks/dialog-ovhmzfuppr5xix0e.js +0 -134
- package/dist/chunks/dialog-ovhmzfuppr5xix0e.js.map +0 -1
- package/dist/chunks/diff-cpj1h9lg0bw716mj.js +0 -8
- package/dist/chunks/diff-cpj1h9lg0bw716mj.js.map +0 -1
- package/dist/chunks/dropdown-iey8f344rd5dgahz.js +0 -321
- package/dist/chunks/dropdown-iey8f344rd5dgahz.js.map +0 -1
- package/dist/chunks/empty-k83r53jh5utqvv7w.js +0 -94
- package/dist/chunks/empty-k83r53jh5utqvv7w.js.map +0 -1
- package/dist/chunks/engine-javascript-hi1kqifa6nkcridk.js +0 -2638
- package/dist/chunks/engine-javascript-hi1kqifa6nkcridk.js.map +0 -1
- package/dist/chunks/engine-oniguruma-g75h8oxao68cjmhg.js +0 -295
- package/dist/chunks/engine-oniguruma-g75h8oxao68cjmhg.js.map +0 -1
- package/dist/chunks/field-bmglk138wa8bf3ei.js +0 -77
- package/dist/chunks/field-bmglk138wa8bf3ei.js.map +0 -1
- package/dist/chunks/github-light-ulev8flhimfg79ob.js +0 -6
- package/dist/chunks/github-light-ulev8flhimfg79ob.js.map +0 -1
- package/dist/chunks/graphql-ft2h47erta7isqn4.js +0 -16
- package/dist/chunks/graphql-ft2h47erta7isqn4.js.map +0 -1
- package/dist/chunks/grid-jze04557ljywg3uc.js +0 -128
- package/dist/chunks/grid-jze04557ljywg3uc.js.map +0 -1
- package/dist/chunks/hcl-hcu7d6ja6t540ijn.js +0 -8
- package/dist/chunks/hcl-hcu7d6ja6t540ijn.js.map +0 -1
- package/dist/chunks/html-kl304jmqj4jxj777.js +0 -12
- package/dist/chunks/html-kl304jmqj4jxj777.js.map +0 -1
- package/dist/chunks/input-area-ixtj4e8eny58nbf9.js +0 -78
- package/dist/chunks/input-area-ixtj4e8eny58nbf9.js.map +0 -1
- package/dist/chunks/input-ckl5misj0jd9cu5r.js +0 -130
- package/dist/chunks/input-ckl5misj0jd9cu5r.js.map +0 -1
- package/dist/chunks/input-group-bflx1m6ki55e99vf.js +0 -505
- package/dist/chunks/input-group-bflx1m6ki55e99vf.js.map +0 -1
- package/dist/chunks/javascript-hhx3avh9uv2o27ay.js +0 -8
- package/dist/chunks/javascript-hhx3avh9uv2o27ay.js.map +0 -1
- package/dist/chunks/json-jovp9qemdkp5cziz.js +0 -8
- package/dist/chunks/json-jovp9qemdkp5cziz.js.map +0 -1
- package/dist/chunks/jsonc-jbkkgjer6ispw2u3.js +0 -8
- package/dist/chunks/jsonc-jbkkgjer6ispw2u3.js.map +0 -1
- package/dist/chunks/jsx-ij885l2li2lzfoss.js +0 -8
- package/dist/chunks/jsx-ij885l2li2lzfoss.js.map +0 -1
- package/dist/chunks/label-i1xbmg8y1n0tbtkx.js +0 -68
- package/dist/chunks/label-i1xbmg8y1n0tbtkx.js.map +0 -1
- package/dist/chunks/layer-card-m6h85dpadvee39h2.js +0 -47
- package/dist/chunks/layer-card-m6h85dpadvee39h2.js.map +0 -1
- package/dist/chunks/link-j93fl5m8zrcfivsr.js +0 -95
- package/dist/chunks/link-j93fl5m8zrcfivsr.js.map +0 -1
- package/dist/chunks/link-provider-mn2voeohon7cj9o4.js +0 -22
- package/dist/chunks/link-provider-mn2voeohon7cj9o4.js.map +0 -1
- package/dist/chunks/loader-g8a6j76ue5nq0lr8.js +0 -109
- package/dist/chunks/loader-g8a6j76ue5nq0lr8.js.map +0 -1
- package/dist/chunks/markdown-n2vyyq7l68fy32wc.js +0 -8
- package/dist/chunks/markdown-n2vyyq7l68fy32wc.js.map +0 -1
- package/dist/chunks/menubar-opzxfzylaatfz4nv.js +0 -98
- package/dist/chunks/menubar-opzxfzylaatfz4nv.js.map +0 -1
- package/dist/chunks/meter-6br6z5ekw41trxeh.js +0 -51
- package/dist/chunks/meter-6br6z5ekw41trxeh.js.map +0 -1
- package/dist/chunks/pagination-j33ntwqmm9qskfgv.js +0 -266
- package/dist/chunks/pagination-j33ntwqmm9qskfgv.js.map +0 -1
- package/dist/chunks/popover-cqdmpp8i4hg8gzzx.js +0 -181
- package/dist/chunks/popover-cqdmpp8i4hg8gzzx.js.map +0 -1
- package/dist/chunks/portal-provider-hwmkdmkpvct0cb76.js +0 -18
- package/dist/chunks/portal-provider-hwmkdmkpvct0cb76.js.map +0 -1
- package/dist/chunks/python-gg755pb8oe9ra1d1.js +0 -8
- package/dist/chunks/python-gg755pb8oe9ra1d1.js.map +0 -1
- package/dist/chunks/radio-ejey7i6r4tq314av.js +0 -226
- package/dist/chunks/radio-ejey7i6r4tq314av.js.map +0 -1
- package/dist/chunks/resolve-variant-gw6eh7fa4st8ej7m.js +0 -11
- package/dist/chunks/resolve-variant-gw6eh7fa4st8ej7m.js.map +0 -1
- package/dist/chunks/select-p8adn2tnpom25hpl.js +0 -237
- package/dist/chunks/select-p8adn2tnpom25hpl.js.map +0 -1
- package/dist/chunks/sensitive-input-it1hsswlccq3u7g6.js +0 -273
- package/dist/chunks/sensitive-input-it1hsswlccq3u7g6.js.map +0 -1
- package/dist/chunks/sidebar-ctd980heycmxsux1.js +0 -1144
- package/dist/chunks/sidebar-ctd980heycmxsux1.js.map +0 -1
- package/dist/chunks/skeleton-line-omxgxia23vpav94x.js +0 -33
- package/dist/chunks/skeleton-line-omxgxia23vpav94x.js.map +0 -1
- package/dist/chunks/sql-ovukp5mrfunfk5tv.js +0 -8
- package/dist/chunks/sql-ovukp5mrfunfk5tv.js.map +0 -1
- package/dist/chunks/surface-gc2gblserrxcb1eg.js +0 -29
- package/dist/chunks/surface-gc2gblserrxcb1eg.js.map +0 -1
- package/dist/chunks/switch-ljsq915e0l1a5mjd.js +0 -256
- package/dist/chunks/switch-ljsq915e0l1a5mjd.js.map +0 -1
- package/dist/chunks/table-of-contents-cghjqyk43nj5zmlw.js +0 -106
- package/dist/chunks/table-of-contents-cghjqyk43nj5zmlw.js.map +0 -1
- package/dist/chunks/table-ojjjeqszmt9jgnug.js +0 -208
- package/dist/chunks/table-ojjjeqszmt9jgnug.js.map +0 -1
- package/dist/chunks/tabs-kemdy19kfesj2xjr.js +0 -177
- package/dist/chunks/tabs-kemdy19kfesj2xjr.js.map +0 -1
- package/dist/chunks/text-oqp48b9m5u6t62b4.js +0 -103
- package/dist/chunks/text-oqp48b9m5u6t62b4.js.map +0 -1
- package/dist/chunks/toast-ldj9zi940w83ub90.js +0 -386
- package/dist/chunks/toast-ldj9zi940w83ub90.js.map +0 -1
- package/dist/chunks/toml-nczb2z9n0o23o3ci.js +0 -8
- package/dist/chunks/toml-nczb2z9n0o23o3ci.js.map +0 -1
- package/dist/chunks/toolbar-lmylyrod70sn0q4i.js +0 -172
- package/dist/chunks/toolbar-lmylyrod70sn0q4i.js.map +0 -1
- package/dist/chunks/tooltip-mooldq78tg77ekvv.js +0 -103
- package/dist/chunks/tooltip-mooldq78tg77ekvv.js.map +0 -1
- package/dist/chunks/tsx-ehy8lrzet6v54zur.js +0 -8
- package/dist/chunks/tsx-ehy8lrzet6v54zur.js.map +0 -1
- package/dist/chunks/typescript-k4ggjrxhrhcdni6u.js +0 -8
- package/dist/chunks/typescript-k4ggjrxhrhcdni6u.js.map +0 -1
- package/dist/chunks/vendor-base-ui-elpbzr8xeffrz4h2.js +0 -25027
- package/dist/chunks/vendor-base-ui-elpbzr8xeffrz4h2.js.map +0 -1
- package/dist/chunks/vendor-floating-ui-k1zjlb8fkwtcw4k5.js +0 -1310
- package/dist/chunks/vendor-floating-ui-k1zjlb8fkwtcw4k5.js.map +0 -1
- package/dist/chunks/vendor-styling-ofvnbcuht98q88oo.js +0 -3252
- package/dist/chunks/vendor-styling-ofvnbcuht98q88oo.js.map +0 -1
- package/dist/chunks/vendor-utils-m5h2xu7s2rs3pgk5.js +0 -217
- package/dist/chunks/vendor-utils-m5h2xu7s2rs3pgk5.js.map +0 -1
- package/dist/chunks/vesper-ebfu9ns65f2v830s.js +0 -6
- package/dist/chunks/vesper-ebfu9ns65f2v830s.js.map +0 -1
- package/dist/chunks/wasm-oj22f8usru9h7dzg.js +0 -9
- package/dist/chunks/wasm-oj22f8usru9h7dzg.js.map +0 -1
- package/dist/chunks/yaml-e2v22lr79tss2brj.js +0 -8
- package/dist/chunks/yaml-e2v22lr79tss2brj.js.map +0 -1
- package/dist/code/server.js.map +0 -1
- package/dist/code.js.map +0 -1
- package/dist/components/autocomplete.js.map +0 -1
- package/dist/components/badge.js.map +0 -1
- package/dist/components/banner.js.map +0 -1
- package/dist/components/breadcrumbs.js.map +0 -1
- package/dist/components/button.js.map +0 -1
- package/dist/components/chart.js.map +0 -1
- package/dist/components/checkbox.js.map +0 -1
- package/dist/components/clipboard-text.js.map +0 -1
- package/dist/components/cloudflare-logo.js.map +0 -1
- package/dist/components/code.js.map +0 -1
- package/dist/components/collapsible.js.map +0 -1
- package/dist/components/combobox.js.map +0 -1
- package/dist/components/command-palette.js.map +0 -1
- package/dist/components/date-picker.js.map +0 -1
- package/dist/components/date-range-picker.js.map +0 -1
- package/dist/components/dialog.js.map +0 -1
- package/dist/components/dropdown.js.map +0 -1
- package/dist/components/empty.js.map +0 -1
- package/dist/components/field.js.map +0 -1
- package/dist/components/flow.js.map +0 -1
- package/dist/components/grid.js.map +0 -1
- package/dist/components/input-group.js.map +0 -1
- package/dist/components/input.js.map +0 -1
- package/dist/components/label.js.map +0 -1
- package/dist/components/layer-card.js.map +0 -1
- package/dist/components/link.js.map +0 -1
- package/dist/components/loader.js.map +0 -1
- package/dist/components/menubar.js.map +0 -1
- package/dist/components/meter.js.map +0 -1
- package/dist/components/pagination.js.map +0 -1
- package/dist/components/popover.js.map +0 -1
- package/dist/components/radio.js.map +0 -1
- package/dist/components/select.js.map +0 -1
- package/dist/components/sensitive-input.js.map +0 -1
- package/dist/components/sidebar.js.map +0 -1
- package/dist/components/surface.js.map +0 -1
- package/dist/components/switch.js.map +0 -1
- package/dist/components/table-of-contents.js.map +0 -1
- package/dist/components/table.js.map +0 -1
- package/dist/components/tabs.js.map +0 -1
- package/dist/components/text.js.map +0 -1
- package/dist/components/toast.js.map +0 -1
- package/dist/components/toolbar.js.map +0 -1
- package/dist/components/tooltip.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/primitives/accordion.js.map +0 -1
- package/dist/primitives/alert-dialog.js.map +0 -1
- package/dist/primitives/autocomplete.js.map +0 -1
- package/dist/primitives/avatar.js.map +0 -1
- package/dist/primitives/button.js.map +0 -1
- package/dist/primitives/checkbox-group.js.map +0 -1
- package/dist/primitives/checkbox.js.map +0 -1
- package/dist/primitives/collapsible.js.map +0 -1
- package/dist/primitives/combobox.js.map +0 -1
- package/dist/primitives/context-menu.js.map +0 -1
- package/dist/primitives/csp-provider.js.map +0 -1
- package/dist/primitives/dialog.js.map +0 -1
- package/dist/primitives/direction-provider.js.map +0 -1
- package/dist/primitives/drawer.js.map +0 -1
- package/dist/primitives/field.js.map +0 -1
- package/dist/primitives/fieldset.js.map +0 -1
- package/dist/primitives/form.js.map +0 -1
- package/dist/primitives/input.js.map +0 -1
- package/dist/primitives/menu.js.map +0 -1
- package/dist/primitives/menubar.js.map +0 -1
- package/dist/primitives/meter.js.map +0 -1
- package/dist/primitives/navigation-menu.js.map +0 -1
- package/dist/primitives/number-field.js.map +0 -1
- package/dist/primitives/otp-field.js.map +0 -1
- package/dist/primitives/popover.js.map +0 -1
- package/dist/primitives/preview-card.js.map +0 -1
- package/dist/primitives/progress.js.map +0 -1
- package/dist/primitives/radio-group.js.map +0 -1
- package/dist/primitives/radio.js.map +0 -1
- package/dist/primitives/scroll-area.js.map +0 -1
- package/dist/primitives/select.js.map +0 -1
- package/dist/primitives/separator.js.map +0 -1
- package/dist/primitives/slider.js.map +0 -1
- package/dist/primitives/switch.js.map +0 -1
- package/dist/primitives/tabs.js.map +0 -1
- package/dist/primitives/toast.js.map +0 -1
- package/dist/primitives/toggle-group.js.map +0 -1
- package/dist/primitives/toggle.js.map +0 -1
- package/dist/primitives/toolbar.js.map +0 -1
- package/dist/primitives/tooltip.js.map +0 -1
- package/dist/primitives.js.map +0 -1
- package/dist/registry.js.map +0 -1
- package/dist/scripts/theme-generator/config.d.ts.map +0 -1
- package/dist/scripts/theme-generator/config.js.map +0 -1
- package/dist/scripts/theme-generator/generate-css.d.ts +0 -31
- package/dist/scripts/theme-generator/generate-css.d.ts.map +0 -1
- package/dist/scripts/theme-generator/index.d.ts +0 -13
- package/dist/scripts/theme-generator/index.d.ts.map +0 -1
- package/dist/scripts/theme-generator/migrate.d.ts +0 -56
- package/dist/scripts/theme-generator/migrate.d.ts.map +0 -1
- package/dist/scripts/theme-generator/types.d.ts.map +0 -1
- package/dist/scripts/theme-generator/types.js.map +0 -1
- package/dist/src/blocks/delete-resource/delete-resource.d.ts +0 -46
- package/dist/src/blocks/delete-resource/delete-resource.d.ts.map +0 -1
- package/dist/src/blocks/delete-resource/index.d.ts +0 -2
- package/dist/src/blocks/delete-resource/index.d.ts.map +0 -1
- package/dist/src/blocks/page-header/index.d.ts +0 -2
- package/dist/src/blocks/page-header/index.d.ts.map +0 -1
- package/dist/src/blocks/page-header/page-header.d.ts +0 -38
- package/dist/src/blocks/page-header/page-header.d.ts.map +0 -1
- package/dist/src/blocks/resource-list/index.d.ts +0 -2
- package/dist/src/blocks/resource-list/index.d.ts.map +0 -1
- package/dist/src/blocks/resource-list/resource-list.d.ts +0 -18
- package/dist/src/blocks/resource-list/resource-list.d.ts.map +0 -1
- package/dist/src/catalog/catalog.d.ts +0 -75
- package/dist/src/catalog/catalog.d.ts.map +0 -1
- package/dist/src/catalog/data.d.ts +0 -44
- package/dist/src/catalog/data.d.ts.map +0 -1
- package/dist/src/catalog/index.d.ts +0 -39
- package/dist/src/catalog/index.d.ts.map +0 -1
- package/dist/src/catalog/types.d.ts +0 -226
- package/dist/src/catalog/types.d.ts.map +0 -1
- package/dist/src/catalog/visibility.d.ts +0 -37
- package/dist/src/catalog/visibility.d.ts.map +0 -1
- package/dist/src/code/code-highlighted.d.ts +0 -32
- package/dist/src/code/code-highlighted.d.ts.map +0 -1
- package/dist/src/code/context.d.ts +0 -16
- package/dist/src/code/context.d.ts.map +0 -1
- package/dist/src/code/index.d.ts +0 -32
- package/dist/src/code/index.d.ts.map +0 -1
- package/dist/src/code/provider.d.ts +0 -13
- package/dist/src/code/provider.d.ts.map +0 -1
- package/dist/src/code/server.d.ts +0 -95
- package/dist/src/code/server.d.ts.map +0 -1
- package/dist/src/code/types.d.ts +0 -130
- package/dist/src/code/types.d.ts.map +0 -1
- package/dist/src/code/use-shiki-highlighter.d.ts +0 -36
- package/dist/src/code/use-shiki-highlighter.d.ts.map +0 -1
- package/dist/src/command-line/build-cli.d.ts +0 -7
- package/dist/src/command-line/build-cli.d.ts.map +0 -1
- package/dist/src/command-line/cli.d.ts +0 -13
- package/dist/src/command-line/cli.d.ts.map +0 -1
- package/dist/src/command-line/commands/add.d.ts +0 -10
- package/dist/src/command-line/commands/add.d.ts.map +0 -1
- package/dist/src/command-line/commands/ai.d.ts +0 -10
- package/dist/src/command-line/commands/ai.d.ts.map +0 -1
- package/dist/src/command-line/commands/blocks.d.ts +0 -10
- package/dist/src/command-line/commands/blocks.d.ts.map +0 -1
- package/dist/src/command-line/commands/doc.d.ts +0 -14
- package/dist/src/command-line/commands/doc.d.ts.map +0 -1
- package/dist/src/command-line/commands/init.d.ts +0 -18
- package/dist/src/command-line/commands/init.d.ts.map +0 -1
- package/dist/src/command-line/commands/ls.d.ts +0 -10
- package/dist/src/command-line/commands/ls.d.ts.map +0 -1
- package/dist/src/command-line/commands/migrate.d.ts +0 -10
- package/dist/src/command-line/commands/migrate.d.ts.map +0 -1
- package/dist/src/command-line/utils/config.d.ts +0 -42
- package/dist/src/command-line/utils/config.d.ts.map +0 -1
- package/dist/src/command-line/utils/transformer.d.ts +0 -21
- package/dist/src/command-line/utils/transformer.d.ts.map +0 -1
- package/dist/src/components/autocomplete/autocomplete.d.ts +0 -181
- package/dist/src/components/autocomplete/autocomplete.d.ts.map +0 -1
- package/dist/src/components/autocomplete/index.d.ts +0 -3
- package/dist/src/components/autocomplete/index.d.ts.map +0 -1
- package/dist/src/components/badge/badge.d.ts +0 -180
- package/dist/src/components/badge/badge.d.ts.map +0 -1
- package/dist/src/components/badge/index.d.ts +0 -2
- package/dist/src/components/badge/index.d.ts.map +0 -1
- package/dist/src/components/banner/banner.d.ts +0 -106
- package/dist/src/components/banner/banner.d.ts.map +0 -1
- package/dist/src/components/banner/index.d.ts +0 -2
- package/dist/src/components/banner/index.d.ts.map +0 -1
- package/dist/src/components/breadcrumbs/breadcrumbs.d.ts +0 -78
- package/dist/src/components/breadcrumbs/breadcrumbs.d.ts.map +0 -1
- package/dist/src/components/breadcrumbs/index.d.ts +0 -2
- package/dist/src/components/breadcrumbs/index.d.ts.map +0 -1
- package/dist/src/components/button/button.d.ts +0 -214
- package/dist/src/components/button/button.d.ts.map +0 -1
- package/dist/src/components/button/index.d.ts +0 -2
- package/dist/src/components/button/index.d.ts.map +0 -1
- package/dist/src/components/chart/Color.d.ts +0 -107
- package/dist/src/components/chart/Color.d.ts.map +0 -1
- package/dist/src/components/chart/EChart.d.ts +0 -166
- package/dist/src/components/chart/EChart.d.ts.map +0 -1
- package/dist/src/components/chart/Legend.d.ts +0 -51
- package/dist/src/components/chart/Legend.d.ts.map +0 -1
- package/dist/src/components/chart/Maps.d.ts +0 -211
- package/dist/src/components/chart/Maps.d.ts.map +0 -1
- package/dist/src/components/chart/SankeyChart.d.ts +0 -98
- package/dist/src/components/chart/SankeyChart.d.ts.map +0 -1
- package/dist/src/components/chart/TimeseriesChart.d.ts +0 -181
- package/dist/src/components/chart/TimeseriesChart.d.ts.map +0 -1
- package/dist/src/components/chart/index.d.ts +0 -7
- package/dist/src/components/chart/index.d.ts.map +0 -1
- package/dist/src/components/chart/tooltip-utils.d.ts +0 -4
- package/dist/src/components/chart/tooltip-utils.d.ts.map +0 -1
- package/dist/src/components/checkbox/checkbox.d.ts +0 -197
- package/dist/src/components/checkbox/checkbox.d.ts.map +0 -1
- package/dist/src/components/checkbox/index.d.ts +0 -2
- package/dist/src/components/checkbox/index.d.ts.map +0 -1
- package/dist/src/components/clipboard-text/clipboard-text.d.ts +0 -88
- package/dist/src/components/clipboard-text/clipboard-text.d.ts.map +0 -1
- package/dist/src/components/clipboard-text/index.d.ts +0 -2
- package/dist/src/components/clipboard-text/index.d.ts.map +0 -1
- package/dist/src/components/cloudflare-logo/cloudflare-logo.d.ts +0 -133
- package/dist/src/components/cloudflare-logo/cloudflare-logo.d.ts.map +0 -1
- package/dist/src/components/cloudflare-logo/index.d.ts +0 -2
- package/dist/src/components/cloudflare-logo/index.d.ts.map +0 -1
- package/dist/src/components/code/code.d.ts +0 -189
- package/dist/src/components/code/code.d.ts.map +0 -1
- package/dist/src/components/code/index.d.ts +0 -4
- package/dist/src/components/code/index.d.ts.map +0 -1
- package/dist/src/components/collapsible/collapsible.d.ts +0 -109
- package/dist/src/components/collapsible/collapsible.d.ts.map +0 -1
- package/dist/src/components/collapsible/index.d.ts +0 -2
- package/dist/src/components/collapsible/index.d.ts.map +0 -1
- package/dist/src/components/combobox/combobox.d.ts +0 -246
- package/dist/src/components/combobox/combobox.d.ts.map +0 -1
- package/dist/src/components/combobox/index.d.ts +0 -3
- package/dist/src/components/combobox/index.d.ts.map +0 -1
- package/dist/src/components/command-palette/command-palette.d.ts +0 -258
- package/dist/src/components/command-palette/command-palette.d.ts.map +0 -1
- package/dist/src/components/command-palette/index.d.ts +0 -3
- package/dist/src/components/command-palette/index.d.ts.map +0 -1
- package/dist/src/components/command-palette/types.d.ts +0 -168
- package/dist/src/components/command-palette/types.d.ts.map +0 -1
- package/dist/src/components/date-picker/date-picker.d.ts +0 -65
- package/dist/src/components/date-picker/date-picker.d.ts.map +0 -1
- package/dist/src/components/date-picker/index.d.ts +0 -4
- package/dist/src/components/date-picker/index.d.ts.map +0 -1
- package/dist/src/components/date-range-picker/date-range-picker.d.ts +0 -125
- package/dist/src/components/date-range-picker/date-range-picker.d.ts.map +0 -1
- package/dist/src/components/date-range-picker/index.d.ts +0 -5
- package/dist/src/components/date-range-picker/index.d.ts.map +0 -1
- package/dist/src/components/dialog/dialog.d.ts +0 -242
- package/dist/src/components/dialog/dialog.d.ts.map +0 -1
- package/dist/src/components/dialog/index.d.ts +0 -2
- package/dist/src/components/dialog/index.d.ts.map +0 -1
- package/dist/src/components/dropdown/dropdown.d.ts +0 -116
- package/dist/src/components/dropdown/dropdown.d.ts.map +0 -1
- package/dist/src/components/dropdown/index.d.ts +0 -2
- package/dist/src/components/dropdown/index.d.ts.map +0 -1
- package/dist/src/components/empty/empty.d.ts +0 -69
- package/dist/src/components/empty/empty.d.ts.map +0 -1
- package/dist/src/components/empty/index.d.ts +0 -2
- package/dist/src/components/empty/index.d.ts.map +0 -1
- package/dist/src/components/field/field.d.ts +0 -89
- package/dist/src/components/field/field.d.ts.map +0 -1
- package/dist/src/components/field/index.d.ts +0 -2
- package/dist/src/components/field/index.d.ts.map +0 -1
- package/dist/src/components/flow/connectors.d.ts +0 -41
- package/dist/src/components/flow/connectors.d.ts.map +0 -1
- package/dist/src/components/flow/diagram.d.ts +0 -98
- package/dist/src/components/flow/diagram.d.ts.map +0 -1
- package/dist/src/components/flow/index.d.ts +0 -26
- package/dist/src/components/flow/index.d.ts.map +0 -1
- package/dist/src/components/flow/node.d.ts +0 -61
- package/dist/src/components/flow/node.d.ts.map +0 -1
- package/dist/src/components/flow/parallel.d.ts +0 -13
- package/dist/src/components/flow/parallel.d.ts.map +0 -1
- package/dist/src/components/flow/use-children.d.ts +0 -87
- package/dist/src/components/flow/use-children.d.ts.map +0 -1
- package/dist/src/components/grid/grid.d.ts +0 -135
- package/dist/src/components/grid/grid.d.ts.map +0 -1
- package/dist/src/components/grid/index.d.ts +0 -2
- package/dist/src/components/grid/index.d.ts.map +0 -1
- package/dist/src/components/input/index.d.ts +0 -19
- package/dist/src/components/input/index.d.ts.map +0 -1
- package/dist/src/components/input/input-area.d.ts +0 -65
- package/dist/src/components/input/input-area.d.ts.map +0 -1
- package/dist/src/components/input/input.d.ts +0 -175
- package/dist/src/components/input/input.d.ts.map +0 -1
- package/dist/src/components/input-group/context.d.ts +0 -96
- package/dist/src/components/input-group/context.d.ts.map +0 -1
- package/dist/src/components/input-group/index.d.ts +0 -2
- package/dist/src/components/input-group/index.d.ts.map +0 -1
- package/dist/src/components/input-group/input-group-addon.d.ts +0 -15
- package/dist/src/components/input-group/input-group-addon.d.ts.map +0 -1
- package/dist/src/components/input-group/input-group-button.d.ts +0 -36
- package/dist/src/components/input-group/input-group-button.d.ts.map +0 -1
- package/dist/src/components/input-group/input-group-input.d.ts +0 -9
- package/dist/src/components/input-group/input-group-input.d.ts.map +0 -1
- package/dist/src/components/input-group/input-group-suffix.d.ts +0 -13
- package/dist/src/components/input-group/input-group-suffix.d.ts.map +0 -1
- package/dist/src/components/input-group/input-group.d.ts +0 -43
- package/dist/src/components/input-group/input-group.d.ts.map +0 -1
- package/dist/src/components/label/index.d.ts +0 -2
- package/dist/src/components/label/index.d.ts.map +0 -1
- package/dist/src/components/label/label.d.ts +0 -67
- package/dist/src/components/label/label.d.ts.map +0 -1
- package/dist/src/components/layer-card/index.d.ts +0 -2
- package/dist/src/components/layer-card/index.d.ts.map +0 -1
- package/dist/src/components/layer-card/layer-card.d.ts +0 -60
- package/dist/src/components/layer-card/layer-card.d.ts.map +0 -1
- package/dist/src/components/link/index.d.ts +0 -2
- package/dist/src/components/link/index.d.ts.map +0 -1
- package/dist/src/components/link/link.d.ts +0 -66
- package/dist/src/components/link/link.d.ts.map +0 -1
- package/dist/src/components/loader/index.d.ts +0 -3
- package/dist/src/components/loader/index.d.ts.map +0 -1
- package/dist/src/components/loader/loader.d.ts +0 -70
- package/dist/src/components/loader/loader.d.ts.map +0 -1
- package/dist/src/components/loader/skeleton-line.d.ts +0 -11
- package/dist/src/components/loader/skeleton-line.d.ts.map +0 -1
- package/dist/src/components/menubar/index.d.ts +0 -3
- package/dist/src/components/menubar/index.d.ts.map +0 -1
- package/dist/src/components/menubar/menubar.d.ts +0 -66
- package/dist/src/components/menubar/menubar.d.ts.map +0 -1
- package/dist/src/components/menubar/use-menu-navigation.d.ts +0 -8
- package/dist/src/components/menubar/use-menu-navigation.d.ts.map +0 -1
- package/dist/src/components/meter/index.d.ts +0 -2
- package/dist/src/components/meter/index.d.ts.map +0 -1
- package/dist/src/components/meter/meter.d.ts +0 -44
- package/dist/src/components/meter/meter.d.ts.map +0 -1
- package/dist/src/components/pagination/index.d.ts +0 -2
- package/dist/src/components/pagination/index.d.ts.map +0 -1
- package/dist/src/components/pagination/pagination.d.ts +0 -241
- package/dist/src/components/pagination/pagination.d.ts.map +0 -1
- package/dist/src/components/popover/index.d.ts +0 -3
- package/dist/src/components/popover/index.d.ts.map +0 -1
- package/dist/src/components/popover/popover.d.ts +0 -178
- package/dist/src/components/popover/popover.d.ts.map +0 -1
- package/dist/src/components/radio/index.d.ts +0 -2
- package/dist/src/components/radio/index.d.ts.map +0 -1
- package/dist/src/components/radio/radio.d.ts +0 -277
- package/dist/src/components/radio/radio.d.ts.map +0 -1
- package/dist/src/components/radio/radio.type-spec.d.ts +0 -12
- package/dist/src/components/radio/radio.type-spec.d.ts.map +0 -1
- package/dist/src/components/select/index.d.ts +0 -2
- package/dist/src/components/select/index.d.ts.map +0 -1
- package/dist/src/components/select/select.d.ts +0 -288
- package/dist/src/components/select/select.d.ts.map +0 -1
- package/dist/src/components/sensitive-input/index.d.ts +0 -2
- package/dist/src/components/sensitive-input/index.d.ts.map +0 -1
- package/dist/src/components/sensitive-input/sensitive-input.d.ts +0 -94
- package/dist/src/components/sensitive-input/sensitive-input.d.ts.map +0 -1
- package/dist/src/components/sidebar/index.d.ts +0 -2
- package/dist/src/components/sidebar/index.d.ts.map +0 -1
- package/dist/src/components/sidebar/sidebar.d.ts +0 -581
- package/dist/src/components/sidebar/sidebar.d.ts.map +0 -1
- package/dist/src/components/surface/index.d.ts +0 -5
- package/dist/src/components/surface/index.d.ts.map +0 -1
- package/dist/src/components/surface/surface.d.ts +0 -64
- package/dist/src/components/surface/surface.d.ts.map +0 -1
- package/dist/src/components/switch/index.d.ts +0 -2
- package/dist/src/components/switch/index.d.ts.map +0 -1
- package/dist/src/components/switch/switch.d.ts +0 -197
- package/dist/src/components/switch/switch.d.ts.map +0 -1
- package/dist/src/components/table/index.d.ts +0 -2
- package/dist/src/components/table/index.d.ts.map +0 -1
- package/dist/src/components/table/table.d.ts +0 -138
- package/dist/src/components/table/table.d.ts.map +0 -1
- package/dist/src/components/table-of-contents/index.d.ts +0 -2
- package/dist/src/components/table-of-contents/index.d.ts.map +0 -1
- package/dist/src/components/table-of-contents/table-of-contents.d.ts +0 -72
- package/dist/src/components/table-of-contents/table-of-contents.d.ts.map +0 -1
- package/dist/src/components/tabs/index.d.ts +0 -3
- package/dist/src/components/tabs/index.d.ts.map +0 -1
- package/dist/src/components/tabs/tabs.d.ts +0 -116
- package/dist/src/components/tabs/tabs.d.ts.map +0 -1
- package/dist/src/components/text/index.d.ts +0 -2
- package/dist/src/components/text/index.d.ts.map +0 -1
- package/dist/src/components/text/text.d.ts +0 -214
- package/dist/src/components/text/text.d.ts.map +0 -1
- package/dist/src/components/text/text.type-spec.d.ts +0 -44
- package/dist/src/components/text/text.type-spec.d.ts.map +0 -1
- package/dist/src/components/toast/index.d.ts +0 -5
- package/dist/src/components/toast/index.d.ts.map +0 -1
- package/dist/src/components/toast/toast.d.ts +0 -197
- package/dist/src/components/toast/toast.d.ts.map +0 -1
- package/dist/src/components/toolbar/index.d.ts +0 -2
- package/dist/src/components/toolbar/index.d.ts.map +0 -1
- package/dist/src/components/toolbar/toolbar.d.ts +0 -50
- package/dist/src/components/toolbar/toolbar.d.ts.map +0 -1
- package/dist/src/components/tooltip/index.d.ts +0 -2
- package/dist/src/components/tooltip/index.d.ts.map +0 -1
- package/dist/src/components/tooltip/tooltip.d.ts +0 -108
- package/dist/src/components/tooltip/tooltip.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -85
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/primitives/accordion.d.ts +0 -13
- package/dist/src/primitives/accordion.d.ts.map +0 -1
- package/dist/src/primitives/alert-dialog.d.ts +0 -13
- package/dist/src/primitives/alert-dialog.d.ts.map +0 -1
- package/dist/src/primitives/autocomplete.d.ts +0 -13
- package/dist/src/primitives/autocomplete.d.ts.map +0 -1
- package/dist/src/primitives/avatar.d.ts +0 -13
- package/dist/src/primitives/avatar.d.ts.map +0 -1
- package/dist/src/primitives/button.d.ts +0 -13
- package/dist/src/primitives/button.d.ts.map +0 -1
- package/dist/src/primitives/checkbox-group.d.ts +0 -13
- package/dist/src/primitives/checkbox-group.d.ts.map +0 -1
- package/dist/src/primitives/checkbox.d.ts +0 -13
- package/dist/src/primitives/checkbox.d.ts.map +0 -1
- package/dist/src/primitives/collapsible.d.ts +0 -13
- package/dist/src/primitives/collapsible.d.ts.map +0 -1
- package/dist/src/primitives/combobox.d.ts +0 -13
- package/dist/src/primitives/combobox.d.ts.map +0 -1
- package/dist/src/primitives/context-menu.d.ts +0 -13
- package/dist/src/primitives/context-menu.d.ts.map +0 -1
- package/dist/src/primitives/csp-provider.d.ts +0 -13
- package/dist/src/primitives/csp-provider.d.ts.map +0 -1
- package/dist/src/primitives/dialog.d.ts +0 -13
- package/dist/src/primitives/dialog.d.ts.map +0 -1
- package/dist/src/primitives/direction-provider.d.ts +0 -13
- package/dist/src/primitives/direction-provider.d.ts.map +0 -1
- package/dist/src/primitives/drawer.d.ts +0 -13
- package/dist/src/primitives/drawer.d.ts.map +0 -1
- package/dist/src/primitives/field.d.ts +0 -13
- package/dist/src/primitives/field.d.ts.map +0 -1
- package/dist/src/primitives/fieldset.d.ts +0 -13
- package/dist/src/primitives/fieldset.d.ts.map +0 -1
- package/dist/src/primitives/form.d.ts +0 -13
- package/dist/src/primitives/form.d.ts.map +0 -1
- package/dist/src/primitives/index.d.ts +0 -56
- package/dist/src/primitives/index.d.ts.map +0 -1
- package/dist/src/primitives/input.d.ts +0 -13
- package/dist/src/primitives/input.d.ts.map +0 -1
- package/dist/src/primitives/menu.d.ts +0 -13
- package/dist/src/primitives/menu.d.ts.map +0 -1
- package/dist/src/primitives/menubar.d.ts +0 -13
- package/dist/src/primitives/menubar.d.ts.map +0 -1
- package/dist/src/primitives/meter.d.ts +0 -13
- package/dist/src/primitives/meter.d.ts.map +0 -1
- package/dist/src/primitives/navigation-menu.d.ts +0 -13
- package/dist/src/primitives/navigation-menu.d.ts.map +0 -1
- package/dist/src/primitives/number-field.d.ts +0 -13
- package/dist/src/primitives/number-field.d.ts.map +0 -1
- package/dist/src/primitives/otp-field.d.ts +0 -14
- package/dist/src/primitives/otp-field.d.ts.map +0 -1
- package/dist/src/primitives/popover.d.ts +0 -13
- package/dist/src/primitives/popover.d.ts.map +0 -1
- package/dist/src/primitives/preview-card.d.ts +0 -13
- package/dist/src/primitives/preview-card.d.ts.map +0 -1
- package/dist/src/primitives/progress.d.ts +0 -13
- package/dist/src/primitives/progress.d.ts.map +0 -1
- package/dist/src/primitives/radio-group.d.ts +0 -13
- package/dist/src/primitives/radio-group.d.ts.map +0 -1
- package/dist/src/primitives/radio.d.ts +0 -13
- package/dist/src/primitives/radio.d.ts.map +0 -1
- package/dist/src/primitives/scroll-area.d.ts +0 -13
- package/dist/src/primitives/scroll-area.d.ts.map +0 -1
- package/dist/src/primitives/select.d.ts +0 -13
- package/dist/src/primitives/select.d.ts.map +0 -1
- package/dist/src/primitives/separator.d.ts +0 -13
- package/dist/src/primitives/separator.d.ts.map +0 -1
- package/dist/src/primitives/slider.d.ts +0 -13
- package/dist/src/primitives/slider.d.ts.map +0 -1
- package/dist/src/primitives/switch.d.ts +0 -13
- package/dist/src/primitives/switch.d.ts.map +0 -1
- package/dist/src/primitives/tabs.d.ts +0 -13
- package/dist/src/primitives/tabs.d.ts.map +0 -1
- package/dist/src/primitives/toast.d.ts +0 -13
- package/dist/src/primitives/toast.d.ts.map +0 -1
- package/dist/src/primitives/toggle-group.d.ts +0 -13
- package/dist/src/primitives/toggle-group.d.ts.map +0 -1
- package/dist/src/primitives/toggle.d.ts +0 -13
- package/dist/src/primitives/toggle.d.ts.map +0 -1
- package/dist/src/primitives/toolbar.d.ts +0 -13
- package/dist/src/primitives/toolbar.d.ts.map +0 -1
- package/dist/src/primitives/tooltip.d.ts +0 -13
- package/dist/src/primitives/tooltip.d.ts.map +0 -1
- package/dist/src/registry/index.d.ts +0 -8
- package/dist/src/registry/index.d.ts.map +0 -1
- package/dist/src/registry/types.d.ts +0 -191
- package/dist/src/registry/types.d.ts.map +0 -1
- package/dist/src/utils/cn.d.ts +0 -3
- package/dist/src/utils/cn.d.ts.map +0 -1
- package/dist/src/utils/index.d.ts +0 -4
- package/dist/src/utils/index.d.ts.map +0 -1
- package/dist/src/utils/link-provider.d.ts +0 -66
- package/dist/src/utils/link-provider.d.ts.map +0 -1
- package/dist/src/utils/portal-provider.d.ts +0 -56
- package/dist/src/utils/portal-provider.d.ts.map +0 -1
- package/dist/src/utils/prop-examples.d.ts +0 -36
- package/dist/src/utils/prop-examples.d.ts.map +0 -1
- package/dist/src/utils/resolve-variant.d.ts +0 -27
- package/dist/src/utils/resolve-variant.d.ts.map +0 -1
- package/dist/utils.js.map +0 -1
|
@@ -0,0 +1,3103 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region ../../node_modules/.pnpm/@shikijs+engine-javascript@4.0.0/node_modules/@shikijs/engine-javascript/dist/scanner-BFcBmQR1.mjs
|
|
3
|
+
const MAX = 4294967295;
|
|
4
|
+
var JavaScriptScanner = class {
|
|
5
|
+
regexps;
|
|
6
|
+
constructor(patterns, options = {}) {
|
|
7
|
+
this.patterns = patterns;
|
|
8
|
+
this.options = options;
|
|
9
|
+
const { forgiving = false, cache, regexConstructor } = options;
|
|
10
|
+
if (!regexConstructor) throw new Error("Option `regexConstructor` is not provided");
|
|
11
|
+
this.regexps = patterns.map((p) => {
|
|
12
|
+
if (typeof p !== "string") return p;
|
|
13
|
+
const cached = cache?.get(p);
|
|
14
|
+
if (cached) {
|
|
15
|
+
if (cached instanceof RegExp) return cached;
|
|
16
|
+
if (forgiving) return null;
|
|
17
|
+
throw cached;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const regex = regexConstructor(p);
|
|
21
|
+
cache?.set(p, regex);
|
|
22
|
+
return regex;
|
|
23
|
+
} catch (e) {
|
|
24
|
+
cache?.set(p, e);
|
|
25
|
+
if (forgiving) return null;
|
|
26
|
+
throw e;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
findNextMatchSync(string, startPosition, _options) {
|
|
31
|
+
const str = typeof string === "string" ? string : string.content;
|
|
32
|
+
const pending = [];
|
|
33
|
+
function toResult(index, match, offset = 0) {
|
|
34
|
+
return {
|
|
35
|
+
index,
|
|
36
|
+
captureIndices: match.indices.map((indice) => {
|
|
37
|
+
if (indice == null) return {
|
|
38
|
+
start: MAX,
|
|
39
|
+
end: MAX,
|
|
40
|
+
length: 0
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
start: indice[0] + offset,
|
|
44
|
+
end: indice[1] + offset,
|
|
45
|
+
length: indice[1] - indice[0]
|
|
46
|
+
};
|
|
47
|
+
})
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
for (let i = 0; i < this.regexps.length; i++) {
|
|
51
|
+
const regexp = this.regexps[i];
|
|
52
|
+
if (!regexp) continue;
|
|
53
|
+
try {
|
|
54
|
+
regexp.lastIndex = startPosition;
|
|
55
|
+
const match = regexp.exec(str);
|
|
56
|
+
if (!match) continue;
|
|
57
|
+
if (match.index === startPosition) return toResult(i, match, 0);
|
|
58
|
+
pending.push([
|
|
59
|
+
i,
|
|
60
|
+
match,
|
|
61
|
+
0
|
|
62
|
+
]);
|
|
63
|
+
} catch (e) {
|
|
64
|
+
if (this.options.forgiving) continue;
|
|
65
|
+
throw e;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (pending.length) {
|
|
69
|
+
const minIndex = Math.min(...pending.map((m) => m[1].index));
|
|
70
|
+
for (const [i, match, offset] of pending) if (match.index === minIndex) return toResult(i, match, offset);
|
|
71
|
+
}
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region ../../node_modules/.pnpm/oniguruma-parser@0.12.1/node_modules/oniguruma-parser/dist/utils.js
|
|
77
|
+
function r$2(e) {
|
|
78
|
+
if ([...e].length !== 1) throw new Error(`Expected "${e}" to be a single code point`);
|
|
79
|
+
return e.codePointAt(0);
|
|
80
|
+
}
|
|
81
|
+
function l$1(e, t, n) {
|
|
82
|
+
return e.has(t) || e.set(t, n), e.get(t);
|
|
83
|
+
}
|
|
84
|
+
const i = /* @__PURE__ */ new Set([
|
|
85
|
+
"alnum",
|
|
86
|
+
"alpha",
|
|
87
|
+
"ascii",
|
|
88
|
+
"blank",
|
|
89
|
+
"cntrl",
|
|
90
|
+
"digit",
|
|
91
|
+
"graph",
|
|
92
|
+
"lower",
|
|
93
|
+
"print",
|
|
94
|
+
"punct",
|
|
95
|
+
"space",
|
|
96
|
+
"upper",
|
|
97
|
+
"word",
|
|
98
|
+
"xdigit"
|
|
99
|
+
]);
|
|
100
|
+
const o$1 = String.raw;
|
|
101
|
+
function u(e, t) {
|
|
102
|
+
if (e == null) throw new Error(t ?? "Value expected");
|
|
103
|
+
return e;
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
//#region ../../node_modules/.pnpm/oniguruma-parser@0.12.1/node_modules/oniguruma-parser/dist/tokenizer/tokenize.js
|
|
107
|
+
const m$1 = o$1`\[\^?`;
|
|
108
|
+
const b$1 = `c.? | C(?:-.?)?|${o$1`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${o$1`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${o$1`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${o$1`o\{[^\}]*\}?`}|${o$1`\d{1,3}`}`;
|
|
109
|
+
const y$1 = /[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/;
|
|
110
|
+
const C$1 = new RegExp(o$1`
|
|
111
|
+
\\ (?:
|
|
112
|
+
${b$1}
|
|
113
|
+
| [gk]<[^>]*>?
|
|
114
|
+
| [gk]'[^']*'?
|
|
115
|
+
| .
|
|
116
|
+
)
|
|
117
|
+
| \( (?:
|
|
118
|
+
\? (?:
|
|
119
|
+
[:=!>({]
|
|
120
|
+
| <[=!]
|
|
121
|
+
| <[^>]*>
|
|
122
|
+
| '[^']*'
|
|
123
|
+
| ~\|?
|
|
124
|
+
| #(?:[^)\\]|\\.?)*
|
|
125
|
+
| [^:)]*[:)]
|
|
126
|
+
)?
|
|
127
|
+
| \*[^\)]*\)?
|
|
128
|
+
)?
|
|
129
|
+
| (?:${y$1.source})+
|
|
130
|
+
| ${m$1}
|
|
131
|
+
| .
|
|
132
|
+
`.replace(/\s+/g, ""), "gsu");
|
|
133
|
+
const T$1 = new RegExp(o$1`
|
|
134
|
+
\\ (?:
|
|
135
|
+
${b$1}
|
|
136
|
+
| .
|
|
137
|
+
)
|
|
138
|
+
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
139
|
+
| ${m$1}
|
|
140
|
+
| &&
|
|
141
|
+
| .
|
|
142
|
+
`.replace(/\s+/g, ""), "gsu");
|
|
143
|
+
function M$1(e, n = {}) {
|
|
144
|
+
const t = {
|
|
145
|
+
flags: "",
|
|
146
|
+
...n,
|
|
147
|
+
rules: {
|
|
148
|
+
captureGroup: !1,
|
|
149
|
+
singleline: !1,
|
|
150
|
+
...n.rules
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
if (typeof e != "string") throw new Error("String expected as pattern");
|
|
154
|
+
const o = Y(t.flags), s = [o.extended], a = {
|
|
155
|
+
captureGroup: t.rules.captureGroup,
|
|
156
|
+
getCurrentModX() {
|
|
157
|
+
return s.at(-1);
|
|
158
|
+
},
|
|
159
|
+
numOpenGroups: 0,
|
|
160
|
+
popModX() {
|
|
161
|
+
s.pop();
|
|
162
|
+
},
|
|
163
|
+
pushModX(u) {
|
|
164
|
+
s.push(u);
|
|
165
|
+
},
|
|
166
|
+
replaceCurrentModX(u) {
|
|
167
|
+
s[s.length - 1] = u;
|
|
168
|
+
},
|
|
169
|
+
singleline: t.rules.singleline
|
|
170
|
+
};
|
|
171
|
+
let r = [], i;
|
|
172
|
+
for (C$1.lastIndex = 0; i = C$1.exec(e);) {
|
|
173
|
+
const u = F$1(a, e, i[0], C$1.lastIndex);
|
|
174
|
+
u.tokens ? r.push(...u.tokens) : u.token && r.push(u.token), u.lastIndex !== void 0 && (C$1.lastIndex = u.lastIndex);
|
|
175
|
+
}
|
|
176
|
+
const l = [];
|
|
177
|
+
let c = 0;
|
|
178
|
+
r.filter((u) => u.type === "GroupOpen").forEach((u) => {
|
|
179
|
+
u.kind === "capturing" ? u.number = ++c : u.raw === "(" && l.push(u);
|
|
180
|
+
}), c || l.forEach((u, S) => {
|
|
181
|
+
u.kind = "capturing", u.number = S + 1;
|
|
182
|
+
});
|
|
183
|
+
const g = c || l.length;
|
|
184
|
+
return {
|
|
185
|
+
tokens: r.map((u) => u.type === "EscapedNumber" ? ee$1(u, g) : u).flat(),
|
|
186
|
+
flags: o
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
function F$1(e, n, t, o) {
|
|
190
|
+
const [s, a] = t;
|
|
191
|
+
if (t === "[" || t === "[^") {
|
|
192
|
+
const r = K$1(n, t, o);
|
|
193
|
+
return {
|
|
194
|
+
tokens: r.tokens,
|
|
195
|
+
lastIndex: r.lastIndex
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
if (s === "\\") {
|
|
199
|
+
if ("AbBGyYzZ".includes(a)) return { token: w$1(t, t) };
|
|
200
|
+
if (/^\\g[<']/.test(t)) {
|
|
201
|
+
if (!/^\\g(?:<[^>]+>|'[^']+')$/.test(t)) throw new Error(`Invalid group name "${t}"`);
|
|
202
|
+
return { token: R$1(t) };
|
|
203
|
+
}
|
|
204
|
+
if (/^\\k[<']/.test(t)) {
|
|
205
|
+
if (!/^\\k(?:<[^>]+>|'[^']+')$/.test(t)) throw new Error(`Invalid group name "${t}"`);
|
|
206
|
+
return { token: A$1(t) };
|
|
207
|
+
}
|
|
208
|
+
if (a === "K") return { token: I$1("keep", t) };
|
|
209
|
+
if (a === "N" || a === "R") return { token: k$1("newline", t, { negate: a === "N" }) };
|
|
210
|
+
if (a === "O") return { token: k$1("any", t) };
|
|
211
|
+
if (a === "X") return { token: k$1("text_segment", t) };
|
|
212
|
+
const r = x(t, { inCharClass: !1 });
|
|
213
|
+
return Array.isArray(r) ? { tokens: r } : { token: r };
|
|
214
|
+
}
|
|
215
|
+
if (s === "(") {
|
|
216
|
+
if (a === "*") return { token: j(t) };
|
|
217
|
+
if (t === "(?{") throw new Error(`Unsupported callout "${t}"`);
|
|
218
|
+
if (t.startsWith("(?#")) {
|
|
219
|
+
if (n[o] !== ")") throw new Error("Unclosed comment group \"(?#\"");
|
|
220
|
+
return { lastIndex: o + 1 };
|
|
221
|
+
}
|
|
222
|
+
if (/^\(\?[-imx]+[:)]$/.test(t)) return { token: L$1(t, e) };
|
|
223
|
+
if (e.pushModX(e.getCurrentModX()), e.numOpenGroups++, t === "(" && !e.captureGroup || t === "(?:") return { token: f$1("group", t) };
|
|
224
|
+
if (t === "(?>") return { token: f$1("atomic", t) };
|
|
225
|
+
if (t === "(?=" || t === "(?!" || t === "(?<=" || t === "(?<!") return { token: f$1(t[2] === "<" ? "lookbehind" : "lookahead", t, { negate: t.endsWith("!") }) };
|
|
226
|
+
if (t === "(" && e.captureGroup || t.startsWith("(?<") && t.endsWith(">") || t.startsWith("(?'") && t.endsWith("'")) return { token: f$1("capturing", t, { ...t !== "(" && { name: t.slice(3, -1) } }) };
|
|
227
|
+
if (t.startsWith("(?~")) {
|
|
228
|
+
if (t === "(?~|") throw new Error(`Unsupported absence function kind "${t}"`);
|
|
229
|
+
return { token: f$1("absence_repeater", t) };
|
|
230
|
+
}
|
|
231
|
+
throw t === "(?(" ? /* @__PURE__ */ new Error(`Unsupported conditional "${t}"`) : /* @__PURE__ */ new Error(`Invalid or unsupported group option "${t}"`);
|
|
232
|
+
}
|
|
233
|
+
if (t === ")") {
|
|
234
|
+
if (e.popModX(), e.numOpenGroups--, e.numOpenGroups < 0) throw new Error("Unmatched \")\"");
|
|
235
|
+
return { token: Q$1(t) };
|
|
236
|
+
}
|
|
237
|
+
if (e.getCurrentModX()) {
|
|
238
|
+
if (t === "#") {
|
|
239
|
+
const r = n.indexOf(`
|
|
240
|
+
`, o);
|
|
241
|
+
return { lastIndex: r === -1 ? n.length : r };
|
|
242
|
+
}
|
|
243
|
+
if (/^\s$/.test(t)) {
|
|
244
|
+
const r = /\s+/y;
|
|
245
|
+
return r.lastIndex = o, { lastIndex: r.exec(n) ? r.lastIndex : o };
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
if (t === ".") return { token: k$1("dot", t) };
|
|
249
|
+
if (t === "^" || t === "$") return { token: w$1(e.singleline ? {
|
|
250
|
+
"^": o$1`\A`,
|
|
251
|
+
$: o$1`\Z`
|
|
252
|
+
}[t] : t, t) };
|
|
253
|
+
return t === "|" ? { token: P$1(t) } : y$1.test(t) ? { tokens: te$1(t) } : { token: d(r$2(t), t) };
|
|
254
|
+
}
|
|
255
|
+
function K$1(e, n, t) {
|
|
256
|
+
const o = [E$1(n[1] === "^", n)];
|
|
257
|
+
let s = 1, a;
|
|
258
|
+
for (T$1.lastIndex = t; a = T$1.exec(e);) {
|
|
259
|
+
const r = a[0];
|
|
260
|
+
if (r[0] === "[" && r[1] !== ":") s++, o.push(E$1(r[1] === "^", r));
|
|
261
|
+
else if (r === "]") {
|
|
262
|
+
if (o.at(-1).type === "CharacterClassOpen") o.push(d(93, r));
|
|
263
|
+
else if (s--, o.push(z$1(r)), !s) break;
|
|
264
|
+
} else {
|
|
265
|
+
const i = X$1(r);
|
|
266
|
+
Array.isArray(i) ? o.push(...i) : o.push(i);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
return {
|
|
270
|
+
tokens: o,
|
|
271
|
+
lastIndex: T$1.lastIndex || e.length
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
function X$1(e) {
|
|
275
|
+
if (e[0] === "\\") return x(e, { inCharClass: !0 });
|
|
276
|
+
if (e[0] === "[") {
|
|
277
|
+
const n = /\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);
|
|
278
|
+
if (!n || !i.has(n.groups.name)) throw new Error(`Invalid POSIX class "${e}"`);
|
|
279
|
+
return k$1("posix", e, {
|
|
280
|
+
value: n.groups.name,
|
|
281
|
+
negate: !!n.groups.negate
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
return e === "-" ? U$1(e) : e === "&&" ? H(e) : d(r$2(e), e);
|
|
285
|
+
}
|
|
286
|
+
function x(e, { inCharClass: n }) {
|
|
287
|
+
const t = e[1];
|
|
288
|
+
if (t === "c" || t === "C") return Z(e);
|
|
289
|
+
if ("dDhHsSwW".includes(t)) return q(e);
|
|
290
|
+
if (e.startsWith(o$1`\o{`)) throw new Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);
|
|
291
|
+
if (/^\\[pP]\{/.test(e)) {
|
|
292
|
+
if (e.length === 3) throw new Error(`Incomplete or invalid Unicode property "${e}"`);
|
|
293
|
+
return V$1(e);
|
|
294
|
+
}
|
|
295
|
+
if (/^\\x[89A-Fa-f]\p{AHex}/u.test(e)) try {
|
|
296
|
+
const o = e.split(/\\x/).slice(1).map((i) => parseInt(i, 16)), s = new TextDecoder("utf-8", {
|
|
297
|
+
ignoreBOM: !0,
|
|
298
|
+
fatal: !0
|
|
299
|
+
}).decode(new Uint8Array(o)), a = new TextEncoder();
|
|
300
|
+
return [...s].map((i) => {
|
|
301
|
+
const l = [...a.encode(i)].map((c) => `\\x${c.toString(16)}`).join("");
|
|
302
|
+
return d(r$2(i), l);
|
|
303
|
+
});
|
|
304
|
+
} catch {
|
|
305
|
+
throw new Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`);
|
|
306
|
+
}
|
|
307
|
+
if (t === "u" || t === "x") return d(J$1(e), e);
|
|
308
|
+
if ($$1.has(t)) return d($$1.get(t), e);
|
|
309
|
+
if (/\d/.test(t)) return W$1(n, e);
|
|
310
|
+
if (e === "\\") throw new Error(o$1`Incomplete escape "\"`);
|
|
311
|
+
if (t === "M") throw new Error(`Unsupported meta "${e}"`);
|
|
312
|
+
if ([...e].length === 2) return d(e.codePointAt(1), e);
|
|
313
|
+
throw new Error(`Unexpected escape "${e}"`);
|
|
314
|
+
}
|
|
315
|
+
function P$1(e) {
|
|
316
|
+
return {
|
|
317
|
+
type: "Alternator",
|
|
318
|
+
raw: e
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
function w$1(e, n) {
|
|
322
|
+
return {
|
|
323
|
+
type: "Assertion",
|
|
324
|
+
kind: e,
|
|
325
|
+
raw: n
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
function A$1(e) {
|
|
329
|
+
return {
|
|
330
|
+
type: "Backreference",
|
|
331
|
+
raw: e
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
function d(e, n) {
|
|
335
|
+
return {
|
|
336
|
+
type: "Character",
|
|
337
|
+
value: e,
|
|
338
|
+
raw: n
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
function z$1(e) {
|
|
342
|
+
return {
|
|
343
|
+
type: "CharacterClassClose",
|
|
344
|
+
raw: e
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
function U$1(e) {
|
|
348
|
+
return {
|
|
349
|
+
type: "CharacterClassHyphen",
|
|
350
|
+
raw: e
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
function H(e) {
|
|
354
|
+
return {
|
|
355
|
+
type: "CharacterClassIntersector",
|
|
356
|
+
raw: e
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
function E$1(e, n) {
|
|
360
|
+
return {
|
|
361
|
+
type: "CharacterClassOpen",
|
|
362
|
+
negate: e,
|
|
363
|
+
raw: n
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
function k$1(e, n, t = {}) {
|
|
367
|
+
return {
|
|
368
|
+
type: "CharacterSet",
|
|
369
|
+
kind: e,
|
|
370
|
+
...t,
|
|
371
|
+
raw: n
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
function I$1(e, n, t = {}) {
|
|
375
|
+
return e === "keep" ? {
|
|
376
|
+
type: "Directive",
|
|
377
|
+
kind: e,
|
|
378
|
+
raw: n
|
|
379
|
+
} : {
|
|
380
|
+
type: "Directive",
|
|
381
|
+
kind: e,
|
|
382
|
+
flags: u(t.flags),
|
|
383
|
+
raw: n
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
function W$1(e, n) {
|
|
387
|
+
return {
|
|
388
|
+
type: "EscapedNumber",
|
|
389
|
+
inCharClass: e,
|
|
390
|
+
raw: n
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
function Q$1(e) {
|
|
394
|
+
return {
|
|
395
|
+
type: "GroupClose",
|
|
396
|
+
raw: e
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
function f$1(e, n, t = {}) {
|
|
400
|
+
return {
|
|
401
|
+
type: "GroupOpen",
|
|
402
|
+
kind: e,
|
|
403
|
+
...t,
|
|
404
|
+
raw: n
|
|
405
|
+
};
|
|
406
|
+
}
|
|
407
|
+
function D$1(e, n, t, o) {
|
|
408
|
+
return {
|
|
409
|
+
type: "NamedCallout",
|
|
410
|
+
kind: e,
|
|
411
|
+
tag: n,
|
|
412
|
+
arguments: t,
|
|
413
|
+
raw: o
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
function _$1(e, n, t, o) {
|
|
417
|
+
return {
|
|
418
|
+
type: "Quantifier",
|
|
419
|
+
kind: e,
|
|
420
|
+
min: n,
|
|
421
|
+
max: t,
|
|
422
|
+
raw: o
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
function R$1(e) {
|
|
426
|
+
return {
|
|
427
|
+
type: "Subroutine",
|
|
428
|
+
raw: e
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
const B$1 = /* @__PURE__ */ new Set([
|
|
432
|
+
"COUNT",
|
|
433
|
+
"CMP",
|
|
434
|
+
"ERROR",
|
|
435
|
+
"FAIL",
|
|
436
|
+
"MAX",
|
|
437
|
+
"MISMATCH",
|
|
438
|
+
"SKIP",
|
|
439
|
+
"TOTAL_COUNT"
|
|
440
|
+
]);
|
|
441
|
+
const $$1 = /* @__PURE__ */ new Map([
|
|
442
|
+
["a", 7],
|
|
443
|
+
["b", 8],
|
|
444
|
+
["e", 27],
|
|
445
|
+
["f", 12],
|
|
446
|
+
["n", 10],
|
|
447
|
+
["r", 13],
|
|
448
|
+
["t", 9],
|
|
449
|
+
["v", 11]
|
|
450
|
+
]);
|
|
451
|
+
function Z(e) {
|
|
452
|
+
const n = e[1] === "c" ? e[2] : e[3];
|
|
453
|
+
if (!n || !/[A-Za-z]/.test(n)) throw new Error(`Unsupported control character "${e}"`);
|
|
454
|
+
return d(r$2(n.toUpperCase()) - 64, e);
|
|
455
|
+
}
|
|
456
|
+
function L$1(e, n) {
|
|
457
|
+
let { on: t, off: o } = /^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;
|
|
458
|
+
o ??= "";
|
|
459
|
+
const s = (n.getCurrentModX() || t.includes("x")) && !o.includes("x"), a = v(t), r = v(o), i = {};
|
|
460
|
+
if (a && (i.enable = a), r && (i.disable = r), e.endsWith(")")) return n.replaceCurrentModX(s), I$1("flags", e, { flags: i });
|
|
461
|
+
if (e.endsWith(":")) return n.pushModX(s), n.numOpenGroups++, f$1("group", e, { ...(a || r) && { flags: i } });
|
|
462
|
+
throw new Error(`Unexpected flag modifier "${e}"`);
|
|
463
|
+
}
|
|
464
|
+
function j(e) {
|
|
465
|
+
const n = /\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);
|
|
466
|
+
if (!n) throw new Error(`Incomplete or invalid named callout "${e}"`);
|
|
467
|
+
const { name: t, tag: o, args: s } = n.groups;
|
|
468
|
+
if (!t) throw new Error(`Invalid named callout "${e}"`);
|
|
469
|
+
if (o === "") throw new Error(`Named callout tag with empty value not allowed "${e}"`);
|
|
470
|
+
const a = s ? s.split(",").filter((g) => g !== "").map((g) => /^[+-]?\d+$/.test(g) ? +g : g) : [], [r, i, l] = a, c = B$1.has(t) ? t.toLowerCase() : "custom";
|
|
471
|
+
switch (c) {
|
|
472
|
+
case "fail":
|
|
473
|
+
case "mismatch":
|
|
474
|
+
case "skip":
|
|
475
|
+
if (a.length > 0) throw new Error(`Named callout arguments not allowed "${a}"`);
|
|
476
|
+
break;
|
|
477
|
+
case "error":
|
|
478
|
+
if (a.length > 1) throw new Error(`Named callout allows only one argument "${a}"`);
|
|
479
|
+
if (typeof r == "string") throw new Error(`Named callout argument must be a number "${r}"`);
|
|
480
|
+
break;
|
|
481
|
+
case "max":
|
|
482
|
+
if (!a.length || a.length > 2) throw new Error(`Named callout must have one or two arguments "${a}"`);
|
|
483
|
+
if (typeof r == "string" && !/^[A-Za-z_]\w*$/.test(r)) throw new Error(`Named callout argument one must be a tag or number "${r}"`);
|
|
484
|
+
if (a.length === 2 && (typeof i == "number" || !/^[<>X]$/.test(i))) throw new Error(`Named callout optional argument two must be '<', '>', or 'X' "${i}"`);
|
|
485
|
+
break;
|
|
486
|
+
case "count":
|
|
487
|
+
case "total_count":
|
|
488
|
+
if (a.length > 1) throw new Error(`Named callout allows only one argument "${a}"`);
|
|
489
|
+
if (a.length === 1 && (typeof r == "number" || !/^[<>X]$/.test(r))) throw new Error(`Named callout optional argument must be '<', '>', or 'X' "${r}"`);
|
|
490
|
+
break;
|
|
491
|
+
case "cmp":
|
|
492
|
+
if (a.length !== 3) throw new Error(`Named callout must have three arguments "${a}"`);
|
|
493
|
+
if (typeof r == "string" && !/^[A-Za-z_]\w*$/.test(r)) throw new Error(`Named callout argument one must be a tag or number "${r}"`);
|
|
494
|
+
if (typeof i == "number" || !/^(?:[<>!=]=|[<>])$/.test(i)) throw new Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${i}"`);
|
|
495
|
+
if (typeof l == "string" && !/^[A-Za-z_]\w*$/.test(l)) throw new Error(`Named callout argument three must be a tag or number "${l}"`);
|
|
496
|
+
break;
|
|
497
|
+
case "custom": throw new Error(`Undefined callout name "${t}"`);
|
|
498
|
+
default: throw new Error(`Unexpected named callout kind "${c}"`);
|
|
499
|
+
}
|
|
500
|
+
return D$1(c, o ?? null, s?.split(",") ?? null, e);
|
|
501
|
+
}
|
|
502
|
+
function O$1(e) {
|
|
503
|
+
let n = null, t, o;
|
|
504
|
+
if (e[0] === "{") {
|
|
505
|
+
const { minStr: s, maxStr: a } = /^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups, r = 1e5;
|
|
506
|
+
if (+s > r || a && +a > r) throw new Error("Quantifier value unsupported in Oniguruma");
|
|
507
|
+
if (t = +s, o = a === void 0 ? +s : a === "" ? Infinity : +a, t > o && (n = "possessive", [t, o] = [o, t]), e.endsWith("?")) {
|
|
508
|
+
if (n === "possessive") throw new Error("Unsupported possessive interval quantifier chain with \"?\"");
|
|
509
|
+
n = "lazy";
|
|
510
|
+
} else n || (n = "greedy");
|
|
511
|
+
} else t = e[0] === "+" ? 1 : 0, o = e[0] === "?" ? 1 : Infinity, n = e[1] === "+" ? "possessive" : e[1] === "?" ? "lazy" : "greedy";
|
|
512
|
+
return _$1(n, t, o, e);
|
|
513
|
+
}
|
|
514
|
+
function q(e) {
|
|
515
|
+
const n = e[1].toLowerCase();
|
|
516
|
+
return k$1({
|
|
517
|
+
d: "digit",
|
|
518
|
+
h: "hex",
|
|
519
|
+
s: "space",
|
|
520
|
+
w: "word"
|
|
521
|
+
}[n], e, { negate: e[1] !== n });
|
|
522
|
+
}
|
|
523
|
+
function V$1(e) {
|
|
524
|
+
const { p: n, neg: t, value: o } = /^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;
|
|
525
|
+
return k$1("property", e, {
|
|
526
|
+
value: o,
|
|
527
|
+
negate: n === "P" && !t || n === "p" && !!t
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
function v(e) {
|
|
531
|
+
const n = {};
|
|
532
|
+
return e.includes("i") && (n.ignoreCase = !0), e.includes("m") && (n.dotAll = !0), e.includes("x") && (n.extended = !0), Object.keys(n).length ? n : null;
|
|
533
|
+
}
|
|
534
|
+
function Y(e) {
|
|
535
|
+
const n = {
|
|
536
|
+
ignoreCase: !1,
|
|
537
|
+
dotAll: !1,
|
|
538
|
+
extended: !1,
|
|
539
|
+
digitIsAscii: !1,
|
|
540
|
+
posixIsAscii: !1,
|
|
541
|
+
spaceIsAscii: !1,
|
|
542
|
+
wordIsAscii: !1,
|
|
543
|
+
textSegmentMode: null
|
|
544
|
+
};
|
|
545
|
+
for (let t = 0; t < e.length; t++) {
|
|
546
|
+
const o = e[t];
|
|
547
|
+
if (!"imxDPSWy".includes(o)) throw new Error(`Invalid flag "${o}"`);
|
|
548
|
+
if (o === "y") {
|
|
549
|
+
if (!/^y{[gw]}/.test(e.slice(t))) throw new Error("Invalid or unspecified flag \"y\" mode");
|
|
550
|
+
n.textSegmentMode = e[t + 2] === "g" ? "grapheme" : "word", t += 3;
|
|
551
|
+
continue;
|
|
552
|
+
}
|
|
553
|
+
n[{
|
|
554
|
+
i: "ignoreCase",
|
|
555
|
+
m: "dotAll",
|
|
556
|
+
x: "extended",
|
|
557
|
+
D: "digitIsAscii",
|
|
558
|
+
P: "posixIsAscii",
|
|
559
|
+
S: "spaceIsAscii",
|
|
560
|
+
W: "wordIsAscii"
|
|
561
|
+
}[o]] = !0;
|
|
562
|
+
}
|
|
563
|
+
return n;
|
|
564
|
+
}
|
|
565
|
+
function J$1(e) {
|
|
566
|
+
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}"`);
|
|
567
|
+
const n = e[2] === "{" ? /^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex : e.slice(2);
|
|
568
|
+
return parseInt(n, 16);
|
|
569
|
+
}
|
|
570
|
+
function ee$1(e, n) {
|
|
571
|
+
const { raw: t, inCharClass: o } = e, s = t.slice(1);
|
|
572
|
+
if (!o && (s !== "0" && s.length === 1 || s[0] !== "0" && +s <= n)) return [A$1(t)];
|
|
573
|
+
const a = [], r = s.match(/^[0-7]+|\d/g);
|
|
574
|
+
for (let i = 0; i < r.length; i++) {
|
|
575
|
+
const l = r[i];
|
|
576
|
+
let c;
|
|
577
|
+
if (i === 0 && l !== "8" && l !== "9") {
|
|
578
|
+
if (c = parseInt(l, 8), c > 127) throw new Error(o$1`Octal encoded byte above 177 unsupported "${t}"`);
|
|
579
|
+
} else c = r$2(l);
|
|
580
|
+
a.push(d(c, (i === 0 ? "\\" : "") + l));
|
|
581
|
+
}
|
|
582
|
+
return a;
|
|
583
|
+
}
|
|
584
|
+
function te$1(e) {
|
|
585
|
+
const n = [], t = new RegExp(y$1, "gy");
|
|
586
|
+
let o;
|
|
587
|
+
for (; o = t.exec(e);) {
|
|
588
|
+
const s = o[0];
|
|
589
|
+
if (s[0] === "{") {
|
|
590
|
+
const a = /^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(s);
|
|
591
|
+
if (a) {
|
|
592
|
+
const { min: r, max: i } = a.groups;
|
|
593
|
+
if (+r > +i && s.endsWith("?")) {
|
|
594
|
+
t.lastIndex--, n.push(O$1(s.slice(0, -1)));
|
|
595
|
+
continue;
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
n.push(O$1(s));
|
|
600
|
+
}
|
|
601
|
+
return n;
|
|
602
|
+
}
|
|
603
|
+
//#endregion
|
|
604
|
+
//#region ../../node_modules/.pnpm/oniguruma-parser@0.12.1/node_modules/oniguruma-parser/dist/parser/node-utils.js
|
|
605
|
+
function o(e, t) {
|
|
606
|
+
if (!Array.isArray(e.body)) throw new Error("Expected node with body array");
|
|
607
|
+
if (e.body.length !== 1) return !1;
|
|
608
|
+
const r = e.body[0];
|
|
609
|
+
return !t || Object.keys(t).every((n) => t[n] === r[n]);
|
|
610
|
+
}
|
|
611
|
+
function s(e) {
|
|
612
|
+
return y.has(e.type);
|
|
613
|
+
}
|
|
614
|
+
const y = /* @__PURE__ */ new Set([
|
|
615
|
+
"AbsenceFunction",
|
|
616
|
+
"Backreference",
|
|
617
|
+
"CapturingGroup",
|
|
618
|
+
"Character",
|
|
619
|
+
"CharacterClass",
|
|
620
|
+
"CharacterSet",
|
|
621
|
+
"Group",
|
|
622
|
+
"Quantifier",
|
|
623
|
+
"Subroutine"
|
|
624
|
+
]);
|
|
625
|
+
//#endregion
|
|
626
|
+
//#region ../../node_modules/.pnpm/oniguruma-parser@0.12.1/node_modules/oniguruma-parser/dist/parser/parse.js
|
|
627
|
+
function J(e, r = {}) {
|
|
628
|
+
const n = {
|
|
629
|
+
flags: "",
|
|
630
|
+
normalizeUnknownPropertyNames: !1,
|
|
631
|
+
skipBackrefValidation: !1,
|
|
632
|
+
skipLookbehindValidation: !1,
|
|
633
|
+
skipPropertyNameValidation: !1,
|
|
634
|
+
unicodePropertyMap: null,
|
|
635
|
+
...r,
|
|
636
|
+
rules: {
|
|
637
|
+
captureGroup: !1,
|
|
638
|
+
singleline: !1,
|
|
639
|
+
...r.rules
|
|
640
|
+
}
|
|
641
|
+
}, t = M$1(e, {
|
|
642
|
+
flags: n.flags,
|
|
643
|
+
rules: {
|
|
644
|
+
captureGroup: n.rules.captureGroup,
|
|
645
|
+
singleline: n.rules.singleline
|
|
646
|
+
}
|
|
647
|
+
}), s = (p, N) => {
|
|
648
|
+
const u = t.tokens[o.nextIndex];
|
|
649
|
+
switch (o.parent = p, o.nextIndex++, u.type) {
|
|
650
|
+
case "Alternator": return b();
|
|
651
|
+
case "Assertion": return W(u);
|
|
652
|
+
case "Backreference": return X(u, o);
|
|
653
|
+
case "Character": return m(u.value, { useLastValid: !!N.isCheckingRangeEnd });
|
|
654
|
+
case "CharacterClassHyphen": return ee(u, o, N);
|
|
655
|
+
case "CharacterClassOpen": return re(u, o, N);
|
|
656
|
+
case "CharacterSet": return ne(u, o);
|
|
657
|
+
case "Directive": return I(u.kind, { flags: u.flags });
|
|
658
|
+
case "GroupOpen": return te(u, o, N);
|
|
659
|
+
case "NamedCallout": return U(u.kind, u.tag, u.arguments);
|
|
660
|
+
case "Quantifier": return oe(u, o);
|
|
661
|
+
case "Subroutine": return ae(u, o);
|
|
662
|
+
default: throw new Error(`Unexpected token type "${u.type}"`);
|
|
663
|
+
}
|
|
664
|
+
}, o = {
|
|
665
|
+
capturingGroups: [],
|
|
666
|
+
hasNumberedRef: !1,
|
|
667
|
+
namedGroupsByName: /* @__PURE__ */ new Map(),
|
|
668
|
+
nextIndex: 0,
|
|
669
|
+
normalizeUnknownPropertyNames: n.normalizeUnknownPropertyNames,
|
|
670
|
+
parent: null,
|
|
671
|
+
skipBackrefValidation: n.skipBackrefValidation,
|
|
672
|
+
skipLookbehindValidation: n.skipLookbehindValidation,
|
|
673
|
+
skipPropertyNameValidation: n.skipPropertyNameValidation,
|
|
674
|
+
subroutines: [],
|
|
675
|
+
tokens: t.tokens,
|
|
676
|
+
unicodePropertyMap: n.unicodePropertyMap,
|
|
677
|
+
walk: s
|
|
678
|
+
}, i = B(T(t.flags));
|
|
679
|
+
let d = i.body[0];
|
|
680
|
+
for (; o.nextIndex < t.tokens.length;) {
|
|
681
|
+
const p = s(d, {});
|
|
682
|
+
p.type === "Alternative" ? (i.body.push(p), d = p) : d.body.push(p);
|
|
683
|
+
}
|
|
684
|
+
const { capturingGroups: a, hasNumberedRef: l, namedGroupsByName: c, subroutines: f } = o;
|
|
685
|
+
if (l && c.size && !n.rules.captureGroup) throw new Error("Numbered backref/subroutine not allowed when using named capture");
|
|
686
|
+
for (const { ref: p } of f) if (typeof p == "number") {
|
|
687
|
+
if (p > a.length) throw new Error("Subroutine uses a group number that's not defined");
|
|
688
|
+
p && (a[p - 1].isSubroutined = !0);
|
|
689
|
+
} else if (c.has(p)) {
|
|
690
|
+
if (c.get(p).length > 1) throw new Error(o$1`Subroutine uses a duplicate group name "\g<${p}>"`);
|
|
691
|
+
c.get(p)[0].isSubroutined = !0;
|
|
692
|
+
} else throw new Error(o$1`Subroutine uses a group name that's not defined "\g<${p}>"`);
|
|
693
|
+
return i;
|
|
694
|
+
}
|
|
695
|
+
function W({ kind: e }) {
|
|
696
|
+
return F(u({
|
|
697
|
+
"^": "line_start",
|
|
698
|
+
$: "line_end",
|
|
699
|
+
"\\A": "string_start",
|
|
700
|
+
"\\b": "word_boundary",
|
|
701
|
+
"\\B": "word_boundary",
|
|
702
|
+
"\\G": "search_start",
|
|
703
|
+
"\\y": "text_segment_boundary",
|
|
704
|
+
"\\Y": "text_segment_boundary",
|
|
705
|
+
"\\z": "string_end",
|
|
706
|
+
"\\Z": "string_end_newline"
|
|
707
|
+
}[e], `Unexpected assertion kind "${e}"`), { negate: e === o$1`\B` || e === o$1`\Y` });
|
|
708
|
+
}
|
|
709
|
+
function X({ raw: e }, r) {
|
|
710
|
+
const n = /^\\k[<']/.test(e), t = n ? e.slice(3, -1) : e.slice(1), s = (o, i = !1) => {
|
|
711
|
+
const d = r.capturingGroups.length;
|
|
712
|
+
let a = !1;
|
|
713
|
+
if (o > d) if (r.skipBackrefValidation) a = !0;
|
|
714
|
+
else throw new Error(`Not enough capturing groups defined to the left "${e}"`);
|
|
715
|
+
return r.hasNumberedRef = !0, k(i ? d + 1 - o : o, { orphan: a });
|
|
716
|
+
};
|
|
717
|
+
if (n) {
|
|
718
|
+
const o = /^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(t);
|
|
719
|
+
if (o) return s(+o.groups.num, !!o.groups.sign);
|
|
720
|
+
if (/[-+]/.test(t)) throw new Error(`Invalid backref name "${e}"`);
|
|
721
|
+
if (!r.namedGroupsByName.has(t)) throw new Error(`Group name not defined to the left "${e}"`);
|
|
722
|
+
return k(t);
|
|
723
|
+
}
|
|
724
|
+
return s(+t);
|
|
725
|
+
}
|
|
726
|
+
function ee(e, r, n) {
|
|
727
|
+
const { tokens: t, walk: s } = r, o = r.parent, i = o.body.at(-1), d = t[r.nextIndex];
|
|
728
|
+
if (!n.isCheckingRangeEnd && i && i.type !== "CharacterClass" && i.type !== "CharacterClassRange" && d && d.type !== "CharacterClassOpen" && d.type !== "CharacterClassClose" && d.type !== "CharacterClassIntersector") {
|
|
729
|
+
const a = s(o, {
|
|
730
|
+
...n,
|
|
731
|
+
isCheckingRangeEnd: !0
|
|
732
|
+
});
|
|
733
|
+
if (i.type === "Character" && a.type === "Character") return o.body.pop(), L(i, a);
|
|
734
|
+
throw new Error("Invalid character class range");
|
|
735
|
+
}
|
|
736
|
+
return m(r$2("-"));
|
|
737
|
+
}
|
|
738
|
+
function re({ negate: e }, r, n) {
|
|
739
|
+
const { tokens: t, walk: s } = r, o = t[r.nextIndex], i = [C()];
|
|
740
|
+
let d = z(o);
|
|
741
|
+
for (; d.type !== "CharacterClassClose";) {
|
|
742
|
+
if (d.type === "CharacterClassIntersector") i.push(C()), r.nextIndex++;
|
|
743
|
+
else {
|
|
744
|
+
const l = i.at(-1);
|
|
745
|
+
l.body.push(s(l, n));
|
|
746
|
+
}
|
|
747
|
+
d = z(t[r.nextIndex], o);
|
|
748
|
+
}
|
|
749
|
+
const a = C({ negate: e });
|
|
750
|
+
return i.length === 1 ? a.body = i[0].body : (a.kind = "intersection", a.body = i.map((l) => l.body.length === 1 ? l.body[0] : l)), r.nextIndex++, a;
|
|
751
|
+
}
|
|
752
|
+
function ne({ kind: e, negate: r, value: n }, t) {
|
|
753
|
+
const { normalizeUnknownPropertyNames: s, skipPropertyNameValidation: o, unicodePropertyMap: i$1 } = t;
|
|
754
|
+
if (e === "property") {
|
|
755
|
+
const d = w(n);
|
|
756
|
+
if (i.has(d) && !i$1?.has(d)) e = "posix", n = d;
|
|
757
|
+
else return Q(n, {
|
|
758
|
+
negate: r,
|
|
759
|
+
normalizeUnknownPropertyNames: s,
|
|
760
|
+
skipPropertyNameValidation: o,
|
|
761
|
+
unicodePropertyMap: i$1
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
return e === "posix" ? R(n, { negate: r }) : E(e, { negate: r });
|
|
765
|
+
}
|
|
766
|
+
function te(e, r, n) {
|
|
767
|
+
const { tokens: t, capturingGroups: s, namedGroupsByName: o, skipLookbehindValidation: i, walk: d } = r, a = ie(e), l = a.type === "AbsenceFunction", c = $(a), f = c && a.negate;
|
|
768
|
+
if (a.type === "CapturingGroup" && (s.push(a), a.name && l$1(o, a.name, []).push(a)), l && n.isInAbsenceFunction) throw new Error("Nested absence function not supported by Oniguruma");
|
|
769
|
+
let p = D(t[r.nextIndex]);
|
|
770
|
+
for (; p.type !== "GroupClose";) {
|
|
771
|
+
if (p.type === "Alternator") a.body.push(b()), r.nextIndex++;
|
|
772
|
+
else {
|
|
773
|
+
const N = a.body.at(-1), u = d(N, {
|
|
774
|
+
...n,
|
|
775
|
+
isInAbsenceFunction: n.isInAbsenceFunction || l,
|
|
776
|
+
isInLookbehind: n.isInLookbehind || c,
|
|
777
|
+
isInNegLookbehind: n.isInNegLookbehind || f
|
|
778
|
+
});
|
|
779
|
+
if (N.body.push(u), (c || n.isInLookbehind) && !i) {
|
|
780
|
+
const v = "Lookbehind includes a pattern not allowed by Oniguruma";
|
|
781
|
+
if (f || n.isInNegLookbehind) {
|
|
782
|
+
if (M(u) || u.type === "CapturingGroup") throw new Error(v);
|
|
783
|
+
} else if (M(u) || $(u) && u.negate) throw new Error(v);
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
p = D(t[r.nextIndex]);
|
|
787
|
+
}
|
|
788
|
+
return r.nextIndex++, a;
|
|
789
|
+
}
|
|
790
|
+
function oe({ kind: e, min: r, max: n }, t) {
|
|
791
|
+
const s$1 = t.parent, o = s$1.body.at(-1);
|
|
792
|
+
if (!o || !s(o)) throw new Error("Quantifier requires a repeatable token");
|
|
793
|
+
const i = _(e, r, n, o);
|
|
794
|
+
return s$1.body.pop(), i;
|
|
795
|
+
}
|
|
796
|
+
function ae({ raw: e }, r) {
|
|
797
|
+
const { capturingGroups: n, subroutines: t } = r;
|
|
798
|
+
let s = e.slice(3, -1);
|
|
799
|
+
const o = /^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(s);
|
|
800
|
+
if (o) {
|
|
801
|
+
const d = +o.groups.num, a = n.length;
|
|
802
|
+
if (r.hasNumberedRef = !0, s = {
|
|
803
|
+
"": d,
|
|
804
|
+
"+": a + d,
|
|
805
|
+
"-": a + 1 - d
|
|
806
|
+
}[o.groups.sign], s < 1) throw new Error("Invalid subroutine number");
|
|
807
|
+
} else s === "0" && (s = 0);
|
|
808
|
+
const i = O(s);
|
|
809
|
+
return t.push(i), i;
|
|
810
|
+
}
|
|
811
|
+
function G(e, r) {
|
|
812
|
+
if (e !== "repeater") throw new Error(`Unexpected absence function kind "${e}"`);
|
|
813
|
+
return {
|
|
814
|
+
type: "AbsenceFunction",
|
|
815
|
+
kind: e,
|
|
816
|
+
body: h(r?.body)
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
function b(e) {
|
|
820
|
+
return {
|
|
821
|
+
type: "Alternative",
|
|
822
|
+
body: V(e?.body)
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
function F(e, r) {
|
|
826
|
+
const n = {
|
|
827
|
+
type: "Assertion",
|
|
828
|
+
kind: e
|
|
829
|
+
};
|
|
830
|
+
return (e === "word_boundary" || e === "text_segment_boundary") && (n.negate = !!r?.negate), n;
|
|
831
|
+
}
|
|
832
|
+
function k(e, r) {
|
|
833
|
+
const n = !!r?.orphan;
|
|
834
|
+
return {
|
|
835
|
+
type: "Backreference",
|
|
836
|
+
ref: e,
|
|
837
|
+
...n && { orphan: n }
|
|
838
|
+
};
|
|
839
|
+
}
|
|
840
|
+
function P(e, r) {
|
|
841
|
+
const n = {
|
|
842
|
+
name: void 0,
|
|
843
|
+
isSubroutined: !1,
|
|
844
|
+
...r
|
|
845
|
+
};
|
|
846
|
+
if (n.name !== void 0 && !se(n.name)) throw new Error(`Group name "${n.name}" invalid in Oniguruma`);
|
|
847
|
+
return {
|
|
848
|
+
type: "CapturingGroup",
|
|
849
|
+
number: e,
|
|
850
|
+
...n.name && { name: n.name },
|
|
851
|
+
...n.isSubroutined && { isSubroutined: n.isSubroutined },
|
|
852
|
+
body: h(r?.body)
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
function m(e, r) {
|
|
856
|
+
const n = {
|
|
857
|
+
useLastValid: !1,
|
|
858
|
+
...r
|
|
859
|
+
};
|
|
860
|
+
if (e > 1114111) {
|
|
861
|
+
const t = e.toString(16);
|
|
862
|
+
if (n.useLastValid) e = 1114111;
|
|
863
|
+
else throw e > 1310719 ? /* @__PURE__ */ new Error(`Invalid code point out of range "\\x{${t}}"`) : /* @__PURE__ */ new Error(`Invalid code point out of range in JS "\\x{${t}}"`);
|
|
864
|
+
}
|
|
865
|
+
return {
|
|
866
|
+
type: "Character",
|
|
867
|
+
value: e
|
|
868
|
+
};
|
|
869
|
+
}
|
|
870
|
+
function C(e) {
|
|
871
|
+
const r = {
|
|
872
|
+
kind: "union",
|
|
873
|
+
negate: !1,
|
|
874
|
+
...e
|
|
875
|
+
};
|
|
876
|
+
return {
|
|
877
|
+
type: "CharacterClass",
|
|
878
|
+
kind: r.kind,
|
|
879
|
+
negate: r.negate,
|
|
880
|
+
body: V(e?.body)
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
function L(e, r) {
|
|
884
|
+
if (r.value < e.value) throw new Error("Character class range out of order");
|
|
885
|
+
return {
|
|
886
|
+
type: "CharacterClassRange",
|
|
887
|
+
min: e,
|
|
888
|
+
max: r
|
|
889
|
+
};
|
|
890
|
+
}
|
|
891
|
+
function E(e, r) {
|
|
892
|
+
const n = !!r?.negate, t = {
|
|
893
|
+
type: "CharacterSet",
|
|
894
|
+
kind: e
|
|
895
|
+
};
|
|
896
|
+
return (e === "digit" || e === "hex" || e === "newline" || e === "space" || e === "word") && (t.negate = n), (e === "text_segment" || e === "newline" && !n) && (t.variableLength = !0), t;
|
|
897
|
+
}
|
|
898
|
+
function I(e, r = {}) {
|
|
899
|
+
if (e === "keep") return {
|
|
900
|
+
type: "Directive",
|
|
901
|
+
kind: e
|
|
902
|
+
};
|
|
903
|
+
if (e === "flags") return {
|
|
904
|
+
type: "Directive",
|
|
905
|
+
kind: e,
|
|
906
|
+
flags: u(r.flags)
|
|
907
|
+
};
|
|
908
|
+
throw new Error(`Unexpected directive kind "${e}"`);
|
|
909
|
+
}
|
|
910
|
+
function T(e) {
|
|
911
|
+
return {
|
|
912
|
+
type: "Flags",
|
|
913
|
+
...e
|
|
914
|
+
};
|
|
915
|
+
}
|
|
916
|
+
function A(e) {
|
|
917
|
+
const r = e?.atomic, n = e?.flags;
|
|
918
|
+
if (r && n) throw new Error("Atomic group cannot have flags");
|
|
919
|
+
return {
|
|
920
|
+
type: "Group",
|
|
921
|
+
...r && { atomic: r },
|
|
922
|
+
...n && { flags: n },
|
|
923
|
+
body: h(e?.body)
|
|
924
|
+
};
|
|
925
|
+
}
|
|
926
|
+
function K(e) {
|
|
927
|
+
const r = {
|
|
928
|
+
behind: !1,
|
|
929
|
+
negate: !1,
|
|
930
|
+
...e
|
|
931
|
+
};
|
|
932
|
+
return {
|
|
933
|
+
type: "LookaroundAssertion",
|
|
934
|
+
kind: r.behind ? "lookbehind" : "lookahead",
|
|
935
|
+
negate: r.negate,
|
|
936
|
+
body: h(e?.body)
|
|
937
|
+
};
|
|
938
|
+
}
|
|
939
|
+
function U(e, r, n) {
|
|
940
|
+
return {
|
|
941
|
+
type: "NamedCallout",
|
|
942
|
+
kind: e,
|
|
943
|
+
tag: r,
|
|
944
|
+
arguments: n
|
|
945
|
+
};
|
|
946
|
+
}
|
|
947
|
+
function R(e, r) {
|
|
948
|
+
const n = !!r?.negate;
|
|
949
|
+
if (!i.has(e)) throw new Error(`Invalid POSIX class "${e}"`);
|
|
950
|
+
return {
|
|
951
|
+
type: "CharacterSet",
|
|
952
|
+
kind: "posix",
|
|
953
|
+
value: e,
|
|
954
|
+
negate: n
|
|
955
|
+
};
|
|
956
|
+
}
|
|
957
|
+
function _(e, r, n, t) {
|
|
958
|
+
if (r > n) throw new Error("Invalid reversed quantifier range");
|
|
959
|
+
return {
|
|
960
|
+
type: "Quantifier",
|
|
961
|
+
kind: e,
|
|
962
|
+
min: r,
|
|
963
|
+
max: n,
|
|
964
|
+
body: t
|
|
965
|
+
};
|
|
966
|
+
}
|
|
967
|
+
function B(e, r) {
|
|
968
|
+
return {
|
|
969
|
+
type: "Regex",
|
|
970
|
+
body: h(r?.body),
|
|
971
|
+
flags: e
|
|
972
|
+
};
|
|
973
|
+
}
|
|
974
|
+
function O(e) {
|
|
975
|
+
return {
|
|
976
|
+
type: "Subroutine",
|
|
977
|
+
ref: e
|
|
978
|
+
};
|
|
979
|
+
}
|
|
980
|
+
function Q(e, r) {
|
|
981
|
+
const n = {
|
|
982
|
+
negate: !1,
|
|
983
|
+
normalizeUnknownPropertyNames: !1,
|
|
984
|
+
skipPropertyNameValidation: !1,
|
|
985
|
+
unicodePropertyMap: null,
|
|
986
|
+
...r
|
|
987
|
+
};
|
|
988
|
+
let t = n.unicodePropertyMap?.get(w(e));
|
|
989
|
+
if (!t) {
|
|
990
|
+
if (n.normalizeUnknownPropertyNames) t = de(e);
|
|
991
|
+
else if (n.unicodePropertyMap && !n.skipPropertyNameValidation) throw new Error(o$1`Invalid Unicode property "\p{${e}}"`);
|
|
992
|
+
}
|
|
993
|
+
return {
|
|
994
|
+
type: "CharacterSet",
|
|
995
|
+
kind: "property",
|
|
996
|
+
value: t ?? e,
|
|
997
|
+
negate: n.negate
|
|
998
|
+
};
|
|
999
|
+
}
|
|
1000
|
+
function ie({ flags: e, kind: r, name: n, negate: t, number: s }) {
|
|
1001
|
+
switch (r) {
|
|
1002
|
+
case "absence_repeater": return G("repeater");
|
|
1003
|
+
case "atomic": return A({ atomic: !0 });
|
|
1004
|
+
case "capturing": return P(s, { name: n });
|
|
1005
|
+
case "group": return A({ flags: e });
|
|
1006
|
+
case "lookahead":
|
|
1007
|
+
case "lookbehind": return K({
|
|
1008
|
+
behind: r === "lookbehind",
|
|
1009
|
+
negate: t
|
|
1010
|
+
});
|
|
1011
|
+
default: throw new Error(`Unexpected group kind "${r}"`);
|
|
1012
|
+
}
|
|
1013
|
+
}
|
|
1014
|
+
function h(e) {
|
|
1015
|
+
if (e === void 0) e = [b()];
|
|
1016
|
+
else if (!Array.isArray(e) || !e.length || !e.every((r) => r.type === "Alternative")) throw new Error("Invalid body; expected array of one or more Alternative nodes");
|
|
1017
|
+
return e;
|
|
1018
|
+
}
|
|
1019
|
+
function V(e) {
|
|
1020
|
+
if (e === void 0) e = [];
|
|
1021
|
+
else if (!Array.isArray(e) || !e.every((r) => !!r.type)) throw new Error("Invalid body; expected array of nodes");
|
|
1022
|
+
return e;
|
|
1023
|
+
}
|
|
1024
|
+
function M(e) {
|
|
1025
|
+
return e.type === "LookaroundAssertion" && e.kind === "lookahead";
|
|
1026
|
+
}
|
|
1027
|
+
function $(e) {
|
|
1028
|
+
return e.type === "LookaroundAssertion" && e.kind === "lookbehind";
|
|
1029
|
+
}
|
|
1030
|
+
function se(e) {
|
|
1031
|
+
return /^[\p{Alpha}\p{Pc}][^)]*$/u.test(e);
|
|
1032
|
+
}
|
|
1033
|
+
function de(e) {
|
|
1034
|
+
return e.trim().replace(/[- _]+/g, "_").replace(/[A-Z][a-z]+(?=[A-Z])/g, "$&_").replace(/[A-Za-z]+/g, (r) => r[0].toUpperCase() + r.slice(1).toLowerCase());
|
|
1035
|
+
}
|
|
1036
|
+
function w(e) {
|
|
1037
|
+
return e.replace(/[- _]+/g, "").toLowerCase();
|
|
1038
|
+
}
|
|
1039
|
+
function z(e, r) {
|
|
1040
|
+
return u(e, `${r?.type === "Character" && r.value === 93 ? "Empty" : "Unclosed"} character class`);
|
|
1041
|
+
}
|
|
1042
|
+
function D(e) {
|
|
1043
|
+
return u(e, "Unclosed group");
|
|
1044
|
+
}
|
|
1045
|
+
//#endregion
|
|
1046
|
+
//#region ../../node_modules/.pnpm/oniguruma-parser@0.12.1/node_modules/oniguruma-parser/dist/traverser/traverse.js
|
|
1047
|
+
function S(a, v, N = null) {
|
|
1048
|
+
function u$1(e, s) {
|
|
1049
|
+
for (let t = 0; t < e.length; t++) {
|
|
1050
|
+
const r = n(e[t], s, t, e);
|
|
1051
|
+
t = Math.max(-1, t + r);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
function n(e, s = null, t = null, r = null) {
|
|
1055
|
+
let i = 0, c = !1;
|
|
1056
|
+
const d = {
|
|
1057
|
+
node: e,
|
|
1058
|
+
parent: s,
|
|
1059
|
+
key: t,
|
|
1060
|
+
container: r,
|
|
1061
|
+
root: a,
|
|
1062
|
+
remove() {
|
|
1063
|
+
f(r).splice(Math.max(0, l(t) + i), 1), i--, c = !0;
|
|
1064
|
+
},
|
|
1065
|
+
removeAllNextSiblings() {
|
|
1066
|
+
return f(r).splice(l(t) + 1);
|
|
1067
|
+
},
|
|
1068
|
+
removeAllPrevSiblings() {
|
|
1069
|
+
const o = l(t) + i;
|
|
1070
|
+
return i -= o, f(r).splice(0, Math.max(0, o));
|
|
1071
|
+
},
|
|
1072
|
+
replaceWith(o, y = {}) {
|
|
1073
|
+
const b = !!y.traverse;
|
|
1074
|
+
r ? r[Math.max(0, l(t) + i)] = o : u(s, "Can't replace root node")[t] = o, b && n(o, s, t, r), c = !0;
|
|
1075
|
+
},
|
|
1076
|
+
replaceWithMultiple(o, y = {}) {
|
|
1077
|
+
const b = !!y.traverse;
|
|
1078
|
+
if (f(r).splice(Math.max(0, l(t) + i), 1, ...o), i += o.length - 1, b) {
|
|
1079
|
+
let g = 0;
|
|
1080
|
+
for (let x = 0; x < o.length; x++) g += n(o[x], s, l(t) + x + g, r);
|
|
1081
|
+
}
|
|
1082
|
+
c = !0;
|
|
1083
|
+
},
|
|
1084
|
+
skip() {
|
|
1085
|
+
c = !0;
|
|
1086
|
+
}
|
|
1087
|
+
}, { type: m } = e, h = v["*"], p = v[m], R = typeof h == "function" ? h : h?.enter, P = typeof p == "function" ? p : p?.enter;
|
|
1088
|
+
if (R?.(d, N), P?.(d, N), !c) switch (m) {
|
|
1089
|
+
case "AbsenceFunction":
|
|
1090
|
+
case "CapturingGroup":
|
|
1091
|
+
case "Group":
|
|
1092
|
+
u$1(e.body, e);
|
|
1093
|
+
break;
|
|
1094
|
+
case "Alternative":
|
|
1095
|
+
case "CharacterClass":
|
|
1096
|
+
u$1(e.body, e);
|
|
1097
|
+
break;
|
|
1098
|
+
case "Assertion":
|
|
1099
|
+
case "Backreference":
|
|
1100
|
+
case "Character":
|
|
1101
|
+
case "CharacterSet":
|
|
1102
|
+
case "Directive":
|
|
1103
|
+
case "Flags":
|
|
1104
|
+
case "NamedCallout":
|
|
1105
|
+
case "Subroutine": break;
|
|
1106
|
+
case "CharacterClassRange":
|
|
1107
|
+
n(e.min, e, "min"), n(e.max, e, "max");
|
|
1108
|
+
break;
|
|
1109
|
+
case "LookaroundAssertion":
|
|
1110
|
+
u$1(e.body, e);
|
|
1111
|
+
break;
|
|
1112
|
+
case "Quantifier":
|
|
1113
|
+
n(e.body, e, "body");
|
|
1114
|
+
break;
|
|
1115
|
+
case "Regex":
|
|
1116
|
+
u$1(e.body, e), n(e.flags, e, "flags");
|
|
1117
|
+
break;
|
|
1118
|
+
default: throw new Error(`Unexpected node type "${m}"`);
|
|
1119
|
+
}
|
|
1120
|
+
return p?.exit?.(d, N), h?.exit?.(d, N), i;
|
|
1121
|
+
}
|
|
1122
|
+
return n(a), a;
|
|
1123
|
+
}
|
|
1124
|
+
function f(a) {
|
|
1125
|
+
if (!Array.isArray(a)) throw new Error("Container expected");
|
|
1126
|
+
return a;
|
|
1127
|
+
}
|
|
1128
|
+
function l(a) {
|
|
1129
|
+
if (typeof a != "number") throw new Error("Numeric key expected");
|
|
1130
|
+
return a;
|
|
1131
|
+
}
|
|
1132
|
+
//#endregion
|
|
1133
|
+
//#region ../../node_modules/.pnpm/regex@6.1.0/node_modules/regex/src/utils-internals.js
|
|
1134
|
+
const noncapturingDelim = String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;
|
|
1135
|
+
/**
|
|
1136
|
+
Updates the array in place by incrementing each value greater than or equal to the threshold.
|
|
1137
|
+
@param {Array<number>} arr
|
|
1138
|
+
@param {number} threshold
|
|
1139
|
+
*/
|
|
1140
|
+
function incrementIfAtLeast$1(arr, threshold) {
|
|
1141
|
+
for (let i = 0; i < arr.length; i++) if (arr[i] >= threshold) arr[i]++;
|
|
1142
|
+
}
|
|
1143
|
+
/**
|
|
1144
|
+
@param {string} str
|
|
1145
|
+
@param {number} pos
|
|
1146
|
+
@param {string} oldValue
|
|
1147
|
+
@param {string} newValue
|
|
1148
|
+
@returns {string}
|
|
1149
|
+
*/
|
|
1150
|
+
function spliceStr(str, pos, oldValue, newValue) {
|
|
1151
|
+
return str.slice(0, pos) + newValue + str.slice(pos + oldValue.length);
|
|
1152
|
+
}
|
|
1153
|
+
//#endregion
|
|
1154
|
+
//#region ../../node_modules/.pnpm/regex-utilities@2.3.0/node_modules/regex-utilities/src/index.js
|
|
1155
|
+
const Context = Object.freeze({
|
|
1156
|
+
DEFAULT: "DEFAULT",
|
|
1157
|
+
CHAR_CLASS: "CHAR_CLASS"
|
|
1158
|
+
});
|
|
1159
|
+
/**
|
|
1160
|
+
Replaces all unescaped instances of a regex pattern in the given context, using a replacement
|
|
1161
|
+
string or callback.
|
|
1162
|
+
|
|
1163
|
+
Doesn't skip over complete multicharacter tokens (only `\` plus its folowing char) so must be used
|
|
1164
|
+
with knowledge of what's safe to do given regex syntax. Assumes UnicodeSets-mode syntax.
|
|
1165
|
+
@param {string} expression Search target
|
|
1166
|
+
@param {string} needle Search as a regex pattern, with flags `su` applied
|
|
1167
|
+
@param {string | (match: RegExpExecArray, details: {
|
|
1168
|
+
context: 'DEFAULT' | 'CHAR_CLASS';
|
|
1169
|
+
negated: boolean;
|
|
1170
|
+
}) => string} replacement
|
|
1171
|
+
@param {'DEFAULT' | 'CHAR_CLASS'} [context] All contexts if not specified
|
|
1172
|
+
@returns {string} Updated expression
|
|
1173
|
+
@example
|
|
1174
|
+
const str = '.\\.\\\\.[[\\.].].';
|
|
1175
|
+
replaceUnescaped(str, '\\.', '@');
|
|
1176
|
+
// → '@\\.\\\\@[[\\.]@]@'
|
|
1177
|
+
replaceUnescaped(str, '\\.', '@', Context.DEFAULT);
|
|
1178
|
+
// → '@\\.\\\\@[[\\.].]@'
|
|
1179
|
+
replaceUnescaped(str, '\\.', '@', Context.CHAR_CLASS);
|
|
1180
|
+
// → '.\\.\\\\.[[\\.]@].'
|
|
1181
|
+
*/
|
|
1182
|
+
function replaceUnescaped(expression, needle, replacement, context) {
|
|
1183
|
+
const re = new RegExp(String.raw`${needle}|(?<$skip>\[\^?|\\?.)`, "gsu");
|
|
1184
|
+
const negated = [false];
|
|
1185
|
+
let numCharClassesOpen = 0;
|
|
1186
|
+
let result = "";
|
|
1187
|
+
for (const match of expression.matchAll(re)) {
|
|
1188
|
+
const { 0: m, groups: { $skip } } = match;
|
|
1189
|
+
if (!$skip && (!context || context === Context.DEFAULT === !numCharClassesOpen)) {
|
|
1190
|
+
if (replacement instanceof Function) result += replacement(match, {
|
|
1191
|
+
context: numCharClassesOpen ? Context.CHAR_CLASS : Context.DEFAULT,
|
|
1192
|
+
negated: negated[negated.length - 1]
|
|
1193
|
+
});
|
|
1194
|
+
else result += replacement;
|
|
1195
|
+
continue;
|
|
1196
|
+
}
|
|
1197
|
+
if (m[0] === "[") {
|
|
1198
|
+
numCharClassesOpen++;
|
|
1199
|
+
negated.push(m[1] === "^");
|
|
1200
|
+
} else if (m === "]" && numCharClassesOpen) {
|
|
1201
|
+
numCharClassesOpen--;
|
|
1202
|
+
negated.pop();
|
|
1203
|
+
}
|
|
1204
|
+
result += m;
|
|
1205
|
+
}
|
|
1206
|
+
return result;
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
Runs a callback for each unescaped instance of a regex pattern in the given context.
|
|
1210
|
+
|
|
1211
|
+
Doesn't skip over complete multicharacter tokens (only `\` plus its folowing char) so must be used
|
|
1212
|
+
with knowledge of what's safe to do given regex syntax. Assumes UnicodeSets-mode syntax.
|
|
1213
|
+
@param {string} expression Search target
|
|
1214
|
+
@param {string} needle Search as a regex pattern, with flags `su` applied
|
|
1215
|
+
@param {(match: RegExpExecArray, details: {
|
|
1216
|
+
context: 'DEFAULT' | 'CHAR_CLASS';
|
|
1217
|
+
negated: boolean;
|
|
1218
|
+
}) => void} callback
|
|
1219
|
+
@param {'DEFAULT' | 'CHAR_CLASS'} [context] All contexts if not specified
|
|
1220
|
+
*/
|
|
1221
|
+
function forEachUnescaped(expression, needle, callback, context) {
|
|
1222
|
+
replaceUnescaped(expression, needle, callback, context);
|
|
1223
|
+
}
|
|
1224
|
+
/**
|
|
1225
|
+
Returns a match object for the first unescaped instance of a regex pattern in the given context, or
|
|
1226
|
+
`null`.
|
|
1227
|
+
|
|
1228
|
+
Doesn't skip over complete multicharacter tokens (only `\` plus its folowing char) so must be used
|
|
1229
|
+
with knowledge of what's safe to do given regex syntax. Assumes UnicodeSets-mode syntax.
|
|
1230
|
+
@param {string} expression Search target
|
|
1231
|
+
@param {string} needle Search as a regex pattern, with flags `su` applied
|
|
1232
|
+
@param {number} [pos] Offset to start the search
|
|
1233
|
+
@param {'DEFAULT' | 'CHAR_CLASS'} [context] All contexts if not specified
|
|
1234
|
+
@returns {RegExpExecArray | null}
|
|
1235
|
+
*/
|
|
1236
|
+
function execUnescaped(expression, needle, pos = 0, context) {
|
|
1237
|
+
if (!new RegExp(needle, "su").test(expression)) return null;
|
|
1238
|
+
const re = new RegExp(`${needle}|(?<$skip>\\\\?.)`, "gsu");
|
|
1239
|
+
re.lastIndex = pos;
|
|
1240
|
+
let numCharClassesOpen = 0;
|
|
1241
|
+
let match;
|
|
1242
|
+
while (match = re.exec(expression)) {
|
|
1243
|
+
const { 0: m, groups: { $skip } } = match;
|
|
1244
|
+
if (!$skip && (!context || context === Context.DEFAULT === !numCharClassesOpen)) return match;
|
|
1245
|
+
if (m === "[") numCharClassesOpen++;
|
|
1246
|
+
else if (m === "]" && numCharClassesOpen) numCharClassesOpen--;
|
|
1247
|
+
if (re.lastIndex == match.index) re.lastIndex++;
|
|
1248
|
+
}
|
|
1249
|
+
return null;
|
|
1250
|
+
}
|
|
1251
|
+
/**
|
|
1252
|
+
Checks whether an unescaped instance of a regex pattern appears in the given context.
|
|
1253
|
+
|
|
1254
|
+
Doesn't skip over complete multicharacter tokens (only `\` plus its folowing char) so must be used
|
|
1255
|
+
with knowledge of what's safe to do given regex syntax. Assumes UnicodeSets-mode syntax.
|
|
1256
|
+
@param {string} expression Search target
|
|
1257
|
+
@param {string} needle Search as a regex pattern, with flags `su` applied
|
|
1258
|
+
@param {'DEFAULT' | 'CHAR_CLASS'} [context] All contexts if not specified
|
|
1259
|
+
@returns {boolean} Whether the pattern was found
|
|
1260
|
+
*/
|
|
1261
|
+
function hasUnescaped(expression, needle, context) {
|
|
1262
|
+
return !!execUnescaped(expression, needle, 0, context);
|
|
1263
|
+
}
|
|
1264
|
+
/**
|
|
1265
|
+
Extracts the full contents of a group (subpattern) from the given expression, accounting for
|
|
1266
|
+
escaped characters, nested groups, and character classes. The group is identified by the position
|
|
1267
|
+
where its contents start (the string index just after the group's opening delimiter). Returns the
|
|
1268
|
+
rest of the string if the group is unclosed.
|
|
1269
|
+
|
|
1270
|
+
Assumes UnicodeSets-mode syntax.
|
|
1271
|
+
@param {string} expression Search target
|
|
1272
|
+
@param {number} contentsStartPos
|
|
1273
|
+
@returns {string}
|
|
1274
|
+
*/
|
|
1275
|
+
function getGroupContents(expression, contentsStartPos) {
|
|
1276
|
+
const token = /\\?./gsu;
|
|
1277
|
+
token.lastIndex = contentsStartPos;
|
|
1278
|
+
let contentsEndPos = expression.length;
|
|
1279
|
+
let numCharClassesOpen = 0;
|
|
1280
|
+
let numGroupsOpen = 1;
|
|
1281
|
+
let match;
|
|
1282
|
+
while (match = token.exec(expression)) {
|
|
1283
|
+
const [m] = match;
|
|
1284
|
+
if (m === "[") numCharClassesOpen++;
|
|
1285
|
+
else if (!numCharClassesOpen) {
|
|
1286
|
+
if (m === "(") numGroupsOpen++;
|
|
1287
|
+
else if (m === ")") {
|
|
1288
|
+
numGroupsOpen--;
|
|
1289
|
+
if (!numGroupsOpen) {
|
|
1290
|
+
contentsEndPos = match.index;
|
|
1291
|
+
break;
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
} else if (m === "]") numCharClassesOpen--;
|
|
1295
|
+
}
|
|
1296
|
+
return expression.slice(contentsStartPos, contentsEndPos);
|
|
1297
|
+
}
|
|
1298
|
+
//#endregion
|
|
1299
|
+
//#region ../../node_modules/.pnpm/regex@6.1.0/node_modules/regex/src/atomic.js
|
|
1300
|
+
/**
|
|
1301
|
+
@import {PluginData, PluginResult} from './regex.js';
|
|
1302
|
+
*/
|
|
1303
|
+
const atomicPluginToken = new RegExp(String.raw`(?<noncapturingStart>${noncapturingDelim})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`, "gsu");
|
|
1304
|
+
/**
|
|
1305
|
+
Apply transformations for atomic groups: `(?>…)`.
|
|
1306
|
+
@param {string} expression
|
|
1307
|
+
@param {PluginData} [data]
|
|
1308
|
+
@returns {Required<PluginResult>}
|
|
1309
|
+
*/
|
|
1310
|
+
function atomic(expression, data) {
|
|
1311
|
+
const hiddenCaptures = data?.hiddenCaptures ?? [];
|
|
1312
|
+
let captureTransfers = data?.captureTransfers ?? /* @__PURE__ */ new Map();
|
|
1313
|
+
if (!/\(\?>/.test(expression)) return {
|
|
1314
|
+
pattern: expression,
|
|
1315
|
+
captureTransfers,
|
|
1316
|
+
hiddenCaptures
|
|
1317
|
+
};
|
|
1318
|
+
const aGDelim = "(?>";
|
|
1319
|
+
const emulatedAGDelim = "(?:(?=(";
|
|
1320
|
+
const captureNumMap = [0];
|
|
1321
|
+
const addedHiddenCaptures = [];
|
|
1322
|
+
let numCapturesBeforeAG = 0;
|
|
1323
|
+
let numAGs = 0;
|
|
1324
|
+
let aGPos = NaN;
|
|
1325
|
+
let hasProcessedAG;
|
|
1326
|
+
do {
|
|
1327
|
+
hasProcessedAG = false;
|
|
1328
|
+
let numCharClassesOpen = 0;
|
|
1329
|
+
let numGroupsOpenInAG = 0;
|
|
1330
|
+
let inAG = false;
|
|
1331
|
+
let match;
|
|
1332
|
+
atomicPluginToken.lastIndex = Number.isNaN(aGPos) ? 0 : aGPos + 7;
|
|
1333
|
+
while (match = atomicPluginToken.exec(expression)) {
|
|
1334
|
+
const { 0: m, index, groups: { capturingStart, noncapturingStart } } = match;
|
|
1335
|
+
if (m === "[") numCharClassesOpen++;
|
|
1336
|
+
else if (!numCharClassesOpen) {
|
|
1337
|
+
if (m === aGDelim && !inAG) {
|
|
1338
|
+
aGPos = index;
|
|
1339
|
+
inAG = true;
|
|
1340
|
+
} else if (inAG && noncapturingStart) numGroupsOpenInAG++;
|
|
1341
|
+
else if (capturingStart) if (inAG) numGroupsOpenInAG++;
|
|
1342
|
+
else {
|
|
1343
|
+
numCapturesBeforeAG++;
|
|
1344
|
+
captureNumMap.push(numCapturesBeforeAG + numAGs);
|
|
1345
|
+
}
|
|
1346
|
+
else if (m === ")" && inAG) {
|
|
1347
|
+
if (!numGroupsOpenInAG) {
|
|
1348
|
+
numAGs++;
|
|
1349
|
+
const addedCaptureNum = numCapturesBeforeAG + numAGs;
|
|
1350
|
+
expression = `${expression.slice(0, aGPos)}${emulatedAGDelim}${expression.slice(aGPos + 3, index)}))<$$${addedCaptureNum}>)${expression.slice(index + 1)}`;
|
|
1351
|
+
hasProcessedAG = true;
|
|
1352
|
+
addedHiddenCaptures.push(addedCaptureNum);
|
|
1353
|
+
incrementIfAtLeast$1(hiddenCaptures, addedCaptureNum);
|
|
1354
|
+
if (captureTransfers.size) {
|
|
1355
|
+
const newCaptureTransfers = /* @__PURE__ */ new Map();
|
|
1356
|
+
captureTransfers.forEach((from, to) => {
|
|
1357
|
+
newCaptureTransfers.set(to >= addedCaptureNum ? to + 1 : to, from.map((f) => f >= addedCaptureNum ? f + 1 : f));
|
|
1358
|
+
});
|
|
1359
|
+
captureTransfers = newCaptureTransfers;
|
|
1360
|
+
}
|
|
1361
|
+
break;
|
|
1362
|
+
}
|
|
1363
|
+
numGroupsOpenInAG--;
|
|
1364
|
+
}
|
|
1365
|
+
} else if (m === "]") numCharClassesOpen--;
|
|
1366
|
+
}
|
|
1367
|
+
} while (hasProcessedAG);
|
|
1368
|
+
hiddenCaptures.push(...addedHiddenCaptures);
|
|
1369
|
+
expression = replaceUnescaped(expression, String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`, ({ 0: m, groups: { backrefNum, wrappedBackrefNum } }) => {
|
|
1370
|
+
if (backrefNum) {
|
|
1371
|
+
const bNum = +backrefNum;
|
|
1372
|
+
if (bNum > captureNumMap.length - 1) throw new Error(`Backref "${m}" greater than number of captures`);
|
|
1373
|
+
return `\\${captureNumMap[bNum]}`;
|
|
1374
|
+
}
|
|
1375
|
+
return `\\${wrappedBackrefNum}`;
|
|
1376
|
+
}, Context.DEFAULT);
|
|
1377
|
+
return {
|
|
1378
|
+
pattern: expression,
|
|
1379
|
+
captureTransfers,
|
|
1380
|
+
hiddenCaptures
|
|
1381
|
+
};
|
|
1382
|
+
}
|
|
1383
|
+
const baseQuantifier = String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`;
|
|
1384
|
+
const possessivePluginToken = new RegExp(String.raw`
|
|
1385
|
+
\\(?: \d+
|
|
1386
|
+
| c[A-Za-z]
|
|
1387
|
+
| [gk]<[^>]+>
|
|
1388
|
+
| [pPu]\{[^\}]+\}
|
|
1389
|
+
| u[A-Fa-f\d]{4}
|
|
1390
|
+
| x[A-Fa-f\d]{2}
|
|
1391
|
+
)
|
|
1392
|
+
| \((?: \? (?: [:=!>]
|
|
1393
|
+
| <(?:[=!]|[^>]+>)
|
|
1394
|
+
| [A-Za-z\-]+:
|
|
1395
|
+
| \(DEFINE\)
|
|
1396
|
+
))?
|
|
1397
|
+
| (?<qBase>${baseQuantifier})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
1398
|
+
| \\?.
|
|
1399
|
+
`.replace(/\s+/g, ""), "gsu");
|
|
1400
|
+
/**
|
|
1401
|
+
Transform posessive quantifiers into atomic groups. The posessessive quantifiers are:
|
|
1402
|
+
`?+`, `*+`, `++`, `{N}+`, `{N,}+`, `{N,N}+`.
|
|
1403
|
+
This follows Java, PCRE, Perl, and Python.
|
|
1404
|
+
Possessive quantifiers in Oniguruma and Onigmo are only: `?+`, `*+`, `++`.
|
|
1405
|
+
@param {string} expression
|
|
1406
|
+
@returns {PluginResult}
|
|
1407
|
+
*/
|
|
1408
|
+
function possessive(expression) {
|
|
1409
|
+
if (!new RegExp(`${baseQuantifier}\\+`).test(expression)) return { pattern: expression };
|
|
1410
|
+
const openGroupIndices = [];
|
|
1411
|
+
let lastGroupIndex = null;
|
|
1412
|
+
let lastCharClassIndex = null;
|
|
1413
|
+
let lastToken = "";
|
|
1414
|
+
let numCharClassesOpen = 0;
|
|
1415
|
+
let match;
|
|
1416
|
+
possessivePluginToken.lastIndex = 0;
|
|
1417
|
+
while (match = possessivePluginToken.exec(expression)) {
|
|
1418
|
+
const { 0: m, index, groups: { qBase, qMod, invalidQ } } = match;
|
|
1419
|
+
if (m === "[") {
|
|
1420
|
+
if (!numCharClassesOpen) lastCharClassIndex = index;
|
|
1421
|
+
numCharClassesOpen++;
|
|
1422
|
+
} else if (m === "]") if (numCharClassesOpen) numCharClassesOpen--;
|
|
1423
|
+
else lastCharClassIndex = null;
|
|
1424
|
+
else if (!numCharClassesOpen) {
|
|
1425
|
+
if (qMod === "+" && lastToken && !lastToken.startsWith("(")) {
|
|
1426
|
+
if (invalidQ) throw new Error(`Invalid quantifier "${m}"`);
|
|
1427
|
+
let charsAdded = -1;
|
|
1428
|
+
if (/^\{\d+\}$/.test(qBase)) expression = spliceStr(expression, index + qBase.length, qMod, "");
|
|
1429
|
+
else {
|
|
1430
|
+
if (lastToken === ")" || lastToken === "]") {
|
|
1431
|
+
const nodeIndex = lastToken === ")" ? lastGroupIndex : lastCharClassIndex;
|
|
1432
|
+
if (nodeIndex === null) throw new Error(`Invalid unmatched "${lastToken}"`);
|
|
1433
|
+
expression = `${expression.slice(0, nodeIndex)}(?>${expression.slice(nodeIndex, index)}${qBase})${expression.slice(index + m.length)}`;
|
|
1434
|
+
} else expression = `${expression.slice(0, index - lastToken.length)}(?>${lastToken}${qBase})${expression.slice(index + m.length)}`;
|
|
1435
|
+
charsAdded += 4;
|
|
1436
|
+
}
|
|
1437
|
+
possessivePluginToken.lastIndex += charsAdded;
|
|
1438
|
+
} else if (m[0] === "(") openGroupIndices.push(index);
|
|
1439
|
+
else if (m === ")") lastGroupIndex = openGroupIndices.length ? openGroupIndices.pop() : null;
|
|
1440
|
+
}
|
|
1441
|
+
lastToken = m;
|
|
1442
|
+
}
|
|
1443
|
+
return { pattern: expression };
|
|
1444
|
+
}
|
|
1445
|
+
//#endregion
|
|
1446
|
+
//#region ../../node_modules/.pnpm/regex-recursion@6.0.2/node_modules/regex-recursion/src/index.js
|
|
1447
|
+
const r$1 = String.raw;
|
|
1448
|
+
const recursiveToken = r$1`\(\?R=(?<rDepth>[^\)]+)\)|${r$1`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`;
|
|
1449
|
+
const namedCaptureDelim = r$1`\(\?<(?![=!])(?<captureName>[^>]+)>`;
|
|
1450
|
+
const captureDelim = r$1`${namedCaptureDelim}|(?<unnamed>\()(?!\?)`;
|
|
1451
|
+
const token = new RegExp(r$1`${namedCaptureDelim}|${recursiveToken}|\(\?|\\?.`, "gsu");
|
|
1452
|
+
const overlappingRecursionMsg = "Cannot use multiple overlapping recursions";
|
|
1453
|
+
/**
|
|
1454
|
+
@param {string} pattern
|
|
1455
|
+
@param {{
|
|
1456
|
+
flags?: string;
|
|
1457
|
+
captureTransfers?: Map<number, Array<number>>;
|
|
1458
|
+
hiddenCaptures?: Array<number>;
|
|
1459
|
+
mode?: 'plugin' | 'external';
|
|
1460
|
+
}} [data]
|
|
1461
|
+
@returns {{
|
|
1462
|
+
pattern: string;
|
|
1463
|
+
captureTransfers: Map<number, Array<number>>;
|
|
1464
|
+
hiddenCaptures: Array<number>;
|
|
1465
|
+
}}
|
|
1466
|
+
*/
|
|
1467
|
+
function recursion(pattern, data) {
|
|
1468
|
+
const { hiddenCaptures, mode } = {
|
|
1469
|
+
hiddenCaptures: [],
|
|
1470
|
+
mode: "plugin",
|
|
1471
|
+
...data
|
|
1472
|
+
};
|
|
1473
|
+
let captureTransfers = data?.captureTransfers ?? /* @__PURE__ */ new Map();
|
|
1474
|
+
if (!new RegExp(recursiveToken, "su").test(pattern)) return {
|
|
1475
|
+
pattern,
|
|
1476
|
+
captureTransfers,
|
|
1477
|
+
hiddenCaptures
|
|
1478
|
+
};
|
|
1479
|
+
if (mode === "plugin" && hasUnescaped(pattern, r$1`\(\?\(DEFINE\)`, Context.DEFAULT)) throw new Error("DEFINE groups cannot be used with recursion");
|
|
1480
|
+
const addedHiddenCaptures = [];
|
|
1481
|
+
const hasNumberedBackref = hasUnescaped(pattern, r$1`\\[1-9]`, Context.DEFAULT);
|
|
1482
|
+
const groupContentsStartPos = /* @__PURE__ */ new Map();
|
|
1483
|
+
const openGroups = [];
|
|
1484
|
+
let hasRecursed = false;
|
|
1485
|
+
let numCharClassesOpen = 0;
|
|
1486
|
+
let numCapturesPassed = 0;
|
|
1487
|
+
let match;
|
|
1488
|
+
token.lastIndex = 0;
|
|
1489
|
+
while (match = token.exec(pattern)) {
|
|
1490
|
+
const { 0: m, groups: { captureName, rDepth, gRNameOrNum, gRDepth } } = match;
|
|
1491
|
+
if (m === "[") numCharClassesOpen++;
|
|
1492
|
+
else if (!numCharClassesOpen) {
|
|
1493
|
+
if (rDepth) {
|
|
1494
|
+
assertMaxInBounds(rDepth);
|
|
1495
|
+
if (hasRecursed) throw new Error(overlappingRecursionMsg);
|
|
1496
|
+
if (hasNumberedBackref) throw new Error(`${mode === "external" ? "Backrefs" : "Numbered backrefs"} cannot be used with global recursion`);
|
|
1497
|
+
const left = pattern.slice(0, match.index);
|
|
1498
|
+
const right = pattern.slice(token.lastIndex);
|
|
1499
|
+
if (hasUnescaped(right, recursiveToken, Context.DEFAULT)) throw new Error(overlappingRecursionMsg);
|
|
1500
|
+
const reps = +rDepth - 1;
|
|
1501
|
+
pattern = makeRecursive(left, right, reps, false, hiddenCaptures, addedHiddenCaptures, numCapturesPassed);
|
|
1502
|
+
captureTransfers = mapCaptureTransfers(captureTransfers, left, reps, addedHiddenCaptures.length, 0, numCapturesPassed);
|
|
1503
|
+
break;
|
|
1504
|
+
} else if (gRNameOrNum) {
|
|
1505
|
+
assertMaxInBounds(gRDepth);
|
|
1506
|
+
let isWithinReffedGroup = false;
|
|
1507
|
+
for (const g of openGroups) if (g.name === gRNameOrNum || g.num === +gRNameOrNum) {
|
|
1508
|
+
isWithinReffedGroup = true;
|
|
1509
|
+
if (g.hasRecursedWithin) throw new Error(overlappingRecursionMsg);
|
|
1510
|
+
break;
|
|
1511
|
+
}
|
|
1512
|
+
if (!isWithinReffedGroup) throw new Error(r$1`Recursive \g cannot be used outside the referenced group "${mode === "external" ? gRNameOrNum : r$1`\g<${gRNameOrNum}&R=${gRDepth}>`}"`);
|
|
1513
|
+
const startPos = groupContentsStartPos.get(gRNameOrNum);
|
|
1514
|
+
const groupContents = getGroupContents(pattern, startPos);
|
|
1515
|
+
if (hasNumberedBackref && hasUnescaped(groupContents, r$1`${namedCaptureDelim}|\((?!\?)`, Context.DEFAULT)) throw new Error(`${mode === "external" ? "Backrefs" : "Numbered backrefs"} cannot be used with recursion of capturing groups`);
|
|
1516
|
+
const groupContentsLeft = pattern.slice(startPos, match.index);
|
|
1517
|
+
const groupContentsRight = groupContents.slice(groupContentsLeft.length + m.length);
|
|
1518
|
+
const numAddedHiddenCapturesPreExpansion = addedHiddenCaptures.length;
|
|
1519
|
+
const reps = +gRDepth - 1;
|
|
1520
|
+
const expansion = makeRecursive(groupContentsLeft, groupContentsRight, reps, true, hiddenCaptures, addedHiddenCaptures, numCapturesPassed);
|
|
1521
|
+
captureTransfers = mapCaptureTransfers(captureTransfers, groupContentsLeft, reps, addedHiddenCaptures.length - numAddedHiddenCapturesPreExpansion, numAddedHiddenCapturesPreExpansion, numCapturesPassed);
|
|
1522
|
+
pattern = `${pattern.slice(0, startPos)}${expansion}${pattern.slice(startPos + groupContents.length)}`;
|
|
1523
|
+
token.lastIndex += expansion.length - m.length - groupContentsLeft.length - groupContentsRight.length;
|
|
1524
|
+
openGroups.forEach((g) => g.hasRecursedWithin = true);
|
|
1525
|
+
hasRecursed = true;
|
|
1526
|
+
} else if (captureName) {
|
|
1527
|
+
numCapturesPassed++;
|
|
1528
|
+
groupContentsStartPos.set(String(numCapturesPassed), token.lastIndex);
|
|
1529
|
+
groupContentsStartPos.set(captureName, token.lastIndex);
|
|
1530
|
+
openGroups.push({
|
|
1531
|
+
num: numCapturesPassed,
|
|
1532
|
+
name: captureName
|
|
1533
|
+
});
|
|
1534
|
+
} else if (m[0] === "(") {
|
|
1535
|
+
const isUnnamedCapture = m === "(";
|
|
1536
|
+
if (isUnnamedCapture) {
|
|
1537
|
+
numCapturesPassed++;
|
|
1538
|
+
groupContentsStartPos.set(String(numCapturesPassed), token.lastIndex);
|
|
1539
|
+
}
|
|
1540
|
+
openGroups.push(isUnnamedCapture ? { num: numCapturesPassed } : {});
|
|
1541
|
+
} else if (m === ")") openGroups.pop();
|
|
1542
|
+
} else if (m === "]") numCharClassesOpen--;
|
|
1543
|
+
}
|
|
1544
|
+
hiddenCaptures.push(...addedHiddenCaptures);
|
|
1545
|
+
return {
|
|
1546
|
+
pattern,
|
|
1547
|
+
captureTransfers,
|
|
1548
|
+
hiddenCaptures
|
|
1549
|
+
};
|
|
1550
|
+
}
|
|
1551
|
+
/**
|
|
1552
|
+
@param {string} max
|
|
1553
|
+
*/
|
|
1554
|
+
function assertMaxInBounds(max) {
|
|
1555
|
+
const errMsg = `Max depth must be integer between 2 and 100; used ${max}`;
|
|
1556
|
+
if (!/^[1-9]\d*$/.test(max)) throw new Error(errMsg);
|
|
1557
|
+
max = +max;
|
|
1558
|
+
if (max < 2 || max > 100) throw new Error(errMsg);
|
|
1559
|
+
}
|
|
1560
|
+
/**
|
|
1561
|
+
@param {string} left
|
|
1562
|
+
@param {string} right
|
|
1563
|
+
@param {number} reps
|
|
1564
|
+
@param {boolean} isSubpattern
|
|
1565
|
+
@param {Array<number>} hiddenCaptures
|
|
1566
|
+
@param {Array<number>} addedHiddenCaptures
|
|
1567
|
+
@param {number} numCapturesPassed
|
|
1568
|
+
@returns {string}
|
|
1569
|
+
*/
|
|
1570
|
+
function makeRecursive(left, right, reps, isSubpattern, hiddenCaptures, addedHiddenCaptures, numCapturesPassed) {
|
|
1571
|
+
const namesInRecursed = /* @__PURE__ */ new Set();
|
|
1572
|
+
if (isSubpattern) forEachUnescaped(left + right, namedCaptureDelim, ({ groups: { captureName } }) => {
|
|
1573
|
+
namesInRecursed.add(captureName);
|
|
1574
|
+
}, Context.DEFAULT);
|
|
1575
|
+
const rest = [
|
|
1576
|
+
reps,
|
|
1577
|
+
isSubpattern ? namesInRecursed : null,
|
|
1578
|
+
hiddenCaptures,
|
|
1579
|
+
addedHiddenCaptures,
|
|
1580
|
+
numCapturesPassed
|
|
1581
|
+
];
|
|
1582
|
+
return `${left}${repeatWithDepth(`(?:${left}`, "forward", ...rest)}(?:)${repeatWithDepth(`${right})`, "backward", ...rest)}${right}`;
|
|
1583
|
+
}
|
|
1584
|
+
/**
|
|
1585
|
+
@param {string} pattern
|
|
1586
|
+
@param {'forward' | 'backward'} direction
|
|
1587
|
+
@param {number} reps
|
|
1588
|
+
@param {Set<string> | null} namesInRecursed
|
|
1589
|
+
@param {Array<number>} hiddenCaptures
|
|
1590
|
+
@param {Array<number>} addedHiddenCaptures
|
|
1591
|
+
@param {number} numCapturesPassed
|
|
1592
|
+
@returns {string}
|
|
1593
|
+
*/
|
|
1594
|
+
function repeatWithDepth(pattern, direction, reps, namesInRecursed, hiddenCaptures, addedHiddenCaptures, numCapturesPassed) {
|
|
1595
|
+
const startNum = 2;
|
|
1596
|
+
const getDepthNum = (i) => direction === "forward" ? i + startNum : reps - i + startNum - 1;
|
|
1597
|
+
let result = "";
|
|
1598
|
+
for (let i = 0; i < reps; i++) {
|
|
1599
|
+
const depthNum = getDepthNum(i);
|
|
1600
|
+
result += replaceUnescaped(pattern, r$1`${captureDelim}|\\k<(?<backref>[^>]+)>`, ({ 0: m, groups: { captureName, unnamed, backref } }) => {
|
|
1601
|
+
if (backref && namesInRecursed && !namesInRecursed.has(backref)) return m;
|
|
1602
|
+
const suffix = `_$${depthNum}`;
|
|
1603
|
+
if (unnamed || captureName) {
|
|
1604
|
+
const addedCaptureNum = numCapturesPassed + addedHiddenCaptures.length + 1;
|
|
1605
|
+
addedHiddenCaptures.push(addedCaptureNum);
|
|
1606
|
+
incrementIfAtLeast(hiddenCaptures, addedCaptureNum);
|
|
1607
|
+
return unnamed ? m : `(?<${captureName}${suffix}>`;
|
|
1608
|
+
}
|
|
1609
|
+
return r$1`\k<${backref}${suffix}>`;
|
|
1610
|
+
}, Context.DEFAULT);
|
|
1611
|
+
}
|
|
1612
|
+
return result;
|
|
1613
|
+
}
|
|
1614
|
+
/**
|
|
1615
|
+
Updates the array in place by incrementing each value greater than or equal to the threshold.
|
|
1616
|
+
@param {Array<number>} arr
|
|
1617
|
+
@param {number} threshold
|
|
1618
|
+
*/
|
|
1619
|
+
function incrementIfAtLeast(arr, threshold) {
|
|
1620
|
+
for (let i = 0; i < arr.length; i++) if (arr[i] >= threshold) arr[i]++;
|
|
1621
|
+
}
|
|
1622
|
+
/**
|
|
1623
|
+
@param {Map<number, Array<number>>} captureTransfers
|
|
1624
|
+
@param {string} left
|
|
1625
|
+
@param {number} reps
|
|
1626
|
+
@param {number} numCapturesAddedInExpansion
|
|
1627
|
+
@param {number} numAddedHiddenCapturesPreExpansion
|
|
1628
|
+
@param {number} numCapturesPassed
|
|
1629
|
+
@returns {Map<number, Array<number>>}
|
|
1630
|
+
*/
|
|
1631
|
+
function mapCaptureTransfers(captureTransfers, left, reps, numCapturesAddedInExpansion, numAddedHiddenCapturesPreExpansion, numCapturesPassed) {
|
|
1632
|
+
if (captureTransfers.size && numCapturesAddedInExpansion) {
|
|
1633
|
+
let numCapturesInLeft = 0;
|
|
1634
|
+
forEachUnescaped(left, captureDelim, () => numCapturesInLeft++, Context.DEFAULT);
|
|
1635
|
+
const recursionDelimCaptureNum = numCapturesPassed - numCapturesInLeft + numAddedHiddenCapturesPreExpansion;
|
|
1636
|
+
const newCaptureTransfers = /* @__PURE__ */ new Map();
|
|
1637
|
+
captureTransfers.forEach((from, to) => {
|
|
1638
|
+
const numCapturesInRight = (numCapturesAddedInExpansion - numCapturesInLeft * reps) / reps;
|
|
1639
|
+
const numCapturesAddedInLeft = numCapturesInLeft * reps;
|
|
1640
|
+
const newTo = to > recursionDelimCaptureNum + numCapturesInLeft ? to + numCapturesAddedInExpansion : to;
|
|
1641
|
+
const newFrom = [];
|
|
1642
|
+
for (const f of from) if (f <= recursionDelimCaptureNum) newFrom.push(f);
|
|
1643
|
+
else if (f > recursionDelimCaptureNum + numCapturesInLeft + numCapturesInRight) newFrom.push(f + numCapturesAddedInExpansion);
|
|
1644
|
+
else if (f <= recursionDelimCaptureNum + numCapturesInLeft) for (let i = 0; i <= reps; i++) newFrom.push(f + numCapturesInLeft * i);
|
|
1645
|
+
else for (let i = 0; i <= reps; i++) newFrom.push(f + numCapturesAddedInLeft + numCapturesInRight * i);
|
|
1646
|
+
newCaptureTransfers.set(newTo, newFrom);
|
|
1647
|
+
});
|
|
1648
|
+
return newCaptureTransfers;
|
|
1649
|
+
}
|
|
1650
|
+
return captureTransfers;
|
|
1651
|
+
}
|
|
1652
|
+
//#endregion
|
|
1653
|
+
//#region ../../node_modules/.pnpm/oniguruma-to-es@4.3.4/node_modules/oniguruma-to-es/dist/esm/index.js
|
|
1654
|
+
var cp = String.fromCodePoint;
|
|
1655
|
+
var r = String.raw;
|
|
1656
|
+
var envFlags = {
|
|
1657
|
+
flagGroups: (() => {
|
|
1658
|
+
return true;
|
|
1659
|
+
})(),
|
|
1660
|
+
unicodeSets: (() => {
|
|
1661
|
+
return true;
|
|
1662
|
+
})()
|
|
1663
|
+
};
|
|
1664
|
+
envFlags.bugFlagVLiteralHyphenIsRange = envFlags.unicodeSets ? (() => {
|
|
1665
|
+
try {
|
|
1666
|
+
new RegExp(r`[\d\-a]`, "v");
|
|
1667
|
+
} catch {
|
|
1668
|
+
return true;
|
|
1669
|
+
}
|
|
1670
|
+
return false;
|
|
1671
|
+
})() : false;
|
|
1672
|
+
envFlags.bugNestedClassIgnoresNegation = envFlags.unicodeSets && (/* @__PURE__ */ new RegExp("[[^a]]", "v")).test("a");
|
|
1673
|
+
function getNewCurrentFlags(current, { enable, disable }) {
|
|
1674
|
+
return {
|
|
1675
|
+
dotAll: !disable?.dotAll && !!(enable?.dotAll || current.dotAll),
|
|
1676
|
+
ignoreCase: !disable?.ignoreCase && !!(enable?.ignoreCase || current.ignoreCase)
|
|
1677
|
+
};
|
|
1678
|
+
}
|
|
1679
|
+
function getOrInsert(map, key, defaultValue) {
|
|
1680
|
+
if (!map.has(key)) map.set(key, defaultValue);
|
|
1681
|
+
return map.get(key);
|
|
1682
|
+
}
|
|
1683
|
+
function isMinTarget(target, min) {
|
|
1684
|
+
return EsVersion[target] >= EsVersion[min];
|
|
1685
|
+
}
|
|
1686
|
+
function throwIfNullish(value, msg) {
|
|
1687
|
+
if (value == null) throw new Error(msg ?? "Value expected");
|
|
1688
|
+
return value;
|
|
1689
|
+
}
|
|
1690
|
+
var EsVersion = {
|
|
1691
|
+
ES2025: 2025,
|
|
1692
|
+
ES2024: 2024,
|
|
1693
|
+
ES2018: 2018
|
|
1694
|
+
};
|
|
1695
|
+
var Target = (
|
|
1696
|
+
/** @type {const} */
|
|
1697
|
+
{
|
|
1698
|
+
auto: "auto",
|
|
1699
|
+
ES2025: "ES2025",
|
|
1700
|
+
ES2024: "ES2024",
|
|
1701
|
+
ES2018: "ES2018"
|
|
1702
|
+
});
|
|
1703
|
+
function getOptions(options = {}) {
|
|
1704
|
+
if ({}.toString.call(options) !== "[object Object]") throw new Error("Unexpected options");
|
|
1705
|
+
if (options.target !== void 0 && !Target[options.target]) throw new Error(`Unexpected target "${options.target}"`);
|
|
1706
|
+
const opts = {
|
|
1707
|
+
accuracy: "default",
|
|
1708
|
+
avoidSubclass: false,
|
|
1709
|
+
flags: "",
|
|
1710
|
+
global: false,
|
|
1711
|
+
hasIndices: false,
|
|
1712
|
+
lazyCompileLength: Infinity,
|
|
1713
|
+
target: "auto",
|
|
1714
|
+
verbose: false,
|
|
1715
|
+
...options,
|
|
1716
|
+
rules: {
|
|
1717
|
+
allowOrphanBackrefs: false,
|
|
1718
|
+
asciiWordBoundaries: false,
|
|
1719
|
+
captureGroup: false,
|
|
1720
|
+
recursionLimit: 20,
|
|
1721
|
+
singleline: false,
|
|
1722
|
+
...options.rules
|
|
1723
|
+
}
|
|
1724
|
+
};
|
|
1725
|
+
if (opts.target === "auto") opts.target = envFlags.flagGroups ? "ES2025" : envFlags.unicodeSets ? "ES2024" : "ES2018";
|
|
1726
|
+
return opts;
|
|
1727
|
+
}
|
|
1728
|
+
var asciiSpaceChar = "[ -\r ]";
|
|
1729
|
+
var CharsWithoutIgnoreCaseExpansion = /* @__PURE__ */ new Set([cp(304), cp(305)]);
|
|
1730
|
+
var defaultWordChar = r`[\p{L}\p{M}\p{N}\p{Pc}]`;
|
|
1731
|
+
function getIgnoreCaseMatchChars(char) {
|
|
1732
|
+
if (CharsWithoutIgnoreCaseExpansion.has(char)) return [char];
|
|
1733
|
+
const set = /* @__PURE__ */ new Set();
|
|
1734
|
+
const lower = char.toLowerCase();
|
|
1735
|
+
const upper = lower.toUpperCase();
|
|
1736
|
+
const title = LowerToTitleCaseMap.get(lower);
|
|
1737
|
+
const altLower = LowerToAlternativeLowerCaseMap.get(lower);
|
|
1738
|
+
const altUpper = LowerToAlternativeUpperCaseMap.get(lower);
|
|
1739
|
+
if ([...upper].length === 1) set.add(upper);
|
|
1740
|
+
altUpper && set.add(altUpper);
|
|
1741
|
+
title && set.add(title);
|
|
1742
|
+
set.add(lower);
|
|
1743
|
+
altLower && set.add(altLower);
|
|
1744
|
+
return [...set];
|
|
1745
|
+
}
|
|
1746
|
+
var JsUnicodePropertyMap = /* @__PURE__ */ new Map(`C Other
|
|
1747
|
+
Cc Control cntrl
|
|
1748
|
+
Cf Format
|
|
1749
|
+
Cn Unassigned
|
|
1750
|
+
Co Private_Use
|
|
1751
|
+
Cs Surrogate
|
|
1752
|
+
L Letter
|
|
1753
|
+
LC Cased_Letter
|
|
1754
|
+
Ll Lowercase_Letter
|
|
1755
|
+
Lm Modifier_Letter
|
|
1756
|
+
Lo Other_Letter
|
|
1757
|
+
Lt Titlecase_Letter
|
|
1758
|
+
Lu Uppercase_Letter
|
|
1759
|
+
M Mark Combining_Mark
|
|
1760
|
+
Mc Spacing_Mark
|
|
1761
|
+
Me Enclosing_Mark
|
|
1762
|
+
Mn Nonspacing_Mark
|
|
1763
|
+
N Number
|
|
1764
|
+
Nd Decimal_Number digit
|
|
1765
|
+
Nl Letter_Number
|
|
1766
|
+
No Other_Number
|
|
1767
|
+
P Punctuation punct
|
|
1768
|
+
Pc Connector_Punctuation
|
|
1769
|
+
Pd Dash_Punctuation
|
|
1770
|
+
Pe Close_Punctuation
|
|
1771
|
+
Pf Final_Punctuation
|
|
1772
|
+
Pi Initial_Punctuation
|
|
1773
|
+
Po Other_Punctuation
|
|
1774
|
+
Ps Open_Punctuation
|
|
1775
|
+
S Symbol
|
|
1776
|
+
Sc Currency_Symbol
|
|
1777
|
+
Sk Modifier_Symbol
|
|
1778
|
+
Sm Math_Symbol
|
|
1779
|
+
So Other_Symbol
|
|
1780
|
+
Z Separator
|
|
1781
|
+
Zl Line_Separator
|
|
1782
|
+
Zp Paragraph_Separator
|
|
1783
|
+
Zs Space_Separator
|
|
1784
|
+
ASCII
|
|
1785
|
+
ASCII_Hex_Digit AHex
|
|
1786
|
+
Alphabetic Alpha
|
|
1787
|
+
Any
|
|
1788
|
+
Assigned
|
|
1789
|
+
Bidi_Control Bidi_C
|
|
1790
|
+
Bidi_Mirrored Bidi_M
|
|
1791
|
+
Case_Ignorable CI
|
|
1792
|
+
Cased
|
|
1793
|
+
Changes_When_Casefolded CWCF
|
|
1794
|
+
Changes_When_Casemapped CWCM
|
|
1795
|
+
Changes_When_Lowercased CWL
|
|
1796
|
+
Changes_When_NFKC_Casefolded CWKCF
|
|
1797
|
+
Changes_When_Titlecased CWT
|
|
1798
|
+
Changes_When_Uppercased CWU
|
|
1799
|
+
Dash
|
|
1800
|
+
Default_Ignorable_Code_Point DI
|
|
1801
|
+
Deprecated Dep
|
|
1802
|
+
Diacritic Dia
|
|
1803
|
+
Emoji
|
|
1804
|
+
Emoji_Component EComp
|
|
1805
|
+
Emoji_Modifier EMod
|
|
1806
|
+
Emoji_Modifier_Base EBase
|
|
1807
|
+
Emoji_Presentation EPres
|
|
1808
|
+
Extended_Pictographic ExtPict
|
|
1809
|
+
Extender Ext
|
|
1810
|
+
Grapheme_Base Gr_Base
|
|
1811
|
+
Grapheme_Extend Gr_Ext
|
|
1812
|
+
Hex_Digit Hex
|
|
1813
|
+
IDS_Binary_Operator IDSB
|
|
1814
|
+
IDS_Trinary_Operator IDST
|
|
1815
|
+
ID_Continue IDC
|
|
1816
|
+
ID_Start IDS
|
|
1817
|
+
Ideographic Ideo
|
|
1818
|
+
Join_Control Join_C
|
|
1819
|
+
Logical_Order_Exception LOE
|
|
1820
|
+
Lowercase Lower
|
|
1821
|
+
Math
|
|
1822
|
+
Noncharacter_Code_Point NChar
|
|
1823
|
+
Pattern_Syntax Pat_Syn
|
|
1824
|
+
Pattern_White_Space Pat_WS
|
|
1825
|
+
Quotation_Mark QMark
|
|
1826
|
+
Radical
|
|
1827
|
+
Regional_Indicator RI
|
|
1828
|
+
Sentence_Terminal STerm
|
|
1829
|
+
Soft_Dotted SD
|
|
1830
|
+
Terminal_Punctuation Term
|
|
1831
|
+
Unified_Ideograph UIdeo
|
|
1832
|
+
Uppercase Upper
|
|
1833
|
+
Variation_Selector VS
|
|
1834
|
+
White_Space space
|
|
1835
|
+
XID_Continue XIDC
|
|
1836
|
+
XID_Start XIDS`.split(/\s/).map((p) => [w(p), p]));
|
|
1837
|
+
var LowerToAlternativeLowerCaseMap = /* @__PURE__ */ new Map([["s", cp(383)], [cp(383), "s"]]);
|
|
1838
|
+
var LowerToAlternativeUpperCaseMap = /* @__PURE__ */ new Map([
|
|
1839
|
+
[cp(223), cp(7838)],
|
|
1840
|
+
[cp(107), cp(8490)],
|
|
1841
|
+
[cp(229), cp(8491)],
|
|
1842
|
+
[cp(969), cp(8486)]
|
|
1843
|
+
]);
|
|
1844
|
+
var LowerToTitleCaseMap = new Map([
|
|
1845
|
+
titleEntry(453),
|
|
1846
|
+
titleEntry(456),
|
|
1847
|
+
titleEntry(459),
|
|
1848
|
+
titleEntry(498),
|
|
1849
|
+
...titleRange(8072, 8079),
|
|
1850
|
+
...titleRange(8088, 8095),
|
|
1851
|
+
...titleRange(8104, 8111),
|
|
1852
|
+
titleEntry(8124),
|
|
1853
|
+
titleEntry(8140),
|
|
1854
|
+
titleEntry(8188)
|
|
1855
|
+
]);
|
|
1856
|
+
var PosixClassMap = /* @__PURE__ */ new Map([
|
|
1857
|
+
["alnum", r`[\p{Alpha}\p{Nd}]`],
|
|
1858
|
+
["alpha", r`\p{Alpha}`],
|
|
1859
|
+
["ascii", r`\p{ASCII}`],
|
|
1860
|
+
["blank", r`[\p{Zs}\t]`],
|
|
1861
|
+
["cntrl", r`\p{Cc}`],
|
|
1862
|
+
["digit", r`\p{Nd}`],
|
|
1863
|
+
["graph", r`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],
|
|
1864
|
+
["lower", r`\p{Lower}`],
|
|
1865
|
+
["print", r`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],
|
|
1866
|
+
["punct", r`[\p{P}\p{S}]`],
|
|
1867
|
+
["space", r`\p{space}`],
|
|
1868
|
+
["upper", r`\p{Upper}`],
|
|
1869
|
+
["word", r`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],
|
|
1870
|
+
["xdigit", r`\p{AHex}`]
|
|
1871
|
+
]);
|
|
1872
|
+
function range(start, end) {
|
|
1873
|
+
const range2 = [];
|
|
1874
|
+
for (let i = start; i <= end; i++) range2.push(i);
|
|
1875
|
+
return range2;
|
|
1876
|
+
}
|
|
1877
|
+
function titleEntry(codePoint) {
|
|
1878
|
+
const char = cp(codePoint);
|
|
1879
|
+
return [char.toLowerCase(), char];
|
|
1880
|
+
}
|
|
1881
|
+
function titleRange(start, end) {
|
|
1882
|
+
return range(start, end).map((codePoint) => titleEntry(codePoint));
|
|
1883
|
+
}
|
|
1884
|
+
var UnicodePropertiesWithSpecificCase = /* @__PURE__ */ new Set([
|
|
1885
|
+
"Lower",
|
|
1886
|
+
"Lowercase",
|
|
1887
|
+
"Upper",
|
|
1888
|
+
"Uppercase",
|
|
1889
|
+
"Ll",
|
|
1890
|
+
"Lowercase_Letter",
|
|
1891
|
+
"Lt",
|
|
1892
|
+
"Titlecase_Letter",
|
|
1893
|
+
"Lu",
|
|
1894
|
+
"Uppercase_Letter"
|
|
1895
|
+
]);
|
|
1896
|
+
function transform(ast, options) {
|
|
1897
|
+
const opts = {
|
|
1898
|
+
accuracy: "default",
|
|
1899
|
+
asciiWordBoundaries: false,
|
|
1900
|
+
avoidSubclass: false,
|
|
1901
|
+
bestEffortTarget: "ES2025",
|
|
1902
|
+
...options
|
|
1903
|
+
};
|
|
1904
|
+
addParentProperties(ast);
|
|
1905
|
+
const firstPassState = {
|
|
1906
|
+
accuracy: opts.accuracy,
|
|
1907
|
+
asciiWordBoundaries: opts.asciiWordBoundaries,
|
|
1908
|
+
avoidSubclass: opts.avoidSubclass,
|
|
1909
|
+
flagDirectivesByAlt: /* @__PURE__ */ new Map(),
|
|
1910
|
+
jsGroupNameMap: /* @__PURE__ */ new Map(),
|
|
1911
|
+
minTargetEs2024: isMinTarget(opts.bestEffortTarget, "ES2024"),
|
|
1912
|
+
passedLookbehind: false,
|
|
1913
|
+
strategy: null,
|
|
1914
|
+
subroutineRefMap: /* @__PURE__ */ new Map(),
|
|
1915
|
+
supportedGNodes: /* @__PURE__ */ new Set(),
|
|
1916
|
+
digitIsAscii: ast.flags.digitIsAscii,
|
|
1917
|
+
spaceIsAscii: ast.flags.spaceIsAscii,
|
|
1918
|
+
wordIsAscii: ast.flags.wordIsAscii
|
|
1919
|
+
};
|
|
1920
|
+
S(ast, FirstPassVisitor, firstPassState);
|
|
1921
|
+
const globalFlags = {
|
|
1922
|
+
dotAll: ast.flags.dotAll,
|
|
1923
|
+
ignoreCase: ast.flags.ignoreCase
|
|
1924
|
+
};
|
|
1925
|
+
const secondPassState = {
|
|
1926
|
+
currentFlags: globalFlags,
|
|
1927
|
+
prevFlags: null,
|
|
1928
|
+
globalFlags,
|
|
1929
|
+
groupOriginByCopy: /* @__PURE__ */ new Map(),
|
|
1930
|
+
groupsByName: /* @__PURE__ */ new Map(),
|
|
1931
|
+
multiplexCapturesToLeftByRef: /* @__PURE__ */ new Map(),
|
|
1932
|
+
openRefs: /* @__PURE__ */ new Map(),
|
|
1933
|
+
reffedNodesByReferencer: /* @__PURE__ */ new Map(),
|
|
1934
|
+
subroutineRefMap: firstPassState.subroutineRefMap
|
|
1935
|
+
};
|
|
1936
|
+
S(ast, SecondPassVisitor, secondPassState);
|
|
1937
|
+
S(ast, ThirdPassVisitor, {
|
|
1938
|
+
groupsByName: secondPassState.groupsByName,
|
|
1939
|
+
highestOrphanBackref: 0,
|
|
1940
|
+
numCapturesToLeft: 0,
|
|
1941
|
+
reffedNodesByReferencer: secondPassState.reffedNodesByReferencer
|
|
1942
|
+
});
|
|
1943
|
+
ast._originMap = secondPassState.groupOriginByCopy;
|
|
1944
|
+
ast._strategy = firstPassState.strategy;
|
|
1945
|
+
return ast;
|
|
1946
|
+
}
|
|
1947
|
+
var FirstPassVisitor = {
|
|
1948
|
+
AbsenceFunction({ node, parent, replaceWith }) {
|
|
1949
|
+
const { body, kind } = node;
|
|
1950
|
+
if (kind === "repeater") {
|
|
1951
|
+
const innerGroup = A();
|
|
1952
|
+
innerGroup.body[0].body.push(K({
|
|
1953
|
+
negate: true,
|
|
1954
|
+
body
|
|
1955
|
+
}), Q("Any"));
|
|
1956
|
+
const outerGroup = A();
|
|
1957
|
+
outerGroup.body[0].body.push(_("greedy", 0, Infinity, innerGroup));
|
|
1958
|
+
replaceWith(setParentDeep(outerGroup, parent), { traverse: true });
|
|
1959
|
+
} else throw new Error(`Unsupported absence function "(?~|"`);
|
|
1960
|
+
},
|
|
1961
|
+
Alternative: {
|
|
1962
|
+
enter({ node, parent, key }, { flagDirectivesByAlt }) {
|
|
1963
|
+
const flagDirectives = node.body.filter((el) => el.kind === "flags");
|
|
1964
|
+
for (let i = key + 1; i < parent.body.length; i++) {
|
|
1965
|
+
const forwardSiblingAlt = parent.body[i];
|
|
1966
|
+
getOrInsert(flagDirectivesByAlt, forwardSiblingAlt, []).push(...flagDirectives);
|
|
1967
|
+
}
|
|
1968
|
+
},
|
|
1969
|
+
exit({ node }, { flagDirectivesByAlt }) {
|
|
1970
|
+
if (flagDirectivesByAlt.get(node)?.length) {
|
|
1971
|
+
const flags = getCombinedFlagModsFromFlagNodes(flagDirectivesByAlt.get(node));
|
|
1972
|
+
if (flags) {
|
|
1973
|
+
const flagGroup = A({ flags });
|
|
1974
|
+
flagGroup.body[0].body = node.body;
|
|
1975
|
+
node.body = [setParentDeep(flagGroup, node)];
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
}
|
|
1979
|
+
},
|
|
1980
|
+
Assertion({ node, parent, key, container, root, remove, replaceWith }, state) {
|
|
1981
|
+
const { kind, negate } = node;
|
|
1982
|
+
const { asciiWordBoundaries, avoidSubclass, supportedGNodes, wordIsAscii } = state;
|
|
1983
|
+
if (kind === "text_segment_boundary") throw new Error(`Unsupported text segment boundary "\\${negate ? "Y" : "y"}"`);
|
|
1984
|
+
else if (kind === "line_end") replaceWith(setParentDeep(K({ body: [b({ body: [F("string_end")] }), b({ body: [m(10)] })] }), parent));
|
|
1985
|
+
else if (kind === "line_start") replaceWith(setParentDeep(parseFragment(r`(?<=\A|\n(?!\z))`, { skipLookbehindValidation: true }), parent));
|
|
1986
|
+
else if (kind === "search_start") if (supportedGNodes.has(node)) {
|
|
1987
|
+
root.flags.sticky = true;
|
|
1988
|
+
remove();
|
|
1989
|
+
} else {
|
|
1990
|
+
const prev = container[key - 1];
|
|
1991
|
+
if (prev && isAlwaysNonZeroLength(prev)) replaceWith(setParentDeep(K({ negate: true }), parent));
|
|
1992
|
+
else if (avoidSubclass) throw new Error(r`Uses "\G" in a way that requires a subclass`);
|
|
1993
|
+
else {
|
|
1994
|
+
replaceWith(setParent(F("string_start"), parent));
|
|
1995
|
+
state.strategy = "clip_search";
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
else if (kind === "string_end" || kind === "string_start") {} else if (kind === "string_end_newline") replaceWith(setParentDeep(parseFragment(r`(?=\n?\z)`), parent));
|
|
1999
|
+
else if (kind === "word_boundary") {
|
|
2000
|
+
if (!wordIsAscii && !asciiWordBoundaries) {
|
|
2001
|
+
const b = `(?:(?<=${defaultWordChar})(?!${defaultWordChar})|(?<!${defaultWordChar})(?=${defaultWordChar}))`;
|
|
2002
|
+
const B = `(?:(?<=${defaultWordChar})(?=${defaultWordChar})|(?<!${defaultWordChar})(?!${defaultWordChar}))`;
|
|
2003
|
+
replaceWith(setParentDeep(parseFragment(negate ? B : b), parent));
|
|
2004
|
+
}
|
|
2005
|
+
} else throw new Error(`Unexpected assertion kind "${kind}"`);
|
|
2006
|
+
},
|
|
2007
|
+
Backreference({ node }, { jsGroupNameMap }) {
|
|
2008
|
+
let { ref } = node;
|
|
2009
|
+
if (typeof ref === "string" && !isValidJsGroupName(ref)) {
|
|
2010
|
+
ref = getAndStoreJsGroupName(ref, jsGroupNameMap);
|
|
2011
|
+
node.ref = ref;
|
|
2012
|
+
}
|
|
2013
|
+
},
|
|
2014
|
+
CapturingGroup({ node }, { jsGroupNameMap, subroutineRefMap }) {
|
|
2015
|
+
let { name } = node;
|
|
2016
|
+
if (name && !isValidJsGroupName(name)) {
|
|
2017
|
+
name = getAndStoreJsGroupName(name, jsGroupNameMap);
|
|
2018
|
+
node.name = name;
|
|
2019
|
+
}
|
|
2020
|
+
subroutineRefMap.set(node.number, node);
|
|
2021
|
+
if (name) subroutineRefMap.set(name, node);
|
|
2022
|
+
},
|
|
2023
|
+
CharacterClassRange({ node, parent, replaceWith }) {
|
|
2024
|
+
if (parent.kind === "intersection") replaceWith(setParentDeep(C({ body: [node] }), parent), { traverse: true });
|
|
2025
|
+
},
|
|
2026
|
+
CharacterSet({ node, parent, replaceWith }, { accuracy, minTargetEs2024, digitIsAscii, spaceIsAscii, wordIsAscii }) {
|
|
2027
|
+
const { kind, negate, value } = node;
|
|
2028
|
+
if (digitIsAscii && (kind === "digit" || value === "digit")) {
|
|
2029
|
+
replaceWith(setParent(E("digit", { negate }), parent));
|
|
2030
|
+
return;
|
|
2031
|
+
}
|
|
2032
|
+
if (spaceIsAscii && (kind === "space" || value === "space")) {
|
|
2033
|
+
replaceWith(setParentDeep(setNegate(parseFragment(asciiSpaceChar), negate), parent));
|
|
2034
|
+
return;
|
|
2035
|
+
}
|
|
2036
|
+
if (wordIsAscii && (kind === "word" || value === "word")) {
|
|
2037
|
+
replaceWith(setParent(E("word", { negate }), parent));
|
|
2038
|
+
return;
|
|
2039
|
+
}
|
|
2040
|
+
if (kind === "any") replaceWith(setParent(Q("Any"), parent));
|
|
2041
|
+
else if (kind === "digit") replaceWith(setParent(Q("Nd", { negate }), parent));
|
|
2042
|
+
else if (kind === "dot") {} else if (kind === "text_segment") {
|
|
2043
|
+
if (accuracy === "strict") throw new Error(r`Use of "\X" requires non-strict accuracy`);
|
|
2044
|
+
const eBase = "\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?";
|
|
2045
|
+
const emoji = r`\p{RI}{2}|${eBase}(?:\u200D${eBase})*`;
|
|
2046
|
+
replaceWith(setParentDeep(parseFragment(r`(?>\r\n|${minTargetEs2024 ? r`\p{RGI_Emoji}` : emoji}|\P{M}\p{M}*)`, { skipPropertyNameValidation: true }), parent));
|
|
2047
|
+
} else if (kind === "hex") replaceWith(setParent(Q("AHex", { negate }), parent));
|
|
2048
|
+
else if (kind === "newline") replaceWith(setParentDeep(parseFragment(negate ? "[^\n]" : "(?>\r\n?|[\n\v\f
\u2028\u2029])"), parent));
|
|
2049
|
+
else if (kind === "posix") if (!minTargetEs2024 && (value === "graph" || value === "print")) {
|
|
2050
|
+
if (accuracy === "strict") throw new Error(`POSIX class "${value}" requires min target ES2024 or non-strict accuracy`);
|
|
2051
|
+
let ascii = {
|
|
2052
|
+
graph: "!-~",
|
|
2053
|
+
print: " -~"
|
|
2054
|
+
}[value];
|
|
2055
|
+
if (negate) ascii = `\0-${cp(ascii.codePointAt(0) - 1)}${cp(ascii.codePointAt(2) + 1)}-\u{10FFFF}`;
|
|
2056
|
+
replaceWith(setParentDeep(parseFragment(`[${ascii}]`), parent));
|
|
2057
|
+
} else replaceWith(setParentDeep(setNegate(parseFragment(PosixClassMap.get(value)), negate), parent));
|
|
2058
|
+
else if (kind === "property") {
|
|
2059
|
+
if (!JsUnicodePropertyMap.has(w(value))) node.key = "sc";
|
|
2060
|
+
} else if (kind === "space") replaceWith(setParent(Q("space", { negate }), parent));
|
|
2061
|
+
else if (kind === "word") replaceWith(setParentDeep(setNegate(parseFragment(defaultWordChar), negate), parent));
|
|
2062
|
+
else throw new Error(`Unexpected character set kind "${kind}"`);
|
|
2063
|
+
},
|
|
2064
|
+
Directive({ node, parent, root, remove, replaceWith, removeAllPrevSiblings, removeAllNextSiblings }) {
|
|
2065
|
+
const { kind, flags } = node;
|
|
2066
|
+
if (kind === "flags") if (!flags.enable && !flags.disable) remove();
|
|
2067
|
+
else {
|
|
2068
|
+
const flagGroup = A({ flags });
|
|
2069
|
+
flagGroup.body[0].body = removeAllNextSiblings();
|
|
2070
|
+
replaceWith(setParentDeep(flagGroup, parent), { traverse: true });
|
|
2071
|
+
}
|
|
2072
|
+
else if (kind === "keep") {
|
|
2073
|
+
const firstAlt = root.body[0];
|
|
2074
|
+
const topLevel = root.body.length === 1 && o(firstAlt, { type: "Group" }) && firstAlt.body[0].body.length === 1 ? firstAlt.body[0] : root;
|
|
2075
|
+
if (parent.parent !== topLevel || topLevel.body.length > 1) throw new Error(r`Uses "\K" in a way that's unsupported`);
|
|
2076
|
+
const lookbehind = K({ behind: true });
|
|
2077
|
+
lookbehind.body[0].body = removeAllPrevSiblings();
|
|
2078
|
+
replaceWith(setParentDeep(lookbehind, parent));
|
|
2079
|
+
} else throw new Error(`Unexpected directive kind "${kind}"`);
|
|
2080
|
+
},
|
|
2081
|
+
Flags({ node, parent }) {
|
|
2082
|
+
if (node.posixIsAscii) throw new Error("Unsupported flag \"P\"");
|
|
2083
|
+
if (node.textSegmentMode === "word") throw new Error("Unsupported flag \"y{w}\"");
|
|
2084
|
+
[
|
|
2085
|
+
"digitIsAscii",
|
|
2086
|
+
"extended",
|
|
2087
|
+
"posixIsAscii",
|
|
2088
|
+
"spaceIsAscii",
|
|
2089
|
+
"wordIsAscii",
|
|
2090
|
+
"textSegmentMode"
|
|
2091
|
+
].forEach((f) => delete node[f]);
|
|
2092
|
+
Object.assign(node, {
|
|
2093
|
+
global: false,
|
|
2094
|
+
hasIndices: false,
|
|
2095
|
+
multiline: false,
|
|
2096
|
+
sticky: node.sticky ?? false
|
|
2097
|
+
});
|
|
2098
|
+
parent.options = {
|
|
2099
|
+
disable: {
|
|
2100
|
+
x: true,
|
|
2101
|
+
n: true
|
|
2102
|
+
},
|
|
2103
|
+
force: { v: true }
|
|
2104
|
+
};
|
|
2105
|
+
},
|
|
2106
|
+
Group({ node }) {
|
|
2107
|
+
if (!node.flags) return;
|
|
2108
|
+
const { enable, disable } = node.flags;
|
|
2109
|
+
enable?.extended && delete enable.extended;
|
|
2110
|
+
disable?.extended && delete disable.extended;
|
|
2111
|
+
enable?.dotAll && disable?.dotAll && delete enable.dotAll;
|
|
2112
|
+
enable?.ignoreCase && disable?.ignoreCase && delete enable.ignoreCase;
|
|
2113
|
+
enable && !Object.keys(enable).length && delete node.flags.enable;
|
|
2114
|
+
disable && !Object.keys(disable).length && delete node.flags.disable;
|
|
2115
|
+
!node.flags.enable && !node.flags.disable && delete node.flags;
|
|
2116
|
+
},
|
|
2117
|
+
LookaroundAssertion({ node }, state) {
|
|
2118
|
+
const { kind } = node;
|
|
2119
|
+
if (kind === "lookbehind") state.passedLookbehind = true;
|
|
2120
|
+
},
|
|
2121
|
+
NamedCallout({ node, parent, replaceWith }) {
|
|
2122
|
+
const { kind } = node;
|
|
2123
|
+
if (kind === "fail") replaceWith(setParentDeep(K({ negate: true }), parent));
|
|
2124
|
+
else throw new Error(`Unsupported named callout "(*${kind.toUpperCase()}"`);
|
|
2125
|
+
},
|
|
2126
|
+
Quantifier({ node }) {
|
|
2127
|
+
if (node.body.type === "Quantifier") {
|
|
2128
|
+
const group = A();
|
|
2129
|
+
group.body[0].body.push(node.body);
|
|
2130
|
+
node.body = setParentDeep(group, node);
|
|
2131
|
+
}
|
|
2132
|
+
},
|
|
2133
|
+
Regex: {
|
|
2134
|
+
enter({ node }, { supportedGNodes }) {
|
|
2135
|
+
const leadingGs = [];
|
|
2136
|
+
let hasAltWithLeadG = false;
|
|
2137
|
+
let hasAltWithoutLeadG = false;
|
|
2138
|
+
for (const alt of node.body) if (alt.body.length === 1 && alt.body[0].kind === "search_start") alt.body.pop();
|
|
2139
|
+
else {
|
|
2140
|
+
const leadingG = getLeadingG(alt.body);
|
|
2141
|
+
if (leadingG) {
|
|
2142
|
+
hasAltWithLeadG = true;
|
|
2143
|
+
Array.isArray(leadingG) ? leadingGs.push(...leadingG) : leadingGs.push(leadingG);
|
|
2144
|
+
} else hasAltWithoutLeadG = true;
|
|
2145
|
+
}
|
|
2146
|
+
if (hasAltWithLeadG && !hasAltWithoutLeadG) leadingGs.forEach((g) => supportedGNodes.add(g));
|
|
2147
|
+
},
|
|
2148
|
+
exit(_, { accuracy, passedLookbehind, strategy }) {
|
|
2149
|
+
if (accuracy === "strict" && passedLookbehind && strategy) throw new Error(r`Uses "\G" in a way that requires non-strict accuracy`);
|
|
2150
|
+
}
|
|
2151
|
+
},
|
|
2152
|
+
Subroutine({ node }, { jsGroupNameMap }) {
|
|
2153
|
+
let { ref } = node;
|
|
2154
|
+
if (typeof ref === "string" && !isValidJsGroupName(ref)) {
|
|
2155
|
+
ref = getAndStoreJsGroupName(ref, jsGroupNameMap);
|
|
2156
|
+
node.ref = ref;
|
|
2157
|
+
}
|
|
2158
|
+
}
|
|
2159
|
+
};
|
|
2160
|
+
var SecondPassVisitor = {
|
|
2161
|
+
Backreference({ node }, { multiplexCapturesToLeftByRef, reffedNodesByReferencer }) {
|
|
2162
|
+
const { orphan, ref } = node;
|
|
2163
|
+
if (!orphan) reffedNodesByReferencer.set(node, [...multiplexCapturesToLeftByRef.get(ref).map(({ node: node2 }) => node2)]);
|
|
2164
|
+
},
|
|
2165
|
+
CapturingGroup: {
|
|
2166
|
+
enter({ node, parent, replaceWith, skip }, { groupOriginByCopy, groupsByName, multiplexCapturesToLeftByRef, openRefs, reffedNodesByReferencer }) {
|
|
2167
|
+
const origin = groupOriginByCopy.get(node);
|
|
2168
|
+
if (origin && openRefs.has(node.number)) {
|
|
2169
|
+
const recursion2 = setParent(createRecursion(node.number), parent);
|
|
2170
|
+
reffedNodesByReferencer.set(recursion2, openRefs.get(node.number));
|
|
2171
|
+
replaceWith(recursion2);
|
|
2172
|
+
return;
|
|
2173
|
+
}
|
|
2174
|
+
openRefs.set(node.number, node);
|
|
2175
|
+
multiplexCapturesToLeftByRef.set(node.number, []);
|
|
2176
|
+
if (node.name) getOrInsert(multiplexCapturesToLeftByRef, node.name, []);
|
|
2177
|
+
const multiplexNodes = multiplexCapturesToLeftByRef.get(node.name ?? node.number);
|
|
2178
|
+
for (let i = 0; i < multiplexNodes.length; i++) {
|
|
2179
|
+
const multiplex = multiplexNodes[i];
|
|
2180
|
+
if (origin === multiplex.node || origin && origin === multiplex.origin || node === multiplex.origin) {
|
|
2181
|
+
multiplexNodes.splice(i, 1);
|
|
2182
|
+
break;
|
|
2183
|
+
}
|
|
2184
|
+
}
|
|
2185
|
+
multiplexCapturesToLeftByRef.get(node.number).push({
|
|
2186
|
+
node,
|
|
2187
|
+
origin
|
|
2188
|
+
});
|
|
2189
|
+
if (node.name) multiplexCapturesToLeftByRef.get(node.name).push({
|
|
2190
|
+
node,
|
|
2191
|
+
origin
|
|
2192
|
+
});
|
|
2193
|
+
if (node.name) {
|
|
2194
|
+
const groupsWithSameName = getOrInsert(groupsByName, node.name, /* @__PURE__ */ new Map());
|
|
2195
|
+
let hasDuplicateNameToRemove = false;
|
|
2196
|
+
if (origin) hasDuplicateNameToRemove = true;
|
|
2197
|
+
else for (const groupInfo of groupsWithSameName.values()) if (!groupInfo.hasDuplicateNameToRemove) {
|
|
2198
|
+
hasDuplicateNameToRemove = true;
|
|
2199
|
+
break;
|
|
2200
|
+
}
|
|
2201
|
+
groupsByName.get(node.name).set(node, {
|
|
2202
|
+
node,
|
|
2203
|
+
hasDuplicateNameToRemove
|
|
2204
|
+
});
|
|
2205
|
+
}
|
|
2206
|
+
},
|
|
2207
|
+
exit({ node }, { openRefs }) {
|
|
2208
|
+
openRefs.delete(node.number);
|
|
2209
|
+
}
|
|
2210
|
+
},
|
|
2211
|
+
Group: {
|
|
2212
|
+
enter({ node }, state) {
|
|
2213
|
+
state.prevFlags = state.currentFlags;
|
|
2214
|
+
if (node.flags) state.currentFlags = getNewCurrentFlags(state.currentFlags, node.flags);
|
|
2215
|
+
},
|
|
2216
|
+
exit(_, state) {
|
|
2217
|
+
state.currentFlags = state.prevFlags;
|
|
2218
|
+
}
|
|
2219
|
+
},
|
|
2220
|
+
Subroutine({ node, parent, replaceWith }, state) {
|
|
2221
|
+
const { isRecursive, ref } = node;
|
|
2222
|
+
if (isRecursive) {
|
|
2223
|
+
let reffed = parent;
|
|
2224
|
+
while (reffed = reffed.parent) if (reffed.type === "CapturingGroup" && (reffed.name === ref || reffed.number === ref)) break;
|
|
2225
|
+
state.reffedNodesByReferencer.set(node, reffed);
|
|
2226
|
+
return;
|
|
2227
|
+
}
|
|
2228
|
+
const reffedGroupNode = state.subroutineRefMap.get(ref);
|
|
2229
|
+
const isGlobalRecursion = ref === 0;
|
|
2230
|
+
const expandedSubroutine = isGlobalRecursion ? createRecursion(0) : cloneCapturingGroup(reffedGroupNode, state.groupOriginByCopy, null);
|
|
2231
|
+
let replacement = expandedSubroutine;
|
|
2232
|
+
if (!isGlobalRecursion) {
|
|
2233
|
+
const reffedGroupFlagMods = getCombinedFlagModsFromFlagNodes(getAllParents(reffedGroupNode, (p) => p.type === "Group" && !!p.flags));
|
|
2234
|
+
const reffedGroupFlags = reffedGroupFlagMods ? getNewCurrentFlags(state.globalFlags, reffedGroupFlagMods) : state.globalFlags;
|
|
2235
|
+
if (!areFlagsEqual(reffedGroupFlags, state.currentFlags)) {
|
|
2236
|
+
replacement = A({ flags: getFlagModsFromFlags(reffedGroupFlags) });
|
|
2237
|
+
replacement.body[0].body.push(expandedSubroutine);
|
|
2238
|
+
}
|
|
2239
|
+
}
|
|
2240
|
+
replaceWith(setParentDeep(replacement, parent), { traverse: !isGlobalRecursion });
|
|
2241
|
+
}
|
|
2242
|
+
};
|
|
2243
|
+
var ThirdPassVisitor = {
|
|
2244
|
+
Backreference({ node, parent, replaceWith }, state) {
|
|
2245
|
+
if (node.orphan) {
|
|
2246
|
+
state.highestOrphanBackref = Math.max(state.highestOrphanBackref, node.ref);
|
|
2247
|
+
return;
|
|
2248
|
+
}
|
|
2249
|
+
const participants = state.reffedNodesByReferencer.get(node).filter((reffed) => canParticipateWithNode(reffed, node));
|
|
2250
|
+
if (!participants.length) replaceWith(setParentDeep(K({ negate: true }), parent));
|
|
2251
|
+
else if (participants.length > 1) replaceWith(setParentDeep(A({
|
|
2252
|
+
atomic: true,
|
|
2253
|
+
body: participants.reverse().map((reffed) => b({ body: [k(reffed.number)] }))
|
|
2254
|
+
}), parent));
|
|
2255
|
+
else node.ref = participants[0].number;
|
|
2256
|
+
},
|
|
2257
|
+
CapturingGroup({ node }, state) {
|
|
2258
|
+
node.number = ++state.numCapturesToLeft;
|
|
2259
|
+
if (node.name) {
|
|
2260
|
+
if (state.groupsByName.get(node.name).get(node).hasDuplicateNameToRemove) delete node.name;
|
|
2261
|
+
}
|
|
2262
|
+
},
|
|
2263
|
+
Regex: { exit({ node }, state) {
|
|
2264
|
+
const numCapsNeeded = Math.max(state.highestOrphanBackref - state.numCapturesToLeft, 0);
|
|
2265
|
+
for (let i = 0; i < numCapsNeeded; i++) {
|
|
2266
|
+
const emptyCapture = P();
|
|
2267
|
+
node.body.at(-1).body.push(emptyCapture);
|
|
2268
|
+
}
|
|
2269
|
+
} },
|
|
2270
|
+
Subroutine({ node }, state) {
|
|
2271
|
+
if (!node.isRecursive || node.ref === 0) return;
|
|
2272
|
+
node.ref = state.reffedNodesByReferencer.get(node).number;
|
|
2273
|
+
}
|
|
2274
|
+
};
|
|
2275
|
+
function addParentProperties(root) {
|
|
2276
|
+
S(root, { "*"({ node, parent }) {
|
|
2277
|
+
node.parent = parent;
|
|
2278
|
+
} });
|
|
2279
|
+
}
|
|
2280
|
+
function areFlagsEqual(a, b) {
|
|
2281
|
+
return a.dotAll === b.dotAll && a.ignoreCase === b.ignoreCase;
|
|
2282
|
+
}
|
|
2283
|
+
function canParticipateWithNode(capture, node) {
|
|
2284
|
+
let rightmostPoint = node;
|
|
2285
|
+
do {
|
|
2286
|
+
if (rightmostPoint.type === "Regex") return false;
|
|
2287
|
+
if (rightmostPoint.type === "Alternative") continue;
|
|
2288
|
+
if (rightmostPoint === capture) return false;
|
|
2289
|
+
const kidsOfParent = getKids(rightmostPoint.parent);
|
|
2290
|
+
for (const kid of kidsOfParent) {
|
|
2291
|
+
if (kid === rightmostPoint) break;
|
|
2292
|
+
if (kid === capture || isAncestorOf(kid, capture)) return true;
|
|
2293
|
+
}
|
|
2294
|
+
} while (rightmostPoint = rightmostPoint.parent);
|
|
2295
|
+
throw new Error("Unexpected path");
|
|
2296
|
+
}
|
|
2297
|
+
function cloneCapturingGroup(obj, originMap, up, up2) {
|
|
2298
|
+
const store = Array.isArray(obj) ? [] : {};
|
|
2299
|
+
for (const [key, value] of Object.entries(obj)) if (key === "parent") store.parent = Array.isArray(up) ? up2 : up;
|
|
2300
|
+
else if (value && typeof value === "object") store[key] = cloneCapturingGroup(value, originMap, store, up);
|
|
2301
|
+
else {
|
|
2302
|
+
if (key === "type" && value === "CapturingGroup") originMap.set(store, originMap.get(obj) ?? obj);
|
|
2303
|
+
store[key] = value;
|
|
2304
|
+
}
|
|
2305
|
+
return store;
|
|
2306
|
+
}
|
|
2307
|
+
function createRecursion(ref) {
|
|
2308
|
+
const node = O(ref);
|
|
2309
|
+
node.isRecursive = true;
|
|
2310
|
+
return node;
|
|
2311
|
+
}
|
|
2312
|
+
function getAllParents(node, filterFn) {
|
|
2313
|
+
const results = [];
|
|
2314
|
+
while (node = node.parent) if (!filterFn || filterFn(node)) results.push(node);
|
|
2315
|
+
return results;
|
|
2316
|
+
}
|
|
2317
|
+
function getAndStoreJsGroupName(name, map) {
|
|
2318
|
+
if (map.has(name)) return map.get(name);
|
|
2319
|
+
const jsName = `$${map.size}_${name.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu, "_")}`;
|
|
2320
|
+
map.set(name, jsName);
|
|
2321
|
+
return jsName;
|
|
2322
|
+
}
|
|
2323
|
+
function getCombinedFlagModsFromFlagNodes(flagNodes) {
|
|
2324
|
+
const flagProps = ["dotAll", "ignoreCase"];
|
|
2325
|
+
const combinedFlags = {
|
|
2326
|
+
enable: {},
|
|
2327
|
+
disable: {}
|
|
2328
|
+
};
|
|
2329
|
+
flagNodes.forEach(({ flags }) => {
|
|
2330
|
+
flagProps.forEach((prop) => {
|
|
2331
|
+
if (flags.enable?.[prop]) {
|
|
2332
|
+
delete combinedFlags.disable[prop];
|
|
2333
|
+
combinedFlags.enable[prop] = true;
|
|
2334
|
+
}
|
|
2335
|
+
if (flags.disable?.[prop]) combinedFlags.disable[prop] = true;
|
|
2336
|
+
});
|
|
2337
|
+
});
|
|
2338
|
+
if (!Object.keys(combinedFlags.enable).length) delete combinedFlags.enable;
|
|
2339
|
+
if (!Object.keys(combinedFlags.disable).length) delete combinedFlags.disable;
|
|
2340
|
+
if (combinedFlags.enable || combinedFlags.disable) return combinedFlags;
|
|
2341
|
+
return null;
|
|
2342
|
+
}
|
|
2343
|
+
function getFlagModsFromFlags({ dotAll, ignoreCase }) {
|
|
2344
|
+
const mods = {};
|
|
2345
|
+
if (dotAll || ignoreCase) {
|
|
2346
|
+
mods.enable = {};
|
|
2347
|
+
dotAll && (mods.enable.dotAll = true);
|
|
2348
|
+
ignoreCase && (mods.enable.ignoreCase = true);
|
|
2349
|
+
}
|
|
2350
|
+
if (!dotAll || !ignoreCase) {
|
|
2351
|
+
mods.disable = {};
|
|
2352
|
+
!dotAll && (mods.disable.dotAll = true);
|
|
2353
|
+
!ignoreCase && (mods.disable.ignoreCase = true);
|
|
2354
|
+
}
|
|
2355
|
+
return mods;
|
|
2356
|
+
}
|
|
2357
|
+
function getKids(node) {
|
|
2358
|
+
if (!node) throw new Error("Node expected");
|
|
2359
|
+
const { body } = node;
|
|
2360
|
+
return Array.isArray(body) ? body : body ? [body] : null;
|
|
2361
|
+
}
|
|
2362
|
+
function getLeadingG(els) {
|
|
2363
|
+
const firstToConsider = els.find((el) => el.kind === "search_start" || isLoneGLookaround(el, { negate: false }) || !isAlwaysZeroLength(el));
|
|
2364
|
+
if (!firstToConsider) return null;
|
|
2365
|
+
if (firstToConsider.kind === "search_start") return firstToConsider;
|
|
2366
|
+
if (firstToConsider.type === "LookaroundAssertion") return firstToConsider.body[0].body[0];
|
|
2367
|
+
if (firstToConsider.type === "CapturingGroup" || firstToConsider.type === "Group") {
|
|
2368
|
+
const gNodesForGroup = [];
|
|
2369
|
+
for (const alt of firstToConsider.body) {
|
|
2370
|
+
const leadingG = getLeadingG(alt.body);
|
|
2371
|
+
if (!leadingG) return null;
|
|
2372
|
+
Array.isArray(leadingG) ? gNodesForGroup.push(...leadingG) : gNodesForGroup.push(leadingG);
|
|
2373
|
+
}
|
|
2374
|
+
return gNodesForGroup;
|
|
2375
|
+
}
|
|
2376
|
+
return null;
|
|
2377
|
+
}
|
|
2378
|
+
function isAncestorOf(node, descendant) {
|
|
2379
|
+
const kids = getKids(node) ?? [];
|
|
2380
|
+
for (const kid of kids) if (kid === descendant || isAncestorOf(kid, descendant)) return true;
|
|
2381
|
+
return false;
|
|
2382
|
+
}
|
|
2383
|
+
function isAlwaysZeroLength({ type }) {
|
|
2384
|
+
return type === "Assertion" || type === "Directive" || type === "LookaroundAssertion";
|
|
2385
|
+
}
|
|
2386
|
+
function isAlwaysNonZeroLength(node) {
|
|
2387
|
+
const types = [
|
|
2388
|
+
"Character",
|
|
2389
|
+
"CharacterClass",
|
|
2390
|
+
"CharacterSet"
|
|
2391
|
+
];
|
|
2392
|
+
return types.includes(node.type) || node.type === "Quantifier" && node.min && types.includes(node.body.type);
|
|
2393
|
+
}
|
|
2394
|
+
function isLoneGLookaround(node, options) {
|
|
2395
|
+
const opts = {
|
|
2396
|
+
negate: null,
|
|
2397
|
+
...options
|
|
2398
|
+
};
|
|
2399
|
+
return node.type === "LookaroundAssertion" && (opts.negate === null || node.negate === opts.negate) && node.body.length === 1 && o(node.body[0], {
|
|
2400
|
+
type: "Assertion",
|
|
2401
|
+
kind: "search_start"
|
|
2402
|
+
});
|
|
2403
|
+
}
|
|
2404
|
+
function isValidJsGroupName(name) {
|
|
2405
|
+
return /^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(name);
|
|
2406
|
+
}
|
|
2407
|
+
function parseFragment(pattern, options) {
|
|
2408
|
+
const alts = J(pattern, {
|
|
2409
|
+
...options,
|
|
2410
|
+
unicodePropertyMap: JsUnicodePropertyMap
|
|
2411
|
+
}).body;
|
|
2412
|
+
if (alts.length > 1 || alts[0].body.length > 1) return A({ body: alts });
|
|
2413
|
+
return alts[0].body[0];
|
|
2414
|
+
}
|
|
2415
|
+
function setNegate(node, negate) {
|
|
2416
|
+
node.negate = negate;
|
|
2417
|
+
return node;
|
|
2418
|
+
}
|
|
2419
|
+
function setParent(node, parent) {
|
|
2420
|
+
node.parent = parent;
|
|
2421
|
+
return node;
|
|
2422
|
+
}
|
|
2423
|
+
function setParentDeep(node, parent) {
|
|
2424
|
+
addParentProperties(node);
|
|
2425
|
+
node.parent = parent;
|
|
2426
|
+
return node;
|
|
2427
|
+
}
|
|
2428
|
+
function generate(ast, options) {
|
|
2429
|
+
const opts = getOptions(options);
|
|
2430
|
+
const minTargetEs2024 = isMinTarget(opts.target, "ES2024");
|
|
2431
|
+
const minTargetEs2025 = isMinTarget(opts.target, "ES2025");
|
|
2432
|
+
const recursionLimit = opts.rules.recursionLimit;
|
|
2433
|
+
if (!Number.isInteger(recursionLimit) || recursionLimit < 2 || recursionLimit > 20) throw new Error("Invalid recursionLimit; use 2-20");
|
|
2434
|
+
let hasCaseInsensitiveNode = null;
|
|
2435
|
+
let hasCaseSensitiveNode = null;
|
|
2436
|
+
if (!minTargetEs2025) {
|
|
2437
|
+
const iStack = [ast.flags.ignoreCase];
|
|
2438
|
+
S(ast, FlagModifierVisitor, {
|
|
2439
|
+
getCurrentModI: () => iStack.at(-1),
|
|
2440
|
+
popModI() {
|
|
2441
|
+
iStack.pop();
|
|
2442
|
+
},
|
|
2443
|
+
pushModI(isIOn) {
|
|
2444
|
+
iStack.push(isIOn);
|
|
2445
|
+
},
|
|
2446
|
+
setHasCasedChar() {
|
|
2447
|
+
if (iStack.at(-1)) hasCaseInsensitiveNode = true;
|
|
2448
|
+
else hasCaseSensitiveNode = true;
|
|
2449
|
+
}
|
|
2450
|
+
});
|
|
2451
|
+
}
|
|
2452
|
+
const appliedGlobalFlags = {
|
|
2453
|
+
dotAll: ast.flags.dotAll,
|
|
2454
|
+
ignoreCase: !!((ast.flags.ignoreCase || hasCaseInsensitiveNode) && !hasCaseSensitiveNode)
|
|
2455
|
+
};
|
|
2456
|
+
let lastNode = ast;
|
|
2457
|
+
const state = {
|
|
2458
|
+
accuracy: opts.accuracy,
|
|
2459
|
+
appliedGlobalFlags,
|
|
2460
|
+
captureMap: /* @__PURE__ */ new Map(),
|
|
2461
|
+
currentFlags: {
|
|
2462
|
+
dotAll: ast.flags.dotAll,
|
|
2463
|
+
ignoreCase: ast.flags.ignoreCase
|
|
2464
|
+
},
|
|
2465
|
+
inCharClass: false,
|
|
2466
|
+
lastNode,
|
|
2467
|
+
originMap: ast._originMap,
|
|
2468
|
+
recursionLimit,
|
|
2469
|
+
useAppliedIgnoreCase: !!(!minTargetEs2025 && hasCaseInsensitiveNode && hasCaseSensitiveNode),
|
|
2470
|
+
useFlagMods: minTargetEs2025,
|
|
2471
|
+
useFlagV: minTargetEs2024,
|
|
2472
|
+
verbose: opts.verbose
|
|
2473
|
+
};
|
|
2474
|
+
function gen(node) {
|
|
2475
|
+
state.lastNode = lastNode;
|
|
2476
|
+
lastNode = node;
|
|
2477
|
+
return throwIfNullish(generator[node.type], `Unexpected node type "${node.type}"`)(node, state, gen);
|
|
2478
|
+
}
|
|
2479
|
+
const result = {
|
|
2480
|
+
pattern: ast.body.map(gen).join("|"),
|
|
2481
|
+
flags: gen(ast.flags),
|
|
2482
|
+
options: { ...ast.options }
|
|
2483
|
+
};
|
|
2484
|
+
if (!minTargetEs2024) {
|
|
2485
|
+
delete result.options.force.v;
|
|
2486
|
+
result.options.disable.v = true;
|
|
2487
|
+
result.options.unicodeSetsPlugin = null;
|
|
2488
|
+
}
|
|
2489
|
+
result._captureTransfers = /* @__PURE__ */ new Map();
|
|
2490
|
+
result._hiddenCaptures = [];
|
|
2491
|
+
state.captureMap.forEach((value, key) => {
|
|
2492
|
+
if (value.hidden) result._hiddenCaptures.push(key);
|
|
2493
|
+
if (value.transferTo) getOrInsert(result._captureTransfers, value.transferTo, []).push(key);
|
|
2494
|
+
});
|
|
2495
|
+
return result;
|
|
2496
|
+
}
|
|
2497
|
+
var FlagModifierVisitor = {
|
|
2498
|
+
"*": {
|
|
2499
|
+
enter({ node }, state) {
|
|
2500
|
+
if (isAnyGroup(node)) {
|
|
2501
|
+
const currentModI = state.getCurrentModI();
|
|
2502
|
+
state.pushModI(node.flags ? getNewCurrentFlags({ ignoreCase: currentModI }, node.flags).ignoreCase : currentModI);
|
|
2503
|
+
}
|
|
2504
|
+
},
|
|
2505
|
+
exit({ node }, state) {
|
|
2506
|
+
if (isAnyGroup(node)) state.popModI();
|
|
2507
|
+
}
|
|
2508
|
+
},
|
|
2509
|
+
Backreference(_, state) {
|
|
2510
|
+
state.setHasCasedChar();
|
|
2511
|
+
},
|
|
2512
|
+
Character({ node }, state) {
|
|
2513
|
+
if (charHasCase(cp(node.value))) state.setHasCasedChar();
|
|
2514
|
+
},
|
|
2515
|
+
CharacterClassRange({ node, skip }, state) {
|
|
2516
|
+
skip();
|
|
2517
|
+
if (getCasesOutsideCharClassRange(node, { firstOnly: true }).length) state.setHasCasedChar();
|
|
2518
|
+
},
|
|
2519
|
+
CharacterSet({ node }, state) {
|
|
2520
|
+
if (node.kind === "property" && UnicodePropertiesWithSpecificCase.has(node.value)) state.setHasCasedChar();
|
|
2521
|
+
}
|
|
2522
|
+
};
|
|
2523
|
+
var generator = {
|
|
2524
|
+
/**
|
|
2525
|
+
@param {AlternativeNode} node
|
|
2526
|
+
*/
|
|
2527
|
+
Alternative({ body }, _, gen) {
|
|
2528
|
+
return body.map(gen).join("");
|
|
2529
|
+
},
|
|
2530
|
+
/**
|
|
2531
|
+
@param {AssertionNode} node
|
|
2532
|
+
*/
|
|
2533
|
+
Assertion({ kind, negate }) {
|
|
2534
|
+
if (kind === "string_end") return "$";
|
|
2535
|
+
if (kind === "string_start") return "^";
|
|
2536
|
+
if (kind === "word_boundary") return negate ? r`\B` : r`\b`;
|
|
2537
|
+
throw new Error(`Unexpected assertion kind "${kind}"`);
|
|
2538
|
+
},
|
|
2539
|
+
/**
|
|
2540
|
+
@param {BackreferenceNode} node
|
|
2541
|
+
*/
|
|
2542
|
+
Backreference({ ref }, state) {
|
|
2543
|
+
if (typeof ref !== "number") throw new Error("Unexpected named backref in transformed AST");
|
|
2544
|
+
if (!state.useFlagMods && state.accuracy === "strict" && state.currentFlags.ignoreCase && !state.captureMap.get(ref).ignoreCase) throw new Error("Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy");
|
|
2545
|
+
return "\\" + ref;
|
|
2546
|
+
},
|
|
2547
|
+
/**
|
|
2548
|
+
@param {CapturingGroupNode} node
|
|
2549
|
+
*/
|
|
2550
|
+
CapturingGroup(node, state, gen) {
|
|
2551
|
+
const { body, name, number } = node;
|
|
2552
|
+
const data = { ignoreCase: state.currentFlags.ignoreCase };
|
|
2553
|
+
const origin = state.originMap.get(node);
|
|
2554
|
+
if (origin) {
|
|
2555
|
+
data.hidden = true;
|
|
2556
|
+
if (number > origin.number) data.transferTo = origin.number;
|
|
2557
|
+
}
|
|
2558
|
+
state.captureMap.set(number, data);
|
|
2559
|
+
return `(${name ? `?<${name}>` : ""}${body.map(gen).join("|")})`;
|
|
2560
|
+
},
|
|
2561
|
+
/**
|
|
2562
|
+
@param {CharacterNode} node
|
|
2563
|
+
*/
|
|
2564
|
+
Character({ value }, state) {
|
|
2565
|
+
const char = cp(value);
|
|
2566
|
+
const escaped = getCharEscape(value, {
|
|
2567
|
+
escDigit: state.lastNode.type === "Backreference",
|
|
2568
|
+
inCharClass: state.inCharClass,
|
|
2569
|
+
useFlagV: state.useFlagV
|
|
2570
|
+
});
|
|
2571
|
+
if (escaped !== char) return escaped;
|
|
2572
|
+
if (state.useAppliedIgnoreCase && state.currentFlags.ignoreCase && charHasCase(char)) {
|
|
2573
|
+
const cases = getIgnoreCaseMatchChars(char);
|
|
2574
|
+
return state.inCharClass ? cases.join("") : cases.length > 1 ? `[${cases.join("")}]` : cases[0];
|
|
2575
|
+
}
|
|
2576
|
+
return char;
|
|
2577
|
+
},
|
|
2578
|
+
/**
|
|
2579
|
+
@param {CharacterClassNode} node
|
|
2580
|
+
*/
|
|
2581
|
+
CharacterClass(node, state, gen) {
|
|
2582
|
+
const { kind, negate, parent } = node;
|
|
2583
|
+
let { body } = node;
|
|
2584
|
+
if (kind === "intersection" && !state.useFlagV) throw new Error("Use of character class intersection requires min target ES2024");
|
|
2585
|
+
if (envFlags.bugFlagVLiteralHyphenIsRange && state.useFlagV && body.some(isLiteralHyphen)) body = [m(45), ...body.filter((kid) => !isLiteralHyphen(kid))];
|
|
2586
|
+
const genClass = () => `[${negate ? "^" : ""}${body.map(gen).join(kind === "intersection" ? "&&" : "")}]`;
|
|
2587
|
+
if (!state.inCharClass) {
|
|
2588
|
+
if ((!state.useFlagV || envFlags.bugNestedClassIgnoresNegation) && !negate) {
|
|
2589
|
+
const negatedChildClasses = body.filter((kid) => kid.type === "CharacterClass" && kid.kind === "union" && kid.negate);
|
|
2590
|
+
if (negatedChildClasses.length) {
|
|
2591
|
+
const group = A();
|
|
2592
|
+
const groupFirstAlt = group.body[0];
|
|
2593
|
+
group.parent = parent;
|
|
2594
|
+
groupFirstAlt.parent = group;
|
|
2595
|
+
body = body.filter((kid) => !negatedChildClasses.includes(kid));
|
|
2596
|
+
node.body = body;
|
|
2597
|
+
if (body.length) {
|
|
2598
|
+
node.parent = groupFirstAlt;
|
|
2599
|
+
groupFirstAlt.body.push(node);
|
|
2600
|
+
} else group.body.pop();
|
|
2601
|
+
negatedChildClasses.forEach((cc) => {
|
|
2602
|
+
const newAlt = b({ body: [cc] });
|
|
2603
|
+
cc.parent = newAlt;
|
|
2604
|
+
newAlt.parent = group;
|
|
2605
|
+
group.body.push(newAlt);
|
|
2606
|
+
});
|
|
2607
|
+
return gen(group);
|
|
2608
|
+
}
|
|
2609
|
+
}
|
|
2610
|
+
state.inCharClass = true;
|
|
2611
|
+
const result = genClass();
|
|
2612
|
+
state.inCharClass = false;
|
|
2613
|
+
return result;
|
|
2614
|
+
}
|
|
2615
|
+
const firstEl = body[0];
|
|
2616
|
+
if (kind === "union" && !negate && firstEl && ((!state.useFlagV || !state.verbose) && parent.kind === "union" && !(envFlags.bugFlagVLiteralHyphenIsRange && state.useFlagV) || !state.verbose && parent.kind === "intersection" && body.length === 1 && firstEl.type !== "CharacterClassRange")) return body.map(gen).join("");
|
|
2617
|
+
if (!state.useFlagV && parent.type === "CharacterClass") throw new Error("Uses nested character class in a way that requires min target ES2024");
|
|
2618
|
+
return genClass();
|
|
2619
|
+
},
|
|
2620
|
+
/**
|
|
2621
|
+
@param {CharacterClassRangeNode} node
|
|
2622
|
+
*/
|
|
2623
|
+
CharacterClassRange(node, state) {
|
|
2624
|
+
const min = node.min.value;
|
|
2625
|
+
const max = node.max.value;
|
|
2626
|
+
const escOpts = {
|
|
2627
|
+
escDigit: false,
|
|
2628
|
+
inCharClass: true,
|
|
2629
|
+
useFlagV: state.useFlagV
|
|
2630
|
+
};
|
|
2631
|
+
const minStr = getCharEscape(min, escOpts);
|
|
2632
|
+
const maxStr = getCharEscape(max, escOpts);
|
|
2633
|
+
const extraChars = /* @__PURE__ */ new Set();
|
|
2634
|
+
if (state.useAppliedIgnoreCase && state.currentFlags.ignoreCase) getCodePointRangesFromChars(getCasesOutsideCharClassRange(node)).forEach((value) => {
|
|
2635
|
+
extraChars.add(Array.isArray(value) ? `${getCharEscape(value[0], escOpts)}-${getCharEscape(value[1], escOpts)}` : getCharEscape(value, escOpts));
|
|
2636
|
+
});
|
|
2637
|
+
return `${minStr}-${maxStr}${[...extraChars].join("")}`;
|
|
2638
|
+
},
|
|
2639
|
+
/**
|
|
2640
|
+
@param {CharacterSetNode} node
|
|
2641
|
+
*/
|
|
2642
|
+
CharacterSet({ kind, negate, value, key }, state) {
|
|
2643
|
+
if (kind === "dot") return state.currentFlags.dotAll ? state.appliedGlobalFlags.dotAll || state.useFlagMods ? "." : "[^]" : r`[^\n]`;
|
|
2644
|
+
if (kind === "digit") return negate ? r`\D` : r`\d`;
|
|
2645
|
+
if (kind === "property") {
|
|
2646
|
+
if (state.useAppliedIgnoreCase && state.currentFlags.ignoreCase && UnicodePropertiesWithSpecificCase.has(value)) throw new Error(`Unicode property "${value}" can't be case-insensitive when other chars have specific case`);
|
|
2647
|
+
return `${negate ? r`\P` : r`\p`}{${key ? `${key}=` : ""}${value}}`;
|
|
2648
|
+
}
|
|
2649
|
+
if (kind === "word") return negate ? r`\W` : r`\w`;
|
|
2650
|
+
throw new Error(`Unexpected character set kind "${kind}"`);
|
|
2651
|
+
},
|
|
2652
|
+
/**
|
|
2653
|
+
@param {FlagsNode} node
|
|
2654
|
+
*/
|
|
2655
|
+
Flags(node, state) {
|
|
2656
|
+
return (state.appliedGlobalFlags.ignoreCase ? "i" : "") + (node.dotAll ? "s" : "") + (node.sticky ? "y" : "");
|
|
2657
|
+
},
|
|
2658
|
+
/**
|
|
2659
|
+
@param {GroupNode} node
|
|
2660
|
+
*/
|
|
2661
|
+
Group({ atomic: atomic2, body, flags, parent }, state, gen) {
|
|
2662
|
+
const currentFlags = state.currentFlags;
|
|
2663
|
+
if (flags) state.currentFlags = getNewCurrentFlags(currentFlags, flags);
|
|
2664
|
+
const contents = body.map(gen).join("|");
|
|
2665
|
+
const result = !state.verbose && body.length === 1 && parent.type !== "Quantifier" && !atomic2 && (!state.useFlagMods || !flags) ? contents : `(?${getGroupPrefix(atomic2, flags, state.useFlagMods)}${contents})`;
|
|
2666
|
+
state.currentFlags = currentFlags;
|
|
2667
|
+
return result;
|
|
2668
|
+
},
|
|
2669
|
+
/**
|
|
2670
|
+
@param {LookaroundAssertionNode} node
|
|
2671
|
+
*/
|
|
2672
|
+
LookaroundAssertion({ body, kind, negate }, _, gen) {
|
|
2673
|
+
return `(?${`${kind === "lookahead" ? "" : "<"}${negate ? "!" : "="}`}${body.map(gen).join("|")})`;
|
|
2674
|
+
},
|
|
2675
|
+
/**
|
|
2676
|
+
@param {QuantifierNode} node
|
|
2677
|
+
*/
|
|
2678
|
+
Quantifier(node, _, gen) {
|
|
2679
|
+
return gen(node.body) + getQuantifierStr(node);
|
|
2680
|
+
},
|
|
2681
|
+
/**
|
|
2682
|
+
@param {SubroutineNode & {isRecursive: true}} node
|
|
2683
|
+
*/
|
|
2684
|
+
Subroutine({ isRecursive, ref }, state) {
|
|
2685
|
+
if (!isRecursive) throw new Error("Unexpected non-recursive subroutine in transformed AST");
|
|
2686
|
+
const limit = state.recursionLimit;
|
|
2687
|
+
return ref === 0 ? `(?R=${limit})` : r`\g<${ref}&R=${limit}>`;
|
|
2688
|
+
}
|
|
2689
|
+
};
|
|
2690
|
+
var BaseEscapeChars = /* @__PURE__ */ new Set([
|
|
2691
|
+
"$",
|
|
2692
|
+
"(",
|
|
2693
|
+
")",
|
|
2694
|
+
"*",
|
|
2695
|
+
"+",
|
|
2696
|
+
".",
|
|
2697
|
+
"?",
|
|
2698
|
+
"[",
|
|
2699
|
+
"\\",
|
|
2700
|
+
"]",
|
|
2701
|
+
"^",
|
|
2702
|
+
"{",
|
|
2703
|
+
"|",
|
|
2704
|
+
"}"
|
|
2705
|
+
]);
|
|
2706
|
+
var CharClassEscapeChars = /* @__PURE__ */ new Set([
|
|
2707
|
+
"-",
|
|
2708
|
+
"\\",
|
|
2709
|
+
"]",
|
|
2710
|
+
"^",
|
|
2711
|
+
"["
|
|
2712
|
+
]);
|
|
2713
|
+
var CharClassEscapeCharsFlagV = /* @__PURE__ */ new Set([
|
|
2714
|
+
"(",
|
|
2715
|
+
")",
|
|
2716
|
+
"-",
|
|
2717
|
+
"/",
|
|
2718
|
+
"[",
|
|
2719
|
+
"\\",
|
|
2720
|
+
"]",
|
|
2721
|
+
"^",
|
|
2722
|
+
"{",
|
|
2723
|
+
"|",
|
|
2724
|
+
"}",
|
|
2725
|
+
"!",
|
|
2726
|
+
"#",
|
|
2727
|
+
"$",
|
|
2728
|
+
"%",
|
|
2729
|
+
"&",
|
|
2730
|
+
"*",
|
|
2731
|
+
"+",
|
|
2732
|
+
",",
|
|
2733
|
+
".",
|
|
2734
|
+
":",
|
|
2735
|
+
";",
|
|
2736
|
+
"<",
|
|
2737
|
+
"=",
|
|
2738
|
+
">",
|
|
2739
|
+
"?",
|
|
2740
|
+
"@",
|
|
2741
|
+
"`",
|
|
2742
|
+
"~"
|
|
2743
|
+
]);
|
|
2744
|
+
var CharCodeEscapeMap = /* @__PURE__ */ new Map([
|
|
2745
|
+
[9, r`\t`],
|
|
2746
|
+
[10, r`\n`],
|
|
2747
|
+
[11, r`\v`],
|
|
2748
|
+
[12, r`\f`],
|
|
2749
|
+
[13, r`\r`],
|
|
2750
|
+
[8232, r`\u2028`],
|
|
2751
|
+
[8233, r`\u2029`],
|
|
2752
|
+
[65279, r`\uFEFF`]
|
|
2753
|
+
]);
|
|
2754
|
+
var casedRe = /^\p{Cased}$/u;
|
|
2755
|
+
function charHasCase(char) {
|
|
2756
|
+
return casedRe.test(char);
|
|
2757
|
+
}
|
|
2758
|
+
function getCasesOutsideCharClassRange(node, options) {
|
|
2759
|
+
const firstOnly = !!options?.firstOnly;
|
|
2760
|
+
const min = node.min.value;
|
|
2761
|
+
const max = node.max.value;
|
|
2762
|
+
const found = [];
|
|
2763
|
+
if (min < 65 && (max === 65535 || max >= 131071) || min === 65536 && max >= 131071) return found;
|
|
2764
|
+
for (let i = min; i <= max; i++) {
|
|
2765
|
+
const char = cp(i);
|
|
2766
|
+
if (!charHasCase(char)) continue;
|
|
2767
|
+
const charsOutsideRange = getIgnoreCaseMatchChars(char).filter((caseOfChar) => {
|
|
2768
|
+
const num = caseOfChar.codePointAt(0);
|
|
2769
|
+
return num < min || num > max;
|
|
2770
|
+
});
|
|
2771
|
+
if (charsOutsideRange.length) {
|
|
2772
|
+
found.push(...charsOutsideRange);
|
|
2773
|
+
if (firstOnly) break;
|
|
2774
|
+
}
|
|
2775
|
+
}
|
|
2776
|
+
return found;
|
|
2777
|
+
}
|
|
2778
|
+
function getCharEscape(codePoint, { escDigit, inCharClass, useFlagV }) {
|
|
2779
|
+
if (CharCodeEscapeMap.has(codePoint)) return CharCodeEscapeMap.get(codePoint);
|
|
2780
|
+
if (codePoint < 32 || codePoint > 126 && codePoint < 160 || codePoint > 262143 || escDigit && isDigitCharCode(codePoint)) return codePoint > 255 ? `\\u{${codePoint.toString(16).toUpperCase()}}` : `\\x${codePoint.toString(16).toUpperCase().padStart(2, "0")}`;
|
|
2781
|
+
const escapeChars = inCharClass ? useFlagV ? CharClassEscapeCharsFlagV : CharClassEscapeChars : BaseEscapeChars;
|
|
2782
|
+
const char = cp(codePoint);
|
|
2783
|
+
return (escapeChars.has(char) ? "\\" : "") + char;
|
|
2784
|
+
}
|
|
2785
|
+
function getCodePointRangesFromChars(chars) {
|
|
2786
|
+
const codePoints = chars.map((char) => char.codePointAt(0)).sort((a, b) => a - b);
|
|
2787
|
+
const values = [];
|
|
2788
|
+
let start = null;
|
|
2789
|
+
for (let i = 0; i < codePoints.length; i++) if (codePoints[i + 1] === codePoints[i] + 1) start ??= codePoints[i];
|
|
2790
|
+
else if (start === null) values.push(codePoints[i]);
|
|
2791
|
+
else {
|
|
2792
|
+
values.push([start, codePoints[i]]);
|
|
2793
|
+
start = null;
|
|
2794
|
+
}
|
|
2795
|
+
return values;
|
|
2796
|
+
}
|
|
2797
|
+
function getGroupPrefix(atomic2, flagMods, useFlagMods) {
|
|
2798
|
+
if (atomic2) return ">";
|
|
2799
|
+
let mods = "";
|
|
2800
|
+
if (flagMods && useFlagMods) {
|
|
2801
|
+
const { enable, disable } = flagMods;
|
|
2802
|
+
mods = (enable?.ignoreCase ? "i" : "") + (enable?.dotAll ? "s" : "") + (disable ? "-" : "") + (disable?.ignoreCase ? "i" : "") + (disable?.dotAll ? "s" : "");
|
|
2803
|
+
}
|
|
2804
|
+
return `${mods}:`;
|
|
2805
|
+
}
|
|
2806
|
+
function getQuantifierStr({ kind, max, min }) {
|
|
2807
|
+
let base;
|
|
2808
|
+
if (!min && max === 1) base = "?";
|
|
2809
|
+
else if (!min && max === Infinity) base = "*";
|
|
2810
|
+
else if (min === 1 && max === Infinity) base = "+";
|
|
2811
|
+
else if (min === max) base = `{${min}}`;
|
|
2812
|
+
else base = `{${min},${max === Infinity ? "" : max}}`;
|
|
2813
|
+
return base + {
|
|
2814
|
+
greedy: "",
|
|
2815
|
+
lazy: "?",
|
|
2816
|
+
possessive: "+"
|
|
2817
|
+
}[kind];
|
|
2818
|
+
}
|
|
2819
|
+
function isAnyGroup({ type }) {
|
|
2820
|
+
return type === "CapturingGroup" || type === "Group" || type === "LookaroundAssertion";
|
|
2821
|
+
}
|
|
2822
|
+
function isDigitCharCode(value) {
|
|
2823
|
+
return value > 47 && value < 58;
|
|
2824
|
+
}
|
|
2825
|
+
function isLiteralHyphen({ type, value }) {
|
|
2826
|
+
return type === "Character" && value === 45;
|
|
2827
|
+
}
|
|
2828
|
+
var EmulatedRegExp = class _EmulatedRegExp extends RegExp {
|
|
2829
|
+
/**
|
|
2830
|
+
@type {Map<number, {
|
|
2831
|
+
hidden?: true;
|
|
2832
|
+
transferTo?: number;
|
|
2833
|
+
}>}
|
|
2834
|
+
*/
|
|
2835
|
+
#captureMap = /* @__PURE__ */ new Map();
|
|
2836
|
+
/**
|
|
2837
|
+
@type {RegExp | EmulatedRegExp | null}
|
|
2838
|
+
*/
|
|
2839
|
+
#compiled = null;
|
|
2840
|
+
/**
|
|
2841
|
+
@type {string}
|
|
2842
|
+
*/
|
|
2843
|
+
#pattern;
|
|
2844
|
+
/**
|
|
2845
|
+
@type {Map<number, string>?}
|
|
2846
|
+
*/
|
|
2847
|
+
#nameMap = null;
|
|
2848
|
+
/**
|
|
2849
|
+
@type {string?}
|
|
2850
|
+
*/
|
|
2851
|
+
#strategy = null;
|
|
2852
|
+
/**
|
|
2853
|
+
Can be used to serialize the instance.
|
|
2854
|
+
@type {EmulatedRegExpOptions}
|
|
2855
|
+
*/
|
|
2856
|
+
rawOptions = {};
|
|
2857
|
+
get source() {
|
|
2858
|
+
return this.#pattern || "(?:)";
|
|
2859
|
+
}
|
|
2860
|
+
/**
|
|
2861
|
+
@overload
|
|
2862
|
+
@param {string} pattern
|
|
2863
|
+
@param {string} [flags]
|
|
2864
|
+
@param {EmulatedRegExpOptions} [options]
|
|
2865
|
+
*/
|
|
2866
|
+
/**
|
|
2867
|
+
@overload
|
|
2868
|
+
@param {EmulatedRegExp} pattern
|
|
2869
|
+
@param {string} [flags]
|
|
2870
|
+
*/
|
|
2871
|
+
constructor(pattern, flags, options) {
|
|
2872
|
+
const lazyCompile = !!options?.lazyCompile;
|
|
2873
|
+
if (pattern instanceof RegExp) {
|
|
2874
|
+
if (options) throw new Error("Cannot provide options when copying a regexp");
|
|
2875
|
+
const re = pattern;
|
|
2876
|
+
super(re, flags);
|
|
2877
|
+
this.#pattern = re.source;
|
|
2878
|
+
if (re instanceof _EmulatedRegExp) {
|
|
2879
|
+
this.#captureMap = re.#captureMap;
|
|
2880
|
+
this.#nameMap = re.#nameMap;
|
|
2881
|
+
this.#strategy = re.#strategy;
|
|
2882
|
+
this.rawOptions = re.rawOptions;
|
|
2883
|
+
}
|
|
2884
|
+
} else {
|
|
2885
|
+
const opts = {
|
|
2886
|
+
hiddenCaptures: [],
|
|
2887
|
+
strategy: null,
|
|
2888
|
+
transfers: [],
|
|
2889
|
+
...options
|
|
2890
|
+
};
|
|
2891
|
+
super(lazyCompile ? "" : pattern, flags);
|
|
2892
|
+
this.#pattern = pattern;
|
|
2893
|
+
this.#captureMap = createCaptureMap(opts.hiddenCaptures, opts.transfers);
|
|
2894
|
+
this.#strategy = opts.strategy;
|
|
2895
|
+
this.rawOptions = options ?? {};
|
|
2896
|
+
}
|
|
2897
|
+
if (!lazyCompile) this.#compiled = this;
|
|
2898
|
+
}
|
|
2899
|
+
/**
|
|
2900
|
+
Called internally by all String/RegExp methods that use regexes.
|
|
2901
|
+
@override
|
|
2902
|
+
@param {string} str
|
|
2903
|
+
@returns {RegExpExecArray?}
|
|
2904
|
+
*/
|
|
2905
|
+
exec(str) {
|
|
2906
|
+
if (!this.#compiled) {
|
|
2907
|
+
const { lazyCompile, ...rest } = this.rawOptions;
|
|
2908
|
+
this.#compiled = new _EmulatedRegExp(this.#pattern, this.flags, rest);
|
|
2909
|
+
}
|
|
2910
|
+
const useLastIndex = this.global || this.sticky;
|
|
2911
|
+
const pos = this.lastIndex;
|
|
2912
|
+
if (this.#strategy === "clip_search" && useLastIndex && pos) {
|
|
2913
|
+
this.lastIndex = 0;
|
|
2914
|
+
const match = this.#execCore(str.slice(pos));
|
|
2915
|
+
if (match) {
|
|
2916
|
+
adjustMatchDetailsForOffset(match, pos, str, this.hasIndices);
|
|
2917
|
+
this.lastIndex += pos;
|
|
2918
|
+
}
|
|
2919
|
+
return match;
|
|
2920
|
+
}
|
|
2921
|
+
return this.#execCore(str);
|
|
2922
|
+
}
|
|
2923
|
+
/**
|
|
2924
|
+
Adds support for hidden and transfer captures.
|
|
2925
|
+
@param {string} str
|
|
2926
|
+
@returns
|
|
2927
|
+
*/
|
|
2928
|
+
#execCore(str) {
|
|
2929
|
+
this.#compiled.lastIndex = this.lastIndex;
|
|
2930
|
+
const match = super.exec.call(this.#compiled, str);
|
|
2931
|
+
this.lastIndex = this.#compiled.lastIndex;
|
|
2932
|
+
if (!match || !this.#captureMap.size) return match;
|
|
2933
|
+
const matchCopy = [...match];
|
|
2934
|
+
match.length = 1;
|
|
2935
|
+
let indicesCopy;
|
|
2936
|
+
if (this.hasIndices) {
|
|
2937
|
+
indicesCopy = [...match.indices];
|
|
2938
|
+
match.indices.length = 1;
|
|
2939
|
+
}
|
|
2940
|
+
const mappedNums = [0];
|
|
2941
|
+
for (let i = 1; i < matchCopy.length; i++) {
|
|
2942
|
+
const { hidden, transferTo } = this.#captureMap.get(i) ?? {};
|
|
2943
|
+
if (hidden) mappedNums.push(null);
|
|
2944
|
+
else {
|
|
2945
|
+
mappedNums.push(match.length);
|
|
2946
|
+
match.push(matchCopy[i]);
|
|
2947
|
+
if (this.hasIndices) match.indices.push(indicesCopy[i]);
|
|
2948
|
+
}
|
|
2949
|
+
if (transferTo && matchCopy[i] !== void 0) {
|
|
2950
|
+
const to = mappedNums[transferTo];
|
|
2951
|
+
if (!to) throw new Error(`Invalid capture transfer to "${to}"`);
|
|
2952
|
+
match[to] = matchCopy[i];
|
|
2953
|
+
if (this.hasIndices) match.indices[to] = indicesCopy[i];
|
|
2954
|
+
if (match.groups) {
|
|
2955
|
+
if (!this.#nameMap) this.#nameMap = createNameMap(this.source);
|
|
2956
|
+
const name = this.#nameMap.get(transferTo);
|
|
2957
|
+
if (name) {
|
|
2958
|
+
match.groups[name] = matchCopy[i];
|
|
2959
|
+
if (this.hasIndices) match.indices.groups[name] = indicesCopy[i];
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
}
|
|
2963
|
+
}
|
|
2964
|
+
return match;
|
|
2965
|
+
}
|
|
2966
|
+
};
|
|
2967
|
+
function adjustMatchDetailsForOffset(match, offset, input, hasIndices) {
|
|
2968
|
+
match.index += offset;
|
|
2969
|
+
match.input = input;
|
|
2970
|
+
if (hasIndices) {
|
|
2971
|
+
const indices = match.indices;
|
|
2972
|
+
for (let i = 0; i < indices.length; i++) {
|
|
2973
|
+
const arr = indices[i];
|
|
2974
|
+
if (arr) indices[i] = [arr[0] + offset, arr[1] + offset];
|
|
2975
|
+
}
|
|
2976
|
+
const groupIndices = indices.groups;
|
|
2977
|
+
if (groupIndices) Object.keys(groupIndices).forEach((key) => {
|
|
2978
|
+
const arr = groupIndices[key];
|
|
2979
|
+
if (arr) groupIndices[key] = [arr[0] + offset, arr[1] + offset];
|
|
2980
|
+
});
|
|
2981
|
+
}
|
|
2982
|
+
}
|
|
2983
|
+
function createCaptureMap(hiddenCaptures, transfers) {
|
|
2984
|
+
const captureMap = /* @__PURE__ */ new Map();
|
|
2985
|
+
for (const num of hiddenCaptures) captureMap.set(num, { hidden: true });
|
|
2986
|
+
for (const [to, from] of transfers) for (const num of from) getOrInsert(captureMap, num, {}).transferTo = to;
|
|
2987
|
+
return captureMap;
|
|
2988
|
+
}
|
|
2989
|
+
function createNameMap(pattern) {
|
|
2990
|
+
const re = /(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu;
|
|
2991
|
+
const map = /* @__PURE__ */ new Map();
|
|
2992
|
+
let numCharClassesOpen = 0;
|
|
2993
|
+
let numCaptures = 0;
|
|
2994
|
+
let match;
|
|
2995
|
+
while (match = re.exec(pattern)) {
|
|
2996
|
+
const { 0: m, groups: { capture, name } } = match;
|
|
2997
|
+
if (m === "[") numCharClassesOpen++;
|
|
2998
|
+
else if (!numCharClassesOpen) {
|
|
2999
|
+
if (capture) {
|
|
3000
|
+
numCaptures++;
|
|
3001
|
+
if (name) map.set(numCaptures, name);
|
|
3002
|
+
}
|
|
3003
|
+
} else if (m === "]") numCharClassesOpen--;
|
|
3004
|
+
}
|
|
3005
|
+
return map;
|
|
3006
|
+
}
|
|
3007
|
+
function toRegExp(pattern, options) {
|
|
3008
|
+
const d = toRegExpDetails(pattern, options);
|
|
3009
|
+
if (d.options) return new EmulatedRegExp(d.pattern, d.flags, d.options);
|
|
3010
|
+
return new RegExp(d.pattern, d.flags);
|
|
3011
|
+
}
|
|
3012
|
+
function toRegExpDetails(pattern, options) {
|
|
3013
|
+
const opts = getOptions(options);
|
|
3014
|
+
const regexPlusAst = transform(J(pattern, {
|
|
3015
|
+
flags: opts.flags,
|
|
3016
|
+
normalizeUnknownPropertyNames: true,
|
|
3017
|
+
rules: {
|
|
3018
|
+
captureGroup: opts.rules.captureGroup,
|
|
3019
|
+
singleline: opts.rules.singleline
|
|
3020
|
+
},
|
|
3021
|
+
skipBackrefValidation: opts.rules.allowOrphanBackrefs,
|
|
3022
|
+
unicodePropertyMap: JsUnicodePropertyMap
|
|
3023
|
+
}), {
|
|
3024
|
+
accuracy: opts.accuracy,
|
|
3025
|
+
asciiWordBoundaries: opts.rules.asciiWordBoundaries,
|
|
3026
|
+
avoidSubclass: opts.avoidSubclass,
|
|
3027
|
+
bestEffortTarget: opts.target
|
|
3028
|
+
});
|
|
3029
|
+
const generated = generate(regexPlusAst, opts);
|
|
3030
|
+
const recursionResult = recursion(generated.pattern, {
|
|
3031
|
+
captureTransfers: generated._captureTransfers,
|
|
3032
|
+
hiddenCaptures: generated._hiddenCaptures,
|
|
3033
|
+
mode: "external"
|
|
3034
|
+
});
|
|
3035
|
+
const atomicResult = atomic(possessive(recursionResult.pattern).pattern, {
|
|
3036
|
+
captureTransfers: recursionResult.captureTransfers,
|
|
3037
|
+
hiddenCaptures: recursionResult.hiddenCaptures
|
|
3038
|
+
});
|
|
3039
|
+
const details = {
|
|
3040
|
+
pattern: atomicResult.pattern,
|
|
3041
|
+
flags: `${opts.hasIndices ? "d" : ""}${opts.global ? "g" : ""}${generated.flags}${generated.options.disable.v ? "u" : "v"}`
|
|
3042
|
+
};
|
|
3043
|
+
if (opts.avoidSubclass) {
|
|
3044
|
+
if (opts.lazyCompileLength !== Infinity) throw new Error("Lazy compilation requires subclass");
|
|
3045
|
+
} else {
|
|
3046
|
+
const hiddenCaptures = atomicResult.hiddenCaptures.sort((a, b) => a - b);
|
|
3047
|
+
const transfers = Array.from(atomicResult.captureTransfers);
|
|
3048
|
+
const strategy = regexPlusAst._strategy;
|
|
3049
|
+
const lazyCompile = details.pattern.length >= opts.lazyCompileLength;
|
|
3050
|
+
if (hiddenCaptures.length || transfers.length || strategy || lazyCompile) details.options = {
|
|
3051
|
+
...hiddenCaptures.length && { hiddenCaptures },
|
|
3052
|
+
...transfers.length && { transfers },
|
|
3053
|
+
...strategy && { strategy },
|
|
3054
|
+
...lazyCompile && { lazyCompile }
|
|
3055
|
+
};
|
|
3056
|
+
}
|
|
3057
|
+
return details;
|
|
3058
|
+
}
|
|
3059
|
+
//#endregion
|
|
3060
|
+
//#region ../../node_modules/.pnpm/@shikijs+engine-javascript@4.0.0/node_modules/@shikijs/engine-javascript/dist/engine-compile.mjs
|
|
3061
|
+
/**
|
|
3062
|
+
* The default regex constructor for the JavaScript RegExp engine.
|
|
3063
|
+
*/
|
|
3064
|
+
function defaultJavaScriptRegexConstructor(pattern, options) {
|
|
3065
|
+
return toRegExp(pattern, {
|
|
3066
|
+
global: true,
|
|
3067
|
+
hasIndices: true,
|
|
3068
|
+
lazyCompileLength: 3e3,
|
|
3069
|
+
rules: {
|
|
3070
|
+
allowOrphanBackrefs: true,
|
|
3071
|
+
asciiWordBoundaries: true,
|
|
3072
|
+
captureGroup: true,
|
|
3073
|
+
recursionLimit: 5,
|
|
3074
|
+
singleline: true
|
|
3075
|
+
},
|
|
3076
|
+
...options
|
|
3077
|
+
});
|
|
3078
|
+
}
|
|
3079
|
+
/**
|
|
3080
|
+
* Use the modern JavaScript RegExp engine to implement the OnigScanner.
|
|
3081
|
+
*
|
|
3082
|
+
* As Oniguruma supports some features that can't be emulated using native JavaScript regexes, some
|
|
3083
|
+
* patterns are not supported. Errors will be thrown when parsing TextMate grammars with
|
|
3084
|
+
* unsupported patterns, and when the grammar includes patterns that use invalid Oniguruma syntax.
|
|
3085
|
+
* Set `forgiving` to `true` to ignore these errors and skip any unsupported or invalid patterns.
|
|
3086
|
+
*/
|
|
3087
|
+
function createJavaScriptRegexEngine(options = {}) {
|
|
3088
|
+
const _options = Object.assign({
|
|
3089
|
+
target: "auto",
|
|
3090
|
+
cache: /* @__PURE__ */ new Map()
|
|
3091
|
+
}, options);
|
|
3092
|
+
_options.regexConstructor ||= (pattern) => defaultJavaScriptRegexConstructor(pattern, { target: _options.target });
|
|
3093
|
+
return {
|
|
3094
|
+
createScanner(patterns) {
|
|
3095
|
+
return new JavaScriptScanner(patterns, _options);
|
|
3096
|
+
},
|
|
3097
|
+
createString(s) {
|
|
3098
|
+
return { content: s };
|
|
3099
|
+
}
|
|
3100
|
+
};
|
|
3101
|
+
}
|
|
3102
|
+
//#endregion
|
|
3103
|
+
export { createJavaScriptRegexEngine };
|