oxlint-plugin-react-doctor 0.9.12-dev.3ff37f3 → 0.9.12-dev.4bf7aff

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -61,9 +61,54 @@ the package's root entry.
61
61
 
62
62
  ## Available rules
63
63
 
64
- The full rule list lives in [`rule-registry.ts`](https://github.com/millionco/react-doctor/blob/main/packages/oxlint-plugin-react-doctor/src/plugin/rule-registry.ts). All rules are namespaced under `react-doctor/*`.
64
+ The full rule list lives in [`rule-registry.ts`](https://github.com/millionco/react-doctor/blob/main/packages/oxlint-plugin-react-doctor/src/plugin/rule-registry.ts). Rules exported by this package use the `react-doctor/*` namespace.
65
65
 
66
- Rules in the `security-scan` bucket are project-level project-wide file scans (leaked artifact secrets, permissive Firebase/Supabase rules, committed key material, …). They register metadata here but are no-ops under plain oxlint or ESLint — the [React Doctor CLI](https://npmjs.com/package/react-doctor) executes them over a whole-tree file walk during its scan.
66
+ ### Choose a runner for each diagnostic
67
+
68
+ Standalone Oxlint runs rules that inspect one source file. The React Doctor CLI also runs whole-project and package analyzers.
69
+
70
+ | Diagnostic source | Standalone Oxlint | Runner |
71
+ | --------------------------------------------------------------------------------------------- | ----------------- | ---------------------------------------------------------------- |
72
+ | `react-doctor/*` rules with per-file visitors | Yes | Configure them under `rules` as shown above |
73
+ | Project rules such as `react-doctor/circular-dependency` and `react-doctor/unused-dependency` | No | Run the React Doctor CLI |
74
+ | `deslop/*` diagnostics | No | Run the React Doctor CLI |
75
+ | `socket/*` diagnostics | No | Run the React Doctor CLI |
76
+ | `react-hooks-js/*` React Compiler diagnostics | Separate plugin | Register `eslint-plugin-react-hooks` or run the React Doctor CLI |
77
+
78
+ The `deslop/*` names are CLI output aliases for project rules. These rules need the complete dependency graph, so their plugin entries have no per-file visitors. The `socket/*` diagnostics need package and supply-chain data. Neither prefix names an Oxlint plugin exported by this package.
79
+
80
+ Rules in the `security-scan` bucket also require a project-wide file scan. They register metadata here but do nothing under standalone Oxlint or ESLint. The [React Doctor CLI](https://npmjs.com/package/react-doctor) executes them during its whole-tree scan.
81
+
82
+ ### Run React Compiler diagnostics in standalone Oxlint
83
+
84
+ React Doctor loads React Compiler diagnostics from `eslint-plugin-react-hooks` when it detects the compiler. To use them in standalone Oxlint, install and register that plugin:
85
+
86
+ ```bash
87
+ npm install --save-dev eslint-plugin-react-hooks
88
+ ```
89
+
90
+ Add both plugins to `.oxlintrc.json`. The `react-compiler` capability enables compiler-specific React Doctor cleanup rules:
91
+
92
+ ```jsonc
93
+ {
94
+ "jsPlugins": [
95
+ { "name": "react-doctor", "specifier": "oxlint-plugin-react-doctor" },
96
+ { "name": "react-hooks-js", "specifier": "eslint-plugin-react-hooks" },
97
+ ],
98
+ "settings": {
99
+ "react-doctor": {
100
+ "capabilities": ["react-compiler"],
101
+ },
102
+ },
103
+ "rules": {
104
+ "react-doctor/react-compiler-no-manual-memoization": "warn",
105
+ "react-hooks-js/immutability": "error",
106
+ "react-hooks-js/refs": "error",
107
+ },
108
+ }
109
+ ```
110
+
111
+ The `react-hooks-js` namespace is the alias React Doctor uses for the external plugin. It is not exported by `oxlint-plugin-react-doctor`.
67
112
 
68
113
  Each rule can be set to `"error"`, `"warn"`, or `"off"`:
69
114
 
@@ -1,5 +1,5 @@
1
1
  import{parseSync as e,visitorKeys as t}from"oxc-parser";import{KEYS as n}from"eslint-visitor-keys";import*as r from"node:fs";import*as i from"node:path";const a=[[`nextjs`,`Next.js`,`NEXT_PUBLIC_*`],[`vite`,`Vite`,`VITE_*`],[`tanstack-start`,`TanStack Start`,`VITE_*`],[`cra`,`Create React App`,`REACT_APP_*`],[`gatsby`,`Gatsby`,`GATSBY_*`]],o=e=>{for(let[t,n,r]of a)if(e(t))return`Move secrets to server-only code. In ${n}, only \`${r}\` env vars are exposed to the browser, and they must not contain secrets`},s=e=>e(`nextjs:static-export`)?`Avoid redirects inside useEffect — they flash the wrong page first. Use an event handler (e.g. onClick), or call redirect() from next/navigation during render (it prerenders a client-side redirect under output: "export"). Middleware and getServerSideProps redirects aren't available in a static export.`:void 0,c=[{key:`react-hooks-js/set-state-in-render`,source:`react-compiler`,severity:`error`},{key:`react-hooks-js/immutability`,source:`react-compiler`,severity:`error`},{key:`react-hooks-js/refs`,source:`react-compiler`,severity:`error`},{key:`react-hooks-js/purity`,source:`react-compiler`,severity:`error`},{key:`react-hooks-js/hooks`,source:`react-compiler`,severity:`error`},{key:`react-hooks-js/set-state-in-effect`,source:`react-compiler`,severity:`warn`},{key:`react-hooks-js/globals`,source:`react-compiler`,severity:`error`},{key:`react-hooks-js/error-boundaries`,source:`react-compiler`,severity:`error`},{key:`react-hooks-js/preserve-manual-memoization`,source:`react-compiler`,severity:`error`},{key:`react-hooks-js/unsupported-syntax`,source:`react-compiler`,severity:`error`},{key:`react-hooks-js/component-hook-factories`,source:`react-compiler`,severity:`error`},{key:`react-hooks-js/static-components`,source:`react-compiler`,severity:`error`},{key:`react-hooks-js/use-memo`,source:`react-compiler`,severity:`error`},{key:`react-hooks-js/void-use-memo`,source:`react-compiler`,severity:`error`},{key:`react-hooks-js/incompatible-library`,source:`react-compiler`,severity:`error`},{key:`react-hooks-js/todo`,source:`react-compiler`,severity:`error`}],l=Object.fromEntries(c.map(e=>[e.key,e.severity])),u=new Set(`width.height.min-width.max-width.min-height.max-height.top.right.bottom.left.padding.padding-top.padding-right.padding-bottom.padding-left.margin.margin-top.margin-right.margin-bottom.margin-left.border-width.border-top-width.border-right-width.border-bottom-width.border-left-width.line-height.column-width`.split(`.`)),d=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,`padding`,`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`,`margin`,`marginTop`,`marginRight`,`marginBottom`,`marginLeft`,`borderWidth`,`fontSize`,`lineHeight`,`gap`]),f=new Set([`animate`,`initial`,`exit`,`whileHover`,`whileTap`,`whileFocus`,`whileDrag`,`whileInView`]),p=/blur\((\d+(?:\.\d+)?)px\)/,m=new Set([`requestAnimationFrame`,`setInterval`]),h=new Set([`framer-motion`,`motion`]),ee=new Set([`bounce`,`elastic`,`wobble`,`jiggle`,`spring`]),g={base:`3.0.0`,textLayoutGuard:`3.0.1`,aria:`6.2.0`,cursor:`6.7.0`,concurrent:`6.7.0`,renderToString:`6.8.0`,modernHooks:`7.0.0`,suspendTerminal:`7.1.0`},_=[`ink-ctrl-c-handler-requires-exit-option`,`ink-newline-inside-text`,`ink-no-bare-process-exit`,`ink-no-direct-raw-mode`,`ink-no-dom-host-elements`,`ink-no-dom-router`,`ink-no-focus-in-render`,`ink-no-layout-inside-text`,`ink-no-live-hooks-in-render-to-string`,`ink-no-measure-element-in-render`,`ink-no-multiple-static`,`ink-no-raw-text`,`ink-no-repeated-render`,`ink-prefer-use-animation`,`ink-prefer-use-paste`,`ink-static-is-append-only`,`ink-static-requires-key`,`ink-suspense-requires-concurrent`,`ink-use-reactive-window-size`,`ink-use-string-width-for-cursor`,`ink-use-suspend-terminal`,`ink-valid-aria-semantics`],v=[`@react-router/dev`,`react-router-dom`,`react-router`],te=[`Component`,`element`,`lazy`],ne=[`action`,`clientAction`,`clientLoader`,`loader`],re=`react-router-csp-nonce-consistency.react-router-descendant-routes-require-splat.react-router-guard-aborted-handle-error.react-router-internal-route-anchor.react-router-loader-fetch-forwards-signal.react-router-loader-parallel-fetch.react-router-nested-route-requires-outlet.react-router-no-catch-middleware-next.react-router-no-client-module-in-server-render.react-router-no-duplicate-route-id.react-router-no-empty-leaf-route.react-router-no-invalid-absolute-child-path.react-router-no-invalid-lazy-route-properties.react-router-no-invalid-splat-path.react-router-no-loader-request-body.react-router-no-middleware-response-body-consumption.react-router-no-multiple-blockers.react-router-no-multiple-middleware-next.react-router-no-multiple-set-search-params-in-tick.react-router-no-navigate-in-render.react-router-no-nested-router.react-router-no-redirect-in-try-catch.react-router-no-route-module-environment-suffix.react-router-no-router-in-render.react-router-no-session-mutation-in-loader.react-router-no-static-cookie-expires.react-router-no-unsynchronized-search-params-mutation.react-router-no-use-loader-data-in-error-ui.react-router-prefer-route-lazy.react-router-require-root-error-boundary.react-router-resource-link-requires-reload.react-router-return-navigation-promise-in-transition.react-router-server-middleware-return-response.react-router-session-mutation-requires-commit.react-router-v8-no-meta-data-field.react-router-v8-no-react-router-dom-import.react-router-v8-no-removed-future-flags.react-router-valid-route-object`.split(`.`),ie=new Set([`@react-router/cloudflare`,`@react-router/node`,`react-router/dom`,`react-router-dom`,`react-router`]),ae=new Set([`flash`,`set`,`unset`]),oe=new Set([`createCookieSessionStorage`,`createFileSessionStorage`,`createMemorySessionStorage`,`createSessionStorage`,`createWorkersKVSessionStorage`]),se=new Set([`createBrowserRouter`,`createHashRouter`,`createMemoryRouter`]),ce=new Set([`append`,`delete`,`set`,`sort`]),le=new Set([`caseSensitive`,`children`,`id`,`index`,`lazy`,`path`]),ue=new Set([`arrayBuffer`,`blob`,`bytes`,`formData`,`json`,`text`]),de=new Set([`unstable_previewServerPrerendering`,`v8_middleware`,`v8_passThroughRequests`,`v8_splitRouteModules`,`v8_trailingSlashAwareDataRequests`,`v8_viteEnvironmentApi`]),fe=new Set([`BrowserRouter`,`HashRouter`,`MemoryRouter`,`Router`,`RouterProvider`]),pe=new Set([..._,`client-passive-event-listeners`,`effect-needs-cleanup`,`anchor-target-exists`,`exhaustive-deps`,`no-barrel-import`,`nextjs-async-dynamic-api-not-awaited`,`nextjs-missing-metadata`,`nextjs-no-img-element`,`nextjs-no-use-search-params-without-suspense`,`no-dynamic-import-path`,`no-full-lodash-import`,`no-hydration-branch-on-browser-global`,`no-img-without-dimensions`,`no-indeterminate-attribute`,`no-loading-flag-reset-outside-finally`,`no-locale-format-in-render`,`no-match-media-in-state-initializer`,`no-create-ref-in-function-component`,`no-reset-all-state-on-prop-change`,`no-side-effect-in-state-updater-function`,`no-adjust-state-on-prop-change`,`no-derived-state`,`no-derived-state-effect`,`no-event-handler`,`no-initialize-state`,`no-mutating-reducer-state`,`only-export-components`,`no-unguarded-browser-global-at-module-scope`,`no-unguarded-browser-global-in-render-or-hook-init`,`window-open-without-noopener`,`prefer-dynamic-import`,`rendering-hydration-mismatch-time`,`rendering-hydration-no-flicker`,`remotion-calculate-metadata-fetch-signal`,`remotion-deterministic-randomness`,`remotion-no-css-animation`,`remotion-no-css-transition`,`remotion-no-css-url-assets`,`remotion-no-native-media-elements`,`remotion-no-next-image`,`rerender-memo-with-default-value`,`rn-no-legacy-shadow-styles`,`rn-no-raw-text`,`rn-prefer-expo-image`,`rn-style-prefer-boxshadow`,...re]),me=new Set([`implements`,`returnType`,`superTypeArguments`,`superTypeParameters`,`typeAnnotation`,`typeArguments`,`typeParameters`]),y=e=>typeof e==`object`&&!!e&&typeof e.type==`string`,b=e=>e!=null&&(e.type===`ArrowFunctionExpression`||e.type===`FunctionExpression`||e.type===`FunctionDeclaration`),x=(e,t)=>typeof e==`object`&&!!e&&e.type===t,he={...t,...n,ArrayPattern:[`decorators`,...n.ArrayPattern],AssignmentPattern:[`decorators`,...n.AssignmentPattern],ClassDeclaration:[`decorators`,...n.ClassDeclaration],ClassExpression:[`decorators`,...n.ClassExpression],Identifier:[`decorators`,...n.Identifier],MethodDefinition:[`decorators`,...n.MethodDefinition],ObjectPattern:[`decorators`,...n.ObjectPattern],PropertyDefinition:[`decorators`,...n.PropertyDefinition],RestElement:[`decorators`,...n.RestElement]},ge=e=>e===`var`||e===`function`,_e=e=>{let t=e;for(;t;){if(t.kind===`module`||t.kind===`function`||t.kind===`arrow-function`||t.kind===`method`)return t;t=t.parent}return e},ve=(e,t,n,r)=>{let i={id:r.nextScopeId++,kind:e,node:t,parent:n,children:[],symbols:[],references:[],symbolsByName:new Map};return n&&n.children.push(i),i},S=(e,t,n)=>{let r=ve(e,t,n.currentScope,n);return n.scopeStack.push(r),n.currentScope=r,n.ownScopeForNode.set(t,r),r},ye=e=>{e.scopeStack.pop();let t=e.scopeStack[e.scopeStack.length-1];if(!t)throw Error(`scope stack underflow`);e.currentScope=t},C=(e,t,n)=>{let r={id:t.nextSymbolId++,name:n.name,kind:n.kind,bindingIdentifier:n.bindingIdentifier,declarationNode:n.declarationNode,scope:e,initializer:n.initializer,references:[]};return e.symbols.push(r),e.symbolsByName.set(n.name,r),t.symbolByBindingIdentifier.set(n.bindingIdentifier,r),r},w=(e,t,n,r,i,a)=>{if(x(e,`Identifier`)){C(n,r,{name:e.name,kind:i,bindingIdentifier:e,declarationNode:a,initializer:t});return}if(x(e,`ObjectPattern`)){for(let o of e.properties)if(x(o,`Property`)){let e=o.value;w(e,x(e,`AssignmentPattern`)?e.right:t,n,r,i,a)}else x(o,`RestElement`)&&w(o.argument,t,n,r,i,a);return}if(x(e,`ArrayPattern`)){for(let o of e.elements)o&&w(o,x(o,`AssignmentPattern`)?o.right??null:t,n,r,i,a);return}if(x(e,`AssignmentPattern`)){w(e.left,e.right??null,n,r,i,a);return}x(e,`RestElement`)&&w(e.argument,null,n,r,i,a)},be=(e,t,n)=>{let r={id:e.nextReferenceId++,identifier:t,resolvedSymbol:null,flag:n,scope:e.currentScope};e.currentScope.references.push(r),e.referenceByIdentifier.set(t,r)},xe=e=>e.parent?b(e.parent):!1,Se=e=>e.parent!==null&&e.parent!==void 0&&e.parent.type===`CatchClause`,Ce=(e,t)=>{if(!x(e,`VariableDeclaration`))return;let n=e.kind===`var`?`var`:e.kind===`let`?`let`:e.kind===`const`?`const`:`using`,r=ge(n)?_e(t.currentScope):t.currentScope;for(let i of e.declarations){let e=i,a=i.init??null;w(i.id,a,r,t,n,e)}},we=(e,t)=>{x(e,`FunctionDeclaration`)&&e.id&&C(_e(t.currentScope),t,{name:e.id.name,kind:`function`,bindingIdentifier:e.id,declarationNode:e,initializer:e})},Te=(e,t)=>{x(e,`ClassDeclaration`)&&e.id&&C(t.currentScope,t,{name:e.id.name,kind:`class`,bindingIdentifier:e.id,declarationNode:e,initializer:e})},Ee=(e,t)=>{if(!x(e,`ImportDeclaration`))return;let n=_e(t.currentScope);for(let r of e.specifiers){let e=r.local;x(e,`Identifier`)&&C(n,t,{name:e.name,kind:`import`,bindingIdentifier:e,declarationNode:r,initializer:r})}},De=(e,t)=>{if(e.type!==`TSImportEqualsDeclaration`&&e.type!==`TSEnumDeclaration`&&e.type!==`TSTypeAliasDeclaration`&&e.type!==`TSInterfaceDeclaration`&&e.type!==`TSModuleDeclaration`)return;let n=e.id;if(!n||!x(n,`Identifier`))return;let r=e.type===`TSImportEqualsDeclaration`?`ts-import-equals`:e.type===`TSEnumDeclaration`?`ts-enum`:e.type===`TSTypeAliasDeclaration`?`ts-type-alias`:e.type===`TSInterfaceDeclaration`?`ts-interface`:`ts-module`;C(_e(t.currentScope),t,{name:n.name,kind:r,bindingIdentifier:n,declarationNode:e,initializer:null})},Oe=(e,t,n)=>{for(let r of e)w(r,null,t,n,`parameter`,r)},ke=e=>!(!x(e,`BlockStatement`)||xe(e)||Se(e)||e.parent&&e.parent.type===`TSModuleDeclaration`),Ae=e=>{let t=e.parent;if(!t)return!1;if(t.type===`JSXMemberExpression`)return t.object===e;if(t.type===`JSXNamespacedName`)return!1;let n=e.name.charCodeAt(0);return!(n>=97&&n<=122)},je=e=>{let t=e.parent;if(!t)return!1;switch(t.type){case`MemberExpression`:return t.property===e&&!t.computed;case`Property`:return t.key===e&&!t.computed&&!t.shorthand;case`MethodDefinition`:case`PropertyDefinition`:return t.key===e&&!t.computed;case`JSXAttribute`:return t.name===e;case`ImportSpecifier`:return t.imported===e;case`ExportSpecifier`:return t.exported===e&&t.local!==t.exported;case`LabeledStatement`:case`BreakStatement`:case`ContinueStatement`:return t.label===e;default:return!1}},Me=e=>{let t=e.parent;if(!t)return`read`;switch(t.type){case`AssignmentExpression`:return t.left===e?t.operator===`=`?`write`:`read-write`:`read`;case`UpdateExpression`:return`read-write`;case`ForInStatement`:case`ForOfStatement`:return t.left===e?`write`:`read`;default:return`read`}},T=(e,t)=>{t.nodeScope.set(e,t.currentScope)},Ne=(e,t)=>{if(e.type===`AssignmentPattern`){Ne(e.left,t);let n=e.right??null;n&&E(n,t);return}if(e.type===`ObjectPattern`){for(let n of e.properties){let e=n;if(e.type===`RestElement`){Ne(e.argument,t);continue}if(e.type!==`Property`)continue;let r=e;r.computed&&E(r.key,t),Ne(r.value,t)}return}if(e.type===`ArrayPattern`){for(let n of e.elements)n&&Ne(n,t);return}e.type===`RestElement`&&Ne(e.argument,t)},E=(e,t)=>{if(e.type===`ArrowFunctionExpression`||e.type===`FunctionExpression`||e.type===`FunctionDeclaration`){e.type===`FunctionDeclaration`&&e.id&&we(e,t);let n=e.params??[];for(let e of n)if(!(!(`decorators`in e)||!Array.isArray(e.decorators)))for(let n of e.decorators)y(n)&&E(n,t);T(e,t);let r=S(e.type===`ArrowFunctionExpression`?`arrow-function`:`function`,e,t);(e.type===`FunctionExpression`||e.type===`FunctionDeclaration`)&&e.id&&C(r,t,{name:e.id.name,kind:`function`,bindingIdentifier:e.id,declarationNode:e,initializer:e}),Oe(n,r,t);for(let e of n)Ne(e,t);let i=e.body;i&&E(i,t),ye(t);return}if(e.type===`ClassDeclaration`||e.type===`ClassExpression`){if(e.type===`ClassDeclaration`&&e.id&&Te(e,t),Array.isArray(e.decorators))for(let n of e.decorators)y(n)&&E(n,t);let n=S(`class`,e,t);T(e,t),e.type===`ClassExpression`&&e.id&&C(n,t,{name:e.id.name,kind:`class`,bindingIdentifier:e.id,declarationNode:e,initializer:e}),e.superClass&&E(e.superClass,t),e.body&&E(e.body,t),ye(t);return}if(e.type===`CatchClause`){let n=S(`catch`,e,t);T(e,t),e.param&&w(e.param,null,n,t,`catch-clause-parameter`,e),e.body&&E(e.body,t),ye(t);return}if(e.type===`ForStatement`||e.type===`ForInStatement`||e.type===`ForOfStatement`){S(`for`,e,t),T(e,t);let n=e,r=he[e.type]??Object.keys(n);for(let e of r){if(e===`parent`||me.has(e))continue;let r=n[e];if(Array.isArray(r))for(let e of r)y(e)&&E(e,t);else y(r)&&E(r,t)}ye(t);return}if(e.type===`SwitchStatement`){S(`switch`,e,t),T(e,t),e.discriminant&&E(e.discriminant,t);for(let n of e.cases)E(n,t);ye(t);return}if(e.type===`TSModuleDeclaration`){let n=S(`ts-module`,e,t);if(T(e,t),e.id&&x(e.id,`Identifier`)){let r=e.id;C(_e(n.parent??t.currentScope),t,{name:r.name,kind:`ts-module`,bindingIdentifier:r,declarationNode:e,initializer:null})}e.body&&E(e.body,t),ye(t);return}if(e.type===`TSEnumDeclaration`){De(e,t),S(`ts-enum`,e,t),T(e,t);let n=e.members??[];for(let e of n)E(e,t);ye(t);return}if(e.type===`BlockStatement`&&ke(e)){S(`block`,e,t),T(e,t);for(let n of e.body)E(n,t);ye(t);return}switch(T(e,t),e.type){case`VariableDeclaration`:Ce(e,t);break;case`ImportDeclaration`:Ee(e,t);break;case`TSImportEqualsDeclaration`:case`TSTypeAliasDeclaration`:case`TSInterfaceDeclaration`:De(e,t);break}(e.type===`Identifier`||e.type===`JSXIdentifier`)&&!t.symbolByBindingIdentifier.has(e)&&!je(e)&&(e.type===`JSXIdentifier`?Ae(e)&&be(t,e,Me(e)):be(t,e,Me(e)));let n=e,r=he[e.type]??Object.keys(n);for(let e of r){if(e===`parent`||me.has(e))continue;let r=n[e];if(Array.isArray(r))for(let e of r)y(e)&&E(e,t);else y(r)&&E(r,t)}},Pe=e=>{let t=e=>{for(let t of e.references){let n=t.identifier.name;if(typeof n!=`string`)continue;let r=e;for(;r;){let e=r.symbolsByName.get(n);if(e){t.resolvedSymbol=e,e.references.push(t);break}r=r.parent}}for(let n of e.children)t(n)};t(e)},Fe=e=>{let t={id:0,kind:`module`,node:e,parent:null,children:[],symbols:[],references:[],symbolsByName:new Map},n={nextScopeId:1,nextSymbolId:0,nextReferenceId:0,currentScope:t,scopeStack:[t],rootScope:t,nodeScope:new WeakMap,ownScopeForNode:new WeakMap,symbolByBindingIdentifier:new WeakMap,referenceByIdentifier:new WeakMap};if(n.nodeScope.set(e,t),n.ownScopeForNode.set(e,t),e.type===`Program`)for(let t of e.body)E(t,n);else E(e,n);return Pe(t),{rootScope:t,scopeFor:e=>{let r=e;for(;r;){let e=n.nodeScope.get(r);if(e)return e;r=r.parent??null}return t},ownScopeFor:e=>n.ownScopeForNode.get(e)??null,symbolFor:e=>{let t=n.referenceByIdentifier.get(e);return t?t.resolvedSymbol:n.symbolByBindingIdentifier.get(e)||null},referenceFor:e=>n.referenceByIdentifier.get(e)??null,isGlobalReference:e=>{let t=n.referenceByIdentifier.get(e);return t?t.resolvedSymbol===null:!1}}},Ie=(e,t)=>{let n=e;for(;n;){if(n===t)return!0;n=n.parent}return!1},Le=`(?:tsx?|jsx?|mts|mjs)`,Re=RegExp(`/page\\.${Le}$`),ze=RegExp(`/(page|layout)\\.${Le}$`),Be=[`layout.tsx`,`layout.jsx`,`layout.ts`,`layout.js`,`layout.mts`,`layout.mjs`],Ve=[`metadata`,`generateMetadata`],He=/\/(?:(?:\((?:dashboard|admin|settings|account|internal|manage|console|portal|auth|onboarding|app|ee|protected)\))|(?:dashboard|admin|settings|account|internal|manage|console|portal))\//i,Ue=new Set([`redirect`,`permanentRedirect`,`notFound`,`forbidden`,`unauthorized`]),We=new Set([`revalidateTag`,`revalidatePath`,`expireTag`,`expirePath`,`unstable_expireTag`,`unstable_expirePath`]),Ge=/fonts\.googleapis\.com/,Ke=/polyfill\.io|polyfill\.min\.js|cdn\.polyfill/,qe=RegExp(`/route\\.${Le}$`),Je=/\/(?:cron|jobs\/cron)(?:\/|$)/i,Ye=new Set([`logout`,`log-out`,`signout`,`sign-out`,`unsubscribe`,`delete`,`remove`,`revoke`,`cancel`,`deactivate`]),Xe=RegExp(`/(error|global-error)\\.${Le}$`),Ze=RegExp(`/global-error\\.${Le}$`),Qe=new Set([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`,`OPTIONS`,`HEAD`]),$e=/google-analytics\.com|googletagmanager\.com\/gtag/,et=RegExp(`/(opengraph-image|twitter-image)\\d*\\.${Le}$`),tt=1024,nt=2e6,rt=1e3,it=1e3,at=new Set([`expo`,`expo-router`,`@expo/cli`,`@expo/metro-config`,`@expo/metro-runtime`]),ot=new Set([`react-native`,`react-native-tvos`,...at,`react-native-windows`,`react-native-macos`]),st=[`@react-native/`,`@react-native-`],ct=e=>at.has(e),lt=e=>{if(ot.has(e))return!0;for(let t of st)if(e.startsWith(t))return!0;return!1};let ut=null;const dt=e=>{ut?.existencePaths.add(e)},D=e=>{ut?.contentPaths.add(e)},ft=()=>ut!==null,pt=e=>{let t=ut,n={existencePaths:new Set,contentPaths:new Set};ut=n;try{return{value:e(),trace:n}}finally{if(ut=t,t!==null){for(let e of n.existencePaths)t.existencePaths.add(e);for(let e of n.contentPaths)t.contentPaths.add(e)}}},mt=e=>pt(e).trace,ht=new Map,gt=new Map,_t=()=>{ht.clear(),gt.clear()},vt=e=>{if(!e)return null;let t=ht.get(e);if(t!==void 0){if(ft()){let n=i.dirname(e);for(;dt(i.join(n,`package.json`)),n!==t;){let e=i.dirname(n);if(e===n)break;n=e}}return t}let n=i.dirname(e);for(;;){let t=i.join(n,`package.json`);dt(t);let a=!1;try{a=r.statSync(t).isFile()}catch{a=!1}if(a)return ht.set(e,n),n;let o=i.dirname(n);if(o===n)return ht.set(e,null),null;n=o}},yt=e=>{let t=vt(e);return t?bt(t):null},bt=e=>{let t=i.join(e,`package.json`);D(t);let n=gt.get(e);if(n!==void 0)return n;let a=null;try{let e=JSON.parse(r.readFileSync(t,`utf-8`));typeof e==`object`&&e&&(a=e)}catch{a=null}return gt.set(e,a),a},xt=new Set([`next`,`vite`,`react-scripts`,`gatsby`,`@remix-run/react`,`@remix-run/node`,`@docusaurus/core`,`@docusaurus/preset-classic`,`@storybook/react`,`@storybook/react-vite`,`@storybook/react-webpack5`,`@storybook/nextjs`,`@storybook/web-components`,`storybook`,`react-dom`,`@vitejs/plugin-react`,`@vitejs/plugin-react-swc`]),St=[`dependencies`,`devDependencies`,`peerDependencies`,`optionalDependencies`],Ct=function*(e){for(let t of St){let n=e[t];if(n)for(let e of Object.keys(n))yield e}},wt=e=>{if(typeof e[`react-native`]==`string`)return!0;for(let t of Ct(e))if(lt(t))return!0;return!1},Tt=e=>{for(let t of Ct(e))if(ct(t))return!0;return!1},Et=e=>{for(let t of Ct(e))if(xt.has(t))return!0;return!1},Dt=e=>St.some(t=>{let n=e[t];return typeof n==`object`&&!!n&&Object.keys(n).length>0}),Ot=(e,t)=>St.some(n=>{let r=e[n];return typeof r==`object`&&!!r&&Object.prototype.propertyIsEnumerable.call(r,t)}),kt=new WeakMap,At=e=>{let t=yt(e);if(!t)return`unknown`;let n=kt.get(t);if(n!==void 0)return n;let r;return r=Tt(t)?`expo`:wt(t)?`react-native`:Et(t)?`web`:Dt(t)?`neutral`:`unknown`,kt.set(t,r),r},jt=e=>x(e,`Identifier`)?e.name:x(e,`Literal`)&&typeof e.value==`string`?e.value:null,Mt=e=>{if(x(e,`ImportSpecifier`)){let t=e.imported;return x(t,`Identifier`)?t.name:x(t,`Literal`)&&typeof t.value==`string`?t.value:null}return x(e,`ImportDefaultSpecifier`)?`default`:null},Nt=(e,t)=>{if(!x(e,`ExportNamedDeclaration`)||!e.source||e.exportKind===`type`)return null;let n=e.source.value;if(typeof n!=`string`)return null;for(let r of e.specifiers??[]){let e=Pt(r,t,n);if(e)return e}return null},Pt=(e,t,n)=>{if(!x(e,`ExportSpecifier`)||e.exportKind===`type`||jt(e.exported)!==t)return null;let r=jt(e.local);return r?{importedName:r,source:n}:null},Ft=(e,t)=>{if(!x(e,`ExportAllDeclaration`)||!e.source||e.exportKind===`type`||e.exported)return null;let n=e.source.value;return typeof n==`string`?{importedName:t,source:n}:null},It=(e,t)=>{if(!x(e,`Program`))return[];let n=[];for(let r of e.body??[]){let e=Nt(r,t);if(e)return[e];let i=Ft(r,t);i&&n.push(i)}return n},Lt=new Set([`ParenthesizedExpression`,`TSAsExpression`,`TSSatisfiesExpression`,`TSTypeAssertion`,`TSNonNullExpression`,`TSInstantiationExpression`,`ChainExpression`]),O=e=>{let t=e;for(;;)switch(t.type){case`ParenthesizedExpression`:case`TSAsExpression`:case`TSSatisfiesExpression`:case`TSTypeAssertion`:case`TSNonNullExpression`:case`TSInstantiationExpression`:case`ChainExpression`:if(!(`expression`in t)||!t.expression)return t;t=t.expression;break;default:return t}},Rt=(e,t)=>{if(!x(e,`Program`))return null;let n=new Map,r=new Map,i=null,a=null,o=e=>{for(let t of e.declarations??[])x(t,`VariableDeclarator`)&&(!x(t.id,`Identifier`)||!t.init||n.set(t.id.name,O(t.init)))};for(let t of e.body??[]){if(x(t,`ImportDeclaration`)){if(t.importKind===`type`)continue;for(let e of t.specifiers??[])x(e,`ImportSpecifier`)&&e.importKind===`type`||(x(e,`ImportDefaultSpecifier`)||x(e,`ImportNamespaceSpecifier`)||x(e,`ImportSpecifier`))&&x(e.local,`Identifier`)&&n.set(e.local.name,e.local);continue}if(x(t,`VariableDeclaration`)){o(t);continue}if(x(t,`FunctionDeclaration`)&&t.id){n.set(t.id.name,t);continue}if(x(t,`ExportNamedDeclaration`)){if(t.exportKind===`type`)continue;let e=t.declaration;if(e&&x(e,`VariableDeclaration`)){o(e);for(let t of e.declarations??[])x(t,`VariableDeclarator`)&&x(t.id,`Identifier`)&&r.set(t.id.name,t.id.name)}else e&&x(e,`FunctionDeclaration`)&&e.id&&(n.set(e.id.name,e),r.set(e.id.name,e.id.name));if(t.source)continue;for(let e of t.specifiers??[]){if(!x(e,`ExportSpecifier`)||e.exportKind===`type`)continue;let t=x(e.local,`Identifier`)?e.local.name:null,n=null;x(e.exported,`Identifier`)?n=e.exported.name:x(e.exported,`Literal`)&&typeof e.exported.value==`string`&&(n=e.exported.value),t&&n&&r.set(n,t)}continue}if(!x(t,`ExportDefaultDeclaration`))continue;let e=t.declaration;e&&(x(e,`Identifier`)?a=e.name:((x(e,`FunctionDeclaration`)||x(e,`ClassDeclaration`))&&e.id&&n.set(e.id.name,e),i=O(e)))}if(t===`default`){if(i)return i;if(a){let e=n.get(a);if(e)return e}}let s=r.get(t);return s?n.get(s)??null:null},zt=e=>{let t=(e,n)=>{let r=e;r.parent=n,r.range==null&&typeof r.start==`number`&&typeof r.end==`number`&&(r.range=[r.start,r.end]);let i=e;for(let n of Object.keys(i)){if(n===`parent`)continue;let r=i[n];if(Array.isArray(r))for(let n of r)y(n)&&t(n,e);else y(r)&&t(r,e)}};t(e,null)},Bt={".ts":`ts`,".tsx":`tsx`,".js":`js`,".jsx":`jsx`,".mjs":`js`,".cjs":`js`,".mts":`ts`,".cts":`ts`},Vt=e=>Bt[i.extname(e).toLowerCase()]??`tsx`,Ht=({filename:t,sourceText:n,shouldAttachParentReferences:r=!0})=>{try{let i=e(t,n,{astType:`ts`,lang:Vt(t)});if(i.errors.some(e=>e.severity===`Error`))return null;let a=i.program;return r&&zt(a),a}catch{return null}},Ut=new Map,Wt=e=>{e.endsWith(`.d.ts`)||e.endsWith(`.d.mts`)||e.endsWith(`.d.cts`)||D(e);let t;try{t=r.statSync(e)}catch{return null}if(!t.isFile()||t.size>2e6)return null;let n=Ut.get(e);if(n&&n.mtimeMs===t.mtimeMs&&n.size===t.size)return n.program;if(e.endsWith(`.d.ts`)||e.endsWith(`.d.mts`)||e.endsWith(`.d.cts`))return Ut.set(e,{mtimeMs:t.mtimeMs,size:t.size,program:null}),null;let i;try{i=r.readFileSync(e,`utf8`)}catch{return Ut.set(e,{mtimeMs:t.mtimeMs,size:t.size,program:null}),null}let a=Ht({filename:e,sourceText:i});return Ut.set(e,{mtimeMs:t.mtimeMs,size:t.size,program:a}),a},Gt=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`,`.cjs`,`.mts`,`.cts`],Kt=[`import`,`default`,`module`,`browser`,`require`],qt=[`module`,`main`,`browser`],Jt={isDirectory:!0,isFile:!1},Yt={isDirectory:!1,isFile:!0},Xt={isDirectory:!1,isFile:!1},Zt=new Map,Qt=new Map,$t=e=>{dt(e);let t=Zt.get(e);if(t)return t;let n=Xt;try{let t=r.statSync(e);t.isFile()?n=Yt:t.isDirectory()&&(n=Jt)}catch{return Zt.set(e,Xt),Xt}return Zt.set(e,n),n},en=e=>$t(e).isFile?e:null,tn=e=>$t(e).isDirectory?e:null,nn=e=>{let t=i.extname(e);if(!Gt.includes(t))return Gt.map(t=>`${e}${t}`);let n=e.slice(0,-t.length);return t===`.js`?[e,`${n}.ts`,`${n}.tsx`,`${n}.jsx`]:t===`.jsx`?[e,`${n}.tsx`]:t===`.mjs`?[e,`${n}.mts`]:t===`.cjs`?[e,`${n}.cts`]:[e]},rn=e=>typeof e==`object`&&!!e,an=e=>{if(typeof e==`string`)return e;if(Array.isArray(e)){for(let t of e){let e=an(t);if(e)return e}return null}if(!rn(e))return null;for(let t of Kt){let n=an(e[t]);if(n)return n}return null},on=e=>{let t=e.exports;return t?an(t)||(rn(t)?an(t[`.`]):null):null},sn=e=>{D(e);let t=Qt.get(e);if(t!==void 0)return t;let n;try{n=JSON.parse(r.readFileSync(e,`utf8`))}catch{n=null}return Qt.set(e,n),n},cn=e=>un(e)||un(i.join(e,`index`)),ln=e=>{let t=tn(e);if(!t)return null;let n=sn(i.join(t,`package.json`));if(!n)return null;let r=on(n)??qt.map(e=>n[e]).find(e=>typeof e==`string`);return r?cn(i.resolve(t,r)):null},un=e=>{let t=en(e);if(t)return t;for(let t of nn(e)){let e=en(t);if(e)return e}return null},dn=e=>un(e)||ln(e)||un(i.join(e,`index`)),fn=(e,t)=>dn(i.resolve(i.dirname(e),t)),pn=()=>{Zt.clear(),Qt.clear()},mn=[`tsconfig.json`,`jsconfig.json`],hn=e=>typeof e==`object`&&!!e,gn=e=>{let t=``,n=!1,r=!1,i=!1;for(let a=0;a<e.length;a++){let o=e[a],s=e[a+1];if(r){o===`
2
- `&&(r=!1,t+=o);continue}if(i){o===`*`&&s===`/`&&(i=!1,a++);continue}if(n){t+=o,o===`\\`?(t+=s??``,a++):o===`"`&&(n=!1);continue}if(o===`"`){n=!0,t+=o;continue}if(o===`/`&&s===`/`){r=!0,a++;continue}if(o===`/`&&s===`*`){i=!0,a++;continue}t+=o}return t.replace(/,(\s*[}\]])/g,`$1`)},_n=(e,t)=>{D(e),t.push(e);let n;try{n=r.readFileSync(e,`utf8`)}catch{return null}try{let e=JSON.parse(gn(n));return hn(e)?e:null}catch{return null}},vn=(e,t)=>{let n=e.endsWith(`.json`)?e:`${e}.json`;return e.startsWith(`./`)||e.startsWith(`../`)?i.resolve(t,n):i.join(t,`node_modules`,n)},yn=e=>{let t=new Map;if(!hn(e))return t;for(let[n,r]of Object.entries(e)){if(!Array.isArray(r))continue;let e=r.filter(e=>typeof e==`string`);e.length>0&&t.set(n,e)}return t},bn=(e,t,n)=>{let r=_n(e,n);if(!r)return null;let a=i.dirname(e),o=hn(r.compilerOptions)?r.compilerOptions:{},s=typeof o.baseUrl==`string`?o.baseUrl:null,c=s!==null,l=s===null?a:i.resolve(a,s);if(hn(o.paths))return{baseAbsolutePath:l,hasExplicitBaseUrl:c,paths:yn(o.paths)};if(typeof r.extends==`string`&&t<8){let e=vn(r.extends,a),i=e?bn(e,t+1,n):null;if(i)return i}return c?{baseAbsolutePath:l,hasExplicitBaseUrl:c,paths:new Map}:null},xn=new Map,Sn=new Map,Cn=e=>{D(e);let t;try{t=r.statSync(e)}catch{return{config:null,probedContentPaths:new Set([e])}}let n=xn.get(e);if(n&&n.mtimeMs===t.mtimeMs){for(let e of n.probedChainPaths)D(e);return{config:n.config,probedContentPaths:new Set(n.probedChainPaths)}}let i=[],a=bn(e,0,i);return xn.set(e,{mtimeMs:t.mtimeMs,config:a,probedChainPaths:i}),{config:a,probedContentPaths:new Set(i)}},wn=(e,t,n)=>{let r=new Set(t.probedContentPaths),i=n;for(let n=e.length-1;n>=0;n--){let a=e[n];i++;for(let e of a.probedContentPaths)r.add(e);Sn.set(a.directory,{config:t.config,directoryCount:i,probedContentPaths:new Set(r)})}},Tn=e=>{let t=Sn.get(e);if(t!==void 0){for(let e of t.probedContentPaths)D(e);return t.config}let n=[],r=e;for(let e=0;e<30;e++){let t=Sn.get(r),a=30-e;if(t!==void 0&&t.directoryCount<=a){for(let e of t.probedContentPaths)D(e);return wn(n,t,t.directoryCount),t.config}let o=new Set;for(let e of mn){let t=Cn(i.join(r,e));for(let e of t.probedContentPaths)o.add(e);if(t.config)return n.push({directory:r,probedContentPaths:o}),wn(n,{config:t.config,probedContentPaths:new Set},0),t.config}n.push({directory:r,probedContentPaths:o});let s=i.dirname(r);if(s===r)return wn(n,{config:null,probedContentPaths:new Set},0),null;r=s}let a=new Set;for(let e of n)for(let t of e.probedContentPaths)a.add(t);return Sn.set(e,{config:null,directoryCount:n.length,probedContentPaths:a}),null},En=(e,t)=>{let n=t.indexOf(`*`);if(n===-1)return e===t?``:null;let r=t.slice(0,n),i=t.slice(n+1);return e.length>=r.length+i.length&&e.startsWith(r)&&e.endsWith(i)?e.slice(r.length,e.length-i.length):null},Dn=(e,t)=>{let n=Tn(i.dirname(e));if(!n)return null;let r=null,a=``,o=-1;for(let e of n.paths.keys()){let n=En(t,e);if(n===null)continue;let i=e.indexOf(`*`),s=i===-1?e.length:i;s>o&&(r=e,a=n,o=s)}if(r)for(let e of n.paths.get(r)??[]){let t=e.replaceAll(`*`,a),r=dn(i.resolve(n.baseAbsolutePath,t));if(r)return r}return n.hasExplicitBaseUrl?dn(i.resolve(n.baseAbsolutePath,t)):null},On=()=>{xn.clear(),Sn.clear()},kn=(e,t)=>i.isAbsolute(t)?null:t.startsWith(`.`)?fn(e,t):Dn(e,t),An=new Map,jn=()=>{An.clear()},Mn=(e,t,n)=>{if(n.size>=4||n.has(e))return null;n.add(e);let r=Wt(e);if(!r)return null;let i=Rt(r,t);if(i)return{filePath:e,exportedNode:i,programNode:r};let a=new Map;for(let i of It(r,t)){let t=kn(e,i.source);if(!t)continue;let r=Mn(t,i.importedName,new Set(n));r&&a.set(r.exportedNode,r)}return a.size===1?a.values().next().value??null:null},Nn=(e,t,n)=>Pn(e,t,n)?.functionNode??null,Pn=(e,t,n)=>{let r=k(e,t,n);return!r||!b(r.exportedNode)?null:{filePath:r.filePath,functionNode:r.exportedNode,programNode:r.programNode}},k=(e,t,n)=>{if(!ft()){let r=kn(e,t);return r?Mn(r,n,new Set):null}let r=`${e}\0${t}\0${n}`,i=An.get(r);if(i!==void 0){for(let e of i.trace.contentPaths)D(e);for(let e of i.trace.existencePaths)dt(e);return i.result}let a=pt(()=>{let r=kn(e,t);return r?Mn(r,n,new Set):null});return An.set(r,{result:a.value,trace:a.trace}),a.value},Fn=(e,t)=>{let n=e,r=he[e.type];if(r!==void 0){for(let e=r.length-1;e>=0;--e){let i=n[r[e]];if(Array.isArray(i))for(let e=i.length-1;e>=0;--e){let n=i[e];y(n)&&t.push(n)}else y(i)&&t.push(i)}return}let i=Object.keys(n);for(let e=i.length-1;e>=0;--e){let r=i[e];if(r===`parent`)continue;let a=n[r];if(Array.isArray(a))for(let e=a.length-1;e>=0;--e){let n=a[e];y(n)&&t.push(n)}else y(a)&&t.push(a)}},In=(e,t)=>{let n=e,r=he[e.type];if(r!==void 0){for(let e=0;e<r.length;e+=1){let i=n[r[e]];if(Array.isArray(i))for(let e=0;e<i.length;e+=1){let n=i[e];y(n)&&t(n)}else y(i)&&t(i)}return}for(let e in n){if(e===`parent`||!Object.hasOwn(n,e))continue;let r=n[e];if(Array.isArray(r))for(let e=0;e<r.length;e+=1){let n=r[e];y(n)&&t(n)}else y(r)&&t(r)}},A=(e,t)=>{if(!e||typeof e!=`object`)return;let n=[e];for(;n.length>0;){let e=n.pop();e===void 0||t(e)===!1||Fn(e,n)}},Ln=({absoluteFilePath:e,staticImports:t,program:n})=>{let r=new Set;if(A(n,e=>{if(e.type!==`JSXOpeningElement`)return;let t=e.name;if(t){if(t.type===`JSXIdentifier`){let e=t.name;typeof e==`string`&&r.add(e)}else if(t.type===`JSXMemberExpression`){let e=t.property;e?.type===`JSXIdentifier`&&typeof e.name==`string`&&r.add(e.name)}else if(t.type===`JSXNamespacedName`){let e=t.namespace;typeof e?.name==`string`&&r.add(e.name)}}}),r.size!==0)for(let n of t)for(let t of n.entries){let{importName:i}=t;if(i.kind===`NamespaceObject`||!r.has(t.localName.value))continue;let a=i.kind===`Default`?`default`:i.name;a&&Nn(e,n.moduleRequest.value,a)}},Rn=e=>e.replace(/^type\s+/,``).trim(),zn=(e,t)=>e.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>{let n=t||e.startsWith(`type `),[r,i]=e.split(/\s+as\s+/),a=Rn(r??``);return{localName:a,exportedName:Rn(i??a),isTypeOnly:n}}),Bn=/\/\*[\s\S]*?\*\//g,Vn=/^\s*\/\/.*$/gm,Hn=e=>e.replace(Bn,``).replace(Vn,``),Un=/^\s*export\s+default\b/m,Wn=/^\s*export\s+(?:declare\s+)?(?:(?:async\s+)?function|(?:abstract\s+)?class|const|let|var|enum|interface|type)\s+([\w$]+)/gm,Gn=/^\s*export\s+(?:type\s+)?\{([\s\S]*?)\}(?:\s+from\s+["'][^"']+["'])?\s*;?\s*(?:(?:\/\/[^\n]*)?\s*)/gm,Kn=e=>{let t=Hn(e),n=new Set;Un.test(t)&&n.add(`default`);for(let e of t.matchAll(Wn))e[1]&&n.add(e[1]);for(let e of t.matchAll(Gn)){let t=e[1]??``;for(let e of zn(t,!1))n.add(e.exportedName)}return n},qn=new Map,Jn=(e,t)=>{D(e);try{let n=r.statSync(e),i=qn.get(e);if(i&&i.mtimeMs===n.mtimeMs&&i.size===n.size)return i.exportedNames.has(t);let a=Kn(r.readFileSync(e,`utf8`));return qn.set(e,{mtimeMs:n.mtimeMs,size:n.size,exportedNames:a}),a.has(t)}catch{return!1}},Yn=(e,t)=>{let n=e.replaceAll(`\\`,`/`),r=i.dirname(n);for(let e=0;e<30;e++){for(let e of Be){let a=i.join(r,e);if(a.replaceAll(`\\`,`/`)!==n&&t(a))return!0}let e=i.dirname(r);if(i.basename(r)===`app`&&i.basename(e)!==`app`||e===r)break;r=e}return!1},Xn=e=>Yn(e,e=>Ve.some(t=>Jn(e,t))),j=e=>{if(!x(e,`ImportSpecifier`))return;let t=e.imported;if(x(t,`Identifier`))return t.name;if(x(t,`Literal`)&&typeof t.value==`string`)return t.value},Zn=e=>x(e,`JSXIdentifier`)?e.name===`Suspense`:x(e,`JSXMemberExpression`)&&x(e.property,`JSXIdentifier`)&&e.property.name===`Suspense`,Qn=e=>{let t=!1;return A(e,e=>{if(t)return!1;if(x(e,`JSXOpeningElement`)&&Zn(e.name)||x(e,`ImportDeclaration`)&&e.source?.value===`react`&&(e.specifiers??[]).some(e=>x(e,`ImportSpecifier`)&&j(e)===`Suspense`))return t=!0,!1}),t},$n=e=>Yn(e,e=>{let t=Wt(e);return!!(t&&Qn(t))}),er=e=>{if(x(e,`ImportDeclaration`)){if(e.importKind===`type`||e.specifiers.length>0&&e.specifiers.every(e=>x(e,`ImportSpecifier`)&&e.importKind===`type`))return null}else if(x(e,`ExportNamedDeclaration`)){if(e.exportKind===`type`||!e.source||e.specifiers.length>0&&e.specifiers.every(e=>x(e,`ExportSpecifier`)&&e.exportKind===`type`))return null}else if(x(e,`ExportAllDeclaration`)){if(e.exportKind===`type`)return null}else return null;return e.source&&typeof e.source.value==`string`?e.source.value:null},M=e=>{let t=e.property;return!e.computed&&x(t,`Identifier`)?t.name:e.computed&&x(t,`Literal`)?typeof t.value==`string`?t.value:null:e.computed&&x(t,`TemplateLiteral`)&&t.expressions.length===0?t.quasis[0]?.value.cooked??t.quasis[0]?.value.raw??null:null},tr=/^index\.(?:[cm]?[jt]sx?|mjs)$/,nr=/^\s*import\s+(type\s+)?(?!["'])([^;]*?)\s+from\s+["']([^"']+)["']\s*;?\s*(?:(?:\/\/[^\n]*)?\s*)/gm,rr=/^\s*export\s+(type\s+)?(?:\*(?:\s+as\s+([\w$]+))?|\{([\s\S]*?)\})\s+from\s+["']([^"']+)["']\s*;?\s*(?:(?:\/\/[^\n]*)?\s*)/gm,ir=/^\s*export\s+(type\s+)?\{([\s\S]*?)\}\s*;?\s*(?:(?:\/\/[^\n]*)?\s*)/gm,ar=new Map,or=e=>tr.test(i.basename(e)),sr=()=>({isBarrel:!1,exportsByName:new Map,starExportSources:[]}),cr=(e,t)=>{e.set(t.localName,{...t,didExport:!1})},lr=(e,t,n,r)=>{for(let i of zn(e,n))cr(r,{localName:i.exportedName,importedName:i.localName,source:t,isTypeOnly:i.isTypeOnly})},ur=(e,t,n,r)=>{let i=e.trim(),a=i.match(/(?:^|,\s*)\*\s+as\s+([\w$]+)/);a?.[1]&&cr(r,{localName:a[1],importedName:`*`,source:t,isTypeOnly:n});let o=i.match(/\{([\s\S]*?)\}/);o?.[1]&&lr(o[1],t,n,r);let s=i.split(`,`)[0]?.trim();s&&!s.startsWith(`{`)&&!s.startsWith(`*`)&&cr(r,{localName:s,importedName:`default`,source:t,isTypeOnly:n})},dr=(e,t,n,r)=>{let i=e.replace(nr,(e,n,r,i)=>(ur(r,i,!!n,t),``));return i=i.replace(rr,(e,t,i,a,o)=>{let s=!!t;if(i)return n.set(i,{exportedName:i,importedName:`*`,source:o,isTypeOnly:s}),``;if(a){for(let e of zn(a,s))n.set(e.exportedName,{exportedName:e.exportedName,importedName:e.localName,source:o,isTypeOnly:e.isTypeOnly});return``}return r.push(o),``}),i=i.replace(ir,(e,r,i)=>{for(let a of zn(i,!!r)){let r=t.get(a.localName);if(!r)return e;r.didExport=!0,n.set(a.exportedName,{exportedName:a.exportedName,importedName:r.importedName,source:r.source,isTypeOnly:a.isTypeOnly||r.isTypeOnly})}return``}),i},fr=e=>{for(let t of e.values())if(!t.isTypeOnly&&!t.didExport)return!0;return!1},pr=e=>{let t=Hn(e).trim();if(!t)return sr();let n=new Map,r=new Map,i=[];return dr(t,n,r,i).trim()||fr(n)?sr():{isBarrel:r.size>0||i.length>0,exportsByName:r,starExportSources:i}},mr=e=>{if(!or(e))return sr();D(e);let t;try{t=r.statSync(e)}catch{t=null}let n=ar.get(e);if(n!==void 0&&t!==null&&n.mtimeMs===t.mtimeMs&&n.size===t.size)return n.moduleInfo;if(t===null)return sr();let i=sr();try{i=pr(r.readFileSync(e,`utf8`))}catch{i=sr()}return ar.set(e,{mtimeMs:t.mtimeMs,size:t.size,moduleInfo:i}),i},hr=e=>mr(e).isBarrel,gr=i.join(`android`,`gradle.properties`),_r=/^\s*newArchEnabled\s*=\s*false\s*$/m,vr=[`app.config.ts`,`app.config.js`,`app.config.cjs`,`app.config.mjs`],yr=[`app.config.json`,`app.json`],br=new WeakMap,xr=e=>{D(i.join(e,gr));for(let t of vr)dt(i.join(e,t));for(let t of yr)D(i.join(e,t))},Sr=e=>{try{return r.readFileSync(e,`utf-8`)}catch{return null}},Cr=e=>{let t=e.dependencies?.[`react-native`]??e.devDependencies?.[`react-native`];return typeof t==`string`?t:null},wr=e=>{let t=e.match(/(?:^|[^\d.])0\.(\d+)/);return t?Number.parseInt(t[1],10):null},Tr=e=>{let t=Sr(i.join(e,gr));return t!==null&&_r.test(t)},Er=e=>{for(let t of vr)if(r.existsSync(i.join(e,t)))return!1;for(let t of yr){let n=Sr(i.join(e,t));if(n===null)continue;let r;try{r=JSON.parse(n)}catch{continue}if(typeof r!=`object`||!r)continue;let a=Object.getOwnPropertyDescriptor(r,`expo`)?.value;if(!(typeof a!=`object`||!a)&&Object.getOwnPropertyDescriptor(a,`newArchEnabled`)?.value===!1)return!0}return!1},Dr=(e,t)=>{let n=Cr(t);if(n!==null){let e=wr(n);if(e!==null&&e<76)return!0}return Tr(e)||Er(e)},Or=e=>{let t=vt(e);if(!t)return!1;let n=yt(e);if(!n)return!1;xr(t);let r=br.get(n);if(r!==void 0)return r;let i=Dr(t,n);return br.set(n,i),i},kr=e=>{let t=e.match(/^(\d+)(?:\.(\d+))?(?:\.(\d+))?(-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/);return t?{major:Number(t[1]),minor:Number(t[2]??0),patch:Number(t[3]??0),isPrerelease:!!t[4]}:null},Ar=(e,t)=>e.major-t.major||e.minor-t.minor||e.patch-t.patch||Number(t.isPrerelease)-Number(e.isPrerelease),jr=e=>{if(typeof e!=`string`)return null;let t=e.trim();if(!t||/^(?:catalog|file|git|https?|link|npm|workspace):/.test(t)||/^(?:latest|next|\*)$/.test(t))return null;let n=[];for(let e of t.split(`||`)){let t=e.trim();if(/^<(?!=)/.test(t)||/^<=/.test(t))return null;let r=t.match(/\d+(?:\.\d+)?(?:\.\d+)?(?:-[0-9A-Za-z.-]+)?/)?.[0];if(!r)return null;let i=kr(r);if(!i)return null;n.push(i)}return n.reduce((e,t)=>Ar(t,e)<0?t:e)},Mr=e=>jr(e.dependencies?.ink??e.devDependencies?.ink??e.peerDependencies?.ink??e.optionalDependencies?.ink),Nr=e=>{let t=e;for(;;){let e=bt(i.join(t,`node_modules`,`ink`));if(e)return{didFindPackage:!0,version:typeof e.version==`string`?kr(e.version):null};let n=i.dirname(t);if(n===t)return{didFindPackage:!1,version:null};t=n}},Pr=e=>{if(!e)return null;let t=vt(i.resolve(e));if(!t)return null;let n=Nr(t);if(n.didFindPackage)return n.version;let r=bt(t);return r?Mr(r):null},Fr=(e,t)=>{let n=Pr(e),r=kr(t);return!!(n&&r&&Ar(n,r)>=0)},Ir=new Set([`@monaco-editor/react`,`monaco-editor`,`recharts`,`@react-pdf/renderer`,`react-quill`,`@codemirror/view`,`@codemirror/state`,`chart.js`,`react-chartjs-2`,`@toast-ui/editor`,`draft-js`,`mermaid`]),Lr=new Set([`fetch`,`ky`,`got`,`wretch`,`ofetch`]),Rr=new Set([`axios`,`ky`,`got`,`ofetch`,`wretch`,`request`]),zr=new Set([`create`,`insert`,`insertInto`,`update`,`upsert`,`delete`,`remove`,`destroy`,`set`,`append`]),Br=new Set([`POST`,`PUT`,`DELETE`,`PATCH`]),Vr=new Set([`Map`,`Set`,`WeakMap`,`WeakSet`,`Headers`,`URLSearchParams`,`FormData`,`Response`,`NextResponse`]),Hr=new Set([`Response`,`NextResponse`]),Ur=new Set([`json`,`redirect`,`next`,`rewrite`,`error`]),Wr=new Set([`wheel`,`mousewheel`,`touchstart`,`touchmove`]),Gr=new Set([`defer`,`async`]),Kr=new Set([`text/javascript`,`application/javascript`,`module`]),qr=new Set([`setTimeout`,`setInterval`,`requestAnimationFrame`,`requestIdleCallback`,`queueMicrotask`]),Jr=new Set([`setInterval`,`setTimeout`]),Yr=new Set([`clearInterval`,`clearTimeout`]),Xr=new Set([`WebSocket`,`EventSource`,`BroadcastChannel`,`RTCPeerConnection`]),Zr=new Set([`location`,`window`,`document`,`navigator`,`history`,`screen`,`performance`]),Qr=new Set([`IntersectionObserver`,`MutationObserver`,`ResizeObserver`,`PerformanceObserver`]),$r=new Set([`blur`,`canPlayType`,`focus`,`getBoundingClientRect`,`getClientRects`,`measure`,`measureInWindow`,`measureLayout`,`scroll`,`scrollBy`,`scrollIntoView`,`scrollTo`,`select`,`setRangeText`,`setSelectionRange`]),ei=new Set([`localStorage`,`sessionStorage`]),ti=new Set([`index`,`idx`,`i`]),ni=new Set([`react`,`react-dom`,`preact/compat`,`preact/hooks`,`@wordpress/element`]),ri=new Set([`next`,`next-themes`,`@remix-run/react`,`swr`,`zustand`,`jotai`,`recoil`,`wouter`,`framer-motion`,`@apollo/client`,`urql`,`usehooks-ts`]),ii=/^(?:isLoading|isPending)$/,ai=new Set([`useState`,`useMemo`,`useRef`]),oi=new Set([`Click`,`Change`,`Input`,`Blur`,`Focus`]),si=new Set([`Boolean`,`String`,`Number`,`Array`,`Object`,`parseInt`,`parseFloat`]),ci=/^set[A-Z]/,li=/^render[A-Z]/,ui=/^[A-Z]/,di=/^on[A-Z]/,fi=/^use[A-Z]/,pi=/^(?:on|handle)[A-Z]/,mi=new Set([`useEffect`,`useLayoutEffect`]),hi=new Set([`useEffect`,`useLayoutEffect`,`useMemo`,`useCallback`]),gi=new Set([`use`,`useState`,`useRef`,`useMemo`,`useCallback`,`useReducer`,`useContext`,`useEffect`,`useLayoutEffect`,`useInsertionEffect`,`useImperativeHandle`,`useSyncExternalStore`,`useDeferredValue`,`useTransition`,`useId`,`useDebugValue`]),_i=new Set([`memo`,`forwardRef`,`React.memo`,`React.forwardRef`]),vi=new Set([`useMemo`,`useCallback`]),yi=new Set([`memo`,`forwardRef`,`observer`,`lazy`]),bi=new Set([`subscribe`,`addEventListener`,`addListener`,`on`,`watch`,`listen`,`sub`]),xi=new Set([`subscribe`,`sub`,`listen`]),Si=new Set([`unsubscribe`,`removeEventListener`,`removeListener`,`off`,`unwatch`,`unlisten`,`unsub`,`abort`,`disconnect`,`unobserve`,`close`]),Ci=new Set([`remove`,`cleanup`,`dispose`,`destroy`,`stop`,`teardown`]),wi=new Set([...Si,`cleanup`,`dispose`,`destroy`,`teardown`]),Ti=new Set([...bi,`connect`,`disconnect`,`open`,`close`,`fetch`,`post`,`put`,`patch`]),Ei=new Set([`get`,`head`,`options`,`delete`]),Di=new Set([...Lr,...qr]),Oi=new Set([...Lr,`post`,`put`,`patch`,`navigate`,`navigateTo`,`showNotification`,`toast`,`alert`,`confirm`,`logVisit`,`captureEvent`]),ki=new Set([`post`,`put`,`patch`,`delete`,`navigate`,`capture`,`track`,`logEvent`]),Ai=new Set([`push`,`replace`]),ji=new Set([`router`,`navigation`,`navigator`,`history`,`location`]),N=(e,t={})=>{if(!x(e,`Property`)&&!x(e,`MethodDefinition`)&&!x(e,`PropertyDefinition`)&&!x(e,`MemberExpression`))return null;let n=x(e,`MemberExpression`)?e.property:e.key;if(e.computed)return t.allowComputedString&&x(n,`Literal`)&&typeof n.value==`string`?n.value:t.allowComputedString&&t.stringifyNonStringLiterals&&x(n,`Literal`)?String(n.value):t.allowComputedString&&x(n,`TemplateLiteral`)&&n.expressions.length===0?n.quasis[0]?.value.cooked??n.quasis[0]?.value.raw??null:null;if(x(n,`Identifier`))return n.name;if(x(n,`Literal`)){if(typeof n.value==`string`)return n.value;if(t.stringifyNonStringLiterals)return String(n.value)}return null},P=(e,t,n=!1)=>{if(e.type!==`Identifier`&&e.type!==`JSXIdentifier`)return null;let r=null,i=t.symbolFor(e);for(;i?.kind===`const`;){if(!i.initializer||i.declarationNode.type!==`VariableDeclarator`)return null;if(i.declarationNode.id!==i.bindingIdentifier)return n?i:null;let e=O(i.initializer);if(e.type!==`Identifier`)return i;if(r?.has(i.id))return null;r||=new Set,r.add(i.id),i=t.symbolFor(e)}return i},Mi={},Ni=new WeakMap,Pi=(e,t)=>typeof e==`string`?e===t:e.has(t),Fi=e=>{let t=Ni.get(e);if(t)return t;let n=e.declarationNode.parent,r=!!(e.kind===`import`&&n&&n.type===`ImportDeclaration`&&typeof n.source.value==`string`&&ni.has(n.source.value)),i={importedName:r?j(e.declarationNode):void 0,isReactImport:r};return Ni.set(e,i),i},Ii=e=>Fi(e).isReactImport,Li=(e,t,n,r)=>{if(e.type!==`Identifier`)return!1;let i=r?P(e,n):n.symbolFor(e);if(!i)return!1;let a=Fi(i);return!!(a.isReactImport&&a.importedName&&Pi(t,a.importedName))},Ri=(e,t)=>{let n=P(e,t);if(!n)return!1;let r=Fi(n);return r.isReactImport?n.declarationNode.type===`ImportDefaultSpecifier`||n.declarationNode.type===`ImportNamespaceSpecifier`||r.importedName===`default`:!1},zi=(e,t,n)=>e.type===`Identifier`?Ri(e,t)?!0:!!(n.allowGlobalReactNamespace&&e.name===`React`&&t.isGlobalReference(e)):!1,Bi=(e,t,n,r)=>{let i=n.symbolFor(e);if(!i||i.kind!==`const`||!i.initializer||i.declarationNode.type!==`VariableDeclarator`)return!1;let a=i.declarationNode.id;if(a.type!==`ObjectPattern`)return!1;for(let e of a.properties){if(e.type!==`Property`||e.value!==i.bindingIdentifier)continue;let a=N(e);return!!(a&&Pi(t,a)&&zi(O(i.initializer),n,r))}return!1},Vi=(e,t,n,r=Mi)=>e.type===`CallExpression`?Hi(e.callee,t,n,r):!1,Hi=(e,t,n,r,i)=>{let a=O(e);if(r.resolveConditionalAliases&&a.type===`ConditionalExpression`)return Hi(a.consequent,t,n,r,new Set(i))&&Hi(a.alternate,t,n,r,new Set(i));if(a.type===`Identifier`){if(Li(a,t,n,!!r.resolveNamedAliases)||r.resolveNamedAliases&&Bi(a,t,n,r))return!0;if(r.resolveConditionalAliases){let e=n.symbolFor(a);if(e?.kind===`const`&&e.initializer&&!i?.has(e.id)){let a=i??new Set;return a.add(e.id),Hi(e.initializer,t,n,r,a)}}return!!(r.allowUnboundBareCalls&&Pi(t,a.name)&&n.isGlobalReference(a))}return a.type!==`MemberExpression`||!Pi(t,M(a)??``)?!1:zi(O(a.object),n,r)},Ui=e=>e.includes(`\\`)?e.replaceAll(`\\`,`/`):e,Wi=e=>{let t=new Set(e);if(t.size!==1)return null;let[n]=t;return n??null},Gi=(e,t,n,r)=>{let i=fn(e,n);return i?Ki(i,t,new Set(r))||(Jn(i,t)?i:null):null},Ki=(e,t,n=new Set)=>{if(n.has(e))return null;n.add(e);let r=mr(e);if(!r.isBarrel)return null;let i=r.exportsByName.get(t);if(i){let t=fn(e,i.source);return t?Ki(t,i.importedName,n)??t:null}return t===`default`?null:Wi(r.starExportSources.map(r=>Gi(e,t,r,n)).filter(e=>!!e))},qi=(e,t,n)=>{let r=k(e,t,n);return r?{filePath:r.filePath,node:r.exportedNode,programNode:r.programNode,kind:b(r.exportedNode)?`function`:`initializer`}:null},F=e=>{let t=e;for(;t.parent&&Lt.has(t.parent.type);)t=t.parent;return t},Ji=(e,t)=>{if(!x(e,`ArrowFunctionExpression`)&&!x(e,`FunctionExpression`)&&!x(e,`FunctionDeclaration`))return null;let n=e.params[0],r=x(n,`AssignmentPattern`)?n.left:n;if(x(r,`ObjectPattern`)){let e=r.properties.find(e=>x(e,`Property`)&&N(e,{allowComputedString:!0})===`children`);if(!e||!x(e,`Property`))return null;let n=x(e.value,`AssignmentPattern`)?e.value.left:e.value;if(!x(n,`Identifier`))return null;let i=t.symbolFor(n);return!i||i.references.length===0||i.references.some(e=>e.flag!==`read`)?null:i.references.map(e=>e.identifier)}if(!x(r,`Identifier`))return null;let i=t.symbolFor(r);if(!i||i.references.length===0)return null;let a=[];for(let e of i.references){if(e.flag!==`read`)return null;let t=[],n=F(e.identifier);for(;n.parent&&x(n.parent,`MemberExpression`)&&n.parent.object===n;){let e=M(n.parent);if(!e)return null;t.push(e),n=F(n.parent)}if(t[0]!==`children`){if(t.length===0)return null;continue}if(t.length!==1)return null;a.push(n)}return a.length>0?a:null},I=e=>{let t=e.parent;for(;t;){if(b(t))return t;t=t.parent??null}return null},Yi=e=>{let t=e;for(;t;){if(x(t,`Program`))return t;t=t.parent??null}return null},Xi=e=>{let t=new Map,n=e.body??[];for(let e of n){if(e.type!==`ImportDeclaration`||!(`source`in e)||!e.source)continue;let n=e.source.value;if(typeof n==`string`&&!(!(`specifiers`in e)||!Array.isArray(e.specifiers)))for(let r of e.specifiers){if(!(`local`in r)||!r.local)continue;let e=r.local;if(typeof e.name==`string`){if(r.type===`ImportDefaultSpecifier`)t.set(e.name,{source:n,imported:null,isDefault:!0,isNamespace:!1});else if(r.type===`ImportNamespaceSpecifier`)t.set(e.name,{source:n,imported:null,isDefault:!1,isNamespace:!0});else if(r.type===`ImportSpecifier`){let i=r.imported,a=i?.name??(typeof i?.value==`string`?i.value:null);t.set(e.name,{source:n,imported:a,isDefault:!1,isNamespace:!1})}}}}return t},Zi=new WeakMap,Qi=e=>{let t=Yi(e);if(!t)return null;let n=Zi.get(t);return n||(n=Xi(t),Zi.set(t,n)),n},$i=(e,t)=>{let n=Qi(e);if(!n)return!1;for(let e of n.values())if(t.includes(e.source))return!0;return!1},ea=(e,t,n)=>{let r=Qi(e);if(!r)return!1;let i=r.get(t);return i?i.source===n:!1},ta=(e,t,n)=>{let r=Qi(e);if(!r)return!1;let i=r.get(t);return i?i.isNamespace&&i.source===n:!1},na=(e,t,n)=>{let r=Qi(e);if(!r)return!1;let i=r.get(t);return i?i.isDefault&&i.source===n:!1},ra=(e,t,n)=>{let r=Qi(e);if(!r)return null;let i=r.get(t);return!i||i.source!==n?null:i.imported},ia=(e,t)=>{let n=Qi(e);return n?n.get(t)?.source??null:null},aa=(e,t)=>{let n=Qi(e)?.get(t);return n?n.isNamespace?{source:n.source,exportedName:null,isNamespace:!0}:{source:n.source,exportedName:n.isDefault?`default`:n.imported,isNamespace:!1}:null},oa=e=>{let t=e,n=t.parent;for(;n&&O(n)===e;)t=n,n=t.parent;return n&&x(n,`AssignmentExpression`)&&n.operator===`=`&&n.left===t?n.right:null},sa=e=>{let t=e.range?.[0];return typeof t==`number`?t:null},ca=new Set([`let`,`var`]),la=new Set([`ConditionalExpression`,`LogicalExpression`]),ua=new WeakMap,da=(e,t,n)=>{let r=e.parent??null;for(;r&&n.blockOf(r)===t;){if(la.has(r.type))return!0;r=r.parent??null}return!1},fa=(e,t)=>e.size===t.size&&[...e].every(e=>t.has(e)),pa=(e,t)=>{let n=new Set(e);for(let e of t)e.isConditionalWithinBlock||(n=new Set),n.add(e);return n},ma=(e,t,n)=>{let r=I(t);if(I(e.bindingIdentifier)!==r||!r)return[];let i=n.cfgFor(r);if(!i)return[];let a=i.blockOf(t);if(!a)return[];let o=sa(t),s=sa(e.bindingIdentifier);if(o===null||s===null)return[];let c=new Map,l=(e,t,n)=>{let r=i.blockOf(t);if(!r)return;let a=c.get(r)??[];a.push({expression:e,position:n,isConditionalWithinBlock:da(t,r,i)}),c.set(r,a)};e.initializer&&l(e.initializer,e.bindingIdentifier,s);for(let t of e.references){let e=sa(t.identifier);if(t.flag===`read`||I(t.identifier)!==r||e===null||e>=o)continue;let n=oa(t.identifier);n&&l(n,t.identifier,e)}for(let e of c.values())e.sort((e,t)=>e.position-t.position);let u=new Map,d=new Map,f=new Set([i.entry]),p=[i.entry];for(;p.length>0;){let e=p.pop();if(!e)break;for(let t of e.successors)f.has(t.to)||(f.add(t.to),p.push(t.to))}if(!f.has(a))return[];let m=!0;for(;m;){m=!1;for(let e of i.blocks){if(!f.has(e))continue;let t=new Set;for(let n of e.predecessors)if(f.has(n.from))for(let e of d.get(n.from)??[])t.add(e);let n=pa(t,c.get(e)??[]),r=u.get(e)??new Set,i=d.get(e)??new Set;(!fa(t,r)||!fa(n,i))&&(u.set(e,t),d.set(e,n),m=!0)}}let h=(c.get(a)??[]).filter(e=>e.position<o);return[...pa(u.get(a)??new Set,h)].map(e=>e.expression)},ha=(e,t,n)=>{if(!ca.has(e.kind))return e.initializer?[e.initializer]:[];if(!n)return[];let r=ua.get(n);r||(r=new WeakMap,ua.set(n,r));let i=r.get(e);i||(i=new WeakMap,r.set(e,i));let a=i.get(t);if(a)return a;let o=ma(e,t,n);return i.set(t,o),o},ga=e=>{if(!b(e)||!x(e.body,`BlockStatement`))return[];let t=[];return A(e.body,n=>{if(n!==e.body&&(b(n)||x(n,`ClassDeclaration`)||x(n,`ClassExpression`)))return!1;x(n,`ReturnStatement`)&&t.push(n)}),t},L=e=>{if(x(e,`ReturnStatement`)||x(e,`ThrowStatement`))return!0;if(x(e,`IfStatement`)){if(x(e.test,`Literal`)){let t=e.test.value?e.consequent:e.alternate;return t?L(t):!1}return!!(e.alternate&&L(e.consequent)&&L(e.alternate))}if(x(e,`TryStatement`))return e.finalizer&&L(e.finalizer)?!0:L(e.block)?e.handler?L(e.handler.body):!0:!1;if(x(e,`DoWhileStatement`))return L(e.body);if(x(e,`WhileStatement`)){let t=e.test;return!!(x(t,`Literal`)&&t.value&&L(e.body))}if(x(e,`ForStatement`)){let t=e.test;return!!((!t||x(t,`Literal`)&&t.value)&&L(e.body))}return x(e,`BlockStatement`)?e.body.some(e=>L(e)):!1},_a=new Set([`let`,`var`]),va=e=>!b(e)||!e.body?[]:x(e.body,`BlockStatement`)?ga(e).flatMap(e=>e.argument?[e.argument]:[]):[e.body],ya=e=>{if(!b(e)||!x(e.body,`BlockStatement`))return!1;let t=!1;return A(e.body,n=>{if(t||n!==e.body&&b(n))return!1;x(n,`ReturnStatement`)&&!n.argument&&(t=!0)}),t},ba=(e,t,n,r=`some`)=>{let i=new Set,a=new Set,o,s=e=>{if(a.has(e))return!1;a.add(e);try{let t=va(e);return r===`every`&&b(e)&&x(e.body,`BlockStatement`)&&(!L(e.body)||ya(e))?!1:t.length>0&&(r===`every`?t.every(o):t.some(o))}finally{a.delete(e)}};o=a=>{let l=O(a);if(i.has(l))return!1;i.add(l);try{if(t(l))return!0;if(x(l,`Identifier`)){let t=e.symbolFor(l);if(!t||t.kind!==`const`&&!_a.has(t.kind))return!1;let i=ha(t,l,n),a=e=>{let t=O(e);return!b(t)&&o(t)};return r===`every`?i.length>0&&i.every(a):i.some(a)}if(x(l,`CallExpression`)){if(l.arguments.length!==0||!x(l.callee,`Identifier`))return!1;let t=e.symbolFor(l.callee);if(!t||t.kind!==`const`&&t.kind!==`function`)return!1;let n=t.initializer?O(t.initializer):null,r=null;return b(n)?r=n:b(t.declarationNode)&&(r=t.declarationNode),!r||r.async||r.generator||r.params.length!==0?!1:s(r)}return x(l,`ConditionalExpression`)?c(l.consequent,l.alternate):x(l,`LogicalExpression`)?c(l.left,l.right):!1}finally{i.delete(l)}};let c=(e,t)=>{let n=[o(e),o(t)];return r===`every`?n.every(Boolean):n.some(Boolean)};return{expressionMatches:o,functionMatches:s}},xa=(e,t,n,r,i=`some`)=>ba(t,n,r,i).functionMatches(e),Sa=(e,t,n,r,i)=>{let a=i.cfgFor(e),o=a?.blockOf(t);if(!a||!o)return!1;let s=new Set(ga(e).flatMap(e=>{if(!e.argument||!ba(n,r,i,`every`).expressionMatches(e.argument))return[];let t=a.blockOf(e.argument);return t?[t]:[]}));if(s.size===0)return!1;let c=new Set([o]),l=[o];for(;l.length>0;){let e=l.pop();if(!e)break;if(!s.has(e))for(let t of e.successors){if(t.to===a.exit)return!1;c.has(t.to)||(c.add(t.to),l.push(t.to))}}return!0},Ca=e=>x(e,`Program`)?e.range[1]:e.range[0],wa=new WeakMap,Ta=(e,t)=>{t.push(...e.symbols);for(let n of e.children)Ta(n,t)},Ea=e=>{let t=new Map,n=[];Ta(e.rootScope,n);for(let r of n){let n=P(r.bindingIdentifier,e);if(!n)continue;let i=t.get(n.id)??[];i.push(r),t.set(n.id,i)}return t},Da=(e,t)=>{let n=P(e,t);if(!n)return[];let r=wa.get(t);return r||(r=Ea(t),wa.set(t,r)),r.get(n.id)??[]},Oa=e=>{let t=e.expressions??[],n=e.quasis??[];if(t.length!==0||n.length!==1)return null;let r=n[0]?.value;return r?.cooked??r?.raw??null},R=(e,t,n={})=>{let r=N(e,{allowComputedString:!0,stringifyNonStringLiterals:n.stringifyNonStringLiterals});if(r!==null||!x(e,`Property`)&&!x(e,`MethodDefinition`)&&!x(e,`PropertyDefinition`)&&!x(e,`MemberExpression`)||!e.computed)return r;let i=O(x(e,`MemberExpression`)?e.property:e.key);if(!x(i,`Identifier`))return null;let a=P(i,t);if(a?.kind!==`const`||!a.initializer)return null;let o=O(a.initializer);return x(o,`Literal`)?typeof o.value==`string`?o.value:n.allowConstNumericLiteral&&typeof o.value==`number`?String(o.value):null:n.allowConstTemplateLiteral&&x(o,`TemplateLiteral`)?Oa(o):null},ka=new Set([`CatchClause`,`ConditionalExpression`,`DoWhileStatement`,`ForInStatement`,`ForOfStatement`,`ForStatement`,`IfStatement`,`LogicalExpression`,`SwitchCase`,`SwitchStatement`,`TryStatement`,`WhileStatement`]),Aa=(e,t)=>{let n=e.parent??null;for(;n&&n!==t;){if(ka.has(n.type))return!1;n=n.parent??null}return n===t},ja=e=>I(e)??Yi(e),Ma=e=>{let t=F(e),n=t.parent;return!!(n&&x(n,`VariableDeclarator`)&&n.init===t&&n.parent&&x(n.parent,`VariableDeclaration`)&&n.parent.kind===`const`)},Na=e=>{let t=F(e),n=t.parent;return!!(n&&(x(n,`AssignmentExpression`)&&n.left===t||x(n,`UpdateExpression`)&&n.argument===t||x(n,`UnaryExpression`)&&n.operator===`delete`&&n.argument===t))},Pa=e=>{let t=F(e),n=t.parent;return n&&x(n,`MemberExpression`)&&O(n.object)===t?n:null},Fa=(e,t,n,r)=>{if(!x(e,`ObjectExpression`))return null;for(let i of e.properties.toReversed()){if(!x(i,`Property`))return null;let e=R(i,n);if(e===null)return null;if(e===t)return i.kind===`init`?z(i.value,n,r):null}return null},Ia=(e,t,n,r)=>{if(!x(e,`ObjectExpression`))return[];let i=[],a=new Set;for(let o of e.properties){if(!x(o,`Property`))continue;let e=R(o,n),s=o.kind===`init`||o.kind===`get`?z(o.value,n,new Set(r)):null;e===t?(i=s?[s]:[],a.clear(),s&&a.add(s)):e===null&&s&&!a.has(s)&&(i.push(s),a.add(s))}return i},La=(e,t,n,r)=>{if(!x(e,`ClassDeclaration`)&&!x(e,`ClassExpression`))return null;for(let i of e.body.body.toReversed()){if(!x(i,`MethodDefinition`)&&!x(i,`PropertyDefinition`)||!i.static)continue;let e=R(i,n);if(e===null)return null;if(e===t)return x(i,`MethodDefinition`)&&i.kind!==`method`?null:i.value?z(i.value,n,r):null}return null},Ra=(e,t,n,r)=>{if(!x(e,`ClassDeclaration`)&&!x(e,`ClassExpression`))return[];let i=[],a=new Set;for(let o of e.body.body){if(!x(o,`MethodDefinition`)&&!x(o,`PropertyDefinition`)||!o.static)continue;let e=R(o,n),s=o.value&&(!x(o,`MethodDefinition`)||o.kind===`method`||o.kind===`get`)?z(o.value,n,new Set(r)):null;e===t?(i=s?[s]:[],a.clear(),s&&a.add(s)):e===null&&s&&!a.has(s)&&(i.push(s),a.add(s))}return i},za=(e,t,n,r,i,a,o)=>{let s=ja(t);if(!s||!x(e,`Identifier`))return{exactFunction:null,possibleFunctions:[]};let c=[];for(let r of Da(e,a))for(let e of r.references){let r=e.identifier;if(r.range[0]>=t.range[0]||Ma(r))continue;let i=Pa(r);if(!i){ja(r)===s&&c.push({assignedExpression:null,isDefinite:!1,offset:r.range[0]});continue}if(!Na(i)||ja(i)!==s)continue;let o=R(i,a),l=F(i).parent,u=l&&x(l,`AssignmentExpression`)&&l.operator===`=`?l.right:null;if(o===null){c.push({assignedExpression:u,isDefinite:!1,offset:i.range[0]});continue}if(o===n){if(!l||!x(l,`AssignmentExpression`)||l.operator!==`=`||!Aa(i,s)){c.push({assignedExpression:u,isDefinite:!1,offset:i.range[0]});continue}c.push({assignedExpression:u,isDefinite:!0,offset:l.range[0]})}}c.sort((e,t)=>e.offset-t.offset);let l=r,u=i,d=new Set(i);for(let e of c){let t=e.assignedExpression?z(e.assignedExpression,a,new Set(o)):null;if(e.isDefinite){l=t,u=t?[t]:[],d.clear(),t&&d.add(t);continue}l=null,t&&!d.has(t)&&(u.push(t),d.add(t))}return{exactFunction:l,possibleFunctions:u}},Ba=(e,t,n)=>{if(!x(e,`MemberExpression`))return{exactFunction:null,possibleFunctions:[]};let r=M(e);if(r===null)return{exactFunction:null,possibleFunctions:[]};let i=O(e.object);if(x(i,`ObjectExpression`))return{exactFunction:Fa(i,r,t,n),possibleFunctions:Ia(i,r,t,n)};if(x(i,`ClassExpression`))return{exactFunction:La(i,r,t,n),possibleFunctions:Ra(i,r,t,n)};if(!x(i,`Identifier`))return{exactFunction:null,possibleFunctions:[]};let a=P(i,t);if(!a||n.has(a.id))return{exactFunction:null,possibleFunctions:[]};n.add(a.id);let o=null,s=[];if(a.kind===`const`&&a.initializer){let e=O(a.initializer);o=Fa(e,r,t,n),s=Ia(e,r,t,n)}else a.kind===`class`&&a.initializer&&(o=La(a.initializer,r,t,n),s=Ra(a.initializer,r,t,n));return za(i,e,r,o,s,t,n)},Va=(e,t,n)=>{let r=O(e);if(x(r,`CallExpression`)){let e=O(r.callee);return x(e,`MemberExpression`)&&M(e)===`bind`?Va(e.object,t,n):[]}if(x(r,`MemberExpression`)){let e=M(r);return e===`call`||e===`apply`?Va(r.object,t,n):Ba(r,t,n).possibleFunctions}let i=z(r,t,n);return i?[i]:[]},z=(e,t,n)=>{let r=O(e);if(b(r))return r;if(x(r,`CallExpression`)){let e=O(r.callee);return x(e,`MemberExpression`)&&M(e)===`bind`?z(e.object,t,n):null}if(x(r,`MemberExpression`)){let e=M(r);return e===`call`||e===`apply`?z(r.object,t,n):Ba(r,t,n).exactFunction}if(!x(r,`Identifier`))return null;let i=P(r,t);return!i||n.has(i.id)?null:(n.add(i.id),i.kind===`function`?!i.references.some(e=>e.flag!==`read`)&&b(i.declarationNode)?i.declarationNode:null:i.kind!==`const`||!i.initializer?null:z(i.initializer,t,n))},Ha=(e,t)=>z(e,t,new Set),Ua=(e,t)=>Va(e,t,new Set),Wa=new WeakMap,Ga=(e,t)=>{let n=O(e);return x(n,`Identifier`)?t.symbolFor(n):null},Ka=(e,t)=>{let n=F(e),r=n.parent;return!r||!x(r,`AssignmentExpression`)||r.operator!==`=`||r.left!==n?null:Ga(r.right,t)},qa=e=>{let t=F(e),n=t.parent;return n&&x(n,`VariableDeclarator`)&&n.init===t&&(x(n.id,`Identifier`)||x(n.id,`ObjectPattern`))?!0:!!(n&&x(n,`AssignmentExpression`)&&n.operator===`=`&&n.right===t&&x(O(n.left),`Identifier`))},Ja=(e,t,n)=>{if(e.initializer&&x(e.declarationNode,`VariableDeclarator`)&&e.declarationNode.id===e.bindingIdentifier){let r=Ga(e.initializer,n);if(r&&t.has(r.id))return!0}return e.references.some(e=>{let r=Ka(e.identifier,n);return!!(r&&t.has(r.id))})},Ya=(e,t)=>{let n=P(e,t);if(!n)return[];let r=Wa.get(t);r||(r=new Map,Wa.set(t,r));let i=r.get(n.id);if(i)return i;let a=[],o=[t.rootScope];for(;o.length>0;){let e=o.pop();e&&(a.push(...e.symbols),o.push(...e.children))}let s=new Set([n.id]),c=!0;for(;c;){c=!1;for(let e of a)s.has(e.id)||Ja(e,s,t)&&(s.add(e.id),c=!0)}let l=a.filter(e=>s.has(e.id));return r.set(n.id,l),l},Xa=e=>{let t=e;for(;t;){if(b(t)||x(t,`Program`))return t;t=t.parent??null}return null},Za=new WeakMap,Qa=(e,t)=>{let n=Za.get(t);if(!n){let r=new Map,i=new Map,a=Yi(e);a&&A(a,e=>{if(!x(e,`CallExpression`))return;let n=O(e.callee),a=x(n,`Identifier`)?t.symbolFor(n):null,o=a?i.get(a.id):void 0;o===void 0&&(o=Ua(e.callee,t),a&&i.set(a.id,o));for(let t of o){let n=r.get(t)??[];n.push(e),r.set(t,n)}}),n=r,Za.set(t,n)}return n.get(e)??[]},$a=new WeakMap,eo=(e,t)=>{let n=$a.get(t);if(n===void 0){let e=null;A(t,n=>{x(n,`AwaitExpression`)&&I(n)===t&&(e===null||n.range[0]<e)&&(e=n.range[0])}),n=e,$a.set(t,n)}return n===null||e.range[0]<n},to=(e,t,n,r=new Set,i=null,a)=>{if(r.has(e)||!b(e)||e.generator||i!==null&&!Aa(i,e)||i!==null&&a!==void 0&&!a(i)||i!==null&&e.async&&!eo(i,e))return[];r.add(e);let o=Xa(t);return o?Qa(e,n).flatMap(e=>{let s=Xa(e);return!s||i!==null&&!Aa(e,s)||i!==null&&a!==void 0&&!a(e)?[]:s===o?e.range[0]<Ca(t)?[[e.range[0]]]:[]:b(s)?to(s,t,n,new Set(r),i===null?null:e,a).map(t=>[...t,e.range[0]]):[]}):[]},no=(e,t,n,r=new Set,i=null)=>to(e,t,n,r,i).length>0,ro=e=>{let t=e.parent;return t?x(t,`AssignmentExpression`)?t.left===e:(x(t,`UpdateExpression`)||x(t,`UnaryExpression`)&&t.operator===`delete`)&&t.argument===e:!1},io=e=>{let t=e.parent;for(;t&&O(t)===e;)t=t.parent;return!t||!x(t,`MemberExpression`)||O(t.object)!==e||!ro(t)?null:t},ao=(e,t,n)=>{let r=io(e);return r&&R(r,n)===t?r:null},oo=(e,t,n,r)=>e.references.some(e=>{let i=ao(e.identifier,t,r);if(!i)return!1;let a=Xa(i),o=Xa(n);return!a||!o||!Aa(i,a)?!1:a===o?i.range[0]<Ca(n):b(a)&&no(a,n,r)}),so=e=>{if(qa(e))return!0;let t=F(e),n=t.parent;return!!(n&&x(n,`MemberExpression`)&&O(n.object)===t)},co=e=>{if(qa(e))return!0;let t=F(e),n=t.parent;if(!n||!x(n,`MemberExpression`)||O(n.object)!==t)return!1;let r=F(n),i=r.parent;return!(i&&x(i,`CallExpression`)&&i.callee===r)},lo=(e,t,n)=>x(e,`Identifier`)?Ya(e,n).some(e=>e.references.some(e=>{let r=io(e.identifier);if(!r)return!1;let i=R(r,n);return i===null||i===t})):!1,uo=(e,t,n)=>{let r=Xa(e),i=Xa(t);return!r||!i?!0:r===i?e.range[0]<Ca(t):b(r)?no(r,t,n):!0},fo=(e,t,n,r)=>x(e,`Identifier`)?Ya(e,r).some(e=>e.references.some(e=>{let i=io(e.identifier);if(!i||!uo(i,n,r))return!1;let a=R(i,r);return a===null||a===t})):!1,po=(e,t,n)=>x(e,`Identifier`)?lo(e,t,n)?!0:Ya(e,n).some(e=>e.references.some(e=>!so(e.identifier))):!1,mo=(e,t,n,r)=>x(e,`Identifier`)?fo(e,t,n,r)?!0:Ya(e,r).some(e=>e.references.some(e=>!co(e.identifier)&&uo(e.identifier,n,r))):!1,ho=(e,t)=>{let n=O(e);if(!x(n,`CallExpression`))return!1;let r=O(n.callee);if(!x(r,`MemberExpression`))return!1;let i=M(r);if(i===null)return!1;let a=O(r.object);return x(a,`Identifier`)&&lo(a,i,t)},go=(e,t,n,r)=>x(e,`Identifier`)?Da(e,r).some(e=>oo(e,t,n,r)):!1,_o=(e,t,n,r={})=>{let i=I(e);return i===I(t)?e.range[0]>=Ca(t)||r.requireSynchronousWrite&&(!i||!Aa(e,i)||r.isSynchronousNode!==void 0&&!r.isSynchronousNode(e))?[]:[[e.range[0]]]:i?r.requireSynchronousWrite?to(i,t,n,new Set,e,r.isSynchronousNode).map(t=>[...t,e.range[0]]):to(i,t,n).map(t=>[...t,e.range[0]]):r.requireSynchronousWrite?[]:[[-1/0,e.range[0]]]},vo=(e,t,n,r={})=>_o(e,t,n,r).length>0,B=(e,t,n,r={})=>e.references.some(e=>e.flag===`read`?!1:vo(e.identifier,t,n,r)),yo=(e,t)=>{if(!x(e,`CallExpression`))return!1;let n=O(e.callee);if(x(n,`Identifier`)){let e=t.symbolFor(n);return!!(e&&!B(e,n,t))}if(!x(n,`MemberExpression`))return!1;let r=M(n),i=O(n.object);return!!(r&&x(i,`Identifier`)&&!go(i,r,n,t))},bo=new Set([`FunctionDeclaration`,`FunctionExpression`,`ArrowFunctionExpression`,`ClassDeclaration`,`ClassExpression`]),xo={allowGlobalReactNamespace:!1,allowUnboundBareCalls:!1},So=new Set([`lodash/sortBy`,`lodash/sortBy.js`,`lodash-es/sortBy`,`lodash-es/sortBy.js`]),Co=e=>x(e,`TSArrayType`)||x(e,`TSTupleType`)?!0:x(e,`TSTypeReference`)?x(e.typeName,`Identifier`)&&(e.typeName.name===`Array`||e.typeName.name===`ReadonlyArray`):!1,wo=e=>{if(!x(e,`Identifier`))return!1;let t=e.typeAnnotation;return!!(t&&x(t,`TSTypeAnnotation`)&&Co(t.typeAnnotation))},To=(e,t)=>{if(!x(e,`CallExpression`))return!1;let n=O(e.callee);if(!x(n,`Identifier`))return!1;let r=t.symbolFor(n);if(!r||B(r,n,t)||!x(r.declarationNode,`ImportDefaultSpecifier`)&&!x(r.declarationNode,`ImportSpecifier`))return!1;let i=aa(n,n.name);return!i||i.isNamespace?!1:So.has(i.source)&&i.exportedName===`default`?!0:(i.source===`lodash`||i.source===`lodash-es`)&&i.exportedName===`sortBy`},Eo=(e,t,n,r=new Set)=>{let i=O(e);if(x(i,`ArrayExpression`)||To(i,t))return!0;if(!x(i,`Identifier`))return!1;let a=t.symbolFor(i);return!a||r.has(a.id)||B(a,n,t)?!1:wo(a.bindingIdentifier)?!0:a.initializer?(r.add(a.id),Eo(a.initializer,t,n,r)):!1},Do=(e,t)=>{if(!x(e,`CallExpression`))return!1;let n=O(e.callee);if(!x(n,`MemberExpression`)||M(n)!==`map`)return!1;let r=O(n.object);return Eo(r,t,e)?!(x(r,`Identifier`)&&go(r,`map`,e,t)):!1},Oo=(e,t)=>{if(e.type!==`ArrowFunctionExpression`&&e.type!==`FunctionExpression`)return!1;let n=e.parent;return x(n,`CallExpression`)?Vi(n,`useMemo`,t,{resolveNamedAliases:!0})&&yo(n,t)?n.arguments[0]===e:n.arguments.some(t=>t===e)&&Do(n,t):!1},ko=(e,t)=>bo.has(e.type)&&!Oo(e,t),Ao=(e,t)=>e.type===`JSXElement`||e.type===`JSXFragment`||Vi(e,`createElement`,t,xo)||jo(e,t),jo=(e,t)=>{if(!x(e,`CallExpression`))return!1;let n=O(e.callee);if(x(n,`Identifier`))return t.symbolFor(n)?.kind===`import`&&ra(n,n.name,`react-dom`)===`createPortal`;if(!x(n,`MemberExpression`)||n.computed||!x(n.object,`Identifier`)||!x(n.property,`Identifier`)||n.property.name!==`createPortal`)return!1;let r=t.symbolFor(n.object);return!r||r.kind!==`import`?!1:na(n.object,n.object.name,`react-dom`)||ta(n.object,n.object.name,`react-dom`)},Mo=(e,t)=>{let n=!1;return A(e,r=>{if(n||r!==e&&ko(r,t))return!1;if(Ao(r,t))return n=!0,!1}),n},No=new WeakMap,Po=(e,t,n)=>{let r=No.get(e);if(r&&r.scopes===t&&r.controlFlow===n)return r.hasRenderOutput;let i=xa(e,t,e=>Mo(e,t),n);return No.set(e,{scopes:t,controlFlow:n,hasRenderOutput:i}),i},Fo=e=>x(e,`JSXIdentifier`)?e.name:x(e,`JSXNamespacedName`)?`${e.namespace.name}:${e.name.name}`:null,Io=new Set([`Component`,`PureComponent`]),Lo=(e,t,n,r)=>{let i=O(e);if(x(i,`MemberExpression`)){let e=M(i),n=O(i.object);return!!(e&&Io.has(e)&&x(n,`Identifier`)&&!go(n,e,i,t)&&Ri(n,t))}if(x(i,`ClassExpression`))return Ro(i,t,n,r);if(!x(i,`Identifier`))return!1;let a=t.symbolFor(i);if(!a||r.has(a.id)||B(a,i,t))return!1;if(r.add(a.id),Ii(a)){let e=j(a.declarationNode);return!!(e&&Io.has(e))}return x(a.declarationNode,`ClassDeclaration`)||x(a.declarationNode,`ClassExpression`)?Ro(a.declarationNode,t,n,r):!!(a.kind===`const`&&a.initializer&&Lo(a.initializer,t,n,r))},Ro=(e,t,n=new Set,r=new Set)=>!x(e,`ClassDeclaration`)&&!x(e,`ClassExpression`)||n.has(e)||!e.superClass?!1:(n.add(e),Lo(e.superClass,t,n,r)),zo=new Set([`FunctionDeclaration`,`FunctionExpression`,`ArrowFunctionExpression`,`MethodDefinition`,`Program`]),Bo=e=>{let t=e;for(;t;){if(zo.has(t.type))return t;t=t.parent??null}return null},Vo=(e,t)=>{if(t!==`let`&&t!==`const`)return Bo(e);let n=e.parent;for(;n;){if(n.type===`BlockStatement`){let t=n.parent;return t&&(t.type===`FunctionDeclaration`||t.type===`FunctionExpression`||t.type===`ArrowFunctionExpression`||t.type===`MethodDefinition`)?Bo(e):n}if(zo.has(n.type))return n;n=n.parent??null}return null},Ho=(e,t,n,r)=>{if(x(e,`Identifier`)){let i=r.get(e.name)??[];i.push({bindingIdentifier:e,initializer:t,scopeOwner:n}),r.set(e.name,i);return}if(x(e,`ObjectPattern`)){for(let t of e.properties)if(x(t,`Property`)){let e=t.value;Ho(e,x(e,`AssignmentPattern`)?e.right:null,n,r)}else x(t,`RestElement`)&&Ho(t.argument,null,n,r);return}if(x(e,`ArrayPattern`)){for(let t of e.elements)t&&Ho(t,x(t,`AssignmentPattern`)?t.right??null:null,n,r);return}if(x(e,`AssignmentPattern`)){Ho(e.left,e.right??null,n,r);return}x(e,`RestElement`)&&Ho(e.argument,null,n,r)},Uo=e=>{let t=new Map;return A(e,e=>{switch(e.type){case`VariableDeclarator`:{let n=e.parent,r=Vo(e,n?.type===`VariableDeclaration`?n.kind:void 0);r&&Ho(e.id,e.init??null,r,t);break}case`FunctionDeclaration`:case`FunctionExpression`:case`ArrowFunctionExpression`:if(e.type!==`ArrowFunctionExpression`&&e.id){let n=e.parent?Bo(e.parent):null;if(n){let r=t.get(e.id.name)??[];r.push({bindingIdentifier:e.id,initializer:e,scopeOwner:n}),t.set(e.id.name,r)}}for(let n of e.params)Ho(n,null,e,t);break;case`ClassDeclaration`:case`ClassExpression`:{if(!e.id)break;let n=e.parent?Bo(e.parent):null;if(n){let r=t.get(e.id.name)??[];r.push({bindingIdentifier:e.id,initializer:e,scopeOwner:n}),t.set(e.id.name,r)}break}case`ImportDeclaration`:{let n=Bo(e);if(!n)break;for(let r of e.specifiers){let e=r.local;if(e&&x(e,`Identifier`)){let i=t.get(e.name)??[];i.push({bindingIdentifier:e,initializer:r,scopeOwner:n}),t.set(e.name,i)}}break}case`TSImportEqualsDeclaration`:case`TSEnumDeclaration`:case`TSModuleDeclaration`:{let n=e.id;if(n?.type===`Identifier`){let r=Bo(e);if(r){let e=t.get(n.name)??[];e.push({bindingIdentifier:n,initializer:null,scopeOwner:r}),t.set(n.name,e)}}break}}}),t},Wo=new WeakMap,Go=new WeakMap,Ko=e=>{let t=Yi(e);if(!t)return null;let n=Wo.get(t);return n||(n=Uo(t),Wo.set(t,n)),n},qo=(e,t,n)=>{let r=Ko(e);if(!r)return null;let i=r.get(t);if(!i||i.length===0)return null;let a=i[0];if(i.length===1&&a){let t=e;for(;t;){if(t===a.scopeOwner)return a;t=t.parent??null}return null}let o=e;for(;o;){let t=null;for(let r of i)if(r.scopeOwner===o){if(t===null){t=r;continue}if(n?.preferInitializerBeforeReference){let n=!!(r.initializer&&(x(r.initializer,`FunctionDeclaration`)||r.bindingIdentifier.range[0]<e.range[0]));if(n!==!!(t.initializer&&(x(t.initializer,`FunctionDeclaration`)||t.bindingIdentifier.range[0]<e.range[0]))){n&&(t=r);continue}}(r.initializer!==null||t.initializer===null)&&(t=r)}if(t)return t;o=o.parent??null}return null},Jo=(e,t,n)=>{let r=Go.get(e),i;if(!r)i={},Go.set(e,{primaryBindingName:t,primaryLookup:i});else if(r.primaryBindingName===t)i=r.primaryLookup;else{let e=r.additionalLookups;e||(e=new Map,r.additionalLookups=e);let n=e.get(t);n?i=n:(i={},e.set(t,i))}let a=n?.preferInitializerBeforeReference?`preferredResult`:`defaultResult`;if(a in i)return i[a]??null;let o=qo(e,t,n);return i[a]=o,o},Yo=e=>ui.test(e),Xo=e=>{let t=Jo(e,e.name);if(!t?.initializer)return null;let n=t.bindingIdentifier.parent;if(!n||!x(n,`VariableDeclarator`)||n.id!==t.bindingIdentifier)return null;let r=n.parent;if(!r||!x(r,`VariableDeclaration`)||r.kind!==`const`)return null;let i=O(t.initializer);return x(i,`Literal`)&&typeof i.value==`string`?i.value:null},Zo=e=>x(e,`JSXIdentifier`)?e.name:x(e,`JSXMemberExpression`)?`${Zo(e.object)}.${e.property.name}`:x(e,`JSXNamespacedName`)?`${e.namespace.name}:${e.name.name}`:``,Qo=e=>{let t=e.name;return x(t,`JSXIdentifier`)?Yo(t.name)?Xo(t)??t.name:t.name:Zo(t)},$o=(e,t)=>{if(!x(e.name,`JSXIdentifier`))return!1;let n=Qo(e);if(n[0]===n[0]?.toLowerCase())return!0;let r=new Set,i=e=>{let n=F(e);if(x(n,`Literal`))return typeof n.value==`string`;if(x(n,`Identifier`)||x(n,`JSXIdentifier`)){let e=t.symbolFor(n);if(!e||e.kind!==`const`||!e.initializer||r.has(e.id))return!1;r.add(e.id);let a=i(e.initializer);return r.delete(e.id),a}return x(n,`ConditionalExpression`)?i(n.consequent)&&i(n.alternate):!1};return i(e.name)},es=(e,t,n=new Set)=>{if(!e)return null;let r=O(e);if(b(r))return r;if(x(r,`Identifier`)){let e=t.symbolFor(r);return!e||n.has(e.id)||!e.initializer||B(e,r,t)?null:(n.add(e.id),es(e.initializer,t,n))}if(!x(r,`CallExpression`)||!Vi(r,`memo`,t,{resolveNamedAliases:!0})&&!Vi(r,`forwardRef`,t,{resolveNamedAliases:!0}))return null;let i=r.arguments[0];return!i||x(i,`SpreadElement`)?null:es(i,t,n)},ts=(e,t)=>{let n=F(e);if(!b(n)||n.async||n.generator)return!1;let r=n.parent;if(!r||!x(r,`JSXExpressionContainer`))return!1;let i=r.parent;if(!i||!x(i,`JSXAttribute`)||Fo(i.name)!==`ref`)return!1;let a=i.parent;return!!(a&&x(a,`JSXOpeningElement`)&&$o(a,t))},ns=(e,t)=>t.every((t,n)=>e[n]===t),rs=e=>{let t=F(e);for(;t.parent&&x(t.parent,`MemberExpression`)&&t.parent.object===t;){if(!M(t.parent))return null;t=F(t.parent)}return t},is=(e,t,n,r)=>{if(t.length!==n.length+1||!ns(t,n)||t[n.length]!==`current`)return!1;let i=rs(e),a=i?.parent;if(!i||!a||!x(a,`AssignmentExpression`)||a.operator!==`=`||a.left!==i)return!1;let o=I(e);if(!o)return!1;if(ts(o,r))return!0;if(!b(o)||o.async||o.generator)return!1;let s=I(o);if(!s||!ts(s,r))return!1;let c=F(o),l=c.parent;return!!(x(l,`ReturnStatement`)&&l.argument===c&&I(l)===s||x(s,`ArrowFunctionExpression`)&&s.body===c)},as=(e,t)=>{if(!x(e,`JSXOpeningElement`))return!1;let n=e.name;if(x(n,`JSXIdentifier`)){if(!t)return n.name===`Fragment`;let e=P(n,t);return e?Ii(e)&&j(e.declarationNode)===`Fragment`:n.name===`Fragment`&&t.isGlobalReference(n)}return x(n,`JSXMemberExpression`)?!x(n.object,`JSXIdentifier`)||n.property.name!==`Fragment`?!1:t?Ri(n.object,t)?!0:n.object.name===`React`&&t.isGlobalReference(n.object):n.object.name===`React`:!1},os=(e,t,n,r,i)=>{let a=F(e),o=a.parent;if(!o)return!1;if(x(o,`ReturnStatement`)&&o.argument===a)return I(o)===t;if(x(o,`ArrowFunctionExpression`)&&o.body===a)return o===t;if(x(o,`JSXFragment`)&&o.children.some(e=>e===a)||x(o,`JSXElement`)&&o.children.some(e=>e===a)&&($o(o.openingElement,n)||as(o.openingElement,n)||i.doesCustomElementRenderChildren?.(o.openingElement)))return os(o,t,n,r,i);if(x(o,`JSXExpressionContainer`)&&o.expression===a&&o.parent&&(x(o.parent,`JSXFragment`)||x(o.parent,`JSXElement`)&&($o(o.parent.openingElement,n)||as(o.parent.openingElement,n)||i.doesCustomElementRenderChildren?.(o.parent.openingElement))))return os(o.parent,t,n,r,i);if(x(o,`ConditionalExpression`)&&(o.consequent===a||o.alternate===a)||x(o,`LogicalExpression`)&&(o.left===a||o.right===a)||x(o,`ArrayExpression`)&&o.elements.some(e=>e===a))return os(o,t,n,r,i);if(!x(o,`VariableDeclarator`)||o.init!==a||!x(o.id,`Identifier`))return!1;let s=n.symbolFor(o.id);if(!s||s.kind!==`const`||s.references.length===0||r.has(s.id))return!1;r.add(s.id);let c=s.references.every(e=>e.flag===`read`&&os(e.identifier,t,n,r,i));return r.delete(s.id),c},ss=(e,t,n={})=>os(e,I(e),t,new Set,n),cs=(e,t)=>t.every((t,n)=>e[n]===t),ls=(e,t)=>cs(e,t)||cs(t,e),us=e=>b(e)&&x(e.body,`BlockStatement`)&&e.body.body.length===0,ds=(e,t,n)=>Vi(e,t,n,{resolveNamedAliases:!0}),fs=(e,t,n=new Set)=>x(e,`ObjectExpression`)?e.properties.every(e=>{if(x(e,`SpreadElement`)){let r=F(e.argument);if(x(r,`ObjectExpression`))return fs(r,t,n);if(!x(r,`Identifier`))return!1;let i=t.symbolFor(r);if(!i||i.kind!==`const`||n.has(i.id)||!x(i.initializer,`ObjectExpression`))return!1;n.add(i.id);let a=fs(i.initializer,t,n);return n.delete(i.id),a}return x(e,`Property`)?!b(e.value)||us(e.value):!1}):!1,ps=e=>M(e)||(e.computed&&x(e.property,`Literal`)&&typeof e.property.value==`number`&&Number.isSafeInteger(e.property.value)&&e.property.value>=0?String(e.property.value):null),ms=e=>{let t=[],n=F(e);for(;n.parent&&x(n.parent,`MemberExpression`)&&n.parent.object===n;){let e=ps(n.parent);if(!e)return null;t.push(e),n=F(n.parent)}return{expression:n,propertyPath:t}},hs=(e,t,n)=>{let r=n.environmentsByProgram.get(e);if(r)return r;let i={filename:t,program:e,scopes:Fe(e)};return n.environmentsByProgram.set(e,i),i},gs=(e,t,n=new Set)=>{let r=F(e);if(x(r,`Identifier`)){let e=t.symbolFor(r);return!e||!e.initializer||n.has(e.id)||B(e,r,t)?!1:(n.add(e.id),gs(e.initializer,t,n))}if(!x(r,`CallExpression`))return!1;if(ds(r,`forwardRef`,t))return!0;if(!ds(r,`memo`,t))return!1;let i=r.arguments[0];return!i||x(i,`SpreadElement`)?!1:gs(i,t,n)},_s=(e,t)=>{let n=hs(e.programNode,e.filePath,t),r=es(e.exportedNode,n.scopes);return r?{environment:n,functionNode:r,isForwardRef:gs(e.exportedNode,n.scopes)}:null},vs=(e,t,n)=>{if(!x(e,`Identifier`)&&!x(e,`JSXIdentifier`))return null;let r=t.scopes.symbolFor(e);if(r&&r.kind!==`import`){if(B(r,e,t.scopes))return null;let n=es(r.initializer,t.scopes);return n?{environment:t,functionNode:n,isForwardRef:!!(r.initializer&&gs(r.initializer,t.scopes))}:null}let i=aa(e,e.name);if(!i||i.isNamespace||i.exportedName===null)return null;let a=k(t.filename,i.source,i.exportedName);return a?_s(a,n):null},ys=(e,t,n)=>{if(x(e,`JSXIdentifier`))return vs(e,t,n);if(!x(e,`JSXMemberExpression`)||!x(e.object,`JSXIdentifier`))return null;let r=aa(e.object,e.object.name);if(!r?.isNamespace)return null;let i=k(t.filename,r.source,e.property.name);return i?_s(i,n):null},bs=(e,t,n=new Set)=>{let r=F(e);if(x(r,`Identifier`)){let e=t.scopes.symbolFor(r);return!e||!e.initializer||n.has(e.id)||B(e,r,t.scopes)?!1:(n.add(e.id),bs(e.initializer,t,n))}return Ro(r,t.scopes)},xs=(e,t,n)=>{if(!x(e,`JSXIdentifier`))return!1;let r=t.scopes.symbolFor(e);if(r&&r.kind!==`import`)return B(r,e,t.scopes)?!1:!!(r.initializer&&bs(r.initializer,t));let i=aa(e,e.name);if(!i||i.isNamespace||i.exportedName===null)return!1;let a=k(t.filename,i.source,i.exportedName);if(!a)return!1;let o=hs(a.programNode,a.filePath,n);return bs(a.exportedNode,o)},Ss=(e,t)=>{if(!e)return null;let n=F(e);return!x(n,`ClassDeclaration`)&&!x(n,`ClassExpression`)||!bs(n,t)?null:{classNode:n,environment:t}},Cs=(e,t,n)=>{if(!x(e,`JSXIdentifier`))return null;let r=t.scopes.symbolFor(e);if(r&&r.kind!==`import`)return B(r,e,t.scopes)?null:Ss(r.initializer,t);let i=aa(e,e.name);if(!i||i.isNamespace||i.exportedName===null)return null;let a=k(t.filename,i.source,i.exportedName);if(!a)return null;let o=hs(a.programNode,a.filePath,n);return Ss(a.exportedNode,o)},ws=(e,t,n)=>{let r=[...t],i=F(e);for(;i.parent;){let e=i.parent;if(x(e,`ArrayExpression`)){if(e.elements.some(e=>e&&x(e,`SpreadElement`)))return null;let t=e.elements.findIndex(e=>e===i);if(t<0)return null;r.unshift(String(t)),i=F(e);continue}if(x(e,`Property`)&&e.value===i){let t=N(e,{allowComputedString:!0}),a=e.parent;if(!t||!a||!fs(a,n.scopes))return null;r.unshift(t),i=F(a);continue}if(x(e,`ConditionalExpression`)&&(e.consequent===i||e.alternate===i)||x(e,`LogicalExpression`)&&(e.left===i||e.right===i)){i=F(e);continue}if(x(e,`VariableDeclarator`)&&e.init===i&&x(e.id,`Identifier`)){let t=n.scopes.symbolFor(e.id);return!t||t.kind!==`const`?null:{environment:n,propertyPath:r,symbol:t}}if(x(e,`AssignmentExpression`)&&e.operator===`=`&&e.right===i&&x(e.left,`MemberExpression`)){let t=[],i=e.left;for(;x(i,`MemberExpression`);){let e=ps(i);if(!e)return null;t.unshift(e),i=F(i.object)}if(!x(i,`Identifier`))return null;let a=n.scopes.symbolFor(i);return!a||a.kind!==`const`?null:{environment:n,originWriteReference:i,propertyPath:[...t,...r],symbol:a}}return null}return null},Ts=(e,t,n,r,i)=>{if(x(e,`AssignmentPattern`))return Ts(e.left,t,n,r,i);if(x(e,`Identifier`)){let a=n.scopes.symbolFor(e);return!!(a&&Vs({environment:n,propertyPath:t,symbol:a},r,i-1))}if(!x(e,`ObjectPattern`)||t.length===0)return!1;let[a,...o]=t;for(let t of e.properties){if(!x(t,`Property`))continue;let e=N(t,{allowComputedString:!0});if(!e)return!1;if(e===a)return Ts(t.value,o,n,r,i)}let s=e.properties.find(e=>x(e,`RestElement`));return s?Ts(s.argument,t,n,r,i):!0},Es=(e,t)=>{let n=e.arguments[0];return!n||x(n,`SpreadElement`)?!1:ds(e,`createElement`,t.scopes)?x(n,`Literal`)&&typeof n.value==`string`:!ds(e,`cloneElement`,t.scopes)||!x(n,`JSXElement`)?!1:$o(n.openingElement,t.scopes)},Ds=(e,t,n,r,i)=>{if(t.length>0)return!1;let a=e.parent;if(!a||!x(a,`Property`)||a.value!==e||N(a,{allowComputedString:!0})!==`ref`)return!1;let o=a.parent;if(!o||!x(o,`ObjectExpression`))return!1;let s=o.parent;return!(!s||!x(s,`CallExpression`)||s.arguments[1]!==o||!Es(s,n)||!js(s,n,r,i))},Os=(e,t,n,r,i)=>{if(i<=0||!b(e.functionNode)||e.functionNode.async||e.functionNode.generator)return!1;let a=e.functionNode.params[t];return!!(a&&Ts(a,n,e.environment,r,i))},ks=e=>{if(!x(e,`MemberExpression`)||M(e)!==`children`)return!1;let t=F(e.object);return!!(x(t,`MemberExpression`)&&M(t)===`props`&&x(F(t.object),`ThisExpression`))},As=(e,t)=>{if(!x(e,`JSXOpeningElement`)||!x(e.name,`JSXMemberExpression`)||e.name.property.name!==`Provider`||!x(e.name.object,`JSXIdentifier`))return!1;let n=t.scopes.symbolFor(e.name.object);return!!(n?.kind===`const`&&n.initializer&&x(n.initializer,`CallExpression`)&&ds(n.initializer,`createContext`,t.scopes))},js=(e,t,n,r)=>ss(e,t.scopes,{doesCustomElementRenderChildren:e=>Ps(e,t,n,r-1)}),Ms=(e,t,n)=>{let{functionNode:r}=e;if(n<=0||t.activeRenderedChildrenComponents.has(r)||!x(r,`ArrowFunctionExpression`)&&!x(r,`FunctionExpression`)&&!x(r,`FunctionDeclaration`)||r.async||r.generator)return!1;let i=Ji(r,e.environment.scopes);if(!i)return!1;t.activeRenderedChildrenComponents.add(r);let a=i.every(r=>js(r,e.environment,t,n));return t.activeRenderedChildrenComponents.delete(r),a},Ns=(e,t,n)=>{let{classNode:r,environment:i}=e;if(n<=0||t.activeRenderedChildrenComponents.has(r)||!x(r,`ClassDeclaration`)&&!x(r,`ClassExpression`))return!1;let a=r.body.body.find(e=>x(e,`MethodDefinition`)&&!e.computed&&x(e.key,`Identifier`)&&e.key.name===`render`);if(!a||!x(a,`MethodDefinition`))return!1;let o=[];if(A(r,e=>{ks(e)&&o.push(e)}),o.length===0)return!1;t.activeRenderedChildrenComponents.add(r);let s=o.every(e=>I(e)===a.value&&js(e,i,t,n));return t.activeRenderedChildrenComponents.delete(r),s},Ps=(e,t,n,r)=>{if(r<=0||!x(e,`JSXOpeningElement`))return!1;if(As(e,t))return!0;let i=ys(e.name,t,n);if(i)return Ms(i,n,r);let a=Cs(e.name,t,n);return!!(a&&Ns(a,n,r))},Fs=(e,t,n,r,i)=>{let a=Fo(e.name),o=e.parent;if(!a||!o||!x(o,`JSXOpeningElement`))return!1;let s=o.parent;if(!s||!x(s,`JSXElement`)||!js(s,n,r,i))return!1;if($o(o,n.scopes))return a===`ref`&&t.length===0;if(x(o.name,`JSXIdentifier`)&&a===`ref`&&t.length===0&&xs(o.name,n,r))return!0;let c=ys(o.name,n,r);return c?a===`ref`&&c.isForwardRef?Os(c,1,t,r,i):Os(c,0,[a,...t],r,i):!1},Is=(e,t,n,r,i,a)=>{let o=e.arguments.findIndex(e=>e===t);if(o<0)return!1;if(o===0&&x(e.callee,`Identifier`)&&e.callee.name===`Boolean`&&r.scopes.isGlobalReference(e.callee))return!0;if(o===0&&ds(e,`useImperativeHandle`,r.scopes))return n.length===0;if(o===1&&n.length===1&&n[0]===`ref`&&Es(e,r)&&js(e,r,i,a))return!0;let s=F(e.callee);if(b(s))return Po(s,r.scopes)&&!js(e,r,i,a)?!1:Os({environment:r,functionNode:s,isForwardRef:!1},o,n,i,a);if(!x(e.callee,`Identifier`))return!1;let c=vs(e.callee,r,i);return!!(c&&(!Po(c.functionNode,c.environment.scopes)||js(e,r,i,a))&&Os(c,o,n,i,a))},Ls=(e,t,n,r,i)=>{let a;if(t.length===1&&t[0]===`ref`)a=e.parent;else if(t.length===0){let t=e.parent;if(!t||!x(t,`Property`)||t.value!==e||N(t,{allowComputedString:!0})!==`ref`)return!1;a=t.parent?.parent}if(!a||!x(a,`JSXSpreadAttribute`))return!1;let o=a.parent;if(!o||!x(o,`JSXOpeningElement`))return!1;let s=o.parent;return!!($o(o,n.scopes)&&s&&x(s,`JSXElement`)&&js(s,n,r,i))},Rs=(e,t,n,r,i)=>{let a=F(e),o=a.parent;if(!o)return!1;if(x(o,`ExpressionStatement`)||x(o,`UnaryExpression`)&&o.operator===`void`&&o.argument===a)return!0;if(t.length===0&&x(o,`BinaryExpression`)&&(o.operator===`===`||o.operator===`!==`||o.operator===`==`||o.operator===`!=`)){let e=o.left===a?o.right:o.left;return!!(x(a,`Identifier`)&&x(e,`Identifier`)&&n.scopes.symbolFor(a)?.id===n.scopes.symbolFor(e)?.id)}if(Ls(a,t,n,r,i)||Ds(a,t,n,r,i)||t.length>0&&(x(o,`LogicalExpression`)&&o.left===a||x(o,`ConditionalExpression`)&&o.test===a||x(o,`IfStatement`)&&o.test===a||x(o,`UnaryExpression`)&&o.operator===`!`&&o.argument===a))return!0;if(x(o,`JSXExpressionContainer`)&&o.expression===a){let e=o.parent;return!!(e&&x(e,`JSXAttribute`)&&Fs(e,t,n,r,i))}if(x(o,`CallExpression`))return Is(o,a,t,n,r,i);if(x(o,`VariableDeclarator`)&&o.init===a&&!x(o.id,`Identifier`))return Ts(o.id,t,n,r,i);let s=ws(a,t,n);return!!(s&&Vs(s,r,i-1))},zs=e=>{let t=e.parent;return t&&x(t,`VariableDeclarator`)&&t.init===e&&x(t.id,`Identifier`)?t.id:(x(e,`FunctionDeclaration`)||x(e,`FunctionExpression`))&&e.id?e.id:null},Bs=(e,t,n)=>{if(!e||!t||!b(e)||e.async||e.generator)return!1;let r=zs(e);if(!r||((x(e,`FunctionDeclaration`)||x(e,`FunctionExpression`))&&e.id===r?I(e):I(r))!==t)return!1;let i=x(e,`FunctionDeclaration`)?n.ownScopeFor(t)?.symbolsByName.get(r.name):n.symbolFor(r);return!!(i&&i.references.length>0&&i.references.every(e=>{let r=F(e.identifier),i=r.parent;return!!(i&&x(i,`CallExpression`)&&i.callee===r&&I(i)===t&&ss(i,n))}))},Vs=(e,t,n)=>{if(n<=0)return!1;let r=`${e.environment.filename}:${e.symbol.id}:${e.propertyPath.join(`.`)}`;if(t.activePaths.has(r))return!1;t.activePaths.add(r);let i=I(e.symbol.bindingIdentifier),a=e.symbol.references.every(r=>{if(r.identifier===e.originWriteReference)return!0;let a=r.identifier.parent;if(a&&x(a,`Property`)&&!a.computed&&a.key===r.identifier&&a.value!==r.identifier)return!0;let o=ms(r.identifier);if(!o)return!1;if(!ls(o.propertyPath,e.propertyPath))return!0;let s=I(r.identifier);if(s!==i&&!Bs(s,i,e.environment.scopes))return!!is(r.identifier,o.propertyPath,e.propertyPath,e.environment.scopes);if(r.flag!==`read`)return!1;if(cs(o.propertyPath,e.propertyPath)){if(o.propertyPath.length>e.propertyPath.length){let t=o.expression.parent;return!!(o.propertyPath.length===e.propertyPath.length+1&&o.propertyPath[e.propertyPath.length]===`current`&&t&&x(t,`UnaryExpression`)&&t.operator===`void`&&t.argument===o.expression)}return Rs(o.expression,[],e.environment,t,n)}return Rs(o.expression,e.propertyPath.slice(o.propertyPath.length),e.environment,t,n)});return t.activePaths.delete(r),a},Hs=(e,t,n)=>{if(!t)return!1;let r=Yi(e);if(!r)return!1;let i={filename:t,program:r,scopes:n},a={activePaths:new Set,activeRenderedChildrenComponents:new WeakSet,environmentsByProgram:new WeakMap([[r,i]])},o=ws(e,[],i);return o?Vs(o,a,12):Rs(e,[],i,a,12)},Us=e=>{let t=[];for(let n of e)for(let e of n.entries){if(e.importName.kind===`NamespaceObject`)continue;let r=e.importName.kind===`Default`?`default`:e.importName.name??null;r!==null&&t.push({source:n.moduleRequest.value,exportedName:r})}return t},Ws=({absoluteFilePath:e,staticImports:t})=>{let n=!1;for(let r of t){let t=r.moduleRequest.value;if(!t.startsWith(`.`))continue;let i=r.entries.filter(e=>!e.isType);if(i.length===0)continue;let a=fn(e,t);if(!(!a||!hr(a))){n||(n=!0,At(e));for(let e of i){let t=e.importName.kind===`Default`?`default`:e.importName.name;t&&Ki(a,t)}}}},Gs=({absoluteFilePath:e})=>{Re.test(e)&&(He.test(e)||Xn(e))},Ks=({absoluteFilePath:e,staticImports:t})=>{if(ze.test(e)&&!$n(e))for(let n of Us(t))Nn(e,n.source,n.exportedName)},V=({absoluteFilePath:e,staticImports:t})=>{for(let n of Us(t))Nn(e,n.source,n.exportedName)},qs=({absoluteFilePath:e,staticImports:t})=>{for(let n of Us(t))k(e,n.source,n.exportedName)},Js=(e,t,n,r)=>{let i=n.get(t);if(!(i!==void 0&&i<=r)){n.set(t,r);for(let i of e.body??[]){let e=er(i);if(!e)continue;let a=kn(t,e);if(!a||r>=8)continue;let o=r+1,s=n.get(a);if(s!==void 0&&s<=o)continue;let c=Wt(a);if(!c){n.set(a,o);continue}Js(c,a,n,o)}}},Ys=e=>{qs(e);let t=e.getProgram(),n=!1;A(t,e=>{if(n)return!1;if(!x(e,`CallExpression`))return;let t=O(e.callee);if(!x(t,`MemberExpression`))return;let r=M(t);n=r===`add`||r===`set`}),n&&Js(t,e.absoluteFilePath,new Map,0)},Xs=({absoluteFilePath:e,staticImports:t})=>{for(let n of Us(t))qi(e,n.source,n.exportedName)},Zs=e=>{let t=[];for(let n of e.body??[]){if(n.type!==`ImportDeclaration`)continue;let e=n.source?.value;if(typeof e==`string`){for(let r of n.specifiers??[])if(r.type===`ImportDefaultSpecifier`)t.push({source:e,exportedName:`default`});else if(r.type===`ImportSpecifier`){let n=r.imported,i=null;typeof n?.name==`string`?i=n.name:typeof n?.value==`string`&&(i=n.value),i&&t.push({source:e,exportedName:i})}}}return t},Qs=({absoluteFilePath:e,staticImports:t},n,r=()=>!0,i=()=>!0)=>{let a=new Map,o=(e,t,n)=>{if(!((a.get(e)??-1)>=n)){a.set(e,n);for(let a of Zs(t)){let t=k(e,a.source,a.exportedName);!t||n===0||!r(t)||!i(t.filePath)||o(t.filePath,t.programNode,n-1)}}};for(let a of Us(t)){let t=k(e,a.source,a.exportedName);!t||!r(t)||!i(t.filePath)||o(t.filePath,t.programNode,n)}},$s=e=>{Qs(e,4)},ec=({absoluteFilePath:e,sourceText:t,getProgram:n})=>{if(!t.includes(`createRef`)&&!t.includes(`\\u`))return;let r=n();zt(r);let i=Fe(r);A(r,t=>{!x(t,`CallExpression`)||!Vi(t,`createRef`,i,{allowGlobalReactNamespace:!0,allowUnboundBareCalls:!0,resolveNamedAliases:!0})||Hs(t,e,i)})},tc=({absoluteFilePath:e,sourceText:t,staticImports:n,getProgram:r})=>{let i=new Set,a=new Set;for(let e of n)if(e.moduleRequest.value===`react`)for(let t of e.entries){let{importName:e}=t;e.kind===`Name`&&e.name===`useReducer`?i.add(t.localName.value):(e.kind===`Default`||e.kind===`NamespaceObject`)&&a.add(t.localName.value)}if(!(i.size>0||a.size>0&&(t.includes(`useReducer`)||t.includes(`\\u`))))return;let o=r(),s=e=>{if(e?.type!==`Identifier`)return null;let{name:t}=e;return typeof t==`string`?t:null},c=e=>{let t=s(e);if(t!==null)return i.has(t);if(e.type!==`MemberExpression`)return!1;let n=e,r=s(n.object);return r!==null&&a.has(r)&&s(n.property)===`useReducer`},l=new Set;if(A(o,e=>{if(e.type!==`CallExpression`)return;let t=e;if(!t.callee||!c(t.callee))return;let n=t.arguments?.[0];if(!n)return;let r=s(O(n));r!==null&&l.add(r)}),l.size!==0)for(let t of n)for(let n of t.entries){if(n.importName.kind===`NamespaceObject`||!l.has(n.localName.value))continue;let r=n.importName.kind===`Default`?`default`:n.importName.name;r&&Nn(e,t.moduleRequest.value,r)}},nc=({absoluteFilePath:e,staticImports:t,getProgram:n})=>{At(e),Ln({absoluteFilePath:e,staticImports:t,program:n()})},H=({absoluteFilePath:e})=>{At(e)},rc=e=>{H(e),Xs(e)},ic=e=>{H(e),Qs(e,1/0,e=>b(e.exportedNode),e=>!e.split(/[\\/]/).includes(`node_modules`))},ac=({absoluteFilePath:e})=>{Or(e)},oc=({absoluteFilePath:e})=>{Pr(e)},sc=e=>{oc(e),Ln({absoluteFilePath:e.absoluteFilePath,staticImports:e.staticImports,program:e.getProgram()})},cc=new Map([..._.map(e=>[e,oc]),[`ink-no-raw-text`,sc],[`client-passive-event-listeners`,V],[`effect-needs-cleanup`,V],[`exhaustive-deps`,$s],[`no-barrel-import`,Ws],[`nextjs-async-dynamic-api-not-awaited`,H],[`nextjs-missing-metadata`,Gs],[`nextjs-no-use-search-params-without-suspense`,Ks],[`no-dynamic-import-path`,H],[`no-full-lodash-import`,H],[`no-hydration-branch-on-browser-global`,rc],[`no-indeterminate-attribute`,H],[`no-locale-format-in-render`,H],[`no-match-media-in-state-initializer`,H],[`no-create-ref-in-function-component`,ec],[`no-adjust-state-on-prop-change`,V],[`no-derived-state`,V],[`no-derived-state-effect`,V],[`no-event-handler`,V],[`no-initialize-state`,V],[`no-reset-all-state-on-prop-change`,V],[`no-mutating-reducer-state`,tc],[`no-side-effect-in-state-updater-function`,Ys],[`no-unguarded-browser-global-at-module-scope`,Xs],[`no-unguarded-browser-global-in-render-or-hook-init`,ic],[`prefer-dynamic-import`,H],[`rendering-hydration-mismatch-time`,H],[`rendering-hydration-no-flicker`,V],[`rerender-memo-with-default-value`,$s],[`rn-no-legacy-shadow-styles`,ac],[`rn-no-raw-text`,nc],[`rn-prefer-expo-image`,H],[`rn-style-prefer-boxshadow`,ac],...re.map(e=>[e,H])]),lc=new Set([`anchor-target-exists`,`nextjs-no-img-element`,`no-img-without-dimensions`,`no-loading-flag-reset-outside-finally`,`only-export-components`,`remotion-calculate-metadata-fetch-signal`,`remotion-deterministic-randomness`,`remotion-no-css-animation`,`remotion-no-css-transition`,`remotion-no-css-url-assets`,`remotion-no-native-media-elements`,`remotion-no-next-image`,`window-open-without-noopener`]),uc=t=>{let n=new Set;for(let e of t.ruleIds){let t=cc.get(e);if(!t)return null;n.add(t)}let r=Ui(t.absoluteFilePath),i,a;try{let n=e(r,t.sourceText,{astType:`ts`,lang:Vt(r)});if(n.errors.some(e=>e.severity===`Error`))return null;i=n.module.staticImports;let o;a=()=>(o??=n.program,o)}catch{return null}let o={absoluteFilePath:r,sourceText:t.sourceText,staticImports:i,getProgram:a};return mt(()=>{for(let e of n)e(o)})},dc={},fc=(e,t,n)=>!e||e.length===0?!1:e.every(e=>x(e,t)&&e[n]===`type`),pc=e=>e.importKind===`type`||fc(e.specifiers,`ImportSpecifier`,`importKind`),mc=new Set([`solid-js`,`solid-js/web`,`solid-js/store`,`solid-js/h`,`solid-js/html`,`@builder.io/qwik`,`@builder.io/qwik-city`,`@builder.io/qwik-react`,`voby`,`vidode`]),hc=[`solid-js`,`@builder.io/qwik`],gc=[`react`,`react-dom`,`preact`],_c=new WeakMap,vc=new WeakMap,yc=(e,t)=>t.some(t=>e===t||e.startsWith(`${t}/`)),bc=e=>{let t=_c.get(e);if(t)return t;let n=!1,r=!1,i=!1;for(let t of e.body){if(i||A(t,e=>{if(i)return!1;if(x(e,`JSXOpeningElement`)&&Sc(e))return i=!0,!1}),!x(t,`ImportDeclaration`))continue;let e=t;if(pc(e))continue;let a=e.source,o=a&&typeof a.value==`string`?a.value:null;o&&((mc.has(o)||yc(o,hc))&&(n=!0),yc(o,gc)&&(r=!0))}let a={hasNonReactMarker:i,hasNonReactRuntime:n,hasReactRuntime:r};return _c.set(e,a),a},xc=e=>{let t=bc(e);return t.hasNonReactRuntime&&!t.hasReactRuntime},Sc=e=>{let t=vc.get(e);if(t!==void 0)return t;let n=!1;for(let t of e.attributes){if(!x(t,`JSXAttribute`)||!x(t.name,`JSXIdentifier`))continue;let e=t.name.name;if(e===`classList`&&x(t.value,`JSXExpressionContainer`)&&x(t.value.expression,`ObjectExpression`)||e.startsWith(`class:`)||e.startsWith(`bind:`)){n=!0;break}}return vc.set(e,n),n},Cc=`/test/,/tests/,/testing/,/__tests__/,/__test__/,/__fixtures__/,/fixtures/,/__mocks__/,/mocks/,/testUtils/,/test-utils/,/test-stubs/,/testutils/,/cypress/,/playwright/,/.storybook/,/.dumi/,/stories/,/__stories__/,/playground/,/playgrounds/,/examples/,/example/,/demo/,/demos/,/sandbox/,/sandboxes/,/e2e/,/e2e-tests/,/specs/,/spec/,/integration-tests/,/integration/,/it/,/benchmarks/,/benchmark/,/__benchmarks__/,/perf/,/perf-tests/,/scripts/,/cli/,/bin/,/tooling/,/tools/,/codemods/,/codemod/,/migrations/,/migration/,/generators/,/generator/,/runbooks/,/devtools/,/internal-tools/,/seeds/,/seed/,/dev-seeder/`.split(`,`),wc=[`.test.`,`.spec.`,`.cy.`,`.stories.`,`.story.`,`.bench.`,`.benchmark.`,`.e2e.`,`.integration-spec.`,`.int-spec.`,`.mock.`,`.mocks.`,`.fixture.`],Tc=new Set(`setuptests.js,setuptests.ts,setuptests.jsx,setuptests.tsx,setupvitest.js,setupvitest.ts,setupvitest.jsx,setupvitest.tsx,setupjest.js,setupjest.ts,vitest.setup.js,vitest.setup.ts,vitest.setup.mjs,vitest.config.ts,vitest.config.js,vitest.config.mts,vitest.config.mjs,jest.setup.js,jest.setup.ts,jest.setup.jsx,jest.setup.tsx,jest.config.js,jest.config.ts,jest.config.mjs,playwright.config.ts,playwright.config.js,cypress.config.ts,cypress.config.js,karma.conf.js,karma.conf.ts,vite.config.ts,vite.config.js,vite.config.mts,vite.config.mjs,webpack.config.ts,webpack.config.js,webpack.config.mjs,rollup.config.ts,rollup.config.js,rollup.config.mjs,esbuild.config.ts,esbuild.config.js,esbuild.config.mjs,tsup.config.ts,tsup.config.js,tsup.config.mjs,rsbuild.config.ts,rsbuild.config.js,rspack.config.ts,rspack.config.js,next.config.ts,next.config.js,next.config.mjs,remix.config.js,remix.config.ts,astro.config.ts,astro.config.js,astro.config.mjs,tailwind.config.ts,tailwind.config.js,tailwind.config.mjs,postcss.config.ts,postcss.config.js,postcss.config.mjs,biome.config.ts,biome.config.js,drizzle.config.ts,drizzle.config.js,prisma.config.ts,prisma.config.js,knip.config.ts,knip.config.js,knip.config.mjs,lint-staged.config.js,lint-staged.config.mjs`.split(`,`)),Ec=[`/src/`,`/app/`,`/lib/`,`/components/`,`/pages/`,`/features/`,`/modules/`,`/packages/`,`/apps/`,`/frontend/`,`/client/`],Dc=Cc.filter(e=>e.startsWith(`/.`)),Oc=e=>{let t=-1;for(let n of Ec){let r=e.lastIndexOf(n);r>t&&(t=r)}return t<0?e:e.slice(t)};let kc,Ac=!1;const jc=e=>e?e===kc?Ac:(kc=e,Ac=Nc(e),Ac):!1,Mc=(e,t)=>e?Nc(e,t):!1,Nc=(e,t=new Set)=>{let n=e.replaceAll(`\\`,`/`),r=n.lastIndexOf(`/`),i=r===-1?n:n.slice(r+1);if(Tc.has(i.toLowerCase()))return!0;for(let e of wc)if(i.includes(e))return!0;let a=n.startsWith(`/`)?n:`/${n}`;for(let e of Dc)if(!t.has(e)&&a.includes(e))return!0;let o=Oc(n);for(let e of Cc)if(!t.has(e)&&(e.startsWith(`/.`)?n:o).includes(e))return!0;return!1},Pc=e=>t=>jc(t.filename)?dc:e(t),Fc=e=>{let t=e?.[`react-doctor`];return typeof t!=`object`||!t||Array.isArray(t)?null:t},Ic=(e,t)=>Object.getOwnPropertyDescriptor(e,t)?.value,Lc=(e,t)=>{let n=Fc(e);if(!n)return;let r=Ic(n,t);return typeof r==`string`?r:void 0},Rc=(e,t)=>{let n=Fc(e);if(!n)return;let r=Ic(n,t);return typeof r==`number`&&Number.isFinite(r)?r:void 0},zc=(e,t)=>{let n=Fc(e);if(!n)return;let r=Ic(n,t);if(Array.isArray(r))return r.filter(e=>typeof e==`string`&&e.length>0)},Bc=(e,t)=>zc(e,t)??[],Vc=(e,t)=>Bc(e,`capabilities`).includes(t),Hc=(e,t)=>{let n=Fc(e);return!n||Ic(n,`capabilities`)===void 0?!0:Vc(e,t)},Uc=(e,t)=>!t?.some(t=>Vc(e,t)),Wc=(e,t)=>n=>Uc(n.settings,t)?e(n):dc,Gc=e=>(t=>{let n=e(t),r=!1,i=!1,a={};for(let e in n){if(!Object.hasOwn(n,e))continue;let t=n[e];if(typeof t!=`function`){a[e]=t;continue}let o=e.charAt(0);if(o<`A`||o>`Z`){a[e]=t;continue}if(e===`Program`){a.Program=e=>{let n=bc(e);i=n.hasReactRuntime,r=!n.hasReactRuntime&&(n.hasNonReactRuntime||n.hasNonReactMarker),t(e)};continue}if(e===`JSXOpeningElement`){a.JSXOpeningElement=e=>{!i&&!r&&Sc(e)&&(r=!0),!r&&t(e)};continue}a[e]=(...e)=>{r||t(...e)}}return`Program`in a||(a.Program=e=>{let t=bc(e);i=t.hasReactRuntime,r=!t.hasReactRuntime&&(t.hasNonReactRuntime||t.hasNonReactMarker)}),a}),U=e=>{if(!(`create`in e))return{...e,create:()=>dc};let t=e.tags,n=e.create,r=t?.includes(`test-noise`)&&!t?.includes(`migration-hint`);return t?.includes(`react-jsx-only`)&&(n=Gc(n)),r&&(n=Pc(n)),e.disabledWhen&&(n=Wc(n,e.disabledWhen)),n===e.create?e:{...e,create:n}};let Kc;const qc=e=>{let t=[0];for(let n=0;n<e.length;n+=1){let r=e[n];if(r===`\r`&&e[n+1]===`
2
+ `&&(r=!1,t+=o);continue}if(i){o===`*`&&s===`/`&&(i=!1,a++);continue}if(n){t+=o,o===`\\`?(t+=s??``,a++):o===`"`&&(n=!1);continue}if(o===`"`){n=!0,t+=o;continue}if(o===`/`&&s===`/`){r=!0,a++;continue}if(o===`/`&&s===`*`){i=!0,a++;continue}t+=o}return t.replace(/,(\s*[}\]])/g,`$1`)},_n=(e,t)=>{D(e),t.push(e);let n;try{n=r.readFileSync(e,`utf8`)}catch{return null}try{let e=JSON.parse(gn(n));return hn(e)?e:null}catch{return null}},vn=(e,t)=>{let n=e.endsWith(`.json`)?e:`${e}.json`;return e.startsWith(`./`)||e.startsWith(`../`)?i.resolve(t,n):i.join(t,`node_modules`,n)},yn=e=>{let t=new Map;if(!hn(e))return t;for(let[n,r]of Object.entries(e)){if(!Array.isArray(r))continue;let e=r.filter(e=>typeof e==`string`);e.length>0&&t.set(n,e)}return t},bn=(e,t,n)=>{let r=_n(e,n);if(!r)return null;let a=i.dirname(e),o=hn(r.compilerOptions)?r.compilerOptions:{},s=typeof o.baseUrl==`string`?o.baseUrl:null,c=s!==null,l=s===null?a:i.resolve(a,s);if(hn(o.paths))return{baseAbsolutePath:l,hasExplicitBaseUrl:c,paths:yn(o.paths)};if(typeof r.extends==`string`&&t<8){let e=vn(r.extends,a),i=e?bn(e,t+1,n):null;if(i)return i}return c?{baseAbsolutePath:l,hasExplicitBaseUrl:c,paths:new Map}:null},xn=new Map,Sn=new Map,Cn=e=>{D(e);let t;try{t=r.statSync(e)}catch{return{config:null,probedContentPaths:new Set([e])}}let n=xn.get(e);if(n&&n.mtimeMs===t.mtimeMs){for(let e of n.probedChainPaths)D(e);return{config:n.config,probedContentPaths:new Set(n.probedChainPaths)}}let i=[],a=bn(e,0,i);return xn.set(e,{mtimeMs:t.mtimeMs,config:a,probedChainPaths:i}),{config:a,probedContentPaths:new Set(i)}},wn=(e,t,n)=>{let r=new Set(t.probedContentPaths),i=n;for(let n=e.length-1;n>=0;n--){let a=e[n];i++;for(let e of a.probedContentPaths)r.add(e);Sn.set(a.directory,{config:t.config,directoryCount:i,probedContentPaths:new Set(r)})}},Tn=e=>{let t=Sn.get(e);if(t!==void 0){for(let e of t.probedContentPaths)D(e);return t.config}let n=[],r=e;for(let e=0;e<30;e++){let t=Sn.get(r),a=30-e;if(t!==void 0&&t.directoryCount<=a){for(let e of t.probedContentPaths)D(e);return wn(n,t,t.directoryCount),t.config}let o=new Set;for(let e of mn){let t=Cn(i.join(r,e));for(let e of t.probedContentPaths)o.add(e);if(t.config)return n.push({directory:r,probedContentPaths:o}),wn(n,{config:t.config,probedContentPaths:new Set},0),t.config}n.push({directory:r,probedContentPaths:o});let s=i.dirname(r);if(s===r)return wn(n,{config:null,probedContentPaths:new Set},0),null;r=s}let a=new Set;for(let e of n)for(let t of e.probedContentPaths)a.add(t);return Sn.set(e,{config:null,directoryCount:n.length,probedContentPaths:a}),null},En=(e,t)=>{let n=t.indexOf(`*`);if(n===-1)return e===t?``:null;let r=t.slice(0,n),i=t.slice(n+1);return e.length>=r.length+i.length&&e.startsWith(r)&&e.endsWith(i)?e.slice(r.length,e.length-i.length):null},Dn=(e,t)=>{let n=Tn(i.dirname(e));if(!n)return null;let r=null,a=``,o=-1;for(let e of n.paths.keys()){let n=En(t,e);if(n===null)continue;let i=e.indexOf(`*`),s=i===-1?e.length:i;s>o&&(r=e,a=n,o=s)}if(r)for(let e of n.paths.get(r)??[]){let t=e.replaceAll(`*`,a),r=dn(i.resolve(n.baseAbsolutePath,t));if(r)return r}return n.hasExplicitBaseUrl?dn(i.resolve(n.baseAbsolutePath,t)):null},On=()=>{xn.clear(),Sn.clear()},kn=(e,t)=>i.isAbsolute(t)?null:t.startsWith(`.`)?fn(e,t):Dn(e,t),An=new Map,jn=()=>{An.clear()},Mn=(e,t,n)=>{if(n.size>=4||n.has(e))return null;n.add(e);let r=Wt(e);if(!r)return null;let i=Rt(r,t);if(i)return{filePath:e,exportedNode:i,programNode:r};let a=new Map;for(let i of It(r,t)){let t=kn(e,i.source);if(!t)continue;let r=Mn(t,i.importedName,new Set(n));r&&a.set(r.exportedNode,r)}return a.size===1?a.values().next().value??null:null},Nn=(e,t,n)=>Pn(e,t,n)?.functionNode??null,Pn=(e,t,n)=>{let r=k(e,t,n);return!r||!b(r.exportedNode)?null:{filePath:r.filePath,functionNode:r.exportedNode,programNode:r.programNode}},k=(e,t,n)=>{if(!ft()){let r=kn(e,t);return r?Mn(r,n,new Set):null}let r=`${e}\0${t}\0${n}`,i=An.get(r);if(i!==void 0){for(let e of i.trace.contentPaths)D(e);for(let e of i.trace.existencePaths)dt(e);return i.result}let a=pt(()=>{let r=kn(e,t);return r?Mn(r,n,new Set):null});return An.set(r,{result:a.value,trace:a.trace}),a.value},Fn=(e,t)=>{let n=e,r=he[e.type];if(r!==void 0){for(let e=r.length-1;e>=0;--e){let i=n[r[e]];if(Array.isArray(i))for(let e=i.length-1;e>=0;--e){let n=i[e];y(n)&&t.push(n)}else y(i)&&t.push(i)}return}let i=Object.keys(n);for(let e=i.length-1;e>=0;--e){let r=i[e];if(r===`parent`)continue;let a=n[r];if(Array.isArray(a))for(let e=a.length-1;e>=0;--e){let n=a[e];y(n)&&t.push(n)}else y(a)&&t.push(a)}},In=(e,t)=>{let n=e,r=he[e.type];if(r!==void 0){for(let e=0;e<r.length;e+=1){let i=n[r[e]];if(Array.isArray(i))for(let e=0;e<i.length;e+=1){let n=i[e];y(n)&&t(n)}else y(i)&&t(i)}return}for(let e in n){if(e===`parent`||!Object.hasOwn(n,e))continue;let r=n[e];if(Array.isArray(r))for(let e=0;e<r.length;e+=1){let n=r[e];y(n)&&t(n)}else y(r)&&t(r)}},A=(e,t)=>{if(!e||typeof e!=`object`)return;let n=[e];for(;n.length>0;){let e=n.pop();e===void 0||t(e)===!1||Fn(e,n)}},Ln=({absoluteFilePath:e,staticImports:t,program:n})=>{let r=new Set;if(A(n,e=>{if(e.type!==`JSXOpeningElement`)return;let t=e.name;if(t){if(t.type===`JSXIdentifier`){let e=t.name;typeof e==`string`&&r.add(e)}else if(t.type===`JSXMemberExpression`){let e=t.property;e?.type===`JSXIdentifier`&&typeof e.name==`string`&&r.add(e.name)}else if(t.type===`JSXNamespacedName`){let e=t.namespace;typeof e?.name==`string`&&r.add(e.name)}}}),r.size!==0)for(let n of t)for(let t of n.entries){let{importName:i}=t;if(i.kind===`NamespaceObject`||!r.has(t.localName.value))continue;let a=i.kind===`Default`?`default`:i.name;a&&Nn(e,n.moduleRequest.value,a)}},Rn=e=>e.replace(/^type\s+/,``).trim(),zn=(e,t)=>e.split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>{let n=t||e.startsWith(`type `),[r,i]=e.split(/\s+as\s+/),a=Rn(r??``);return{localName:a,exportedName:Rn(i??a),isTypeOnly:n}}),Bn=/\/\*[\s\S]*?\*\//g,Vn=/^\s*\/\/.*$/gm,Hn=e=>e.replace(Bn,``).replace(Vn,``),Un=/^\s*export\s+default\b/m,Wn=/^\s*export\s+(?:declare\s+)?(?:(?:async\s+)?function|(?:abstract\s+)?class|const|let|var|enum|interface|type)\s+([\w$]+)/gm,Gn=/^\s*export\s+(?:type\s+)?\{([\s\S]*?)\}(?:\s+from\s+["'][^"']+["'])?\s*;?\s*(?:(?:\/\/[^\n]*)?\s*)/gm,Kn=e=>{let t=Hn(e),n=new Set;Un.test(t)&&n.add(`default`);for(let e of t.matchAll(Wn))e[1]&&n.add(e[1]);for(let e of t.matchAll(Gn)){let t=e[1]??``;for(let e of zn(t,!1))n.add(e.exportedName)}return n},qn=new Map,Jn=(e,t)=>{D(e);try{let n=r.statSync(e),i=qn.get(e);if(i&&i.mtimeMs===n.mtimeMs&&i.size===n.size)return i.exportedNames.has(t);let a=Kn(r.readFileSync(e,`utf8`));return qn.set(e,{mtimeMs:n.mtimeMs,size:n.size,exportedNames:a}),a.has(t)}catch{return!1}},Yn=(e,t)=>{let n=e.replaceAll(`\\`,`/`),r=i.dirname(n);for(let e=0;e<30;e++){for(let e of Be){let a=i.join(r,e);if(a.replaceAll(`\\`,`/`)!==n&&t(a))return!0}let e=i.dirname(r);if(i.basename(r)===`app`&&i.basename(e)!==`app`||e===r)break;r=e}return!1},Xn=e=>Yn(e,e=>Ve.some(t=>Jn(e,t))),j=e=>{if(!x(e,`ImportSpecifier`))return;let t=e.imported;if(x(t,`Identifier`))return t.name;if(x(t,`Literal`)&&typeof t.value==`string`)return t.value},Zn=e=>x(e,`JSXIdentifier`)?e.name===`Suspense`:x(e,`JSXMemberExpression`)&&x(e.property,`JSXIdentifier`)&&e.property.name===`Suspense`,Qn=e=>{let t=!1;return A(e,e=>{if(t)return!1;if(x(e,`JSXOpeningElement`)&&Zn(e.name)||x(e,`ImportDeclaration`)&&e.source?.value===`react`&&(e.specifiers??[]).some(e=>x(e,`ImportSpecifier`)&&j(e)===`Suspense`))return t=!0,!1}),t},$n=e=>Yn(e,e=>{let t=Wt(e);return!!(t&&Qn(t))}),er=e=>{if(x(e,`ImportDeclaration`)){if(e.importKind===`type`||e.specifiers.length>0&&e.specifiers.every(e=>x(e,`ImportSpecifier`)&&e.importKind===`type`))return null}else if(x(e,`ExportNamedDeclaration`)){if(e.exportKind===`type`||!e.source||e.specifiers.length>0&&e.specifiers.every(e=>x(e,`ExportSpecifier`)&&e.exportKind===`type`))return null}else if(x(e,`ExportAllDeclaration`)){if(e.exportKind===`type`)return null}else return null;return e.source&&typeof e.source.value==`string`?e.source.value:null},M=e=>{let t=e.property;return!e.computed&&x(t,`Identifier`)?t.name:e.computed&&x(t,`Literal`)?typeof t.value==`string`?t.value:null:e.computed&&x(t,`TemplateLiteral`)&&t.expressions.length===0?t.quasis[0]?.value.cooked??t.quasis[0]?.value.raw??null:null},tr=/^index\.(?:[cm]?[jt]sx?|mjs)$/,nr=/^\s*import\s+(type\s+)?(?!["'])([^;]*?)\s+from\s+["']([^"']+)["']\s*;?\s*(?:(?:\/\/[^\n]*)?\s*)/gm,rr=/^\s*export\s+(type\s+)?(?:\*(?:\s+as\s+([\w$]+))?|\{([\s\S]*?)\})\s+from\s+["']([^"']+)["']\s*;?\s*(?:(?:\/\/[^\n]*)?\s*)/gm,ir=/^\s*export\s+(type\s+)?\{([\s\S]*?)\}\s*;?\s*(?:(?:\/\/[^\n]*)?\s*)/gm,ar=new Map,or=e=>tr.test(i.basename(e)),sr=()=>({isBarrel:!1,exportsByName:new Map,starExportSources:[]}),cr=(e,t)=>{e.set(t.localName,{...t,didExport:!1})},lr=(e,t,n,r)=>{for(let i of zn(e,n))cr(r,{localName:i.exportedName,importedName:i.localName,source:t,isTypeOnly:i.isTypeOnly})},ur=(e,t,n,r)=>{let i=e.trim(),a=i.match(/(?:^|,\s*)\*\s+as\s+([\w$]+)/);a?.[1]&&cr(r,{localName:a[1],importedName:`*`,source:t,isTypeOnly:n});let o=i.match(/\{([\s\S]*?)\}/);o?.[1]&&lr(o[1],t,n,r);let s=i.split(`,`)[0]?.trim();s&&!s.startsWith(`{`)&&!s.startsWith(`*`)&&cr(r,{localName:s,importedName:`default`,source:t,isTypeOnly:n})},dr=(e,t,n,r)=>{let i=e.replace(nr,(e,n,r,i)=>(ur(r,i,!!n,t),``));return i=i.replace(rr,(e,t,i,a,o)=>{let s=!!t;if(i)return n.set(i,{exportedName:i,importedName:`*`,source:o,isTypeOnly:s}),``;if(a){for(let e of zn(a,s))n.set(e.exportedName,{exportedName:e.exportedName,importedName:e.localName,source:o,isTypeOnly:e.isTypeOnly});return``}return r.push(o),``}),i=i.replace(ir,(e,r,i)=>{for(let a of zn(i,!!r)){let r=t.get(a.localName);if(!r)return e;r.didExport=!0,n.set(a.exportedName,{exportedName:a.exportedName,importedName:r.importedName,source:r.source,isTypeOnly:a.isTypeOnly||r.isTypeOnly})}return``}),i},fr=e=>{for(let t of e.values())if(!t.isTypeOnly&&!t.didExport)return!0;return!1},pr=e=>{let t=Hn(e).trim();if(!t)return sr();let n=new Map,r=new Map,i=[];return dr(t,n,r,i).trim()||fr(n)?sr():{isBarrel:r.size>0||i.length>0,exportsByName:r,starExportSources:i}},mr=e=>{if(!or(e))return sr();D(e);let t;try{t=r.statSync(e)}catch{t=null}let n=ar.get(e);if(n!==void 0&&t!==null&&n.mtimeMs===t.mtimeMs&&n.size===t.size)return n.moduleInfo;if(t===null)return sr();let i=sr();try{i=pr(r.readFileSync(e,`utf8`))}catch{i=sr()}return ar.set(e,{mtimeMs:t.mtimeMs,size:t.size,moduleInfo:i}),i},hr=e=>mr(e).isBarrel,gr=i.join(`android`,`gradle.properties`),_r=/^\s*newArchEnabled\s*=\s*false\s*$/m,vr=[`app.config.ts`,`app.config.js`,`app.config.cjs`,`app.config.mjs`],yr=[`app.config.json`,`app.json`],br=new WeakMap,xr=e=>{D(i.join(e,gr));for(let t of vr)dt(i.join(e,t));for(let t of yr)D(i.join(e,t))},Sr=e=>{try{return r.readFileSync(e,`utf-8`)}catch{return null}},Cr=e=>{let t=e.dependencies?.[`react-native`]??e.devDependencies?.[`react-native`];return typeof t==`string`?t:null},wr=e=>{let t=e.match(/(?:^|[^\d.])0\.(\d+)/);return t?Number.parseInt(t[1],10):null},Tr=e=>{let t=Sr(i.join(e,gr));return t!==null&&_r.test(t)},Er=e=>{for(let t of vr)if(r.existsSync(i.join(e,t)))return!1;for(let t of yr){let n=Sr(i.join(e,t));if(n===null)continue;let r;try{r=JSON.parse(n)}catch{continue}if(typeof r!=`object`||!r)continue;let a=Object.getOwnPropertyDescriptor(r,`expo`)?.value;if(!(typeof a!=`object`||!a)&&Object.getOwnPropertyDescriptor(a,`newArchEnabled`)?.value===!1)return!0}return!1},Dr=(e,t)=>{let n=Cr(t);if(n!==null){let e=wr(n);if(e!==null&&e<76)return!0}return Tr(e)||Er(e)},Or=e=>{let t=vt(e);if(!t)return!1;let n=yt(e);if(!n)return!1;xr(t);let r=br.get(n);if(r!==void 0)return r;let i=Dr(t,n);return br.set(n,i),i},kr=e=>{let t=e.match(/^(\d+)(?:\.(\d+))?(?:\.(\d+))?(-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/);return t?{major:Number(t[1]),minor:Number(t[2]??0),patch:Number(t[3]??0),isPrerelease:!!t[4]}:null},Ar=(e,t)=>e.major-t.major||e.minor-t.minor||e.patch-t.patch||Number(t.isPrerelease)-Number(e.isPrerelease),jr=e=>{if(typeof e!=`string`)return null;let t=e.trim();if(!t||/^(?:catalog|file|git|https?|link|npm|workspace):/.test(t)||/^(?:latest|next|\*)$/.test(t))return null;let n=[];for(let e of t.split(`||`)){let t=e.trim();if(/^<(?!=)/.test(t)||/^<=/.test(t))return null;let r=t.match(/\d+(?:\.\d+)?(?:\.\d+)?(?:-[0-9A-Za-z.-]+)?/)?.[0];if(!r)return null;let i=kr(r);if(!i)return null;n.push(i)}return n.reduce((e,t)=>Ar(t,e)<0?t:e)},Mr=e=>jr(e.dependencies?.ink??e.devDependencies?.ink??e.peerDependencies?.ink??e.optionalDependencies?.ink),Nr=e=>{let t=e;for(;;){let e=bt(i.join(t,`node_modules`,`ink`));if(e)return{didFindPackage:!0,version:typeof e.version==`string`?kr(e.version):null};let n=i.dirname(t);if(n===t)return{didFindPackage:!1,version:null};t=n}},Pr=e=>{if(!e)return null;let t=vt(i.resolve(e));if(!t)return null;let n=Nr(t);if(n.didFindPackage)return n.version;let r=bt(t);return r?Mr(r):null},Fr=(e,t)=>{let n=Pr(e),r=kr(t);return!!(n&&r&&Ar(n,r)>=0)},Ir=new Set([`@monaco-editor/react`,`monaco-editor`,`recharts`,`@react-pdf/renderer`,`react-quill`,`@codemirror/view`,`@codemirror/state`,`chart.js`,`react-chartjs-2`,`@toast-ui/editor`,`draft-js`,`mermaid`]),Lr=new Set([`fetch`,`ky`,`got`,`wretch`,`ofetch`]),Rr=new Set([`axios`,`ky`,`got`,`ofetch`,`wretch`,`request`]),zr=new Set([`create`,`insert`,`insertInto`,`update`,`upsert`,`delete`,`remove`,`destroy`,`set`,`append`]),Br=new Set([`POST`,`PUT`,`DELETE`,`PATCH`]),Vr=new Set([`Map`,`Set`,`WeakMap`,`WeakSet`,`Headers`,`URLSearchParams`,`FormData`,`Response`,`NextResponse`]),Hr=new Set([`Response`,`NextResponse`]),Ur=new Set([`json`,`redirect`,`next`,`rewrite`,`error`]),Wr=new Set([`wheel`,`mousewheel`,`touchstart`,`touchmove`]),Gr=new Set([`defer`,`async`]),Kr=new Set([`text/javascript`,`application/javascript`,`module`]),qr=new Set([`setTimeout`,`setInterval`,`requestAnimationFrame`,`requestIdleCallback`,`queueMicrotask`]),Jr=new Set([`setInterval`,`setTimeout`]),Yr=new Set([`clearInterval`,`clearTimeout`]),Xr=new Set([`WebSocket`,`EventSource`,`BroadcastChannel`,`RTCPeerConnection`]),Zr=new Set([`location`,`window`,`document`,`navigator`,`history`,`screen`,`performance`]),Qr=new Set([`IntersectionObserver`,`MutationObserver`,`ResizeObserver`,`PerformanceObserver`]),$r=new Set([`blur`,`canPlayType`,`focus`,`getBoundingClientRect`,`getClientRects`,`measure`,`measureInWindow`,`measureLayout`,`scroll`,`scrollBy`,`scrollIntoView`,`scrollTo`,`select`,`setRangeText`,`setSelectionRange`]),ei=new Set([`localStorage`,`sessionStorage`]),ti=new Set([`index`,`idx`,`i`]),ni=new Set([`react`,`react-dom`,`preact/compat`,`preact/hooks`,`@wordpress/element`]),ri=new Set([`next`,`next-themes`,`@remix-run/react`,`swr`,`zustand`,`jotai`,`recoil`,`wouter`,`framer-motion`,`@apollo/client`,`urql`,`usehooks-ts`]),ii=/^(?:isLoading|isPending)$/,ai=new Set([`useState`,`useMemo`,`useRef`]),oi=new Set([`Click`,`Change`,`Input`,`Blur`,`Focus`]),si=new Set([`Boolean`,`String`,`Number`,`Array`,`Object`,`parseInt`,`parseFloat`]),ci=/^set[A-Z]/,li=/^render[A-Z]/,ui=/^[A-Z]/,di=/^on[A-Z]/,fi=/^use[A-Z]/,pi=/^(?:on|handle)[A-Z]/,mi=new Set([`useEffect`,`useLayoutEffect`]),hi=new Set([`useEffect`,`useLayoutEffect`,`useMemo`,`useCallback`]),gi=new Set([`use`,`useState`,`useRef`,`useMemo`,`useCallback`,`useReducer`,`useContext`,`useEffect`,`useLayoutEffect`,`useInsertionEffect`,`useImperativeHandle`,`useSyncExternalStore`,`useDeferredValue`,`useTransition`,`useId`,`useDebugValue`]),_i=new Set([`memo`,`forwardRef`,`React.memo`,`React.forwardRef`]),vi=new Set([`useMemo`,`useCallback`]),yi=new Set([`memo`,`forwardRef`,`observer`,`lazy`]),bi=new Set([`subscribe`,`addEventListener`,`addListener`,`on`,`watch`,`listen`,`sub`]),xi=new Set([`subscribe`,`sub`,`listen`]),Si=new Set([`unsubscribe`,`removeEventListener`,`removeListener`,`off`,`unwatch`,`unlisten`,`unsub`,`abort`,`disconnect`,`unobserve`,`close`]),Ci=new Set([`remove`,`cleanup`,`dispose`,`destroy`,`stop`,`teardown`]),wi=new Set([...Si,`cleanup`,`dispose`,`destroy`,`teardown`]),Ti=new Set([...bi,`connect`,`disconnect`,`open`,`close`,`fetch`,`post`,`put`,`patch`]),Ei=new Set([`get`,`head`,`options`,`delete`]),Di=new Set([...Lr,...qr]),Oi=new Set([...Lr,`post`,`put`,`patch`,`navigate`,`navigateTo`,`showNotification`,`toast`,`alert`,`confirm`,`logVisit`,`captureEvent`]),ki=new Set([`post`,`put`,`patch`,`delete`,`navigate`,`capture`,`track`,`logEvent`]),Ai=new Set([`push`,`replace`]),ji=new Set([`router`,`navigation`,`navigator`,`history`,`location`]),N=(e,t={})=>{if(!x(e,`Property`)&&!x(e,`MethodDefinition`)&&!x(e,`PropertyDefinition`)&&!x(e,`MemberExpression`))return null;let n=x(e,`MemberExpression`)?e.property:e.key;if(e.computed)return t.allowComputedString&&x(n,`Literal`)&&typeof n.value==`string`?n.value:t.allowComputedString&&t.stringifyNonStringLiterals&&x(n,`Literal`)?String(n.value):t.allowComputedString&&x(n,`TemplateLiteral`)&&n.expressions.length===0?n.quasis[0]?.value.cooked??n.quasis[0]?.value.raw??null:null;if(x(n,`Identifier`))return n.name;if(x(n,`Literal`)){if(typeof n.value==`string`)return n.value;if(t.stringifyNonStringLiterals)return String(n.value)}return null},P=(e,t,n=!1)=>{if(e.type!==`Identifier`&&e.type!==`JSXIdentifier`)return null;let r=null,i=t.symbolFor(e);for(;i?.kind===`const`;){if(!i.initializer||i.declarationNode.type!==`VariableDeclarator`)return null;if(i.declarationNode.id!==i.bindingIdentifier)return n?i:null;let e=O(i.initializer);if(e.type!==`Identifier`)return i;if(r?.has(i.id))return null;r||=new Set,r.add(i.id),i=t.symbolFor(e)}return i},Mi={},Ni=new WeakMap,Pi=(e,t)=>typeof e==`string`?e===t:e.has(t),Fi=e=>{let t=Ni.get(e);if(t)return t;let n=e.declarationNode.parent,r=!!(e.kind===`import`&&n&&n.type===`ImportDeclaration`&&typeof n.source.value==`string`&&ni.has(n.source.value)),i={importedName:r?j(e.declarationNode):void 0,isReactImport:r};return Ni.set(e,i),i},Ii=e=>Fi(e).isReactImport,Li=(e,t,n,r)=>{if(e.type!==`Identifier`)return!1;let i=r?P(e,n):n.symbolFor(e);if(!i)return!1;let a=Fi(i);return!!(a.isReactImport&&a.importedName&&Pi(t,a.importedName))},Ri=(e,t)=>{let n=P(e,t);if(!n)return!1;let r=Fi(n);return r.isReactImport?n.declarationNode.type===`ImportDefaultSpecifier`||n.declarationNode.type===`ImportNamespaceSpecifier`||r.importedName===`default`:!1},zi=(e,t,n)=>e.type===`Identifier`?Ri(e,t)?!0:!!(n.allowGlobalReactNamespace&&e.name===`React`&&t.isGlobalReference(e)):!1,Bi=(e,t,n,r)=>{let i=n.symbolFor(e);if(!i||i.kind!==`const`||!i.initializer||i.declarationNode.type!==`VariableDeclarator`)return!1;let a=i.declarationNode.id;if(a.type!==`ObjectPattern`)return!1;for(let e of a.properties){if(e.type!==`Property`||e.value!==i.bindingIdentifier)continue;let a=N(e);return!!(a&&Pi(t,a)&&zi(O(i.initializer),n,r))}return!1},Vi=(e,t,n,r=Mi)=>e.type===`CallExpression`?Hi(e.callee,t,n,r):!1,Hi=(e,t,n,r,i)=>{let a=O(e);if(r.resolveConditionalAliases&&a.type===`ConditionalExpression`)return Hi(a.consequent,t,n,r,new Set(i))&&Hi(a.alternate,t,n,r,new Set(i));if(a.type===`Identifier`){if(Li(a,t,n,!!r.resolveNamedAliases)||r.resolveNamedAliases&&Bi(a,t,n,r))return!0;if(r.resolveConditionalAliases){let e=n.symbolFor(a);if(e?.kind===`const`&&e.initializer&&!i?.has(e.id)){let a=i??new Set;return a.add(e.id),Hi(e.initializer,t,n,r,a)}}return!!(r.allowUnboundBareCalls&&Pi(t,a.name)&&n.isGlobalReference(a))}return a.type!==`MemberExpression`||!Pi(t,M(a)??``)?!1:zi(O(a.object),n,r)},Ui=e=>e.includes(`\\`)?e.replaceAll(`\\`,`/`):e,Wi=e=>{let t=new Set(e);if(t.size!==1)return null;let[n]=t;return n??null},Gi=(e,t,n,r)=>{let i=fn(e,n);return i?Ki(i,t,new Set(r))||(Jn(i,t)?i:null):null},Ki=(e,t,n=new Set)=>{if(n.has(e))return null;n.add(e);let r=mr(e);if(!r.isBarrel)return null;let i=r.exportsByName.get(t);if(i){let t=fn(e,i.source);return t?Ki(t,i.importedName,n)??t:null}return t===`default`?null:Wi(r.starExportSources.map(r=>Gi(e,t,r,n)).filter(e=>!!e))},qi=(e,t,n)=>{let r=k(e,t,n);return r?{filePath:r.filePath,node:r.exportedNode,programNode:r.programNode,kind:b(r.exportedNode)?`function`:`initializer`}:null},F=e=>{let t=e;for(;t.parent&&Lt.has(t.parent.type);)t=t.parent;return t},Ji=(e,t)=>{if(!x(e,`ArrowFunctionExpression`)&&!x(e,`FunctionExpression`)&&!x(e,`FunctionDeclaration`))return null;let n=e.params[0],r=x(n,`AssignmentPattern`)?n.left:n;if(x(r,`ObjectPattern`)){let e=r.properties.find(e=>x(e,`Property`)&&N(e,{allowComputedString:!0})===`children`);if(!e||!x(e,`Property`))return null;let n=x(e.value,`AssignmentPattern`)?e.value.left:e.value;if(!x(n,`Identifier`))return null;let i=t.symbolFor(n);return!i||i.references.length===0||i.references.some(e=>e.flag!==`read`)?null:i.references.map(e=>e.identifier)}if(!x(r,`Identifier`))return null;let i=t.symbolFor(r);if(!i||i.references.length===0)return null;let a=[];for(let e of i.references){if(e.flag!==`read`)return null;let t=[],n=F(e.identifier);for(;n.parent&&x(n.parent,`MemberExpression`)&&n.parent.object===n;){let e=M(n.parent);if(!e)return null;t.push(e),n=F(n.parent)}if(t[0]!==`children`){if(t.length===0)return null;continue}if(t.length!==1)return null;a.push(n)}return a.length>0?a:null},I=e=>{let t=e.parent;for(;t;){if(b(t))return t;t=t.parent??null}return null},Yi=e=>{let t=e;for(;t;){if(x(t,`Program`))return t;t=t.parent??null}return null},Xi=e=>{let t=new Map,n=e.body??[];for(let e of n){if(e.type!==`ImportDeclaration`||!(`source`in e)||!e.source)continue;let n=e.source.value;if(typeof n==`string`&&!(!(`specifiers`in e)||!Array.isArray(e.specifiers)))for(let r of e.specifiers){if(!(`local`in r)||!r.local)continue;let e=r.local;if(typeof e.name==`string`){if(r.type===`ImportDefaultSpecifier`)t.set(e.name,{source:n,imported:null,isDefault:!0,isNamespace:!1});else if(r.type===`ImportNamespaceSpecifier`)t.set(e.name,{source:n,imported:null,isDefault:!1,isNamespace:!0});else if(r.type===`ImportSpecifier`){let i=r.imported,a=i?.name??(typeof i?.value==`string`?i.value:null);t.set(e.name,{source:n,imported:a,isDefault:!1,isNamespace:!1})}}}}return t},Zi=new WeakMap,Qi=e=>{let t=Yi(e);if(!t)return null;let n=Zi.get(t);return n||(n=Xi(t),Zi.set(t,n)),n},$i=(e,t)=>{let n=Qi(e);if(!n)return!1;for(let e of n.values())if(t.includes(e.source))return!0;return!1},ea=(e,t,n)=>{let r=Qi(e);if(!r)return!1;let i=r.get(t);return i?i.source===n:!1},ta=(e,t,n)=>{let r=Qi(e);if(!r)return!1;let i=r.get(t);return i?i.isNamespace&&i.source===n:!1},na=(e,t,n)=>{let r=Qi(e);if(!r)return!1;let i=r.get(t);return i?i.isDefault&&i.source===n:!1},ra=(e,t,n)=>{let r=Qi(e);if(!r)return null;let i=r.get(t);return!i||i.source!==n?null:i.imported},ia=(e,t)=>{let n=Qi(e);return n?n.get(t)?.source??null:null},aa=(e,t)=>{let n=Qi(e)?.get(t);return n?n.isNamespace?{source:n.source,exportedName:null,isNamespace:!0}:{source:n.source,exportedName:n.isDefault?`default`:n.imported,isNamespace:!1}:null},oa=e=>{let t=e,n=t.parent;for(;n&&O(n)===e;)t=n,n=t.parent;return n&&x(n,`AssignmentExpression`)&&n.operator===`=`&&n.left===t?n.right:null},sa=e=>{let t=e.range?.[0];return typeof t==`number`?t:null},ca=new Set([`let`,`var`]),la=new Set([`ConditionalExpression`,`LogicalExpression`]),ua=new WeakMap,da=(e,t,n)=>{let r=e.parent??null;for(;r&&n.blockOf(r)===t;){if(la.has(r.type))return!0;r=r.parent??null}return!1},fa=(e,t)=>e.size===t.size&&[...e].every(e=>t.has(e)),pa=(e,t)=>{let n=new Set(e);for(let e of t)e.isConditionalWithinBlock||(n=new Set),n.add(e);return n},ma=(e,t,n)=>{let r=I(t);if(I(e.bindingIdentifier)!==r||!r)return[];let i=n.cfgFor(r);if(!i)return[];let a=i.blockOf(t);if(!a)return[];let o=sa(t),s=sa(e.bindingIdentifier);if(o===null||s===null)return[];let c=new Map,l=(e,t,n)=>{let r=i.blockOf(t);if(!r)return;let a=c.get(r)??[];a.push({expression:e,position:n,isConditionalWithinBlock:da(t,r,i)}),c.set(r,a)};e.initializer&&l(e.initializer,e.bindingIdentifier,s);for(let t of e.references){let e=sa(t.identifier);if(t.flag===`read`||I(t.identifier)!==r||e===null||e>=o)continue;let n=oa(t.identifier);n&&l(n,t.identifier,e)}for(let e of c.values())e.sort((e,t)=>e.position-t.position);let u=new Map,d=new Map,f=new Set([i.entry]),p=[i.entry];for(;p.length>0;){let e=p.pop();if(!e)break;for(let t of e.successors)f.has(t.to)||(f.add(t.to),p.push(t.to))}if(!f.has(a))return[];let m=!0;for(;m;){m=!1;for(let e of i.blocks){if(!f.has(e))continue;let t=new Set;for(let n of e.predecessors)if(f.has(n.from))for(let e of d.get(n.from)??[])t.add(e);let n=pa(t,c.get(e)??[]),r=u.get(e)??new Set,i=d.get(e)??new Set;(!fa(t,r)||!fa(n,i))&&(u.set(e,t),d.set(e,n),m=!0)}}let h=(c.get(a)??[]).filter(e=>e.position<o);return[...pa(u.get(a)??new Set,h)].map(e=>e.expression)},ha=(e,t,n)=>{if(!ca.has(e.kind))return e.initializer?[e.initializer]:[];if(!n)return[];let r=ua.get(n);r||(r=new WeakMap,ua.set(n,r));let i=r.get(e);i||(i=new WeakMap,r.set(e,i));let a=i.get(t);if(a)return a;let o=ma(e,t,n);return i.set(t,o),o},ga=e=>{if(!b(e)||!x(e.body,`BlockStatement`))return[];let t=[];return A(e.body,n=>{if(n!==e.body&&(b(n)||x(n,`ClassDeclaration`)||x(n,`ClassExpression`)))return!1;x(n,`ReturnStatement`)&&t.push(n)}),t},L=e=>{if(x(e,`ReturnStatement`)||x(e,`ThrowStatement`))return!0;if(x(e,`IfStatement`)){if(x(e.test,`Literal`)){let t=e.test.value?e.consequent:e.alternate;return t?L(t):!1}return!!(e.alternate&&L(e.consequent)&&L(e.alternate))}if(x(e,`TryStatement`))return e.finalizer&&L(e.finalizer)?!0:L(e.block)?e.handler?L(e.handler.body):!0:!1;if(x(e,`DoWhileStatement`))return L(e.body);if(x(e,`WhileStatement`)){let t=e.test;return!!(x(t,`Literal`)&&t.value&&L(e.body))}if(x(e,`ForStatement`)){let t=e.test;return!!((!t||x(t,`Literal`)&&t.value)&&L(e.body))}return x(e,`BlockStatement`)?e.body.some(e=>L(e)):!1},_a=new Set([`let`,`var`]),va=e=>!b(e)||!e.body?[]:x(e.body,`BlockStatement`)?ga(e).flatMap(e=>e.argument?[e.argument]:[]):[e.body],ya=e=>{if(!b(e)||!x(e.body,`BlockStatement`))return!1;let t=!1;return A(e.body,n=>{if(t||n!==e.body&&b(n))return!1;x(n,`ReturnStatement`)&&!n.argument&&(t=!0)}),t},ba=(e,t,n,r=`some`)=>{let i=new Set,a=new Set,o,s=e=>{if(a.has(e))return!1;a.add(e);try{let t=va(e);return r===`every`&&b(e)&&x(e.body,`BlockStatement`)&&(!L(e.body)||ya(e))?!1:t.length>0&&(r===`every`?t.every(o):t.some(o))}finally{a.delete(e)}};o=a=>{let l=O(a);if(i.has(l))return!1;i.add(l);try{if(t(l))return!0;if(x(l,`Identifier`)){let t=e.symbolFor(l);if(!t||t.kind!==`const`&&!_a.has(t.kind))return!1;let i=ha(t,l,n),a=e=>{let t=O(e);return!b(t)&&o(t)};return r===`every`?i.length>0&&i.every(a):i.some(a)}if(x(l,`CallExpression`)){if(l.arguments.length!==0||!x(l.callee,`Identifier`))return!1;let t=e.symbolFor(l.callee);if(!t||t.kind!==`const`&&t.kind!==`function`)return!1;let n=t.initializer?O(t.initializer):null,r=null;return b(n)?r=n:b(t.declarationNode)&&(r=t.declarationNode),!r||r.async||r.generator||r.params.length!==0?!1:s(r)}return x(l,`ConditionalExpression`)?c(l.consequent,l.alternate):x(l,`LogicalExpression`)?c(l.left,l.right):!1}finally{i.delete(l)}};let c=(e,t)=>{let n=[o(e),o(t)];return r===`every`?n.every(Boolean):n.some(Boolean)};return{expressionMatches:o,functionMatches:s}},xa=(e,t,n,r,i=`some`)=>ba(t,n,r,i).functionMatches(e),Sa=(e,t,n,r,i)=>{let a=i.cfgFor(e),o=a?.blockOf(t);if(!a||!o)return!1;let s=new Set(ga(e).flatMap(e=>{if(!e.argument||!ba(n,r,i,`every`).expressionMatches(e.argument))return[];let t=a.blockOf(e.argument);return t?[t]:[]}));if(s.size===0)return!1;let c=new Set([o]),l=[o];for(;l.length>0;){let e=l.pop();if(!e)break;if(!s.has(e))for(let t of e.successors){if(t.to===a.exit)return!1;c.has(t.to)||(c.add(t.to),l.push(t.to))}}return!0},Ca=e=>x(e,`Program`)?e.range[1]:e.range[0],wa=new WeakMap,Ta=(e,t)=>{t.push(...e.symbols);for(let n of e.children)Ta(n,t)},Ea=e=>{let t=new Map,n=[];Ta(e.rootScope,n);for(let r of n){let n=P(r.bindingIdentifier,e);if(!n)continue;let i=t.get(n.id)??[];i.push(r),t.set(n.id,i)}return t},Da=(e,t)=>{let n=P(e,t);if(!n)return[];let r=wa.get(t);return r||(r=Ea(t),wa.set(t,r)),r.get(n.id)??[]},Oa=e=>{let t=e.expressions??[],n=e.quasis??[];if(t.length!==0||n.length!==1)return null;let r=n[0]?.value;return r?.cooked??r?.raw??null},R=(e,t,n={})=>{let r=N(e,{allowComputedString:!0,stringifyNonStringLiterals:n.stringifyNonStringLiterals});if(r!==null||!x(e,`Property`)&&!x(e,`MethodDefinition`)&&!x(e,`PropertyDefinition`)&&!x(e,`MemberExpression`)||!e.computed)return r;let i=O(x(e,`MemberExpression`)?e.property:e.key);if(!x(i,`Identifier`))return null;let a=P(i,t);if(a?.kind!==`const`||!a.initializer)return null;let o=O(a.initializer);return x(o,`Literal`)?typeof o.value==`string`?o.value:n.allowConstNumericLiteral&&typeof o.value==`number`?String(o.value):null:n.allowConstTemplateLiteral&&x(o,`TemplateLiteral`)?Oa(o):null},ka=new Set([`CatchClause`,`ConditionalExpression`,`DoWhileStatement`,`ForInStatement`,`ForOfStatement`,`ForStatement`,`IfStatement`,`LogicalExpression`,`SwitchCase`,`SwitchStatement`,`TryStatement`,`WhileStatement`]),Aa=(e,t)=>{let n=e.parent??null;for(;n&&n!==t;){if(ka.has(n.type))return!1;n=n.parent??null}return n===t},ja=e=>I(e)??Yi(e),Ma=e=>{let t=F(e),n=t.parent;return!!(n&&x(n,`VariableDeclarator`)&&n.init===t&&n.parent&&x(n.parent,`VariableDeclaration`)&&n.parent.kind===`const`)},Na=e=>{let t=F(e),n=t.parent;return!!(n&&(x(n,`AssignmentExpression`)&&n.left===t||x(n,`UpdateExpression`)&&n.argument===t||x(n,`UnaryExpression`)&&n.operator===`delete`&&n.argument===t))},Pa=e=>{let t=F(e),n=t.parent;return n&&x(n,`MemberExpression`)&&O(n.object)===t?n:null},Fa=(e,t,n,r,i)=>{if(i<=0||!x(e,`ObjectExpression`))return null;for(let a of e.properties.toReversed()){if(!x(a,`Property`))return null;let e=R(a,n);if(e===null)return null;if(e===t)return a.kind===`init`?z(a.value,n,r,i-1):null}return null},Ia=(e,t,n,r,i)=>{if(i<=0||!x(e,`ObjectExpression`))return[];let a=[],o=new Set;for(let s of e.properties){if(!x(s,`Property`))continue;let e=R(s,n),c=s.kind===`init`||s.kind===`get`?z(s.value,n,new Set(r),i-1):null;e===t?(a=c?[c]:[],o.clear(),c&&o.add(c)):e===null&&c&&!o.has(c)&&(a.push(c),o.add(c))}return a},La=(e,t,n,r,i)=>{if(i<=0||!x(e,`ClassDeclaration`)&&!x(e,`ClassExpression`))return null;for(let a of e.body.body.toReversed()){if(!x(a,`MethodDefinition`)&&!x(a,`PropertyDefinition`)||!a.static)continue;let e=R(a,n);if(e===null)return null;if(e===t)return x(a,`MethodDefinition`)&&a.kind!==`method`?null:a.value?z(a.value,n,r,i-1):null}return null},Ra=(e,t,n,r,i)=>{if(i<=0||!x(e,`ClassDeclaration`)&&!x(e,`ClassExpression`))return[];let a=[],o=new Set;for(let s of e.body.body){if(!x(s,`MethodDefinition`)&&!x(s,`PropertyDefinition`)||!s.static)continue;let e=R(s,n),c=s.value&&(!x(s,`MethodDefinition`)||s.kind===`method`||s.kind===`get`)?z(s.value,n,new Set(r),i-1):null;e===t?(a=c?[c]:[],o.clear(),c&&o.add(c)):e===null&&c&&!o.has(c)&&(a.push(c),o.add(c))}return a},za=(e,t,n,r,i,a,o,s)=>{let c=ja(t);if(s<=0||!c||!x(e,`Identifier`))return{exactFunction:null,possibleFunctions:[]};let l=[];for(let r of Da(e,a))for(let e of r.references){let r=e.identifier;if(r.range[0]>=t.range[0]||Ma(r))continue;let i=Pa(r);if(!i){ja(r)===c&&l.push({assignedExpression:null,isDefinite:!1,offset:r.range[0]});continue}if(!Na(i)||ja(i)!==c)continue;let o=R(i,a),s=F(i).parent,u=s&&x(s,`AssignmentExpression`)&&s.operator===`=`?s.right:null;if(o===null){l.push({assignedExpression:u,isDefinite:!1,offset:i.range[0]});continue}if(o===n){if(!s||!x(s,`AssignmentExpression`)||s.operator!==`=`||!Aa(i,c)){l.push({assignedExpression:u,isDefinite:!1,offset:i.range[0]});continue}l.push({assignedExpression:u,isDefinite:!0,offset:s.range[0]})}}l.sort((e,t)=>e.offset-t.offset);let u=r,d=i,f=new Set(i);for(let e of l){let t=e.assignedExpression?z(e.assignedExpression,a,new Set(o),s-1):null;if(e.isDefinite){u=t,d=t?[t]:[],f.clear(),t&&f.add(t);continue}u=null,t&&!f.has(t)&&(d.push(t),f.add(t))}return{exactFunction:u,possibleFunctions:d}},Ba=(e,t,n,r)=>{if(r<=0||!x(e,`MemberExpression`))return{exactFunction:null,possibleFunctions:[]};let i=M(e);if(i===null)return{exactFunction:null,possibleFunctions:[]};let a=O(e.object);if(x(a,`ObjectExpression`))return{exactFunction:Fa(a,i,t,n,r),possibleFunctions:Ia(a,i,t,n,r)};if(x(a,`ClassExpression`))return{exactFunction:La(a,i,t,n,r),possibleFunctions:Ra(a,i,t,n,r)};if(!x(a,`Identifier`))return{exactFunction:null,possibleFunctions:[]};let o=P(a,t);if(!o||n.has(o.id))return{exactFunction:null,possibleFunctions:[]};n.add(o.id);let s=null,c=[];if(o.kind===`const`&&o.initializer){let e=O(o.initializer);s=Fa(e,i,t,n,r),c=Ia(e,i,t,n,r)}else o.kind===`class`&&o.initializer&&(s=La(o.initializer,i,t,n,r),c=Ra(o.initializer,i,t,n,r));return za(a,e,i,s,c,t,n,r)},Va=(e,t,n,r)=>{if(r<=0)return[];let i=O(e);if(x(i,`CallExpression`)){let e=O(i.callee);return x(e,`MemberExpression`)&&M(e)===`bind`?Va(e.object,t,n,r-1):[]}if(x(i,`MemberExpression`)){let e=M(i);return e===`call`||e===`apply`?Va(i.object,t,n,r-1):Ba(i,t,n,r).possibleFunctions}let a=z(i,t,n,r);return a?[a]:[]},z=(e,t,n,r)=>{let i=O(e);if(b(i))return i;if(r<=0)return null;if(x(i,`CallExpression`)){let e=O(i.callee);return x(e,`MemberExpression`)&&M(e)===`bind`?z(e.object,t,n,r-1):null}if(x(i,`MemberExpression`)){let e=M(i);return e===`call`||e===`apply`?z(i.object,t,n,r-1):Ba(i,t,n,r).exactFunction}if(!x(i,`Identifier`))return null;let a=P(i,t);return!a||n.has(a.id)?null:(n.add(a.id),a.kind===`function`?!a.references.some(e=>e.flag!==`read`)&&b(a.declarationNode)?a.declarationNode:null:a.kind!==`const`||!a.initializer?null:z(a.initializer,t,n,r-1))},Ha=(e,t)=>z(e,t,new Set,15),Ua=(e,t)=>Va(e,t,new Set,15),Wa=new WeakMap,Ga=(e,t)=>{let n=O(e);return x(n,`Identifier`)?t.symbolFor(n):null},Ka=(e,t)=>{let n=F(e),r=n.parent;return!r||!x(r,`AssignmentExpression`)||r.operator!==`=`||r.left!==n?null:Ga(r.right,t)},qa=e=>{let t=F(e),n=t.parent;return n&&x(n,`VariableDeclarator`)&&n.init===t&&(x(n.id,`Identifier`)||x(n.id,`ObjectPattern`))?!0:!!(n&&x(n,`AssignmentExpression`)&&n.operator===`=`&&n.right===t&&x(O(n.left),`Identifier`))},Ja=(e,t,n)=>{if(e.initializer&&x(e.declarationNode,`VariableDeclarator`)&&e.declarationNode.id===e.bindingIdentifier){let r=Ga(e.initializer,n);if(r&&t.has(r.id))return!0}return e.references.some(e=>{let r=Ka(e.identifier,n);return!!(r&&t.has(r.id))})},Ya=(e,t)=>{let n=P(e,t);if(!n)return[];let r=Wa.get(t);r||(r=new Map,Wa.set(t,r));let i=r.get(n.id);if(i)return i;let a=[],o=[t.rootScope];for(;o.length>0;){let e=o.pop();e&&(a.push(...e.symbols),o.push(...e.children))}let s=new Set([n.id]),c=!0;for(;c;){c=!1;for(let e of a)s.has(e.id)||Ja(e,s,t)&&(s.add(e.id),c=!0)}let l=a.filter(e=>s.has(e.id));return r.set(n.id,l),l},Xa=e=>{let t=e;for(;t;){if(b(t)||x(t,`Program`))return t;t=t.parent??null}return null},Za=new WeakMap,Qa=(e,t)=>{let n=Za.get(t);if(!n){let r=new Map,i=new Map,a=Yi(e);a&&A(a,e=>{if(!x(e,`CallExpression`))return;let n=O(e.callee),a=x(n,`Identifier`)?t.symbolFor(n):null,o=a?i.get(a.id):void 0;o===void 0&&(o=Ua(e.callee,t),a&&i.set(a.id,o));for(let t of o){let n=r.get(t)??[];n.push(e),r.set(t,n)}}),n=r,Za.set(t,n)}return n.get(e)??[]},$a=new WeakMap,eo=(e,t)=>{let n=$a.get(t);if(n===void 0){let e=null;A(t,n=>{x(n,`AwaitExpression`)&&I(n)===t&&(e===null||n.range[0]<e)&&(e=n.range[0])}),n=e,$a.set(t,n)}return n===null||e.range[0]<n},to=(e,t,n,r=new Set,i=null,a)=>{if(r.has(e)||!b(e)||e.generator||i!==null&&!Aa(i,e)||i!==null&&a!==void 0&&!a(i)||i!==null&&e.async&&!eo(i,e))return[];r.add(e);let o=Xa(t);return o?Qa(e,n).flatMap(e=>{let s=Xa(e);return!s||i!==null&&!Aa(e,s)||i!==null&&a!==void 0&&!a(e)?[]:s===o?e.range[0]<Ca(t)?[[e.range[0]]]:[]:b(s)?to(s,t,n,new Set(r),i===null?null:e,a).map(t=>[...t,e.range[0]]):[]}):[]},no=(e,t,n,r=new Set,i=null)=>to(e,t,n,r,i).length>0,ro=e=>{let t=e.parent;return t?x(t,`AssignmentExpression`)?t.left===e:(x(t,`UpdateExpression`)||x(t,`UnaryExpression`)&&t.operator===`delete`)&&t.argument===e:!1},io=e=>{let t=e.parent;for(;t&&O(t)===e;)t=t.parent;return!t||!x(t,`MemberExpression`)||O(t.object)!==e||!ro(t)?null:t},ao=(e,t,n)=>{let r=io(e);return r&&R(r,n)===t?r:null},oo=(e,t,n,r)=>e.references.some(e=>{let i=ao(e.identifier,t,r);if(!i)return!1;let a=Xa(i),o=Xa(n);return!a||!o||!Aa(i,a)?!1:a===o?i.range[0]<Ca(n):b(a)&&no(a,n,r)}),so=e=>{if(qa(e))return!0;let t=F(e),n=t.parent;return!!(n&&x(n,`MemberExpression`)&&O(n.object)===t)},co=e=>{if(qa(e))return!0;let t=F(e),n=t.parent;if(!n||!x(n,`MemberExpression`)||O(n.object)!==t)return!1;let r=F(n),i=r.parent;return!(i&&x(i,`CallExpression`)&&i.callee===r)},lo=(e,t,n)=>x(e,`Identifier`)?Ya(e,n).some(e=>e.references.some(e=>{let r=io(e.identifier);if(!r)return!1;let i=R(r,n);return i===null||i===t})):!1,uo=(e,t,n)=>{let r=Xa(e),i=Xa(t);return!r||!i?!0:r===i?e.range[0]<Ca(t):b(r)?no(r,t,n):!0},fo=(e,t,n,r)=>x(e,`Identifier`)?Ya(e,r).some(e=>e.references.some(e=>{let i=io(e.identifier);if(!i||!uo(i,n,r))return!1;let a=R(i,r);return a===null||a===t})):!1,po=(e,t,n)=>x(e,`Identifier`)?lo(e,t,n)?!0:Ya(e,n).some(e=>e.references.some(e=>!so(e.identifier))):!1,mo=(e,t,n,r)=>x(e,`Identifier`)?fo(e,t,n,r)?!0:Ya(e,r).some(e=>e.references.some(e=>!co(e.identifier)&&uo(e.identifier,n,r))):!1,ho=(e,t)=>{let n=O(e);if(!x(n,`CallExpression`))return!1;let r=O(n.callee);if(!x(r,`MemberExpression`))return!1;let i=M(r);if(i===null)return!1;let a=O(r.object);return x(a,`Identifier`)&&lo(a,i,t)},go=(e,t,n,r)=>x(e,`Identifier`)?Da(e,r).some(e=>oo(e,t,n,r)):!1,_o=(e,t,n,r={})=>{let i=I(e);return i===I(t)?e.range[0]>=Ca(t)||r.requireSynchronousWrite&&(!i||!Aa(e,i)||r.isSynchronousNode!==void 0&&!r.isSynchronousNode(e))?[]:[[e.range[0]]]:i?r.requireSynchronousWrite?to(i,t,n,new Set,e,r.isSynchronousNode).map(t=>[...t,e.range[0]]):to(i,t,n).map(t=>[...t,e.range[0]]):r.requireSynchronousWrite?[]:[[-1/0,e.range[0]]]},vo=(e,t,n,r={})=>_o(e,t,n,r).length>0,B=(e,t,n,r={})=>e.references.some(e=>e.flag===`read`?!1:vo(e.identifier,t,n,r)),yo=(e,t)=>{if(!x(e,`CallExpression`))return!1;let n=O(e.callee);if(x(n,`Identifier`)){let e=t.symbolFor(n);return!!(e&&!B(e,n,t))}if(!x(n,`MemberExpression`))return!1;let r=M(n),i=O(n.object);return!!(r&&x(i,`Identifier`)&&!go(i,r,n,t))},bo=new Set([`FunctionDeclaration`,`FunctionExpression`,`ArrowFunctionExpression`,`ClassDeclaration`,`ClassExpression`]),xo={allowGlobalReactNamespace:!1,allowUnboundBareCalls:!1},So=new Set([`lodash/sortBy`,`lodash/sortBy.js`,`lodash-es/sortBy`,`lodash-es/sortBy.js`]),Co=e=>x(e,`TSArrayType`)||x(e,`TSTupleType`)?!0:x(e,`TSTypeReference`)?x(e.typeName,`Identifier`)&&(e.typeName.name===`Array`||e.typeName.name===`ReadonlyArray`):!1,wo=e=>{if(!x(e,`Identifier`))return!1;let t=e.typeAnnotation;return!!(t&&x(t,`TSTypeAnnotation`)&&Co(t.typeAnnotation))},To=(e,t)=>{if(!x(e,`CallExpression`))return!1;let n=O(e.callee);if(!x(n,`Identifier`))return!1;let r=t.symbolFor(n);if(!r||B(r,n,t)||!x(r.declarationNode,`ImportDefaultSpecifier`)&&!x(r.declarationNode,`ImportSpecifier`))return!1;let i=aa(n,n.name);return!i||i.isNamespace?!1:So.has(i.source)&&i.exportedName===`default`?!0:(i.source===`lodash`||i.source===`lodash-es`)&&i.exportedName===`sortBy`},Eo=(e,t,n,r=new Set)=>{let i=O(e);if(x(i,`ArrayExpression`)||To(i,t))return!0;if(!x(i,`Identifier`))return!1;let a=t.symbolFor(i);return!a||r.has(a.id)||B(a,n,t)?!1:wo(a.bindingIdentifier)?!0:a.initializer?(r.add(a.id),Eo(a.initializer,t,n,r)):!1},Do=(e,t)=>{if(!x(e,`CallExpression`))return!1;let n=O(e.callee);if(!x(n,`MemberExpression`)||M(n)!==`map`)return!1;let r=O(n.object);return Eo(r,t,e)?!(x(r,`Identifier`)&&go(r,`map`,e,t)):!1},Oo=(e,t)=>{if(e.type!==`ArrowFunctionExpression`&&e.type!==`FunctionExpression`)return!1;let n=e.parent;return x(n,`CallExpression`)?Vi(n,`useMemo`,t,{resolveNamedAliases:!0})&&yo(n,t)?n.arguments[0]===e:n.arguments.some(t=>t===e)&&Do(n,t):!1},ko=(e,t)=>bo.has(e.type)&&!Oo(e,t),Ao=(e,t)=>e.type===`JSXElement`||e.type===`JSXFragment`||Vi(e,`createElement`,t,xo)||jo(e,t),jo=(e,t)=>{if(!x(e,`CallExpression`))return!1;let n=O(e.callee);if(x(n,`Identifier`))return t.symbolFor(n)?.kind===`import`&&ra(n,n.name,`react-dom`)===`createPortal`;if(!x(n,`MemberExpression`)||n.computed||!x(n.object,`Identifier`)||!x(n.property,`Identifier`)||n.property.name!==`createPortal`)return!1;let r=t.symbolFor(n.object);return!r||r.kind!==`import`?!1:na(n.object,n.object.name,`react-dom`)||ta(n.object,n.object.name,`react-dom`)},Mo=(e,t)=>{let n=!1;return A(e,r=>{if(n||r!==e&&ko(r,t))return!1;if(Ao(r,t))return n=!0,!1}),n},No=new WeakMap,Po=(e,t,n)=>{let r=No.get(e);if(r&&r.scopes===t&&r.controlFlow===n)return r.hasRenderOutput;let i=xa(e,t,e=>Mo(e,t),n);return No.set(e,{scopes:t,controlFlow:n,hasRenderOutput:i}),i},Fo=e=>x(e,`JSXIdentifier`)?e.name:x(e,`JSXNamespacedName`)?`${e.namespace.name}:${e.name.name}`:null,Io=new Set([`Component`,`PureComponent`]),Lo=(e,t,n,r)=>{let i=O(e);if(x(i,`MemberExpression`)){let e=M(i),n=O(i.object);return!!(e&&Io.has(e)&&x(n,`Identifier`)&&!go(n,e,i,t)&&Ri(n,t))}if(x(i,`ClassExpression`))return Ro(i,t,n,r);if(!x(i,`Identifier`))return!1;let a=t.symbolFor(i);if(!a||r.has(a.id)||B(a,i,t))return!1;if(r.add(a.id),Ii(a)){let e=j(a.declarationNode);return!!(e&&Io.has(e))}return x(a.declarationNode,`ClassDeclaration`)||x(a.declarationNode,`ClassExpression`)?Ro(a.declarationNode,t,n,r):!!(a.kind===`const`&&a.initializer&&Lo(a.initializer,t,n,r))},Ro=(e,t,n=new Set,r=new Set)=>!x(e,`ClassDeclaration`)&&!x(e,`ClassExpression`)||n.has(e)||!e.superClass?!1:(n.add(e),Lo(e.superClass,t,n,r)),zo=new Set([`FunctionDeclaration`,`FunctionExpression`,`ArrowFunctionExpression`,`MethodDefinition`,`Program`]),Bo=e=>{let t=e;for(;t;){if(zo.has(t.type))return t;t=t.parent??null}return null},Vo=(e,t)=>{if(t!==`let`&&t!==`const`)return Bo(e);let n=e.parent;for(;n;){if(n.type===`BlockStatement`){let t=n.parent;return t&&(t.type===`FunctionDeclaration`||t.type===`FunctionExpression`||t.type===`ArrowFunctionExpression`||t.type===`MethodDefinition`)?Bo(e):n}if(zo.has(n.type))return n;n=n.parent??null}return null},Ho=(e,t,n,r)=>{if(x(e,`Identifier`)){let i=r.get(e.name)??[];i.push({bindingIdentifier:e,initializer:t,scopeOwner:n}),r.set(e.name,i);return}if(x(e,`ObjectPattern`)){for(let t of e.properties)if(x(t,`Property`)){let e=t.value;Ho(e,x(e,`AssignmentPattern`)?e.right:null,n,r)}else x(t,`RestElement`)&&Ho(t.argument,null,n,r);return}if(x(e,`ArrayPattern`)){for(let t of e.elements)t&&Ho(t,x(t,`AssignmentPattern`)?t.right??null:null,n,r);return}if(x(e,`AssignmentPattern`)){Ho(e.left,e.right??null,n,r);return}x(e,`RestElement`)&&Ho(e.argument,null,n,r)},Uo=e=>{let t=new Map;return A(e,e=>{switch(e.type){case`VariableDeclarator`:{let n=e.parent,r=Vo(e,n?.type===`VariableDeclaration`?n.kind:void 0);r&&Ho(e.id,e.init??null,r,t);break}case`FunctionDeclaration`:case`FunctionExpression`:case`ArrowFunctionExpression`:if(e.type!==`ArrowFunctionExpression`&&e.id){let n=e.parent?Bo(e.parent):null;if(n){let r=t.get(e.id.name)??[];r.push({bindingIdentifier:e.id,initializer:e,scopeOwner:n}),t.set(e.id.name,r)}}for(let n of e.params)Ho(n,null,e,t);break;case`ClassDeclaration`:case`ClassExpression`:{if(!e.id)break;let n=e.parent?Bo(e.parent):null;if(n){let r=t.get(e.id.name)??[];r.push({bindingIdentifier:e.id,initializer:e,scopeOwner:n}),t.set(e.id.name,r)}break}case`ImportDeclaration`:{let n=Bo(e);if(!n)break;for(let r of e.specifiers){let e=r.local;if(e&&x(e,`Identifier`)){let i=t.get(e.name)??[];i.push({bindingIdentifier:e,initializer:r,scopeOwner:n}),t.set(e.name,i)}}break}case`TSImportEqualsDeclaration`:case`TSEnumDeclaration`:case`TSModuleDeclaration`:{let n=e.id;if(n?.type===`Identifier`){let r=Bo(e);if(r){let e=t.get(n.name)??[];e.push({bindingIdentifier:n,initializer:null,scopeOwner:r}),t.set(n.name,e)}}break}}}),t},Wo=new WeakMap,Go=new WeakMap,Ko=e=>{let t=Yi(e);if(!t)return null;let n=Wo.get(t);return n||(n=Uo(t),Wo.set(t,n)),n},qo=(e,t,n)=>{let r=Ko(e);if(!r)return null;let i=r.get(t);if(!i||i.length===0)return null;let a=i[0];if(i.length===1&&a){let t=e;for(;t;){if(t===a.scopeOwner)return a;t=t.parent??null}return null}let o=e;for(;o;){let t=null;for(let r of i)if(r.scopeOwner===o){if(t===null){t=r;continue}if(n?.preferInitializerBeforeReference){let n=!!(r.initializer&&(x(r.initializer,`FunctionDeclaration`)||r.bindingIdentifier.range[0]<e.range[0]));if(n!==!!(t.initializer&&(x(t.initializer,`FunctionDeclaration`)||t.bindingIdentifier.range[0]<e.range[0]))){n&&(t=r);continue}}(r.initializer!==null||t.initializer===null)&&(t=r)}if(t)return t;o=o.parent??null}return null},Jo=(e,t,n)=>{let r=Go.get(e),i;if(!r)i={},Go.set(e,{primaryBindingName:t,primaryLookup:i});else if(r.primaryBindingName===t)i=r.primaryLookup;else{let e=r.additionalLookups;e||(e=new Map,r.additionalLookups=e);let n=e.get(t);n?i=n:(i={},e.set(t,i))}let a=n?.preferInitializerBeforeReference?`preferredResult`:`defaultResult`;if(a in i)return i[a]??null;let o=qo(e,t,n);return i[a]=o,o},Yo=e=>ui.test(e),Xo=e=>{let t=Jo(e,e.name);if(!t?.initializer)return null;let n=t.bindingIdentifier.parent;if(!n||!x(n,`VariableDeclarator`)||n.id!==t.bindingIdentifier)return null;let r=n.parent;if(!r||!x(r,`VariableDeclaration`)||r.kind!==`const`)return null;let i=O(t.initializer);return x(i,`Literal`)&&typeof i.value==`string`?i.value:null},Zo=e=>x(e,`JSXIdentifier`)?e.name:x(e,`JSXMemberExpression`)?`${Zo(e.object)}.${e.property.name}`:x(e,`JSXNamespacedName`)?`${e.namespace.name}:${e.name.name}`:``,Qo=e=>{let t=e.name;return x(t,`JSXIdentifier`)?Yo(t.name)?Xo(t)??t.name:t.name:Zo(t)},$o=(e,t)=>{if(!x(e.name,`JSXIdentifier`))return!1;let n=Qo(e);if(n[0]===n[0]?.toLowerCase())return!0;let r=new Set,i=e=>{let n=F(e);if(x(n,`Literal`))return typeof n.value==`string`;if(x(n,`Identifier`)||x(n,`JSXIdentifier`)){let e=t.symbolFor(n);if(!e||e.kind!==`const`||!e.initializer||r.has(e.id))return!1;r.add(e.id);let a=i(e.initializer);return r.delete(e.id),a}return x(n,`ConditionalExpression`)?i(n.consequent)&&i(n.alternate):!1};return i(e.name)},es=(e,t,n=new Set)=>{if(!e)return null;let r=O(e);if(b(r))return r;if(x(r,`Identifier`)){let e=t.symbolFor(r);return!e||n.has(e.id)||!e.initializer||B(e,r,t)?null:(n.add(e.id),es(e.initializer,t,n))}if(!x(r,`CallExpression`)||!Vi(r,`memo`,t,{resolveNamedAliases:!0})&&!Vi(r,`forwardRef`,t,{resolveNamedAliases:!0}))return null;let i=r.arguments[0];return!i||x(i,`SpreadElement`)?null:es(i,t,n)},ts=(e,t)=>{let n=F(e);if(!b(n)||n.async||n.generator)return!1;let r=n.parent;if(!r||!x(r,`JSXExpressionContainer`))return!1;let i=r.parent;if(!i||!x(i,`JSXAttribute`)||Fo(i.name)!==`ref`)return!1;let a=i.parent;return!!(a&&x(a,`JSXOpeningElement`)&&$o(a,t))},ns=(e,t)=>t.every((t,n)=>e[n]===t),rs=e=>{let t=F(e);for(;t.parent&&x(t.parent,`MemberExpression`)&&t.parent.object===t;){if(!M(t.parent))return null;t=F(t.parent)}return t},is=(e,t,n,r)=>{if(t.length!==n.length+1||!ns(t,n)||t[n.length]!==`current`)return!1;let i=rs(e),a=i?.parent;if(!i||!a||!x(a,`AssignmentExpression`)||a.operator!==`=`||a.left!==i)return!1;let o=I(e);if(!o)return!1;if(ts(o,r))return!0;if(!b(o)||o.async||o.generator)return!1;let s=I(o);if(!s||!ts(s,r))return!1;let c=F(o),l=c.parent;return!!(x(l,`ReturnStatement`)&&l.argument===c&&I(l)===s||x(s,`ArrowFunctionExpression`)&&s.body===c)},as=(e,t)=>{if(!x(e,`JSXOpeningElement`))return!1;let n=e.name;if(x(n,`JSXIdentifier`)){if(!t)return n.name===`Fragment`;let e=P(n,t);return e?Ii(e)&&j(e.declarationNode)===`Fragment`:n.name===`Fragment`&&t.isGlobalReference(n)}return x(n,`JSXMemberExpression`)?!x(n.object,`JSXIdentifier`)||n.property.name!==`Fragment`?!1:t?Ri(n.object,t)?!0:n.object.name===`React`&&t.isGlobalReference(n.object):n.object.name===`React`:!1},os=(e,t,n,r,i)=>{let a=F(e),o=a.parent;if(!o)return!1;if(x(o,`ReturnStatement`)&&o.argument===a)return I(o)===t;if(x(o,`ArrowFunctionExpression`)&&o.body===a)return o===t;if(x(o,`JSXFragment`)&&o.children.some(e=>e===a)||x(o,`JSXElement`)&&o.children.some(e=>e===a)&&($o(o.openingElement,n)||as(o.openingElement,n)||i.doesCustomElementRenderChildren?.(o.openingElement)))return os(o,t,n,r,i);if(x(o,`JSXExpressionContainer`)&&o.expression===a&&o.parent&&(x(o.parent,`JSXFragment`)||x(o.parent,`JSXElement`)&&($o(o.parent.openingElement,n)||as(o.parent.openingElement,n)||i.doesCustomElementRenderChildren?.(o.parent.openingElement))))return os(o.parent,t,n,r,i);if(x(o,`ConditionalExpression`)&&(o.consequent===a||o.alternate===a)||x(o,`LogicalExpression`)&&(o.left===a||o.right===a)||x(o,`ArrayExpression`)&&o.elements.some(e=>e===a))return os(o,t,n,r,i);if(!x(o,`VariableDeclarator`)||o.init!==a||!x(o.id,`Identifier`))return!1;let s=n.symbolFor(o.id);if(!s||s.kind!==`const`||s.references.length===0||r.has(s.id))return!1;r.add(s.id);let c=s.references.every(e=>e.flag===`read`&&os(e.identifier,t,n,r,i));return r.delete(s.id),c},ss=(e,t,n={})=>os(e,I(e),t,new Set,n),cs=(e,t)=>t.every((t,n)=>e[n]===t),ls=(e,t)=>cs(e,t)||cs(t,e),us=e=>b(e)&&x(e.body,`BlockStatement`)&&e.body.body.length===0,ds=(e,t,n)=>Vi(e,t,n,{resolveNamedAliases:!0}),fs=(e,t,n=new Set)=>x(e,`ObjectExpression`)?e.properties.every(e=>{if(x(e,`SpreadElement`)){let r=F(e.argument);if(x(r,`ObjectExpression`))return fs(r,t,n);if(!x(r,`Identifier`))return!1;let i=t.symbolFor(r);if(!i||i.kind!==`const`||n.has(i.id)||!x(i.initializer,`ObjectExpression`))return!1;n.add(i.id);let a=fs(i.initializer,t,n);return n.delete(i.id),a}return x(e,`Property`)?!b(e.value)||us(e.value):!1}):!1,ps=e=>M(e)||(e.computed&&x(e.property,`Literal`)&&typeof e.property.value==`number`&&Number.isSafeInteger(e.property.value)&&e.property.value>=0?String(e.property.value):null),ms=e=>{let t=[],n=F(e);for(;n.parent&&x(n.parent,`MemberExpression`)&&n.parent.object===n;){let e=ps(n.parent);if(!e)return null;t.push(e),n=F(n.parent)}return{expression:n,propertyPath:t}},hs=(e,t,n)=>{let r=n.environmentsByProgram.get(e);if(r)return r;let i={filename:t,program:e,scopes:Fe(e)};return n.environmentsByProgram.set(e,i),i},gs=(e,t,n=new Set)=>{let r=F(e);if(x(r,`Identifier`)){let e=t.symbolFor(r);return!e||!e.initializer||n.has(e.id)||B(e,r,t)?!1:(n.add(e.id),gs(e.initializer,t,n))}if(!x(r,`CallExpression`))return!1;if(ds(r,`forwardRef`,t))return!0;if(!ds(r,`memo`,t))return!1;let i=r.arguments[0];return!i||x(i,`SpreadElement`)?!1:gs(i,t,n)},_s=(e,t)=>{let n=hs(e.programNode,e.filePath,t),r=es(e.exportedNode,n.scopes);return r?{environment:n,functionNode:r,isForwardRef:gs(e.exportedNode,n.scopes)}:null},vs=(e,t,n)=>{if(!x(e,`Identifier`)&&!x(e,`JSXIdentifier`))return null;let r=t.scopes.symbolFor(e);if(r&&r.kind!==`import`){if(B(r,e,t.scopes))return null;let n=es(r.initializer,t.scopes);return n?{environment:t,functionNode:n,isForwardRef:!!(r.initializer&&gs(r.initializer,t.scopes))}:null}let i=aa(e,e.name);if(!i||i.isNamespace||i.exportedName===null)return null;let a=k(t.filename,i.source,i.exportedName);return a?_s(a,n):null},ys=(e,t,n)=>{if(x(e,`JSXIdentifier`))return vs(e,t,n);if(!x(e,`JSXMemberExpression`)||!x(e.object,`JSXIdentifier`))return null;let r=aa(e.object,e.object.name);if(!r?.isNamespace)return null;let i=k(t.filename,r.source,e.property.name);return i?_s(i,n):null},bs=(e,t,n=new Set)=>{let r=F(e);if(x(r,`Identifier`)){let e=t.scopes.symbolFor(r);return!e||!e.initializer||n.has(e.id)||B(e,r,t.scopes)?!1:(n.add(e.id),bs(e.initializer,t,n))}return Ro(r,t.scopes)},xs=(e,t,n)=>{if(!x(e,`JSXIdentifier`))return!1;let r=t.scopes.symbolFor(e);if(r&&r.kind!==`import`)return B(r,e,t.scopes)?!1:!!(r.initializer&&bs(r.initializer,t));let i=aa(e,e.name);if(!i||i.isNamespace||i.exportedName===null)return!1;let a=k(t.filename,i.source,i.exportedName);if(!a)return!1;let o=hs(a.programNode,a.filePath,n);return bs(a.exportedNode,o)},Ss=(e,t)=>{if(!e)return null;let n=F(e);return!x(n,`ClassDeclaration`)&&!x(n,`ClassExpression`)||!bs(n,t)?null:{classNode:n,environment:t}},Cs=(e,t,n)=>{if(!x(e,`JSXIdentifier`))return null;let r=t.scopes.symbolFor(e);if(r&&r.kind!==`import`)return B(r,e,t.scopes)?null:Ss(r.initializer,t);let i=aa(e,e.name);if(!i||i.isNamespace||i.exportedName===null)return null;let a=k(t.filename,i.source,i.exportedName);if(!a)return null;let o=hs(a.programNode,a.filePath,n);return Ss(a.exportedNode,o)},ws=(e,t,n)=>{let r=[...t],i=F(e);for(;i.parent;){let e=i.parent;if(x(e,`ArrayExpression`)){if(e.elements.some(e=>e&&x(e,`SpreadElement`)))return null;let t=e.elements.findIndex(e=>e===i);if(t<0)return null;r.unshift(String(t)),i=F(e);continue}if(x(e,`Property`)&&e.value===i){let t=N(e,{allowComputedString:!0}),a=e.parent;if(!t||!a||!fs(a,n.scopes))return null;r.unshift(t),i=F(a);continue}if(x(e,`ConditionalExpression`)&&(e.consequent===i||e.alternate===i)||x(e,`LogicalExpression`)&&(e.left===i||e.right===i)){i=F(e);continue}if(x(e,`VariableDeclarator`)&&e.init===i&&x(e.id,`Identifier`)){let t=n.scopes.symbolFor(e.id);return!t||t.kind!==`const`?null:{environment:n,propertyPath:r,symbol:t}}if(x(e,`AssignmentExpression`)&&e.operator===`=`&&e.right===i&&x(e.left,`MemberExpression`)){let t=[],i=e.left;for(;x(i,`MemberExpression`);){let e=ps(i);if(!e)return null;t.unshift(e),i=F(i.object)}if(!x(i,`Identifier`))return null;let a=n.scopes.symbolFor(i);return!a||a.kind!==`const`?null:{environment:n,originWriteReference:i,propertyPath:[...t,...r],symbol:a}}return null}return null},Ts=(e,t,n,r,i)=>{if(x(e,`AssignmentPattern`))return Ts(e.left,t,n,r,i);if(x(e,`Identifier`)){let a=n.scopes.symbolFor(e);return!!(a&&Vs({environment:n,propertyPath:t,symbol:a},r,i-1))}if(!x(e,`ObjectPattern`)||t.length===0)return!1;let[a,...o]=t;for(let t of e.properties){if(!x(t,`Property`))continue;let e=N(t,{allowComputedString:!0});if(!e)return!1;if(e===a)return Ts(t.value,o,n,r,i)}let s=e.properties.find(e=>x(e,`RestElement`));return s?Ts(s.argument,t,n,r,i):!0},Es=(e,t)=>{let n=e.arguments[0];return!n||x(n,`SpreadElement`)?!1:ds(e,`createElement`,t.scopes)?x(n,`Literal`)&&typeof n.value==`string`:!ds(e,`cloneElement`,t.scopes)||!x(n,`JSXElement`)?!1:$o(n.openingElement,t.scopes)},Ds=(e,t,n,r,i)=>{if(t.length>0)return!1;let a=e.parent;if(!a||!x(a,`Property`)||a.value!==e||N(a,{allowComputedString:!0})!==`ref`)return!1;let o=a.parent;if(!o||!x(o,`ObjectExpression`))return!1;let s=o.parent;return!(!s||!x(s,`CallExpression`)||s.arguments[1]!==o||!Es(s,n)||!js(s,n,r,i))},Os=(e,t,n,r,i)=>{if(i<=0||!b(e.functionNode)||e.functionNode.async||e.functionNode.generator)return!1;let a=e.functionNode.params[t];return!!(a&&Ts(a,n,e.environment,r,i))},ks=e=>{if(!x(e,`MemberExpression`)||M(e)!==`children`)return!1;let t=F(e.object);return!!(x(t,`MemberExpression`)&&M(t)===`props`&&x(F(t.object),`ThisExpression`))},As=(e,t)=>{if(!x(e,`JSXOpeningElement`)||!x(e.name,`JSXMemberExpression`)||e.name.property.name!==`Provider`||!x(e.name.object,`JSXIdentifier`))return!1;let n=t.scopes.symbolFor(e.name.object);return!!(n?.kind===`const`&&n.initializer&&x(n.initializer,`CallExpression`)&&ds(n.initializer,`createContext`,t.scopes))},js=(e,t,n,r)=>ss(e,t.scopes,{doesCustomElementRenderChildren:e=>Ps(e,t,n,r-1)}),Ms=(e,t,n)=>{let{functionNode:r}=e;if(n<=0||t.activeRenderedChildrenComponents.has(r)||!x(r,`ArrowFunctionExpression`)&&!x(r,`FunctionExpression`)&&!x(r,`FunctionDeclaration`)||r.async||r.generator)return!1;let i=Ji(r,e.environment.scopes);if(!i)return!1;t.activeRenderedChildrenComponents.add(r);let a=i.every(r=>js(r,e.environment,t,n));return t.activeRenderedChildrenComponents.delete(r),a},Ns=(e,t,n)=>{let{classNode:r,environment:i}=e;if(n<=0||t.activeRenderedChildrenComponents.has(r)||!x(r,`ClassDeclaration`)&&!x(r,`ClassExpression`))return!1;let a=r.body.body.find(e=>x(e,`MethodDefinition`)&&!e.computed&&x(e.key,`Identifier`)&&e.key.name===`render`);if(!a||!x(a,`MethodDefinition`))return!1;let o=[];if(A(r,e=>{ks(e)&&o.push(e)}),o.length===0)return!1;t.activeRenderedChildrenComponents.add(r);let s=o.every(e=>I(e)===a.value&&js(e,i,t,n));return t.activeRenderedChildrenComponents.delete(r),s},Ps=(e,t,n,r)=>{if(r<=0||!x(e,`JSXOpeningElement`))return!1;if(As(e,t))return!0;let i=ys(e.name,t,n);if(i)return Ms(i,n,r);let a=Cs(e.name,t,n);return!!(a&&Ns(a,n,r))},Fs=(e,t,n,r,i)=>{let a=Fo(e.name),o=e.parent;if(!a||!o||!x(o,`JSXOpeningElement`))return!1;let s=o.parent;if(!s||!x(s,`JSXElement`)||!js(s,n,r,i))return!1;if($o(o,n.scopes))return a===`ref`&&t.length===0;if(x(o.name,`JSXIdentifier`)&&a===`ref`&&t.length===0&&xs(o.name,n,r))return!0;let c=ys(o.name,n,r);return c?a===`ref`&&c.isForwardRef?Os(c,1,t,r,i):Os(c,0,[a,...t],r,i):!1},Is=(e,t,n,r,i,a)=>{let o=e.arguments.findIndex(e=>e===t);if(o<0)return!1;if(o===0&&x(e.callee,`Identifier`)&&e.callee.name===`Boolean`&&r.scopes.isGlobalReference(e.callee))return!0;if(o===0&&ds(e,`useImperativeHandle`,r.scopes))return n.length===0;if(o===1&&n.length===1&&n[0]===`ref`&&Es(e,r)&&js(e,r,i,a))return!0;let s=F(e.callee);if(b(s))return Po(s,r.scopes)&&!js(e,r,i,a)?!1:Os({environment:r,functionNode:s,isForwardRef:!1},o,n,i,a);if(!x(e.callee,`Identifier`))return!1;let c=vs(e.callee,r,i);return!!(c&&(!Po(c.functionNode,c.environment.scopes)||js(e,r,i,a))&&Os(c,o,n,i,a))},Ls=(e,t,n,r,i)=>{let a;if(t.length===1&&t[0]===`ref`)a=e.parent;else if(t.length===0){let t=e.parent;if(!t||!x(t,`Property`)||t.value!==e||N(t,{allowComputedString:!0})!==`ref`)return!1;a=t.parent?.parent}if(!a||!x(a,`JSXSpreadAttribute`))return!1;let o=a.parent;if(!o||!x(o,`JSXOpeningElement`))return!1;let s=o.parent;return!!($o(o,n.scopes)&&s&&x(s,`JSXElement`)&&js(s,n,r,i))},Rs=(e,t,n,r,i)=>{let a=F(e),o=a.parent;if(!o)return!1;if(x(o,`ExpressionStatement`)||x(o,`UnaryExpression`)&&o.operator===`void`&&o.argument===a)return!0;if(t.length===0&&x(o,`BinaryExpression`)&&(o.operator===`===`||o.operator===`!==`||o.operator===`==`||o.operator===`!=`)){let e=o.left===a?o.right:o.left;return!!(x(a,`Identifier`)&&x(e,`Identifier`)&&n.scopes.symbolFor(a)?.id===n.scopes.symbolFor(e)?.id)}if(Ls(a,t,n,r,i)||Ds(a,t,n,r,i)||t.length>0&&(x(o,`LogicalExpression`)&&o.left===a||x(o,`ConditionalExpression`)&&o.test===a||x(o,`IfStatement`)&&o.test===a||x(o,`UnaryExpression`)&&o.operator===`!`&&o.argument===a))return!0;if(x(o,`JSXExpressionContainer`)&&o.expression===a){let e=o.parent;return!!(e&&x(e,`JSXAttribute`)&&Fs(e,t,n,r,i))}if(x(o,`CallExpression`))return Is(o,a,t,n,r,i);if(x(o,`VariableDeclarator`)&&o.init===a&&!x(o.id,`Identifier`))return Ts(o.id,t,n,r,i);let s=ws(a,t,n);return!!(s&&Vs(s,r,i-1))},zs=e=>{let t=e.parent;return t&&x(t,`VariableDeclarator`)&&t.init===e&&x(t.id,`Identifier`)?t.id:(x(e,`FunctionDeclaration`)||x(e,`FunctionExpression`))&&e.id?e.id:null},Bs=(e,t,n)=>{if(!e||!t||!b(e)||e.async||e.generator)return!1;let r=zs(e);if(!r||((x(e,`FunctionDeclaration`)||x(e,`FunctionExpression`))&&e.id===r?I(e):I(r))!==t)return!1;let i=x(e,`FunctionDeclaration`)?n.ownScopeFor(t)?.symbolsByName.get(r.name):n.symbolFor(r);return!!(i&&i.references.length>0&&i.references.every(e=>{let r=F(e.identifier),i=r.parent;return!!(i&&x(i,`CallExpression`)&&i.callee===r&&I(i)===t&&ss(i,n))}))},Vs=(e,t,n)=>{if(n<=0)return!1;let r=`${e.environment.filename}:${e.symbol.id}:${e.propertyPath.join(`.`)}`;if(t.activePaths.has(r))return!1;t.activePaths.add(r);let i=I(e.symbol.bindingIdentifier),a=e.symbol.references.every(r=>{if(r.identifier===e.originWriteReference)return!0;let a=r.identifier.parent;if(a&&x(a,`Property`)&&!a.computed&&a.key===r.identifier&&a.value!==r.identifier)return!0;let o=ms(r.identifier);if(!o)return!1;if(!ls(o.propertyPath,e.propertyPath))return!0;let s=I(r.identifier);if(s!==i&&!Bs(s,i,e.environment.scopes))return!!is(r.identifier,o.propertyPath,e.propertyPath,e.environment.scopes);if(r.flag!==`read`)return!1;if(cs(o.propertyPath,e.propertyPath)){if(o.propertyPath.length>e.propertyPath.length){let t=o.expression.parent;return!!(o.propertyPath.length===e.propertyPath.length+1&&o.propertyPath[e.propertyPath.length]===`current`&&t&&x(t,`UnaryExpression`)&&t.operator===`void`&&t.argument===o.expression)}return Rs(o.expression,[],e.environment,t,n)}return Rs(o.expression,e.propertyPath.slice(o.propertyPath.length),e.environment,t,n)});return t.activePaths.delete(r),a},Hs=(e,t,n)=>{if(!t)return!1;let r=Yi(e);if(!r)return!1;let i={filename:t,program:r,scopes:n},a={activePaths:new Set,activeRenderedChildrenComponents:new WeakSet,environmentsByProgram:new WeakMap([[r,i]])},o=ws(e,[],i);return o?Vs(o,a,12):Rs(e,[],i,a,12)},Us=e=>{let t=[];for(let n of e)for(let e of n.entries){if(e.importName.kind===`NamespaceObject`)continue;let r=e.importName.kind===`Default`?`default`:e.importName.name??null;r!==null&&t.push({source:n.moduleRequest.value,exportedName:r})}return t},Ws=({absoluteFilePath:e,staticImports:t})=>{let n=!1;for(let r of t){let t=r.moduleRequest.value;if(!t.startsWith(`.`))continue;let i=r.entries.filter(e=>!e.isType);if(i.length===0)continue;let a=fn(e,t);if(!(!a||!hr(a))){n||(n=!0,At(e));for(let e of i){let t=e.importName.kind===`Default`?`default`:e.importName.name;t&&Ki(a,t)}}}},Gs=({absoluteFilePath:e})=>{Re.test(e)&&(He.test(e)||Xn(e))},Ks=({absoluteFilePath:e,staticImports:t})=>{if(ze.test(e)&&!$n(e))for(let n of Us(t))Nn(e,n.source,n.exportedName)},V=({absoluteFilePath:e,staticImports:t})=>{for(let n of Us(t))Nn(e,n.source,n.exportedName)},qs=({absoluteFilePath:e,staticImports:t})=>{for(let n of Us(t))k(e,n.source,n.exportedName)},Js=(e,t,n,r)=>{let i=n.get(t);if(!(i!==void 0&&i<=r)){n.set(t,r);for(let i of e.body??[]){let e=er(i);if(!e)continue;let a=kn(t,e);if(!a||r>=8)continue;let o=r+1,s=n.get(a);if(s!==void 0&&s<=o)continue;let c=Wt(a);if(!c){n.set(a,o);continue}Js(c,a,n,o)}}},Ys=e=>{qs(e);let t=e.getProgram(),n=!1;A(t,e=>{if(n)return!1;if(!x(e,`CallExpression`))return;let t=O(e.callee);if(!x(t,`MemberExpression`))return;let r=M(t);n=r===`add`||r===`set`}),n&&Js(t,e.absoluteFilePath,new Map,0)},Xs=({absoluteFilePath:e,staticImports:t})=>{for(let n of Us(t))qi(e,n.source,n.exportedName)},Zs=e=>{let t=[];for(let n of e.body??[]){if(n.type!==`ImportDeclaration`)continue;let e=n.source?.value;if(typeof e==`string`){for(let r of n.specifiers??[])if(r.type===`ImportDefaultSpecifier`)t.push({source:e,exportedName:`default`});else if(r.type===`ImportSpecifier`){let n=r.imported,i=null;typeof n?.name==`string`?i=n.name:typeof n?.value==`string`&&(i=n.value),i&&t.push({source:e,exportedName:i})}}}return t},Qs=({absoluteFilePath:e,staticImports:t},n,r=()=>!0,i=()=>!0)=>{let a=new Map,o=(e,t,n)=>{if(!((a.get(e)??-1)>=n)){a.set(e,n);for(let a of Zs(t)){let t=k(e,a.source,a.exportedName);!t||n===0||!r(t)||!i(t.filePath)||o(t.filePath,t.programNode,n-1)}}};for(let a of Us(t)){let t=k(e,a.source,a.exportedName);!t||!r(t)||!i(t.filePath)||o(t.filePath,t.programNode,n)}},$s=e=>{Qs(e,4)},ec=({absoluteFilePath:e,sourceText:t,getProgram:n})=>{if(!t.includes(`createRef`)&&!t.includes(`\\u`))return;let r=n();zt(r);let i=Fe(r);A(r,t=>{!x(t,`CallExpression`)||!Vi(t,`createRef`,i,{allowGlobalReactNamespace:!0,allowUnboundBareCalls:!0,resolveNamedAliases:!0})||Hs(t,e,i)})},tc=({absoluteFilePath:e,sourceText:t,staticImports:n,getProgram:r})=>{let i=new Set,a=new Set;for(let e of n)if(e.moduleRequest.value===`react`)for(let t of e.entries){let{importName:e}=t;e.kind===`Name`&&e.name===`useReducer`?i.add(t.localName.value):(e.kind===`Default`||e.kind===`NamespaceObject`)&&a.add(t.localName.value)}if(!(i.size>0||a.size>0&&(t.includes(`useReducer`)||t.includes(`\\u`))))return;let o=r(),s=e=>{if(e?.type!==`Identifier`)return null;let{name:t}=e;return typeof t==`string`?t:null},c=e=>{let t=s(e);if(t!==null)return i.has(t);if(e.type!==`MemberExpression`)return!1;let n=e,r=s(n.object);return r!==null&&a.has(r)&&s(n.property)===`useReducer`},l=new Set;if(A(o,e=>{if(e.type!==`CallExpression`)return;let t=e;if(!t.callee||!c(t.callee))return;let n=t.arguments?.[0];if(!n)return;let r=s(O(n));r!==null&&l.add(r)}),l.size!==0)for(let t of n)for(let n of t.entries){if(n.importName.kind===`NamespaceObject`||!l.has(n.localName.value))continue;let r=n.importName.kind===`Default`?`default`:n.importName.name;r&&Nn(e,t.moduleRequest.value,r)}},nc=({absoluteFilePath:e,staticImports:t,getProgram:n})=>{At(e),Ln({absoluteFilePath:e,staticImports:t,program:n()})},H=({absoluteFilePath:e})=>{At(e)},rc=e=>{H(e),Xs(e)},ic=e=>{H(e),Qs(e,1/0,e=>b(e.exportedNode),e=>!e.split(/[\\/]/).includes(`node_modules`))},ac=({absoluteFilePath:e})=>{Or(e)},oc=({absoluteFilePath:e})=>{Pr(e)},sc=e=>{oc(e),Ln({absoluteFilePath:e.absoluteFilePath,staticImports:e.staticImports,program:e.getProgram()})},cc=new Map([..._.map(e=>[e,oc]),[`ink-no-raw-text`,sc],[`client-passive-event-listeners`,V],[`effect-needs-cleanup`,V],[`exhaustive-deps`,$s],[`no-barrel-import`,Ws],[`nextjs-async-dynamic-api-not-awaited`,H],[`nextjs-missing-metadata`,Gs],[`nextjs-no-use-search-params-without-suspense`,Ks],[`no-dynamic-import-path`,H],[`no-full-lodash-import`,H],[`no-hydration-branch-on-browser-global`,rc],[`no-indeterminate-attribute`,H],[`no-locale-format-in-render`,H],[`no-match-media-in-state-initializer`,H],[`no-create-ref-in-function-component`,ec],[`no-adjust-state-on-prop-change`,V],[`no-derived-state`,V],[`no-derived-state-effect`,V],[`no-event-handler`,V],[`no-initialize-state`,V],[`no-reset-all-state-on-prop-change`,V],[`no-mutating-reducer-state`,tc],[`no-side-effect-in-state-updater-function`,Ys],[`no-unguarded-browser-global-at-module-scope`,Xs],[`no-unguarded-browser-global-in-render-or-hook-init`,ic],[`prefer-dynamic-import`,H],[`rendering-hydration-mismatch-time`,H],[`rendering-hydration-no-flicker`,V],[`rerender-memo-with-default-value`,$s],[`rn-no-legacy-shadow-styles`,ac],[`rn-no-raw-text`,nc],[`rn-prefer-expo-image`,H],[`rn-style-prefer-boxshadow`,ac],...re.map(e=>[e,H])]),lc=new Set([`anchor-target-exists`,`nextjs-no-img-element`,`no-img-without-dimensions`,`no-loading-flag-reset-outside-finally`,`only-export-components`,`remotion-calculate-metadata-fetch-signal`,`remotion-deterministic-randomness`,`remotion-no-css-animation`,`remotion-no-css-transition`,`remotion-no-css-url-assets`,`remotion-no-native-media-elements`,`remotion-no-next-image`,`window-open-without-noopener`]),uc=t=>{let n=new Set;for(let e of t.ruleIds){let t=cc.get(e);if(!t)return null;n.add(t)}let r=Ui(t.absoluteFilePath),i,a;try{let n=e(r,t.sourceText,{astType:`ts`,lang:Vt(r)});if(n.errors.some(e=>e.severity===`Error`))return null;i=n.module.staticImports;let o;a=()=>(o??=n.program,o)}catch{return null}let o={absoluteFilePath:r,sourceText:t.sourceText,staticImports:i,getProgram:a};return mt(()=>{for(let e of n)e(o)})},dc={},fc=(e,t,n)=>!e||e.length===0?!1:e.every(e=>x(e,t)&&e[n]===`type`),pc=e=>e.importKind===`type`||fc(e.specifiers,`ImportSpecifier`,`importKind`),mc=new Set([`solid-js`,`solid-js/web`,`solid-js/store`,`solid-js/h`,`solid-js/html`,`@builder.io/qwik`,`@builder.io/qwik-city`,`@builder.io/qwik-react`,`voby`,`vidode`]),hc=[`solid-js`,`@builder.io/qwik`],gc=[`react`,`react-dom`,`preact`],_c=new WeakMap,vc=new WeakMap,yc=(e,t)=>t.some(t=>e===t||e.startsWith(`${t}/`)),bc=e=>{let t=_c.get(e);if(t)return t;let n=!1,r=!1,i=!1;for(let t of e.body){if(i||A(t,e=>{if(i)return!1;if(x(e,`JSXOpeningElement`)&&Sc(e))return i=!0,!1}),!x(t,`ImportDeclaration`))continue;let e=t;if(pc(e))continue;let a=e.source,o=a&&typeof a.value==`string`?a.value:null;o&&((mc.has(o)||yc(o,hc))&&(n=!0),yc(o,gc)&&(r=!0))}let a={hasNonReactMarker:i,hasNonReactRuntime:n,hasReactRuntime:r};return _c.set(e,a),a},xc=e=>{let t=bc(e);return t.hasNonReactRuntime&&!t.hasReactRuntime},Sc=e=>{let t=vc.get(e);if(t!==void 0)return t;let n=!1;for(let t of e.attributes){if(!x(t,`JSXAttribute`)||!x(t.name,`JSXIdentifier`))continue;let e=t.name.name;if(e===`classList`&&x(t.value,`JSXExpressionContainer`)&&x(t.value.expression,`ObjectExpression`)||e.startsWith(`class:`)||e.startsWith(`bind:`)){n=!0;break}}return vc.set(e,n),n},Cc=`/test/,/tests/,/testing/,/__tests__/,/__test__/,/__fixtures__/,/fixtures/,/__mocks__/,/mocks/,/testUtils/,/test-utils/,/test-stubs/,/testutils/,/cypress/,/playwright/,/.storybook/,/.dumi/,/stories/,/__stories__/,/playground/,/playgrounds/,/examples/,/example/,/demo/,/demos/,/sandbox/,/sandboxes/,/e2e/,/e2e-tests/,/specs/,/spec/,/integration-tests/,/integration/,/it/,/benchmarks/,/benchmark/,/__benchmarks__/,/perf/,/perf-tests/,/scripts/,/cli/,/bin/,/tooling/,/tools/,/codemods/,/codemod/,/migrations/,/migration/,/generators/,/generator/,/runbooks/,/devtools/,/internal-tools/,/seeds/,/seed/,/dev-seeder/`.split(`,`),wc=[`.test.`,`.spec.`,`.cy.`,`.stories.`,`.story.`,`.bench.`,`.benchmark.`,`.e2e.`,`.integration-spec.`,`.int-spec.`,`.mock.`,`.mocks.`,`.fixture.`],Tc=new Set(`setuptests.js,setuptests.ts,setuptests.jsx,setuptests.tsx,setupvitest.js,setupvitest.ts,setupvitest.jsx,setupvitest.tsx,setupjest.js,setupjest.ts,vitest.setup.js,vitest.setup.ts,vitest.setup.mjs,vitest.config.ts,vitest.config.js,vitest.config.mts,vitest.config.mjs,jest.setup.js,jest.setup.ts,jest.setup.jsx,jest.setup.tsx,jest.config.js,jest.config.ts,jest.config.mjs,playwright.config.ts,playwright.config.js,cypress.config.ts,cypress.config.js,karma.conf.js,karma.conf.ts,vite.config.ts,vite.config.js,vite.config.mts,vite.config.mjs,webpack.config.ts,webpack.config.js,webpack.config.mjs,rollup.config.ts,rollup.config.js,rollup.config.mjs,esbuild.config.ts,esbuild.config.js,esbuild.config.mjs,tsup.config.ts,tsup.config.js,tsup.config.mjs,rsbuild.config.ts,rsbuild.config.js,rspack.config.ts,rspack.config.js,next.config.ts,next.config.js,next.config.mjs,remix.config.js,remix.config.ts,astro.config.ts,astro.config.js,astro.config.mjs,tailwind.config.ts,tailwind.config.js,tailwind.config.mjs,postcss.config.ts,postcss.config.js,postcss.config.mjs,biome.config.ts,biome.config.js,drizzle.config.ts,drizzle.config.js,prisma.config.ts,prisma.config.js,knip.config.ts,knip.config.js,knip.config.mjs,lint-staged.config.js,lint-staged.config.mjs`.split(`,`)),Ec=[`/src/`,`/app/`,`/lib/`,`/components/`,`/pages/`,`/features/`,`/modules/`,`/packages/`,`/apps/`,`/frontend/`,`/client/`],Dc=Cc.filter(e=>e.startsWith(`/.`)),Oc=e=>{let t=-1;for(let n of Ec){let r=e.lastIndexOf(n);r>t&&(t=r)}return t<0?e:e.slice(t)};let kc,Ac=!1;const jc=e=>e?e===kc?Ac:(kc=e,Ac=Nc(e),Ac):!1,Mc=(e,t)=>e?Nc(e,t):!1,Nc=(e,t=new Set)=>{let n=e.replaceAll(`\\`,`/`),r=n.lastIndexOf(`/`),i=r===-1?n:n.slice(r+1);if(Tc.has(i.toLowerCase()))return!0;for(let e of wc)if(i.includes(e))return!0;let a=n.startsWith(`/`)?n:`/${n}`;for(let e of Dc)if(!t.has(e)&&a.includes(e))return!0;let o=Oc(n);for(let e of Cc)if(!t.has(e)&&(e.startsWith(`/.`)?n:o).includes(e))return!0;return!1},Pc=e=>t=>jc(t.filename)?dc:e(t),Fc=e=>{let t=e?.[`react-doctor`];return typeof t!=`object`||!t||Array.isArray(t)?null:t},Ic=(e,t)=>Object.getOwnPropertyDescriptor(e,t)?.value,Lc=(e,t)=>{let n=Fc(e);if(!n)return;let r=Ic(n,t);return typeof r==`string`?r:void 0},Rc=(e,t)=>{let n=Fc(e);if(!n)return;let r=Ic(n,t);return typeof r==`number`&&Number.isFinite(r)?r:void 0},zc=(e,t)=>{let n=Fc(e);if(!n)return;let r=Ic(n,t);if(Array.isArray(r))return r.filter(e=>typeof e==`string`&&e.length>0)},Bc=(e,t)=>zc(e,t)??[],Vc=(e,t)=>Bc(e,`capabilities`).includes(t),Hc=(e,t)=>{let n=Fc(e);return!n||Ic(n,`capabilities`)===void 0?!0:Vc(e,t)},Uc=(e,t)=>!t?.some(t=>Vc(e,t)),Wc=(e,t)=>n=>Uc(n.settings,t)?e(n):dc,Gc=e=>(t=>{let n=e(t),r=!1,i=!1,a={};for(let e in n){if(!Object.hasOwn(n,e))continue;let t=n[e];if(typeof t!=`function`){a[e]=t;continue}let o=e.charAt(0);if(o<`A`||o>`Z`){a[e]=t;continue}if(e===`Program`){a.Program=e=>{let n=bc(e);i=n.hasReactRuntime,r=!n.hasReactRuntime&&(n.hasNonReactRuntime||n.hasNonReactMarker),t(e)};continue}if(e===`JSXOpeningElement`){a.JSXOpeningElement=e=>{!i&&!r&&Sc(e)&&(r=!0),!r&&t(e)};continue}a[e]=(...e)=>{r||t(...e)}}return`Program`in a||(a.Program=e=>{let t=bc(e);i=t.hasReactRuntime,r=!t.hasReactRuntime&&(t.hasNonReactRuntime||t.hasNonReactMarker)}),a}),U=e=>{if(!(`create`in e))return{...e,create:()=>dc};let t=e.tags,n=e.create,r=t?.includes(`test-noise`)&&!t?.includes(`migration-hint`);return t?.includes(`react-jsx-only`)&&(n=Gc(n)),r&&(n=Pc(n)),e.disabledWhen&&(n=Wc(n,e.disabledWhen)),n===e.create?e:{...e,create:n}};let Kc;const qc=e=>{let t=[0];for(let n=0;n<e.length;n+=1){let r=e[n];if(r===`\r`&&e[n+1]===`
3
3
  `){n+=1,t.push(n+1);continue}(r===`\r`||r===`
4
4
  `||r===`\u2028`||r===`\u2029`)&&t.push(n+1)}return t},Jc=e=>{if(Kc?.content===e)return Kc.lineStartOffsets;let t=qc(e);return Kc={content:e,lineStartOffsets:t},t},W=(e,t)=>{if(Number.isNaN(t)||t<0)return{line:1,column:1};let n=Jc(e),r=Math.min(Math.trunc(t),e.length),i=0,a=n.length-1;for(;i<a;){let e=i+a+1>>1;n[e]<=r?i=e:a=e-1}return{line:i+1,column:r-n[i]+1}},Yc=(e,t)=>W(e,e.search(t)),Xc=/\.(?:[cm]?[jt]sx?|json|jsonc|map|html?|mdx?|ya?ml|toml|sql|rules|env|txt|log|svg|xml|pem|key|crt|cert|pub|py|php)$/i,Zc=/(?:^|\/)\.env(?:\.|$)/,Qc=/\.(?:[cm]?[jt]sx?)$/i,$c=/\.(?:[cm]?[jt]sx?|py|php)$/i,el=/\.(?:[cm]?[jt]sx?|py)$/i,tl=/(?:^|\/)(?:api|backend|server|servers|middleware|route|routes|functions|lambdas|workers)(?:\/|$)|(?:^|\/)[^/]+\.server\.[cm]?[jt]sx?$/i,nl=/(?:^|\/)(?:__fixtures__|__mocks__|__tests__|__integration__|fixtures|mocks|test|tests|testdata|test-data|e2e|playwright|cypress|specs?)(?:\/|$)|^(?:test|spec)-[^/]+\.[cm]?[jt]sx?$|\.(?:test|spec|e2e|e2e-spec|integration-test|fixture|fixtures|stories|story)\.[cm]?[jt]sx?$|(?:^|\/)(?:playwright|cypress|vitest|jest|karma)[^/]*\.conf(?:ig)?\.[cm]?[jt]s$|(?:^|\/)(?:test_[^/]+|[^/]+_test|conftest)\.py$|\.env\.[^/]*(?:test|e2e)[^/]*$/i,rl=/(?:^|\/)(?:vite|next|nuxt|astro|remix|webpack|rollup|rspack|rsbuild|esbuild|tsup|metro|expo|babel|tailwind|postcss|svelte|farm|parcel|snowpack)[^/]*\.config\.[cm]?[jt]sx?$/i,il=/(?:^|\/)scripts(?:\/|$)/i,al=/(?:^|\/)(?:examples?|tutorials?|demos?|samples?|playgrounds?)(?:\/|$)/i,ol=/(?:^|\/)(?:README|CHANGELOG|CONTRIBUTING|PUBLISHING|DOCS)\.mdx?$|\.mdx?$/i,sl=/(?:^|\/)(?:generated|__generated__|dist|build|coverage|out|storybook-static|vendor|vendors|third[-_]?party|libraries)(?:\/|$)|(?:^|\/)\.next\/|(?:^|\/)\.yarn\/|(?:^|\/)public\/(?:chunks?|assets?|build|dist|static)\/|(?:generated|\.gen)\.[cm]?[jt]sx?$|@\d+\.\d+\.\d+(?:[-.][\w.]+)?\.[cm]?js$|[.-]min\.[cm]?js$|\.asm\.js$|(?:^|\/)[\w-]+[.@-]\d+\.\d+\.\d+(?:[-.][\w.]+)?\//i,cl=/\.(iife|umd|global|min)\.js$/i,ll=[/(?:^|\/)\.next\/static\//,/(?:^|\/)\.output\/public\//,/(?:^|\/)build\/static\//,/(?:^|\/)dist\/assets\//,/(?:^|\/)public\//,/(?:^|\/)out\//,/(?:^|\/)storybook-static\//],ul=/\b(?:exec|execSync|spawn|child_process|eval|new Function|vm\.run|readFile|writeFile|fs\.read|fs\.write|fetch|axios|http\.request|sandbox|runCode|executeCode)\b/,dl=new Set([`.next`,`.output`]),fl=e=>{let t=e.split(`/`);for(let e=0;e<t.length;e+=1)if(dl.has(t[e])&&(t[e]===`.next`&&t[e+1]===`dev`||t[e+1]===`server`&&e+2<t.length))return!0;return!1},pl=(e,t)=>fl(e)?!1:t||e.endsWith(`.map`)?!0:ll.some(t=>t.test(e)),ml=e=>/(?:^|\/)(?:package\.json|Dockerfile|docker-compose\.ya?ml|\.github\/workflows\/[^/]+\.ya?ml|vercel\.json|next\.config\.[cm]?[jt]s|netlify\.toml)$/i.test(e),hl=new Map,gl=(e,t)=>{let n=hl.get(t);n||(n=new Map,hl.set(t,n));let r=n.get(e);if(r!==void 0)return r;let i=t.test(e)&&!nl.test(e)&&!il.test(e)&&!ol.test(e)&&!sl.test(e);return n.set(e,i),i},G=e=>/\.d\.[cm]?[jt]s$/i.test(e)?!1:gl(e,Qc),_l=/<script\b|on(?:load|error|click|mouseover)\s*=/i,vl=/dangerouslyAllowSVG\s*:\s*true/i,yl=/<(?:object|embed|iframe)\b[^>]+(?:data|src)=["'][^"']+\.svg(?:\?[^"']*)?["']/i,bl=U({id:`active-static-asset`,title:`Executable SVG exposure`,severity:`warn`,recommendation:"Prefer `<img>` for SVG images; if SVG must be served directly, use attachment disposition and a CSP that blocks scripts and objects.",scan:e=>{let t=[];if(e.relativePath.endsWith(`.svg`)&&pl(e.relativePath,e.isGeneratedBundle)){if(_l.test(e.content)){let n=Yc(e.content,_l);t.push({message:`A browser-reachable SVG contains script or event-handler code.`,line:n.line,column:n.column,severity:`error`,title:`Active SVG in public assets`,help:`Serve untrusted SVG as downloads, sanitize it, or isolate it on a cookieless asset origin with a restrictive CSP.`})}return t}if(!G(e.relativePath)&&!ml(e.relativePath))return t;let n=[vl,yl].find(t=>t.test(e.content));if(n!==void 0){let r=Yc(e.content,n);t.push({message:`The app enables or embeds SVG in an executable browser context.`,line:r.line,column:r.column})}return t}}),xl=e=>/(?:^|\/)(?:firestore\.rules|storage\.rules|database\.rules\.json)$/.test(e),Sl=/\s/,Cl=/[\p{ID_Continue}$]/u,wl=new Set([`return`,`typeof`,`case`,`in`,`of`,`new`,`delete`,`void`,`instanceof`,`do`,`else`,`yield`,`await`,`throw`]),Tl=(e,t,n)=>{let r=n-1;for(;r>=0&&Sl.test(t[r]);)--r;if(r<0)return!0;let i=t[r],a=r>0?t[r-1]:``;if(Cl.test(i)){let n=r;for(;n>0&&Cl.test(t[n-1]);)--n;return n>0&&t[n-1]===`.`?!1:wl.has(e.slice(n,r+1))}return i===`<`?!1:i===`>`?a===`=`:i===`+`||i===`-`?a!==i:i===`!`?!(Cl.test(a)||a===`)`||a===`]`):!(i===`)`||i===`]`||i===`}`||i===`"`||i===`'`||i==="`")},El=(e,t)=>{let n=t+1,r=!1;for(;n<e.length;){let t=e[n];if(t===`\\`){n+=2;continue}if(t===`
5
5
  `)return null;if(t===`[`)r=!0;else if(t===`]`)r=!1;else if(t===`/`&&!r)return e[n+1]===`/`?null:n+1;n+=1}return null},Dl=(e,t,n)=>{for(let r=t+1;r<e.length;r+=1){let t=e[r];if(t===`\\`){r+=1;continue}if(t===n)return!1;if(Sl.test(t))return!0}return!1},Ol=(e,t)=>{let n=null,r=null,i=!1,a=[],o=0,s=t=>{t>=e.length||e[t]===`
@@ -28,4 +28,4 @@ import{parseSync as e,visitorKeys as t}from"oxc-parser";import{KEYS as n}from"es
28
28
  `&&(t[r]=` `);n=o;continue}}if(r===`"`){for(n+=1;n<e.length;){if(e[n]===`"`){if(e[n+1]===`"`){n+=2;continue}n+=1;break}n+=1}continue}n+=1}return t.join(``)},uh=/disable\s+row\s+level\s+security/i,dh=/auth\.role\(\)\s*=\s*["']service_role["']/i,fh=/create\s+policy/gi,ph=/;|create\s+policy/i,mh=/\b(?:using|with\s+check)\s*\(\s*true\s*\)/i,hh=/\bfor\s+select\b/i,gh=/\bto\s+([\s\S]+?)(?=\s+(?:using|with\s+check|as|for)\b|;|$)/i,_h=new Set([`service_role`,`postgres`,`supabase_admin`]),vh=e=>{let t=gh.exec(e);if(t===null)return!1;let n=t[1].split(`,`).map(e=>e.trim().replace(/["'`]/g,``).toLowerCase()).filter(Boolean);return n.length>0&&n.every(e=>_h.has(e))},yh=(e,t)=>dh.test(t)?!0:!mh.test(e)||hh.test(e)?!1:!vh(e),bh=U({id:`supabase-rls-policy-risk`,title:`Permissive Supabase RLS policy`,severity:`error`,recommendation:"Keep public-read policies explicit, but gate inserts, updates, deletes, and service-role bypasses behind `auth.uid()` plus trusted tenant membership.",scan:e=>{if(!ih(e.relativePath))return[];let t=lh(e.content),n=t.search(uh);fh.lastIndex=0;for(let r=fh.exec(t);r!==null;r=fh.exec(t)){let i=r.index+r[0].length,a=t.slice(i).search(ph),o=a<0?t.length:i+a;if(yh(t.slice(r.index,o),e.content.slice(r.index,o))){(n<0||r.index<n)&&(n=r.index);break}}if(n<0)return[];let{line:r,column:i}=W(t,n);return[{message:`Supabase policy SQL disables RLS, permits writes broadly, or references a service-role bypass.`,line:r,column:i}]}}),xh=/create\s+(?:unlogged\s+)?table\s+(?:if\s+not\s+exists\s+)?(?!["`]?(?:auth|storage|realtime|vault|extensions|graphql|graphql_public|pgbouncer|net|supabase_functions|supabase_migrations|cron|pgsodium|pgmq|information_schema|pg_catalog|pg_temp|private|internal)["`]?\s*\.)(?:["`]?public["`]?\s*\.\s*)?["`]?([A-Za-z_][\w$]*)["`]?(?:\s*\(|\s+as\b)/gi,Sh=/alter\s+table\s+(?:if\s+exists\s+)?(?:only\s+)?(?:["`]?public["`]?\s*\.\s*)?["`]?([A-Za-z_][\w$]*)["`]?\s+(?:force\s+)?enable\s+row\s+level\s+security/gi,Ch=/\benable\s+row\s+level\s+security\b/gi,wh=e=>{let t=new Map,n=0;for(let r of e.matchAll(Sh)){let e=r[1];e!==void 0&&(n+=1,t.set(e.toLowerCase(),r.index))}return{lastEnableIndexByTable:t,staticEnableCount:n}},Th=(e,t)=>(e.match(Ch)?.length??0)>t,Eh=U({id:`supabase-table-missing-rls`,title:`Supabase table created without Row Level Security`,severity:`error`,recommendation:"Enable RLS in the same migration (`alter table <name> enable row level security;`) and add `auth.uid()`-scoped policies for select/insert/update/delete. A public table without RLS is fully readable and writable with the public anon key.",scan:e=>{if(!rh(e.relativePath))return[];let t=lh(e.content);if(!/create\s+(?:unlogged\s+)?table/i.test(t))return[];let n=[],{lastEnableIndexByTable:r,staticEnableCount:i}=wh(t);if(Th(t,i))return[];xh.lastIndex=0;for(let e=xh.exec(t);e!==null;e=xh.exec(t)){let i=e[1];if(i===void 0)continue;let a=r.get(i.toLowerCase());if(a!==void 0&&a>=e.index)continue;let o=W(t,e.index);n.push({message:`Supabase migration creates a public table but never enables Row Level Security, leaving every row exposed to the anon key.`,line:o.line,column:o.column})}return n}}),Dh=U({id:`svg-filter-clickjacking-risk`,title:`SVG-filtered iframe clickjacking primitive`,severity:`warn`,recommendation:"Avoid filtering cross-origin iframes. Use `frame-ancestors` on sensitive pages and keep SVG filters away from embedded privileged UI.",scan:K({shouldScan:e=>G(e.relativePath),pattern:/<iframe\b(?:=>|[^>]){0,300}\bfilter\s*:\s*["']?url\(#|filter\s*:\s*url\(#[\s\S]{0,700}<iframe\b|<fe(?:DisplacementMap|ColorMatrix|Composite|Tile|Morphology)\b[\s\S]{0,700}<iframe\b/i,message:`An iframe is rendered through an SVG/CSS filter, which can support advanced clickjacking or visual exfiltration tricks.`})}),Oh=e=>G(e)?tl.test(e)?!0:/(?:^|\/)(?:middleware|route)\.[cm]?[jt]sx?$/.test(e):!1,kh=U({id:`tenant-static-proxy-risk`,title:`Tenant-controlled static asset proxy`,severity:`warn`,recommendation:`Bind tenant identity to the trusted host or authenticated org, canonicalize after decoding, reject traversal, and never let one tenant choose another tenant's asset prefix.`,scan:K({shouldScan:e=>Oh(e.relativePath),pattern:/\b(?:fetch|path\.join|getObject\w*|GetObjectCommand|getSignedUrl|createReadStream)\s*\([^;]{0,200}(?:\$\{[^}]{0,100}\b(?:tenant|subdomain|workspace|hostPattern|(?<!\.)organization(?:Id|Slug)?)\b|\b(?:tenant|subdomain|workspace)(?:Id|Slug|Name)?\b\s*[,)+\].])/i,message:`Route code appears to compose tenant or subdomain input into a static/CDN/object-store fetch path.`})}),Ah=[/dangerouslySetInnerHTML\s*=\s*\{\{\s*__html\s*:[\s\S]{0,300}?\bJSON\.stringify\s*\(/gi,/<script\b[^>]*>(?:(?!<\/script>)[\s\S]){0,300}?\bJSON\.stringify\s*\(/gi],jh=/\$\{|["'`]\s*\+\s*$/,Mh=/^\s*\{(?!\{)/,Nh=/"(?:[^"\\\n]|\\.)*"|'(?:[^'\\\n]|\\.)*'/g,Ph=/\b(?:true|false|null)\b|[\d.]+(?:e[+-]?\d+)?/gi,Fh=e=>{if(e.includes("`")||e.includes("${"))return!1;let t=e.replace(Nh,``).replace(Ph,``);return!/[A-Za-z_$]/.test(t)},Ih=/^[\s)]*\.replace\s*\([^)]*(?:\\u003[cC]|&lt;|<)/,Lh=/(?:\b(?:escapeHtml|escapeJSON|escapeJson|htmlEscape|jsesc)|(?<![.\w])(?:serialize|serializeJavascript|devalue|uneval|superjson))\s*\(\s*$/i,Rh=/\bJSON\.stringify\s*\($/i,zh=U({id:`unsafe-json-in-html`,title:`Unescaped JSON in HTML or script sink`,severity:`warn`,recommendation:'JSON.stringify does not HTML-escape, so a `<\/script>` (or `<`) in the data breaks out and becomes XSS. Use an HTML-safe serializer (serialize-javascript, devalue) or escape `<`, `>`, and `&`, or pass data via a JSON `<script type="application/json">` read with JSON.parse.',scan:e=>{if(!G(e.relativePath))return[];let t=Nl(e);if(!t.includes(`JSON.stringify`))return[];let n=[],r=new Set;for(let[e,i]of Ah.entries()){i.lastIndex=0;for(let a=i.exec(t);a!==null;a=i.exec(t)){let i=a[0].replace(Rh,``);if(Lh.test(i))continue;if(e===1){let e=t.indexOf(`>`,a.index),n=a[0].search(/\bJSON\.stringify\s*\($/i);if(e>=0&&n>=0){let r=t.slice(e+1,a.index+n);if(!jh.test(r)||Mh.test(r))continue}}let o=a.index+a[0].length-1,s=td(t,o);if(s>=0){let e=t.slice(s+1,s+1+160);if(Ih.test(e)||Fh(t.slice(o+1,s)))continue}if(r.has(a.index))continue;r.add(a.index);let c=W(t,a.index);n.push({message:"JSON.stringify is embedded in HTML/script markup without HTML-escaping; data containing `<\/script>` or `<` breaks out and becomes XSS.",line:c.line,column:c.column})}}return n}}),Bh=/(?:(?<![.\w$])fetch|\baxios\.\s*(?:get|post|put|delete|head)|\bgot|\bgot\.\s*(?:get|post))\s*\(\s*([^,)]+)/,Vh=/\b(?:url|targetUrl|callbackUrl|redirectUrl|webhookUrl|companyUrl|websiteUrl|domainUrl|imageUrl|fetchUrl|next|return_to|returnTo|destination|location)\b/i,Hh=/\breq\.|\brequest\.(?:query|body|params|nextUrl)|\bsearchParams\b|\bparams\.|\bbody\.|\bquery\./,Uh=/\bredirect\s*:\s*["'](?:manual|error)["']/,Wh=/\b(params|body|query)\./g,Gh=(e,t)=>RegExp(`(?:const|let|var)\\s+${e}\\s*(?::[^=;\\n]{0,80})?=\\s*new\\s+URLSearchParams\\b`).test(t),Kh=(e,t)=>{let n=e.replace(Wh,(e,n)=>Gh(n,t)?``:e);return Hh.test(n)},qh=(e,t)=>{if(Kh(e,t))return!0;let n=/^[\w$]+$/.exec(e.trim());if(n===null)return!1;let r=RegExp(`(?:const|let|var)[^=;\\n]{0,80}\\b${n[0]}\\b[^=;\\n]{0,80}=([^;\\n]*)`,`g`);for(let e of t.matchAll(r)){let n=e[1]??``;if(/\breq\.|\brequest\.|\bsearchParams\b|\$_(?:GET|POST|REQUEST)/.test(n)||Kh(n,t))return!0}return!1},Jh=U({id:`untrusted-redirect-following`,title:`Server fetch follows redirects for caller-shaped URL`,severity:`warn`,recommendation:'Use `redirect: "manual"` or equivalent and re-validate every redirect target before following it to avoid SSRF redirect bypasses.',scan:e=>{if(!Oh(e.relativePath)||!Bh.test(e.content))return[];let t=[],n=e.content.split(`
29
29
  `);for(let r=0;r<n.length;r+=1){let i=n[r]??``,a=i.match(Bh),o=a?.[1]??``;if(!a||!Vh.test(o)||!qh(o,e.content))continue;let s=n.slice(r,r+5).join(`
30
30
  `);Uh.test(s)||t.push({message:`Server-side fetch code appears to follow redirects for a URL shaped like caller-controlled input.`,line:r+1,column:i.search(/\S/)+1})}return t}}),Yh=U({id:`url-prefilled-privileged-action`,title:`URL pre-fills a privileged action`,severity:`warn`,recommendation:`Require server-side validation and explicit confirmation for URL-sourced invite, role, permission, redirect, or sharing parameters.`,scan:K({shouldScan:e=>op(e.relativePath),pattern:/(?<!(?:safe|valid|sanitiz|relativ|allowlist|whitelist|parse|normaliz)[\w$]*\(\s*(?:new\s+)?(?:[\w$]+\s*\.\s*){0,4})\b(?:searchParams|useSearchParams\s*\(\s*\)|URLSearchParams\s*\([^)]{0,120}\))(?:[?!])?\.get(?:All)?\s*\(\s*["'](?:userstoinvite|role|permission|sharingaction|invite|admin|next|continue|returnTo|redirect_uri|callbackUrl)["']|\bsearchParams\.(?:userstoinvite|role|permission|sharingaction|invite|admin|returnTo|redirect_uri|callbackUrl)\b/i,message:`Client code reads sensitive action state from the URL, which can pre-fill invites, roles, redirects, or sharing flows with attacker values.`})}),Xh=/(?:^|\/)[^/]*webhook[^/]*\/|(?:^|\/)[^/]*webhook[^/]*\.[cm]?[jt]s$|\bwebhook\b/i,Zh=/\b(?:export\s+(?:async\s+)?function\s+POST|export\s+const\s+(?:POST|handler|webhook)|webhookHandler|webhookRoute)\b/i,Qh=RegExp(`verifySignature|verify.*signature|verify\\w*(?:Webhook|Auth)|constructEvent|createHmac|timingSafeEqual|svix|webhookSecret|stripe\\.webhooks|["'][\\w-]*signature["']|\\b[A-Za-z]{0,40}(?:verif|valid|check|assert|authenticat|compare|guard)[A-Za-z]{0,40}(?:secret|signature|hmac|webhook|digest)[A-Za-z]{0,40}\\s*\\(`,`i`),$h=/webhook[\s_-]?ur[il]\w*/gi,eg=/process\.env\.\w*WEBHOOK_URL|\b(?:send|post|dispatch|publish|notify)\w*Webhook/,tg=/\b(?:req|request)\b/,ng=/\/\/[^\n]*|\/\*[\s\S]*?\*\/|"(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])*'|`(?:\\.|[^`\\])*`/g,rg=U({id:`webhook-signature-risk`,title:`Webhook handler lacks signature verification`,severity:`warn`,recommendation:`Verify provider signatures before parsing or acting on webhook bodies. Use provider SDK helpers or HMAC verification with timing-safe comparison.`,scan:K({shouldScan:e=>{if(!G(e.relativePath)||eg.test(e.content))return!1;let t=e.content.replace(ng,``).replace($h,``);return Xh.test(e.relativePath)||Xh.test(t)},pattern:Zh,requireAll:[tg],suppressWhen:Qh,message:`Webhook handler code does not show an obvious signature verification step.`})}),ig=/\.[cm]?[jt]sx?$/i,ag=/\.d\.[cm]?[jt]s$/i,og=/\.mdx$/i,sg=/\.html?$/i,cg=new Set([`.angular`,`.astro`,`.cache`,`.contentlayer`,`.docusaurus`,`.expo`,`.git`,`.next`,`.nuxt`,`.output`,`.svelte-kit`,`.turbo`,`.vercel`,`build`,`coverage`,`dist`,`node_modules`,`out`,`storybook-static`]),lg=new WeakMap,ug=e=>{let t=lg.get(e);if(t)return t;let n=Fe(e);return lg.set(e,n),n},dg=e=>{let t=[],n=[],a=[e],o=!1;for(;a.length>0;){let e=a.pop();if(!e)continue;let s;try{s=r.readdirSync(e,{withFileTypes:!0})}catch{return null}for(let r of s){let s=i.join(e,r.name),c=cg.has(r.name)||r.name.startsWith(`.`)&&r.name!==`.dumi`&&r.name!==`.storybook`;if(!(r.isSymbolicLink()&&c)){if(r.isSymbolicLink())return null;if(r.isDirectory()){if(c)continue;a.push(s);continue}if(!(!r.isFile()||jc(s))){if(og.test(r.name)){o=!0;continue}if(sg.test(r.name)){n.push(Ui(s));continue}ig.test(r.name)&&(ag.test(r.name)||t.push(Ui(s)))}}}}return{sourceFilePaths:t,htmlFilePaths:n,hasOpaqueMdxConsumerSurface:o}},fg=(e,t)=>{for(let n of e){let e;try{e=r.readFileSync(n,`utf8`)}catch{return!0}for(let n of t)if(e.includes(`"${n}"`)||e.includes(`'${n}'`))return!0}return!1},pg=e=>{if(x(e,`ImportDeclaration`))return pc(e)?null:typeof e.source.value==`string`?e.source.value:null;if(x(e,`ExportNamedDeclaration`))return e.exportKind===`type`||fc(e.specifiers,`ExportSpecifier`,`exportKind`)?null:e.source&&typeof e.source.value==`string`?e.source.value:null;if(x(e,`ExportAllDeclaration`))return e.exportKind===`type`?null:typeof e.source.value==`string`?e.source.value:null;if(x(e,`ImportExpression`))return x(e.source,`Literal`)&&typeof e.source.value==`string`?e.source.value:null;if(x(e,`CallExpression`)&&x(e.callee,`Identifier`)&&e.callee.name===`require`&&e.arguments.length===1){let t=e.arguments[0];return t&&x(t,`Literal`)&&typeof t.value==`string`?t.value:null}return null},mg=(e,t,n,r)=>{A(e.programNode,i=>{let a=pg(i);if(!a)return;let o=kn(e.filePath,a);if(!o){r.add(a);return}let s=Ui(o);n.set(i,s);let c=t.get(s)??new Set;c.add(e),t.set(s,c)})},hg=({rootDirectory:e,currentFilePath:t,currentProgramNode:n,currentScopes:r,requiredModuleSources:i=[],knownModuleSources:a})=>{if(i.length>0&&a!==void 0&&!i.some(e=>a.includes(e)))return null;let o=dg(e);if(!o||i.length>0&&a===void 0&&!fg(o.sourceFilePaths,i))return null;let s=new Map;for(let e of o.sourceFilePaths){if(e===t){s.set(e,{filePath:e,programNode:n,scopes:r});continue}let i=Wt(e);if(!i||!x(i,`Program`))return null;s.set(e,{filePath:e,programNode:i,scopes:ug(i)})}let c=new Map,l=new WeakMap,u=new Set;for(let e of s.values())mg(e,c,l,u);return{modulesByFilePath:s,htmlFilePaths:o.htmlFilePaths,consumerModulesByFilePath:c,resolvedSourcePathByNode:l,unresolvedRuntimeSources:u,hasOpaqueMdxConsumerSurface:o.hasOpaqueMdxConsumerSurface}},gg=e=>{if(!e)return null;let t=O(e);return!x(t,`Literal`)||typeof t.value!=`boolean`?null:t.value},_g=(e,t,n={})=>{let r=n.maximumConstAliases===void 0?4:n.maximumConstAliases,i=n.shouldFoldStaticConditions??!1,a=n.shouldKeepKnownValues??!1,o=[],s=[{expression:e,remainingConstAliases:r,resolvingSymbols:new Set}];for(;s.length>0;){let e=s.pop();if(!e)continue;let n=O(e.expression);if(x(n,`Literal`)){if(typeof n.value!=`string`){if(a)continue;return null}o.push(n.value);continue}if(x(n,`TemplateLiteral`)){let e=Oa(n);if(e===null){if(a)continue;return null}o.push(e);continue}if(x(n,`ConditionalExpression`)){let t=i?gg(n.test):null;if(t!==null){s.push({expression:t?n.consequent:n.alternate,remainingConstAliases:e.remainingConstAliases,resolvingSymbols:e.resolvingSymbols});continue}s.push({expression:n.alternate,remainingConstAliases:e.remainingConstAliases,resolvingSymbols:new Set(e.resolvingSymbols)}),s.push({expression:n.consequent,remainingConstAliases:e.remainingConstAliases,resolvingSymbols:new Set(e.resolvingSymbols)});continue}if(a&&x(n,`LogicalExpression`)&&(n.operator===`??`||n.operator===`||`)){s.push({expression:n.right,remainingConstAliases:e.remainingConstAliases,resolvingSymbols:new Set(e.resolvingSymbols)}),s.push({expression:n.left,remainingConstAliases:e.remainingConstAliases,resolvingSymbols:new Set(e.resolvingSymbols)});continue}if(x(n,`Identifier`)){let r=t.referenceFor(n)?.resolvedSymbol;if(!r||r.kind!==`const`||!r.initializer||!x(r.declarationNode,`VariableDeclarator`)||r.declarationNode.id!==r.bindingIdentifier||e.remainingConstAliases===0||e.resolvingSymbols.has(r)){if(a)continue;return null}e.resolvingSymbols.add(r),s.push({expression:r.initializer,remainingConstAliases:e.remainingConstAliases===null?null:e.remainingConstAliases-1,resolvingSymbols:e.resolvingSymbols});continue}if(!a)return null}return o.length>0?o:null},vg=(e,t,n={})=>_g(e,t,n),yg=(e,t)=>_g(e,t,{shouldKeepKnownValues:!0}),bg=(e,t,n,r,i=!1)=>{let a=e.value;return a?x(a,`Literal`)?typeof a.value==`string`?[a.value]:null:x(a,`JSXExpressionContainer`)?vg(a.expression,t,{maximumConstAliases:n,shouldFoldStaticConditions:r,shouldKeepKnownValues:i}):null:null},xg=(e,t)=>bg(e,t,4,!1),Sg=(e,t)=>bg(e,t,null,!0),Cg=(e,t)=>bg(e,t,4,!1,!0),wg=(e,t)=>{let n=i.relative(t,e);return n===``||!n.startsWith(`..${i.sep}`)&&n!==`..`&&!i.isAbsolute(n)},Tg={attribute:null,expression:null,isPresent:!1,isUnknown:!1},Eg={attribute:null,expression:null,isPresent:!1,isUnknown:!0},Dg=(e,t,n)=>{for(let r=e.properties.length-1;r>=0;--r){let i=e.properties[r];if(!i)return Eg;if(x(i,`SpreadElement`)){if(!x(i.argument,`ObjectExpression`))return Eg;let e=Dg(i.argument,t,n);if(e.isPresent||e.isUnknown)return e;continue}if(!x(i,`Property`))return Eg;let a=N(i,{allowComputedString:!0});if(!a)return Eg;if((n?a:a.toLowerCase())===t)return{attribute:null,expression:i.value,isPresent:!0,isUnknown:!1}}return Tg},Og=(e,t,n=!0)=>{let r=n?t:t.toLowerCase();for(let t=e.length-1;t>=0;--t){let i=e[t];if(!i)return Eg;if(x(i,`JSXSpreadAttribute`)){if(!x(i.argument,`ObjectExpression`))return Eg;let e=Dg(i.argument,r,n);if(e.isPresent||e.isUnknown)return e;continue}if(!x(i,`JSXAttribute`))continue;let a=Fo(i.name);if((n?a:a?.toLowerCase())===r)return{attribute:i,expression:null,isPresent:!0,isUnknown:!1}}return Tg},kg=/(?<attributeName>[^\s"'<>/=]+)(?:\s*=\s*(?:"(?<doubleQuoted>[^"]*)"|'(?<singleQuoted>[^']*)'|(?<unquoted>[^\s"'=<>`]+)))?/g,Ag=/<!--[\s\S]*?-->|(?<skippedContentOpeningTag><(?<skippedContentTag>script|style|textarea|title|xmp|iframe|noembed|noframes|plaintext|template)\b(?:"[^"]*"|'[^']*'|[^'"<>])*?>)[\s\S]*?(?:<\/\k<skippedContentTag>\s*>|$)|(?<openingTag><[A-Za-z][\w:-]*(?:"[^"]*"|'[^']*'|[^'"<>])*>)/gi,jg=new Map,Mg=(e,t,n)=>{if(!e.isPresent)return;let r=e.attribute?Cg(e.attribute,t):e.expression?yg(e.expression,t):null;for(let e of r??[]){let t=e?.trim();t&&n.add(t)}},Ng=(e,t,n)=>{for(let r of e.properties){if(x(r,`SpreadElement`)){x(r.argument,`ObjectExpression`)&&Ng(r.argument,t,n);continue}if(x(r,`Property`)&&N(r,{allowComputedString:!0})?.toLowerCase()===`id`)for(let e of yg(r.value,t)??[]){let t=e.trim();t&&n.add(t)}}},Pg=e=>{let t=e.parent;for(x(t,`JSXElement`)&&t.openingElement===e&&(t=t.parent);t;){if(x(t,`JSXElement`)&&Qo(t.openingElement)===`template`)return!0;t=t.parent}return!1},Fg=(e,t,n)=>{A(e,e=>{if(!x(e,`JSXOpeningElement`)||Pg(e))return;let r=Og(e.attributes,`id`,!1);if(r.isUnknown){for(let r of e.attributes)Mg(Og([r],`id`,!1),t,n),x(r,`JSXSpreadAttribute`)&&x(r.argument,`ObjectExpression`)&&Ng(r.argument,t,n);return}Mg(r,t,n)})},Ig=(e,t)=>{for(let n of e.matchAll(Ag)){let e=n.groups?.skippedContentOpeningTag??n.groups?.openingTag;if(e)for(let n of e.matchAll(kg)){if(n.groups?.attributeName?.toLowerCase()!==`id`)continue;let e=n.groups?.doubleQuoted??n.groups?.singleQuoted??n.groups?.unquoted??``;e.trim()&&t.add(e.trim())}}},Lg=e=>{if(!i.isAbsolute(e.currentFilePath))return null;let t=e.configuredRootDirectory?Ui(e.configuredRootDirectory):null;return!t||!wg(e.currentFilePath,t)?null:t},Rg=()=>{jg.clear()},zg=e=>{let t=new Set;Fg(e.currentProgramNode,e.currentScopes,t);let n=Lg(e);if(!n)return t;if(jg.has(n)){let e=jg.get(n);return e?new Set([...e,...t]):null}let i=hg({rootDirectory:n,currentFilePath:Ui(e.currentFilePath),currentProgramNode:e.currentProgramNode,currentScopes:e.currentScopes});if(!i)return jg.set(n,null),null;let a=new Set;for(let e of i.modulesByFilePath.values())Fg(e.programNode,e.scopes,a);try{for(let e of i.htmlFilePaths)Ig(r.readFileSync(e,`utf8`),a)}catch{return jg.set(n,null),null}return jg.set(n,a),new Set([...a,...t])},Bg=()=>{jn(),_t(),pn(),Rg(),On()},Vg=e=>Xc.test(e)||Zc.test(e),Hg=e=>{let t=cl.test(e);return qm(e)||ih(e)||xl(e)||ml(e)?{bucket:`priority`,isGeneratedBundleByName:t}:pl(e,t)?{bucket:`artifact`,isGeneratedBundleByName:t}:Vg(e)?{bucket:`other`,isGeneratedBundleByName:t}:null},Ug=(e,t)=>t||Vg(e)||ml(e)||qm(e),Wg=[`nextjs`,`astro`,`vite`,`cra`,`remix`,`gatsby`,`expo`,`react-native`,`tanstack-start`,`preact`,`unknown`];export{rd as $,qe as $i,Vi as $n,Fr as $r,pc as $t,vm as A,l as Aa,dt as Ai,Oa as An,ai as Ar,_u as At,Cp as B,Xe as Bi,ia as Bn,Xr as Br,bl as Bt,Zm as C,p as Ca,At as Ci,mo as Cn,ji as Cr,pu as Ct,Vm as D,f as Da,yt as Di,Ha as Dn,ni as Dr,gu as Dt,Um as E,u as Ea,vt as Ei,go as En,_i as Er,Su as Et,cm as F,it as Fi,ga as Fn,$r as Fr,lu as Ft,ap as G,Ve as Gi,ta as Gn,Lr as Gr,Lc as Gt,up as H,$e as Hi,$i as Hn,qr as Hr,Rc as Ht,sm as I,tt as Ii,ha as In,Qr as Ir,iu as It,wd as J,Le as Ji,F as Jn,Br as Jr,Pc as Jt,Fd as K,Ye as Ki,Yi as Kn,Rr as Kr,Vc as Kt,am as L,rt as Li,sa as Ln,Zr as Lr,su as Lt,hm as M,o as Ma,st as Mi,xa as Mn,si as Mr,uu as Mt,mm as N,lt as Ni,Sa as Nn,ui as Nr,yu as Nt,Lm as O,h as Oa,bt as Oi,Aa as On,li as Or,fu as Ot,pm as P,nt as Pi,L as Pn,Kr as Pr,cu as Pt,id as Q,Ke as Qi,Ii as Qn,Vr as Qr,fc as Qt,nm as R,We as Ri,oa as Rn,Wr as Rr,Rl as Rt,Qm as S,m as Sa,jt as Si,po as Sn,vi as Sr,xu as St,Km as T,d as Ta,Ot as Ti,fo as Tn,di as Tr,ou as Tt,lp as U,Ge as Ui,na as Un,Jr as Ur,zc as Ut,gp as V,Ze as Vi,ra as Vn,ei as Vr,U as Vt,cp as W,He as Wi,ea as Wn,Yr as Wr,Bc as Wt,ld as X,Re as Xi,Ki as Xn,Ur as Xr,Mc as Xt,cd as Y,et as Yi,qi as Yn,zr as Yr,jc as Yt,sd as Z,ze as Zi,Ui as Zn,Hr as Zr,xc as Zt,Dh as _,ce as _a,Rt as _i,_o as _n,pi as _r,ru as _t,zg as a,b as aa,Qn as ai,as as an,wi as ar,Fu as at,nh as b,de as ba,It as bi,uo as bn,ti as br,bu as bt,Sg as c,pe as ca,In as ci,$o as cn,mi as cr,zl as ct,hg as d,le as da,Nn as di,Jo as dn,ki as dr,Wl as dt,Qe as ea,Or as ei,dc as en,Ri as er,J as et,rg as f,v as fa,Pn as fi,Ro as fn,Ei as fr,Vl as ft,kh as g,ie as ga,Wt as gi,yo as gn,Si as gr,ql as gt,zh as h,ue as ha,fn as hi,jo as hn,oi as hr,Kl as ht,Bg as i,x as ia,$n as ii,Hs as in,gi as ir,Wu as it,_m as j,s as ja,ot as ji,Ca as jn,bi as jr,vu as jt,Em as k,c as ka,D as ki,R as kn,ci as kr,du as kt,xg as l,fe as la,A as li,Qo as ln,Ai as lr,Ul as lt,Jh as m,ne as ma,kn as mi,Po as mn,Ti as mr,Bl as mt,Hg as n,Ie as na,M as ni,lc as nn,N as nr,$u as nt,Og as o,y as oa,j as oi,ts as on,xi as or,Pu as ot,Yh as p,te as pa,k as pi,Fo as pn,Di as pr,Gl as pt,Pd as q,Ue as qi,I as qn,Ir as qr,Hc as qt,Ug as r,he as ra,er as ri,uc as rn,Ci as rr,Gu as rt,wg as s,me as sa,Xn as si,es as sn,yi as sr,Hl as st,Wg as t,Fe as ta,mr as ti,cc as tn,P as tr,ed as tt,gg as u,se as ua,Fn as ui,Yo as un,Oi as ur,Jl as ut,Eh as v,ae as va,Lt as vi,B as vn,hi as vr,hu as vt,Ym as w,ee as wa,Dt as wi,lo as wn,ri as wr,Yl as wt,$m as x,g as xa,Mt as xi,ho as xn,ii as xr,au as xt,bh as y,oe as ya,O as yi,vo as yn,fi as yr,mu as yt,Gp as z,Je as zi,aa as zn,Gr as zr,Ll as zt};
31
- //# sourceMappingURL=capability-DRxP7Tl8.js.map
31
+ //# sourceMappingURL=capability-D9W-G7Ci.js.map