@donotdev/core 0.0.42 → 0.0.44

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/vite/index.js CHANGED
@@ -1,10 +1,10 @@
1
- var Qt=Object.defineProperty;var Le=(n,e)=>()=>(n&&(e=n(n=0)),e);var es=(n,e)=>{for(var t in e)Qt(n,t,{get:e[t],enumerable:!0})};function nt(n,e=null){let t=Q[n];if(!t)throw new Error(`Unknown pattern type: ${n}`);return e&&t.framework?{...t,framework:t.framework.map(s=>`${e}/${s}`)}:t}function Ne(n){return rt[n]||rt.base}var We,C,V,j,Ge,xe,Ae,Q,me,ot,Be,Ve,Se,He,rt,L=Le(()=>{"use strict";We={HOMEPAGE_FILE:"HomePage.tsx",HOMEPAGE_PATH:"/",HOMEPAGE_COMPONENT:"HomePage"},C={routes:"virtual:routes",themes:"virtual:themes",i18n:"virtual:i18n-mapping",assets:"virtual:assets",env:"virtual:env"},V={routes:"routes",themes:"themes",i18n:"i18n",assets:"assets",env:"env"},j={next:{middleware:"middleware.ts",routeManifest:"public/route-manifest.json",assetManifest:"public/asset-manifest.json",utilities:"src/styles/utilities.generated.css",appPages:"src/app",appLayout:"src/app/layout.tsx",configRoute:"src/config/dndev-config-route.js",configTheme:"src/config/dndev-config-theme.js",configI18n:"src/config/dndev-config-i18n.js",configPwa:"src/config/dndev-config-pwa.js",configAsset:"src/config/dndev-config-asset.js",configSeo:"src/config/dndev-config-seo.js",configEnv:"src/config/dndev-config-env.js",configServer:"src/config/dndev-config-server.js"},vite:{routeInspection:"src/routes.generated.log",themeInspection:"src/themes.generated.log",i18nInspection:"src/i18n.generated.log",assetInspection:"src/assets.generated.log",envInspection:"src/env.generated.log"},manifests:{route:"route-manifest.json",theme:"theme-manifest.json",i18n:"i18n-manifest.json",asset:"asset-manifest.json",feature:"feature-manifest.json",env:"env-manifest.json"}},Ge={package:"@donotdev/ui",assetsPath:"packages/ui/assets",browserTargets:["> 1%","last 2 versions","Firefox ESR","not dead","not op_mini all"]},xe={public:"public",fonts:"fonts",nodeModules:"node_modules",packages:"packages",core:"core",ui:"ui"},Ae={SOURCE_ROOT:"packages/core/i18n",SOURCE_LOCALES:"packages/core/i18n/locales",SOURCE_EAGER:"packages/core/i18n/locales/eager",SOURCE_LAZY:"packages/core/i18n/locales/lazy",PUBLISHED_ROOT:"i18n",PUBLISHED_LOCALES:"i18n/locales",PUBLISHED_EAGER:"i18n/locales/eager",PUBLISHED_LAZY:"i18n/locales/lazy"},Q={routes:{consumer:["src/**/*Page.tsx","src/pages/**/*Page.tsx"],exclude:["**/node_modules/**","**/dist/**","**/build/**","**/*.test.tsx","**/*.stories.tsx"],extensions:[".tsx"]},css:{consumer:["src/**/*.css"],themes:["src/**/*.css"],extensions:[".css",".scss",".sass"],framework:["packages/ui/src/**/*.css","packages/core/components/src/**/*.css","packages/core/templates/src/**/*.css"]},i18n:{eager:["src/locales/*_*.json"],lazy:["src/**/locales/*_*.json","!src/locales/*_*.json","../../entities/locales/*_*.json"],additional:[],framework:{eager:[`${Ae.SOURCE_EAGER}/*_*.json`],lazy:[`${Ae.SOURCE_LAZY}/*_*.json`]},extensions:[".json"]},assets:{consumer:["public/**/*"],fallback:["manifest.json"],modern:["logo.svg","favicon.svg","apple-touch-icon.png","android-chrome-192x192.png","android-chrome-512x512.png"],patterns:["favicon.svg","favicon.ico","favicon-*.png","logo.svg","logo.png","logo.webp","logo.avif","apple-touch-icon*.png","android-chrome-*.png","manifest.json"],fonts:["fonts/**/*.woff2","fonts/**/*.woff","fonts/**/*.ttf"],framework:["packages/ui/assets/**/*"]},pwa:{consumer:["public/manifest.json","public/service-worker.js","public/sw.js","public/icon-192x192.png","public/icon-512x512.png","public/favicon.ico","public/favicon.svg","public/apple-touch-icon.png","public/logo.svg"],exclude:["**/node_modules/**","**/dist/**","**/build/**"],extensions:[".json",".js",".png",".svg",".ico"],framework:["packages/ui/assets/**/*"]},globalIgnore:["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/coverage/**","**/test/**"]},me={mandatoryIncludes:["react","react-dom","react-router-dom","zustand","lucide-react","valibot","i18next","i18next-browser-languagedetector","i18next-http-backend","react-i18next","@tanstack/react-query","react-helmet-async"],optionalFeatures:[],coreBundled:["@donotdev/types","@donotdev/utils","@donotdev/stores","@donotdev/schemas","@donotdev/hooks","@donotdev/i18n","@donotdev/config"],componentsBundled:["class-variance-authority","clsx","lucide-react","react-day-picker"],radixUIPattern:"@radix-ui/",buildTools:["esbuild","@esbuild/win32-x64","@esbuild/darwin-x64","@esbuild/linux-x64","@esbuild/darwin-arm64","@esbuild/linux-arm64","vite","rollup","rollup-plugin-visualizer","@vitejs/plugin-react","vite-tsconfig-paths","vite-plugin-pwa","vite-plugin-compression2","vite-plugin-node-polyfills","fsevents","postcss","postcss-import","postcss-nesting","autoprefixer"],buildTimePackages:[],largeOptional:["@sentry/react","framer-motion","stripe","@tanstack/react-query","shiki","@tiptap/react","@tiptap/starter-kit","@tiptap/extension-placeholder","sharp","semver","file-type"]},ot=["firebase-admin","gcp-metadata","google-logging-utils","payload","undici","@fastify/busboy","image-size","@donotdev/tooling","fs","path","crypto","net","tls","http","https","child_process","os","util","stream","buffer","events","querystring","url","zlib","assert","constants","domain","punycode","string_decoder","timers","tty","vm","worker_threads","cluster","dgram","dns","http2","inspector","module","perf_hooks","process","readline","repl","trace_events","v8","wasi"],Be=["@donotdev/core/functions","@donotdev/core/server"],Ve={selectors:{class:/\.([a-zA-Z0-9-]+)/g,variable:/--[a-zA-Z0-9-]+/g,keyframe:/@keyframes\s+([a-zA-Z0-9-]+)/g},themes:{themeClass:/(?::root\.|\.)([a-z][a-z0-9-]+)\s*\{([\s\S]*?)\}/gim,themeLabel:/--theme-label\s*:\s*['"]([^'"]+)['"]/,themeIcon:/--theme-icon\s*:\s*['"]([^'"]+)['"]/,themeIsDark:/--theme-is-dark\s*:\s*(0|1)/}},Se={Inter:"inter-latin","Space Grotesk":"space-grotesk-latin","Playfair Display":"playfair-display-latin","Press Start 2P":"press-start-2p-latin",Roboto:"roboto-latin"},He=[{name:"light",displayName:"Light",icon:"Sun",isDark:!1}],rt={base:{absolute:!0,onlyFiles:!0,ignore:Q.globalIgnore},css:{absolute:!0,onlyFiles:!0,ignore:[...Q.globalIgnore,"**/*.test.css"]},routes:{absolute:!0,onlyFiles:!0,ignore:[...Q.globalIgnore,"**/*.test.tsx","**/*.stories.tsx"]},i18n:{absolute:!0,onlyFiles:!0,ignore:Q.globalIgnore},assets:{absolute:!0,onlyFiles:!0,ignore:Q.globalIgnore}}});import*as E from"node:fs";import"node:fs";import{createRequire as is}from"node:module";import{resolve as Oe,join as ue,dirname as he,relative as at,normalize as ls,sep as it,extname as cs}from"node:path";import"node:url";import us from"fast-glob";function lt(n,e){return n().catch(t=>{throw new Error(`${e}: ${t instanceof Error?t.message:String(t)}`)})}var ve,U,ct,_,B=Le(()=>{"use strict";L();ve={getGlobOptionsFor:Ne||void 0,SCAN_PATTERNS:Q||void 0,getPatternsFor:nt||void 0,I18N_PATHS:Ae||void 0},U={error:(n,e)=>{},warn:(n,e)=>{},info:n=>{}};ct={CLI:"packages/cli",COMPONENTS:"packages/core/components",CONFIG:"packages/core/config",CORE:"packages/core",CRUD:"packages/core/crud",FEATURES:"packages/features",HOOKS:"packages/core/hooks",I18N:"packages/core/i18n",SCHEMAS:"packages/core/schemas",STORES:"packages/core/stores",TEMPLATES:"packages/templates",TOOLING:"packages/tooling",TYPES:"packages/core/types",UI:"packages/ui",UTILS:"packages/core/utils",AUTH:"packages/features/auth",BILLING:"packages/features/billing",OAUTH:"packages/features/oauth",FIREBASE:"packages/providers/firebase",FUNCTIONS:"packages/functions"},_=class n{static _instance=null;options;_repoRoot;_appRoot=null;static getInstance(e={}){return n._instance||(n._instance=new n(e)),n._instance}static _reset(){n._instance=null}constructor(e={}){if(n._instance)return n._instance;this.options={maxLevels:e.maxLevels??10,customMarkers:e.customMarkers||[],cache:e.cache??!1,debug:e.debug??!1};try{let t=process.cwd();if(!t)throw new Error("PathResolver: process.cwd() returned undefined. This should never happen.");this._repoRoot=this._findRepoRoot(t)}catch(t){throw new Error(`PathResolver constructor failed: ${t instanceof Error?t.message:String(t)}. cwd: ${process.cwd()}`)}this._appRoot=null,n._instance=this}normalizePath(e){if(!e)return"";try{return ls(e).split(it).join("/")}catch{return String(e).split(it).join("/")}}getRelativePath(e){let t=this.getAppRoot(),s=at(t,e);return this.normalizePath(s)}getBasename(e){if(!e)return"";let s=this.normalizePath(e).split("/");return s[s.length-1]||""}getDirname(e){return e?this.normalizePath(he(e)):""}resolvePackage(e,t=null){try{let s=t||this.getAppRoot(),o=is(ue(s,"package.json")).resolve(e);return this.normalizePath(o)}catch{return null}}resolveFrameworkPackage(e,t=null){let s=this.resolvePackage(`${e}/package.json`,t);if(s)return this.getDirname(s);if(this.isMonorepo()&&e.startsWith("@donotdev/")){let a=e.replace("@donotdev/",""),i=this.resolveRepoPath(`packages/${a}`);if(this.pathExists(i))return i;if(["auth","billing","crud","oauth"].includes(a)){let l=this.resolveRepoPath(`packages/features/${a}`);if(this.pathExists(l))return l}if(a==="firebase"){let l=this.resolveRepoPath(`packages/providers/${a}`);if(this.pathExists(l))return l}}let r=this.resolveAppPath(`node_modules/${e}`);if(this.pathExists(r))return r;let o=this.resolveRepoPath(`node_modules/${e}`);return this.pathExists(o)?o:null}resolvePackageAsset(e,t=null){return this.resolvePackage(e,t)}resolveAppPath(e){let t=this.getAppRoot(),s=Oe(t,e);return this.normalizePath(s)}resolveRepoPath(e){let t=this.getRepoRoot(),s=this.normalizePath(e),r=Oe(t,s);return this.normalizePath(r)}resolvePath(e,t){let s=this.normalizePath(t),r=this.normalizePath(e),o=Oe(s,r);return this.normalizePath(o)}createImportPath(e){return"./"+this.getRelativePath(e)}getFileInfo(e){try{let t=E.statSync(e);return{absolutePath:this.normalizePath(e),relativePath:this.getRelativePath(e),importPath:this.createImportPath(e),size:t.size,isFile:t.isFile(),isDirectory:t.isDirectory()}}catch{return null}}_detectFormat(e,t){return t&&t!=="auto"?t:cs(e).toLowerCase()===".json"?"json":"text"}async read(e,t={}){let{format:s="auto",encoding:r="utf8"}=t,o=this._detectFormat(e,s);try{if(o==="buffer")return await E.promises.readFile(e);let a=await E.promises.readFile(e,r),i=this.stripBom(a);return o==="json"?JSON.parse(i):i}catch(a){return this.options.debug&&U.warn(`Failed to read file: ${e}`,a),null}}readSync(e,t={}){let{format:s="auto",encoding:r="utf8"}=t,o=this._detectFormat(e,s);try{if(o==="buffer")return E.readFileSync(e);let a=E.readFileSync(e,r),i=this.stripBom(a);return o==="json"?JSON.parse(i):i}catch(a){return this.options.debug&&U.warn(`Failed to read file: ${e}`,a),null}}async write(e,t,s={}){let{format:r="auto",overwrite:o=!1,dryRun:a=!1,verbose:i=!1}=s,l=this.normalizePath(e),u=this.normalizePath(he(l)),c=this.pathExists(l);if(c&&!o)return i&&U.info(`Skipping existing file: ${l}`),!1;if(a)return U.info(`[DRY RUN] Would write file: ${l}`),!0;try{await E.promises.mkdir(u,{recursive:!0})}catch(d){if(d?.code!=="EEXIST")throw d}let p=this._detectFormat(e,r),g;Buffer.isBuffer(t)?g=t:p==="json"&&typeof t=="object"?g=JSON.stringify(t,null,2):g=String(t);try{return await lt(async()=>(Buffer.isBuffer(g)?await E.promises.writeFile(l,g):await E.promises.writeFile(l,g,"utf8"),i&&U.info(`${c?"Updated":"Created"} file: ${l}`),!0),`Failed to write file: ${l}`)}catch{return!1}}writeSync(e,t,s={}){let{format:r="auto",overwrite:o=!1,dryRun:a=!1,verbose:i=!1}=s,l=this.normalizePath(e),u=this.normalizePath(he(l)),c=this.pathExists(l);if(c&&!o)return i&&U.info(`Skipping existing file: ${l}`),!1;if(a)return U.info(`[DRY RUN] Would write file: ${l}`),!0;try{E.mkdirSync(u,{recursive:!0})}catch(d){if(d?.code!=="EEXIST")throw d}let p=this._detectFormat(e,r),g;Buffer.isBuffer(t)?g=t:p==="json"&&typeof t=="object"?g=JSON.stringify(t,null,2):g=String(t);try{return Buffer.isBuffer(g)?E.writeFileSync(l,g):E.writeFileSync(l,g,"utf8"),i&&U.info(`${c?"Updated":"Created"} file: ${l}`),!0}catch(d){throw new Error(`Failed to write file: ${l}: ${d instanceof Error?d.message:String(d)}`)}}async copy(e,t,s={}){let{overwrite:r=!1,dryRun:o=!1,verbose:a=!1}=s,i=this.normalizePath(t),l=this.pathExists(i);if(l&&!r)return a&&U.info(`Skipping existing file: ${i}`),!1;if(o)return U.info(`[DRY RUN] Would copy file: ${i}`),!0;let u=this.normalizePath(he(i));try{await E.promises.mkdir(u,{recursive:!0})}catch(c){if(c?.code!=="EEXIST")throw c}try{return await lt(async()=>(await E.promises.copyFile(e,i),a&&U.info(`${l?"Updated":"Created"} file: ${i}`),!0),`Failed to copy file from ${e} to ${i}`)}catch{return!1}}copySync(e,t,s={}){let{overwrite:r=!1,dryRun:o=!1,verbose:a=!1}=s,i=this.normalizePath(t),l=this.pathExists(i);if(l&&!r)return a&&U.info(`Skipping existing file: ${i}`),!1;if(o)return U.info(`[DRY RUN] Would copy file: ${i}`),!0;let u=this.normalizePath(he(i));try{E.mkdirSync(u,{recursive:!0})}catch(c){if(c?.code!=="EEXIST")throw c}try{return E.copyFileSync(e,i),a&&U.info(`${l?"Updated":"Created"} file: ${i}`),!0}catch{return!1}}pathExists(e,t=!1){try{return E.existsSync(e)}catch(s){return t||U.error(`Error checking path existence: ${e}`,s),!1}}mkdir(e){try{let t=e.startsWith("/")||e.match(/^[A-Z]:/)?this.normalizePath(e):this.resolveAppPath(e);return E.existsSync(t)||E.mkdirSync(t,{recursive:!0}),!0}catch{return!1}}readdirSync(e,t){try{return E.readdirSync(e,t)}catch(s){return this.options.debug&&U.warn(`Failed to read directory: ${e}`,s),t&&typeof t=="object"&&"withFileTypes"in t&&t.withFileTypes?[]:[]}}statSync(e){try{return E.statSync(e)}catch(t){return this.options.debug&&U.warn(`Failed to stat file: ${e}`,t),null}}realpathSync(e){return E.realpathSync(e)}watch(e,t,s){return E.watch(e,t,s)}lstatSync(e){try{return E.lstatSync(e)}catch(t){return this.options.debug&&U.warn(`Failed to lstat file: ${e}`,t),null}}async ensureDir(e){try{await E.promises.mkdir(e,{recursive:!0})}catch(t){if(t?.code!=="EEXIST")throw t}}ensureDirSync(e){try{E.mkdirSync(e,{recursive:!0})}catch(t){if(t?.code!=="EEXIST")throw t}}async remove(e){await E.promises.rm(e,{recursive:!0,force:!0})}removeSync(e){E.rmSync(e,{recursive:!0,force:!0})}async readdir(e,t){return E.promises.readdir(e,t)}stripBom(e){return e.charCodeAt(0)===65279?e.slice(1):e}getRepoRoot(){return this._repoRoot||process.cwd()}getAppRoot(){return this._appRoot?this._appRoot:this._repoRoot}setAppRoot(e){if(!e)throw new Error("PathResolver.setAppRoot: root cannot be undefined or null");this._appRoot=this.normalizePath(e)}isMonorepo(){let e=ue(this._repoRoot,"packages");return this.pathExists(e)}isWithinApp(e){let t=this.normalizePath(Oe(e)),s=this.getAppRoot(),r=at(s,t),o=this.normalizePath(r);return!o.startsWith("../")&&!o.startsWith("/")}async findFiles(e,t,s={}){let r=this.normalizePath(ue(e,t)),o=this.getAppRoot(),a=this.normalizePath(o),i=r.startsWith(a)?r.slice(a.length+1):r,l={absolute:!0,onlyFiles:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:o,ignore:ve.SCAN_PATTERNS?.globalIgnore||["**/node_modules/**","**/dist/**","**/build/**","**/.git/**"]};return await this._globWithNormalization([i],{...l,...s})}clearCache(){}async _resolveFrameworkI18nPattern(e){let t=ve.I18N_PATHS;if(!t)return null;let s=e.replace(t.SOURCE_ROOT+"/",""),r=this.resolveFrameworkPackage("@donotdev/core");if(!r)return null;let o=this.normalizePath(ue(r,t.PUBLISHED_ROOT,s)),a=o.replace(/\/[^/]*\*.*$/,"");return this.pathExists(a),o}async _globWithNormalization(e,t){return(await us(e,t)).map(r=>{let o=typeof r=="string"?r:r.path;return this.normalizePath(o)})}async resolveFiles(e,t="css"){if(!e||typeof e!="object")return{frameworkFiles:[],consumerFiles:[]};if(t==="i18n")return{frameworkFiles:[],consumerFiles:[]};if(Array.isArray(e.framework)||(e.framework=[]),!Array.isArray(e.consumer))return{frameworkFiles:[],consumerFiles:[]};let s=[...e.framework,...e.consumer];for(let c of s)if(typeof c!="string"||c.trim()==="")return{frameworkFiles:[],consumerFiles:[]};let r=this.getAppRoot(),o=ve.getGlobOptionsFor?ve.getGlobOptionsFor(t):{ignore:["**/node_modules/**","**/dist/**","**/build/**"]},a=this.normalizePath(r),i=e.framework.map(c=>{let p=this.normalizePath(c);return p.startsWith(a)?p.slice(a.length+1):p}),l=e.consumer.map(c=>{let p=this.normalizePath(c);return p.startsWith(a)?p.slice(a.length+1):p}),u={...o,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:r};try{let c=i.length>0?await this._globWithNormalization(i,u):[],p=await this._globWithNormalization(l,u);return{frameworkFiles:c,consumerFiles:p}}catch{return this.options.debug,{frameworkFiles:[],consumerFiles:[]}}}async resolvePatterns(e){if(!ve.getPatternsFor)return{framework:[],consumer:[],all:[]};let t=this.getAppRoot(),s=this.getRepoRoot();if(e==="i18n"&&(!t||t===s))throw new Error(`Cannot resolve i18n patterns: appRoot not set (appRoot: ${t}, repoRoot: ${s}). Ensure configResolved hook has run before discovery.`);let r=ve.getPatternsFor(e),o=this.isMonorepo();if(e==="i18n"){let l=r,u={eager:l.eager.map(c=>c.startsWith("!")?"!"+this.resolveAppPath(c.slice(1)):this.resolveAppPath(c)),lazy:l.lazy.map(c=>c.startsWith("!")?"!"+this.resolveAppPath(c.slice(1)):this.resolveAppPath(c)),framework:{eager:o?(l.framework?.eager||[]).map(c=>this.resolveRepoPath(c)).filter(Boolean):await Promise.all((l.framework?.eager||[]).map(c=>this._resolveFrameworkI18nPattern(c))).then(c=>c.filter(Boolean)),lazy:o?(l.framework?.lazy||[]).map(c=>this.resolveRepoPath(c)).filter(Boolean):await Promise.all((l.framework?.lazy||[]).map(c=>this._resolveFrameworkI18nPattern(c))).then(c=>c.filter(Boolean))},all:[]};return u.all=[...u.eager,...u.lazy,...u.framework.eager,...u.framework.lazy],u}let a=r,i={framework:o?(a.framework||[]).map(l=>this.resolveRepoPath(l)).filter(Boolean):[],consumer:(a.consumer||[]).map(l=>this.resolveAppPath(l)),all:[]};return i.all=[...i.consumer,...i.framework],i}getEmptyModulePath(){return this.getEmptyCjsModulePath().replace(/\.cjs$/,".js")}getEmptyCjsModulePath(){let e=this.resolvePackage("@donotdev/core/empty");if(!e)throw new Error("Cannot resolve @donotdev/core/empty \u2014 package setup is broken");return e}_findRepoRoot(e){let t=this.normalizePath(e),s=0,r=this.options.maxLevels;for(;s<r;){let o=this.normalizePath(ue(t,ct.TOOLING)),a=this.normalizePath(ue(t,ct.CORE));if(this.pathExists(o)&&this.pathExists(a))return t;let i=ue(t,"apps");if(this.pathExists(i)&&this.statSync(i)?.isDirectory())return this.normalizePath(t);let l=this.normalizePath(ue(t,"package.json"));if(this.pathExists(l)&&this.normalizePath(he(t))===t)return t;let u=this.normalizePath(he(t));if(u===t)break;t=u,s++}return this.normalizePath(e)}}});var Yt={};es(Yt,{createDndevPlugin:()=>cr});import{execSync as Me,spawn as Hs}from"node:child_process";function q(){return _.getInstance()}function Bt(){return q().getRepoRoot()}function Vt(){return q().resolveRepoPath(".dndev")}function w(n,e,t=200){n.writeHead(t,{"Content-Type":"application/json"}),n.end(JSON.stringify(e))}function _e(n,e=Js){return new Promise((t,s)=>{let r="",o=0;n.on("data",a=>{if(o+=a.length,o>e){n.destroy(),s(new Error("Request body too large"));return}r+=a.toString()}),n.on("end",()=>t(r)),n.on("error",s)})}function qs(n){let e=n.lastIndexOf(".");return e===-1?"":n.slice(e).toLowerCase()}function Ys(){let n=q(),e=[],t=process.env.HOME||process.env.USERPROFILE||"";try{let r=process.platform==="win32"?"where node":"which node",o=Me(r,{encoding:"utf8"}).trim().split(`
1
+ var Qt=Object.defineProperty;var Le=(n,e)=>()=>(n&&(e=n(n=0)),e);var es=(n,e)=>{for(var t in e)Qt(n,t,{get:e[t],enumerable:!0})};function nt(n,e=null){let t=ee[n];if(!t)throw new Error(`Unknown pattern type: ${n}`);return e&&t.framework?{...t,framework:t.framework.map(s=>`${e}/${s}`)}:t}function Ne(n){return rt[n]||rt.base}var We,M,V,j,Ge,xe,Ae,ee,me,ot,Be,Ve,Se,He,rt,L=Le(()=>{"use strict";We={HOMEPAGE_FILE:"HomePage.tsx",HOMEPAGE_PATH:"/",HOMEPAGE_COMPONENT:"HomePage"},M={routes:"virtual:routes",themes:"virtual:themes",i18n:"virtual:i18n-mapping",assets:"virtual:assets",env:"virtual:env"},V={routes:"routes",themes:"themes",i18n:"i18n",assets:"assets",env:"env"},j={next:{middleware:"middleware.ts",routeManifest:"public/route-manifest.json",assetManifest:"public/asset-manifest.json",utilities:"src/styles/utilities.generated.css",appPages:"src/app",appLayout:"src/app/layout.tsx",configRoute:"src/config/dndev-config-route.js",configTheme:"src/config/dndev-config-theme.js",configI18n:"src/config/dndev-config-i18n.js",configPwa:"src/config/dndev-config-pwa.js",configAsset:"src/config/dndev-config-asset.js",configSeo:"src/config/dndev-config-seo.js",configEnv:"src/config/dndev-config-env.js",configServer:"src/config/dndev-config-server.js"},vite:{routeInspection:"src/routes.generated.log",themeInspection:"src/themes.generated.log",i18nInspection:"src/i18n.generated.log",assetInspection:"src/assets.generated.log",envInspection:"src/env.generated.log"},manifests:{route:"route-manifest.json",theme:"theme-manifest.json",i18n:"i18n-manifest.json",asset:"asset-manifest.json",feature:"feature-manifest.json",env:"env-manifest.json"}},Ge={package:"@donotdev/ui",assetsPath:"packages/ui/assets",browserTargets:["> 1%","last 2 versions","Firefox ESR","not dead","not op_mini all"]},xe={public:"public",fonts:"fonts",nodeModules:"node_modules",packages:"packages",core:"core",ui:"ui"},Ae={SOURCE_ROOT:"packages/core/i18n",SOURCE_LOCALES:"packages/core/i18n/locales",SOURCE_EAGER:"packages/core/i18n/locales/eager",SOURCE_LAZY:"packages/core/i18n/locales/lazy",PUBLISHED_ROOT:"i18n",PUBLISHED_LOCALES:"i18n/locales",PUBLISHED_EAGER:"i18n/locales/eager",PUBLISHED_LAZY:"i18n/locales/lazy"},ee={routes:{consumer:["src/**/*Page.tsx","src/pages/**/*Page.tsx"],exclude:["**/node_modules/**","**/dist/**","**/build/**","**/*.test.tsx","**/*.stories.tsx"],extensions:[".tsx"]},css:{consumer:["src/**/*.css"],themes:["src/**/*.css"],extensions:[".css",".scss",".sass"],framework:["packages/ui/src/**/*.css","packages/core/components/src/**/*.css","packages/core/templates/src/**/*.css"]},i18n:{eager:["src/locales/*_*.json"],lazy:["src/**/locales/*_*.json","!src/locales/*_*.json","../../entities/locales/*_*.json"],additional:[],framework:{eager:[`${Ae.SOURCE_EAGER}/*_*.json`],lazy:[`${Ae.SOURCE_LAZY}/*_*.json`]},extensions:[".json"]},assets:{consumer:["public/**/*"],fallback:["manifest.json"],modern:["logo.svg","favicon.svg","apple-touch-icon.png","android-chrome-192x192.png","android-chrome-512x512.png"],patterns:["favicon.svg","favicon.ico","favicon-*.png","logo.svg","logo.png","logo.webp","logo.avif","apple-touch-icon*.png","android-chrome-*.png","manifest.json"],fonts:["fonts/**/*.woff2","fonts/**/*.woff","fonts/**/*.ttf"],framework:["packages/ui/assets/**/*"]},pwa:{consumer:["public/manifest.json","public/service-worker.js","public/sw.js","public/icon-192x192.png","public/icon-512x512.png","public/favicon.ico","public/favicon.svg","public/apple-touch-icon.png","public/logo.svg"],exclude:["**/node_modules/**","**/dist/**","**/build/**"],extensions:[".json",".js",".png",".svg",".ico"],framework:["packages/ui/assets/**/*"]},globalIgnore:["**/node_modules/**","**/dist/**","**/build/**","**/.git/**","**/coverage/**","**/test/**"]},me={mandatoryIncludes:["react","react-dom","react-router-dom","zustand","lucide-react","valibot","i18next","i18next-browser-languagedetector","i18next-http-backend","react-i18next","@tanstack/react-query","react-helmet-async"],optionalFeatures:[],coreBundled:["@donotdev/types","@donotdev/utils","@donotdev/stores","@donotdev/schemas","@donotdev/hooks","@donotdev/i18n","@donotdev/config"],componentsBundled:["class-variance-authority","clsx","lucide-react","react-day-picker"],radixUIPattern:"@radix-ui/",buildTools:["esbuild","@esbuild/win32-x64","@esbuild/darwin-x64","@esbuild/linux-x64","@esbuild/darwin-arm64","@esbuild/linux-arm64","vite","rollup","rollup-plugin-visualizer","@vitejs/plugin-react","vite-tsconfig-paths","vite-plugin-pwa","vite-plugin-compression2","vite-plugin-node-polyfills","fsevents","postcss","postcss-import","postcss-nesting","autoprefixer"],buildTimePackages:[],largeOptional:["@sentry/react","framer-motion","stripe","@tanstack/react-query","shiki","@tiptap/react","@tiptap/starter-kit","@tiptap/extension-placeholder","sharp","semver","file-type"]},ot=["firebase-admin","gcp-metadata","google-logging-utils","payload","undici","@fastify/busboy","image-size","@donotdev/tooling","fs","path","crypto","net","tls","http","https","child_process","os","util","stream","buffer","events","querystring","url","zlib","assert","constants","domain","punycode","string_decoder","timers","tty","vm","worker_threads","cluster","dgram","dns","http2","inspector","module","perf_hooks","process","readline","repl","trace_events","v8","wasi"],Be=["@donotdev/core/functions","@donotdev/core/server"],Ve={selectors:{class:/\.([a-zA-Z0-9-]+)/g,variable:/--[a-zA-Z0-9-]+/g,keyframe:/@keyframes\s+([a-zA-Z0-9-]+)/g},themes:{themeClass:/(?::root\.|\.)([a-z][a-z0-9-]+)\s*\{([\s\S]*?)\}/gim,themeLabel:/--theme-label\s*:\s*['"]([^'"]+)['"]/,themeIcon:/--theme-icon\s*:\s*['"]([^'"]+)['"]/,themeIsDark:/--theme-is-dark\s*:\s*(0|1)/}},Se={Inter:"inter-latin","Space Grotesk":"space-grotesk-latin","Playfair Display":"playfair-display-latin","Press Start 2P":"press-start-2p-latin",Roboto:"roboto-latin"},He=[{name:"light",displayName:"Light",icon:"Sun",isDark:!1}],rt={base:{absolute:!0,onlyFiles:!0,ignore:ee.globalIgnore},css:{absolute:!0,onlyFiles:!0,ignore:[...ee.globalIgnore,"**/*.test.css"]},routes:{absolute:!0,onlyFiles:!0,ignore:[...ee.globalIgnore,"**/*.test.tsx","**/*.stories.tsx"]},i18n:{absolute:!0,onlyFiles:!0,ignore:ee.globalIgnore},assets:{absolute:!0,onlyFiles:!0,ignore:ee.globalIgnore}}});import*as E from"node:fs";import"node:fs";import{createRequire as is}from"node:module";import{resolve as Oe,join as pe,dirname as he,relative as at,normalize as ls,sep as it,extname as cs}from"node:path";import"node:url";import us from"fast-glob";function lt(n,e){return n().catch(t=>{throw new Error(`${e}: ${t instanceof Error?t.message:String(t)}`)})}var ve,U,ct,_,B=Le(()=>{"use strict";L();ve={getGlobOptionsFor:Ne||void 0,SCAN_PATTERNS:ee||void 0,getPatternsFor:nt||void 0,I18N_PATHS:Ae||void 0},U={error:(n,e)=>{},warn:(n,e)=>{},info:n=>{}};ct={CLI:"packages/cli",COMPONENTS:"packages/core/components",CONFIG:"packages/core/config",CORE:"packages/core",CRUD:"packages/core/crud",FEATURES:"packages/features",HOOKS:"packages/core/hooks",I18N:"packages/core/i18n",SCHEMAS:"packages/core/schemas",STORES:"packages/core/stores",TEMPLATES:"packages/templates",TOOLING:"packages/tooling",TYPES:"packages/core/types",UI:"packages/ui",UTILS:"packages/core/utils",AUTH:"packages/features/auth",BILLING:"packages/features/billing",OAUTH:"packages/features/oauth",FIREBASE:"packages/providers/firebase",FUNCTIONS:"packages/functions"},_=class n{static _instance=null;options;_repoRoot;_appRoot=null;static getInstance(e={}){return n._instance||(n._instance=new n(e)),n._instance}static _reset(){n._instance=null}constructor(e={}){if(n._instance)return n._instance;this.options={maxLevels:e.maxLevels??10,customMarkers:e.customMarkers||[],cache:e.cache??!1,debug:e.debug??!1};try{let t=process.cwd();if(!t)throw new Error("PathResolver: process.cwd() returned undefined. This should never happen.");this._repoRoot=this._findRepoRoot(t)}catch(t){throw new Error(`PathResolver constructor failed: ${t instanceof Error?t.message:String(t)}. cwd: ${process.cwd()}`)}this._appRoot=null,n._instance=this}normalizePath(e){if(!e)return"";try{return ls(e).split(it).join("/")}catch{return String(e).split(it).join("/")}}getRelativePath(e){let t=this.getAppRoot(),s=at(t,e);return this.normalizePath(s)}getBasename(e){if(!e)return"";let s=this.normalizePath(e).split("/");return s[s.length-1]||""}getDirname(e){return e?this.normalizePath(he(e)):""}resolvePackage(e,t=null){try{let s=t||this.getAppRoot(),o=is(pe(s,"package.json")).resolve(e);return this.normalizePath(o)}catch{return null}}resolveFrameworkPackage(e,t=null){let s=this.resolvePackage(`${e}/package.json`,t);if(s)return this.getDirname(s);if(this.isMonorepo()&&e.startsWith("@donotdev/")){let a=e.replace("@donotdev/",""),i=this.resolveRepoPath(`packages/${a}`);if(this.pathExists(i))return i;if(["auth","billing","crud","oauth"].includes(a)){let l=this.resolveRepoPath(`packages/features/${a}`);if(this.pathExists(l))return l}if(a==="firebase"){let l=this.resolveRepoPath(`packages/providers/${a}`);if(this.pathExists(l))return l}}let r=this.resolveAppPath(`node_modules/${e}`);if(this.pathExists(r))return r;let o=this.resolveRepoPath(`node_modules/${e}`);return this.pathExists(o)?o:null}resolvePackageAsset(e,t=null){return this.resolvePackage(e,t)}resolveAppPath(e){let t=this.getAppRoot(),s=Oe(t,e);return this.normalizePath(s)}resolveRepoPath(e){let t=this.getRepoRoot(),s=this.normalizePath(e),r=Oe(t,s);return this.normalizePath(r)}resolvePath(e,t){let s=this.normalizePath(t),r=this.normalizePath(e),o=Oe(s,r);return this.normalizePath(o)}createImportPath(e){return"./"+this.getRelativePath(e)}getFileInfo(e){try{let t=E.statSync(e);return{absolutePath:this.normalizePath(e),relativePath:this.getRelativePath(e),importPath:this.createImportPath(e),size:t.size,isFile:t.isFile(),isDirectory:t.isDirectory()}}catch{return null}}_detectFormat(e,t){return t&&t!=="auto"?t:cs(e).toLowerCase()===".json"?"json":"text"}async read(e,t={}){let{format:s="auto",encoding:r="utf8"}=t,o=this._detectFormat(e,s);try{if(o==="buffer")return await E.promises.readFile(e);let a=await E.promises.readFile(e,r),i=this.stripBom(a);return o==="json"?JSON.parse(i):i}catch(a){return this.options.debug&&U.warn(`Failed to read file: ${e}`,a),null}}readSync(e,t={}){let{format:s="auto",encoding:r="utf8"}=t,o=this._detectFormat(e,s);try{if(o==="buffer")return E.readFileSync(e);let a=E.readFileSync(e,r),i=this.stripBom(a);return o==="json"?JSON.parse(i):i}catch(a){return this.options.debug&&U.warn(`Failed to read file: ${e}`,a),null}}async write(e,t,s={}){let{format:r="auto",overwrite:o=!1,dryRun:a=!1,verbose:i=!1}=s,l=this.normalizePath(e),u=this.normalizePath(he(l)),c=this.pathExists(l);if(c&&!o)return i&&U.info(`Skipping existing file: ${l}`),!1;if(a)return U.info(`[DRY RUN] Would write file: ${l}`),!0;try{await E.promises.mkdir(u,{recursive:!0})}catch(d){if(d?.code!=="EEXIST")throw d}let p=this._detectFormat(e,r),g;Buffer.isBuffer(t)?g=t:p==="json"&&typeof t=="object"?g=JSON.stringify(t,null,2):g=String(t);try{return await lt(async()=>(Buffer.isBuffer(g)?await E.promises.writeFile(l,g):await E.promises.writeFile(l,g,"utf8"),i&&U.info(`${c?"Updated":"Created"} file: ${l}`),!0),`Failed to write file: ${l}`)}catch{return!1}}writeSync(e,t,s={}){let{format:r="auto",overwrite:o=!1,dryRun:a=!1,verbose:i=!1}=s,l=this.normalizePath(e),u=this.normalizePath(he(l)),c=this.pathExists(l);if(c&&!o)return i&&U.info(`Skipping existing file: ${l}`),!1;if(a)return U.info(`[DRY RUN] Would write file: ${l}`),!0;try{E.mkdirSync(u,{recursive:!0})}catch(d){if(d?.code!=="EEXIST")throw d}let p=this._detectFormat(e,r),g;Buffer.isBuffer(t)?g=t:p==="json"&&typeof t=="object"?g=JSON.stringify(t,null,2):g=String(t);try{return Buffer.isBuffer(g)?E.writeFileSync(l,g):E.writeFileSync(l,g,"utf8"),i&&U.info(`${c?"Updated":"Created"} file: ${l}`),!0}catch(d){throw new Error(`Failed to write file: ${l}: ${d instanceof Error?d.message:String(d)}`)}}async copy(e,t,s={}){let{overwrite:r=!1,dryRun:o=!1,verbose:a=!1}=s,i=this.normalizePath(t),l=this.pathExists(i);if(l&&!r)return a&&U.info(`Skipping existing file: ${i}`),!1;if(o)return U.info(`[DRY RUN] Would copy file: ${i}`),!0;let u=this.normalizePath(he(i));try{await E.promises.mkdir(u,{recursive:!0})}catch(c){if(c?.code!=="EEXIST")throw c}try{return await lt(async()=>(await E.promises.copyFile(e,i),a&&U.info(`${l?"Updated":"Created"} file: ${i}`),!0),`Failed to copy file from ${e} to ${i}`)}catch{return!1}}copySync(e,t,s={}){let{overwrite:r=!1,dryRun:o=!1,verbose:a=!1}=s,i=this.normalizePath(t),l=this.pathExists(i);if(l&&!r)return a&&U.info(`Skipping existing file: ${i}`),!1;if(o)return U.info(`[DRY RUN] Would copy file: ${i}`),!0;let u=this.normalizePath(he(i));try{E.mkdirSync(u,{recursive:!0})}catch(c){if(c?.code!=="EEXIST")throw c}try{return E.copyFileSync(e,i),a&&U.info(`${l?"Updated":"Created"} file: ${i}`),!0}catch{return!1}}pathExists(e,t=!1){try{return E.existsSync(e)}catch(s){return t||U.error(`Error checking path existence: ${e}`,s),!1}}mkdir(e){try{let t=e.startsWith("/")||e.match(/^[A-Z]:/)?this.normalizePath(e):this.resolveAppPath(e);return E.existsSync(t)||E.mkdirSync(t,{recursive:!0}),!0}catch{return!1}}readdirSync(e,t){try{return E.readdirSync(e,t)}catch(s){return this.options.debug&&U.warn(`Failed to read directory: ${e}`,s),t&&typeof t=="object"&&"withFileTypes"in t&&t.withFileTypes?[]:[]}}statSync(e){try{return E.statSync(e)}catch(t){return this.options.debug&&U.warn(`Failed to stat file: ${e}`,t),null}}realpathSync(e){return E.realpathSync(e)}watch(e,t,s){return E.watch(e,t,s)}lstatSync(e){try{return E.lstatSync(e)}catch(t){return this.options.debug&&U.warn(`Failed to lstat file: ${e}`,t),null}}async ensureDir(e){try{await E.promises.mkdir(e,{recursive:!0})}catch(t){if(t?.code!=="EEXIST")throw t}}ensureDirSync(e){try{E.mkdirSync(e,{recursive:!0})}catch(t){if(t?.code!=="EEXIST")throw t}}async remove(e){await E.promises.rm(e,{recursive:!0,force:!0})}removeSync(e){E.rmSync(e,{recursive:!0,force:!0})}async readdir(e,t){return E.promises.readdir(e,t)}stripBom(e){return e.charCodeAt(0)===65279?e.slice(1):e}getRepoRoot(){return this._repoRoot||process.cwd()}getAppRoot(){return this._appRoot?this._appRoot:this._repoRoot}setAppRoot(e){if(!e)throw new Error("PathResolver.setAppRoot: root cannot be undefined or null");this._appRoot=this.normalizePath(e)}isMonorepo(){let e=pe(this._repoRoot,"packages");return this.pathExists(e)}isWithinApp(e){let t=this.normalizePath(Oe(e)),s=this.getAppRoot(),r=at(s,t),o=this.normalizePath(r);return!o.startsWith("../")&&!o.startsWith("/")}async findFiles(e,t,s={}){let r=this.normalizePath(pe(e,t)),o=this.getAppRoot(),a=this.normalizePath(o),i=r.startsWith(a)?r.slice(a.length+1):r,l={absolute:!0,onlyFiles:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:o,ignore:ve.SCAN_PATTERNS?.globalIgnore||["**/node_modules/**","**/dist/**","**/build/**","**/.git/**"]};return await this._globWithNormalization([i],{...l,...s})}clearCache(){}async _resolveFrameworkI18nPattern(e){let t=ve.I18N_PATHS;if(!t)return null;let s=e.replace(t.SOURCE_ROOT+"/",""),r=this.resolveFrameworkPackage("@donotdev/core");if(!r)return null;let o=this.normalizePath(pe(r,t.PUBLISHED_ROOT,s)),a=o.replace(/\/[^/]*\*.*$/,"");return this.pathExists(a),o}async _globWithNormalization(e,t){return(await us(e,t)).map(r=>{let o=typeof r=="string"?r:r.path;return this.normalizePath(o)})}async resolveFiles(e,t="css"){if(!e||typeof e!="object")return{frameworkFiles:[],consumerFiles:[]};if(t==="i18n")return{frameworkFiles:[],consumerFiles:[]};if(Array.isArray(e.framework)||(e.framework=[]),!Array.isArray(e.consumer))return{frameworkFiles:[],consumerFiles:[]};let s=[...e.framework,...e.consumer];for(let c of s)if(typeof c!="string"||c.trim()==="")return{frameworkFiles:[],consumerFiles:[]};let r=this.getAppRoot(),o=ve.getGlobOptionsFor?ve.getGlobOptionsFor(t):{ignore:["**/node_modules/**","**/dist/**","**/build/**"]},a=this.normalizePath(r),i=e.framework.map(c=>{let p=this.normalizePath(c);return p.startsWith(a)?p.slice(a.length+1):p}),l=e.consumer.map(c=>{let p=this.normalizePath(c);return p.startsWith(a)?p.slice(a.length+1):p}),u={...o,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:r};try{let c=i.length>0?await this._globWithNormalization(i,u):[],p=await this._globWithNormalization(l,u);return{frameworkFiles:c,consumerFiles:p}}catch{return this.options.debug,{frameworkFiles:[],consumerFiles:[]}}}async resolvePatterns(e){if(!ve.getPatternsFor)return{framework:[],consumer:[],all:[]};let t=this.getAppRoot(),s=this.getRepoRoot();if(e==="i18n"&&(!t||t===s))throw new Error(`Cannot resolve i18n patterns: appRoot not set (appRoot: ${t}, repoRoot: ${s}). Ensure configResolved hook has run before discovery.`);let r=ve.getPatternsFor(e),o=this.isMonorepo();if(e==="i18n"){let l=r,u={eager:l.eager.map(c=>c.startsWith("!")?"!"+this.resolveAppPath(c.slice(1)):this.resolveAppPath(c)),lazy:l.lazy.map(c=>c.startsWith("!")?"!"+this.resolveAppPath(c.slice(1)):this.resolveAppPath(c)),framework:{eager:o?(l.framework?.eager||[]).map(c=>this.resolveRepoPath(c)).filter(Boolean):await Promise.all((l.framework?.eager||[]).map(c=>this._resolveFrameworkI18nPattern(c))).then(c=>c.filter(Boolean)),lazy:o?(l.framework?.lazy||[]).map(c=>this.resolveRepoPath(c)).filter(Boolean):await Promise.all((l.framework?.lazy||[]).map(c=>this._resolveFrameworkI18nPattern(c))).then(c=>c.filter(Boolean))},all:[]};return u.all=[...u.eager,...u.lazy,...u.framework.eager,...u.framework.lazy],u}let a=r,i={framework:o?(a.framework||[]).map(l=>this.resolveRepoPath(l)).filter(Boolean):[],consumer:(a.consumer||[]).map(l=>this.resolveAppPath(l)),all:[]};return i.all=[...i.consumer,...i.framework],i}getEmptyModulePath(){return this.getEmptyCjsModulePath().replace(/\.cjs$/,".js")}getEmptyCjsModulePath(){let e=this.resolvePackage("@donotdev/core/empty");if(!e)throw new Error("Cannot resolve @donotdev/core/empty \u2014 package setup is broken");return e}_findRepoRoot(e){let t=this.normalizePath(e),s=0,r=this.options.maxLevels;for(;s<r;){let o=this.normalizePath(pe(t,ct.TOOLING)),a=this.normalizePath(pe(t,ct.CORE));if(this.pathExists(o)&&this.pathExists(a))return t;let i=pe(t,"apps");if(this.pathExists(i)&&this.statSync(i)?.isDirectory())return this.normalizePath(t);let l=this.normalizePath(pe(t,"package.json"));if(this.pathExists(l)&&this.normalizePath(he(t))===t)return t;let u=this.normalizePath(he(t));if(u===t)break;t=u,s++}return this.normalizePath(e)}}});var Yt={};es(Yt,{createDndevPlugin:()=>cr});import{execSync as Me,spawn as Hs}from"node:child_process";function q(){return _.getInstance()}function Bt(){return q().getRepoRoot()}function Vt(){return q().resolveRepoPath(".dndev")}function w(n,e,t=200){n.writeHead(t,{"Content-Type":"application/json"}),n.end(JSON.stringify(e))}function _e(n,e=Js){return new Promise((t,s)=>{let r="",o=0;n.on("data",a=>{if(o+=a.length,o>e){n.destroy(),s(new Error("Request body too large"));return}r+=a.toString()}),n.on("end",()=>t(r)),n.on("error",s)})}function qs(n){let e=n.lastIndexOf(".");return e===-1?"":n.slice(e).toLowerCase()}function Ys(){let n=q(),e=[],t=process.env.HOME||process.env.USERPROFILE||"";try{let r=process.platform==="win32"?"where node":"which node",o=Me(r,{encoding:"utf8"}).trim().split(`
2
2
  `)[0];e.push(o)}catch{}let s=[process.env.NVM_DIR,n.resolvePath(".nvm",t)].filter(Boolean);for(let r of s)try{let o=n.resolvePath("versions/node",r),a=n.readdirSync(o).filter(i=>i.startsWith("v")).sort().reverse();for(let i of a)e.push(n.resolvePath(`${i}/bin/node`,o))}catch{}if(process.env.NVM_BIN&&e.push(n.resolvePath("node",process.env.NVM_BIN)),process.platform==="win32"){e.push("C:\\Program Files\\nodejs\\node.exe");let r=process.env.APPDATA||"";if(r)try{let o=n.resolvePath("nvm",r),a=n.readdirSync(o).filter(i=>i.startsWith("v")).sort().reverse();for(let i of a)e.push(n.resolvePath(`${i}/node.exe`,o))}catch{}}else e.push("/usr/local/bin/node","/usr/bin/node");for(let r of e)try{let o=n.realpathSync(r);if(o.includes("bun")||!n.pathExists(o))continue;return r}catch{continue}return"node"}function Ht(n){if(!n||typeof n!="string"||n.includes("\0"))return!1;let e=n.split(/[/\\]/).filter(Boolean);for(let t of e)if(t==="."||t===".."||t==="node_modules"||t===".git"||t.startsWith(".")&&t!==".dndev")return!1;return!0}function Ks(n){return n.includes("..")?!1:n.startsWith(".dndev/")||n.startsWith("docs/")||n.startsWith("guides/")}function Jt(n){let e=q(),t=e.getRepoRoot(),s=e.resolvePath(n,t),r=e.normalizePath(t),o=e.normalizePath(s);return!o.startsWith(r+"/")&&o!==r?null:s}async function Xs(n,e){let s=new URL(n.url,`http://${n.headers.host}`).searchParams.get("path");if(!s)return w(e,{error:"path parameter required"},400);if(!Ht(s))return w(e,{error:"Access denied"},403);let r=Jt(s);if(!r)return w(e,{error:"Access denied"},403);let o=q();if(!o.pathExists(r))return w(e,{error:"File not found"},404);let a=qs(r);if(Zs.has(a)){let i=o.readSync(r,{format:"buffer"});return i?(e.writeHead(200,{"Content-Type":qt[a]||"application/octet-stream","Content-Length":i.byteLength}),void e.end(Buffer.from(i))):w(e,{error:"Failed to read file"},500)}if(a===".json")try{let i=await o.read(r);return i===null?w(e,{error:"Failed to read file"},500):w(e,{path:s,content:i})}catch{return w(e,{error:"Invalid JSON"},500)}try{let i=await o.read(r,{format:"text"});if(i===null)return w(e,{error:"Failed to read file"},500);w(e,{path:s,content:i})}catch{w(e,{error:"Failed to read file"},500)}}function Qs(n,e){let s=new URL(n.url,`http://${n.headers.host}`).searchParams.get("dir"),r=q(),o=r.getRepoRoot(),a=[],i=new Set(["node_modules",".git","dist","build",".next",".expo"]);function l(c,p){try{let g=r.readdirSync(c,{withFileTypes:!0});for(let d of g){let m=p?`${p}/${d.name}`:d.name;d.isDirectory()&&i.has(d.name)||(d.isDirectory()?(a.push({path:m,name:d.name,isDirectory:!0}),l(r.resolvePath(d.name,c),m)):d.name.endsWith(".md")&&a.push({path:m,name:d.name,isDirectory:!1}))}}catch{}}let u=[".dndev","docs","guides"];if(s){if(s.includes("..")||s.includes("\0"))return w(e,{error:"Access denied"},403);if(!u.includes(s)&&!u.some(d=>s.startsWith(d+"/")))return w(e,{error:"Directory not allowed"},403);let c=r.resolvePath(s,o),p=r.normalizePath(o);if(!r.normalizePath(c).startsWith(p+"/"))return w(e,{error:"Access denied"},403);r.pathExists(c)&&(a.push({path:s,name:r.getBasename(s),isDirectory:!0}),l(c,s))}else{for(let c of u){let p=r.resolveRepoPath(c);r.pathExists(p)&&(a.push({path:c,name:c,isDirectory:!0}),l(p,c))}try{let c=r.readdirSync(o,{withFileTypes:!0});for(let p of c)!p.isDirectory()&&p.name.endsWith(".md")&&a.push({path:p.name,name:p.name,isDirectory:!1})}catch{}}w(e,{entries:a})}async function er(n,e){let s=new URL(n.url,`http://${n.headers.host}`).searchParams.get("path");if(!s)return w(e,{error:"path parameter required"},400);if(!Ht(s))return w(e,{error:"Access denied"},403);if(!Ks(s))return w(e,{error:"Write not allowed to this path"},403);let r=Jt(s);if(!r)return w(e,{error:"Access denied"},403);try{let o=await _e(n),{content:a}=JSON.parse(o);if(a===void 0)return w(e,{error:"content field required"},400);let i=typeof a=="string"?a:JSON.stringify(a,null,2);await q().write(r,i,{overwrite:!0}),w(e,{ok:!0})}catch{w(e,{error:"Failed to write file"},500)}}async function tr(n,e){try{let t=await _e(n),{line:s,checked:r}=JSON.parse(t);if(typeof s!="number")return w(e,{error:"line number required"},400);let o=q(),a=o.resolveRepoPath(".dndev/implementation.md");if(!o.pathExists(a))return w(e,{error:"implementation.md not found"},404);let i=await o.read(a,{format:"text"});if(i===null)return w(e,{error:"Failed to read file"},500);let l=i.split(`
3
3
  `);if(s<0||s>=l.length)return w(e,{error:"Line out of range"},400);let u=l[s];l[s]=r?u.replace("- [ ]","- [x]"):u.replace("- [x]","- [ ]"),await o.write(a,l.join(`
4
- `),{overwrite:!0}),w(e,{ok:!0,line:l[s]})}catch{w(e,{error:"Failed to update progress"},500)}}async function sr(n,e){try{let t=await _e(n),{id:s,data:r}=JSON.parse(t);if(!s||!r)return w(e,{error:"id and data required"},400);if(!/^[\w-]+$/.test(s))return w(e,{error:"Invalid screenshot ID"},400);let o=q(),a=o.resolveRepoPath(".dndev/bugs");o.ensureDirSync(a);let i=Buffer.from(r,"base64"),l=o.resolvePath(`${s}.png`,a);await o.write(l,i,{overwrite:!0}),w(e,{ok:!0,path:`.dndev/bugs/${s}.png`})}catch{w(e,{error:"Failed to save screenshot"},500)}}async function rr(n,e){try{let t=await _e(n),{action:s,phase:r}=JSON.parse(t);if(!s||typeof r!="number")return w(e,{error:"action and phase required"},400);let o=q(),a=Vt();o.ensureDirSync(a);let i=o.resolvePath("protocol.json",a),l={currentPhase:0,phases:{}};if(o.pathExists(i))try{let u=await o.read(i);u&&(l=u)}catch{}s==="start"?(l.currentPhase=r,l.phases[r]||(l.phases[r]={}),l.phases[r].status="active",l.phases[r].startedAt=new Date().toISOString()):s==="complete"&&(l.phases[r]||(l.phases[r]={}),l.phases[r].status="completed",l.phases[r].completedAt=new Date().toISOString()),await o.write(i,l,{overwrite:!0}),w(e,{ok:!0,protocol:l})}catch{w(e,{error:"Failed to update phase"},500)}}function or(n,e){try{let t=Bt(),s=Me("git rev-parse --short HEAD",{cwd:t,encoding:"utf-8",timeout:5e3}).trim(),r=Me("git rev-parse --abbrev-ref HEAD",{cwd:t,encoding:"utf-8",timeout:5e3}).trim();w(e,{commit:s,branch:r})}catch{w(e,{commit:"unknown",branch:"unknown"})}}async function nr(n,e){try{let t=await _e(n),s=JSON.parse(t);if(!s.id||!s.type||!s.result)return w(e,{error:"id, type, and result required"},400);let r=q(),o=Vt();r.ensureDirSync(o);let a=r.resolvePath("health.json",o),i={actions:[]};if(r.pathExists(a))try{let u=await r.read(a);u&&(i=u)}catch{}Array.isArray(i.actions)||(i.actions=[]);let l=i.actions.findIndex(u=>u.id===s.id);l>=0?i.actions[l]={...i.actions[l],...s}:i.actions.unshift(s),await r.write(a,i,{overwrite:!0}),w(e,{ok:!0})}catch{w(e,{error:"Failed to append action"},500)}}function ar(n,e){let t=q(),s=t.resolveRepoPath("apps");try{let o=t.readdirSync(s).filter(a=>{if(a==="dndev")return!1;let i=t.resolvePath(a,s);return t.statSync(i)?.isDirectory()&&t.pathExists(t.resolvePath("package.json",i))}).map(a=>{try{let i=t.resolvePath(`${a}/package.json`,s),l=t.readSync(i);return{name:a,packageName:l?.name||a}}catch{return{name:a,packageName:a}}});w(e,{apps:o})}catch{w(e,{apps:[]})}}function ir(n){if(Ze)return;let e=q(),t=e.normalizePath(n.config.root),s=e.resolvePath("terminal-sidecar.cjs",t);if(!e.pathExists(s))return;try{let i=Me(`fuser ${Gt}/tcp 2>/dev/null`,{encoding:"utf8"}).trim();i&&process.kill(Number(i),"SIGKILL")}catch{}Ze=!0;let r=e.getRepoRoot(),o=Ys(),a=Hs(o,[s],{cwd:r,stdio:["ignore","inherit","inherit","ipc"],env:{...process.env,TERMINAL_PORT:String(Gt),TERMINAL_CWD:r}});a.on("message",i=>{i.type}),a.on("exit",i=>{Ze=!1}),process.on("exit",()=>{a.kill()})}function lr(n){let e=q(),t=e.getRepoRoot(),s=[".dndev","docs","guides"];for(let r of s){let o=e.resolveRepoPath(r);if(!e.pathExists(o))continue;let a=e.watch(o,{recursive:!0},(i,l)=>{if(!l||l==="dashboard.json")return;let u=`${r}/${l}`,c=`change:${u}`;Xe.has(c)||(Xe.set(c,!0),setTimeout(()=>Xe.delete(c),300),n.hot.send("dndev:file-changed",{path:u,timestamp:Date.now()}))});n.httpServer?.on("close",()=>a.close())}}function cr(n={}){return{name:"dndev",configureServer(e){let t=Bt();n.debug,e.middlewares.use((s,r,o)=>{let a=s.url;if(!a?.startsWith(Wt))return o();let l=new URL(a,`http://${s.headers.host}`).pathname.slice(Wt.length),u=s.method?.toUpperCase();if(u==="GET")return l==="/file"?void Xs(s,r):l==="/tree"?void Qs(s,r):l==="/git/head"?void or(s,r):l==="/apps"?void ar(s,r):w(r,{error:"Not found"},404);if(u==="POST")return l==="/file"?void er(s,r):l==="/progress/toggle"?void tr(s,r):l==="/bugs/screenshot"?void sr(s,r):l==="/phase"?void rr(s,r):l==="/actions/append"?void nr(s,r):w(r,{error:"Not found"},404);w(r,{error:"Method not allowed"},405)}),ir(e),lr(e)}}}var Wt,Js,qt,Zs,Gt,Ze,Xe,Kt=Le(()=>{"use strict";B();Wt="/api/dndev";Js=5*1024*1024;qt={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".ico":"image/x-icon",".svg":"image/svg+xml"},Zs=new Set(Object.keys(qt));Gt=24681,Ze=!1;Xe=new Map});import gs from"@rollup/plugin-strip";import{visualizer as ds}from"rollup-plugin-visualizer";var Ue=["/react/","/react-dom/","/scheduler/","/react-router","/@radix-ui/","/react-day-picker/","/react-hook-form/","/react-i18next/","/clsx/","/class-variance-authority/"],ts={valibot:["/valibot/"],firebase:["/firebase/","/@firebase/"],lucide:["/lucide-react/","/lucide/"],i18n:["/i18next/","/i18next-browser-languagedetector/","/i18next-http-backend/","/@donotdev/i18n/"],zustand:["/zustand/"],"tanstack-query":["/@tanstack/react-query/","/@tanstack/query-core/"]};function ss(n){let e=n.match(/(?:^|\0)virtual:([^?]+)/);if(e)return e[1]}function et(n){let e=n.replace(/\\/g,"/");if(e.includes("/node_modules/"))return e.split("?")[0]}function tt(n,e=Ue){return e.some(t=>n.includes(t))}function rs(n){for(let[e,t]of Object.entries(ts))if(t.some(s=>n.includes(s)))return e}function os(n){let e=ss(n);if(e)return e==="i18n-mapping"?"virtual-i18n-mapping":e.startsWith("i18n-lazy-")?e:"virtual-modules";let t=et(n);if(!t)return;if(tt(t))return"react-core";let s=rs(t);if(s)return s}function ns(n=[]){let e=n.filter(s=>!Ue.includes(s)),t=[...Ue,...e];return function(s){let r=et(s);if(r&&tt(r,t))return"react-core"}}var Qe={development:{manualChunks:void 0},production:{manualChunks:os}};function st(n,e={}){let t=Qe[n]||Qe.production,s=e.reactCore||[];return s.length>0?{manualChunks:ns(s)}:t}B();import*as Y from"@clack/prompts";var re={reset:"\x1B[0m",green:"\x1B[32m",brightGreen:"\x1B[92m",red:"\x1B[31m",brightRed:"\x1B[91m",yellow:"\x1B[33m",brightYellow:"\x1B[93m",blue:"\x1B[34m",cyan:"\x1B[36m",brightCyan:"\x1B[96m",gray:"\x1B[90m",white:"\x1B[37m"};function ps(){return process.env.NO_COLOR?!1:process.platform==="win32"?!0:process.stdout.isTTY===!0}function ae(n,e){return ps()?`${e}${n}${re.reset}`:n}function I(n,e,t,s={}){let{logDir:r=".dndev-logs",fileLogging:o=!1}=s,a=_.getInstance(),i=null;if(o){let c=a.resolveAppPath(r);a.pathExists(c)||a.mkdir(c),i=a.resolveAppPath(`${r}/${n.replace(/[^a-zA-Z0-9]/g,"-")}.log`);let p=`=== ${n} Log Started at ${new Date().toISOString()} ===
5
- `;a.writeSync(i,p)}let l=(c,p,g)=>{if(i){let d=new Date().toISOString(),m=g.length>0?" "+g.map(T=>typeof T=="object"?JSON.stringify(T,null,2):String(T)).join(" "):"",k=`${d} [${c}] ${p}${m}
6
- `;a.appendFile(i,k)}},u=(c,p)=>{if(p.length===0)return c;let g=p.map(d=>typeof d=="object"?JSON.stringify(d,null,2):String(d)).join(" ");return`${c} ${g}`};return{debug:(c,...p)=>{e&&(o?l("DEBUG",c,p):Y.log.message(ae(u(c,p),re.gray)))},verbose:(c,...p)=>{t&&(o?l("VERBOSE",c,p):Y.log.message(u(c,p)))},info:(c,...p)=>{o?l("INFO",c,p):Y.log.info(ae(u(c,p),re.brightCyan))},warn:(c,...p)=>{e&&o?l("WARN",c,p):Y.log.warn(ae(u(c,p),re.brightYellow))},error:(c,...p)=>{e&&o?l("ERROR",c,p):Y.log.error(ae(u(c,p),re.brightRed))},success:(c,...p)=>{e&&o?l("SUCCESS",c,p):Y.log.success(ae(u(c,p),re.brightGreen))},when:(c,p="debug")=>(g,...d)=>{if(c){let m=u(g,d);switch(p){case"verbose":t&&(Y.log.message(m),l("VERBOSE",g,d));break;case"info":Y.log.info(ae(m,re.brightCyan)),l("INFO",g,d);break;case"warn":Y.log.warn(ae(m,re.brightYellow)),l("WARN",g,d);break;case"error":Y.log.error(ae(m,re.brightRed)),l("ERROR",g,d);break;case"success":Y.log.success(ae(m,re.brightGreen)),l("SUCCESS",g,d);break;default:e&&(Y.log.message(ae(m,re.gray)),l("DEBUG",g,d))}}},getLogFilePath:()=>i}}B();function ut(n={}){let{mode:e="development",chunkingOptions:t={},debug:s,verbose:r=!0,isDev:o,isDebug:a,shouldAnalyze:i,build:l={}}=n,u=I("build",s,r),c=st(e,t);return u.debug("\u{1F41B} DEBUG MODE ENABLED:"),u.debug(" - Minification: DISABLED"),u.debug(" - Sourcemaps: ENABLED"),u.debug(" - Console logs: PRESERVED"),u.debug(" - Debugger statements: PRESERVED"),i&&(u.info("\u{1F4CA} Bundle analysis enabled"),u.info(` Visual treemap will open after build (stats.html)
7
- `)),{outDir:"dist",sourcemap:o||a,cacheDir:"node_modules/.vite",target:"baseline-widely-available",minify:a?!1:"esbuild",reportCompressedSize:!1,chunkSizeWarningLimit:2048,assetsInlineLimit:0,esbuild:{format:"esm",drop:a?[]:["console","debugger"],legalComments:"none"},cssMinify:a?!1:"esbuild",cssCodeSplit:!0,rollupOptions:{external:fs(),output:{format:"es",entryFileNames:"assets/[name].[hash].js",chunkFileNames:"assets/[name].[hash].js",assetFileNames:"assets/[name].[hash][extname]",...c.manualChunks&&{manualChunks:c.manualChunks},compact:!0},onwarn(g,d){g.code!=="MODULE_LEVEL_DIRECTIVE"&&d(g)},plugins:[...a?[]:[gs({include:["**/*.js","**/*.ts","**/*.tsx","**/*.jsx"],functions:["console.*","debugger"],labels:["debug"]})],...i?[(()=>{let g=_.getInstance(),d=g.getAppRoot(),m="dist",k=g.resolveAppPath(`${m}/stats.html`),T=()=>{try{let R=g.resolveAppPath(m);g.pathExists(R)||g.mkdir(R)}catch{}},v=ds({filename:k,open:!0,gzipSize:!0,brotliSize:!0,template:"treemap",sourcemap:o||a,projectRoot:d});if(v.buildStart){let R=v.buildStart.bind(v);v.buildStart=function(...y){T();let S=R.apply(this,y);return S&&typeof S.then=="function"?S.catch(h=>{}):S}}else v.buildStart=function(){T()};let $=["generateBundle","writeBundle","closeBundle"];for(let R of $)if(v[R]){let y=v[R];v[R]=function(...S){try{T();let h=y.apply(this,S);return h&&typeof h.then=="function"?h.catch(O=>{let F=O?.message||O?.toString()||String(O)||"Unknown error";u.warn(`Bundle visualizer warning in ${R}: ${F}`),R==="closeBundle"&&u.warn(`You can manually open ${k} to view the bundle analysis`)}):h}catch(h){let O=h?.message||h?.toString()||String(h)||"Unknown error";buildLogger.warn(`Bundle visualizer warning in ${R}: ${O}`),R==="closeBundle"&&buildLogger.warn(` You can manually open ${k} to view the bundle analysis`)}}}return v})()]:[]]}}}function fs(n){return n?["firebase-admin","gcp-metadata","google-logging-utils","@google-cloud/firestore",/\.node$/,"esbuild",/@esbuild\/.*/]:["gcp-metadata","google-logging-utils","payload","file-type","firebase-admin","firebase-admin/app","firebase-admin/auth","firebase-admin/firestore","firebase-admin/functions","firebase-admin/credential","@google-cloud/firestore","google-auth-library","google-gax","googleapis-common"]}function ms(){let n=!1,e=_.getInstance();if((e.pathExists("/.dockerenv")||e.pathExists("/run/.containerenv"))&&(n=!0),!n&&(process.env.DOCKER_CONTAINER==="true"||process.env.IS_DOCKER==="true"||process.env.DOCKER_BUILDKIT==="1"||process.env.CI==="true"&&process.env.DOCKER==="true")&&(n=!0),!n&&process.env.DOCKER_HOST&&process.env.DOCKER_HOST.includes("docker")&&(n=!0),!n&&process.platform==="linux"&&e.pathExists("/proc/self/cgroup"))try{let r=e.readSync("/proc/self/cgroup");r&&(r.includes("docker")||r.includes("containerd"))&&(n=!0)}catch{}let t=!1;if((process.env.WSL_DISTRO_NAME||process.env.WSLENV)&&(t=!0),!t&&process.platform==="linux"&&e.pathExists("/proc/version"))try{let r=(e.readSync("/proc/version")||"").toLowerCase();t=r.includes("microsoft")||r.includes("wsl")}catch{}if(!t&&process.platform==="linux"&&e.pathExists("/proc/sys/kernel/osrelease"))try{let r=(e.readSync("/proc/sys/kernel/osrelease")||"").toLowerCase()||"";(r.includes("microsoft")||r.includes("wsl"))&&(t=!0)}catch{}if(!t&&process.platform==="win32"){let r=process.cwd();r&&(r.includes("\\wsl$")||r.includes("\\wsl.localhost"))&&(t=!0)}let s=typeof process.versions?.bun=="string";return{isDocker:n,isWSL2:t,isBun:s}}function hs(n,e){if(n!==void 0)return n;let{isDocker:t,isWSL2:s,isBun:r}=ms();if(t||s||r){let o=t?"Docker":s?"WSL2":"Bun";return e.info(`Detected ${o} environment - enabling polling mode for file watching`),!0}}function pt(n,e={},t){let s=_.getInstance(),r=s.getRepoRoot(),{watch:o,hmr:a,host:i,...l}=e||{},u=a||{},c=i===!0?"localhost":i||"localhost",p={...u.port&&{port:u.port},...u.clientPort&&{clientPort:u.clientPort},host:u.host??c,...u.protocol&&{protocol:u.protocol},overlay:u.overlay??!0,timeout:u.timeout??5e3},g=i!==void 0?i:!0,d=l.https===!0;return{port:n,host:g,open:e.open!==void 0?e.open:!0,https:d,fs:{allow:[r,s.resolveRepoPath("packages"),s.resolveRepoPath("node_modules")],strict:!1},watch:(()=>{let m=hs(e?.watch?.usePolling,t);return{usePolling:m,interval:e?.watch?.interval??2e3,...m&&{awaitWriteFinish:{stabilityThreshold:300,pollInterval:100}},...e?.watch||{}}})(),hmr:{...p,...u},headers:{"Cross-Origin-Opener-Policy":"same-origin-allow-popups","Cross-Origin-Embedder-Policy":"unsafe-none"},middlewareMode:!1,...l}}function gt(n={}){let e=n.https===!0;return{...n,https:e}}L();var ee={CONCATENATE_DEDUPE:"CONCATENATE_DEDUPE",SHALLOW_MERGE:"SHALLOW_MERGE",DEEP_MERGE:"DEEP_MERGE",REPLACE:"REPLACE"};function pe(n,e,t,s={}){let{protectedKeys:r=[],onConflict:o}=s;if(e==null)return n;switch(t){case ee.CONCATENATE_DEDUPE:{if(!Array.isArray(n)||!Array.isArray(e))return e;let a=[...n,...e];return[...new Set(a)]}case ee.SHALLOW_MERGE:return typeof n!="object"||typeof e!="object"||n===null||e===null||Array.isArray(n)||Array.isArray(e)?e:{...n,...e};case ee.DEEP_MERGE:{if(typeof n!="object"||typeof e!="object"||n===null||e===null||Array.isArray(n)||Array.isArray(e))return e;let a={...n};for(let i in e){if(r.includes(i)){o&&o(i,n[i],e[i]);continue}typeof a[i]=="object"&&typeof e[i]=="object"&&a[i]!==null&&e[i]!==null&&!Array.isArray(a[i])&&!Array.isArray(e[i])?a[i]=pe(a[i],e[i],ee.DEEP_MERGE,{protectedKeys:r,onConflict:o}):a[i]=e[i]}return a}case ee.REPLACE:default:return e}}function dt(n,e,t=[],s){let r=[...n,...e||[]],o=[...new Set(r)];return[...new Set([...o,...t])]}var ye={base:"/",mode:process.env.NODE_ENV==="production"?"production":"development",debug:!1,verbose:process.env.CI!=="true",server:{port:3e3,strictPort:!0,host:!0,open:!0,cors:!0,https:!0,hmr:{overlay:!0,timeout:5e3,usePolling:void 0,interval:2e3},watch:{usePolling:void 0,interval:2e3}},build:{sourcemap:!0,target:"es2020",minify:"esbuild",cssMinify:"esbuild",analyze:!0},preview:{port:4173,strictPort:!0,host:!0,open:!1,cors:!0,https:!0},routes:{hmr:!0},themes:{},i18n:{},assets:{},features:{},pwa:{enabled:!1},seo:{disabled:!1,generateRobotsTxt:!0,generateSitemap:!0,crawlDelay:1},serverShim:{enabled:!0},chunking:{reactCore:[]},discovery:{verbose:!0,cacheTimeout:6e4,fileLogging:!1,logDir:".dndev-logs"},pluginFactory:{verbose:!0,disableHmr:!1,hmrSmartDetection:!0,hmrDebounceMs:500,hmrCacheTimeout:3e4},resolve:{alias:{"@":"/src"},preserveSymlinks:!1},define:{__DEV__:JSON.stringify(process.env.NODE_ENV==="development"),__PROD__:JSON.stringify(process.env.NODE_ENV==="production")},optimizeDeps:{include:[...me.mandatoryIncludes],exclude:[...me.buildTools,...Object.values(C)],esbuildOptions:{format:"esm",target:"es2020",platform:"browser",define:{"process.env.NODE_ENV":JSON.stringify(process.env.NODE_ENV||"development")},external:["next","next/*"]}},plugins:[],css:{},envDir:void 0};function ft(n={},e={}){let{onConflict:t}=e,s={...ye},r=[],o=(a,i,l,u)=>{r.push({key:a,frameworkValue:i,userValue:l,reason:u}),t&&t(a,i,l,u)};return Object.keys(n).forEach(a=>{let i=n[a],l=s[a];if(a==="optimizeDeps"&&typeof i=="object"&&i!==null){let u=l?.include||[],c=l?.exclude||[],p=i.include||[],g=i.exclude||[],d=u.filter($=>!$.startsWith("@donotdev/")),m=g.filter($=>d.includes($));if(m.length>0)for(let $ of m)o("optimizeDeps.exclude",$,"excluded",`Framework requires ${$} to be included. It will be included despite your exclusion.`);let k=dt(u,p,d),T=pe(c,g,ee.CONCATENATE_DEDUPE),v=pe(l?.esbuildOptions||{},i.esbuildOptions||{},ee.DEEP_MERGE,{protectedKeys:["external"],onConflict:$=>o(`optimizeDeps.esbuildOptions.${$}`,l?.esbuildOptions?.[$],i.esbuildOptions?.[$],`Framework requires ${$} to remain as configured.`)});s[a]={...l,include:k,exclude:T,esbuildOptions:v,...Object.fromEntries(Object.entries(i).filter(([$])=>!["include","exclude","esbuildOptions"].includes($)))};return}if(a==="css"&&typeof i=="object"&&i!==null){s[a]=pe(l||{},i,ee.DEEP_MERGE,{protectedKeys:["postcss"],onConflict:()=>o("css.postcss","framework PostCSS config",i.postcss,"Framework PostCSS config is required and cannot be overridden. Your postcss config is ignored.")});return}if(a==="define"&&typeof i=="object"&&i!==null){s[a]=pe(l||{},i,ee.DEEP_MERGE,{protectedKeys:["__DEV__","__PROD__"],onConflict:u=>o(`define.${u}`,l?.[u],i[u],`Framework requires ${u} to remain as configured.`)});return}if(Array.isArray(i)){Array.isArray(l)?s[a]=pe(l,i,ee.CONCATENATE_DEDUPE):s[a]=i;return}if(typeof i=="object"&&i!==null&&typeof l=="object"&&l!==null&&!Array.isArray(l)){s[a]=pe(l,i,ee.SHALLOW_MERGE);return}s[a]=i}),s}function mt(n){let{server:e={},preview:t={},mode:s,build:r={},resolve:o={},routes:a={},themes:i={},i18n:l={},assets:u={},features:c={},seo:p={},pwa:g={},serverShim:d={},chunking:m={},discovery:k={},pluginFactory:T={},debug:v,verbose:$,base:R,define:y={},optimizeDeps:S={},plugins:h=[],css:O={},envDir:F,...K}=n,P=s!=="production",x=v||P,W=s==="production"&&(r.analyze??ye.build.analyze);return{mode:s,debug:v,verbose:$,isDev:P,isDebug:x,shouldAnalyze:W,serverOptions:e,previewOptions:t,buildOverrides:r,resolveOptions:o,routeOptions:a,themeOptions:i,i18nOptions:l,assetOptions:u,featureOptions:c,seoOptions:p,pwaOptions:g,serverShimOptions:d,chunkingOptions:m,discoveryOptions:k,pluginFactoryOptions:T,base:R,defineOptions:y,optimizeDepsOptions:S,pluginsOptions:h,cssOptions:O,envDir:F,restOptions:K}}B();import vs from"autoprefixer";import ys from"postcss-import";import bs from"postcss-nesting";function ht({postcssImport:n,postcssNesting:e,autoprefixer:t,resolve:s}){return{plugins:[s?n({resolve:s}):n,e,t({overrideBrowserslist:["> 1%","last 2 versions","Firefox ESR","not dead","not op_mini all"],grid:"autoplace"})]}}function vt(n={}){if(n.postcss)return n.postcss;let e=_.getInstance();return ht({postcssImport:ys,postcssNesting:bs,autoprefixer:vs,resolve:(s,r)=>{let o=e.resolvePackage(s,r);if(o)return o;if(s.startsWith("@donotdev/")){let a=s.split("/")[0]+"/"+s.split("/")[1],i=s.split("/").slice(2).join("/"),l=e.resolveFrameworkPackage(a,r);if(l&&i){let u=e.resolvePath(i,l);if(e.pathExists(u))return u}}return e.resolvePath(s,r)}})}import Us from"@vitejs/plugin-basic-ssl";import Ws from"@vitejs/plugin-react";import Gs from"vite-tsconfig-paths";var H=class{static generateVirtualModule(e,t,s=!1,r=void 0,o=void 0){return t.isEmpty(e)?t.generateEmpty(e,s,r,o):t.generateModule(e,s,o)}static generateInspection(e,t,s,r){return t.generateInspection.length>=3?t.generateInspection(e,s,r):t.generateInspection(e,s)}static wrapVirtualModule(e,t){return`// Virtual module: ${e}
4
+ `),{overwrite:!0}),w(e,{ok:!0,line:l[s]})}catch{w(e,{error:"Failed to update progress"},500)}}async function sr(n,e){try{let t=await _e(n),{id:s,data:r}=JSON.parse(t);if(!s||!r)return w(e,{error:"id and data required"},400);if(!/^[\w-]+$/.test(s))return w(e,{error:"Invalid screenshot ID"},400);let o=q(),a=o.resolveRepoPath(".dndev/bugs");o.ensureDirSync(a);let i=Buffer.from(r,"base64"),l=o.resolvePath(`${s}.png`,a);await o.write(l,i,{overwrite:!0}),w(e,{ok:!0,path:`.dndev/bugs/${s}.png`})}catch{w(e,{error:"Failed to save screenshot"},500)}}async function rr(n,e){try{let t=await _e(n),{action:s,phase:r}=JSON.parse(t);if(!s||typeof r!="number")return w(e,{error:"action and phase required"},400);let o=q(),a=Vt();o.ensureDirSync(a);let i=o.resolvePath("protocol.json",a),l={currentPhase:0,phases:{}};if(o.pathExists(i))try{let u=await o.read(i);u&&(l=u)}catch{}s==="start"?(l.currentPhase=r,l.phases[r]||(l.phases[r]={}),l.phases[r].status="active",l.phases[r].startedAt=new Date().toISOString()):s==="complete"&&(l.phases[r]||(l.phases[r]={}),l.phases[r].status="completed",l.phases[r].completedAt=new Date().toISOString()),await o.write(i,l,{overwrite:!0}),w(e,{ok:!0,protocol:l})}catch{w(e,{error:"Failed to update phase"},500)}}function or(n,e){try{let t=Bt(),s=Me("git rev-parse --short HEAD",{cwd:t,encoding:"utf-8",timeout:5e3}).trim(),r=Me("git rev-parse --abbrev-ref HEAD",{cwd:t,encoding:"utf-8",timeout:5e3}).trim();w(e,{commit:s,branch:r})}catch{w(e,{commit:"unknown",branch:"unknown"})}}async function nr(n,e){try{let t=await _e(n),s=JSON.parse(t);if(!s.id||!s.type||!s.result)return w(e,{error:"id, type, and result required"},400);let r=q(),o=Vt();r.ensureDirSync(o);let a=r.resolvePath("health.json",o),i={actions:[]};if(r.pathExists(a))try{let u=await r.read(a);u&&(i=u)}catch{}Array.isArray(i.actions)||(i.actions=[]);let l=i.actions.findIndex(u=>u.id===s.id);l>=0?i.actions[l]={...i.actions[l],...s}:i.actions.unshift(s),await r.write(a,i,{overwrite:!0}),w(e,{ok:!0})}catch{w(e,{error:"Failed to append action"},500)}}function ar(n,e){let t=q(),s=t.resolveRepoPath("apps");try{let o=t.readdirSync(s).filter(a=>{if(a==="dndev")return!1;let i=t.resolvePath(a,s);return t.statSync(i)?.isDirectory()&&t.pathExists(t.resolvePath("package.json",i))}).map(a=>{try{let i=t.resolvePath(`${a}/package.json`,s),l=t.readSync(i);return{name:a,packageName:l?.name||a}}catch{return{name:a,packageName:a}}});w(e,{apps:o})}catch{w(e,{apps:[]})}}function ir(n){if(Ze)return;let e=q(),t=e.normalizePath(n.config.root),s=e.resolvePath("terminal-sidecar.cjs",t);if(!e.pathExists(s))return;try{let i=Me(`fuser ${Gt}/tcp 2>/dev/null`,{encoding:"utf8"}).trim();i&&process.kill(Number(i),"SIGKILL")}catch{}Ze=!0;let r=e.getRepoRoot(),o=Ys(),a=Hs(o,[s],{cwd:r,stdio:["ignore","inherit","inherit","ipc"],env:{...process.env,TERMINAL_PORT:String(Gt),TERMINAL_CWD:r}});a.on("message",i=>{i.type}),a.on("exit",i=>{Ze=!1}),process.on("exit",()=>{a.kill()})}function lr(n){let e=q(),t=e.getRepoRoot(),s=[".dndev","docs","guides"];for(let r of s){let o=e.resolveRepoPath(r);if(!e.pathExists(o))continue;let a=e.watch(o,{recursive:!0},(i,l)=>{if(!l||l==="dashboard.json")return;let u=`${r}/${l}`,c=`change:${u}`;Xe.has(c)||(Xe.set(c,!0),setTimeout(()=>Xe.delete(c),300),n.hot.send("dndev:file-changed",{path:u,timestamp:Date.now()}))});n.httpServer?.on("close",()=>a.close())}}function cr(n={}){return{name:"dndev",configureServer(e){let t=Bt();n.debug,e.middlewares.use((s,r,o)=>{let a=s.url;if(!a?.startsWith(Wt))return o();let l=new URL(a,`http://${s.headers.host}`).pathname.slice(Wt.length),u=s.method?.toUpperCase();if(u==="GET")return l==="/file"?void Xs(s,r):l==="/tree"?void Qs(s,r):l==="/git/head"?void or(s,r):l==="/apps"?void ar(s,r):w(r,{error:"Not found"},404);if(u==="POST")return l==="/file"?void er(s,r):l==="/progress/toggle"?void tr(s,r):l==="/bugs/screenshot"?void sr(s,r):l==="/phase"?void rr(s,r):l==="/actions/append"?void nr(s,r):w(r,{error:"Not found"},404);w(r,{error:"Method not allowed"},405)}),ir(e),lr(e)}}}var Wt,Js,qt,Zs,Gt,Ze,Xe,Kt=Le(()=>{"use strict";B();Wt="/api/dndev";Js=5*1024*1024;qt={".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".webp":"image/webp",".ico":"image/x-icon",".svg":"image/svg+xml"},Zs=new Set(Object.keys(qt));Gt=24681,Ze=!1;Xe=new Map});import gs from"@rollup/plugin-strip";import{visualizer as ds}from"rollup-plugin-visualizer";var Ue=["/react/","/react-dom/","/scheduler/","/react-router","/@radix-ui/","/react-day-picker/","/react-hook-form/","/react-i18next/","/clsx/","/class-variance-authority/"],ts={valibot:["/valibot/"],firebase:["/firebase/","/@firebase/"],lucide:["/lucide-react/","/lucide/"],i18n:["/i18next/","/i18next-browser-languagedetector/","/i18next-http-backend/","/@donotdev/i18n/"],zustand:["/zustand/"],"tanstack-query":["/@tanstack/react-query/","/@tanstack/query-core/"]};function ss(n){let e=n.match(/(?:^|\0)virtual:([^?]+)/);if(e)return e[1]}function et(n){let e=n.replace(/\\/g,"/");if(e.includes("/node_modules/"))return e.split("?")[0]}function tt(n,e=Ue){return e.some(t=>n.includes(t))}function rs(n){for(let[e,t]of Object.entries(ts))if(t.some(s=>n.includes(s)))return e}function os(n){let e=ss(n);if(e)return e==="i18n-mapping"?"virtual-i18n-mapping":e.startsWith("i18n-lazy-")?e:"virtual-modules";let t=et(n);if(!t)return;if(tt(t))return"react-core";let s=rs(t);if(s)return s}function ns(n=[]){let e=n.filter(s=>!Ue.includes(s)),t=[...Ue,...e];return function(s){let r=et(s);if(r&&tt(r,t))return"react-core"}}var Qe={development:{manualChunks:void 0},production:{manualChunks:os}};function st(n,e={}){let t=Qe[n]||Qe.production,s=e.reactCore||[];return s.length>0?{manualChunks:ns(s)}:t}B();import*as Y from"@clack/prompts";var oe={reset:"\x1B[0m",green:"\x1B[32m",brightGreen:"\x1B[92m",red:"\x1B[31m",brightRed:"\x1B[91m",yellow:"\x1B[33m",brightYellow:"\x1B[93m",blue:"\x1B[34m",cyan:"\x1B[36m",brightCyan:"\x1B[96m",gray:"\x1B[90m",white:"\x1B[37m"};function ps(){return process.env.NO_COLOR?!1:process.platform==="win32"?!0:process.stdout.isTTY===!0}function ie(n,e){return ps()?`${e}${n}${oe.reset}`:n}function F(n,e,t,s={}){let{logDir:r=".dndev-logs",fileLogging:o=!1}=s,a=_.getInstance(),i=null;if(o){let c=a.resolveAppPath(r);a.pathExists(c)||a.mkdir(c),i=a.resolveAppPath(`${r}/${n.replace(/[^a-zA-Z0-9]/g,"-")}.log`);let p=`=== ${n} Log Started at ${new Date().toISOString()} ===
5
+ `;a.writeSync(i,p)}let l=(c,p,g)=>{if(i){let d=new Date().toISOString(),m=g.length>0?" "+g.map(O=>typeof O=="object"?JSON.stringify(O,null,2):String(O)).join(" "):"",k=`${d} [${c}] ${p}${m}
6
+ `;a.appendFile(i,k)}},u=(c,p)=>{if(p.length===0)return c;let g=p.map(d=>typeof d=="object"?JSON.stringify(d,null,2):String(d)).join(" ");return`${c} ${g}`};return{debug:(c,...p)=>{e&&(o?l("DEBUG",c,p):Y.log.message(ie(u(c,p),oe.gray)))},verbose:(c,...p)=>{t&&(o?l("VERBOSE",c,p):Y.log.message(u(c,p)))},info:(c,...p)=>{o?l("INFO",c,p):Y.log.info(ie(u(c,p),oe.brightCyan))},warn:(c,...p)=>{e&&o?l("WARN",c,p):Y.log.warn(ie(u(c,p),oe.brightYellow))},error:(c,...p)=>{e&&o?l("ERROR",c,p):Y.log.error(ie(u(c,p),oe.brightRed))},success:(c,...p)=>{e&&o?l("SUCCESS",c,p):Y.log.success(ie(u(c,p),oe.brightGreen))},when:(c,p="debug")=>(g,...d)=>{if(c){let m=u(g,d);switch(p){case"verbose":t&&(Y.log.message(m),l("VERBOSE",g,d));break;case"info":Y.log.info(ie(m,oe.brightCyan)),l("INFO",g,d);break;case"warn":Y.log.warn(ie(m,oe.brightYellow)),l("WARN",g,d);break;case"error":Y.log.error(ie(m,oe.brightRed)),l("ERROR",g,d);break;case"success":Y.log.success(ie(m,oe.brightGreen)),l("SUCCESS",g,d);break;default:e&&(Y.log.message(ie(m,oe.gray)),l("DEBUG",g,d))}}},getLogFilePath:()=>i}}B();function ut(n={}){let{mode:e="development",chunkingOptions:t={},debug:s,verbose:r=!0,isDev:o,isDebug:a,shouldAnalyze:i,build:l={}}=n,u=F("build",s,r),c=st(e,t);return u.debug("\u{1F41B} DEBUG MODE ENABLED:"),u.debug(" - Minification: DISABLED"),u.debug(" - Sourcemaps: ENABLED"),u.debug(" - Console logs: PRESERVED"),u.debug(" - Debugger statements: PRESERVED"),i&&(u.info("\u{1F4CA} Bundle analysis enabled"),u.info(` Visual treemap will open after build (stats.html)
7
+ `)),{outDir:"dist",sourcemap:o||a,cacheDir:"node_modules/.vite",target:"baseline-widely-available",minify:a?!1:"esbuild",reportCompressedSize:!1,chunkSizeWarningLimit:2048,assetsInlineLimit:0,esbuild:{format:"esm",drop:a?[]:["console","debugger"],legalComments:"none"},cssMinify:a?!1:"esbuild",cssCodeSplit:!0,rollupOptions:{external:fs(),output:{format:"es",entryFileNames:"assets/[name].[hash].js",chunkFileNames:"assets/[name].[hash].js",assetFileNames:"assets/[name].[hash][extname]",...c.manualChunks&&{manualChunks:c.manualChunks},compact:!0},onwarn(g,d){g.code!=="MODULE_LEVEL_DIRECTIVE"&&d(g)},plugins:[...a?[]:[gs({include:["**/*.js","**/*.ts","**/*.tsx","**/*.jsx"],functions:["console.*","debugger"],labels:["debug"]})],...i?[(()=>{let g=_.getInstance(),d=g.getAppRoot(),m="dist",k=g.resolveAppPath(`${m}/stats.html`),O=()=>{try{let R=g.resolveAppPath(m);g.pathExists(R)||g.mkdir(R)}catch{}},v=ds({filename:k,open:!0,gzipSize:!0,brotliSize:!0,template:"treemap",sourcemap:o||a,projectRoot:d});if(v.buildStart){let R=v.buildStart.bind(v);v.buildStart=function(...y){O();let S=R.apply(this,y);return S&&typeof S.then=="function"?S.catch(h=>{}):S}}else v.buildStart=function(){O()};let D=["generateBundle","writeBundle","closeBundle"];for(let R of D)if(v[R]){let y=v[R];v[R]=function(...S){try{O();let h=y.apply(this,S);return h&&typeof h.then=="function"?h.catch(N=>{let T=N?.message||N?.toString()||String(N)||"Unknown error";u.warn(`Bundle visualizer warning in ${R}: ${T}`),R==="closeBundle"&&u.warn(`You can manually open ${k} to view the bundle analysis`)}):h}catch(h){let N=h?.message||h?.toString()||String(h)||"Unknown error";buildLogger.warn(`Bundle visualizer warning in ${R}: ${N}`),R==="closeBundle"&&buildLogger.warn(` You can manually open ${k} to view the bundle analysis`)}}}return v})()]:[]]}}}function fs(n){return n?["firebase-admin","gcp-metadata","google-logging-utils","@google-cloud/firestore",/\.node$/,"esbuild",/@esbuild\/.*/]:["gcp-metadata","google-logging-utils","payload","file-type","firebase-admin","firebase-admin/app","firebase-admin/auth","firebase-admin/firestore","firebase-admin/functions","firebase-admin/credential","@google-cloud/firestore","google-auth-library","google-gax","googleapis-common"]}function ms(){let n=!1,e=_.getInstance();if((e.pathExists("/.dockerenv")||e.pathExists("/run/.containerenv"))&&(n=!0),!n&&(process.env.DOCKER_CONTAINER==="true"||process.env.IS_DOCKER==="true"||process.env.DOCKER_BUILDKIT==="1"||process.env.CI==="true"&&process.env.DOCKER==="true")&&(n=!0),!n&&process.env.DOCKER_HOST&&process.env.DOCKER_HOST.includes("docker")&&(n=!0),!n&&process.platform==="linux"&&e.pathExists("/proc/self/cgroup"))try{let r=e.readSync("/proc/self/cgroup");r&&(r.includes("docker")||r.includes("containerd"))&&(n=!0)}catch{}let t=!1;if((process.env.WSL_DISTRO_NAME||process.env.WSLENV)&&(t=!0),!t&&process.platform==="linux"&&e.pathExists("/proc/version"))try{let r=(e.readSync("/proc/version")||"").toLowerCase();t=r.includes("microsoft")||r.includes("wsl")}catch{}if(!t&&process.platform==="linux"&&e.pathExists("/proc/sys/kernel/osrelease"))try{let r=(e.readSync("/proc/sys/kernel/osrelease")||"").toLowerCase()||"";(r.includes("microsoft")||r.includes("wsl"))&&(t=!0)}catch{}if(!t&&process.platform==="win32"){let r=process.cwd();r&&(r.includes("\\wsl$")||r.includes("\\wsl.localhost"))&&(t=!0)}let s=typeof process.versions?.bun=="string";return{isDocker:n,isWSL2:t,isBun:s}}function hs(n,e){if(n!==void 0)return n;let{isDocker:t,isWSL2:s,isBun:r}=ms();if(t||s||r){let o=t?"Docker":s?"WSL2":"Bun";return e.info(`Detected ${o} environment - enabling polling mode for file watching`),!0}}function pt(n,e={},t){let s=_.getInstance(),r=s.getRepoRoot(),{watch:o,hmr:a,host:i,...l}=e||{},u=a||{},c=i===!0?"localhost":i||"localhost",p={...u.port&&{port:u.port},...u.clientPort&&{clientPort:u.clientPort},host:u.host??c,...u.protocol&&{protocol:u.protocol},overlay:u.overlay??!0,timeout:u.timeout??5e3},g=i!==void 0?i:!0,d=l.https===!0;return{port:n,host:g,open:e.open!==void 0?e.open:!0,https:d,fs:{allow:[r,s.resolveRepoPath("packages"),s.resolveRepoPath("node_modules")],strict:!1},watch:(()=>{let m=hs(e?.watch?.usePolling,t);return{usePolling:m,interval:e?.watch?.interval??2e3,...m&&{awaitWriteFinish:{stabilityThreshold:300,pollInterval:100}},...e?.watch||{}}})(),hmr:{...p,...u},headers:{"Cross-Origin-Opener-Policy":"same-origin-allow-popups","Cross-Origin-Embedder-Policy":"unsafe-none"},middlewareMode:!1,...l}}function gt(n={}){let e=n.https===!0;return{...n,https:e}}L();var te={CONCATENATE_DEDUPE:"CONCATENATE_DEDUPE",SHALLOW_MERGE:"SHALLOW_MERGE",DEEP_MERGE:"DEEP_MERGE",REPLACE:"REPLACE"};function ge(n,e,t,s={}){let{protectedKeys:r=[],onConflict:o}=s;if(e==null)return n;switch(t){case te.CONCATENATE_DEDUPE:{if(!Array.isArray(n)||!Array.isArray(e))return e;let a=[...n,...e];return[...new Set(a)]}case te.SHALLOW_MERGE:return typeof n!="object"||typeof e!="object"||n===null||e===null||Array.isArray(n)||Array.isArray(e)?e:{...n,...e};case te.DEEP_MERGE:{if(typeof n!="object"||typeof e!="object"||n===null||e===null||Array.isArray(n)||Array.isArray(e))return e;let a={...n};for(let i in e){if(r.includes(i)){o&&o(i,n[i],e[i]);continue}typeof a[i]=="object"&&typeof e[i]=="object"&&a[i]!==null&&e[i]!==null&&!Array.isArray(a[i])&&!Array.isArray(e[i])?a[i]=ge(a[i],e[i],te.DEEP_MERGE,{protectedKeys:r,onConflict:o}):a[i]=e[i]}return a}case te.REPLACE:default:return e}}function dt(n,e,t=[],s){let r=[...n,...e||[]],o=[...new Set(r)];return[...new Set([...o,...t])]}var ye={base:"/",mode:process.env.NODE_ENV==="production"?"production":"development",debug:!1,verbose:process.env.CI!=="true",server:{port:3e3,strictPort:!0,host:!0,open:!0,cors:!0,https:!0,hmr:{overlay:!0,timeout:5e3,usePolling:void 0,interval:2e3},watch:{usePolling:void 0,interval:2e3}},build:{sourcemap:!0,target:"es2020",minify:"esbuild",cssMinify:"esbuild",analyze:!0},preview:{port:4173,strictPort:!0,host:!0,open:!1,cors:!0,https:!0},routes:{hmr:!0},themes:{},i18n:{},assets:{},features:{},pwa:{enabled:!1},seo:{disabled:!1,generateRobotsTxt:!0,generateSitemap:!0,crawlDelay:1},serverShim:{enabled:!0},chunking:{reactCore:[]},discovery:{verbose:!0,cacheTimeout:6e4,fileLogging:!1,logDir:".dndev-logs"},pluginFactory:{verbose:!0,disableHmr:!1,hmrSmartDetection:!0,hmrDebounceMs:500,hmrCacheTimeout:3e4},resolve:{alias:{"@":"/src"},preserveSymlinks:!1},define:{__DEV__:JSON.stringify(process.env.NODE_ENV==="development"),__PROD__:JSON.stringify(process.env.NODE_ENV==="production")},optimizeDeps:{include:[...me.mandatoryIncludes],exclude:[...me.buildTools,...Object.values(M)],esbuildOptions:{format:"esm",target:"es2020",platform:"browser",define:{"process.env.NODE_ENV":JSON.stringify(process.env.NODE_ENV||"development")},external:["next","next/*"]}},plugins:[],css:{},envDir:void 0};function ft(n={},e={}){let{onConflict:t}=e,s={...ye},r=[],o=(a,i,l,u)=>{r.push({key:a,frameworkValue:i,userValue:l,reason:u}),t&&t(a,i,l,u)};return Object.keys(n).forEach(a=>{let i=n[a],l=s[a];if(a==="optimizeDeps"&&typeof i=="object"&&i!==null){let u=l?.include||[],c=l?.exclude||[],p=i.include||[],g=i.exclude||[],d=u.filter(D=>!D.startsWith("@donotdev/")),m=g.filter(D=>d.includes(D));if(m.length>0)for(let D of m)o("optimizeDeps.exclude",D,"excluded",`Framework requires ${D} to be included. It will be included despite your exclusion.`);let k=dt(u,p,d),O=ge(c,g,te.CONCATENATE_DEDUPE),v=ge(l?.esbuildOptions||{},i.esbuildOptions||{},te.DEEP_MERGE,{protectedKeys:["external"],onConflict:D=>o(`optimizeDeps.esbuildOptions.${D}`,l?.esbuildOptions?.[D],i.esbuildOptions?.[D],`Framework requires ${D} to remain as configured.`)});s[a]={...l,include:k,exclude:O,esbuildOptions:v,...Object.fromEntries(Object.entries(i).filter(([D])=>!["include","exclude","esbuildOptions"].includes(D)))};return}if(a==="css"&&typeof i=="object"&&i!==null){s[a]=ge(l||{},i,te.DEEP_MERGE,{protectedKeys:["postcss"],onConflict:()=>o("css.postcss","framework PostCSS config",i.postcss,"Framework PostCSS config is required and cannot be overridden. Your postcss config is ignored.")});return}if(a==="define"&&typeof i=="object"&&i!==null){s[a]=ge(l||{},i,te.DEEP_MERGE,{protectedKeys:["__DEV__","__PROD__"],onConflict:u=>o(`define.${u}`,l?.[u],i[u],`Framework requires ${u} to remain as configured.`)});return}if(Array.isArray(i)){Array.isArray(l)?s[a]=ge(l,i,te.CONCATENATE_DEDUPE):s[a]=i;return}if(typeof i=="object"&&i!==null&&typeof l=="object"&&l!==null&&!Array.isArray(l)){s[a]=ge(l,i,te.SHALLOW_MERGE);return}s[a]=i}),s}function mt(n){let{server:e={},preview:t={},mode:s,build:r={},resolve:o={},routes:a={},themes:i={},i18n:l={},assets:u={},features:c={},seo:p={},pwa:g={},serverShim:d={},chunking:m={},discovery:k={},pluginFactory:O={},debug:v,verbose:D,base:R,define:y={},optimizeDeps:S={},plugins:h=[],css:N={},envDir:T,...K}=n,P=s!=="production",x=v||P,W=s==="production"&&(r.analyze??ye.build.analyze);return{mode:s,debug:v,verbose:D,isDev:P,isDebug:x,shouldAnalyze:W,serverOptions:e,previewOptions:t,buildOverrides:r,resolveOptions:o,routeOptions:a,themeOptions:i,i18nOptions:l,assetOptions:u,featureOptions:c,seoOptions:p,pwaOptions:g,serverShimOptions:d,chunkingOptions:m,discoveryOptions:k,pluginFactoryOptions:O,base:R,defineOptions:y,optimizeDepsOptions:S,pluginsOptions:h,cssOptions:N,envDir:T,restOptions:K}}B();import vs from"autoprefixer";import ys from"postcss-import";import bs from"postcss-nesting";function ht({postcssImport:n,postcssNesting:e,autoprefixer:t,resolve:s}){return{plugins:[s?n({resolve:s}):n,e,t({overrideBrowserslist:["> 1%","last 2 versions","Firefox ESR","not dead","not op_mini all"],grid:"autoplace"})]}}function vt(n={}){if(n.postcss)return n.postcss;let e=_.getInstance();return ht({postcssImport:ys,postcssNesting:bs,autoprefixer:vs,resolve:(s,r)=>{let o=e.resolvePackage(s,r);if(o)return o;if(s.startsWith("@donotdev/")){let a=s.split("/")[0]+"/"+s.split("/")[1],i=s.split("/").slice(2).join("/"),l=e.resolveFrameworkPackage(a,r);if(l&&i){let u=e.resolvePath(i,l);if(e.pathExists(u))return u}}return e.resolvePath(s,r)}})}import Us from"@vitejs/plugin-basic-ssl";import Ws from"@vitejs/plugin-react";import Gs from"vite-tsconfig-paths";var H=class{static generateVirtualModule(e,t,s=!1,r=void 0,o=void 0){return t.isEmpty(e)?t.generateEmpty(e,s,r,o):t.generateModule(e,s,o)}static generateInspection(e,t,s,r){return t.generateInspection.length>=3?t.generateInspection(e,s,r):t.generateInspection(e,s)}static wrapVirtualModule(e,t){return`// Virtual module: ${e}
8
8
  // Generated by @donotdev/config discovery
9
9
  // Version: 1.0.0
10
10
 
@@ -40,13 +40,13 @@ var Qt=Object.defineProperty;var Le=(n,e)=>()=>(n&&(e=n(n=0)),e);var es=(n,e)=>{
40
40
  `);return`// Helper functions for ${e}
41
41
  // Generated by @donotdev/config
42
42
 
43
- ${s}`}static validateTemplates(e){return["isEmpty","generateModule","generateEmpty","generateInspection"].every(s=>e[s]&&typeof e[s]=="function")}static createTemplateConfig(e,t){let{isEmpty:s=()=>!1,generateModule:r=()=>"",generateEmpty:o=()=>"",generateInspection:a=()=>"",generateManifest:i=()=>({}),logConfig:l=()=>{},logStats:u=()=>{},logManifest:c=()=>{}}=t;return{isEmpty:s,generateModule:r,generateEmpty:o,generateInspection:a,generateManifest:i,logConfig:l,logStats:u,logManifest:c,pluginName:e,version:"1.0.0",createdAt:new Date().toISOString()}}static getEmptyResultWithError(e,t){let s=t?.message||t||"Unknown error";if(e&&typeof e._getEmptyResult=="function")try{let r=e._getEmptyResult();return r.errors&&Array.isArray(r.errors)?r.errors.push(s):r.errors===void 0&&(r.errors=[s]),r.source==="empty"&&(r.source="error"),r}catch{return{errors:[s],source:"error"}}return{errors:[s],source:"error"}}};B();function ie(n){let{pluginName:e,icon:t,virtualModuleId:s,DiscoveryClass:r,discoveryMethod:o,filePatterns:a,templates:i,defaultInspectionPath:l,manifestFileName:u,createDiscovery:c,discoveryOptions:p={},configKey:g}=n;return function(m={}){let{debug:k,verbose:T,virtualModuleId:v=s,inspectionFilePath:$=l,hmrDebounceMs:R,hmrCacheTimeout:y,hmrSmartDetection:S,disableHmr:h,...O}=m;if(!H.validateTemplates(i))throw new Error(`Invalid templates for plugin ${e}`);let F={...ye.discovery,...p,debug:k,verbose:T,...O},K=g||(()=>{let f=e.match(/dndev-vite-(\w+)-discovery/);return f?f[1]:null})(),P=I(e,k,T,{fileLogging:F.fileLogging,logDir:F.logDir}),x=_.getInstance(),W=()=>{let f=x.getAppRoot(),b=x.getRepoRoot();return f&&f!==b},be=Date.now(),Z=c?c(x,F):new r(x,F),oe="\0"+v,D="",A=!1,N=null,z=0,de=!1,G=null,le=!1,ce=null,fe=!1;typeof global<"u"&&(global.__DNDEV_CLEAR_CACHE__=()=>(Z.clearCache(),G=null,P.info("Discovery cache cleared manually"),"Cache cleared"));function ze(f){let M=H.generateVirtualModule(f,i,k,F,K).replace(/mode:\s*['"]development['"]/g,"mode: typeof process !== 'undefined' && process.env.NODE_ENV === 'production' ? 'production' : 'development'");return!h&&A&&(M+=`
43
+ ${s}`}static validateTemplates(e){return["isEmpty","generateModule","generateEmpty","generateInspection"].every(s=>e[s]&&typeof e[s]=="function")}static createTemplateConfig(e,t){let{isEmpty:s=()=>!1,generateModule:r=()=>"",generateEmpty:o=()=>"",generateInspection:a=()=>"",generateManifest:i=()=>({}),logConfig:l=()=>{},logStats:u=()=>{},logManifest:c=()=>{}}=t;return{isEmpty:s,generateModule:r,generateEmpty:o,generateInspection:a,generateManifest:i,logConfig:l,logStats:u,logManifest:c,pluginName:e,version:"1.0.0",createdAt:new Date().toISOString()}}static getEmptyResultWithError(e,t){let s=t?.message||t||"Unknown error";if(e&&typeof e._getEmptyResult=="function")try{let r=e._getEmptyResult();return r.errors&&Array.isArray(r.errors)?r.errors.push(s):r.errors===void 0&&(r.errors=[s]),r.source==="empty"&&(r.source="error"),r}catch{return{errors:[s],source:"error"}}return{errors:[s],source:"error"}}};B();function le(n){let{pluginName:e,icon:t,virtualModuleId:s,DiscoveryClass:r,discoveryMethod:o,filePatterns:a,templates:i,defaultInspectionPath:l,manifestFileName:u,createDiscovery:c,discoveryOptions:p={},configKey:g}=n;return function(m={}){let{debug:k,verbose:O,virtualModuleId:v=s,inspectionFilePath:D=l,hmrDebounceMs:R,hmrCacheTimeout:y,hmrSmartDetection:S,disableHmr:h,...N}=m;if(!H.validateTemplates(i))throw new Error(`Invalid templates for plugin ${e}`);let T={...ye.discovery,...p,debug:k,verbose:O,...N},K=g||(()=>{let f=e.match(/dndev-vite-(\w+)-discovery/);return f?f[1]:null})(),P=F(e,k,O,{fileLogging:T.fileLogging,logDir:T.logDir}),x=_.getInstance(),W=()=>{let f=x.getAppRoot(),b=x.getRepoRoot();return f&&f!==b},be=Date.now(),Z=c?c(x,T):new r(x,T),ne="\0"+v,$="",A=!1,C=null,I=0,X=!1,G=null,ce=!1,ue=null,fe=!1;typeof global<"u"&&(global.__DNDEV_CLEAR_CACHE__=()=>(Z.clearCache(),G=null,P.info("Discovery cache cleared manually"),"Cache cleared"));function ze(f){let z=H.generateVirtualModule(f,i,k,T,K).replace(/mode:\s*['"]development['"]/g,"mode: typeof process !== 'undefined' && process.env.NODE_ENV === 'production' ? 'production' : 'development'");return!h&&A&&(z+=`
44
44
 
45
45
  // HMR boundary for ${e}
46
46
  if (import.meta.hot) {
47
47
  import.meta.hot.accept();
48
48
  }
49
- `),M}function je(f){return H.generateInspection(f,i,D,F)}async function we(){if(D)try{let f=await Z[o](),b=je(f),M=x.resolveAppPath($);await x.write(M,b),P.debug(`Generated inspection file: ${x.getRelativePath(M)}`)}catch(f){P.error(`${e} failed to write inspection file (${$}): ${f.message}`),P.error(`Stack: ${f.stack||"No stack trace available"}`)}}function $e(f){let b=f.replace(/\\/g,"/");if(h||b.includes("/node_modules/")||b.includes("/.git/")||b.includes("/dist/")||b.includes("/build/")||b.includes("/coverage/")||b.includes("/.vite/")||b.includes("/.turbo/")||b.endsWith(".d.ts")||b.endsWith(".tsbuildinfo")||b.endsWith(".map")||b.endsWith(".css.map")||b.endsWith(".generated.log")||/\.generated\.[a-z]+$/.test(b))return!1;let M=x.getRelativePath(b);if(M.startsWith("packages/"))return!1;let ne=M.startsWith("src/")&&/\.(ts|tsx)$/.test(M);return ne?Array.isArray(a)&&a.length>0?a.some(se=>typeof se=="function"?se(b):typeof se=="string"?se.startsWith("**/")?b.endsWith(se.slice(3)):b.endsWith(se):!1):ne:!1}function De(f){if(h)return P.debug("Virtual modules are static - HMR disabled"),[];let b=Date.now();return le?(P.debug("HMR already in progress, skipping update"),[]):b-z<R?(de||(de=!0,N=setTimeout(()=>{de=!1,z=Date.now(),ke(f)},R)),[]):(z=b,ke(f))}function ke(f){let b=Date.now();if(ce===f.file&&b-z<100)return P.debug(`Same file processed too recently: ${f.file}`),[];if(!$e(f.file))return P.debug(`Skipping irrelevant file change: ${f.file}`),[];P.debug(`Relevant file changed: ${f.file}`),le=!0,ce=f.file;try{let M=Date.now()-(G?.timestamp||0);if(M<y&&G){P.debug(`Using cached discovery data (age: ${M}ms)`);let se=f.server.moduleGraph.getModuleById(oe);return se&&f.server.reloadModule(se),[]}Z.clearCache();let ne=f.server.moduleGraph.getModuleById(oe);return ne&&f.server.reloadModule(ne),N&&clearTimeout(N),N=setTimeout(()=>{we()},500),[]}finally{le=!1,setTimeout(()=>{ce===f.file&&(ce=null)},200)}}return{name:e,enforce:"pre",configResolved(f){D=f.root,A=f.command==="serve",k&&P.debug(`${t} ${e} initialized`),A&&P.debug("\u{1F4A1} Dev mode: Press 'r' in terminal to restart, or use global.__DNDEV_CLEAR_CACHE__() in console"),i.logConfig&&i.logConfig(F)},config(f){return f.optimizeDeps||(f.optimizeDeps={}),f.optimizeDeps.exclude||(f.optimizeDeps.exclude=[]),f.optimizeDeps.exclude.includes(v)||f.optimizeDeps.exclude.push(v),f},resolveId(f){return f===v?(P.debug(`Resolving virtual module: ${f}`),{id:oe,moduleSideEffects:!0}):null},async load(f){if(f!==oe)return null;if(P.debug(`Loading virtual module: ${f}`),!W()){P.warn("\u26A0\uFE0F load() called before appRoot is set - waiting for config resolution");let b=0;for(;!W()&&b<100;)await new Promise(M=>setTimeout(M,10)),b++;if(!W())throw new Error("App root not set before discovery. Ensure configResolved hook has set appRoot.")}try{let b;return G?(P.debug("Using cached discovery data for virtual module"),b=G):(P.warn(`\u26A0\uFE0F No cached discovery data found for ${e} - running discovery in load() hook. This may indicate buildStart() hook did not run or failed. Performance may be impacted.`),b=await Z[o](),G=b,P.debug("Discovery completed for virtual module")),ze(b)}catch(b){return P.error(`${e} virtual module (${oe}) failed to load: ${b.message}`),P.error(`Stack: ${b.stack||"No stack trace available"}`),i.generateEmpty({},k,F,K)}},async buildStart(){if(fe=!1,!W()){P.warn("\u26A0\uFE0F buildStart() called before appRoot is set - waiting for config resolution");let f=0;for(;!W()&&f<100;)await new Promise(b=>setTimeout(b,10)),f++;if(!W())throw new Error("App root not set before discovery. Ensure configResolved hook has set appRoot.")}try{let f=await Z[o](!G);G=f,await we(),i.logStats&&i.logStats(f,t,P)}catch(f){P.error(`${e} discovery failed during file scanning: ${f.message}`),P.error(`Stack: ${f.stack||"No stack trace available"}`),G=H.getEmptyResultWithError(Z,f)}finally{fe=!0}},configureServer(){fe=!0},handleHotUpdate(f){return h?[]:fe?De(f):(P.debug("HMR disabled - discovery not complete yet"),[])},generateBundle(){if(!G){P.warn("No cached discovery data for manifest generation - skipping");return}try{let f=H.generateManifest(G,i.generateManifest);this.emitFile({type:"asset",fileName:u,source:JSON.stringify(f,null,2)}),T&&i.logManifest&&i.logManifest(G,e)}catch(f){P.error(`${e} manifest generation failed: ${f.message}`),P.error(`Stack: ${f.stack||"No stack trace available"}`)}},transform(f,b){return b===oe?{code:f,map:null}:null}}}}var Jr={generateGlobals:H.generateGlobals,generateExports:H.generateExports,generateDefaultExport:H.generateDefaultExport,wrapVirtualModule:H.wrapVirtualModule,generateInspectionHeader:H.generateInspectionHeader,validateTemplates:H.validateTemplates,createTemplateConfig:H.createTemplateConfig};L();var te=class n{constructor(e,t={}){if(this.constructor===n)throw new Error("BaseDiscovery is abstract and cannot be instantiated directly");this.pathResolver=e,this.options={...t},process.env.NODE_ENV==="development"&&(this.options.cacheTimeout=Math.max(this.options.cacheTimeout||6e4,3e5)),this.logger=I(this._getDiscoveryType(),this.options.debug,this.options.verbose,{fileLogging:this.options.fileLogging,logDir:this.options.logDir}),this.cache=null,this._lastDiscoveryTime=0}async discover(e=!1){if(!e&&this._isCacheValid())return this.logger.debug("Using cached results"),this.cache;let t=Date.now();try{let s=await this._getPatterns();this.options.verbose&&s&&(typeof s=="object"&&s.pattern?this.logger.verbose(`Pattern: ${s.pattern}`):typeof s=="string"&&this.logger.verbose(`Pattern: ${s}`),s.dirs&&this.logger.verbose(`Search directories: ${s.dirs.slice(0,3).join(", ")}${s.dirs.length>3?` (${s.dirs.length} total)`:""}`));let r=await this._scanFiles(s),o=await this._processFiles(r);this.cache={...o,timestamp:Date.now()};let a=Date.now()-t;return this.logger.debug(`Discovery completed in ${a}ms`),this._lastDiscoveryTime=Date.now(),this.cache}catch(s){return this.logger.error(`${this._getDiscoveryType()} discovery failed during file scanning: ${s.message}`),this.logger.error(`Stack: ${s.stack||"No stack trace available"}`),this._getEmptyResult()}}clearCache(){this.cache=null,this._lastDiscoveryTime=0,this.logger.debug("Cache cleared")}getCachedResults(){return this.cache}_getDiscoveryType(){throw new Error("_getDiscoveryType must be implemented by subclass")}_getPatterns(){throw new Error("_getPatterns must be implemented by subclass")}_getPatternType(){throw new Error("_getPatternType must be implemented by subclass")}async _processFiles(e){throw new Error("_processFiles must be implemented by subclass")}_getEmptyResult(){throw new Error("_getEmptyResult must be implemented by subclass")}_getDiscoverySummary(){throw new Error("_getDiscoverySummary must be implemented by subclass")}async _scanFiles(e){let t=this._getPatternType();return await this.pathResolver.resolveFiles(e,t)}_extractFileNameInfo(e){let t=e.split("/"),s=t[t.length-1],r=s.split(".")[0],o=s.split(".").pop();return{fileName:s,baseName:r,extension:o,directory:t.slice(0,-1).join("/")}}async _processSingleFile(e,t){try{let s=this.pathResolver.getFileInfo(e);return s?await t(s):(this.logger.debug(`Could not get file info: ${e}`),null)}catch(s){return this.logger.debug(`Error processing file ${e}: ${s.message}`),null}}async _batchProcessFiles(e,t){return(await Promise.all(e.map(r=>this._processSingleFile(r,t)))).filter(r=>r!==null)}_isCacheValid(){return this.cache?Date.now()-this.cache.timestamp<this.options.cacheTimeout:!1}};L();var Te=class extends te{constructor(e,t={}){super(e,{assets:Q.assets.fallback,assetPatterns:Q.assets.patterns,frameworkPackage:Ge.package,assetsPath:Ge.assetsPath,modernFormats:Q.assets.modern,...t}),this.hasRunForSession=!1}_getDiscoveryType(){return"Asset"}async _getPatterns(){return await this.pathResolver.resolvePatterns("assets")}_getPatternType(){return"assets"}async _processFiles(e){let t=this.pathResolver.getAppRoot(),s=await this._ensureDefaultAssets(t),r=this.pathResolver.resolveAppPath("public/logo.svg");this.pathResolver.pathExists(r)||this.logger.warn("logo.svg not found in public/. Add your logo.svg to generate PWA assets, or copy from node_modules/@donotdev/ui/assets/logo.svg");let a=[],i=this.pathResolver.resolveAppPath("public/logo.svg");this.pathResolver.pathExists(i)&&this.options.generateAssets!==!1&&(a=(await this._generateMissingAssets(t))?.generated||[]);let{consumerFiles:l}=e,u=await this._processAssetFiles(l),c=this._buildAssetManifest(u),p=await this._readLogoSvgContent("/logo.svg",t);return{assets:u,manifest:{...c,logoSvgContent:p},copiedAssets:s,generatedAssets:a,pwaIcons:this._extractPWAIcons(u)}}_extractPWAIcons(e){let t=[/icon-(\d+)x(\d+)\.(png|jpg|jpeg|webp|svg)/i,/apple-touch-icon/i,/android-chrome/i,/favicon\.(ico|svg)/i];return e.filter(s=>{let r=s.path.split("/").pop()||"";return t.some(o=>o.test(r))}).map(s=>{let r=s.path.split("/").pop()||"",o=r.match(/(\d+)x(\d+)/),a=o?{width:parseInt(o[1]),height:parseInt(o[2])}:this._getDefaultIconSize(r);return{type:"icon",path:s.path.replace(/^\/?public\//,""),size:a,format:s.format||this._getFormatFromPath(s.path),purpose:this._getIconPurpose(r)}})}_getDefaultIconSize(e){return e.includes("apple-touch-icon")?{width:180,height:180}:e.includes("favicon")?{width:32,height:32}:{width:192,height:192}}_getFormatFromPath(e){return e.split(".").pop()?.toLowerCase()||"png"}_getIconPurpose(e){return e.includes("maskable")||e.includes("mask")?"maskable":"any"}_getEmptyResult(){return{assets:[],manifest:this._getEmptyManifest(),copiedAssets:[],timestamp:Date.now()}}_getDiscoverySummary(){let e=this.cache?.assets?.length||0,t=this.cache?.copiedAssets?.length||0;return`${e} assets, ${t} copied`}async discoverAssets(e=!1){return await this.discover(e)}getAssets(){return this.cache?.assets||[]}getManifest(){return this.cache?.manifest||this._getEmptyManifest()}getOptimalAsset(e,t){let s=this.getAssets().map(o=>o.path),r=t||this.options.modernFormats;for(let o of r){let a=`/${e}.${o}`;if(s.includes(a))return a}return null}async _ensureDefaultAssets(e){this.logger.debug("Ensuring default assets with modern format support...");let t=[];try{let s=await this._resolveFrameworkAssetsDir(e);if(this.logger.debug(`Framework assets directory resolved to: ${s}`),!s)return this.logger.debug("Framework assets directory not found, skipping defaults"),t;let r=this.pathResolver.resolveAppPath(xe.public);this.pathResolver.pathExists(r)||(this.pathResolver.mkdir(r),this.logger.debug(`Created public directory: ${r}`));for(let o of this.options.assets)await this._ensureAsset(o,r,s)&&t.push(o);t.length>0&&this.logger.debug(`Added ${t.length} default assets from DNDev framework`)}catch(s){this.logger.debug(`Failed to ensure default assets: ${s.message}`)}return t}async _ensureAsset(e,t,s){let r=this.pathResolver.resolveAppPath(`${xe.public}/${e}`);if(this.pathResolver.pathExists(r))return this.logger.debug(`Asset exists: ${e}`),!1;let o=this.pathResolver.normalizePath(`${s}/${e}`);if(this.pathResolver.pathExists(o)){if(await this.pathResolver.copy(o,r))return this.logger.debug(`Copied framework asset: ${e}`),!0;this.logger.debug(`Failed to copy framework asset: ${e}`)}return!1}async _processAssetFiles(e){let t=[];for(let s of e)try{let r=this.pathResolver.getFileInfo(s);if(r&&r.isFile){let o=s.split("/").pop()||s.split("\\").pop(),a=this._analyzeAsset(o,r.size);a&&t.push(a)}}catch(r){this.logger.debug(`Error processing asset file ${s}: ${r.message}`)}return this.logger.debug(`Processed ${t.length} assets from ${e.length} files`),t}_analyzeAsset(e,t){let s=this._determineAssetType(e),r=this._determineAssetFormat(e);return this.options.assetPatterns.some(a=>this._matchesPattern(e,a))?{path:`/${e}`,name:e,type:s,format:r,size:t,sizeFormatted:this._formatBytes(t),isModern:this.options.modernFormats.includes(r)}:(this.logger.debug(`Asset ${e} does not match any pattern, skipping`),null)}_determineAssetType(e){let t=e.toLowerCase();if(t.includes("favicon"))return"favicon";if(t.includes("logo"))return"logo";if(t.includes("icon"))return"icon";if(t.includes("apple-touch"))return"apple-touch-icon";if(t.includes("android-chrome"))return"android-icon";if(t.includes("manifest"))return"manifest";let s=e.split(".").pop()?.toLowerCase();return["png","jpg","jpeg","gif","webp","avif","svg"].includes(s)?"image":["woff2","woff","ttf","otf"].includes(s)?"font":["json"].includes(s)?"json":["ico"].includes(s)?"icon":"unknown"}_determineAssetFormat(e){return e.split(".").pop()?.toLowerCase()||"unknown"}_formatBytes(e){if(e===0)return"0 Bytes";let t=1024,s=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,r)).toFixed(2))+" "+s[r]}_matchesPattern(e,t){let s=e.toLowerCase(),r=t.toLowerCase();return s.includes(r.replace("*",""))}_buildAssetManifest(e){let t=e.map(r=>r.path);return{logo:{optimal:this._getOptimalAsset("logo",t,this.options.modernFormats),fallback:this._getOptimalAsset("logo",t,["png","jpg","jpeg"])},favicon:{optimal:this._getOptimalAsset("favicon",t,["svg","ico"]),fallback:this._getOptimalAsset("favicon",t,["ico"])},appleTouchIcon:this._getOptimalAsset("apple-touch-icon",t,["png"]),androidChrome:{192:this._getOptimalAsset("android-chrome-192x192",t,["png"]),512:this._getOptimalAsset("android-chrome-512x512",t,["png"])},manifest:t.find(r=>r.includes("manifest.json"))||null,modernFormats:e.filter(r=>r.isModern).map(r=>r.path),fallbackFormats:e.filter(r=>!r.isModern).map(r=>r.path)}}_getOptimalAsset(e,t,s){for(let r of s){let o=`/${e}.${r}`;if(t.includes(o))return o}return null}async _resolveFrameworkAssetsDir(e){try{let t=this.pathResolver.getRepoRoot(),s=await this._resolvePackage("@donotdev/ui",t);if(!s)return this.logger.debug("@donotdev/ui package not found"),null;let r=this.pathResolver.normalizePath(`${s}/assets`);return this.pathResolver.pathExists(r)?(this.logger.debug(`Using framework assets from: ${r}`),r):(this.logger.debug(`Assets directory not found: ${r}`),null)}catch(t){return this.logger.debug(`Error resolving framework assets directory: ${t.message}`),null}}async _resolvePackage(e,t){try{let s=this.pathResolver.resolveFrameworkPackage(e,t);return s?(this.logger.debug(`Found package: ${s}`),s):(this.logger.debug(`Package ${e} not found`),null)}catch(s){return this.logger.debug(`Error resolving package ${e}: ${s.message}`),null}}_getEmptyManifest(){return{logo:{optimal:null,fallback:null},favicon:{optimal:null,fallback:null},appleTouchIcon:null,androidChrome:{192:null,512:null},manifest:null,modernFormats:[],fallbackFormats:[],logoSvgContent:null}}async _readLogoSvgContent(e,t){if(!e||!e.endsWith(".svg"))return null;try{let s=e.slice(1),r=this.pathResolver.resolveAppPath(`${xe.public}/${s}`);return this.pathResolver.pathExists(r)&&await this.pathResolver.read(r,{format:"text"})||null}catch(s){return this.logger.debug(`Failed to read logo SVG content: ${s.message}`),null}}async _copyFrameworkLogo(e){try{let t=await this._resolveFrameworkAssetsDir(e);if(!t)return this.logger.debug("Framework assets directory not found"),!1;let s=this.pathResolver.normalizePath(`${t}/logo.svg`);if(!this.pathResolver.pathExists(s))return this.logger.debug("Framework logo.svg not found"),!1;let r=this.pathResolver.resolveAppPath(xe.public);this.pathResolver.pathExists(r)||this.pathResolver.mkdir(r);let o=this.pathResolver.resolveAppPath("public/logo.svg");return await this.pathResolver.copy(s,o)}catch(t){return this.logger.debug(`Failed to copy framework logo: ${t.message}`),!1}}async _generateMissingAssets(e){let t=this.pathResolver.resolveAppPath("public/logo.svg"),s=this.pathResolver.resolveAppPath("public");if(!this.pathResolver.pathExists(t))return this.logger.debug("logo.svg not found in public/, skipping asset generation"),{generated:[],skipped:[],error:"logo.svg not found in public/"};let r=[{name:"favicon.ico",size:32,format:"ico"},{name:"apple-touch-icon.png",size:180,format:"png"},{name:"icon-192x192.png",size:192,format:"png"},{name:"icon-512x512.png",size:512,format:"png"}],o=[{name:"favicon.svg",format:"svg"}],a=[],i=[];try{let l=await this.pathResolver.read(t,{format:"text"});if(!l)return{generated:[],skipped:[...o,...r].map(c=>c.name),error:"Failed to read logo.svg"};for(let c of o){let p=`${s}/${c.name}`;if(this.pathResolver.pathExists(p)){i.push(c.name);continue}try{await this.pathResolver.write(`public/${c.name}`,l),a.push(c.name)}catch(g){this.logger.debug(`Failed to copy ${c.name}: ${g.message}`),i.push(c.name)}}let u=await import("sharp").catch(()=>null);if(!u)this.logger.debug("sharp not installed, skipping PNG/ICO generation"),i.push(...r.map(c=>c.name));else for(let c of r){let p=`${s}/${c.name}`;if(this.pathResolver.pathExists(p)){i.push(c.name);continue}try{let g=u.default(t).resize(c.size,c.size,{fit:"contain",background:{r:255,g:255,b:255,alpha:0}}),d;c.format==="ico"?d=await g.toFormat("png").toBuffer():d=await g.toFormat(c.format).toBuffer(),await this.pathResolver.write(`public/${c.name}`,d),a.push(c.name)}catch(g){this.logger.debug(`Failed to generate ${c.name}: ${g.message}`),i.push(c.name)}}return{generated:a,skipped:i,error:null}}catch(l){return this.logger.debug(`Asset generation failed: ${l.message}`),{generated:[],skipped:requiredAssets.map(u=>u.name),error:l.message}}}};B();var Je={data:null},ws={isEmpty:n=>!n.manifest||n.assets?.length===0,generateModule:(n,e,t="assets")=>{let{manifest:s,assets:r,copiedAssets:o}=n,a=s.logoSvgContent||null,i={totalAssets:r.length,copiedAssets:o.length,hasLogo:s.logo.optimal!==null,hasFavicon:s.favicon.optimal!==null,hasManifest:s.manifest!==null,timestamp:new Date().toISOString()};return`// ${C.assets} - Generated asset manifest
49
+ `),z}function je(f){return H.generateInspection(f,i,$,T)}async function we(){if($)try{let f=await Z[o](),b=je(f),z=x.resolveAppPath(D);await x.write(z,b),P.debug(`Generated inspection file: ${x.getRelativePath(z)}`)}catch(f){P.error(`${e} failed to write inspection file (${D}): ${f.message}`),P.error(`Stack: ${f.stack||"No stack trace available"}`)}}function $e(f){let b=f.replace(/\\/g,"/");if(h||b.includes("/node_modules/")||b.includes("/.git/")||b.includes("/dist/")||b.includes("/build/")||b.includes("/coverage/")||b.includes("/.vite/")||b.includes("/.turbo/")||b.endsWith(".d.ts")||b.endsWith(".tsbuildinfo")||b.endsWith(".map")||b.endsWith(".css.map")||b.endsWith(".generated.log")||/\.generated\.[a-z]+$/.test(b))return!1;let z=x.getRelativePath(b);if(z.startsWith("packages/"))return!1;let ae=z.startsWith("src/")&&/\.(ts|tsx)$/.test(z);return ae?Array.isArray(a)&&a.length>0?a.some(re=>typeof re=="function"?re(b):typeof re=="string"?re.startsWith("**/")?b.endsWith(re.slice(3)):b.endsWith(re):!1):ae:!1}function De(f){if(h)return P.debug("Virtual modules are static - HMR disabled"),[];let b=Date.now();return ce?(P.debug("HMR already in progress, skipping update"),[]):b-I<R?(X||(X=!0,C=setTimeout(()=>{X=!1,I=Date.now(),ke(f)},R)),[]):(I=b,ke(f))}function ke(f){let b=Date.now();if(ue===f.file&&b-I<100)return P.debug(`Same file processed too recently: ${f.file}`),[];if(!$e(f.file))return P.debug(`Skipping irrelevant file change: ${f.file}`),[];P.debug(`Relevant file changed: ${f.file}`),ce=!0,ue=f.file;try{let z=Date.now()-(G?.timestamp||0);if(z<y&&G){P.debug(`Using cached discovery data (age: ${z}ms)`);let re=f.server.moduleGraph.getModuleById(ne);return re&&f.server.reloadModule(re),[]}Z.clearCache();let ae=f.server.moduleGraph.getModuleById(ne);return ae&&f.server.reloadModule(ae),C&&clearTimeout(C),C=setTimeout(()=>{we()},500),[]}finally{ce=!1,setTimeout(()=>{ue===f.file&&(ue=null)},200)}}return{name:e,enforce:"pre",configResolved(f){$=f.root,A=f.command==="serve",k&&P.debug(`${t} ${e} initialized`),A&&P.debug("\u{1F4A1} Dev mode: Press 'r' in terminal to restart, or use global.__DNDEV_CLEAR_CACHE__() in console"),i.logConfig&&i.logConfig(T)},config(f){return f.optimizeDeps||(f.optimizeDeps={}),f.optimizeDeps.exclude||(f.optimizeDeps.exclude=[]),f.optimizeDeps.exclude.includes(v)||f.optimizeDeps.exclude.push(v),f},resolveId(f){return f===v?(P.debug(`Resolving virtual module: ${f}`),{id:ne,moduleSideEffects:!0}):null},async load(f){if(f!==ne)return null;if(P.debug(`Loading virtual module: ${f}`),!W()){P.warn("\u26A0\uFE0F load() called before appRoot is set - waiting for config resolution");let b=0;for(;!W()&&b<100;)await new Promise(z=>setTimeout(z,10)),b++;if(!W())throw new Error("App root not set before discovery. Ensure configResolved hook has set appRoot.")}try{let b;return G?(P.debug("Using cached discovery data for virtual module"),b=G):(P.warn(`\u26A0\uFE0F No cached discovery data found for ${e} - running discovery in load() hook. This may indicate buildStart() hook did not run or failed. Performance may be impacted.`),b=await Z[o](),G=b,P.debug("Discovery completed for virtual module")),ze(b)}catch(b){return P.error(`${e} virtual module (${ne}) failed to load: ${b.message}`),P.error(`Stack: ${b.stack||"No stack trace available"}`),i.generateEmpty({},k,T,K)}},async buildStart(){if(fe=!1,!W()){P.warn("\u26A0\uFE0F buildStart() called before appRoot is set - waiting for config resolution");let f=0;for(;!W()&&f<100;)await new Promise(b=>setTimeout(b,10)),f++;if(!W())throw new Error("App root not set before discovery. Ensure configResolved hook has set appRoot.")}try{let f=await Z[o](!G);G=f,await we(),i.logStats&&i.logStats(f,t,P)}catch(f){P.error(`${e} discovery failed during file scanning: ${f.message}`),P.error(`Stack: ${f.stack||"No stack trace available"}`),G=H.getEmptyResultWithError(Z,f)}finally{fe=!0}},configureServer(){fe=!0},handleHotUpdate(f){return h?[]:fe?De(f):(P.debug("HMR disabled - discovery not complete yet"),[])},generateBundle(){if(!G){P.warn("No cached discovery data for manifest generation - skipping");return}try{let f=H.generateManifest(G,i.generateManifest);this.emitFile({type:"asset",fileName:u,source:JSON.stringify(f,null,2)}),O&&i.logManifest&&i.logManifest(G,e)}catch(f){P.error(`${e} manifest generation failed: ${f.message}`),P.error(`Stack: ${f.stack||"No stack trace available"}`)}},transform(f,b){return b===ne?{code:f,map:null}:null}}}}var Jr={generateGlobals:H.generateGlobals,generateExports:H.generateExports,generateDefaultExport:H.generateDefaultExport,wrapVirtualModule:H.wrapVirtualModule,generateInspectionHeader:H.generateInspectionHeader,validateTemplates:H.validateTemplates,createTemplateConfig:H.createTemplateConfig};L();var se=class n{constructor(e,t={}){if(this.constructor===n)throw new Error("BaseDiscovery is abstract and cannot be instantiated directly");this.pathResolver=e,this.options={...t},process.env.NODE_ENV==="development"&&(this.options.cacheTimeout=Math.max(this.options.cacheTimeout||6e4,3e5)),this.logger=F(this._getDiscoveryType(),this.options.debug,this.options.verbose,{fileLogging:this.options.fileLogging,logDir:this.options.logDir}),this.cache=null,this._lastDiscoveryTime=0}async discover(e=!1){if(!e&&this._isCacheValid())return this.logger.debug("Using cached results"),this.cache;let t=Date.now();try{let s=await this._getPatterns();this.options.verbose&&s&&(typeof s=="object"&&s.pattern?this.logger.verbose(`Pattern: ${s.pattern}`):typeof s=="string"&&this.logger.verbose(`Pattern: ${s}`),s.dirs&&this.logger.verbose(`Search directories: ${s.dirs.slice(0,3).join(", ")}${s.dirs.length>3?` (${s.dirs.length} total)`:""}`));let r=await this._scanFiles(s),o=await this._processFiles(r);this.cache={...o,timestamp:Date.now()};let a=Date.now()-t;return this.logger.debug(`Discovery completed in ${a}ms`),this._lastDiscoveryTime=Date.now(),this.cache}catch(s){return this.logger.error(`${this._getDiscoveryType()} discovery failed during file scanning: ${s.message}`),this.logger.error(`Stack: ${s.stack||"No stack trace available"}`),this._getEmptyResult()}}clearCache(){this.cache=null,this._lastDiscoveryTime=0,this.logger.debug("Cache cleared")}getCachedResults(){return this.cache}_getDiscoveryType(){throw new Error("_getDiscoveryType must be implemented by subclass")}_getPatterns(){throw new Error("_getPatterns must be implemented by subclass")}_getPatternType(){throw new Error("_getPatternType must be implemented by subclass")}async _processFiles(e){throw new Error("_processFiles must be implemented by subclass")}_getEmptyResult(){throw new Error("_getEmptyResult must be implemented by subclass")}_getDiscoverySummary(){throw new Error("_getDiscoverySummary must be implemented by subclass")}async _scanFiles(e){let t=this._getPatternType();return await this.pathResolver.resolveFiles(e,t)}_extractFileNameInfo(e){let t=e.split("/"),s=t[t.length-1],r=s.split(".")[0],o=s.split(".").pop();return{fileName:s,baseName:r,extension:o,directory:t.slice(0,-1).join("/")}}async _processSingleFile(e,t){try{let s=this.pathResolver.getFileInfo(e);return s?await t(s):(this.logger.debug(`Could not get file info: ${e}`),null)}catch(s){return this.logger.debug(`Error processing file ${e}: ${s.message}`),null}}async _batchProcessFiles(e,t){return(await Promise.all(e.map(r=>this._processSingleFile(r,t)))).filter(r=>r!==null)}_isCacheValid(){return this.cache?Date.now()-this.cache.timestamp<this.options.cacheTimeout:!1}};L();var Te=class extends se{constructor(e,t={}){super(e,{assets:ee.assets.fallback,assetPatterns:ee.assets.patterns,frameworkPackage:Ge.package,assetsPath:Ge.assetsPath,modernFormats:ee.assets.modern,...t}),this.hasRunForSession=!1}_getDiscoveryType(){return"Asset"}async _getPatterns(){return await this.pathResolver.resolvePatterns("assets")}_getPatternType(){return"assets"}async _processFiles(e){let t=this.pathResolver.getAppRoot(),s=await this._ensureDefaultAssets(t),r=this.pathResolver.resolveAppPath("public/logo.svg");this.pathResolver.pathExists(r)||this.logger.warn("logo.svg not found in public/. Add your logo.svg to generate PWA assets, or copy from node_modules/@donotdev/ui/assets/logo.svg");let a=[],i=this.pathResolver.resolveAppPath("public/logo.svg");this.pathResolver.pathExists(i)&&this.options.generateAssets!==!1&&(a=(await this._generateMissingAssets(t))?.generated||[]);let{consumerFiles:l}=e,u=await this._processAssetFiles(l),c=this._buildAssetManifest(u),p=await this._readLogoSvgContent("/logo.svg",t);return{assets:u,manifest:{...c,logoSvgContent:p},copiedAssets:s,generatedAssets:a,pwaIcons:this._extractPWAIcons(u)}}_extractPWAIcons(e){let t=[/icon-(\d+)x(\d+)\.(png|jpg|jpeg|webp|svg)/i,/apple-touch-icon/i,/android-chrome/i,/favicon\.(ico|svg)/i];return e.filter(s=>{let r=s.path.split("/").pop()||"";return t.some(o=>o.test(r))}).map(s=>{let r=s.path.split("/").pop()||"",o=r.match(/(\d+)x(\d+)/),a=o?{width:parseInt(o[1]),height:parseInt(o[2])}:this._getDefaultIconSize(r);return{type:"icon",path:s.path.replace(/^\/?public\//,""),size:a,format:s.format||this._getFormatFromPath(s.path),purpose:this._getIconPurpose(r)}})}_getDefaultIconSize(e){return e.includes("apple-touch-icon")?{width:180,height:180}:e.includes("favicon")?{width:32,height:32}:{width:192,height:192}}_getFormatFromPath(e){return e.split(".").pop()?.toLowerCase()||"png"}_getIconPurpose(e){return e.includes("maskable")||e.includes("mask")?"maskable":"any"}_getEmptyResult(){return{assets:[],manifest:this._getEmptyManifest(),copiedAssets:[],timestamp:Date.now()}}_getDiscoverySummary(){let e=this.cache?.assets?.length||0,t=this.cache?.copiedAssets?.length||0;return`${e} assets, ${t} copied`}async discoverAssets(e=!1){return await this.discover(e)}getAssets(){return this.cache?.assets||[]}getManifest(){return this.cache?.manifest||this._getEmptyManifest()}getOptimalAsset(e,t){let s=this.getAssets().map(o=>o.path),r=t||this.options.modernFormats;for(let o of r){let a=`/${e}.${o}`;if(s.includes(a))return a}return null}async _ensureDefaultAssets(e){this.logger.debug("Ensuring default assets with modern format support...");let t=[];try{let s=await this._resolveFrameworkAssetsDir(e);if(this.logger.debug(`Framework assets directory resolved to: ${s}`),!s)return this.logger.debug("Framework assets directory not found, skipping defaults"),t;let r=this.pathResolver.resolveAppPath(xe.public);this.pathResolver.pathExists(r)||(this.pathResolver.mkdir(r),this.logger.debug(`Created public directory: ${r}`));for(let o of this.options.assets)await this._ensureAsset(o,r,s)&&t.push(o);t.length>0&&this.logger.debug(`Added ${t.length} default assets from DNDev framework`)}catch(s){this.logger.debug(`Failed to ensure default assets: ${s.message}`)}return t}async _ensureAsset(e,t,s){let r=this.pathResolver.resolveAppPath(`${xe.public}/${e}`);if(this.pathResolver.pathExists(r))return this.logger.debug(`Asset exists: ${e}`),!1;let o=this.pathResolver.normalizePath(`${s}/${e}`);if(this.pathResolver.pathExists(o)){if(await this.pathResolver.copy(o,r))return this.logger.debug(`Copied framework asset: ${e}`),!0;this.logger.debug(`Failed to copy framework asset: ${e}`)}return!1}async _processAssetFiles(e){let t=[];for(let s of e)try{let r=this.pathResolver.getFileInfo(s);if(r&&r.isFile){let o=s.split("/").pop()||s.split("\\").pop(),a=this._analyzeAsset(o,r.size);a&&t.push(a)}}catch(r){this.logger.debug(`Error processing asset file ${s}: ${r.message}`)}return this.logger.debug(`Processed ${t.length} assets from ${e.length} files`),t}_analyzeAsset(e,t){let s=this._determineAssetType(e),r=this._determineAssetFormat(e);return this.options.assetPatterns.some(a=>this._matchesPattern(e,a))?{path:`/${e}`,name:e,type:s,format:r,size:t,sizeFormatted:this._formatBytes(t),isModern:this.options.modernFormats.includes(r)}:(this.logger.debug(`Asset ${e} does not match any pattern, skipping`),null)}_determineAssetType(e){let t=e.toLowerCase();if(t.includes("favicon"))return"favicon";if(t.includes("logo"))return"logo";if(t.includes("icon"))return"icon";if(t.includes("apple-touch"))return"apple-touch-icon";if(t.includes("android-chrome"))return"android-icon";if(t.includes("manifest"))return"manifest";let s=e.split(".").pop()?.toLowerCase();return["png","jpg","jpeg","gif","webp","avif","svg"].includes(s)?"image":["woff2","woff","ttf","otf"].includes(s)?"font":["json"].includes(s)?"json":["ico"].includes(s)?"icon":"unknown"}_determineAssetFormat(e){return e.split(".").pop()?.toLowerCase()||"unknown"}_formatBytes(e){if(e===0)return"0 Bytes";let t=1024,s=["Bytes","KB","MB","GB"],r=Math.floor(Math.log(e)/Math.log(t));return parseFloat((e/Math.pow(t,r)).toFixed(2))+" "+s[r]}_matchesPattern(e,t){let s=e.toLowerCase(),r=t.toLowerCase();return s.includes(r.replace("*",""))}_buildAssetManifest(e){let t=e.map(r=>r.path);return{logo:{optimal:this._getOptimalAsset("logo",t,this.options.modernFormats),fallback:this._getOptimalAsset("logo",t,["png","jpg","jpeg"])},favicon:{optimal:this._getOptimalAsset("favicon",t,["svg","ico"]),fallback:this._getOptimalAsset("favicon",t,["ico"])},appleTouchIcon:this._getOptimalAsset("apple-touch-icon",t,["png"]),androidChrome:{192:this._getOptimalAsset("android-chrome-192x192",t,["png"]),512:this._getOptimalAsset("android-chrome-512x512",t,["png"])},manifest:t.find(r=>r.includes("manifest.json"))||null,modernFormats:e.filter(r=>r.isModern).map(r=>r.path),fallbackFormats:e.filter(r=>!r.isModern).map(r=>r.path)}}_getOptimalAsset(e,t,s){for(let r of s){let o=`/${e}.${r}`;if(t.includes(o))return o}return null}async _resolveFrameworkAssetsDir(e){try{let t=this.pathResolver.getRepoRoot(),s=await this._resolvePackage("@donotdev/ui",t);if(!s)return this.logger.debug("@donotdev/ui package not found"),null;let r=this.pathResolver.normalizePath(`${s}/assets`);return this.pathResolver.pathExists(r)?(this.logger.debug(`Using framework assets from: ${r}`),r):(this.logger.debug(`Assets directory not found: ${r}`),null)}catch(t){return this.logger.debug(`Error resolving framework assets directory: ${t.message}`),null}}async _resolvePackage(e,t){try{let s=this.pathResolver.resolveFrameworkPackage(e,t);return s?(this.logger.debug(`Found package: ${s}`),s):(this.logger.debug(`Package ${e} not found`),null)}catch(s){return this.logger.debug(`Error resolving package ${e}: ${s.message}`),null}}_getEmptyManifest(){return{logo:{optimal:null,fallback:null},favicon:{optimal:null,fallback:null},appleTouchIcon:null,androidChrome:{192:null,512:null},manifest:null,modernFormats:[],fallbackFormats:[],logoSvgContent:null}}async _readLogoSvgContent(e,t){if(!e||!e.endsWith(".svg"))return null;try{let s=e.slice(1),r=this.pathResolver.resolveAppPath(`${xe.public}/${s}`);return this.pathResolver.pathExists(r)&&await this.pathResolver.read(r,{format:"text"})||null}catch(s){return this.logger.debug(`Failed to read logo SVG content: ${s.message}`),null}}async _copyFrameworkLogo(e){try{let t=await this._resolveFrameworkAssetsDir(e);if(!t)return this.logger.debug("Framework assets directory not found"),!1;let s=this.pathResolver.normalizePath(`${t}/logo.svg`);if(!this.pathResolver.pathExists(s))return this.logger.debug("Framework logo.svg not found"),!1;let r=this.pathResolver.resolveAppPath(xe.public);this.pathResolver.pathExists(r)||this.pathResolver.mkdir(r);let o=this.pathResolver.resolveAppPath("public/logo.svg");return await this.pathResolver.copy(s,o)}catch(t){return this.logger.debug(`Failed to copy framework logo: ${t.message}`),!1}}async _generateMissingAssets(e){let t=this.pathResolver.resolveAppPath("public/logo.svg"),s=this.pathResolver.resolveAppPath("public");if(!this.pathResolver.pathExists(t))return this.logger.debug("logo.svg not found in public/, skipping asset generation"),{generated:[],skipped:[],error:"logo.svg not found in public/"};let r=[{name:"favicon.ico",size:32,format:"ico"},{name:"apple-touch-icon.png",size:180,format:"png"},{name:"icon-192x192.png",size:192,format:"png"},{name:"icon-512x512.png",size:512,format:"png"}],o=[{name:"favicon.svg",format:"svg"}],a=[],i=[];try{let l=await this.pathResolver.read(t,{format:"text"});if(!l)return{generated:[],skipped:[...o,...r].map(c=>c.name),error:"Failed to read logo.svg"};for(let c of o){let p=`${s}/${c.name}`;if(this.pathResolver.pathExists(p)){i.push(c.name);continue}try{await this.pathResolver.write(`public/${c.name}`,l),a.push(c.name)}catch(g){this.logger.debug(`Failed to copy ${c.name}: ${g.message}`),i.push(c.name)}}let u=await import("sharp").catch(()=>null);if(!u)this.logger.debug("sharp not installed, skipping PNG/ICO generation"),i.push(...r.map(c=>c.name));else for(let c of r){let p=`${s}/${c.name}`;if(this.pathResolver.pathExists(p)){i.push(c.name);continue}try{let g=u.default(t).resize(c.size,c.size,{fit:"contain",background:{r:255,g:255,b:255,alpha:0}}),d;c.format==="ico"?d=await g.toFormat("png").toBuffer():d=await g.toFormat(c.format).toBuffer(),await this.pathResolver.write(`public/${c.name}`,d),a.push(c.name)}catch(g){this.logger.debug(`Failed to generate ${c.name}: ${g.message}`),i.push(c.name)}}return{generated:a,skipped:i,error:null}}catch(l){return this.logger.debug(`Asset generation failed: ${l.message}`),{generated:[],skipped:requiredAssets.map(u=>u.name),error:l.message}}}};B();var Je={data:null},ws={isEmpty:n=>!n.manifest||n.assets?.length===0,generateModule:(n,e,t="assets")=>{let{manifest:s,assets:r,copiedAssets:o}=n,a=s.logoSvgContent||null,i={totalAssets:r.length,copiedAssets:o.length,hasLogo:s.logo.optimal!==null,hasFavicon:s.favicon.optimal!==null,hasManifest:s.manifest!==null,timestamp:new Date().toISOString()};return`// ${M.assets} - Generated asset manifest
50
50
  const assetManifest = ${JSON.stringify(s,null,2)};
51
51
  const assetStats = ${JSON.stringify(i,null,2)};
52
52
 
@@ -116,7 +116,7 @@ export default {
116
116
  getManifest,
117
117
  getAllAssets
118
118
  };
119
- `},generateEmpty:(n,e,t,s="assets")=>{let r={totalAssets:0,copiedAssets:0,hasLogo:!1,hasFavicon:!1,hasManifest:!1,timestamp:new Date().toISOString()};return`// ${C.assets} - Empty asset manifest
119
+ `},generateEmpty:(n,e,t,s="assets")=>{let r={totalAssets:0,copiedAssets:0,hasLogo:!1,hasFavicon:!1,hasManifest:!1,timestamp:new Date().toISOString()};return`// ${M.assets} - Empty asset manifest
120
120
  const assetManifest = {
121
121
  logo: { optimal: null, fallback: null },
122
122
  favicon: { optimal: null, fallback: null },
@@ -215,7 +215,7 @@ export default discoveredAssets;
215
215
  `:`/**
216
216
  * Generated Asset Discovery Results
217
217
  * Generated at: ${new Date().toISOString()}
218
- * Import from '${C.assets}'
218
+ * Import from '${M.assets}'
219
219
  */
220
220
 
221
221
  export const discoveredAssets = ${JSON.stringify(e,null,2)};
@@ -232,7 +232,7 @@ export const assetStats = {
232
232
  };
233
233
 
234
234
  export default discoveredAssets;
235
- `},generateManifest:n=>({assets:n.assets?.length||0,copied:n.copiedAssets?.length||0,timestamp:Date.now(),hasLogo:n.manifest?.logo?.optimal!==null,hasFavicon:n.manifest?.favicon?.optimal!==null}),logConfig:n=>{},logStats:(n,e,t)=>{let s=n.assets?.length||0,r=n.generatedAssets?.length||0;t&&(r>0?t.info(`${e} Assets: ${s} found, ${r} generated`):t.info(`${e} Assets: ${s} found`))}},xs=[n=>n.includes("/public/"),n=>n.endsWith(".png")||n.endsWith(".svg")||n.endsWith(".ico"),n=>n.includes("favicon")||n.includes("logo")||n.includes("manifest")];function yt(n={}){let e=ie({pluginName:"dndev-vite-asset-discovery",icon:"\u{1F3AF}",virtualModuleId:C.assets,DiscoveryClass:Te,discoveryMethod:"discoverAssets",filePatterns:xs,templates:ws,defaultInspectionPath:j.vite.assetInspection,manifestFileName:j.manifests.asset,configKey:"assets"})(n),t=_.getInstance(),s=I("asset-plugin",n.debug,n.verbose),r=e.buildStart;return e.buildStart=async function(...o){r&&await r.apply(this,o);let a=null;try{let i=t.resolveAppPath(j.vite.assetInspection);if(t.pathExists(i)){let l=t.readSync(i,{format:"json"});l&&(a=l,Je.data=a)}}catch(i){s.debug(`Could not cache asset data: ${i.message}`)}},e}import{loadEnv as Ss}from"vite";L();var bt={isEmpty:n=>!n.env||Object.keys(n.env).length===0,generateModule:(n,e,t="env")=>{let{env:s,mode:r}=n;if(!s||Object.keys(s).length===0)return bt.generateEmpty(n,e,void 0,t);let o={totalVars:Object.keys(s).length,mode:r,source:n.source,generatedAt:new Date().toISOString()};return`// ${C.env} - Generated environment variables
235
+ `},generateManifest:n=>({assets:n.assets?.length||0,copied:n.copiedAssets?.length||0,timestamp:Date.now(),hasLogo:n.manifest?.logo?.optimal!==null,hasFavicon:n.manifest?.favicon?.optimal!==null}),logConfig:n=>{},logStats:(n,e,t)=>{let s=n.assets?.length||0,r=n.generatedAssets?.length||0;t&&(r>0?t.info(`${e} Assets: ${s} found, ${r} generated`):t.info(`${e} Assets: ${s} found`))}},xs=[n=>n.includes("/public/"),n=>n.endsWith(".png")||n.endsWith(".svg")||n.endsWith(".ico"),n=>n.includes("favicon")||n.includes("logo")||n.includes("manifest")];function yt(n={}){let e=le({pluginName:"dndev-vite-asset-discovery",icon:"\u{1F3AF}",virtualModuleId:M.assets,DiscoveryClass:Te,discoveryMethod:"discoverAssets",filePatterns:xs,templates:ws,defaultInspectionPath:j.vite.assetInspection,manifestFileName:j.manifests.asset,configKey:"assets"})(n),t=_.getInstance(),s=F("asset-plugin",n.debug,n.verbose),r=e.buildStart;return e.buildStart=async function(...o){r&&await r.apply(this,o);let a=null;try{let i=t.resolveAppPath(j.vite.assetInspection);if(t.pathExists(i)){let l=t.readSync(i,{format:"json"});l&&(a=l,Je.data=a)}}catch(i){s.debug(`Could not cache asset data: ${i.message}`)}},e}import{loadEnv as Ss}from"vite";L();var bt={isEmpty:n=>!n.env||Object.keys(n.env).length===0,generateModule:(n,e,t="env")=>{let{env:s,mode:r}=n;if(!s||Object.keys(s).length===0)return bt.generateEmpty(n,e,void 0,t);let o={totalVars:Object.keys(s).length,mode:r,source:n.source,generatedAt:new Date().toISOString()};return`// ${M.env} - Generated environment variables
236
236
 
237
237
  const envData = ${JSON.stringify(s,null,2)};
238
238
  const envManifest = ${JSON.stringify(o,null,2)};
@@ -272,7 +272,7 @@ export const source = '${n.source}';
272
272
 
273
273
  // Default export
274
274
  export default envData;
275
- `},generateEmpty:(n,e,t,s="env")=>{let r={totalVars:0,mode:n.mode||"development",source:"empty",generatedAt:new Date().toISOString()};return`// ${C.env} - Empty environment data
275
+ `},generateEmpty:(n,e,t,s="env")=>{let r={totalVars:0,mode:n.mode||"development",source:"empty",generatedAt:new Date().toISOString()};return`// ${M.env} - Empty environment data
276
276
 
277
277
  const envData = {};
278
278
  const envManifest = ${JSON.stringify(r,null,2)};
@@ -311,16 +311,16 @@ export const source = 'empty';
311
311
 
312
312
  export default envData;
313
313
  `},generateInspection:n=>{let{env:e,mode:t}=n;return["/**"," * Generated Environment Variables",` * Mode: ${t}`,` * Generated at: ${new Date().toISOString()}`,` * Total variables: ${Object.keys(e).length}`," */","","```json",JSON.stringify(e,null,2),"```"].join(`
314
- `)},generateManifest:n=>({totalVars:Object.keys(n?.env||{}).length,mode:n?.mode||"development",variables:Object.keys(n?.env||{}),timestamp:Date.now()}),logStats:(n,e,t)=>{let s=Object.keys(n.env).length;t&&t.info(`${e} Env: ${s} VITE_* variables`)}},qe=class{constructor(e,t={}){this.pathResolver=e,this.options=t,this.mode=t.mode||"development",this.appRoot=null}async discoverEnv(){try{let e=this.pathResolver.getAppRoot();if(!e)throw new Error("App root not available in EnvDiscovery");let s={...Ss(this.mode,e,"VITE_")};return this.mode==="production"&&(delete s.VITE_USE_FIREBASE_EMULATOR,delete s.VITE_FIREBASE_EMULATOR_HOST,delete s.VITE_FIREBASE_AUTH_EMULATOR_HOST,delete s.VITE_FIREBASE_FIRESTORE_EMULATOR_HOST,delete s.VITE_FIREBASE_FUNCTIONS_EMULATOR_PORT),s.MODE=this.mode,s.DEV=this.mode==="development",s.PROD=this.mode==="production",s.SSR=!1,{env:s,mode:this.mode,source:`${e}/.env`,errors:[]}}catch(e){return{env:{},mode:this.mode,source:"error",errors:[e.message]}}}};function wt(n={}){return ie({pluginName:"dndev-vite-env-discovery",icon:"\u{1F510}",virtualModuleId:C.env,discoveryMethod:"discoverEnv",filePatterns:[],templates:bt,defaultInspectionPath:j.vite.envInspection,manifestFileName:j.manifests.env,configKey:"env",createDiscovery:(e,t)=>new qe(e,{...t,mode:n.mode||t.mode||"development"})})({...n,disableHmr:!0})}L();L();var xt=/--(?:font-family|font-headline)\s*:\s*(?:['"]([^'"]+)['"]|([^;]+?));/g,ge=class{constructor(e,t={}){if(!e)throw new Error("CSSExtractor requires PathResolver instance");this.pathResolver=e,this.options={debug:!1,customPatterns:{},...t},this.logger=t.logger||{debug:(s,...r)=>{this.options.debug}},this.patterns={selectors:{...Ve.selectors,...this.options.customPatterns?.selectors},themes:{...Ve.themes,...this.options.customPatterns?.themes}}}cssVarToJsIdentifier(e){if(!e||typeof e!="string")return this._debug(`Invalid CSS variable: ${e}`),null;let t=e.replace(/^--/,"");if(!t)return this._debug(`Empty CSS variable after removing --: ${e}`),null;let s=t.split("-").filter(a=>a.length>0);if(s.length===0)return this._debug(`No valid parts in CSS variable: ${e}`),null;let r=s.map((a,i)=>{let l=a.replace(/[^a-zA-Z0-9]/g,"");return l?i===0?l.toLowerCase():l.charAt(0).toUpperCase()+l.slice(1).toLowerCase():null}).filter(Boolean).join("");return!r||!/^[a-zA-Z][a-zA-Z0-9]*$/.test(r)?(this._debug(`Invalid JavaScript identifier generated from ${e}: ${r}`),null):["const","let","var","function","class","export","import","default","if","else","for","while"].includes(r)?`${r}Var`:r}_stripComments(e){return e.replace(/\/\*[\s\S]*?\*\//g,"")}extractThemes(e,t,s){let r=[],o,a=this.pathResolver.normalizePath(t),i=this._stripComments(e),l=/(?::root\.|\.)([a-z][a-z0-9-]*)\s*\{([^}]*--theme-label\s*:\s*['"]([^'"]+)['"][^}]*)\}/gim;for(;(o=l.exec(i))!==null;){let[,u,c,p]=o;if(!u||!p)continue;let g=c.match(this.patterns.themes.themeIcon),d=c.match(this.patterns.themes.themeIsDark),m={name:u,displayName:p,isDark:d?d[1]==="1":!1,meta:{icon:g?.[1]},source:this.pathResolver.getBasename(t)};this._debug(`Discovered theme: ${u} (${p})`),r.push(m),s.themes.set(u,{name:u,displayName:p,isDark:m.isDark,file:a,variables:new Set,meta:m.meta})}return r.length>0&&this._debug(`Extracted ${r.length} themes from ${a}`),r}extractClasses(e,t){(e.match(this.patterns.selectors.class)||[]).forEach(r=>{let o=r.slice(1);o.startsWith("_")||t.classes.add(o)})}extractVariables(e,t,s){(e.match(this.patterns.selectors.variable)||[]).forEach(o=>{o.startsWith("--")&&o.length>2?s==="framework"?t.variables.framework.add(o):t.variables.consumer.add(o):this._debug(`Skipping invalid CSS variable: ${o}`)})}extractFontFamilies(e){if(!e||typeof e!="string")return[];let t=this._stripComments(e),s=new Set,r;for(xt.lastIndex=0;(r=xt.exec(t))!==null;){let o=r[1];o&&o.trim()&&s.add(o.trim())}return Array.from(s)}extractKeyframes(e,t){(e.match(this.patterns.selectors.keyframe)||[]).forEach(r=>{let o=r.replace("@keyframes","").trim();o&&t.keyframes.add(o)})}validateCSS(e){let t=[],s=e.match(/--[a-zA-Z0-9-_]*[^a-zA-Z0-9-_:;\s]/g);return s&&s.forEach(o=>{t.push(`Possible malformed CSS variable: ${o}`)}),(e.match(/\.[a-z][a-z0-9-]+\s*\{[^}]*\}/gi)||[]).forEach(o=>{if(!o.includes("--theme-label")&&o.includes("--")){let a=o.match(/\.([a-z][a-z0-9-]+)/)?.[1];a&&t.push(`Theme class "${a}" missing --theme-label`)}}),t}extractAll(e,t,s="consumer"){let r={themes:new Map,classes:new Set,variables:{framework:new Set,consumer:new Set},keyframes:new Set},o=this.extractThemes(e,t,r);this.extractClasses(e,r),this.extractVariables(e,r,s),this.extractKeyframes(e,r);let a=this.validateCSS(e);return{themes:o,classes:Array.from(r.classes),variables:{framework:Array.from(r.variables.framework),consumer:Array.from(r.variables.consumer),all:[...Array.from(r.variables.framework),...Array.from(r.variables.consumer)].sort()},keyframes:Array.from(r.keyframes),warnings:a}}getPatterns(){return{...this.patterns}}setPatterns(e){this.patterns={...this.patterns,...e,selectors:{...this.patterns.selectors,...e.selectors},themes:{...this.patterns.themes,...e.themes}}}_debug(e,t){this.logger.debug(e,t||"")}};B();var Ps=3,Ye="<!-- DNDEV_FONT_PRELOADS -->";function St(n={}){let{debug:e=!1}=n,t=I("font-preload",e,!1),s,r={},o=[],a=[];return{name:"vite-font-preload-plugin",enforce:"post",configResolved(i){r={root:i.root,base:i.base&&i.base!=="/"?i.base.replace(/\/$/,""):"",outDir:i.build?.outDir??"dist"};try{s=_.getInstance()}catch(l){t.debug(`Font preload: PathResolver not ready: ${l?.message}`)}},async buildStart(){if(!(!s||!s.getAppRoot()))try{let l=await s.resolvePatterns("css"),{consumerFiles:u}=await s.resolveFiles(l,"css");if(!u?.length){o=[Se.Inter],t.debug("Font preload: no consumer CSS, using default Inter");return}let c=new ge(s,{debug:e,logger:t}),p=new Set;for(let d of u)try{let m=await s.read(d,{format:"text"});m&&c.extractFontFamilies(m).forEach(T=>p.add(T))}catch(m){t.debug(`Font preload: skip read ${d}: ${m?.message}`)}if(p.size===0){o=[Se.Inter],t.debug("Font preload: no font families in CSS, using default Inter");return}let g=new Set;for(let d of p){let m=Se[d];m&&g.add(m)}o=Array.from(g),t.debug(`Font preload: stems ${o.join(", ")} from CSS`)}catch(l){t.debug(`Font preload: discovery failed, use Inter: ${l?.message}`),o=[Se.Inter]}},generateBundle(i,l){if(!o.length)return;let u=r.base||"",c=[];for(let[p,g]of Object.entries(l)){if(g.type!=="asset"||!p.endsWith(".woff2")&&!p.endsWith(".woff"))continue;let d=p.toLowerCase();if(o.some(k=>d.includes(k))){let k=u?`${u}/${p}`:`/${p}`;c.push(k)}}a=c.slice(0,Ps)},writeBundle(){if(!a.length)return;let i=s||_.getInstance(),l=r.root||process.cwd(),u=r.outDir||"dist",c=i.resolvePath(`${u}/index.html`,l);try{if(!i.pathExists(c)){t.debug(`Font preload: index.html not found at ${c}`);return}let p=i.readSync(c,{format:"text"}),g=a.map(d=>`<link rel="preload" as="font" href="${d}" type="font/woff2" crossorigin="anonymous" />`).join(`
314
+ `)},generateManifest:n=>({totalVars:Object.keys(n?.env||{}).length,mode:n?.mode||"development",variables:Object.keys(n?.env||{}),timestamp:Date.now()}),logStats:(n,e,t)=>{let s=Object.keys(n.env).length;t&&t.info(`${e} Env: ${s} VITE_* variables`)}},qe=class{constructor(e,t={}){this.pathResolver=e,this.options=t,this.mode=t.mode||"development",this.appRoot=null}async discoverEnv(){try{let e=this.pathResolver.getAppRoot();if(!e)throw new Error("App root not available in EnvDiscovery");let s={...Ss(this.mode,e,"VITE_")};return this.mode==="production"&&(delete s.VITE_USE_FIREBASE_EMULATOR,delete s.VITE_FIREBASE_EMULATOR_HOST,delete s.VITE_FIREBASE_AUTH_EMULATOR_HOST,delete s.VITE_FIREBASE_FIRESTORE_EMULATOR_HOST,delete s.VITE_FIREBASE_FUNCTIONS_EMULATOR_PORT),s.MODE=this.mode,s.DEV=this.mode==="development",s.PROD=this.mode==="production",s.SSR=!1,{env:s,mode:this.mode,source:`${e}/.env`,errors:[]}}catch(e){return{env:{},mode:this.mode,source:"error",errors:[e.message]}}}};function wt(n={}){return le({pluginName:"dndev-vite-env-discovery",icon:"\u{1F510}",virtualModuleId:M.env,discoveryMethod:"discoverEnv",filePatterns:[],templates:bt,defaultInspectionPath:j.vite.envInspection,manifestFileName:j.manifests.env,configKey:"env",createDiscovery:(e,t)=>new qe(e,{...t,mode:n.mode||t.mode||"development"})})({...n,disableHmr:!0})}L();L();var xt=/--(?:font-family|font-headline)\s*:\s*(?:['"]([^'"]+)['"]|([^;]+?));/g,de=class{constructor(e,t={}){if(!e)throw new Error("CSSExtractor requires PathResolver instance");this.pathResolver=e,this.options={debug:!1,customPatterns:{},...t},this.logger=t.logger||{debug:(s,...r)=>{this.options.debug}},this.patterns={selectors:{...Ve.selectors,...this.options.customPatterns?.selectors},themes:{...Ve.themes,...this.options.customPatterns?.themes}}}cssVarToJsIdentifier(e){if(!e||typeof e!="string")return this._debug(`Invalid CSS variable: ${e}`),null;let t=e.replace(/^--/,"");if(!t)return this._debug(`Empty CSS variable after removing --: ${e}`),null;let s=t.split("-").filter(a=>a.length>0);if(s.length===0)return this._debug(`No valid parts in CSS variable: ${e}`),null;let r=s.map((a,i)=>{let l=a.replace(/[^a-zA-Z0-9]/g,"");return l?i===0?l.toLowerCase():l.charAt(0).toUpperCase()+l.slice(1).toLowerCase():null}).filter(Boolean).join("");return!r||!/^[a-zA-Z][a-zA-Z0-9]*$/.test(r)?(this._debug(`Invalid JavaScript identifier generated from ${e}: ${r}`),null):["const","let","var","function","class","export","import","default","if","else","for","while"].includes(r)?`${r}Var`:r}_stripComments(e){return e.replace(/\/\*[\s\S]*?\*\//g,"")}extractThemes(e,t,s){let r=[],o,a=this.pathResolver.normalizePath(t),i=this._stripComments(e),l=/(?::root\.|\.)([a-z][a-z0-9-]*)\s*\{([^}]*--theme-label\s*:\s*['"]([^'"]+)['"][^}]*)\}/gim;for(;(o=l.exec(i))!==null;){let[,u,c,p]=o;if(!u||!p)continue;let g=c.match(this.patterns.themes.themeIcon),d=c.match(this.patterns.themes.themeIsDark),m={name:u,displayName:p,isDark:d?d[1]==="1":!1,meta:{icon:g?.[1]},source:this.pathResolver.getBasename(t)};this._debug(`Discovered theme: ${u} (${p})`),r.push(m),s.themes.set(u,{name:u,displayName:p,isDark:m.isDark,file:a,variables:new Set,meta:m.meta})}return r.length>0&&this._debug(`Extracted ${r.length} themes from ${a}`),r}extractClasses(e,t){(e.match(this.patterns.selectors.class)||[]).forEach(r=>{let o=r.slice(1);o.startsWith("_")||t.classes.add(o)})}extractVariables(e,t,s){(e.match(this.patterns.selectors.variable)||[]).forEach(o=>{o.startsWith("--")&&o.length>2?s==="framework"?t.variables.framework.add(o):t.variables.consumer.add(o):this._debug(`Skipping invalid CSS variable: ${o}`)})}extractFontFamilies(e){if(!e||typeof e!="string")return[];let t=this._stripComments(e),s=new Set,r;for(xt.lastIndex=0;(r=xt.exec(t))!==null;){let o=r[1];o&&o.trim()&&s.add(o.trim())}return Array.from(s)}extractKeyframes(e,t){(e.match(this.patterns.selectors.keyframe)||[]).forEach(r=>{let o=r.replace("@keyframes","").trim();o&&t.keyframes.add(o)})}validateCSS(e){let t=[],s=e.match(/--[a-zA-Z0-9-_]*[^a-zA-Z0-9-_:;\s]/g);return s&&s.forEach(o=>{t.push(`Possible malformed CSS variable: ${o}`)}),(e.match(/\.[a-z][a-z0-9-]+\s*\{[^}]*\}/gi)||[]).forEach(o=>{if(!o.includes("--theme-label")&&o.includes("--")){let a=o.match(/\.([a-z][a-z0-9-]+)/)?.[1];a&&t.push(`Theme class "${a}" missing --theme-label`)}}),t}extractAll(e,t,s="consumer"){let r={themes:new Map,classes:new Set,variables:{framework:new Set,consumer:new Set},keyframes:new Set},o=this.extractThemes(e,t,r);this.extractClasses(e,r),this.extractVariables(e,r,s),this.extractKeyframes(e,r);let a=this.validateCSS(e);return{themes:o,classes:Array.from(r.classes),variables:{framework:Array.from(r.variables.framework),consumer:Array.from(r.variables.consumer),all:[...Array.from(r.variables.framework),...Array.from(r.variables.consumer)].sort()},keyframes:Array.from(r.keyframes),warnings:a}}getPatterns(){return{...this.patterns}}setPatterns(e){this.patterns={...this.patterns,...e,selectors:{...this.patterns.selectors,...e.selectors},themes:{...this.patterns.themes,...e.themes}}}_debug(e,t){this.logger.debug(e,t||"")}};B();var Ps=3,Ye="<!-- DNDEV_FONT_PRELOADS -->";function St(n={}){let{debug:e=!1}=n,t=F("font-preload",e,!1),s,r={},o=[],a=[];return{name:"vite-font-preload-plugin",enforce:"post",configResolved(i){r={root:i.root,base:i.base&&i.base!=="/"?i.base.replace(/\/$/,""):"",outDir:i.build?.outDir??"dist"};try{s=_.getInstance()}catch(l){t.debug(`Font preload: PathResolver not ready: ${l?.message}`)}},async buildStart(){if(!(!s||!s.getAppRoot()))try{let l=await s.resolvePatterns("css"),{consumerFiles:u}=await s.resolveFiles(l,"css");if(!u?.length){o=[Se.Inter],t.debug("Font preload: no consumer CSS, using default Inter");return}let c=new de(s,{debug:e,logger:t}),p=new Set;for(let d of u)try{let m=await s.read(d,{format:"text"});m&&c.extractFontFamilies(m).forEach(O=>p.add(O))}catch(m){t.debug(`Font preload: skip read ${d}: ${m?.message}`)}if(p.size===0){o=[Se.Inter],t.debug("Font preload: no font families in CSS, using default Inter");return}let g=new Set;for(let d of p){let m=Se[d];m&&g.add(m)}o=Array.from(g),t.debug(`Font preload: stems ${o.join(", ")} from CSS`)}catch(l){t.debug(`Font preload: discovery failed, use Inter: ${l?.message}`),o=[Se.Inter]}},generateBundle(i,l){if(!o.length)return;let u=r.base||"",c=[];for(let[p,g]of Object.entries(l)){if(g.type!=="asset"||!p.endsWith(".woff2")&&!p.endsWith(".woff"))continue;let d=p.toLowerCase();if(o.some(k=>d.includes(k))){let k=u?`${u}/${p}`:`/${p}`;c.push(k)}}a=c.slice(0,Ps)},writeBundle(){if(!a.length)return;let i=s||_.getInstance(),l=r.root||process.cwd(),u=r.outDir||"dist",c=i.resolvePath(`${u}/index.html`,l);try{if(!i.pathExists(c)){t.debug(`Font preload: index.html not found at ${c}`);return}let p=i.readSync(c,{format:"text"}),g=a.map(d=>`<link rel="preload" as="font" href="${d}" type="font/woff2" crossorigin="anonymous" />`).join(`
315
315
  `);if(p.includes(Ye))p=p.replace(Ye,`${Ye}
316
316
  ${g}`);else{let d=p.indexOf("<!-- Fonts:"),m=d!==-1?p.indexOf("-->",d)+3:p.indexOf("</head>");m!==-1&&(p=p.slice(0,m)+`
317
- ${g}`+p.slice(m))}i.writeSync(c,p,{overwrite:!0}),t.debug(`Font preload: injected ${a.length} link(s)`)}catch(p){t.debug(`Font preload: write failed: ${p?.message}`)}}}}L();L();var Pe=class extends te{constructor(e,t={}){super(e,{fallbackLanguage:"en",additionalPaths:[],...t})}_getDiscoveryType(){return"I18n"}async _getPatterns(){return await this.pathResolver.resolvePatterns("i18n")}_getPatternType(){return"i18n"}async _processFiles(e){let t=this.pathResolver.getAppRoot(),s=this.pathResolver.getRepoRoot();if(!t||t===s)throw this.logger.error(`I18n discovery: appRoot not properly set (appRoot: ${t}, repoRoot: ${s})`),new Error("App root not set before i18n discovery. Ensure configResolved hook has run.");this.logger.debug(`I18n discovery: appRoot=${t}, repoRoot=${s}`);let r=await this._getPatterns();this.logger.debug(`I18n patterns - eager: ${r.eager.length}, lazy: ${r.lazy.length}, framework eager: ${r.framework?.eager?.length||0}, framework lazy: ${r.framework?.lazy?.length||0}`),this.logger.debug(`isMonorepo: ${this.pathResolver.isMonorepo()}, repoRoot: ${this.pathResolver.getRepoRoot()}`);let o=Ne("i18n"),a=r.eager||[],i=r.lazy||[],l=(this.options.additionalPaths||[]).map(D=>{let A=D.endsWith(".json")?D:`${D}/*_*.json`;return this.pathResolver.resolveAppPath(A)});l.length>0&&this.logger.debug(`Additional i18n paths configured: ${l.join(", ")}`);let u=r.framework?.eager||[],c=r.framework?.lazy||[];this.logger.debug(`Resolved patterns - eager: ${a.join(", ")}, lazy: ${i.join(", ")}, framework eager: ${u.join(", ")}, framework lazy: ${c.join(", ")}`),u.length===0&&c.length===0&&this.logger.error(`\u26A0\uFE0F Framework i18n patterns are EMPTY! isMonorepo=${this.pathResolver.isMonorepo()}, repoRoot=${this.pathResolver.getRepoRoot()}`);let p=this.pathResolver.normalizePath(t),g=this.pathResolver.normalizePath(s),d=(D,A)=>{let N=this.pathResolver.normalizePath(D),z=this.pathResolver.normalizePath(A);return N.startsWith(z)?N.slice(z.length+1):N},m=a.map(D=>d(D,t)),T=[...i,...l].map(D=>d(D,t)),v=u.map(D=>d(D,s)),$=c.map(D=>d(D,s)),R={...o,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:t},y=await this.pathResolver._globWithNormalization(m,R),S=await this.pathResolver._globWithNormalization(T,R),h={...o,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:s,ignore:o.ignore?.filter(D=>D!=="**/node_modules/**")||[]};this.logger.debug(`\u{1F50D} Searching framework patterns with cwd: ${s}, ignore: ${JSON.stringify(h.ignore)}`);let O=await this.pathResolver._globWithNormalization(v,h),F=await this.pathResolver._globWithNormalization($,h);this.logger.debug(`Found ${y.length} eager, ${S.length} lazy, ${O.length} framework eager, ${F.length} framework lazy files`),O.length>0?this.logger.debug(`Framework eager files (first 3): ${O.slice(0,3).join(", ")}`):this.logger.error(`\u274C NO framework eager files found! Patterns were: ${u.join(", ")}`),F.length>0?this.logger.debug(`Framework lazy files (first 3): ${F.slice(0,3).join(", ")}`):this.logger.error(`\u274C NO framework lazy files found! Patterns were: ${c.join(", ")}`);let K=[...new Set([...y,...S,...O,...F])],P=new Set([...y,...O]),x={mapping:{},content:{},eagerNamespaces:new Set,allNamespaces:new Set,supportedLanguages:new Set,files:[]},W=new Map,be=[...O,...F];for(let D of be){let A=this._processTranslationFile(D,O.includes(D),t);if(A){let N=`${A.namespace}_${A.language}`;W.set(N,A),x.allNamespaces.add(A.namespace),x.supportedLanguages.add(A.language),O.includes(D)&&x.eagerNamespaces.add(A.namespace)}}let Z=new Set;for(let D of K){if(be.includes(D))continue;let A=this._processTranslationFile(D,P.has(D),t);if(A){let{namespace:N,language:z,importPath:de,content:G}=A,le=`${A.namespace}_${A.language}`;if(W.has(le)){let ce=W.get(le);A.content=this._mergeTranslations(ce.content,G)}x.allNamespaces.add(N),x.supportedLanguages.add(z),Z.add(z),P.has(D)&&x.eagerNamespaces.add(N),x.mapping[N]||(x.mapping[N]={}),x.mapping[N][z]=de,A.content&&(x.content[N]||(x.content[N]={}),x.content[N][z]=A.content),x.files.push({path:D,relativePath:this.pathResolver.getRelativePath(D),namespace:N,language:z,eager:P.has(D),size:A.content?JSON.stringify(A.content).length:0})}}for(let[D,A]of W){let[N,z]=D.split("_");(!x.mapping[N]||!x.mapping[N][z])&&(x.mapping[N]||(x.mapping[N]={}),x.mapping[N][z]=A.importPath,x.content[N]||(x.content[N]={}),x.content[N][z]=A.content,x.files.push({path:A.absolutePath,relativePath:this.pathResolver.getRelativePath(A.absolutePath),namespace:N,language:z,eager:x.eagerNamespaces.has(N),size:A.content?JSON.stringify(A.content).length:0}))}let oe=Z.size>0?[...Z].sort():[this.options.fallbackLanguage];return{mapping:x.mapping,content:x.content,eagerNamespaces:[...x.eagerNamespaces].sort(),allNamespaces:[...x.allNamespaces].sort(),supportedLanguages:oe,fallbackLanguage:this.options.fallbackLanguage,files:x.files}}_getEmptyResult(){return{mapping:{},content:{},eagerNamespaces:[],allNamespaces:["common"],supportedLanguages:[this.options.fallbackLanguage],fallbackLanguage:this.options.fallbackLanguage,files:[],timestamp:Date.now()}}_getDiscoverySummary(){return`${this.cache?.allNamespaces?.length||0} namespaces, ${this.cache?.supportedLanguages?.length||0} languages`}async discover(e=!1){if(!e&&this._isCacheValid())return this.logger.debug("Using cached results"),this.cache;let t=Date.now();try{let s=await this._processFiles([]);this.cache={...s,timestamp:Date.now()};let r=Date.now()-t;return this.logger.debug(`Discovery completed in ${r}ms`),this._lastDiscoveryTime=Date.now(),this.cache}catch(s){throw this.logger.error(`I18n discovery failed: ${s.message}`),s}}async discoverTranslations(e=!1){return await this.discover(e)}getMapping(){return this.cache?.mapping||{}}getLanguages(){return this.cache?.supportedLanguages||[this.options.fallbackLanguage]}getNamespaces(){return this.cache?.allNamespaces||["common"]}getEagerNamespaces(){return this.cache?.eagerNamespaces||[]}_processTranslationFile(e,t,s){let r=e.split("/").pop()||e.split("\\").pop()||"",o,a,i=r.match(/^([^_]+)_([^.]+)\.json$/);if(!i)return this.logger.debug(`Invalid translation file name format: ${r}`),null;if([,o,a]=i,!o||!a)return this.logger.debug(`Invalid namespace or language in file: ${r}`),null;let u="./"+this.pathResolver.getRelativePath(e).replace(/\\/g,"/"),c;try{if(c=this.pathResolver.readSync(e,{format:"json"}),!c)return this.logger.debug(`Could not read file: ${e}`),null}catch(p){return this.logger.debug(`Error parsing JSON from ${e}: ${p.message}`),null}return{namespace:o,language:a,importPath:u,absolutePath:e,content:c}}_mergeTranslations(e,t){let s={...e};for(let[r,o]of Object.entries(t))typeof o=="object"&&o!==null&&!Array.isArray(o)?s[r]=this._mergeTranslations(s[r]||{},o):s[r]=o;return s}};B();var Pt={isEmpty:n=>!n.mapping||Object.keys(n.mapping).length===0,generateModule:(n,e,t="i18n",s=!1)=>{let{mapping:r,eagerNamespaces:o,supportedLanguages:a,fallbackLanguage:i,stats:l,content:u={},files:c=[]}=n,p=s?Object.keys(u):o,g={};for(let v of p)u[v]&&(g[v]=u[v]);let d=[...new Set([...o,...Object.keys(u)])],m={mapping:r,languages:a,eager:s?d:o,fallback:i,content:g,storage:{type:"localStorage",prefix:"dndev_i18n_",ttl:1440*60*1e3,encryption:!1,maxSize:5*1024*1024},performance:{cacheSize:1e3,errorCacheTTL:300*1e3},manifest:{totalFiles:l?.totalFiles||0,totalNamespaces:l?.totalNamespaces||0,totalLanguages:l?.totalLanguages||0,eagerNamespaces:l?.eagerNamespaces||0,generatedAt:new Date().toISOString()},debug:e},k=[];if(!s)for(let[v,$]of Object.entries(r)){if(o.includes(v))continue;let R=[];for(let y of Object.keys($))R.push(` '${y}': () => import('virtual:i18n-lazy-${v}-${y}')`);R.length>0&&k.push(` '${v}': {
317
+ ${g}`+p.slice(m))}i.writeSync(c,p,{overwrite:!0}),t.debug(`Font preload: injected ${a.length} link(s)`)}catch(p){t.debug(`Font preload: write failed: ${p?.message}`)}}}}L();L();var Pe=class extends se{constructor(e,t={}){super(e,{fallbackLanguage:"en",additionalPaths:[],...t})}_getDiscoveryType(){return"I18n"}async _getPatterns(){return await this.pathResolver.resolvePatterns("i18n")}_getPatternType(){return"i18n"}async _processFiles(e){let t=this.pathResolver.getAppRoot(),s=this.pathResolver.getRepoRoot();if(!t||t===s)throw this.logger.error(`I18n discovery: appRoot not properly set (appRoot: ${t}, repoRoot: ${s})`),new Error("App root not set before i18n discovery. Ensure configResolved hook has run.");this.logger.debug(`I18n discovery: appRoot=${t}, repoRoot=${s}`);let r=await this._getPatterns();this.logger.debug(`I18n patterns - eager: ${r.eager.length}, lazy: ${r.lazy.length}, framework eager: ${r.framework?.eager?.length||0}, framework lazy: ${r.framework?.lazy?.length||0}`),this.logger.debug(`isMonorepo: ${this.pathResolver.isMonorepo()}, repoRoot: ${this.pathResolver.getRepoRoot()}`);let o=Ne("i18n"),a=r.eager||[],i=r.lazy||[],l=(this.options.additionalPaths||[]).map($=>{let A=$.endsWith(".json")?$:`${$}/*_*.json`;return this.pathResolver.resolveAppPath(A)});l.length>0&&this.logger.debug(`Additional i18n paths configured: ${l.join(", ")}`);let u=r.framework?.eager||[],c=r.framework?.lazy||[];this.logger.debug(`Resolved patterns - eager: ${a.join(", ")}, lazy: ${i.join(", ")}, framework eager: ${u.join(", ")}, framework lazy: ${c.join(", ")}`),u.length===0&&c.length===0&&this.logger.error(`\u26A0\uFE0F Framework i18n patterns are EMPTY! isMonorepo=${this.pathResolver.isMonorepo()}, repoRoot=${this.pathResolver.getRepoRoot()}`);let p=this.pathResolver.normalizePath(t),g=this.pathResolver.normalizePath(s),d=($,A)=>{let C=this.pathResolver.normalizePath($),I=this.pathResolver.normalizePath(A);return C.startsWith(I)?C.slice(I.length+1):C},m=a.map($=>d($,t)),O=[...i,...l].map($=>d($,t)),v=u.map($=>d($,s)),D=c.map($=>d($,s)),R={...o,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:t},y=await this.pathResolver._globWithNormalization(m,R),S=await this.pathResolver._globWithNormalization(O,R),h={...o,onlyFiles:!0,absolute:!0,braceExpansion:!0,extglob:!0,globstar:!0,cwd:s,ignore:o.ignore?.filter($=>$!=="**/node_modules/**")||[]};this.logger.debug(`\u{1F50D} Searching framework patterns with cwd: ${s}, ignore: ${JSON.stringify(h.ignore)}`);let N=await this.pathResolver._globWithNormalization(v,h),T=await this.pathResolver._globWithNormalization(D,h);this.logger.debug(`Found ${y.length} eager, ${S.length} lazy, ${N.length} framework eager, ${T.length} framework lazy files`),N.length>0?this.logger.debug(`Framework eager files (first 3): ${N.slice(0,3).join(", ")}`):this.logger.error(`\u274C NO framework eager files found! Patterns were: ${u.join(", ")}`),T.length>0?this.logger.debug(`Framework lazy files (first 3): ${T.slice(0,3).join(", ")}`):this.logger.error(`\u274C NO framework lazy files found! Patterns were: ${c.join(", ")}`);let K=[...new Set([...y,...S,...N,...T])],P=new Set([...y,...N]),x={mapping:{},content:{},eagerNamespaces:new Set,allNamespaces:new Set,supportedLanguages:new Set,files:[]},W=new Map,be=[...N,...T];for(let $ of be){let A=this._processTranslationFile($,N.includes($),t);if(A){let C=`${A.namespace}_${A.language}`;W.set(C,A),x.allNamespaces.add(A.namespace),x.supportedLanguages.add(A.language),N.includes($)&&x.eagerNamespaces.add(A.namespace)}}let Z=new Set;for(let $ of K){if(be.includes($))continue;let A=this._processTranslationFile($,P.has($),t);if(A){let{namespace:C,language:I,importPath:X,content:G}=A,ce=`${A.namespace}_${A.language}`;if(W.has(ce)){let ue=W.get(ce);A.content=this._mergeTranslations(ue.content,G)}x.allNamespaces.add(C),x.supportedLanguages.add(I),Z.add(I),P.has($)&&x.eagerNamespaces.add(C),x.mapping[C]||(x.mapping[C]={}),x.mapping[C][I]=X,A.content&&(x.content[C]||(x.content[C]={}),x.content[C][I]=A.content),x.files.push({path:$,relativePath:this.pathResolver.getRelativePath($),namespace:C,language:I,eager:P.has($),size:A.content?JSON.stringify(A.content).length:0})}}for(let[$,A]of W){let C=$.lastIndexOf("_"),I=$.slice(0,C),X=$.slice(C+1);(!x.mapping[I]||!x.mapping[I][X])&&(x.mapping[I]||(x.mapping[I]={}),x.mapping[I][X]=A.importPath,x.content[I]||(x.content[I]={}),x.content[I][X]=A.content,x.files.push({path:A.absolutePath,relativePath:this.pathResolver.getRelativePath(A.absolutePath),namespace:I,language:X,eager:x.eagerNamespaces.has(I),size:A.content?JSON.stringify(A.content).length:0}))}let ne=Z.size>0?[...Z].sort():[this.options.fallbackLanguage];return{mapping:x.mapping,content:x.content,eagerNamespaces:[...x.eagerNamespaces].sort(),allNamespaces:[...x.allNamespaces].sort(),supportedLanguages:ne,fallbackLanguage:this.options.fallbackLanguage,files:x.files}}_getEmptyResult(){return{mapping:{},content:{},eagerNamespaces:[],allNamespaces:["common"],supportedLanguages:[this.options.fallbackLanguage],fallbackLanguage:this.options.fallbackLanguage,files:[],timestamp:Date.now()}}_getDiscoverySummary(){return`${this.cache?.allNamespaces?.length||0} namespaces, ${this.cache?.supportedLanguages?.length||0} languages`}async discover(e=!1){if(!e&&this._isCacheValid())return this.logger.debug("Using cached results"),this.cache;let t=Date.now();try{let s=await this._processFiles([]);this.cache={...s,timestamp:Date.now()};let r=Date.now()-t;return this.logger.debug(`Discovery completed in ${r}ms`),this._lastDiscoveryTime=Date.now(),this.cache}catch(s){throw this.logger.error(`I18n discovery failed: ${s.message}`),s}}async discoverTranslations(e=!1){return await this.discover(e)}getMapping(){return this.cache?.mapping||{}}getLanguages(){return this.cache?.supportedLanguages||[this.options.fallbackLanguage]}getNamespaces(){return this.cache?.allNamespaces||["common"]}getEagerNamespaces(){return this.cache?.eagerNamespaces||[]}_processTranslationFile(e,t,s){let r=e.split("/").pop()||e.split("\\").pop()||"",o,a,i=r.match(/^([^_]+)_([^.]+)\.json$/);if(!i)return this.logger.debug(`Invalid translation file name format: ${r}`),null;if([,o,a]=i,!o||!a)return this.logger.debug(`Invalid namespace or language in file: ${r}`),null;let u="./"+this.pathResolver.getRelativePath(e).replace(/\\/g,"/"),c;try{if(c=this.pathResolver.readSync(e,{format:"json"}),!c)return this.logger.debug(`Could not read file: ${e}`),null}catch(p){return this.logger.debug(`Error parsing JSON from ${e}: ${p.message}`),null}return{namespace:o,language:a,importPath:u,absolutePath:e,content:c}}_mergeTranslations(e,t){let s={...e};for(let[r,o]of Object.entries(t))typeof o=="object"&&o!==null&&!Array.isArray(o)?s[r]=this._mergeTranslations(s[r]||{},o):s[r]=o;return s}};B();var Pt={isEmpty:n=>!n.mapping||Object.keys(n.mapping).length===0,generateModule:(n,e,t="i18n",s=!1)=>{let{mapping:r,eagerNamespaces:o,supportedLanguages:a,fallbackLanguage:i,stats:l,content:u={},files:c=[]}=n,p=s?Object.keys(u):o,g={};for(let v of p)u[v]&&(g[v]=u[v]);let d=[...new Set([...o,...Object.keys(u)])],m={mapping:r,languages:a,eager:s?d:o,fallback:i,content:g,storage:{type:"localStorage",prefix:"dndev_i18n_",ttl:1440*60*1e3,encryption:!1,maxSize:5*1024*1024},performance:{cacheSize:1e3,errorCacheTTL:300*1e3},manifest:{totalFiles:l?.totalFiles||0,totalNamespaces:l?.totalNamespaces||0,totalLanguages:l?.totalLanguages||0,eagerNamespaces:l?.eagerNamespaces||0,generatedAt:new Date().toISOString()},debug:e},k=[];if(!s)for(let[v,D]of Object.entries(r)){if(o.includes(v))continue;let R=[];for(let y of Object.keys(D))R.push(` '${y}': () => import('virtual:i18n-lazy-${v}-${y}')`);R.length>0&&k.push(` '${v}': {
318
318
  ${R.join(`,
319
319
  `)}
320
- }`)}let T=k.length>0?`{
320
+ }`)}let O=k.length>0?`{
321
321
  ${k.join(`,
322
322
  `)}
323
- }`:"{}";return`// ${C.i18n} - Generated by @donotdev/config
323
+ }`:"{}";return`// ${M.i18n} - Generated by @donotdev/config
324
324
  // Generated at: ${new Date().toISOString()}
325
325
 
326
326
  // ===== STATIC EXPORTS =====
@@ -333,7 +333,7 @@ const i18nPluginConfig = I18N_CONFIG;
333
333
 
334
334
  // ===== LAZY LOADERS =====
335
335
  // Static import() calls \u2014 Vite bundles each JSON as a separate async chunk
336
- const _lazyLoaders = ${T};
336
+ const _lazyLoaders = ${O};
337
337
 
338
338
  // ============================================================================
339
339
  // INITIALIZE DnDev CONFIG FOUNDATION
@@ -445,7 +445,7 @@ export default {
445
445
  getInlineContent,
446
446
  };
447
447
 
448
- `},generateEmpty:(n,e,t,s="i18n")=>{let r=t.fallbackLanguage||"en",o={mapping:{},languages:[r],eager:[],fallback:r,content:{},storage:{type:"localStorage",prefix:"dndev_i18n_",ttl:1440*60*1e3,encryption:!1,maxSize:5*1024*1024},performance:{cacheSize:1e3,errorCacheTTL:300*1e3},manifest:{totalFiles:0,totalNamespaces:0,totalLanguages:1,eagerNamespaces:0,generatedAt:new Date().toISOString()},debug:e};return`// ${C.i18n} - Empty i18n configuration
448
+ `},generateEmpty:(n,e,t,s="i18n")=>{let r=t.fallbackLanguage||"en",o={mapping:{},languages:[r],eager:[],fallback:r,content:{},storage:{type:"localStorage",prefix:"dndev_i18n_",ttl:1440*60*1e3,encryption:!1,maxSize:5*1024*1024},performance:{cacheSize:1e3,errorCacheTTL:300*1e3},manifest:{totalFiles:0,totalNamespaces:0,totalLanguages:1,eagerNamespaces:0,generatedAt:new Date().toISOString()},debug:e};return`// ${M.i18n} - Empty i18n configuration
449
449
  // No translation files found - using fallback configuration
450
450
  // Generated at: ${new Date().toISOString()}
451
451
 
@@ -565,7 +565,7 @@ export default {
565
565
  files: translationFiles,
566
566
  manifest: i18nManifest,
567
567
  };
568
- `},generateManifest:n=>({namespaces:n.stats?.totalNamespaces||0,languages:n.stats?.totalLanguages||0,fallbackLanguage:n.fallbackLanguage,eagerNamespaces:n.stats?.eagerNamespaces||0,platform:"vite",timestamp:Date.now()}),logConfig:n=>{},logStats:(n,e,t)=>{let s=n.supportedLanguages||[],r=Object.keys(n.mapping||{}).filter(o=>o!=="default").length||0;t&&t.info(`${e} I18n: ${s.length} languages, ${r} namespaces`)}},Es=[n=>n.endsWith(".json")&&n.includes("locale"),n=>/[a-z]+_[a-z]{2}\.json$/i.test(n),n=>n.includes("/locales/")&&n.endsWith(".json")];function Et(n={}){let e=!1,t=new Map,s=_.getInstance(),r={...ye.discovery,fallbackLanguage:n.fallbackLanguage||"en",...n},o=new Pe(s,r);function a(c){t.clear();let{content:p,eagerNamespaces:g}=c;for(let[d,m]of Object.entries(p||{}))if(!g.includes(d))for(let[k,T]of Object.entries(m))t.set(`virtual:i18n-lazy-${d}-${k}`,T)}let i={...Pt,generateModule:(c,p,g)=>(e||a(c),Pt.generateModule(c,p,g,e))};return[ie({pluginName:"dndev-vite-i18n-discovery",icon:"\u{1F310}",virtualModuleId:C.i18n,DiscoveryClass:Pe,discoveryMethod:"discoverTranslations",filePatterns:Es,templates:i,defaultInspectionPath:j.vite.i18nInspection,manifestFileName:j.manifests.i18n,configKey:"i18n",discoveryOptions:r})({...n,hmrSmartDetection:!1}),{name:"dndev-i18n-lazy-loader",enforce:"pre",configResolved(c){e=c.command==="serve"},async buildStart(){if(e)return;let c=()=>{let d=s.getAppRoot(),m=s.getRepoRoot();return d&&d!==m},p=0;for(;!c()&&p<100;)await new Promise(d=>setTimeout(d,10)),p++;if(!c())return;let g=await o.discoverTranslations();a(g)},resolveId(c){if(!e&&c.startsWith("virtual:i18n-lazy-"))return"\0"+c},load(c){if(!e&&c.startsWith("\0virtual:i18n-lazy-")){let p=c.slice(1),g=t.get(p);return`export default ${JSON.stringify(g||{})};`}}}]}B();B();L();function Rs(n){if(!n)return[];let e=_.getInstance(),t=new Set;try{let s=e.resolvePackage("@donotdev/core",n);if(!s)return[];let r=e.getDirname(e.getDirname(s)),o;try{o=e.readdirSync(r)}catch{return[]}for(let a of o)try{let i=e.resolvePath(`${a}/package.json`,r),l=e.readSync(i,{format:"json"});if(!l?.peerDependenciesMeta)continue;for(let[u,c]of Object.entries(l.peerDependenciesMeta))c?.optional&&t.add(u)}catch{}}catch{}return Array.from(t)}function _s(n){if(!n)return[];let e=_.getInstance();try{let t=e.resolvePath("package.json",n),s=e.readSync(t,{format:"json"});if(!s)return[];let r=new Set;if(s.peerDependenciesMeta)for(let[o,a]of Object.entries(s.peerDependenciesMeta))a?.optional&&r.add(o);if(s.optionalDependencies)for(let o of Object.keys(s.optionalDependencies))r.add(o);return Array.from(r)}catch{return[]}}function $s(n){let e=me.optionalFeatures||[],t=Rs(n),s=_s(n);return[...new Set([...e,...t,...s])]}function Ds(n){let e=_.getInstance();try{let t=e.resolvePath("package.json",n),s=e.readSync(t,{format:"json"});return s?new Set([...Object.keys(s.dependencies||{}),...Object.keys(s.devDependencies||{})]):new Set}catch{return new Set}}function ks(n,e,t){if(t.resolvePackage(n,e||void 0))return!0;let s=n.startsWith("@")?n.split("/").slice(0,2).join("/"):n.split("/")[0],r=e;for(let o=0;o<10;o++){let a=t.resolvePath(`node_modules/${s}`,r);if(t.pathExists(a))return!0;let i=t.getDirname(r);if(i===r)break;r=i}return!1}function Rt(n){let e=$s(n),t=[],s=[],r=_.getInstance(),o=Ds(n);for(let a of e)a.startsWith("@donotdev/")?o.has(a)?s.push(a):t.push(a):ks(a,n,r)?s.push(a):t.push(a);return{missing:t,installed:s}}function _t(n,e){return e.some(t=>n===t||n.startsWith(t+"/"))}function $t(n={}){let e=[],t="",s="";return{name:"dndev-optional-dep-resolver",enforce:"pre",config(r){let o={name:"dndev-optional-dep-esbuild",setup(i){i.onResolve({filter:/^[@a-z]/,namespace:"file"},l=>_t(l.path,e)?{path:s,external:!1}:null)}};return{optimizeDeps:{esbuildOptions:{plugins:[...r.optimizeDeps?.esbuildOptions?.plugins||[],o]}}}},configResolved(r){let o=_.getInstance(),a=o.getAppRoot();if(e=Rt(a).missing,t=o.getEmptyModulePath(),s=o.getEmptyCjsModulePath(),e.length>0){let l=r.optimizeDeps?.exclude||[];r.optimizeDeps.exclude=[...l,...e]}n.debug&&e.length>0},resolveId(r){return _t(r,e)?{id:t,syntheticNamedExports:!0}:null}}}function Ke(n){return!n||typeof n!="string"?null:n.startsWith("@")?n.split("/").slice(0,2).join("/"):n.split("/")[0]}function As(n){return!n||typeof n!="string"?!1:!n.startsWith(".")&&!n.startsWith("/")&&!n.startsWith("\\")&&!n.startsWith("\0")}function Ns(n,e){if(!n||!e||!e.getRepoRoot())return!1;let s=n;n.startsWith("@fs/")&&(s=n.slice(4));let r=e.resolveRepoPath("packages"),o=e.normalizePath(s);return r&&o.startsWith(r)}function Os(n,e){if(!n||!e)return null;let t=Ke(n);if(!t)return null;let s=e.resolveAppPath(`node_modules/${t}`);return e.pathExists(s)?e.resolveAppPath(`node_modules/${n}`):null}function Dt(n,e,t){return!As(n)||!Ns(e,t)?null:Os(n,t)}B();function kt(n={}){let{debug:e=!1,verbose:t=!0}=n,s=I("peer-dependency-resolver",e,t);return{name:"dndev-peer-dependency-resolver",enforce:"pre",configResolved(r){let o=_.getInstance(),a=o.getAppRoot();if(!a){s.warn("App root not set, peer dependency resolution may fail");return}this.pathResolver=o,this.appRoot=a},resolveId(r,o){if(!o||!this.appRoot||!this.pathResolver)return null;if(Dt(r,o,this.pathResolver)){let i=Ke(r),l=this.pathResolver.resolveAppPath(`node_modules/${r}`),u=this.pathResolver.resolveAppPath(`node_modules/${i}`);return this.pathResolver.pathExists(u)?r===i?((e||t)&&s.debug(`[PeerDeps] Resolving bare import "${r}" from app's node_modules: ${u}`),u):((e||t)&&s.debug(`[PeerDeps] Resolving subpath "${r}" from app's node_modules: ${l}`),l):(e&&s.debug(`[PeerDeps] Package directory not found: ${u}, skipping resolution`),null)}return null}}}import{VitePWA as Ts}from"vite-plugin-pwa";L();var Fe=class extends te{constructor(e,t={}){super(e,{...t})}_getDiscoveryType(){return"PWA"}async _getPatterns(){return await this.pathResolver.resolvePatterns("pwa")}_getPatternType(){return"pwa"}async _processFiles(e){let{frameworkFiles:t,consumerFiles:s}=e,r=[...t,...s];this.logger.debug(`Processing ${r.length} PWA files`);let o=[];this.options.assetData?.pwaIcons&&(this.logger.debug(`Using ${this.options.assetData.pwaIcons.length} icons from AssetDiscovery`),o=[...this.options.assetData.pwaIcons]);let a=await this._analyzePWAFiles(r),i=a.filter(g=>g.type==="manifest"||g.type==="service-worker");o.push(...i);let l=a.filter(g=>g.type==="icon"),u=new Set(o.filter(g=>g.type==="icon").map(g=>g.path)),c=l.filter(g=>!u.has(g.path));o.push(...c);let p=this._generatePWAManifest(o);return{assets:o,manifest:p,totalFiles:r.length,timestamp:Date.now()}}_getEmptyResult(){return{assets:[],manifest:this._getDefaultManifest(),totalFiles:0,timestamp:Date.now()}}_getDiscoverySummary(){return`${this.cache?.assets?.length||0} PWA assets discovered`}async _analyzePWAFiles(e){let t=[];for(let s of e){let r=typeof s=="string"?{absolutePath:s,relativePath:this.pathResolver.getRelativePath(s),fileName:s.split("/").pop()||"",extension:(s.split(".").pop()||"").toLowerCase()}:s,o=await this._analyzePWAAsset(r);o&&t.push(o)}return t}async _analyzePWAAsset(e){let t=await this.pathResolver.read(e.absolutePath,{format:"text"});if(!t)return null;let s=e.relativePath,r=e.fileName;return r.includes("manifest.json")?this._parseManifestFile(t,s):r.includes("service-worker")||r.includes("sw.")?this._parseServiceWorkerFile(t,s):this._isPWAIcon(r)?this._parseIconFile(e,s):null}_parseManifestFile(e,t){try{let s=typeof e=="string"?JSON.parse(e):e;return{type:"manifest",path:t,content:s,size:typeof e=="string"?e.length:JSON.stringify(s).length}}catch(s){return this.logger.debug(`Failed to parse manifest: ${s.message}`),null}}_parseServiceWorkerFile(e,t){return{type:"service-worker",path:t,size:e.length,hasWorkbox:e.includes("workbox")}}_parseIconFile(e,t){let s=e.fileName,r=this._extractIconSize(s);return{type:"icon",path:t,size:r,format:e.extension,purpose:this._getIconPurpose(s)}}_isPWAIcon(e){return["icon","logo","apple-touch-icon","android-chrome","favicon"].some(s=>e.includes(s))}_extractIconSize(e){let t=e.match(/(\d+)x(\d+)/);return t?{width:parseInt(t[1]),height:parseInt(t[2])}:e.includes("favicon")?{width:32,height:32}:e.includes("apple-touch-icon")?{width:180,height:180}:e.includes("icon-192")?{width:192,height:192}:e.includes("icon-512")?{width:512,height:512}:{width:192,height:192}}_getIconPurpose(e){return e.includes("maskable")?"maskable":e.includes("apple-touch")?"apple-touch":e.includes("android-chrome")?"android":"any"}_generatePWAManifest(e){let t=e.filter(o=>o.type==="icon"),r=e.find(o=>o.type==="manifest")?.content||this._getDefaultManifest();return t.length>0&&(r.icons=t.map(o=>({src:`/${o.path}`,sizes:`${o.size.width}x${o.size.height}`,type:`image/${o.format}`,purpose:o.purpose}))),r}_getDefaultManifest(){let e=this.options?.app||{};return{name:e.name,short_name:e.shortName,description:e.description,start_url:"/",display:"standalone",background_color:"#ffffff",theme_color:"#000000",icons:[]}}generateManifestContent(e){let t=e.manifest||this._getDefaultManifest();return JSON.stringify(t,null,2)}generateServiceWorkerContent(e,t={}){let s=this._getWorkboxDefaults(t),r=t.backgroundSync!==!1&&t.backgroundSync,o=t.precacheManifest||[],a=JSON.stringify(o,null,2);return`// Generated by @donotdev/config - PWA Service Worker with Workbox
568
+ `},generateManifest:n=>({namespaces:n.stats?.totalNamespaces||0,languages:n.stats?.totalLanguages||0,fallbackLanguage:n.fallbackLanguage,eagerNamespaces:n.stats?.eagerNamespaces||0,platform:"vite",timestamp:Date.now()}),logConfig:n=>{},logStats:(n,e,t)=>{let s=n.supportedLanguages||[],r=Object.keys(n.mapping||{}).filter(o=>o!=="default").length||0;t&&t.info(`${e} I18n: ${s.length} languages, ${r} namespaces`)}},Es=[n=>n.endsWith(".json")&&n.includes("locale"),n=>/[a-z]+_[a-z]{2}\.json$/i.test(n),n=>n.includes("/locales/")&&n.endsWith(".json")];function Et(n={}){let e=!1,t=new Map,s=_.getInstance(),r={...ye.discovery,fallbackLanguage:n.fallbackLanguage||"en",...n},o=new Pe(s,r);function a(c){t.clear();let{content:p,eagerNamespaces:g}=c;for(let[d,m]of Object.entries(p||{}))if(!g.includes(d))for(let[k,O]of Object.entries(m))t.set(`virtual:i18n-lazy-${d}-${k}`,O)}let i={...Pt,generateModule:(c,p,g)=>(e||a(c),Pt.generateModule(c,p,g,e))};return[le({pluginName:"dndev-vite-i18n-discovery",icon:"\u{1F310}",virtualModuleId:M.i18n,DiscoveryClass:Pe,discoveryMethod:"discoverTranslations",filePatterns:Es,templates:i,defaultInspectionPath:j.vite.i18nInspection,manifestFileName:j.manifests.i18n,configKey:"i18n",discoveryOptions:r})({...n,hmrSmartDetection:!1}),{name:"dndev-i18n-lazy-loader",enforce:"pre",configResolved(c){e=c.command==="serve"},async buildStart(){if(e)return;let c=()=>{let d=s.getAppRoot(),m=s.getRepoRoot();return d&&d!==m},p=0;for(;!c()&&p<100;)await new Promise(d=>setTimeout(d,10)),p++;if(!c())return;let g=await o.discoverTranslations();a(g)},resolveId(c){if(!e&&c.startsWith("virtual:i18n-lazy-"))return"\0"+c},load(c){if(!e&&c.startsWith("\0virtual:i18n-lazy-")){let p=c.slice(1),g=t.get(p);return`export default ${JSON.stringify(g||{})};`}}}]}B();B();L();function Rs(n){if(!n)return[];let e=_.getInstance(),t=new Set;try{let s=e.resolvePackage("@donotdev/core",n);if(!s)return[];let r=e.getDirname(e.getDirname(s)),o;try{o=e.readdirSync(r)}catch{return[]}for(let a of o)try{let i=e.resolvePath(`${a}/package.json`,r),l=e.readSync(i,{format:"json"});if(!l?.peerDependenciesMeta)continue;for(let[u,c]of Object.entries(l.peerDependenciesMeta))c?.optional&&t.add(u)}catch{}}catch{}return Array.from(t)}function _s(n){if(!n)return[];let e=_.getInstance();try{let t=e.resolvePath("package.json",n),s=e.readSync(t,{format:"json"});if(!s)return[];let r=new Set;if(s.peerDependenciesMeta)for(let[o,a]of Object.entries(s.peerDependenciesMeta))a?.optional&&r.add(o);if(s.optionalDependencies)for(let o of Object.keys(s.optionalDependencies))r.add(o);return Array.from(r)}catch{return[]}}function $s(n){let e=me.optionalFeatures||[],t=Rs(n),s=_s(n);return[...new Set([...e,...t,...s])]}function Ds(n){let e=_.getInstance();try{let t=e.resolvePath("package.json",n),s=e.readSync(t,{format:"json"});return s?new Set([...Object.keys(s.dependencies||{}),...Object.keys(s.devDependencies||{})]):new Set}catch{return new Set}}function ks(n,e,t){if(t.resolvePackage(n,e||void 0))return!0;let s=n.startsWith("@")?n.split("/").slice(0,2).join("/"):n.split("/")[0],r=e;for(let o=0;o<10;o++){let a=t.resolvePath(`node_modules/${s}`,r);if(t.pathExists(a))return!0;let i=t.getDirname(r);if(i===r)break;r=i}return!1}function Rt(n){let e=$s(n),t=[],s=[],r=_.getInstance(),o=Ds(n);for(let a of e)a.startsWith("@donotdev/")?o.has(a)?s.push(a):t.push(a):ks(a,n,r)?s.push(a):t.push(a);return{missing:t,installed:s}}function _t(n,e){return e.some(t=>n===t||n.startsWith(t+"/"))}function $t(n={}){let e=[],t="",s="";return{name:"dndev-optional-dep-resolver",enforce:"pre",config(r){let o={name:"dndev-optional-dep-esbuild",setup(i){i.onResolve({filter:/^[@a-z]/,namespace:"file"},l=>_t(l.path,e)?{path:s,external:!1}:null)}};return{optimizeDeps:{esbuildOptions:{plugins:[...r.optimizeDeps?.esbuildOptions?.plugins||[],o]}}}},configResolved(r){let o=_.getInstance(),a=o.getAppRoot();if(e=Rt(a).missing,t=o.getEmptyModulePath(),s=o.getEmptyCjsModulePath(),e.length>0){let l=r.optimizeDeps?.exclude||[];r.optimizeDeps.exclude=[...l,...e]}n.debug&&e.length>0},resolveId(r){return _t(r,e)?{id:t,syntheticNamedExports:!0}:null}}}function Ke(n){return!n||typeof n!="string"?null:n.startsWith("@")?n.split("/").slice(0,2).join("/"):n.split("/")[0]}function As(n){return!n||typeof n!="string"?!1:!n.startsWith(".")&&!n.startsWith("/")&&!n.startsWith("\\")&&!n.startsWith("\0")}function Ns(n,e){if(!n||!e||!e.getRepoRoot())return!1;let s=n;n.startsWith("@fs/")&&(s=n.slice(4));let r=e.resolveRepoPath("packages"),o=e.normalizePath(s);return r&&o.startsWith(r)}function Os(n,e){if(!n||!e)return null;let t=Ke(n);if(!t)return null;let s=e.resolveAppPath(`node_modules/${t}`);return e.pathExists(s)?e.resolveAppPath(`node_modules/${n}`):null}function Dt(n,e,t){return!As(n)||!Ns(e,t)?null:Os(n,t)}B();function kt(n={}){let{debug:e=!1,verbose:t=!0}=n,s=F("peer-dependency-resolver",e,t);return{name:"dndev-peer-dependency-resolver",enforce:"pre",configResolved(r){let o=_.getInstance(),a=o.getAppRoot();if(!a){s.warn("App root not set, peer dependency resolution may fail");return}this.pathResolver=o,this.appRoot=a},resolveId(r,o){if(!o||!this.appRoot||!this.pathResolver)return null;if(Dt(r,o,this.pathResolver)){let i=Ke(r),l=this.pathResolver.resolveAppPath(`node_modules/${r}`),u=this.pathResolver.resolveAppPath(`node_modules/${i}`);return this.pathResolver.pathExists(u)?r===i?((e||t)&&s.debug(`[PeerDeps] Resolving bare import "${r}" from app's node_modules: ${u}`),u):((e||t)&&s.debug(`[PeerDeps] Resolving subpath "${r}" from app's node_modules: ${l}`),l):(e&&s.debug(`[PeerDeps] Package directory not found: ${u}, skipping resolution`),null)}return null}}}import{VitePWA as Ts}from"vite-plugin-pwa";L();var Fe=class extends se{constructor(e,t={}){super(e,{...t})}_getDiscoveryType(){return"PWA"}async _getPatterns(){return await this.pathResolver.resolvePatterns("pwa")}_getPatternType(){return"pwa"}async _processFiles(e){let{frameworkFiles:t,consumerFiles:s}=e,r=[...t,...s];this.logger.debug(`Processing ${r.length} PWA files`);let o=[];this.options.assetData?.pwaIcons&&(this.logger.debug(`Using ${this.options.assetData.pwaIcons.length} icons from AssetDiscovery`),o=[...this.options.assetData.pwaIcons]);let a=await this._analyzePWAFiles(r),i=a.filter(g=>g.type==="manifest"||g.type==="service-worker");o.push(...i);let l=a.filter(g=>g.type==="icon"),u=new Set(o.filter(g=>g.type==="icon").map(g=>g.path)),c=l.filter(g=>!u.has(g.path));o.push(...c);let p=this._generatePWAManifest(o);return{assets:o,manifest:p,totalFiles:r.length,timestamp:Date.now()}}_getEmptyResult(){return{assets:[],manifest:this._getDefaultManifest(),totalFiles:0,timestamp:Date.now()}}_getDiscoverySummary(){return`${this.cache?.assets?.length||0} PWA assets discovered`}async _analyzePWAFiles(e){let t=[];for(let s of e){let r=typeof s=="string"?{absolutePath:s,relativePath:this.pathResolver.getRelativePath(s),fileName:s.split("/").pop()||"",extension:(s.split(".").pop()||"").toLowerCase()}:s,o=await this._analyzePWAAsset(r);o&&t.push(o)}return t}async _analyzePWAAsset(e){let t=await this.pathResolver.read(e.absolutePath,{format:"text"});if(!t)return null;let s=e.relativePath,r=e.fileName;return r.includes("manifest.json")?this._parseManifestFile(t,s):r.includes("service-worker")||r.includes("sw.")?this._parseServiceWorkerFile(t,s):this._isPWAIcon(r)?this._parseIconFile(e,s):null}_parseManifestFile(e,t){try{let s=typeof e=="string"?JSON.parse(e):e;return{type:"manifest",path:t,content:s,size:typeof e=="string"?e.length:JSON.stringify(s).length}}catch(s){return this.logger.debug(`Failed to parse manifest: ${s.message}`),null}}_parseServiceWorkerFile(e,t){return{type:"service-worker",path:t,size:e.length,hasWorkbox:e.includes("workbox")}}_parseIconFile(e,t){let s=e.fileName,r=this._extractIconSize(s);return{type:"icon",path:t,size:r,format:e.extension,purpose:this._getIconPurpose(s)}}_isPWAIcon(e){return["icon","logo","apple-touch-icon","android-chrome","favicon"].some(s=>e.includes(s))}_extractIconSize(e){let t=e.match(/(\d+)x(\d+)/);return t?{width:parseInt(t[1]),height:parseInt(t[2])}:e.includes("favicon")?{width:32,height:32}:e.includes("apple-touch-icon")?{width:180,height:180}:e.includes("icon-192")?{width:192,height:192}:e.includes("icon-512")?{width:512,height:512}:{width:192,height:192}}_getIconPurpose(e){return e.includes("maskable")?"maskable":e.includes("apple-touch")?"apple-touch":e.includes("android-chrome")?"android":"any"}_generatePWAManifest(e){let t=e.filter(o=>o.type==="icon"),r=e.find(o=>o.type==="manifest")?.content||this._getDefaultManifest();return t.length>0&&(r.icons=t.map(o=>({src:`/${o.path}`,sizes:`${o.size.width}x${o.size.height}`,type:`image/${o.format}`,purpose:o.purpose}))),r}_getDefaultManifest(){let e=this.options?.app||{};return{name:e.name,short_name:e.shortName,description:e.description,start_url:"/",display:"standalone",background_color:"#ffffff",theme_color:"#000000",icons:[]}}generateManifestContent(e){let t=e.manifest||this._getDefaultManifest();return JSON.stringify(t,null,2)}generateServiceWorkerContent(e,t={}){let s=this._getWorkboxDefaults(t),r=t.backgroundSync!==!1&&t.backgroundSync,o=t.precacheManifest||[],a=JSON.stringify(o,null,2);return`// Generated by @donotdev/config - PWA Service Worker with Workbox
569
569
  // Generated at ${new Date().toISOString()}
570
570
 
571
571
  importScripts('https://storage.googleapis.com/workbox-cdn/releases/7.0.0/workbox-sw.js');
@@ -633,7 +633,7 @@ registerRoute(
633
633
  }),
634
634
  'POST'
635
635
  );
636
- `}getPWAHeaders(){return[{source:"/manifest.json",headers:[{key:"Content-Type",value:"application/manifest+json"},{key:"Cache-Control",value:"public, max-age=3600"}]},{source:"/sw.js",headers:[{key:"Content-Type",value:"application/javascript"},{key:"Cache-Control",value:"no-cache"}]}]}getPWARewrites(){return{beforeFiles:[],afterFiles:[{source:"/sw.js",destination:"/sw.js"},{source:"/workbox-:path*",destination:"/workbox-:path*"}],fallback:[]}}async discoverNextBuildAssets(e=".next"){let t=this.pathResolver.resolveAppPath(`${e}/static`),s=this.pathResolver.resolveAppPath(`${e}/static/chunks`),r=this.pathResolver.resolveAppPath(`${e}/static/css`),o=[];try{let a=[`${t}/**/*.{js,css,woff2,woff,ttf,eot}`,`${s}/**/*.{js,css}`,`${r}/**/*.css`];for(let i of a){let l=await this.pathResolver.findFiles(this.pathResolver.getAppRoot(),i.replace(this.pathResolver.getAppRoot(),""),{onlyFiles:!0});for(let u of l){let c=this.pathResolver.getRelativePath(u);if(c.startsWith(`${e}/static/`)){let p=`/_next/${c.replace(`${e}/static/`,"")}`;o.push({url:p,revision:null})}}}}catch(a){this.logger?.warn(`Failed to discover Next.js build assets: ${a.message}`)}return o}generatePrecacheManifest(e=[],t=null){let s=e;return t&&typeof t=="function"&&(s=t(s)),s}async discoverPWAAssets(e=!1){return await this.discover(e)}getPWAAssets(){return this.cache?.assets||[]}getPWAManifest(){return this.cache?.manifest||this._getDefaultManifest()}};B();function At(n={}){if(!n.enabled)return null;let e=n.app||{},t=[];if(e.name||t.push("name"),e.shortName||t.push("shortName"),e.description||t.push("description"),t.length>0){let c=I("PWA",n.debug,!0);c.warn(`\u26A0\uFE0F PWA is enabled but appConfig.app is missing required fields: ${t.join(", ")}`),c.warn(" Add these to your src/config/app.ts:"),c.warn(" export const appConfig: AppConfig = {"),c.warn(" app: {"),e.name||c.warn(' name: "Your App Name",'),e.shortName||c.warn(' shortName: "App",'),e.description||c.warn(' description: "Your app description",'),c.warn(" },"),c.warn(" // ... rest of config"),c.warn(" };"),c.warn("")}let s=_.getInstance(),r=Je.data;if(!r)try{let c=s.resolveAppPath(j.vite.assetInspection);s.pathExists(c)}catch{}let o=new Fe(s,{...n,assetData:r}),a=n.devEnabled===!0,i={registerType:n.registerType||"prompt",includeAssets:["favicon.ico","favicon.svg","apple-touch-icon.png"],manifest:async()=>{let c=n.app||{},g=(await o.discoverPWAAssets()).assets.filter(d=>d.type==="icon").map(d=>({src:`/${d.path}`,sizes:`${d.size.width}x${d.size.height}`,type:`image/${d.format}`,purpose:d.purpose}));return{name:c.name,short_name:c.shortName,description:c.description,start_url:"/",display:"standalone",background_color:"#ffffff",theme_color:"#000000",icons:g.length>0?g:[]}},workbox:{globPatterns:["**/*.{js,css,html,ico,png,svg,woff2}"],runtimeCaching:[{urlPattern:/^https:\/\/fonts\.googleapis\.com\/.*/i,handler:"CacheFirst",options:{cacheName:"google-fonts-cache",expiration:{maxEntries:10,maxAgeSeconds:3600*24*365},cacheableResponse:{statuses:[0,200]}}},{urlPattern:/^https:\/\/fonts\.gstatic\.com\/.*/i,handler:"CacheFirst",options:{cacheName:"gstatic-fonts-cache",expiration:{maxEntries:10,maxAgeSeconds:3600*24*365},cacheableResponse:{statuses:[0,200]}}},{urlPattern:/\.(?:png|jpg|jpeg|svg|gif|webp|avif)$/,handler:"StaleWhileRevalidate",options:{cacheName:"images-cache",expiration:{maxEntries:60,maxAgeSeconds:3600*24*30}}},{urlPattern:/\/api\/.*/i,handler:"NetworkFirst",options:{cacheName:"api-cache",expiration:{maxEntries:50,maxAgeSeconds:300},networkTimeoutSeconds:10}},{urlPattern:({request:c})=>c.destination==="document",handler:"NetworkFirst",options:{cacheName:"pages-cache",expiration:{maxEntries:32,maxAgeSeconds:3600*24},networkTimeoutSeconds:10}}],cleanupOutdatedCaches:!0,skipWaiting:!0,clientsClaim:!0,maximumFileSizeToCacheInBytes:5*1024*1024,navigateFallback:"/index.html",navigateFallbackDenylist:[/^\/api\/.*/],manifestTransforms:[c=>{let p=c.find(g=>g.url==="/index.html"||g.url==="index.html");return p&&!c.find(g=>g.url==="/")&&c.push({url:"/",revision:p.revision}),{manifest:c,warnings:[]}}]},devOptions:{enabled:a,type:"module"}},u={...i,manifest:async()=>{let c=await i.manifest();if(n.manifest){if(typeof n.manifest=="function"){let p=await n.manifest();return{...c,...p}}return{...c,...n.manifest}}return c},workbox:{...i.workbox,...n.workbox||{},runtimeCaching:[...i.workbox.runtimeCaching,...n.workbox?.runtimeCaching||[]],manifestTransforms:[...i.workbox.manifestTransforms||[],...n.workbox?.manifestTransforms||[]]}};return Ts(u)}L();L();function Nt(n,e="unknown"){try{let t=/export\s+const\s+meta\s*[^=]*=\s*(\{[\s\S]*?\});/,s=n.match(t);if(!s)return null;let r=s[1];r=r.replace(/icon:\s*<(\w+)[\s\/][^>]*\/?>/g,(l,u)=>`icon: '${u}'`);let o=/(?:export\s+)?const\s+(\w+)\s*=\s*['"]([^'"]+)['"]/g;return[...n.matchAll(o)].forEach(l=>{let u=l[1],c=l[2];r=r.replace(new RegExp(`\\b${u}\\b`,"g"),`'${c}'`)}),Function(`return ${r}`)()}catch{return null}}var Ee=null,Ot=null;function Fs(n){let t=(n.split("/").pop()?.replace(/\.tsx?$/,"")||"Component").replace(/[^a-zA-Z0-9]/g,"");return t.charAt(0).toUpperCase()+t.slice(1)}var Ie=class extends te{constructor(e,t={}){super(e,{additionalPatterns:[],...t}),this.routes=[],this.errors=[],this.source="auto-discovery"}_getDiscoveryType(){return"Route"}async _getPatterns(){return await this.pathResolver.resolvePatterns("routes")}_getPatternType(){return"routes"}async _processFiles(e){let t=this.pathResolver.getAppRoot(),s=process.env.DNDEV_BUILD_ID;if(Ee&&Ot===s)return this.logger.debug("Using cached route discovery results"),this.routes=Ee.routes,this.errors=Ee.errors,this.source=Ee.source,{routes:this.routes,errors:this.errors,source:this.source,totalFiles:this.routes.length};if(this.logger.debug("Route discovery mode: AUTO-DISCOVERY"),this.logger.debug(`App root: ${t}`),this.options.debug){let r=e?.consumerFiles?.length||0;this.logger.debug(`\u{1F50D} Route discovery: Scanning ${r} files in ${t}`);let o=await this._getPatterns();this.logger.debug(`Patterns: ${JSON.stringify(o)}`)}return await this._performAutoDiscovery(e,t),this.options.debug&&this.logger.debug(`\u{1F50D} Route discovery: Found ${this.routes.length} routes`),this.routes.length===0&&this.logger.warn("\u26A0\uFE0F No routes discovered! Check that pages exist in src/pages/"),Ee={routes:this.routes,errors:this.errors,source:this.source},Ot=process.env.DNDEV_BUILD_ID,{routes:this.routes,errors:this.errors,source:this.source,totalFiles:this.routes.length}}_getEmptyResult(){return{routes:[],errors:[],source:"empty",totalFiles:0,timestamp:Date.now()}}_getDiscoverySummary(){return`${this.cache?.routes?.length||0} routes discovered via ${this.cache?.source||"unknown"}`}async discoverRoutes(e=!1){return await this.discover(e)}getRoutes(){return this.cache?.routes||[]}async _performAutoDiscovery(e,t){let{consumerFiles:s}=e,r=await this._batchProcessFiles(s,u=>this._analyzePageFile(u,t)),o=await this._scanAdditionalPatterns(t),a=await this._batchProcessFiles(o,u=>this._analyzePageFile(u,t)),i=[...r,...a];this.logger.debug(`Auto-discovering from ${s.length} app + ${o.length} additional files`),this.routes=i.filter(u=>u.path==="home"||u.path==="/home"?(this.logger.debug(`Filtered reserved route: ${u.path} - Use root "/" instead (${u.file})`),!1):!0);let l=new Map;for(let u of this.routes){let c=u.path;if(l.has(c)){let p=l.get(c);throw new Error(`Route conflict: Multiple routes found for path '${c}'. Routes: ${p.file} and ${u.file}. Use PageMeta route override to specify unique paths. Example: export const meta: PageMeta = { route: '/custom-path' };`)}l.set(c,u)}this.logger.debug(`Auto-discovered ${this.routes.length} routes from ${s.length+o.length} files`)}async _scanAdditionalPatterns(e){let t=this.options.additionalPatterns.map(s=>this.pathResolver.resolveAppPath(s));if(t.length===0)return[];try{let{consumerFiles:s}=await this.pathResolver.resolveFiles({consumer:t,framework:[]},"routes");return s}catch(s){return this.logger.debug(`Error scanning additional patterns: ${s.message}`),[]}}async _analyzePageFile(e,t){let s=await this.pathResolver.read(e.absolutePath,{format:"text"});if(!s)return null;let r=e.relativePath,o="/src/"+r.replace(/\\/g,"/");o=o.replace(/src\/src\//g,"src/").replace(/src\/src\//g,"src/");let a=this._extractMetaExport(s,e.absolutePath),i=Fs(o),u=i===We.HOMEPAGE_COMPONENT?We.HOMEPAGE_PATH:this._resolveRoutePath(a,r,e.absolutePath),c=this._extractPageMeta(r,s),{entity:p,action:g,...d}=a||{};return{path:u,component:i,importPath:o,auth:a?.auth||!1,meta:{...c,...d,entity:c.entity,action:c.action},metaExport:a,file:r}}_extractMetaExport(e,t){try{let s=Nt(e,t);return s?(this.logger.debug(`Extracted meta export from ${t}: ${JSON.stringify(s)}`),s):null}catch(s){return this.logger.debug(`Error parsing meta export from ${t}: ${s.message}`),null}}_generateRoutePath(e){let t=e.replace(/\.tsx$/,"").replace(/Page$/,"").replace(/^src\//,"").replace(/^pages\//,"").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return(t.endsWith("/index")||t==="index")&&(t=t.replace(/\/index$/,"")||"/"),t==="/"?"/":"/"+t.replace(/\/+/g,"/")}_resolveRoutePath(e,t,s){if(!e?.route)return this._generateRoutePath(t);if(typeof e.route=="string"){let r=e.route.trim();return r==="/"?"/":(r=r.replace(/\/+/g,"/"),r.startsWith("/")||(r="/"+r),r)}if(typeof e.route=="object"&&e.route!==null){let r=this._generateRoutePath(t),o=e.route.params;if(Array.isArray(o)&&o.length>0){let a=o.map(i=>`:${i}`).join("/");return`${r}/${a}`}return r}return this.logger.warn(`Invalid route format in ${s}. Use string format: route: "/path/:param" or object format: route: { params: ['id'] }`),this.logger.debug(`Falling back to auto-generated path for ${s}`),this._generateRoutePath(t)}_extractPageMeta(e,t){let s=e.split("/").pop()?.replace(".tsx","")||"",r=s.replace(/Page$/,"");r=r.replace(/([A-Z])/g," $1").trim(),r=r.charAt(0).toUpperCase()+r.slice(1);let o=e.split("/"),a=null,i=null;return o.length>1&&(a=o[o.length-2],s.includes("List")?i="list":s.includes("Form")||s.includes("Create")||s.includes("Edit")?i="form":(s.includes("Detail")||s.includes("View"))&&(i="detail")),{title:r,entity:a,action:i,file:e}}};var Is={isEmpty:n=>!n.routes||n.routes.length===0,generateModule:(n,e,t="routes")=>{let s={totalRoutes:n.routes.length,authRequired:n.routes.filter(o=>o.auth&&o.auth.required).length,publicRoutes:n.routes.filter(o=>!o.auth||o.auth===!1).length,source:n.source,generatedAt:new Date().toISOString(),errors:n.errors.length},r=n.routes.map(o=>` {
636
+ `}getPWAHeaders(){return[{source:"/manifest.json",headers:[{key:"Content-Type",value:"application/manifest+json"},{key:"Cache-Control",value:"public, max-age=3600"}]},{source:"/sw.js",headers:[{key:"Content-Type",value:"application/javascript"},{key:"Cache-Control",value:"no-cache"}]}]}getPWARewrites(){return{beforeFiles:[],afterFiles:[{source:"/sw.js",destination:"/sw.js"},{source:"/workbox-:path*",destination:"/workbox-:path*"}],fallback:[]}}async discoverNextBuildAssets(e=".next"){let t=this.pathResolver.resolveAppPath(`${e}/static`),s=this.pathResolver.resolveAppPath(`${e}/static/chunks`),r=this.pathResolver.resolveAppPath(`${e}/static/css`),o=[];try{let a=[`${t}/**/*.{js,css,woff2,woff,ttf,eot}`,`${s}/**/*.{js,css}`,`${r}/**/*.css`];for(let i of a){let l=await this.pathResolver.findFiles(this.pathResolver.getAppRoot(),i.replace(this.pathResolver.getAppRoot(),""),{onlyFiles:!0});for(let u of l){let c=this.pathResolver.getRelativePath(u);if(c.startsWith(`${e}/static/`)){let p=`/_next/${c.replace(`${e}/static/`,"")}`;o.push({url:p,revision:null})}}}}catch(a){this.logger?.warn(`Failed to discover Next.js build assets: ${a.message}`)}return o}generatePrecacheManifest(e=[],t=null){let s=e;return t&&typeof t=="function"&&(s=t(s)),s}async discoverPWAAssets(e=!1){return await this.discover(e)}getPWAAssets(){return this.cache?.assets||[]}getPWAManifest(){return this.cache?.manifest||this._getDefaultManifest()}};B();function At(n={}){if(!n.enabled)return null;let e=n.app||{},t=[];if(e.name||t.push("name"),e.shortName||t.push("shortName"),e.description||t.push("description"),t.length>0){let c=F("PWA",n.debug,!0);c.warn(`\u26A0\uFE0F PWA is enabled but appConfig.app is missing required fields: ${t.join(", ")}`),c.warn(" Add these to your src/config/app.ts:"),c.warn(" export const appConfig: AppConfig = {"),c.warn(" app: {"),e.name||c.warn(' name: "Your App Name",'),e.shortName||c.warn(' shortName: "App",'),e.description||c.warn(' description: "Your app description",'),c.warn(" },"),c.warn(" // ... rest of config"),c.warn(" };"),c.warn("")}let s=_.getInstance(),r=Je.data;if(!r)try{let c=s.resolveAppPath(j.vite.assetInspection);s.pathExists(c)}catch{}let o=new Fe(s,{...n,assetData:r}),a=n.devEnabled===!0,i={registerType:n.registerType||"prompt",includeAssets:["favicon.ico","favicon.svg","apple-touch-icon.png"],manifest:async()=>{let c=n.app||{},g=(await o.discoverPWAAssets()).assets.filter(d=>d.type==="icon").map(d=>({src:`/${d.path}`,sizes:`${d.size.width}x${d.size.height}`,type:`image/${d.format}`,purpose:d.purpose}));return{name:c.name,short_name:c.shortName,description:c.description,start_url:"/",display:"standalone",background_color:"#ffffff",theme_color:"#000000",icons:g.length>0?g:[]}},workbox:{globPatterns:["**/*.{js,css,html,ico,png,svg,woff2}"],runtimeCaching:[{urlPattern:/^https:\/\/fonts\.googleapis\.com\/.*/i,handler:"CacheFirst",options:{cacheName:"google-fonts-cache",expiration:{maxEntries:10,maxAgeSeconds:3600*24*365},cacheableResponse:{statuses:[0,200]}}},{urlPattern:/^https:\/\/fonts\.gstatic\.com\/.*/i,handler:"CacheFirst",options:{cacheName:"gstatic-fonts-cache",expiration:{maxEntries:10,maxAgeSeconds:3600*24*365},cacheableResponse:{statuses:[0,200]}}},{urlPattern:/\.(?:png|jpg|jpeg|svg|gif|webp|avif)$/,handler:"StaleWhileRevalidate",options:{cacheName:"images-cache",expiration:{maxEntries:60,maxAgeSeconds:3600*24*30}}},{urlPattern:/\/api\/.*/i,handler:"NetworkFirst",options:{cacheName:"api-cache",expiration:{maxEntries:50,maxAgeSeconds:300},networkTimeoutSeconds:10}},{urlPattern:({request:c})=>c.destination==="document",handler:"NetworkFirst",options:{cacheName:"pages-cache",expiration:{maxEntries:32,maxAgeSeconds:3600*24},networkTimeoutSeconds:10}}],cleanupOutdatedCaches:!0,skipWaiting:!0,clientsClaim:!0,maximumFileSizeToCacheInBytes:5*1024*1024,navigateFallback:"/index.html",navigateFallbackDenylist:[/^\/api\/.*/],manifestTransforms:[c=>{let p=c.find(g=>g.url==="/index.html"||g.url==="index.html");return p&&!c.find(g=>g.url==="/")&&c.push({url:"/",revision:p.revision}),{manifest:c,warnings:[]}}]},devOptions:{enabled:a,type:"module"}},u={...i,manifest:async()=>{let c=await i.manifest();if(n.manifest){if(typeof n.manifest=="function"){let p=await n.manifest();return{...c,...p}}return{...c,...n.manifest}}return c},workbox:{...i.workbox,...n.workbox||{},runtimeCaching:[...i.workbox.runtimeCaching,...n.workbox?.runtimeCaching||[]],manifestTransforms:[...i.workbox.manifestTransforms||[],...n.workbox?.manifestTransforms||[]]}};return Ts(u)}L();L();function Nt(n,e="unknown"){try{let t=/export\s+const\s+meta\s*[^=]*=\s*(\{[\s\S]*?\});/,s=n.match(t);if(!s)return null;let r=s[1];r=r.replace(/icon:\s*<(\w+)[\s\/][^>]*\/?>/g,(l,u)=>`icon: '${u}'`);let o=/(?:export\s+)?const\s+(\w+)\s*=\s*['"]([^'"]+)['"]/g;return[...n.matchAll(o)].forEach(l=>{let u=l[1],c=l[2];r=r.replace(new RegExp(`\\b${u}\\b`,"g"),`'${c}'`)}),Function(`return ${r}`)()}catch{return null}}var Ee=null,Ot=null;function Fs(n){let t=(n.split("/").pop()?.replace(/\.tsx?$/,"")||"Component").replace(/[^a-zA-Z0-9]/g,"");return t.charAt(0).toUpperCase()+t.slice(1)}var Ie=class extends se{constructor(e,t={}){super(e,{additionalPatterns:[],...t}),this.routes=[],this.errors=[],this.source="auto-discovery"}_getDiscoveryType(){return"Route"}async _getPatterns(){return await this.pathResolver.resolvePatterns("routes")}_getPatternType(){return"routes"}async _processFiles(e){let t=this.pathResolver.getAppRoot(),s=process.env.DNDEV_BUILD_ID;if(Ee&&Ot===s)return this.logger.debug("Using cached route discovery results"),this.routes=Ee.routes,this.errors=Ee.errors,this.source=Ee.source,{routes:this.routes,errors:this.errors,source:this.source,totalFiles:this.routes.length};if(this.logger.debug("Route discovery mode: AUTO-DISCOVERY"),this.logger.debug(`App root: ${t}`),this.options.debug){let r=e?.consumerFiles?.length||0;this.logger.debug(`\u{1F50D} Route discovery: Scanning ${r} files in ${t}`);let o=await this._getPatterns();this.logger.debug(`Patterns: ${JSON.stringify(o)}`)}return await this._performAutoDiscovery(e,t),this.options.debug&&this.logger.debug(`\u{1F50D} Route discovery: Found ${this.routes.length} routes`),this.routes.length===0&&this.logger.warn("\u26A0\uFE0F No routes discovered! Check that pages exist in src/pages/"),Ee={routes:this.routes,errors:this.errors,source:this.source},Ot=process.env.DNDEV_BUILD_ID,{routes:this.routes,errors:this.errors,source:this.source,totalFiles:this.routes.length}}_getEmptyResult(){return{routes:[],errors:[],source:"empty",totalFiles:0,timestamp:Date.now()}}_getDiscoverySummary(){return`${this.cache?.routes?.length||0} routes discovered via ${this.cache?.source||"unknown"}`}async discoverRoutes(e=!1){return await this.discover(e)}getRoutes(){return this.cache?.routes||[]}async _performAutoDiscovery(e,t){let{consumerFiles:s}=e,r=await this._batchProcessFiles(s,u=>this._analyzePageFile(u,t)),o=await this._scanAdditionalPatterns(t),a=await this._batchProcessFiles(o,u=>this._analyzePageFile(u,t)),i=[...r,...a];this.logger.debug(`Auto-discovering from ${s.length} app + ${o.length} additional files`),this.routes=i.filter(u=>u.path==="home"||u.path==="/home"?(this.logger.debug(`Filtered reserved route: ${u.path} - Use root "/" instead (${u.file})`),!1):!0);let l=new Map;for(let u of this.routes){let c=u.path;if(l.has(c)){let p=l.get(c);throw new Error(`Route conflict: Multiple routes found for path '${c}'. Routes: ${p.file} and ${u.file}. Use PageMeta route override to specify unique paths. Example: export const meta: PageMeta = { route: '/custom-path' };`)}l.set(c,u)}this.logger.debug(`Auto-discovered ${this.routes.length} routes from ${s.length+o.length} files`)}async _scanAdditionalPatterns(e){let t=this.options.additionalPatterns.map(s=>this.pathResolver.resolveAppPath(s));if(t.length===0)return[];try{let{consumerFiles:s}=await this.pathResolver.resolveFiles({consumer:t,framework:[]},"routes");return s}catch(s){return this.logger.debug(`Error scanning additional patterns: ${s.message}`),[]}}async _analyzePageFile(e,t){let s=await this.pathResolver.read(e.absolutePath,{format:"text"});if(!s)return null;let r=e.relativePath,o="/src/"+r.replace(/\\/g,"/");o=o.replace(/src\/src\//g,"src/").replace(/src\/src\//g,"src/");let a=this._extractMetaExport(s,e.absolutePath),i=Fs(o),u=i===We.HOMEPAGE_COMPONENT?We.HOMEPAGE_PATH:this._resolveRoutePath(a,r,e.absolutePath),c=this._extractPageMeta(r,s),{entity:p,action:g,...d}=a||{};return{path:u,component:i,importPath:o,auth:a?.auth||!1,meta:{...c,...d,entity:c.entity,action:c.action},metaExport:a,file:r}}_extractMetaExport(e,t){try{let s=Nt(e,t);return s?(this.logger.debug(`Extracted meta export from ${t}: ${JSON.stringify(s)}`),s):null}catch(s){return this.logger.debug(`Error parsing meta export from ${t}: ${s.message}`),null}}_generateRoutePath(e){let t=e.replace(/\.tsx$/,"").replace(/Page$/,"").replace(/^src\//,"").replace(/^pages\//,"").replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase();return(t.endsWith("/index")||t==="index")&&(t=t.replace(/\/index$/,"")||"/"),t==="/"?"/":"/"+t.replace(/\/+/g,"/")}_resolveRoutePath(e,t,s){if(!e?.route)return this._generateRoutePath(t);if(typeof e.route=="string"){let r=e.route.trim();return r==="/"?"/":(r=r.replace(/\/+/g,"/"),r.startsWith("/")||(r="/"+r),r)}if(typeof e.route=="object"&&e.route!==null){let r=this._generateRoutePath(t),o=e.route.params;if(Array.isArray(o)&&o.length>0){let a=o.map(i=>`:${i}`).join("/");return`${r}/${a}`}return r}return this.logger.warn(`Invalid route format in ${s}. Use string format: route: "/path/:param" or object format: route: { params: ['id'] }`),this.logger.debug(`Falling back to auto-generated path for ${s}`),this._generateRoutePath(t)}_extractPageMeta(e,t){let s=e.split("/").pop()?.replace(".tsx","")||"",r=s.replace(/Page$/,"");r=r.replace(/([A-Z])/g," $1").trim(),r=r.charAt(0).toUpperCase()+r.slice(1);let o=e.split("/"),a=null,i=null;return o.length>1&&(a=o[o.length-2],s.includes("List")?i="list":s.includes("Form")||s.includes("Create")||s.includes("Edit")?i="form":(s.includes("Detail")||s.includes("View"))&&(i="detail")),{title:r,entity:a,action:i,file:e}}};var Is={isEmpty:n=>!n.routes||n.routes.length===0,generateModule:(n,e,t="routes")=>{let s={totalRoutes:n.routes.length,authRequired:n.routes.filter(o=>o.auth&&o.auth.required).length,publicRoutes:n.routes.filter(o=>!o.auth||o.auth===!1).length,source:n.source,generatedAt:new Date().toISOString(),errors:n.errors.length},r=n.routes.map(o=>` {
637
637
  path: '${o.path}',
638
638
  component: () => import('${o.importPath}'),
639
639
  auth: ${JSON.stringify(o.auth,null,2).replace(/\n/g,`
@@ -642,7 +642,7 @@ registerRoute(
642
642
  `)}
643
643
  }`).join(`,
644
644
  `);return`
645
- // ${C.routes} - Generated route data
645
+ // ${M.routes} - Generated route data
646
646
  import { lazy } from 'react';
647
647
 
648
648
  const routeData = [
@@ -682,7 +682,7 @@ export const source = '${n.source}';
682
682
 
683
683
  export default { routes: routeData, manifest: routeManifest, source: '${n.source}' };
684
684
  `},generateEmpty:(n,e,t,s="routes")=>{let r={totalRoutes:0,authRequired:0,publicRoutes:0,source:"empty",generatedAt:new Date().toISOString()};return`
685
- // ${C.routes} - Empty route data
685
+ // ${M.routes} - Empty route data
686
686
 
687
687
  const routeData = [];
688
688
  const routeManifest = ${JSON.stringify(r,null,2)};
@@ -746,7 +746,7 @@ export default discoveredRoutes;
746
746
  * Generated Route Discovery Results
747
747
  * Source: ${n.source}
748
748
  * Generated at: ${new Date().toISOString()}
749
- * Import from '${C.routes}'
749
+ * Import from '${M.routes}'
750
750
  */
751
751
 
752
752
  export const discoveredRoutes = [
@@ -760,7 +760,7 @@ export const routeManifest = {
760
760
  };
761
761
 
762
762
  export default discoveredRoutes;
763
- `},generateManifest:n=>({routes:n?.routes?.length||0,source:n?.source||"unknown",timestamp:Date.now(),errors:n?.errors?.length||0}),logConfig:n=>{},logStats:(n,e,t)=>{let s=n.routes||[],r=s.filter(a=>a.auth&&a.auth.required).length,o=s.length;t&&t.info(`${e} Routes: ${o} found${r>0?`, ${r} are authguarded`:""}`)}},Cs=[n=>n.endsWith("Page.tsx")];function Tt(n={}){return ie({pluginName:"dndev-vite-route-discovery",icon:"\u{1F6E3}\uFE0F",virtualModuleId:C.routes,DiscoveryClass:Ie,discoveryMethod:"discoverRoutes",filePatterns:Cs,templates:Is,defaultInspectionPath:j.vite.routeInspection,manifestFileName:j.manifests.route,configKey:"routes"})({...n,disableHmr:n?.hmr===!1,hmrSmartDetection:!1})}import{loadEnv as Ls}from"vite";B();import{readFileSync as Ms,readdirSync as zs,existsSync as js}from"fs";import{join as Ft}from"path";var Ce=class{constructor(e={}){let{debug:t=!1,generateRobotsTxt:s=!0,generateSitemap:r=!0,baseUrl:o,siteName:a,crawlDelay:i=1,routes:l={},...u}=e;if(!o||!a)throw new Error("SEOGenerator requires baseUrl and siteName options");this.options={debug:t,generateRobotsTxt:s,generateSitemap:r,baseUrl:o,siteName:a,crawlDelay:i,routes:l,defaultImage:"/og-image.jpg",twitterHandle:"@donotdev",defaultAuthor:"DNDev Team",defaultLanguage:"en",staticTags:{},...u},this.appRoot=u.appRoot||null,this.logger=I("SEO Generator",e.debug,e.verbose)}async generateSEOFiles(e,t,s=null){try{let r=this.generateRouteMetaTags(e.routes||[]),o={routes:e.routes||[],routeMetaTags:r,baseUrl:this.options.baseUrl,siteName:this.options.siteName},a=this.discoverBlogPosts(),i={robotsTxt:null,sitemap:null,rss:null,manifest:null,totalRoutes:o.routes.length,publicRoutes:o.routes.filter(l=>!l.auth||l.auth===!1).length,protectedRoutes:o.routes.filter(l=>l.auth&&l.auth.required).length,blogPosts:a.length};return this.options.generateRobotsTxt&&(i.robotsTxt=await this.generateRobotsTxt(o,t,s)),this.options.generateSitemap&&(i.sitemap=await this.generateSitemap(o,t,s,a)),a.length>0&&(i.rss=await this.generateRSSFeed(a,t,s)),i.manifest=await this.generateManifest(o,t,s),i}catch(r){throw this.logger.error(`SEO generator failed to create files (robots.txt/sitemap.xml/manifest): ${r.message}`),this.logger.error(`Stack: ${r.stack||"No stack trace available"}`),r}}async generateRobotsTxt(e,t,s=null){if(s&&await s("robots.txt"))return this.logger.info("\u2705 robots.txt already exists, skipping generation"),{fileName:"robots.txt",skipped:!0};let r=[];(e.routes||[]).forEach(a=>{if(a.auth&&a.auth.required){let i=a.path.startsWith("/")?a.path:`/${a.path}`;r.push(i)}}),r.push("/admin","/api","/_next","/static");let o=this.generateRobotsTxtContent({disallowedPaths:[...new Set(r)],sitemap:`${this.options.baseUrl}/sitemap.xml`,crawlDelay:this.options.crawlDelay});return await t("robots.txt",o),{fileName:"robots.txt",content:o,disallowedPaths:r.length}}async generateSitemap(e,t,s=null,r=[]){if(s&&await s("sitemap.xml"))return this.logger.info("\u2705 sitemap.xml already exists, skipping generation"),{fileName:"sitemap.xml",skipped:!0};let a=(e.routes||[]).filter(l=>!l.auth||l.auth===!1).map(l=>({url:l.path,lastmod:new Date().toISOString().split("T")[0],changefreq:"weekly",priority:l.path==="/"?"1.0":"0.8"}));if(r.length>0){a.push({url:"/blog",lastmod:r[0]?.date||new Date().toISOString().split("T")[0],changefreq:"weekly",priority:"0.7"});for(let l of r)a.push({url:`/blog/${l.slug}`,lastmod:l.date,changefreq:"monthly",priority:"0.6"})}let i=this.generateSitemapContent(a);return await t("sitemap.xml",i),{fileName:"sitemap.xml",content:i,publicRoutes:a.length}}async generateManifest(e,t,s=null){if(s&&await s("seo-manifest.json"))return this.logger.info("\u2705 seo-manifest.json already exists, skipping generation"),{fileName:"seo-manifest.json",skipped:!0};let r={totalRoutes:e.routes?.length||0,publicRoutes:e.routes?.filter(a=>!a.auth||a.auth===!1).length||0,protectedRoutes:e.routes?.filter(a=>a.auth&&a.auth.required).length||0,baseUrl:this.options.baseUrl,siteName:this.options.siteName,generatedAt:new Date().toISOString(),routeMetaTags:e.routeMetaTags||[]},o=JSON.stringify(r,null,2);return await t("seo-manifest.json",o),{fileName:"seo-manifest.json",content:o,manifest:r}}generateRobotsTxtContent(e={}){let{allowedPaths:t=["/"],disallowedPaths:s=["/admin","/api"],sitemap:r,crawlDelay:o}=e,a=l=>l?l==="*"?"*":l.startsWith("/")?l:`/${l}`:"/",i=["User-agent: *",...s.map(l=>`Disallow: ${a(l)}`),...t.map(l=>`Allow: ${a(l)}`)];return o&&i.push(`Crawl-delay: ${o}`),r&&i.push(`Sitemap: ${r}`),i.join(`
763
+ `},generateManifest:n=>({routes:n?.routes?.length||0,source:n?.source||"unknown",timestamp:Date.now(),errors:n?.errors?.length||0}),logConfig:n=>{},logStats:(n,e,t)=>{let s=n.routes||[],r=s.filter(a=>a.auth&&a.auth.required).length,o=s.length;t&&t.info(`${e} Routes: ${o} found${r>0?`, ${r} are authguarded`:""}`)}},Cs=[n=>n.endsWith("Page.tsx")];function Tt(n={}){return le({pluginName:"dndev-vite-route-discovery",icon:"\u{1F6E3}\uFE0F",virtualModuleId:M.routes,DiscoveryClass:Ie,discoveryMethod:"discoverRoutes",filePatterns:Cs,templates:Is,defaultInspectionPath:j.vite.routeInspection,manifestFileName:j.manifests.route,configKey:"routes"})({...n,disableHmr:n?.hmr===!1,hmrSmartDetection:!1})}import{loadEnv as Ls}from"vite";B();import{readFileSync as Ms,readdirSync as zs,existsSync as js}from"fs";import{join as Ft}from"path";var Ce=class{constructor(e={}){let{debug:t=!1,generateRobotsTxt:s=!0,generateSitemap:r=!0,baseUrl:o,siteName:a,crawlDelay:i=1,routes:l={},...u}=e;if(!o||!a)throw new Error("SEOGenerator requires baseUrl and siteName options");this.options={debug:t,generateRobotsTxt:s,generateSitemap:r,baseUrl:o,siteName:a,crawlDelay:i,routes:l,defaultImage:"/og-image.jpg",twitterHandle:"@donotdev",defaultAuthor:"DNDev Team",defaultLanguage:"en",staticTags:{},...u},this.appRoot=u.appRoot||null,this.logger=F("SEO Generator",e.debug,e.verbose)}async generateSEOFiles(e,t,s=null){try{let r=this.generateRouteMetaTags(e.routes||[]),o={routes:e.routes||[],routeMetaTags:r,baseUrl:this.options.baseUrl,siteName:this.options.siteName},a=this.discoverBlogPosts(),i={robotsTxt:null,sitemap:null,rss:null,manifest:null,totalRoutes:o.routes.length,publicRoutes:o.routes.filter(l=>!l.auth||l.auth===!1).length,protectedRoutes:o.routes.filter(l=>l.auth&&l.auth.required).length,blogPosts:a.length};return this.options.generateRobotsTxt&&(i.robotsTxt=await this.generateRobotsTxt(o,t,s)),this.options.generateSitemap&&(i.sitemap=await this.generateSitemap(o,t,s,a)),a.length>0&&(i.rss=await this.generateRSSFeed(a,t,s)),i.manifest=await this.generateManifest(o,t,s),i}catch(r){throw this.logger.error(`SEO generator failed to create files (robots.txt/sitemap.xml/manifest): ${r.message}`),this.logger.error(`Stack: ${r.stack||"No stack trace available"}`),r}}async generateRobotsTxt(e,t,s=null){if(s&&await s("robots.txt"))return this.logger.info("\u2705 robots.txt already exists, skipping generation"),{fileName:"robots.txt",skipped:!0};let r=[];(e.routes||[]).forEach(a=>{if(a.auth&&a.auth.required){let i=a.path.startsWith("/")?a.path:`/${a.path}`;r.push(i)}}),r.push("/admin","/api","/_next","/static");let o=this.generateRobotsTxtContent({disallowedPaths:[...new Set(r)],sitemap:`${this.options.baseUrl}/sitemap.xml`,crawlDelay:this.options.crawlDelay});return await t("robots.txt",o),{fileName:"robots.txt",content:o,disallowedPaths:r.length}}async generateSitemap(e,t,s=null,r=[]){if(s&&await s("sitemap.xml"))return this.logger.info("\u2705 sitemap.xml already exists, skipping generation"),{fileName:"sitemap.xml",skipped:!0};let a=(e.routes||[]).filter(l=>!l.auth||l.auth===!1).map(l=>({url:l.path,lastmod:new Date().toISOString().split("T")[0],changefreq:"weekly",priority:l.path==="/"?"1.0":"0.8"}));if(r.length>0){a.push({url:"/blog",lastmod:r[0]?.date||new Date().toISOString().split("T")[0],changefreq:"weekly",priority:"0.7"});for(let l of r)a.push({url:`/blog/${l.slug}`,lastmod:l.date,changefreq:"monthly",priority:"0.6"})}let i=this.generateSitemapContent(a);return await t("sitemap.xml",i),{fileName:"sitemap.xml",content:i,publicRoutes:a.length}}async generateManifest(e,t,s=null){if(s&&await s("seo-manifest.json"))return this.logger.info("\u2705 seo-manifest.json already exists, skipping generation"),{fileName:"seo-manifest.json",skipped:!0};let r={totalRoutes:e.routes?.length||0,publicRoutes:e.routes?.filter(a=>!a.auth||a.auth===!1).length||0,protectedRoutes:e.routes?.filter(a=>a.auth&&a.auth.required).length||0,baseUrl:this.options.baseUrl,siteName:this.options.siteName,generatedAt:new Date().toISOString(),routeMetaTags:e.routeMetaTags||[]},o=JSON.stringify(r,null,2);return await t("seo-manifest.json",o),{fileName:"seo-manifest.json",content:o,manifest:r}}generateRobotsTxtContent(e={}){let{allowedPaths:t=["/"],disallowedPaths:s=["/admin","/api"],sitemap:r,crawlDelay:o}=e,a=l=>l?l==="*"?"*":l.startsWith("/")?l:`/${l}`:"/",i=["User-agent: *",...s.map(l=>`Disallow: ${a(l)}`),...t.map(l=>`Allow: ${a(l)}`)];return o&&i.push(`Crawl-delay: ${o}`),r&&i.push(`Sitemap: ${r}`),i.join(`
764
764
  `)}generateSitemapContent(e){return`<?xml version="1.0" encoding="UTF-8"?>
765
765
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
766
766
  ${e.map(({url:s,lastmod:r,changefreq:o,priority:a})=>{let i=[` <loc>${this.options.baseUrl}${s}</loc>`];return r&&i.push(` <lastmod>${r}</lastmod>`),o&&i.push(` <changefreq>${o}</changefreq>`),a&&i.push(` <priority>${a}</priority>`),` <url>
@@ -788,7 +788,7 @@ ${i.join(`
788
788
  <atom:link href="${this.options.baseUrl}/rss.xml" rel="self" type="application/rss+xml"/>
789
789
  ${r}
790
790
  </channel>
791
- </rss>`;return await t("rss.xml",o),{fileName:"rss.xml",content:o,postCount:e.length}}getGenerationSummary(e){let t=e.routes?.length||0,s=e.routes?.filter(o=>!o.auth||o.auth===!1).length||0,r=e.routes?.filter(o=>o.auth&&o.auth.required).length||0;return`${t} routes (${s} public, ${r} protected)`}formatAPIResponse(e){return{totalRoutes:e.routes?.length||0,publicRoutes:e.routes?.filter(t=>!t.auth||t.auth===!1).length||0,protectedRoutes:e.routes?.filter(t=>t.auth&&t.auth.required).length||0,baseUrl:this.options.baseUrl,siteName:this.options.siteName,generatedAt:new Date().toISOString()}}};function It(n={}){let{disabled:e=!1,debug:t,generateRobotsTxt:s,generateSitemap:r,routes:o={},baseUrl:a,siteName:i,crawlDelay:l,isDev:u,...c}=n;if(e)return{name:"seo-disabled"};let p=I("SEO Plugin",t,!0),g=_.getInstance(),d=null,m=null,k=!1;async function T(){try{let v=g.resolveAppPath("src/routes.generated.log"),$=g.readSync(v,{format:"text"});if(!$)return p.error(`SEO plugin: routes discovery file not found at ${v}`),p.error("This indicates route discovery failed or did not run. SEO files will be generated with empty routes."),{routes:[],errors:[`Routes file missing: ${v}`],source:"fallback"};let R=$.match(/export const discoveredRoutes = (\[[\s\S]*?\]);/);if(!R)return p.error(`SEO plugin: failed to parse routes from ${v}`),p.error("Expected format: export const discoveredRoutes = [...];"),p.error("This indicates route discovery generated invalid output. SEO files will be generated with empty routes."),{routes:[],errors:[`Invalid routes file format: ${v}`],source:"fallback"};let y=R[1].replace(/component:\s*\(\)\s*=>\s*Promise\.resolve\(\{[^}]*\}\),?/g,"").replace(/component:\s*\(\)\s*=>\s*import\([^)]*\),?/g,"").replace(/component:\s*[^,}\n]+,?/g,"").replace(/,\s*,/g,",").replace(/,\s*}/g,"}").replace(/,\s*]/g,"]"),S=Function(`"use strict"; return ${y}`)();return{routes:S,errors:[],source:"generated",totalFiles:S.length}}catch(v){return p.warn(`Error parsing generated routes: ${v.message}, falling back to empty routes`),{routes:[],errors:[],source:"fallback"}}}return{name:"vite-seo-plugin",enforce:"pre",configResolved(v){let $=g.getAppRoot(),R=v.mode||"production",S=Ls(R,$,"VITE_").VITE_APP_URL||process.env.VITE_APP_URL||null;S&&t&&p.debug(`Using app URL from VITE_APP_URL: ${S}`),d=i||null,m=a||S||null,p.verbose(`Name: ${d||"Not found"}`),p.verbose(`URL: ${m||"Not found"}`),d&&p.debug(` - Site name from appConfig: "${d}"`);let h=[];if(m||h.push("baseUrl (VITE_APP_URL in .env)"),d||h.push("siteName (APP_NAME in src/config/app.ts)"),h.length>0){k=!0,p.warn("\u26A0\uFE0F SEO Plugin disabled - missing required configuration:"),h.forEach(O=>p.warn(` - ${O}`)),p.warn(""),p.warn(" To fix:"),m||p.warn(" 1. Add VITE_APP_URL=https://yourdomain.com to your .env file"),d||(p.warn(" 2. Add APP_NAME export to src/config/app.ts:"),p.warn(' export const APP_NAME = "Your App Name";')),p.warn(""),p.warn(" robots.txt and sitemap.xml will NOT be generated."),p.warn("");return}p.debug(`Generate robots.txt: ${s}`),p.debug(`Generate sitemap: ${r}`)},async generateBundle(){if(!k)try{let v=new Ce({debug:t,generateRobotsTxt:s,generateSitemap:r,baseUrl:m,siteName:d,crawlDelay:l,routes:o,appRoot:g.getAppRoot(),...c}),$=await T(),R=async(h,O)=>{this.emitFile({type:"asset",fileName:h,source:O})},y=async h=>!1,S=await v.generateSEOFiles($,R,y);S.robotsTxt&&!S.robotsTxt.skipped&&p.info(`\u{1F916} robots.txt: ${S.robotsTxt.disallowedPaths||0} disallowed paths`),S.sitemap&&!S.sitemap.skipped&&p.info(`\u{1F5FA}\uFE0F sitemap.xml: ${S.sitemap.publicRoutes||0} routes`),S.rss&&!S.rss.skipped&&p.info(`\u{1F4E1} rss.xml: ${S.rss.postCount||0} blog posts`),S.manifest&&!S.manifest.skipped&&p.info("\u{1F4C4} seo-manifest.json")}catch(v){p.error(`SEO plugin failed to generate files (robots.txt/sitemap.xml): ${v.message}`),p.error(`Stack: ${v.stack||"No stack trace available"}`)}}}}L();function Ct(n={}){let{debug:e}=n;return{name:"dndev-server-shim",enforce:"pre",resolveId(t,s){return t.startsWith("node:")?(I("server-shim",e,!0).warn(`Blocking Node.js built-in module import: ${t}${s?` from ${s}`:""}`),"\0virtual:empty-server-module"):Be.includes(t)||Be.some(r=>t.startsWith(`${r}/`))?(I("server-shim",e,!0).warn(`Blocking server-only subpath import: ${t}${s?` from ${s}`:""}`),"\0virtual:empty-server-module"):ot.includes(t)?(I("server-shim",e,!0).warn(`Blocking server-only import: ${t}${s?` from ${s}`:""}`),"\0virtual:empty-server-module"):null},load(t){return t==="\0virtual:empty-server-module"?`
791
+ </rss>`;return await t("rss.xml",o),{fileName:"rss.xml",content:o,postCount:e.length}}getGenerationSummary(e){let t=e.routes?.length||0,s=e.routes?.filter(o=>!o.auth||o.auth===!1).length||0,r=e.routes?.filter(o=>o.auth&&o.auth.required).length||0;return`${t} routes (${s} public, ${r} protected)`}formatAPIResponse(e){return{totalRoutes:e.routes?.length||0,publicRoutes:e.routes?.filter(t=>!t.auth||t.auth===!1).length||0,protectedRoutes:e.routes?.filter(t=>t.auth&&t.auth.required).length||0,baseUrl:this.options.baseUrl,siteName:this.options.siteName,generatedAt:new Date().toISOString()}}};function It(n={}){let{disabled:e=!1,debug:t,generateRobotsTxt:s,generateSitemap:r,routes:o={},baseUrl:a,siteName:i,crawlDelay:l,isDev:u,...c}=n;if(e)return{name:"seo-disabled"};let p=F("SEO Plugin",t,!0),g=_.getInstance(),d=null,m=null,k=!1;async function O(){try{let v=g.resolveAppPath("src/routes.generated.log"),D=g.readSync(v,{format:"text"});if(!D)return p.error(`SEO plugin: routes discovery file not found at ${v}`),p.error("This indicates route discovery failed or did not run. SEO files will be generated with empty routes."),{routes:[],errors:[`Routes file missing: ${v}`],source:"fallback"};let R=D.match(/export const discoveredRoutes = (\[[\s\S]*?\]);/);if(!R)return p.error(`SEO plugin: failed to parse routes from ${v}`),p.error("Expected format: export const discoveredRoutes = [...];"),p.error("This indicates route discovery generated invalid output. SEO files will be generated with empty routes."),{routes:[],errors:[`Invalid routes file format: ${v}`],source:"fallback"};let y=R[1].replace(/component:\s*\(\)\s*=>\s*Promise\.resolve\(\{[^}]*\}\),?/g,"").replace(/component:\s*\(\)\s*=>\s*import\([^)]*\),?/g,"").replace(/component:\s*[^,}\n]+,?/g,"").replace(/,\s*,/g,",").replace(/,\s*}/g,"}").replace(/,\s*]/g,"]"),S=Function(`"use strict"; return ${y}`)();return{routes:S,errors:[],source:"generated",totalFiles:S.length}}catch(v){return p.warn(`Error parsing generated routes: ${v.message}, falling back to empty routes`),{routes:[],errors:[],source:"fallback"}}}return{name:"vite-seo-plugin",enforce:"pre",configResolved(v){let D=g.getAppRoot(),R=v.mode||"production",S=Ls(R,D,"VITE_").VITE_APP_URL||process.env.VITE_APP_URL||null;S&&t&&p.debug(`Using app URL from VITE_APP_URL: ${S}`),d=i||null,m=a||S||null,p.verbose(`Name: ${d||"Not found"}`),p.verbose(`URL: ${m||"Not found"}`),d&&p.debug(` - Site name from appConfig: "${d}"`);let h=[];if(m||h.push("baseUrl (VITE_APP_URL in .env)"),d||h.push("siteName (APP_NAME in src/config/app.ts)"),h.length>0){k=!0,p.warn("\u26A0\uFE0F SEO Plugin disabled - missing required configuration:"),h.forEach(N=>p.warn(` - ${N}`)),p.warn(""),p.warn(" To fix:"),m||p.warn(" 1. Add VITE_APP_URL=https://yourdomain.com to your .env file"),d||(p.warn(" 2. Add APP_NAME export to src/config/app.ts:"),p.warn(' export const APP_NAME = "Your App Name";')),p.warn(""),p.warn(" robots.txt and sitemap.xml will NOT be generated."),p.warn("");return}p.debug(`Generate robots.txt: ${s}`),p.debug(`Generate sitemap: ${r}`)},async generateBundle(){if(!k)try{let v=new Ce({debug:t,generateRobotsTxt:s,generateSitemap:r,baseUrl:m,siteName:d,crawlDelay:l,routes:o,appRoot:g.getAppRoot(),...c}),D=await O(),R=async(h,N)=>{this.emitFile({type:"asset",fileName:h,source:N})},y=async h=>!1,S=await v.generateSEOFiles(D,R,y);S.robotsTxt&&!S.robotsTxt.skipped&&p.info(`\u{1F916} robots.txt: ${S.robotsTxt.disallowedPaths||0} disallowed paths`),S.sitemap&&!S.sitemap.skipped&&p.info(`\u{1F5FA}\uFE0F sitemap.xml: ${S.sitemap.publicRoutes||0} routes`),S.rss&&!S.rss.skipped&&p.info(`\u{1F4E1} rss.xml: ${S.rss.postCount||0} blog posts`),S.manifest&&!S.manifest.skipped&&p.info("\u{1F4C4} seo-manifest.json")}catch(v){p.error(`SEO plugin failed to generate files (robots.txt/sitemap.xml): ${v.message}`),p.error(`Stack: ${v.stack||"No stack trace available"}`)}}}}L();function Ct(n={}){let{debug:e}=n;return{name:"dndev-server-shim",enforce:"pre",resolveId(t,s){return t.startsWith("node:")?(F("server-shim",e,!0).warn(`Blocking Node.js built-in module import: ${t}${s?` from ${s}`:""}`),"\0virtual:empty-server-module"):Be.includes(t)||Be.some(r=>t.startsWith(`${r}/`))?(F("server-shim",e,!0).warn(`Blocking server-only subpath import: ${t}${s?` from ${s}`:""}`),"\0virtual:empty-server-module"):ot.includes(t)?(F("server-shim",e,!0).warn(`Blocking server-only import: ${t}${s?` from ${s}`:""}`),"\0virtual:empty-server-module"):null},load(t){return t==="\0virtual:empty-server-module"?`
792
792
  // Node.js built-in modules shims for browser compatibility
793
793
  export const URL = globalThis.URL;
794
794
  export const URLSearchParams = globalThis.URLSearchParams;
@@ -1067,7 +1067,7 @@ ${r}
1067
1067
  // Google Logging Utils shims
1068
1068
  export const LoggingWinston = class LoggingWinston {};
1069
1069
  export const LoggingBunyan = class LoggingBunyan {};
1070
- `:null}}}L();L();var Re=class extends te{constructor(e,t,s={}){super(t,s),this.cssExtractor=e||new ge(t,{debug:s.debug,logger:this.logger}),this.discovered={themes:new Map,variables:{framework:new Set,consumer:new Set},classes:new Set,keyframes:new Set},this._addEssentialThemes()}_getDiscoveryType(){return"Theme"}async _getPatterns(){return await this.pathResolver.resolvePatterns("css")}_getPatternType(){return"css"}async _processFiles(e){this.discovered={themes:new Map,variables:{framework:new Set,consumer:new Set},classes:new Set,keyframes:new Set},this._addEssentialThemes();let{frameworkFiles:t,consumerFiles:s}=e;this.logger.debug(`Scanning ${t.length} framework + ${s.length} consumer CSS files`),this.logger.debug("\u{1F50D} FILES DISCOVERED:"),this.logger.debug("Framework files:",t),this.logger.debug("Consumer files:",s),t.length>0?(this.logger.debug(`Framework files found: ${t.length}`),this.logger.debug("Framework files:",t)):this.logger.debug("No framework files found"),s.length>0?(this.logger.debug(`Consumer files found: ${s.length}`),this.logger.debug("Consumer files:",s)):this.logger.debug("No consumer files found"),await this._processFrameworkFiles(t),await this._processConsumerFiles(s);let r=this._serializeThemes();return this.logger.debug(`Discovered ${r.length} themes:`,r.map(o=>o.name)),{themes:r,variables:{framework:Array.from(this.discovered.variables.framework).sort(),consumer:Array.from(this.discovered.variables.consumer).sort(),all:[...Array.from(this.discovered.variables.framework),...Array.from(this.discovered.variables.consumer)].sort()},classes:Array.from(this.discovered.classes).sort(),keyframes:Array.from(this.discovered.keyframes).sort()}}_getEmptyResult(){let e=this._serializeThemes();return{themes:e.length>0?e:this._getEssentialThemesFallback(),variables:{framework:[],consumer:[],all:[]},classes:[],keyframes:[],timestamp:Date.now()}}_getEssentialThemesFallback(){return He.map(e=>({name:e.name,displayName:e.displayName,meta:{icon:e.icon,category:e.isDark?"dark":"light"},essential:!0,isDark:e.isDark,source:"built-in",variableCount:0}))}_getDiscoverySummary(){return""}async discoverThemes(e=!1){return await this.discover(e)}getThemes(){return this.cache?.themes||[]}getVariables(){return this.cache?.variables||{framework:[],consumer:[],all:[]}}getClasses(){return this.cache?.classes||[]}async _processFrameworkFiles(e){for(let t of e)try{let s=await this.pathResolver.read(t,{format:"text"}),r=this.pathResolver.normalizePath(t);this.cssExtractor.extractThemes(s,r,this.discovered),this.cssExtractor.extractClasses(s,this.discovered),this.cssExtractor.extractVariables(s,this.discovered,"framework"),this.cssExtractor.extractKeyframes(s,this.discovered),this.logger.debug(`\u2705 Processed framework: ${this.pathResolver.getRelativePath(r)}`)}catch(s){this.logger.debug(`Error scanning framework file ${t}: ${s.message}`)}}async _processConsumerFiles(e){for(let t of e)try{let s=await this.pathResolver.read(t,{format:"text"}),r=this.pathResolver.normalizePath(t);this.cssExtractor.extractThemes(s,r,this.discovered),this.cssExtractor.extractVariables(s,this.discovered,"consumer"),this.logger.debug(`\u2705 Processed consumer: ${this.pathResolver.getRelativePath(r)}`)}catch(s){this.logger.debug(`Error scanning consumer file ${t}: ${s.message}`)}}_addEssentialThemes(){He.forEach(e=>{this.discovered.themes.set(e.name,{name:e.name,displayName:e.displayName,meta:{icon:e.icon,category:e.isDark?"dark":"light"},essential:!0,isDark:e.isDark,source:"built-in",variables:new Set})})}_serializeThemes(){return Array.from(this.discovered.themes.values()).map(e=>({name:e.name,displayName:e.displayName,meta:e.meta,source:e.source,essential:e.essential||!1,isDark:e.isDark||!1,variableCount:e.variables?.size||0}))}};var Mt={isEmpty:n=>!n.themes||n.themes.length===0,generateModule:(n,e,t="themes")=>{let{themes:s}=n;if(!s||s.length===0)return Mt.generateEmpty(n,e,void 0,t);let r=s.find(a=>a.essential&&a.name==="light")||s[0],o={totalThemes:s.length,defaultTheme:r?.name||"light",hasCustomThemes:s.some(a=>!a.essential),timestamp:new Date().toISOString()};return`// Virtual module: ${C.themes}
1070
+ `:null}}}L();L();var Re=class extends se{constructor(e,t,s={}){super(t,s),this.cssExtractor=e||new de(t,{debug:s.debug,logger:this.logger}),this.discovered={themes:new Map,variables:{framework:new Set,consumer:new Set},classes:new Set,keyframes:new Set},this._addEssentialThemes()}_getDiscoveryType(){return"Theme"}async _getPatterns(){return await this.pathResolver.resolvePatterns("css")}_getPatternType(){return"css"}async _processFiles(e){this.discovered={themes:new Map,variables:{framework:new Set,consumer:new Set},classes:new Set,keyframes:new Set},this._addEssentialThemes();let{frameworkFiles:t,consumerFiles:s}=e;this.logger.debug(`Scanning ${t.length} framework + ${s.length} consumer CSS files`),this.logger.debug("\u{1F50D} FILES DISCOVERED:"),this.logger.debug("Framework files:",t),this.logger.debug("Consumer files:",s),t.length>0?(this.logger.debug(`Framework files found: ${t.length}`),this.logger.debug("Framework files:",t)):this.logger.debug("No framework files found"),s.length>0?(this.logger.debug(`Consumer files found: ${s.length}`),this.logger.debug("Consumer files:",s)):this.logger.debug("No consumer files found"),await this._processFrameworkFiles(t),await this._processConsumerFiles(s);let r=this._serializeThemes();return this.logger.debug(`Discovered ${r.length} themes:`,r.map(o=>o.name)),{themes:r,variables:{framework:Array.from(this.discovered.variables.framework).sort(),consumer:Array.from(this.discovered.variables.consumer).sort(),all:[...Array.from(this.discovered.variables.framework),...Array.from(this.discovered.variables.consumer)].sort()},classes:Array.from(this.discovered.classes).sort(),keyframes:Array.from(this.discovered.keyframes).sort()}}_getEmptyResult(){let e=this._serializeThemes();return{themes:e.length>0?e:this._getEssentialThemesFallback(),variables:{framework:[],consumer:[],all:[]},classes:[],keyframes:[],timestamp:Date.now()}}_getEssentialThemesFallback(){return He.map(e=>({name:e.name,displayName:e.displayName,meta:{icon:e.icon,category:e.isDark?"dark":"light"},essential:!0,isDark:e.isDark,source:"built-in",variableCount:0}))}_getDiscoverySummary(){return""}async discoverThemes(e=!1){return await this.discover(e)}getThemes(){return this.cache?.themes||[]}getVariables(){return this.cache?.variables||{framework:[],consumer:[],all:[]}}getClasses(){return this.cache?.classes||[]}async _processFrameworkFiles(e){for(let t of e)try{let s=await this.pathResolver.read(t,{format:"text"}),r=this.pathResolver.normalizePath(t);this.cssExtractor.extractThemes(s,r,this.discovered),this.cssExtractor.extractClasses(s,this.discovered),this.cssExtractor.extractVariables(s,this.discovered,"framework"),this.cssExtractor.extractKeyframes(s,this.discovered),this.logger.debug(`\u2705 Processed framework: ${this.pathResolver.getRelativePath(r)}`)}catch(s){this.logger.debug(`Error scanning framework file ${t}: ${s.message}`)}}async _processConsumerFiles(e){for(let t of e)try{let s=await this.pathResolver.read(t,{format:"text"}),r=this.pathResolver.normalizePath(t);this.cssExtractor.extractThemes(s,r,this.discovered),this.cssExtractor.extractVariables(s,this.discovered,"consumer"),this.logger.debug(`\u2705 Processed consumer: ${this.pathResolver.getRelativePath(r)}`)}catch(s){this.logger.debug(`Error scanning consumer file ${t}: ${s.message}`)}}_addEssentialThemes(){He.forEach(e=>{this.discovered.themes.set(e.name,{name:e.name,displayName:e.displayName,meta:{icon:e.icon,category:e.isDark?"dark":"light"},essential:!0,isDark:e.isDark,source:"built-in",variables:new Set})})}_serializeThemes(){return Array.from(this.discovered.themes.values()).map(e=>({name:e.name,displayName:e.displayName,meta:e.meta,source:e.source,essential:e.essential||!1,isDark:e.isDark||!1,variableCount:e.variables?.size||0}))}};var Mt={isEmpty:n=>!n.themes||n.themes.length===0,generateModule:(n,e,t="themes")=>{let{themes:s}=n;if(!s||s.length===0)return Mt.generateEmpty(n,e,void 0,t);let r=s.find(a=>a.essential&&a.name==="light")||s[0],o={totalThemes:s.length,defaultTheme:r?.name||"light",hasCustomThemes:s.some(a=>!a.essential),timestamp:new Date().toISOString()};return`// Virtual module: ${M.themes}
1071
1071
  // \u{1F680} STATIC INJECTION PATTERN - Zero Runtime Loading
1072
1072
  // Generated by @donotdev/config at ${new Date().toISOString()}
1073
1073
 
@@ -1142,7 +1142,7 @@ export default {
1142
1142
  getAllThemes,
1143
1143
  getThemeNames
1144
1144
  };
1145
- `},generateEmpty:(n,e,t,s="themes")=>{let r=n.themes&&n.themes.length>0?n.themes:[{name:"light",displayName:"Light",meta:{icon:"Sun",category:"light"},essential:!0,isDark:!1,source:"built-in",variableCount:0}],o=r.find(i=>i.essential&&i.name==="light")||r[0],a={totalThemes:r.length,defaultTheme:o?.name||"light",hasCustomThemes:r.some(i=>!i.essential),timestamp:new Date().toISOString()};return`// ${C.themes} - Using framework essential themes (fallback)
1145
+ `},generateEmpty:(n,e,t,s="themes")=>{let r=n.themes&&n.themes.length>0?n.themes:[{name:"light",displayName:"Light",meta:{icon:"Sun",category:"light"},essential:!0,isDark:!1,source:"built-in",variableCount:0}],o=r.find(i=>i.essential&&i.name==="light")||r[0],a={totalThemes:r.length,defaultTheme:o?.name||"light",hasCustomThemes:r.some(i=>!i.essential),timestamp:new Date().toISOString()};return`// ${M.themes} - Using framework essential themes (fallback)
1146
1146
  // Generated by @donotdev/config at ${new Date().toISOString()}
1147
1147
 
1148
1148
  export const THEMES = ${JSON.stringify(r,null,2)};
@@ -1228,7 +1228,7 @@ export default discoveredThemes;
1228
1228
  `;let s=t.find(r=>r.essential&&r.name==="light")||t[0];return`/**
1229
1229
  * Generated Theme Discovery Results
1230
1230
  * Generated at: ${new Date().toISOString()}
1231
- * Import from '${C.themes}'
1231
+ * Import from '${M.themes}'
1232
1232
  */
1233
1233
 
1234
1234
  export const discoveredThemes = ${JSON.stringify(t,null,2)};
@@ -1243,8 +1243,8 @@ export const themeManifest = {
1243
1243
  };
1244
1244
 
1245
1245
  export default discoveredThemes;
1246
- `},generateManifest:n=>({themes:n.themes?.length||0,timestamp:Date.now(),hasCustomThemes:n.themes?.some(e=>!e.essential)||!1}),logConfig:n=>{},logStats:(n,e,t)=>{let s=n.themes||[],r=s.filter(a=>!a.essential).length,o=s.length;t&&(o===0?t.warn(`${e} No themes discovered - using framework essential themes fallback`):t.info(`${e} Themes: ${o} discovered${r>0?` (${r} custom)`:""}`))}};function zt(n={}){let e=Date.now();return I("theme-plugin",n.debug,n.verbose).debug("\u{1F3A8} Creating theme discovery plugin..."),ie({pluginName:"dndev-theme",icon:"\u{1F3A8}",virtualModuleId:C.themes,DiscoveryClass:Re,discoveryMethod:"discoverThemes",filePatterns:["**/*.css"],templates:Mt,defaultInspectionPath:j.vite.themeInspection,manifestFileName:j.manifests.theme,configKey:"themes",createDiscovery:(r,o)=>{let a=new ge(r,{debug:o.debug,logger:I("css-extractor",o.debug,o.verbose)});return new Re(a,r,o)}})(n)}B();function jt(n={}){let e=I("vite-plugins",n.debug,n.verbose);try{let{mode:t,debug:s,verbose:r,isDev:o,server:a={},routes:i={},themes:l={},i18n:u={},assets:c={},seo:p={},pwa:g={},serverShim:d={},pluginFactory:m={}}=n,k=i.debug??s,T=l.debug??s,v=u.debug??s,$=c.debug??s,R=d.debug??s,y=[];y.push(Ct({...d,debug:R}));let S;try{S=_.getInstance()}catch(h){throw new Error(`Failed to initialize PathResolver: ${h.message||h}`)}return y.push({name:"dndev-file-watcher-fix",enforce:"pre",configResolved(h){if(s){e.debug("\u{1F4CB} Vite resolved config (configResolved):");let F={root:h.root,mode:h.mode,envDir:h.envDir,base:h.base,build:h.build?{outDir:h.build.outDir,minify:h.build.minify}:void 0,server:h.server?{port:h.server.port,host:h.server.host}:void 0,plugins:h.plugins?{count:h.plugins.length,names:h.plugins.map(K=>K?.name||"unnamed").filter(Boolean)}:void 0};e.debug(JSON.stringify(F,null,2))}S.setAppRoot(h.root);let O=S.getAppRoot();if(o&&h.server?.port){let F=h.server.https?"https":"http";process.env.VITE_APP_URL=`${F}://localhost:${h.server.port}`,(s||r)&&e.debug(`VITE_APP_URL set: ${process.env.VITE_APP_URL}`)}else o&&e.warn("VITE_APP_URL not set in dev mode. Server port not available.");try{let F=S.getRepoRoot();e.verbose(`Repo: ${F}`),e.verbose(`App: ${O}`)}catch(F){e.debug(`Could not log PathResolver values: ${F.message}`)}if(h.server){let F=P=>{let x=P.replace(/\\/g,"/"),W=O.replace(/\\/g,"/");return!x.startsWith(W)};h.server.watch||(h.server.watch={});let K=["**/node_modules/**","**/.git/**","**/dist/**","**/build/**","**/.next/**","**/.turbo/**","**/.vite/**","**/functions/**","**/.generated/**"];h.server.watch={...h.server.watch,ignored:[...h.server.watch.ignored||[],...K,F]},e.verbose(`Fixed file watcher to use app root: ${O}`)}}}),y.push(kt({debug:s,verbose:r})),y.push($t({debug:s})),y.push(Ws({fastRefresh:!0,jsxRuntime:"automatic"})),y.push(Gs({ignoreConfigErrors:!0})),a.https!==!1&&y.push(Us()),y.push(Tt({...m,...i,debug:k})),y.push(zt({...m,...l,debug:T})),y.push(...Et({...m,...u,debug:v})),y.push(yt({...m,...c,debug:$})),y.push(wt({...m,mode:t,debug:s,verbose:r})),y.push(It({...p,debug:s,isDev:o})),g.enabled&&y.push(At({...g,debug:s})),y.push(St({debug:s})),y}catch(t){throw I("vite-plugins",!1,!0).error(`Failed to create Vite plugins: ${t.message}`),t}}L();B();function Bs(){let n=_.getInstance(),e=process.cwd(),t=n.resolvePath("/","/");for(;e!==t;){let s=n.resolvePath("node_modules/@donotdev",e);if(n.pathExists(s,!0))try{return n.readdirSync(s).filter(r=>!r.startsWith(".")).map(r=>`@donotdev/${r}`)}catch{return[]}e=n.resolvePath("..",e)}return[]}function Vs(n){if(!n)return{};let e={};return Array.isArray(n)?n.forEach(({find:t,replacement:s})=>{typeof t=="string"&&(e[t]=s)}):typeof n=="object"&&Object.assign(e,n),e}function Lt(n={}){let{alias:e,...t}=n,{conditions:s,...r}=t;return{alias:{"@":"/src",...Vs(e)},dedupe:["react","react-dom","react-router-dom"],preserveSymlinks:!1,conditions:["browser","module","import","vite-app",...s||[]],...r}}function Ut(n={}){let{include:e=[],exclude:t=[],esbuildOptions:s={},...r}=n,o=Bs(),a=[...e,...me.optionalFeatures,...o],i=[...new Set(a)],l=[...new Set(t)];return{include:i,exclude:l,esbuildOptions:s,...r}}function ur(n={}){return n==null&&(n={}),async(e={})=>{e==null&&(e={});try{let t=process.env.CI==="true";process.env.DNDEV_BUILD_ID||(process.env.DNDEV_BUILD_ID=t?`ci-${Math.random().toString(36).slice(2,9)}`:Math.random().toString(36).slice(2,9));let s=e.command,r=e.mode,{appConfig:o,dndev:a,...i}=n;if(!o)throw new Error(`appConfig is required. Import appConfig from src/config/app.ts and pass it to defineViteConfig({ appConfig, ... })
1247
- Make sure the import statement in vite.config.ts is: import { appConfig } from "./src/config/app";`);if(typeof o!="object"||o===null)throw new Error(`appConfig must be an object, but got ${typeof o}. Make sure you are exporting appConfig from src/config/app.ts correctly.`);let l=o?.features?{debug:o.features.debug}:void 0,u=o?.seo&&typeof o.seo!="boolean"?{...o.seo,siteName:o.seo.siteName||o.app?.name}:o?.app?.name?{siteName:o.app.name}:void 0,{features:c,seo:p,...g}=i,d=o?.app?{name:o.app.name,shortName:o.app.shortName,description:o.app.description}:void 0,{pwa:m={},...k}=g,T={...m,app:m.app||d},v={...l?{features:l}:{},...u?{seo:u}:{},...Object.keys(T).length>0?{pwa:T}:{},...k,mode:r},$;try{$=ft(v)}catch(J){throw new Error(`mergeOptions failed: ${J?.message||J||"Unknown error"}`)}let R;try{R=mt($)}catch(J){throw new Error(`normalizeOptions failed: ${J?.message||J||"Unknown error"}`)}if(!R)throw new Error("normalizeOptions returned undefined");let{mode:y,debug:S,verbose:h,isDev:O,isDebug:F,shouldAnalyze:K,serverOptions:P,previewOptions:x,buildOverrides:W,resolveOptions:be,routeOptions:Z,themeOptions:oe,i18nOptions:D,assetOptions:A,featureOptions:N,seoOptions:z,pwaOptions:de,serverShimOptions:G,chunkingOptions:le,pluginFactoryOptions:ce,base:fe,defineOptions:ze,optimizeDepsOptions:je,pluginsOptions:we,cssOptions:$e,envDir:De,restOptions:ke}=R,f=I("vite-config",S,h);f.debug(`Mode: ${y}, Dev: ${O}`);let b=process.env.DNDEV_BUILD_ID,M;s==="build"?M=`Building for ${y}`:s==="serve"?M=`Development server (${y})`:s==="preview"?M=`Preview server (serving ${y} build)`:M=`Running ${s} (${y})`,f.info(`
1248
- \u{1F3D7}\uFE0F DnDev Framework - ${M}${b?` [build:${b}]`:""}`),f.info(` Platform: Vite | Command: ${s} | Mode: ${y}
1249
- `);let ne=jt({mode:y,debug:S,verbose:h,isDev:O,routes:Z,themes:oe,i18n:D,assets:A,features:N,seo:z,pwa:de,serverShim:G,chunkingOptions:le,pluginFactory:ce});if(!Array.isArray(ne))throw new Error(`createVitePlugins returned ${typeof ne}, expected array. Value: ${ne}`);let se=ut({mode:y,chunkingOptions:le,debug:S,isDev:O,isDebug:F,shouldAnalyze:K}),Zt=pt(P.port||3e3,P,f),Xt=gt(x);if(a)try{let{createDndevPlugin:J}=await Promise.resolve().then(()=>(Kt(),Yt));we.push(J(typeof a=="object"?a:{}))}catch{}return{...fe&&{base:fe},plugins:[...ne,...we],appType:"spa",assetsInclude:["**/*.woff","**/*.woff2","**/*.ttf","**/*.otf","**/*.eot"],...y==="production"&&{build:se},...s==="serve"&&{server:Zt},...s==="preview"&&{preview:Xt},...De&&{envDir:De},customLogger:y==="production"&&!S?(()=>{let J={hasWarned:!1,_shouldSuppress(X){return X.includes("dist/")||X.includes("kB")||X.includes("\u2502")||X.includes("gzip:")||X.includes("\u2713 built in")||X.match(/built in \d+\.\d+s/)},info(X){J._shouldSuppress(X)},warn(X){J._shouldSuppress(X)},error(X){},warnOnce(X){J.hasWarned||(J.hasWarned=!0)},clearScreen(){},hasErrorLogged(){return!1}};return J})():void 0,css:{postcss:vt($e),...$e},optimizeDeps:Ut(je),resolve:Lt(be),define:{...ze,"process.env.NODE_ENV":JSON.stringify(r),__DEV__:JSON.stringify(O),__PROD__:JSON.stringify(!O)},...ke}}catch(t){let s=t||new Error("Unknown error occurred"),r=s?.message||s?.toString()||String(s)||"Unknown error",o=s?.stack||"",a=new Error(`Failed to create Vite config: ${r}${o?`
1246
+ `},generateManifest:n=>({themes:n.themes?.length||0,timestamp:Date.now(),hasCustomThemes:n.themes?.some(e=>!e.essential)||!1}),logConfig:n=>{},logStats:(n,e,t)=>{let s=n.themes||[],r=s.filter(a=>!a.essential).length,o=s.length;t&&(o===0?t.warn(`${e} No themes discovered - using framework essential themes fallback`):t.info(`${e} Themes: ${o} discovered${r>0?` (${r} custom)`:""}`))}};function zt(n={}){let e=Date.now();return F("theme-plugin",n.debug,n.verbose).debug("\u{1F3A8} Creating theme discovery plugin..."),le({pluginName:"dndev-theme",icon:"\u{1F3A8}",virtualModuleId:M.themes,DiscoveryClass:Re,discoveryMethod:"discoverThemes",filePatterns:["**/*.css"],templates:Mt,defaultInspectionPath:j.vite.themeInspection,manifestFileName:j.manifests.theme,configKey:"themes",createDiscovery:(r,o)=>{let a=new de(r,{debug:o.debug,logger:F("css-extractor",o.debug,o.verbose)});return new Re(a,r,o)}})(n)}B();function jt(n={}){let e=F("vite-plugins",n.debug,n.verbose);try{let{mode:t,debug:s,verbose:r,isDev:o,server:a={},routes:i={},themes:l={},i18n:u={},assets:c={},seo:p={},pwa:g={},serverShim:d={},pluginFactory:m={}}=n,k=i.debug??s,O=l.debug??s,v=u.debug??s,D=c.debug??s,R=d.debug??s,y=[];y.push(Ct({...d,debug:R}));let S;try{S=_.getInstance()}catch(h){throw new Error(`Failed to initialize PathResolver: ${h.message||h}`)}return y.push({name:"dndev-file-watcher-fix",enforce:"pre",configResolved(h){if(s){e.debug("\u{1F4CB} Vite resolved config (configResolved):");let T={root:h.root,mode:h.mode,envDir:h.envDir,base:h.base,build:h.build?{outDir:h.build.outDir,minify:h.build.minify}:void 0,server:h.server?{port:h.server.port,host:h.server.host}:void 0,plugins:h.plugins?{count:h.plugins.length,names:h.plugins.map(K=>K?.name||"unnamed").filter(Boolean)}:void 0};e.debug(JSON.stringify(T,null,2))}S.setAppRoot(h.root);let N=S.getAppRoot();if(o&&h.server?.port){let T=h.server.https?"https":"http";process.env.VITE_APP_URL=`${T}://localhost:${h.server.port}`,(s||r)&&e.debug(`VITE_APP_URL set: ${process.env.VITE_APP_URL}`)}else o&&e.warn("VITE_APP_URL not set in dev mode. Server port not available.");try{let T=S.getRepoRoot();e.verbose(`Repo: ${T}`),e.verbose(`App: ${N}`)}catch(T){e.debug(`Could not log PathResolver values: ${T.message}`)}if(h.server){let T=P=>{let x=P.replace(/\\/g,"/"),W=N.replace(/\\/g,"/");return!x.startsWith(W)};h.server.watch||(h.server.watch={});let K=["**/node_modules/**","**/.git/**","**/dist/**","**/build/**","**/.next/**","**/.turbo/**","**/.vite/**","**/functions/**","**/.generated/**"];h.server.watch={...h.server.watch,ignored:[...h.server.watch.ignored||[],...K,T]},e.verbose(`Fixed file watcher to use app root: ${N}`)}}}),y.push(kt({debug:s,verbose:r})),y.push($t({debug:s})),y.push(Ws({fastRefresh:!0,jsxRuntime:"automatic"})),y.push(Gs({ignoreConfigErrors:!0})),a.https!==!1&&y.push(Us()),y.push(Tt({...m,...i,debug:k})),y.push(zt({...m,...l,debug:O})),y.push(...Et({...m,...u,debug:v})),y.push(yt({...m,...c,debug:D})),y.push(wt({...m,mode:t,debug:s,verbose:r})),y.push(It({...p,debug:s,isDev:o})),g.enabled&&y.push(At({...g,debug:s})),y.push(St({debug:s})),y}catch(t){throw F("vite-plugins",!1,!0).error(`Failed to create Vite plugins: ${t.message}`),t}}L();B();function Bs(){let n=_.getInstance(),e=process.cwd(),t=n.resolvePath("/","/");for(;e!==t;){let s=n.resolvePath("node_modules/@donotdev",e);if(n.pathExists(s,!0))try{return n.readdirSync(s).filter(r=>!r.startsWith(".")).map(r=>`@donotdev/${r}`)}catch{return[]}e=n.resolvePath("..",e)}return[]}function Vs(n){if(!n)return{};let e={};return Array.isArray(n)?n.forEach(({find:t,replacement:s})=>{typeof t=="string"&&(e[t]=s)}):typeof n=="object"&&Object.assign(e,n),e}function Lt(n={}){let{alias:e,...t}=n,{conditions:s,...r}=t;return{alias:{"@":"/src",...Vs(e)},dedupe:["react","react-dom","react-router-dom"],preserveSymlinks:!1,conditions:["browser","module","import","vite-app",...s||[]],...r}}function Ut(n={}){let{include:e=[],exclude:t=[],esbuildOptions:s={},...r}=n,o=Bs(),a=[...e,...me.optionalFeatures,...o],i=[...new Set(a)],l=[...new Set(t)];return{include:i,exclude:l,esbuildOptions:s,...r}}function ur(n={}){return n==null&&(n={}),async(e={})=>{e==null&&(e={});try{let t=process.env.CI==="true";process.env.DNDEV_BUILD_ID||(process.env.DNDEV_BUILD_ID=t?`ci-${Math.random().toString(36).slice(2,9)}`:Math.random().toString(36).slice(2,9));let s=e.command,r=e.mode,{appConfig:o,dndev:a,...i}=n;if(!o)throw new Error(`appConfig is required. Import appConfig from src/config/app.ts and pass it to defineViteConfig({ appConfig, ... })
1247
+ Make sure the import statement in vite.config.ts is: import { appConfig } from "./src/config/app";`);if(typeof o!="object"||o===null)throw new Error(`appConfig must be an object, but got ${typeof o}. Make sure you are exporting appConfig from src/config/app.ts correctly.`);let l=o?.features?{debug:o.features.debug}:void 0,u=o?.seo&&typeof o.seo!="boolean"?{...o.seo,siteName:o.seo.siteName||o.app?.name}:o?.app?.name?{siteName:o.app.name}:void 0,{features:c,seo:p,...g}=i,d=o?.app?{name:o.app.name,shortName:o.app.shortName,description:o.app.description}:void 0,{pwa:m={},...k}=g,O={...m,app:m.app||d},v={...l?{features:l}:{},...u?{seo:u}:{},...Object.keys(O).length>0?{pwa:O}:{},...k,mode:r},D;try{D=ft(v)}catch(J){throw new Error(`mergeOptions failed: ${J?.message||J||"Unknown error"}`)}let R;try{R=mt(D)}catch(J){throw new Error(`normalizeOptions failed: ${J?.message||J||"Unknown error"}`)}if(!R)throw new Error("normalizeOptions returned undefined");let{mode:y,debug:S,verbose:h,isDev:N,isDebug:T,shouldAnalyze:K,serverOptions:P,previewOptions:x,buildOverrides:W,resolveOptions:be,routeOptions:Z,themeOptions:ne,i18nOptions:$,assetOptions:A,featureOptions:C,seoOptions:I,pwaOptions:X,serverShimOptions:G,chunkingOptions:ce,pluginFactoryOptions:ue,base:fe,defineOptions:ze,optimizeDepsOptions:je,pluginsOptions:we,cssOptions:$e,envDir:De,restOptions:ke}=R,f=F("vite-config",S,h);f.debug(`Mode: ${y}, Dev: ${N}`);let b=process.env.DNDEV_BUILD_ID,z;s==="build"?z=`Building for ${y}`:s==="serve"?z=`Development server (${y})`:s==="preview"?z=`Preview server (serving ${y} build)`:z=`Running ${s} (${y})`,f.info(`
1248
+ \u{1F3D7}\uFE0F DnDev Framework - ${z}${b?` [build:${b}]`:""}`),f.info(` Platform: Vite | Command: ${s} | Mode: ${y}
1249
+ `);let ae=jt({mode:y,debug:S,verbose:h,isDev:N,routes:Z,themes:ne,i18n:$,assets:A,features:C,seo:I,pwa:X,serverShim:G,chunkingOptions:ce,pluginFactory:ue});if(!Array.isArray(ae))throw new Error(`createVitePlugins returned ${typeof ae}, expected array. Value: ${ae}`);let re=ut({mode:y,chunkingOptions:ce,debug:S,isDev:N,isDebug:T,shouldAnalyze:K}),Zt=pt(P.port||3e3,P,f),Xt=gt(x);if(a)try{let{createDndevPlugin:J}=await Promise.resolve().then(()=>(Kt(),Yt));we.push(J(typeof a=="object"?a:{}))}catch{}return{...fe&&{base:fe},plugins:[...ae,...we],appType:"spa",assetsInclude:["**/*.woff","**/*.woff2","**/*.ttf","**/*.otf","**/*.eot"],...y==="production"&&{build:re},...s==="serve"&&{server:Zt},...s==="preview"&&{preview:Xt},...De&&{envDir:De},customLogger:y==="production"&&!S?(()=>{let J={hasWarned:!1,_shouldSuppress(Q){return Q.includes("dist/")||Q.includes("kB")||Q.includes("\u2502")||Q.includes("gzip:")||Q.includes("\u2713 built in")||Q.match(/built in \d+\.\d+s/)},info(Q){J._shouldSuppress(Q)},warn(Q){J._shouldSuppress(Q)},error(Q){},warnOnce(Q){J.hasWarned||(J.hasWarned=!0)},clearScreen(){},hasErrorLogged(){return!1}};return J})():void 0,css:{postcss:vt($e),...$e},optimizeDeps:Ut(je),resolve:Lt(be),define:{...ze,"process.env.NODE_ENV":JSON.stringify(r),__DEV__:JSON.stringify(N),__PROD__:JSON.stringify(!N)},...ke}}catch(t){let s=t||new Error("Unknown error occurred"),r=s?.message||s?.toString()||String(s)||"Unknown error",o=s?.stack||"",a=new Error(`Failed to create Vite config: ${r}${o?`
1250
1250
  ${o}`:""}`);throw a.stack=o||a.stack,a}}}export{ur as defineViteConfig};