oxlint-plugin-react-doctor 0.9.17-dev.a410280 → 0.9.17-dev.bb00a27

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.
@@ -1,5 +1,5 @@
1
- import*as e from"node:path";import*as t from"node:fs";import{readFileSync as n}from"node:fs";import{KEYS as r}from"eslint-visitor-keys";import{parseSync as i,rawTransferSupported as a,visitorKeys as o}from"oxc-parser";const s=[[`nextjs`,`Next.js`,`NEXT_PUBLIC_*`],[`vite`,`Vite`,`VITE_*`],[`tanstack-start`,`TanStack Start`,`VITE_*`],[`cra`,`Create React App`,`REACT_APP_*`],[`gatsby`,`Gatsby`,`GATSBY_*`]],c=e=>{for(let[t,n,r]of s)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`},l=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,u=[{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`}],d=Object.fromEntries(u.map(e=>[e.key,e.severity])),f=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(`.`)),p=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,`padding`,`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`,`margin`,`marginTop`,`marginRight`,`marginBottom`,`marginLeft`,`borderWidth`,`fontSize`,`lineHeight`,`gap`]),m=new Set([`animate`,`initial`,`exit`,`whileHover`,`whileTap`,`whileFocus`,`whileDrag`,`whileInView`]),h=/blur\((\d+(?:\.\d+)?)px\)/,g=new Set([`requestAnimationFrame`,`setInterval`]),_=new Set([`framer-motion`,`motion`]),v=new Set([`bounce`,`elastic`,`wobble`,`jiggle`,`spring`]),y={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`},b=[`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`],ee=[`@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([...b,`client-passive-event-listeners`,`effect-needs-cleanup`,`effect-listener-cleanup-reference-mismatch`,`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`,`server-sequential-independent-await`,`rn-no-deprecated-modules`,`rn-no-legacy-shadow-styles`,`rn-no-raw-text`,`rn-prefer-expo-image`,`rn-style-prefer-boxshadow`,...re]),me=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},he=(e,t)=>e.major-t.major||e.minor-t.minor||e.patch-t.patch||Number(t.isPrerelease)-Number(e.isPrerelease);let x=null;const ge=e=>{x?.existencePaths.add(e)},S=e=>{x?.contentPaths.add(e)},_e=()=>x!==null,ve=e=>{let t=x,n={existencePaths:new Set,contentPaths:new Set};x=n;try{return{value:e(),trace:n}}finally{if(x=t,t!==null){for(let e of n.existencePaths)t.existencePaths.add(e);for(let e of n.contentPaths)t.contentPaths.add(e)}}},ye=e=>{if(x!==null){for(let t of e.existencePaths)x.existencePaths.add(t);for(let t of e.contentPaths)x.contentPaths.add(t)}},be=e=>ve(e).trace,xe=new Map,Se=new Map;let Ce=0;const we=()=>{xe.clear(),Se.clear(),Ce+=1},Te=()=>Ce,Ee=n=>{if(!n)return null;let r=e.dirname(n),i=xe.get(r);if(i!==void 0){if(_e()){let t=r;for(;ge(e.join(t,`package.json`)),t!==i;){let n=e.dirname(t);if(n===t)break;t=n}}return i}let a=r;for(;;){let n=e.join(a,`package.json`);ge(n);let i=!1;try{i=t.statSync(n,{throwIfNoEntry:!1})?.isFile()??!1}catch{i=!1}if(i)return xe.set(r,a),a;let o=e.dirname(a);if(o===a)return xe.set(r,null),null;a=o}},De=e=>{let t=Ee(e);return t?Oe(t):null},Oe=n=>{let r=Se.get(n);if(r!==void 0&&!_e())return r;let i=e.join(n,`package.json`);if(S(i),r!==void 0)return r;let a=null;try{let e=JSON.parse(t.readFileSync(i,`utf-8`));typeof e==`object`&&e&&(a=e)}catch{a=null}return Se.set(n,a),a},ke=new Map;let Ae=Te();const je=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=me(r);if(!i)return null;n.push(i)}return n.reduce((e,t)=>he(t,e)<0?t:e)},Me=(e,t)=>{let n=e.dependencies?.[t]??e.devDependencies?.[t]??e.peerDependencies?.[t]??e.optionalDependencies?.[t],r=je(n);return r&&typeof n==`string`?{version:r,declaredRange:n}:null},Ne=(t,n)=>{let r=t;for(;;){let t=Oe(e.join(r,`node_modules`,n));if(t)return{didFindPackage:!0,version:typeof t.version==`string`?me(t.version):null};let i=e.dirname(r);if(i===r)return{didFindPackage:!1,version:null};r=i}},Pe=(e,t)=>{let n=Ne(e,t);if(n.didFindPackage)return n.version?{version:n.version,declaredRange:null}:null;let r=Oe(e);return r?Me(r,t):null},Fe=(t,n)=>{if(!t)return null;let r=Ee(e.resolve(t));if(!r)return null;let i=Te();i!==Ae&&(ke.clear(),Ae=i);let a=JSON.stringify([r,n]),o=ke.get(a);if(o)return ye(o.trace),o.version;let{value:s,trace:c}=ve(()=>Pe(r,n));return ke.set(a,{version:s,trace:c}),s},Ie=new Set([`implements`,`returnType`,`superTypeArguments`,`superTypeParameters`,`typeAnnotation`,`typeArguments`,`typeParameters`]),Le={...o,...r,ArrayPattern:[`decorators`,...r.ArrayPattern],AssignmentPattern:[`decorators`,...r.AssignmentPattern],ClassDeclaration:[`decorators`,...r.ClassDeclaration],ClassExpression:[`decorators`,...r.ClassExpression],Identifier:[`decorators`,...r.Identifier],MethodDefinition:[`decorators`,...r.MethodDefinition],ObjectPattern:[`decorators`,...r.ObjectPattern],PropertyDefinition:[`decorators`,...r.PropertyDefinition],RestElement:[`decorators`,...r.RestElement]},Re=new Map,ze=e=>e.filter(e=>e!==`parent`&&!Ie.has(e)),Be=e=>{let t=Re.get(e.type);if(t)return t;let n=Le[e.type];if(!n)return ze(Object.keys(e));let r=ze(n);return Re.set(e.type,r),r},C=e=>typeof e==`object`&&!!e&&typeof e.type==`string`,w=e=>e!=null&&(e.type===`ArrowFunctionExpression`||e.type===`FunctionExpression`||e.type===`FunctionDeclaration`),T=(e,t)=>typeof e==`object`&&!!e&&e.type===t,Ve=e=>e===`var`||e===`function`,He=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},Ue=(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},We=(e,t,n)=>{let r=Ue(e,t,n.currentScope,n);return n.scopeStack.push(r),n.currentScope=r,n.ownScopeForNode.set(t,r),r},Ge=e=>{e.scopeStack.pop();let t=e.scopeStack[e.scopeStack.length-1];if(!t)throw Error(`scope stack underflow`);e.currentScope=t},Ke=(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},qe=(e,t,n,r,i,a)=>{if(T(e,`Identifier`)){Ke(n,r,{name:e.name,kind:i,bindingIdentifier:e,declarationNode:a,initializer:t});return}if(T(e,`ObjectPattern`)){for(let o of e.properties)if(T(o,`Property`)){let e=o.value;qe(e,T(e,`AssignmentPattern`)?e.right:t,n,r,i,a)}else T(o,`RestElement`)&&qe(o.argument,t,n,r,i,a);return}if(T(e,`ArrayPattern`)){for(let o of e.elements)o&&qe(o,T(o,`AssignmentPattern`)?o.right??null:t,n,r,i,a);return}if(T(e,`AssignmentPattern`)){qe(e.left,e.right??null,n,r,i,a);return}T(e,`RestElement`)&&qe(e.argument,null,n,r,i,a)},Je=(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)},Ye=e=>e.parent?w(e.parent):!1,Xe=e=>e.parent!==null&&e.parent!==void 0&&e.parent.type===`CatchClause`,Ze=(e,t)=>{if(!T(e,`VariableDeclaration`))return;let n=e.kind===`var`?`var`:e.kind===`let`?`let`:e.kind===`const`?`const`:`using`,r=Ve(n)?He(t.currentScope):t.currentScope;for(let i of e.declarations){let e=i,a=i.init??null;qe(i.id,a,r,t,n,e)}},Qe=(e,t)=>{T(e,`FunctionDeclaration`)&&e.id&&Ke(He(t.currentScope),t,{name:e.id.name,kind:`function`,bindingIdentifier:e.id,declarationNode:e,initializer:e})},$e=(e,t)=>{T(e,`ClassDeclaration`)&&e.id&&Ke(t.currentScope,t,{name:e.id.name,kind:`class`,bindingIdentifier:e.id,declarationNode:e,initializer:e})},et=(e,t)=>{if(!T(e,`ImportDeclaration`))return;let n=He(t.currentScope);for(let r of e.specifiers){let e=r.local;T(e,`Identifier`)&&Ke(n,t,{name:e.name,kind:`import`,bindingIdentifier:e,declarationNode:r,initializer:r})}},tt=(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||!T(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`;Ke(He(t.currentScope),t,{name:n.name,kind:r,bindingIdentifier:n,declarationNode:e,initializer:null})},nt=(e,t,n)=>{for(let r of e)qe(r,null,t,n,`parameter`,r)},rt=e=>!(!T(e,`BlockStatement`)||Ye(e)||Xe(e)||e.parent&&e.parent.type===`TSModuleDeclaration`),it=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)},at=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}},ot=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`}},st=(e,t)=>{t.nodeScope.set(e,t.currentScope)},ct=(e,t,n)=>{let r=We(e,t,n);return st(t,n),r},lt=(e,t,n)=>{if(e.type===`AssignmentPattern`){lt(e.left,t,n);let r=e.right??null;r&&E(r,t,n);return}if(e.type===`ObjectPattern`){for(let r of e.properties){let e=r;if(e.type===`RestElement`){lt(e.argument,t,n);continue}if(e.type!==`Property`)continue;let i=e;i.computed&&E(i.key,t,n),lt(i.value,t,n)}return}if(e.type===`ArrayPattern`){for(let r of e.elements)r&&lt(r,t,n);return}e.type===`RestElement`&&lt(e.argument,t,n)},E=(e,t,n)=>{if(e.type===`ArrowFunctionExpression`||e.type===`FunctionExpression`||e.type===`FunctionDeclaration`){e.type===`FunctionDeclaration`&&e.id&&Qe(e,t);let n=e.params??[],r=t.currentScope;for(let e of n)if(!(!(`decorators`in e)||!Array.isArray(e.decorators)))for(let n of e.decorators)C(n)&&E(n,t,r);st(e,t);let i=We(e.type===`ArrowFunctionExpression`?`arrow-function`:`function`,e,t);(e.type===`FunctionExpression`||e.type===`FunctionDeclaration`)&&e.id&&Ke(i,t,{name:e.id.name,kind:`function`,bindingIdentifier:e.id,declarationNode:e,initializer:e}),nt(n,i,t);for(let e of n)lt(e,t,r);let a=e.body;a&&E(a,t,r),Ge(t);return}if(e.type===`ClassDeclaration`||e.type===`ClassExpression`){if(e.type===`ClassDeclaration`&&e.id&&$e(e,t),Array.isArray(e.decorators))for(let n of e.decorators)C(n)&&E(n,t,null);let n=ct(`class`,e,t);e.type===`ClassExpression`&&e.id&&Ke(n,t,{name:e.id.name,kind:`class`,bindingIdentifier:e.id,declarationNode:e,initializer:e}),e.superClass&&E(e.superClass,t,n),e.body&&E(e.body,t,n),Ge(t);return}if(e.type===`CatchClause`){let n=ct(`catch`,e,t);e.param&&qe(e.param,null,n,t,`catch-clause-parameter`,e),e.body&&E(e.body,t,n),Ge(t);return}if(e.type===`ForStatement`||e.type===`ForInStatement`||e.type===`ForOfStatement`){ct(`for`,e,t),ut(e,t),Ge(t);return}if(e.type===`SwitchStatement`){let n=ct(`switch`,e,t);e.discriminant&&E(e.discriminant,t,n);for(let r of e.cases)E(r,t,n);Ge(t);return}if(e.type===`TSModuleDeclaration`){let n=ct(`ts-module`,e,t);if(e.id&&T(e.id,`Identifier`)){let r=e.id;Ke(He(n.parent??t.currentScope),t,{name:r.name,kind:`ts-module`,bindingIdentifier:r,declarationNode:e,initializer:null})}e.body&&E(e.body,t,n),Ge(t);return}if(e.type===`TSEnumDeclaration`){tt(e,t);let n=ct(`ts-enum`,e,t),r=e.members??[];for(let e of r)E(e,t,n);Ge(t);return}if(e.type===`BlockStatement`&&rt(e)){let n=ct(`block`,e,t);for(let r of e.body)E(r,t,n);Ge(t);return}switch(t.currentScope!==n&&st(e,t),e.type){case`VariableDeclaration`:Ze(e,t);break;case`ImportDeclaration`:et(e,t);break;case`TSImportEqualsDeclaration`:case`TSTypeAliasDeclaration`:case`TSInterfaceDeclaration`:tt(e,t);break}(e.type===`Identifier`||e.type===`JSXIdentifier`)&&!t.symbolByBindingIdentifier.has(e)&&!at(e)&&(e.type===`JSXIdentifier`?it(e)&&Je(t,e,ot(e)):Je(t,e,ot(e))),ut(e,t)},ut=(e,t)=>{let n=e,r=t.currentScope;for(let i of Be(e)){let e=n[i];if(Array.isArray(e))for(let n of e)C(n)&&E(n,t,r);else C(e)&&E(e,t,r)}},dt=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)},ft=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 r of e.body)E(r,n,t);else E(e,n,t);return dt(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}}},pt=(e,t)=>{let n=e;for(;n;){if(n===t)return!0;n=n.parent}return!1},mt=1024,ht=2e6,gt=1e3,D=e=>{let t=e.parent;for(;t;){if(w(t))return t;t=t.parent??null}return null},_t=e=>T(e,`Identifier`)?e.name:T(e,`Literal`)&&typeof e.value==`string`?e.value:null,vt=e=>{if(T(e,`ImportSpecifier`)){let t=e.imported;return T(t,`Identifier`)?t.name:T(t,`Literal`)&&typeof t.value==`string`?t.value:null}return T(e,`ImportDefaultSpecifier`)?`default`:null},yt=(e,t)=>{if(!T(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=bt(r,t,n);if(e)return e}return null},bt=(e,t,n)=>{if(!T(e,`ExportSpecifier`)||e.exportKind===`type`||_t(e.exported)!==t)return null;let r=_t(e.local);return r?{importedName:r,source:n}:null},xt=(e,t)=>{if(!T(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},St=(e,t)=>{if(!T(e,`Program`))return[];let n=[];for(let r of e.body??[]){let e=yt(r,t);if(e)return[e];let i=xt(r,t);i&&n.push(i)}return n},O=(e,t)=>{if(e){if(T(e,`Identifier`)){t.add(e.name);return}if(T(e,`AssignmentPattern`)){O(e.left,t);return}if(T(e,`RestElement`)){O(e.argument,t);return}if(T(e,`ArrayPattern`)){for(let n of e.elements??[])O(n,t);return}if(T(e,`ObjectPattern`))for(let n of e.properties??[]){if(T(n,`RestElement`)){O(n.argument,t);continue}T(n,`Property`)&&O(n.value,t)}}},Ct=(e,t,n)=>{if(e&&!T(e,`Identifier`)){if(T(e,`AssignmentPattern`)){k(e.right,t,n),Ct(e.left,t,n);return}if(T(e,`RestElement`)){Ct(e.argument,t,n);return}if(T(e,`ArrayPattern`)){for(let r of e.elements??[])Ct(r,t,n);return}if(T(e,`ObjectPattern`))for(let r of e.properties??[]){if(T(r,`RestElement`)){Ct(r.argument,t,n);continue}T(r,`Property`)&&(r.computed&&k(r.key,t,n),Ct(r.value,t,n))}}},wt=(e,t,n)=>{if(!T(e,`FunctionDeclaration`)&&!T(e,`FunctionExpression`)&&!T(e,`ArrowFunctionExpression`))return;let r=new Set(n);for(let t of e.params??[])O(t,r);for(let n of e.params??[])Ct(n,t,r);k(e.body,t,r)},k=(e,t,n)=>{if(!e)return;if(T(e,`Identifier`)){n.has(e.name)||t.add(e.name);return}if(T(e,`MemberExpression`)){k(e.object,t,n),e.computed&&k(e.property,t,n);return}if(T(e,`Property`)){e.computed&&k(e.key,t,n),k(e.value,t,n);return}if(T(e,`FunctionDeclaration`)||T(e,`FunctionExpression`)||T(e,`ArrowFunctionExpression`)){wt(e,t,n);return}if(T(e,`TSAsExpression`)||T(e,`TSSatisfiesExpression`)||T(e,`TSTypeAssertion`)||T(e,`TSNonNullExpression`)||T(e,`TSInstantiationExpression`)){k(e.expression,t,n);return}if(typeof e.type==`string`&&e.type.startsWith(`TS`))return;let r=e;for(let e of Object.keys(r)){if(e===`parent`||Ie.has(e))continue;let i=r[e];if(Array.isArray(i))for(let e of i)C(e)&&k(e,t,n);else C(i)&&k(i,t,n)}},Tt=(e,t)=>k(e,t,new Set),Et=e=>{let t=[],n=new Set;if(T(e,`VariableDeclaration`))for(let r of e.declarations??[])T(r.init,`AwaitExpression`)&&(r.init.argument&&t.push(r.init.argument),O(r.id,n));else if(T(e,`ExpressionStatement`)){let r=e.expression;T(r,`AwaitExpression`)?r.argument&&t.push(r.argument):T(r,`AssignmentExpression`)&&T(r.right,`AwaitExpression`)&&(r.right.argument&&t.push(r.right.argument),T(r.left,`Identifier`)&&n.add(r.left.name))}else T(e,`ReturnStatement`)&&T(e.argument,`AwaitExpression`)?e.argument.argument&&t.push(e.argument.argument):T(e,`ForOfStatement`)&&e.await&&(e.right&&t.push(e.right),O(T(e.left,`VariableDeclaration`)?e.left.declarations?.[0]?.id??null:e.left,n));return t.length===0?null:{awaitedExpressions:t,boundNames:[...n]}},Dt=(e,t)=>{if(T(e,`VariableDeclaration`))for(let n of e.declarations??[])O(n.id,t)},Ot=(e,t,n)=>{let r=new Map,i=[];for(let a of e.body??[]){let e=Et(a);if(!e){let e=new Set;if(Dt(a,e),e.size===0)continue;let t=new Set;Tt(a,t);let n=new Set;for(let e of t)for(let t of r.get(e)??[])n.add(t);if(n.size===0)continue;for(let t of e)r.set(t,n);continue}if(n&&!e.awaitedExpressions.every(e=>n(e))){r.clear(),i.length=0;continue}let o=new Set;for(let t of e.awaitedExpressions)Tt(t,o);let s=new Set;for(let e of o)for(let t of r.get(e)??[])s.add(t);if(i.filter((e,t)=>!s.has(t)).length+1>=t)return a;let c=i.length;i.push(s);let l=new Set(s);l.add(c);for(let t of e.boundNames)r.set(t,l)}return null},kt=e=>{if(e.kind!==`import`)return null;let t=e.declarationNode.parent;return T(t,`ImportDeclaration`)?t:null},At=new Set([`ParenthesizedExpression`,`TSAsExpression`,`TSSatisfiesExpression`,`TSTypeAssertion`,`TSNonNullExpression`,`TSInstantiationExpression`,`ChainExpression`]),A=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}},j=e=>{let t=e;for(;t.parent&&At.has(t.parent.type);)t=t.parent;return t},jt=e=>{if(T(e,`FunctionDeclaration`)&&T(e.id,`Identifier`))return e.id;let t=j(e),n=t.parent;return T(n,`VariableDeclarator`)&&n.init===t&&T(n.id,`Identifier`)?n.id:null},M=e=>{let t=e.property;return!e.computed&&T(t,`Identifier`)?t.name:e.computed&&T(t,`Literal`)?typeof t.value==`string`?t.value:null:e.computed&&T(t,`TemplateLiteral`)&&t.expressions.length===0?t.quasis[0]?.value.cooked??t.quasis[0]?.value.raw??null:null},Mt=e=>{let t=j(e);return!!(t.parent&&T(t.parent,`AwaitExpression`)&&t.parent.argument===t)},N=(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=A(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},Nt=(e,t)=>{if(!w(e)||e.async||!T(e.body,`BlockStatement`))return!1;let[n,r,i,a,o]=e.body.body.toReversed();if(!T(o,`VariableDeclaration`)||o.kind!==`const`||o.declarations.length!==1||!T(a,`IfStatement`)||a.alternate||!T(i,`VariableDeclaration`)||i.kind!==`const`||i.declarations.length!==1||!T(r,`ExpressionStatement`)||!T(n,`ReturnStatement`))return!1;let s=o.declarations[0],c=i.declarations[0];if(!s?.init||!c?.init||!n.argument)return!1;let l=A(s.init),u=A(r.expression);if(!T(l,`CallExpression`)||!T(u,`CallExpression`)||!T(l.callee,`MemberExpression`)||!T(u.callee,`MemberExpression`)||l.optional||u.optional||l.callee.optional||u.callee.optional||M(l.callee)!==`get`||M(u.callee)!==`set`||l.arguments.length!==1||u.arguments.length!==2)return!1;let d=N(l.callee.object,t);if(d?.kind!==`const`||!d.initializer||D(d.bindingIdentifier)||N(u.callee.object,t)!==d)return!1;let f=A(d.initializer);if(!T(f,`NewExpression`)||!T(f.callee,`Identifier`)||![`Map`,`WeakMap`].includes(f.callee.name)||!t.isGlobalReference(f.callee)||f.arguments.length!==0)return!1;let p=a.consequent;if(T(p,`BlockStatement`)){if(p.body.length!==1)return!1;p=p.body[0]}let m=t.symbolFor(s.id),h=t.symbolFor(c.id),g=l.arguments[0],_=u.arguments[0],v=u.arguments[1];if(!m||!h||!T(p,`ReturnStatement`)||!p.argument||!g||!_||!v||t.symbolFor(A(a.test))!==m||t.symbolFor(A(p.argument))!==m||t.symbolFor(A(v))!==h||t.symbolFor(A(n.argument))!==h)return!1;let y=N(A(g),t);if(!y||y.references.some(e=>e.flag!==`read`)||y.kind!==`parameter`||D(y.bindingIdentifier)!==e||N(A(_),t)!==y)return!1;let b=l.callee.object,ee=u.callee.object;return d.references.every(e=>e.flag===`read`&&(e.identifier===b||e.identifier===ee))},Pt=e=>{let t=e;for(;t;){if(T(t,`Program`))return t;t=t.parent??null}return null},Ft=new WeakMap,It=(e,t)=>{t.push(...e.symbols);for(let n of e.children)It(n,t)},Lt=e=>{let t=new Map,n=[];It(e.rootScope,n);for(let r of n){let n=N(r.bindingIdentifier,e);if(!n)continue;let i=t.get(n.id)??[];i.push(r),t.set(n.id,i)}return t},Rt=(e,t)=>{let n=N(e,t);if(!n)return[];let r=Ft.get(t);return r||(r=Lt(t),Ft.set(t,r)),r.get(n.id)??[]},P=(e,t={})=>{if(!T(e,`Property`)&&!T(e,`MethodDefinition`)&&!T(e,`PropertyDefinition`)&&!T(e,`MemberExpression`))return null;let n=T(e,`MemberExpression`)?e.property:e.key;if(e.computed)return t.allowComputedString&&T(n,`Literal`)&&typeof n.value==`string`?n.value:t.allowComputedString&&t.stringifyNonStringLiterals&&T(n,`Literal`)?String(n.value):t.allowComputedString&&T(n,`TemplateLiteral`)&&n.expressions.length===0?n.quasis[0]?.value.cooked??n.quasis[0]?.value.raw??null:null;if(T(n,`Identifier`))return n.name;if(T(n,`Literal`)){if(typeof n.value==`string`)return n.value;if(t.stringifyNonStringLiterals)return String(n.value)}return null},zt=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},Bt=(e,t,n={})=>{let r=P(e,{allowComputedString:!0,stringifyNonStringLiterals:n.stringifyNonStringLiterals});if(r!==null||!T(e,`Property`)&&!T(e,`MethodDefinition`)&&!T(e,`PropertyDefinition`)&&!T(e,`MemberExpression`)||!e.computed)return r;let i=A(T(e,`MemberExpression`)?e.property:e.key);if(!T(i,`Identifier`))return null;let a=N(i,t);if(a?.kind!==`const`||!a.initializer)return null;let o=A(a.initializer);return T(o,`Literal`)?typeof o.value==`string`?o.value:n.allowConstNumericLiteral&&typeof o.value==`number`?String(o.value):null:n.allowConstTemplateLiteral&&T(o,`TemplateLiteral`)?zt(o):null},Vt=e=>{if(!w(e))return null;if(!T(e.body,`BlockStatement`))return e.body;if(e.body.body.length!==1)return null;let t=e.body.body[0];return T(t,`ReturnStatement`)&&t.argument?t.argument:null},Ht=new Set([`CatchClause`,`ConditionalExpression`,`DoWhileStatement`,`ForInStatement`,`ForOfStatement`,`ForStatement`,`IfStatement`,`LogicalExpression`,`SwitchCase`,`SwitchStatement`,`TryStatement`,`WhileStatement`]),Ut=(e,t)=>{let n=e.parent??null;for(;n&&n!==t;){if(Ht.has(n.type))return!1;n=n.parent??null}return n===t},Wt=e=>D(e)??Pt(e),Gt=e=>{let t=j(e),n=t.parent;return!!(n&&T(n,`VariableDeclarator`)&&n.init===t&&n.parent&&T(n.parent,`VariableDeclaration`)&&n.parent.kind===`const`)},Kt=e=>{let t=j(e),n=t.parent;return!!(n&&(T(n,`AssignmentExpression`)&&n.left===t||T(n,`UpdateExpression`)&&n.argument===t||T(n,`UnaryExpression`)&&n.operator===`delete`&&n.argument===t))},qt=e=>{let t=j(e),n=t.parent;return n&&T(n,`MemberExpression`)&&A(n.object)===t?n:null},Jt=(e,t,n,r,i)=>{if(i<=0||!T(e,`ObjectExpression`))return null;for(let a of e.properties.toReversed()){if(!T(a,`Property`))return null;let e=Bt(a,n);if(e===null)return null;if(e===t)return a.kind===`init`?F(a.value,n,r,i-1):null}return null},Yt=(e,t,n,r,i)=>{if(i<=0||!T(e,`ObjectExpression`))return[];let a=[],o=new Set;for(let s of e.properties){if(!T(s,`Property`))continue;let e=Bt(s,n),c=s.kind===`init`||s.kind===`get`?F(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},Xt=(e,t,n,r,i)=>{if(i<=0||!T(e,`ClassDeclaration`)&&!T(e,`ClassExpression`))return null;for(let a of e.body.body.toReversed()){if(!T(a,`MethodDefinition`)&&!T(a,`PropertyDefinition`)||!a.static)continue;let e=Bt(a,n);if(e===null)return null;if(e===t)return T(a,`MethodDefinition`)&&a.kind!==`method`?null:a.value?F(a.value,n,r,i-1):null}return null},Zt=(e,t,n,r,i)=>{if(i<=0||!T(e,`ClassDeclaration`)&&!T(e,`ClassExpression`))return[];let a=[],o=new Set;for(let s of e.body.body){if(!T(s,`MethodDefinition`)&&!T(s,`PropertyDefinition`)||!s.static)continue;let e=Bt(s,n),c=s.value&&(!T(s,`MethodDefinition`)||s.kind===`method`||s.kind===`get`)?F(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},Qt=(e,t,n,r,i,a,o,s)=>{let c=Wt(t);if(s<=0||!c||!T(e,`Identifier`))return{exactFunction:null,possibleFunctions:[]};let l=[];for(let r of Rt(e,a))for(let e of r.references){let r=e.identifier;if(r.range[0]>=t.range[0]||Gt(r))continue;let i=qt(r);if(!i){Wt(r)===c&&l.push({assignedExpression:null,isDefinite:!1,offset:r.range[0]});continue}if(!Kt(i)||Wt(i)!==c)continue;let o=Bt(i,a),s=j(i).parent,u=s&&T(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||!T(s,`AssignmentExpression`)||s.operator!==`=`||!Ut(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?F(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}},$t=(e,t,n,r)=>{if(r<=0||!T(e,`MemberExpression`))return{exactFunction:null,possibleFunctions:[]};let i=M(e);if(i===null)return{exactFunction:null,possibleFunctions:[]};let a=A(e.object);if(T(a,`ObjectExpression`))return{exactFunction:Jt(a,i,t,n,r),possibleFunctions:Yt(a,i,t,n,r)};if(T(a,`ClassExpression`))return{exactFunction:Xt(a,i,t,n,r),possibleFunctions:Zt(a,i,t,n,r)};if(!T(a,`Identifier`))return{exactFunction:null,possibleFunctions:[]};let o=N(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=A(o.initializer);s=Jt(e,i,t,n,r),c=Yt(e,i,t,n,r)}else o.kind===`class`&&o.initializer&&(s=Xt(o.initializer,i,t,n,r),c=Zt(o.initializer,i,t,n,r));return Qt(a,e,i,s,c,t,n,r)},en=(e,t,n,r)=>{if(r<=0)return[];let i=A(e);if(T(i,`CallExpression`)){let e=A(i.callee);return T(e,`MemberExpression`)&&M(e)===`bind`?en(e.object,t,n,r-1):[]}if(T(i,`MemberExpression`)){let e=M(i);return e===`call`||e===`apply`?en(i.object,t,n,r-1):$t(i,t,n,r).possibleFunctions}let a=F(i,t,n,r);return a?[a]:[]},F=(e,t,n,r)=>{let i=A(e);if(w(i))return i;if(r<=0)return null;if(T(i,`CallExpression`)){let e=A(i.callee);if(T(e,`MemberExpression`)&&M(e)===`bind`)return F(e.object,t,n,r-1);if(!i.arguments.every(e=>T(e,`Literal`)))return null;let a=F(e,t,n,r-1);if(!w(a)||a.async||a.generator||!a.params.every(e=>T(e,`Identifier`)))return null;let o=Vt(a),s=o&&A(o);return w(s)?s:null}if(T(i,`MemberExpression`)){let e=M(i);return e===`call`||e===`apply`?F(i.object,t,n,r-1):$t(i,t,n,r).exactFunction}if(!T(i,`Identifier`))return null;let a=N(i,t);return!a||n.has(a.id)?null:(n.add(a.id),a.kind===`function`?!a.references.some(e=>e.flag!==`read`)&&w(a.declarationNode)?a.declarationNode:null:a.kind!==`const`||!a.initializer?null:F(a.initializer,t,n,r-1))},tn=(e,t)=>F(e,t,new Set,15),nn=(e,t)=>en(e,t,new Set,15),rn=(e,t)=>{if(!T(e,`CallExpression`)||!T(e.callee,`MemberExpression`)||M(e.callee)!==`join`)return!1;let n=A(e.callee.object);for(let e=0;e<15;e++){if(T(n,`ArrayExpression`))return!0;if(T(n,`Identifier`)){let e=N(n,t);if(!e?.initializer||e.references.some(e=>e.flag!==`read`))return!1;n=A(e.initializer);continue}if(!T(n,`CallExpression`))return!1;let e=A(n.callee);if(T(e,`MemberExpression`)&&[`map`,`filter`,`slice`].includes(M(e)??``)){n=A(e.object);continue}let r=tn(e,t);return!!(w(r)&&!r.async&&T(r.returnType,`TSTypeAnnotation`)&&T(r.returnType.typeAnnotation,`TSArrayType`))}return!1},an=(e,t)=>{if(!T(e,`Program`))return null;let n=new Map,r=new Map,i=null,a=null,o=e=>{for(let t of e.declarations??[])T(t,`VariableDeclarator`)&&(!T(t.id,`Identifier`)||!t.init||n.set(t.id.name,A(t.init)))};for(let t of e.body??[]){if(T(t,`ImportDeclaration`)){if(t.importKind===`type`)continue;for(let e of t.specifiers??[])T(e,`ImportSpecifier`)&&e.importKind===`type`||(T(e,`ImportDefaultSpecifier`)||T(e,`ImportNamespaceSpecifier`)||T(e,`ImportSpecifier`))&&T(e.local,`Identifier`)&&n.set(e.local.name,e.local);continue}if(T(t,`VariableDeclaration`)){o(t);continue}if(T(t,`FunctionDeclaration`)&&t.id){n.set(t.id.name,t);continue}if(T(t,`ExportNamedDeclaration`)){if(t.exportKind===`type`)continue;let e=t.declaration;if(e&&T(e,`VariableDeclaration`)){o(e);for(let t of e.declarations??[])T(t,`VariableDeclarator`)&&T(t.id,`Identifier`)&&r.set(t.id.name,t.id.name)}else e&&T(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(!T(e,`ExportSpecifier`)||e.exportKind===`type`)continue;let t=T(e.local,`Identifier`)?e.local.name:null,n=null;T(e.exported,`Identifier`)?n=e.exported.name:T(e.exported,`Literal`)&&typeof e.exported.value==`string`&&(n=e.exported.value),t&&n&&r.set(n,t)}continue}if(!T(t,`ExportDefaultDeclaration`))continue;let e=t.declaration;e&&(T(e,`Identifier`)?a=e.name:((T(e,`FunctionDeclaration`)||T(e,`ClassDeclaration`))&&e.id&&n.set(e.id.name,e),i=A(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},on=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 in i){if(n===`parent`||!Object.hasOwn(i,n))continue;let r=i[n];if(Array.isArray(r))for(let n=0;n<r.length;n+=1){let i=r[n];C(i)&&t(i,e)}else C(r)&&t(r,e)}};t(e,null)},sn={".ts":`ts`,".tsx":`tsx`,".js":`js`,".jsx":`jsx`,".mjs":`js`,".cjs":`js`,".mts":`ts`,".cts":`ts`},cn=t=>sn[e.extname(t).toLowerCase()]??`tsx`;let ln=process.platform!==`win32`&&a();const un=(e,t)=>({astType:`ts`,lang:cn(e),experimentalRawTransfer:t}),dn=(e,t)=>{if(ln)try{return i(e,t,un(e,!0))}catch{ln=!1}return i(e,t,un(e,!1))},fn=({filename:e,sourceText:t,shouldAttachParentReferences:n=!0})=>{try{let r=dn(e,t);if(r.errors.some(e=>e.severity===`Error`))return null;let i=r.program;return n&&on(i),i}catch{return null}},pn=new Map,mn=(e,t)=>{if(pn.delete(e),pn.set(e,t),pn.size>256){let e=pn.keys().next().value;e!==void 0&&pn.delete(e)}},hn=e=>{e.endsWith(`.d.ts`)||e.endsWith(`.d.mts`)||e.endsWith(`.d.cts`)||S(e);let n;try{n=t.statSync(e,{throwIfNoEntry:!1})}catch{return null}if(!n?.isFile()||n.size>2e6)return null;let r=pn.get(e);if(r&&r.mtimeMs===n.mtimeMs&&r.size===n.size)return mn(e,r),r.program;if(e.endsWith(`.d.ts`)||e.endsWith(`.d.mts`)||e.endsWith(`.d.cts`))return mn(e,{mtimeMs:n.mtimeMs,size:n.size,program:null}),null;let i;try{i=t.readFileSync(e,`utf8`)}catch{return mn(e,{mtimeMs:n.mtimeMs,size:n.size,program:null}),null}let a=fn({filename:e,sourceText:i});return mn(e,{mtimeMs:n.mtimeMs,size:n.size,program:a}),a},gn=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`,`.cjs`,`.mts`,`.cts`],_n=[`import`,`default`,`module`,`browser`,`require`],vn=[`module`,`main`,`browser`],yn={isDirectory:!0,isFile:!1},bn={isDirectory:!1,isFile:!0},xn={isDirectory:!1,isFile:!1},Sn=new Map,Cn=new Map,wn=e=>{ge(e);let n=Sn.get(e);if(n)return n;let r=xn;try{let n=t.statSync(e,{throwIfNoEntry:!1});n?.isFile()?r=bn:n?.isDirectory()&&(r=yn)}catch{return Sn.set(e,xn),xn}return Sn.set(e,r),r},Tn=e=>wn(e).isFile?e:null,En=e=>wn(e).isDirectory?e:null,Dn=t=>{let n=e.extname(t);if(!gn.includes(n))return gn.map(e=>`${t}${e}`);let r=t.slice(0,-n.length);return n===`.js`?[t,`${r}.ts`,`${r}.tsx`,`${r}.jsx`]:n===`.jsx`?[t,`${r}.tsx`]:n===`.mjs`?[t,`${r}.mts`]:n===`.cjs`?[t,`${r}.cts`]:[t]},On=e=>typeof e==`object`&&!!e,kn=e=>{if(typeof e==`string`)return e;if(Array.isArray(e)){for(let t of e){let e=kn(t);if(e)return e}return null}if(!On(e))return null;for(let t of _n){let n=kn(e[t]);if(n)return n}return null},An=e=>{let t=e.exports;return t?kn(t)||(On(t)?kn(t[`.`]):null):null},jn=e=>{S(e);let n=Cn.get(e);if(n!==void 0)return n;let r;try{r=JSON.parse(t.readFileSync(e,`utf8`))}catch{r=null}return Cn.set(e,r),r},Mn=t=>Pn(t)||Pn(e.join(t,`index`)),Nn=t=>{let n=En(t);if(!n)return null;let r=jn(e.join(n,`package.json`));if(!r)return null;let i=An(r)??vn.map(e=>r[e]).find(e=>typeof e==`string`);return i?Mn(e.resolve(n,i)):null},Pn=e=>{let t=Tn(e);if(t)return t;for(let t of Dn(e)){let e=Tn(t);if(e)return e}return null},Fn=t=>Pn(t)||Nn(t)||Pn(e.join(t,`index`)),In=(t,n)=>Fn(e.resolve(e.dirname(t),n)),Ln=()=>{Sn.clear(),Cn.clear()},Rn=[`tsconfig.json`,`jsconfig.json`],zn=e=>typeof e==`object`&&!!e,Bn=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`)},Vn=(e,n)=>{S(e),n.push(e);let r;try{r=t.readFileSync(e,`utf8`)}catch{return null}try{let e=JSON.parse(Bn(r));return zn(e)?e:null}catch{return null}},Hn=(t,n)=>{let r=t.endsWith(`.json`)?t:`${t}.json`;return t.startsWith(`./`)||t.startsWith(`../`)?e.resolve(n,r):e.join(n,`node_modules`,r)},Un=e=>{let t=new Map;if(!zn(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},Wn=(t,n,r)=>{let i=Vn(t,r);if(!i)return null;let a=e.dirname(t),o=zn(i.compilerOptions)?i.compilerOptions:{},s=typeof o.baseUrl==`string`?o.baseUrl:null,c=s!==null,l=s===null?a:e.resolve(a,s);if(zn(o.paths))return{baseAbsolutePath:l,hasExplicitBaseUrl:c,paths:Un(o.paths)};if(typeof i.extends==`string`&&n<8){let e=Hn(i.extends,a),t=e?Wn(e,n+1,r):null;if(t)return t}return c?{baseAbsolutePath:l,hasExplicitBaseUrl:c,paths:new Map}:null},Gn=new Map,Kn=new Map,qn=e=>{S(e);let n;try{n=t.statSync(e,{throwIfNoEntry:!1})}catch{n=void 0}if(n===void 0)return{config:null,probedContentPaths:new Set([e])};let r=Gn.get(e);if(r&&r.mtimeMs===n.mtimeMs){for(let e of r.probedChainPaths)S(e);return{config:r.config,probedContentPaths:new Set(r.probedChainPaths)}}let i=[],a=Wn(e,0,i);return Gn.set(e,{mtimeMs:n.mtimeMs,config:a,probedChainPaths:i}),{config:a,probedContentPaths:new Set(i)}},Jn=(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);Kn.set(a.directory,{config:t.config,directoryCount:i,probedContentPaths:new Set(r)})}},Yn=t=>{let n=Kn.get(t);if(n!==void 0){for(let e of n.probedContentPaths)S(e);return n.config}let r=[],i=t;for(let t=0;t<30;t++){let n=Kn.get(i),a=30-t;if(n!==void 0&&n.directoryCount<=a){for(let e of n.probedContentPaths)S(e);return Jn(r,n,n.directoryCount),n.config}let o=new Set;for(let t of Rn){let n=qn(e.join(i,t));for(let e of n.probedContentPaths)o.add(e);if(n.config)return r.push({directory:i,probedContentPaths:o}),Jn(r,{config:n.config,probedContentPaths:new Set},0),n.config}r.push({directory:i,probedContentPaths:o});let s=e.dirname(i);if(s===i)return Jn(r,{config:null,probedContentPaths:new Set},0),null;i=s}let a=new Set;for(let e of r)for(let t of e.probedContentPaths)a.add(t);return Kn.set(t,{config:null,directoryCount:r.length,probedContentPaths:a}),null},Xn=(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},Zn=(t,n)=>{let r=Yn(e.dirname(t));if(!r)return null;let i=null,a=``,o=-1;for(let e of r.paths.keys()){let t=Xn(n,e);if(t===null)continue;let r=e.indexOf(`*`),s=r===-1?e.length:r;s>o&&(i=e,a=t,o=s)}if(i)for(let t of r.paths.get(i)??[]){let n=t.replaceAll(`*`,a),i=Fn(e.resolve(r.baseAbsolutePath,n));if(i)return i}return r.hasExplicitBaseUrl?Fn(e.resolve(r.baseAbsolutePath,n)):null},Qn=()=>{Gn.clear(),Kn.clear()},$n=(t,n)=>e.isAbsolute(n)?null:n.startsWith(`.`)?In(t,n):Zn(t,n),er=new Map,tr=()=>{er.clear()},nr=(e,t,n)=>{if(n.size>=4||n.has(e))return null;n.add(e);let r=hn(e);if(!r)return null;let i=an(r,t);if(i)return{filePath:e,exportedNode:i,programNode:r};let a=new Map;for(let i of St(r,t)){let t=$n(e,i.source);if(!t)continue;let r=nr(t,i.importedName,new Set(n));r&&a.set(r.exportedNode,r)}return a.size===1?a.values().next().value??null:null},rr=(e,t,n)=>ir(e,t,n)?.functionNode??null,ir=(e,t,n)=>{let r=I(e,t,n);return!r||!w(r.exportedNode)?null:{filePath:r.filePath,functionNode:r.exportedNode,programNode:r.programNode}},I=(e,t,n)=>{if(!_e()){let r=$n(e,t);return r?nr(r,n,new Set):null}let r=`${e}\0${t}\0${n}`,i=er.get(r);if(i!==void 0){for(let e of i.trace.contentPaths)S(e);for(let e of i.trace.existencePaths)ge(e);return i.result}let a=ve(()=>{let r=$n(e,t);return r?nr(r,n,new Set):null});return er.set(r,{result:a.value,trace:a.trace}),a.value},ar=(e,t)=>{let n=e,r=Le[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];C(n)&&t.push(n)}else C(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];C(n)&&t.push(n)}else C(a)&&t.push(a)}},or=(e,t)=>{let n=e,r=Le[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];C(n)&&t(n)}else C(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];C(n)&&t(n)}else C(r)&&t(r)}},L=(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||ar(e,n)}},sr=new WeakMap,cr=new Set([`TSStringKeyword`,`TSNumberKeyword`,`TSBooleanKeyword`]),lr=new Set([`String`,`Number`,`Boolean`]),ur=(e,t,n)=>{let r=[],i=15,a=(e,t,n,o,s,c)=>{let l=e=>{let r=N(A(e),o);return!r||r.references.some(e=>e.flag!==`read`)?null:t.has(r.bindingIdentifier)?t.get(r.bindingIdentifier)??null:n&&D(r.bindingIdentifier)===n?null:r.bindingIdentifier};L(e,e=>{if(w(e)||T(e,`ClassDeclaration`)||T(e,`ClassExpression`))return!1;if(c&&T(e,`AwaitExpression`)&&!T(A(e.argument),`CallExpression`)&&r.push({binding:e,member:null,inputs:[],crossFile:!0}),!T(e,`CallExpression`))return;let n=A(e.callee);if(e.optional||T(n,`MemberExpression`)&&n.optional)return c&&r.push({binding:e,member:null,inputs:[],crossFile:!0}),!1;let u=e.arguments.map(l),d=T(n,`MemberExpression`)?A(n.object):n,f=N(d,o),p=T(n,`Identifier`)&&(f?.kind===`function`||w(f?.initializer))?tn(n,o):null,m=o,h=s,g=c;if(f?.kind===`import`){let e=T(n,`MemberExpression`)?M(n):null,t=f.declarationNode,a=kt(f),o=null;if(T(t,`ImportNamespaceSpecifier`)?o=e:T(n,`Identifier`)&&(o=vt(t)),s&&i>0&&o&&a&&a.importKind!==`type`&&(!T(t,`ImportSpecifier`)||t.importKind!==`type`)){i--;let e=ir(s,a.source.value,o);e&&(p=e.functionNode,m=sr.get(e.programNode)??ft(e.programNode),sr.set(e.programNode,m),h=e.filePath,g=!0)}!p&&!c&&(T(n,`Identifier`)||e!==null)&&r.push({binding:f.bindingIdentifier,member:e,inputs:u})}else if(!c&&T(n,`MemberExpression`)&&M(n)===`get`&&f?.kind===`const`&&f.initializer){let e=A(f.initializer);if(T(e,`NewExpression`)&&T(e.callee,`Identifier`)&&(e.callee.name===`Map`||e.callee.name===`WeakMap`)&&o.isGlobalReference(e.callee)){let e=l(d);e&&r.push({binding:e,member:`get`,inputs:[u[0]??null]})}}if(g&&p){let t=jt(p),n=t?m.symbolFor(t):null;if(n&&(n.kind!==`const`&&n.kind!==`function`||n.references.some(e=>e.flag!==`read`)))return r.push({binding:e,member:null,inputs:[],crossFile:!0}),!1}if(g&&p&&Nt(p,m))return r.push({binding:p,member:null,inputs:u,crossFile:!0}),!1;if(!w(p)||i<=0){c&&(i<=0||f?.kind===`import`||Mt(e)||T(e.parent,`ReturnStatement`)&&!rn(e,o)&&!(T(n,`Identifier`)&&lr.has(n.name)&&o.isGlobalReference(n))||T(n,`Identifier`)&&n.name===`fetch`&&o.isGlobalReference(n))&&r.push({binding:e,member:null,inputs:[],crossFile:!0});return}if(c&&!p.async&&!Mt(e)&&(!T(e.parent,`ReturnStatement`)||T(p.returnType,`TSTypeAnnotation`)&&cr.has(p.returnType.typeAnnotation.type)))return;i--;let _=new Map(t);for(let[e,t]of p.params.entries()){let n=m.symbolFor(t);n&&_.set(n.bindingIdentifier,u[e]??null)}a(p.body,_,p,m,h,g)})};for(let r of Et(e)?.awaitedExpressions??[])a(r,new Map,null,t,n,!1);return r},dr=(e,t,n,r)=>{let i=ur(e,n,r);if(i.length===0)return!1;let a=ur(t,n,r),o=e=>i.some(t=>t.binding===e.binding&&t.member===e.member&&t.inputs.length>0&&t.inputs.length===e.inputs.length&&t.inputs.every((t,n)=>t!==null&&t===e.inputs[n]));return a.some(o)&&(!a.some(e=>e.crossFile)||a.every(o))},fr=`(?:tsx?|jsx?|mts|mjs)`,pr=RegExp(`/page\\.${fr}$`),mr=RegExp(`/(page|layout)\\.${fr}$`),hr=[`layout.tsx`,`layout.jsx`,`layout.ts`,`layout.js`,`layout.mts`,`layout.mjs`],gr=[`metadata`,`generateMetadata`],_r=/\/(?:(?:\((?:dashboard|admin|settings|account|internal|manage|console|portal|auth|onboarding|app|ee|protected)\))|(?:dashboard|admin|settings|account|internal|manage|console|portal))\//i,vr=new Set([`redirect`,`permanentRedirect`,`notFound`,`forbidden`,`unauthorized`]),yr=new Set([`revalidateTag`,`revalidatePath`,`expireTag`,`expirePath`,`unstable_expireTag`,`unstable_expirePath`]),br=/fonts\.googleapis\.com/,xr=/polyfill\.io|polyfill\.min\.js|cdn\.polyfill/,Sr=RegExp(`/route\\.${fr}$`),Cr=/\/(?:cron|jobs\/cron)(?:\/|$)/i,wr=new Set([`logout`,`log-out`,`signout`,`sign-out`,`unsubscribe`,`delete`,`remove`,`revoke`,`cancel`,`deactivate`]),Tr=RegExp(`/(error|global-error)\\.${fr}$`),Er=RegExp(`/global-error\\.${fr}$`),Dr=new Set([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`,`OPTIONS`,`HEAD`]),Or=/google-analytics\.com|googletagmanager\.com\/gtag/,kr=RegExp(`/(opengraph-image|twitter-image)\\d*\\.${fr}$`),Ar=new Set([`expo`,`expo-router`,`@expo/cli`,`@expo/metro-config`,`@expo/metro-runtime`]),jr=new Set([`react-native`,`react-native-tvos`,...Ar,`react-native-windows`,`react-native-macos`]),Mr=[`@react-native/`,`@react-native-`],Nr=e=>Ar.has(e),Pr=e=>{if(jr.has(e))return!0;for(let t of Mr)if(e.startsWith(t))return!0;return!1},Fr=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`]),Ir=[`dependencies`,`devDependencies`,`peerDependencies`,`optionalDependencies`],Lr=function*(e){for(let t of Ir){let n=e[t];if(n)for(let e of Object.keys(n))yield e}},Rr=e=>{if(typeof e[`react-native`]==`string`)return!0;for(let t of Lr(e))if(Pr(t))return!0;return!1},zr=e=>{for(let t of Lr(e))if(Nr(t))return!0;return!1},Br=e=>{for(let t of Lr(e))if(Fr.has(t))return!0;return!1},Vr=e=>Ir.some(t=>{let n=e[t];return typeof n==`object`&&!!n&&Object.keys(n).length>0}),Hr=(e,t)=>Ir.some(n=>{let r=e[n];return typeof r==`object`&&!!r&&Object.prototype.propertyIsEnumerable.call(r,t)}),Ur=new WeakMap,Wr=e=>{let t=De(e);if(!t)return`unknown`;let n=Ur.get(t);if(n!==void 0)return n;let r;return r=zr(t)?`expo`:Rr(t)?`react-native`:Br(t)?`web`:Vr(t)?`neutral`:`unknown`,Ur.set(t,r),r},Gr=({absoluteFilePath:e,staticImports:t,program:n})=>{let r=new Set;if(L(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&&rr(e,n.moduleRequest.value,a)}},Kr=e=>e.replace(/^type\s+/,``).trim(),qr=(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=Kr(r??``);return{localName:a,exportedName:Kr(i??a),isTypeOnly:n}}),Jr=/\/\*[\s\S]*?\*\//g,Yr=/^\s*\/\/.*$/gm,Xr=e=>e.replace(Jr,``).replace(Yr,``),Zr=/^\s*export\s+default\b/m,Qr=/^\s*export\s+(?:declare\s+)?(?:(?:async\s+)?function|(?:abstract\s+)?class|const|let|var|enum|interface|type)\s+([\w$]+)/gm,$r=/^\s*export\s+(?:type\s+)?\{([\s\S]*?)\}(?:\s+from\s+["'][^"']+["'])?\s*;?\s*(?:(?:\/\/[^\n]*)?\s*)/gm,ei=e=>{let t=Xr(e),n=new Set;Zr.test(t)&&n.add(`default`);for(let e of t.matchAll(Qr))e[1]&&n.add(e[1]);for(let e of t.matchAll($r)){let t=e[1]??``;for(let e of qr(t,!1))n.add(e.exportedName)}return n},ti=new Map,ni=(e,n)=>{S(e);try{let r=t.statSync(e,{throwIfNoEntry:!1});if(r===void 0)return!1;let i=ti.get(e);if(i&&i.mtimeMs===r.mtimeMs&&i.size===r.size)return i.exportedNames.has(n);let a=ei(t.readFileSync(e,`utf8`));return ti.set(e,{mtimeMs:r.mtimeMs,size:r.size,exportedNames:a}),a.has(n)}catch{return!1}},ri=(t,n)=>{let r=t.replaceAll(`\\`,`/`),i=e.dirname(r);for(let t=0;t<30;t++){for(let t of hr){let a=e.join(i,t);if(a.replaceAll(`\\`,`/`)!==r&&n(a))return!0}let t=e.dirname(i);if(e.basename(i)===`app`&&e.basename(t)!==`app`||t===i)break;i=t}return!1},ii=e=>ri(e,e=>gr.some(t=>ni(e,t))),R=e=>{if(!T(e,`ImportSpecifier`))return;let t=e.imported;if(T(t,`Identifier`))return t.name;if(T(t,`Literal`)&&typeof t.value==`string`)return t.value},ai=e=>T(e,`JSXIdentifier`)?e.name===`Suspense`:T(e,`JSXMemberExpression`)&&T(e.property,`JSXIdentifier`)&&e.property.name===`Suspense`,oi=e=>{let t=!1;return L(e,e=>{if(t)return!1;if(T(e,`JSXOpeningElement`)&&ai(e.name)||T(e,`ImportDeclaration`)&&e.source?.value===`react`&&(e.specifiers??[]).some(e=>T(e,`ImportSpecifier`)&&R(e)===`Suspense`))return t=!0,!1}),t},si=e=>ri(e,e=>{let t=hn(e);return!!(t&&oi(t))}),ci=e=>{if(T(e,`ImportDeclaration`)){if(e.importKind===`type`||e.specifiers.length>0&&e.specifiers.every(e=>T(e,`ImportSpecifier`)&&e.importKind===`type`))return null}else if(T(e,`ExportNamedDeclaration`)){if(e.exportKind===`type`||!e.source||e.specifiers.length>0&&e.specifiers.every(e=>T(e,`ExportSpecifier`)&&e.exportKind===`type`))return null}else if(T(e,`ExportAllDeclaration`)){if(e.exportKind===`type`)return null}else return null;return e.source&&typeof e.source.value==`string`?e.source.value:null},li=/^index\.(?:[cm]?[jt]sx?|mjs)$/,ui=/^\s*import\s+(type\s+)?(?!["'])([^;]*?)\s+from\s+["']([^"']+)["']\s*;?\s*(?:(?:\/\/[^\n]*)?\s*)/gm,di=/^\s*export\s+(type\s+)?(?:\*(?:\s+as\s+([\w$]+))?|\{([\s\S]*?)\})\s+from\s+["']([^"']+)["']\s*;?\s*(?:(?:\/\/[^\n]*)?\s*)/gm,fi=/^\s*export\s+(type\s+)?\{([\s\S]*?)\}\s*;?\s*(?:(?:\/\/[^\n]*)?\s*)/gm,pi=new Map,mi=t=>li.test(e.basename(t)),hi=()=>({isBarrel:!1,exportsByName:new Map,starExportSources:[]}),gi=(e,t)=>{e.set(t.localName,{...t,didExport:!1})},_i=(e,t,n,r)=>{for(let i of qr(e,n))gi(r,{localName:i.exportedName,importedName:i.localName,source:t,isTypeOnly:i.isTypeOnly})},vi=(e,t,n,r)=>{let i=e.trim(),a=i.match(/(?:^|,\s*)\*\s+as\s+([\w$]+)/);a?.[1]&&gi(r,{localName:a[1],importedName:`*`,source:t,isTypeOnly:n});let o=i.match(/\{([\s\S]*?)\}/);o?.[1]&&_i(o[1],t,n,r);let s=i.split(`,`)[0]?.trim();s&&!s.startsWith(`{`)&&!s.startsWith(`*`)&&gi(r,{localName:s,importedName:`default`,source:t,isTypeOnly:n})},yi=(e,t,n,r)=>{let i=e.replace(ui,(e,n,r,i)=>(vi(r,i,!!n,t),``));return i=i.replace(di,(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 qr(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(fi,(e,r,i)=>{for(let a of qr(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},bi=e=>{for(let t of e.values())if(!t.isTypeOnly&&!t.didExport)return!0;return!1},xi=e=>{let t=Xr(e).trim();if(!t)return hi();let n=new Map,r=new Map,i=[];return yi(t,n,r,i).trim()||bi(n)?hi():{isBarrel:r.size>0||i.length>0,exportsByName:r,starExportSources:i}},Si=e=>{if(!mi(e))return hi();S(e);let n;try{n=t.statSync(e,{throwIfNoEntry:!1})??null}catch{n=null}let r=pi.get(e);if(r!==void 0&&n!==null&&r.mtimeMs===n.mtimeMs&&r.size===n.size)return r.moduleInfo;if(n===null)return hi();let i=hi();try{i=xi(t.readFileSync(e,`utf8`))}catch{i=hi()}return pi.set(e,{mtimeMs:n.mtimeMs,size:n.size,moduleInfo:i}),i},Ci=e=>Si(e).isBarrel,wi=e.join(`android`,`gradle.properties`),Ti=/^\s*newArchEnabled\s*=\s*false\s*$/m,Ei=[`app.config.ts`,`app.config.js`,`app.config.cjs`,`app.config.mjs`],Di=[`app.config.json`,`app.json`],Oi=new WeakMap,ki=t=>{S(e.join(t,wi));for(let n of Ei)ge(e.join(t,n));for(let n of Di)S(e.join(t,n))},Ai=e=>{try{return t.readFileSync(e,`utf-8`)}catch{return null}},ji=e=>{let t=e.dependencies?.[`react-native`]??e.devDependencies?.[`react-native`];return typeof t==`string`?t:null},Mi=e=>{let t=e.match(/(?:^|[^\d.])0\.(\d+)/);return t?Number.parseInt(t[1],10):null},Ni=t=>{let n=Ai(e.join(t,wi));return n!==null&&Ti.test(n)},Pi=n=>{for(let r of Ei)if(t.existsSync(e.join(n,r)))return!1;for(let t of Di){let r=Ai(e.join(n,t));if(r===null)continue;let i;try{i=JSON.parse(r)}catch{continue}if(typeof i!=`object`||!i)continue;let a=Object.getOwnPropertyDescriptor(i,`expo`)?.value;if(!(typeof a!=`object`||!a)&&Object.getOwnPropertyDescriptor(a,`newArchEnabled`)?.value===!1)return!0}return!1},Fi=(e,t)=>{let n=ji(t);if(n!==null){let e=Mi(n);if(e!==null&&e<76)return!0}return Ni(e)||Pi(e)},Ii=e=>{let t=Ee(e);if(!t)return!1;let n=De(e);if(!n)return!1;ki(t);let r=Oi.get(n);if(r!==void 0)return r;let i=Fi(t,n);return Oi.set(n,i),i},Li=e=>Fe(e,`ink`)?.version??null,Ri=(e,t)=>{let n=Li(e),r=me(t);return!!(n&&r&&he(n,r)>=0)},zi=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`]),Bi=new Set([`fetch`,`ky`,`got`,`wretch`,`ofetch`]),Vi=new Set([`axios`,`ky`,`got`,`ofetch`,`wretch`,`request`]),Hi=new Set([`create`,`insert`,`insertInto`,`update`,`upsert`,`delete`,`remove`,`destroy`,`set`,`append`]),Ui=new Set([`POST`,`PUT`,`DELETE`,`PATCH`]),Wi=new Set([`Map`,`Set`,`WeakMap`,`WeakSet`,`Headers`,`URLSearchParams`,`FormData`,`Response`,`NextResponse`]),Gi=new Set([`Response`,`NextResponse`]),Ki=new Set([`json`,`redirect`,`next`,`rewrite`,`error`]),qi=new Set([`wheel`,`mousewheel`,`touchstart`,`touchmove`]),Ji=new Set([`defer`,`async`]),Yi=new Set([`text/javascript`,`application/javascript`,`module`]),Xi=new Set([`setTimeout`,`setInterval`,`requestAnimationFrame`,`requestIdleCallback`,`queueMicrotask`]),Zi=new Set([`setInterval`,`setTimeout`]),Qi=new Set([`clearInterval`,`clearTimeout`]),$i=new Set([`WebSocket`,`EventSource`,`BroadcastChannel`,`RTCPeerConnection`]),ea=new Set([`location`,`window`,`document`,`navigator`,`history`,`screen`,`performance`]),ta=new Set([`IntersectionObserver`,`MutationObserver`,`ResizeObserver`,`PerformanceObserver`]),na=new Set([`blur`,`canPlayType`,`focus`,`getBoundingClientRect`,`getClientRects`,`measure`,`measureInWindow`,`measureLayout`,`scroll`,`scrollBy`,`scrollIntoView`,`scrollTo`,`select`,`setRangeText`,`setSelectionRange`]),ra=new Set([`localStorage`,`sessionStorage`]),ia=new Set([`index`,`idx`,`i`]),aa=new Set([`react`,`react-dom`,`preact/compat`,`preact/hooks`,`@wordpress/element`]),oa=new Set([`next`,`next-themes`,`@remix-run/react`,`swr`,`zustand`,`jotai`,`recoil`,`wouter`,`framer-motion`,`@apollo/client`,`urql`,`usehooks-ts`]),sa=new Set([`useState`,`useMemo`,`useRef`]),ca=new Set([`Click`,`Change`,`Input`,`Blur`,`Focus`]),la=new Set([`Boolean`,`String`,`Number`,`Array`,`Object`,`parseInt`,`parseFloat`]),ua=/^set[A-Z]/,da=/^render[A-Z]/,fa=/^[A-Z]/,pa=/^on[A-Z]/,ma=/^use[A-Z]/,ha=/^(?:on|handle)[A-Z]/,ga=new Set([`useEffect`,`useLayoutEffect`]),_a=new Set([`useEffect`,`useLayoutEffect`,`useMemo`,`useCallback`]),va=new Set([`use`,`useState`,`useRef`,`useMemo`,`useCallback`,`useReducer`,`useContext`,`useEffect`,`useLayoutEffect`,`useInsertionEffect`,`useImperativeHandle`,`useSyncExternalStore`,`useDeferredValue`,`useTransition`,`useId`,`useDebugValue`]),ya=new Set([`memo`,`forwardRef`,`React.memo`,`React.forwardRef`]),ba=new Set([`useMemo`,`useCallback`]),xa=new Set([`memo`,`forwardRef`,`observer`,`lazy`]),Sa=new Set([`subscribe`,`addEventListener`,`addListener`,`on`,`watch`,`listen`,`sub`]),Ca=new Set([`subscribe`,`sub`,`listen`]),wa=new Set([`unsubscribe`,`removeEventListener`,`removeListener`,`off`,`unwatch`,`unlisten`,`unsub`,`abort`,`disconnect`,`unobserve`,`close`]),Ta=new Set([`remove`,`cleanup`,`dispose`,`destroy`,`stop`,`teardown`]),Ea=new Set([...wa,`cleanup`,`dispose`,`destroy`,`teardown`]),Da=new Set([...Sa,`connect`,`disconnect`,`open`,`close`,`fetch`,`post`,`put`,`patch`]),Oa=new Set([`get`,`head`,`options`,`delete`]),ka=new Set([...Bi,...Xi]),Aa=new Set([...Bi,`post`,`put`,`patch`,`navigate`,`navigateTo`,`showNotification`,`toast`,`alert`,`confirm`,`logVisit`,`captureEvent`]),ja=new Set([`post`,`put`,`patch`,`delete`,`navigate`,`capture`,`track`,`logEvent`]),Ma=new Set([`push`,`replace`]),Na=new Set([`router`,`navigation`,`navigator`,`history`,`location`]),Pa={},Fa=new WeakMap,Ia=(e,t)=>typeof e==`string`?e===t:e.has(t),La=e=>{let t=Fa.get(e);if(t)return t;let n=e.declarationNode.parent,r=!!(e.kind===`import`&&n&&n.type===`ImportDeclaration`&&typeof n.source.value==`string`&&aa.has(n.source.value)),i={importedName:r?R(e.declarationNode):void 0,isReactImport:r};return Fa.set(e,i),i},Ra=e=>La(e).isReactImport,za=(e,t,n,r)=>{if(e.type!==`Identifier`)return!1;let i=r?N(e,n):n.symbolFor(e);if(!i)return!1;let a=La(i);return!!(a.isReactImport&&a.importedName&&Ia(t,a.importedName))},Ba=(e,t)=>{let n=N(e,t);if(!n)return!1;let r=La(n);return r.isReactImport?n.declarationNode.type===`ImportDefaultSpecifier`||n.declarationNode.type===`ImportNamespaceSpecifier`||r.importedName===`default`:!1},Va=(e,t,n)=>e.type===`Identifier`?Ba(e,t)?!0:!!(n.allowGlobalReactNamespace&&e.name===`React`&&t.isGlobalReference(e)):!1,Ha=(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=P(e);return!!(a&&Ia(t,a)&&Va(A(i.initializer),n,r))}return!1},Ua=(e,t,n,r=Pa)=>e.type===`CallExpression`?Wa(e.callee,t,n,r):!1,Wa=(e,t,n,r,i)=>{let a=A(e);if(r.resolveConditionalAliases&&a.type===`ConditionalExpression`)return Wa(a.consequent,t,n,r,new Set(i))&&Wa(a.alternate,t,n,r,new Set(i));if(a.type===`Identifier`){if(za(a,t,n,!!r.resolveNamedAliases)||r.resolveNamedAliases&&Ha(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),Wa(e.initializer,t,n,r,a)}}return!!(r.allowUnboundBareCalls&&Ia(t,a.name)&&n.isGlobalReference(a))}return a.type!==`MemberExpression`||!Ia(t,M(a)??``)?!1:Va(A(a.object),n,r)},z=e=>e.includes(`\\`)?e.replaceAll(`\\`,`/`):e,Ga=e=>{let t=new Set(e);if(t.size!==1)return null;let[n]=t;return n??null},Ka=(e,t,n,r)=>{let i=In(e,n);return i?qa(i,t,new Set(r))||(ni(i,t)?i:null):null},qa=(e,t,n=new Set)=>{if(n.has(e))return null;n.add(e);let r=Si(e);if(!r.isBarrel)return null;let i=r.exportsByName.get(t);if(i){let t=In(e,i.source);return t?qa(t,i.importedName,n)??t:null}return t===`default`?null:Ga(r.starExportSources.map(r=>Ka(e,t,r,n)).filter(e=>!!e))},Ja=(e,t,n)=>{let r=I(e,t,n);return r?{filePath:r.filePath,node:r.exportedNode,programNode:r.programNode,kind:w(r.exportedNode)?`function`:`initializer`}:null},Ya=(e,t)=>{if(!T(e,`ArrowFunctionExpression`)&&!T(e,`FunctionExpression`)&&!T(e,`FunctionDeclaration`))return null;let n=e.params[0],r=T(n,`AssignmentPattern`)?n.left:n;if(T(r,`ObjectPattern`)){let e=r.properties.find(e=>T(e,`Property`)&&P(e,{allowComputedString:!0})===`children`);if(!e||!T(e,`Property`))return null;let n=T(e.value,`AssignmentPattern`)?e.value.left:e.value;if(!T(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(!T(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=j(e.identifier);for(;n.parent&&T(n.parent,`MemberExpression`)&&n.parent.object===n;){let e=M(n.parent);if(!e)return null;t.push(e),n=j(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},Xa=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},Za=new WeakMap,Qa=e=>{let t=Pt(e);if(!t)return null;let n=Za.get(t);return n||(n=Xa(t),Za.set(t,n)),n},$a=(e,t)=>{let n=Qa(e);if(!n)return!1;for(let e of n.values())if(t.includes(e.source))return!0;return!1},eo=(e,t,n)=>{let r=Qa(e);if(!r)return!1;let i=r.get(t);return i?i.source===n:!1},to=(e,t,n)=>{let r=Qa(e);if(!r)return!1;let i=r.get(t);return i?i.isNamespace&&i.source===n:!1},no=(e,t,n)=>{let r=Qa(e);if(!r)return!1;let i=r.get(t);return i?i.isDefault&&i.source===n:!1},ro=(e,t,n)=>{let r=Qa(e);if(!r)return null;let i=r.get(t);return!i||i.source!==n?null:i.imported},io=(e,t)=>{let n=Qa(e);return n?n.get(t)?.source??null:null},ao=(e,t)=>{let n=Qa(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},oo=(e,t)=>{let n=e.parent;for(;n;){if(`typeParameters`in n){let e=n.typeParameters;if(e&&T(e,`TSTypeParameterDeclaration`)&&e.params.some(e=>T(e,`TSTypeParameter`)&&T(e.name,`Identifier`)&&e.name.name===t))return!0}n=n.parent}return!1},so=e=>{if(!T(e,`Identifier`)||oo(e,e.name))return!1;let t=ao(e,e.name);return!!(t&&t.source===`react`&&(t.isNamespace||t.exportedName===`default`))},co=e=>{let t=Pt(e);return!t||!T(t,`Program`)?!1:t.body.some(e=>T(e,`TSModuleDeclaration`)&&T(e.id,`Identifier`)&&e.id.name===`JSX`)},lo=(e,t)=>{if(!T(e,`TSTypeReference`))return!1;let n=e.typeName;if(T(n,`Identifier`)){if(oo(n,n.name))return!1;let e=ro(n,n.name,`react`);return e===`ReactElement`||t&&e===`ReactNode`}if(!T(n,`TSQualifiedName`)||!T(n.right,`Identifier`))return!1;if((n.right.name===`ReactElement`||t&&n.right.name===`ReactNode`)&&so(n.left))return!0;if(n.right.name!==`Element`)return!1;if(T(n.left,`Identifier`)){if(n.left.name!==`JSX`)return!1;let e=ao(n.left,n.left.name);return e?e.source===`react`&&e.exportedName===`JSX`:!co(n.left)}return T(n.left,`TSQualifiedName`)&&T(n.left.right,`Identifier`)&&n.left.right.name===`JSX`&&so(n.left.left)},uo=(e,t)=>T(e,`TSUnionType`)?t?e.types.every(e=>T(e,`TSNullKeyword`)||T(e,`TSUndefinedKeyword`)||uo(e,t)):e.types.some(e=>uo(e,t)):lo(e,t),fo=(e,t=!1)=>{let n=Reflect.get(e,`returnType`);return T(n,`TSTypeAnnotation`)?uo(n.typeAnnotation,t):!1},po=e=>{let t=e,n=t.parent;for(;n&&A(n)===e;)t=n,n=t.parent;return n&&T(n,`AssignmentExpression`)&&n.operator===`=`&&n.left===t?n.right:null},mo=e=>{let t=e.range?.[0];return typeof t==`number`?t:null},ho=new Set([`let`,`var`]),go=new Set([`ConditionalExpression`,`LogicalExpression`]),_o=new WeakMap,vo=(e,t,n)=>{let r=e.parent??null;for(;r&&n.blockOf(r)===t;){if(go.has(r.type))return!0;r=r.parent??null}return!1},yo=(e,t)=>e.size===t.size&&[...e].every(e=>t.has(e)),bo=(e,t)=>{let n=new Set(e);for(let e of t)e.isConditionalWithinBlock||(n=new Set),n.add(e);return n},xo=(e,t,n)=>{let r=D(t);if(D(e.bindingIdentifier)!==r||!r)return[];let i=n.cfgFor(r);if(!i)return[];let a=i.blockOf(t);if(!a)return[];let o=mo(t),s=mo(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:vo(t,r,i)}),c.set(r,a)};e.initializer&&l(e.initializer,e.bindingIdentifier,s);for(let t of e.references){let e=mo(t.identifier);if(t.flag===`read`||D(t.identifier)!==r||e===null||e>=o)continue;let n=po(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=bo(t,c.get(e)??[]),r=u.get(e)??new Set,i=d.get(e)??new Set;(!yo(t,r)||!yo(n,i))&&(u.set(e,t),d.set(e,n),m=!0)}}let h=(c.get(a)??[]).filter(e=>e.position<o);return[...bo(u.get(a)??new Set,h)].map(e=>e.expression)},So=(e,t,n)=>{if(!ho.has(e.kind))return e.initializer?[e.initializer]:[];if(!n)return[];let r=_o.get(n);r||(r=new WeakMap,_o.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=xo(e,t,n);return i.set(t,o),o},Co=e=>{if(!w(e)||!T(e.body,`BlockStatement`))return[];let t=[];return L(e.body,n=>{if(n!==e.body&&(w(n)||T(n,`ClassDeclaration`)||T(n,`ClassExpression`)))return!1;T(n,`ReturnStatement`)&&t.push(n)}),t},B=e=>{if(T(e,`ReturnStatement`)||T(e,`ThrowStatement`))return!0;if(T(e,`IfStatement`)){if(T(e.test,`Literal`)){let t=e.test.value?e.consequent:e.alternate;return t?B(t):!1}return!!(e.alternate&&B(e.consequent)&&B(e.alternate))}if(T(e,`TryStatement`))return e.finalizer&&B(e.finalizer)?!0:B(e.block)?e.handler?B(e.handler.body):!0:!1;if(T(e,`DoWhileStatement`))return B(e.body);if(T(e,`WhileStatement`)){let t=e.test;return!!(T(t,`Literal`)&&t.value&&B(e.body))}if(T(e,`ForStatement`)){let t=e.test;return!!((!t||T(t,`Literal`)&&t.value)&&B(e.body))}return T(e,`BlockStatement`)?e.body.some(e=>B(e)):!1},wo=new Set([`let`,`var`]),To=e=>!w(e)||!e.body?[]:T(e.body,`BlockStatement`)?Co(e).flatMap(e=>e.argument?[e.argument]:[]):[e.body],Eo=e=>{if(!w(e)||!T(e.body,`BlockStatement`))return!1;let t=!1;return L(e.body,n=>{if(t||n!==e.body&&w(n))return!1;T(n,`ReturnStatement`)&&!n.argument&&(t=!0)}),t},Do=(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=To(e);return r===`every`&&w(e)&&T(e.body,`BlockStatement`)&&(!B(e.body)||Eo(e))?!1:t.length>0&&(r===`every`?t.every(o):t.some(o))}finally{a.delete(e)}};o=a=>{let l=A(a);if(i.has(l))return!1;i.add(l);try{if(t(l))return!0;if(T(l,`Identifier`)){let t=e.symbolFor(l);if(!t||t.kind!==`const`&&!wo.has(t.kind))return!1;let i=So(t,l,n),a=e=>{let t=A(e);return!w(t)&&o(t)};return r===`every`?i.length>0&&i.every(a):i.some(a)}if(T(l,`CallExpression`)){if(l.arguments.length!==0||!T(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?A(t.initializer):null,r=null;return w(n)?r=n:w(t.declarationNode)&&(r=t.declarationNode),!r||r.async||r.generator||r.params.length!==0?!1:s(r)}return T(l,`ConditionalExpression`)?c(l.consequent,l.alternate):T(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}},Oo=(e,t,n,r,i=`some`)=>Do(t,n,r,i).functionMatches(e),ko=(e,t,n,r,i)=>{let a=i.cfgFor(e),o=a?.blockOf(t);if(!a||!o)return!1;let s=new Set(Co(e).flatMap(e=>{if(!e.argument||!Do(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},Ao=e=>T(e,`Program`)?e.range[1]:e.range[0],jo=new WeakMap,Mo=(e,t)=>{let n=A(e);return T(n,`Identifier`)?t.symbolFor(n):null},No=(e,t)=>{let n=j(e),r=n.parent;return!r||!T(r,`AssignmentExpression`)||r.operator!==`=`||r.left!==n?null:Mo(r.right,t)},Po=e=>{let t=j(e),n=t.parent;return n&&T(n,`VariableDeclarator`)&&n.init===t&&(T(n.id,`Identifier`)||T(n.id,`ObjectPattern`))?!0:!!(n&&T(n,`AssignmentExpression`)&&n.operator===`=`&&n.right===t&&T(A(n.left),`Identifier`))},Fo=(e,t,n)=>{if(e.initializer&&T(e.declarationNode,`VariableDeclarator`)&&e.declarationNode.id===e.bindingIdentifier){let r=Mo(e.initializer,n);if(r&&t.has(r.id))return!0}return e.references.some(e=>{let r=No(e.identifier,n);return!!(r&&t.has(r.id))})},Io=(e,t)=>{let n=N(e,t);if(!n)return[];let r=jo.get(t);r||(r=new Map,jo.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)||Fo(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},Lo=e=>{let t=e;for(;t;){if(w(t)||T(t,`Program`))return t;t=t.parent??null}return null},Ro=new WeakMap,zo=(e,t)=>{let n=Ro.get(t);if(!n){let r=new Map,i=new Map,a=Pt(e);a&&L(a,e=>{if(!T(e,`CallExpression`))return;let n=A(e.callee),a=T(n,`Identifier`)?t.symbolFor(n):null,o=a?i.get(a.id):void 0;o===void 0&&(o=nn(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,Ro.set(t,n)}return n.get(e)??[]},Bo=new WeakMap,Vo=(e,t)=>{let n=Bo.get(t);if(n===void 0){let e=null;L(t,n=>{T(n,`AwaitExpression`)&&D(n)===t&&(e===null||n.range[0]<e)&&(e=n.range[0])}),n=e,Bo.set(t,n)}return n===null||e.range[0]<n},Ho=(e,t,n,r=new Set,i=null,a)=>{if(r.has(e)||!w(e)||e.generator||i!==null&&!Ut(i,e)||i!==null&&a!==void 0&&!a(i)||i!==null&&e.async&&!Vo(i,e))return[];r.add(e);let o=Lo(t);return o?zo(e,n).flatMap(e=>{let s=Lo(e);return!s||i!==null&&!Ut(e,s)||i!==null&&a!==void 0&&!a(e)?[]:s===o?e.range[0]<Ao(t)?[[e.range[0]]]:[]:w(s)?Ho(s,t,n,new Set(r),i===null?null:e,a).map(t=>[...t,e.range[0]]):[]}):[]},Uo=(e,t,n,r=new Set,i=null)=>Ho(e,t,n,r,i).length>0,Wo=e=>{let t=e.parent;return t?T(t,`AssignmentExpression`)?t.left===e:(T(t,`UpdateExpression`)||T(t,`UnaryExpression`)&&t.operator===`delete`)&&t.argument===e:!1},Go=e=>{let t=e.parent;for(;t&&A(t)===e;)t=t.parent;return!t||!T(t,`MemberExpression`)||A(t.object)!==e||!Wo(t)?null:t},Ko=(e,t,n)=>{let r=Go(e);return r&&Bt(r,n)===t?r:null},qo=(e,t,n,r)=>e.references.some(e=>{let i=Ko(e.identifier,t,r);if(!i)return!1;let a=Lo(i),o=Lo(n);return!a||!o||!Ut(i,a)?!1:a===o?i.range[0]<Ao(n):w(a)&&Uo(a,n,r)}),Jo=e=>{if(Po(e))return!0;let t=j(e),n=t.parent;return!!(n&&T(n,`MemberExpression`)&&A(n.object)===t)},Yo=e=>{if(Po(e))return!0;let t=j(e),n=t.parent;if(!n||!T(n,`MemberExpression`)||A(n.object)!==t)return!1;let r=j(n),i=r.parent;return!(i&&T(i,`CallExpression`)&&i.callee===r)},Xo=(e,t,n)=>T(e,`Identifier`)?Io(e,n).some(e=>e.references.some(e=>{let r=Go(e.identifier);if(!r)return!1;let i=Bt(r,n);return i===null||i===t})):!1,Zo=(e,t,n)=>{let r=Lo(e),i=Lo(t);return!r||!i?!0:r===i?e.range[0]<Ao(t):w(r)?Uo(r,t,n):!0},Qo=(e,t,n,r)=>T(e,`Identifier`)?Io(e,r).some(e=>e.references.some(e=>{let i=Go(e.identifier);if(!i||!Zo(i,n,r))return!1;let a=Bt(i,r);return a===null||a===t})):!1,$o=(e,t,n)=>T(e,`Identifier`)?Xo(e,t,n)?!0:Io(e,n).some(e=>e.references.some(e=>!Jo(e.identifier))):!1,es=(e,t,n,r)=>T(e,`Identifier`)?Qo(e,t,n,r)?!0:Io(e,r).some(e=>e.references.some(e=>!Yo(e.identifier)&&Zo(e.identifier,n,r))):!1,ts=(e,t)=>{let n=A(e);if(!T(n,`CallExpression`))return!1;let r=A(n.callee);if(!T(r,`MemberExpression`))return!1;let i=M(r);if(i===null)return!1;let a=A(r.object);return T(a,`Identifier`)&&Xo(a,i,t)},ns=(e,t,n,r)=>T(e,`Identifier`)?Rt(e,r).some(e=>qo(e,t,n,r)):!1,rs=(e,t,n,r={})=>{let i=D(e);return i===D(t)?e.range[0]>=Ao(t)||r.requireSynchronousWrite&&(!i||!Ut(e,i)||r.isSynchronousNode!==void 0&&!r.isSynchronousNode(e))?[]:[[e.range[0]]]:i?r.requireSynchronousWrite?Ho(i,t,n,new Set,e,r.isSynchronousNode).map(t=>[...t,e.range[0]]):Ho(i,t,n).map(t=>[...t,e.range[0]]):r.requireSynchronousWrite?[]:[[-1/0,e.range[0]]]},is=(e,t,n,r={})=>rs(e,t,n,r).length>0,V=(e,t,n,r={})=>e.references.some(e=>e.flag===`read`?!1:is(e.identifier,t,n,r)),as=(e,t)=>{if(!T(e,`CallExpression`))return!1;let n=A(e.callee);if(T(n,`Identifier`)){let e=t.symbolFor(n);return!!(e&&!V(e,n,t))}if(!T(n,`MemberExpression`))return!1;let r=M(n),i=A(n.object);return!!(r&&T(i,`Identifier`)&&!ns(i,r,n,t))},os=new Set([`FunctionDeclaration`,`FunctionExpression`,`ArrowFunctionExpression`,`ClassDeclaration`,`ClassExpression`]),ss={allowGlobalReactNamespace:!1,allowUnboundBareCalls:!1},cs=new Set([`lodash/sortBy`,`lodash/sortBy.js`,`lodash-es/sortBy`,`lodash-es/sortBy.js`]),ls=e=>T(e,`TSArrayType`)||T(e,`TSTupleType`)?!0:T(e,`TSTypeReference`)?T(e.typeName,`Identifier`)&&(e.typeName.name===`Array`||e.typeName.name===`ReadonlyArray`):!1,us=e=>{if(!T(e,`Identifier`))return!1;let t=e.typeAnnotation;return!!(t&&T(t,`TSTypeAnnotation`)&&ls(t.typeAnnotation))},ds=(e,t)=>{if(!T(e,`CallExpression`))return!1;let n=A(e.callee);if(!T(n,`Identifier`))return!1;let r=t.symbolFor(n);if(!r||V(r,n,t)||!T(r.declarationNode,`ImportDefaultSpecifier`)&&!T(r.declarationNode,`ImportSpecifier`))return!1;let i=ao(n,n.name);return!i||i.isNamespace?!1:cs.has(i.source)&&i.exportedName===`default`?!0:(i.source===`lodash`||i.source===`lodash-es`)&&i.exportedName===`sortBy`},fs=(e,t,n,r=new Set)=>{let i=A(e);if(T(i,`ArrayExpression`)||ds(i,t))return!0;if(!T(i,`Identifier`))return!1;let a=t.symbolFor(i);return!a||r.has(a.id)||V(a,n,t)?!1:us(a.bindingIdentifier)?!0:a.initializer?(r.add(a.id),fs(a.initializer,t,n,r)):!1},ps=(e,t)=>{if(!T(e,`CallExpression`))return!1;let n=A(e.callee);if(!T(n,`MemberExpression`)||M(n)!==`map`)return!1;let r=A(n.object);return fs(r,t,e)?!(T(r,`Identifier`)&&ns(r,`map`,e,t)):!1},ms=(e,t)=>{if(e.type!==`ArrowFunctionExpression`&&e.type!==`FunctionExpression`)return!1;let n=e.parent;if(T(n,`CallExpression`))return Ua(n,`useMemo`,t,{resolveNamedAliases:!0})&&as(n,t)?n.arguments[0]===e:n.arguments.some(t=>t===e)&&ps(n,t);if(T(n,`Property`)&&n.kind===`init`&&n.value===e){let e=n.parent;if(!T(e,`ObjectExpression`))return!1;let r=e.parent;if(!T(r,`CallExpression`)||!r.arguments.some(t=>t===e)||!as(r,t))return!1;let i=tn(r.callee,t);return!!(i&&fo(i,!0))}return!1},hs=(e,t)=>os.has(e.type)&&!ms(e,t),gs=(e,t)=>e.type===`JSXElement`||e.type===`JSXFragment`||Ua(e,`createElement`,t,ss)||_s(e,t),_s=(e,t)=>{if(!T(e,`CallExpression`))return!1;let n=A(e.callee);if(T(n,`Identifier`))return t.symbolFor(n)?.kind===`import`&&ro(n,n.name,`react-dom`)===`createPortal`;if(!T(n,`MemberExpression`)||n.computed||!T(n.object,`Identifier`)||!T(n.property,`Identifier`)||n.property.name!==`createPortal`)return!1;let r=t.symbolFor(n.object);return!r||r.kind!==`import`?!1:no(n.object,n.object.name,`react-dom`)||to(n.object,n.object.name,`react-dom`)},vs=(e,t)=>{if(hs(e,t))return!1;let n=!1;return L(e,r=>{if(n||r!==e&&hs(r,t))return!1;if(gs(r,t))return n=!0,!1}),n},ys=new WeakMap,bs=(e,t,n)=>{let r=ys.get(e);if(r&&r.scopes===t&&r.controlFlow===n)return r.hasRenderOutput;let i=Oo(e,t,e=>vs(e,t),n);return ys.set(e,{scopes:t,controlFlow:n,hasRenderOutput:i}),i},xs=e=>T(e,`JSXIdentifier`)?e.name:T(e,`JSXNamespacedName`)?`${e.namespace.name}:${e.name.name}`:null,Ss=new Set([`Component`,`PureComponent`]),Cs=(e,t,n,r)=>{let i=A(e);if(T(i,`MemberExpression`)){let e=M(i),n=A(i.object);return!!(e&&Ss.has(e)&&T(n,`Identifier`)&&!ns(n,e,i,t)&&Ba(n,t))}if(T(i,`ClassExpression`))return ws(i,t,n,r);if(!T(i,`Identifier`))return!1;let a=t.symbolFor(i);if(!a||r.has(a.id)||V(a,i,t))return!1;if(r.add(a.id),Ra(a)){let e=R(a.declarationNode);return!!(e&&Ss.has(e))}return T(a.declarationNode,`ClassDeclaration`)||T(a.declarationNode,`ClassExpression`)?ws(a.declarationNode,t,n,r):!!(a.kind===`const`&&a.initializer&&Cs(a.initializer,t,n,r))},ws=(e,t,n=new Set,r=new Set)=>!T(e,`ClassDeclaration`)&&!T(e,`ClassExpression`)||n.has(e)||!e.superClass?!1:(n.add(e),Cs(e.superClass,t,n,r)),Ts=new Set([`FunctionDeclaration`,`FunctionExpression`,`ArrowFunctionExpression`,`MethodDefinition`,`Program`]),Es=e=>{let t=e;for(;t;){if(Ts.has(t.type))return t;t=t.parent??null}return null},Ds=(e,t)=>{if(t!==`let`&&t!==`const`)return Es(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`)?Es(e):n}if(Ts.has(n.type))return n;n=n.parent??null}return null},Os=(e,t,n,r)=>{if(T(e,`Identifier`)){let i=r.get(e.name)??[];i.push({bindingIdentifier:e,initializer:t,scopeOwner:n}),r.set(e.name,i);return}if(T(e,`ObjectPattern`)){for(let t of e.properties)if(T(t,`Property`)){let e=t.value;Os(e,T(e,`AssignmentPattern`)?e.right:null,n,r)}else T(t,`RestElement`)&&Os(t.argument,null,n,r);return}if(T(e,`ArrayPattern`)){for(let t of e.elements)t&&Os(t,T(t,`AssignmentPattern`)?t.right??null:null,n,r);return}if(T(e,`AssignmentPattern`)){Os(e.left,e.right??null,n,r);return}T(e,`RestElement`)&&Os(e.argument,null,n,r)},ks=e=>{let t=new Map;return L(e,e=>{switch(e.type){case`VariableDeclarator`:{let n=e.parent,r=Ds(e,n?.type===`VariableDeclaration`?n.kind:void 0);r&&Os(e.id,e.init??null,r,t);break}case`FunctionDeclaration`:case`FunctionExpression`:case`ArrowFunctionExpression`:if(e.type!==`ArrowFunctionExpression`&&e.id){let n=e.parent?Es(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)Os(n,null,e,t);break;case`ClassDeclaration`:case`ClassExpression`:{if(!e.id)break;let n=e.parent?Es(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=Es(e);if(!n)break;for(let r of e.specifiers){let e=r.local;if(e&&T(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=Es(e);if(r){let e=t.get(n.name)??[];e.push({bindingIdentifier:n,initializer:null,scopeOwner:r}),t.set(n.name,e)}}break}}}),t},As=new WeakMap,js=new WeakMap,Ms=e=>{let t=Pt(e);if(!t)return null;let n=As.get(t);return n||(n=ks(t),As.set(t,n)),n},Ns=(e,t,n)=>{let r=Ms(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&&(T(r.initializer,`FunctionDeclaration`)||r.bindingIdentifier.range[0]<e.range[0]));if(n!==!!(t.initializer&&(T(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},Ps=(e,t,n)=>{let r=js.get(e),i;if(!r)i={},js.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=Ns(e,t,n);return i[a]=o,o},Fs=e=>fa.test(e),Is=e=>{let t=Ps(e,e.name);if(!t?.initializer)return null;let n=t.bindingIdentifier.parent;if(!n||!T(n,`VariableDeclarator`)||n.id!==t.bindingIdentifier)return null;let r=n.parent;if(!r||!T(r,`VariableDeclaration`)||r.kind!==`const`)return null;let i=A(t.initializer);return T(i,`Literal`)&&typeof i.value==`string`?i.value:null},Ls=e=>T(e,`JSXIdentifier`)?e.name:T(e,`JSXMemberExpression`)?`${Ls(e.object)}.${e.property.name}`:T(e,`JSXNamespacedName`)?`${e.namespace.name}:${e.name.name}`:``,Rs=e=>{let t=e.name;return T(t,`JSXIdentifier`)?Fs(t.name)?Is(t)??t.name:t.name:Ls(t)},zs=(e,t)=>{if(!T(e.name,`JSXIdentifier`))return!1;let n=Rs(e);if(n[0]===n[0]?.toLowerCase())return!0;let r=new Set,i=e=>{let n=j(e);if(T(n,`Literal`))return typeof n.value==`string`;if(T(n,`Identifier`)||T(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 T(n,`ConditionalExpression`)?i(n.consequent)&&i(n.alternate):!1};return i(e.name)},Bs=(e,t,n=new Set)=>{if(!e)return null;let r=A(e);if(w(r))return r;if(T(r,`Identifier`)){let e=t.symbolFor(r);return!e||n.has(e.id)||!e.initializer||V(e,r,t)?null:(n.add(e.id),Bs(e.initializer,t,n))}if(!T(r,`CallExpression`)||!Ua(r,`memo`,t,{resolveNamedAliases:!0})&&!Ua(r,`forwardRef`,t,{resolveNamedAliases:!0}))return null;let i=r.arguments[0];return!i||T(i,`SpreadElement`)?null:Bs(i,t,n)},Vs=(e,t)=>{let n=j(e);if(!w(n)||n.async||n.generator)return!1;let r=n.parent;if(!r||!T(r,`JSXExpressionContainer`))return!1;let i=r.parent;if(!i||!T(i,`JSXAttribute`)||xs(i.name)!==`ref`)return!1;let a=i.parent;return!!(a&&T(a,`JSXOpeningElement`)&&zs(a,t))},Hs=(e,t)=>t.every((t,n)=>e[n]===t),Us=e=>{let t=j(e);for(;t.parent&&T(t.parent,`MemberExpression`)&&t.parent.object===t;){if(!M(t.parent))return null;t=j(t.parent)}return t},Ws=(e,t,n,r)=>{if(t.length!==n.length+1||!Hs(t,n)||t[n.length]!==`current`)return!1;let i=Us(e),a=i?.parent;if(!i||!a||!T(a,`AssignmentExpression`)||a.operator!==`=`||a.left!==i)return!1;let o=D(e);if(!o)return!1;if(Vs(o,r))return!0;if(!w(o)||o.async||o.generator)return!1;let s=D(o);if(!s||!Vs(s,r))return!1;let c=j(o),l=c.parent;return!!(T(l,`ReturnStatement`)&&l.argument===c&&D(l)===s||T(s,`ArrowFunctionExpression`)&&s.body===c)},Gs=(e,t)=>{if(!T(e,`JSXOpeningElement`))return!1;let n=e.name;if(T(n,`JSXIdentifier`)){if(!t)return n.name===`Fragment`;let e=N(n,t);return e?Ra(e)&&R(e.declarationNode)===`Fragment`:n.name===`Fragment`&&t.isGlobalReference(n)}return T(n,`JSXMemberExpression`)?!T(n.object,`JSXIdentifier`)||n.property.name!==`Fragment`?!1:t?Ba(n.object,t)?!0:n.object.name===`React`&&t.isGlobalReference(n.object):n.object.name===`React`:!1},Ks=(e,t,n,r,i)=>{let a=j(e),o=a.parent;if(!o)return!1;if(T(o,`ReturnStatement`)&&o.argument===a)return D(o)===t;if(T(o,`ArrowFunctionExpression`)&&o.body===a)return o===t;if(T(o,`JSXFragment`)&&o.children.some(e=>e===a)||T(o,`JSXElement`)&&o.children.some(e=>e===a)&&(zs(o.openingElement,n)||Gs(o.openingElement,n)||i.doesCustomElementRenderChildren?.(o.openingElement)))return Ks(o,t,n,r,i);if(T(o,`JSXExpressionContainer`)&&o.expression===a&&o.parent&&(T(o.parent,`JSXFragment`)||T(o.parent,`JSXElement`)&&(zs(o.parent.openingElement,n)||Gs(o.parent.openingElement,n)||i.doesCustomElementRenderChildren?.(o.parent.openingElement))))return Ks(o.parent,t,n,r,i);if(T(o,`ConditionalExpression`)&&(o.consequent===a||o.alternate===a)||T(o,`LogicalExpression`)&&(o.left===a||o.right===a)||T(o,`ArrayExpression`)&&o.elements.some(e=>e===a))return Ks(o,t,n,r,i);if(!T(o,`VariableDeclarator`)||o.init!==a||!T(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`&&Ks(e.identifier,t,n,r,i));return r.delete(s.id),c},qs=(e,t,n={})=>Ks(e,D(e),t,new Set,n),Js=(e,t)=>t.every((t,n)=>e[n]===t),Ys=(e,t)=>Js(e,t)||Js(t,e),Xs=e=>w(e)&&T(e.body,`BlockStatement`)&&e.body.body.length===0,Zs=(e,t,n)=>Ua(e,t,n,{resolveNamedAliases:!0}),Qs=(e,t,n=new Set)=>T(e,`ObjectExpression`)?e.properties.every(e=>{if(T(e,`SpreadElement`)){let r=j(e.argument);if(T(r,`ObjectExpression`))return Qs(r,t,n);if(!T(r,`Identifier`))return!1;let i=t.symbolFor(r);if(!i||i.kind!==`const`||n.has(i.id)||!T(i.initializer,`ObjectExpression`))return!1;n.add(i.id);let a=Qs(i.initializer,t,n);return n.delete(i.id),a}return T(e,`Property`)?!w(e.value)||Xs(e.value):!1}):!1,$s=e=>M(e)||(e.computed&&T(e.property,`Literal`)&&typeof e.property.value==`number`&&Number.isSafeInteger(e.property.value)&&e.property.value>=0?String(e.property.value):null),ec=e=>{let t=[],n=j(e);for(;n.parent&&T(n.parent,`MemberExpression`)&&n.parent.object===n;){let e=$s(n.parent);if(!e)return null;t.push(e),n=j(n.parent)}return{expression:n,propertyPath:t}},tc=(e,t,n)=>{let r=n.environmentsByProgram.get(e);if(r)return r;let i={filename:t,program:e,scopes:ft(e)};return n.environmentsByProgram.set(e,i),i},nc=(e,t,n=new Set)=>{let r=j(e);if(T(r,`Identifier`)){let e=t.symbolFor(r);return!e||!e.initializer||n.has(e.id)||V(e,r,t)?!1:(n.add(e.id),nc(e.initializer,t,n))}if(!T(r,`CallExpression`))return!1;if(Zs(r,`forwardRef`,t))return!0;if(!Zs(r,`memo`,t))return!1;let i=r.arguments[0];return!i||T(i,`SpreadElement`)?!1:nc(i,t,n)},rc=(e,t)=>{let n=tc(e.programNode,e.filePath,t),r=Bs(e.exportedNode,n.scopes);return r?{environment:n,functionNode:r,isForwardRef:nc(e.exportedNode,n.scopes)}:null},ic=(e,t,n)=>{if(!T(e,`Identifier`)&&!T(e,`JSXIdentifier`))return null;let r=t.scopes.symbolFor(e);if(r&&r.kind!==`import`){if(V(r,e,t.scopes))return null;let n=Bs(r.initializer,t.scopes);return n?{environment:t,functionNode:n,isForwardRef:!!(r.initializer&&nc(r.initializer,t.scopes))}:null}let i=ao(e,e.name);if(!i||i.isNamespace||i.exportedName===null)return null;let a=I(t.filename,i.source,i.exportedName);return a?rc(a,n):null},ac=(e,t,n)=>{if(T(e,`JSXIdentifier`))return ic(e,t,n);if(!T(e,`JSXMemberExpression`)||!T(e.object,`JSXIdentifier`))return null;let r=ao(e.object,e.object.name);if(!r?.isNamespace)return null;let i=I(t.filename,r.source,e.property.name);return i?rc(i,n):null},oc=(e,t,n=new Set)=>{let r=j(e);if(T(r,`Identifier`)){let e=t.scopes.symbolFor(r);return!e||!e.initializer||n.has(e.id)||V(e,r,t.scopes)?!1:(n.add(e.id),oc(e.initializer,t,n))}return ws(r,t.scopes)},sc=(e,t,n)=>{if(!T(e,`JSXIdentifier`))return!1;let r=t.scopes.symbolFor(e);if(r&&r.kind!==`import`)return V(r,e,t.scopes)?!1:!!(r.initializer&&oc(r.initializer,t));let i=ao(e,e.name);if(!i||i.isNamespace||i.exportedName===null)return!1;let a=I(t.filename,i.source,i.exportedName);if(!a)return!1;let o=tc(a.programNode,a.filePath,n);return oc(a.exportedNode,o)},cc=(e,t)=>{if(!e)return null;let n=j(e);return!T(n,`ClassDeclaration`)&&!T(n,`ClassExpression`)||!oc(n,t)?null:{classNode:n,environment:t}},lc=(e,t,n)=>{if(!T(e,`JSXIdentifier`))return null;let r=t.scopes.symbolFor(e);if(r&&r.kind!==`import`)return V(r,e,t.scopes)?null:cc(r.initializer,t);let i=ao(e,e.name);if(!i||i.isNamespace||i.exportedName===null)return null;let a=I(t.filename,i.source,i.exportedName);if(!a)return null;let o=tc(a.programNode,a.filePath,n);return cc(a.exportedNode,o)},uc=(e,t,n)=>{let r=[...t],i=j(e);for(;i.parent;){let e=i.parent;if(T(e,`ArrayExpression`)){if(e.elements.some(e=>e&&T(e,`SpreadElement`)))return null;let t=e.elements.findIndex(e=>e===i);if(t<0)return null;r.unshift(String(t)),i=j(e);continue}if(T(e,`Property`)&&e.value===i){let t=P(e,{allowComputedString:!0}),a=e.parent;if(!t||!a||!Qs(a,n.scopes))return null;r.unshift(t),i=j(a);continue}if(T(e,`ConditionalExpression`)&&(e.consequent===i||e.alternate===i)||T(e,`LogicalExpression`)&&(e.left===i||e.right===i)){i=j(e);continue}if(T(e,`VariableDeclarator`)&&e.init===i&&T(e.id,`Identifier`)){let t=n.scopes.symbolFor(e.id);return!t||t.kind!==`const`?null:{environment:n,propertyPath:r,symbol:t}}if(T(e,`AssignmentExpression`)&&e.operator===`=`&&e.right===i&&T(e.left,`MemberExpression`)){let t=[],i=e.left;for(;T(i,`MemberExpression`);){let e=$s(i);if(!e)return null;t.unshift(e),i=j(i.object)}if(!T(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},dc=(e,t,n,r,i)=>{if(T(e,`AssignmentPattern`))return dc(e.left,t,n,r,i);if(T(e,`Identifier`)){let a=n.scopes.symbolFor(e);return!!(a&&Dc({environment:n,propertyPath:t,symbol:a},r,i-1))}if(!T(e,`ObjectPattern`)||t.length===0)return!1;let[a,...o]=t;for(let t of e.properties){if(!T(t,`Property`))continue;let e=P(t,{allowComputedString:!0});if(!e)return!1;if(e===a)return dc(t.value,o,n,r,i)}let s=e.properties.find(e=>T(e,`RestElement`));return s?dc(s.argument,t,n,r,i):!0},fc=(e,t)=>{let n=e.arguments[0];return!n||T(n,`SpreadElement`)?!1:Zs(e,`createElement`,t.scopes)?T(n,`Literal`)&&typeof n.value==`string`:!Zs(e,`cloneElement`,t.scopes)||!T(n,`JSXElement`)?!1:zs(n.openingElement,t.scopes)},pc=(e,t,n,r,i)=>{if(t.length>0)return!1;let a=e.parent;if(!a||!T(a,`Property`)||a.value!==e||P(a,{allowComputedString:!0})!==`ref`)return!1;let o=a.parent;if(!o||!T(o,`ObjectExpression`))return!1;let s=o.parent;return!(!s||!T(s,`CallExpression`)||s.arguments[1]!==o||!fc(s,n)||!_c(s,n,r,i))},mc=(e,t,n,r,i)=>{if(i<=0||!w(e.functionNode)||e.functionNode.async||e.functionNode.generator)return!1;let a=e.functionNode.params[t];return!!(a&&dc(a,n,e.environment,r,i))},hc=e=>{if(!T(e,`MemberExpression`)||M(e)!==`children`)return!1;let t=j(e.object);return!!(T(t,`MemberExpression`)&&M(t)===`props`&&T(j(t.object),`ThisExpression`))},gc=(e,t)=>{if(!T(e,`JSXOpeningElement`)||!T(e.name,`JSXMemberExpression`)||e.name.property.name!==`Provider`||!T(e.name.object,`JSXIdentifier`))return!1;let n=t.scopes.symbolFor(e.name.object);return!!(n?.kind===`const`&&n.initializer&&T(n.initializer,`CallExpression`)&&Zs(n.initializer,`createContext`,t.scopes))},_c=(e,t,n,r)=>qs(e,t.scopes,{doesCustomElementRenderChildren:e=>bc(e,t,n,r-1)}),vc=(e,t,n)=>{let{functionNode:r}=e;if(n<=0||t.activeRenderedChildrenComponents.has(r)||!T(r,`ArrowFunctionExpression`)&&!T(r,`FunctionExpression`)&&!T(r,`FunctionDeclaration`)||r.async||r.generator)return!1;let i=Ya(r,e.environment.scopes);if(!i)return!1;t.activeRenderedChildrenComponents.add(r);let a=i.every(r=>_c(r,e.environment,t,n));return t.activeRenderedChildrenComponents.delete(r),a},yc=(e,t,n)=>{let{classNode:r,environment:i}=e;if(n<=0||t.activeRenderedChildrenComponents.has(r)||!T(r,`ClassDeclaration`)&&!T(r,`ClassExpression`))return!1;let a=r.body.body.find(e=>T(e,`MethodDefinition`)&&!e.computed&&T(e.key,`Identifier`)&&e.key.name===`render`);if(!a||!T(a,`MethodDefinition`))return!1;let o=[];if(L(r,e=>{hc(e)&&o.push(e)}),o.length===0)return!1;t.activeRenderedChildrenComponents.add(r);let s=o.every(e=>D(e)===a.value&&_c(e,i,t,n));return t.activeRenderedChildrenComponents.delete(r),s},bc=(e,t,n,r)=>{if(r<=0||!T(e,`JSXOpeningElement`))return!1;if(gc(e,t))return!0;let i=ac(e.name,t,n);if(i)return vc(i,n,r);let a=lc(e.name,t,n);return!!(a&&yc(a,n,r))},xc=(e,t,n,r,i)=>{let a=xs(e.name),o=e.parent;if(!a||!o||!T(o,`JSXOpeningElement`))return!1;let s=o.parent;if(!s||!T(s,`JSXElement`)||!_c(s,n,r,i))return!1;if(zs(o,n.scopes))return a===`ref`&&t.length===0;if(T(o.name,`JSXIdentifier`)&&a===`ref`&&t.length===0&&sc(o.name,n,r))return!0;let c=ac(o.name,n,r);return c?a===`ref`&&c.isForwardRef?mc(c,1,t,r,i):mc(c,0,[a,...t],r,i):!1},Sc=(e,t,n,r,i,a)=>{let o=e.arguments.findIndex(e=>e===t);if(o<0)return!1;if(o===0&&T(e.callee,`Identifier`)&&e.callee.name===`Boolean`&&r.scopes.isGlobalReference(e.callee))return!0;if(o===0&&Zs(e,`useImperativeHandle`,r.scopes))return n.length===0;if(o===1&&n.length===1&&n[0]===`ref`&&fc(e,r)&&_c(e,r,i,a))return!0;let s=j(e.callee);if(w(s))return bs(s,r.scopes)&&!_c(e,r,i,a)?!1:mc({environment:r,functionNode:s,isForwardRef:!1},o,n,i,a);if(!T(e.callee,`Identifier`))return!1;let c=ic(e.callee,r,i);return!!(c&&(!bs(c.functionNode,c.environment.scopes)||_c(e,r,i,a))&&mc(c,o,n,i,a))},Cc=(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||!T(t,`Property`)||t.value!==e||P(t,{allowComputedString:!0})!==`ref`)return!1;a=t.parent?.parent}if(!a||!T(a,`JSXSpreadAttribute`))return!1;let o=a.parent;if(!o||!T(o,`JSXOpeningElement`))return!1;let s=o.parent;return!!(zs(o,n.scopes)&&s&&T(s,`JSXElement`)&&_c(s,n,r,i))},wc=(e,t,n,r,i)=>{let a=j(e),o=a.parent;if(!o)return!1;if(T(o,`ExpressionStatement`)||T(o,`UnaryExpression`)&&o.operator===`void`&&o.argument===a)return!0;if(t.length===0&&T(o,`BinaryExpression`)&&(o.operator===`===`||o.operator===`!==`||o.operator===`==`||o.operator===`!=`)){let e=o.left===a?o.right:o.left;return!!(T(a,`Identifier`)&&T(e,`Identifier`)&&n.scopes.symbolFor(a)?.id===n.scopes.symbolFor(e)?.id)}if(Cc(a,t,n,r,i)||pc(a,t,n,r,i)||t.length>0&&(T(o,`LogicalExpression`)&&o.left===a||T(o,`ConditionalExpression`)&&o.test===a||T(o,`IfStatement`)&&o.test===a||T(o,`UnaryExpression`)&&o.operator===`!`&&o.argument===a))return!0;if(T(o,`JSXExpressionContainer`)&&o.expression===a){let e=o.parent;return!!(e&&T(e,`JSXAttribute`)&&xc(e,t,n,r,i))}if(T(o,`CallExpression`))return Sc(o,a,t,n,r,i);if(T(o,`VariableDeclarator`)&&o.init===a&&!T(o.id,`Identifier`))return dc(o.id,t,n,r,i);let s=uc(a,t,n);return!!(s&&Dc(s,r,i-1))},Tc=e=>{let t=e.parent;return t&&T(t,`VariableDeclarator`)&&t.init===e&&T(t.id,`Identifier`)?t.id:(T(e,`FunctionDeclaration`)||T(e,`FunctionExpression`))&&e.id?e.id:null},Ec=(e,t,n)=>{if(!e||!t||!w(e)||e.async||e.generator)return!1;let r=Tc(e);if(!r||((T(e,`FunctionDeclaration`)||T(e,`FunctionExpression`))&&e.id===r?D(e):D(r))!==t)return!1;let i=T(e,`FunctionDeclaration`)?n.ownScopeFor(t)?.symbolsByName.get(r.name):n.symbolFor(r);return!!(i&&i.references.length>0&&i.references.every(e=>{let r=j(e.identifier),i=r.parent;return!!(i&&T(i,`CallExpression`)&&i.callee===r&&D(i)===t&&qs(i,n))}))},Dc=(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=D(e.symbol.bindingIdentifier),a=e.symbol.references.every(r=>{if(r.identifier===e.originWriteReference)return!0;let a=r.identifier.parent;if(a&&T(a,`Property`)&&!a.computed&&a.key===r.identifier&&a.value!==r.identifier)return!0;let o=ec(r.identifier);if(!o)return!1;if(!Ys(o.propertyPath,e.propertyPath))return!0;let s=D(r.identifier);if(s!==i&&!Ec(s,i,e.environment.scopes))return!!Ws(r.identifier,o.propertyPath,e.propertyPath,e.environment.scopes);if(r.flag!==`read`)return!1;if(Js(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&&T(t,`UnaryExpression`)&&t.operator===`void`&&t.argument===o.expression)}return wc(o.expression,[],e.environment,t,n)}return wc(o.expression,e.propertyPath.slice(o.propertyPath.length),e.environment,t,n)});return t.activePaths.delete(r),a},Oc=(e,t,n)=>{if(!t)return!1;let r=Pt(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=uc(e,[],i);return o?Dc(o,a,12):wc(e,[],i,a,12)},kc=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},Ac=({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=In(e,t);if(!(!a||!Ci(a))){n||(n=!0,Wr(e));for(let e of i){let t=e.importName.kind===`Default`?`default`:e.importName.name;t&&qa(a,t)}}}},jc=({absoluteFilePath:e})=>{pr.test(e)&&(_r.test(e)||ii(e))},Mc=({absoluteFilePath:e,staticImports:t})=>{if(mr.test(e)&&!si(e))for(let n of kc(t))rr(e,n.source,n.exportedName)},H=({absoluteFilePath:e,staticImports:t})=>{for(let n of kc(t))rr(e,n.source,n.exportedName)},Nc=({absoluteFilePath:e,staticImports:t})=>{for(let n of kc(t))I(e,n.source,n.exportedName)},Pc=(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=ci(i);if(!e)continue;let a=$n(t,e);if(!a||r>=8)continue;let o=r+1,s=n.get(a);if(s!==void 0&&s<=o)continue;let c=hn(a);if(!c){n.set(a,o);continue}Pc(c,a,n,o)}}},Fc=e=>{Nc(e);let t=e.getProgram(),n=!1;L(t,e=>{if(n)return!1;if(!T(e,`CallExpression`))return;let t=A(e.callee);if(!T(t,`MemberExpression`))return;let r=M(t);n=r===`add`||r===`set`}),n&&Pc(t,e.absoluteFilePath,new Map,0)},Ic=({absoluteFilePath:e,staticImports:t})=>{for(let n of kc(t))Ja(e,n.source,n.exportedName)},Lc=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},Rc=({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 Lc(t)){let t=I(e,a.source,a.exportedName);!t||n===0||!r(t)||!i(t.filePath)||o(t.filePath,t.programNode,n-1)}}};for(let a of kc(t)){let t=I(e,a.source,a.exportedName);!t||!r(t)||!i(t.filePath)||o(t.filePath,t.programNode,n)}},zc=e=>{let t=e.getProgram();on(t);let n=ft(t);L(t,t=>{if(T(t,`BlockStatement`))for(let[r,i]of t.body.entries()){let a=t.body[r+1];!T(i,`VariableDeclaration`)||!T(a,`VariableDeclaration`)||dr(i,a,n,e.absoluteFilePath)}})},Bc=e=>{Rc(e,4)},Vc=({absoluteFilePath:e,sourceText:t,getProgram:n})=>{if(!t.includes(`createRef`)&&!t.includes(`\\u`))return;let r=n();on(r);let i=ft(r);L(r,t=>{!T(t,`CallExpression`)||!Ua(t,`createRef`,i,{allowGlobalReactNamespace:!0,allowUnboundBareCalls:!0,resolveNamedAliases:!0})||Oc(t,e,i)})},Hc=({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(L(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(A(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&&rr(e,t.moduleRequest.value,r)}},Uc=({absoluteFilePath:e,staticImports:t,getProgram:n})=>{Wr(e),Gr({absoluteFilePath:e,staticImports:t,program:n()})},U=({absoluteFilePath:e})=>{Wr(e)},Wc=e=>{U(e),Ic(e)},Gc=e=>{U(e),Rc(e,1/0,e=>w(e.exportedNode),e=>!e.split(/[\\/]/).includes(`node_modules`))},Kc=({absoluteFilePath:e})=>{Ii(e)},qc=({absoluteFilePath:e})=>{Fe(e,`react-native`)},Jc=({absoluteFilePath:e})=>{Li(e)},Yc=e=>{Jc(e),Gr({absoluteFilePath:e.absoluteFilePath,staticImports:e.staticImports,program:e.getProgram()})},Xc=new Map([...b.map(e=>[e,Jc]),[`ink-no-raw-text`,Yc],[`client-passive-event-listeners`,H],[`effect-needs-cleanup`,H],[`effect-listener-cleanup-reference-mismatch`,H],[`exhaustive-deps`,Bc],[`no-barrel-import`,Ac],[`nextjs-async-dynamic-api-not-awaited`,U],[`nextjs-missing-metadata`,jc],[`nextjs-no-use-search-params-without-suspense`,Mc],[`no-dynamic-import-path`,U],[`no-full-lodash-import`,U],[`no-hydration-branch-on-browser-global`,Wc],[`no-indeterminate-attribute`,U],[`no-locale-format-in-render`,U],[`no-match-media-in-state-initializer`,U],[`no-create-ref-in-function-component`,Vc],[`no-adjust-state-on-prop-change`,H],[`no-derived-state`,H],[`no-derived-state-effect`,H],[`no-event-handler`,H],[`no-initialize-state`,H],[`no-reset-all-state-on-prop-change`,H],[`no-mutating-reducer-state`,Hc],[`no-side-effect-in-state-updater-function`,Fc],[`no-unguarded-browser-global-at-module-scope`,Ic],[`no-unguarded-browser-global-in-render-or-hook-init`,Gc],[`prefer-dynamic-import`,U],[`rendering-hydration-mismatch-time`,U],[`rendering-hydration-no-flicker`,H],[`rerender-memo-with-default-value`,Bc],[`server-sequential-independent-await`,zc],[`rn-no-deprecated-modules`,qc],[`rn-no-legacy-shadow-styles`,Kc],[`rn-no-raw-text`,Uc],[`rn-prefer-expo-image`,U],[`rn-style-prefer-boxshadow`,Kc],...re.map(e=>[e,U])]),Zc=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`]),Qc=e=>{let t=new Set;for(let n of e.ruleIds){let e=Xc.get(n);if(!e)return null;t.add(e)}let n=z(e.absoluteFilePath),r,i;try{let t=dn(n,e.sourceText);if(t.errors.some(e=>e.severity===`Error`))return null;r=t.module.staticImports;let a;i=()=>(a??=t.program,a)}catch{return null}let a={absoluteFilePath:n,sourceText:e.sourceText,staticImports:r,getProgram:i};return be(()=>{for(let e of t)e(a)})},$c={},el=(e,t,n)=>!e||e.length===0?!1:e.every(e=>T(e,t)&&e[n]===`type`),tl=e=>e.importKind===`type`||el(e.specifiers,`ImportSpecifier`,`importKind`),nl=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`]),rl=[`solid-js`,`@builder.io/qwik`],il=[`react`,`react-dom`,`preact`],al=new WeakMap,ol=new WeakMap,sl=(e,t)=>t.some(t=>e===t||e.startsWith(`${t}/`)),cl=e=>{let t=al.get(e);if(t)return t;let n=!1,r=!1,i=!1,a=!1,o=!1,s=!1;for(let t of e.body){if(i||L(t,e=>{if(i)return!1;if(T(e,`JSXOpeningElement`)&&ll(e))return i=!0,!1;T(e,`JSXOpeningElement`)&&T(e.name,`JSXIdentifier`)&&/^[a-z]/.test(e.name.name)&&e.attributes.some(e=>T(e,`JSXAttribute`)&&xs(e.name)===`class`)&&(s=!0)}),!T(t,`ImportDeclaration`))continue;let e=t,c=e.source,l=c&&typeof c.value==`string`?c.value:null;if(l){if(l===`solid-js`)for(let t of e.specifiers){if(!T(t,`ImportSpecifier`)||e.importKind!==`type`&&t.importKind!==`type`)continue;let n=R(t);n===`Component`&&(a=!0),n===`JSX`&&(o=!0)}tl(e)||((nl.has(l)||sl(l,rl))&&(n=!0),sl(l,il)&&(r=!0))}}let c={hasNonReactMarker:i||a||o&&s,hasNonReactRuntime:n,hasReactRuntime:r};return al.set(e,c),c},ll=e=>{let t=ol.get(e);if(t!==void 0)return t;let n=!1;for(let t of e.attributes){if(!T(t,`JSXAttribute`))continue;let r=xs(t.name);if(r&&(r===`classList`&&T(t.value,`JSXExpressionContainer`)&&T(t.value.expression,`ObjectExpression`)||T(e.name,`JSXIdentifier`)&&/^[a-z]/.test(e.name.name)&&(r.startsWith(`class:`)||r.startsWith(`bind:`)||r.startsWith(`on:`)||r.startsWith(`oncapture:`)))){n=!0;break}}return ol.set(e,n),n},ul=new Set(`/playground/./playgrounds/./examples/./example/./demo/./demos/./sandbox/./sandboxes/./specs/./spec/./integration/./it/./perf/./scripts/./cli/./bin/./tooling/./tools/./codemods/./codemod/./migrations/./migration/./generators/./generator/./runbooks/./devtools/./internal-tools/./seeds/./seed/./dev-seeder/`.split(`.`)),dl=new Set,fl=[`/test/`,`/tests/`,`/testing/`,`/__tests__/`,`/__test__/`,`/__fixtures__/`,`/fixtures/`,`/__mocks__/`,`/mocks/`,`/testUtils/`,`/test-utils/`,`/test-stubs/`,`/testutils/`,`/cypress/`,`/playwright/`,`/.storybook/`,`/.dumi/`,`/stories/`,`/__stories__/`,...ul,`/e2e/`,`/e2e-tests/`,`/integration-tests/`,`/benchmarks/`,`/benchmark/`,`/__benchmarks__/`,`/perf-tests/`],pl=[`.test.`,`.spec.`,`.cy.`,`.stories.`,`.story.`,`.bench.`,`.benchmark.`,`.e2e.`,`.integration-spec.`,`.int-spec.`,`.mock.`,`.mocks.`,`.fixture.`],ml=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(`,`)),hl=[`/src/`,`/app/`,`/lib/`,`/components/`,`/pages/`,`/features/`,`/modules/`,`/packages/`,`/apps/`,`/frontend/`,`/client/`],gl=fl.filter(e=>e.startsWith(`/.`)),_l=e=>{let t=-1;for(let n of hl){let r=e.lastIndexOf(n);r>t&&(t=r)}return t<0?e:e.slice(t)};let vl,yl=!1,bl,xl=!1;const Sl=e=>e?e===vl?yl:(vl=e,yl=Tl(e),yl):!1,Cl=e=>{if(!e)return!1;if(e===bl)return xl;bl=e;let t=e.replaceAll(`\\`,`/`),n=t.startsWith(`/`)?t:`/${t}`;return xl=Tl(n,hl.some(e=>n.includes(e))?ul:dl),xl},wl=(e,t)=>e?Tl(e,t):!1,Tl=(e,t=dl)=>{let n=e.replaceAll(`\\`,`/`),r=n.lastIndexOf(`/`),i=r===-1?n:n.slice(r+1);if(ml.has(i.toLowerCase()))return!0;for(let e of pl)if(i.includes(e))return!0;let a=n.startsWith(`/`)?n:`/${n}`;for(let e of gl)if(!t.has(e)&&a.includes(e))return!0;let o=_l(n);for(let e of fl)if(!t.has(e)&&(e.startsWith(`/.`)?n:o).includes(e))return!0;return!1},El=(e,t=Sl)=>n=>t(n.filename)?$c:e(n),Dl=e=>{let t=e?.[`react-doctor`];return typeof t!=`object`||!t||Array.isArray(t)?null:t},Ol=(e,t)=>Object.getOwnPropertyDescriptor(e,t)?.value,kl=(e,t)=>{let n=Dl(e);if(!n)return;let r=Ol(n,t);return typeof r==`string`?r:void 0},Al=(e,t)=>{let n=Dl(e);if(!n)return;let r=Ol(n,t);return typeof r==`number`&&Number.isFinite(r)?r:void 0},jl=new WeakMap,Ml=(e,t)=>{let n=Ol(e,t);if(Array.isArray(n))return n.filter(e=>typeof e==`string`&&e.length>0)},Nl=(e,t)=>{let n=Dl(e);if(!n)return;let r=jl.get(n);if(r||(r=new Map,jl.set(n,r)),r.has(t))return r.get(t);let i=Ml(n,t);return r.set(t,i),i},Pl=(e,t)=>Nl(e,t)??[],Fl=(e,t)=>Pl(e,`capabilities`).includes(t),Il=(e,t)=>{let n=Dl(e);return!n||Ol(n,`capabilities`)===void 0?!0:Fl(e,t)},Ll=(e,t,n)=>!t?.some(t=>!Il(e,t))&&!n?.some(t=>Fl(e,t)),Rl=(e,t,n)=>r=>Ll(r.settings,t,n)?e(r):$c,zl=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=cl(e);i=n.hasReactRuntime,r=!n.hasReactRuntime&&(n.hasNonReactRuntime||n.hasNonReactMarker),!r&&t(e)};continue}if(e===`JSXOpeningElement`){a.JSXOpeningElement=e=>{!i&&!r&&ll(e)&&(r=!0),!r&&t(e)};continue}a[e]=e=>{r||t(e)}}return`Program`in a||(a.Program=e=>{let t=cl(e);i=t.hasReactRuntime,r=!t.hasReactRuntime&&(t.hasNonReactRuntime||t.hasNonReactMarker)}),a}),W=e=>{if(!(`create`in e))return{...e,create:()=>$c};let t=e.tags,n=e.create,r=t?.includes(`test-noise`)&&!t?.includes(`migration-hint`);return t?.includes(`react-jsx-only`)&&(n=zl(n)),r&&(n=El(n,Cl)),(e.requires||e.disabledWhen)&&(n=Rl(n,e.requires,e.disabledWhen)),n===e.create?e:{...e,create:n}};let Bl;const Vl=e=>{let t=[0];for(let n=0;n<e.length;n+=1){let r=e[n];if(r===`\r`&&e[n+1]===`
1
+ import*as e from"node:path";import*as t from"node:fs";import{readFileSync as n}from"node:fs";import{KEYS as r}from"eslint-visitor-keys";import{parseSync as i,rawTransferSupported as a,visitorKeys as o}from"oxc-parser";const s=[[`nextjs`,`Next.js`,`NEXT_PUBLIC_*`],[`vite`,`Vite`,`VITE_*`],[`tanstack-start`,`TanStack Start`,`VITE_*`],[`cra`,`Create React App`,`REACT_APP_*`],[`gatsby`,`Gatsby`,`GATSBY_*`]],c=e=>{for(let[t,n,r]of s)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`},l=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,u=[{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`}],d=Object.fromEntries(u.map(e=>[e.key,e.severity])),f=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(`.`)),p=new Set([`width`,`height`,`top`,`left`,`right`,`bottom`,`padding`,`paddingTop`,`paddingRight`,`paddingBottom`,`paddingLeft`,`margin`,`marginTop`,`marginRight`,`marginBottom`,`marginLeft`,`borderWidth`,`fontSize`,`lineHeight`,`gap`]),m=new Set([`animate`,`initial`,`exit`,`whileHover`,`whileTap`,`whileFocus`,`whileDrag`,`whileInView`]),h=/blur\((\d+(?:\.\d+)?)px\)/,g=new Set([`requestAnimationFrame`,`setInterval`]),_=new Set([`framer-motion`,`motion`]),v=new Set([`bounce`,`elastic`,`wobble`,`jiggle`,`spring`]),y={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`},b=[`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`],ee=[`@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([...b,`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`,`server-sequential-independent-await`,`rn-no-deprecated-modules`,`rn-no-legacy-shadow-styles`,`rn-no-raw-text`,`rn-prefer-expo-image`,`rn-style-prefer-boxshadow`,...re]),me=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},he=(e,t)=>e.major-t.major||e.minor-t.minor||e.patch-t.patch||Number(t.isPrerelease)-Number(e.isPrerelease);let x=null;const ge=e=>{x?.existencePaths.add(e)},S=e=>{x?.contentPaths.add(e)},_e=()=>x!==null,ve=e=>{let t=x,n={existencePaths:new Set,contentPaths:new Set};x=n;try{return{value:e(),trace:n}}finally{if(x=t,t!==null){for(let e of n.existencePaths)t.existencePaths.add(e);for(let e of n.contentPaths)t.contentPaths.add(e)}}},ye=e=>{if(x!==null){for(let t of e.existencePaths)x.existencePaths.add(t);for(let t of e.contentPaths)x.contentPaths.add(t)}},be=e=>ve(e).trace,xe=new Map,Se=new Map;let Ce=0;const we=()=>{xe.clear(),Se.clear(),Ce+=1},Te=()=>Ce,Ee=n=>{if(!n)return null;let r=e.dirname(n),i=xe.get(r);if(i!==void 0){if(_e()){let t=r;for(;ge(e.join(t,`package.json`)),t!==i;){let n=e.dirname(t);if(n===t)break;t=n}}return i}let a=r;for(;;){let n=e.join(a,`package.json`);ge(n);let i=!1;try{i=t.statSync(n,{throwIfNoEntry:!1})?.isFile()??!1}catch{i=!1}if(i)return xe.set(r,a),a;let o=e.dirname(a);if(o===a)return xe.set(r,null),null;a=o}},De=e=>{let t=Ee(e);return t?Oe(t):null},Oe=n=>{let r=Se.get(n);if(r!==void 0&&!_e())return r;let i=e.join(n,`package.json`);if(S(i),r!==void 0)return r;let a=null;try{let e=JSON.parse(t.readFileSync(i,`utf-8`));typeof e==`object`&&e&&(a=e)}catch{a=null}return Se.set(n,a),a},ke=new Map;let Ae=Te();const je=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=me(r);if(!i)return null;n.push(i)}return n.reduce((e,t)=>he(t,e)<0?t:e)},Me=(e,t)=>{let n=e.dependencies?.[t]??e.devDependencies?.[t]??e.peerDependencies?.[t]??e.optionalDependencies?.[t],r=je(n);return r&&typeof n==`string`?{version:r,declaredRange:n}:null},Ne=(t,n)=>{let r=t;for(;;){let t=Oe(e.join(r,`node_modules`,n));if(t)return{didFindPackage:!0,version:typeof t.version==`string`?me(t.version):null};let i=e.dirname(r);if(i===r)return{didFindPackage:!1,version:null};r=i}},Pe=(e,t)=>{let n=Ne(e,t);if(n.didFindPackage)return n.version?{version:n.version,declaredRange:null}:null;let r=Oe(e);return r?Me(r,t):null},Fe=(t,n)=>{if(!t)return null;let r=Ee(e.resolve(t));if(!r)return null;let i=Te();i!==Ae&&(ke.clear(),Ae=i);let a=JSON.stringify([r,n]),o=ke.get(a);if(o)return ye(o.trace),o.version;let{value:s,trace:c}=ve(()=>Pe(r,n));return ke.set(a,{version:s,trace:c}),s},Ie=new Set([`implements`,`returnType`,`superTypeArguments`,`superTypeParameters`,`typeAnnotation`,`typeArguments`,`typeParameters`]),Le={...o,...r,ArrayPattern:[`decorators`,...r.ArrayPattern],AssignmentPattern:[`decorators`,...r.AssignmentPattern],ClassDeclaration:[`decorators`,...r.ClassDeclaration],ClassExpression:[`decorators`,...r.ClassExpression],Identifier:[`decorators`,...r.Identifier],MethodDefinition:[`decorators`,...r.MethodDefinition],ObjectPattern:[`decorators`,...r.ObjectPattern],PropertyDefinition:[`decorators`,...r.PropertyDefinition],RestElement:[`decorators`,...r.RestElement]},Re=new Map,ze=e=>e.filter(e=>e!==`parent`&&!Ie.has(e)),Be=e=>{let t=Re.get(e.type);if(t)return t;let n=Le[e.type];if(!n)return ze(Object.keys(e));let r=ze(n);return Re.set(e.type,r),r},C=e=>typeof e==`object`&&!!e&&typeof e.type==`string`,w=e=>e!=null&&(e.type===`ArrowFunctionExpression`||e.type===`FunctionExpression`||e.type===`FunctionDeclaration`),T=(e,t)=>typeof e==`object`&&!!e&&e.type===t,Ve=e=>e===`var`||e===`function`,He=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},Ue=(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},We=(e,t,n)=>{let r=Ue(e,t,n.currentScope,n);return n.scopeStack.push(r),n.currentScope=r,n.ownScopeForNode.set(t,r),r},Ge=e=>{e.scopeStack.pop();let t=e.scopeStack[e.scopeStack.length-1];if(!t)throw Error(`scope stack underflow`);e.currentScope=t},Ke=(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},qe=(e,t,n,r,i,a)=>{if(T(e,`Identifier`)){Ke(n,r,{name:e.name,kind:i,bindingIdentifier:e,declarationNode:a,initializer:t});return}if(T(e,`ObjectPattern`)){for(let o of e.properties)if(T(o,`Property`)){let e=o.value;qe(e,T(e,`AssignmentPattern`)?e.right:t,n,r,i,a)}else T(o,`RestElement`)&&qe(o.argument,t,n,r,i,a);return}if(T(e,`ArrayPattern`)){for(let o of e.elements)o&&qe(o,T(o,`AssignmentPattern`)?o.right??null:t,n,r,i,a);return}if(T(e,`AssignmentPattern`)){qe(e.left,e.right??null,n,r,i,a);return}T(e,`RestElement`)&&qe(e.argument,null,n,r,i,a)},Je=(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)},Ye=e=>e.parent?w(e.parent):!1,Xe=e=>e.parent!==null&&e.parent!==void 0&&e.parent.type===`CatchClause`,Ze=(e,t)=>{if(!T(e,`VariableDeclaration`))return;let n=e.kind===`var`?`var`:e.kind===`let`?`let`:e.kind===`const`?`const`:`using`,r=Ve(n)?He(t.currentScope):t.currentScope;for(let i of e.declarations){let e=i,a=i.init??null;qe(i.id,a,r,t,n,e)}},Qe=(e,t)=>{T(e,`FunctionDeclaration`)&&e.id&&Ke(He(t.currentScope),t,{name:e.id.name,kind:`function`,bindingIdentifier:e.id,declarationNode:e,initializer:e})},$e=(e,t)=>{T(e,`ClassDeclaration`)&&e.id&&Ke(t.currentScope,t,{name:e.id.name,kind:`class`,bindingIdentifier:e.id,declarationNode:e,initializer:e})},et=(e,t)=>{if(!T(e,`ImportDeclaration`))return;let n=He(t.currentScope);for(let r of e.specifiers){let e=r.local;T(e,`Identifier`)&&Ke(n,t,{name:e.name,kind:`import`,bindingIdentifier:e,declarationNode:r,initializer:r})}},tt=(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||!T(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`;Ke(He(t.currentScope),t,{name:n.name,kind:r,bindingIdentifier:n,declarationNode:e,initializer:null})},nt=(e,t,n)=>{for(let r of e)qe(r,null,t,n,`parameter`,r)},rt=e=>!(!T(e,`BlockStatement`)||Ye(e)||Xe(e)||e.parent&&e.parent.type===`TSModuleDeclaration`),it=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)},at=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}},ot=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`}},st=(e,t)=>{t.nodeScope.set(e,t.currentScope)},ct=(e,t,n)=>{let r=We(e,t,n);return st(t,n),r},lt=(e,t,n)=>{if(e.type===`AssignmentPattern`){lt(e.left,t,n);let r=e.right??null;r&&E(r,t,n);return}if(e.type===`ObjectPattern`){for(let r of e.properties){let e=r;if(e.type===`RestElement`){lt(e.argument,t,n);continue}if(e.type!==`Property`)continue;let i=e;i.computed&&E(i.key,t,n),lt(i.value,t,n)}return}if(e.type===`ArrayPattern`){for(let r of e.elements)r&&lt(r,t,n);return}e.type===`RestElement`&&lt(e.argument,t,n)},E=(e,t,n)=>{if(e.type===`ArrowFunctionExpression`||e.type===`FunctionExpression`||e.type===`FunctionDeclaration`){e.type===`FunctionDeclaration`&&e.id&&Qe(e,t);let n=e.params??[],r=t.currentScope;for(let e of n)if(!(!(`decorators`in e)||!Array.isArray(e.decorators)))for(let n of e.decorators)C(n)&&E(n,t,r);st(e,t);let i=We(e.type===`ArrowFunctionExpression`?`arrow-function`:`function`,e,t);(e.type===`FunctionExpression`||e.type===`FunctionDeclaration`)&&e.id&&Ke(i,t,{name:e.id.name,kind:`function`,bindingIdentifier:e.id,declarationNode:e,initializer:e}),nt(n,i,t);for(let e of n)lt(e,t,r);let a=e.body;a&&E(a,t,r),Ge(t);return}if(e.type===`ClassDeclaration`||e.type===`ClassExpression`){if(e.type===`ClassDeclaration`&&e.id&&$e(e,t),Array.isArray(e.decorators))for(let n of e.decorators)C(n)&&E(n,t,null);let n=ct(`class`,e,t);e.type===`ClassExpression`&&e.id&&Ke(n,t,{name:e.id.name,kind:`class`,bindingIdentifier:e.id,declarationNode:e,initializer:e}),e.superClass&&E(e.superClass,t,n),e.body&&E(e.body,t,n),Ge(t);return}if(e.type===`CatchClause`){let n=ct(`catch`,e,t);e.param&&qe(e.param,null,n,t,`catch-clause-parameter`,e),e.body&&E(e.body,t,n),Ge(t);return}if(e.type===`ForStatement`||e.type===`ForInStatement`||e.type===`ForOfStatement`){ct(`for`,e,t),ut(e,t),Ge(t);return}if(e.type===`SwitchStatement`){let n=ct(`switch`,e,t);e.discriminant&&E(e.discriminant,t,n);for(let r of e.cases)E(r,t,n);Ge(t);return}if(e.type===`TSModuleDeclaration`){let n=ct(`ts-module`,e,t);if(e.id&&T(e.id,`Identifier`)){let r=e.id;Ke(He(n.parent??t.currentScope),t,{name:r.name,kind:`ts-module`,bindingIdentifier:r,declarationNode:e,initializer:null})}e.body&&E(e.body,t,n),Ge(t);return}if(e.type===`TSEnumDeclaration`){tt(e,t);let n=ct(`ts-enum`,e,t),r=e.members??[];for(let e of r)E(e,t,n);Ge(t);return}if(e.type===`BlockStatement`&&rt(e)){let n=ct(`block`,e,t);for(let r of e.body)E(r,t,n);Ge(t);return}switch(t.currentScope!==n&&st(e,t),e.type){case`VariableDeclaration`:Ze(e,t);break;case`ImportDeclaration`:et(e,t);break;case`TSImportEqualsDeclaration`:case`TSTypeAliasDeclaration`:case`TSInterfaceDeclaration`:tt(e,t);break}(e.type===`Identifier`||e.type===`JSXIdentifier`)&&!t.symbolByBindingIdentifier.has(e)&&!at(e)&&(e.type===`JSXIdentifier`?it(e)&&Je(t,e,ot(e)):Je(t,e,ot(e))),ut(e,t)},ut=(e,t)=>{let n=e,r=t.currentScope;for(let i of Be(e)){let e=n[i];if(Array.isArray(e))for(let n of e)C(n)&&E(n,t,r);else C(e)&&E(e,t,r)}},dt=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)},ft=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 r of e.body)E(r,n,t);else E(e,n,t);return dt(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}}},pt=(e,t)=>{let n=e;for(;n;){if(n===t)return!0;n=n.parent}return!1},mt=1024,ht=2e6,gt=1e3,D=e=>{let t=e.parent;for(;t;){if(w(t))return t;t=t.parent??null}return null},_t=e=>T(e,`Identifier`)?e.name:T(e,`Literal`)&&typeof e.value==`string`?e.value:null,vt=e=>{if(T(e,`ImportSpecifier`)){let t=e.imported;return T(t,`Identifier`)?t.name:T(t,`Literal`)&&typeof t.value==`string`?t.value:null}return T(e,`ImportDefaultSpecifier`)?`default`:null},yt=(e,t)=>{if(!T(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=bt(r,t,n);if(e)return e}return null},bt=(e,t,n)=>{if(!T(e,`ExportSpecifier`)||e.exportKind===`type`||_t(e.exported)!==t)return null;let r=_t(e.local);return r?{importedName:r,source:n}:null},xt=(e,t)=>{if(!T(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},St=(e,t)=>{if(!T(e,`Program`))return[];let n=[];for(let r of e.body??[]){let e=yt(r,t);if(e)return[e];let i=xt(r,t);i&&n.push(i)}return n},O=(e,t)=>{if(e){if(T(e,`Identifier`)){t.add(e.name);return}if(T(e,`AssignmentPattern`)){O(e.left,t);return}if(T(e,`RestElement`)){O(e.argument,t);return}if(T(e,`ArrayPattern`)){for(let n of e.elements??[])O(n,t);return}if(T(e,`ObjectPattern`))for(let n of e.properties??[]){if(T(n,`RestElement`)){O(n.argument,t);continue}T(n,`Property`)&&O(n.value,t)}}},Ct=(e,t,n)=>{if(e&&!T(e,`Identifier`)){if(T(e,`AssignmentPattern`)){k(e.right,t,n),Ct(e.left,t,n);return}if(T(e,`RestElement`)){Ct(e.argument,t,n);return}if(T(e,`ArrayPattern`)){for(let r of e.elements??[])Ct(r,t,n);return}if(T(e,`ObjectPattern`))for(let r of e.properties??[]){if(T(r,`RestElement`)){Ct(r.argument,t,n);continue}T(r,`Property`)&&(r.computed&&k(r.key,t,n),Ct(r.value,t,n))}}},wt=(e,t,n)=>{if(!T(e,`FunctionDeclaration`)&&!T(e,`FunctionExpression`)&&!T(e,`ArrowFunctionExpression`))return;let r=new Set(n);for(let t of e.params??[])O(t,r);for(let n of e.params??[])Ct(n,t,r);k(e.body,t,r)},k=(e,t,n)=>{if(!e)return;if(T(e,`Identifier`)){n.has(e.name)||t.add(e.name);return}if(T(e,`MemberExpression`)){k(e.object,t,n),e.computed&&k(e.property,t,n);return}if(T(e,`Property`)){e.computed&&k(e.key,t,n),k(e.value,t,n);return}if(T(e,`FunctionDeclaration`)||T(e,`FunctionExpression`)||T(e,`ArrowFunctionExpression`)){wt(e,t,n);return}if(T(e,`TSAsExpression`)||T(e,`TSSatisfiesExpression`)||T(e,`TSTypeAssertion`)||T(e,`TSNonNullExpression`)||T(e,`TSInstantiationExpression`)){k(e.expression,t,n);return}if(typeof e.type==`string`&&e.type.startsWith(`TS`))return;let r=e;for(let e of Object.keys(r)){if(e===`parent`||Ie.has(e))continue;let i=r[e];if(Array.isArray(i))for(let e of i)C(e)&&k(e,t,n);else C(i)&&k(i,t,n)}},Tt=(e,t)=>k(e,t,new Set),Et=e=>{let t=[],n=new Set;if(T(e,`VariableDeclaration`))for(let r of e.declarations??[])T(r.init,`AwaitExpression`)&&(r.init.argument&&t.push(r.init.argument),O(r.id,n));else if(T(e,`ExpressionStatement`)){let r=e.expression;T(r,`AwaitExpression`)?r.argument&&t.push(r.argument):T(r,`AssignmentExpression`)&&T(r.right,`AwaitExpression`)&&(r.right.argument&&t.push(r.right.argument),T(r.left,`Identifier`)&&n.add(r.left.name))}else T(e,`ReturnStatement`)&&T(e.argument,`AwaitExpression`)?e.argument.argument&&t.push(e.argument.argument):T(e,`ForOfStatement`)&&e.await&&(e.right&&t.push(e.right),O(T(e.left,`VariableDeclaration`)?e.left.declarations?.[0]?.id??null:e.left,n));return t.length===0?null:{awaitedExpressions:t,boundNames:[...n]}},Dt=(e,t)=>{if(T(e,`VariableDeclaration`))for(let n of e.declarations??[])O(n.id,t)},Ot=(e,t,n)=>{let r=new Map,i=[];for(let a of e.body??[]){let e=Et(a);if(!e){let e=new Set;if(Dt(a,e),e.size===0)continue;let t=new Set;Tt(a,t);let n=new Set;for(let e of t)for(let t of r.get(e)??[])n.add(t);if(n.size===0)continue;for(let t of e)r.set(t,n);continue}if(n&&!e.awaitedExpressions.every(e=>n(e))){r.clear(),i.length=0;continue}let o=new Set;for(let t of e.awaitedExpressions)Tt(t,o);let s=new Set;for(let e of o)for(let t of r.get(e)??[])s.add(t);if(i.filter((e,t)=>!s.has(t)).length+1>=t)return a;let c=i.length;i.push(s);let l=new Set(s);l.add(c);for(let t of e.boundNames)r.set(t,l)}return null},kt=e=>{if(e.kind!==`import`)return null;let t=e.declarationNode.parent;return T(t,`ImportDeclaration`)?t:null},At=new Set([`ParenthesizedExpression`,`TSAsExpression`,`TSSatisfiesExpression`,`TSTypeAssertion`,`TSNonNullExpression`,`TSInstantiationExpression`,`ChainExpression`]),A=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}},j=e=>{let t=e;for(;t.parent&&At.has(t.parent.type);)t=t.parent;return t},jt=e=>{if(T(e,`FunctionDeclaration`)&&T(e.id,`Identifier`))return e.id;let t=j(e),n=t.parent;return T(n,`VariableDeclarator`)&&n.init===t&&T(n.id,`Identifier`)?n.id:null},M=e=>{let t=e.property;return!e.computed&&T(t,`Identifier`)?t.name:e.computed&&T(t,`Literal`)?typeof t.value==`string`?t.value:null:e.computed&&T(t,`TemplateLiteral`)&&t.expressions.length===0?t.quasis[0]?.value.cooked??t.quasis[0]?.value.raw??null:null},Mt=e=>{let t=j(e);return!!(t.parent&&T(t.parent,`AwaitExpression`)&&t.parent.argument===t)},N=(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=A(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},Nt=(e,t)=>{if(!w(e)||e.async||!T(e.body,`BlockStatement`))return!1;let[n,r,i,a,o]=e.body.body.toReversed();if(!T(o,`VariableDeclaration`)||o.kind!==`const`||o.declarations.length!==1||!T(a,`IfStatement`)||a.alternate||!T(i,`VariableDeclaration`)||i.kind!==`const`||i.declarations.length!==1||!T(r,`ExpressionStatement`)||!T(n,`ReturnStatement`))return!1;let s=o.declarations[0],c=i.declarations[0];if(!s?.init||!c?.init||!n.argument)return!1;let l=A(s.init),u=A(r.expression);if(!T(l,`CallExpression`)||!T(u,`CallExpression`)||!T(l.callee,`MemberExpression`)||!T(u.callee,`MemberExpression`)||l.optional||u.optional||l.callee.optional||u.callee.optional||M(l.callee)!==`get`||M(u.callee)!==`set`||l.arguments.length!==1||u.arguments.length!==2)return!1;let d=N(l.callee.object,t);if(d?.kind!==`const`||!d.initializer||D(d.bindingIdentifier)||N(u.callee.object,t)!==d)return!1;let f=A(d.initializer);if(!T(f,`NewExpression`)||!T(f.callee,`Identifier`)||![`Map`,`WeakMap`].includes(f.callee.name)||!t.isGlobalReference(f.callee)||f.arguments.length!==0)return!1;let p=a.consequent;if(T(p,`BlockStatement`)){if(p.body.length!==1)return!1;p=p.body[0]}let m=t.symbolFor(s.id),h=t.symbolFor(c.id),g=l.arguments[0],_=u.arguments[0],v=u.arguments[1];if(!m||!h||!T(p,`ReturnStatement`)||!p.argument||!g||!_||!v||t.symbolFor(A(a.test))!==m||t.symbolFor(A(p.argument))!==m||t.symbolFor(A(v))!==h||t.symbolFor(A(n.argument))!==h)return!1;let y=N(A(g),t);if(!y||y.references.some(e=>e.flag!==`read`)||y.kind!==`parameter`||D(y.bindingIdentifier)!==e||N(A(_),t)!==y)return!1;let b=l.callee.object,ee=u.callee.object;return d.references.every(e=>e.flag===`read`&&(e.identifier===b||e.identifier===ee))},Pt=e=>{let t=e;for(;t;){if(T(t,`Program`))return t;t=t.parent??null}return null},Ft=new WeakMap,It=(e,t)=>{t.push(...e.symbols);for(let n of e.children)It(n,t)},Lt=e=>{let t=new Map,n=[];It(e.rootScope,n);for(let r of n){let n=N(r.bindingIdentifier,e);if(!n)continue;let i=t.get(n.id)??[];i.push(r),t.set(n.id,i)}return t},Rt=(e,t)=>{let n=N(e,t);if(!n)return[];let r=Ft.get(t);return r||(r=Lt(t),Ft.set(t,r)),r.get(n.id)??[]},P=(e,t={})=>{if(!T(e,`Property`)&&!T(e,`MethodDefinition`)&&!T(e,`PropertyDefinition`)&&!T(e,`MemberExpression`))return null;let n=T(e,`MemberExpression`)?e.property:e.key;if(e.computed)return t.allowComputedString&&T(n,`Literal`)&&typeof n.value==`string`?n.value:t.allowComputedString&&t.stringifyNonStringLiterals&&T(n,`Literal`)?String(n.value):t.allowComputedString&&T(n,`TemplateLiteral`)&&n.expressions.length===0?n.quasis[0]?.value.cooked??n.quasis[0]?.value.raw??null:null;if(T(n,`Identifier`))return n.name;if(T(n,`Literal`)){if(typeof n.value==`string`)return n.value;if(t.stringifyNonStringLiterals)return String(n.value)}return null},zt=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},Bt=(e,t,n={})=>{let r=P(e,{allowComputedString:!0,stringifyNonStringLiterals:n.stringifyNonStringLiterals});if(r!==null||!T(e,`Property`)&&!T(e,`MethodDefinition`)&&!T(e,`PropertyDefinition`)&&!T(e,`MemberExpression`)||!e.computed)return r;let i=A(T(e,`MemberExpression`)?e.property:e.key);if(!T(i,`Identifier`))return null;let a=N(i,t);if(a?.kind!==`const`||!a.initializer)return null;let o=A(a.initializer);return T(o,`Literal`)?typeof o.value==`string`?o.value:n.allowConstNumericLiteral&&typeof o.value==`number`?String(o.value):null:n.allowConstTemplateLiteral&&T(o,`TemplateLiteral`)?zt(o):null},Vt=e=>{if(!w(e))return null;if(!T(e.body,`BlockStatement`))return e.body;if(e.body.body.length!==1)return null;let t=e.body.body[0];return T(t,`ReturnStatement`)&&t.argument?t.argument:null},Ht=new Set([`CatchClause`,`ConditionalExpression`,`DoWhileStatement`,`ForInStatement`,`ForOfStatement`,`ForStatement`,`IfStatement`,`LogicalExpression`,`SwitchCase`,`SwitchStatement`,`TryStatement`,`WhileStatement`]),Ut=(e,t)=>{let n=e.parent??null;for(;n&&n!==t;){if(Ht.has(n.type))return!1;n=n.parent??null}return n===t},Wt=e=>D(e)??Pt(e),Gt=e=>{let t=j(e),n=t.parent;return!!(n&&T(n,`VariableDeclarator`)&&n.init===t&&n.parent&&T(n.parent,`VariableDeclaration`)&&n.parent.kind===`const`)},Kt=e=>{let t=j(e),n=t.parent;return!!(n&&(T(n,`AssignmentExpression`)&&n.left===t||T(n,`UpdateExpression`)&&n.argument===t||T(n,`UnaryExpression`)&&n.operator===`delete`&&n.argument===t))},qt=e=>{let t=j(e),n=t.parent;return n&&T(n,`MemberExpression`)&&A(n.object)===t?n:null},Jt=(e,t,n,r,i)=>{if(i<=0||!T(e,`ObjectExpression`))return null;for(let a of e.properties.toReversed()){if(!T(a,`Property`))return null;let e=Bt(a,n);if(e===null)return null;if(e===t)return a.kind===`init`?F(a.value,n,r,i-1):null}return null},Yt=(e,t,n,r,i)=>{if(i<=0||!T(e,`ObjectExpression`))return[];let a=[],o=new Set;for(let s of e.properties){if(!T(s,`Property`))continue;let e=Bt(s,n),c=s.kind===`init`||s.kind===`get`?F(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},Xt=(e,t,n,r,i)=>{if(i<=0||!T(e,`ClassDeclaration`)&&!T(e,`ClassExpression`))return null;for(let a of e.body.body.toReversed()){if(!T(a,`MethodDefinition`)&&!T(a,`PropertyDefinition`)||!a.static)continue;let e=Bt(a,n);if(e===null)return null;if(e===t)return T(a,`MethodDefinition`)&&a.kind!==`method`?null:a.value?F(a.value,n,r,i-1):null}return null},Zt=(e,t,n,r,i)=>{if(i<=0||!T(e,`ClassDeclaration`)&&!T(e,`ClassExpression`))return[];let a=[],o=new Set;for(let s of e.body.body){if(!T(s,`MethodDefinition`)&&!T(s,`PropertyDefinition`)||!s.static)continue;let e=Bt(s,n),c=s.value&&(!T(s,`MethodDefinition`)||s.kind===`method`||s.kind===`get`)?F(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},Qt=(e,t,n,r,i,a,o,s)=>{let c=Wt(t);if(s<=0||!c||!T(e,`Identifier`))return{exactFunction:null,possibleFunctions:[]};let l=[];for(let r of Rt(e,a))for(let e of r.references){let r=e.identifier;if(r.range[0]>=t.range[0]||Gt(r))continue;let i=qt(r);if(!i){Wt(r)===c&&l.push({assignedExpression:null,isDefinite:!1,offset:r.range[0]});continue}if(!Kt(i)||Wt(i)!==c)continue;let o=Bt(i,a),s=j(i).parent,u=s&&T(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||!T(s,`AssignmentExpression`)||s.operator!==`=`||!Ut(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?F(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}},$t=(e,t,n,r)=>{if(r<=0||!T(e,`MemberExpression`))return{exactFunction:null,possibleFunctions:[]};let i=M(e);if(i===null)return{exactFunction:null,possibleFunctions:[]};let a=A(e.object);if(T(a,`ObjectExpression`))return{exactFunction:Jt(a,i,t,n,r),possibleFunctions:Yt(a,i,t,n,r)};if(T(a,`ClassExpression`))return{exactFunction:Xt(a,i,t,n,r),possibleFunctions:Zt(a,i,t,n,r)};if(!T(a,`Identifier`))return{exactFunction:null,possibleFunctions:[]};let o=N(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=A(o.initializer);s=Jt(e,i,t,n,r),c=Yt(e,i,t,n,r)}else o.kind===`class`&&o.initializer&&(s=Xt(o.initializer,i,t,n,r),c=Zt(o.initializer,i,t,n,r));return Qt(a,e,i,s,c,t,n,r)},en=(e,t,n,r)=>{if(r<=0)return[];let i=A(e);if(T(i,`CallExpression`)){let e=A(i.callee);return T(e,`MemberExpression`)&&M(e)===`bind`?en(e.object,t,n,r-1):[]}if(T(i,`MemberExpression`)){let e=M(i);return e===`call`||e===`apply`?en(i.object,t,n,r-1):$t(i,t,n,r).possibleFunctions}let a=F(i,t,n,r);return a?[a]:[]},F=(e,t,n,r)=>{let i=A(e);if(w(i))return i;if(r<=0)return null;if(T(i,`CallExpression`)){let e=A(i.callee);if(T(e,`MemberExpression`)&&M(e)===`bind`)return F(e.object,t,n,r-1);if(!i.arguments.every(e=>T(e,`Literal`)))return null;let a=F(e,t,n,r-1);if(!w(a)||a.async||a.generator||!a.params.every(e=>T(e,`Identifier`)))return null;let o=Vt(a),s=o&&A(o);return w(s)?s:null}if(T(i,`MemberExpression`)){let e=M(i);return e===`call`||e===`apply`?F(i.object,t,n,r-1):$t(i,t,n,r).exactFunction}if(!T(i,`Identifier`))return null;let a=N(i,t);return!a||n.has(a.id)?null:(n.add(a.id),a.kind===`function`?!a.references.some(e=>e.flag!==`read`)&&w(a.declarationNode)?a.declarationNode:null:a.kind!==`const`||!a.initializer?null:F(a.initializer,t,n,r-1))},tn=(e,t)=>F(e,t,new Set,15),nn=(e,t)=>en(e,t,new Set,15),rn=(e,t)=>{if(!T(e,`CallExpression`)||!T(e.callee,`MemberExpression`)||M(e.callee)!==`join`)return!1;let n=A(e.callee.object);for(let e=0;e<15;e++){if(T(n,`ArrayExpression`))return!0;if(T(n,`Identifier`)){let e=N(n,t);if(!e?.initializer||e.references.some(e=>e.flag!==`read`))return!1;n=A(e.initializer);continue}if(!T(n,`CallExpression`))return!1;let e=A(n.callee);if(T(e,`MemberExpression`)&&[`map`,`filter`,`slice`].includes(M(e)??``)){n=A(e.object);continue}let r=tn(e,t);return!!(w(r)&&!r.async&&T(r.returnType,`TSTypeAnnotation`)&&T(r.returnType.typeAnnotation,`TSArrayType`))}return!1},an=(e,t)=>{if(!T(e,`Program`))return null;let n=new Map,r=new Map,i=null,a=null,o=e=>{for(let t of e.declarations??[])T(t,`VariableDeclarator`)&&(!T(t.id,`Identifier`)||!t.init||n.set(t.id.name,A(t.init)))};for(let t of e.body??[]){if(T(t,`ImportDeclaration`)){if(t.importKind===`type`)continue;for(let e of t.specifiers??[])T(e,`ImportSpecifier`)&&e.importKind===`type`||(T(e,`ImportDefaultSpecifier`)||T(e,`ImportNamespaceSpecifier`)||T(e,`ImportSpecifier`))&&T(e.local,`Identifier`)&&n.set(e.local.name,e.local);continue}if(T(t,`VariableDeclaration`)){o(t);continue}if(T(t,`FunctionDeclaration`)&&t.id){n.set(t.id.name,t);continue}if(T(t,`ExportNamedDeclaration`)){if(t.exportKind===`type`)continue;let e=t.declaration;if(e&&T(e,`VariableDeclaration`)){o(e);for(let t of e.declarations??[])T(t,`VariableDeclarator`)&&T(t.id,`Identifier`)&&r.set(t.id.name,t.id.name)}else e&&T(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(!T(e,`ExportSpecifier`)||e.exportKind===`type`)continue;let t=T(e.local,`Identifier`)?e.local.name:null,n=null;T(e.exported,`Identifier`)?n=e.exported.name:T(e.exported,`Literal`)&&typeof e.exported.value==`string`&&(n=e.exported.value),t&&n&&r.set(n,t)}continue}if(!T(t,`ExportDefaultDeclaration`))continue;let e=t.declaration;e&&(T(e,`Identifier`)?a=e.name:((T(e,`FunctionDeclaration`)||T(e,`ClassDeclaration`))&&e.id&&n.set(e.id.name,e),i=A(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},on=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 in i){if(n===`parent`||!Object.hasOwn(i,n))continue;let r=i[n];if(Array.isArray(r))for(let n=0;n<r.length;n+=1){let i=r[n];C(i)&&t(i,e)}else C(r)&&t(r,e)}};t(e,null)},sn={".ts":`ts`,".tsx":`tsx`,".js":`js`,".jsx":`jsx`,".mjs":`js`,".cjs":`js`,".mts":`ts`,".cts":`ts`},cn=t=>sn[e.extname(t).toLowerCase()]??`tsx`;let ln=process.platform!==`win32`&&a();const un=(e,t)=>({astType:`ts`,lang:cn(e),experimentalRawTransfer:t}),dn=(e,t)=>{if(ln)try{return i(e,t,un(e,!0))}catch{ln=!1}return i(e,t,un(e,!1))},fn=({filename:e,sourceText:t,shouldAttachParentReferences:n=!0})=>{try{let r=dn(e,t);if(r.errors.some(e=>e.severity===`Error`))return null;let i=r.program;return n&&on(i),i}catch{return null}},pn=new Map,mn=(e,t)=>{if(pn.delete(e),pn.set(e,t),pn.size>256){let e=pn.keys().next().value;e!==void 0&&pn.delete(e)}},hn=e=>{e.endsWith(`.d.ts`)||e.endsWith(`.d.mts`)||e.endsWith(`.d.cts`)||S(e);let n;try{n=t.statSync(e,{throwIfNoEntry:!1})}catch{return null}if(!n?.isFile()||n.size>2e6)return null;let r=pn.get(e);if(r&&r.mtimeMs===n.mtimeMs&&r.size===n.size)return mn(e,r),r.program;if(e.endsWith(`.d.ts`)||e.endsWith(`.d.mts`)||e.endsWith(`.d.cts`))return mn(e,{mtimeMs:n.mtimeMs,size:n.size,program:null}),null;let i;try{i=t.readFileSync(e,`utf8`)}catch{return mn(e,{mtimeMs:n.mtimeMs,size:n.size,program:null}),null}let a=fn({filename:e,sourceText:i});return mn(e,{mtimeMs:n.mtimeMs,size:n.size,program:a}),a},gn=[`.ts`,`.tsx`,`.js`,`.jsx`,`.mjs`,`.cjs`,`.mts`,`.cts`],_n=[`import`,`default`,`module`,`browser`,`require`],vn=[`module`,`main`,`browser`],yn={isDirectory:!0,isFile:!1},bn={isDirectory:!1,isFile:!0},xn={isDirectory:!1,isFile:!1},Sn=new Map,Cn=new Map,wn=e=>{ge(e);let n=Sn.get(e);if(n)return n;let r=xn;try{let n=t.statSync(e,{throwIfNoEntry:!1});n?.isFile()?r=bn:n?.isDirectory()&&(r=yn)}catch{return Sn.set(e,xn),xn}return Sn.set(e,r),r},Tn=e=>wn(e).isFile?e:null,En=e=>wn(e).isDirectory?e:null,Dn=t=>{let n=e.extname(t);if(!gn.includes(n))return gn.map(e=>`${t}${e}`);let r=t.slice(0,-n.length);return n===`.js`?[t,`${r}.ts`,`${r}.tsx`,`${r}.jsx`]:n===`.jsx`?[t,`${r}.tsx`]:n===`.mjs`?[t,`${r}.mts`]:n===`.cjs`?[t,`${r}.cts`]:[t]},On=e=>typeof e==`object`&&!!e,kn=e=>{if(typeof e==`string`)return e;if(Array.isArray(e)){for(let t of e){let e=kn(t);if(e)return e}return null}if(!On(e))return null;for(let t of _n){let n=kn(e[t]);if(n)return n}return null},An=e=>{let t=e.exports;return t?kn(t)||(On(t)?kn(t[`.`]):null):null},jn=e=>{S(e);let n=Cn.get(e);if(n!==void 0)return n;let r;try{r=JSON.parse(t.readFileSync(e,`utf8`))}catch{r=null}return Cn.set(e,r),r},Mn=t=>Pn(t)||Pn(e.join(t,`index`)),Nn=t=>{let n=En(t);if(!n)return null;let r=jn(e.join(n,`package.json`));if(!r)return null;let i=An(r)??vn.map(e=>r[e]).find(e=>typeof e==`string`);return i?Mn(e.resolve(n,i)):null},Pn=e=>{let t=Tn(e);if(t)return t;for(let t of Dn(e)){let e=Tn(t);if(e)return e}return null},Fn=t=>Pn(t)||Nn(t)||Pn(e.join(t,`index`)),In=(t,n)=>Fn(e.resolve(e.dirname(t),n)),Ln=()=>{Sn.clear(),Cn.clear()},Rn=[`tsconfig.json`,`jsconfig.json`],zn=e=>typeof e==`object`&&!!e,Bn=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`)},Vn=(e,n)=>{S(e),n.push(e);let r;try{r=t.readFileSync(e,`utf8`)}catch{return null}try{let e=JSON.parse(Bn(r));return zn(e)?e:null}catch{return null}},Hn=(t,n)=>{let r=t.endsWith(`.json`)?t:`${t}.json`;return t.startsWith(`./`)||t.startsWith(`../`)?e.resolve(n,r):e.join(n,`node_modules`,r)},Un=e=>{let t=new Map;if(!zn(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},Wn=(t,n,r)=>{let i=Vn(t,r);if(!i)return null;let a=e.dirname(t),o=zn(i.compilerOptions)?i.compilerOptions:{},s=typeof o.baseUrl==`string`?o.baseUrl:null,c=s!==null,l=s===null?a:e.resolve(a,s);if(zn(o.paths))return{baseAbsolutePath:l,hasExplicitBaseUrl:c,paths:Un(o.paths)};if(typeof i.extends==`string`&&n<8){let e=Hn(i.extends,a),t=e?Wn(e,n+1,r):null;if(t)return t}return c?{baseAbsolutePath:l,hasExplicitBaseUrl:c,paths:new Map}:null},Gn=new Map,Kn=new Map,qn=e=>{S(e);let n;try{n=t.statSync(e,{throwIfNoEntry:!1})}catch{n=void 0}if(n===void 0)return{config:null,probedContentPaths:new Set([e])};let r=Gn.get(e);if(r&&r.mtimeMs===n.mtimeMs){for(let e of r.probedChainPaths)S(e);return{config:r.config,probedContentPaths:new Set(r.probedChainPaths)}}let i=[],a=Wn(e,0,i);return Gn.set(e,{mtimeMs:n.mtimeMs,config:a,probedChainPaths:i}),{config:a,probedContentPaths:new Set(i)}},Jn=(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);Kn.set(a.directory,{config:t.config,directoryCount:i,probedContentPaths:new Set(r)})}},Yn=t=>{let n=Kn.get(t);if(n!==void 0){for(let e of n.probedContentPaths)S(e);return n.config}let r=[],i=t;for(let t=0;t<30;t++){let n=Kn.get(i),a=30-t;if(n!==void 0&&n.directoryCount<=a){for(let e of n.probedContentPaths)S(e);return Jn(r,n,n.directoryCount),n.config}let o=new Set;for(let t of Rn){let n=qn(e.join(i,t));for(let e of n.probedContentPaths)o.add(e);if(n.config)return r.push({directory:i,probedContentPaths:o}),Jn(r,{config:n.config,probedContentPaths:new Set},0),n.config}r.push({directory:i,probedContentPaths:o});let s=e.dirname(i);if(s===i)return Jn(r,{config:null,probedContentPaths:new Set},0),null;i=s}let a=new Set;for(let e of r)for(let t of e.probedContentPaths)a.add(t);return Kn.set(t,{config:null,directoryCount:r.length,probedContentPaths:a}),null},Xn=(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},Zn=(t,n)=>{let r=Yn(e.dirname(t));if(!r)return null;let i=null,a=``,o=-1;for(let e of r.paths.keys()){let t=Xn(n,e);if(t===null)continue;let r=e.indexOf(`*`),s=r===-1?e.length:r;s>o&&(i=e,a=t,o=s)}if(i)for(let t of r.paths.get(i)??[]){let n=t.replaceAll(`*`,a),i=Fn(e.resolve(r.baseAbsolutePath,n));if(i)return i}return r.hasExplicitBaseUrl?Fn(e.resolve(r.baseAbsolutePath,n)):null},Qn=()=>{Gn.clear(),Kn.clear()},$n=(t,n)=>e.isAbsolute(n)?null:n.startsWith(`.`)?In(t,n):Zn(t,n),er=new Map,tr=()=>{er.clear()},nr=(e,t,n)=>{if(n.size>=4||n.has(e))return null;n.add(e);let r=hn(e);if(!r)return null;let i=an(r,t);if(i)return{filePath:e,exportedNode:i,programNode:r};let a=new Map;for(let i of St(r,t)){let t=$n(e,i.source);if(!t)continue;let r=nr(t,i.importedName,new Set(n));r&&a.set(r.exportedNode,r)}return a.size===1?a.values().next().value??null:null},rr=(e,t,n)=>ir(e,t,n)?.functionNode??null,ir=(e,t,n)=>{let r=I(e,t,n);return!r||!w(r.exportedNode)?null:{filePath:r.filePath,functionNode:r.exportedNode,programNode:r.programNode}},I=(e,t,n)=>{if(!_e()){let r=$n(e,t);return r?nr(r,n,new Set):null}let r=`${e}\0${t}\0${n}`,i=er.get(r);if(i!==void 0){for(let e of i.trace.contentPaths)S(e);for(let e of i.trace.existencePaths)ge(e);return i.result}let a=ve(()=>{let r=$n(e,t);return r?nr(r,n,new Set):null});return er.set(r,{result:a.value,trace:a.trace}),a.value},ar=(e,t)=>{let n=e,r=Le[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];C(n)&&t.push(n)}else C(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];C(n)&&t.push(n)}else C(a)&&t.push(a)}},or=(e,t)=>{let n=e,r=Le[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];C(n)&&t(n)}else C(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];C(n)&&t(n)}else C(r)&&t(r)}},L=(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||ar(e,n)}},sr=new WeakMap,cr=new Set([`TSStringKeyword`,`TSNumberKeyword`,`TSBooleanKeyword`]),lr=new Set([`String`,`Number`,`Boolean`]),ur=(e,t,n)=>{let r=[],i=15,a=(e,t,n,o,s,c)=>{let l=e=>{let r=N(A(e),o);return!r||r.references.some(e=>e.flag!==`read`)?null:t.has(r.bindingIdentifier)?t.get(r.bindingIdentifier)??null:n&&D(r.bindingIdentifier)===n?null:r.bindingIdentifier};L(e,e=>{if(w(e)||T(e,`ClassDeclaration`)||T(e,`ClassExpression`))return!1;if(c&&T(e,`AwaitExpression`)&&!T(A(e.argument),`CallExpression`)&&r.push({binding:e,member:null,inputs:[],crossFile:!0}),!T(e,`CallExpression`))return;let n=A(e.callee);if(e.optional||T(n,`MemberExpression`)&&n.optional)return c&&r.push({binding:e,member:null,inputs:[],crossFile:!0}),!1;let u=e.arguments.map(l),d=T(n,`MemberExpression`)?A(n.object):n,f=N(d,o),p=T(n,`Identifier`)&&(f?.kind===`function`||w(f?.initializer))?tn(n,o):null,m=o,h=s,g=c;if(f?.kind===`import`){let e=T(n,`MemberExpression`)?M(n):null,t=f.declarationNode,a=kt(f),o=null;if(T(t,`ImportNamespaceSpecifier`)?o=e:T(n,`Identifier`)&&(o=vt(t)),s&&i>0&&o&&a&&a.importKind!==`type`&&(!T(t,`ImportSpecifier`)||t.importKind!==`type`)){i--;let e=ir(s,a.source.value,o);e&&(p=e.functionNode,m=sr.get(e.programNode)??ft(e.programNode),sr.set(e.programNode,m),h=e.filePath,g=!0)}!p&&!c&&(T(n,`Identifier`)||e!==null)&&r.push({binding:f.bindingIdentifier,member:e,inputs:u})}else if(!c&&T(n,`MemberExpression`)&&M(n)===`get`&&f?.kind===`const`&&f.initializer){let e=A(f.initializer);if(T(e,`NewExpression`)&&T(e.callee,`Identifier`)&&(e.callee.name===`Map`||e.callee.name===`WeakMap`)&&o.isGlobalReference(e.callee)){let e=l(d);e&&r.push({binding:e,member:`get`,inputs:[u[0]??null]})}}if(g&&p){let t=jt(p),n=t?m.symbolFor(t):null;if(n&&(n.kind!==`const`&&n.kind!==`function`||n.references.some(e=>e.flag!==`read`)))return r.push({binding:e,member:null,inputs:[],crossFile:!0}),!1}if(g&&p&&Nt(p,m))return r.push({binding:p,member:null,inputs:u,crossFile:!0}),!1;if(!w(p)||i<=0){c&&(i<=0||f?.kind===`import`||Mt(e)||T(e.parent,`ReturnStatement`)&&!rn(e,o)&&!(T(n,`Identifier`)&&lr.has(n.name)&&o.isGlobalReference(n))||T(n,`Identifier`)&&n.name===`fetch`&&o.isGlobalReference(n))&&r.push({binding:e,member:null,inputs:[],crossFile:!0});return}if(c&&!p.async&&!Mt(e)&&(!T(e.parent,`ReturnStatement`)||T(p.returnType,`TSTypeAnnotation`)&&cr.has(p.returnType.typeAnnotation.type)))return;i--;let _=new Map(t);for(let[e,t]of p.params.entries()){let n=m.symbolFor(t);n&&_.set(n.bindingIdentifier,u[e]??null)}a(p.body,_,p,m,h,g)})};for(let r of Et(e)?.awaitedExpressions??[])a(r,new Map,null,t,n,!1);return r},dr=(e,t,n,r)=>{let i=ur(e,n,r);if(i.length===0)return!1;let a=ur(t,n,r),o=e=>i.some(t=>t.binding===e.binding&&t.member===e.member&&t.inputs.length>0&&t.inputs.length===e.inputs.length&&t.inputs.every((t,n)=>t!==null&&t===e.inputs[n]));return a.some(o)&&(!a.some(e=>e.crossFile)||a.every(o))},fr=`(?:tsx?|jsx?|mts|mjs)`,pr=RegExp(`/page\\.${fr}$`),mr=RegExp(`/(page|layout)\\.${fr}$`),hr=[`layout.tsx`,`layout.jsx`,`layout.ts`,`layout.js`,`layout.mts`,`layout.mjs`],gr=[`metadata`,`generateMetadata`],_r=/\/(?:(?:\((?:dashboard|admin|settings|account|internal|manage|console|portal|auth|onboarding|app|ee|protected)\))|(?:dashboard|admin|settings|account|internal|manage|console|portal))\//i,vr=new Set([`redirect`,`permanentRedirect`,`notFound`,`forbidden`,`unauthorized`]),yr=new Set([`revalidateTag`,`revalidatePath`,`expireTag`,`expirePath`,`unstable_expireTag`,`unstable_expirePath`]),br=/fonts\.googleapis\.com/,xr=/polyfill\.io|polyfill\.min\.js|cdn\.polyfill/,Sr=RegExp(`/route\\.${fr}$`),Cr=/\/(?:cron|jobs\/cron)(?:\/|$)/i,wr=new Set([`logout`,`log-out`,`signout`,`sign-out`,`unsubscribe`,`delete`,`remove`,`revoke`,`cancel`,`deactivate`]),Tr=RegExp(`/(error|global-error)\\.${fr}$`),Er=RegExp(`/global-error\\.${fr}$`),Dr=new Set([`GET`,`POST`,`PUT`,`PATCH`,`DELETE`,`OPTIONS`,`HEAD`]),Or=/google-analytics\.com|googletagmanager\.com\/gtag/,kr=RegExp(`/(opengraph-image|twitter-image)\\d*\\.${fr}$`),Ar=new Set([`expo`,`expo-router`,`@expo/cli`,`@expo/metro-config`,`@expo/metro-runtime`]),jr=new Set([`react-native`,`react-native-tvos`,...Ar,`react-native-windows`,`react-native-macos`]),Mr=[`@react-native/`,`@react-native-`],Nr=e=>Ar.has(e),Pr=e=>{if(jr.has(e))return!0;for(let t of Mr)if(e.startsWith(t))return!0;return!1},Fr=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`]),Ir=[`dependencies`,`devDependencies`,`peerDependencies`,`optionalDependencies`],Lr=function*(e){for(let t of Ir){let n=e[t];if(n)for(let e of Object.keys(n))yield e}},Rr=e=>{if(typeof e[`react-native`]==`string`)return!0;for(let t of Lr(e))if(Pr(t))return!0;return!1},zr=e=>{for(let t of Lr(e))if(Nr(t))return!0;return!1},Br=e=>{for(let t of Lr(e))if(Fr.has(t))return!0;return!1},Vr=e=>Ir.some(t=>{let n=e[t];return typeof n==`object`&&!!n&&Object.keys(n).length>0}),Hr=(e,t)=>Ir.some(n=>{let r=e[n];return typeof r==`object`&&!!r&&Object.prototype.propertyIsEnumerable.call(r,t)}),Ur=new WeakMap,Wr=e=>{let t=De(e);if(!t)return`unknown`;let n=Ur.get(t);if(n!==void 0)return n;let r;return r=zr(t)?`expo`:Rr(t)?`react-native`:Br(t)?`web`:Vr(t)?`neutral`:`unknown`,Ur.set(t,r),r},Gr=({absoluteFilePath:e,staticImports:t,program:n})=>{let r=new Set;if(L(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&&rr(e,n.moduleRequest.value,a)}},Kr=e=>e.replace(/^type\s+/,``).trim(),qr=(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=Kr(r??``);return{localName:a,exportedName:Kr(i??a),isTypeOnly:n}}),Jr=/\/\*[\s\S]*?\*\//g,Yr=/^\s*\/\/.*$/gm,Xr=e=>e.replace(Jr,``).replace(Yr,``),Zr=/^\s*export\s+default\b/m,Qr=/^\s*export\s+(?:declare\s+)?(?:(?:async\s+)?function|(?:abstract\s+)?class|const|let|var|enum|interface|type)\s+([\w$]+)/gm,$r=/^\s*export\s+(?:type\s+)?\{([\s\S]*?)\}(?:\s+from\s+["'][^"']+["'])?\s*;?\s*(?:(?:\/\/[^\n]*)?\s*)/gm,ei=e=>{let t=Xr(e),n=new Set;Zr.test(t)&&n.add(`default`);for(let e of t.matchAll(Qr))e[1]&&n.add(e[1]);for(let e of t.matchAll($r)){let t=e[1]??``;for(let e of qr(t,!1))n.add(e.exportedName)}return n},ti=new Map,ni=(e,n)=>{S(e);try{let r=t.statSync(e,{throwIfNoEntry:!1});if(r===void 0)return!1;let i=ti.get(e);if(i&&i.mtimeMs===r.mtimeMs&&i.size===r.size)return i.exportedNames.has(n);let a=ei(t.readFileSync(e,`utf8`));return ti.set(e,{mtimeMs:r.mtimeMs,size:r.size,exportedNames:a}),a.has(n)}catch{return!1}},ri=(t,n)=>{let r=t.replaceAll(`\\`,`/`),i=e.dirname(r);for(let t=0;t<30;t++){for(let t of hr){let a=e.join(i,t);if(a.replaceAll(`\\`,`/`)!==r&&n(a))return!0}let t=e.dirname(i);if(e.basename(i)===`app`&&e.basename(t)!==`app`||t===i)break;i=t}return!1},ii=e=>ri(e,e=>gr.some(t=>ni(e,t))),R=e=>{if(!T(e,`ImportSpecifier`))return;let t=e.imported;if(T(t,`Identifier`))return t.name;if(T(t,`Literal`)&&typeof t.value==`string`)return t.value},ai=e=>T(e,`JSXIdentifier`)?e.name===`Suspense`:T(e,`JSXMemberExpression`)&&T(e.property,`JSXIdentifier`)&&e.property.name===`Suspense`,oi=e=>{let t=!1;return L(e,e=>{if(t)return!1;if(T(e,`JSXOpeningElement`)&&ai(e.name)||T(e,`ImportDeclaration`)&&e.source?.value===`react`&&(e.specifiers??[]).some(e=>T(e,`ImportSpecifier`)&&R(e)===`Suspense`))return t=!0,!1}),t},si=e=>ri(e,e=>{let t=hn(e);return!!(t&&oi(t))}),ci=e=>{if(T(e,`ImportDeclaration`)){if(e.importKind===`type`||e.specifiers.length>0&&e.specifiers.every(e=>T(e,`ImportSpecifier`)&&e.importKind===`type`))return null}else if(T(e,`ExportNamedDeclaration`)){if(e.exportKind===`type`||!e.source||e.specifiers.length>0&&e.specifiers.every(e=>T(e,`ExportSpecifier`)&&e.exportKind===`type`))return null}else if(T(e,`ExportAllDeclaration`)){if(e.exportKind===`type`)return null}else return null;return e.source&&typeof e.source.value==`string`?e.source.value:null},li=/^index\.(?:[cm]?[jt]sx?|mjs)$/,ui=/^\s*import\s+(type\s+)?(?!["'])([^;]*?)\s+from\s+["']([^"']+)["']\s*;?\s*(?:(?:\/\/[^\n]*)?\s*)/gm,di=/^\s*export\s+(type\s+)?(?:\*(?:\s+as\s+([\w$]+))?|\{([\s\S]*?)\})\s+from\s+["']([^"']+)["']\s*;?\s*(?:(?:\/\/[^\n]*)?\s*)/gm,fi=/^\s*export\s+(type\s+)?\{([\s\S]*?)\}\s*;?\s*(?:(?:\/\/[^\n]*)?\s*)/gm,pi=new Map,mi=t=>li.test(e.basename(t)),hi=()=>({isBarrel:!1,exportsByName:new Map,starExportSources:[]}),gi=(e,t)=>{e.set(t.localName,{...t,didExport:!1})},_i=(e,t,n,r)=>{for(let i of qr(e,n))gi(r,{localName:i.exportedName,importedName:i.localName,source:t,isTypeOnly:i.isTypeOnly})},vi=(e,t,n,r)=>{let i=e.trim(),a=i.match(/(?:^|,\s*)\*\s+as\s+([\w$]+)/);a?.[1]&&gi(r,{localName:a[1],importedName:`*`,source:t,isTypeOnly:n});let o=i.match(/\{([\s\S]*?)\}/);o?.[1]&&_i(o[1],t,n,r);let s=i.split(`,`)[0]?.trim();s&&!s.startsWith(`{`)&&!s.startsWith(`*`)&&gi(r,{localName:s,importedName:`default`,source:t,isTypeOnly:n})},yi=(e,t,n,r)=>{let i=e.replace(ui,(e,n,r,i)=>(vi(r,i,!!n,t),``));return i=i.replace(di,(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 qr(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(fi,(e,r,i)=>{for(let a of qr(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},bi=e=>{for(let t of e.values())if(!t.isTypeOnly&&!t.didExport)return!0;return!1},xi=e=>{let t=Xr(e).trim();if(!t)return hi();let n=new Map,r=new Map,i=[];return yi(t,n,r,i).trim()||bi(n)?hi():{isBarrel:r.size>0||i.length>0,exportsByName:r,starExportSources:i}},Si=e=>{if(!mi(e))return hi();S(e);let n;try{n=t.statSync(e,{throwIfNoEntry:!1})??null}catch{n=null}let r=pi.get(e);if(r!==void 0&&n!==null&&r.mtimeMs===n.mtimeMs&&r.size===n.size)return r.moduleInfo;if(n===null)return hi();let i=hi();try{i=xi(t.readFileSync(e,`utf8`))}catch{i=hi()}return pi.set(e,{mtimeMs:n.mtimeMs,size:n.size,moduleInfo:i}),i},Ci=e=>Si(e).isBarrel,wi=e.join(`android`,`gradle.properties`),Ti=/^\s*newArchEnabled\s*=\s*false\s*$/m,Ei=[`app.config.ts`,`app.config.js`,`app.config.cjs`,`app.config.mjs`],Di=[`app.config.json`,`app.json`],Oi=new WeakMap,ki=t=>{S(e.join(t,wi));for(let n of Ei)ge(e.join(t,n));for(let n of Di)S(e.join(t,n))},Ai=e=>{try{return t.readFileSync(e,`utf-8`)}catch{return null}},ji=e=>{let t=e.dependencies?.[`react-native`]??e.devDependencies?.[`react-native`];return typeof t==`string`?t:null},Mi=e=>{let t=e.match(/(?:^|[^\d.])0\.(\d+)/);return t?Number.parseInt(t[1],10):null},Ni=t=>{let n=Ai(e.join(t,wi));return n!==null&&Ti.test(n)},Pi=n=>{for(let r of Ei)if(t.existsSync(e.join(n,r)))return!1;for(let t of Di){let r=Ai(e.join(n,t));if(r===null)continue;let i;try{i=JSON.parse(r)}catch{continue}if(typeof i!=`object`||!i)continue;let a=Object.getOwnPropertyDescriptor(i,`expo`)?.value;if(!(typeof a!=`object`||!a)&&Object.getOwnPropertyDescriptor(a,`newArchEnabled`)?.value===!1)return!0}return!1},Fi=(e,t)=>{let n=ji(t);if(n!==null){let e=Mi(n);if(e!==null&&e<76)return!0}return Ni(e)||Pi(e)},Ii=e=>{let t=Ee(e);if(!t)return!1;let n=De(e);if(!n)return!1;ki(t);let r=Oi.get(n);if(r!==void 0)return r;let i=Fi(t,n);return Oi.set(n,i),i},Li=e=>Fe(e,`ink`)?.version??null,Ri=(e,t)=>{let n=Li(e),r=me(t);return!!(n&&r&&he(n,r)>=0)},zi=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`]),Bi=new Set([`fetch`,`ky`,`got`,`wretch`,`ofetch`]),Vi=new Set([`axios`,`ky`,`got`,`ofetch`,`wretch`,`request`]),Hi=new Set([`create`,`insert`,`insertInto`,`update`,`upsert`,`delete`,`remove`,`destroy`,`set`,`append`]),Ui=new Set([`POST`,`PUT`,`DELETE`,`PATCH`]),Wi=new Set([`Map`,`Set`,`WeakMap`,`WeakSet`,`Headers`,`URLSearchParams`,`FormData`,`Response`,`NextResponse`]),Gi=new Set([`Response`,`NextResponse`]),Ki=new Set([`json`,`redirect`,`next`,`rewrite`,`error`]),qi=new Set([`wheel`,`mousewheel`,`touchstart`,`touchmove`]),Ji=new Set([`defer`,`async`]),Yi=new Set([`text/javascript`,`application/javascript`,`module`]),Xi=new Set([`setTimeout`,`setInterval`,`requestAnimationFrame`,`requestIdleCallback`,`queueMicrotask`]),Zi=new Set([`setInterval`,`setTimeout`]),Qi=new Set([`clearInterval`,`clearTimeout`]),$i=new Set([`WebSocket`,`EventSource`,`BroadcastChannel`,`RTCPeerConnection`]),ea=new Set([`location`,`window`,`document`,`navigator`,`history`,`screen`,`performance`]),ta=new Set([`IntersectionObserver`,`MutationObserver`,`ResizeObserver`,`PerformanceObserver`]),na=new Set([`blur`,`canPlayType`,`focus`,`getBoundingClientRect`,`getClientRects`,`measure`,`measureInWindow`,`measureLayout`,`scroll`,`scrollBy`,`scrollIntoView`,`scrollTo`,`select`,`setRangeText`,`setSelectionRange`]),ra=new Set([`localStorage`,`sessionStorage`]),ia=new Set([`index`,`idx`,`i`]),aa=new Set([`react`,`react-dom`,`preact/compat`,`preact/hooks`,`@wordpress/element`]),oa=new Set([`next`,`next-themes`,`@remix-run/react`,`swr`,`zustand`,`jotai`,`recoil`,`wouter`,`framer-motion`,`@apollo/client`,`urql`,`usehooks-ts`]),sa=new Set([`useState`,`useMemo`,`useRef`]),ca=new Set([`Click`,`Change`,`Input`,`Blur`,`Focus`]),la=new Set([`Boolean`,`String`,`Number`,`Array`,`Object`,`parseInt`,`parseFloat`]),ua=/^set[A-Z]/,da=/^render[A-Z]/,fa=/^[A-Z]/,pa=/^on[A-Z]/,ma=/^use[A-Z]/,ha=/^(?:on|handle)[A-Z]/,ga=new Set([`useEffect`,`useLayoutEffect`]),_a=new Set([`useEffect`,`useLayoutEffect`,`useMemo`,`useCallback`]),va=new Set([`use`,`useState`,`useRef`,`useMemo`,`useCallback`,`useReducer`,`useContext`,`useEffect`,`useLayoutEffect`,`useInsertionEffect`,`useImperativeHandle`,`useSyncExternalStore`,`useDeferredValue`,`useTransition`,`useId`,`useDebugValue`]),ya=new Set([`memo`,`forwardRef`,`React.memo`,`React.forwardRef`]),ba=new Set([`useMemo`,`useCallback`]),xa=new Set([`memo`,`forwardRef`,`observer`,`lazy`]),Sa=new Set([`subscribe`,`addEventListener`,`addListener`,`on`,`watch`,`listen`,`sub`]),Ca=new Set([`subscribe`,`sub`,`listen`]),wa=new Set([`unsubscribe`,`removeEventListener`,`removeListener`,`off`,`unwatch`,`unlisten`,`unsub`,`abort`,`disconnect`,`unobserve`,`close`]),Ta=new Set([`remove`,`cleanup`,`dispose`,`destroy`,`stop`,`teardown`]),Ea=new Set([...wa,`cleanup`,`dispose`,`destroy`,`teardown`]),Da=new Set([...Sa,`connect`,`disconnect`,`open`,`close`,`fetch`,`post`,`put`,`patch`]),Oa=new Set([`get`,`head`,`options`,`delete`]),ka=new Set([...Bi,...Xi]),Aa=new Set([...Bi,`post`,`put`,`patch`,`navigate`,`navigateTo`,`showNotification`,`toast`,`alert`,`confirm`,`logVisit`,`captureEvent`]),ja=new Set([`post`,`put`,`patch`,`delete`,`navigate`,`capture`,`track`,`logEvent`]),Ma=new Set([`push`,`replace`]),Na=new Set([`router`,`navigation`,`navigator`,`history`,`location`]),Pa={},Fa=new WeakMap,Ia=(e,t)=>typeof e==`string`?e===t:e.has(t),La=e=>{let t=Fa.get(e);if(t)return t;let n=e.declarationNode.parent,r=!!(e.kind===`import`&&n&&n.type===`ImportDeclaration`&&typeof n.source.value==`string`&&aa.has(n.source.value)),i={importedName:r?R(e.declarationNode):void 0,isReactImport:r};return Fa.set(e,i),i},Ra=e=>La(e).isReactImport,za=(e,t,n,r)=>{if(e.type!==`Identifier`)return!1;let i=r?N(e,n):n.symbolFor(e);if(!i)return!1;let a=La(i);return!!(a.isReactImport&&a.importedName&&Ia(t,a.importedName))},Ba=(e,t)=>{let n=N(e,t);if(!n)return!1;let r=La(n);return r.isReactImport?n.declarationNode.type===`ImportDefaultSpecifier`||n.declarationNode.type===`ImportNamespaceSpecifier`||r.importedName===`default`:!1},Va=(e,t,n)=>e.type===`Identifier`?Ba(e,t)?!0:!!(n.allowGlobalReactNamespace&&e.name===`React`&&t.isGlobalReference(e)):!1,Ha=(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=P(e);return!!(a&&Ia(t,a)&&Va(A(i.initializer),n,r))}return!1},Ua=(e,t,n,r=Pa)=>e.type===`CallExpression`?Wa(e.callee,t,n,r):!1,Wa=(e,t,n,r,i)=>{let a=A(e);if(r.resolveConditionalAliases&&a.type===`ConditionalExpression`)return Wa(a.consequent,t,n,r,new Set(i))&&Wa(a.alternate,t,n,r,new Set(i));if(a.type===`Identifier`){if(za(a,t,n,!!r.resolveNamedAliases)||r.resolveNamedAliases&&Ha(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),Wa(e.initializer,t,n,r,a)}}return!!(r.allowUnboundBareCalls&&Ia(t,a.name)&&n.isGlobalReference(a))}return a.type!==`MemberExpression`||!Ia(t,M(a)??``)?!1:Va(A(a.object),n,r)},z=e=>e.includes(`\\`)?e.replaceAll(`\\`,`/`):e,Ga=e=>{let t=new Set(e);if(t.size!==1)return null;let[n]=t;return n??null},Ka=(e,t,n,r)=>{let i=In(e,n);return i?qa(i,t,new Set(r))||(ni(i,t)?i:null):null},qa=(e,t,n=new Set)=>{if(n.has(e))return null;n.add(e);let r=Si(e);if(!r.isBarrel)return null;let i=r.exportsByName.get(t);if(i){let t=In(e,i.source);return t?qa(t,i.importedName,n)??t:null}return t===`default`?null:Ga(r.starExportSources.map(r=>Ka(e,t,r,n)).filter(e=>!!e))},Ja=(e,t,n)=>{let r=I(e,t,n);return r?{filePath:r.filePath,node:r.exportedNode,programNode:r.programNode,kind:w(r.exportedNode)?`function`:`initializer`}:null},Ya=(e,t)=>{if(!T(e,`ArrowFunctionExpression`)&&!T(e,`FunctionExpression`)&&!T(e,`FunctionDeclaration`))return null;let n=e.params[0],r=T(n,`AssignmentPattern`)?n.left:n;if(T(r,`ObjectPattern`)){let e=r.properties.find(e=>T(e,`Property`)&&P(e,{allowComputedString:!0})===`children`);if(!e||!T(e,`Property`))return null;let n=T(e.value,`AssignmentPattern`)?e.value.left:e.value;if(!T(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(!T(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=j(e.identifier);for(;n.parent&&T(n.parent,`MemberExpression`)&&n.parent.object===n;){let e=M(n.parent);if(!e)return null;t.push(e),n=j(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},Xa=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},Za=new WeakMap,Qa=e=>{let t=Pt(e);if(!t)return null;let n=Za.get(t);return n||(n=Xa(t),Za.set(t,n)),n},$a=(e,t)=>{let n=Qa(e);if(!n)return!1;for(let e of n.values())if(t.includes(e.source))return!0;return!1},eo=(e,t,n)=>{let r=Qa(e);if(!r)return!1;let i=r.get(t);return i?i.source===n:!1},to=(e,t,n)=>{let r=Qa(e);if(!r)return!1;let i=r.get(t);return i?i.isNamespace&&i.source===n:!1},no=(e,t,n)=>{let r=Qa(e);if(!r)return!1;let i=r.get(t);return i?i.isDefault&&i.source===n:!1},ro=(e,t,n)=>{let r=Qa(e);if(!r)return null;let i=r.get(t);return!i||i.source!==n?null:i.imported},io=(e,t)=>{let n=Qa(e);return n?n.get(t)?.source??null:null},ao=(e,t)=>{let n=Qa(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},oo=(e,t)=>{let n=e.parent;for(;n;){if(`typeParameters`in n){let e=n.typeParameters;if(e&&T(e,`TSTypeParameterDeclaration`)&&e.params.some(e=>T(e,`TSTypeParameter`)&&T(e.name,`Identifier`)&&e.name.name===t))return!0}n=n.parent}return!1},so=e=>{if(!T(e,`Identifier`)||oo(e,e.name))return!1;let t=ao(e,e.name);return!!(t&&t.source===`react`&&(t.isNamespace||t.exportedName===`default`))},co=e=>{let t=Pt(e);return!t||!T(t,`Program`)?!1:t.body.some(e=>T(e,`TSModuleDeclaration`)&&T(e.id,`Identifier`)&&e.id.name===`JSX`)},lo=(e,t)=>{if(!T(e,`TSTypeReference`))return!1;let n=e.typeName;if(T(n,`Identifier`)){if(oo(n,n.name))return!1;let e=ro(n,n.name,`react`);return e===`ReactElement`||t&&e===`ReactNode`}if(!T(n,`TSQualifiedName`)||!T(n.right,`Identifier`))return!1;if((n.right.name===`ReactElement`||t&&n.right.name===`ReactNode`)&&so(n.left))return!0;if(n.right.name!==`Element`)return!1;if(T(n.left,`Identifier`)){if(n.left.name!==`JSX`)return!1;let e=ao(n.left,n.left.name);return e?e.source===`react`&&e.exportedName===`JSX`:!co(n.left)}return T(n.left,`TSQualifiedName`)&&T(n.left.right,`Identifier`)&&n.left.right.name===`JSX`&&so(n.left.left)},uo=(e,t)=>T(e,`TSUnionType`)?t?e.types.every(e=>T(e,`TSNullKeyword`)||T(e,`TSUndefinedKeyword`)||uo(e,t)):e.types.some(e=>uo(e,t)):lo(e,t),fo=(e,t=!1)=>{let n=Reflect.get(e,`returnType`);return T(n,`TSTypeAnnotation`)?uo(n.typeAnnotation,t):!1},po=e=>{let t=e,n=t.parent;for(;n&&A(n)===e;)t=n,n=t.parent;return n&&T(n,`AssignmentExpression`)&&n.operator===`=`&&n.left===t?n.right:null},mo=e=>{let t=e.range?.[0];return typeof t==`number`?t:null},ho=new Set([`let`,`var`]),go=new Set([`ConditionalExpression`,`LogicalExpression`]),_o=new WeakMap,vo=(e,t,n)=>{let r=e.parent??null;for(;r&&n.blockOf(r)===t;){if(go.has(r.type))return!0;r=r.parent??null}return!1},yo=(e,t)=>e.size===t.size&&[...e].every(e=>t.has(e)),bo=(e,t)=>{let n=new Set(e);for(let e of t)e.isConditionalWithinBlock||(n=new Set),n.add(e);return n},xo=(e,t,n)=>{let r=D(t);if(D(e.bindingIdentifier)!==r||!r)return[];let i=n.cfgFor(r);if(!i)return[];let a=i.blockOf(t);if(!a)return[];let o=mo(t),s=mo(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:vo(t,r,i)}),c.set(r,a)};e.initializer&&l(e.initializer,e.bindingIdentifier,s);for(let t of e.references){let e=mo(t.identifier);if(t.flag===`read`||D(t.identifier)!==r||e===null||e>=o)continue;let n=po(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=bo(t,c.get(e)??[]),r=u.get(e)??new Set,i=d.get(e)??new Set;(!yo(t,r)||!yo(n,i))&&(u.set(e,t),d.set(e,n),m=!0)}}let h=(c.get(a)??[]).filter(e=>e.position<o);return[...bo(u.get(a)??new Set,h)].map(e=>e.expression)},So=(e,t,n)=>{if(!ho.has(e.kind))return e.initializer?[e.initializer]:[];if(!n)return[];let r=_o.get(n);r||(r=new WeakMap,_o.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=xo(e,t,n);return i.set(t,o),o},Co=e=>{if(!w(e)||!T(e.body,`BlockStatement`))return[];let t=[];return L(e.body,n=>{if(n!==e.body&&(w(n)||T(n,`ClassDeclaration`)||T(n,`ClassExpression`)))return!1;T(n,`ReturnStatement`)&&t.push(n)}),t},B=e=>{if(T(e,`ReturnStatement`)||T(e,`ThrowStatement`))return!0;if(T(e,`IfStatement`)){if(T(e.test,`Literal`)){let t=e.test.value?e.consequent:e.alternate;return t?B(t):!1}return!!(e.alternate&&B(e.consequent)&&B(e.alternate))}if(T(e,`TryStatement`))return e.finalizer&&B(e.finalizer)?!0:B(e.block)?e.handler?B(e.handler.body):!0:!1;if(T(e,`DoWhileStatement`))return B(e.body);if(T(e,`WhileStatement`)){let t=e.test;return!!(T(t,`Literal`)&&t.value&&B(e.body))}if(T(e,`ForStatement`)){let t=e.test;return!!((!t||T(t,`Literal`)&&t.value)&&B(e.body))}return T(e,`BlockStatement`)?e.body.some(e=>B(e)):!1},wo=new Set([`let`,`var`]),To=e=>!w(e)||!e.body?[]:T(e.body,`BlockStatement`)?Co(e).flatMap(e=>e.argument?[e.argument]:[]):[e.body],Eo=e=>{if(!w(e)||!T(e.body,`BlockStatement`))return!1;let t=!1;return L(e.body,n=>{if(t||n!==e.body&&w(n))return!1;T(n,`ReturnStatement`)&&!n.argument&&(t=!0)}),t},Do=(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=To(e);return r===`every`&&w(e)&&T(e.body,`BlockStatement`)&&(!B(e.body)||Eo(e))?!1:t.length>0&&(r===`every`?t.every(o):t.some(o))}finally{a.delete(e)}};o=a=>{let l=A(a);if(i.has(l))return!1;i.add(l);try{if(t(l))return!0;if(T(l,`Identifier`)){let t=e.symbolFor(l);if(!t||t.kind!==`const`&&!wo.has(t.kind))return!1;let i=So(t,l,n),a=e=>{let t=A(e);return!w(t)&&o(t)};return r===`every`?i.length>0&&i.every(a):i.some(a)}if(T(l,`CallExpression`)){if(l.arguments.length!==0||!T(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?A(t.initializer):null,r=null;return w(n)?r=n:w(t.declarationNode)&&(r=t.declarationNode),!r||r.async||r.generator||r.params.length!==0?!1:s(r)}return T(l,`ConditionalExpression`)?c(l.consequent,l.alternate):T(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}},Oo=(e,t,n,r,i=`some`)=>Do(t,n,r,i).functionMatches(e),ko=(e,t,n,r,i)=>{let a=i.cfgFor(e),o=a?.blockOf(t);if(!a||!o)return!1;let s=new Set(Co(e).flatMap(e=>{if(!e.argument||!Do(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},Ao=e=>T(e,`Program`)?e.range[1]:e.range[0],jo=new WeakMap,Mo=(e,t)=>{let n=A(e);return T(n,`Identifier`)?t.symbolFor(n):null},No=(e,t)=>{let n=j(e),r=n.parent;return!r||!T(r,`AssignmentExpression`)||r.operator!==`=`||r.left!==n?null:Mo(r.right,t)},Po=e=>{let t=j(e),n=t.parent;return n&&T(n,`VariableDeclarator`)&&n.init===t&&(T(n.id,`Identifier`)||T(n.id,`ObjectPattern`))?!0:!!(n&&T(n,`AssignmentExpression`)&&n.operator===`=`&&n.right===t&&T(A(n.left),`Identifier`))},Fo=(e,t,n)=>{if(e.initializer&&T(e.declarationNode,`VariableDeclarator`)&&e.declarationNode.id===e.bindingIdentifier){let r=Mo(e.initializer,n);if(r&&t.has(r.id))return!0}return e.references.some(e=>{let r=No(e.identifier,n);return!!(r&&t.has(r.id))})},Io=(e,t)=>{let n=N(e,t);if(!n)return[];let r=jo.get(t);r||(r=new Map,jo.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)||Fo(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},Lo=e=>{let t=e;for(;t;){if(w(t)||T(t,`Program`))return t;t=t.parent??null}return null},Ro=new WeakMap,zo=(e,t)=>{let n=Ro.get(t);if(!n){let r=new Map,i=new Map,a=Pt(e);a&&L(a,e=>{if(!T(e,`CallExpression`))return;let n=A(e.callee),a=T(n,`Identifier`)?t.symbolFor(n):null,o=a?i.get(a.id):void 0;o===void 0&&(o=nn(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,Ro.set(t,n)}return n.get(e)??[]},Bo=new WeakMap,Vo=(e,t)=>{let n=Bo.get(t);if(n===void 0){let e=null;L(t,n=>{T(n,`AwaitExpression`)&&D(n)===t&&(e===null||n.range[0]<e)&&(e=n.range[0])}),n=e,Bo.set(t,n)}return n===null||e.range[0]<n},Ho=(e,t,n,r=new Set,i=null,a)=>{if(r.has(e)||!w(e)||e.generator||i!==null&&!Ut(i,e)||i!==null&&a!==void 0&&!a(i)||i!==null&&e.async&&!Vo(i,e))return[];r.add(e);let o=Lo(t);return o?zo(e,n).flatMap(e=>{let s=Lo(e);return!s||i!==null&&!Ut(e,s)||i!==null&&a!==void 0&&!a(e)?[]:s===o?e.range[0]<Ao(t)?[[e.range[0]]]:[]:w(s)?Ho(s,t,n,new Set(r),i===null?null:e,a).map(t=>[...t,e.range[0]]):[]}):[]},Uo=(e,t,n,r=new Set,i=null)=>Ho(e,t,n,r,i).length>0,Wo=e=>{let t=e.parent;return t?T(t,`AssignmentExpression`)?t.left===e:(T(t,`UpdateExpression`)||T(t,`UnaryExpression`)&&t.operator===`delete`)&&t.argument===e:!1},Go=e=>{let t=e.parent;for(;t&&A(t)===e;)t=t.parent;return!t||!T(t,`MemberExpression`)||A(t.object)!==e||!Wo(t)?null:t},Ko=(e,t,n)=>{let r=Go(e);return r&&Bt(r,n)===t?r:null},qo=(e,t,n,r)=>e.references.some(e=>{let i=Ko(e.identifier,t,r);if(!i)return!1;let a=Lo(i),o=Lo(n);return!a||!o||!Ut(i,a)?!1:a===o?i.range[0]<Ao(n):w(a)&&Uo(a,n,r)}),Jo=e=>{if(Po(e))return!0;let t=j(e),n=t.parent;return!!(n&&T(n,`MemberExpression`)&&A(n.object)===t)},Yo=e=>{if(Po(e))return!0;let t=j(e),n=t.parent;if(!n||!T(n,`MemberExpression`)||A(n.object)!==t)return!1;let r=j(n),i=r.parent;return!(i&&T(i,`CallExpression`)&&i.callee===r)},Xo=(e,t,n)=>T(e,`Identifier`)?Io(e,n).some(e=>e.references.some(e=>{let r=Go(e.identifier);if(!r)return!1;let i=Bt(r,n);return i===null||i===t})):!1,Zo=(e,t,n)=>{let r=Lo(e),i=Lo(t);return!r||!i?!0:r===i?e.range[0]<Ao(t):w(r)?Uo(r,t,n):!0},Qo=(e,t,n,r)=>T(e,`Identifier`)?Io(e,r).some(e=>e.references.some(e=>{let i=Go(e.identifier);if(!i||!Zo(i,n,r))return!1;let a=Bt(i,r);return a===null||a===t})):!1,$o=(e,t,n)=>T(e,`Identifier`)?Xo(e,t,n)?!0:Io(e,n).some(e=>e.references.some(e=>!Jo(e.identifier))):!1,es=(e,t,n,r)=>T(e,`Identifier`)?Qo(e,t,n,r)?!0:Io(e,r).some(e=>e.references.some(e=>!Yo(e.identifier)&&Zo(e.identifier,n,r))):!1,ts=(e,t)=>{let n=A(e);if(!T(n,`CallExpression`))return!1;let r=A(n.callee);if(!T(r,`MemberExpression`))return!1;let i=M(r);if(i===null)return!1;let a=A(r.object);return T(a,`Identifier`)&&Xo(a,i,t)},ns=(e,t,n,r)=>T(e,`Identifier`)?Rt(e,r).some(e=>qo(e,t,n,r)):!1,rs=(e,t,n,r={})=>{let i=D(e);return i===D(t)?e.range[0]>=Ao(t)||r.requireSynchronousWrite&&(!i||!Ut(e,i)||r.isSynchronousNode!==void 0&&!r.isSynchronousNode(e))?[]:[[e.range[0]]]:i?r.requireSynchronousWrite?Ho(i,t,n,new Set,e,r.isSynchronousNode).map(t=>[...t,e.range[0]]):Ho(i,t,n).map(t=>[...t,e.range[0]]):r.requireSynchronousWrite?[]:[[-1/0,e.range[0]]]},is=(e,t,n,r={})=>rs(e,t,n,r).length>0,V=(e,t,n,r={})=>e.references.some(e=>e.flag===`read`?!1:is(e.identifier,t,n,r)),as=(e,t)=>{if(!T(e,`CallExpression`))return!1;let n=A(e.callee);if(T(n,`Identifier`)){let e=t.symbolFor(n);return!!(e&&!V(e,n,t))}if(!T(n,`MemberExpression`))return!1;let r=M(n),i=A(n.object);return!!(r&&T(i,`Identifier`)&&!ns(i,r,n,t))},os=new Set([`FunctionDeclaration`,`FunctionExpression`,`ArrowFunctionExpression`,`ClassDeclaration`,`ClassExpression`]),ss={allowGlobalReactNamespace:!1,allowUnboundBareCalls:!1},cs=new Set([`lodash/sortBy`,`lodash/sortBy.js`,`lodash-es/sortBy`,`lodash-es/sortBy.js`]),ls=e=>T(e,`TSArrayType`)||T(e,`TSTupleType`)?!0:T(e,`TSTypeReference`)?T(e.typeName,`Identifier`)&&(e.typeName.name===`Array`||e.typeName.name===`ReadonlyArray`):!1,us=e=>{if(!T(e,`Identifier`))return!1;let t=e.typeAnnotation;return!!(t&&T(t,`TSTypeAnnotation`)&&ls(t.typeAnnotation))},ds=(e,t)=>{if(!T(e,`CallExpression`))return!1;let n=A(e.callee);if(!T(n,`Identifier`))return!1;let r=t.symbolFor(n);if(!r||V(r,n,t)||!T(r.declarationNode,`ImportDefaultSpecifier`)&&!T(r.declarationNode,`ImportSpecifier`))return!1;let i=ao(n,n.name);return!i||i.isNamespace?!1:cs.has(i.source)&&i.exportedName===`default`?!0:(i.source===`lodash`||i.source===`lodash-es`)&&i.exportedName===`sortBy`},fs=(e,t,n,r=new Set)=>{let i=A(e);if(T(i,`ArrayExpression`)||ds(i,t))return!0;if(!T(i,`Identifier`))return!1;let a=t.symbolFor(i);return!a||r.has(a.id)||V(a,n,t)?!1:us(a.bindingIdentifier)?!0:a.initializer?(r.add(a.id),fs(a.initializer,t,n,r)):!1},ps=(e,t)=>{if(!T(e,`CallExpression`))return!1;let n=A(e.callee);if(!T(n,`MemberExpression`)||M(n)!==`map`)return!1;let r=A(n.object);return fs(r,t,e)?!(T(r,`Identifier`)&&ns(r,`map`,e,t)):!1},ms=(e,t)=>{if(e.type!==`ArrowFunctionExpression`&&e.type!==`FunctionExpression`)return!1;let n=e.parent;if(T(n,`CallExpression`))return Ua(n,`useMemo`,t,{resolveNamedAliases:!0})&&as(n,t)?n.arguments[0]===e:n.arguments.some(t=>t===e)&&ps(n,t);if(T(n,`Property`)&&n.kind===`init`&&n.value===e){let e=n.parent;if(!T(e,`ObjectExpression`))return!1;let r=e.parent;if(!T(r,`CallExpression`)||!r.arguments.some(t=>t===e)||!as(r,t))return!1;let i=tn(r.callee,t);return!!(i&&fo(i,!0))}return!1},hs=(e,t)=>os.has(e.type)&&!ms(e,t),gs=(e,t)=>e.type===`JSXElement`||e.type===`JSXFragment`||Ua(e,`createElement`,t,ss)||_s(e,t),_s=(e,t)=>{if(!T(e,`CallExpression`))return!1;let n=A(e.callee);if(T(n,`Identifier`))return t.symbolFor(n)?.kind===`import`&&ro(n,n.name,`react-dom`)===`createPortal`;if(!T(n,`MemberExpression`)||n.computed||!T(n.object,`Identifier`)||!T(n.property,`Identifier`)||n.property.name!==`createPortal`)return!1;let r=t.symbolFor(n.object);return!r||r.kind!==`import`?!1:no(n.object,n.object.name,`react-dom`)||to(n.object,n.object.name,`react-dom`)},vs=(e,t)=>{if(hs(e,t))return!1;let n=!1;return L(e,r=>{if(n||r!==e&&hs(r,t))return!1;if(gs(r,t))return n=!0,!1}),n},ys=new WeakMap,bs=(e,t,n)=>{let r=ys.get(e);if(r&&r.scopes===t&&r.controlFlow===n)return r.hasRenderOutput;let i=Oo(e,t,e=>vs(e,t),n);return ys.set(e,{scopes:t,controlFlow:n,hasRenderOutput:i}),i},xs=e=>T(e,`JSXIdentifier`)?e.name:T(e,`JSXNamespacedName`)?`${e.namespace.name}:${e.name.name}`:null,Ss=new Set([`Component`,`PureComponent`]),Cs=(e,t,n,r)=>{let i=A(e);if(T(i,`MemberExpression`)){let e=M(i),n=A(i.object);return!!(e&&Ss.has(e)&&T(n,`Identifier`)&&!ns(n,e,i,t)&&Ba(n,t))}if(T(i,`ClassExpression`))return ws(i,t,n,r);if(!T(i,`Identifier`))return!1;let a=t.symbolFor(i);if(!a||r.has(a.id)||V(a,i,t))return!1;if(r.add(a.id),Ra(a)){let e=R(a.declarationNode);return!!(e&&Ss.has(e))}return T(a.declarationNode,`ClassDeclaration`)||T(a.declarationNode,`ClassExpression`)?ws(a.declarationNode,t,n,r):!!(a.kind===`const`&&a.initializer&&Cs(a.initializer,t,n,r))},ws=(e,t,n=new Set,r=new Set)=>!T(e,`ClassDeclaration`)&&!T(e,`ClassExpression`)||n.has(e)||!e.superClass?!1:(n.add(e),Cs(e.superClass,t,n,r)),Ts=new Set([`FunctionDeclaration`,`FunctionExpression`,`ArrowFunctionExpression`,`MethodDefinition`,`Program`]),Es=e=>{let t=e;for(;t;){if(Ts.has(t.type))return t;t=t.parent??null}return null},Ds=(e,t)=>{if(t!==`let`&&t!==`const`)return Es(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`)?Es(e):n}if(Ts.has(n.type))return n;n=n.parent??null}return null},Os=(e,t,n,r)=>{if(T(e,`Identifier`)){let i=r.get(e.name)??[];i.push({bindingIdentifier:e,initializer:t,scopeOwner:n}),r.set(e.name,i);return}if(T(e,`ObjectPattern`)){for(let t of e.properties)if(T(t,`Property`)){let e=t.value;Os(e,T(e,`AssignmentPattern`)?e.right:null,n,r)}else T(t,`RestElement`)&&Os(t.argument,null,n,r);return}if(T(e,`ArrayPattern`)){for(let t of e.elements)t&&Os(t,T(t,`AssignmentPattern`)?t.right??null:null,n,r);return}if(T(e,`AssignmentPattern`)){Os(e.left,e.right??null,n,r);return}T(e,`RestElement`)&&Os(e.argument,null,n,r)},ks=e=>{let t=new Map;return L(e,e=>{switch(e.type){case`VariableDeclarator`:{let n=e.parent,r=Ds(e,n?.type===`VariableDeclaration`?n.kind:void 0);r&&Os(e.id,e.init??null,r,t);break}case`FunctionDeclaration`:case`FunctionExpression`:case`ArrowFunctionExpression`:if(e.type!==`ArrowFunctionExpression`&&e.id){let n=e.parent?Es(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)Os(n,null,e,t);break;case`ClassDeclaration`:case`ClassExpression`:{if(!e.id)break;let n=e.parent?Es(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=Es(e);if(!n)break;for(let r of e.specifiers){let e=r.local;if(e&&T(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=Es(e);if(r){let e=t.get(n.name)??[];e.push({bindingIdentifier:n,initializer:null,scopeOwner:r}),t.set(n.name,e)}}break}}}),t},As=new WeakMap,js=new WeakMap,Ms=e=>{let t=Pt(e);if(!t)return null;let n=As.get(t);return n||(n=ks(t),As.set(t,n)),n},Ns=(e,t,n)=>{let r=Ms(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&&(T(r.initializer,`FunctionDeclaration`)||r.bindingIdentifier.range[0]<e.range[0]));if(n!==!!(t.initializer&&(T(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},Ps=(e,t,n)=>{let r=js.get(e),i;if(!r)i={},js.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=Ns(e,t,n);return i[a]=o,o},Fs=e=>fa.test(e),Is=e=>{let t=Ps(e,e.name);if(!t?.initializer)return null;let n=t.bindingIdentifier.parent;if(!n||!T(n,`VariableDeclarator`)||n.id!==t.bindingIdentifier)return null;let r=n.parent;if(!r||!T(r,`VariableDeclaration`)||r.kind!==`const`)return null;let i=A(t.initializer);return T(i,`Literal`)&&typeof i.value==`string`?i.value:null},Ls=e=>T(e,`JSXIdentifier`)?e.name:T(e,`JSXMemberExpression`)?`${Ls(e.object)}.${e.property.name}`:T(e,`JSXNamespacedName`)?`${e.namespace.name}:${e.name.name}`:``,Rs=e=>{let t=e.name;return T(t,`JSXIdentifier`)?Fs(t.name)?Is(t)??t.name:t.name:Ls(t)},zs=(e,t)=>{if(!T(e.name,`JSXIdentifier`))return!1;let n=Rs(e);if(n[0]===n[0]?.toLowerCase())return!0;let r=new Set,i=e=>{let n=j(e);if(T(n,`Literal`))return typeof n.value==`string`;if(T(n,`Identifier`)||T(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 T(n,`ConditionalExpression`)?i(n.consequent)&&i(n.alternate):!1};return i(e.name)},Bs=(e,t,n=new Set)=>{if(!e)return null;let r=A(e);if(w(r))return r;if(T(r,`Identifier`)){let e=t.symbolFor(r);return!e||n.has(e.id)||!e.initializer||V(e,r,t)?null:(n.add(e.id),Bs(e.initializer,t,n))}if(!T(r,`CallExpression`)||!Ua(r,`memo`,t,{resolveNamedAliases:!0})&&!Ua(r,`forwardRef`,t,{resolveNamedAliases:!0}))return null;let i=r.arguments[0];return!i||T(i,`SpreadElement`)?null:Bs(i,t,n)},Vs=(e,t)=>{let n=j(e);if(!w(n)||n.async||n.generator)return!1;let r=n.parent;if(!r||!T(r,`JSXExpressionContainer`))return!1;let i=r.parent;if(!i||!T(i,`JSXAttribute`)||xs(i.name)!==`ref`)return!1;let a=i.parent;return!!(a&&T(a,`JSXOpeningElement`)&&zs(a,t))},Hs=(e,t)=>t.every((t,n)=>e[n]===t),Us=e=>{let t=j(e);for(;t.parent&&T(t.parent,`MemberExpression`)&&t.parent.object===t;){if(!M(t.parent))return null;t=j(t.parent)}return t},Ws=(e,t,n,r)=>{if(t.length!==n.length+1||!Hs(t,n)||t[n.length]!==`current`)return!1;let i=Us(e),a=i?.parent;if(!i||!a||!T(a,`AssignmentExpression`)||a.operator!==`=`||a.left!==i)return!1;let o=D(e);if(!o)return!1;if(Vs(o,r))return!0;if(!w(o)||o.async||o.generator)return!1;let s=D(o);if(!s||!Vs(s,r))return!1;let c=j(o),l=c.parent;return!!(T(l,`ReturnStatement`)&&l.argument===c&&D(l)===s||T(s,`ArrowFunctionExpression`)&&s.body===c)},Gs=(e,t)=>{if(!T(e,`JSXOpeningElement`))return!1;let n=e.name;if(T(n,`JSXIdentifier`)){if(!t)return n.name===`Fragment`;let e=N(n,t);return e?Ra(e)&&R(e.declarationNode)===`Fragment`:n.name===`Fragment`&&t.isGlobalReference(n)}return T(n,`JSXMemberExpression`)?!T(n.object,`JSXIdentifier`)||n.property.name!==`Fragment`?!1:t?Ba(n.object,t)?!0:n.object.name===`React`&&t.isGlobalReference(n.object):n.object.name===`React`:!1},Ks=(e,t,n,r,i)=>{let a=j(e),o=a.parent;if(!o)return!1;if(T(o,`ReturnStatement`)&&o.argument===a)return D(o)===t;if(T(o,`ArrowFunctionExpression`)&&o.body===a)return o===t;if(T(o,`JSXFragment`)&&o.children.some(e=>e===a)||T(o,`JSXElement`)&&o.children.some(e=>e===a)&&(zs(o.openingElement,n)||Gs(o.openingElement,n)||i.doesCustomElementRenderChildren?.(o.openingElement)))return Ks(o,t,n,r,i);if(T(o,`JSXExpressionContainer`)&&o.expression===a&&o.parent&&(T(o.parent,`JSXFragment`)||T(o.parent,`JSXElement`)&&(zs(o.parent.openingElement,n)||Gs(o.parent.openingElement,n)||i.doesCustomElementRenderChildren?.(o.parent.openingElement))))return Ks(o.parent,t,n,r,i);if(T(o,`ConditionalExpression`)&&(o.consequent===a||o.alternate===a)||T(o,`LogicalExpression`)&&(o.left===a||o.right===a)||T(o,`ArrayExpression`)&&o.elements.some(e=>e===a))return Ks(o,t,n,r,i);if(!T(o,`VariableDeclarator`)||o.init!==a||!T(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`&&Ks(e.identifier,t,n,r,i));return r.delete(s.id),c},qs=(e,t,n={})=>Ks(e,D(e),t,new Set,n),Js=(e,t)=>t.every((t,n)=>e[n]===t),Ys=(e,t)=>Js(e,t)||Js(t,e),Xs=e=>w(e)&&T(e.body,`BlockStatement`)&&e.body.body.length===0,Zs=(e,t,n)=>Ua(e,t,n,{resolveNamedAliases:!0}),Qs=(e,t,n=new Set)=>T(e,`ObjectExpression`)?e.properties.every(e=>{if(T(e,`SpreadElement`)){let r=j(e.argument);if(T(r,`ObjectExpression`))return Qs(r,t,n);if(!T(r,`Identifier`))return!1;let i=t.symbolFor(r);if(!i||i.kind!==`const`||n.has(i.id)||!T(i.initializer,`ObjectExpression`))return!1;n.add(i.id);let a=Qs(i.initializer,t,n);return n.delete(i.id),a}return T(e,`Property`)?!w(e.value)||Xs(e.value):!1}):!1,$s=e=>M(e)||(e.computed&&T(e.property,`Literal`)&&typeof e.property.value==`number`&&Number.isSafeInteger(e.property.value)&&e.property.value>=0?String(e.property.value):null),ec=e=>{let t=[],n=j(e);for(;n.parent&&T(n.parent,`MemberExpression`)&&n.parent.object===n;){let e=$s(n.parent);if(!e)return null;t.push(e),n=j(n.parent)}return{expression:n,propertyPath:t}},tc=(e,t,n)=>{let r=n.environmentsByProgram.get(e);if(r)return r;let i={filename:t,program:e,scopes:ft(e)};return n.environmentsByProgram.set(e,i),i},nc=(e,t,n=new Set)=>{let r=j(e);if(T(r,`Identifier`)){let e=t.symbolFor(r);return!e||!e.initializer||n.has(e.id)||V(e,r,t)?!1:(n.add(e.id),nc(e.initializer,t,n))}if(!T(r,`CallExpression`))return!1;if(Zs(r,`forwardRef`,t))return!0;if(!Zs(r,`memo`,t))return!1;let i=r.arguments[0];return!i||T(i,`SpreadElement`)?!1:nc(i,t,n)},rc=(e,t)=>{let n=tc(e.programNode,e.filePath,t),r=Bs(e.exportedNode,n.scopes);return r?{environment:n,functionNode:r,isForwardRef:nc(e.exportedNode,n.scopes)}:null},ic=(e,t,n)=>{if(!T(e,`Identifier`)&&!T(e,`JSXIdentifier`))return null;let r=t.scopes.symbolFor(e);if(r&&r.kind!==`import`){if(V(r,e,t.scopes))return null;let n=Bs(r.initializer,t.scopes);return n?{environment:t,functionNode:n,isForwardRef:!!(r.initializer&&nc(r.initializer,t.scopes))}:null}let i=ao(e,e.name);if(!i||i.isNamespace||i.exportedName===null)return null;let a=I(t.filename,i.source,i.exportedName);return a?rc(a,n):null},ac=(e,t,n)=>{if(T(e,`JSXIdentifier`))return ic(e,t,n);if(!T(e,`JSXMemberExpression`)||!T(e.object,`JSXIdentifier`))return null;let r=ao(e.object,e.object.name);if(!r?.isNamespace)return null;let i=I(t.filename,r.source,e.property.name);return i?rc(i,n):null},oc=(e,t,n=new Set)=>{let r=j(e);if(T(r,`Identifier`)){let e=t.scopes.symbolFor(r);return!e||!e.initializer||n.has(e.id)||V(e,r,t.scopes)?!1:(n.add(e.id),oc(e.initializer,t,n))}return ws(r,t.scopes)},sc=(e,t,n)=>{if(!T(e,`JSXIdentifier`))return!1;let r=t.scopes.symbolFor(e);if(r&&r.kind!==`import`)return V(r,e,t.scopes)?!1:!!(r.initializer&&oc(r.initializer,t));let i=ao(e,e.name);if(!i||i.isNamespace||i.exportedName===null)return!1;let a=I(t.filename,i.source,i.exportedName);if(!a)return!1;let o=tc(a.programNode,a.filePath,n);return oc(a.exportedNode,o)},cc=(e,t)=>{if(!e)return null;let n=j(e);return!T(n,`ClassDeclaration`)&&!T(n,`ClassExpression`)||!oc(n,t)?null:{classNode:n,environment:t}},lc=(e,t,n)=>{if(!T(e,`JSXIdentifier`))return null;let r=t.scopes.symbolFor(e);if(r&&r.kind!==`import`)return V(r,e,t.scopes)?null:cc(r.initializer,t);let i=ao(e,e.name);if(!i||i.isNamespace||i.exportedName===null)return null;let a=I(t.filename,i.source,i.exportedName);if(!a)return null;let o=tc(a.programNode,a.filePath,n);return cc(a.exportedNode,o)},uc=(e,t,n)=>{let r=[...t],i=j(e);for(;i.parent;){let e=i.parent;if(T(e,`ArrayExpression`)){if(e.elements.some(e=>e&&T(e,`SpreadElement`)))return null;let t=e.elements.findIndex(e=>e===i);if(t<0)return null;r.unshift(String(t)),i=j(e);continue}if(T(e,`Property`)&&e.value===i){let t=P(e,{allowComputedString:!0}),a=e.parent;if(!t||!a||!Qs(a,n.scopes))return null;r.unshift(t),i=j(a);continue}if(T(e,`ConditionalExpression`)&&(e.consequent===i||e.alternate===i)||T(e,`LogicalExpression`)&&(e.left===i||e.right===i)){i=j(e);continue}if(T(e,`VariableDeclarator`)&&e.init===i&&T(e.id,`Identifier`)){let t=n.scopes.symbolFor(e.id);return!t||t.kind!==`const`?null:{environment:n,propertyPath:r,symbol:t}}if(T(e,`AssignmentExpression`)&&e.operator===`=`&&e.right===i&&T(e.left,`MemberExpression`)){let t=[],i=e.left;for(;T(i,`MemberExpression`);){let e=$s(i);if(!e)return null;t.unshift(e),i=j(i.object)}if(!T(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},dc=(e,t,n,r,i)=>{if(T(e,`AssignmentPattern`))return dc(e.left,t,n,r,i);if(T(e,`Identifier`)){let a=n.scopes.symbolFor(e);return!!(a&&Dc({environment:n,propertyPath:t,symbol:a},r,i-1))}if(!T(e,`ObjectPattern`)||t.length===0)return!1;let[a,...o]=t;for(let t of e.properties){if(!T(t,`Property`))continue;let e=P(t,{allowComputedString:!0});if(!e)return!1;if(e===a)return dc(t.value,o,n,r,i)}let s=e.properties.find(e=>T(e,`RestElement`));return s?dc(s.argument,t,n,r,i):!0},fc=(e,t)=>{let n=e.arguments[0];return!n||T(n,`SpreadElement`)?!1:Zs(e,`createElement`,t.scopes)?T(n,`Literal`)&&typeof n.value==`string`:!Zs(e,`cloneElement`,t.scopes)||!T(n,`JSXElement`)?!1:zs(n.openingElement,t.scopes)},pc=(e,t,n,r,i)=>{if(t.length>0)return!1;let a=e.parent;if(!a||!T(a,`Property`)||a.value!==e||P(a,{allowComputedString:!0})!==`ref`)return!1;let o=a.parent;if(!o||!T(o,`ObjectExpression`))return!1;let s=o.parent;return!(!s||!T(s,`CallExpression`)||s.arguments[1]!==o||!fc(s,n)||!_c(s,n,r,i))},mc=(e,t,n,r,i)=>{if(i<=0||!w(e.functionNode)||e.functionNode.async||e.functionNode.generator)return!1;let a=e.functionNode.params[t];return!!(a&&dc(a,n,e.environment,r,i))},hc=e=>{if(!T(e,`MemberExpression`)||M(e)!==`children`)return!1;let t=j(e.object);return!!(T(t,`MemberExpression`)&&M(t)===`props`&&T(j(t.object),`ThisExpression`))},gc=(e,t)=>{if(!T(e,`JSXOpeningElement`)||!T(e.name,`JSXMemberExpression`)||e.name.property.name!==`Provider`||!T(e.name.object,`JSXIdentifier`))return!1;let n=t.scopes.symbolFor(e.name.object);return!!(n?.kind===`const`&&n.initializer&&T(n.initializer,`CallExpression`)&&Zs(n.initializer,`createContext`,t.scopes))},_c=(e,t,n,r)=>qs(e,t.scopes,{doesCustomElementRenderChildren:e=>bc(e,t,n,r-1)}),vc=(e,t,n)=>{let{functionNode:r}=e;if(n<=0||t.activeRenderedChildrenComponents.has(r)||!T(r,`ArrowFunctionExpression`)&&!T(r,`FunctionExpression`)&&!T(r,`FunctionDeclaration`)||r.async||r.generator)return!1;let i=Ya(r,e.environment.scopes);if(!i)return!1;t.activeRenderedChildrenComponents.add(r);let a=i.every(r=>_c(r,e.environment,t,n));return t.activeRenderedChildrenComponents.delete(r),a},yc=(e,t,n)=>{let{classNode:r,environment:i}=e;if(n<=0||t.activeRenderedChildrenComponents.has(r)||!T(r,`ClassDeclaration`)&&!T(r,`ClassExpression`))return!1;let a=r.body.body.find(e=>T(e,`MethodDefinition`)&&!e.computed&&T(e.key,`Identifier`)&&e.key.name===`render`);if(!a||!T(a,`MethodDefinition`))return!1;let o=[];if(L(r,e=>{hc(e)&&o.push(e)}),o.length===0)return!1;t.activeRenderedChildrenComponents.add(r);let s=o.every(e=>D(e)===a.value&&_c(e,i,t,n));return t.activeRenderedChildrenComponents.delete(r),s},bc=(e,t,n,r)=>{if(r<=0||!T(e,`JSXOpeningElement`))return!1;if(gc(e,t))return!0;let i=ac(e.name,t,n);if(i)return vc(i,n,r);let a=lc(e.name,t,n);return!!(a&&yc(a,n,r))},xc=(e,t,n,r,i)=>{let a=xs(e.name),o=e.parent;if(!a||!o||!T(o,`JSXOpeningElement`))return!1;let s=o.parent;if(!s||!T(s,`JSXElement`)||!_c(s,n,r,i))return!1;if(zs(o,n.scopes))return a===`ref`&&t.length===0;if(T(o.name,`JSXIdentifier`)&&a===`ref`&&t.length===0&&sc(o.name,n,r))return!0;let c=ac(o.name,n,r);return c?a===`ref`&&c.isForwardRef?mc(c,1,t,r,i):mc(c,0,[a,...t],r,i):!1},Sc=(e,t,n,r,i,a)=>{let o=e.arguments.findIndex(e=>e===t);if(o<0)return!1;if(o===0&&T(e.callee,`Identifier`)&&e.callee.name===`Boolean`&&r.scopes.isGlobalReference(e.callee))return!0;if(o===0&&Zs(e,`useImperativeHandle`,r.scopes))return n.length===0;if(o===1&&n.length===1&&n[0]===`ref`&&fc(e,r)&&_c(e,r,i,a))return!0;let s=j(e.callee);if(w(s))return bs(s,r.scopes)&&!_c(e,r,i,a)?!1:mc({environment:r,functionNode:s,isForwardRef:!1},o,n,i,a);if(!T(e.callee,`Identifier`))return!1;let c=ic(e.callee,r,i);return!!(c&&(!bs(c.functionNode,c.environment.scopes)||_c(e,r,i,a))&&mc(c,o,n,i,a))},Cc=(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||!T(t,`Property`)||t.value!==e||P(t,{allowComputedString:!0})!==`ref`)return!1;a=t.parent?.parent}if(!a||!T(a,`JSXSpreadAttribute`))return!1;let o=a.parent;if(!o||!T(o,`JSXOpeningElement`))return!1;let s=o.parent;return!!(zs(o,n.scopes)&&s&&T(s,`JSXElement`)&&_c(s,n,r,i))},wc=(e,t,n,r,i)=>{let a=j(e),o=a.parent;if(!o)return!1;if(T(o,`ExpressionStatement`)||T(o,`UnaryExpression`)&&o.operator===`void`&&o.argument===a)return!0;if(t.length===0&&T(o,`BinaryExpression`)&&(o.operator===`===`||o.operator===`!==`||o.operator===`==`||o.operator===`!=`)){let e=o.left===a?o.right:o.left;return!!(T(a,`Identifier`)&&T(e,`Identifier`)&&n.scopes.symbolFor(a)?.id===n.scopes.symbolFor(e)?.id)}if(Cc(a,t,n,r,i)||pc(a,t,n,r,i)||t.length>0&&(T(o,`LogicalExpression`)&&o.left===a||T(o,`ConditionalExpression`)&&o.test===a||T(o,`IfStatement`)&&o.test===a||T(o,`UnaryExpression`)&&o.operator===`!`&&o.argument===a))return!0;if(T(o,`JSXExpressionContainer`)&&o.expression===a){let e=o.parent;return!!(e&&T(e,`JSXAttribute`)&&xc(e,t,n,r,i))}if(T(o,`CallExpression`))return Sc(o,a,t,n,r,i);if(T(o,`VariableDeclarator`)&&o.init===a&&!T(o.id,`Identifier`))return dc(o.id,t,n,r,i);let s=uc(a,t,n);return!!(s&&Dc(s,r,i-1))},Tc=e=>{let t=e.parent;return t&&T(t,`VariableDeclarator`)&&t.init===e&&T(t.id,`Identifier`)?t.id:(T(e,`FunctionDeclaration`)||T(e,`FunctionExpression`))&&e.id?e.id:null},Ec=(e,t,n)=>{if(!e||!t||!w(e)||e.async||e.generator)return!1;let r=Tc(e);if(!r||((T(e,`FunctionDeclaration`)||T(e,`FunctionExpression`))&&e.id===r?D(e):D(r))!==t)return!1;let i=T(e,`FunctionDeclaration`)?n.ownScopeFor(t)?.symbolsByName.get(r.name):n.symbolFor(r);return!!(i&&i.references.length>0&&i.references.every(e=>{let r=j(e.identifier),i=r.parent;return!!(i&&T(i,`CallExpression`)&&i.callee===r&&D(i)===t&&qs(i,n))}))},Dc=(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=D(e.symbol.bindingIdentifier),a=e.symbol.references.every(r=>{if(r.identifier===e.originWriteReference)return!0;let a=r.identifier.parent;if(a&&T(a,`Property`)&&!a.computed&&a.key===r.identifier&&a.value!==r.identifier)return!0;let o=ec(r.identifier);if(!o)return!1;if(!Ys(o.propertyPath,e.propertyPath))return!0;let s=D(r.identifier);if(s!==i&&!Ec(s,i,e.environment.scopes))return!!Ws(r.identifier,o.propertyPath,e.propertyPath,e.environment.scopes);if(r.flag!==`read`)return!1;if(Js(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&&T(t,`UnaryExpression`)&&t.operator===`void`&&t.argument===o.expression)}return wc(o.expression,[],e.environment,t,n)}return wc(o.expression,e.propertyPath.slice(o.propertyPath.length),e.environment,t,n)});return t.activePaths.delete(r),a},Oc=(e,t,n)=>{if(!t)return!1;let r=Pt(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=uc(e,[],i);return o?Dc(o,a,12):wc(e,[],i,a,12)},kc=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},Ac=({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=In(e,t);if(!(!a||!Ci(a))){n||(n=!0,Wr(e));for(let e of i){let t=e.importName.kind===`Default`?`default`:e.importName.name;t&&qa(a,t)}}}},jc=({absoluteFilePath:e})=>{pr.test(e)&&(_r.test(e)||ii(e))},Mc=({absoluteFilePath:e,staticImports:t})=>{if(mr.test(e)&&!si(e))for(let n of kc(t))rr(e,n.source,n.exportedName)},H=({absoluteFilePath:e,staticImports:t})=>{for(let n of kc(t))rr(e,n.source,n.exportedName)},Nc=({absoluteFilePath:e,staticImports:t})=>{for(let n of kc(t))I(e,n.source,n.exportedName)},Pc=(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=ci(i);if(!e)continue;let a=$n(t,e);if(!a||r>=8)continue;let o=r+1,s=n.get(a);if(s!==void 0&&s<=o)continue;let c=hn(a);if(!c){n.set(a,o);continue}Pc(c,a,n,o)}}},Fc=e=>{Nc(e);let t=e.getProgram(),n=!1;L(t,e=>{if(n)return!1;if(!T(e,`CallExpression`))return;let t=A(e.callee);if(!T(t,`MemberExpression`))return;let r=M(t);n=r===`add`||r===`set`}),n&&Pc(t,e.absoluteFilePath,new Map,0)},Ic=({absoluteFilePath:e,staticImports:t})=>{for(let n of kc(t))Ja(e,n.source,n.exportedName)},Lc=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},Rc=({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 Lc(t)){let t=I(e,a.source,a.exportedName);!t||n===0||!r(t)||!i(t.filePath)||o(t.filePath,t.programNode,n-1)}}};for(let a of kc(t)){let t=I(e,a.source,a.exportedName);!t||!r(t)||!i(t.filePath)||o(t.filePath,t.programNode,n)}},zc=e=>{let t=e.getProgram();on(t);let n=ft(t);L(t,t=>{if(T(t,`BlockStatement`))for(let[r,i]of t.body.entries()){let a=t.body[r+1];!T(i,`VariableDeclaration`)||!T(a,`VariableDeclaration`)||dr(i,a,n,e.absoluteFilePath)}})},Bc=e=>{Rc(e,4)},Vc=({absoluteFilePath:e,sourceText:t,getProgram:n})=>{if(!t.includes(`createRef`)&&!t.includes(`\\u`))return;let r=n();on(r);let i=ft(r);L(r,t=>{!T(t,`CallExpression`)||!Ua(t,`createRef`,i,{allowGlobalReactNamespace:!0,allowUnboundBareCalls:!0,resolveNamedAliases:!0})||Oc(t,e,i)})},Hc=({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(L(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(A(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&&rr(e,t.moduleRequest.value,r)}},Uc=({absoluteFilePath:e,staticImports:t,getProgram:n})=>{Wr(e),Gr({absoluteFilePath:e,staticImports:t,program:n()})},U=({absoluteFilePath:e})=>{Wr(e)},Wc=e=>{U(e),Ic(e)},Gc=e=>{U(e),Rc(e,1/0,e=>w(e.exportedNode),e=>!e.split(/[\\/]/).includes(`node_modules`))},Kc=({absoluteFilePath:e})=>{Ii(e)},qc=({absoluteFilePath:e})=>{Fe(e,`react-native`)},Jc=({absoluteFilePath:e})=>{Li(e)},Yc=e=>{Jc(e),Gr({absoluteFilePath:e.absoluteFilePath,staticImports:e.staticImports,program:e.getProgram()})},Xc=new Map([...b.map(e=>[e,Jc]),[`ink-no-raw-text`,Yc],[`client-passive-event-listeners`,H],[`effect-needs-cleanup`,H],[`exhaustive-deps`,Bc],[`no-barrel-import`,Ac],[`nextjs-async-dynamic-api-not-awaited`,U],[`nextjs-missing-metadata`,jc],[`nextjs-no-use-search-params-without-suspense`,Mc],[`no-dynamic-import-path`,U],[`no-full-lodash-import`,U],[`no-hydration-branch-on-browser-global`,Wc],[`no-indeterminate-attribute`,U],[`no-locale-format-in-render`,U],[`no-match-media-in-state-initializer`,U],[`no-create-ref-in-function-component`,Vc],[`no-adjust-state-on-prop-change`,H],[`no-derived-state`,H],[`no-derived-state-effect`,H],[`no-event-handler`,H],[`no-initialize-state`,H],[`no-reset-all-state-on-prop-change`,H],[`no-mutating-reducer-state`,Hc],[`no-side-effect-in-state-updater-function`,Fc],[`no-unguarded-browser-global-at-module-scope`,Ic],[`no-unguarded-browser-global-in-render-or-hook-init`,Gc],[`prefer-dynamic-import`,U],[`rendering-hydration-mismatch-time`,U],[`rendering-hydration-no-flicker`,H],[`rerender-memo-with-default-value`,Bc],[`server-sequential-independent-await`,zc],[`rn-no-deprecated-modules`,qc],[`rn-no-legacy-shadow-styles`,Kc],[`rn-no-raw-text`,Uc],[`rn-prefer-expo-image`,U],[`rn-style-prefer-boxshadow`,Kc],...re.map(e=>[e,U])]),Zc=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`]),Qc=e=>{let t=new Set;for(let n of e.ruleIds){let e=Xc.get(n);if(!e)return null;t.add(e)}let n=z(e.absoluteFilePath),r,i;try{let t=dn(n,e.sourceText);if(t.errors.some(e=>e.severity===`Error`))return null;r=t.module.staticImports;let a;i=()=>(a??=t.program,a)}catch{return null}let a={absoluteFilePath:n,sourceText:e.sourceText,staticImports:r,getProgram:i};return be(()=>{for(let e of t)e(a)})},$c={},el=(e,t,n)=>!e||e.length===0?!1:e.every(e=>T(e,t)&&e[n]===`type`),tl=e=>e.importKind===`type`||el(e.specifiers,`ImportSpecifier`,`importKind`),nl=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`]),rl=[`solid-js`,`@builder.io/qwik`],il=[`react`,`react-dom`,`preact`],al=new WeakMap,ol=new WeakMap,sl=(e,t)=>t.some(t=>e===t||e.startsWith(`${t}/`)),cl=e=>{let t=al.get(e);if(t)return t;let n=!1,r=!1,i=!1,a=!1,o=!1,s=!1;for(let t of e.body){if(i||L(t,e=>{if(i)return!1;if(T(e,`JSXOpeningElement`)&&ll(e))return i=!0,!1;T(e,`JSXOpeningElement`)&&T(e.name,`JSXIdentifier`)&&/^[a-z]/.test(e.name.name)&&e.attributes.some(e=>T(e,`JSXAttribute`)&&xs(e.name)===`class`)&&(s=!0)}),!T(t,`ImportDeclaration`))continue;let e=t,c=e.source,l=c&&typeof c.value==`string`?c.value:null;if(l){if(l===`solid-js`)for(let t of e.specifiers){if(!T(t,`ImportSpecifier`)||e.importKind!==`type`&&t.importKind!==`type`)continue;let n=R(t);n===`Component`&&(a=!0),n===`JSX`&&(o=!0)}tl(e)||((nl.has(l)||sl(l,rl))&&(n=!0),sl(l,il)&&(r=!0))}}let c={hasNonReactMarker:i||a||o&&s,hasNonReactRuntime:n,hasReactRuntime:r};return al.set(e,c),c},ll=e=>{let t=ol.get(e);if(t!==void 0)return t;let n=!1;for(let t of e.attributes){if(!T(t,`JSXAttribute`))continue;let r=xs(t.name);if(r&&(r===`classList`&&T(t.value,`JSXExpressionContainer`)&&T(t.value.expression,`ObjectExpression`)||T(e.name,`JSXIdentifier`)&&/^[a-z]/.test(e.name.name)&&(r.startsWith(`class:`)||r.startsWith(`bind:`)||r.startsWith(`on:`)||r.startsWith(`oncapture:`)))){n=!0;break}}return ol.set(e,n),n},ul=new Set(`/playground/./playgrounds/./examples/./example/./demo/./demos/./sandbox/./sandboxes/./specs/./spec/./integration/./it/./perf/./scripts/./cli/./bin/./tooling/./tools/./codemods/./codemod/./migrations/./migration/./generators/./generator/./runbooks/./devtools/./internal-tools/./seeds/./seed/./dev-seeder/`.split(`.`)),dl=new Set,fl=[`/test/`,`/tests/`,`/testing/`,`/__tests__/`,`/__test__/`,`/__fixtures__/`,`/fixtures/`,`/__mocks__/`,`/mocks/`,`/testUtils/`,`/test-utils/`,`/test-stubs/`,`/testutils/`,`/cypress/`,`/playwright/`,`/.storybook/`,`/.dumi/`,`/stories/`,`/__stories__/`,...ul,`/e2e/`,`/e2e-tests/`,`/integration-tests/`,`/benchmarks/`,`/benchmark/`,`/__benchmarks__/`,`/perf-tests/`],pl=[`.test.`,`.spec.`,`.cy.`,`.stories.`,`.story.`,`.bench.`,`.benchmark.`,`.e2e.`,`.integration-spec.`,`.int-spec.`,`.mock.`,`.mocks.`,`.fixture.`],ml=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(`,`)),hl=[`/src/`,`/app/`,`/lib/`,`/components/`,`/pages/`,`/features/`,`/modules/`,`/packages/`,`/apps/`,`/frontend/`,`/client/`],gl=fl.filter(e=>e.startsWith(`/.`)),_l=e=>{let t=-1;for(let n of hl){let r=e.lastIndexOf(n);r>t&&(t=r)}return t<0?e:e.slice(t)};let vl,yl=!1,bl,xl=!1;const Sl=e=>e?e===vl?yl:(vl=e,yl=Tl(e),yl):!1,Cl=e=>{if(!e)return!1;if(e===bl)return xl;bl=e;let t=e.replaceAll(`\\`,`/`),n=t.startsWith(`/`)?t:`/${t}`;return xl=Tl(n,hl.some(e=>n.includes(e))?ul:dl),xl},wl=(e,t)=>e?Tl(e,t):!1,Tl=(e,t=dl)=>{let n=e.replaceAll(`\\`,`/`),r=n.lastIndexOf(`/`),i=r===-1?n:n.slice(r+1);if(ml.has(i.toLowerCase()))return!0;for(let e of pl)if(i.includes(e))return!0;let a=n.startsWith(`/`)?n:`/${n}`;for(let e of gl)if(!t.has(e)&&a.includes(e))return!0;let o=_l(n);for(let e of fl)if(!t.has(e)&&(e.startsWith(`/.`)?n:o).includes(e))return!0;return!1},El=(e,t=Sl)=>n=>t(n.filename)?$c:e(n),Dl=e=>{let t=e?.[`react-doctor`];return typeof t!=`object`||!t||Array.isArray(t)?null:t},Ol=(e,t)=>Object.getOwnPropertyDescriptor(e,t)?.value,kl=(e,t)=>{let n=Dl(e);if(!n)return;let r=Ol(n,t);return typeof r==`string`?r:void 0},Al=(e,t)=>{let n=Dl(e);if(!n)return;let r=Ol(n,t);return typeof r==`number`&&Number.isFinite(r)?r:void 0},jl=new WeakMap,Ml=(e,t)=>{let n=Ol(e,t);if(Array.isArray(n))return n.filter(e=>typeof e==`string`&&e.length>0)},Nl=(e,t)=>{let n=Dl(e);if(!n)return;let r=jl.get(n);if(r||(r=new Map,jl.set(n,r)),r.has(t))return r.get(t);let i=Ml(n,t);return r.set(t,i),i},Pl=(e,t)=>Nl(e,t)??[],Fl=(e,t)=>Pl(e,`capabilities`).includes(t),Il=(e,t)=>{let n=Dl(e);return!n||Ol(n,`capabilities`)===void 0?!0:Fl(e,t)},Ll=(e,t,n)=>!t?.some(t=>!Il(e,t))&&!n?.some(t=>Fl(e,t)),Rl=(e,t,n)=>r=>Ll(r.settings,t,n)?e(r):$c,zl=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=cl(e);i=n.hasReactRuntime,r=!n.hasReactRuntime&&(n.hasNonReactRuntime||n.hasNonReactMarker),!r&&t(e)};continue}if(e===`JSXOpeningElement`){a.JSXOpeningElement=e=>{!i&&!r&&ll(e)&&(r=!0),!r&&t(e)};continue}a[e]=e=>{r||t(e)}}return`Program`in a||(a.Program=e=>{let t=cl(e);i=t.hasReactRuntime,r=!t.hasReactRuntime&&(t.hasNonReactRuntime||t.hasNonReactMarker)}),a}),W=e=>{if(!(`create`in e))return{...e,create:()=>$c};let t=e.tags,n=e.create,r=t?.includes(`test-noise`)&&!t?.includes(`migration-hint`);return t?.includes(`react-jsx-only`)&&(n=zl(n)),r&&(n=El(n,Cl)),(e.requires||e.disabledWhen)&&(n=Rl(n,e.requires,e.disabledWhen)),n===e.create?e:{...e,create:n}};let Bl;const Vl=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},Hl=e=>{if(Bl?.content===e)return Bl.lineStartOffsets;let t=Vl(e);return Bl={content:e,lineStartOffsets:t},t},G=(e,t)=>{if(Number.isNaN(t)||t<0)return{line:1,column:1};let n=Hl(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}},Ul=(e,t)=>G(e,e.search(t)),Wl=/\.(?:[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,Gl=/(?:^|\/)\.env(?:\.|$)/,Kl=/\.(?:[cm]?[jt]sx?)$/i,ql=/\.(?:[cm]?[jt]sx?|py|php)$/i,Jl=/\.(?:[cm]?[jt]sx?|py)$/i,Yl=/(?:^|\/)(?:api|backend|server|servers|middleware|route|routes|functions|lambdas|workers)(?:\/|$)|(?:^|\/)[^/]+\.server\.[cm]?[jt]sx?$/i,Xl=/(?:^|\/)(?:__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,Zl=/(?:^|\/)(?: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,Ql=/(?:^|\/)scripts(?:\/|$)/i,$l=/(?:^|\/)(?:examples?|tutorials?|demos?|samples?|playgrounds?)(?:\/|$)/i,eu=/(?:^|\/)(?:README|CHANGELOG|CONTRIBUTING|PUBLISHING|DOCS)\.mdx?$|\.mdx?$/i,tu=/(?:^|\/)(?: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,nu=/\.(iife|umd|global|min)\.js$/i,ru=[/(?:^|\/)\.next\/static\//,/(?:^|\/)\.output\/public\//,/(?:^|\/)build\/static\//,/(?:^|\/)dist\/assets\//,/(?:^|\/)public\//,/(?:^|\/)out\//,/(?:^|\/)storybook-static\//],iu=/\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/,au=new Set([`.next`,`.output`]),ou=e=>{let t=e.split(`/`);for(let e=0;e<t.length;e+=1)if(au.has(t[e])&&(t[e]===`.next`&&t[e+1]===`dev`||t[e+1]===`server`&&e+2<t.length))return!0;return!1},su=(e,t)=>ou(e)?!1:t||e.endsWith(`.map`)?!0:ru.some(t=>t.test(e)),cu=e=>/(?:^|\/)(?:package\.json|Dockerfile|docker-compose\.ya?ml|\.github\/workflows\/[^/]+\.ya?ml|vercel\.json|next\.config\.[cm]?[jt]s|netlify\.toml)$/i.test(e),lu=new Map,uu=(e,t)=>{let n=lu.get(t);n||(n=new Map,lu.set(t,n));let r=n.get(e);if(r!==void 0)return r;let i=t.test(e)&&!Xl.test(e)&&!Ql.test(e)&&!eu.test(e)&&!tu.test(e);return n.set(e,i),i},K=e=>/\.d\.[cm]?[jt]s$/i.test(e)?!1:uu(e,Kl),du=/<script\b|on(?:load|error|click|mouseover)\s*=/i,fu=/dangerouslyAllowSVG\s*:\s*true/i,pu=/<(?:object|embed|iframe)\b[^>]+(?:data|src)=["'][^"']+\.svg(?:\?[^"']*)?["']/i,mu=W({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`)&&su(e.relativePath,e.isGeneratedBundle)){if(du.test(e.content)){let n=Ul(e.content,du);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(!K(e.relativePath)&&!cu(e.relativePath))return t;let n=[fu,pu].find(t=>t.test(e.content));if(n!==void 0){let r=Ul(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}}),hu=e=>/(?:^|\/)(?:firestore\.rules|storage\.rules|database\.rules\.json)$/.test(e),gu=/\s/,_u=/[\p{ID_Continue}$]/u,vu=/["'`/]/g,yu=/["'`/{}]/g,bu=/["\\\n]/g,xu=/['\\\n]/g,Su=/[`\\$\n]/g,Cu=new Set([`return`,`typeof`,`case`,`in`,`of`,`new`,`delete`,`void`,`instanceof`,`do`,`else`,`yield`,`await`,`throw`]),wu=()=>{let e=[],t=[],n=-1,r=-1,i=()=>{n<0||(e.push(n),t.push(r),n=-1,r=-1)},a=(e,t)=>{if(e===r){r=t;return}if(e<r){r=Math.max(r,t);return}i(),n=e,r=t};return{blank:e=>a(e,e+1),blankSpan:a,isBlanked:i=>{if(i>=n&&i<r)return!0;for(let n=e.length-1;n>=0;--n)if(!(e[n]>i))return t[n]>i;return!1},apply:n=>{if(i(),e.length===0)return n;let r=[],a=0;for(let i=0;i<e.length;i+=1)r.push(n.slice(a,e[i]),` `.repeat(t[i]-e[i])),a=t[i];return r.push(n.slice(a)),r.join(``)}}},Tu=(e,t,n)=>{let r=n=>t.isBlanked(n)?` `:e[n],i=n-1;for(;i>=0&&gu.test(r(i));)--i;if(i<0)return!0;let a=r(i),o=i>0?r(i-1):``;if(_u.test(a)){let t=i;for(;t>0&&_u.test(r(t-1));)--t;return t>0&&r(t-1)===`.`?!1:Cu.has(e.slice(t,i+1))}return a===`<`?!1:a===`>`?o===`=`:a===`+`||a===`-`?o!==a:a===`!`?!(_u.test(o)||o===`)`||o===`]`):!(a===`)`||a===`]`||a===`}`||a===`"`||a===`'`||a==="`")},Eu=(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},Du=(e,t,n)=>{for(let r=t+1;r<e.length;r+=1){let t=e.charCodeAt(r);if(t===92){r+=1;continue}if(t===n)return!1;if(gu.test(e[r]))return!0}return!1},Ou=(e,t)=>{let n=e.length,r=wu(),i=-1,a=!1,o=[],s=0,c=t=>{t>=n||e.charCodeAt(t)===10||r.blank(t)};for(;s<n;){if(i===-1){let t=o.length>0?yu:vu;t.lastIndex=s;let n=t.exec(e);if(n===null)break;s=n.index}else{let t=i===34?bu:i===39?xu:Su;t.lastIndex=s;let o=t.exec(e),c=o===null?n:o.index;if(a&&c>s&&r.blankSpan(s,c),s=c,o===null)break}let l=e.charCodeAt(s),u=e.charCodeAt(s+1);if(i!==-1){if(l===92){a&&(c(s),c(s+1)),s+=2;continue}if(l===10&&i!==96){i=-1,s+=1;continue}if(l===i){i=-1,s+=1;continue}if(t&&i===96&&l===36&&u===123){o.push(0),i=-1,s+=2;continue}a&&c(s),s+=1;continue}if(l===34||l===39){i=l,a=t&&Du(e,s,l),s+=1;continue}if(l===96){i=96,a=t,s+=1;continue}if(l===47&&u===47){for(;s<n&&e.charCodeAt(s)!==10;)r.blank(s),s+=1;continue}if(l===47&&u===42){for(;s<n;){if(e.charCodeAt(s)===42&&e.charCodeAt(s+1)===47){r.blank(s),r.blank(s+1),s+=2;break}c(s),s+=1}continue}if(l===47){let n=Tu(e,r,s)?Eu(e,s):null;if(n!==null){if(t)for(let e=s+1;e<n-1;e+=1)c(e);s=n;continue}}if(o.length>0){let e=o.length-1;l===123?o[e]+=1:l===125&&(o[e]===0?(o.pop(),i=96,a=t):--o[e])}s+=1}return r.apply(e)},ku=e=>e.includes(`//`)||e.includes(`/*`)?Ou(e,!1):e,Au=e=>Ou(e,!0),ju=new WeakMap,Mu=new WeakMap,Nu=(e,t=!1)=>{if(!Kl.test(e.relativePath)&&!hu(e.relativePath))return e.content;let n=t?Mu:ju,r=n.get(e);if(r!==void 0)return r;let i=t?Au(e.content):ku(e.content);return n.set(e,i),i},q=({shouldScan:e,pattern:t,requireAll:n,suppressWhen:r,ignoreStringLiterals:i,message:a})=>o=>{if(!e(o))return[];let s=Nu(o,i);if(n!==void 0&&!n.every(e=>e.test(s)))return[];let c=-1;if(t instanceof RegExp)c=s.search(t);else for(let e=0;e<t.length&&(c=s.search(t[e]),!(c>=0));e+=1);if(c<0||r!==void 0&&r.test(s))return[];let{line:l,column:u}=G(s,c);return[{message:a,line:l,column:u}]},Pu=/\b(?:tool\s*\(\s*\{|createTool\s*\(|defineTool\s*\(|new\s+(?:DynamicTool|StructuredTool)\s*\()/,Fu=/\b(?:tool|createTool|defineTool|DynamicTool|StructuredTool)\b/,Iu=/(?:^|\/)(?:agents?|tools?|mcp)(?:\/|$)|(?:agent|tool|mcp)[^/]*\.[cm]?[jt]sx?$/i,Lu=W({id:`agent-tool-capability-risk`,defaultEnabled:!1,title:`Agent tool exposes dangerous capability`,severity:`warn`,recommendation:`Treat tool inputs as prompt-injection controlled. Validate arguments, scope permissions per call, and avoid exposing shell/file/network primitives directly to agents.`,scan:q({shouldScan:e=>K(e.relativePath)&&Iu.test(e.relativePath)&&Fu.test(e.content)&&iu.test(e.content),pattern:Pu,requireAll:[iu],ignoreStringLiterals:!0,message:`An agent-callable tool appears to expose network, filesystem, shell, or code-execution capability.`})}),Ru=W({id:`artifact-baas-authority-surface`,defaultEnabled:!1,title:`BaaS authority map shipped in browser artifact`,severity:`warn`,recommendation:`Client BaaS config is often public, but shipped collection names plus owner, role, tenant, or admin fields give attackers a precise authorization map. Verify rules/RLS enforce every boundary server-side.`,scan:q({shouldScan:e=>su(e.relativePath,e.isGeneratedBundle),pattern:/\b(?:collection\s*\(\s*["'](?:boosts|sessions|sessions_admin|users|orgs|candidateJobs|conversations|documents|profiles)|from\s*\(\s*["'](?:users|profiles|documents|organizations|memberships)|creatorID|creatorId|providerId|ghostOrg|ownerId|orgId|tenantId|workspaceId|isAdmin|SuperAdmin)\b/i,requireAll:[/\b(?:initializeApp|firebase|firestore|getFirestore)\b[\s\S]{0,700}\b(?:apiKey|authDomain|projectId|databaseURL|storageBucket)\b|\b(?:apiKey|authDomain|projectId|databaseURL|storageBucket)\b[\s\S]{0,700}\b(?:firebase|firestore|getFirestore|initializeApp)\b|\bcreateClient\b[\s\S]{0,700}\b(?:supabase|SUPABASE_URL)\b|\b(?:supabase|SUPABASE_URL)\b[\s\S]{0,700}\bcreateClient\b/i],message:`A browser artifact exposes Firebase/Supabase config together with sensitive collections or authorization fields.`})}),zu=new Set([`auth`,`getSession`,`getServerSession`,`getUser`,`requireAuth`,`checkAuth`,`verifyAuth`,`authenticate`,`currentUser`,`getAuth`,`validateSession`]),Bu=/^auth(?:n|z|ed|enticate[ds]?|enticating|entication|orize[ds]?|orizing|orization|orizer)?$/,Vu=new Set([`signedin`,`loggedin`,`signin`]),Hu=new Set([`require`,`ensure`,`assert`,`verify`,`validate`,`check`,`protect`,`enforce`,`guard`,`gate`,`restrict`,`is`,`has`,`can`,`must`]),Uu=new Set([`get`,`fetch`,`load`,`read`,`resolve`,`retrieve`,`use`]),Wu=new Set([`current`,`my`,`own`]),Gu=new Set([`session`,`sessions`,`login`,`admin`,`admins`,`superadmin`,`superuser`,`role`,`roles`,`permission`,`permissions`,`jwt`,`identity`,`principal`,`credential`,`credentials`]),Ku=new Set([`user`,`users`,`account`,`accounts`,`token`,`tokens`,`access`,`me`,`viewer`,`caller`,`subject`,`scope`,`scopes`]),qu=new Set([`getUser`]),Ju=/(?:^|[._])(?:auth|authn|authz|clerk|session|jwt|firebase|supabase|nextauth|kinde|workos|stytch|descope|cognito|propelauth|lucia)/i,Yu=[/^sk_live_/,/^sk_test_/,/^AKIA[0-9A-Z]{16}$/,/^ghp_[a-zA-Z0-9]{36}$/,/^gho_[a-zA-Z0-9]{36}$/,/^github_pat_/,/^glpat-/,/^xox[bporas]-/,/^sk-[a-zA-Z0-9]{32,}$/],Xu=[/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/,/\bAWS_SECRET_ACCESS_KEY\s*[:=]\s*["']?[A-Za-z0-9/+=]{35,}["']?/,/\bgithub_pat_[A-Za-z0-9_]{30,}\b/,/\bgh[pousr]_[A-Za-z0-9]{30,}\b/,/\bglpat-[A-Za-z0-9_-]{20,}\b/,/\bxox[baprs]-[A-Za-z0-9-]{20,}\b/,/\bsk_(?:live|test)_[A-Za-z0-9]{16,}\b/,/\brk_(?:live|test)_[A-Za-z0-9]{16,}\b/,/\bsk-[A-Za-z0-9_-]{32,}\b/,/\bsk-ant-api\d{2}-[A-Za-z0-9_-]{20,}\b/,/\blin_(?:api|oauth)_[A-Za-z0-9]{20,}\b/,/\bvercel_[A-Za-z0-9]{20,}\b/,/\bsntrys_[A-Za-z0-9_-]{20,}\b/,/\bkey-[a-f0-9]{32}\b/i,/\bnpm_[A-Za-z0-9]{30,}\b/,/\bSG\.[A-Za-z0-9_-]{20,}\.[A-Za-z0-9_-]{20,}\b/,/https:\/\/hooks\.slack\.com\/services\/T[A-Z0-9]+\/B[A-Z0-9]+\/[A-Za-z0-9]+/,/https:\/\/discord(?:app)?\.com\/api\/webhooks\/\d+\/[A-Za-z0-9_-]+/,/\bsb_secret_[A-Za-z0-9_]{20,}\b/,/\bservice_role\b/i,/"private_key"\s*:\s*"-----BEGIN PRIVATE KEY-----/,/-----BEGIN (?:RSA |EC |OPENSSH |DSA )?PRIVATE KEY-----/,/\b(?:postgres|mysql|mongodb(?:\+srv)?|redis):\/\/[^:\s/@]+:(?!(?:pass(?:word)?|my[a-z]*pass(?:word)?|mysecretpassword|myusername|postgres|mysql|redis|root|admin|minioadmin|secret|example|changeme|change_me|test|guest|placeholder|default|user(?:name)?|x{3,}|\*{2,}|\$\{[^}]*\}|\$[A-Z_]+|<[^>]*>|%[\w.]+%|\{\{[^}]*\}\})@)[^@\s/]+@(?!(?:localhost|127\.0\.0\.1|0\.0\.0\.0|host\.docker\.internal)(?:[:/\s]|$))[^\s:/@]*\./i],Zu=/\beyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{16,}\b/,Qu=/\b(?:NEXT_PUBLIC|VITE|REACT_APP|EXPO_PUBLIC)_[A-Z0-9_]*(?:SECRET|TOKEN|PASSWORD|PRIVATE|DATABASE_URL|SERVICE_ROLE|AWS_ACCESS_KEY|AWS_SECRET)[A-Z0-9_]*\b/i,$u=/\b(?:process\s*\.\s*env|import\s*\.\s*meta\s*\.\s*env|window\.__[A-Z0-9_]*ENV[A-Z0-9_]*__|__[A-Z0-9_]*ENV[A-Z0-9_]*__)\b/,ed=/\b(?:(?:process|window)\s*(?:\/[*/]|<!--|-->|\.\s*(?:\/[*/]|<!--|-->))|import\s*(?:\/[*/]|<!--|-->|\.\s*(?:\/[*/]|<!--|-->|meta\s*(?:\/[*/]|<!--|-->|\.\s*(?:\/[*/]|<!--|-->)))))/,td=/\b(?:DATABASE_URL|AWS_SECRET_ACCESS_KEY|AWS_ACCESS_KEY_ID|MAILGUN_API_KEY|SALESFORCE_CLIENT_SECRET|OKTA_CLIENT_SECRET|SESSION_SECRET|COOKIE_SECRET|PRIVATE_KEY|SERVICE_ROLE)\b/,nd=/(?:SENTRY_DSN|PUBLIC_KEY|(?:^|_)PUBLIC_TOKEN$|PUBLISHABLE|ANON_KEY|POSTHOG_(?:PROJECT_)?TOKEN|POSTHOG_KEY|TLDRAW_LICENSE_KEY|CLERK_PUBLISHABLE_KEY|ALGOLIA_SEARCH_KEY|GC_API_KEY|GOOGLE_MAPS_API_KEY|MAPBOX_TOKEN|MIXPANEL_TOKEN|FACEBOOK_CLIENT_TOKEN|(?:NEXT_PUBLIC|VITE|REACT_APP|EXPO_PUBLIC)_(?:DISABLE|ENABLE|ALLOW|REQUIRE)_)|(?:TOKEN|SECRET|PASSWORD|PRIVATE)_(?:KIND|TYPE|URL|URI|ENDPOINT|HEADER|NAME)$/i,rd=[/^appl_/,/^goog_/,/^amzn_/,/^strp_/,/^pk_(?:live|test)_/,/^sb_publishable_/,/^phc_/,/^public-token-(?:live|test)-/,/^pk\.eyJ/],id=[/^[\s._\-*\u2022xX]{8,}$/,/(?:\.{3,}|\u2026|[*\u2022]{3,})/,/(?:^|[_\-\s])(?:your|redacted|masked|placeholder|replace[_\-\s]?me|changeme)(?:$|[_\-\s])/i,/<[^>]*(?:auth|credential|key|password|secret|token|your|redacted|placeholder|masked)[^>]*>/i,/\[[^\]]*(?:auth|credential|key|password|secret|token|your|redacted|placeholder|masked)[^\]]*\]/i,/\{[^}]*(?:auth|credential|key|password|secret|token|your|redacted|placeholder|masked)[^}]*\}/i],ad=[/(?:^|[_\-\s])(?:example|sample|dummy)(?:$|[_\-\s])/i],od=/(?:placeholder|example|sample|dummy|masked|redacted|mask)/i,sd=/(?:api_?key|secret|token|password|credential|auth(?!or(?!i[sz])))/i,cd=/(?:^|\/)[^/]+\.config\.[cm]?[jt]s$/,ld=/(?:^|\/)(?:\.[a-z-]+rc|[a-z-]+\.rc)\.[cm]?[jt]s$/,ud=/(?:^|\/)[^/]+\.(?:test|spec|stories|story|fixture|fixtures)\.[cm]?[jt]sx?$/,dd=/(?:^|\/)[^/]+\.server\.[cm]?[jt]sx?$/,fd=/(?:^|\/)(?:middleware|proxy|route)\.[cm]?[jt]sx?$/,pd=/(?:^|\/)pages\/api\/.+\.[cm]?[jt]sx?$/,md=/(?:^|\/)[^/]+\.(?:client|browser|web)\.[cm]?[jt]sx?$/,hd=/(?:^|\/)(?:src\/)?(?:main|index|[Aa]pp|client)\.[cm]?[jt]sx?$/,gd=new Set([`backend`,`functions`,`lambdas`,`lambda`,`middleware`,`server`,`servers`]),_d=new Set([`api`,`backend`,`edge`,`function`,`functions`,`lambda`,`lambdas`,`server`,`servers`,`worker`,`workers`]),vd=new Set([`__fixtures__`,`__mocks__`,`__tests__`,`fixtures`,`mocks`,`test`,`tests`]),yd=new Set([`bin`,`config`,`configs`,`script`,`scripts`,`tooling`,`tools`]),bd=new Set([`components`,`features`,`hooks`,`pages`,`ui`,`views`,`widgets`]),xd=new Set(`alert.modal.label.text.title.name.id.url.path.route.page.param.field.column.header.placeholder.prefix.description.type.icon.class.style.variant.event.action.status.state.mode.flag.option.config.message.error.display.view.component.element.container.wrapper.button.link.input.select.dialog.menu.form.step.index.count.length.role.scope.context.provider.ref.handler.query.schema.constant`.split(`.`)),Sd=new Set([`start`,`end`]),J=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),Cd=new RegExp(Qu.source,`gi`),wd=e=>{for(let t of e.matchAll(Cd)){let e=t[0]??``;if(!nd.test(e))return new RegExp(J(e))}},Td=e=>$u.test(e)&&td.test(e),Ed=/\.(?:[cm]?[jt]sx?)$/i,Dd=/\/\/|\/\*|<!--/,Od=new Set([`\r`,`
@@ -25,4 +25,4 @@ import*as e from"node:path";import*as t from"node:fs";import{readFileSync as n}f
25
25
  `&&(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(``)},bg=/disable\s+row\s+level\s+security/i,xg=/auth\.role\(\)\s*=\s*["']service_role["']/i,Sg=/create\s+policy/gi,Cg=/;|create\s+policy/i,wg=/\b(?:using|with\s+check)\s*\(\s*true\s*\)/i,Tg=/\bfor\s+select\b/i,Eg=/\bto\s+([\s\S]+?)(?=\s+(?:using|with\s+check|as|for)\b|;|$)/i,Dg=new Set([`service_role`,`postgres`,`supabase_admin`]),Og=e=>{let t=Eg.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=>Dg.has(e))},kg=(e,t)=>xg.test(t)?!0:!wg.test(e)||Tg.test(e)?!1:!Og(e),Ag=W({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(!mg(e.relativePath))return[];let t=yg(e.content),n=t.search(bg);Sg.lastIndex=0;for(let r=Sg.exec(t);r!==null;r=Sg.exec(t)){let i=r.index+r[0].length,a=t.slice(i).search(Cg),o=a<0?t.length:i+a;if(kg(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}=G(t,n);return[{message:`Supabase policy SQL disables RLS, permits writes broadly, or references a service-role bypass.`,line:r,column:i}]}}),jg=/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,Mg=/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,Ng=/\benable\s+row\s+level\s+security\b/gi,Pg=e=>{let t=new Map,n=0;for(let r of e.matchAll(Mg)){let e=r[1];e!==void 0&&(n+=1,t.set(e.toLowerCase(),r.index))}return{lastEnableIndexByTable:t,staticEnableCount:n}},Fg=(e,t)=>(e.match(Ng)?.length??0)>t,Ig=W({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(!pg(e.relativePath))return[];let t=yg(e.content);if(!/create\s+(?:unlogged\s+)?table/i.test(t))return[];let n=[],{lastEnableIndexByTable:r,staticEnableCount:i}=Pg(t);if(Fg(t,i))return[];jg.lastIndex=0;for(let e=jg.exec(t);e!==null;e=jg.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=G(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}}),Lg=W({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:q({shouldScan:e=>K(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.`})}),Rg=e=>K(e)?Yl.test(e)?!0:/(?:^|\/)(?:middleware|route)\.[cm]?[jt]sx?$/.test(e):!1,zg=W({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:q({shouldScan:e=>Rg(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.`})}),Bg=[/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],Vg=/\$\{|["'`]\s*\+\s*$/,Hg=/^\s*\{(?!\{)/,Ug=/"(?:[^"\\\n]|\\.)*"|'(?:[^'\\\n]|\\.)*'/g,Wg=/\b(?:true|false|null)\b|[\d.]+(?:e[+-]?\d+)?/gi,Gg=e=>{if(e.includes("`")||e.includes("${"))return!1;let t=e.replace(Ug,``).replace(Wg,``);return!/[A-Za-z_$]/.test(t)},Kg=/^[\s)]*\.replace\s*\([^)]*(?:\\u003[cC]|&lt;|<)/,qg=/(?:\b(?:escapeHtml|escapeJSON|escapeJson|htmlEscape|jsesc)|(?<![.\w])(?:serialize|serializeJavascript|devalue|uneval|superjson))\s*\(\s*$/i,Jg=/\bJSON\.stringify\s*\($/i,Yg=W({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(!K(e.relativePath))return[];let t=Nu(e);if(!t.includes(`JSON.stringify`))return[];let n=[],r=new Set;for(let[e,i]of Bg.entries()){i.lastIndex=0;for(let a=i.exec(t);a!==null;a=i.exec(t)){let i=a[0].replace(Jg,``);if(qg.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(!Vg.test(r)||Hg.test(r))continue}}let o=a.index+a[0].length-1,s=df(t,o);if(s>=0){let e=t.slice(s+1,s+1+160);if(Kg.test(e)||Gg(t.slice(o+1,s)))continue}if(r.has(a.index))continue;r.add(a.index);let c=G(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}}),Xg=/(?:(?<![.\w$])fetch|\baxios\.\s*(?:get|post|put|delete|head)|\bgot|\bgot\.\s*(?:get|post))\s*\(\s*([^,)]+)/,Zg=/\b(?:url|targetUrl|callbackUrl|redirectUrl|webhookUrl|companyUrl|websiteUrl|domainUrl|imageUrl|fetchUrl|next|return_to|returnTo|destination|location)\b/i,Qg=/\breq\.|\brequest\.(?:query|body|params|nextUrl)|\bsearchParams\b|\bparams\.|\bbody\.|\bquery\./,$g=/\bredirect\s*:\s*["'](?:manual|error)["']/,e_=/\b(params|body|query)\./g,t_=(e,t)=>RegExp(`(?:const|let|var)\\s+${e}\\s*(?::[^=;\\n]{0,80})?=\\s*new\\s+URLSearchParams\\b`).test(t),n_=(e,t)=>{let n=e.replace(e_,(e,n)=>t_(n,t)?``:e);return Qg.test(n)},r_=(e,t)=>{if(n_(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)||n_(n,t))return!0}return!1},i_=W({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(!Rg(e.relativePath)||!Xg.test(e.content))return[];let t=[],n=e.content.split(`
26
26
  `);for(let r=0;r<n.length;r+=1){let i=n[r]??``,a=i.match(Xg),o=a?.[1]??``;if(!a||!Zg.test(o)||!r_(o,e.content))continue;let s=n.slice(r,r+5).join(`
27
27
  `);$g.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}}),a_=W({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:q({shouldScan:e=>gm(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.`})}),o_=/(?:^|\/)[^/]*webhook[^/]*\/|(?:^|\/)[^/]*webhook[^/]*\.[cm]?[jt]s$|\bwebhook\b/i,s_=/\b(?:export\s+(?:async\s+)?function\s+POST|export\s+const\s+(?:POST|handler|webhook)|webhookHandler|webhookRoute)\b/i,c_=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`),l_=/webhook[\s_-]?ur[il]\w*/gi,u_=/process\.env\.\w*WEBHOOK_URL|\b(?:send|post|dispatch|publish|notify)\w*Webhook/,d_=/\b(?:req|request)\b/,f_=/\/\/[^\n]*|\/\*[\s\S]*?\*\/|"(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])*'|`(?:\\.|[^`\\])*`/g,p_=W({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:q({shouldScan:e=>{if(!K(e.relativePath)||u_.test(e.content))return!1;let t=e.content.replace(f_,``).replace(l_,``);return o_.test(e.relativePath)||o_.test(t)},pattern:s_,requireAll:[d_],suppressWhen:c_,message:`Webhook handler code does not show an obvious signature verification step.`})}),m_=/\.[cm]?[jt]sx?$/i,h_=/\.d\.[cm]?[jt]s$/i,g_=/\.mdx$/i,__=/\.html?$/i,v_=new Set([`.angular`,`.astro`,`.cache`,`.contentlayer`,`.docusaurus`,`.expo`,`.git`,`.next`,`.nuxt`,`.output`,`.svelte-kit`,`.turbo`,`.vercel`,`build`,`coverage`,`dist`,`node_modules`,`out`,`storybook-static`]),y_=new WeakMap,b_=e=>{let t=y_.get(e);if(t)return t;let n=ft(e);return y_.set(e,n),n},x_=n=>{let r=[],i=[],a=[n],o=!1;for(;a.length>0;){let n=a.pop();if(!n)continue;let s;try{s=t.readdirSync(n,{withFileTypes:!0})}catch{return null}for(let t of s){let s=e.join(n,t.name),c=v_.has(t.name)||t.name.startsWith(`.`)&&t.name!==`.dumi`&&t.name!==`.storybook`;if(!(t.isSymbolicLink()&&c)){if(t.isSymbolicLink())return null;if(t.isDirectory()){if(c)continue;a.push(s);continue}if(!(!t.isFile()||Sl(s))){if(g_.test(t.name)){o=!0;continue}if(__.test(t.name)){i.push(z(s));continue}m_.test(t.name)&&(h_.test(t.name)||r.push(z(s)))}}}}return{sourceFilePaths:r,htmlFilePaths:i,hasOpaqueMdxConsumerSurface:o}},S_=(e,n)=>{for(let r of e){let e;try{e=t.readFileSync(r,`utf8`)}catch{return!0}for(let t of n)if(e.includes(`"${t}"`)||e.includes(`'${t}'`))return!0}return!1},C_=e=>{if(T(e,`ImportDeclaration`))return tl(e)?null:typeof e.source.value==`string`?e.source.value:null;if(T(e,`ExportNamedDeclaration`))return e.exportKind===`type`||el(e.specifiers,`ExportSpecifier`,`exportKind`)?null:e.source&&typeof e.source.value==`string`?e.source.value:null;if(T(e,`ExportAllDeclaration`))return e.exportKind===`type`?null:typeof e.source.value==`string`?e.source.value:null;if(T(e,`ImportExpression`))return T(e.source,`Literal`)&&typeof e.source.value==`string`?e.source.value:null;if(T(e,`CallExpression`)&&T(e.callee,`Identifier`)&&e.callee.name===`require`&&e.arguments.length===1){let t=e.arguments[0];return t&&T(t,`Literal`)&&typeof t.value==`string`?t.value:null}return null},w_=(e,t,n,r)=>{L(e.programNode,i=>{let a=C_(i);if(!a)return;let o=$n(e.filePath,a);if(!o){r.add(a);return}let s=z(o);n.set(i,s);let c=t.get(s)??new Set;c.add(e),t.set(s,c)})},T_=({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=x_(e);if(!o||i.length>0&&a===void 0&&!S_(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=hn(e);if(!i||!T(i,`Program`))return null;s.set(e,{filePath:e,programNode:i,scopes:b_(i)})}let c=new Map,l=new WeakMap,u=new Set;for(let e of s.values())w_(e,c,l,u);return{modulesByFilePath:s,htmlFilePaths:o.htmlFilePaths,consumerModulesByFilePath:c,resolvedSourcePathByNode:l,unresolvedRuntimeSources:u,hasOpaqueMdxConsumerSurface:o.hasOpaqueMdxConsumerSurface}},E_=e=>{if(!e)return null;let t=A(e);return!T(t,`Literal`)||typeof t.value!=`boolean`?null:t.value},D_=(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=A(e.expression);if(T(n,`Literal`)){if(typeof n.value!=`string`){if(a)continue;return null}o.push(n.value);continue}if(T(n,`TemplateLiteral`)){let e=zt(n);if(e===null){if(a)continue;return null}o.push(e);continue}if(T(n,`ConditionalExpression`)){let t=i?E_(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&&T(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(T(n,`Identifier`)){let r=t.referenceFor(n)?.resolvedSymbol;if(!r||r.kind!==`const`||!r.initializer||!T(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},O_=(e,t,n={})=>D_(e,t,n),k_=(e,t)=>D_(e,t,{shouldKeepKnownValues:!0}),A_=(e,t,n,r,i=!1)=>{let a=e.value;return a?T(a,`Literal`)?typeof a.value==`string`?[a.value]:null:T(a,`JSXExpressionContainer`)?O_(a.expression,t,{maximumConstAliases:n,shouldFoldStaticConditions:r,shouldKeepKnownValues:i}):null:null},j_=(e,t)=>A_(e,t,4,!1),M_=(e,t)=>A_(e,t,null,!0),N_=(e,t)=>A_(e,t,4,!1,!0),P_=(t,n)=>{let r=e.relative(n,t);return r===``||!r.startsWith(`..${e.sep}`)&&r!==`..`&&!e.isAbsolute(r)},F_={attribute:null,expression:null,isPresent:!1,isUnknown:!1},I_={attribute:null,expression:null,isPresent:!1,isUnknown:!0},L_=(e,t,n)=>{for(let r=e.properties.length-1;r>=0;--r){let i=e.properties[r];if(!i)return I_;if(T(i,`SpreadElement`)){if(!T(i.argument,`ObjectExpression`))return I_;let e=L_(i.argument,t,n);if(e.isPresent||e.isUnknown)return e;continue}if(!T(i,`Property`))return I_;let a=P(i,{allowComputedString:!0});if(!a)return I_;if((n?a:a.toLowerCase())===t)return{attribute:null,expression:i.value,isPresent:!0,isUnknown:!1}}return F_},R_=(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 I_;if(T(i,`JSXSpreadAttribute`)){if(!T(i.argument,`ObjectExpression`))return I_;let e=L_(i.argument,r,n);if(e.isPresent||e.isUnknown)return e;continue}if(!T(i,`JSXAttribute`))continue;let a=xs(i.name);if((n?a:a?.toLowerCase())===r)return{attribute:i,expression:null,isPresent:!0,isUnknown:!1}}return F_},z_=/(?<attributeName>[^\s"'<>/=]+)(?:\s*=\s*(?:"(?<doubleQuoted>[^"]*)"|'(?<singleQuoted>[^']*)'|(?<unquoted>[^\s"'=<>`]+)))?/g,B_=/<!--[\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,V_=new Map,H_=(e,t,n)=>{if(!e.isPresent)return;let r=e.attribute?N_(e.attribute,t):e.expression?k_(e.expression,t):null;for(let e of r??[]){let t=e?.trim();t&&n.add(t)}},U_=(e,t,n)=>{for(let r of e.properties){if(T(r,`SpreadElement`)){T(r.argument,`ObjectExpression`)&&U_(r.argument,t,n);continue}if(T(r,`Property`)&&P(r,{allowComputedString:!0})?.toLowerCase()===`id`)for(let e of k_(r.value,t)??[]){let t=e.trim();t&&n.add(t)}}},W_=e=>{let t=e.parent;for(T(t,`JSXElement`)&&t.openingElement===e&&(t=t.parent);t;){if(T(t,`JSXElement`)&&Rs(t.openingElement)===`template`)return!0;t=t.parent}return!1},G_=(e,t,n)=>{L(e,e=>{if(!T(e,`JSXOpeningElement`)||W_(e))return;let r=R_(e.attributes,`id`,!1);if(r.isUnknown){for(let r of e.attributes)H_(R_([r],`id`,!1),t,n),T(r,`JSXSpreadAttribute`)&&T(r.argument,`ObjectExpression`)&&U_(r.argument,t,n);return}H_(r,t,n)})},K_=(e,t)=>{for(let n of e.matchAll(B_)){let e=n.groups?.skippedContentOpeningTag??n.groups?.openingTag;if(e)for(let n of e.matchAll(z_)){if(n.groups?.attributeName?.toLowerCase()!==`id`)continue;let e=n.groups?.doubleQuoted??n.groups?.singleQuoted??n.groups?.unquoted??``;e.trim()&&t.add(e.trim())}}},q_=t=>{if(!e.isAbsolute(t.currentFilePath))return null;let n=t.configuredRootDirectory?z(t.configuredRootDirectory):null;return!n||!P_(t.currentFilePath,n)?null:n},J_=()=>{V_.clear()},Y_=e=>{let n=new Set;G_(e.currentProgramNode,e.currentScopes,n);let r=q_(e);if(!r)return n;if(V_.has(r)){let e=V_.get(r);return e?new Set([...e,...n]):null}let i=T_({rootDirectory:r,currentFilePath:z(e.currentFilePath),currentProgramNode:e.currentProgramNode,currentScopes:e.currentScopes});if(!i)return V_.set(r,null),null;let a=new Set;for(let e of i.modulesByFilePath.values())G_(e.programNode,e.scopes,a);try{for(let e of i.htmlFilePaths)K_(t.readFileSync(e,`utf8`),a)}catch{return V_.set(r,null),null}return V_.set(r,a),new Set([...a,...n])},X_=new Map,Z_=()=>{X_.clear()},Q_=e=>{let n=X_.get(e);if(n!==void 0)return n;let r;try{r=t.realpathSync(e)}catch{r=e}return X_.set(e,r),r},$_=(e,t,n)=>{if(t===void 0||t.length===0)return!1;let r=z(Q_(e)),i=z(t);if(n&&r===i)return!0;let a=i.endsWith(`/`)?i:`${i}/`;return r.startsWith(a)},ev=/webpackIgnore\s*:\s*true|@vite-ignore/,tv=new Map,nv=()=>{tv.clear()},rv=e=>{if(!e)return null;let t=tv.get(e);if(t!==void 0)return t===!1?null:t;let r=!1;try{let t=n(e,`utf8`);ev.test(t)&&(r=t)}catch{r=!1}return tv.set(e,r),r===!1?null:r},iv=()=>{nv(),tr(),we(),Ln(),Z_(),J_(),Qn()},av=e=>Wl.test(e)||Gl.test(e),ov=e=>{let t=nu.test(e);return rg(e)||mg(e)||hu(e)||cu(e)?{bucket:`priority`,isGeneratedBundleByName:t}:su(e,t)?{bucket:`artifact`,isGeneratedBundleByName:t}:av(e)?{bucket:`other`,isGeneratedBundleByName:t}:null},sv=(e,t)=>t||av(e)||cu(e)||rg(e),cv=[`nextjs`,`astro`,`vite`,`cra`,`remix`,`gatsby`,`expo`,`react-native`,`tanstack-start`,`preact`,`unknown`];export{yf as $,O as $i,Ta as $n,oi as $r,el as $t,Zh as A,oe as Aa,ir as Ai,Do as An,na as Ar,fd as At,hh as B,u as Ba,zt as Bi,ao as Bn,Bi as Br,Ru as Bt,fg as C,ee as Ca,Sr as Ci,ts as Cn,da as Cr,ad as Ct,ag as D,ie as Da,L as Di,Qo as Dn,la as Dr,od as Dt,sg as E,ue as Ea,or as Ei,Xo as En,Sa as Er,Yu as Et,Th as F,v as Fa,an as Fi,So as Fn,$i as Fr,yd as Ft,bm as G,M as Gi,eo as Gn,Ki as Gr,Nl as Gt,th as H,l as Ha,Pt as Hi,ro as Hn,zi as Hr,mu as Ht,wh as I,p as Ia,tn as Ii,mo as In,ra as Ir,cd as It,hm as J,At as Ji,qa as Jn,Ri as Jr,Fl as Jt,ym as K,jt as Ki,to as Kn,Gi as Kr,Pl as Kt,Ch as L,f as La,Ut as Li,po as Ln,Xi as Lr,ld as Lt,Ih as M,y as Ma,$n as Mi,ko as Mn,ea as Mr,_d as Mt,Oh as N,g as Na,In as Ni,B as Nn,qi as Nr,vd as Nt,ng as O,ce as Oa,ar as Oi,ns as On,fa as Or,Sd as Ot,Dh as P,h as Pa,hn as Pi,Co as Pn,Ji as Pr,ud as Pt,vf as Q,Tt as Qi,Ba as Qn,si as Qr,wl as Qt,vh as R,m as Ra,Vt as Ri,fo as Rn,Zi as Rr,id as Rt,Ag as S,le as Sa,xr as Si,Zo as Sn,aa as Sr,bd as St,cg as T,ne as Ta,dr as Ti,es as Tn,sa as Tr,pd as Tt,Nm as U,c as Ua,N as Ui,$a as Un,Ui as Ur,W as Ut,fh as V,d as Va,P as Vi,io as Vn,Vi as Vr,Lu as Vt,Em as W,Mt as Wi,no as Wn,Hi as Wr,Al as Wt,Gf as X,kt as Xi,Ra as Xn,Si as Xr,El as Xt,Kf as Y,A as Yi,z as Yn,Ii as Yr,Il as Yt,Ff as Z,Ot as Zi,Ua as Zn,ci as Zr,Sl as Zt,i_ as _,S as _a,vr as _i,ms as _n,ba as _r,Ku as _t,ev as a,mt as aa,jr as ai,Oc as an,Ma as ar,ef as at,Lg as b,fe as ba,pr as bi,V as bn,pa as br,hd as bt,Y_ as c,pt as ca,yr as ci,Bs as cn,Oa as cr,Ud as ct,M_ as d,C as da,Er as di,Fs as dn,ca as dr,Uu as dt,St as ea,R as ei,tl as en,va as er,_f as et,j_ as f,Le as fa,Or as fi,Ps as fn,wa as fr,Ju as ft,a_ as g,Oe as ga,wr as gi,_s as gn,ia as gr,Bu as gt,p_ as h,De as ha,gr as hi,bs as hn,ma as hr,Gu as ht,iv as i,ht as ia,Hr as ii,Qc as in,ga as ir,lf as it,qh as j,de as ja,I as ji,Oo as jn,ta as jr,dd as jt,$h as k,ae as ka,rr as ki,Ao as kn,Yi as kr,gd as kt,R_ as l,T as la,Cr as li,zs as ln,ka as lr,Hu as lt,T_ as m,Ee as ma,_r as mi,xs as mn,_a as mr,Vu as mt,ov as n,_t as na,Wr as ni,Xc as nn,Ca as nr,X as nt,rv as o,gt as oa,Mr as oi,Gs as on,Aa as or,$d as ot,E_ as p,Fe as pa,br as pi,ws as pn,ha as pr,Wu as pt,vm as q,j as qi,Ja as qn,Wi as qr,kl as qt,sv as r,D as ra,Vr as ri,Zc as rn,xa as rr,uf as rt,$_ as s,ft as sa,Pr as si,Vs as sn,ja as sr,Wd as st,cv as t,vt as ta,ii as ti,$c as tn,Ea as tr,pf as tt,P_ as u,w as ua,Tr as ui,Rs as un,Da as ur,zu as ut,Yg as v,ge as va,fr as vi,as as vn,Na as vr,qu as vt,lg as w,te as wa,Dr as wi,$o as wn,ua as wr,xd as wt,Ig as x,se as xa,mr as xi,is as xn,ya as xr,md as xt,zg as y,pe as ya,kr as yi,rs as yn,oa as yr,rd as yt,_h as z,_ as za,Bt as zi,oo as zn,Qi as zr,sd as zt};
28
- //# sourceMappingURL=capability-CCHJDJaL.js.map
28
+ //# sourceMappingURL=capability-CpRm9X0w.js.map