import*as a from"path";import{DEFAULT_THEME_NAME as i,USER_THEME_ALIAS as T}from"../../constants/common.js";import{logger as m}from"../../server/tools/notifiers/logger.js";import{resolveTheme as A}from"./resolveTheme.js";import{EntitlementsProvider as F}from"../../server/entitlements/entitlements-provider.js";const y=["markdoc/attributes/code-walkthrough-filesets.ts","markdoc/attributes/code-walkthrough-filters.ts","markdoc/components/CodeWalkthrough/**","markdoc/tags/code-step.ts","markdoc/tags/code-toggle.ts","markdoc/tags/code-walkthrough.ts"],p=["./core/**","./markdoc/**/default.*","**/__mocks__/**","**/index.*","**/utils/**/*","**/__tests__/**/*","**/__snapshots__/**/*","**/*.stories.*","**/variables.*",...y],v=["./components/CatalogClassic/CatalogClassicCard.*","./components/ColorModeSwitcher/**","./components/Feedback/**","./components/Filter/**","./components/Footer/**","./components/LanguagePicker/**","./components/Menu/**","./components/Navbar/**","./components/PageNavigation/**","./components/Product/**","./components/Search/**","./components/UserMenu/**","./layouts/RootLayout.*","./layouts/NotFound.*","./icons/**","./markdoc/**","./ext/**"];async function C(t){const[l,r]=t._,{theme:d,force:g,onSuccess:u,onError:h,onOverride:E,config:_}=t,f=F.instance(),s=a.resolve(t["project-dir"]);let o=d;o||(o=i);const n=await A(s,_.plugins||[],o,r);n||m.panicOnContentError(`Theme ${o} not found. Skipping eject.`);const e=n?.config.ejectIgnore;e&&!Array.isArray(e)&&m.warn("'ejectIgnore' must be of type Array. Skipping.");const c=await f.getPackageEjectIgnore(),k={force:g,onSuccess:u,onError:h,onOverride:E,onlyFiles:o===i?v:void 0,ignoreFiles:Array.isArray(e)?[...e,...c,...p]:[...c,...p]};return{objectType:l,pathToThemeFolder:n?.pluginDirAbsolutePath,pathToPortalCustomThemeFolder:a.resolve(s,T),componentToEject:r,theme:o,options:k}}export{p as DEFAULT_IGNORED_FILES,v as EJECTABLE_FILES,C as default};
